gisviewer-vue3-arcgis 1.0.179 → 1.0.180
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 +3 -1
- package/es/src/gis-map/gis-map.vue.mjs +65 -60
- package/es/src/gis-map/index.d.ts +3 -1
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +18 -1
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +46 -13
- package/lib/src/gis-map/gis-map.vue.d.ts +3 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +3 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +18 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -125,10 +125,12 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
125
125
|
}) => Promise<import("../types").IResult>;
|
|
126
126
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
127
127
|
showSubSignalControlArea: (params: any) => import("../types").IResult;
|
|
128
|
-
editSubSignalControlArea: () => Promise<import("../types").IResult> | {
|
|
128
|
+
editSubSignalControlArea: (addCrossCallback: (id: string) => void, removeCrossCallback: (id: string) => void) => Promise<import("../types").IResult> | {
|
|
129
129
|
status: number;
|
|
130
130
|
message: string;
|
|
131
131
|
};
|
|
132
|
+
selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
133
|
+
unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
132
134
|
props: any;
|
|
133
135
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
134
136
|
SignalCountdownPanel: import("vue").DefineComponent<{
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import b, { registerStore as
|
|
1
|
+
import { defineComponent as Be, ref as k, reactive as Ne, onMounted as ze, getCurrentInstance as Qe, onUnmounted as je, computed as Ee, openBlock as C, createElementBlock as A, createElementVNode as g, withDirectives as Ze, vShow as $e, Fragment as qe, renderList as Ke, createBlock as Ue } from "vue";
|
|
2
|
+
import b, { registerStore as Ge } from "./stores/index.mjs";
|
|
3
3
|
import "./style/index.css";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import Je from "./utils/holo-flow/index.mjs";
|
|
5
|
+
import Re from "./utils/holo-flow/signal-countdown-panel.vue.mjs";
|
|
6
|
+
import We 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 Xe 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 Ye from "./utils/traffic-flow.mjs";
|
|
13
|
+
const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom: "80px", left: "10px", "z-index": "9999" } }, gt = /* @__PURE__ */ Be({
|
|
14
14
|
__name: "gis-map",
|
|
15
15
|
props: {
|
|
16
16
|
config: {},
|
|
@@ -19,83 +19,83 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
|
|
|
19
19
|
emits: ["mapLoaded", "markerClick", "mapClick"],
|
|
20
20
|
setup(M, { expose: _, emit: x }) {
|
|
21
21
|
const d = k(null);
|
|
22
|
-
let
|
|
22
|
+
let o, u, c, s, n, r, p, t, a;
|
|
23
23
|
const f = k(!1);
|
|
24
|
-
|
|
25
|
-
const H = b.useAppDataStore,
|
|
26
|
-
|
|
24
|
+
Ge();
|
|
25
|
+
const H = b.useAppDataStore, v = Ne([]);
|
|
26
|
+
ze(async () => {
|
|
27
27
|
if (!d.value)
|
|
28
28
|
return;
|
|
29
29
|
document.addEventListener("keydown", (m) => {
|
|
30
30
|
m.ctrlKey && m.key === "i" && (f.value = !f.value);
|
|
31
31
|
});
|
|
32
|
-
const e =
|
|
33
|
-
i.assetsRoot = O.assetsRoot ||
|
|
32
|
+
const e = Qe(), { $gisviewerAssetsRoot: l } = e.appContext.config.globalProperties, i = await (await fetch(O.config)).json();
|
|
33
|
+
i.assetsRoot = O.assetsRoot || l, H.mapConfig = i, u = new We(), o = await u.initialize({
|
|
34
34
|
container: d.value,
|
|
35
35
|
mapConfig: i,
|
|
36
|
-
markerClickCallback: (m, w, h,
|
|
37
|
-
y("markerClick", m, w, h,
|
|
36
|
+
markerClickCallback: (m, w, h, Ve) => {
|
|
37
|
+
y("markerClick", m, w, h, Ve);
|
|
38
38
|
},
|
|
39
39
|
mapClickCallback: (m, w, h) => {
|
|
40
40
|
y("mapClick", m, w, h);
|
|
41
41
|
}
|
|
42
|
-
}),
|
|
43
|
-
}),
|
|
44
|
-
|
|
42
|
+
}), n = new Je(o, v), await n.init(), y("mapLoaded");
|
|
43
|
+
}), je(() => {
|
|
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 = Ee(() => 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
|
S("vehicleId");
|
|
53
53
|
}, z = () => {
|
|
54
54
|
S("plateNumber");
|
|
55
|
-
}, Q = async (e) => await
|
|
56
|
-
|
|
55
|
+
}, Q = async (e) => await u.setMapCenter(e), j = async (e) => await u.setMapCamera(e), E = async (e) => await u.lookAt(e), Z = (e) => u.setLayerVisibility(e), $ = (e, l) => u.requestCoordinateTransform(e, l), q = (e) => {
|
|
56
|
+
u.cancelCoordinateTransform(e);
|
|
57
57
|
}, K = (e) => {
|
|
58
|
-
|
|
59
|
-
}, U = (e) => (c || (c = new T(
|
|
58
|
+
u.setMapZoomRange(e);
|
|
59
|
+
}, U = (e) => (c || (c = new T(o)), c.showLaneNumber(e)), G = () => {
|
|
60
60
|
c == null || c.clearLaneNumber();
|
|
61
|
-
}, J = async (e) => (c || (c = new T(
|
|
62
|
-
}, X = async (e,
|
|
63
|
-
|
|
61
|
+
}, J = async (e) => (c || (c = new T(o)), await c.initializeSearch(e)), R = async () => c == null ? void 0 : c.calCrossIndicatorArea(), W = async () => {
|
|
62
|
+
}, X = async (e, l) => {
|
|
63
|
+
s || (s = new Ye(o)), s.connectTrafficFlow(e, l);
|
|
64
64
|
}, Y = () => {
|
|
65
|
-
|
|
65
|
+
s == null || s.disconnectTrafficFlow();
|
|
66
66
|
}, F = async (e) => {
|
|
67
|
-
|
|
67
|
+
n.handleVehicleTraceData(e);
|
|
68
68
|
}, ee = () => {
|
|
69
|
-
|
|
69
|
+
n.clearHoloTrace();
|
|
70
70
|
}, te = (e) => {
|
|
71
|
-
|
|
71
|
+
n.setInterpolate(e);
|
|
72
72
|
}, ae = async (e) => {
|
|
73
|
-
await
|
|
73
|
+
await n.handleSignalData(e);
|
|
74
74
|
}, ne = () => {
|
|
75
|
-
|
|
75
|
+
n.clearHoloSignal();
|
|
76
76
|
}, re = (e) => {
|
|
77
|
-
|
|
78
|
-
}, oe = (e) => {
|
|
79
|
-
a == null || a.togglePause(e);
|
|
77
|
+
s == null || s.toggleTrafficInfo(e), n == null || n.toggleTrafficInfo(e);
|
|
80
78
|
}, se = (e) => {
|
|
81
|
-
|
|
79
|
+
n == null || n.togglePause(e);
|
|
80
|
+
}, oe = (e) => {
|
|
81
|
+
s == null || s.toggleTrafficObject(e), n == null || n.toggleTrafficObject(e);
|
|
82
82
|
}, S = (e) => {
|
|
83
|
-
|
|
84
|
-
}, ie = async (e) => (
|
|
85
|
-
|
|
86
|
-
}, ue = (e) =>
|
|
87
|
-
|
|
83
|
+
n == null || n.updatePanelContent(e);
|
|
84
|
+
}, ie = async (e) => (r || (r = new L(o)), r.addOverlays(e)), ce = (e) => (r || (r = new L(o)), r.addMask(e)), le = () => {
|
|
85
|
+
r == null || r.removeMask();
|
|
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
|
+
r == null || r.showAllOverlays();
|
|
88
88
|
}, de = (e) => {
|
|
89
|
-
p || (p = new
|
|
89
|
+
p || (p = new Xe(o)), p.updateQueueLength(e);
|
|
90
90
|
}, fe = () => {
|
|
91
91
|
p == null || p.removeQueueLength();
|
|
92
|
-
}, Se = async (e,
|
|
92
|
+
}, Se = async (e, l) => (t || (t = new D(o)), await t.showOpenDriveFromServer(e, l)), ye = async (e) => (t || (t = new D(o)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), we = async () => await (t == null ? void 0 : t.clearOpenDrive()), he = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
|
|
93
93
|
status: -1,
|
|
94
94
|
message: "未加载OpenDrive地图"
|
|
95
|
-
},
|
|
95
|
+
}, Ce = async (e) => t ? t.selectSumo(e) : {
|
|
96
96
|
status: -1,
|
|
97
97
|
message: "未加载OpenDrive地图"
|
|
98
|
-
},
|
|
98
|
+
}, ve = async (e) => t ? t.unselectSumo(e) : {
|
|
99
99
|
status: -1,
|
|
100
100
|
message: "未加载OpenDrive地图"
|
|
101
101
|
}, Oe = async (e) => t ? await t.geometrySearch(e) : {
|
|
@@ -110,9 +110,12 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
|
|
|
110
110
|
}, be = async () => t ? t == null ? void 0 : t.clearSplitLane() : {
|
|
111
111
|
status: -1,
|
|
112
112
|
message: "未加载OpenDrive地图"
|
|
113
|
-
}, De = (e) => (
|
|
114
|
-
|
|
115
|
-
}, Te = async (e) =>
|
|
113
|
+
}, De = (e) => (a || (a = new I(o)), a.showSignalControlArea(e)), Le = () => {
|
|
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, l) => a ? a.editSubSignalArea(
|
|
116
|
+
e,
|
|
117
|
+
l
|
|
118
|
+
) : { status: -1, message: "未加载信号控制区" }, He = (e) => a ? a.selectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, Pe = (e) => a ? a.unselectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, O = M, y = x;
|
|
116
119
|
return _({
|
|
117
120
|
mapViewer: P,
|
|
118
121
|
setLayerVisibility: Z,
|
|
@@ -142,9 +145,9 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
|
|
|
142
145
|
clearHoloSignal: ne,
|
|
143
146
|
setInterpolate: te,
|
|
144
147
|
toggleTrafficInfo: re,
|
|
145
|
-
toggleTrafficObject:
|
|
148
|
+
toggleTrafficObject: oe,
|
|
146
149
|
toggleVehicleInfo: S,
|
|
147
|
-
togglePause:
|
|
150
|
+
togglePause: se,
|
|
148
151
|
updateQueueLength: de,
|
|
149
152
|
removeQueueLength: fe,
|
|
150
153
|
showOpenDriveFromServer: Se,
|
|
@@ -152,8 +155,8 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
|
|
|
152
155
|
clearOpenDrive: we,
|
|
153
156
|
geometrySearchInOpenDrive: Oe,
|
|
154
157
|
findSumoInOpenDrive: he,
|
|
155
|
-
selectSumoInOpenDrive:
|
|
156
|
-
unselectSumoInOpenDrive:
|
|
158
|
+
selectSumoInOpenDrive: Ce,
|
|
159
|
+
unselectSumoInOpenDrive: ve,
|
|
157
160
|
getSumoInfo: ke,
|
|
158
161
|
splitOpenDriveLane: Ae,
|
|
159
162
|
clearSplitOpenDriveLane: be,
|
|
@@ -163,14 +166,16 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
|
|
|
163
166
|
highlightSignalControlArea: Ie,
|
|
164
167
|
resetHighlightSignalControlArea: Me,
|
|
165
168
|
showSubSignalControlArea: _e,
|
|
166
|
-
editSubSignalControlArea: xe
|
|
167
|
-
|
|
169
|
+
editSubSignalControlArea: xe,
|
|
170
|
+
selectSubSignalControlAreaCross: He,
|
|
171
|
+
unselectSubSignalControlAreaCross: Pe
|
|
172
|
+
}), (e, l) => (C(), A("div", Fe, [
|
|
168
173
|
g("div", {
|
|
169
174
|
class: "gis-viewer-main",
|
|
170
175
|
ref_key: "mapContainer",
|
|
171
176
|
ref: d
|
|
172
177
|
}, [
|
|
173
|
-
|
|
178
|
+
Ze(g("div", et, [
|
|
174
179
|
g("button", {
|
|
175
180
|
style: { "margin-right": "10px" },
|
|
176
181
|
onClick: V
|
|
@@ -185,10 +190,10 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
|
|
|
185
190
|
}, " 显示车辆id "),
|
|
186
191
|
g("button", { onClick: z }, "显示车辆号牌")
|
|
187
192
|
], 512), [
|
|
188
|
-
[
|
|
193
|
+
[$e, f.value]
|
|
189
194
|
])
|
|
190
195
|
], 512),
|
|
191
|
-
(
|
|
196
|
+
(C(!0), A(qe, null, Ke(v, (i, m) => (C(), Ue(Re, {
|
|
192
197
|
key: m,
|
|
193
198
|
"display-mode": i.displayMode,
|
|
194
199
|
"road-id": i.crossId,
|
|
@@ -204,5 +209,5 @@ const Xe = { class: "gis-viewer" }, Ye = { style: { position: "absolute", bottom
|
|
|
204
209
|
}
|
|
205
210
|
});
|
|
206
211
|
export {
|
|
207
|
-
|
|
212
|
+
gt as default
|
|
208
213
|
};
|
|
@@ -114,10 +114,12 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
114
114
|
}) => Promise<import("../types").IResult>;
|
|
115
115
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
116
116
|
showSubSignalControlArea: (params: any) => import("../types").IResult;
|
|
117
|
-
editSubSignalControlArea: () => Promise<import("../types").IResult> | {
|
|
117
|
+
editSubSignalControlArea: (addCrossCallback: (id: string) => void, removeCrossCallback: (id: string) => void) => Promise<import("../types").IResult> | {
|
|
118
118
|
status: number;
|
|
119
119
|
message: string;
|
|
120
120
|
};
|
|
121
|
+
selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
122
|
+
unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
121
123
|
props: any;
|
|
122
124
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
123
125
|
SignalCountdownPanel: import("vue").DefineComponent<{
|
|
@@ -26,12 +26,29 @@ export default class SignalControlAreaController {
|
|
|
26
26
|
* @returns
|
|
27
27
|
*/
|
|
28
28
|
private handleViewClick;
|
|
29
|
+
/**
|
|
30
|
+
* 显示周边的路口
|
|
31
|
+
* @param crossIds
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
29
34
|
private showNearbyCrosses;
|
|
35
|
+
private addCrossCallback;
|
|
36
|
+
private removeCrossCallback;
|
|
30
37
|
/**
|
|
31
38
|
* 编辑子区的路口
|
|
32
39
|
* @returns
|
|
33
40
|
*/
|
|
34
|
-
editSubSignalArea(): Promise<IResult>;
|
|
41
|
+
editSubSignalArea(addCrossCallback: (id: string) => void, removeCrossCallback: (id: string) => void): Promise<IResult>;
|
|
42
|
+
/**
|
|
43
|
+
* 从外部接口选中一个路口
|
|
44
|
+
* @param id
|
|
45
|
+
*/
|
|
46
|
+
selectSubSignalControlAreaCross(id: string): IResult;
|
|
47
|
+
/**
|
|
48
|
+
* 从外部接口取消选中一个路口
|
|
49
|
+
* @param id
|
|
50
|
+
*/
|
|
51
|
+
unselectSubSignalControlAreaCross(id: string): IResult;
|
|
35
52
|
/**
|
|
36
53
|
* 在区控\子区\路口图层中查找对应的graphic
|
|
37
54
|
* @param id
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as g from "@arcgis/core/core/reactiveUtils.js";
|
|
2
2
|
import c from "@arcgis/core/Graphic";
|
|
3
3
|
import y from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import p from "@turf/buffer";
|
|
5
|
+
import b from "@turf/convex";
|
|
6
6
|
import * as n from "@turf/helpers";
|
|
7
|
-
import
|
|
7
|
+
import d from "axios";
|
|
8
8
|
import f from "concaveman";
|
|
9
9
|
import C from "../../stores/index.mjs";
|
|
10
10
|
import v from "./district-controller.mjs";
|
|
@@ -141,10 +141,19 @@ class N {
|
|
|
141
141
|
if (r.length === 0)
|
|
142
142
|
return;
|
|
143
143
|
const s = r[0].graphic;
|
|
144
|
-
s.getAttribute("selected")
|
|
144
|
+
s.getAttribute("selected") ? s.getAttribute("signalId") && (this.removeCrossCallback && this.removeCrossCallback(s.getAttribute("id")), s.setAttribute("selected", !1), s.symbol = this.getCrossSymbolInSubDistrict(
|
|
145
|
+
s.attributes
|
|
146
|
+
)) : (s.getAttribute("signalId") && (this.addCrossCallback && this.addCrossCallback(s.getAttribute("id")), s.setAttribute("selected", !0), s.symbol = this.getCrossSymbolInSubDistrict(
|
|
147
|
+
s.attributes
|
|
148
|
+
)), await this.showNearbyCrosses(s.getAttribute("id")));
|
|
145
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* 显示周边的路口
|
|
152
|
+
* @param crossIds
|
|
153
|
+
* @returns
|
|
154
|
+
*/
|
|
146
155
|
async showNearbyCrosses(e) {
|
|
147
|
-
const t = await
|
|
156
|
+
const t = await d.get(
|
|
148
157
|
`http://${this.openDriveServer}/api/computable/getRelatedJunctionsForJunction`,
|
|
149
158
|
{ params: { junctionIds: e } }
|
|
150
159
|
);
|
|
@@ -184,16 +193,40 @@ class N {
|
|
|
184
193
|
* 编辑子区的路口
|
|
185
194
|
* @returns
|
|
186
195
|
*/
|
|
187
|
-
async editSubSignalArea() {
|
|
196
|
+
async editSubSignalArea(e, t) {
|
|
188
197
|
if (this.openDriveServer) {
|
|
189
|
-
this.clickWatcher || (this.clickWatcher = this.view.on("click", async (
|
|
190
|
-
await this.handleViewClick(
|
|
198
|
+
this.addCrossCallback = e, this.removeCrossCallback = t, this.clickWatcher || (this.clickWatcher = this.view.on("click", async (s) => {
|
|
199
|
+
await this.handleViewClick(s);
|
|
191
200
|
}));
|
|
192
|
-
const
|
|
193
|
-
return await this.showNearbyCrosses(
|
|
201
|
+
const r = this.crossLayer.graphics.toArray().map((s) => s.getAttribute("id")).join(",");
|
|
202
|
+
return await this.showNearbyCrosses(r);
|
|
194
203
|
} else
|
|
195
204
|
return { status: 1, message: "未配置OpenDriveServer" };
|
|
196
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* 从外部接口选中一个路口
|
|
208
|
+
* @param id
|
|
209
|
+
*/
|
|
210
|
+
selectSubSignalControlAreaCross(e) {
|
|
211
|
+
return this.crossLayer.graphics.forEach((t) => {
|
|
212
|
+
if (t.getAttribute("id") === e && !t.getAttribute("selected"))
|
|
213
|
+
return t.setAttribute("selected", !0), t.symbol = this.getCrossSymbolInSubDistrict(
|
|
214
|
+
t.attributes
|
|
215
|
+
), { status: 0, message: "ok" };
|
|
216
|
+
}), { status: 0, message: "未找到" };
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* 从外部接口取消选中一个路口
|
|
220
|
+
* @param id
|
|
221
|
+
*/
|
|
222
|
+
unselectSubSignalControlAreaCross(e) {
|
|
223
|
+
return this.crossLayer.graphics.forEach((t) => {
|
|
224
|
+
if (t.getAttribute("id") === e && t.getAttribute("selected"))
|
|
225
|
+
return t.setAttribute("selected", !1), t.symbol = this.getCrossSymbolInSubDistrict(
|
|
226
|
+
t.attributes
|
|
227
|
+
), { status: 0, message: "ok" };
|
|
228
|
+
}), { status: 0, message: "未找到" };
|
|
229
|
+
}
|
|
197
230
|
/**
|
|
198
231
|
* 在区控\子区\路口图层中查找对应的graphic
|
|
199
232
|
* @param id
|
|
@@ -222,16 +255,16 @@ class N {
|
|
|
222
255
|
else {
|
|
223
256
|
if (t) {
|
|
224
257
|
const h = n.featureCollection(
|
|
225
|
-
r.map((
|
|
258
|
+
r.map((u) => n.point(u))
|
|
226
259
|
);
|
|
227
|
-
i =
|
|
260
|
+
i = b(h);
|
|
228
261
|
} else {
|
|
229
262
|
const h = f(r, 0.5);
|
|
230
263
|
h.length >= 4 && (i = n.polygon([h]));
|
|
231
264
|
}
|
|
232
265
|
i || (i = n.lineString(r));
|
|
233
266
|
}
|
|
234
|
-
const a =
|
|
267
|
+
const a = p(
|
|
235
268
|
i.geometry,
|
|
236
269
|
// 区控面积更大,需要更大的缓冲半径
|
|
237
270
|
t ? 200 : 30,
|
|
@@ -125,10 +125,12 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
125
125
|
}) => Promise<import("../types").IResult>;
|
|
126
126
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
127
127
|
showSubSignalControlArea: (params: any) => import("../types").IResult;
|
|
128
|
-
editSubSignalControlArea: () => Promise<import("../types").IResult> | {
|
|
128
|
+
editSubSignalControlArea: (addCrossCallback: (id: string) => void, removeCrossCallback: (id: string) => void) => Promise<import("../types").IResult> | {
|
|
129
129
|
status: number;
|
|
130
130
|
message: string;
|
|
131
131
|
};
|
|
132
|
+
selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
133
|
+
unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
132
134
|
props: any;
|
|
133
135
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
134
136
|
SignalCountdownPanel: import("vue").DefineComponent<{
|
|
@@ -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("vue"),h=require("./stores/index.js");require("./style/index.css");const Me=require("./utils/holo-flow/index.js"),Ve=require("./utils/holo-flow/signal-countdown-panel.vue.js"),Ne=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"},Ee={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},ze=n.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(D,{expose:T,emit:_}){const p=n.ref(null);let i,m,l,o,r,s,g,t,a;const f=n.ref(!1);h.registerStore();const I=h.default.useAppDataStore,C=n.reactive([]);n.onMounted(async()=>{if(!p.value)return;document.addEventListener("keydown",d=>{d.ctrlKey&&d.key==="i"&&(f.value=!f.value)});const e=n.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,c=await(await fetch(k.config)).json();c.assetsRoot=k.assetsRoot||u,I.mapConfig=c,m=new Ne.default,i=await m.initialize({container:p.value,mapConfig:c,markerClickCallback:(d,v,w,qe)=>{y("markerClick",d,v,w,qe)},mapClickCallback:(d,v,w)=>{y("mapClick",d,v,w)}}),r=new Me.default(i,C),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=h.default.useAppDataStore;e.saveTrackLog=!0},M=()=>{r.downloadTrackLog()},V=()=>{S("vehicleId")},N=()=>{S("plateNumber")},B=async e=>await m.setMapCenter(e),H=async e=>await m.setMapCamera(e),P=async e=>await m.lookAt(e),E=e=>m.setLayerVisibility(e),z=(e,u)=>m.requestCoordinateTransform(e,u),j=e=>{m.cancelCoordinateTransform(e)},Q=e=>{m.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,u)=>{o||(o=new He.default(i)),o.connectTrafficFlow(e,u)},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()},me=e=>{g||(g=new Be.default(i)),g.updateQueueLength(e)},de=()=>{g==null||g.removeQueueLength()},ge=async(e,u)=>(t||(t=new O.default(i)),await t.showOpenDriveFromServer(e,u)),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地图"},he=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Ce=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,u)=>a?a.editSubSignalArea(e,u):{status:-1,message:"未加载信号控制区"},Ie=e=>a?a.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},xe=e=>a?a.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},k=D,y=_;return T({mapViewer:x,setLayerVisibility:E,setMapCenter:B,lookAt:P,setMapCamera:H,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:me,removeQueueLength:de,showOpenDriveFromServer:ge,showOpenDriveFromFile:pe,clearOpenDrive:fe,geometrySearchInOpenDrive:we,findSumoInOpenDrive:Se,selectSumoInOpenDrive:ye,unselectSumoInOpenDrive:ve,getSumoInfo:he,splitOpenDriveLane:Ce,clearSplitOpenDriveLane:ke,showSignalControlArea:Oe,clearSignalControlArea:be,locateSignalControlArea:Ae,highlightSignalControlArea:Le,resetHighlightSignalControlArea:De,showSubSignalControlArea:Te,editSubSignalControlArea:_e,selectSubSignalControlAreaCross:Ie,unselectSubSignalControlAreaCross:xe}),(e,u)=>(n.openBlock(),n.createElementBlock("div",Pe,[n.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:p},[n.withDirectives(n.createElementVNode("div",Ee,[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(C,(c,d)=>(n.openBlock(),n.createBlock(Ve.default,{key:d,"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=ze;
|
|
@@ -114,10 +114,12 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
114
114
|
}) => Promise<import("../types").IResult>;
|
|
115
115
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
116
116
|
showSubSignalControlArea: (params: any) => import("../types").IResult;
|
|
117
|
-
editSubSignalControlArea: () => Promise<import("../types").IResult> | {
|
|
117
|
+
editSubSignalControlArea: (addCrossCallback: (id: string) => void, removeCrossCallback: (id: string) => void) => Promise<import("../types").IResult> | {
|
|
118
118
|
status: number;
|
|
119
119
|
message: string;
|
|
120
120
|
};
|
|
121
|
+
selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
122
|
+
unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
|
|
121
123
|
props: any;
|
|
122
124
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
123
125
|
SignalCountdownPanel: import("vue").DefineComponent<{
|
|
@@ -26,12 +26,29 @@ export default class SignalControlAreaController {
|
|
|
26
26
|
* @returns
|
|
27
27
|
*/
|
|
28
28
|
private handleViewClick;
|
|
29
|
+
/**
|
|
30
|
+
* 显示周边的路口
|
|
31
|
+
* @param crossIds
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
29
34
|
private showNearbyCrosses;
|
|
35
|
+
private addCrossCallback;
|
|
36
|
+
private removeCrossCallback;
|
|
30
37
|
/**
|
|
31
38
|
* 编辑子区的路口
|
|
32
39
|
* @returns
|
|
33
40
|
*/
|
|
34
|
-
editSubSignalArea(): Promise<IResult>;
|
|
41
|
+
editSubSignalArea(addCrossCallback: (id: string) => void, removeCrossCallback: (id: string) => void): Promise<IResult>;
|
|
42
|
+
/**
|
|
43
|
+
* 从外部接口选中一个路口
|
|
44
|
+
* @param id
|
|
45
|
+
*/
|
|
46
|
+
selectSubSignalControlAreaCross(id: string): IResult;
|
|
47
|
+
/**
|
|
48
|
+
* 从外部接口取消选中一个路口
|
|
49
|
+
* @param id
|
|
50
|
+
*/
|
|
51
|
+
unselectSubSignalControlAreaCross(id: string): IResult;
|
|
35
52
|
/**
|
|
36
53
|
* 在区控\子区\路口图层中查找对应的graphic
|
|
37
54
|
* @param id
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils.js"),y=require("@arcgis/core/Graphic"),u=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/buffer"),f=require("@turf/convex"),C=require("@turf/helpers"),v=require("axios"),S=require("concaveman"),L=require("../../stores/index.js"),w=require("./district-controller.js");function p(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const I=p(d),c=p(C);class A{constructor(e){var s;this.crossScale=5e3,this.view=e;const i=L.default.useAppDataStore.mapConfig;this.openDriveServer=(s=i.openDriveServer)==null?void 0:s.url,this.districtControllerLayer=new u({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new u({id:"subDistrictControllerLayer",visible:!1}),this.crossLayer=new u({id:"crossLayer",visible:!1}),this.highlightLayer=new u({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){const i=new w.default(t);this.drawArea(i,!0)}return this.scaleWatcher=I.watch(()=>this.view.scale,(t,i)=>{t>this.crossScale&&i<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):t<=this.crossScale&&i>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.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(r=>r.getAttribute("id")===e.id).toArray().map(r=>{const a=r.clone();return a.symbol.style="none",a}),i=this.subDistrictControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("parentId")===e.id).toArray().map(r=>r.clone()),s=this.crossLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("districtId")===e.id||r.getAttribute("subDistrictId")===e.id).toArray().map(r=>r.clone());if(t.length>0&&this.highlightLayer.addMany(t),i.length>0&&this.highlightLayer.addMany(i),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(t.length>0)await this.view.goTo(t);else if(i.length>0){const r=i[0].geometry.centroid;await this.view.goTo({target:r,scale:this.crossScale-500})}else s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[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(s=>{const r={...s,selected:!0};return new y({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossSymbolInSubDistrict(r),attributes:r})});return this.crossLayer.addMany(i),this.view.goTo(i),{status:0,message:"ok"}}async handleViewClick(e){var r;const i=(r=(await this.view.hitTest(e,{include:[this.crossLayer]})).results)==null?void 0:r.filter(a=>a.type==="graphic");if(i.length===0)return;const s=i[0].graphic;s.getAttribute("selected")||await this.showNearbyCrosses(s.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,s=[];return i.forEach(r=>{const{junctionId:a}=r;if(!this.crossLayer.graphics.some(n=>n.getAttribute("id")===a)){const n=new y({geometry:{type:"point",x:r.lon,y:r.lat},symbol:this.getCrossSymbolInSubDistrict(r),attributes:{id:r.junctionId,name:r.name,signalId:r.signalId,selected:!1}});s.push(n)}}),this.crossLayer.addMany(s),{status:0,message:"ok"}}else return{status:-1,message:t.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalArea(){if(this.openDriveServer){this.clickWatcher||(this.clickWatcher=this.view.on("click",async t=>{await this.handleViewClick(t)}));const e=this.crossLayer.graphics.toArray().map(t=>t.getAttribute("id")).join(",");return await this.showNearbyCrosses(e)}else return{status:1,message:"未配置OpenDriveServer"}}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 r=null;if(i.length===2)r=c.lineString(i);else{if(t){const h=c.featureCollection(i.map(m=>c.point(m)));r=f(h)}else{const h=S(i,.5);h.length>=4&&(r=c.polygon([h]))}r||(r=c.lineString(i))}const a=b(r.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const n={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},g=new y({geometry:{type:"polygon",rings:a.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.2],outline:{color:e.areaColor,width:3,style:t?"solid":"long-dash"}},attributes:n,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(g):this.subDistrictControllerLayer.add(g)}for(const r of e.subDistricts)this.drawArea(r,!1);const s=[];e.crosses.forEach(r=>{const a={type:"cross",id:r.id,name:r.name,color:e.areaColor,signalId:r.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:r.isKey},l=new y({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:this.getCrossGraphicSymbol(a,"marker"),attributes:a,popupTemplate:{title:r.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});s.push(l)}),this.crossLayer.addMany(s)}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:s}=e;if(t==="marker")return i?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:s,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_gjxk_blue":"gis_xhj_blue"}.png`}]}}}}}exports.default=A;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),u=require("@arcgis/core/Graphic"),y=require("@arcgis/core/layers/GraphicsLayer"),d=require("@turf/buffer"),f=require("@turf/convex"),C=require("@turf/helpers"),v=require("axios"),S=require("concaveman"),A=require("../../stores/index.js"),I=require("./district-controller.js");function m(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const L=m(b),c=m(C);class w{constructor(t){var s;this.crossScale=5e3,this.view=t;const r=A.default.useAppDataStore.mapConfig;this.openDriveServer=(s=r.openDriveServer)==null?void 0:s.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(t){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 e of t){const r=new I.default(e);this.drawArea(r,!0)}return this.scaleWatcher=L.watch(()=>this.view.scale,(e,r)=>{e>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):e<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var t,e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(t=this.scaleWatcher)==null||t.remove(),this.scaleWatcher=void 0,(e=this.clickWatcher)==null||e.remove(),this.clickWatcher=void 0,this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(t){const e=this.findAreaGraphic(t.id);return e?(e.attributes.type==="cross"?await this.view.goTo({target:e.geometry,scale:1500}):await this.view.goTo(e.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}async highlightSignalControlArea(t){if(!t.id||t.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1;const e=this.districtControllerLayer.graphics.filter(i=>i.getAttribute("id")===t.id).toArray().map(i=>{const a=i.clone();return a.symbol.style="none",a}),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===t.id||i.getAttribute("parentId")===t.id).toArray().map(i=>i.clone()),s=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===t.id||i.getAttribute("districtId")===t.id||i.getAttribute("subDistrictId")===t.id).toArray().map(i=>i.clone());if(e.length>0&&this.highlightLayer.addMany(e),r.length>0&&this.highlightLayer.addMany(r),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(e.length>0)await this.view.goTo(e);else if(r.length>0){const i=r[0].geometry.centroid;await this.view.goTo({target:i,scale:this.crossScale-500})}else s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[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(t){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const r=t.children.map(s=>{const i={...s,selected:!0};return new u({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossSymbolInSubDistrict(i),attributes:i})});return this.crossLayer.addMany(r),this.view.goTo(r),{status:0,message:"ok"}}async handleViewClick(t){var i;const r=(i=(await this.view.hitTest(t,{include:[this.crossLayer]})).results)==null?void 0:i.filter(a=>a.type==="graphic");if(r.length===0)return;const s=r[0].graphic;s.getAttribute("selected")?s.getAttribute("signalId")&&(this.removeCrossCallback&&this.removeCrossCallback(s.getAttribute("id")),s.setAttribute("selected",!1),s.symbol=this.getCrossSymbolInSubDistrict(s.attributes)):(s.getAttribute("signalId")&&(this.addCrossCallback&&this.addCrossCallback(s.getAttribute("id")),s.setAttribute("selected",!0),s.symbol=this.getCrossSymbolInSubDistrict(s.attributes)),await this.showNearbyCrosses(s.getAttribute("id")))}async showNearbyCrosses(t){const e=await v.get(`http://${this.openDriveServer}/api/computable/getRelatedJunctionsForJunction`,{params:{junctionIds:t}});if(e.status===200)if(e.data.status===0){const r=e.data.result,s=[];return r.forEach(i=>{const{junctionId:a}=i;if(!this.crossLayer.graphics.some(n=>n.getAttribute("id")===a)){const n=new u({geometry:{type:"point",x:i.lon,y:i.lat},symbol:this.getCrossSymbolInSubDistrict(i),attributes:{id:i.junctionId,name:i.name,signalId:i.signalId,selected:!1}});s.push(n)}}),this.crossLayer.addMany(s),{status:0,message:"ok"}}else return{status:-1,message:e.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalArea(t,e){if(this.openDriveServer){this.addCrossCallback=t,this.removeCrossCallback=e,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"}}selectSubSignalControlAreaCross(t){return this.crossLayer.graphics.forEach(e=>{if(e.getAttribute("id")===t&&!e.getAttribute("selected"))return e.setAttribute("selected",!0),e.symbol=this.getCrossSymbolInSubDistrict(e.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}unselectSubSignalControlAreaCross(t){return this.crossLayer.graphics.forEach(e=>{if(e.getAttribute("id")===t&&e.getAttribute("selected"))return e.setAttribute("selected",!1),e.symbol=this.getCrossSymbolInSubDistrict(e.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}findAreaGraphic(t){let e=this.districtControllerLayer.graphics.find(r=>r.attributes.id===t);return e||(e=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===t)),e||(e=this.crossLayer.graphics.find(r=>r.attributes.id===t)),e}drawArea(t,e){const r=t.getAllCrossCoordinates();if(r.length>=2){let i=null;if(r.length===2)i=c.lineString(r);else{if(e){const h=c.featureCollection(r.map(p=>c.point(p)));i=f(h)}else{const h=S(r,.5);h.length>=4&&(i=c.polygon([h]))}i||(i=c.lineString(r))}const a=d(i.geometry,e?200:30,{units:"meters"});let l;e?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const n={type:"signalControlArea",id:t.id,name:t.name,parentId:t.parentId,parentName:t.parentName,crossCount:t.crossCount,subDistrictCount:t.subDistrictCount},g=new u({geometry:{type:"polygon",rings:a.geometry.coordinates},symbol:{type:"simple-fill",color:[...t.areaColor,.2],outline:{color:t.areaColor,width:3,style:e?"solid":"long-dash"}},attributes:n,popupTemplate:{title:`${e?"区控":"子区"} ${t.name}`,content:[{type:"fields",fieldInfos:l}]}});e?this.districtControllerLayer.add(g):this.subDistrictControllerLayer.add(g)}for(const i of t.subDistricts)this.drawArea(i,!1);const s=[];t.crosses.forEach(i=>{const a={type:"cross",id:i.id,name:i.name,color:t.areaColor,signalId:i.signalId,districtId:e?t.id:t.parentId,districtName:e?t.name:t.parentName,subDistrictId:e?"":t.id,subDistrictName:e?"":t.name,isKey:i.isKey},l=new u({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossGraphicSymbol(a,"marker"),attributes:a,popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});s.push(l)}),this.crossLayer.addMany(s)}getCrossSymbolInSubDistrict(t){return t.signalId&&t.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/${t.selected?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz.png",width:"20px",height:"20px"}}getCrossGraphicSymbol(t,e){const{isKey:r,color:s}=t;if(e==="marker")return r?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:s,size:8,outline:{color:"white",width:1}};if(e==="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_gjxk_blue":"gis_xhj_blue"}.png`}]}}}}}exports.default=w;
|