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.
- package/es/src/gis-map/gis-map.vue.d.ts +6 -3
- package/es/src/gis-map/gis-map.vue.mjs +100 -95
- package/es/src/gis-map/index.d.ts +5 -2
- package/es/src/gis-map/stores/appData.d.ts +3 -0
- package/es/src/gis-map/stores/appData.mjs +7 -4
- package/es/src/gis-map/utils/common-utils.d.ts +12 -0
- package/es/src/gis-map/utils/common-utils.mjs +81 -43
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +3 -3
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +0 -1
- package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +17 -0
- package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.mjs +49 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +32 -3
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +279 -45
- package/es/src/gis-map/utils/open-drive-renderer/junction.d.ts +50 -0
- package/es/src/gis-map/utils/open-drive-renderer/junction.mjs +151 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +48 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane-section.mjs +82 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +29 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane-utils.mjs +265 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane.d.ts +77 -0
- package/es/src/gis-map/utils/open-drive-renderer/lane.mjs +110 -0
- package/es/src/gis-map/utils/open-drive-renderer/road.d.ts +60 -0
- package/es/src/gis-map/utils/open-drive-renderer/road.mjs +113 -0
- package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +88 -0
- package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.mjs +367 -0
- package/es/src/types/index.d.ts +54 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +6 -3
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +5 -2
- package/lib/src/gis-map/stores/appData.d.ts +3 -0
- package/lib/src/gis-map/stores/appData.js +1 -1
- package/lib/src/gis-map/utils/common-utils.d.ts +12 -0
- package/lib/src/gis-map/utils/common-utils.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +17 -0
- package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +32 -3
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/junction.d.ts +50 -0
- package/lib/src/gis-map/utils/open-drive-renderer/junction.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +48 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane-section.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +29 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane.d.ts +77 -0
- package/lib/src/gis-map/utils/open-drive-renderer/lane.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/road.d.ts +60 -0
- package/lib/src/gis-map/utils/open-drive-renderer/road.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +88 -0
- package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.js +1 -0
- package/lib/src/types/index.d.ts +54 -0
- package/package.json +4 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import a from "../common-utils.mjs";
|
|
2
|
+
import g from "./lane.mjs";
|
|
3
|
+
class m {
|
|
4
|
+
constructor(s, r) {
|
|
5
|
+
this.s0 = s.s0, this.road = r, this.idToLane = /* @__PURE__ */ new Map(), a.getStdVecEntries(
|
|
6
|
+
s.odr_lanes,
|
|
7
|
+
!0
|
|
8
|
+
).forEach((l) => {
|
|
9
|
+
const n = new g(l, r, this);
|
|
10
|
+
this.idToLane.set(n.id, n);
|
|
11
|
+
}), this.borders = this.getBorderLine();
|
|
12
|
+
const e = [];
|
|
13
|
+
e.push(...this.borders.right), e.push(...this.borders.top), e.push(...[...this.borders.left].reverse()), e.push(...[...this.borders.bottom].reverse()), e.push(e[0]), this.polygon = e;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 获取一个车道
|
|
17
|
+
* @param id
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
getLane(s) {
|
|
21
|
+
return this.idToLane.get(s);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 获取所有车道
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
get allLanes() {
|
|
28
|
+
return [...this.idToLane.values()];
|
|
29
|
+
}
|
|
30
|
+
get laneNumber() {
|
|
31
|
+
return this.idToLane.size;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 获取所有车道id,id升序排列
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
get allLaneIds() {
|
|
38
|
+
return [...this.idToLane.keys()].sort((s, r) => s - r);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 路段采样后的数据
|
|
42
|
+
*/
|
|
43
|
+
get sampledLaneSection() {
|
|
44
|
+
const s = this.allLanes.filter((r) => r.id !== 0);
|
|
45
|
+
return {
|
|
46
|
+
id: this.s0,
|
|
47
|
+
lanePaths: s.map((r) => r.sampledLane)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 计算路段上下左右边框
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
getBorderLine() {
|
|
55
|
+
let s = [], r = [];
|
|
56
|
+
const t = [], e = [], l = this.allLaneIds;
|
|
57
|
+
return l.filter((n) => n !== 0).forEach((n, p) => {
|
|
58
|
+
const o = this.getLane(n), i = o.innerBorder[o.innerBorder.length - 1], u = o.outerBorder[o.outerBorder.length - 1], h = o.innerBorder[0], d = o.outerBorder[0];
|
|
59
|
+
p === 0 ? (r = o.outerBorder, t.push(i), e.push(h)) : p === l.length - 2 ? (s = o.outerBorder, t.push(i), e.push(h)) : o.id < 0 ? (a.pointsEqual(
|
|
60
|
+
u,
|
|
61
|
+
t[t.length - 1]
|
|
62
|
+
) || t.push(u), t.push(i), a.pointsEqual(
|
|
63
|
+
d,
|
|
64
|
+
e[e.length - 1]
|
|
65
|
+
) || e.push(d), e.push(h)) : (a.pointsEqual(
|
|
66
|
+
i,
|
|
67
|
+
t[t.length - 1]
|
|
68
|
+
) || t.push(i), t.push(u), a.pointsEqual(
|
|
69
|
+
h,
|
|
70
|
+
e[e.length - 1]
|
|
71
|
+
) || e.push(h), e.push(d));
|
|
72
|
+
}), {
|
|
73
|
+
left: s,
|
|
74
|
+
right: r,
|
|
75
|
+
top: t,
|
|
76
|
+
bottom: e
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
m as default
|
|
82
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,265 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
/**
|
|
39
|
+
* 是否是最后一个路段的里程值
|
|
40
|
+
* @param s
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
isLastLaneSection(s: number): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* 获取下一个路段
|
|
46
|
+
* @param s
|
|
47
|
+
*/
|
|
48
|
+
getNextLaneSection(s: number): LaneSection | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* 获取上一个路段
|
|
51
|
+
* @param s
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
getPrevLaneSection(s: number): LaneSection | undefined;
|
|
55
|
+
/** 获取所有路段 */
|
|
56
|
+
get allLaneSections(): LaneSection[];
|
|
57
|
+
get laneSectionNumber(): number;
|
|
58
|
+
get sampledRoad(): ISampledRoad;
|
|
59
|
+
private getBorderLine;
|
|
60
|
+
}
|