gisviewer-vue3-arcgis 1.0.194 → 1.0.196
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 +67 -62
- package/es/src/gis-map/index.d.ts +4 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.d.ts +18 -4
- package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +164 -37
- package/es/src/types/index.d.ts +2 -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/green-wave-band-controller/index.d.ts +18 -4
- package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -1
- package/lib/src/types/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -142,6 +142,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
142
142
|
message: string;
|
|
143
143
|
};
|
|
144
144
|
addGreenWaveBand: (params: IEditSignalControlAreaParams) => void;
|
|
145
|
+
stopAddGreenWaveBand: () => {
|
|
146
|
+
status: number;
|
|
147
|
+
message: string;
|
|
148
|
+
} | undefined;
|
|
145
149
|
props: any;
|
|
146
150
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
147
151
|
SignalCountdownPanel: import("vue").DefineComponent<{
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import D, { registerStore as
|
|
1
|
+
import { defineComponent as Ge, ref as b, reactive as Qe, onMounted as je, getCurrentInstance as Ze, onUnmounted as $e, computed as qe, openBlock as h, createElementBlock as k, createElementVNode as p, withDirectives as Ke, vShow as Ue, Fragment as Je, renderList as Re, createBlock as Xe } from "vue";
|
|
2
|
+
import D, { registerStore as Ye } from "./stores/index.mjs";
|
|
3
3
|
import "./style/index.css";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
4
|
+
import Fe from "./utils/green-wave-band-controller/index.mjs";
|
|
5
|
+
import et from "./utils/holo-flow/index.mjs";
|
|
6
|
+
import tt from "./utils/holo-flow/signal-countdown-panel.vue.mjs";
|
|
7
|
+
import at from "./utils/map-initializer.mjs";
|
|
8
8
|
import L from "./utils/open-drive-renderer/index.mjs";
|
|
9
9
|
import T from "./utils/overlay.mjs";
|
|
10
|
-
import
|
|
10
|
+
import nt from "./utils/queue-length.mjs";
|
|
11
11
|
import I from "./utils/road-config-tool/index.mjs";
|
|
12
12
|
import B from "./utils/signal-control-area-controller/index.mjs";
|
|
13
|
-
import
|
|
14
|
-
const
|
|
13
|
+
import rt from "./utils/traffic-flow.mjs";
|
|
14
|
+
const st = { class: "gis-viewer" }, ot = { style: { position: "absolute", bottom: "80px", left: "10px", "z-index": "9999" } }, wt = /* @__PURE__ */ Ge({
|
|
15
15
|
__name: "gis-map",
|
|
16
16
|
props: {
|
|
17
17
|
config: {},
|
|
@@ -19,51 +19,51 @@ const rt = { class: "gis-viewer" }, ot = { style: { position: "absolute", bottom
|
|
|
19
19
|
},
|
|
20
20
|
emits: ["mapLoaded", "markerClick", "mapClick"],
|
|
21
21
|
setup(M, { expose: _, emit: x }) {
|
|
22
|
-
const
|
|
23
|
-
let
|
|
24
|
-
const f =
|
|
25
|
-
|
|
26
|
-
const H = D.useAppDataStore, O =
|
|
27
|
-
|
|
28
|
-
if (!
|
|
22
|
+
const S = b(null);
|
|
23
|
+
let o, l, c, s, n, r, g, t, a, d;
|
|
24
|
+
const f = b(!1);
|
|
25
|
+
Ye();
|
|
26
|
+
const H = D.useAppDataStore, O = Qe([]);
|
|
27
|
+
je(async () => {
|
|
28
|
+
if (!S.value)
|
|
29
29
|
return;
|
|
30
30
|
document.addEventListener("keydown", (m) => {
|
|
31
31
|
m.ctrlKey && m.key === "i" && (f.value = !f.value);
|
|
32
32
|
});
|
|
33
|
-
const e =
|
|
34
|
-
i.assetsRoot =
|
|
35
|
-
container:
|
|
33
|
+
const e = Ze(), { $gisviewerAssetsRoot: u } = e.appContext.config.globalProperties, i = await (await fetch(A.config)).json();
|
|
34
|
+
i.assetsRoot = A.assetsRoot || u, H.mapConfig = i, l = new at(), o = await l.initialize({
|
|
35
|
+
container: S.value,
|
|
36
36
|
mapConfig: i,
|
|
37
|
-
markerClickCallback: (m,
|
|
38
|
-
|
|
37
|
+
markerClickCallback: (m, y, w, Ee) => {
|
|
38
|
+
v("markerClick", m, y, w, Ee);
|
|
39
39
|
},
|
|
40
|
-
mapClickCallback: (m,
|
|
41
|
-
|
|
40
|
+
mapClickCallback: (m, y, w) => {
|
|
41
|
+
v("mapClick", m, y, w);
|
|
42
42
|
}
|
|
43
|
-
}), n = new
|
|
44
|
-
}),
|
|
45
|
-
a == null || a.clearSignalControlArea(), t == null || t.clearOpenDrive(), n.clearHoloTrace(), n.clearHoloSignal(),
|
|
43
|
+
}), n = new et(o, O), await n.init(), v("mapLoaded");
|
|
44
|
+
}), $e(() => {
|
|
45
|
+
a == null || a.clearSignalControlArea(), t == null || t.clearOpenDrive(), n.clearHoloTrace(), n.clearHoloSignal(), s == null || s.disconnectTrafficFlow();
|
|
46
46
|
});
|
|
47
|
-
const V =
|
|
47
|
+
const V = qe(() => o), P = () => {
|
|
48
48
|
const e = D.useAppDataStore;
|
|
49
49
|
e.saveTrackLog = !0;
|
|
50
50
|
}, N = () => {
|
|
51
51
|
n.downloadTrackLog();
|
|
52
52
|
}, z = () => {
|
|
53
53
|
C("vehicleId");
|
|
54
|
-
},
|
|
54
|
+
}, W = () => {
|
|
55
55
|
C("plateNumber");
|
|
56
|
-
},
|
|
56
|
+
}, E = async (e) => await l.setMapCenter(e), G = async (e) => await l.setMapCamera(e), Q = async (e) => await l.lookAt(e), j = (e) => l.setLayerVisibility(e), Z = (e, u) => l.requestCoordinateTransform(e, u), $ = (e) => {
|
|
57
57
|
l.cancelCoordinateTransform(e);
|
|
58
58
|
}, q = (e) => {
|
|
59
59
|
l.setMapZoomRange(e);
|
|
60
|
-
}, K = (e) => (c || (c = new I(
|
|
60
|
+
}, K = (e) => (c || (c = new I(o)), c.showLaneNumber(e)), U = () => {
|
|
61
61
|
c == null || c.clearLaneNumber();
|
|
62
|
-
}, J = async (e) => (c || (c = new I(
|
|
62
|
+
}, J = async (e) => (c || (c = new I(o)), await c.initializeSearch(e)), R = async () => c == null ? void 0 : c.calCrossIndicatorArea(), X = async () => {
|
|
63
63
|
}, Y = async (e, u) => {
|
|
64
|
-
|
|
64
|
+
s || (s = new rt(o)), s.connectTrafficFlow(e, u);
|
|
65
65
|
}, F = () => {
|
|
66
|
-
|
|
66
|
+
s == null || s.disconnectTrafficFlow();
|
|
67
67
|
}, ee = async (e) => {
|
|
68
68
|
n.handleVehicleTraceData(e);
|
|
69
69
|
}, te = () => {
|
|
@@ -74,23 +74,23 @@ const rt = { class: "gis-viewer" }, ot = { style: { position: "absolute", bottom
|
|
|
74
74
|
await n.handleSignalData(e);
|
|
75
75
|
}, re = () => {
|
|
76
76
|
n.clearHoloSignal();
|
|
77
|
-
}, oe = (e) => {
|
|
78
|
-
o == null || o.toggleTrafficInfo(e), n == null || n.toggleTrafficInfo(e);
|
|
79
77
|
}, se = (e) => {
|
|
78
|
+
s == null || s.toggleTrafficInfo(e), n == null || n.toggleTrafficInfo(e);
|
|
79
|
+
}, oe = (e) => {
|
|
80
80
|
n == null || n.togglePause(e);
|
|
81
81
|
}, ie = (e) => {
|
|
82
|
-
|
|
82
|
+
s == null || s.toggleTrafficObject(e), n == null || n.toggleTrafficObject(e);
|
|
83
83
|
}, C = (e) => {
|
|
84
84
|
n == null || n.updatePanelContent(e);
|
|
85
|
-
}, ce = async (e) => (r || (r = new T(
|
|
85
|
+
}, ce = async (e) => (r || (r = new T(o)), r.addOverlays(e)), le = (e) => (r || (r = new T(o)), r.addMask(e)), ue = () => {
|
|
86
86
|
r == null || r.removeMask();
|
|
87
87
|
}, me = (e) => r == null ? void 0 : r.removeOverlaysByType(e), ge = (e) => r == null ? void 0 : r.removeOverlaysById(e), pe = () => r == null ? void 0 : r.removeAllOverlays(), de = () => {
|
|
88
88
|
r == null || r.showAllOverlays();
|
|
89
89
|
}, Se = (e) => {
|
|
90
|
-
g || (g = new
|
|
90
|
+
g || (g = new nt(o)), g.updateQueueLength(e);
|
|
91
91
|
}, fe = () => {
|
|
92
92
|
g == null || g.removeQueueLength();
|
|
93
|
-
}, Ce = async (e, u) => (t || (t = new L(
|
|
93
|
+
}, Ce = async (e, u) => (t || (t = new L(o)), await t.showOpenDriveFromServer(e, u)), ve = async (e) => (t || (t = new L(o)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), ye = async () => await (t == null ? void 0 : t.clearOpenDrive()), we = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
|
|
94
94
|
status: -1,
|
|
95
95
|
message: "未加载OpenDrive地图"
|
|
96
96
|
}, he = async (e) => t ? t.selectSumo(e) : {
|
|
@@ -99,10 +99,10 @@ const rt = { class: "gis-viewer" }, ot = { style: { position: "absolute", bottom
|
|
|
99
99
|
}, Oe = async (e) => t ? t.unselectSumo(e) : {
|
|
100
100
|
status: -1,
|
|
101
101
|
message: "未加载OpenDrive地图"
|
|
102
|
-
},
|
|
102
|
+
}, Ae = async (e) => t ? await t.geometrySearch(e) : {
|
|
103
103
|
status: -1,
|
|
104
104
|
message: "未加载OpenDrive地图"
|
|
105
|
-
},
|
|
105
|
+
}, be = async (e) => t ? await t.getSumoInfo(e) : {
|
|
106
106
|
status: -1,
|
|
107
107
|
message: "未加载OpenDrive地图"
|
|
108
108
|
}, ke = async (e) => t ? await (t == null ? void 0 : t.splitLane(e)) : {
|
|
@@ -111,17 +111,21 @@ const rt = { class: "gis-viewer" }, ot = { style: { position: "absolute", bottom
|
|
|
111
111
|
}, De = async () => t ? t == null ? void 0 : t.clearSplitLane() : {
|
|
112
112
|
status: -1,
|
|
113
113
|
message: "未加载OpenDrive地图"
|
|
114
|
-
}, Le = (e) => (a || (a = new B(
|
|
114
|
+
}, Le = (e) => (a || (a = new B(o)), a.showSignalControlArea(e)), Te = () => {
|
|
115
115
|
a == null || a.clearSignalControlArea();
|
|
116
|
-
}, Ie = async (e) => a ? await a.locateSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Be = async (e) => a ? await a.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Me = () => a ? a.resetHighlight() : { status: -1, message: "未加载信号控制区" }, _e = (e) => (a || (a = new B(
|
|
116
|
+
}, Ie = async (e) => a ? await a.locateSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Be = async (e) => a ? await a.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, Me = () => a ? a.resetHighlight() : { status: -1, message: "未加载信号控制区" }, _e = (e) => (a || (a = new B(o)), a.showSubSignalControlArea(e)), xe = (e) => a ? a.editSubSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, He = () => a ? a.stopEditSubSignalControlArea() : { status: -1, message: "未加载信号控制区" }, Ve = (e) => a ? a.selectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, Pe = (e) => a ? a.unselectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, Ne = (e) => a ? a.changeSubSignalControlAreaBorderVisibility(
|
|
117
117
|
e
|
|
118
|
-
) : { status: -1, message: "未加载信号控制区" }, ze = (e) => (
|
|
118
|
+
) : { status: -1, message: "未加载信号控制区" }, ze = (e) => (d || (d = new Fe(o)), d.addGreenWaveBand(e)), We = () => {
|
|
119
|
+
if (!d)
|
|
120
|
+
return { status: -1, message: "未加载绿波带" };
|
|
121
|
+
d.stopAddGreenWaveBand();
|
|
122
|
+
}, A = M, v = x;
|
|
119
123
|
return _({
|
|
120
124
|
mapViewer: V,
|
|
121
|
-
setLayerVisibility:
|
|
122
|
-
setMapCenter:
|
|
123
|
-
lookAt:
|
|
124
|
-
setMapCamera:
|
|
125
|
+
setLayerVisibility: j,
|
|
126
|
+
setMapCenter: E,
|
|
127
|
+
lookAt: Q,
|
|
128
|
+
setMapCamera: G,
|
|
125
129
|
setMapZoomRange: q,
|
|
126
130
|
requestCoordinateTransform: Z,
|
|
127
131
|
cancelCoordinateTransform: $,
|
|
@@ -144,20 +148,20 @@ const rt = { class: "gis-viewer" }, ot = { style: { position: "absolute", bottom
|
|
|
144
148
|
handleHoloSignalData: ne,
|
|
145
149
|
clearHoloSignal: re,
|
|
146
150
|
setInterpolate: ae,
|
|
147
|
-
toggleTrafficInfo:
|
|
151
|
+
toggleTrafficInfo: se,
|
|
148
152
|
toggleTrafficObject: ie,
|
|
149
153
|
toggleVehicleInfo: C,
|
|
150
|
-
togglePause:
|
|
154
|
+
togglePause: oe,
|
|
151
155
|
updateQueueLength: Se,
|
|
152
156
|
removeQueueLength: fe,
|
|
153
157
|
showOpenDriveFromServer: Ce,
|
|
154
|
-
showOpenDriveFromFile:
|
|
155
|
-
clearOpenDrive:
|
|
156
|
-
geometrySearchInOpenDrive:
|
|
158
|
+
showOpenDriveFromFile: ve,
|
|
159
|
+
clearOpenDrive: ye,
|
|
160
|
+
geometrySearchInOpenDrive: Ae,
|
|
157
161
|
findSumoInOpenDrive: we,
|
|
158
162
|
selectSumoInOpenDrive: he,
|
|
159
163
|
unselectSumoInOpenDrive: Oe,
|
|
160
|
-
getSumoInfo:
|
|
164
|
+
getSumoInfo: be,
|
|
161
165
|
splitOpenDriveLane: ke,
|
|
162
166
|
clearSplitOpenDriveLane: De,
|
|
163
167
|
showSignalControlArea: Le,
|
|
@@ -171,14 +175,15 @@ const rt = { class: "gis-viewer" }, ot = { style: { position: "absolute", bottom
|
|
|
171
175
|
selectSubSignalControlAreaCross: Ve,
|
|
172
176
|
unselectSubSignalControlAreaCross: Pe,
|
|
173
177
|
changeSubSignalControlAreaBorderVisibility: Ne,
|
|
174
|
-
addGreenWaveBand: ze
|
|
175
|
-
|
|
178
|
+
addGreenWaveBand: ze,
|
|
179
|
+
stopAddGreenWaveBand: We
|
|
180
|
+
}), (e, u) => (h(), k("div", st, [
|
|
176
181
|
p("div", {
|
|
177
182
|
class: "gis-viewer-main",
|
|
178
183
|
ref_key: "mapContainer",
|
|
179
|
-
ref:
|
|
184
|
+
ref: S
|
|
180
185
|
}, [
|
|
181
|
-
|
|
186
|
+
Ke(p("div", ot, [
|
|
182
187
|
p("button", {
|
|
183
188
|
style: { "margin-right": "10px" },
|
|
184
189
|
onClick: P
|
|
@@ -191,12 +196,12 @@ const rt = { class: "gis-viewer" }, ot = { style: { position: "absolute", bottom
|
|
|
191
196
|
style: { "margin-right": "10px" },
|
|
192
197
|
onClick: z
|
|
193
198
|
}, " 显示车辆id "),
|
|
194
|
-
p("button", { onClick:
|
|
199
|
+
p("button", { onClick: W }, "显示车辆号牌")
|
|
195
200
|
], 512), [
|
|
196
|
-
[
|
|
201
|
+
[Ue, f.value]
|
|
197
202
|
])
|
|
198
203
|
], 512),
|
|
199
|
-
(h(!0), k(
|
|
204
|
+
(h(!0), k(Je, null, Re(O, (i, m) => (h(), Xe(tt, {
|
|
200
205
|
key: m,
|
|
201
206
|
"display-mode": i.displayMode,
|
|
202
207
|
"road-id": i.crossId,
|
|
@@ -212,5 +217,5 @@ const rt = { class: "gis-viewer" }, ot = { style: { position: "absolute", bottom
|
|
|
212
217
|
}
|
|
213
218
|
});
|
|
214
219
|
export {
|
|
215
|
-
|
|
220
|
+
wt as default
|
|
216
221
|
};
|
|
@@ -130,6 +130,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
130
130
|
message: string;
|
|
131
131
|
};
|
|
132
132
|
addGreenWaveBand: (params: import("../types").IEditSignalControlAreaParams) => void;
|
|
133
|
+
stopAddGreenWaveBand: () => {
|
|
134
|
+
status: number;
|
|
135
|
+
message: string;
|
|
136
|
+
} | undefined;
|
|
133
137
|
props: any;
|
|
134
138
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
135
139
|
SignalCountdownPanel: import("vue").DefineComponent<{
|
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
import { IEditSignalControlAreaParams } from '../../../types';
|
|
2
2
|
export default class GreenWaveBandController {
|
|
3
3
|
private view;
|
|
4
|
-
private
|
|
4
|
+
private allNodesLayer;
|
|
5
|
+
private roadsectLayer;
|
|
5
6
|
private viewClickWatcher?;
|
|
6
7
|
private openDriveServer;
|
|
7
8
|
private selectedNodeIds;
|
|
9
|
+
private addCrossCallback;
|
|
10
|
+
private removeCrossCallback;
|
|
11
|
+
private removeAllCrossCallback;
|
|
8
12
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
9
13
|
/**
|
|
10
14
|
* 新增绿波带
|
|
11
|
-
* @param
|
|
15
|
+
* @param params
|
|
12
16
|
*/
|
|
13
|
-
addGreenWaveBand(
|
|
17
|
+
addGreenWaveBand(params: IEditSignalControlAreaParams): void;
|
|
14
18
|
stopAddGreenWaveBand(): void;
|
|
19
|
+
/**
|
|
20
|
+
* 显示所有路口,进入待选状态
|
|
21
|
+
* @param nodeAttributes
|
|
22
|
+
*/
|
|
15
23
|
private showAllNodes;
|
|
24
|
+
/**
|
|
25
|
+
* 点击待选/已选路口
|
|
26
|
+
* @param event
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
16
29
|
private handleViewClick;
|
|
17
30
|
/**
|
|
18
31
|
* 显示下游节点
|
|
19
32
|
* @param nodeId
|
|
20
33
|
*/
|
|
21
34
|
private showDownstreamNodes;
|
|
22
|
-
private
|
|
35
|
+
private getLineSymbol;
|
|
36
|
+
private getNodeSymbol;
|
|
23
37
|
}
|
|
@@ -1,73 +1,200 @@
|
|
|
1
|
-
import
|
|
1
|
+
import h from "@arcgis/core/Graphic";
|
|
2
2
|
import n from "@arcgis/core/layers/GraphicsLayer";
|
|
3
|
-
import
|
|
4
|
-
class
|
|
3
|
+
import y from "axios";
|
|
4
|
+
class C {
|
|
5
5
|
constructor(e) {
|
|
6
|
-
this.selectedNodeIds = [], this.view = e, this.
|
|
7
|
-
id: "
|
|
8
|
-
}), this.view.map.
|
|
6
|
+
this.selectedNodeIds = [], this.view = e, this.roadsectLayer = new n({
|
|
7
|
+
id: "roadsectLayer"
|
|
8
|
+
}), this.view.map.add(this.roadsectLayer), this.allNodesLayer = new n({
|
|
9
|
+
id: "allNodesLayer"
|
|
10
|
+
}), this.view.map.add(this.allNodesLayer);
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* 新增绿波带
|
|
12
|
-
* @param
|
|
14
|
+
* @param params
|
|
13
15
|
*/
|
|
14
16
|
addGreenWaveBand(e) {
|
|
15
|
-
this.selectedNodeIds = [], this.openDriveServer = e.odrServer, this.showAllNodes(e.crossesInArea), this.viewClickWatcher || (this.viewClickWatcher = this.view.on("click", (
|
|
16
|
-
this.handleViewClick(
|
|
17
|
+
this.addCrossCallback = e.addCrossCallback, this.removeCrossCallback = e.removeCrossCallback, e.removeAllCrossCallback && (this.removeAllCrossCallback = e.removeAllCrossCallback), this.selectedNodeIds = [], this.openDriveServer = e.odrServer, this.showAllNodes(e.crossesInArea), this.viewClickWatcher || (this.viewClickWatcher = this.view.on("click", (i) => {
|
|
18
|
+
this.handleViewClick(i);
|
|
17
19
|
}));
|
|
18
20
|
}
|
|
19
21
|
stopAddGreenWaveBand() {
|
|
20
22
|
var e;
|
|
21
|
-
(e = this.viewClickWatcher) == null || e.remove(), this.viewClickWatcher = void 0;
|
|
23
|
+
(e = this.viewClickWatcher) == null || e.remove(), this.viewClickWatcher = void 0, this.allNodesLayer.removeAll(), this.selectedNodeIds = [], this.roadsectLayer.removeAll();
|
|
22
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* 显示所有路口,进入待选状态
|
|
27
|
+
* @param nodeAttributes
|
|
28
|
+
*/
|
|
23
29
|
showAllNodes(e) {
|
|
24
|
-
const
|
|
25
|
-
e.forEach((
|
|
26
|
-
|
|
27
|
-
new
|
|
30
|
+
const i = [];
|
|
31
|
+
e.forEach((a) => {
|
|
32
|
+
i.push(
|
|
33
|
+
new h({
|
|
28
34
|
geometry: {
|
|
29
35
|
type: "point",
|
|
30
|
-
x:
|
|
31
|
-
y:
|
|
36
|
+
x: a.longitude,
|
|
37
|
+
y: a.latitude
|
|
32
38
|
},
|
|
33
|
-
symbol: this.
|
|
34
|
-
attributes: { ...
|
|
39
|
+
symbol: this.getNodeSymbol(!1),
|
|
40
|
+
attributes: { ...a, selected: !1 }
|
|
35
41
|
})
|
|
36
42
|
);
|
|
37
|
-
}), this.
|
|
43
|
+
}), this.allNodesLayer.addMany(i);
|
|
38
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* 点击待选/已选路口
|
|
47
|
+
* @param event
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
39
50
|
async handleViewClick(e) {
|
|
40
|
-
var
|
|
41
|
-
const
|
|
42
|
-
include: [this.
|
|
43
|
-
})).results) == null ? void 0 :
|
|
44
|
-
(
|
|
51
|
+
var d;
|
|
52
|
+
const a = (d = (await this.view.hitTest(e, {
|
|
53
|
+
include: [this.allNodesLayer]
|
|
54
|
+
})).results) == null ? void 0 : d.filter(
|
|
55
|
+
(s) => s.type === "graphic"
|
|
45
56
|
);
|
|
46
|
-
if (
|
|
57
|
+
if (a.length === 0)
|
|
47
58
|
return;
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
const o = a[0].graphic, r = o.getAttribute("id");
|
|
60
|
+
if (this.selectedNodeIds.includes(r)) {
|
|
61
|
+
const s = this.selectedNodeIds.indexOf(r) + 1;
|
|
62
|
+
if (s === 1)
|
|
63
|
+
this.removeAllCrossCallback && this.removeAllCrossCallback(), this.selectedNodeIds = [], this.allNodesLayer.graphics.forEach((t) => {
|
|
64
|
+
t.setAttribute("selected", !1), t.symbol = this.getNodeSymbol(!1), t.visible = !0;
|
|
65
|
+
}), this.roadsectLayer.removeAll();
|
|
66
|
+
else {
|
|
67
|
+
for (let t = s; t < this.selectedNodeIds.length; t++) {
|
|
68
|
+
this.removeCrossCallback && this.removeCrossCallback({
|
|
69
|
+
id: this.selectedNodeIds[t]
|
|
70
|
+
});
|
|
71
|
+
for (let l = 0; l < this.roadsectLayer.graphics.length; l++) {
|
|
72
|
+
const c = this.roadsectLayer.graphics.getItemAt(l);
|
|
73
|
+
(c.getAttribute("id") === this.selectedNodeIds[t] || !c.getAttribute("selected")) && (this.roadsectLayer.remove(c), l--);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
this.selectedNodeIds = this.selectedNodeIds.slice(0, s), this.allNodesLayer.graphics.forEach((t) => {
|
|
77
|
+
const l = this.selectedNodeIds.includes(
|
|
78
|
+
t.getAttribute("id")
|
|
79
|
+
);
|
|
80
|
+
t.setAttribute("selected", l), t.symbol = this.getNodeSymbol(l), t.visible = l;
|
|
81
|
+
}), await this.showDownstreamNodes(r);
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
o.setAttribute("selected", !0), this.addCrossCallback && this.addCrossCallback({
|
|
85
|
+
id: r,
|
|
86
|
+
name: o.getAttribute("name")
|
|
87
|
+
}), o.symbol = this.getNodeSymbol(!0), this.selectedNodeIds.push(r), this.allNodesLayer.graphics.forEach((s) => {
|
|
88
|
+
s.visible = s.getAttribute("selected");
|
|
89
|
+
});
|
|
90
|
+
for (let s = 0; s < this.roadsectLayer.graphics.length; s++) {
|
|
91
|
+
const t = this.roadsectLayer.graphics.getItemAt(s);
|
|
92
|
+
t.getAttribute("id") === r ? (t.symbol = this.getLineSymbol(!0), t.setAttribute("selected", !0)) : t.getAttribute("selected") || (this.roadsectLayer.remove(t), s--);
|
|
93
|
+
}
|
|
94
|
+
await this.showDownstreamNodes(r);
|
|
95
|
+
}
|
|
52
96
|
}
|
|
53
97
|
/**
|
|
54
98
|
* 显示下游节点
|
|
55
99
|
* @param nodeId
|
|
56
100
|
*/
|
|
57
101
|
async showDownstreamNodes(e) {
|
|
58
|
-
|
|
102
|
+
this.view.container.style.cursor = "progress";
|
|
103
|
+
const i = await y.get(
|
|
59
104
|
`http://${this.openDriveServer}/api/computable/getDownstreamNodes`,
|
|
60
105
|
{ params: { nodeId: e } }
|
|
61
106
|
);
|
|
62
|
-
if (
|
|
107
|
+
if (i.status !== 200 || i.data.status !== 0) {
|
|
108
|
+
this.view.container.style.cursor = "default";
|
|
63
109
|
return;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
110
|
+
}
|
|
111
|
+
i.data.result.forEach((o) => {
|
|
112
|
+
this.allNodesLayer.graphics.forEach((r) => {
|
|
113
|
+
if (r.getAttribute("nodeId") === o.id && r.getAttribute("selected") === !1 && (r.visible = !0, o.coordinates)) {
|
|
114
|
+
const d = new h({
|
|
115
|
+
geometry: {
|
|
116
|
+
type: "polyline",
|
|
117
|
+
paths: [o.coordinates]
|
|
118
|
+
},
|
|
119
|
+
symbol: this.getLineSymbol(!1),
|
|
120
|
+
attributes: { ...o, selected: !1 }
|
|
121
|
+
});
|
|
122
|
+
this.roadsectLayer.add(d);
|
|
123
|
+
}
|
|
67
124
|
});
|
|
68
|
-
});
|
|
125
|
+
}), this.view.container.style.cursor = "default";
|
|
126
|
+
}
|
|
127
|
+
getLineSymbol(e) {
|
|
128
|
+
return e ? {
|
|
129
|
+
type: "cim",
|
|
130
|
+
data: {
|
|
131
|
+
type: "CIMSymbolReference",
|
|
132
|
+
symbol: {
|
|
133
|
+
type: "CIMLineSymbol",
|
|
134
|
+
symbolLayers: [
|
|
135
|
+
{
|
|
136
|
+
type: "CIMVectorMarker",
|
|
137
|
+
enable: !0,
|
|
138
|
+
size: 4,
|
|
139
|
+
markerPlacement: {
|
|
140
|
+
type: "CIMMarkerPlacementAlongLineSameSize",
|
|
141
|
+
endings: "WithMarkers",
|
|
142
|
+
placementTemplate: [40],
|
|
143
|
+
angleToLine: !0
|
|
144
|
+
},
|
|
145
|
+
frame: {
|
|
146
|
+
xmin: -5,
|
|
147
|
+
ymin: -5,
|
|
148
|
+
xmax: 5,
|
|
149
|
+
ymax: 5
|
|
150
|
+
},
|
|
151
|
+
markerGraphics: [
|
|
152
|
+
{
|
|
153
|
+
type: "CIMMarkerGraphic",
|
|
154
|
+
geometry: {
|
|
155
|
+
paths: [
|
|
156
|
+
[
|
|
157
|
+
[4, -4],
|
|
158
|
+
[12, 0],
|
|
159
|
+
[4, 4]
|
|
160
|
+
],
|
|
161
|
+
[
|
|
162
|
+
[-4, 4],
|
|
163
|
+
[-12, 0],
|
|
164
|
+
[-4, -4]
|
|
165
|
+
]
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
symbol: {
|
|
169
|
+
type: "CIMLineSymbol",
|
|
170
|
+
symbolLayers: [
|
|
171
|
+
{
|
|
172
|
+
type: "CIMSolidStroke",
|
|
173
|
+
enable: !0,
|
|
174
|
+
width: 1.5,
|
|
175
|
+
color: [255, 255, 255, 255]
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
type: "CIMSolidStroke",
|
|
184
|
+
enable: !0,
|
|
185
|
+
width: 4,
|
|
186
|
+
color: [55, 125, 34, 255]
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
} : {
|
|
192
|
+
type: "simple-line",
|
|
193
|
+
color: "gray",
|
|
194
|
+
width: 2
|
|
195
|
+
};
|
|
69
196
|
}
|
|
70
|
-
|
|
197
|
+
getNodeSymbol(e) {
|
|
71
198
|
return {
|
|
72
199
|
type: "cim",
|
|
73
200
|
data: {
|
|
@@ -157,5 +284,5 @@ class p {
|
|
|
157
284
|
}
|
|
158
285
|
}
|
|
159
286
|
export {
|
|
160
|
-
|
|
287
|
+
C as default
|
|
161
288
|
};
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -280,6 +280,7 @@ export interface INode {
|
|
|
280
280
|
latitude: number;
|
|
281
281
|
name: string;
|
|
282
282
|
signalId?: string;
|
|
283
|
+
coordinates?: number[][];
|
|
283
284
|
}
|
|
284
285
|
export interface IEditSignalControlAreaParams {
|
|
285
286
|
crossesInArea: INode[];
|
|
@@ -290,5 +291,6 @@ export interface IEditSignalControlAreaParams {
|
|
|
290
291
|
removeCrossCallback: (params: {
|
|
291
292
|
id: string;
|
|
292
293
|
}) => void;
|
|
294
|
+
removeAllCrossCallback?: () => void;
|
|
293
295
|
odrServer: string;
|
|
294
296
|
}
|
|
@@ -142,6 +142,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
142
142
|
message: string;
|
|
143
143
|
};
|
|
144
144
|
addGreenWaveBand: (params: IEditSignalControlAreaParams) => void;
|
|
145
|
+
stopAddGreenWaveBand: () => {
|
|
146
|
+
status: number;
|
|
147
|
+
message: string;
|
|
148
|
+
} | undefined;
|
|
145
149
|
props: any;
|
|
146
150
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
147
151
|
SignalCountdownPanel: import("vue").DefineComponent<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),h=require("./stores/index.js");require("./style/index.css");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),h=require("./stores/index.js");require("./style/index.css");const He=require("./utils/green-wave-band-controller/index.js"),Pe=require("./utils/holo-flow/index.js"),ze=require("./utils/holo-flow/signal-countdown-panel.vue.js"),je=require("./utils/map-initializer.js"),O=require("./utils/open-drive-renderer/index.js"),A=require("./utils/overlay.js"),We=require("./utils/queue-length.js"),L=require("./utils/road-config-tool/index.js"),D=require("./utils/signal-control-area-controller/index.js"),Ge=require("./utils/traffic-flow.js"),Qe={class:"gis-viewer"},Ze={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},Ke=a.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(T,{expose:_,emit:B}){const f=a.ref(null);let i,u,l,o,r,s,m,t,n,p;const S=a.ref(!1);h.registerStore();const x=h.default.useAppDataStore,b=a.reactive([]);a.onMounted(async()=>{if(!f.value)return;document.addEventListener("keydown",g=>{g.ctrlKey&&g.key==="i"&&(S.value=!S.value)});const e=a.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(k.config)).json();c.assetsRoot=k.assetsRoot||d,x.mapConfig=c,u=new je.default,i=await u.initialize({container:f.value,mapConfig:c,markerClickCallback:(g,w,C,Ee)=>{y("markerClick",g,w,C,Ee)},mapClickCallback:(g,w,C)=>{y("mapClick",g,w,C)}}),r=new Pe.default(i,b),await r.init(),y("mapLoaded")}),a.onUnmounted(()=>{n==null||n.clearSignalControlArea(),t==null||t.clearOpenDrive(),r.clearHoloTrace(),r.clearHoloSignal(),o==null||o.disconnectTrafficFlow()});const I=a.computed(()=>i),q=()=>{const e=h.default.useAppDataStore;e.saveTrackLog=!0},V=()=>{r.downloadTrackLog()},M=()=>{v("vehicleId")},N=()=>{v("plateNumber")},E=async e=>await u.setMapCenter(e),H=async e=>await u.setMapCamera(e),P=async e=>await u.lookAt(e),z=e=>u.setLayerVisibility(e),j=(e,d)=>u.requestCoordinateTransform(e,d),W=e=>{u.cancelCoordinateTransform(e)},G=e=>{u.setMapZoomRange(e)},Q=e=>(l||(l=new L.default(i)),l.showLaneNumber(e)),Z=()=>{l==null||l.clearLaneNumber()},K=async e=>(l||(l=new L.default(i)),await l.initializeSearch(e)),U=async()=>l==null?void 0:l.calCrossIndicatorArea(),J=async()=>{},X=async(e,d)=>{o||(o=new Ge.default(i)),o.connectTrafficFlow(e,d)},Y=()=>{o==null||o.disconnectTrafficFlow()},F=async e=>{r.handleVehicleTraceData(e)},R=()=>{r.clearHoloTrace()},$=e=>{r.setInterpolate(e)},ee=async e=>{await r.handleSignalData(e)},te=()=>{r.clearHoloSignal()},ne=e=>{o==null||o.toggleTrafficInfo(e),r==null||r.toggleTrafficInfo(e)},ae=e=>{r==null||r.togglePause(e)},re=e=>{o==null||o.toggleTrafficObject(e),r==null||r.toggleTrafficObject(e)},v=e=>{r==null||r.updatePanelContent(e)},se=async e=>(s||(s=new A.default(i)),s.addOverlays(e)),oe=e=>(s||(s=new A.default(i)),s.addMask(e)),ie=()=>{s==null||s.removeMask()},ce=e=>s==null?void 0:s.removeOverlaysByType(e),le=e=>s==null?void 0:s.removeOverlaysById(e),ue=()=>s==null?void 0:s.removeAllOverlays(),de=()=>{s==null||s.showAllOverlays()},ge=e=>{m||(m=new We.default(i)),m.updateQueueLength(e)},me=()=>{m==null||m.removeQueueLength()},pe=async(e,d)=>(t||(t=new O.default(i)),await t.showOpenDriveFromServer(e,d)),fe=async e=>(t||(t=new O.default(i)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),Se=async()=>await(t==null?void 0:t.clearOpenDrive()),ve=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地图"},we=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Ce=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},he=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},be=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=>(n||(n=new D.default(i)),n.showSignalControlArea(e)),Ae=()=>{n==null||n.clearSignalControlArea()},Le=async e=>n?await n.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},De=async e=>n?await n.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Te=()=>n?n.resetHighlight():{status:-1,message:"未加载信号控制区"},_e=e=>(n||(n=new D.default(i)),n.showSubSignalControlArea(e)),Be=e=>n?n.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},xe=()=>n?n.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},Ie=e=>n?n.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},qe=e=>n?n.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Ve=e=>n?n.changeSubSignalControlAreaBorderVisibility(e):{status:-1,message:"未加载信号控制区"},Me=e=>(p||(p=new He.default(i)),p.addGreenWaveBand(e)),Ne=()=>{if(!p)return{status:-1,message:"未加载绿波带"};p.stopAddGreenWaveBand()},k=T,y=B;return _({mapViewer:I,setLayerVisibility:z,setMapCenter:E,lookAt:P,setMapCamera:H,setMapZoomRange:G,requestCoordinateTransform:j,cancelCoordinateTransform:W,addOverlays:se,addMask:oe,removeMask:ie,showAllOverlays:de,removeOverlaysByType:ce,removeOverlaysById:le,removeAllOverlays:ue,showLaneNumber:Q,clearLaneNumber:Z,initializeAreaTool:K,calCrossIndicatorArea:U,calRoadIndicatorArea:J,connectCarFlow:X,disconnectCarFlow:Y,handleHoloVehicleTraceData:F,clearHoloTrace:R,handleHoloSignalData:ee,clearHoloSignal:te,setInterpolate:$,toggleTrafficInfo:ne,toggleTrafficObject:re,toggleVehicleInfo:v,togglePause:ae,updateQueueLength:ge,removeQueueLength:me,showOpenDriveFromServer:pe,showOpenDriveFromFile:fe,clearOpenDrive:Se,geometrySearchInOpenDrive:Ce,findSumoInOpenDrive:ve,selectSumoInOpenDrive:ye,unselectSumoInOpenDrive:we,getSumoInfo:he,splitOpenDriveLane:be,clearSplitOpenDriveLane:ke,showSignalControlArea:Oe,clearSignalControlArea:Ae,locateSignalControlArea:Le,highlightSignalControlArea:De,resetHighlightSignalControlArea:Te,showSubSignalControlArea:_e,editSubSignalControlArea:Be,stopEditSubSignalControlArea:xe,selectSubSignalControlAreaCross:Ie,unselectSubSignalControlAreaCross:qe,changeSubSignalControlAreaBorderVisibility:Ve,addGreenWaveBand:Me,stopAddGreenWaveBand:Ne}),(e,d)=>(a.openBlock(),a.createElementBlock("div",Qe,[a.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:f},[a.withDirectives(a.createElementVNode("div",Ze,[a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:q}," 开始记录 "),a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:V}," 下载日志 "),a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:M}," 显示车辆id "),a.createElementVNode("button",{onClick:N},"显示车辆号牌")],512),[[a.vShow,S.value]])],512),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(b,(c,g)=>(a.openBlock(),a.createBlock(ze.default,{key:g,"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=Ke;
|
|
@@ -130,6 +130,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
130
130
|
message: string;
|
|
131
131
|
};
|
|
132
132
|
addGreenWaveBand: (params: import("../types").IEditSignalControlAreaParams) => void;
|
|
133
|
+
stopAddGreenWaveBand: () => {
|
|
134
|
+
status: number;
|
|
135
|
+
message: string;
|
|
136
|
+
} | undefined;
|
|
133
137
|
props: any;
|
|
134
138
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
135
139
|
SignalCountdownPanel: import("vue").DefineComponent<{
|
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
import { IEditSignalControlAreaParams } from '../../../types';
|
|
2
2
|
export default class GreenWaveBandController {
|
|
3
3
|
private view;
|
|
4
|
-
private
|
|
4
|
+
private allNodesLayer;
|
|
5
|
+
private roadsectLayer;
|
|
5
6
|
private viewClickWatcher?;
|
|
6
7
|
private openDriveServer;
|
|
7
8
|
private selectedNodeIds;
|
|
9
|
+
private addCrossCallback;
|
|
10
|
+
private removeCrossCallback;
|
|
11
|
+
private removeAllCrossCallback;
|
|
8
12
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
9
13
|
/**
|
|
10
14
|
* 新增绿波带
|
|
11
|
-
* @param
|
|
15
|
+
* @param params
|
|
12
16
|
*/
|
|
13
|
-
addGreenWaveBand(
|
|
17
|
+
addGreenWaveBand(params: IEditSignalControlAreaParams): void;
|
|
14
18
|
stopAddGreenWaveBand(): void;
|
|
19
|
+
/**
|
|
20
|
+
* 显示所有路口,进入待选状态
|
|
21
|
+
* @param nodeAttributes
|
|
22
|
+
*/
|
|
15
23
|
private showAllNodes;
|
|
24
|
+
/**
|
|
25
|
+
* 点击待选/已选路口
|
|
26
|
+
* @param event
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
16
29
|
private handleViewClick;
|
|
17
30
|
/**
|
|
18
31
|
* 显示下游节点
|
|
19
32
|
* @param nodeId
|
|
20
33
|
*/
|
|
21
34
|
private showDownstreamNodes;
|
|
22
|
-
private
|
|
35
|
+
private getLineSymbol;
|
|
36
|
+
private getNodeSymbol;
|
|
23
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("@arcgis/core/Graphic"),h=require("@arcgis/core/layers/GraphicsLayer"),y=require("axios");class m{constructor(e){this.selectedNodeIds=[],this.view=e,this.roadsectLayer=new h({id:"roadsectLayer"}),this.view.map.add(this.roadsectLayer),this.allNodesLayer=new h({id:"allNodesLayer"}),this.view.map.add(this.allNodesLayer)}addGreenWaveBand(e){this.addCrossCallback=e.addCrossCallback,this.removeCrossCallback=e.removeCrossCallback,e.removeAllCrossCallback&&(this.removeAllCrossCallback=e.removeAllCrossCallback),this.selectedNodeIds=[],this.openDriveServer=e.odrServer,this.showAllNodes(e.crossesInArea),this.viewClickWatcher||(this.viewClickWatcher=this.view.on("click",i=>{this.handleViewClick(i)}))}stopAddGreenWaveBand(){var e;(e=this.viewClickWatcher)==null||e.remove(),this.viewClickWatcher=void 0,this.allNodesLayer.removeAll(),this.selectedNodeIds=[],this.roadsectLayer.removeAll()}showAllNodes(e){const i=[];e.forEach(a=>{i.push(new n({geometry:{type:"point",x:a.longitude,y:a.latitude},symbol:this.getNodeSymbol(!1),attributes:{...a,selected:!1}}))}),this.allNodesLayer.addMany(i)}async handleViewClick(e){var d;const a=(d=(await this.view.hitTest(e,{include:[this.allNodesLayer]})).results)==null?void 0:d.filter(s=>s.type==="graphic");if(a.length===0)return;const o=a[0].graphic,r=o.getAttribute("id");if(this.selectedNodeIds.includes(r)){const s=this.selectedNodeIds.indexOf(r)+1;if(s===1)this.removeAllCrossCallback&&this.removeAllCrossCallback(),this.selectedNodeIds=[],this.allNodesLayer.graphics.forEach(t=>{t.setAttribute("selected",!1),t.symbol=this.getNodeSymbol(!1),t.visible=!0}),this.roadsectLayer.removeAll();else{for(let t=s;t<this.selectedNodeIds.length;t++){this.removeCrossCallback&&this.removeCrossCallback({id:this.selectedNodeIds[t]});for(let l=0;l<this.roadsectLayer.graphics.length;l++){const c=this.roadsectLayer.graphics.getItemAt(l);(c.getAttribute("id")===this.selectedNodeIds[t]||!c.getAttribute("selected"))&&(this.roadsectLayer.remove(c),l--)}}this.selectedNodeIds=this.selectedNodeIds.slice(0,s),this.allNodesLayer.graphics.forEach(t=>{const l=this.selectedNodeIds.includes(t.getAttribute("id"));t.setAttribute("selected",l),t.symbol=this.getNodeSymbol(l),t.visible=l}),await this.showDownstreamNodes(r)}}else{o.setAttribute("selected",!0),this.addCrossCallback&&this.addCrossCallback({id:r,name:o.getAttribute("name")}),o.symbol=this.getNodeSymbol(!0),this.selectedNodeIds.push(r),this.allNodesLayer.graphics.forEach(s=>{s.visible=s.getAttribute("selected")});for(let s=0;s<this.roadsectLayer.graphics.length;s++){const t=this.roadsectLayer.graphics.getItemAt(s);t.getAttribute("id")===r?(t.symbol=this.getLineSymbol(!0),t.setAttribute("selected",!0)):t.getAttribute("selected")||(this.roadsectLayer.remove(t),s--)}await this.showDownstreamNodes(r)}}async showDownstreamNodes(e){this.view.container.style.cursor="progress";const i=await y.get(`http://${this.openDriveServer}/api/computable/getDownstreamNodes`,{params:{nodeId:e}});if(i.status!==200||i.data.status!==0){this.view.container.style.cursor="default";return}i.data.result.forEach(o=>{this.allNodesLayer.graphics.forEach(r=>{if(r.getAttribute("nodeId")===o.id&&r.getAttribute("selected")===!1&&(r.visible=!0,o.coordinates)){const d=new n({geometry:{type:"polyline",paths:[o.coordinates]},symbol:this.getLineSymbol(!1),attributes:{...o,selected:!1}});this.roadsectLayer.add(d)}})}),this.view.container.style.cursor="default"}getLineSymbol(e){return e?{type:"cim",data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:4,markerPlacement:{type:"CIMMarkerPlacementAlongLineSameSize",endings:"WithMarkers",placementTemplate:[40],angleToLine:!0},frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[4,-4],[12,0],[4,4]],[[-4,4],[-12,0],[-4,-4]]]},symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,width:1.5,color:[255,255,255,255]}]}}]},{type:"CIMSolidStroke",enable:!0,width:4,color:[55,125,34,255]}]}}}:{type:"simple-line",color:"gray",width:2}}getNodeSymbol(e){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:30,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:2,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:25,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${e?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}}}exports.default=m;
|
package/lib/src/types/index.d.ts
CHANGED
|
@@ -280,6 +280,7 @@ export interface INode {
|
|
|
280
280
|
latitude: number;
|
|
281
281
|
name: string;
|
|
282
282
|
signalId?: string;
|
|
283
|
+
coordinates?: number[][];
|
|
283
284
|
}
|
|
284
285
|
export interface IEditSignalControlAreaParams {
|
|
285
286
|
crossesInArea: INode[];
|
|
@@ -290,5 +291,6 @@ export interface IEditSignalControlAreaParams {
|
|
|
290
291
|
removeCrossCallback: (params: {
|
|
291
292
|
id: string;
|
|
292
293
|
}) => void;
|
|
294
|
+
removeAllCrossCallback?: () => void;
|
|
293
295
|
odrServer: string;
|
|
294
296
|
}
|