gisviewer-vue3-arcgis 1.0.189 → 1.0.190
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/es/src/gis-map/gis-map.vue.d.ts +4 -0
- package/es/src/gis-map/gis-map.vue.mjs +45 -44
- package/es/src/gis-map/index.d.ts +4 -0
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +1 -0
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +18 -10
- package/es/src/types/index.d.ts +1 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +4 -0
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +4 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/lib/src/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -129,6 +129,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
129
129
|
status: number;
|
|
130
130
|
message: string;
|
|
131
131
|
};
|
|
132
|
+
stopEditSubSignalControlArea: () => void | {
|
|
133
|
+
status: number;
|
|
134
|
+
message: string;
|
|
135
|
+
};
|
|
132
136
|
selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
133
137
|
unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
134
138
|
props: any;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import b, { registerStore as
|
|
1
|
+
import { defineComponent as Ne, ref as k, reactive as ze, onMounted as Ee, getCurrentInstance as Qe, onUnmounted as je, computed as Ze, openBlock as h, createElementBlock as A, createElementVNode as g, withDirectives as $e, vShow as qe, Fragment as Ke, renderList as Ue, createBlock as Ge } from "vue";
|
|
2
|
+
import b, { registerStore as Je } from "./stores/index.mjs";
|
|
3
3
|
import "./style/index.css";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import Re from "./utils/holo-flow/index.mjs";
|
|
5
|
+
import We from "./utils/holo-flow/signal-countdown-panel.vue.mjs";
|
|
6
|
+
import Xe from "./utils/map-initializer.mjs";
|
|
7
7
|
import D from "./utils/open-drive-renderer/index.mjs";
|
|
8
8
|
import L from "./utils/overlay.mjs";
|
|
9
|
-
import
|
|
9
|
+
import Ye from "./utils/queue-length.mjs";
|
|
10
10
|
import T from "./utils/road-config-tool/index.mjs";
|
|
11
11
|
import I from "./utils/signal-control-area-controller/index.mjs";
|
|
12
|
-
import
|
|
13
|
-
const
|
|
12
|
+
import Fe from "./utils/traffic-flow.mjs";
|
|
13
|
+
const et = { class: "gis-viewer" }, tt = { style: { position: "absolute", bottom: "80px", left: "10px", "z-index": "9999" } }, dt = /* @__PURE__ */ Ne({
|
|
14
14
|
__name: "gis-map",
|
|
15
15
|
props: {
|
|
16
16
|
config: {},
|
|
@@ -20,39 +20,39 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
20
20
|
setup(M, { expose: _, emit: x }) {
|
|
21
21
|
const d = k(null);
|
|
22
22
|
let o, l, c, s, n, r, p, t, a;
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const H = b.useAppDataStore, v =
|
|
26
|
-
|
|
23
|
+
const S = k(!1);
|
|
24
|
+
Je();
|
|
25
|
+
const H = b.useAppDataStore, v = ze([]);
|
|
26
|
+
Ee(async () => {
|
|
27
27
|
if (!d.value)
|
|
28
28
|
return;
|
|
29
29
|
document.addEventListener("keydown", (m) => {
|
|
30
|
-
m.ctrlKey && m.key === "i" && (
|
|
30
|
+
m.ctrlKey && m.key === "i" && (S.value = !S.value);
|
|
31
31
|
});
|
|
32
32
|
const e = Qe(), { $gisviewerAssetsRoot: u } = e.appContext.config.globalProperties, i = await (await fetch(O.config)).json();
|
|
33
|
-
i.assetsRoot = O.assetsRoot || u, H.mapConfig = i, l = new
|
|
33
|
+
i.assetsRoot = O.assetsRoot || u, H.mapConfig = i, l = new Xe(), o = await l.initialize({
|
|
34
34
|
container: d.value,
|
|
35
35
|
mapConfig: i,
|
|
36
|
-
markerClickCallback: (m,
|
|
37
|
-
y("markerClick", m,
|
|
36
|
+
markerClickCallback: (m, C, w, Be) => {
|
|
37
|
+
y("markerClick", m, C, w, Be);
|
|
38
38
|
},
|
|
39
|
-
mapClickCallback: (m,
|
|
40
|
-
y("mapClick", m,
|
|
39
|
+
mapClickCallback: (m, C, w) => {
|
|
40
|
+
y("mapClick", m, C, w);
|
|
41
41
|
}
|
|
42
|
-
}), n = new
|
|
42
|
+
}), n = new Re(o, v), await n.init(), y("mapLoaded");
|
|
43
43
|
}), je(() => {
|
|
44
44
|
a == null || a.clearSignalControlArea(), t == null || t.clearOpenDrive(), n.clearHoloTrace(), n.clearHoloSignal(), s == null || s.disconnectTrafficFlow();
|
|
45
45
|
});
|
|
46
|
-
const P =
|
|
46
|
+
const P = Ze(() => o), V = () => {
|
|
47
47
|
const e = b.useAppDataStore;
|
|
48
48
|
e.saveTrackLog = !0;
|
|
49
49
|
}, B = () => {
|
|
50
50
|
n.downloadTrackLog();
|
|
51
51
|
}, N = () => {
|
|
52
|
-
|
|
52
|
+
f("vehicleId");
|
|
53
53
|
}, z = () => {
|
|
54
|
-
|
|
55
|
-
},
|
|
54
|
+
f("plateNumber");
|
|
55
|
+
}, E = async (e) => await l.setMapCenter(e), Q = async (e) => await l.setMapCamera(e), j = async (e) => await l.lookAt(e), Z = (e) => l.setLayerVisibility(e), $ = (e, u) => l.requestCoordinateTransform(e, u), q = (e) => {
|
|
56
56
|
l.cancelCoordinateTransform(e);
|
|
57
57
|
}, K = (e) => {
|
|
58
58
|
l.setMapZoomRange(e);
|
|
@@ -60,7 +60,7 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
60
60
|
c == null || c.clearLaneNumber();
|
|
61
61
|
}, J = async (e) => (c || (c = new T(o)), await c.initializeSearch(e)), R = async () => c == null ? void 0 : c.calCrossIndicatorArea(), W = async () => {
|
|
62
62
|
}, X = async (e, u) => {
|
|
63
|
-
s || (s = new
|
|
63
|
+
s || (s = new Fe(o)), s.connectTrafficFlow(e, u);
|
|
64
64
|
}, Y = () => {
|
|
65
65
|
s == null || s.disconnectTrafficFlow();
|
|
66
66
|
}, F = async (e) => {
|
|
@@ -79,17 +79,17 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
79
79
|
n == null || n.togglePause(e);
|
|
80
80
|
}, oe = (e) => {
|
|
81
81
|
s == null || s.toggleTrafficObject(e), n == null || n.toggleTrafficObject(e);
|
|
82
|
-
},
|
|
82
|
+
}, f = (e) => {
|
|
83
83
|
n == null || n.updatePanelContent(e);
|
|
84
84
|
}, ie = async (e) => (r || (r = new L(o)), r.addOverlays(e)), ce = (e) => (r || (r = new L(o)), r.addMask(e)), le = () => {
|
|
85
85
|
r == null || r.removeMask();
|
|
86
86
|
}, ue = (e) => r == null ? void 0 : r.removeOverlaysByType(e), me = (e) => r == null ? void 0 : r.removeOverlaysById(e), pe = () => r == null ? void 0 : r.removeAllOverlays(), ge = () => {
|
|
87
87
|
r == null || r.showAllOverlays();
|
|
88
88
|
}, de = (e) => {
|
|
89
|
-
p || (p = new
|
|
90
|
-
},
|
|
89
|
+
p || (p = new Ye(o)), p.updateQueueLength(e);
|
|
90
|
+
}, Se = () => {
|
|
91
91
|
p == null || p.removeQueueLength();
|
|
92
|
-
},
|
|
92
|
+
}, fe = async (e, u) => (t || (t = new D(o)), await t.showOpenDriveFromServer(e, u)), ye = async (e) => (t || (t = new D(o)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), Ce = async () => await (t == null ? void 0 : t.clearOpenDrive()), we = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
|
|
93
93
|
status: -1,
|
|
94
94
|
message: "未加载OpenDrive地图"
|
|
95
95
|
}, he = async (e) => t ? t.selectSumo(e) : {
|
|
@@ -112,13 +112,13 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
112
112
|
message: "未加载OpenDrive地图"
|
|
113
113
|
}, De = (e) => (a || (a = new I(o)), a.showSignalControlArea(e)), Le = () => {
|
|
114
114
|
a == null || a.clearSignalControlArea();
|
|
115
|
-
}, Te = async (e) => a ? await a.locateSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Ie = async (e) => a ? await a.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Me = () => a ? a.resetHighlight() : { status: -1, message: "未加载信号控制区" }, _e = (e) => (a || (a = new I(o)), a.showSubSignalControlArea(e)), xe = (e) => a ? a.editSubSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, He = (e) => a ? a.selectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" },
|
|
115
|
+
}, Te = async (e) => a ? await a.locateSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Ie = async (e) => a ? await a.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Me = () => a ? a.resetHighlight() : { status: -1, message: "未加载信号控制区" }, _e = (e) => (a || (a = new I(o)), a.showSubSignalControlArea(e)), xe = (e) => a ? a.editSubSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, He = () => a ? a.stopEditSubSignalControlArea() : { status: -1, message: "未加载信号控制区" }, Pe = (e) => a ? a.selectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, Ve = (e) => a ? a.unselectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, O = M, y = x;
|
|
116
116
|
return _({
|
|
117
117
|
mapViewer: P,
|
|
118
118
|
setLayerVisibility: Z,
|
|
119
|
-
setMapCenter:
|
|
120
|
-
lookAt:
|
|
121
|
-
setMapCamera:
|
|
119
|
+
setMapCenter: E,
|
|
120
|
+
lookAt: j,
|
|
121
|
+
setMapCamera: Q,
|
|
122
122
|
setMapZoomRange: K,
|
|
123
123
|
requestCoordinateTransform: $,
|
|
124
124
|
cancelCoordinateTransform: q,
|
|
@@ -143,15 +143,15 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
143
143
|
setInterpolate: te,
|
|
144
144
|
toggleTrafficInfo: re,
|
|
145
145
|
toggleTrafficObject: oe,
|
|
146
|
-
toggleVehicleInfo:
|
|
146
|
+
toggleVehicleInfo: f,
|
|
147
147
|
togglePause: se,
|
|
148
148
|
updateQueueLength: de,
|
|
149
|
-
removeQueueLength:
|
|
150
|
-
showOpenDriveFromServer:
|
|
149
|
+
removeQueueLength: Se,
|
|
150
|
+
showOpenDriveFromServer: fe,
|
|
151
151
|
showOpenDriveFromFile: ye,
|
|
152
|
-
clearOpenDrive:
|
|
152
|
+
clearOpenDrive: Ce,
|
|
153
153
|
geometrySearchInOpenDrive: Oe,
|
|
154
|
-
findSumoInOpenDrive:
|
|
154
|
+
findSumoInOpenDrive: we,
|
|
155
155
|
selectSumoInOpenDrive: he,
|
|
156
156
|
unselectSumoInOpenDrive: ve,
|
|
157
157
|
getSumoInfo: ke,
|
|
@@ -164,15 +164,16 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
164
164
|
resetHighlightSignalControlArea: Me,
|
|
165
165
|
showSubSignalControlArea: _e,
|
|
166
166
|
editSubSignalControlArea: xe,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
stopEditSubSignalControlArea: He,
|
|
168
|
+
selectSubSignalControlAreaCross: Pe,
|
|
169
|
+
unselectSubSignalControlAreaCross: Ve
|
|
170
|
+
}), (e, u) => (h(), A("div", et, [
|
|
170
171
|
g("div", {
|
|
171
172
|
class: "gis-viewer-main",
|
|
172
173
|
ref_key: "mapContainer",
|
|
173
174
|
ref: d
|
|
174
175
|
}, [
|
|
175
|
-
|
|
176
|
+
$e(g("div", tt, [
|
|
176
177
|
g("button", {
|
|
177
178
|
style: { "margin-right": "10px" },
|
|
178
179
|
onClick: V
|
|
@@ -187,10 +188,10 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
187
188
|
}, " 显示车辆id "),
|
|
188
189
|
g("button", { onClick: z }, "显示车辆号牌")
|
|
189
190
|
], 512), [
|
|
190
|
-
[
|
|
191
|
+
[qe, S.value]
|
|
191
192
|
])
|
|
192
193
|
], 512),
|
|
193
|
-
(h(!0), A(
|
|
194
|
+
(h(!0), A(Ke, null, Ue(v, (i, m) => (h(), Ge(We, {
|
|
194
195
|
key: m,
|
|
195
196
|
"display-mode": i.displayMode,
|
|
196
197
|
"road-id": i.crossId,
|
|
@@ -206,5 +207,5 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
206
207
|
}
|
|
207
208
|
});
|
|
208
209
|
export {
|
|
209
|
-
|
|
210
|
+
dt as default
|
|
210
211
|
};
|
|
@@ -118,6 +118,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
118
118
|
status: number;
|
|
119
119
|
message: string;
|
|
120
120
|
};
|
|
121
|
+
stopEditSubSignalControlArea: () => void | {
|
|
122
|
+
status: number;
|
|
123
|
+
message: string;
|
|
124
|
+
};
|
|
121
125
|
selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
122
126
|
unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
123
127
|
props: any;
|
|
@@ -2,7 +2,7 @@ import * as p from "@arcgis/core/core/reactiveUtils.js";
|
|
|
2
2
|
import n from "@arcgis/core/Graphic";
|
|
3
3
|
import y from "@arcgis/core/layers/GraphicsLayer";
|
|
4
4
|
import d from "@turf/buffer";
|
|
5
|
-
import
|
|
5
|
+
import u from "@turf/convex";
|
|
6
6
|
import * as a from "@turf/helpers";
|
|
7
7
|
import b from "axios";
|
|
8
8
|
import f from "concaveman";
|
|
@@ -183,7 +183,7 @@ class P {
|
|
|
183
183
|
(c) => c.getAttribute("id") === o
|
|
184
184
|
))
|
|
185
185
|
continue;
|
|
186
|
-
const
|
|
186
|
+
const g = new n({
|
|
187
187
|
geometry: {
|
|
188
188
|
type: "point",
|
|
189
189
|
x: s.lon,
|
|
@@ -197,7 +197,7 @@ class P {
|
|
|
197
197
|
selected: !1
|
|
198
198
|
}
|
|
199
199
|
});
|
|
200
|
-
i.push(
|
|
200
|
+
i.push(g);
|
|
201
201
|
}
|
|
202
202
|
return this.crossLayer.addMany(i), { status: 0, message: "ok" };
|
|
203
203
|
} else
|
|
@@ -210,11 +210,11 @@ class P {
|
|
|
210
210
|
* @returns
|
|
211
211
|
*/
|
|
212
212
|
async editSubSignalControlArea(e) {
|
|
213
|
-
if (
|
|
214
|
-
this.crossIdsInDistrict = e.crossesInArea.map((s) => s.id);
|
|
213
|
+
if (e.odrServer) {
|
|
214
|
+
this.openDriveServer = e.odrServer, this.crossIdsInDistrict = e.crossesInArea.map((s) => s.id);
|
|
215
215
|
const t = a.featureCollection(
|
|
216
216
|
e.crossesInArea.map((s) => a.point([s.x, s.y]))
|
|
217
|
-
), r =
|
|
217
|
+
), r = u(t);
|
|
218
218
|
r && (this.districtControllerLayer.removeAll(), this.districtControllerLayer.add(
|
|
219
219
|
new n({
|
|
220
220
|
geometry: {
|
|
@@ -239,6 +239,14 @@ class P {
|
|
|
239
239
|
} else
|
|
240
240
|
return { status: 1, message: "未配置OpenDriveServer" };
|
|
241
241
|
}
|
|
242
|
+
stopEditSubSignalControlArea() {
|
|
243
|
+
var t;
|
|
244
|
+
(t = this.clickWatcher) == null || t.remove(), this.clickWatcher = void 0;
|
|
245
|
+
const e = this.crossLayer.graphics.filter(
|
|
246
|
+
(r) => r.getAttribute("signalId") === "" || !r.getAttribute("signalId") || !r.getAttribute("selected")
|
|
247
|
+
);
|
|
248
|
+
this.crossLayer.removeMany(e.toArray());
|
|
249
|
+
}
|
|
242
250
|
/**
|
|
243
251
|
* 从外部接口选中一个路口
|
|
244
252
|
* @param id
|
|
@@ -291,9 +299,9 @@ class P {
|
|
|
291
299
|
else {
|
|
292
300
|
if (t) {
|
|
293
301
|
const h = a.featureCollection(
|
|
294
|
-
r.map((
|
|
302
|
+
r.map((m) => a.point(m))
|
|
295
303
|
);
|
|
296
|
-
s =
|
|
304
|
+
s = u(h);
|
|
297
305
|
} else {
|
|
298
306
|
const h = f(r, 0.5);
|
|
299
307
|
h.length >= 4 && (s = a.polygon([h]));
|
|
@@ -332,7 +340,7 @@ class P {
|
|
|
332
340
|
label: "路口数量"
|
|
333
341
|
}
|
|
334
342
|
];
|
|
335
|
-
const
|
|
343
|
+
const g = {
|
|
336
344
|
type: "signalControlArea",
|
|
337
345
|
id: e.id,
|
|
338
346
|
name: e.name,
|
|
@@ -355,7 +363,7 @@ class P {
|
|
|
355
363
|
style: t ? "long-dash" : "solid"
|
|
356
364
|
}
|
|
357
365
|
},
|
|
358
|
-
attributes:
|
|
366
|
+
attributes: g,
|
|
359
367
|
popupTemplate: {
|
|
360
368
|
title: `${t ? "区控" : "子区"} ${e.name}`,
|
|
361
369
|
content: [
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -129,6 +129,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
129
129
|
status: number;
|
|
130
130
|
message: string;
|
|
131
131
|
};
|
|
132
|
+
stopEditSubSignalControlArea: () => void | {
|
|
133
|
+
status: number;
|
|
134
|
+
message: string;
|
|
135
|
+
};
|
|
132
136
|
selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
133
137
|
unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
134
138
|
props: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),C=require("./stores/index.js");require("./style/index.css");const Ve=require("./utils/holo-flow/index.js"),Ne=require("./utils/holo-flow/signal-countdown-panel.vue.js"),Ee=require("./utils/map-initializer.js"),O=require("./utils/open-drive-renderer/index.js"),b=require("./utils/overlay.js"),Be=require("./utils/queue-length.js"),A=require("./utils/road-config-tool/index.js"),L=require("./utils/signal-control-area-controller/index.js"),He=require("./utils/traffic-flow.js"),Pe={class:"gis-viewer"},ze={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},je=n.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(D,{expose:T,emit:_}){const p=n.ref(null);let i,u,l,o,r,s,g,t,a;const f=n.ref(!1);C.registerStore();const I=C.default.useAppDataStore,h=n.reactive([]);n.onMounted(async()=>{if(!p.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(f.value=!f.value)});const e=n.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(k.config)).json();c.assetsRoot=k.assetsRoot||d,I.mapConfig=c,u=new Ee.default,i=await u.initialize({container:p.value,mapConfig:c,markerClickCallback:(m,v,w,Me)=>{y("markerClick",m,v,w,Me)},mapClickCallback:(m,v,w)=>{y("mapClick",m,v,w)}}),r=new Ve.default(i,h),await r.init(),y("mapLoaded")}),n.onUnmounted(()=>{a==null||a.clearSignalControlArea(),t==null||t.clearOpenDrive(),r.clearHoloTrace(),r.clearHoloSignal(),o==null||o.disconnectTrafficFlow()});const x=n.computed(()=>i),q=()=>{const e=C.default.useAppDataStore;e.saveTrackLog=!0},M=()=>{r.downloadTrackLog()},V=()=>{S("vehicleId")},N=()=>{S("plateNumber")},E=async e=>await u.setMapCenter(e),B=async e=>await u.setMapCamera(e),H=async e=>await u.lookAt(e),P=e=>u.setLayerVisibility(e),z=(e,d)=>u.requestCoordinateTransform(e,d),j=e=>{u.cancelCoordinateTransform(e)},Q=e=>{u.setMapZoomRange(e)},Z=e=>(l||(l=new A.default(i)),l.showLaneNumber(e)),K=()=>{l==null||l.clearLaneNumber()},U=async e=>(l||(l=new A.default(i)),await l.initializeSearch(e)),G=async()=>l==null?void 0:l.calCrossIndicatorArea(),J=async()=>{},W=async(e,d)=>{o||(o=new He.default(i)),o.connectTrafficFlow(e,d)},X=()=>{o==null||o.disconnectTrafficFlow()},Y=async e=>{r.handleVehicleTraceData(e)},F=()=>{r.clearHoloTrace()},R=e=>{r.setInterpolate(e)},$=async e=>{await r.handleSignalData(e)},ee=()=>{r.clearHoloSignal()},te=e=>{o==null||o.toggleTrafficInfo(e),r==null||r.toggleTrafficInfo(e)},ae=e=>{r==null||r.togglePause(e)},ne=e=>{o==null||o.toggleTrafficObject(e),r==null||r.toggleTrafficObject(e)},S=e=>{r==null||r.updatePanelContent(e)},re=async e=>(s||(s=new b.default(i)),s.addOverlays(e)),se=e=>(s||(s=new b.default(i)),s.addMask(e)),oe=()=>{s==null||s.removeMask()},ie=e=>s==null?void 0:s.removeOverlaysByType(e),ce=e=>s==null?void 0:s.removeOverlaysById(e),le=()=>s==null?void 0:s.removeAllOverlays(),ue=()=>{s==null||s.showAllOverlays()},de=e=>{g||(g=new Be.default(i)),g.updateQueueLength(e)},me=()=>{g==null||g.removeQueueLength()},ge=async(e,d)=>(t||(t=new O.default(i)),await t.showOpenDriveFromServer(e,d)),pe=async e=>(t||(t=new O.default(i)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),fe=async()=>await(t==null?void 0:t.clearOpenDrive()),Se=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},ye=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ve=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},we=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},Ce=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},he=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},ke=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Oe=e=>(a||(a=new L.default(i)),a.showSignalControlArea(e)),be=()=>{a==null||a.clearSignalControlArea()},Ae=async e=>a?await a.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Le=async e=>a?await a.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},De=()=>a?a.resetHighlight():{status:-1,message:"未加载信号控制区"},Te=e=>(a||(a=new L.default(i)),a.showSubSignalControlArea(e)),_e=e=>a?a.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Ie=()=>a?a.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},xe=e=>a?a.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},qe=e=>a?a.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},k=D,y=_;return T({mapViewer:x,setLayerVisibility:P,setMapCenter:E,lookAt:H,setMapCamera:B,setMapZoomRange:Q,requestCoordinateTransform:z,cancelCoordinateTransform:j,addOverlays:re,addMask:se,removeMask:oe,showAllOverlays:ue,removeOverlaysByType:ie,removeOverlaysById:ce,removeAllOverlays:le,showLaneNumber:Z,clearLaneNumber:K,initializeAreaTool:U,calCrossIndicatorArea:G,calRoadIndicatorArea:J,connectCarFlow:W,disconnectCarFlow:X,handleHoloVehicleTraceData:Y,clearHoloTrace:F,handleHoloSignalData:$,clearHoloSignal:ee,setInterpolate:R,toggleTrafficInfo:te,toggleTrafficObject:ne,toggleVehicleInfo:S,togglePause:ae,updateQueueLength:de,removeQueueLength:me,showOpenDriveFromServer:ge,showOpenDriveFromFile:pe,clearOpenDrive:fe,geometrySearchInOpenDrive:we,findSumoInOpenDrive:Se,selectSumoInOpenDrive:ye,unselectSumoInOpenDrive:ve,getSumoInfo:Ce,splitOpenDriveLane:he,clearSplitOpenDriveLane:ke,showSignalControlArea:Oe,clearSignalControlArea:be,locateSignalControlArea:Ae,highlightSignalControlArea:Le,resetHighlightSignalControlArea:De,showSubSignalControlArea:Te,editSubSignalControlArea:_e,stopEditSubSignalControlArea:Ie,selectSubSignalControlAreaCross:xe,unselectSubSignalControlAreaCross:qe}),(e,d)=>(n.openBlock(),n.createElementBlock("div",Pe,[n.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:p},[n.withDirectives(n.createElementVNode("div",ze,[n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:q}," 开始记录 "),n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:M}," 下载日志 "),n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:V}," 显示车辆id "),n.createElementVNode("button",{onClick:N},"显示车辆号牌")],512),[[n.vShow,f.value]])],512),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h,(c,m)=>(n.openBlock(),n.createBlock(Ne.default,{key:m,"display-mode":c.displayMode,"road-id":c.crossId,"cross-id":c.roadId,"map-point":c.mapPoint,"stop-line":c.stopLine,position:c.position,rotation:c.rotation,scale:c.scale,"lamp-status":c.lampStatus},null,8,["display-mode","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=je;
|
|
@@ -118,6 +118,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
118
118
|
status: number;
|
|
119
119
|
message: string;
|
|
120
120
|
};
|
|
121
|
+
stopEditSubSignalControlArea: () => void | {
|
|
122
|
+
status: number;
|
|
123
|
+
message: string;
|
|
124
|
+
};
|
|
121
125
|
selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
122
126
|
unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
123
127
|
props: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),c=require("@arcgis/core/Graphic"),y=require("@arcgis/core/layers/GraphicsLayer"),f=require("@turf/buffer"),m=require("@turf/convex"),C=require("@turf/helpers"),v=require("axios"),S=require("concaveman"),I=require("../../stores/index.js"),A=require("./district-controller.js");function d(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const L=d(b),o=d(C);class w{constructor(e){var i;this.crossScale=5e3,this.crossIdsInDistrict=[],this.view=e;const r=I.default.useAppDataStore.mapConfig;this.openDriveServer=(i=r.openDriveServer)==null?void 0:i.url,this.districtControllerLayer=new y({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new y({id:"subDistrictControllerLayer",visible:!1}),this.crossLayer=new y({id:"crossLayer",visible:!1}),this.highlightLayer=new y({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1,this.districtControllerLayer.visible=!0;for(const t of e.areaList){const r=new A.default(t,e.style||"");this.drawArea(r,!0)}return this.scaleWatcher=L.watch(()=>this.view.scale,(t,r)=>{t>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(i=>{i.symbol=this.getCrossGraphicSymbol(i.attributes,"marker")}),this.highlightLayer.graphics.forEach(i=>{i.getAttribute("type")==="cross"&&(i.symbol=this.getCrossGraphicSymbol(i.attributes,"marker"))})):t<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(i=>{i.symbol=this.getCrossGraphicSymbol(i.attributes,"picture")}),this.highlightLayer.graphics.forEach(i=>{i.getAttribute("type")==="cross"&&(i.symbol=this.getCrossGraphicSymbol(i.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var e,t;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.scaleWatcher)==null||e.remove(),this.scaleWatcher=void 0,(t=this.clickWatcher)==null||t.remove(),this.clickWatcher=void 0,this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}async highlightSignalControlArea(e){if(!e.id||e.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(s=>s.getAttribute("id")===e.id).toArray().map(s=>{const a=s.clone();return a.symbol.style="none",a}),r=this.subDistrictControllerLayer.graphics.filter(s=>s.getAttribute("id")===e.id||s.getAttribute("parentId")===e.id).toArray().map(s=>s.clone()),i=this.crossLayer.graphics.filter(s=>s.getAttribute("id")===e.id||s.getAttribute("districtId")===e.id||s.getAttribute("subDistrictId")===e.id).toArray().map(s=>s.clone());if(t.length>0&&this.highlightLayer.addMany(t),r.length>0&&this.highlightLayer.addMany(r),i.length>0&&this.highlightLayer.addMany(i),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(t.length>0)await this.view.goTo(t);else if(r.length>0){const s=r[0].geometry.centroid;await this.view.goTo({target:s,scale:this.crossScale-500})}else i.length>1?await this.view.goTo(i):await this.view.goTo({target:i[0].geometry,scale:1500});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,{status:0,message:"ok"}}showSubSignalControlArea(e){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const r=e.children.map(i=>{const s={...i,selected:!0};return new c({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossSymbolInSubDistrict(s),attributes:s})});return this.crossLayer.addMany(r),this.view.goTo(r),{status:0,message:"ok"}}async handleViewClick(e){var s;const r=(s=(await this.view.hitTest(e,{include:[this.crossLayer]})).results)==null?void 0:s.filter(a=>a.type==="graphic");if(r.length===0)return;const i=r[0].graphic;i.getAttribute("selected")?i.getAttribute("signalId")&&(this.removeCrossCallback&&this.removeCrossCallback({id:i.getAttribute("id")}),i.setAttribute("selected",!1),i.symbol=this.getCrossSymbolInSubDistrict(i.attributes)):(i.getAttribute("signalId")&&(this.addCrossCallback&&this.addCrossCallback({id:i.getAttribute("id"),name:i.getAttribute("name")}),i.setAttribute("selected",!0),i.symbol=this.getCrossSymbolInSubDistrict(i.attributes)),await this.showNearbyCrosses(i.getAttribute("id")))}async showNearbyCrosses(e){const t=await v.get(`http://${this.openDriveServer}/api/computable/getRelatedJunctionsForJunction`,{params:{junctionIds:e}});if(t.status===200)if(t.data.status===0){const r=t.data.result,i=[];for(const s of r){const a=s.junctionId;if(a.startsWith("-"))continue;if(s.signalId&&!this.crossIdsInDistrict.includes(a)){console.log("不是此区控内的路口",a);continue}if(this.crossLayer.graphics.some(h=>h.getAttribute("id")===a))continue;const g=new c({geometry:{type:"point",x:s.lon,y:s.lat},symbol:this.getCrossSymbolInSubDistrict(s),attributes:{id:a,name:s.name,signalId:s.signalId,selected:!1}});i.push(g)}return this.crossLayer.addMany(i),{status:0,message:"ok"}}else return{status:-1,message:t.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalControlArea(e){if(this.openDriveServer){this.crossIdsInDistrict=e.crossesInArea.map(s=>s.id);const t=o.featureCollection(e.crossesInArea.map(s=>o.point([s.x,s.y]))),r=m(t);r&&(this.districtControllerLayer.removeAll(),this.districtControllerLayer.add(new c({geometry:{type:"polygon",rings:r.geometry.coordinates},symbol:{type:"simple-fill",style:"none",outline:{color:[61,139,249],width:3,style:"long-dash"}}}))),this.addCrossCallback=e.addCrossCallback,this.removeCrossCallback=e.removeCrossCallback,this.clickWatcher||(this.clickWatcher=this.view.on("click",async s=>{await this.handleViewClick(s)}));const i=this.crossLayer.graphics.toArray().map(s=>s.getAttribute("id")).join(",");return await this.showNearbyCrosses(i)}else return{status:1,message:"未配置OpenDriveServer"}}selectSubSignalControlAreaCross(e){return this.crossLayer.graphics.forEach(t=>{if(t.getAttribute("id")===e&&!t.getAttribute("selected"))return t.setAttribute("selected",!0),t.symbol=this.getCrossSymbolInSubDistrict(t.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}unselectSubSignalControlAreaCross(e){return this.crossLayer.graphics.forEach(t=>{if(t.getAttribute("id")===e&&t.getAttribute("selected"))return t.setAttribute("selected",!1),t.symbol=this.getCrossSymbolInSubDistrict(t.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e)),t}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>=2){let s=null;if(r.length===2)s=o.lineString(r);else{if(t){const u=o.featureCollection(r.map(p=>o.point(p)));s=m(u)}else{const u=S(r,.5);u.length>=4&&(s=o.polygon([u]))}s||(s=o.lineString(r))}const a=f(s.geometry,t?200:30,{units:"meters"});let n;t?n=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:n=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const g={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},h=new c({geometry:{type:"polygon",rings:a.geometry.coordinates},symbol:{type:"simple-fill",style:"none",color:[...e.areaColor,.3],outline:{color:e.areaColor,width:3,style:t?"long-dash":"solid"}},attributes:g,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:n}]}});t?this.districtControllerLayer.add(h):this.subDistrictControllerLayer.add(h)}for(const s of e.subDistricts)this.drawArea(s,!1);const i=[];e.crosses.forEach(s=>{const a={type:"cross",id:s.id,name:s.name,color:e.areaColor,signalId:s.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:s.isKey},n=new c({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossGraphicSymbol(a,"marker"),attributes:a,popupTemplate:{title:s.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});i.push(n)}),this.crossLayer.addMany(i)}getCrossSymbolInSubDistrict(e){return e.signalId&&e.signalId!==""?{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${e.selected?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz.png",width:"20px",height:"20px"}}getCrossGraphicSymbol(e,t){const{isKey:r,color:i}=e;if(t==="marker")return r?{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_gjxklk_orange.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:i,size:8,outline:{color:"white",width:1}};if(t==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:r?30:15,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r?40:20,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${r?"gis_gjxklk_orange":"gis_xhj_blue"}.png`}]}}}}}exports.default=w;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),c=require("@arcgis/core/Graphic"),y=require("@arcgis/core/layers/GraphicsLayer"),f=require("@turf/buffer"),m=require("@turf/convex"),C=require("@turf/helpers"),v=require("axios"),S=require("concaveman"),I=require("../../stores/index.js"),A=require("./district-controller.js");function d(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const L=d(b),a=d(C);class w{constructor(e){var r;this.crossScale=5e3,this.crossIdsInDistrict=[],this.view=e;const i=I.default.useAppDataStore.mapConfig;this.openDriveServer=(r=i.openDriveServer)==null?void 0:r.url,this.districtControllerLayer=new y({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new y({id:"subDistrictControllerLayer",visible:!1}),this.crossLayer=new y({id:"crossLayer",visible:!1}),this.highlightLayer=new y({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1,this.districtControllerLayer.visible=!0;for(const t of e.areaList){const i=new A.default(t,e.style||"");this.drawArea(i,!0)}return this.scaleWatcher=L.watch(()=>this.view.scale,(t,i)=>{t>this.crossScale&&i<=this.crossScale?(this.crossLayer.graphics.forEach(r=>{r.symbol=this.getCrossGraphicSymbol(r.attributes,"marker")}),this.highlightLayer.graphics.forEach(r=>{r.getAttribute("type")==="cross"&&(r.symbol=this.getCrossGraphicSymbol(r.attributes,"marker"))})):t<=this.crossScale&&i>this.crossScale&&(this.crossLayer.graphics.forEach(r=>{r.symbol=this.getCrossGraphicSymbol(r.attributes,"picture")}),this.highlightLayer.graphics.forEach(r=>{r.getAttribute("type")==="cross"&&(r.symbol=this.getCrossGraphicSymbol(r.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var e,t;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.scaleWatcher)==null||e.remove(),this.scaleWatcher=void 0,(t=this.clickWatcher)==null||t.remove(),this.clickWatcher=void 0,this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}async highlightSignalControlArea(e){if(!e.id||e.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(s=>s.getAttribute("id")===e.id).toArray().map(s=>{const o=s.clone();return o.symbol.style="none",o}),i=this.subDistrictControllerLayer.graphics.filter(s=>s.getAttribute("id")===e.id||s.getAttribute("parentId")===e.id).toArray().map(s=>s.clone()),r=this.crossLayer.graphics.filter(s=>s.getAttribute("id")===e.id||s.getAttribute("districtId")===e.id||s.getAttribute("subDistrictId")===e.id).toArray().map(s=>s.clone());if(t.length>0&&this.highlightLayer.addMany(t),i.length>0&&this.highlightLayer.addMany(i),r.length>0&&this.highlightLayer.addMany(r),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(t.length>0)await this.view.goTo(t);else if(i.length>0){const s=i[0].geometry.centroid;await this.view.goTo({target:s,scale:this.crossScale-500})}else r.length>1?await this.view.goTo(r):await this.view.goTo({target:r[0].geometry,scale:1500});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,{status:0,message:"ok"}}showSubSignalControlArea(e){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const i=e.children.map(r=>{const s={...r,selected:!0};return new c({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:this.getCrossSymbolInSubDistrict(s),attributes:s})});return this.crossLayer.addMany(i),this.view.goTo(i),{status:0,message:"ok"}}async handleViewClick(e){var s;const i=(s=(await this.view.hitTest(e,{include:[this.crossLayer]})).results)==null?void 0:s.filter(o=>o.type==="graphic");if(i.length===0)return;const r=i[0].graphic;r.getAttribute("selected")?r.getAttribute("signalId")&&(this.removeCrossCallback&&this.removeCrossCallback({id:r.getAttribute("id")}),r.setAttribute("selected",!1),r.symbol=this.getCrossSymbolInSubDistrict(r.attributes)):(r.getAttribute("signalId")&&(this.addCrossCallback&&this.addCrossCallback({id:r.getAttribute("id"),name:r.getAttribute("name")}),r.setAttribute("selected",!0),r.symbol=this.getCrossSymbolInSubDistrict(r.attributes)),await this.showNearbyCrosses(r.getAttribute("id")))}async showNearbyCrosses(e){const t=await v.get(`http://${this.openDriveServer}/api/computable/getRelatedJunctionsForJunction`,{params:{junctionIds:e}});if(t.status===200)if(t.data.status===0){const i=t.data.result,r=[];for(const s of i){const o=s.junctionId;if(o.startsWith("-"))continue;if(s.signalId&&!this.crossIdsInDistrict.includes(o)){console.log("不是此区控内的路口",o);continue}if(this.crossLayer.graphics.some(h=>h.getAttribute("id")===o))continue;const g=new c({geometry:{type:"point",x:s.lon,y:s.lat},symbol:this.getCrossSymbolInSubDistrict(s),attributes:{id:o,name:s.name,signalId:s.signalId,selected:!1}});r.push(g)}return this.crossLayer.addMany(r),{status:0,message:"ok"}}else return{status:-1,message:t.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalControlArea(e){if(e.odrServer){this.openDriveServer=e.odrServer,this.crossIdsInDistrict=e.crossesInArea.map(s=>s.id);const t=a.featureCollection(e.crossesInArea.map(s=>a.point([s.x,s.y]))),i=m(t);i&&(this.districtControllerLayer.removeAll(),this.districtControllerLayer.add(new c({geometry:{type:"polygon",rings:i.geometry.coordinates},symbol:{type:"simple-fill",style:"none",outline:{color:[61,139,249],width:3,style:"long-dash"}}}))),this.addCrossCallback=e.addCrossCallback,this.removeCrossCallback=e.removeCrossCallback,this.clickWatcher||(this.clickWatcher=this.view.on("click",async s=>{await this.handleViewClick(s)}));const r=this.crossLayer.graphics.toArray().map(s=>s.getAttribute("id")).join(",");return await this.showNearbyCrosses(r)}else return{status:1,message:"未配置OpenDriveServer"}}stopEditSubSignalControlArea(){var t;(t=this.clickWatcher)==null||t.remove(),this.clickWatcher=void 0;const e=this.crossLayer.graphics.filter(i=>i.getAttribute("signalId")===""||!i.getAttribute("signalId")||!i.getAttribute("selected"));this.crossLayer.removeMany(e.toArray())}selectSubSignalControlAreaCross(e){return this.crossLayer.graphics.forEach(t=>{if(t.getAttribute("id")===e&&!t.getAttribute("selected"))return t.setAttribute("selected",!0),t.symbol=this.getCrossSymbolInSubDistrict(t.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}unselectSubSignalControlAreaCross(e){return this.crossLayer.graphics.forEach(t=>{if(t.getAttribute("id")===e&&t.getAttribute("selected"))return t.setAttribute("selected",!1),t.symbol=this.getCrossSymbolInSubDistrict(t.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(i=>i.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(i=>i.attributes.id===e)),t||(t=this.crossLayer.graphics.find(i=>i.attributes.id===e)),t}drawArea(e,t){const i=e.getAllCrossCoordinates();if(i.length>=2){let s=null;if(i.length===2)s=a.lineString(i);else{if(t){const u=a.featureCollection(i.map(p=>a.point(p)));s=m(u)}else{const u=S(i,.5);u.length>=4&&(s=a.polygon([u]))}s||(s=a.lineString(i))}const o=f(s.geometry,t?200:30,{units:"meters"});let n;t?n=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:n=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const g={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},h=new c({geometry:{type:"polygon",rings:o.geometry.coordinates},symbol:{type:"simple-fill",style:"none",color:[...e.areaColor,.3],outline:{color:e.areaColor,width:3,style:t?"long-dash":"solid"}},attributes:g,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:n}]}});t?this.districtControllerLayer.add(h):this.subDistrictControllerLayer.add(h)}for(const s of e.subDistricts)this.drawArea(s,!1);const r=[];e.crosses.forEach(s=>{const o={type:"cross",id:s.id,name:s.name,color:e.areaColor,signalId:s.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:s.isKey},n=new c({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossGraphicSymbol(o,"marker"),attributes:o,popupTemplate:{title:s.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});r.push(n)}),this.crossLayer.addMany(r)}getCrossSymbolInSubDistrict(e){return e.signalId&&e.signalId!==""?{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${e.selected?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz.png",width:"20px",height:"20px"}}getCrossGraphicSymbol(e,t){const{isKey:i,color:r}=e;if(t==="marker")return i?{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_gjxklk_orange.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:r,size:8,outline:{color:"white",width:1}};if(t==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:i?30:15,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:i?40:20,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${i?"gis_gjxklk_orange":"gis_xhj_blue"}.png`}]}}}}}exports.default=w;
|
package/lib/src/types/index.d.ts
CHANGED