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.
Files changed (53) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +6 -3
  2. package/es/src/gis-map/gis-map.vue.mjs +100 -95
  3. package/es/src/gis-map/index.d.ts +5 -2
  4. package/es/src/gis-map/stores/appData.d.ts +3 -0
  5. package/es/src/gis-map/stores/appData.mjs +7 -4
  6. package/es/src/gis-map/utils/common-utils.d.ts +12 -0
  7. package/es/src/gis-map/utils/common-utils.mjs +81 -43
  8. package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +3 -3
  9. package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +0 -1
  10. package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +17 -0
  11. package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.mjs +49 -0
  12. package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +32 -3
  13. package/es/src/gis-map/utils/open-drive-renderer/index.mjs +279 -45
  14. package/es/src/gis-map/utils/open-drive-renderer/junction.d.ts +50 -0
  15. package/es/src/gis-map/utils/open-drive-renderer/junction.mjs +151 -0
  16. package/es/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +48 -0
  17. package/es/src/gis-map/utils/open-drive-renderer/lane-section.mjs +82 -0
  18. package/es/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +29 -0
  19. package/es/src/gis-map/utils/open-drive-renderer/lane-utils.mjs +265 -0
  20. package/es/src/gis-map/utils/open-drive-renderer/lane.d.ts +77 -0
  21. package/es/src/gis-map/utils/open-drive-renderer/lane.mjs +110 -0
  22. package/es/src/gis-map/utils/open-drive-renderer/road.d.ts +60 -0
  23. package/es/src/gis-map/utils/open-drive-renderer/road.mjs +113 -0
  24. package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +88 -0
  25. package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.mjs +367 -0
  26. package/es/src/types/index.d.ts +54 -0
  27. package/lib/src/gis-map/gis-map.vue.d.ts +6 -3
  28. package/lib/src/gis-map/gis-map.vue.js +1 -1
  29. package/lib/src/gis-map/index.d.ts +5 -2
  30. package/lib/src/gis-map/stores/appData.d.ts +3 -0
  31. package/lib/src/gis-map/stores/appData.js +1 -1
  32. package/lib/src/gis-map/utils/common-utils.d.ts +12 -0
  33. package/lib/src/gis-map/utils/common-utils.js +1 -1
  34. package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -1
  35. package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -1
  36. package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +17 -0
  37. package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.js +1 -0
  38. package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +32 -3
  39. package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
  40. package/lib/src/gis-map/utils/open-drive-renderer/junction.d.ts +50 -0
  41. package/lib/src/gis-map/utils/open-drive-renderer/junction.js +1 -0
  42. package/lib/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +48 -0
  43. package/lib/src/gis-map/utils/open-drive-renderer/lane-section.js +1 -0
  44. package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +29 -0
  45. package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.js +1 -0
  46. package/lib/src/gis-map/utils/open-drive-renderer/lane.d.ts +77 -0
  47. package/lib/src/gis-map/utils/open-drive-renderer/lane.js +1 -0
  48. package/lib/src/gis-map/utils/open-drive-renderer/road.d.ts +60 -0
  49. package/lib/src/gis-map/utils/open-drive-renderer/road.js +1 -0
  50. package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +88 -0
  51. package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.js +1 -0
  52. package/lib/src/types/index.d.ts +54 -0
  53. 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
- showOpenDrive: (server: string, projectName: string) => Promise<void>;
71
- hideOpenDrive: () => Promise<void>;
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 ie, ref as h, onMounted as le, getCurrentInstance as pe, computed as me, openBlock as ue, createElementBlock as de, createElementVNode as m, withDirectives as fe, vShow as ge } from "vue";
2
- import C, { registerStore as we } from "./stores/index.mjs";
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 ve from "./utils/holo-flow/index.mjs";
5
- import ye from "./utils/map-initializer.mjs";
6
- import he from "./utils/open-drive-renderer/index.mjs";
7
- import Ce from "./utils/overlay.mjs";
8
- import ke from "./utils/queue-length.mjs";
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 Te from "./utils/traffic-flow.mjs";
11
- const Oe = { class: "gis-viewer" }, Le = { style: { position: "absolute", bottom: "10px", left: "10px" } }, Be = /* @__PURE__ */ ie({
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: O, emit: L }) {
18
+ setup(T, { expose: L, emit: D }) {
19
19
  const u = h(null);
20
- let r, s, o, a, n, t, i, l;
21
- const d = h(!1);
22
- we(), le(async () => {
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", (p) => {
26
- p.ctrlKey && p.key === "i" && (d.value = !d.value);
25
+ document.addEventListener("keydown", (m) => {
26
+ m.ctrlKey && m.key === "i" && (f.value = !f.value);
27
27
  });
28
- const e = pe(), { $gisviewerAssetsRoot: c } = e.appContext.config.globalProperties, y = await (await fetch(v.config)).json();
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 se = C.useAppDataStore;
31
- se.mapConfig = y, s = new ye(), r = await s.initialize({
30
+ const me = C.useAppDataStore;
31
+ me.mapConfig = y, i = new ke(), s = await i.initialize({
32
32
  container: u.value,
33
- markerClickCallback: (p, g, w, ce) => {
34
- f("markerClick", p, g, w, ce);
33
+ markerClickCallback: (m, w, d, pe) => {
34
+ g("markerClick", m, w, d, pe);
35
35
  },
36
- mapClickCallback: (p, g, w) => {
37
- f("mapClick", p, g, w);
36
+ mapClickCallback: (m, w, d) => {
37
+ g("mapClick", m, w, d);
38
38
  }
39
- }), n = new ve(r), await n.init(), f("mapLoaded");
39
+ }), r = new Oe(s), await r.init(), g("mapLoaded");
40
40
  });
41
- const b = me(() => r), I = () => {
41
+ const S = we(() => s), b = () => {
42
42
  const e = C.useAppDataStore;
43
43
  e.saveTrackLog = !0;
44
- }, D = () => {
45
- n.downloadTrackLog();
46
- }, A = async (e) => await s.setMapCenter(e), S = async (e) => await s.setMapCamera(e), _ = async (e) => await s.lookAt(e), x = (e) => s.setLayerVisibility(e), M = (e, c) => s.requestCoordinateTransform(e, c), R = (e) => {
47
- s.cancelCoordinateTransform(e);
48
- }, V = (e) => {
49
- s.setMapZoomRange(e);
50
- }, B = (e) => (o || (o = new k(r)), o.showLaneNumber(e)), H = () => {
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
- }, z = async (e) => (o || (o = new k(r)), await o.initializeSearch(e)), N = async () => o == null ? void 0 : o.calCrossIndicatorArea(), Q = async () => {
53
- }, j = async (e, c) => {
54
- a || (a = new Te(r)), a.connectTrafficFlow(e, c);
55
- }, P = () => {
56
- a == null || a.disconnectTrafficFlow();
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
- n.handleVehicleTraceData(e);
58
+ r.handleVehicleTraceData(e);
59
59
  }, Z = () => {
60
- n.clearHoloTrace();
60
+ r.clearHoloTrace();
61
61
  }, q = (e) => {
62
- n.setInterpolate(e);
63
- }, F = async (e) => {
64
- await n.handleSignalData(e);
65
- }, K = () => {
66
- n.clearHoloSignal();
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.togglePause(e);
68
+ n == null || n.toggleTrafficInfo(e), r.toggleTrafficInfo(e);
71
69
  }, J = (e) => {
72
- a == null || a.toggleTrafficObject(e), n.toggleTrafficObject(e);
70
+ r.togglePause(e);
73
71
  }, U = (e) => {
74
- n.updatePanelContent(e);
75
- }, W = async (e) => (t || (t = new Ce(r)), t.addOverlays(e)), X = (e) => t == null ? void 0 : t.removeOverlaysByType(e), Y = (e) => t == null ? void 0 : t.removeOverlaysById(e), ee = () => t == null ? void 0 : t.removeAllOverlays(), te = () => {
76
- t == null || t.showAllOverlays();
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
- i || (i = new ke(r)), i.updateQueueLength(e);
79
- }, ae = () => {
80
- i == null || i.removeQueueLength();
81
- }, ne = async (e, c) => {
82
- l || (l = new he(r)), await l.showOpenDrive(e, c);
83
- }, re = async () => {
84
- await (l == null ? void 0 : l.hideOpenDrive());
85
- }, v = T, f = L;
86
- return O({
87
- mapViewer: b,
88
- setLayerVisibility: x,
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: S,
92
- setMapZoomRange: V,
93
- requestCoordinateTransform: M,
94
- cancelCoordinateTransform: R,
95
- addOverlays: W,
96
- showAllOverlays: te,
97
- removeOverlaysByType: X,
98
- removeOverlaysById: Y,
99
- removeAllOverlays: ee,
100
- showLaneNumber: B,
101
- clearLaneNumber: H,
102
- initializeAreaTool: z,
103
- calCrossIndicatorArea: N,
104
- calRoadIndicatorArea: Q,
105
- connectCarFlow: j,
106
- disconnectCarFlow: P,
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: F,
110
- clearHoloSignal: K,
111
+ handleHoloSignalData: K,
112
+ clearHoloSignal: $,
111
113
  setInterpolate: q,
112
- toggleTrafficInfo: $,
113
- toggleTrafficObject: J,
114
- toggleVehicleInfo: U,
115
- togglePause: G,
114
+ toggleTrafficInfo: G,
115
+ toggleTrafficObject: U,
116
+ toggleVehicleInfo: W,
117
+ togglePause: J,
116
118
  updateQueueLength: oe,
117
- removeQueueLength: ae,
118
- showOpenDrive: ne,
119
- hideOpenDrive: re
120
- }), (e, c) => (ue(), de("div", Oe, [
121
- m("div", {
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
- fe(m("div", Le, [
127
- m("button", {
131
+ ye(p("div", be, [
132
+ p("button", {
128
133
  style: { "margin-right": "10px" },
129
- onClick: I
134
+ onClick: b
130
135
  }, " 开始记录 "),
131
- m("button", { onClick: D }, "下载日志")
136
+ p("button", { onClick: I }, "下载日志")
132
137
  ], 512), [
133
- [ge, d.value]
138
+ [he, f.value]
134
139
  ])
135
140
  ], 512)
136
141
  ]));
137
142
  }
138
143
  });
139
144
  export {
140
- Be as default
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
- showOpenDrive: (server: string, projectName: string) => Promise<void>;
61
- hideOpenDrive: () => Promise<void>;
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,4 +1,7 @@
1
1
  export declare const useAppDataStore: import("pinia").StoreDefinition<"appData", {
2
2
  mapConfig: {};
3
3
  saveTrackLog: boolean;
4
+ geoReference: string;
5
+ xOffset: number;
6
+ yOffset: number;
4
7
  }, {}, {}>;
@@ -1,10 +1,13 @@
1
- import { defineStore as a } from "pinia";
2
- const t = a("appData", {
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
- t as useAppDataStore
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 y, Polyline as f } from "@arcgis/core/geometry";
2
- import * as g from "@arcgis/core/geometry/geometryEngineAsync";
3
- import * as u from "@arcgis/core/geometry/support/webMercatorUtils";
4
- import h from "@turf/bearing";
5
- import p from "@turf/destination";
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 w from "pako";
8
- class s {
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 i = a.point([t.x, t.y]), o = p(i, n, e, {
19
+ const r = a.point([t.x, t.y]), s = g(r, n, e, {
18
20
  units: "meters"
19
21
  });
20
- return new y({
21
- x: o.geometry.coordinates[0],
22
- y: o.geometry.coordinates[1]
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]), i = a.point(e[e.length - 1]);
32
- return h(n, i);
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], i = a.point(n[0]), o = a.point(n[1]), r = h(o, i), c = p(i, e, r, {
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
- }), l = r > 0 ? r - 180 : r + 180, P = p(o, e, l, {
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, P.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 g.intersectLinesToPoints(
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 i = await s.getIntersectPointOfLineAndPolygon(
75
+ let r = await i.getIntersectPointOfLineAndPolygon(
74
76
  t,
75
77
  e
76
78
  );
77
- if (await s.pointDistance(i) < 3 && n) {
78
- for (const o of n)
79
- if (i = await s.getIntersectPointOfLineAndPolygon(
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
- o
83
- ), await s.pointDistance(i) > 2.5) {
84
- const r = new f({ paths: [i] });
85
- return (await s.getOffsetLine(
86
- r,
87
- -o
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 i;
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 g.geodesicLength(e, "meters");
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 s.getOffsetLine(t, n));
114
- const i = await g.intersect(t, e);
115
- if (i instanceof f) {
116
- const o = i.paths[0], r = o[0], c = o[o.length - 1];
117
- return [r, c];
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 = u.geographicToWebMercator(t), i = await g.offset(
130
+ const n = l.geographicToWebMercator(t), r = await p.offset(
129
131
  n,
130
132
  e,
131
133
  "meters"
132
134
  );
133
- return u.webMercatorToGeographic(
134
- i,
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 o = 0; o < n.length; o++) {
147
- const r = n[o];
148
- e.push(r.charCodeAt(0));
148
+ for (let s = 0; s < n.length; s++) {
149
+ const o = n[s];
150
+ e.push(o.charCodeAt(0));
149
151
  }
150
- const i = new Uint8Array(e);
151
- return w.inflate(i, { to: "string" });
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
- s as default
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, timestamp: n } = s, o = Number(s.x), d = Number(s.y);
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.segmentStartTime = Date.now(), t.segmentTotalTime = e[1].time - e[0].time - // 补偿损耗时间
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;
@@ -37,7 +37,6 @@ class f {
37
37
  return this.logTable;
38
38
  }
39
39
  async init() {
40
- console.log("init");
41
40
  }
42
41
  addVehicles(i) {
43
42
  return new Promise((e) => {
@@ -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
+ };