gisviewer-vue3-arcgis 1.0.184 → 1.0.185
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 +1 -1
- package/es/src/gis-map/gis-map.vue.mjs +26 -25
- package/es/src/gis-map/index.d.ts +1 -1
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +2 -1
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +103 -104
- package/lib/src/gis-map/gis-map.vue.d.ts +1 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +2 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -128,7 +128,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
128
128
|
}) => Promise<import("../types").IResult>;
|
|
129
129
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
130
130
|
showSubSignalControlArea: (params: any) => import("../types").IResult;
|
|
131
|
-
editSubSignalControlArea: (addCrossCallback: (params: {
|
|
131
|
+
editSubSignalControlArea: (crossIdsInDistrict: string[], addCrossCallback: (params: {
|
|
132
132
|
id: string;
|
|
133
133
|
name: string;
|
|
134
134
|
}) => void, removeCrossCallback: (params: {
|
|
@@ -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 i, u, 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: l } = e.appContext.config.globalProperties,
|
|
33
|
-
|
|
32
|
+
const e = Qe(), { $gisviewerAssetsRoot: l } = e.appContext.config.globalProperties, o = await (await fetch(O.config)).json();
|
|
33
|
+
o.assetsRoot = O.assetsRoot || l, H.mapConfig = o, u = new We(), i = await u.initialize({
|
|
34
34
|
container: d.value,
|
|
35
|
-
mapConfig:
|
|
35
|
+
mapConfig: o,
|
|
36
36
|
markerClickCallback: (m, w, h, Ve) => {
|
|
37
37
|
y("markerClick", m, w, h, Ve);
|
|
38
38
|
},
|
|
39
39
|
mapClickCallback: (m, w, h) => {
|
|
40
40
|
y("mapClick", m, w, h);
|
|
41
41
|
}
|
|
42
|
-
}), n = new Je(
|
|
42
|
+
}), n = new Je(i, 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(() => i), V = () => {
|
|
47
47
|
const e = b.useAppDataStore;
|
|
48
48
|
e.saveTrackLog = !0;
|
|
49
49
|
}, B = () => {
|
|
@@ -56,11 +56,11 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
56
56
|
u.cancelCoordinateTransform(e);
|
|
57
57
|
}, K = (e) => {
|
|
58
58
|
u.setMapZoomRange(e);
|
|
59
|
-
}, U = (e) => (c || (c = new T(
|
|
59
|
+
}, U = (e) => (c || (c = new T(i)), c.showLaneNumber(e)), G = () => {
|
|
60
60
|
c == null || c.clearLaneNumber();
|
|
61
|
-
}, J = async (e) => (c || (c = new T(
|
|
61
|
+
}, J = async (e) => (c || (c = new T(i)), await c.initializeSearch(e)), R = async () => c == null ? void 0 : c.calCrossIndicatorArea(), W = async () => {
|
|
62
62
|
}, X = async (e, l) => {
|
|
63
|
-
s || (s = new Ye(
|
|
63
|
+
s || (s = new Ye(i)), s.connectTrafficFlow(e, l);
|
|
64
64
|
}, Y = () => {
|
|
65
65
|
s == null || s.disconnectTrafficFlow();
|
|
66
66
|
}, F = async (e) => {
|
|
@@ -81,15 +81,15 @@ 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(i)), r.addOverlays(e)), ce = (e) => (r || (r = new L(i)), 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(i)), p.updateQueueLength(e);
|
|
90
90
|
}, fe = () => {
|
|
91
91
|
p == null || p.removeQueueLength();
|
|
92
|
-
}, Se = async (e, l) => (t || (t = new D(
|
|
92
|
+
}, Se = async (e, l) => (t || (t = new D(i)), await t.showOpenDriveFromServer(e, l)), ye = async (e) => (t || (t = new D(i)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), we = async () => await (t == null ? void 0 : t.clearOpenDrive()), he = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
|
|
93
93
|
status: -1,
|
|
94
94
|
message: "未加载OpenDrive地图"
|
|
95
95
|
}, Ce = async (e) => t ? t.selectSumo(e) : {
|
|
@@ -110,11 +110,12 @@ 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(i)), 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(
|
|
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(i)), a.showSubSignalControlArea(e)), xe = (e, l, o) => a ? a.editSubSignalArea(
|
|
116
116
|
e,
|
|
117
|
-
l
|
|
117
|
+
l,
|
|
118
|
+
o
|
|
118
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;
|
|
119
120
|
return _({
|
|
120
121
|
mapViewer: P,
|
|
@@ -193,17 +194,17 @@ const Fe = { class: "gis-viewer" }, et = { style: { position: "absolute", bottom
|
|
|
193
194
|
[$e, f.value]
|
|
194
195
|
])
|
|
195
196
|
], 512),
|
|
196
|
-
(C(!0), A(qe, null, Ke(v, (
|
|
197
|
+
(C(!0), A(qe, null, Ke(v, (o, m) => (C(), Ue(Re, {
|
|
197
198
|
key: m,
|
|
198
|
-
"display-mode":
|
|
199
|
-
"road-id":
|
|
200
|
-
"cross-id":
|
|
201
|
-
"map-point":
|
|
202
|
-
"stop-line":
|
|
203
|
-
position:
|
|
204
|
-
rotation:
|
|
205
|
-
scale:
|
|
206
|
-
"lamp-status":
|
|
199
|
+
"display-mode": o.displayMode,
|
|
200
|
+
"road-id": o.crossId,
|
|
201
|
+
"cross-id": o.roadId,
|
|
202
|
+
"map-point": o.mapPoint,
|
|
203
|
+
"stop-line": o.stopLine,
|
|
204
|
+
position: o.position,
|
|
205
|
+
rotation: o.rotation,
|
|
206
|
+
scale: o.scale,
|
|
207
|
+
"lamp-status": o.lampStatus
|
|
207
208
|
}, null, 8, ["display-mode", "road-id", "cross-id", "map-point", "stop-line", "position", "rotation", "scale", "lamp-status"]))), 128))
|
|
208
209
|
]));
|
|
209
210
|
}
|
|
@@ -117,7 +117,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
117
117
|
}) => Promise<import("../types").IResult>;
|
|
118
118
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
119
119
|
showSubSignalControlArea: (params: any) => import("../types").IResult;
|
|
120
|
-
editSubSignalControlArea: (addCrossCallback: (params: {
|
|
120
|
+
editSubSignalControlArea: (crossIdsInDistrict: string[], addCrossCallback: (params: {
|
|
121
121
|
id: string;
|
|
122
122
|
name: string;
|
|
123
123
|
}) => void, removeCrossCallback: (params: {
|
|
@@ -34,6 +34,7 @@ export default class SignalControlAreaController {
|
|
|
34
34
|
* @returns
|
|
35
35
|
*/
|
|
36
36
|
private handleViewClick;
|
|
37
|
+
private crossIdsInDistrict;
|
|
37
38
|
/**
|
|
38
39
|
* 显示周边的路口
|
|
39
40
|
* @param crossIds
|
|
@@ -46,7 +47,7 @@ export default class SignalControlAreaController {
|
|
|
46
47
|
* 编辑子区的路口
|
|
47
48
|
* @returns
|
|
48
49
|
*/
|
|
49
|
-
editSubSignalArea(addCrossCallback: (params: {
|
|
50
|
+
editSubSignalArea(crossIdsInDistrict: string[], addCrossCallback: (params: {
|
|
50
51
|
id: string;
|
|
51
52
|
name: string;
|
|
52
53
|
}) => void, removeCrossCallback: (params: {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as g from "@arcgis/core/core/reactiveUtils.js";
|
|
2
|
-
import
|
|
2
|
+
import h from "@arcgis/core/Graphic";
|
|
3
3
|
import y from "@arcgis/core/layers/GraphicsLayer";
|
|
4
4
|
import p from "@turf/buffer";
|
|
5
5
|
import b from "@turf/convex";
|
|
6
|
-
import * as
|
|
6
|
+
import * as l from "@turf/helpers";
|
|
7
7
|
import d from "axios";
|
|
8
8
|
import f from "concaveman";
|
|
9
9
|
import C from "../../stores/index.mjs";
|
|
10
10
|
import v from "./district-controller.mjs";
|
|
11
11
|
class N {
|
|
12
12
|
constructor(e) {
|
|
13
|
-
var
|
|
14
|
-
this.crossScale = 5e3, this.view = e;
|
|
13
|
+
var i;
|
|
14
|
+
this.crossScale = 5e3, this.crossIdsInDistrict = [], this.view = e;
|
|
15
15
|
const r = C.useAppDataStore.mapConfig;
|
|
16
|
-
this.openDriveServer = (
|
|
16
|
+
this.openDriveServer = (i = r.openDriveServer) == null ? void 0 : i.url, this.districtControllerLayer = new y({
|
|
17
17
|
id: "districtControllerLayer"
|
|
18
18
|
}), this.subDistrictControllerLayer = new y({
|
|
19
19
|
id: "subDistrictControllerLayer",
|
|
@@ -51,24 +51,24 @@ class N {
|
|
|
51
51
|
return this.scaleWatcher = g.watch(
|
|
52
52
|
() => this.view.scale,
|
|
53
53
|
(t, r) => {
|
|
54
|
-
t > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
t > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((i) => {
|
|
55
|
+
i.symbol = this.getCrossGraphicSymbol(
|
|
56
|
+
i.attributes,
|
|
57
57
|
"marker"
|
|
58
58
|
);
|
|
59
|
-
}), this.highlightLayer.graphics.forEach((
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
}), this.highlightLayer.graphics.forEach((i) => {
|
|
60
|
+
i.getAttribute("type") === "cross" && (i.symbol = this.getCrossGraphicSymbol(
|
|
61
|
+
i.attributes,
|
|
62
62
|
"marker"
|
|
63
63
|
));
|
|
64
|
-
})) : t <= this.crossScale && r > this.crossScale && (this.crossLayer.graphics.forEach((
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
})) : t <= this.crossScale && r > this.crossScale && (this.crossLayer.graphics.forEach((i) => {
|
|
65
|
+
i.symbol = this.getCrossGraphicSymbol(
|
|
66
|
+
i.attributes,
|
|
67
67
|
"picture"
|
|
68
68
|
);
|
|
69
|
-
}), this.highlightLayer.graphics.forEach((
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
}), this.highlightLayer.graphics.forEach((i) => {
|
|
70
|
+
i.getAttribute("type") === "cross" && (i.symbol = this.getCrossGraphicSymbol(
|
|
71
|
+
i.attributes,
|
|
72
72
|
"picture"
|
|
73
73
|
));
|
|
74
74
|
}));
|
|
@@ -90,27 +90,27 @@ class N {
|
|
|
90
90
|
if (!e.id || e.id === "")
|
|
91
91
|
return { status: 1, message: "请输入id" };
|
|
92
92
|
this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !1;
|
|
93
|
-
const t = this.districtControllerLayer.graphics.filter((
|
|
94
|
-
const a =
|
|
93
|
+
const t = this.districtControllerLayer.graphics.filter((s) => s.getAttribute("id") === e.id).toArray().map((s) => {
|
|
94
|
+
const a = s.clone();
|
|
95
95
|
return a.symbol.style = "none", a;
|
|
96
96
|
}), r = this.subDistrictControllerLayer.graphics.filter(
|
|
97
|
-
(
|
|
98
|
-
).toArray().map((
|
|
99
|
-
(
|
|
100
|
-
).toArray().map((
|
|
101
|
-
if (t.length > 0 && this.highlightLayer.addMany(t), r.length > 0 && this.highlightLayer.addMany(r),
|
|
97
|
+
(s) => s.getAttribute("id") === e.id || s.getAttribute("parentId") === e.id
|
|
98
|
+
).toArray().map((s) => s.clone()), i = this.crossLayer.graphics.filter(
|
|
99
|
+
(s) => s.getAttribute("id") === e.id || s.getAttribute("districtId") === e.id || s.getAttribute("subDistrictId") === e.id
|
|
100
|
+
).toArray().map((s) => s.clone());
|
|
101
|
+
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)
|
|
102
102
|
return { status: 1, message: "未找到" };
|
|
103
103
|
if (t.length > 0)
|
|
104
104
|
await this.view.goTo(t);
|
|
105
105
|
else if (r.length > 0) {
|
|
106
|
-
const
|
|
106
|
+
const s = r[0].geometry.centroid;
|
|
107
107
|
await this.view.goTo({
|
|
108
|
-
target:
|
|
108
|
+
target: s,
|
|
109
109
|
scale: this.crossScale - 500
|
|
110
110
|
});
|
|
111
111
|
} else
|
|
112
|
-
|
|
113
|
-
target:
|
|
112
|
+
i.length > 1 ? await this.view.goTo(i) : await this.view.goTo({
|
|
113
|
+
target: i[0].geometry,
|
|
114
114
|
scale: 1500
|
|
115
115
|
});
|
|
116
116
|
return { status: 0, message: "ok" };
|
|
@@ -120,16 +120,16 @@ class N {
|
|
|
120
120
|
}
|
|
121
121
|
showSubSignalControlArea(e) {
|
|
122
122
|
this.crossLayer.removeAll(), this.crossLayer.visible = !0;
|
|
123
|
-
const r = e.children.map((
|
|
124
|
-
const
|
|
125
|
-
return new
|
|
123
|
+
const r = e.children.map((i) => {
|
|
124
|
+
const s = { ...i, selected: !0 };
|
|
125
|
+
return new h({
|
|
126
126
|
geometry: {
|
|
127
127
|
type: "point",
|
|
128
|
-
x:
|
|
129
|
-
y:
|
|
128
|
+
x: i.longitude,
|
|
129
|
+
y: i.latitude
|
|
130
130
|
},
|
|
131
|
-
symbol: this.getCrossSymbolInSubDistrict(
|
|
132
|
-
attributes:
|
|
131
|
+
symbol: this.getCrossSymbolInSubDistrict(s),
|
|
132
|
+
attributes: s
|
|
133
133
|
});
|
|
134
134
|
});
|
|
135
135
|
return this.crossLayer.addMany(r), this.view.goTo(r), { status: 0, message: "ok" };
|
|
@@ -140,23 +140,23 @@ class N {
|
|
|
140
140
|
* @returns
|
|
141
141
|
*/
|
|
142
142
|
async handleViewClick(e) {
|
|
143
|
-
var
|
|
144
|
-
const r = (
|
|
143
|
+
var s;
|
|
144
|
+
const r = (s = (await this.view.hitTest(e, {
|
|
145
145
|
include: [this.crossLayer]
|
|
146
|
-
})).results) == null ? void 0 :
|
|
146
|
+
})).results) == null ? void 0 : s.filter(
|
|
147
147
|
(a) => a.type === "graphic"
|
|
148
148
|
);
|
|
149
149
|
if (r.length === 0)
|
|
150
150
|
return;
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
)) : (
|
|
155
|
-
id:
|
|
156
|
-
name:
|
|
157
|
-
}),
|
|
158
|
-
|
|
159
|
-
)), await this.showNearbyCrosses(
|
|
151
|
+
const i = r[0].graphic;
|
|
152
|
+
i.getAttribute("selected") ? i.getAttribute("signalId") && (this.removeCrossCallback && this.removeCrossCallback({ id: i.getAttribute("id") }), i.setAttribute("selected", !1), i.symbol = this.getCrossSymbolInSubDistrict(
|
|
153
|
+
i.attributes
|
|
154
|
+
)) : (i.getAttribute("signalId") && (this.addCrossCallback && this.addCrossCallback({
|
|
155
|
+
id: i.getAttribute("id"),
|
|
156
|
+
name: i.getAttribute("name")
|
|
157
|
+
}), i.setAttribute("selected", !0), i.symbol = this.getCrossSymbolInSubDistrict(
|
|
158
|
+
i.attributes
|
|
159
|
+
)), await this.showNearbyCrosses(i.getAttribute("id")));
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* 显示周边的路口
|
|
@@ -170,31 +170,30 @@ class N {
|
|
|
170
170
|
);
|
|
171
171
|
if (t.status === 200)
|
|
172
172
|
if (t.data.status === 0) {
|
|
173
|
-
const r = t.data.result,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
s.push(l);
|
|
173
|
+
const r = t.data.result, i = [];
|
|
174
|
+
for (const s of r) {
|
|
175
|
+
const { junctionId: a } = s;
|
|
176
|
+
if (s.signalId && !this.crossIdsInDistrict.includes(a) || this.crossLayer.graphics.some(
|
|
177
|
+
(n) => n.getAttribute("id") === a
|
|
178
|
+
))
|
|
179
|
+
continue;
|
|
180
|
+
const m = new h({
|
|
181
|
+
geometry: {
|
|
182
|
+
type: "point",
|
|
183
|
+
x: s.lon,
|
|
184
|
+
y: s.lat
|
|
185
|
+
},
|
|
186
|
+
symbol: this.getCrossSymbolInSubDistrict(s),
|
|
187
|
+
attributes: {
|
|
188
|
+
id: a,
|
|
189
|
+
name: s.name,
|
|
190
|
+
signalId: s.signalId,
|
|
191
|
+
selected: !1
|
|
195
192
|
}
|
|
196
|
-
}
|
|
197
|
-
|
|
193
|
+
});
|
|
194
|
+
i.push(m);
|
|
195
|
+
}
|
|
196
|
+
return this.crossLayer.addMany(i), { status: 0, message: "ok" };
|
|
198
197
|
} else
|
|
199
198
|
return { status: -1, message: t.data.message };
|
|
200
199
|
else
|
|
@@ -204,13 +203,13 @@ class N {
|
|
|
204
203
|
* 编辑子区的路口
|
|
205
204
|
* @returns
|
|
206
205
|
*/
|
|
207
|
-
async editSubSignalArea(e, t) {
|
|
206
|
+
async editSubSignalArea(e, t, r) {
|
|
208
207
|
if (this.openDriveServer) {
|
|
209
|
-
this.
|
|
208
|
+
this.crossIdsInDistrict = e, this.addCrossCallback = t, this.removeCrossCallback = r, this.clickWatcher || (this.clickWatcher = this.view.on("click", async (s) => {
|
|
210
209
|
await this.handleViewClick(s);
|
|
211
210
|
}));
|
|
212
|
-
const
|
|
213
|
-
return await this.showNearbyCrosses(
|
|
211
|
+
const i = this.crossLayer.graphics.toArray().map((s) => s.getAttribute("id")).join(",");
|
|
212
|
+
return await this.showNearbyCrosses(i);
|
|
214
213
|
} else
|
|
215
214
|
return { status: 1, message: "未配置OpenDriveServer" };
|
|
216
215
|
}
|
|
@@ -260,23 +259,23 @@ class N {
|
|
|
260
259
|
drawArea(e, t) {
|
|
261
260
|
const r = e.getAllCrossCoordinates();
|
|
262
261
|
if (r.length >= 2) {
|
|
263
|
-
let
|
|
262
|
+
let s = null;
|
|
264
263
|
if (r.length === 2)
|
|
265
|
-
|
|
264
|
+
s = l.lineString(r);
|
|
266
265
|
else {
|
|
267
266
|
if (t) {
|
|
268
|
-
const
|
|
269
|
-
r.map((u) =>
|
|
267
|
+
const c = l.featureCollection(
|
|
268
|
+
r.map((u) => l.point(u))
|
|
270
269
|
);
|
|
271
|
-
|
|
270
|
+
s = b(c);
|
|
272
271
|
} else {
|
|
273
|
-
const
|
|
274
|
-
|
|
272
|
+
const c = f(r, 0.5);
|
|
273
|
+
c.length >= 4 && (s = l.polygon([c]));
|
|
275
274
|
}
|
|
276
|
-
|
|
275
|
+
s || (s = l.lineString(r));
|
|
277
276
|
}
|
|
278
277
|
const a = p(
|
|
279
|
-
|
|
278
|
+
s.geometry,
|
|
280
279
|
// 区控面积更大,需要更大的缓冲半径
|
|
281
280
|
t ? 200 : 30,
|
|
282
281
|
{
|
|
@@ -307,7 +306,7 @@ class N {
|
|
|
307
306
|
label: "路口数量"
|
|
308
307
|
}
|
|
309
308
|
];
|
|
310
|
-
const
|
|
309
|
+
const m = {
|
|
311
310
|
type: "signalControlArea",
|
|
312
311
|
id: e.id,
|
|
313
312
|
name: e.name,
|
|
@@ -315,7 +314,7 @@ class N {
|
|
|
315
314
|
parentName: e.parentName,
|
|
316
315
|
crossCount: e.crossCount,
|
|
317
316
|
subDistrictCount: e.subDistrictCount
|
|
318
|
-
},
|
|
317
|
+
}, n = new h({
|
|
319
318
|
geometry: {
|
|
320
319
|
type: "polygon",
|
|
321
320
|
rings: a.geometry.coordinates
|
|
@@ -330,7 +329,7 @@ class N {
|
|
|
330
329
|
style: t ? "long-dash" : "solid"
|
|
331
330
|
}
|
|
332
331
|
},
|
|
333
|
-
attributes:
|
|
332
|
+
attributes: m,
|
|
334
333
|
popupTemplate: {
|
|
335
334
|
title: `${t ? "区控" : "子区"} ${e.name}`,
|
|
336
335
|
content: [
|
|
@@ -341,33 +340,33 @@ class N {
|
|
|
341
340
|
]
|
|
342
341
|
}
|
|
343
342
|
});
|
|
344
|
-
t ? this.districtControllerLayer.add(
|
|
343
|
+
t ? this.districtControllerLayer.add(n) : this.subDistrictControllerLayer.add(n);
|
|
345
344
|
}
|
|
346
|
-
for (const
|
|
347
|
-
this.drawArea(
|
|
348
|
-
const
|
|
349
|
-
e.crosses.forEach((
|
|
345
|
+
for (const s of e.subDistricts)
|
|
346
|
+
this.drawArea(s, !1);
|
|
347
|
+
const i = [];
|
|
348
|
+
e.crosses.forEach((s) => {
|
|
350
349
|
const a = {
|
|
351
350
|
type: "cross",
|
|
352
|
-
id:
|
|
353
|
-
name:
|
|
351
|
+
id: s.id,
|
|
352
|
+
name: s.name,
|
|
354
353
|
color: e.areaColor,
|
|
355
|
-
signalId:
|
|
354
|
+
signalId: s.signalId,
|
|
356
355
|
districtId: t ? e.id : e.parentId,
|
|
357
356
|
districtName: t ? e.name : e.parentName,
|
|
358
357
|
subDistrictId: t ? "" : e.id,
|
|
359
358
|
subDistrictName: t ? "" : e.name,
|
|
360
|
-
isKey:
|
|
361
|
-
}, o = new
|
|
359
|
+
isKey: s.isKey
|
|
360
|
+
}, o = new h({
|
|
362
361
|
geometry: {
|
|
363
362
|
type: "point",
|
|
364
|
-
x:
|
|
365
|
-
y:
|
|
363
|
+
x: s.longitude,
|
|
364
|
+
y: s.latitude
|
|
366
365
|
},
|
|
367
366
|
symbol: this.getCrossGraphicSymbol(a, "marker"),
|
|
368
367
|
attributes: a,
|
|
369
368
|
popupTemplate: {
|
|
370
|
-
title:
|
|
369
|
+
title: s.name,
|
|
371
370
|
content: [
|
|
372
371
|
{
|
|
373
372
|
type: "fields",
|
|
@@ -393,8 +392,8 @@ class N {
|
|
|
393
392
|
]
|
|
394
393
|
}
|
|
395
394
|
});
|
|
396
|
-
|
|
397
|
-
}), this.crossLayer.addMany(
|
|
395
|
+
i.push(o);
|
|
396
|
+
}), this.crossLayer.addMany(i);
|
|
398
397
|
}
|
|
399
398
|
/**
|
|
400
399
|
* 显示子区时路口的样式
|
|
@@ -500,7 +499,7 @@ class N {
|
|
|
500
499
|
* @returns
|
|
501
500
|
*/
|
|
502
501
|
getCrossGraphicSymbol(e, t) {
|
|
503
|
-
const { isKey: r, color:
|
|
502
|
+
const { isKey: r, color: i } = e;
|
|
504
503
|
if (t === "marker")
|
|
505
504
|
return r ? {
|
|
506
505
|
type: "picture-marker",
|
|
@@ -510,7 +509,7 @@ class N {
|
|
|
510
509
|
} : {
|
|
511
510
|
type: "simple-marker",
|
|
512
511
|
style: "circle",
|
|
513
|
-
color:
|
|
512
|
+
color: i,
|
|
514
513
|
size: 8,
|
|
515
514
|
outline: {
|
|
516
515
|
color: "white",
|
|
@@ -128,7 +128,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
128
128
|
}) => Promise<import("../types").IResult>;
|
|
129
129
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
130
130
|
showSubSignalControlArea: (params: any) => import("../types").IResult;
|
|
131
|
-
editSubSignalControlArea: (addCrossCallback: (params: {
|
|
131
|
+
editSubSignalControlArea: (crossIdsInDistrict: string[], addCrossCallback: (params: {
|
|
132
132
|
id: string;
|
|
133
133
|
name: string;
|
|
134
134
|
}) => void, removeCrossCallback: (params: {
|
|
@@ -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 c,m,l,o,r,s,g,t,a;const f=n.ref(!1);h.registerStore();const I=h.default.useAppDataStore,C=n.reactive([]);n.onMounted(async()=>{if(!p.value)return;document.addEventListener("keydown",d=>{d.ctrlKey&&d.key==="i"&&(f.value=!f.value)});const e=n.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,i=await(await fetch(k.config)).json();i.assetsRoot=k.assetsRoot||u,I.mapConfig=i,m=new Ne.default,c=await m.initialize({container:p.value,mapConfig:i,markerClickCallback:(d,v,w,qe)=>{y("markerClick",d,v,w,qe)},mapClickCallback:(d,v,w)=>{y("mapClick",d,v,w)}}),r=new Me.default(c,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(()=>c),q=()=>{const e=h.default.useAppDataStore;e.saveTrackLog=!0},M=()=>{r.downloadTrackLog()},V=()=>{S("vehicleId")},N=()=>{S("plateNumber")},B=async e=>await m.setMapCenter(e),H=async e=>await m.setMapCamera(e),P=async e=>await m.lookAt(e),E=e=>m.setLayerVisibility(e),z=(e,u)=>m.requestCoordinateTransform(e,u),j=e=>{m.cancelCoordinateTransform(e)},Q=e=>{m.setMapZoomRange(e)},Z=e=>(l||(l=new A.default(c)),l.showLaneNumber(e)),K=()=>{l==null||l.clearLaneNumber()},U=async e=>(l||(l=new A.default(c)),await l.initializeSearch(e)),G=async()=>l==null?void 0:l.calCrossIndicatorArea(),J=async()=>{},W=async(e,u)=>{o||(o=new He.default(c)),o.connectTrafficFlow(e,u)},X=()=>{o==null||o.disconnectTrafficFlow()},Y=async e=>{r.handleVehicleTraceData(e)},F=()=>{r.clearHoloTrace()},R=e=>{r.setInterpolate(e)},$=async e=>{await r.handleSignalData(e)},ee=()=>{r.clearHoloSignal()},te=e=>{o==null||o.toggleTrafficInfo(e),r==null||r.toggleTrafficInfo(e)},ae=e=>{r==null||r.togglePause(e)},ne=e=>{o==null||o.toggleTrafficObject(e),r==null||r.toggleTrafficObject(e)},S=e=>{r==null||r.updatePanelContent(e)},re=async e=>(s||(s=new b.default(c)),s.addOverlays(e)),se=e=>(s||(s=new b.default(c)),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(c)),g.updateQueueLength(e)},de=()=>{g==null||g.removeQueueLength()},ge=async(e,u)=>(t||(t=new O.default(c)),await t.showOpenDriveFromServer(e,u)),pe=async e=>(t||(t=new O.default(c)),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(c)),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(c)),a.showSubSignalControlArea(e)),_e=(e,u,i)=>a?a.editSubSignalArea(e,u,i):{status:-1,message:"未加载信号控制区"},Ie=e=>a?a.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},xe=e=>a?a.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},k=D,y=_;return T({mapViewer:x,setLayerVisibility:E,setMapCenter:B,lookAt:P,setMapCamera:H,setMapZoomRange:Q,requestCoordinateTransform:z,cancelCoordinateTransform:j,addOverlays:re,addMask:se,removeMask:oe,showAllOverlays:ue,removeOverlaysByType:ie,removeOverlaysById:ce,removeAllOverlays:le,showLaneNumber:Z,clearLaneNumber:K,initializeAreaTool:U,calCrossIndicatorArea:G,calRoadIndicatorArea:J,connectCarFlow:W,disconnectCarFlow:X,handleHoloVehicleTraceData:Y,clearHoloTrace:F,handleHoloSignalData:$,clearHoloSignal:ee,setInterpolate:R,toggleTrafficInfo:te,toggleTrafficObject:ne,toggleVehicleInfo:S,togglePause:ae,updateQueueLength:me,removeQueueLength:de,showOpenDriveFromServer:ge,showOpenDriveFromFile:pe,clearOpenDrive:fe,geometrySearchInOpenDrive:we,findSumoInOpenDrive:Se,selectSumoInOpenDrive:ye,unselectSumoInOpenDrive:ve,getSumoInfo:he,splitOpenDriveLane:Ce,clearSplitOpenDriveLane:ke,showSignalControlArea:Oe,clearSignalControlArea:be,locateSignalControlArea:Ae,highlightSignalControlArea:Le,resetHighlightSignalControlArea:De,showSubSignalControlArea:Te,editSubSignalControlArea:_e,selectSubSignalControlAreaCross:Ie,unselectSubSignalControlAreaCross:xe}),(e,u)=>(n.openBlock(),n.createElementBlock("div",Pe,[n.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:p},[n.withDirectives(n.createElementVNode("div",Ee,[n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:q}," 开始记录 "),n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:M}," 下载日志 "),n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:V}," 显示车辆id "),n.createElementVNode("button",{onClick:N},"显示车辆号牌")],512),[[n.vShow,f.value]])],512),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(C,(i,d)=>(n.openBlock(),n.createBlock(Ve.default,{key:d,"display-mode":i.displayMode,"road-id":i.crossId,"cross-id":i.roadId,"map-point":i.mapPoint,"stop-line":i.stopLine,position:i.position,rotation:i.rotation,scale:i.scale,"lamp-status":i.lampStatus},null,8,["display-mode","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=ze;
|
|
@@ -117,7 +117,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
117
117
|
}) => Promise<import("../types").IResult>;
|
|
118
118
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
119
119
|
showSubSignalControlArea: (params: any) => import("../types").IResult;
|
|
120
|
-
editSubSignalControlArea: (addCrossCallback: (params: {
|
|
120
|
+
editSubSignalControlArea: (crossIdsInDistrict: string[], addCrossCallback: (params: {
|
|
121
121
|
id: string;
|
|
122
122
|
name: string;
|
|
123
123
|
}) => void, removeCrossCallback: (params: {
|
|
@@ -34,6 +34,7 @@ export default class SignalControlAreaController {
|
|
|
34
34
|
* @returns
|
|
35
35
|
*/
|
|
36
36
|
private handleViewClick;
|
|
37
|
+
private crossIdsInDistrict;
|
|
37
38
|
/**
|
|
38
39
|
* 显示周边的路口
|
|
39
40
|
* @param crossIds
|
|
@@ -46,7 +47,7 @@ export default class SignalControlAreaController {
|
|
|
46
47
|
* 编辑子区的路口
|
|
47
48
|
* @returns
|
|
48
49
|
*/
|
|
49
|
-
editSubSignalArea(addCrossCallback: (params: {
|
|
50
|
+
editSubSignalArea(crossIdsInDistrict: string[], addCrossCallback: (params: {
|
|
50
51
|
id: string;
|
|
51
52
|
name: string;
|
|
52
53
|
}) => void, removeCrossCallback: (params: {
|
|
@@ -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"),A=require("../../stores/index.js"),I=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),c=m(C);class w{constructor(e){var s;this.crossScale=5e3,this.view=e;const r=A.default.useAppDataStore.mapConfig;this.openDriveServer=(s=r.openDriveServer)==null?void 0:s.url,this.districtControllerLayer=new y({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new y({id:"subDistrictControllerLayer",visible:!1}),this.crossLayer=new y({id:"crossLayer",visible:!1}),this.highlightLayer=new y({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(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 I.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(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):t<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var 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(i=>i.getAttribute("id")===e.id).toArray().map(i=>{const a=i.clone();return a.symbol.style="none",a}),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("parentId")===e.id).toArray().map(i=>i.clone()),s=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("districtId")===e.id||i.getAttribute("subDistrictId")===e.id).toArray().map(i=>i.clone());if(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)return{status:1,message:"未找到"};if(t.length>0)await this.view.goTo(t);else if(r.length>0){const i=r[0].geometry.centroid;await this.view.goTo({target:i,scale:this.crossScale-500})}else s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,{status:0,message:"ok"}}showSubSignalControlArea(e){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const r=e.children.map(s=>{const i={...s,selected:!0};return new u({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossSymbolInSubDistrict(i),attributes:i})});return this.crossLayer.addMany(r),this.view.goTo(r),{status:0,message:"ok"}}async handleViewClick(e){var i;const r=(i=(await this.view.hitTest(e,{include:[this.crossLayer]})).results)==null?void 0:i.filter(a=>a.type==="graphic");if(r.length===0)return;const s=r[0].graphic;s.getAttribute("selected")?s.getAttribute("signalId")&&(this.removeCrossCallback&&this.removeCrossCallback({id:s.getAttribute("id")}),s.setAttribute("selected",!1),s.symbol=this.getCrossSymbolInSubDistrict(s.attributes)):(s.getAttribute("signalId")&&(this.addCrossCallback&&this.addCrossCallback({id:s.getAttribute("id"),name:s.getAttribute("name")}),s.setAttribute("selected",!0),s.symbol=this.getCrossSymbolInSubDistrict(s.attributes)),await this.showNearbyCrosses(s.getAttribute("id")))}async showNearbyCrosses(e){const t=await v.get(`http://${this.openDriveServer}/api/computable/getRelatedJunctionsForJunction`,{params:{junctionIds:e}});if(t.status===200)if(t.data.status===0){const r=t.data.result,s=[];return r.forEach(i=>{const{junctionId:a}=i;if(!this.crossLayer.graphics.some(n=>n.getAttribute("id")===a)){const n=new u({geometry:{type:"point",x:i.lon,y:i.lat},symbol:this.getCrossSymbolInSubDistrict(i),attributes:{id:i.junctionId,name:i.name,signalId:i.signalId,selected:!1}});s.push(n)}}),this.crossLayer.addMany(s),{status:0,message:"ok"}}else return{status:-1,message:t.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalArea(e,t){if(this.openDriveServer){this.addCrossCallback=e,this.removeCrossCallback=t,this.clickWatcher||(this.clickWatcher=this.view.on("click",async s=>{await this.handleViewClick(s)}));const r=this.crossLayer.graphics.toArray().map(s=>s.getAttribute("id")).join(",");return await this.showNearbyCrosses(r)}else return{status:1,message:"未配置OpenDriveServer"}}selectSubSignalControlAreaCross(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 i=null;if(r.length===2)i=c.lineString(r);else{if(t){const h=c.featureCollection(r.map(p=>c.point(p)));i=f(h)}else{const h=S(r,.5);h.length>=4&&(i=c.polygon([h]))}i||(i=c.lineString(r))}const a=d(i.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const n={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},g=new 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:n,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(g):this.subDistrictControllerLayer.add(g)}for(const i of e.subDistricts)this.drawArea(i,!1);const s=[];e.crosses.forEach(i=>{const a={type:"cross",id:i.id,name:i.name,color:e.areaColor,signalId:i.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:i.isKey},l=new u({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossGraphicSymbol(a,"marker"),attributes:a,popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});s.push(l)}),this.crossLayer.addMany(s)}getCrossSymbolInSubDistrict(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:s}=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:s,size:8,outline:{color:"white",width:1}};if(t==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY: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"),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;
|