check-in bower_components
This commit is contained in:
parent
4cc16bccd0
commit
9e08e74132
101 changed files with 90960 additions and 0 deletions
76
bower_components/leaflet-plugins/control/Permalink.Layer.js
vendored
Normal file
76
bower_components/leaflet-plugins/control/Permalink.Layer.js
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
//#include "Permalink.js
|
||||
|
||||
L.Control.Permalink.include({
|
||||
/*
|
||||
options: {
|
||||
useMarker: true,
|
||||
markerOptions: {}
|
||||
},
|
||||
*/
|
||||
|
||||
initialize_layer: function() {
|
||||
//console.info("Initialize layer");
|
||||
this.on('update', this._set_layer, this);
|
||||
this.on('add', this._onadd_layer, this);
|
||||
},
|
||||
|
||||
_onadd_layer: function(e) {
|
||||
//console.info("onAdd::layer", e);
|
||||
this._map.on('layeradd', this._update_layer, this);
|
||||
this._map.on('layerremove', this._update_layer, this);
|
||||
this._update_layer();
|
||||
},
|
||||
|
||||
_update_layer: function() {
|
||||
if (!this.options.layers) return;
|
||||
//console.info(this.options.layers);
|
||||
var layer = this.options.layers.currentBaseLayer();
|
||||
if (layer)
|
||||
this._update({layer: layer.name});
|
||||
},
|
||||
|
||||
_set_layer: function(e) {
|
||||
//console.info("Set layer", e);
|
||||
var p = e.params;
|
||||
if (!this.options.layers || !p.layer) return;
|
||||
this.options.layers.chooseBaseLayer(p.layer);
|
||||
}
|
||||
});
|
||||
|
||||
L.Control.Layers.include({
|
||||
chooseBaseLayer: function(name) {
|
||||
var layer, obj;
|
||||
for (var i in this._layers) {
|
||||
if (!this._layers.hasOwnProperty(i))
|
||||
continue;
|
||||
obj = this._layers[i];
|
||||
if (!obj.overlay && obj.name == name)
|
||||
layer = obj.layer;
|
||||
}
|
||||
if (!layer || this._map.hasLayer(layer))
|
||||
return;
|
||||
|
||||
for (var i in this._layers) {
|
||||
if (!this._layers.hasOwnProperty(i))
|
||||
continue;
|
||||
obj = this._layers[i];
|
||||
if (!obj.overlay && this._map.hasLayer(obj.layer))
|
||||
this._map.removeLayer(obj.layer)
|
||||
}
|
||||
this._map.addLayer(layer)
|
||||
this._update();
|
||||
},
|
||||
|
||||
currentBaseLayer: function() {
|
||||
for (var i in this._layers) {
|
||||
if (!this._layers.hasOwnProperty(i))
|
||||
continue;
|
||||
var obj = this._layers[i];
|
||||
//console.info("Layer: ", obj.name, obj);
|
||||
if (obj.overlay) continue;
|
||||
if (!obj.overlay && this._map.hasLayer(obj.layer))
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue