@nextgis/leaflet-map-adapter 1.11.7 → 1.12.1
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/README.md +2 -2
- package/lib/index.d.ts +4 -3
- package/lib/leaflet-map-adapter.esm-browser.js +848 -726
- package/lib/leaflet-map-adapter.esm-browser.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-browser.prod.js +17 -3
- package/lib/leaflet-map-adapter.esm-browser.prod.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.js +852 -730
- package/lib/leaflet-map-adapter.esm-bundler.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.prod.js +16 -2
- package/lib/leaflet-map-adapter.esm-bundler.prod.js.map +1 -1
- package/lib/leaflet-map-adapter.global.js +25 -4
- package/lib/leaflet-map-adapter.global.js.map +1 -1
- package/lib/leaflet-map-adapter.global.prod.js +1 -1
- package/lib/leaflet-map-adapter.global.prod.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,4 +1,106 @@
|
|
|
1
|
-
/** Bundle of @nextgis/leaflet-map-adapter; version: 1.
|
|
1
|
+
/** Bundle of @nextgis/leaflet-map-adapter; version: 1.12.1; author: NextGIS */
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */
|
|
16
|
+
/* global Reflect, Promise */
|
|
17
|
+
|
|
18
|
+
var extendStatics = function(d, b) {
|
|
19
|
+
extendStatics = Object.setPrototypeOf ||
|
|
20
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
21
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
22
|
+
return extendStatics(d, b);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function __extends(d, b) {
|
|
26
|
+
if (typeof b !== "function" && b !== null)
|
|
27
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
28
|
+
extendStatics(d, b);
|
|
29
|
+
function __() { this.constructor = d; }
|
|
30
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var __assign = function() {
|
|
34
|
+
__assign = Object.assign || function __assign(t) {
|
|
35
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
36
|
+
s = arguments[i];
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
38
|
+
}
|
|
39
|
+
return t;
|
|
40
|
+
};
|
|
41
|
+
return __assign.apply(this, arguments);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
function __rest(s, e) {
|
|
45
|
+
var t = {};
|
|
46
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
47
|
+
t[p] = s[p];
|
|
48
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
49
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
50
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
51
|
+
t[p[i]] = s[p[i]];
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
57
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
58
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
59
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
60
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
61
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
62
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function __generator(thisArg, body) {
|
|
67
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
68
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
69
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
70
|
+
function step(op) {
|
|
71
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
72
|
+
while (_) try {
|
|
73
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
74
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
75
|
+
switch (op[0]) {
|
|
76
|
+
case 0: case 1: t = op; break;
|
|
77
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
78
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
79
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
80
|
+
default:
|
|
81
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
82
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
83
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
84
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
85
|
+
if (t[2]) _.ops.pop();
|
|
86
|
+
_.trys.pop(); continue;
|
|
87
|
+
}
|
|
88
|
+
op = body.call(thisArg, _);
|
|
89
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
90
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function __spreadArray(to, from, pack) {
|
|
95
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
96
|
+
if (ar || !(i in from)) {
|
|
97
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
98
|
+
ar[i] = from[i];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
102
|
+
}
|
|
103
|
+
|
|
2
104
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
3
105
|
|
|
4
106
|
var events = {exports: {}};
|
|
@@ -14542,22 +14644,23 @@ var leafletSrc = {exports: {}};
|
|
|
14542
14644
|
}(leafletSrc, leafletSrc.exports));
|
|
14543
14645
|
|
|
14544
14646
|
function convertMapClickEvent(evt) {
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14647
|
+
var coord = evt.containerPoint;
|
|
14648
|
+
var latLng = evt.latlng;
|
|
14649
|
+
var lat = latLng.lat, lng = latLng.lng;
|
|
14548
14650
|
return {
|
|
14549
|
-
latLng,
|
|
14651
|
+
latLng: latLng,
|
|
14550
14652
|
lngLat: [lng, lat],
|
|
14551
14653
|
pixel: { left: coord.x, top: coord.y },
|
|
14552
14654
|
source: evt,
|
|
14553
14655
|
};
|
|
14554
14656
|
}
|
|
14555
14657
|
|
|
14556
|
-
function createControl(control, options
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14658
|
+
function createControl(control, options, map) {
|
|
14659
|
+
if (options === void 0) { options = {}; }
|
|
14660
|
+
var C = leafletSrc.exports.Control.extend({
|
|
14661
|
+
onAdd: function () {
|
|
14662
|
+
var element = document.createElement('div');
|
|
14663
|
+
var content = control.onAdd(map);
|
|
14561
14664
|
element.classList.add('leaflet-control');
|
|
14562
14665
|
if (options.bar) {
|
|
14563
14666
|
element.classList.add('leaflet-bar');
|
|
@@ -14577,7 +14680,7 @@ function createControl(control, options = {}, map) {
|
|
|
14577
14680
|
leafletSrc.exports.DomEvent.disableClickPropagation(element);
|
|
14578
14681
|
return element;
|
|
14579
14682
|
},
|
|
14580
|
-
onRemove() {
|
|
14683
|
+
onRemove: function () {
|
|
14581
14684
|
control.onRemove();
|
|
14582
14685
|
},
|
|
14583
14686
|
});
|
|
@@ -14585,12 +14688,15 @@ function createControl(control, options = {}, map) {
|
|
|
14585
14688
|
}
|
|
14586
14689
|
|
|
14587
14690
|
function createButtonControl(options, map) {
|
|
14588
|
-
|
|
14589
|
-
|
|
14691
|
+
var link = document.createElement('a');
|
|
14692
|
+
var title = options.title || '';
|
|
14590
14693
|
link.href = '#';
|
|
14591
14694
|
link.title = title;
|
|
14592
14695
|
link.setAttribute('role', 'button');
|
|
14593
14696
|
link.setAttribute('aria-label', title);
|
|
14697
|
+
if (options.addClass) {
|
|
14698
|
+
link.classList.add(options.addClass);
|
|
14699
|
+
}
|
|
14594
14700
|
leafletSrc.exports.DomEvent.disableClickPropagation(link);
|
|
14595
14701
|
leafletSrc.exports.DomEvent.on(link, 'click', leafletSrc.exports.DomEvent.stop);
|
|
14596
14702
|
if (options.html instanceof HTMLElement) {
|
|
@@ -14599,19 +14705,19 @@ function createButtonControl(options, map) {
|
|
|
14599
14705
|
else if (typeof options.html === 'string') {
|
|
14600
14706
|
link.innerHTML = options.html;
|
|
14601
14707
|
}
|
|
14602
|
-
|
|
14708
|
+
var onClick = function (e) {
|
|
14603
14709
|
e.stopPropagation();
|
|
14604
14710
|
options.onClick();
|
|
14605
14711
|
};
|
|
14606
14712
|
return createControl({
|
|
14607
|
-
onAdd() {
|
|
14713
|
+
onAdd: function () {
|
|
14608
14714
|
if (options.onClick !== undefined) {
|
|
14609
14715
|
link.addEventListener('click', onClick);
|
|
14610
14716
|
}
|
|
14611
14717
|
return link;
|
|
14612
14718
|
},
|
|
14613
|
-
onRemove() {
|
|
14614
|
-
|
|
14719
|
+
onRemove: function () {
|
|
14720
|
+
var parent = link.parentNode;
|
|
14615
14721
|
if (parent) {
|
|
14616
14722
|
parent.removeChild(link);
|
|
14617
14723
|
}
|
|
@@ -14622,23 +14728,26 @@ function createButtonControl(options, map) {
|
|
|
14622
14728
|
}, { bar: true }, map);
|
|
14623
14729
|
}
|
|
14624
14730
|
|
|
14625
|
-
|
|
14731
|
+
var AttributionControl = /** @class */ (function (_super) {
|
|
14732
|
+
__extends(AttributionControl, _super);
|
|
14626
14733
|
// options: AttributionControlOptions
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14734
|
+
function AttributionControl(options) {
|
|
14735
|
+
var _this = _super.call(this, options) || this;
|
|
14736
|
+
var customAttribution = options && options.customAttribution;
|
|
14630
14737
|
if (customAttribution) {
|
|
14631
|
-
|
|
14738
|
+
var attributions = [];
|
|
14632
14739
|
if (Array.isArray(customAttribution)) {
|
|
14633
14740
|
attributions = customAttribution;
|
|
14634
14741
|
}
|
|
14635
14742
|
else if (customAttribution) {
|
|
14636
14743
|
attributions = [customAttribution];
|
|
14637
14744
|
}
|
|
14638
|
-
attributions.forEach((x)
|
|
14745
|
+
attributions.forEach(function (x) { return _this.addAttribution(x); });
|
|
14639
14746
|
}
|
|
14747
|
+
return _this;
|
|
14640
14748
|
}
|
|
14641
|
-
|
|
14749
|
+
return AttributionControl;
|
|
14750
|
+
}(leafletSrc.exports.Control.Attribution));
|
|
14642
14751
|
|
|
14643
14752
|
/**
|
|
14644
14753
|
* from https://github.com/CesiumGS/cesium/blob/master/Source/Core/defined.js
|
|
@@ -14660,13 +14769,19 @@ function defined(val) {
|
|
|
14660
14769
|
}
|
|
14661
14770
|
|
|
14662
14771
|
// based on https://github.com/bvaughn/debounce-decorator
|
|
14663
|
-
function debounce(cb, wait
|
|
14664
|
-
|
|
14665
|
-
|
|
14772
|
+
function debounce(cb, wait) {
|
|
14773
|
+
if (wait === void 0) { wait = 10; }
|
|
14774
|
+
var timeoutId;
|
|
14775
|
+
function wrapper() {
|
|
14776
|
+
var _this = this;
|
|
14777
|
+
var args = [];
|
|
14778
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
14779
|
+
args[_i] = arguments[_i];
|
|
14780
|
+
}
|
|
14666
14781
|
wrapper.clear();
|
|
14667
|
-
timeoutId = setTimeout(()
|
|
14782
|
+
timeoutId = setTimeout(function () {
|
|
14668
14783
|
timeoutId = null;
|
|
14669
|
-
cb.apply(
|
|
14784
|
+
cb.apply(_this, args);
|
|
14670
14785
|
}, wait);
|
|
14671
14786
|
}
|
|
14672
14787
|
wrapper.clear = function () {
|
|
@@ -14692,12 +14807,12 @@ function isPaintCallback(paint) {
|
|
|
14692
14807
|
}
|
|
14693
14808
|
|
|
14694
14809
|
function boundsToArray(bounds) {
|
|
14695
|
-
|
|
14696
|
-
|
|
14810
|
+
var ne = bounds.getNorthEast();
|
|
14811
|
+
var sw = bounds.getSouthWest();
|
|
14697
14812
|
return [sw.lng, sw.lat, ne.lng, ne.lat];
|
|
14698
14813
|
}
|
|
14699
14814
|
|
|
14700
|
-
|
|
14815
|
+
var typeAlias = {
|
|
14701
14816
|
Point: 'point',
|
|
14702
14817
|
LineString: 'line',
|
|
14703
14818
|
MultiPoint: 'point',
|
|
@@ -14706,79 +14821,78 @@ const typeAlias = {
|
|
|
14706
14821
|
MultiPolygon: 'polygon',
|
|
14707
14822
|
GeometryCollection: 'polygon',
|
|
14708
14823
|
};
|
|
14709
|
-
|
|
14824
|
+
var PAINT = {
|
|
14710
14825
|
stroke: false,
|
|
14711
14826
|
opacity: 1,
|
|
14712
14827
|
};
|
|
14713
|
-
|
|
14714
|
-
for (
|
|
14715
|
-
|
|
14716
|
-
|
|
14828
|
+
var backAliases = {};
|
|
14829
|
+
for (var a in typeAlias) {
|
|
14830
|
+
var layerType = typeAlias[a];
|
|
14831
|
+
var backAlias = backAliases[layerType] || [];
|
|
14717
14832
|
backAlias.push(a);
|
|
14718
14833
|
backAliases[layerType] = backAlias;
|
|
14719
14834
|
}
|
|
14720
14835
|
function geometryFilter(geometry, type) {
|
|
14721
|
-
|
|
14836
|
+
var geoJsonGeometry = backAliases[type] || [];
|
|
14722
14837
|
return geoJsonGeometry.indexOf(geometry) !== -1;
|
|
14723
14838
|
}
|
|
14724
14839
|
function filterGeometries(data, type) {
|
|
14725
14840
|
if (data.type === 'FeatureCollection') {
|
|
14726
|
-
|
|
14727
|
-
_data.features = _data.features.filter((f)
|
|
14841
|
+
var _data = data;
|
|
14842
|
+
_data.features = _data.features.filter(function (f) {
|
|
14843
|
+
return geometryFilter(f.geometry.type, type);
|
|
14844
|
+
});
|
|
14728
14845
|
}
|
|
14729
14846
|
else if (data.type === 'Feature') {
|
|
14730
|
-
|
|
14847
|
+
var allow = geometryFilter(data.geometry.type, type);
|
|
14731
14848
|
if (!allow) {
|
|
14732
14849
|
return false;
|
|
14733
14850
|
}
|
|
14734
14851
|
}
|
|
14735
14852
|
else if (data.type === 'GeometryCollection') {
|
|
14736
|
-
|
|
14737
|
-
_data.geometries = _data.geometries.filter((g)
|
|
14853
|
+
var _data = data;
|
|
14854
|
+
_data.geometries = _data.geometries.filter(function (g) {
|
|
14855
|
+
return geometryFilter(g.type, type);
|
|
14856
|
+
});
|
|
14738
14857
|
}
|
|
14739
14858
|
return data;
|
|
14740
14859
|
}
|
|
14741
14860
|
function featuresBounds(features) {
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
features_.forEach((f)
|
|
14861
|
+
var geoJsonLayer = new leafletSrc.exports.GeoJSON();
|
|
14862
|
+
var features_ = Array.isArray(features) ? features : [features];
|
|
14863
|
+
features_.forEach(function (f) { return geoJsonLayer.addData(f); });
|
|
14745
14864
|
return geoJsonLayer.getBounds();
|
|
14746
14865
|
}
|
|
14747
14866
|
function getFeaturesBounds(features) {
|
|
14748
14867
|
return boundsToArray(featuresBounds(features));
|
|
14749
14868
|
}
|
|
14750
14869
|
function getFeaturesCenter(features) {
|
|
14751
|
-
|
|
14870
|
+
var _a = featuresBounds(features).getCenter(), lat = _a.lat, lng = _a.lng;
|
|
14752
14871
|
return [lng, lat];
|
|
14753
14872
|
}
|
|
14754
14873
|
function createFeaturePositionOptions(features) {
|
|
14755
14874
|
return {
|
|
14756
|
-
getBounds: ()
|
|
14757
|
-
getCenter: ()
|
|
14875
|
+
getBounds: function () { return getFeaturesBounds(features); },
|
|
14876
|
+
getCenter: function () { return getFeaturesCenter(features); },
|
|
14758
14877
|
};
|
|
14759
14878
|
}
|
|
14760
14879
|
|
|
14761
|
-
function createMouseEvent(
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
feature,
|
|
14767
|
-
event: convertMapClickEvent(source),
|
|
14768
|
-
source,
|
|
14769
|
-
...createFeaturePositionOptions(feature),
|
|
14770
|
-
};
|
|
14880
|
+
function createMouseEvent(_a) {
|
|
14881
|
+
var layer = _a.layer, source = _a.source;
|
|
14882
|
+
var layer_ = source.target;
|
|
14883
|
+
var feature = layer_.feature;
|
|
14884
|
+
var opt = __assign({ layer: layer, feature: feature, event: convertMapClickEvent(source), source: source }, createFeaturePositionOptions(feature));
|
|
14771
14885
|
return opt;
|
|
14772
14886
|
}
|
|
14773
14887
|
|
|
14774
14888
|
function findMostFrequentGeomType(arr) {
|
|
14775
|
-
|
|
14776
|
-
for (
|
|
14889
|
+
var counts = {};
|
|
14890
|
+
for (var fry = 0; fry < arr.length; fry++) {
|
|
14777
14891
|
counts[arr[fry]] = 1 + (counts[arr[fry]] || 0);
|
|
14778
14892
|
}
|
|
14779
|
-
|
|
14780
|
-
for (
|
|
14781
|
-
|
|
14893
|
+
var maxName = '';
|
|
14894
|
+
for (var c in counts) {
|
|
14895
|
+
var maxCount = maxName ? counts[maxName] : 0;
|
|
14782
14896
|
if (counts[c] > maxCount) {
|
|
14783
14897
|
maxName = c;
|
|
14784
14898
|
}
|
|
@@ -14786,13 +14900,13 @@ function findMostFrequentGeomType(arr) {
|
|
|
14786
14900
|
return maxName;
|
|
14787
14901
|
}
|
|
14788
14902
|
function detectType(geojson) {
|
|
14789
|
-
|
|
14903
|
+
var geometry;
|
|
14790
14904
|
if (geojson.type === 'FeatureCollection') {
|
|
14791
|
-
|
|
14905
|
+
var featuresTypes = geojson.features.map(function (f) { return f.geometry.type; });
|
|
14792
14906
|
geometry = findMostFrequentGeomType(featuresTypes);
|
|
14793
14907
|
}
|
|
14794
14908
|
else if (geojson.type === 'GeometryCollection') {
|
|
14795
|
-
|
|
14909
|
+
var geometryTypes = geojson.geometries.map(function (g) { return g.type; });
|
|
14796
14910
|
geometry = findMostFrequentGeomType(geometryTypes);
|
|
14797
14911
|
}
|
|
14798
14912
|
else if (geojson.type === 'Feature') {
|
|
@@ -14804,14 +14918,14 @@ function detectType(geojson) {
|
|
|
14804
14918
|
return geometry;
|
|
14805
14919
|
}
|
|
14806
14920
|
|
|
14807
|
-
|
|
14808
|
-
|
|
14921
|
+
var BaseAdapter = /** @class */ (function () {
|
|
14922
|
+
function BaseAdapter(map, options) {
|
|
14809
14923
|
this.map = map;
|
|
14810
14924
|
this.options = options;
|
|
14811
14925
|
this.pane = 'order-0';
|
|
14812
14926
|
if (options.order !== undefined) {
|
|
14813
|
-
|
|
14814
|
-
|
|
14927
|
+
var pane = 'order-' + options.order;
|
|
14928
|
+
var exist = map.getPane(pane);
|
|
14815
14929
|
if (!exist) {
|
|
14816
14930
|
exist = map.createPane(pane);
|
|
14817
14931
|
}
|
|
@@ -14819,34 +14933,34 @@ class BaseAdapter {
|
|
|
14819
14933
|
this.pane = pane;
|
|
14820
14934
|
}
|
|
14821
14935
|
}
|
|
14822
|
-
addLayer(options) {
|
|
14936
|
+
BaseAdapter.prototype.addLayer = function (options) {
|
|
14823
14937
|
Object.assign(this.options, options);
|
|
14824
14938
|
return undefined;
|
|
14825
|
-
}
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14939
|
+
};
|
|
14940
|
+
return BaseAdapter;
|
|
14941
|
+
}());
|
|
14942
|
+
|
|
14943
|
+
var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
14944
|
+
__extends(GeoJsonAdapter, _super);
|
|
14945
|
+
function GeoJsonAdapter(map, options) {
|
|
14946
|
+
var _this = _super.call(this, map, options) || this;
|
|
14947
|
+
_this.selected = false;
|
|
14948
|
+
_this._layers = [];
|
|
14949
|
+
_this._selectedLayers = [];
|
|
14950
|
+
_this._filteredLayers = [];
|
|
14951
|
+
_this._openedPopup = [];
|
|
14952
|
+
_this.$updateTooltip = debounce(function () {
|
|
14953
|
+
_this.updateTooltip();
|
|
14838
14954
|
}, 300);
|
|
14839
|
-
|
|
14840
|
-
|
|
14955
|
+
_this.$unselect = function () {
|
|
14956
|
+
_this.unselect();
|
|
14841
14957
|
};
|
|
14958
|
+
return _this;
|
|
14842
14959
|
}
|
|
14843
|
-
addLayer(options) {
|
|
14960
|
+
GeoJsonAdapter.prototype.addLayer = function (options) {
|
|
14844
14961
|
Object.assign(this.options, options);
|
|
14845
14962
|
this.paint = options.paint;
|
|
14846
|
-
this.layer = new leafletSrc.exports.FeatureGroup([], {
|
|
14847
|
-
...options.nativeOptions,
|
|
14848
|
-
pane: this.pane,
|
|
14849
|
-
});
|
|
14963
|
+
this.layer = new leafletSrc.exports.FeatureGroup([], __assign(__assign({}, options.nativeOptions), { pane: this.pane }));
|
|
14850
14964
|
this.selectedPaint = options.selectedPaint;
|
|
14851
14965
|
options.paint = this.paint;
|
|
14852
14966
|
if (options.data) {
|
|
@@ -14854,15 +14968,16 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
14854
14968
|
}
|
|
14855
14969
|
this._addMapListener();
|
|
14856
14970
|
return this.layer;
|
|
14857
|
-
}
|
|
14858
|
-
beforeRemove() {
|
|
14971
|
+
};
|
|
14972
|
+
GeoJsonAdapter.prototype.beforeRemove = function () {
|
|
14859
14973
|
this._removeMapListener();
|
|
14860
|
-
}
|
|
14861
|
-
select(findFeatureFun) {
|
|
14974
|
+
};
|
|
14975
|
+
GeoJsonAdapter.prototype.select = function (findFeatureFun) {
|
|
14976
|
+
var _this = this;
|
|
14862
14977
|
if (findFeatureFun) {
|
|
14863
|
-
|
|
14864
|
-
def.forEach((x)
|
|
14865
|
-
|
|
14978
|
+
var def = this._layers.filter(findFeatureFun);
|
|
14979
|
+
def.forEach(function (x) {
|
|
14980
|
+
_this._selectLayer(x, 'api');
|
|
14866
14981
|
});
|
|
14867
14982
|
}
|
|
14868
14983
|
else if (!this.selected) {
|
|
@@ -14871,16 +14986,18 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
14871
14986
|
this._setPaintEachLayer(this.selectedPaint);
|
|
14872
14987
|
}
|
|
14873
14988
|
}
|
|
14874
|
-
}
|
|
14875
|
-
unselect(findFeatureFun) {
|
|
14989
|
+
};
|
|
14990
|
+
GeoJsonAdapter.prototype.unselect = function (findFeatureFun) {
|
|
14991
|
+
var _this = this;
|
|
14876
14992
|
if (findFeatureFun) {
|
|
14877
|
-
|
|
14878
|
-
feature.forEach((x)
|
|
14879
|
-
|
|
14993
|
+
var feature = this._layers.filter(findFeatureFun);
|
|
14994
|
+
feature.forEach(function (x) {
|
|
14995
|
+
_this._unSelectLayer(x);
|
|
14880
14996
|
});
|
|
14881
14997
|
}
|
|
14882
14998
|
else if (this.selected) {
|
|
14883
|
-
for (
|
|
14999
|
+
for (var _i = 0, _a = this._openedPopup; _i < _a.length; _i++) {
|
|
15000
|
+
var p = _a[_i];
|
|
14884
15001
|
this._removePopup(p[0]);
|
|
14885
15002
|
}
|
|
14886
15003
|
if (this.paint) {
|
|
@@ -14889,83 +15006,67 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
14889
15006
|
this._selectedLayers.length = 0;
|
|
14890
15007
|
this.selected = false;
|
|
14891
15008
|
}
|
|
14892
|
-
}
|
|
14893
|
-
getSelected() {
|
|
14894
|
-
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
feature: x.feature,
|
|
14898
|
-
layer: x,
|
|
14899
|
-
...createFeaturePositionOptions(x.feature),
|
|
14900
|
-
};
|
|
15009
|
+
};
|
|
15010
|
+
GeoJsonAdapter.prototype.getSelected = function () {
|
|
15011
|
+
var _this = this;
|
|
15012
|
+
return this._selectedLayers.map(function (x) {
|
|
15013
|
+
return __assign({ target: _this, feature: x.feature, layer: x }, createFeaturePositionOptions(x.feature));
|
|
14901
15014
|
});
|
|
14902
|
-
}
|
|
14903
|
-
getFiltered() {
|
|
15015
|
+
};
|
|
15016
|
+
GeoJsonAdapter.prototype.getFiltered = function () {
|
|
14904
15017
|
return this._filteredLayers;
|
|
14905
|
-
}
|
|
14906
|
-
filter(fun) {
|
|
15018
|
+
};
|
|
15019
|
+
GeoJsonAdapter.prototype.filter = function (fun) {
|
|
15020
|
+
var _this = this;
|
|
14907
15021
|
// Some optimization
|
|
14908
15022
|
this._filterFun = fun;
|
|
14909
|
-
|
|
14910
|
-
|
|
15023
|
+
var layer_ = this.layer;
|
|
15024
|
+
var map = layer_ && layer_._map;
|
|
14911
15025
|
if (layer_ && map) {
|
|
14912
15026
|
layer_.remove();
|
|
14913
|
-
|
|
14914
|
-
this._layers.forEach((
|
|
15027
|
+
var filteredLayers_1 = [];
|
|
15028
|
+
this._layers.forEach(function (_a) {
|
|
15029
|
+
var feature = _a.feature, layer = _a.layer;
|
|
14915
15030
|
if (layer) {
|
|
14916
|
-
|
|
14917
|
-
? fun({
|
|
14918
|
-
target: this,
|
|
14919
|
-
feature,
|
|
14920
|
-
layer,
|
|
14921
|
-
...createFeaturePositionOptions(feature),
|
|
14922
|
-
})
|
|
15031
|
+
var ok = fun
|
|
15032
|
+
? fun(__assign({ target: _this, feature: feature, layer: layer }, createFeaturePositionOptions(feature)))
|
|
14923
15033
|
: true;
|
|
14924
15034
|
if (ok) {
|
|
14925
15035
|
layer_.addLayer(layer);
|
|
14926
|
-
|
|
14927
|
-
target: this,
|
|
14928
|
-
feature,
|
|
14929
|
-
layer,
|
|
14930
|
-
...createFeaturePositionOptions(feature),
|
|
14931
|
-
});
|
|
15036
|
+
filteredLayers_1.push(__assign({ target: _this, feature: feature, layer: layer }, createFeaturePositionOptions(feature)));
|
|
14932
15037
|
}
|
|
14933
15038
|
else {
|
|
14934
15039
|
layer_.removeLayer(layer);
|
|
14935
15040
|
}
|
|
14936
15041
|
}
|
|
14937
15042
|
});
|
|
14938
|
-
this._filteredLayers =
|
|
15043
|
+
this._filteredLayers = filteredLayers_1;
|
|
14939
15044
|
layer_.addTo(map);
|
|
14940
15045
|
}
|
|
14941
15046
|
return this._filteredLayers;
|
|
14942
|
-
}
|
|
14943
|
-
cleanFilter() {
|
|
15047
|
+
};
|
|
15048
|
+
GeoJsonAdapter.prototype.cleanFilter = function () {
|
|
14944
15049
|
this.filter();
|
|
14945
|
-
}
|
|
14946
|
-
getLayers() {
|
|
14947
|
-
|
|
14948
|
-
|
|
14949
|
-
|
|
14950
|
-
|
|
14951
|
-
|
|
14952
|
-
visible,
|
|
14953
|
-
target: this,
|
|
14954
|
-
...createFeaturePositionOptions(feature),
|
|
14955
|
-
};
|
|
15050
|
+
};
|
|
15051
|
+
GeoJsonAdapter.prototype.getLayers = function () {
|
|
15052
|
+
var _this = this;
|
|
15053
|
+
return this._layers.map(function (_a) {
|
|
15054
|
+
var layer = _a.layer, feature = _a.feature;
|
|
15055
|
+
var visible = layer && !!layer._map;
|
|
15056
|
+
return __assign({ feature: feature, layer: layer, visible: visible, target: _this }, createFeaturePositionOptions(feature));
|
|
14956
15057
|
});
|
|
14957
|
-
}
|
|
14958
|
-
clearLayer(cb) {
|
|
15058
|
+
};
|
|
15059
|
+
GeoJsonAdapter.prototype.clearLayer = function (cb) {
|
|
14959
15060
|
this.unselect();
|
|
14960
|
-
|
|
15061
|
+
var layer_ = this.layer;
|
|
14961
15062
|
if (layer_) {
|
|
14962
15063
|
if (cb) {
|
|
14963
|
-
for (
|
|
14964
|
-
|
|
15064
|
+
for (var fry = this._layers.length; fry--;) {
|
|
15065
|
+
var def = this._layers[fry];
|
|
14965
15066
|
if (def) {
|
|
14966
|
-
|
|
15067
|
+
var feature = def.feature, layer = def.layer;
|
|
14967
15068
|
if (feature && layer) {
|
|
14968
|
-
|
|
15069
|
+
var exist = cb(feature);
|
|
14969
15070
|
if (exist) {
|
|
14970
15071
|
layer_.removeLayer(layer);
|
|
14971
15072
|
this._layers.splice(fry, 1);
|
|
@@ -14979,19 +15080,19 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
14979
15080
|
this._layers = [];
|
|
14980
15081
|
}
|
|
14981
15082
|
}
|
|
14982
|
-
}
|
|
14983
|
-
setData(data) {
|
|
15083
|
+
};
|
|
15084
|
+
GeoJsonAdapter.prototype.setData = function (data) {
|
|
14984
15085
|
this.clearLayer();
|
|
14985
15086
|
this.addData(data);
|
|
14986
|
-
}
|
|
14987
|
-
addData(data) {
|
|
14988
|
-
|
|
14989
|
-
|
|
15087
|
+
};
|
|
15088
|
+
GeoJsonAdapter.prototype.addData = function (data) {
|
|
15089
|
+
var options = this.options;
|
|
15090
|
+
var geoJsonOptions;
|
|
14990
15091
|
if (options) {
|
|
14991
15092
|
if (data) {
|
|
14992
|
-
|
|
15093
|
+
var type = void 0;
|
|
14993
15094
|
if (!options.type) {
|
|
14994
|
-
|
|
15095
|
+
var detectedType = detectType(data);
|
|
14995
15096
|
type = typeAlias[detectedType];
|
|
14996
15097
|
}
|
|
14997
15098
|
else {
|
|
@@ -15009,155 +15110,166 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15009
15110
|
}
|
|
15010
15111
|
new leafletSrc.exports.GeoJSON(data || undefined, geoJsonOptions);
|
|
15011
15112
|
}
|
|
15012
|
-
}
|
|
15013
|
-
openPopup(findFeatureFun, options) {
|
|
15113
|
+
};
|
|
15114
|
+
GeoJsonAdapter.prototype.openPopup = function (findFeatureFun, options) {
|
|
15115
|
+
var _this = this;
|
|
15014
15116
|
if (findFeatureFun) {
|
|
15015
|
-
|
|
15016
|
-
def.forEach((x)
|
|
15017
|
-
|
|
15117
|
+
var def = this._layers.filter(findFeatureFun);
|
|
15118
|
+
def.forEach(function (x) {
|
|
15119
|
+
_this._openPopup(x, options, 'api');
|
|
15018
15120
|
});
|
|
15019
15121
|
}
|
|
15020
|
-
}
|
|
15021
|
-
closePopup(findFeatureFun) {
|
|
15022
|
-
|
|
15023
|
-
|
|
15122
|
+
};
|
|
15123
|
+
GeoJsonAdapter.prototype.closePopup = function (findFeatureFun) {
|
|
15124
|
+
var _this = this;
|
|
15125
|
+
var popupToClose = findFeatureFun
|
|
15126
|
+
? this._openedPopup.filter(function (x) { return findFeatureFun(x[2]); })
|
|
15024
15127
|
: this._openedPopup;
|
|
15025
|
-
popupToClose.forEach((x)
|
|
15026
|
-
|
|
15128
|
+
popupToClose.forEach(function (x) {
|
|
15129
|
+
_this._removePopup(x[0]);
|
|
15027
15130
|
});
|
|
15028
|
-
}
|
|
15029
|
-
updateTooltip(layerDef) {
|
|
15131
|
+
};
|
|
15132
|
+
GeoJsonAdapter.prototype.updateTooltip = function (layerDef) {
|
|
15133
|
+
var _this = this;
|
|
15030
15134
|
if (layerDef) {
|
|
15031
15135
|
this._updateTooltip(layerDef);
|
|
15032
15136
|
}
|
|
15033
15137
|
else {
|
|
15034
|
-
this.getLayers().forEach((x)
|
|
15138
|
+
this.getLayers().forEach(function (x) {
|
|
15139
|
+
return _this._updateTooltip({ feature: x.feature, layer: x.layer });
|
|
15140
|
+
});
|
|
15035
15141
|
}
|
|
15036
|
-
}
|
|
15142
|
+
};
|
|
15037
15143
|
/** @deprecated use {@link GeoJsonAdapter.getBounds} instead */
|
|
15038
|
-
getExtent() {
|
|
15144
|
+
GeoJsonAdapter.prototype.getExtent = function () {
|
|
15039
15145
|
return this.getBounds();
|
|
15040
|
-
}
|
|
15041
|
-
getBounds() {
|
|
15146
|
+
};
|
|
15147
|
+
GeoJsonAdapter.prototype.getBounds = function () {
|
|
15042
15148
|
if (this.layer) {
|
|
15043
|
-
|
|
15149
|
+
var bounds = this.layer.getBounds();
|
|
15044
15150
|
if (bounds.isValid()) {
|
|
15045
15151
|
return boundsToArray(bounds);
|
|
15046
15152
|
}
|
|
15047
15153
|
}
|
|
15048
|
-
}
|
|
15049
|
-
setOpacity(value) {
|
|
15154
|
+
};
|
|
15155
|
+
GeoJsonAdapter.prototype.setOpacity = function (value) {
|
|
15050
15156
|
this.options.opacity = value;
|
|
15051
15157
|
this.setPaint(this.paint);
|
|
15052
15158
|
this.setSelectedPaint(this.selectedPaint);
|
|
15053
|
-
}
|
|
15054
|
-
setPaint(paint) {
|
|
15159
|
+
};
|
|
15160
|
+
GeoJsonAdapter.prototype.setPaint = function (paint) {
|
|
15055
15161
|
if (paint) {
|
|
15056
15162
|
this.paint = paint;
|
|
15057
|
-
for (
|
|
15163
|
+
for (var _i = 0, _a = this._layers; _i < _a.length; _i++) {
|
|
15164
|
+
var l = _a[_i];
|
|
15058
15165
|
this._setPaint(l, paint);
|
|
15059
15166
|
}
|
|
15060
15167
|
}
|
|
15061
|
-
}
|
|
15062
|
-
setSelectedPaint(paint) {
|
|
15168
|
+
};
|
|
15169
|
+
GeoJsonAdapter.prototype.setSelectedPaint = function (paint) {
|
|
15063
15170
|
if (paint) {
|
|
15064
15171
|
this.selectedPaint = paint;
|
|
15065
|
-
for (
|
|
15172
|
+
for (var _i = 0, _a = this._selectedLayers; _i < _a.length; _i++) {
|
|
15173
|
+
var l = _a[_i];
|
|
15066
15174
|
this._setPaint(l, paint);
|
|
15067
15175
|
}
|
|
15068
15176
|
}
|
|
15069
|
-
}
|
|
15070
|
-
updatePaint(paint) {
|
|
15071
|
-
this.paint = {
|
|
15072
|
-
for (
|
|
15177
|
+
};
|
|
15178
|
+
GeoJsonAdapter.prototype.updatePaint = function (paint) {
|
|
15179
|
+
this.paint = __assign(__assign({}, this.paint), paint);
|
|
15180
|
+
for (var _i = 0, _a = this._layers; _i < _a.length; _i++) {
|
|
15181
|
+
var l = _a[_i];
|
|
15073
15182
|
this._setPaint(l, this.paint);
|
|
15074
15183
|
}
|
|
15075
|
-
}
|
|
15076
|
-
updateSelectedPaint(paint) {
|
|
15077
|
-
this.selectedPaint = {
|
|
15078
|
-
for (
|
|
15184
|
+
};
|
|
15185
|
+
GeoJsonAdapter.prototype.updateSelectedPaint = function (paint) {
|
|
15186
|
+
this.selectedPaint = __assign(__assign({}, this.selectedPaint), paint);
|
|
15187
|
+
for (var _i = 0, _a = this._selectedLayers; _i < _a.length; _i++) {
|
|
15188
|
+
var l = _a[_i];
|
|
15079
15189
|
this._setPaint(l, this.selectedPaint);
|
|
15080
15190
|
}
|
|
15081
|
-
}
|
|
15082
|
-
_updateTooltip(layerDef) {
|
|
15083
|
-
|
|
15191
|
+
};
|
|
15192
|
+
GeoJsonAdapter.prototype._updateTooltip = function (layerDef) {
|
|
15193
|
+
var feature = layerDef.feature, layer = layerDef.layer;
|
|
15084
15194
|
if (feature && layer && feature.properties && this.options.labelField) {
|
|
15085
15195
|
layer.unbindTooltip();
|
|
15086
|
-
|
|
15196
|
+
var message = feature.properties[this.options.labelField];
|
|
15087
15197
|
if (message !== undefined) {
|
|
15088
|
-
|
|
15089
|
-
layer.bindTooltip(String(message), { permanent, sticky: false });
|
|
15198
|
+
var permanent = !this.options.labelOnHover;
|
|
15199
|
+
layer.bindTooltip(String(message), { permanent: permanent, sticky: false });
|
|
15090
15200
|
}
|
|
15091
15201
|
}
|
|
15092
|
-
}
|
|
15093
|
-
|
|
15202
|
+
};
|
|
15203
|
+
GeoJsonAdapter.prototype._openPopup = function (def, options, type, latLng) {
|
|
15094
15204
|
var _a, _b;
|
|
15095
|
-
|
|
15096
|
-
|
|
15097
|
-
minWidth
|
|
15098
|
-
|
|
15099
|
-
|
|
15100
|
-
|
|
15101
|
-
|
|
15102
|
-
|
|
15103
|
-
|
|
15104
|
-
|
|
15105
|
-
|
|
15106
|
-
|
|
15107
|
-
|
|
15108
|
-
|
|
15109
|
-
|
|
15110
|
-
|
|
15111
|
-
|
|
15112
|
-
|
|
15113
|
-
|
|
15114
|
-
|
|
15115
|
-
|
|
15116
|
-
|
|
15117
|
-
|
|
15118
|
-
|
|
15119
|
-
|
|
15120
|
-
|
|
15205
|
+
if (options === void 0) { options = {}; }
|
|
15206
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
15207
|
+
var feature, layer, _c, minWidth, autoPan, maxWidth, closeButton_, closeButton, popup, _closeHandlers, onClose, close, content, popupOptions, unselectOnClose, p;
|
|
15208
|
+
var _this = this;
|
|
15209
|
+
return __generator(this, function (_d) {
|
|
15210
|
+
switch (_d.label) {
|
|
15211
|
+
case 0:
|
|
15212
|
+
feature = def.feature, layer = def.layer;
|
|
15213
|
+
_c = __assign({ minWidth: 300 }, options), minWidth = _c.minWidth, autoPan = _c.autoPan, maxWidth = _c.maxWidth, closeButton_ = _c.closeButton;
|
|
15214
|
+
closeButton = closeButton_ !== null && closeButton_ !== void 0 ? closeButton_ : !this.options.selectOnHover;
|
|
15215
|
+
_closeHandlers = [];
|
|
15216
|
+
onClose = function (handler) {
|
|
15217
|
+
_closeHandlers.push(handler);
|
|
15218
|
+
};
|
|
15219
|
+
close = function () {
|
|
15220
|
+
if (popup) {
|
|
15221
|
+
_this._removePopup(popup);
|
|
15222
|
+
}
|
|
15223
|
+
};
|
|
15224
|
+
if (!options.createPopupContent) return [3 /*break*/, 2];
|
|
15225
|
+
return [4 /*yield*/, options.createPopupContent(__assign({ layer: layer, feature: feature, target: this, type: type, close: close, onClose: onClose }, createFeaturePositionOptions(feature)))];
|
|
15226
|
+
case 1:
|
|
15227
|
+
content = _d.sent();
|
|
15228
|
+
return [3 /*break*/, 3];
|
|
15229
|
+
case 2:
|
|
15230
|
+
content = options.popupContent;
|
|
15231
|
+
_d.label = 3;
|
|
15232
|
+
case 3:
|
|
15233
|
+
if (content && layer) {
|
|
15234
|
+
popupOptions = {
|
|
15235
|
+
minWidth: minWidth,
|
|
15236
|
+
autoPan: autoPan,
|
|
15237
|
+
// maxWidth,
|
|
15238
|
+
closeButton: closeButton,
|
|
15239
|
+
closeOnClick: false,
|
|
15240
|
+
autoClose: false,
|
|
15241
|
+
};
|
|
15242
|
+
if (defined(maxWidth)) {
|
|
15243
|
+
popupOptions.maxWidth = maxWidth;
|
|
15244
|
+
}
|
|
15245
|
+
popup = layer.bindPopup(content, popupOptions);
|
|
15246
|
+
unselectOnClose = (_b = (_a = this.options.popupOptions) === null || _a === void 0 ? void 0 : _a.unselectOnClose) !== null && _b !== void 0 ? _b : true;
|
|
15247
|
+
if (unselectOnClose) {
|
|
15248
|
+
p = layer.getPopup();
|
|
15249
|
+
p &&
|
|
15250
|
+
p.once('remove', function () {
|
|
15251
|
+
close();
|
|
15252
|
+
}, this);
|
|
15253
|
+
}
|
|
15254
|
+
this._openedPopup.push([popup, _closeHandlers, def]);
|
|
15255
|
+
popup.openPopup(latLng);
|
|
15256
|
+
}
|
|
15257
|
+
return [2 /*return*/];
|
|
15258
|
+
}
|
|
15121
15259
|
});
|
|
15122
|
-
}
|
|
15123
|
-
|
|
15124
|
-
|
|
15125
|
-
}
|
|
15126
|
-
if (content && layer) {
|
|
15127
|
-
const popupOptions = {
|
|
15128
|
-
minWidth,
|
|
15129
|
-
autoPan,
|
|
15130
|
-
// maxWidth,
|
|
15131
|
-
closeButton,
|
|
15132
|
-
closeOnClick: false,
|
|
15133
|
-
autoClose: false,
|
|
15134
|
-
};
|
|
15135
|
-
if (defined(maxWidth)) {
|
|
15136
|
-
popupOptions.maxWidth = maxWidth;
|
|
15137
|
-
}
|
|
15138
|
-
popup = layer.bindPopup(content, popupOptions);
|
|
15139
|
-
const unselectOnClose = (_b = (_a = this.options.popupOptions) === null || _a === void 0 ? void 0 : _a.unselectOnClose) !== null && _b !== void 0 ? _b : true;
|
|
15140
|
-
if (unselectOnClose) {
|
|
15141
|
-
const p = layer.getPopup();
|
|
15142
|
-
p &&
|
|
15143
|
-
p.once('remove', () => {
|
|
15144
|
-
close();
|
|
15145
|
-
}, this);
|
|
15146
|
-
}
|
|
15147
|
-
this._openedPopup.push([popup, _closeHandlers, def]);
|
|
15148
|
-
popup.openPopup(latLng);
|
|
15149
|
-
}
|
|
15150
|
-
}
|
|
15151
|
-
_removePopup(popup) {
|
|
15260
|
+
});
|
|
15261
|
+
};
|
|
15262
|
+
GeoJsonAdapter.prototype._removePopup = function (popup) {
|
|
15152
15263
|
var _a, _b;
|
|
15153
|
-
|
|
15264
|
+
var map = this.map;
|
|
15154
15265
|
if (map) {
|
|
15155
15266
|
popup.closePopup().unbindPopup();
|
|
15156
|
-
|
|
15267
|
+
var index = this._openedPopup.findIndex(function (x) { return x[0] === popup; });
|
|
15157
15268
|
if (index !== -1) {
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
for (
|
|
15269
|
+
var unselectOnClose = (_b = (_a = this.options.popupOptions) === null || _a === void 0 ? void 0 : _a.unselectOnClose) !== null && _b !== void 0 ? _b : true;
|
|
15270
|
+
var _c = this._openedPopup[index], closeHandlers = _c[1], def = _c[2];
|
|
15271
|
+
for (var _i = 0, closeHandlers_1 = closeHandlers; _i < closeHandlers_1.length; _i++) {
|
|
15272
|
+
var h = closeHandlers_1[_i];
|
|
15161
15273
|
h(def);
|
|
15162
15274
|
}
|
|
15163
15275
|
closeHandlers.length = 0;
|
|
@@ -15167,15 +15279,16 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15167
15279
|
this._openedPopup.splice(index, 1);
|
|
15168
15280
|
}
|
|
15169
15281
|
}
|
|
15170
|
-
}
|
|
15171
|
-
_setPaintEachLayer(paint) {
|
|
15172
|
-
|
|
15173
|
-
|
|
15282
|
+
};
|
|
15283
|
+
GeoJsonAdapter.prototype._setPaintEachLayer = function (paint) {
|
|
15284
|
+
var _this = this;
|
|
15285
|
+
this._layers.forEach(function (l) {
|
|
15286
|
+
_this._setPaint(l, paint);
|
|
15174
15287
|
});
|
|
15175
|
-
}
|
|
15176
|
-
_setPaint(def, paint) {
|
|
15177
|
-
|
|
15178
|
-
|
|
15288
|
+
};
|
|
15289
|
+
GeoJsonAdapter.prototype._setPaint = function (def, paint) {
|
|
15290
|
+
var style = undefined;
|
|
15291
|
+
var layer = def.layer, feature = def.feature;
|
|
15179
15292
|
if (layer && feature) {
|
|
15180
15293
|
if (isPaintCallback(paint)) {
|
|
15181
15294
|
style = paint(feature);
|
|
@@ -15185,8 +15298,8 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15185
15298
|
}
|
|
15186
15299
|
if (style) {
|
|
15187
15300
|
if (this.type === 'point' && style.type === 'icon') {
|
|
15188
|
-
|
|
15189
|
-
|
|
15301
|
+
var marker = layer;
|
|
15302
|
+
var divIcon = this._createDivIcon(style);
|
|
15190
15303
|
marker.setIcon(divIcon);
|
|
15191
15304
|
}
|
|
15192
15305
|
else if ('setStyle' in layer) {
|
|
@@ -15194,14 +15307,14 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15194
15307
|
}
|
|
15195
15308
|
}
|
|
15196
15309
|
}
|
|
15197
|
-
}
|
|
15198
|
-
_preparePaint(paint) {
|
|
15310
|
+
};
|
|
15311
|
+
GeoJsonAdapter.prototype._preparePaint = function (paint) {
|
|
15199
15312
|
if (paint.type !== 'get-paint') {
|
|
15200
15313
|
// const path: CircleMarkerOptions | PathOptions = paint as CircleMarkerOptions | PathOptions;
|
|
15201
15314
|
// if (path.opacity) {
|
|
15202
15315
|
// path.fillOpacity = path.opacity;
|
|
15203
15316
|
// }
|
|
15204
|
-
|
|
15317
|
+
var paintAliases = [
|
|
15205
15318
|
// ['color', 'color'],
|
|
15206
15319
|
['color', 'strokeColor'],
|
|
15207
15320
|
['opacity', 'strokeOpacity'],
|
|
@@ -15211,19 +15324,20 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15211
15324
|
['fill', 'fill'],
|
|
15212
15325
|
['weight', 'weight'],
|
|
15213
15326
|
];
|
|
15214
|
-
|
|
15327
|
+
var aliases = this.type === 'line'
|
|
15215
15328
|
? [
|
|
15216
15329
|
['color', 'strokeColor'],
|
|
15217
15330
|
['opacity', 'strokeOpacity'],
|
|
15218
15331
|
['weight', 'weight'],
|
|
15219
15332
|
]
|
|
15220
15333
|
: paintAliases;
|
|
15221
|
-
|
|
15334
|
+
var readyPaint = {};
|
|
15222
15335
|
if ('radius' in paint && typeof paint.radius === 'number') {
|
|
15223
15336
|
readyPaint.radius = paint.radius;
|
|
15224
15337
|
}
|
|
15225
|
-
for (
|
|
15226
|
-
|
|
15338
|
+
for (var _i = 0, aliases_1 = aliases; _i < aliases_1.length; _i++) {
|
|
15339
|
+
var _a = aliases_1[_i], to = _a[0], from = _a[1];
|
|
15340
|
+
var paintProp = paint[from];
|
|
15227
15341
|
if (defined(this.options.opacity) &&
|
|
15228
15342
|
from.toLowerCase().indexOf('opacity') !== -1) {
|
|
15229
15343
|
paintProp = Number(paintProp) * this.options.opacity;
|
|
@@ -15238,27 +15352,28 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15238
15352
|
return readyPaint;
|
|
15239
15353
|
}
|
|
15240
15354
|
return PAINT;
|
|
15241
|
-
}
|
|
15242
|
-
_getGeoJsonOptions(options, type) {
|
|
15243
|
-
|
|
15244
|
-
|
|
15355
|
+
};
|
|
15356
|
+
GeoJsonAdapter.prototype._getGeoJsonOptions = function (options, type) {
|
|
15357
|
+
var _this = this;
|
|
15358
|
+
var paint = options.paint;
|
|
15359
|
+
var lopt = {};
|
|
15245
15360
|
if (typeof paint === 'function') {
|
|
15246
15361
|
if (type === 'point') {
|
|
15247
15362
|
// TODO: fix types (@geoman-io/leaflet-geoman-free)
|
|
15248
|
-
lopt.pointToLayer = (feature, latLng)
|
|
15249
|
-
|
|
15250
|
-
|
|
15363
|
+
lopt.pointToLayer = function (feature, latLng) {
|
|
15364
|
+
var iconOpt = paint(feature);
|
|
15365
|
+
var pointToLayer = _this._createPaintToLayer(iconOpt);
|
|
15251
15366
|
return pointToLayer(feature, latLng);
|
|
15252
15367
|
};
|
|
15253
15368
|
}
|
|
15254
15369
|
else {
|
|
15255
15370
|
lopt = {
|
|
15256
|
-
style: (feature)
|
|
15371
|
+
style: function (feature) {
|
|
15257
15372
|
if (feature) {
|
|
15258
|
-
return
|
|
15373
|
+
return _this._preparePaint(__assign(__assign({}, PAINT), paint(feature)));
|
|
15259
15374
|
}
|
|
15260
15375
|
else {
|
|
15261
|
-
return
|
|
15376
|
+
return _this._preparePaint(__assign(__assign({}, PAINT), { type: 'path' }));
|
|
15262
15377
|
}
|
|
15263
15378
|
},
|
|
15264
15379
|
};
|
|
@@ -15267,106 +15382,90 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15267
15382
|
else {
|
|
15268
15383
|
lopt = this._createPaintOptions(paint, type);
|
|
15269
15384
|
}
|
|
15270
|
-
lopt.onEachFeature = (feature, layer)
|
|
15271
|
-
|
|
15385
|
+
lopt.onEachFeature = function (feature, layer) {
|
|
15386
|
+
_this._onEachFeature(feature, layer);
|
|
15272
15387
|
};
|
|
15273
15388
|
return lopt;
|
|
15274
|
-
}
|
|
15275
|
-
_onEachFeature(feature, layer) {
|
|
15276
|
-
|
|
15389
|
+
};
|
|
15390
|
+
GeoJsonAdapter.prototype._onEachFeature = function (feature, layer) {
|
|
15391
|
+
var _this = this;
|
|
15392
|
+
var layer_ = this.layer;
|
|
15277
15393
|
if (layer_) {
|
|
15278
|
-
|
|
15279
|
-
target: this,
|
|
15280
|
-
feature,
|
|
15281
|
-
layer,
|
|
15282
|
-
...createFeaturePositionOptions(feature),
|
|
15283
|
-
};
|
|
15394
|
+
var def_1 = __assign({ target: this, feature: feature, layer: layer }, createFeaturePositionOptions(feature));
|
|
15284
15395
|
// @ts-ignore
|
|
15285
15396
|
layer.options.pane = this.pane;
|
|
15286
|
-
this._layers.push(
|
|
15287
|
-
|
|
15397
|
+
this._layers.push(def_1);
|
|
15398
|
+
var ok = true;
|
|
15288
15399
|
if (this._filterFun) {
|
|
15289
|
-
ok = this._filterFun(
|
|
15400
|
+
ok = this._filterFun(def_1);
|
|
15290
15401
|
}
|
|
15291
15402
|
if (ok) {
|
|
15292
|
-
|
|
15403
|
+
var _a = this.options, popup_1 = _a.popup, popupOptions_1 = _a.popupOptions, selectable = _a.selectable, interactive = _a.interactive, selectOnHover = _a.selectOnHover;
|
|
15293
15404
|
// @ts-ignore
|
|
15294
15405
|
layer.options.interactive = defined(interactive) ? interactive : true;
|
|
15295
15406
|
layer_.addLayer(layer);
|
|
15296
15407
|
if (selectable) {
|
|
15297
15408
|
if (selectOnHover) {
|
|
15298
|
-
layer.on('mouseover', ()
|
|
15299
|
-
|
|
15409
|
+
layer.on('mouseover', function () {
|
|
15410
|
+
_this._selectLayer(def_1, 'hover');
|
|
15300
15411
|
});
|
|
15301
|
-
layer.on('mouseout', ()
|
|
15302
|
-
|
|
15412
|
+
layer.on('mouseout', function () {
|
|
15413
|
+
_this._unSelectLayer(def_1);
|
|
15303
15414
|
});
|
|
15304
15415
|
}
|
|
15305
15416
|
else {
|
|
15306
|
-
layer.on('click', (e)
|
|
15417
|
+
layer.on('click', function (e) { return _this._selectOnLayerClick(e); }, this);
|
|
15307
15418
|
}
|
|
15308
15419
|
}
|
|
15309
15420
|
this._handleMouseEvents(layer);
|
|
15310
15421
|
// The timeout is needed to display the popup immediately when adding a layer to the map.
|
|
15311
15422
|
// Without a timeout, the layer may not yet have a _map object
|
|
15312
|
-
setTimeout(()
|
|
15313
|
-
if (
|
|
15314
|
-
|
|
15315
|
-
target: this,
|
|
15316
|
-
layer,
|
|
15317
|
-
feature,
|
|
15318
|
-
...createFeaturePositionOptions(feature),
|
|
15319
|
-
}, popupOptions, 'api');
|
|
15423
|
+
setTimeout(function () {
|
|
15424
|
+
if (popup_1) {
|
|
15425
|
+
_this._openPopup(__assign({ target: _this, layer: layer, feature: feature }, createFeaturePositionOptions(feature)), popupOptions_1, 'api');
|
|
15320
15426
|
}
|
|
15321
|
-
|
|
15427
|
+
_this._updateTooltip({ layer: layer, feature: feature });
|
|
15322
15428
|
});
|
|
15323
15429
|
}
|
|
15324
15430
|
}
|
|
15325
|
-
}
|
|
15326
|
-
_handleMouseEvents(layer) {
|
|
15327
|
-
|
|
15431
|
+
};
|
|
15432
|
+
GeoJsonAdapter.prototype._handleMouseEvents = function (layer) {
|
|
15433
|
+
var _this = this;
|
|
15434
|
+
var _a = this.options, onClick = _a.onClick, onLayerClick = _a.onLayerClick, onMouseOut = _a.onMouseOut, onMouseOver = _a.onMouseOver;
|
|
15328
15435
|
// TODO: remove backward compatibility for onLayerClick
|
|
15329
|
-
|
|
15436
|
+
var onClick_ = onClick || onLayerClick;
|
|
15330
15437
|
if (onClick_) {
|
|
15331
|
-
layer.on('click', (e)
|
|
15332
|
-
|
|
15333
|
-
onClick_({
|
|
15334
|
-
selected,
|
|
15335
|
-
...this._createMouseEvent(e),
|
|
15336
|
-
});
|
|
15438
|
+
layer.on('click', function (e) {
|
|
15439
|
+
var selected = !!_this._getSelected(layer);
|
|
15440
|
+
onClick_(__assign({ selected: selected }, _this._createMouseEvent(e)));
|
|
15337
15441
|
}, this);
|
|
15338
15442
|
}
|
|
15339
15443
|
if (onMouseOut) {
|
|
15340
|
-
layer.on('mouseout', (e)
|
|
15341
|
-
onMouseOut(
|
|
15444
|
+
layer.on('mouseout', function (e) {
|
|
15445
|
+
onMouseOut(_this._createMouseEvent(e));
|
|
15342
15446
|
}, this);
|
|
15343
15447
|
}
|
|
15344
15448
|
if (onMouseOver) {
|
|
15345
|
-
layer.on('mouseover', (e)
|
|
15346
|
-
onMouseOver(
|
|
15449
|
+
layer.on('mouseover', function (e) {
|
|
15450
|
+
onMouseOver(_this._createMouseEvent(e));
|
|
15347
15451
|
}, this);
|
|
15348
15452
|
}
|
|
15349
|
-
}
|
|
15350
|
-
_createMouseEvent(source) {
|
|
15453
|
+
};
|
|
15454
|
+
GeoJsonAdapter.prototype._createMouseEvent = function (source) {
|
|
15351
15455
|
return createMouseEvent({
|
|
15352
15456
|
layer: this,
|
|
15353
15457
|
source: source,
|
|
15354
15458
|
});
|
|
15355
|
-
}
|
|
15356
|
-
_getSelected(layer) {
|
|
15357
|
-
return this._selectedLayers.find((x)
|
|
15358
|
-
}
|
|
15359
|
-
_selectOnLayerClick(e) {
|
|
15459
|
+
};
|
|
15460
|
+
GeoJsonAdapter.prototype._getSelected = function (layer) {
|
|
15461
|
+
return this._selectedLayers.find(function (x) { return x.layer === layer; });
|
|
15462
|
+
};
|
|
15463
|
+
GeoJsonAdapter.prototype._selectOnLayerClick = function (e) {
|
|
15360
15464
|
leafletSrc.exports.DomEvent.stopPropagation(e);
|
|
15361
|
-
|
|
15362
|
-
|
|
15363
|
-
|
|
15364
|
-
|
|
15365
|
-
layer,
|
|
15366
|
-
feature,
|
|
15367
|
-
...createFeaturePositionOptions(feature),
|
|
15368
|
-
};
|
|
15369
|
-
const isSelected = this._getSelected(layer);
|
|
15465
|
+
var layer = e.target;
|
|
15466
|
+
var feature = layer.feature;
|
|
15467
|
+
var def = __assign({ target: this, layer: layer, feature: feature }, createFeaturePositionOptions(feature));
|
|
15468
|
+
var isSelected = this._getSelected(layer);
|
|
15370
15469
|
if (isSelected) {
|
|
15371
15470
|
if (this.options && this.options.unselectOnSecondClick) {
|
|
15372
15471
|
this._unSelectLayer(isSelected);
|
|
@@ -15375,17 +15474,18 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15375
15474
|
else {
|
|
15376
15475
|
this._selectLayer(def, 'click', e.latlng);
|
|
15377
15476
|
}
|
|
15378
|
-
}
|
|
15379
|
-
_selectLayer(def, type, latlng) {
|
|
15380
|
-
|
|
15381
|
-
|
|
15477
|
+
};
|
|
15478
|
+
GeoJsonAdapter.prototype._selectLayer = function (def, type, latlng) {
|
|
15479
|
+
var _this = this;
|
|
15480
|
+
this.map._addUnselectCb(function () {
|
|
15481
|
+
_this._unSelectLayer(def);
|
|
15382
15482
|
});
|
|
15383
15483
|
if (this.options && !this.options.multiselect) {
|
|
15384
|
-
this._selectedLayers.forEach((x)
|
|
15484
|
+
this._selectedLayers.forEach(function (x) { return _this._unSelectLayer(x); });
|
|
15385
15485
|
}
|
|
15386
15486
|
this._selectedLayers.push(def);
|
|
15387
15487
|
this.selected = true;
|
|
15388
|
-
|
|
15488
|
+
var _a = this.options, selectedPaint = _a.selectedPaint, popupOnSelect = _a.popupOnSelect, popupOptions = _a.popupOptions;
|
|
15389
15489
|
if (selectedPaint && def.layer) {
|
|
15390
15490
|
this._setPaint(def, selectedPaint);
|
|
15391
15491
|
}
|
|
@@ -15393,17 +15493,12 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15393
15493
|
this._openPopup(def, popupOptions, type, latlng);
|
|
15394
15494
|
}
|
|
15395
15495
|
if (this.options.onSelect) {
|
|
15396
|
-
|
|
15397
|
-
this.options.onSelect({
|
|
15398
|
-
type,
|
|
15399
|
-
layer: this,
|
|
15400
|
-
features,
|
|
15401
|
-
...createFeaturePositionOptions(features),
|
|
15402
|
-
});
|
|
15496
|
+
var features = def.feature ? [def.feature] : [];
|
|
15497
|
+
this.options.onSelect(__assign({ type: type, layer: this, features: features }, createFeaturePositionOptions(features)));
|
|
15403
15498
|
}
|
|
15404
|
-
}
|
|
15405
|
-
_unSelectLayer(def) {
|
|
15406
|
-
|
|
15499
|
+
};
|
|
15500
|
+
GeoJsonAdapter.prototype._unSelectLayer = function (def) {
|
|
15501
|
+
var index = this._selectedLayers.indexOf(def);
|
|
15407
15502
|
if (index !== -1) {
|
|
15408
15503
|
this._selectedLayers.splice(index, 1);
|
|
15409
15504
|
if (this.options) {
|
|
@@ -15416,40 +15511,41 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15416
15511
|
}
|
|
15417
15512
|
}
|
|
15418
15513
|
this.selected = this._selectedLayers.length > 0;
|
|
15419
|
-
}
|
|
15420
|
-
_createDivIcon(icon) {
|
|
15421
|
-
|
|
15422
|
-
return new leafletSrc.exports.DivIcon({ className: '',
|
|
15423
|
-
}
|
|
15424
|
-
_createPaintToLayer(icon) {
|
|
15514
|
+
};
|
|
15515
|
+
GeoJsonAdapter.prototype._createDivIcon = function (icon) {
|
|
15516
|
+
var toLIconOpt = __rest(icon, []);
|
|
15517
|
+
return new leafletSrc.exports.DivIcon(__assign({ className: '' }, toLIconOpt));
|
|
15518
|
+
};
|
|
15519
|
+
GeoJsonAdapter.prototype._createPaintToLayer = function (icon) {
|
|
15520
|
+
var _this = this;
|
|
15425
15521
|
if (icon && icon.type) {
|
|
15426
15522
|
if (icon.type === 'icon') {
|
|
15427
|
-
|
|
15428
|
-
|
|
15523
|
+
var iconClassName = icon.className;
|
|
15524
|
+
var html = icon.html;
|
|
15429
15525
|
if (iconClassName || html) {
|
|
15430
|
-
return (geoJsonPoint, latlng)
|
|
15431
|
-
|
|
15526
|
+
return function (geoJsonPoint, latlng) {
|
|
15527
|
+
var divIcon = _this._createDivIcon(icon);
|
|
15432
15528
|
return new leafletSrc.exports.Marker(latlng, { icon: divIcon });
|
|
15433
15529
|
};
|
|
15434
15530
|
}
|
|
15435
15531
|
}
|
|
15436
15532
|
else if (icon.type === 'pin') {
|
|
15437
|
-
return (geoJsonPoint, latlng)
|
|
15533
|
+
return function (geoJsonPoint, latlng) {
|
|
15438
15534
|
// const divIcon = this.createDivIcon(icon);
|
|
15439
15535
|
return new leafletSrc.exports.Marker(latlng);
|
|
15440
15536
|
};
|
|
15441
15537
|
}
|
|
15442
15538
|
}
|
|
15443
|
-
return (geoJsonPoint, latlng)
|
|
15444
|
-
|
|
15445
|
-
return new leafletSrc.exports.CircleMarker(latlng,
|
|
15539
|
+
return function (geoJsonPoint, latlng) {
|
|
15540
|
+
var p = PAINT;
|
|
15541
|
+
return new leafletSrc.exports.CircleMarker(latlng, _this._preparePaint(__assign(__assign({}, p), icon)));
|
|
15446
15542
|
};
|
|
15447
|
-
}
|
|
15448
|
-
_createPaintOptions(paintOptions, type) {
|
|
15449
|
-
|
|
15450
|
-
|
|
15543
|
+
};
|
|
15544
|
+
GeoJsonAdapter.prototype._createPaintOptions = function (paintOptions, type) {
|
|
15545
|
+
var geoJsonOptions = {};
|
|
15546
|
+
var paint = (paintOptions && this._preparePaint(paintOptions)) || {};
|
|
15451
15547
|
if (paintOptions) {
|
|
15452
|
-
geoJsonOptions.style = ()
|
|
15548
|
+
geoJsonOptions.style = function () {
|
|
15453
15549
|
return paint;
|
|
15454
15550
|
};
|
|
15455
15551
|
}
|
|
@@ -15460,12 +15556,12 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15460
15556
|
paint.stroke = true;
|
|
15461
15557
|
}
|
|
15462
15558
|
return geoJsonOptions;
|
|
15463
|
-
}
|
|
15464
|
-
_addMapListener() {
|
|
15465
|
-
|
|
15559
|
+
};
|
|
15560
|
+
GeoJsonAdapter.prototype._addMapListener = function () {
|
|
15561
|
+
var map = this.map;
|
|
15466
15562
|
if (map) {
|
|
15467
|
-
|
|
15468
|
-
|
|
15563
|
+
var _a = this.options, labelField = _a.labelField, labelOnHover = _a.labelOnHover, unselectOnClick = _a.unselectOnClick;
|
|
15564
|
+
var uoc = unselectOnClick !== null && unselectOnClick !== void 0 ? unselectOnClick : true;
|
|
15469
15565
|
if (uoc) {
|
|
15470
15566
|
map.on('click', this.$unselect);
|
|
15471
15567
|
}
|
|
@@ -15474,62 +15570,66 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15474
15570
|
map.on('moveend', this.$updateTooltip);
|
|
15475
15571
|
}
|
|
15476
15572
|
}
|
|
15477
|
-
}
|
|
15478
|
-
_removeMapListener() {
|
|
15573
|
+
};
|
|
15574
|
+
GeoJsonAdapter.prototype._removeMapListener = function () {
|
|
15479
15575
|
this.map.off('zoomend', this.$updateTooltip);
|
|
15480
15576
|
this.map.off('moveend', this.$updateTooltip);
|
|
15481
15577
|
this.map.off('click', this.$unselect);
|
|
15482
|
-
}
|
|
15483
|
-
|
|
15578
|
+
};
|
|
15579
|
+
return GeoJsonAdapter;
|
|
15580
|
+
}(BaseAdapter));
|
|
15484
15581
|
|
|
15485
15582
|
function callAjax(src, callback, headers) {
|
|
15486
|
-
|
|
15583
|
+
var xhr = new XMLHttpRequest();
|
|
15487
15584
|
xhr.open('GET', src);
|
|
15488
15585
|
xhr.responseType = 'arraybuffer';
|
|
15489
|
-
for (
|
|
15586
|
+
for (var h in headers) {
|
|
15490
15587
|
xhr.setRequestHeader(h, headers[h]);
|
|
15491
15588
|
}
|
|
15492
15589
|
xhr.onload = function () {
|
|
15493
|
-
|
|
15494
|
-
|
|
15590
|
+
var arrayBufferView = new Uint8Array(this.response);
|
|
15591
|
+
var blob = new Blob([arrayBufferView], { type: 'image/png' });
|
|
15495
15592
|
// @ts-ignore for typedoc
|
|
15496
|
-
|
|
15497
|
-
|
|
15593
|
+
var urlCreator = window.URL || window.webkitURL;
|
|
15594
|
+
var imageUrl = urlCreator.createObjectURL(blob);
|
|
15498
15595
|
callback(imageUrl);
|
|
15499
15596
|
};
|
|
15500
15597
|
xhr.send();
|
|
15501
|
-
return ()
|
|
15598
|
+
return function () {
|
|
15502
15599
|
xhr.abort();
|
|
15503
15600
|
};
|
|
15504
15601
|
}
|
|
15505
15602
|
|
|
15506
|
-
|
|
15507
|
-
|
|
15508
|
-
|
|
15509
|
-
|
|
15603
|
+
var ImageOverlay = /** @class */ (function (_super) {
|
|
15604
|
+
__extends(ImageOverlay, _super);
|
|
15605
|
+
function ImageOverlay(imageUrl, bounds, options) {
|
|
15606
|
+
var _this = _super.call(this, imageUrl, bounds, options) || this;
|
|
15607
|
+
_this._abort = [];
|
|
15608
|
+
return _this;
|
|
15510
15609
|
}
|
|
15511
|
-
cancelLoad() {
|
|
15610
|
+
ImageOverlay.prototype.cancelLoad = function () {
|
|
15512
15611
|
if (this._abort) {
|
|
15513
|
-
this._abort.forEach((x)
|
|
15612
|
+
this._abort.forEach(function (x) { return x(); });
|
|
15514
15613
|
this._abort = [];
|
|
15515
15614
|
}
|
|
15516
|
-
}
|
|
15517
|
-
_initImage() {
|
|
15615
|
+
};
|
|
15616
|
+
ImageOverlay.prototype._initImage = function () {
|
|
15518
15617
|
// @ts-ignore
|
|
15519
|
-
|
|
15618
|
+
_super.prototype._initImage.call(this);
|
|
15520
15619
|
// @ts-ignore
|
|
15521
|
-
|
|
15620
|
+
var headers = this.options.headers;
|
|
15522
15621
|
if (headers) {
|
|
15523
15622
|
// @ts-ignore
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
this._abort.push(callAjax(src, (response)
|
|
15528
|
-
|
|
15623
|
+
var img_1 = this._image;
|
|
15624
|
+
var src = img_1.src;
|
|
15625
|
+
img_1.src = '';
|
|
15626
|
+
this._abort.push(callAjax(src, function (response) {
|
|
15627
|
+
img_1.src = response;
|
|
15529
15628
|
}, headers));
|
|
15530
15629
|
}
|
|
15531
|
-
}
|
|
15532
|
-
|
|
15630
|
+
};
|
|
15631
|
+
return ImageOverlay;
|
|
15632
|
+
}(leafletSrc.exports.ImageOverlay));
|
|
15533
15633
|
|
|
15534
15634
|
/*!
|
|
15535
15635
|
* leaflet.wms.js
|
|
@@ -15543,10 +15643,11 @@ class ImageOverlay extends leafletSrc.exports.ImageOverlay {
|
|
|
15543
15643
|
* Portions of wms.Overlay are directly extracted from L.TileLayer.WMS.
|
|
15544
15644
|
* See Leaflet license.
|
|
15545
15645
|
*/
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15646
|
+
var ImageLayer = /** @class */ (function (_super) {
|
|
15647
|
+
__extends(ImageLayer, _super);
|
|
15648
|
+
function ImageLayer(url, options) {
|
|
15649
|
+
var _this = _super.call(this, options) || this;
|
|
15650
|
+
_this.defaultWmsParams = {
|
|
15550
15651
|
service: 'WMS',
|
|
15551
15652
|
request: 'GetMap',
|
|
15552
15653
|
version: '1.1.1',
|
|
@@ -15555,7 +15656,7 @@ class ImageLayer extends leafletSrc.exports.Layer {
|
|
|
15555
15656
|
format: 'image/jpeg',
|
|
15556
15657
|
transparent: false,
|
|
15557
15658
|
};
|
|
15558
|
-
|
|
15659
|
+
_this.options = {
|
|
15559
15660
|
crs: null,
|
|
15560
15661
|
uppercase: false,
|
|
15561
15662
|
attribution: '',
|
|
@@ -15568,34 +15669,35 @@ class ImageLayer extends leafletSrc.exports.Layer {
|
|
|
15568
15669
|
viewPortBuffer: 0,
|
|
15569
15670
|
setViewDelay: 100,
|
|
15570
15671
|
};
|
|
15571
|
-
|
|
15672
|
+
_this._url = url;
|
|
15572
15673
|
// Move WMS parameters to params object
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15674
|
+
var params = {};
|
|
15675
|
+
var opts = {};
|
|
15676
|
+
var opt;
|
|
15576
15677
|
for (opt in options) {
|
|
15577
|
-
if (opt in
|
|
15678
|
+
if (opt in _this.options) {
|
|
15578
15679
|
opts[opt] = options[opt];
|
|
15579
15680
|
}
|
|
15580
15681
|
else {
|
|
15581
15682
|
params[opt] = options[opt];
|
|
15582
15683
|
}
|
|
15583
15684
|
}
|
|
15584
|
-
leafletSrc.exports.Util.setOptions(
|
|
15585
|
-
|
|
15685
|
+
leafletSrc.exports.Util.setOptions(_this, opts);
|
|
15686
|
+
_this.wmsParams = leafletSrc.exports.Util.extend({}, _this.defaultWmsParams, params);
|
|
15687
|
+
return _this;
|
|
15586
15688
|
}
|
|
15587
|
-
setParams(params) {
|
|
15689
|
+
ImageLayer.prototype.setParams = function (params) {
|
|
15588
15690
|
leafletSrc.exports.Util.extend(this.wmsParams, params);
|
|
15589
15691
|
this.update();
|
|
15590
|
-
}
|
|
15591
|
-
getAttribution() {
|
|
15692
|
+
};
|
|
15693
|
+
ImageLayer.prototype.getAttribution = function () {
|
|
15592
15694
|
return this.options.attribution || '';
|
|
15593
|
-
}
|
|
15594
|
-
onAdd() {
|
|
15695
|
+
};
|
|
15696
|
+
ImageLayer.prototype.onAdd = function () {
|
|
15595
15697
|
this.update();
|
|
15596
15698
|
return this;
|
|
15597
|
-
}
|
|
15598
|
-
onRemove(map) {
|
|
15699
|
+
};
|
|
15700
|
+
ImageLayer.prototype.onRemove = function (map) {
|
|
15599
15701
|
if (this._currentOverlay) {
|
|
15600
15702
|
this._currentOverlay.cancelLoad();
|
|
15601
15703
|
map.removeLayer(this._currentOverlay);
|
|
@@ -15605,28 +15707,29 @@ class ImageLayer extends leafletSrc.exports.Layer {
|
|
|
15605
15707
|
delete this._currentUrl;
|
|
15606
15708
|
}
|
|
15607
15709
|
return this;
|
|
15608
|
-
}
|
|
15609
|
-
getEvents() {
|
|
15710
|
+
};
|
|
15711
|
+
ImageLayer.prototype.getEvents = function () {
|
|
15610
15712
|
return {
|
|
15611
15713
|
moveend: debounce(this.update, this.options.setViewDelay),
|
|
15612
15714
|
};
|
|
15613
|
-
}
|
|
15614
|
-
update() {
|
|
15715
|
+
};
|
|
15716
|
+
ImageLayer.prototype.update = function () {
|
|
15717
|
+
var _this = this;
|
|
15615
15718
|
if (!this._map) {
|
|
15616
15719
|
return;
|
|
15617
15720
|
}
|
|
15618
15721
|
// Determine image URL and whether it has changed since last update
|
|
15619
15722
|
this.updateWmsParams();
|
|
15620
|
-
|
|
15723
|
+
var url = this.getImageUrl();
|
|
15621
15724
|
if (this._currentUrl === url) {
|
|
15622
15725
|
return;
|
|
15623
15726
|
}
|
|
15624
15727
|
this._currentUrl = url;
|
|
15625
15728
|
// Keep current image overlay in place until new one loads
|
|
15626
15729
|
// (inspired by esri.leaflet)
|
|
15627
|
-
|
|
15628
|
-
|
|
15629
|
-
|
|
15730
|
+
var viewPortBuffer = this.options.viewPortBuffer || 0;
|
|
15731
|
+
var bounds = this._map.getBounds().pad(viewPortBuffer);
|
|
15732
|
+
var overlay = new ImageOverlay(url, bounds, {
|
|
15630
15733
|
opacity: 0,
|
|
15631
15734
|
pane: this.options.pane,
|
|
15632
15735
|
headers: this.options.headers,
|
|
@@ -15635,82 +15738,82 @@ class ImageLayer extends leafletSrc.exports.Layer {
|
|
|
15635
15738
|
if (this._currentOverlay) {
|
|
15636
15739
|
this._currentOverlay.cancelLoad();
|
|
15637
15740
|
}
|
|
15638
|
-
overlay.once('load', ()
|
|
15639
|
-
if (!
|
|
15741
|
+
overlay.once('load', function () {
|
|
15742
|
+
if (!_this._map) {
|
|
15640
15743
|
return;
|
|
15641
15744
|
}
|
|
15642
15745
|
// @ts-ignore
|
|
15643
|
-
if (overlay._url !==
|
|
15644
|
-
|
|
15746
|
+
if (overlay._url !== _this._currentUrl) {
|
|
15747
|
+
_this._map.removeLayer(overlay);
|
|
15645
15748
|
return;
|
|
15646
15749
|
}
|
|
15647
|
-
else if (
|
|
15648
|
-
|
|
15750
|
+
else if (_this._currentOverlay) {
|
|
15751
|
+
_this._map.removeLayer(_this._currentOverlay);
|
|
15649
15752
|
}
|
|
15650
|
-
|
|
15651
|
-
overlay.setOpacity(
|
|
15652
|
-
if (
|
|
15753
|
+
_this._currentOverlay = overlay;
|
|
15754
|
+
overlay.setOpacity(_this.options.opacity !== undefined ? _this.options.opacity : 1);
|
|
15755
|
+
if (_this.options.isBack === true) {
|
|
15653
15756
|
overlay.bringToBack();
|
|
15654
15757
|
}
|
|
15655
|
-
if (
|
|
15758
|
+
if (_this.options.isBack === false) {
|
|
15656
15759
|
overlay.bringToFront();
|
|
15657
15760
|
}
|
|
15658
|
-
if (
|
|
15659
|
-
overlay.setZIndex(
|
|
15761
|
+
if (_this.options.zIndex !== undefined) {
|
|
15762
|
+
overlay.setZIndex(_this.options.zIndex);
|
|
15660
15763
|
}
|
|
15661
15764
|
}, this);
|
|
15662
|
-
|
|
15765
|
+
var _a = this.options, minZoom = _a.minZoom, maxZoom = _a.maxZoom;
|
|
15663
15766
|
if ((minZoom && this._map.getZoom() < minZoom) ||
|
|
15664
15767
|
(maxZoom && this._map.getZoom() > maxZoom)) {
|
|
15665
15768
|
this._map.removeLayer(overlay);
|
|
15666
15769
|
}
|
|
15667
|
-
}
|
|
15668
|
-
setOpacity(opacity) {
|
|
15770
|
+
};
|
|
15771
|
+
ImageLayer.prototype.setOpacity = function (opacity) {
|
|
15669
15772
|
this.options.opacity = opacity;
|
|
15670
15773
|
if (this._currentOverlay) {
|
|
15671
15774
|
this._currentOverlay.setOpacity(opacity);
|
|
15672
15775
|
}
|
|
15673
|
-
}
|
|
15674
|
-
bringToBack() {
|
|
15776
|
+
};
|
|
15777
|
+
ImageLayer.prototype.bringToBack = function () {
|
|
15675
15778
|
this.options.isBack = true;
|
|
15676
15779
|
if (this._currentOverlay) {
|
|
15677
15780
|
this._currentOverlay.bringToBack();
|
|
15678
15781
|
}
|
|
15679
|
-
}
|
|
15680
|
-
bringToFront() {
|
|
15782
|
+
};
|
|
15783
|
+
ImageLayer.prototype.bringToFront = function () {
|
|
15681
15784
|
this.options.isBack = false;
|
|
15682
15785
|
if (this._currentOverlay) {
|
|
15683
15786
|
this._currentOverlay.bringToFront();
|
|
15684
15787
|
}
|
|
15685
|
-
}
|
|
15686
|
-
setZIndex(zIndex) {
|
|
15788
|
+
};
|
|
15789
|
+
ImageLayer.prototype.setZIndex = function (zIndex) {
|
|
15687
15790
|
this.options.zIndex = zIndex;
|
|
15688
15791
|
if (this._currentOverlay) {
|
|
15689
15792
|
this._currentOverlay.setZIndex(zIndex);
|
|
15690
15793
|
}
|
|
15691
|
-
}
|
|
15794
|
+
};
|
|
15692
15795
|
// See L.TileLayer.WMS: onAdd() & getTileUrl()
|
|
15693
|
-
updateWmsParams(map) {
|
|
15796
|
+
ImageLayer.prototype.updateWmsParams = function (map) {
|
|
15694
15797
|
if (!map) {
|
|
15695
15798
|
map = this._map;
|
|
15696
15799
|
}
|
|
15697
15800
|
// Compute WMS options
|
|
15698
|
-
|
|
15699
|
-
|
|
15700
|
-
|
|
15801
|
+
var viewPortBuffer = this.options.viewPortBuffer || 0;
|
|
15802
|
+
var bounds = map.getBounds().pad(viewPortBuffer);
|
|
15803
|
+
var size = map.getSize();
|
|
15701
15804
|
if (this.options.viewPortBuffer !== 0) {
|
|
15702
|
-
|
|
15805
|
+
var factor = viewPortBuffer + 1;
|
|
15703
15806
|
size.x = Math.ceil(size.x * factor);
|
|
15704
15807
|
size.y = Math.ceil(size.y * factor);
|
|
15705
15808
|
}
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
|
|
15809
|
+
var wmsVersion = parseFloat(this.wmsParams.version);
|
|
15810
|
+
var crs = this.options.crs || map.options.crs;
|
|
15811
|
+
var projectionKey = wmsVersion >= 1.3 ? 'crs' : 'srs';
|
|
15709
15812
|
if (crs) {
|
|
15710
|
-
|
|
15711
|
-
|
|
15813
|
+
var nw = crs.project(bounds.getNorthWest());
|
|
15814
|
+
var se = crs.project(bounds.getSouthEast());
|
|
15712
15815
|
// Assemble WMS parameter string
|
|
15713
|
-
|
|
15816
|
+
var params = {
|
|
15714
15817
|
width: size.x,
|
|
15715
15818
|
height: size.y,
|
|
15716
15819
|
};
|
|
@@ -15720,60 +15823,67 @@ class ImageLayer extends leafletSrc.exports.Layer {
|
|
|
15720
15823
|
: [nw.x, se.y, se.x, nw.y]).join(',');
|
|
15721
15824
|
leafletSrc.exports.Util.extend(this.wmsParams, params);
|
|
15722
15825
|
}
|
|
15723
|
-
}
|
|
15724
|
-
getImageUrl() {
|
|
15725
|
-
|
|
15726
|
-
|
|
15826
|
+
};
|
|
15827
|
+
ImageLayer.prototype.getImageUrl = function () {
|
|
15828
|
+
var uppercase = this.options.uppercase || false;
|
|
15829
|
+
var pstr = leafletSrc.exports.Util.getParamString(this.wmsParams, this._url, uppercase);
|
|
15727
15830
|
return this._url + pstr;
|
|
15728
|
-
}
|
|
15729
|
-
|
|
15831
|
+
};
|
|
15832
|
+
return ImageLayer;
|
|
15833
|
+
}(leafletSrc.exports.Layer));
|
|
15730
15834
|
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
|
|
15835
|
+
var ImageAdapter = /** @class */ (function (_super) {
|
|
15836
|
+
__extends(ImageAdapter, _super);
|
|
15837
|
+
function ImageAdapter() {
|
|
15838
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
15839
|
+
}
|
|
15840
|
+
ImageAdapter.prototype.addLayer = function (options) {
|
|
15841
|
+
var url = options && options.url;
|
|
15734
15842
|
if (url) {
|
|
15735
|
-
options = { transparent: true,
|
|
15736
|
-
|
|
15737
|
-
this.layer = new ImageLayer(url, {
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
setViewDelay: options.setViewDelay,
|
|
15741
|
-
/**
|
|
15742
|
-
* TODO: safe remove, use only options.nativeOptions
|
|
15743
|
-
*/
|
|
15744
|
-
...options,
|
|
15745
|
-
...options.params,
|
|
15746
|
-
...options.nativeOptions,
|
|
15747
|
-
});
|
|
15748
|
-
if (updateWmsParamsFromOpt) {
|
|
15749
|
-
const updateWmsParams = this.layer.updateWmsParams;
|
|
15843
|
+
options = __assign({ transparent: true }, options);
|
|
15844
|
+
var updateWmsParamsFromOpt_1 = options.updateWmsParams;
|
|
15845
|
+
this.layer = new ImageLayer(url, __assign(__assign(__assign({ pane: this.pane, headers: options.headers, setViewDelay: options.setViewDelay }, options), options.params), options.nativeOptions));
|
|
15846
|
+
if (updateWmsParamsFromOpt_1) {
|
|
15847
|
+
var updateWmsParams_1 = this.layer.updateWmsParams;
|
|
15750
15848
|
this.layer.updateWmsParams = function (map) {
|
|
15751
|
-
|
|
15752
|
-
this.wmsParams =
|
|
15849
|
+
updateWmsParams_1.call(this, map);
|
|
15850
|
+
this.wmsParams = updateWmsParamsFromOpt_1(this.wmsParams);
|
|
15753
15851
|
};
|
|
15754
15852
|
}
|
|
15755
15853
|
return this.layer;
|
|
15756
15854
|
}
|
|
15757
|
-
}
|
|
15758
|
-
|
|
15855
|
+
};
|
|
15856
|
+
return ImageAdapter;
|
|
15857
|
+
}(BaseAdapter));
|
|
15759
15858
|
|
|
15760
15859
|
function makeRemote(Base) {
|
|
15761
|
-
return class
|
|
15762
|
-
|
|
15763
|
-
|
|
15764
|
-
|
|
15860
|
+
return /** @class */ (function (_super) {
|
|
15861
|
+
__extends(RemoteTileLayer, _super);
|
|
15862
|
+
function RemoteTileLayer() {
|
|
15863
|
+
var args = [];
|
|
15864
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
15865
|
+
args[_i] = arguments[_i];
|
|
15866
|
+
}
|
|
15867
|
+
var _this = _super.apply(this, args) || this;
|
|
15868
|
+
if (_this.options.setViewDelay) {
|
|
15765
15869
|
// @ts-ignore
|
|
15766
|
-
|
|
15870
|
+
_this._update = debounce(function () {
|
|
15871
|
+
var _a;
|
|
15872
|
+
var a = [];
|
|
15873
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
15874
|
+
a[_i] = arguments[_i];
|
|
15875
|
+
}
|
|
15767
15876
|
// @ts-ignore
|
|
15768
|
-
leafletSrc.exports.GridLayer.prototype._update.call(
|
|
15769
|
-
},
|
|
15877
|
+
(_a = leafletSrc.exports.GridLayer.prototype._update).call.apply(_a, __spreadArray([_this], a, false));
|
|
15878
|
+
}, _this.options.setViewDelay);
|
|
15770
15879
|
}
|
|
15880
|
+
return _this;
|
|
15771
15881
|
}
|
|
15772
|
-
createTile(coords, done) {
|
|
15882
|
+
RemoteTileLayer.prototype.createTile = function (coords, done) {
|
|
15773
15883
|
// @ts-ignore
|
|
15774
|
-
|
|
15775
|
-
|
|
15776
|
-
tile.abort = callAjax(url, (response)
|
|
15884
|
+
var url = this.getTileUrl(coords);
|
|
15885
|
+
var tile = document.createElement('img');
|
|
15886
|
+
tile.abort = callAjax(url, function (response) {
|
|
15777
15887
|
tile.src = response;
|
|
15778
15888
|
done(null, tile);
|
|
15779
15889
|
},
|
|
@@ -15786,15 +15896,15 @@ function makeRemote(Base) {
|
|
|
15786
15896
|
tile.alt = '';
|
|
15787
15897
|
tile.setAttribute('role', 'presentation');
|
|
15788
15898
|
return tile;
|
|
15789
|
-
}
|
|
15790
|
-
_abortLoading() {
|
|
15899
|
+
};
|
|
15900
|
+
RemoteTileLayer.prototype._abortLoading = function () {
|
|
15791
15901
|
// @ts-ignore
|
|
15792
|
-
|
|
15902
|
+
var tiles = this._tiles;
|
|
15793
15903
|
// @ts-ignore
|
|
15794
|
-
|
|
15795
|
-
for (
|
|
15904
|
+
var tileZoom = this._tileZoom;
|
|
15905
|
+
for (var i in tiles) {
|
|
15796
15906
|
if (tiles[i].coords.z !== tileZoom) {
|
|
15797
|
-
|
|
15907
|
+
var tile = tiles[i].el;
|
|
15798
15908
|
tile.onload = leafletSrc.exports.Util.falseFn;
|
|
15799
15909
|
tile.onerror = leafletSrc.exports.Util.falseFn;
|
|
15800
15910
|
if (!tile.complete) {
|
|
@@ -15807,41 +15917,39 @@ function makeRemote(Base) {
|
|
|
15807
15917
|
}
|
|
15808
15918
|
}
|
|
15809
15919
|
}
|
|
15810
|
-
}
|
|
15811
|
-
|
|
15920
|
+
};
|
|
15921
|
+
return RemoteTileLayer;
|
|
15922
|
+
}(Base));
|
|
15812
15923
|
}
|
|
15813
15924
|
|
|
15814
|
-
|
|
15815
|
-
|
|
15816
|
-
|
|
15817
|
-
|
|
15925
|
+
var TileLayerBase = /** @class */ (function (_super) {
|
|
15926
|
+
__extends(TileLayerBase, _super);
|
|
15927
|
+
function TileLayerBase(urlTemplate, options) {
|
|
15928
|
+
var _this = _super.call(this, urlTemplate, options) || this;
|
|
15929
|
+
Object.assign(_this.options, options);
|
|
15930
|
+
return _this;
|
|
15818
15931
|
}
|
|
15819
|
-
|
|
15820
|
-
|
|
15821
|
-
|
|
15822
|
-
|
|
15823
|
-
|
|
15932
|
+
return TileLayerBase;
|
|
15933
|
+
}(leafletSrc.exports.TileLayer));
|
|
15934
|
+
var TileLayer = makeRemote(TileLayerBase);
|
|
15935
|
+
|
|
15936
|
+
var TileAdapter = /** @class */ (function (_super) {
|
|
15937
|
+
__extends(TileAdapter, _super);
|
|
15938
|
+
function TileAdapter() {
|
|
15939
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
15940
|
+
}
|
|
15941
|
+
TileAdapter.prototype.addLayer = function (options) {
|
|
15824
15942
|
this.options = Object.assign(this.options, options);
|
|
15825
15943
|
if (options) {
|
|
15826
|
-
|
|
15944
|
+
var url = options.url, opt = __rest(options, ["url"]);
|
|
15827
15945
|
if (url) {
|
|
15828
|
-
|
|
15829
|
-
pane: this.pane,
|
|
15830
|
-
attribution: opt.attribution,
|
|
15831
|
-
minZoom: opt.minZoom,
|
|
15832
|
-
maxZoom: opt.maxZoom,
|
|
15833
|
-
...opt.nativeOptions,
|
|
15834
|
-
};
|
|
15946
|
+
var tileLayerOptions = __assign({ pane: this.pane, attribution: opt.attribution, minZoom: opt.minZoom, maxZoom: opt.maxZoom }, opt.nativeOptions);
|
|
15835
15947
|
if (opt.subdomains) {
|
|
15836
15948
|
tileLayerOptions.subdomains = opt.subdomains;
|
|
15837
15949
|
}
|
|
15838
|
-
|
|
15950
|
+
var layer = void 0;
|
|
15839
15951
|
if (opt.headers) {
|
|
15840
|
-
layer = new TileLayer(url, {
|
|
15841
|
-
...tileLayerOptions,
|
|
15842
|
-
headers: opt.headers,
|
|
15843
|
-
setViewDelay: opt.setViewDelay,
|
|
15844
|
-
});
|
|
15952
|
+
layer = new TileLayer(url, __assign(__assign({}, tileLayerOptions), { headers: opt.headers, setViewDelay: opt.setViewDelay }));
|
|
15845
15953
|
}
|
|
15846
15954
|
else {
|
|
15847
15955
|
layer = new leafletSrc.exports.TileLayer(url, tileLayerOptions);
|
|
@@ -15849,57 +15957,57 @@ class TileAdapter extends BaseAdapter {
|
|
|
15849
15957
|
return layer;
|
|
15850
15958
|
}
|
|
15851
15959
|
}
|
|
15852
|
-
}
|
|
15853
|
-
|
|
15960
|
+
};
|
|
15961
|
+
return TileAdapter;
|
|
15962
|
+
}(BaseAdapter));
|
|
15854
15963
|
|
|
15855
|
-
|
|
15856
|
-
|
|
15857
|
-
|
|
15964
|
+
var WmsLayerBase = /** @class */ (function (_super) {
|
|
15965
|
+
__extends(WmsLayerBase, _super);
|
|
15966
|
+
function WmsLayerBase(urlTemplate, options) {
|
|
15967
|
+
return _super.call(this, urlTemplate, options) || this;
|
|
15858
15968
|
}
|
|
15859
|
-
|
|
15860
|
-
|
|
15969
|
+
return WmsLayerBase;
|
|
15970
|
+
}(leafletSrc.exports.TileLayer.WMS));
|
|
15971
|
+
var WmsLayer = makeRemote(WmsLayerBase);
|
|
15861
15972
|
// applyMixins(WmsLayer, [RemoteTileLayer]);
|
|
15862
15973
|
|
|
15863
|
-
|
|
15864
|
-
|
|
15974
|
+
var WmsAdapter = /** @class */ (function (_super) {
|
|
15975
|
+
__extends(WmsAdapter, _super);
|
|
15976
|
+
function WmsAdapter() {
|
|
15977
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
15978
|
+
}
|
|
15979
|
+
WmsAdapter.prototype.addLayer = function (options) {
|
|
15865
15980
|
Object.assign(this.options, options);
|
|
15866
|
-
|
|
15981
|
+
var url = options.url, opt = __rest(options, ["url"]);
|
|
15867
15982
|
if (url) {
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
attribution: opt.attribution,
|
|
15871
|
-
minZoom: opt.minZoom,
|
|
15872
|
-
maxZoom: opt.maxZoom,
|
|
15873
|
-
layers: options.layers,
|
|
15874
|
-
format: options.format,
|
|
15875
|
-
...options.nativeOptions,
|
|
15876
|
-
};
|
|
15877
|
-
let layer;
|
|
15983
|
+
var layerOptions = __assign({ pane: this.pane, attribution: opt.attribution, minZoom: opt.minZoom, maxZoom: opt.maxZoom, layers: options.layers, format: options.format }, options.nativeOptions);
|
|
15984
|
+
var layer = void 0;
|
|
15878
15985
|
if (opt.headers) {
|
|
15879
|
-
layer = new WmsLayer(url, {
|
|
15986
|
+
layer = new WmsLayer(url, __assign(__assign({}, layerOptions), { headers: opt.headers }));
|
|
15880
15987
|
}
|
|
15881
15988
|
else {
|
|
15882
15989
|
layer = new leafletSrc.exports.TileLayer.WMS(url, layerOptions);
|
|
15883
15990
|
}
|
|
15884
15991
|
return layer;
|
|
15885
15992
|
}
|
|
15886
|
-
}
|
|
15887
|
-
|
|
15993
|
+
};
|
|
15994
|
+
return WmsAdapter;
|
|
15995
|
+
}(BaseAdapter));
|
|
15888
15996
|
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
return
|
|
15893
|
-
name: 'OpenStreetMap',
|
|
15894
|
-
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
|
15895
|
-
...options,
|
|
15896
|
-
url,
|
|
15897
|
-
});
|
|
15997
|
+
var OsmAdapter = /** @class */ (function (_super) {
|
|
15998
|
+
__extends(OsmAdapter, _super);
|
|
15999
|
+
function OsmAdapter() {
|
|
16000
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
15898
16001
|
}
|
|
15899
|
-
|
|
16002
|
+
OsmAdapter.prototype.addLayer = function (options) {
|
|
16003
|
+
var url = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
|
16004
|
+
return _super.prototype.addLayer.call(this, __assign(__assign({ name: 'OpenStreetMap', attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }, options), { url: url }));
|
|
16005
|
+
};
|
|
16006
|
+
return OsmAdapter;
|
|
16007
|
+
}(TileAdapter));
|
|
15900
16008
|
|
|
15901
16009
|
function arrayToBoundsExpression(bounds) {
|
|
15902
|
-
|
|
16010
|
+
var e = bounds;
|
|
15903
16011
|
// top, left, bottom, right
|
|
15904
16012
|
return [
|
|
15905
16013
|
[e[3], e[0]],
|
|
@@ -15907,74 +16015,71 @@ function arrayToBoundsExpression(bounds) {
|
|
|
15907
16015
|
];
|
|
15908
16016
|
}
|
|
15909
16017
|
|
|
15910
|
-
|
|
15911
|
-
|
|
16018
|
+
var LeafletMapAdapter$1 = /** @class */ (function () {
|
|
16019
|
+
function LeafletMapAdapter() {
|
|
15912
16020
|
this.options = { target: 'map' };
|
|
15913
|
-
this.layerAdapters = LeafletMapAdapter
|
|
15914
|
-
this.controlAdapters = LeafletMapAdapter
|
|
16021
|
+
this.layerAdapters = LeafletMapAdapter.layerAdapters;
|
|
16022
|
+
this.controlAdapters = LeafletMapAdapter.controlAdapters;
|
|
15915
16023
|
this.emitter = new events.exports.EventEmitter();
|
|
15916
16024
|
this._unselectCb = [];
|
|
15917
16025
|
this._universalEvents = [
|
|
15918
16026
|
'move',
|
|
15919
16027
|
'zoom',
|
|
15920
|
-
'moveend',
|
|
15921
16028
|
'zoomend',
|
|
15922
16029
|
'zoomstart',
|
|
16030
|
+
'moveend',
|
|
15923
16031
|
'movestart',
|
|
15924
16032
|
];
|
|
16033
|
+
this._positionEvents = [
|
|
16034
|
+
'mousemove',
|
|
16035
|
+
'mouseout',
|
|
16036
|
+
'mouseover',
|
|
16037
|
+
];
|
|
15925
16038
|
}
|
|
15926
|
-
create(options) {
|
|
15927
|
-
|
|
16039
|
+
LeafletMapAdapter.prototype.create = function (options) {
|
|
16040
|
+
var _this = this;
|
|
16041
|
+
this.options = __assign({}, options);
|
|
15928
16042
|
if (this.options.target) {
|
|
15929
|
-
|
|
15930
|
-
this.map = new leafletSrc.exports.Map(this.options.target, {
|
|
15931
|
-
attributionControl: false,
|
|
15932
|
-
zoomControl: false,
|
|
15933
|
-
maxBounds: mb ? arrayToBoundsExpression(mb) : undefined,
|
|
15934
|
-
maxZoom,
|
|
15935
|
-
minZoom,
|
|
15936
|
-
center: center && [center[1], center[0]],
|
|
15937
|
-
zoom,
|
|
15938
|
-
...mapAdapterOptions,
|
|
15939
|
-
});
|
|
16043
|
+
var _a = this.options, zoom = _a.zoom, center = _a.center, maxZoom = _a.maxZoom, minZoom = _a.minZoom, mb = _a.maxBounds, mapAdapterOptions = _a.mapAdapterOptions;
|
|
16044
|
+
this.map = new leafletSrc.exports.Map(this.options.target, __assign({ attributionControl: false, zoomControl: false, maxBounds: mb ? arrayToBoundsExpression(mb) : undefined, maxZoom: maxZoom, minZoom: minZoom, center: center && [center[1], center[0]], zoom: zoom }, mapAdapterOptions));
|
|
15940
16045
|
// create default pane
|
|
15941
|
-
|
|
15942
|
-
this.map._addUnselectCb = (def)
|
|
15943
|
-
|
|
16046
|
+
var defPane = this.map.createPane('order-0');
|
|
16047
|
+
this.map._addUnselectCb = function (def) {
|
|
16048
|
+
_this._addUnselectCb(def);
|
|
15944
16049
|
};
|
|
15945
16050
|
defPane.style.zIndex = String(0);
|
|
15946
16051
|
this.emitter.emit('create', this);
|
|
15947
16052
|
this._addMapListeners();
|
|
15948
16053
|
}
|
|
15949
|
-
}
|
|
15950
|
-
destroy() {
|
|
16054
|
+
};
|
|
16055
|
+
LeafletMapAdapter.prototype.destroy = function () {
|
|
15951
16056
|
if (this.map) {
|
|
15952
16057
|
this.map.remove();
|
|
15953
16058
|
}
|
|
15954
16059
|
this._stopWatchSizeChangeToUpdateMinZoom();
|
|
15955
|
-
}
|
|
15956
|
-
getContainer() {
|
|
16060
|
+
};
|
|
16061
|
+
LeafletMapAdapter.prototype.getContainer = function () {
|
|
15957
16062
|
return this.map && this.map.getContainer();
|
|
15958
|
-
}
|
|
15959
|
-
getControlContainer() {
|
|
15960
|
-
|
|
16063
|
+
};
|
|
16064
|
+
LeafletMapAdapter.prototype.getControlContainer = function () {
|
|
16065
|
+
var controlContainer = this.map && this.map._controlContainer;
|
|
15961
16066
|
if (controlContainer) {
|
|
15962
16067
|
return controlContainer;
|
|
15963
16068
|
}
|
|
15964
16069
|
throw new Error('Leaflet Map is not initialized yet');
|
|
15965
|
-
}
|
|
15966
|
-
setCursor(cursor) {
|
|
16070
|
+
};
|
|
16071
|
+
LeafletMapAdapter.prototype.setCursor = function (cursor) {
|
|
15967
16072
|
if (this.map) {
|
|
15968
16073
|
this.map.getContainer().style.cursor = cursor;
|
|
15969
16074
|
}
|
|
15970
|
-
}
|
|
15971
|
-
setView(lngLatOrOpt, zoom) {
|
|
15972
|
-
|
|
16075
|
+
};
|
|
16076
|
+
LeafletMapAdapter.prototype.setView = function (lngLatOrOpt, zoom) {
|
|
16077
|
+
var map = this.map;
|
|
15973
16078
|
if (!map)
|
|
15974
16079
|
return;
|
|
15975
16080
|
if (Array.isArray(lngLatOrOpt)) {
|
|
15976
|
-
|
|
15977
|
-
|
|
16081
|
+
var lngLat = lngLatOrOpt;
|
|
16082
|
+
var lng = lngLat[0], lat = lngLat[1];
|
|
15978
16083
|
if (this.map) {
|
|
15979
16084
|
if (typeof zoom === 'number') {
|
|
15980
16085
|
this.map.setView([lat, lng], zoom, { animate: false });
|
|
@@ -15985,13 +16090,13 @@ class LeafletMapAdapter$1 {
|
|
|
15985
16090
|
}
|
|
15986
16091
|
}
|
|
15987
16092
|
else {
|
|
15988
|
-
|
|
15989
|
-
if (center &&
|
|
15990
|
-
this.setView(center,
|
|
16093
|
+
var zoom_1 = lngLatOrOpt.zoom, center = lngLatOrOpt.center, maxBounds = lngLatOrOpt.maxBounds, bounds = lngLatOrOpt.bounds, minZoom = lngLatOrOpt.minZoom, maxZoom = lngLatOrOpt.maxZoom;
|
|
16094
|
+
if (center && zoom_1 !== undefined) {
|
|
16095
|
+
this.setView(center, zoom_1);
|
|
15991
16096
|
}
|
|
15992
16097
|
else {
|
|
15993
|
-
if (
|
|
15994
|
-
this.setZoom(
|
|
16098
|
+
if (zoom_1 !== undefined) {
|
|
16099
|
+
this.setZoom(zoom_1);
|
|
15995
16100
|
}
|
|
15996
16101
|
if (center) {
|
|
15997
16102
|
this.setCenter(center);
|
|
@@ -16002,7 +16107,7 @@ class LeafletMapAdapter$1 {
|
|
|
16002
16107
|
}
|
|
16003
16108
|
if (maxBounds !== undefined) {
|
|
16004
16109
|
if (maxBounds) {
|
|
16005
|
-
|
|
16110
|
+
var b = arrayToBoundsExpression(maxBounds);
|
|
16006
16111
|
map.setMaxBounds(b);
|
|
16007
16112
|
map.setMinZoom(map.getBoundsZoom(b));
|
|
16008
16113
|
this._watchSizeChangeToUpdateMinZoom(b);
|
|
@@ -16021,42 +16126,43 @@ class LeafletMapAdapter$1 {
|
|
|
16021
16126
|
map.setMinZoom(minZoom);
|
|
16022
16127
|
}
|
|
16023
16128
|
}
|
|
16024
|
-
}
|
|
16025
|
-
setCenter(lngLat) {
|
|
16026
|
-
|
|
16129
|
+
};
|
|
16130
|
+
LeafletMapAdapter.prototype.setCenter = function (lngLat) {
|
|
16131
|
+
var lng = lngLat[0], lat = lngLat[1];
|
|
16027
16132
|
if (this.map) {
|
|
16028
16133
|
this.map.panTo([lat, lng]);
|
|
16029
16134
|
}
|
|
16030
|
-
}
|
|
16031
|
-
getCenter() {
|
|
16032
|
-
|
|
16135
|
+
};
|
|
16136
|
+
LeafletMapAdapter.prototype.getCenter = function () {
|
|
16137
|
+
var map = this.map;
|
|
16033
16138
|
if (map) {
|
|
16034
|
-
|
|
16035
|
-
|
|
16139
|
+
var bounds = map.getBounds();
|
|
16140
|
+
var center = bounds.getCenter();
|
|
16036
16141
|
return [center.lng, center.lat];
|
|
16037
16142
|
}
|
|
16038
|
-
}
|
|
16039
|
-
setZoom(zoom) {
|
|
16143
|
+
};
|
|
16144
|
+
LeafletMapAdapter.prototype.setZoom = function (zoom) {
|
|
16040
16145
|
if (this.map) {
|
|
16041
16146
|
this.map.setZoom(zoom);
|
|
16042
16147
|
}
|
|
16043
|
-
}
|
|
16044
|
-
getZoom() {
|
|
16148
|
+
};
|
|
16149
|
+
LeafletMapAdapter.prototype.getZoom = function () {
|
|
16045
16150
|
return (this.map && this.map.getZoom()) || undefined;
|
|
16046
|
-
}
|
|
16047
|
-
getBounds() {
|
|
16151
|
+
};
|
|
16152
|
+
LeafletMapAdapter.prototype.getBounds = function () {
|
|
16048
16153
|
if (!this.map)
|
|
16049
16154
|
return undefined;
|
|
16050
|
-
|
|
16051
|
-
|
|
16052
|
-
|
|
16155
|
+
var b = this.map.getBounds();
|
|
16156
|
+
var sw = b.getSouthWest();
|
|
16157
|
+
var ne = b.getNorthEast();
|
|
16053
16158
|
return [sw.lng, sw.lat, ne.lng, ne.lat];
|
|
16054
|
-
}
|
|
16159
|
+
};
|
|
16055
16160
|
// [west, south, east, north]
|
|
16056
|
-
fitBounds(bounds, options
|
|
16161
|
+
LeafletMapAdapter.prototype.fitBounds = function (bounds, options) {
|
|
16162
|
+
if (options === void 0) { options = {}; }
|
|
16057
16163
|
if (this.map) {
|
|
16058
|
-
|
|
16059
|
-
|
|
16164
|
+
var maxZoom = options.maxZoom, offset = options.offset, padding = options.padding;
|
|
16165
|
+
var opt = {};
|
|
16060
16166
|
if (maxZoom) {
|
|
16061
16167
|
opt.maxZoom = maxZoom;
|
|
16062
16168
|
}
|
|
@@ -16068,103 +16174,104 @@ class LeafletMapAdapter$1 {
|
|
|
16068
16174
|
}
|
|
16069
16175
|
this.map.fitBounds(arrayToBoundsExpression(bounds), opt);
|
|
16070
16176
|
}
|
|
16071
|
-
}
|
|
16072
|
-
getLayerAdapter(name) {
|
|
16073
|
-
return LeafletMapAdapter
|
|
16074
|
-
}
|
|
16075
|
-
createControl(control, options) {
|
|
16177
|
+
};
|
|
16178
|
+
LeafletMapAdapter.prototype.getLayerAdapter = function (name) {
|
|
16179
|
+
return LeafletMapAdapter.layerAdapters[name];
|
|
16180
|
+
};
|
|
16181
|
+
LeafletMapAdapter.prototype.createControl = function (control, options) {
|
|
16076
16182
|
return createControl(control, options, this);
|
|
16077
|
-
}
|
|
16078
|
-
createButtonControl(options) {
|
|
16183
|
+
};
|
|
16184
|
+
LeafletMapAdapter.prototype.createButtonControl = function (options) {
|
|
16079
16185
|
return createButtonControl(options, this);
|
|
16080
|
-
}
|
|
16081
|
-
addControl(control, position) {
|
|
16186
|
+
};
|
|
16187
|
+
LeafletMapAdapter.prototype.addControl = function (control, position) {
|
|
16082
16188
|
control.options.position = position.replace('-', '');
|
|
16083
16189
|
if (this.map) {
|
|
16084
16190
|
this.map.addControl(control);
|
|
16085
16191
|
return control;
|
|
16086
16192
|
}
|
|
16087
|
-
}
|
|
16088
|
-
removeControl(control) {
|
|
16193
|
+
};
|
|
16194
|
+
LeafletMapAdapter.prototype.removeControl = function (control) {
|
|
16089
16195
|
if (this.map) {
|
|
16090
16196
|
this.map.removeControl(control);
|
|
16091
16197
|
}
|
|
16092
|
-
}
|
|
16093
|
-
removeLayer(layer) {
|
|
16198
|
+
};
|
|
16199
|
+
LeafletMapAdapter.prototype.removeLayer = function (layer) {
|
|
16094
16200
|
layer && layer.remove && layer.remove();
|
|
16095
|
-
}
|
|
16096
|
-
showLayer(layer) {
|
|
16201
|
+
};
|
|
16202
|
+
LeafletMapAdapter.prototype.showLayer = function (layer) {
|
|
16097
16203
|
if (this.map) {
|
|
16098
16204
|
layer.addTo(this.map);
|
|
16099
16205
|
}
|
|
16100
|
-
}
|
|
16101
|
-
hideLayer(layer) {
|
|
16206
|
+
};
|
|
16207
|
+
LeafletMapAdapter.prototype.hideLayer = function (layer) {
|
|
16102
16208
|
layer.remove();
|
|
16103
|
-
}
|
|
16104
|
-
setLayerOpacity(layer, value) {
|
|
16209
|
+
};
|
|
16210
|
+
LeafletMapAdapter.prototype.setLayerOpacity = function (layer, value) {
|
|
16105
16211
|
if ('setOpacity' in layer) {
|
|
16106
16212
|
layer.setOpacity(value);
|
|
16107
16213
|
}
|
|
16108
|
-
}
|
|
16109
|
-
setLayerOrder(layer, order, layers) {
|
|
16214
|
+
};
|
|
16215
|
+
LeafletMapAdapter.prototype.setLayerOrder = function (layer, order, layers) {
|
|
16110
16216
|
//
|
|
16111
|
-
}
|
|
16112
|
-
onMapClick(evt) {
|
|
16113
|
-
|
|
16217
|
+
};
|
|
16218
|
+
LeafletMapAdapter.prototype.onMapClick = function (evt) {
|
|
16219
|
+
var converted = convertMapClickEvent(evt);
|
|
16114
16220
|
this.emitter.emit('preclick', converted);
|
|
16115
16221
|
this.emitter.emit('click', converted);
|
|
16116
|
-
}
|
|
16117
|
-
locate(opt, events) {
|
|
16118
|
-
|
|
16222
|
+
};
|
|
16223
|
+
LeafletMapAdapter.prototype.locate = function (opt, events) {
|
|
16224
|
+
var map = this.map;
|
|
16119
16225
|
if (map) {
|
|
16120
16226
|
map.locate(opt);
|
|
16121
16227
|
if (events) {
|
|
16122
|
-
|
|
16123
|
-
|
|
16124
|
-
|
|
16125
|
-
|
|
16126
|
-
|
|
16228
|
+
var locationfound_1 = events.locationfound, locationerror_1 = events.locationerror;
|
|
16229
|
+
var locationFound_1 = function (e) {
|
|
16230
|
+
var event = e;
|
|
16231
|
+
var lngLat = [event.latlng.lng, event.latlng.lat];
|
|
16232
|
+
locationfound_1({ lngLat: lngLat });
|
|
16127
16233
|
};
|
|
16128
|
-
if (
|
|
16129
|
-
map.on('locationfound',
|
|
16234
|
+
if (locationfound_1 !== undefined) {
|
|
16235
|
+
map.on('locationfound', locationFound_1, this);
|
|
16130
16236
|
}
|
|
16131
|
-
if (
|
|
16132
|
-
map.on('locationerror',
|
|
16237
|
+
if (locationerror_1) {
|
|
16238
|
+
map.on('locationerror', locationerror_1, this);
|
|
16133
16239
|
}
|
|
16134
|
-
|
|
16135
|
-
if (
|
|
16136
|
-
map.off('locationfound',
|
|
16240
|
+
var stop_1 = function () {
|
|
16241
|
+
if (locationfound_1 !== undefined) {
|
|
16242
|
+
map.off('locationfound', locationFound_1);
|
|
16137
16243
|
}
|
|
16138
|
-
if (
|
|
16139
|
-
map.off('locationerror',
|
|
16244
|
+
if (locationerror_1) {
|
|
16245
|
+
map.off('locationerror', locationerror_1);
|
|
16140
16246
|
}
|
|
16141
16247
|
};
|
|
16142
|
-
return { stop };
|
|
16248
|
+
return { stop: stop_1 };
|
|
16143
16249
|
}
|
|
16144
16250
|
}
|
|
16145
|
-
|
|
16146
|
-
return { stop };
|
|
16147
|
-
}
|
|
16148
|
-
_addUnselectCb(cb) {
|
|
16149
|
-
for (
|
|
16251
|
+
var stop = function () { return void 'fake function'; };
|
|
16252
|
+
return { stop: stop };
|
|
16253
|
+
};
|
|
16254
|
+
LeafletMapAdapter.prototype._addUnselectCb = function (cb) {
|
|
16255
|
+
for (var _i = 0, _a = this._unselectCb; _i < _a.length; _i++) {
|
|
16256
|
+
var p = _a[_i];
|
|
16150
16257
|
p();
|
|
16151
16258
|
}
|
|
16152
16259
|
this._unselectCb.length = 0;
|
|
16153
16260
|
this._unselectCb.push(cb);
|
|
16154
|
-
}
|
|
16155
|
-
_watchSizeChangeToUpdateMinZoom(bounds) {
|
|
16261
|
+
};
|
|
16262
|
+
LeafletMapAdapter.prototype._watchSizeChangeToUpdateMinZoom = function (bounds) {
|
|
16156
16263
|
this._stopWatchSizeChangeToUpdateMinZoom();
|
|
16157
|
-
|
|
16158
|
-
|
|
16264
|
+
var container = this.getContainer();
|
|
16265
|
+
var map = this.map;
|
|
16159
16266
|
if (container && map && window.ResizeObserver) {
|
|
16160
|
-
this._resizeObserver = new ResizeObserver(()
|
|
16267
|
+
this._resizeObserver = new ResizeObserver(function () {
|
|
16161
16268
|
map.setMinZoom(map.getBoundsZoom(bounds));
|
|
16162
16269
|
});
|
|
16163
16270
|
this._resizeObserver.observe(container);
|
|
16164
16271
|
}
|
|
16165
|
-
}
|
|
16166
|
-
_stopWatchSizeChangeToUpdateMinZoom() {
|
|
16167
|
-
|
|
16272
|
+
};
|
|
16273
|
+
LeafletMapAdapter.prototype._stopWatchSizeChangeToUpdateMinZoom = function () {
|
|
16274
|
+
var map = this.map;
|
|
16168
16275
|
if (map) {
|
|
16169
16276
|
map.setMinZoom(0);
|
|
16170
16277
|
}
|
|
@@ -16172,32 +16279,47 @@ class LeafletMapAdapter$1 {
|
|
|
16172
16279
|
this._resizeObserver.disconnect();
|
|
16173
16280
|
this._resizeObserver = undefined;
|
|
16174
16281
|
}
|
|
16175
|
-
}
|
|
16176
|
-
_addMapListeners() {
|
|
16177
|
-
|
|
16282
|
+
};
|
|
16283
|
+
LeafletMapAdapter.prototype._addMapListeners = function () {
|
|
16284
|
+
var _this = this;
|
|
16285
|
+
var map = this.map;
|
|
16178
16286
|
if (map) {
|
|
16179
|
-
map.on('click', (evt)
|
|
16180
|
-
|
|
16181
|
-
});
|
|
16182
|
-
this._universalEvents.forEach((e) => {
|
|
16183
|
-
map.on(e, () => this.emitter.emit(e, this), map);
|
|
16287
|
+
map.on('click', function (evt) {
|
|
16288
|
+
_this.onMapClick(evt);
|
|
16184
16289
|
});
|
|
16290
|
+
var _loop_1 = function (e) {
|
|
16291
|
+
map.on(e, function () { return _this.emitter.emit(e, _this); }, map);
|
|
16292
|
+
};
|
|
16293
|
+
for (var _i = 0, _a = this._universalEvents; _i < _a.length; _i++) {
|
|
16294
|
+
var e = _a[_i];
|
|
16295
|
+
_loop_1(e);
|
|
16296
|
+
}
|
|
16297
|
+
var _loop_2 = function (e) {
|
|
16298
|
+
map.on(e, function (evt) {
|
|
16299
|
+
return _this.emitter.emit(e, convertMapClickEvent(evt));
|
|
16300
|
+
}, map);
|
|
16301
|
+
};
|
|
16302
|
+
for (var _b = 0, _c = this._positionEvents; _b < _c.length; _b++) {
|
|
16303
|
+
var e = _c[_b];
|
|
16304
|
+
_loop_2(e);
|
|
16305
|
+
}
|
|
16185
16306
|
}
|
|
16186
|
-
}
|
|
16187
|
-
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
|
|
16197
|
-
|
|
16198
|
-
|
|
16199
|
-
|
|
16200
|
-
LeafletMapAdapter
|
|
16307
|
+
};
|
|
16308
|
+
LeafletMapAdapter.layerAdapters = {
|
|
16309
|
+
GEOJSON: GeoJsonAdapter,
|
|
16310
|
+
IMAGE: ImageAdapter,
|
|
16311
|
+
TILE: TileAdapter,
|
|
16312
|
+
WMS: WmsAdapter,
|
|
16313
|
+
// // MVT: MvtAdapter,
|
|
16314
|
+
OSM: OsmAdapter,
|
|
16315
|
+
};
|
|
16316
|
+
LeafletMapAdapter.controlAdapters = {
|
|
16317
|
+
ZOOM: leafletSrc.exports.Control.Zoom,
|
|
16318
|
+
ATTRIBUTION: AttributionControl,
|
|
16319
|
+
};
|
|
16320
|
+
LeafletMapAdapter.Map = leafletSrc.exports.Map;
|
|
16321
|
+
return LeafletMapAdapter;
|
|
16322
|
+
}());
|
|
16201
16323
|
|
|
16202
16324
|
/**
|
|
16203
16325
|
* @module leaflet-map-adapter
|