@watergis/maplibre-gl-terradraw 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/maplibre-gl-terradraw.es.js +496 -442
- package/dist/maplibre-gl-terradraw.es.js.map +1 -1
- package/dist/maplibre-gl-terradraw.umd.js +3 -3
- package/dist/maplibre-gl-terradraw.umd.js.map +1 -1
- package/dist/types/constants/defaultMeasureControlOptions.d.ts.map +1 -1
- package/dist/types/controls/MaplibreMeasureControl.d.ts +3 -1
- package/dist/types/controls/MaplibreMeasureControl.d.ts.map +1 -1
- package/dist/types/controls/MaplibreValhallaControl.d.ts.map +1 -1
- package/dist/types/helpers/calcArea.d.ts +2 -2
- package/dist/types/helpers/calcArea.d.ts.map +1 -1
- package/dist/types/helpers/convertAreaUnit.d.ts +2 -2
- package/dist/types/helpers/convertAreaUnit.d.ts.map +1 -1
- package/dist/types/interfaces/AreaUnit.d.ts +3 -0
- package/dist/types/interfaces/AreaUnit.d.ts.map +1 -1
- package/dist/types/interfaces/MeasureControlOptions.d.ts +2 -1
- package/dist/types/interfaces/MeasureControlOptions.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LngLat as
|
|
1
|
+
import { LngLat as Ze } from "maplibre-gl";
|
|
2
2
|
function x() {
|
|
3
3
|
return x = Object.assign ? Object.assign.bind() : function(r) {
|
|
4
4
|
for (var t = 1; t < arguments.length; t++) {
|
|
@@ -12,24 +12,24 @@ var b;
|
|
|
12
12
|
(function(r) {
|
|
13
13
|
r.Commit = "commit", r.Provisional = "provisional", r.Finish = "finish";
|
|
14
14
|
})(b || (b = {}));
|
|
15
|
-
const k = { SELECTED: "selected", MID_POINT: "midPoint", SELECTION_POINT_FEATURE_ID: "selectionPointFeatureId", SELECTION_POINT: "selectionPoint" }, D = "currentlyDrawing", z = "edited", J = "closingPoint",
|
|
16
|
-
function
|
|
15
|
+
const k = { SELECTED: "selected", MID_POINT: "midPoint", SELECTION_POINT_FEATURE_ID: "selectionPointFeatureId", SELECTION_POINT: "selectionPoint" }, D = "currentlyDrawing", z = "edited", J = "closingPoint", xt = "snappingPoint", It = "coordinatePoint", Qe = "coordinatePointFeatureId", ht = "coordinatePointIds", T = 10;
|
|
16
|
+
function Ft(r) {
|
|
17
17
|
return !!(r && typeof r == "object" && r !== null && !Array.isArray(r));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function te(r) {
|
|
20
20
|
return !!(r && typeof r == "object" && "properties" in r && typeof r.properties == "object" && r.properties !== null && "mode" in r.properties);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function ee(r) {
|
|
23
23
|
return !!(function(t) {
|
|
24
24
|
return typeof t == "number" && !isNaN(new Date(t).valueOf());
|
|
25
25
|
})(r);
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const ti = "Feature mode property does not match the mode being added to";
|
|
28
28
|
var q;
|
|
29
29
|
(function(r) {
|
|
30
30
|
r.Drawing = "drawing", r.Select = "select", r.Static = "static", r.Render = "render";
|
|
31
31
|
})(q || (q = {}));
|
|
32
|
-
const
|
|
32
|
+
const ei = { rightClick: !0, contextMenu: !1, leftClick: !0, onDragStart: !0, onDrag: !0, onDragEnd: !0 };
|
|
33
33
|
let G = class {
|
|
34
34
|
get state() {
|
|
35
35
|
return this._state;
|
|
@@ -47,7 +47,7 @@ let G = class {
|
|
|
47
47
|
registerBehaviors(t) {
|
|
48
48
|
}
|
|
49
49
|
constructor(t, e = !1) {
|
|
50
|
-
this._state = "unregistered", this._styles = {}, this.pointerEvents =
|
|
50
|
+
this._state = "unregistered", this._styles = {}, this.pointerEvents = ei, this.behaviors = [], this.validate = void 0, this.pointerDistance = 40, this.coordinatePrecision = void 0, this.onStyleChange = void 0, this.store = void 0, this.projection = "web-mercator", this.setDoubleClickToZoom = void 0, this.unproject = void 0, this.project = void 0, this.setCursor = void 0, this.type = q.Drawing, this.mode = "base", e || this.updateOptions(t);
|
|
51
51
|
}
|
|
52
52
|
updateOptions(t) {
|
|
53
53
|
t != null && t.styles && (this.styles = x({}, this._styles, t.styles)), t != null && t.pointerDistance && (this.pointerDistance = t.pointerDistance), t != null && t.validation && (this.validate = t && t.validation), t != null && t.projection && (this.projection = t.projection), t?.pointerEvents !== void 0 && (this.pointerEvents = t.pointerEvents);
|
|
@@ -82,9 +82,9 @@ let G = class {
|
|
|
82
82
|
if (this._state === "unregistered") throw new Error("Mode must be registered");
|
|
83
83
|
const e = (function(i, o) {
|
|
84
84
|
let s;
|
|
85
|
-
if (
|
|
85
|
+
if (Ft(i)) if (i.id == null) s = "Feature has no id";
|
|
86
86
|
else if (typeof i.id != "string" && typeof i.id != "number") s = "Feature must be string or number as per GeoJSON spec";
|
|
87
|
-
else if (o(i.id)) if (
|
|
87
|
+
else if (o(i.id)) if (Ft(i.geometry)) if (Ft(i.properties)) if (typeof i.geometry.type == "string" && ["Polygon", "LineString", "Point"].includes(i.geometry.type)) if (Array.isArray(i.geometry.coordinates)) {
|
|
88
88
|
if (!i.properties.mode || typeof i.properties.mode != "string") return { valid: !1, reason: "Feature does not have a valid mode property" };
|
|
89
89
|
} else s = "Feature coordinates is not an array";
|
|
90
90
|
else s = "Feature is not Point, LineString or Polygon";
|
|
@@ -102,7 +102,7 @@ let G = class {
|
|
|
102
102
|
}
|
|
103
103
|
validateModeFeature(t, e) {
|
|
104
104
|
const i = this.performFeatureValidation(t);
|
|
105
|
-
return i.valid ? t.properties.mode !== this.mode ? { valid: !1, reason:
|
|
105
|
+
return i.valid ? t.properties.mode !== this.mode ? { valid: !1, reason: ti } : e(t) : { valid: !1, reason: i.reason };
|
|
106
106
|
}
|
|
107
107
|
onFinish(t, e) {
|
|
108
108
|
}
|
|
@@ -134,7 +134,7 @@ let G = class {
|
|
|
134
134
|
return t === void 0 ? e : typeof t == "function" ? t(i) : t;
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
|
-
class
|
|
137
|
+
class ii extends G {
|
|
138
138
|
constructor(...t) {
|
|
139
139
|
super(...t), this.type = q.Select;
|
|
140
140
|
}
|
|
@@ -143,11 +143,11 @@ function R(r, t) {
|
|
|
143
143
|
const e = (d) => d * Math.PI / 180, i = e(r[1]), o = e(r[0]), s = e(t[1]), n = s - i, a = e(t[0]) - o, l = Math.sin(n / 2) * Math.sin(n / 2) + Math.cos(i) * Math.cos(s) * Math.sin(a / 2) * Math.sin(a / 2);
|
|
144
144
|
return 2 * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l)) * 6371e3 / 1e3;
|
|
145
145
|
}
|
|
146
|
-
const
|
|
146
|
+
const Ee = 63710088e-1;
|
|
147
147
|
function M(r) {
|
|
148
148
|
return r % 360 * Math.PI / 180;
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function we(r) {
|
|
151
151
|
return r / 6371.0088;
|
|
152
152
|
}
|
|
153
153
|
function $(r) {
|
|
@@ -157,20 +157,20 @@ function w(r, t = 9) {
|
|
|
157
157
|
const e = Math.pow(10, t);
|
|
158
158
|
return Math.round(r * e) / e;
|
|
159
159
|
}
|
|
160
|
-
const
|
|
161
|
-
function
|
|
162
|
-
const i = M(r[0]), o = M(r[1]), s = M(e), n =
|
|
160
|
+
const ie = 57.29577951308232, oe = 0.017453292519943295, bt = 6378137, I = (r, t) => ({ x: r === 0 ? 0 : r * oe * bt, y: t === 0 ? 0 : Math.log(Math.tan(Math.PI / 4 + t * oe / 2)) * bt }), A = (r, t) => ({ lng: r === 0 ? 0 : ie * (r / bt), lat: t === 0 ? 0 : (2 * Math.atan(Math.exp(t / bt)) - Math.PI / 2) * ie });
|
|
161
|
+
function oi(r, t, e) {
|
|
162
|
+
const i = M(r[0]), o = M(r[1]), s = M(e), n = we(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(s));
|
|
163
163
|
return [$(i + Math.atan2(Math.sin(s) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), $(a)];
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function se(r) {
|
|
166
166
|
const { center: t, radiusKilometers: e, coordinatePrecision: i } = r, o = r.steps ? r.steps : 64, s = [];
|
|
167
167
|
for (let n = 0; n < o; n++) {
|
|
168
|
-
const a =
|
|
168
|
+
const a = oi(t, e, -360 * n / o);
|
|
169
169
|
s.push([w(a[0], i), w(a[1], i)]);
|
|
170
170
|
}
|
|
171
171
|
return s.push(s[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [s] }, properties: {} };
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function Gt(r) {
|
|
174
174
|
let t;
|
|
175
175
|
if (r.geometry.type === "Polygon") t = r.geometry.coordinates;
|
|
176
176
|
else {
|
|
@@ -185,7 +185,7 @@ function Wt(r) {
|
|
|
185
185
|
}
|
|
186
186
|
function o(s, n, a, l) {
|
|
187
187
|
const d = t[s][n], c = t[s][n + 1], h = t[a][l], u = t[a][l + 1], p = (function(m, v, C, f) {
|
|
188
|
-
if (
|
|
188
|
+
if (mt(m, C) || mt(m, f) || mt(v, C) || mt(f, C)) return null;
|
|
189
189
|
const P = m[0], S = m[1], E = v[0], O = v[1], F = C[0], N = C[1], _ = f[0], B = f[1], K = (P - E) * (N - B) - (S - O) * (F - _);
|
|
190
190
|
return K === 0 ? null : [((P * O - S * E) * (F - _) - (P - E) * (F * B - N * _)) / K, ((P * O - S * E) * (N - B) - (S - O) * (F * B - N * _)) / K];
|
|
191
191
|
})(d, c, h, u);
|
|
@@ -194,41 +194,41 @@ function Wt(r) {
|
|
|
194
194
|
g = c[0] !== d[0] ? (p[0] - d[0]) / (c[0] - d[0]) : (p[1] - d[1]) / (c[1] - d[1]), y = u[0] !== h[0] ? (p[0] - h[0]) / (u[0] - h[0]) : (p[1] - h[1]) / (u[1] - h[1]), i(g) || i(y) || (p.toString(), e.push(p));
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function mt(r, t) {
|
|
198
198
|
return r[0] === t[0] && r[1] === t[1];
|
|
199
199
|
}
|
|
200
|
-
function
|
|
201
|
-
return
|
|
200
|
+
function Ot(r, t) {
|
|
201
|
+
return re(r[0]) <= t && re(r[1]) <= t;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function At(r) {
|
|
204
204
|
return r.length === 2 && typeof r[0] == "number" && typeof r[1] == "number" && r[0] !== 1 / 0 && r[1] !== 1 / 0 && (e = r[0]) >= -180 && e <= 180 && (t = r[1]) >= -90 && t <= 90;
|
|
205
205
|
var t, e;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function re(r) {
|
|
208
208
|
let t = 1, e = 0;
|
|
209
209
|
for (; Math.round(r * t) / t !== r; ) t *= 10, e++;
|
|
210
210
|
return e;
|
|
211
211
|
}
|
|
212
|
-
const
|
|
213
|
-
function
|
|
212
|
+
const si = "Feature has holes", ri = "Feature has less than 4 coordinates", ni = "Feature has invalid coordinates", ai = "Feature coordinates are not closed";
|
|
213
|
+
function Lt(r, t) {
|
|
214
214
|
if (r.geometry.type !== "Polygon") return { valid: !1, reason: "Feature is not a Polygon" };
|
|
215
|
-
if (r.geometry.coordinates.length !== 1) return { valid: !1, reason:
|
|
216
|
-
if (r.geometry.coordinates[0].length < 4) return { valid: !1, reason:
|
|
215
|
+
if (r.geometry.coordinates.length !== 1) return { valid: !1, reason: si };
|
|
216
|
+
if (r.geometry.coordinates[0].length < 4) return { valid: !1, reason: ri };
|
|
217
217
|
for (let o = 0; o < r.geometry.coordinates[0].length; o++) {
|
|
218
|
-
if (!
|
|
219
|
-
if (!
|
|
218
|
+
if (!At(r.geometry.coordinates[0][o])) return { valid: !1, reason: ni };
|
|
219
|
+
if (!Ot(r.geometry.coordinates[0][o], t)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
|
|
220
220
|
}
|
|
221
|
-
return (e = r.geometry.coordinates[0][0])[0] !== (i = r.geometry.coordinates[0][r.geometry.coordinates[0].length - 1])[0] || e[1] !== i[1] ? { valid: !1, reason:
|
|
221
|
+
return (e = r.geometry.coordinates[0][0])[0] !== (i = r.geometry.coordinates[0][r.geometry.coordinates[0].length - 1])[0] || e[1] !== i[1] ? { valid: !1, reason: ai } : { valid: !0 };
|
|
222
222
|
var e, i;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
const e =
|
|
226
|
-
return e.valid ?
|
|
224
|
+
function yt(r, t) {
|
|
225
|
+
const e = Lt(r, t);
|
|
226
|
+
return e.valid ? Gt(r) ? { valid: !1, reason: "Feature intersects itself" } : { valid: !0 } : e;
|
|
227
227
|
}
|
|
228
|
-
const
|
|
229
|
-
class
|
|
228
|
+
const li = { cancel: "Escape", finish: "Enter" }, di = { start: "crosshair" };
|
|
229
|
+
class Oe extends G {
|
|
230
230
|
constructor(t) {
|
|
231
|
-
super(t, !0), this.mode = "circle", this.center = void 0, this.clickCount = 0, this.currentCircleId = void 0, this.keyEvents =
|
|
231
|
+
super(t, !0), this.mode = "circle", this.center = void 0, this.clickCount = 0, this.currentCircleId = void 0, this.keyEvents = li, this.cursors = di, this.startingRadiusKilometers = 1e-5, this.cursorMovedAfterInitialCursorDown = !1, this.updateOptions(t);
|
|
232
232
|
}
|
|
233
233
|
updateOptions(t) {
|
|
234
234
|
super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.startingRadiusKilometers && (this.startingRadiusKilometers = t.startingRadiusKilometers);
|
|
@@ -252,7 +252,7 @@ class Ee extends G {
|
|
|
252
252
|
onClick(t) {
|
|
253
253
|
if (t.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, t) || t.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, t) || t.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, t)) if (this.clickCount === 0) {
|
|
254
254
|
this.center = [t.lng, t.lat];
|
|
255
|
-
const e =
|
|
255
|
+
const e = se({ center: this.center, radiusKilometers: this.startingRadiusKilometers, coordinatePrecision: this.coordinatePrecision }), [i] = this.store.create([{ geometry: e.geometry, properties: { mode: this.mode, radiusKilometers: this.startingRadiusKilometers, [D]: !0 } }]);
|
|
256
256
|
this.currentCircleId = i, this.clickCount++, this.cursorMovedAfterInitialCursorDown = !1, this.setDrawing();
|
|
257
257
|
} else this.clickCount === 1 && this.center && this.currentCircleId !== void 0 && this.cursorMovedAfterInitialCursorDown && this.updateCircle(t), this.close();
|
|
258
258
|
}
|
|
@@ -283,7 +283,7 @@ class Ee extends G {
|
|
|
283
283
|
return t.type === "Feature" && t.geometry.type === "Polygon" && t.properties.mode === this.mode && (e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = T), e;
|
|
284
284
|
}
|
|
285
285
|
validateFeature(t) {
|
|
286
|
-
return this.validateModeFeature(t, (e) =>
|
|
286
|
+
return this.validateModeFeature(t, (e) => yt(e, this.coordinatePrecision));
|
|
287
287
|
}
|
|
288
288
|
updateCircle(t) {
|
|
289
289
|
if (this.clickCount === 1 && this.center && this.currentCircleId) {
|
|
@@ -306,7 +306,7 @@ class Ee extends G {
|
|
|
306
306
|
})({ center: this.center, radiusKilometers: e * o, coordinatePrecision: this.coordinatePrecision });
|
|
307
307
|
} else {
|
|
308
308
|
if (this.projection !== "globe") throw new Error("Invalid projection");
|
|
309
|
-
i =
|
|
309
|
+
i = se({ center: this.center, radiusKilometers: e, coordinatePrecision: this.coordinatePrecision });
|
|
310
310
|
}
|
|
311
311
|
if (this.validate && !this.validate({ type: "Feature", id: this.currentCircleId, geometry: i.geometry, properties: { radiusKilometers: e } }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: b.Provisional }).valid) return;
|
|
312
312
|
this.store.updateGeometry([{ id: this.currentCircleId, geometry: i.geometry }]), this.store.updateProperty([{ id: this.currentCircleId, property: "radiusKilometers", value: e }]);
|
|
@@ -320,7 +320,7 @@ const L = (r, t) => {
|
|
|
320
320
|
const { x: e, y: i } = r, { x: o, y: s } = t, n = o - e, a = s - i;
|
|
321
321
|
return Math.sqrt(a * a + n * n);
|
|
322
322
|
};
|
|
323
|
-
function
|
|
323
|
+
function ft(r) {
|
|
324
324
|
if (!(function(e) {
|
|
325
325
|
const i = e.coordinates[0];
|
|
326
326
|
let o = 0;
|
|
@@ -331,10 +331,10 @@ function gt(r) {
|
|
|
331
331
|
return o < 0;
|
|
332
332
|
})(r)) return { type: "Polygon", coordinates: [r.coordinates[0].reverse()] };
|
|
333
333
|
}
|
|
334
|
-
const
|
|
335
|
-
class
|
|
334
|
+
const ci = { cancel: "Escape", finish: "Enter" }, hi = { start: "crosshair", close: "pointer" };
|
|
335
|
+
class Le extends G {
|
|
336
336
|
constructor(t) {
|
|
337
|
-
super(t, !0), this.mode = "freehand", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents =
|
|
337
|
+
super(t, !0), this.mode = "freehand", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents = ci, this.cursors = hi, this.preventPointsNearClose = !0, this.autoClose = !1, this.autoCloseTimeout = 500, this.hasLeftStartingPoint = !1, this.preventNewFeature = !1, this.updateOptions(t);
|
|
338
338
|
}
|
|
339
339
|
updateOptions(t) {
|
|
340
340
|
super.updateOptions(t), t != null && t.minDistance && (this.minDistance = t.minDistance), t?.preventPointsNearClose !== void 0 && (this.preventPointsNearClose = t.preventPointsNearClose), t?.autoClose !== void 0 && (this.autoClose = t.autoClose), t != null && t.autoCloseTimeout && (this.autoCloseTimeout = t.autoCloseTimeout), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors));
|
|
@@ -342,7 +342,7 @@ class we extends G {
|
|
|
342
342
|
close() {
|
|
343
343
|
if (this.currentId === void 0) return;
|
|
344
344
|
if (this.currentId) {
|
|
345
|
-
const e =
|
|
345
|
+
const e = ft(this.store.getGeometryCopy(this.currentId));
|
|
346
346
|
e && this.store.updateGeometry([{ id: this.currentId, geometry: e }]), this.store.updateProperty([{ id: this.currentId, property: D, value: void 0 }]);
|
|
347
347
|
}
|
|
348
348
|
const t = this.currentId;
|
|
@@ -405,7 +405,7 @@ class we extends G {
|
|
|
405
405
|
return t.type === "Feature" && t.geometry.type === "Polygon" && t.properties.mode === this.mode ? (e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = T, e) : (t.type === "Feature" && t.geometry.type === "Point" && t.properties.mode === this.mode && (e.pointWidth = this.getNumericStylingValue(this.styles.closingPointWidth, e.pointWidth, t), e.pointColor = this.getHexColorStylingValue(this.styles.closingPointColor, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.closingPointOutlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.closingPointOutlineWidth, 2, t), e.zIndex = 50), e);
|
|
406
406
|
}
|
|
407
407
|
validateFeature(t) {
|
|
408
|
-
return this.validateModeFeature(t, (e) =>
|
|
408
|
+
return this.validateModeFeature(t, (e) => Lt(e, this.coordinatePrecision));
|
|
409
409
|
}
|
|
410
410
|
afterFeatureUpdated(t) {
|
|
411
411
|
this.currentId === t.id && (this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.hasLeftStartingPoint = !1);
|
|
@@ -416,20 +416,20 @@ class W {
|
|
|
416
416
|
this.store = void 0, this.mode = void 0, this.project = void 0, this.unproject = void 0, this.pointerDistance = void 0, this.coordinatePrecision = void 0, this.projection = void 0, this.store = t, this.mode = e, this.project = i, this.unproject = o, this.pointerDistance = s, this.coordinatePrecision = n, this.projection = a;
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
-
function
|
|
419
|
+
function Fe({ unproject: r, point: t, pointerDistance: e }) {
|
|
420
420
|
const i = e / 2, { x: o, y: s } = t;
|
|
421
421
|
return { type: "Feature", properties: {}, geometry: { type: "Polygon", coordinates: [[r(o - i, s - i), r(o + i, s - i), r(o + i, s + i), r(o - i, s + i), r(o - i, s - i)].map((n) => [n.lng, n.lat])] } };
|
|
422
422
|
}
|
|
423
|
-
class
|
|
423
|
+
class ut extends W {
|
|
424
424
|
constructor(t) {
|
|
425
425
|
super(t);
|
|
426
426
|
}
|
|
427
427
|
create(t) {
|
|
428
428
|
const { containerX: e, containerY: i } = t;
|
|
429
|
-
return
|
|
429
|
+
return Fe({ unproject: this.unproject, point: { x: e, y: i }, pointerDistance: this.pointerDistance });
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
-
class
|
|
432
|
+
class pt extends W {
|
|
433
433
|
constructor(t) {
|
|
434
434
|
super(t);
|
|
435
435
|
}
|
|
@@ -438,7 +438,7 @@ class ht extends W {
|
|
|
438
438
|
return L({ x: i, y: o }, { x: t.containerX, y: t.containerY });
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
class
|
|
441
|
+
class Et extends W {
|
|
442
442
|
constructor(t, e, i) {
|
|
443
443
|
super(t), this.config = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.getSnappableCoordinateFirstClick = (o) => this.getSnappable(o, (s) => !!(s.properties && s.properties.mode === this.mode)).coordinate, this.getSnappableCoordinate = (o, s) => this.getSnappable(o, (n) => !!(n.properties && n.properties.mode === this.mode && n.id !== s)).coordinate, this.config = t, this.pixelDistance = e, this.clickBoundingBox = i;
|
|
444
444
|
}
|
|
@@ -458,15 +458,15 @@ class It extends W {
|
|
|
458
458
|
}), s;
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
function
|
|
462
|
-
const i = M(r[0]), o = M(r[1]), s = M(e), n =
|
|
461
|
+
function ne(r, t, e) {
|
|
462
|
+
const i = M(r[0]), o = M(r[1]), s = M(e), n = we(t), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(s));
|
|
463
463
|
return [$(i + Math.atan2(Math.sin(s) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), $(a)];
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function gt({ x: r, y: t }, e, i) {
|
|
466
466
|
const o = M(i);
|
|
467
467
|
return { x: r + e * Math.cos(o), y: t + e * Math.sin(o) };
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function ae(r, t) {
|
|
470
470
|
const e = M(r[0]), i = M(t[0]), o = M(r[1]), s = M(t[1]), n = Math.sin(i - e) * Math.cos(s), a = Math.cos(o) * Math.sin(s) - Math.sin(o) * Math.cos(s) * Math.cos(i - e);
|
|
471
471
|
return $(Math.atan2(n, a));
|
|
472
472
|
}
|
|
@@ -479,15 +479,15 @@ function U({ x: r, y: t }, { x: e, y: i }) {
|
|
|
479
479
|
function H(r) {
|
|
480
480
|
return (r + 360) % 360;
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function ui(r, t, e) {
|
|
483
483
|
const i = [], o = r.length;
|
|
484
484
|
let s, n, a, l = 0;
|
|
485
485
|
for (let c = 0; c < r.length && !(t >= l && c === r.length - 1); c++) {
|
|
486
486
|
if (l > t && i.length === 0) {
|
|
487
487
|
if (s = t - l, !s) return i.push(r[c]), i;
|
|
488
|
-
n =
|
|
488
|
+
n = ae(r[c], r[c - 1]) - 180, a = ne(r[c], s, n), i.push(a);
|
|
489
489
|
}
|
|
490
|
-
if (l >= e) return s = e - l, s ? (n =
|
|
490
|
+
if (l >= e) return s = e - l, s ? (n = ae(r[c], r[c - 1]) - 180, a = ne(r[c], s, n), i.push(a), i) : (i.push(r[c]), i);
|
|
491
491
|
if (l >= t && i.push(r[c]), c === r.length - 1) return i;
|
|
492
492
|
l += R(r[c], r[c + 1]);
|
|
493
493
|
}
|
|
@@ -495,13 +495,13 @@ function ci(r, t, e) {
|
|
|
495
495
|
const d = r[r.length - 1];
|
|
496
496
|
return [d, d];
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function vt(r) {
|
|
499
499
|
return r * (Math.PI / 180);
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function le(r) {
|
|
502
502
|
return r * (180 / Math.PI);
|
|
503
503
|
}
|
|
504
|
-
class
|
|
504
|
+
class pi extends W {
|
|
505
505
|
constructor(t) {
|
|
506
506
|
super(t), this.config = void 0, this.config = t;
|
|
507
507
|
}
|
|
@@ -514,7 +514,7 @@ class hi extends W {
|
|
|
514
514
|
Number.isInteger(n) || (n = Math.floor(n) + 1);
|
|
515
515
|
const a = [];
|
|
516
516
|
for (let d = 0; d < n; d++) {
|
|
517
|
-
const c =
|
|
517
|
+
const c = ui(o, i * d, i * (d + 1));
|
|
518
518
|
a.push(c);
|
|
519
519
|
}
|
|
520
520
|
const l = [];
|
|
@@ -523,7 +523,7 @@ class hi extends W {
|
|
|
523
523
|
}
|
|
524
524
|
generateInsertionGeodesicCoordinates(t, e, i) {
|
|
525
525
|
const o = R(t, e), s = (function(n, a, l) {
|
|
526
|
-
const d = [], c =
|
|
526
|
+
const d = [], c = vt(n[1]), h = vt(n[0]), u = vt(a[1]), p = vt(a[0]);
|
|
527
527
|
l += 1;
|
|
528
528
|
const g = 2 * Math.asin(Math.sqrt(Math.sin((u - c) / 2) ** 2 + Math.cos(c) * Math.cos(u) * Math.sin((p - h) / 2) ** 2));
|
|
529
529
|
if (g === 0 || isNaN(g)) return d;
|
|
@@ -531,7 +531,7 @@ class hi extends W {
|
|
|
531
531
|
const m = y / l, v = Math.sin((1 - m) * g) / Math.sin(g), C = Math.sin(m * g) / Math.sin(g), f = v * Math.cos(c) * Math.cos(h) + C * Math.cos(u) * Math.cos(p), P = v * Math.cos(c) * Math.sin(h) + C * Math.cos(u) * Math.sin(p), S = v * Math.sin(c) + C * Math.sin(u);
|
|
532
532
|
if (isNaN(f) || isNaN(P) || isNaN(S)) continue;
|
|
533
533
|
const E = Math.atan2(S, Math.sqrt(f ** 2 + P ** 2)), O = Math.atan2(P, f);
|
|
534
|
-
isNaN(E) || isNaN(O) || d.push([
|
|
534
|
+
isNaN(E) || isNaN(O) || d.push([le(O), le(E)]);
|
|
535
535
|
}
|
|
536
536
|
return d.slice(1, -1);
|
|
537
537
|
})(t, e, Math.floor(o / i));
|
|
@@ -544,26 +544,26 @@ class hi extends W {
|
|
|
544
544
|
function it(r, t) {
|
|
545
545
|
return r[0] === t[0] && r[1] === t[1];
|
|
546
546
|
}
|
|
547
|
-
function
|
|
547
|
+
function Ut(r, t) {
|
|
548
548
|
if (r.geometry.type !== "LineString") return { valid: !1, reason: "Feature is not a LineString" };
|
|
549
549
|
if (r.geometry.coordinates.length < 2) return { valid: !1, reason: "Feature has less than 2 coordinates" };
|
|
550
550
|
for (let e = 0; e < r.geometry.coordinates.length; e++) {
|
|
551
|
-
if (!
|
|
552
|
-
if (!
|
|
551
|
+
if (!At(r.geometry.coordinates[e])) return { valid: !1, reason: "Feature has invalid coordinates" };
|
|
552
|
+
if (!Ot(r.geometry.coordinates[e], t)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
|
|
553
553
|
}
|
|
554
554
|
return { valid: !0 };
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function de(r) {
|
|
557
557
|
return Math.sqrt(Math.pow(r[0], 2) + Math.pow(r[1], 2) + Math.pow(r[2], 2));
|
|
558
558
|
}
|
|
559
559
|
function X(r, t) {
|
|
560
560
|
const e = (function(i, o) {
|
|
561
561
|
const [s, n, a] = i, [l, d, c] = o;
|
|
562
562
|
return s * l + n * d + a * c;
|
|
563
|
-
})(r, t) / (
|
|
563
|
+
})(r, t) / (de(r) * de(t));
|
|
564
564
|
return Math.acos(Math.min(Math.max(e, -1), 1));
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function Mt(r) {
|
|
567
567
|
const t = M(r[1]), e = M(r[0]);
|
|
568
568
|
return [Math.cos(t) * Math.cos(e), Math.cos(t) * Math.sin(e), Math.sin(t)];
|
|
569
569
|
}
|
|
@@ -571,19 +571,19 @@ function Y(r) {
|
|
|
571
571
|
const [t, e, i] = r, o = $(Math.asin(i));
|
|
572
572
|
return [$(Math.atan2(e, t)), o];
|
|
573
573
|
}
|
|
574
|
-
function
|
|
575
|
-
const i =
|
|
576
|
-
const [
|
|
577
|
-
return [
|
|
574
|
+
function gi(r, t, e) {
|
|
575
|
+
const i = Mt(r), o = Mt(t), s = Mt(e), [n, a, l] = s, [d, c, h] = (function(B, K) {
|
|
576
|
+
const [Yt, Ht, Jt] = B, [qt, Zt, Qt] = K;
|
|
577
|
+
return [Ht * Qt - Jt * Zt, Jt * qt - Yt * Qt, Yt * Zt - Ht * qt];
|
|
578
578
|
})(i, o), u = c * l - h * a, p = h * n - d * l, g = d * a - c * n, y = g * c - p * h, m = u * h - g * d, v = p * d - u * c, C = 1 / Math.sqrt(Math.pow(y, 2) + Math.pow(m, 2) + Math.pow(v, 2)), f = [y * C, m * C, v * C], P = [-1 * y * C, -1 * m * C, -1 * v * C], S = X(i, o), E = X(i, f), O = X(o, f), F = X(i, P), N = X(o, P);
|
|
579
579
|
let _;
|
|
580
580
|
return _ = E < F && E < N || O < F && O < N ? f : P, X(i, _) > S || X(o, _) > S ? R(Y(_), Y(i)) <= R(Y(_), Y(o)) ? [Y(i), !0, !1] : [Y(o), !1, !0] : [Y(_), !1, !1];
|
|
581
581
|
}
|
|
582
|
-
function
|
|
582
|
+
function yi(r, t, e) {
|
|
583
583
|
const i = t.x - r.x, o = t.y - r.y, s = Math.max(0, Math.min(1, ((e.x - r.x) * i + (e.y - r.y) * o) / (i * i + o * o)));
|
|
584
584
|
return { x: r.x + s * i, y: r.y + s * o };
|
|
585
585
|
}
|
|
586
|
-
class
|
|
586
|
+
class Rt extends W {
|
|
587
587
|
constructor(t, e, i) {
|
|
588
588
|
super(t), this.config = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.getSnappableCoordinateFirstClick = (o) => {
|
|
589
589
|
const s = this.getSnappable(o, (n) => !!(n.properties && n.properties.mode === this.mode));
|
|
@@ -615,7 +615,7 @@ class At extends W {
|
|
|
615
615
|
if (C[0] === u[0] && C[1] === u[1]) P = C;
|
|
616
616
|
else if (f[0] === u[0] && f[1] === u[1]) P = f;
|
|
617
617
|
else {
|
|
618
|
-
const { x: N, y: _ } =
|
|
618
|
+
const { x: N, y: _ } = yi(E, O, F), { lng: B, lat: K } = A(N, _);
|
|
619
619
|
P = [B, K];
|
|
620
620
|
}
|
|
621
621
|
P && (S = L(F, I(P[0], P[1])), S < y && (g = P, y = S, m = p.indexOf(v)));
|
|
@@ -626,7 +626,7 @@ class At extends W {
|
|
|
626
626
|
for (let v of p) {
|
|
627
627
|
const C = v[0], f = v[1];
|
|
628
628
|
let P, S = 1 / 0;
|
|
629
|
-
C[0] === u[0] && C[1] === u[1] ? P = C : f[0] === u[0] && f[1] === u[1] ? P = f : [P] =
|
|
629
|
+
C[0] === u[0] && C[1] === u[1] ? P = C : f[0] === u[0] && f[1] === u[1] ? P = f : [P] = gi(C, f, u), P && (S = R(u, P), S < y && (g = P, y = S, m = p.indexOf(v)));
|
|
630
630
|
}
|
|
631
631
|
return y === 1 / 0 ? void 0 : { coordinate: g, distance: y, lineIndex: m };
|
|
632
632
|
})(c, l)), !d) return;
|
|
@@ -635,10 +635,10 @@ class At extends W {
|
|
|
635
635
|
}), s;
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
|
-
const
|
|
639
|
-
class
|
|
638
|
+
const fi = { cancel: "Escape", finish: "Enter" }, mi = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
|
|
639
|
+
class zt extends G {
|
|
640
640
|
constructor(t) {
|
|
641
|
-
super(t, !0), this.mode = "linestring", this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.keyEvents =
|
|
641
|
+
super(t, !0), this.mode = "linestring", this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.keyEvents = fi, this.snapping = void 0, this.cursors = mi, this.mouseMove = !1, this.insertCoordinates = void 0, this.lastCommittedCoordinates = void 0, this.snappedPointId = void 0, this.lastMouseMoveEvent = void 0, this.editable = !1, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0, this.editedInsertIndex = void 0, this.editedPointId = void 0, this.coordinateSnapping = void 0, this.insertPoint = void 0, this.lineSnapping = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.updateOptions(t);
|
|
642
642
|
}
|
|
643
643
|
updateOptions(t) {
|
|
644
644
|
super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t != null && t.snapping && (this.snapping = t.snapping), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.insertCoordinates && (this.insertCoordinates = t.insertCoordinates), t && t.editable && (this.editable = t.editable);
|
|
@@ -648,7 +648,7 @@ class Ut extends G {
|
|
|
648
648
|
if (e) {
|
|
649
649
|
if (this.snappedPointId) this.store.updateGeometry([{ id: this.snappedPointId, geometry: { type: "Point", coordinates: e } }]);
|
|
650
650
|
else {
|
|
651
|
-
const [i] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [
|
|
651
|
+
const [i] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [xt]: !0 } }]);
|
|
652
652
|
this.snappedPointId = i;
|
|
653
653
|
}
|
|
654
654
|
t.lng = e[0], t.lat = e[1];
|
|
@@ -696,7 +696,7 @@ class Ut extends G {
|
|
|
696
696
|
this.updateGeometries(l, i[i.length - 1], b.Commit), this.currentCoordinate++;
|
|
697
697
|
}
|
|
698
698
|
registerBehaviors(t) {
|
|
699
|
-
this.coordinateSnapping = new
|
|
699
|
+
this.coordinateSnapping = new Et(t, new pt(t), new ut(t)), this.insertPoint = new pi(t), this.clickBoundingBox = new ut(t), this.pixelDistance = new pt(t), this.lineSnapping = new Rt(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new Et(t, this.pixelDistance, this.clickBoundingBox);
|
|
700
700
|
}
|
|
701
701
|
start() {
|
|
702
702
|
this.setStarted(), this.setCursor(this.cursors.start);
|
|
@@ -792,7 +792,7 @@ class Ut extends G {
|
|
|
792
792
|
return e;
|
|
793
793
|
}
|
|
794
794
|
validateFeature(t) {
|
|
795
|
-
return this.validateModeFeature(t, (e) =>
|
|
795
|
+
return this.validateModeFeature(t, (e) => Ut(e, this.coordinatePrecision));
|
|
796
796
|
}
|
|
797
797
|
lineStringFilter(t) {
|
|
798
798
|
return !!(t.geometry.type === "LineString" && t.properties && t.properties.mode === this.mode);
|
|
@@ -810,14 +810,14 @@ class Ut extends G {
|
|
|
810
810
|
this.editedFeatureId === t.id && this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0), this.snappedPointId && this.lastMouseMoveEvent && this.updateSnappedCoordinate(this.lastMouseMoveEvent), this.currentId === t.id && (this.closingPointId && (this.store.delete([this.closingPointId]), this.closingPointId = void 0), this.currentCoordinate = 0, this.currentId = void 0, this.state === "drawing" && this.setStarted());
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
|
-
const
|
|
814
|
-
function
|
|
815
|
-
return r.geometry.type !== "Point" ? { valid: !1, reason:
|
|
813
|
+
const vi = "Feature is not a Point", Ci = "Feature has invalid coordinates", Pi = "Feature has coordinates with excessive precision";
|
|
814
|
+
function Me(r, t) {
|
|
815
|
+
return r.geometry.type !== "Point" ? { valid: !1, reason: vi } : At(r.geometry.coordinates) ? Ot(r.geometry.coordinates, t) ? { valid: !0 } : { valid: !1, reason: Pi } : { valid: !1, reason: Ci };
|
|
816
816
|
}
|
|
817
|
-
const
|
|
818
|
-
class
|
|
817
|
+
const Si = { create: "crosshair", dragStart: "grabbing", dragEnd: "crosshair" };
|
|
818
|
+
class Vt extends G {
|
|
819
819
|
constructor(t) {
|
|
820
|
-
super(t, !0), this.mode = "point", this.cursors =
|
|
820
|
+
super(t, !0), this.mode = "point", this.cursors = Si, this.editable = !1, this.editedFeatureId = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.updateOptions(t);
|
|
821
821
|
}
|
|
822
822
|
updateOptions(t) {
|
|
823
823
|
super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t != null && t.editable && (this.editable = t.editable);
|
|
@@ -856,7 +856,7 @@ class Rt extends G {
|
|
|
856
856
|
this.allowPointerEvent(this.pointerEvents.onDragEnd, t) && this.editedFeatureId !== void 0 && (this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.setCursor(this.cursors.dragEnd), this.store.updateProperty([{ id: this.editedFeatureId, property: z, value: !1 }]), this.editedFeatureId = void 0, e(!0));
|
|
857
857
|
}
|
|
858
858
|
registerBehaviors(t) {
|
|
859
|
-
this.pixelDistance = new
|
|
859
|
+
this.pixelDistance = new pt(t), this.clickBoundingBox = new ut(t);
|
|
860
860
|
}
|
|
861
861
|
styleFeature(t) {
|
|
862
862
|
const e = x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
|
|
@@ -867,7 +867,7 @@ class Rt extends G {
|
|
|
867
867
|
return e;
|
|
868
868
|
}
|
|
869
869
|
validateFeature(t) {
|
|
870
|
-
return this.validateModeFeature(t, (e) =>
|
|
870
|
+
return this.validateModeFeature(t, (e) => Me(e, this.coordinatePrecision));
|
|
871
871
|
}
|
|
872
872
|
onLeftClick(t) {
|
|
873
873
|
const e = { type: "Point", coordinates: [t.lng, t.lat] }, i = { mode: this.mode };
|
|
@@ -895,7 +895,7 @@ class Rt extends G {
|
|
|
895
895
|
this.editedFeatureId === t.id && (this.editedFeatureId = void 0, this.setCursor(this.cursors.create));
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
|
-
class
|
|
898
|
+
class xi extends W {
|
|
899
899
|
constructor(t, e) {
|
|
900
900
|
super(t), this.config = void 0, this.pixelDistance = void 0, this._startEndPoints = [], this.config = t, this.pixelDistance = e;
|
|
901
901
|
}
|
|
@@ -921,7 +921,7 @@ class Pi extends W {
|
|
|
921
921
|
return { isClosing: o < this.pointerDistance, isPreviousClosing: s < this.pointerDistance };
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
|
-
class
|
|
924
|
+
class De extends W {
|
|
925
925
|
constructor(t) {
|
|
926
926
|
super(t);
|
|
927
927
|
}
|
|
@@ -962,10 +962,10 @@ class Fe extends W {
|
|
|
962
962
|
if (i.coordinatePointIds) return i.coordinatePointIds.map((o, s) => ({ id: o, geometry: x({}, this.store.getGeometryCopy(o), { coordinates: e[s] }) }));
|
|
963
963
|
}
|
|
964
964
|
createPoints(t, e, i) {
|
|
965
|
-
return this.store.create(t.map((o, s) => ({ geometry: { type: "Point", coordinates: o }, properties: { mode: e, [
|
|
965
|
+
return this.store.create(t.map((o, s) => ({ geometry: { type: "Point", coordinates: o }, properties: { mode: e, [It]: !0, [Qe]: i, index: s } })));
|
|
966
966
|
}
|
|
967
967
|
setFeatureCoordinatePoints(t, e) {
|
|
968
|
-
this.store.updateProperty([{ id: t, property:
|
|
968
|
+
this.store.updateProperty([{ id: t, property: ht, value: e }]);
|
|
969
969
|
}
|
|
970
970
|
deleteCoordinatePoints(t) {
|
|
971
971
|
const e = t.filter((i) => this.store.has(i));
|
|
@@ -976,10 +976,10 @@ class Fe extends W {
|
|
|
976
976
|
e && (this.deleteCoordinatePoints(e), this.setFeatureCoordinatePoints(t, null));
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
|
-
const
|
|
980
|
-
class
|
|
979
|
+
const Ii = { cancel: "Escape", finish: "Enter" }, bi = { start: "crosshair", close: "pointer", dragStart: "grabbing", dragEnd: "crosshair" };
|
|
980
|
+
class _e extends G {
|
|
981
981
|
constructor(t) {
|
|
982
|
-
super(t, !0), this.mode = "polygon", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents =
|
|
982
|
+
super(t, !0), this.mode = "polygon", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Ii, this.cursors = bi, this.mouseMove = !1, this.showCoordinatePoints = !1, this.lastMouseMoveEvent = void 0, this.snapping = void 0, this.snappedPointId = void 0, this.editable = !1, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0, this.editedInsertIndex = void 0, this.editedPointId = void 0, this.coordinatePoints = void 0, this.lineSnapping = void 0, this.coordinateSnapping = void 0, this.pixelDistance = void 0, this.closingPoints = void 0, this.clickBoundingBox = void 0, this.updateOptions(t);
|
|
983
983
|
}
|
|
984
984
|
updateOptions(t) {
|
|
985
985
|
if (super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.snapping && (this.snapping = t.snapping), t?.editable !== void 0 && (this.editable = t.editable), t?.pointerEvents !== void 0 && (this.pointerEvents = t.pointerEvents), t?.showCoordinatePoints !== void 0) {
|
|
@@ -987,7 +987,7 @@ class Me extends G {
|
|
|
987
987
|
this.coordinatePoints.createOrUpdate(e);
|
|
988
988
|
});
|
|
989
989
|
else if (this.coordinatePoints && this.showCoordinatePoints === !1) {
|
|
990
|
-
const e = this.store.copyAllWhere((i) => i.mode === this.mode && !!i[
|
|
990
|
+
const e = this.store.copyAllWhere((i) => i.mode === this.mode && !!i[ht]);
|
|
991
991
|
this.coordinatePoints.deletePointsByFeatureIds(e.map((i) => i.id));
|
|
992
992
|
}
|
|
993
993
|
}
|
|
@@ -998,13 +998,13 @@ class Me extends G {
|
|
|
998
998
|
if (t.length < 5 || !this.updatePolygonGeometry([...t.slice(0, -2), t[0]], b.Finish)) return;
|
|
999
999
|
const e = this.currentId;
|
|
1000
1000
|
if (this.currentId) {
|
|
1001
|
-
const i =
|
|
1001
|
+
const i = ft(this.store.getGeometryCopy(this.currentId));
|
|
1002
1002
|
i && this.store.updateGeometry([{ id: this.currentId, geometry: i }]), this.store.updateProperty([{ id: this.currentId, property: D, value: void 0 }]);
|
|
1003
1003
|
}
|
|
1004
1004
|
this.snappedPointId && this.store.delete([this.snappedPointId]), this.currentCoordinate = 0, this.currentId = void 0, this.snappedPointId = void 0, this.closingPoints.delete(), this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
|
|
1005
1005
|
}
|
|
1006
1006
|
registerBehaviors(t) {
|
|
1007
|
-
this.clickBoundingBox = new
|
|
1007
|
+
this.clickBoundingBox = new ut(t), this.pixelDistance = new pt(t), this.lineSnapping = new Rt(t, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new Et(t, this.pixelDistance, this.clickBoundingBox), this.closingPoints = new xi(t, this.pixelDistance), this.coordinatePoints = new De(t);
|
|
1008
1008
|
}
|
|
1009
1009
|
start() {
|
|
1010
1010
|
this.setStarted(), this.setCursor(this.cursors.start);
|
|
@@ -1017,7 +1017,7 @@ class Me extends G {
|
|
|
1017
1017
|
if (e) {
|
|
1018
1018
|
if (this.snappedPointId) this.store.updateGeometry([{ id: this.snappedPointId, geometry: { type: "Point", coordinates: e } }]);
|
|
1019
1019
|
else {
|
|
1020
|
-
const [i] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [
|
|
1020
|
+
const [i] = this.store.create([{ geometry: { type: "Point", coordinates: e }, properties: { mode: this.mode, [xt]: !0 } }]);
|
|
1021
1021
|
this.snappedPointId = i;
|
|
1022
1022
|
}
|
|
1023
1023
|
t.lng = e[0], t.lat = e[1];
|
|
@@ -1146,7 +1146,7 @@ class Me extends G {
|
|
|
1146
1146
|
if (t.properties.mode === this.mode) {
|
|
1147
1147
|
if (t.geometry.type === "Polygon") return e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = T, e;
|
|
1148
1148
|
if (t.geometry.type === "Point") {
|
|
1149
|
-
const i = t.properties[z], o = t.properties[
|
|
1149
|
+
const i = t.properties[z], o = t.properties[It], s = i ? "editedPoint" : t.properties[J] ? "closingPoint" : t.properties[xt] ? "snappingPoint" : o ? "coordinatePoint" : void 0;
|
|
1150
1150
|
if (!s) return e;
|
|
1151
1151
|
const n = { editedPoint: { width: this.styles.editedPointOutlineWidth, color: this.styles.editedPointColor, outlineColor: this.styles.editedPointOutlineColor, outlineWidth: this.styles.editedPointOutlineWidth }, closingPoint: { width: this.styles.closingPointWidth, color: this.styles.closingPointColor, outlineColor: this.styles.closingPointOutlineColor, outlineWidth: this.styles.closingPointOutlineWidth }, snappingPoint: { width: this.styles.snappingPointWidth, color: this.styles.snappingPointColor, outlineColor: this.styles.snappingPointOutlineColor, outlineWidth: this.styles.snappingPointOutlineWidth }, coordinatePoint: { width: this.styles.coordinatePointWidth, color: this.styles.coordinatePointColor, outlineColor: this.styles.coordinatePointOutlineColor, outlineWidth: this.styles.coordinatePointOutlineWidth } };
|
|
1152
1152
|
return e.pointWidth = this.getNumericStylingValue(n[s].width, e.pointWidth, t), e.pointColor = this.getHexColorStylingValue(n[s].color, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(n[s].outlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(n[s].outlineWidth, 2, t), e.zIndex = i ? 40 : o ? 20 : 30, e;
|
|
@@ -1161,13 +1161,13 @@ class Me extends G {
|
|
|
1161
1161
|
this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(t.id), this.editedFeatureId === t.id && this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0, this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedSnapType = void 0), this.snappedPointId && this.lastMouseMoveEvent && this.updateSnappedCoordinate(this.lastMouseMoveEvent), this.currentId === t.id && (this.currentCoordinate = 0, this.currentId = void 0, this.closingPoints.delete(), this.state === "drawing" && this.setStarted());
|
|
1162
1162
|
}
|
|
1163
1163
|
validateFeature(t) {
|
|
1164
|
-
return this.validateModeFeature(t, (e) =>
|
|
1164
|
+
return this.validateModeFeature(t, (e) => Lt(e, this.coordinatePrecision));
|
|
1165
1165
|
}
|
|
1166
1166
|
}
|
|
1167
|
-
const
|
|
1168
|
-
class
|
|
1167
|
+
const Ei = { cancel: "Escape", finish: "Enter" }, wi = { start: "crosshair" };
|
|
1168
|
+
class ke extends G {
|
|
1169
1169
|
constructor(t) {
|
|
1170
|
-
super(t, !0), this.mode = "rectangle", this.center = void 0, this.clickCount = 0, this.currentRectangleId = void 0, this.keyEvents =
|
|
1170
|
+
super(t, !0), this.mode = "rectangle", this.center = void 0, this.clickCount = 0, this.currentRectangleId = void 0, this.keyEvents = Ei, this.cursors = wi, this.updateOptions(t);
|
|
1171
1171
|
}
|
|
1172
1172
|
updateOptions(t) {
|
|
1173
1173
|
super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents));
|
|
@@ -1182,7 +1182,7 @@ class De extends G {
|
|
|
1182
1182
|
close() {
|
|
1183
1183
|
const t = this.currentRectangleId;
|
|
1184
1184
|
if (t) {
|
|
1185
|
-
const e =
|
|
1185
|
+
const e = ft(this.store.getGeometryCopy(t));
|
|
1186
1186
|
e && this.store.updateGeometry([{ id: t, geometry: e }]), this.store.updateProperty([{ id: t, property: D, value: void 0 }]);
|
|
1187
1187
|
}
|
|
1188
1188
|
this.center = void 0, this.currentRectangleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted(), t !== void 0 && this.onFinish(t, { mode: this.mode, action: "draw" });
|
|
@@ -1223,7 +1223,7 @@ class De extends G {
|
|
|
1223
1223
|
return t.type === "Feature" && t.geometry.type === "Polygon" && t.properties.mode === this.mode && (e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = T), e;
|
|
1224
1224
|
}
|
|
1225
1225
|
validateFeature(t) {
|
|
1226
|
-
return this.validateModeFeature(t, (e) =>
|
|
1226
|
+
return this.validateModeFeature(t, (e) => yt(e, this.coordinatePrecision));
|
|
1227
1227
|
}
|
|
1228
1228
|
afterFeatureUpdated(t) {
|
|
1229
1229
|
this.currentRectangleId === t.id && (this.center = void 0, this.currentRectangleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted());
|
|
@@ -1268,50 +1268,50 @@ class et extends G {
|
|
|
1268
1268
|
validateFeature(t) {
|
|
1269
1269
|
const e = super.validateFeature(t);
|
|
1270
1270
|
if (e.valid) {
|
|
1271
|
-
const i = t, o =
|
|
1271
|
+
const i = t, o = Me(i, this.coordinatePrecision).valid || Lt(i, this.coordinatePrecision).valid || Ut(i, this.coordinatePrecision).valid;
|
|
1272
1272
|
return o ? { valid: !0 } : { valid: o, reason: "Feature is not a valid Point, Polygon or LineString feature" };
|
|
1273
1273
|
}
|
|
1274
1274
|
return e;
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
|
-
function
|
|
1277
|
+
function Bt(r, t) {
|
|
1278
1278
|
const e = r, i = t, o = M(e[1]), s = M(i[1]);
|
|
1279
1279
|
let n = M(i[0] - e[0]);
|
|
1280
1280
|
n > Math.PI && (n -= 2 * Math.PI), n < -Math.PI && (n += 2 * Math.PI);
|
|
1281
1281
|
const a = Math.log(Math.tan(s / 2 + Math.PI / 4) / Math.tan(o / 2 + Math.PI / 4)), l = ($(Math.atan2(n, a)) + 360) % 360;
|
|
1282
1282
|
return l > 180 ? -(360 - l) : l;
|
|
1283
1283
|
}
|
|
1284
|
-
function
|
|
1284
|
+
function Ne(r, t, e) {
|
|
1285
1285
|
let i = t;
|
|
1286
1286
|
t < 0 && (i = -Math.abs(i));
|
|
1287
|
-
const o = i /
|
|
1287
|
+
const o = i / Ee, s = r[0] * Math.PI / 180, n = M(r[1]), a = M(e), l = o * Math.cos(a);
|
|
1288
1288
|
let d = n + l;
|
|
1289
1289
|
Math.abs(d) > Math.PI / 2 && (d = d > 0 ? Math.PI - d : -Math.PI - d);
|
|
1290
1290
|
const c = Math.log(Math.tan(d / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4)), h = Math.abs(c) > 1e-11 ? l / c : Math.cos(n), u = [(180 * (s + o * Math.sin(a) / h) / Math.PI + 540) % 360 - 180, 180 * d / Math.PI];
|
|
1291
1291
|
return u[0] += u[0] - r[0] > 180 ? -360 : r[0] - u[0] > 180 ? 360 : 0, u;
|
|
1292
1292
|
}
|
|
1293
|
-
function
|
|
1293
|
+
function Be(r, t, e, i, o) {
|
|
1294
1294
|
const s = i(r[0], r[1]), n = i(t[0], t[1]), { lng: a, lat: l } = o((s.x + n.x) / 2, (s.y + n.y) / 2);
|
|
1295
1295
|
return [w(a, e), w(l, e)];
|
|
1296
1296
|
}
|
|
1297
|
-
function
|
|
1298
|
-
const i =
|
|
1297
|
+
function Oi(r, t, e) {
|
|
1298
|
+
const i = Ne(r, 1e3 * R(r, t) / 2, Bt(r, t));
|
|
1299
1299
|
return [w(i[0], e), w(i[1], e)];
|
|
1300
1300
|
}
|
|
1301
|
-
function
|
|
1301
|
+
function ce({ featureCoords: r, precision: t, unproject: e, project: i, projection: o }) {
|
|
1302
1302
|
const s = [];
|
|
1303
1303
|
for (let n = 0; n < r.length - 1; n++) {
|
|
1304
1304
|
let a;
|
|
1305
|
-
if (o === "web-mercator") a =
|
|
1305
|
+
if (o === "web-mercator") a = Be(r[n], r[n + 1], t, i, e);
|
|
1306
1306
|
else {
|
|
1307
1307
|
if (o !== "globe") throw new Error("Invalid projection");
|
|
1308
|
-
a =
|
|
1308
|
+
a = Oi(r[n], r[n + 1], t);
|
|
1309
1309
|
}
|
|
1310
1310
|
s.push(a);
|
|
1311
1311
|
}
|
|
1312
1312
|
return s;
|
|
1313
1313
|
}
|
|
1314
|
-
class
|
|
1314
|
+
class Li extends W {
|
|
1315
1315
|
constructor(t, e, i) {
|
|
1316
1316
|
super(t), this.config = void 0, this.selectionPointBehavior = void 0, this.coordinatePointBehavior = void 0, this._midPoints = [], this.config = t, this.selectionPointBehavior = e, this.coordinatePointBehavior = i;
|
|
1317
1317
|
}
|
|
@@ -1322,22 +1322,22 @@ class wi extends W {
|
|
|
1322
1322
|
}
|
|
1323
1323
|
insert(t, e, i) {
|
|
1324
1324
|
const o = this.store.getGeometryCopy(e), { midPointFeatureId: s, midPointSegment: n } = this.store.getPropertiesCopy(e), a = this.store.getGeometryCopy(s), l = a.type === "Polygon" ? a.coordinates[0] : a.coordinates;
|
|
1325
|
-
l.splice(n + 1, 0, o.coordinates), a.coordinates = a.type === "Polygon" ? [l] : l, this.store.updateGeometry([{ id: s, geometry: a }]), this.store.getPropertiesCopy(t)[
|
|
1325
|
+
l.splice(n + 1, 0, o.coordinates), a.coordinates = a.type === "Polygon" ? [l] : l, this.store.updateGeometry([{ id: s, geometry: a }]), this.store.getPropertiesCopy(t)[ht] && this.coordinatePointBehavior.createOrUpdate(t), this.store.delete([...this._midPoints, ...this.selectionPointBehavior.ids]), this.create(l, s, i), this.selectionPointBehavior.create(l, a.type, s);
|
|
1326
1326
|
}
|
|
1327
1327
|
create(t, e, i) {
|
|
1328
1328
|
if (!this.store.has(e)) throw new Error("Store does not have feature with this id");
|
|
1329
1329
|
this._midPoints = this.store.create((function(o, s, n, a, l, d) {
|
|
1330
|
-
return
|
|
1330
|
+
return ce({ featureCoords: o, precision: n, project: a, unproject: l, projection: d }).map((c, h) => ({ geometry: { type: "Point", coordinates: c }, properties: s(h) }));
|
|
1331
1331
|
})(t, (o) => ({ mode: this.mode, [k.MID_POINT]: !0, midPointSegment: o, midPointFeatureId: e }), i, this.config.project, this.config.unproject, this.projection));
|
|
1332
1332
|
}
|
|
1333
1333
|
delete() {
|
|
1334
1334
|
this._midPoints.length && (this.store.delete(this._midPoints), this._midPoints = []);
|
|
1335
1335
|
}
|
|
1336
1336
|
getUpdated(t) {
|
|
1337
|
-
if (this._midPoints.length !== 0) return
|
|
1337
|
+
if (this._midPoints.length !== 0) return ce({ featureCoords: t, precision: this.coordinatePrecision, project: this.config.project, unproject: this.config.unproject, projection: this.config.projection }).map((e, i) => ({ id: this._midPoints[i], geometry: { type: "Point", coordinates: e } }));
|
|
1338
1338
|
}
|
|
1339
1339
|
}
|
|
1340
|
-
class
|
|
1340
|
+
class Fi extends W {
|
|
1341
1341
|
constructor(t) {
|
|
1342
1342
|
super(t), this._selectionPoints = [];
|
|
1343
1343
|
}
|
|
@@ -1363,7 +1363,7 @@ class Oi extends W {
|
|
|
1363
1363
|
if (this._selectionPoints[t] !== void 0) return { id: this._selectionPoints[t], geometry: { type: "Point", coordinates: e } };
|
|
1364
1364
|
}
|
|
1365
1365
|
}
|
|
1366
|
-
function
|
|
1366
|
+
function je(r, t) {
|
|
1367
1367
|
let e = !1;
|
|
1368
1368
|
for (let n = 0, a = t.length; n < a; n++) {
|
|
1369
1369
|
const l = t[n];
|
|
@@ -1372,7 +1372,7 @@ function Ne(r, t) {
|
|
|
1372
1372
|
var i, o, s;
|
|
1373
1373
|
return e;
|
|
1374
1374
|
}
|
|
1375
|
-
const
|
|
1375
|
+
const jt = (r, t, e) => {
|
|
1376
1376
|
const i = (s) => s * s, o = (s, n) => i(s.x - n.x) + i(s.y - n.y);
|
|
1377
1377
|
return Math.sqrt(((s, n, a) => {
|
|
1378
1378
|
const l = o(n, a);
|
|
@@ -1381,7 +1381,7 @@ const Nt = (r, t, e) => {
|
|
|
1381
1381
|
return d = Math.max(0, Math.min(1, d)), o(s, { x: n.x + d * (a.x - n.x), y: n.y + d * (a.y - n.y) });
|
|
1382
1382
|
})(r, t, e));
|
|
1383
1383
|
};
|
|
1384
|
-
class
|
|
1384
|
+
class Mi extends W {
|
|
1385
1385
|
constructor(t, e, i) {
|
|
1386
1386
|
super(t), this.config = void 0, this.createClickBoundingBox = void 0, this.pixelDistance = void 0, this.config = t, this.createClickBoundingBox = e, this.pixelDistance = i;
|
|
1387
1387
|
}
|
|
@@ -1397,18 +1397,18 @@ class Li extends W {
|
|
|
1397
1397
|
} else if (g.type === "LineString") {
|
|
1398
1398
|
if (i) continue;
|
|
1399
1399
|
for (let y = 0; y < g.coordinates.length - 1; y++) {
|
|
1400
|
-
const m = g.coordinates[y], v = g.coordinates[y + 1], C =
|
|
1400
|
+
const m = g.coordinates[y], v = g.coordinates[y + 1], C = jt({ x: t.containerX, y: t.containerY }, this.project(m[0], m[1]), this.project(v[0], v[1]));
|
|
1401
1401
|
C < this.pointerDistance && C < l && (l = C, o = p);
|
|
1402
1402
|
}
|
|
1403
1403
|
} else if (g.type === "Polygon") {
|
|
1404
1404
|
if (i || o) continue;
|
|
1405
|
-
|
|
1405
|
+
je([t.lng, t.lat], g.coordinates) && (n = p);
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
1408
|
return { clickedFeature: i || o || n, clickedMidPoint: s };
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
|
-
class
|
|
1411
|
+
class Di extends W {
|
|
1412
1412
|
constructor(t, e, i, o, s) {
|
|
1413
1413
|
super(t), this.config = void 0, this.featuresAtCursorEvent = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinatePoints = void 0, this.draggedFeatureId = null, this.dragPosition = void 0, this.config = t, this.featuresAtCursorEvent = e, this.selectionPoints = i, this.midPoints = o, this.coordinatePoints = s;
|
|
1414
1414
|
}
|
|
@@ -1451,7 +1451,7 @@ class Fi extends W {
|
|
|
1451
1451
|
} else i.type === "Point" && (this.store.updateGeometry([{ id: this.draggedFeatureId, geometry: { type: "Point", coordinates: o } }]), this.dragPosition = [t.lng, t.lat]);
|
|
1452
1452
|
}
|
|
1453
1453
|
}
|
|
1454
|
-
class
|
|
1454
|
+
class _i extends W {
|
|
1455
1455
|
constructor(t, e, i, o, s, n, a) {
|
|
1456
1456
|
super(t), this.config = void 0, this.pixelDistance = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinatePoints = void 0, this.coordinateSnapping = void 0, this.lineSnapping = void 0, this.draggedCoordinate = { id: null, index: -1 }, this.config = t, this.pixelDistance = e, this.selectionPoints = i, this.midPoints = o, this.coordinatePoints = s, this.coordinateSnapping = n, this.lineSnapping = a;
|
|
1457
1457
|
}
|
|
@@ -1503,7 +1503,7 @@ class Mi extends W {
|
|
|
1503
1503
|
d[0] = u, d[v] = u;
|
|
1504
1504
|
} else d[n] = u;
|
|
1505
1505
|
const p = this.selectionPoints.getOneUpdated(n, u), g = p ? [p] : [], y = this.midPoints.getUpdated(d) || [], m = this.coordinatePoints.getUpdated(s, d) || [];
|
|
1506
|
-
return !(a.type !== "Point" && !e &&
|
|
1506
|
+
return !(a.type !== "Point" && !e && Gt({ geometry: a }) || i && !i(h, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional }).valid || (this.store.updateGeometry([{ id: s, geometry: a }, ...g, ...y, ...m]), 0));
|
|
1507
1507
|
}
|
|
1508
1508
|
isDragging() {
|
|
1509
1509
|
return this.draggedCoordinate.id !== null;
|
|
@@ -1515,20 +1515,20 @@ class Mi extends W {
|
|
|
1515
1515
|
this.draggedCoordinate = { id: null, index: -1 };
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
|
-
function
|
|
1518
|
+
function he(r) {
|
|
1519
1519
|
let t = 0, e = 0, i = 0;
|
|
1520
1520
|
return (r.geometry.type === "Polygon" ? r.geometry.coordinates[0].slice(0, -1) : r.geometry.coordinates).forEach((o) => {
|
|
1521
1521
|
t += o[0], e += o[1], i++;
|
|
1522
1522
|
}, !0), [t / i, e / i];
|
|
1523
1523
|
}
|
|
1524
|
-
const
|
|
1524
|
+
const We = (r, t) => {
|
|
1525
1525
|
if (t === 0 || t === 360 || t === -360) return r;
|
|
1526
1526
|
const e = 0.017453292519943295 * t, i = (r.geometry.type === "Polygon" ? r.geometry.coordinates[0] : r.geometry.coordinates).map(([n, a]) => I(n, a)), o = i.reduce((n, a) => ({ x: n.x + a.x, y: n.y + a.y }), { x: 0, y: 0 });
|
|
1527
1527
|
o.x /= i.length, o.y /= i.length;
|
|
1528
1528
|
const s = i.map((n) => ({ x: o.x + (n.x - o.x) * Math.cos(e) - (n.y - o.y) * Math.sin(e), y: o.y + (n.x - o.x) * Math.sin(e) + (n.y - o.y) * Math.cos(e) })).map(({ x: n, y: a }) => [A(n, a).lng, A(n, a).lat]);
|
|
1529
1529
|
return r.geometry.type === "Polygon" ? r.geometry.coordinates[0] = s : r.geometry.coordinates = s, r;
|
|
1530
1530
|
};
|
|
1531
|
-
function
|
|
1531
|
+
function Wt(r) {
|
|
1532
1532
|
const t = (r.geometry.type === "Polygon" ? r.geometry.coordinates[0] : r.geometry.coordinates).map((e) => {
|
|
1533
1533
|
const { x: i, y: o } = I(e[0], e[1]);
|
|
1534
1534
|
return [i, o];
|
|
@@ -1551,7 +1551,7 @@ function Bt(r) {
|
|
|
1551
1551
|
return { x: o / i, y: s / i };
|
|
1552
1552
|
})(t);
|
|
1553
1553
|
}
|
|
1554
|
-
class
|
|
1554
|
+
class ki extends W {
|
|
1555
1555
|
constructor(t, e, i, o) {
|
|
1556
1556
|
super(t), this.config = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinatePoints = void 0, this.lastBearing = void 0, this.selectedGeometry = void 0, this.selectedGeometryCentroid = void 0, this.selectedGeometryWebMercatorCentroid = void 0, this.config = t, this.selectionPoints = e, this.midPoints = i, this.coordinatePoints = o;
|
|
1557
1557
|
}
|
|
@@ -1566,26 +1566,26 @@ class Di extends W {
|
|
|
1566
1566
|
let n;
|
|
1567
1567
|
const a = { type: "Feature", geometry: o, properties: {} };
|
|
1568
1568
|
if (this.config.projection === "web-mercator") {
|
|
1569
|
-
this.selectedGeometryWebMercatorCentroid || (this.selectedGeometryWebMercatorCentroid =
|
|
1569
|
+
this.selectedGeometryWebMercatorCentroid || (this.selectedGeometryWebMercatorCentroid = Wt(a));
|
|
1570
1570
|
const u = I(t.lng, t.lat);
|
|
1571
1571
|
if (n = U(this.selectedGeometryWebMercatorCentroid, u), n === 0) return;
|
|
1572
1572
|
if (!this.lastBearing) return void (this.lastBearing = n);
|
|
1573
|
-
|
|
1573
|
+
We(a, -(this.lastBearing - n));
|
|
1574
1574
|
} else {
|
|
1575
1575
|
if (this.config.projection !== "globe") throw new Error("Unsupported projection");
|
|
1576
|
-
if (this.selectedGeometryCentroid || (this.selectedGeometryCentroid =
|
|
1576
|
+
if (this.selectedGeometryCentroid || (this.selectedGeometryCentroid = he({ geometry: o })), n = Bt(this.selectedGeometryCentroid, s), !this.lastBearing) return void (this.lastBearing = n + 180);
|
|
1577
1577
|
(function(u, p) {
|
|
1578
1578
|
if (p === 0 || p === 360 || p === -360) return u;
|
|
1579
|
-
const g =
|
|
1579
|
+
const g = he(u);
|
|
1580
1580
|
(u.geometry.type === "Polygon" ? u.geometry.coordinates[0] : u.geometry.coordinates).forEach((y) => {
|
|
1581
|
-
const m =
|
|
1581
|
+
const m = Bt(g, y) + p, v = (function(f, P) {
|
|
1582
1582
|
f[0] += f[0] - P[0] > 180 ? -360 : P[0] - f[0] > 180 ? 360 : 0;
|
|
1583
|
-
const S =
|
|
1583
|
+
const S = Ee, E = P[1] * Math.PI / 180, O = f[1] * Math.PI / 180, F = O - E;
|
|
1584
1584
|
let N = Math.abs(f[0] - P[0]) * Math.PI / 180;
|
|
1585
1585
|
N > Math.PI && (N -= 2 * Math.PI);
|
|
1586
1586
|
const _ = Math.log(Math.tan(O / 2 + Math.PI / 4) / Math.tan(E / 2 + Math.PI / 4)), B = Math.abs(_) > 1e-11 ? F / _ : Math.cos(E);
|
|
1587
1587
|
return Math.sqrt(F * F + B * B * N * N) * S;
|
|
1588
|
-
})(g, y), C =
|
|
1588
|
+
})(g, y), C = Ne(g, v, m);
|
|
1589
1589
|
y[0] = C[0], y[1] = C[1];
|
|
1590
1590
|
});
|
|
1591
1591
|
})(a, -(this.lastBearing - (n + 180)));
|
|
@@ -1599,7 +1599,7 @@ class Di extends W {
|
|
|
1599
1599
|
this.store.updateGeometry([{ id: e, geometry: o }, ...c, ...d, ...h]), this.projection === "web-mercator" ? this.lastBearing = n : this.projection === "globe" && (this.lastBearing = n + 180);
|
|
1600
1600
|
}
|
|
1601
1601
|
}
|
|
1602
|
-
class
|
|
1602
|
+
class Ni extends W {
|
|
1603
1603
|
constructor(t, e) {
|
|
1604
1604
|
super(t), this.config = void 0, this.dragCoordinateResizeBehavior = void 0, this.config = t, this.dragCoordinateResizeBehavior = e;
|
|
1605
1605
|
}
|
|
@@ -1614,13 +1614,13 @@ class _i extends W {
|
|
|
1614
1614
|
this.dragCoordinateResizeBehavior.stopDragging();
|
|
1615
1615
|
}
|
|
1616
1616
|
}
|
|
1617
|
-
function
|
|
1617
|
+
function Te({ coordinates: r, originX: t, originY: e, xScale: i, yScale: o }) {
|
|
1618
1618
|
i === 1 && o === 1 || r.forEach((s) => {
|
|
1619
1619
|
const { x: n, y: a } = I(s[0], s[1]), l = t + (n - t) * i, d = e + (a - e) * o, { lng: c, lat: h } = A(l, d);
|
|
1620
1620
|
s[0] = c, s[1] = h;
|
|
1621
1621
|
});
|
|
1622
1622
|
}
|
|
1623
|
-
class
|
|
1623
|
+
class Bi extends W {
|
|
1624
1624
|
constructor(t, e, i, o, s) {
|
|
1625
1625
|
super(t), this.config = void 0, this.pixelDistance = void 0, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinatePoints = void 0, this.minimumScale = 1e-4, this.draggedCoordinate = { id: null, index: -1 }, this.boundingBoxMaps = { opposite: { 0: 4, 1: 5, 2: 6, 3: 7, 4: 0, 5: 1, 6: 2, 7: 3 } }, this.config = t, this.pixelDistance = e, this.selectionPoints = i, this.midPoints = o, this.coordinatePoints = s;
|
|
1626
1626
|
}
|
|
@@ -1679,7 +1679,7 @@ class ki extends W {
|
|
|
1679
1679
|
centerWebMercatorDrag(t) {
|
|
1680
1680
|
const e = this.getSelectedFeatureDataWebMercator();
|
|
1681
1681
|
if (!e) return null;
|
|
1682
|
-
const { feature: i, boundingBox: o, updatedCoords: s, selectedCoordinate: n } = e, a =
|
|
1682
|
+
const { feature: i, boundingBox: o, updatedCoords: s, selectedCoordinate: n } = e, a = Wt(i);
|
|
1683
1683
|
if (!a) return null;
|
|
1684
1684
|
const l = I(n[0], n[1]), { closestBBoxIndex: d } = this.getIndexesWebMercator(o, l), c = I(t.lng, t.lat);
|
|
1685
1685
|
return this.scaleWebMercator({ closestBBoxIndex: d, updatedCoords: s, webMercatorCursor: c, webMercatorSelected: l, webMercatorOrigin: a }), s;
|
|
@@ -1687,7 +1687,7 @@ class ki extends W {
|
|
|
1687
1687
|
centerFixedWebMercatorDrag(t) {
|
|
1688
1688
|
const e = this.getSelectedFeatureDataWebMercator();
|
|
1689
1689
|
if (!e) return null;
|
|
1690
|
-
const { feature: i, boundingBox: o, updatedCoords: s, selectedCoordinate: n } = e, a =
|
|
1690
|
+
const { feature: i, boundingBox: o, updatedCoords: s, selectedCoordinate: n } = e, a = Wt(i);
|
|
1691
1691
|
if (!a) return null;
|
|
1692
1692
|
const l = I(n[0], n[1]), { closestBBoxIndex: d } = this.getIndexesWebMercator(o, l), c = I(t.lng, t.lat);
|
|
1693
1693
|
return this.scaleFixedWebMercator({ closestBBoxIndex: d, updatedCoords: s, webMercatorCursor: c, webMercatorSelected: l, webMercatorOrigin: a }), s;
|
|
@@ -1695,7 +1695,7 @@ class ki extends W {
|
|
|
1695
1695
|
scaleFixedWebMercator({ closestBBoxIndex: t, webMercatorOrigin: e, webMercatorSelected: i, webMercatorCursor: o, updatedCoords: s }) {
|
|
1696
1696
|
if (!this.isValidDragWebMercator(t, e.x - o.x, e.y - o.y)) return null;
|
|
1697
1697
|
let n = L(e, o) / L(e, i);
|
|
1698
|
-
return n < 0 && (n = this.minimumScale),
|
|
1698
|
+
return n < 0 && (n = this.minimumScale), Te({ coordinates: s, originX: e.x, originY: e.y, xScale: n, yScale: n }), s;
|
|
1699
1699
|
}
|
|
1700
1700
|
oppositeFixedWebMercatorDrag(t) {
|
|
1701
1701
|
const e = this.getSelectedFeatureDataWebMercator();
|
|
@@ -1776,19 +1776,19 @@ class ki extends W {
|
|
|
1776
1776
|
if (e === "center" ? s = this.centerWebMercatorDrag(t) : e === "opposite" ? s = this.oppositeWebMercatorDrag(t) : e === "center-fixed" ? s = this.centerFixedWebMercatorDrag(t) : e === "opposite-fixed" && (s = this.oppositeFixedWebMercatorDrag(t)), !s) return !1;
|
|
1777
1777
|
for (let c = 0; c < s.length; c++) {
|
|
1778
1778
|
const h = s[c];
|
|
1779
|
-
if (h[0] = w(h[0], this.coordinatePrecision), h[1] = w(h[1], this.coordinatePrecision), !
|
|
1779
|
+
if (h[0] = w(h[0], this.coordinatePrecision), h[1] = w(h[1], this.coordinatePrecision), !Ot(h, this.coordinatePrecision)) return !1;
|
|
1780
1780
|
}
|
|
1781
1781
|
const n = this.midPoints.getUpdated(s) || [], a = this.selectionPoints.getUpdated(s) || [], l = this.coordinatePoints.getUpdated(o.id, s) || [], d = { type: o.geometry.type, coordinates: o.geometry.type === "Polygon" ? [s] : s };
|
|
1782
1782
|
return !(i && !i({ id: this.draggedCoordinate.id, type: "Feature", geometry: d, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: b.Provisional }).valid || (this.store.updateGeometry([{ id: this.draggedCoordinate.id, geometry: d }, ...a, ...n, ...l]), 0));
|
|
1783
1783
|
}
|
|
1784
1784
|
}
|
|
1785
|
-
const
|
|
1786
|
-
class
|
|
1785
|
+
const ji = { deselect: "Escape", delete: "Delete", rotate: ["Control", "r"], scale: ["Control", "s"] }, ue = { pointerOver: "move", dragStart: "move", dragEnd: "move", insertMidpoint: "crosshair" };
|
|
1786
|
+
class $t extends ii {
|
|
1787
1787
|
constructor(t) {
|
|
1788
|
-
super(t, !0), this.mode = "select", this.allowManualDeselection = !0, this.dragEventThrottle = 5, this.dragEventCount = 0, this.selected = [], this.flags = {}, this.keyEvents =
|
|
1788
|
+
super(t, !0), this.mode = "select", this.allowManualDeselection = !0, this.dragEventThrottle = 5, this.dragEventCount = 0, this.selected = [], this.flags = {}, this.keyEvents = ji, this.cursors = ue, this.validations = {}, this.selectionPoints = void 0, this.midPoints = void 0, this.coordinateSnap = void 0, this.featuresAtMouseEvent = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.dragFeature = void 0, this.dragCoordinate = void 0, this.rotateFeature = void 0, this.scaleFeature = void 0, this.dragCoordinateResizeFeature = void 0, this.coordinatePoints = void 0, this.lineSnap = void 0, this.updateOptions(t);
|
|
1789
1789
|
}
|
|
1790
1790
|
updateOptions(t) {
|
|
1791
|
-
if (super.updateOptions(t), this.cursors = t && t.cursors ? x({}, this.cursors, t.cursors) :
|
|
1791
|
+
if (super.updateOptions(t), this.cursors = t && t.cursors ? x({}, this.cursors, t.cursors) : ue, t?.keyEvents === null ? this.keyEvents = { deselect: null, delete: null, rotate: null, scale: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t?.dragEventThrottle !== void 0 && (this.dragEventThrottle = t.dragEventThrottle), t?.allowManualDeselection !== void 0 && (this.allowManualDeselection = t.allowManualDeselection), t != null && t.flags) {
|
|
1792
1792
|
this.flags = x({}, this.flags, t.flags), this.validations = {};
|
|
1793
1793
|
for (const e in this.flags) {
|
|
1794
1794
|
const i = this.flags[e].feature;
|
|
@@ -1804,7 +1804,7 @@ class zt extends ti {
|
|
|
1804
1804
|
this._state = "selecting";
|
|
1805
1805
|
}
|
|
1806
1806
|
registerBehaviors(t) {
|
|
1807
|
-
this.pixelDistance = new
|
|
1807
|
+
this.pixelDistance = new pt(t), this.clickBoundingBox = new ut(t), this.featuresAtMouseEvent = new Mi(t, this.clickBoundingBox, this.pixelDistance), this.selectionPoints = new Fi(t), this.coordinatePoints = new De(t), this.midPoints = new Li(t, this.selectionPoints, this.coordinatePoints), this.coordinateSnap = new Et(t, this.pixelDistance, this.clickBoundingBox), this.lineSnap = new Rt(t, this.pixelDistance, this.clickBoundingBox), this.rotateFeature = new ki(t, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragFeature = new Di(t, this.featuresAtMouseEvent, this.selectionPoints, this.midPoints, this.coordinatePoints), this.dragCoordinate = new _i(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints, this.coordinateSnap, this.lineSnap), this.dragCoordinateResizeFeature = new Bi(t, this.pixelDistance, this.selectionPoints, this.midPoints, this.coordinatePoints), this.scaleFeature = new Ni(t, this.dragCoordinateResizeFeature);
|
|
1808
1808
|
}
|
|
1809
1809
|
deselectFeature() {
|
|
1810
1810
|
this.deselect();
|
|
@@ -1973,7 +1973,7 @@ class zt extends ti {
|
|
|
1973
1973
|
}
|
|
1974
1974
|
}
|
|
1975
1975
|
}
|
|
1976
|
-
class
|
|
1976
|
+
class Wi extends G {
|
|
1977
1977
|
constructor(...t) {
|
|
1978
1978
|
super(...t), this.type = q.Static, this.mode = "static";
|
|
1979
1979
|
}
|
|
@@ -2001,11 +2001,11 @@ class Bi extends G {
|
|
|
2001
2001
|
return x({}, { polygonFillColor: "#3f97e0", polygonOutlineColor: "#3f97e0", polygonOutlineWidth: 4, polygonFillOpacity: 0.3, pointColor: "#3f97e0", pointOutlineColor: "#ffffff", pointOutlineWidth: 0, pointWidth: 6, lineStringColor: "#3f97e0", lineStringWidth: 4, zIndex: 0 });
|
|
2002
2002
|
}
|
|
2003
2003
|
}
|
|
2004
|
-
function
|
|
2004
|
+
function Ge(r, t, e, i, o) {
|
|
2005
2005
|
for (; i > e; ) {
|
|
2006
2006
|
if (i - e > 600) {
|
|
2007
2007
|
const l = i - e + 1, d = t - e + 1, c = Math.log(l), h = 0.5 * Math.exp(2 * c / 3), u = 0.5 * Math.sqrt(c * h * (l - h) / l) * (d - l / 2 < 0 ? -1 : 1);
|
|
2008
|
-
|
|
2008
|
+
Ge(r, t, Math.max(e, Math.floor(t - d * h / l + u)), Math.min(i, Math.floor(t + (l - d) * h / l + u)), o);
|
|
2009
2009
|
}
|
|
2010
2010
|
const s = r[t];
|
|
2011
2011
|
let n = e, a = i;
|
|
@@ -2021,65 +2021,65 @@ function st(r, t, e) {
|
|
|
2021
2021
|
r[t] = r[e], r[e] = i;
|
|
2022
2022
|
}
|
|
2023
2023
|
function Z(r, t) {
|
|
2024
|
-
|
|
2024
|
+
lt(r, 0, r.children.length, t, r);
|
|
2025
2025
|
}
|
|
2026
|
-
function
|
|
2026
|
+
function lt(r, t, e, i, o) {
|
|
2027
2027
|
o || (o = tt([])), o.minX = 1 / 0, o.minY = 1 / 0, o.maxX = -1 / 0, o.maxY = -1 / 0;
|
|
2028
2028
|
for (let s = t; s < e; s++) {
|
|
2029
2029
|
const n = r.children[s];
|
|
2030
|
-
|
|
2030
|
+
dt(o, r.leaf ? i(n) : n);
|
|
2031
2031
|
}
|
|
2032
2032
|
return o;
|
|
2033
2033
|
}
|
|
2034
|
-
function
|
|
2034
|
+
function dt(r, t) {
|
|
2035
2035
|
return r.minX = Math.min(r.minX, t.minX), r.minY = Math.min(r.minY, t.minY), r.maxX = Math.max(r.maxX, t.maxX), r.maxY = Math.max(r.maxY, t.maxY), r;
|
|
2036
2036
|
}
|
|
2037
|
-
function
|
|
2037
|
+
function Ti(r, t) {
|
|
2038
2038
|
return r.minX - t.minX;
|
|
2039
2039
|
}
|
|
2040
|
-
function
|
|
2040
|
+
function Gi(r, t) {
|
|
2041
2041
|
return r.minY - t.minY;
|
|
2042
2042
|
}
|
|
2043
|
-
function
|
|
2043
|
+
function Dt(r) {
|
|
2044
2044
|
return (r.maxX - r.minX) * (r.maxY - r.minY);
|
|
2045
2045
|
}
|
|
2046
|
-
function
|
|
2046
|
+
function Ct(r) {
|
|
2047
2047
|
return r.maxX - r.minX + (r.maxY - r.minY);
|
|
2048
2048
|
}
|
|
2049
|
-
function
|
|
2049
|
+
function Ai(r, t) {
|
|
2050
2050
|
const e = Math.max(r.minX, t.minX), i = Math.max(r.minY, t.minY), o = Math.min(r.maxX, t.maxX), s = Math.min(r.maxY, t.maxY);
|
|
2051
2051
|
return Math.max(0, o - e) * Math.max(0, s - i);
|
|
2052
2052
|
}
|
|
2053
|
-
function
|
|
2053
|
+
function _t(r, t) {
|
|
2054
2054
|
return r.minX <= t.minX && r.minY <= t.minY && t.maxX <= r.maxX && t.maxY <= r.maxY;
|
|
2055
2055
|
}
|
|
2056
|
-
function
|
|
2056
|
+
function Pt(r, t) {
|
|
2057
2057
|
return t.minX <= r.maxX && t.minY <= r.maxY && t.maxX >= r.minX && t.maxY >= r.minY;
|
|
2058
2058
|
}
|
|
2059
2059
|
function tt(r) {
|
|
2060
2060
|
return { children: r, height: 1, leaf: !0, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
|
|
2061
2061
|
}
|
|
2062
|
-
function
|
|
2062
|
+
function pe(r, t, e, i, o) {
|
|
2063
2063
|
const s = [t, e];
|
|
2064
2064
|
for (; s.length; ) {
|
|
2065
2065
|
if ((e = s.pop()) - (t = s.pop()) <= i) continue;
|
|
2066
2066
|
const n = t + Math.ceil((e - t) / i / 2) * i;
|
|
2067
|
-
|
|
2067
|
+
Ge(r, n, t, e, o), s.push(t, n, n, e);
|
|
2068
2068
|
}
|
|
2069
2069
|
}
|
|
2070
|
-
class
|
|
2070
|
+
class Ui {
|
|
2071
2071
|
constructor(t) {
|
|
2072
2072
|
this._maxEntries = void 0, this._minEntries = void 0, this.data = void 0, this._maxEntries = Math.max(4, t), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
|
|
2073
2073
|
}
|
|
2074
2074
|
search(t) {
|
|
2075
2075
|
let e = this.data;
|
|
2076
2076
|
const i = [];
|
|
2077
|
-
if (!
|
|
2077
|
+
if (!Pt(t, e)) return i;
|
|
2078
2078
|
const o = this.toBBox, s = [];
|
|
2079
2079
|
for (; e; ) {
|
|
2080
2080
|
for (let n = 0; n < e.children.length; n++) {
|
|
2081
2081
|
const a = e.children[n], l = e.leaf ? o(a) : a;
|
|
2082
|
-
|
|
2082
|
+
Pt(t, l) && (e.leaf ? i.push(a) : _t(t, l) ? this._all(a, i) : s.push(a));
|
|
2083
2083
|
}
|
|
2084
2084
|
e = s.pop();
|
|
2085
2085
|
}
|
|
@@ -2087,13 +2087,13 @@ class Gi {
|
|
|
2087
2087
|
}
|
|
2088
2088
|
collides(t) {
|
|
2089
2089
|
let e = this.data;
|
|
2090
|
-
if (
|
|
2090
|
+
if (Pt(t, e)) {
|
|
2091
2091
|
const i = [];
|
|
2092
2092
|
for (; e; ) {
|
|
2093
2093
|
for (let o = 0; o < e.children.length; o++) {
|
|
2094
2094
|
const s = e.children[o], n = e.leaf ? this.toBBox(s) : s;
|
|
2095
|
-
if (
|
|
2096
|
-
if (e.leaf ||
|
|
2095
|
+
if (Pt(t, n)) {
|
|
2096
|
+
if (e.leaf || _t(t, n)) return !0;
|
|
2097
2097
|
i.push(s);
|
|
2098
2098
|
}
|
|
2099
2099
|
}
|
|
@@ -2133,7 +2133,7 @@ class Gi {
|
|
|
2133
2133
|
const d = e.children.indexOf(t);
|
|
2134
2134
|
d !== -1 && (e.children.splice(d, 1), o.push(e), this._condense(o));
|
|
2135
2135
|
}
|
|
2136
|
-
l || e.leaf || !
|
|
2136
|
+
l || e.leaf || !_t(e, i) ? a ? (n++, e = a.children[n], l = !1) : e = null : (o.push(e), s.push(n), n = 0, a = e, e = e.children[0]);
|
|
2137
2137
|
}
|
|
2138
2138
|
}
|
|
2139
2139
|
toBBox(t) {
|
|
@@ -2156,10 +2156,10 @@ class Gi {
|
|
|
2156
2156
|
if (s <= a) return n = tt(t.slice(e, i + 1)), Z(n, this.toBBox), n;
|
|
2157
2157
|
o || (o = Math.ceil(Math.log(s) / Math.log(a)), a = Math.ceil(s / Math.pow(a, o - 1))), n = tt([]), n.leaf = !1, n.height = o;
|
|
2158
2158
|
const l = Math.ceil(s / a), d = l * Math.ceil(Math.sqrt(a));
|
|
2159
|
-
|
|
2159
|
+
pe(t, e, i, d, this.compareMinX);
|
|
2160
2160
|
for (let c = e; c <= i; c += d) {
|
|
2161
2161
|
const h = Math.min(c + d - 1, i);
|
|
2162
|
-
|
|
2162
|
+
pe(t, c, h, l, this.compareMinY);
|
|
2163
2163
|
for (let u = c; u <= h; u += l) {
|
|
2164
2164
|
const p = Math.min(u + l - 1, h);
|
|
2165
2165
|
n.children.push(this._build(t, u, p, o - 1));
|
|
@@ -2171,7 +2171,7 @@ class Gi {
|
|
|
2171
2171
|
for (; o.push(e), !e.leaf && o.length - 1 !== i; ) {
|
|
2172
2172
|
let a, l = 1 / 0, d = 1 / 0;
|
|
2173
2173
|
for (let c = 0; c < e.children.length; c++) {
|
|
2174
|
-
const h = e.children[c], u =
|
|
2174
|
+
const h = e.children[c], u = Dt(h), p = (s = t, n = h, (Math.max(n.maxX, s.maxX) - Math.min(n.minX, s.minX)) * (Math.max(n.maxY, s.maxY) - Math.min(n.minY, s.minY)) - u);
|
|
2175
2175
|
p < d ? (d = p, l = u < l ? u : l, a = h) : p === d && u < l && (l = u, a = h);
|
|
2176
2176
|
}
|
|
2177
2177
|
e = a || e.children[0];
|
|
@@ -2181,7 +2181,7 @@ class Gi {
|
|
|
2181
2181
|
}
|
|
2182
2182
|
_insert(t, e, i) {
|
|
2183
2183
|
const o = i ? t : this.toBBox(t), s = [], n = this._chooseSubtree(o, this.data, e, s);
|
|
2184
|
-
for (n.children.push(t),
|
|
2184
|
+
for (n.children.push(t), dt(n, o); e >= 0 && s[e].children.length > this._maxEntries; ) this._split(s, e), e--;
|
|
2185
2185
|
this._adjustParentBBoxes(o, s, e);
|
|
2186
2186
|
}
|
|
2187
2187
|
_split(t, e) {
|
|
@@ -2196,39 +2196,39 @@ class Gi {
|
|
|
2196
2196
|
_chooseSplitIndex(t, e, i) {
|
|
2197
2197
|
let o, s = 1 / 0, n = 1 / 0;
|
|
2198
2198
|
for (let a = e; a <= i - e; a++) {
|
|
2199
|
-
const l =
|
|
2199
|
+
const l = lt(t, 0, a, this.toBBox), d = lt(t, a, i, this.toBBox), c = Ai(l, d), h = Dt(l) + Dt(d);
|
|
2200
2200
|
c < s ? (s = c, o = a, n = h < n ? h : n) : c === s && h < n && (n = h, o = a);
|
|
2201
2201
|
}
|
|
2202
2202
|
return o || i - e;
|
|
2203
2203
|
}
|
|
2204
2204
|
_chooseSplitAxis(t, e, i) {
|
|
2205
|
-
const o = t.leaf ? this.compareMinX :
|
|
2205
|
+
const o = t.leaf ? this.compareMinX : Ti, s = t.leaf ? this.compareMinY : Gi;
|
|
2206
2206
|
this._allDistMargin(t, e, i, o) < this._allDistMargin(t, e, i, s) && t.children.sort(o);
|
|
2207
2207
|
}
|
|
2208
2208
|
_allDistMargin(t, e, i, o) {
|
|
2209
2209
|
t.children.sort(o);
|
|
2210
|
-
const s = this.toBBox, n =
|
|
2211
|
-
let l =
|
|
2210
|
+
const s = this.toBBox, n = lt(t, 0, e, s), a = lt(t, i - e, i, s);
|
|
2211
|
+
let l = Ct(n) + Ct(a);
|
|
2212
2212
|
for (let d = e; d < i - e; d++) {
|
|
2213
2213
|
const c = t.children[d];
|
|
2214
|
-
|
|
2214
|
+
dt(n, t.leaf ? s(c) : c), l += Ct(n);
|
|
2215
2215
|
}
|
|
2216
2216
|
for (let d = i - e - 1; d >= e; d--) {
|
|
2217
2217
|
const c = t.children[d];
|
|
2218
|
-
|
|
2218
|
+
dt(a, t.leaf ? s(c) : c), l += Ct(a);
|
|
2219
2219
|
}
|
|
2220
2220
|
return l;
|
|
2221
2221
|
}
|
|
2222
2222
|
_adjustParentBBoxes(t, e, i) {
|
|
2223
|
-
for (let o = i; o >= 0; o--)
|
|
2223
|
+
for (let o = i; o >= 0; o--) dt(e[o], t);
|
|
2224
2224
|
}
|
|
2225
2225
|
_condense(t) {
|
|
2226
2226
|
for (let e, i = t.length - 1; i >= 0; i--) t[i].children.length === 0 ? i > 0 ? (e = t[i - 1].children, e.splice(e.indexOf(t[i]), 1)) : this.clear() : Z(t[i], this.toBBox);
|
|
2227
2227
|
}
|
|
2228
2228
|
}
|
|
2229
|
-
class
|
|
2229
|
+
class Ri {
|
|
2230
2230
|
constructor(t) {
|
|
2231
|
-
this.tree = void 0, this.idToNode = void 0, this.nodeToId = void 0, this.tree = new
|
|
2231
|
+
this.tree = void 0, this.idToNode = void 0, this.nodeToId = void 0, this.tree = new Ui(t && t.maxEntries ? t.maxEntries : 9), this.idToNode = /* @__PURE__ */ new Map(), this.nodeToId = /* @__PURE__ */ new Map();
|
|
2232
2232
|
}
|
|
2233
2233
|
setMaps(t, e) {
|
|
2234
2234
|
this.idToNode.set(t.id, e), this.nodeToId.set(e, t.id);
|
|
@@ -2279,14 +2279,14 @@ class Ai {
|
|
|
2279
2279
|
return this.tree.collides(this.toBBox(t));
|
|
2280
2280
|
}
|
|
2281
2281
|
}
|
|
2282
|
-
const
|
|
2282
|
+
const zi = { getId: () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(r) {
|
|
2283
2283
|
const t = 16 * Math.random() | 0;
|
|
2284
2284
|
return (r == "x" ? t : 3 & t | 8).toString(16);
|
|
2285
2285
|
}), isValidId: (r) => typeof r == "string" && r.length === 36 };
|
|
2286
|
-
class
|
|
2286
|
+
class Vi {
|
|
2287
2287
|
constructor(t) {
|
|
2288
2288
|
this.idStrategy = void 0, this.tracked = void 0, this.spatialIndex = void 0, this.store = void 0, this._onChange = () => {
|
|
2289
|
-
}, this.store = {}, this.spatialIndex = new
|
|
2289
|
+
}, this.store = {}, this.spatialIndex = new Ri(), this.tracked = !t || t.tracked !== !1, this.idStrategy = t && t.idStrategy ? t.idStrategy : zi;
|
|
2290
2290
|
}
|
|
2291
2291
|
clone(t) {
|
|
2292
2292
|
return JSON.parse(JSON.stringify(t));
|
|
@@ -2310,10 +2310,10 @@ class Ri {
|
|
|
2310
2310
|
}
|
|
2311
2311
|
if (this.tracked) {
|
|
2312
2312
|
if (l.properties.createdAt) {
|
|
2313
|
-
if (!
|
|
2313
|
+
if (!ee(l.properties.createdAt)) return a.push({ id: l.id, valid: !1, reason: "createdAt is not a valid numeric timestamp" }), !1;
|
|
2314
2314
|
} else l.properties.createdAt = +/* @__PURE__ */ new Date();
|
|
2315
2315
|
if (l.properties.updatedAt) {
|
|
2316
|
-
if (!
|
|
2316
|
+
if (!ee(l.properties.updatedAt)) return a.push({ id: l.id, valid: !1, reason: "updatedAt is not a valid numeric timestamp" }), !1;
|
|
2317
2317
|
} else l.properties.updatedAt = +/* @__PURE__ */ new Date();
|
|
2318
2318
|
}
|
|
2319
2319
|
return this.has(d) ? (a.push({ id: d, valid: !1, reason: `Feature already exists with this id: ${d}` }), !1) : (this.store[d] = l, n.push(d), i && i(l), a.push({ id: d, valid: !0 }), !0);
|
|
@@ -2386,16 +2386,16 @@ class Ri {
|
|
|
2386
2386
|
return Object.keys(this.store).length;
|
|
2387
2387
|
}
|
|
2388
2388
|
}
|
|
2389
|
-
const
|
|
2390
|
-
function
|
|
2389
|
+
const $i = "Feature is not a Polygon or LineString", Ki = "Feature intersects itself", Xi = (r) => r.geometry.type !== "Polygon" && r.geometry.type !== "LineString" ? { valid: !1, reason: $i } : Gt(r) ? { valid: !1, reason: Ki } : { valid: !0 };
|
|
2390
|
+
function ge(r, t, e) {
|
|
2391
2391
|
const i = U(r, t);
|
|
2392
2392
|
let o = U(t, e) - i;
|
|
2393
2393
|
return o < 0 && (o += 360), 180 - Math.abs(o - 90 - 90);
|
|
2394
2394
|
}
|
|
2395
|
-
const
|
|
2396
|
-
class
|
|
2395
|
+
const Yi = { cancel: "Escape", finish: "Enter" }, Hi = { start: "crosshair", close: "pointer" };
|
|
2396
|
+
class Ae extends G {
|
|
2397
2397
|
constructor(t) {
|
|
2398
|
-
super(t, !0), this.mode = "angled-rectangle", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents =
|
|
2398
|
+
super(t, !0), this.mode = "angled-rectangle", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Yi, this.cursors = Hi, this.mouseMove = !1, this.updateOptions(t);
|
|
2399
2399
|
}
|
|
2400
2400
|
updateOptions(t) {
|
|
2401
2401
|
super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents));
|
|
@@ -2420,10 +2420,10 @@ class Te extends G {
|
|
|
2420
2420
|
const o = 1 / Math.pow(10, this.coordinatePrecision - 1), s = Math.max(1e-6, o);
|
|
2421
2421
|
i = [e[0], [t.lng, t.lat], [t.lng, t.lat - s], e[0]];
|
|
2422
2422
|
} else if (this.currentCoordinate === 2) {
|
|
2423
|
-
const o = e[0], s = e[1], n =
|
|
2423
|
+
const o = e[0], s = e[1], n = Be(o, s, this.coordinatePrecision, this.project, this.unproject), a = I(o[0], o[1]), l = I(n[0], n[1]), d = I(s[0], s[1]), c = I(t.lng, t.lat), h = L(c, a) < L(c, d), u = ge(a, l, c), p = h ? 90 - u : ge(a, l, c) - 90, g = L(l, c), y = Math.cos(M(p)) * g, m = U(a, d) + ((function(S, E, O) {
|
|
2424
2424
|
const F = (O.x - E.x) * (S.y - E.y) - (O.y - E.y) * (S.x - E.x);
|
|
2425
2425
|
return F > 1e-10 ? "left" : F < -1e-10 ? "right" : "left";
|
|
2426
|
-
})(a, d, c) === "right" ? -90 : 90), v =
|
|
2426
|
+
})(a, d, c) === "right" ? -90 : 90), v = gt(a, y, m), C = gt(d, y, m), f = A(v.x, v.y), P = A(C.x, C.y);
|
|
2427
2427
|
i = [e[0], e[1], [P.lng, P.lat], [f.lng, f.lat], e[0]];
|
|
2428
2428
|
}
|
|
2429
2429
|
i && this.updatePolygonGeometry(this.currentId, i, b.Provisional);
|
|
@@ -2469,26 +2469,26 @@ class Te extends G {
|
|
|
2469
2469
|
return t.properties.mode === this.mode && t.geometry.type === "Polygon" && (e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = T), e;
|
|
2470
2470
|
}
|
|
2471
2471
|
validateFeature(t) {
|
|
2472
|
-
return this.validateModeFeature(t, (e) =>
|
|
2472
|
+
return this.validateModeFeature(t, (e) => yt(e, this.coordinatePrecision));
|
|
2473
2473
|
}
|
|
2474
2474
|
afterFeatureUpdated(t) {
|
|
2475
2475
|
this.currentId === t.id && (this.currentId = void 0, this.currentCoordinate = 0, this.state === "drawing" && this.setStarted());
|
|
2476
2476
|
}
|
|
2477
2477
|
}
|
|
2478
|
-
function
|
|
2478
|
+
function Ue(r, t, e) {
|
|
2479
2479
|
return (t.x - r.x) * (e.y - r.y) - (t.y - r.y) * (e.x - r.x) <= 0;
|
|
2480
2480
|
}
|
|
2481
|
-
const
|
|
2482
|
-
class
|
|
2481
|
+
const Ji = { cancel: "Escape", finish: "Enter" }, qi = { start: "crosshair", close: "pointer" };
|
|
2482
|
+
class Re extends G {
|
|
2483
2483
|
constructor(t) {
|
|
2484
|
-
super(t, !0), this.mode = "sector", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents =
|
|
2484
|
+
super(t, !0), this.mode = "sector", this.currentCoordinate = 0, this.currentId = void 0, this.keyEvents = Ji, this.direction = void 0, this.arcPoints = 64, this.cursors = qi, this.mouseMove = !1, this.updateOptions(t);
|
|
2485
2485
|
}
|
|
2486
2486
|
updateOptions(t) {
|
|
2487
2487
|
super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.arcPoints && (this.arcPoints = t.arcPoints);
|
|
2488
2488
|
}
|
|
2489
2489
|
close() {
|
|
2490
2490
|
if (this.currentId === void 0) return;
|
|
2491
|
-
const t =
|
|
2491
|
+
const t = ft(this.store.getGeometryCopy(this.currentId));
|
|
2492
2492
|
t && this.store.updateGeometry([{ id: this.currentId, geometry: t }]), this.store.updateProperty([{ id: this.currentId, property: D, value: void 0 }]);
|
|
2493
2493
|
const e = this.currentId;
|
|
2494
2494
|
this.currentCoordinate = 0, this.currentId = void 0, this.direction = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
|
|
@@ -2509,7 +2509,7 @@ class Ae extends G {
|
|
|
2509
2509
|
} else if (this.currentCoordinate === 2) {
|
|
2510
2510
|
const o = e[0], s = e[1], n = [t.lng, t.lat], a = I(o[0], o[1]), l = I(s[0], s[1]), d = I(n[0], n[1]);
|
|
2511
2511
|
if (this.direction === void 0) {
|
|
2512
|
-
const f =
|
|
2512
|
+
const f = Ue(a, l, d);
|
|
2513
2513
|
this.direction = f ? "clockwise" : "anticlockwise";
|
|
2514
2514
|
}
|
|
2515
2515
|
const c = L(a, l), h = U(a, l), u = U(a, d), p = this.arcPoints, g = [o], y = H(h), m = H(u);
|
|
@@ -2518,7 +2518,7 @@ class Ae extends G {
|
|
|
2518
2518
|
const C = (this.direction === "anticlockwise" ? 1 : -1) * v / p;
|
|
2519
2519
|
g.push(s);
|
|
2520
2520
|
for (let f = 0; f <= p; f++) {
|
|
2521
|
-
const P =
|
|
2521
|
+
const P = gt(a, c, y + f * C), { lng: S, lat: E } = A(P.x, P.y), O = [w(S, this.coordinatePrecision), w(E, this.coordinatePrecision)];
|
|
2522
2522
|
O[0] !== g[g.length - 1][0] && O[1] !== g[g.length - 1][1] && g.push(O);
|
|
2523
2523
|
}
|
|
2524
2524
|
g.push(o), i = [...g];
|
|
@@ -2562,16 +2562,16 @@ class Ae extends G {
|
|
|
2562
2562
|
return t.properties.mode === this.mode && t.geometry.type === "Polygon" && (e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = T), e;
|
|
2563
2563
|
}
|
|
2564
2564
|
validateFeature(t) {
|
|
2565
|
-
return this.validateModeFeature(t, (e) =>
|
|
2565
|
+
return this.validateModeFeature(t, (e) => yt(e, this.coordinatePrecision));
|
|
2566
2566
|
}
|
|
2567
2567
|
afterFeatureUpdated(t) {
|
|
2568
2568
|
this.currentId === t.id && (this.currentId = void 0, this.direction = void 0, this.currentCoordinate = 0, this.state === "drawing" && this.setStarted());
|
|
2569
2569
|
}
|
|
2570
2570
|
}
|
|
2571
|
-
const
|
|
2572
|
-
class
|
|
2571
|
+
const Zi = { cancel: "Escape", finish: "Enter" }, Qi = { start: "crosshair", close: "pointer" };
|
|
2572
|
+
class ze extends G {
|
|
2573
2573
|
constructor(t) {
|
|
2574
|
-
super(t, !0), this.mode = "sensor", this.currentCoordinate = 0, this.currentId = void 0, this.currentInitialArcId = void 0, this.currentStartingPointId = void 0, this.keyEvents =
|
|
2574
|
+
super(t, !0), this.mode = "sensor", this.currentCoordinate = 0, this.currentId = void 0, this.currentInitialArcId = void 0, this.currentStartingPointId = void 0, this.keyEvents = Zi, this.direction = void 0, this.arcPoints = 64, this.cursors = Qi, this.mouseMove = !1, this.updateOptions(t);
|
|
2575
2575
|
}
|
|
2576
2576
|
updateOptions(t) {
|
|
2577
2577
|
super.updateOptions(t), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors)), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.arcPoints && (this.arcPoints = t.arcPoints);
|
|
@@ -2580,7 +2580,7 @@ class Ue extends G {
|
|
|
2580
2580
|
if (this.currentStartingPointId === void 0) return;
|
|
2581
2581
|
const t = this.currentStartingPointId, e = this.currentInitialArcId, i = this.currentId;
|
|
2582
2582
|
if (t && this.store.delete([t]), e && this.store.delete([e]), this.currentId) {
|
|
2583
|
-
const o =
|
|
2583
|
+
const o = ft(this.store.getGeometryCopy(this.currentId));
|
|
2584
2584
|
o && this.store.updateGeometry([{ id: this.currentId, geometry: o }]), this.store.updateProperty([{ id: this.currentId, property: D, value: void 0 }]);
|
|
2585
2585
|
}
|
|
2586
2586
|
this.currentCoordinate = 0, this.currentStartingPointId = void 0, this.currentInitialArcId = void 0, this.currentId = void 0, this.direction = void 0, this.state === "drawing" && this.setStarted(), i && this.onFinish(i, { mode: this.mode, action: "draw" });
|
|
@@ -2596,7 +2596,7 @@ class Ue extends G {
|
|
|
2596
2596
|
if (this.currentCoordinate === 2) {
|
|
2597
2597
|
const e = this.store.getGeometryCopy(this.currentInitialArcId).coordinates, i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], s = [t.lng, t.lat], n = I(o[0], o[1]), a = I(s[0], s[1]), l = I(i[0], i[1]), d = L(l, n);
|
|
2598
2598
|
if (this.direction === void 0) {
|
|
2599
|
-
const C =
|
|
2599
|
+
const C = Ue(l, n, a);
|
|
2600
2600
|
this.direction = C ? "clockwise" : "anticlockwise";
|
|
2601
2601
|
}
|
|
2602
2602
|
const c = U(l, n), h = U(l, a), u = this.arcPoints, p = [o], g = H(c), y = H(h);
|
|
@@ -2604,7 +2604,7 @@ class Ue extends G {
|
|
|
2604
2604
|
this.direction === "anticlockwise" ? (m = y - g, m < 0 && (m += 360)) : (m = g - y, m < 0 && (m += 360));
|
|
2605
2605
|
const v = (this.direction === "anticlockwise" ? 1 : -1) * m / u;
|
|
2606
2606
|
for (let C = 0; C <= u; C++) {
|
|
2607
|
-
const f =
|
|
2607
|
+
const f = gt(l, d, g + C * v), { lng: P, lat: S } = A(f.x, f.y), E = [w(P, this.coordinatePrecision), w(S, this.coordinatePrecision)];
|
|
2608
2608
|
E[0] !== p[p.length - 1][0] && E[1] !== p[p.length - 1][1] && p.push(E);
|
|
2609
2609
|
}
|
|
2610
2610
|
this.updateLineStringGeometry(this.currentInitialArcId, p, b.Provisional);
|
|
@@ -2615,7 +2615,7 @@ class Ue extends G {
|
|
|
2615
2615
|
if (this.notInSector({ normalizedCursor: v, normalizedStart: y, normalizedEnd: m, direction: this.direction })) return;
|
|
2616
2616
|
const C = this.getDeltaBearing(this.direction, y, m), f = this.arcPoints, P = (this.direction === "anticlockwise" ? 1 : -1) * C / f, S = L(d, h), E = [];
|
|
2617
2617
|
for (let O = 0; O <= f; O++) {
|
|
2618
|
-
const F =
|
|
2618
|
+
const F = gt(d, S, y + O * P), { lng: N, lat: _ } = A(F.x, F.y), B = [w(N, this.coordinatePrecision), w(_, this.coordinatePrecision)];
|
|
2619
2619
|
B[0] !== e[e.length - 1][0] && B[1] !== e[e.length - 1][1] && E.unshift(B);
|
|
2620
2620
|
}
|
|
2621
2621
|
e.push(...E), e.push(e[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, e, b.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [e] }, properties: { mode: this.mode, [D]: !0 } }]);
|
|
@@ -2662,7 +2662,7 @@ class Ue extends G {
|
|
|
2662
2662
|
return t.properties.mode === this.mode && (t.geometry.type === "Polygon" ? (e.polygonFillColor = this.getHexColorStylingValue(this.styles.fillColor, e.polygonFillColor, t), e.polygonOutlineColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.polygonOutlineWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.polygonFillOpacity = this.getNumericStylingValue(this.styles.fillOpacity, e.polygonFillOpacity, t), e.zIndex = T) : t.geometry.type === "LineString" ? (e.lineStringColor = this.getHexColorStylingValue(this.styles.outlineColor, e.polygonOutlineColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.outlineWidth, e.polygonOutlineWidth, t), e.zIndex = T) : t.geometry.type === "Point" && (e.pointColor = this.getHexColorStylingValue(this.styles.centerPointColor, e.pointColor, t), e.pointWidth = this.getNumericStylingValue(this.styles.centerPointWidth, e.pointWidth, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.centerPointOutlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.centerPointOutlineWidth, e.pointOutlineWidth, t), e.zIndex = 20)), e;
|
|
2663
2663
|
}
|
|
2664
2664
|
validateFeature(t) {
|
|
2665
|
-
return this.validateModeFeature(t, (e) =>
|
|
2665
|
+
return this.validateModeFeature(t, (e) => yt(e, this.coordinatePrecision));
|
|
2666
2666
|
}
|
|
2667
2667
|
afterFeatureUpdated(t) {
|
|
2668
2668
|
this.currentId === t.id && (this.currentStartingPointId && this.store.delete([this.currentStartingPointId]), this.currentInitialArcId && this.store.delete([this.currentInitialArcId]), this.currentStartingPointId = void 0, this.direction = void 0, this.currentId = void 0, this.currentCoordinate = 0, this.state === "drawing" && this.setStarted());
|
|
@@ -2684,7 +2684,7 @@ class Q {
|
|
|
2684
2684
|
}, this.callback = e;
|
|
2685
2685
|
}
|
|
2686
2686
|
}
|
|
2687
|
-
var
|
|
2687
|
+
var to = { __proto__: null, TerraDrawBaseAdapter: class {
|
|
2688
2688
|
constructor(r) {
|
|
2689
2689
|
this._nextKeyUpIsContextMenu = !1, this._minPixelDragDistance = void 0, this._minPixelDragDistanceDrawing = void 0, this._minPixelDragDistanceSelecting = void 0, this._lastDrawEvent = void 0, this._coordinatePrecision = void 0, this._heldKeys = /* @__PURE__ */ new Set(), this._listeners = [], this._dragState = "not-dragging", this._currentModeCallbacks = void 0, this._minPixelDragDistance = typeof r.minPixelDragDistance == "number" ? r.minPixelDragDistance : 1, this._minPixelDragDistanceSelecting = typeof r.minPixelDragDistanceSelecting == "number" ? r.minPixelDragDistanceSelecting : 1, this._minPixelDragDistanceDrawing = typeof r.minPixelDragDistanceDrawing == "number" ? r.minPixelDragDistanceDrawing : 8, this._coordinatePrecision = typeof r.coordinatePrecision == "number" ? r.coordinatePrecision : 9;
|
|
2690
2690
|
}
|
|
@@ -2774,10 +2774,10 @@ var Zi = { __proto__: null, TerraDrawBaseAdapter: class {
|
|
|
2774
2774
|
}), this.clear(), this._currentModeCallbacks = void 0;
|
|
2775
2775
|
}
|
|
2776
2776
|
} };
|
|
2777
|
-
const
|
|
2778
|
-
class
|
|
2777
|
+
const eo = { cancel: "Escape", finish: "Enter" }, io = { start: "crosshair", close: "pointer" };
|
|
2778
|
+
class Ve extends G {
|
|
2779
2779
|
constructor(t) {
|
|
2780
|
-
super(t, !0), this.mode = "freehand-linestring", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents =
|
|
2780
|
+
super(t, !0), this.mode = "freehand-linestring", this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.minDistance = 20, this.keyEvents = eo, this.cursors = io, this.preventNewFeature = !1, this.updateOptions(t);
|
|
2781
2781
|
}
|
|
2782
2782
|
updateOptions(t) {
|
|
2783
2783
|
super.updateOptions(t), t != null && t.minDistance && (this.minDistance = t.minDistance), t?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : t != null && t.keyEvents && (this.keyEvents = x({}, this.keyEvents, t.keyEvents)), t != null && t.cursors && (this.cursors = x({}, this.cursors, t.cursors));
|
|
@@ -2839,15 +2839,15 @@ class Re extends G {
|
|
|
2839
2839
|
return t.type === "Feature" && t.geometry.type === "LineString" && t.properties.mode === this.mode ? (e.lineStringColor = this.getHexColorStylingValue(this.styles.lineStringColor, e.lineStringColor, t), e.lineStringWidth = this.getNumericStylingValue(this.styles.lineStringWidth, e.lineStringWidth, t), e.zIndex = T, e) : (t.type === "Feature" && t.geometry.type === "Point" && t.properties.mode === this.mode && (e.pointWidth = this.getNumericStylingValue(this.styles.closingPointWidth, e.pointWidth, t), e.pointColor = this.getHexColorStylingValue(this.styles.closingPointColor, e.pointColor, t), e.pointOutlineColor = this.getHexColorStylingValue(this.styles.closingPointOutlineColor, e.pointOutlineColor, t), e.pointOutlineWidth = this.getNumericStylingValue(this.styles.closingPointOutlineWidth, 2, t), e.zIndex = 50), e);
|
|
2840
2840
|
}
|
|
2841
2841
|
validateFeature(t) {
|
|
2842
|
-
return this.validateModeFeature(t, (e) =>
|
|
2842
|
+
return this.validateModeFeature(t, (e) => Ut(e, this.coordinatePrecision));
|
|
2843
2843
|
}
|
|
2844
2844
|
afterFeatureUpdated(t) {
|
|
2845
2845
|
this.currentId === t.id && (this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0);
|
|
2846
2846
|
}
|
|
2847
2847
|
}
|
|
2848
|
-
class
|
|
2848
|
+
class oo {
|
|
2849
2849
|
constructor(t) {
|
|
2850
|
-
this._modes = void 0, this._mode = void 0, this._adapter = void 0, this._enabled = !1, this._store = void 0, this._eventListeners = void 0, this._instanceSelectMode = void 0, this._adapter = t.adapter, this._mode = new
|
|
2850
|
+
this._modes = void 0, this._mode = void 0, this._adapter = void 0, this._enabled = !1, this._store = void 0, this._eventListeners = void 0, this._instanceSelectMode = void 0, this._adapter = t.adapter, this._mode = new Wi();
|
|
2851
2851
|
const e = /* @__PURE__ */ new Set(), i = t.modes.reduce((c, h) => {
|
|
2852
2852
|
if (e.has(h.mode)) throw new Error(`There is already a ${h.mode} mode provided`);
|
|
2853
2853
|
return e.add(h.mode), c[h.mode] = h, c;
|
|
@@ -2858,7 +2858,7 @@ class eo {
|
|
|
2858
2858
|
if (this._instanceSelectMode) throw new Error("only one type of select mode can be provided");
|
|
2859
2859
|
this._instanceSelectMode = c;
|
|
2860
2860
|
}
|
|
2861
|
-
}), this._modes = x({}, i, { static: this._mode }), this._eventListeners = { change: [], select: [], deselect: [], finish: [], ready: [] }, this._store = new
|
|
2861
|
+
}), this._modes = x({}, i, { static: this._mode }), this._eventListeners = { change: [], select: [], deselect: [], finish: [], ready: [] }, this._store = new Vi({ tracked: !!t.tracked, idStrategy: t.idStrategy ? t.idStrategy : void 0 });
|
|
2862
2862
|
const s = (c) => {
|
|
2863
2863
|
const h = [], u = this._store.copyAll().filter((p) => !c.includes(p.id) || (h.push(p), !1));
|
|
2864
2864
|
return { changed: h, unchanged: u };
|
|
@@ -2902,9 +2902,9 @@ class eo {
|
|
|
2902
2902
|
}), t;
|
|
2903
2903
|
}
|
|
2904
2904
|
featuresAtLocation({ lng: t, lat: e }, i) {
|
|
2905
|
-
const o = i && i.pointerDistance !== void 0 ? i.pointerDistance : 30, s = !i || i.ignoreSelectFeatures === void 0 || i.ignoreSelectFeatures, n = !(!i || i.ignoreCoordinatePoints === void 0) && i.ignoreCoordinatePoints, a = !(!i || i.ignoreCurrentlyDrawing === void 0) && i.ignoreCurrentlyDrawing, l = !(!i || i.ignoreClosingPoints === void 0) && i.ignoreClosingPoints, d = this._adapter.unproject.bind(this._adapter), c = this._adapter.project.bind(this._adapter), h = c(t, e), u =
|
|
2905
|
+
const o = i && i.pointerDistance !== void 0 ? i.pointerDistance : 30, s = !i || i.ignoreSelectFeatures === void 0 || i.ignoreSelectFeatures, n = !(!i || i.ignoreCoordinatePoints === void 0) && i.ignoreCoordinatePoints, a = !(!i || i.ignoreCurrentlyDrawing === void 0) && i.ignoreCurrentlyDrawing, l = !(!i || i.ignoreClosingPoints === void 0) && i.ignoreClosingPoints, d = this._adapter.unproject.bind(this._adapter), c = this._adapter.project.bind(this._adapter), h = c(t, e), u = Fe({ unproject: d, point: h, pointerDistance: o });
|
|
2906
2906
|
return this._store.search(u).filter((p) => {
|
|
2907
|
-
if (s && (p.properties[k.MID_POINT] || p.properties[k.SELECTION_POINT]) || n && p.properties[
|
|
2907
|
+
if (s && (p.properties[k.MID_POINT] || p.properties[k.SELECTION_POINT]) || n && p.properties[It] || l && p.properties[J] || a && p.properties[D]) return !1;
|
|
2908
2908
|
if (p.geometry.type === "Point") {
|
|
2909
2909
|
const g = p.geometry.coordinates, y = c(g[0], g[1]);
|
|
2910
2910
|
return L(h, y) < o;
|
|
@@ -2913,16 +2913,16 @@ class eo {
|
|
|
2913
2913
|
const g = p.geometry.coordinates;
|
|
2914
2914
|
for (let y = 0; y < g.length - 1; y++) {
|
|
2915
2915
|
const m = g[y], v = g[y + 1];
|
|
2916
|
-
if (
|
|
2916
|
+
if (jt(h, c(m[0], m[1]), c(v[0], v[1])) < o) return !0;
|
|
2917
2917
|
}
|
|
2918
2918
|
return !1;
|
|
2919
2919
|
}
|
|
2920
|
-
if (
|
|
2920
|
+
if (je([t, e], p.geometry.coordinates)) return !0;
|
|
2921
2921
|
if (i != null && i.includePolygonsWithinPointerDistance) {
|
|
2922
2922
|
const g = p.geometry.coordinates;
|
|
2923
2923
|
for (const y of g) for (let m = 0; m < y.length - 1; m++) {
|
|
2924
2924
|
const v = y[m], C = y[m + 1], f = c(v[0], v[1]), P = c(C[0], C[1]);
|
|
2925
|
-
if (
|
|
2925
|
+
if (jt(h, f, P) < o) return !0;
|
|
2926
2926
|
}
|
|
2927
2927
|
}
|
|
2928
2928
|
return !1;
|
|
@@ -2939,7 +2939,7 @@ class eo {
|
|
|
2939
2939
|
return t && e !== this._instanceSelectMode && this.setMode(this._instanceSelectMode), this._modes[this._instanceSelectMode];
|
|
2940
2940
|
}
|
|
2941
2941
|
isGuidanceFeature(t) {
|
|
2942
|
-
return !!(t.properties[k.MID_POINT] || t.properties[k.SELECTION_POINT] || t.properties[
|
|
2942
|
+
return !!(t.properties[k.MID_POINT] || t.properties[k.SELECTION_POINT] || t.properties[It] || t.properties[xt]);
|
|
2943
2943
|
}
|
|
2944
2944
|
setModeStyles(t, e) {
|
|
2945
2945
|
if (this.checkEnabled(), !this._modes[t]) throw new Error("No mode with this name present");
|
|
@@ -2980,7 +2980,7 @@ class eo {
|
|
|
2980
2980
|
t.forEach((i) => {
|
|
2981
2981
|
if (!this._store.has(i)) throw new Error(`No feature with id ${i}, can not delete`);
|
|
2982
2982
|
const o = this._store.copy(i);
|
|
2983
|
-
o.properties[k.SELECTED] && this.deselectFeature(i), o.properties[
|
|
2983
|
+
o.properties[k.SELECTED] && this.deselectFeature(i), o.properties[ht] && e.push(...o.properties[ht]);
|
|
2984
2984
|
}), this._store.delete([...t, ...e], { origin: "api" });
|
|
2985
2985
|
}
|
|
2986
2986
|
selectFeature(t) {
|
|
@@ -3026,8 +3026,8 @@ class eo {
|
|
|
3026
3026
|
if (e.projection != "web-mercator") throw new Error(`Projection ${e.projection} is not currently supported for transformation`);
|
|
3027
3027
|
if (e.type === "scale") {
|
|
3028
3028
|
const { x: a, y: l } = I(e.origin[0], e.origin[1]);
|
|
3029
|
-
|
|
3030
|
-
} else e.type === "rotate" && (i =
|
|
3029
|
+
Te({ coordinates: n, originX: a, originY: l, xScale: e.options.xScale || 1, yScale: e.options.yScale || 1 });
|
|
3030
|
+
} else e.type === "rotate" && (i = We(i, e.options.angle || 0), n = i.geometry.type === "Polygon" ? i.geometry.coordinates[0] : i.geometry.coordinates);
|
|
3031
3031
|
if (n = n.map((a) => [w(a[0], this._adapter.getCoordinatePrecision()), w(a[1], this._adapter.getCoordinatePrecision())]), i.geometry.coordinates = i.geometry.type === "Polygon" ? [n] : n, this._store.updateGeometry([{ id: i.id, geometry: i.geometry }], { origin: "api" }), s.afterFeatureUpdated) {
|
|
3032
3032
|
s.afterFeatureUpdated(i);
|
|
3033
3033
|
const a = i.properties[k.SELECTED], l = this.getSelectMode({ switchToSelectMode: !1 });
|
|
@@ -3036,7 +3036,7 @@ class eo {
|
|
|
3036
3036
|
}
|
|
3037
3037
|
addFeatures(t) {
|
|
3038
3038
|
return this.checkEnabled(), t.length === 0 ? [] : this._store.load(t, (e) => {
|
|
3039
|
-
if (
|
|
3039
|
+
if (te(e)) {
|
|
3040
3040
|
const i = e.properties.mode, o = this._modes[i];
|
|
3041
3041
|
if (!o) return { id: e.id, valid: !1, reason: `${i} mode is not in the list of instantiated modes` };
|
|
3042
3042
|
const s = o.validateFeature.bind(o)(e);
|
|
@@ -3044,7 +3044,7 @@ class eo {
|
|
|
3044
3044
|
}
|
|
3045
3045
|
return { id: e.id, valid: !1, reason: "Mode property does not exist" };
|
|
3046
3046
|
}, (e) => {
|
|
3047
|
-
if (
|
|
3047
|
+
if (te(e)) {
|
|
3048
3048
|
const i = this._modes[e.properties.mode];
|
|
3049
3049
|
i && i.afterFeatureAdded && i.afterFeatureAdded(e);
|
|
3050
3050
|
}
|
|
@@ -3093,7 +3093,7 @@ class eo {
|
|
|
3093
3093
|
i.includes(e) && i.splice(i.indexOf(e), 1);
|
|
3094
3094
|
}
|
|
3095
3095
|
}
|
|
3096
|
-
class
|
|
3096
|
+
class so extends to.TerraDrawBaseAdapter {
|
|
3097
3097
|
constructor(t) {
|
|
3098
3098
|
super(t), this._renderBeforeLayerId = void 0, this._prefixId = void 0, this._initialDragPan = void 0, this._initialDragRotate = void 0, this._nextRender = void 0, this._map = void 0, this._container = void 0, this.changedIds = { deletion: !1, points: !1, linestrings: !1, polygons: !1, styling: !1 }, this._map = t.map, this._container = this._map.getContainer(), this._initialDragRotate = this._map.dragRotate.isEnabled(), this._initialDragPan = this._map.dragPan.isEnabled(), this._renderBeforeLayerId = t.renderBelowLayerId, this._prefixId = t.prefixId || "td";
|
|
3099
3099
|
}
|
|
@@ -3181,7 +3181,7 @@ class io extends Zi.TerraDrawBaseAdapter {
|
|
|
3181
3181
|
this._renderBeforeLayerId && (this._map.moveLayer(s, this._renderBeforeLayerId), this._map.moveLayer(o, s), this._map.moveLayer(i + "-outline", o), this._map.moveLayer(i, o)), (e = this._currentModeCallbacks) != null && e.onReady && this._currentModeCallbacks.onReady();
|
|
3182
3182
|
}
|
|
3183
3183
|
}
|
|
3184
|
-
const
|
|
3184
|
+
const $o = [
|
|
3185
3185
|
"render",
|
|
3186
3186
|
"point",
|
|
3187
3187
|
"linestring",
|
|
@@ -3197,7 +3197,7 @@ const zo = [
|
|
|
3197
3197
|
"delete-selection",
|
|
3198
3198
|
"delete",
|
|
3199
3199
|
"download"
|
|
3200
|
-
],
|
|
3200
|
+
], Ko = [
|
|
3201
3201
|
"render",
|
|
3202
3202
|
"linestring",
|
|
3203
3203
|
"point",
|
|
@@ -3206,7 +3206,7 @@ const zo = [
|
|
|
3206
3206
|
"delete",
|
|
3207
3207
|
"download",
|
|
3208
3208
|
"settings"
|
|
3209
|
-
],
|
|
3209
|
+
], ro = {
|
|
3210
3210
|
modes: [
|
|
3211
3211
|
"render",
|
|
3212
3212
|
"point",
|
|
@@ -3225,7 +3225,7 @@ const zo = [
|
|
|
3225
3225
|
"download"
|
|
3226
3226
|
],
|
|
3227
3227
|
open: !1
|
|
3228
|
-
},
|
|
3228
|
+
}, ct = {
|
|
3229
3229
|
modes: [
|
|
3230
3230
|
"render",
|
|
3231
3231
|
"point",
|
|
@@ -3246,7 +3246,7 @@ const zo = [
|
|
|
3246
3246
|
open: !1,
|
|
3247
3247
|
// see styling parameters of Terra Draw at https://github.com/JamesLMilner/terra-draw/blob/main/guides/5.STYLING.md
|
|
3248
3248
|
modeOptions: {
|
|
3249
|
-
point: new
|
|
3249
|
+
point: new Vt({
|
|
3250
3250
|
editable: !0,
|
|
3251
3251
|
styles: {
|
|
3252
3252
|
pointColor: "#FFFFFF",
|
|
@@ -3255,7 +3255,7 @@ const zo = [
|
|
|
3255
3255
|
pointOutlineWidth: 1
|
|
3256
3256
|
}
|
|
3257
3257
|
}),
|
|
3258
|
-
linestring: new
|
|
3258
|
+
linestring: new zt({
|
|
3259
3259
|
editable: !0,
|
|
3260
3260
|
styles: {
|
|
3261
3261
|
lineStringColor: "#666666",
|
|
@@ -3266,7 +3266,7 @@ const zo = [
|
|
|
3266
3266
|
closingPointOutlineWidth: 1
|
|
3267
3267
|
}
|
|
3268
3268
|
}),
|
|
3269
|
-
polygon: new
|
|
3269
|
+
polygon: new _e({
|
|
3270
3270
|
editable: !0,
|
|
3271
3271
|
styles: {
|
|
3272
3272
|
fillColor: "#EDEFF0",
|
|
@@ -3279,7 +3279,7 @@ const zo = [
|
|
|
3279
3279
|
closingPointOutlineWidth: 1
|
|
3280
3280
|
}
|
|
3281
3281
|
}),
|
|
3282
|
-
rectangle: new
|
|
3282
|
+
rectangle: new ke({
|
|
3283
3283
|
styles: {
|
|
3284
3284
|
fillColor: "#EDEFF0",
|
|
3285
3285
|
fillOpacity: 0.7,
|
|
@@ -3287,7 +3287,7 @@ const zo = [
|
|
|
3287
3287
|
outlineWidth: 2
|
|
3288
3288
|
}
|
|
3289
3289
|
}),
|
|
3290
|
-
"angled-rectangle": new
|
|
3290
|
+
"angled-rectangle": new Ae({
|
|
3291
3291
|
styles: {
|
|
3292
3292
|
fillColor: "#EDEFF0",
|
|
3293
3293
|
fillOpacity: 0.7,
|
|
@@ -3295,7 +3295,7 @@ const zo = [
|
|
|
3295
3295
|
outlineWidth: 2
|
|
3296
3296
|
}
|
|
3297
3297
|
}),
|
|
3298
|
-
circle: new
|
|
3298
|
+
circle: new Oe({
|
|
3299
3299
|
styles: {
|
|
3300
3300
|
fillColor: "#EDEFF0",
|
|
3301
3301
|
fillOpacity: 0.7,
|
|
@@ -3303,7 +3303,7 @@ const zo = [
|
|
|
3303
3303
|
outlineWidth: 2
|
|
3304
3304
|
}
|
|
3305
3305
|
}),
|
|
3306
|
-
freehand: new
|
|
3306
|
+
freehand: new Le({
|
|
3307
3307
|
styles: {
|
|
3308
3308
|
fillColor: "#EDEFF0",
|
|
3309
3309
|
fillOpacity: 0.7,
|
|
@@ -3315,7 +3315,7 @@ const zo = [
|
|
|
3315
3315
|
closingPointOutlineWidth: 1
|
|
3316
3316
|
}
|
|
3317
3317
|
}),
|
|
3318
|
-
"freehand-linestring": new
|
|
3318
|
+
"freehand-linestring": new Ve({
|
|
3319
3319
|
styles: {
|
|
3320
3320
|
lineStringColor: "#666666",
|
|
3321
3321
|
lineStringWidth: 2,
|
|
@@ -3325,7 +3325,7 @@ const zo = [
|
|
|
3325
3325
|
closingPointOutlineWidth: 1
|
|
3326
3326
|
}
|
|
3327
3327
|
}),
|
|
3328
|
-
sensor: new
|
|
3328
|
+
sensor: new ze({
|
|
3329
3329
|
styles: {
|
|
3330
3330
|
fillColor: "#EDEFF0",
|
|
3331
3331
|
fillOpacity: 0.7,
|
|
@@ -3337,7 +3337,7 @@ const zo = [
|
|
|
3337
3337
|
centerPointOutlineWidth: 1
|
|
3338
3338
|
}
|
|
3339
3339
|
}),
|
|
3340
|
-
sector: new
|
|
3340
|
+
sector: new Re({
|
|
3341
3341
|
styles: {
|
|
3342
3342
|
fillColor: "#EDEFF0",
|
|
3343
3343
|
fillOpacity: 0.7,
|
|
@@ -3345,7 +3345,7 @@ const zo = [
|
|
|
3345
3345
|
outlineWidth: 2
|
|
3346
3346
|
}
|
|
3347
3347
|
}),
|
|
3348
|
-
select: new
|
|
3348
|
+
select: new $t({
|
|
3349
3349
|
flags: {
|
|
3350
3350
|
point: {
|
|
3351
3351
|
feature: {
|
|
@@ -3611,6 +3611,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
|
|
|
3611
3611
|
distancePrecision: 2,
|
|
3612
3612
|
areaUnit: "metric",
|
|
3613
3613
|
areaPrecision: 2,
|
|
3614
|
+
forceAreaUnit: "auto",
|
|
3614
3615
|
elevationCacheConfig: {
|
|
3615
3616
|
enabled: !0,
|
|
3616
3617
|
maxSize: 1e3,
|
|
@@ -3636,7 +3637,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
|
|
|
3636
3637
|
open: !1,
|
|
3637
3638
|
// see styling parameters of Terra Draw at https://github.com/JamesLMilner/terra-draw/blob/main/guides/5.STYLING.md
|
|
3638
3639
|
modeOptions: {
|
|
3639
|
-
point: new
|
|
3640
|
+
point: new Vt({
|
|
3640
3641
|
editable: !1,
|
|
3641
3642
|
styles: {
|
|
3642
3643
|
pointColor: "#FFFFFF",
|
|
@@ -3645,7 +3646,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
|
|
|
3645
3646
|
pointOutlineWidth: 1
|
|
3646
3647
|
}
|
|
3647
3648
|
}),
|
|
3648
|
-
linestring: new
|
|
3649
|
+
linestring: new zt({
|
|
3649
3650
|
editable: !1,
|
|
3650
3651
|
styles: {
|
|
3651
3652
|
lineStringColor: "#FF0000",
|
|
@@ -3656,7 +3657,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
|
|
|
3656
3657
|
closingPointOutlineWidth: 1
|
|
3657
3658
|
}
|
|
3658
3659
|
}),
|
|
3659
|
-
select: new
|
|
3660
|
+
select: new $t({
|
|
3660
3661
|
flags: {
|
|
3661
3662
|
point: {
|
|
3662
3663
|
feature: {
|
|
@@ -3851,34 +3852,34 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
|
|
|
3851
3852
|
"text-halo-color": "rgb(255, 255, 255)"
|
|
3852
3853
|
}
|
|
3853
3854
|
}
|
|
3854
|
-
},
|
|
3855
|
+
}, no = () => ({
|
|
3855
3856
|
render: new et({
|
|
3856
3857
|
modeName: "render",
|
|
3857
3858
|
styles: {}
|
|
3858
3859
|
}),
|
|
3859
|
-
point: new
|
|
3860
|
+
point: new Vt({
|
|
3860
3861
|
editable: !0
|
|
3861
3862
|
}),
|
|
3862
|
-
linestring: new
|
|
3863
|
+
linestring: new zt({
|
|
3863
3864
|
editable: !0
|
|
3864
3865
|
}),
|
|
3865
|
-
polygon: new
|
|
3866
|
+
polygon: new _e({
|
|
3866
3867
|
editable: !0,
|
|
3867
3868
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3868
3869
|
// @ts-ignore
|
|
3869
3870
|
validation: (t, e) => {
|
|
3870
3871
|
const i = e.updateType;
|
|
3871
|
-
return i === "finish" || i === "commit" ?
|
|
3872
|
+
return i === "finish" || i === "commit" ? Xi(t) : { valid: !0 };
|
|
3872
3873
|
}
|
|
3873
3874
|
}),
|
|
3874
|
-
rectangle: new
|
|
3875
|
-
"angled-rectangle": new
|
|
3876
|
-
circle: new
|
|
3877
|
-
freehand: new
|
|
3878
|
-
"freehand-linestring": new
|
|
3879
|
-
sensor: new
|
|
3880
|
-
sector: new
|
|
3881
|
-
select: new
|
|
3875
|
+
rectangle: new ke(),
|
|
3876
|
+
"angled-rectangle": new Ae(),
|
|
3877
|
+
circle: new Oe(),
|
|
3878
|
+
freehand: new Le(),
|
|
3879
|
+
"freehand-linestring": new Ve(),
|
|
3880
|
+
sensor: new ze(),
|
|
3881
|
+
sector: new Re(),
|
|
3882
|
+
select: new $t({
|
|
3882
3883
|
flags: {
|
|
3883
3884
|
point: {
|
|
3884
3885
|
feature: {
|
|
@@ -4004,7 +4005,7 @@ Alt. `, ["to-string", ["floor", ["get", "elevation"]]], " m"],
|
|
|
4004
4005
|
styles: {}
|
|
4005
4006
|
})
|
|
4006
4007
|
});
|
|
4007
|
-
var j = 63710088e-1,
|
|
4008
|
+
var j = 63710088e-1, ao = {
|
|
4008
4009
|
centimeters: j * 100,
|
|
4009
4010
|
centimetres: j * 100,
|
|
4010
4011
|
degrees: 360 / (2 * Math.PI),
|
|
@@ -4021,37 +4022,37 @@ var j = 63710088e-1, ro = {
|
|
|
4021
4022
|
radians: 1,
|
|
4022
4023
|
yards: j * 1.0936
|
|
4023
4024
|
};
|
|
4024
|
-
function
|
|
4025
|
+
function lo(r, t, e = {}) {
|
|
4025
4026
|
const i = { type: "Feature" };
|
|
4026
4027
|
return (e.id === 0 || e.id) && (i.id = e.id), e.bbox && (i.bbox = e.bbox), i.properties = t || {}, i.geometry = r, i;
|
|
4027
4028
|
}
|
|
4028
|
-
function
|
|
4029
|
+
function co(r, t, e = {}) {
|
|
4029
4030
|
if (!r)
|
|
4030
4031
|
throw new Error("coordinates is required");
|
|
4031
4032
|
if (!Array.isArray(r))
|
|
4032
4033
|
throw new Error("coordinates must be an Array");
|
|
4033
4034
|
if (r.length < 2)
|
|
4034
4035
|
throw new Error("coordinates must be at least 2 numbers long");
|
|
4035
|
-
if (!
|
|
4036
|
+
if (!ye(r[0]) || !ye(r[1]))
|
|
4036
4037
|
throw new Error("coordinates must contain numbers");
|
|
4037
|
-
return
|
|
4038
|
+
return lo({
|
|
4038
4039
|
type: "Point",
|
|
4039
4040
|
coordinates: r
|
|
4040
4041
|
}, t, e);
|
|
4041
4042
|
}
|
|
4042
|
-
function
|
|
4043
|
-
const e =
|
|
4043
|
+
function ho(r, t = "kilometers") {
|
|
4044
|
+
const e = ao[t];
|
|
4044
4045
|
if (!e)
|
|
4045
4046
|
throw new Error(t + " units is invalid");
|
|
4046
4047
|
return r * e;
|
|
4047
4048
|
}
|
|
4048
|
-
function
|
|
4049
|
+
function St(r) {
|
|
4049
4050
|
return r % 360 * Math.PI / 180;
|
|
4050
4051
|
}
|
|
4051
|
-
function
|
|
4052
|
+
function ye(r) {
|
|
4052
4053
|
return !isNaN(r) && r !== null && !Array.isArray(r);
|
|
4053
4054
|
}
|
|
4054
|
-
function
|
|
4055
|
+
function $e(r, t, e) {
|
|
4055
4056
|
if (r !== null)
|
|
4056
4057
|
for (var i, o, s, n, a, l, d, c = 0, h = 0, u, p = r.type, g = p === "FeatureCollection", y = p === "Feature", m = g ? r.features.length : 1, v = 0; v < m; v++) {
|
|
4057
4058
|
d = g ? r.features[v].geometry : y ? r.geometry : r, u = d ? d.type === "GeometryCollection" : !1, a = u ? d.geometries.length : 1;
|
|
@@ -4128,7 +4129,7 @@ function ze(r, t, e) {
|
|
|
4128
4129
|
break;
|
|
4129
4130
|
case "GeometryCollection":
|
|
4130
4131
|
for (i = 0; i < n.geometries.length; i++)
|
|
4131
|
-
if (
|
|
4132
|
+
if ($e(n.geometries[i], t) === !1)
|
|
4132
4133
|
return !1;
|
|
4133
4134
|
break;
|
|
4134
4135
|
default:
|
|
@@ -4138,7 +4139,7 @@ function ze(r, t, e) {
|
|
|
4138
4139
|
}
|
|
4139
4140
|
}
|
|
4140
4141
|
}
|
|
4141
|
-
function
|
|
4142
|
+
function uo(r, t) {
|
|
4142
4143
|
var e, i, o, s, n, a, l, d, c, h, u = 0, p = r.type === "FeatureCollection", g = r.type === "Feature", y = p ? r.features.length : 1;
|
|
4143
4144
|
for (e = 0; e < y; e++) {
|
|
4144
4145
|
for (a = p ? r.features[e].geometry : g ? r.geometry : r, d = p ? r.features[e].properties : g ? r.properties : {}, c = p ? r.features[e].bbox : g ? r.bbox : void 0, h = p ? r.features[e].id : g ? r.id : void 0, l = a ? a.type === "GeometryCollection" : !1, n = l ? a.geometries.length : 1, o = 0; o < n; o++) {
|
|
@@ -4189,9 +4190,9 @@ function co(r, t) {
|
|
|
4189
4190
|
u++;
|
|
4190
4191
|
}
|
|
4191
4192
|
}
|
|
4192
|
-
function
|
|
4193
|
+
function po(r, t, e) {
|
|
4193
4194
|
var i = e;
|
|
4194
|
-
return
|
|
4195
|
+
return uo(
|
|
4195
4196
|
r,
|
|
4196
4197
|
function(o, s, n, a, l) {
|
|
4197
4198
|
s === 0 && e === void 0 ? i = o : i = t(
|
|
@@ -4205,21 +4206,21 @@ function ho(r, t, e) {
|
|
|
4205
4206
|
}
|
|
4206
4207
|
), i;
|
|
4207
4208
|
}
|
|
4208
|
-
function
|
|
4209
|
-
return
|
|
4209
|
+
function go(r) {
|
|
4210
|
+
return po(
|
|
4210
4211
|
r,
|
|
4211
|
-
(t, e) => t +
|
|
4212
|
+
(t, e) => t + yo(e),
|
|
4212
4213
|
0
|
|
4213
4214
|
);
|
|
4214
4215
|
}
|
|
4215
|
-
function
|
|
4216
|
+
function yo(r) {
|
|
4216
4217
|
let t = 0, e;
|
|
4217
4218
|
switch (r.type) {
|
|
4218
4219
|
case "Polygon":
|
|
4219
|
-
return
|
|
4220
|
+
return fe(r.coordinates);
|
|
4220
4221
|
case "MultiPolygon":
|
|
4221
4222
|
for (e = 0; e < r.coordinates.length; e++)
|
|
4222
|
-
t +=
|
|
4223
|
+
t += fe(r.coordinates[e]);
|
|
4223
4224
|
return t;
|
|
4224
4225
|
case "Point":
|
|
4225
4226
|
case "MultiPoint":
|
|
@@ -4229,36 +4230,81 @@ function po(r) {
|
|
|
4229
4230
|
}
|
|
4230
4231
|
return 0;
|
|
4231
4232
|
}
|
|
4232
|
-
function
|
|
4233
|
+
function fe(r) {
|
|
4233
4234
|
let t = 0;
|
|
4234
4235
|
if (r && r.length > 0) {
|
|
4235
|
-
t += Math.abs(
|
|
4236
|
+
t += Math.abs(me(r[0]));
|
|
4236
4237
|
for (let e = 1; e < r.length; e++)
|
|
4237
|
-
t -= Math.abs(
|
|
4238
|
+
t -= Math.abs(me(r[e]));
|
|
4238
4239
|
}
|
|
4239
4240
|
return t;
|
|
4240
4241
|
}
|
|
4241
|
-
var
|
|
4242
|
-
function
|
|
4242
|
+
var fo = j * j / 2, kt = Math.PI / 180;
|
|
4243
|
+
function me(r) {
|
|
4243
4244
|
const t = r.length - 1;
|
|
4244
4245
|
if (t <= 2) return 0;
|
|
4245
4246
|
let e = 0, i = 0;
|
|
4246
4247
|
for (; i < t; ) {
|
|
4247
|
-
const o = r[i], s = r[i + 1 === t ? 0 : i + 1], n = r[i + 2 >= t ? (i + 2) % t : i + 2], a = o[0] *
|
|
4248
|
+
const o = r[i], s = r[i + 1 === t ? 0 : i + 1], n = r[i + 2 >= t ? (i + 2) % t : i + 2], a = o[0] * kt, l = s[1] * kt, d = n[0] * kt;
|
|
4248
4249
|
e += (d - a) * Math.sin(l), i++;
|
|
4249
4250
|
}
|
|
4250
|
-
return e *
|
|
4251
|
+
return e * fo;
|
|
4251
4252
|
}
|
|
4252
|
-
var
|
|
4253
|
-
const
|
|
4253
|
+
var mo = go;
|
|
4254
|
+
const vo = (r, t, e = "auto") => {
|
|
4255
|
+
const i = ["m2", "km2", "a", "ha"], o = ["ft2", "yd2", "acre", "mi2"];
|
|
4256
|
+
let s = e;
|
|
4257
|
+
if (e !== "auto") {
|
|
4258
|
+
const n = i.includes(e), a = o.includes(e);
|
|
4259
|
+
(t === "metric" && !n || t === "imperial" && !a) && (s = "auto");
|
|
4260
|
+
}
|
|
4261
|
+
return t === "metric" ? s !== "auto" ? rt(r, s) : r >= 1e6 ? rt(r, "km2") : r >= 1e4 ? rt(r, "ha") : r >= 100 ? rt(r, "a") : rt(r, "m2") : s !== "auto" ? nt(r, s) : r >= 258998811e-2 ? nt(r, "mi2") : r >= 4046.856 ? nt(r, "acre") : r >= 0.83612736 ? nt(r, "yd2") : nt(r, "ft2");
|
|
4262
|
+
}, rt = (r, t) => {
|
|
4254
4263
|
let e = r, i = "m²";
|
|
4255
|
-
|
|
4256
|
-
|
|
4264
|
+
switch (t) {
|
|
4265
|
+
case "m2":
|
|
4266
|
+
e = r, i = "m²";
|
|
4267
|
+
break;
|
|
4268
|
+
case "a":
|
|
4269
|
+
e = r / 100, i = "a";
|
|
4270
|
+
break;
|
|
4271
|
+
case "ha":
|
|
4272
|
+
e = r / 1e4, i = "ha";
|
|
4273
|
+
break;
|
|
4274
|
+
case "km2":
|
|
4275
|
+
e = r / 1e6, i = "km²";
|
|
4276
|
+
break;
|
|
4277
|
+
}
|
|
4278
|
+
return {
|
|
4279
|
+
area: e,
|
|
4280
|
+
unit: i
|
|
4281
|
+
};
|
|
4282
|
+
}, nt = (r, t) => {
|
|
4283
|
+
let e = r / 258998811e-2, i = "m²";
|
|
4284
|
+
switch (t) {
|
|
4285
|
+
case "ft2":
|
|
4286
|
+
e = r / 0.09290304, i = "ft²";
|
|
4287
|
+
break;
|
|
4288
|
+
case "yd2":
|
|
4289
|
+
e = r / 0.83612736, i = "yd²";
|
|
4290
|
+
break;
|
|
4291
|
+
case "acre":
|
|
4292
|
+
e = r / 4046.856, i = "acre";
|
|
4293
|
+
break;
|
|
4294
|
+
case "mi2":
|
|
4295
|
+
e = r / 258998811e-2, i = "mi²";
|
|
4296
|
+
break;
|
|
4297
|
+
}
|
|
4298
|
+
return {
|
|
4299
|
+
area: e,
|
|
4300
|
+
unit: i
|
|
4301
|
+
};
|
|
4302
|
+
}, ve = (r, t, e, i) => {
|
|
4257
4303
|
if (r.geometry.type !== "Polygon") return r;
|
|
4258
|
-
const
|
|
4259
|
-
return
|
|
4304
|
+
const o = mo(r.geometry), s = vo(o, t, i);
|
|
4305
|
+
return s.area = parseFloat(s.area.toFixed(e)), r.properties.area = s.area, r.properties.unit = s.unit, r;
|
|
4260
4306
|
};
|
|
4261
|
-
function
|
|
4307
|
+
function Ce(r) {
|
|
4262
4308
|
if (!r)
|
|
4263
4309
|
throw new Error("coord is required");
|
|
4264
4310
|
if (!Array.isArray(r)) {
|
|
@@ -4271,15 +4317,15 @@ function me(r) {
|
|
|
4271
4317
|
return [...r];
|
|
4272
4318
|
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
4273
4319
|
}
|
|
4274
|
-
function
|
|
4275
|
-
var i =
|
|
4276
|
-
return
|
|
4320
|
+
function Co(r, t, e = {}) {
|
|
4321
|
+
var i = Ce(r), o = Ce(t), s = St(o[1] - i[1]), n = St(o[0] - i[0]), a = St(i[1]), l = St(o[1]), d = Math.pow(Math.sin(s / 2), 2) + Math.pow(Math.sin(n / 2), 2) * Math.cos(a) * Math.cos(l);
|
|
4322
|
+
return ho(
|
|
4277
4323
|
2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d)),
|
|
4278
4324
|
e.units
|
|
4279
4325
|
);
|
|
4280
4326
|
}
|
|
4281
|
-
var
|
|
4282
|
-
const
|
|
4327
|
+
var Po = Co;
|
|
4328
|
+
const Pe = (r) => r === "degrees" ? "°" : r === "miles" ? "mi" : r === "radians" ? "rad" : "km", Nt = (r) => {
|
|
4283
4329
|
if (r >= 1)
|
|
4284
4330
|
return {
|
|
4285
4331
|
distance: r,
|
|
@@ -4293,16 +4339,16 @@ const ve = (r) => r === "degrees" ? "°" : r === "miles" ? "mi" : r === "radians
|
|
|
4293
4339
|
distance: t * 100,
|
|
4294
4340
|
unit: "cm"
|
|
4295
4341
|
};
|
|
4296
|
-
},
|
|
4342
|
+
}, Se = (r, t, e, i, o, s) => {
|
|
4297
4343
|
if (r.geometry.type !== "LineString") return r;
|
|
4298
4344
|
const n = r.geometry.coordinates;
|
|
4299
4345
|
let a = 0;
|
|
4300
4346
|
const l = [];
|
|
4301
4347
|
for (let d = 0; d < n.length - 1; d++) {
|
|
4302
|
-
const c = n[d], h = n[d + 1], u =
|
|
4348
|
+
const c = n[d], h = n[d + 1], u = Po(c, h, { units: t });
|
|
4303
4349
|
a += u;
|
|
4304
4350
|
const p = JSON.parse(JSON.stringify(r));
|
|
4305
|
-
if (p.id = `${p.id}-${d}`, p.geometry.coordinates = [c, h], p.properties.originalId = r.id, p.properties.distance = u, p.properties.total = a, p.properties.unit =
|
|
4351
|
+
if (p.id = `${p.id}-${d}`, p.geometry.coordinates = [c, h], p.properties.originalId = r.id, p.properties.distance = u, p.properties.total = a, p.properties.unit = Pe(t), p.properties.totalUnit = Pe(t), o === !0 && s === void 0) {
|
|
4306
4352
|
const g = i?.queryTerrainElevation(c);
|
|
4307
4353
|
g && (p.properties.elevation_start = g);
|
|
4308
4354
|
const y = i?.queryTerrainElevation(h);
|
|
@@ -4311,12 +4357,12 @@ const ve = (r) => r === "degrees" ? "°" : r === "miles" ? "mi" : r === "radians
|
|
|
4311
4357
|
l.push(p);
|
|
4312
4358
|
}
|
|
4313
4359
|
if (r.properties.distance = l[l.length - 1].properties.total, r.properties.unit = l[l.length - 1].properties.unit, r.properties.segments = JSON.parse(JSON.stringify(l)), t === "kilometers") {
|
|
4314
|
-
const d =
|
|
4360
|
+
const d = Nt(r.properties.distance);
|
|
4315
4361
|
r.properties.distance = d.distance, r.properties.unit = d.unit, r.properties.segments.forEach(
|
|
4316
4362
|
(c) => {
|
|
4317
|
-
const h =
|
|
4363
|
+
const h = Nt(c.properties.distance);
|
|
4318
4364
|
c.properties.distance = h.distance, c.properties.unit = h.unit;
|
|
4319
|
-
const u =
|
|
4365
|
+
const u = Nt(c.properties.total);
|
|
4320
4366
|
c.properties.total = u.distance, c.properties.totalUnit = u.unit;
|
|
4321
4367
|
}
|
|
4322
4368
|
);
|
|
@@ -4332,25 +4378,25 @@ const ve = (r) => r === "degrees" ? "°" : r === "miles" ? "mi" : r === "radians
|
|
|
4332
4378
|
);
|
|
4333
4379
|
}
|
|
4334
4380
|
), r;
|
|
4335
|
-
},
|
|
4381
|
+
}, xe = (r) => r.charAt(0).toUpperCase() + r.slice(1), ot = [
|
|
4336
4382
|
"{prefix}-point",
|
|
4337
4383
|
"{prefix}-point-lower",
|
|
4338
4384
|
"{prefix}-linestring",
|
|
4339
4385
|
"{prefix}-polygon",
|
|
4340
4386
|
"{prefix}-polygon-outline"
|
|
4341
|
-
],
|
|
4387
|
+
], Xo = [
|
|
4342
4388
|
...ot,
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
],
|
|
4389
|
+
ct.polygonLayerSpec?.source,
|
|
4390
|
+
ct.lineLayerLabelSpec?.source,
|
|
4391
|
+
ct.pointLayerLabelSpec?.source
|
|
4392
|
+
], Yo = [
|
|
4347
4393
|
...ot,
|
|
4348
4394
|
V.routingLineLayerNodeLabelSpec?.source,
|
|
4349
4395
|
V.routingLineLayerNodeSpec?.source,
|
|
4350
4396
|
V.isochronePolygonLayerSpec?.source,
|
|
4351
4397
|
V.isochroneLineLayerSpec?.source,
|
|
4352
4398
|
V.isochroneLabelLayerSpec?.source
|
|
4353
|
-
],
|
|
4399
|
+
], Kt = (r, t, e = ot, i = "td") => {
|
|
4354
4400
|
e = e.map((s) => s.replace("{prefix}", i));
|
|
4355
4401
|
const o = JSON.parse(JSON.stringify(r));
|
|
4356
4402
|
return t && (t.onlyTerraDrawLayers === !0 ? (o.layers = o.layers.filter((s) => "source" in s && e.includes(s.source)), Object.keys(o.sources).forEach((s) => {
|
|
@@ -4358,13 +4404,13 @@ const ve = (r) => r === "degrees" ? "°" : r === "miles" ? "mi" : r === "radians
|
|
|
4358
4404
|
})) : t.excludeTerraDrawLayers === !0 && (o.layers = o.layers.filter((s) => "source" in s && !e.includes(s.source) || s.type === "background"), Object.keys(o.sources).forEach((s) => {
|
|
4359
4405
|
e.includes(s) && delete o.sources[s];
|
|
4360
4406
|
}))), o;
|
|
4361
|
-
},
|
|
4407
|
+
}, Ke = (r, t = 250) => {
|
|
4362
4408
|
let e;
|
|
4363
4409
|
return (...i) => {
|
|
4364
4410
|
clearTimeout(e), e = setTimeout(() => r(...i), t);
|
|
4365
4411
|
};
|
|
4366
4412
|
};
|
|
4367
|
-
class
|
|
4413
|
+
class Xe {
|
|
4368
4414
|
cache = /* @__PURE__ */ new Map();
|
|
4369
4415
|
maxSize;
|
|
4370
4416
|
ttl;
|
|
@@ -4442,7 +4488,7 @@ class $e {
|
|
|
4442
4488
|
};
|
|
4443
4489
|
}
|
|
4444
4490
|
}
|
|
4445
|
-
class
|
|
4491
|
+
class So {
|
|
4446
4492
|
className;
|
|
4447
4493
|
dialog;
|
|
4448
4494
|
title;
|
|
@@ -4531,7 +4577,7 @@ class Co {
|
|
|
4531
4577
|
}), o;
|
|
4532
4578
|
}
|
|
4533
4579
|
}
|
|
4534
|
-
const
|
|
4580
|
+
const Ie = (r, t, e, i) => {
|
|
4535
4581
|
if (r.geometry.type !== "Point") return r;
|
|
4536
4582
|
const o = r.geometry.coordinates;
|
|
4537
4583
|
if (e === !0 && i === void 0) {
|
|
@@ -4540,58 +4586,58 @@ const Se = (r, t, e, i) => {
|
|
|
4540
4586
|
}
|
|
4541
4587
|
return r;
|
|
4542
4588
|
};
|
|
4543
|
-
var
|
|
4544
|
-
function
|
|
4589
|
+
var xo = Object.defineProperty, Io = (r, t, e) => t in r ? xo(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, at = (r, t, e) => Io(r, typeof t != "symbol" ? t + "" : t, e), wt = 2 * Math.PI * 6378137 / 2;
|
|
4590
|
+
function bo(r) {
|
|
4545
4591
|
return r = r || 256, 2 * Math.PI * 6378137 / r;
|
|
4546
4592
|
}
|
|
4547
|
-
function
|
|
4548
|
-
r =
|
|
4549
|
-
var i = r[0], o = r[1], s = i *
|
|
4550
|
-
return n = n *
|
|
4593
|
+
function Eo(r, t, e = { enable: !0, decimal: 1 }) {
|
|
4594
|
+
r = Xt(r);
|
|
4595
|
+
var i = r[0], o = r[1], s = i * wt / 180, n = Math.log(Math.tan((90 + o) * Math.PI / 360)) / (Math.PI / 180);
|
|
4596
|
+
return n = n * wt / 180, e.enable && (s = Number(s.toFixed(e.decimal)), n = Number(n.toFixed(e.decimal))), [s, n];
|
|
4551
4597
|
}
|
|
4552
|
-
function
|
|
4553
|
-
var i = r[0], o = r[1], s =
|
|
4598
|
+
function wo(r, t, e) {
|
|
4599
|
+
var i = r[0], o = r[1], s = _o(t, e), n = (i + wt) / s, a = (o + wt) / s;
|
|
4554
4600
|
return [n, a, t];
|
|
4555
4601
|
}
|
|
4556
|
-
function
|
|
4557
|
-
r =
|
|
4558
|
-
var i =
|
|
4559
|
-
return
|
|
4602
|
+
function Ye(r, t, e) {
|
|
4603
|
+
r = Xt(r);
|
|
4604
|
+
var i = Eo(r), o = wo(i, t);
|
|
4605
|
+
return Lo(o);
|
|
4560
4606
|
}
|
|
4561
|
-
function
|
|
4562
|
-
if (r =
|
|
4607
|
+
function Oo(r, t, e) {
|
|
4608
|
+
if (r = Xt(r), t === 0)
|
|
4563
4609
|
return [0, 0, 0];
|
|
4564
|
-
var i =
|
|
4565
|
-
return
|
|
4610
|
+
var i = Ye(r, t);
|
|
4611
|
+
return Fo(i);
|
|
4566
4612
|
}
|
|
4567
|
-
function
|
|
4613
|
+
function Lo(r, t, e) {
|
|
4568
4614
|
t = t || 256;
|
|
4569
4615
|
var i = r[0], o = r[1], s = r[2];
|
|
4570
4616
|
if (s === 0) return [0, 0, 0];
|
|
4571
|
-
|
|
4617
|
+
He(s);
|
|
4572
4618
|
var n = Math.ceil(i / t) - 1, a = Math.ceil(o / t) - 1;
|
|
4573
4619
|
return n < 0 && (n = 0), a < 0 && (a = 0), [n, a, s];
|
|
4574
4620
|
}
|
|
4575
|
-
function
|
|
4576
|
-
|
|
4621
|
+
function Fo(r, t) {
|
|
4622
|
+
Mo(r);
|
|
4577
4623
|
var e = r[0], i = r[1], o = r[2];
|
|
4578
4624
|
if (o === 0)
|
|
4579
4625
|
return [0, 0, 0];
|
|
4580
4626
|
var s = e, n = Math.pow(2, o) - 1 - i;
|
|
4581
4627
|
return [s, n, o];
|
|
4582
4628
|
}
|
|
4583
|
-
function
|
|
4629
|
+
function Mo(r, t) {
|
|
4584
4630
|
var e = r[0], i = r[1], o = r[2];
|
|
4585
4631
|
if (o == null) throw new Error("<zoom> is required");
|
|
4586
4632
|
if (e == null) throw new Error("<x> is required");
|
|
4587
4633
|
if (i == null) throw new Error("<y> is required");
|
|
4588
|
-
return o =
|
|
4634
|
+
return o = He(o), r = Do(r), r;
|
|
4589
4635
|
}
|
|
4590
|
-
function
|
|
4636
|
+
function Do(r) {
|
|
4591
4637
|
var t = r[0], e = r[1], i = r[2], o = Math.pow(2, i);
|
|
4592
4638
|
return t = t % o, t < 0 && (t = t + o), [t, e, i];
|
|
4593
4639
|
}
|
|
4594
|
-
function
|
|
4640
|
+
function He(r) {
|
|
4595
4641
|
if (r === !1) return r;
|
|
4596
4642
|
if (r == null)
|
|
4597
4643
|
throw new Error("<zoom> is required");
|
|
@@ -4601,22 +4647,22 @@ function Xe(r) {
|
|
|
4601
4647
|
throw new Error("<zoom> cannot be greater than 32");
|
|
4602
4648
|
return r;
|
|
4603
4649
|
}
|
|
4604
|
-
function
|
|
4605
|
-
var e =
|
|
4650
|
+
function Xt(r, t) {
|
|
4651
|
+
var e = No(r[0]), i = ko(r[1]);
|
|
4606
4652
|
return i > 85 && (i = 85), i < -85 && (i = -85), [e, i];
|
|
4607
4653
|
}
|
|
4608
|
-
function
|
|
4609
|
-
return
|
|
4654
|
+
function _o(r, t) {
|
|
4655
|
+
return bo(t) / Math.pow(2, r);
|
|
4610
4656
|
}
|
|
4611
|
-
function
|
|
4657
|
+
function ko(r) {
|
|
4612
4658
|
if (r == null) throw new Error("lat is required");
|
|
4613
4659
|
return (r > 90 || r < -90) && (r = r % 180, r > 90 && (r = -180 + r), r < -90 && (r = 180 + r), r === 0 && (r = 0)), r;
|
|
4614
4660
|
}
|
|
4615
|
-
function
|
|
4661
|
+
function No(r) {
|
|
4616
4662
|
if (r == null) throw new Error("lng is required");
|
|
4617
4663
|
return (r > 180 || r < -180) && (r = r % 360, r > 180 && (r = -360 + r), r < -180 && (r = 360 + r), r === 0 && (r = 0)), r;
|
|
4618
4664
|
}
|
|
4619
|
-
class
|
|
4665
|
+
class Je {
|
|
4620
4666
|
/**
|
|
4621
4667
|
* Constructor
|
|
4622
4668
|
* @param url URL for terrain RGB raster tilesets
|
|
@@ -4627,7 +4673,7 @@ class Ye {
|
|
|
4627
4673
|
* @param tms whether it is Tile Map Service
|
|
4628
4674
|
*/
|
|
4629
4675
|
constructor(t, e, i, o, s) {
|
|
4630
|
-
|
|
4676
|
+
at(this, "url"), at(this, "tileSize"), at(this, "tms"), at(this, "minzoom"), at(this, "maxzoom"), this.url = t, this.tileSize = e, this.tms = s, this.minzoom = i, this.maxzoom = o, this.tms = s;
|
|
4631
4677
|
}
|
|
4632
4678
|
/**
|
|
4633
4679
|
* Get the value from target coordinates and zoom level by using certain formula.
|
|
@@ -4641,7 +4687,7 @@ class Ye {
|
|
|
4641
4687
|
const s = t[0], n = t[1];
|
|
4642
4688
|
let a = e;
|
|
4643
4689
|
e > this.maxzoom ? a = this.maxzoom : e < this.minzoom && (a = this.minzoom);
|
|
4644
|
-
const l = this.tms ?
|
|
4690
|
+
const l = this.tms ? Ye([s, n], a) : Oo([s, n], a), d = this.url.replace(/{x}/g, l[0].toString()).replace(/{y}/g, l[1].toString()).replace(/{z}/g, l[2].toString());
|
|
4645
4691
|
let c = this.getUrlExtension(d);
|
|
4646
4692
|
switch (c || (c = "png"), c) {
|
|
4647
4693
|
case "png":
|
|
@@ -4743,7 +4789,7 @@ class Ye {
|
|
|
4743
4789
|
return i * Math.atan(0.5 * (Math.exp(o) - Math.exp(-o)));
|
|
4744
4790
|
}
|
|
4745
4791
|
}
|
|
4746
|
-
class
|
|
4792
|
+
class Bo extends Je {
|
|
4747
4793
|
/**
|
|
4748
4794
|
* Constructor
|
|
4749
4795
|
* @param url URL for terrain RGB raster tilesets
|
|
@@ -4775,7 +4821,7 @@ class ko extends Ye {
|
|
|
4775
4821
|
return -1e4 + (t * 256 * 256 + e * 256 + i) * 0.1;
|
|
4776
4822
|
}
|
|
4777
4823
|
}
|
|
4778
|
-
class
|
|
4824
|
+
class jo extends Je {
|
|
4779
4825
|
/**
|
|
4780
4826
|
* Constructor
|
|
4781
4827
|
* @param url URL for terrarium raster tilesets
|
|
@@ -4809,10 +4855,10 @@ class No extends Ye {
|
|
|
4809
4855
|
return parseInt(o.toFixed(0));
|
|
4810
4856
|
}
|
|
4811
4857
|
}
|
|
4812
|
-
const
|
|
4858
|
+
const Wo = (r, t = 8) => {
|
|
4813
4859
|
const [e, i] = r, o = Math.pow(10, t), s = Math.round(e * o) / o, n = Math.round(i * o) / o;
|
|
4814
4860
|
return `${s},${n}`;
|
|
4815
|
-
},
|
|
4861
|
+
}, be = async (r, t, e, i) => {
|
|
4816
4862
|
const o = [], s = {
|
|
4817
4863
|
enabled: !0,
|
|
4818
4864
|
maxSize: 1e3,
|
|
@@ -4822,19 +4868,19 @@ const Bo = (r, t = 8) => {
|
|
|
4822
4868
|
...e
|
|
4823
4869
|
};
|
|
4824
4870
|
let n;
|
|
4825
|
-
s.enabled && (n = i || new
|
|
4871
|
+
s.enabled && (n = i || new Xe(s.maxSize, s.ttl));
|
|
4826
4872
|
let a, l = 15;
|
|
4827
4873
|
if (t) {
|
|
4828
4874
|
const d = t.url, c = t.encoding ?? "mapbox", h = t.tileSize ?? 512, u = t.minzoom ?? 5;
|
|
4829
4875
|
l = t.maxzoom ?? 15;
|
|
4830
4876
|
const p = t.tms ?? !1;
|
|
4831
|
-
a = c === "mapbox" ? new
|
|
4877
|
+
a = c === "mapbox" ? new Bo(d, h, u, l, p) : new jo(d, h, u, l, p);
|
|
4832
4878
|
}
|
|
4833
4879
|
for (const d of r)
|
|
4834
4880
|
o.push(
|
|
4835
4881
|
new Promise((c) => {
|
|
4836
4882
|
d.geometry.type !== "Point" && c(d);
|
|
4837
|
-
const h = d.geometry.coordinates, u =
|
|
4883
|
+
const h = d.geometry.coordinates, u = Wo(h, s.precision);
|
|
4838
4884
|
if (n) {
|
|
4839
4885
|
const p = n.get(u);
|
|
4840
4886
|
if (p !== void 0) {
|
|
@@ -4850,7 +4896,7 @@ const Bo = (r, t = 8) => {
|
|
|
4850
4896
|
})
|
|
4851
4897
|
);
|
|
4852
4898
|
return await Promise.all(o);
|
|
4853
|
-
},
|
|
4899
|
+
}, Ho = (r, t = 9) => {
|
|
4854
4900
|
function e(o) {
|
|
4855
4901
|
return [Number(o[0].toFixed(t)), Number(o[1].toFixed(t))];
|
|
4856
4902
|
}
|
|
@@ -4884,11 +4930,11 @@ const Bo = (r, t = 8) => {
|
|
|
4884
4930
|
...o,
|
|
4885
4931
|
geometry: i(o.geometry)
|
|
4886
4932
|
}));
|
|
4887
|
-
},
|
|
4933
|
+
}, To = [
|
|
4888
4934
|
{ value: "time", label: "Time" },
|
|
4889
4935
|
{ value: "distance", label: "Distance" }
|
|
4890
4936
|
];
|
|
4891
|
-
class
|
|
4937
|
+
class Go {
|
|
4892
4938
|
url;
|
|
4893
4939
|
/**
|
|
4894
4940
|
* Constructor
|
|
@@ -4920,15 +4966,15 @@ class Wo {
|
|
|
4920
4966
|
return await (await fetch(l)).json();
|
|
4921
4967
|
}
|
|
4922
4968
|
}
|
|
4923
|
-
const
|
|
4969
|
+
const Tt = [
|
|
4924
4970
|
{ value: "pedestrian", label: "Pedestrian" },
|
|
4925
4971
|
{ value: "bicycle", label: "Bicycle" },
|
|
4926
4972
|
{ value: "auto", label: "Car" }
|
|
4927
|
-
],
|
|
4973
|
+
], Ao = [
|
|
4928
4974
|
{ value: "kilometers", label: "km" },
|
|
4929
4975
|
{ value: "miles", label: "mile" }
|
|
4930
4976
|
];
|
|
4931
|
-
class
|
|
4977
|
+
class Uo {
|
|
4932
4978
|
tripData = [];
|
|
4933
4979
|
/**
|
|
4934
4980
|
* get the raw trip data from the valhalla routing API.
|
|
@@ -5007,7 +5053,7 @@ class Go {
|
|
|
5007
5053
|
maneuvers: f.maneuvers
|
|
5008
5054
|
};
|
|
5009
5055
|
});
|
|
5010
|
-
const m =
|
|
5056
|
+
const m = Tt.find((f) => f.value === e)?.label, v = this.geoLineString(h, {
|
|
5011
5057
|
costingModel: m,
|
|
5012
5058
|
distance: u,
|
|
5013
5059
|
distance_unit: i === "kilometers" ? "km" : "mi",
|
|
@@ -5082,7 +5128,7 @@ class Go {
|
|
|
5082
5128
|
return n;
|
|
5083
5129
|
}
|
|
5084
5130
|
}
|
|
5085
|
-
class
|
|
5131
|
+
class qe {
|
|
5086
5132
|
controlContainer;
|
|
5087
5133
|
map;
|
|
5088
5134
|
modeButtons = {};
|
|
@@ -5121,7 +5167,7 @@ class He {
|
|
|
5121
5167
|
i && i.length > 0 && (this.isExpanded ? i.item(0)?.classList.add("enabled") : (i.item(0)?.classList.remove("enabled"), this.resetActiveMode())), this.toggleDeleteSelectionButton(), this.toggleButtonsWhenNoFeature(), this.isExpanded ? this.dispatchEvent("expanded") : this.dispatchEvent("collapsed");
|
|
5122
5168
|
}
|
|
5123
5169
|
terradraw;
|
|
5124
|
-
options =
|
|
5170
|
+
options = ro;
|
|
5125
5171
|
events = {};
|
|
5126
5172
|
defaultMode = "render";
|
|
5127
5173
|
/**
|
|
@@ -5149,7 +5195,7 @@ class He {
|
|
|
5149
5195
|
if (this.options && this.options.modes && this.options.modes.length === 0)
|
|
5150
5196
|
throw new Error("At least a mode must be enabled.");
|
|
5151
5197
|
this.map = t;
|
|
5152
|
-
const e =
|
|
5198
|
+
const e = no(), i = [];
|
|
5153
5199
|
return this.options?.modes?.forEach((o) => {
|
|
5154
5200
|
if (this.options.modeOptions && this.options.modeOptions[o]) {
|
|
5155
5201
|
const s = this.options.modeOptions[o];
|
|
@@ -5171,8 +5217,8 @@ class He {
|
|
|
5171
5217
|
modeName: "default",
|
|
5172
5218
|
styles: {}
|
|
5173
5219
|
})
|
|
5174
|
-
), this.defaultMode = "default"), this.isExpanded = this.options.open === !0, this.terradraw = new
|
|
5175
|
-
adapter: new
|
|
5220
|
+
), this.defaultMode = "default"), this.isExpanded = this.options.open === !0, this.terradraw = new oo({
|
|
5221
|
+
adapter: new so({ map: t, ...this.options.adapterOptions }),
|
|
5176
5222
|
modes: i
|
|
5177
5223
|
}), this.map?.loaded() ? this.terradraw.start() : this.map?.once("load", () => {
|
|
5178
5224
|
this.terradraw?.start();
|
|
@@ -5270,7 +5316,7 @@ class He {
|
|
|
5270
5316
|
*/
|
|
5271
5317
|
addTerradrawButton(t) {
|
|
5272
5318
|
const e = document.createElement("button");
|
|
5273
|
-
e.type = "button", this.modeButtons[t] = e, t === "render" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), this.isExpanded && e.classList.add("enabled"), e.type = "button", e.title =
|
|
5319
|
+
e.type = "button", this.modeButtons[t] = e, t === "render" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), this.isExpanded && e.classList.add("enabled"), e.type = "button", e.title = xe("expand or collapse drawing tool"), e.addEventListener("click", this.toggleEditor.bind(this))) : (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}add-control`), this.isExpanded || e.classList.add("hidden"), e.title = xe(t.replace(/-/g, " ")), t === "delete" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), e.addEventListener("click", () => {
|
|
5274
5320
|
this.terradraw && this.terradraw.enabled && (this.terradraw.clear(), this.deactivate(), this.toggleDeleteSelectionButton(), this.toggleButtonsWhenNoFeature(), this.dispatchEvent("feature-deleted"));
|
|
5275
5321
|
})) : t === "delete-selection" ? (e.classList.add(`maplibregl-terradraw-${this.cssPrefix}${t}-button`), e.classList.add("hidden-delete-selection"), e.addEventListener("click", () => {
|
|
5276
5322
|
if (!this.terradraw || !this.terradraw.enabled) return;
|
|
@@ -5318,7 +5364,7 @@ class He {
|
|
|
5318
5364
|
* @returns
|
|
5319
5365
|
*/
|
|
5320
5366
|
cleanStyle(t, e) {
|
|
5321
|
-
return
|
|
5367
|
+
return Kt(
|
|
5322
5368
|
t,
|
|
5323
5369
|
e,
|
|
5324
5370
|
ot,
|
|
@@ -5385,16 +5431,16 @@ class He {
|
|
|
5385
5431
|
}
|
|
5386
5432
|
}
|
|
5387
5433
|
}
|
|
5388
|
-
function
|
|
5434
|
+
function Ro(r, t = {}) {
|
|
5389
5435
|
let e = 0, i = 0, o = 0;
|
|
5390
|
-
return
|
|
5436
|
+
return $e(
|
|
5391
5437
|
r,
|
|
5392
5438
|
function(s) {
|
|
5393
5439
|
e += s[0], i += s[1], o++;
|
|
5394
5440
|
}
|
|
5395
|
-
),
|
|
5441
|
+
), co([e / o, i / o], t.properties);
|
|
5396
5442
|
}
|
|
5397
|
-
class
|
|
5443
|
+
class Jo extends qe {
|
|
5398
5444
|
measureOptions;
|
|
5399
5445
|
elevationCache;
|
|
5400
5446
|
/**
|
|
@@ -5439,6 +5485,16 @@ class Yo extends He {
|
|
|
5439
5485
|
const e = this.measureOptions.areaPrecision === t;
|
|
5440
5486
|
this.measureOptions.areaPrecision = t, e || this.recalc();
|
|
5441
5487
|
}
|
|
5488
|
+
/**
|
|
5489
|
+
* Default is `auto`. If `auto` is set, unit is converted depending on the value and selection of area unit. If a specific unit is specified, it returns the value always the same. If a selected unit is not the same type of unit either metric of imperial, it will be ignored, and `auto` will be applied.
|
|
5490
|
+
*/
|
|
5491
|
+
get forceAreaUnit() {
|
|
5492
|
+
return this.measureOptions.forceAreaUnit ?? "auto";
|
|
5493
|
+
}
|
|
5494
|
+
set forceAreaUnit(t) {
|
|
5495
|
+
const e = this.measureOptions.forceAreaUnit === t;
|
|
5496
|
+
this.measureOptions.forceAreaUnit = t, e || this.recalc();
|
|
5497
|
+
}
|
|
5442
5498
|
/**
|
|
5443
5499
|
* The flag of whether computing elevation. Default is false.
|
|
5444
5500
|
* Using setter to override the value if you want.
|
|
@@ -5491,8 +5547,8 @@ class Yo extends He {
|
|
|
5491
5547
|
*/
|
|
5492
5548
|
constructor(t) {
|
|
5493
5549
|
let e = {
|
|
5494
|
-
...JSON.parse(JSON.stringify(
|
|
5495
|
-
modeOptions: { ...
|
|
5550
|
+
...JSON.parse(JSON.stringify(ct)),
|
|
5551
|
+
modeOptions: { ...ct.modeOptions }
|
|
5496
5552
|
};
|
|
5497
5553
|
t && (e = Object.assign(e, t));
|
|
5498
5554
|
const i = e.adapterOptions?.prefixId ?? "td-measure";
|
|
@@ -5501,7 +5557,7 @@ class Yo extends He {
|
|
|
5501
5557
|
open: e.open,
|
|
5502
5558
|
modeOptions: e.modeOptions,
|
|
5503
5559
|
adapterOptions: e.adapterOptions
|
|
5504
|
-
}), this._cssPrefix = "measure-", this.measureOptions = e, this.measureOptions.elevationCacheConfig && this.measureOptions.elevationCacheConfig?.enabled && (this.elevationCache = new
|
|
5560
|
+
}), this._cssPrefix = "measure-", this.measureOptions = e, this.measureOptions.elevationCacheConfig && this.measureOptions.elevationCacheConfig?.enabled && (this.elevationCache = new Xe(
|
|
5505
5561
|
this.measureOptions.elevationCacheConfig.maxSize,
|
|
5506
5562
|
this.measureOptions.elevationCacheConfig.ttl
|
|
5507
5563
|
));
|
|
@@ -5572,7 +5628,7 @@ class Yo extends He {
|
|
|
5572
5628
|
const s = this.measureOptions.lineLayerLabelSpec?.source;
|
|
5573
5629
|
s && i.push(s);
|
|
5574
5630
|
const n = this.measureOptions.pointLayerLabelSpec?.source;
|
|
5575
|
-
return n && i.push(n),
|
|
5631
|
+
return n && i.push(n), Kt(
|
|
5576
5632
|
t,
|
|
5577
5633
|
e,
|
|
5578
5634
|
i,
|
|
@@ -5655,7 +5711,7 @@ class Yo extends He {
|
|
|
5655
5711
|
* Handle finish event of terradraw. It will be called after finishing adding a feature
|
|
5656
5712
|
* @param id Feature ID
|
|
5657
5713
|
*/
|
|
5658
|
-
handleTerradrawFeatureReady =
|
|
5714
|
+
handleTerradrawFeatureReady = Ke((t) => {
|
|
5659
5715
|
this.map && (this.computeElevationByLineFeatureID(t), this.computeElevationByPointFeatureID(t));
|
|
5660
5716
|
}, 300);
|
|
5661
5717
|
/**
|
|
@@ -5754,7 +5810,7 @@ class Yo extends He {
|
|
|
5754
5810
|
(o) => o.properties?.originalId === t && o.geometry.type === "Point"
|
|
5755
5811
|
);
|
|
5756
5812
|
if (i && i.length > 0) {
|
|
5757
|
-
const o = await
|
|
5813
|
+
const o = await be(
|
|
5758
5814
|
i,
|
|
5759
5815
|
this.measureOptions.terrainSource,
|
|
5760
5816
|
this.measureOptions.elevationCacheConfig,
|
|
@@ -5781,7 +5837,7 @@ class Yo extends He {
|
|
|
5781
5837
|
(o) => o.id === t && o.geometry.type === "Point" && o.properties?.mode === "point"
|
|
5782
5838
|
);
|
|
5783
5839
|
if (i && i.length > 0) {
|
|
5784
|
-
const o = await
|
|
5840
|
+
const o = await be(
|
|
5785
5841
|
i,
|
|
5786
5842
|
this.measureOptions.terrainSource,
|
|
5787
5843
|
this.measureOptions.elevationCacheConfig,
|
|
@@ -5812,7 +5868,7 @@ class Yo extends He {
|
|
|
5812
5868
|
(a) => a.properties?.originalId !== t
|
|
5813
5869
|
));
|
|
5814
5870
|
const n = JSON.parse(JSON.stringify(o));
|
|
5815
|
-
n.id = n.id + "-area-label", n.geometry =
|
|
5871
|
+
n.id = n.id + "-area-label", n.geometry = Ro(o.geometry).geometry, n.properties.originalId = o.id, o = ve(o, this.areaUnit, this.areaPrecision, this.forceAreaUnit), n.properties.area = o.properties.area, n.properties.unit = o.properties.unit, typeof s.data != "string" && s.data.type === "FeatureCollection" && s.data.features.push(n), this.map.getSource(
|
|
5816
5872
|
this.measureOptions.polygonLayerSpec.source
|
|
5817
5873
|
)?.setData(s.data), this.map.moveLayer(this.measureOptions.polygonLayerSpec.id), this.map.getLayer(this.measureOptions.lineLayerLabelSpec.id) && this.map.moveLayer(
|
|
5818
5874
|
this.measureOptions.lineLayerLabelSpec.id
|
|
@@ -5842,7 +5898,7 @@ class Yo extends He {
|
|
|
5842
5898
|
if (s) {
|
|
5843
5899
|
typeof s.data != "string" && s.data.type === "FeatureCollection" && (s.data.features = s.data.features.filter(
|
|
5844
5900
|
(a) => a.properties?.originalId !== t
|
|
5845
|
-
)), o =
|
|
5901
|
+
)), o = Se(
|
|
5846
5902
|
o,
|
|
5847
5903
|
this.distanceUnit,
|
|
5848
5904
|
this.distancePrecision,
|
|
@@ -5891,7 +5947,7 @@ class Yo extends He {
|
|
|
5891
5947
|
let o = e.getSnapshot()?.find((s) => s.id === t && s.geometry.type === "Point");
|
|
5892
5948
|
if (o) {
|
|
5893
5949
|
const s = this.map.getStyle().sources[this.measureOptions.pointLayerLabelSpec.source];
|
|
5894
|
-
s && (typeof s.data != "string" && s.data.type === "FeatureCollection" && (s.data.features = s.data.features.filter((n) => n.id !== t)), o =
|
|
5950
|
+
s && (typeof s.data != "string" && s.data.type === "FeatureCollection" && (s.data.features = s.data.features.filter((n) => n.id !== t)), o = Ie(
|
|
5895
5951
|
o,
|
|
5896
5952
|
this.map,
|
|
5897
5953
|
this.computeElevation,
|
|
@@ -5936,14 +5992,14 @@ class Yo extends He {
|
|
|
5936
5992
|
const o = e.features[i];
|
|
5937
5993
|
if (!this.map || !this.map.loaded()) continue;
|
|
5938
5994
|
const s = o.geometry.type;
|
|
5939
|
-
s === "LineString" ? e.features[i] =
|
|
5995
|
+
s === "LineString" ? e.features[i] = Se(
|
|
5940
5996
|
o,
|
|
5941
5997
|
this.distanceUnit,
|
|
5942
5998
|
this.distancePrecision,
|
|
5943
5999
|
this.map,
|
|
5944
6000
|
this.computeElevation,
|
|
5945
6001
|
this.measureOptions.terrainSource
|
|
5946
|
-
) : s === "Polygon" ? e.features[i] =
|
|
6002
|
+
) : s === "Polygon" ? e.features[i] = ve(o, this.areaUnit, this.areaPrecision, this.forceAreaUnit) : s === "Point" && (e.features[i] = Ie(
|
|
5947
6003
|
o,
|
|
5948
6004
|
this.map,
|
|
5949
6005
|
this.computeElevation,
|
|
@@ -5953,7 +6009,7 @@ class Yo extends He {
|
|
|
5953
6009
|
return e;
|
|
5954
6010
|
}
|
|
5955
6011
|
}
|
|
5956
|
-
class
|
|
6012
|
+
class qo extends qe {
|
|
5957
6013
|
controlOptions;
|
|
5958
6014
|
valhallaOptions;
|
|
5959
6015
|
_modalDialog;
|
|
@@ -6152,13 +6208,13 @@ class Ho extends He {
|
|
|
6152
6208
|
const i = ot, o = this.controlOptions.routingLineLayerNodeSpec?.source;
|
|
6153
6209
|
o && i.push(o);
|
|
6154
6210
|
const s = this.controlOptions.isochronePolygonLayerSpec?.source;
|
|
6155
|
-
return s && i.push(s),
|
|
6211
|
+
return s && i.push(s), Kt(t, e, i, this.options.adapterOptions?.prefixId);
|
|
6156
6212
|
}
|
|
6157
6213
|
/**
|
|
6158
6214
|
* Create the settings dialog for Valhalla control
|
|
6159
6215
|
*/
|
|
6160
6216
|
createSettingsDialog() {
|
|
6161
|
-
this.settingDialog = new
|
|
6217
|
+
this.settingDialog = new So(
|
|
6162
6218
|
`maplibregl-terradraw-${this.cssPrefix}settings-dialog`,
|
|
6163
6219
|
"Settings"
|
|
6164
6220
|
), this.settingDialog.create(
|
|
@@ -6200,7 +6256,7 @@ class Ho extends He {
|
|
|
6200
6256
|
const i = document.createElement("label");
|
|
6201
6257
|
i.textContent = "Means of Transport", i.classList.add("setting-label"), e.appendChild(i), e.appendChild(
|
|
6202
6258
|
this.settingDialog.createSegmentButtons(
|
|
6203
|
-
|
|
6259
|
+
Tt,
|
|
6204
6260
|
this.routingCostingModel,
|
|
6205
6261
|
(n) => {
|
|
6206
6262
|
this.valhallaOptions.routingOptions || (this.valhallaOptions.routingOptions = {}), this.valhallaOptions.routingOptions.costingModel = n, this.dispatchEvent("setting-changed");
|
|
@@ -6212,7 +6268,7 @@ class Ho extends He {
|
|
|
6212
6268
|
const s = document.createElement("label");
|
|
6213
6269
|
return s.textContent = "Distance Unit", s.classList.add("setting-label"), o.appendChild(s), o.appendChild(
|
|
6214
6270
|
this.settingDialog.createSegmentButtons(
|
|
6215
|
-
|
|
6271
|
+
Ao,
|
|
6216
6272
|
this.routingDistanceUnit,
|
|
6217
6273
|
(n) => {
|
|
6218
6274
|
this.valhallaOptions.routingOptions || (this.valhallaOptions.routingOptions = {}), this.valhallaOptions.routingOptions.distanceUnit = n, this.dispatchEvent("setting-changed");
|
|
@@ -6229,7 +6285,7 @@ class Ho extends He {
|
|
|
6229
6285
|
const i = document.createElement("label");
|
|
6230
6286
|
i.textContent = "Contour Type", i.classList.add("setting-label"), e.appendChild(i), e.appendChild(
|
|
6231
6287
|
this.settingDialog.createSegmentButtons(
|
|
6232
|
-
|
|
6288
|
+
To,
|
|
6233
6289
|
this.controlOptions.valhallaOptions?.isochroneOptions?.contourType || "time",
|
|
6234
6290
|
(d) => {
|
|
6235
6291
|
this.valhallaOptions.isochroneOptions || (this.valhallaOptions.isochroneOptions = {}), this.valhallaOptions.isochroneOptions.contourType = d, this.dispatchEvent("setting-changed");
|
|
@@ -6241,7 +6297,7 @@ class Ho extends He {
|
|
|
6241
6297
|
const s = document.createElement("label");
|
|
6242
6298
|
s.textContent = "Means of Transport", s.classList.add("setting-label"), o.appendChild(s), o.appendChild(
|
|
6243
6299
|
this.settingDialog.createSegmentButtons(
|
|
6244
|
-
|
|
6300
|
+
Tt,
|
|
6245
6301
|
this.controlOptions.valhallaOptions?.isochroneOptions?.costingModel || "auto",
|
|
6246
6302
|
(d) => {
|
|
6247
6303
|
this.valhallaOptions.isochroneOptions || (this.valhallaOptions.isochroneOptions = {}), this.valhallaOptions.isochroneOptions.costingModel = d, this.dispatchEvent("setting-changed");
|
|
@@ -6424,14 +6480,14 @@ class Ho extends He {
|
|
|
6424
6480
|
* Handle finish event of terradraw. It will be called after finishing adding a feature
|
|
6425
6481
|
* @param id Feature ID
|
|
6426
6482
|
*/
|
|
6427
|
-
handleTerradrawFeatureReady =
|
|
6483
|
+
handleTerradrawFeatureReady = Ke((t) => {
|
|
6428
6484
|
this.map && (this.computeRouteByLineFeatureID(t), this.computeIsochroneByPointFeatureID(t));
|
|
6429
6485
|
}, 300);
|
|
6430
6486
|
computeIsochroneByPointFeatureID = async (t) => {
|
|
6431
6487
|
if (!this.map || !this.valhallaOptions.url) return;
|
|
6432
6488
|
const e = this.terradraw?.getSnapshotFeature(t);
|
|
6433
6489
|
if (!e || e && e.geometry.type !== "Point") return;
|
|
6434
|
-
const i = e.geometry.coordinates, n = (await new
|
|
6490
|
+
const i = e.geometry.coordinates, n = (await new Go(this.valhallaUrl).calcIsochrone(
|
|
6435
6491
|
i[0],
|
|
6436
6492
|
i[1],
|
|
6437
6493
|
this.isochroneContourType,
|
|
@@ -6463,9 +6519,9 @@ class Ho extends He {
|
|
|
6463
6519
|
if (!this.map || !this.valhallaOptions.url) return;
|
|
6464
6520
|
const e = this.terradraw?.getSnapshotFeature(t);
|
|
6465
6521
|
if (!e || e && e.geometry.type !== "LineString") return;
|
|
6466
|
-
const i = new
|
|
6522
|
+
const i = new Uo(this.valhallaUrl), o = e.geometry.coordinates.map((c) => {
|
|
6467
6523
|
const h = c;
|
|
6468
|
-
return new
|
|
6524
|
+
return new Ze(h[0], h[1]);
|
|
6469
6525
|
});
|
|
6470
6526
|
if (!o || o && o.length < 2) return;
|
|
6471
6527
|
const s = await i.calcRoute(
|
|
@@ -6512,12 +6568,10 @@ class Ho extends He {
|
|
|
6512
6568
|
*/
|
|
6513
6569
|
getFeatures(t = !1) {
|
|
6514
6570
|
const e = super.getFeatures(t);
|
|
6515
|
-
if (!e || !this.terradraw) return e;
|
|
6516
|
-
if (!this.map) return;
|
|
6571
|
+
if (!e || !this.terradraw || !this.map) return e;
|
|
6517
6572
|
const i = this.map.getStyle().sources[this.controlOptions.isochronePolygonLayerSpec.source], o = [];
|
|
6518
6573
|
for (let s = 0; s < e.features.length; s++) {
|
|
6519
6574
|
const n = e.features[s];
|
|
6520
|
-
if (!this.map || !this.map.loaded()) continue;
|
|
6521
6575
|
if (n.geometry.type === "Point") {
|
|
6522
6576
|
const l = n.id;
|
|
6523
6577
|
if (i && typeof i.data != "string" && i.data.type === "FeatureCollection") {
|
|
@@ -6536,35 +6590,35 @@ class Ho extends He {
|
|
|
6536
6590
|
}
|
|
6537
6591
|
}
|
|
6538
6592
|
export {
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6593
|
+
$o as AvailableModes,
|
|
6594
|
+
Ko as AvailableValhallaModes,
|
|
6595
|
+
Jo as MaplibreMeasureControl,
|
|
6596
|
+
qe as MaplibreTerradrawControl,
|
|
6597
|
+
qo as MaplibreValhallaControl,
|
|
6598
|
+
Xe as MemoryCache,
|
|
6599
|
+
So as ModalDialog,
|
|
6600
|
+
Xo as TERRADRAW_MEASURE_SOURCE_IDS,
|
|
6547
6601
|
ot as TERRADRAW_SOURCE_IDS,
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6602
|
+
Yo as TERRADRAW_VALHALLA_SOURCE_IDS,
|
|
6603
|
+
Go as ValhallaIsochrone,
|
|
6604
|
+
Uo as ValhallaRouting,
|
|
6605
|
+
ve as calcArea,
|
|
6606
|
+
Se as calcDistance,
|
|
6607
|
+
xe as capitalize,
|
|
6608
|
+
Kt as cleanMaplibreStyle,
|
|
6609
|
+
To as contourTypeOptions,
|
|
6610
|
+
vo as convertAreaUnit,
|
|
6611
|
+
Nt as convertMetricDistance,
|
|
6612
|
+
Tt as costingModelOptions,
|
|
6613
|
+
Ke as debounce,
|
|
6614
|
+
ro as defaultControlOptions,
|
|
6615
|
+
ct as defaultMeasureControlOptions,
|
|
6562
6616
|
V as defaultValhallaControlOptions,
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6617
|
+
no as getDefaultModeOptions,
|
|
6618
|
+
Pe as getDistanceUnitName,
|
|
6619
|
+
Ie as queryElevationByPoint,
|
|
6620
|
+
be as queryElevationFromRasterDEM,
|
|
6621
|
+
Ho as roundFeatureCoordinates,
|
|
6622
|
+
Ao as routingDistanceUnitOptions
|
|
6569
6623
|
};
|
|
6570
6624
|
//# sourceMappingURL=maplibre-gl-terradraw.es.js.map
|