@nextgis/leaflet-map-adapter 1.19.5 → 2.0.0-alpha.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 +1 -1
- package/lib/index.d.ts +68 -88
- package/lib/leaflet-map-adapter.esm-browser.js +1990 -1772
- package/lib/leaflet-map-adapter.esm-browser.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-browser.prod.js +1 -11
- package/lib/leaflet-map-adapter.esm-browser.prod.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.js +1836 -1601
- package/lib/leaflet-map-adapter.esm-bundler.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.prod.js +1 -7
- package/lib/leaflet-map-adapter.esm-bundler.prod.js.map +1 -1
- package/lib/leaflet-map-adapter.global.js +16332 -16225
- package/lib/leaflet-map-adapter.global.js.map +1 -1
- package/lib/leaflet-map-adapter.global.prod.js +1 -11
- package/lib/leaflet-map-adapter.global.prod.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,78 +1,39 @@
|
|
|
1
|
-
/** Bundle of @nextgis/leaflet-map-adapter; version:
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var events = {exports: {}};
|
|
5
|
-
|
|
6
|
-
var R = typeof Reflect === 'object' ? Reflect : null;
|
|
7
|
-
var ReflectApply = R && typeof R.apply === 'function'
|
|
8
|
-
? R.apply
|
|
9
|
-
: function ReflectApply(target, receiver, args) {
|
|
10
|
-
return Function.prototype.apply.call(target, receiver, args);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
var ReflectOwnKeys;
|
|
14
|
-
if (R && typeof R.ownKeys === 'function') {
|
|
15
|
-
ReflectOwnKeys = R.ownKeys;
|
|
16
|
-
} else if (Object.getOwnPropertySymbols) {
|
|
17
|
-
ReflectOwnKeys = function ReflectOwnKeys(target) {
|
|
18
|
-
return Object.getOwnPropertyNames(target)
|
|
19
|
-
.concat(Object.getOwnPropertySymbols(target));
|
|
20
|
-
};
|
|
21
|
-
} else {
|
|
22
|
-
ReflectOwnKeys = function ReflectOwnKeys(target) {
|
|
23
|
-
return Object.getOwnPropertyNames(target);
|
|
24
|
-
};
|
|
25
|
-
}
|
|
1
|
+
/** Bundle of @nextgis/leaflet-map-adapter; version: 2.0.0-alpha.1; author: NextGIS */
|
|
2
|
+
var domain;
|
|
26
3
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return value !== value;
|
|
33
|
-
};
|
|
4
|
+
// This constructor is used to store event handlers. Instantiating this is
|
|
5
|
+
// faster than explicitly calling `Object.create(null)` to get a "clean" empty
|
|
6
|
+
// object (tested with v8 v4.9).
|
|
7
|
+
function EventHandlers() {}
|
|
8
|
+
EventHandlers.prototype = Object.create(null);
|
|
34
9
|
|
|
35
10
|
function EventEmitter() {
|
|
36
11
|
EventEmitter.init.call(this);
|
|
37
12
|
}
|
|
38
|
-
events.exports = EventEmitter;
|
|
39
|
-
events.exports.once = once;
|
|
40
13
|
|
|
41
|
-
//
|
|
14
|
+
// nodejs oddity
|
|
15
|
+
// require('events') === require('events').EventEmitter
|
|
42
16
|
EventEmitter.EventEmitter = EventEmitter;
|
|
43
17
|
|
|
18
|
+
EventEmitter.usingDomains = false;
|
|
19
|
+
|
|
20
|
+
EventEmitter.prototype.domain = undefined;
|
|
44
21
|
EventEmitter.prototype._events = undefined;
|
|
45
|
-
EventEmitter.prototype._eventsCount = 0;
|
|
46
22
|
EventEmitter.prototype._maxListeners = undefined;
|
|
47
23
|
|
|
48
24
|
// By default EventEmitters will print a warning if more than 10 listeners are
|
|
49
25
|
// added to it. This is a useful default which helps finding memory leaks.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
function checkListener(listener) {
|
|
53
|
-
if (typeof listener !== 'function') {
|
|
54
|
-
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
|
|
59
|
-
enumerable: true,
|
|
60
|
-
get: function() {
|
|
61
|
-
return defaultMaxListeners;
|
|
62
|
-
},
|
|
63
|
-
set: function(arg) {
|
|
64
|
-
if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
|
|
65
|
-
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
|
|
66
|
-
}
|
|
67
|
-
defaultMaxListeners = arg;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
26
|
+
EventEmitter.defaultMaxListeners = 10;
|
|
70
27
|
|
|
71
28
|
EventEmitter.init = function() {
|
|
29
|
+
this.domain = null;
|
|
30
|
+
if (EventEmitter.usingDomains) {
|
|
31
|
+
// if there is an active domain, then attach to it.
|
|
32
|
+
if (domain.active ) ;
|
|
33
|
+
}
|
|
72
34
|
|
|
73
|
-
if (this._events ===
|
|
74
|
-
|
|
75
|
-
this._events = Object.create(null);
|
|
35
|
+
if (!this._events || this._events === Object.getPrototypeOf(this)._events) {
|
|
36
|
+
this._events = new EventHandlers();
|
|
76
37
|
this._eventsCount = 0;
|
|
77
38
|
}
|
|
78
39
|
|
|
@@ -82,62 +43,139 @@ EventEmitter.init = function() {
|
|
|
82
43
|
// Obviously not all Emitters should be limited to 10. This function allows
|
|
83
44
|
// that to be increased. Set to zero for unlimited.
|
|
84
45
|
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
|
85
|
-
if (typeof n !== 'number' || n < 0 ||
|
|
86
|
-
throw new
|
|
87
|
-
}
|
|
46
|
+
if (typeof n !== 'number' || n < 0 || isNaN(n))
|
|
47
|
+
throw new TypeError('"n" argument must be a positive number');
|
|
88
48
|
this._maxListeners = n;
|
|
89
49
|
return this;
|
|
90
50
|
};
|
|
91
51
|
|
|
92
|
-
function
|
|
52
|
+
function $getMaxListeners(that) {
|
|
93
53
|
if (that._maxListeners === undefined)
|
|
94
54
|
return EventEmitter.defaultMaxListeners;
|
|
95
55
|
return that._maxListeners;
|
|
96
56
|
}
|
|
97
57
|
|
|
98
58
|
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
|
99
|
-
return
|
|
59
|
+
return $getMaxListeners(this);
|
|
100
60
|
};
|
|
101
61
|
|
|
62
|
+
// These standalone emit* functions are used to optimize calling of event
|
|
63
|
+
// handlers for fast cases because emit() itself often has a variable number of
|
|
64
|
+
// arguments and can be deoptimized because of that. These functions always have
|
|
65
|
+
// the same number of arguments and thus do not get deoptimized, so the code
|
|
66
|
+
// inside them can execute faster.
|
|
67
|
+
function emitNone(handler, isFn, self) {
|
|
68
|
+
if (isFn)
|
|
69
|
+
handler.call(self);
|
|
70
|
+
else {
|
|
71
|
+
var len = handler.length;
|
|
72
|
+
var listeners = arrayClone(handler, len);
|
|
73
|
+
for (var i = 0; i < len; ++i)
|
|
74
|
+
listeners[i].call(self);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function emitOne(handler, isFn, self, arg1) {
|
|
78
|
+
if (isFn)
|
|
79
|
+
handler.call(self, arg1);
|
|
80
|
+
else {
|
|
81
|
+
var len = handler.length;
|
|
82
|
+
var listeners = arrayClone(handler, len);
|
|
83
|
+
for (var i = 0; i < len; ++i)
|
|
84
|
+
listeners[i].call(self, arg1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function emitTwo(handler, isFn, self, arg1, arg2) {
|
|
88
|
+
if (isFn)
|
|
89
|
+
handler.call(self, arg1, arg2);
|
|
90
|
+
else {
|
|
91
|
+
var len = handler.length;
|
|
92
|
+
var listeners = arrayClone(handler, len);
|
|
93
|
+
for (var i = 0; i < len; ++i)
|
|
94
|
+
listeners[i].call(self, arg1, arg2);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function emitThree(handler, isFn, self, arg1, arg2, arg3) {
|
|
98
|
+
if (isFn)
|
|
99
|
+
handler.call(self, arg1, arg2, arg3);
|
|
100
|
+
else {
|
|
101
|
+
var len = handler.length;
|
|
102
|
+
var listeners = arrayClone(handler, len);
|
|
103
|
+
for (var i = 0; i < len; ++i)
|
|
104
|
+
listeners[i].call(self, arg1, arg2, arg3);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function emitMany(handler, isFn, self, args) {
|
|
109
|
+
if (isFn)
|
|
110
|
+
handler.apply(self, args);
|
|
111
|
+
else {
|
|
112
|
+
var len = handler.length;
|
|
113
|
+
var listeners = arrayClone(handler, len);
|
|
114
|
+
for (var i = 0; i < len; ++i)
|
|
115
|
+
listeners[i].apply(self, args);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
102
119
|
EventEmitter.prototype.emit = function emit(type) {
|
|
103
|
-
var args
|
|
104
|
-
for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
|
|
120
|
+
var er, handler, len, args, i, events, domain;
|
|
105
121
|
var doError = (type === 'error');
|
|
106
122
|
|
|
107
|
-
|
|
108
|
-
if (events
|
|
109
|
-
doError = (doError && events.error
|
|
123
|
+
events = this._events;
|
|
124
|
+
if (events)
|
|
125
|
+
doError = (doError && events.error == null);
|
|
110
126
|
else if (!doError)
|
|
111
127
|
return false;
|
|
112
128
|
|
|
129
|
+
domain = this.domain;
|
|
130
|
+
|
|
113
131
|
// If there is no 'error' event listener then throw.
|
|
114
132
|
if (doError) {
|
|
115
|
-
|
|
116
|
-
if (
|
|
117
|
-
er
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
133
|
+
er = arguments[1];
|
|
134
|
+
if (domain) {
|
|
135
|
+
if (!er)
|
|
136
|
+
er = new Error('Uncaught, unspecified "error" event');
|
|
137
|
+
er.domainEmitter = this;
|
|
138
|
+
er.domain = domain;
|
|
139
|
+
er.domainThrown = false;
|
|
140
|
+
domain.emit('error', er);
|
|
141
|
+
} else if (er instanceof Error) {
|
|
121
142
|
throw er; // Unhandled 'error' event
|
|
143
|
+
} else {
|
|
144
|
+
// At least give some kind of context to the user
|
|
145
|
+
var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
|
|
146
|
+
err.context = er;
|
|
147
|
+
throw err;
|
|
122
148
|
}
|
|
123
|
-
|
|
124
|
-
var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
|
|
125
|
-
err.context = er;
|
|
126
|
-
throw err; // Unhandled 'error' event
|
|
149
|
+
return false;
|
|
127
150
|
}
|
|
128
151
|
|
|
129
|
-
|
|
152
|
+
handler = events[type];
|
|
130
153
|
|
|
131
|
-
if (handler
|
|
154
|
+
if (!handler)
|
|
132
155
|
return false;
|
|
133
156
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
157
|
+
var isFn = typeof handler === 'function';
|
|
158
|
+
len = arguments.length;
|
|
159
|
+
switch (len) {
|
|
160
|
+
// fast cases
|
|
161
|
+
case 1:
|
|
162
|
+
emitNone(handler, isFn, this);
|
|
163
|
+
break;
|
|
164
|
+
case 2:
|
|
165
|
+
emitOne(handler, isFn, this, arguments[1]);
|
|
166
|
+
break;
|
|
167
|
+
case 3:
|
|
168
|
+
emitTwo(handler, isFn, this, arguments[1], arguments[2]);
|
|
169
|
+
break;
|
|
170
|
+
case 4:
|
|
171
|
+
emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
|
|
172
|
+
break;
|
|
173
|
+
// slower
|
|
174
|
+
default:
|
|
175
|
+
args = new Array(len - 1);
|
|
176
|
+
for (i = 1; i < len; i++)
|
|
177
|
+
args[i - 1] = arguments[i];
|
|
178
|
+
emitMany(handler, isFn, this, args);
|
|
141
179
|
}
|
|
142
180
|
|
|
143
181
|
return true;
|
|
@@ -148,16 +186,17 @@ function _addListener(target, type, listener, prepend) {
|
|
|
148
186
|
var events;
|
|
149
187
|
var existing;
|
|
150
188
|
|
|
151
|
-
|
|
189
|
+
if (typeof listener !== 'function')
|
|
190
|
+
throw new TypeError('"listener" argument must be a function');
|
|
152
191
|
|
|
153
192
|
events = target._events;
|
|
154
|
-
if (events
|
|
155
|
-
events = target._events =
|
|
193
|
+
if (!events) {
|
|
194
|
+
events = target._events = new EventHandlers();
|
|
156
195
|
target._eventsCount = 0;
|
|
157
196
|
} else {
|
|
158
197
|
// To avoid recursion in the case that type === "newListener"! Before
|
|
159
198
|
// adding it to the listeners, first emit "newListener".
|
|
160
|
-
if (events.newListener
|
|
199
|
+
if (events.newListener) {
|
|
161
200
|
target.emit('newListener', type,
|
|
162
201
|
listener.listener ? listener.listener : listener);
|
|
163
202
|
|
|
@@ -168,43 +207,46 @@ function _addListener(target, type, listener, prepend) {
|
|
|
168
207
|
existing = events[type];
|
|
169
208
|
}
|
|
170
209
|
|
|
171
|
-
if (existing
|
|
210
|
+
if (!existing) {
|
|
172
211
|
// Optimize the case of one listener. Don't need the extra array object.
|
|
173
212
|
existing = events[type] = listener;
|
|
174
213
|
++target._eventsCount;
|
|
175
214
|
} else {
|
|
176
215
|
if (typeof existing === 'function') {
|
|
177
216
|
// Adding the second element, need to change to array.
|
|
178
|
-
existing = events[type] =
|
|
179
|
-
|
|
180
|
-
// If we've already got an array, just append.
|
|
181
|
-
} else if (prepend) {
|
|
182
|
-
existing.unshift(listener);
|
|
217
|
+
existing = events[type] = prepend ? [listener, existing] :
|
|
218
|
+
[existing, listener];
|
|
183
219
|
} else {
|
|
184
|
-
|
|
220
|
+
// If we've already got an array, just append.
|
|
221
|
+
if (prepend) {
|
|
222
|
+
existing.unshift(listener);
|
|
223
|
+
} else {
|
|
224
|
+
existing.push(listener);
|
|
225
|
+
}
|
|
185
226
|
}
|
|
186
227
|
|
|
187
228
|
// Check for listener leak
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
existing.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
ProcessEmitWarning(w);
|
|
229
|
+
if (!existing.warned) {
|
|
230
|
+
m = $getMaxListeners(target);
|
|
231
|
+
if (m && m > 0 && existing.length > m) {
|
|
232
|
+
existing.warned = true;
|
|
233
|
+
var w = new Error('Possible EventEmitter memory leak detected. ' +
|
|
234
|
+
existing.length + ' ' + type + ' listeners added. ' +
|
|
235
|
+
'Use emitter.setMaxListeners() to increase limit');
|
|
236
|
+
w.name = 'MaxListenersExceededWarning';
|
|
237
|
+
w.emitter = target;
|
|
238
|
+
w.type = type;
|
|
239
|
+
w.count = existing.length;
|
|
240
|
+
emitWarning(w);
|
|
241
|
+
}
|
|
202
242
|
}
|
|
203
243
|
}
|
|
204
244
|
|
|
205
245
|
return target;
|
|
206
246
|
}
|
|
207
|
-
|
|
247
|
+
function emitWarning(e) {
|
|
248
|
+
typeof console.warn === 'function' ? console.warn(e) : console.log(e);
|
|
249
|
+
}
|
|
208
250
|
EventEmitter.prototype.addListener = function addListener(type, listener) {
|
|
209
251
|
return _addListener(this, type, listener, false);
|
|
210
252
|
};
|
|
@@ -216,55 +258,53 @@ EventEmitter.prototype.prependListener =
|
|
|
216
258
|
return _addListener(this, type, listener, true);
|
|
217
259
|
};
|
|
218
260
|
|
|
219
|
-
function onceWrapper() {
|
|
220
|
-
if (!this.fired) {
|
|
221
|
-
this.target.removeListener(this.type, this.wrapFn);
|
|
222
|
-
this.fired = true;
|
|
223
|
-
if (arguments.length === 0)
|
|
224
|
-
return this.listener.call(this.target);
|
|
225
|
-
return this.listener.apply(this.target, arguments);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
261
|
function _onceWrap(target, type, listener) {
|
|
230
|
-
var
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
262
|
+
var fired = false;
|
|
263
|
+
function g() {
|
|
264
|
+
target.removeListener(type, g);
|
|
265
|
+
if (!fired) {
|
|
266
|
+
fired = true;
|
|
267
|
+
listener.apply(target, arguments);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
g.listener = listener;
|
|
271
|
+
return g;
|
|
235
272
|
}
|
|
236
273
|
|
|
237
274
|
EventEmitter.prototype.once = function once(type, listener) {
|
|
238
|
-
|
|
275
|
+
if (typeof listener !== 'function')
|
|
276
|
+
throw new TypeError('"listener" argument must be a function');
|
|
239
277
|
this.on(type, _onceWrap(this, type, listener));
|
|
240
278
|
return this;
|
|
241
279
|
};
|
|
242
280
|
|
|
243
281
|
EventEmitter.prototype.prependOnceListener =
|
|
244
282
|
function prependOnceListener(type, listener) {
|
|
245
|
-
|
|
283
|
+
if (typeof listener !== 'function')
|
|
284
|
+
throw new TypeError('"listener" argument must be a function');
|
|
246
285
|
this.prependListener(type, _onceWrap(this, type, listener));
|
|
247
286
|
return this;
|
|
248
287
|
};
|
|
249
288
|
|
|
250
|
-
//
|
|
289
|
+
// emits a 'removeListener' event iff the listener was removed
|
|
251
290
|
EventEmitter.prototype.removeListener =
|
|
252
291
|
function removeListener(type, listener) {
|
|
253
292
|
var list, events, position, i, originalListener;
|
|
254
293
|
|
|
255
|
-
|
|
294
|
+
if (typeof listener !== 'function')
|
|
295
|
+
throw new TypeError('"listener" argument must be a function');
|
|
256
296
|
|
|
257
297
|
events = this._events;
|
|
258
|
-
if (events
|
|
298
|
+
if (!events)
|
|
259
299
|
return this;
|
|
260
300
|
|
|
261
301
|
list = events[type];
|
|
262
|
-
if (list
|
|
302
|
+
if (!list)
|
|
263
303
|
return this;
|
|
264
304
|
|
|
265
|
-
if (list === listener || list.listener === listener) {
|
|
305
|
+
if (list === listener || (list.listener && list.listener === listener)) {
|
|
266
306
|
if (--this._eventsCount === 0)
|
|
267
|
-
this._events =
|
|
307
|
+
this._events = new EventHandlers();
|
|
268
308
|
else {
|
|
269
309
|
delete events[type];
|
|
270
310
|
if (events.removeListener)
|
|
@@ -273,8 +313,9 @@ EventEmitter.prototype.removeListener =
|
|
|
273
313
|
} else if (typeof list !== 'function') {
|
|
274
314
|
position = -1;
|
|
275
315
|
|
|
276
|
-
for (i = list.length
|
|
277
|
-
if (list[i] === listener ||
|
|
316
|
+
for (i = list.length; i-- > 0;) {
|
|
317
|
+
if (list[i] === listener ||
|
|
318
|
+
(list[i].listener && list[i].listener === listener)) {
|
|
278
319
|
originalListener = list[i].listener;
|
|
279
320
|
position = i;
|
|
280
321
|
break;
|
|
@@ -284,40 +325,47 @@ EventEmitter.prototype.removeListener =
|
|
|
284
325
|
if (position < 0)
|
|
285
326
|
return this;
|
|
286
327
|
|
|
287
|
-
if (
|
|
288
|
-
list
|
|
289
|
-
|
|
328
|
+
if (list.length === 1) {
|
|
329
|
+
list[0] = undefined;
|
|
330
|
+
if (--this._eventsCount === 0) {
|
|
331
|
+
this._events = new EventHandlers();
|
|
332
|
+
return this;
|
|
333
|
+
} else {
|
|
334
|
+
delete events[type];
|
|
335
|
+
}
|
|
336
|
+
} else {
|
|
290
337
|
spliceOne(list, position);
|
|
291
338
|
}
|
|
292
339
|
|
|
293
|
-
if (
|
|
294
|
-
events[type] = list[0];
|
|
295
|
-
|
|
296
|
-
if (events.removeListener !== undefined)
|
|
340
|
+
if (events.removeListener)
|
|
297
341
|
this.emit('removeListener', type, originalListener || listener);
|
|
298
342
|
}
|
|
299
343
|
|
|
300
344
|
return this;
|
|
301
345
|
};
|
|
302
|
-
|
|
303
|
-
|
|
346
|
+
|
|
347
|
+
// Alias for removeListener added in NodeJS 10.0
|
|
348
|
+
// https://nodejs.org/api/events.html#events_emitter_off_eventname_listener
|
|
349
|
+
EventEmitter.prototype.off = function(type, listener){
|
|
350
|
+
return this.removeListener(type, listener);
|
|
351
|
+
};
|
|
304
352
|
|
|
305
353
|
EventEmitter.prototype.removeAllListeners =
|
|
306
354
|
function removeAllListeners(type) {
|
|
307
|
-
var listeners, events
|
|
355
|
+
var listeners, events;
|
|
308
356
|
|
|
309
357
|
events = this._events;
|
|
310
|
-
if (events
|
|
358
|
+
if (!events)
|
|
311
359
|
return this;
|
|
312
360
|
|
|
313
361
|
// not listening for removeListener, no need to emit
|
|
314
|
-
if (events.removeListener
|
|
362
|
+
if (!events.removeListener) {
|
|
315
363
|
if (arguments.length === 0) {
|
|
316
|
-
this._events =
|
|
364
|
+
this._events = new EventHandlers();
|
|
317
365
|
this._eventsCount = 0;
|
|
318
|
-
} else if (events[type]
|
|
366
|
+
} else if (events[type]) {
|
|
319
367
|
if (--this._eventsCount === 0)
|
|
320
|
-
this._events =
|
|
368
|
+
this._events = new EventHandlers();
|
|
321
369
|
else
|
|
322
370
|
delete events[type];
|
|
323
371
|
}
|
|
@@ -327,14 +375,13 @@ EventEmitter.prototype.removeAllListeners =
|
|
|
327
375
|
// emit removeListener for all listeners on all events
|
|
328
376
|
if (arguments.length === 0) {
|
|
329
377
|
var keys = Object.keys(events);
|
|
330
|
-
var key;
|
|
331
|
-
for (i = 0; i < keys.length; ++i) {
|
|
378
|
+
for (var i = 0, key; i < keys.length; ++i) {
|
|
332
379
|
key = keys[i];
|
|
333
380
|
if (key === 'removeListener') continue;
|
|
334
381
|
this.removeAllListeners(key);
|
|
335
382
|
}
|
|
336
383
|
this.removeAllListeners('removeListener');
|
|
337
|
-
this._events =
|
|
384
|
+
this._events = new EventHandlers();
|
|
338
385
|
this._eventsCount = 0;
|
|
339
386
|
return this;
|
|
340
387
|
}
|
|
@@ -343,39 +390,34 @@ EventEmitter.prototype.removeAllListeners =
|
|
|
343
390
|
|
|
344
391
|
if (typeof listeners === 'function') {
|
|
345
392
|
this.removeListener(type, listeners);
|
|
346
|
-
} else if (listeners
|
|
393
|
+
} else if (listeners) {
|
|
347
394
|
// LIFO order
|
|
348
|
-
|
|
349
|
-
this.removeListener(type, listeners[
|
|
350
|
-
}
|
|
395
|
+
do {
|
|
396
|
+
this.removeListener(type, listeners[listeners.length - 1]);
|
|
397
|
+
} while (listeners[0]);
|
|
351
398
|
}
|
|
352
399
|
|
|
353
400
|
return this;
|
|
354
401
|
};
|
|
355
402
|
|
|
356
|
-
function _listeners(target, type, unwrap) {
|
|
357
|
-
var events = target._events;
|
|
358
|
-
|
|
359
|
-
if (events === undefined)
|
|
360
|
-
return [];
|
|
361
|
-
|
|
362
|
-
var evlistener = events[type];
|
|
363
|
-
if (evlistener === undefined)
|
|
364
|
-
return [];
|
|
365
|
-
|
|
366
|
-
if (typeof evlistener === 'function')
|
|
367
|
-
return unwrap ? [evlistener.listener || evlistener] : [evlistener];
|
|
368
|
-
|
|
369
|
-
return unwrap ?
|
|
370
|
-
unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
403
|
EventEmitter.prototype.listeners = function listeners(type) {
|
|
374
|
-
|
|
375
|
-
|
|
404
|
+
var evlistener;
|
|
405
|
+
var ret;
|
|
406
|
+
var events = this._events;
|
|
407
|
+
|
|
408
|
+
if (!events)
|
|
409
|
+
ret = [];
|
|
410
|
+
else {
|
|
411
|
+
evlistener = events[type];
|
|
412
|
+
if (!evlistener)
|
|
413
|
+
ret = [];
|
|
414
|
+
else if (typeof evlistener === 'function')
|
|
415
|
+
ret = [evlistener.listener || evlistener];
|
|
416
|
+
else
|
|
417
|
+
ret = unwrapListeners(evlistener);
|
|
418
|
+
}
|
|
376
419
|
|
|
377
|
-
|
|
378
|
-
return _listeners(this, type, false);
|
|
420
|
+
return ret;
|
|
379
421
|
};
|
|
380
422
|
|
|
381
423
|
EventEmitter.listenerCount = function(emitter, type) {
|
|
@@ -390,12 +432,12 @@ EventEmitter.prototype.listenerCount = listenerCount;
|
|
|
390
432
|
function listenerCount(type) {
|
|
391
433
|
var events = this._events;
|
|
392
434
|
|
|
393
|
-
if (events
|
|
435
|
+
if (events) {
|
|
394
436
|
var evlistener = events[type];
|
|
395
437
|
|
|
396
438
|
if (typeof evlistener === 'function') {
|
|
397
439
|
return 1;
|
|
398
|
-
} else if (evlistener
|
|
440
|
+
} else if (evlistener) {
|
|
399
441
|
return evlistener.length;
|
|
400
442
|
}
|
|
401
443
|
}
|
|
@@ -404,22 +446,23 @@ function listenerCount(type) {
|
|
|
404
446
|
}
|
|
405
447
|
|
|
406
448
|
EventEmitter.prototype.eventNames = function eventNames() {
|
|
407
|
-
return this._eventsCount > 0 ?
|
|
449
|
+
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
|
408
450
|
};
|
|
409
451
|
|
|
410
|
-
|
|
411
|
-
var copy = new Array(n);
|
|
412
|
-
for (var i = 0; i < n; ++i)
|
|
413
|
-
copy[i] = arr[i];
|
|
414
|
-
return copy;
|
|
415
|
-
}
|
|
416
|
-
|
|
452
|
+
// About 1.5x faster than the two-arg version of Array#splice().
|
|
417
453
|
function spliceOne(list, index) {
|
|
418
|
-
for (
|
|
419
|
-
list[
|
|
454
|
+
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
|
|
455
|
+
list[i] = list[k];
|
|
420
456
|
list.pop();
|
|
421
457
|
}
|
|
422
458
|
|
|
459
|
+
function arrayClone(arr, i) {
|
|
460
|
+
var copy = new Array(i);
|
|
461
|
+
while (i--)
|
|
462
|
+
copy[i] = arr[i];
|
|
463
|
+
return copy;
|
|
464
|
+
}
|
|
465
|
+
|
|
423
466
|
function unwrapListeners(arr) {
|
|
424
467
|
var ret = new Array(arr.length);
|
|
425
468
|
for (var i = 0; i < ret.length; ++i) {
|
|
@@ -428,54 +471,7 @@ function unwrapListeners(arr) {
|
|
|
428
471
|
return ret;
|
|
429
472
|
}
|
|
430
473
|
|
|
431
|
-
|
|
432
|
-
return new Promise(function (resolve, reject) {
|
|
433
|
-
function errorListener(err) {
|
|
434
|
-
emitter.removeListener(name, resolver);
|
|
435
|
-
reject(err);
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
function resolver() {
|
|
439
|
-
if (typeof emitter.removeListener === 'function') {
|
|
440
|
-
emitter.removeListener('error', errorListener);
|
|
441
|
-
}
|
|
442
|
-
resolve([].slice.call(arguments));
|
|
443
|
-
}
|
|
444
|
-
eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
|
|
445
|
-
if (name !== 'error') {
|
|
446
|
-
addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
|
|
452
|
-
if (typeof emitter.on === 'function') {
|
|
453
|
-
eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
458
|
-
if (typeof emitter.on === 'function') {
|
|
459
|
-
if (flags.once) {
|
|
460
|
-
emitter.once(name, listener);
|
|
461
|
-
} else {
|
|
462
|
-
emitter.on(name, listener);
|
|
463
|
-
}
|
|
464
|
-
} else if (typeof emitter.addEventListener === 'function') {
|
|
465
|
-
// EventTarget does not have `error` event semantics like Node
|
|
466
|
-
// EventEmitters, we do not listen for `error` events here.
|
|
467
|
-
emitter.addEventListener(name, function wrapListener(arg) {
|
|
468
|
-
// IE does not have builtin `{ once: true }` support so we
|
|
469
|
-
// have to do it manually.
|
|
470
|
-
if (flags.once) {
|
|
471
|
-
emitter.removeEventListener(name, wrapListener);
|
|
472
|
-
}
|
|
473
|
-
listener(arg);
|
|
474
|
-
});
|
|
475
|
-
} else {
|
|
476
|
-
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
474
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
479
475
|
|
|
480
476
|
var leafletSrc = {exports: {}};
|
|
481
477
|
|
|
@@ -14541,1745 +14537,1967 @@ var leafletSrc = {exports: {}};
|
|
|
14541
14537
|
|
|
14542
14538
|
} (leafletSrc, leafletSrc.exports));
|
|
14543
14539
|
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
14558
|
-
|
|
14540
|
+
var leafletSrcExports = leafletSrc.exports;
|
|
14541
|
+
|
|
14542
|
+
class AttributionControl extends leafletSrcExports.Control.Attribution {
|
|
14543
|
+
// options: AttributionControlOptions
|
|
14544
|
+
constructor(options) {
|
|
14545
|
+
super(options);
|
|
14546
|
+
const customAttribution = options && options.customAttribution;
|
|
14547
|
+
if (customAttribution) {
|
|
14548
|
+
let attributions = [];
|
|
14549
|
+
if (Array.isArray(customAttribution)) {
|
|
14550
|
+
attributions = customAttribution;
|
|
14551
|
+
} else if (customAttribution) {
|
|
14552
|
+
attributions = [customAttribution];
|
|
14553
|
+
}
|
|
14554
|
+
attributions.forEach((x) => this.addAttribution(x));
|
|
14559
14555
|
}
|
|
14556
|
+
}
|
|
14560
14557
|
}
|
|
14561
14558
|
|
|
14562
14559
|
function createControl(control, options = {}, map) {
|
|
14563
|
-
|
|
14564
|
-
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14560
|
+
const C = leafletSrcExports.Control.extend({
|
|
14561
|
+
onAdd() {
|
|
14562
|
+
const element = document.createElement("div");
|
|
14563
|
+
const content = control.onAdd(map);
|
|
14564
|
+
element.classList.add("leaflet-control");
|
|
14565
|
+
if (options.bar) {
|
|
14566
|
+
element.classList.add("leaflet-bar");
|
|
14567
|
+
}
|
|
14568
|
+
if (options.addClass) {
|
|
14569
|
+
element.classList.add(options.addClass);
|
|
14570
|
+
}
|
|
14571
|
+
if (!options.margin && !options.bar) {
|
|
14572
|
+
element.style.marginBottom = "0px";
|
|
14573
|
+
element.style.marginTop = "0px";
|
|
14574
|
+
element.style.marginLeft = "0px";
|
|
14575
|
+
element.style.marginRight = "0px";
|
|
14576
|
+
}
|
|
14577
|
+
if (content) {
|
|
14578
|
+
element.appendChild(content);
|
|
14579
|
+
}
|
|
14580
|
+
leafletSrcExports.DomEvent.disableClickPropagation(element);
|
|
14581
|
+
return element;
|
|
14582
|
+
},
|
|
14583
|
+
onRemove() {
|
|
14584
|
+
control.onRemove();
|
|
14585
|
+
}
|
|
14586
|
+
});
|
|
14587
|
+
return new C();
|
|
14591
14588
|
}
|
|
14592
14589
|
|
|
14593
14590
|
function createButtonControl(options, map) {
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
14597
|
-
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
},
|
|
14591
|
+
const link = document.createElement("a");
|
|
14592
|
+
const title = options.title || "";
|
|
14593
|
+
link.href = "#";
|
|
14594
|
+
link.title = title;
|
|
14595
|
+
link.setAttribute("role", "button");
|
|
14596
|
+
link.setAttribute("aria-label", title);
|
|
14597
|
+
if (options.addClass) {
|
|
14598
|
+
link.classList.add(options.addClass);
|
|
14599
|
+
}
|
|
14600
|
+
leafletSrcExports.DomEvent.disableClickPropagation(link);
|
|
14601
|
+
leafletSrcExports.DomEvent.on(link, "click", leafletSrcExports.DomEvent.stop);
|
|
14602
|
+
if (options.html instanceof HTMLElement) {
|
|
14603
|
+
link.appendChild(options.html);
|
|
14604
|
+
} else if (typeof options.html === "string") {
|
|
14605
|
+
link.innerHTML = options.html;
|
|
14606
|
+
}
|
|
14607
|
+
const onClick = (e) => {
|
|
14608
|
+
e.stopPropagation();
|
|
14609
|
+
options.onClick();
|
|
14610
|
+
};
|
|
14611
|
+
return createControl(
|
|
14612
|
+
{
|
|
14613
|
+
onAdd() {
|
|
14614
|
+
if (options.onClick !== void 0) {
|
|
14615
|
+
link.addEventListener("click", onClick);
|
|
14616
|
+
}
|
|
14617
|
+
return link;
|
|
14618
|
+
},
|
|
14619
|
+
onRemove() {
|
|
14620
|
+
const parent = link.parentNode;
|
|
14621
|
+
if (parent) {
|
|
14622
|
+
parent.removeChild(link);
|
|
14623
|
+
}
|
|
14624
|
+
if (options.onClick !== void 0) {
|
|
14625
|
+
link.removeEventListener("click", onClick);
|
|
14626
|
+
}
|
|
14627
|
+
}
|
|
14628
|
+
},
|
|
14629
|
+
{ bar: true },
|
|
14630
|
+
map
|
|
14631
|
+
);
|
|
14632
14632
|
}
|
|
14633
14633
|
|
|
14634
|
-
/**
|
|
14635
|
-
* from https://github.com/CesiumGS/cesium/blob/master/Source/Core/defined.js
|
|
14636
|
-
*
|
|
14637
|
-
* @param val - The object.
|
|
14638
|
-
* @returns Returns true if the object is defined, returns false otherwise.
|
|
14639
|
-
*
|
|
14640
|
-
* @example
|
|
14641
|
-
* ```javascript
|
|
14642
|
-
* if (defined(positions)) {
|
|
14643
|
-
* doSomething();
|
|
14644
|
-
* } else {
|
|
14645
|
-
* doSomethingElse();
|
|
14646
|
-
* }
|
|
14647
|
-
* ```
|
|
14648
|
-
*/
|
|
14649
14634
|
function defined(val) {
|
|
14650
|
-
|
|
14635
|
+
return val !== void 0 && val !== null;
|
|
14651
14636
|
}
|
|
14652
14637
|
|
|
14653
|
-
// based on https://github.com/bvaughn/debounce-decorator
|
|
14654
14638
|
function debounce(cb, wait = 10) {
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
|
|
14639
|
+
let timeoutId;
|
|
14640
|
+
function wrapper(...args) {
|
|
14641
|
+
wrapper.clear();
|
|
14642
|
+
timeoutId = setTimeout(() => {
|
|
14643
|
+
timeoutId = null;
|
|
14644
|
+
cb.apply(this, args);
|
|
14645
|
+
}, wait);
|
|
14646
|
+
}
|
|
14647
|
+
wrapper.clear = function() {
|
|
14648
|
+
if (timeoutId) {
|
|
14649
|
+
clearTimeout(timeoutId);
|
|
14650
|
+
timeoutId = null;
|
|
14662
14651
|
}
|
|
14663
|
-
|
|
14664
|
-
|
|
14665
|
-
clearTimeout(timeoutId);
|
|
14666
|
-
timeoutId = null;
|
|
14667
|
-
}
|
|
14668
|
-
};
|
|
14669
|
-
return wrapper;
|
|
14652
|
+
};
|
|
14653
|
+
return wrapper;
|
|
14670
14654
|
}
|
|
14671
14655
|
|
|
14672
14656
|
function boundsToArray(bounds) {
|
|
14673
|
-
|
|
14674
|
-
|
|
14675
|
-
|
|
14657
|
+
const ne = bounds.getNorthEast();
|
|
14658
|
+
const sw = bounds.getSouthWest();
|
|
14659
|
+
return [sw.lng, sw.lat, ne.lng, ne.lat];
|
|
14676
14660
|
}
|
|
14677
14661
|
|
|
14678
14662
|
function findMostFrequentGeomType(arr) {
|
|
14679
|
-
|
|
14680
|
-
|
|
14681
|
-
|
|
14682
|
-
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
|
|
14686
|
-
|
|
14687
|
-
|
|
14688
|
-
}
|
|
14663
|
+
const counts = {};
|
|
14664
|
+
for (let fry = 0; fry < arr.length; fry++) {
|
|
14665
|
+
counts[arr[fry]] = 1 + (counts[arr[fry]] || 0);
|
|
14666
|
+
}
|
|
14667
|
+
let maxName = "";
|
|
14668
|
+
for (const c in counts) {
|
|
14669
|
+
const maxCount = maxName ? counts[maxName] : 0;
|
|
14670
|
+
if (counts[c] > maxCount) {
|
|
14671
|
+
maxName = c;
|
|
14689
14672
|
}
|
|
14690
|
-
|
|
14673
|
+
}
|
|
14674
|
+
return maxName;
|
|
14691
14675
|
}
|
|
14692
14676
|
function detectType(geojson) {
|
|
14693
|
-
|
|
14694
|
-
|
|
14695
|
-
|
|
14696
|
-
|
|
14697
|
-
|
|
14698
|
-
|
|
14699
|
-
|
|
14700
|
-
|
|
14701
|
-
|
|
14702
|
-
|
|
14703
|
-
|
|
14704
|
-
|
|
14705
|
-
|
|
14706
|
-
|
|
14707
|
-
|
|
14708
|
-
|
|
14677
|
+
let geometry;
|
|
14678
|
+
if (geojson.type === "FeatureCollection") {
|
|
14679
|
+
const featuresTypes = geojson.features.map(
|
|
14680
|
+
(f) => f.geometry.type
|
|
14681
|
+
);
|
|
14682
|
+
geometry = findMostFrequentGeomType(featuresTypes);
|
|
14683
|
+
} else if (geojson.type === "GeometryCollection") {
|
|
14684
|
+
const geometryTypes = geojson.geometries.map(
|
|
14685
|
+
(g) => g.type
|
|
14686
|
+
);
|
|
14687
|
+
geometry = findMostFrequentGeomType(geometryTypes);
|
|
14688
|
+
} else if (geojson.type === "Feature") {
|
|
14689
|
+
geometry = geojson.geometry.type;
|
|
14690
|
+
} else {
|
|
14691
|
+
geometry = geojson.type;
|
|
14692
|
+
}
|
|
14693
|
+
return geometry;
|
|
14709
14694
|
}
|
|
14710
14695
|
|
|
14711
14696
|
const typeAlias = {
|
|
14712
|
-
|
|
14713
|
-
|
|
14714
|
-
|
|
14715
|
-
|
|
14716
|
-
|
|
14717
|
-
|
|
14718
|
-
|
|
14697
|
+
Point: "point",
|
|
14698
|
+
LineString: "line",
|
|
14699
|
+
MultiPoint: "point",
|
|
14700
|
+
Polygon: "polygon",
|
|
14701
|
+
MultiLineString: "line",
|
|
14702
|
+
MultiPolygon: "polygon",
|
|
14703
|
+
GeometryCollection: "polygon"
|
|
14719
14704
|
};
|
|
14720
14705
|
const PAINT = {
|
|
14721
|
-
|
|
14722
|
-
|
|
14706
|
+
stroke: false,
|
|
14707
|
+
opacity: 1
|
|
14723
14708
|
};
|
|
14724
14709
|
const backAliases = {};
|
|
14725
14710
|
for (const a in typeAlias) {
|
|
14726
|
-
|
|
14727
|
-
|
|
14728
|
-
|
|
14729
|
-
|
|
14711
|
+
const layerType = typeAlias[a];
|
|
14712
|
+
const backAlias = backAliases[layerType] || [];
|
|
14713
|
+
backAlias.push(a);
|
|
14714
|
+
backAliases[layerType] = backAlias;
|
|
14730
14715
|
}
|
|
14731
14716
|
function geometryFilter(geometry, type) {
|
|
14732
|
-
|
|
14733
|
-
|
|
14717
|
+
const geoJsonGeometry = backAliases[type] || [];
|
|
14718
|
+
return geoJsonGeometry.indexOf(geometry) !== -1;
|
|
14734
14719
|
}
|
|
14735
14720
|
function filterGeometries(data, type) {
|
|
14736
|
-
|
|
14737
|
-
|
|
14738
|
-
|
|
14739
|
-
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
}
|
|
14746
|
-
else if (data.type === 'GeometryCollection') {
|
|
14747
|
-
const _data = data;
|
|
14748
|
-
_data.geometries = _data.geometries.filter((g) => geometryFilter(g.type, type));
|
|
14721
|
+
if (data.type === "FeatureCollection") {
|
|
14722
|
+
const _data = data;
|
|
14723
|
+
_data.features = _data.features.filter(
|
|
14724
|
+
(f) => geometryFilter(f.geometry.type, type)
|
|
14725
|
+
);
|
|
14726
|
+
} else if (data.type === "Feature") {
|
|
14727
|
+
const allow = geometryFilter(data.geometry.type, type);
|
|
14728
|
+
if (!allow) {
|
|
14729
|
+
return false;
|
|
14749
14730
|
}
|
|
14750
|
-
|
|
14731
|
+
} else if (data.type === "GeometryCollection") {
|
|
14732
|
+
const _data = data;
|
|
14733
|
+
_data.geometries = _data.geometries.filter(
|
|
14734
|
+
(g) => geometryFilter(g.type, type)
|
|
14735
|
+
);
|
|
14736
|
+
}
|
|
14737
|
+
return data;
|
|
14751
14738
|
}
|
|
14752
14739
|
function featuresBounds(features) {
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
14740
|
+
const geoJsonLayer = new leafletSrcExports.GeoJSON();
|
|
14741
|
+
const features_ = Array.isArray(features) ? features : [features];
|
|
14742
|
+
features_.forEach((f) => geoJsonLayer.addData(f));
|
|
14743
|
+
return geoJsonLayer.getBounds();
|
|
14757
14744
|
}
|
|
14758
14745
|
function getFeaturesBounds(features) {
|
|
14759
|
-
|
|
14746
|
+
return boundsToArray(featuresBounds(features));
|
|
14760
14747
|
}
|
|
14761
14748
|
function getFeaturesCenter(features) {
|
|
14762
|
-
|
|
14763
|
-
|
|
14749
|
+
const { lat, lng } = featuresBounds(features).getCenter();
|
|
14750
|
+
return [lng, lat];
|
|
14764
14751
|
}
|
|
14765
14752
|
function createFeaturePositionOptions(features) {
|
|
14766
|
-
|
|
14767
|
-
|
|
14768
|
-
|
|
14769
|
-
|
|
14753
|
+
return {
|
|
14754
|
+
getBounds: () => getFeaturesBounds(features),
|
|
14755
|
+
getCenter: () => getFeaturesCenter(features)
|
|
14756
|
+
};
|
|
14770
14757
|
}
|
|
14771
14758
|
|
|
14759
|
+
var __defProp$b = Object.defineProperty;
|
|
14760
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14761
|
+
var __publicField$7 = (obj, key, value) => {
|
|
14762
|
+
__defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14763
|
+
return value;
|
|
14764
|
+
};
|
|
14772
14765
|
class BaseAdapter {
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
14785
|
-
|
|
14786
|
-
}
|
|
14787
|
-
addLayer(options) {
|
|
14788
|
-
Object.assign(this.options, options);
|
|
14789
|
-
return undefined;
|
|
14766
|
+
constructor(map, options) {
|
|
14767
|
+
this.map = map;
|
|
14768
|
+
this.options = options;
|
|
14769
|
+
__publicField$7(this, "layer");
|
|
14770
|
+
__publicField$7(this, "pane", "order-0");
|
|
14771
|
+
if (options.order !== void 0) {
|
|
14772
|
+
const pane = "order-" + options.order;
|
|
14773
|
+
let exist = map.getPane(pane);
|
|
14774
|
+
if (!exist) {
|
|
14775
|
+
exist = map.createPane(pane);
|
|
14776
|
+
}
|
|
14777
|
+
exist.style.zIndex = String(Math.round(options.order * 100));
|
|
14778
|
+
this.pane = pane;
|
|
14790
14779
|
}
|
|
14780
|
+
}
|
|
14781
|
+
addLayer(options) {
|
|
14782
|
+
Object.assign(this.options, options);
|
|
14783
|
+
return void 0;
|
|
14784
|
+
}
|
|
14791
14785
|
}
|
|
14792
14786
|
|
|
14793
14787
|
function convertMapClickEvent(evt) {
|
|
14794
|
-
|
|
14795
|
-
|
|
14796
|
-
|
|
14797
|
-
|
|
14798
|
-
|
|
14799
|
-
|
|
14800
|
-
|
|
14801
|
-
|
|
14802
|
-
|
|
14788
|
+
const coord = evt.containerPoint;
|
|
14789
|
+
const latLng = evt.latlng;
|
|
14790
|
+
const { lat, lng } = latLng;
|
|
14791
|
+
return {
|
|
14792
|
+
latLng,
|
|
14793
|
+
lngLat: [lng, lat],
|
|
14794
|
+
pixel: { left: coord.x, top: coord.y },
|
|
14795
|
+
source: evt
|
|
14796
|
+
};
|
|
14803
14797
|
}
|
|
14804
14798
|
|
|
14805
|
-
|
|
14806
|
-
|
|
14807
|
-
|
|
14808
|
-
|
|
14809
|
-
|
|
14810
|
-
|
|
14811
|
-
|
|
14812
|
-
|
|
14813
|
-
|
|
14814
|
-
|
|
14815
|
-
|
|
14799
|
+
var __defProp$a = Object.defineProperty;
|
|
14800
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
14801
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
14802
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
14803
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14804
|
+
var __spreadValues$8 = (a, b) => {
|
|
14805
|
+
for (var prop in b || (b = {}))
|
|
14806
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
14807
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
14808
|
+
if (__getOwnPropSymbols$8)
|
|
14809
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
14810
|
+
if (__propIsEnum$8.call(b, prop))
|
|
14811
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
14812
|
+
}
|
|
14813
|
+
return a;
|
|
14814
|
+
};
|
|
14815
|
+
function createMouseEvent({
|
|
14816
|
+
layer,
|
|
14817
|
+
source
|
|
14818
|
+
}) {
|
|
14819
|
+
const layer_ = source.target;
|
|
14820
|
+
const feature = layer_.feature;
|
|
14821
|
+
const opt = __spreadValues$8({
|
|
14822
|
+
layer,
|
|
14823
|
+
feature,
|
|
14824
|
+
event: convertMapClickEvent(source),
|
|
14825
|
+
source
|
|
14826
|
+
}, createFeaturePositionOptions(feature));
|
|
14827
|
+
return opt;
|
|
14816
14828
|
}
|
|
14817
14829
|
|
|
14830
|
+
var __defProp$9 = Object.defineProperty;
|
|
14831
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
14832
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
14833
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
14834
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14835
|
+
var __spreadValues$7 = (a, b) => {
|
|
14836
|
+
for (var prop in b || (b = {}))
|
|
14837
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
14838
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
14839
|
+
if (__getOwnPropSymbols$7)
|
|
14840
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
14841
|
+
if (__propIsEnum$7.call(b, prop))
|
|
14842
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
14843
|
+
}
|
|
14844
|
+
return a;
|
|
14845
|
+
};
|
|
14846
|
+
var __publicField$6 = (obj, key, value) => {
|
|
14847
|
+
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14848
|
+
return value;
|
|
14849
|
+
};
|
|
14818
14850
|
class GeoJsonEvents {
|
|
14819
|
-
|
|
14820
|
-
|
|
14851
|
+
constructor(layer) {
|
|
14852
|
+
__publicField$6(this, "layer");
|
|
14853
|
+
__publicField$6(this, "_onclick");
|
|
14854
|
+
__publicField$6(this, "_mouseout");
|
|
14855
|
+
__publicField$6(this, "_mouseover");
|
|
14856
|
+
this.layer = layer;
|
|
14857
|
+
}
|
|
14858
|
+
handleMouseEvents(layer) {
|
|
14859
|
+
const { onClick, onLayerClick, onMouseOut, onMouseOver } = this.layer.options;
|
|
14860
|
+
const onClick_ = onClick || onLayerClick;
|
|
14861
|
+
if (onClick_) {
|
|
14862
|
+
this._onclick = (e) => {
|
|
14863
|
+
const selected = !!this.layer._getSelected(layer);
|
|
14864
|
+
onClick_(__spreadValues$7({
|
|
14865
|
+
selected
|
|
14866
|
+
}, this._createMouseEvent(e)));
|
|
14867
|
+
};
|
|
14868
|
+
layer.on("click", this._onclick, this);
|
|
14821
14869
|
}
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
this._onclick = (e) => {
|
|
14828
|
-
const selected = !!this.layer._getSelected(layer);
|
|
14829
|
-
onClick_({
|
|
14830
|
-
selected,
|
|
14831
|
-
...this._createMouseEvent(e),
|
|
14832
|
-
});
|
|
14833
|
-
};
|
|
14834
|
-
layer.on('click', this._onclick, this);
|
|
14835
|
-
}
|
|
14836
|
-
if (onMouseOut) {
|
|
14837
|
-
this._mouseout = (e) => {
|
|
14838
|
-
onMouseOut(this._createMouseEvent(e));
|
|
14839
|
-
};
|
|
14840
|
-
layer.on('mouseout', this._mouseout, this);
|
|
14841
|
-
}
|
|
14842
|
-
if (onMouseOver) {
|
|
14843
|
-
this._mouseover = (e) => {
|
|
14844
|
-
onMouseOver(this._createMouseEvent(e));
|
|
14845
|
-
};
|
|
14846
|
-
layer.on('mouseover', this._mouseover, this);
|
|
14847
|
-
}
|
|
14870
|
+
if (onMouseOut) {
|
|
14871
|
+
this._mouseout = (e) => {
|
|
14872
|
+
onMouseOut(this._createMouseEvent(e));
|
|
14873
|
+
};
|
|
14874
|
+
layer.on("mouseout", this._mouseout, this);
|
|
14848
14875
|
}
|
|
14849
|
-
|
|
14850
|
-
|
|
14851
|
-
|
|
14852
|
-
|
|
14853
|
-
|
|
14854
|
-
layer.off('mouseout', this._mouseout, this);
|
|
14855
|
-
}
|
|
14856
|
-
if (this._onclick) {
|
|
14857
|
-
layer.off('click', this._onclick, this);
|
|
14858
|
-
}
|
|
14876
|
+
if (onMouseOver) {
|
|
14877
|
+
this._mouseover = (e) => {
|
|
14878
|
+
onMouseOver(this._createMouseEvent(e));
|
|
14879
|
+
};
|
|
14880
|
+
layer.on("mouseover", this._mouseover, this);
|
|
14859
14881
|
}
|
|
14860
|
-
|
|
14861
|
-
|
|
14862
|
-
|
|
14863
|
-
|
|
14864
|
-
|
|
14882
|
+
}
|
|
14883
|
+
stopMouseEvents(layer) {
|
|
14884
|
+
if (this._mouseover) {
|
|
14885
|
+
layer.off("mouseover", this._mouseover, this);
|
|
14886
|
+
}
|
|
14887
|
+
if (this._mouseout) {
|
|
14888
|
+
layer.off("mouseout", this._mouseout, this);
|
|
14865
14889
|
}
|
|
14890
|
+
if (this._onclick) {
|
|
14891
|
+
layer.off("click", this._onclick, this);
|
|
14892
|
+
}
|
|
14893
|
+
}
|
|
14894
|
+
_createMouseEvent(source) {
|
|
14895
|
+
return createMouseEvent({
|
|
14896
|
+
layer: this.layer,
|
|
14897
|
+
source
|
|
14898
|
+
});
|
|
14899
|
+
}
|
|
14866
14900
|
}
|
|
14867
14901
|
|
|
14868
14902
|
function isPaint(paint) {
|
|
14869
|
-
|
|
14870
|
-
|
|
14871
|
-
|
|
14872
|
-
|
|
14903
|
+
if (Object.prototype.toString.call(paint) === "[object Object]") {
|
|
14904
|
+
return true;
|
|
14905
|
+
}
|
|
14906
|
+
return false;
|
|
14873
14907
|
}
|
|
14874
14908
|
function isPaintCallback(paint) {
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14909
|
+
if (typeof paint === "function") {
|
|
14910
|
+
return true;
|
|
14911
|
+
}
|
|
14912
|
+
return false;
|
|
14879
14913
|
}
|
|
14880
14914
|
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14915
|
+
var __defProp$8 = Object.defineProperty;
|
|
14916
|
+
var __defProps$4 = Object.defineProperties;
|
|
14917
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
14918
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
14919
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
14920
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
14921
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14922
|
+
var __spreadValues$6 = (a, b) => {
|
|
14923
|
+
for (var prop in b || (b = {}))
|
|
14924
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
14925
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
14926
|
+
if (__getOwnPropSymbols$6)
|
|
14927
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
14928
|
+
if (__propIsEnum$6.call(b, prop))
|
|
14929
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
14889
14930
|
}
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
|
|
14893
|
-
|
|
14894
|
-
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
const marker = layer;
|
|
14903
|
-
const divIcon = this._createDivIcon(style);
|
|
14904
|
-
setTimeout(() => {
|
|
14905
|
-
marker.setIcon(divIcon);
|
|
14906
|
-
}, 10);
|
|
14907
|
-
}
|
|
14908
|
-
else if ('setStyle' in layer) {
|
|
14909
|
-
layer.setStyle(this.preparePaint(style));
|
|
14910
|
-
}
|
|
14911
|
-
}
|
|
14912
|
-
}
|
|
14931
|
+
return a;
|
|
14932
|
+
};
|
|
14933
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
14934
|
+
var __objRest$2 = (source, exclude) => {
|
|
14935
|
+
var target = {};
|
|
14936
|
+
for (var prop in source)
|
|
14937
|
+
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
14938
|
+
target[prop] = source[prop];
|
|
14939
|
+
if (source != null && __getOwnPropSymbols$6)
|
|
14940
|
+
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
14941
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
14942
|
+
target[prop] = source[prop];
|
|
14913
14943
|
}
|
|
14914
|
-
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
14930
|
-
|
|
14931
|
-
|
|
14932
|
-
|
|
14933
|
-
|
|
14934
|
-
|
|
14935
|
-
|
|
14936
|
-
|
|
14937
|
-
|
|
14938
|
-
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
|
|
14945
|
-
|
|
14946
|
-
|
|
14947
|
-
|
|
14948
|
-
}
|
|
14949
|
-
return readyPaint;
|
|
14944
|
+
return target;
|
|
14945
|
+
};
|
|
14946
|
+
var __publicField$5 = (obj, key, value) => {
|
|
14947
|
+
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14948
|
+
return value;
|
|
14949
|
+
};
|
|
14950
|
+
class GeoJsonPaint {
|
|
14951
|
+
constructor(layer) {
|
|
14952
|
+
__publicField$5(this, "layer");
|
|
14953
|
+
this.layer = layer;
|
|
14954
|
+
}
|
|
14955
|
+
setPaintEachLayer(paint) {
|
|
14956
|
+
this.layer._layers.forEach((layerDef) => {
|
|
14957
|
+
this.setPaint(layerDef, paint);
|
|
14958
|
+
});
|
|
14959
|
+
}
|
|
14960
|
+
setPaint(layerDef, paint) {
|
|
14961
|
+
let style = void 0;
|
|
14962
|
+
const { layer, feature } = layerDef;
|
|
14963
|
+
if (layer && feature) {
|
|
14964
|
+
if (isPaintCallback(paint)) {
|
|
14965
|
+
style = paint(feature);
|
|
14966
|
+
} else if (isPaint(paint)) {
|
|
14967
|
+
style = paint;
|
|
14968
|
+
}
|
|
14969
|
+
if (style) {
|
|
14970
|
+
if (this.layer.type === "point" && style.type === "icon") {
|
|
14971
|
+
const marker = layer;
|
|
14972
|
+
const divIcon = this._createDivIcon(style);
|
|
14973
|
+
setTimeout(() => {
|
|
14974
|
+
marker.setIcon(divIcon);
|
|
14975
|
+
}, 10);
|
|
14976
|
+
} else if ("setStyle" in layer) {
|
|
14977
|
+
layer.setStyle(this.preparePaint(style));
|
|
14950
14978
|
}
|
|
14951
|
-
|
|
14979
|
+
}
|
|
14952
14980
|
}
|
|
14953
|
-
|
|
14954
|
-
|
|
14955
|
-
|
|
14956
|
-
|
|
14957
|
-
|
|
14958
|
-
|
|
14959
|
-
|
|
14960
|
-
|
|
14981
|
+
}
|
|
14982
|
+
preparePaint(paint) {
|
|
14983
|
+
if (paint.type !== "get-paint") {
|
|
14984
|
+
const paintAliases = [
|
|
14985
|
+
["color", "strokeColor"],
|
|
14986
|
+
["opacity", "strokeOpacity"],
|
|
14987
|
+
["stroke", "stroke"],
|
|
14988
|
+
["fillColor", "fillColor"],
|
|
14989
|
+
["fillOpacity", "fillOpacity"],
|
|
14990
|
+
["fill", "fill"],
|
|
14991
|
+
["weight", "weight"]
|
|
14992
|
+
];
|
|
14993
|
+
const aliases = this.layer.type === "line" ? [
|
|
14994
|
+
["color", "strokeColor"],
|
|
14995
|
+
["opacity", "strokeOpacity"],
|
|
14996
|
+
["weight", "weight"]
|
|
14997
|
+
] : paintAliases;
|
|
14998
|
+
const readyPaint = {};
|
|
14999
|
+
if ("radius" in paint && typeof paint.radius === "number") {
|
|
15000
|
+
readyPaint.radius = paint.radius;
|
|
15001
|
+
}
|
|
15002
|
+
for (const [to, from] of aliases) {
|
|
15003
|
+
const opacity = this.layer.options.opacity;
|
|
15004
|
+
let paintProp = paint[from];
|
|
15005
|
+
if (defined(opacity) && from.toLowerCase().indexOf("opacity") !== -1) {
|
|
15006
|
+
paintProp = Number(paintProp) * opacity;
|
|
14961
15007
|
}
|
|
14962
|
-
if (
|
|
14963
|
-
|
|
15008
|
+
if (paintProp !== void 0) {
|
|
15009
|
+
Object.defineProperty(readyPaint, to, {
|
|
15010
|
+
enumerable: true,
|
|
15011
|
+
value: paintProp
|
|
15012
|
+
});
|
|
14964
15013
|
}
|
|
14965
|
-
|
|
14966
|
-
|
|
14967
|
-
...toLIconOpt,
|
|
14968
|
-
html: element,
|
|
14969
|
-
});
|
|
14970
|
-
return divIcon;
|
|
15014
|
+
}
|
|
15015
|
+
return readyPaint;
|
|
14971
15016
|
}
|
|
14972
|
-
|
|
14973
|
-
|
|
14974
|
-
|
|
14975
|
-
|
|
14976
|
-
|
|
14977
|
-
|
|
14978
|
-
|
|
14979
|
-
|
|
14980
|
-
|
|
14981
|
-
|
|
14982
|
-
|
|
14983
|
-
|
|
14984
|
-
|
|
14985
|
-
|
|
14986
|
-
|
|
14987
|
-
|
|
14988
|
-
|
|
15017
|
+
return PAINT;
|
|
15018
|
+
}
|
|
15019
|
+
_createDivIcon(icon) {
|
|
15020
|
+
const _a = icon, { html, rotate, className } = _a, toLIconOpt = __objRest$2(_a, ["html", "rotate", "className"]);
|
|
15021
|
+
const element = document.createElement("div");
|
|
15022
|
+
if (className) {
|
|
15023
|
+
element.className = className;
|
|
15024
|
+
}
|
|
15025
|
+
if (rotate) {
|
|
15026
|
+
element.style.transform = `rotateZ(${rotate}deg)`;
|
|
15027
|
+
}
|
|
15028
|
+
if (html) {
|
|
15029
|
+
element.innerHTML = html;
|
|
15030
|
+
}
|
|
15031
|
+
const divIcon = new leafletSrcExports.DivIcon(__spreadProps$4(__spreadValues$6({
|
|
15032
|
+
className: ""
|
|
15033
|
+
}, toLIconOpt), {
|
|
15034
|
+
html: element
|
|
15035
|
+
}));
|
|
15036
|
+
return divIcon;
|
|
15037
|
+
}
|
|
15038
|
+
createPaintToLayer(icon) {
|
|
15039
|
+
if (icon && icon.type) {
|
|
15040
|
+
if (icon.type === "icon") {
|
|
15041
|
+
const iconClassName = icon.className;
|
|
15042
|
+
const html = icon.html;
|
|
15043
|
+
if (iconClassName || html) {
|
|
15044
|
+
return (_, latlng) => {
|
|
15045
|
+
const divIcon = this._createDivIcon(icon);
|
|
15046
|
+
return new leafletSrcExports.Marker(latlng, { icon: divIcon });
|
|
15047
|
+
};
|
|
14989
15048
|
}
|
|
15049
|
+
} else if (icon.type === "pin") {
|
|
14990
15050
|
return (_, latlng) => {
|
|
14991
|
-
|
|
14992
|
-
return new leafletSrc.exports.CircleMarker(latlng, this.preparePaint({ ...p, ...icon }));
|
|
15051
|
+
return new leafletSrcExports.Marker(latlng);
|
|
14993
15052
|
};
|
|
15053
|
+
}
|
|
14994
15054
|
}
|
|
14995
|
-
|
|
14996
|
-
|
|
14997
|
-
|
|
14998
|
-
|
|
14999
|
-
|
|
15000
|
-
|
|
15001
|
-
|
|
15002
|
-
|
|
15003
|
-
|
|
15004
|
-
|
|
15005
|
-
|
|
15006
|
-
|
|
15007
|
-
|
|
15008
|
-
|
|
15009
|
-
|
|
15055
|
+
return (_, latlng) => {
|
|
15056
|
+
const p = PAINT;
|
|
15057
|
+
return new leafletSrcExports.CircleMarker(latlng, this.preparePaint(__spreadValues$6(__spreadValues$6({}, p), icon)));
|
|
15058
|
+
};
|
|
15059
|
+
}
|
|
15060
|
+
createPaintOptions(paint) {
|
|
15061
|
+
const geoJsonOptions = {};
|
|
15062
|
+
const newPaint = this.preparePaint(paint);
|
|
15063
|
+
if (paint) {
|
|
15064
|
+
geoJsonOptions.style = () => {
|
|
15065
|
+
return newPaint;
|
|
15066
|
+
};
|
|
15067
|
+
}
|
|
15068
|
+
if (this.layer.type === "point") {
|
|
15069
|
+
geoJsonOptions.pointToLayer = this.createPaintToLayer(
|
|
15070
|
+
paint
|
|
15071
|
+
);
|
|
15072
|
+
} else if (this.layer.type === "line") {
|
|
15073
|
+
newPaint.stroke = true;
|
|
15010
15074
|
}
|
|
15075
|
+
return geoJsonOptions;
|
|
15076
|
+
}
|
|
15011
15077
|
}
|
|
15012
15078
|
|
|
15013
|
-
|
|
15014
|
-
|
|
15015
|
-
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
|
|
15019
|
-
|
|
15020
|
-
|
|
15021
|
-
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
|
|
15028
|
-
this._paint = new GeoJsonPaint(this);
|
|
15029
|
-
}
|
|
15030
|
-
addLayer(options) {
|
|
15031
|
-
Object.assign(this.options, options);
|
|
15032
|
-
this.paint = options.paint;
|
|
15033
|
-
this.layer = new leafletSrc.exports.FeatureGroup([], {
|
|
15034
|
-
...options.nativeOptions,
|
|
15035
|
-
pane: this.pane,
|
|
15036
|
-
});
|
|
15037
|
-
this.selectedPaint = options.selectedPaint;
|
|
15038
|
-
options.paint = this.paint;
|
|
15039
|
-
if (options.data) {
|
|
15040
|
-
this.addData(options.data);
|
|
15041
|
-
}
|
|
15042
|
-
this._addMapListener();
|
|
15043
|
-
return this.layer;
|
|
15044
|
-
}
|
|
15045
|
-
beforeRemove() {
|
|
15046
|
-
this._removeMapListener();
|
|
15079
|
+
var __defProp$7 = Object.defineProperty;
|
|
15080
|
+
var __defProps$3 = Object.defineProperties;
|
|
15081
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
15082
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
15083
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
15084
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
15085
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15086
|
+
var __spreadValues$5 = (a, b) => {
|
|
15087
|
+
for (var prop in b || (b = {}))
|
|
15088
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
15089
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
15090
|
+
if (__getOwnPropSymbols$5)
|
|
15091
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
15092
|
+
if (__propIsEnum$5.call(b, prop))
|
|
15093
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
15047
15094
|
}
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
|
|
15055
|
-
|
|
15056
|
-
|
|
15057
|
-
|
|
15058
|
-
|
|
15059
|
-
|
|
15060
|
-
|
|
15061
|
-
|
|
15062
|
-
|
|
15063
|
-
|
|
15064
|
-
|
|
15065
|
-
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
|
|
15069
|
-
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
|
|
15077
|
-
|
|
15078
|
-
|
|
15079
|
-
|
|
15080
|
-
|
|
15081
|
-
|
|
15082
|
-
|
|
15083
|
-
|
|
15084
|
-
|
|
15085
|
-
|
|
15086
|
-
|
|
15087
|
-
|
|
15088
|
-
|
|
15089
|
-
|
|
15090
|
-
|
|
15091
|
-
|
|
15092
|
-
|
|
15093
|
-
|
|
15094
|
-
|
|
15095
|
-
|
|
15096
|
-
|
|
15097
|
-
|
|
15098
|
-
|
|
15099
|
-
|
|
15100
|
-
|
|
15101
|
-
|
|
15102
|
-
|
|
15103
|
-
|
|
15104
|
-
|
|
15105
|
-
|
|
15106
|
-
|
|
15107
|
-
|
|
15108
|
-
|
|
15109
|
-
...createFeaturePositionOptions(feature),
|
|
15110
|
-
})
|
|
15111
|
-
: true;
|
|
15112
|
-
if (ok) {
|
|
15113
|
-
layer_.addLayer(layer);
|
|
15114
|
-
filteredLayers.push({
|
|
15115
|
-
target: this,
|
|
15116
|
-
feature,
|
|
15117
|
-
layer,
|
|
15118
|
-
...createFeaturePositionOptions(feature),
|
|
15119
|
-
});
|
|
15120
|
-
}
|
|
15121
|
-
else {
|
|
15122
|
-
layer_.removeLayer(layer);
|
|
15123
|
-
}
|
|
15124
|
-
}
|
|
15125
|
-
});
|
|
15126
|
-
this._filteredLayers = filteredLayers;
|
|
15127
|
-
layer_.addTo(map);
|
|
15128
|
-
}
|
|
15129
|
-
return this._filteredLayers;
|
|
15095
|
+
return a;
|
|
15096
|
+
};
|
|
15097
|
+
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
15098
|
+
var __publicField$4 = (obj, key, value) => {
|
|
15099
|
+
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15100
|
+
return value;
|
|
15101
|
+
};
|
|
15102
|
+
var __async = (__this, __arguments, generator) => {
|
|
15103
|
+
return new Promise((resolve, reject) => {
|
|
15104
|
+
var fulfilled = (value) => {
|
|
15105
|
+
try {
|
|
15106
|
+
step(generator.next(value));
|
|
15107
|
+
} catch (e) {
|
|
15108
|
+
reject(e);
|
|
15109
|
+
}
|
|
15110
|
+
};
|
|
15111
|
+
var rejected = (value) => {
|
|
15112
|
+
try {
|
|
15113
|
+
step(generator.throw(value));
|
|
15114
|
+
} catch (e) {
|
|
15115
|
+
reject(e);
|
|
15116
|
+
}
|
|
15117
|
+
};
|
|
15118
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
15119
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
15120
|
+
});
|
|
15121
|
+
};
|
|
15122
|
+
class GeoJsonAdapter extends BaseAdapter {
|
|
15123
|
+
constructor(map, options) {
|
|
15124
|
+
super(map, options);
|
|
15125
|
+
__publicField$4(this, "layer");
|
|
15126
|
+
__publicField$4(this, "selected", false);
|
|
15127
|
+
__publicField$4(this, "type");
|
|
15128
|
+
__publicField$4(this, "_layers", []);
|
|
15129
|
+
__publicField$4(this, "_events");
|
|
15130
|
+
__publicField$4(this, "paint");
|
|
15131
|
+
__publicField$4(this, "selectedPaint");
|
|
15132
|
+
__publicField$4(this, "_selectedLayers", []);
|
|
15133
|
+
__publicField$4(this, "_filteredLayers", []);
|
|
15134
|
+
__publicField$4(this, "_filterFun");
|
|
15135
|
+
__publicField$4(this, "_openedPopup", []);
|
|
15136
|
+
__publicField$4(this, "_paint");
|
|
15137
|
+
__publicField$4(this, "$updateTooltip", debounce(() => {
|
|
15138
|
+
this.updateTooltip();
|
|
15139
|
+
}, 300));
|
|
15140
|
+
__publicField$4(this, "$unselect", () => {
|
|
15141
|
+
this.unselect();
|
|
15142
|
+
});
|
|
15143
|
+
this._events = new GeoJsonEvents(this);
|
|
15144
|
+
this._paint = new GeoJsonPaint(this);
|
|
15145
|
+
}
|
|
15146
|
+
addLayer(options) {
|
|
15147
|
+
Object.assign(this.options, options);
|
|
15148
|
+
this.paint = options.paint;
|
|
15149
|
+
this.layer = new leafletSrcExports.FeatureGroup([], __spreadProps$3(__spreadValues$5({}, options.nativeOptions), {
|
|
15150
|
+
pane: this.pane
|
|
15151
|
+
}));
|
|
15152
|
+
this.selectedPaint = options.selectedPaint;
|
|
15153
|
+
options.paint = this.paint;
|
|
15154
|
+
if (options.data) {
|
|
15155
|
+
this.addData(options.data);
|
|
15130
15156
|
}
|
|
15131
|
-
|
|
15132
|
-
|
|
15157
|
+
this._addMapListener();
|
|
15158
|
+
return this.layer;
|
|
15159
|
+
}
|
|
15160
|
+
beforeRemove() {
|
|
15161
|
+
this._removeMapListener();
|
|
15162
|
+
}
|
|
15163
|
+
select(findFeatureFun) {
|
|
15164
|
+
this.unselect();
|
|
15165
|
+
if (findFeatureFun) {
|
|
15166
|
+
const def = this._layers.filter(findFeatureFun);
|
|
15167
|
+
for (const x of def) {
|
|
15168
|
+
this._selectLayer(x, "api");
|
|
15169
|
+
}
|
|
15170
|
+
} else if (!this.selected) {
|
|
15171
|
+
this.selected = true;
|
|
15172
|
+
if (this.selectedPaint) {
|
|
15173
|
+
this._paint.setPaintEachLayer(
|
|
15174
|
+
this.selectedPaint
|
|
15175
|
+
);
|
|
15176
|
+
}
|
|
15133
15177
|
}
|
|
15134
|
-
|
|
15135
|
-
|
|
15136
|
-
|
|
15137
|
-
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15141
|
-
|
|
15142
|
-
|
|
15143
|
-
|
|
15144
|
-
|
|
15178
|
+
}
|
|
15179
|
+
unselect(findFeatureFun) {
|
|
15180
|
+
if (findFeatureFun) {
|
|
15181
|
+
const feature = this._layers.filter(findFeatureFun);
|
|
15182
|
+
feature.forEach((x) => {
|
|
15183
|
+
this._unSelectLayer(x);
|
|
15184
|
+
});
|
|
15185
|
+
} else if (this.selected) {
|
|
15186
|
+
for (const p of this._openedPopup) {
|
|
15187
|
+
this._removePopup(p[0]);
|
|
15188
|
+
}
|
|
15189
|
+
if (this.paint) {
|
|
15190
|
+
this._paint.setPaintEachLayer(this.paint);
|
|
15191
|
+
}
|
|
15192
|
+
this._selectedLayers.length = 0;
|
|
15193
|
+
this.selected = false;
|
|
15145
15194
|
}
|
|
15146
|
-
|
|
15147
|
-
|
|
15148
|
-
|
|
15149
|
-
|
|
15150
|
-
|
|
15151
|
-
|
|
15152
|
-
|
|
15153
|
-
|
|
15154
|
-
|
|
15155
|
-
|
|
15156
|
-
|
|
15157
|
-
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
15162
|
-
|
|
15163
|
-
|
|
15164
|
-
|
|
15165
|
-
|
|
15166
|
-
|
|
15167
|
-
|
|
15168
|
-
|
|
15195
|
+
}
|
|
15196
|
+
getSelected() {
|
|
15197
|
+
return this._selectedLayers.map((x) => {
|
|
15198
|
+
return __spreadValues$5({
|
|
15199
|
+
target: this,
|
|
15200
|
+
feature: x.feature,
|
|
15201
|
+
layer: x
|
|
15202
|
+
}, createFeaturePositionOptions(x.feature));
|
|
15203
|
+
});
|
|
15204
|
+
}
|
|
15205
|
+
getFiltered() {
|
|
15206
|
+
return this._filteredLayers;
|
|
15207
|
+
}
|
|
15208
|
+
filter(fun) {
|
|
15209
|
+
this._filterFun = fun;
|
|
15210
|
+
const layer_ = this.layer;
|
|
15211
|
+
const map = layer_ && layer_._map;
|
|
15212
|
+
if (layer_ && map) {
|
|
15213
|
+
layer_.remove();
|
|
15214
|
+
const filteredLayers = [];
|
|
15215
|
+
this._layers.forEach(({ feature, layer }) => {
|
|
15216
|
+
if (layer) {
|
|
15217
|
+
const ok = fun ? fun(__spreadValues$5({
|
|
15218
|
+
target: this,
|
|
15219
|
+
feature,
|
|
15220
|
+
layer
|
|
15221
|
+
}, createFeaturePositionOptions(feature))) : true;
|
|
15222
|
+
if (ok) {
|
|
15223
|
+
layer_.addLayer(layer);
|
|
15224
|
+
filteredLayers.push(__spreadValues$5({
|
|
15225
|
+
target: this,
|
|
15226
|
+
feature,
|
|
15227
|
+
layer
|
|
15228
|
+
}, createFeaturePositionOptions(feature)));
|
|
15229
|
+
} else {
|
|
15230
|
+
layer_.removeLayer(layer);
|
|
15231
|
+
}
|
|
15169
15232
|
}
|
|
15233
|
+
});
|
|
15234
|
+
this._filteredLayers = filteredLayers;
|
|
15235
|
+
layer_.addTo(map);
|
|
15170
15236
|
}
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15237
|
+
return this._filteredLayers;
|
|
15238
|
+
}
|
|
15239
|
+
cleanFilter() {
|
|
15240
|
+
this.filter();
|
|
15241
|
+
}
|
|
15242
|
+
getLayers() {
|
|
15243
|
+
return this._layers.map(({ layer, feature }) => {
|
|
15244
|
+
const visible = layer && !!layer._map;
|
|
15245
|
+
return __spreadValues$5({
|
|
15246
|
+
feature,
|
|
15247
|
+
layer,
|
|
15248
|
+
visible,
|
|
15249
|
+
target: this
|
|
15250
|
+
}, createFeaturePositionOptions(feature));
|
|
15251
|
+
});
|
|
15252
|
+
}
|
|
15253
|
+
clearLayer(cb) {
|
|
15254
|
+
this.unselect();
|
|
15255
|
+
const layer_ = this.layer;
|
|
15256
|
+
if (layer_) {
|
|
15257
|
+
if (cb) {
|
|
15258
|
+
for (let fry = this._layers.length; fry--; ) {
|
|
15259
|
+
const def = this._layers[fry];
|
|
15260
|
+
if (def) {
|
|
15261
|
+
const { feature, layer } = def;
|
|
15262
|
+
if (feature && layer) {
|
|
15263
|
+
const exist = cb(feature);
|
|
15264
|
+
if (exist) {
|
|
15265
|
+
layer_.removeLayer(layer);
|
|
15266
|
+
this._layers.splice(fry, 1);
|
|
15267
|
+
}
|
|
15197
15268
|
}
|
|
15198
|
-
|
|
15269
|
+
}
|
|
15199
15270
|
}
|
|
15271
|
+
} else {
|
|
15272
|
+
layer_.clearLayers();
|
|
15273
|
+
this._layers = [];
|
|
15274
|
+
}
|
|
15200
15275
|
}
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
-
|
|
15276
|
+
}
|
|
15277
|
+
setData(data) {
|
|
15278
|
+
this.clearLayer();
|
|
15279
|
+
this.addData(data);
|
|
15280
|
+
}
|
|
15281
|
+
addData(data) {
|
|
15282
|
+
const options = this.options;
|
|
15283
|
+
let geoJsonOptions;
|
|
15284
|
+
if (options) {
|
|
15285
|
+
if (data) {
|
|
15286
|
+
let type;
|
|
15287
|
+
if (!options.type) {
|
|
15288
|
+
const detectedType = detectType(data);
|
|
15289
|
+
type = typeAlias[detectedType];
|
|
15290
|
+
} else {
|
|
15291
|
+
type = options.type;
|
|
15207
15292
|
}
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
? this._openedPopup.filter((x) => findFeatureFun(x[2]))
|
|
15212
|
-
: this._openedPopup;
|
|
15213
|
-
popupToClose.forEach((x) => {
|
|
15214
|
-
this._removePopup(x[0]);
|
|
15215
|
-
});
|
|
15216
|
-
}
|
|
15217
|
-
updateTooltip(layerDef) {
|
|
15218
|
-
if (layerDef) {
|
|
15219
|
-
this._updateTooltip(layerDef);
|
|
15293
|
+
if (this.type && this.type !== type) {
|
|
15294
|
+
console.warn("no other data type than layer can be added");
|
|
15295
|
+
return;
|
|
15220
15296
|
}
|
|
15221
|
-
|
|
15222
|
-
|
|
15297
|
+
this.type = type;
|
|
15298
|
+
data = filterGeometries(data, type);
|
|
15299
|
+
if (data) {
|
|
15300
|
+
geoJsonOptions = this._getGeoJsonOptions(options, type);
|
|
15223
15301
|
}
|
|
15302
|
+
}
|
|
15303
|
+
new leafletSrcExports.GeoJSON(data || void 0, geoJsonOptions);
|
|
15224
15304
|
}
|
|
15225
|
-
|
|
15226
|
-
|
|
15227
|
-
|
|
15305
|
+
}
|
|
15306
|
+
openPopup(findFeatureFun, options) {
|
|
15307
|
+
if (findFeatureFun) {
|
|
15308
|
+
const def = this._layers.filter(findFeatureFun);
|
|
15309
|
+
def.forEach((x) => {
|
|
15310
|
+
this._openPopup(x, options, "api");
|
|
15311
|
+
});
|
|
15228
15312
|
}
|
|
15229
|
-
|
|
15230
|
-
|
|
15231
|
-
|
|
15232
|
-
|
|
15233
|
-
|
|
15234
|
-
|
|
15235
|
-
|
|
15313
|
+
}
|
|
15314
|
+
closePopup(findFeatureFun) {
|
|
15315
|
+
const popupToClose = findFeatureFun ? this._openedPopup.filter((x) => findFeatureFun(x[2])) : this._openedPopup;
|
|
15316
|
+
popupToClose.forEach((x) => {
|
|
15317
|
+
this._removePopup(x[0]);
|
|
15318
|
+
});
|
|
15319
|
+
}
|
|
15320
|
+
updateTooltip(layerDef) {
|
|
15321
|
+
if (layerDef) {
|
|
15322
|
+
this._updateTooltip(layerDef);
|
|
15323
|
+
} else {
|
|
15324
|
+
this.getLayers().forEach(
|
|
15325
|
+
(x) => this._updateTooltip({ feature: x.feature, layer: x.layer })
|
|
15326
|
+
);
|
|
15236
15327
|
}
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
|
|
15328
|
+
}
|
|
15329
|
+
/** @deprecated use {@link GeoJsonAdapter.getBounds} instead */
|
|
15330
|
+
getExtent() {
|
|
15331
|
+
return this.getBounds();
|
|
15332
|
+
}
|
|
15333
|
+
getBounds() {
|
|
15334
|
+
if (this.layer) {
|
|
15335
|
+
const bounds = this.layer.getBounds();
|
|
15336
|
+
if (bounds.isValid()) {
|
|
15337
|
+
return boundsToArray(bounds);
|
|
15338
|
+
}
|
|
15241
15339
|
}
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
|
|
15340
|
+
}
|
|
15341
|
+
setOpacity(value) {
|
|
15342
|
+
this.options.opacity = value;
|
|
15343
|
+
this.setPaint(this.paint);
|
|
15344
|
+
this.setSelectedPaint(this.selectedPaint);
|
|
15345
|
+
}
|
|
15346
|
+
setPaint(paint) {
|
|
15347
|
+
if (paint) {
|
|
15348
|
+
this.paint = paint;
|
|
15349
|
+
for (const l of this._layers) {
|
|
15350
|
+
this._paint.setPaint(l, paint);
|
|
15351
|
+
}
|
|
15249
15352
|
}
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
|
|
15255
|
-
|
|
15256
|
-
|
|
15353
|
+
}
|
|
15354
|
+
setSelectedPaint(paint) {
|
|
15355
|
+
if (paint) {
|
|
15356
|
+
this.selectedPaint = paint;
|
|
15357
|
+
for (const l of this._selectedLayers) {
|
|
15358
|
+
this._paint.setPaint(l, paint);
|
|
15359
|
+
}
|
|
15257
15360
|
}
|
|
15258
|
-
|
|
15259
|
-
|
|
15260
|
-
|
|
15261
|
-
|
|
15262
|
-
|
|
15361
|
+
}
|
|
15362
|
+
updatePaint(paint) {
|
|
15363
|
+
this.paint = __spreadValues$5(__spreadValues$5({}, this.paint), paint);
|
|
15364
|
+
for (const l of this._layers) {
|
|
15365
|
+
this._paint.setPaint(l, this.paint);
|
|
15263
15366
|
}
|
|
15264
|
-
|
|
15265
|
-
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
|
|
15367
|
+
}
|
|
15368
|
+
updateSelectedPaint(paint) {
|
|
15369
|
+
this.selectedPaint = __spreadValues$5(__spreadValues$5({}, this.selectedPaint), paint);
|
|
15370
|
+
for (const l of this._selectedLayers) {
|
|
15371
|
+
this._paint.setPaint(l, this.selectedPaint);
|
|
15269
15372
|
}
|
|
15270
|
-
|
|
15271
|
-
|
|
15373
|
+
}
|
|
15374
|
+
_getSelected(layer) {
|
|
15375
|
+
return this._selectedLayers.find((x) => x.layer === layer);
|
|
15376
|
+
}
|
|
15377
|
+
_updateTooltip(layerDef) {
|
|
15378
|
+
const { feature, layer } = layerDef;
|
|
15379
|
+
const { label, labelField, labelOnHover } = this.options;
|
|
15380
|
+
if (layer) {
|
|
15381
|
+
layer.unbindTooltip();
|
|
15382
|
+
let message;
|
|
15383
|
+
if (feature.properties && labelField) {
|
|
15384
|
+
message = feature.properties[labelField];
|
|
15385
|
+
} else if (label) {
|
|
15386
|
+
message = label(__spreadValues$5(__spreadValues$5({
|
|
15387
|
+
target: this
|
|
15388
|
+
}, layerDef), createFeaturePositionOptions(feature)));
|
|
15389
|
+
}
|
|
15390
|
+
if (message) {
|
|
15391
|
+
const permanent = !labelOnHover;
|
|
15392
|
+
layer.bindTooltip(String(message), { permanent, sticky: false });
|
|
15393
|
+
}
|
|
15272
15394
|
}
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15395
|
+
}
|
|
15396
|
+
_openPopup(_0) {
|
|
15397
|
+
return __async(this, arguments, function* (def, options = {}, type, latLng) {
|
|
15398
|
+
var _a, _b;
|
|
15399
|
+
const { feature, layer } = def;
|
|
15400
|
+
const {
|
|
15401
|
+
minWidth,
|
|
15402
|
+
autoPan,
|
|
15403
|
+
maxWidth,
|
|
15404
|
+
closeButton: closeButton_
|
|
15405
|
+
} = __spreadValues$5({
|
|
15406
|
+
minWidth: 300
|
|
15407
|
+
}, options);
|
|
15408
|
+
const closeButton = closeButton_ != null ? closeButton_ : !this.options.selectOnHover;
|
|
15409
|
+
let popup;
|
|
15410
|
+
const _closeHandlers = [];
|
|
15411
|
+
const onClose = (handler) => {
|
|
15412
|
+
_closeHandlers.push(handler);
|
|
15413
|
+
};
|
|
15414
|
+
const close = () => {
|
|
15415
|
+
if (popup) {
|
|
15416
|
+
this._removePopup(popup);
|
|
15293
15417
|
}
|
|
15294
|
-
|
|
15295
|
-
|
|
15296
|
-
|
|
15297
|
-
|
|
15298
|
-
|
|
15299
|
-
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
|
|
15304
|
-
|
|
15305
|
-
|
|
15306
|
-
|
|
15307
|
-
|
|
15308
|
-
|
|
15309
|
-
|
|
15310
|
-
|
|
15311
|
-
|
|
15418
|
+
};
|
|
15419
|
+
let content;
|
|
15420
|
+
if (options.createPopupContent) {
|
|
15421
|
+
content = yield options.createPopupContent(__spreadValues$5({
|
|
15422
|
+
layer,
|
|
15423
|
+
feature,
|
|
15424
|
+
target: this,
|
|
15425
|
+
type,
|
|
15426
|
+
close,
|
|
15427
|
+
onClose
|
|
15428
|
+
}, createFeaturePositionOptions(feature)));
|
|
15429
|
+
} else {
|
|
15430
|
+
content = options.popupContent;
|
|
15431
|
+
}
|
|
15432
|
+
if (content && layer) {
|
|
15433
|
+
const popupOptions = {
|
|
15434
|
+
minWidth,
|
|
15435
|
+
autoPan,
|
|
15436
|
+
// maxWidth,
|
|
15437
|
+
closeButton,
|
|
15438
|
+
closeOnClick: false,
|
|
15439
|
+
autoClose: false
|
|
15312
15440
|
};
|
|
15313
|
-
|
|
15314
|
-
|
|
15315
|
-
content = await options.createPopupContent({
|
|
15316
|
-
layer,
|
|
15317
|
-
feature,
|
|
15318
|
-
target: this,
|
|
15319
|
-
type,
|
|
15320
|
-
close,
|
|
15321
|
-
onClose,
|
|
15322
|
-
...createFeaturePositionOptions(feature),
|
|
15323
|
-
});
|
|
15441
|
+
if (defined(maxWidth)) {
|
|
15442
|
+
popupOptions.maxWidth = maxWidth;
|
|
15324
15443
|
}
|
|
15325
|
-
|
|
15326
|
-
|
|
15444
|
+
popup = layer.bindPopup(content, popupOptions);
|
|
15445
|
+
const unselectOnClose = (_b = (_a = this.options.popupOptions) == null ? void 0 : _a.unselectOnClose) != null ? _b : true;
|
|
15446
|
+
if (unselectOnClose) {
|
|
15447
|
+
const p = layer.getPopup();
|
|
15448
|
+
p && p.once(
|
|
15449
|
+
"remove",
|
|
15450
|
+
() => {
|
|
15451
|
+
close();
|
|
15452
|
+
},
|
|
15453
|
+
this
|
|
15454
|
+
);
|
|
15327
15455
|
}
|
|
15328
|
-
|
|
15329
|
-
|
|
15330
|
-
|
|
15331
|
-
|
|
15332
|
-
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
p &&
|
|
15345
|
-
p.once('remove', () => {
|
|
15346
|
-
close();
|
|
15347
|
-
}, this);
|
|
15348
|
-
}
|
|
15349
|
-
this._openedPopup.push([popup, _closeHandlers, def]);
|
|
15350
|
-
popup.openPopup(latLng);
|
|
15456
|
+
this._openedPopup.push([popup, _closeHandlers, def]);
|
|
15457
|
+
popup.openPopup(latLng);
|
|
15458
|
+
}
|
|
15459
|
+
});
|
|
15460
|
+
}
|
|
15461
|
+
_removePopup(popup) {
|
|
15462
|
+
var _a, _b;
|
|
15463
|
+
const map = this.map;
|
|
15464
|
+
if (map) {
|
|
15465
|
+
popup.closePopup().unbindPopup();
|
|
15466
|
+
const index = this._openedPopup.findIndex((x) => x[0] === popup);
|
|
15467
|
+
if (index !== -1) {
|
|
15468
|
+
const unselectOnClose = (_b = (_a = this.options.popupOptions) == null ? void 0 : _a.unselectOnClose) != null ? _b : true;
|
|
15469
|
+
const [, closeHandlers, def] = this._openedPopup[index];
|
|
15470
|
+
for (const h of closeHandlers) {
|
|
15471
|
+
h(def);
|
|
15351
15472
|
}
|
|
15352
|
-
|
|
15353
|
-
|
|
15354
|
-
|
|
15355
|
-
const map = this.map;
|
|
15356
|
-
if (map) {
|
|
15357
|
-
popup.closePopup().unbindPopup();
|
|
15358
|
-
const index = this._openedPopup.findIndex((x) => x[0] === popup);
|
|
15359
|
-
if (index !== -1) {
|
|
15360
|
-
const unselectOnClose = (_b = (_a = this.options.popupOptions) === null || _a === void 0 ? void 0 : _a.unselectOnClose) !== null && _b !== void 0 ? _b : true;
|
|
15361
|
-
const [, closeHandlers, def] = this._openedPopup[index];
|
|
15362
|
-
for (const h of closeHandlers) {
|
|
15363
|
-
h(def);
|
|
15364
|
-
}
|
|
15365
|
-
closeHandlers.length = 0;
|
|
15366
|
-
if (unselectOnClose) {
|
|
15367
|
-
this._unSelectLayer(def);
|
|
15368
|
-
}
|
|
15369
|
-
this._openedPopup.splice(index, 1);
|
|
15370
|
-
}
|
|
15473
|
+
closeHandlers.length = 0;
|
|
15474
|
+
if (unselectOnClose) {
|
|
15475
|
+
this._unSelectLayer(def);
|
|
15371
15476
|
}
|
|
15477
|
+
this._openedPopup.splice(index, 1);
|
|
15478
|
+
}
|
|
15372
15479
|
}
|
|
15373
|
-
|
|
15374
|
-
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
|
|
15385
|
-
else {
|
|
15386
|
-
lopt = {
|
|
15387
|
-
style: (feature) => {
|
|
15388
|
-
if (feature) {
|
|
15389
|
-
return this._paint.preparePaint({ ...PAINT, ...paint(feature) });
|
|
15390
|
-
}
|
|
15391
|
-
else {
|
|
15392
|
-
return this._paint.preparePaint({ ...PAINT, type: 'path' });
|
|
15393
|
-
}
|
|
15394
|
-
},
|
|
15395
|
-
};
|
|
15396
|
-
}
|
|
15397
|
-
}
|
|
15398
|
-
else {
|
|
15399
|
-
lopt = this._paint.createPaintOptions(paint);
|
|
15400
|
-
}
|
|
15401
|
-
lopt.onEachFeature = (feature, layer) => {
|
|
15402
|
-
this._onEachFeature(feature, layer);
|
|
15480
|
+
}
|
|
15481
|
+
_getGeoJsonOptions(options, type) {
|
|
15482
|
+
const paint = options.paint;
|
|
15483
|
+
let lopt = {};
|
|
15484
|
+
if (typeof paint === "function") {
|
|
15485
|
+
if (type === "point") {
|
|
15486
|
+
lopt.pointToLayer = (feature, latLng) => {
|
|
15487
|
+
const iconOpt = paint(feature);
|
|
15488
|
+
const pointToLayer = this._paint.createPaintToLayer(
|
|
15489
|
+
iconOpt
|
|
15490
|
+
);
|
|
15491
|
+
return pointToLayer(feature, latLng);
|
|
15403
15492
|
};
|
|
15404
|
-
|
|
15405
|
-
|
|
15406
|
-
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
|
|
15410
|
-
|
|
15411
|
-
feature,
|
|
15412
|
-
layer,
|
|
15413
|
-
...createFeaturePositionOptions(feature),
|
|
15414
|
-
};
|
|
15415
|
-
// @ts-ignore
|
|
15416
|
-
layer.options.pane = this.pane;
|
|
15417
|
-
this._layers.push(def);
|
|
15418
|
-
let ok = true;
|
|
15419
|
-
if (this._filterFun) {
|
|
15420
|
-
ok = this._filterFun(def);
|
|
15421
|
-
}
|
|
15422
|
-
if (ok) {
|
|
15423
|
-
const { popup, popupOptions, selectable, interactive, selectOnHover } = this.options;
|
|
15424
|
-
// @ts-ignore
|
|
15425
|
-
layer.options.interactive = defined(interactive) ? interactive : true;
|
|
15426
|
-
layer_.addLayer(layer);
|
|
15427
|
-
if (selectable) {
|
|
15428
|
-
if (selectOnHover) {
|
|
15429
|
-
layer.on('mouseover', () => {
|
|
15430
|
-
this._selectLayer(def, 'hover');
|
|
15431
|
-
});
|
|
15432
|
-
layer.on('mouseout', () => {
|
|
15433
|
-
this._unSelectLayer(def);
|
|
15434
|
-
});
|
|
15435
|
-
}
|
|
15436
|
-
else {
|
|
15437
|
-
layer.on('click', (e) => this._selectOnLayerClick(e), this);
|
|
15438
|
-
}
|
|
15439
|
-
}
|
|
15440
|
-
this._events.handleMouseEvents(layer);
|
|
15441
|
-
// The timeout is needed to display the popup immediately when adding a layer to the map.
|
|
15442
|
-
// Without a timeout, the layer may not yet have a _map object
|
|
15443
|
-
setTimeout(() => {
|
|
15444
|
-
if (popup) {
|
|
15445
|
-
this._openPopup({
|
|
15446
|
-
target: this,
|
|
15447
|
-
layer,
|
|
15448
|
-
feature,
|
|
15449
|
-
...createFeaturePositionOptions(feature),
|
|
15450
|
-
}, popupOptions, 'api');
|
|
15451
|
-
}
|
|
15452
|
-
this._updateTooltip({ layer, feature });
|
|
15453
|
-
});
|
|
15493
|
+
} else {
|
|
15494
|
+
lopt = {
|
|
15495
|
+
style: (feature) => {
|
|
15496
|
+
if (feature) {
|
|
15497
|
+
return this._paint.preparePaint(__spreadValues$5(__spreadValues$5({}, PAINT), paint(feature)));
|
|
15498
|
+
} else {
|
|
15499
|
+
return this._paint.preparePaint(__spreadProps$3(__spreadValues$5({}, PAINT), { type: "path" }));
|
|
15454
15500
|
}
|
|
15455
|
-
|
|
15456
|
-
}
|
|
15457
|
-
_selectOnLayerClick(e) {
|
|
15458
|
-
leafletSrc.exports.DomEvent.stopPropagation(e);
|
|
15459
|
-
const layer = e.target;
|
|
15460
|
-
const feature = layer.feature;
|
|
15461
|
-
const def = {
|
|
15462
|
-
target: this,
|
|
15463
|
-
layer,
|
|
15464
|
-
feature,
|
|
15465
|
-
...createFeaturePositionOptions(feature),
|
|
15501
|
+
}
|
|
15466
15502
|
};
|
|
15467
|
-
|
|
15468
|
-
|
|
15469
|
-
|
|
15470
|
-
this._unSelectLayer(isSelected);
|
|
15471
|
-
}
|
|
15472
|
-
}
|
|
15473
|
-
else {
|
|
15474
|
-
this._selectLayer(def, 'click', e.latlng);
|
|
15475
|
-
}
|
|
15503
|
+
}
|
|
15504
|
+
} else {
|
|
15505
|
+
lopt = this._paint.createPaintOptions(paint);
|
|
15476
15506
|
}
|
|
15477
|
-
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
|
|
15481
|
-
|
|
15482
|
-
|
|
15507
|
+
lopt.onEachFeature = (feature, layer) => {
|
|
15508
|
+
this._onEachFeature(feature, layer);
|
|
15509
|
+
};
|
|
15510
|
+
return lopt;
|
|
15511
|
+
}
|
|
15512
|
+
_onEachFeature(feature, layer) {
|
|
15513
|
+
const layer_ = this.layer;
|
|
15514
|
+
if (layer_) {
|
|
15515
|
+
const def = __spreadValues$5({
|
|
15516
|
+
target: this,
|
|
15517
|
+
feature,
|
|
15518
|
+
layer
|
|
15519
|
+
}, createFeaturePositionOptions(feature));
|
|
15520
|
+
layer.options.pane = this.pane;
|
|
15521
|
+
this._layers.push(def);
|
|
15522
|
+
let ok = true;
|
|
15523
|
+
if (this._filterFun) {
|
|
15524
|
+
ok = this._filterFun(def);
|
|
15525
|
+
}
|
|
15526
|
+
if (ok) {
|
|
15527
|
+
const { popup, popupOptions, selectable, interactive, selectOnHover } = this.options;
|
|
15528
|
+
layer.options.interactive = defined(interactive) ? interactive : true;
|
|
15529
|
+
layer_.addLayer(layer);
|
|
15530
|
+
if (selectable) {
|
|
15531
|
+
if (selectOnHover) {
|
|
15532
|
+
layer.on("mouseover", () => {
|
|
15533
|
+
this._selectLayer(def, "hover");
|
|
15483
15534
|
});
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
this._selectedLayers.push(def);
|
|
15487
|
-
this.selected = true;
|
|
15488
|
-
const { selectedPaint, popupOnSelect, popupOptions } = this.options;
|
|
15489
|
-
if (selectedPaint && def.layer) {
|
|
15490
|
-
this._paint.setPaint(def, selectedPaint);
|
|
15491
|
-
}
|
|
15492
|
-
if (popupOnSelect) {
|
|
15493
|
-
this._openPopup(def, popupOptions, type, latlng);
|
|
15494
|
-
}
|
|
15495
|
-
if (this.options.onSelect) {
|
|
15496
|
-
const features = def.feature ? [def.feature] : [];
|
|
15497
|
-
this.options.onSelect({
|
|
15498
|
-
type,
|
|
15499
|
-
layer: this,
|
|
15500
|
-
features,
|
|
15501
|
-
...createFeaturePositionOptions(features),
|
|
15535
|
+
layer.on("mouseout", () => {
|
|
15536
|
+
this._unSelectLayer(def);
|
|
15502
15537
|
});
|
|
15538
|
+
} else {
|
|
15539
|
+
layer.on(
|
|
15540
|
+
"click",
|
|
15541
|
+
(e) => this._selectOnLayerClick(e),
|
|
15542
|
+
this
|
|
15543
|
+
);
|
|
15544
|
+
}
|
|
15503
15545
|
}
|
|
15546
|
+
this._events.handleMouseEvents(layer);
|
|
15547
|
+
setTimeout(() => {
|
|
15548
|
+
if (popup) {
|
|
15549
|
+
this._openPopup(
|
|
15550
|
+
__spreadValues$5({
|
|
15551
|
+
target: this,
|
|
15552
|
+
layer,
|
|
15553
|
+
feature
|
|
15554
|
+
}, createFeaturePositionOptions(feature)),
|
|
15555
|
+
popupOptions,
|
|
15556
|
+
"api"
|
|
15557
|
+
);
|
|
15558
|
+
}
|
|
15559
|
+
this._updateTooltip({ layer, feature });
|
|
15560
|
+
});
|
|
15561
|
+
}
|
|
15504
15562
|
}
|
|
15505
|
-
|
|
15506
|
-
|
|
15507
|
-
|
|
15508
|
-
|
|
15509
|
-
|
|
15510
|
-
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
|
|
15514
|
-
|
|
15515
|
-
|
|
15516
|
-
|
|
15517
|
-
|
|
15518
|
-
this.
|
|
15563
|
+
}
|
|
15564
|
+
_selectOnLayerClick(e) {
|
|
15565
|
+
leafletSrcExports.DomEvent.stopPropagation(e);
|
|
15566
|
+
const layer = e.target;
|
|
15567
|
+
const feature = layer.feature;
|
|
15568
|
+
const def = __spreadValues$5({
|
|
15569
|
+
target: this,
|
|
15570
|
+
layer,
|
|
15571
|
+
feature
|
|
15572
|
+
}, createFeaturePositionOptions(feature));
|
|
15573
|
+
const isSelected = this._getSelected(layer);
|
|
15574
|
+
if (isSelected) {
|
|
15575
|
+
if (this.options && this.options.unselectOnSecondClick) {
|
|
15576
|
+
this._unSelectLayer(isSelected);
|
|
15577
|
+
}
|
|
15578
|
+
} else {
|
|
15579
|
+
this._selectLayer(def, "click", e.latlng);
|
|
15519
15580
|
}
|
|
15520
|
-
|
|
15521
|
-
|
|
15522
|
-
|
|
15523
|
-
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
}
|
|
15581
|
+
}
|
|
15582
|
+
_selectLayer(def, type, latlng) {
|
|
15583
|
+
const { multiselect } = this.options;
|
|
15584
|
+
if (!multiselect) {
|
|
15585
|
+
this.map._addUnselectCb(() => {
|
|
15586
|
+
this._unSelectLayer(def);
|
|
15587
|
+
});
|
|
15588
|
+
this._selectedLayers.forEach((x) => this._unSelectLayer(x));
|
|
15529
15589
|
}
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15590
|
+
this._selectedLayers.push(def);
|
|
15591
|
+
this.selected = true;
|
|
15592
|
+
const { selectedPaint, popupOnSelect, popupOptions } = this.options;
|
|
15593
|
+
if (selectedPaint && def.layer) {
|
|
15594
|
+
this._paint.setPaint(def, selectedPaint);
|
|
15534
15595
|
}
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15596
|
+
if (popupOnSelect) {
|
|
15597
|
+
this._openPopup(def, popupOptions, type, latlng);
|
|
15598
|
+
}
|
|
15599
|
+
if (this.options.onSelect) {
|
|
15600
|
+
const features = def.feature ? [def.feature] : [];
|
|
15601
|
+
this.options.onSelect(__spreadValues$5({
|
|
15602
|
+
type,
|
|
15603
|
+
layer: this,
|
|
15604
|
+
features
|
|
15605
|
+
}, createFeaturePositionOptions(features)));
|
|
15606
|
+
}
|
|
15607
|
+
}
|
|
15608
|
+
_unSelectLayer(def) {
|
|
15609
|
+
const index = this._selectedLayers.indexOf(def);
|
|
15610
|
+
if (index !== -1) {
|
|
15611
|
+
this._selectedLayers.splice(index, 1);
|
|
15612
|
+
if (this.options) {
|
|
15613
|
+
if (this.options.paint) {
|
|
15614
|
+
this._paint.setPaint(
|
|
15615
|
+
def,
|
|
15616
|
+
this.options.paint
|
|
15617
|
+
);
|
|
15544
15618
|
}
|
|
15619
|
+
if (this.options.popupOnSelect && def.layer) {
|
|
15620
|
+
this._removePopup(def.layer);
|
|
15621
|
+
}
|
|
15622
|
+
}
|
|
15623
|
+
}
|
|
15624
|
+
this.selected = this._selectedLayers.length > 0;
|
|
15625
|
+
}
|
|
15626
|
+
_addMapClickListener() {
|
|
15627
|
+
const map = this.map;
|
|
15628
|
+
if (map) {
|
|
15629
|
+
const { unselectOnClick } = this.options;
|
|
15630
|
+
const uoc = unselectOnClick != null ? unselectOnClick : true;
|
|
15631
|
+
if (uoc) {
|
|
15632
|
+
map.on("click", this.$unselect);
|
|
15633
|
+
}
|
|
15545
15634
|
}
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15635
|
+
}
|
|
15636
|
+
_removeMapClickListener() {
|
|
15637
|
+
this.map.off("zoomend", this.$updateTooltip);
|
|
15638
|
+
this.map.off("moveend", this.$updateTooltip);
|
|
15639
|
+
this.map.off("click", this.$unselect);
|
|
15640
|
+
}
|
|
15641
|
+
_addMapListener() {
|
|
15642
|
+
const map = this.map;
|
|
15643
|
+
if (map) {
|
|
15644
|
+
const { label, labelField, labelOnHover } = this.options;
|
|
15645
|
+
this._addMapClickListener();
|
|
15646
|
+
if ((labelField || label) && !labelOnHover) {
|
|
15647
|
+
map.on("zoomend", this.$updateTooltip);
|
|
15648
|
+
map.on("moveend", this.$updateTooltip);
|
|
15649
|
+
}
|
|
15550
15650
|
}
|
|
15651
|
+
}
|
|
15652
|
+
_removeMapListener() {
|
|
15653
|
+
this._removeMapClickListener();
|
|
15654
|
+
this.map.off("zoomend", this.$updateTooltip);
|
|
15655
|
+
this.map.off("moveend", this.$updateTooltip);
|
|
15656
|
+
}
|
|
15551
15657
|
}
|
|
15552
15658
|
|
|
15553
15659
|
function callAjax(src, callback, headers) {
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
};
|
|
15660
|
+
const xhr = new XMLHttpRequest();
|
|
15661
|
+
xhr.open("GET", src);
|
|
15662
|
+
xhr.responseType = "arraybuffer";
|
|
15663
|
+
for (const h in headers) {
|
|
15664
|
+
xhr.setRequestHeader(h, headers[h]);
|
|
15665
|
+
}
|
|
15666
|
+
xhr.onload = function() {
|
|
15667
|
+
const arrayBufferView = new Uint8Array(this.response);
|
|
15668
|
+
const blob = new Blob([arrayBufferView], { type: "image/png" });
|
|
15669
|
+
const urlCreator = window.URL || window.webkitURL;
|
|
15670
|
+
const imageUrl = urlCreator.createObjectURL(blob);
|
|
15671
|
+
callback(imageUrl);
|
|
15672
|
+
};
|
|
15673
|
+
xhr.send();
|
|
15674
|
+
return () => {
|
|
15675
|
+
xhr.abort();
|
|
15676
|
+
};
|
|
15572
15677
|
}
|
|
15573
15678
|
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15679
|
+
var __defProp$6 = Object.defineProperty;
|
|
15680
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15681
|
+
var __publicField$3 = (obj, key, value) => {
|
|
15682
|
+
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15683
|
+
return value;
|
|
15684
|
+
};
|
|
15685
|
+
class ImageOverlay extends leafletSrcExports.ImageOverlay {
|
|
15686
|
+
constructor(imageUrl, bounds, options) {
|
|
15687
|
+
super(imageUrl, bounds, options);
|
|
15688
|
+
__publicField$3(this, "_abort", []);
|
|
15689
|
+
}
|
|
15690
|
+
cancelLoad() {
|
|
15691
|
+
if (this._abort) {
|
|
15692
|
+
this._abort.forEach((x) => x());
|
|
15693
|
+
this._abort = [];
|
|
15584
15694
|
}
|
|
15585
|
-
|
|
15586
|
-
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
|
|
15596
|
-
|
|
15597
|
-
|
|
15598
|
-
|
|
15695
|
+
}
|
|
15696
|
+
_initImage() {
|
|
15697
|
+
super._initImage();
|
|
15698
|
+
const headers = this.options.headers;
|
|
15699
|
+
if (headers) {
|
|
15700
|
+
const img = this._image;
|
|
15701
|
+
const src = img.src;
|
|
15702
|
+
img.src = "";
|
|
15703
|
+
this._abort.push(
|
|
15704
|
+
callAjax(
|
|
15705
|
+
src,
|
|
15706
|
+
(response) => {
|
|
15707
|
+
img.src = response;
|
|
15708
|
+
},
|
|
15709
|
+
headers
|
|
15710
|
+
)
|
|
15711
|
+
);
|
|
15599
15712
|
}
|
|
15713
|
+
}
|
|
15600
15714
|
}
|
|
15601
15715
|
|
|
15602
|
-
|
|
15603
|
-
|
|
15604
|
-
|
|
15605
|
-
|
|
15606
|
-
|
|
15607
|
-
|
|
15608
|
-
|
|
15609
|
-
|
|
15610
|
-
|
|
15611
|
-
|
|
15612
|
-
|
|
15613
|
-
|
|
15614
|
-
|
|
15615
|
-
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
|
|
15619
|
-
|
|
15620
|
-
|
|
15621
|
-
|
|
15622
|
-
|
|
15623
|
-
|
|
15624
|
-
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15628
|
-
|
|
15629
|
-
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
|
|
15639
|
-
|
|
15640
|
-
|
|
15641
|
-
|
|
15642
|
-
|
|
15643
|
-
|
|
15644
|
-
|
|
15645
|
-
|
|
15646
|
-
}
|
|
15647
|
-
else {
|
|
15648
|
-
params[opt] = options[opt];
|
|
15649
|
-
}
|
|
15650
|
-
}
|
|
15651
|
-
leafletSrc.exports.Util.setOptions(this, opts);
|
|
15652
|
-
this.wmsParams = leafletSrc.exports.Util.extend({}, this.defaultWmsParams, params);
|
|
15716
|
+
var __defProp$5 = Object.defineProperty;
|
|
15717
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15718
|
+
var __publicField$2 = (obj, key, value) => {
|
|
15719
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15720
|
+
return value;
|
|
15721
|
+
};
|
|
15722
|
+
class ImageLayer extends leafletSrcExports.Layer {
|
|
15723
|
+
constructor(url, options) {
|
|
15724
|
+
super(options);
|
|
15725
|
+
__publicField$2(this, "defaultWmsParams", {
|
|
15726
|
+
service: "WMS",
|
|
15727
|
+
request: "GetMap",
|
|
15728
|
+
version: "1.1.1",
|
|
15729
|
+
layers: "",
|
|
15730
|
+
styles: "",
|
|
15731
|
+
format: "image/jpeg",
|
|
15732
|
+
transparent: false
|
|
15733
|
+
});
|
|
15734
|
+
__publicField$2(this, "options", {
|
|
15735
|
+
crs: null,
|
|
15736
|
+
uppercase: false,
|
|
15737
|
+
attribution: "",
|
|
15738
|
+
opacity: 1,
|
|
15739
|
+
isBack: false,
|
|
15740
|
+
minZoom: 0,
|
|
15741
|
+
pane: "tilePane",
|
|
15742
|
+
headers: null,
|
|
15743
|
+
viewPortBuffer: 0,
|
|
15744
|
+
setViewDelay: 100
|
|
15745
|
+
});
|
|
15746
|
+
__publicField$2(this, "wmsParams");
|
|
15747
|
+
__publicField$2(this, "_url");
|
|
15748
|
+
__publicField$2(this, "_currentUrl");
|
|
15749
|
+
__publicField$2(this, "_currentOverlay");
|
|
15750
|
+
this._url = url;
|
|
15751
|
+
const params = {};
|
|
15752
|
+
const opts = {};
|
|
15753
|
+
let opt;
|
|
15754
|
+
for (opt in options) {
|
|
15755
|
+
if (opt in this.options) {
|
|
15756
|
+
opts[opt] = options[opt];
|
|
15757
|
+
} else {
|
|
15758
|
+
params[opt] = options[opt];
|
|
15759
|
+
}
|
|
15653
15760
|
}
|
|
15654
|
-
|
|
15655
|
-
|
|
15656
|
-
|
|
15761
|
+
leafletSrcExports.Util.setOptions(this, opts);
|
|
15762
|
+
this.wmsParams = leafletSrcExports.Util.extend({}, this.defaultWmsParams, params);
|
|
15763
|
+
}
|
|
15764
|
+
setParams(params) {
|
|
15765
|
+
leafletSrcExports.Util.extend(this.wmsParams, params);
|
|
15766
|
+
this.update();
|
|
15767
|
+
}
|
|
15768
|
+
getAttribution() {
|
|
15769
|
+
return this.options.attribution || "";
|
|
15770
|
+
}
|
|
15771
|
+
onAdd() {
|
|
15772
|
+
this.update();
|
|
15773
|
+
return this;
|
|
15774
|
+
}
|
|
15775
|
+
onRemove(map) {
|
|
15776
|
+
if (this._currentOverlay) {
|
|
15777
|
+
this._currentOverlay.cancelLoad();
|
|
15778
|
+
map.removeLayer(this._currentOverlay);
|
|
15779
|
+
delete this._currentOverlay;
|
|
15657
15780
|
}
|
|
15658
|
-
|
|
15659
|
-
|
|
15781
|
+
if (this._currentUrl) {
|
|
15782
|
+
delete this._currentUrl;
|
|
15660
15783
|
}
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15784
|
+
return this;
|
|
15785
|
+
}
|
|
15786
|
+
getEvents() {
|
|
15787
|
+
return {
|
|
15788
|
+
moveend: debounce(this.update, this.options.setViewDelay)
|
|
15789
|
+
};
|
|
15790
|
+
}
|
|
15791
|
+
update() {
|
|
15792
|
+
if (!this._map) {
|
|
15793
|
+
return;
|
|
15664
15794
|
}
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
delete this._currentOverlay;
|
|
15670
|
-
}
|
|
15671
|
-
if (this._currentUrl) {
|
|
15672
|
-
delete this._currentUrl;
|
|
15673
|
-
}
|
|
15674
|
-
return this;
|
|
15795
|
+
this.updateWmsParams();
|
|
15796
|
+
const url = this.getImageUrl();
|
|
15797
|
+
if (this._currentUrl === url) {
|
|
15798
|
+
return;
|
|
15675
15799
|
}
|
|
15676
|
-
|
|
15677
|
-
|
|
15678
|
-
|
|
15679
|
-
|
|
15800
|
+
this._currentUrl = url;
|
|
15801
|
+
const viewPortBuffer = this.options.viewPortBuffer || 0;
|
|
15802
|
+
const bounds = this._map.getBounds().pad(viewPortBuffer);
|
|
15803
|
+
const overlay = new ImageOverlay(url, bounds, {
|
|
15804
|
+
opacity: 0,
|
|
15805
|
+
pane: this.options.pane,
|
|
15806
|
+
headers: this.options.headers
|
|
15807
|
+
});
|
|
15808
|
+
overlay.addTo(this._map);
|
|
15809
|
+
if (this._currentOverlay) {
|
|
15810
|
+
this._currentOverlay.cancelLoad();
|
|
15680
15811
|
}
|
|
15681
|
-
|
|
15812
|
+
overlay.once(
|
|
15813
|
+
"load",
|
|
15814
|
+
() => {
|
|
15682
15815
|
if (!this._map) {
|
|
15683
|
-
|
|
15816
|
+
return;
|
|
15684
15817
|
}
|
|
15685
|
-
|
|
15686
|
-
|
|
15687
|
-
|
|
15688
|
-
if (this.
|
|
15689
|
-
|
|
15818
|
+
if (overlay._url !== this._currentUrl) {
|
|
15819
|
+
this._map.removeLayer(overlay);
|
|
15820
|
+
return;
|
|
15821
|
+
} else if (this._currentOverlay) {
|
|
15822
|
+
this._map.removeLayer(this._currentOverlay);
|
|
15690
15823
|
}
|
|
15691
|
-
this.
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
opacity: 0,
|
|
15698
|
-
pane: this.options.pane,
|
|
15699
|
-
headers: this.options.headers,
|
|
15700
|
-
});
|
|
15701
|
-
overlay.addTo(this._map);
|
|
15702
|
-
if (this._currentOverlay) {
|
|
15703
|
-
this._currentOverlay.cancelLoad();
|
|
15824
|
+
this._currentOverlay = overlay;
|
|
15825
|
+
overlay.setOpacity(
|
|
15826
|
+
this.options.opacity !== void 0 ? this.options.opacity : 1
|
|
15827
|
+
);
|
|
15828
|
+
if (this.options.isBack === true) {
|
|
15829
|
+
overlay.bringToBack();
|
|
15704
15830
|
}
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
return;
|
|
15708
|
-
}
|
|
15709
|
-
// @ts-ignore
|
|
15710
|
-
if (overlay._url !== this._currentUrl) {
|
|
15711
|
-
this._map.removeLayer(overlay);
|
|
15712
|
-
return;
|
|
15713
|
-
}
|
|
15714
|
-
else if (this._currentOverlay) {
|
|
15715
|
-
this._map.removeLayer(this._currentOverlay);
|
|
15716
|
-
}
|
|
15717
|
-
this._currentOverlay = overlay;
|
|
15718
|
-
overlay.setOpacity(this.options.opacity !== undefined ? this.options.opacity : 1);
|
|
15719
|
-
if (this.options.isBack === true) {
|
|
15720
|
-
overlay.bringToBack();
|
|
15721
|
-
}
|
|
15722
|
-
if (this.options.isBack === false) {
|
|
15723
|
-
overlay.bringToFront();
|
|
15724
|
-
}
|
|
15725
|
-
if (this.options.zIndex !== undefined) {
|
|
15726
|
-
overlay.setZIndex(this.options.zIndex);
|
|
15727
|
-
}
|
|
15728
|
-
}, this);
|
|
15729
|
-
const { minZoom, maxZoom } = this.options;
|
|
15730
|
-
if ((minZoom && this._map.getZoom() < minZoom) ||
|
|
15731
|
-
(maxZoom && this._map.getZoom() > maxZoom)) {
|
|
15732
|
-
this._map.removeLayer(overlay);
|
|
15831
|
+
if (this.options.isBack === false) {
|
|
15832
|
+
overlay.bringToFront();
|
|
15733
15833
|
}
|
|
15734
|
-
|
|
15735
|
-
|
|
15736
|
-
this.options.opacity = opacity;
|
|
15737
|
-
if (this._currentOverlay) {
|
|
15738
|
-
this._currentOverlay.setOpacity(opacity);
|
|
15834
|
+
if (this.options.zIndex !== void 0) {
|
|
15835
|
+
overlay.setZIndex(this.options.zIndex);
|
|
15739
15836
|
}
|
|
15837
|
+
},
|
|
15838
|
+
this
|
|
15839
|
+
);
|
|
15840
|
+
const { minZoom, maxZoom } = this.options;
|
|
15841
|
+
if (minZoom && this._map.getZoom() < minZoom || maxZoom && this._map.getZoom() > maxZoom) {
|
|
15842
|
+
this._map.removeLayer(overlay);
|
|
15740
15843
|
}
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15844
|
+
}
|
|
15845
|
+
setOpacity(opacity) {
|
|
15846
|
+
this.options.opacity = opacity;
|
|
15847
|
+
if (this._currentOverlay) {
|
|
15848
|
+
this._currentOverlay.setOpacity(opacity);
|
|
15746
15849
|
}
|
|
15747
|
-
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
15751
|
-
|
|
15850
|
+
}
|
|
15851
|
+
bringToBack() {
|
|
15852
|
+
this.options.isBack = true;
|
|
15853
|
+
if (this._currentOverlay) {
|
|
15854
|
+
this._currentOverlay.bringToBack();
|
|
15752
15855
|
}
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
|
|
15756
|
-
|
|
15757
|
-
|
|
15856
|
+
}
|
|
15857
|
+
bringToFront() {
|
|
15858
|
+
this.options.isBack = false;
|
|
15859
|
+
if (this._currentOverlay) {
|
|
15860
|
+
this._currentOverlay.bringToFront();
|
|
15758
15861
|
}
|
|
15759
|
-
|
|
15760
|
-
|
|
15761
|
-
|
|
15762
|
-
|
|
15763
|
-
|
|
15764
|
-
// Compute WMS options
|
|
15765
|
-
const viewPortBuffer = this.options.viewPortBuffer || 0;
|
|
15766
|
-
const bounds = map.getBounds().pad(viewPortBuffer);
|
|
15767
|
-
const size = map.getSize();
|
|
15768
|
-
if (this.options.viewPortBuffer !== 0) {
|
|
15769
|
-
const factor = viewPortBuffer + 1;
|
|
15770
|
-
size.x = Math.ceil(size.x * factor);
|
|
15771
|
-
size.y = Math.ceil(size.y * factor);
|
|
15772
|
-
}
|
|
15773
|
-
const wmsVersion = parseFloat(this.wmsParams.version);
|
|
15774
|
-
const crs = this.options.crs || map.options.crs;
|
|
15775
|
-
const projectionKey = wmsVersion >= 1.3 ? 'crs' : 'srs';
|
|
15776
|
-
if (crs) {
|
|
15777
|
-
const nw = crs.project(bounds.getNorthWest());
|
|
15778
|
-
const se = crs.project(bounds.getSouthEast());
|
|
15779
|
-
// Assemble WMS parameter string
|
|
15780
|
-
const params = {
|
|
15781
|
-
width: size.x,
|
|
15782
|
-
height: size.y,
|
|
15783
|
-
};
|
|
15784
|
-
params[projectionKey] = crs.code;
|
|
15785
|
-
params.bbox = (wmsVersion >= 1.3 && crs === leafletSrc.exports.CRS.EPSG4326
|
|
15786
|
-
? [se.y, nw.x, nw.y, se.x]
|
|
15787
|
-
: [nw.x, se.y, se.x, nw.y]).join(',');
|
|
15788
|
-
leafletSrc.exports.Util.extend(this.wmsParams, params);
|
|
15789
|
-
}
|
|
15862
|
+
}
|
|
15863
|
+
setZIndex(zIndex) {
|
|
15864
|
+
this.options.zIndex = zIndex;
|
|
15865
|
+
if (this._currentOverlay) {
|
|
15866
|
+
this._currentOverlay.setZIndex(zIndex);
|
|
15790
15867
|
}
|
|
15791
|
-
|
|
15792
|
-
|
|
15793
|
-
|
|
15794
|
-
|
|
15868
|
+
}
|
|
15869
|
+
// See L.TileLayer.WMS: onAdd() & getTileUrl()
|
|
15870
|
+
updateWmsParams(map) {
|
|
15871
|
+
if (!map) {
|
|
15872
|
+
map = this._map;
|
|
15873
|
+
}
|
|
15874
|
+
const viewPortBuffer = this.options.viewPortBuffer || 0;
|
|
15875
|
+
const bounds = map.getBounds().pad(viewPortBuffer);
|
|
15876
|
+
const size = map.getSize();
|
|
15877
|
+
if (this.options.viewPortBuffer !== 0) {
|
|
15878
|
+
const factor = viewPortBuffer + 1;
|
|
15879
|
+
size.x = Math.ceil(size.x * factor);
|
|
15880
|
+
size.y = Math.ceil(size.y * factor);
|
|
15881
|
+
}
|
|
15882
|
+
const wmsVersion = parseFloat(this.wmsParams.version);
|
|
15883
|
+
const crs = this.options.crs || map.options.crs;
|
|
15884
|
+
const projectionKey = wmsVersion >= 1.3 ? "crs" : "srs";
|
|
15885
|
+
if (crs) {
|
|
15886
|
+
const nw = crs.project(bounds.getNorthWest());
|
|
15887
|
+
const se = crs.project(bounds.getSouthEast());
|
|
15888
|
+
const params = {
|
|
15889
|
+
width: size.x,
|
|
15890
|
+
height: size.y
|
|
15891
|
+
};
|
|
15892
|
+
params[projectionKey] = crs.code;
|
|
15893
|
+
params.bbox = (wmsVersion >= 1.3 && crs === leafletSrcExports.CRS.EPSG4326 ? [se.y, nw.x, nw.y, se.x] : [nw.x, se.y, se.x, nw.y]).join(",");
|
|
15894
|
+
leafletSrcExports.Util.extend(this.wmsParams, params);
|
|
15795
15895
|
}
|
|
15896
|
+
}
|
|
15897
|
+
getImageUrl() {
|
|
15898
|
+
const uppercase = this.options.uppercase || false;
|
|
15899
|
+
const pstr = leafletSrcExports.Util.getParamString(this.wmsParams, this._url, uppercase);
|
|
15900
|
+
return this._url + pstr;
|
|
15901
|
+
}
|
|
15796
15902
|
}
|
|
15797
15903
|
|
|
15904
|
+
var __defProp$4 = Object.defineProperty;
|
|
15905
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
15906
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
15907
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
15908
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15909
|
+
var __spreadValues$4 = (a, b) => {
|
|
15910
|
+
for (var prop in b || (b = {}))
|
|
15911
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
15912
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
15913
|
+
if (__getOwnPropSymbols$4)
|
|
15914
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
15915
|
+
if (__propIsEnum$4.call(b, prop))
|
|
15916
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
15917
|
+
}
|
|
15918
|
+
return a;
|
|
15919
|
+
};
|
|
15920
|
+
var __publicField$1 = (obj, key, value) => {
|
|
15921
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15922
|
+
return value;
|
|
15923
|
+
};
|
|
15798
15924
|
class ImageAdapter extends BaseAdapter {
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
|
-
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
|
|
15810
|
-
|
|
15811
|
-
|
|
15812
|
-
|
|
15813
|
-
|
|
15814
|
-
|
|
15815
|
-
|
|
15816
|
-
|
|
15817
|
-
|
|
15818
|
-
|
|
15819
|
-
|
|
15820
|
-
|
|
15821
|
-
}
|
|
15822
|
-
return this.layer;
|
|
15823
|
-
}
|
|
15925
|
+
constructor() {
|
|
15926
|
+
super(...arguments);
|
|
15927
|
+
__publicField$1(this, "layer");
|
|
15928
|
+
}
|
|
15929
|
+
addLayer(options) {
|
|
15930
|
+
const url = options && options.url;
|
|
15931
|
+
if (url) {
|
|
15932
|
+
options = __spreadValues$4({ transparent: true }, options);
|
|
15933
|
+
const updateWmsParamsFromOpt = options.updateWmsParams;
|
|
15934
|
+
this.layer = new ImageLayer(url, __spreadValues$4(__spreadValues$4(__spreadValues$4({
|
|
15935
|
+
pane: this.pane,
|
|
15936
|
+
headers: options.headers,
|
|
15937
|
+
setViewDelay: options.setViewDelay
|
|
15938
|
+
}, options), options.params), options.nativeOptions));
|
|
15939
|
+
if (updateWmsParamsFromOpt) {
|
|
15940
|
+
const updateWmsParams = this.layer.updateWmsParams;
|
|
15941
|
+
this.layer.updateWmsParams = function(map) {
|
|
15942
|
+
updateWmsParams.call(this, map);
|
|
15943
|
+
this.wmsParams = updateWmsParamsFromOpt(this.wmsParams);
|
|
15944
|
+
};
|
|
15945
|
+
}
|
|
15946
|
+
return this.layer;
|
|
15824
15947
|
}
|
|
15948
|
+
}
|
|
15825
15949
|
}
|
|
15826
15950
|
|
|
15827
15951
|
function makeRemote(Base) {
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
|
|
15850
|
-
|
|
15851
|
-
|
|
15852
|
-
|
|
15853
|
-
|
|
15854
|
-
|
|
15855
|
-
|
|
15856
|
-
|
|
15857
|
-
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
if (!tile.complete) {
|
|
15868
|
-
if (tile.abort) {
|
|
15869
|
-
tile.abort();
|
|
15870
|
-
}
|
|
15871
|
-
tile.src = leafletSrc.exports.Util.emptyImageUrl;
|
|
15872
|
-
leafletSrc.exports.DomUtil.remove(tile);
|
|
15873
|
-
delete tiles[i];
|
|
15874
|
-
}
|
|
15875
|
-
}
|
|
15952
|
+
return class RemoteTileLayer extends Base {
|
|
15953
|
+
constructor(...args) {
|
|
15954
|
+
super(...args);
|
|
15955
|
+
if (this.options.setViewDelay) {
|
|
15956
|
+
this._update = debounce((...a) => {
|
|
15957
|
+
leafletSrcExports.GridLayer.prototype._update.call(this, ...a);
|
|
15958
|
+
}, this.options.setViewDelay);
|
|
15959
|
+
}
|
|
15960
|
+
}
|
|
15961
|
+
createTile(coords, done) {
|
|
15962
|
+
const url = this.getTileUrl(coords);
|
|
15963
|
+
const tile = document.createElement("img");
|
|
15964
|
+
tile.abort = callAjax(
|
|
15965
|
+
url,
|
|
15966
|
+
(response) => {
|
|
15967
|
+
tile.src = response;
|
|
15968
|
+
done(null, tile);
|
|
15969
|
+
},
|
|
15970
|
+
// @ts-ignore
|
|
15971
|
+
this.options.headers
|
|
15972
|
+
);
|
|
15973
|
+
if (this.options.crossOrigin || this.options.crossOrigin === "") {
|
|
15974
|
+
tile.crossOrigin = this.options.crossOrigin === true ? "" : this.options.crossOrigin;
|
|
15975
|
+
}
|
|
15976
|
+
tile.alt = "";
|
|
15977
|
+
tile.setAttribute("role", "presentation");
|
|
15978
|
+
return tile;
|
|
15979
|
+
}
|
|
15980
|
+
_abortLoading() {
|
|
15981
|
+
const tiles = this._tiles;
|
|
15982
|
+
const tileZoom = this._tileZoom;
|
|
15983
|
+
for (const i in tiles) {
|
|
15984
|
+
if (tiles[i].coords.z !== tileZoom) {
|
|
15985
|
+
const tile = tiles[i].el;
|
|
15986
|
+
tile.onload = leafletSrcExports.Util.falseFn;
|
|
15987
|
+
tile.onerror = leafletSrcExports.Util.falseFn;
|
|
15988
|
+
if (!tile.complete) {
|
|
15989
|
+
if (tile.abort) {
|
|
15990
|
+
tile.abort();
|
|
15876
15991
|
}
|
|
15992
|
+
tile.src = leafletSrcExports.Util.emptyImageUrl;
|
|
15993
|
+
leafletSrcExports.DomUtil.remove(tile);
|
|
15994
|
+
delete tiles[i];
|
|
15995
|
+
}
|
|
15877
15996
|
}
|
|
15878
|
-
|
|
15997
|
+
}
|
|
15998
|
+
}
|
|
15999
|
+
};
|
|
15879
16000
|
}
|
|
15880
16001
|
|
|
15881
|
-
class TileLayerBase extends
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
|
|
16002
|
+
class TileLayerBase extends leafletSrcExports.TileLayer {
|
|
16003
|
+
constructor(urlTemplate, options) {
|
|
16004
|
+
super(urlTemplate, options);
|
|
16005
|
+
Object.assign(this.options, options);
|
|
16006
|
+
}
|
|
15886
16007
|
}
|
|
15887
16008
|
const TileLayer = makeRemote(TileLayerBase);
|
|
15888
16009
|
|
|
16010
|
+
var __defProp$3 = Object.defineProperty;
|
|
16011
|
+
var __defProps$2 = Object.defineProperties;
|
|
16012
|
+
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
16013
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
16014
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
16015
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
16016
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16017
|
+
var __spreadValues$3 = (a, b) => {
|
|
16018
|
+
for (var prop in b || (b = {}))
|
|
16019
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
16020
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
16021
|
+
if (__getOwnPropSymbols$3)
|
|
16022
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
16023
|
+
if (__propIsEnum$3.call(b, prop))
|
|
16024
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
16025
|
+
}
|
|
16026
|
+
return a;
|
|
16027
|
+
};
|
|
16028
|
+
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
16029
|
+
var __objRest$1 = (source, exclude) => {
|
|
16030
|
+
var target = {};
|
|
16031
|
+
for (var prop in source)
|
|
16032
|
+
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
16033
|
+
target[prop] = source[prop];
|
|
16034
|
+
if (source != null && __getOwnPropSymbols$3)
|
|
16035
|
+
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
16036
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
16037
|
+
target[prop] = source[prop];
|
|
16038
|
+
}
|
|
16039
|
+
return target;
|
|
16040
|
+
};
|
|
15889
16041
|
class TileAdapter extends BaseAdapter {
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15898
|
-
|
|
15899
|
-
|
|
15900
|
-
|
|
15901
|
-
|
|
15902
|
-
|
|
15903
|
-
|
|
15904
|
-
|
|
15905
|
-
|
|
15906
|
-
|
|
15907
|
-
|
|
15908
|
-
|
|
15909
|
-
|
|
15910
|
-
|
|
15911
|
-
|
|
15912
|
-
}
|
|
15913
|
-
else {
|
|
15914
|
-
layer = new leafletSrc.exports.TileLayer(url, tileLayerOptions);
|
|
15915
|
-
}
|
|
15916
|
-
return layer;
|
|
15917
|
-
}
|
|
16042
|
+
addLayer(options) {
|
|
16043
|
+
this.options = Object.assign(this.options, options);
|
|
16044
|
+
if (options) {
|
|
16045
|
+
const _a = options, { url } = _a, opt = __objRest$1(_a, ["url"]);
|
|
16046
|
+
if (url) {
|
|
16047
|
+
const tileLayerOptions = __spreadValues$3({
|
|
16048
|
+
pane: this.pane,
|
|
16049
|
+
attribution: opt.attribution,
|
|
16050
|
+
minZoom: opt.minZoom,
|
|
16051
|
+
maxZoom: opt.maxZoom
|
|
16052
|
+
}, opt.nativeOptions);
|
|
16053
|
+
if (opt.subdomains) {
|
|
16054
|
+
tileLayerOptions.subdomains = opt.subdomains;
|
|
16055
|
+
}
|
|
16056
|
+
let layer;
|
|
16057
|
+
if (opt.headers) {
|
|
16058
|
+
layer = new TileLayer(url, __spreadProps$2(__spreadValues$3({}, tileLayerOptions), {
|
|
16059
|
+
headers: opt.headers,
|
|
16060
|
+
setViewDelay: opt.setViewDelay
|
|
16061
|
+
}));
|
|
16062
|
+
} else {
|
|
16063
|
+
layer = new leafletSrcExports.TileLayer(url, tileLayerOptions);
|
|
15918
16064
|
}
|
|
16065
|
+
return layer;
|
|
16066
|
+
}
|
|
15919
16067
|
}
|
|
16068
|
+
}
|
|
15920
16069
|
}
|
|
15921
16070
|
|
|
15922
|
-
|
|
15923
|
-
|
|
15924
|
-
|
|
15925
|
-
|
|
15926
|
-
|
|
15927
|
-
|
|
15928
|
-
|
|
15929
|
-
|
|
15930
|
-
|
|
16071
|
+
var __defProp$2 = Object.defineProperty;
|
|
16072
|
+
var __defProps$1 = Object.defineProperties;
|
|
16073
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
16074
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
16075
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
16076
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
16077
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16078
|
+
var __spreadValues$2 = (a, b) => {
|
|
16079
|
+
for (var prop in b || (b = {}))
|
|
16080
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
16081
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
16082
|
+
if (__getOwnPropSymbols$2)
|
|
16083
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
16084
|
+
if (__propIsEnum$2.call(b, prop))
|
|
16085
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
15931
16086
|
}
|
|
16087
|
+
return a;
|
|
16088
|
+
};
|
|
16089
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
16090
|
+
class OsmAdapter extends TileAdapter {
|
|
16091
|
+
addLayer(options) {
|
|
16092
|
+
const url = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
|
|
16093
|
+
return super.addLayer(__spreadProps$1(__spreadValues$2({
|
|
16094
|
+
name: "OpenStreetMap",
|
|
16095
|
+
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
16096
|
+
}, options), {
|
|
16097
|
+
url
|
|
16098
|
+
}));
|
|
16099
|
+
}
|
|
15932
16100
|
}
|
|
15933
16101
|
|
|
15934
|
-
class WmsLayerBase extends
|
|
15935
|
-
|
|
15936
|
-
|
|
15937
|
-
|
|
16102
|
+
class WmsLayerBase extends leafletSrcExports.TileLayer.WMS {
|
|
16103
|
+
constructor(urlTemplate, options) {
|
|
16104
|
+
super(urlTemplate, options);
|
|
16105
|
+
}
|
|
15938
16106
|
}
|
|
15939
16107
|
const WmsLayer = makeRemote(WmsLayerBase);
|
|
15940
16108
|
|
|
16109
|
+
var __defProp$1 = Object.defineProperty;
|
|
16110
|
+
var __defProps = Object.defineProperties;
|
|
16111
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
16112
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
16113
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
16114
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
16115
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16116
|
+
var __spreadValues$1 = (a, b) => {
|
|
16117
|
+
for (var prop in b || (b = {}))
|
|
16118
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
16119
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
16120
|
+
if (__getOwnPropSymbols$1)
|
|
16121
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
16122
|
+
if (__propIsEnum$1.call(b, prop))
|
|
16123
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
16124
|
+
}
|
|
16125
|
+
return a;
|
|
16126
|
+
};
|
|
16127
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
16128
|
+
var __objRest = (source, exclude) => {
|
|
16129
|
+
var target = {};
|
|
16130
|
+
for (var prop in source)
|
|
16131
|
+
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
16132
|
+
target[prop] = source[prop];
|
|
16133
|
+
if (source != null && __getOwnPropSymbols$1)
|
|
16134
|
+
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
16135
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
16136
|
+
target[prop] = source[prop];
|
|
16137
|
+
}
|
|
16138
|
+
return target;
|
|
16139
|
+
};
|
|
15941
16140
|
class WmsAdapter extends BaseAdapter {
|
|
15942
|
-
|
|
15943
|
-
|
|
15944
|
-
|
|
15945
|
-
|
|
15946
|
-
|
|
15947
|
-
|
|
15948
|
-
|
|
15949
|
-
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
}
|
|
15962
|
-
return layer;
|
|
15963
|
-
}
|
|
16141
|
+
addLayer(options) {
|
|
16142
|
+
Object.assign(this.options, options);
|
|
16143
|
+
const _a = options, { url } = _a, opt = __objRest(_a, ["url"]);
|
|
16144
|
+
if (url) {
|
|
16145
|
+
const layerOptions = __spreadValues$1({
|
|
16146
|
+
pane: this.pane,
|
|
16147
|
+
attribution: opt.attribution,
|
|
16148
|
+
minZoom: opt.minZoom,
|
|
16149
|
+
maxZoom: opt.maxZoom,
|
|
16150
|
+
layers: options.layers,
|
|
16151
|
+
format: options.format
|
|
16152
|
+
}, options.nativeOptions);
|
|
16153
|
+
let layer;
|
|
16154
|
+
if (opt.headers) {
|
|
16155
|
+
layer = new WmsLayer(url, __spreadProps(__spreadValues$1({}, layerOptions), { headers: opt.headers }));
|
|
16156
|
+
} else {
|
|
16157
|
+
layer = new leafletSrcExports.TileLayer.WMS(url, layerOptions);
|
|
16158
|
+
}
|
|
16159
|
+
return layer;
|
|
15964
16160
|
}
|
|
16161
|
+
}
|
|
15965
16162
|
}
|
|
15966
16163
|
|
|
15967
16164
|
function arrayToBoundsExpression(bounds) {
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
];
|
|
16165
|
+
const e = bounds;
|
|
16166
|
+
return [
|
|
16167
|
+
[e[3], e[0]],
|
|
16168
|
+
[e[1], e[2]]
|
|
16169
|
+
];
|
|
15974
16170
|
}
|
|
15975
16171
|
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
'movestart',
|
|
15990
|
-
];
|
|
15991
|
-
this._positionEvents = [
|
|
15992
|
-
'mousemove',
|
|
15993
|
-
'mouseout',
|
|
15994
|
-
'mouseover',
|
|
15995
|
-
];
|
|
15996
|
-
}
|
|
15997
|
-
create(options) {
|
|
15998
|
-
this.options = { ...options };
|
|
15999
|
-
if (this.options.target) {
|
|
16000
|
-
const { zoom, center, maxZoom, minZoom, maxBounds: mb, mapAdapterOptions, } = this.options;
|
|
16001
|
-
this.map =
|
|
16002
|
-
this.options.map ||
|
|
16003
|
-
new leafletSrc.exports.Map(this.options.target, {
|
|
16004
|
-
attributionControl: false,
|
|
16005
|
-
zoomControl: false,
|
|
16006
|
-
maxBounds: mb ? arrayToBoundsExpression(mb) : undefined,
|
|
16007
|
-
maxZoom,
|
|
16008
|
-
minZoom,
|
|
16009
|
-
center: center && [center[1], center[0]],
|
|
16010
|
-
zoom,
|
|
16011
|
-
...mapAdapterOptions,
|
|
16012
|
-
});
|
|
16013
|
-
// create default pane
|
|
16014
|
-
const defPane = this.map.createPane('order-0');
|
|
16015
|
-
this.map._addUnselectCb = (def) => {
|
|
16016
|
-
this._addUnselectCb(def);
|
|
16017
|
-
};
|
|
16018
|
-
defPane.style.zIndex = String(0);
|
|
16019
|
-
this.emitter.emit('create', this);
|
|
16020
|
-
this._addMapListeners();
|
|
16021
|
-
}
|
|
16172
|
+
var __defProp = Object.defineProperty;
|
|
16173
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
16174
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16175
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
16176
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16177
|
+
var __spreadValues = (a, b) => {
|
|
16178
|
+
for (var prop in b || (b = {}))
|
|
16179
|
+
if (__hasOwnProp.call(b, prop))
|
|
16180
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16181
|
+
if (__getOwnPropSymbols)
|
|
16182
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16183
|
+
if (__propIsEnum.call(b, prop))
|
|
16184
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16022
16185
|
}
|
|
16023
|
-
|
|
16024
|
-
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
-
|
|
16186
|
+
return a;
|
|
16187
|
+
};
|
|
16188
|
+
var __publicField = (obj, key, value) => {
|
|
16189
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16190
|
+
return value;
|
|
16191
|
+
};
|
|
16192
|
+
const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
16193
|
+
constructor() {
|
|
16194
|
+
__publicField(this, "options", { target: "map" });
|
|
16195
|
+
__publicField(this, "layerAdapters", _LeafletMapAdapter.layerAdapters);
|
|
16196
|
+
__publicField(this, "controlAdapters", _LeafletMapAdapter.controlAdapters);
|
|
16197
|
+
__publicField(this, "emitter", new EventEmitter());
|
|
16198
|
+
__publicField(this, "map");
|
|
16199
|
+
__publicField(this, "_resizeObserver");
|
|
16200
|
+
__publicField(this, "_unselectCb", []);
|
|
16201
|
+
__publicField(this, "_universalEvents", [
|
|
16202
|
+
"move",
|
|
16203
|
+
"zoom",
|
|
16204
|
+
"zoomend",
|
|
16205
|
+
"zoomstart",
|
|
16206
|
+
"moveend",
|
|
16207
|
+
"movestart"
|
|
16208
|
+
]);
|
|
16209
|
+
__publicField(this, "_positionEvents", [
|
|
16210
|
+
"mousemove",
|
|
16211
|
+
"mouseout",
|
|
16212
|
+
"mouseover"
|
|
16213
|
+
]);
|
|
16214
|
+
}
|
|
16215
|
+
create(options) {
|
|
16216
|
+
this.options = __spreadValues({}, options);
|
|
16217
|
+
if (this.options.target) {
|
|
16218
|
+
const {
|
|
16219
|
+
zoom,
|
|
16220
|
+
center,
|
|
16221
|
+
maxZoom,
|
|
16222
|
+
minZoom,
|
|
16223
|
+
maxBounds: mb,
|
|
16224
|
+
mapAdapterOptions
|
|
16225
|
+
} = this.options;
|
|
16226
|
+
this.map = this.options.map || new leafletSrcExports.Map(this.options.target, __spreadValues({
|
|
16227
|
+
attributionControl: false,
|
|
16228
|
+
zoomControl: false,
|
|
16229
|
+
maxBounds: mb ? arrayToBoundsExpression(mb) : void 0,
|
|
16230
|
+
maxZoom,
|
|
16231
|
+
minZoom,
|
|
16232
|
+
center: center && [center[1], center[0]],
|
|
16233
|
+
zoom
|
|
16234
|
+
}, mapAdapterOptions));
|
|
16235
|
+
const defPane = this.map.createPane("order-0");
|
|
16236
|
+
this.map._addUnselectCb = (def) => {
|
|
16237
|
+
this._addUnselectCb(def);
|
|
16238
|
+
};
|
|
16239
|
+
defPane.style.zIndex = String(0);
|
|
16240
|
+
this.emitter.emit("create", this);
|
|
16241
|
+
this._addMapListeners();
|
|
16028
16242
|
}
|
|
16029
|
-
|
|
16030
|
-
|
|
16243
|
+
}
|
|
16244
|
+
destroy() {
|
|
16245
|
+
if (this.map) {
|
|
16246
|
+
this.map.remove();
|
|
16031
16247
|
}
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
|
|
16036
|
-
|
|
16037
|
-
|
|
16248
|
+
this._stopWatchSizeChangeToUpdateMinZoom();
|
|
16249
|
+
}
|
|
16250
|
+
getContainer() {
|
|
16251
|
+
return this.map && this.map.getContainer();
|
|
16252
|
+
}
|
|
16253
|
+
getControlContainer() {
|
|
16254
|
+
const controlContainer = this.map && this.map._controlContainer;
|
|
16255
|
+
if (controlContainer) {
|
|
16256
|
+
return controlContainer;
|
|
16038
16257
|
}
|
|
16039
|
-
|
|
16040
|
-
|
|
16041
|
-
|
|
16042
|
-
|
|
16258
|
+
throw new Error("Leaflet Map is not initialized yet");
|
|
16259
|
+
}
|
|
16260
|
+
setCursor(cursor) {
|
|
16261
|
+
if (this.map) {
|
|
16262
|
+
this.map.getContainer().style.cursor = cursor;
|
|
16043
16263
|
}
|
|
16044
|
-
|
|
16045
|
-
|
|
16046
|
-
|
|
16047
|
-
|
|
16048
|
-
|
|
16049
|
-
|
|
16050
|
-
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
|
|
16057
|
-
}
|
|
16058
|
-
}
|
|
16059
|
-
}
|
|
16060
|
-
else {
|
|
16061
|
-
const { zoom, center, maxBounds, bounds, minZoom, maxZoom } = lngLatOrOpt;
|
|
16062
|
-
if (center && zoom !== undefined) {
|
|
16063
|
-
this.setView(center, zoom);
|
|
16064
|
-
}
|
|
16065
|
-
else {
|
|
16066
|
-
if (zoom !== undefined) {
|
|
16067
|
-
this.setZoom(zoom);
|
|
16068
|
-
}
|
|
16069
|
-
if (center) {
|
|
16070
|
-
this.setCenter(center);
|
|
16071
|
-
}
|
|
16072
|
-
}
|
|
16073
|
-
if (bounds) {
|
|
16074
|
-
this.fitBounds(bounds);
|
|
16075
|
-
}
|
|
16076
|
-
if (maxBounds !== undefined) {
|
|
16077
|
-
if (maxBounds) {
|
|
16078
|
-
const b = arrayToBoundsExpression(maxBounds);
|
|
16079
|
-
map.setMaxBounds(b);
|
|
16080
|
-
map.setMinZoom(map.getBoundsZoom(b));
|
|
16081
|
-
this._watchSizeChangeToUpdateMinZoom(b);
|
|
16082
|
-
}
|
|
16083
|
-
else {
|
|
16084
|
-
// @ts-ignore `null` works for unset maxBounds, but not in typing
|
|
16085
|
-
map.setMaxBounds(null);
|
|
16086
|
-
this._stopWatchSizeChangeToUpdateMinZoom();
|
|
16087
|
-
}
|
|
16088
|
-
}
|
|
16089
|
-
if (maxZoom !== undefined) {
|
|
16090
|
-
map.setMaxZoom(maxZoom);
|
|
16091
|
-
}
|
|
16092
|
-
if (minZoom !== undefined) {
|
|
16093
|
-
this._stopWatchSizeChangeToUpdateMinZoom();
|
|
16094
|
-
map.setMinZoom(minZoom);
|
|
16095
|
-
}
|
|
16264
|
+
}
|
|
16265
|
+
setView(lngLatOrOpt, zoom) {
|
|
16266
|
+
const map = this.map;
|
|
16267
|
+
if (!map)
|
|
16268
|
+
return;
|
|
16269
|
+
if (Array.isArray(lngLatOrOpt)) {
|
|
16270
|
+
const lngLat = lngLatOrOpt;
|
|
16271
|
+
const [lng, lat] = lngLat;
|
|
16272
|
+
if (this.map) {
|
|
16273
|
+
if (typeof zoom === "number") {
|
|
16274
|
+
this.map.setView([lat, lng], zoom, { animate: false });
|
|
16275
|
+
} else {
|
|
16276
|
+
this.setCenter([lng, lat]);
|
|
16096
16277
|
}
|
|
16097
|
-
|
|
16098
|
-
|
|
16099
|
-
|
|
16100
|
-
|
|
16101
|
-
|
|
16278
|
+
}
|
|
16279
|
+
} else {
|
|
16280
|
+
const { zoom: zoom2, center, maxBounds, bounds, minZoom, maxZoom } = lngLatOrOpt;
|
|
16281
|
+
if (center && zoom2 !== void 0) {
|
|
16282
|
+
this.setView(center, zoom2);
|
|
16283
|
+
} else {
|
|
16284
|
+
if (zoom2 !== void 0) {
|
|
16285
|
+
this.setZoom(zoom2);
|
|
16102
16286
|
}
|
|
16103
|
-
|
|
16104
|
-
|
|
16105
|
-
const map = this.map;
|
|
16106
|
-
if (map) {
|
|
16107
|
-
const bounds = map.getBounds();
|
|
16108
|
-
const center = bounds.getCenter();
|
|
16109
|
-
return [center.lng, center.lat];
|
|
16287
|
+
if (center) {
|
|
16288
|
+
this.setCenter(center);
|
|
16110
16289
|
}
|
|
16111
|
-
|
|
16112
|
-
|
|
16113
|
-
|
|
16114
|
-
|
|
16290
|
+
}
|
|
16291
|
+
if (bounds) {
|
|
16292
|
+
this.fitBounds(bounds);
|
|
16293
|
+
}
|
|
16294
|
+
if (maxBounds !== void 0) {
|
|
16295
|
+
if (maxBounds) {
|
|
16296
|
+
const b = arrayToBoundsExpression(maxBounds);
|
|
16297
|
+
map.setMaxBounds(b);
|
|
16298
|
+
map.setMinZoom(map.getBoundsZoom(b));
|
|
16299
|
+
this._watchSizeChangeToUpdateMinZoom(b);
|
|
16300
|
+
} else {
|
|
16301
|
+
map.setMaxBounds(null);
|
|
16302
|
+
this._stopWatchSizeChangeToUpdateMinZoom();
|
|
16115
16303
|
}
|
|
16304
|
+
}
|
|
16305
|
+
if (maxZoom !== void 0) {
|
|
16306
|
+
map.setMaxZoom(maxZoom);
|
|
16307
|
+
}
|
|
16308
|
+
if (minZoom !== void 0) {
|
|
16309
|
+
this._stopWatchSizeChangeToUpdateMinZoom();
|
|
16310
|
+
map.setMinZoom(minZoom);
|
|
16311
|
+
}
|
|
16116
16312
|
}
|
|
16117
|
-
|
|
16118
|
-
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
|
|
16122
|
-
if (!this.map)
|
|
16123
|
-
return undefined;
|
|
16124
|
-
const b = this.map.getBounds();
|
|
16125
|
-
const sw = b.getSouthWest();
|
|
16126
|
-
const ne = b.getNorthEast();
|
|
16127
|
-
return [sw.lng, sw.lat, ne.lng, ne.lat];
|
|
16313
|
+
}
|
|
16314
|
+
setCenter(lngLat) {
|
|
16315
|
+
const [lng, lat] = lngLat;
|
|
16316
|
+
if (this.map) {
|
|
16317
|
+
this.map.panTo([lat, lng]);
|
|
16128
16318
|
}
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
}
|
|
16137
|
-
if (padding) {
|
|
16138
|
-
opt.padding = [padding, padding];
|
|
16139
|
-
}
|
|
16140
|
-
if (offset) {
|
|
16141
|
-
opt.padding = offset;
|
|
16142
|
-
}
|
|
16143
|
-
this.map.fitBounds(arrayToBoundsExpression(bounds), opt);
|
|
16144
|
-
}
|
|
16319
|
+
}
|
|
16320
|
+
getCenter() {
|
|
16321
|
+
const map = this.map;
|
|
16322
|
+
if (map) {
|
|
16323
|
+
const bounds = map.getBounds();
|
|
16324
|
+
const center = bounds.getCenter();
|
|
16325
|
+
return [center.lng, center.lat];
|
|
16145
16326
|
}
|
|
16146
|
-
|
|
16147
|
-
|
|
16327
|
+
}
|
|
16328
|
+
setZoom(zoom) {
|
|
16329
|
+
if (this.map) {
|
|
16330
|
+
this.map.setZoom(zoom);
|
|
16148
16331
|
}
|
|
16149
|
-
|
|
16150
|
-
|
|
16332
|
+
}
|
|
16333
|
+
getZoom() {
|
|
16334
|
+
var _a;
|
|
16335
|
+
return (_a = this.map && this.map.getZoom()) != null ? _a : void 0;
|
|
16336
|
+
}
|
|
16337
|
+
getBounds() {
|
|
16338
|
+
if (!this.map)
|
|
16339
|
+
return void 0;
|
|
16340
|
+
const b = this.map.getBounds();
|
|
16341
|
+
const sw = b.getSouthWest();
|
|
16342
|
+
const ne = b.getNorthEast();
|
|
16343
|
+
return [sw.lng, sw.lat, ne.lng, ne.lat];
|
|
16344
|
+
}
|
|
16345
|
+
// [west, south, east, north]
|
|
16346
|
+
fitBounds(bounds, options = {}) {
|
|
16347
|
+
if (this.map) {
|
|
16348
|
+
const { maxZoom, offset, padding } = options;
|
|
16349
|
+
const opt = {};
|
|
16350
|
+
if (maxZoom) {
|
|
16351
|
+
opt.maxZoom = maxZoom;
|
|
16352
|
+
}
|
|
16353
|
+
if (padding) {
|
|
16354
|
+
opt.padding = [padding, padding];
|
|
16355
|
+
}
|
|
16356
|
+
if (offset) {
|
|
16357
|
+
opt.padding = offset;
|
|
16358
|
+
}
|
|
16359
|
+
this.map.fitBounds(arrayToBoundsExpression(bounds), opt);
|
|
16151
16360
|
}
|
|
16152
|
-
|
|
16153
|
-
|
|
16361
|
+
}
|
|
16362
|
+
getLayerAdapter(name) {
|
|
16363
|
+
return _LeafletMapAdapter.layerAdapters[name];
|
|
16364
|
+
}
|
|
16365
|
+
createControl(control, options) {
|
|
16366
|
+
return createControl(control, options, this);
|
|
16367
|
+
}
|
|
16368
|
+
createButtonControl(options) {
|
|
16369
|
+
return createButtonControl(options, this);
|
|
16370
|
+
}
|
|
16371
|
+
addControl(control, position) {
|
|
16372
|
+
control.options.position = position.replace("-", "");
|
|
16373
|
+
if (this.map) {
|
|
16374
|
+
this.map.addControl(control);
|
|
16375
|
+
return control;
|
|
16154
16376
|
}
|
|
16155
|
-
|
|
16156
|
-
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
return control;
|
|
16160
|
-
}
|
|
16377
|
+
}
|
|
16378
|
+
removeControl(control) {
|
|
16379
|
+
if (this.map) {
|
|
16380
|
+
this.map.removeControl(control);
|
|
16161
16381
|
}
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
16382
|
+
}
|
|
16383
|
+
removeLayer(layer) {
|
|
16384
|
+
layer && layer.remove && layer.remove();
|
|
16385
|
+
}
|
|
16386
|
+
showLayer(layer) {
|
|
16387
|
+
if (this.map) {
|
|
16388
|
+
layer.addTo(this.map);
|
|
16166
16389
|
}
|
|
16167
|
-
|
|
16168
|
-
|
|
16390
|
+
}
|
|
16391
|
+
hideLayer(layer) {
|
|
16392
|
+
layer.remove();
|
|
16393
|
+
}
|
|
16394
|
+
setLayerOpacity(layer, value) {
|
|
16395
|
+
if ("setOpacity" in layer) {
|
|
16396
|
+
layer.setOpacity(value);
|
|
16169
16397
|
}
|
|
16170
|
-
|
|
16171
|
-
|
|
16172
|
-
|
|
16398
|
+
}
|
|
16399
|
+
setLayerOrder(layer, order, layers) {
|
|
16400
|
+
}
|
|
16401
|
+
onMapClick(evt) {
|
|
16402
|
+
const converted = convertMapClickEvent(evt);
|
|
16403
|
+
this.emitter.emit("preclick", converted);
|
|
16404
|
+
this.emitter.emit("click", converted);
|
|
16405
|
+
}
|
|
16406
|
+
locate(opt, events) {
|
|
16407
|
+
const map = this.map;
|
|
16408
|
+
if (map) {
|
|
16409
|
+
map.locate(opt);
|
|
16410
|
+
if (events) {
|
|
16411
|
+
const { locationfound, locationerror } = events;
|
|
16412
|
+
const locationFound = (e) => {
|
|
16413
|
+
const event = e;
|
|
16414
|
+
const lngLat = [event.latlng.lng, event.latlng.lat];
|
|
16415
|
+
locationfound({ lngLat });
|
|
16416
|
+
};
|
|
16417
|
+
if (locationfound !== void 0) {
|
|
16418
|
+
map.on("locationfound", locationFound, this);
|
|
16173
16419
|
}
|
|
16174
|
-
|
|
16175
|
-
|
|
16176
|
-
layer.remove();
|
|
16177
|
-
}
|
|
16178
|
-
setLayerOpacity(layer, value) {
|
|
16179
|
-
if ('setOpacity' in layer) {
|
|
16180
|
-
layer.setOpacity(value);
|
|
16420
|
+
if (locationerror) {
|
|
16421
|
+
map.on("locationerror", locationerror, this);
|
|
16181
16422
|
}
|
|
16423
|
+
const stop2 = () => {
|
|
16424
|
+
if (locationfound !== void 0) {
|
|
16425
|
+
map.off("locationfound", locationFound);
|
|
16426
|
+
}
|
|
16427
|
+
if (locationerror) {
|
|
16428
|
+
map.off("locationerror", locationerror);
|
|
16429
|
+
}
|
|
16430
|
+
};
|
|
16431
|
+
return { stop: stop2 };
|
|
16432
|
+
}
|
|
16182
16433
|
}
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
|
|
16188
|
-
|
|
16189
|
-
this.emitter.emit('click', converted);
|
|
16190
|
-
}
|
|
16191
|
-
locate(opt, events) {
|
|
16192
|
-
const map = this.map;
|
|
16193
|
-
if (map) {
|
|
16194
|
-
map.locate(opt);
|
|
16195
|
-
if (events) {
|
|
16196
|
-
const { locationfound, locationerror } = events;
|
|
16197
|
-
const locationFound = (e) => {
|
|
16198
|
-
const event = e;
|
|
16199
|
-
const lngLat = [event.latlng.lng, event.latlng.lat];
|
|
16200
|
-
locationfound({ lngLat });
|
|
16201
|
-
};
|
|
16202
|
-
if (locationfound !== undefined) {
|
|
16203
|
-
map.on('locationfound', locationFound, this);
|
|
16204
|
-
}
|
|
16205
|
-
if (locationerror) {
|
|
16206
|
-
map.on('locationerror', locationerror, this);
|
|
16207
|
-
}
|
|
16208
|
-
const stop = () => {
|
|
16209
|
-
if (locationfound !== undefined) {
|
|
16210
|
-
map.off('locationfound', locationFound);
|
|
16211
|
-
}
|
|
16212
|
-
if (locationerror) {
|
|
16213
|
-
map.off('locationerror', locationerror);
|
|
16214
|
-
}
|
|
16215
|
-
};
|
|
16216
|
-
return { stop };
|
|
16217
|
-
}
|
|
16218
|
-
}
|
|
16219
|
-
const stop = () => void 'fake function';
|
|
16220
|
-
return { stop };
|
|
16434
|
+
const stop = () => void 0;
|
|
16435
|
+
return { stop };
|
|
16436
|
+
}
|
|
16437
|
+
_addUnselectCb(cb) {
|
|
16438
|
+
for (const p of this._unselectCb) {
|
|
16439
|
+
p();
|
|
16221
16440
|
}
|
|
16222
|
-
|
|
16223
|
-
|
|
16224
|
-
|
|
16225
|
-
|
|
16226
|
-
|
|
16227
|
-
|
|
16441
|
+
this._unselectCb.length = 0;
|
|
16442
|
+
this._unselectCb.push(cb);
|
|
16443
|
+
}
|
|
16444
|
+
_watchSizeChangeToUpdateMinZoom(bounds) {
|
|
16445
|
+
this._stopWatchSizeChangeToUpdateMinZoom();
|
|
16446
|
+
const container = this.getContainer();
|
|
16447
|
+
const map = this.map;
|
|
16448
|
+
if (container && map && window.ResizeObserver) {
|
|
16449
|
+
this._resizeObserver = new ResizeObserver(() => {
|
|
16450
|
+
map.setMinZoom(map.getBoundsZoom(bounds));
|
|
16451
|
+
});
|
|
16452
|
+
this._resizeObserver.observe(container);
|
|
16228
16453
|
}
|
|
16229
|
-
|
|
16230
|
-
|
|
16231
|
-
|
|
16232
|
-
|
|
16233
|
-
|
|
16234
|
-
this._resizeObserver = new ResizeObserver(() => {
|
|
16235
|
-
map.setMinZoom(map.getBoundsZoom(bounds));
|
|
16236
|
-
});
|
|
16237
|
-
this._resizeObserver.observe(container);
|
|
16238
|
-
}
|
|
16454
|
+
}
|
|
16455
|
+
_stopWatchSizeChangeToUpdateMinZoom() {
|
|
16456
|
+
const map = this.map;
|
|
16457
|
+
if (map) {
|
|
16458
|
+
map.setMinZoom(0);
|
|
16239
16459
|
}
|
|
16240
|
-
|
|
16241
|
-
|
|
16242
|
-
|
|
16243
|
-
map.setMinZoom(0);
|
|
16244
|
-
}
|
|
16245
|
-
if (this._resizeObserver) {
|
|
16246
|
-
this._resizeObserver.disconnect();
|
|
16247
|
-
this._resizeObserver = undefined;
|
|
16248
|
-
}
|
|
16460
|
+
if (this._resizeObserver) {
|
|
16461
|
+
this._resizeObserver.disconnect();
|
|
16462
|
+
this._resizeObserver = void 0;
|
|
16249
16463
|
}
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
|
|
16253
|
-
|
|
16254
|
-
|
|
16255
|
-
|
|
16256
|
-
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
|
|
16260
|
-
|
|
16261
|
-
|
|
16262
|
-
|
|
16464
|
+
}
|
|
16465
|
+
_addMapListeners() {
|
|
16466
|
+
const map = this.map;
|
|
16467
|
+
if (map) {
|
|
16468
|
+
map.on("click", (evt) => {
|
|
16469
|
+
this.onMapClick(evt);
|
|
16470
|
+
});
|
|
16471
|
+
for (const e of this._universalEvents) {
|
|
16472
|
+
map.on(e, () => this.emitter.emit(e, this), map);
|
|
16473
|
+
}
|
|
16474
|
+
for (const e of this._positionEvents) {
|
|
16475
|
+
map.on(
|
|
16476
|
+
e,
|
|
16477
|
+
(evt) => this.emitter.emit(
|
|
16478
|
+
e,
|
|
16479
|
+
convertMapClickEvent(evt)
|
|
16480
|
+
),
|
|
16481
|
+
map
|
|
16482
|
+
);
|
|
16483
|
+
}
|
|
16263
16484
|
}
|
|
16264
|
-
}
|
|
16265
|
-
LeafletMapAdapter$1.layerAdapters = {
|
|
16266
|
-
GEOJSON: GeoJsonAdapter,
|
|
16267
|
-
IMAGE: ImageAdapter,
|
|
16268
|
-
TILE: TileAdapter,
|
|
16269
|
-
WMS: WmsAdapter,
|
|
16270
|
-
// // MVT: MvtAdapter,
|
|
16271
|
-
OSM: OsmAdapter,
|
|
16272
|
-
};
|
|
16273
|
-
LeafletMapAdapter$1.controlAdapters = {
|
|
16274
|
-
ZOOM: leafletSrc.exports.Control.Zoom,
|
|
16275
|
-
ATTRIBUTION: AttributionControl,
|
|
16485
|
+
}
|
|
16276
16486
|
};
|
|
16277
|
-
|
|
16278
|
-
|
|
16279
|
-
|
|
16280
|
-
|
|
16281
|
-
|
|
16282
|
-
|
|
16487
|
+
__publicField(_LeafletMapAdapter, "layerAdapters", {
|
|
16488
|
+
GEOJSON: GeoJsonAdapter,
|
|
16489
|
+
IMAGE: ImageAdapter,
|
|
16490
|
+
TILE: TileAdapter,
|
|
16491
|
+
WMS: WmsAdapter,
|
|
16492
|
+
// // MVT: MvtAdapter,
|
|
16493
|
+
OSM: OsmAdapter
|
|
16494
|
+
});
|
|
16495
|
+
__publicField(_LeafletMapAdapter, "controlAdapters", {
|
|
16496
|
+
ZOOM: leafletSrcExports.Control.Zoom,
|
|
16497
|
+
ATTRIBUTION: AttributionControl
|
|
16498
|
+
});
|
|
16499
|
+
__publicField(_LeafletMapAdapter, "Map", leafletSrcExports.Map);
|
|
16500
|
+
let LeafletMapAdapter = _LeafletMapAdapter;
|
|
16283
16501
|
|
|
16284
16502
|
export { LeafletMapAdapter as default };
|
|
16285
16503
|
//# sourceMappingURL=leaflet-map-adapter.esm-browser.js.map
|