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
@@ -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,367 @@
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 {
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 l = window.libOpenDrive;
20
+ this.ModuleOpenDrive = await l(), 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 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);
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 p(r);
80
+ this.roadList.set(c.id, c);
81
+ }), f.getStdVecEntries(
82
+ t.junctions,
83
+ !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
+ });
110
+ });
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: "解析路网失败" };
126
+ }
127
+ }
128
+ /**
129
+ * 获取所有道路的采样结果
130
+ */
131
+ get allSampledRoads() {
132
+ return [...this.roadList.values()].map((t) => t.sampledRoad);
133
+ }
134
+ /**
135
+ * 获取路网结构
136
+ */
137
+ get roadNetwork() {
138
+ return [...this.roadList.values()].map((e) => {
139
+ const s = e.allLaneSections.map((o) => {
140
+ const n = o.allLaneIds.filter((i) => i !== 0);
141
+ return {
142
+ sectionId: o.s0,
143
+ laneIds: n
144
+ };
145
+ });
146
+ return {
147
+ roadName: e.name,
148
+ roadId: e.id,
149
+ roadLength: e.length,
150
+ sections: s
151
+ };
152
+ });
153
+ }
154
+ /**
155
+ * 从车道信息获取车道对象
156
+ * @param laneInfo
157
+ */
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);
161
+ }
162
+ /**
163
+ * 获取两个车道之间的车道功能
164
+ * 左转、直行、右转、调头
165
+ * @param incoming
166
+ * @param outgoing
167
+ */
168
+ getFunctionFromIncomingToOutgoing(t, e) {
169
+ const s = this.getLane(t), o = this.getLane(e);
170
+ if (!s || !o || !s.drivingAngle || !o.drivingAngle)
171
+ return { status: -1, message: "车道信息错误" };
172
+ let n = o.drivingAngle - s.drivingAngle;
173
+ n > 180 ? n -= 360 : n < -180 && (n += 360);
174
+ let i = "";
175
+ 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" };
176
+ }
177
+ /**
178
+ * 获取所有路口的轮廓
179
+ * @returns
180
+ */
181
+ getJunctionOutline(t) {
182
+ const e = [];
183
+ if (t !== "") {
184
+ const s = this.junctionList.get(t);
185
+ if (s) {
186
+ const o = s.getJunctionOutline();
187
+ e.push({
188
+ junctionId: t,
189
+ name: s.name,
190
+ outline: o
191
+ });
192
+ }
193
+ } 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,
198
+ name: n.name,
199
+ outline: i
200
+ });
201
+ }
202
+ return { status: 0, result: e, message: "ok" };
203
+ }
204
+ /**
205
+ * 获取车道的前驱车道和后继车道
206
+ * @param laneInfo
207
+ * @returns
208
+ */
209
+ getLaneLink(t) {
210
+ const e = this.getLane(t);
211
+ return e ? { status: 0, result: e.getLink(), message: "ok" } : { status: -1, message: "车道信息错误" };
212
+ }
213
+ getRoadLink(t) {
214
+ 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
221
+ });
222
+ } else
223
+ [...this.roadList.values()].forEach((o) => {
224
+ e.push({
225
+ roadId: t,
226
+ successor: o.successor,
227
+ predecessor: o.predecessor
228
+ });
229
+ });
230
+ return { status: 0, result: e, message: "ok" };
231
+ }
232
+ getConnectionLink(t) {
233
+ 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,
238
+ name: n.name,
239
+ links: n.laneLinks
240
+ }), t !== ""))
241
+ break;
242
+ }
243
+ return { status: 0, result: e, message: "ok" };
244
+ }
245
+ getLaneAngle(t) {
246
+ const e = this.getLane(t);
247
+ if (e) {
248
+ const s = e.drivingAngle;
249
+ if (s)
250
+ return { status: 0, result: s, message: "ok" };
251
+ }
252
+ return { status: -1, message: "车道信息错误" };
253
+ }
254
+ getTurnArrow(t) {
255
+ const e = this.getLane(t.incoming);
256
+ if (!e)
257
+ return { status: -1, message: "进口道信息错误" };
258
+ const s = e.drivingAngle;
259
+ if (!s)
260
+ return { status: -1, message: "进口道信息错误" };
261
+ const o = this.getLane(t.outgoing);
262
+ if (!o)
263
+ return { status: -1, message: "出口道信息错误" };
264
+ const n = o.drivingAngle;
265
+ if (!n)
266
+ return { status: -1, message: "出口道信息错误" };
267
+ let i = n - s;
268
+ 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", {
271
+ status: 0,
272
+ message: "ok",
273
+ result: {
274
+ incomingAngle: s,
275
+ outgoingAngle: n,
276
+ direction: a
277
+ }
278
+ };
279
+ }
280
+ // public async getShpPolygon(laneInfo: ILaneInfo): Promise<IResult> {
281
+ // const lane = this.getLane(laneInfo);
282
+ // const polygon = lane?.getShpPolygon();
283
+ // if (polygon) {
284
+ // return { status: 0, result: polygon };
285
+ // } else {
286
+ // return { status: -1, message: "车道信息错误" };
287
+ // }
288
+ // }
289
+ // public async getLaneArrowPositions(laneInfo: ILaneInfo): Promise<IResult> {
290
+ // const lane = this.getLane(laneInfo);
291
+ // const positions = lane?.getArrowPositions();
292
+ // if (positions) {
293
+ // return { status: 0, result: positions };
294
+ // } else {
295
+ // return { status: -1, message: "车道信息错误" };
296
+ // }
297
+ // }
298
+ /**
299
+ * 道路路段车道的轮廓
300
+ * @param roadId
301
+ * @param sectionId
302
+ * @param laneId
303
+ * @returns
304
+ */
305
+ getPolygon(t, e, s) {
306
+ const o = this.roadList.get(t);
307
+ if (!o)
308
+ 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 });
311
+ return n ? { status: 0, message: "ok", result: n.ring } : { status: -1, message: "车道信息错误" };
312
+ } else if (e !== void 0 && !isNaN(e)) {
313
+ const n = o.getLaneSection(e);
314
+ return n ? { status: 0, message: "ok", result: n.polygon } : { status: -1, message: "路段信息错误" };
315
+ } else
316
+ return { status: 0, message: "ok", result: o.polygon };
317
+ }
318
+ /**
319
+ * 车道长度
320
+ * @param laneInfo
321
+ * @returns
322
+ */
323
+ getLaneLength(t) {
324
+ const e = this.getLane(t);
325
+ 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(
328
+ e.laneSection.s0
329
+ ).s0 - e.laneSection.s0, {
330
+ status: 0,
331
+ message: "ok",
332
+ result: Number(s.toFixed(2))
333
+ };
334
+ } else
335
+ return { status: -1, message: "车道信息错误" };
336
+ }
337
+ getRoadStopLine(t) {
338
+ const e = [];
339
+ for (const s of this.junctionList) {
340
+ const o = s[0], n = s[1];
341
+ if (o === t) {
342
+ const i = n.getRoadStopLine();
343
+ e.push({ junctionId: o, stopLines: i });
344
+ break;
345
+ } else if (t === "") {
346
+ const i = n.getRoadStopLine();
347
+ e.push({ junctionId: o, stopLines: i });
348
+ }
349
+ }
350
+ return { status: 0, message: "ok", result: e };
351
+ }
352
+ getLaneStopLine(t) {
353
+ const e = this.getLane(t);
354
+ return e ? { status: 0, message: "ok", result: e.getStopLine() } : { status: -1, message: "车道信息错误" };
355
+ }
356
+ getLaneCenterLine(t) {
357
+ const e = this.getLane(t);
358
+ return e ? {
359
+ status: 0,
360
+ message: "ok",
361
+ result: e.getLaneEndPoints("middle")
362
+ } : { status: -1, message: "车道信息错误" };
363
+ }
364
+ }
365
+ export {
366
+ g as default
367
+ };
@@ -170,3 +170,57 @@ 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
+ flash?: boolean;
221
+ }
222
+ export interface ISplitOpenDriveLaneParams {
223
+ id: string;
224
+ start: number;
225
+ end: number;
226
+ }
@@ -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 +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 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;
@@ -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<{