gisviewer-vue3-arcgis 1.0.130 → 1.0.131
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 +7 -1
- package/es/src/gis-map/gis-map.vue.mjs +98 -94
- package/es/src/gis-map/index.d.ts +7 -1
- package/es/src/gis-map/utils/holo-flow/index.mjs +2 -1
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +1 -0
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +2 -2
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +12 -1
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +87 -52
- package/lib/src/gis-map/gis-map.vue.d.ts +7 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +7 -1
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +12 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -79,7 +79,13 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
79
79
|
splitOpenDriveLane: (params: ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
80
80
|
showSignalControlArea: (params: any) => import("../types").IResult;
|
|
81
81
|
clearSignalControlArea: () => void;
|
|
82
|
-
locateSignalControlArea: (params:
|
|
82
|
+
locateSignalControlArea: (params: {
|
|
83
|
+
id: string;
|
|
84
|
+
}) => Promise<import("../types").IResult>;
|
|
85
|
+
highlightSignalControlArea: (params: {
|
|
86
|
+
id: string;
|
|
87
|
+
}) => Promise<import("../types").IResult>;
|
|
88
|
+
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
83
89
|
props: any;
|
|
84
90
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
85
91
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1,91 +1,93 @@
|
|
|
1
|
-
import { defineComponent as Ce, ref as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as Ce, ref as S, onMounted as Oe, getCurrentInstance as ke, onUnmounted as Te, computed as Ae, openBlock as De, createElementBlock as Ie, createElementVNode as p, withDirectives as Le, vShow as be } from "vue";
|
|
2
|
+
import C, { registerStore as _e } from "./stores/index.mjs";
|
|
3
3
|
import "./style/index.css";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
4
|
+
import He from "./utils/holo-flow/index.mjs";
|
|
5
|
+
import xe from "./utils/map-initializer.mjs";
|
|
6
|
+
import O from "./utils/open-drive-renderer/index.mjs";
|
|
7
|
+
import Me from "./utils/overlay.mjs";
|
|
8
|
+
import Ve from "./utils/queue-length.mjs";
|
|
9
9
|
import k from "./utils/road-config-tool/index.mjs";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
const
|
|
10
|
+
import Be from "./utils/signal-control-area-controller/index.mjs";
|
|
11
|
+
import ze from "./utils/traffic-flow.mjs";
|
|
12
|
+
const Ne = { class: "gis-viewer" }, Qe = { style: { position: "absolute", bottom: "10px", left: "10px" } }, Je = /* @__PURE__ */ Ce({
|
|
13
13
|
__name: "gis-map",
|
|
14
14
|
props: {
|
|
15
15
|
config: {},
|
|
16
16
|
assetsRoot: {}
|
|
17
17
|
},
|
|
18
18
|
emits: ["mapLoaded", "markerClick", "mapClick"],
|
|
19
|
-
setup(
|
|
20
|
-
const g =
|
|
21
|
-
let
|
|
22
|
-
const f =
|
|
23
|
-
|
|
24
|
-
if (
|
|
19
|
+
setup(T, { expose: A, emit: D }) {
|
|
20
|
+
const g = S(null);
|
|
21
|
+
let i, c, s, n, a, r, u, t, o;
|
|
22
|
+
const f = S(!1);
|
|
23
|
+
Oe(async () => {
|
|
24
|
+
if (_e(), !g.value)
|
|
25
25
|
return;
|
|
26
|
-
document.addEventListener("keydown", (
|
|
27
|
-
|
|
26
|
+
document.addEventListener("keydown", (m) => {
|
|
27
|
+
m.ctrlKey && m.key === "i" && (f.value = !f.value);
|
|
28
28
|
});
|
|
29
|
-
const e =
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
29
|
+
const e = ke(), { $gisviewerAssetsRoot: l } = e.appContext.config.globalProperties, h = await (await fetch(y.config)).json();
|
|
30
|
+
h.assetsRoot = y.assetsRoot || l;
|
|
31
|
+
const he = C.useAppDataStore;
|
|
32
|
+
he.mapConfig = h, c = new xe(), i = await c.initialize({
|
|
33
33
|
container: g.value,
|
|
34
|
-
markerClickCallback: (
|
|
35
|
-
w("markerClick",
|
|
34
|
+
markerClickCallback: (m, d, v, Se) => {
|
|
35
|
+
w("markerClick", m, d, v, Se);
|
|
36
36
|
},
|
|
37
|
-
mapClickCallback: (
|
|
38
|
-
w("mapClick",
|
|
37
|
+
mapClickCallback: (m, d, v) => {
|
|
38
|
+
w("mapClick", m, d, v);
|
|
39
39
|
}
|
|
40
|
-
}),
|
|
40
|
+
}), a = new He(i), await a.init(), w("mapLoaded");
|
|
41
|
+
}), Te(() => {
|
|
42
|
+
o == null || o.clearSignalControlArea(), t == null || t.clearOpenDrive(), a == null || a.clearHoloTrace(), a == null || a.clearHoloSignal(), n == null || n.disconnectTrafficFlow();
|
|
41
43
|
});
|
|
42
|
-
const
|
|
43
|
-
const e =
|
|
44
|
+
const I = Ae(() => i), L = () => {
|
|
45
|
+
const e = C.useAppDataStore;
|
|
44
46
|
e.saveTrackLog = !0;
|
|
45
47
|
}, b = () => {
|
|
46
|
-
|
|
47
|
-
}, _ = async (e) => await
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
|
|
48
|
+
a.downloadTrackLog();
|
|
49
|
+
}, _ = async (e) => await c.setMapCenter(e), H = async (e) => await c.setMapCamera(e), x = async (e) => await c.lookAt(e), M = (e) => c.setLayerVisibility(e), V = (e, l) => c.requestCoordinateTransform(e, l), B = (e) => {
|
|
50
|
+
c.cancelCoordinateTransform(e);
|
|
51
|
+
}, z = (e) => {
|
|
52
|
+
c.setMapZoomRange(e);
|
|
53
|
+
}, N = (e) => (s || (s = new k(i)), s.showLaneNumber(e)), Q = () => {
|
|
54
|
+
s == null || s.clearLaneNumber();
|
|
55
|
+
}, j = async (e) => (s || (s = new k(i)), await s.initializeSearch(e)), P = async () => s == null ? void 0 : s.calCrossIndicatorArea(), E = async () => {
|
|
56
|
+
}, F = async (e, l) => {
|
|
57
|
+
n || (n = new ze(i)), n.connectTrafficFlow(e, l);
|
|
58
|
+
}, R = () => {
|
|
59
|
+
n == null || n.disconnectTrafficFlow();
|
|
58
60
|
}, Z = (e) => {
|
|
59
|
-
|
|
61
|
+
a.handleVehicleTraceData(e);
|
|
60
62
|
}, q = () => {
|
|
61
|
-
|
|
63
|
+
a.clearHoloTrace();
|
|
62
64
|
}, K = (e) => {
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
await
|
|
66
|
-
},
|
|
67
|
-
|
|
65
|
+
a.setInterpolate(e);
|
|
66
|
+
}, U = async (e) => {
|
|
67
|
+
await a.handleSignalData(e);
|
|
68
|
+
}, $ = () => {
|
|
69
|
+
a.clearHoloSignal();
|
|
70
|
+
}, G = (e) => {
|
|
71
|
+
n == null || n.toggleTrafficInfo(e), a.toggleTrafficInfo(e);
|
|
68
72
|
}, J = (e) => {
|
|
69
|
-
|
|
70
|
-
}, U = (e) => {
|
|
71
|
-
r.togglePause(e);
|
|
73
|
+
a.togglePause(e);
|
|
72
74
|
}, W = (e) => {
|
|
73
|
-
|
|
75
|
+
n == null || n.toggleTrafficObject(e), a.toggleTrafficObject(e);
|
|
74
76
|
}, X = (e) => {
|
|
75
|
-
|
|
76
|
-
}, Y = async (e) => (
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
}, se = async (e, l) => (t || (t = new
|
|
77
|
+
a.updatePanelContent(e);
|
|
78
|
+
}, Y = async (e) => (r || (r = new Me(i)), r.addOverlays(e)), ee = (e) => r == null ? void 0 : r.removeOverlaysByType(e), te = (e) => r == null ? void 0 : r.removeOverlaysById(e), ae = () => r == null ? void 0 : r.removeAllOverlays(), ne = () => {
|
|
79
|
+
r == null || r.showAllOverlays();
|
|
80
|
+
}, re = (e) => {
|
|
81
|
+
u || (u = new Ve(i)), u.updateQueueLength(e);
|
|
82
|
+
}, oe = () => {
|
|
83
|
+
u == null || u.removeQueueLength();
|
|
84
|
+
}, se = async (e, l) => (t || (t = new O(i)), await t.showOpenDriveFromServer(e, l)), ie = async (e) => (t || (t = new O(i)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), ce = async () => await (t == null ? void 0 : t.clearOpenDrive()), le = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
|
|
83
85
|
status: -1,
|
|
84
86
|
message: "未加载OpenDrive地图"
|
|
85
|
-
},
|
|
87
|
+
}, ue = async (e) => t ? t.selectSumo(e) : {
|
|
86
88
|
status: -1,
|
|
87
89
|
message: "未加载OpenDrive地图"
|
|
88
|
-
},
|
|
90
|
+
}, me = async (e) => t ? t.unselectSumo(e) : {
|
|
89
91
|
status: -1,
|
|
90
92
|
message: "未加载OpenDrive地图"
|
|
91
93
|
}, pe = async (e) => t ? await t.getSumoInfo(e) : {
|
|
@@ -94,71 +96,73 @@ const Ve = { class: "gis-viewer" }, Be = { style: { position: "absolute", bottom
|
|
|
94
96
|
}, ge = async (e) => t ? await (t == null ? void 0 : t.splitLane(e)) : {
|
|
95
97
|
status: -1,
|
|
96
98
|
message: "未加载OpenDrive地图"
|
|
97
|
-
}, fe = (e) => (
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
return
|
|
101
|
-
mapViewer:
|
|
102
|
-
setLayerVisibility:
|
|
99
|
+
}, fe = (e) => (o || (o = new Be(i)), o.showSignalControlArea(e)), we = () => {
|
|
100
|
+
o == null || o.clearSignalControlArea();
|
|
101
|
+
}, de = async (e) => o ? await o.locateSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, ve = async (e) => o ? await o.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, ye = () => o ? o.resetHighlight() : { status: -1, message: "未加载信号控制区" }, y = T, w = D;
|
|
102
|
+
return A({
|
|
103
|
+
mapViewer: I,
|
|
104
|
+
setLayerVisibility: M,
|
|
103
105
|
setMapCenter: _,
|
|
104
|
-
lookAt:
|
|
105
|
-
setMapCamera:
|
|
106
|
-
setMapZoomRange:
|
|
106
|
+
lookAt: x,
|
|
107
|
+
setMapCamera: H,
|
|
108
|
+
setMapZoomRange: z,
|
|
107
109
|
requestCoordinateTransform: V,
|
|
108
110
|
cancelCoordinateTransform: B,
|
|
109
111
|
addOverlays: Y,
|
|
110
|
-
showAllOverlays:
|
|
112
|
+
showAllOverlays: ne,
|
|
111
113
|
removeOverlaysByType: ee,
|
|
112
114
|
removeOverlaysById: te,
|
|
113
|
-
removeAllOverlays:
|
|
114
|
-
showLaneNumber:
|
|
115
|
-
clearLaneNumber:
|
|
116
|
-
initializeAreaTool:
|
|
117
|
-
calCrossIndicatorArea:
|
|
118
|
-
calRoadIndicatorArea:
|
|
119
|
-
connectCarFlow:
|
|
120
|
-
disconnectCarFlow:
|
|
115
|
+
removeAllOverlays: ae,
|
|
116
|
+
showLaneNumber: N,
|
|
117
|
+
clearLaneNumber: Q,
|
|
118
|
+
initializeAreaTool: j,
|
|
119
|
+
calCrossIndicatorArea: P,
|
|
120
|
+
calRoadIndicatorArea: E,
|
|
121
|
+
connectCarFlow: F,
|
|
122
|
+
disconnectCarFlow: R,
|
|
121
123
|
handleHoloVehicleTraceData: Z,
|
|
122
124
|
clearHoloTrace: q,
|
|
123
|
-
handleHoloSignalData:
|
|
124
|
-
clearHoloSignal:
|
|
125
|
+
handleHoloSignalData: U,
|
|
126
|
+
clearHoloSignal: $,
|
|
125
127
|
setInterpolate: K,
|
|
126
|
-
toggleTrafficInfo:
|
|
128
|
+
toggleTrafficInfo: G,
|
|
127
129
|
toggleTrafficObject: W,
|
|
128
130
|
toggleVehicleInfo: X,
|
|
129
|
-
togglePause:
|
|
130
|
-
updateQueueLength:
|
|
131
|
-
removeQueueLength:
|
|
131
|
+
togglePause: J,
|
|
132
|
+
updateQueueLength: re,
|
|
133
|
+
removeQueueLength: oe,
|
|
132
134
|
showOpenDriveFromServer: se,
|
|
133
135
|
showOpenDriveFromFile: ie,
|
|
134
136
|
clearOpenDrive: ce,
|
|
135
137
|
findSumoInOpenDrive: le,
|
|
136
|
-
selectSumoInOpenDrive:
|
|
137
|
-
unselectSumoInOpenDrive:
|
|
138
|
+
selectSumoInOpenDrive: ue,
|
|
139
|
+
unselectSumoInOpenDrive: me,
|
|
138
140
|
getSumoInfo: pe,
|
|
139
141
|
splitOpenDriveLane: ge,
|
|
140
142
|
showSignalControlArea: fe,
|
|
141
143
|
clearSignalControlArea: we,
|
|
142
|
-
locateSignalControlArea:
|
|
143
|
-
|
|
144
|
+
locateSignalControlArea: de,
|
|
145
|
+
highlightSignalControlArea: ve,
|
|
146
|
+
resetHighlightSignalControlArea: ye
|
|
147
|
+
}), (e, l) => (De(), Ie("div", Ne, [
|
|
144
148
|
p("div", {
|
|
145
149
|
class: "gis-viewer-main",
|
|
146
150
|
ref_key: "mapContainer",
|
|
147
151
|
ref: g
|
|
148
152
|
}, [
|
|
149
|
-
|
|
153
|
+
Le(p("div", Qe, [
|
|
150
154
|
p("button", {
|
|
151
155
|
style: { "margin-right": "10px" },
|
|
152
|
-
onClick:
|
|
156
|
+
onClick: L
|
|
153
157
|
}, " 开始记录 "),
|
|
154
158
|
p("button", { onClick: b }, "下载日志")
|
|
155
159
|
], 512), [
|
|
156
|
-
[
|
|
160
|
+
[be, f.value]
|
|
157
161
|
])
|
|
158
162
|
], 512)
|
|
159
163
|
]));
|
|
160
164
|
}
|
|
161
165
|
});
|
|
162
166
|
export {
|
|
163
|
-
|
|
167
|
+
Je as default
|
|
164
168
|
};
|
|
@@ -68,7 +68,13 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
68
68
|
splitOpenDriveLane: (params: import("../types").ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
69
69
|
showSignalControlArea: (params: any) => import("../types").IResult;
|
|
70
70
|
clearSignalControlArea: () => void;
|
|
71
|
-
locateSignalControlArea: (params:
|
|
71
|
+
locateSignalControlArea: (params: {
|
|
72
|
+
id: string;
|
|
73
|
+
}) => Promise<import("../types").IResult>;
|
|
74
|
+
highlightSignalControlArea: (params: {
|
|
75
|
+
id: string;
|
|
76
|
+
}) => Promise<import("../types").IResult>;
|
|
77
|
+
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
72
78
|
props: any;
|
|
73
79
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
74
80
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -58,7 +58,8 @@ class n {
|
|
|
58
58
|
this.signalHoloFlow || (this.signalHoloFlow = new a(this.view)), await this.signalHoloFlow.initializeLayer(), await this.signalHoloFlow.handleSignalData(e);
|
|
59
59
|
}
|
|
60
60
|
clearHoloSignal() {
|
|
61
|
-
|
|
61
|
+
var e;
|
|
62
|
+
(e = this.signalHoloFlow) == null || e.clearSignal();
|
|
62
63
|
}
|
|
63
64
|
setInterpolate(e) {
|
|
64
65
|
this.traceHoloFlow.setInterpolate(e);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class r {
|
|
2
2
|
constructor(t) {
|
|
3
|
-
this.crosses = [], this.subDistricts = [], this.areaColor = [
|
|
3
|
+
this.parentName = "", this.crosses = [], this.subDistricts = [], this.areaColor = [
|
|
4
4
|
Math.floor(Math.random() * 255),
|
|
5
5
|
Math.floor(Math.random() * 255),
|
|
6
6
|
Math.floor(Math.random() * 255)
|
|
@@ -8,7 +8,7 @@ class r {
|
|
|
8
8
|
for (const s of t.children)
|
|
9
9
|
if (s.children) {
|
|
10
10
|
const o = new r(s);
|
|
11
|
-
o.areaColor = this.areaColor, this.subDistricts.push(o), this.subDistrictCount++, this.crossCount += o.crossCount;
|
|
11
|
+
o.parentName = this.name, o.areaColor = this.areaColor, this.subDistricts.push(o), this.subDistrictCount++, this.crossCount += o.crossCount;
|
|
12
12
|
} else {
|
|
13
13
|
const o = {
|
|
14
14
|
id: s.id,
|
|
@@ -4,13 +4,24 @@ export default class SignalControlAreaController {
|
|
|
4
4
|
private districtControllerLayer;
|
|
5
5
|
private subDistrictControllerLayer;
|
|
6
6
|
private crossLayer;
|
|
7
|
+
private highlightLayer;
|
|
7
8
|
private eventHandle?;
|
|
8
9
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
9
10
|
showSignalControlArea(params: any): IResult;
|
|
10
11
|
clearSignalControlArea(): IResult;
|
|
11
12
|
locateSignalControlArea(params: {
|
|
12
13
|
id: string;
|
|
13
|
-
}): IResult
|
|
14
|
+
}): Promise<IResult>;
|
|
15
|
+
highlightSignalControlArea(params: {
|
|
16
|
+
id: string;
|
|
17
|
+
}): Promise<IResult>;
|
|
18
|
+
resetHighlight(): IResult;
|
|
19
|
+
/**
|
|
20
|
+
* 在区控\子区\路口图层中查找对应的graphic
|
|
21
|
+
* @param id
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
private findAreaGraphic;
|
|
14
25
|
/**
|
|
15
26
|
* 绘制区控与子区
|
|
16
27
|
* @param districtController
|
|
@@ -1,61 +1,86 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import h from "@arcgis/core/Graphic";
|
|
2
|
+
import a from "@arcgis/core/layers/GraphicsLayer";
|
|
3
|
+
import y from "@turf/buffer";
|
|
4
|
+
import g from "@turf/convex";
|
|
5
5
|
import * as c from "@turf/helpers";
|
|
6
|
-
import
|
|
7
|
-
class
|
|
6
|
+
import m from "./district-controller.mjs";
|
|
7
|
+
class C {
|
|
8
8
|
constructor(e) {
|
|
9
9
|
this.view = e, this.view.popup.visibleElements = {
|
|
10
10
|
closeButton: !0,
|
|
11
11
|
collapseButton: !1,
|
|
12
|
-
actionBar: !
|
|
13
|
-
}, this.districtControllerLayer = new
|
|
12
|
+
actionBar: !0
|
|
13
|
+
}, this.districtControllerLayer = new a({
|
|
14
14
|
id: "districtControllerLayer",
|
|
15
15
|
maxScale: 144447,
|
|
16
16
|
minScale: 1155582
|
|
17
|
-
}), this.subDistrictControllerLayer = new
|
|
17
|
+
}), this.subDistrictControllerLayer = new a({
|
|
18
18
|
id: "subDistrictControllerLayer",
|
|
19
19
|
maxScale: 0,
|
|
20
20
|
minScale: 144447
|
|
21
|
-
}), this.crossLayer = new
|
|
21
|
+
}), this.crossLayer = new a({
|
|
22
22
|
id: "crossLayer",
|
|
23
23
|
maxScale: 0,
|
|
24
|
-
minScale:
|
|
24
|
+
minScale: 36112
|
|
25
|
+
}), this.highlightLayer = new a({
|
|
26
|
+
id: "highlightLayer"
|
|
25
27
|
}), this.view.map.addMany([
|
|
26
|
-
this.crossLayer,
|
|
27
28
|
this.districtControllerLayer,
|
|
28
|
-
this.subDistrictControllerLayer
|
|
29
|
+
this.subDistrictControllerLayer,
|
|
30
|
+
this.crossLayer,
|
|
31
|
+
this.highlightLayer
|
|
29
32
|
]);
|
|
30
33
|
}
|
|
31
34
|
showSignalControlArea(e) {
|
|
35
|
+
this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0;
|
|
32
36
|
for (const t of e) {
|
|
33
|
-
const r = new
|
|
37
|
+
const r = new m(t);
|
|
34
38
|
this.drawArea(r, !0);
|
|
35
39
|
}
|
|
36
40
|
return { status: 0, message: "ok" };
|
|
37
41
|
}
|
|
38
42
|
clearSignalControlArea() {
|
|
39
43
|
var e;
|
|
40
|
-
return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), (e = this.eventHandle) == null || e.remove(), this.view.closePopup(), { status: 0, message: "ok" };
|
|
44
|
+
return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), (e = this.eventHandle) == null || e.remove(), this.view.closePopup(), { status: 0, message: "ok" };
|
|
41
45
|
}
|
|
42
|
-
locateSignalControlArea(e) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (t || (t = this.subDistrictControllerLayer.graphics.find(
|
|
47
|
-
(r) => r.attributes.id === e.id
|
|
48
|
-
)), t || (t = this.crossLayer.graphics.find(
|
|
49
|
-
(r) => r.attributes.id === e.id
|
|
50
|
-
)), t) {
|
|
51
|
-
this.view.goTo(t.geometry);
|
|
46
|
+
async locateSignalControlArea(e) {
|
|
47
|
+
const t = this.findAreaGraphic(e.id);
|
|
48
|
+
if (t) {
|
|
49
|
+
await this.view.goTo(t.geometry);
|
|
52
50
|
const r = t.geometry.type === "point" ? t.geometry : t.geometry.centroid;
|
|
53
51
|
return this.view.popup.open({
|
|
54
52
|
features: [t],
|
|
55
53
|
location: r
|
|
56
54
|
}), { status: 0, message: "ok" };
|
|
57
|
-
}
|
|
58
|
-
|
|
55
|
+
} else
|
|
56
|
+
return { status: 1, message: "未找到" };
|
|
57
|
+
}
|
|
58
|
+
async highlightSignalControlArea(e) {
|
|
59
|
+
this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.crossLayer.visible = !1;
|
|
60
|
+
const t = this.districtControllerLayer.graphics.filter((i) => i.getAttribute("id") === e.id).toArray(), r = this.subDistrictControllerLayer.graphics.filter(
|
|
61
|
+
(i) => i.getAttribute("id") === e.id || i.getAttribute("parentId") === e.id
|
|
62
|
+
).toArray(), s = this.crossLayer.graphics.filter(
|
|
63
|
+
(i) => i.getAttribute("id") === e.id || i.getAttribute("districtId") === e.id || i.getAttribute("subDistrictId") === e.id
|
|
64
|
+
).toArray();
|
|
65
|
+
return t.length > 0 && this.highlightLayer.addMany(t), r.length > 0 && this.highlightLayer.addMany(r), s.length > 0 && this.highlightLayer.addMany(s), this.highlightLayer.graphics.length === 0 ? { status: 1, message: "未找到" } : (await this.view.goTo(
|
|
66
|
+
t.length > 0 ? t : r.length > 0 ? r : s
|
|
67
|
+
), { status: 0, message: "ok" });
|
|
68
|
+
}
|
|
69
|
+
resetHighlight() {
|
|
70
|
+
return this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0, this.crossLayer.visible = !0, { status: 0, message: "ok" };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 在区控\子区\路口图层中查找对应的graphic
|
|
74
|
+
* @param id
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
findAreaGraphic(e) {
|
|
78
|
+
let t = this.districtControllerLayer.graphics.find(
|
|
79
|
+
(r) => r.attributes.id === e
|
|
80
|
+
);
|
|
81
|
+
return t || (t = this.subDistrictControllerLayer.graphics.find(
|
|
82
|
+
(r) => r.attributes.id === e
|
|
83
|
+
)), t || (t = this.crossLayer.graphics.find((r) => r.attributes.id === e)), t;
|
|
59
84
|
}
|
|
60
85
|
/**
|
|
61
86
|
* 绘制区控与子区
|
|
@@ -66,21 +91,21 @@ class v {
|
|
|
66
91
|
drawArea(e, t) {
|
|
67
92
|
const r = e.getAllCrossCoordinates();
|
|
68
93
|
if (r.length > 2) {
|
|
69
|
-
const
|
|
94
|
+
const i = c.featureCollection(
|
|
70
95
|
r.map((u) => c.point(u))
|
|
71
|
-
),
|
|
72
|
-
if (!
|
|
96
|
+
), l = g(i);
|
|
97
|
+
if (!l)
|
|
73
98
|
return;
|
|
74
|
-
const d =
|
|
75
|
-
|
|
99
|
+
const d = y(
|
|
100
|
+
l.geometry,
|
|
76
101
|
// 区控面积更大,需要更大的缓冲半径
|
|
77
|
-
t ? 200 :
|
|
102
|
+
t ? 200 : 30,
|
|
78
103
|
{
|
|
79
104
|
units: "meters"
|
|
80
105
|
}
|
|
81
106
|
);
|
|
82
|
-
let
|
|
83
|
-
t ?
|
|
107
|
+
let o;
|
|
108
|
+
t ? o = [
|
|
84
109
|
{
|
|
85
110
|
fieldName: "id",
|
|
86
111
|
label: "区控编号"
|
|
@@ -93,11 +118,15 @@ class v {
|
|
|
93
118
|
fieldName: "subDistrictCount",
|
|
94
119
|
label: "子区数量"
|
|
95
120
|
}
|
|
96
|
-
] :
|
|
121
|
+
] : o = [
|
|
97
122
|
{
|
|
98
123
|
fieldName: "parentId",
|
|
99
124
|
label: "区控编号"
|
|
100
125
|
},
|
|
126
|
+
{
|
|
127
|
+
fieldName: "parentName",
|
|
128
|
+
label: "区控名称"
|
|
129
|
+
},
|
|
101
130
|
{
|
|
102
131
|
fieldName: "id",
|
|
103
132
|
label: "子区编号"
|
|
@@ -107,17 +136,18 @@ class v {
|
|
|
107
136
|
label: "路口数量"
|
|
108
137
|
}
|
|
109
138
|
];
|
|
110
|
-
const
|
|
139
|
+
const n = new h({
|
|
111
140
|
geometry: {
|
|
112
141
|
type: "polygon",
|
|
113
142
|
rings: d.geometry.coordinates
|
|
114
143
|
},
|
|
115
144
|
symbol: {
|
|
116
145
|
type: "simple-fill",
|
|
117
|
-
color: [...e.areaColor, 0.
|
|
146
|
+
color: [...e.areaColor, t ? 0.6 : 0.8],
|
|
118
147
|
outline: {
|
|
119
148
|
color: e.areaColor,
|
|
120
|
-
width:
|
|
149
|
+
width: 2,
|
|
150
|
+
style: t ? "solid" : "long-dash"
|
|
121
151
|
}
|
|
122
152
|
},
|
|
123
153
|
attributes: {
|
|
@@ -125,6 +155,7 @@ class v {
|
|
|
125
155
|
id: e.id,
|
|
126
156
|
name: e.name,
|
|
127
157
|
parentId: e.parentId,
|
|
158
|
+
parentName: e.parentName,
|
|
128
159
|
crossCount: e.crossCount,
|
|
129
160
|
subDistrictCount: e.subDistrictCount
|
|
130
161
|
},
|
|
@@ -133,35 +164,39 @@ class v {
|
|
|
133
164
|
content: [
|
|
134
165
|
{
|
|
135
166
|
type: "fields",
|
|
136
|
-
fieldInfos:
|
|
167
|
+
fieldInfos: o
|
|
137
168
|
}
|
|
138
169
|
]
|
|
139
170
|
}
|
|
140
171
|
});
|
|
141
|
-
t ? this.districtControllerLayer.add(
|
|
172
|
+
t ? this.districtControllerLayer.add(n) : this.subDistrictControllerLayer.add(n);
|
|
142
173
|
}
|
|
143
|
-
for (const
|
|
144
|
-
this.drawArea(
|
|
145
|
-
const
|
|
174
|
+
for (const i of e.subDistricts)
|
|
175
|
+
this.drawArea(i, !1);
|
|
176
|
+
const s = e.crosses.map((i) => new h({
|
|
146
177
|
geometry: {
|
|
147
178
|
type: "point",
|
|
148
|
-
x:
|
|
149
|
-
y:
|
|
179
|
+
x: i.longitude,
|
|
180
|
+
y: i.latitude
|
|
150
181
|
},
|
|
151
182
|
symbol: {
|
|
152
183
|
type: "simple-marker",
|
|
153
184
|
color: e.areaColor,
|
|
154
|
-
size: 8
|
|
185
|
+
size: 8,
|
|
186
|
+
outline: {
|
|
187
|
+
color: "white",
|
|
188
|
+
width: 1
|
|
189
|
+
}
|
|
155
190
|
},
|
|
156
191
|
attributes: {
|
|
157
192
|
type: "cross",
|
|
158
|
-
id:
|
|
159
|
-
name:
|
|
193
|
+
id: i.id,
|
|
194
|
+
name: i.name,
|
|
160
195
|
districtId: t ? e.id : e.parentId,
|
|
161
196
|
subDistrictId: t ? "" : e.id
|
|
162
197
|
},
|
|
163
198
|
popupTemplate: {
|
|
164
|
-
title:
|
|
199
|
+
title: i.name,
|
|
165
200
|
content: [
|
|
166
201
|
{
|
|
167
202
|
type: "fields",
|
|
@@ -183,9 +218,9 @@ class v {
|
|
|
183
218
|
]
|
|
184
219
|
}
|
|
185
220
|
}));
|
|
186
|
-
this.crossLayer.addMany(
|
|
221
|
+
this.crossLayer.addMany(s);
|
|
187
222
|
}
|
|
188
223
|
}
|
|
189
224
|
export {
|
|
190
|
-
|
|
225
|
+
C as default
|
|
191
226
|
};
|
|
@@ -79,7 +79,13 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
79
79
|
splitOpenDriveLane: (params: ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
80
80
|
showSignalControlArea: (params: any) => import("../types").IResult;
|
|
81
81
|
clearSignalControlArea: () => void;
|
|
82
|
-
locateSignalControlArea: (params:
|
|
82
|
+
locateSignalControlArea: (params: {
|
|
83
|
+
id: string;
|
|
84
|
+
}) => Promise<import("../types").IResult>;
|
|
85
|
+
highlightSignalControlArea: (params: {
|
|
86
|
+
id: string;
|
|
87
|
+
}) => Promise<import("../types").IResult>;
|
|
88
|
+
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
83
89
|
props: any;
|
|
84
90
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
85
91
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -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 o=require("vue"),y=require("./stores/index.js");require("./style/index.css");const Se=require("./utils/holo-flow/index.js"),Ce=require("./utils/map-initializer.js"),C=require("./utils/open-drive-renderer/index.js"),Oe=require("./utils/overlay.js"),ke=require("./utils/queue-length.js"),O=require("./utils/road-config-tool/index.js"),Te=require("./utils/signal-control-area-controller/index.js"),Ae=require("./utils/traffic-flow.js"),De={class:"gis-viewer"},Le={style:{position:"absolute",bottom:"10px",left:"10px"}},Ie=o.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:T,emit:A}){const d=o.ref(null);let i,l,c,n,a,r,g,t,s;const p=o.ref(!1);o.onMounted(async()=>{if(y.registerStore(),!d.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(p.value=!p.value)});const e=o.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,S=await(await fetch(h.config)).json();S.assetsRoot=h.assetsRoot||u;const ye=y.default.useAppDataStore;ye.mapConfig=S,l=new Ce.default,i=await l.initialize({container:d.value,markerClickCallback:(m,w,v,he)=>{f("markerClick",m,w,v,he)},mapClickCallback:(m,w,v)=>{f("mapClick",m,w,v)}}),a=new Se.default(i),await a.init(),f("mapLoaded")}),o.onUnmounted(()=>{s==null||s.clearSignalControlArea(),t==null||t.clearOpenDrive(),a==null||a.clearHoloTrace(),a==null||a.clearHoloSignal(),n==null||n.disconnectTrafficFlow()});const D=o.computed(()=>i),L=()=>{const e=y.default.useAppDataStore;e.saveTrackLog=!0},I=()=>{a.downloadTrackLog()},b=async e=>await l.setMapCenter(e),q=async e=>await l.setMapCamera(e),_=async e=>await l.lookAt(e),x=e=>l.setLayerVisibility(e),H=(e,u)=>l.requestCoordinateTransform(e,u),V=e=>{l.cancelCoordinateTransform(e)},M=e=>{l.setMapZoomRange(e)},N=e=>(c||(c=new O.default(i)),c.showLaneNumber(e)),B=()=>{c==null||c.clearLaneNumber()},E=async e=>(c||(c=new O.default(i)),await c.initializeSearch(e)),j=async()=>c==null?void 0:c.calCrossIndicatorArea(),z=async()=>{},P=async(e,u)=>{n||(n=new Ae.default(i)),n.connectTrafficFlow(e,u)},Q=()=>{n==null||n.disconnectTrafficFlow()},F=e=>{a.handleVehicleTraceData(e)},Z=()=>{a.clearHoloTrace()},K=e=>{a.setInterpolate(e)},U=async e=>{await a.handleSignalData(e)},G=()=>{a.clearHoloSignal()},J=e=>{n==null||n.toggleTrafficInfo(e),a.toggleTrafficInfo(e)},R=e=>{a.togglePause(e)},W=e=>{n==null||n.toggleTrafficObject(e),a.toggleTrafficObject(e)},X=e=>{a.updatePanelContent(e)},Y=async e=>(r||(r=new Oe.default(i)),r.addOverlays(e)),$=e=>r==null?void 0:r.removeOverlaysByType(e),ee=e=>r==null?void 0:r.removeOverlaysById(e),te=()=>r==null?void 0:r.removeAllOverlays(),ae=()=>{r==null||r.showAllOverlays()},ne=e=>{g||(g=new ke.default(i)),g.updateQueueLength(e)},re=()=>{g==null||g.removeQueueLength()},se=async(e,u)=>(t||(t=new C.default(i)),await t.showOpenDriveFromServer(e,u)),oe=async e=>(t||(t=new C.default(i)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),ce=async()=>await(t==null?void 0:t.clearOpenDrive()),ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},le=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ue=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ge=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},me=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},de=e=>(s||(s=new Te.default(i)),s.showSignalControlArea(e)),pe=()=>{s==null||s.clearSignalControlArea()},fe=async e=>s?await s.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},we=async e=>s?await s.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},ve=()=>s?s.resetHighlight():{status:-1,message:"未加载信号控制区"},h=k,f=A;return T({mapViewer:D,setLayerVisibility:x,setMapCenter:b,lookAt:_,setMapCamera:q,setMapZoomRange:M,requestCoordinateTransform:H,cancelCoordinateTransform:V,addOverlays:Y,showAllOverlays:ae,removeOverlaysByType:$,removeOverlaysById:ee,removeAllOverlays:te,showLaneNumber:N,clearLaneNumber:B,initializeAreaTool:E,calCrossIndicatorArea:j,calRoadIndicatorArea:z,connectCarFlow:P,disconnectCarFlow:Q,handleHoloVehicleTraceData:F,clearHoloTrace:Z,handleHoloSignalData:U,clearHoloSignal:G,setInterpolate:K,toggleTrafficInfo:J,toggleTrafficObject:W,toggleVehicleInfo:X,togglePause:R,updateQueueLength:ne,removeQueueLength:re,showOpenDriveFromServer:se,showOpenDriveFromFile:oe,clearOpenDrive:ce,findSumoInOpenDrive:ie,selectSumoInOpenDrive:le,unselectSumoInOpenDrive:ue,getSumoInfo:ge,splitOpenDriveLane:me,showSignalControlArea:de,clearSignalControlArea:pe,locateSignalControlArea:fe,highlightSignalControlArea:we,resetHighlightSignalControlArea:ve}),(e,u)=>(o.openBlock(),o.createElementBlock("div",De,[o.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:d},[o.withDirectives(o.createElementVNode("div",Le,[o.createElementVNode("button",{style:{"margin-right":"10px"},onClick:L}," 开始记录 "),o.createElementVNode("button",{onClick:I},"下载日志")],512),[[o.vShow,p.value]])],512)]))}});exports.default=Ie;
|
|
@@ -68,7 +68,13 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
68
68
|
splitOpenDriveLane: (params: import("../types").ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
69
69
|
showSignalControlArea: (params: any) => import("../types").IResult;
|
|
70
70
|
clearSignalControlArea: () => void;
|
|
71
|
-
locateSignalControlArea: (params:
|
|
71
|
+
locateSignalControlArea: (params: {
|
|
72
|
+
id: string;
|
|
73
|
+
}) => Promise<import("../types").IResult>;
|
|
74
|
+
highlightSignalControlArea: (params: {
|
|
75
|
+
id: string;
|
|
76
|
+
}) => Promise<import("../types").IResult>;
|
|
77
|
+
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
72
78
|
props: any;
|
|
73
79
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
74
80
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../types/index.js"),a=require("./signal-holo-flow.js"),o=require("./trace-holo-flow.js");class i{constructor(e){this.view=e}async init(){this.traceHoloFlow=new o.default(this.view),await this.traceHoloFlow.init()}handleVehicleTraceData(e){this.traceHoloFlow.handleVehicleTraceData(e)}toggleTrafficObject(e){switch(e.name.toLowerCase()){case"groundVehicle".toLowerCase():this.traceHoloFlow.toggleGroundVehicle(e.visible);break;case"elevatedVehicle".toLowerCase():this.traceHoloFlow.toggleElevatedVehicle(e.visible);break}}clearHoloTrace(){this.traceHoloFlow.clearTrace()}toggleTrafficInfo(e){this.traceHoloFlow.toggleTrafficInfo(e)}togglePause(e){this.traceHoloFlow.togglePause(e)}updatePanelContent(e){let l=t.EVehiclePlateState.None;switch(e){case"none":l=t.EVehiclePlateState.None;break;case"plateNumber":l=t.EVehiclePlateState.PlateNumber;break;case"vehicleId":l=t.EVehiclePlateState.Id;break;case"mix":l=t.EVehiclePlateState.Mix;break}this.traceHoloFlow.updatePanelContent(l)}async handleSignalData(e){this.signalHoloFlow||(this.signalHoloFlow=new a.default(this.view)),await this.signalHoloFlow.initializeLayer(),await this.signalHoloFlow.handleSignalData(e)}clearHoloSignal(){this.signalHoloFlow.clearSignal()}setInterpolate(e){this.traceHoloFlow.setInterpolate(e)}downloadTrackLog(){this.traceHoloFlow.downloadLog()}}exports.default=i;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../types/index.js"),a=require("./signal-holo-flow.js"),o=require("./trace-holo-flow.js");class i{constructor(e){this.view=e}async init(){this.traceHoloFlow=new o.default(this.view),await this.traceHoloFlow.init()}handleVehicleTraceData(e){this.traceHoloFlow.handleVehicleTraceData(e)}toggleTrafficObject(e){switch(e.name.toLowerCase()){case"groundVehicle".toLowerCase():this.traceHoloFlow.toggleGroundVehicle(e.visible);break;case"elevatedVehicle".toLowerCase():this.traceHoloFlow.toggleElevatedVehicle(e.visible);break}}clearHoloTrace(){this.traceHoloFlow.clearTrace()}toggleTrafficInfo(e){this.traceHoloFlow.toggleTrafficInfo(e)}togglePause(e){this.traceHoloFlow.togglePause(e)}updatePanelContent(e){let l=t.EVehiclePlateState.None;switch(e){case"none":l=t.EVehiclePlateState.None;break;case"plateNumber":l=t.EVehiclePlateState.PlateNumber;break;case"vehicleId":l=t.EVehiclePlateState.Id;break;case"mix":l=t.EVehiclePlateState.Mix;break}this.traceHoloFlow.updatePanelContent(l)}async handleSignalData(e){this.signalHoloFlow||(this.signalHoloFlow=new a.default(this.view)),await this.signalHoloFlow.initializeLayer(),await this.signalHoloFlow.handleSignalData(e)}clearHoloSignal(){var e;(e=this.signalHoloFlow)==null||e.clearSignal()}setInterpolate(e){this.traceHoloFlow.setInterpolate(e)}downloadTrackLog(){this.traceHoloFlow.downloadLog()}}exports.default=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class e{constructor(s){this.parentName="",this.crosses=[],this.subDistricts=[],this.areaColor=[Math.floor(Math.random()*255),Math.floor(Math.random()*255),Math.floor(Math.random()*255)],this.crossCount=0,this.subDistrictCount=0,this.id=s.id,this.name=s.name,this.parentId=s.parentId;for(const t of s.children)if(t.children){const o=new e(t);o.parentName=this.name,o.areaColor=this.areaColor,this.subDistricts.push(o),this.subDistrictCount++,this.crossCount+=o.crossCount}else{const o={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude)};this.crosses.push(o),this.crossCount++}}getAllCrossCoordinates(){const s=[];for(const t of this.crosses)s.push([t.longitude,t.latitude]);for(const t of this.subDistricts)s.push(...t.getAllCrossCoordinates());return s}}exports.default=e;
|
|
@@ -4,13 +4,24 @@ export default class SignalControlAreaController {
|
|
|
4
4
|
private districtControllerLayer;
|
|
5
5
|
private subDistrictControllerLayer;
|
|
6
6
|
private crossLayer;
|
|
7
|
+
private highlightLayer;
|
|
7
8
|
private eventHandle?;
|
|
8
9
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
9
10
|
showSignalControlArea(params: any): IResult;
|
|
10
11
|
clearSignalControlArea(): IResult;
|
|
11
12
|
locateSignalControlArea(params: {
|
|
12
13
|
id: string;
|
|
13
|
-
}): IResult
|
|
14
|
+
}): Promise<IResult>;
|
|
15
|
+
highlightSignalControlArea(params: {
|
|
16
|
+
id: string;
|
|
17
|
+
}): Promise<IResult>;
|
|
18
|
+
resetHighlight(): IResult;
|
|
19
|
+
/**
|
|
20
|
+
* 在区控\子区\路口图层中查找对应的graphic
|
|
21
|
+
* @param id
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
private findAreaGraphic;
|
|
14
25
|
/**
|
|
15
26
|
* 绘制区控与子区
|
|
16
27
|
* @param districtController
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/GraphicsLayer"),y=require("@turf/buffer"),f=require("@turf/convex"),p=require("@turf/helpers"),b=require("./district-controller.js");function m(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=m(p);class L{constructor(e){this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!0},this.districtControllerLayer=new l({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new l({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new l({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new l({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.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const t of e){const r=new b.default(t);this.drawArea(r,!0)}return{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.eventHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);if(t){await this.view.goTo(t.geometry);const r=t.geometry.type==="point"?t.geometry:t.geometry.centroid;return this.view.popup.open({features:[t],location:r}),{status:0,message:"ok"}}else return{status:1,message:"未找到"}}async highlightSignalControlArea(e){this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id).toArray(),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("parentId")===e.id).toArray(),a=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("districtId")===e.id||i.getAttribute("subDistrictId")===e.id).toArray();return t.length>0&&this.highlightLayer.addMany(t),r.length>0&&this.highlightLayer.addMany(r),a.length>0&&this.highlightLayer.addMany(a),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(await this.view.goTo(t.length>0?t:r.length>0?r:a),{status:0,message:"ok"})}resetHighlight(){return this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}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){const i=u.featureCollection(r.map(g=>u.point(g))),n=f(i);if(!n)return;const d=y(n.geometry,t?200:30,{units:"meters"});let o;t?o=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:o=[{fieldName:"parentId",label:"区控编号"},{fieldName:"parentName",label:"区控名称"},{fieldName:"id",label:"子区编号"},{fieldName:"crossCount",label:"路口数量"}];const h=new c({geometry:{type:"polygon",rings:d.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:{type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:e.name,content:[{type:"fields",fieldInfos:o}]}});t?this.districtControllerLayer.add(h):this.subDistrictControllerLayer.add(h)}for(const i of e.subDistricts)this.drawArea(i,!1);const a=e.crosses.map(i=>new c({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:{type:"simple-marker",color:e.areaColor,size:8,outline:{color:"white",width:1}},attributes:{type:"cross",id:i.id,name:i.name,districtId:t?e.id:e.parentId,subDistrictId:t?"":e.id},popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtId",label:"区控编号"},{fieldName:"subDistrictId",label:"子区编号"},{fieldName:"id",label:"路口编号"}]}]}}));this.crossLayer.addMany(a)}}exports.default=L;
|