gisviewer-vue3-arcgis 1.0.118 → 1.0.120

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 (29) hide show
  1. package/es/src/gis-map/gis-map.vue.mjs +2 -2
  2. package/es/src/gis-map/stores/appData.d.ts +0 -3
  3. package/es/src/gis-map/stores/appData.mjs +4 -7
  4. package/es/src/gis-map/utils/common-utils.d.ts +5 -0
  5. package/es/src/gis-map/utils/common-utils.mjs +47 -23
  6. package/es/src/gis-map/utils/map-initializer.mjs +100 -99
  7. package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +23 -3
  8. package/es/src/gis-map/utils/open-drive-renderer/index.mjs +290 -136
  9. package/es/src/gis-map/utils/open-drive-renderer/junction.d.ts +2 -1
  10. package/es/src/gis-map/utils/open-drive-renderer/road.d.ts +2 -0
  11. package/es/src/gis-map/utils/open-drive-renderer/road.mjs +16 -8
  12. package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +21 -1
  13. package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.mjs +219 -161
  14. package/es/src/types/index.d.ts +11 -0
  15. package/lib/src/gis-map/gis-map.vue.js +1 -1
  16. package/lib/src/gis-map/stores/appData.d.ts +0 -3
  17. package/lib/src/gis-map/stores/appData.js +1 -1
  18. package/lib/src/gis-map/utils/common-utils.d.ts +5 -0
  19. package/lib/src/gis-map/utils/common-utils.js +1 -1
  20. package/lib/src/gis-map/utils/map-initializer.js +1 -1
  21. package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +23 -3
  22. package/lib/src/gis-map/utils/open-drive-renderer/index.js +2 -1
  23. package/lib/src/gis-map/utils/open-drive-renderer/junction.d.ts +2 -1
  24. package/lib/src/gis-map/utils/open-drive-renderer/road.d.ts +2 -0
  25. package/lib/src/gis-map/utils/open-drive-renderer/road.js +1 -1
  26. package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +21 -1
  27. package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.js +1 -1
  28. package/lib/src/types/index.d.ts +11 -0
  29. package/package.json +1 -1
@@ -1,38 +1,28 @@
1
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 L from "./junction.mjs";
5
- import p from "./road.mjs";
6
- class g {
2
+ import L from "../../stores/index.mjs";
3
+ import g from "../common-utils.mjs";
4
+ import p from "./junction.mjs";
5
+ import S from "./road.mjs";
6
+ class u {
7
7
  constructor() {
8
- this.roadList = /* @__PURE__ */ new Map(), this.junctionList = /* @__PURE__ */ new Map(), this.isWasmLoaded = !1, this.appStore = h(), this.FsFile = "data.xodr";
8
+ this.roadList = /* @__PURE__ */ new Map(), this.junctionList = /* @__PURE__ */ new Map(), this.junctionTableData = /* @__PURE__ */ new Map(), this.isWasmLoaded = !1, this.appDataStore = L.useAppDataStore, this.FsFile = "data.xodr";
9
9
  }
10
10
  static getInstance() {
11
- return g.instance || (g.instance = new g()), g.instance;
11
+ return u.instance || (u.instance = new u()), u.instance;
12
12
  }
13
13
  /**
14
14
  * 载入指定xodr文件并解析
15
15
  * @param filePath
16
16
  */
17
- async load(t) {
17
+ async load(o) {
18
18
  if (!this.isWasmLoaded) {
19
- const l = window.libOpenDrive;
20
- this.ModuleOpenDrive = await l(), this.isWasmLoaded = !0;
19
+ const r = window.libOpenDrive;
20
+ this.ModuleOpenDrive = await r(), this.isWasmLoaded = !0;
21
21
  }
22
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 l = Number(a["@_x"]) || 0, u = Number(a["@_y"]) || 0;
29
- this.appStore.$patch({
30
- xOffset: l,
31
- yOffset: u,
32
- geoReference: i
33
- });
34
- }
35
- const c = new TextEncoder().encode(s);
23
+ const t = await (await fetch(o)).text();
24
+ this.readXodrString(t);
25
+ const n = new TextEncoder().encode(t);
36
26
  try {
37
27
  this.ModuleOpenDrive.FS_unlink(`./${this.FsFile}`);
38
28
  } catch {
@@ -40,11 +30,11 @@ class g {
40
30
  this.ModuleOpenDrive.FS_createDataFile(
41
31
  ".",
42
32
  this.FsFile,
43
- c,
33
+ n,
44
34
  !0,
45
35
  !0
46
36
  );
47
- const d = {
37
+ const i = {
48
38
  with_lateralProfile: !0,
49
39
  with_laneHeight: !0,
50
40
  with_road_objects: !1,
@@ -53,7 +43,7 @@ class g {
53
43
  };
54
44
  return this.ModuleOpenDriveMap = new this.ModuleOpenDrive.OpenDriveMap(
55
45
  `./${this.FsFile}`,
56
- d
46
+ i
57
47
  ), console.timeEnd("加载用时"), this.getRoadNetwork();
58
48
  }
59
49
  clear() {
@@ -63,83 +53,111 @@ class g {
63
53
  } catch {
64
54
  }
65
55
  }
56
+ /**
57
+ * 读取xodr中wasm接口不提供的数据
58
+ * @param fileText
59
+ */
60
+ readXodrString(o) {
61
+ const t = new m({
62
+ ignoreAttributes: !1,
63
+ allowBooleanAttributes: !0
64
+ }).parse(o), s = t.OpenDRIVE.header.geoReference, n = t.OpenDRIVE.header.offset;
65
+ if (n) {
66
+ const r = Number(n["@_x"]) || 0, a = Number(n["@_y"]) || 0;
67
+ g.setGeoData(s, r, a);
68
+ }
69
+ const i = t.OpenDRIVE.junction;
70
+ for (const r of i) {
71
+ const a = JSON.parse(
72
+ r.userData.tableData
73
+ );
74
+ this.junctionTableData.set(a.id, a);
75
+ }
76
+ }
66
77
  /**
67
78
  * 解析路网
68
79
  */
69
80
  getRoadNetwork() {
70
- console.time("采样用时"), this.roadList.clear(), this.junctionList.clear();
81
+ this.roadList.clear(), this.junctionList.clear();
82
+ let o;
71
83
  try {
72
- const t = this.ModuleOpenDrive.get_odr_road_network(
84
+ console.time("采样用时"), o = this.ModuleOpenDrive.get_odr_road_network(
73
85
  this.ModuleOpenDriveMap,
74
86
  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 p(r);
80
- this.roadList.set(c.id, c);
81
- }), f.getStdVecEntries(
82
- t.junctions,
87
+ );
88
+ } catch (s) {
89
+ return { status: -1, message: `解析路网失败, ${s}` };
90
+ } finally {
91
+ console.timeEnd("采样用时");
92
+ }
93
+ console.time("投影转换用时");
94
+ try {
95
+ g.getStdVecEntries(o.roads, !0).forEach((n) => {
96
+ const i = new S(n);
97
+ this.roadList.set(i.id, i);
98
+ });
99
+ } catch (s) {
100
+ return { status: -1, message: `解析道路失败, ${s}` };
101
+ }
102
+ try {
103
+ g.getStdVecEntries(
104
+ o.junctions,
83
105
  !0
84
- ).forEach((r) => {
85
- const c = new L(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 l = d.allLanes.map((u) => ({
92
- id: u.id,
93
- type: u.type,
94
- innerPath: u.innerBorder,
95
- outerPath: u.outerBorder,
96
- centerLine: u.centerLine
97
- }));
98
- return {
99
- id: d.s0,
100
- lanePaths: l
101
- };
102
- });
103
- i.push({
104
- id: r.id,
105
- name: r.name,
106
- laneSections: c,
107
- junction: r.junction,
108
- refLine: r.refLine
109
- });
106
+ ).forEach((n) => {
107
+ const i = new p(n);
108
+ i.tableData = this.junctionTableData.get(i.id), this.junctionList.set(n.id, i);
110
109
  });
111
- const a = [];
112
- return this.junctionList.forEach((r) => {
113
- const c = r.getJunctionOutline();
114
- a.push({
115
- id: r.id,
116
- name: r.name,
117
- outline: c
118
- });
119
- }), {
120
- status: 0,
121
- message: "ok",
122
- result: { roads: i, junctions: a }
123
- };
124
- } catch {
125
- return { status: -1, message: "解析路网失败" };
110
+ } catch (s) {
111
+ return { status: -1, message: `解析路口失败, ${s}` };
126
112
  }
113
+ console.timeEnd("投影转换用时");
114
+ const e = [];
115
+ this.roadList.forEach((s) => {
116
+ const n = s.allLaneSections.map((i) => {
117
+ const r = i.allLanes.map((a) => ({
118
+ id: a.id,
119
+ type: a.type,
120
+ innerPath: a.innerBorder,
121
+ outerPath: a.outerBorder,
122
+ centerLine: a.centerLine
123
+ }));
124
+ return {
125
+ id: i.s0,
126
+ lanePaths: r
127
+ };
128
+ });
129
+ e.push({
130
+ id: s.id,
131
+ name: s.name,
132
+ laneSections: n,
133
+ junction: s.junction,
134
+ refLine: s.refLine
135
+ });
136
+ });
137
+ const t = [];
138
+ return this.junctionList.forEach((s) => {
139
+ s.tableData && t.push(s.tableData);
140
+ }), {
141
+ status: 0,
142
+ message: "ok",
143
+ result: { roads: e, junctions: t }
144
+ };
127
145
  }
128
146
  /**
129
147
  * 获取所有道路的采样结果
130
148
  */
131
149
  get allSampledRoads() {
132
- return [...this.roadList.values()].map((t) => t.sampledRoad);
150
+ return [...this.roadList.values()].map((o) => o.sampledRoad);
133
151
  }
134
152
  /**
135
153
  * 获取路网结构
136
154
  */
137
155
  get roadNetwork() {
138
156
  return [...this.roadList.values()].map((e) => {
139
- const s = e.allLaneSections.map((o) => {
140
- const n = o.allLaneIds.filter((i) => i !== 0);
157
+ const t = e.allLaneSections.map((s) => {
158
+ const n = s.allLaneIds.filter((i) => i !== 0);
141
159
  return {
142
- sectionId: o.s0,
160
+ sectionId: s.s0,
143
161
  laneIds: n
144
162
  };
145
163
  });
@@ -147,7 +165,7 @@ class g {
147
165
  roadName: e.name,
148
166
  roadId: e.id,
149
167
  roadLength: e.length,
150
- sections: s
168
+ sections: t
151
169
  };
152
170
  });
153
171
  }
@@ -155,9 +173,9 @@ class g {
155
173
  * 从车道信息获取车道对象
156
174
  * @param laneInfo
157
175
  */
158
- getLane(t) {
159
- const e = this.roadList.get(t.roadId), s = e == null ? void 0 : e.getLaneSection(t.sectionId);
160
- return s == null ? void 0 : s.getLane(t.laneId);
176
+ getLane(o) {
177
+ const e = this.roadList.get(o.roadId), t = e == null ? void 0 : e.getLaneSection(o.sectionId);
178
+ return t == null ? void 0 : t.getLane(o.laneId);
161
179
  }
162
180
  /**
163
181
  * 获取两个车道之间的车道功能
@@ -165,11 +183,11 @@ class g {
165
183
  * @param incoming
166
184
  * @param outgoing
167
185
  */
168
- getFunctionFromIncomingToOutgoing(t, e) {
169
- const s = this.getLane(t), o = this.getLane(e);
170
- if (!s || !o || !s.drivingAngle || !o.drivingAngle)
186
+ getFunctionFromIncomingToOutgoing(o, e) {
187
+ const t = this.getLane(o), s = this.getLane(e);
188
+ if (!t || !s || !t.drivingAngle || !s.drivingAngle)
171
189
  return { status: -1, message: "车道信息错误" };
172
- let n = o.drivingAngle - s.drivingAngle;
190
+ let n = s.drivingAngle - t.drivingAngle;
173
191
  n > 180 ? n -= 360 : n < -180 && (n += 360);
174
192
  let i = "";
175
193
  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" };
@@ -178,23 +196,23 @@ class g {
178
196
  * 获取所有路口的轮廓
179
197
  * @returns
180
198
  */
181
- getJunctionOutline(t) {
199
+ getJunctionOutline(o) {
182
200
  const e = [];
183
- if (t !== "") {
184
- const s = this.junctionList.get(t);
185
- if (s) {
186
- const o = s.getJunctionOutline();
201
+ if (o !== "") {
202
+ const t = this.junctionList.get(o);
203
+ if (t) {
204
+ const s = t.getJunctionOutline();
187
205
  e.push({
188
- junctionId: t,
189
- name: s.name,
190
- outline: o
206
+ junctionId: o,
207
+ name: t.name,
208
+ outline: s
191
209
  });
192
210
  }
193
211
  } else
194
- for (const s of this.junctionList) {
195
- const o = s[0], n = s[1], i = n.getJunctionOutline();
196
- i.length <= 4 ? console.log(i, o) : e.push({
197
- junctionId: o,
212
+ for (const t of this.junctionList) {
213
+ const s = t[0], n = t[1], i = n.getJunctionOutline();
214
+ i.length <= 4 ? console.log(i, s) : e.push({
215
+ junctionId: s,
198
216
  name: n.name,
199
217
  outline: i
200
218
  });
@@ -206,74 +224,74 @@ class g {
206
224
  * @param laneInfo
207
225
  * @returns
208
226
  */
209
- getLaneLink(t) {
210
- const e = this.getLane(t);
227
+ getLaneLink(o) {
228
+ const e = this.getLane(o);
211
229
  return e ? { status: 0, result: e.getLink(), message: "ok" } : { status: -1, message: "车道信息错误" };
212
230
  }
213
- getRoadLink(t) {
231
+ getRoadLink(o) {
214
232
  const e = [];
215
- if (t !== "") {
216
- const s = this.roadList.get(t);
217
- s && e.push({
218
- roadId: t,
219
- successor: s.successor,
220
- predecessor: s.predecessor
233
+ if (o !== "") {
234
+ const t = this.roadList.get(o);
235
+ t && e.push({
236
+ roadId: o,
237
+ successor: t.successor,
238
+ predecessor: t.predecessor
221
239
  });
222
240
  } else
223
- [...this.roadList.values()].forEach((o) => {
241
+ [...this.roadList.values()].forEach((s) => {
224
242
  e.push({
225
- roadId: t,
226
- successor: o.successor,
227
- predecessor: o.predecessor
243
+ roadId: o,
244
+ successor: s.successor,
245
+ predecessor: s.predecessor
228
246
  });
229
247
  });
230
248
  return { status: 0, result: e, message: "ok" };
231
249
  }
232
- getConnectionLink(t) {
250
+ getConnectionLink(o) {
233
251
  const e = [];
234
- for (const s of this.junctionList) {
235
- const o = s[0], n = s[1];
236
- if ((t === "" || o === t) && (e.push({
237
- id: o,
252
+ for (const t of this.junctionList) {
253
+ const s = t[0], n = t[1];
254
+ if ((o === "" || s === o) && (e.push({
255
+ id: s,
238
256
  name: n.name,
239
257
  links: n.laneLinks
240
- }), t !== ""))
258
+ }), o !== ""))
241
259
  break;
242
260
  }
243
261
  return { status: 0, result: e, message: "ok" };
244
262
  }
245
- getLaneAngle(t) {
246
- const e = this.getLane(t);
263
+ getLaneAngle(o) {
264
+ const e = this.getLane(o);
247
265
  if (e) {
248
- const s = e.drivingAngle;
249
- if (s)
250
- return { status: 0, result: s, message: "ok" };
266
+ const t = e.drivingAngle;
267
+ if (t)
268
+ return { status: 0, result: t, message: "ok" };
251
269
  }
252
270
  return { status: -1, message: "车道信息错误" };
253
271
  }
254
- getTurnArrow(t) {
255
- const e = this.getLane(t.incoming);
272
+ getTurnArrow(o) {
273
+ const e = this.getLane(o.incoming);
256
274
  if (!e)
257
275
  return { status: -1, message: "进口道信息错误" };
258
- const s = e.drivingAngle;
259
- if (!s)
276
+ const t = e.drivingAngle;
277
+ if (!t)
260
278
  return { status: -1, message: "进口道信息错误" };
261
- const o = this.getLane(t.outgoing);
262
- if (!o)
279
+ const s = this.getLane(o.outgoing);
280
+ if (!s)
263
281
  return { status: -1, message: "出口道信息错误" };
264
- const n = o.drivingAngle;
282
+ const n = s.drivingAngle;
265
283
  if (!n)
266
284
  return { status: -1, message: "出口道信息错误" };
267
- let i = n - s;
285
+ let i = n - t;
268
286
  i > 180 ? i -= 360 : i < -180 && (i += 360);
269
- let a = "";
270
- return -45 < i && i < 45 ? a = "s" : 45 <= i && i <= 135 ? a = "r" : -135 <= i && i <= -45 ? a = "l" : a = "t", {
287
+ let r = "";
288
+ return -45 < i && i < 45 ? r = "s" : 45 <= i && i <= 135 ? r = "r" : -135 <= i && i <= -45 ? r = "l" : r = "t", {
271
289
  status: 0,
272
290
  message: "ok",
273
291
  result: {
274
- incomingAngle: s,
292
+ incomingAngle: t,
275
293
  outgoingAngle: n,
276
- direction: a
294
+ direction: r
277
295
  }
278
296
  };
279
297
  }
@@ -302,66 +320,106 @@ class g {
302
320
  * @param laneId
303
321
  * @returns
304
322
  */
305
- getPolygon(t, e, s) {
306
- const o = this.roadList.get(t);
307
- if (!o)
323
+ getPolygon(o, e, t) {
324
+ const s = this.roadList.get(o);
325
+ if (!s)
308
326
  return { status: -1, message: "道路id错误" };
309
- if (e !== void 0 && s !== void 0 && !isNaN(e) && !isNaN(s)) {
310
- const n = this.getLane({ roadId: t, sectionId: e, laneId: s });
327
+ if (e !== void 0 && t !== void 0 && !isNaN(e) && !isNaN(t)) {
328
+ const n = this.getLane({ roadId: o, sectionId: e, laneId: t });
311
329
  return n ? { status: 0, message: "ok", result: n.ring } : { status: -1, message: "车道信息错误" };
312
330
  } else if (e !== void 0 && !isNaN(e)) {
313
- const n = o.getLaneSection(e);
331
+ const n = s.getLaneSection(e);
314
332
  return n ? { status: 0, message: "ok", result: n.polygon } : { status: -1, message: "路段信息错误" };
315
333
  } else
316
- return { status: 0, message: "ok", result: o.polygon };
334
+ return { status: 0, message: "ok", result: s.polygon };
317
335
  }
318
336
  /**
319
337
  * 车道长度
320
338
  * @param laneInfo
321
339
  * @returns
322
340
  */
323
- getLaneLength(t) {
324
- const e = this.getLane(t);
341
+ getLaneLength(o) {
342
+ const e = this.getLane(o);
325
343
  if (e) {
326
- let s = 0;
327
- return e.road.isLastLaneSection(e.laneSection.s0) ? s = e.road.length - e.laneSection.s0 : s = e.road.getNextLaneSection(
344
+ let t = 0;
345
+ return e.road.isLastLaneSection(e.laneSection.s0) ? t = e.road.length - e.laneSection.s0 : t = e.road.getNextLaneSection(
328
346
  e.laneSection.s0
329
347
  ).s0 - e.laneSection.s0, {
330
348
  status: 0,
331
349
  message: "ok",
332
- result: Number(s.toFixed(2))
350
+ result: Number(t.toFixed(2))
333
351
  };
334
352
  } else
335
353
  return { status: -1, message: "车道信息错误" };
336
354
  }
337
- getRoadStopLine(t) {
355
+ getRoadStopLine(o) {
338
356
  const e = [];
339
- for (const s of this.junctionList) {
340
- const o = s[0], n = s[1];
341
- if (o === t) {
357
+ for (const t of this.junctionList) {
358
+ const s = t[0], n = t[1];
359
+ if (s === o) {
342
360
  const i = n.getRoadStopLine();
343
- e.push({ junctionId: o, stopLines: i });
361
+ e.push({ junctionId: s, stopLines: i });
344
362
  break;
345
- } else if (t === "") {
363
+ } else if (o === "") {
346
364
  const i = n.getRoadStopLine();
347
- e.push({ junctionId: o, stopLines: i });
365
+ e.push({ junctionId: s, stopLines: i });
348
366
  }
349
367
  }
350
368
  return { status: 0, message: "ok", result: e };
351
369
  }
352
- getLaneStopLine(t) {
353
- const e = this.getLane(t);
370
+ getLaneStopLine(o) {
371
+ const e = this.getLane(o);
354
372
  return e ? { status: 0, message: "ok", result: e.getStopLine() } : { status: -1, message: "车道信息错误" };
355
373
  }
356
- getLaneCenterLine(t) {
357
- const e = this.getLane(t);
374
+ getLaneCenterLine(o) {
375
+ const e = this.getLane(o);
358
376
  return e ? {
359
377
  status: 0,
360
378
  message: "ok",
361
379
  result: e.getLaneEndPoints("middle")
362
380
  } : { status: -1, message: "车道信息错误" };
363
381
  }
382
+ getSumoEdgeInfo(o) {
383
+ const e = o.split("+"), t = e[0], s = Number(e[1]), n = this.roadList.get(t);
384
+ if (!n)
385
+ return;
386
+ let i = "";
387
+ if (n.laneSectionNumber === 1)
388
+ i = `-${t}`;
389
+ else {
390
+ const c = n.getLaneSectionIndex(s);
391
+ if (c === -1)
392
+ return;
393
+ i = `-${t}#${c}`;
394
+ }
395
+ const r = n.predecessor.elementId, a = n.successor.elementId, l = n.getLaneSection(s);
396
+ if (!l)
397
+ return;
398
+ const d = [], f = l.laneNumber - 1;
399
+ for (const c of l.allLanes) {
400
+ if (c.id === 0)
401
+ continue;
402
+ const h = f - Math.abs(c.id);
403
+ d.push({
404
+ obj_id: `${i}_${h}`
405
+ });
406
+ }
407
+ return {
408
+ obj_id: i,
409
+ obj_type: 1,
410
+ obj_desc: "edge",
411
+ obj_info: {
412
+ obj_id: i,
413
+ length: n.getLaneSectionLength(s),
414
+ from: r,
415
+ to: a,
416
+ numLanes: f,
417
+ type: "driving",
418
+ laneList: d
419
+ }
420
+ };
421
+ }
364
422
  }
365
423
  export {
366
- g as default
424
+ u as default
367
425
  };
@@ -208,11 +208,13 @@ export interface IRoadStopLinesResult {
208
208
  }[];
209
209
  }
210
210
  export interface IShowOpenDriveFromFileParams {
211
+ server: string;
211
212
  file: string;
212
213
  options?: {
213
214
  showJunctionPolygon: boolean;
214
215
  showJunctionLane: boolean;
215
216
  showRoadName: boolean;
217
+ centerMap: boolean;
216
218
  };
217
219
  }
218
220
  export interface IFindSumoParams {
@@ -224,3 +226,12 @@ export interface ISplitOpenDriveLaneParams {
224
226
  start: number;
225
227
  end: number;
226
228
  }
229
+ export interface IJunctionTableData {
230
+ id: string;
231
+ name: string;
232
+ type: string;
233
+ coordinates: number[];
234
+ district: string;
235
+ crossId?: string;
236
+ factoryCode?: string;
237
+ }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),v=require("./stores/index.js");require("./style/index.css");const de=require("./utils/holo-flow/index.js"),me=require("./utils/map-initializer.js"),C=require("./utils/open-drive-renderer/index.js"),pe=require("./utils/overlay.js"),fe=require("./utils/queue-length.js"),O=require("./utils/road-config-tool/index.js"),ge=require("./utils/traffic-flow.js"),we={class:"gis-viewer"},ve={style:{position:"absolute",bottom:"10px",left:"10px"}},ye=n.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:T,emit:L}){const m=n.ref(null);let c,i,o,r,s,a,u,t;const p=n.ref(!1);v.registerStore(),n.onMounted(async()=>{if(!m.value)return;document.addEventListener("keydown",d=>{d.ctrlKey&&d.key==="i"&&(p.value=!p.value)});const e=n.getCurrentInstance(),{$gisviewerAssetsRoot:l}=e.appContext.config.globalProperties,h=await(await fetch(y.config)).json();h.assetsRoot=y.assetsRoot||l;const le=v.default.useAppDataStore;le.mapConfig=h,i=new me.default,c=await i.initialize({container:m.value,markerClickCallback:(d,g,w,ue)=>{f("markerClick",d,g,w,ue)},mapClickCallback:(d,g,w)=>{f("mapClick",d,g,w)}}),s=new de.default(c),await s.init(),f("mapLoaded")});const b=n.computed(()=>c),S=()=>{const e=v.default.useAppDataStore;e.saveTrackLog=!0},D=()=>{s.downloadTrackLog()},I=async e=>await i.setMapCenter(e),A=async e=>await i.setMapCamera(e),_=async e=>await i.lookAt(e),q=e=>i.setLayerVisibility(e),x=(e,l)=>i.requestCoordinateTransform(e,l),V=e=>{i.cancelCoordinateTransform(e)},M=e=>{i.setMapZoomRange(e)},N=e=>(o||(o=new O.default(c)),o.showLaneNumber(e)),F=()=>{o==null||o.clearLaneNumber()},B=async e=>(o||(o=new O.default(c)),await o.initializeSearch(e)),E=async()=>o==null?void 0:o.calCrossIndicatorArea(),H=async()=>{},j=async(e,l)=>{r||(r=new ge.default(c)),r.connectTrafficFlow(e,l)},z=()=>{r==null||r.disconnectTrafficFlow()},P=e=>{s.handleVehicleTraceData(e)},Q=()=>{s.clearHoloTrace()},R=e=>{s.setInterpolate(e)},Z=async e=>{await s.handleSignalData(e)},K=()=>{s.clearHoloSignal()},G=e=>{r==null||r.toggleTrafficInfo(e),s.toggleTrafficInfo(e)},J=e=>{s.togglePause(e)},U=e=>{r==null||r.toggleTrafficObject(e),s.toggleTrafficObject(e)},W=e=>{s.updatePanelContent(e)},X=async e=>(a||(a=new pe.default(c)),a.addOverlays(e)),Y=e=>a==null?void 0:a.removeOverlaysByType(e),$=e=>a==null?void 0:a.removeOverlaysById(e),ee=()=>a==null?void 0:a.removeAllOverlays(),te=()=>{a==null||a.showAllOverlays()},ae=e=>{u||(u=new fe.default(c)),u.updateQueueLength(e)},ne=()=>{u==null||u.removeQueueLength()},oe=async(e,l)=>(t||(t=new C.default(c)),await t.showOpenDriveFromServer(e,l)),re=async e=>(t||(t=new C.default(c)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),se=async()=>await(t==null?void 0:t.clearOpenDrive()),ce=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},ie=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},y=k,f=L;return T({mapViewer:b,setLayerVisibility:q,setMapCenter:I,lookAt:_,setMapCamera:A,setMapZoomRange:M,requestCoordinateTransform:x,cancelCoordinateTransform:V,addOverlays:X,showAllOverlays:te,removeOverlaysByType:Y,removeOverlaysById:$,removeAllOverlays:ee,showLaneNumber:N,clearLaneNumber:F,initializeAreaTool:B,calCrossIndicatorArea:E,calRoadIndicatorArea:H,connectCarFlow:j,disconnectCarFlow:z,handleHoloVehicleTraceData:P,clearHoloTrace:Q,handleHoloSignalData:Z,clearHoloSignal:K,setInterpolate:R,toggleTrafficInfo:G,toggleTrafficObject:U,toggleVehicleInfo:W,togglePause:J,updateQueueLength:ae,removeQueueLength:ne,showOpenDriveFromServer:oe,showOpenDriveFromFile:re,clearOpenDrive:se,findSumoInOpenDrive:ce,splitOpenDriveLane:ie}),(e,l)=>(n.openBlock(),n.createElementBlock("div",we,[n.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:m},[n.withDirectives(n.createElementVNode("div",ve,[n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:S}," 开始记录 "),n.createElementVNode("button",{onClick:D},"下载日志")],512),[[n.vShow,p.value]])],512)]))}});exports.default=ye;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),v=require("./stores/index.js");require("./style/index.css");const de=require("./utils/holo-flow/index.js"),me=require("./utils/map-initializer.js"),C=require("./utils/open-drive-renderer/index.js"),pe=require("./utils/overlay.js"),fe=require("./utils/queue-length.js"),O=require("./utils/road-config-tool/index.js"),ge=require("./utils/traffic-flow.js"),we={class:"gis-viewer"},ve={style:{position:"absolute",bottom:"10px",left:"10px"}},ye=n.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:T,emit:L}){const m=n.ref(null);let c,i,o,r,s,a,u,t;const p=n.ref(!1);n.onMounted(async()=>{if(v.registerStore(),!m.value)return;document.addEventListener("keydown",d=>{d.ctrlKey&&d.key==="i"&&(p.value=!p.value)});const e=n.getCurrentInstance(),{$gisviewerAssetsRoot:l}=e.appContext.config.globalProperties,h=await(await fetch(y.config)).json();h.assetsRoot=y.assetsRoot||l;const le=v.default.useAppDataStore;le.mapConfig=h,i=new me.default,c=await i.initialize({container:m.value,markerClickCallback:(d,g,w,ue)=>{f("markerClick",d,g,w,ue)},mapClickCallback:(d,g,w)=>{f("mapClick",d,g,w)}}),s=new de.default(c),await s.init(),f("mapLoaded")});const b=n.computed(()=>c),S=()=>{const e=v.default.useAppDataStore;e.saveTrackLog=!0},D=()=>{s.downloadTrackLog()},I=async e=>await i.setMapCenter(e),A=async e=>await i.setMapCamera(e),_=async e=>await i.lookAt(e),q=e=>i.setLayerVisibility(e),x=(e,l)=>i.requestCoordinateTransform(e,l),V=e=>{i.cancelCoordinateTransform(e)},M=e=>{i.setMapZoomRange(e)},N=e=>(o||(o=new O.default(c)),o.showLaneNumber(e)),F=()=>{o==null||o.clearLaneNumber()},B=async e=>(o||(o=new O.default(c)),await o.initializeSearch(e)),E=async()=>o==null?void 0:o.calCrossIndicatorArea(),H=async()=>{},j=async(e,l)=>{r||(r=new ge.default(c)),r.connectTrafficFlow(e,l)},z=()=>{r==null||r.disconnectTrafficFlow()},P=e=>{s.handleVehicleTraceData(e)},Q=()=>{s.clearHoloTrace()},R=e=>{s.setInterpolate(e)},Z=async e=>{await s.handleSignalData(e)},K=()=>{s.clearHoloSignal()},G=e=>{r==null||r.toggleTrafficInfo(e),s.toggleTrafficInfo(e)},J=e=>{s.togglePause(e)},U=e=>{r==null||r.toggleTrafficObject(e),s.toggleTrafficObject(e)},W=e=>{s.updatePanelContent(e)},X=async e=>(a||(a=new pe.default(c)),a.addOverlays(e)),Y=e=>a==null?void 0:a.removeOverlaysByType(e),$=e=>a==null?void 0:a.removeOverlaysById(e),ee=()=>a==null?void 0:a.removeAllOverlays(),te=()=>{a==null||a.showAllOverlays()},ae=e=>{u||(u=new fe.default(c)),u.updateQueueLength(e)},ne=()=>{u==null||u.removeQueueLength()},oe=async(e,l)=>(t||(t=new C.default(c)),await t.showOpenDriveFromServer(e,l)),re=async e=>(t||(t=new C.default(c)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),se=async()=>await(t==null?void 0:t.clearOpenDrive()),ce=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},ie=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},y=k,f=L;return T({mapViewer:b,setLayerVisibility:q,setMapCenter:I,lookAt:_,setMapCamera:A,setMapZoomRange:M,requestCoordinateTransform:x,cancelCoordinateTransform:V,addOverlays:X,showAllOverlays:te,removeOverlaysByType:Y,removeOverlaysById:$,removeAllOverlays:ee,showLaneNumber:N,clearLaneNumber:F,initializeAreaTool:B,calCrossIndicatorArea:E,calRoadIndicatorArea:H,connectCarFlow:j,disconnectCarFlow:z,handleHoloVehicleTraceData:P,clearHoloTrace:Q,handleHoloSignalData:Z,clearHoloSignal:K,setInterpolate:R,toggleTrafficInfo:G,toggleTrafficObject:U,toggleVehicleInfo:W,togglePause:J,updateQueueLength:ae,removeQueueLength:ne,showOpenDriveFromServer:oe,showOpenDriveFromFile:re,clearOpenDrive:se,findSumoInOpenDrive:ce,splitOpenDriveLane:ie}),(e,l)=>(n.openBlock(),n.createElementBlock("div",we,[n.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:m},[n.withDirectives(n.createElementVNode("div",ve,[n.createElementVNode("button",{style:{"margin-right":"10px"},onClick:S}," 开始记录 "),n.createElementVNode("button",{onClick:D},"下载日志")],512),[[n.vShow,p.value]])],512)]))}});exports.default=ye;
@@ -1,7 +1,4 @@
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;
7
4
  }, {}, {}>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("pinia"),t=e.defineStore("appData",{state:()=>({mapConfig:{},saveTrackLog:!1,geoReference:"",xOffset:0,yOffset:0})});exports.useAppDataStore=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("pinia"),t=e.defineStore("appData",{state:()=>({mapConfig:{},saveTrackLog:!1})});exports.useAppDataStore=t;
@@ -66,12 +66,17 @@ export default class CommonUtils {
66
66
  static getStdVecEntries(std_vec: any, delete_vec?: boolean): any[];
67
67
  static getStdMapEntries(std_map: any): any[];
68
68
  static getStdMapKeys(std_map: any, delete_map?: boolean): any[];
69
+ static geoReference: string;
70
+ static xOffset: number;
71
+ static yOffset: number;
72
+ static setGeoData(geoReference: string, xOffset: number, yOffset: number): void;
69
73
  /**
70
74
  * OpenDrive坐标转换为WGS84坐标
71
75
  * @param line
72
76
  * @returns
73
77
  */
74
78
  static transformLineProjection(line: number[][]): number[][];
79
+ static transformPointProjection(point: number[]): number[];
75
80
  static pointsEqual(point1: number[], point2: number[]): boolean;
76
81
  static getExtensionLine(pt1: number[], pt2: number[], distance: number): turf.Position;
77
82
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/geometry"),O=require("@arcgis/core/geometry/geometryEngineAsync"),L=require("@arcgis/core/geometry/support/webMercatorUtils"),l=require("@turf/bearing"),g=require("@turf/destination"),w=require("@turf/helpers"),b=require("pako"),m=require("proj4"),A=require("../stores/appData.js");function y(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const e in c)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(c,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>c[e]})}}return t.default=c,Object.freeze(t)}const p=y(O),P=y(L),a=y(w);class i{static destinationWithPoint(t,e,n){const r=a.point([t.x,t.y]),s=g(r,n,e,{units:"meters"});return new u.Point({x:s.geometry.coordinates[0],y:s.geometry.coordinates[1]})}static angleOfLine(t){const e=t.paths[0],n=a.point(e[0]),r=a.point(e[e.length-1]);return l(n,r)}static extendLineInTowDir(t,e){const n=t.paths[0],r=a.point(n[0]),s=a.point(n[1]),o=l(s,r),f=g(r,e,o,{units:"meters"}),h=o>0?o-180:o+180,d=g(s,e,h,{units:"meters"});return new u.Polyline({paths:[[f.geometry.coordinates,d.geometry.coordinates]]})}static async getIntersectPointOfTwoLines(t,e){const n=await p.intersectLinesToPoints(t,e);if(n.length)return n[0]}static async getIntersectPointsOfStopLineAndLane(t,e,n){let r=await i.getIntersectPointOfLineAndPolygon(t,e);if(await i.pointDistance(r)<3&&n){for(const s of n)if(r=await i.getIntersectPointOfLineAndPolygon(t,e,s),await i.pointDistance(r)>2.5){const o=new u.Polyline({paths:[r]});return(await i.getOffsetLine(o,-s)).paths[0]}}else return r;return[]}static async pointDistance(t){if(t.length<2)return 0;const e=new u.Polyline({paths:[t]});return await p.geodesicLength(e,"meters")}static async getIntersectPointOfLineAndPolygon(t,e,n=0){n!==0&&(t=await i.getOffsetLine(t,n));const r=await p.intersect(t,e);if(r instanceof u.Polyline){const s=r.paths[0],o=s[0],f=s[s.length-1];return[o,f]}return[]}static async getOffsetLine(t,e){const n=P.geographicToWebMercator(t),r=await p.offset(n,e,"meters");return P.webMercatorToGeographic(r,!1)}static unzip(t){try{const e=[],n=t.split("");for(let s=0;s<n.length;s++){const o=n[s];e.push(o.charCodeAt(0))}const r=new Uint8Array(e);return b.inflate(r,{to:"string"})}catch{console.log(`非压缩内容: ${t}`)}}static getStdVecEntries(t,e=!1){const n=new Array(t.size());for(let r=0;r<t.size();r++)n[r]=t.get(r);return e&&t.delete(),n}static getStdMapEntries(t){const e=[];for(const n of i.getStdMapKeys(t))e.push([n,t.get(n)]);return e}static getStdMapKeys(t,e=!1){const n=[],r=t.keys();for(let s=0;s<r.size();s++)n.push(r.get(s));return r.delete(),e&&t.delete(),n}static transformLineProjection(t){const e=A.useAppDataStore(),n=e.geoReference,r=e.xOffset,s=e.yOffset;return t.map(o=>m(n).inverse([o[0]-r,o[1]-s]))}static pointsEqual(t,e){return Math.abs(t[0]-e[0])<Number.EPSILON&&Math.abs(t[1]-e[1])<Number.EPSILON}static getExtensionLine(t,e,n){const r=a.point(t),s=a.point(e),o=l(r,s);return g(s,n,o,{units:"meters"}).geometry.coordinates}}exports.default=i;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),y=require("@turf/bearing"),g=require("@turf/destination"),b=require("@turf/helpers"),S=require("pako"),P=require("proj4");function l(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const p=l(L),h=l(w),c=l(b);class i{static destinationWithPoint(e,t,n){const r=c.point([e.x,e.y]),s=g(r,n,t,{units:"meters"});return new u.Point({x:s.geometry.coordinates[0],y:s.geometry.coordinates[1]})}static angleOfLine(e){const t=e.paths[0],n=c.point(t[0]),r=c.point(t[t.length-1]);return y(n,r)}static extendLineInTowDir(e,t){const n=e.paths[0],r=c.point(n[0]),s=c.point(n[1]),o=y(s,r),f=g(r,t,o,{units:"meters"}),O=o>0?o-180:o+180,d=g(s,t,O,{units:"meters"});return new u.Polyline({paths:[[f.geometry.coordinates,d.geometry.coordinates]]})}static async getIntersectPointOfTwoLines(e,t){const n=await p.intersectLinesToPoints(e,t);if(n.length)return n[0]}static async getIntersectPointsOfStopLineAndLane(e,t,n){let r=await i.getIntersectPointOfLineAndPolygon(e,t);if(await i.pointDistance(r)<3&&n){for(const s of n)if(r=await i.getIntersectPointOfLineAndPolygon(e,t,s),await i.pointDistance(r)>2.5){const o=new u.Polyline({paths:[r]});return(await i.getOffsetLine(o,-s)).paths[0]}}else return r;return[]}static async pointDistance(e){if(e.length<2)return 0;const t=new u.Polyline({paths:[e]});return await p.geodesicLength(t,"meters")}static async getIntersectPointOfLineAndPolygon(e,t,n=0){n!==0&&(e=await i.getOffsetLine(e,n));const r=await p.intersect(e,t);if(r instanceof u.Polyline){const s=r.paths[0],o=s[0],f=s[s.length-1];return[o,f]}return[]}static async getOffsetLine(e,t){const n=h.geographicToWebMercator(e),r=await p.offset(n,t,"meters");return h.webMercatorToGeographic(r,!1)}static unzip(e){try{const t=[],n=e.split("");for(let s=0;s<n.length;s++){const o=n[s];t.push(o.charCodeAt(0))}const r=new Uint8Array(t);return S.inflate(r,{to:"string"})}catch{console.log(`非压缩内容: ${e}`)}}static getStdVecEntries(e,t=!1){const n=new Array(e.size());for(let r=0;r<e.size();r++)n[r]=e.get(r);return t&&e.delete(),n}static getStdMapEntries(e){const t=[];for(const n of i.getStdMapKeys(e))t.push([n,e.get(n)]);return t}static getStdMapKeys(e,t=!1){const n=[],r=e.keys();for(let s=0;s<r.size();s++)n.push(r.get(s));return r.delete(),t&&e.delete(),n}static setGeoData(e,t,n){i.geoReference=e,i.xOffset=t,i.yOffset=n}static transformLineProjection(e){try{return e.map(t=>P(i.geoReference).inverse([t[0]-i.xOffset,t[1]-i.yOffset]))}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",i.geoReference),e}}static transformPointProjection(e){try{return P(i.geoReference).inverse([e[0]-i.xOffset,e[1]-i.yOffset])}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",i.geoReference),e}}static pointsEqual(e,t){return Math.abs(e[0]-t[0])<Number.EPSILON&&Math.abs(e[1]-t[1])<Number.EPSILON}static getExtensionLine(e,t,n){const r=c.point(e),s=c.point(t),o=y(r,s);return g(s,n,o,{units:"meters"}).geometry.coordinates}}exports.default=i;