Loading src/js/leaflet.storage.controls.js +1 −1 Changes for src/js/leaflet.storage.controls.js: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -710,7 +710,7 @@ L.Storage.Map.include({ var appendAll = function () { featuresContainer.innerHTML = ''; filterValue = filter.value; this.eachDataLayerReverse(function (datalayer) { this.eachBrowsableDataLayer(function (datalayer) { append(datalayer); }); }; Loading src/js/leaflet.storage.core.js +2 −1 Changes for src/js/leaflet.storage.core.js: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -427,7 +427,8 @@ L.Storage.Help = L.Class.extend({ interactive: L._('If false, the polygon will act as a part of the underlying map.'), outlink: L._('Define link to open in a new window on polygon click.'), dynamicRemoteData: L._('Fetch data each time map view changes.'), proxyRemoteData: L._('To use if remote server doesn\'t allow cross domain (slower)') proxyRemoteData: L._('To use if remote server doesn\'t allow cross domain (slower)'), browsable: L._('Set it to false to hide this layer from the slideshow, the data browser, the popup navigation…') }); Loading src/js/leaflet.storage.forms.js +1 −1 Changes for src/js/leaflet.storage.forms.js: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -229,7 +229,7 @@ L.FormBuilder.DataLayerSwitcher = L.FormBuilder.Select.extend({ getOptions: function () { var options = []; this.builder.map.eachDataLayerReverse(function (datalayer) { if(datalayer.isLoaded() && !datalayer.isRemoteLayer() && datalayer.isBrowsable()) { if(datalayer.isLoaded() && !datalayer.isRemoteLayer() && datalayer.canBrowse()) { options.push([L.stamp(datalayer), datalayer.getName()]); } }); Loading src/js/leaflet.storage.js +23 −23 Changes for src/js/leaflet.storage.js: 23 added lines, 23 removed lines. Original line number Diff line number Diff line Loading @@ -146,8 +146,10 @@ L.Storage.Map.include({ } delete this.options.displayDataBrowserOnLoad; } this.onceDatalayersLoaded(function () { if (this.options.onLoadPanel === 'databrowser') this.openBrowser(); else if (this.options.onLoadPanel === 'caption') this.displayCaption(); }); this.ui.on('panel:closed', function () { this.invalidateSize({pan: false}); Loading Loading @@ -848,7 +850,7 @@ L.Storage.Map.include({ }, openBrowser: function () { this.whenReady(function () { this.onceDatalayersLoaded(function () { this._openBrowser(); }); }, Loading @@ -869,7 +871,7 @@ L.Storage.Map.include({ description.innerHTML = L.Util.toHTML(this.options.description); } var datalayerContainer = L.DomUtil.create('div', 'datalayer-container', container); this.eachDataLayerReverse(function (datalayer) { this.eachBrowsableDataLayer(function (datalayer) { var p = L.DomUtil.create('p', '', datalayerContainer), color = L.DomUtil.create('span', 'datalayer-color', p), headline = L.DomUtil.create('strong', '', p), Loading Loading @@ -926,12 +928,23 @@ L.Storage.Map.include({ } }, eachDataLayerReverse: function (method, context) { eachDataLayerReverse: function (method, context, filter) { for (var i = this.datalayers_index.length - 1; i >= 0; i--) { if (filter && !filter.call(context, this.datalayers_index[i])) continue; method.call(context, this.datalayers_index[i]); } }, eachBrowsableDataLayer: function (method, context, filter) { this.eachDataLayerReverse(method, context, function (d) { return d.allowBrowse(); }); }, findDataLayer: function (method, context) { for (var i = this.datalayers_index.length - 1; i >= 0; i--) { if (method.call(context, this.datalayers_index[i])) return this.datalayers_index[i]; } }, backup: function () { this.backupOptions(); this._datalayers_index_bk = [].concat(this.datalayers_index); Loading Loading @@ -1111,21 +1124,16 @@ L.Storage.Map.include({ defaultDataLayer: function () { var datalayer, fallback; datalayer = this.lastUsedDataLayer; if (datalayer && !datalayer.isRemoteLayer() && datalayer.isBrowsable() && datalayer.isVisible()) { if (datalayer && !datalayer.isRemoteLayer() && datalayer.canBrowse() && datalayer.isVisible()) { return datalayer; } for (var i in this.datalayers) { if (this.datalayers.hasOwnProperty(i)) { datalayer = this.datalayers[i]; if (!datalayer.isRemoteLayer() && datalayer.isBrowsable()) { if (datalayer.isVisible()) { return datalayer; } else { datalayer = this.findDataLayer(function (datalayer) { if (!datalayer.isRemoteLayer() && datalayer.canBrowse()) { fallback = datalayer; if (datalayer.isVisible()) return true; } } } } }); if (datalayer) return datalayer; if (fallback) { // No datalayer visible, let's force one this.addLayer(fallback.layer); Loading @@ -1135,15 +1143,7 @@ L.Storage.Map.include({ }, getDataLayerByStorageId: function (storage_id) { var datalayer; for (var i in this.datalayers) { if (this.datalayers.hasOwnProperty(i)) { datalayer = this.datalayers[i]; if (datalayer.storage_id == storage_id) { return datalayer; } } } return this.findDataLayer(function (d) { return d.storage_id == storage_id; }); }, edit: function () { Loading src/js/leaflet.storage.layer.js +15 −15 Changes for src/js/leaflet.storage.layer.js: 15 added lines, 15 removed lines. Original line number Diff line number Diff line L.S.Layer = { isBrowsable: true, canBrowse: true, getFeatures: function () { return this._layers; Loading Loading @@ -70,7 +70,7 @@ L.S.Layer.Cluster = L.MarkerClusterGroup.extend({ L.S.Layer.Heat = L.HeatLayer.extend({ _type: 'Heat', includes: [L.S.Layer], isBrowsable: false, canBrowse: false, initialize: function (datalayer) { this.datalayer = datalayer; Loading Loading @@ -138,7 +138,7 @@ L.Storage.DataLayer = L.Class.extend({ options: { displayOnLoad: true, slideshow: true browsable: true }, initialize: function (map, data) { Loading Loading @@ -246,7 +246,7 @@ L.Storage.DataLayer = L.Class.extend({ }, eachFeature: function (method, context) { if (this.layer && this.layer.isBrowsable) { if (this.layer && this.layer.canBrowse) { for (var i = 0; i < this._index.length; i++) { method.call(context || this, this._layers[this._index[i]]); } Loading Loading @@ -703,7 +703,7 @@ L.Storage.DataLayer = L.Class.extend({ 'options.description', ['options.type', {handler: 'LayerTypeChooser', label: L._('Type of layer')}], ['options.displayOnLoad', {label: L._('Display on load'), handler: 'Switch'}], ['options.slideshow', {label: L._('Use in slideshow'), handler: 'Switch'}] ['options.browsable', {label: L._('Data is browsable'), handler: 'Switch', helpEntries: 'browsable'}] ]; var title = L.DomUtil.add('h3', '', container, L._('Layer properties')); var builder = new L.S.FormBuilder(this, metadataFields, { Loading Loading @@ -900,16 +900,16 @@ L.Storage.DataLayer = L.Class.extend({ if (bounds.isValid()) this.map.fitBounds(bounds); }, useForSlideshow: function () { return !!this.options.slideshow && this.isVisible() && this.isBrowsable() && this._index.length; allowBrowse: function () { return !!this.options.browsable && this.canBrowse() && this.isVisible() && this._index.length; }, isVisible: function () { return this.map.hasLayer(this.layer); }, isBrowsable: function () { return this.layer && this.layer.isBrowsable; canBrowse: function () { return this.layer && this.layer.canBrowse; }, getFeatureByIndex: function (index) { Loading @@ -921,28 +921,28 @@ L.Storage.DataLayer = L.Class.extend({ getNextFeature: function (feature) { var id = this._index.indexOf(L.stamp(feature)), nextId = this._index[id + 1]; return nextId? this._layers[nextId]: this.getNextForSlideshow().getFeatureByIndex(0); return nextId? this._layers[nextId]: this.getNextBrowsable().getFeatureByIndex(0); }, getPreviousFeature: function (feature) { if (this._index <= 1) { return null; } var id = this._index.indexOf(L.stamp(feature)), previousId = this._index[id - 1]; return previousId? this._layers[previousId]: this.getPreviousForSlideshow().getFeatureByIndex(-1); return previousId? this._layers[previousId]: this.getPreviousBrowsable().getFeatureByIndex(-1); }, getNextForSlideshow: function () { getNextBrowsable: function () { var id = this.getRank(), next, index = this.map.datalayers_index; while(id = index[++id] ? id : 0, next = index[id]) { if (next === this || next.useForSlideshow()) break; if (next === this || next.allowBrowse()) break; } return next; }, getPreviousForSlideshow: function () { getPreviousBrowsable: function () { var id = this.getRank(), prev, index = this.map.datalayers_index; while(id = index[--id] ? id : index.length - 1, prev = index[id]) { if (prev === this || prev.useForSlideshow()) break; if (prev === this || prev.allowBrowse()) break; } return prev; }, Loading Loading
src/js/leaflet.storage.controls.js +1 −1 Changes for src/js/leaflet.storage.controls.js: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -710,7 +710,7 @@ L.Storage.Map.include({ var appendAll = function () { featuresContainer.innerHTML = ''; filterValue = filter.value; this.eachDataLayerReverse(function (datalayer) { this.eachBrowsableDataLayer(function (datalayer) { append(datalayer); }); }; Loading
src/js/leaflet.storage.core.js +2 −1 Changes for src/js/leaflet.storage.core.js: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -427,7 +427,8 @@ L.Storage.Help = L.Class.extend({ interactive: L._('If false, the polygon will act as a part of the underlying map.'), outlink: L._('Define link to open in a new window on polygon click.'), dynamicRemoteData: L._('Fetch data each time map view changes.'), proxyRemoteData: L._('To use if remote server doesn\'t allow cross domain (slower)') proxyRemoteData: L._('To use if remote server doesn\'t allow cross domain (slower)'), browsable: L._('Set it to false to hide this layer from the slideshow, the data browser, the popup navigation…') }); Loading
src/js/leaflet.storage.forms.js +1 −1 Changes for src/js/leaflet.storage.forms.js: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -229,7 +229,7 @@ L.FormBuilder.DataLayerSwitcher = L.FormBuilder.Select.extend({ getOptions: function () { var options = []; this.builder.map.eachDataLayerReverse(function (datalayer) { if(datalayer.isLoaded() && !datalayer.isRemoteLayer() && datalayer.isBrowsable()) { if(datalayer.isLoaded() && !datalayer.isRemoteLayer() && datalayer.canBrowse()) { options.push([L.stamp(datalayer), datalayer.getName()]); } }); Loading
src/js/leaflet.storage.js +23 −23 Changes for src/js/leaflet.storage.js: 23 added lines, 23 removed lines. Original line number Diff line number Diff line Loading @@ -146,8 +146,10 @@ L.Storage.Map.include({ } delete this.options.displayDataBrowserOnLoad; } this.onceDatalayersLoaded(function () { if (this.options.onLoadPanel === 'databrowser') this.openBrowser(); else if (this.options.onLoadPanel === 'caption') this.displayCaption(); }); this.ui.on('panel:closed', function () { this.invalidateSize({pan: false}); Loading Loading @@ -848,7 +850,7 @@ L.Storage.Map.include({ }, openBrowser: function () { this.whenReady(function () { this.onceDatalayersLoaded(function () { this._openBrowser(); }); }, Loading @@ -869,7 +871,7 @@ L.Storage.Map.include({ description.innerHTML = L.Util.toHTML(this.options.description); } var datalayerContainer = L.DomUtil.create('div', 'datalayer-container', container); this.eachDataLayerReverse(function (datalayer) { this.eachBrowsableDataLayer(function (datalayer) { var p = L.DomUtil.create('p', '', datalayerContainer), color = L.DomUtil.create('span', 'datalayer-color', p), headline = L.DomUtil.create('strong', '', p), Loading Loading @@ -926,12 +928,23 @@ L.Storage.Map.include({ } }, eachDataLayerReverse: function (method, context) { eachDataLayerReverse: function (method, context, filter) { for (var i = this.datalayers_index.length - 1; i >= 0; i--) { if (filter && !filter.call(context, this.datalayers_index[i])) continue; method.call(context, this.datalayers_index[i]); } }, eachBrowsableDataLayer: function (method, context, filter) { this.eachDataLayerReverse(method, context, function (d) { return d.allowBrowse(); }); }, findDataLayer: function (method, context) { for (var i = this.datalayers_index.length - 1; i >= 0; i--) { if (method.call(context, this.datalayers_index[i])) return this.datalayers_index[i]; } }, backup: function () { this.backupOptions(); this._datalayers_index_bk = [].concat(this.datalayers_index); Loading Loading @@ -1111,21 +1124,16 @@ L.Storage.Map.include({ defaultDataLayer: function () { var datalayer, fallback; datalayer = this.lastUsedDataLayer; if (datalayer && !datalayer.isRemoteLayer() && datalayer.isBrowsable() && datalayer.isVisible()) { if (datalayer && !datalayer.isRemoteLayer() && datalayer.canBrowse() && datalayer.isVisible()) { return datalayer; } for (var i in this.datalayers) { if (this.datalayers.hasOwnProperty(i)) { datalayer = this.datalayers[i]; if (!datalayer.isRemoteLayer() && datalayer.isBrowsable()) { if (datalayer.isVisible()) { return datalayer; } else { datalayer = this.findDataLayer(function (datalayer) { if (!datalayer.isRemoteLayer() && datalayer.canBrowse()) { fallback = datalayer; if (datalayer.isVisible()) return true; } } } } }); if (datalayer) return datalayer; if (fallback) { // No datalayer visible, let's force one this.addLayer(fallback.layer); Loading @@ -1135,15 +1143,7 @@ L.Storage.Map.include({ }, getDataLayerByStorageId: function (storage_id) { var datalayer; for (var i in this.datalayers) { if (this.datalayers.hasOwnProperty(i)) { datalayer = this.datalayers[i]; if (datalayer.storage_id == storage_id) { return datalayer; } } } return this.findDataLayer(function (d) { return d.storage_id == storage_id; }); }, edit: function () { Loading
src/js/leaflet.storage.layer.js +15 −15 Changes for src/js/leaflet.storage.layer.js: 15 added lines, 15 removed lines. Original line number Diff line number Diff line L.S.Layer = { isBrowsable: true, canBrowse: true, getFeatures: function () { return this._layers; Loading Loading @@ -70,7 +70,7 @@ L.S.Layer.Cluster = L.MarkerClusterGroup.extend({ L.S.Layer.Heat = L.HeatLayer.extend({ _type: 'Heat', includes: [L.S.Layer], isBrowsable: false, canBrowse: false, initialize: function (datalayer) { this.datalayer = datalayer; Loading Loading @@ -138,7 +138,7 @@ L.Storage.DataLayer = L.Class.extend({ options: { displayOnLoad: true, slideshow: true browsable: true }, initialize: function (map, data) { Loading Loading @@ -246,7 +246,7 @@ L.Storage.DataLayer = L.Class.extend({ }, eachFeature: function (method, context) { if (this.layer && this.layer.isBrowsable) { if (this.layer && this.layer.canBrowse) { for (var i = 0; i < this._index.length; i++) { method.call(context || this, this._layers[this._index[i]]); } Loading Loading @@ -703,7 +703,7 @@ L.Storage.DataLayer = L.Class.extend({ 'options.description', ['options.type', {handler: 'LayerTypeChooser', label: L._('Type of layer')}], ['options.displayOnLoad', {label: L._('Display on load'), handler: 'Switch'}], ['options.slideshow', {label: L._('Use in slideshow'), handler: 'Switch'}] ['options.browsable', {label: L._('Data is browsable'), handler: 'Switch', helpEntries: 'browsable'}] ]; var title = L.DomUtil.add('h3', '', container, L._('Layer properties')); var builder = new L.S.FormBuilder(this, metadataFields, { Loading Loading @@ -900,16 +900,16 @@ L.Storage.DataLayer = L.Class.extend({ if (bounds.isValid()) this.map.fitBounds(bounds); }, useForSlideshow: function () { return !!this.options.slideshow && this.isVisible() && this.isBrowsable() && this._index.length; allowBrowse: function () { return !!this.options.browsable && this.canBrowse() && this.isVisible() && this._index.length; }, isVisible: function () { return this.map.hasLayer(this.layer); }, isBrowsable: function () { return this.layer && this.layer.isBrowsable; canBrowse: function () { return this.layer && this.layer.canBrowse; }, getFeatureByIndex: function (index) { Loading @@ -921,28 +921,28 @@ L.Storage.DataLayer = L.Class.extend({ getNextFeature: function (feature) { var id = this._index.indexOf(L.stamp(feature)), nextId = this._index[id + 1]; return nextId? this._layers[nextId]: this.getNextForSlideshow().getFeatureByIndex(0); return nextId? this._layers[nextId]: this.getNextBrowsable().getFeatureByIndex(0); }, getPreviousFeature: function (feature) { if (this._index <= 1) { return null; } var id = this._index.indexOf(L.stamp(feature)), previousId = this._index[id - 1]; return previousId? this._layers[previousId]: this.getPreviousForSlideshow().getFeatureByIndex(-1); return previousId? this._layers[previousId]: this.getPreviousBrowsable().getFeatureByIndex(-1); }, getNextForSlideshow: function () { getNextBrowsable: function () { var id = this.getRank(), next, index = this.map.datalayers_index; while(id = index[++id] ? id : 0, next = index[id]) { if (next === this || next.useForSlideshow()) break; if (next === this || next.allowBrowse()) break; } return next; }, getPreviousForSlideshow: function () { getPreviousBrowsable: function () { var id = this.getRank(), prev, index = this.map.datalayers_index; while(id = index[--id] ? id : index.length - 1, prev = index[id]) { if (prev === this || prev.useForSlideshow()) break; if (prev === this || prev.allowBrowse()) break; } return prev; }, Loading