@hybridcore/ui 1.6.19 → 1.6.21
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/dist/components/geometry-picker/index.js +95 -81
- package/dist/components/geometry-picker/logic.js +58 -41
- package/dist/components/geometry-picker/map/logic.js +446 -448
- package/dist/components/geometry-picker/styled.js +62 -40
- package/dist/components/metric-card/index.js +68 -58
- package/dist/components/metric-card/styled.js +79 -60
- package/dist/components/status-indicator/index.js +25 -25
- package/dist/components/status-indicator/styled.js +77 -41
- package/dist/main.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createMapboxLayer as
|
|
3
|
-
import { C as
|
|
4
|
-
import { T as
|
|
5
|
-
import { F as
|
|
6
|
-
import { I as
|
|
7
|
-
import { V as
|
|
8
|
-
import { e as
|
|
9
|
-
import { defaultStyle as
|
|
10
|
-
import { a8 as
|
|
11
|
-
import { alert as
|
|
12
|
-
const
|
|
1
|
+
import L from "react";
|
|
2
|
+
import { createMapboxLayer as Ft } from "../../map/helpers/mapbox.js";
|
|
3
|
+
import { C as Pe, b as G, c as Be, V as Me, a as oe } from "../../../Vector-DfTqQEln.js";
|
|
4
|
+
import { T as ae, g as C, j as pt, e as Oe, f as H, E as W, k as Et, F as We, t as St, s as He, m as $e, l as Z, u as xe, a as D, p as wt, q as Pt, r as $, v as J, b as Lt, w as Dt } from "../../../math-Bvt2Ubuz.js";
|
|
5
|
+
import { F as M, L as re, M as Mt, a as Je, b as Qe, G as kt } from "../../../WKT-2wsDT-nq.js";
|
|
6
|
+
import { I as Rt, s as et, n as Le, e as tt, P as ke, p as Gt, f as vt, h as De, M as P, C as At, i as bt, j as It, l as jt, T as Ot, m as U, o as b, q as Ut, R as zt, r as Kt, a as Ue, t as ze, u as Nt } from "../../../ol-yOE-NV0X.js";
|
|
7
|
+
import { V as ce } from "../../../Vector-BmuhQO4p.js";
|
|
8
|
+
import { e as Re, f as A, s as Vt } from "../../../Text-ChJRuaD8.js";
|
|
9
|
+
import { defaultStyle as qt, selectStyleFunction as Xt, markerStyle as Zt } from "./style.js";
|
|
10
|
+
import { a8 as S, a9 as Ce, P as Y, aa as le, ab as F, ac as v, ad as he, ae as Yt, af as it, a4 as nt, ag as I, ah as st, ai as Bt, aj as Ke, I as rt, y as Wt, ak as Ht, al as $t, am as Jt, an as ot, T as at, ao as Qt, c as Ge, ap as ei, a2 as lt, aq as ti, ar as ii, as as ni, at as si, S as ri, e as K } from "../../../Source-BSZST_GH.js";
|
|
11
|
+
import { alert as oi } from "../../confirm/index.js";
|
|
12
|
+
const ai = {
|
|
13
13
|
/**
|
|
14
14
|
* Triggered when feature(s) has been (de)selected.
|
|
15
15
|
* @event SelectEvent#select
|
|
@@ -17,7 +17,7 @@ const oi = {
|
|
|
17
17
|
*/
|
|
18
18
|
SELECT: "select"
|
|
19
19
|
};
|
|
20
|
-
class
|
|
20
|
+
class li extends H {
|
|
21
21
|
/**
|
|
22
22
|
* @param {SelectEventType} type The event type.
|
|
23
23
|
* @param {Array<import("../Feature.js").default>} selected Selected features.
|
|
@@ -29,13 +29,13 @@ class ai extends J {
|
|
|
29
29
|
super(e), this.selected = t, this.deselected = i, this.mapBrowserEvent = n;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
class ve extends
|
|
32
|
+
const Q = {};
|
|
33
|
+
class ve extends Rt {
|
|
34
34
|
/**
|
|
35
35
|
* @param {Options} [options] Options.
|
|
36
36
|
*/
|
|
37
37
|
constructor(e) {
|
|
38
|
-
super(), this.on, this.once, this.un, e = e || {}, this.boundAddFeature_ = this.addFeature_.bind(this), this.boundRemoveFeature_ = this.removeFeature_.bind(this), this.condition_ = e.condition ? e.condition : et, this.addCondition_ = e.addCondition ? e.addCondition :
|
|
38
|
+
super(), this.on, this.once, this.un, e = e || {}, this.boundAddFeature_ = this.addFeature_.bind(this), this.boundRemoveFeature_ = this.removeFeature_.bind(this), this.condition_ = e.condition ? e.condition : et, this.addCondition_ = e.addCondition ? e.addCondition : Le, this.removeCondition_ = e.removeCondition ? e.removeCondition : Le, this.toggleCondition_ = e.toggleCondition ? e.toggleCondition : tt, this.multi_ = e.multi ? e.multi : !1, this.filter_ = e.filter ? e.filter : ae, this.hitTolerance_ = e.hitTolerance ? e.hitTolerance : 0, this.style_ = e.style !== void 0 ? e.style : hi(), this.features_ = e.features || new Pe();
|
|
39
39
|
let t;
|
|
40
40
|
if (e.layers)
|
|
41
41
|
if (typeof e.layers == "function")
|
|
@@ -47,7 +47,7 @@ class ve extends kt {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
else
|
|
50
|
-
t =
|
|
50
|
+
t = ae;
|
|
51
51
|
this.layerFilter_ = t, this.featureLayerAssociation_ = {};
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
@@ -104,16 +104,16 @@ class ve extends kt {
|
|
|
104
104
|
*/
|
|
105
105
|
setMap(e) {
|
|
106
106
|
this.getMap() && this.style_ && this.features_.forEach(this.restorePreviousStyle_.bind(this)), super.setMap(e), e ? (this.features_.addEventListener(
|
|
107
|
-
|
|
107
|
+
G.ADD,
|
|
108
108
|
this.boundAddFeature_
|
|
109
109
|
), this.features_.addEventListener(
|
|
110
|
-
|
|
110
|
+
G.REMOVE,
|
|
111
111
|
this.boundRemoveFeature_
|
|
112
112
|
), this.style_ && this.features_.forEach(this.applySelectedStyle_.bind(this))) : (this.features_.removeEventListener(
|
|
113
|
-
|
|
113
|
+
G.ADD,
|
|
114
114
|
this.boundAddFeature_
|
|
115
115
|
), this.features_.removeEventListener(
|
|
116
|
-
|
|
116
|
+
G.REMOVE,
|
|
117
117
|
this.boundRemoveFeature_
|
|
118
118
|
));
|
|
119
119
|
}
|
|
@@ -127,7 +127,7 @@ class ve extends kt {
|
|
|
127
127
|
const i = (
|
|
128
128
|
/** @type {VectorLayer} */
|
|
129
129
|
this.getMap().getAllLayers().find(function(n) {
|
|
130
|
-
if (n instanceof
|
|
130
|
+
if (n instanceof ce && n.getSource() && n.getSource().hasFeature(t))
|
|
131
131
|
return n;
|
|
132
132
|
})
|
|
133
133
|
);
|
|
@@ -153,7 +153,7 @@ class ve extends kt {
|
|
|
153
153
|
*/
|
|
154
154
|
applySelectedStyle_(e) {
|
|
155
155
|
const t = C(e);
|
|
156
|
-
t in
|
|
156
|
+
t in Q || (Q[t] = e.getStyle()), e.setStyle(this.style_);
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
159
|
* @param {Feature} feature Feature
|
|
@@ -169,7 +169,7 @@ class ve extends kt {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
const i = C(e);
|
|
172
|
-
e.setStyle(
|
|
172
|
+
e.setStyle(Q[i]), delete Q[i];
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* @param {Feature} feature Feature.
|
|
@@ -189,7 +189,7 @@ class ve extends kt {
|
|
|
189
189
|
return !0;
|
|
190
190
|
const t = this.addCondition_(e), i = this.removeCondition_(e), n = this.toggleCondition_(e), s = !t && !i && !n, r = e.map, o = this.getFeatures(), a = [], h = [];
|
|
191
191
|
if (s) {
|
|
192
|
-
|
|
192
|
+
pt(this.featureLayerAssociation_), r.forEachFeatureAtPixel(
|
|
193
193
|
e.pixel,
|
|
194
194
|
/**
|
|
195
195
|
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
|
@@ -197,7 +197,7 @@ class ve extends kt {
|
|
|
197
197
|
* @return {boolean|undefined} Continue to iterate over the features.
|
|
198
198
|
*/
|
|
199
199
|
(c, u) => {
|
|
200
|
-
if (!(!(c instanceof
|
|
200
|
+
if (!(!(c instanceof M) || !this.filter_(c, u)))
|
|
201
201
|
return this.addFeatureLayerAssociation_(c, u), h.push(c), !this.multi_;
|
|
202
202
|
},
|
|
203
203
|
{
|
|
@@ -219,7 +219,7 @@ class ve extends kt {
|
|
|
219
219
|
* @return {boolean|undefined} Continue to iterate over the features.
|
|
220
220
|
*/
|
|
221
221
|
(c, u) => {
|
|
222
|
-
if (!(!(c instanceof
|
|
222
|
+
if (!(!(c instanceof M) || !this.filter_(c, u)))
|
|
223
223
|
return (t || n) && !o.getArray().includes(c) ? (this.addFeatureLayerAssociation_(c, u), h.push(c)) : (i || n) && o.getArray().includes(c) && (a.push(c), this.removeFeatureLayerAssociation_(c)), !this.multi_;
|
|
224
224
|
},
|
|
225
225
|
{
|
|
@@ -232,8 +232,8 @@ class ve extends kt {
|
|
|
232
232
|
o.extend(h);
|
|
233
233
|
}
|
|
234
234
|
return (h.length > 0 || a.length > 0) && this.dispatchEvent(
|
|
235
|
-
new
|
|
236
|
-
|
|
235
|
+
new li(
|
|
236
|
+
ai.SELECT,
|
|
237
237
|
h,
|
|
238
238
|
a,
|
|
239
239
|
e
|
|
@@ -241,13 +241,13 @@ class ve extends kt {
|
|
|
241
241
|
), !0;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
function
|
|
245
|
-
const l =
|
|
244
|
+
function hi() {
|
|
245
|
+
const l = Re();
|
|
246
246
|
return Oe(l.Polygon, l.LineString), Oe(l.GeometryCollection, l.LineString), function(e) {
|
|
247
247
|
return e.getGeometry() ? l[e.getGeometry().getType()] : null;
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
|
-
const Ne = 0,
|
|
250
|
+
const Ne = 0, B = 1, Ve = [0, 0, 0, 0], q = [], Te = {
|
|
251
251
|
/**
|
|
252
252
|
* Triggered upon feature modification start
|
|
253
253
|
* @event ModifyEvent#modifystart
|
|
@@ -261,7 +261,7 @@ const Ne = 0, H = 1, Ve = [0, 0, 0, 0], Z = [], xe = {
|
|
|
261
261
|
*/
|
|
262
262
|
MODIFYEND: "modifyend"
|
|
263
263
|
};
|
|
264
|
-
class
|
|
264
|
+
class Fe extends H {
|
|
265
265
|
/**
|
|
266
266
|
* @param {ModifyEventType} type Type.
|
|
267
267
|
* @param {Collection<Feature>} features
|
|
@@ -273,7 +273,7 @@ class Ce extends J {
|
|
|
273
273
|
super(e), this.features = t, this.mapBrowserEvent = i;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
class
|
|
276
|
+
class ci extends ke {
|
|
277
277
|
/**
|
|
278
278
|
* @param {Options} options Options.
|
|
279
279
|
*/
|
|
@@ -283,12 +283,12 @@ class hi extends Me {
|
|
|
283
283
|
e
|
|
284
284
|
), this.on, this.once, this.un, this.boundHandleFeatureChange_ = this.handleFeatureChange_.bind(this), this.condition_ = e.condition ? e.condition : Gt, this.defaultDeleteCondition_ = function(i) {
|
|
285
285
|
return vt(i) && et(i);
|
|
286
|
-
}, this.deleteCondition_ = e.deleteCondition ? e.deleteCondition : this.defaultDeleteCondition_, this.insertVertexCondition_ = e.insertVertexCondition ? e.insertVertexCondition :
|
|
287
|
-
source: new
|
|
286
|
+
}, this.deleteCondition_ = e.deleteCondition ? e.deleteCondition : this.defaultDeleteCondition_, this.insertVertexCondition_ = e.insertVertexCondition ? e.insertVertexCondition : De, this.vertexFeature_ = null, this.vertexSegments_ = null, this.lastPixel_ = [0, 0], this.ignoreNextSingleClick_ = !1, this.featuresBeingModified_ = null, this.rBush_ = new Be(), this.pixelTolerance_ = e.pixelTolerance !== void 0 ? e.pixelTolerance : 10, this.snappedToVertex_ = !1, this.changingFeature_ = !1, this.dragSegments_ = [], this.overlay_ = new ce({
|
|
287
|
+
source: new Me({
|
|
288
288
|
useSpatialIndex: !1,
|
|
289
289
|
wrapX: !!e.wrapX
|
|
290
290
|
}),
|
|
291
|
-
style: e.style ? e.style :
|
|
291
|
+
style: e.style ? e.style : di(),
|
|
292
292
|
updateWhileAnimating: !0,
|
|
293
293
|
updateWhileInteracting: !0
|
|
294
294
|
}), this.SEGMENT_WRITERS_ = {
|
|
@@ -303,21 +303,21 @@ class hi extends Me {
|
|
|
303
303
|
GeometryCollection: this.writeGeometryCollectionGeometry_.bind(this)
|
|
304
304
|
}, this.source_ = null, this.hitDetection_ = null;
|
|
305
305
|
let t;
|
|
306
|
-
if (e.features ? t = e.features : e.source && (this.source_ = e.source, t = new
|
|
307
|
-
|
|
306
|
+
if (e.features ? t = e.features : e.source && (this.source_ = e.source, t = new Pe(this.source_.getFeatures()), this.source_.addEventListener(
|
|
307
|
+
oe.ADDFEATURE,
|
|
308
308
|
this.handleSourceAdd_.bind(this)
|
|
309
309
|
), this.source_.addEventListener(
|
|
310
|
-
|
|
310
|
+
oe.REMOVEFEATURE,
|
|
311
311
|
this.handleSourceRemove_.bind(this)
|
|
312
312
|
)), !t)
|
|
313
313
|
throw new Error(
|
|
314
314
|
"The modify interaction requires features, a source or a layer"
|
|
315
315
|
);
|
|
316
316
|
e.hitDetection && (this.hitDetection_ = e.hitDetection), this.features_ = t, this.features_.forEach(this.addFeature_.bind(this)), this.features_.addEventListener(
|
|
317
|
-
|
|
317
|
+
G.ADD,
|
|
318
318
|
this.handleFeatureAdd_.bind(this)
|
|
319
319
|
), this.features_.addEventListener(
|
|
320
|
-
|
|
320
|
+
G.REMOVE,
|
|
321
321
|
this.handleFeatureRemove_.bind(this)
|
|
322
322
|
), this.lastPointerEvent_ = null, this.delta_ = [0, 0], this.snapToPointer_ = e.snapToPointer === void 0 ? !this.hitDetection_ : e.snapToPointer;
|
|
323
323
|
}
|
|
@@ -332,7 +332,7 @@ class hi extends Me {
|
|
|
332
332
|
n && n(e, t);
|
|
333
333
|
}
|
|
334
334
|
const i = this.getMap();
|
|
335
|
-
i && i.isRendered() && this.getActive() && this.handlePointerAtPixel_(this.lastPixel_, i), e.addEventListener(
|
|
335
|
+
i && i.isRendered() && this.getActive() && this.handlePointerAtPixel_(this.lastPixel_, i), e.addEventListener(W.CHANGE, this.boundHandleFeatureChange_);
|
|
336
336
|
}
|
|
337
337
|
/**
|
|
338
338
|
* @param {import("../MapBrowserEvent.js").default} evt Map browser event.
|
|
@@ -341,7 +341,7 @@ class hi extends Me {
|
|
|
341
341
|
*/
|
|
342
342
|
willModifyFeatures_(e, t) {
|
|
343
343
|
if (!this.featuresBeingModified_) {
|
|
344
|
-
this.featuresBeingModified_ = new
|
|
344
|
+
this.featuresBeingModified_ = new Pe();
|
|
345
345
|
const i = this.featuresBeingModified_.getArray();
|
|
346
346
|
for (let n = 0, s = t.length; n < s; ++n) {
|
|
347
347
|
const r = t[n];
|
|
@@ -351,8 +351,8 @@ class hi extends Me {
|
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
this.featuresBeingModified_.getLength() === 0 ? this.featuresBeingModified_ = null : this.dispatchEvent(
|
|
354
|
-
new
|
|
355
|
-
|
|
354
|
+
new Fe(
|
|
355
|
+
Te.MODIFYSTART,
|
|
356
356
|
this.featuresBeingModified_,
|
|
357
357
|
e
|
|
358
358
|
)
|
|
@@ -365,7 +365,7 @@ class hi extends Me {
|
|
|
365
365
|
*/
|
|
366
366
|
removeFeature_(e) {
|
|
367
367
|
this.removeFeatureSegmentData_(e), this.vertexFeature_ && this.features_.getLength() === 0 && (this.overlay_.getSource().removeFeature(this.vertexFeature_), this.vertexFeature_ = null), e.removeEventListener(
|
|
368
|
-
|
|
368
|
+
W.CHANGE,
|
|
369
369
|
this.boundHandleFeatureChange_
|
|
370
370
|
);
|
|
371
371
|
}
|
|
@@ -502,7 +502,7 @@ class hi extends Me {
|
|
|
502
502
|
index: n,
|
|
503
503
|
segment: r
|
|
504
504
|
};
|
|
505
|
-
this.rBush_.insert(
|
|
505
|
+
this.rBush_.insert(S(r), o);
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
/**
|
|
@@ -522,7 +522,7 @@ class hi extends Me {
|
|
|
522
522
|
index: o,
|
|
523
523
|
segment: h
|
|
524
524
|
};
|
|
525
|
-
this.rBush_.insert(
|
|
525
|
+
this.rBush_.insert(S(h), c);
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
528
|
}
|
|
@@ -543,7 +543,7 @@ class hi extends Me {
|
|
|
543
543
|
index: o,
|
|
544
544
|
segment: h
|
|
545
545
|
};
|
|
546
|
-
this.rBush_.insert(
|
|
546
|
+
this.rBush_.insert(S(h), c);
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
}
|
|
@@ -566,7 +566,7 @@ class hi extends Me {
|
|
|
566
566
|
index: c,
|
|
567
567
|
segment: g
|
|
568
568
|
};
|
|
569
|
-
this.rBush_.insert(
|
|
569
|
+
this.rBush_.insert(S(g), d);
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
}
|
|
@@ -591,10 +591,10 @@ class hi extends Me {
|
|
|
591
591
|
}, s = {
|
|
592
592
|
feature: e,
|
|
593
593
|
geometry: t,
|
|
594
|
-
index:
|
|
594
|
+
index: B,
|
|
595
595
|
segment: [i, i]
|
|
596
596
|
}, r = [n, s];
|
|
597
|
-
n.featureSegments = r, s.featureSegments = r, this.rBush_.insert(
|
|
597
|
+
n.featureSegments = r, s.featureSegments = r, this.rBush_.insert(Ce(i), n);
|
|
598
598
|
let o = (
|
|
599
599
|
/** @type {import("../geom/Geometry.js").default} */
|
|
600
600
|
t
|
|
@@ -622,7 +622,7 @@ class hi extends Me {
|
|
|
622
622
|
*/
|
|
623
623
|
createOrUpdateVertexFeature_(e, t, i) {
|
|
624
624
|
let n = this.vertexFeature_;
|
|
625
|
-
return n ? n.getGeometry().setCoordinates(e) : (n = new
|
|
625
|
+
return n ? n.getGeometry().setCoordinates(e) : (n = new M(new Y(e)), this.vertexFeature_ = n, this.overlay_.getSource().addFeature(n)), n.set("features", t), n.set("geometries", i), n;
|
|
626
626
|
}
|
|
627
627
|
/**
|
|
628
628
|
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may modify the geometry.
|
|
@@ -634,7 +634,7 @@ class hi extends Me {
|
|
|
634
634
|
return !0;
|
|
635
635
|
this.lastPointerEvent_ = e;
|
|
636
636
|
let t;
|
|
637
|
-
return !e.map.getView().getInteracting() && e.type ==
|
|
637
|
+
return !e.map.getView().getInteracting() && e.type == P.POINTERMOVE && !this.handlingDownUpSequence && this.handlePointerMove_(e), this.vertexFeature_ && this.deleteCondition_(e) && (e.type != P.SINGLECLICK || !this.ignoreNextSingleClick_ ? t = this.removePoint() : t = !0), e.type == P.SINGLECLICK && (this.ignoreNextSingleClick_ = !1), super.handleEvent(e) && !t;
|
|
638
638
|
}
|
|
639
639
|
/**
|
|
640
640
|
* Handle pointer drag events.
|
|
@@ -680,11 +680,11 @@ class hi extends Me {
|
|
|
680
680
|
this.changingFeature_ = !0, c.setCenter(t), this.changingFeature_ = !1;
|
|
681
681
|
else {
|
|
682
682
|
this.changingFeature_ = !0, e.map.getView().getProjection();
|
|
683
|
-
let
|
|
684
|
-
|
|
685
|
-
|
|
683
|
+
let m = le(
|
|
684
|
+
F(c.getCenter()),
|
|
685
|
+
F(t)
|
|
686
686
|
);
|
|
687
|
-
c.setRadius(
|
|
687
|
+
c.setRadius(m), this.changingFeature_ = !1;
|
|
688
688
|
}
|
|
689
689
|
break;
|
|
690
690
|
}
|
|
@@ -705,35 +705,35 @@ class hi extends Me {
|
|
|
705
705
|
const i = this.vertexFeature_;
|
|
706
706
|
if (i) {
|
|
707
707
|
e.map.getView().getProjection();
|
|
708
|
-
const n = [], s = i.getGeometry().getCoordinates(), r =
|
|
709
|
-
o.sort(
|
|
708
|
+
const n = [], s = i.getGeometry().getCoordinates(), r = S([s]), o = this.rBush_.getInExtent(r), a = {};
|
|
709
|
+
o.sort(ui);
|
|
710
710
|
for (let h = 0, c = o.length; h < c; ++h) {
|
|
711
711
|
const u = o[h], g = u.segment;
|
|
712
712
|
let d = C(u.geometry);
|
|
713
713
|
const f = u.depth;
|
|
714
|
-
if (f && (d += "-" + f.join("-")), a[d] || (a[d] = new Array(2)), u.geometry.getType() === "Circle" && u.index ===
|
|
715
|
-
const
|
|
714
|
+
if (f && (d += "-" + f.join("-")), a[d] || (a[d] = new Array(2)), u.geometry.getType() === "Circle" && u.index === B) {
|
|
715
|
+
const m = Xe(
|
|
716
716
|
t,
|
|
717
717
|
u
|
|
718
718
|
);
|
|
719
|
-
|
|
719
|
+
v(m, s) && !a[d][0] && (this.dragSegments_.push([u, 0]), a[d][0] = u);
|
|
720
720
|
continue;
|
|
721
721
|
}
|
|
722
|
-
if (
|
|
722
|
+
if (v(g[0], s) && !a[d][0]) {
|
|
723
723
|
this.dragSegments_.push([u, 0]), a[d][0] = u;
|
|
724
724
|
continue;
|
|
725
725
|
}
|
|
726
|
-
if (
|
|
726
|
+
if (v(g[1], s) && !a[d][1]) {
|
|
727
727
|
if (a[d][0] && a[d][0].index === 0) {
|
|
728
|
-
let
|
|
728
|
+
let m = u.geometry.getCoordinates();
|
|
729
729
|
switch (u.geometry.getType()) {
|
|
730
730
|
case "LineString":
|
|
731
731
|
case "MultiLineString":
|
|
732
732
|
continue;
|
|
733
733
|
case "MultiPolygon":
|
|
734
|
-
|
|
734
|
+
m = m[f[1]];
|
|
735
735
|
case "Polygon":
|
|
736
|
-
if (u.index !==
|
|
736
|
+
if (u.index !== m[f[0]].length - 2)
|
|
737
737
|
continue;
|
|
738
738
|
break;
|
|
739
739
|
}
|
|
@@ -759,18 +759,18 @@ class hi extends Me {
|
|
|
759
759
|
const i = this.dragSegments_[t][0], n = i.geometry;
|
|
760
760
|
if (n.getType() === "Circle") {
|
|
761
761
|
const s = n.getCenter(), r = i.featureSegments[0], o = i.featureSegments[1];
|
|
762
|
-
r.segment[0] = s, r.segment[1] = s, o.segment[0] = s, o.segment[1] = s, this.rBush_.update(
|
|
762
|
+
r.segment[0] = s, r.segment[1] = s, o.segment[0] = s, o.segment[1] = s, this.rBush_.update(Ce(s), r);
|
|
763
763
|
let a = n;
|
|
764
764
|
this.rBush_.update(
|
|
765
765
|
a.getExtent(),
|
|
766
766
|
o
|
|
767
767
|
);
|
|
768
768
|
} else
|
|
769
|
-
this.rBush_.update(
|
|
769
|
+
this.rBush_.update(S(i.segment), i);
|
|
770
770
|
}
|
|
771
771
|
return this.featuresBeingModified_ && (this.dispatchEvent(
|
|
772
|
-
new
|
|
773
|
-
|
|
772
|
+
new Fe(
|
|
773
|
+
Te.MODIFYEND,
|
|
774
774
|
this.featuresBeingModified_,
|
|
775
775
|
e
|
|
776
776
|
)
|
|
@@ -793,7 +793,7 @@ class hi extends Me {
|
|
|
793
793
|
const n = i || t.getCoordinateFromPixel(e);
|
|
794
794
|
t.getView().getProjection();
|
|
795
795
|
const s = function(a, h) {
|
|
796
|
-
return
|
|
796
|
+
return qe(n, a) - qe(n, h);
|
|
797
797
|
};
|
|
798
798
|
let r, o;
|
|
799
799
|
if (this.hitDetection_) {
|
|
@@ -801,11 +801,11 @@ class hi extends Me {
|
|
|
801
801
|
t.forEachFeatureAtPixel(
|
|
802
802
|
e,
|
|
803
803
|
(h, c, u) => {
|
|
804
|
-
u && (u = new
|
|
805
|
-
|
|
804
|
+
u && (u = new Y(
|
|
805
|
+
he(u.getCoordinates())
|
|
806
806
|
));
|
|
807
807
|
const g = u || h.getGeometry();
|
|
808
|
-
if (g.getType() === "Point" && h instanceof
|
|
808
|
+
if (g.getType() === "Point" && h instanceof M && this.features_.getArray().includes(h)) {
|
|
809
809
|
o = /** @type {Point} */
|
|
810
810
|
g;
|
|
811
811
|
const d = (
|
|
@@ -826,8 +826,8 @@ class hi extends Me {
|
|
|
826
826
|
);
|
|
827
827
|
}
|
|
828
828
|
if (!r) {
|
|
829
|
-
const a =
|
|
830
|
-
|
|
829
|
+
const a = Yt(
|
|
830
|
+
Ce(n, Ve)
|
|
831
831
|
), h = t.getView().getResolution() * this.pixelTolerance_, c = it(
|
|
832
832
|
nt(a, h, Ve)
|
|
833
833
|
);
|
|
@@ -835,31 +835,31 @@ class hi extends Me {
|
|
|
835
835
|
}
|
|
836
836
|
if (r && r.length > 0) {
|
|
837
837
|
const a = r.sort(s)[0], h = a.segment;
|
|
838
|
-
let c =
|
|
838
|
+
let c = Xe(n, a);
|
|
839
839
|
const u = t.getPixelFromCoordinate(c);
|
|
840
|
-
let g =
|
|
840
|
+
let g = le(e, u);
|
|
841
841
|
if (o || g <= this.pixelTolerance_) {
|
|
842
842
|
const d = {};
|
|
843
|
-
if (d[C(h)] = !0, this.snapToPointer_ || (this.delta_[0] = c[0] - n[0], this.delta_[1] = c[1] - n[1]), a.geometry.getType() === "Circle" && a.index ===
|
|
843
|
+
if (d[C(h)] = !0, this.snapToPointer_ || (this.delta_[0] = c[0] - n[0], this.delta_[1] = c[1] - n[1]), a.geometry.getType() === "Circle" && a.index === B)
|
|
844
844
|
this.snappedToVertex_ = !0, this.createOrUpdateVertexFeature_(
|
|
845
845
|
c,
|
|
846
846
|
[a.feature],
|
|
847
847
|
[a.geometry]
|
|
848
848
|
);
|
|
849
849
|
else {
|
|
850
|
-
const f = t.getPixelFromCoordinate(h[0]),
|
|
850
|
+
const f = t.getPixelFromCoordinate(h[0]), m = t.getPixelFromCoordinate(h[1]), x = I(u, f), T = I(u, m);
|
|
851
851
|
g = Math.sqrt(Math.min(x, T)), this.snappedToVertex_ = g <= this.pixelTolerance_, this.snappedToVertex_ && (c = x > T ? h[1] : h[0]), this.createOrUpdateVertexFeature_(
|
|
852
852
|
c,
|
|
853
853
|
[a.feature],
|
|
854
854
|
[a.geometry]
|
|
855
855
|
);
|
|
856
|
-
const
|
|
857
|
-
|
|
858
|
-
for (let
|
|
859
|
-
const k = r[
|
|
860
|
-
if (
|
|
861
|
-
const
|
|
862
|
-
|
|
856
|
+
const p = {};
|
|
857
|
+
p[C(a.geometry)] = !0;
|
|
858
|
+
for (let w = 1, de = r.length; w < de; ++w) {
|
|
859
|
+
const k = r[w].segment;
|
|
860
|
+
if (v(h[0], k[0]) && v(h[1], k[1]) || v(h[0], k[1]) && v(h[1], k[0])) {
|
|
861
|
+
const j = C(r[w].geometry);
|
|
862
|
+
j in p || (p[j] = !0, d[C(k)] = !0);
|
|
863
863
|
} else
|
|
864
864
|
break;
|
|
865
865
|
}
|
|
@@ -906,7 +906,7 @@ class hi extends Me {
|
|
|
906
906
|
depth: r,
|
|
907
907
|
index: o
|
|
908
908
|
};
|
|
909
|
-
h.insert(
|
|
909
|
+
h.insert(S(c.segment), c), this.dragSegments_.push([c, 1]);
|
|
910
910
|
const u = {
|
|
911
911
|
segment: [t, i[1]],
|
|
912
912
|
feature: n,
|
|
@@ -914,7 +914,7 @@ class hi extends Me {
|
|
|
914
914
|
depth: r,
|
|
915
915
|
index: o + 1
|
|
916
916
|
};
|
|
917
|
-
h.insert(
|
|
917
|
+
h.insert(S(u.segment), u), this.dragSegments_.push([u, 0]), this.ignoreNextSingleClick_ = !0;
|
|
918
918
|
}
|
|
919
919
|
/**
|
|
920
920
|
* Removes the vertex currently being pointed.
|
|
@@ -922,13 +922,13 @@ class hi extends Me {
|
|
|
922
922
|
* @api
|
|
923
923
|
*/
|
|
924
924
|
removePoint() {
|
|
925
|
-
if (this.lastPointerEvent_ && this.lastPointerEvent_.type !=
|
|
925
|
+
if (this.lastPointerEvent_ && this.lastPointerEvent_.type != P.POINTERDRAG) {
|
|
926
926
|
const e = this.lastPointerEvent_;
|
|
927
927
|
this.willModifyFeatures_(e, this.dragSegments_);
|
|
928
928
|
const t = this.removeVertex_();
|
|
929
929
|
return this.featuresBeingModified_ && this.dispatchEvent(
|
|
930
|
-
new
|
|
931
|
-
|
|
930
|
+
new Fe(
|
|
931
|
+
Te.MODIFYEND,
|
|
932
932
|
this.featuresBeingModified_,
|
|
933
933
|
e
|
|
934
934
|
)
|
|
@@ -962,17 +962,17 @@ class hi extends Me {
|
|
|
962
962
|
}
|
|
963
963
|
if (i) {
|
|
964
964
|
this.setGeometryCoordinates_(o, s);
|
|
965
|
-
const
|
|
966
|
-
if (c !== void 0 && (this.rBush_.remove(c),
|
|
965
|
+
const m = [];
|
|
966
|
+
if (c !== void 0 && (this.rBush_.remove(c), m.push(c.segment[0])), g !== void 0 && (this.rBush_.remove(g), m.push(g.segment[1])), c !== void 0 && g !== void 0) {
|
|
967
967
|
const x = {
|
|
968
968
|
depth: d.depth,
|
|
969
969
|
feature: d.feature,
|
|
970
970
|
geometry: d.geometry,
|
|
971
971
|
index: u,
|
|
972
|
-
segment:
|
|
972
|
+
segment: m
|
|
973
973
|
};
|
|
974
974
|
this.rBush_.insert(
|
|
975
|
-
|
|
975
|
+
S(x.segment),
|
|
976
976
|
x
|
|
977
977
|
);
|
|
978
978
|
}
|
|
@@ -1000,53 +1000,53 @@ class hi extends Me {
|
|
|
1000
1000
|
this.rBush_.forEachInExtent(
|
|
1001
1001
|
e.getExtent(),
|
|
1002
1002
|
function(s) {
|
|
1003
|
-
s.geometry === e && (i === void 0 || s.depth === void 0 ||
|
|
1003
|
+
s.geometry === e && (i === void 0 || s.depth === void 0 || Et(s.depth, i)) && s.index > t && (s.index += n);
|
|
1004
1004
|
}
|
|
1005
1005
|
);
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1008
|
+
function ui(l, e) {
|
|
1009
1009
|
return l.index - e.index;
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1011
|
+
function qe(l, e, t) {
|
|
1012
1012
|
const i = e.geometry;
|
|
1013
1013
|
if (i.getType() === "Circle") {
|
|
1014
1014
|
let s = (
|
|
1015
1015
|
/** @type {import("../geom/Circle.js").default} */
|
|
1016
1016
|
i
|
|
1017
1017
|
);
|
|
1018
|
-
if (e.index ===
|
|
1019
|
-
const r =
|
|
1018
|
+
if (e.index === B) {
|
|
1019
|
+
const r = I(
|
|
1020
1020
|
s.getCenter(),
|
|
1021
|
-
|
|
1021
|
+
F(l)
|
|
1022
1022
|
), o = Math.sqrt(r) - s.getRadius();
|
|
1023
1023
|
return o * o;
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
|
-
const n =
|
|
1027
|
-
return
|
|
1026
|
+
const n = F(l);
|
|
1027
|
+
return q[0] = F(e.segment[0]), q[1] = F(e.segment[1]), Bt(n, q);
|
|
1028
1028
|
}
|
|
1029
|
-
function
|
|
1029
|
+
function Xe(l, e, t) {
|
|
1030
1030
|
const i = e.geometry;
|
|
1031
|
-
if (i.getType() === "Circle" && e.index ===
|
|
1032
|
-
return
|
|
1031
|
+
if (i.getType() === "Circle" && e.index === B)
|
|
1032
|
+
return he(
|
|
1033
1033
|
/** @type {import("../geom/Circle.js").default} */
|
|
1034
1034
|
i.getClosestPoint(
|
|
1035
|
-
|
|
1035
|
+
F(l)
|
|
1036
1036
|
)
|
|
1037
1037
|
);
|
|
1038
|
-
const n =
|
|
1039
|
-
return
|
|
1040
|
-
st(n,
|
|
1038
|
+
const n = F(l);
|
|
1039
|
+
return q[0] = F(e.segment[0]), q[1] = F(e.segment[1]), he(
|
|
1040
|
+
st(n, q)
|
|
1041
1041
|
);
|
|
1042
1042
|
}
|
|
1043
|
-
function
|
|
1044
|
-
const l =
|
|
1043
|
+
function di() {
|
|
1044
|
+
const l = Re();
|
|
1045
1045
|
return function(e, t) {
|
|
1046
1046
|
return l.Point;
|
|
1047
1047
|
};
|
|
1048
1048
|
}
|
|
1049
|
-
const
|
|
1049
|
+
const ee = {
|
|
1050
1050
|
/**
|
|
1051
1051
|
* Triggered upon feature draw start
|
|
1052
1052
|
* @event DrawEvent#drawstart
|
|
@@ -1066,7 +1066,7 @@ const ne = {
|
|
|
1066
1066
|
*/
|
|
1067
1067
|
DRAWABORT: "drawabort"
|
|
1068
1068
|
};
|
|
1069
|
-
class
|
|
1069
|
+
class te extends H {
|
|
1070
1070
|
/**
|
|
1071
1071
|
* @param {DrawEventType} type Type.
|
|
1072
1072
|
* @param {Feature} feature The feature drawn.
|
|
@@ -1075,7 +1075,7 @@ class se extends J {
|
|
|
1075
1075
|
super(e), this.feature = t;
|
|
1076
1076
|
}
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function gi(l, e) {
|
|
1079
1079
|
const t = [];
|
|
1080
1080
|
for (let i = 0; i < e.length; ++i) {
|
|
1081
1081
|
const s = e[i].getGeometry();
|
|
@@ -1083,51 +1083,51 @@ function di(l, e) {
|
|
|
1083
1083
|
}
|
|
1084
1084
|
return t;
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1086
|
+
function ie(l, e) {
|
|
1087
1087
|
return He(l[0], l[1], e[0], e[1]);
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1089
|
+
function N(l, e) {
|
|
1090
1090
|
const t = l.length;
|
|
1091
1091
|
return e < 0 ? l[e + t] : e >= t ? l[e - t] : l[e];
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function ne(l, e, t) {
|
|
1094
1094
|
let i, n;
|
|
1095
1095
|
e < t ? (i = e, n = t) : (i = t, n = e);
|
|
1096
1096
|
const s = Math.ceil(i), r = Math.floor(n);
|
|
1097
1097
|
if (s > r) {
|
|
1098
|
-
const a =
|
|
1099
|
-
return
|
|
1098
|
+
const a = V(l, i), h = V(l, n);
|
|
1099
|
+
return ie(a, h);
|
|
1100
1100
|
}
|
|
1101
1101
|
let o = 0;
|
|
1102
1102
|
if (i < s) {
|
|
1103
|
-
const a =
|
|
1104
|
-
o +=
|
|
1103
|
+
const a = V(l, i), h = N(l, s);
|
|
1104
|
+
o += ie(a, h);
|
|
1105
1105
|
}
|
|
1106
1106
|
if (r < n) {
|
|
1107
|
-
const a =
|
|
1108
|
-
o +=
|
|
1107
|
+
const a = N(l, r), h = V(l, n);
|
|
1108
|
+
o += ie(a, h);
|
|
1109
1109
|
}
|
|
1110
1110
|
for (let a = s; a < r - 1; ++a) {
|
|
1111
|
-
const h =
|
|
1112
|
-
o +=
|
|
1111
|
+
const h = N(l, a), c = N(l, a + 1);
|
|
1112
|
+
o += ie(h, c);
|
|
1113
1113
|
}
|
|
1114
1114
|
return o;
|
|
1115
1115
|
}
|
|
1116
1116
|
function ht(l, e, t) {
|
|
1117
|
-
if (e instanceof
|
|
1118
|
-
|
|
1117
|
+
if (e instanceof re) {
|
|
1118
|
+
se(l, e.getCoordinates(), !1, t);
|
|
1119
1119
|
return;
|
|
1120
1120
|
}
|
|
1121
1121
|
if (e instanceof Je) {
|
|
1122
1122
|
const i = e.getCoordinates();
|
|
1123
1123
|
for (let n = 0, s = i.length; n < s; ++n)
|
|
1124
|
-
|
|
1124
|
+
se(l, i[n], !1, t);
|
|
1125
1125
|
return;
|
|
1126
1126
|
}
|
|
1127
1127
|
if (e instanceof rt) {
|
|
1128
1128
|
const i = e.getCoordinates();
|
|
1129
1129
|
for (let n = 0, s = i.length; n < s; ++n)
|
|
1130
|
-
|
|
1130
|
+
se(l, i[n], !0, t);
|
|
1131
1131
|
return;
|
|
1132
1132
|
}
|
|
1133
1133
|
if (e instanceof Qe) {
|
|
@@ -1135,68 +1135,68 @@ function ht(l, e, t) {
|
|
|
1135
1135
|
for (let n = 0, s = i.length; n < s; ++n) {
|
|
1136
1136
|
const r = i[n];
|
|
1137
1137
|
for (let o = 0, a = r.length; o < a; ++o)
|
|
1138
|
-
|
|
1138
|
+
se(l, r[o], !0, t);
|
|
1139
1139
|
}
|
|
1140
1140
|
return;
|
|
1141
1141
|
}
|
|
1142
|
-
if (e instanceof
|
|
1142
|
+
if (e instanceof kt) {
|
|
1143
1143
|
const i = e.getGeometries();
|
|
1144
1144
|
for (let n = 0; n < i.length; ++n)
|
|
1145
1145
|
ht(l, i[n], t);
|
|
1146
1146
|
return;
|
|
1147
1147
|
}
|
|
1148
1148
|
}
|
|
1149
|
-
const
|
|
1150
|
-
function
|
|
1149
|
+
const pe = { index: -1, endIndex: NaN };
|
|
1150
|
+
function fi(l, e, t, i) {
|
|
1151
1151
|
const n = l[0], s = l[1];
|
|
1152
1152
|
let r = 1 / 0, o = -1, a = NaN;
|
|
1153
1153
|
for (let u = 0; u < e.targets.length; ++u) {
|
|
1154
1154
|
const g = e.targets[u], d = g.coordinates;
|
|
1155
|
-
let f = 1 / 0,
|
|
1155
|
+
let f = 1 / 0, m;
|
|
1156
1156
|
for (let x = 0; x < d.length - 1; ++x) {
|
|
1157
|
-
const T = d[x],
|
|
1158
|
-
|
|
1157
|
+
const T = d[x], p = d[x + 1], w = ct(n, s, T, p);
|
|
1158
|
+
w.squaredDistance < f && (f = w.squaredDistance, m = x + w.along);
|
|
1159
1159
|
}
|
|
1160
|
-
f < r && (r = f, g.ring && e.targetIndex === u && (g.endIndex > g.startIndex ?
|
|
1160
|
+
f < r && (r = f, g.ring && e.targetIndex === u && (g.endIndex > g.startIndex ? m < g.startIndex && (m += d.length) : g.endIndex < g.startIndex && m > g.startIndex && (m -= d.length)), a = m, o = u);
|
|
1161
1161
|
}
|
|
1162
1162
|
const h = e.targets[o];
|
|
1163
1163
|
let c = h.ring;
|
|
1164
1164
|
if (e.targetIndex === o && c) {
|
|
1165
|
-
const u =
|
|
1165
|
+
const u = V(
|
|
1166
1166
|
h.coordinates,
|
|
1167
1167
|
a
|
|
1168
1168
|
), g = t.getPixelFromCoordinate(u);
|
|
1169
|
-
|
|
1169
|
+
le(g, e.startPx) > i && (c = !1);
|
|
1170
1170
|
}
|
|
1171
1171
|
if (c) {
|
|
1172
1172
|
const u = h.coordinates, g = u.length, d = h.startIndex, f = a;
|
|
1173
1173
|
if (d < f) {
|
|
1174
|
-
const
|
|
1174
|
+
const m = ne(
|
|
1175
1175
|
u,
|
|
1176
1176
|
d,
|
|
1177
1177
|
f
|
|
1178
1178
|
);
|
|
1179
|
-
|
|
1179
|
+
ne(
|
|
1180
1180
|
u,
|
|
1181
1181
|
d,
|
|
1182
1182
|
f - g
|
|
1183
|
-
) <
|
|
1183
|
+
) < m && (a -= g);
|
|
1184
1184
|
} else {
|
|
1185
|
-
const
|
|
1185
|
+
const m = ne(
|
|
1186
1186
|
u,
|
|
1187
1187
|
d,
|
|
1188
1188
|
f
|
|
1189
1189
|
);
|
|
1190
|
-
|
|
1190
|
+
ne(
|
|
1191
1191
|
u,
|
|
1192
1192
|
d,
|
|
1193
1193
|
f + g
|
|
1194
|
-
) <
|
|
1194
|
+
) < m && (a += g);
|
|
1195
1195
|
}
|
|
1196
1196
|
}
|
|
1197
|
-
return
|
|
1197
|
+
return pe.index = o, pe.endIndex = a, pe;
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1199
|
+
function se(l, e, t, i) {
|
|
1200
1200
|
const n = l[0], s = l[1];
|
|
1201
1201
|
for (let r = 0, o = e.length - 1; r < o; ++r) {
|
|
1202
1202
|
const a = e[r], h = e[r + 1], c = ct(n, s, a, h);
|
|
@@ -1212,13 +1212,13 @@ function ae(l, e, t, i) {
|
|
|
1212
1212
|
}
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
-
const
|
|
1215
|
+
const Ee = { along: 0, squaredDistance: 0 };
|
|
1216
1216
|
function ct(l, e, t, i) {
|
|
1217
1217
|
const n = t[0], s = t[1], r = i[0], o = i[1], a = r - n, h = o - s;
|
|
1218
1218
|
let c = 0, u = n, g = s;
|
|
1219
|
-
return (a !== 0 || h !== 0) && (c = $e(((l - n) * a + (e - s) * h) / (a * a + h * h), 0, 1), u += a * c, g += h * c),
|
|
1219
|
+
return (a !== 0 || h !== 0) && (c = $e(((l - n) * a + (e - s) * h) / (a * a + h * h), 0, 1), u += a * c, g += h * c), Ee.along = c, Ee.squaredDistance = St(He(l, e, u, g), 10), Ee;
|
|
1220
1220
|
}
|
|
1221
|
-
function
|
|
1221
|
+
function V(l, e) {
|
|
1222
1222
|
const t = l.length;
|
|
1223
1223
|
let i = Math.floor(e);
|
|
1224
1224
|
const n = e - i;
|
|
@@ -1228,7 +1228,7 @@ function X(l, e) {
|
|
|
1228
1228
|
const r = l[i], o = r[0], a = r[1], h = l[s], c = h[0] - o, u = h[1] - a;
|
|
1229
1229
|
return [o + c * n, a + u * n];
|
|
1230
1230
|
}
|
|
1231
|
-
class
|
|
1231
|
+
class _i extends ke {
|
|
1232
1232
|
/**
|
|
1233
1233
|
* @param {Options} options Options.
|
|
1234
1234
|
*/
|
|
@@ -1238,15 +1238,15 @@ class fi extends Me {
|
|
|
1238
1238
|
e
|
|
1239
1239
|
);
|
|
1240
1240
|
t.stopDown || (t.stopDown = We), super(t), this.on, this.once, this.un, this.shouldHandle_ = !1, this.downPx_ = null, this.downTimeout_, this.lastDragTime_, this.pointerType_, this.freehand_ = !1, this.source_ = e.source ? e.source : null, this.features_ = e.features ? e.features : null, this.snapTolerance_ = e.snapTolerance ? e.snapTolerance : 12, this.type_ = /** @type {import("../geom/Geometry.js").Type} */
|
|
1241
|
-
e.type, this.mode_ =
|
|
1241
|
+
e.type, this.mode_ = yi(this.type_), this.stopClick_ = !!e.stopClick, this.minPoints_ = e.minPoints ? e.minPoints : this.mode_ === "Polygon" ? 3 : 2, this.maxPoints_ = this.mode_ === "Circle" ? 2 : e.maxPoints ? e.maxPoints : 1 / 0, this.finishCondition_ = e.finishCondition ? e.finishCondition : ae, this.geometryLayout_ = e.geometryLayout ? e.geometryLayout : "XY";
|
|
1242
1242
|
let i = e.geometryFunction;
|
|
1243
1243
|
if (!i) {
|
|
1244
1244
|
const n = this.mode_;
|
|
1245
1245
|
if (n === "Circle")
|
|
1246
1246
|
i = function(s, r, o) {
|
|
1247
|
-
const a = r || new
|
|
1247
|
+
const a = r || new At([NaN, NaN]), h = F(s[0]), c = I(
|
|
1248
1248
|
h,
|
|
1249
|
-
|
|
1249
|
+
F(s[s.length - 1])
|
|
1250
1250
|
);
|
|
1251
1251
|
return a.setCenterAndRadius(
|
|
1252
1252
|
h,
|
|
@@ -1256,7 +1256,7 @@ class fi extends Me {
|
|
|
1256
1256
|
};
|
|
1257
1257
|
else {
|
|
1258
1258
|
let s;
|
|
1259
|
-
n === "Point" ? s =
|
|
1259
|
+
n === "Point" ? s = Y : n === "LineString" ? s = re : n === "Polygon" && (s = rt), i = function(r, o, a) {
|
|
1260
1260
|
return o ? n === "Polygon" ? r[0].length ? o.setCoordinates(
|
|
1261
1261
|
[r[0].concat([r[0][0]])],
|
|
1262
1262
|
this.geometryLayout_
|
|
@@ -1264,14 +1264,14 @@ class fi extends Me {
|
|
|
1264
1264
|
};
|
|
1265
1265
|
}
|
|
1266
1266
|
}
|
|
1267
|
-
this.geometryFunction_ = i, this.dragVertexDelay_ = e.dragVertexDelay !== void 0 ? e.dragVertexDelay : 500, this.finishCoordinate_ = null, this.sketchFeature_ = null, this.sketchPoint_ = null, this.sketchCoords_ = null, this.sketchLine_ = null, this.sketchLineCoords_ = null, this.squaredClickTolerance_ = e.clickTolerance ? e.clickTolerance * e.clickTolerance : 36, this.overlay_ = new
|
|
1268
|
-
source: new
|
|
1267
|
+
this.geometryFunction_ = i, this.dragVertexDelay_ = e.dragVertexDelay !== void 0 ? e.dragVertexDelay : 500, this.finishCoordinate_ = null, this.sketchFeature_ = null, this.sketchPoint_ = null, this.sketchCoords_ = null, this.sketchLine_ = null, this.sketchLineCoords_ = null, this.squaredClickTolerance_ = e.clickTolerance ? e.clickTolerance * e.clickTolerance : 36, this.overlay_ = new ce({
|
|
1268
|
+
source: new Me({
|
|
1269
1269
|
useSpatialIndex: !1,
|
|
1270
1270
|
wrapX: e.wrapX ? e.wrapX : !1
|
|
1271
1271
|
}),
|
|
1272
|
-
style: e.style ? e.style :
|
|
1272
|
+
style: e.style ? e.style : mi(),
|
|
1273
1273
|
updateWhileInteracting: !0
|
|
1274
|
-
}), this.geometryName_ = e.geometryName, this.condition_ = e.condition ? e.condition :
|
|
1274
|
+
}), this.geometryName_ = e.geometryName, this.condition_ = e.condition ? e.condition : bt, this.freehandCondition_, e.freehand ? this.freehandCondition_ = De : this.freehandCondition_ = e.freehandCondition ? e.freehandCondition : tt, this.traceCondition_, this.setTrace(e.trace || !1), this.traceState_ = { active: !1 }, this.traceSource_ = e.traceSource || e.source || null, this.addChangeListener(It.ACTIVE, this.updateState_);
|
|
1275
1275
|
}
|
|
1276
1276
|
/**
|
|
1277
1277
|
* Toggle tracing mode or set a tracing condition.
|
|
@@ -1281,7 +1281,7 @@ class fi extends Me {
|
|
|
1281
1281
|
*/
|
|
1282
1282
|
setTrace(e) {
|
|
1283
1283
|
let t;
|
|
1284
|
-
e ? e === !0 ? t =
|
|
1284
|
+
e ? e === !0 ? t = De : t = e : t = Le, this.traceCondition_ = t;
|
|
1285
1285
|
}
|
|
1286
1286
|
/**
|
|
1287
1287
|
* Remove the interaction from its current map and attach it to the new map.
|
|
@@ -1307,9 +1307,9 @@ class fi extends Me {
|
|
|
1307
1307
|
* @api
|
|
1308
1308
|
*/
|
|
1309
1309
|
handleEvent(e) {
|
|
1310
|
-
e.originalEvent.type ===
|
|
1311
|
-
let t = e.type ===
|
|
1312
|
-
return !this.freehand_ && this.lastDragTime_ && e.type ===
|
|
1310
|
+
e.originalEvent.type === W.CONTEXTMENU && e.originalEvent.preventDefault(), this.freehand_ = this.mode_ !== "Point" && this.freehandCondition_(e);
|
|
1311
|
+
let t = e.type === P.POINTERMOVE, i = !0;
|
|
1312
|
+
return !this.freehand_ && this.lastDragTime_ && e.type === P.POINTERDRAG && (Date.now() - this.lastDragTime_ >= this.dragVertexDelay_ ? (this.downPx_ = e.pixel, this.shouldHandle_ = !this.freehand_, t = !0) : this.lastDragTime_ = void 0, this.shouldHandle_ && this.downTimeout_ !== void 0 && (clearTimeout(this.downTimeout_), this.downTimeout_ = void 0)), this.freehand_ && e.type === P.POINTERDRAG && this.sketchFeature_ !== null ? (this.addToDrawing_(e.coordinate), i = !1) : this.freehand_ && e.type === P.POINTERDOWN ? i = !1 : t && this.getPointerCount() < 2 ? (i = e.type === P.POINTERMOVE, i && this.freehand_ ? (this.handlePointerMove_(e), this.shouldHandle_ && e.originalEvent.preventDefault()) : (e.originalEvent.pointerType === "mouse" || e.type === P.POINTERDRAG && this.downTimeout_ === void 0) && this.handlePointerMove_(e)) : e.type === P.DBLCLICK && (i = !1), super.handleEvent(e) && i;
|
|
1313
1313
|
}
|
|
1314
1314
|
/**
|
|
1315
1315
|
* Handle pointer down events.
|
|
@@ -1319,8 +1319,8 @@ class fi extends Me {
|
|
|
1319
1319
|
handleDownEvent(e) {
|
|
1320
1320
|
return this.shouldHandle_ = !this.freehand_, this.freehand_ ? (this.downPx_ = e.pixel, this.finishCoordinate_ || this.startDrawing_(e.coordinate), !0) : this.condition_(e) ? (this.lastDragTime_ = Date.now(), this.downTimeout_ = setTimeout(() => {
|
|
1321
1321
|
this.handlePointerMove_(
|
|
1322
|
-
new
|
|
1323
|
-
|
|
1322
|
+
new jt(
|
|
1323
|
+
P.POINTERMOVE,
|
|
1324
1324
|
e.map,
|
|
1325
1325
|
e.originalEvent,
|
|
1326
1326
|
!1,
|
|
@@ -1353,10 +1353,10 @@ class fi extends Me {
|
|
|
1353
1353
|
]), n = t.getCoordinateFromPixel([
|
|
1354
1354
|
e.pixel[0] + this.snapTolerance_,
|
|
1355
1355
|
e.pixel[1] - this.snapTolerance_
|
|
1356
|
-
]), s =
|
|
1356
|
+
]), s = S([i, n]), r = this.traceSource_.getFeaturesInExtent(s);
|
|
1357
1357
|
if (r.length === 0)
|
|
1358
1358
|
return;
|
|
1359
|
-
const o =
|
|
1359
|
+
const o = gi(e.coordinate, r);
|
|
1360
1360
|
o.length && (this.traceState_ = {
|
|
1361
1361
|
active: !0,
|
|
1362
1362
|
startPx: e.pixel.slice(),
|
|
@@ -1408,13 +1408,13 @@ class fi extends Me {
|
|
|
1408
1408
|
let r = Math.floor(i);
|
|
1409
1409
|
r === i && (r -= 1);
|
|
1410
1410
|
for (let o = s; o <= r; ++o)
|
|
1411
|
-
n.push(
|
|
1411
|
+
n.push(N(e.coordinates, o));
|
|
1412
1412
|
} else {
|
|
1413
1413
|
const s = Math.floor(t);
|
|
1414
1414
|
let r = Math.ceil(i);
|
|
1415
1415
|
r === i && (r += 1);
|
|
1416
1416
|
for (let o = s; o >= r; --o)
|
|
1417
|
-
n.push(
|
|
1417
|
+
n.push(N(e.coordinates, o));
|
|
1418
1418
|
}
|
|
1419
1419
|
n.length && this.appendCoordinates(n);
|
|
1420
1420
|
}
|
|
@@ -1425,9 +1425,9 @@ class fi extends Me {
|
|
|
1425
1425
|
*/
|
|
1426
1426
|
updateTrace_(e) {
|
|
1427
1427
|
const t = this.traceState_;
|
|
1428
|
-
if (!t.active || t.targetIndex === -1 &&
|
|
1428
|
+
if (!t.active || t.targetIndex === -1 && le(t.startPx, e.pixel) < this.snapTolerance_)
|
|
1429
1429
|
return;
|
|
1430
|
-
const i =
|
|
1430
|
+
const i = fi(
|
|
1431
1431
|
e.coordinate,
|
|
1432
1432
|
t,
|
|
1433
1433
|
this.getMap(),
|
|
@@ -1451,7 +1451,7 @@ class fi extends Me {
|
|
|
1451
1451
|
t.targetIndex = i.index;
|
|
1452
1452
|
const n = t.targets[t.targetIndex];
|
|
1453
1453
|
n.endIndex = i.endIndex;
|
|
1454
|
-
const s =
|
|
1454
|
+
const s = V(
|
|
1455
1455
|
n.coordinates,
|
|
1456
1456
|
n.endIndex
|
|
1457
1457
|
), r = this.getMap().getPixelFromCoordinate(s);
|
|
@@ -1540,20 +1540,20 @@ class fi extends Me {
|
|
|
1540
1540
|
* @private
|
|
1541
1541
|
*/
|
|
1542
1542
|
createOrUpdateSketchPoint_(e) {
|
|
1543
|
-
this.sketchPoint_ ? this.sketchPoint_.getGeometry().setCoordinates(e) : (this.sketchPoint_ = new
|
|
1543
|
+
this.sketchPoint_ ? this.sketchPoint_.getGeometry().setCoordinates(e) : (this.sketchPoint_ = new M(new Y(e)), this.updateSketchFeatures_());
|
|
1544
1544
|
}
|
|
1545
1545
|
/**
|
|
1546
1546
|
* @param {import("../geom/Polygon.js").default} geometry Polygon geometry.
|
|
1547
1547
|
* @private
|
|
1548
1548
|
*/
|
|
1549
1549
|
createOrUpdateCustomSketchLine_(e) {
|
|
1550
|
-
this.sketchLine_ || (this.sketchLine_ = new
|
|
1550
|
+
this.sketchLine_ || (this.sketchLine_ = new M());
|
|
1551
1551
|
const t = e.getLinearRing(0);
|
|
1552
1552
|
let i = this.sketchLine_.getGeometry();
|
|
1553
1553
|
i ? (i.setFlatCoordinates(
|
|
1554
1554
|
t.getLayout(),
|
|
1555
1555
|
t.getFlatCoordinates()
|
|
1556
|
-
), i.changed()) : (i = new
|
|
1556
|
+
), i.changed()) : (i = new re(
|
|
1557
1557
|
t.getFlatCoordinates(),
|
|
1558
1558
|
t.getLayout()
|
|
1559
1559
|
), this.sketchLine_.setGeometry(i));
|
|
@@ -1567,14 +1567,14 @@ class fi extends Me {
|
|
|
1567
1567
|
const t = this.getMap().getView().getProjection(), i = Ke(this.geometryLayout_);
|
|
1568
1568
|
for (; e.length < i; )
|
|
1569
1569
|
e.push(0);
|
|
1570
|
-
this.finishCoordinate_ = e, this.mode_ === "Point" ? this.sketchCoords_ = e.slice() : this.mode_ === "Polygon" ? (this.sketchCoords_ = [[e.slice(), e.slice()]], this.sketchLineCoords_ = this.sketchCoords_[0]) : this.sketchCoords_ = [e.slice(), e.slice()], this.sketchLineCoords_ && (this.sketchLine_ = new
|
|
1570
|
+
this.finishCoordinate_ = e, this.mode_ === "Point" ? this.sketchCoords_ = e.slice() : this.mode_ === "Polygon" ? (this.sketchCoords_ = [[e.slice(), e.slice()]], this.sketchLineCoords_ = this.sketchCoords_[0]) : this.sketchCoords_ = [e.slice(), e.slice()], this.sketchLineCoords_ && (this.sketchLine_ = new M(new re(this.sketchLineCoords_)));
|
|
1571
1571
|
const n = this.geometryFunction_(
|
|
1572
1572
|
this.sketchCoords_,
|
|
1573
1573
|
void 0,
|
|
1574
1574
|
t
|
|
1575
1575
|
);
|
|
1576
|
-
this.sketchFeature_ = new
|
|
1577
|
-
new
|
|
1576
|
+
this.sketchFeature_ = new M(), this.geometryName_ && this.sketchFeature_.setGeometryName(this.geometryName_), this.sketchFeature_.setGeometry(n), this.updateSketchFeatures_(), this.dispatchEvent(
|
|
1577
|
+
new te(ee.DRAWSTART, this.sketchFeature_)
|
|
1578
1578
|
);
|
|
1579
1579
|
}
|
|
1580
1580
|
/**
|
|
@@ -1669,7 +1669,7 @@ class fi extends Me {
|
|
|
1669
1669
|
let t = this.sketchCoords_;
|
|
1670
1670
|
const i = e.getGeometry(), n = this.getMap().getView().getProjection();
|
|
1671
1671
|
this.mode_ === "LineString" ? (t.pop(), this.geometryFunction_(t, i, n)) : this.mode_ === "Polygon" && (t[0].pop(), this.geometryFunction_(t, i, n), t = i.getCoordinates()), this.type_ === "MultiPoint" ? e.setGeometry(
|
|
1672
|
-
new
|
|
1672
|
+
new Mt([
|
|
1673
1673
|
/** @type {PointCoordType} */
|
|
1674
1674
|
t
|
|
1675
1675
|
])
|
|
@@ -1683,7 +1683,7 @@ class fi extends Me {
|
|
|
1683
1683
|
/** @type {PolyCoordType} */
|
|
1684
1684
|
t
|
|
1685
1685
|
])
|
|
1686
|
-
), this.dispatchEvent(new
|
|
1686
|
+
), this.dispatchEvent(new te(ee.DRAWEND, e)), this.features_ && this.features_.push(e), this.source_ && this.source_.addFeature(e);
|
|
1687
1687
|
}
|
|
1688
1688
|
/**
|
|
1689
1689
|
* Stop drawing without adding the sketch feature to the target layer.
|
|
@@ -1701,7 +1701,7 @@ class fi extends Me {
|
|
|
1701
1701
|
*/
|
|
1702
1702
|
abortDrawing() {
|
|
1703
1703
|
const e = this.abortDrawing_();
|
|
1704
|
-
e && this.dispatchEvent(new
|
|
1704
|
+
e && this.dispatchEvent(new te(ee.DRAWABORT, e));
|
|
1705
1705
|
}
|
|
1706
1706
|
/**
|
|
1707
1707
|
* Append coordinates to the end of the geometry that is currently being drawn.
|
|
@@ -1748,8 +1748,8 @@ class fi extends Me {
|
|
|
1748
1748
|
const i = e.getGeometry();
|
|
1749
1749
|
this.sketchFeature_ = e, this.sketchCoords_ = i.getCoordinates();
|
|
1750
1750
|
const n = this.sketchCoords_[this.sketchCoords_.length - 1];
|
|
1751
|
-
this.finishCoordinate_ = n.slice(), this.sketchCoords_.push(n.slice()), this.sketchPoint_ = new
|
|
1752
|
-
new
|
|
1751
|
+
this.finishCoordinate_ = n.slice(), this.sketchCoords_.push(n.slice()), this.sketchPoint_ = new M(new Y(n)), this.updateSketchFeatures_(), this.dispatchEvent(
|
|
1752
|
+
new te(ee.DRAWSTART, this.sketchFeature_)
|
|
1753
1753
|
);
|
|
1754
1754
|
}
|
|
1755
1755
|
/**
|
|
@@ -1770,13 +1770,13 @@ class fi extends Me {
|
|
|
1770
1770
|
(!e || !t) && this.abortDrawing(), this.overlay_.setMap(t ? e : null);
|
|
1771
1771
|
}
|
|
1772
1772
|
}
|
|
1773
|
-
function
|
|
1774
|
-
const l =
|
|
1773
|
+
function mi() {
|
|
1774
|
+
const l = Re();
|
|
1775
1775
|
return function(e, t) {
|
|
1776
1776
|
return l[e.getGeometry().getType()];
|
|
1777
1777
|
};
|
|
1778
1778
|
}
|
|
1779
|
-
function
|
|
1779
|
+
function yi(l) {
|
|
1780
1780
|
switch (l) {
|
|
1781
1781
|
case "Point":
|
|
1782
1782
|
case "MultiPoint":
|
|
@@ -1793,7 +1793,7 @@ function mi(l) {
|
|
|
1793
1793
|
throw new Error("Invalid type: " + l);
|
|
1794
1794
|
}
|
|
1795
1795
|
}
|
|
1796
|
-
const
|
|
1796
|
+
const xi = {
|
|
1797
1797
|
/**
|
|
1798
1798
|
* Triggered upon snapping to vertex or edge
|
|
1799
1799
|
* @event SnapEvent#snap
|
|
@@ -1801,7 +1801,7 @@ const yi = {
|
|
|
1801
1801
|
*/
|
|
1802
1802
|
SNAP: "snap"
|
|
1803
1803
|
};
|
|
1804
|
-
class
|
|
1804
|
+
class Ci extends H {
|
|
1805
1805
|
/**
|
|
1806
1806
|
* @param {SnapEventType} type Type.
|
|
1807
1807
|
* @param {Object} options Options.
|
|
@@ -1813,7 +1813,7 @@ class xi extends J {
|
|
|
1813
1813
|
super(e), this.vertex = t.vertex, this.vertexPixel = t.vertexPixel, this.feature = t.feature;
|
|
1814
1814
|
}
|
|
1815
1815
|
}
|
|
1816
|
-
function
|
|
1816
|
+
function Ze(l) {
|
|
1817
1817
|
return (
|
|
1818
1818
|
/** @type {import("../source/Vector.js").VectorSourceEvent} */
|
|
1819
1819
|
l.feature ? (
|
|
@@ -1828,8 +1828,8 @@ function qe(l) {
|
|
|
1828
1828
|
)
|
|
1829
1829
|
);
|
|
1830
1830
|
}
|
|
1831
|
-
const
|
|
1832
|
-
class
|
|
1831
|
+
const Se = [];
|
|
1832
|
+
class Ti extends ke {
|
|
1833
1833
|
/**
|
|
1834
1834
|
* @param {Options} [options] Options.
|
|
1835
1835
|
*/
|
|
@@ -1839,7 +1839,7 @@ class Ci extends Me {
|
|
|
1839
1839
|
/** @type {import("./Pointer.js").Options} */
|
|
1840
1840
|
e
|
|
1841
1841
|
);
|
|
1842
|
-
t.handleDownEvent || (t.handleDownEvent =
|
|
1842
|
+
t.handleDownEvent || (t.handleDownEvent = ae), t.stopDown || (t.stopDown = We), super(t), this.on, this.once, this.un, this.source_ = e.source ? e.source : null, this.vertex_ = e.vertex !== void 0 ? e.vertex : !0, this.edge_ = e.edge !== void 0 ? e.edge : !0, this.features_ = e.features ? e.features : null, this.featuresListenerKeys_ = [], this.featureChangeListenerKeys_ = {}, this.indexedFeaturesExtents_ = {}, this.pendingFeatures_ = {}, this.pixelTolerance_ = e.pixelTolerance !== void 0 ? e.pixelTolerance : 10, this.rBush_ = new Be(), this.GEOMETRY_SEGMENTERS_ = {
|
|
1843
1843
|
Point: this.segmentPointGeometry_.bind(this),
|
|
1844
1844
|
LineString: this.segmentLineStringGeometry_.bind(this),
|
|
1845
1845
|
LinearRing: this.segmentLineStringGeometry_.bind(this),
|
|
@@ -1865,19 +1865,19 @@ class Ci extends Me {
|
|
|
1865
1865
|
const s = this.GEOMETRY_SEGMENTERS_[n.getType()];
|
|
1866
1866
|
if (s) {
|
|
1867
1867
|
this.indexedFeaturesExtents_[i] = n.getExtent(
|
|
1868
|
-
|
|
1868
|
+
Wt()
|
|
1869
1869
|
);
|
|
1870
1870
|
const r = (
|
|
1871
1871
|
/** @type {Array<Array<import('../coordinate.js').Coordinate>>} */
|
|
1872
1872
|
[]
|
|
1873
1873
|
);
|
|
1874
1874
|
if (s(r, n), r.length === 1)
|
|
1875
|
-
this.rBush_.insert(
|
|
1875
|
+
this.rBush_.insert(S(r[0]), {
|
|
1876
1876
|
feature: e,
|
|
1877
1877
|
segment: r[0]
|
|
1878
1878
|
});
|
|
1879
1879
|
else if (r.length > 1) {
|
|
1880
|
-
const o = r.map((h) =>
|
|
1880
|
+
const o = r.map((h) => S(h)), a = r.map((h) => ({
|
|
1881
1881
|
feature: e,
|
|
1882
1882
|
segment: h
|
|
1883
1883
|
}));
|
|
@@ -1885,9 +1885,9 @@ class Ci extends Me {
|
|
|
1885
1885
|
}
|
|
1886
1886
|
}
|
|
1887
1887
|
}
|
|
1888
|
-
t && (this.featureChangeListenerKeys_[i] =
|
|
1888
|
+
t && (this.featureChangeListenerKeys_[i] = Z(
|
|
1889
1889
|
e,
|
|
1890
|
-
|
|
1890
|
+
W.CHANGE,
|
|
1891
1891
|
this.handleFeatureChange_,
|
|
1892
1892
|
this
|
|
1893
1893
|
));
|
|
@@ -1908,7 +1908,7 @@ class Ci extends Me {
|
|
|
1908
1908
|
handleEvent(e) {
|
|
1909
1909
|
const t = this.snapTo(e.pixel, e.coordinate, e.map);
|
|
1910
1910
|
return t && (e.coordinate = t.vertex.slice(0, 2), e.pixel = t.vertexPixel, this.dispatchEvent(
|
|
1911
|
-
new xi
|
|
1911
|
+
new Ci(xi.SNAP, {
|
|
1912
1912
|
vertex: e.coordinate,
|
|
1913
1913
|
vertexPixel: e.pixel,
|
|
1914
1914
|
feature: t.feature
|
|
@@ -1920,7 +1920,7 @@ class Ci extends Me {
|
|
|
1920
1920
|
* @private
|
|
1921
1921
|
*/
|
|
1922
1922
|
handleFeatureAdd_(e) {
|
|
1923
|
-
const t =
|
|
1923
|
+
const t = Ze(e);
|
|
1924
1924
|
t && this.addFeature(t);
|
|
1925
1925
|
}
|
|
1926
1926
|
/**
|
|
@@ -1928,7 +1928,7 @@ class Ci extends Me {
|
|
|
1928
1928
|
* @private
|
|
1929
1929
|
*/
|
|
1930
1930
|
handleFeatureRemove_(e) {
|
|
1931
|
-
const t =
|
|
1931
|
+
const t = Ze(e);
|
|
1932
1932
|
t && this.removeFeature(t);
|
|
1933
1933
|
}
|
|
1934
1934
|
/**
|
|
@@ -1972,7 +1972,7 @@ class Ci extends Me {
|
|
|
1972
1972
|
for (let a = o.length - 1; a >= 0; --a)
|
|
1973
1973
|
r.remove(o[a]);
|
|
1974
1974
|
}
|
|
1975
|
-
i && (
|
|
1975
|
+
i && (xe(this.featureChangeListenerKeys_[n]), delete this.featureChangeListenerKeys_[n]);
|
|
1976
1976
|
}
|
|
1977
1977
|
/**
|
|
1978
1978
|
* Remove the interaction from its current map and attach it to the new map.
|
|
@@ -1985,29 +1985,29 @@ class Ci extends Me {
|
|
|
1985
1985
|
/** @type {Array<import("../Feature.js").default>} */
|
|
1986
1986
|
this.getFeatures_()
|
|
1987
1987
|
);
|
|
1988
|
-
t && (i.forEach(
|
|
1989
|
-
|
|
1988
|
+
t && (i.forEach(xe), i.length = 0, this.rBush_.clear(), Object.values(this.featureChangeListenerKeys_).forEach(xe), this.featureChangeListenerKeys_ = {}), super.setMap(e), e && (this.features_ ? i.push(
|
|
1989
|
+
Z(
|
|
1990
1990
|
this.features_,
|
|
1991
|
-
|
|
1991
|
+
G.ADD,
|
|
1992
1992
|
this.handleFeatureAdd_,
|
|
1993
1993
|
this
|
|
1994
1994
|
),
|
|
1995
|
-
|
|
1995
|
+
Z(
|
|
1996
1996
|
this.features_,
|
|
1997
|
-
|
|
1997
|
+
G.REMOVE,
|
|
1998
1998
|
this.handleFeatureRemove_,
|
|
1999
1999
|
this
|
|
2000
2000
|
)
|
|
2001
2001
|
) : this.source_ && i.push(
|
|
2002
|
-
|
|
2002
|
+
Z(
|
|
2003
2003
|
this.source_,
|
|
2004
|
-
|
|
2004
|
+
oe.ADDFEATURE,
|
|
2005
2005
|
this.handleFeatureAdd_,
|
|
2006
2006
|
this
|
|
2007
2007
|
),
|
|
2008
|
-
|
|
2008
|
+
Z(
|
|
2009
2009
|
this.source_,
|
|
2010
|
-
|
|
2010
|
+
oe.REMOVEFEATURE,
|
|
2011
2011
|
this.handleFeatureRemove_,
|
|
2012
2012
|
this
|
|
2013
2013
|
)
|
|
@@ -2021,9 +2021,9 @@ class Ci extends Me {
|
|
|
2021
2021
|
*/
|
|
2022
2022
|
snapTo(e, t, i) {
|
|
2023
2023
|
i.getView().getProjection();
|
|
2024
|
-
const n =
|
|
2024
|
+
const n = F(t), s = it(
|
|
2025
2025
|
nt(
|
|
2026
|
-
|
|
2026
|
+
S([n]),
|
|
2027
2027
|
i.getView().getResolution() * this.pixelTolerance_
|
|
2028
2028
|
)
|
|
2029
2029
|
), r = this.rBush_.getInExtent(s), o = r.length;
|
|
@@ -2033,7 +2033,7 @@ class Ci extends Me {
|
|
|
2033
2033
|
const u = this.pixelTolerance_ * this.pixelTolerance_, g = () => {
|
|
2034
2034
|
if (a) {
|
|
2035
2035
|
const d = i.getPixelFromCoordinate(a);
|
|
2036
|
-
if (
|
|
2036
|
+
if (I(e, d) <= u)
|
|
2037
2037
|
return {
|
|
2038
2038
|
vertex: a,
|
|
2039
2039
|
vertexPixel: [
|
|
@@ -2047,10 +2047,10 @@ class Ci extends Me {
|
|
|
2047
2047
|
};
|
|
2048
2048
|
if (this.vertex_) {
|
|
2049
2049
|
for (let f = 0; f < o; ++f) {
|
|
2050
|
-
const
|
|
2051
|
-
|
|
2052
|
-
const T =
|
|
2053
|
-
|
|
2050
|
+
const m = r[f];
|
|
2051
|
+
m.feature.getGeometry().getType() !== "Circle" && m.segment.forEach((x) => {
|
|
2052
|
+
const T = F(x), p = I(n, T);
|
|
2053
|
+
p < h && (a = x, h = p, c = m.feature);
|
|
2054
2054
|
});
|
|
2055
2055
|
}
|
|
2056
2056
|
const d = g();
|
|
@@ -2059,22 +2059,22 @@ class Ci extends Me {
|
|
|
2059
2059
|
}
|
|
2060
2060
|
if (this.edge_) {
|
|
2061
2061
|
for (let f = 0; f < o; ++f) {
|
|
2062
|
-
let
|
|
2062
|
+
let m = null;
|
|
2063
2063
|
const x = r[f];
|
|
2064
2064
|
if (x.feature.getGeometry().getType() === "Circle") {
|
|
2065
2065
|
let T = x.feature.getGeometry();
|
|
2066
|
-
|
|
2066
|
+
m = Ht(
|
|
2067
2067
|
n,
|
|
2068
2068
|
/** @type {import("../geom/Circle.js").default} */
|
|
2069
2069
|
T
|
|
2070
2070
|
);
|
|
2071
2071
|
} else {
|
|
2072
|
-
const [T,
|
|
2073
|
-
|
|
2072
|
+
const [T, p] = x.segment;
|
|
2073
|
+
p && (Se[0] = F(T), Se[1] = F(p), m = st(n, Se));
|
|
2074
2074
|
}
|
|
2075
|
-
if (
|
|
2076
|
-
const T =
|
|
2077
|
-
T < h && (a =
|
|
2075
|
+
if (m) {
|
|
2076
|
+
const T = I(n, m);
|
|
2077
|
+
T < h && (a = he(m), h = T);
|
|
2078
2078
|
}
|
|
2079
2079
|
}
|
|
2080
2080
|
const d = g();
|
|
@@ -2097,7 +2097,7 @@ class Ci extends Me {
|
|
|
2097
2097
|
*/
|
|
2098
2098
|
segmentCircleGeometry_(e, t) {
|
|
2099
2099
|
this.getMap().getView().getProjection();
|
|
2100
|
-
const s =
|
|
2100
|
+
const s = $t(t).getCoordinates()[0];
|
|
2101
2101
|
for (let r = 0, o = s.length - 1; r < o; ++r)
|
|
2102
2102
|
e.push(s.slice(r, r + 2));
|
|
2103
2103
|
}
|
|
@@ -2184,7 +2184,7 @@ class Ci extends Me {
|
|
|
2184
2184
|
}
|
|
2185
2185
|
}
|
|
2186
2186
|
}
|
|
2187
|
-
class
|
|
2187
|
+
class Fi {
|
|
2188
2188
|
/**
|
|
2189
2189
|
* @param {number} [highWaterMark] High water mark.
|
|
2190
2190
|
*/
|
|
@@ -2236,7 +2236,7 @@ class Ti {
|
|
|
2236
2236
|
*/
|
|
2237
2237
|
get(e, t) {
|
|
2238
2238
|
const i = this.entries_[e];
|
|
2239
|
-
return
|
|
2239
|
+
return D(i !== void 0, 15), i === this.newest_ || (i === this.oldest_ ? (this.oldest_ = /** @type {Entry} */
|
|
2240
2240
|
this.oldest_.newer, this.oldest_.older = null) : (i.newer.older = i.older, i.older.newer = i.newer), i.newer = null, i.older = this.newest_, this.newest_.newer = i, this.newest_ = i), i.value_;
|
|
2241
2241
|
}
|
|
2242
2242
|
/**
|
|
@@ -2246,7 +2246,7 @@ class Ti {
|
|
|
2246
2246
|
*/
|
|
2247
2247
|
remove(e) {
|
|
2248
2248
|
const t = this.entries_[e];
|
|
2249
|
-
return
|
|
2249
|
+
return D(t !== void 0, 15), t === this.newest_ ? (this.newest_ = /** @type {Entry} */
|
|
2250
2250
|
t.older, this.newest_ && (this.newest_.newer = null)) : t === this.oldest_ ? (this.oldest_ = /** @type {Entry} */
|
|
2251
2251
|
t.newer, this.oldest_ && (this.oldest_.older = null)) : (t.newer.older = t.older, t.older.newer = t.newer), delete this.entries_[e], --this.count_, t.value_;
|
|
2252
2252
|
}
|
|
@@ -2324,7 +2324,7 @@ class Ti {
|
|
|
2324
2324
|
* @param {T} value Value.
|
|
2325
2325
|
*/
|
|
2326
2326
|
set(e, t) {
|
|
2327
|
-
|
|
2327
|
+
D(!(e in this.entries_), 16);
|
|
2328
2328
|
const i = {
|
|
2329
2329
|
key_: e,
|
|
2330
2330
|
newer: null,
|
|
@@ -2345,26 +2345,26 @@ class Ti {
|
|
|
2345
2345
|
function Ye(l, e, t, i) {
|
|
2346
2346
|
return i !== void 0 ? (i[0] = l, i[1] = e, i[2] = t, i) : [l, e, t];
|
|
2347
2347
|
}
|
|
2348
|
-
function
|
|
2348
|
+
function ue(l, e, t) {
|
|
2349
2349
|
return l + "/" + e + "/" + t;
|
|
2350
2350
|
}
|
|
2351
2351
|
function ut(l) {
|
|
2352
|
-
return
|
|
2352
|
+
return ue(l[0], l[1], l[2]);
|
|
2353
2353
|
}
|
|
2354
|
-
function
|
|
2354
|
+
function pi(l) {
|
|
2355
2355
|
return l.split("/").map(Number);
|
|
2356
2356
|
}
|
|
2357
|
-
function
|
|
2357
|
+
function Ei(l) {
|
|
2358
2358
|
return (l[1] << l[0]) + l[2];
|
|
2359
2359
|
}
|
|
2360
|
-
function
|
|
2360
|
+
function Si(l, e) {
|
|
2361
2361
|
const t = l[0], i = l[1], n = l[2];
|
|
2362
2362
|
if (e.getMinZoom() > t || t > e.getMaxZoom())
|
|
2363
2363
|
return !1;
|
|
2364
2364
|
const s = e.getFullTileRange(t);
|
|
2365
2365
|
return s ? s.containsXY(i, n) : !0;
|
|
2366
2366
|
}
|
|
2367
|
-
class dt extends
|
|
2367
|
+
class dt extends Fi {
|
|
2368
2368
|
clear() {
|
|
2369
2369
|
for (; this.getCount() > 0; )
|
|
2370
2370
|
this.pop().release();
|
|
@@ -2383,13 +2383,13 @@ class dt extends Ti {
|
|
|
2383
2383
|
pruneExceptNewestZ() {
|
|
2384
2384
|
if (this.getCount() === 0)
|
|
2385
2385
|
return;
|
|
2386
|
-
const e = this.peekFirstKey(), i =
|
|
2386
|
+
const e = this.peekFirstKey(), i = pi(e)[0];
|
|
2387
2387
|
this.forEach((n) => {
|
|
2388
2388
|
n.tileCoord[0] !== i && (this.remove(ut(n.tileCoord)), n.release());
|
|
2389
2389
|
});
|
|
2390
2390
|
}
|
|
2391
2391
|
}
|
|
2392
|
-
const
|
|
2392
|
+
const we = {
|
|
2393
2393
|
/**
|
|
2394
2394
|
* Triggered when a tile starts loading.
|
|
2395
2395
|
* @event module:ol/source/Tile.TileSourceEvent#tileloadstart
|
|
@@ -2411,14 +2411,14 @@ const Ee = {
|
|
|
2411
2411
|
* @api
|
|
2412
2412
|
*/
|
|
2413
2413
|
TILELOADERROR: "tileloaderror"
|
|
2414
|
-
},
|
|
2414
|
+
}, z = [0, 0, 0], R = 5;
|
|
2415
2415
|
class gt {
|
|
2416
2416
|
/**
|
|
2417
2417
|
* @param {Options} options Tile grid options.
|
|
2418
2418
|
*/
|
|
2419
2419
|
constructor(e) {
|
|
2420
|
-
this.minZoom = e.minZoom !== void 0 ? e.minZoom : 0, this.resolutions_ = e.resolutions,
|
|
2421
|
-
|
|
2420
|
+
this.minZoom = e.minZoom !== void 0 ? e.minZoom : 0, this.resolutions_ = e.resolutions, D(
|
|
2421
|
+
wt(
|
|
2422
2422
|
this.resolutions_,
|
|
2423
2423
|
function(n, s) {
|
|
2424
2424
|
return s - n;
|
|
@@ -2436,16 +2436,16 @@ class gt {
|
|
|
2436
2436
|
break;
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
|
-
this.zoomFactor_ = t, this.maxZoom = this.resolutions_.length - 1, this.origin_ = e.origin !== void 0 ? e.origin : null, this.origins_ = null, e.origins !== void 0 && (this.origins_ = e.origins,
|
|
2439
|
+
this.zoomFactor_ = t, this.maxZoom = this.resolutions_.length - 1, this.origin_ = e.origin !== void 0 ? e.origin : null, this.origins_ = null, e.origins !== void 0 && (this.origins_ = e.origins, D(this.origins_.length == this.resolutions_.length, 20));
|
|
2440
2440
|
const i = e.extent;
|
|
2441
|
-
i !== void 0 && !this.origin_ && !this.origins_ && (this.origin_ =
|
|
2441
|
+
i !== void 0 && !this.origin_ && !this.origins_ && (this.origin_ = Jt(i)), D(
|
|
2442
2442
|
!this.origin_ && this.origins_ || this.origin_ && !this.origins_,
|
|
2443
2443
|
18
|
|
2444
|
-
), this.tileSizes_ = null, e.tileSizes !== void 0 && (this.tileSizes_ = e.tileSizes,
|
|
2444
|
+
), this.tileSizes_ = null, e.tileSizes !== void 0 && (this.tileSizes_ = e.tileSizes, D(this.tileSizes_.length == this.resolutions_.length, 19)), this.tileSize_ = e.tileSize !== void 0 ? e.tileSize : this.tileSizes_ ? null : ot, D(
|
|
2445
2445
|
!this.tileSize_ && this.tileSizes_ || this.tileSize_ && !this.tileSizes_,
|
|
2446
2446
|
22
|
|
2447
2447
|
), this.extent_ = i !== void 0 ? i : null, this.fullTileRanges_ = null, this.tmpSize_ = [0, 0], this.tmpExtent_ = [0, 0, 0, 0], e.sizes !== void 0 ? this.fullTileRanges_ = e.sizes.map(function(n, s) {
|
|
2448
|
-
const r = new
|
|
2448
|
+
const r = new Ot(
|
|
2449
2449
|
Math.min(0, n[0]),
|
|
2450
2450
|
Math.max(n[0] - 1, -1),
|
|
2451
2451
|
Math.min(0, n[1]),
|
|
@@ -2482,7 +2482,7 @@ class gt {
|
|
|
2482
2482
|
forEachTileCoordParentTileRange(e, t, i, n) {
|
|
2483
2483
|
let s, r, o, a = null, h = e[0] - 1;
|
|
2484
2484
|
for (this.zoomFactor_ === 2 ? (r = e[1], o = e[2]) : a = this.getTileCoordExtent(e, n); h >= this.minZoom; ) {
|
|
2485
|
-
if (this.zoomFactor_ === 2 ? (r = Math.floor(r / 2), o = Math.floor(o / 2), s =
|
|
2485
|
+
if (this.zoomFactor_ === 2 ? (r = Math.floor(r / 2), o = Math.floor(o / 2), s = U(r, r, o, o, i)) : s = this.getTileRangeForExtentAndZ(
|
|
2486
2486
|
a,
|
|
2487
2487
|
h,
|
|
2488
2488
|
i
|
|
@@ -2552,7 +2552,7 @@ class gt {
|
|
|
2552
2552
|
if (e[0] < this.maxZoom) {
|
|
2553
2553
|
if (this.zoomFactor_ === 2) {
|
|
2554
2554
|
const s = e[1] * 2, r = e[2] * 2;
|
|
2555
|
-
return
|
|
2555
|
+
return U(
|
|
2556
2556
|
s,
|
|
2557
2557
|
s + 1,
|
|
2558
2558
|
r,
|
|
@@ -2583,7 +2583,7 @@ class gt {
|
|
|
2583
2583
|
return null;
|
|
2584
2584
|
const n = e[0], s = e[1], r = e[2];
|
|
2585
2585
|
if (t === n)
|
|
2586
|
-
return
|
|
2586
|
+
return U(
|
|
2587
2587
|
s,
|
|
2588
2588
|
r,
|
|
2589
2589
|
s,
|
|
@@ -2593,9 +2593,9 @@ class gt {
|
|
|
2593
2593
|
if (this.zoomFactor_) {
|
|
2594
2594
|
const a = Math.pow(this.zoomFactor_, t - n), h = Math.floor(s * a), c = Math.floor(r * a);
|
|
2595
2595
|
if (t < n)
|
|
2596
|
-
return
|
|
2596
|
+
return U(h, h, c, c, i);
|
|
2597
2597
|
const u = Math.floor(a * (s + 1)) - 1, g = Math.floor(a * (r + 1)) - 1;
|
|
2598
|
-
return
|
|
2598
|
+
return U(h, u, c, g, i);
|
|
2599
2599
|
}
|
|
2600
2600
|
const o = this.getTileCoordExtent(e, this.tmpExtent_);
|
|
2601
2601
|
return this.getTileRangeForExtentAndZ(o, t, i);
|
|
@@ -2608,18 +2608,18 @@ class gt {
|
|
|
2608
2608
|
* @return {import("../TileRange.js").default} Tile range.
|
|
2609
2609
|
*/
|
|
2610
2610
|
getTileRangeForExtentAndZ(e, t, i) {
|
|
2611
|
-
this.getTileCoordForXYAndZ_(e[0], e[3], t, !1,
|
|
2612
|
-
const n =
|
|
2613
|
-
this.getTileCoordForXYAndZ_(e[2], e[1], t, !0,
|
|
2614
|
-
const r =
|
|
2615
|
-
return
|
|
2611
|
+
this.getTileCoordForXYAndZ_(e[0], e[3], t, !1, z);
|
|
2612
|
+
const n = z[1], s = z[2];
|
|
2613
|
+
this.getTileCoordForXYAndZ_(e[2], e[1], t, !0, z);
|
|
2614
|
+
const r = z[1], o = z[2];
|
|
2615
|
+
return U(n, r, s, o, i);
|
|
2616
2616
|
}
|
|
2617
2617
|
/**
|
|
2618
2618
|
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
2619
2619
|
* @return {import("../coordinate.js").Coordinate} Tile center.
|
|
2620
2620
|
*/
|
|
2621
2621
|
getTileCoordCenter(e) {
|
|
2622
|
-
const t = this.getOrigin(e[0]), i = this.getResolution(e[0]), n =
|
|
2622
|
+
const t = this.getOrigin(e[0]), i = this.getResolution(e[0]), n = A(this.getTileSize(e[0]), this.tmpSize_);
|
|
2623
2623
|
return [
|
|
2624
2624
|
t[0] + (e[1] + 0.5) * n[0] * i,
|
|
2625
2625
|
t[1] - (e[2] + 0.5) * n[1] * i
|
|
@@ -2634,7 +2634,7 @@ class gt {
|
|
|
2634
2634
|
* @api
|
|
2635
2635
|
*/
|
|
2636
2636
|
getTileCoordExtent(e, t) {
|
|
2637
|
-
const i = this.getOrigin(e[0]), n = this.getResolution(e[0]), s =
|
|
2637
|
+
const i = this.getOrigin(e[0]), n = this.getResolution(e[0]), s = A(this.getTileSize(e[0]), this.tmpSize_), r = i[0] + e[1] * s[0] * n, o = i[1] - (e[2] + 1) * s[1] * n, a = r + s[0] * n, h = o + s[1] * n;
|
|
2638
2638
|
return at(r, o, a, h, t);
|
|
2639
2639
|
}
|
|
2640
2640
|
/**
|
|
@@ -2671,9 +2671,9 @@ class gt {
|
|
|
2671
2671
|
* @private
|
|
2672
2672
|
*/
|
|
2673
2673
|
getTileCoordForXYAndResolution_(e, t, i, n, s) {
|
|
2674
|
-
const r = this.getZForResolution(i), o = i / this.getResolution(r), a = this.getOrigin(r), h =
|
|
2674
|
+
const r = this.getZForResolution(i), o = i / this.getResolution(r), a = this.getOrigin(r), h = A(this.getTileSize(r), this.tmpSize_);
|
|
2675
2675
|
let c = o * (e - a[0]) / i / h[0], u = o * (a[1] - t) / i / h[1];
|
|
2676
|
-
return n ? (c =
|
|
2676
|
+
return n ? (c = $(c, R) - 1, u = $(u, R) - 1) : (c = J(c, R), u = J(u, R)), Ye(r, c, u, s);
|
|
2677
2677
|
}
|
|
2678
2678
|
/**
|
|
2679
2679
|
* Although there is repetition between this method and `getTileCoordForXYAndResolution_`,
|
|
@@ -2691,9 +2691,9 @@ class gt {
|
|
|
2691
2691
|
* @private
|
|
2692
2692
|
*/
|
|
2693
2693
|
getTileCoordForXYAndZ_(e, t, i, n, s) {
|
|
2694
|
-
const r = this.getOrigin(i), o = this.getResolution(i), a =
|
|
2694
|
+
const r = this.getOrigin(i), o = this.getResolution(i), a = A(this.getTileSize(i), this.tmpSize_);
|
|
2695
2695
|
let h = (e - r[0]) / o / a[0], c = (r[1] - t) / o / a[1];
|
|
2696
|
-
return n ? (h =
|
|
2696
|
+
return n ? (h = $(h, R) - 1, c = $(c, R) - 1) : (h = J(h, R), c = J(c, R)), Ye(i, h, c, s);
|
|
2697
2697
|
}
|
|
2698
2698
|
/**
|
|
2699
2699
|
* Get a tile coordinate given a map coordinate and zoom level.
|
|
@@ -2755,7 +2755,7 @@ class gt {
|
|
|
2755
2755
|
* @api
|
|
2756
2756
|
*/
|
|
2757
2757
|
getZForResolution(e, t) {
|
|
2758
|
-
const i =
|
|
2758
|
+
const i = Pt(
|
|
2759
2759
|
this.resolutions_,
|
|
2760
2760
|
e,
|
|
2761
2761
|
t || 0
|
|
@@ -2769,7 +2769,7 @@ class gt {
|
|
|
2769
2769
|
* @return {boolean} The tile with the provided tile coordinate intersects the given viewport.
|
|
2770
2770
|
*/
|
|
2771
2771
|
tileCoordIntersectsViewport(e, t) {
|
|
2772
|
-
return
|
|
2772
|
+
return Qt(
|
|
2773
2773
|
t,
|
|
2774
2774
|
0,
|
|
2775
2775
|
t.length,
|
|
@@ -2790,11 +2790,11 @@ class gt {
|
|
|
2790
2790
|
}
|
|
2791
2791
|
function ft(l) {
|
|
2792
2792
|
let e = l.getDefaultTileGrid();
|
|
2793
|
-
return e || (e =
|
|
2793
|
+
return e || (e = Di(l), l.setDefaultTileGrid(e)), e;
|
|
2794
2794
|
}
|
|
2795
|
-
function
|
|
2796
|
-
const i = e[0], n = l.getTileCoordCenter(e), s =
|
|
2797
|
-
if (!
|
|
2795
|
+
function wi(l, e, t) {
|
|
2796
|
+
const i = e[0], n = l.getTileCoordCenter(e), s = Ae(t);
|
|
2797
|
+
if (!si(s, n)) {
|
|
2798
2798
|
const r = lt(s), o = Math.ceil(
|
|
2799
2799
|
(s[0] - n[0]) / r
|
|
2800
2800
|
);
|
|
@@ -2802,17 +2802,17 @@ function Si(l, e, t) {
|
|
|
2802
2802
|
}
|
|
2803
2803
|
return e;
|
|
2804
2804
|
}
|
|
2805
|
-
function
|
|
2805
|
+
function Pi(l, e, t, i) {
|
|
2806
2806
|
i = i !== void 0 ? i : "top-left";
|
|
2807
2807
|
const n = _t(l, e, t);
|
|
2808
2808
|
return new gt({
|
|
2809
2809
|
extent: l,
|
|
2810
|
-
origin:
|
|
2810
|
+
origin: ii(l, i),
|
|
2811
2811
|
resolutions: n,
|
|
2812
2812
|
tileSize: t
|
|
2813
2813
|
});
|
|
2814
2814
|
}
|
|
2815
|
-
function
|
|
2815
|
+
function Li(l) {
|
|
2816
2816
|
const e = l || {}, t = e.extent || Ge("EPSG:3857").getExtent(), i = {
|
|
2817
2817
|
extent: t,
|
|
2818
2818
|
minZoom: e.minZoom,
|
|
@@ -2827,28 +2827,28 @@ function Pi(l) {
|
|
|
2827
2827
|
return new gt(i);
|
|
2828
2828
|
}
|
|
2829
2829
|
function _t(l, e, t, i) {
|
|
2830
|
-
e = e !== void 0 ? e :
|
|
2831
|
-
const n =
|
|
2830
|
+
e = e !== void 0 ? e : ni, t = A(t !== void 0 ? t : ot);
|
|
2831
|
+
const n = ei(l), s = lt(l);
|
|
2832
2832
|
i = i > 0 ? i : Math.max(s / t[0], n / t[1]);
|
|
2833
2833
|
const r = e + 1, o = new Array(r);
|
|
2834
2834
|
for (let a = 0; a < r; ++a)
|
|
2835
2835
|
o[a] = i / Math.pow(2, a);
|
|
2836
2836
|
return o;
|
|
2837
2837
|
}
|
|
2838
|
-
function
|
|
2839
|
-
const n =
|
|
2840
|
-
return
|
|
2838
|
+
function Di(l, e, t, i) {
|
|
2839
|
+
const n = Ae(l);
|
|
2840
|
+
return Pi(n, e, t, i);
|
|
2841
2841
|
}
|
|
2842
|
-
function
|
|
2842
|
+
function Ae(l) {
|
|
2843
2843
|
l = Ge(l);
|
|
2844
2844
|
let e = l.getExtent();
|
|
2845
2845
|
if (!e) {
|
|
2846
|
-
const t = 180 *
|
|
2846
|
+
const t = 180 * ti.degrees / l.getMetersPerUnit();
|
|
2847
2847
|
e = at(-t, -t, t, t);
|
|
2848
2848
|
}
|
|
2849
2849
|
return e;
|
|
2850
2850
|
}
|
|
2851
|
-
class
|
|
2851
|
+
class Mi extends ri {
|
|
2852
2852
|
/**
|
|
2853
2853
|
* @param {Options} options SourceTile source options.
|
|
2854
2854
|
*/
|
|
@@ -2862,7 +2862,7 @@ class Di extends si {
|
|
|
2862
2862
|
interpolate: e.interpolate
|
|
2863
2863
|
}), this.on, this.once, this.un, this.opaque_ = e.opaque !== void 0 ? e.opaque : !1, this.tilePixelRatio_ = e.tilePixelRatio !== void 0 ? e.tilePixelRatio : 1, this.tileGrid = e.tileGrid !== void 0 ? e.tileGrid : null;
|
|
2864
2864
|
const t = [256, 256];
|
|
2865
|
-
this.tileGrid &&
|
|
2865
|
+
this.tileGrid && A(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()), t), this.tileCache = new dt(e.cacheSize || 0), this.tmpSize = [0, 0], this.key_ = e.key || "", this.tileOptions = {
|
|
2866
2866
|
transition: e.transition,
|
|
2867
2867
|
interpolate: e.interpolate
|
|
2868
2868
|
}, this.zDirection = e.zDirection ? e.zDirection : 0;
|
|
@@ -2897,8 +2897,8 @@ class Di extends si {
|
|
|
2897
2897
|
let r = !0, o, a, h;
|
|
2898
2898
|
for (let c = i.minX; c <= i.maxX; ++c)
|
|
2899
2899
|
for (let u = i.minY; u <= i.maxY; ++u)
|
|
2900
|
-
a =
|
|
2901
|
-
s.get(a), h = o.getState() ===
|
|
2900
|
+
a = ue(t, c, u), h = !1, s.containsKey(a) && (o = /** @type {!import("../Tile.js").default} */
|
|
2901
|
+
s.get(a), h = o.getState() === b.LOADED, h && (h = n(o) !== !1)), h || (r = !1);
|
|
2902
2902
|
return r;
|
|
2903
2903
|
}
|
|
2904
2904
|
/**
|
|
@@ -2948,7 +2948,7 @@ class Di extends si {
|
|
|
2948
2948
|
* @return {!import("../Tile.js").default} Tile.
|
|
2949
2949
|
*/
|
|
2950
2950
|
getTile(e, t, i, n, s) {
|
|
2951
|
-
return
|
|
2951
|
+
return Lt();
|
|
2952
2952
|
}
|
|
2953
2953
|
/**
|
|
2954
2954
|
* Return the tile grid of the tile source.
|
|
@@ -2972,8 +2972,8 @@ class Di extends si {
|
|
|
2972
2972
|
*/
|
|
2973
2973
|
getTileCacheForProjection(e) {
|
|
2974
2974
|
const t = this.getProjection();
|
|
2975
|
-
return
|
|
2976
|
-
t === null ||
|
|
2975
|
+
return D(
|
|
2976
|
+
t === null || K(t, e),
|
|
2977
2977
|
68
|
|
2978
2978
|
// A VectorTile source can only be rendered if it has a projection compatible with the view projection.
|
|
2979
2979
|
), this.tileCache;
|
|
@@ -2995,8 +2995,8 @@ class Di extends si {
|
|
|
2995
2995
|
* @return {import("../size.js").Size} Tile size.
|
|
2996
2996
|
*/
|
|
2997
2997
|
getTilePixelSize(e, t, i) {
|
|
2998
|
-
const n = this.getTileGridForProjection(i), s = this.getTilePixelRatio(t), r =
|
|
2999
|
-
return s == 1 ? r :
|
|
2998
|
+
const n = this.getTileGridForProjection(i), s = this.getTilePixelRatio(t), r = A(n.getTileSize(e), this.tmpSize);
|
|
2999
|
+
return s == 1 ? r : Vt(r, s, this.tmpSize);
|
|
3000
3000
|
}
|
|
3001
3001
|
/**
|
|
3002
3002
|
* Returns a tile coordinate wrapped around the x-axis. When the tile coordinate
|
|
@@ -3010,7 +3010,7 @@ class Di extends si {
|
|
|
3010
3010
|
getTileCoordForTileUrlFunction(e, t) {
|
|
3011
3011
|
t = t !== void 0 ? t : this.getProjection();
|
|
3012
3012
|
const i = this.getTileGridForProjection(t);
|
|
3013
|
-
return this.getWrapX() && t.isGlobal() && (e =
|
|
3013
|
+
return this.getWrapX() && t.isGlobal() && (e = wi(i, e, t)), Si(e, i) ? e : null;
|
|
3014
3014
|
}
|
|
3015
3015
|
/**
|
|
3016
3016
|
* Remove all cached tiles from the source. The next render cycle will fetch new tiles.
|
|
@@ -3042,7 +3042,7 @@ class Di extends si {
|
|
|
3042
3042
|
useTile(e, t, i, n) {
|
|
3043
3043
|
}
|
|
3044
3044
|
}
|
|
3045
|
-
class
|
|
3045
|
+
class ki extends H {
|
|
3046
3046
|
/**
|
|
3047
3047
|
* @param {string} type Type.
|
|
3048
3048
|
* @param {import("../Tile.js").default} tile The tile.
|
|
@@ -3051,7 +3051,7 @@ class Mi extends J {
|
|
|
3051
3051
|
super(e), this.tile = t;
|
|
3052
3052
|
}
|
|
3053
3053
|
}
|
|
3054
|
-
function
|
|
3054
|
+
function Ri(l, e) {
|
|
3055
3055
|
const t = /\{z\}/g, i = /\{x\}/g, n = /\{y\}/g, s = /\{-y\}/g;
|
|
3056
3056
|
return (
|
|
3057
3057
|
/**
|
|
@@ -3064,7 +3064,7 @@ function ki(l, e) {
|
|
|
3064
3064
|
if (r)
|
|
3065
3065
|
return l.replace(t, r[0].toString()).replace(i, r[1].toString()).replace(n, r[2].toString()).replace(s, function() {
|
|
3066
3066
|
const h = r[0], c = e.getFullTileRange(h);
|
|
3067
|
-
return
|
|
3067
|
+
return D(c, 55), (c.getHeight() - r[2] - 1).toString();
|
|
3068
3068
|
});
|
|
3069
3069
|
}
|
|
3070
3070
|
);
|
|
@@ -3072,7 +3072,7 @@ function ki(l, e) {
|
|
|
3072
3072
|
function Gi(l, e) {
|
|
3073
3073
|
const t = l.length, i = new Array(t);
|
|
3074
3074
|
for (let n = 0; n < t; ++n)
|
|
3075
|
-
i[n] =
|
|
3075
|
+
i[n] = Ri(l[n], e);
|
|
3076
3076
|
return vi(i);
|
|
3077
3077
|
}
|
|
3078
3078
|
function vi(l) {
|
|
@@ -3086,12 +3086,12 @@ function vi(l) {
|
|
|
3086
3086
|
function(e, t, i) {
|
|
3087
3087
|
if (!e)
|
|
3088
3088
|
return;
|
|
3089
|
-
const n =
|
|
3089
|
+
const n = Ei(e), s = Dt(n, l.length);
|
|
3090
3090
|
return l[s](e, t, i);
|
|
3091
3091
|
}
|
|
3092
3092
|
);
|
|
3093
3093
|
}
|
|
3094
|
-
function
|
|
3094
|
+
function Ai(l) {
|
|
3095
3095
|
const e = [];
|
|
3096
3096
|
let t = /\{([a-z])-([a-z])\}/.exec(l);
|
|
3097
3097
|
if (t) {
|
|
@@ -3109,7 +3109,7 @@ function Ri(l) {
|
|
|
3109
3109
|
}
|
|
3110
3110
|
return e.push(l), e;
|
|
3111
3111
|
}
|
|
3112
|
-
class
|
|
3112
|
+
class be extends Mi {
|
|
3113
3113
|
/**
|
|
3114
3114
|
* @param {Options} options Image tile options.
|
|
3115
3115
|
*/
|
|
@@ -3128,7 +3128,7 @@ class Ae extends Di {
|
|
|
3128
3128
|
key: e.key,
|
|
3129
3129
|
attributionsCollapsible: e.attributionsCollapsible,
|
|
3130
3130
|
zDirection: e.zDirection
|
|
3131
|
-
}), this.generateTileUrlFunction_ = this.tileUrlFunction ===
|
|
3131
|
+
}), this.generateTileUrlFunction_ = this.tileUrlFunction === be.prototype.tileUrlFunction, this.tileLoadFunction = e.tileLoadFunction, e.tileUrlFunction && (this.tileUrlFunction = e.tileUrlFunction), this.urls = null, e.urls ? this.setUrls(e.urls) : e.url && this.setUrl(e.url), this.tileLoadingKeys_ = {};
|
|
3132
3132
|
}
|
|
3133
3133
|
/**
|
|
3134
3134
|
* Return the tile load function of the source.
|
|
@@ -3167,7 +3167,7 @@ class Ae extends Di {
|
|
|
3167
3167
|
e.target
|
|
3168
3168
|
), i = C(t), n = t.getState();
|
|
3169
3169
|
let s;
|
|
3170
|
-
n ==
|
|
3170
|
+
n == b.LOADING ? (this.tileLoadingKeys_[i] = !0, s = we.TILELOADSTART) : i in this.tileLoadingKeys_ && (delete this.tileLoadingKeys_[i], s = n == b.ERROR ? we.TILELOADERROR : n == b.LOADED ? we.TILELOADEND : void 0), s != null && this.dispatchEvent(new ki(s, t));
|
|
3171
3171
|
}
|
|
3172
3172
|
/**
|
|
3173
3173
|
* Set the tile load function of the source.
|
|
@@ -3192,7 +3192,7 @@ class Ae extends Di {
|
|
|
3192
3192
|
* @api
|
|
3193
3193
|
*/
|
|
3194
3194
|
setUrl(e) {
|
|
3195
|
-
const t =
|
|
3195
|
+
const t = Ai(e);
|
|
3196
3196
|
this.urls = t, this.setUrls(t);
|
|
3197
3197
|
}
|
|
3198
3198
|
/**
|
|
@@ -3221,11 +3221,11 @@ class Ae extends Di {
|
|
|
3221
3221
|
* @param {number} y Tile coordinate y.
|
|
3222
3222
|
*/
|
|
3223
3223
|
useTile(e, t, i) {
|
|
3224
|
-
const n =
|
|
3224
|
+
const n = ue(e, t, i);
|
|
3225
3225
|
this.tileCache.containsKey(n) && this.tileCache.get(n);
|
|
3226
3226
|
}
|
|
3227
3227
|
}
|
|
3228
|
-
class
|
|
3228
|
+
class bi extends be {
|
|
3229
3229
|
/**
|
|
3230
3230
|
* @param {!Options} options Image tile options.
|
|
3231
3231
|
*/
|
|
@@ -3237,7 +3237,7 @@ class Ai extends Ae {
|
|
|
3237
3237
|
projection: e.projection,
|
|
3238
3238
|
state: e.state,
|
|
3239
3239
|
tileGrid: e.tileGrid,
|
|
3240
|
-
tileLoadFunction: e.tileLoadFunction ? e.tileLoadFunction :
|
|
3240
|
+
tileLoadFunction: e.tileLoadFunction ? e.tileLoadFunction : Ii,
|
|
3241
3241
|
tilePixelRatio: e.tilePixelRatio,
|
|
3242
3242
|
tileUrlFunction: e.tileUrlFunction,
|
|
3243
3243
|
url: e.url,
|
|
@@ -3248,7 +3248,7 @@ class Ai extends Ae {
|
|
|
3248
3248
|
key: e.key,
|
|
3249
3249
|
attributionsCollapsible: e.attributionsCollapsible,
|
|
3250
3250
|
zDirection: e.zDirection
|
|
3251
|
-
}), this.crossOrigin = e.crossOrigin !== void 0 ? e.crossOrigin : null, this.tileClass = e.tileClass !== void 0 ? e.tileClass :
|
|
3251
|
+
}), this.crossOrigin = e.crossOrigin !== void 0 ? e.crossOrigin : null, this.tileClass = e.tileClass !== void 0 ? e.tileClass : Ut, this.tileCacheForProjection = {}, this.tileGridForProjection = {}, this.reprojectionErrorThreshold_ = e.reprojectionErrorThreshold, this.renderReprojectionEdges_ = !1;
|
|
3252
3252
|
}
|
|
3253
3253
|
/**
|
|
3254
3254
|
* @return {boolean} Can expire cache.
|
|
@@ -3280,7 +3280,7 @@ class Ai extends Ae {
|
|
|
3280
3280
|
* @return {number} Gutter.
|
|
3281
3281
|
*/
|
|
3282
3282
|
getGutterForProjection(e) {
|
|
3283
|
-
return this.getProjection() && e && !
|
|
3283
|
+
return this.getProjection() && e && !K(this.getProjection(), e) ? 0 : this.getGutter();
|
|
3284
3284
|
}
|
|
3285
3285
|
/**
|
|
3286
3286
|
* @return {number} Gutter.
|
|
@@ -3301,7 +3301,7 @@ class Ai extends Ae {
|
|
|
3301
3301
|
* @return {boolean} Opaque.
|
|
3302
3302
|
*/
|
|
3303
3303
|
getOpaque(e) {
|
|
3304
|
-
return this.getProjection() && e && !
|
|
3304
|
+
return this.getProjection() && e && !K(this.getProjection(), e) ? !1 : super.getOpaque(e);
|
|
3305
3305
|
}
|
|
3306
3306
|
/**
|
|
3307
3307
|
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
@@ -3309,7 +3309,7 @@ class Ai extends Ae {
|
|
|
3309
3309
|
*/
|
|
3310
3310
|
getTileGridForProjection(e) {
|
|
3311
3311
|
const t = this.getProjection();
|
|
3312
|
-
if (this.tileGrid && (!t ||
|
|
3312
|
+
if (this.tileGrid && (!t || K(t, e)))
|
|
3313
3313
|
return this.tileGrid;
|
|
3314
3314
|
const i = C(e);
|
|
3315
3315
|
return i in this.tileGridForProjection || (this.tileGridForProjection[i] = ft(e)), this.tileGridForProjection[i];
|
|
@@ -3320,7 +3320,7 @@ class Ai extends Ae {
|
|
|
3320
3320
|
*/
|
|
3321
3321
|
getTileCacheForProjection(e) {
|
|
3322
3322
|
const t = this.getProjection();
|
|
3323
|
-
if (!t ||
|
|
3323
|
+
if (!t || K(t, e))
|
|
3324
3324
|
return this.tileCache;
|
|
3325
3325
|
const i = C(e);
|
|
3326
3326
|
return i in this.tileCacheForProjection || (this.tileCacheForProjection[i] = new dt(
|
|
@@ -3343,13 +3343,13 @@ class Ai extends Ae {
|
|
|
3343
3343
|
s
|
|
3344
3344
|
), h = a ? this.tileUrlFunction(a, n, s) : void 0, c = new this.tileClass(
|
|
3345
3345
|
o,
|
|
3346
|
-
h !== void 0 ?
|
|
3346
|
+
h !== void 0 ? b.IDLE : b.EMPTY,
|
|
3347
3347
|
h !== void 0 ? h : "",
|
|
3348
3348
|
this.crossOrigin,
|
|
3349
3349
|
this.tileLoadFunction,
|
|
3350
3350
|
this.tileOptions
|
|
3351
3351
|
);
|
|
3352
|
-
return c.key = r, c.addEventListener(
|
|
3352
|
+
return c.key = r, c.addEventListener(W.CHANGE, this.handleTileChange.bind(this)), c;
|
|
3353
3353
|
}
|
|
3354
3354
|
/**
|
|
3355
3355
|
* @param {number} z Tile coordinate z.
|
|
@@ -3361,7 +3361,7 @@ class Ai extends Ae {
|
|
|
3361
3361
|
*/
|
|
3362
3362
|
getTile(e, t, i, n, s) {
|
|
3363
3363
|
const r = this.getProjection();
|
|
3364
|
-
if (!r || !s ||
|
|
3364
|
+
if (!r || !s || K(r, s))
|
|
3365
3365
|
return this.getTileInternal(
|
|
3366
3366
|
e,
|
|
3367
3367
|
t,
|
|
@@ -3379,7 +3379,7 @@ class Ai extends Ae {
|
|
|
3379
3379
|
const g = this.getTileGridForProjection(r), d = this.getTileGridForProjection(s), f = this.getTileCoordForTileUrlFunction(
|
|
3380
3380
|
a,
|
|
3381
3381
|
s
|
|
3382
|
-
),
|
|
3382
|
+
), m = new zt(
|
|
3383
3383
|
r,
|
|
3384
3384
|
g,
|
|
3385
3385
|
s,
|
|
@@ -3388,12 +3388,12 @@ class Ai extends Ae {
|
|
|
3388
3388
|
f,
|
|
3389
3389
|
this.getTilePixelRatio(n),
|
|
3390
3390
|
this.getGutter(),
|
|
3391
|
-
(x, T,
|
|
3391
|
+
(x, T, p, w) => this.getTileInternal(x, T, p, w, r),
|
|
3392
3392
|
this.reprojectionErrorThreshold_,
|
|
3393
3393
|
this.renderReprojectionEdges_,
|
|
3394
3394
|
this.getInterpolate()
|
|
3395
3395
|
);
|
|
3396
|
-
return
|
|
3396
|
+
return m.key = u, h ? (m.interimTile = h, m.refreshInterimChain(), o.replace(c, m)) : o.set(c, m), m;
|
|
3397
3397
|
}
|
|
3398
3398
|
/**
|
|
3399
3399
|
* @param {number} z Tile coordinate z.
|
|
@@ -3406,12 +3406,12 @@ class Ai extends Ae {
|
|
|
3406
3406
|
*/
|
|
3407
3407
|
getTileInternal(e, t, i, n, s) {
|
|
3408
3408
|
let r = null;
|
|
3409
|
-
const o =
|
|
3409
|
+
const o = ue(e, t, i), a = this.getKey();
|
|
3410
3410
|
if (!this.tileCache.containsKey(o))
|
|
3411
3411
|
r = this.createTile_(e, t, i, n, s, a), this.tileCache.set(o, r);
|
|
3412
3412
|
else if (r = this.tileCache.get(o), r.key != a) {
|
|
3413
3413
|
const h = r;
|
|
3414
|
-
r = this.createTile_(e, t, i, n, s, a), h.getState() ==
|
|
3414
|
+
r = this.createTile_(e, t, i, n, s, a), h.getState() == b.IDLE ? r.interimTile = h.interimTile : r.interimTile = h, r.refreshInterimChain(), this.tileCache.replace(o, r);
|
|
3415
3415
|
}
|
|
3416
3416
|
return r;
|
|
3417
3417
|
}
|
|
@@ -3453,17 +3453,17 @@ class Ai extends Ae {
|
|
|
3453
3453
|
this.tileCacheForProjection[e].clear();
|
|
3454
3454
|
}
|
|
3455
3455
|
}
|
|
3456
|
-
function
|
|
3456
|
+
function Ii(l, e) {
|
|
3457
3457
|
l.getImage().src = e;
|
|
3458
3458
|
}
|
|
3459
|
-
class
|
|
3459
|
+
class ji extends bi {
|
|
3460
3460
|
/**
|
|
3461
3461
|
* @param {Options} [options] XYZ options.
|
|
3462
3462
|
*/
|
|
3463
3463
|
constructor(e) {
|
|
3464
3464
|
e = e || {};
|
|
3465
|
-
const t = e.projection !== void 0 ? e.projection : "EPSG:3857", i = e.tileGrid !== void 0 ? e.tileGrid :
|
|
3466
|
-
extent:
|
|
3465
|
+
const t = e.projection !== void 0 ? e.projection : "EPSG:3857", i = e.tileGrid !== void 0 ? e.tileGrid : Li({
|
|
3466
|
+
extent: Ae(t),
|
|
3467
3467
|
maxResolution: e.maxResolution,
|
|
3468
3468
|
maxZoom: e.maxZoom,
|
|
3469
3469
|
minZoom: e.minZoom,
|
|
@@ -3496,15 +3496,15 @@ class Ii extends Ai {
|
|
|
3496
3496
|
return this.gutter_;
|
|
3497
3497
|
}
|
|
3498
3498
|
}
|
|
3499
|
-
const
|
|
3500
|
-
class
|
|
3499
|
+
const Oi = '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';
|
|
3500
|
+
class Ui extends ji {
|
|
3501
3501
|
/**
|
|
3502
3502
|
* @param {Options} [options] Open Street Map options.
|
|
3503
3503
|
*/
|
|
3504
3504
|
constructor(e) {
|
|
3505
3505
|
e = e || {};
|
|
3506
3506
|
let t;
|
|
3507
|
-
e.attributions !== void 0 ? t = e.attributions : t = [
|
|
3507
|
+
e.attributions !== void 0 ? t = e.attributions : t = [Oi];
|
|
3508
3508
|
const i = e.crossOrigin !== void 0 ? e.crossOrigin : "anonymous", n = e.url !== void 0 ? e.url : "https://tile.openstreetmap.org/{z}/{x}/{y}.png";
|
|
3509
3509
|
super({
|
|
3510
3510
|
attributions: t,
|
|
@@ -3523,187 +3523,185 @@ class Oi extends Ii {
|
|
|
3523
3523
|
});
|
|
3524
3524
|
}
|
|
3525
3525
|
}
|
|
3526
|
-
|
|
3527
|
-
const
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
})
|
|
3539
|
-
};
|
|
3540
|
-
function Hi(l) {
|
|
3541
|
-
const e = v.useRef(null), [t, i] = v.useState("Pointer"), [n, s] = v.useState(!1), [r, o] = v.useState({
|
|
3526
|
+
function $i(l) {
|
|
3527
|
+
const e = L.useRef(null), t = L.useRef();
|
|
3528
|
+
t.current || (t.current = new Me());
|
|
3529
|
+
const i = t.current, n = L.useRef();
|
|
3530
|
+
n.current || (n.current = {
|
|
3531
|
+
layer: new ce({ source: i, style: qt }),
|
|
3532
|
+
modify: new ci({ source: i }),
|
|
3533
|
+
draw: null,
|
|
3534
|
+
snap: null,
|
|
3535
|
+
select: new ve({ condition: Kt, style: Xt })
|
|
3536
|
+
});
|
|
3537
|
+
const s = n.current, [r, o] = L.useState("Pointer"), [a, h] = L.useState(!1), [c, u] = L.useState({
|
|
3542
3538
|
open: !1,
|
|
3543
3539
|
buttons: [],
|
|
3544
3540
|
position: void 0
|
|
3545
|
-
}),
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3541
|
+
}), g = () => {
|
|
3542
|
+
l.defaultExtent && ye(l.defaultExtent), d(), f(), m(), fe();
|
|
3543
|
+
let _;
|
|
3544
|
+
l.drawingWKTData && l.drawingWKTData !== "GEOMETRYCOLLECTION()" && (ge(l.drawingWKTData), _ = ze(l.drawingWKTData) || void 0, _ && me(_[0], [100, 100, 100, 100])), requestAnimationFrame(() => {
|
|
3545
|
+
var y;
|
|
3546
|
+
(y = e.current) == null || y.updateSize(), l.defaultExtent && ye(l.defaultExtent), _ && me(_[0], [100, 100, 100, 100]);
|
|
3547
|
+
});
|
|
3551
3548
|
};
|
|
3552
|
-
|
|
3553
|
-
}, []),
|
|
3554
|
-
if (
|
|
3555
|
-
if (
|
|
3549
|
+
L.useEffect(() => () => {
|
|
3550
|
+
}, []), L.useEffect(() => {
|
|
3551
|
+
if (r !== "Pointer") {
|
|
3552
|
+
if (r === "KML") {
|
|
3556
3553
|
_e();
|
|
3557
3554
|
return;
|
|
3558
3555
|
}
|
|
3559
|
-
return
|
|
3556
|
+
return k(r), () => {
|
|
3560
3557
|
};
|
|
3561
3558
|
}
|
|
3562
|
-
}, [
|
|
3563
|
-
}), [l.drawingKMLData]),
|
|
3559
|
+
}, [r]), L.useEffect(() => (l.drawingKMLData && Ie(l.drawingKMLData), () => {
|
|
3560
|
+
}), [l.drawingKMLData]), L.useEffect(() => (l.drawingWKTData && (fe(), l.drawingWKTData !== "GEOMETRYCOLLECTION()" && ge(l.drawingWKTData)), () => {
|
|
3564
3561
|
}), [l.drawingWKTData]);
|
|
3565
|
-
const
|
|
3566
|
-
|
|
3567
|
-
},
|
|
3568
|
-
|
|
3569
|
-
},
|
|
3570
|
-
|
|
3571
|
-
},
|
|
3572
|
-
var
|
|
3573
|
-
|
|
3562
|
+
const d = () => {
|
|
3563
|
+
x(), T();
|
|
3564
|
+
}, f = () => {
|
|
3565
|
+
p(), w();
|
|
3566
|
+
}, m = () => {
|
|
3567
|
+
de();
|
|
3568
|
+
}, x = () => {
|
|
3569
|
+
var y;
|
|
3570
|
+
let _;
|
|
3571
|
+
l.mapboxAccessToken ? _ = Ft({
|
|
3574
3572
|
id: l.id,
|
|
3575
3573
|
center: [0, 0],
|
|
3576
3574
|
style: "mapbox://styles/mapbox/streets-v11",
|
|
3577
3575
|
accessToken: l.mapboxAccessToken
|
|
3578
|
-
}).layer :
|
|
3579
|
-
source: new
|
|
3580
|
-
}), (
|
|
3581
|
-
},
|
|
3582
|
-
var
|
|
3583
|
-
(
|
|
3584
|
-
},
|
|
3585
|
-
var
|
|
3586
|
-
(
|
|
3587
|
-
l.onSelect && l.onSelect(
|
|
3576
|
+
}).layer : _ = new Nt({
|
|
3577
|
+
source: new Ui()
|
|
3578
|
+
}), (y = e.current) == null || y.addLayer(_);
|
|
3579
|
+
}, T = () => {
|
|
3580
|
+
var _;
|
|
3581
|
+
(_ = e.current) == null || _.addLayer(s.layer);
|
|
3582
|
+
}, p = () => {
|
|
3583
|
+
var _;
|
|
3584
|
+
(_ = e.current) == null || _.addInteraction(s.select), s.select.on("select", function() {
|
|
3585
|
+
l.onSelect && l.onSelect(s.select.getFeatures().getArray());
|
|
3588
3586
|
});
|
|
3589
|
-
},
|
|
3590
|
-
var
|
|
3591
|
-
(
|
|
3587
|
+
}, w = () => {
|
|
3588
|
+
var _;
|
|
3589
|
+
(_ = e.current) == null || _.addInteraction(s.modify), s.modify.on("modifyend", () => {
|
|
3592
3590
|
setTimeout(() => {
|
|
3593
|
-
l.onDrawEnd && l.onDrawEnd(
|
|
3594
|
-
}, 250),
|
|
3591
|
+
l.onDrawEnd && l.onDrawEnd(i.getFeatures());
|
|
3592
|
+
}, 250), j();
|
|
3595
3593
|
});
|
|
3596
|
-
},
|
|
3597
|
-
var
|
|
3598
|
-
(
|
|
3594
|
+
}, de = async () => {
|
|
3595
|
+
var _;
|
|
3596
|
+
(_ = e.current) == null || _.on(
|
|
3599
3597
|
"contextmenu",
|
|
3600
3598
|
async (y) => {
|
|
3601
|
-
var
|
|
3599
|
+
var X;
|
|
3602
3600
|
y.preventDefault();
|
|
3603
|
-
const
|
|
3604
|
-
if (
|
|
3605
|
-
const
|
|
3606
|
-
if (
|
|
3607
|
-
|
|
3601
|
+
const E = (X = e.current) == null ? void 0 : X.getEventPixel(y.originalEvent);
|
|
3602
|
+
if (E) {
|
|
3603
|
+
const O = await s.layer.getFeatures(E);
|
|
3604
|
+
if (O && O.length > 0) {
|
|
3605
|
+
u({
|
|
3608
3606
|
open: !0,
|
|
3609
3607
|
buttons: [
|
|
3610
3608
|
{
|
|
3611
3609
|
label: "Delete",
|
|
3612
3610
|
onClick: () => {
|
|
3613
|
-
|
|
3614
|
-
(
|
|
3615
|
-
),
|
|
3616
|
-
l.onDrawEnd && l.onDrawEnd(
|
|
3611
|
+
O.forEach(
|
|
3612
|
+
(Tt) => mt(Tt)
|
|
3613
|
+
), je(), setTimeout(() => {
|
|
3614
|
+
l.onDrawEnd && l.onDrawEnd(i.getFeatures());
|
|
3617
3615
|
}, 250);
|
|
3618
3616
|
}
|
|
3619
3617
|
}
|
|
3620
3618
|
],
|
|
3621
3619
|
position: {
|
|
3622
|
-
top:
|
|
3623
|
-
left:
|
|
3620
|
+
top: E[1],
|
|
3621
|
+
left: E[0]
|
|
3624
3622
|
}
|
|
3625
3623
|
});
|
|
3626
3624
|
return;
|
|
3627
3625
|
}
|
|
3628
3626
|
}
|
|
3629
|
-
|
|
3627
|
+
je();
|
|
3630
3628
|
}
|
|
3631
3629
|
);
|
|
3632
|
-
},
|
|
3633
|
-
var
|
|
3634
|
-
|
|
3635
|
-
const y = new
|
|
3636
|
-
source:
|
|
3637
|
-
type:
|
|
3638
|
-
}),
|
|
3630
|
+
}, k = (_) => {
|
|
3631
|
+
var X, O;
|
|
3632
|
+
j();
|
|
3633
|
+
const y = new _i({
|
|
3634
|
+
source: i,
|
|
3635
|
+
type: _
|
|
3636
|
+
}), E = new Ti({ source: i });
|
|
3639
3637
|
y.on("drawend", () => {
|
|
3640
3638
|
setTimeout(() => {
|
|
3641
|
-
l.onDrawEnd && l.onDrawEnd(
|
|
3642
|
-
}, 250),
|
|
3643
|
-
}),
|
|
3644
|
-
},
|
|
3645
|
-
var
|
|
3646
|
-
|
|
3647
|
-
},
|
|
3648
|
-
const y = Ue(
|
|
3649
|
-
y &&
|
|
3650
|
-
},
|
|
3651
|
-
const y = ze(
|
|
3652
|
-
y &&
|
|
3653
|
-
},
|
|
3654
|
-
|
|
3655
|
-
},
|
|
3656
|
-
|
|
3657
|
-
},
|
|
3658
|
-
|
|
3639
|
+
l.onDrawEnd && l.onDrawEnd(i.getFeatures());
|
|
3640
|
+
}, 250), j(), o("Pointer");
|
|
3641
|
+
}), s.draw = y, s.snap = E, (X = e.current) == null || X.addInteraction(y), (O = e.current) == null || O.addInteraction(E);
|
|
3642
|
+
}, j = () => {
|
|
3643
|
+
var _, y;
|
|
3644
|
+
s.draw && ((_ = e.current) == null || _.removeInteraction(s.draw)), s.snap && ((y = e.current) == null || y.removeInteraction(s.snap));
|
|
3645
|
+
}, Ie = (_) => {
|
|
3646
|
+
const y = Ue(_);
|
|
3647
|
+
y && i.addFeatures(y);
|
|
3648
|
+
}, ge = (_) => {
|
|
3649
|
+
const y = ze(_, Zt);
|
|
3650
|
+
y && i.addFeatures(y);
|
|
3651
|
+
}, fe = () => {
|
|
3652
|
+
i.clear();
|
|
3653
|
+
}, mt = (_) => {
|
|
3654
|
+
i.removeFeature(_);
|
|
3655
|
+
}, je = () => {
|
|
3656
|
+
u({
|
|
3659
3657
|
open: !1,
|
|
3660
3658
|
buttons: []
|
|
3661
3659
|
});
|
|
3662
3660
|
}, _e = () => {
|
|
3663
|
-
|
|
3664
|
-
},
|
|
3665
|
-
var
|
|
3666
|
-
const y = Ue(
|
|
3667
|
-
y ? (_e(),
|
|
3668
|
-
},
|
|
3661
|
+
h((_) => !_);
|
|
3662
|
+
}, yt = (_) => {
|
|
3663
|
+
var E;
|
|
3664
|
+
const y = Ue(_);
|
|
3665
|
+
y ? (_e(), i.addFeatures(y), (E = e.current) == null || E.centerToFeature(y[0]), l.onDrawEnd && l.onDrawEnd(y)) : oi("Error!", "Feature(s) could not be loaded! Check your KML data!");
|
|
3666
|
+
}, xt = (_) => {
|
|
3669
3667
|
var y;
|
|
3670
|
-
(y = e.current) == null || y.setCenter(
|
|
3671
|
-
},
|
|
3668
|
+
(y = e.current) == null || y.setCenter(_);
|
|
3669
|
+
}, Ct = (_) => {
|
|
3672
3670
|
var y;
|
|
3673
|
-
(y = e.current) == null || y.setZoomLevel(
|
|
3674
|
-
},
|
|
3675
|
-
var
|
|
3676
|
-
(
|
|
3677
|
-
},
|
|
3671
|
+
(y = e.current) == null || y.setZoomLevel(_);
|
|
3672
|
+
}, me = (_, y = [0, 0, 0, 0]) => {
|
|
3673
|
+
var E;
|
|
3674
|
+
(E = e.current) == null || E.centerToFeature(_, y);
|
|
3675
|
+
}, ye = (_) => {
|
|
3678
3676
|
var y;
|
|
3679
|
-
(y = e.current) == null || y.centerToExtent(
|
|
3677
|
+
(y = e.current) == null || y.centerToExtent(_);
|
|
3680
3678
|
};
|
|
3681
3679
|
return {
|
|
3682
3680
|
refs: {
|
|
3683
3681
|
mapRef: e
|
|
3684
3682
|
},
|
|
3685
3683
|
state: {
|
|
3686
|
-
activeDrawingTool:
|
|
3687
|
-
openAddKMLText:
|
|
3688
|
-
contextMenu:
|
|
3684
|
+
activeDrawingTool: r,
|
|
3685
|
+
openAddKMLText: a,
|
|
3686
|
+
contextMenu: c
|
|
3689
3687
|
},
|
|
3690
3688
|
action: {
|
|
3691
|
-
setActiveDrawingTool:
|
|
3692
|
-
addInteractions:
|
|
3693
|
-
addDrawingSourceKMLData:
|
|
3694
|
-
addDrawingSourceWKTData:
|
|
3695
|
-
clearDrawingSource:
|
|
3689
|
+
setActiveDrawingTool: o,
|
|
3690
|
+
addInteractions: k,
|
|
3691
|
+
addDrawingSourceKMLData: Ie,
|
|
3692
|
+
addDrawingSourceWKTData: ge,
|
|
3693
|
+
clearDrawingSource: fe,
|
|
3696
3694
|
toggleAddKMLText: _e,
|
|
3697
|
-
addKMLText:
|
|
3698
|
-
setContextMenu:
|
|
3699
|
-
setCenter:
|
|
3700
|
-
setZoomLevel:
|
|
3701
|
-
centerToFeature:
|
|
3702
|
-
centerToExtent:
|
|
3703
|
-
onMapInit:
|
|
3695
|
+
addKMLText: yt,
|
|
3696
|
+
setContextMenu: u,
|
|
3697
|
+
setCenter: xt,
|
|
3698
|
+
setZoomLevel: Ct,
|
|
3699
|
+
centerToFeature: me,
|
|
3700
|
+
centerToExtent: ye,
|
|
3701
|
+
onMapInit: g
|
|
3704
3702
|
}
|
|
3705
3703
|
};
|
|
3706
3704
|
}
|
|
3707
3705
|
export {
|
|
3708
|
-
|
|
3706
|
+
$i as default
|
|
3709
3707
|
};
|