gisviewer-vue3-arcgis 1.0.116 → 1.0.118
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 +2 -1
- package/es/src/gis-map/gis-map.vue.mjs +57 -53
- package/es/src/gis-map/index.d.ts +1 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +2 -1
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +138 -133
- package/es/src/gis-map/utils/open-drive-renderer/lane.d.ts +7 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane.mjs +33 -16
- package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.mjs +16 -15
- package/es/src/types/index.d.ts +6 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +2 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +2 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/lane.d.ts +7 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.js +1 -1
- package/lib/src/types/index.d.ts +6 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MapView from '@arcgis/core/views/MapView';
|
|
2
2
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
-
import { IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowOpenDriveFromFileParams, IStartCrossBufferParam, IToggleTrafficInfoParams } from '../types';
|
|
3
|
+
import { IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowOpenDriveFromFileParams, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams } from '../types';
|
|
4
4
|
import HoloFlow from './utils/holo-flow';
|
|
5
5
|
import MapInitializer from './utils/map-initializer';
|
|
6
6
|
import OpenDriveRenderer from './utils/open-drive-renderer';
|
|
@@ -71,6 +71,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
71
71
|
showOpenDriveFromFile: (params: IShowOpenDriveFromFileParams) => Promise<import("../types").IResult>;
|
|
72
72
|
clearOpenDrive: () => Promise<void>;
|
|
73
73
|
findSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
|
|
74
|
+
splitOpenDriveLane: (params: ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
74
75
|
props: any;
|
|
75
76
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
76
77
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import C, { registerStore as
|
|
1
|
+
import { defineComponent as ue, ref as h, onMounted as fe, getCurrentInstance as ge, computed as we, openBlock as de, createElementBlock as ve, createElementVNode as p, withDirectives as ye, vShow as he } from "vue";
|
|
2
|
+
import C, { registerStore as Ce } from "./stores/index.mjs";
|
|
3
3
|
import "./style/index.css";
|
|
4
|
-
import
|
|
4
|
+
import Oe from "./utils/holo-flow/index.mjs";
|
|
5
5
|
import ke from "./utils/map-initializer.mjs";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const Se = { class: "gis-viewer" }, be = { style: { position: "absolute", bottom: "10px", left: "10px" } },
|
|
6
|
+
import O from "./utils/open-drive-renderer/index.mjs";
|
|
7
|
+
import Te from "./utils/overlay.mjs";
|
|
8
|
+
import Le from "./utils/queue-length.mjs";
|
|
9
|
+
import k from "./utils/road-config-tool/index.mjs";
|
|
10
|
+
import De from "./utils/traffic-flow.mjs";
|
|
11
|
+
const Se = { class: "gis-viewer" }, be = { style: { position: "absolute", bottom: "10px", left: "10px" } }, Ne = /* @__PURE__ */ ue({
|
|
12
12
|
__name: "gis-map",
|
|
13
13
|
props: {
|
|
14
14
|
config: {},
|
|
15
15
|
assetsRoot: {}
|
|
16
16
|
},
|
|
17
17
|
emits: ["mapLoaded", "markerClick", "mapClick"],
|
|
18
|
-
setup(T, { expose: L, emit:
|
|
18
|
+
setup(T, { expose: L, emit: D }) {
|
|
19
19
|
const u = h(null);
|
|
20
|
-
let s,
|
|
20
|
+
let s, i, o, n, r, a, l, t;
|
|
21
21
|
const f = h(!1);
|
|
22
|
-
|
|
22
|
+
Ce(), fe(async () => {
|
|
23
23
|
if (!u.value)
|
|
24
24
|
return;
|
|
25
25
|
document.addEventListener("keydown", (m) => {
|
|
26
26
|
m.ctrlKey && m.key === "i" && (f.value = !f.value);
|
|
27
27
|
});
|
|
28
|
-
const e =
|
|
29
|
-
y.assetsRoot = v.assetsRoot ||
|
|
30
|
-
const
|
|
31
|
-
|
|
28
|
+
const e = ge(), { $gisviewerAssetsRoot: c } = e.appContext.config.globalProperties, y = await (await fetch(v.config)).json();
|
|
29
|
+
y.assetsRoot = v.assetsRoot || c;
|
|
30
|
+
const me = C.useAppDataStore;
|
|
31
|
+
me.mapConfig = y, i = new ke(), s = await i.initialize({
|
|
32
32
|
container: u.value,
|
|
33
|
-
markerClickCallback: (m,
|
|
34
|
-
g("markerClick", m,
|
|
33
|
+
markerClickCallback: (m, w, d, pe) => {
|
|
34
|
+
g("markerClick", m, w, d, pe);
|
|
35
35
|
},
|
|
36
|
-
mapClickCallback: (m,
|
|
37
|
-
g("mapClick", m,
|
|
36
|
+
mapClickCallback: (m, w, d) => {
|
|
37
|
+
g("mapClick", m, w, d);
|
|
38
38
|
}
|
|
39
|
-
}), r = new
|
|
39
|
+
}), r = new Oe(s), await r.init(), g("mapLoaded");
|
|
40
40
|
});
|
|
41
|
-
const
|
|
41
|
+
const S = we(() => s), b = () => {
|
|
42
42
|
const e = C.useAppDataStore;
|
|
43
43
|
e.saveTrackLog = !0;
|
|
44
44
|
}, I = () => {
|
|
45
45
|
r.downloadTrackLog();
|
|
46
|
-
}, A = async (e) => await
|
|
47
|
-
|
|
46
|
+
}, A = async (e) => await i.setMapCenter(e), _ = async (e) => await i.setMapCamera(e), x = async (e) => await i.lookAt(e), M = (e) => i.setLayerVisibility(e), F = (e, c) => i.requestCoordinateTransform(e, c), V = (e) => {
|
|
47
|
+
i.cancelCoordinateTransform(e);
|
|
48
48
|
}, B = (e) => {
|
|
49
|
-
|
|
50
|
-
}, H = (e) => (
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
n || (n = new
|
|
55
|
-
},
|
|
49
|
+
i.setMapZoomRange(e);
|
|
50
|
+
}, H = (e) => (o || (o = new k(s)), o.showLaneNumber(e)), z = () => {
|
|
51
|
+
o == null || o.clearLaneNumber();
|
|
52
|
+
}, N = async (e) => (o || (o = new k(s)), await o.initializeSearch(e)), Q = async () => o == null ? void 0 : o.calCrossIndicatorArea(), j = async () => {
|
|
53
|
+
}, P = async (e, c) => {
|
|
54
|
+
n || (n = new De(s)), n.connectTrafficFlow(e, c);
|
|
55
|
+
}, R = () => {
|
|
56
56
|
n == null || n.disconnectTrafficFlow();
|
|
57
57
|
}, E = (e) => {
|
|
58
58
|
r.handleVehicleTraceData(e);
|
|
@@ -72,18 +72,21 @@ const Se = { class: "gis-viewer" }, be = { style: { position: "absolute", bottom
|
|
|
72
72
|
n == null || n.toggleTrafficObject(e), r.toggleTrafficObject(e);
|
|
73
73
|
}, W = (e) => {
|
|
74
74
|
r.updatePanelContent(e);
|
|
75
|
-
}, X = async (e) => (
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
l || (l = new
|
|
75
|
+
}, X = async (e) => (a || (a = new Te(s)), a.addOverlays(e)), Y = (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 = () => {
|
|
76
|
+
a == null || a.showAllOverlays();
|
|
77
|
+
}, oe = (e) => {
|
|
78
|
+
l || (l = new Le(s)), l.updateQueueLength(e);
|
|
79
79
|
}, ne = () => {
|
|
80
80
|
l == null || l.removeQueueLength();
|
|
81
|
-
}, re = async (e,
|
|
81
|
+
}, re = async (e, c) => (t || (t = new O(s)), await t.showOpenDriveFromServer(e, c)), se = async (e) => (t || (t = new O(s)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), ie = async () => await (t == null ? void 0 : t.clearOpenDrive()), ce = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
|
|
82
82
|
status: -1,
|
|
83
83
|
message: "未加载OpenDrive地图"
|
|
84
|
-
},
|
|
84
|
+
}, le = async (e) => t ? await (t == null ? void 0 : t.splitLane(e)) : {
|
|
85
|
+
status: -1,
|
|
86
|
+
message: "未加载OpenDrive地图"
|
|
87
|
+
}, v = T, g = D;
|
|
85
88
|
return L({
|
|
86
|
-
mapViewer:
|
|
89
|
+
mapViewer: S,
|
|
87
90
|
setLayerVisibility: M,
|
|
88
91
|
setMapCenter: A,
|
|
89
92
|
lookAt: x,
|
|
@@ -92,17 +95,17 @@ const Se = { class: "gis-viewer" }, be = { style: { position: "absolute", bottom
|
|
|
92
95
|
requestCoordinateTransform: F,
|
|
93
96
|
cancelCoordinateTransform: V,
|
|
94
97
|
addOverlays: X,
|
|
95
|
-
showAllOverlays:
|
|
98
|
+
showAllOverlays: ae,
|
|
96
99
|
removeOverlaysByType: Y,
|
|
97
100
|
removeOverlaysById: ee,
|
|
98
101
|
removeAllOverlays: te,
|
|
99
102
|
showLaneNumber: H,
|
|
100
|
-
clearLaneNumber:
|
|
101
|
-
initializeAreaTool:
|
|
102
|
-
calCrossIndicatorArea:
|
|
103
|
-
calRoadIndicatorArea:
|
|
104
|
-
connectCarFlow:
|
|
105
|
-
disconnectCarFlow:
|
|
103
|
+
clearLaneNumber: z,
|
|
104
|
+
initializeAreaTool: N,
|
|
105
|
+
calCrossIndicatorArea: Q,
|
|
106
|
+
calRoadIndicatorArea: j,
|
|
107
|
+
connectCarFlow: P,
|
|
108
|
+
disconnectCarFlow: R,
|
|
106
109
|
handleHoloVehicleTraceData: E,
|
|
107
110
|
clearHoloTrace: Z,
|
|
108
111
|
handleHoloSignalData: K,
|
|
@@ -112,31 +115,32 @@ const Se = { class: "gis-viewer" }, be = { style: { position: "absolute", bottom
|
|
|
112
115
|
toggleTrafficObject: U,
|
|
113
116
|
toggleVehicleInfo: W,
|
|
114
117
|
togglePause: J,
|
|
115
|
-
updateQueueLength:
|
|
118
|
+
updateQueueLength: oe,
|
|
116
119
|
removeQueueLength: ne,
|
|
117
120
|
showOpenDriveFromServer: re,
|
|
118
121
|
showOpenDriveFromFile: se,
|
|
119
|
-
clearOpenDrive:
|
|
120
|
-
findSumoInOpenDrive:
|
|
121
|
-
|
|
122
|
+
clearOpenDrive: ie,
|
|
123
|
+
findSumoInOpenDrive: ce,
|
|
124
|
+
splitOpenDriveLane: le
|
|
125
|
+
}), (e, c) => (de(), ve("div", Se, [
|
|
122
126
|
p("div", {
|
|
123
127
|
class: "gis-viewer-main",
|
|
124
128
|
ref_key: "mapContainer",
|
|
125
129
|
ref: u
|
|
126
130
|
}, [
|
|
127
|
-
|
|
131
|
+
ye(p("div", be, [
|
|
128
132
|
p("button", {
|
|
129
133
|
style: { "margin-right": "10px" },
|
|
130
|
-
onClick:
|
|
134
|
+
onClick: b
|
|
131
135
|
}, " 开始记录 "),
|
|
132
136
|
p("button", { onClick: I }, "下载日志")
|
|
133
137
|
], 512), [
|
|
134
|
-
[
|
|
138
|
+
[he, f.value]
|
|
135
139
|
])
|
|
136
140
|
], 512)
|
|
137
141
|
]));
|
|
138
142
|
}
|
|
139
143
|
});
|
|
140
144
|
export {
|
|
141
|
-
|
|
145
|
+
Ne as default
|
|
142
146
|
};
|
|
@@ -61,6 +61,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
61
61
|
showOpenDriveFromFile: (params: import("../types").IShowOpenDriveFromFileParams) => Promise<import("../types").IResult>;
|
|
62
62
|
clearOpenDrive: () => Promise<void>;
|
|
63
63
|
findSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
|
|
64
|
+
splitOpenDriveLane: (params: import("../types").ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
64
65
|
props: any;
|
|
65
66
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
66
67
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import View from '@arcgis/core/views/View';
|
|
2
|
-
import { IFindSumoParams, IResult, IShowOpenDriveFromFileParams } from '../../../types';
|
|
2
|
+
import { IFindSumoParams, IResult, IShowOpenDriveFromFileParams, ISplitOpenDriveLaneParams } from '../../../types';
|
|
3
3
|
export default class OpenDriveRenderer {
|
|
4
4
|
private static instance;
|
|
5
5
|
static getInstance(view: View): OpenDriveRenderer;
|
|
@@ -34,4 +34,5 @@ export default class OpenDriveRenderer {
|
|
|
34
34
|
* @returns
|
|
35
35
|
*/
|
|
36
36
|
private findLane;
|
|
37
|
+
splitLane(params: ISplitOpenDriveLaneParams): Promise<IResult>;
|
|
37
38
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
1
|
+
import m from "@arcgis/core/Graphic";
|
|
2
|
+
import { Polygon as b } from "@arcgis/core/geometry";
|
|
3
|
+
import * as G from "@arcgis/core/geometry/geometryEngineAsync.js";
|
|
4
4
|
import L from "@arcgis/core/layers/FeatureLayer";
|
|
5
5
|
import v from "@arcgis/core/layers/GraphicsLayer";
|
|
6
6
|
import O from "axios";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import j from "pako";
|
|
8
|
+
import N from "./wasm-loader.mjs";
|
|
9
9
|
class I {
|
|
10
10
|
constructor(e) {
|
|
11
|
-
this.wasmLoader =
|
|
11
|
+
this.wasmLoader = N.getInstance(), this.view = e, this.laneLayer = new L({
|
|
12
12
|
id: "OpenDriveLane",
|
|
13
13
|
fields: [
|
|
14
14
|
{
|
|
@@ -45,6 +45,11 @@ class I {
|
|
|
45
45
|
name: "type",
|
|
46
46
|
alias: "类型",
|
|
47
47
|
type: "string"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "sumoId",
|
|
51
|
+
alias: "sumo编号",
|
|
52
|
+
type: "string"
|
|
48
53
|
}
|
|
49
54
|
],
|
|
50
55
|
objectIdField: "ObjectID",
|
|
@@ -255,7 +260,7 @@ class I {
|
|
|
255
260
|
family: "sans-serif"
|
|
256
261
|
}
|
|
257
262
|
},
|
|
258
|
-
labelPlacement: "center-along",
|
|
263
|
+
labelPlacement: this.view.type === "2d" ? "center-along" : void 0,
|
|
259
264
|
labelExpressionInfo: {
|
|
260
265
|
expression: "$feature.roadName"
|
|
261
266
|
}
|
|
@@ -272,90 +277,94 @@ class I {
|
|
|
272
277
|
return this.instance || (this.instance = new I(e)), this.instance;
|
|
273
278
|
}
|
|
274
279
|
async showOpenDriveFromFile(e) {
|
|
275
|
-
var
|
|
276
|
-
const
|
|
277
|
-
if (
|
|
278
|
-
return
|
|
280
|
+
var o, c, s;
|
|
281
|
+
const i = await this.wasmLoader.load(e.file);
|
|
282
|
+
if (i.status !== 0)
|
|
283
|
+
return i;
|
|
279
284
|
console.time("渲染用时");
|
|
280
|
-
const { roads:
|
|
285
|
+
const { roads: n, junctions: a } = i.result;
|
|
281
286
|
return await this.showAllLanes(
|
|
282
|
-
|
|
283
|
-
((
|
|
284
|
-
((
|
|
285
|
-
), (
|
|
287
|
+
n,
|
|
288
|
+
((o = e.options) == null ? void 0 : o.showJunctionLane) || !1,
|
|
289
|
+
((c = e.options) == null ? void 0 : c.showRoadName) || !0
|
|
290
|
+
), (s = e.options) != null && s.showJunctionPolygon && this.showJunction(a), console.timeEnd("渲染用时"), { status: 0, message: "ok" };
|
|
286
291
|
}
|
|
287
292
|
/**
|
|
288
293
|
* 从服务器载入OpenDrive文件解析结果并显示
|
|
289
294
|
* @param server
|
|
290
295
|
* @param projectName
|
|
291
296
|
*/
|
|
292
|
-
async showOpenDriveFromServer(e,
|
|
293
|
-
const
|
|
297
|
+
async showOpenDriveFromServer(e, i) {
|
|
298
|
+
const n = `http://${e}/api/openDrive/analyzeXodr`, a = await O.get(n, {
|
|
294
299
|
headers: {
|
|
295
|
-
projectName:
|
|
300
|
+
projectName: i
|
|
296
301
|
},
|
|
297
302
|
params: {
|
|
298
303
|
analyze: !1,
|
|
299
304
|
compressed: !0
|
|
300
305
|
}
|
|
301
306
|
});
|
|
302
|
-
if (
|
|
303
|
-
throw new Error(`OpenDriveRenderer: ${
|
|
304
|
-
let
|
|
305
|
-
|
|
306
|
-
const
|
|
307
|
-
return await this.showAllLanes(
|
|
307
|
+
if (a.status !== 200)
|
|
308
|
+
throw new Error(`OpenDriveRenderer: ${a.statusText}`);
|
|
309
|
+
let o = a.data.result.json;
|
|
310
|
+
o.startsWith(window.location.protocol) || (o = `${window.location.protocol}//${e}${o}`);
|
|
311
|
+
const s = await (await fetch(o)).arrayBuffer(), r = j.inflate(s, { to: "string" }), d = JSON.parse(r);
|
|
312
|
+
return await this.showAllLanes(d, !1, !1), { status: 0, message: "ok" };
|
|
308
313
|
}
|
|
309
|
-
async showAllLanes(e,
|
|
310
|
-
const
|
|
311
|
-
return
|
|
312
|
-
deleteFeatures:
|
|
313
|
-
}), this.roadNameLayer.visible =
|
|
314
|
-
let
|
|
314
|
+
async showAllLanes(e, i, n) {
|
|
315
|
+
const a = await this.laneLayer.queryFeatures();
|
|
316
|
+
return a.features.length > 0 && this.laneLayer.applyEdits({
|
|
317
|
+
deleteFeatures: a.features
|
|
318
|
+
}), this.roadNameLayer.visible = n, new Promise((o) => {
|
|
319
|
+
let c = 0;
|
|
315
320
|
this.allLaneGraphics = [], this.allRefLineGraphics = [];
|
|
316
|
-
for (const
|
|
317
|
-
if (!
|
|
321
|
+
for (const r of e) {
|
|
322
|
+
if (!i && r.junction !== "-1")
|
|
318
323
|
continue;
|
|
319
|
-
const { id:
|
|
320
|
-
let
|
|
321
|
-
|
|
322
|
-
const
|
|
323
|
-
geometry:
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
const { id: d, refLine: l } = r;
|
|
325
|
+
let t = r.name;
|
|
326
|
+
t.includes("(") && (t = t.slice(0, t.indexOf("("))), t = t.replace(/(.)/g, "$1 ");
|
|
327
|
+
const h = new m({
|
|
328
|
+
geometry: {
|
|
329
|
+
type: "polyline",
|
|
330
|
+
paths: [l]
|
|
331
|
+
},
|
|
326
332
|
attributes: {
|
|
327
|
-
ObjectID:
|
|
328
|
-
roadId:
|
|
329
|
-
roadName:
|
|
333
|
+
ObjectID: c++,
|
|
334
|
+
roadId: d,
|
|
335
|
+
roadName: t
|
|
330
336
|
}
|
|
331
337
|
});
|
|
332
|
-
this.allRefLineGraphics.push(
|
|
333
|
-
for (const
|
|
334
|
-
const
|
|
335
|
-
for (const
|
|
336
|
-
const
|
|
337
|
-
if (
|
|
338
|
+
this.allRefLineGraphics.push(h);
|
|
339
|
+
for (const y of r.laneSections) {
|
|
340
|
+
const g = Number(y.id);
|
|
341
|
+
for (const u of y.lanePaths) {
|
|
342
|
+
const p = Number(u.id);
|
|
343
|
+
if (p === 0)
|
|
338
344
|
continue;
|
|
339
|
-
const D =
|
|
340
|
-
|
|
341
|
-
|
|
345
|
+
const D = u.type, f = u.innerPath.concat(
|
|
346
|
+
u.outerPath.reverse()
|
|
347
|
+
);
|
|
348
|
+
if (f.length <= 3) {
|
|
349
|
+
console.warn(`lane ${p} has less than 3 points`);
|
|
342
350
|
continue;
|
|
343
351
|
}
|
|
344
|
-
|
|
345
|
-
const
|
|
346
|
-
rings: [
|
|
352
|
+
f.push(u.innerPath[0]);
|
|
353
|
+
const w = new b({
|
|
354
|
+
rings: [f]
|
|
347
355
|
});
|
|
348
|
-
if (
|
|
349
|
-
const F = new
|
|
350
|
-
geometry:
|
|
356
|
+
if (w) {
|
|
357
|
+
const F = new m({
|
|
358
|
+
geometry: w,
|
|
351
359
|
attributes: {
|
|
352
|
-
ObjectID:
|
|
353
|
-
id: `${
|
|
354
|
-
roadId:
|
|
355
|
-
roadName:
|
|
356
|
-
sectionId:
|
|
357
|
-
laneId:
|
|
358
|
-
type: D
|
|
360
|
+
ObjectID: c++,
|
|
361
|
+
id: `${d}+${g}+${p}`,
|
|
362
|
+
roadId: d,
|
|
363
|
+
roadName: r.name,
|
|
364
|
+
sectionId: g,
|
|
365
|
+
laneId: p,
|
|
366
|
+
type: D,
|
|
367
|
+
sumoId: ""
|
|
359
368
|
}
|
|
360
369
|
});
|
|
361
370
|
this.allLaneGraphics.push(F);
|
|
@@ -363,34 +372,35 @@ class I {
|
|
|
363
372
|
}
|
|
364
373
|
}
|
|
365
374
|
}
|
|
366
|
-
|
|
375
|
+
this.view.type === "2d" ? this.view.goTo(this.allRefLineGraphics) : this.view.goTo(this.allRefLineGraphics);
|
|
376
|
+
const s = setInterval(() => {
|
|
367
377
|
if (this.allLaneGraphics.length > 0 || this.allRefLineGraphics.length > 0) {
|
|
368
378
|
if (this.allLaneGraphics.length > 0) {
|
|
369
|
-
const
|
|
379
|
+
const r = this.allLaneGraphics.splice(0, 100);
|
|
370
380
|
this.laneLayer.applyEdits({
|
|
371
|
-
addFeatures:
|
|
381
|
+
addFeatures: r
|
|
372
382
|
});
|
|
373
383
|
}
|
|
374
384
|
if (this.allRefLineGraphics.length > 0) {
|
|
375
|
-
const
|
|
385
|
+
const r = this.allRefLineGraphics.splice(0, 10);
|
|
376
386
|
this.roadNameLayer.applyEdits({
|
|
377
|
-
addFeatures:
|
|
387
|
+
addFeatures: r
|
|
378
388
|
});
|
|
379
389
|
}
|
|
380
390
|
} else
|
|
381
|
-
clearInterval(
|
|
391
|
+
clearInterval(s), o();
|
|
382
392
|
}, 10);
|
|
383
393
|
});
|
|
384
394
|
}
|
|
385
395
|
async showJunction(e) {
|
|
386
|
-
for (const
|
|
387
|
-
const
|
|
388
|
-
rings: [
|
|
389
|
-
}),
|
|
390
|
-
geometry:
|
|
396
|
+
for (const i of e) {
|
|
397
|
+
const n = new b({
|
|
398
|
+
rings: [i.outline]
|
|
399
|
+
}), a = new m({
|
|
400
|
+
geometry: n,
|
|
391
401
|
attributes: {
|
|
392
|
-
id:
|
|
393
|
-
name:
|
|
402
|
+
id: i.id,
|
|
403
|
+
name: i.name
|
|
394
404
|
},
|
|
395
405
|
symbol: {
|
|
396
406
|
type: "simple-fill",
|
|
@@ -402,7 +412,7 @@ class I {
|
|
|
402
412
|
}
|
|
403
413
|
}
|
|
404
414
|
});
|
|
405
|
-
this.junctionLayer.add(
|
|
415
|
+
this.junctionLayer.add(a);
|
|
406
416
|
}
|
|
407
417
|
}
|
|
408
418
|
async clearOpenDrive() {
|
|
@@ -417,14 +427,16 @@ class I {
|
|
|
417
427
|
* @returns
|
|
418
428
|
*/
|
|
419
429
|
async findSumo(e) {
|
|
420
|
-
const { id:
|
|
421
|
-
if (
|
|
430
|
+
const { id: i } = e, n = e.flash === void 0 ? !0 : e.flash, a = i.split("+");
|
|
431
|
+
if (a.length > 2)
|
|
422
432
|
return { status: -1, message: "id格式错误" };
|
|
423
|
-
const
|
|
424
|
-
if (
|
|
433
|
+
const o = a.length === 2 ? Number(a[1]) : void 0, c = a[0].split("#");
|
|
434
|
+
if (c.length > 2)
|
|
425
435
|
return { status: -1, message: "id格式错误" };
|
|
426
|
-
|
|
427
|
-
|
|
436
|
+
let s = c[0];
|
|
437
|
+
s.startsWith("-") && (s = s.slice(1));
|
|
438
|
+
const r = c.length === 2 ? Number(c[1]) : void 0;
|
|
439
|
+
return await this.findLane({ roadsectId: s, segmentId: r, laneId: o, flash: n });
|
|
428
440
|
}
|
|
429
441
|
/**
|
|
430
442
|
* 用sumo的id定位车道、基本段、路段
|
|
@@ -432,69 +444,62 @@ class I {
|
|
|
432
444
|
* @returns
|
|
433
445
|
*/
|
|
434
446
|
async findLane(e) {
|
|
435
|
-
let {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
if (d.features.length === 0)
|
|
447
|
+
let { segmentId: i, laneId: n } = e;
|
|
448
|
+
const { roadsectId: a } = e, o = this.laneLayer.createQuery();
|
|
449
|
+
o.returnGeometry = !0, o.outFields = ["*"], o.where = `roadId = '${a}'`;
|
|
450
|
+
const c = await this.laneLayer.queryFeatures(o);
|
|
451
|
+
if (c.features.length === 0)
|
|
441
452
|
return { status: -1, message: "未找到。请检查路段编号" };
|
|
442
|
-
let
|
|
453
|
+
let s = c.features;
|
|
443
454
|
if (i !== void 0) {
|
|
444
|
-
const
|
|
445
|
-
if (
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
}),
|
|
455
|
+
const l = [];
|
|
456
|
+
if (s.forEach((t) => {
|
|
457
|
+
const h = Number(t.attributes.sectionId);
|
|
458
|
+
l.indexOf(h) === -1 && l.push(h);
|
|
459
|
+
}), l.sort((t, h) => t - h), i > l.length - 1)
|
|
449
460
|
return { status: -1, message: "未找到。请检查基本段编号" };
|
|
450
|
-
i =
|
|
451
|
-
(
|
|
461
|
+
i = l[i], s = s.filter(
|
|
462
|
+
(t) => Number(t.attributes.sectionId) === i
|
|
452
463
|
);
|
|
453
464
|
}
|
|
454
|
-
if (
|
|
455
|
-
const
|
|
456
|
-
if (
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
}),
|
|
465
|
+
if (n !== void 0) {
|
|
466
|
+
const l = [];
|
|
467
|
+
if (s.forEach((t) => {
|
|
468
|
+
const h = Number(t.attributes.laneId);
|
|
469
|
+
l.indexOf(h) === -1 && l.push(h);
|
|
470
|
+
}), l.sort((t, h) => t - h), n > l.length - 1)
|
|
460
471
|
return { status: -1, message: "未找到。请检查车道编号" };
|
|
461
|
-
|
|
462
|
-
(
|
|
472
|
+
n = l[n], s = s.filter(
|
|
473
|
+
(t) => Number(t.attributes.laneId) === n
|
|
463
474
|
);
|
|
464
475
|
}
|
|
465
|
-
const
|
|
466
|
-
(
|
|
467
|
-
),
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
476
|
+
const r = s.map(
|
|
477
|
+
(l) => l.geometry
|
|
478
|
+
), d = await G.union(r);
|
|
479
|
+
if (e.flash) {
|
|
480
|
+
this.highlightLayer.removeAll();
|
|
481
|
+
const l = new m({
|
|
482
|
+
geometry: d,
|
|
471
483
|
symbol: {
|
|
472
484
|
type: "simple-fill",
|
|
473
|
-
|
|
485
|
+
color: [255, 0, 0, 0.5],
|
|
486
|
+
style: "solid",
|
|
474
487
|
outline: {
|
|
475
488
|
color: "red",
|
|
476
489
|
width: 2
|
|
477
490
|
}
|
|
478
491
|
}
|
|
479
|
-
})
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
|
-
this.highlightLayer.add(y);
|
|
493
|
-
let u = 0;
|
|
494
|
-
const f = setInterval(() => {
|
|
495
|
-
u % 2 === 0 ? y.visible = !0 : y.visible = !1, u++, u > 10 && (this.highlightLayer.removeAll(), clearInterval(f));
|
|
496
|
-
}, 500);
|
|
497
|
-
return this.view.type === "2d" ? await this.view.goTo(h, { duration: 1e3 }) : await this.view.goTo(h, { duration: 1e3 }), { status: 0, message: "ok" };
|
|
492
|
+
});
|
|
493
|
+
this.highlightLayer.add(l);
|
|
494
|
+
let t = 0, h = !0;
|
|
495
|
+
const y = setInterval(() => {
|
|
496
|
+
h ? (this.highlightLayer.opacity -= 0.02, this.highlightLayer.opacity <= 0.1 && (h = !1, t++)) : (this.highlightLayer.opacity += 0.02, this.highlightLayer.opacity >= 1 && (h = !0)), t > 5 && (this.highlightLayer.removeAll(), this.highlightLayer.opacity = 1, clearInterval(y));
|
|
497
|
+
}, 20);
|
|
498
|
+
}
|
|
499
|
+
return this.view.type === "2d" ? await this.view.goTo(d, { duration: 1e3 }) : await this.view.goTo(d, { duration: 1e3 }), { status: 0, message: "ok" };
|
|
500
|
+
}
|
|
501
|
+
async splitLane(e) {
|
|
502
|
+
return { status: 0, message: "ok", result: e };
|
|
498
503
|
}
|
|
499
504
|
}
|
|
500
505
|
export {
|
|
@@ -12,6 +12,7 @@ export default class Lane {
|
|
|
12
12
|
innerBorder: number[][];
|
|
13
13
|
/** 外侧边线采样点坐标 */
|
|
14
14
|
outerBorder: number[][];
|
|
15
|
+
centerLine: number[][];
|
|
15
16
|
road: Road;
|
|
16
17
|
laneSection: LaneSection;
|
|
17
18
|
predecessor: number;
|
|
@@ -48,6 +49,12 @@ export default class Lane {
|
|
|
48
49
|
* @returns
|
|
49
50
|
*/
|
|
50
51
|
get drivingAngle(): number;
|
|
52
|
+
/**
|
|
53
|
+
* 根据左右边线生成车道中心线
|
|
54
|
+
* @param left
|
|
55
|
+
* @param right
|
|
56
|
+
*/
|
|
57
|
+
private getCenterLineFromBorder;
|
|
51
58
|
/**
|
|
52
59
|
* 获取车道按行车方向的起点、终点,可选择内侧、中间、外侧
|
|
53
60
|
* @param type
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
class
|
|
4
|
-
constructor(e, t,
|
|
5
|
-
this.isDirEqualReady = !1, this.road = t, this.laneSection =
|
|
6
|
-
const o =
|
|
1
|
+
import n from "../common-utils.mjs";
|
|
2
|
+
import s from "./lane-utils.mjs";
|
|
3
|
+
class c {
|
|
4
|
+
constructor(e, t, i) {
|
|
5
|
+
this.isDirEqualReady = !1, this.road = t, this.laneSection = i, this.id = e.id, this.type = e.type, this.predecessor = e.predecessor, this.successor = e.successor;
|
|
6
|
+
const o = n.getStdVecEntries(
|
|
7
7
|
e.inner_border,
|
|
8
8
|
!0
|
|
9
9
|
);
|
|
10
|
-
this.innerBorder =
|
|
11
|
-
const
|
|
10
|
+
this.innerBorder = n.transformLineProjection(o);
|
|
11
|
+
const r = n.getStdVecEntries(
|
|
12
12
|
e.outer_border,
|
|
13
13
|
!0
|
|
14
14
|
);
|
|
15
|
-
this.outerBorder =
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
this.outerBorder = n.transformLineProjection(r), this.centerLine = this.getCenterLineFromBorder(
|
|
16
|
+
this.innerBorder,
|
|
17
|
+
this.outerBorder
|
|
18
|
+
);
|
|
19
|
+
const h = this.innerBorder.concat([...this.outerBorder].reverse());
|
|
20
|
+
h.push(h[0]), this.ring = h;
|
|
18
21
|
}
|
|
19
22
|
get isDirEqual() {
|
|
20
|
-
return this.isDirEqualReady || (this._isDirEqual =
|
|
23
|
+
return this.isDirEqualReady || (this._isDirEqual = s.isLaneDirEqualDriveDir(this), this.isDirEqualReady = !0), this._isDirEqual;
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
* 车道代码:道路id_路段id_车道id
|
|
@@ -49,25 +52,39 @@ class l {
|
|
|
49
52
|
*/
|
|
50
53
|
get drivingAngle() {
|
|
51
54
|
if (!this.angle) {
|
|
52
|
-
const e =
|
|
55
|
+
const e = s.getDriveAngle(this);
|
|
53
56
|
this.angle = e;
|
|
54
57
|
}
|
|
55
58
|
return this.angle;
|
|
56
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* 根据左右边线生成车道中心线
|
|
62
|
+
* @param left
|
|
63
|
+
* @param right
|
|
64
|
+
*/
|
|
65
|
+
getCenterLineFromBorder(e, t) {
|
|
66
|
+
const i = [], o = Math.min(e.length, t.length);
|
|
67
|
+
for (let r = 0; r < o; r++)
|
|
68
|
+
i.push([
|
|
69
|
+
(e[r][0] + t[r][0]) / 2,
|
|
70
|
+
(e[r][1] + t[r][1]) / 2
|
|
71
|
+
]);
|
|
72
|
+
return i;
|
|
73
|
+
}
|
|
57
74
|
/**
|
|
58
75
|
* 获取车道按行车方向的起点、终点,可选择内侧、中间、外侧
|
|
59
76
|
* @param type
|
|
60
77
|
* @returns
|
|
61
78
|
*/
|
|
62
79
|
getLaneEndPoints(e = "middle") {
|
|
63
|
-
return
|
|
80
|
+
return s.getLaneEndPoints(this, e);
|
|
64
81
|
}
|
|
65
82
|
/**
|
|
66
83
|
* 获取车道的前驱车道和后继车道
|
|
67
84
|
* @returns
|
|
68
85
|
*/
|
|
69
86
|
getLink() {
|
|
70
|
-
return
|
|
87
|
+
return s.getPrevAndNext(this);
|
|
71
88
|
}
|
|
72
89
|
// /**
|
|
73
90
|
// * 获取车道对应的高精地图要素
|
|
@@ -89,5 +106,5 @@ class l {
|
|
|
89
106
|
}
|
|
90
107
|
}
|
|
91
108
|
export {
|
|
92
|
-
|
|
109
|
+
c as default
|
|
93
110
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { XMLParser as m } from "fast-xml-parser";
|
|
2
2
|
import { useAppDataStore as h } from "../../stores/appData.mjs";
|
|
3
3
|
import f from "../common-utils.mjs";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import L from "./junction.mjs";
|
|
5
|
+
import p from "./road.mjs";
|
|
6
6
|
class g {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.roadList = /* @__PURE__ */ new Map(), this.junctionList = /* @__PURE__ */ new Map(), this.isWasmLoaded = !1, this.appStore = h(), this.FsFile = "data.xodr";
|
|
@@ -16,8 +16,8 @@ class g {
|
|
|
16
16
|
*/
|
|
17
17
|
async load(t) {
|
|
18
18
|
if (!this.isWasmLoaded) {
|
|
19
|
-
const
|
|
20
|
-
this.ModuleOpenDrive = await
|
|
19
|
+
const l = window.libOpenDrive;
|
|
20
|
+
this.ModuleOpenDrive = await l(), this.isWasmLoaded = !0;
|
|
21
21
|
}
|
|
22
22
|
console.time("加载用时");
|
|
23
23
|
const s = await (await fetch(t)).text(), n = new m({
|
|
@@ -25,10 +25,10 @@ class g {
|
|
|
25
25
|
allowBooleanAttributes: !0
|
|
26
26
|
}).parse(s), i = n.OpenDRIVE.header.geoReference, a = n.OpenDRIVE.header.offset;
|
|
27
27
|
if (a) {
|
|
28
|
-
const
|
|
28
|
+
const l = Number(a["@_x"]) || 0, u = Number(a["@_y"]) || 0;
|
|
29
29
|
this.appStore.$patch({
|
|
30
|
-
xOffset:
|
|
31
|
-
yOffset:
|
|
30
|
+
xOffset: l,
|
|
31
|
+
yOffset: u,
|
|
32
32
|
geoReference: i
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -76,27 +76,28 @@ class g {
|
|
|
76
76
|
h().$patch({
|
|
77
77
|
geoReference: e
|
|
78
78
|
}), console.timeEnd("采样用时"), console.time("投影转换用时"), f.getStdVecEntries(t.roads, !0).forEach((r) => {
|
|
79
|
-
const c = new
|
|
79
|
+
const c = new p(r);
|
|
80
80
|
this.roadList.set(c.id, c);
|
|
81
81
|
}), f.getStdVecEntries(
|
|
82
82
|
t.junctions,
|
|
83
83
|
!0
|
|
84
84
|
).forEach((r) => {
|
|
85
|
-
const c = new
|
|
85
|
+
const c = new L(r);
|
|
86
86
|
this.junctionList.set(r.id, c);
|
|
87
87
|
}), console.timeEnd("投影转换用时");
|
|
88
88
|
const i = [];
|
|
89
89
|
this.roadList.forEach((r) => {
|
|
90
90
|
const c = r.allLaneSections.map((d) => {
|
|
91
|
-
const
|
|
92
|
-
id:
|
|
93
|
-
type:
|
|
94
|
-
innerPath:
|
|
95
|
-
outerPath:
|
|
91
|
+
const l = d.allLanes.map((u) => ({
|
|
92
|
+
id: u.id,
|
|
93
|
+
type: u.type,
|
|
94
|
+
innerPath: u.innerBorder,
|
|
95
|
+
outerPath: u.outerBorder,
|
|
96
|
+
centerLine: u.centerLine
|
|
96
97
|
}));
|
|
97
98
|
return {
|
|
98
99
|
id: d.s0,
|
|
99
|
-
lanePaths:
|
|
100
|
+
lanePaths: l
|
|
100
101
|
};
|
|
101
102
|
});
|
|
102
103
|
i.push({
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MapView from '@arcgis/core/views/MapView';
|
|
2
2
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
-
import { IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowOpenDriveFromFileParams, IStartCrossBufferParam, IToggleTrafficInfoParams } from '../types';
|
|
3
|
+
import { IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowOpenDriveFromFileParams, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams } from '../types';
|
|
4
4
|
import HoloFlow from './utils/holo-flow';
|
|
5
5
|
import MapInitializer from './utils/map-initializer';
|
|
6
6
|
import OpenDriveRenderer from './utils/open-drive-renderer';
|
|
@@ -71,6 +71,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
71
71
|
showOpenDriveFromFile: (params: IShowOpenDriveFromFileParams) => Promise<import("../types").IResult>;
|
|
72
72
|
clearOpenDrive: () => Promise<void>;
|
|
73
73
|
findSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
|
|
74
|
+
splitOpenDriveLane: (params: ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
74
75
|
props: any;
|
|
75
76
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
76
77
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),v=require("./stores/index.js");require("./style/index.css");const de=require("./utils/holo-flow/index.js"),me=require("./utils/map-initializer.js"),C=require("./utils/open-drive-renderer/index.js"),pe=require("./utils/overlay.js"),fe=require("./utils/queue-length.js"),O=require("./utils/road-config-tool/index.js"),ge=require("./utils/traffic-flow.js"),we={class:"gis-viewer"},ve={style:{position:"absolute",bottom:"10px",left:"10px"}},ye=n.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:T,emit:L}){const m=n.ref(null);let c,i,o,r,s,a,u,t;const p=n.ref(!1);v.registerStore(),n.onMounted(async()=>{if(!m.value)return;document.addEventListener("keydown",d=>{d.ctrlKey&&d.key==="i"&&(p.value=!p.value)});const e=n.getCurrentInstance(),{$gisviewerAssetsRoot:l}=e.appContext.config.globalProperties,h=await(await fetch(y.config)).json();h.assetsRoot=y.assetsRoot||l;const le=v.default.useAppDataStore;le.mapConfig=h,i=new me.default,c=await i.initialize({container:m.value,markerClickCallback:(d,g,w,ue)=>{f("markerClick",d,g,w,ue)},mapClickCallback:(d,g,w)=>{f("mapClick",d,g,w)}}),s=new de.default(c),await s.init(),f("mapLoaded")});const b=n.computed(()=>c),S=()=>{const e=v.default.useAppDataStore;e.saveTrackLog=!0},D=()=>{s.downloadTrackLog()},I=async e=>await i.setMapCenter(e),A=async e=>await i.setMapCamera(e),_=async e=>await i.lookAt(e),q=e=>i.setLayerVisibility(e),x=(e,l)=>i.requestCoordinateTransform(e,l),V=e=>{i.cancelCoordinateTransform(e)},M=e=>{i.setMapZoomRange(e)},N=e=>(o||(o=new O.default(c)),o.showLaneNumber(e)),F=()=>{o==null||o.clearLaneNumber()},B=async e=>(o||(o=new O.default(c)),await o.initializeSearch(e)),E=async()=>o==null?void 0:o.calCrossIndicatorArea(),H=async()=>{},j=async(e,l)=>{r||(r=new ge.default(c)),r.connectTrafficFlow(e,l)},z=()=>{r==null||r.disconnectTrafficFlow()},P=e=>{s.handleVehicleTraceData(e)},Q=()=>{s.clearHoloTrace()},R=e=>{s.setInterpolate(e)},Z=async e=>{await s.handleSignalData(e)},K=()=>{s.clearHoloSignal()},G=e=>{r==null||r.toggleTrafficInfo(e),s.toggleTrafficInfo(e)},J=e=>{s.togglePause(e)},U=e=>{r==null||r.toggleTrafficObject(e),s.toggleTrafficObject(e)},W=e=>{s.updatePanelContent(e)},X=async e=>(a||(a=new pe.default(c)),a.addOverlays(e)),Y=e=>a==null?void 0:a.removeOverlaysByType(e),$=e=>a==null?void 0:a.removeOverlaysById(e),ee=()=>a==null?void 0:a.removeAllOverlays(),te=()=>{a==null||a.showAllOverlays()},ae=e=>{u||(u=new fe.default(c)),u.updateQueueLength(e)},ne=()=>{u==null||u.removeQueueLength()},oe=async(e,l)=>(t||(t=new C.default(c)),await t.showOpenDriveFromServer(e,l)),re=async e=>(t||(t=new C.default(c)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),se=async()=>await(t==null?void 0:t.clearOpenDrive()),ce=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},ie=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},y=k,f=L;return T({mapViewer:b,setLayerVisibility:q,setMapCenter:I,lookAt:_,setMapCamera:A,setMapZoomRange:M,requestCoordinateTransform:x,cancelCoordinateTransform:V,addOverlays:X,showAllOverlays:te,removeOverlaysByType:Y,removeOverlaysById:$,removeAllOverlays:ee,showLaneNumber:N,clearLaneNumber:F,initializeAreaTool:B,calCrossIndicatorArea:E,calRoadIndicatorArea:H,connectCarFlow:j,disconnectCarFlow:z,handleHoloVehicleTraceData:P,clearHoloTrace:Q,handleHoloSignalData:Z,clearHoloSignal:K,setInterpolate:R,toggleTrafficInfo:G,toggleTrafficObject:U,toggleVehicleInfo:W,togglePause:J,updateQueueLength:ae,removeQueueLength:ne,showOpenDriveFromServer:oe,showOpenDriveFromFile:re,clearOpenDrive:se,findSumoInOpenDrive:ce,splitOpenDriveLane:ie}),(e,l)=>(n.openBlock(),n.createElementBlock("div",we,[n.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:m},[n.withDirectives(n.createElementVNode("div",ve,[n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:S}," 开始记录 "),n.createElementVNode("button",{onClick:D},"下载日志")],512),[[n.vShow,p.value]])],512)]))}});exports.default=ye;
|
|
@@ -61,6 +61,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
61
61
|
showOpenDriveFromFile: (params: import("../types").IShowOpenDriveFromFileParams) => Promise<import("../types").IResult>;
|
|
62
62
|
clearOpenDrive: () => Promise<void>;
|
|
63
63
|
findSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
|
|
64
|
+
splitOpenDriveLane: (params: import("../types").ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
64
65
|
props: any;
|
|
65
66
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
66
67
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import View from '@arcgis/core/views/View';
|
|
2
|
-
import { IFindSumoParams, IResult, IShowOpenDriveFromFileParams } from '../../../types';
|
|
2
|
+
import { IFindSumoParams, IResult, IShowOpenDriveFromFileParams, ISplitOpenDriveLaneParams } from '../../../types';
|
|
3
3
|
export default class OpenDriveRenderer {
|
|
4
4
|
private static instance;
|
|
5
5
|
static getInstance(view: View): OpenDriveRenderer;
|
|
@@ -34,4 +34,5 @@ export default class OpenDriveRenderer {
|
|
|
34
34
|
* @returns
|
|
35
35
|
*/
|
|
36
36
|
private findLane;
|
|
37
|
+
splitLane(params: ISplitOpenDriveLaneParams): Promise<IResult>;
|
|
37
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/Graphic"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/Graphic"),v=require("@arcgis/core/geometry"),F=require("@arcgis/core/geometry/geometryEngineAsync.js"),I=require("@arcgis/core/layers/FeatureLayer"),O=require("@arcgis/core/layers/GraphicsLayer"),G=require("axios"),N=require("pako"),R=require("./wasm-loader.js");function q(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const t in u)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>u[t]})}}return e.default=u,Object.freeze(e)}const P=q(F);class w{constructor(e){this.wasmLoader=R.default.getInstance(),this.view=e,this.laneLayer=new I({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 I({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 O({id:"OpenDriveJunction"}),this.highlightLayer=new O({id:"OpenDriveHighlight"}),this.view.map.addMany([this.laneLayer,this.junctionLayer,this.highlightLayer,this.roadNameLayer])}static getInstance(e){return this.instance||(this.instance=new w(e)),this.instance}async showOpenDriveFromFile(e){var n,h,s;const t=await this.wasmLoader.load(e.file);if(t.status!==0)return t;console.time("渲染用时");const{roads:a,junctions:o}=t.result;return await this.showAllLanes(a,((n=e.options)==null?void 0:n.showJunctionLane)||!1,((h=e.options)==null?void 0:h.showRoadName)||!0),(s=e.options)!=null&&s.showJunctionPolygon&&this.showJunction(o),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const a=`http://${e}/api/openDrive/analyzeXodr`,o=await G.get(a,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let n=o.data.result.json;n.startsWith(window.location.protocol)||(n=`${window.location.protocol}//${e}${n}`);const s=await(await fetch(n)).arrayBuffer(),r=N.inflate(s,{to:"string"}),d=JSON.parse(r);return await this.showAllLanes(d,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,a){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=a,new Promise(n=>{let h=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];for(const r of e){if(!t&&r.junction!=="-1")continue;const{id:d,refLine:l}=r;let i=r.name;i.includes("(")&&(i=i.slice(0,i.indexOf("("))),i=i.replace(/(.)/g,"$1 ");const c=new m({geometry:{type:"polyline",paths:[l]},attributes:{ObjectID:h++,roadId:d,roadName:i}});this.allRefLineGraphics.push(c);for(const p of r.laneSections){const b=Number(p.id);for(const y of p.lanePaths){const f=Number(y.id);if(f===0)continue;const D=y.type,g=y.innerPath.concat(y.outerPath.reverse());if(g.length<=3){console.warn(`lane ${f} has less than 3 points`);continue}g.push(y.innerPath[0]);const L=new v.Polygon({rings:[g]});if(L){const j=new m({geometry:L,attributes:{ObjectID:h++,id:`${d}+${b}+${f}`,roadId:d,roadName:r.name,sectionId:b,laneId:f,type:D,sumoId:""}});this.allLaneGraphics.push(j)}}}}this.view.type==="2d"?this.view.goTo(this.allRefLineGraphics):this.view.goTo(this.allRefLineGraphics);const s=setInterval(()=>{if(this.allLaneGraphics.length>0||this.allRefLineGraphics.length>0){if(this.allLaneGraphics.length>0){const r=this.allLaneGraphics.splice(0,100);this.laneLayer.applyEdits({addFeatures:r})}if(this.allRefLineGraphics.length>0){const r=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:r})}}else clearInterval(s),n()},10)})}async showJunction(e){for(const t of e){const a=new v.Polygon({rings:[t.outline]}),o=new m({geometry:a,attributes:{id:t.id,name:t.name},symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}});this.junctionLayer.add(o)}}async clearOpenDrive(){const e=await this.laneLayer.queryFeatures();e.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:e.features}),this.wasmLoader.clear()}async findSumo(e){const{id:t}=e,a=e.flash===void 0?!0:e.flash,o=t.split("+");if(o.length>2)return{status:-1,message:"id格式错误"};const n=o.length===2?Number(o[1]):void 0,h=o[0].split("#");if(h.length>2)return{status:-1,message:"id格式错误"};let s=h[0];s.startsWith("-")&&(s=s.slice(1));const r=h.length===2?Number(h[1]):void 0;return await this.findLane({roadsectId:s,segmentId:r,laneId:n,flash:a})}async findLane(e){let{segmentId:t,laneId:a}=e;const{roadsectId:o}=e,n=this.laneLayer.createQuery();n.returnGeometry=!0,n.outFields=["*"],n.where=`roadId = '${o}'`;const h=await this.laneLayer.queryFeatures(n);if(h.features.length===0)return{status:-1,message:"未找到。请检查路段编号"};let s=h.features;if(t!==void 0){const l=[];if(s.forEach(i=>{const c=Number(i.attributes.sectionId);l.indexOf(c)===-1&&l.push(c)}),l.sort((i,c)=>i-c),t>l.length-1)return{status:-1,message:"未找到。请检查基本段编号"};t=l[t],s=s.filter(i=>Number(i.attributes.sectionId)===t)}if(a!==void 0){const l=[];if(s.forEach(i=>{const c=Number(i.attributes.laneId);l.indexOf(c)===-1&&l.push(c)}),l.sort((i,c)=>i-c),a>l.length-1)return{status:-1,message:"未找到。请检查车道编号"};a=l[a],s=s.filter(i=>Number(i.attributes.laneId)===a)}const r=s.map(l=>l.geometry),d=await P.union(r);if(e.flash){this.highlightLayer.removeAll();const l=new m({geometry:d,symbol:{type:"simple-fill",color:[255,0,0,.5],style:"solid",outline:{color:"red",width:2}}});this.highlightLayer.add(l);let i=0,c=!0;const p=setInterval(()=>{c?(this.highlightLayer.opacity-=.02,this.highlightLayer.opacity<=.1&&(c=!1,i++)):(this.highlightLayer.opacity+=.02,this.highlightLayer.opacity>=1&&(c=!0)),i>5&&(this.highlightLayer.removeAll(),this.highlightLayer.opacity=1,clearInterval(p))},20)}return this.view.type==="2d"?await this.view.goTo(d,{duration:1e3}):await this.view.goTo(d,{duration:1e3}),{status:0,message:"ok"}}async splitLane(e){return{status:0,message:"ok",result:e}}}exports.default=w;
|
|
@@ -12,6 +12,7 @@ export default class Lane {
|
|
|
12
12
|
innerBorder: number[][];
|
|
13
13
|
/** 外侧边线采样点坐标 */
|
|
14
14
|
outerBorder: number[][];
|
|
15
|
+
centerLine: number[][];
|
|
15
16
|
road: Road;
|
|
16
17
|
laneSection: LaneSection;
|
|
17
18
|
predecessor: number;
|
|
@@ -48,6 +49,12 @@ export default class Lane {
|
|
|
48
49
|
* @returns
|
|
49
50
|
*/
|
|
50
51
|
get drivingAngle(): number;
|
|
52
|
+
/**
|
|
53
|
+
* 根据左右边线生成车道中心线
|
|
54
|
+
* @param left
|
|
55
|
+
* @param right
|
|
56
|
+
*/
|
|
57
|
+
private getCenterLineFromBorder;
|
|
51
58
|
/**
|
|
52
59
|
* 获取车道按行车方向的起点、终点,可选择内侧、中间、外侧
|
|
53
60
|
* @param type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../common-utils.js"),s=require("./lane-utils.js");class a{constructor(e,t,i){this.isDirEqualReady=!1,this.road=t,this.laneSection=i,this.id=e.id,this.type=e.type,this.predecessor=e.predecessor,this.successor=e.successor;const o=n.default.getStdVecEntries(e.inner_border,!0);this.innerBorder=n.default.transformLineProjection(o);const r=n.default.getStdVecEntries(e.outer_border,!0);this.outerBorder=n.default.transformLineProjection(r),this.centerLine=this.getCenterLineFromBorder(this.innerBorder,this.outerBorder);const d=this.innerBorder.concat([...this.outerBorder].reverse());d.push(d[0]),this.ring=d}get isDirEqual(){return this.isDirEqualReady||(this._isDirEqual=s.default.isLaneDirEqualDriveDir(this),this.isDirEqualReady=!0),this._isDirEqual}get laneCode(){return`${this.road.id}_${this.laneSection.s0}_${this.id}`}get sampledLane(){return{id:this.id,type:this.type,innerPath:this.innerBorder,outerPath:this.outerBorder}}get outerMostLaneInTheSameDir(){const e=this.laneSection.allLaneIds,t=this.id>0?e[e.length-1]:e[0];return this.laneSection.getLane(t)}get drivingAngle(){if(!this.angle){const e=s.default.getDriveAngle(this);this.angle=e}return this.angle}getCenterLineFromBorder(e,t){const i=[],o=Math.min(e.length,t.length);for(let r=0;r<o;r++)i.push([(e[r][0]+t[r][0])/2,(e[r][1]+t[r][1])/2]);return i}getLaneEndPoints(e="middle"){return s.default.getLaneEndPoints(this,e)}getLink(){return s.default.getPrevAndNext(this)}getStopLine(){const e=this.getLaneEndPoints("inner"),t=this.getLaneEndPoints("outer");return[e[1],t[1]]}}exports.default=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("fast-xml-parser"),h=require("../../stores/appData.js"),f=require("../common-utils.js"),m=require("./junction.js"),p=require("./road.js");class g{constructor(){this.roadList=new Map,this.junctionList=new Map,this.isWasmLoaded=!1,this.appStore=h.useAppDataStore(),this.FsFile="data.xodr"}static getInstance(){return g.instance||(g.instance=new g),g.instance}async load(t){if(!this.isWasmLoaded){const l=window.libOpenDrive;this.ModuleOpenDrive=await l(),this.isWasmLoaded=!0}console.time("加载用时");const s=await(await fetch(t)).text(),n=new L.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(s),o=n.OpenDRIVE.header.geoReference,a=n.OpenDRIVE.header.offset;if(a){const l=Number(a["@_x"])||0,c=Number(a["@_y"])||0;this.appStore.$patch({xOffset:l,yOffset:c,geoReference:o})}const u=new TextEncoder().encode(s);try{this.ModuleOpenDrive.FS_unlink(`./${this.FsFile}`)}catch{}this.ModuleOpenDrive.FS_createDataFile(".",this.FsFile,u,!0,!0);const d={with_lateralProfile:!0,with_laneHeight:!0,with_road_objects:!1,center_map:!1,abs_z_for_for_local_road_obj_outline:!0};return this.ModuleOpenDriveMap=new this.ModuleOpenDrive.OpenDriveMap(`./${this.FsFile}`,d),console.timeEnd("加载用时"),this.getRoadNetwork()}clear(){this.roadList.clear(),this.junctionList.clear();try{this.ModuleOpenDrive.FS_unlink(`./${this.FsFile}`)}catch{}}getRoadNetwork(){console.time("采样用时"),this.roadList.clear(),this.junctionList.clear();try{const t=this.ModuleOpenDrive.get_odr_road_network(this.ModuleOpenDriveMap,.5),e=t.geo_reference;h.useAppDataStore().$patch({geoReference:e}),console.timeEnd("采样用时"),console.time("投影转换用时"),f.default.getStdVecEntries(t.roads,!0).forEach(r=>{const u=new p.default(r);this.roadList.set(u.id,u)}),f.default.getStdVecEntries(t.junctions,!0).forEach(r=>{const u=new m.default(r);this.junctionList.set(r.id,u)}),console.timeEnd("投影转换用时");const o=[];this.roadList.forEach(r=>{const u=r.allLaneSections.map(d=>{const l=d.allLanes.map(c=>({id:c.id,type:c.type,innerPath:c.innerBorder,outerPath:c.outerBorder,centerLine:c.centerLine}));return{id:d.s0,lanePaths:l}});o.push({id:r.id,name:r.name,laneSections:u,junction:r.junction,refLine:r.refLine})});const a=[];return this.junctionList.forEach(r=>{const u=r.getJunctionOutline();a.push({id:r.id,name:r.name,outline:u})}),{status:0,message:"ok",result:{roads:o,junctions:a}}}catch{return{status:-1,message:"解析路网失败"}}}get allSampledRoads(){return[...this.roadList.values()].map(t=>t.sampledRoad)}get roadNetwork(){return[...this.roadList.values()].map(e=>{const s=e.allLaneSections.map(i=>{const n=i.allLaneIds.filter(o=>o!==0);return{sectionId:i.s0,laneIds:n}});return{roadName:e.name,roadId:e.id,roadLength:e.length,sections:s}})}getLane(t){const e=this.roadList.get(t.roadId),s=e==null?void 0:e.getLaneSection(t.sectionId);return s==null?void 0:s.getLane(t.laneId)}getFunctionFromIncomingToOutgoing(t,e){const s=this.getLane(t),i=this.getLane(e);if(!s||!i||!s.drivingAngle||!i.drivingAngle)return{status:-1,message:"车道信息错误"};let n=i.drivingAngle-s.drivingAngle;n>180?n-=360:n<-180&&(n+=360);let o="";return-45<n&&n<45?o="s":45<=n&&n<=135?o="r":-135<=n&&n<=-45?o="l":o="t",{status:0,result:o,message:"ok"}}getJunctionOutline(t){const e=[];if(t!==""){const s=this.junctionList.get(t);if(s){const i=s.getJunctionOutline();e.push({junctionId:t,name:s.name,outline:i})}}else for(const s of this.junctionList){const i=s[0],n=s[1],o=n.getJunctionOutline();o.length<=4?console.log(o,i):e.push({junctionId:i,name:n.name,outline:o})}return{status:0,result:e,message:"ok"}}getLaneLink(t){const e=this.getLane(t);return e?{status:0,result:e.getLink(),message:"ok"}:{status:-1,message:"车道信息错误"}}getRoadLink(t){const e=[];if(t!==""){const s=this.roadList.get(t);s&&e.push({roadId:t,successor:s.successor,predecessor:s.predecessor})}else[...this.roadList.values()].forEach(i=>{e.push({roadId:t,successor:i.successor,predecessor:i.predecessor})});return{status:0,result:e,message:"ok"}}getConnectionLink(t){const e=[];for(const s of this.junctionList){const i=s[0],n=s[1];if((t===""||i===t)&&(e.push({id:i,name:n.name,links:n.laneLinks}),t!==""))break}return{status:0,result:e,message:"ok"}}getLaneAngle(t){const e=this.getLane(t);if(e){const s=e.drivingAngle;if(s)return{status:0,result:s,message:"ok"}}return{status:-1,message:"车道信息错误"}}getTurnArrow(t){const e=this.getLane(t.incoming);if(!e)return{status:-1,message:"进口道信息错误"};const s=e.drivingAngle;if(!s)return{status:-1,message:"进口道信息错误"};const i=this.getLane(t.outgoing);if(!i)return{status:-1,message:"出口道信息错误"};const n=i.drivingAngle;if(!n)return{status:-1,message:"出口道信息错误"};let o=n-s;o>180?o-=360:o<-180&&(o+=360);let a="";return-45<o&&o<45?a="s":45<=o&&o<=135?a="r":-135<=o&&o<=-45?a="l":a="t",{status:0,message:"ok",result:{incomingAngle:s,outgoingAngle:n,direction:a}}}getPolygon(t,e,s){const i=this.roadList.get(t);if(!i)return{status:-1,message:"道路id错误"};if(e!==void 0&&s!==void 0&&!isNaN(e)&&!isNaN(s)){const n=this.getLane({roadId:t,sectionId:e,laneId:s});return n?{status:0,message:"ok",result:n.ring}:{status:-1,message:"车道信息错误"}}else if(e!==void 0&&!isNaN(e)){const n=i.getLaneSection(e);return n?{status:0,message:"ok",result:n.polygon}:{status:-1,message:"路段信息错误"}}else return{status:0,message:"ok",result:i.polygon}}getLaneLength(t){const e=this.getLane(t);if(e){let s=0;return e.road.isLastLaneSection(e.laneSection.s0)?s=e.road.length-e.laneSection.s0:s=e.road.getNextLaneSection(e.laneSection.s0).s0-e.laneSection.s0,{status:0,message:"ok",result:Number(s.toFixed(2))}}else return{status:-1,message:"车道信息错误"}}getRoadStopLine(t){const e=[];for(const s of this.junctionList){const i=s[0],n=s[1];if(i===t){const o=n.getRoadStopLine();e.push({junctionId:i,stopLines:o});break}else if(t===""){const o=n.getRoadStopLine();e.push({junctionId:i,stopLines:o})}}return{status:0,message:"ok",result:e}}getLaneStopLine(t){const e=this.getLane(t);return e?{status:0,message:"ok",result:e.getStopLine()}:{status:-1,message:"车道信息错误"}}getLaneCenterLine(t){const e=this.getLane(t);return e?{status:0,message:"ok",result:e.getLaneEndPoints("middle")}:{status:-1,message:"车道信息错误"}}}exports.default=g;
|
package/lib/src/types/index.d.ts
CHANGED