gisviewer-vue3-arcgis 1.0.115 → 1.0.117
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 +6 -3
- package/es/src/gis-map/gis-map.vue.mjs +100 -95
- package/es/src/gis-map/index.d.ts +5 -2
- package/es/src/gis-map/stores/appData.d.ts +3 -0
- package/es/src/gis-map/stores/appData.mjs +7 -4
- package/es/src/gis-map/utils/common-utils.d.ts +12 -0
- package/es/src/gis-map/utils/common-utils.mjs +81 -43
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +3 -3
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +0 -1
- package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +17 -0
- package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.mjs +49 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +32 -3
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +279 -45
- package/es/src/gis-map/utils/open-drive-renderer/junction.d.ts +50 -0
- package/es/src/gis-map/utils/open-drive-renderer/junction.mjs +151 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +48 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane-section.mjs +82 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +29 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane-utils.mjs +265 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane.d.ts +77 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane.mjs +110 -0
- package/es/src/gis-map/utils/open-drive-renderer/road.d.ts +60 -0
- package/es/src/gis-map/utils/open-drive-renderer/road.mjs +113 -0
- package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +88 -0
- package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.mjs +367 -0
- package/es/src/types/index.d.ts +54 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +6 -3
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +5 -2
- package/lib/src/gis-map/stores/appData.d.ts +3 -0
- package/lib/src/gis-map/stores/appData.js +1 -1
- package/lib/src/gis-map/utils/common-utils.d.ts +12 -0
- package/lib/src/gis-map/utils/common-utils.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +17 -0
- package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +32 -3
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/junction.d.ts +50 -0
- package/lib/src/gis-map/utils/open-drive-renderer/junction.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +48 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane-section.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +29 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane.d.ts +77 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/road.d.ts +60 -0
- package/lib/src/gis-map/utils/open-drive-renderer/road.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +88 -0
- package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.js +1 -0
- package/lib/src/types/index.d.ts +54 -0
- package/package.json +4 -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 { ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, 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';
|
|
@@ -67,8 +67,11 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
67
67
|
showAllOverlays: () => void;
|
|
68
68
|
updateQueueLength: (params: IQueueLengthParams[]) => void;
|
|
69
69
|
removeQueueLength: () => void;
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
showOpenDriveFromServer: (server: string, projectName: string) => Promise<import("../types").IResult>;
|
|
71
|
+
showOpenDriveFromFile: (params: IShowOpenDriveFromFileParams) => Promise<import("../types").IResult>;
|
|
72
|
+
clearOpenDrive: () => Promise<void>;
|
|
73
|
+
findSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
|
|
74
|
+
splitOpenDriveLane: (params: ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
72
75
|
props: any;
|
|
73
76
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
74
77
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1,141 +1,146 @@
|
|
|
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
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
4
|
+
import Oe from "./utils/holo-flow/index.mjs";
|
|
5
|
+
import ke from "./utils/map-initializer.mjs";
|
|
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
9
|
import k from "./utils/road-config-tool/index.mjs";
|
|
10
|
-
import
|
|
11
|
-
const
|
|
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:
|
|
18
|
+
setup(T, { expose: L, emit: D }) {
|
|
19
19
|
const u = h(null);
|
|
20
|
-
let
|
|
21
|
-
const
|
|
22
|
-
|
|
20
|
+
let s, i, o, n, r, a, l, t;
|
|
21
|
+
const f = h(!1);
|
|
22
|
+
Ce(), fe(async () => {
|
|
23
23
|
if (!u.value)
|
|
24
24
|
return;
|
|
25
|
-
document.addEventListener("keydown", (
|
|
26
|
-
|
|
25
|
+
document.addEventListener("keydown", (m) => {
|
|
26
|
+
m.ctrlKey && m.key === "i" && (f.value = !f.value);
|
|
27
27
|
});
|
|
28
|
-
const e =
|
|
28
|
+
const e = ge(), { $gisviewerAssetsRoot: c } = e.appContext.config.globalProperties, y = await (await fetch(v.config)).json();
|
|
29
29
|
y.assetsRoot = v.assetsRoot || c;
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const me = C.useAppDataStore;
|
|
31
|
+
me.mapConfig = y, i = new ke(), s = await i.initialize({
|
|
32
32
|
container: u.value,
|
|
33
|
-
markerClickCallback: (
|
|
34
|
-
|
|
33
|
+
markerClickCallback: (m, w, d, pe) => {
|
|
34
|
+
g("markerClick", m, w, d, pe);
|
|
35
35
|
},
|
|
36
|
-
mapClickCallback: (
|
|
37
|
-
|
|
36
|
+
mapClickCallback: (m, w, d) => {
|
|
37
|
+
g("mapClick", m, w, d);
|
|
38
38
|
}
|
|
39
|
-
}),
|
|
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
|
-
},
|
|
45
|
-
|
|
46
|
-
}, A = async (e) => await
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
44
|
+
}, I = () => {
|
|
45
|
+
r.downloadTrackLog();
|
|
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
|
+
}, B = (e) => {
|
|
49
|
+
i.setMapZoomRange(e);
|
|
50
|
+
}, H = (e) => (o || (o = new k(s)), o.showLaneNumber(e)), z = () => {
|
|
51
51
|
o == null || o.clearLaneNumber();
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
|
|
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
|
+
n == null || n.disconnectTrafficFlow();
|
|
57
57
|
}, E = (e) => {
|
|
58
|
-
|
|
58
|
+
r.handleVehicleTraceData(e);
|
|
59
59
|
}, Z = () => {
|
|
60
|
-
|
|
60
|
+
r.clearHoloTrace();
|
|
61
61
|
}, q = (e) => {
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
await
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
}, $ = (e) => {
|
|
68
|
-
a == null || a.toggleTrafficInfo(e), n.toggleTrafficInfo(e);
|
|
62
|
+
r.setInterpolate(e);
|
|
63
|
+
}, K = async (e) => {
|
|
64
|
+
await r.handleSignalData(e);
|
|
65
|
+
}, $ = () => {
|
|
66
|
+
r.clearHoloSignal();
|
|
69
67
|
}, G = (e) => {
|
|
70
|
-
n.
|
|
68
|
+
n == null || n.toggleTrafficInfo(e), r.toggleTrafficInfo(e);
|
|
71
69
|
}, J = (e) => {
|
|
72
|
-
|
|
70
|
+
r.togglePause(e);
|
|
73
71
|
}, U = (e) => {
|
|
74
|
-
n.
|
|
75
|
-
}, W =
|
|
76
|
-
|
|
72
|
+
n == null || n.toggleTrafficObject(e), r.toggleTrafficObject(e);
|
|
73
|
+
}, W = (e) => {
|
|
74
|
+
r.updatePanelContent(e);
|
|
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
77
|
}, oe = (e) => {
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
l || (l = new Le(s)), l.updateQueueLength(e);
|
|
79
|
+
}, ne = () => {
|
|
80
|
+
l == null || l.removeQueueLength();
|
|
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
|
+
status: -1,
|
|
83
|
+
message: "未加载OpenDrive地图"
|
|
84
|
+
}, le = async (e) => t ? await (t == null ? void 0 : t.splitLane(e)) : {
|
|
85
|
+
status: -1,
|
|
86
|
+
message: "未加载OpenDrive地图"
|
|
87
|
+
}, v = T, g = D;
|
|
88
|
+
return L({
|
|
89
|
+
mapViewer: S,
|
|
90
|
+
setLayerVisibility: M,
|
|
89
91
|
setMapCenter: A,
|
|
90
|
-
lookAt:
|
|
91
|
-
setMapCamera:
|
|
92
|
-
setMapZoomRange:
|
|
93
|
-
requestCoordinateTransform:
|
|
94
|
-
cancelCoordinateTransform:
|
|
95
|
-
addOverlays:
|
|
96
|
-
showAllOverlays:
|
|
97
|
-
removeOverlaysByType:
|
|
98
|
-
removeOverlaysById:
|
|
99
|
-
removeAllOverlays:
|
|
100
|
-
showLaneNumber:
|
|
101
|
-
clearLaneNumber:
|
|
102
|
-
initializeAreaTool:
|
|
103
|
-
calCrossIndicatorArea:
|
|
104
|
-
calRoadIndicatorArea:
|
|
105
|
-
connectCarFlow:
|
|
106
|
-
disconnectCarFlow:
|
|
92
|
+
lookAt: x,
|
|
93
|
+
setMapCamera: _,
|
|
94
|
+
setMapZoomRange: B,
|
|
95
|
+
requestCoordinateTransform: F,
|
|
96
|
+
cancelCoordinateTransform: V,
|
|
97
|
+
addOverlays: X,
|
|
98
|
+
showAllOverlays: ae,
|
|
99
|
+
removeOverlaysByType: Y,
|
|
100
|
+
removeOverlaysById: ee,
|
|
101
|
+
removeAllOverlays: te,
|
|
102
|
+
showLaneNumber: H,
|
|
103
|
+
clearLaneNumber: z,
|
|
104
|
+
initializeAreaTool: N,
|
|
105
|
+
calCrossIndicatorArea: Q,
|
|
106
|
+
calRoadIndicatorArea: j,
|
|
107
|
+
connectCarFlow: P,
|
|
108
|
+
disconnectCarFlow: R,
|
|
107
109
|
handleHoloVehicleTraceData: E,
|
|
108
110
|
clearHoloTrace: Z,
|
|
109
|
-
handleHoloSignalData:
|
|
110
|
-
clearHoloSignal:
|
|
111
|
+
handleHoloSignalData: K,
|
|
112
|
+
clearHoloSignal: $,
|
|
111
113
|
setInterpolate: q,
|
|
112
|
-
toggleTrafficInfo:
|
|
113
|
-
toggleTrafficObject:
|
|
114
|
-
toggleVehicleInfo:
|
|
115
|
-
togglePause:
|
|
114
|
+
toggleTrafficInfo: G,
|
|
115
|
+
toggleTrafficObject: U,
|
|
116
|
+
toggleVehicleInfo: W,
|
|
117
|
+
togglePause: J,
|
|
116
118
|
updateQueueLength: oe,
|
|
117
|
-
removeQueueLength:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
removeQueueLength: ne,
|
|
120
|
+
showOpenDriveFromServer: re,
|
|
121
|
+
showOpenDriveFromFile: se,
|
|
122
|
+
clearOpenDrive: ie,
|
|
123
|
+
findSumoInOpenDrive: ce,
|
|
124
|
+
splitOpenDriveLane: le
|
|
125
|
+
}), (e, c) => (de(), ve("div", Se, [
|
|
126
|
+
p("div", {
|
|
122
127
|
class: "gis-viewer-main",
|
|
123
128
|
ref_key: "mapContainer",
|
|
124
129
|
ref: u
|
|
125
130
|
}, [
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
ye(p("div", be, [
|
|
132
|
+
p("button", {
|
|
128
133
|
style: { "margin-right": "10px" },
|
|
129
|
-
onClick:
|
|
134
|
+
onClick: b
|
|
130
135
|
}, " 开始记录 "),
|
|
131
|
-
|
|
136
|
+
p("button", { onClick: I }, "下载日志")
|
|
132
137
|
], 512), [
|
|
133
|
-
[
|
|
138
|
+
[he, f.value]
|
|
134
139
|
])
|
|
135
140
|
], 512)
|
|
136
141
|
]));
|
|
137
142
|
}
|
|
138
143
|
});
|
|
139
144
|
export {
|
|
140
|
-
|
|
145
|
+
Ne as default
|
|
141
146
|
};
|
|
@@ -57,8 +57,11 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
57
57
|
showAllOverlays: () => void;
|
|
58
58
|
updateQueueLength: (params: import("../types").IQueueLengthParams[]) => void;
|
|
59
59
|
removeQueueLength: () => void;
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
showOpenDriveFromServer: (server: string, projectName: string) => Promise<import("../types").IResult>;
|
|
61
|
+
showOpenDriveFromFile: (params: import("../types").IShowOpenDriveFromFileParams) => Promise<import("../types").IResult>;
|
|
62
|
+
clearOpenDrive: () => Promise<void>;
|
|
63
|
+
findSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
|
|
64
|
+
splitOpenDriveLane: (params: import("../types").ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
62
65
|
props: any;
|
|
63
66
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
64
67
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { defineStore as
|
|
2
|
-
const
|
|
1
|
+
import { defineStore as e } from "pinia";
|
|
2
|
+
const a = e("appData", {
|
|
3
3
|
state: () => ({
|
|
4
4
|
mapConfig: {},
|
|
5
|
-
saveTrackLog: !1
|
|
5
|
+
saveTrackLog: !1,
|
|
6
|
+
geoReference: "",
|
|
7
|
+
xOffset: 0,
|
|
8
|
+
yOffset: 0
|
|
6
9
|
})
|
|
7
10
|
});
|
|
8
11
|
export {
|
|
9
|
-
|
|
12
|
+
a as useAppDataStore
|
|
10
13
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Point, Polygon, Polyline } from '@arcgis/core/geometry';
|
|
2
|
+
import * as turf from '@turf/helpers';
|
|
2
3
|
export default class CommonUtils {
|
|
3
4
|
/**
|
|
4
5
|
* 得到某个点在一定方向、距离之外的另一个点
|
|
@@ -62,4 +63,15 @@ export default class CommonUtils {
|
|
|
62
63
|
* @returns
|
|
63
64
|
*/
|
|
64
65
|
static unzip(key: string): string | undefined;
|
|
66
|
+
static getStdVecEntries(std_vec: any, delete_vec?: boolean): any[];
|
|
67
|
+
static getStdMapEntries(std_map: any): any[];
|
|
68
|
+
static getStdMapKeys(std_map: any, delete_map?: boolean): any[];
|
|
69
|
+
/**
|
|
70
|
+
* OpenDrive坐标转换为WGS84坐标
|
|
71
|
+
* @param line
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
static transformLineProjection(line: number[][]): number[][];
|
|
75
|
+
static pointsEqual(point1: number[], point2: number[]): boolean;
|
|
76
|
+
static getExtensionLine(pt1: number[], pt2: number[], distance: number): turf.Position;
|
|
65
77
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Point as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { Point as m, Polyline as f } from "@arcgis/core/geometry";
|
|
2
|
+
import * as p from "@arcgis/core/geometry/geometryEngineAsync";
|
|
3
|
+
import * as l from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
4
|
+
import u from "@turf/bearing";
|
|
5
|
+
import g from "@turf/destination";
|
|
6
6
|
import * as a from "@turf/helpers";
|
|
7
|
-
import
|
|
8
|
-
|
|
7
|
+
import P from "pako";
|
|
8
|
+
import L from "proj4";
|
|
9
|
+
import { useAppDataStore as w } from "../stores/appData.mjs";
|
|
10
|
+
class i {
|
|
9
11
|
/**
|
|
10
12
|
* 得到某个点在一定方向、距离之外的另一个点
|
|
11
13
|
* @param point
|
|
@@ -14,12 +16,12 @@ class s {
|
|
|
14
16
|
* @returns
|
|
15
17
|
*/
|
|
16
18
|
static destinationWithPoint(t, e, n) {
|
|
17
|
-
const
|
|
19
|
+
const r = a.point([t.x, t.y]), s = g(r, n, e, {
|
|
18
20
|
units: "meters"
|
|
19
21
|
});
|
|
20
|
-
return new
|
|
21
|
-
x:
|
|
22
|
-
y:
|
|
22
|
+
return new m({
|
|
23
|
+
x: s.geometry.coordinates[0],
|
|
24
|
+
y: s.geometry.coordinates[1]
|
|
23
25
|
});
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
@@ -28,8 +30,8 @@ class s {
|
|
|
28
30
|
* @returns
|
|
29
31
|
*/
|
|
30
32
|
static angleOfLine(t) {
|
|
31
|
-
const e = t.paths[0], n = a.point(e[0]),
|
|
32
|
-
return
|
|
33
|
+
const e = t.paths[0], n = a.point(e[0]), r = a.point(e[e.length - 1]);
|
|
34
|
+
return u(n, r);
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
37
|
* 在头尾两个方向上延长折线
|
|
@@ -37,14 +39,14 @@ class s {
|
|
|
37
39
|
* @param distance
|
|
38
40
|
*/
|
|
39
41
|
static extendLineInTowDir(t, e) {
|
|
40
|
-
const n = t.paths[0],
|
|
42
|
+
const n = t.paths[0], r = a.point(n[0]), s = a.point(n[1]), o = u(s, r), c = g(r, e, o, {
|
|
41
43
|
units: "meters"
|
|
42
|
-
}),
|
|
44
|
+
}), y = o > 0 ? o - 180 : o + 180, h = g(s, e, y, {
|
|
43
45
|
units: "meters"
|
|
44
46
|
});
|
|
45
47
|
return new f({
|
|
46
48
|
paths: [
|
|
47
|
-
[c.geometry.coordinates,
|
|
49
|
+
[c.geometry.coordinates, h.geometry.coordinates]
|
|
48
50
|
]
|
|
49
51
|
});
|
|
50
52
|
}
|
|
@@ -55,7 +57,7 @@ class s {
|
|
|
55
57
|
* @returns
|
|
56
58
|
*/
|
|
57
59
|
static async getIntersectPointOfTwoLines(t, e) {
|
|
58
|
-
const n = await
|
|
60
|
+
const n = await p.intersectLinesToPoints(
|
|
59
61
|
t,
|
|
60
62
|
e
|
|
61
63
|
);
|
|
@@ -70,25 +72,25 @@ class s {
|
|
|
70
72
|
* @returns
|
|
71
73
|
*/
|
|
72
74
|
static async getIntersectPointsOfStopLineAndLane(t, e, n) {
|
|
73
|
-
let
|
|
75
|
+
let r = await i.getIntersectPointOfLineAndPolygon(
|
|
74
76
|
t,
|
|
75
77
|
e
|
|
76
78
|
);
|
|
77
|
-
if (await
|
|
78
|
-
for (const
|
|
79
|
-
if (
|
|
79
|
+
if (await i.pointDistance(r) < 3 && n) {
|
|
80
|
+
for (const s of n)
|
|
81
|
+
if (r = await i.getIntersectPointOfLineAndPolygon(
|
|
80
82
|
t,
|
|
81
83
|
e,
|
|
82
|
-
|
|
83
|
-
), await
|
|
84
|
-
const
|
|
85
|
-
return (await
|
|
86
|
-
|
|
87
|
-
-
|
|
84
|
+
s
|
|
85
|
+
), await i.pointDistance(r) > 2.5) {
|
|
86
|
+
const o = new f({ paths: [r] });
|
|
87
|
+
return (await i.getOffsetLine(
|
|
88
|
+
o,
|
|
89
|
+
-s
|
|
88
90
|
)).paths[0];
|
|
89
91
|
}
|
|
90
92
|
} else
|
|
91
|
-
return
|
|
93
|
+
return r;
|
|
92
94
|
return [];
|
|
93
95
|
}
|
|
94
96
|
/**
|
|
@@ -100,7 +102,7 @@ class s {
|
|
|
100
102
|
if (t.length < 2)
|
|
101
103
|
return 0;
|
|
102
104
|
const e = new f({ paths: [t] });
|
|
103
|
-
return await
|
|
105
|
+
return await p.geodesicLength(e, "meters");
|
|
104
106
|
}
|
|
105
107
|
/**
|
|
106
108
|
* 线按一定距离平移之后,与面相交的两个端点
|
|
@@ -110,11 +112,11 @@ class s {
|
|
|
110
112
|
* @returns 线面交线的头尾端点
|
|
111
113
|
*/
|
|
112
114
|
static async getIntersectPointOfLineAndPolygon(t, e, n = 0) {
|
|
113
|
-
n !== 0 && (t = await
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
117
|
-
return [
|
|
115
|
+
n !== 0 && (t = await i.getOffsetLine(t, n));
|
|
116
|
+
const r = await p.intersect(t, e);
|
|
117
|
+
if (r instanceof f) {
|
|
118
|
+
const s = r.paths[0], o = s[0], c = s[s.length - 1];
|
|
119
|
+
return [o, c];
|
|
118
120
|
}
|
|
119
121
|
return [];
|
|
120
122
|
}
|
|
@@ -125,13 +127,13 @@ class s {
|
|
|
125
127
|
* @returns 平移后的polyline
|
|
126
128
|
*/
|
|
127
129
|
static async getOffsetLine(t, e) {
|
|
128
|
-
const n =
|
|
130
|
+
const n = l.geographicToWebMercator(t), r = await p.offset(
|
|
129
131
|
n,
|
|
130
132
|
e,
|
|
131
133
|
"meters"
|
|
132
134
|
);
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
+
return l.webMercatorToGeographic(
|
|
136
|
+
r,
|
|
135
137
|
!1
|
|
136
138
|
);
|
|
137
139
|
}
|
|
@@ -143,17 +145,53 @@ class s {
|
|
|
143
145
|
static unzip(t) {
|
|
144
146
|
try {
|
|
145
147
|
const e = [], n = t.split("");
|
|
146
|
-
for (let
|
|
147
|
-
const
|
|
148
|
-
e.push(
|
|
148
|
+
for (let s = 0; s < n.length; s++) {
|
|
149
|
+
const o = n[s];
|
|
150
|
+
e.push(o.charCodeAt(0));
|
|
149
151
|
}
|
|
150
|
-
const
|
|
151
|
-
return
|
|
152
|
+
const r = new Uint8Array(e);
|
|
153
|
+
return P.inflate(r, { to: "string" });
|
|
152
154
|
} catch {
|
|
153
155
|
console.log(`非压缩内容: ${t}`);
|
|
154
156
|
}
|
|
155
157
|
}
|
|
158
|
+
static getStdVecEntries(t, e = !1) {
|
|
159
|
+
const n = new Array(t.size());
|
|
160
|
+
for (let r = 0; r < t.size(); r++)
|
|
161
|
+
n[r] = t.get(r);
|
|
162
|
+
return e && t.delete(), n;
|
|
163
|
+
}
|
|
164
|
+
static getStdMapEntries(t) {
|
|
165
|
+
const e = [];
|
|
166
|
+
for (const n of i.getStdMapKeys(t))
|
|
167
|
+
e.push([n, t.get(n)]);
|
|
168
|
+
return e;
|
|
169
|
+
}
|
|
170
|
+
static getStdMapKeys(t, e = !1) {
|
|
171
|
+
const n = [], r = t.keys();
|
|
172
|
+
for (let s = 0; s < r.size(); s++)
|
|
173
|
+
n.push(r.get(s));
|
|
174
|
+
return r.delete(), e && t.delete(), n;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* OpenDrive坐标转换为WGS84坐标
|
|
178
|
+
* @param line
|
|
179
|
+
* @returns
|
|
180
|
+
*/
|
|
181
|
+
static transformLineProjection(t) {
|
|
182
|
+
const e = w(), n = e.geoReference, r = e.xOffset, s = e.yOffset;
|
|
183
|
+
return t.map(
|
|
184
|
+
(o) => L(n).inverse([o[0] - r, o[1] - s])
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
static pointsEqual(t, e) {
|
|
188
|
+
return Math.abs(t[0] - e[0]) < Number.EPSILON && Math.abs(t[1] - e[1]) < Number.EPSILON;
|
|
189
|
+
}
|
|
190
|
+
static getExtensionLine(t, e, n) {
|
|
191
|
+
const r = a.point(t), s = a.point(e), o = u(r, s);
|
|
192
|
+
return g(s, n, o, { units: "meters" }).geometry.coordinates;
|
|
193
|
+
}
|
|
156
194
|
}
|
|
157
195
|
export {
|
|
158
|
-
|
|
196
|
+
i as default
|
|
159
197
|
};
|
|
@@ -237,7 +237,7 @@ class I {
|
|
|
237
237
|
return;
|
|
238
238
|
const e = [], t = Date.now();
|
|
239
239
|
for (const s of i) {
|
|
240
|
-
const { vehicleId: a,
|
|
240
|
+
const { vehicleId: a, localTimestamp: n } = s, o = Number(s.x), d = Number(s.y);
|
|
241
241
|
let h = Number(s.heading);
|
|
242
242
|
const r = this.vehicleObjectMap.get(a), p = this.historyPositionMap.get(
|
|
243
243
|
a
|
|
@@ -416,9 +416,9 @@ class I {
|
|
|
416
416
|
t.waitForDelete === !0 ? this.deleteVehicle(t) : (t.segmentStartTime = void 0, t.segmentTotalTime = void 0, t.model.visible = !1, t.isMoving = !1, console.log("hide vehicle", i));
|
|
417
417
|
return;
|
|
418
418
|
} else {
|
|
419
|
+
t.segmentStartTime = Date.now();
|
|
419
420
|
const o = a - t.segmentTotalTime;
|
|
420
|
-
return t.
|
|
421
|
-
(o > 0 ? o : 0), (e[1].heading >= 270 && e[0].heading <= 90 || e[1].heading <= 90 && e[0].heading >= 270) && (e[1].heading > e[0].heading ? e[0].heading += 360 : e[1].heading += 360), e[0].pos.concat(e[0].heading);
|
|
421
|
+
return t.segmentTotalTime = e[1].time - e[0].time - o, console.log(t.segmentStartTime, t.segmentTotalTime), (e[1].heading >= 270 && e[0].heading <= 90 || e[1].heading <= 90 && e[0].heading >= 270) && (e[1].heading > e[0].heading ? e[0].heading += 360 : e[1].heading += 360), e[0].pos.concat(e[0].heading);
|
|
422
422
|
}
|
|
423
423
|
else if (e.length >= 2) {
|
|
424
424
|
const o = e[0].pos[0] + (e[1].pos[0] - e[0].pos[0]) * n, d = e[0].pos[1] + (e[1].pos[1] - e[0].pos[1]) * n, h = e[0].heading + (e[1].heading - e[0].heading) * n;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default class DrawBezier {
|
|
2
|
+
private static sampleCount;
|
|
3
|
+
static drawBezierBetweenLane(incoming: number[][], outgoing: number[][]): number[][];
|
|
4
|
+
/**
|
|
5
|
+
* 生成控制点
|
|
6
|
+
* 进口道的延长线和出口道的反向延长线的交点
|
|
7
|
+
*/
|
|
8
|
+
private static getControlPoint;
|
|
9
|
+
/**
|
|
10
|
+
* @desc 二阶贝塞尔
|
|
11
|
+
* @param {number} t 当前百分比
|
|
12
|
+
* @param {Array} p1 起点坐标
|
|
13
|
+
* @param {Array} p2 终点坐标
|
|
14
|
+
* @param {Array} cp 控制点
|
|
15
|
+
*/
|
|
16
|
+
private static twoBezier;
|
|
17
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as m from "@turf/helpers";
|
|
2
|
+
import f from "@turf/line-intersect";
|
|
3
|
+
import p from "../common-utils.mjs";
|
|
4
|
+
class P {
|
|
5
|
+
static drawBezierBetweenLane(t, i) {
|
|
6
|
+
const n = this.getControlPoint(t, i);
|
|
7
|
+
if (n.length === 3) {
|
|
8
|
+
const s = n[0], r = n[1], c = n[2], o = [];
|
|
9
|
+
for (let e = 0; e <= this.sampleCount; e++)
|
|
10
|
+
o.push(this.twoBezier(e / this.sampleCount, s, r, c));
|
|
11
|
+
return o;
|
|
12
|
+
} else
|
|
13
|
+
return n;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 生成控制点
|
|
17
|
+
* 进口道的延长线和出口道的反向延长线的交点
|
|
18
|
+
*/
|
|
19
|
+
static getControlPoint(t, i) {
|
|
20
|
+
const n = t[0], s = t[1], r = p.getExtensionLine(
|
|
21
|
+
n,
|
|
22
|
+
s,
|
|
23
|
+
100
|
|
24
|
+
), c = m.lineString([n, r]), o = i[0], e = i[1], l = p.getExtensionLine(
|
|
25
|
+
e,
|
|
26
|
+
o,
|
|
27
|
+
100
|
|
28
|
+
), u = m.lineString([l, e]), g = f(c, u);
|
|
29
|
+
if (g.features.length === 0)
|
|
30
|
+
return [s, o];
|
|
31
|
+
const a = g.features[0].geometry.coordinates;
|
|
32
|
+
return [s, o, a];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @desc 二阶贝塞尔
|
|
36
|
+
* @param {number} t 当前百分比
|
|
37
|
+
* @param {Array} p1 起点坐标
|
|
38
|
+
* @param {Array} p2 终点坐标
|
|
39
|
+
* @param {Array} cp 控制点
|
|
40
|
+
*/
|
|
41
|
+
static twoBezier(t, i, n, s) {
|
|
42
|
+
const [r, c] = i, [o, e] = s, [l, u] = n, g = (1 - t) * (1 - t) * r + 2 * t * (1 - t) * o + t * t * l, a = (1 - t) * (1 - t) * c + 2 * t * (1 - t) * e + t * t * u;
|
|
43
|
+
return [g, a];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
P.sampleCount = 50;
|
|
47
|
+
export {
|
|
48
|
+
P as default
|
|
49
|
+
};
|