@nextgis/ngw-leaflet 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ngw-leaflet.esm-browser.js +93 -80
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +2 -2
- package/lib/ngw-leaflet.esm-browser.prod.js.map +1 -1
- package/lib/ngw-leaflet.esm-bundler.js +1 -1
- package/lib/ngw-leaflet.global.js +101 -91
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +2 -2
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 1.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 1.8.0; author: NextGIS */
|
|
2
2
|
function styleInject(css, ref) {
|
|
3
3
|
if ( ref === void 0 ) ref = {};
|
|
4
4
|
var insertAt = ref.insertAt;
|
|
@@ -16674,11 +16674,11 @@ class WebMapLayers extends WebMapMain {
|
|
|
16674
16674
|
const order = l.options.baselayer ? 0 : l.options.order;
|
|
16675
16675
|
// do not show baselayer if another on the map
|
|
16676
16676
|
if (l.options.baselayer && this._baselayers.length) {
|
|
16677
|
-
const
|
|
16677
|
+
const anotherVisibleBaselayers = this._baselayers.filter((x) => {
|
|
16678
16678
|
return x !== l.id && this.isLayerVisible(x);
|
|
16679
16679
|
});
|
|
16680
|
-
|
|
16681
|
-
await this.hideLayer(
|
|
16680
|
+
for (const bl of anotherVisibleBaselayers) {
|
|
16681
|
+
await this.hideLayer(bl);
|
|
16682
16682
|
}
|
|
16683
16683
|
}
|
|
16684
16684
|
if (l.showLayer) {
|
|
@@ -21788,7 +21788,8 @@ class BaseAdapter {
|
|
|
21788
21788
|
this.pane = pane;
|
|
21789
21789
|
}
|
|
21790
21790
|
}
|
|
21791
|
-
addLayer(
|
|
21791
|
+
addLayer(options) {
|
|
21792
|
+
Object.assign(this.options, options);
|
|
21792
21793
|
return undefined;
|
|
21793
21794
|
}
|
|
21794
21795
|
}
|
|
@@ -21807,11 +21808,14 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
21807
21808
|
this.$unselect = () => {
|
|
21808
21809
|
this.unselect();
|
|
21809
21810
|
};
|
|
21810
|
-
this.layer = new leafletSrc.exports.FeatureGroup([], { pane: this.pane });
|
|
21811
21811
|
}
|
|
21812
21812
|
addLayer(options) {
|
|
21813
|
-
this.options
|
|
21813
|
+
Object.assign(this.options, options);
|
|
21814
21814
|
this.paint = options.paint;
|
|
21815
|
+
this.layer = new leafletSrc.exports.FeatureGroup([], {
|
|
21816
|
+
...options.nativeOptions,
|
|
21817
|
+
pane: this.pane,
|
|
21818
|
+
});
|
|
21815
21819
|
this.selectedPaint = options.selectedPaint;
|
|
21816
21820
|
options.paint = this.paint;
|
|
21817
21821
|
if (options.data) {
|
|
@@ -21871,39 +21875,37 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
21871
21875
|
filter(fun) {
|
|
21872
21876
|
// Some optimization
|
|
21873
21877
|
this._filterFun = fun;
|
|
21874
|
-
|
|
21875
|
-
const
|
|
21876
|
-
if (
|
|
21877
|
-
|
|
21878
|
-
|
|
21879
|
-
|
|
21880
|
-
|
|
21881
|
-
|
|
21882
|
-
|
|
21883
|
-
|
|
21884
|
-
|
|
21885
|
-
|
|
21886
|
-
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
|
|
21890
|
-
|
|
21891
|
-
|
|
21892
|
-
|
|
21893
|
-
|
|
21894
|
-
|
|
21895
|
-
|
|
21896
|
-
|
|
21897
|
-
}
|
|
21898
|
-
|
|
21899
|
-
|
|
21900
|
-
|
|
21878
|
+
const layer_ = this.layer;
|
|
21879
|
+
const map = layer_ && layer_._map;
|
|
21880
|
+
if (layer_ && map) {
|
|
21881
|
+
layer_.remove();
|
|
21882
|
+
const filteredLayers = [];
|
|
21883
|
+
this._layers.forEach(({ feature, layer }) => {
|
|
21884
|
+
if (layer) {
|
|
21885
|
+
const ok = fun
|
|
21886
|
+
? fun({
|
|
21887
|
+
target: this,
|
|
21888
|
+
feature,
|
|
21889
|
+
layer,
|
|
21890
|
+
...createFeaturePositionOptions(feature),
|
|
21891
|
+
})
|
|
21892
|
+
: true;
|
|
21893
|
+
if (ok) {
|
|
21894
|
+
layer_.addLayer(layer);
|
|
21895
|
+
filteredLayers.push({
|
|
21896
|
+
target: this,
|
|
21897
|
+
feature,
|
|
21898
|
+
layer,
|
|
21899
|
+
...createFeaturePositionOptions(feature),
|
|
21900
|
+
});
|
|
21901
|
+
}
|
|
21902
|
+
else {
|
|
21903
|
+
layer_.removeLayer(layer);
|
|
21904
|
+
}
|
|
21901
21905
|
}
|
|
21902
|
-
}
|
|
21903
|
-
|
|
21904
|
-
|
|
21905
|
-
if (_map) {
|
|
21906
|
-
this.layer.addTo(_map);
|
|
21906
|
+
});
|
|
21907
|
+
this._filteredLayers = filteredLayers;
|
|
21908
|
+
layer_.addTo(map);
|
|
21907
21909
|
}
|
|
21908
21910
|
return this._filteredLayers;
|
|
21909
21911
|
}
|
|
@@ -21924,24 +21926,27 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
21924
21926
|
}
|
|
21925
21927
|
clearLayer(cb) {
|
|
21926
21928
|
this.unselect();
|
|
21927
|
-
|
|
21928
|
-
|
|
21929
|
-
|
|
21930
|
-
|
|
21931
|
-
const
|
|
21932
|
-
if (
|
|
21933
|
-
const
|
|
21934
|
-
if (
|
|
21935
|
-
|
|
21936
|
-
|
|
21929
|
+
const layer_ = this.layer;
|
|
21930
|
+
if (layer_) {
|
|
21931
|
+
if (cb) {
|
|
21932
|
+
for (let fry = this._layers.length; fry--;) {
|
|
21933
|
+
const def = this._layers[fry];
|
|
21934
|
+
if (def) {
|
|
21935
|
+
const { feature, layer } = def;
|
|
21936
|
+
if (feature && layer) {
|
|
21937
|
+
const exist = cb(feature);
|
|
21938
|
+
if (exist) {
|
|
21939
|
+
layer_.removeLayer(layer);
|
|
21940
|
+
this._layers.splice(fry, 1);
|
|
21941
|
+
}
|
|
21937
21942
|
}
|
|
21938
21943
|
}
|
|
21939
21944
|
}
|
|
21940
21945
|
}
|
|
21941
|
-
|
|
21942
|
-
|
|
21943
|
-
|
|
21944
|
-
|
|
21946
|
+
else {
|
|
21947
|
+
layer_.clearLayers();
|
|
21948
|
+
this._layers = [];
|
|
21949
|
+
}
|
|
21945
21950
|
}
|
|
21946
21951
|
}
|
|
21947
21952
|
setData(data) {
|
|
@@ -22003,8 +22008,10 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
22003
22008
|
return this.getBounds();
|
|
22004
22009
|
}
|
|
22005
22010
|
getBounds() {
|
|
22006
|
-
|
|
22007
|
-
|
|
22011
|
+
if (this.layer) {
|
|
22012
|
+
const bounds = this.layer.getBounds();
|
|
22013
|
+
return boundsToArray(bounds);
|
|
22014
|
+
}
|
|
22008
22015
|
}
|
|
22009
22016
|
setOpacity(value) {
|
|
22010
22017
|
this.options.opacity = value;
|
|
@@ -22219,6 +22226,13 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
22219
22226
|
lopt = this._createPaintOptions(paint, type);
|
|
22220
22227
|
}
|
|
22221
22228
|
lopt.onEachFeature = (feature, layer) => {
|
|
22229
|
+
this._onEachFeature(feature, layer);
|
|
22230
|
+
};
|
|
22231
|
+
return lopt;
|
|
22232
|
+
}
|
|
22233
|
+
_onEachFeature(feature, layer) {
|
|
22234
|
+
const layer_ = this.layer;
|
|
22235
|
+
if (layer_) {
|
|
22222
22236
|
const def = {
|
|
22223
22237
|
target: this,
|
|
22224
22238
|
feature,
|
|
@@ -22236,7 +22250,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
22236
22250
|
const { popup, popupOptions, selectable, interactive, selectOnHover } = this.options;
|
|
22237
22251
|
// @ts-ignore
|
|
22238
22252
|
layer.options.interactive = defined(interactive) ? interactive : true;
|
|
22239
|
-
|
|
22253
|
+
layer_.addLayer(layer);
|
|
22240
22254
|
if (selectable) {
|
|
22241
22255
|
if (selectOnHover) {
|
|
22242
22256
|
layer.on('mouseover', () => {
|
|
@@ -22261,8 +22275,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
22261
22275
|
}
|
|
22262
22276
|
this._updateTooltip({ layer, feature });
|
|
22263
22277
|
}
|
|
22264
|
-
}
|
|
22265
|
-
return lopt;
|
|
22278
|
+
}
|
|
22266
22279
|
}
|
|
22267
22280
|
_handleMouseEvents(layer) {
|
|
22268
22281
|
const isSelected = (l) => this._selectedLayers.indexOf(l) !== -1;
|
|
@@ -22666,7 +22679,6 @@ class ImageLayer extends leafletSrc.exports.Layer {
|
|
|
22666
22679
|
}
|
|
22667
22680
|
}
|
|
22668
22681
|
|
|
22669
|
-
// @ts-ignore
|
|
22670
22682
|
class ImageAdapter extends BaseAdapter {
|
|
22671
22683
|
addLayer(options) {
|
|
22672
22684
|
const url = options && options.url;
|
|
@@ -22678,10 +22690,11 @@ class ImageAdapter extends BaseAdapter {
|
|
|
22678
22690
|
headers: options.headers,
|
|
22679
22691
|
setViewDelay: options.setViewDelay,
|
|
22680
22692
|
/**
|
|
22681
|
-
* TODO: safe remove, use only options.
|
|
22693
|
+
* TODO: safe remove, use only options.nativeOptions
|
|
22682
22694
|
*/
|
|
22683
22695
|
...options,
|
|
22684
22696
|
...options.params,
|
|
22697
|
+
...options.nativeOptions,
|
|
22685
22698
|
});
|
|
22686
22699
|
if (updateWmsParamsFromOpt) {
|
|
22687
22700
|
const updateWmsParams = this.layer.updateWmsParams;
|
|
@@ -22800,33 +22813,33 @@ const WmsLayer = makeRemote(WmsLayerBase);
|
|
|
22800
22813
|
|
|
22801
22814
|
class WmsAdapter extends BaseAdapter {
|
|
22802
22815
|
addLayer(options) {
|
|
22803
|
-
|
|
22804
|
-
|
|
22805
|
-
|
|
22806
|
-
|
|
22807
|
-
|
|
22808
|
-
|
|
22809
|
-
|
|
22810
|
-
|
|
22811
|
-
|
|
22812
|
-
|
|
22813
|
-
|
|
22814
|
-
|
|
22815
|
-
|
|
22816
|
-
|
|
22817
|
-
}
|
|
22818
|
-
else {
|
|
22819
|
-
layer = new leafletSrc.exports.TileLayer.WMS(url, layerOptions);
|
|
22820
|
-
}
|
|
22821
|
-
return layer;
|
|
22816
|
+
Object.assign(this.options, options);
|
|
22817
|
+
const { url, ...opt } = options;
|
|
22818
|
+
if (url) {
|
|
22819
|
+
const layerOptions = {
|
|
22820
|
+
pane: this.pane,
|
|
22821
|
+
attribution: opt.attribution,
|
|
22822
|
+
minZoom: opt.minZoom,
|
|
22823
|
+
maxZoom: opt.maxZoom,
|
|
22824
|
+
layers: options.layers,
|
|
22825
|
+
format: options.format,
|
|
22826
|
+
...options.nativeOptions,
|
|
22827
|
+
};
|
|
22828
|
+
let layer;
|
|
22829
|
+
if (opt.headers) {
|
|
22830
|
+
layer = new WmsLayer(url, { ...layerOptions, headers: opt.headers });
|
|
22822
22831
|
}
|
|
22832
|
+
else {
|
|
22833
|
+
layer = new leafletSrc.exports.TileLayer.WMS(url, layerOptions);
|
|
22834
|
+
}
|
|
22835
|
+
return layer;
|
|
22823
22836
|
}
|
|
22824
22837
|
}
|
|
22825
22838
|
}
|
|
22826
22839
|
|
|
22827
22840
|
class OsmAdapter extends TileAdapter {
|
|
22828
22841
|
addLayer(options) {
|
|
22829
|
-
const url =
|
|
22842
|
+
const url = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
|
22830
22843
|
return super.addLayer({
|
|
22831
22844
|
name: 'OpenStreetMap',
|
|
22832
22845
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|