@aapicoits/powermap-web-sdk 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -6
- package/dist/index.d.ts +13 -2
- package/dist/powermap-web-sdk.cjs.cjs +12 -12
- package/dist/powermap-web-sdk.js +410 -377
- package/dist/powermap-web-sdk.umd.cjs +14 -14
- package/package.json +1 -1
package/dist/powermap-web-sdk.js
CHANGED
|
@@ -234,7 +234,7 @@ class Wr {
|
|
|
234
234
|
}
|
|
235
235
|
this.eventBus.emit("mapClick", a);
|
|
236
236
|
try {
|
|
237
|
-
const c = ["poi_level_1", "poi_pa", "poi_pa_label"].filter((
|
|
237
|
+
const c = ["poi_level_1", "poi_pa", "poi_pa_label"].filter((g) => this.map.getLayer(g));
|
|
238
238
|
if (c.length === 0) return;
|
|
239
239
|
const u = this.map.queryRenderedFeatures(a.point, {
|
|
240
240
|
layers: c
|
|
@@ -533,15 +533,15 @@ class qr {
|
|
|
533
533
|
let l = "Marker_1.png";
|
|
534
534
|
n === "start" && (l = "truck_start.png"), n === "destination" && (l = "truck_stop.png"), n === "waypoint" && (l = "stop.png");
|
|
535
535
|
const c = new URL((/* @__PURE__ */ Object.assign({ "../assets/route_icons/Marker_1.png": Mt, "../assets/route_icons/Marker_10.png": It, "../assets/route_icons/Marker_11.png": Bt, "../assets/route_icons/Marker_12.png": xt, "../assets/route_icons/Marker_13.png": kt, "../assets/route_icons/Marker_14.png": St, "../assets/route_icons/Marker_15.png": Pt, "../assets/route_icons/Marker_16.png": Dt, "../assets/route_icons/Marker_17.png": Ft, "../assets/route_icons/Marker_18.png": Lt, "../assets/route_icons/Marker_19.png": Nt, "../assets/route_icons/Marker_2.png": Qt, "../assets/route_icons/Marker_20.png": Ot, "../assets/route_icons/Marker_3.png": Tt, "../assets/route_icons/Marker_4.png": Yt, "../assets/route_icons/Marker_5.png": Gt, "../assets/route_icons/Marker_6.png": Ut, "../assets/route_icons/Marker_7.png": Rt, "../assets/route_icons/Marker_8.png": Ht, "../assets/route_icons/Marker_9.png": zt, "../assets/route_icons/stop.png": Vt, "../assets/route_icons/truck_start.png": Kt, "../assets/route_icons/truck_stop.png": jt }))[`../assets/route_icons/${l}`], import.meta.url).href;
|
|
536
|
-
s.loadImage(c, (u,
|
|
537
|
-
u || s.hasImage(a) || s.addImage(a,
|
|
536
|
+
s.loadImage(c, (u, g) => {
|
|
537
|
+
u || s.hasImage(a) || s.addImage(a, g);
|
|
538
538
|
});
|
|
539
539
|
} else {
|
|
540
540
|
const h = document.createElement("canvas");
|
|
541
541
|
h.width = 52, h.height = 72;
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
const m =
|
|
542
|
+
const d = h.getContext("2d");
|
|
543
|
+
d.clearRect(0, 0, 52, 72), d.beginPath(), d.moveTo(26, 72), d.bezierCurveTo(26, 72, 52, 48, 52, 26), d.arc(26, 26, 26, 0, Math.PI, !0), d.bezierCurveTo(0, 48, 26, 72, 26, 72), d.closePath(), d.fillStyle = e || "#f26522", d.fill(), d.strokeStyle = "#ffffff", d.lineWidth = 3, d.stroke(), d.beginPath(), d.arc(26, 26, 14, 0, Math.PI * 2), d.fillStyle = "#ffffff", d.fill();
|
|
544
|
+
const m = d.getImageData(0, 0, 52, 72);
|
|
545
545
|
s.hasImage(a) || s.addImage(a, m, { pixelRatio: 2 });
|
|
546
546
|
}
|
|
547
547
|
return this.imageRegistry.set(a, { color: e, icon: r, type: n }), a;
|
|
@@ -567,8 +567,8 @@ class qr {
|
|
|
567
567
|
const c = [];
|
|
568
568
|
return a && Array.isArray(a) ? c.push(...a) : s && typeof s == "object" && c.push(s), c.length > 0 && (l += '<div class="pm-popup-actions">', c.forEach((u) => {
|
|
569
569
|
if (u.url) {
|
|
570
|
-
const
|
|
571
|
-
l += `<a href="${u.url}" target="${p}" class="pm-popup-btn" ${h}>${
|
|
570
|
+
const g = u.label || "View Details", p = u.target || "_blank", h = u.color ? `style="background: ${u.color};"` : "";
|
|
571
|
+
l += `<a href="${u.url}" target="${p}" class="pm-popup-btn" ${h}>${g}</a>`;
|
|
572
572
|
}
|
|
573
573
|
}), l += "</div>"), l += "</div>", n && (l += `<div class="pm-popup-footer">${n}</div>`), l;
|
|
574
574
|
}
|
|
@@ -697,35 +697,35 @@ class Jr {
|
|
|
697
697
|
voice_instructions: "true",
|
|
698
698
|
banner_instructions: "true",
|
|
699
699
|
language: e.language || "th"
|
|
700
|
-
}), h = `${this.authManager.getBaseUrl()}/api/v2/map/route/${a}/${s}?${p.toString()}`,
|
|
701
|
-
if (!
|
|
702
|
-
const m = await f.fromResponse(
|
|
700
|
+
}), h = `${this.authManager.getBaseUrl()}/api/v2/map/route/${a}/${s}?${p.toString()}`, d = await this.authManager.fetchWithAuth(h, { source: "routing" });
|
|
701
|
+
if (!d.ok) {
|
|
702
|
+
const m = await f.fromResponse(d, "routing");
|
|
703
703
|
throw this.eventBus.emit("error", m), m;
|
|
704
704
|
}
|
|
705
|
-
c = await
|
|
705
|
+
c = await d.json();
|
|
706
706
|
}
|
|
707
|
-
let u = null,
|
|
707
|
+
let u = null, g = [];
|
|
708
708
|
if (c.routes && c.routes.length > 0) {
|
|
709
709
|
u = c.routes[0];
|
|
710
710
|
const p = typeof u.geometry == "string" ? { type: "LineString", coordinates: this.decodePolyline(u.geometry, 6) } : u.geometry;
|
|
711
|
-
|
|
712
|
-
text:
|
|
713
|
-
distance:
|
|
714
|
-
duration:
|
|
715
|
-
location:
|
|
711
|
+
g = (u.legs || []).flatMap((h) => (h.steps || []).map((d) => ({
|
|
712
|
+
text: d.maneuver ? d.maneuver.instruction : d.text || "Continue",
|
|
713
|
+
distance: d.distance || 0,
|
|
714
|
+
duration: d.duration || 0,
|
|
715
|
+
location: d.maneuver ? d.maneuver.location : null
|
|
716
716
|
}))), this.routeFeature = {
|
|
717
717
|
distance: u.distance,
|
|
718
718
|
// meters
|
|
719
719
|
duration: u.duration,
|
|
720
720
|
// seconds
|
|
721
|
-
steps:
|
|
721
|
+
steps: g,
|
|
722
722
|
geometry: p,
|
|
723
723
|
raw: u
|
|
724
724
|
};
|
|
725
725
|
} else if (c.paths && c.paths.length > 0) {
|
|
726
726
|
u = c.paths[0];
|
|
727
727
|
const p = typeof u.points == "string" ? { type: "LineString", coordinates: this.decodePolyline(u.points, 5) } : u.points;
|
|
728
|
-
|
|
728
|
+
g = (u.instructions || []).map((h) => ({
|
|
729
729
|
text: h.text || "Continue",
|
|
730
730
|
distance: h.distance || 0,
|
|
731
731
|
duration: (h.time || 0) / 1e3,
|
|
@@ -735,7 +735,7 @@ class Jr {
|
|
|
735
735
|
})), this.routeFeature = {
|
|
736
736
|
distance: u.distance,
|
|
737
737
|
duration: (u.time || 0) / 1e3,
|
|
738
|
-
steps:
|
|
738
|
+
steps: g,
|
|
739
739
|
geometry: p,
|
|
740
740
|
raw: u
|
|
741
741
|
};
|
|
@@ -829,8 +829,8 @@ class Jr {
|
|
|
829
829
|
do
|
|
830
830
|
u = e.charCodeAt(o++) - 63, l |= (u & 31) << c, c += 5;
|
|
831
831
|
while (u >= 32);
|
|
832
|
-
const
|
|
833
|
-
i +=
|
|
832
|
+
const g = l & 1 ? ~(l >> 1) : l >> 1;
|
|
833
|
+
i += g, l = 0, c = 0;
|
|
834
834
|
do
|
|
835
835
|
u = e.charCodeAt(o++) - 63, l |= (u & 31) << c, c += 5;
|
|
836
836
|
while (u >= 32);
|
|
@@ -844,57 +844,90 @@ class Xr {
|
|
|
844
844
|
constructor(e) {
|
|
845
845
|
this.authManager = e.authManager, this.eventBus = e.eventBus, this.searchThPath = "/api/v2/map/address_th", this.searchEnPath = "/api/v2/map/address_en";
|
|
846
846
|
}
|
|
847
|
+
/**
|
|
848
|
+
* Helper to perform single endpoint search fetch.
|
|
849
|
+
* @private
|
|
850
|
+
*/
|
|
851
|
+
async _fetchSearch(e, r, o) {
|
|
852
|
+
const i = this.authManager.getBaseUrl(), n = new URL(`${i}${e}`);
|
|
853
|
+
n.searchParams.append("q", r), o && n.searchParams.append("coor", `${o[0]},${o[1]}`);
|
|
854
|
+
const s = await this.authManager.fetchWithAuth(n.toString(), { source: "search" });
|
|
855
|
+
if (!s.ok) {
|
|
856
|
+
const l = await f.fromResponse(s, "search");
|
|
857
|
+
throw this.eventBus.emit("error", l), l;
|
|
858
|
+
}
|
|
859
|
+
const a = await s.json();
|
|
860
|
+
return Array.isArray(a) ? a : (a == null ? void 0 : a.hits) || (a == null ? void 0 : a.results) || [];
|
|
861
|
+
}
|
|
847
862
|
/**
|
|
848
863
|
* Searches for places matching the query.
|
|
849
864
|
* @param {string} query - The search query
|
|
850
865
|
* @param {Object} [options] - Optional parameters
|
|
851
866
|
* @param {Array<number>} [options.location] - [latitude, longitude] to prioritize results
|
|
852
|
-
* @param {string} [options.lang='
|
|
867
|
+
* @param {string} [options.lang='auto'] - Language ('th', 'en', or 'auto')
|
|
853
868
|
* @returns {Promise<Array>} List of search results
|
|
854
869
|
*/
|
|
855
870
|
async search(e, r = {}) {
|
|
871
|
+
var u;
|
|
856
872
|
if (!e || typeof e != "string" || e.trim() === "")
|
|
857
873
|
throw new f("Search query must be a non-empty string.", y.INVALID_PARAMETERS, "search");
|
|
858
|
-
const { location: o, lang: i = "
|
|
859
|
-
if (!["th", "en"].includes(i))
|
|
860
|
-
throw new f('Invalid language option. Supported: "th", "en".', y.INVALID_PARAMETERS, "search");
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
}
|
|
874
|
+
const { location: o, lang: i = "auto" } = r;
|
|
875
|
+
if (i && !["th", "en", "auto"].includes(i.toLowerCase()))
|
|
876
|
+
throw new f('Invalid language option. Supported: "th", "en", "auto".', y.INVALID_PARAMETERS, "search");
|
|
877
|
+
if (o && (!Array.isArray(o) || o.length !== 2))
|
|
878
|
+
throw new f("Location must be an array of [latitude, longitude].", y.INVALID_PARAMETERS, "search");
|
|
879
|
+
const n = (i || "auto").toLowerCase(), s = /[\u0E00-\u0E7F]/.test(e), a = /[a-zA-Z]/.test(e);
|
|
880
|
+
let l = this.searchThPath, c = this.searchEnPath;
|
|
881
|
+
n === "en" ? (l = this.searchEnPath, c = this.searchThPath) : n === "th" ? (l = this.searchThPath, c = this.searchEnPath) : a && !s ? (l = this.searchEnPath, c = this.searchThPath) : (l = this.searchThPath, c = this.searchEnPath);
|
|
867
882
|
try {
|
|
868
|
-
|
|
869
|
-
if (!
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
883
|
+
let g = await this._fetchSearch(l, e, o);
|
|
884
|
+
if (!g || g.length === 0 || n === "auto" && s && a)
|
|
885
|
+
try {
|
|
886
|
+
const h = await this._fetchSearch(c, e, o);
|
|
887
|
+
if (h && h.length > 0)
|
|
888
|
+
if (!g || g.length === 0)
|
|
889
|
+
g = h;
|
|
890
|
+
else {
|
|
891
|
+
const d = new Set(g.map((m) => {
|
|
892
|
+
var w;
|
|
893
|
+
return (w = m._source) == null ? void 0 : w.gid;
|
|
894
|
+
}).filter(Boolean));
|
|
895
|
+
for (const m of h) {
|
|
896
|
+
const w = (u = m._source) == null ? void 0 : u.gid;
|
|
897
|
+
(!w || !d.has(w)) && (g.push(m), w && d.add(w));
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
} catch {
|
|
901
|
+
}
|
|
902
|
+
const p = n === "th" || n === "auto" && s && !a ? "th" : "en";
|
|
903
|
+
return (g || []).map((h) => {
|
|
904
|
+
const d = h._source || {}, m = d.coordinates || [0, 0], w = d.name_t || d.name_e || d.name || "", b = d.name_e || d.name_t || d.name || "", C = d.address_t || (d.tambon_t ? `ต.${d.tambon_t || ""} อ.${d.amphoe_t || ""} จ.${d.province_t || ""}`.trim() : "") || d.address_e || "", M = d.address_e || (d.tambon_e ? `${d.tambon_e || ""} ${d.amphoe_e || ""} ${d.province_e || ""}`.trim() : "") || d.address_t || "", B = p === "th" ? w : b, x = p === "th" ? C : M;
|
|
875
905
|
return {
|
|
876
906
|
gid: d.gid,
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
907
|
+
id: d.gid,
|
|
908
|
+
name: B,
|
|
909
|
+
nameEn: b,
|
|
910
|
+
nameTh: w,
|
|
911
|
+
address: x,
|
|
912
|
+
addressEn: M,
|
|
913
|
+
addressTh: C,
|
|
914
|
+
position: [m[1], m[0]],
|
|
882
915
|
// Return [lat, lng] to match mobile SDK search results
|
|
883
|
-
positionLngLat: [
|
|
916
|
+
positionLngLat: [m[0], m[1]],
|
|
884
917
|
// Extra for web map consumption
|
|
885
|
-
province: d.province_t || "",
|
|
886
|
-
amphoe: d.amphoe_t || "",
|
|
887
|
-
tambon: d.tambon_t || "",
|
|
918
|
+
province: d.province_t || d.province_e || "",
|
|
919
|
+
amphoe: d.amphoe_t || d.amphoe_e || "",
|
|
920
|
+
tambon: d.tambon_t || d.tambon_e || "",
|
|
888
921
|
postCode: d.post_code || "",
|
|
889
922
|
rawData: d
|
|
890
923
|
};
|
|
891
924
|
});
|
|
892
|
-
} catch (
|
|
893
|
-
if (!(
|
|
894
|
-
const
|
|
895
|
-
throw this.eventBus.emit("error",
|
|
925
|
+
} catch (g) {
|
|
926
|
+
if (!(g instanceof f)) {
|
|
927
|
+
const p = new f(g.message, y.UNKNOWN, "search", { originalError: g });
|
|
928
|
+
throw this.eventBus.emit("error", p), p;
|
|
896
929
|
}
|
|
897
|
-
throw
|
|
930
|
+
throw g;
|
|
898
931
|
}
|
|
899
932
|
}
|
|
900
933
|
}
|
|
@@ -926,7 +959,7 @@ const j = {
|
|
|
926
959
|
POLYGON: "polygon",
|
|
927
960
|
LINE: "line_string",
|
|
928
961
|
POINT: "point"
|
|
929
|
-
},
|
|
962
|
+
}, v = {
|
|
930
963
|
FEATURE: "Feature",
|
|
931
964
|
POLYGON: "Polygon",
|
|
932
965
|
LINE_STRING: "LineString",
|
|
@@ -936,7 +969,7 @@ const j = {
|
|
|
936
969
|
MULTI_POINT: "MultiPoint",
|
|
937
970
|
MULTI_LINE_STRING: "MultiLineString",
|
|
938
971
|
MULTI_POLYGON: "MultiPolygon"
|
|
939
|
-
},
|
|
972
|
+
}, I = {
|
|
940
973
|
DRAW_LINE_STRING: "draw_line_string",
|
|
941
974
|
DRAW_POLYGON: "draw_polygon",
|
|
942
975
|
DRAW_POINT: "draw_point",
|
|
@@ -983,10 +1016,10 @@ const j = {
|
|
|
983
1016
|
classes: j,
|
|
984
1017
|
cursors: Q,
|
|
985
1018
|
events: V,
|
|
986
|
-
geojsonTypes:
|
|
1019
|
+
geojsonTypes: v,
|
|
987
1020
|
interactions: ur,
|
|
988
1021
|
meta: U,
|
|
989
|
-
modes:
|
|
1022
|
+
modes: I,
|
|
990
1023
|
sources: Z,
|
|
991
1024
|
types: W,
|
|
992
1025
|
updateActions: Me
|
|
@@ -1126,11 +1159,11 @@ const Jt = {
|
|
|
1126
1159
|
};
|
|
1127
1160
|
function oo(t, e) {
|
|
1128
1161
|
const r = Jt[t.geometry.type] - Jt[e.geometry.type];
|
|
1129
|
-
return r === 0 && t.geometry.type ===
|
|
1162
|
+
return r === 0 && t.geometry.type === v.POLYGON ? t.area - e.area : r;
|
|
1130
1163
|
}
|
|
1131
1164
|
function wr(t) {
|
|
1132
|
-
return t.map((e) => (e.geometry.type ===
|
|
1133
|
-
type:
|
|
1165
|
+
return t.map((e) => (e.geometry.type === v.POLYGON && (e.area = dt.geometry({
|
|
1166
|
+
type: v.FEATURE,
|
|
1134
1167
|
property: {},
|
|
1135
1168
|
geometry: e.geometry
|
|
1136
1169
|
})), e)).sort(oo).map((e) => (delete e.area, e));
|
|
@@ -1330,7 +1363,7 @@ K.prototype.setProperty = function(t, e) {
|
|
|
1330
1363
|
K.prototype.toGeoJSON = function() {
|
|
1331
1364
|
return JSON.parse(JSON.stringify({
|
|
1332
1365
|
id: this.id,
|
|
1333
|
-
type:
|
|
1366
|
+
type: v.FEATURE,
|
|
1334
1367
|
properties: this.properties,
|
|
1335
1368
|
geometry: {
|
|
1336
1369
|
coordinates: this.getCoordinates(),
|
|
@@ -1350,7 +1383,7 @@ K.prototype.internal = function(t) {
|
|
|
1350
1383
|
for (const r in this.properties)
|
|
1351
1384
|
e[`user_${r}`] = this.properties[r];
|
|
1352
1385
|
return {
|
|
1353
|
-
type:
|
|
1386
|
+
type: v.FEATURE,
|
|
1354
1387
|
properties: e,
|
|
1355
1388
|
geometry: {
|
|
1356
1389
|
coordinates: this.getCoordinates(),
|
|
@@ -1445,7 +1478,7 @@ z.prototype._coordinatesToFeatures = function(t) {
|
|
|
1445
1478
|
const e = this.model.bind(this);
|
|
1446
1479
|
return t.map((r) => new e(this.ctx, {
|
|
1447
1480
|
id: ht(),
|
|
1448
|
-
type:
|
|
1481
|
+
type: v.FEATURE,
|
|
1449
1482
|
properties: {},
|
|
1450
1483
|
geometry: {
|
|
1451
1484
|
coordinates: r,
|
|
@@ -1463,7 +1496,7 @@ z.prototype.getCoordinate = function(t) {
|
|
|
1463
1496
|
return He(this.features, "getCoordinate", t);
|
|
1464
1497
|
};
|
|
1465
1498
|
z.prototype.getCoordinates = function() {
|
|
1466
|
-
return JSON.parse(JSON.stringify(this.features.map((t) => t.type ===
|
|
1499
|
+
return JSON.parse(JSON.stringify(this.features.map((t) => t.type === v.POLYGON ? t.getCoordinates() : t.coordinates)));
|
|
1467
1500
|
};
|
|
1468
1501
|
z.prototype.updateCoordinate = function(t, e, r) {
|
|
1469
1502
|
He(this.features, "updateCoordinate", t, e, r), this.changed();
|
|
@@ -1542,12 +1575,12 @@ E.prototype.featuresAt = function(t, e, r = "click") {
|
|
|
1542
1575
|
};
|
|
1543
1576
|
E.prototype.newFeature = function(t) {
|
|
1544
1577
|
const e = t.geometry.type;
|
|
1545
|
-
return e ===
|
|
1578
|
+
return e === v.POINT ? new ge(this._ctx, t) : e === v.LINE_STRING ? new ae(this._ctx, t) : e === v.POLYGON ? new q(this._ctx, t) : new z(this._ctx, t);
|
|
1546
1579
|
};
|
|
1547
1580
|
E.prototype.isInstanceOf = function(t, e) {
|
|
1548
|
-
if (t ===
|
|
1549
|
-
if (t ===
|
|
1550
|
-
if (t ===
|
|
1581
|
+
if (t === v.POINT) return e instanceof ge;
|
|
1582
|
+
if (t === v.LINE_STRING) return e instanceof ae;
|
|
1583
|
+
if (t === v.POLYGON) return e instanceof q;
|
|
1551
1584
|
if (t === "MultiFeature") return e instanceof z;
|
|
1552
1585
|
throw new Error(`Unknown feature class: ${t}`);
|
|
1553
1586
|
};
|
|
@@ -1656,8 +1689,8 @@ function yo(t) {
|
|
|
1656
1689
|
}, i.mousemove = function(p) {
|
|
1657
1690
|
if ((p.originalEvent.buttons !== void 0 ? p.originalEvent.buttons : p.originalEvent.which) === 1)
|
|
1658
1691
|
return i.mousedrag(p);
|
|
1659
|
-
const
|
|
1660
|
-
p.featureTarget =
|
|
1692
|
+
const d = Fe(p, t);
|
|
1693
|
+
p.featureTarget = d, s.mousemove(p);
|
|
1661
1694
|
}, i.mousedown = function(p) {
|
|
1662
1695
|
r = {
|
|
1663
1696
|
time: (/* @__PURE__ */ new Date()).getTime(),
|
|
@@ -1695,29 +1728,29 @@ function yo(t) {
|
|
|
1695
1728
|
}) ? s.tap(p) : s.touchend(p);
|
|
1696
1729
|
};
|
|
1697
1730
|
const a = (p) => {
|
|
1698
|
-
const h = tt(p),
|
|
1699
|
-
return !(h ||
|
|
1731
|
+
const h = tt(p), d = rt(p), m = Ar(p);
|
|
1732
|
+
return !(h || d || m);
|
|
1700
1733
|
};
|
|
1701
1734
|
i.keydown = function(p) {
|
|
1702
|
-
(p.srcElement || p.target).classList.contains(j.CANVAS) && ((tt(p) || rt(p)) && t.options.controls.trash ? (p.preventDefault(), s.trash()) : a(p) ? s.keydown(p) : hr(p) && t.options.controls.point ? l(
|
|
1735
|
+
(p.srcElement || p.target).classList.contains(j.CANVAS) && ((tt(p) || rt(p)) && t.options.controls.trash ? (p.preventDefault(), s.trash()) : a(p) ? s.keydown(p) : hr(p) && t.options.controls.point ? l(I.DRAW_POINT) : mr(p) && t.options.controls.line_string ? l(I.DRAW_LINE_STRING) : fr(p) && t.options.controls.polygon && l(I.DRAW_POLYGON));
|
|
1703
1736
|
}, i.keyup = function(p) {
|
|
1704
1737
|
a(p) && s.keyup(p);
|
|
1705
1738
|
}, i.zoomend = function() {
|
|
1706
1739
|
t.store.changeZoom();
|
|
1707
1740
|
}, i.data = function(p) {
|
|
1708
1741
|
if (p.dataType === "style") {
|
|
1709
|
-
const { setup: h, map:
|
|
1710
|
-
m.styles.some((C) =>
|
|
1742
|
+
const { setup: h, map: d, options: m, store: w } = t;
|
|
1743
|
+
m.styles.some((C) => d.getLayer(C.id)) || (h.addLayers(), w.setDirty(), w.render());
|
|
1711
1744
|
}
|
|
1712
1745
|
};
|
|
1713
|
-
function l(p, h,
|
|
1746
|
+
function l(p, h, d = {}) {
|
|
1714
1747
|
s.stop();
|
|
1715
1748
|
const m = e[p];
|
|
1716
1749
|
if (m === void 0)
|
|
1717
1750
|
throw new Error(`${p} is not valid`);
|
|
1718
1751
|
n = p;
|
|
1719
|
-
const
|
|
1720
|
-
s = st(
|
|
1752
|
+
const w = m(t, h);
|
|
1753
|
+
s = st(w, t), d.silent || t.map.fire(V.MODE_CHANGE, { mode: p }), t.store.setDirty(), t.store.render();
|
|
1721
1754
|
}
|
|
1722
1755
|
const c = {
|
|
1723
1756
|
trash: !1,
|
|
@@ -1726,9 +1759,9 @@ function yo(t) {
|
|
|
1726
1759
|
};
|
|
1727
1760
|
function u(p) {
|
|
1728
1761
|
let h = !1;
|
|
1729
|
-
Object.keys(p).forEach((
|
|
1730
|
-
if (c[
|
|
1731
|
-
c[
|
|
1762
|
+
Object.keys(p).forEach((d) => {
|
|
1763
|
+
if (c[d] === void 0) throw new Error("Invalid action type");
|
|
1764
|
+
c[d] !== p[d] && (h = !0), c[d] = p[d];
|
|
1732
1765
|
}), h && t.map.fire(V.ACTIONABLE, { actions: c });
|
|
1733
1766
|
}
|
|
1734
1767
|
return {
|
|
@@ -1790,10 +1823,10 @@ function bo() {
|
|
|
1790
1823
|
});
|
|
1791
1824
|
}
|
|
1792
1825
|
s && t.ctx.map.getSource(Z.COLD).setData({
|
|
1793
|
-
type:
|
|
1826
|
+
type: v.FEATURE_COLLECTION,
|
|
1794
1827
|
features: t.sources.cold
|
|
1795
1828
|
}), t.ctx.map.getSource(Z.HOT).setData({
|
|
1796
|
-
type:
|
|
1829
|
+
type: v.FEATURE_COLLECTION,
|
|
1797
1830
|
features: t.sources.hot
|
|
1798
1831
|
}), l();
|
|
1799
1832
|
function l() {
|
|
@@ -1811,10 +1844,10 @@ function F(t) {
|
|
|
1811
1844
|
e = null, bo.call(this), this._emitSelectionChange && (this.ctx.events.fire(V.SELECTION_CHANGE, {
|
|
1812
1845
|
features: this.getSelected().map((r) => r.toGeoJSON()),
|
|
1813
1846
|
points: this.getSelectedCoordinates().map((r) => ({
|
|
1814
|
-
type:
|
|
1847
|
+
type: v.FEATURE,
|
|
1815
1848
|
properties: {},
|
|
1816
1849
|
geometry: {
|
|
1817
|
-
type:
|
|
1850
|
+
type: v.POINT,
|
|
1818
1851
|
coordinates: r.coordinates
|
|
1819
1852
|
}
|
|
1820
1853
|
}))
|
|
@@ -1955,19 +1988,19 @@ function vo(t) {
|
|
|
1955
1988
|
}
|
|
1956
1989
|
function a() {
|
|
1957
1990
|
if (!t.container) return;
|
|
1958
|
-
const h = [],
|
|
1991
|
+
const h = [], d = [];
|
|
1959
1992
|
wo.forEach((m) => {
|
|
1960
|
-
i[m] !== o[m] && (h.push(`${m}-${o[m]}`), i[m] !== null &&
|
|
1961
|
-
}), h.length > 0 && t.container.classList.remove(...h),
|
|
1993
|
+
i[m] !== o[m] && (h.push(`${m}-${o[m]}`), i[m] !== null && d.push(`${m}-${i[m]}`));
|
|
1994
|
+
}), h.length > 0 && t.container.classList.remove(...h), d.length > 0 && t.container.classList.add(...d), o = Object.assign(o, i);
|
|
1962
1995
|
}
|
|
1963
|
-
function l(h,
|
|
1996
|
+
function l(h, d = {}) {
|
|
1964
1997
|
const m = document.createElement("button");
|
|
1965
|
-
return m.className = `${j.CONTROL_BUTTON} ${
|
|
1966
|
-
if (
|
|
1967
|
-
c(),
|
|
1998
|
+
return m.className = `${j.CONTROL_BUTTON} ${d.className}`, m.setAttribute("title", d.title), d.container.appendChild(m), m.addEventListener("click", (w) => {
|
|
1999
|
+
if (w.preventDefault(), w.stopPropagation(), w.target === r) {
|
|
2000
|
+
c(), d.onDeactivate();
|
|
1968
2001
|
return;
|
|
1969
2002
|
}
|
|
1970
|
-
u(h),
|
|
2003
|
+
u(h), d.onActivate();
|
|
1971
2004
|
}, !0), m;
|
|
1972
2005
|
}
|
|
1973
2006
|
function c() {
|
|
@@ -1975,56 +2008,56 @@ function vo(t) {
|
|
|
1975
2008
|
}
|
|
1976
2009
|
function u(h) {
|
|
1977
2010
|
c();
|
|
1978
|
-
const
|
|
1979
|
-
|
|
2011
|
+
const d = e[h];
|
|
2012
|
+
d && d && h !== "trash" && (d.classList.add(j.ACTIVE_BUTTON), r = d);
|
|
1980
2013
|
}
|
|
1981
|
-
function
|
|
1982
|
-
const h = t.options.controls,
|
|
1983
|
-
return
|
|
1984
|
-
container:
|
|
2014
|
+
function g() {
|
|
2015
|
+
const h = t.options.controls, d = document.createElement("div");
|
|
2016
|
+
return d.className = `${j.CONTROL_GROUP} ${j.CONTROL_BASE}`, h && (h[W.POINT] && (e[W.POINT] = l(W.POINT, {
|
|
2017
|
+
container: d,
|
|
1985
2018
|
className: j.CONTROL_BUTTON_POINT,
|
|
1986
2019
|
title: `Marker tool ${t.options.keybindings ? "(1)" : ""}`,
|
|
1987
|
-
onActivate: () => t.events.changeMode(
|
|
2020
|
+
onActivate: () => t.events.changeMode(I.DRAW_POINT),
|
|
1988
2021
|
onDeactivate: () => t.events.trash()
|
|
1989
2022
|
})), h[W.LINE] && (e[W.LINE] = l(W.LINE, {
|
|
1990
|
-
container:
|
|
2023
|
+
container: d,
|
|
1991
2024
|
className: j.CONTROL_BUTTON_LINE,
|
|
1992
2025
|
title: `LineString tool ${t.options.keybindings ? "(2)" : ""}`,
|
|
1993
|
-
onActivate: () => t.events.changeMode(
|
|
2026
|
+
onActivate: () => t.events.changeMode(I.DRAW_LINE_STRING),
|
|
1994
2027
|
onDeactivate: () => t.events.trash()
|
|
1995
2028
|
})), h[W.POLYGON] && (e[W.POLYGON] = l(W.POLYGON, {
|
|
1996
|
-
container:
|
|
2029
|
+
container: d,
|
|
1997
2030
|
className: j.CONTROL_BUTTON_POLYGON,
|
|
1998
2031
|
title: `Polygon tool ${t.options.keybindings ? "(3)" : ""}`,
|
|
1999
|
-
onActivate: () => t.events.changeMode(
|
|
2032
|
+
onActivate: () => t.events.changeMode(I.DRAW_POLYGON),
|
|
2000
2033
|
onDeactivate: () => t.events.trash()
|
|
2001
2034
|
})), h.trash && (e.trash = l("trash", {
|
|
2002
|
-
container:
|
|
2035
|
+
container: d,
|
|
2003
2036
|
className: j.CONTROL_BUTTON_TRASH,
|
|
2004
2037
|
title: "Delete",
|
|
2005
2038
|
onActivate: () => {
|
|
2006
2039
|
t.events.trash();
|
|
2007
2040
|
}
|
|
2008
2041
|
})), h.combine_features && (e.combine_features = l("combineFeatures", {
|
|
2009
|
-
container:
|
|
2042
|
+
container: d,
|
|
2010
2043
|
className: j.CONTROL_BUTTON_COMBINE_FEATURES,
|
|
2011
2044
|
title: "Combine",
|
|
2012
2045
|
onActivate: () => {
|
|
2013
2046
|
t.events.combineFeatures();
|
|
2014
2047
|
}
|
|
2015
2048
|
})), h.uncombine_features && (e.uncombine_features = l("uncombineFeatures", {
|
|
2016
|
-
container:
|
|
2049
|
+
container: d,
|
|
2017
2050
|
className: j.CONTROL_BUTTON_UNCOMBINE_FEATURES,
|
|
2018
2051
|
title: "Uncombine",
|
|
2019
2052
|
onActivate: () => {
|
|
2020
2053
|
t.events.uncombineFeatures();
|
|
2021
2054
|
}
|
|
2022
|
-
}))),
|
|
2055
|
+
}))), d;
|
|
2023
2056
|
}
|
|
2024
2057
|
function p() {
|
|
2025
2058
|
Object.keys(e).forEach((h) => {
|
|
2026
|
-
const
|
|
2027
|
-
|
|
2059
|
+
const d = e[h];
|
|
2060
|
+
d.parentNode && d.parentNode.removeChild(d), delete e[h];
|
|
2028
2061
|
});
|
|
2029
2062
|
}
|
|
2030
2063
|
return {
|
|
@@ -2032,7 +2065,7 @@ function vo(t) {
|
|
|
2032
2065
|
queueMapClasses: s,
|
|
2033
2066
|
updateMapClasses: a,
|
|
2034
2067
|
clearMapClasses: n,
|
|
2035
|
-
addButtons:
|
|
2068
|
+
addButtons: g,
|
|
2036
2069
|
removeButtons: p
|
|
2037
2070
|
};
|
|
2038
2071
|
}
|
|
@@ -2058,13 +2091,13 @@ function Co(t) {
|
|
|
2058
2091
|
addLayers() {
|
|
2059
2092
|
t.map.addSource(Z.COLD, {
|
|
2060
2093
|
data: {
|
|
2061
|
-
type:
|
|
2094
|
+
type: v.FEATURE_COLLECTION,
|
|
2062
2095
|
features: []
|
|
2063
2096
|
},
|
|
2064
2097
|
type: "geojson"
|
|
2065
2098
|
}), t.map.addSource(Z.HOT, {
|
|
2066
2099
|
data: {
|
|
2067
|
-
type:
|
|
2100
|
+
type: v.FEATURE_COLLECTION,
|
|
2068
2101
|
features: []
|
|
2069
2102
|
},
|
|
2070
2103
|
type: "geojson"
|
|
@@ -2506,7 +2539,7 @@ function mt(t, e) {
|
|
|
2506
2539
|
}
|
|
2507
2540
|
function be(t, e, r, o) {
|
|
2508
2541
|
return {
|
|
2509
|
-
type:
|
|
2542
|
+
type: v.FEATURE,
|
|
2510
2543
|
properties: {
|
|
2511
2544
|
meta: U.VERTEX,
|
|
2512
2545
|
parent: t,
|
|
@@ -2514,7 +2547,7 @@ function be(t, e, r, o) {
|
|
|
2514
2547
|
active: o ? Y.ACTIVE : Y.INACTIVE
|
|
2515
2548
|
},
|
|
2516
2549
|
geometry: {
|
|
2517
|
-
type:
|
|
2550
|
+
type: v.POINT,
|
|
2518
2551
|
coordinates: e
|
|
2519
2552
|
}
|
|
2520
2553
|
};
|
|
@@ -2602,8 +2635,8 @@ function at(t) {
|
|
|
2602
2635
|
}
|
|
2603
2636
|
function ze(t, e, r) {
|
|
2604
2637
|
if (t !== null)
|
|
2605
|
-
for (var o, i, n, s, a, l, c, u = 0,
|
|
2606
|
-
c =
|
|
2638
|
+
for (var o, i, n, s, a, l, c, u = 0, g = 0, p, h = t.type, d = h === "FeatureCollection", m = h === "Feature", w = d ? t.features.length : 1, b = 0; b < w; b++) {
|
|
2639
|
+
c = d ? (
|
|
2607
2640
|
// @ts-expect-error: Known type conflict
|
|
2608
2641
|
t.features[b].geometry
|
|
2609
2642
|
) : m ? (
|
|
@@ -2611,11 +2644,11 @@ function ze(t, e, r) {
|
|
|
2611
2644
|
t.geometry
|
|
2612
2645
|
) : t, p = c ? c.type === "GeometryCollection" : !1, a = p ? c.geometries.length : 1;
|
|
2613
2646
|
for (var C = 0; C < a; C++) {
|
|
2614
|
-
var
|
|
2647
|
+
var M = 0, B = 0;
|
|
2615
2648
|
if (s = p ? c.geometries[C] : c, s !== null) {
|
|
2616
2649
|
l = s.coordinates;
|
|
2617
|
-
var
|
|
2618
|
-
switch (u = r && (
|
|
2650
|
+
var x = s.type;
|
|
2651
|
+
switch (u = r && (x === "Polygon" || x === "MultiPolygon") ? 1 : 0, x) {
|
|
2619
2652
|
case null:
|
|
2620
2653
|
break;
|
|
2621
2654
|
case "Point":
|
|
@@ -2623,14 +2656,14 @@ function ze(t, e, r) {
|
|
|
2623
2656
|
// @ts-expect-error: Known type conflict
|
|
2624
2657
|
e(
|
|
2625
2658
|
l,
|
|
2626
|
-
|
|
2659
|
+
g,
|
|
2627
2660
|
b,
|
|
2628
|
-
|
|
2629
|
-
|
|
2661
|
+
M,
|
|
2662
|
+
B
|
|
2630
2663
|
) === !1
|
|
2631
2664
|
)
|
|
2632
2665
|
return !1;
|
|
2633
|
-
|
|
2666
|
+
g++, M++;
|
|
2634
2667
|
break;
|
|
2635
2668
|
case "LineString":
|
|
2636
2669
|
case "MultiPoint":
|
|
@@ -2639,16 +2672,16 @@ function ze(t, e, r) {
|
|
|
2639
2672
|
// @ts-expect-error: Known type conflict
|
|
2640
2673
|
e(
|
|
2641
2674
|
l[o],
|
|
2642
|
-
|
|
2675
|
+
g,
|
|
2643
2676
|
b,
|
|
2644
|
-
|
|
2645
|
-
|
|
2677
|
+
M,
|
|
2678
|
+
B
|
|
2646
2679
|
) === !1
|
|
2647
2680
|
)
|
|
2648
2681
|
return !1;
|
|
2649
|
-
|
|
2682
|
+
g++, x === "MultiPoint" && M++;
|
|
2650
2683
|
}
|
|
2651
|
-
|
|
2684
|
+
x === "LineString" && M++;
|
|
2652
2685
|
break;
|
|
2653
2686
|
case "Polygon":
|
|
2654
2687
|
case "MultiLineString":
|
|
@@ -2658,39 +2691,39 @@ function ze(t, e, r) {
|
|
|
2658
2691
|
// @ts-expect-error: Known type conflict
|
|
2659
2692
|
e(
|
|
2660
2693
|
l[o][i],
|
|
2661
|
-
|
|
2694
|
+
g,
|
|
2662
2695
|
b,
|
|
2663
|
-
|
|
2664
|
-
|
|
2696
|
+
M,
|
|
2697
|
+
B
|
|
2665
2698
|
) === !1
|
|
2666
2699
|
)
|
|
2667
2700
|
return !1;
|
|
2668
|
-
|
|
2701
|
+
g++;
|
|
2669
2702
|
}
|
|
2670
|
-
|
|
2703
|
+
x === "MultiLineString" && M++, x === "Polygon" && B++;
|
|
2671
2704
|
}
|
|
2672
|
-
|
|
2705
|
+
x === "Polygon" && M++;
|
|
2673
2706
|
break;
|
|
2674
2707
|
case "MultiPolygon":
|
|
2675
2708
|
for (o = 0; o < l.length; o++) {
|
|
2676
|
-
for (
|
|
2709
|
+
for (B = 0, i = 0; i < l[o].length; i++) {
|
|
2677
2710
|
for (n = 0; n < l[o][i].length - u; n++) {
|
|
2678
2711
|
if (
|
|
2679
2712
|
// @ts-expect-error: Known type conflict
|
|
2680
2713
|
e(
|
|
2681
2714
|
l[o][i][n],
|
|
2682
|
-
|
|
2715
|
+
g,
|
|
2683
2716
|
b,
|
|
2684
|
-
|
|
2685
|
-
|
|
2717
|
+
M,
|
|
2718
|
+
B
|
|
2686
2719
|
) === !1
|
|
2687
2720
|
)
|
|
2688
2721
|
return !1;
|
|
2689
|
-
|
|
2722
|
+
g++;
|
|
2690
2723
|
}
|
|
2691
|
-
|
|
2724
|
+
B++;
|
|
2692
2725
|
}
|
|
2693
|
-
|
|
2726
|
+
M++;
|
|
2694
2727
|
}
|
|
2695
2728
|
break;
|
|
2696
2729
|
case "GeometryCollection":
|
|
@@ -2709,30 +2742,30 @@ function ze(t, e, r) {
|
|
|
2709
2742
|
}
|
|
2710
2743
|
}
|
|
2711
2744
|
function xr(t, e) {
|
|
2712
|
-
var r, o, i, n, s, a, l, c, u,
|
|
2745
|
+
var r, o, i, n, s, a, l, c, u, g, p = 0, h = t.type === "FeatureCollection", d = t.type === "Feature", m = h ? t.features.length : 1;
|
|
2713
2746
|
for (r = 0; r < m; r++) {
|
|
2714
2747
|
for (a = h ? (
|
|
2715
2748
|
// @ts-expect-error: Known type conflict
|
|
2716
2749
|
t.features[r].geometry
|
|
2717
|
-
) :
|
|
2750
|
+
) : d ? (
|
|
2718
2751
|
// @ts-expect-error: Known type conflict
|
|
2719
2752
|
t.geometry
|
|
2720
2753
|
) : t, c = h ? (
|
|
2721
2754
|
// @ts-expect-error: Known type conflict
|
|
2722
2755
|
t.features[r].properties
|
|
2723
|
-
) :
|
|
2756
|
+
) : d ? (
|
|
2724
2757
|
// @ts-expect-error: Known type conflict
|
|
2725
2758
|
t.properties
|
|
2726
2759
|
) : {}, u = h ? (
|
|
2727
2760
|
// @ts-expect-error: Known type conflict
|
|
2728
2761
|
t.features[r].bbox
|
|
2729
|
-
) :
|
|
2762
|
+
) : d ? (
|
|
2730
2763
|
// @ts-expect-error: Known type conflict
|
|
2731
2764
|
t.bbox
|
|
2732
|
-
) : void 0,
|
|
2765
|
+
) : void 0, g = h ? (
|
|
2733
2766
|
// @ts-expect-error: Known type conflict
|
|
2734
2767
|
t.features[r].id
|
|
2735
|
-
) :
|
|
2768
|
+
) : d ? (
|
|
2736
2769
|
// @ts-expect-error: Known type conflict
|
|
2737
2770
|
t.id
|
|
2738
2771
|
) : void 0, l = a ? a.type === "GeometryCollection" : !1, s = l ? a.geometries.length : 1, i = 0; i < s; i++) {
|
|
@@ -2745,7 +2778,7 @@ function xr(t, e) {
|
|
|
2745
2778
|
p,
|
|
2746
2779
|
c,
|
|
2747
2780
|
u,
|
|
2748
|
-
|
|
2781
|
+
g
|
|
2749
2782
|
) === !1
|
|
2750
2783
|
)
|
|
2751
2784
|
return !1;
|
|
@@ -2765,7 +2798,7 @@ function xr(t, e) {
|
|
|
2765
2798
|
p,
|
|
2766
2799
|
c,
|
|
2767
2800
|
u,
|
|
2768
|
-
|
|
2801
|
+
g
|
|
2769
2802
|
) === !1
|
|
2770
2803
|
)
|
|
2771
2804
|
return !1;
|
|
@@ -2780,7 +2813,7 @@ function xr(t, e) {
|
|
|
2780
2813
|
p,
|
|
2781
2814
|
c,
|
|
2782
2815
|
u,
|
|
2783
|
-
|
|
2816
|
+
g
|
|
2784
2817
|
) === !1
|
|
2785
2818
|
)
|
|
2786
2819
|
return !1;
|
|
@@ -2845,13 +2878,13 @@ function ko(t, e) {
|
|
|
2845
2878
|
c < r.coordinates.length;
|
|
2846
2879
|
c++
|
|
2847
2880
|
) {
|
|
2848
|
-
var u = r.coordinates[c],
|
|
2881
|
+
var u = r.coordinates[c], g = {
|
|
2849
2882
|
type: l,
|
|
2850
2883
|
coordinates: u
|
|
2851
2884
|
};
|
|
2852
2885
|
if (
|
|
2853
2886
|
// @ts-expect-error: Known type conflict
|
|
2854
|
-
e(Ee(
|
|
2887
|
+
e(Ee(g, i), o, c) === !1
|
|
2855
2888
|
)
|
|
2856
2889
|
return !1;
|
|
2857
2890
|
}
|
|
@@ -2868,24 +2901,24 @@ function So(t, e) {
|
|
|
2868
2901
|
// @ts-expect-error: Known type conflict
|
|
2869
2902
|
ze(
|
|
2870
2903
|
r,
|
|
2871
|
-
function(
|
|
2904
|
+
function(g, p, h, d, m) {
|
|
2872
2905
|
if (
|
|
2873
2906
|
// @ts-expect-error: Known type conflict
|
|
2874
|
-
a === void 0 || o > l ||
|
|
2907
|
+
a === void 0 || o > l || d > c || m > u
|
|
2875
2908
|
) {
|
|
2876
|
-
a =
|
|
2909
|
+
a = g, l = o, c = d, u = m, n = 0;
|
|
2877
2910
|
return;
|
|
2878
2911
|
}
|
|
2879
|
-
var
|
|
2912
|
+
var w = Mo(
|
|
2880
2913
|
// @ts-expect-error: Known type conflict
|
|
2881
|
-
[a,
|
|
2914
|
+
[a, g],
|
|
2882
2915
|
r.properties
|
|
2883
2916
|
);
|
|
2884
2917
|
if (
|
|
2885
2918
|
// @ts-expect-error: Known type conflict
|
|
2886
2919
|
e(
|
|
2887
2920
|
// @ts-expect-error: Known type conflict
|
|
2888
|
-
|
|
2921
|
+
w,
|
|
2889
2922
|
o,
|
|
2890
2923
|
i,
|
|
2891
2924
|
m,
|
|
@@ -2893,7 +2926,7 @@ function So(t, e) {
|
|
|
2893
2926
|
) === !1
|
|
2894
2927
|
)
|
|
2895
2928
|
return !1;
|
|
2896
|
-
n++, a =
|
|
2929
|
+
n++, a = g;
|
|
2897
2930
|
}
|
|
2898
2931
|
) === !1
|
|
2899
2932
|
)
|
|
@@ -3015,7 +3048,7 @@ function Fr(t, e, r) {
|
|
|
3015
3048
|
const o = e.geometry.coordinates, i = r.geometry.coordinates;
|
|
3016
3049
|
if (o[1] > et || o[1] < $e || i[1] > et || i[1] < $e)
|
|
3017
3050
|
return null;
|
|
3018
|
-
const n = _t(o), s = _t(i), a = (
|
|
3051
|
+
const n = _t(o), s = _t(i), a = (g) => Number(g.toFixed(8)), l = (g, p) => (g + p) / 2, c = Lo([
|
|
3019
3052
|
l(n[0], s[0]),
|
|
3020
3053
|
l(n[1], s[1])
|
|
3021
3054
|
]), u = [
|
|
@@ -3023,7 +3056,7 @@ function Fr(t, e, r) {
|
|
|
3023
3056
|
a(c[1])
|
|
3024
3057
|
];
|
|
3025
3058
|
return {
|
|
3026
|
-
type:
|
|
3059
|
+
type: v.FEATURE,
|
|
3027
3060
|
properties: {
|
|
3028
3061
|
meta: U.MIDPOINT,
|
|
3029
3062
|
parent: t,
|
|
@@ -3032,7 +3065,7 @@ function Fr(t, e, r) {
|
|
|
3032
3065
|
coord_path: r.properties.coord_path
|
|
3033
3066
|
},
|
|
3034
3067
|
geometry: {
|
|
3035
|
-
type:
|
|
3068
|
+
type: v.POINT,
|
|
3036
3069
|
coordinates: u
|
|
3037
3070
|
}
|
|
3038
3071
|
};
|
|
@@ -3040,19 +3073,19 @@ function Fr(t, e, r) {
|
|
|
3040
3073
|
function Ve(t, e = {}, r = null) {
|
|
3041
3074
|
const { type: o, coordinates: i } = t.geometry, n = t.properties && t.properties.id;
|
|
3042
3075
|
let s = [];
|
|
3043
|
-
o ===
|
|
3044
|
-
a(u, r !== null ? `${r}.${
|
|
3045
|
-
}) : o ===
|
|
3046
|
-
function a(u,
|
|
3076
|
+
o === v.POINT ? s.push(be(n, i, r, l(r))) : o === v.POLYGON ? i.forEach((u, g) => {
|
|
3077
|
+
a(u, r !== null ? `${r}.${g}` : String(g));
|
|
3078
|
+
}) : o === v.LINE_STRING ? a(i, r) : o.indexOf(v.MULTI_PREFIX) === 0 && c();
|
|
3079
|
+
function a(u, g) {
|
|
3047
3080
|
let p = "", h = null;
|
|
3048
|
-
u.forEach((
|
|
3049
|
-
const
|
|
3081
|
+
u.forEach((d, m) => {
|
|
3082
|
+
const w = g != null ? `${g}.${m}` : String(m), b = be(n, d, w, l(w));
|
|
3050
3083
|
if (e.midpoints && h) {
|
|
3051
|
-
const
|
|
3052
|
-
|
|
3084
|
+
const M = Fr(n, h, b);
|
|
3085
|
+
M && s.push(M);
|
|
3053
3086
|
}
|
|
3054
3087
|
h = b;
|
|
3055
|
-
const C = JSON.stringify(
|
|
3088
|
+
const C = JSON.stringify(d);
|
|
3056
3089
|
p !== C && s.push(b), m === 0 && (p = C);
|
|
3057
3090
|
});
|
|
3058
3091
|
}
|
|
@@ -3060,14 +3093,14 @@ function Ve(t, e = {}, r = null) {
|
|
|
3060
3093
|
return e.selectedPaths ? e.selectedPaths.indexOf(u) !== -1 : !1;
|
|
3061
3094
|
}
|
|
3062
3095
|
function c() {
|
|
3063
|
-
const u = o.replace(
|
|
3064
|
-
i.forEach((
|
|
3096
|
+
const u = o.replace(v.MULTI_PREFIX, "");
|
|
3097
|
+
i.forEach((g, p) => {
|
|
3065
3098
|
const h = {
|
|
3066
|
-
type:
|
|
3099
|
+
type: v.FEATURE,
|
|
3067
3100
|
properties: t.properties,
|
|
3068
3101
|
geometry: {
|
|
3069
3102
|
type: u,
|
|
3070
|
-
coordinates:
|
|
3103
|
+
coordinates: g
|
|
3071
3104
|
}
|
|
3072
3105
|
};
|
|
3073
3106
|
s = s.concat(Ve(h, e, p));
|
|
@@ -3108,8 +3141,8 @@ function Qo(t) {
|
|
|
3108
3141
|
function At(t, e) {
|
|
3109
3142
|
let r = Se, o = Pe, i = Se, n = Pe, s = ir, a = or;
|
|
3110
3143
|
t.forEach((c) => {
|
|
3111
|
-
const u = Qo(c),
|
|
3112
|
-
|
|
3144
|
+
const u = Qo(c), g = u[1], p = u[3], h = u[0], d = u[2];
|
|
3145
|
+
g > r && (r = g), p < o && (o = p), p > i && (i = p), g < n && (n = g), h < s && (s = h), d > a && (a = d);
|
|
3113
3146
|
});
|
|
3114
3147
|
const l = e;
|
|
3115
3148
|
return r + l.lat > rr && (l.lat = rr - r), i + l.lat > Pe && (l.lat = Pe - i), o + l.lat < tr && (l.lat = tr - o), n + l.lat < Se && (l.lat = Se - n), s + l.lng <= or && (l.lng += Math.ceil(Math.abs(l.lng) / 360) * 360), a + l.lng >= ir && (l.lng -= Math.ceil(Math.abs(l.lng) / 360) * 360), l;
|
|
@@ -3125,7 +3158,7 @@ function yt(t, e) {
|
|
|
3125
3158
|
return [u.lng, u.lat];
|
|
3126
3159
|
}, s = (c) => c.map((u) => n(u)), a = (c) => c.map((u) => s(u));
|
|
3127
3160
|
let l;
|
|
3128
|
-
o.type ===
|
|
3161
|
+
o.type === v.POINT ? l = n(i) : o.type === v.LINE_STRING || o.type === v.MULTI_POINT ? l = i.map(n) : o.type === v.POLYGON || o.type === v.MULTI_LINE_STRING ? l = i.map(s) : o.type === v.MULTI_POLYGON && (l = i.map(a)), o.incomingCoords(l);
|
|
3129
3162
|
});
|
|
3130
3163
|
}
|
|
3131
3164
|
const P = {};
|
|
@@ -3197,7 +3230,7 @@ P.clickAnywhere = function(t) {
|
|
|
3197
3230
|
e.length && (this.clearSelectedFeatures(), e.forEach((r) => this.doRender(r))), te.enable(this), this.stopExtendedInteractions(t);
|
|
3198
3231
|
};
|
|
3199
3232
|
P.clickOnVertex = function(t, e) {
|
|
3200
|
-
this.changeMode(
|
|
3233
|
+
this.changeMode(I.DIRECT_SELECT, {
|
|
3201
3234
|
featureId: e.featureTarget.properties.parent,
|
|
3202
3235
|
coordPath: e.featureTarget.properties.coord_path,
|
|
3203
3236
|
startPos: e.lngLat
|
|
@@ -3209,8 +3242,8 @@ P.startOnActiveFeature = function(t, e) {
|
|
|
3209
3242
|
P.clickOnFeature = function(t, e) {
|
|
3210
3243
|
te.disable(this), this.stopExtendedInteractions(t);
|
|
3211
3244
|
const r = Ne(e), o = this.getSelectedIds(), i = e.featureTarget.properties.id, n = this.isSelected(i);
|
|
3212
|
-
if (!r && n && this.getFeature(i).type !==
|
|
3213
|
-
return this.changeMode(
|
|
3245
|
+
if (!r && n && this.getFeature(i).type !== v.POINT)
|
|
3246
|
+
return this.changeMode(I.DIRECT_SELECT, {
|
|
3214
3247
|
featureId: i
|
|
3215
3248
|
});
|
|
3216
3249
|
n && r ? (this.deselect(i), this.updateUIClasses({ mouse: Q.POINTER }), o.length === 1 && te.enable(this)) : !n && r ? (this.select(i), this.updateUIClasses({ mouse: Q.MOVE })) : !n && !r && (o.forEach((s) => this.doRender(s)), this.setSelected(i), this.updateUIClasses({ mouse: Q.MOVE })), this.doRender(i);
|
|
@@ -3255,7 +3288,7 @@ P.onTouchEnd = P.onMouseUp = function(t, e) {
|
|
|
3255
3288
|
this.stopExtendedInteractions(t);
|
|
3256
3289
|
};
|
|
3257
3290
|
P.toDisplayFeatures = function(t, e, r) {
|
|
3258
|
-
e.properties.active = this.isSelected(e.properties.id) ? Y.ACTIVE : Y.INACTIVE, r(e), this.fireActionable(), !(e.properties.active !== Y.ACTIVE || e.geometry.type ===
|
|
3291
|
+
e.properties.active = this.isSelected(e.properties.id) ? Y.ACTIVE : Y.INACTIVE, r(e), this.fireActionable(), !(e.properties.active !== Y.ACTIVE || e.geometry.type === v.POINT) && Ve(e).forEach(r);
|
|
3259
3292
|
};
|
|
3260
3293
|
P.onTrash = function() {
|
|
3261
3294
|
this.deleteFeature(this.getSelectedIds()), this.fireActionable();
|
|
@@ -3274,7 +3307,7 @@ P.onCombineFeatures = function() {
|
|
|
3274
3307
|
}
|
|
3275
3308
|
if (r.length > 1) {
|
|
3276
3309
|
const i = this.newFeature({
|
|
3277
|
-
type:
|
|
3310
|
+
type: v.FEATURE,
|
|
3278
3311
|
properties: r[0].properties,
|
|
3279
3312
|
geometry: {
|
|
3280
3313
|
type: `Multi${o}`,
|
|
@@ -3346,10 +3379,10 @@ D.dragFeature = function(t, e, r) {
|
|
|
3346
3379
|
};
|
|
3347
3380
|
D.dragVertex = function(t, e, r) {
|
|
3348
3381
|
const o = t.selectedCoordPaths.map((s) => t.feature.getCoordinate(s)), i = o.map((s) => ({
|
|
3349
|
-
type:
|
|
3382
|
+
type: v.FEATURE,
|
|
3350
3383
|
properties: {},
|
|
3351
3384
|
geometry: {
|
|
3352
|
-
type:
|
|
3385
|
+
type: v.POINT,
|
|
3353
3386
|
coordinates: s
|
|
3354
3387
|
}
|
|
3355
3388
|
})), n = At(i, r);
|
|
@@ -3359,10 +3392,10 @@ D.dragVertex = function(t, e, r) {
|
|
|
3359
3392
|
}
|
|
3360
3393
|
};
|
|
3361
3394
|
D.clickNoTarget = function() {
|
|
3362
|
-
this.changeMode(
|
|
3395
|
+
this.changeMode(I.SIMPLE_SELECT);
|
|
3363
3396
|
};
|
|
3364
3397
|
D.clickInactive = function() {
|
|
3365
|
-
this.changeMode(
|
|
3398
|
+
this.changeMode(I.SIMPLE_SELECT);
|
|
3366
3399
|
};
|
|
3367
3400
|
D.clickActiveFeature = function(t) {
|
|
3368
3401
|
t.selectedCoordPaths = [], this.clearSelectedCoordinates(), t.feature.changed();
|
|
@@ -3371,7 +3404,7 @@ D.onSetup = function(t) {
|
|
|
3371
3404
|
const e = t.featureId, r = this.getFeature(e);
|
|
3372
3405
|
if (!r)
|
|
3373
3406
|
throw new Error("You must provide a featureId to enter direct_select mode");
|
|
3374
|
-
if (r.type ===
|
|
3407
|
+
if (r.type === v.POINT)
|
|
3375
3408
|
throw new TypeError("direct_select mode doesn't handle point features");
|
|
3376
3409
|
const o = {
|
|
3377
3410
|
featureId: e,
|
|
@@ -3396,7 +3429,7 @@ D.toDisplayFeatures = function(t, e, r) {
|
|
|
3396
3429
|
}).forEach(r)) : (e.properties.active = Y.INACTIVE, r(e)), this.fireActionable(t);
|
|
3397
3430
|
};
|
|
3398
3431
|
D.onTrash = function(t) {
|
|
3399
|
-
t.selectedCoordPaths.sort((e, r) => r.localeCompare(e, "en", { numeric: !0 })).forEach((e) => t.feature.removeCoordinate(e)), this.fireUpdate(), t.selectedCoordPaths = [], this.clearSelectedCoordinates(), this.fireActionable(t), t.feature.isValid() === !1 && (this.deleteFeature([t.featureId]), this.changeMode(
|
|
3432
|
+
t.selectedCoordPaths.sort((e, r) => r.localeCompare(e, "en", { numeric: !0 })).forEach((e) => t.feature.removeCoordinate(e)), this.fireUpdate(), t.selectedCoordPaths = [], this.clearSelectedCoordinates(), this.fireActionable(t), t.feature.isValid() === !1 && (this.deleteFeature([t.featureId]), this.changeMode(I.SIMPLE_SELECT, {}));
|
|
3400
3433
|
};
|
|
3401
3434
|
D.onMouseMove = function(t, e) {
|
|
3402
3435
|
const r = fe(e), o = Lr(e), i = Nr(e), n = t.selectedCoordPaths.length === 0;
|
|
@@ -3436,10 +3469,10 @@ D.onTouchEnd = D.onMouseUp = function(t) {
|
|
|
3436
3469
|
const se = {};
|
|
3437
3470
|
se.onSetup = function() {
|
|
3438
3471
|
const t = this.newFeature({
|
|
3439
|
-
type:
|
|
3472
|
+
type: v.FEATURE,
|
|
3440
3473
|
properties: {},
|
|
3441
3474
|
geometry: {
|
|
3442
|
-
type:
|
|
3475
|
+
type: v.POINT,
|
|
3443
3476
|
coordinates: []
|
|
3444
3477
|
}
|
|
3445
3478
|
});
|
|
@@ -3448,12 +3481,12 @@ se.onSetup = function() {
|
|
|
3448
3481
|
}), { point: t };
|
|
3449
3482
|
};
|
|
3450
3483
|
se.stopDrawingAndRemove = function(t) {
|
|
3451
|
-
this.deleteFeature([t.point.id], { silent: !0 }), this.changeMode(
|
|
3484
|
+
this.deleteFeature([t.point.id], { silent: !0 }), this.changeMode(I.SIMPLE_SELECT);
|
|
3452
3485
|
};
|
|
3453
3486
|
se.onTap = se.onClick = function(t, e) {
|
|
3454
3487
|
this.updateUIClasses({ mouse: Q.MOVE }), t.point.updateCoordinate("", e.lngLat.lng, e.lngLat.lat), this.fire(V.CREATE, {
|
|
3455
3488
|
features: [t.point.toGeoJSON()]
|
|
3456
|
-
}), this.changeMode(
|
|
3489
|
+
}), this.changeMode(I.SIMPLE_SELECT, { featureIds: [t.point.id] });
|
|
3457
3490
|
};
|
|
3458
3491
|
se.onStop = function(t) {
|
|
3459
3492
|
this.activateUIButton(), t.point.getCoordinate().length || this.deleteFeature([t.point.id], { silent: !0 });
|
|
@@ -3473,10 +3506,10 @@ function Qe(t, e) {
|
|
|
3473
3506
|
const re = {};
|
|
3474
3507
|
re.onSetup = function() {
|
|
3475
3508
|
const t = this.newFeature({
|
|
3476
|
-
type:
|
|
3509
|
+
type: v.FEATURE,
|
|
3477
3510
|
properties: {},
|
|
3478
3511
|
geometry: {
|
|
3479
|
-
type:
|
|
3512
|
+
type: v.POLYGON,
|
|
3480
3513
|
coordinates: [[]]
|
|
3481
3514
|
}
|
|
3482
3515
|
});
|
|
@@ -3489,11 +3522,11 @@ re.onSetup = function() {
|
|
|
3489
3522
|
};
|
|
3490
3523
|
re.clickAnywhere = function(t, e) {
|
|
3491
3524
|
if (t.currentVertexPosition > 0 && Qe(e, t.polygon.coordinates[0][t.currentVertexPosition - 1]))
|
|
3492
|
-
return this.changeMode(
|
|
3525
|
+
return this.changeMode(I.SIMPLE_SELECT, { featureIds: [t.polygon.id] });
|
|
3493
3526
|
this.updateUIClasses({ mouse: Q.ADD }), t.polygon.updateCoordinate(`0.${t.currentVertexPosition}`, e.lngLat.lng, e.lngLat.lat), t.currentVertexPosition++, t.polygon.updateCoordinate(`0.${t.currentVertexPosition}`, e.lngLat.lng, e.lngLat.lat);
|
|
3494
3527
|
};
|
|
3495
3528
|
re.clickOnVertex = function(t) {
|
|
3496
|
-
return this.changeMode(
|
|
3529
|
+
return this.changeMode(I.SIMPLE_SELECT, { featureIds: [t.polygon.id] });
|
|
3497
3530
|
};
|
|
3498
3531
|
re.onMouseMove = function(t, e) {
|
|
3499
3532
|
t.polygon.updateCoordinate(`0.${t.currentVertexPosition}`, e.lngLat.lng, e.lngLat.lat), Ie(e) && this.updateUIClasses({ mouse: Q.POINTER });
|
|
@@ -3502,12 +3535,12 @@ re.onTap = re.onClick = function(t, e) {
|
|
|
3502
3535
|
return Ie(e) ? this.clickOnVertex(t, e) : this.clickAnywhere(t, e);
|
|
3503
3536
|
};
|
|
3504
3537
|
re.onKeyUp = function(t, e) {
|
|
3505
|
-
Ge(e) ? (this.deleteFeature([t.polygon.id], { silent: !0 }), this.changeMode(
|
|
3538
|
+
Ge(e) ? (this.deleteFeature([t.polygon.id], { silent: !0 }), this.changeMode(I.SIMPLE_SELECT)) : Ue(e) && this.changeMode(I.SIMPLE_SELECT, { featureIds: [t.polygon.id] });
|
|
3506
3539
|
};
|
|
3507
3540
|
re.onStop = function(t) {
|
|
3508
3541
|
this.updateUIClasses({ mouse: Q.NONE }), te.enable(this), this.activateUIButton(), this.getFeature(t.polygon.id) !== void 0 && (t.polygon.removeCoordinate(`0.${t.currentVertexPosition}`), t.polygon.isValid() ? this.fire(V.CREATE, {
|
|
3509
3542
|
features: [t.polygon.toGeoJSON()]
|
|
3510
|
-
}) : (this.deleteFeature([t.polygon.id], { silent: !0 }), this.changeMode(
|
|
3543
|
+
}) : (this.deleteFeature([t.polygon.id], { silent: !0 }), this.changeMode(I.SIMPLE_SELECT, {}, { silent: !0 })));
|
|
3511
3544
|
};
|
|
3512
3545
|
re.toDisplayFeatures = function(t, e, r) {
|
|
3513
3546
|
const o = e.properties.id === t.polygon.id;
|
|
@@ -3525,11 +3558,11 @@ re.toDisplayFeatures = function(t, e, r) {
|
|
|
3525
3558
|
[e.geometry.coordinates[0][1][0], e.geometry.coordinates[0][1][1]]
|
|
3526
3559
|
];
|
|
3527
3560
|
if (r({
|
|
3528
|
-
type:
|
|
3561
|
+
type: v.FEATURE,
|
|
3529
3562
|
properties: e.properties,
|
|
3530
3563
|
geometry: {
|
|
3531
3564
|
coordinates: n,
|
|
3532
|
-
type:
|
|
3565
|
+
type: v.LINE_STRING
|
|
3533
3566
|
}
|
|
3534
3567
|
}), i === 3)
|
|
3535
3568
|
return;
|
|
@@ -3538,7 +3571,7 @@ re.toDisplayFeatures = function(t, e, r) {
|
|
|
3538
3571
|
}
|
|
3539
3572
|
};
|
|
3540
3573
|
re.onTrash = function(t) {
|
|
3541
|
-
this.deleteFeature([t.polygon.id], { silent: !0 }), this.changeMode(
|
|
3574
|
+
this.deleteFeature([t.polygon.id], { silent: !0 }), this.changeMode(I.SIMPLE_SELECT);
|
|
3542
3575
|
};
|
|
3543
3576
|
const oe = {};
|
|
3544
3577
|
oe.onSetup = function(t) {
|
|
@@ -3560,10 +3593,10 @@ oe.onSetup = function(t) {
|
|
|
3560
3593
|
throw new Error("`from` should match the point at either the start or the end of the provided LineString");
|
|
3561
3594
|
} else
|
|
3562
3595
|
r = this.newFeature({
|
|
3563
|
-
type:
|
|
3596
|
+
type: v.FEATURE,
|
|
3564
3597
|
properties: {},
|
|
3565
3598
|
geometry: {
|
|
3566
|
-
type:
|
|
3599
|
+
type: v.LINE_STRING,
|
|
3567
3600
|
coordinates: []
|
|
3568
3601
|
}
|
|
3569
3602
|
}), o = 0, this.addFeature(r);
|
|
@@ -3577,11 +3610,11 @@ oe.onSetup = function(t) {
|
|
|
3577
3610
|
};
|
|
3578
3611
|
oe.clickAnywhere = function(t, e) {
|
|
3579
3612
|
if (t.currentVertexPosition > 0 && Qe(e, t.line.coordinates[t.currentVertexPosition - 1]) || t.direction === "backwards" && Qe(e, t.line.coordinates[t.currentVertexPosition + 1]))
|
|
3580
|
-
return this.changeMode(
|
|
3613
|
+
return this.changeMode(I.SIMPLE_SELECT, { featureIds: [t.line.id] });
|
|
3581
3614
|
this.updateUIClasses({ mouse: Q.ADD }), t.line.updateCoordinate(t.currentVertexPosition, e.lngLat.lng, e.lngLat.lat), t.direction === "forward" ? (t.currentVertexPosition++, t.line.updateCoordinate(t.currentVertexPosition, e.lngLat.lng, e.lngLat.lat)) : t.line.addCoordinate(0, e.lngLat.lng, e.lngLat.lat);
|
|
3582
3615
|
};
|
|
3583
3616
|
oe.clickOnVertex = function(t) {
|
|
3584
|
-
return this.changeMode(
|
|
3617
|
+
return this.changeMode(I.SIMPLE_SELECT, { featureIds: [t.line.id] });
|
|
3585
3618
|
};
|
|
3586
3619
|
oe.onMouseMove = function(t, e) {
|
|
3587
3620
|
t.line.updateCoordinate(t.currentVertexPosition, e.lngLat.lng, e.lngLat.lat), Ie(e) && this.updateUIClasses({ mouse: Q.POINTER });
|
|
@@ -3591,15 +3624,15 @@ oe.onTap = oe.onClick = function(t, e) {
|
|
|
3591
3624
|
this.clickAnywhere(t, e);
|
|
3592
3625
|
};
|
|
3593
3626
|
oe.onKeyUp = function(t, e) {
|
|
3594
|
-
Ue(e) ? this.changeMode(
|
|
3627
|
+
Ue(e) ? this.changeMode(I.SIMPLE_SELECT, { featureIds: [t.line.id] }) : Ge(e) && (this.deleteFeature([t.line.id], { silent: !0 }), this.changeMode(I.SIMPLE_SELECT));
|
|
3595
3628
|
};
|
|
3596
3629
|
oe.onStop = function(t) {
|
|
3597
3630
|
te.enable(this), this.activateUIButton(), this.getFeature(t.line.id) !== void 0 && (t.line.removeCoordinate(`${t.currentVertexPosition}`), t.line.isValid() ? this.fire(V.CREATE, {
|
|
3598
3631
|
features: [t.line.toGeoJSON()]
|
|
3599
|
-
}) : (this.deleteFeature([t.line.id], { silent: !0 }), this.changeMode(
|
|
3632
|
+
}) : (this.deleteFeature([t.line.id], { silent: !0 }), this.changeMode(I.SIMPLE_SELECT, {}, { silent: !0 })));
|
|
3600
3633
|
};
|
|
3601
3634
|
oe.onTrash = function(t) {
|
|
3602
|
-
this.deleteFeature([t.line.id], { silent: !0 }), this.changeMode(
|
|
3635
|
+
this.deleteFeature([t.line.id], { silent: !0 }), this.changeMode(I.SIMPLE_SELECT);
|
|
3603
3636
|
};
|
|
3604
3637
|
oe.toDisplayFeatures = function(t, e, r) {
|
|
3605
3638
|
const o = e.properties.id === t.line.id;
|
|
@@ -3618,7 +3651,7 @@ const Qr = {
|
|
|
3618
3651
|
draw_polygon: re,
|
|
3619
3652
|
draw_line_string: oe
|
|
3620
3653
|
}, Oo = {
|
|
3621
|
-
defaultMode:
|
|
3654
|
+
defaultMode: I.SIMPLE_SELECT,
|
|
3622
3655
|
keybindings: !0,
|
|
3623
3656
|
touchEnabled: !0,
|
|
3624
3657
|
clickBuffer: 2,
|
|
@@ -3726,7 +3759,7 @@ const Ko = {
|
|
|
3726
3759
|
MultiPoint: z
|
|
3727
3760
|
};
|
|
3728
3761
|
function jo(t, e) {
|
|
3729
|
-
e.modes =
|
|
3762
|
+
e.modes = I;
|
|
3730
3763
|
const r = t.options.suppressAPIEvents !== void 0 ? !!t.options.suppressAPIEvents : !0;
|
|
3731
3764
|
return e.getFeatureIdsAt = function(o) {
|
|
3732
3765
|
return ye.click({ point: o }, null, t).map((n) => n.properties.id);
|
|
@@ -3734,23 +3767,23 @@ function jo(t, e) {
|
|
|
3734
3767
|
return t.store.getSelectedIds();
|
|
3735
3768
|
}, e.getSelected = function() {
|
|
3736
3769
|
return {
|
|
3737
|
-
type:
|
|
3770
|
+
type: v.FEATURE_COLLECTION,
|
|
3738
3771
|
features: t.store.getSelectedIds().map((o) => t.store.get(o)).map((o) => o.toGeoJSON())
|
|
3739
3772
|
};
|
|
3740
3773
|
}, e.getSelectedPoints = function() {
|
|
3741
3774
|
return {
|
|
3742
|
-
type:
|
|
3775
|
+
type: v.FEATURE_COLLECTION,
|
|
3743
3776
|
features: t.store.getSelectedCoordinates().map((o) => ({
|
|
3744
|
-
type:
|
|
3777
|
+
type: v.FEATURE,
|
|
3745
3778
|
properties: {},
|
|
3746
3779
|
geometry: {
|
|
3747
|
-
type:
|
|
3780
|
+
type: v.POINT,
|
|
3748
3781
|
coordinates: o.coordinates
|
|
3749
3782
|
}
|
|
3750
3783
|
}))
|
|
3751
3784
|
};
|
|
3752
3785
|
}, e.set = function(o) {
|
|
3753
|
-
if (o.type === void 0 || o.type !==
|
|
3786
|
+
if (o.type === void 0 || o.type !== v.FEATURE_COLLECTION || !Array.isArray(o.features))
|
|
3754
3787
|
throw new Error("Invalid FeatureCollection");
|
|
3755
3788
|
const i = t.store.createRenderBatch();
|
|
3756
3789
|
let n = t.store.getAllIds().slice();
|
|
@@ -3779,15 +3812,15 @@ function jo(t, e) {
|
|
|
3779
3812
|
return i.toGeoJSON();
|
|
3780
3813
|
}, e.getAll = function() {
|
|
3781
3814
|
return {
|
|
3782
|
-
type:
|
|
3815
|
+
type: v.FEATURE_COLLECTION,
|
|
3783
3816
|
features: t.store.getAll().map((o) => o.toGeoJSON())
|
|
3784
3817
|
};
|
|
3785
3818
|
}, e.delete = function(o) {
|
|
3786
|
-
return t.store.delete(o, { silent: r }), e.getMode() ===
|
|
3819
|
+
return t.store.delete(o, { silent: r }), e.getMode() === I.DIRECT_SELECT && !t.store.getSelectedIds().length ? t.events.changeMode(I.SIMPLE_SELECT, void 0, { silent: r }) : t.store.render(), e;
|
|
3787
3820
|
}, e.deleteAll = function() {
|
|
3788
|
-
return t.store.delete(t.store.getAllIds(), { silent: r }), e.getMode() ===
|
|
3821
|
+
return t.store.delete(t.store.getAllIds(), { silent: r }), e.getMode() === I.DIRECT_SELECT ? t.events.changeMode(I.SIMPLE_SELECT, void 0, { silent: r }) : t.store.render(), e;
|
|
3789
3822
|
}, e.changeMode = function(o, i = {}) {
|
|
3790
|
-
return o ===
|
|
3823
|
+
return o === I.SIMPLE_SELECT && e.getMode() === I.SIMPLE_SELECT ? (Or(i.featureIds || [], t.store.getSelectedIds()) || (t.store.setSelected(i.featureIds, { silent: r }), t.store.render()), e) : (o === I.DIRECT_SELECT && e.getMode() === I.DIRECT_SELECT && i.featureId === t.store.getSelectedIds()[0] || t.events.changeMode(o, i, { silent: r }), e);
|
|
3791
3824
|
}, e.getMode = function() {
|
|
3792
3825
|
return t.events.getMode();
|
|
3793
3826
|
}, e.trash = function() {
|
|
@@ -3856,8 +3889,8 @@ function Jo(t, e, r, o = {}) {
|
|
|
3856
3889
|
), u = n + Math.atan2(
|
|
3857
3890
|
Math.sin(a) * Math.sin(l) * Math.cos(s),
|
|
3858
3891
|
Math.cos(l) - Math.sin(s) * Math.sin(c)
|
|
3859
|
-
),
|
|
3860
|
-
return i[2] !== void 0 ? ue([
|
|
3892
|
+
), g = Zt(u), p = Zt(c);
|
|
3893
|
+
return i[2] !== void 0 ? ue([g, p, i[2]], o.properties) : ue([g, p], o.properties);
|
|
3861
3894
|
}
|
|
3862
3895
|
function ct(t, e, r = {}) {
|
|
3863
3896
|
var o = lt(t), i = lt(e), n = he(i[1] - o[1]), s = he(i[0] - o[0]), a = he(o[1]), l = he(i[1]), c = Math.pow(Math.sin(n / 2), 2) + Math.pow(Math.sin(s / 2), 2) * Math.cos(a) * Math.cos(l);
|
|
@@ -4393,8 +4426,8 @@ class me {
|
|
|
4393
4426
|
const i = o.properties || {}, n = i.user_kind || i.kind;
|
|
4394
4427
|
let s = this.MAPPING[n];
|
|
4395
4428
|
if (n === "floor") {
|
|
4396
|
-
const L = i.user_feature_type || i.feature_type,
|
|
4397
|
-
L ? s = { feature_type: L, category:
|
|
4429
|
+
const L = i.user_feature_type || i.feature_type, k = i.user_category || i.category;
|
|
4430
|
+
L ? s = { feature_type: L, category: k || "" } : k === "venue" ? s = this.MAPPING.venue : k === "building" ? s = this.MAPPING.building : s = { feature_type: "level", category: k || "room" };
|
|
4398
4431
|
}
|
|
4399
4432
|
s || (s = { feature_type: "unknown", category: "unknown" });
|
|
4400
4433
|
const a = i.user_name || i.name, l = {
|
|
@@ -4406,18 +4439,18 @@ class me {
|
|
|
4406
4439
|
outdoor: i.user_outdoor === !0
|
|
4407
4440
|
};
|
|
4408
4441
|
i.user_restricted === !0 || i.restricted === !0 ? u.restriction = i.user_restriction || i.restriction || "restricted" : u.restriction = null;
|
|
4409
|
-
const
|
|
4410
|
-
|
|
4442
|
+
const g = i.user_display_point || i.display_point;
|
|
4443
|
+
g && (u.display_point = g);
|
|
4411
4444
|
const p = i.user_short_name || i.short_name;
|
|
4412
4445
|
p && (u.short_name = typeof p == "object" ? p : { en: p });
|
|
4413
4446
|
const h = i.user_alt_name || i.alt_name;
|
|
4414
4447
|
h && (u.alt_name = typeof h == "object" ? h : { en: h });
|
|
4415
|
-
const
|
|
4416
|
-
|
|
4448
|
+
const d = i.user_address_id || i.address_id;
|
|
4449
|
+
d && (u.address_id = d);
|
|
4417
4450
|
const m = i.user_building_ids || i.building_ids;
|
|
4418
4451
|
m && (u.building_ids = m);
|
|
4419
|
-
const
|
|
4420
|
-
|
|
4452
|
+
const w = i.user_level_id || i.level_id;
|
|
4453
|
+
w && (u.level_id = w);
|
|
4421
4454
|
const b = i.user_accessibility || i.accessibility;
|
|
4422
4455
|
b && (u.accessibility = b), (i.user_hours || i.hours) && (u.hours = i.user_hours || i.hours), (i.user_phone || i.phone) && (u.phone = i.user_phone || i.phone), (i.user_website || i.website) && (u.website = i.user_website || i.website), (i.user_x !== void 0 || i.x !== void 0) && (u.x = i.user_x !== void 0 ? i.user_x : i.x), (i.user_y !== void 0 || i.y !== void 0) && (u.y = i.user_y !== void 0 ? i.user_y : i.y);
|
|
4423
4456
|
const C = [
|
|
@@ -4442,9 +4475,9 @@ class me {
|
|
|
4442
4475
|
"hours",
|
|
4443
4476
|
"phone",
|
|
4444
4477
|
"website"
|
|
4445
|
-
],
|
|
4478
|
+
], M = C.map((L) => `user_${L}`), B = /* @__PURE__ */ new Set([...C, ...M]);
|
|
4446
4479
|
return u._internal = Object.fromEntries(
|
|
4447
|
-
Object.entries(i).filter(([L,
|
|
4480
|
+
Object.entries(i).filter(([L, k]) => ["height", "user_height"].includes(L) && (typeof k != "number" || k <= 0) ? !1 : !B.has(L))
|
|
4448
4481
|
), {
|
|
4449
4482
|
id: i.user_id || o.id,
|
|
4450
4483
|
type: "Feature",
|
|
@@ -4472,11 +4505,11 @@ class me {
|
|
|
4472
4505
|
return {
|
|
4473
4506
|
...e,
|
|
4474
4507
|
features: e.features.map((r) => {
|
|
4475
|
-
var c, u,
|
|
4508
|
+
var c, u, g, p, h, d;
|
|
4476
4509
|
const o = r.properties || {}, i = r.feature_type;
|
|
4477
4510
|
let n = "unknown";
|
|
4478
|
-
for (const [m,
|
|
4479
|
-
if (
|
|
4511
|
+
for (const [m, w] of Object.entries(this.MAPPING))
|
|
4512
|
+
if (w.feature_type === i && w.category === o.category) {
|
|
4480
4513
|
n = m;
|
|
4481
4514
|
break;
|
|
4482
4515
|
}
|
|
@@ -4504,7 +4537,7 @@ class me {
|
|
|
4504
4537
|
const a = {
|
|
4505
4538
|
...s,
|
|
4506
4539
|
user_kind: n,
|
|
4507
|
-
user_name: (typeof (((c = o.name) == null ? void 0 : c.en) || o.name) == "object" ? (
|
|
4540
|
+
user_name: (typeof (((c = o.name) == null ? void 0 : c.en) || o.name) == "object" ? (g = ((u = o.name) == null ? void 0 : u.en) || o.name) == null ? void 0 : g.en : ((p = o.name) == null ? void 0 : p.en) || o.name) || s.user_name || "",
|
|
4508
4541
|
user_id: r.id,
|
|
4509
4542
|
user_feature_type: i,
|
|
4510
4543
|
user_category: o.category || (i === "venue" ? "venue" : i === "building" ? "building" : o.category),
|
|
@@ -4512,7 +4545,7 @@ class me {
|
|
|
4512
4545
|
user_outdoor: o.outdoor,
|
|
4513
4546
|
user_restricted: !!(o.restriction && o.restriction !== null)
|
|
4514
4547
|
};
|
|
4515
|
-
o.restriction && (a.user_restriction = o.restriction), o.display_point && (a.user_display_point = o.display_point), o.short_name && (a.user_short_name = typeof o.short_name == "object" ? (h = o.short_name) == null ? void 0 : h.en : o.short_name), o.alt_name && (a.user_alt_name = typeof o.alt_name == "object" ? (
|
|
4548
|
+
o.restriction && (a.user_restriction = o.restriction), o.display_point && (a.user_display_point = o.display_point), o.short_name && (a.user_short_name = typeof o.short_name == "object" ? (h = o.short_name) == null ? void 0 : h.en : o.short_name), o.alt_name && (a.user_alt_name = typeof o.alt_name == "object" ? (d = o.alt_name) == null ? void 0 : d.en : o.alt_name), o.address_id && (a.user_address_id = o.address_id), o.building_ids && (a.user_building_ids = o.building_ids), o.level_id && (a.user_level_id = o.level_id), o.accessibility && (a.user_accessibility = o.accessibility), o.hours && (a.user_hours = o.hours), o.phone && (a.user_phone = o.phone), o.website && (a.user_website = o.website), o.x !== void 0 && (a.user_x = o.x), o.y !== void 0 && (a.user_y = o.y);
|
|
4516
4549
|
const l = s.height || s.user_height || 0;
|
|
4517
4550
|
return l > 0 && (a.user_height = l), {
|
|
4518
4551
|
id: r.id,
|
|
@@ -4821,10 +4854,10 @@ class Oe {
|
|
|
4821
4854
|
const c = a.properties.user_ordinal || a.properties.ordinal;
|
|
4822
4855
|
if (c !== void 0 && a.geometry.type === "Point") {
|
|
4823
4856
|
const u = this.draw.getAll().features.find(
|
|
4824
|
-
(
|
|
4857
|
+
(g) => (g.properties.user_kind || g.properties.kind) === "floor" && (g.properties.user_ordinal === c || g.properties.ordinal === c)
|
|
4825
4858
|
);
|
|
4826
4859
|
if (u) {
|
|
4827
|
-
const
|
|
4860
|
+
const g = pe(u), { x: p, y: h } = le(a.geometry.coordinates[0], a.geometry.coordinates[1], g.geometry.coordinates);
|
|
4828
4861
|
this.draw.setFeatureProperty(a.id, "user_x", p), this.draw.setFeatureProperty(a.id, "user_y", h);
|
|
4829
4862
|
}
|
|
4830
4863
|
}
|
|
@@ -4842,12 +4875,12 @@ class Oe {
|
|
|
4842
4875
|
this._updateDebounceTimers.delete(n.id);
|
|
4843
4876
|
const a = this.draw.get(n.id) || n, l = a.properties.user_ordinal || a.properties.ordinal;
|
|
4844
4877
|
if (l !== void 0 && a.geometry.type === "Point") {
|
|
4845
|
-
const
|
|
4878
|
+
const g = this.draw.getAll().features.find(
|
|
4846
4879
|
(p) => (p.properties.user_kind || p.properties.kind) === "floor" && (p.properties.user_ordinal === l || p.properties.ordinal === l)
|
|
4847
4880
|
);
|
|
4848
|
-
if (
|
|
4849
|
-
const p = pe(
|
|
4850
|
-
(a.properties.user_x !== h || a.properties.user_y !==
|
|
4881
|
+
if (g) {
|
|
4882
|
+
const p = pe(g), { x: h, y: d } = le(a.geometry.coordinates[0], a.geometry.coordinates[1], p.geometry.coordinates);
|
|
4883
|
+
(a.properties.user_x !== h || a.properties.user_y !== d) && (this.draw.setFeatureProperty(a.id, "user_x", h), this.draw.setFeatureProperty(a.id, "user_y", d), Object.assign(a.properties, { user_x: h, user_y: d }));
|
|
4851
4884
|
}
|
|
4852
4885
|
}
|
|
4853
4886
|
const c = r(a), u = this._geomHashes.get(a.id);
|
|
@@ -4873,8 +4906,8 @@ class Oe {
|
|
|
4873
4906
|
(l) => (l.properties.user_kind || l.properties.kind) === "floor" && (l.properties.user_ordinal === s || l.properties.ordinal === s)
|
|
4874
4907
|
);
|
|
4875
4908
|
if (a) {
|
|
4876
|
-
const l = pe(a), { x: c, y: u } = le(n.geometry.coordinates[0], n.geometry.coordinates[1], l.geometry.coordinates),
|
|
4877
|
-
|
|
4909
|
+
const l = pe(a), { x: c, y: u } = le(n.geometry.coordinates[0], n.geometry.coordinates[1], l.geometry.coordinates), g = JSON.parse(JSON.stringify(n));
|
|
4910
|
+
g.properties.user_x = c, g.properties.user_y = u, this.eventBus.emit("geometryLiveUpdate", { type: "update", features: [g] });
|
|
4878
4911
|
return;
|
|
4879
4912
|
}
|
|
4880
4913
|
}
|
|
@@ -5024,7 +5057,7 @@ class Oe {
|
|
|
5024
5057
|
throw new f("Cannot create: Draw not initialized.", y.MAP_NOT_INITIALIZED, "geometry");
|
|
5025
5058
|
const o = { ...r.properties || {} }, i = ["beacon", "poi", "walkway", "floor", "obstacle"], n = ["beacon", "poi", "point"], s = ["line", "walkway"], a = ["polygon", "floor", "obstacle", "rectangle"];
|
|
5026
5059
|
if (i.includes(e) && (o.kind = e), i.includes(e) && e !== "floor") {
|
|
5027
|
-
const
|
|
5060
|
+
const g = this.context.registry.get("indoor"), p = g ? g.getCurrentFloor() : void 0;
|
|
5028
5061
|
p !== void 0 && o.ordinal === void 0 && (o.ordinal = p, o.floorOrdinal = p);
|
|
5029
5062
|
}
|
|
5030
5063
|
let l = null;
|
|
@@ -5035,8 +5068,8 @@ class Oe {
|
|
|
5035
5068
|
if (!r.coordinates) throw new f(`create('${e}') requires options.coordinates`, y.INVALID_PARAMETERS, "geometry");
|
|
5036
5069
|
l = { type: "Feature", geometry: { type: "LineString", coordinates: r.coordinates }, properties: o };
|
|
5037
5070
|
} else if (e === "rectangle" && r.bounds) {
|
|
5038
|
-
const [[
|
|
5039
|
-
l = { type: "Feature", geometry: { type: "Polygon", coordinates: [[[
|
|
5071
|
+
const [[g, p], [h, d]] = r.bounds;
|
|
5072
|
+
l = { type: "Feature", geometry: { type: "Polygon", coordinates: [[[g, p], [h, p], [h, d], [g, d], [g, p]]] }, properties: o };
|
|
5040
5073
|
} else if (e === "circle" && r.center && r.radiusKm)
|
|
5041
5074
|
l = { type: "Feature", geometry: cr(ue(r.center), r.radiusKm, { steps: 64, units: "kilometers" }).geometry, properties: { ...o, isCircle: !0, center: r.center, radiusKm: r.radiusKm } };
|
|
5042
5075
|
else if (a.includes(e)) {
|
|
@@ -5047,8 +5080,8 @@ class Oe {
|
|
|
5047
5080
|
const c = this.draw.add(l), u = Array.isArray(c) ? c[0] : c;
|
|
5048
5081
|
if (u) {
|
|
5049
5082
|
this._createKind = i.includes(e) ? e : null, this._applyKindToNewFeature(this.draw.get(u)), ["beacon", "poi"].includes(e) && this._createBeaconPoiMarker(this.draw.get(u));
|
|
5050
|
-
const
|
|
5051
|
-
this.syncUser3DBuildings(), this._updateLiveMeasurements(), this.eventBus.emit("geometryChanged", { operation: "create", source: "programmatic", feature:
|
|
5083
|
+
const g = this.draw.get(u);
|
|
5084
|
+
this.syncUser3DBuildings(), this._updateLiveMeasurements(), this.eventBus.emit("geometryChanged", { operation: "create", source: "programmatic", feature: g });
|
|
5052
5085
|
}
|
|
5053
5086
|
return u || null;
|
|
5054
5087
|
}
|
|
@@ -5281,10 +5314,10 @@ class Oe {
|
|
|
5281
5314
|
n && n.classList.add("anim-pulse");
|
|
5282
5315
|
}
|
|
5283
5316
|
beginRotate() {
|
|
5284
|
-
var u,
|
|
5317
|
+
var u, g;
|
|
5285
5318
|
const e = (u = this.draw) == null ? void 0 : u.getSelected();
|
|
5286
5319
|
if (!e || e.features.length !== 1) return;
|
|
5287
|
-
const r = e.features[0], o = (
|
|
5320
|
+
const r = e.features[0], o = (g = r.geometry) == null ? void 0 : g.type;
|
|
5288
5321
|
if (!["Polygon", "LineString", "Point"].includes(o)) return;
|
|
5289
5322
|
this._cancelAdvancedInteractions();
|
|
5290
5323
|
let i;
|
|
@@ -5319,14 +5352,14 @@ class Oe {
|
|
|
5319
5352
|
const r = this._cloneState.feature;
|
|
5320
5353
|
this.mapManager.getMap();
|
|
5321
5354
|
try {
|
|
5322
|
-
const o = pe(r), [i, n] = o.geometry.coordinates, { lng: s, lat: a } = e.lngLat, l = s - i, c = a - n, u = JSON.parse(JSON.stringify(r.geometry)),
|
|
5323
|
-
u.type === "Polygon" ? u.coordinates = u.coordinates.map((m) => m.map(
|
|
5355
|
+
const o = pe(r), [i, n] = o.geometry.coordinates, { lng: s, lat: a } = e.lngLat, l = s - i, c = a - n, u = JSON.parse(JSON.stringify(r.geometry)), g = (m) => [m[0] + l, m[1] + c];
|
|
5356
|
+
u.type === "Polygon" ? u.coordinates = u.coordinates.map((m) => m.map(g)) : u.type === "LineString" ? u.coordinates = u.coordinates.map(g) : u.type === "Point" && (u.coordinates = g(u.coordinates));
|
|
5324
5357
|
const p = {
|
|
5325
5358
|
type: "Feature",
|
|
5326
5359
|
geometry: u,
|
|
5327
5360
|
properties: { ...r.properties || {} }
|
|
5328
|
-
}, h = this.draw.add(p),
|
|
5329
|
-
|
|
5361
|
+
}, h = this.draw.add(p), d = Array.isArray(h) ? h[0] : h;
|
|
5362
|
+
d && this.draw.changeMode("simple_select", { featureIds: [d] }), this.syncUser3DBuildings(), this.eventBus.emit("geometryChanged", { type: "create", features: [this.draw.get(d)] });
|
|
5330
5363
|
} catch (o) {
|
|
5331
5364
|
console.error(o);
|
|
5332
5365
|
}
|
|
@@ -5356,13 +5389,13 @@ class Oe {
|
|
|
5356
5389
|
let n = this._rotateState.startCursorAngle - i;
|
|
5357
5390
|
e.ctrlKey && (n = Math.round(n * 180 / Math.PI / 5) * 5 * Math.PI / 180);
|
|
5358
5391
|
const [s, a] = this._rotateState.centerLngLat, l = Math.cos(a * Math.PI / 180) || 1, c = (p) => {
|
|
5359
|
-
const [h,
|
|
5392
|
+
const [h, d] = p, m = (h - s) * l, w = d - a, b = m * Math.cos(n) - w * Math.sin(n), C = m * Math.sin(n) + w * Math.cos(n);
|
|
5360
5393
|
return [s + b / l, a + C];
|
|
5361
5394
|
}, u = this._rotateState.baseGeom;
|
|
5362
|
-
let
|
|
5363
|
-
if (u.type === "Polygon" ?
|
|
5395
|
+
let g = null;
|
|
5396
|
+
if (u.type === "Polygon" ? g = { type: "Polygon", coordinates: u.coordinates.map((p) => p.map(c)) } : u.type === "LineString" ? g = { type: "LineString", coordinates: u.coordinates.map(c) } : u.type === "Point" && (g = { type: "Point", coordinates: c(u.coordinates) }), g) {
|
|
5364
5397
|
this.draw.delete(this._rotateState.featureId);
|
|
5365
|
-
const p = this.draw.add({ type: "Feature", geometry:
|
|
5398
|
+
const p = this.draw.add({ type: "Feature", geometry: g, properties: this._rotateState.baseProperties }), h = Array.isArray(p) ? p[0] : p;
|
|
5366
5399
|
this._rotateState.featureId = h, this.draw.changeMode("simple_select", { featureIds: [h] }), this.syncUser3DBuildings();
|
|
5367
5400
|
}
|
|
5368
5401
|
}
|
|
@@ -5449,38 +5482,38 @@ class Oe {
|
|
|
5449
5482
|
if (!o) return;
|
|
5450
5483
|
const i = this.draw.getAll(), n = this.draw.getSelectedIds(), s = this.draw.getMode(), a = i.features.filter((c) => n.includes(c.id)), l = [];
|
|
5451
5484
|
a.forEach((c) => {
|
|
5452
|
-
var
|
|
5485
|
+
var d;
|
|
5453
5486
|
if (!c.geometry) return;
|
|
5454
5487
|
const u = c.geometry.type;
|
|
5455
|
-
let
|
|
5456
|
-
const h = n.includes(c.id) && !((
|
|
5488
|
+
let g = [];
|
|
5489
|
+
const h = n.includes(c.id) && !((d = c.properties) != null && d.kind) && ["draw_line_string", "draw_polygon"].includes(s);
|
|
5457
5490
|
if (u === "LineString") {
|
|
5458
5491
|
let m = [...c.geometry.coordinates];
|
|
5459
5492
|
if (h && e && m.length > 0) {
|
|
5460
|
-
const
|
|
5461
|
-
(
|
|
5493
|
+
const w = m[m.length - 1];
|
|
5494
|
+
(w[0] !== e.lng || w[1] !== e.lat) && m.push([e.lng, e.lat]);
|
|
5462
5495
|
}
|
|
5463
|
-
|
|
5496
|
+
g = [m];
|
|
5464
5497
|
} else if (u === "Polygon") {
|
|
5465
|
-
let m = c.geometry.coordinates.map((
|
|
5466
|
-
h && e && m.length > 0 && m[0].length > 0 && m[0].splice(m[0].length - 1, 0, [e.lng, e.lat]),
|
|
5498
|
+
let m = c.geometry.coordinates.map((w) => [...w]);
|
|
5499
|
+
h && e && m.length > 0 && m[0].length > 0 && m[0].splice(m[0].length - 1, 0, [e.lng, e.lat]), g = m;
|
|
5467
5500
|
}
|
|
5468
|
-
|
|
5501
|
+
g.forEach((m) => {
|
|
5469
5502
|
if (!(!m || !Array.isArray(m)))
|
|
5470
|
-
for (let
|
|
5471
|
-
const b = m[
|
|
5503
|
+
for (let w = 0; w < m.length - 1; w++) {
|
|
5504
|
+
const b = m[w], C = m[w + 1];
|
|
5472
5505
|
if (!b || !C) continue;
|
|
5473
|
-
let
|
|
5506
|
+
let M = 0;
|
|
5474
5507
|
try {
|
|
5475
|
-
|
|
5508
|
+
M = ct(ue(b), ue(C), { units: "meters" });
|
|
5476
5509
|
} catch {
|
|
5477
5510
|
continue;
|
|
5478
5511
|
}
|
|
5479
|
-
|
|
5512
|
+
M < 0.1 || l.push({
|
|
5480
5513
|
type: "Feature",
|
|
5481
5514
|
geometry: { type: "LineString", coordinates: [b, C] },
|
|
5482
5515
|
properties: {
|
|
5483
|
-
label: `${
|
|
5516
|
+
label: `${M.toFixed(1)}m`
|
|
5484
5517
|
}
|
|
5485
5518
|
});
|
|
5486
5519
|
}
|
|
@@ -5534,12 +5567,12 @@ class Oe {
|
|
|
5534
5567
|
c.className = `pm-indoor-marker pm-indoor-marker-${i}`, c.setAttribute("data-feature-id", e.id), c.style.pointerEvents = "none", c.style.zIndex = "5";
|
|
5535
5568
|
const u = document.createElement("div");
|
|
5536
5569
|
u.className = "pm-indoor-marker-bg", u.style.backgroundColor = n, u.style.pointerEvents = "none";
|
|
5537
|
-
const
|
|
5538
|
-
|
|
5570
|
+
const g = document.createElement("i");
|
|
5571
|
+
g.className = l, u.appendChild(g), c.appendChild(u);
|
|
5539
5572
|
const p = document.createElement("div");
|
|
5540
5573
|
p.className = "pm-indoor-marker-label", p.style.color = n, p.textContent = a || "", p.style.pointerEvents = "none", p.style.display = a ? "block" : "none", c.appendChild(p);
|
|
5541
|
-
const h = e.geometry.coordinates,
|
|
5542
|
-
this._beaconPoiMarkers.set(e.id,
|
|
5574
|
+
const h = e.geometry.coordinates, d = new ce.Marker({ element: c, anchor: "center" }).setLngLat(h).addTo(r);
|
|
5575
|
+
this._beaconPoiMarkers.set(e.id, d);
|
|
5543
5576
|
}
|
|
5544
5577
|
/**
|
|
5545
5578
|
* Update a DOM marker's visual appearance (color, icon, label).
|
|
@@ -5558,11 +5591,11 @@ class Oe {
|
|
|
5558
5591
|
}
|
|
5559
5592
|
const s = o.user_color || o.color || (i === "beacon" ? "#fbbf24" : "#c084fc"), a = o.user_icon || o.icon || (i === "beacon" ? "broadcast-tower" : "map-marker"), l = o.user_name || o.name || "", c = Oe.ICON_CLASS_MAP[a] || "fas fa-map-marker-alt", u = n.getElement();
|
|
5560
5593
|
if (!u) return;
|
|
5561
|
-
const
|
|
5562
|
-
if (
|
|
5563
|
-
|
|
5564
|
-
const
|
|
5565
|
-
|
|
5594
|
+
const g = u.querySelector(".pm-indoor-marker-bg");
|
|
5595
|
+
if (g) {
|
|
5596
|
+
g.style.backgroundColor = s;
|
|
5597
|
+
const d = g.querySelector("i");
|
|
5598
|
+
d && (d.className = c);
|
|
5566
5599
|
}
|
|
5567
5600
|
let p = u.querySelector(".pm-indoor-marker-label");
|
|
5568
5601
|
p || (p = document.createElement("div"), p.className = "pm-indoor-marker-label", u.appendChild(p)), p.textContent = l || "", p.style.color = s, p.style.display = l ? "block" : "none";
|
|
@@ -5629,8 +5662,8 @@ class Oe {
|
|
|
5629
5662
|
for (const [o, i] of this._beaconPoiMarkers.entries()) {
|
|
5630
5663
|
const n = this.draw.get(o);
|
|
5631
5664
|
if (n) {
|
|
5632
|
-
const s = n.properties || {}, a = s.user_kind || s.kind, c = (s.user_floorOrdinal !== void 0 ? s.user_floorOrdinal : s.floorOrdinal !== void 0 ? s.floorOrdinal : s.user_ordinal !== void 0 ? s.user_ordinal : s.ordinal !== void 0 ? s.ordinal : 0) === e, u = r[a] !== !1,
|
|
5633
|
-
|
|
5665
|
+
const s = n.properties || {}, a = s.user_kind || s.kind, c = (s.user_floorOrdinal !== void 0 ? s.user_floorOrdinal : s.floorOrdinal !== void 0 ? s.floorOrdinal : s.user_ordinal !== void 0 ? s.user_ordinal : s.ordinal !== void 0 ? s.ordinal : 0) === e, u = r[a] !== !1, g = i.getElement();
|
|
5666
|
+
g && (g.style.display = c && u ? "block" : "none");
|
|
5634
5667
|
}
|
|
5635
5668
|
}
|
|
5636
5669
|
}
|
|
@@ -5875,9 +5908,9 @@ class li {
|
|
|
5875
5908
|
let l = r.user_feature_type || r.feature_type;
|
|
5876
5909
|
const c = r.user_category || r.category || "";
|
|
5877
5910
|
!l && o === "floor" && (c === "venue" ? l = "venue" : c === "building" ? l = "building" : l = "level");
|
|
5878
|
-
const u = r.user_ordinal || r.ordinal || 0,
|
|
5911
|
+
const u = r.user_ordinal || r.ordinal || 0, g = r.user_outdoor === !0 || r.outdoor === !0, p = r.user_restricted === !0 || r.restricted === !0, h = ["user_kind", "user_color", "user_icon", "user_name", "user_id", "user_category", "user_ordinal", "user_outdoor", "user_restricted", "user_x", "user_y", "user_feature_type", "user_height", "kind", "color", "icon", "name", "id", "category", "ordinal", "outdoor", "restricted", "x", "y", "feature_type", "height"], d = {};
|
|
5879
5912
|
Object.keys(r).forEach((A) => {
|
|
5880
|
-
!h.includes(A) && A.startsWith("user_") && (
|
|
5913
|
+
!h.includes(A) && A.startsWith("user_") && (d[A.replace("user_", "")] = r[A]);
|
|
5881
5914
|
});
|
|
5882
5915
|
const m = ["beacon", "poi"].includes(o);
|
|
5883
5916
|
this.container.innerHTML = `
|
|
@@ -5977,7 +6010,7 @@ class li {
|
|
|
5977
6010
|
<div class="pm-toggle-wrap">
|
|
5978
6011
|
<span class="pm-toggle-label">OUTDOOR FEATURE</span>
|
|
5979
6012
|
<label class="pm-switch">
|
|
5980
|
-
<input type="checkbox" id="pm-prop-input-outdoor" ${
|
|
6013
|
+
<input type="checkbox" id="pm-prop-input-outdoor" ${g ? "checked" : ""}>
|
|
5981
6014
|
<span class="pm-slider"></span>
|
|
5982
6015
|
</label>
|
|
5983
6016
|
</div>
|
|
@@ -6027,7 +6060,7 @@ class li {
|
|
|
6027
6060
|
<!-- Custom Properties Section -->
|
|
6028
6061
|
<div class="pm-prop-section-title">Custom Properties</div>
|
|
6029
6062
|
<div class="pm-custom-props-list" id="pm-custom-props-list">
|
|
6030
|
-
${Object.entries(
|
|
6063
|
+
${Object.entries(d).map(([A, S]) => `
|
|
6031
6064
|
<div class="pm-custom-prop-row" data-key="${A}">
|
|
6032
6065
|
<input type="text" class="pm-prop-custom-key" value="${A}" placeholder="Key" />
|
|
6033
6066
|
<input type="text" class="pm-prop-custom-val" value="${S}" placeholder="Value" />
|
|
@@ -6041,8 +6074,8 @@ class li {
|
|
|
6041
6074
|
</div>
|
|
6042
6075
|
</div>
|
|
6043
6076
|
`;
|
|
6044
|
-
const
|
|
6045
|
-
|
|
6077
|
+
const w = this.container.querySelector("#pm-prop-close-btn");
|
|
6078
|
+
w && (w.onclick = (A) => {
|
|
6046
6079
|
A.preventDefault(), A.stopPropagation(), this.hide();
|
|
6047
6080
|
});
|
|
6048
6081
|
const b = this.container.querySelector(".pm-prop-overlay");
|
|
@@ -6051,19 +6084,19 @@ class li {
|
|
|
6051
6084
|
});
|
|
6052
6085
|
const C = this.container.querySelector("#pm-prop-input-id");
|
|
6053
6086
|
C && C.addEventListener("input", (A) => this._updateProperty("id", A.target.value));
|
|
6054
|
-
const
|
|
6055
|
-
|
|
6056
|
-
const
|
|
6057
|
-
|
|
6087
|
+
const M = this.container.querySelector("#pm-prop-input-name");
|
|
6088
|
+
M && M.addEventListener("input", (A) => this._updateProperty("name", A.target.value));
|
|
6089
|
+
const B = this.container.querySelector("#pm-prop-select-feature-type"), x = this.container.querySelector("#pm-prop-input-feature-type");
|
|
6090
|
+
B && B.addEventListener("change", (A) => {
|
|
6058
6091
|
const S = A.target.value;
|
|
6059
|
-
S === "_custom" ?
|
|
6060
|
-
}),
|
|
6061
|
-
|
|
6092
|
+
S === "_custom" ? x && (x.style.display = "block", x.focus(), this._updateProperty("feature_type", x.value)) : (x && (x.style.display = "none"), this._updateProperty("feature_type", S));
|
|
6093
|
+
}), x && x.addEventListener("input", (A) => {
|
|
6094
|
+
B && B.value === "_custom" && this._updateProperty("feature_type", A.target.value);
|
|
6062
6095
|
});
|
|
6063
6096
|
const L = this.container.querySelector("#pm-prop-input-category");
|
|
6064
6097
|
L && (L.addEventListener("change", (A) => this._updateProperty("category", A.target.value)), L.tagName === "INPUT" && L.addEventListener("input", (A) => this._updateProperty("category", A.target.value)));
|
|
6065
|
-
const
|
|
6066
|
-
if (
|
|
6098
|
+
const k = this.container.querySelector("#pm-prop-input-ordinal");
|
|
6099
|
+
if (k) {
|
|
6067
6100
|
const A = (S) => {
|
|
6068
6101
|
let N = parseInt(S.target.value, 10);
|
|
6069
6102
|
isNaN(N) && (N = 0), this._updateProperty("ordinal", N);
|
|
@@ -6085,7 +6118,7 @@ class li {
|
|
|
6085
6118
|
}
|
|
6086
6119
|
}
|
|
6087
6120
|
};
|
|
6088
|
-
|
|
6121
|
+
k.addEventListener("input", A), k.tagName === "SELECT" && k.addEventListener("change", A);
|
|
6089
6122
|
}
|
|
6090
6123
|
const O = this.container.querySelector("#pm-prop-input-outdoor");
|
|
6091
6124
|
O && O.addEventListener("change", (A) => this._updateProperty("outdoor", A.target.checked));
|
|
@@ -6238,7 +6271,7 @@ class ci {
|
|
|
6238
6271
|
</div>
|
|
6239
6272
|
</div>
|
|
6240
6273
|
`, this.container.appendChild(this.toolbar), this.container.appendChild(this.measurePanel), this.toolbar.addEventListener("click", (n) => {
|
|
6241
|
-
var c, u,
|
|
6274
|
+
var c, u, g, p, h;
|
|
6242
6275
|
const s = n.target.closest("button");
|
|
6243
6276
|
if (!s) return;
|
|
6244
6277
|
const a = s.getAttribute("data-tool"), l = [
|
|
@@ -6252,8 +6285,8 @@ class ci {
|
|
|
6252
6285
|
"draw_floor",
|
|
6253
6286
|
"draw_obstacle"
|
|
6254
6287
|
];
|
|
6255
|
-
if (l.includes(a) && (this.measurePanel.style.display = "none", this.toolbar.querySelectorAll(".pm-draw-btn").forEach((
|
|
6256
|
-
l.includes(
|
|
6288
|
+
if (l.includes(a) && (this.measurePanel.style.display = "none", this.toolbar.querySelectorAll(".pm-draw-btn").forEach((d) => {
|
|
6289
|
+
l.includes(d.getAttribute("data-tool")) && d.classList.remove("active");
|
|
6257
6290
|
}), s.classList.add("active")), a === "simple_select")
|
|
6258
6291
|
this._currentMode = "simple_select", this.geometryManager.drawMode("simple_select");
|
|
6259
6292
|
else if (a === "draw_line_string")
|
|
@@ -6263,15 +6296,15 @@ class ci {
|
|
|
6263
6296
|
else if (a === "draw_rectangle")
|
|
6264
6297
|
this._currentMode = "draw_rectangle", this.geometryManager.drawMode("rectangle");
|
|
6265
6298
|
else if (a === "draw_beacon" || a === "draw_poi") {
|
|
6266
|
-
const
|
|
6299
|
+
const d = a === "draw_beacon" ? "beacon" : "poi", m = this.geometryManager.draw.getSelected();
|
|
6267
6300
|
if (m && m.features.length === 1) {
|
|
6268
|
-
const
|
|
6269
|
-
if ((((c =
|
|
6270
|
-
this.propertyEditor.show(
|
|
6301
|
+
const w = m.features[0];
|
|
6302
|
+
if ((((c = w.properties) == null ? void 0 : c.user_kind) || ((u = w.properties) == null ? void 0 : u.kind)) === d) {
|
|
6303
|
+
this.propertyEditor.show(w);
|
|
6271
6304
|
return;
|
|
6272
6305
|
}
|
|
6273
6306
|
}
|
|
6274
|
-
this._currentMode = a, this.geometryManager.drawMode(
|
|
6307
|
+
this._currentMode = a, this.geometryManager.drawMode(d);
|
|
6275
6308
|
} else if (a === "draw_walkway")
|
|
6276
6309
|
this._currentMode = "draw_walkway", this.geometryManager.drawMode("walkway");
|
|
6277
6310
|
else if (a === "draw_floor")
|
|
@@ -6279,8 +6312,8 @@ class ci {
|
|
|
6279
6312
|
else if (a === "draw_obstacle")
|
|
6280
6313
|
this._currentMode = "draw_obstacle", this.geometryManager.drawMode("obstacle");
|
|
6281
6314
|
else if (a === "delete") {
|
|
6282
|
-
const
|
|
6283
|
-
|
|
6315
|
+
const d = ((g = this.geometryManager.getDrawInstance()) == null ? void 0 : g.getSelectedIds()) || [];
|
|
6316
|
+
d.length > 0 && this.geometryManager.remove(d), this.measurePanel.style.display = "none";
|
|
6284
6317
|
} else if (a === "extrude")
|
|
6285
6318
|
this._currentMode = "extrude", this.geometryManager.beginExtrude && this.geometryManager.beginExtrude();
|
|
6286
6319
|
else if (a === "rotate")
|
|
@@ -6294,8 +6327,8 @@ class ci {
|
|
|
6294
6327
|
else if (a === "save")
|
|
6295
6328
|
this._triggerSave();
|
|
6296
6329
|
else if (a === "settings" && this.selectedFeature) {
|
|
6297
|
-
const
|
|
6298
|
-
["beacon", "poi"].includes(
|
|
6330
|
+
const d = ((p = this.selectedFeature.properties) == null ? void 0 : p.user_kind) || ((h = this.selectedFeature.properties) == null ? void 0 : h.kind);
|
|
6331
|
+
["beacon", "poi"].includes(d) && this.propertyEditor.show(this.selectedFeature);
|
|
6299
6332
|
}
|
|
6300
6333
|
});
|
|
6301
6334
|
const r = this.measurePanel.querySelector("#pm-height-down"), o = this.measurePanel.querySelector("#pm-height-up"), i = this.measurePanel.querySelector("#pm-measure-height-val");
|
|
@@ -6340,10 +6373,10 @@ class ci {
|
|
|
6340
6373
|
var i, n, s, a;
|
|
6341
6374
|
const o = r.getAttribute("data-tool");
|
|
6342
6375
|
if (r.classList.remove("active"), o === "simple_select" && e === "simple_select" && r.classList.add("active"), o === "draw_line_string" && e === "draw_line_string" && this._currentMode === "draw_line_string" && r.classList.add("active"), o === "draw_polygon" && e === "draw_polygon" && this._currentMode === "draw_polygon" && r.classList.add("active"), e === "draw_point" && (o === "draw_beacon" && this._currentMode === "draw_beacon" && r.classList.add("active"), o === "draw_poi" && this._currentMode === "draw_poi" && r.classList.add("active")), e === "draw_line_string" && o === "draw_walkway" && this._currentMode === "draw_walkway" && r.classList.add("active"), e === "draw_polygon" && (o === "draw_floor" && this._currentMode === "draw_floor" && r.classList.add("active"), o === "draw_obstacle" && this._currentMode === "draw_obstacle" && r.classList.add("active")), o === "settings") {
|
|
6343
|
-
const l = ((n = (i = this.selectedFeature) == null ? void 0 : i.properties) == null ? void 0 : n.user_kind) || ((a = (s = this.selectedFeature) == null ? void 0 : s.properties) == null ? void 0 : a.kind), c = this.geometryManager.getDrawInstance().getMode(),
|
|
6344
|
-
r.style.display =
|
|
6376
|
+
const l = ((n = (i = this.selectedFeature) == null ? void 0 : i.properties) == null ? void 0 : n.user_kind) || ((a = (s = this.selectedFeature) == null ? void 0 : s.properties) == null ? void 0 : a.kind), c = this.geometryManager.getDrawInstance().getMode(), g = ["simple_select", "direct_select"].includes(c) && ["beacon", "poi", "floor", "walkway", "obstacle"].includes(l);
|
|
6377
|
+
r.style.display = g ? "flex" : "none";
|
|
6345
6378
|
const p = r.previousElementSibling;
|
|
6346
|
-
p && p.classList.contains("pm-draw-divider") && p.getAttribute("data-for") === "settings" && (p.style.display =
|
|
6379
|
+
p && p.classList.contains("pm-draw-divider") && p.getAttribute("data-for") === "settings" && (p.style.display = g ? "block" : "none");
|
|
6347
6380
|
}
|
|
6348
6381
|
if (o === "export") {
|
|
6349
6382
|
const l = this.geometryManager.draw.getAll().features.length > 0;
|
|
@@ -6354,7 +6387,7 @@ class ci {
|
|
|
6354
6387
|
});
|
|
6355
6388
|
}
|
|
6356
6389
|
_updateMeasurements() {
|
|
6357
|
-
var b, C,
|
|
6390
|
+
var b, C, M, B, x, L;
|
|
6358
6391
|
if (!this.selectedFeature) {
|
|
6359
6392
|
this.measurePanel.style.display = "none";
|
|
6360
6393
|
return;
|
|
@@ -6368,33 +6401,33 @@ class ci {
|
|
|
6368
6401
|
this.measurePanel.querySelector(".pm-measure-header-title-wrap");
|
|
6369
6402
|
const l = this.measurePanel.querySelector(".pm-measure-settings-btn");
|
|
6370
6403
|
l && l.remove();
|
|
6371
|
-
const c = this.measurePanel.querySelector("#pm-measure-row-height"), u = this.measurePanel.querySelector("#pm-measure-height-val"),
|
|
6404
|
+
const c = this.measurePanel.querySelector("#pm-measure-row-height"), u = this.measurePanel.querySelector("#pm-measure-height-val"), g = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor"><path d="M209.1 516.2c-18.7 18.7-49.1 18.7-67.9 0L28.1 403.1c-18.7-18.7-18.7-49.1 0-67.9l17-17 73.5 73.5c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-73.5-73.5 33.9-33.9 50.9 50.9c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-50.9-50.9 33.9-33.9 73.5 73.5c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-73.5-73.5 33.9-33.9 50.9 50.9c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-50.9-50.9 33.9-33.9 73.5 73.5c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-73.5-73.5 17-17c18.7-18.7 49.1-18.7 67.9 0L548.5 108.9c18.7 18.7 18.7 49.1 0 67.9L209.1 516.2z"/></svg>', p = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M64 0c23.7 0 44.4 12.9 55.4 32l273.1 0c11.1-19.1 31.7-32 55.4-32 35.3 0 64 28.7 64 64 0 34-26.5 61.8-60 63.9l-2.1 2.9-71.5 99.1c3.6 8 5.6 16.9 5.6 26.2s-2 18.2-5.6 26.2l2.2 3.1 69.3 96 2.1 2.9c33.5 2.1 60 29.9 60 63.9 0 35.3-28.7 64-64 64-23.7 0-44.4-12.9-55.4-32l-273.1 0c-11.1 19.1-31.7 32-55.4 32-35.3 0-64-28.7-64-64 0-23.7 12.9-44.4 32-55.4l0-273.1C12.9 108.4 0 87.7 0 64 0 28.7 28.7 0 64 0zM394.2 413.4l-65.5-90.6-2.2-3.1c-2.1 .2-4.3 .3-6.5 .3-35.3 0-64-28.7-64-64s28.7-64 64-64c2.2 0 4.4 .1 6.5 .3l67.7-93.7c-.6-.9-1.1-1.7-1.6-2.6L119.4 96c-5.6 9.7-13.7 17.8-23.4 23.4l0 273.1c9.7 5.6 17.8 13.7 23.4 23.4l273.1 0c.5-.9 1.1-1.8 1.6-2.6z"/></svg>', h = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><path d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"/></svg>';
|
|
6372
6405
|
c.style.display = "none";
|
|
6373
|
-
const
|
|
6406
|
+
const d = ((b = r.properties) == null ? void 0 : b.user_kind) || ((C = r.properties) == null ? void 0 : C.kind), m = this.mode === "indoor";
|
|
6374
6407
|
if (r.geometry.type === "LineString") {
|
|
6375
|
-
a.innerHTML =
|
|
6376
|
-
const
|
|
6377
|
-
o.innerHTML = `${O.toFixed(m ? 2 : 1)} <span style="font-size: 11px;">ม.</span>`,
|
|
6408
|
+
a.innerHTML = g;
|
|
6409
|
+
const k = $o(r, { units: "kilometers" }), O = k * 1e3;
|
|
6410
|
+
o.innerHTML = `${O.toFixed(m ? 2 : 1)} <span style="font-size: 11px;">ม.</span>`, d === "walkway" ? (i.textContent = "ทางเดิน", s.textContent = "ทางเดิน") : (i.textContent = "ระยะทาง", s.textContent = "เส้นลาก"), k >= 1 && !m ? n.textContent = `${k.toFixed(2)} กม.` : n.textContent = "ความยาวรวม";
|
|
6378
6411
|
} else if (r.geometry.type === "Polygon") {
|
|
6379
6412
|
a.innerHTML = p;
|
|
6380
|
-
const
|
|
6381
|
-
o.innerHTML = `${
|
|
6382
|
-
const J = ((
|
|
6413
|
+
const k = Xo(r), O = k / 1600;
|
|
6414
|
+
o.innerHTML = `${k.toFixed(m ? 2 : 1)} <span style="font-size: 11px; font-weight: 700;">ม.²</span>`, d === "floor" ? (i.textContent = "พื้น", s.textContent = "พื้น") : d === "obstacle" ? (i.textContent = "สิ่งกีดขวาง", s.textContent = "สิ่งกีดขวาง") : (i.textContent = "พื้นที่", s.textContent = "รูปทรง"), O >= 0.1 && !m ? n.textContent = `${O.toFixed(2)} ไร่` : n.textContent = "พื้นที่ครอบคลุม";
|
|
6415
|
+
const J = ((M = r.properties) == null ? void 0 : M.user_height) !== void 0 ? r.properties.user_height : (B = r.properties) == null ? void 0 : B.height;
|
|
6383
6416
|
if (J !== void 0) {
|
|
6384
6417
|
const ie = parseFloat(J);
|
|
6385
6418
|
(ie > 0 || this._currentMode === "extrude") && (c.style.display = "flex", document.activeElement !== u && (u.value = ie.toFixed(2)));
|
|
6386
6419
|
}
|
|
6387
6420
|
} else {
|
|
6388
6421
|
a.innerHTML = h;
|
|
6389
|
-
const
|
|
6422
|
+
const k = ((x = r.properties) == null ? void 0 : x.user_ordinal) || ((L = r.properties) == null ? void 0 : L.ordinal);
|
|
6390
6423
|
let O = !1;
|
|
6391
|
-
if (
|
|
6424
|
+
if (k && r.geometry.type === "Point") {
|
|
6392
6425
|
const J = this.geometryManager.getDrawInstance();
|
|
6393
6426
|
if (J) {
|
|
6394
6427
|
const ie = J.getAll().features.find(
|
|
6395
6428
|
(A) => {
|
|
6396
6429
|
var S, N, T, G;
|
|
6397
|
-
return (((S = A.properties) == null ? void 0 : S.user_kind) || ((N = A.properties) == null ? void 0 : N.kind)) === "floor" && (((T = A.properties) == null ? void 0 : T.user_ordinal) ===
|
|
6430
|
+
return (((S = A.properties) == null ? void 0 : S.user_kind) || ((N = A.properties) == null ? void 0 : N.kind)) === "floor" && (((T = A.properties) == null ? void 0 : T.user_ordinal) === k || ((G = A.properties) == null ? void 0 : G.ordinal) === k);
|
|
6398
6431
|
}
|
|
6399
6432
|
);
|
|
6400
6433
|
if (ie)
|
|
@@ -6409,27 +6442,27 @@ class ci {
|
|
|
6409
6442
|
const [J, ie] = r.geometry.coordinates;
|
|
6410
6443
|
o.innerHTML = `<span style="font-size:12px; font-weight:600; color:#64748b;">Lat</span> ${ie.toFixed(5)} <span style="font-size:12px; font-weight:600; color:#64748b;">Lng</span> ${J.toFixed(5)}`;
|
|
6411
6444
|
} else O || (o.textContent = "-");
|
|
6412
|
-
|
|
6445
|
+
d === "beacon" ? (i.textContent = "บีคอน", s.textContent = "บีคอน") : d === "poi" ? (i.textContent = "จุดสนใจ", s.textContent = "จุดสนใจ") : (i.textContent = "จุด", s.textContent = "Point"), n.textContent = "พิกัดพอยต์";
|
|
6413
6446
|
}
|
|
6414
|
-
if (["beacon", "poi", "floor", "walkway", "obstacle"].includes(
|
|
6415
|
-
const
|
|
6416
|
-
|
|
6447
|
+
if (["beacon", "poi", "floor", "walkway", "obstacle"].includes(d)) {
|
|
6448
|
+
const k = document.createElement("button");
|
|
6449
|
+
k.className = "pm-measure-settings-btn", k.title = "Edit Properties", k.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6l-44.4 122.1c-3.1 8.6-11.5 14.2-20.5 14.2h-1.9l-56.7-10.2c-15.8 9.6-33.1 17.4-51.5 23.2l-13 57c-2.1 9-10.1 15.3-19.4 15.3l-88.7 0c-9.3 0-17.3-6.3-19.4-15.3l-13-57c-18.4-5.7-35.7-13.5-51.5-23.2l-56.7 10.2h-1.9c-9 0-17.4-5.6-20.5-14.2L3.1 345.4c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C51.7 273.1 51.1 264.6 51.1 256s.6-17.1 1.7-25.4L9.5 191.2c-6.9-6.2-9.6-15.9-6.4-24.6L47.5 44.5c3.1-8.6 11.5-14.2 20.5-14.2h1.9l56.7 10.2c15.8-9.6 33.1-17.4 51.5-23.2l13-57c2.1-9 10.1-15.3-19.4-15.3l88.7 0c9.3 0 17.3 6.3 19.4-15.3l13 57c18.4 5.7 35.7 13.5 51.5 23.2l56.7-10.2h1.9c9 0 17.4 5.6 20.5 14.2l44.4 122.1zM256 160c-53 0-96 43-96 96s43 96 96 96s96-43 96-96s-43-96-96-96z"/></svg>', k.onclick = (J) => {
|
|
6417
6450
|
J.stopPropagation(), this.propertyEditor.show(r);
|
|
6418
6451
|
};
|
|
6419
6452
|
const O = this.measurePanel.querySelector(".pm-measure-header-title-wrap");
|
|
6420
|
-
O && O.appendChild(
|
|
6453
|
+
O && O.appendChild(k);
|
|
6421
6454
|
}
|
|
6422
6455
|
}
|
|
6423
6456
|
_renderToolbar() {
|
|
6424
6457
|
if (!this.toolbar) return;
|
|
6425
|
-
const e = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M77.3 2.5c8.1-4.1 17.9-3.2 25.1 2.3l320 239.9c8.3 6.2 11.6 17 8.4 26.8s-12.4 16.4-22.8 16.4l-152.3 0 88.9 177.7c7.9 15.8 1.5 35-14.3 42.9s-35 1.5-42.9-14.3l-88.9-177.7-91.3 121.8c-6.2 8.3-17 11.6-26.8 8.4S64 434.3 64 424L64 24c0-9.1 5.1-17.4 13.3-21.5z"/></svg>', r = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M209.1 516.2c-18.7 18.7-49.1 18.7-67.9 0L28.1 403.1c-18.7-18.7-18.7-49.1 0-67.9l17-17 73.5 73.5c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-73.5-73.5 33.9-33.9 50.9 50.9c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-50.9-50.9 33.9-33.9 73.5 73.5c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-73.5-73.5 33.9-33.9 50.9 50.9c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-50.9-50.9 33.9-33.9 73.5 73.5c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-73.5-73.5 17-17c18.7-18.7 49.1-18.7 67.9 0L548.5 108.9c18.7 18.7 18.7 49.1 0 67.9L209.1 516.2z"/></svg>', o = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M64 0c23.7 0 44.4 12.9 55.4 32l273.1 0c11.1-19.1 31.7-32 55.4-32 35.3 0 64 28.7 64 64 0 34-26.5 61.8-60 63.9l-2.1 2.9-71.5 99.1c3.6 8 5.6 16.9 5.6 26.2s-2 18.2-5.6 26.2l2.2 3.1 69.3 96 2.1 2.9c33.5 2.1 60 29.9 60 63.9 0 35.3-28.7 64-64 64-23.7 0-44.4-12.9-55.4-32l-273.1 0c-11.1 19.1-31.7 32-55.4 32-35.3 0-64-28.7-64-64 0-23.7 12.9-44.4 32-55.4l0-273.1C12.9 108.4 0 87.7 0 64 0 28.7 28.7 0 64 0zM394.2 413.4l-65.5-90.6-2.2-3.1c-2.1 .2-4.3 .3-6.5 .3-35.3 0-64-28.7-64-64s28.7-64 64-64c2.2 0 4.4 .1 6.5 .3l67.7-93.7c-.6-.9-1.1-1.7-1.6-2.6L119.4 96c-5.6 9.7-13.7 17.8-23.4 23.4l0 273.1c9.7 5.6 17.8 13.7 23.4 23.4l273.1 0c.5-.9 1.1-1.8 1.6-2.6z"/></svg>', i = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M384 80c8.8 0 16 7.2 16 16l0 320c0 8.8-7.2 16-16 16L64 432c-8.8 0-16-7.2-16-16L48 96c0-8.8 7.2-16 16-16l320 0zM64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32z"/></svg>', n = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M224.3-2.5c19.8-11.4 44.2-11.4 64 0L464.2 99c19.8 11.4 32 32.6 32 55.4l0 203c0 22.9-12.2 44-32 55.4L288.3 514.5c-19.8 11.4-44.2 11.4-64 0L48.5 413c-19.8-11.4-32-32.6-32-55.4l0-203c0-22.9 12.2-44 32-55.4L224.3-2.5zm207.8 360l0-166.1-143.8 83 0 166.1 143.8-83z"/></svg>', s = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M480.1 192l7.9 0c13.3 0 24-10.7 24-24l0-144c0-9.7-5.8-18.5-14.8-22.2S477.9 .2 471 7L419.3 58.8C375 22.1 318 0 256 0 127 0 20.3 95.4 2.6 219.5 .1 237 12.2 253.2 29.7 255.7s33.7-9.7 36.2-27.1C79.2 135.5 159.3 64 256 64 300.4 64 341.2 79 373.7 104.3L327 151c-6.9 6.9-8.9 17.2-5.2 26.2S334.3 192 344 192l136.1 0zm29.4 100.5c2.5-17.5-9.7-33.7-27.1-36.2s-33.7 9.7-36.2 27.1c-13.3 93-93.4 164.5-190.1 164.5-44.4 0-85.2-15-117.7-40.3L185 361c6.9-6.9 8.9-17.2-5.2-26.2S177.7 320 168 320L24 320c-13.3 0-24 10.7-24 24L0 488c0 9.7 5.8 18.5 14.8 22.2S34.1 511.8 41 505l51.8-51.8C137 489.9 194 512 256 512 385 512 491.7 416.6 509.4 292.5z"/></svg>', a = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M192 0c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-200.6c0-17.4-7.1-34.1-19.7-46.2L370.6 17.8C358.7 6.4 342.8 0 326.3 0L192 0zM64 128c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-16-64 0 0 16-192 0 0-256 16 0 0-64-16 0z"/></svg>', l = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M136.7 5.9L128 32 32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-96 0-8.7-26.1C306.9-7.2 294.7-16 280.9-16L167.1-16c-13.8 0-26 8.8-30.4 21.9zM416 144L32 144 53.1 467.1C54.7 492.4 75.7 512 101 512L347 512c25.3 0 46.3-19.6 47.9-44.9L416 144z"/></svg>', c = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 242.7-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7 288 32zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zM432 456c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/></svg>', u = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M288 109.3L288 352c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-242.7-73.4 73.4c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l128-128c12.5-12.5 32.8-12.5 45.3 0l128 128c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L288 109.3zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zM432 456c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/></svg>',
|
|
6458
|
+
const e = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M77.3 2.5c8.1-4.1 17.9-3.2 25.1 2.3l320 239.9c8.3 6.2 11.6 17 8.4 26.8s-12.4 16.4-22.8 16.4l-152.3 0 88.9 177.7c7.9 15.8 1.5 35-14.3 42.9s-35 1.5-42.9-14.3l-88.9-177.7-91.3 121.8c-6.2 8.3-17 11.6-26.8 8.4S64 434.3 64 424L64 24c0-9.1 5.1-17.4 13.3-21.5z"/></svg>', r = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M209.1 516.2c-18.7 18.7-49.1 18.7-67.9 0L28.1 403.1c-18.7-18.7-18.7-49.1 0-67.9l17-17 73.5 73.5c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-73.5-73.5 33.9-33.9 50.9 50.9c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-50.9-50.9 33.9-33.9 73.5 73.5c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-73.5-73.5 33.9-33.9 50.9 50.9c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-50.9-50.9 33.9-33.9 73.5 73.5c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-73.5-73.5 17-17c18.7-18.7 49.1-18.7 67.9 0L548.5 108.9c18.7 18.7 18.7 49.1 0 67.9L209.1 516.2z"/></svg>', o = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M64 0c23.7 0 44.4 12.9 55.4 32l273.1 0c11.1-19.1 31.7-32 55.4-32 35.3 0 64 28.7 64 64 0 34-26.5 61.8-60 63.9l-2.1 2.9-71.5 99.1c3.6 8 5.6 16.9 5.6 26.2s-2 18.2-5.6 26.2l2.2 3.1 69.3 96 2.1 2.9c33.5 2.1 60 29.9 60 63.9 0 35.3-28.7 64-64 64-23.7 0-44.4-12.9-55.4-32l-273.1 0c-11.1 19.1-31.7 32-55.4 32-35.3 0-64-28.7-64-64 0-23.7 12.9-44.4 32-55.4l0-273.1C12.9 108.4 0 87.7 0 64 0 28.7 28.7 0 64 0zM394.2 413.4l-65.5-90.6-2.2-3.1c-2.1 .2-4.3 .3-6.5 .3-35.3 0-64-28.7-64-64s28.7-64 64-64c2.2 0 4.4 .1 6.5 .3l67.7-93.7c-.6-.9-1.1-1.7-1.6-2.6L119.4 96c-5.6 9.7-13.7 17.8-23.4 23.4l0 273.1c9.7 5.6 17.8 13.7 23.4 23.4l273.1 0c.5-.9 1.1-1.8 1.6-2.6z"/></svg>', i = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M384 80c8.8 0 16 7.2 16 16l0 320c0 8.8-7.2 16-16 16L64 432c-8.8 0-16-7.2-16-16L48 96c0-8.8 7.2-16 16-16l320 0zM64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32z"/></svg>', n = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M224.3-2.5c19.8-11.4 44.2-11.4 64 0L464.2 99c19.8 11.4 32 32.6 32 55.4l0 203c0 22.9-12.2 44-32 55.4L288.3 514.5c-19.8 11.4-44.2 11.4-64 0L48.5 413c-19.8-11.4-32-32.6-32-55.4l0-203c0-22.9 12.2-44 32-55.4L224.3-2.5zm207.8 360l0-166.1-143.8 83 0 166.1 143.8-83z"/></svg>', s = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M480.1 192l7.9 0c13.3 0 24-10.7 24-24l0-144c0-9.7-5.8-18.5-14.8-22.2S477.9 .2 471 7L419.3 58.8C375 22.1 318 0 256 0 127 0 20.3 95.4 2.6 219.5 .1 237 12.2 253.2 29.7 255.7s33.7-9.7 36.2-27.1C79.2 135.5 159.3 64 256 64 300.4 64 341.2 79 373.7 104.3L327 151c-6.9 6.9-8.9 17.2-5.2 26.2S334.3 192 344 192l136.1 0zm29.4 100.5c2.5-17.5-9.7-33.7-27.1-36.2s-33.7 9.7-36.2 27.1c-13.3 93-93.4 164.5-190.1 164.5-44.4 0-85.2-15-117.7-40.3L185 361c6.9-6.9 8.9-17.2-5.2-26.2S177.7 320 168 320L24 320c-13.3 0-24 10.7-24 24L0 488c0 9.7 5.8 18.5 14.8 22.2S34.1 511.8 41 505l51.8-51.8C137 489.9 194 512 256 512 385 512 491.7 416.6 509.4 292.5z"/></svg>', a = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M192 0c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-200.6c0-17.4-7.1-34.1-19.7-46.2L370.6 17.8C358.7 6.4 342.8 0 326.3 0L192 0zM64 128c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-16-64 0 0 16-192 0 0-256 16 0 0-64-16 0z"/></svg>', l = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M136.7 5.9L128 32 32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-96 0-8.7-26.1C306.9-7.2 294.7-16 280.9-16L167.1-16c-13.8 0-26 8.8-30.4 21.9zM416 144L32 144 53.1 467.1C54.7 492.4 75.7 512 101 512L347 512c25.3 0 46.3-19.6 47.9-44.9L416 144z"/></svg>', c = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 242.7-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7 288 32zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zM432 456c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/></svg>', u = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M288 109.3L288 352c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-242.7-73.4 73.4c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l128-128c12.5-12.5 32.8-12.5 45.3 0l128 128c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L288 109.3zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zM432 456c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/></svg>', g = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6l-44.4 122.1c-3.1 8.6-11.5 14.2-20.5 14.2h-1.9l-56.7-10.2c-15.8 9.6-33.1 17.4-51.5 23.2l-13 57c-2.1 9-10.1 15.3-19.4 15.3l-88.7 0c-9.3 0-17.3-6.3-19.4-15.3l-13-57c-18.4-5.7-35.7-13.5-51.5-23.2l-56.7 10.2h-1.9c-9 0-17.4-5.6-20.5-14.2L3.1 345.4c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C51.7 273.1 51.1 264.6 51.1 256s.6-17.1 1.7-25.4L9.5 191.2c-6.9-6.2-9.6-15.9-6.4-24.6L47.5 44.5c3.1-8.6 11.5-14.2 20.5-14.2h1.9l56.7 10.2c15.8-9.6 33.1-17.4 51.5-23.2l13-57c2.1-9 10.1-15.3 19.4-15.3l88.7 0c9.3 0 17.3 6.3 19.4 15.3l13 57c18.4 5.7 35.7 13.5 51.5 23.2l56.7-10.2h1.9c9 0 17.4 5.6 20.5 14.2l44.4 122.1zM256 160c-53 0-96 43-96 96s43 96 96 96s96-43 96-96s-43-96-96-96z"/></svg>', p = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M48 96V416c0 8.8 7.2 16 16 16H384c8.8 0 16-7.2 16-16V170.5c0-4.2-1.7-8.3-4.7-11.3l-33.9-33.9c-12-12-18.7-28.3-18.7-45.3V128H304v48c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V80H64c-8.8 0-16 7.2-16 16zm128-16H272V80H176v0zM48 416V96C48 60.7 76.7 32 112 32H338.7c17 0 33.3 6.7 45.3 18.7l45.3 45.3C441.3 108 448 124.3 448 141.3V416c0 35.3-28.7 64-64 64H112c-35.3 0-64-28.7-64-64zm176-16H272V272H224v128z"/></svg>', h = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M448 112c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zM304 112c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zM144 112c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zM0 112c0 26.5 21.5 48 48 48s 48-21.5 48-48-21.5-48-48-48-48 21.5-48 48zM448 240c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zM304 240c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zM144 240c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zM0 240c0 26.5 21.5 48 48 48s 48-21.5 48-48-21.5-48-48-48-48 21.5-48 48zM448 368c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zM304 368c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zM144 368c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zM0 368c0 26.5 21.5 48 48 48s 48-21.5 48-48-21.5-48-48-48-48 21.5-48 48z"/></svg>', d = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"/></svg>', m = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M208 80c0-26.5 21.5-48 48-48h64c26.5 0 48 21.5 48 48v64c0 26.5-21.5 48-48 48h-8c-11.4 0-21.7-4-29.7-10.7L256 240l-26.3-10.7c-8 6.7-18.3 10.7-29.7 10.7h-8c-26.5 0-48-21.5-48-48V80zm232 256c26.5 0 48 21.5 48 48v64c0 26.5-21.5 48-48 48h-64c-26.5 0-48-21.5-48-48v-64c0-26.5 21.5-48 48-48h64zm-336 0c26.5 0 48 21.5 48 48v64c0 26.5-21.5 48-48 48H40c-26.5 0-48-21.5-48-48v-64c0-26.5 21.5-48 48-48h64z"/></svg>', w = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 32L20 176l236 144 236-144L256 32zm0 304l-20-12.2V432l20 12.2 20-12.2V323.8l-20 12.2z"/></svg>', b = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 0l256 128-256 128L0 128 256 0zM0 192l256 128 256-128v128L256 448 0 320V192zm256 192l256-128v128L256 512 0 384V256l256 128z"/></svg>';
|
|
6426
6459
|
let C = "";
|
|
6427
6460
|
this.mode === "indoor" ? C = `
|
|
6428
6461
|
<button class="pm-draw-btn active" data-tool="simple_select" title="Select Tool">${e}</button>
|
|
6429
6462
|
<button class="pm-draw-btn" data-tool="draw_beacon" title="Place Beacon">${h}</button>
|
|
6430
|
-
<button class="pm-draw-btn" data-tool="draw_poi" title="Place POI">${
|
|
6463
|
+
<button class="pm-draw-btn" data-tool="draw_poi" title="Place POI">${d}</button>
|
|
6431
6464
|
<button class="pm-draw-btn" data-tool="draw_walkway" title="Create Walkway">${m}</button>
|
|
6432
|
-
<button class="pm-draw-btn" data-tool="draw_floor" title="Create Floor">${
|
|
6465
|
+
<button class="pm-draw-btn" data-tool="draw_floor" title="Create Floor">${w}</button>
|
|
6433
6466
|
<button class="pm-draw-btn" data-tool="draw_obstacle" title="Create Obstacle">${b}</button>
|
|
6434
6467
|
` : C = `
|
|
6435
6468
|
<button class="pm-draw-btn active" data-tool="simple_select" title="Select Tool">${e}</button>
|
|
@@ -6450,7 +6483,7 @@ class ci {
|
|
|
6450
6483
|
<button class="pm-draw-btn" data-tool="import" title="Import GeoJSON">${u}</button>
|
|
6451
6484
|
${this.mode === "indoor" ? `
|
|
6452
6485
|
<div class="pm-draw-divider" data-for="settings" style="display: none;"></div>
|
|
6453
|
-
<button class="pm-draw-btn" data-tool="settings" title="Settings" style="display: none;">${
|
|
6486
|
+
<button class="pm-draw-btn" data-tool="settings" title="Settings" style="display: none;">${g}</button>
|
|
6454
6487
|
` : ""}
|
|
6455
6488
|
`, this.toolbar.innerHTML = C, this.tooltip && this.tooltip.attachToToolbar(this.toolbar);
|
|
6456
6489
|
}
|
|
@@ -6706,7 +6739,7 @@ async function we(t, e, {
|
|
|
6706
6739
|
base: s,
|
|
6707
6740
|
apiKey: a
|
|
6708
6741
|
} = {}) {
|
|
6709
|
-
var
|
|
6742
|
+
var d;
|
|
6710
6743
|
if (!(t != null && t.getStyle)) return;
|
|
6711
6744
|
const l = t.__pmNonce, c = () => {
|
|
6712
6745
|
try {
|
|
@@ -6722,27 +6755,27 @@ async function we(t, e, {
|
|
|
6722
6755
|
}
|
|
6723
6756
|
};
|
|
6724
6757
|
if (!c()) return;
|
|
6725
|
-
let
|
|
6758
|
+
let g = null;
|
|
6726
6759
|
try {
|
|
6727
|
-
|
|
6760
|
+
g = await di(e);
|
|
6728
6761
|
} catch {
|
|
6729
6762
|
console.warn("fetchStyle failed:", e);
|
|
6730
6763
|
return;
|
|
6731
6764
|
}
|
|
6732
6765
|
if (!c()) return;
|
|
6733
6766
|
const p = {};
|
|
6734
|
-
for (const [m,
|
|
6767
|
+
for (const [m, w] of Object.entries(g.sources || {})) {
|
|
6735
6768
|
if (!c()) return;
|
|
6736
6769
|
const b = `${r}-src-${m}`;
|
|
6737
|
-
fi(t, b,
|
|
6770
|
+
fi(t, b, w, s, a, c), p[m] = b;
|
|
6738
6771
|
}
|
|
6739
|
-
for (const m of
|
|
6772
|
+
for (const m of g.layers || []) {
|
|
6740
6773
|
if (!o(m)) continue;
|
|
6741
6774
|
if (!c()) return;
|
|
6742
|
-
const
|
|
6743
|
-
if (u(
|
|
6775
|
+
const w = `${r}-${m.id}`;
|
|
6776
|
+
if (u(w)) continue;
|
|
6744
6777
|
const b = JSON.parse(JSON.stringify(m));
|
|
6745
|
-
b.id =
|
|
6778
|
+
b.id = w, p[b.source] && (b.source = p[b.source]), b.layout = b.layout || {}, b.layout.visibility = i;
|
|
6746
6779
|
try {
|
|
6747
6780
|
if (!c()) return;
|
|
6748
6781
|
t.addLayer(b, n);
|
|
@@ -6750,7 +6783,7 @@ async function we(t, e, {
|
|
|
6750
6783
|
}
|
|
6751
6784
|
}
|
|
6752
6785
|
if (!c()) return;
|
|
6753
|
-
const h = (
|
|
6786
|
+
const h = (d = t.__pmDesiredVis) == null ? void 0 : d[r];
|
|
6754
6787
|
return typeof h == "boolean" && Tr(t, r, h, c), { prefix: r };
|
|
6755
6788
|
}
|
|
6756
6789
|
function Tr(t, e, r, o = () => !0) {
|
|
@@ -6786,8 +6819,8 @@ async function bt(t, e, r = e, o) {
|
|
|
6786
6819
|
if (t.isStyleLoaded && !t.isStyleLoaded() && await new Promise((b) => {
|
|
6787
6820
|
if (!n()) return b();
|
|
6788
6821
|
const C = () => {
|
|
6789
|
-
|
|
6790
|
-
},
|
|
6822
|
+
M(), b();
|
|
6823
|
+
}, M = () => {
|
|
6791
6824
|
try {
|
|
6792
6825
|
t.off("styledata", C);
|
|
6793
6826
|
} catch {
|
|
@@ -6798,7 +6831,7 @@ async function bt(t, e, r = e, o) {
|
|
|
6798
6831
|
}
|
|
6799
6832
|
};
|
|
6800
6833
|
t.on("styledata", C), t.on("load", C), setTimeout(() => {
|
|
6801
|
-
|
|
6834
|
+
M(), b();
|
|
6802
6835
|
}, 1500);
|
|
6803
6836
|
}), !n() || (t.__pmSpriteLoaded = t.__pmSpriteLoaded || {}, t.__pmSpriteLoaded[r])) return;
|
|
6804
6837
|
const a = (b) => ne(b, o), c = (window.devicePixelRatio || 1) > 1.5 ? [
|
|
@@ -6812,45 +6845,45 @@ async function bt(t, e, r = e, o) {
|
|
|
6812
6845
|
a(`${e}@2x.json`),
|
|
6813
6846
|
a(`${e}@2x.png`)
|
|
6814
6847
|
];
|
|
6815
|
-
let u,
|
|
6848
|
+
let u, g, p = 1;
|
|
6816
6849
|
for (let b = 0; b < c.length; b += 2) {
|
|
6817
6850
|
if (!n()) return;
|
|
6818
6851
|
try {
|
|
6819
|
-
const [C,
|
|
6852
|
+
const [C, M] = [c[b], c[b + 1]], B = await fetch(C);
|
|
6853
|
+
if (!B.ok) throw 0;
|
|
6854
|
+
if (u = await B.json(), !n()) return;
|
|
6855
|
+
const x = await fetch(M);
|
|
6820
6856
|
if (!x.ok) throw 0;
|
|
6821
|
-
|
|
6822
|
-
const k = await fetch(I);
|
|
6823
|
-
if (!k.ok) throw 0;
|
|
6824
|
-
const L = await k.blob();
|
|
6857
|
+
const L = await x.blob();
|
|
6825
6858
|
if (!n()) return;
|
|
6826
|
-
|
|
6859
|
+
g = "createImageBitmap" in window ? await createImageBitmap(L) : await w(L), p = C.includes("@2x") ? 2 : 1;
|
|
6827
6860
|
break;
|
|
6828
6861
|
} catch {
|
|
6829
6862
|
}
|
|
6830
6863
|
}
|
|
6831
6864
|
if (!n()) return;
|
|
6832
|
-
if (!u || !
|
|
6865
|
+
if (!u || !g) {
|
|
6833
6866
|
console.warn("sprite load failed for", e);
|
|
6834
6867
|
return;
|
|
6835
6868
|
}
|
|
6836
|
-
const h = "createImageBitmap" in window &&
|
|
6869
|
+
const h = "createImageBitmap" in window && g instanceof ImageBitmap, d = h ? null : document.createElement("canvas"), m = d ? d.getContext("2d") : null;
|
|
6837
6870
|
for (const [b, C] of Object.entries(u)) {
|
|
6838
6871
|
if (!n()) return;
|
|
6839
6872
|
if (s(b)) continue;
|
|
6840
|
-
const { x:
|
|
6873
|
+
const { x: M, y: B, width: x, height: L, sdf: k } = C;
|
|
6841
6874
|
let O;
|
|
6842
|
-
if (h ? O = await createImageBitmap(
|
|
6875
|
+
if (h ? O = await createImageBitmap(g, M, B, x, L) : (d.width = x, d.height = L, m.clearRect(0, 0, x, L), m.drawImage(g, M, B, x, L, 0, 0, x, L), O = d), !n()) return;
|
|
6843
6876
|
try {
|
|
6844
|
-
t.addImage(b, O, { pixelRatio: p, sdf: !!
|
|
6877
|
+
t.addImage(b, O, { pixelRatio: p, sdf: !!k });
|
|
6845
6878
|
} catch {
|
|
6846
6879
|
}
|
|
6847
6880
|
}
|
|
6848
6881
|
if (!n()) return;
|
|
6849
6882
|
t.__pmSpriteLoaded[r] = !0;
|
|
6850
|
-
function
|
|
6851
|
-
return new Promise((C,
|
|
6852
|
-
const
|
|
6853
|
-
|
|
6883
|
+
function w(b) {
|
|
6884
|
+
return new Promise((C, M) => {
|
|
6885
|
+
const B = new Image();
|
|
6886
|
+
B.onload = () => C(B), B.onerror = M, B.crossOrigin = "anonymous", B.src = URL.createObjectURL(b);
|
|
6854
6887
|
});
|
|
6855
6888
|
}
|
|
6856
6889
|
}
|
|
@@ -7145,13 +7178,13 @@ function Ae({ id: t, name: e, ns: r, stylePath: o, flagPrefix: i, base: n, apiKe
|
|
|
7145
7178
|
l[`${i}Round1`] || (await we(l, c, {
|
|
7146
7179
|
ns: r,
|
|
7147
7180
|
defaultVis: "none",
|
|
7148
|
-
includeFn: (
|
|
7181
|
+
includeFn: (g) => (g == null ? void 0 : g.type) === "line",
|
|
7149
7182
|
base: n,
|
|
7150
7183
|
apiKey: s
|
|
7151
7184
|
}), l[`${i}Round1`] = !0), l[`${i}Sprite`] || (await bt(l, u, o.replace("/", "_"), s), l[`${i}Sprite`] = !0), l[`${i}Round2`] || (await we(l, c, {
|
|
7152
7185
|
ns: r,
|
|
7153
7186
|
defaultVis: "none",
|
|
7154
|
-
includeFn: (
|
|
7187
|
+
includeFn: (g) => (g == null ? void 0 : g.type) === "symbol",
|
|
7155
7188
|
base: n,
|
|
7156
7189
|
apiKey: s
|
|
7157
7190
|
}), l[`${i}Round2`] = !0);
|
|
@@ -7169,13 +7202,13 @@ function De({ id: t, name: e, ns: r, stylePath: o, flagPrefix: i, base: n, apiKe
|
|
|
7169
7202
|
l[`${i}_Lines`] || (await we(l, c, {
|
|
7170
7203
|
ns: r,
|
|
7171
7204
|
defaultVis: "none",
|
|
7172
|
-
includeFn: (
|
|
7205
|
+
includeFn: (g) => (g == null ? void 0 : g.type) === "line",
|
|
7173
7206
|
base: n,
|
|
7174
7207
|
apiKey: s
|
|
7175
7208
|
}), l[`${i}_Lines`] = !0), l[`${i}_Sprite`] || (await bt(l, u, o.replace("/", "_"), s), l[`${i}_Sprite`] = !0), l[`${i}_Symbols`] || (await we(l, c, {
|
|
7176
7209
|
ns: r,
|
|
7177
7210
|
defaultVis: "none",
|
|
7178
|
-
includeFn: (
|
|
7211
|
+
includeFn: (g) => (g == null ? void 0 : g.type) === "symbol" && g["source-layer"] === "bts_mrt_station",
|
|
7179
7212
|
base: n,
|
|
7180
7213
|
apiKey: s
|
|
7181
7214
|
}), l[`${i}_Symbols`] = !0);
|
|
@@ -7679,10 +7712,10 @@ class wi {
|
|
|
7679
7712
|
try {
|
|
7680
7713
|
const l = ((s = this._activeVenue.geometry) == null ? void 0 : s.type) === "Polygon" ? this._activeVenue.geometry.coordinates[0] : ((a = this._activeVenue.geometry) == null ? void 0 : a.type) === "Point" ? [this._activeVenue.geometry.coordinates] : [];
|
|
7681
7714
|
if (l.length > 0) {
|
|
7682
|
-
let c = 1 / 0, u = 1 / 0,
|
|
7715
|
+
let c = 1 / 0, u = 1 / 0, g = -1 / 0, p = -1 / 0;
|
|
7683
7716
|
for (const h of l)
|
|
7684
|
-
h[0] < c && (c = h[0]), h[1] < u && (u = h[1]), h[0] >
|
|
7685
|
-
n = [[c, u], [
|
|
7717
|
+
h[0] < c && (c = h[0]), h[1] < u && (u = h[1]), h[0] > g && (g = h[0]), h[1] > p && (p = h[1]);
|
|
7718
|
+
n = [[c, u], [g, p]];
|
|
7686
7719
|
}
|
|
7687
7720
|
} catch {
|
|
7688
7721
|
}
|
|
@@ -8308,7 +8341,7 @@ class Ei {
|
|
|
8308
8341
|
...this.geometry.query().byKind("floor").where("category", "eq", "venue").toArray(),
|
|
8309
8342
|
...this.geometry.query().byKind("floor").where("feature_type", "eq", "venue").toArray()
|
|
8310
8343
|
], i = o.find((l) => {
|
|
8311
|
-
const c = l.properties || {}, u = c.user_id || l.id,
|
|
8344
|
+
const c = l.properties || {}, u = c.user_id || l.id, g = c.user_name || c.name, p = typeof g == "object" ? g == null ? void 0 : g.en : g;
|
|
8312
8345
|
return u === e || p === e;
|
|
8313
8346
|
}) || o[0];
|
|
8314
8347
|
if (!i)
|