@taichina/map-sdk 1.0.6 → 1.0.7
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/package.json +1 -1
- package/teee-sdk/teee-map-sdk.es.js +362 -33
- package/teee-sdk/teee-map-sdk.umd.js +8 -3
package/package.json
CHANGED
|
@@ -1838,6 +1838,72 @@ var r = async () => {
|
|
|
1838
1838
|
"fill-opacity": .4
|
|
1839
1839
|
}
|
|
1840
1840
|
},
|
|
1841
|
+
{
|
|
1842
|
+
id: `${e.id}_${t}_fill_hitarea`,
|
|
1843
|
+
type: "fill",
|
|
1844
|
+
source: e.id,
|
|
1845
|
+
"source-layer": t,
|
|
1846
|
+
filter: [
|
|
1847
|
+
"==",
|
|
1848
|
+
["geometry-type"],
|
|
1849
|
+
"Polygon"
|
|
1850
|
+
],
|
|
1851
|
+
layout: { visibility: "visible" },
|
|
1852
|
+
paint: {
|
|
1853
|
+
"fill-color": "#8bc34a",
|
|
1854
|
+
"fill-opacity": [
|
|
1855
|
+
"case",
|
|
1856
|
+
[
|
|
1857
|
+
"all",
|
|
1858
|
+
[
|
|
1859
|
+
"==",
|
|
1860
|
+
["feature-state", "select"],
|
|
1861
|
+
!0
|
|
1862
|
+
],
|
|
1863
|
+
[
|
|
1864
|
+
"!=",
|
|
1865
|
+
["feature-state", "visiable"],
|
|
1866
|
+
!1
|
|
1867
|
+
]
|
|
1868
|
+
],
|
|
1869
|
+
.7,
|
|
1870
|
+
0
|
|
1871
|
+
]
|
|
1872
|
+
}
|
|
1873
|
+
},
|
|
1874
|
+
{
|
|
1875
|
+
id: `${e.id}_${t}_fill_selected`,
|
|
1876
|
+
type: "fill",
|
|
1877
|
+
source: e.id,
|
|
1878
|
+
"source-layer": t,
|
|
1879
|
+
filter: [
|
|
1880
|
+
"==",
|
|
1881
|
+
["geometry-type"],
|
|
1882
|
+
"Polygon"
|
|
1883
|
+
],
|
|
1884
|
+
layout: { visibility: "visible" },
|
|
1885
|
+
paint: {
|
|
1886
|
+
"fill-color": "#8bc34a",
|
|
1887
|
+
"fill-opacity": [
|
|
1888
|
+
"case",
|
|
1889
|
+
[
|
|
1890
|
+
"all",
|
|
1891
|
+
[
|
|
1892
|
+
"==",
|
|
1893
|
+
["feature-state", "state"],
|
|
1894
|
+
"1"
|
|
1895
|
+
],
|
|
1896
|
+
[
|
|
1897
|
+
"!=",
|
|
1898
|
+
["feature-state", "visiable"],
|
|
1899
|
+
!1
|
|
1900
|
+
]
|
|
1901
|
+
],
|
|
1902
|
+
.7,
|
|
1903
|
+
0
|
|
1904
|
+
]
|
|
1905
|
+
}
|
|
1906
|
+
},
|
|
1841
1907
|
{
|
|
1842
1908
|
id: `${e.id}_${t}_fill_outline`,
|
|
1843
1909
|
type: "line",
|
|
@@ -1864,6 +1930,47 @@ var r = async () => {
|
|
|
1864
1930
|
]
|
|
1865
1931
|
}
|
|
1866
1932
|
},
|
|
1933
|
+
{
|
|
1934
|
+
id: `${e.id}_${t}_fill_selected_label`,
|
|
1935
|
+
type: "symbol",
|
|
1936
|
+
source: e.id,
|
|
1937
|
+
"source-layer": t,
|
|
1938
|
+
filter: [
|
|
1939
|
+
"==",
|
|
1940
|
+
["geometry-type"],
|
|
1941
|
+
"Polygon"
|
|
1942
|
+
],
|
|
1943
|
+
layout: {
|
|
1944
|
+
visibility: "visible",
|
|
1945
|
+
"text-field": ["get", "name"],
|
|
1946
|
+
"text-size": 14,
|
|
1947
|
+
"text-allow-overlap": !0,
|
|
1948
|
+
"text-offset": [.6, .6]
|
|
1949
|
+
},
|
|
1950
|
+
paint: {
|
|
1951
|
+
"text-color": "#1b5e20",
|
|
1952
|
+
"text-halo-color": "#ffffff",
|
|
1953
|
+
"text-halo-width": 2,
|
|
1954
|
+
"text-opacity": [
|
|
1955
|
+
"case",
|
|
1956
|
+
[
|
|
1957
|
+
"all",
|
|
1958
|
+
[
|
|
1959
|
+
"==",
|
|
1960
|
+
["feature-state", "state"],
|
|
1961
|
+
"1"
|
|
1962
|
+
],
|
|
1963
|
+
[
|
|
1964
|
+
"!=",
|
|
1965
|
+
["feature-state", "visiable"],
|
|
1966
|
+
!1
|
|
1967
|
+
]
|
|
1968
|
+
],
|
|
1969
|
+
1,
|
|
1970
|
+
0
|
|
1971
|
+
]
|
|
1972
|
+
}
|
|
1973
|
+
},
|
|
1867
1974
|
{
|
|
1868
1975
|
id: `${e.id}_${t}_line`,
|
|
1869
1976
|
type: "line",
|
|
@@ -4721,13 +4828,20 @@ var be = class {
|
|
|
4721
4828
|
subState1: "",
|
|
4722
4829
|
subState2: "",
|
|
4723
4830
|
subState3: ""
|
|
4724
|
-
}) : n === "sgfhqy_door"
|
|
4831
|
+
}) : n === "sgfhqy_door" ? this.teeeMap.updateFeatureState(e.properties.code, {
|
|
4725
4832
|
state: "2",
|
|
4726
4833
|
select: !1,
|
|
4727
4834
|
visiable: !0,
|
|
4728
4835
|
subState1: "",
|
|
4729
4836
|
subState2: "",
|
|
4730
4837
|
subState3: ""
|
|
4838
|
+
}) : n === "sgfhqy_fill" && this.teeeMap.updateFeatureState(e.properties.code, {
|
|
4839
|
+
state: "",
|
|
4840
|
+
select: !1,
|
|
4841
|
+
visiable: !0,
|
|
4842
|
+
subState1: "",
|
|
4843
|
+
subState2: "",
|
|
4844
|
+
subState3: ""
|
|
4731
4845
|
});
|
|
4732
4846
|
}
|
|
4733
4847
|
changeFeatureState(e, t) {
|
|
@@ -4907,6 +5021,48 @@ var be = class {
|
|
|
4907
5021
|
data: a
|
|
4908
5022
|
};
|
|
4909
5023
|
}
|
|
5024
|
+
createFSQAction(e) {
|
|
5025
|
+
let t, n, r, i, a = {};
|
|
5026
|
+
e.state;
|
|
5027
|
+
let o = e.feature.properties, s = o.name;
|
|
5028
|
+
return e.featureType && (t = "fsq", n = "封锁区", r = `对${o.name}区域进行封锁操作`, i = s, a = e), {
|
|
5029
|
+
actionType: t,
|
|
5030
|
+
actionName: n,
|
|
5031
|
+
content: r,
|
|
5032
|
+
target: i,
|
|
5033
|
+
data: a
|
|
5034
|
+
};
|
|
5035
|
+
}
|
|
5036
|
+
createDoorAction(e) {
|
|
5037
|
+
let t = e.state, n = e.feature.properties.name, r = {
|
|
5038
|
+
1: {
|
|
5039
|
+
op: "open",
|
|
5040
|
+
label: "施工开门"
|
|
5041
|
+
},
|
|
5042
|
+
2: {
|
|
5043
|
+
op: "close",
|
|
5044
|
+
label: "施工关门"
|
|
5045
|
+
},
|
|
5046
|
+
3: {
|
|
5047
|
+
op: "lsopen",
|
|
5048
|
+
label: "临时开门"
|
|
5049
|
+
},
|
|
5050
|
+
4: {
|
|
5051
|
+
op: "lsclose",
|
|
5052
|
+
label: "临时关门"
|
|
5053
|
+
}
|
|
5054
|
+
}, i = (e) => e === "1" ? "t" : "f", { op: a, label: o } = r[t.state] || {
|
|
5055
|
+
op: "unknown",
|
|
5056
|
+
label: "未知操作"
|
|
5057
|
+
};
|
|
5058
|
+
return {
|
|
5059
|
+
actionType: `door_${a}_${i(t.subState1)}_${i(t.subState2)}_${i(t.subState3)}`,
|
|
5060
|
+
actionName: `通道门${o}`,
|
|
5061
|
+
content: `对${n} ${o}`,
|
|
5062
|
+
target: n,
|
|
5063
|
+
data: e
|
|
5064
|
+
};
|
|
5065
|
+
}
|
|
4910
5066
|
};
|
|
4911
5067
|
//#endregion
|
|
4912
5068
|
//#region src/teee-map/utils/baseTool.ts
|
|
@@ -13870,13 +14026,13 @@ var ki = class {
|
|
|
13870
14026
|
this.map = e.map, this.boundMouseMove = this.onMouseMove.bind(this), this.boundClick = this.onClick_.bind(this);
|
|
13871
14027
|
}
|
|
13872
14028
|
start(e, t) {
|
|
13873
|
-
this.active && this.
|
|
14029
|
+
this.active && this.stop(), this.layerIds = Array.isArray(e) ? e : [e], this.onClick = t, this.active = !0, this.map.on("mousemove", this.boundMouseMove), this.map.on("click", this.boundClick);
|
|
13874
14030
|
}
|
|
13875
|
-
|
|
14031
|
+
stop() {
|
|
13876
14032
|
this.active = !1, this.snapMarker?.remove(), this.snapMarker = null, this.onClick = null, this.layerIds = [], this.map.off("mousemove", this.boundMouseMove), this.map.off("click", this.boundClick);
|
|
13877
14033
|
}
|
|
13878
14034
|
destroy() {
|
|
13879
|
-
this.
|
|
14035
|
+
this.stop();
|
|
13880
14036
|
}
|
|
13881
14037
|
getMarkerEl(e = "crosshair") {
|
|
13882
14038
|
let t = document.createElement("div");
|
|
@@ -14165,7 +14321,7 @@ var ki = class {
|
|
|
14165
14321
|
this.addItem(e, "供电", r, () => this.emit({ subState1: "" })), this.addItem(e, "停电", i, () => this.emit({ subState1: "1" }));
|
|
14166
14322
|
}
|
|
14167
14323
|
buildSgfhqyDoorMenu(e, t, n) {
|
|
14168
|
-
this.addSplit(e), this.addItem(e, "
|
|
14324
|
+
this.addSplit(e), this.addItem(e, "施工开始开门", n.state === "1", () => this.emit({ state: "1" })), this.addItem(e, "施工结束关门", n.state === "2", () => this.emit({ state: "2" })), this.addItem(e, "施工临时开门", n.state === "3", () => this.emit({ state: "3" })), this.addItem(e, "施工临时关门", n.state === "4", () => this.emit({ state: "4" })), this.addSplit(e), this.addItem(e, "调度命令确认", n.subState1 === "1", () => this.emit({ subState1: "1" })), this.addItem(e, "调度命令取消", n.subState1 === "", () => this.emit({ subState1: "" })), this.addSplit(e), this.addItem(e, "进入申请确认", n.subState2 === "1", () => this.emit({ subState2: "1" })), this.addItem(e, "进入申请取消", n.subState2 === "", () => this.emit({ subState2: "" })), this.addSplit(e), this.addItem(e, "人员工机通道门号确认", n.subState3 === "1", () => this.emit({ subState3: "1" })), this.addItem(e, "人员工机通道门号取消", n.subState3 === "", () => this.emit({ subState3: "" }));
|
|
14169
14325
|
}
|
|
14170
14326
|
showLightMenu(e) {
|
|
14171
14327
|
let t = this.createContainer(e, "点灯操作");
|
|
@@ -14238,6 +14394,176 @@ var ki = class {
|
|
|
14238
14394
|
return this.popupRenderer ? this.popupRenderer(e) : [...new Set(e.map((e) => e.properties.name))].join("<br>");
|
|
14239
14395
|
}
|
|
14240
14396
|
}, Ii = class {
|
|
14397
|
+
map;
|
|
14398
|
+
layerIds = [];
|
|
14399
|
+
callbacks = { onClick: () => {} };
|
|
14400
|
+
hovered = null;
|
|
14401
|
+
popup = null;
|
|
14402
|
+
popupRenderer;
|
|
14403
|
+
_active = !1;
|
|
14404
|
+
_boundMouseMove;
|
|
14405
|
+
_boundClick;
|
|
14406
|
+
_boundMove;
|
|
14407
|
+
constructor(e) {
|
|
14408
|
+
this.map = e.map, this._boundMouseMove = this._onMouseMove.bind(this), this._boundClick = this._onClick.bind(this), this._boundMove = this._onMove.bind(this);
|
|
14409
|
+
}
|
|
14410
|
+
start(e, t) {
|
|
14411
|
+
this._active && this.stop(), this._active = !0, this.layerIds = e, this.callbacks = t, this.map.on("mousemove", this._boundMouseMove), this.map.on("click", this._boundClick), this.map.on("move", this._boundMove);
|
|
14412
|
+
}
|
|
14413
|
+
stop() {
|
|
14414
|
+
this._active && (this._active = !1, this.map.off("mousemove", this._boundMouseMove), this.map.off("click", this._boundClick), this.map.off("move", this._boundMove), this._clearHover(), this.popup?.remove(), this.popup = null, this.callbacks.onStop?.(), this.callbacks = { onClick: () => {} }, this.layerIds = []);
|
|
14415
|
+
}
|
|
14416
|
+
setPopupRenderer(e) {
|
|
14417
|
+
this.popupRenderer = e;
|
|
14418
|
+
}
|
|
14419
|
+
destroy() {
|
|
14420
|
+
this.stop(), this.popupRenderer = void 0;
|
|
14421
|
+
}
|
|
14422
|
+
_onMouseMove(t) {
|
|
14423
|
+
if (!this.layerIds.length) return;
|
|
14424
|
+
let n = this.map.queryRenderedFeatures(t.point, { layers: this.layerIds });
|
|
14425
|
+
if (n.length > 0) {
|
|
14426
|
+
let r = n[0];
|
|
14427
|
+
if (this.hovered && this.hovered.properties.code === r.properties.code) {
|
|
14428
|
+
this.popup?.setLngLat(t.lngLat);
|
|
14429
|
+
return;
|
|
14430
|
+
}
|
|
14431
|
+
this._clearHover(), this.hovered = r, this.callbacks.onEnter?.(this.hovered), this.popup ||= new e.Popup({
|
|
14432
|
+
closeButton: !1,
|
|
14433
|
+
closeOnClick: !1,
|
|
14434
|
+
anchor: "top-left",
|
|
14435
|
+
offset: [15, 0]
|
|
14436
|
+
}), this.popup.setLngLat(t.lngLat).setHTML(this._renderPopup(r)).addTo(this.map);
|
|
14437
|
+
} else this._clearHover();
|
|
14438
|
+
}
|
|
14439
|
+
_onClick(e) {
|
|
14440
|
+
if (!this.layerIds.length) return;
|
|
14441
|
+
let t = this.map.queryRenderedFeatures(e.point, { layers: this.layerIds });
|
|
14442
|
+
t.length > 0 && this.callbacks.onClick(t[0]);
|
|
14443
|
+
}
|
|
14444
|
+
_onMove() {
|
|
14445
|
+
this._active && (this._clearHover(), this.popup?.remove());
|
|
14446
|
+
}
|
|
14447
|
+
_clearHover() {
|
|
14448
|
+
if (!this.hovered) return;
|
|
14449
|
+
let e = this.hovered;
|
|
14450
|
+
this.hovered = null, this.popup?.remove(), this.callbacks.onLeave?.(e);
|
|
14451
|
+
}
|
|
14452
|
+
_renderPopup(e) {
|
|
14453
|
+
if (this.popupRenderer) return this.popupRenderer(e);
|
|
14454
|
+
let t = e.properties;
|
|
14455
|
+
return `
|
|
14456
|
+
<div style="max-width:300px;overflow:auto;font-size:12px">
|
|
14457
|
+
<div style="font-weight:700;font-size:13px;padding:0px 0;border-bottom:1px solid #e8e8e8;margin-bottom:2px">${t.name || ""}</div>
|
|
14458
|
+
<table style="border-collapse:collapse">${Object.entries({
|
|
14459
|
+
danyuan: "单元",
|
|
14460
|
+
quyu: "区域",
|
|
14461
|
+
tianchuan: "天窗",
|
|
14462
|
+
zhengxian: "正线",
|
|
14463
|
+
bz: "备注"
|
|
14464
|
+
}).filter(([e]) => t[e] !== void 0 && t[e] !== null).map(([e, n]) => `<tr><td style="padding:2px 6px;font-weight:600;white-space:nowrap;vertical-align:top">${n}</td><td style="padding:2px 6px">${t[e]}</td></tr>`).join("")}</table>
|
|
14465
|
+
</div>
|
|
14466
|
+
`;
|
|
14467
|
+
}
|
|
14468
|
+
}, Li = class {
|
|
14469
|
+
map;
|
|
14470
|
+
teeeMap;
|
|
14471
|
+
layerIds = [];
|
|
14472
|
+
callback = null;
|
|
14473
|
+
active = !1;
|
|
14474
|
+
el = null;
|
|
14475
|
+
currentFeature = null;
|
|
14476
|
+
checked = {
|
|
14477
|
+
state: "",
|
|
14478
|
+
subState1: "",
|
|
14479
|
+
subState2: "",
|
|
14480
|
+
subState3: ""
|
|
14481
|
+
};
|
|
14482
|
+
boundContextMenu;
|
|
14483
|
+
boundMove;
|
|
14484
|
+
constructor(e) {
|
|
14485
|
+
this.teeeMap = e, this.map = e.map, this.boundContextMenu = this._onContextMenu.bind(this), this.boundMove = this._onMove.bind(this);
|
|
14486
|
+
}
|
|
14487
|
+
start(e, t) {
|
|
14488
|
+
this.active && this.stop(), this.active = !0, this.layerIds = e, this.callback = t, this.map.on("contextmenu", this.boundContextMenu), this.map.on("move", this.boundMove);
|
|
14489
|
+
}
|
|
14490
|
+
stop() {
|
|
14491
|
+
this.active && (this.active = !1, this.map.off("contextmenu", this.boundContextMenu), this.map.off("move", this.boundMove), this._removePopup(), this.callback = null, this.layerIds = []);
|
|
14492
|
+
}
|
|
14493
|
+
destroy() {
|
|
14494
|
+
this.stop();
|
|
14495
|
+
}
|
|
14496
|
+
_onContextMenu(e) {
|
|
14497
|
+
e.preventDefault(), this._removePopup();
|
|
14498
|
+
let t = this.map.queryRenderedFeatures(e.point, { layers: this.layerIds });
|
|
14499
|
+
if (!t.length) return;
|
|
14500
|
+
let n = t[0];
|
|
14501
|
+
this.currentFeature = n, this.teeeMap.ctcTool?.changeFeatureState(n.properties.code, { select: !0 });
|
|
14502
|
+
let r = n.state || {}, i = r.state || "";
|
|
14503
|
+
this.checked = {
|
|
14504
|
+
state: "",
|
|
14505
|
+
subState1: r.subState1 || "",
|
|
14506
|
+
subState2: r.subState2 || "",
|
|
14507
|
+
subState3: r.subState3 || ""
|
|
14508
|
+
}, this._showPopup(e, n, i);
|
|
14509
|
+
}
|
|
14510
|
+
_onMove() {
|
|
14511
|
+
this._removePopup();
|
|
14512
|
+
}
|
|
14513
|
+
_showPopup(e, t, n) {
|
|
14514
|
+
let r = this._getViewportPos(e), i = t.properties.name || "", a = document.createElement("div");
|
|
14515
|
+
a.className = "door-tool-popup", a.style.cssText = `position:fixed;z-index:9999;left:${r.x}px;top:${r.y}px;background:#fff;color:#000;font-size:13px;min-width:220px;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,0.2);`;
|
|
14516
|
+
let o = document.createElement("div");
|
|
14517
|
+
o.style.cssText = "padding:8px 10px;font-size:14px;font-weight:600;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #e8e8e8;", o.innerHTML = `${i}<span class="door-popup-close" style="cursor:pointer;font-size:16px;color:#999;line-height:1;">×</span>`, o.querySelector(".door-popup-close").addEventListener("click", () => this._removePopup()), a.appendChild(o), this._addCheckItem(a, "调度命令确认", "subState1"), this._addCheckItem(a, "进入通道门申请确认", "subState2"), this._addCheckItem(a, "人员、工机具、通道门号确认", "subState3");
|
|
14518
|
+
let s = document.createElement("div");
|
|
14519
|
+
s.style.cssText = "height:1px;background:#e8e8e8;margin:4px 0;", a.appendChild(s);
|
|
14520
|
+
let c = document.createElement("div");
|
|
14521
|
+
c.style.cssText = "display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:8px 10px;", this._addButton(c, "施工开始开门", "1", n), this._addButton(c, "施工结束关门", "2", n), this._addButton(c, "临时开门", "3", n), this._addButton(c, "临时关门", "4", n), a.appendChild(c), document.body.appendChild(a), this._adjustPosition(a, e), this.el = a;
|
|
14522
|
+
}
|
|
14523
|
+
_addCheckItem(e, t, n) {
|
|
14524
|
+
let r = this.checked[n] === "1", i = document.createElement("div");
|
|
14525
|
+
i.style.cssText = "padding:6px 10px;display:flex;align-items:center;gap:8px;cursor:pointer;user-select:none;", i.innerHTML = r ? `<span style="color:#1677ff;font-weight:600;width:16px;">✓</span>${t}` : `<span style="color:#ccc;width:16px;">○</span>${t}`, i.addEventListener("mouseenter", () => {
|
|
14526
|
+
i.style.background = "#f2f2f2";
|
|
14527
|
+
}), i.addEventListener("mouseleave", () => {
|
|
14528
|
+
i.style.background = "";
|
|
14529
|
+
}), i.addEventListener("click", () => {
|
|
14530
|
+
this.checked = {
|
|
14531
|
+
...this.checked,
|
|
14532
|
+
[n]: this.checked[n] === "1" ? "" : "1"
|
|
14533
|
+
};
|
|
14534
|
+
let e = i.querySelector("span");
|
|
14535
|
+
this.checked[n] === "1" ? (e.style.color = "#1677ff", e.style.fontWeight = "600", e.textContent = "✓") : (e.style.color = "#ccc", e.style.fontWeight = "", e.textContent = "○");
|
|
14536
|
+
}), e.appendChild(i);
|
|
14537
|
+
}
|
|
14538
|
+
_addButton(e, t, n, r) {
|
|
14539
|
+
let i = n === r, a = document.createElement("button");
|
|
14540
|
+
a.textContent = t, a.style.cssText = `padding:6px 0;border:1px solid #d9d9d9;border-radius:4px;background:${i ? "#e6f4ff" : "#fff"};color:${i ? "#1677ff" : "#000"};border-color:${i ? "#1677ff" : "#d9d9d9"};font-weight:${i ? "600" : "normal"};cursor:pointer;font-size:13px;white-space:nowrap;`, i || (a.addEventListener("mouseenter", () => {
|
|
14541
|
+
a.style.borderColor = "#1677ff", a.style.color = "#1677ff";
|
|
14542
|
+
}), a.addEventListener("mouseleave", () => {
|
|
14543
|
+
a.style.borderColor = "#d9d9d9", a.style.color = "";
|
|
14544
|
+
})), a.addEventListener("click", () => {
|
|
14545
|
+
let e = {
|
|
14546
|
+
...this.checked,
|
|
14547
|
+
state: n
|
|
14548
|
+
}, t = this.currentFeature;
|
|
14549
|
+
this._removePopup(), this.callback?.(t, e);
|
|
14550
|
+
}), e.appendChild(a);
|
|
14551
|
+
}
|
|
14552
|
+
_getViewportPos(e) {
|
|
14553
|
+
let t = this.map.getContainer().getBoundingClientRect();
|
|
14554
|
+
return {
|
|
14555
|
+
x: t.left + e.point.x,
|
|
14556
|
+
y: t.top + e.point.y
|
|
14557
|
+
};
|
|
14558
|
+
}
|
|
14559
|
+
_adjustPosition(e, t) {
|
|
14560
|
+
let n = this._getViewportPos(t), r = e.getBoundingClientRect();
|
|
14561
|
+
r.right > window.innerWidth && (e.style.left = `${n.x - r.width}px`), r.bottom > window.innerHeight && (e.style.top = `${Math.max(0, n.y - r.height)}px`);
|
|
14562
|
+
}
|
|
14563
|
+
_removePopup() {
|
|
14564
|
+
this.el &&= (this.el.remove(), null), this.currentFeature &&= (this.teeeMap.ctcTool?.changeFeatureState(this.currentFeature.properties.code, { select: !1 }), null);
|
|
14565
|
+
}
|
|
14566
|
+
}, Ri = class {
|
|
14241
14567
|
map;
|
|
14242
14568
|
sourceId;
|
|
14243
14569
|
constructor(e, t) {
|
|
@@ -14270,7 +14596,9 @@ var ki = class {
|
|
|
14270
14596
|
snaps: ki,
|
|
14271
14597
|
drawRoute: Mi,
|
|
14272
14598
|
ctcMenu: Pi,
|
|
14273
|
-
ctcHover: Fi
|
|
14599
|
+
ctcHover: Fi,
|
|
14600
|
+
sgfhqy: Ii,
|
|
14601
|
+
door: Li
|
|
14274
14602
|
}, $ = {
|
|
14275
14603
|
ctc: (e, t, n) => ({
|
|
14276
14604
|
id: "ctc",
|
|
@@ -14317,7 +14645,7 @@ var ki = class {
|
|
|
14317
14645
|
};
|
|
14318
14646
|
//#endregion
|
|
14319
14647
|
//#region src/teee-map/utils/scrambler.ts
|
|
14320
|
-
function
|
|
14648
|
+
function zi(e, t, n) {
|
|
14321
14649
|
let r = BigInt(e), i = BigInt(t), a = BigInt(n), o = r * r * i ^ a;
|
|
14322
14650
|
o === 0n && (o = 3735928559n);
|
|
14323
14651
|
let s = o;
|
|
@@ -14329,14 +14657,14 @@ function Li(e, t, n) {
|
|
|
14329
14657
|
y: a ^ u
|
|
14330
14658
|
};
|
|
14331
14659
|
}
|
|
14332
|
-
function
|
|
14660
|
+
function Bi(e) {
|
|
14333
14661
|
e.map.setTransformRequest((e, t) => {
|
|
14334
14662
|
if (String(t) !== "Tile") return { url: e };
|
|
14335
14663
|
let n = /^https?:\/\//i.test(e) ? e : `${window.location.origin}${e}`, r = new URL(n), i = r.pathname.split("/").filter((e) => e);
|
|
14336
14664
|
if (i.length >= 3) {
|
|
14337
14665
|
let e = Number(i[i.length - 3]), t = Number(i[i.length - 2]), n = i[i.length - 1], a = n.includes(".") ? n.split(".").pop() : "pbf", o = Number(n.replace(/\.(pbf|png)$/i, ""));
|
|
14338
14666
|
if (Number.isInteger(e) && e >= 0 && Number.isInteger(t) && t >= 0 && Number.isInteger(o) && o >= 0) {
|
|
14339
|
-
let n =
|
|
14667
|
+
let n = zi(e, t, o), s = i.slice(0, i.length - 3).join("/");
|
|
14340
14668
|
return { url: `${r.protocol}//${r.host}/${s}/${n.z}/${n.x}/${n.y}.${a}` };
|
|
14341
14669
|
}
|
|
14342
14670
|
}
|
|
@@ -14345,16 +14673,16 @@ function Ri(e) {
|
|
|
14345
14673
|
}
|
|
14346
14674
|
//#endregion
|
|
14347
14675
|
//#region src/teee-map/utils/coordTransform.ts
|
|
14348
|
-
var
|
|
14676
|
+
var Vi = 20037508.34, Hi = (e, t) => [e / Vi * 180, Math.atan(Math.exp(t / Vi * Math.PI)) * 360 / Math.PI - 90], Ui = (e) => "coordinates" in e, Wi = (e) => typeof e[0] == "number" ? Hi(e[0], e[1]) : e.map(Wi), Gi = (e) => e?.features ? {
|
|
14349
14677
|
...e,
|
|
14350
14678
|
features: e.features.map((e) => ({
|
|
14351
14679
|
...e,
|
|
14352
|
-
geometry:
|
|
14680
|
+
geometry: Ui(e.geometry) ? {
|
|
14353
14681
|
...e.geometry,
|
|
14354
|
-
coordinates:
|
|
14682
|
+
coordinates: Wi(e.geometry.coordinates)
|
|
14355
14683
|
} : e.geometry
|
|
14356
14684
|
}))
|
|
14357
|
-
} : e,
|
|
14685
|
+
} : e, Ki = (e, t) => {
|
|
14358
14686
|
if (e === "signal") {
|
|
14359
14687
|
if (!t?.features) return;
|
|
14360
14688
|
t.features.forEach(({ properties: e }) => {
|
|
@@ -14373,7 +14701,7 @@ var zi = 20037508.34, Bi = (e, t) => [e / zi * 180, Math.atan(Math.exp(t / zi *
|
|
|
14373
14701
|
e && (!e.downSignal && e.downsignal && (e.downSignal = e.downsignal, delete e.downsignal), !e.upSignal && e.upsignal && (e.upSignal = e.upsignal, delete e.upsignal));
|
|
14374
14702
|
});
|
|
14375
14703
|
}
|
|
14376
|
-
},
|
|
14704
|
+
}, qi = class {
|
|
14377
14705
|
map;
|
|
14378
14706
|
mapConfigs;
|
|
14379
14707
|
stashFeatures = /* @__PURE__ */ new Map();
|
|
@@ -14403,13 +14731,11 @@ var zi = 20037508.34, Bi = (e, t) => [e / zi * 180, Math.atan(Math.exp(t / zi *
|
|
|
14403
14731
|
this.map.hasImage(e.id) ? console.warn(`图标已存在,跳过添加: ${e.id}`) : this.map.addImage(e.id, e.image);
|
|
14404
14732
|
}), e.layers && e.layers.forEach((e) => {
|
|
14405
14733
|
this.map.getLayer(e.id) ? console.debug(`图层已存在: ${e.id}`) : this.map.addLayer(e);
|
|
14406
|
-
}), this.layerTree = new
|
|
14734
|
+
}), this.layerTree = new Ri(this.map, e.id);
|
|
14407
14735
|
let t = this.map.getStyle().sources, n = Object.keys(t);
|
|
14408
14736
|
console.log(`源列表 (${n.length}):`, n, t);
|
|
14409
14737
|
let r = this.map.getStyle().layers, i = r.map((e) => e.id);
|
|
14410
|
-
console.log(`图层列表 (${i.length}):`, r);
|
|
14411
|
-
let a = this.map.listImages();
|
|
14412
|
-
console.log(`图标列表 (${a.length}):`, a), console.groupEnd(), console.log(`地图构建全部完成: ${e.id}`);
|
|
14738
|
+
console.log(`图层列表 (${i.length}):`, r), this.map.listImages(), console.groupEnd(), console.log(`地图构建全部完成: ${e.id}`);
|
|
14413
14739
|
} catch (t) {
|
|
14414
14740
|
console.error(`地图初始化失败: ${e.id}`, t), t instanceof Error && console.error(`错误详情: ${t.message}`);
|
|
14415
14741
|
}
|
|
@@ -14429,16 +14755,16 @@ var zi = 20037508.34, Bi = (e, t) => [e / zi * 180, Math.atan(Math.exp(t / zi *
|
|
|
14429
14755
|
source: r,
|
|
14430
14756
|
layers: i
|
|
14431
14757
|
};
|
|
14432
|
-
this.initMap(a), this.ctcTool = new Q.ctc(this), this.ctcMenu = new Q.ctcMenu(this), this.ctcHoverTool = new Q.ctcHover(this);
|
|
14758
|
+
this.initMap(a), this.ctcTool = new Q.ctc(this), this.ctcMenu = new Q.ctcMenu(this), this.ctcHoverTool = new Q.ctcHover(this), this.sgfhqyTool = new Q.sgfhqy(this), this.doorTool = new Q.door(this);
|
|
14433
14759
|
}
|
|
14434
14760
|
createCTCEncryptedMap(e, t, n) {
|
|
14435
|
-
|
|
14761
|
+
Bi(this), this.mapConfigs = $.ctc(e, t, n);
|
|
14436
14762
|
let r = x.graph(this.mapConfigs.sourceUrl), i = E.ctc(this.mapConfigs), a = {
|
|
14437
14763
|
id: this.mapConfigs.id,
|
|
14438
14764
|
source: r,
|
|
14439
14765
|
layers: i
|
|
14440
14766
|
};
|
|
14441
|
-
this.initMap(a), this.ctcTool = new Q.ctc(this), this.ctcMenu = new Q.ctcMenu(this), this.ctcHoverTool = new Q.ctcHover(this);
|
|
14767
|
+
this.initMap(a), this.ctcTool = new Q.ctc(this), this.ctcMenu = new Q.ctcMenu(this), this.ctcHoverTool = new Q.ctcHover(this), this.sgfhqyTool = new Q.sgfhqy(this), this.doorTool = new Q.door(this);
|
|
14442
14768
|
}
|
|
14443
14769
|
createRSWPMap(e) {
|
|
14444
14770
|
let t = $.rswp(e), n = x.raster(t.sourceUrl), r = E.raster(t.id), i = $.geojson("rswp-geojson"), a = x.geojson(), o = {
|
|
@@ -14460,7 +14786,7 @@ var zi = 20037508.34, Bi = (e, t) => [e / zi * 180, Math.atan(Math.exp(t / zi *
|
|
|
14460
14786
|
this.initMap(a), Q.graph(this);
|
|
14461
14787
|
}
|
|
14462
14788
|
createGraphEncryptedMap(e, t, n) {
|
|
14463
|
-
|
|
14789
|
+
Bi(this), this.mapConfigs = $.graph(e, t, n);
|
|
14464
14790
|
let r = x.graph(this.mapConfigs.sourceUrl), i = E.ctc(this.mapConfigs), a = {
|
|
14465
14791
|
id: this.mapConfigs.id,
|
|
14466
14792
|
source: r,
|
|
@@ -14478,7 +14804,7 @@ var zi = 20037508.34, Bi = (e, t) => [e / zi * 180, Math.atan(Math.exp(t / zi *
|
|
|
14478
14804
|
this.initMap(a);
|
|
14479
14805
|
}
|
|
14480
14806
|
createGeomEncryptedMap(e, t, n) {
|
|
14481
|
-
|
|
14807
|
+
Bi(this), this.mapConfigs = $.geom(e, t, n);
|
|
14482
14808
|
let r = x.geom(this.mapConfigs.sourceUrl), i = E.geom(this.mapConfigs), a = {
|
|
14483
14809
|
id: this.mapConfigs.id,
|
|
14484
14810
|
source: r,
|
|
@@ -14493,7 +14819,7 @@ var zi = 20037508.34, Bi = (e, t) => [e / zi * 180, Math.atan(Math.exp(t / zi *
|
|
|
14493
14819
|
let n = r[t], i = e.name;
|
|
14494
14820
|
if (this.map.getSource(n)) return;
|
|
14495
14821
|
let a = e.data, o;
|
|
14496
|
-
return typeof a == "string" ? (o =
|
|
14822
|
+
return typeof a == "string" ? (o = Gi(await (await fetch(a)).json()), Ki(i, o)) : (o = Gi(a), Ki(i, o)), this.layerFeaturesCache.set(i, o.features), x.geojson(o);
|
|
14497
14823
|
})), a = {
|
|
14498
14824
|
id: this.mapConfigs.id,
|
|
14499
14825
|
source: i,
|
|
@@ -14502,7 +14828,7 @@ var zi = 20037508.34, Bi = (e, t) => [e / zi * 180, Math.atan(Math.exp(t / zi *
|
|
|
14502
14828
|
this.initMap(a);
|
|
14503
14829
|
let o = e.find((e) => e.name === "track")?.data;
|
|
14504
14830
|
if (o) {
|
|
14505
|
-
let e = t(
|
|
14831
|
+
let e = t(Gi(o));
|
|
14506
14832
|
this.map.fitBounds([[e[0], e[1]], [e[2], e[3]]], {
|
|
14507
14833
|
padding: 100,
|
|
14508
14834
|
maxZoom: 15
|
|
@@ -14520,7 +14846,7 @@ var zi = 20037508.34, Bi = (e, t) => [e / zi * 180, Math.atan(Math.exp(t / zi *
|
|
|
14520
14846
|
this.initMap(r);
|
|
14521
14847
|
}
|
|
14522
14848
|
createEncryptedRasterMap(e) {
|
|
14523
|
-
|
|
14849
|
+
Bi(this), this.mapConfigs = $.raster(e);
|
|
14524
14850
|
let t = x.raster(this.mapConfigs.sourceUrl), n = E.raster(this.mapConfigs.id), r = {
|
|
14525
14851
|
id: this.mapConfigs.id,
|
|
14526
14852
|
source: t,
|
|
@@ -14535,7 +14861,7 @@ var zi = 20037508.34, Bi = (e, t) => [e / zi * 180, Math.atan(Math.exp(t / zi *
|
|
|
14535
14861
|
"bumper",
|
|
14536
14862
|
"prevention"
|
|
14537
14863
|
];
|
|
14538
|
-
|
|
14864
|
+
Bi(this), this.mapConfigs = $.rage(e, t, n, r);
|
|
14539
14865
|
let i = x.geom(this.mapConfigs.sourceUrl), a = x.raster(this.mapConfigs.subSourceUrl), o = E.geom(this.mapConfigs), s = [...E.raster(this.mapConfigs.subSourceId), ...o], c = {
|
|
14540
14866
|
id: this.mapConfigs.id,
|
|
14541
14867
|
source: i,
|
|
@@ -14592,9 +14918,9 @@ var zi = 20037508.34, Bi = (e, t) => [e / zi * 180, Math.atan(Math.exp(t / zi *
|
|
|
14592
14918
|
getFeatureState(e) {
|
|
14593
14919
|
if (this.stashFeatures.get(e)) return this.stashFeatures.get(e);
|
|
14594
14920
|
}
|
|
14595
|
-
locateGeojsonFeature(e) {
|
|
14596
|
-
let
|
|
14597
|
-
this.map.fitBounds([[
|
|
14921
|
+
locateGeojsonFeature(e, n = !0) {
|
|
14922
|
+
let r = t(n ? Gi(e) : e);
|
|
14923
|
+
this.map.fitBounds([[r[0], r[1]], [r[2], r[3]]], {
|
|
14598
14924
|
padding: 50,
|
|
14599
14925
|
maxZoom: 18
|
|
14600
14926
|
});
|
|
@@ -14602,7 +14928,10 @@ var zi = 20037508.34, Bi = (e, t) => [e / zi * 180, Math.atan(Math.exp(t / zi *
|
|
|
14602
14928
|
queryGeojsonFeatures(e) {
|
|
14603
14929
|
return this.layerFeaturesCache.get(e) ?? [];
|
|
14604
14930
|
}
|
|
14605
|
-
|
|
14606
|
-
|
|
14931
|
+
getTrackCircuitFeaturesByCodes(e) {
|
|
14932
|
+
return this.layerFeaturesCache.get("track_circuit")?.filter((t) => e.includes(t.properties.code)) ?? [];
|
|
14933
|
+
}
|
|
14934
|
+
}, Ji = document.createElement("style");
|
|
14935
|
+
Ji.textContent = "\n .maplibregl-ctrl-attrib.maplibregl-compact {\n display: none !important;\n }\n", document.head.appendChild(Ji);
|
|
14607
14936
|
//#endregion
|
|
14608
|
-
export {
|
|
14937
|
+
export { qi as TeeeMap };
|