gisviewer-vue3-arcgis 1.0.115 → 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.
Files changed (53) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +5 -3
  2. package/es/src/gis-map/gis-map.vue.mjs +93 -92
  3. package/es/src/gis-map/index.d.ts +4 -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 +31 -3
  13. package/es/src/gis-map/utils/open-drive-renderer/index.mjs +274 -44
  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 +70 -0
  21. package/es/src/gis-map/utils/open-drive-renderer/lane.mjs +93 -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 +366 -0
  26. package/es/src/types/index.d.ts +48 -0
  27. package/lib/src/gis-map/gis-map.vue.d.ts +5 -3
  28. package/lib/src/gis-map/gis-map.vue.js +1 -1
  29. package/lib/src/gis-map/index.d.ts +4 -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 +31 -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 +70 -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 +48 -0
  53. package/package.json +4 -1
@@ -0,0 +1,113 @@
1
+ import a from "../common-utils.mjs";
2
+ import h from "./lane-section.mjs";
3
+ class g {
4
+ constructor(e) {
5
+ this.id = e.id, this.name = e.name, this.length = e.length, this.junction = e.junction, this.sToLaneSection = /* @__PURE__ */ new Map();
6
+ const t = a.getStdVecEntries(e.ref_line, !0);
7
+ this.refLine = a.transformLineProjection(t);
8
+ for (const i of [!0, !1]) {
9
+ const o = i ? e.predecessor : e.successor, r = {
10
+ elementId: o.id,
11
+ elementType: o.type,
12
+ contactPoint: o.contact_point
13
+ };
14
+ i ? this.predecessor = r : this.successor = r;
15
+ }
16
+ a.getStdVecEntries(
17
+ e.odr_lanesections,
18
+ !0
19
+ ).forEach((i) => {
20
+ const o = new h(i, this);
21
+ this.sToLaneSection.set(o.s0, o);
22
+ }), this.borders = this.getBorderLine();
23
+ const n = [];
24
+ n.push(...this.borders.right), n.push(...this.borders.top), n.push(...[...this.borders.left].reverse()), n.push(...[...this.borders.bottom].reverse()), n.push(n[0]), this.polygon = n;
25
+ }
26
+ /**
27
+ * 获取一个路段
28
+ * @param s0
29
+ * @returns
30
+ */
31
+ getLaneSection(e) {
32
+ return this.sToLaneSection.get(e);
33
+ }
34
+ /**
35
+ * 获取第一个路段
36
+ * @returns
37
+ */
38
+ getFirstLaneSection() {
39
+ const e = [...this.sToLaneSection.keys()];
40
+ return e.sort((t, s) => t - s), this.sToLaneSection.get(e[0]);
41
+ }
42
+ /**
43
+ * 获取最后一个路段
44
+ * @returns
45
+ */
46
+ getLastLaneSection() {
47
+ const e = [...this.sToLaneSection.keys()];
48
+ return e.sort((t, s) => t - s), this.sToLaneSection.get(e[e.length - 1]);
49
+ }
50
+ /**
51
+ * 是否是最后一个路段的里程值
52
+ * @param s
53
+ * @returns
54
+ */
55
+ isLastLaneSection(e) {
56
+ const t = [...this.sToLaneSection.keys()];
57
+ return t.sort((s, n) => s - n), e === t[t.length - 1];
58
+ }
59
+ /**
60
+ * 获取下一个路段
61
+ * @param s
62
+ */
63
+ getNextLaneSection(e) {
64
+ const t = [...this.sToLaneSection.keys()], s = t.indexOf(e);
65
+ if (s >= 0 && s < t.length - 1)
66
+ return this.sToLaneSection.get(t[s + 1]);
67
+ }
68
+ /**
69
+ * 获取上一个路段
70
+ * @param s
71
+ * @returns
72
+ */
73
+ getPrevLaneSection(e) {
74
+ const t = [...this.sToLaneSection.keys()], s = t.indexOf(e);
75
+ if (s > 0)
76
+ return this.sToLaneSection.get(t[s - 1]);
77
+ }
78
+ /** 获取所有路段 */
79
+ get allLaneSections() {
80
+ return [...this.sToLaneSection.values()];
81
+ }
82
+ get laneSectionNumber() {
83
+ return this.sToLaneSection.size;
84
+ }
85
+ get sampledRoad() {
86
+ return {
87
+ id: this.id,
88
+ name: this.name,
89
+ junction: this.junction,
90
+ refLine: this.refLine,
91
+ laneSections: this.allLaneSections.map(
92
+ (e) => e.sampledLaneSection
93
+ )
94
+ };
95
+ }
96
+ getBorderLine() {
97
+ const e = [], t = [];
98
+ let s = [], n = [];
99
+ const i = [...this.sToLaneSection.keys()];
100
+ return i.forEach((o, r) => {
101
+ const c = this.getLaneSection(o);
102
+ r === 0 ? n = c.borders.bottom : r === i.length - 1 && (s = c.borders.top), e.push(...c.borders.left), t.push(...c.borders.right);
103
+ }), {
104
+ left: e,
105
+ right: t,
106
+ top: s,
107
+ bottom: n
108
+ };
109
+ }
110
+ }
111
+ export {
112
+ g as default
113
+ };
@@ -0,0 +1,88 @@
1
+ import { ILaneInfo, IResult, ISampledRoad } from '../../../types';
2
+ import Junction from './junction';
3
+ import Lane from './lane';
4
+ import Road from './road';
5
+ export default class WasmLoader {
6
+ private static instance;
7
+ static getInstance(): WasmLoader;
8
+ roadList: Map<string, Road>;
9
+ junctionList: Map<string, Junction>;
10
+ private isWasmLoaded;
11
+ private ModuleOpenDrive;
12
+ private ModuleOpenDriveMap;
13
+ private appStore;
14
+ private FsFile;
15
+ /**
16
+ * 载入指定xodr文件并解析
17
+ * @param filePath
18
+ */
19
+ load(file: string): Promise<IResult>;
20
+ clear(): void;
21
+ /**
22
+ * 解析路网
23
+ */
24
+ private getRoadNetwork;
25
+ /**
26
+ * 获取所有道路的采样结果
27
+ */
28
+ get allSampledRoads(): ISampledRoad[];
29
+ /**
30
+ * 获取路网结构
31
+ */
32
+ get roadNetwork(): {
33
+ roadName: string;
34
+ roadId: string;
35
+ roadLength: number;
36
+ sections: {
37
+ sectionId: number;
38
+ laneIds: number[];
39
+ }[];
40
+ }[];
41
+ /**
42
+ * 从车道信息获取车道对象
43
+ * @param laneInfo
44
+ */
45
+ getLane(laneInfo: ILaneInfo): Lane | undefined;
46
+ /**
47
+ * 获取两个车道之间的车道功能
48
+ * 左转、直行、右转、调头
49
+ * @param incoming
50
+ * @param outgoing
51
+ */
52
+ getFunctionFromIncomingToOutgoing(incoming: ILaneInfo, outgoing: ILaneInfo): IResult;
53
+ /**
54
+ * 获取所有路口的轮廓
55
+ * @returns
56
+ */
57
+ getJunctionOutline(junctionId: string): IResult;
58
+ /**
59
+ * 获取车道的前驱车道和后继车道
60
+ * @param laneInfo
61
+ * @returns
62
+ */
63
+ getLaneLink(laneInfo: ILaneInfo): IResult;
64
+ getRoadLink(roadId: string): IResult;
65
+ getConnectionLink(junctionId: string): IResult;
66
+ getLaneAngle(laneInfo: ILaneInfo): IResult;
67
+ getTurnArrow(params: {
68
+ incoming: ILaneInfo;
69
+ outgoing: ILaneInfo;
70
+ }): IResult;
71
+ /**
72
+ * 道路路段车道的轮廓
73
+ * @param roadId
74
+ * @param sectionId
75
+ * @param laneId
76
+ * @returns
77
+ */
78
+ getPolygon(roadId: string, sectionId?: number, laneId?: number): IResult;
79
+ /**
80
+ * 车道长度
81
+ * @param laneInfo
82
+ * @returns
83
+ */
84
+ getLaneLength(laneInfo: ILaneInfo): IResult;
85
+ getRoadStopLine(junctionId: string): IResult;
86
+ getLaneStopLine(laneInfo: ILaneInfo): IResult;
87
+ getLaneCenterLine(laneInfo: ILaneInfo): IResult;
88
+ }
@@ -0,0 +1,366 @@
1
+ import { XMLParser as m } from "fast-xml-parser";
2
+ import { useAppDataStore as h } from "../../stores/appData.mjs";
3
+ import f from "../common-utils.mjs";
4
+ import p from "./junction.mjs";
5
+ import L from "./road.mjs";
6
+ class g {
7
+ constructor() {
8
+ this.roadList = /* @__PURE__ */ new Map(), this.junctionList = /* @__PURE__ */ new Map(), this.isWasmLoaded = !1, this.appStore = h(), this.FsFile = "data.xodr";
9
+ }
10
+ static getInstance() {
11
+ return g.instance || (g.instance = new g()), g.instance;
12
+ }
13
+ /**
14
+ * 载入指定xodr文件并解析
15
+ * @param filePath
16
+ */
17
+ async load(t) {
18
+ if (!this.isWasmLoaded) {
19
+ const u = window.libOpenDrive;
20
+ this.ModuleOpenDrive = await u(), this.isWasmLoaded = !0;
21
+ }
22
+ console.time("加载用时");
23
+ const s = await (await fetch(t)).text(), n = new m({
24
+ ignoreAttributes: !1,
25
+ allowBooleanAttributes: !0
26
+ }).parse(s), i = n.OpenDRIVE.header.geoReference, a = n.OpenDRIVE.header.offset;
27
+ if (a) {
28
+ const u = Number(a["@_x"]) || 0, l = Number(a["@_y"]) || 0;
29
+ this.appStore.$patch({
30
+ xOffset: u,
31
+ yOffset: l,
32
+ geoReference: i
33
+ });
34
+ }
35
+ const c = new TextEncoder().encode(s);
36
+ try {
37
+ this.ModuleOpenDrive.FS_unlink(`./${this.FsFile}`);
38
+ } catch {
39
+ }
40
+ this.ModuleOpenDrive.FS_createDataFile(
41
+ ".",
42
+ this.FsFile,
43
+ c,
44
+ !0,
45
+ !0
46
+ );
47
+ const d = {
48
+ with_lateralProfile: !0,
49
+ with_laneHeight: !0,
50
+ with_road_objects: !1,
51
+ center_map: !1,
52
+ abs_z_for_for_local_road_obj_outline: !0
53
+ };
54
+ return this.ModuleOpenDriveMap = new this.ModuleOpenDrive.OpenDriveMap(
55
+ `./${this.FsFile}`,
56
+ d
57
+ ), console.timeEnd("加载用时"), this.getRoadNetwork();
58
+ }
59
+ clear() {
60
+ this.roadList.clear(), this.junctionList.clear();
61
+ try {
62
+ this.ModuleOpenDrive.FS_unlink(`./${this.FsFile}`);
63
+ } catch {
64
+ }
65
+ }
66
+ /**
67
+ * 解析路网
68
+ */
69
+ getRoadNetwork() {
70
+ console.time("采样用时"), this.roadList.clear(), this.junctionList.clear();
71
+ try {
72
+ const t = this.ModuleOpenDrive.get_odr_road_network(
73
+ this.ModuleOpenDriveMap,
74
+ 0.5
75
+ ), e = t.geo_reference;
76
+ h().$patch({
77
+ geoReference: e
78
+ }), console.timeEnd("采样用时"), console.time("投影转换用时"), f.getStdVecEntries(t.roads, !0).forEach((r) => {
79
+ const c = new L(r);
80
+ this.roadList.set(c.id, c);
81
+ }), f.getStdVecEntries(
82
+ t.junctions,
83
+ !0
84
+ ).forEach((r) => {
85
+ const c = new p(r);
86
+ this.junctionList.set(r.id, c);
87
+ }), console.timeEnd("投影转换用时");
88
+ const i = [];
89
+ this.roadList.forEach((r) => {
90
+ const c = r.allLaneSections.map((d) => {
91
+ const u = d.allLanes.map((l) => ({
92
+ id: l.id,
93
+ type: l.type,
94
+ innerPath: l.innerBorder,
95
+ outerPath: l.outerBorder
96
+ }));
97
+ return {
98
+ id: d.s0,
99
+ lanePaths: u
100
+ };
101
+ });
102
+ i.push({
103
+ id: r.id,
104
+ name: r.name,
105
+ laneSections: c,
106
+ junction: r.junction,
107
+ refLine: r.refLine
108
+ });
109
+ });
110
+ const a = [];
111
+ return this.junctionList.forEach((r) => {
112
+ const c = r.getJunctionOutline();
113
+ a.push({
114
+ id: r.id,
115
+ name: r.name,
116
+ outline: c
117
+ });
118
+ }), {
119
+ status: 0,
120
+ message: "ok",
121
+ result: { roads: i, junctions: a }
122
+ };
123
+ } catch {
124
+ return { status: -1, message: "解析路网失败" };
125
+ }
126
+ }
127
+ /**
128
+ * 获取所有道路的采样结果
129
+ */
130
+ get allSampledRoads() {
131
+ return [...this.roadList.values()].map((t) => t.sampledRoad);
132
+ }
133
+ /**
134
+ * 获取路网结构
135
+ */
136
+ get roadNetwork() {
137
+ return [...this.roadList.values()].map((e) => {
138
+ const s = e.allLaneSections.map((o) => {
139
+ const n = o.allLaneIds.filter((i) => i !== 0);
140
+ return {
141
+ sectionId: o.s0,
142
+ laneIds: n
143
+ };
144
+ });
145
+ return {
146
+ roadName: e.name,
147
+ roadId: e.id,
148
+ roadLength: e.length,
149
+ sections: s
150
+ };
151
+ });
152
+ }
153
+ /**
154
+ * 从车道信息获取车道对象
155
+ * @param laneInfo
156
+ */
157
+ getLane(t) {
158
+ const e = this.roadList.get(t.roadId), s = e == null ? void 0 : e.getLaneSection(t.sectionId);
159
+ return s == null ? void 0 : s.getLane(t.laneId);
160
+ }
161
+ /**
162
+ * 获取两个车道之间的车道功能
163
+ * 左转、直行、右转、调头
164
+ * @param incoming
165
+ * @param outgoing
166
+ */
167
+ getFunctionFromIncomingToOutgoing(t, e) {
168
+ const s = this.getLane(t), o = this.getLane(e);
169
+ if (!s || !o || !s.drivingAngle || !o.drivingAngle)
170
+ return { status: -1, message: "车道信息错误" };
171
+ let n = o.drivingAngle - s.drivingAngle;
172
+ n > 180 ? n -= 360 : n < -180 && (n += 360);
173
+ let i = "";
174
+ return -45 < n && n < 45 ? i = "s" : 45 <= n && n <= 135 ? i = "r" : -135 <= n && n <= -45 ? i = "l" : i = "t", { status: 0, result: i, message: "ok" };
175
+ }
176
+ /**
177
+ * 获取所有路口的轮廓
178
+ * @returns
179
+ */
180
+ getJunctionOutline(t) {
181
+ const e = [];
182
+ if (t !== "") {
183
+ const s = this.junctionList.get(t);
184
+ if (s) {
185
+ const o = s.getJunctionOutline();
186
+ e.push({
187
+ junctionId: t,
188
+ name: s.name,
189
+ outline: o
190
+ });
191
+ }
192
+ } else
193
+ for (const s of this.junctionList) {
194
+ const o = s[0], n = s[1], i = n.getJunctionOutline();
195
+ i.length <= 4 ? console.log(i, o) : e.push({
196
+ junctionId: o,
197
+ name: n.name,
198
+ outline: i
199
+ });
200
+ }
201
+ return { status: 0, result: e, message: "ok" };
202
+ }
203
+ /**
204
+ * 获取车道的前驱车道和后继车道
205
+ * @param laneInfo
206
+ * @returns
207
+ */
208
+ getLaneLink(t) {
209
+ const e = this.getLane(t);
210
+ return e ? { status: 0, result: e.getLink(), message: "ok" } : { status: -1, message: "车道信息错误" };
211
+ }
212
+ getRoadLink(t) {
213
+ const e = [];
214
+ if (t !== "") {
215
+ const s = this.roadList.get(t);
216
+ s && e.push({
217
+ roadId: t,
218
+ successor: s.successor,
219
+ predecessor: s.predecessor
220
+ });
221
+ } else
222
+ [...this.roadList.values()].forEach((o) => {
223
+ e.push({
224
+ roadId: t,
225
+ successor: o.successor,
226
+ predecessor: o.predecessor
227
+ });
228
+ });
229
+ return { status: 0, result: e, message: "ok" };
230
+ }
231
+ getConnectionLink(t) {
232
+ const e = [];
233
+ for (const s of this.junctionList) {
234
+ const o = s[0], n = s[1];
235
+ if ((t === "" || o === t) && (e.push({
236
+ id: o,
237
+ name: n.name,
238
+ links: n.laneLinks
239
+ }), t !== ""))
240
+ break;
241
+ }
242
+ return { status: 0, result: e, message: "ok" };
243
+ }
244
+ getLaneAngle(t) {
245
+ const e = this.getLane(t);
246
+ if (e) {
247
+ const s = e.drivingAngle;
248
+ if (s)
249
+ return { status: 0, result: s, message: "ok" };
250
+ }
251
+ return { status: -1, message: "车道信息错误" };
252
+ }
253
+ getTurnArrow(t) {
254
+ const e = this.getLane(t.incoming);
255
+ if (!e)
256
+ return { status: -1, message: "进口道信息错误" };
257
+ const s = e.drivingAngle;
258
+ if (!s)
259
+ return { status: -1, message: "进口道信息错误" };
260
+ const o = this.getLane(t.outgoing);
261
+ if (!o)
262
+ return { status: -1, message: "出口道信息错误" };
263
+ const n = o.drivingAngle;
264
+ if (!n)
265
+ return { status: -1, message: "出口道信息错误" };
266
+ let i = n - s;
267
+ i > 180 ? i -= 360 : i < -180 && (i += 360);
268
+ let a = "";
269
+ return -45 < i && i < 45 ? a = "s" : 45 <= i && i <= 135 ? a = "r" : -135 <= i && i <= -45 ? a = "l" : a = "t", {
270
+ status: 0,
271
+ message: "ok",
272
+ result: {
273
+ incomingAngle: s,
274
+ outgoingAngle: n,
275
+ direction: a
276
+ }
277
+ };
278
+ }
279
+ // public async getShpPolygon(laneInfo: ILaneInfo): Promise<IResult> {
280
+ // const lane = this.getLane(laneInfo);
281
+ // const polygon = lane?.getShpPolygon();
282
+ // if (polygon) {
283
+ // return { status: 0, result: polygon };
284
+ // } else {
285
+ // return { status: -1, message: "车道信息错误" };
286
+ // }
287
+ // }
288
+ // public async getLaneArrowPositions(laneInfo: ILaneInfo): Promise<IResult> {
289
+ // const lane = this.getLane(laneInfo);
290
+ // const positions = lane?.getArrowPositions();
291
+ // if (positions) {
292
+ // return { status: 0, result: positions };
293
+ // } else {
294
+ // return { status: -1, message: "车道信息错误" };
295
+ // }
296
+ // }
297
+ /**
298
+ * 道路路段车道的轮廓
299
+ * @param roadId
300
+ * @param sectionId
301
+ * @param laneId
302
+ * @returns
303
+ */
304
+ getPolygon(t, e, s) {
305
+ const o = this.roadList.get(t);
306
+ if (!o)
307
+ return { status: -1, message: "道路id错误" };
308
+ if (e !== void 0 && s !== void 0 && !isNaN(e) && !isNaN(s)) {
309
+ const n = this.getLane({ roadId: t, sectionId: e, laneId: s });
310
+ return n ? { status: 0, message: "ok", result: n.ring } : { status: -1, message: "车道信息错误" };
311
+ } else if (e !== void 0 && !isNaN(e)) {
312
+ const n = o.getLaneSection(e);
313
+ return n ? { status: 0, message: "ok", result: n.polygon } : { status: -1, message: "路段信息错误" };
314
+ } else
315
+ return { status: 0, message: "ok", result: o.polygon };
316
+ }
317
+ /**
318
+ * 车道长度
319
+ * @param laneInfo
320
+ * @returns
321
+ */
322
+ getLaneLength(t) {
323
+ const e = this.getLane(t);
324
+ if (e) {
325
+ let s = 0;
326
+ return e.road.isLastLaneSection(e.laneSection.s0) ? s = e.road.length - e.laneSection.s0 : s = e.road.getNextLaneSection(
327
+ e.laneSection.s0
328
+ ).s0 - e.laneSection.s0, {
329
+ status: 0,
330
+ message: "ok",
331
+ result: Number(s.toFixed(2))
332
+ };
333
+ } else
334
+ return { status: -1, message: "车道信息错误" };
335
+ }
336
+ getRoadStopLine(t) {
337
+ const e = [];
338
+ for (const s of this.junctionList) {
339
+ const o = s[0], n = s[1];
340
+ if (o === t) {
341
+ const i = n.getRoadStopLine();
342
+ e.push({ junctionId: o, stopLines: i });
343
+ break;
344
+ } else if (t === "") {
345
+ const i = n.getRoadStopLine();
346
+ e.push({ junctionId: o, stopLines: i });
347
+ }
348
+ }
349
+ return { status: 0, message: "ok", result: e };
350
+ }
351
+ getLaneStopLine(t) {
352
+ const e = this.getLane(t);
353
+ return e ? { status: 0, message: "ok", result: e.getStopLine() } : { status: -1, message: "车道信息错误" };
354
+ }
355
+ getLaneCenterLine(t) {
356
+ const e = this.getLane(t);
357
+ return e ? {
358
+ status: 0,
359
+ message: "ok",
360
+ result: e.getLaneEndPoints("middle")
361
+ } : { status: -1, message: "车道信息错误" };
362
+ }
363
+ }
364
+ export {
365
+ g as default
366
+ };
@@ -170,3 +170,51 @@ export declare enum EVehiclePlateState {
170
170
  Id = 2,
171
171
  Mix = 3
172
172
  }
173
+ export interface ILaneInfo {
174
+ roadId: string;
175
+ sectionId: number;
176
+ laneId: number;
177
+ }
178
+ /** 采样后的车道 */
179
+ export interface ISampledLane {
180
+ id: number;
181
+ type: string;
182
+ innerPath: number[][];
183
+ outerPath: number[][];
184
+ }
185
+ /** 采样后的路段 */
186
+ export interface ISampledLaneSection {
187
+ id: number;
188
+ lanePaths: ISampledLane[];
189
+ }
190
+ /** 采样后的道路 */
191
+ export interface ISampledRoad {
192
+ id: string;
193
+ name: string;
194
+ junction: string;
195
+ refLine: number[][];
196
+ laneSections: ISampledLaneSection[];
197
+ }
198
+ export interface IRoadLink {
199
+ elementId: string;
200
+ elementType: string;
201
+ contactPoint?: string;
202
+ }
203
+ export interface IRoadStopLinesResult {
204
+ junctionId: string;
205
+ stopLines: {
206
+ roadId: string;
207
+ line: number[][];
208
+ }[];
209
+ }
210
+ export interface IShowOpenDriveFromFileParams {
211
+ file: string;
212
+ options?: {
213
+ showJunctionPolygon: boolean;
214
+ showJunctionLane: boolean;
215
+ showRoadName: boolean;
216
+ };
217
+ }
218
+ export interface IFindSumoParams {
219
+ id: string;
220
+ }
@@ -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
- 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>;
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 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),v=require("./stores/index.js");require("./style/index.css");const ce=require("./utils/holo-flow/index.js"),ie=require("./utils/map-initializer.js"),le=require("./utils/open-drive-renderer/index.js"),ue=require("./utils/overlay.js"),de=require("./utils/queue-length.js"),C=require("./utils/road-config-tool/index.js"),pe=require("./utils/traffic-flow.js"),me={class:"gis-viewer"},fe={style:{position:"absolute",bottom:"10px",left:"10px"}},ge=a.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:T,emit:b}){const p=a.ref(null);let s,c,n,o,r,t,l,u;const m=a.ref(!1);v.registerStore(),a.onMounted(async()=>{if(!p.value)return;document.addEventListener("keydown",d=>{d.ctrlKey&&d.key==="i"&&(m.value=!m.value)});const e=a.getCurrentInstance(),{$gisviewerAssetsRoot:i}=e.appContext.config.globalProperties,h=await(await fetch(y.config)).json();h.assetsRoot=y.assetsRoot||i;const re=v.default.useAppDataStore;re.mapConfig=h,c=new ie.default,s=await c.initialize({container:p.value,markerClickCallback:(d,g,w,se)=>{f("markerClick",d,g,w,se)},mapClickCallback:(d,g,w)=>{f("mapClick",d,g,w)}}),r=new ce.default(s),await r.init(),f("mapLoaded")});const L=a.computed(()=>s),O=()=>{const e=v.default.useAppDataStore;e.saveTrackLog=!0},I=()=>{r.downloadTrackLog()},S=async e=>await c.setMapCenter(e),A=async e=>await c.setMapCamera(e),D=async e=>await c.lookAt(e),_=e=>c.setLayerVisibility(e),q=(e,i)=>c.requestCoordinateTransform(e,i),x=e=>{c.cancelCoordinateTransform(e)},V=e=>{c.setMapZoomRange(e)},M=e=>(n||(n=new C.default(s)),n.showLaneNumber(e)),N=()=>{n==null||n.clearLaneNumber()},B=async e=>(n||(n=new C.default(s)),await n.initializeSearch(e)),E=async()=>n==null?void 0:n.calCrossIndicatorArea(),H=async()=>{},R=async(e,i)=>{o||(o=new pe.default(s)),o.connectTrafficFlow(e,i)},j=()=>{o==null||o.disconnectTrafficFlow()},z=e=>{r.handleVehicleTraceData(e)},P=()=>{r.clearHoloTrace()},Q=e=>{r.setInterpolate(e)},Z=async e=>{await r.handleSignalData(e)},F=()=>{r.clearHoloSignal()},K=e=>{o==null||o.toggleTrafficInfo(e),r.toggleTrafficInfo(e)},G=e=>{r.togglePause(e)},J=e=>{o==null||o.toggleTrafficObject(e),r.toggleTrafficObject(e)},U=e=>{r.updatePanelContent(e)},W=async e=>(t||(t=new ue.default(s)),t.addOverlays(e)),X=e=>t==null?void 0:t.removeOverlaysByType(e),Y=e=>t==null?void 0:t.removeOverlaysById(e),$=()=>t==null?void 0:t.removeAllOverlays(),ee=()=>{t==null||t.showAllOverlays()},te=e=>{l||(l=new de.default(s)),l.updateQueueLength(e)},ae=()=>{l==null||l.removeQueueLength()},ne=async(e,i)=>{u||(u=new le.default(s)),await u.showOpenDrive(e,i)},oe=async()=>{await(u==null?void 0:u.hideOpenDrive())},y=k,f=b;return T({mapViewer:L,setLayerVisibility:_,setMapCenter:S,lookAt:D,setMapCamera:A,setMapZoomRange:V,requestCoordinateTransform:q,cancelCoordinateTransform:x,addOverlays:W,showAllOverlays:ee,removeOverlaysByType:X,removeOverlaysById:Y,removeAllOverlays:$,showLaneNumber:M,clearLaneNumber:N,initializeAreaTool:B,calCrossIndicatorArea:E,calRoadIndicatorArea:H,connectCarFlow:R,disconnectCarFlow:j,handleHoloVehicleTraceData:z,clearHoloTrace:P,handleHoloSignalData:Z,clearHoloSignal:F,setInterpolate:Q,toggleTrafficInfo:K,toggleTrafficObject:J,toggleVehicleInfo:U,togglePause:G,updateQueueLength:te,removeQueueLength:ae,showOpenDrive:ne,hideOpenDrive:oe}),(e,i)=>(a.openBlock(),a.createElementBlock("div",me,[a.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:p},[a.withDirectives(a.createElementVNode("div",fe,[a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:O}," 开始记录 "),a.createElementVNode("button",{onClick:I},"下载日志")],512),[[a.vShow,m.value]])],512)]))}});exports.default=ge;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),v=require("./stores/index.js");require("./style/index.css");const ue=require("./utils/holo-flow/index.js"),de=require("./utils/map-initializer.js"),C=require("./utils/open-drive-renderer/index.js"),me=require("./utils/overlay.js"),pe=require("./utils/queue-length.js"),k=require("./utils/road-config-tool/index.js"),fe=require("./utils/traffic-flow.js"),ge={class:"gis-viewer"},we={style:{position:"absolute",bottom:"10px",left:"10px"}},ve=a.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(O,{expose:T,emit:b}){const m=a.ref(null);let c,i,o,r,s,t,u,n;const p=a.ref(!1);v.registerStore(),a.onMounted(async()=>{if(!m.value)return;document.addEventListener("keydown",d=>{d.ctrlKey&&d.key==="i"&&(p.value=!p.value)});const e=a.getCurrentInstance(),{$gisviewerAssetsRoot:l}=e.appContext.config.globalProperties,h=await(await fetch(y.config)).json();h.assetsRoot=y.assetsRoot||l;const ie=v.default.useAppDataStore;ie.mapConfig=h,i=new de.default,c=await i.initialize({container:m.value,markerClickCallback:(d,g,w,le)=>{f("markerClick",d,g,w,le)},mapClickCallback:(d,g,w)=>{f("mapClick",d,g,w)}}),s=new ue.default(c),await s.init(),f("mapLoaded")});const L=a.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 k.default(c)),o.showLaneNumber(e)),F=()=>{o==null||o.clearLaneNumber()},B=async e=>(o||(o=new k.default(c)),await o.initializeSearch(e)),E=async()=>o==null?void 0:o.calCrossIndicatorArea(),H=async()=>{},j=async(e,l)=>{r||(r=new fe.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=>(t||(t=new me.default(c)),t.addOverlays(e)),Y=e=>t==null?void 0:t.removeOverlaysByType(e),$=e=>t==null?void 0:t.removeOverlaysById(e),ee=()=>t==null?void 0:t.removeAllOverlays(),te=()=>{t==null||t.showAllOverlays()},ae=e=>{u||(u=new pe.default(c)),u.updateQueueLength(e)},ne=()=>{u==null||u.removeQueueLength()},oe=async(e,l)=>(n||(n=new C.default(c)),await n.showOpenDriveFromServer(e,l)),re=async e=>(n||(n=new C.default(c)),await n.showOpenDriveFromFile(e)),se=async()=>await(n==null?void 0:n.clearOpenDrive()),ce=async e=>n?await(n==null?void 0:n.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},y=O,f=b;return T({mapViewer:L,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}),(e,l)=>(a.openBlock(),a.createElementBlock("div",ge,[a.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:m},[a.withDirectives(a.createElementVNode("div",we,[a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:S}," 开始记录 "),a.createElementVNode("button",{onClick:D},"下载日志")],512),[[a.vShow,p.value]])],512)]))}});exports.default=ve;
@@ -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
- 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>;
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,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
  }, {}, {}>;