@hybridcore/ui 1.5.30 → 1.5.32
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/{Source-CnCcu5UP.js → Source-BESIjd9X.js} +770 -761
- package/dist/{Text-BT5kPHOo.js → Text-Cl1H4b0h.js} +47 -43
- package/dist/components/geometry-picker/coordinate/index.js +1 -1
- package/dist/components/geometry-picker/edit/index.js +42 -57
- package/dist/components/geometry-picker/geometry/index.js +1 -1
- package/dist/components/geometry-picker/geometry/map-overlay.js +1 -1
- package/dist/components/geometry-picker/index.js +31 -32
- package/dist/components/geometry-picker/kml/index.js +7 -7
- package/dist/components/geometry-picker/map/logic.js +2025 -680
- package/dist/components/geometry-picker/map/style.js +1 -1
- package/dist/components/geometry-picker/parser/coordinate-input/index.js +2 -2
- package/dist/components/geometry-picker/parser/coordinate-input/logic.js +122 -135
- package/dist/components/map/helpers/mapbox.js +1 -1
- package/dist/components/map/helpers/ol.js +6 -6
- package/dist/components/map/logic.js +3 -3
- package/dist/components/map/styled.js +31 -41
- package/dist/components/property-mapping/index.js +1 -1
- package/dist/{has-9_asnBxn.js → has-DNclCIDV.js} +99 -81
- package/dist/main.d.ts +2 -2
- package/dist/{ol-9hySGI6D.js → ol-lGwSyEIV.js} +331 -322
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createMapboxLayer as
|
|
3
|
-
import { I as
|
|
4
|
-
import {
|
|
5
|
-
import { c as
|
|
6
|
-
import { defaultStyle as
|
|
7
|
-
import {
|
|
8
|
-
import { alert as
|
|
9
|
-
const
|
|
1
|
+
import v from "react";
|
|
2
|
+
import { createMapboxLayer as Tt } from "../../map/helpers/mapbox.js";
|
|
3
|
+
import { I as Ft, s as Ye, n as we, e as We, C as Pe, f as A, V as ge, F as G, P as De, p as pt, h as Et, i as Le, R as He, j as Me, k as he, M as D, l as St, m as wt, o as Pt, q as Lt, L as le, r as Dt, t as $e, u as Je, G as Mt, T as kt, v as z, w as j, x as Gt, y as vt, z as Rt, a as Oe, A as Ue, B as At } from "../../../ol-lGwSyEIV.js";
|
|
4
|
+
import { e as ce, g as C, b as bt, f as ze, h as J, E as $, i as It, F as Qe, t as jt, s as et, c as tt, j as Y, u as me, a as M, k as Ot, m as Ut, n as ee, o as te, d as zt, p as Kt } from "../../../has-DNclCIDV.js";
|
|
5
|
+
import { c as ke, t as I, s as Nt } from "../../../Text-Cl1H4b0h.js";
|
|
6
|
+
import { defaultStyle as Vt, selectStyleFunction as Xt, markerStyle as Zt } from "./style.js";
|
|
7
|
+
import { b as P, c as ye, P as W, d as ue, f as p, e as b, g as de, h as qt, i as it, j as nt, s as O, k as st, l as Bt, m as Ke, n as rt, o as Yt, p as Wt, q as Ht, r as $t, D as ot, u as at, v as Jt, w as Ge, x as Qt, y as lt, M as ei, z as ti, A as ii, B as ni, S as si, C as N } from "../../../Source-BESIjd9X.js";
|
|
8
|
+
import { alert as ri } from "../../confirm/index.js";
|
|
9
|
+
const oi = {
|
|
10
10
|
/**
|
|
11
11
|
* Triggered when feature(s) has been (de)selected.
|
|
12
12
|
* @event SelectEvent#select
|
|
@@ -14,7 +14,7 @@ const pt = {
|
|
|
14
14
|
*/
|
|
15
15
|
SELECT: "select"
|
|
16
16
|
};
|
|
17
|
-
class
|
|
17
|
+
class ai extends J {
|
|
18
18
|
/**
|
|
19
19
|
* @param {SelectEventType} type The event type.
|
|
20
20
|
* @param {Array<import("../Feature.js").default>} selected Selected features.
|
|
@@ -22,29 +22,29 @@ class Ct extends ne {
|
|
|
22
22
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Associated
|
|
23
23
|
* {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
|
|
24
24
|
*/
|
|
25
|
-
constructor(e, t,
|
|
26
|
-
super(e), this.selected = t, this.deselected =
|
|
25
|
+
constructor(e, t, i, n) {
|
|
26
|
+
super(e), this.selected = t, this.deselected = i, this.mapBrowserEvent = n;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
class
|
|
29
|
+
const ie = {};
|
|
30
|
+
class ve extends Ft {
|
|
31
31
|
/**
|
|
32
32
|
* @param {Options} [options] Options.
|
|
33
33
|
*/
|
|
34
34
|
constructor(e) {
|
|
35
|
-
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 :
|
|
35
|
+
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 : Ye, this.addCondition_ = e.addCondition ? e.addCondition : we, this.removeCondition_ = e.removeCondition ? e.removeCondition : we, this.toggleCondition_ = e.toggleCondition ? e.toggleCondition : We, this.multi_ = e.multi ? e.multi : !1, this.filter_ = e.filter ? e.filter : ce, this.hitTolerance_ = e.hitTolerance ? e.hitTolerance : 0, this.style_ = e.style !== void 0 ? e.style : li(), this.features_ = e.features || new Pe();
|
|
36
36
|
let t;
|
|
37
37
|
if (e.layers)
|
|
38
38
|
if (typeof e.layers == "function")
|
|
39
39
|
t = e.layers;
|
|
40
40
|
else {
|
|
41
|
-
const
|
|
42
|
-
t = function(
|
|
43
|
-
return
|
|
41
|
+
const i = e.layers;
|
|
42
|
+
t = function(n) {
|
|
43
|
+
return i.includes(n);
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
else
|
|
47
|
-
t =
|
|
47
|
+
t = ce;
|
|
48
48
|
this.layerFilter_ = t, this.featureLayerAssociation_ = {};
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
@@ -53,7 +53,7 @@ class pe extends $e {
|
|
|
53
53
|
* @private
|
|
54
54
|
*/
|
|
55
55
|
addFeatureLayerAssociation_(e, t) {
|
|
56
|
-
this.featureLayerAssociation_[
|
|
56
|
+
this.featureLayerAssociation_[C(e)] = t;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Get the selected features.
|
|
@@ -81,7 +81,7 @@ class pe extends $e {
|
|
|
81
81
|
getLayer(e) {
|
|
82
82
|
return (
|
|
83
83
|
/** @type {import('../layer/Vector.js').default} */
|
|
84
|
-
this.featureLayerAssociation_[
|
|
84
|
+
this.featureLayerAssociation_[C(e)]
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
@@ -101,16 +101,16 @@ class pe extends $e {
|
|
|
101
101
|
*/
|
|
102
102
|
setMap(e) {
|
|
103
103
|
this.getMap() && this.style_ && this.features_.forEach(this.restorePreviousStyle_.bind(this)), super.setMap(e), e ? (this.features_.addEventListener(
|
|
104
|
-
|
|
104
|
+
A.ADD,
|
|
105
105
|
this.boundAddFeature_
|
|
106
106
|
), this.features_.addEventListener(
|
|
107
|
-
|
|
107
|
+
A.REMOVE,
|
|
108
108
|
this.boundRemoveFeature_
|
|
109
109
|
), this.style_ && this.features_.forEach(this.applySelectedStyle_.bind(this))) : (this.features_.removeEventListener(
|
|
110
|
-
|
|
110
|
+
A.ADD,
|
|
111
111
|
this.boundAddFeature_
|
|
112
112
|
), this.features_.removeEventListener(
|
|
113
|
-
|
|
113
|
+
A.REMOVE,
|
|
114
114
|
this.boundRemoveFeature_
|
|
115
115
|
));
|
|
116
116
|
}
|
|
@@ -121,14 +121,14 @@ class pe extends $e {
|
|
|
121
121
|
addFeature_(e) {
|
|
122
122
|
const t = e.element;
|
|
123
123
|
if (this.style_ && this.applySelectedStyle_(t), !this.getLayer(t)) {
|
|
124
|
-
const
|
|
124
|
+
const i = (
|
|
125
125
|
/** @type {VectorLayer} */
|
|
126
|
-
this.getMap().getAllLayers().find(function(
|
|
127
|
-
if (
|
|
128
|
-
return
|
|
126
|
+
this.getMap().getAllLayers().find(function(n) {
|
|
127
|
+
if (n instanceof ge && n.getSource() && n.getSource().hasFeature(t))
|
|
128
|
+
return n;
|
|
129
129
|
})
|
|
130
130
|
);
|
|
131
|
-
|
|
131
|
+
i && this.addFeatureLayerAssociation_(t, i);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
@@ -149,8 +149,8 @@ class pe extends $e {
|
|
|
149
149
|
* @private
|
|
150
150
|
*/
|
|
151
151
|
applySelectedStyle_(e) {
|
|
152
|
-
const t =
|
|
153
|
-
t in
|
|
152
|
+
const t = C(e);
|
|
153
|
+
t in ie || (ie[t] = e.getStyle()), e.setStyle(this.style_);
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* @param {Feature} feature Feature
|
|
@@ -158,22 +158,22 @@ class pe extends $e {
|
|
|
158
158
|
*/
|
|
159
159
|
restorePreviousStyle_(e) {
|
|
160
160
|
const t = this.getMap().getInteractions().getArray();
|
|
161
|
-
for (let
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
164
|
-
e.setStyle(
|
|
161
|
+
for (let n = t.length - 1; n >= 0; --n) {
|
|
162
|
+
const s = t[n];
|
|
163
|
+
if (s !== this && s instanceof ve && s.getStyle() && s.getFeatures().getArray().lastIndexOf(e) !== -1) {
|
|
164
|
+
e.setStyle(s.getStyle());
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
const
|
|
169
|
-
e.setStyle(
|
|
168
|
+
const i = C(e);
|
|
169
|
+
e.setStyle(ie[i]), delete ie[i];
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* @param {Feature} feature Feature.
|
|
173
173
|
* @private
|
|
174
174
|
*/
|
|
175
175
|
removeFeatureLayerAssociation_(e) {
|
|
176
|
-
delete this.featureLayerAssociation_[
|
|
176
|
+
delete this.featureLayerAssociation_[C(e)];
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
179
|
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may change the
|
|
@@ -184,18 +184,18 @@ class pe extends $e {
|
|
|
184
184
|
handleEvent(e) {
|
|
185
185
|
if (!this.condition_(e))
|
|
186
186
|
return !0;
|
|
187
|
-
const t = this.addCondition_(e),
|
|
188
|
-
if (
|
|
189
|
-
|
|
187
|
+
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 = [];
|
|
188
|
+
if (s) {
|
|
189
|
+
bt(this.featureLayerAssociation_), r.forEachFeatureAtPixel(
|
|
190
190
|
e.pixel,
|
|
191
191
|
/**
|
|
192
192
|
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
|
193
193
|
* @param {import("../layer/Layer.js").default} layer Layer.
|
|
194
194
|
* @return {boolean|undefined} Continue to iterate over the features.
|
|
195
195
|
*/
|
|
196
|
-
(c,
|
|
197
|
-
if (!(!(c instanceof
|
|
198
|
-
return this.addFeatureLayerAssociation_(c,
|
|
196
|
+
(c, u) => {
|
|
197
|
+
if (!(!(c instanceof G) || !this.filter_(c, u)))
|
|
198
|
+
return this.addFeatureLayerAssociation_(c, u), h.push(c), !this.multi_;
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
201
|
layerFilter: this.layerFilter_,
|
|
@@ -203,8 +203,8 @@ class pe extends $e {
|
|
|
203
203
|
}
|
|
204
204
|
);
|
|
205
205
|
for (let c = o.getLength() - 1; c >= 0; --c) {
|
|
206
|
-
const
|
|
207
|
-
g > -1 ? h.splice(g, 1) : (o.remove(
|
|
206
|
+
const u = o.item(c), g = h.indexOf(u);
|
|
207
|
+
g > -1 ? h.splice(g, 1) : (o.remove(u), a.push(u));
|
|
208
208
|
}
|
|
209
209
|
h.length !== 0 && o.extend(h);
|
|
210
210
|
} else {
|
|
@@ -215,9 +215,9 @@ class pe extends $e {
|
|
|
215
215
|
* @param {import("../layer/Layer.js").default} layer Layer.
|
|
216
216
|
* @return {boolean|undefined} Continue to iterate over the features.
|
|
217
217
|
*/
|
|
218
|
-
(c,
|
|
219
|
-
if (!(!(c instanceof
|
|
220
|
-
return (t ||
|
|
218
|
+
(c, u) => {
|
|
219
|
+
if (!(!(c instanceof G) || !this.filter_(c, u)))
|
|
220
|
+
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_;
|
|
221
221
|
},
|
|
222
222
|
{
|
|
223
223
|
layerFilter: this.layerFilter_,
|
|
@@ -229,8 +229,8 @@ class pe extends $e {
|
|
|
229
229
|
o.extend(h);
|
|
230
230
|
}
|
|
231
231
|
return (h.length > 0 || a.length > 0) && this.dispatchEvent(
|
|
232
|
-
new
|
|
233
|
-
|
|
232
|
+
new ai(
|
|
233
|
+
oi.SELECT,
|
|
234
234
|
h,
|
|
235
235
|
a,
|
|
236
236
|
e
|
|
@@ -238,13 +238,13 @@ class pe extends $e {
|
|
|
238
238
|
), !0;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
function
|
|
242
|
-
const l =
|
|
243
|
-
return
|
|
241
|
+
function li() {
|
|
242
|
+
const l = ke();
|
|
243
|
+
return ze(l.Polygon, l.LineString), ze(l.GeometryCollection, l.LineString), function(e) {
|
|
244
244
|
return e.getGeometry() ? l[e.getGeometry().getType()] : null;
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
|
-
const
|
|
247
|
+
const Ne = 0, H = 1, Ve = [0, 0, 0, 0], Z = [], xe = {
|
|
248
248
|
/**
|
|
249
249
|
* Triggered upon feature modification start
|
|
250
250
|
* @event ModifyEvent#modifystart
|
|
@@ -258,7 +258,7 @@ const Pe = 0, K = 1, we = [0, 0, 0, 0], N = [], he = {
|
|
|
258
258
|
*/
|
|
259
259
|
MODIFYEND: "modifyend"
|
|
260
260
|
};
|
|
261
|
-
class
|
|
261
|
+
class Ce extends J {
|
|
262
262
|
/**
|
|
263
263
|
* @param {ModifyEventType} type Type.
|
|
264
264
|
* @param {Collection<Feature>} features
|
|
@@ -266,11 +266,11 @@ class ce extends ne {
|
|
|
266
266
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent
|
|
267
267
|
* Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
|
|
268
268
|
*/
|
|
269
|
-
constructor(e, t,
|
|
270
|
-
super(e), this.features = t, this.mapBrowserEvent =
|
|
269
|
+
constructor(e, t, i) {
|
|
270
|
+
super(e), this.features = t, this.mapBrowserEvent = i;
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
class
|
|
273
|
+
class hi extends De {
|
|
274
274
|
/**
|
|
275
275
|
* @param {Options} options Options.
|
|
276
276
|
*/
|
|
@@ -278,14 +278,14 @@ class Tt extends me {
|
|
|
278
278
|
super(
|
|
279
279
|
/** @type {import("./Pointer.js").Options} */
|
|
280
280
|
e
|
|
281
|
-
), this.on, this.once, this.un, this.boundHandleFeatureChange_ = this.handleFeatureChange_.bind(this), this.condition_ = e.condition ? e.condition :
|
|
282
|
-
return
|
|
283
|
-
}, this.deleteCondition_ = e.deleteCondition ? e.deleteCondition : this.defaultDeleteCondition_, this.insertVertexCondition_ = e.insertVertexCondition ? e.insertVertexCondition :
|
|
284
|
-
source: new
|
|
281
|
+
), this.on, this.once, this.un, this.boundHandleFeatureChange_ = this.handleFeatureChange_.bind(this), this.condition_ = e.condition ? e.condition : pt, this.defaultDeleteCondition_ = function(i) {
|
|
282
|
+
return Et(i) && Ye(i);
|
|
283
|
+
}, this.deleteCondition_ = e.deleteCondition ? e.deleteCondition : this.defaultDeleteCondition_, this.insertVertexCondition_ = e.insertVertexCondition ? e.insertVertexCondition : Le, this.vertexFeature_ = null, this.vertexSegments_ = null, this.lastPixel_ = [0, 0], this.ignoreNextSingleClick_ = !1, this.featuresBeingModified_ = null, this.rBush_ = new He(), this.pixelTolerance_ = e.pixelTolerance !== void 0 ? e.pixelTolerance : 10, this.snappedToVertex_ = !1, this.changingFeature_ = !1, this.dragSegments_ = [], this.overlay_ = new ge({
|
|
284
|
+
source: new Me({
|
|
285
285
|
useSpatialIndex: !1,
|
|
286
286
|
wrapX: !!e.wrapX
|
|
287
287
|
}),
|
|
288
|
-
style: e.style ? e.style :
|
|
288
|
+
style: e.style ? e.style : ui(),
|
|
289
289
|
updateWhileAnimating: !0,
|
|
290
290
|
updateWhileInteracting: !0
|
|
291
291
|
}), this.SEGMENT_WRITERS_ = {
|
|
@@ -300,21 +300,21 @@ class Tt extends me {
|
|
|
300
300
|
GeometryCollection: this.writeGeometryCollectionGeometry_.bind(this)
|
|
301
301
|
}, this.source_ = null, this.hitDetection_ = null;
|
|
302
302
|
let t;
|
|
303
|
-
if (e.features ? t = e.features : e.source && (this.source_ = e.source, t = new
|
|
304
|
-
|
|
303
|
+
if (e.features ? t = e.features : e.source && (this.source_ = e.source, t = new Pe(this.source_.getFeatures()), this.source_.addEventListener(
|
|
304
|
+
he.ADDFEATURE,
|
|
305
305
|
this.handleSourceAdd_.bind(this)
|
|
306
306
|
), this.source_.addEventListener(
|
|
307
|
-
|
|
307
|
+
he.REMOVEFEATURE,
|
|
308
308
|
this.handleSourceRemove_.bind(this)
|
|
309
309
|
)), !t)
|
|
310
310
|
throw new Error(
|
|
311
311
|
"The modify interaction requires features, a source or a layer"
|
|
312
312
|
);
|
|
313
313
|
e.hitDetection && (this.hitDetection_ = e.hitDetection), this.features_ = t, this.features_.forEach(this.addFeature_.bind(this)), this.features_.addEventListener(
|
|
314
|
-
|
|
314
|
+
A.ADD,
|
|
315
315
|
this.handleFeatureAdd_.bind(this)
|
|
316
316
|
), this.features_.addEventListener(
|
|
317
|
-
|
|
317
|
+
A.REMOVE,
|
|
318
318
|
this.handleFeatureRemove_.bind(this)
|
|
319
319
|
), this.lastPointerEvent_ = null, this.delta_ = [0, 0], this.snapToPointer_ = e.snapToPointer === void 0 ? !this.hitDetection_ : e.snapToPointer;
|
|
320
320
|
}
|
|
@@ -325,11 +325,11 @@ class Tt extends me {
|
|
|
325
325
|
addFeature_(e) {
|
|
326
326
|
const t = e.getGeometry();
|
|
327
327
|
if (t) {
|
|
328
|
-
const
|
|
329
|
-
|
|
328
|
+
const n = this.SEGMENT_WRITERS_[t.getType()];
|
|
329
|
+
n && n(e, t);
|
|
330
330
|
}
|
|
331
|
-
const
|
|
332
|
-
|
|
331
|
+
const i = this.getMap();
|
|
332
|
+
i && i.isRendered() && this.getActive() && this.handlePointerAtPixel_(this.lastPixel_, i), e.addEventListener($.CHANGE, this.boundHandleFeatureChange_);
|
|
333
333
|
}
|
|
334
334
|
/**
|
|
335
335
|
* @param {import("../MapBrowserEvent.js").default} evt Map browser event.
|
|
@@ -338,18 +338,18 @@ class Tt extends me {
|
|
|
338
338
|
*/
|
|
339
339
|
willModifyFeatures_(e, t) {
|
|
340
340
|
if (!this.featuresBeingModified_) {
|
|
341
|
-
this.featuresBeingModified_ = new
|
|
342
|
-
const
|
|
343
|
-
for (let
|
|
344
|
-
const r = t[
|
|
341
|
+
this.featuresBeingModified_ = new Pe();
|
|
342
|
+
const i = this.featuresBeingModified_.getArray();
|
|
343
|
+
for (let n = 0, s = t.length; n < s; ++n) {
|
|
344
|
+
const r = t[n];
|
|
345
345
|
for (let o = 0, a = r.length; o < a; ++o) {
|
|
346
346
|
const h = r[o].feature;
|
|
347
|
-
h && !
|
|
347
|
+
h && !i.includes(h) && this.featuresBeingModified_.push(h);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
this.featuresBeingModified_.getLength() === 0 ? this.featuresBeingModified_ = null : this.dispatchEvent(
|
|
351
|
-
new
|
|
352
|
-
|
|
351
|
+
new Ce(
|
|
352
|
+
xe.MODIFYSTART,
|
|
353
353
|
this.featuresBeingModified_,
|
|
354
354
|
e
|
|
355
355
|
)
|
|
@@ -362,7 +362,7 @@ class Tt extends me {
|
|
|
362
362
|
*/
|
|
363
363
|
removeFeature_(e) {
|
|
364
364
|
this.removeFeatureSegmentData_(e), this.vertexFeature_ && this.features_.getLength() === 0 && (this.overlay_.getSource().removeFeature(this.vertexFeature_), this.vertexFeature_ = null), e.removeEventListener(
|
|
365
|
-
|
|
365
|
+
$.CHANGE,
|
|
366
366
|
this.boundHandleFeatureChange_
|
|
367
367
|
);
|
|
368
368
|
}
|
|
@@ -371,20 +371,20 @@ class Tt extends me {
|
|
|
371
371
|
* @private
|
|
372
372
|
*/
|
|
373
373
|
removeFeatureSegmentData_(e) {
|
|
374
|
-
const t = this.rBush_,
|
|
374
|
+
const t = this.rBush_, i = [];
|
|
375
375
|
t.forEach(
|
|
376
376
|
/**
|
|
377
377
|
* @param {SegmentData} node RTree node.
|
|
378
378
|
*/
|
|
379
|
-
function(
|
|
380
|
-
e ===
|
|
379
|
+
function(n) {
|
|
380
|
+
e === n.feature && i.push(n);
|
|
381
381
|
}
|
|
382
382
|
);
|
|
383
|
-
for (let
|
|
384
|
-
const
|
|
383
|
+
for (let n = i.length - 1; n >= 0; --n) {
|
|
384
|
+
const s = i[n];
|
|
385
385
|
for (let r = this.dragSegments_.length - 1; r >= 0; --r)
|
|
386
|
-
this.dragSegments_[r][0] ===
|
|
387
|
-
t.remove(
|
|
386
|
+
this.dragSegments_[r][0] === s && this.dragSegments_.splice(r, 1);
|
|
387
|
+
t.remove(s);
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
/**
|
|
@@ -460,12 +460,12 @@ class Tt extends me {
|
|
|
460
460
|
* @private
|
|
461
461
|
*/
|
|
462
462
|
writePointGeometry_(e, t) {
|
|
463
|
-
const
|
|
463
|
+
const i = t.getCoordinates(), n = {
|
|
464
464
|
feature: e,
|
|
465
465
|
geometry: t,
|
|
466
|
-
segment: [
|
|
466
|
+
segment: [i, i]
|
|
467
467
|
};
|
|
468
|
-
this.rBush_.insert(t.getExtent(),
|
|
468
|
+
this.rBush_.insert(t.getExtent(), n);
|
|
469
469
|
}
|
|
470
470
|
/**
|
|
471
471
|
* @param {Feature} feature Feature
|
|
@@ -473,13 +473,13 @@ class Tt extends me {
|
|
|
473
473
|
* @private
|
|
474
474
|
*/
|
|
475
475
|
writeMultiPointGeometry_(e, t) {
|
|
476
|
-
const
|
|
477
|
-
for (let
|
|
478
|
-
const r =
|
|
476
|
+
const i = t.getCoordinates();
|
|
477
|
+
for (let n = 0, s = i.length; n < s; ++n) {
|
|
478
|
+
const r = i[n], o = {
|
|
479
479
|
feature: e,
|
|
480
480
|
geometry: t,
|
|
481
|
-
depth: [
|
|
482
|
-
index:
|
|
481
|
+
depth: [n],
|
|
482
|
+
index: n,
|
|
483
483
|
segment: [r, r]
|
|
484
484
|
};
|
|
485
485
|
this.rBush_.insert(t.getExtent(), o);
|
|
@@ -491,15 +491,15 @@ class Tt extends me {
|
|
|
491
491
|
* @private
|
|
492
492
|
*/
|
|
493
493
|
writeLineStringGeometry_(e, t) {
|
|
494
|
-
const
|
|
495
|
-
for (let
|
|
496
|
-
const r =
|
|
494
|
+
const i = t.getCoordinates();
|
|
495
|
+
for (let n = 0, s = i.length - 1; n < s; ++n) {
|
|
496
|
+
const r = i.slice(n, n + 2), o = {
|
|
497
497
|
feature: e,
|
|
498
498
|
geometry: t,
|
|
499
|
-
index:
|
|
499
|
+
index: n,
|
|
500
500
|
segment: r
|
|
501
501
|
};
|
|
502
|
-
this.rBush_.insert(
|
|
502
|
+
this.rBush_.insert(P(r), o);
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
/**
|
|
@@ -508,18 +508,18 @@ class Tt extends me {
|
|
|
508
508
|
* @private
|
|
509
509
|
*/
|
|
510
510
|
writeMultiLineStringGeometry_(e, t) {
|
|
511
|
-
const
|
|
512
|
-
for (let
|
|
513
|
-
const r =
|
|
511
|
+
const i = t.getCoordinates();
|
|
512
|
+
for (let n = 0, s = i.length; n < s; ++n) {
|
|
513
|
+
const r = i[n];
|
|
514
514
|
for (let o = 0, a = r.length - 1; o < a; ++o) {
|
|
515
515
|
const h = r.slice(o, o + 2), c = {
|
|
516
516
|
feature: e,
|
|
517
517
|
geometry: t,
|
|
518
|
-
depth: [
|
|
518
|
+
depth: [n],
|
|
519
519
|
index: o,
|
|
520
520
|
segment: h
|
|
521
521
|
};
|
|
522
|
-
this.rBush_.insert(
|
|
522
|
+
this.rBush_.insert(P(h), c);
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
}
|
|
@@ -529,18 +529,18 @@ class Tt extends me {
|
|
|
529
529
|
* @private
|
|
530
530
|
*/
|
|
531
531
|
writePolygonGeometry_(e, t) {
|
|
532
|
-
const
|
|
533
|
-
for (let
|
|
534
|
-
const r =
|
|
532
|
+
const i = t.getCoordinates();
|
|
533
|
+
for (let n = 0, s = i.length; n < s; ++n) {
|
|
534
|
+
const r = i[n];
|
|
535
535
|
for (let o = 0, a = r.length - 1; o < a; ++o) {
|
|
536
536
|
const h = r.slice(o, o + 2), c = {
|
|
537
537
|
feature: e,
|
|
538
538
|
geometry: t,
|
|
539
|
-
depth: [
|
|
539
|
+
depth: [n],
|
|
540
540
|
index: o,
|
|
541
541
|
segment: h
|
|
542
542
|
};
|
|
543
|
-
this.rBush_.insert(
|
|
543
|
+
this.rBush_.insert(P(h), c);
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
}
|
|
@@ -550,20 +550,20 @@ class Tt extends me {
|
|
|
550
550
|
* @private
|
|
551
551
|
*/
|
|
552
552
|
writeMultiPolygonGeometry_(e, t) {
|
|
553
|
-
const
|
|
554
|
-
for (let
|
|
555
|
-
const r =
|
|
553
|
+
const i = t.getCoordinates();
|
|
554
|
+
for (let n = 0, s = i.length; n < s; ++n) {
|
|
555
|
+
const r = i[n];
|
|
556
556
|
for (let o = 0, a = r.length; o < a; ++o) {
|
|
557
557
|
const h = r[o];
|
|
558
|
-
for (let c = 0,
|
|
559
|
-
const g = h.slice(c, c + 2),
|
|
558
|
+
for (let c = 0, u = h.length - 1; c < u; ++c) {
|
|
559
|
+
const g = h.slice(c, c + 2), d = {
|
|
560
560
|
feature: e,
|
|
561
561
|
geometry: t,
|
|
562
|
-
depth: [o,
|
|
562
|
+
depth: [o, n],
|
|
563
563
|
index: c,
|
|
564
564
|
segment: g
|
|
565
565
|
};
|
|
566
|
-
this.rBush_.insert(
|
|
566
|
+
this.rBush_.insert(P(g), d);
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
569
|
}
|
|
@@ -580,23 +580,23 @@ class Tt extends me {
|
|
|
580
580
|
* @private
|
|
581
581
|
*/
|
|
582
582
|
writeCircleGeometry_(e, t) {
|
|
583
|
-
const
|
|
583
|
+
const i = t.getCenter(), n = {
|
|
584
584
|
feature: e,
|
|
585
585
|
geometry: t,
|
|
586
|
-
index:
|
|
587
|
-
segment: [
|
|
588
|
-
},
|
|
586
|
+
index: Ne,
|
|
587
|
+
segment: [i, i]
|
|
588
|
+
}, s = {
|
|
589
589
|
feature: e,
|
|
590
590
|
geometry: t,
|
|
591
|
-
index:
|
|
592
|
-
segment: [
|
|
593
|
-
}, r = [
|
|
594
|
-
|
|
591
|
+
index: H,
|
|
592
|
+
segment: [i, i]
|
|
593
|
+
}, r = [n, s];
|
|
594
|
+
n.featureSegments = r, s.featureSegments = r, this.rBush_.insert(ye(i), n);
|
|
595
595
|
let o = (
|
|
596
596
|
/** @type {import("../geom/Geometry.js").default} */
|
|
597
597
|
t
|
|
598
598
|
);
|
|
599
|
-
this.rBush_.insert(o.getExtent(),
|
|
599
|
+
this.rBush_.insert(o.getExtent(), s);
|
|
600
600
|
}
|
|
601
601
|
/**
|
|
602
602
|
* @param {Feature} feature Feature
|
|
@@ -604,10 +604,10 @@ class Tt extends me {
|
|
|
604
604
|
* @private
|
|
605
605
|
*/
|
|
606
606
|
writeGeometryCollectionGeometry_(e, t) {
|
|
607
|
-
const
|
|
608
|
-
for (let
|
|
609
|
-
const
|
|
610
|
-
r(e,
|
|
607
|
+
const i = t.getGeometriesArray();
|
|
608
|
+
for (let n = 0; n < i.length; ++n) {
|
|
609
|
+
const s = i[n], r = this.SEGMENT_WRITERS_[s.getType()];
|
|
610
|
+
r(e, s);
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
613
|
/**
|
|
@@ -617,9 +617,9 @@ class Tt extends me {
|
|
|
617
617
|
* @return {Feature} Vertex feature.
|
|
618
618
|
* @private
|
|
619
619
|
*/
|
|
620
|
-
createOrUpdateVertexFeature_(e, t,
|
|
621
|
-
let
|
|
622
|
-
return
|
|
620
|
+
createOrUpdateVertexFeature_(e, t, i) {
|
|
621
|
+
let n = this.vertexFeature_;
|
|
622
|
+
return n ? n.getGeometry().setCoordinates(e) : (n = new G(new W(e)), this.vertexFeature_ = n, this.overlay_.getSource().addFeature(n)), n.set("features", t), n.set("geometries", i), n;
|
|
623
623
|
}
|
|
624
624
|
/**
|
|
625
625
|
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may modify the geometry.
|
|
@@ -642,44 +642,44 @@ class Tt extends me {
|
|
|
642
642
|
const t = [
|
|
643
643
|
e.coordinate[0] + this.delta_[0],
|
|
644
644
|
e.coordinate[1] + this.delta_[1]
|
|
645
|
-
],
|
|
646
|
-
for (let
|
|
647
|
-
const o = this.dragSegments_[
|
|
648
|
-
|
|
645
|
+
], i = [], n = [];
|
|
646
|
+
for (let s = 0, r = this.dragSegments_.length; s < r; ++s) {
|
|
647
|
+
const o = this.dragSegments_[s], a = o[0], h = a.feature;
|
|
648
|
+
i.includes(h) || i.push(h);
|
|
649
649
|
const c = a.geometry;
|
|
650
|
-
|
|
651
|
-
const
|
|
650
|
+
n.includes(c) || n.push(c);
|
|
651
|
+
const u = a.depth;
|
|
652
652
|
let g;
|
|
653
|
-
const
|
|
653
|
+
const d = a.segment, f = o[1];
|
|
654
654
|
for (; t.length < c.getStride(); )
|
|
655
|
-
t.push(
|
|
655
|
+
t.push(d[f][t.length]);
|
|
656
656
|
switch (c.getType()) {
|
|
657
657
|
case "Point":
|
|
658
|
-
g = t,
|
|
658
|
+
g = t, d[0] = t, d[1] = t;
|
|
659
659
|
break;
|
|
660
660
|
case "MultiPoint":
|
|
661
|
-
g = c.getCoordinates(), g[a.index] = t,
|
|
661
|
+
g = c.getCoordinates(), g[a.index] = t, d[0] = t, d[1] = t;
|
|
662
662
|
break;
|
|
663
663
|
case "LineString":
|
|
664
|
-
g = c.getCoordinates(), g[a.index + f] = t,
|
|
664
|
+
g = c.getCoordinates(), g[a.index + f] = t, d[f] = t;
|
|
665
665
|
break;
|
|
666
666
|
case "MultiLineString":
|
|
667
|
-
g = c.getCoordinates(), g[
|
|
667
|
+
g = c.getCoordinates(), g[u[0]][a.index + f] = t, d[f] = t;
|
|
668
668
|
break;
|
|
669
669
|
case "Polygon":
|
|
670
|
-
g = c.getCoordinates(), g[
|
|
670
|
+
g = c.getCoordinates(), g[u[0]][a.index + f] = t, d[f] = t;
|
|
671
671
|
break;
|
|
672
672
|
case "MultiPolygon":
|
|
673
|
-
g = c.getCoordinates(), g[
|
|
673
|
+
g = c.getCoordinates(), g[u[1]][u[0]][a.index + f] = t, d[f] = t;
|
|
674
674
|
break;
|
|
675
675
|
case "Circle":
|
|
676
|
-
if (
|
|
676
|
+
if (d[0] = t, d[1] = t, a.index === Ne)
|
|
677
677
|
this.changingFeature_ = !0, c.setCenter(t), this.changingFeature_ = !1;
|
|
678
678
|
else {
|
|
679
679
|
this.changingFeature_ = !0, e.map.getView().getProjection();
|
|
680
|
-
let _ =
|
|
681
|
-
|
|
682
|
-
|
|
680
|
+
let _ = ue(
|
|
681
|
+
p(c.getCenter()),
|
|
682
|
+
p(t)
|
|
683
683
|
);
|
|
684
684
|
c.setRadius(_), this.changingFeature_ = !1;
|
|
685
685
|
}
|
|
@@ -687,7 +687,7 @@ class Tt extends me {
|
|
|
687
687
|
}
|
|
688
688
|
g && this.setGeometryCoordinates_(c, g);
|
|
689
689
|
}
|
|
690
|
-
this.createOrUpdateVertexFeature_(t,
|
|
690
|
+
this.createOrUpdateVertexFeature_(t, i, n);
|
|
691
691
|
}
|
|
692
692
|
/**
|
|
693
693
|
* Handle pointer down events.
|
|
@@ -699,50 +699,50 @@ class Tt extends me {
|
|
|
699
699
|
return !1;
|
|
700
700
|
const t = e.coordinate;
|
|
701
701
|
this.handlePointerAtPixel_(e.pixel, e.map, t), this.dragSegments_.length = 0, this.featuresBeingModified_ = null;
|
|
702
|
-
const
|
|
703
|
-
if (
|
|
702
|
+
const i = this.vertexFeature_;
|
|
703
|
+
if (i) {
|
|
704
704
|
e.map.getView().getProjection();
|
|
705
|
-
const
|
|
706
|
-
o.sort(
|
|
705
|
+
const n = [], s = i.getGeometry().getCoordinates(), r = P([s]), o = this.rBush_.getInExtent(r), a = {};
|
|
706
|
+
o.sort(ci);
|
|
707
707
|
for (let h = 0, c = o.length; h < c; ++h) {
|
|
708
|
-
const
|
|
709
|
-
let
|
|
710
|
-
const f =
|
|
711
|
-
if (f && (
|
|
712
|
-
const _ =
|
|
708
|
+
const u = o[h], g = u.segment;
|
|
709
|
+
let d = C(u.geometry);
|
|
710
|
+
const f = u.depth;
|
|
711
|
+
if (f && (d += "-" + f.join("-")), a[d] || (a[d] = new Array(2)), u.geometry.getType() === "Circle" && u.index === H) {
|
|
712
|
+
const _ = Ze(
|
|
713
713
|
t,
|
|
714
|
-
|
|
714
|
+
u
|
|
715
715
|
);
|
|
716
|
-
|
|
716
|
+
b(_, s) && !a[d][0] && (this.dragSegments_.push([u, 0]), a[d][0] = u);
|
|
717
717
|
continue;
|
|
718
718
|
}
|
|
719
|
-
if (
|
|
720
|
-
this.dragSegments_.push([
|
|
719
|
+
if (b(g[0], s) && !a[d][0]) {
|
|
720
|
+
this.dragSegments_.push([u, 0]), a[d][0] = u;
|
|
721
721
|
continue;
|
|
722
722
|
}
|
|
723
|
-
if (
|
|
724
|
-
if (a[
|
|
725
|
-
let _ =
|
|
726
|
-
switch (
|
|
723
|
+
if (b(g[1], s) && !a[d][1]) {
|
|
724
|
+
if (a[d][0] && a[d][0].index === 0) {
|
|
725
|
+
let _ = u.geometry.getCoordinates();
|
|
726
|
+
switch (u.geometry.getType()) {
|
|
727
727
|
case "LineString":
|
|
728
728
|
case "MultiLineString":
|
|
729
729
|
continue;
|
|
730
730
|
case "MultiPolygon":
|
|
731
731
|
_ = _[f[1]];
|
|
732
732
|
case "Polygon":
|
|
733
|
-
if (
|
|
733
|
+
if (u.index !== _[f[0]].length - 2)
|
|
734
734
|
continue;
|
|
735
735
|
break;
|
|
736
736
|
}
|
|
737
737
|
}
|
|
738
|
-
this.dragSegments_.push([
|
|
738
|
+
this.dragSegments_.push([u, 1]), a[d][1] = u;
|
|
739
739
|
continue;
|
|
740
740
|
}
|
|
741
|
-
|
|
741
|
+
C(g) in this.vertexSegments_ && !a[d][0] && !a[d][1] && this.insertVertexCondition_(e) && n.push(u);
|
|
742
742
|
}
|
|
743
|
-
|
|
744
|
-
for (let h =
|
|
745
|
-
this.insertVertex_(
|
|
743
|
+
n.length && this.willModifyFeatures_(e, [n]);
|
|
744
|
+
for (let h = n.length - 1; h >= 0; --h)
|
|
745
|
+
this.insertVertex_(n[h], s);
|
|
746
746
|
}
|
|
747
747
|
return !!this.vertexFeature_;
|
|
748
748
|
}
|
|
@@ -753,21 +753,21 @@ class Tt extends me {
|
|
|
753
753
|
*/
|
|
754
754
|
handleUpEvent(e) {
|
|
755
755
|
for (let t = this.dragSegments_.length - 1; t >= 0; --t) {
|
|
756
|
-
const
|
|
757
|
-
if (
|
|
758
|
-
const
|
|
759
|
-
r.segment[0] =
|
|
760
|
-
let a =
|
|
756
|
+
const i = this.dragSegments_[t][0], n = i.geometry;
|
|
757
|
+
if (n.getType() === "Circle") {
|
|
758
|
+
const s = n.getCenter(), r = i.featureSegments[0], o = i.featureSegments[1];
|
|
759
|
+
r.segment[0] = s, r.segment[1] = s, o.segment[0] = s, o.segment[1] = s, this.rBush_.update(ye(s), r);
|
|
760
|
+
let a = n;
|
|
761
761
|
this.rBush_.update(
|
|
762
762
|
a.getExtent(),
|
|
763
763
|
o
|
|
764
764
|
);
|
|
765
765
|
} else
|
|
766
|
-
this.rBush_.update(
|
|
766
|
+
this.rBush_.update(P(i.segment), i);
|
|
767
767
|
}
|
|
768
768
|
return this.featuresBeingModified_ && (this.dispatchEvent(
|
|
769
|
-
new
|
|
770
|
-
|
|
769
|
+
new Ce(
|
|
770
|
+
xe.MODIFYEND,
|
|
771
771
|
this.featuresBeingModified_,
|
|
772
772
|
e
|
|
773
773
|
)
|
|
@@ -786,26 +786,26 @@ class Tt extends me {
|
|
|
786
786
|
* @param {import("../coordinate.js").Coordinate} [coordinate] The pixel Coordinate.
|
|
787
787
|
* @private
|
|
788
788
|
*/
|
|
789
|
-
handlePointerAtPixel_(e, t,
|
|
790
|
-
const
|
|
789
|
+
handlePointerAtPixel_(e, t, i) {
|
|
790
|
+
const n = i || t.getCoordinateFromPixel(e);
|
|
791
791
|
t.getView().getProjection();
|
|
792
|
-
const
|
|
793
|
-
return
|
|
792
|
+
const s = function(a, h) {
|
|
793
|
+
return Xe(n, a) - Xe(n, h);
|
|
794
794
|
};
|
|
795
795
|
let r, o;
|
|
796
796
|
if (this.hitDetection_) {
|
|
797
797
|
const a = typeof this.hitDetection_ == "object" ? (h) => h === this.hitDetection_ : void 0;
|
|
798
798
|
t.forEachFeatureAtPixel(
|
|
799
799
|
e,
|
|
800
|
-
(h, c,
|
|
801
|
-
|
|
802
|
-
|
|
800
|
+
(h, c, u) => {
|
|
801
|
+
u && (u = new W(
|
|
802
|
+
de(u.getCoordinates())
|
|
803
803
|
));
|
|
804
|
-
const g =
|
|
805
|
-
if (g.getType() === "Point" && h instanceof
|
|
804
|
+
const g = u || h.getGeometry();
|
|
805
|
+
if (g.getType() === "Point" && h instanceof G && this.features_.getArray().includes(h)) {
|
|
806
806
|
o = /** @type {Point} */
|
|
807
807
|
g;
|
|
808
|
-
const
|
|
808
|
+
const d = (
|
|
809
809
|
/** @type {Point} */
|
|
810
810
|
h.getGeometry().getFlatCoordinates().slice(0, 2)
|
|
811
811
|
);
|
|
@@ -813,7 +813,7 @@ class Tt extends me {
|
|
|
813
813
|
{
|
|
814
814
|
feature: h,
|
|
815
815
|
geometry: o,
|
|
816
|
-
segment: [
|
|
816
|
+
segment: [d, d]
|
|
817
817
|
}
|
|
818
818
|
];
|
|
819
819
|
}
|
|
@@ -823,45 +823,45 @@ class Tt extends me {
|
|
|
823
823
|
);
|
|
824
824
|
}
|
|
825
825
|
if (!r) {
|
|
826
|
-
const a =
|
|
827
|
-
|
|
828
|
-
), h = t.getView().getResolution() * this.pixelTolerance_, c =
|
|
829
|
-
|
|
826
|
+
const a = qt(
|
|
827
|
+
ye(n, Ve)
|
|
828
|
+
), h = t.getView().getResolution() * this.pixelTolerance_, c = it(
|
|
829
|
+
nt(a, h, Ve)
|
|
830
830
|
);
|
|
831
831
|
r = this.rBush_.getInExtent(c);
|
|
832
832
|
}
|
|
833
833
|
if (r && r.length > 0) {
|
|
834
|
-
const a = r.sort(
|
|
835
|
-
let c =
|
|
836
|
-
const
|
|
837
|
-
let g =
|
|
834
|
+
const a = r.sort(s)[0], h = a.segment;
|
|
835
|
+
let c = Ze(n, a);
|
|
836
|
+
const u = t.getPixelFromCoordinate(c);
|
|
837
|
+
let g = ue(e, u);
|
|
838
838
|
if (o || g <= this.pixelTolerance_) {
|
|
839
|
-
const
|
|
840
|
-
if (
|
|
839
|
+
const d = {};
|
|
840
|
+
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 === H)
|
|
841
841
|
this.snappedToVertex_ = !0, this.createOrUpdateVertexFeature_(
|
|
842
842
|
c,
|
|
843
843
|
[a.feature],
|
|
844
844
|
[a.geometry]
|
|
845
845
|
);
|
|
846
846
|
else {
|
|
847
|
-
const f = t.getPixelFromCoordinate(h[0]), _ = t.getPixelFromCoordinate(h[1]), x =
|
|
848
|
-
g = Math.sqrt(Math.min(x,
|
|
847
|
+
const f = t.getPixelFromCoordinate(h[0]), _ = t.getPixelFromCoordinate(h[1]), x = O(u, f), T = O(u, _);
|
|
848
|
+
g = Math.sqrt(Math.min(x, T)), this.snappedToVertex_ = g <= this.pixelTolerance_, this.snappedToVertex_ && (c = x > T ? h[1] : h[0]), this.createOrUpdateVertexFeature_(
|
|
849
849
|
c,
|
|
850
850
|
[a.feature],
|
|
851
851
|
[a.geometry]
|
|
852
852
|
);
|
|
853
|
-
const
|
|
854
|
-
|
|
855
|
-
for (let
|
|
856
|
-
const
|
|
857
|
-
if (
|
|
858
|
-
const
|
|
859
|
-
|
|
853
|
+
const F = {};
|
|
854
|
+
F[C(a.geometry)] = !0;
|
|
855
|
+
for (let E = 1, q = r.length; E < q; ++E) {
|
|
856
|
+
const k = r[E].segment;
|
|
857
|
+
if (b(h[0], k[0]) && b(h[1], k[1]) || b(h[0], k[1]) && b(h[1], k[0])) {
|
|
858
|
+
const Q = C(r[E].geometry);
|
|
859
|
+
Q in F || (F[Q] = !0, d[C(k)] = !0);
|
|
860
860
|
} else
|
|
861
861
|
break;
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
|
-
this.vertexSegments_ =
|
|
864
|
+
this.vertexSegments_ = d;
|
|
865
865
|
return;
|
|
866
866
|
}
|
|
867
867
|
}
|
|
@@ -873,45 +873,45 @@ class Tt extends me {
|
|
|
873
873
|
* @private
|
|
874
874
|
*/
|
|
875
875
|
insertVertex_(e, t) {
|
|
876
|
-
const
|
|
876
|
+
const i = e.segment, n = e.feature, s = e.geometry, r = e.depth, o = e.index;
|
|
877
877
|
let a;
|
|
878
|
-
for (; t.length <
|
|
878
|
+
for (; t.length < s.getStride(); )
|
|
879
879
|
t.push(0);
|
|
880
|
-
switch (
|
|
880
|
+
switch (s.getType()) {
|
|
881
881
|
case "MultiLineString":
|
|
882
|
-
a =
|
|
882
|
+
a = s.getCoordinates(), a[r[0]].splice(o + 1, 0, t);
|
|
883
883
|
break;
|
|
884
884
|
case "Polygon":
|
|
885
|
-
a =
|
|
885
|
+
a = s.getCoordinates(), a[r[0]].splice(o + 1, 0, t);
|
|
886
886
|
break;
|
|
887
887
|
case "MultiPolygon":
|
|
888
|
-
a =
|
|
888
|
+
a = s.getCoordinates(), a[r[1]][r[0]].splice(o + 1, 0, t);
|
|
889
889
|
break;
|
|
890
890
|
case "LineString":
|
|
891
|
-
a =
|
|
891
|
+
a = s.getCoordinates(), a.splice(o + 1, 0, t);
|
|
892
892
|
break;
|
|
893
893
|
default:
|
|
894
894
|
return;
|
|
895
895
|
}
|
|
896
|
-
this.setGeometryCoordinates_(
|
|
896
|
+
this.setGeometryCoordinates_(s, a);
|
|
897
897
|
const h = this.rBush_;
|
|
898
|
-
h.remove(e), this.updateSegmentIndices_(
|
|
898
|
+
h.remove(e), this.updateSegmentIndices_(s, o, r, 1);
|
|
899
899
|
const c = {
|
|
900
|
-
segment: [
|
|
901
|
-
feature:
|
|
902
|
-
geometry:
|
|
900
|
+
segment: [i[0], t],
|
|
901
|
+
feature: n,
|
|
902
|
+
geometry: s,
|
|
903
903
|
depth: r,
|
|
904
904
|
index: o
|
|
905
905
|
};
|
|
906
|
-
h.insert(
|
|
907
|
-
const
|
|
908
|
-
segment: [t,
|
|
909
|
-
feature:
|
|
910
|
-
geometry:
|
|
906
|
+
h.insert(P(c.segment), c), this.dragSegments_.push([c, 1]);
|
|
907
|
+
const u = {
|
|
908
|
+
segment: [t, i[1]],
|
|
909
|
+
feature: n,
|
|
910
|
+
geometry: s,
|
|
911
911
|
depth: r,
|
|
912
912
|
index: o + 1
|
|
913
913
|
};
|
|
914
|
-
h.insert(
|
|
914
|
+
h.insert(P(u.segment), u), this.dragSegments_.push([u, 0]), this.ignoreNextSingleClick_ = !0;
|
|
915
915
|
}
|
|
916
916
|
/**
|
|
917
917
|
* Removes the vertex currently being pointed.
|
|
@@ -924,8 +924,8 @@ class Tt extends me {
|
|
|
924
924
|
this.willModifyFeatures_(e, this.dragSegments_);
|
|
925
925
|
const t = this.removeVertex_();
|
|
926
926
|
return this.featuresBeingModified_ && this.dispatchEvent(
|
|
927
|
-
new
|
|
928
|
-
|
|
927
|
+
new Ce(
|
|
928
|
+
xe.MODIFYEND,
|
|
929
929
|
this.featuresBeingModified_,
|
|
930
930
|
e
|
|
931
931
|
)
|
|
@@ -940,43 +940,43 @@ class Tt extends me {
|
|
|
940
940
|
*/
|
|
941
941
|
removeVertex_() {
|
|
942
942
|
const e = this.dragSegments_, t = {};
|
|
943
|
-
let
|
|
943
|
+
let i = !1, n, s, r, o, a, h, c, u, g, d, f;
|
|
944
944
|
for (a = e.length - 1; a >= 0; --a)
|
|
945
|
-
r = e[a],
|
|
945
|
+
r = e[a], d = r[0], f = C(d.feature), d.depth && (f += "-" + d.depth.join("-")), f in t || (t[f] = {}), r[1] === 0 ? (t[f].right = d, t[f].index = d.index) : r[1] == 1 && (t[f].left = d, t[f].index = d.index + 1);
|
|
946
946
|
for (f in t) {
|
|
947
|
-
switch (g = t[f].right, c = t[f].left, h = t[f].index,
|
|
947
|
+
switch (g = t[f].right, c = t[f].left, h = t[f].index, u = h - 1, c !== void 0 ? d = c : d = g, u < 0 && (u = 0), o = d.geometry, s = o.getCoordinates(), n = s, i = !1, o.getType()) {
|
|
948
948
|
case "MultiLineString":
|
|
949
|
-
|
|
949
|
+
s[d.depth[0]].length > 2 && (s[d.depth[0]].splice(h, 1), i = !0);
|
|
950
950
|
break;
|
|
951
951
|
case "LineString":
|
|
952
|
-
|
|
952
|
+
s.length > 2 && (s.splice(h, 1), i = !0);
|
|
953
953
|
break;
|
|
954
954
|
case "MultiPolygon":
|
|
955
|
-
|
|
955
|
+
n = n[d.depth[1]];
|
|
956
956
|
case "Polygon":
|
|
957
|
-
|
|
957
|
+
n = n[d.depth[0]], n.length > 4 && (h == n.length - 1 && (h = 0), n.splice(h, 1), i = !0, h === 0 && (n.pop(), n.push(n[0]), u = n.length - 1));
|
|
958
958
|
break;
|
|
959
959
|
}
|
|
960
|
-
if (
|
|
961
|
-
this.setGeometryCoordinates_(o,
|
|
960
|
+
if (i) {
|
|
961
|
+
this.setGeometryCoordinates_(o, s);
|
|
962
962
|
const _ = [];
|
|
963
963
|
if (c !== void 0 && (this.rBush_.remove(c), _.push(c.segment[0])), g !== void 0 && (this.rBush_.remove(g), _.push(g.segment[1])), c !== void 0 && g !== void 0) {
|
|
964
964
|
const x = {
|
|
965
|
-
depth:
|
|
966
|
-
feature:
|
|
967
|
-
geometry:
|
|
968
|
-
index:
|
|
965
|
+
depth: d.depth,
|
|
966
|
+
feature: d.feature,
|
|
967
|
+
geometry: d.geometry,
|
|
968
|
+
index: u,
|
|
969
969
|
segment: _
|
|
970
970
|
};
|
|
971
971
|
this.rBush_.insert(
|
|
972
|
-
|
|
972
|
+
P(x.segment),
|
|
973
973
|
x
|
|
974
974
|
);
|
|
975
975
|
}
|
|
976
|
-
this.updateSegmentIndices_(o, h,
|
|
976
|
+
this.updateSegmentIndices_(o, h, d.depth, -1), this.vertexFeature_ && (this.overlay_.getSource().removeFeature(this.vertexFeature_), this.vertexFeature_ = null), e.length = 0;
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
|
-
return
|
|
979
|
+
return i;
|
|
980
980
|
}
|
|
981
981
|
/**
|
|
982
982
|
* @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
|
|
@@ -993,57 +993,57 @@ class Tt extends me {
|
|
|
993
993
|
* @param {number} delta Delta (1 or -1).
|
|
994
994
|
* @private
|
|
995
995
|
*/
|
|
996
|
-
updateSegmentIndices_(e, t,
|
|
996
|
+
updateSegmentIndices_(e, t, i, n) {
|
|
997
997
|
this.rBush_.forEachInExtent(
|
|
998
998
|
e.getExtent(),
|
|
999
|
-
function(
|
|
1000
|
-
|
|
999
|
+
function(s) {
|
|
1000
|
+
s.geometry === e && (i === void 0 || s.depth === void 0 || It(s.depth, i)) && s.index > t && (s.index += n);
|
|
1001
1001
|
}
|
|
1002
1002
|
);
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1005
|
+
function ci(l, e) {
|
|
1006
1006
|
return l.index - e.index;
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1009
|
-
const
|
|
1010
|
-
if (
|
|
1011
|
-
let
|
|
1008
|
+
function Xe(l, e, t) {
|
|
1009
|
+
const i = e.geometry;
|
|
1010
|
+
if (i.getType() === "Circle") {
|
|
1011
|
+
let s = (
|
|
1012
1012
|
/** @type {import("../geom/Circle.js").default} */
|
|
1013
|
-
|
|
1013
|
+
i
|
|
1014
1014
|
);
|
|
1015
|
-
if (e.index ===
|
|
1016
|
-
const r =
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
), o = Math.sqrt(r) -
|
|
1015
|
+
if (e.index === H) {
|
|
1016
|
+
const r = O(
|
|
1017
|
+
s.getCenter(),
|
|
1018
|
+
p(l)
|
|
1019
|
+
), o = Math.sqrt(r) - s.getRadius();
|
|
1020
1020
|
return o * o;
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
|
-
const
|
|
1024
|
-
return
|
|
1023
|
+
const n = p(l);
|
|
1024
|
+
return Z[0] = p(e.segment[0]), Z[1] = p(e.segment[1]), Bt(n, Z);
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1027
|
-
const
|
|
1028
|
-
if (
|
|
1029
|
-
return
|
|
1026
|
+
function Ze(l, e, t) {
|
|
1027
|
+
const i = e.geometry;
|
|
1028
|
+
if (i.getType() === "Circle" && e.index === H)
|
|
1029
|
+
return de(
|
|
1030
1030
|
/** @type {import("../geom/Circle.js").default} */
|
|
1031
|
-
|
|
1032
|
-
|
|
1031
|
+
i.getClosestPoint(
|
|
1032
|
+
p(l)
|
|
1033
1033
|
)
|
|
1034
1034
|
);
|
|
1035
|
-
const
|
|
1036
|
-
return
|
|
1037
|
-
|
|
1035
|
+
const n = p(l);
|
|
1036
|
+
return Z[0] = p(e.segment[0]), Z[1] = p(e.segment[1]), de(
|
|
1037
|
+
st(n, Z)
|
|
1038
1038
|
);
|
|
1039
1039
|
}
|
|
1040
|
-
function
|
|
1041
|
-
const l =
|
|
1040
|
+
function ui() {
|
|
1041
|
+
const l = ke();
|
|
1042
1042
|
return function(e, t) {
|
|
1043
1043
|
return l.Point;
|
|
1044
1044
|
};
|
|
1045
1045
|
}
|
|
1046
|
-
const
|
|
1046
|
+
const ne = {
|
|
1047
1047
|
/**
|
|
1048
1048
|
* Triggered upon feature draw start
|
|
1049
1049
|
* @event DrawEvent#drawstart
|
|
@@ -1063,7 +1063,7 @@ const H = {
|
|
|
1063
1063
|
*/
|
|
1064
1064
|
DRAWABORT: "drawabort"
|
|
1065
1065
|
};
|
|
1066
|
-
class
|
|
1066
|
+
class se extends J {
|
|
1067
1067
|
/**
|
|
1068
1068
|
* @param {DrawEventType} type Type.
|
|
1069
1069
|
* @param {Feature} feature The feature drawn.
|
|
@@ -1072,160 +1072,160 @@ class Y extends ne {
|
|
|
1072
1072
|
super(e), this.feature = t;
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1075
|
+
function di(l, e) {
|
|
1076
1076
|
const t = [];
|
|
1077
|
-
for (let
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1077
|
+
for (let i = 0; i < e.length; ++i) {
|
|
1078
|
+
const s = e[i].getGeometry();
|
|
1079
|
+
ht(l, s, t);
|
|
1080
1080
|
}
|
|
1081
1081
|
return t;
|
|
1082
1082
|
}
|
|
1083
|
-
function
|
|
1084
|
-
return
|
|
1083
|
+
function re(l, e) {
|
|
1084
|
+
return et(l[0], l[1], e[0], e[1]);
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1086
|
+
function V(l, e) {
|
|
1087
1087
|
const t = l.length;
|
|
1088
1088
|
return e < 0 ? l[e + t] : e >= t ? l[e - t] : l[e];
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1091
|
-
let
|
|
1092
|
-
e < t ? (
|
|
1093
|
-
const
|
|
1094
|
-
if (
|
|
1095
|
-
const a =
|
|
1096
|
-
return
|
|
1090
|
+
function oe(l, e, t) {
|
|
1091
|
+
let i, n;
|
|
1092
|
+
e < t ? (i = e, n = t) : (i = t, n = e);
|
|
1093
|
+
const s = Math.ceil(i), r = Math.floor(n);
|
|
1094
|
+
if (s > r) {
|
|
1095
|
+
const a = X(l, i), h = X(l, n);
|
|
1096
|
+
return re(a, h);
|
|
1097
1097
|
}
|
|
1098
1098
|
let o = 0;
|
|
1099
|
-
if (
|
|
1100
|
-
const a =
|
|
1101
|
-
o +=
|
|
1099
|
+
if (i < s) {
|
|
1100
|
+
const a = X(l, i), h = V(l, s);
|
|
1101
|
+
o += re(a, h);
|
|
1102
1102
|
}
|
|
1103
|
-
if (r <
|
|
1104
|
-
const a =
|
|
1105
|
-
o +=
|
|
1103
|
+
if (r < n) {
|
|
1104
|
+
const a = V(l, r), h = X(l, n);
|
|
1105
|
+
o += re(a, h);
|
|
1106
1106
|
}
|
|
1107
|
-
for (let a =
|
|
1108
|
-
const h =
|
|
1109
|
-
o +=
|
|
1107
|
+
for (let a = s; a < r - 1; ++a) {
|
|
1108
|
+
const h = V(l, a), c = V(l, a + 1);
|
|
1109
|
+
o += re(h, c);
|
|
1110
1110
|
}
|
|
1111
1111
|
return o;
|
|
1112
1112
|
}
|
|
1113
|
-
function
|
|
1114
|
-
if (e instanceof
|
|
1115
|
-
|
|
1113
|
+
function ht(l, e, t) {
|
|
1114
|
+
if (e instanceof le) {
|
|
1115
|
+
ae(l, e.getCoordinates(), !1, t);
|
|
1116
1116
|
return;
|
|
1117
1117
|
}
|
|
1118
|
-
if (e instanceof
|
|
1119
|
-
const
|
|
1120
|
-
for (let
|
|
1121
|
-
|
|
1118
|
+
if (e instanceof $e) {
|
|
1119
|
+
const i = e.getCoordinates();
|
|
1120
|
+
for (let n = 0, s = i.length; n < s; ++n)
|
|
1121
|
+
ae(l, i[n], !1, t);
|
|
1122
1122
|
return;
|
|
1123
1123
|
}
|
|
1124
|
-
if (e instanceof
|
|
1125
|
-
const
|
|
1126
|
-
for (let
|
|
1127
|
-
|
|
1124
|
+
if (e instanceof rt) {
|
|
1125
|
+
const i = e.getCoordinates();
|
|
1126
|
+
for (let n = 0, s = i.length; n < s; ++n)
|
|
1127
|
+
ae(l, i[n], !0, t);
|
|
1128
1128
|
return;
|
|
1129
1129
|
}
|
|
1130
|
-
if (e instanceof
|
|
1131
|
-
const
|
|
1132
|
-
for (let
|
|
1133
|
-
const r =
|
|
1130
|
+
if (e instanceof Je) {
|
|
1131
|
+
const i = e.getCoordinates();
|
|
1132
|
+
for (let n = 0, s = i.length; n < s; ++n) {
|
|
1133
|
+
const r = i[n];
|
|
1134
1134
|
for (let o = 0, a = r.length; o < a; ++o)
|
|
1135
|
-
|
|
1135
|
+
ae(l, r[o], !0, t);
|
|
1136
1136
|
}
|
|
1137
1137
|
return;
|
|
1138
1138
|
}
|
|
1139
|
-
if (e instanceof
|
|
1140
|
-
const
|
|
1141
|
-
for (let
|
|
1142
|
-
|
|
1139
|
+
if (e instanceof Mt) {
|
|
1140
|
+
const i = e.getGeometries();
|
|
1141
|
+
for (let n = 0; n < i.length; ++n)
|
|
1142
|
+
ht(l, i[n], t);
|
|
1143
1143
|
return;
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
|
-
const
|
|
1147
|
-
function
|
|
1148
|
-
const
|
|
1146
|
+
const Te = { index: -1, endIndex: NaN };
|
|
1147
|
+
function gi(l, e, t, i) {
|
|
1148
|
+
const n = l[0], s = l[1];
|
|
1149
1149
|
let r = 1 / 0, o = -1, a = NaN;
|
|
1150
|
-
for (let
|
|
1151
|
-
const g = e.targets[
|
|
1150
|
+
for (let u = 0; u < e.targets.length; ++u) {
|
|
1151
|
+
const g = e.targets[u], d = g.coordinates;
|
|
1152
1152
|
let f = 1 / 0, _;
|
|
1153
|
-
for (let x = 0; x <
|
|
1154
|
-
const
|
|
1155
|
-
|
|
1153
|
+
for (let x = 0; x < d.length - 1; ++x) {
|
|
1154
|
+
const T = d[x], F = d[x + 1], E = ct(n, s, T, F);
|
|
1155
|
+
E.squaredDistance < f && (f = E.squaredDistance, _ = x + E.along);
|
|
1156
1156
|
}
|
|
1157
|
-
f < r && (r = f, g.ring && e.targetIndex ===
|
|
1157
|
+
f < r && (r = f, g.ring && e.targetIndex === u && (g.endIndex > g.startIndex ? _ < g.startIndex && (_ += d.length) : g.endIndex < g.startIndex && _ > g.startIndex && (_ -= d.length)), a = _, o = u);
|
|
1158
1158
|
}
|
|
1159
1159
|
const h = e.targets[o];
|
|
1160
1160
|
let c = h.ring;
|
|
1161
1161
|
if (e.targetIndex === o && c) {
|
|
1162
|
-
const
|
|
1162
|
+
const u = X(
|
|
1163
1163
|
h.coordinates,
|
|
1164
1164
|
a
|
|
1165
|
-
), g = t.getPixelFromCoordinate(
|
|
1166
|
-
|
|
1165
|
+
), g = t.getPixelFromCoordinate(u);
|
|
1166
|
+
ue(g, e.startPx) > i && (c = !1);
|
|
1167
1167
|
}
|
|
1168
1168
|
if (c) {
|
|
1169
|
-
const
|
|
1170
|
-
if (
|
|
1171
|
-
const _ =
|
|
1172
|
-
d,
|
|
1169
|
+
const u = h.coordinates, g = u.length, d = h.startIndex, f = a;
|
|
1170
|
+
if (d < f) {
|
|
1171
|
+
const _ = oe(
|
|
1173
1172
|
u,
|
|
1173
|
+
d,
|
|
1174
1174
|
f
|
|
1175
1175
|
);
|
|
1176
|
-
|
|
1177
|
-
d,
|
|
1176
|
+
oe(
|
|
1178
1177
|
u,
|
|
1178
|
+
d,
|
|
1179
1179
|
f - g
|
|
1180
1180
|
) < _ && (a -= g);
|
|
1181
1181
|
} else {
|
|
1182
|
-
const _ =
|
|
1183
|
-
d,
|
|
1182
|
+
const _ = oe(
|
|
1184
1183
|
u,
|
|
1184
|
+
d,
|
|
1185
1185
|
f
|
|
1186
1186
|
);
|
|
1187
|
-
|
|
1188
|
-
d,
|
|
1187
|
+
oe(
|
|
1189
1188
|
u,
|
|
1189
|
+
d,
|
|
1190
1190
|
f + g
|
|
1191
1191
|
) < _ && (a += g);
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
1194
|
-
return
|
|
1194
|
+
return Te.index = o, Te.endIndex = a, Te;
|
|
1195
1195
|
}
|
|
1196
|
-
function
|
|
1197
|
-
const
|
|
1196
|
+
function ae(l, e, t, i) {
|
|
1197
|
+
const n = l[0], s = l[1];
|
|
1198
1198
|
for (let r = 0, o = e.length - 1; r < o; ++r) {
|
|
1199
|
-
const a = e[r], h = e[r + 1], c =
|
|
1199
|
+
const a = e[r], h = e[r + 1], c = ct(n, s, a, h);
|
|
1200
1200
|
if (c.squaredDistance === 0) {
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1201
|
+
const u = r + c.along;
|
|
1202
|
+
i.push({
|
|
1203
1203
|
coordinates: e,
|
|
1204
1204
|
ring: t,
|
|
1205
|
-
startIndex:
|
|
1206
|
-
endIndex:
|
|
1205
|
+
startIndex: u,
|
|
1206
|
+
endIndex: u
|
|
1207
1207
|
});
|
|
1208
1208
|
return;
|
|
1209
1209
|
}
|
|
1210
1210
|
}
|
|
1211
1211
|
}
|
|
1212
|
-
const
|
|
1213
|
-
function
|
|
1214
|
-
const
|
|
1215
|
-
let c = 0,
|
|
1216
|
-
return (a !== 0 || h !== 0) && (c =
|
|
1212
|
+
const Fe = { along: 0, squaredDistance: 0 };
|
|
1213
|
+
function ct(l, e, t, i) {
|
|
1214
|
+
const n = t[0], s = t[1], r = i[0], o = i[1], a = r - n, h = o - s;
|
|
1215
|
+
let c = 0, u = n, g = s;
|
|
1216
|
+
return (a !== 0 || h !== 0) && (c = tt(((l - n) * a + (e - s) * h) / (a * a + h * h), 0, 1), u += a * c, g += h * c), Fe.along = c, Fe.squaredDistance = jt(et(l, e, u, g), 10), Fe;
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1218
|
+
function X(l, e) {
|
|
1219
1219
|
const t = l.length;
|
|
1220
|
-
let
|
|
1221
|
-
const
|
|
1222
|
-
|
|
1223
|
-
let
|
|
1224
|
-
|
|
1225
|
-
const r = l[
|
|
1226
|
-
return [o + c *
|
|
1220
|
+
let i = Math.floor(e);
|
|
1221
|
+
const n = e - i;
|
|
1222
|
+
i >= t ? i -= t : i < 0 && (i += t);
|
|
1223
|
+
let s = i + 1;
|
|
1224
|
+
s >= t && (s -= t);
|
|
1225
|
+
const r = l[i], o = r[0], a = r[1], h = l[s], c = h[0] - o, u = h[1] - a;
|
|
1226
|
+
return [o + c * n, a + u * n];
|
|
1227
1227
|
}
|
|
1228
|
-
class
|
|
1228
|
+
class fi extends De {
|
|
1229
1229
|
/**
|
|
1230
1230
|
* @param {Options} options Options.
|
|
1231
1231
|
*/
|
|
@@ -1234,16 +1234,16 @@ class Dt extends me {
|
|
|
1234
1234
|
/** @type {import("./Pointer.js").Options} */
|
|
1235
1235
|
e
|
|
1236
1236
|
);
|
|
1237
|
-
t.stopDown || (t.stopDown =
|
|
1238
|
-
e.type, this.mode_ =
|
|
1239
|
-
let
|
|
1240
|
-
if (!
|
|
1241
|
-
const
|
|
1242
|
-
if (
|
|
1243
|
-
|
|
1244
|
-
const a = r || new
|
|
1237
|
+
t.stopDown || (t.stopDown = Qe), 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} */
|
|
1238
|
+
e.type, this.mode_ = mi(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 : ce, this.geometryLayout_ = e.geometryLayout ? e.geometryLayout : "XY";
|
|
1239
|
+
let i = e.geometryFunction;
|
|
1240
|
+
if (!i) {
|
|
1241
|
+
const n = this.mode_;
|
|
1242
|
+
if (n === "Circle")
|
|
1243
|
+
i = function(s, r, o) {
|
|
1244
|
+
const a = r || new St([NaN, NaN]), h = p(s[0]), c = O(
|
|
1245
1245
|
h,
|
|
1246
|
-
|
|
1246
|
+
p(s[s.length - 1])
|
|
1247
1247
|
);
|
|
1248
1248
|
return a.setCenterAndRadius(
|
|
1249
1249
|
h,
|
|
@@ -1252,23 +1252,23 @@ class Dt extends me {
|
|
|
1252
1252
|
), a;
|
|
1253
1253
|
};
|
|
1254
1254
|
else {
|
|
1255
|
-
let
|
|
1256
|
-
|
|
1257
|
-
return o ?
|
|
1255
|
+
let s;
|
|
1256
|
+
n === "Point" ? s = W : n === "LineString" ? s = le : n === "Polygon" && (s = rt), i = function(r, o, a) {
|
|
1257
|
+
return o ? n === "Polygon" ? r[0].length ? o.setCoordinates(
|
|
1258
1258
|
[r[0].concat([r[0][0]])],
|
|
1259
1259
|
this.geometryLayout_
|
|
1260
|
-
) : o.setCoordinates([], this.geometryLayout_) : o.setCoordinates(r, this.geometryLayout_) : o = new
|
|
1260
|
+
) : o.setCoordinates([], this.geometryLayout_) : o.setCoordinates(r, this.geometryLayout_) : o = new s(r, this.geometryLayout_), o;
|
|
1261
1261
|
};
|
|
1262
1262
|
}
|
|
1263
1263
|
}
|
|
1264
|
-
this.geometryFunction_ =
|
|
1265
|
-
source: new
|
|
1264
|
+
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 ge({
|
|
1265
|
+
source: new Me({
|
|
1266
1266
|
useSpatialIndex: !1,
|
|
1267
1267
|
wrapX: e.wrapX ? e.wrapX : !1
|
|
1268
1268
|
}),
|
|
1269
|
-
style: e.style ? e.style :
|
|
1269
|
+
style: e.style ? e.style : _i(),
|
|
1270
1270
|
updateWhileInteracting: !0
|
|
1271
|
-
}), this.geometryName_ = e.geometryName, this.condition_ = e.condition ? e.condition :
|
|
1271
|
+
}), this.geometryName_ = e.geometryName, this.condition_ = e.condition ? e.condition : wt, this.freehandCondition_, e.freehand ? this.freehandCondition_ = Le : this.freehandCondition_ = e.freehandCondition ? e.freehandCondition : We, this.traceCondition_, this.setTrace(e.trace || !1), this.traceState_ = { active: !1 }, this.traceSource_ = e.traceSource || e.source || null, this.addChangeListener(Pt.ACTIVE, this.updateState_);
|
|
1272
1272
|
}
|
|
1273
1273
|
/**
|
|
1274
1274
|
* Toggle tracing mode or set a tracing condition.
|
|
@@ -1278,7 +1278,7 @@ class Dt extends me {
|
|
|
1278
1278
|
*/
|
|
1279
1279
|
setTrace(e) {
|
|
1280
1280
|
let t;
|
|
1281
|
-
e ? e === !0 ? t =
|
|
1281
|
+
e ? e === !0 ? t = Le : t = e : t = we, this.traceCondition_ = t;
|
|
1282
1282
|
}
|
|
1283
1283
|
/**
|
|
1284
1284
|
* Remove the interaction from its current map and attach it to the new map.
|
|
@@ -1304,9 +1304,9 @@ class Dt extends me {
|
|
|
1304
1304
|
* @api
|
|
1305
1305
|
*/
|
|
1306
1306
|
handleEvent(e) {
|
|
1307
|
-
e.originalEvent.type ===
|
|
1308
|
-
let t = e.type === D.POINTERMOVE,
|
|
1309
|
-
return !this.freehand_ && this.lastDragTime_ && e.type === D.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 === D.POINTERDRAG && this.sketchFeature_ !== null ? (this.addToDrawing_(e.coordinate),
|
|
1307
|
+
e.originalEvent.type === $.CONTEXTMENU && e.originalEvent.preventDefault(), this.freehand_ = this.mode_ !== "Point" && this.freehandCondition_(e);
|
|
1308
|
+
let t = e.type === D.POINTERMOVE, i = !0;
|
|
1309
|
+
return !this.freehand_ && this.lastDragTime_ && e.type === D.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 === D.POINTERDRAG && this.sketchFeature_ !== null ? (this.addToDrawing_(e.coordinate), i = !1) : this.freehand_ && e.type === D.POINTERDOWN ? i = !1 : t && this.getPointerCount() < 2 ? (i = e.type === D.POINTERMOVE, i && this.freehand_ ? (this.handlePointerMove_(e), this.shouldHandle_ && e.originalEvent.preventDefault()) : (e.originalEvent.pointerType === "mouse" || e.type === D.POINTERDRAG && this.downTimeout_ === void 0) && this.handlePointerMove_(e)) : e.type === D.DBLCLICK && (i = !1), super.handleEvent(e) && i;
|
|
1310
1310
|
}
|
|
1311
1311
|
/**
|
|
1312
1312
|
* Handle pointer down events.
|
|
@@ -1316,7 +1316,7 @@ class Dt extends me {
|
|
|
1316
1316
|
handleDownEvent(e) {
|
|
1317
1317
|
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(() => {
|
|
1318
1318
|
this.handlePointerMove_(
|
|
1319
|
-
new
|
|
1319
|
+
new Lt(
|
|
1320
1320
|
D.POINTERMOVE,
|
|
1321
1321
|
e.map,
|
|
1322
1322
|
e.originalEvent,
|
|
@@ -1344,16 +1344,16 @@ class Dt extends me {
|
|
|
1344
1344
|
this.deactivateTrace_();
|
|
1345
1345
|
return;
|
|
1346
1346
|
}
|
|
1347
|
-
const t = this.getMap(),
|
|
1347
|
+
const t = this.getMap(), i = t.getCoordinateFromPixel([
|
|
1348
1348
|
e.pixel[0] - this.snapTolerance_,
|
|
1349
1349
|
e.pixel[1] + this.snapTolerance_
|
|
1350
|
-
]),
|
|
1350
|
+
]), n = t.getCoordinateFromPixel([
|
|
1351
1351
|
e.pixel[0] + this.snapTolerance_,
|
|
1352
1352
|
e.pixel[1] - this.snapTolerance_
|
|
1353
|
-
]),
|
|
1353
|
+
]), s = P([i, n]), r = this.traceSource_.getFeaturesInExtent(s);
|
|
1354
1354
|
if (r.length === 0)
|
|
1355
1355
|
return;
|
|
1356
|
-
const o =
|
|
1356
|
+
const o = di(e.coordinate, r);
|
|
1357
1357
|
o.length && (this.traceState_ = {
|
|
1358
1358
|
active: !0,
|
|
1359
1359
|
startPx: e.pixel.slice(),
|
|
@@ -1367,8 +1367,8 @@ class Dt extends me {
|
|
|
1367
1367
|
* @private
|
|
1368
1368
|
*/
|
|
1369
1369
|
addOrRemoveTracedCoordinates_(e, t) {
|
|
1370
|
-
const
|
|
1371
|
-
|
|
1370
|
+
const i = e.startIndex <= e.endIndex, n = e.startIndex <= t;
|
|
1371
|
+
i === n ? i && t > e.endIndex || !i && t < e.endIndex ? this.addTracedCoordinates_(e, e.endIndex, t) : (i && t < e.endIndex || !i && t > e.endIndex) && this.removeTracedCoordinates_(t, e.endIndex) : (this.removeTracedCoordinates_(e.startIndex, e.endIndex), this.addTracedCoordinates_(e, e.startIndex, t));
|
|
1372
1372
|
}
|
|
1373
1373
|
/**
|
|
1374
1374
|
* @param {number} fromIndex The start index.
|
|
@@ -1378,17 +1378,17 @@ class Dt extends me {
|
|
|
1378
1378
|
removeTracedCoordinates_(e, t) {
|
|
1379
1379
|
if (e === t)
|
|
1380
1380
|
return;
|
|
1381
|
-
let
|
|
1381
|
+
let i = 0;
|
|
1382
1382
|
if (e < t) {
|
|
1383
|
-
const
|
|
1384
|
-
let
|
|
1385
|
-
|
|
1383
|
+
const n = Math.ceil(e);
|
|
1384
|
+
let s = Math.floor(t);
|
|
1385
|
+
s === t && (s -= 1), i = s - n + 1;
|
|
1386
1386
|
} else {
|
|
1387
|
-
const
|
|
1388
|
-
let
|
|
1389
|
-
|
|
1387
|
+
const n = Math.floor(e);
|
|
1388
|
+
let s = Math.ceil(t);
|
|
1389
|
+
s === t && (s += 1), i = n - s + 1;
|
|
1390
1390
|
}
|
|
1391
|
-
|
|
1391
|
+
i > 0 && this.removeLastPoints_(i);
|
|
1392
1392
|
}
|
|
1393
1393
|
/**
|
|
1394
1394
|
* @param {TraceTarget} target The trace target.
|
|
@@ -1396,24 +1396,24 @@ class Dt extends me {
|
|
|
1396
1396
|
* @param {number} toIndex The end index.
|
|
1397
1397
|
* @private
|
|
1398
1398
|
*/
|
|
1399
|
-
addTracedCoordinates_(e, t,
|
|
1400
|
-
if (t ===
|
|
1399
|
+
addTracedCoordinates_(e, t, i) {
|
|
1400
|
+
if (t === i)
|
|
1401
1401
|
return;
|
|
1402
|
-
const
|
|
1403
|
-
if (t <
|
|
1404
|
-
const
|
|
1405
|
-
let r = Math.floor(
|
|
1406
|
-
r ===
|
|
1407
|
-
for (let o =
|
|
1408
|
-
|
|
1402
|
+
const n = [];
|
|
1403
|
+
if (t < i) {
|
|
1404
|
+
const s = Math.ceil(t);
|
|
1405
|
+
let r = Math.floor(i);
|
|
1406
|
+
r === i && (r -= 1);
|
|
1407
|
+
for (let o = s; o <= r; ++o)
|
|
1408
|
+
n.push(V(e.coordinates, o));
|
|
1409
1409
|
} else {
|
|
1410
|
-
const
|
|
1411
|
-
let r = Math.ceil(
|
|
1412
|
-
r ===
|
|
1413
|
-
for (let o =
|
|
1414
|
-
|
|
1410
|
+
const s = Math.floor(t);
|
|
1411
|
+
let r = Math.ceil(i);
|
|
1412
|
+
r === i && (r += 1);
|
|
1413
|
+
for (let o = s; o >= r; --o)
|
|
1414
|
+
n.push(V(e.coordinates, o));
|
|
1415
1415
|
}
|
|
1416
|
-
|
|
1416
|
+
n.length && this.appendCoordinates(n);
|
|
1417
1417
|
}
|
|
1418
1418
|
/**
|
|
1419
1419
|
* Update the trace.
|
|
@@ -1422,37 +1422,37 @@ class Dt extends me {
|
|
|
1422
1422
|
*/
|
|
1423
1423
|
updateTrace_(e) {
|
|
1424
1424
|
const t = this.traceState_;
|
|
1425
|
-
if (!t.active || t.targetIndex === -1 &&
|
|
1425
|
+
if (!t.active || t.targetIndex === -1 && ue(t.startPx, e.pixel) < this.snapTolerance_)
|
|
1426
1426
|
return;
|
|
1427
|
-
const
|
|
1427
|
+
const i = gi(
|
|
1428
1428
|
e.coordinate,
|
|
1429
1429
|
t,
|
|
1430
1430
|
this.getMap(),
|
|
1431
1431
|
this.snapTolerance_
|
|
1432
1432
|
);
|
|
1433
|
-
if (t.targetIndex !==
|
|
1433
|
+
if (t.targetIndex !== i.index) {
|
|
1434
1434
|
if (t.targetIndex !== -1) {
|
|
1435
1435
|
const a = t.targets[t.targetIndex];
|
|
1436
1436
|
this.removeTracedCoordinates_(a.startIndex, a.endIndex);
|
|
1437
1437
|
}
|
|
1438
|
-
const o = t.targets[
|
|
1438
|
+
const o = t.targets[i.index];
|
|
1439
1439
|
this.addTracedCoordinates_(
|
|
1440
1440
|
o,
|
|
1441
1441
|
o.startIndex,
|
|
1442
|
-
|
|
1442
|
+
i.endIndex
|
|
1443
1443
|
);
|
|
1444
1444
|
} else {
|
|
1445
1445
|
const o = t.targets[t.targetIndex];
|
|
1446
|
-
this.addOrRemoveTracedCoordinates_(o,
|
|
1446
|
+
this.addOrRemoveTracedCoordinates_(o, i.endIndex);
|
|
1447
1447
|
}
|
|
1448
|
-
t.targetIndex =
|
|
1449
|
-
const
|
|
1450
|
-
|
|
1451
|
-
const
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
), r = this.getMap().getPixelFromCoordinate(
|
|
1455
|
-
e.coordinate =
|
|
1448
|
+
t.targetIndex = i.index;
|
|
1449
|
+
const n = t.targets[t.targetIndex];
|
|
1450
|
+
n.endIndex = i.endIndex;
|
|
1451
|
+
const s = X(
|
|
1452
|
+
n.coordinates,
|
|
1453
|
+
n.endIndex
|
|
1454
|
+
), r = this.getMap().getPixelFromCoordinate(s);
|
|
1455
|
+
e.coordinate = s, e.pixel = [Math.round(r[0]), Math.round(r[1])];
|
|
1456
1456
|
}
|
|
1457
1457
|
/**
|
|
1458
1458
|
* Handle pointer up events.
|
|
@@ -1463,10 +1463,10 @@ class Dt extends me {
|
|
|
1463
1463
|
let t = !0;
|
|
1464
1464
|
if (this.getPointerCount() === 0) {
|
|
1465
1465
|
this.downTimeout_ && (clearTimeout(this.downTimeout_), this.downTimeout_ = void 0), this.handlePointerMove_(e);
|
|
1466
|
-
const
|
|
1466
|
+
const i = this.traceState_.active;
|
|
1467
1467
|
if (this.toggleTraceState_(e), this.shouldHandle_) {
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1468
|
+
const n = !this.finishCoordinate_;
|
|
1469
|
+
n && this.startDrawing_(e.coordinate), !n && this.freehand_ ? this.finishDrawing() : !this.freehand_ && (!n || this.mode_ === "Point") && (this.atFinish_(e.pixel, i) ? this.finishCondition_(e) && this.finishDrawing() : this.addToDrawing_(e.coordinate)), t = !1;
|
|
1470
1470
|
} else this.freehand_ && this.abortDrawing();
|
|
1471
1471
|
}
|
|
1472
1472
|
return !t && this.stopClick_ && e.preventDefault(), t;
|
|
@@ -1478,7 +1478,7 @@ class Dt extends me {
|
|
|
1478
1478
|
*/
|
|
1479
1479
|
handlePointerMove_(e) {
|
|
1480
1480
|
if (this.pointerType_ = e.originalEvent.pointerType, this.downPx_ && (!this.freehand_ && this.shouldHandle_ || this.freehand_ && !this.shouldHandle_)) {
|
|
1481
|
-
const t = this.downPx_,
|
|
1481
|
+
const t = this.downPx_, i = e.pixel, n = t[0] - i[0], s = t[1] - i[1], r = n * n + s * s;
|
|
1482
1482
|
if (this.shouldHandle_ = this.freehand_ ? r > this.squaredClickTolerance_ : r <= this.squaredClickTolerance_, !this.shouldHandle_)
|
|
1483
1483
|
return;
|
|
1484
1484
|
}
|
|
@@ -1496,64 +1496,64 @@ class Dt extends me {
|
|
|
1496
1496
|
* @private
|
|
1497
1497
|
*/
|
|
1498
1498
|
atFinish_(e, t) {
|
|
1499
|
-
let
|
|
1499
|
+
let i = !1;
|
|
1500
1500
|
if (this.sketchFeature_) {
|
|
1501
|
-
let
|
|
1501
|
+
let n = !1, s = [this.finishCoordinate_];
|
|
1502
1502
|
const r = this.mode_;
|
|
1503
1503
|
if (r === "Point")
|
|
1504
|
-
|
|
1504
|
+
i = !0;
|
|
1505
1505
|
else if (r === "Circle")
|
|
1506
|
-
|
|
1506
|
+
i = this.sketchCoords_.length === 2;
|
|
1507
1507
|
else if (r === "LineString")
|
|
1508
|
-
|
|
1508
|
+
n = !t && this.sketchCoords_.length > this.minPoints_;
|
|
1509
1509
|
else if (r === "Polygon") {
|
|
1510
1510
|
const o = (
|
|
1511
1511
|
/** @type {PolyCoordType} */
|
|
1512
1512
|
this.sketchCoords_
|
|
1513
1513
|
);
|
|
1514
|
-
|
|
1514
|
+
n = o[0].length > this.minPoints_, s = [
|
|
1515
1515
|
o[0][0],
|
|
1516
1516
|
o[0][o[0].length - 2]
|
|
1517
|
-
], t ?
|
|
1517
|
+
], t ? s = [o[0][0]] : s = [
|
|
1518
1518
|
o[0][0],
|
|
1519
1519
|
o[0][o[0].length - 2]
|
|
1520
1520
|
];
|
|
1521
1521
|
}
|
|
1522
|
-
if (
|
|
1522
|
+
if (n) {
|
|
1523
1523
|
const o = this.getMap();
|
|
1524
|
-
for (let a = 0, h =
|
|
1525
|
-
const c =
|
|
1526
|
-
if (
|
|
1524
|
+
for (let a = 0, h = s.length; a < h; a++) {
|
|
1525
|
+
const c = s[a], u = o.getPixelFromCoordinate(c), g = e[0] - u[0], d = e[1] - u[1], f = this.freehand_ ? 1 : this.snapTolerance_;
|
|
1526
|
+
if (i = Math.sqrt(g * g + d * d) <= f, i) {
|
|
1527
1527
|
this.finishCoordinate_ = c;
|
|
1528
1528
|
break;
|
|
1529
1529
|
}
|
|
1530
1530
|
}
|
|
1531
1531
|
}
|
|
1532
1532
|
}
|
|
1533
|
-
return
|
|
1533
|
+
return i;
|
|
1534
1534
|
}
|
|
1535
1535
|
/**
|
|
1536
1536
|
* @param {import("../coordinate").Coordinate} coordinates Coordinate.
|
|
1537
1537
|
* @private
|
|
1538
1538
|
*/
|
|
1539
1539
|
createOrUpdateSketchPoint_(e) {
|
|
1540
|
-
this.sketchPoint_ ? this.sketchPoint_.getGeometry().setCoordinates(e) : (this.sketchPoint_ = new
|
|
1540
|
+
this.sketchPoint_ ? this.sketchPoint_.getGeometry().setCoordinates(e) : (this.sketchPoint_ = new G(new W(e)), this.updateSketchFeatures_());
|
|
1541
1541
|
}
|
|
1542
1542
|
/**
|
|
1543
1543
|
* @param {import("../geom/Polygon.js").default} geometry Polygon geometry.
|
|
1544
1544
|
* @private
|
|
1545
1545
|
*/
|
|
1546
1546
|
createOrUpdateCustomSketchLine_(e) {
|
|
1547
|
-
this.sketchLine_ || (this.sketchLine_ = new
|
|
1547
|
+
this.sketchLine_ || (this.sketchLine_ = new G());
|
|
1548
1548
|
const t = e.getLinearRing(0);
|
|
1549
|
-
let
|
|
1550
|
-
|
|
1549
|
+
let i = this.sketchLine_.getGeometry();
|
|
1550
|
+
i ? (i.setFlatCoordinates(
|
|
1551
1551
|
t.getLayout(),
|
|
1552
1552
|
t.getFlatCoordinates()
|
|
1553
|
-
),
|
|
1553
|
+
), i.changed()) : (i = new le(
|
|
1554
1554
|
t.getFlatCoordinates(),
|
|
1555
1555
|
t.getLayout()
|
|
1556
|
-
), this.sketchLine_.setGeometry(
|
|
1556
|
+
), this.sketchLine_.setGeometry(i));
|
|
1557
1557
|
}
|
|
1558
1558
|
/**
|
|
1559
1559
|
* Start the drawing.
|
|
@@ -1561,17 +1561,17 @@ class Dt extends me {
|
|
|
1561
1561
|
* @private
|
|
1562
1562
|
*/
|
|
1563
1563
|
startDrawing_(e) {
|
|
1564
|
-
const t = this.getMap().getView().getProjection(),
|
|
1565
|
-
for (; e.length <
|
|
1564
|
+
const t = this.getMap().getView().getProjection(), i = Ke(this.geometryLayout_);
|
|
1565
|
+
for (; e.length < i; )
|
|
1566
1566
|
e.push(0);
|
|
1567
|
-
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
|
|
1568
|
-
const
|
|
1567
|
+
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 G(new le(this.sketchLineCoords_)));
|
|
1568
|
+
const n = this.geometryFunction_(
|
|
1569
1569
|
this.sketchCoords_,
|
|
1570
1570
|
void 0,
|
|
1571
1571
|
t
|
|
1572
1572
|
);
|
|
1573
|
-
this.sketchFeature_ = new
|
|
1574
|
-
new
|
|
1573
|
+
this.sketchFeature_ = new G(), this.geometryName_ && this.sketchFeature_.setGeometryName(this.geometryName_), this.sketchFeature_.setGeometry(n), this.updateSketchFeatures_(), this.dispatchEvent(
|
|
1574
|
+
new se(ne.DRAWSTART, this.sketchFeature_)
|
|
1575
1575
|
);
|
|
1576
1576
|
}
|
|
1577
1577
|
/**
|
|
@@ -1580,19 +1580,19 @@ class Dt extends me {
|
|
|
1580
1580
|
* @private
|
|
1581
1581
|
*/
|
|
1582
1582
|
modifyDrawing_(e) {
|
|
1583
|
-
const t = this.getMap(),
|
|
1583
|
+
const t = this.getMap(), i = this.sketchFeature_.getGeometry(), n = t.getView().getProjection(), s = Ke(this.geometryLayout_);
|
|
1584
1584
|
let r, o;
|
|
1585
|
-
for (; e.length <
|
|
1585
|
+
for (; e.length < s; )
|
|
1586
1586
|
e.push(0);
|
|
1587
1587
|
this.mode_ === "Point" ? o = this.sketchCoords_ : this.mode_ === "Polygon" ? (r = /** @type {PolyCoordType} */
|
|
1588
1588
|
this.sketchCoords_[0], o = r[r.length - 1], this.atFinish_(t.getPixelFromCoordinate(e)) && (e = this.finishCoordinate_.slice())) : (r = this.sketchCoords_, o = r[r.length - 1]), o[0] = e[0], o[1] = e[1], this.geometryFunction_(
|
|
1589
1589
|
/** @type {!LineCoordType} */
|
|
1590
1590
|
this.sketchCoords_,
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
), this.sketchPoint_ && this.sketchPoint_.getGeometry().setCoordinates(e),
|
|
1591
|
+
i,
|
|
1592
|
+
n
|
|
1593
|
+
), this.sketchPoint_ && this.sketchPoint_.getGeometry().setCoordinates(e), i.getType() === "Polygon" && this.mode_ !== "Polygon" ? this.createOrUpdateCustomSketchLine_(
|
|
1594
1594
|
/** @type {Polygon} */
|
|
1595
|
-
|
|
1595
|
+
i
|
|
1596
1596
|
) : this.sketchLineCoords_ && this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_), this.updateSketchFeatures_();
|
|
1597
1597
|
}
|
|
1598
1598
|
/**
|
|
@@ -1601,12 +1601,12 @@ class Dt extends me {
|
|
|
1601
1601
|
* @private
|
|
1602
1602
|
*/
|
|
1603
1603
|
addToDrawing_(e) {
|
|
1604
|
-
const t = this.sketchFeature_.getGeometry(),
|
|
1605
|
-
let
|
|
1604
|
+
const t = this.sketchFeature_.getGeometry(), i = this.getMap().getView().getProjection();
|
|
1605
|
+
let n, s;
|
|
1606
1606
|
const r = this.mode_;
|
|
1607
|
-
r === "LineString" || r === "Circle" ? (this.finishCoordinate_ = e.slice(),
|
|
1608
|
-
this.sketchCoords_,
|
|
1609
|
-
this.sketchCoords_[0],
|
|
1607
|
+
r === "LineString" || r === "Circle" ? (this.finishCoordinate_ = e.slice(), s = /** @type {LineCoordType} */
|
|
1608
|
+
this.sketchCoords_, s.length >= this.maxPoints_ && (this.freehand_ ? s.pop() : n = !0), s.push(e.slice()), this.geometryFunction_(s, t, i)) : r === "Polygon" && (s = /** @type {PolyCoordType} */
|
|
1609
|
+
this.sketchCoords_[0], s.length >= this.maxPoints_ && (this.freehand_ ? s.pop() : n = !0), s.push(e.slice()), n && (this.finishCoordinate_ = s[0]), this.geometryFunction_(this.sketchCoords_, t, i)), this.createOrUpdateSketchPoint_(e.slice()), this.updateSketchFeatures_(), n && this.finishDrawing();
|
|
1610
1610
|
}
|
|
1611
1611
|
/**
|
|
1612
1612
|
* @param {number} n The number of points to remove.
|
|
@@ -1614,21 +1614,21 @@ class Dt extends me {
|
|
|
1614
1614
|
removeLastPoints_(e) {
|
|
1615
1615
|
if (!this.sketchFeature_)
|
|
1616
1616
|
return;
|
|
1617
|
-
const t = this.sketchFeature_.getGeometry(),
|
|
1618
|
-
for (let
|
|
1617
|
+
const t = this.sketchFeature_.getGeometry(), i = this.getMap().getView().getProjection(), n = this.mode_;
|
|
1618
|
+
for (let s = 0; s < e; ++s) {
|
|
1619
1619
|
let r;
|
|
1620
|
-
if (
|
|
1620
|
+
if (n === "LineString" || n === "Circle") {
|
|
1621
1621
|
if (r = /** @type {LineCoordType} */
|
|
1622
1622
|
this.sketchCoords_, r.splice(-2, 1), r.length >= 2) {
|
|
1623
1623
|
this.finishCoordinate_ = r[r.length - 2].slice();
|
|
1624
1624
|
const o = this.finishCoordinate_.slice();
|
|
1625
1625
|
r[r.length - 1] = o, this.createOrUpdateSketchPoint_(o);
|
|
1626
1626
|
}
|
|
1627
|
-
this.geometryFunction_(r, t,
|
|
1627
|
+
this.geometryFunction_(r, t, i), t.getType() === "Polygon" && this.sketchLine_ && this.createOrUpdateCustomSketchLine_(
|
|
1628
1628
|
/** @type {Polygon} */
|
|
1629
1629
|
t
|
|
1630
1630
|
);
|
|
1631
|
-
} else if (
|
|
1631
|
+
} else if (n === "Polygon") {
|
|
1632
1632
|
r = /** @type {PolyCoordType} */
|
|
1633
1633
|
this.sketchCoords_[0], r.splice(-2, 1);
|
|
1634
1634
|
const o = this.sketchLine_.getGeometry();
|
|
@@ -1636,7 +1636,7 @@ class Dt extends me {
|
|
|
1636
1636
|
const a = r[r.length - 2].slice();
|
|
1637
1637
|
r[r.length - 1] = a, this.createOrUpdateSketchPoint_(a);
|
|
1638
1638
|
}
|
|
1639
|
-
o.setCoordinates(r), this.geometryFunction_(this.sketchCoords_, t,
|
|
1639
|
+
o.setCoordinates(r), this.geometryFunction_(this.sketchCoords_, t, i);
|
|
1640
1640
|
}
|
|
1641
1641
|
if (r.length === 1) {
|
|
1642
1642
|
this.abortDrawing();
|
|
@@ -1664,23 +1664,23 @@ class Dt extends me {
|
|
|
1664
1664
|
if (!e)
|
|
1665
1665
|
return;
|
|
1666
1666
|
let t = this.sketchCoords_;
|
|
1667
|
-
const
|
|
1668
|
-
this.mode_ === "LineString" ? (t.pop(), this.geometryFunction_(t,
|
|
1669
|
-
new
|
|
1667
|
+
const i = e.getGeometry(), n = this.getMap().getView().getProjection();
|
|
1668
|
+
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(
|
|
1669
|
+
new Dt([
|
|
1670
1670
|
/** @type {PointCoordType} */
|
|
1671
1671
|
t
|
|
1672
1672
|
])
|
|
1673
1673
|
) : this.type_ === "MultiLineString" ? e.setGeometry(
|
|
1674
|
-
new
|
|
1674
|
+
new $e([
|
|
1675
1675
|
/** @type {LineCoordType} */
|
|
1676
1676
|
t
|
|
1677
1677
|
])
|
|
1678
1678
|
) : this.type_ === "MultiPolygon" && e.setGeometry(
|
|
1679
|
-
new
|
|
1679
|
+
new Je([
|
|
1680
1680
|
/** @type {PolyCoordType} */
|
|
1681
1681
|
t
|
|
1682
1682
|
])
|
|
1683
|
-
), this.dispatchEvent(new
|
|
1683
|
+
), this.dispatchEvent(new se(ne.DRAWEND, e)), this.features_ && this.features_.push(e), this.source_ && this.source_.addFeature(e);
|
|
1684
1684
|
}
|
|
1685
1685
|
/**
|
|
1686
1686
|
* Stop drawing without adding the sketch feature to the target layer.
|
|
@@ -1698,7 +1698,7 @@ class Dt extends me {
|
|
|
1698
1698
|
*/
|
|
1699
1699
|
abortDrawing() {
|
|
1700
1700
|
const e = this.abortDrawing_();
|
|
1701
|
-
e && this.dispatchEvent(new
|
|
1701
|
+
e && this.dispatchEvent(new se(ne.DRAWABORT, e));
|
|
1702
1702
|
}
|
|
1703
1703
|
/**
|
|
1704
1704
|
* Append coordinates to the end of the geometry that is currently being drawn.
|
|
@@ -1710,24 +1710,24 @@ class Dt extends me {
|
|
|
1710
1710
|
* @api
|
|
1711
1711
|
*/
|
|
1712
1712
|
appendCoordinates(e) {
|
|
1713
|
-
const t = this.mode_,
|
|
1714
|
-
|
|
1715
|
-
let
|
|
1713
|
+
const t = this.mode_, i = !this.sketchFeature_;
|
|
1714
|
+
i && this.startDrawing_(e[0]);
|
|
1715
|
+
let n;
|
|
1716
1716
|
if (t === "LineString" || t === "Circle")
|
|
1717
|
-
|
|
1717
|
+
n = /** @type {LineCoordType} */
|
|
1718
1718
|
this.sketchCoords_;
|
|
1719
1719
|
else if (t === "Polygon")
|
|
1720
|
-
|
|
1720
|
+
n = this.sketchCoords_ && this.sketchCoords_.length ? (
|
|
1721
1721
|
/** @type {PolyCoordType} */
|
|
1722
1722
|
this.sketchCoords_[0]
|
|
1723
1723
|
) : [];
|
|
1724
1724
|
else
|
|
1725
1725
|
return;
|
|
1726
|
-
|
|
1726
|
+
i && n.shift(), n.pop();
|
|
1727
1727
|
for (let r = 0; r < e.length; r++)
|
|
1728
1728
|
this.addToDrawing_(e[r]);
|
|
1729
|
-
const
|
|
1730
|
-
this.addToDrawing_(
|
|
1729
|
+
const s = e[e.length - 1];
|
|
1730
|
+
this.addToDrawing_(s), this.modifyDrawing_(s);
|
|
1731
1731
|
}
|
|
1732
1732
|
/**
|
|
1733
1733
|
* Initiate draw mode by starting from an existing geometry which will
|
|
@@ -1742,11 +1742,11 @@ class Dt extends me {
|
|
|
1742
1742
|
* @api
|
|
1743
1743
|
*/
|
|
1744
1744
|
extend(e) {
|
|
1745
|
-
const
|
|
1746
|
-
this.sketchFeature_ = e, this.sketchCoords_ =
|
|
1747
|
-
const
|
|
1748
|
-
this.finishCoordinate_ =
|
|
1749
|
-
new
|
|
1745
|
+
const i = e.getGeometry();
|
|
1746
|
+
this.sketchFeature_ = e, this.sketchCoords_ = i.getCoordinates();
|
|
1747
|
+
const n = this.sketchCoords_[this.sketchCoords_.length - 1];
|
|
1748
|
+
this.finishCoordinate_ = n.slice(), this.sketchCoords_.push(n.slice()), this.sketchPoint_ = new G(new W(n)), this.updateSketchFeatures_(), this.dispatchEvent(
|
|
1749
|
+
new se(ne.DRAWSTART, this.sketchFeature_)
|
|
1750
1750
|
);
|
|
1751
1751
|
}
|
|
1752
1752
|
/**
|
|
@@ -1767,13 +1767,13 @@ class Dt extends me {
|
|
|
1767
1767
|
(!e || !t) && this.abortDrawing(), this.overlay_.setMap(t ? e : null);
|
|
1768
1768
|
}
|
|
1769
1769
|
}
|
|
1770
|
-
function
|
|
1771
|
-
const l =
|
|
1770
|
+
function _i() {
|
|
1771
|
+
const l = ke();
|
|
1772
1772
|
return function(e, t) {
|
|
1773
1773
|
return l[e.getGeometry().getType()];
|
|
1774
1774
|
};
|
|
1775
1775
|
}
|
|
1776
|
-
function
|
|
1776
|
+
function mi(l) {
|
|
1777
1777
|
switch (l) {
|
|
1778
1778
|
case "Point":
|
|
1779
1779
|
case "MultiPoint":
|
|
@@ -1790,7 +1790,7 @@ function Lt(l) {
|
|
|
1790
1790
|
throw new Error("Invalid type: " + l);
|
|
1791
1791
|
}
|
|
1792
1792
|
}
|
|
1793
|
-
const
|
|
1793
|
+
const yi = {
|
|
1794
1794
|
/**
|
|
1795
1795
|
* Triggered upon snapping to vertex or edge
|
|
1796
1796
|
* @event SnapEvent#snap
|
|
@@ -1798,7 +1798,7 @@ const kt = {
|
|
|
1798
1798
|
*/
|
|
1799
1799
|
SNAP: "snap"
|
|
1800
1800
|
};
|
|
1801
|
-
class
|
|
1801
|
+
class xi extends J {
|
|
1802
1802
|
/**
|
|
1803
1803
|
* @param {SnapEventType} type Type.
|
|
1804
1804
|
* @param {Object} options Options.
|
|
@@ -1810,7 +1810,7 @@ class vt extends ne {
|
|
|
1810
1810
|
super(e), this.vertex = t.vertex, this.vertexPixel = t.vertexPixel, this.feature = t.feature;
|
|
1811
1811
|
}
|
|
1812
1812
|
}
|
|
1813
|
-
function
|
|
1813
|
+
function qe(l) {
|
|
1814
1814
|
return (
|
|
1815
1815
|
/** @type {import("../source/Vector.js").VectorSourceEvent} */
|
|
1816
1816
|
l.feature ? (
|
|
@@ -1825,8 +1825,8 @@ function Me(l) {
|
|
|
1825
1825
|
)
|
|
1826
1826
|
);
|
|
1827
1827
|
}
|
|
1828
|
-
const
|
|
1829
|
-
class
|
|
1828
|
+
const pe = [];
|
|
1829
|
+
class Ci extends De {
|
|
1830
1830
|
/**
|
|
1831
1831
|
* @param {Options} [options] Options.
|
|
1832
1832
|
*/
|
|
@@ -1836,7 +1836,7 @@ class Gt extends me {
|
|
|
1836
1836
|
/** @type {import("./Pointer.js").Options} */
|
|
1837
1837
|
e
|
|
1838
1838
|
);
|
|
1839
|
-
t.handleDownEvent || (t.handleDownEvent =
|
|
1839
|
+
t.handleDownEvent || (t.handleDownEvent = ce), t.stopDown || (t.stopDown = Qe), 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 He(), this.GEOMETRY_SEGMENTERS_ = {
|
|
1840
1840
|
Point: this.segmentPointGeometry_.bind(this),
|
|
1841
1841
|
LineString: this.segmentLineStringGeometry_.bind(this),
|
|
1842
1842
|
LinearRing: this.segmentLineStringGeometry_.bind(this),
|
|
@@ -1857,24 +1857,24 @@ class Gt extends me {
|
|
|
1857
1857
|
*/
|
|
1858
1858
|
addFeature(e, t) {
|
|
1859
1859
|
t = t !== void 0 ? t : !0;
|
|
1860
|
-
const
|
|
1861
|
-
if (
|
|
1862
|
-
const
|
|
1863
|
-
if (
|
|
1864
|
-
this.indexedFeaturesExtents_[
|
|
1865
|
-
|
|
1860
|
+
const i = C(e), n = e.getGeometry();
|
|
1861
|
+
if (n) {
|
|
1862
|
+
const s = this.GEOMETRY_SEGMENTERS_[n.getType()];
|
|
1863
|
+
if (s) {
|
|
1864
|
+
this.indexedFeaturesExtents_[i] = n.getExtent(
|
|
1865
|
+
Yt()
|
|
1866
1866
|
);
|
|
1867
1867
|
const r = (
|
|
1868
1868
|
/** @type {Array<Array<import('../coordinate.js').Coordinate>>} */
|
|
1869
1869
|
[]
|
|
1870
1870
|
);
|
|
1871
|
-
if (
|
|
1872
|
-
this.rBush_.insert(
|
|
1871
|
+
if (s(r, n), r.length === 1)
|
|
1872
|
+
this.rBush_.insert(P(r[0]), {
|
|
1873
1873
|
feature: e,
|
|
1874
1874
|
segment: r[0]
|
|
1875
1875
|
});
|
|
1876
1876
|
else if (r.length > 1) {
|
|
1877
|
-
const o = r.map((h) =>
|
|
1877
|
+
const o = r.map((h) => P(h)), a = r.map((h) => ({
|
|
1878
1878
|
feature: e,
|
|
1879
1879
|
segment: h
|
|
1880
1880
|
}));
|
|
@@ -1882,9 +1882,9 @@ class Gt extends me {
|
|
|
1882
1882
|
}
|
|
1883
1883
|
}
|
|
1884
1884
|
}
|
|
1885
|
-
t && (this.featureChangeListenerKeys_[
|
|
1885
|
+
t && (this.featureChangeListenerKeys_[i] = Y(
|
|
1886
1886
|
e,
|
|
1887
|
-
|
|
1887
|
+
$.CHANGE,
|
|
1888
1888
|
this.handleFeatureChange_,
|
|
1889
1889
|
this
|
|
1890
1890
|
));
|
|
@@ -1905,7 +1905,7 @@ class Gt extends me {
|
|
|
1905
1905
|
handleEvent(e) {
|
|
1906
1906
|
const t = this.snapTo(e.pixel, e.coordinate, e.map);
|
|
1907
1907
|
return t && (e.coordinate = t.vertex.slice(0, 2), e.pixel = t.vertexPixel, this.dispatchEvent(
|
|
1908
|
-
new
|
|
1908
|
+
new xi(yi.SNAP, {
|
|
1909
1909
|
vertex: e.coordinate,
|
|
1910
1910
|
vertexPixel: e.pixel,
|
|
1911
1911
|
feature: t.feature
|
|
@@ -1917,7 +1917,7 @@ class Gt extends me {
|
|
|
1917
1917
|
* @private
|
|
1918
1918
|
*/
|
|
1919
1919
|
handleFeatureAdd_(e) {
|
|
1920
|
-
const t =
|
|
1920
|
+
const t = qe(e);
|
|
1921
1921
|
t && this.addFeature(t);
|
|
1922
1922
|
}
|
|
1923
1923
|
/**
|
|
@@ -1925,7 +1925,7 @@ class Gt extends me {
|
|
|
1925
1925
|
* @private
|
|
1926
1926
|
*/
|
|
1927
1927
|
handleFeatureRemove_(e) {
|
|
1928
|
-
const t =
|
|
1928
|
+
const t = qe(e);
|
|
1929
1929
|
t && this.removeFeature(t);
|
|
1930
1930
|
}
|
|
1931
1931
|
/**
|
|
@@ -1938,8 +1938,8 @@ class Gt extends me {
|
|
|
1938
1938
|
e.target
|
|
1939
1939
|
);
|
|
1940
1940
|
if (this.handlingDownUpSequence) {
|
|
1941
|
-
const
|
|
1942
|
-
|
|
1941
|
+
const i = C(t);
|
|
1942
|
+
i in this.pendingFeatures_ || (this.pendingFeatures_[i] = t);
|
|
1943
1943
|
} else
|
|
1944
1944
|
this.updateFeature_(t);
|
|
1945
1945
|
}
|
|
@@ -1960,16 +1960,16 @@ class Gt extends me {
|
|
|
1960
1960
|
* @api
|
|
1961
1961
|
*/
|
|
1962
1962
|
removeFeature(e, t) {
|
|
1963
|
-
const
|
|
1964
|
-
if (
|
|
1963
|
+
const i = t !== void 0 ? t : !0, n = C(e), s = this.indexedFeaturesExtents_[n];
|
|
1964
|
+
if (s) {
|
|
1965
1965
|
const r = this.rBush_, o = [];
|
|
1966
|
-
r.forEachInExtent(
|
|
1966
|
+
r.forEachInExtent(s, function(a) {
|
|
1967
1967
|
e === a.feature && o.push(a);
|
|
1968
1968
|
});
|
|
1969
1969
|
for (let a = o.length - 1; a >= 0; --a)
|
|
1970
1970
|
r.remove(o[a]);
|
|
1971
1971
|
}
|
|
1972
|
-
|
|
1972
|
+
i && (me(this.featureChangeListenerKeys_[n]), delete this.featureChangeListenerKeys_[n]);
|
|
1973
1973
|
}
|
|
1974
1974
|
/**
|
|
1975
1975
|
* Remove the interaction from its current map and attach it to the new map.
|
|
@@ -1978,37 +1978,37 @@ class Gt extends me {
|
|
|
1978
1978
|
* @param {import("../Map.js").default} map Map.
|
|
1979
1979
|
*/
|
|
1980
1980
|
setMap(e) {
|
|
1981
|
-
const t = this.getMap(),
|
|
1981
|
+
const t = this.getMap(), i = this.featuresListenerKeys_, n = (
|
|
1982
1982
|
/** @type {Array<import("../Feature.js").default>} */
|
|
1983
1983
|
this.getFeatures_()
|
|
1984
1984
|
);
|
|
1985
|
-
t && (
|
|
1986
|
-
|
|
1985
|
+
t && (i.forEach(me), i.length = 0, this.rBush_.clear(), Object.values(this.featureChangeListenerKeys_).forEach(me), this.featureChangeListenerKeys_ = {}), super.setMap(e), e && (this.features_ ? i.push(
|
|
1986
|
+
Y(
|
|
1987
1987
|
this.features_,
|
|
1988
|
-
|
|
1988
|
+
A.ADD,
|
|
1989
1989
|
this.handleFeatureAdd_,
|
|
1990
1990
|
this
|
|
1991
1991
|
),
|
|
1992
|
-
|
|
1992
|
+
Y(
|
|
1993
1993
|
this.features_,
|
|
1994
|
-
|
|
1994
|
+
A.REMOVE,
|
|
1995
1995
|
this.handleFeatureRemove_,
|
|
1996
1996
|
this
|
|
1997
1997
|
)
|
|
1998
|
-
) : this.source_ &&
|
|
1999
|
-
|
|
1998
|
+
) : this.source_ && i.push(
|
|
1999
|
+
Y(
|
|
2000
2000
|
this.source_,
|
|
2001
|
-
|
|
2001
|
+
he.ADDFEATURE,
|
|
2002
2002
|
this.handleFeatureAdd_,
|
|
2003
2003
|
this
|
|
2004
2004
|
),
|
|
2005
|
-
|
|
2005
|
+
Y(
|
|
2006
2006
|
this.source_,
|
|
2007
|
-
|
|
2007
|
+
he.REMOVEFEATURE,
|
|
2008
2008
|
this.handleFeatureRemove_,
|
|
2009
2009
|
this
|
|
2010
2010
|
)
|
|
2011
|
-
),
|
|
2011
|
+
), n.forEach((s) => this.addFeature(s)));
|
|
2012
2012
|
}
|
|
2013
2013
|
/**
|
|
2014
2014
|
* @param {import("../pixel.js").Pixel} pixel Pixel
|
|
@@ -2016,26 +2016,26 @@ class Gt extends me {
|
|
|
2016
2016
|
* @param {import("../Map.js").default} map Map.
|
|
2017
2017
|
* @return {Result|null} Snap result
|
|
2018
2018
|
*/
|
|
2019
|
-
snapTo(e, t,
|
|
2020
|
-
|
|
2021
|
-
const
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2019
|
+
snapTo(e, t, i) {
|
|
2020
|
+
i.getView().getProjection();
|
|
2021
|
+
const n = p(t), s = it(
|
|
2022
|
+
nt(
|
|
2023
|
+
P([n]),
|
|
2024
|
+
i.getView().getResolution() * this.pixelTolerance_
|
|
2025
2025
|
)
|
|
2026
|
-
), r = this.rBush_.getInExtent(
|
|
2026
|
+
), r = this.rBush_.getInExtent(s), o = r.length;
|
|
2027
2027
|
if (o === 0)
|
|
2028
2028
|
return null;
|
|
2029
2029
|
let a, h = 1 / 0, c;
|
|
2030
|
-
const
|
|
2030
|
+
const u = this.pixelTolerance_ * this.pixelTolerance_, g = () => {
|
|
2031
2031
|
if (a) {
|
|
2032
|
-
const
|
|
2033
|
-
if (
|
|
2032
|
+
const d = i.getPixelFromCoordinate(a);
|
|
2033
|
+
if (O(e, d) <= u)
|
|
2034
2034
|
return {
|
|
2035
2035
|
vertex: a,
|
|
2036
2036
|
vertexPixel: [
|
|
2037
|
-
Math.round(
|
|
2038
|
-
Math.round(
|
|
2037
|
+
Math.round(d[0]),
|
|
2038
|
+
Math.round(d[1])
|
|
2039
2039
|
],
|
|
2040
2040
|
feature: c
|
|
2041
2041
|
};
|
|
@@ -2046,37 +2046,37 @@ class Gt extends me {
|
|
|
2046
2046
|
for (let f = 0; f < o; ++f) {
|
|
2047
2047
|
const _ = r[f];
|
|
2048
2048
|
_.feature.getGeometry().getType() !== "Circle" && _.segment.forEach((x) => {
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2049
|
+
const T = p(x), F = O(n, T);
|
|
2050
|
+
F < h && (a = x, h = F, c = _.feature);
|
|
2051
2051
|
});
|
|
2052
2052
|
}
|
|
2053
|
-
const
|
|
2054
|
-
if (
|
|
2055
|
-
return
|
|
2053
|
+
const d = g();
|
|
2054
|
+
if (d)
|
|
2055
|
+
return d;
|
|
2056
2056
|
}
|
|
2057
2057
|
if (this.edge_) {
|
|
2058
2058
|
for (let f = 0; f < o; ++f) {
|
|
2059
2059
|
let _ = null;
|
|
2060
2060
|
const x = r[f];
|
|
2061
2061
|
if (x.feature.getGeometry().getType() === "Circle") {
|
|
2062
|
-
let
|
|
2063
|
-
_ =
|
|
2064
|
-
|
|
2062
|
+
let T = x.feature.getGeometry();
|
|
2063
|
+
_ = Wt(
|
|
2064
|
+
n,
|
|
2065
2065
|
/** @type {import("../geom/Circle.js").default} */
|
|
2066
|
-
|
|
2066
|
+
T
|
|
2067
2067
|
);
|
|
2068
2068
|
} else {
|
|
2069
|
-
const [
|
|
2070
|
-
|
|
2069
|
+
const [T, F] = x.segment;
|
|
2070
|
+
F && (pe[0] = p(T), pe[1] = p(F), _ = st(n, pe));
|
|
2071
2071
|
}
|
|
2072
2072
|
if (_) {
|
|
2073
|
-
const
|
|
2074
|
-
|
|
2073
|
+
const T = O(n, _);
|
|
2074
|
+
T < h && (a = de(_), h = T);
|
|
2075
2075
|
}
|
|
2076
2076
|
}
|
|
2077
|
-
const
|
|
2078
|
-
if (
|
|
2079
|
-
return
|
|
2077
|
+
const d = g();
|
|
2078
|
+
if (d)
|
|
2079
|
+
return d;
|
|
2080
2080
|
}
|
|
2081
2081
|
return null;
|
|
2082
2082
|
}
|
|
@@ -2094,9 +2094,9 @@ class Gt extends me {
|
|
|
2094
2094
|
*/
|
|
2095
2095
|
segmentCircleGeometry_(e, t) {
|
|
2096
2096
|
this.getMap().getView().getProjection();
|
|
2097
|
-
const
|
|
2098
|
-
for (let r = 0, o =
|
|
2099
|
-
e.push(
|
|
2097
|
+
const s = Ht(t).getCoordinates()[0];
|
|
2098
|
+
for (let r = 0, o = s.length - 1; r < o; ++r)
|
|
2099
|
+
e.push(s.slice(r, r + 2));
|
|
2100
2100
|
}
|
|
2101
2101
|
/**
|
|
2102
2102
|
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
|
@@ -2104,10 +2104,10 @@ class Gt extends me {
|
|
|
2104
2104
|
* @private
|
|
2105
2105
|
*/
|
|
2106
2106
|
segmentGeometryCollectionGeometry_(e, t) {
|
|
2107
|
-
const
|
|
2108
|
-
for (let
|
|
2109
|
-
const
|
|
2110
|
-
|
|
2107
|
+
const i = t.getGeometriesArray();
|
|
2108
|
+
for (let n = 0; n < i.length; ++n) {
|
|
2109
|
+
const s = this.GEOMETRY_SEGMENTERS_[i[n].getType()];
|
|
2110
|
+
s && s(e, i[n]);
|
|
2111
2111
|
}
|
|
2112
2112
|
}
|
|
2113
2113
|
/**
|
|
@@ -2116,9 +2116,9 @@ class Gt extends me {
|
|
|
2116
2116
|
* @private
|
|
2117
2117
|
*/
|
|
2118
2118
|
segmentLineStringGeometry_(e, t) {
|
|
2119
|
-
const
|
|
2120
|
-
for (let
|
|
2121
|
-
e.push(
|
|
2119
|
+
const i = t.getCoordinates();
|
|
2120
|
+
for (let n = 0, s = i.length - 1; n < s; ++n)
|
|
2121
|
+
e.push(i.slice(n, n + 2));
|
|
2122
2122
|
}
|
|
2123
2123
|
/**
|
|
2124
2124
|
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
|
@@ -2126,9 +2126,9 @@ class Gt extends me {
|
|
|
2126
2126
|
* @private
|
|
2127
2127
|
*/
|
|
2128
2128
|
segmentMultiLineStringGeometry_(e, t) {
|
|
2129
|
-
const
|
|
2130
|
-
for (let
|
|
2131
|
-
const r =
|
|
2129
|
+
const i = t.getCoordinates();
|
|
2130
|
+
for (let n = 0, s = i.length; n < s; ++n) {
|
|
2131
|
+
const r = i[n];
|
|
2132
2132
|
for (let o = 0, a = r.length - 1; o < a; ++o)
|
|
2133
2133
|
e.push(r.slice(o, o + 2));
|
|
2134
2134
|
}
|
|
@@ -2139,8 +2139,8 @@ class Gt extends me {
|
|
|
2139
2139
|
* @private
|
|
2140
2140
|
*/
|
|
2141
2141
|
segmentMultiPointGeometry_(e, t) {
|
|
2142
|
-
t.getCoordinates().forEach((
|
|
2143
|
-
e.push([
|
|
2142
|
+
t.getCoordinates().forEach((i) => {
|
|
2143
|
+
e.push([i]);
|
|
2144
2144
|
});
|
|
2145
2145
|
}
|
|
2146
2146
|
/**
|
|
@@ -2149,12 +2149,12 @@ class Gt extends me {
|
|
|
2149
2149
|
* @private
|
|
2150
2150
|
*/
|
|
2151
2151
|
segmentMultiPolygonGeometry_(e, t) {
|
|
2152
|
-
const
|
|
2153
|
-
for (let
|
|
2154
|
-
const r =
|
|
2152
|
+
const i = t.getCoordinates();
|
|
2153
|
+
for (let n = 0, s = i.length; n < s; ++n) {
|
|
2154
|
+
const r = i[n];
|
|
2155
2155
|
for (let o = 0, a = r.length; o < a; ++o) {
|
|
2156
2156
|
const h = r[o];
|
|
2157
|
-
for (let c = 0,
|
|
2157
|
+
for (let c = 0, u = h.length - 1; c < u; ++c)
|
|
2158
2158
|
e.push(h.slice(c, c + 2));
|
|
2159
2159
|
}
|
|
2160
2160
|
}
|
|
@@ -2173,77 +2173,1424 @@ class Gt extends me {
|
|
|
2173
2173
|
* @private
|
|
2174
2174
|
*/
|
|
2175
2175
|
segmentPolygonGeometry_(e, t) {
|
|
2176
|
-
const
|
|
2177
|
-
for (let
|
|
2178
|
-
const r =
|
|
2176
|
+
const i = t.getCoordinates();
|
|
2177
|
+
for (let n = 0, s = i.length; n < s; ++n) {
|
|
2178
|
+
const r = i[n];
|
|
2179
2179
|
for (let o = 0, a = r.length - 1; o < a; ++o)
|
|
2180
2180
|
e.push(r.slice(o, o + 2));
|
|
2181
2181
|
}
|
|
2182
2182
|
}
|
|
2183
2183
|
}
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2184
|
+
class Ti {
|
|
2185
|
+
/**
|
|
2186
|
+
* @param {number} [highWaterMark] High water mark.
|
|
2187
|
+
*/
|
|
2188
|
+
constructor(e) {
|
|
2189
|
+
this.highWaterMark = e !== void 0 ? e : 2048, this.count_ = 0, this.entries_ = {}, this.oldest_ = null, this.newest_ = null;
|
|
2190
|
+
}
|
|
2191
|
+
/**
|
|
2192
|
+
* @return {boolean} Can expire cache.
|
|
2193
|
+
*/
|
|
2194
|
+
canExpireCache() {
|
|
2195
|
+
return this.highWaterMark > 0 && this.getCount() > this.highWaterMark;
|
|
2196
|
+
}
|
|
2197
|
+
/**
|
|
2198
|
+
* Expire the cache.
|
|
2199
|
+
* @param {!Object<string, boolean>} [keep] Keys to keep. To be implemented by subclasses.
|
|
2200
|
+
*/
|
|
2201
|
+
expireCache(e) {
|
|
2202
|
+
for (; this.canExpireCache(); )
|
|
2203
|
+
this.pop();
|
|
2204
|
+
}
|
|
2205
|
+
/**
|
|
2206
|
+
* FIXME empty description for jsdoc
|
|
2207
|
+
*/
|
|
2208
|
+
clear() {
|
|
2209
|
+
this.count_ = 0, this.entries_ = {}, this.oldest_ = null, this.newest_ = null;
|
|
2210
|
+
}
|
|
2211
|
+
/**
|
|
2212
|
+
* @param {string} key Key.
|
|
2213
|
+
* @return {boolean} Contains key.
|
|
2214
|
+
*/
|
|
2215
|
+
containsKey(e) {
|
|
2216
|
+
return this.entries_.hasOwnProperty(e);
|
|
2217
|
+
}
|
|
2218
|
+
/**
|
|
2219
|
+
* @param {function(T, string, LRUCache<T>): ?} f The function
|
|
2220
|
+
* to call for every entry from the oldest to the newer. This function takes
|
|
2221
|
+
* 3 arguments (the entry value, the entry key and the LRUCache object).
|
|
2222
|
+
* The return value is ignored.
|
|
2223
|
+
*/
|
|
2224
|
+
forEach(e) {
|
|
2225
|
+
let t = this.oldest_;
|
|
2226
|
+
for (; t; )
|
|
2227
|
+
e(t.value_, t.key_, this), t = t.newer;
|
|
2228
|
+
}
|
|
2229
|
+
/**
|
|
2230
|
+
* @param {string} key Key.
|
|
2231
|
+
* @param {*} [options] Options (reserved for subclasses).
|
|
2232
|
+
* @return {T} Value.
|
|
2233
|
+
*/
|
|
2234
|
+
get(e, t) {
|
|
2235
|
+
const i = this.entries_[e];
|
|
2236
|
+
return M(i !== void 0, 15), i === this.newest_ || (i === this.oldest_ ? (this.oldest_ = /** @type {Entry} */
|
|
2237
|
+
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_;
|
|
2238
|
+
}
|
|
2239
|
+
/**
|
|
2240
|
+
* Remove an entry from the cache.
|
|
2241
|
+
* @param {string} key The entry key.
|
|
2242
|
+
* @return {T} The removed entry.
|
|
2243
|
+
*/
|
|
2244
|
+
remove(e) {
|
|
2245
|
+
const t = this.entries_[e];
|
|
2246
|
+
return M(t !== void 0, 15), t === this.newest_ ? (this.newest_ = /** @type {Entry} */
|
|
2247
|
+
t.older, this.newest_ && (this.newest_.newer = null)) : t === this.oldest_ ? (this.oldest_ = /** @type {Entry} */
|
|
2248
|
+
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_;
|
|
2249
|
+
}
|
|
2250
|
+
/**
|
|
2251
|
+
* @return {number} Count.
|
|
2252
|
+
*/
|
|
2253
|
+
getCount() {
|
|
2254
|
+
return this.count_;
|
|
2255
|
+
}
|
|
2256
|
+
/**
|
|
2257
|
+
* @return {Array<string>} Keys.
|
|
2258
|
+
*/
|
|
2259
|
+
getKeys() {
|
|
2260
|
+
const e = new Array(this.count_);
|
|
2261
|
+
let t = 0, i;
|
|
2262
|
+
for (i = this.newest_; i; i = i.older)
|
|
2263
|
+
e[t++] = i.key_;
|
|
2264
|
+
return e;
|
|
2265
|
+
}
|
|
2266
|
+
/**
|
|
2267
|
+
* @return {Array<T>} Values.
|
|
2268
|
+
*/
|
|
2269
|
+
getValues() {
|
|
2270
|
+
const e = new Array(this.count_);
|
|
2271
|
+
let t = 0, i;
|
|
2272
|
+
for (i = this.newest_; i; i = i.older)
|
|
2273
|
+
e[t++] = i.value_;
|
|
2274
|
+
return e;
|
|
2275
|
+
}
|
|
2276
|
+
/**
|
|
2277
|
+
* @return {T} Last value.
|
|
2278
|
+
*/
|
|
2279
|
+
peekLast() {
|
|
2280
|
+
return this.oldest_.value_;
|
|
2281
|
+
}
|
|
2282
|
+
/**
|
|
2283
|
+
* @return {string} Last key.
|
|
2284
|
+
*/
|
|
2285
|
+
peekLastKey() {
|
|
2286
|
+
return this.oldest_.key_;
|
|
2287
|
+
}
|
|
2288
|
+
/**
|
|
2289
|
+
* Get the key of the newest item in the cache. Throws if the cache is empty.
|
|
2290
|
+
* @return {string} The newest key.
|
|
2291
|
+
*/
|
|
2292
|
+
peekFirstKey() {
|
|
2293
|
+
return this.newest_.key_;
|
|
2294
|
+
}
|
|
2295
|
+
/**
|
|
2296
|
+
* Return an entry without updating least recently used time.
|
|
2297
|
+
* @param {string} key Key.
|
|
2298
|
+
* @return {T} Value.
|
|
2299
|
+
*/
|
|
2300
|
+
peek(e) {
|
|
2301
|
+
if (this.containsKey(e))
|
|
2302
|
+
return this.entries_[e].value_;
|
|
2303
|
+
}
|
|
2304
|
+
/**
|
|
2305
|
+
* @return {T} value Value.
|
|
2306
|
+
*/
|
|
2307
|
+
pop() {
|
|
2308
|
+
const e = this.oldest_;
|
|
2309
|
+
return delete this.entries_[e.key_], e.newer && (e.newer.older = null), this.oldest_ = /** @type {Entry} */
|
|
2310
|
+
e.newer, this.oldest_ || (this.newest_ = null), --this.count_, e.value_;
|
|
2311
|
+
}
|
|
2312
|
+
/**
|
|
2313
|
+
* @param {string} key Key.
|
|
2314
|
+
* @param {T} value Value.
|
|
2315
|
+
*/
|
|
2316
|
+
replace(e, t) {
|
|
2317
|
+
this.get(e), this.entries_[e].value_ = t;
|
|
2318
|
+
}
|
|
2319
|
+
/**
|
|
2320
|
+
* @param {string} key Key.
|
|
2321
|
+
* @param {T} value Value.
|
|
2322
|
+
*/
|
|
2323
|
+
set(e, t) {
|
|
2324
|
+
M(!(e in this.entries_), 16);
|
|
2325
|
+
const i = {
|
|
2326
|
+
key_: e,
|
|
2327
|
+
newer: null,
|
|
2328
|
+
older: this.newest_,
|
|
2329
|
+
value_: t
|
|
2330
|
+
};
|
|
2331
|
+
this.newest_ ? this.newest_.newer = i : this.oldest_ = i, this.newest_ = i, this.entries_[e] = i, ++this.count_;
|
|
2332
|
+
}
|
|
2333
|
+
/**
|
|
2334
|
+
* Set a maximum number of entries for the cache.
|
|
2335
|
+
* @param {number} size Cache size.
|
|
2336
|
+
* @api
|
|
2337
|
+
*/
|
|
2338
|
+
setSize(e) {
|
|
2339
|
+
this.highWaterMark = e;
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
function Be(l, e, t, i) {
|
|
2343
|
+
return i !== void 0 ? (i[0] = l, i[1] = e, i[2] = t, i) : [l, e, t];
|
|
2344
|
+
}
|
|
2345
|
+
function fe(l, e, t) {
|
|
2346
|
+
return l + "/" + e + "/" + t;
|
|
2347
|
+
}
|
|
2348
|
+
function ut(l) {
|
|
2349
|
+
return fe(l[0], l[1], l[2]);
|
|
2350
|
+
}
|
|
2351
|
+
function Fi(l) {
|
|
2352
|
+
return l.split("/").map(Number);
|
|
2353
|
+
}
|
|
2354
|
+
function pi(l) {
|
|
2355
|
+
return (l[1] << l[0]) + l[2];
|
|
2356
|
+
}
|
|
2357
|
+
function Ei(l, e) {
|
|
2358
|
+
const t = l[0], i = l[1], n = l[2];
|
|
2359
|
+
if (e.getMinZoom() > t || t > e.getMaxZoom())
|
|
2360
|
+
return !1;
|
|
2361
|
+
const s = e.getFullTileRange(t);
|
|
2362
|
+
return s ? s.containsXY(i, n) : !0;
|
|
2363
|
+
}
|
|
2364
|
+
class dt extends Ti {
|
|
2365
|
+
clear() {
|
|
2366
|
+
for (; this.getCount() > 0; )
|
|
2367
|
+
this.pop().release();
|
|
2368
|
+
super.clear();
|
|
2369
|
+
}
|
|
2370
|
+
/**
|
|
2371
|
+
* @param {!Object<string, boolean>} usedTiles Used tiles.
|
|
2372
|
+
*/
|
|
2373
|
+
expireCache(e) {
|
|
2374
|
+
for (; this.canExpireCache() && !(this.peekLast().getKey() in e); )
|
|
2375
|
+
this.pop().release();
|
|
2376
|
+
}
|
|
2377
|
+
/**
|
|
2378
|
+
* Prune all tiles from the cache that don't have the same z as the newest tile.
|
|
2379
|
+
*/
|
|
2380
|
+
pruneExceptNewestZ() {
|
|
2381
|
+
if (this.getCount() === 0)
|
|
2382
|
+
return;
|
|
2383
|
+
const e = this.peekFirstKey(), i = Fi(e)[0];
|
|
2384
|
+
this.forEach((n) => {
|
|
2385
|
+
n.tileCoord[0] !== i && (this.remove(ut(n.tileCoord)), n.release());
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
const Ee = {
|
|
2390
|
+
/**
|
|
2391
|
+
* Triggered when a tile starts loading.
|
|
2392
|
+
* @event module:ol/source/Tile.TileSourceEvent#tileloadstart
|
|
2393
|
+
* @api
|
|
2394
|
+
*/
|
|
2395
|
+
TILELOADSTART: "tileloadstart",
|
|
2396
|
+
/**
|
|
2397
|
+
* Triggered when a tile finishes loading, either when its data is loaded,
|
|
2398
|
+
* or when loading was aborted because the tile is no longer needed.
|
|
2399
|
+
* @event module:ol/source/Tile.TileSourceEvent#tileloadend
|
|
2400
|
+
* @api
|
|
2401
|
+
*/
|
|
2402
|
+
TILELOADEND: "tileloadend",
|
|
2403
|
+
/**
|
|
2404
|
+
* Triggered if tile loading results in an error. Note that this is not the
|
|
2405
|
+
* right place to re-fetch tiles. See {@link module:ol/ImageTile~ImageTile#load}
|
|
2406
|
+
* for details.
|
|
2407
|
+
* @event module:ol/source/Tile.TileSourceEvent#tileloaderror
|
|
2408
|
+
* @api
|
|
2409
|
+
*/
|
|
2410
|
+
TILELOADERROR: "tileloaderror"
|
|
2411
|
+
}, K = [0, 0, 0], R = 5;
|
|
2412
|
+
class gt {
|
|
2413
|
+
/**
|
|
2414
|
+
* @param {Options} options Tile grid options.
|
|
2415
|
+
*/
|
|
2416
|
+
constructor(e) {
|
|
2417
|
+
this.minZoom = e.minZoom !== void 0 ? e.minZoom : 0, this.resolutions_ = e.resolutions, M(
|
|
2418
|
+
Ot(
|
|
2419
|
+
this.resolutions_,
|
|
2420
|
+
function(n, s) {
|
|
2421
|
+
return s - n;
|
|
2422
|
+
}
|
|
2423
|
+
),
|
|
2424
|
+
17
|
|
2425
|
+
);
|
|
2426
|
+
let t;
|
|
2427
|
+
if (!e.origins) {
|
|
2428
|
+
for (let n = 0, s = this.resolutions_.length - 1; n < s; ++n)
|
|
2429
|
+
if (!t)
|
|
2430
|
+
t = this.resolutions_[n] / this.resolutions_[n + 1];
|
|
2431
|
+
else if (this.resolutions_[n] / this.resolutions_[n + 1] !== t) {
|
|
2432
|
+
t = void 0;
|
|
2433
|
+
break;
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
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, M(this.origins_.length == this.resolutions_.length, 20));
|
|
2437
|
+
const i = e.extent;
|
|
2438
|
+
i !== void 0 && !this.origin_ && !this.origins_ && (this.origin_ = $t(i)), M(
|
|
2439
|
+
!this.origin_ && this.origins_ || this.origin_ && !this.origins_,
|
|
2440
|
+
18
|
|
2441
|
+
), this.tileSizes_ = null, e.tileSizes !== void 0 && (this.tileSizes_ = e.tileSizes, M(this.tileSizes_.length == this.resolutions_.length, 19)), this.tileSize_ = e.tileSize !== void 0 ? e.tileSize : this.tileSizes_ ? null : ot, M(
|
|
2442
|
+
!this.tileSize_ && this.tileSizes_ || this.tileSize_ && !this.tileSizes_,
|
|
2443
|
+
22
|
|
2444
|
+
), 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) {
|
|
2445
|
+
const r = new kt(
|
|
2446
|
+
Math.min(0, n[0]),
|
|
2447
|
+
Math.max(n[0] - 1, -1),
|
|
2448
|
+
Math.min(0, n[1]),
|
|
2449
|
+
Math.max(n[1] - 1, -1)
|
|
2450
|
+
);
|
|
2451
|
+
if (i) {
|
|
2452
|
+
const o = this.getTileRangeForExtentAndZ(i, s);
|
|
2453
|
+
r.minX = Math.max(o.minX, r.minX), r.maxX = Math.min(o.maxX, r.maxX), r.minY = Math.max(o.minY, r.minY), r.maxY = Math.min(o.maxY, r.maxY);
|
|
2454
|
+
}
|
|
2455
|
+
return r;
|
|
2456
|
+
}, this) : i && this.calculateTileRanges_(i);
|
|
2457
|
+
}
|
|
2458
|
+
/**
|
|
2459
|
+
* Call a function with each tile coordinate for a given extent and zoom level.
|
|
2460
|
+
*
|
|
2461
|
+
* @param {import("../extent.js").Extent} extent Extent.
|
|
2462
|
+
* @param {number} zoom Integer zoom level.
|
|
2463
|
+
* @param {function(import("../tilecoord.js").TileCoord): void} callback Function called with each tile coordinate.
|
|
2464
|
+
* @api
|
|
2465
|
+
*/
|
|
2466
|
+
forEachTileCoord(e, t, i) {
|
|
2467
|
+
const n = this.getTileRangeForExtentAndZ(e, t);
|
|
2468
|
+
for (let s = n.minX, r = n.maxX; s <= r; ++s)
|
|
2469
|
+
for (let o = n.minY, a = n.maxY; o <= a; ++o)
|
|
2470
|
+
i([t, s, o]);
|
|
2471
|
+
}
|
|
2472
|
+
/**
|
|
2473
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
2474
|
+
* @param {function(number, import("../TileRange.js").default): boolean} callback Callback.
|
|
2475
|
+
* @param {import("../TileRange.js").default} [tempTileRange] Temporary import("../TileRange.js").default object.
|
|
2476
|
+
* @param {import("../extent.js").Extent} [tempExtent] Temporary import("../extent.js").Extent object.
|
|
2477
|
+
* @return {boolean} Callback succeeded.
|
|
2478
|
+
*/
|
|
2479
|
+
forEachTileCoordParentTileRange(e, t, i, n) {
|
|
2480
|
+
let s, r, o, a = null, h = e[0] - 1;
|
|
2481
|
+
for (this.zoomFactor_ === 2 ? (r = e[1], o = e[2]) : a = this.getTileCoordExtent(e, n); h >= this.minZoom; ) {
|
|
2482
|
+
if (this.zoomFactor_ === 2 ? (r = Math.floor(r / 2), o = Math.floor(o / 2), s = z(r, r, o, o, i)) : s = this.getTileRangeForExtentAndZ(
|
|
2483
|
+
a,
|
|
2484
|
+
h,
|
|
2485
|
+
i
|
|
2486
|
+
), t(h, s))
|
|
2487
|
+
return !0;
|
|
2488
|
+
--h;
|
|
2489
|
+
}
|
|
2490
|
+
return !1;
|
|
2491
|
+
}
|
|
2492
|
+
/**
|
|
2493
|
+
* Get the extent for this tile grid, if it was configured.
|
|
2494
|
+
* @return {import("../extent.js").Extent} Extent.
|
|
2495
|
+
* @api
|
|
2496
|
+
*/
|
|
2497
|
+
getExtent() {
|
|
2498
|
+
return this.extent_;
|
|
2499
|
+
}
|
|
2500
|
+
/**
|
|
2501
|
+
* Get the maximum zoom level for the grid.
|
|
2502
|
+
* @return {number} Max zoom.
|
|
2503
|
+
* @api
|
|
2504
|
+
*/
|
|
2505
|
+
getMaxZoom() {
|
|
2506
|
+
return this.maxZoom;
|
|
2507
|
+
}
|
|
2508
|
+
/**
|
|
2509
|
+
* Get the minimum zoom level for the grid.
|
|
2510
|
+
* @return {number} Min zoom.
|
|
2511
|
+
* @api
|
|
2512
|
+
*/
|
|
2513
|
+
getMinZoom() {
|
|
2514
|
+
return this.minZoom;
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* Get the origin for the grid at the given zoom level.
|
|
2518
|
+
* @param {number} z Integer zoom level.
|
|
2519
|
+
* @return {import("../coordinate.js").Coordinate} Origin.
|
|
2520
|
+
* @api
|
|
2521
|
+
*/
|
|
2522
|
+
getOrigin(e) {
|
|
2523
|
+
return this.origin_ ? this.origin_ : this.origins_[e];
|
|
2524
|
+
}
|
|
2525
|
+
/**
|
|
2526
|
+
* Get the resolution for the given zoom level.
|
|
2527
|
+
* @param {number} z Integer zoom level.
|
|
2528
|
+
* @return {number} Resolution.
|
|
2529
|
+
* @api
|
|
2530
|
+
*/
|
|
2531
|
+
getResolution(e) {
|
|
2532
|
+
return this.resolutions_[e];
|
|
2533
|
+
}
|
|
2534
|
+
/**
|
|
2535
|
+
* Get the list of resolutions for the tile grid.
|
|
2536
|
+
* @return {Array<number>} Resolutions.
|
|
2537
|
+
* @api
|
|
2538
|
+
*/
|
|
2539
|
+
getResolutions() {
|
|
2540
|
+
return this.resolutions_;
|
|
2541
|
+
}
|
|
2542
|
+
/**
|
|
2543
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
2544
|
+
* @param {import("../TileRange.js").default} [tempTileRange] Temporary import("../TileRange.js").default object.
|
|
2545
|
+
* @param {import("../extent.js").Extent} [tempExtent] Temporary import("../extent.js").Extent object.
|
|
2546
|
+
* @return {import("../TileRange.js").default|null} Tile range.
|
|
2547
|
+
*/
|
|
2548
|
+
getTileCoordChildTileRange(e, t, i) {
|
|
2549
|
+
if (e[0] < this.maxZoom) {
|
|
2550
|
+
if (this.zoomFactor_ === 2) {
|
|
2551
|
+
const s = e[1] * 2, r = e[2] * 2;
|
|
2552
|
+
return z(
|
|
2553
|
+
s,
|
|
2554
|
+
s + 1,
|
|
2555
|
+
r,
|
|
2556
|
+
r + 1,
|
|
2557
|
+
t
|
|
2558
|
+
);
|
|
2559
|
+
}
|
|
2560
|
+
const n = this.getTileCoordExtent(
|
|
2561
|
+
e,
|
|
2562
|
+
i || this.tmpExtent_
|
|
2563
|
+
);
|
|
2564
|
+
return this.getTileRangeForExtentAndZ(
|
|
2565
|
+
n,
|
|
2566
|
+
e[0] + 1,
|
|
2567
|
+
t
|
|
2568
|
+
);
|
|
2569
|
+
}
|
|
2570
|
+
return null;
|
|
2571
|
+
}
|
|
2572
|
+
/**
|
|
2573
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
2574
|
+
* @param {number} z Integer zoom level.
|
|
2575
|
+
* @param {import("../TileRange.js").default} [tempTileRange] Temporary import("../TileRange.js").default object.
|
|
2576
|
+
* @return {import("../TileRange.js").default|null} Tile range.
|
|
2577
|
+
*/
|
|
2578
|
+
getTileRangeForTileCoordAndZ(e, t, i) {
|
|
2579
|
+
if (t > this.maxZoom || t < this.minZoom)
|
|
2580
|
+
return null;
|
|
2581
|
+
const n = e[0], s = e[1], r = e[2];
|
|
2582
|
+
if (t === n)
|
|
2583
|
+
return z(
|
|
2584
|
+
s,
|
|
2585
|
+
r,
|
|
2586
|
+
s,
|
|
2587
|
+
r,
|
|
2588
|
+
i
|
|
2589
|
+
);
|
|
2590
|
+
if (this.zoomFactor_) {
|
|
2591
|
+
const a = Math.pow(this.zoomFactor_, t - n), h = Math.floor(s * a), c = Math.floor(r * a);
|
|
2592
|
+
if (t < n)
|
|
2593
|
+
return z(h, h, c, c, i);
|
|
2594
|
+
const u = Math.floor(a * (s + 1)) - 1, g = Math.floor(a * (r + 1)) - 1;
|
|
2595
|
+
return z(h, u, c, g, i);
|
|
2596
|
+
}
|
|
2597
|
+
const o = this.getTileCoordExtent(e, this.tmpExtent_);
|
|
2598
|
+
return this.getTileRangeForExtentAndZ(o, t, i);
|
|
2599
|
+
}
|
|
2600
|
+
/**
|
|
2601
|
+
* Get a tile range for the given extent and integer zoom level.
|
|
2602
|
+
* @param {import("../extent.js").Extent} extent Extent.
|
|
2603
|
+
* @param {number} z Integer zoom level.
|
|
2604
|
+
* @param {import("../TileRange.js").default} [tempTileRange] Temporary tile range object.
|
|
2605
|
+
* @return {import("../TileRange.js").default} Tile range.
|
|
2606
|
+
*/
|
|
2607
|
+
getTileRangeForExtentAndZ(e, t, i) {
|
|
2608
|
+
this.getTileCoordForXYAndZ_(e[0], e[3], t, !1, K);
|
|
2609
|
+
const n = K[1], s = K[2];
|
|
2610
|
+
this.getTileCoordForXYAndZ_(e[2], e[1], t, !0, K);
|
|
2611
|
+
const r = K[1], o = K[2];
|
|
2612
|
+
return z(n, r, s, o, i);
|
|
2613
|
+
}
|
|
2614
|
+
/**
|
|
2615
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
2616
|
+
* @return {import("../coordinate.js").Coordinate} Tile center.
|
|
2617
|
+
*/
|
|
2618
|
+
getTileCoordCenter(e) {
|
|
2619
|
+
const t = this.getOrigin(e[0]), i = this.getResolution(e[0]), n = I(this.getTileSize(e[0]), this.tmpSize_);
|
|
2620
|
+
return [
|
|
2621
|
+
t[0] + (e[1] + 0.5) * n[0] * i,
|
|
2622
|
+
t[1] - (e[2] + 0.5) * n[1] * i
|
|
2623
|
+
];
|
|
2624
|
+
}
|
|
2625
|
+
/**
|
|
2626
|
+
* Get the extent of a tile coordinate.
|
|
2627
|
+
*
|
|
2628
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
2629
|
+
* @param {import("../extent.js").Extent} [tempExtent] Temporary extent object.
|
|
2630
|
+
* @return {import("../extent.js").Extent} Extent.
|
|
2631
|
+
* @api
|
|
2632
|
+
*/
|
|
2633
|
+
getTileCoordExtent(e, t) {
|
|
2634
|
+
const i = this.getOrigin(e[0]), n = this.getResolution(e[0]), s = I(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;
|
|
2635
|
+
return at(r, o, a, h, t);
|
|
2636
|
+
}
|
|
2637
|
+
/**
|
|
2638
|
+
* Get the tile coordinate for the given map coordinate and resolution. This
|
|
2639
|
+
* method considers that coordinates that intersect tile boundaries should be
|
|
2640
|
+
* assigned the higher tile coordinate.
|
|
2641
|
+
*
|
|
2642
|
+
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
|
2643
|
+
* @param {number} resolution Resolution.
|
|
2644
|
+
* @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Destination import("../tilecoord.js").TileCoord object.
|
|
2645
|
+
* @return {import("../tilecoord.js").TileCoord} Tile coordinate.
|
|
2646
|
+
* @api
|
|
2647
|
+
*/
|
|
2648
|
+
getTileCoordForCoordAndResolution(e, t, i) {
|
|
2649
|
+
return this.getTileCoordForXYAndResolution_(
|
|
2650
|
+
e[0],
|
|
2651
|
+
e[1],
|
|
2652
|
+
t,
|
|
2653
|
+
!1,
|
|
2654
|
+
i
|
|
2655
|
+
);
|
|
2656
|
+
}
|
|
2657
|
+
/**
|
|
2658
|
+
* Note that this method should not be called for resolutions that correspond
|
|
2659
|
+
* to an integer zoom level. Instead call the `getTileCoordForXYAndZ_` method.
|
|
2660
|
+
* @param {number} x X.
|
|
2661
|
+
* @param {number} y Y.
|
|
2662
|
+
* @param {number} resolution Resolution (for a non-integer zoom level).
|
|
2663
|
+
* @param {boolean} reverseIntersectionPolicy Instead of letting edge
|
|
2664
|
+
* intersections go to the higher tile coordinate, let edge intersections
|
|
2665
|
+
* go to the lower tile coordinate.
|
|
2666
|
+
* @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Temporary import("../tilecoord.js").TileCoord object.
|
|
2667
|
+
* @return {import("../tilecoord.js").TileCoord} Tile coordinate.
|
|
2668
|
+
* @private
|
|
2669
|
+
*/
|
|
2670
|
+
getTileCoordForXYAndResolution_(e, t, i, n, s) {
|
|
2671
|
+
const r = this.getZForResolution(i), o = i / this.getResolution(r), a = this.getOrigin(r), h = I(this.getTileSize(r), this.tmpSize_);
|
|
2672
|
+
let c = o * (e - a[0]) / i / h[0], u = o * (a[1] - t) / i / h[1];
|
|
2673
|
+
return n ? (c = ee(c, R) - 1, u = ee(u, R) - 1) : (c = te(c, R), u = te(u, R)), Be(r, c, u, s);
|
|
2674
|
+
}
|
|
2675
|
+
/**
|
|
2676
|
+
* Although there is repetition between this method and `getTileCoordForXYAndResolution_`,
|
|
2677
|
+
* they should have separate implementations. This method is for integer zoom
|
|
2678
|
+
* levels. The other method should only be called for resolutions corresponding
|
|
2679
|
+
* to non-integer zoom levels.
|
|
2680
|
+
* @param {number} x Map x coordinate.
|
|
2681
|
+
* @param {number} y Map y coordinate.
|
|
2682
|
+
* @param {number} z Integer zoom level.
|
|
2683
|
+
* @param {boolean} reverseIntersectionPolicy Instead of letting edge
|
|
2684
|
+
* intersections go to the higher tile coordinate, let edge intersections
|
|
2685
|
+
* go to the lower tile coordinate.
|
|
2686
|
+
* @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Temporary import("../tilecoord.js").TileCoord object.
|
|
2687
|
+
* @return {import("../tilecoord.js").TileCoord} Tile coordinate.
|
|
2688
|
+
* @private
|
|
2689
|
+
*/
|
|
2690
|
+
getTileCoordForXYAndZ_(e, t, i, n, s) {
|
|
2691
|
+
const r = this.getOrigin(i), o = this.getResolution(i), a = I(this.getTileSize(i), this.tmpSize_);
|
|
2692
|
+
let h = (e - r[0]) / o / a[0], c = (r[1] - t) / o / a[1];
|
|
2693
|
+
return n ? (h = ee(h, R) - 1, c = ee(c, R) - 1) : (h = te(h, R), c = te(c, R)), Be(i, h, c, s);
|
|
2694
|
+
}
|
|
2695
|
+
/**
|
|
2696
|
+
* Get a tile coordinate given a map coordinate and zoom level.
|
|
2697
|
+
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
|
2698
|
+
* @param {number} z Zoom level.
|
|
2699
|
+
* @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Destination import("../tilecoord.js").TileCoord object.
|
|
2700
|
+
* @return {import("../tilecoord.js").TileCoord} Tile coordinate.
|
|
2701
|
+
* @api
|
|
2702
|
+
*/
|
|
2703
|
+
getTileCoordForCoordAndZ(e, t, i) {
|
|
2704
|
+
return this.getTileCoordForXYAndZ_(
|
|
2705
|
+
e[0],
|
|
2706
|
+
e[1],
|
|
2707
|
+
t,
|
|
2708
|
+
!1,
|
|
2709
|
+
i
|
|
2710
|
+
);
|
|
2711
|
+
}
|
|
2712
|
+
/**
|
|
2713
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
2714
|
+
* @return {number} Tile resolution.
|
|
2715
|
+
*/
|
|
2716
|
+
getTileCoordResolution(e) {
|
|
2717
|
+
return this.resolutions_[e[0]];
|
|
2718
|
+
}
|
|
2719
|
+
/**
|
|
2720
|
+
* Get the tile size for a zoom level. The type of the return value matches the
|
|
2721
|
+
* `tileSize` or `tileSizes` that the tile grid was configured with. To always
|
|
2722
|
+
* get an {@link import("../size.js").Size}, run the result through {@link module:ol/size.toSize}.
|
|
2723
|
+
* @param {number} z Z.
|
|
2724
|
+
* @return {number|import("../size.js").Size} Tile size.
|
|
2725
|
+
* @api
|
|
2726
|
+
*/
|
|
2727
|
+
getTileSize(e) {
|
|
2728
|
+
return this.tileSize_ ? this.tileSize_ : this.tileSizes_[e];
|
|
2729
|
+
}
|
|
2730
|
+
/**
|
|
2731
|
+
* @param {number} z Zoom level.
|
|
2732
|
+
* @return {import("../TileRange.js").default} Extent tile range for the specified zoom level.
|
|
2733
|
+
*/
|
|
2734
|
+
getFullTileRange(e) {
|
|
2735
|
+
return this.fullTileRanges_ ? this.fullTileRanges_[e] : this.extent_ ? this.getTileRangeForExtentAndZ(this.extent_, e) : null;
|
|
2736
|
+
}
|
|
2737
|
+
/**
|
|
2738
|
+
* @param {number} resolution Resolution.
|
|
2739
|
+
* @param {number|import("../array.js").NearestDirectionFunction} [opt_direction]
|
|
2740
|
+
* If 0, the nearest resolution will be used.
|
|
2741
|
+
* If 1, the nearest higher resolution (lower Z) will be used. If -1, the
|
|
2742
|
+
* nearest lower resolution (higher Z) will be used. Default is 0.
|
|
2743
|
+
* Use a {@link module:ol/array~NearestDirectionFunction} for more precise control.
|
|
2744
|
+
*
|
|
2745
|
+
* For example to change tile Z at the midpoint of zoom levels
|
|
2746
|
+
* ```js
|
|
2747
|
+
* function(value, high, low) {
|
|
2748
|
+
* return value - low * Math.sqrt(high / low);
|
|
2749
|
+
* }
|
|
2750
|
+
* ```
|
|
2751
|
+
* @return {number} Z.
|
|
2752
|
+
* @api
|
|
2753
|
+
*/
|
|
2754
|
+
getZForResolution(e, t) {
|
|
2755
|
+
const i = Ut(
|
|
2756
|
+
this.resolutions_,
|
|
2757
|
+
e,
|
|
2758
|
+
t || 0
|
|
2759
|
+
);
|
|
2760
|
+
return tt(i, this.minZoom, this.maxZoom);
|
|
2761
|
+
}
|
|
2762
|
+
/**
|
|
2763
|
+
* The tile with the provided tile coordinate intersects the given viewport.
|
|
2764
|
+
* @param {import('../tilecoord.js').TileCoord} tileCoord Tile coordinate.
|
|
2765
|
+
* @param {Array<number>} viewport Viewport as returned from {@link module:ol/extent.getRotatedViewport}.
|
|
2766
|
+
* @return {boolean} The tile with the provided tile coordinate intersects the given viewport.
|
|
2767
|
+
*/
|
|
2768
|
+
tileCoordIntersectsViewport(e, t) {
|
|
2769
|
+
return Jt(
|
|
2770
|
+
t,
|
|
2771
|
+
0,
|
|
2772
|
+
t.length,
|
|
2773
|
+
2,
|
|
2774
|
+
this.getTileCoordExtent(e)
|
|
2775
|
+
);
|
|
2776
|
+
}
|
|
2777
|
+
/**
|
|
2778
|
+
* @param {!import("../extent.js").Extent} extent Extent for this tile grid.
|
|
2779
|
+
* @private
|
|
2780
|
+
*/
|
|
2781
|
+
calculateTileRanges_(e) {
|
|
2782
|
+
const t = this.resolutions_.length, i = new Array(t);
|
|
2783
|
+
for (let n = this.minZoom; n < t; ++n)
|
|
2784
|
+
i[n] = this.getTileRangeForExtentAndZ(e, n);
|
|
2785
|
+
this.fullTileRanges_ = i;
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
function ft(l) {
|
|
2789
|
+
let e = l.getDefaultTileGrid();
|
|
2790
|
+
return e || (e = Li(l), l.setDefaultTileGrid(e)), e;
|
|
2791
|
+
}
|
|
2792
|
+
function Si(l, e, t) {
|
|
2793
|
+
const i = e[0], n = l.getTileCoordCenter(e), s = Re(t);
|
|
2794
|
+
if (!ni(s, n)) {
|
|
2795
|
+
const r = lt(s), o = Math.ceil(
|
|
2796
|
+
(s[0] - n[0]) / r
|
|
2797
|
+
);
|
|
2798
|
+
return n[0] += r * o, l.getTileCoordForCoordAndZ(n, i);
|
|
2799
|
+
}
|
|
2800
|
+
return e;
|
|
2801
|
+
}
|
|
2802
|
+
function wi(l, e, t, i) {
|
|
2803
|
+
i = i !== void 0 ? i : "top-left";
|
|
2804
|
+
const n = _t(l, e, t);
|
|
2805
|
+
return new gt({
|
|
2806
|
+
extent: l,
|
|
2807
|
+
origin: ti(l, i),
|
|
2808
|
+
resolutions: n,
|
|
2809
|
+
tileSize: t
|
|
2810
|
+
});
|
|
2811
|
+
}
|
|
2812
|
+
function Pi(l) {
|
|
2813
|
+
const e = l || {}, t = e.extent || Ge("EPSG:3857").getExtent(), i = {
|
|
2814
|
+
extent: t,
|
|
2815
|
+
minZoom: e.minZoom,
|
|
2816
|
+
tileSize: e.tileSize,
|
|
2817
|
+
resolutions: _t(
|
|
2818
|
+
t,
|
|
2819
|
+
e.maxZoom,
|
|
2820
|
+
e.tileSize,
|
|
2821
|
+
e.maxResolution
|
|
2822
|
+
)
|
|
2823
|
+
};
|
|
2824
|
+
return new gt(i);
|
|
2825
|
+
}
|
|
2826
|
+
function _t(l, e, t, i) {
|
|
2827
|
+
e = e !== void 0 ? e : ii, t = I(t !== void 0 ? t : ot);
|
|
2828
|
+
const n = Qt(l), s = lt(l);
|
|
2829
|
+
i = i > 0 ? i : Math.max(s / t[0], n / t[1]);
|
|
2830
|
+
const r = e + 1, o = new Array(r);
|
|
2831
|
+
for (let a = 0; a < r; ++a)
|
|
2832
|
+
o[a] = i / Math.pow(2, a);
|
|
2833
|
+
return o;
|
|
2834
|
+
}
|
|
2835
|
+
function Li(l, e, t, i) {
|
|
2836
|
+
const n = Re(l);
|
|
2837
|
+
return wi(n, e, t, i);
|
|
2838
|
+
}
|
|
2839
|
+
function Re(l) {
|
|
2840
|
+
l = Ge(l);
|
|
2841
|
+
let e = l.getExtent();
|
|
2842
|
+
if (!e) {
|
|
2843
|
+
const t = 180 * ei.degrees / l.getMetersPerUnit();
|
|
2844
|
+
e = at(-t, -t, t, t);
|
|
2845
|
+
}
|
|
2846
|
+
return e;
|
|
2847
|
+
}
|
|
2848
|
+
class Di extends si {
|
|
2849
|
+
/**
|
|
2850
|
+
* @param {Options} options SourceTile source options.
|
|
2851
|
+
*/
|
|
2852
|
+
constructor(e) {
|
|
2853
|
+
super({
|
|
2854
|
+
attributions: e.attributions,
|
|
2855
|
+
attributionsCollapsible: e.attributionsCollapsible,
|
|
2856
|
+
projection: e.projection,
|
|
2857
|
+
state: e.state,
|
|
2858
|
+
wrapX: e.wrapX,
|
|
2859
|
+
interpolate: e.interpolate
|
|
2860
|
+
}), 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;
|
|
2861
|
+
const t = [256, 256];
|
|
2862
|
+
this.tileGrid && I(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()), t), this.tileCache = new dt(e.cacheSize || 0), this.tmpSize = [0, 0], this.key_ = e.key || "", this.tileOptions = {
|
|
2863
|
+
transition: e.transition,
|
|
2864
|
+
interpolate: e.interpolate
|
|
2865
|
+
}, this.zDirection = e.zDirection ? e.zDirection : 0;
|
|
2866
|
+
}
|
|
2867
|
+
/**
|
|
2868
|
+
* @return {boolean} Can expire cache.
|
|
2869
|
+
*/
|
|
2870
|
+
canExpireCache() {
|
|
2871
|
+
return this.tileCache.canExpireCache();
|
|
2872
|
+
}
|
|
2873
|
+
/**
|
|
2874
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
2875
|
+
* @param {!Object<string, boolean>} usedTiles Used tiles.
|
|
2876
|
+
*/
|
|
2877
|
+
expireCache(e, t) {
|
|
2878
|
+
const i = this.getTileCacheForProjection(e);
|
|
2879
|
+
i && i.expireCache(t);
|
|
2880
|
+
}
|
|
2881
|
+
/**
|
|
2882
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
2883
|
+
* @param {number} z Zoom level.
|
|
2884
|
+
* @param {import("../TileRange.js").default} tileRange Tile range.
|
|
2885
|
+
* @param {function(import("../Tile.js").default):(boolean|void)} callback Called with each
|
|
2886
|
+
* loaded tile. If the callback returns `false`, the tile will not be
|
|
2887
|
+
* considered loaded.
|
|
2888
|
+
* @return {boolean} The tile range is fully covered with loaded tiles.
|
|
2889
|
+
*/
|
|
2890
|
+
forEachLoadedTile(e, t, i, n) {
|
|
2891
|
+
const s = this.getTileCacheForProjection(e);
|
|
2892
|
+
if (!s)
|
|
2893
|
+
return !1;
|
|
2894
|
+
let r = !0, o, a, h;
|
|
2895
|
+
for (let c = i.minX; c <= i.maxX; ++c)
|
|
2896
|
+
for (let u = i.minY; u <= i.maxY; ++u)
|
|
2897
|
+
a = fe(t, c, u), h = !1, s.containsKey(a) && (o = /** @type {!import("../Tile.js").default} */
|
|
2898
|
+
s.get(a), h = o.getState() === j.LOADED, h && (h = n(o) !== !1)), h || (r = !1);
|
|
2899
|
+
return r;
|
|
2900
|
+
}
|
|
2901
|
+
/**
|
|
2902
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
2903
|
+
* @return {number} Gutter.
|
|
2904
|
+
*/
|
|
2905
|
+
getGutterForProjection(e) {
|
|
2906
|
+
return 0;
|
|
2907
|
+
}
|
|
2908
|
+
/**
|
|
2909
|
+
* Return the key to be used for all tiles in the source.
|
|
2910
|
+
* @return {string} The key for all tiles.
|
|
2911
|
+
*/
|
|
2912
|
+
getKey() {
|
|
2913
|
+
return this.key_;
|
|
2914
|
+
}
|
|
2915
|
+
/**
|
|
2916
|
+
* Set the value to be used as the key for all tiles in the source.
|
|
2917
|
+
* @param {string} key The key for tiles.
|
|
2918
|
+
* @protected
|
|
2919
|
+
*/
|
|
2920
|
+
setKey(e) {
|
|
2921
|
+
this.key_ !== e && (this.key_ = e, this.changed());
|
|
2922
|
+
}
|
|
2923
|
+
/**
|
|
2924
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
2925
|
+
* @return {boolean} Opaque.
|
|
2926
|
+
*/
|
|
2927
|
+
getOpaque(e) {
|
|
2928
|
+
return this.opaque_;
|
|
2929
|
+
}
|
|
2930
|
+
/**
|
|
2931
|
+
* @param {import("../proj/Projection").default} [projection] Projection.
|
|
2932
|
+
* @return {Array<number>|null} Resolutions.
|
|
2933
|
+
*/
|
|
2934
|
+
getResolutions(e) {
|
|
2935
|
+
const t = e ? this.getTileGridForProjection(e) : this.tileGrid;
|
|
2936
|
+
return t ? t.getResolutions() : null;
|
|
2937
|
+
}
|
|
2938
|
+
/**
|
|
2939
|
+
* @abstract
|
|
2940
|
+
* @param {number} z Tile coordinate z.
|
|
2941
|
+
* @param {number} x Tile coordinate x.
|
|
2942
|
+
* @param {number} y Tile coordinate y.
|
|
2943
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
2944
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
2945
|
+
* @return {!import("../Tile.js").default} Tile.
|
|
2946
|
+
*/
|
|
2947
|
+
getTile(e, t, i, n, s) {
|
|
2948
|
+
return zt();
|
|
2949
|
+
}
|
|
2950
|
+
/**
|
|
2951
|
+
* Return the tile grid of the tile source.
|
|
2952
|
+
* @return {import("../tilegrid/TileGrid.js").default|null} Tile grid.
|
|
2953
|
+
* @api
|
|
2954
|
+
*/
|
|
2955
|
+
getTileGrid() {
|
|
2956
|
+
return this.tileGrid;
|
|
2957
|
+
}
|
|
2958
|
+
/**
|
|
2959
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
2960
|
+
* @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
|
|
2961
|
+
*/
|
|
2962
|
+
getTileGridForProjection(e) {
|
|
2963
|
+
return this.tileGrid ? this.tileGrid : ft(e);
|
|
2964
|
+
}
|
|
2965
|
+
/**
|
|
2966
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
2967
|
+
* @return {import("../TileCache.js").default} Tile cache.
|
|
2968
|
+
* @protected
|
|
2969
|
+
*/
|
|
2970
|
+
getTileCacheForProjection(e) {
|
|
2971
|
+
const t = this.getProjection();
|
|
2972
|
+
return M(
|
|
2973
|
+
t === null || N(t, e),
|
|
2974
|
+
68
|
|
2975
|
+
// A VectorTile source can only be rendered if it has a projection compatible with the view projection.
|
|
2976
|
+
), this.tileCache;
|
|
2977
|
+
}
|
|
2978
|
+
/**
|
|
2979
|
+
* Get the tile pixel ratio for this source. Subclasses may override this
|
|
2980
|
+
* method, which is meant to return a supported pixel ratio that matches the
|
|
2981
|
+
* provided `pixelRatio` as close as possible.
|
|
2982
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
2983
|
+
* @return {number} Tile pixel ratio.
|
|
2984
|
+
*/
|
|
2985
|
+
getTilePixelRatio(e) {
|
|
2986
|
+
return this.tilePixelRatio_;
|
|
2987
|
+
}
|
|
2988
|
+
/**
|
|
2989
|
+
* @param {number} z Z.
|
|
2990
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
2991
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
2992
|
+
* @return {import("../size.js").Size} Tile size.
|
|
2993
|
+
*/
|
|
2994
|
+
getTilePixelSize(e, t, i) {
|
|
2995
|
+
const n = this.getTileGridForProjection(i), s = this.getTilePixelRatio(t), r = I(n.getTileSize(e), this.tmpSize);
|
|
2996
|
+
return s == 1 ? r : Nt(r, s, this.tmpSize);
|
|
2997
|
+
}
|
|
2998
|
+
/**
|
|
2999
|
+
* Returns a tile coordinate wrapped around the x-axis. When the tile coordinate
|
|
3000
|
+
* is outside the resolution and extent range of the tile grid, `null` will be
|
|
3001
|
+
* returned.
|
|
3002
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
3003
|
+
* @param {import("../proj/Projection.js").default} [projection] Projection.
|
|
3004
|
+
* @return {import("../tilecoord.js").TileCoord} Tile coordinate to be passed to the tileUrlFunction or
|
|
3005
|
+
* null if no tile URL should be created for the passed `tileCoord`.
|
|
3006
|
+
*/
|
|
3007
|
+
getTileCoordForTileUrlFunction(e, t) {
|
|
3008
|
+
t = t !== void 0 ? t : this.getProjection();
|
|
3009
|
+
const i = this.getTileGridForProjection(t);
|
|
3010
|
+
return this.getWrapX() && t.isGlobal() && (e = Si(i, e, t)), Ei(e, i) ? e : null;
|
|
3011
|
+
}
|
|
3012
|
+
/**
|
|
3013
|
+
* Remove all cached tiles from the source. The next render cycle will fetch new tiles.
|
|
3014
|
+
* @api
|
|
3015
|
+
*/
|
|
3016
|
+
clear() {
|
|
3017
|
+
this.tileCache.clear();
|
|
3018
|
+
}
|
|
3019
|
+
refresh() {
|
|
3020
|
+
this.clear(), super.refresh();
|
|
3021
|
+
}
|
|
3022
|
+
/**
|
|
3023
|
+
* Increases the cache size if needed
|
|
3024
|
+
* @param {number} tileCount Minimum number of tiles needed.
|
|
3025
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
3026
|
+
*/
|
|
3027
|
+
updateCacheSize(e, t) {
|
|
3028
|
+
const i = this.getTileCacheForProjection(t);
|
|
3029
|
+
e > i.highWaterMark && (i.highWaterMark = e);
|
|
3030
|
+
}
|
|
3031
|
+
/**
|
|
3032
|
+
* Marks a tile coord as being used, without triggering a load.
|
|
3033
|
+
* @abstract
|
|
3034
|
+
* @param {number} z Tile coordinate z.
|
|
3035
|
+
* @param {number} x Tile coordinate x.
|
|
3036
|
+
* @param {number} y Tile coordinate y.
|
|
3037
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
3038
|
+
*/
|
|
3039
|
+
useTile(e, t, i, n) {
|
|
3040
|
+
}
|
|
3041
|
+
}
|
|
3042
|
+
class Mi extends J {
|
|
3043
|
+
/**
|
|
3044
|
+
* @param {string} type Type.
|
|
3045
|
+
* @param {import("../Tile.js").default} tile The tile.
|
|
3046
|
+
*/
|
|
3047
|
+
constructor(e, t) {
|
|
3048
|
+
super(e), this.tile = t;
|
|
3049
|
+
}
|
|
3050
|
+
}
|
|
3051
|
+
function ki(l, e) {
|
|
3052
|
+
const t = /\{z\}/g, i = /\{x\}/g, n = /\{y\}/g, s = /\{-y\}/g;
|
|
3053
|
+
return (
|
|
3054
|
+
/**
|
|
3055
|
+
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
|
|
3056
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
3057
|
+
* @param {import("./proj/Projection.js").default} projection Projection.
|
|
3058
|
+
* @return {string|undefined} Tile URL.
|
|
3059
|
+
*/
|
|
3060
|
+
function(r, o, a) {
|
|
3061
|
+
if (r)
|
|
3062
|
+
return l.replace(t, r[0].toString()).replace(i, r[1].toString()).replace(n, r[2].toString()).replace(s, function() {
|
|
3063
|
+
const h = r[0], c = e.getFullTileRange(h);
|
|
3064
|
+
return M(c, 55), (c.getHeight() - r[2] - 1).toString();
|
|
3065
|
+
});
|
|
3066
|
+
}
|
|
3067
|
+
);
|
|
3068
|
+
}
|
|
3069
|
+
function Gi(l, e) {
|
|
3070
|
+
const t = l.length, i = new Array(t);
|
|
3071
|
+
for (let n = 0; n < t; ++n)
|
|
3072
|
+
i[n] = ki(l[n], e);
|
|
3073
|
+
return vi(i);
|
|
3074
|
+
}
|
|
3075
|
+
function vi(l) {
|
|
3076
|
+
return l.length === 1 ? l[0] : (
|
|
3077
|
+
/**
|
|
3078
|
+
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
|
|
3079
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
3080
|
+
* @param {import("./proj/Projection.js").default} projection Projection.
|
|
3081
|
+
* @return {string|undefined} Tile URL.
|
|
3082
|
+
*/
|
|
3083
|
+
function(e, t, i) {
|
|
3084
|
+
if (!e)
|
|
3085
|
+
return;
|
|
3086
|
+
const n = pi(e), s = Kt(n, l.length);
|
|
3087
|
+
return l[s](e, t, i);
|
|
3088
|
+
}
|
|
3089
|
+
);
|
|
3090
|
+
}
|
|
3091
|
+
function Ri(l) {
|
|
3092
|
+
const e = [];
|
|
3093
|
+
let t = /\{([a-z])-([a-z])\}/.exec(l);
|
|
3094
|
+
if (t) {
|
|
3095
|
+
const i = t[1].charCodeAt(0), n = t[2].charCodeAt(0);
|
|
3096
|
+
let s;
|
|
3097
|
+
for (s = i; s <= n; ++s)
|
|
3098
|
+
e.push(l.replace(t[0], String.fromCharCode(s)));
|
|
3099
|
+
return e;
|
|
3100
|
+
}
|
|
3101
|
+
if (t = /\{(\d+)-(\d+)\}/.exec(l), t) {
|
|
3102
|
+
const i = parseInt(t[2], 10);
|
|
3103
|
+
for (let n = parseInt(t[1], 10); n <= i; n++)
|
|
3104
|
+
e.push(l.replace(t[0], n.toString()));
|
|
3105
|
+
return e;
|
|
3106
|
+
}
|
|
3107
|
+
return e.push(l), e;
|
|
3108
|
+
}
|
|
3109
|
+
class Ae extends Di {
|
|
3110
|
+
/**
|
|
3111
|
+
* @param {Options} options Image tile options.
|
|
3112
|
+
*/
|
|
3113
|
+
constructor(e) {
|
|
3114
|
+
super({
|
|
3115
|
+
attributions: e.attributions,
|
|
3116
|
+
cacheSize: e.cacheSize,
|
|
3117
|
+
opaque: e.opaque,
|
|
3118
|
+
projection: e.projection,
|
|
3119
|
+
state: e.state,
|
|
3120
|
+
tileGrid: e.tileGrid,
|
|
3121
|
+
tilePixelRatio: e.tilePixelRatio,
|
|
3122
|
+
wrapX: e.wrapX,
|
|
3123
|
+
transition: e.transition,
|
|
3124
|
+
interpolate: e.interpolate,
|
|
3125
|
+
key: e.key,
|
|
3126
|
+
attributionsCollapsible: e.attributionsCollapsible,
|
|
3127
|
+
zDirection: e.zDirection
|
|
3128
|
+
}), this.generateTileUrlFunction_ = this.tileUrlFunction === Ae.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_ = {};
|
|
3129
|
+
}
|
|
3130
|
+
/**
|
|
3131
|
+
* Return the tile load function of the source.
|
|
3132
|
+
* @return {import("../Tile.js").LoadFunction} TileLoadFunction
|
|
3133
|
+
* @api
|
|
3134
|
+
*/
|
|
3135
|
+
getTileLoadFunction() {
|
|
3136
|
+
return this.tileLoadFunction;
|
|
3137
|
+
}
|
|
3138
|
+
/**
|
|
3139
|
+
* Return the tile URL function of the source.
|
|
3140
|
+
* @return {import("../Tile.js").UrlFunction} TileUrlFunction
|
|
3141
|
+
* @api
|
|
3142
|
+
*/
|
|
3143
|
+
getTileUrlFunction() {
|
|
3144
|
+
return Object.getPrototypeOf(this).tileUrlFunction === this.tileUrlFunction ? this.tileUrlFunction.bind(this) : this.tileUrlFunction;
|
|
3145
|
+
}
|
|
3146
|
+
/**
|
|
3147
|
+
* Return the URLs used for this source.
|
|
3148
|
+
* When a tileUrlFunction is used instead of url or urls,
|
|
3149
|
+
* null will be returned.
|
|
3150
|
+
* @return {!Array<string>|null} URLs.
|
|
3151
|
+
* @api
|
|
3152
|
+
*/
|
|
3153
|
+
getUrls() {
|
|
3154
|
+
return this.urls;
|
|
3155
|
+
}
|
|
3156
|
+
/**
|
|
3157
|
+
* Handle tile change events.
|
|
3158
|
+
* @param {import("../events/Event.js").default} event Event.
|
|
3159
|
+
* @protected
|
|
3160
|
+
*/
|
|
3161
|
+
handleTileChange(e) {
|
|
3162
|
+
const t = (
|
|
3163
|
+
/** @type {import("../Tile.js").default} */
|
|
3164
|
+
e.target
|
|
3165
|
+
), i = C(t), n = t.getState();
|
|
3166
|
+
let s;
|
|
3167
|
+
n == j.LOADING ? (this.tileLoadingKeys_[i] = !0, s = Ee.TILELOADSTART) : i in this.tileLoadingKeys_ && (delete this.tileLoadingKeys_[i], s = n == j.ERROR ? Ee.TILELOADERROR : n == j.LOADED ? Ee.TILELOADEND : void 0), s != null && this.dispatchEvent(new Mi(s, t));
|
|
3168
|
+
}
|
|
3169
|
+
/**
|
|
3170
|
+
* Set the tile load function of the source.
|
|
3171
|
+
* @param {import("../Tile.js").LoadFunction} tileLoadFunction Tile load function.
|
|
3172
|
+
* @api
|
|
3173
|
+
*/
|
|
3174
|
+
setTileLoadFunction(e) {
|
|
3175
|
+
this.tileCache.clear(), this.tileLoadFunction = e, this.changed();
|
|
3176
|
+
}
|
|
3177
|
+
/**
|
|
3178
|
+
* Set the tile URL function of the source.
|
|
3179
|
+
* @param {import("../Tile.js").UrlFunction} tileUrlFunction Tile URL function.
|
|
3180
|
+
* @param {string} [key] Optional new tile key for the source.
|
|
3181
|
+
* @api
|
|
3182
|
+
*/
|
|
3183
|
+
setTileUrlFunction(e, t) {
|
|
3184
|
+
this.tileUrlFunction = e, this.tileCache.pruneExceptNewestZ(), typeof t < "u" ? this.setKey(t) : this.changed();
|
|
3185
|
+
}
|
|
3186
|
+
/**
|
|
3187
|
+
* Set the URL to use for requests.
|
|
3188
|
+
* @param {string} url URL.
|
|
3189
|
+
* @api
|
|
3190
|
+
*/
|
|
3191
|
+
setUrl(e) {
|
|
3192
|
+
const t = Ri(e);
|
|
3193
|
+
this.urls = t, this.setUrls(t);
|
|
3194
|
+
}
|
|
3195
|
+
/**
|
|
3196
|
+
* Set the URLs to use for requests.
|
|
3197
|
+
* @param {Array<string>} urls URLs.
|
|
3198
|
+
* @api
|
|
3199
|
+
*/
|
|
3200
|
+
setUrls(e) {
|
|
3201
|
+
this.urls = e;
|
|
3202
|
+
const t = e.join(`
|
|
3203
|
+
`);
|
|
3204
|
+
this.generateTileUrlFunction_ ? this.setTileUrlFunction(Gi(e, this.tileGrid), t) : this.setKey(t);
|
|
3205
|
+
}
|
|
3206
|
+
/**
|
|
3207
|
+
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
|
3208
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
3209
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
3210
|
+
* @return {string|undefined} Tile URL.
|
|
3211
|
+
*/
|
|
3212
|
+
tileUrlFunction(e, t, i) {
|
|
3213
|
+
}
|
|
3214
|
+
/**
|
|
3215
|
+
* Marks a tile coord as being used, without triggering a load.
|
|
3216
|
+
* @param {number} z Tile coordinate z.
|
|
3217
|
+
* @param {number} x Tile coordinate x.
|
|
3218
|
+
* @param {number} y Tile coordinate y.
|
|
3219
|
+
*/
|
|
3220
|
+
useTile(e, t, i) {
|
|
3221
|
+
const n = fe(e, t, i);
|
|
3222
|
+
this.tileCache.containsKey(n) && this.tileCache.get(n);
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
class Ai extends Ae {
|
|
3226
|
+
/**
|
|
3227
|
+
* @param {!Options} options Image tile options.
|
|
3228
|
+
*/
|
|
3229
|
+
constructor(e) {
|
|
3230
|
+
super({
|
|
3231
|
+
attributions: e.attributions,
|
|
3232
|
+
cacheSize: e.cacheSize,
|
|
3233
|
+
opaque: e.opaque,
|
|
3234
|
+
projection: e.projection,
|
|
3235
|
+
state: e.state,
|
|
3236
|
+
tileGrid: e.tileGrid,
|
|
3237
|
+
tileLoadFunction: e.tileLoadFunction ? e.tileLoadFunction : bi,
|
|
3238
|
+
tilePixelRatio: e.tilePixelRatio,
|
|
3239
|
+
tileUrlFunction: e.tileUrlFunction,
|
|
3240
|
+
url: e.url,
|
|
3241
|
+
urls: e.urls,
|
|
3242
|
+
wrapX: e.wrapX,
|
|
3243
|
+
transition: e.transition,
|
|
3244
|
+
interpolate: e.interpolate !== void 0 ? e.interpolate : !0,
|
|
3245
|
+
key: e.key,
|
|
3246
|
+
attributionsCollapsible: e.attributionsCollapsible,
|
|
3247
|
+
zDirection: e.zDirection
|
|
3248
|
+
}), this.crossOrigin = e.crossOrigin !== void 0 ? e.crossOrigin : null, this.tileClass = e.tileClass !== void 0 ? e.tileClass : Gt, this.tileCacheForProjection = {}, this.tileGridForProjection = {}, this.reprojectionErrorThreshold_ = e.reprojectionErrorThreshold, this.renderReprojectionEdges_ = !1;
|
|
3249
|
+
}
|
|
3250
|
+
/**
|
|
3251
|
+
* @return {boolean} Can expire cache.
|
|
3252
|
+
*/
|
|
3253
|
+
canExpireCache() {
|
|
3254
|
+
if (this.tileCache.canExpireCache())
|
|
3255
|
+
return !0;
|
|
3256
|
+
for (const e in this.tileCacheForProjection)
|
|
3257
|
+
if (this.tileCacheForProjection[e].canExpireCache())
|
|
3258
|
+
return !0;
|
|
3259
|
+
return !1;
|
|
3260
|
+
}
|
|
3261
|
+
/**
|
|
3262
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
3263
|
+
* @param {!Object<string, boolean>} usedTiles Used tiles.
|
|
3264
|
+
*/
|
|
3265
|
+
expireCache(e, t) {
|
|
3266
|
+
const i = this.getTileCacheForProjection(e);
|
|
3267
|
+
this.tileCache.expireCache(
|
|
3268
|
+
this.tileCache == i ? t : {}
|
|
3269
|
+
);
|
|
3270
|
+
for (const n in this.tileCacheForProjection) {
|
|
3271
|
+
const s = this.tileCacheForProjection[n];
|
|
3272
|
+
s.expireCache(s == i ? t : {});
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
/**
|
|
3276
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
3277
|
+
* @return {number} Gutter.
|
|
3278
|
+
*/
|
|
3279
|
+
getGutterForProjection(e) {
|
|
3280
|
+
return this.getProjection() && e && !N(this.getProjection(), e) ? 0 : this.getGutter();
|
|
3281
|
+
}
|
|
3282
|
+
/**
|
|
3283
|
+
* @return {number} Gutter.
|
|
3284
|
+
*/
|
|
3285
|
+
getGutter() {
|
|
3286
|
+
return 0;
|
|
3287
|
+
}
|
|
3288
|
+
/**
|
|
3289
|
+
* Return the key to be used for all tiles in the source.
|
|
3290
|
+
* @return {string} The key for all tiles.
|
|
3291
|
+
*/
|
|
3292
|
+
getKey() {
|
|
3293
|
+
let e = super.getKey();
|
|
3294
|
+
return this.getInterpolate() || (e += ":disable-interpolation"), e;
|
|
3295
|
+
}
|
|
3296
|
+
/**
|
|
3297
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
3298
|
+
* @return {boolean} Opaque.
|
|
3299
|
+
*/
|
|
3300
|
+
getOpaque(e) {
|
|
3301
|
+
return this.getProjection() && e && !N(this.getProjection(), e) ? !1 : super.getOpaque(e);
|
|
3302
|
+
}
|
|
3303
|
+
/**
|
|
3304
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
3305
|
+
* @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
|
|
3306
|
+
*/
|
|
3307
|
+
getTileGridForProjection(e) {
|
|
3308
|
+
const t = this.getProjection();
|
|
3309
|
+
if (this.tileGrid && (!t || N(t, e)))
|
|
3310
|
+
return this.tileGrid;
|
|
3311
|
+
const i = C(e);
|
|
3312
|
+
return i in this.tileGridForProjection || (this.tileGridForProjection[i] = ft(e)), this.tileGridForProjection[i];
|
|
3313
|
+
}
|
|
3314
|
+
/**
|
|
3315
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
3316
|
+
* @return {import("../TileCache.js").default} Tile cache.
|
|
3317
|
+
*/
|
|
3318
|
+
getTileCacheForProjection(e) {
|
|
3319
|
+
const t = this.getProjection();
|
|
3320
|
+
if (!t || N(t, e))
|
|
3321
|
+
return this.tileCache;
|
|
3322
|
+
const i = C(e);
|
|
3323
|
+
return i in this.tileCacheForProjection || (this.tileCacheForProjection[i] = new dt(
|
|
3324
|
+
this.tileCache.highWaterMark
|
|
3325
|
+
)), this.tileCacheForProjection[i];
|
|
3326
|
+
}
|
|
3327
|
+
/**
|
|
3328
|
+
* @param {number} z Tile coordinate z.
|
|
3329
|
+
* @param {number} x Tile coordinate x.
|
|
3330
|
+
* @param {number} y Tile coordinate y.
|
|
3331
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
3332
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
3333
|
+
* @param {string} key The key set on the tile.
|
|
3334
|
+
* @return {!ImageTile} Tile.
|
|
3335
|
+
* @private
|
|
3336
|
+
*/
|
|
3337
|
+
createTile_(e, t, i, n, s, r) {
|
|
3338
|
+
const o = [e, t, i], a = this.getTileCoordForTileUrlFunction(
|
|
3339
|
+
o,
|
|
3340
|
+
s
|
|
3341
|
+
), h = a ? this.tileUrlFunction(a, n, s) : void 0, c = new this.tileClass(
|
|
3342
|
+
o,
|
|
3343
|
+
h !== void 0 ? j.IDLE : j.EMPTY,
|
|
3344
|
+
h !== void 0 ? h : "",
|
|
3345
|
+
this.crossOrigin,
|
|
3346
|
+
this.tileLoadFunction,
|
|
3347
|
+
this.tileOptions
|
|
3348
|
+
);
|
|
3349
|
+
return c.key = r, c.addEventListener($.CHANGE, this.handleTileChange.bind(this)), c;
|
|
3350
|
+
}
|
|
3351
|
+
/**
|
|
3352
|
+
* @param {number} z Tile coordinate z.
|
|
3353
|
+
* @param {number} x Tile coordinate x.
|
|
3354
|
+
* @param {number} y Tile coordinate y.
|
|
3355
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
3356
|
+
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
3357
|
+
* @return {!(ImageTile|ReprojTile)} Tile.
|
|
3358
|
+
*/
|
|
3359
|
+
getTile(e, t, i, n, s) {
|
|
3360
|
+
const r = this.getProjection();
|
|
3361
|
+
if (!r || !s || N(r, s))
|
|
3362
|
+
return this.getTileInternal(
|
|
3363
|
+
e,
|
|
3364
|
+
t,
|
|
3365
|
+
i,
|
|
3366
|
+
n,
|
|
3367
|
+
r || s
|
|
3368
|
+
);
|
|
3369
|
+
const o = this.getTileCacheForProjection(s), a = [e, t, i];
|
|
3370
|
+
let h;
|
|
3371
|
+
const c = ut(a);
|
|
3372
|
+
o.containsKey(c) && (h = o.get(c));
|
|
3373
|
+
const u = this.getKey();
|
|
3374
|
+
if (h && h.key == u)
|
|
3375
|
+
return h;
|
|
3376
|
+
const g = this.getTileGridForProjection(r), d = this.getTileGridForProjection(s), f = this.getTileCoordForTileUrlFunction(
|
|
3377
|
+
a,
|
|
3378
|
+
s
|
|
3379
|
+
), _ = new vt(
|
|
3380
|
+
r,
|
|
3381
|
+
g,
|
|
3382
|
+
s,
|
|
3383
|
+
d,
|
|
3384
|
+
a,
|
|
3385
|
+
f,
|
|
3386
|
+
this.getTilePixelRatio(n),
|
|
3387
|
+
this.getGutter(),
|
|
3388
|
+
(x, T, F, E) => this.getTileInternal(x, T, F, E, r),
|
|
3389
|
+
this.reprojectionErrorThreshold_,
|
|
3390
|
+
this.renderReprojectionEdges_,
|
|
3391
|
+
this.getInterpolate()
|
|
3392
|
+
);
|
|
3393
|
+
return _.key = u, h ? (_.interimTile = h, _.refreshInterimChain(), o.replace(c, _)) : o.set(c, _), _;
|
|
3394
|
+
}
|
|
3395
|
+
/**
|
|
3396
|
+
* @param {number} z Tile coordinate z.
|
|
3397
|
+
* @param {number} x Tile coordinate x.
|
|
3398
|
+
* @param {number} y Tile coordinate y.
|
|
3399
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
3400
|
+
* @param {!import("../proj/Projection.js").default} projection Projection.
|
|
3401
|
+
* @return {!ImageTile} Tile.
|
|
3402
|
+
* @protected
|
|
3403
|
+
*/
|
|
3404
|
+
getTileInternal(e, t, i, n, s) {
|
|
3405
|
+
let r = null;
|
|
3406
|
+
const o = fe(e, t, i), a = this.getKey();
|
|
3407
|
+
if (!this.tileCache.containsKey(o))
|
|
3408
|
+
r = this.createTile_(e, t, i, n, s, a), this.tileCache.set(o, r);
|
|
3409
|
+
else if (r = this.tileCache.get(o), r.key != a) {
|
|
3410
|
+
const h = r;
|
|
3411
|
+
r = this.createTile_(e, t, i, n, s, a), h.getState() == j.IDLE ? r.interimTile = h.interimTile : r.interimTile = h, r.refreshInterimChain(), this.tileCache.replace(o, r);
|
|
3412
|
+
}
|
|
3413
|
+
return r;
|
|
3414
|
+
}
|
|
3415
|
+
/**
|
|
3416
|
+
* Sets whether to render reprojection edges or not (usually for debugging).
|
|
3417
|
+
* @param {boolean} render Render the edges.
|
|
3418
|
+
* @api
|
|
3419
|
+
*/
|
|
3420
|
+
setRenderReprojectionEdges(e) {
|
|
3421
|
+
if (this.renderReprojectionEdges_ != e) {
|
|
3422
|
+
this.renderReprojectionEdges_ = e;
|
|
3423
|
+
for (const t in this.tileCacheForProjection)
|
|
3424
|
+
this.tileCacheForProjection[t].clear();
|
|
3425
|
+
this.changed();
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
/**
|
|
3429
|
+
* Sets the tile grid to use when reprojecting the tiles to the given
|
|
3430
|
+
* projection instead of the default tile grid for the projection.
|
|
3431
|
+
*
|
|
3432
|
+
* This can be useful when the default tile grid cannot be created
|
|
3433
|
+
* (e.g. projection has no extent defined) or
|
|
3434
|
+
* for optimization reasons (custom tile size, resolutions, ...).
|
|
3435
|
+
*
|
|
3436
|
+
* @param {import("../proj.js").ProjectionLike} projection Projection.
|
|
3437
|
+
* @param {import("../tilegrid/TileGrid.js").default} tilegrid Tile grid to use for the projection.
|
|
3438
|
+
* @api
|
|
3439
|
+
*/
|
|
3440
|
+
setTileGridForProjection(e, t) {
|
|
3441
|
+
const i = Ge(e);
|
|
3442
|
+
if (i) {
|
|
3443
|
+
const n = C(i);
|
|
3444
|
+
n in this.tileGridForProjection || (this.tileGridForProjection[n] = t);
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
clear() {
|
|
3448
|
+
super.clear();
|
|
3449
|
+
for (const e in this.tileCacheForProjection)
|
|
3450
|
+
this.tileCacheForProjection[e].clear();
|
|
3451
|
+
}
|
|
3452
|
+
}
|
|
3453
|
+
function bi(l, e) {
|
|
3454
|
+
l.getImage().src = e;
|
|
3455
|
+
}
|
|
3456
|
+
class Ii extends Ai {
|
|
3457
|
+
/**
|
|
3458
|
+
* @param {Options} [options] XYZ options.
|
|
3459
|
+
*/
|
|
3460
|
+
constructor(e) {
|
|
3461
|
+
e = e || {};
|
|
3462
|
+
const t = e.projection !== void 0 ? e.projection : "EPSG:3857", i = e.tileGrid !== void 0 ? e.tileGrid : Pi({
|
|
3463
|
+
extent: Re(t),
|
|
3464
|
+
maxResolution: e.maxResolution,
|
|
3465
|
+
maxZoom: e.maxZoom,
|
|
3466
|
+
minZoom: e.minZoom,
|
|
3467
|
+
tileSize: e.tileSize
|
|
3468
|
+
});
|
|
3469
|
+
super({
|
|
3470
|
+
attributions: e.attributions,
|
|
3471
|
+
cacheSize: e.cacheSize,
|
|
3472
|
+
crossOrigin: e.crossOrigin,
|
|
3473
|
+
interpolate: e.interpolate,
|
|
3474
|
+
opaque: e.opaque,
|
|
3475
|
+
projection: t,
|
|
3476
|
+
reprojectionErrorThreshold: e.reprojectionErrorThreshold,
|
|
3477
|
+
tileGrid: i,
|
|
3478
|
+
tileLoadFunction: e.tileLoadFunction,
|
|
3479
|
+
tilePixelRatio: e.tilePixelRatio,
|
|
3480
|
+
tileUrlFunction: e.tileUrlFunction,
|
|
3481
|
+
url: e.url,
|
|
3482
|
+
urls: e.urls,
|
|
3483
|
+
wrapX: e.wrapX !== void 0 ? e.wrapX : !0,
|
|
3484
|
+
transition: e.transition,
|
|
3485
|
+
attributionsCollapsible: e.attributionsCollapsible,
|
|
3486
|
+
zDirection: e.zDirection
|
|
3487
|
+
}), this.gutter_ = e.gutter !== void 0 ? e.gutter : 0;
|
|
3488
|
+
}
|
|
3489
|
+
/**
|
|
3490
|
+
* @return {number} Gutter.
|
|
3491
|
+
*/
|
|
3492
|
+
getGutter() {
|
|
3493
|
+
return this.gutter_;
|
|
3494
|
+
}
|
|
3495
|
+
}
|
|
3496
|
+
const ji = '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';
|
|
3497
|
+
class Oi extends Ii {
|
|
3498
|
+
/**
|
|
3499
|
+
* @param {Options} [options] Open Street Map options.
|
|
3500
|
+
*/
|
|
3501
|
+
constructor(e) {
|
|
3502
|
+
e = e || {};
|
|
3503
|
+
let t;
|
|
3504
|
+
e.attributions !== void 0 ? t = e.attributions : t = [ji];
|
|
3505
|
+
const i = e.crossOrigin !== void 0 ? e.crossOrigin : "anonymous", n = e.url !== void 0 ? e.url : "https://tile.openstreetmap.org/{z}/{x}/{y}.png";
|
|
3506
|
+
super({
|
|
3507
|
+
attributions: t,
|
|
3508
|
+
attributionsCollapsible: !1,
|
|
3509
|
+
cacheSize: e.cacheSize,
|
|
3510
|
+
crossOrigin: i,
|
|
3511
|
+
interpolate: e.interpolate,
|
|
3512
|
+
maxZoom: e.maxZoom !== void 0 ? e.maxZoom : 19,
|
|
3513
|
+
opaque: e.opaque !== void 0 ? e.opaque : !0,
|
|
3514
|
+
reprojectionErrorThreshold: e.reprojectionErrorThreshold,
|
|
3515
|
+
tileLoadFunction: e.tileLoadFunction,
|
|
3516
|
+
transition: e.transition,
|
|
3517
|
+
url: n,
|
|
3518
|
+
wrapX: e.wrapX,
|
|
3519
|
+
zDirection: e.zDirection
|
|
3520
|
+
});
|
|
3521
|
+
}
|
|
3522
|
+
}
|
|
3523
|
+
let Se = null;
|
|
3524
|
+
const L = new Me(), w = {
|
|
3525
|
+
layer: new ge({
|
|
3526
|
+
source: L,
|
|
3527
|
+
style: Vt
|
|
2189
3528
|
}),
|
|
2190
|
-
modify: new
|
|
3529
|
+
modify: new hi({ source: L }),
|
|
2191
3530
|
draw: null,
|
|
2192
3531
|
snap: null,
|
|
2193
|
-
select: new
|
|
2194
|
-
condition:
|
|
2195
|
-
style:
|
|
3532
|
+
select: new ve({
|
|
3533
|
+
condition: Rt,
|
|
3534
|
+
style: Xt
|
|
2196
3535
|
})
|
|
2197
3536
|
};
|
|
2198
|
-
function
|
|
2199
|
-
const e =
|
|
3537
|
+
function Bi(l) {
|
|
3538
|
+
const e = v.useRef(null), [t, i] = v.useState("Pointer"), [n, s] = v.useState(!1), [r, o] = v.useState({
|
|
2200
3539
|
open: !1,
|
|
2201
3540
|
buttons: [],
|
|
2202
3541
|
position: void 0
|
|
2203
|
-
})
|
|
2204
|
-
|
|
2205
|
-
|
|
3542
|
+
}), a = () => {
|
|
3543
|
+
if (l.defaultExtent && je(l.defaultExtent), h(), c(), u(), k(), l.drawingWKTData && l.drawingWKTData !== "GEOMETRYCOLLECTION()") {
|
|
3544
|
+
q(l.drawingWKTData);
|
|
3545
|
+
const m = Ue(l.drawingWKTData);
|
|
3546
|
+
m && Ie(m[0], [100, 100, 100, 100]);
|
|
3547
|
+
}
|
|
3548
|
+
};
|
|
3549
|
+
v.useEffect(() => () => {
|
|
3550
|
+
}, []), v.useEffect(() => {
|
|
2206
3551
|
if (t !== "Pointer") {
|
|
2207
3552
|
if (t === "KML") {
|
|
2208
|
-
|
|
3553
|
+
_e();
|
|
2209
3554
|
return;
|
|
2210
3555
|
}
|
|
2211
|
-
return
|
|
3556
|
+
return T(t), () => {
|
|
2212
3557
|
};
|
|
2213
3558
|
}
|
|
2214
|
-
}, [t]),
|
|
2215
|
-
}), [l.drawingKMLData]),
|
|
3559
|
+
}, [t]), v.useEffect(() => (l.drawingKMLData && E(l.drawingKMLData), () => {
|
|
3560
|
+
}), [l.drawingKMLData]), v.useEffect(() => (l.drawingWKTData && (k(), l.drawingWKTData !== "GEOMETRYCOLLECTION()" && q(l.drawingWKTData)), () => {
|
|
2216
3561
|
}), [l.drawingWKTData]);
|
|
2217
|
-
const
|
|
2218
|
-
|
|
2219
|
-
}, h = () => {
|
|
2220
|
-
u(), f();
|
|
3562
|
+
const h = () => {
|
|
3563
|
+
g(), d();
|
|
2221
3564
|
}, c = () => {
|
|
2222
|
-
_();
|
|
2223
|
-
},
|
|
2224
|
-
|
|
2225
|
-
|
|
3565
|
+
f(), _();
|
|
3566
|
+
}, u = () => {
|
|
3567
|
+
x();
|
|
3568
|
+
}, g = () => {
|
|
3569
|
+
var m;
|
|
3570
|
+
l.mapboxAccessToken ? Se = Tt({
|
|
2226
3571
|
id: l.id,
|
|
2227
3572
|
center: [0, 0],
|
|
2228
3573
|
style: "mapbox://styles/mapbox/streets-v11",
|
|
2229
3574
|
accessToken: l.mapboxAccessToken
|
|
2230
|
-
}).layer
|
|
2231
|
-
|
|
3575
|
+
}).layer : Se = new At({
|
|
3576
|
+
source: new Oi()
|
|
3577
|
+
}), (m = e.current) == null || m.addLayer(Se);
|
|
3578
|
+
}, d = () => {
|
|
2232
3579
|
var m;
|
|
2233
|
-
(m = e.current) == null || m.addLayer(
|
|
2234
|
-
},
|
|
3580
|
+
(m = e.current) == null || m.addLayer(w.layer);
|
|
3581
|
+
}, f = () => {
|
|
2235
3582
|
var m;
|
|
2236
|
-
(m = e.current) == null || m.addInteraction(
|
|
2237
|
-
l.onSelect && l.onSelect(
|
|
3583
|
+
(m = e.current) == null || m.addInteraction(w.select), w.select.on("select", function() {
|
|
3584
|
+
l.onSelect && l.onSelect(w.select.getFeatures().getArray());
|
|
2238
3585
|
});
|
|
2239
|
-
},
|
|
3586
|
+
}, _ = () => {
|
|
2240
3587
|
var m;
|
|
2241
|
-
(m = e.current) == null || m.addInteraction(
|
|
3588
|
+
(m = e.current) == null || m.addInteraction(w.modify), w.modify.on("modifyend", () => {
|
|
2242
3589
|
setTimeout(() => {
|
|
2243
|
-
l.onDrawEnd && l.onDrawEnd(
|
|
2244
|
-
}, 250),
|
|
3590
|
+
l.onDrawEnd && l.onDrawEnd(L.getFeatures());
|
|
3591
|
+
}, 250), F();
|
|
2245
3592
|
});
|
|
2246
|
-
},
|
|
3593
|
+
}, x = async () => {
|
|
2247
3594
|
var m;
|
|
2248
3595
|
(m = e.current) == null || m.on(
|
|
2249
3596
|
"contextmenu",
|
|
@@ -2252,18 +3599,18 @@ function qt(l) {
|
|
|
2252
3599
|
y.preventDefault();
|
|
2253
3600
|
const S = (B = e.current) == null ? void 0 : B.getEventPixel(y.originalEvent);
|
|
2254
3601
|
if (S) {
|
|
2255
|
-
const
|
|
2256
|
-
if (
|
|
3602
|
+
const U = await w.layer.getFeatures(S);
|
|
3603
|
+
if (U && U.length > 0) {
|
|
2257
3604
|
o({
|
|
2258
3605
|
open: !0,
|
|
2259
3606
|
buttons: [
|
|
2260
3607
|
{
|
|
2261
3608
|
label: "Delete",
|
|
2262
3609
|
onClick: () => {
|
|
2263
|
-
|
|
2264
|
-
(
|
|
2265
|
-
),
|
|
2266
|
-
l.onDrawEnd && l.onDrawEnd(
|
|
3610
|
+
U.forEach(
|
|
3611
|
+
(Ct) => Q(Ct)
|
|
3612
|
+
), be(), setTimeout(() => {
|
|
3613
|
+
l.onDrawEnd && l.onDrawEnd(L.getFeatures());
|
|
2267
3614
|
}, 250);
|
|
2268
3615
|
}
|
|
2269
3616
|
}
|
|
@@ -2276,55 +3623,55 @@ function qt(l) {
|
|
|
2276
3623
|
return;
|
|
2277
3624
|
}
|
|
2278
3625
|
}
|
|
2279
|
-
|
|
3626
|
+
be();
|
|
2280
3627
|
}
|
|
2281
3628
|
);
|
|
2282
|
-
},
|
|
2283
|
-
var B,
|
|
2284
|
-
|
|
2285
|
-
const y = new
|
|
2286
|
-
source:
|
|
3629
|
+
}, T = (m) => {
|
|
3630
|
+
var B, U;
|
|
3631
|
+
F();
|
|
3632
|
+
const y = new fi({
|
|
3633
|
+
source: L,
|
|
2287
3634
|
type: m
|
|
2288
|
-
}), S = new
|
|
3635
|
+
}), S = new Ci({ source: L });
|
|
2289
3636
|
y.on("drawend", () => {
|
|
2290
3637
|
setTimeout(() => {
|
|
2291
|
-
l.onDrawEnd && l.onDrawEnd(
|
|
2292
|
-
}, 250),
|
|
2293
|
-
}),
|
|
2294
|
-
},
|
|
3638
|
+
l.onDrawEnd && l.onDrawEnd(L.getFeatures());
|
|
3639
|
+
}, 250), F(), i("Pointer");
|
|
3640
|
+
}), w.draw = y, w.snap = S, (B = e.current) == null || B.addInteraction(y), (U = e.current) == null || U.addInteraction(S);
|
|
3641
|
+
}, F = () => {
|
|
2295
3642
|
var m, y;
|
|
2296
|
-
|
|
2297
|
-
},
|
|
2298
|
-
const y =
|
|
2299
|
-
y &&
|
|
2300
|
-
},
|
|
2301
|
-
const y =
|
|
2302
|
-
y &&
|
|
2303
|
-
},
|
|
2304
|
-
|
|
2305
|
-
},
|
|
2306
|
-
|
|
2307
|
-
},
|
|
3643
|
+
w.draw && ((m = e.current) == null || m.removeInteraction(w.draw)), w.snap && ((y = e.current) == null || y.removeInteraction(w.snap));
|
|
3644
|
+
}, E = (m) => {
|
|
3645
|
+
const y = Oe(m);
|
|
3646
|
+
y && L.addFeatures(y);
|
|
3647
|
+
}, q = (m) => {
|
|
3648
|
+
const y = Ue(m, Zt);
|
|
3649
|
+
y && L.addFeatures(y);
|
|
3650
|
+
}, k = () => {
|
|
3651
|
+
L.clear();
|
|
3652
|
+
}, Q = (m) => {
|
|
3653
|
+
L.removeFeature(m);
|
|
3654
|
+
}, be = () => {
|
|
2308
3655
|
o({
|
|
2309
3656
|
open: !1,
|
|
2310
3657
|
buttons: []
|
|
2311
3658
|
});
|
|
2312
|
-
},
|
|
2313
|
-
|
|
2314
|
-
},
|
|
3659
|
+
}, _e = () => {
|
|
3660
|
+
s((m) => !m);
|
|
3661
|
+
}, mt = (m) => {
|
|
2315
3662
|
var S;
|
|
2316
|
-
const y =
|
|
2317
|
-
y ? (
|
|
2318
|
-
},
|
|
3663
|
+
const y = Oe(m);
|
|
3664
|
+
y ? (_e(), L.addFeatures(y), (S = e.current) == null || S.centerToFeature(y[0]), l.onDrawEnd && l.onDrawEnd(y)) : ri("Error!", "Feature(s) could not be loaded! Check your KML data!");
|
|
3665
|
+
}, yt = (m) => {
|
|
2319
3666
|
var y;
|
|
2320
3667
|
(y = e.current) == null || y.setCenter(m);
|
|
2321
|
-
},
|
|
3668
|
+
}, xt = (m) => {
|
|
2322
3669
|
var y;
|
|
2323
3670
|
(y = e.current) == null || y.setZoomLevel(m);
|
|
2324
|
-
},
|
|
3671
|
+
}, Ie = (m, y = [0, 0, 0, 0]) => {
|
|
2325
3672
|
var S;
|
|
2326
3673
|
(S = e.current) == null || S.centerToFeature(m, y);
|
|
2327
|
-
},
|
|
3674
|
+
}, je = (m) => {
|
|
2328
3675
|
var y;
|
|
2329
3676
|
(y = e.current) == null || y.centerToExtent(m);
|
|
2330
3677
|
};
|
|
@@ -2334,28 +3681,26 @@ function qt(l) {
|
|
|
2334
3681
|
},
|
|
2335
3682
|
state: {
|
|
2336
3683
|
activeDrawingTool: t,
|
|
2337
|
-
openAddKMLText:
|
|
3684
|
+
openAddKMLText: n,
|
|
2338
3685
|
contextMenu: r
|
|
2339
3686
|
},
|
|
2340
3687
|
action: {
|
|
2341
|
-
setActiveDrawingTool:
|
|
2342
|
-
addInteractions:
|
|
2343
|
-
addDrawingSourceKMLData:
|
|
2344
|
-
addDrawingSourceWKTData:
|
|
2345
|
-
clearDrawingSource:
|
|
2346
|
-
toggleAddKMLText:
|
|
2347
|
-
addKMLText:
|
|
3688
|
+
setActiveDrawingTool: i,
|
|
3689
|
+
addInteractions: T,
|
|
3690
|
+
addDrawingSourceKMLData: E,
|
|
3691
|
+
addDrawingSourceWKTData: q,
|
|
3692
|
+
clearDrawingSource: k,
|
|
3693
|
+
toggleAddKMLText: _e,
|
|
3694
|
+
addKMLText: mt,
|
|
2348
3695
|
setContextMenu: o,
|
|
2349
|
-
setCenter:
|
|
2350
|
-
setZoomLevel:
|
|
2351
|
-
centerToFeature:
|
|
2352
|
-
centerToExtent:
|
|
2353
|
-
onMapInit:
|
|
2354
|
-
l.defaultExtent && Ce(l.defaultExtent);
|
|
2355
|
-
}
|
|
3696
|
+
setCenter: yt,
|
|
3697
|
+
setZoomLevel: xt,
|
|
3698
|
+
centerToFeature: Ie,
|
|
3699
|
+
centerToExtent: je,
|
|
3700
|
+
onMapInit: a
|
|
2356
3701
|
}
|
|
2357
3702
|
};
|
|
2358
3703
|
}
|
|
2359
3704
|
export {
|
|
2360
|
-
|
|
3705
|
+
Bi as default
|
|
2361
3706
|
};
|