@watergis/maplibre-gl-terradraw 1.9.3 → 1.9.5
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 +101 -108
- package/dist/maplibre-gl-terradraw.es.js.map +1 -1
- package/dist/maplibre-gl-terradraw.umd.js +2 -2
- package/dist/maplibre-gl-terradraw.umd.js.map +1 -1
- package/dist/types/constants/getDefaultModeOptions.d.ts +7 -0
- package/dist/types/constants/getDefaultModeOptions.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -3341,7 +3341,7 @@ class io extends Ji.TerraDrawBaseAdapter {
|
|
|
3341
3341
|
this._renderBeforeLayerId && (this._map.moveLayer(r, this._renderBeforeLayerId), this._map.moveLayer(o, r), this._map.moveLayer(i + "-outline", o), this._map.moveLayer(i, o)), (t = this._currentModeCallbacks) != null && t.onReady && ((n = this._currentModeCallbacks) == null || n.onReady());
|
|
3342
3342
|
}
|
|
3343
3343
|
}
|
|
3344
|
-
const
|
|
3344
|
+
const Qo = [
|
|
3345
3345
|
"render",
|
|
3346
3346
|
"point",
|
|
3347
3347
|
"marker",
|
|
@@ -3358,7 +3358,7 @@ const Zo = [
|
|
|
3358
3358
|
"delete-selection",
|
|
3359
3359
|
"delete",
|
|
3360
3360
|
"download"
|
|
3361
|
-
],
|
|
3361
|
+
], er = [
|
|
3362
3362
|
"render",
|
|
3363
3363
|
"linestring",
|
|
3364
3364
|
"point",
|
|
@@ -4058,7 +4058,10 @@ Alt. `,
|
|
|
4058
4058
|
"text-halo-color": "rgb(255, 255, 255)"
|
|
4059
4059
|
}
|
|
4060
4060
|
}
|
|
4061
|
-
}, so = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:svg='http://www.w3.org/2000/svg'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20inkscape:version='1.0%20(4035a4fb49,%202020-05-01)'%20sodipodi:docname='poi.svg'%20id='svg4460'%20height='100'%20width='100'%20version='1.1'%3e%3csodipodi:namedview%20inkscape:document-rotation='0'%20inkscape:current-layer='svg4460'%20inkscape:window-maximized='1'%20inkscape:window-y='-8'%20inkscape:window-x='-8'%20inkscape:cy='70.031285'%20inkscape:cx='-78.460726'%20inkscape:zoom='2.02'%20showgrid='false'%20id='namedview11'%20inkscape:window-height='1017'%20inkscape:window-width='1920'%20inkscape:pageshadow='2'%20inkscape:pageopacity='0'%20guidetolerance='10'%20gridtolerance='10'%20objecttolerance='10'%20borderopacity='1'%20bordercolor='%23666666'%20pagecolor='%23ffffff'%20/%3e%3cdefs%20id='defs4462'%20/%3e%3cmetadata%20id='metadata4465'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3cdc:title%3e%3c/dc:title%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cpath%20d='M%2050.001528,3.3861402e-7%20C%2030.763177,3.3861402e-7%2015,15.718144%2015,34.901534%20c%200,7.432782%202.373565,14.339962%206.391689,20.019029%20l%2024.338528,42.073163%20c%203.40849,4.452814%205.674917,3.607154%208.509014,-0.23458%20L%2081.083105,51.075788%20C%2081.625418,50.0948%2082.050328,49.050173%2082.421327,47.983517%2084.078241,43.936622%2085.000002,39.521943%2085,34.901534%2085,15.718144%2069.23988,3.3861402e-7%2050.001528,3.3861402e-7%20Z%20m%200,16.35400066138598%20c%2010.359296,0%2018.597616,8.21783%2018.597618,18.547533%200,10.329703%20-8.238322,18.544487%20-18.597618,18.544487%20-10.359299,0%20-18.600672,-8.214784%20-18.600672,-18.544487%200,-10.329703%208.241373,-18.547533%2018.600672,-18.547533%20z'%20style='fill:%233FB1CE;stroke-width:4.26019'%20id='path4135'%20/%3e%3c/svg%3e", no = () =>
|
|
4061
|
+
}, so = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:svg='http://www.w3.org/2000/svg'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20inkscape:version='1.0%20(4035a4fb49,%202020-05-01)'%20sodipodi:docname='poi.svg'%20id='svg4460'%20height='100'%20width='100'%20version='1.1'%3e%3csodipodi:namedview%20inkscape:document-rotation='0'%20inkscape:current-layer='svg4460'%20inkscape:window-maximized='1'%20inkscape:window-y='-8'%20inkscape:window-x='-8'%20inkscape:cy='70.031285'%20inkscape:cx='-78.460726'%20inkscape:zoom='2.02'%20showgrid='false'%20id='namedview11'%20inkscape:window-height='1017'%20inkscape:window-width='1920'%20inkscape:pageshadow='2'%20inkscape:pageopacity='0'%20guidetolerance='10'%20gridtolerance='10'%20objecttolerance='10'%20borderopacity='1'%20bordercolor='%23666666'%20pagecolor='%23ffffff'%20/%3e%3cdefs%20id='defs4462'%20/%3e%3cmetadata%20id='metadata4465'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3cdc:title%3e%3c/dc:title%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cpath%20d='M%2050.001528,3.3861402e-7%20C%2030.763177,3.3861402e-7%2015,15.718144%2015,34.901534%20c%200,7.432782%202.373565,14.339962%206.391689,20.019029%20l%2024.338528,42.073163%20c%203.40849,4.452814%205.674917,3.607154%208.509014,-0.23458%20L%2081.083105,51.075788%20C%2081.625418,50.0948%2082.050328,49.050173%2082.421327,47.983517%2084.078241,43.936622%2085.000002,39.521943%2085,34.901534%2085,15.718144%2069.23988,3.3861402e-7%2050.001528,3.3861402e-7%20Z%20m%200,16.35400066138598%20c%2010.359296,0%2018.597616,8.21783%2018.597618,18.547533%200,10.329703%20-8.238322,18.544487%20-18.597618,18.544487%20-10.359299,0%20-18.600672,-8.214784%20-18.600672,-18.544487%200,-10.329703%208.241373,-18.547533%2018.600672,-18.547533%20z'%20style='fill:%233FB1CE;stroke-width:4.26019'%20id='path4135'%20/%3e%3c/svg%3e", no = (s, e) => {
|
|
4062
|
+
const t = e.updateType;
|
|
4063
|
+
return t === "finish" || t === "commit" ? Vi(s) : { valid: !0 };
|
|
4064
|
+
}, ao = () => ({
|
|
4062
4065
|
render: new ee({
|
|
4063
4066
|
modeName: "render",
|
|
4064
4067
|
styles: {}
|
|
@@ -4079,12 +4082,7 @@ Alt. `,
|
|
|
4079
4082
|
}),
|
|
4080
4083
|
polygon: new Mt({
|
|
4081
4084
|
editable: !0,
|
|
4082
|
-
|
|
4083
|
-
// @ts-ignore
|
|
4084
|
-
validation: (e, t) => {
|
|
4085
|
-
const i = t.updateType;
|
|
4086
|
-
return i === "finish" || i === "commit" ? Vi(e) : { valid: !0 };
|
|
4087
|
-
}
|
|
4085
|
+
validation: no
|
|
4088
4086
|
}),
|
|
4089
4087
|
rectangle: new Lt(),
|
|
4090
4088
|
"angled-rectangle": new Bt(),
|
|
@@ -4222,7 +4220,7 @@ Alt. `,
|
|
|
4222
4220
|
styles: {}
|
|
4223
4221
|
})
|
|
4224
4222
|
});
|
|
4225
|
-
var W = 63710088e-1,
|
|
4223
|
+
var W = 63710088e-1, lo = {
|
|
4226
4224
|
centimeters: W * 100,
|
|
4227
4225
|
centimetres: W * 100,
|
|
4228
4226
|
degrees: 360 / (2 * Math.PI),
|
|
@@ -4239,11 +4237,11 @@ var W = 63710088e-1, ao = {
|
|
|
4239
4237
|
radians: 1,
|
|
4240
4238
|
yards: W * 1.0936
|
|
4241
4239
|
};
|
|
4242
|
-
function
|
|
4240
|
+
function co(s, e, t = {}) {
|
|
4243
4241
|
const i = { type: "Feature" };
|
|
4244
4242
|
return (t.id === 0 || t.id) && (i.id = t.id), t.bbox && (i.bbox = t.bbox), i.properties = e || {}, i.geometry = s, i;
|
|
4245
4243
|
}
|
|
4246
|
-
function
|
|
4244
|
+
function ho(s, e, t = {}) {
|
|
4247
4245
|
if (!s)
|
|
4248
4246
|
throw new Error("coordinates is required");
|
|
4249
4247
|
if (!Array.isArray(s))
|
|
@@ -4252,13 +4250,13 @@ function co(s, e, t = {}) {
|
|
|
4252
4250
|
throw new Error("coordinates must be at least 2 numbers long");
|
|
4253
4251
|
if (!ft(s[0]) || !ft(s[1]))
|
|
4254
4252
|
throw new Error("coordinates must contain numbers");
|
|
4255
|
-
return
|
|
4253
|
+
return co({
|
|
4256
4254
|
type: "Point",
|
|
4257
4255
|
coordinates: s
|
|
4258
4256
|
}, e, t);
|
|
4259
4257
|
}
|
|
4260
|
-
function
|
|
4261
|
-
const t =
|
|
4258
|
+
function uo(s, e = "kilometers") {
|
|
4259
|
+
const t = lo[e];
|
|
4262
4260
|
if (!t)
|
|
4263
4261
|
throw new Error(e + " units is invalid");
|
|
4264
4262
|
return s * t;
|
|
@@ -4356,7 +4354,7 @@ function zt(s, e, t) {
|
|
|
4356
4354
|
}
|
|
4357
4355
|
}
|
|
4358
4356
|
}
|
|
4359
|
-
function
|
|
4357
|
+
function po(s, e) {
|
|
4360
4358
|
var t, i, o, r, n, a, l, d, c, h, u = 0, p = s.type === "FeatureCollection", g = s.type === "Feature", y = p ? s.features.length : 1;
|
|
4361
4359
|
for (t = 0; t < y; t++) {
|
|
4362
4360
|
for (a = p ? s.features[t].geometry : g ? s.geometry : s, d = p ? s.features[t].properties : g ? s.properties : {}, c = p ? s.features[t].bbox : g ? s.bbox : void 0, h = p ? s.features[t].id : g ? s.id : void 0, l = a ? a.type === "GeometryCollection" : !1, n = l ? a.geometries.length : 1, o = 0; o < n; o++) {
|
|
@@ -4407,9 +4405,9 @@ function uo(s, e) {
|
|
|
4407
4405
|
u++;
|
|
4408
4406
|
}
|
|
4409
4407
|
}
|
|
4410
|
-
function
|
|
4408
|
+
function go(s, e, t) {
|
|
4411
4409
|
var i = t;
|
|
4412
|
-
return
|
|
4410
|
+
return po(
|
|
4413
4411
|
s,
|
|
4414
4412
|
function(o, r, n, a, l) {
|
|
4415
4413
|
r === 0 && t === void 0 ? i = o : i = e(
|
|
@@ -4423,14 +4421,14 @@ function po(s, e, t) {
|
|
|
4423
4421
|
}
|
|
4424
4422
|
), i;
|
|
4425
4423
|
}
|
|
4426
|
-
function
|
|
4427
|
-
return
|
|
4424
|
+
function yo(s) {
|
|
4425
|
+
return go(
|
|
4428
4426
|
s,
|
|
4429
|
-
(e, t) => e +
|
|
4427
|
+
(e, t) => e + fo(t),
|
|
4430
4428
|
0
|
|
4431
4429
|
);
|
|
4432
4430
|
}
|
|
4433
|
-
function
|
|
4431
|
+
function fo(s) {
|
|
4434
4432
|
let e = 0, t;
|
|
4435
4433
|
switch (s.type) {
|
|
4436
4434
|
case "Polygon":
|
|
@@ -4456,7 +4454,7 @@ function mt(s) {
|
|
|
4456
4454
|
}
|
|
4457
4455
|
return e;
|
|
4458
4456
|
}
|
|
4459
|
-
var
|
|
4457
|
+
var mo = W * W / 2, ke = Math.PI / 180;
|
|
4460
4458
|
function vt(s) {
|
|
4461
4459
|
const e = s.length - 1;
|
|
4462
4460
|
if (e <= 2) return 0;
|
|
@@ -4465,10 +4463,10 @@ function vt(s) {
|
|
|
4465
4463
|
const o = s[i], r = s[i + 1 === e ? 0 : i + 1], n = s[i + 2 >= e ? (i + 2) % e : i + 2], a = o[0] * ke, l = r[1] * ke, d = n[0] * ke;
|
|
4466
4464
|
t += (d - a) * Math.sin(l), i++;
|
|
4467
4465
|
}
|
|
4468
|
-
return t *
|
|
4466
|
+
return t * mo;
|
|
4469
4467
|
}
|
|
4470
|
-
var
|
|
4471
|
-
const
|
|
4468
|
+
var vo = yo;
|
|
4469
|
+
const Co = (s, e, t = "auto", i = q) => {
|
|
4472
4470
|
const o = ["square meters", "square kilometers", "ares", "hectares"], r = ["square feet", "square yards", "acres", "square miles"];
|
|
4473
4471
|
let n = t;
|
|
4474
4472
|
if (t !== "auto") {
|
|
@@ -4516,9 +4514,9 @@ const vo = (s, e, t = "auto", i = q) => {
|
|
|
4516
4514
|
area: i,
|
|
4517
4515
|
unit: o
|
|
4518
4516
|
};
|
|
4519
|
-
},
|
|
4517
|
+
}, Po = (s, e, t, i, o) => {
|
|
4520
4518
|
if (s.geometry.type !== "Polygon") return s;
|
|
4521
|
-
const r =
|
|
4519
|
+
const r = vo(s.geometry), n = Co(r, e, i, o);
|
|
4522
4520
|
return n.area = parseFloat(n.area.toFixed(t)), s.properties.area = n.area, s.properties.unit = n.unit, s;
|
|
4523
4521
|
};
|
|
4524
4522
|
function Ct(s) {
|
|
@@ -4534,14 +4532,14 @@ function Ct(s) {
|
|
|
4534
4532
|
return [...s];
|
|
4535
4533
|
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
4536
4534
|
}
|
|
4537
|
-
function
|
|
4535
|
+
function Io(s, e, t = {}) {
|
|
4538
4536
|
var i = Ct(s), o = Ct(e), r = Ce(o[1] - i[1]), n = Ce(o[0] - i[0]), a = Ce(i[1]), l = Ce(o[1]), d = Math.pow(Math.sin(r / 2), 2) + Math.pow(Math.sin(n / 2), 2) * Math.cos(a) * Math.cos(l);
|
|
4539
|
-
return
|
|
4537
|
+
return uo(
|
|
4540
4538
|
2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d)),
|
|
4541
4539
|
t.units
|
|
4542
4540
|
);
|
|
4543
4541
|
}
|
|
4544
|
-
var
|
|
4542
|
+
var So = Io;
|
|
4545
4543
|
const _e = (s, e = "metric", t = "auto", i = q) => {
|
|
4546
4544
|
const o = ["centimeter", "meter", "kilometer"], r = ["inch", "foot", "mile"];
|
|
4547
4545
|
let n = t;
|
|
@@ -4560,9 +4558,6 @@ const _e = (s, e = "metric", t = "auto", i = q) => {
|
|
|
4560
4558
|
unit: t.kilometer
|
|
4561
4559
|
};
|
|
4562
4560
|
switch (e) {
|
|
4563
|
-
case "kilometer":
|
|
4564
|
-
i.distance = s, i.unit = t[e];
|
|
4565
|
-
break;
|
|
4566
4561
|
case "meter":
|
|
4567
4562
|
i.distance = s * 1e3, i.unit = t[e];
|
|
4568
4563
|
break;
|
|
@@ -4572,6 +4567,7 @@ const _e = (s, e = "metric", t = "auto", i = q) => {
|
|
|
4572
4567
|
case "auto":
|
|
4573
4568
|
s >= 1 ? i = Pe(s, "kilometer", t) : s * 1e3 >= 1 ? i = Pe(s, "meter", t) : i = Pe(s, "centimeter", t);
|
|
4574
4569
|
break;
|
|
4570
|
+
case "kilometer":
|
|
4575
4571
|
default:
|
|
4576
4572
|
i.distance = s, i.unit = t.kilometer;
|
|
4577
4573
|
break;
|
|
@@ -4583,9 +4579,6 @@ const _e = (s, e = "metric", t = "auto", i = q) => {
|
|
|
4583
4579
|
unit: t.mile
|
|
4584
4580
|
};
|
|
4585
4581
|
switch (e) {
|
|
4586
|
-
case "mile":
|
|
4587
|
-
i.distance = s, i.unit = t[e];
|
|
4588
|
-
break;
|
|
4589
4582
|
case "foot":
|
|
4590
4583
|
i.distance = s * 5280, i.unit = t[e];
|
|
4591
4584
|
break;
|
|
@@ -4595,18 +4588,19 @@ const _e = (s, e = "metric", t = "auto", i = q) => {
|
|
|
4595
4588
|
case "auto":
|
|
4596
4589
|
s >= 1 ? i = Ie(s, "mile", t) : s * 5280 >= 1 ? i = Ie(s, "foot", t) : i = Ie(s, "inch", t);
|
|
4597
4590
|
break;
|
|
4591
|
+
case "mile":
|
|
4598
4592
|
default:
|
|
4599
4593
|
i.distance = s, i.unit = t.mile;
|
|
4600
4594
|
break;
|
|
4601
4595
|
}
|
|
4602
4596
|
return i;
|
|
4603
|
-
},
|
|
4597
|
+
}, xo = (s, e, t, i, o, r, n, a) => {
|
|
4604
4598
|
if (s.geometry.type !== "LineString") return s;
|
|
4605
4599
|
const l = s.geometry.coordinates;
|
|
4606
4600
|
let d = 0;
|
|
4607
4601
|
const c = [];
|
|
4608
4602
|
for (let u = 0; u < l.length - 1; u++) {
|
|
4609
|
-
const p = l[u], g = l[u + 1], y =
|
|
4603
|
+
const p = l[u], g = l[u + 1], y = So(p, g, { units: e === "metric" ? "kilometers" : "miles" });
|
|
4610
4604
|
d += y;
|
|
4611
4605
|
const f = JSON.parse(JSON.stringify(s));
|
|
4612
4606
|
if (f.id = `${f.id}-${u}`, f.geometry.coordinates = [p, g], f.properties.originalId = s.id, f.properties.distance = y, f.properties.total = d, n === !0 && a === void 0) {
|
|
@@ -4664,11 +4658,11 @@ const _e = (s, e = "metric", t = "auto", i = q) => {
|
|
|
4664
4658
|
"{prefix}-linestring",
|
|
4665
4659
|
"{prefix}-polygon",
|
|
4666
4660
|
"{prefix}-polygon-outline"
|
|
4667
|
-
],
|
|
4661
|
+
], tr = [
|
|
4668
4662
|
...re,
|
|
4669
4663
|
Ee.polygonLayerSpec?.source,
|
|
4670
4664
|
Ee.lineLayerLabelSpec?.source
|
|
4671
|
-
],
|
|
4665
|
+
], ir = [
|
|
4672
4666
|
...re,
|
|
4673
4667
|
z.routingLineLayerNodeLabelSpec?.source,
|
|
4674
4668
|
z.routingLineLayerNodeSpec?.source,
|
|
@@ -4767,7 +4761,7 @@ class $t {
|
|
|
4767
4761
|
};
|
|
4768
4762
|
}
|
|
4769
4763
|
}
|
|
4770
|
-
class
|
|
4764
|
+
class Eo {
|
|
4771
4765
|
className;
|
|
4772
4766
|
dialog;
|
|
4773
4767
|
title;
|
|
@@ -4811,10 +4805,8 @@ class xo {
|
|
|
4811
4805
|
}), o.appendChild(n), this.dialog.appendChild(o);
|
|
4812
4806
|
const a = document.createElement("div");
|
|
4813
4807
|
a.classList.add("content"), this.dialog.appendChild(t(a)), this.dialog.addEventListener("click", (l) => {
|
|
4814
|
-
const
|
|
4815
|
-
|
|
4816
|
-
const c = d.getBoundingClientRect();
|
|
4817
|
-
(c.left > l.clientX || c.right < l.clientX || c.top > l.clientY || c.bottom < l.clientY) && this.close();
|
|
4808
|
+
const c = l.target?.getBoundingClientRect();
|
|
4809
|
+
c && (c.left > l.clientX || c.right < l.clientX || c.top > l.clientY || c.bottom < l.clientY) && this.close();
|
|
4818
4810
|
}), e.appendChild(this.dialog);
|
|
4819
4811
|
}
|
|
4820
4812
|
/**
|
|
@@ -4856,7 +4848,7 @@ class xo {
|
|
|
4856
4848
|
}), o;
|
|
4857
4849
|
}
|
|
4858
4850
|
}
|
|
4859
|
-
const
|
|
4851
|
+
const Oo = (s, e, t, i, o = "metric", r = q) => {
|
|
4860
4852
|
if (s.geometry.type !== "Point") return s;
|
|
4861
4853
|
const n = s.geometry.coordinates;
|
|
4862
4854
|
if (t === !0) {
|
|
@@ -4884,31 +4876,31 @@ const Eo = (s, e, t, i, o = "metric", r = q) => {
|
|
|
4884
4876
|
}
|
|
4885
4877
|
return s;
|
|
4886
4878
|
};
|
|
4887
|
-
var
|
|
4888
|
-
function
|
|
4879
|
+
var wo = Object.defineProperty, bo = (s, e, t) => e in s ? wo(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, le = (s, e, t) => bo(s, typeof e != "symbol" ? e + "" : e, t), Oe = 2 * Math.PI * 6378137 / 2;
|
|
4880
|
+
function Fo(s) {
|
|
4889
4881
|
return s = s || 256, 2 * Math.PI * 6378137 / s;
|
|
4890
4882
|
}
|
|
4891
|
-
function
|
|
4883
|
+
function Mo(s, e, t = { enable: !0, decimal: 1 }) {
|
|
4892
4884
|
s = He(s);
|
|
4893
4885
|
var i = s[0], o = s[1], r = i * Oe / 180, n = Math.log(Math.tan((90 + o) * Math.PI / 360)) / (Math.PI / 180);
|
|
4894
4886
|
return n = n * Oe / 180, t.enable && (r = Number(r.toFixed(t.decimal)), n = Number(n.toFixed(t.decimal))), [r, n];
|
|
4895
4887
|
}
|
|
4896
|
-
function
|
|
4897
|
-
var i = s[0], o = s[1], r =
|
|
4888
|
+
function Lo(s, e, t) {
|
|
4889
|
+
var i = s[0], o = s[1], r = Wo(e, t), n = (i + Oe) / r, a = (o + Oe) / r;
|
|
4898
4890
|
return [n, a, e];
|
|
4899
4891
|
}
|
|
4900
4892
|
function Yt(s, e, t) {
|
|
4901
4893
|
s = He(s);
|
|
4902
|
-
var i =
|
|
4903
|
-
return
|
|
4894
|
+
var i = Mo(s), o = Lo(i, e);
|
|
4895
|
+
return ko(o);
|
|
4904
4896
|
}
|
|
4905
|
-
function
|
|
4897
|
+
function Do(s, e, t) {
|
|
4906
4898
|
if (s = He(s), e === 0)
|
|
4907
4899
|
return [0, 0, 0];
|
|
4908
4900
|
var i = Yt(s, e);
|
|
4909
|
-
return
|
|
4901
|
+
return _o(i);
|
|
4910
4902
|
}
|
|
4911
|
-
function
|
|
4903
|
+
function ko(s, e, t) {
|
|
4912
4904
|
e = e || 256;
|
|
4913
4905
|
var i = s[0], o = s[1], r = s[2];
|
|
4914
4906
|
if (r === 0) return [0, 0, 0];
|
|
@@ -4916,22 +4908,22 @@ function Do(s, e, t) {
|
|
|
4916
4908
|
var n = Math.ceil(i / e) - 1, a = Math.ceil(o / e) - 1;
|
|
4917
4909
|
return n < 0 && (n = 0), a < 0 && (a = 0), [n, a, r];
|
|
4918
4910
|
}
|
|
4919
|
-
function
|
|
4920
|
-
|
|
4911
|
+
function _o(s, e) {
|
|
4912
|
+
No(s);
|
|
4921
4913
|
var t = s[0], i = s[1], o = s[2];
|
|
4922
4914
|
if (o === 0)
|
|
4923
4915
|
return [0, 0, 0];
|
|
4924
4916
|
var r = t, n = Math.pow(2, o) - 1 - i;
|
|
4925
4917
|
return [r, n, o];
|
|
4926
4918
|
}
|
|
4927
|
-
function
|
|
4919
|
+
function No(s, e) {
|
|
4928
4920
|
var t = s[0], i = s[1], o = s[2];
|
|
4929
4921
|
if (o == null) throw new Error("<zoom> is required");
|
|
4930
4922
|
if (t == null) throw new Error("<x> is required");
|
|
4931
4923
|
if (i == null) throw new Error("<y> is required");
|
|
4932
|
-
return o = Kt(o), s =
|
|
4924
|
+
return o = Kt(o), s = To(s), s;
|
|
4933
4925
|
}
|
|
4934
|
-
function
|
|
4926
|
+
function To(s) {
|
|
4935
4927
|
var e = s[0], t = s[1], i = s[2], o = Math.pow(2, i);
|
|
4936
4928
|
return e = e % o, e < 0 && (e = e + o), [e, t, i];
|
|
4937
4929
|
}
|
|
@@ -4946,17 +4938,17 @@ function Kt(s) {
|
|
|
4946
4938
|
return s;
|
|
4947
4939
|
}
|
|
4948
4940
|
function He(s, e) {
|
|
4949
|
-
var t =
|
|
4941
|
+
var t = jo(s[0]), i = Bo(s[1]);
|
|
4950
4942
|
return i > 85 && (i = 85), i < -85 && (i = -85), [t, i];
|
|
4951
4943
|
}
|
|
4952
|
-
function
|
|
4953
|
-
return
|
|
4944
|
+
function Wo(s, e) {
|
|
4945
|
+
return Fo(e) / Math.pow(2, s);
|
|
4954
4946
|
}
|
|
4955
|
-
function
|
|
4947
|
+
function Bo(s) {
|
|
4956
4948
|
if (s == null) throw new Error("lat is required");
|
|
4957
4949
|
return (s > 90 || s < -90) && (s = s % 180, s > 90 && (s = -180 + s), s < -90 && (s = 180 + s), s === 0 && (s = 0)), s;
|
|
4958
4950
|
}
|
|
4959
|
-
function
|
|
4951
|
+
function jo(s) {
|
|
4960
4952
|
if (s == null) throw new Error("lng is required");
|
|
4961
4953
|
return (s > 180 || s < -180) && (s = s % 360, s > 180 && (s = -360 + s), s < -180 && (s = 360 + s), s === 0 && (s = 0)), s;
|
|
4962
4954
|
}
|
|
@@ -4985,7 +4977,7 @@ class Ht {
|
|
|
4985
4977
|
const r = e[0], n = e[1];
|
|
4986
4978
|
let a = t;
|
|
4987
4979
|
t > this.maxzoom ? a = this.maxzoom : t < this.minzoom && (a = this.minzoom);
|
|
4988
|
-
const l = this.tms ? Yt([r, n], a) :
|
|
4980
|
+
const l = this.tms ? Yt([r, n], a) : Do([r, n], a), d = this.url.replace(/{x}/g, l[0].toString()).replace(/{y}/g, l[1].toString()).replace(/{z}/g, l[2].toString());
|
|
4989
4981
|
let c = this.getUrlExtension(d);
|
|
4990
4982
|
switch (c || (c = "png"), c) {
|
|
4991
4983
|
case "png":
|
|
@@ -5087,7 +5079,7 @@ class Ht {
|
|
|
5087
5079
|
return i * Math.atan(0.5 * (Math.exp(o) - Math.exp(-o)));
|
|
5088
5080
|
}
|
|
5089
5081
|
}
|
|
5090
|
-
class
|
|
5082
|
+
class Uo extends Ht {
|
|
5091
5083
|
/**
|
|
5092
5084
|
* Constructor
|
|
5093
5085
|
* @param url URL for terrain RGB raster tilesets
|
|
@@ -5119,7 +5111,7 @@ class jo extends Ht {
|
|
|
5119
5111
|
return -1e4 + (e * 256 * 256 + t * 256 + i) * 0.1;
|
|
5120
5112
|
}
|
|
5121
5113
|
}
|
|
5122
|
-
class
|
|
5114
|
+
class Ro extends Ht {
|
|
5123
5115
|
/**
|
|
5124
5116
|
* Constructor
|
|
5125
5117
|
* @param url URL for terrarium raster tilesets
|
|
@@ -5153,7 +5145,7 @@ class Uo extends Ht {
|
|
|
5153
5145
|
return parseInt(o.toFixed(0));
|
|
5154
5146
|
}
|
|
5155
5147
|
}
|
|
5156
|
-
const
|
|
5148
|
+
const Ao = (s, e = 8) => {
|
|
5157
5149
|
const [t, i] = s, o = Math.pow(10, e), r = Math.round(t * o) / o, n = Math.round(i * o) / o;
|
|
5158
5150
|
return `${r},${n}`;
|
|
5159
5151
|
}, It = async (s, e, t, i, o = "metric", r = q) => {
|
|
@@ -5172,13 +5164,13 @@ const Ro = (s, e = 8) => {
|
|
|
5172
5164
|
const h = e.url, u = e.encoding ?? "mapbox", p = e.tileSize ?? 512, g = e.minzoom ?? 5;
|
|
5173
5165
|
c = e.maxzoom ?? 15;
|
|
5174
5166
|
const y = e.tms ?? !1;
|
|
5175
|
-
d = u === "mapbox" ? new
|
|
5167
|
+
d = u === "mapbox" ? new Uo(h, p, g, c, y) : new Ro(h, p, g, c, y);
|
|
5176
5168
|
}
|
|
5177
5169
|
for (const h of s)
|
|
5178
5170
|
n.push(
|
|
5179
5171
|
new Promise((u) => {
|
|
5180
5172
|
h.geometry.type !== "Point" && u(h);
|
|
5181
|
-
const p = h.geometry.coordinates, g =
|
|
5173
|
+
const p = h.geometry.coordinates, g = Ao(p, a.precision);
|
|
5182
5174
|
if (l) {
|
|
5183
5175
|
const y = l.get(g);
|
|
5184
5176
|
if (y !== void 0) {
|
|
@@ -5211,7 +5203,7 @@ const Ro = (s, e = 8) => {
|
|
|
5211
5203
|
})
|
|
5212
5204
|
);
|
|
5213
5205
|
return await Promise.all(n);
|
|
5214
|
-
},
|
|
5206
|
+
}, or = (s, e = 9) => {
|
|
5215
5207
|
function t(o) {
|
|
5216
5208
|
return [Number(o[0].toFixed(e)), Number(o[1].toFixed(e))];
|
|
5217
5209
|
}
|
|
@@ -5245,11 +5237,11 @@ const Ro = (s, e = 8) => {
|
|
|
5245
5237
|
...o,
|
|
5246
5238
|
geometry: i(o.geometry)
|
|
5247
5239
|
}));
|
|
5248
|
-
},
|
|
5240
|
+
}, Go = [
|
|
5249
5241
|
{ value: "time", label: "Time" },
|
|
5250
5242
|
{ value: "distance", label: "Distance" }
|
|
5251
5243
|
];
|
|
5252
|
-
class
|
|
5244
|
+
class zo {
|
|
5253
5245
|
url;
|
|
5254
5246
|
/**
|
|
5255
5247
|
* Constructor
|
|
@@ -5285,11 +5277,11 @@ const je = [
|
|
|
5285
5277
|
{ value: "pedestrian", label: "Pedestrian" },
|
|
5286
5278
|
{ value: "bicycle", label: "Bicycle" },
|
|
5287
5279
|
{ value: "auto", label: "Car" }
|
|
5288
|
-
],
|
|
5280
|
+
], Vo = [
|
|
5289
5281
|
{ value: "kilometers", label: "km" },
|
|
5290
5282
|
{ value: "miles", label: "mile" }
|
|
5291
5283
|
];
|
|
5292
|
-
class
|
|
5284
|
+
class $o {
|
|
5293
5285
|
tripData = [];
|
|
5294
5286
|
/**
|
|
5295
5287
|
* get the raw trip data from the valhalla routing API.
|
|
@@ -5510,7 +5502,7 @@ class Xt {
|
|
|
5510
5502
|
if (this.options && this.options.modes && this.options.modes.length === 0)
|
|
5511
5503
|
throw new Error("At least a mode must be enabled.");
|
|
5512
5504
|
this.map = e;
|
|
5513
|
-
const t =
|
|
5505
|
+
const t = ao(), i = [];
|
|
5514
5506
|
return this.options?.modes?.forEach((o) => {
|
|
5515
5507
|
if (this.options.modeOptions && this.options.modeOptions[o]) {
|
|
5516
5508
|
const r = this.options.modeOptions[o];
|
|
@@ -5772,16 +5764,16 @@ class Xt {
|
|
|
5772
5764
|
}
|
|
5773
5765
|
}
|
|
5774
5766
|
}
|
|
5775
|
-
function
|
|
5767
|
+
function Yo(s, e = {}) {
|
|
5776
5768
|
let t = 0, i = 0, o = 0;
|
|
5777
5769
|
return zt(
|
|
5778
5770
|
s,
|
|
5779
5771
|
function(r) {
|
|
5780
5772
|
t += r[0], i += r[1], o++;
|
|
5781
5773
|
}
|
|
5782
|
-
),
|
|
5774
|
+
), ho([t / o, i / o], e.properties);
|
|
5783
5775
|
}
|
|
5784
|
-
class
|
|
5776
|
+
class rr extends Xt {
|
|
5785
5777
|
measureOptions;
|
|
5786
5778
|
elevationCache;
|
|
5787
5779
|
/**
|
|
@@ -6225,7 +6217,7 @@ class or extends Xt {
|
|
|
6225
6217
|
(l) => l.properties?.originalId !== e
|
|
6226
6218
|
));
|
|
6227
6219
|
const a = JSON.parse(JSON.stringify(r));
|
|
6228
|
-
a.id = a.id + "-area-label", a.geometry =
|
|
6220
|
+
a.id = a.id + "-area-label", a.geometry = Yo(r.geometry).geometry, a.properties.originalId = r.id, r = Po(
|
|
6229
6221
|
r,
|
|
6230
6222
|
this.measureUnitType,
|
|
6231
6223
|
this.areaPrecision,
|
|
@@ -6264,7 +6256,7 @@ class or extends Xt {
|
|
|
6264
6256
|
if (r) {
|
|
6265
6257
|
typeof r.data != "string" && r.data.type === "FeatureCollection" && (r.data.features = r.data.features.filter(
|
|
6266
6258
|
(a) => a.properties?.originalId !== e
|
|
6267
|
-
)), o =
|
|
6259
|
+
)), o = xo(
|
|
6268
6260
|
o,
|
|
6269
6261
|
this.measureUnitType,
|
|
6270
6262
|
this.distancePrecision,
|
|
@@ -6325,7 +6317,7 @@ class or extends Xt {
|
|
|
6325
6317
|
elevation: void 0,
|
|
6326
6318
|
elevationUnit: void 0
|
|
6327
6319
|
};
|
|
6328
|
-
this.computeElevation && (this.measureOptions.terrainSource === void 0 ? o =
|
|
6320
|
+
this.computeElevation && (this.measureOptions.terrainSource === void 0 ? o = Oo(
|
|
6329
6321
|
o,
|
|
6330
6322
|
this.map,
|
|
6331
6323
|
this.computeElevation,
|
|
@@ -6362,7 +6354,7 @@ class or extends Xt {
|
|
|
6362
6354
|
}
|
|
6363
6355
|
}
|
|
6364
6356
|
}
|
|
6365
|
-
class
|
|
6357
|
+
class sr extends Xt {
|
|
6366
6358
|
controlOptions;
|
|
6367
6359
|
valhallaOptions;
|
|
6368
6360
|
_modalDialog;
|
|
@@ -6567,7 +6559,7 @@ class rr extends Xt {
|
|
|
6567
6559
|
* Create the settings dialog for Valhalla control
|
|
6568
6560
|
*/
|
|
6569
6561
|
createSettingsDialog() {
|
|
6570
|
-
this.settingDialog = new
|
|
6562
|
+
this.settingDialog = new Eo(
|
|
6571
6563
|
`maplibregl-terradraw-${this.cssPrefix}settings-dialog`,
|
|
6572
6564
|
"Settings"
|
|
6573
6565
|
), this.settingDialog.create(
|
|
@@ -6621,7 +6613,7 @@ class rr extends Xt {
|
|
|
6621
6613
|
const r = document.createElement("label");
|
|
6622
6614
|
return r.textContent = "Distance Unit", r.classList.add("setting-label"), o.appendChild(r), o.appendChild(
|
|
6623
6615
|
this.settingDialog.createSegmentButtons(
|
|
6624
|
-
|
|
6616
|
+
Vo,
|
|
6625
6617
|
this.routingDistanceUnit,
|
|
6626
6618
|
(n) => {
|
|
6627
6619
|
this.valhallaOptions.routingOptions || (this.valhallaOptions.routingOptions = {}), this.valhallaOptions.routingOptions.distanceUnit = n, this.dispatchEvent("setting-changed");
|
|
@@ -6638,7 +6630,7 @@ class rr extends Xt {
|
|
|
6638
6630
|
const i = document.createElement("label");
|
|
6639
6631
|
i.textContent = "Contour Type", i.classList.add("setting-label"), t.appendChild(i), t.appendChild(
|
|
6640
6632
|
this.settingDialog.createSegmentButtons(
|
|
6641
|
-
|
|
6633
|
+
Go,
|
|
6642
6634
|
this.controlOptions.valhallaOptions?.isochroneOptions?.contourType || "time",
|
|
6643
6635
|
(d) => {
|
|
6644
6636
|
this.valhallaOptions.isochroneOptions || (this.valhallaOptions.isochroneOptions = {}), this.valhallaOptions.isochroneOptions.contourType = d, this.dispatchEvent("setting-changed");
|
|
@@ -6840,7 +6832,7 @@ class rr extends Xt {
|
|
|
6840
6832
|
if (!this.map || !this.valhallaOptions.url) return;
|
|
6841
6833
|
const t = this.terradraw?.getSnapshotFeature(e);
|
|
6842
6834
|
if (!t || t && t.geometry.type !== "Point") return;
|
|
6843
|
-
const i = t.geometry.coordinates, n = (await new
|
|
6835
|
+
const i = t.geometry.coordinates, n = (await new zo(this.valhallaUrl).calcIsochrone(
|
|
6844
6836
|
i[0],
|
|
6845
6837
|
i[1],
|
|
6846
6838
|
this.isochroneContourType,
|
|
@@ -6874,7 +6866,7 @@ class rr extends Xt {
|
|
|
6874
6866
|
if (!this.map || !this.valhallaOptions.url) return;
|
|
6875
6867
|
const t = this.terradraw?.getSnapshotFeature(e);
|
|
6876
6868
|
if (!t || t && t.geometry.type !== "LineString") return;
|
|
6877
|
-
const i = new
|
|
6869
|
+
const i = new $o(this.valhallaUrl), o = t.geometry.coordinates.map((c) => {
|
|
6878
6870
|
const h = c;
|
|
6879
6871
|
return new qt(h[0], h[1]);
|
|
6880
6872
|
});
|
|
@@ -6949,24 +6941,24 @@ class rr extends Xt {
|
|
|
6949
6941
|
}
|
|
6950
6942
|
}
|
|
6951
6943
|
export {
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6944
|
+
Qo as AvailableModes,
|
|
6945
|
+
er as AvailableValhallaModes,
|
|
6946
|
+
rr as MaplibreMeasureControl,
|
|
6955
6947
|
Xt as MaplibreTerradrawControl,
|
|
6956
|
-
|
|
6948
|
+
sr as MaplibreValhallaControl,
|
|
6957
6949
|
$t as MemoryCache,
|
|
6958
|
-
|
|
6959
|
-
|
|
6950
|
+
Eo as ModalDialog,
|
|
6951
|
+
tr as TERRADRAW_MEASURE_SOURCE_IDS,
|
|
6960
6952
|
re as TERRADRAW_SOURCE_IDS,
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6953
|
+
ir as TERRADRAW_VALHALLA_SOURCE_IDS,
|
|
6954
|
+
zo as ValhallaIsochrone,
|
|
6955
|
+
$o as ValhallaRouting,
|
|
6956
|
+
Po as calcArea,
|
|
6957
|
+
xo as calcDistance,
|
|
6966
6958
|
Pt as capitalize,
|
|
6967
6959
|
Ke as cleanMaplibreStyle,
|
|
6968
|
-
|
|
6969
|
-
|
|
6960
|
+
Go as contourTypeOptions,
|
|
6961
|
+
Co as convertArea,
|
|
6970
6962
|
_e as convertDistance,
|
|
6971
6963
|
ue as convertElevation,
|
|
6972
6964
|
je as costingModelOptions,
|
|
@@ -6975,10 +6967,11 @@ export {
|
|
|
6975
6967
|
Ee as defaultMeasureControlOptions,
|
|
6976
6968
|
q as defaultMeasureUnitSymbols,
|
|
6977
6969
|
z as defaultValhallaControlOptions,
|
|
6978
|
-
|
|
6979
|
-
|
|
6970
|
+
ao as getDefaultModeOptions,
|
|
6971
|
+
no as polygonValidation,
|
|
6972
|
+
Oo as queryElevationByPoint,
|
|
6980
6973
|
It as queryElevationFromRasterDEM,
|
|
6981
|
-
|
|
6982
|
-
|
|
6974
|
+
or as roundFeatureCoordinates,
|
|
6975
|
+
Vo as routingDistanceUnitOptions
|
|
6983
6976
|
};
|
|
6984
6977
|
//# sourceMappingURL=maplibre-gl-terradraw.es.js.map
|