mappe per georeferenziazione
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

108 righe
3.1 KiB

/*
* L.Control.ZoomDisplay shows the current map zoom level
*/
L.Control.ZoomDisplay = L.Control.extend({
options: {
position: 'bottomleft'
},
onAdd: function (map) {
this._map = map;
this._container = L.DomUtil.create('div', 'leaflet-control-zoom-display leaflet-bar-part');
this.updateMapZoom(map.getZoom());
map.on('zoomend', this.onMapZoomEnd, this);
return this._container;
},
onRemove: function (map) {
map.off('zoomend', this.onMapZoomEnd, this);
},
onMapZoomEnd: function (e) {
this.updateMapZoom(this._map.getZoom());
},
updateMapZoom: function (zoom) {
/* */
switch(zoom) {
case 1:
this._container.innerHTML = "scala 250M";
break;
case 2:
this._container.innerHTML = "scala 150M";
break;
case 3:
this._container.innerHTML = "scala 70M";
break;
case 4:
this._container.innerHTML = "scala 35M";
break;
case 5:
this._container.innerHTML = "scala 15M";
break;
case 6:
this._container.innerHTML = "scala 10M";
break;
case 7:
this._container.innerHTML = "scala 4M";
break;
case 8:
this._container.innerHTML = "scala 2M";
break;
case 9:
this._container.innerHTML = "scala 1M";
break;
case 10:
this._container.innerHTML = "scala 500.000";
break;
case 11:
this._container.innerHTML = "scala 250.000";
break;
case 12:
this._container.innerHTML = "scala 150.000";
break;
case 13:
this._container.innerHTML = "scala 70.000";
break;
case 14:
this._container.innerHTML = "scala 35.000";
break;
case 15:
this._container.innerHTML = "scala 15.000";
break;
case 16:
this._container.innerHTML = "scala 8.000";
break;
case 17:
this._container.innerHTML = "scala 4.000";
break;
case 18:
this._container.innerHTML = "scala 2.000";
break;
case 19:
this._container.innerHTML = "scala 1.000";
break;
//default:
// default this._container.innerHTML = zoom;
}
// this._container.innerHTML = zoom+"xxx";
}
});
L.Map.mergeOptions({
zoomDisplayControl: true
});
L.Map.addInitHook(function () {
if (this.options.zoomDisplayControl) {
this.zoomDisplayControl = new L.Control.ZoomDisplay();
this.addControl(this.zoomDisplayControl);
}
});
L.control.zoomDisplay = function (options) {
return new L.Control.ZoomDisplay(options);
};