gisviewer-vue3-arcgis 1.0.185 → 1.0.187
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 -11
- package/es/src/gis-map/gis-map.vue.mjs +37 -41
- package/es/src/gis-map/index.d.ts +2 -10
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +8 -8
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.d.ts +6 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +109 -39
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +3 -11
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +67 -41
- package/es/src/types/index.d.ts +18 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +3 -11
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +2 -10
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.d.ts +6 -0
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +3 -11
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/lib/src/types/index.d.ts +18 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MapView from '@arcgis/core/views/MapView';
|
|
2
2
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
-
import { IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IMaskParam, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowOpenDriveFromFileParams, ISignalCountdownProps, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams, IUnselectSumoParams } from '../types';
|
|
3
|
+
import { IEditSignalControlAreaParams, IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IMaskParam, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowOpenDriveFromFileParams, IShowSignalControlAreaParams, ISignalCountdownProps, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams, IUnselectSumoParams } from '../types';
|
|
4
4
|
import HoloFlow from './utils/holo-flow';
|
|
5
5
|
import MapInitializer from './utils/map-initializer';
|
|
6
6
|
import OpenDriveRenderer from './utils/open-drive-renderer';
|
|
@@ -115,10 +115,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
115
115
|
status: number;
|
|
116
116
|
message: string;
|
|
117
117
|
}>;
|
|
118
|
-
showSignalControlArea: (params:
|
|
119
|
-
areaList: any[];
|
|
120
|
-
style?: string;
|
|
121
|
-
}) => import("../types").IResult;
|
|
118
|
+
showSignalControlArea: (params: IShowSignalControlAreaParams) => import("../types").IResult;
|
|
122
119
|
clearSignalControlArea: () => void;
|
|
123
120
|
locateSignalControlArea: (params: {
|
|
124
121
|
id: string;
|
|
@@ -128,12 +125,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
128
125
|
}) => Promise<import("../types").IResult>;
|
|
129
126
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
130
127
|
showSubSignalControlArea: (params: any) => import("../types").IResult;
|
|
131
|
-
editSubSignalControlArea: (
|
|
132
|
-
id: string;
|
|
133
|
-
name: string;
|
|
134
|
-
}) => void, removeCrossCallback: (params: {
|
|
135
|
-
id: string;
|
|
136
|
-
}) => void) => Promise<import("../types").IResult> | {
|
|
128
|
+
editSubSignalControlArea: (params: IEditSignalControlAreaParams) => Promise<import("../types").IResult> | {
|
|
137
129
|
status: number;
|
|
138
130
|
message: string;
|
|
139
131
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
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 h, createElementBlock as A, createElementVNode as g, withDirectives as Ze, vShow as $e, Fragment as qe, renderList as Ke, createBlock as Ue } from "vue";
|
|
2
2
|
import b, { registerStore as Ge } from "./stores/index.mjs";
|
|
3
3
|
import "./style/index.css";
|
|
4
4
|
import Je from "./utils/holo-flow/index.mjs";
|
|
@@ -19,7 +19,7 @@ const Fe = { class: "gis-viewer" }, et = { 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, l, c, s, n, r, p, t, a;
|
|
23
23
|
const f = k(!1);
|
|
24
24
|
Ge();
|
|
25
25
|
const H = b.useAppDataStore, v = Ne([]);
|
|
@@ -29,21 +29,21 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
29
29
|
document.addEventListener("keydown", (m) => {
|
|
30
30
|
m.ctrlKey && m.key === "i" && (f.value = !f.value);
|
|
31
31
|
});
|
|
32
|
-
const e = Qe(), { $gisviewerAssetsRoot:
|
|
33
|
-
|
|
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 We(), o = await l.initialize({
|
|
34
34
|
container: d.value,
|
|
35
|
-
mapConfig:
|
|
36
|
-
markerClickCallback: (m, w,
|
|
37
|
-
y("markerClick", m, w,
|
|
35
|
+
mapConfig: i,
|
|
36
|
+
markerClickCallback: (m, w, C, Ve) => {
|
|
37
|
+
y("markerClick", m, w, C, Ve);
|
|
38
38
|
},
|
|
39
|
-
mapClickCallback: (m, w,
|
|
40
|
-
y("mapClick", m, w,
|
|
39
|
+
mapClickCallback: (m, w, C) => {
|
|
40
|
+
y("mapClick", m, w, C);
|
|
41
41
|
}
|
|
42
|
-
}), n = new Je(
|
|
42
|
+
}), n = new Je(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 = Ee(() =>
|
|
46
|
+
const P = Ee(() => o), V = () => {
|
|
47
47
|
const e = b.useAppDataStore;
|
|
48
48
|
e.saveTrackLog = !0;
|
|
49
49
|
}, B = () => {
|
|
@@ -52,15 +52,15 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
52
52
|
S("vehicleId");
|
|
53
53
|
}, z = () => {
|
|
54
54
|
S("plateNumber");
|
|
55
|
-
}, Q = async (e) => await
|
|
56
|
-
|
|
55
|
+
}, Q = async (e) => await l.setMapCenter(e), j = async (e) => await l.setMapCamera(e), E = async (e) => await l.lookAt(e), Z = (e) => l.setLayerVisibility(e), $ = (e, u) => l.requestCoordinateTransform(e, u), q = (e) => {
|
|
56
|
+
l.cancelCoordinateTransform(e);
|
|
57
57
|
}, K = (e) => {
|
|
58
|
-
|
|
59
|
-
}, U = (e) => (c || (c = new T(
|
|
58
|
+
l.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
|
-
s || (s = new Ye(
|
|
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, u) => {
|
|
63
|
+
s || (s = new Ye(o)), s.connectTrafficFlow(e, u);
|
|
64
64
|
}, Y = () => {
|
|
65
65
|
s == null || s.disconnectTrafficFlow();
|
|
66
66
|
}, F = async (e) => {
|
|
@@ -81,18 +81,18 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
81
81
|
s == null || s.toggleTrafficObject(e), n == null || n.toggleTrafficObject(e);
|
|
82
82
|
}, S = (e) => {
|
|
83
83
|
n == null || n.updatePanelContent(e);
|
|
84
|
-
}, ie = async (e) => (r || (r = new L(
|
|
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 Xe(
|
|
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, 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)), we = async () => await (t == null ? void 0 : t.clearOpenDrive()), Ce = 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) : {
|
|
96
96
|
status: -1,
|
|
97
97
|
message: "未加载OpenDrive地图"
|
|
98
98
|
}, ve = async (e) => t ? t.unselectSumo(e) : {
|
|
@@ -110,13 +110,9 @@ const Fe = { class: "gis-viewer" }, et = { 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) => (a || (a = new I(
|
|
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(
|
|
116
|
-
e,
|
|
117
|
-
l,
|
|
118
|
-
o
|
|
119
|
-
) : { 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;
|
|
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: "未加载信号控制区" }, Pe = (e) => a ? a.unselectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, O = M, y = x;
|
|
120
116
|
return _({
|
|
121
117
|
mapViewer: P,
|
|
122
118
|
setLayerVisibility: Z,
|
|
@@ -155,8 +151,8 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
155
151
|
showOpenDriveFromFile: ye,
|
|
156
152
|
clearOpenDrive: we,
|
|
157
153
|
geometrySearchInOpenDrive: Oe,
|
|
158
|
-
findSumoInOpenDrive:
|
|
159
|
-
selectSumoInOpenDrive:
|
|
154
|
+
findSumoInOpenDrive: Ce,
|
|
155
|
+
selectSumoInOpenDrive: he,
|
|
160
156
|
unselectSumoInOpenDrive: ve,
|
|
161
157
|
getSumoInfo: ke,
|
|
162
158
|
splitOpenDriveLane: Ae,
|
|
@@ -170,7 +166,7 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
170
166
|
editSubSignalControlArea: xe,
|
|
171
167
|
selectSubSignalControlAreaCross: He,
|
|
172
168
|
unselectSubSignalControlAreaCross: Pe
|
|
173
|
-
}), (e,
|
|
169
|
+
}), (e, u) => (h(), A("div", Fe, [
|
|
174
170
|
g("div", {
|
|
175
171
|
class: "gis-viewer-main",
|
|
176
172
|
ref_key: "mapContainer",
|
|
@@ -194,17 +190,17 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
194
190
|
[$e, f.value]
|
|
195
191
|
])
|
|
196
192
|
], 512),
|
|
197
|
-
(
|
|
193
|
+
(h(!0), A(qe, null, Ke(v, (i, m) => (h(), Ue(Re, {
|
|
198
194
|
key: m,
|
|
199
|
-
"display-mode":
|
|
200
|
-
"road-id":
|
|
201
|
-
"cross-id":
|
|
202
|
-
"map-point":
|
|
203
|
-
"stop-line":
|
|
204
|
-
position:
|
|
205
|
-
rotation:
|
|
206
|
-
scale:
|
|
207
|
-
"lamp-status":
|
|
195
|
+
"display-mode": i.displayMode,
|
|
196
|
+
"road-id": i.crossId,
|
|
197
|
+
"cross-id": i.roadId,
|
|
198
|
+
"map-point": i.mapPoint,
|
|
199
|
+
"stop-line": i.stopLine,
|
|
200
|
+
position: i.position,
|
|
201
|
+
rotation: i.rotation,
|
|
202
|
+
scale: i.scale,
|
|
203
|
+
"lamp-status": i.lampStatus
|
|
208
204
|
}, null, 8, ["display-mode", "road-id", "cross-id", "map-point", "stop-line", "position", "rotation", "scale", "lamp-status"]))), 128))
|
|
209
205
|
]));
|
|
210
206
|
}
|
|
@@ -104,10 +104,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
104
104
|
status: number;
|
|
105
105
|
message: string;
|
|
106
106
|
}>;
|
|
107
|
-
showSignalControlArea: (params:
|
|
108
|
-
areaList: any[];
|
|
109
|
-
style?: string | undefined;
|
|
110
|
-
}) => import("../types").IResult;
|
|
107
|
+
showSignalControlArea: (params: import("../types").IShowSignalControlAreaParams) => import("../types").IResult;
|
|
111
108
|
clearSignalControlArea: () => void;
|
|
112
109
|
locateSignalControlArea: (params: {
|
|
113
110
|
id: string;
|
|
@@ -117,12 +114,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
117
114
|
}) => Promise<import("../types").IResult>;
|
|
118
115
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
119
116
|
showSubSignalControlArea: (params: any) => import("../types").IResult;
|
|
120
|
-
editSubSignalControlArea: (
|
|
121
|
-
id: string;
|
|
122
|
-
name: string;
|
|
123
|
-
}) => void, removeCrossCallback: (params: {
|
|
124
|
-
id: string;
|
|
125
|
-
}) => void) => Promise<import("../types").IResult> | {
|
|
117
|
+
editSubSignalControlArea: (params: import("../types").IEditSignalControlAreaParams) => Promise<import("../types").IResult> | {
|
|
126
118
|
status: number;
|
|
127
119
|
message: string;
|
|
128
120
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as w from "@arcgis/core/core/reactiveUtils";
|
|
2
2
|
import { Point as f } from "@arcgis/core/geometry";
|
|
3
|
-
import * as
|
|
3
|
+
import * as d from "@arcgis/core/geometry/support/webMercatorUtils.js";
|
|
4
4
|
import P from "@arcgis/core/layers/GraphicsLayer";
|
|
5
5
|
import m from "./signal-holo-flow.mjs";
|
|
6
6
|
class M extends m {
|
|
@@ -36,7 +36,7 @@ class M extends m {
|
|
|
36
36
|
return n < 1e3 ? s = 1 : n < 2e3 ? s = 0.8 : n < 4e3 ? s = 0.4 : s = 0, s;
|
|
37
37
|
}
|
|
38
38
|
async handleSignalData(n) {
|
|
39
|
-
this.watchHandle || (this.watchHandle =
|
|
39
|
+
this.watchHandle || (this.watchHandle = w.watch(
|
|
40
40
|
() => this.view.extent,
|
|
41
41
|
() => {
|
|
42
42
|
const t = this.getPanelScale();
|
|
@@ -47,7 +47,7 @@ class M extends m {
|
|
|
47
47
|
x: e[0],
|
|
48
48
|
y: e[1]
|
|
49
49
|
});
|
|
50
|
-
this.view.spatialReference.isWebMercator && (a =
|
|
50
|
+
this.view.spatialReference.isWebMercator && (a = d.geographicToWebMercator(
|
|
51
51
|
a
|
|
52
52
|
));
|
|
53
53
|
const i = this.view.toScreen(a);
|
|
@@ -94,11 +94,11 @@ class M extends m {
|
|
|
94
94
|
x: e.panelPoint[0],
|
|
95
95
|
y: e.panelPoint[1]
|
|
96
96
|
});
|
|
97
|
-
this.view.spatialReference.isWebMercator && (i =
|
|
97
|
+
this.view.spatialReference.isWebMercator && (i = d.geographicToWebMercator(
|
|
98
98
|
i
|
|
99
99
|
));
|
|
100
100
|
const r = this.view.toScreen(i), h = this.getPanelRotation(e.coord);
|
|
101
|
-
|
|
101
|
+
this.countdownPanelProps.push({
|
|
102
102
|
displayMode: "complex",
|
|
103
103
|
crossId: s,
|
|
104
104
|
roadId: o,
|
|
@@ -132,7 +132,7 @@ class M extends m {
|
|
|
132
132
|
x: s[0],
|
|
133
133
|
y: s[1]
|
|
134
134
|
});
|
|
135
|
-
this.view.spatialReference.isWebMercator && (c =
|
|
135
|
+
this.view.spatialReference.isWebMercator && (c = d.geographicToWebMercator(
|
|
136
136
|
c
|
|
137
137
|
));
|
|
138
138
|
const p = this.view.toScreen(c), l = n[n.length - 1];
|
|
@@ -140,7 +140,7 @@ class M extends m {
|
|
|
140
140
|
x: l[0],
|
|
141
141
|
y: l[1]
|
|
142
142
|
});
|
|
143
|
-
this.view.spatialReference.isWebMercator && (t =
|
|
143
|
+
this.view.spatialReference.isWebMercator && (t = d.geographicToWebMercator(
|
|
144
144
|
t
|
|
145
145
|
));
|
|
146
146
|
const o = this.view.toScreen(t), e = o.x - p.x, a = o.y - p.y;
|
|
@@ -3,10 +3,15 @@ export default class TraceRendererLayer implements ITraceRendererInterface {
|
|
|
3
3
|
private view;
|
|
4
4
|
private readonly vehicleLayer;
|
|
5
5
|
private mapConfig;
|
|
6
|
+
private hasGpu;
|
|
6
7
|
private rafSignal;
|
|
7
8
|
private appDataStore;
|
|
8
9
|
private logTable;
|
|
9
10
|
constructor(view: __esri.MapView);
|
|
11
|
+
private getRendererText;
|
|
12
|
+
private em;
|
|
13
|
+
private el;
|
|
14
|
+
private getGpuText;
|
|
10
15
|
getLog(): (string | number)[][];
|
|
11
16
|
init(): Promise<void>;
|
|
12
17
|
private needInterpolate;
|
|
@@ -45,6 +50,7 @@ export default class TraceRendererLayer implements ITraceRendererInterface {
|
|
|
45
50
|
* @returns
|
|
46
51
|
*/
|
|
47
52
|
private createCIMSymbol;
|
|
53
|
+
private createMarkerSymbol;
|
|
48
54
|
/**
|
|
49
55
|
* 根据车身颜色属性返回对应的车辆图标
|
|
50
56
|
* @param carColor
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import p from "@arcgis/core/Graphic";
|
|
2
|
+
import g from "@arcgis/core/layers/GraphicsLayer";
|
|
3
3
|
import { toRaw as m } from "vue";
|
|
4
|
-
import
|
|
5
|
-
class
|
|
4
|
+
import u from "../../stores/index.mjs";
|
|
5
|
+
class v {
|
|
6
6
|
constructor(i) {
|
|
7
|
-
this.appDataStore =
|
|
7
|
+
this.hasGpu = !1, this.appDataStore = u.useAppDataStore, this.logTable = [
|
|
8
8
|
[
|
|
9
9
|
"uuid",
|
|
10
10
|
"ptcId",
|
|
@@ -30,9 +30,53 @@ class P {
|
|
|
30
30
|
"step",
|
|
31
31
|
"receiveTimestamp"
|
|
32
32
|
]
|
|
33
|
-
], this.needInterpolate = !0, this.isPaused = !1, this.showVehiclePlate = !1, this.showGroundVehicle = !0, this.showElevatedVehicle = !0, this.historyPositionMap = /* @__PURE__ */ new Map(), this.vehicleObjectMap = /* @__PURE__ */ new Map(), this.view = i, this.mapConfig = m(this.appDataStore.mapConfig), this.vehicleLayer = new
|
|
33
|
+
], this.needInterpolate = !0, this.isPaused = !1, this.showVehiclePlate = !1, this.showGroundVehicle = !0, this.showElevatedVehicle = !0, this.historyPositionMap = /* @__PURE__ */ new Map(), this.vehicleObjectMap = /* @__PURE__ */ new Map(), this.view = i, this.mapConfig = m(this.appDataStore.mapConfig), this.vehicleLayer = new g({
|
|
34
34
|
id: "vehicleLayer"
|
|
35
|
-
}), this.view.map.add(this.vehicleLayer)
|
|
35
|
+
}), this.view.map.add(this.vehicleLayer);
|
|
36
|
+
const t = this.getRendererText(), e = this.getGpuText(t);
|
|
37
|
+
this.hasGpu = e !== "Unknown", this.hasGpu && (this.rafSignal = requestAnimationFrame(() => this.render())), console.log("rendererText: ", t), console.log("gpuText: ", e);
|
|
38
|
+
}
|
|
39
|
+
getRendererText() {
|
|
40
|
+
try {
|
|
41
|
+
const i = document.createElement("canvas"), t = i.getContext("webgl") || i.getContext("experimental-webgl");
|
|
42
|
+
if (!t)
|
|
43
|
+
return "Unknown";
|
|
44
|
+
const e = t.getExtension("WEBGL_debug_renderer_info");
|
|
45
|
+
return e && t.getParameter(e.UNMASKED_RENDERER_WEBGL) || "Unknown";
|
|
46
|
+
} catch {
|
|
47
|
+
return "Unknown";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
em(i) {
|
|
51
|
+
const t = [], e = i.split("");
|
|
52
|
+
for (let s = 0; s < e.length; s++)
|
|
53
|
+
if (e[s] === "(")
|
|
54
|
+
t.push(s);
|
|
55
|
+
else if (e[s] === ")") {
|
|
56
|
+
const r = t.pop();
|
|
57
|
+
r !== void 0 && (e.splice(r, s - r + 1), s = r - 1);
|
|
58
|
+
}
|
|
59
|
+
return e.join("");
|
|
60
|
+
}
|
|
61
|
+
el(i) {
|
|
62
|
+
return this.em(i).replace(/\/PCIe\/SSE2/g, "").replace(/\s+/g, " ").trim();
|
|
63
|
+
}
|
|
64
|
+
getGpuText(i) {
|
|
65
|
+
try {
|
|
66
|
+
if (/, or similar$/.test(i) || /SwiftShader/.test(i))
|
|
67
|
+
return "Unknown";
|
|
68
|
+
if (/^ANGLE/.test(i)) {
|
|
69
|
+
const t = i.match(/\((.+)\)$/);
|
|
70
|
+
if (t) {
|
|
71
|
+
const e = t[1], s = e.split(/,\s*/g);
|
|
72
|
+
let r = s[1];
|
|
73
|
+
return /^ANGLE Metal Renderer: /.test(r) && (r = i.split(": ")[1].split(",")[0]), s.length === 1 && (r = s[0].split(" ").slice(1).join(" ")), /Direct3D/.test(r) && (r = r.split("Direct3D")[0].trim()), r;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch {
|
|
77
|
+
return "Unknown";
|
|
78
|
+
}
|
|
79
|
+
return this.el(i);
|
|
36
80
|
}
|
|
37
81
|
getLog() {
|
|
38
82
|
return this.logTable;
|
|
@@ -46,28 +90,26 @@ class P {
|
|
|
46
90
|
return;
|
|
47
91
|
}
|
|
48
92
|
const e = i.map((s) => {
|
|
49
|
-
const { vehicleId:
|
|
50
|
-
this.historyPositionMap.set(o, [
|
|
51
|
-
{ pos: [l, n, 0], heading: a, time: h }
|
|
52
|
-
]);
|
|
53
|
-
const r = new c({
|
|
93
|
+
const { vehicleId: r, heading: o, localTimestamp: h } = s, n = Number(s.x), l = Number(s.y), a = new p({
|
|
54
94
|
geometry: {
|
|
55
95
|
type: "point",
|
|
56
|
-
x:
|
|
57
|
-
y:
|
|
96
|
+
x: n,
|
|
97
|
+
y: l
|
|
58
98
|
},
|
|
59
99
|
attributes: {
|
|
60
100
|
...s,
|
|
61
101
|
type: "trackVehicle"
|
|
62
102
|
},
|
|
63
|
-
symbol: this.createCIMSymbol(s)
|
|
103
|
+
symbol: this.hasGpu ? this.createCIMSymbol(s) : this.createMarkerSymbol()
|
|
64
104
|
});
|
|
65
|
-
return
|
|
66
|
-
|
|
105
|
+
return this.hasGpu && (a.visible = !1, this.historyPositionMap.set(r, [
|
|
106
|
+
{ pos: [n, l, 0], heading: o, time: h }
|
|
107
|
+
]), this.vehicleObjectMap.set(r, {
|
|
108
|
+
graphic: a,
|
|
67
109
|
data: s,
|
|
68
110
|
waitForDelete: !1,
|
|
69
111
|
isMoving: !1
|
|
70
|
-
}),
|
|
112
|
+
})), a;
|
|
71
113
|
});
|
|
72
114
|
this.vehicleLayer.addMany(e), t();
|
|
73
115
|
});
|
|
@@ -80,25 +122,42 @@ class P {
|
|
|
80
122
|
}
|
|
81
123
|
const e = [];
|
|
82
124
|
i.forEach((s) => {
|
|
83
|
-
const { vehicleId:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
125
|
+
const { vehicleId: r, heading: o, localTimestamp: h } = s, n = Number(s.x), l = Number(s.y);
|
|
126
|
+
if (this.hasGpu) {
|
|
127
|
+
const a = this.vehicleObjectMap.get(r);
|
|
128
|
+
a ? (a.data = s, a.graphic.attributes = {
|
|
129
|
+
...s,
|
|
130
|
+
type: "trackVehicle"
|
|
131
|
+
}, this.historyPositionMap.get(
|
|
132
|
+
r
|
|
133
|
+
).push({
|
|
134
|
+
pos: [n, l, 0],
|
|
135
|
+
heading: o,
|
|
136
|
+
time: h
|
|
137
|
+
})) : e.push(s);
|
|
138
|
+
} else {
|
|
139
|
+
const a = this.vehicleLayer.graphics.find(
|
|
140
|
+
(c) => c.getAttribute("vehicleId") == s.vehicleId
|
|
141
|
+
);
|
|
142
|
+
a ? a.geometry = {
|
|
143
|
+
type: "point",
|
|
144
|
+
x: n,
|
|
145
|
+
y: l
|
|
146
|
+
} : e.push(s);
|
|
147
|
+
}
|
|
94
148
|
}), this.addVehicles(e), t();
|
|
95
149
|
});
|
|
96
150
|
}
|
|
97
151
|
deleteVehicles(i) {
|
|
98
|
-
this.isPaused || i.forEach((t) => {
|
|
152
|
+
this.isPaused || (this.hasGpu ? i.forEach((t) => {
|
|
99
153
|
const e = this.vehicleObjectMap.get(t);
|
|
100
154
|
e && (e.waitForDelete = !0);
|
|
101
|
-
})
|
|
155
|
+
}) : i.forEach((t) => {
|
|
156
|
+
const e = this.vehicleLayer.graphics.find(
|
|
157
|
+
(s) => s.getAttribute("vehicleId") == t
|
|
158
|
+
);
|
|
159
|
+
e && this.vehicleLayer.remove(e);
|
|
160
|
+
}));
|
|
102
161
|
}
|
|
103
162
|
clearVehicles() {
|
|
104
163
|
this.vehicleLayer.removeAll(), this.vehicleObjectMap.clear(), this.historyPositionMap.clear();
|
|
@@ -121,7 +180,7 @@ class P {
|
|
|
121
180
|
i.name === "vehiclePlate" && (this.showVehiclePlate = i.visible);
|
|
122
181
|
}
|
|
123
182
|
togglePause(i) {
|
|
124
|
-
this.isPaused = i, this.isPaused ? cancelAnimationFrame(this.rafSignal) : this.rafSignal = requestAnimationFrame(() => this.render());
|
|
183
|
+
this.isPaused = i, this.isPaused && this.rafSignal ? cancelAnimationFrame(this.rafSignal) : this.rafSignal = requestAnimationFrame(() => this.render());
|
|
125
184
|
}
|
|
126
185
|
updatePanelContent(i) {
|
|
127
186
|
console.log(i);
|
|
@@ -139,11 +198,11 @@ class P {
|
|
|
139
198
|
if (!t || !e || !e.isMoving && t.length <= 2)
|
|
140
199
|
return;
|
|
141
200
|
e.isMoving = !0, (e.graphic.getAttribute("roadLayer") || "1") === "1" ? e.graphic.visible = this.showGroundVehicle : e.graphic.visible = this.showElevatedVehicle, e.segmentStartTime || (e.segmentStartTime = Date.now(), e.segmentTotalTime = t[1].time - t[0].time);
|
|
142
|
-
const
|
|
201
|
+
const r = Date.now() - e.segmentStartTime, o = Math.min(
|
|
143
202
|
1,
|
|
144
|
-
|
|
203
|
+
r / e.segmentTotalTime
|
|
145
204
|
);
|
|
146
|
-
if (
|
|
205
|
+
if (o === 1)
|
|
147
206
|
if (t.shift(), t.length === 1) {
|
|
148
207
|
e.waitForDelete ? (this.vehicleLayer.remove(e.graphic), this.vehicleObjectMap.delete(i), this.historyPositionMap.delete(i)) : (e.segmentStartTime = void 0, e.segmentTotalTime = void 0, e.graphic.visible = !1, e.isMoving = !1);
|
|
149
208
|
return;
|
|
@@ -154,12 +213,12 @@ class P {
|
|
|
154
213
|
y: t[0].pos[1]
|
|
155
214
|
};
|
|
156
215
|
else {
|
|
157
|
-
const h = t[0].pos[0] + (t[1].pos[0] - t[0].pos[0]) *
|
|
216
|
+
const h = t[0].pos[0] + (t[1].pos[0] - t[0].pos[0]) * o, n = t[0].pos[1] + (t[1].pos[1] - t[0].pos[1]) * o, l = t[0].heading + (t[1].heading - t[0].heading) * o;
|
|
158
217
|
e.graphic.geometry = {
|
|
159
218
|
type: "point",
|
|
160
219
|
x: h,
|
|
161
|
-
y:
|
|
162
|
-
}, e.data.heading =
|
|
220
|
+
y: n
|
|
221
|
+
}, e.data.heading = l, e.graphic.symbol = this.hasGpu ? this.createCIMSymbol(e.data) : this.createMarkerSymbol();
|
|
163
222
|
}
|
|
164
223
|
}
|
|
165
224
|
/**
|
|
@@ -258,6 +317,17 @@ class P {
|
|
|
258
317
|
}
|
|
259
318
|
};
|
|
260
319
|
}
|
|
320
|
+
createMarkerSymbol() {
|
|
321
|
+
return {
|
|
322
|
+
type: "simple-marker",
|
|
323
|
+
color: "green",
|
|
324
|
+
size: 5,
|
|
325
|
+
outline: {
|
|
326
|
+
color: "white",
|
|
327
|
+
width: 1
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
}
|
|
261
331
|
/**
|
|
262
332
|
* 根据车身颜色属性返回对应的车辆图标
|
|
263
333
|
* @param carColor
|
|
@@ -351,5 +421,5 @@ class P {
|
|
|
351
421
|
}
|
|
352
422
|
}
|
|
353
423
|
export {
|
|
354
|
-
|
|
424
|
+
v as default
|
|
355
425
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IResult } from '../../../types';
|
|
1
|
+
import { IEditSignalControlAreaParams, IResult, IShowSignalControlAreaParams } from '../../../types';
|
|
2
2
|
export default class SignalControlAreaController {
|
|
3
3
|
private view;
|
|
4
4
|
private districtControllerLayer;
|
|
@@ -15,10 +15,7 @@ export default class SignalControlAreaController {
|
|
|
15
15
|
* @param params
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
|
-
showSignalControlArea(params:
|
|
19
|
-
areaList: any[];
|
|
20
|
-
style?: string;
|
|
21
|
-
}): IResult;
|
|
18
|
+
showSignalControlArea(params: IShowSignalControlAreaParams): IResult;
|
|
22
19
|
clearSignalControlArea(): IResult;
|
|
23
20
|
locateSignalControlArea(params: {
|
|
24
21
|
id: string;
|
|
@@ -47,12 +44,7 @@ export default class SignalControlAreaController {
|
|
|
47
44
|
* 编辑子区的路口
|
|
48
45
|
* @returns
|
|
49
46
|
*/
|
|
50
|
-
|
|
51
|
-
id: string;
|
|
52
|
-
name: string;
|
|
53
|
-
}) => void, removeCrossCallback: (params: {
|
|
54
|
-
id: string;
|
|
55
|
-
}) => void): Promise<IResult>;
|
|
47
|
+
editSubSignalControlArea(params: IEditSignalControlAreaParams): Promise<IResult>;
|
|
56
48
|
/**
|
|
57
49
|
* 从外部接口选中一个路口
|
|
58
50
|
* @param id
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as p from "@arcgis/core/core/reactiveUtils.js";
|
|
2
|
+
import n from "@arcgis/core/Graphic";
|
|
3
3
|
import y from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
7
|
-
import
|
|
4
|
+
import d from "@turf/buffer";
|
|
5
|
+
import g from "@turf/convex";
|
|
6
|
+
import * as a from "@turf/helpers";
|
|
7
|
+
import b from "axios";
|
|
8
8
|
import f from "concaveman";
|
|
9
9
|
import C from "../../stores/index.mjs";
|
|
10
10
|
import v from "./district-controller.mjs";
|
|
11
|
-
class
|
|
11
|
+
class P {
|
|
12
12
|
constructor(e) {
|
|
13
13
|
var i;
|
|
14
14
|
this.crossScale = 5e3, this.crossIdsInDistrict = [], this.view = e;
|
|
@@ -48,7 +48,7 @@ class N {
|
|
|
48
48
|
);
|
|
49
49
|
this.drawArea(r, !0);
|
|
50
50
|
}
|
|
51
|
-
return this.scaleWatcher =
|
|
51
|
+
return this.scaleWatcher = p.watch(
|
|
52
52
|
() => this.view.scale,
|
|
53
53
|
(t, r) => {
|
|
54
54
|
t > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((i) => {
|
|
@@ -91,8 +91,8 @@ class N {
|
|
|
91
91
|
return { status: 1, message: "请输入id" };
|
|
92
92
|
this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !1;
|
|
93
93
|
const t = this.districtControllerLayer.graphics.filter((s) => s.getAttribute("id") === e.id).toArray().map((s) => {
|
|
94
|
-
const
|
|
95
|
-
return
|
|
94
|
+
const o = s.clone();
|
|
95
|
+
return o.symbol.style = "none", o;
|
|
96
96
|
}), r = this.subDistrictControllerLayer.graphics.filter(
|
|
97
97
|
(s) => s.getAttribute("id") === e.id || s.getAttribute("parentId") === e.id
|
|
98
98
|
).toArray().map((s) => s.clone()), i = this.crossLayer.graphics.filter(
|
|
@@ -122,7 +122,7 @@ class N {
|
|
|
122
122
|
this.crossLayer.removeAll(), this.crossLayer.visible = !0;
|
|
123
123
|
const r = e.children.map((i) => {
|
|
124
124
|
const s = { ...i, selected: !0 };
|
|
125
|
-
return new
|
|
125
|
+
return new n({
|
|
126
126
|
geometry: {
|
|
127
127
|
type: "point",
|
|
128
128
|
x: i.longitude,
|
|
@@ -144,7 +144,7 @@ class N {
|
|
|
144
144
|
const r = (s = (await this.view.hitTest(e, {
|
|
145
145
|
include: [this.crossLayer]
|
|
146
146
|
})).results) == null ? void 0 : s.filter(
|
|
147
|
-
(
|
|
147
|
+
(o) => o.type === "graphic"
|
|
148
148
|
);
|
|
149
149
|
if (r.length === 0)
|
|
150
150
|
return;
|
|
@@ -164,7 +164,7 @@ class N {
|
|
|
164
164
|
* @returns
|
|
165
165
|
*/
|
|
166
166
|
async showNearbyCrosses(e) {
|
|
167
|
-
const t = await
|
|
167
|
+
const t = await b.get(
|
|
168
168
|
`http://${this.openDriveServer}/api/computable/getRelatedJunctionsForJunction`,
|
|
169
169
|
{ params: { junctionIds: e } }
|
|
170
170
|
);
|
|
@@ -172,12 +172,18 @@ class N {
|
|
|
172
172
|
if (t.data.status === 0) {
|
|
173
173
|
const r = t.data.result, i = [];
|
|
174
174
|
for (const s of r) {
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
-
|
|
175
|
+
const o = s.junctionId;
|
|
176
|
+
if (o.startsWith("-"))
|
|
177
|
+
continue;
|
|
178
|
+
if (s.signalId && !this.crossIdsInDistrict.includes(o)) {
|
|
179
|
+
console.log("不是此区控内的路口", o);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (this.crossLayer.graphics.some(
|
|
183
|
+
(c) => c.getAttribute("id") === o
|
|
178
184
|
))
|
|
179
185
|
continue;
|
|
180
|
-
const m = new
|
|
186
|
+
const m = new n({
|
|
181
187
|
geometry: {
|
|
182
188
|
type: "point",
|
|
183
189
|
x: s.lon,
|
|
@@ -185,7 +191,7 @@ class N {
|
|
|
185
191
|
},
|
|
186
192
|
symbol: this.getCrossSymbolInSubDistrict(s),
|
|
187
193
|
attributes: {
|
|
188
|
-
id:
|
|
194
|
+
id: o,
|
|
189
195
|
name: s.name,
|
|
190
196
|
signalId: s.signalId,
|
|
191
197
|
selected: !1
|
|
@@ -203,9 +209,29 @@ class N {
|
|
|
203
209
|
* 编辑子区的路口
|
|
204
210
|
* @returns
|
|
205
211
|
*/
|
|
206
|
-
async
|
|
212
|
+
async editSubSignalControlArea(e) {
|
|
207
213
|
if (this.openDriveServer) {
|
|
208
|
-
this.crossIdsInDistrict = e
|
|
214
|
+
this.crossIdsInDistrict = e.crossesInArea.map((s) => s.id);
|
|
215
|
+
const t = a.featureCollection(
|
|
216
|
+
e.crossesInArea.map((s) => a.point([s.x, s.y]))
|
|
217
|
+
), r = g(t);
|
|
218
|
+
r && (this.districtControllerLayer.removeAll(), this.districtControllerLayer.add(
|
|
219
|
+
new n({
|
|
220
|
+
geometry: {
|
|
221
|
+
type: "polygon",
|
|
222
|
+
rings: r.geometry.coordinates
|
|
223
|
+
},
|
|
224
|
+
symbol: {
|
|
225
|
+
type: "simple-fill",
|
|
226
|
+
style: "none",
|
|
227
|
+
outline: {
|
|
228
|
+
color: [61, 139, 249],
|
|
229
|
+
width: 3,
|
|
230
|
+
style: "long-dash"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
)), this.addCrossCallback = e.addCrossCallback, this.removeCrossCallback = e.removeCrossCallback, this.clickWatcher || (this.clickWatcher = this.view.on("click", async (s) => {
|
|
209
235
|
await this.handleViewClick(s);
|
|
210
236
|
}));
|
|
211
237
|
const i = this.crossLayer.graphics.toArray().map((s) => s.getAttribute("id")).join(",");
|
|
@@ -261,20 +287,20 @@ class N {
|
|
|
261
287
|
if (r.length >= 2) {
|
|
262
288
|
let s = null;
|
|
263
289
|
if (r.length === 2)
|
|
264
|
-
s =
|
|
290
|
+
s = a.lineString(r);
|
|
265
291
|
else {
|
|
266
292
|
if (t) {
|
|
267
|
-
const
|
|
268
|
-
r.map((u) =>
|
|
293
|
+
const h = a.featureCollection(
|
|
294
|
+
r.map((u) => a.point(u))
|
|
269
295
|
);
|
|
270
|
-
s =
|
|
296
|
+
s = g(h);
|
|
271
297
|
} else {
|
|
272
|
-
const
|
|
273
|
-
|
|
298
|
+
const h = f(r, 0.5);
|
|
299
|
+
h.length >= 4 && (s = a.polygon([h]));
|
|
274
300
|
}
|
|
275
|
-
s || (s =
|
|
301
|
+
s || (s = a.lineString(r));
|
|
276
302
|
}
|
|
277
|
-
const
|
|
303
|
+
const o = d(
|
|
278
304
|
s.geometry,
|
|
279
305
|
// 区控面积更大,需要更大的缓冲半径
|
|
280
306
|
t ? 200 : 30,
|
|
@@ -282,8 +308,8 @@ class N {
|
|
|
282
308
|
units: "meters"
|
|
283
309
|
}
|
|
284
310
|
);
|
|
285
|
-
let
|
|
286
|
-
t ?
|
|
311
|
+
let l;
|
|
312
|
+
t ? l = [
|
|
287
313
|
{
|
|
288
314
|
fieldName: "id",
|
|
289
315
|
label: "区控编号"
|
|
@@ -296,7 +322,7 @@ class N {
|
|
|
296
322
|
fieldName: "subDistrictCount",
|
|
297
323
|
label: "子区数量"
|
|
298
324
|
}
|
|
299
|
-
] :
|
|
325
|
+
] : l = [
|
|
300
326
|
{
|
|
301
327
|
fieldName: "parentName",
|
|
302
328
|
label: "所属区控"
|
|
@@ -314,10 +340,10 @@ class N {
|
|
|
314
340
|
parentName: e.parentName,
|
|
315
341
|
crossCount: e.crossCount,
|
|
316
342
|
subDistrictCount: e.subDistrictCount
|
|
317
|
-
},
|
|
343
|
+
}, c = new n({
|
|
318
344
|
geometry: {
|
|
319
345
|
type: "polygon",
|
|
320
|
-
rings:
|
|
346
|
+
rings: o.geometry.coordinates
|
|
321
347
|
},
|
|
322
348
|
symbol: {
|
|
323
349
|
type: "simple-fill",
|
|
@@ -335,18 +361,18 @@ class N {
|
|
|
335
361
|
content: [
|
|
336
362
|
{
|
|
337
363
|
type: "fields",
|
|
338
|
-
fieldInfos:
|
|
364
|
+
fieldInfos: l
|
|
339
365
|
}
|
|
340
366
|
]
|
|
341
367
|
}
|
|
342
368
|
});
|
|
343
|
-
t ? this.districtControllerLayer.add(
|
|
369
|
+
t ? this.districtControllerLayer.add(c) : this.subDistrictControllerLayer.add(c);
|
|
344
370
|
}
|
|
345
371
|
for (const s of e.subDistricts)
|
|
346
372
|
this.drawArea(s, !1);
|
|
347
373
|
const i = [];
|
|
348
374
|
e.crosses.forEach((s) => {
|
|
349
|
-
const
|
|
375
|
+
const o = {
|
|
350
376
|
type: "cross",
|
|
351
377
|
id: s.id,
|
|
352
378
|
name: s.name,
|
|
@@ -357,14 +383,14 @@ class N {
|
|
|
357
383
|
subDistrictId: t ? "" : e.id,
|
|
358
384
|
subDistrictName: t ? "" : e.name,
|
|
359
385
|
isKey: s.isKey
|
|
360
|
-
},
|
|
386
|
+
}, l = new n({
|
|
361
387
|
geometry: {
|
|
362
388
|
type: "point",
|
|
363
389
|
x: s.longitude,
|
|
364
390
|
y: s.latitude
|
|
365
391
|
},
|
|
366
|
-
symbol: this.getCrossGraphicSymbol(
|
|
367
|
-
attributes:
|
|
392
|
+
symbol: this.getCrossGraphicSymbol(o, "marker"),
|
|
393
|
+
attributes: o,
|
|
368
394
|
popupTemplate: {
|
|
369
395
|
title: s.name,
|
|
370
396
|
content: [
|
|
@@ -392,7 +418,7 @@ class N {
|
|
|
392
418
|
]
|
|
393
419
|
}
|
|
394
420
|
});
|
|
395
|
-
i.push(
|
|
421
|
+
i.push(l);
|
|
396
422
|
}), this.crossLayer.addMany(i);
|
|
397
423
|
}
|
|
398
424
|
/**
|
|
@@ -606,5 +632,5 @@ class N {
|
|
|
606
632
|
}
|
|
607
633
|
}
|
|
608
634
|
export {
|
|
609
|
-
|
|
635
|
+
P as default
|
|
610
636
|
};
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -270,3 +270,21 @@ export interface ISignalCountdownProps {
|
|
|
270
270
|
rColor?: string;
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
|
+
export interface IShowSignalControlAreaParams {
|
|
274
|
+
areaList: any[];
|
|
275
|
+
style?: string;
|
|
276
|
+
}
|
|
277
|
+
export interface IEditSignalControlAreaParams {
|
|
278
|
+
crossesInArea: {
|
|
279
|
+
id: string;
|
|
280
|
+
x: number;
|
|
281
|
+
y: number;
|
|
282
|
+
}[];
|
|
283
|
+
addCrossCallback: (params: {
|
|
284
|
+
id: string;
|
|
285
|
+
name: string;
|
|
286
|
+
}) => void;
|
|
287
|
+
removeCrossCallback: (params: {
|
|
288
|
+
id: string;
|
|
289
|
+
}) => void;
|
|
290
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MapView from '@arcgis/core/views/MapView';
|
|
2
2
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
-
import { IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IMaskParam, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowOpenDriveFromFileParams, ISignalCountdownProps, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams, IUnselectSumoParams } from '../types';
|
|
3
|
+
import { IEditSignalControlAreaParams, IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IMaskParam, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowOpenDriveFromFileParams, IShowSignalControlAreaParams, ISignalCountdownProps, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams, IUnselectSumoParams } from '../types';
|
|
4
4
|
import HoloFlow from './utils/holo-flow';
|
|
5
5
|
import MapInitializer from './utils/map-initializer';
|
|
6
6
|
import OpenDriveRenderer from './utils/open-drive-renderer';
|
|
@@ -115,10 +115,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
115
115
|
status: number;
|
|
116
116
|
message: string;
|
|
117
117
|
}>;
|
|
118
|
-
showSignalControlArea: (params:
|
|
119
|
-
areaList: any[];
|
|
120
|
-
style?: string;
|
|
121
|
-
}) => import("../types").IResult;
|
|
118
|
+
showSignalControlArea: (params: IShowSignalControlAreaParams) => import("../types").IResult;
|
|
122
119
|
clearSignalControlArea: () => void;
|
|
123
120
|
locateSignalControlArea: (params: {
|
|
124
121
|
id: string;
|
|
@@ -128,12 +125,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
128
125
|
}) => Promise<import("../types").IResult>;
|
|
129
126
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
130
127
|
showSubSignalControlArea: (params: any) => import("../types").IResult;
|
|
131
|
-
editSubSignalControlArea: (
|
|
132
|
-
id: string;
|
|
133
|
-
name: string;
|
|
134
|
-
}) => void, removeCrossCallback: (params: {
|
|
135
|
-
id: string;
|
|
136
|
-
}) => void) => Promise<import("../types").IResult> | {
|
|
128
|
+
editSubSignalControlArea: (params: IEditSignalControlAreaParams) => Promise<import("../types").IResult> | {
|
|
137
129
|
status: number;
|
|
138
130
|
message: string;
|
|
139
131
|
};
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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,u,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:m}=e.appContext.config.globalProperties,c=await(await fetch(k.config)).json();c.assetsRoot=k.assetsRoot||m,I.mapConfig=c,u=new Ne.default,i=await u.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 u.setMapCenter(e),H=async e=>await u.setMapCamera(e),P=async e=>await u.lookAt(e),E=e=>u.setLayerVisibility(e),z=(e,m)=>u.requestCoordinateTransform(e,m),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,m)=>{o||(o=new He.default(i)),o.connectTrafficFlow(e,m)},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,m)=>(t||(t=new O.default(i)),await t.showOpenDriveFromServer(e,m)),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=>a?a.editSubSignalControlArea(e):{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,m)=>(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;
|
|
@@ -104,10 +104,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
104
104
|
status: number;
|
|
105
105
|
message: string;
|
|
106
106
|
}>;
|
|
107
|
-
showSignalControlArea: (params:
|
|
108
|
-
areaList: any[];
|
|
109
|
-
style?: string | undefined;
|
|
110
|
-
}) => import("../types").IResult;
|
|
107
|
+
showSignalControlArea: (params: import("../types").IShowSignalControlAreaParams) => import("../types").IResult;
|
|
111
108
|
clearSignalControlArea: () => void;
|
|
112
109
|
locateSignalControlArea: (params: {
|
|
113
110
|
id: string;
|
|
@@ -117,12 +114,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
117
114
|
}) => Promise<import("../types").IResult>;
|
|
118
115
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
119
116
|
showSubSignalControlArea: (params: any) => import("../types").IResult;
|
|
120
|
-
editSubSignalControlArea: (
|
|
121
|
-
id: string;
|
|
122
|
-
name: string;
|
|
123
|
-
}) => void, removeCrossCallback: (params: {
|
|
124
|
-
id: string;
|
|
125
|
-
}) => void) => Promise<import("../types").IResult> | {
|
|
117
|
+
editSubSignalControlArea: (params: import("../types").IEditSignalControlAreaParams) => Promise<import("../types").IResult> | {
|
|
126
118
|
status: number;
|
|
127
119
|
message: string;
|
|
128
120
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/core/reactiveUtils"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/core/reactiveUtils"),d=require("@arcgis/core/geometry"),g=require("@arcgis/core/geometry/support/webMercatorUtils.js"),m=require("@arcgis/core/layers/GraphicsLayer"),y=require("./signal-holo-flow.js");function w(f){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const n in f)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(f,n);Object.defineProperty(t,n,l.get?l:{enumerable:!0,get:()=>f[n]})}}return t.default=f,Object.freeze(t)}const L=w(P),u=w(g);class M extends y.default{constructor(t,n){super(t),this.stopLineLayer=new m,this.watchHandle=null,this.stopLineMap=new Map,this.countdownPanelProps=n,this.view.map.add(this.stopLineLayer)}async initializeLayer(){var p,c;console.time("初始化停止线图层");let t=(c=(p=this.mapConfig.holoFlow)==null?void 0:p.signal)==null?void 0:c.stopLineLayer;if(!t)return;t=this.mapConfig.assetsRoot+"/"+t,(await(await fetch(t)).json()).features.forEach(o=>{const{roadId:i,nodeId:e,angle:a,destinationPoint:s}=o.properties,{coordinates:r}=o.geometry,h=this.stopLineMap.get(e);h?h.set(i,{coord:r,panelPoint:s,angle:a}):this.stopLineMap.set(e,new Map([[i,{coord:r,panelPoint:s,angle:a}]]))}),console.timeEnd("初始化停止线图层")}getPanelScale(){const t=this.view.scale;let n=1;return t<1e3?n=1:t<2e3?n=.8:t<4e3?n=.4:n=0,n}async handleSignalData(t){this.watchHandle||(this.watchHandle=L.watch(()=>this.view.extent,()=>{const o=this.getPanelScale();for(const i of this.countdownPanelProps){o!==this.currentPanelScale&&(i.scale=o);const{mapPoint:e}=i;let a=new d.Point({x:e[0],y:e[1]});this.view.spatialReference.isWebMercator&&(a=u.geographicToWebMercator(a));const s=this.view.toScreen(a);if(i.position.left=s.x,i.position.top=s.y,this.view.type==="3d"){const r=this.getPanelRotation(i.stopLine);i.rotation=r}}this.currentPanelScale=o}));const n=t.crossId,l=this.stopLineMap.get(n);if(!l)return;const p=t.phaseCountDownList,c=new Map;for(const o of p){let i="";for(let r of o.roadIdList)if(r.startsWith("-")&&(r=r.slice(1)),l.has(r)){i=r;break}if(!i)continue;let e=c.get(i);if(e||(e={},c.set(i,e)),!o.direction){console.log(`没有找到对应的方向${n}--${JSON.stringify(o)}`);continue}const a=o.direction.toLowerCase(),s=o.color===1?"red":o.color===2?"yellow":"green";a==="u"?(e.uNumber=o.leftTime,e.uColor=s):a==="l"?(e.lNumber=o.leftTime,e.lColor=s):a==="s"?(e.sNumber=o.leftTime,e.sColor=s):a==="r"&&(e.rNumber=o.leftTime,e.rColor=s)}c.forEach((o,i)=>{const e=l.get(i);if(!e)return;const a=this.countdownPanelProps.find(s=>s.crossId===n&&s.roadId===i);if(a)a.lampStatus=o;else{let s=new d.Point({x:e.panelPoint[0],y:e.panelPoint[1]});this.view.spatialReference.isWebMercator&&(s=u.geographicToWebMercator(s));const r=this.view.toScreen(s),h=this.getPanelRotation(e.coord);this.countdownPanelProps.push({displayMode:"complex",crossId:n,roadId:i,mapPoint:e.panelPoint,stopLine:e.coord,position:{left:r.x,top:r.y},rotation:h,scale:this.getPanelScale(),lampStatus:o})}})}clearSignal(){var t;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(t=this.watchHandle)==null||t.remove(),this.watchHandle=null}getPanelRotation(t){const n=t[0];let l=new d.Point({x:n[0],y:n[1]});this.view.spatialReference.isWebMercator&&(l=u.geographicToWebMercator(l));const p=this.view.toScreen(l),c=t[t.length-1];let o=new d.Point({x:c[0],y:c[1]});this.view.spatialReference.isWebMercator&&(o=u.geographicToWebMercator(o));const i=this.view.toScreen(o),e=i.x-p.x,a=i.y-p.y;return Math.atan2(a,e)*(180/Math.PI)}}exports.default=M;
|
|
@@ -3,10 +3,15 @@ export default class TraceRendererLayer implements ITraceRendererInterface {
|
|
|
3
3
|
private view;
|
|
4
4
|
private readonly vehicleLayer;
|
|
5
5
|
private mapConfig;
|
|
6
|
+
private hasGpu;
|
|
6
7
|
private rafSignal;
|
|
7
8
|
private appDataStore;
|
|
8
9
|
private logTable;
|
|
9
10
|
constructor(view: __esri.MapView);
|
|
11
|
+
private getRendererText;
|
|
12
|
+
private em;
|
|
13
|
+
private el;
|
|
14
|
+
private getGpuText;
|
|
10
15
|
getLog(): (string | number)[][];
|
|
11
16
|
init(): Promise<void>;
|
|
12
17
|
private needInterpolate;
|
|
@@ -45,6 +50,7 @@ export default class TraceRendererLayer implements ITraceRendererInterface {
|
|
|
45
50
|
* @returns
|
|
46
51
|
*/
|
|
47
52
|
private createCIMSymbol;
|
|
53
|
+
private createMarkerSymbol;
|
|
48
54
|
/**
|
|
49
55
|
* 根据车身颜色属性返回对应的车辆图标
|
|
50
56
|
* @param carColor
|
|
@@ -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 p=require("@arcgis/core/Graphic"),g=require("@arcgis/core/layers/GraphicsLayer"),m=require("vue"),u=require("../../stores/index.js");class y{constructor(i){this.hasGpu=!1,this.appDataStore=u.default.useAppDataStore,this.logTable=[["uuid","ptcId","plateno","timestamp","localTimestamp","timestamp_str","speed","laneNo","objHeight","objLength","latitude","longitude","ptcType","vehicleType","vehicleColor","plateColor","sbdm","heading","fixAngle","roadLayer","status","step","receiveTimestamp"]],this.needInterpolate=!0,this.isPaused=!1,this.showVehiclePlate=!1,this.showGroundVehicle=!0,this.showElevatedVehicle=!0,this.historyPositionMap=new Map,this.vehicleObjectMap=new Map,this.view=i,this.mapConfig=m.toRaw(this.appDataStore.mapConfig),this.vehicleLayer=new g({id:"vehicleLayer"}),this.view.map.add(this.vehicleLayer);const t=this.getRendererText(),e=this.getGpuText(t);this.hasGpu=e!=="Unknown",this.hasGpu&&(this.rafSignal=requestAnimationFrame(()=>this.render())),console.log("rendererText: ",t),console.log("gpuText: ",e)}getRendererText(){try{const i=document.createElement("canvas"),t=i.getContext("webgl")||i.getContext("experimental-webgl");if(!t)return"Unknown";const e=t.getExtension("WEBGL_debug_renderer_info");return e&&t.getParameter(e.UNMASKED_RENDERER_WEBGL)||"Unknown"}catch{return"Unknown"}}em(i){const t=[],e=i.split("");for(let s=0;s<e.length;s++)if(e[s]==="(")t.push(s);else if(e[s]===")"){const r=t.pop();r!==void 0&&(e.splice(r,s-r+1),s=r-1)}return e.join("")}el(i){return this.em(i).replace(/\/PCIe\/SSE2/g,"").replace(/\s+/g," ").trim()}getGpuText(i){try{if(/, or similar$/.test(i)||/SwiftShader/.test(i))return"Unknown";if(/^ANGLE/.test(i)){const t=i.match(/\((.+)\)$/);if(t){const e=t[1],s=e.split(/,\s*/g);let r=s[1];return/^ANGLE Metal Renderer: /.test(r)&&(r=i.split(": ")[1].split(",")[0]),s.length===1&&(r=s[0].split(" ").slice(1).join(" ")),/Direct3D/.test(r)&&(r=r.split("Direct3D")[0].trim()),r}}}catch{return"Unknown"}return this.el(i)}getLog(){return this.logTable}async init(){}addVehicles(i){return new Promise(t=>{if(this.isPaused){t();return}const e=i.map(s=>{const{vehicleId:r,heading:o,localTimestamp:h}=s,n=Number(s.x),l=Number(s.y),a=new p({geometry:{type:"point",x:n,y:l},attributes:{...s,type:"trackVehicle"},symbol:this.hasGpu?this.createCIMSymbol(s):this.createMarkerSymbol()});return this.hasGpu&&(a.visible=!1,this.historyPositionMap.set(r,[{pos:[n,l,0],heading:o,time:h}]),this.vehicleObjectMap.set(r,{graphic:a,data:s,waitForDelete:!1,isMoving:!1})),a});this.vehicleLayer.addMany(e),t()})}updateVehicles(i){return new Promise(t=>{if(this.isPaused){t();return}const e=[];i.forEach(s=>{const{vehicleId:r,heading:o,localTimestamp:h}=s,n=Number(s.x),l=Number(s.y);if(this.hasGpu){const a=this.vehicleObjectMap.get(r);a?(a.data=s,a.graphic.attributes={...s,type:"trackVehicle"},this.historyPositionMap.get(r).push({pos:[n,l,0],heading:o,time:h})):e.push(s)}else{const a=this.vehicleLayer.graphics.find(c=>c.getAttribute("vehicleId")==s.vehicleId);a?a.geometry={type:"point",x:n,y:l}:e.push(s)}}),this.addVehicles(e),t()})}deleteVehicles(i){this.isPaused||(this.hasGpu?i.forEach(t=>{const e=this.vehicleObjectMap.get(t);e&&(e.waitForDelete=!0)}):i.forEach(t=>{const e=this.vehicleLayer.graphics.find(s=>s.getAttribute("vehicleId")==t);e&&this.vehicleLayer.remove(e)}))}clearVehicles(){this.vehicleLayer.removeAll(),this.vehicleObjectMap.clear(),this.historyPositionMap.clear()}toggleGroundVehicle(i){this.showGroundVehicle=i}toggleElevatedVehicle(i){this.showElevatedVehicle=i}toggleTrafficInfo(i){i.name==="vehiclePlate"&&(this.showVehiclePlate=i.visible)}togglePause(i){this.isPaused=i,this.isPaused&&this.rafSignal?cancelAnimationFrame(this.rafSignal):this.rafSignal=requestAnimationFrame(()=>this.render())}updatePanelContent(i){console.log(i)}setInterpolate(i){this.needInterpolate=i}render(){this.isPaused||this.vehicleObjectMap.forEach((i,t)=>{this.updatePosition(t)}),this.rafSignal=requestAnimationFrame(()=>this.render())}updatePosition(i){const t=this.historyPositionMap.get(i),e=this.vehicleObjectMap.get(i);if(!t||!e||!e.isMoving&&t.length<=2)return;e.isMoving=!0,(e.graphic.getAttribute("roadLayer")||"1")==="1"?e.graphic.visible=this.showGroundVehicle:e.graphic.visible=this.showElevatedVehicle,e.segmentStartTime||(e.segmentStartTime=Date.now(),e.segmentTotalTime=t[1].time-t[0].time);const r=Date.now()-e.segmentStartTime,o=Math.min(1,r/e.segmentTotalTime);if(o===1)if(t.shift(),t.length===1){e.waitForDelete?(this.vehicleLayer.remove(e.graphic),this.vehicleObjectMap.delete(i),this.historyPositionMap.delete(i)):(e.segmentStartTime=void 0,e.segmentTotalTime=void 0,e.graphic.visible=!1,e.isMoving=!1);return}else e.segmentStartTime=Date.now(),e.segmentTotalTime=t[1].time-t[0].time,Math.abs(t[1].heading-t[0].heading)>180&&(t[1].heading>t[0].heading?t[0].heading+=360:t[1].heading+=360),e.graphic.geometry={type:"point",x:t[0].pos[0],y:t[0].pos[1]};else{const h=t[0].pos[0]+(t[1].pos[0]-t[0].pos[0])*o,n=t[0].pos[1]+(t[1].pos[1]-t[0].pos[1])*o,l=t[0].heading+(t[1].heading-t[0].heading)*o;e.graphic.geometry={type:"point",x:h,y:n},e.data.heading=l,e.graphic.symbol=this.hasGpu?this.createCIMSymbol(e.data):this.createMarkerSymbol()}}createCIMSymbol(i){const t=this.getPlateFontColor(i.plateColor),e=this.getCarPic(i.vehicleColor,i.speed);return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.showName",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:this.showVehiclePlate,size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-8,ymin:-8,xmax:8,ymax:8},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:4,horizontalAlignment:"Center",offsetX:0,offsetY:8,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t.backgroundColor}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t.fillColor}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:e.size,rotation:i.heading,rotateClockwise:!0,textureFilter:"Picture",url:`${this.mapConfig.assetsRoot}Images/${e.pic}`}]}}}}createMarkerSymbol(){return{type:"simple-marker",color:"green",size:5,outline:{color:"white",width:1}}}getCarPic(i,t){if(this.view.scale>=1e3){let e="point_green.png";return t&&(t<=4.2?e="point_red.png":t<=8.4?e="point_yellow.png":e="point_green.png"),{pic:e,size:15}}else{let e="grey";switch(typeof i=="string"&&(i=i.toLowerCase()),i){case"a":case 1:e="white";break;case"b":case 2:e="grey";break;case"c":case 3:e="yellow";break;case"d":case 4:e="pink";break;case"e":case 5:e="red";break;case"f":case 10:e="purple";break;case"g":case 6:e="green";break;case"h":case 7:e="blue";break;case"i":case 8:e="brown";break;case"j":case 9:e="black";break}return{pic:"/car/"+e+".png",size:20}}}getPlateFontColor(i){let t=[255,255,255,255],e=[169,169,169,255];switch(i){case 0:t=[0,0,0,255],e=[255,255,255,255];break;case 1:t=[0,0,0,255],e=[244,164,96,255];break;case 2:t=[255,255,255,255],e=[65,105,225,255];break;case 3:t=[255,255,255,255],e=[0,0,0,255];break;case 15:t=[244,164,96,255],e=[0,250,154,255];break;case 16:t=[0,0,0,255],e=[0,250,154,255];break}return{fillColor:t,backgroundColor:e}}}exports.default=y;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IResult } from '../../../types';
|
|
1
|
+
import { IEditSignalControlAreaParams, IResult, IShowSignalControlAreaParams } from '../../../types';
|
|
2
2
|
export default class SignalControlAreaController {
|
|
3
3
|
private view;
|
|
4
4
|
private districtControllerLayer;
|
|
@@ -15,10 +15,7 @@ export default class SignalControlAreaController {
|
|
|
15
15
|
* @param params
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
|
-
showSignalControlArea(params:
|
|
19
|
-
areaList: any[];
|
|
20
|
-
style?: string;
|
|
21
|
-
}): IResult;
|
|
18
|
+
showSignalControlArea(params: IShowSignalControlAreaParams): IResult;
|
|
22
19
|
clearSignalControlArea(): IResult;
|
|
23
20
|
locateSignalControlArea(params: {
|
|
24
21
|
id: string;
|
|
@@ -47,12 +44,7 @@ export default class SignalControlAreaController {
|
|
|
47
44
|
* 编辑子区的路口
|
|
48
45
|
* @returns
|
|
49
46
|
*/
|
|
50
|
-
|
|
51
|
-
id: string;
|
|
52
|
-
name: string;
|
|
53
|
-
}) => void, removeCrossCallback: (params: {
|
|
54
|
-
id: string;
|
|
55
|
-
}) => void): Promise<IResult>;
|
|
47
|
+
editSubSignalControlArea(params: IEditSignalControlAreaParams): Promise<IResult>;
|
|
56
48
|
/**
|
|
57
49
|
* 从外部接口选中一个路口
|
|
58
50
|
* @param id
|
|
@@ -1 +1 @@
|
|
|
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"),I=require("../../stores/index.js"),A=require("./district-controller.js");function m(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const L=m(b),n=m(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 u({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{junctionId:a}=s;if(s.signalId&&!this.crossIdsInDistrict.includes(a)||this.crossLayer.graphics.some(c=>c.getAttribute("id")===a))continue;const g=new u({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 editSubSignalArea(e,t,r){if(this.openDriveServer){this.crossIdsInDistrict=e,this.addCrossCallback=t,this.removeCrossCallback=r,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=n.lineString(r);else{if(t){const h=n.featureCollection(r.map(p=>n.point(p)));s=f(h)}else{const h=S(r,.5);h.length>=4&&(s=n.polygon([h]))}s||(s=n.lineString(r))}const a=d(s.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 g={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},c=new u({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:l}]}});t?this.districtControllerLayer.add(c):this.subDistrictControllerLayer.add(c)}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},l=new u({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(l)}),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 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;
|
package/lib/src/types/index.d.ts
CHANGED
|
@@ -270,3 +270,21 @@ export interface ISignalCountdownProps {
|
|
|
270
270
|
rColor?: string;
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
|
+
export interface IShowSignalControlAreaParams {
|
|
274
|
+
areaList: any[];
|
|
275
|
+
style?: string;
|
|
276
|
+
}
|
|
277
|
+
export interface IEditSignalControlAreaParams {
|
|
278
|
+
crossesInArea: {
|
|
279
|
+
id: string;
|
|
280
|
+
x: number;
|
|
281
|
+
y: number;
|
|
282
|
+
}[];
|
|
283
|
+
addCrossCallback: (params: {
|
|
284
|
+
id: string;
|
|
285
|
+
name: string;
|
|
286
|
+
}) => void;
|
|
287
|
+
removeCrossCallback: (params: {
|
|
288
|
+
id: string;
|
|
289
|
+
}) => void;
|
|
290
|
+
}
|