gisviewer-vue3-arcgis 1.0.133 → 1.0.134

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 (52) hide show
  1. package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
  2. package/es/src/gis-map/gis-map.vue.d.ts +17 -0
  3. package/es/src/gis-map/gis-map.vue.mjs +118 -113
  4. package/es/src/gis-map/index.d.ts +17 -0
  5. package/es/src/gis-map/utils/components/sketch-tool.vue.d.ts +18 -0
  6. package/es/src/gis-map/utils/components/sketch-tool.vue.mjs +7 -0
  7. package/es/src/gis-map/utils/components/sketch-tool.vue2.mjs +48 -0
  8. package/es/src/gis-map/utils/components/sketch-tool.vue3.mjs +4 -0
  9. package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +2 -1
  10. package/es/src/gis-map/utils/open-drive-renderer/index.mjs +18 -16
  11. package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +3 -7
  12. package/es/style.css +1 -1
  13. package/lib/_virtual/_plugin-vue_export-helper.js +1 -0
  14. package/lib/src/gis-map/gis-map.vue.d.ts +17 -0
  15. package/lib/src/gis-map/gis-map.vue.js +1 -1
  16. package/lib/src/gis-map/index.d.ts +17 -0
  17. package/lib/src/gis-map/utils/components/sketch-tool.vue.d.ts +18 -0
  18. package/lib/src/gis-map/utils/components/sketch-tool.vue.js +1 -0
  19. package/lib/src/gis-map/utils/components/sketch-tool.vue2.js +1 -0
  20. package/lib/src/gis-map/utils/components/sketch-tool.vue3.js +1 -0
  21. package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +2 -1
  22. package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
  23. package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
  24. package/package.json +1 -1
  25. package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +0 -17
  26. package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.mjs +0 -49
  27. package/es/src/gis-map/utils/open-drive-renderer/junction.d.ts +0 -51
  28. package/es/src/gis-map/utils/open-drive-renderer/junction.mjs +0 -151
  29. package/es/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +0 -48
  30. package/es/src/gis-map/utils/open-drive-renderer/lane-section.mjs +0 -82
  31. package/es/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +0 -29
  32. package/es/src/gis-map/utils/open-drive-renderer/lane-utils.mjs +0 -265
  33. package/es/src/gis-map/utils/open-drive-renderer/lane.d.ts +0 -77
  34. package/es/src/gis-map/utils/open-drive-renderer/lane.mjs +0 -110
  35. package/es/src/gis-map/utils/open-drive-renderer/road.d.ts +0 -62
  36. package/es/src/gis-map/utils/open-drive-renderer/road.mjs +0 -121
  37. package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +0 -108
  38. package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.mjs +0 -425
  39. package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +0 -17
  40. package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.js +0 -1
  41. package/lib/src/gis-map/utils/open-drive-renderer/junction.d.ts +0 -51
  42. package/lib/src/gis-map/utils/open-drive-renderer/junction.js +0 -1
  43. package/lib/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +0 -48
  44. package/lib/src/gis-map/utils/open-drive-renderer/lane-section.js +0 -1
  45. package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +0 -29
  46. package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.js +0 -1
  47. package/lib/src/gis-map/utils/open-drive-renderer/lane.d.ts +0 -77
  48. package/lib/src/gis-map/utils/open-drive-renderer/lane.js +0 -1
  49. package/lib/src/gis-map/utils/open-drive-renderer/road.d.ts +0 -62
  50. package/lib/src/gis-map/utils/open-drive-renderer/road.js +0 -1
  51. package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +0 -108
  52. package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.js +0 -1
@@ -1,29 +0,0 @@
1
- import { ILaneInfo } from '../../../types';
2
- import Lane from './lane';
3
- export default class LaneUtils {
4
- private static shpLanePolygonMap;
5
- private static shpArrowPositionMap;
6
- /**
7
- * 判断车道航向角是否和参考线方向一致,
8
- * 道路两端都连接到道路时无法计算,默认为true
9
- * @param lane
10
- * @returns
11
- */
12
- static isLaneDirEqualDriveDir(lane: Lane): boolean;
13
- /**
14
- * 计算车道航向角
15
- * @param lane
16
- * @returns
17
- */
18
- static getDriveAngle(lane: Lane): number;
19
- /**
20
- * 获取车道首尾端点,包括内侧、中间、外侧
21
- * @param type
22
- * @returns
23
- */
24
- static getLaneEndPoints(lane: Lane, type?: string): number[][];
25
- static getPrevAndNext(lane: Lane): {
26
- predecessorLanes: ILaneInfo[];
27
- successorLanes: ILaneInfo[];
28
- };
29
- }
@@ -1,265 +0,0 @@
1
- import h from "@turf/bearing";
2
- import * as I from "@turf/helpers";
3
- import a from "./wasm-loader.mjs";
4
- const L = class {
5
- /**
6
- * 判断车道航向角是否和参考线方向一致,
7
- * 道路两端都连接到道路时无法计算,默认为true
8
- * @param lane
9
- * @returns
10
- */
11
- static isLaneDirEqualDriveDir(e) {
12
- var s, i;
13
- let t = 0;
14
- if (((s = e.road.predecessor) == null ? void 0 : s.elementType) === "junction") {
15
- const c = e.road.predecessor.elementId, n = a.getInstance().junctionList.get(c);
16
- if (n) {
17
- for (const d of n.laneLinks)
18
- if (d.outgoing.roadId === e.road.id) {
19
- t = d.outgoing.laneId;
20
- break;
21
- }
22
- }
23
- } else if (((i = e.road.successor) == null ? void 0 : i.elementType) === "junction") {
24
- const c = e.road.successor.elementId, n = a.getInstance().junctionList.get(c);
25
- if (n) {
26
- for (const d of n.laneLinks)
27
- if (d.incoming.roadId === e.road.id) {
28
- t = d.incoming.laneId;
29
- break;
30
- }
31
- }
32
- }
33
- return t === 0 ? !0 : t * e.id > 0;
34
- }
35
- /**
36
- * 计算车道航向角
37
- * @param lane
38
- * @returns
39
- */
40
- static getDriveAngle(e) {
41
- const t = L.getLaneEndPoints(e), s = I.point(t[0]), i = I.point(t[1]);
42
- return h(s, i);
43
- }
44
- /**
45
- * 获取车道首尾端点,包括内侧、中间、外侧
46
- * @param type
47
- * @returns
48
- */
49
- static getLaneEndPoints(e, t = "middle") {
50
- let s, i, c, n;
51
- switch (e.isDirEqual ? (s = e.innerBorder[0], i = e.innerBorder[e.innerBorder.length - 1], c = e.outerBorder[0], n = e.outerBorder[e.outerBorder.length - 1]) : (s = e.innerBorder[e.innerBorder.length - 1], i = e.innerBorder[0], c = e.outerBorder[e.outerBorder.length - 1], n = e.outerBorder[0]), t) {
52
- case "inner":
53
- return [s, i];
54
- case "outer":
55
- return [c, n];
56
- default: {
57
- const d = [
58
- (s[0] + c[0]) / 2,
59
- (s[1] + c[1]) / 2
60
- ], f = [
61
- (i[0] + n[0]) / 2,
62
- (i[1] + n[1]) / 2
63
- ];
64
- return [d, f];
65
- }
66
- }
67
- }
68
- static getPrevAndNext(e) {
69
- var n, d, f, p;
70
- const t = [], s = [], i = e.laneSection.s0 === 0, c = e.road.isLastLaneSection(e.laneSection.s0);
71
- if (i) {
72
- if (((n = e.road.predecessor) == null ? void 0 : n.elementType) === "junction") {
73
- const o = a.getInstance().junctionList.get(
74
- e.road.predecessor.elementId
75
- );
76
- if (o) {
77
- const r = o.getSuccessorForIncoming(
78
- e.road.id,
79
- e.id
80
- );
81
- if (r.length > 0)
82
- s.push(...r);
83
- else {
84
- const u = o.getPredecessorForOutgoing(
85
- e.road.id,
86
- e.id
87
- );
88
- t.push(...u);
89
- }
90
- }
91
- } else if (((d = e.road.predecessor) == null ? void 0 : d.elementType) === "road" && e.predecessor !== 0) {
92
- const o = e.road.predecessor.elementId;
93
- let r = 0;
94
- if (e.road.predecessor.contactPoint === "end") {
95
- const g = a.getInstance().roadList.get(o);
96
- g && (r = g.getLastLaneSection().s0);
97
- }
98
- const u = {
99
- roadId: o,
100
- sectionId: r,
101
- laneId: e.predecessor
102
- };
103
- e.isDirEqual ? t.push(u) : s.push(u);
104
- }
105
- } else if (e.predecessor !== 0) {
106
- const o = e.road.getPrevLaneSection(e.laneSection.s0);
107
- if (o) {
108
- const r = {
109
- roadId: e.road.id,
110
- sectionId: o.s0,
111
- laneId: e.predecessor
112
- };
113
- e.isDirEqual ? t.push(r) : s.push(r);
114
- }
115
- }
116
- if (c) {
117
- if (((f = e.road.successor) == null ? void 0 : f.elementType) === "junction") {
118
- const o = a.getInstance().junctionList.get(
119
- e.road.successor.elementId
120
- );
121
- if (o) {
122
- const r = o.getSuccessorForIncoming(
123
- e.road.id,
124
- e.id
125
- );
126
- if (r.length > 0)
127
- s.push(...r);
128
- else {
129
- const u = o.getPredecessorForOutgoing(
130
- e.road.id,
131
- e.id
132
- );
133
- t.push(...u);
134
- }
135
- }
136
- } else if (((p = e.road.successor) == null ? void 0 : p.elementType) === "road" && e.successor !== 0) {
137
- const o = e.road.successor.elementId;
138
- let r = 0;
139
- if (e.road.successor.contactPoint === "end") {
140
- const g = a.getInstance().roadList.get(o);
141
- g && (r = g.getLastLaneSection().s0);
142
- }
143
- const u = {
144
- roadId: o,
145
- sectionId: r,
146
- laneId: e.successor
147
- };
148
- e.isDirEqual ? s.push(u) : t.push(u);
149
- }
150
- } else if (e.successor !== 0) {
151
- const o = e.road.getNextLaneSection(e.laneSection.s0);
152
- if (o) {
153
- const r = {
154
- roadId: e.road.id,
155
- sectionId: o.s0,
156
- laneId: e.successor
157
- };
158
- e.isDirEqual ? s.push(r) : t.push(r);
159
- }
160
- }
161
- return { predecessorLanes: t, successorLanes: s };
162
- }
163
- /**
164
- * 获取OpenDrive车道对应的高精地图中的车道面
165
- * @param lane
166
- */
167
- // public static getShpLanePolygonOfXodrLane(lane: Lane) {
168
- // const xodrLanePolygon = turf.polygon([lane.polygon]);
169
- // const xodrLaneCenter = centerOfMass(xodrLanePolygon);
170
- // const shpLanePolygons = LaneUtils.getShpLanePolygonsInProject("road");
171
- // // xodr车道的中心点在哪个shp车道面内
172
- // const shpLanePolygon = shpLanePolygons.find((shpLanePolygon) =>
173
- // booleanWithin(xodrLaneCenter, shpLanePolygon)
174
- // );
175
- // return shpLanePolygon;
176
- // }
177
- /**
178
- * 获取此项目的车道面
179
- * @param projectName
180
- * @returns
181
- */
182
- // private static getShpLanePolygonsInProject(
183
- // projectName: string
184
- // ): turf.Feature<turf.Polygon, turf.Properties>[] {
185
- // let polygons = LaneUtils.shpLanePolygonMap.get(projectName);
186
- // // 尚未加载车道面图层
187
- // if (!polygons) {
188
- // // 车道面图层地址
189
- // const layerFilePath = path.join(
190
- // __dirname,
191
- // // 默认项目名为"road"
192
- // projectName === "road"
193
- // ? "../../../public/files/layers/LanePolygon.json"
194
- // : `../../../public/files/layers/${projectName}_LanePolygon.json`
195
- // );
196
- // const dataString = readFileSync(layerFilePath, "utf8");
197
- // const layerObj = JSON.parse(dataString);
198
- // const polygons: turf.Feature<turf.Polygon, turf.Properties>[] =
199
- // layerObj.features.map((feature: any) =>
200
- // turf.polygon(
201
- // feature.geometry.coordinates,
202
- // { type: feature.properties.Type },
203
- // { id: feature.properties.ID }
204
- // )
205
- // );
206
- // LaneUtils.shpLanePolygonMap.set(projectName, polygons);
207
- // return polygons;
208
- // }
209
- // return polygons;
210
- // }
211
- /**
212
- * 获取车道内地面转向箭头中心点的位置
213
- * @param lane
214
- * @returns
215
- */
216
- // public static getArrowPositionsInLane(lane: Lane) {
217
- // const shpLanePolygon = lane.getShpPolygon();
218
- // if (shpLanePolygon) {
219
- // const projectName = "road";
220
- // const shpArrowPositions =
221
- // LaneUtils.getShpArrowPositionsInProject(projectName);
222
- // const positionsInLane = shpArrowPositions
223
- // .filter((position) => booleanWithin(position, shpLanePolygon))
224
- // .map((position) => ({
225
- // id: position.id,
226
- // type: position.properties?.type,
227
- // coordinates: position.geometry.coordinates,
228
- // }));
229
- // return positionsInLane;
230
- // }
231
- // }
232
- // private static getShpArrowPositionsInProject(projectName: string) {
233
- // let positions = LaneUtils.shpArrowPositionMap.get(projectName);
234
- // // 尚未加载转向箭头中心点图层
235
- // if (!positions) {
236
- // // 转向箭头中心点图层地址
237
- // const layerFilePath = path.join(
238
- // __dirname,
239
- // // 默认项目名为"road"
240
- // projectName === "road"
241
- // ? "../../../public/files/layers/DirectionArrowPoint.json"
242
- // : `../../../public/files/layers/${projectName}_DirectionArrowPoint.json`
243
- // );
244
- // const dataString = readFileSync(layerFilePath, "utf8");
245
- // const layerObj = JSON.parse(dataString);
246
- // const positions: turf.Feature<turf.Point, turf.Properties>[] =
247
- // layerObj.features.map((feature: any) =>
248
- // turf.point(
249
- // feature.geometry.coordinates,
250
- // { type: feature.properties.Type },
251
- // { id: feature.properties.ID }
252
- // )
253
- // );
254
- // LaneUtils.shpArrowPositionMap.set(projectName, positions);
255
- // return positions;
256
- // }
257
- // return positions;
258
- // }
259
- };
260
- let m = L;
261
- m.shpLanePolygonMap = /* @__PURE__ */ new Map();
262
- m.shpArrowPositionMap = /* @__PURE__ */ new Map();
263
- export {
264
- m as default
265
- };
@@ -1,77 +0,0 @@
1
- import { ISampledLane } from '../../../types';
2
- import LaneSection from './lane-section';
3
- import Road from './road';
4
- export default class Lane {
5
- /** 车道id:
6
- * 车道在路段中的序号,-2,-1,0,1,2,...
7
- */
8
- id: number;
9
- /** 车道类型, driving/walk/bike... */
10
- type: string;
11
- /** 内侧边线采样点坐标 */
12
- innerBorder: number[][];
13
- /** 外侧边线采样点坐标 */
14
- outerBorder: number[][];
15
- centerLine: number[][];
16
- road: Road;
17
- laneSection: LaneSection;
18
- predecessor: number;
19
- successor: number;
20
- /** 车道行车方向与正北夹角 */
21
- private angle;
22
- /** 车道行车方向是否与参考线方向一致 */
23
- private _isDirEqual;
24
- /**
25
- * 行车方向是否已计算
26
- * 存在无法计算行车方向, isDirEqual = undefined的情况,额外加一个标志
27
- * */
28
- private isDirEqualReady;
29
- /**
30
- * 车道面
31
- */
32
- ring: number[][];
33
- constructor(odrLane: any, road: Road, lanesection: LaneSection);
34
- get isDirEqual(): boolean | undefined;
35
- /**
36
- * 车道代码:道路id_路段id_车道id
37
- */
38
- get laneCode(): string;
39
- /**
40
- * 车道边线采样后的数据
41
- */
42
- get sampledLane(): ISampledLane;
43
- /**
44
- * 获取路段内同方向最外侧车道
45
- */
46
- get outerMostLaneInTheSameDir(): Lane;
47
- /**
48
- * 车道航向角
49
- * @returns
50
- */
51
- get drivingAngle(): number;
52
- /**
53
- * 根据左右边线生成车道中心线
54
- * @param left
55
- * @param right
56
- */
57
- private getCenterLineFromBorder;
58
- /**
59
- * 获取车道按行车方向的起点、终点,可选择内侧、中间、外侧
60
- * @param type
61
- * @returns
62
- */
63
- getLaneEndPoints(type?: string): number[][];
64
- /**
65
- * 获取车道的前驱车道和后继车道
66
- * @returns
67
- */
68
- getLink(): {
69
- predecessorLanes: import("../../../types").ILaneInfo[];
70
- successorLanes: import("../../../types").ILaneInfo[];
71
- };
72
- /**
73
- * 获取车道停止线
74
- * @returns
75
- */
76
- getStopLine(): number[][];
77
- }
@@ -1,110 +0,0 @@
1
- import n from "../common-utils.mjs";
2
- import s from "./lane-utils.mjs";
3
- class c {
4
- constructor(e, t, i) {
5
- this.isDirEqualReady = !1, this.road = t, this.laneSection = i, this.id = e.id, this.type = e.type, this.predecessor = e.predecessor, this.successor = e.successor;
6
- const o = n.getStdVecEntries(
7
- e.inner_border,
8
- !0
9
- );
10
- this.innerBorder = n.transformLineProjection(o);
11
- const r = n.getStdVecEntries(
12
- e.outer_border,
13
- !0
14
- );
15
- this.outerBorder = n.transformLineProjection(r), this.centerLine = this.getCenterLineFromBorder(
16
- this.innerBorder,
17
- this.outerBorder
18
- );
19
- const h = this.innerBorder.concat([...this.outerBorder].reverse());
20
- h.push(h[0]), this.ring = h;
21
- }
22
- get isDirEqual() {
23
- return this.isDirEqualReady || (this._isDirEqual = s.isLaneDirEqualDriveDir(this), this.isDirEqualReady = !0), this._isDirEqual;
24
- }
25
- /**
26
- * 车道代码:道路id_路段id_车道id
27
- */
28
- get laneCode() {
29
- return `${this.road.id}_${this.laneSection.s0}_${this.id}`;
30
- }
31
- /**
32
- * 车道边线采样后的数据
33
- */
34
- get sampledLane() {
35
- return {
36
- id: this.id,
37
- type: this.type,
38
- innerPath: this.innerBorder,
39
- outerPath: this.outerBorder
40
- };
41
- }
42
- /**
43
- * 获取路段内同方向最外侧车道
44
- */
45
- get outerMostLaneInTheSameDir() {
46
- const e = this.laneSection.allLaneIds, t = this.id > 0 ? e[e.length - 1] : e[0];
47
- return this.laneSection.getLane(t);
48
- }
49
- /**
50
- * 车道航向角
51
- * @returns
52
- */
53
- get drivingAngle() {
54
- if (!this.angle) {
55
- const e = s.getDriveAngle(this);
56
- this.angle = e;
57
- }
58
- return this.angle;
59
- }
60
- /**
61
- * 根据左右边线生成车道中心线
62
- * @param left
63
- * @param right
64
- */
65
- getCenterLineFromBorder(e, t) {
66
- const i = [], o = Math.min(e.length, t.length);
67
- for (let r = 0; r < o; r++)
68
- i.push([
69
- (e[r][0] + t[r][0]) / 2,
70
- (e[r][1] + t[r][1]) / 2
71
- ]);
72
- return i;
73
- }
74
- /**
75
- * 获取车道按行车方向的起点、终点,可选择内侧、中间、外侧
76
- * @param type
77
- * @returns
78
- */
79
- getLaneEndPoints(e = "middle") {
80
- return s.getLaneEndPoints(this, e);
81
- }
82
- /**
83
- * 获取车道的前驱车道和后继车道
84
- * @returns
85
- */
86
- getLink() {
87
- return s.getPrevAndNext(this);
88
- }
89
- // /**
90
- // * 获取车道对应的高精地图要素
91
- // * @returns
92
- // */
93
- // public getShpPolygon() {
94
- // return LaneUtils.getShpLanePolygonOfXodrLane(this);
95
- // }
96
- // public getArrowPositions() {
97
- // return LaneUtils.getArrowPositionsInLane(this);
98
- // }
99
- /**
100
- * 获取车道停止线
101
- * @returns
102
- */
103
- getStopLine() {
104
- const e = this.getLaneEndPoints("inner"), t = this.getLaneEndPoints("outer");
105
- return [e[1], t[1]];
106
- }
107
- }
108
- export {
109
- c as default
110
- };
@@ -1,62 +0,0 @@
1
- import { IRoadLink, ISampledRoad } from '../../../types';
2
- import LaneSection from './lane-section';
3
- export default class Road {
4
- id: string;
5
- name: string;
6
- length: number;
7
- junction: string;
8
- successor: IRoadLink;
9
- predecessor: IRoadLink;
10
- /** 道路上下左右的边框 */
11
- borders: {
12
- left: number[][];
13
- right: number[][];
14
- top: number[][];
15
- bottom: number[][];
16
- };
17
- /** 上下左右边框围成的多边形 */
18
- polygon: number[][];
19
- refLine: number[][];
20
- private sToLaneSection;
21
- constructor(odrRoad: any);
22
- /**
23
- * 获取一个路段
24
- * @param s0
25
- * @returns
26
- */
27
- getLaneSection(s0: number): LaneSection | undefined;
28
- /**
29
- * 获取第一个路段
30
- * @returns
31
- */
32
- getFirstLaneSection(): LaneSection;
33
- /**
34
- * 获取最后一个路段
35
- * @returns
36
- */
37
- getLastLaneSection(): LaneSection;
38
- getLaneSectionIndex(s: number): number;
39
- getLaneSectionLength(s: number): number;
40
- /**
41
- * 是否是最后一个路段的里程值
42
- * @param s
43
- * @returns
44
- */
45
- isLastLaneSection(s: number): boolean;
46
- /**
47
- * 获取下一个路段
48
- * @param s
49
- */
50
- getNextLaneSection(s: number): LaneSection | undefined;
51
- /**
52
- * 获取上一个路段
53
- * @param s
54
- * @returns
55
- */
56
- getPrevLaneSection(s: number): LaneSection | undefined;
57
- /** 获取所有路段 */
58
- get allLaneSections(): LaneSection[];
59
- get laneSectionNumber(): number;
60
- get sampledRoad(): ISampledRoad;
61
- private getBorderLine;
62
- }
@@ -1,121 +0,0 @@
1
- import h from "../common-utils.mjs";
2
- import a from "./lane-section.mjs";
3
- class S {
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 = h.getStdVecEntries(e.ref_line, !0);
7
- this.refLine = h.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
- h.getStdVecEntries(
17
- e.odr_lanesections,
18
- !0
19
- ).forEach((i) => {
20
- const o = new a(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
- getLaneSectionIndex(e) {
51
- return [...this.sToLaneSection.keys()].indexOf(e);
52
- }
53
- getLaneSectionLength(e) {
54
- const t = [...this.sToLaneSection.keys()], s = t.indexOf(e);
55
- let n = 0;
56
- return s === 0 ? t.length === 1 ? n = this.length : n = t[1] : s === t.length - 1 ? n = this.length - t[t.length - 1] : n = t[s + 1] - e, n;
57
- }
58
- /**
59
- * 是否是最后一个路段的里程值
60
- * @param s
61
- * @returns
62
- */
63
- isLastLaneSection(e) {
64
- const t = [...this.sToLaneSection.keys()];
65
- return t.sort((s, n) => s - n), e === t[t.length - 1];
66
- }
67
- /**
68
- * 获取下一个路段
69
- * @param s
70
- */
71
- getNextLaneSection(e) {
72
- const t = [...this.sToLaneSection.keys()], s = t.indexOf(e);
73
- if (s >= 0 && s < t.length - 1)
74
- return this.sToLaneSection.get(t[s + 1]);
75
- }
76
- /**
77
- * 获取上一个路段
78
- * @param s
79
- * @returns
80
- */
81
- getPrevLaneSection(e) {
82
- const t = [...this.sToLaneSection.keys()], s = t.indexOf(e);
83
- if (s > 0)
84
- return this.sToLaneSection.get(t[s - 1]);
85
- }
86
- /** 获取所有路段 */
87
- get allLaneSections() {
88
- return [...this.sToLaneSection.values()];
89
- }
90
- get laneSectionNumber() {
91
- return this.sToLaneSection.size;
92
- }
93
- get sampledRoad() {
94
- return {
95
- id: this.id,
96
- name: this.name,
97
- junction: this.junction,
98
- refLine: this.refLine,
99
- laneSections: this.allLaneSections.map(
100
- (e) => e.sampledLaneSection
101
- )
102
- };
103
- }
104
- getBorderLine() {
105
- const e = [], t = [];
106
- let s = [], n = [];
107
- const i = [...this.sToLaneSection.keys()];
108
- return i.forEach((o, r) => {
109
- const c = this.getLaneSection(o);
110
- r === 0 ? n = c.borders.bottom : r === i.length - 1 && (s = c.borders.top), e.push(...c.borders.left), t.push(...c.borders.right);
111
- }), {
112
- left: e,
113
- right: t,
114
- top: s,
115
- bottom: n
116
- };
117
- }
118
- }
119
- export {
120
- S as default
121
- };