gisviewer-vue3-arcgis 1.0.114 → 1.0.116
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 -3
- package/es/src/gis-map/gis-map.vue.mjs +93 -92
- package/es/src/gis-map/index.d.ts +4 -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-holo-flow.d.ts +0 -2
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +42 -118
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.d.ts +4 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +200 -108
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.d.ts +3 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +42 -16
- 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 +31 -3
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +274 -44
- 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 +70 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane.mjs +93 -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 +366 -0
- package/es/src/types/index.d.ts +50 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +5 -3
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +4 -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-holo-flow.d.ts +0 -2
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +2 -2
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.d.ts +4 -0
- 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.d.ts +3 -0
- 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 +31 -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 +70 -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 +50 -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, 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,10 @@ 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>;
|
|
72
74
|
props: any;
|
|
73
75
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
74
76
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1,104 +1,103 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import C, { registerStore as
|
|
1
|
+
import { defineComponent as pe, ref as h, onMounted as ue, getCurrentInstance as fe, computed as ge, openBlock as de, createElementBlock as we, createElementVNode as p, withDirectives as ve, vShow as ye } from "vue";
|
|
2
|
+
import C, { registerStore as he } 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
|
-
const
|
|
4
|
+
import Ce from "./utils/holo-flow/index.mjs";
|
|
5
|
+
import ke from "./utils/map-initializer.mjs";
|
|
6
|
+
import k from "./utils/open-drive-renderer/index.mjs";
|
|
7
|
+
import Oe from "./utils/overlay.mjs";
|
|
8
|
+
import Te from "./utils/queue-length.mjs";
|
|
9
|
+
import O from "./utils/road-config-tool/index.mjs";
|
|
10
|
+
import Le from "./utils/traffic-flow.mjs";
|
|
11
|
+
const Se = { class: "gis-viewer" }, be = { style: { position: "absolute", bottom: "10px", left: "10px" } }, Re = /* @__PURE__ */ pe({
|
|
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: S }) {
|
|
19
19
|
const u = h(null);
|
|
20
|
-
let
|
|
21
|
-
const
|
|
22
|
-
|
|
20
|
+
let s, c, a, n, r, t, l, o;
|
|
21
|
+
const f = h(!1);
|
|
22
|
+
he(), ue(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 =
|
|
29
|
-
y.assetsRoot = v.assetsRoot ||
|
|
30
|
-
const
|
|
31
|
-
|
|
28
|
+
const e = fe(), { $gisviewerAssetsRoot: i } = e.appContext.config.globalProperties, y = await (await fetch(v.config)).json();
|
|
29
|
+
y.assetsRoot = v.assetsRoot || i;
|
|
30
|
+
const le = C.useAppDataStore;
|
|
31
|
+
le.mapConfig = y, c = new ke(), s = await c.initialize({
|
|
32
32
|
container: u.value,
|
|
33
|
-
markerClickCallback: (
|
|
34
|
-
|
|
33
|
+
markerClickCallback: (m, d, w, me) => {
|
|
34
|
+
g("markerClick", m, d, w, me);
|
|
35
35
|
},
|
|
36
|
-
mapClickCallback: (
|
|
37
|
-
|
|
36
|
+
mapClickCallback: (m, d, w) => {
|
|
37
|
+
g("mapClick", m, d, w);
|
|
38
38
|
}
|
|
39
|
-
}),
|
|
39
|
+
}), r = new Ce(s), await r.init(), g("mapLoaded");
|
|
40
40
|
});
|
|
41
|
-
const b =
|
|
41
|
+
const b = ge(() => s), D = () => {
|
|
42
42
|
const e = C.useAppDataStore;
|
|
43
43
|
e.saveTrackLog = !0;
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
}, A = async (e) => await
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
}, z = async (e) => (
|
|
53
|
-
}, j = async (e,
|
|
54
|
-
|
|
44
|
+
}, I = () => {
|
|
45
|
+
r.downloadTrackLog();
|
|
46
|
+
}, A = async (e) => await c.setMapCenter(e), _ = async (e) => await c.setMapCamera(e), x = async (e) => await c.lookAt(e), M = (e) => c.setLayerVisibility(e), F = (e, i) => c.requestCoordinateTransform(e, i), V = (e) => {
|
|
47
|
+
c.cancelCoordinateTransform(e);
|
|
48
|
+
}, B = (e) => {
|
|
49
|
+
c.setMapZoomRange(e);
|
|
50
|
+
}, H = (e) => (a || (a = new O(s)), a.showLaneNumber(e)), R = () => {
|
|
51
|
+
a == null || a.clearLaneNumber();
|
|
52
|
+
}, z = async (e) => (a || (a = new O(s)), await a.initializeSearch(e)), N = async () => a == null ? void 0 : a.calCrossIndicatorArea(), Q = async () => {
|
|
53
|
+
}, j = async (e, i) => {
|
|
54
|
+
n || (n = new Le(s)), n.connectTrafficFlow(e, i);
|
|
55
55
|
}, P = () => {
|
|
56
|
-
|
|
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 =
|
|
72
|
+
n == null || n.toggleTrafficObject(e), r.toggleTrafficObject(e);
|
|
73
|
+
}, W = (e) => {
|
|
74
|
+
r.updatePanelContent(e);
|
|
75
|
+
}, X = async (e) => (t || (t = new Oe(s)), t.addOverlays(e)), Y = (e) => t == null ? void 0 : t.removeOverlaysByType(e), ee = (e) => t == null ? void 0 : t.removeOverlaysById(e), te = () => t == null ? void 0 : t.removeAllOverlays(), oe = () => {
|
|
76
76
|
t == null || t.showAllOverlays();
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return O({
|
|
77
|
+
}, ae = (e) => {
|
|
78
|
+
l || (l = new Te(s)), l.updateQueueLength(e);
|
|
79
|
+
}, ne = () => {
|
|
80
|
+
l == null || l.removeQueueLength();
|
|
81
|
+
}, re = async (e, i) => (o || (o = new k(s)), await o.showOpenDriveFromServer(e, i)), se = async (e) => (o || (o = new k(s)), await o.showOpenDriveFromFile(e)), ce = async () => await (o == null ? void 0 : o.clearOpenDrive()), ie = async (e) => o ? await (o == null ? void 0 : o.findSumo(e)) : {
|
|
82
|
+
status: -1,
|
|
83
|
+
message: "未加载OpenDrive地图"
|
|
84
|
+
}, v = T, g = S;
|
|
85
|
+
return L({
|
|
87
86
|
mapViewer: b,
|
|
88
|
-
setLayerVisibility:
|
|
87
|
+
setLayerVisibility: M,
|
|
89
88
|
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:
|
|
89
|
+
lookAt: x,
|
|
90
|
+
setMapCamera: _,
|
|
91
|
+
setMapZoomRange: B,
|
|
92
|
+
requestCoordinateTransform: F,
|
|
93
|
+
cancelCoordinateTransform: V,
|
|
94
|
+
addOverlays: X,
|
|
95
|
+
showAllOverlays: oe,
|
|
96
|
+
removeOverlaysByType: Y,
|
|
97
|
+
removeOverlaysById: ee,
|
|
98
|
+
removeAllOverlays: te,
|
|
99
|
+
showLaneNumber: H,
|
|
100
|
+
clearLaneNumber: R,
|
|
102
101
|
initializeAreaTool: z,
|
|
103
102
|
calCrossIndicatorArea: N,
|
|
104
103
|
calRoadIndicatorArea: Q,
|
|
@@ -106,36 +105,38 @@ const Oe = { class: "gis-viewer" }, Le = { style: { position: "absolute", bottom
|
|
|
106
105
|
disconnectCarFlow: P,
|
|
107
106
|
handleHoloVehicleTraceData: E,
|
|
108
107
|
clearHoloTrace: Z,
|
|
109
|
-
handleHoloSignalData:
|
|
110
|
-
clearHoloSignal:
|
|
108
|
+
handleHoloSignalData: K,
|
|
109
|
+
clearHoloSignal: $,
|
|
111
110
|
setInterpolate: q,
|
|
112
|
-
toggleTrafficInfo:
|
|
113
|
-
toggleTrafficObject:
|
|
114
|
-
toggleVehicleInfo:
|
|
115
|
-
togglePause:
|
|
116
|
-
updateQueueLength:
|
|
117
|
-
removeQueueLength:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
toggleTrafficInfo: G,
|
|
112
|
+
toggleTrafficObject: U,
|
|
113
|
+
toggleVehicleInfo: W,
|
|
114
|
+
togglePause: J,
|
|
115
|
+
updateQueueLength: ae,
|
|
116
|
+
removeQueueLength: ne,
|
|
117
|
+
showOpenDriveFromServer: re,
|
|
118
|
+
showOpenDriveFromFile: se,
|
|
119
|
+
clearOpenDrive: ce,
|
|
120
|
+
findSumoInOpenDrive: ie
|
|
121
|
+
}), (e, i) => (de(), we("div", Se, [
|
|
122
|
+
p("div", {
|
|
122
123
|
class: "gis-viewer-main",
|
|
123
124
|
ref_key: "mapContainer",
|
|
124
125
|
ref: u
|
|
125
126
|
}, [
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
ve(p("div", be, [
|
|
128
|
+
p("button", {
|
|
128
129
|
style: { "margin-right": "10px" },
|
|
129
|
-
onClick:
|
|
130
|
+
onClick: D
|
|
130
131
|
}, " 开始记录 "),
|
|
131
|
-
|
|
132
|
+
p("button", { onClick: I }, "下载日志")
|
|
132
133
|
], 512), [
|
|
133
|
-
[
|
|
134
|
+
[ye, f.value]
|
|
134
135
|
])
|
|
135
136
|
], 512)
|
|
136
137
|
]));
|
|
137
138
|
}
|
|
138
139
|
});
|
|
139
140
|
export {
|
|
140
|
-
|
|
141
|
+
Re as default
|
|
141
142
|
};
|
|
@@ -57,8 +57,10 @@ 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>;
|
|
62
64
|
props: any;
|
|
63
65
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
64
66
|
}, 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
|
};
|