gisviewer-vue3-arcgis 1.0.123 → 1.0.125
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 +5 -0
- package/es/src/gis-map/gis-map.vue.mjs +103 -97
- package/es/src/gis-map/index.d.ts +4 -0
- package/es/src/gis-map/utils/map-initializer.mjs +2 -1
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +4 -4
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +20 -0
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +34 -0
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +15 -0
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +171 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +5 -0
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +4 -0
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +20 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +15 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -0
- package/package.json +2 -1
|
@@ -7,6 +7,7 @@ import OpenDriveRenderer from './utils/open-drive-renderer';
|
|
|
7
7
|
import Overlay from './utils/overlay';
|
|
8
8
|
import QueueLength from './utils/queue-length';
|
|
9
9
|
import RoadConfigTool from './utils/road-config-tool';
|
|
10
|
+
import SignalControlAreaController from './utils/signal-control-area-controller';
|
|
10
11
|
import TrafficFlow from './utils/traffic-flow';
|
|
11
12
|
declare const _sfc_main: import("vue").DefineComponent<{
|
|
12
13
|
config: {
|
|
@@ -27,6 +28,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
27
28
|
overlay: Overlay;
|
|
28
29
|
queueLength: QueueLength;
|
|
29
30
|
openDriveRenderer: OpenDriveRenderer;
|
|
31
|
+
signalControlAreaController: SignalControlAreaController;
|
|
30
32
|
showLogDiv: import("vue").Ref<boolean>;
|
|
31
33
|
mapViewer: import("vue").ComputedRef<MapView | SceneView>;
|
|
32
34
|
startSaveTrackLog: () => void;
|
|
@@ -72,6 +74,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
72
74
|
clearOpenDrive: () => Promise<void>;
|
|
73
75
|
findSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
|
|
74
76
|
splitOpenDriveLane: (params: ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
77
|
+
showSignalControlArea: (params: any) => import("../types").IResult;
|
|
78
|
+
clearSignalControlArea: () => void;
|
|
79
|
+
locateSignalControlArea: (params: any) => import("../types").IResult;
|
|
75
80
|
props: any;
|
|
76
81
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
77
82
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1,146 +1,152 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as de, ref as h, onMounted as ve, getCurrentInstance as ye, computed as Ce, openBlock as he, createElementBlock as Oe, createElementVNode as u, withDirectives as ke, vShow as Se } from "vue";
|
|
2
|
+
import O, { registerStore as Te } from "./stores/index.mjs";
|
|
3
3
|
import "./style/index.css";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
4
|
+
import Le from "./utils/holo-flow/index.mjs";
|
|
5
|
+
import Ae from "./utils/map-initializer.mjs";
|
|
6
|
+
import k from "./utils/open-drive-renderer/index.mjs";
|
|
7
|
+
import De from "./utils/overlay.mjs";
|
|
8
|
+
import be from "./utils/queue-length.mjs";
|
|
9
|
+
import S from "./utils/road-config-tool/index.mjs";
|
|
10
|
+
import Ie from "./utils/signal-control-area-controller/index.mjs";
|
|
11
|
+
import _e from "./utils/traffic-flow.mjs";
|
|
12
|
+
const xe = { class: "gis-viewer" }, Me = { style: { position: "absolute", bottom: "10px", left: "10px" } }, Ze = /* @__PURE__ */ de({
|
|
12
13
|
__name: "gis-map",
|
|
13
14
|
props: {
|
|
14
15
|
config: {},
|
|
15
16
|
assetsRoot: {}
|
|
16
17
|
},
|
|
17
18
|
emits: ["mapLoaded", "markerClick", "mapClick"],
|
|
18
|
-
setup(T, { expose: L, emit:
|
|
19
|
-
const
|
|
20
|
-
let s, i, o, n, r, a,
|
|
19
|
+
setup(T, { expose: L, emit: A }) {
|
|
20
|
+
const g = h(null);
|
|
21
|
+
let s, i, o, n, r, a, m, t, c;
|
|
21
22
|
const f = h(!1);
|
|
22
|
-
|
|
23
|
-
if (
|
|
23
|
+
ve(async () => {
|
|
24
|
+
if (Te(), !g.value)
|
|
24
25
|
return;
|
|
25
|
-
document.addEventListener("keydown", (
|
|
26
|
-
|
|
26
|
+
document.addEventListener("keydown", (p) => {
|
|
27
|
+
p.ctrlKey && p.key === "i" && (f.value = !f.value);
|
|
27
28
|
});
|
|
28
|
-
const e =
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
container:
|
|
33
|
-
markerClickCallback: (
|
|
34
|
-
|
|
29
|
+
const e = ye(), { $gisviewerAssetsRoot: l } = e.appContext.config.globalProperties, C = await (await fetch(y.config)).json();
|
|
30
|
+
C.assetsRoot = y.assetsRoot || l;
|
|
31
|
+
const fe = O.useAppDataStore;
|
|
32
|
+
fe.mapConfig = C, i = new Ae(), s = await i.initialize({
|
|
33
|
+
container: g.value,
|
|
34
|
+
markerClickCallback: (p, d, v, we) => {
|
|
35
|
+
w("markerClick", p, d, v, we);
|
|
35
36
|
},
|
|
36
|
-
mapClickCallback: (
|
|
37
|
-
|
|
37
|
+
mapClickCallback: (p, d, v) => {
|
|
38
|
+
w("mapClick", p, d, v);
|
|
38
39
|
}
|
|
39
|
-
}), r = new
|
|
40
|
+
}), r = new Le(s), await r.init(), w("mapLoaded");
|
|
40
41
|
});
|
|
41
|
-
const
|
|
42
|
-
const e =
|
|
42
|
+
const D = Ce(() => s), b = () => {
|
|
43
|
+
const e = O.useAppDataStore;
|
|
43
44
|
e.saveTrackLog = !0;
|
|
44
45
|
}, I = () => {
|
|
45
46
|
r.downloadTrackLog();
|
|
46
|
-
},
|
|
47
|
+
}, _ = async (e) => await i.setMapCenter(e), x = async (e) => await i.setMapCamera(e), M = async (e) => await i.lookAt(e), F = (e) => i.setLayerVisibility(e), V = (e, l) => i.requestCoordinateTransform(e, l), B = (e) => {
|
|
47
48
|
i.cancelCoordinateTransform(e);
|
|
48
|
-
},
|
|
49
|
+
}, H = (e) => {
|
|
49
50
|
i.setMapZoomRange(e);
|
|
50
|
-
},
|
|
51
|
+
}, z = (e) => (o || (o = new S(s)), o.showLaneNumber(e)), N = () => {
|
|
51
52
|
o == null || o.clearLaneNumber();
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
n || (n = new
|
|
55
|
-
},
|
|
53
|
+
}, Q = async (e) => (o || (o = new S(s)), await o.initializeSearch(e)), j = async () => o == null ? void 0 : o.calCrossIndicatorArea(), P = async () => {
|
|
54
|
+
}, R = async (e, l) => {
|
|
55
|
+
n || (n = new _e(s)), n.connectTrafficFlow(e, l);
|
|
56
|
+
}, E = () => {
|
|
56
57
|
n == null || n.disconnectTrafficFlow();
|
|
57
|
-
},
|
|
58
|
+
}, Z = (e) => {
|
|
58
59
|
r.handleVehicleTraceData(e);
|
|
59
|
-
},
|
|
60
|
+
}, q = () => {
|
|
60
61
|
r.clearHoloTrace();
|
|
61
|
-
},
|
|
62
|
+
}, K = (e) => {
|
|
62
63
|
r.setInterpolate(e);
|
|
63
|
-
},
|
|
64
|
+
}, $ = async (e) => {
|
|
64
65
|
await r.handleSignalData(e);
|
|
65
|
-
},
|
|
66
|
+
}, G = () => {
|
|
66
67
|
r.clearHoloSignal();
|
|
67
|
-
}, G = (e) => {
|
|
68
|
-
n == null || n.toggleTrafficInfo(e), r.toggleTrafficInfo(e);
|
|
69
68
|
}, J = (e) => {
|
|
70
|
-
r.
|
|
69
|
+
n == null || n.toggleTrafficInfo(e), r.toggleTrafficInfo(e);
|
|
71
70
|
}, U = (e) => {
|
|
72
|
-
|
|
71
|
+
r.togglePause(e);
|
|
73
72
|
}, W = (e) => {
|
|
73
|
+
n == null || n.toggleTrafficObject(e), r.toggleTrafficObject(e);
|
|
74
|
+
}, X = (e) => {
|
|
74
75
|
r.updatePanelContent(e);
|
|
75
|
-
},
|
|
76
|
+
}, Y = async (e) => (a || (a = new De(s)), a.addOverlays(e)), ee = (e) => a == null ? void 0 : a.removeOverlaysByType(e), te = (e) => a == null ? void 0 : a.removeOverlaysById(e), ae = () => a == null ? void 0 : a.removeAllOverlays(), oe = () => {
|
|
76
77
|
a == null || a.showAllOverlays();
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
},
|
|
78
|
+
}, ne = (e) => {
|
|
79
|
+
m || (m = new be(s)), m.updateQueueLength(e);
|
|
80
|
+
}, re = () => {
|
|
81
|
+
m == null || m.removeQueueLength();
|
|
82
|
+
}, se = async (e, l) => (t || (t = new k(s)), await t.showOpenDriveFromServer(e, l)), ie = async (e) => (t || (t = new k(s)), 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)) : {
|
|
82
83
|
status: -1,
|
|
83
84
|
message: "未加载OpenDrive地图"
|
|
84
|
-
},
|
|
85
|
+
}, me = async (e) => t ? await (t == null ? void 0 : t.splitLane(e)) : {
|
|
85
86
|
status: -1,
|
|
86
87
|
message: "未加载OpenDrive地图"
|
|
87
|
-
},
|
|
88
|
+
}, pe = (e) => (c || (c = new Ie(s)), c.showSignalControlArea(e)), ue = () => {
|
|
89
|
+
c == null || c.clearSignalControlArea();
|
|
90
|
+
}, ge = (e) => c ? c.locateSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, y = T, w = A;
|
|
88
91
|
return L({
|
|
89
|
-
mapViewer:
|
|
90
|
-
setLayerVisibility:
|
|
91
|
-
setMapCenter:
|
|
92
|
-
lookAt:
|
|
93
|
-
setMapCamera:
|
|
94
|
-
setMapZoomRange:
|
|
95
|
-
requestCoordinateTransform:
|
|
96
|
-
cancelCoordinateTransform:
|
|
97
|
-
addOverlays:
|
|
98
|
-
showAllOverlays:
|
|
99
|
-
removeOverlaysByType:
|
|
100
|
-
removeOverlaysById:
|
|
101
|
-
removeAllOverlays:
|
|
102
|
-
showLaneNumber:
|
|
103
|
-
clearLaneNumber:
|
|
104
|
-
initializeAreaTool:
|
|
105
|
-
calCrossIndicatorArea:
|
|
106
|
-
calRoadIndicatorArea:
|
|
107
|
-
connectCarFlow:
|
|
108
|
-
disconnectCarFlow:
|
|
109
|
-
handleHoloVehicleTraceData:
|
|
110
|
-
clearHoloTrace:
|
|
111
|
-
handleHoloSignalData:
|
|
112
|
-
clearHoloSignal:
|
|
113
|
-
setInterpolate:
|
|
114
|
-
toggleTrafficInfo:
|
|
115
|
-
toggleTrafficObject:
|
|
116
|
-
toggleVehicleInfo:
|
|
117
|
-
togglePause:
|
|
118
|
-
updateQueueLength:
|
|
119
|
-
removeQueueLength:
|
|
120
|
-
showOpenDriveFromServer:
|
|
121
|
-
showOpenDriveFromFile:
|
|
122
|
-
clearOpenDrive:
|
|
123
|
-
findSumoInOpenDrive:
|
|
124
|
-
splitOpenDriveLane:
|
|
125
|
-
|
|
126
|
-
|
|
92
|
+
mapViewer: D,
|
|
93
|
+
setLayerVisibility: F,
|
|
94
|
+
setMapCenter: _,
|
|
95
|
+
lookAt: M,
|
|
96
|
+
setMapCamera: x,
|
|
97
|
+
setMapZoomRange: H,
|
|
98
|
+
requestCoordinateTransform: V,
|
|
99
|
+
cancelCoordinateTransform: B,
|
|
100
|
+
addOverlays: Y,
|
|
101
|
+
showAllOverlays: oe,
|
|
102
|
+
removeOverlaysByType: ee,
|
|
103
|
+
removeOverlaysById: te,
|
|
104
|
+
removeAllOverlays: ae,
|
|
105
|
+
showLaneNumber: z,
|
|
106
|
+
clearLaneNumber: N,
|
|
107
|
+
initializeAreaTool: Q,
|
|
108
|
+
calCrossIndicatorArea: j,
|
|
109
|
+
calRoadIndicatorArea: P,
|
|
110
|
+
connectCarFlow: R,
|
|
111
|
+
disconnectCarFlow: E,
|
|
112
|
+
handleHoloVehicleTraceData: Z,
|
|
113
|
+
clearHoloTrace: q,
|
|
114
|
+
handleHoloSignalData: $,
|
|
115
|
+
clearHoloSignal: G,
|
|
116
|
+
setInterpolate: K,
|
|
117
|
+
toggleTrafficInfo: J,
|
|
118
|
+
toggleTrafficObject: W,
|
|
119
|
+
toggleVehicleInfo: X,
|
|
120
|
+
togglePause: U,
|
|
121
|
+
updateQueueLength: ne,
|
|
122
|
+
removeQueueLength: re,
|
|
123
|
+
showOpenDriveFromServer: se,
|
|
124
|
+
showOpenDriveFromFile: ie,
|
|
125
|
+
clearOpenDrive: ce,
|
|
126
|
+
findSumoInOpenDrive: le,
|
|
127
|
+
splitOpenDriveLane: me,
|
|
128
|
+
showSignalControlArea: pe,
|
|
129
|
+
clearSignalControlArea: ue,
|
|
130
|
+
locateSignalControlArea: ge
|
|
131
|
+
}), (e, l) => (he(), Oe("div", xe, [
|
|
132
|
+
u("div", {
|
|
127
133
|
class: "gis-viewer-main",
|
|
128
134
|
ref_key: "mapContainer",
|
|
129
|
-
ref:
|
|
135
|
+
ref: g
|
|
130
136
|
}, [
|
|
131
|
-
|
|
132
|
-
|
|
137
|
+
ke(u("div", Me, [
|
|
138
|
+
u("button", {
|
|
133
139
|
style: { "margin-right": "10px" },
|
|
134
140
|
onClick: b
|
|
135
141
|
}, " 开始记录 "),
|
|
136
|
-
|
|
142
|
+
u("button", { onClick: I }, "下载日志")
|
|
137
143
|
], 512), [
|
|
138
|
-
[
|
|
144
|
+
[Se, f.value]
|
|
139
145
|
])
|
|
140
146
|
], 512)
|
|
141
147
|
]));
|
|
142
148
|
}
|
|
143
149
|
});
|
|
144
150
|
export {
|
|
145
|
-
|
|
151
|
+
Ze as default
|
|
146
152
|
};
|
|
@@ -17,6 +17,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
17
17
|
overlay: import("./utils/overlay").default;
|
|
18
18
|
queueLength: import("./utils/queue-length").default;
|
|
19
19
|
openDriveRenderer: import("./utils/open-drive-renderer").default;
|
|
20
|
+
signalControlAreaController: import("./utils/signal-control-area-controller").default;
|
|
20
21
|
showLogDiv: import("vue").Ref<boolean>;
|
|
21
22
|
mapViewer: import("vue").ComputedRef<__esri.MapView | __esri.SceneView>;
|
|
22
23
|
startSaveTrackLog: () => void;
|
|
@@ -62,6 +63,9 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
62
63
|
clearOpenDrive: () => Promise<void>;
|
|
63
64
|
findSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
|
|
64
65
|
splitOpenDriveLane: (params: import("../types").ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
66
|
+
showSignalControlArea: (params: any) => import("../types").IResult;
|
|
67
|
+
clearSignalControlArea: () => void;
|
|
68
|
+
locateSignalControlArea: (params: any) => import("../types").IResult;
|
|
65
69
|
props: any;
|
|
66
70
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
67
71
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -473,7 +473,7 @@ class S {
|
|
|
473
473
|
(r) => r.type === "graphic"
|
|
474
474
|
);
|
|
475
475
|
if (s.length === 0) {
|
|
476
|
-
this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = "", this.view.
|
|
476
|
+
this.currentSectionCode !== "" && (this.currentSectionCode = "", this.highlightGraphic = void 0, this.highlightLayer.removeAll()), this.currentJunctionId !== "" && (this.currentJunctionId = "", this.view.closePopup());
|
|
477
477
|
return;
|
|
478
478
|
}
|
|
479
479
|
const e = s[0];
|
|
@@ -493,11 +493,11 @@ class S {
|
|
|
493
493
|
geometry: l,
|
|
494
494
|
symbol: {
|
|
495
495
|
type: "simple-fill",
|
|
496
|
-
color: [
|
|
496
|
+
color: [0, 255, 255, 0.5],
|
|
497
497
|
style: "solid",
|
|
498
498
|
outline: {
|
|
499
|
-
color:
|
|
500
|
-
width:
|
|
499
|
+
color: [0, 255, 255],
|
|
500
|
+
width: 1
|
|
501
501
|
}
|
|
502
502
|
},
|
|
503
503
|
attributes: {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface ICross {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
parentId: string;
|
|
5
|
+
latitude: number;
|
|
6
|
+
longitude: number;
|
|
7
|
+
}
|
|
8
|
+
export default class DistrictController {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
parentId: string;
|
|
12
|
+
crosses: ICross[];
|
|
13
|
+
subDistricts: DistrictController[];
|
|
14
|
+
areaColor: number[];
|
|
15
|
+
crossCount: number;
|
|
16
|
+
subDistrictCount: number;
|
|
17
|
+
constructor(params: any);
|
|
18
|
+
getAllCrossCoordinates(): number[][];
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
class i {
|
|
2
|
+
constructor(t) {
|
|
3
|
+
this.crosses = [], this.subDistricts = [], this.areaColor = [
|
|
4
|
+
Math.floor(Math.random() * 255),
|
|
5
|
+
Math.floor(Math.random() * 255),
|
|
6
|
+
Math.floor(Math.random() * 255)
|
|
7
|
+
], this.crossCount = 0, this.subDistrictCount = 0, this.id = t.id, this.name = t.name, this.parentId = t.parentId;
|
|
8
|
+
for (const s of t.children)
|
|
9
|
+
if (s.children) {
|
|
10
|
+
const o = new i(s);
|
|
11
|
+
o.areaColor = this.areaColor, this.subDistricts.push(o), this.subDistrictCount++, this.crossCount += o.crossCount;
|
|
12
|
+
} else {
|
|
13
|
+
const o = {
|
|
14
|
+
id: s.id,
|
|
15
|
+
name: s.name,
|
|
16
|
+
parentId: s.parentId,
|
|
17
|
+
latitude: s.latitude,
|
|
18
|
+
longitude: s.longitude
|
|
19
|
+
};
|
|
20
|
+
this.crosses.push(o), this.crossCount++;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
getAllCrossCoordinates() {
|
|
24
|
+
const t = [];
|
|
25
|
+
for (const s of this.crosses)
|
|
26
|
+
t.push([s.longitude, s.latitude]);
|
|
27
|
+
for (const s of this.subDistricts)
|
|
28
|
+
t.push(...s.getAllCrossCoordinates());
|
|
29
|
+
return t;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
i as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IResult } from '../../../types';
|
|
2
|
+
export default class SignalControlAreaController {
|
|
3
|
+
private view;
|
|
4
|
+
private districtControllerLayer;
|
|
5
|
+
private subDistrictControllerLayer;
|
|
6
|
+
private crossLayer;
|
|
7
|
+
private eventHandle?;
|
|
8
|
+
constructor(view: __esri.MapView | __esri.SceneView);
|
|
9
|
+
showSignalControlArea(params: any): IResult;
|
|
10
|
+
clearSignalControlArea(): IResult;
|
|
11
|
+
locateSignalControlArea(params: {
|
|
12
|
+
id: string;
|
|
13
|
+
}): IResult;
|
|
14
|
+
private drawArea;
|
|
15
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import n from "@arcgis/core/Graphic";
|
|
2
|
+
import s from "@arcgis/core/layers/GraphicsLayer";
|
|
3
|
+
import u from "@turf/convex";
|
|
4
|
+
import * as c from "@turf/helpers";
|
|
5
|
+
import p from "./district-controller.mjs";
|
|
6
|
+
class C {
|
|
7
|
+
constructor(e) {
|
|
8
|
+
this.view = e, this.view.popup.visibleElements = {
|
|
9
|
+
closeButton: !1,
|
|
10
|
+
collapseButton: !1,
|
|
11
|
+
actionBar: !1
|
|
12
|
+
}, this.districtControllerLayer = new s({
|
|
13
|
+
id: "districtControllerLayer",
|
|
14
|
+
maxScale: 144447,
|
|
15
|
+
minScale: 1155582
|
|
16
|
+
}), this.subDistrictControllerLayer = new s({
|
|
17
|
+
id: "subDistrictControllerLayer",
|
|
18
|
+
maxScale: 0,
|
|
19
|
+
minScale: 144447
|
|
20
|
+
}), this.crossLayer = new s({
|
|
21
|
+
id: "crossLayer",
|
|
22
|
+
maxScale: 0,
|
|
23
|
+
minScale: 18056
|
|
24
|
+
}), this.view.map.addMany([
|
|
25
|
+
this.crossLayer,
|
|
26
|
+
this.districtControllerLayer,
|
|
27
|
+
this.subDistrictControllerLayer
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
showSignalControlArea(e) {
|
|
31
|
+
for (const t of e) {
|
|
32
|
+
const i = new p(t);
|
|
33
|
+
this.drawArea(i, !0);
|
|
34
|
+
}
|
|
35
|
+
return { status: 0, message: "ok" };
|
|
36
|
+
}
|
|
37
|
+
clearSignalControlArea() {
|
|
38
|
+
var e;
|
|
39
|
+
return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), (e = this.eventHandle) == null || e.remove(), this.view.closePopup(), { status: 0, message: "ok" };
|
|
40
|
+
}
|
|
41
|
+
locateSignalControlArea(e) {
|
|
42
|
+
let t = this.districtControllerLayer.graphics.find(
|
|
43
|
+
(i) => i.attributes.id === e.id
|
|
44
|
+
);
|
|
45
|
+
if (t || (t = this.subDistrictControllerLayer.graphics.find(
|
|
46
|
+
(i) => i.attributes.id === e.id
|
|
47
|
+
)), t || (t = this.crossLayer.graphics.find(
|
|
48
|
+
(i) => i.attributes.id === e.id
|
|
49
|
+
)), t) {
|
|
50
|
+
this.view.goTo(t.geometry);
|
|
51
|
+
const i = t.geometry.type === "point" ? t.geometry : t.geometry.centroid;
|
|
52
|
+
return this.view.popup.open({
|
|
53
|
+
features: [t],
|
|
54
|
+
location: i
|
|
55
|
+
}), { status: 0, message: "ok" };
|
|
56
|
+
}
|
|
57
|
+
return { status: 1, message: "未找到" };
|
|
58
|
+
}
|
|
59
|
+
drawArea(e, t) {
|
|
60
|
+
const i = e.getAllCrossCoordinates();
|
|
61
|
+
if (i.length > 2) {
|
|
62
|
+
const r = c.featureCollection(
|
|
63
|
+
i.map((m) => c.point(m))
|
|
64
|
+
), a = u(r);
|
|
65
|
+
if (!a)
|
|
66
|
+
return;
|
|
67
|
+
let o;
|
|
68
|
+
t ? o = [
|
|
69
|
+
{
|
|
70
|
+
fieldName: "id",
|
|
71
|
+
label: "区控编号"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
fieldName: "crossCount",
|
|
75
|
+
label: "路口数量"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
fieldName: "subDistrictCount",
|
|
79
|
+
label: "子区数量"
|
|
80
|
+
}
|
|
81
|
+
] : o = [
|
|
82
|
+
{
|
|
83
|
+
fieldName: "id",
|
|
84
|
+
label: "子区编号"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
fieldName: "crossCount",
|
|
88
|
+
label: "路口数量"
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
const l = new n({
|
|
92
|
+
geometry: {
|
|
93
|
+
type: "polygon",
|
|
94
|
+
rings: a.geometry.coordinates
|
|
95
|
+
},
|
|
96
|
+
symbol: {
|
|
97
|
+
type: "simple-fill",
|
|
98
|
+
color: [...e.areaColor, 0.5],
|
|
99
|
+
outline: {
|
|
100
|
+
color: e.areaColor,
|
|
101
|
+
width: 1
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
attributes: {
|
|
105
|
+
type: "signalControlArea",
|
|
106
|
+
id: e.id,
|
|
107
|
+
name: e.name,
|
|
108
|
+
crossCount: e.crossCount,
|
|
109
|
+
subDistrictCount: e.subDistrictCount
|
|
110
|
+
},
|
|
111
|
+
popupTemplate: {
|
|
112
|
+
title: e.name,
|
|
113
|
+
content: [
|
|
114
|
+
{
|
|
115
|
+
type: "fields",
|
|
116
|
+
fieldInfos: o
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
t ? this.districtControllerLayer.add(l) : this.subDistrictControllerLayer.add(l);
|
|
122
|
+
}
|
|
123
|
+
for (const r of e.subDistricts)
|
|
124
|
+
this.drawArea(r, !1);
|
|
125
|
+
const d = e.crosses.map((r) => new n({
|
|
126
|
+
geometry: {
|
|
127
|
+
type: "point",
|
|
128
|
+
x: r.longitude,
|
|
129
|
+
y: r.latitude
|
|
130
|
+
},
|
|
131
|
+
symbol: {
|
|
132
|
+
type: "simple-marker",
|
|
133
|
+
color: e.areaColor,
|
|
134
|
+
size: 8
|
|
135
|
+
},
|
|
136
|
+
attributes: {
|
|
137
|
+
type: "cross",
|
|
138
|
+
id: r.id,
|
|
139
|
+
name: r.name,
|
|
140
|
+
districtId: t ? e.id : e.parentId,
|
|
141
|
+
subDistrictId: t ? "" : e.id
|
|
142
|
+
},
|
|
143
|
+
popupTemplate: {
|
|
144
|
+
title: r.name,
|
|
145
|
+
content: [
|
|
146
|
+
{
|
|
147
|
+
type: "fields",
|
|
148
|
+
fieldInfos: [
|
|
149
|
+
{
|
|
150
|
+
fieldName: "id",
|
|
151
|
+
label: "路口编号"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
fieldName: "districtId",
|
|
155
|
+
label: "区控编号"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
fieldName: "subDistrictId",
|
|
159
|
+
label: "子区编号"
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
}));
|
|
166
|
+
this.crossLayer.addMany(d);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
C as default
|
|
171
|
+
};
|
|
@@ -7,6 +7,7 @@ import OpenDriveRenderer from './utils/open-drive-renderer';
|
|
|
7
7
|
import Overlay from './utils/overlay';
|
|
8
8
|
import QueueLength from './utils/queue-length';
|
|
9
9
|
import RoadConfigTool from './utils/road-config-tool';
|
|
10
|
+
import SignalControlAreaController from './utils/signal-control-area-controller';
|
|
10
11
|
import TrafficFlow from './utils/traffic-flow';
|
|
11
12
|
declare const _sfc_main: import("vue").DefineComponent<{
|
|
12
13
|
config: {
|
|
@@ -27,6 +28,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
27
28
|
overlay: Overlay;
|
|
28
29
|
queueLength: QueueLength;
|
|
29
30
|
openDriveRenderer: OpenDriveRenderer;
|
|
31
|
+
signalControlAreaController: SignalControlAreaController;
|
|
30
32
|
showLogDiv: import("vue").Ref<boolean>;
|
|
31
33
|
mapViewer: import("vue").ComputedRef<MapView | SceneView>;
|
|
32
34
|
startSaveTrackLog: () => void;
|
|
@@ -72,6 +74,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
72
74
|
clearOpenDrive: () => Promise<void>;
|
|
73
75
|
findSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
|
|
74
76
|
splitOpenDriveLane: (params: ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
77
|
+
showSignalControlArea: (params: any) => import("../types").IResult;
|
|
78
|
+
clearSignalControlArea: () => void;
|
|
79
|
+
locateSignalControlArea: (params: any) => import("../types").IResult;
|
|
75
80
|
props: any;
|
|
76
81
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
77
82
|
}, 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 n=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),y=require("./stores/index.js");require("./style/index.css");const ge=require("./utils/holo-flow/index.js"),we=require("./utils/map-initializer.js"),O=require("./utils/open-drive-renderer/index.js"),ve=require("./utils/overlay.js"),ye=require("./utils/queue-length.js"),k=require("./utils/road-config-tool/index.js"),he=require("./utils/signal-control-area-controller/index.js"),Ce=require("./utils/traffic-flow.js"),Oe={class:"gis-viewer"},ke={style:{position:"absolute",bottom:"10px",left:"10px"}},Se=n.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(S,{expose:T,emit:L}){const p=n.ref(null);let c,i,o,r,s,a,d,t,l;const f=n.ref(!1);n.onMounted(async()=>{if(y.registerStore(),!p.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(f.value=!f.value)});const e=n.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,C=await(await fetch(h.config)).json();C.assetsRoot=h.assetsRoot||u;const pe=y.default.useAppDataStore;pe.mapConfig=C,i=new we.default,c=await i.initialize({container:p.value,markerClickCallback:(m,w,v,fe)=>{g("markerClick",m,w,v,fe)},mapClickCallback:(m,w,v)=>{g("mapClick",m,w,v)}}),s=new ge.default(c),await s.init(),g("mapLoaded")});const b=n.computed(()=>c),A=()=>{const e=y.default.useAppDataStore;e.saveTrackLog=!0},D=()=>{s.downloadTrackLog()},I=async e=>await i.setMapCenter(e),q=async e=>await i.setMapCamera(e),_=async e=>await i.lookAt(e),x=e=>i.setLayerVisibility(e),V=(e,u)=>i.requestCoordinateTransform(e,u),M=e=>{i.cancelCoordinateTransform(e)},N=e=>{i.setMapZoomRange(e)},F=e=>(o||(o=new k.default(c)),o.showLaneNumber(e)),B=()=>{o==null||o.clearLaneNumber()},E=async e=>(o||(o=new k.default(c)),await o.initializeSearch(e)),H=async()=>o==null?void 0:o.calCrossIndicatorArea(),j=async()=>{},z=async(e,u)=>{r||(r=new Ce.default(c)),r.connectTrafficFlow(e,u)},P=()=>{r==null||r.disconnectTrafficFlow()},Q=e=>{s.handleVehicleTraceData(e)},R=()=>{s.clearHoloTrace()},Z=e=>{s.setInterpolate(e)},K=async e=>{await s.handleSignalData(e)},G=()=>{s.clearHoloSignal()},J=e=>{r==null||r.toggleTrafficInfo(e),s.toggleTrafficInfo(e)},U=e=>{s.togglePause(e)},W=e=>{r==null||r.toggleTrafficObject(e),s.toggleTrafficObject(e)},X=e=>{s.updatePanelContent(e)},Y=async e=>(a||(a=new ve.default(c)),a.addOverlays(e)),$=e=>a==null?void 0:a.removeOverlaysByType(e),ee=e=>a==null?void 0:a.removeOverlaysById(e),te=()=>a==null?void 0:a.removeAllOverlays(),ae=()=>{a==null||a.showAllOverlays()},ne=e=>{d||(d=new ye.default(c)),d.updateQueueLength(e)},oe=()=>{d==null||d.removeQueueLength()},re=async(e,u)=>(t||(t=new O.default(c)),await t.showOpenDriveFromServer(e,u)),se=async e=>(t||(t=new O.default(c)),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?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},ue=e=>(l||(l=new he.default(c)),l.showSignalControlArea(e)),de=()=>{l==null||l.clearSignalControlArea()},me=e=>l?l.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},h=S,g=L;return T({mapViewer:b,setLayerVisibility:x,setMapCenter:I,lookAt:_,setMapCamera:q,setMapZoomRange:N,requestCoordinateTransform:V,cancelCoordinateTransform:M,addOverlays:Y,showAllOverlays:ae,removeOverlaysByType:$,removeOverlaysById:ee,removeAllOverlays:te,showLaneNumber:F,clearLaneNumber:B,initializeAreaTool:E,calCrossIndicatorArea:H,calRoadIndicatorArea:j,connectCarFlow:z,disconnectCarFlow:P,handleHoloVehicleTraceData:Q,clearHoloTrace:R,handleHoloSignalData:K,clearHoloSignal:G,setInterpolate:Z,toggleTrafficInfo:J,toggleTrafficObject:W,toggleVehicleInfo:X,togglePause:U,updateQueueLength:ne,removeQueueLength:oe,showOpenDriveFromServer:re,showOpenDriveFromFile:se,clearOpenDrive:ce,findSumoInOpenDrive:ie,splitOpenDriveLane:le,showSignalControlArea:ue,clearSignalControlArea:de,locateSignalControlArea:me}),(e,u)=>(n.openBlock(),n.createElementBlock("div",Oe,[n.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:p},[n.withDirectives(n.createElementVNode("div",ke,[n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:A}," 开始记录 "),n.createElementVNode("button",{onClick:D},"下载日志")],512),[[n.vShow,f.value]])],512)]))}});exports.default=Se;
|
|
@@ -17,6 +17,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
17
17
|
overlay: import("./utils/overlay").default;
|
|
18
18
|
queueLength: import("./utils/queue-length").default;
|
|
19
19
|
openDriveRenderer: import("./utils/open-drive-renderer").default;
|
|
20
|
+
signalControlAreaController: import("./utils/signal-control-area-controller").default;
|
|
20
21
|
showLogDiv: import("vue").Ref<boolean>;
|
|
21
22
|
mapViewer: import("vue").ComputedRef<__esri.MapView | __esri.SceneView>;
|
|
22
23
|
startSaveTrackLog: () => void;
|
|
@@ -62,6 +63,9 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
62
63
|
clearOpenDrive: () => Promise<void>;
|
|
63
64
|
findSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
|
|
64
65
|
splitOpenDriveLane: (params: import("../types").ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
66
|
+
showSignalControlArea: (params: any) => import("../types").IResult;
|
|
67
|
+
clearSignalControlArea: () => void;
|
|
68
|
+
locateSignalControlArea: (params: any) => import("../types").IResult;
|
|
65
69
|
props: any;
|
|
66
70
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
67
71
|
}, 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 P=require("@arcgis/core/Basemap"),y=require("@arcgis/core/config"),q=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),z=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/TileLayer"),S=require("@arcgis/core/layers/WebTileLayer"),L=require("@arcgis/core/Map"),x=require("@arcgis/core/views/MapView"),R=require("@arcgis/core/views/SceneView"),H=require("@turf/destination"),I=require("@turf/helpers"),_=require("../stores/index.js"),C=require("./custom-layer/custom-wmts-layer.js");function b(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const t=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,t.get?t:{enumerable:!0,get:()=>r[i]})}}return e.default=r,Object.freeze(e)}const T=b(q),p=b(z),G=b(I);function k(r,e){return r&&(r.startsWith("http://")||r.startsWith("https://")?r:e+r)}class N{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){const i=_.default.useAppDataStore,t=JSON.parse(JSON.stringify(i.mapConfig));this.mapConfig=t;const{container:o,markerClickCallback:n,mapClickCallback:f}=e;y.assetsPath=`${t.assetsRoot}/ArcgisAssets`,y.fontsUrl=`${t.assetsRoot}/fonts`,y.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const c=new L;if((t==null?void 0:t.mapOptions.mode.toLowerCase())==="2d"?this.view=new x({map:c,container:o,...t.mapOptions}):this.view=new R({map:c,container:o,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...t==null?void 0:t.mapOptions}),this.view.on("click",async s=>{var v,M;if(f){let a=s.mapPoint;a.spatialReference.isWebMercator&&(a=p.webMercatorToGeographic(a)),f([a.x,a.y],[s.screenPoint.x,s.screenPoint.y],s)}if(this.view.type==="3d"){const a=this.view.camera;if(this.view.spatialReference.isWebMercator){const u=p.webMercatorToGeographic(a.position),d={heading:a.heading,tilt:a.tilt,position:u.toJSON()};console.log(d),(v=navigator.clipboard)==null||v.writeText(JSON.stringify(d))}else console.log(a.toJSON());console.log(this.view.zoom,this.view.scale)}else{let a=this.view.center;this.view.spatialReference.isWebMercator&&(a=p.webMercatorToGeographic(a)),console.log({center:a.toJSON(),zoom:this.view.zoom})}const l=(M=(await this.view.hitTest(s)).results)==null?void 0:M.filter(a=>a.type==="graphic");l.length>0&&l.forEach(a=>{var d;const u=a.graphic;(d=u.attributes)!=null&&d.type&&n&&n(u.attributes.type,u.attributes.id,u.attributes,s)})}),t!=null&&t.baseLayers?t.baseLayers.forEach(s=>{const h=k(s.url,t.assetsRoot);switch(s.type.toLowerCase()){case"webTile".toLowerCase():{const l=new S({urlTemplate:h,...s.options});c.add(l);break}case"tile":{const l=new O({url:h,...s.options});c.add(l);break}case"customWMTS".toLowerCase():{const l=new C.default({urlTemplate:h,...s.options});c.add(l);break}case"arcgis":{const l=new P(s.options);c.basemap=l;break}}}):c.basemap=new P({style:{id:"arcgis/dark-gray",language:"zh-CN"}}),t!=null&&t.hdLayers){const s=t.hdLayers.map(h=>new W({url:k(h.url,t.assetsRoot),...h.options,title:h.options.id}));c.addMany(s)}this.view.ui.remove("attribution"),this.view.ui.add("compass","top-left"),await this.view.when();const w=this.mapConfig.camera;let m;if(this.view.type==="2d"){let s=this.view.center;this.view.spatialReference.isWebMercator&&(s=p.webMercatorToGeographic(s)),m={center:[s.x,s.y],zoom:this.view.zoom}}else{let s=this.view.camera.position;this.view.spatialReference.isWebMercator&&(s=p.webMercatorToGeographic(s)),m={position:s,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return w?w.home=m:this.mapConfig.camera={home:m},this.view}setLayerVisibility(e){const{id:i,visible:t}=e,o=this.view.map.findLayerById(i);return o?(o.visible=t,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type){case"point":e.target=new g.Point(e.target);break;case"polyline":e.target=new g.Polyline(e.target);break;case"polygon":e.target=new g.Polygon(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,t=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:t,tilt:0},{duration:(e.duration||2)*1e3});else{const o=Math.tan(i*Math.PI/180)*e.height,n=H(G.point(e.center),o,t+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:e.height},heading:t,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:t=0}=e,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const n=o[i];return n?(await this.view.goTo(n,{duration:t*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let t=0;const n=1e3/30,f=T.watch(()=>this.view.center,()=>{const c=this.transformPoints(e),w=Date.now();w-t>n&&(i(c),t=w)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,f),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const t=new g.Point({x:i[0],y:i[1]}),o=this.view.toScreen(t);return[o.x,o.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:t}=e;!i&&!t||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=T.watch(()=>this.view.zoom,o=>{i&&o<=i&&(this.view.zoom=i),t&&o>=t&&(this.view.zoom=t)}))}}exports.default=N;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/Basemap"),y=require("@arcgis/core/config"),q=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),z=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/TileLayer"),S=require("@arcgis/core/layers/WebTileLayer"),L=require("@arcgis/core/Map"),x=require("@arcgis/core/views/MapView"),R=require("@arcgis/core/views/SceneView"),H=require("@turf/destination"),I=require("@turf/helpers"),_=require("../stores/index.js"),C=require("./custom-layer/custom-wmts-layer.js");function b(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const t=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,t.get?t:{enumerable:!0,get:()=>r[i]})}}return e.default=r,Object.freeze(e)}const T=b(q),p=b(z),G=b(I);function k(r,e){return r&&(r.startsWith("http://")||r.startsWith("https://")?r:e+r)}class N{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){const i=_.default.useAppDataStore,t=JSON.parse(JSON.stringify(i.mapConfig));this.mapConfig=t;const{container:o,markerClickCallback:n,mapClickCallback:f}=e;y.assetsPath=`${t.assetsRoot}/ArcgisAssets`,y.fontsUrl=`${t.assetsRoot}/fonts`,y.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const c=new L;if((t==null?void 0:t.mapOptions.mode.toLowerCase())==="2d"?this.view=new x({map:c,container:o,...t.mapOptions}):this.view=new R({map:c,container:o,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...t==null?void 0:t.mapOptions}),this.view.on("click",async s=>{var v,M;if(f){let a=s.mapPoint;a.spatialReference.isWebMercator&&(a=p.webMercatorToGeographic(a)),f([a.x,a.y],[s.screenPoint.x,s.screenPoint.y],s)}if(this.view.type==="3d"){const a=this.view.camera;if(this.view.spatialReference.isWebMercator){const u=p.webMercatorToGeographic(a.position),d={heading:a.heading,tilt:a.tilt,position:u.toJSON()};console.log(d),(v=navigator.clipboard)==null||v.writeText(JSON.stringify(d))}else console.log(a.toJSON());console.log(this.view.zoom,this.view.scale)}else{let a=this.view.center;this.view.spatialReference.isWebMercator&&(a=p.webMercatorToGeographic(a)),console.log({center:a.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const l=(M=(await this.view.hitTest(s)).results)==null?void 0:M.filter(a=>a.type==="graphic");l.length>0&&l.forEach(a=>{var d;const u=a.graphic;(d=u.attributes)!=null&&d.type&&n&&n(u.attributes.type,u.attributes.id,u.attributes,s)})}),t!=null&&t.baseLayers?t.baseLayers.forEach(s=>{const h=k(s.url,t.assetsRoot);switch(s.type.toLowerCase()){case"webTile".toLowerCase():{const l=new S({urlTemplate:h,...s.options});c.add(l);break}case"tile":{const l=new O({url:h,...s.options});c.add(l);break}case"customWMTS".toLowerCase():{const l=new C.default({urlTemplate:h,...s.options});c.add(l);break}case"arcgis":{const l=new P(s.options);c.basemap=l;break}}}):c.basemap=new P({style:{id:"arcgis/dark-gray",language:"zh-CN"}}),t!=null&&t.hdLayers){const s=t.hdLayers.map(h=>new W({url:k(h.url,t.assetsRoot),...h.options,title:h.options.id}));c.addMany(s)}this.view.ui.remove("attribution"),this.view.ui.add("compass","top-left"),await this.view.when();const w=this.mapConfig.camera;let m;if(this.view.type==="2d"){let s=this.view.center;this.view.spatialReference.isWebMercator&&(s=p.webMercatorToGeographic(s)),m={center:[s.x,s.y],zoom:this.view.zoom}}else{let s=this.view.camera.position;this.view.spatialReference.isWebMercator&&(s=p.webMercatorToGeographic(s)),m={position:s,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return w?w.home=m:this.mapConfig.camera={home:m},this.view}setLayerVisibility(e){const{id:i,visible:t}=e,o=this.view.map.findLayerById(i);return o?(o.visible=t,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type){case"point":e.target=new g.Point(e.target);break;case"polyline":e.target=new g.Polyline(e.target);break;case"polygon":e.target=new g.Polygon(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,t=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:t,tilt:0},{duration:(e.duration||2)*1e3});else{const o=Math.tan(i*Math.PI/180)*e.height,n=H(G.point(e.center),o,t+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:e.height},heading:t,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:t=0}=e,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const n=o[i];return n?(await this.view.goTo(n,{duration:t*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let t=0;const n=1e3/30,f=T.watch(()=>this.view.center,()=>{const c=this.transformPoints(e),w=Date.now();w-t>n&&(i(c),t=w)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,f),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const t=new g.Point({x:i[0],y:i[1]}),o=this.view.toScreen(t);return[o.x,o.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:t}=e;!i&&!t||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=T.watch(()=>this.view.zoom,o=>{i&&o<=i&&(this.view.zoom=i),t&&o>=t&&(this.view.zoom=t)}))}}exports.default=N;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/Graphic"),A=require("@arcgis/core/core/promiseUtils"),$=require("@arcgis/core/geometry"),M=require("@arcgis/core/geometry/geometryEngineAsync"),j=require("@arcgis/core/layers/FeatureLayer"),g=require("@arcgis/core/layers/GraphicsLayer"),w=require("axios"),J=require("md5"),G=require("pako"),C=require("../common-utils.js"),P=require("./wasm-loader.js");function N(p){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const s in p)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(p,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>p[s]})}}return e.default=p,Object.freeze(e)}const O=N(A),S=N(M);class v{constructor(e){this.wasmLoader=P.default.getInstance(),this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.currentJunctionId="",this.view=e,this.view.popup.visibleElements={closeButton:!1,collapseButton:!1,actionBar:!1},this.laneLayer=new j({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new j({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new g({id:"OpenDriveJunction"}),this.sectionLayer=new g({id:"OpenDriveSection"}),this.highlightLayer=new g({id:"OpenDriveHighlight"}),this.flashLayer=new g({id:"OpenDriveFlash"}),this.view.map.addMany([this.laneLayer,this.junctionLayer,this.sectionLayer,this.roadNameLayer,this.highlightLayer,this.flashLayer])}static getInstance(e){return this.instance||(this.instance=new v(e)),this.instance}async makeMd5FromFile(e){const i=await(await fetch(e)).text();return J(i)}async showOpenDriveFromFile(e){var h,u;this.openDriveClickCallback=e.selectedCallback,this.projectName=await this.makeMd5FromFile(e.file),this.openDriveServer=e.server,await this.makeMd5FromFile(e.file);const s=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let i;try{i=await w.post(s,{},{params:{url:e.file,projectName:this.projectName}})}catch(y){return{status:-1,message:y.message}}if(i.status!==200)return{status:-1,message:i.statusText};console.time("渲染用时");const a=i.data.result.geoSetting;C.default.setGeoData(a.geoReference,a.offsetX,a.offsetY);let t=i.data.result.json;t.startsWith(window.location.protocol)||(t=`${window.location.protocol}//${e.server}${t}`);const r=await(await fetch(t)).arrayBuffer(),n=G.inflate(r,{to:"string"}),o=JSON.parse(n);await this.showAllLanes(o,((h=e.options)==null?void 0:h.showJunctionLane)||!1,((u=e.options)==null?void 0:u.showRoadName)||!0);const l=i.data.result.junctions;if(this.showJunction(l),e.options&&e.options.centerMap!==!1){const y=C.default.transformPointProjection([0,0]);await this.view.goTo(y)}return this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick(),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,s){const i=`http://${e}/api/openDrive/analyzeXodr`,a=await w.get(i,{headers:{projectName:s},params:{analyze:!1,compressed:!0}});if(a.status!==200)throw new Error(`OpenDriveRenderer: ${a.statusText}`);let t=a.data.result.json;t.startsWith(window.location.protocol)||(t=`${window.location.protocol}//${e}${t}`);const r=await(await fetch(t)).arrayBuffer(),n=G.inflate(r,{to:"string"}),o=JSON.parse(n);return await this.showAllLanes(o,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,s,i){const a=await this.laneLayer.queryFeatures();return a.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:a.features}),this.roadNameLayer.visible=i,new Promise(t=>{let c=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const r=[];for(const o of e){if(!s&&o.junction!=="-1")continue;const{id:l,refLine:h}=o;let u=o.name;u.includes("(")&&(u=u.slice(0,u.indexOf("("))),u=u.replace(/(.)/g,"$1 ");const y=new d({geometry:{type:"polyline",paths:[h]},attributes:{ObjectID:c++,roadId:l,roadName:u}});this.allRefLineGraphics.push(y);for(const I of o.laneSections){const L=Number(I.id);for(const f of I.lanePaths){const m=Number(f.id);if(m===0)continue;const F=f.type,b=f.innerPath.concat(f.outerPath.reverse());if(b.length<=3){console.warn(`lane ${m} has less than 3 points`);continue}b.push(f.innerPath[0]);const D=new $.Polygon({rings:[b]});if(D){const k=new d({geometry:D,attributes:{ObjectID:c++,id:`${l}+${L}+${m}`,roadId:l,roadName:o.name,sectionId:L,laneId:m,type:F,sumoId:""}});this.allLaneGraphics.push(k),r.push(k)}}}}const n=setInterval(()=>{if(r.length>0||this.allRefLineGraphics.length>0){if(r.length>0){const o=r.splice(0,100);this.laneLayer.applyEdits({addFeatures:o})}if(this.allRefLineGraphics.length>0){const o=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:o})}}else clearInterval(n),t()},10)})}showJunction(e){const s=[];for(const i of e){i.nodeType=i.type;const a=new d({geometry:{type:"point",x:i.coordinates[0],y:i.coordinates[1]},attributes:{...i,selected:!1,type:"OpenDriveJunction"},symbol:{type:"picture-marker",url:i.crossId?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",width:30,height:30}});s.push(a)}this.junctionLayer.addMany(s)}monitorMouseMove(){const e=O.debounce(async s=>{var c;const a=(c=(await this.view.hitTest(s,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:c.filter(r=>r.type==="graphic");if(a.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightGraphic=void 0,this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId="",this.view.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/Graphic"),A=require("@arcgis/core/core/promiseUtils"),$=require("@arcgis/core/geometry"),M=require("@arcgis/core/geometry/geometryEngineAsync"),j=require("@arcgis/core/layers/FeatureLayer"),g=require("@arcgis/core/layers/GraphicsLayer"),w=require("axios"),J=require("md5"),G=require("pako"),C=require("../common-utils.js"),P=require("./wasm-loader.js");function N(p){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const s in p)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(p,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>p[s]})}}return e.default=p,Object.freeze(e)}const O=N(A),S=N(M);class v{constructor(e){this.wasmLoader=P.default.getInstance(),this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.currentJunctionId="",this.view=e,this.view.popup.visibleElements={closeButton:!1,collapseButton:!1,actionBar:!1},this.laneLayer=new j({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new j({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new g({id:"OpenDriveJunction"}),this.sectionLayer=new g({id:"OpenDriveSection"}),this.highlightLayer=new g({id:"OpenDriveHighlight"}),this.flashLayer=new g({id:"OpenDriveFlash"}),this.view.map.addMany([this.laneLayer,this.junctionLayer,this.sectionLayer,this.roadNameLayer,this.highlightLayer,this.flashLayer])}static getInstance(e){return this.instance||(this.instance=new v(e)),this.instance}async makeMd5FromFile(e){const i=await(await fetch(e)).text();return J(i)}async showOpenDriveFromFile(e){var h,u;this.openDriveClickCallback=e.selectedCallback,this.projectName=await this.makeMd5FromFile(e.file),this.openDriveServer=e.server,await this.makeMd5FromFile(e.file);const s=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let i;try{i=await w.post(s,{},{params:{url:e.file,projectName:this.projectName}})}catch(y){return{status:-1,message:y.message}}if(i.status!==200)return{status:-1,message:i.statusText};console.time("渲染用时");const a=i.data.result.geoSetting;C.default.setGeoData(a.geoReference,a.offsetX,a.offsetY);let t=i.data.result.json;t.startsWith(window.location.protocol)||(t=`${window.location.protocol}//${e.server}${t}`);const r=await(await fetch(t)).arrayBuffer(),n=G.inflate(r,{to:"string"}),o=JSON.parse(n);await this.showAllLanes(o,((h=e.options)==null?void 0:h.showJunctionLane)||!1,((u=e.options)==null?void 0:u.showRoadName)||!0);const l=i.data.result.junctions;if(this.showJunction(l),e.options&&e.options.centerMap!==!1){const y=C.default.transformPointProjection([0,0]);await this.view.goTo(y)}return this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick(),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,s){const i=`http://${e}/api/openDrive/analyzeXodr`,a=await w.get(i,{headers:{projectName:s},params:{analyze:!1,compressed:!0}});if(a.status!==200)throw new Error(`OpenDriveRenderer: ${a.statusText}`);let t=a.data.result.json;t.startsWith(window.location.protocol)||(t=`${window.location.protocol}//${e}${t}`);const r=await(await fetch(t)).arrayBuffer(),n=G.inflate(r,{to:"string"}),o=JSON.parse(n);return await this.showAllLanes(o,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,s,i){const a=await this.laneLayer.queryFeatures();return a.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:a.features}),this.roadNameLayer.visible=i,new Promise(t=>{let c=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const r=[];for(const o of e){if(!s&&o.junction!=="-1")continue;const{id:l,refLine:h}=o;let u=o.name;u.includes("(")&&(u=u.slice(0,u.indexOf("("))),u=u.replace(/(.)/g,"$1 ");const y=new d({geometry:{type:"polyline",paths:[h]},attributes:{ObjectID:c++,roadId:l,roadName:u}});this.allRefLineGraphics.push(y);for(const I of o.laneSections){const L=Number(I.id);for(const f of I.lanePaths){const m=Number(f.id);if(m===0)continue;const F=f.type,b=f.innerPath.concat(f.outerPath.reverse());if(b.length<=3){console.warn(`lane ${m} has less than 3 points`);continue}b.push(f.innerPath[0]);const D=new $.Polygon({rings:[b]});if(D){const k=new d({geometry:D,attributes:{ObjectID:c++,id:`${l}+${L}+${m}`,roadId:l,roadName:o.name,sectionId:L,laneId:m,type:F,sumoId:""}});this.allLaneGraphics.push(k),r.push(k)}}}}const n=setInterval(()=>{if(r.length>0||this.allRefLineGraphics.length>0){if(r.length>0){const o=r.splice(0,100);this.laneLayer.applyEdits({addFeatures:o})}if(this.allRefLineGraphics.length>0){const o=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:o})}}else clearInterval(n),t()},10)})}showJunction(e){const s=[];for(const i of e){i.nodeType=i.type;const a=new d({geometry:{type:"point",x:i.coordinates[0],y:i.coordinates[1]},attributes:{...i,selected:!1,type:"OpenDriveJunction"},symbol:{type:"picture-marker",url:i.crossId?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",width:30,height:30}});s.push(a)}this.junctionLayer.addMany(s)}monitorMouseMove(){const e=O.debounce(async s=>{var c;const a=(c=(await this.view.hitTest(s,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:c.filter(r=>r.type==="graphic");if(a.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightGraphic=void 0,this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId="",this.view.closePopup());return}const t=a[0];if(this.hitGraphic=t.graphic,t.layer.id==="OpenDriveLane"){const r=`${this.hitGraphic.attributes.roadId}+${this.hitGraphic.attributes.sectionId}`;if(r===this.currentSectionCode||this.sectionLayer.graphics.findIndex(h=>h.getAttribute("id")===r)>=0)return;this.currentSectionCode=r;const o=this.allLaneGraphics.filter(h=>`${h.attributes.roadId}+${h.attributes.sectionId}`===r),l=await S.union(o.map(h=>h.geometry));this.highlightGraphic=new d({geometry:l,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:r,selected:!1}}),this.highlightLayer.removeAll(),this.highlightLayer.add(this.highlightGraphic)}else if(t.layer.id==="OpenDriveJunction"){const r=this.hitGraphic.getAttribute("id");if(r===this.currentJunctionId)return;this.currentJunctionId=r;const n=this.hitGraphic.getAttribute("name"),o=this.hitGraphic.getAttribute("crossId");this.view.popup.open({title:n,content:`<table>
|
|
2
2
|
<tr><td>路口编号</td><td>${r}</td></tr>
|
|
3
3
|
<tr><td>信号机编号</td><td>${o||"无信控"}</td></tr>
|
|
4
4
|
</table>`,location:this.hitGraphic.geometry})}});this.mouseMoveHandler=this.view.on("pointer-move",async s=>{e(s).catch(()=>{})})}monitorMouseClick(){const e=O.debounce(async s=>{var n;const a=(n=(await this.view.hitTest(s,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:n.filter(o=>o.type==="graphic");if(a.length===0)return;const t=a[0].graphic,c=t.getAttribute("type"),r=t.getAttribute("id");if(c==="OpenDriveJunction")if(t.getAttribute("selected")===!1){const o=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,l=await w.get(o,{params:{id:r,projectName:this.projectName}});l.status===200&&l.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:l.data.result}),t.setAttribute("selected",!0),t.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(t,50))}else{this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:void 0}),t.setAttribute("selected",!1);const o=t.getAttribute("crossId");t.symbol.url=o?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(t,30)}else if(c==="OpenDriveSection")if(t.getAttribute("selected"))this.sectionLayer.remove(t),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:r,details:void 0});else{this.highlightLayer.remove(t),this.sectionLayer.add(t),t.setAttribute("selected",!0);const o=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,l=await w.get(o,{params:{id:r,projectName:this.projectName}});l.status===200&&l.data.status===0&&this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:r,details:l.data.result})}});this.mouseClickHandler=this.view.on("immediate-click",async s=>{e(s).catch(()=>{})})}increasePictureMarkerSize(e,s){const i=setInterval(()=>{const a=e.symbol,t=a.width;t<s?e.symbol={type:"picture-marker",url:a.url,width:t+1,height:t+1}:clearInterval(i)},20)}decreasePictureMarkerSize(e,s){const i=setInterval(()=>{const a=e.symbol,t=a.width;t>s?e.symbol={type:"picture-marker",url:a.url,width:t-1,height:t-1}:clearInterval(i)},20)}async clearOpenDrive(){var s,i;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.wasmLoader.clear(),(s=this.mouseMoveHandler)==null||s.remove(),(i=this.mouseClickHandler)==null||i.remove()}async findSumo(e){const{type:s,id:i}=e,a=e.flash===void 0?!0:e.flash;if(s==="junction")return await this.findJunction(i,a);if(s==="edge"){const t=i.split("+");if(t.length>2)return{status:-1,message:"id格式错误"};const c=t.length===2?Number(t[1]):void 0,r=t[0].split("#");if(r.length>2)return{status:-1,message:"id格式错误"};const n=r[0],o=r.length===2?Number(r[1]):void 0;return await this.findLane({roadsectId:n,segmentId:o,laneId:c,flash:a})}else return{status:-1,message:"未知类型"}}async findJunction(e,s){const i=this.junctionLayer.graphics.find(a=>a.attributes.id===e);if(!i)return{status:-1,message:"未找到。请检查路口编号"};if(s){const a=new d({geometry:i.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[255,0,0,.6],outline:{color:"red",width:1}}});this.flashGraphic(a)}return await this.view.goTo(i.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:s,segmentId:i,laneId:a}=e;s.startsWith("-")&&(s=s.slice(1));let t=this.allLaneGraphics.filter(n=>n.attributes.roadId===s);if(t.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(i!==void 0){const n=[];if(t.forEach(o=>{const l=Number(o.attributes.sectionId);n.indexOf(l)===-1&&n.push(l)}),n.sort((o,l)=>o-l),i>n.length-1)return{status:-1,message:"未找到。请检查基本段编号"};i=n[i],t=t.filter(o=>Number(o.attributes.sectionId)===i)}if(a!==void 0){const n=[];if(t.forEach(o=>{const l=Number(o.attributes.laneId);n.indexOf(l)===-1&&n.push(l)}),n.sort((o,l)=>o-l),a>n.length-1)return{status:-1,message:"未找到。请检查车道编号"};a=n[a],t=t.filter(o=>Number(o.attributes.laneId)===a)}const c=t.map(n=>n.geometry),r=await S.union(c);if(e.flash){const n=new d({geometry:r,symbol:{type:"simple-fill",color:[255,0,0,.5],style:"solid",outline:{color:"red",width:0}}});this.flashGraphic(n)}return await this.view.goTo(r,{duration:1e3}),{status:0,message:"ok"}}flashGraphic(e){this.flashLayer.removeAll(),this.flashLayer.add(e);let s=0,i=!0;const a=setInterval(()=>{i?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(i=!1,s++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(i=!0)),s>=5&&(this.flashLayer.removeAll(),this.flashLayer.opacity=1,clearInterval(a))},10)}async splitLane(e){return{status:0,message:"ok",result:e}}}exports.default=v;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface ICross {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
parentId: string;
|
|
5
|
+
latitude: number;
|
|
6
|
+
longitude: number;
|
|
7
|
+
}
|
|
8
|
+
export default class DistrictController {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
parentId: string;
|
|
12
|
+
crosses: ICross[];
|
|
13
|
+
subDistricts: DistrictController[];
|
|
14
|
+
areaColor: number[];
|
|
15
|
+
crossCount: number;
|
|
16
|
+
subDistrictCount: number;
|
|
17
|
+
constructor(params: any);
|
|
18
|
+
getAllCrossCoordinates(): number[][];
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class i{constructor(s){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 i(t);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:t.latitude,longitude: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=i;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IResult } from '../../../types';
|
|
2
|
+
export default class SignalControlAreaController {
|
|
3
|
+
private view;
|
|
4
|
+
private districtControllerLayer;
|
|
5
|
+
private subDistrictControllerLayer;
|
|
6
|
+
private crossLayer;
|
|
7
|
+
private eventHandle?;
|
|
8
|
+
constructor(view: __esri.MapView | __esri.SceneView);
|
|
9
|
+
showSignalControlArea(params: any): IResult;
|
|
10
|
+
clearSignalControlArea(): IResult;
|
|
11
|
+
locateSignalControlArea(params: {
|
|
12
|
+
id: string;
|
|
13
|
+
}): IResult;
|
|
14
|
+
private drawArea;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),a=require("@arcgis/core/layers/GraphicsLayer"),f=require("@turf/convex"),m=require("@turf/helpers"),y=require("./district-controller.js");function b(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=b(m);class g{constructor(e){this.view=e,this.view.popup.visibleElements={closeButton:!1,collapseButton:!1,actionBar:!1},this.districtControllerLayer=new a({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new a({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new a({id:"crossLayer",maxScale:0,minScale:18056}),this.view.map.addMany([this.crossLayer,this.districtControllerLayer,this.subDistrictControllerLayer])}showSignalControlArea(e){for(const t of e){const r=new y.default(t);this.drawArea(r,!0)}return{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),(e=this.eventHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}locateSignalControlArea(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e.id);if(t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e.id)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e.id)),t){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"}}return{status:1,message:"未找到"}}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>2){const i=u.featureCollection(r.map(p=>u.point(p))),l=f(i);if(!l)return;let o;t?o=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:o=[{fieldName:"id",label:"子区编号"},{fieldName:"crossCount",label:"路口数量"}];const n=new c({geometry:{type:"polygon",rings:l.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.5],outline:{color:e.areaColor,width:1}},attributes:{type:"signalControlArea",id:e.id,name:e.name,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:e.name,content:[{type:"fields",fieldInfos:o}]}});t?this.districtControllerLayer.add(n):this.subDistrictControllerLayer.add(n)}for(const i of e.subDistricts)this.drawArea(i,!1);const d=e.crosses.map(i=>new c({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:{type:"simple-marker",color:e.areaColor,size:8},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:"id",label:"路口编号"},{fieldName:"districtId",label:"区控编号"},{fieldName:"subDistrictId",label:"子区编号"}]}]}}));this.crossLayer.addMany(d)}}exports.default=g;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gisviewer-vue3-arcgis",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.125",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "es/index.mjs",
|
|
6
6
|
"files": [
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@turf/bearing": "^6.5.0",
|
|
26
26
|
"@turf/buffer": "^6.5.0",
|
|
27
27
|
"@turf/destination": "^6.5.0",
|
|
28
|
+
"@turf/convex": "^7.0.0",
|
|
28
29
|
"@turf/helpers": "^6.5.0",
|
|
29
30
|
"@turf/intersect": "^6.5.0",
|
|
30
31
|
"@turf/line-intersect": "^7.0.0",
|