-//= require qs/dist/qs
-
L.extend(L.LatLngBounds.prototype, {
getSize: function () {
return (this._northEast.lat - this._southWest.lat) *
},
updateLayers: function (layerParam) {
- var layers = layerParam || "M";
+ const oldBaseLayer = this.getMapBaseLayer();
+ let newBaseLayer;
- for (let i = this.baseLayers.length - 1; i >= 0; i--) {
- if (layers.indexOf(this.baseLayers[i].options.code) === -1) {
- this.removeLayer(this.baseLayers[i]);
+ for (const layer of this.baseLayers) {
+ if (!newBaseLayer || layerParam.includes(layer.options.code)) {
+ newBaseLayer = layer;
}
}
- for (let i = this.baseLayers.length - 1; i >= 0; i--) {
- if (layers.indexOf(this.baseLayers[i].options.code) >= 0 || i === 0) {
- this.addLayer(this.baseLayers[i]);
- return;
- }
+ if (newBaseLayer !== oldBaseLayer) {
+ if (oldBaseLayer) this.removeLayer(oldBaseLayer);
+ if (newBaseLayer) this.addLayer(newBaseLayer);
}
},
}
var url = window.location.protocol + "//" + OSM.SERVER_URL + "/",
- query = Qs.stringify(params),
+ query = new URLSearchParams(params),
hash = OSM.formatHash(this);
if (query) url += "?" + query;
return (interlaced_x << 1) | interlaced_y;
}
- var params = {};
+ const params = new URLSearchParams();
var layers = this.getLayersCode().replace("M", "");
if (layers) {
- params.layers = layers;
+ params.set("layers", layers);
}
if (marker && this.hasLayer(marker)) {
- params.m = "";
+ params.set("m", "");
}
if (this._object) {
- params[this._object.type] = this._object.id;
+ params.set(this._object.type, this._object.id);
}
- var query = Qs.stringify(params);
+ const query = params.toString();
if (query) {
str += "?" + query;
}