gisviewer-vue3-arcgis 1.0.133 → 1.0.135
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/_virtual/_plugin-vue_export-helper.mjs +9 -0
- package/es/src/gis-map/gis-map.vue.d.ts +17 -0
- package/es/src/gis-map/gis-map.vue.mjs +118 -113
- package/es/src/gis-map/index.d.ts +17 -0
- package/es/src/gis-map/utils/components/sketch-tool.vue.d.ts +18 -0
- package/es/src/gis-map/utils/components/sketch-tool.vue.mjs +7 -0
- package/es/src/gis-map/utils/components/sketch-tool.vue2.mjs +48 -0
- package/es/src/gis-map/utils/components/sketch-tool.vue3.mjs +4 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +2 -1
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +18 -16
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +1 -0
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +5 -4
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +2 -1
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +52 -24
- package/es/style.css +1 -1
- package/lib/_virtual/_plugin-vue_export-helper.js +1 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +17 -0
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +17 -0
- package/lib/src/gis-map/utils/components/sketch-tool.vue.d.ts +18 -0
- package/lib/src/gis-map/utils/components/sketch-tool.vue.js +1 -0
- package/lib/src/gis-map/utils/components/sketch-tool.vue2.js +1 -0
- package/lib/src/gis-map/utils/components/sketch-tool.vue3.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +2 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +2 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
- package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +0 -17
- package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.mjs +0 -49
- package/es/src/gis-map/utils/open-drive-renderer/junction.d.ts +0 -51
- package/es/src/gis-map/utils/open-drive-renderer/junction.mjs +0 -151
- package/es/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +0 -48
- package/es/src/gis-map/utils/open-drive-renderer/lane-section.mjs +0 -82
- package/es/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +0 -29
- package/es/src/gis-map/utils/open-drive-renderer/lane-utils.mjs +0 -265
- package/es/src/gis-map/utils/open-drive-renderer/lane.d.ts +0 -77
- package/es/src/gis-map/utils/open-drive-renderer/lane.mjs +0 -110
- package/es/src/gis-map/utils/open-drive-renderer/road.d.ts +0 -62
- package/es/src/gis-map/utils/open-drive-renderer/road.mjs +0 -121
- package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +0 -108
- package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.mjs +0 -425
- package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +0 -17
- package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.js +0 -1
- package/lib/src/gis-map/utils/open-drive-renderer/junction.d.ts +0 -51
- package/lib/src/gis-map/utils/open-drive-renderer/junction.js +0 -1
- package/lib/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +0 -48
- package/lib/src/gis-map/utils/open-drive-renderer/lane-section.js +0 -1
- package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +0 -29
- package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.js +0 -1
- package/lib/src/gis-map/utils/open-drive-renderer/lane.d.ts +0 -77
- package/lib/src/gis-map/utils/open-drive-renderer/lane.js +0 -1
- package/lib/src/gis-map/utils/open-drive-renderer/road.d.ts +0 -62
- package/lib/src/gis-map/utils/open-drive-renderer/road.js +0 -1
- package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +0 -108
- package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.js +0 -1
|
@@ -1,425 +0,0 @@
|
|
|
1
|
-
import { XMLParser as m } from "fast-xml-parser";
|
|
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
|
-
constructor() {
|
|
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
|
-
}
|
|
10
|
-
static getInstance() {
|
|
11
|
-
return u.instance || (u.instance = new u()), u.instance;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 载入指定xodr文件并解析
|
|
15
|
-
* @param filePath
|
|
16
|
-
*/
|
|
17
|
-
async load(o) {
|
|
18
|
-
if (!this.isWasmLoaded) {
|
|
19
|
-
const r = window.libOpenDrive;
|
|
20
|
-
this.ModuleOpenDrive = await r(), this.isWasmLoaded = !0;
|
|
21
|
-
}
|
|
22
|
-
console.time("加载用时");
|
|
23
|
-
const t = await (await fetch(o)).text();
|
|
24
|
-
this.readXodrString(t);
|
|
25
|
-
const n = new TextEncoder().encode(t);
|
|
26
|
-
try {
|
|
27
|
-
this.ModuleOpenDrive.FS_unlink(`./${this.FsFile}`);
|
|
28
|
-
} catch {
|
|
29
|
-
}
|
|
30
|
-
this.ModuleOpenDrive.FS_createDataFile(
|
|
31
|
-
".",
|
|
32
|
-
this.FsFile,
|
|
33
|
-
n,
|
|
34
|
-
!0,
|
|
35
|
-
!0
|
|
36
|
-
);
|
|
37
|
-
const i = {
|
|
38
|
-
with_lateralProfile: !0,
|
|
39
|
-
with_laneHeight: !0,
|
|
40
|
-
with_road_objects: !1,
|
|
41
|
-
center_map: !1,
|
|
42
|
-
abs_z_for_for_local_road_obj_outline: !0
|
|
43
|
-
};
|
|
44
|
-
return this.ModuleOpenDriveMap = new this.ModuleOpenDrive.OpenDriveMap(
|
|
45
|
-
`./${this.FsFile}`,
|
|
46
|
-
i
|
|
47
|
-
), console.timeEnd("加载用时"), this.getRoadNetwork();
|
|
48
|
-
}
|
|
49
|
-
clear() {
|
|
50
|
-
this.roadList.clear(), this.junctionList.clear();
|
|
51
|
-
try {
|
|
52
|
-
this.ModuleOpenDrive.FS_unlink(`./${this.FsFile}`);
|
|
53
|
-
} catch {
|
|
54
|
-
}
|
|
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
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* 解析路网
|
|
79
|
-
*/
|
|
80
|
-
getRoadNetwork() {
|
|
81
|
-
this.roadList.clear(), this.junctionList.clear();
|
|
82
|
-
let o;
|
|
83
|
-
try {
|
|
84
|
-
console.time("采样用时"), o = this.ModuleOpenDrive.get_odr_road_network(
|
|
85
|
-
this.ModuleOpenDriveMap,
|
|
86
|
-
0.5
|
|
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,
|
|
105
|
-
!0
|
|
106
|
-
).forEach((n) => {
|
|
107
|
-
const i = new p(n);
|
|
108
|
-
i.tableData = this.junctionTableData.get(i.id), this.junctionList.set(n.id, i);
|
|
109
|
-
});
|
|
110
|
-
} catch (s) {
|
|
111
|
-
return { status: -1, message: `解析路口失败, ${s}` };
|
|
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
|
-
};
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* 获取所有道路的采样结果
|
|
148
|
-
*/
|
|
149
|
-
get allSampledRoads() {
|
|
150
|
-
return [...this.roadList.values()].map((o) => o.sampledRoad);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* 获取路网结构
|
|
154
|
-
*/
|
|
155
|
-
get roadNetwork() {
|
|
156
|
-
return [...this.roadList.values()].map((e) => {
|
|
157
|
-
const t = e.allLaneSections.map((s) => {
|
|
158
|
-
const n = s.allLaneIds.filter((i) => i !== 0);
|
|
159
|
-
return {
|
|
160
|
-
sectionId: s.s0,
|
|
161
|
-
laneIds: n
|
|
162
|
-
};
|
|
163
|
-
});
|
|
164
|
-
return {
|
|
165
|
-
roadName: e.name,
|
|
166
|
-
roadId: e.id,
|
|
167
|
-
roadLength: e.length,
|
|
168
|
-
sections: t
|
|
169
|
-
};
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* 从车道信息获取车道对象
|
|
174
|
-
* @param laneInfo
|
|
175
|
-
*/
|
|
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);
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* 获取两个车道之间的车道功能
|
|
182
|
-
* 左转、直行、右转、调头
|
|
183
|
-
* @param incoming
|
|
184
|
-
* @param outgoing
|
|
185
|
-
*/
|
|
186
|
-
getFunctionFromIncomingToOutgoing(o, e) {
|
|
187
|
-
const t = this.getLane(o), s = this.getLane(e);
|
|
188
|
-
if (!t || !s || !t.drivingAngle || !s.drivingAngle)
|
|
189
|
-
return { status: -1, message: "车道信息错误" };
|
|
190
|
-
let n = s.drivingAngle - t.drivingAngle;
|
|
191
|
-
n > 180 ? n -= 360 : n < -180 && (n += 360);
|
|
192
|
-
let i = "";
|
|
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" };
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* 获取所有路口的轮廓
|
|
197
|
-
* @returns
|
|
198
|
-
*/
|
|
199
|
-
getJunctionOutline(o) {
|
|
200
|
-
const e = [];
|
|
201
|
-
if (o !== "") {
|
|
202
|
-
const t = this.junctionList.get(o);
|
|
203
|
-
if (t) {
|
|
204
|
-
const s = t.getJunctionOutline();
|
|
205
|
-
e.push({
|
|
206
|
-
junctionId: o,
|
|
207
|
-
name: t.name,
|
|
208
|
-
outline: s
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
} else
|
|
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,
|
|
216
|
-
name: n.name,
|
|
217
|
-
outline: i
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
return { status: 0, result: e, message: "ok" };
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* 获取车道的前驱车道和后继车道
|
|
224
|
-
* @param laneInfo
|
|
225
|
-
* @returns
|
|
226
|
-
*/
|
|
227
|
-
getLaneLink(o) {
|
|
228
|
-
const e = this.getLane(o);
|
|
229
|
-
return e ? { status: 0, result: e.getLink(), message: "ok" } : { status: -1, message: "车道信息错误" };
|
|
230
|
-
}
|
|
231
|
-
getRoadLink(o) {
|
|
232
|
-
const e = [];
|
|
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
|
|
239
|
-
});
|
|
240
|
-
} else
|
|
241
|
-
[...this.roadList.values()].forEach((s) => {
|
|
242
|
-
e.push({
|
|
243
|
-
roadId: o,
|
|
244
|
-
successor: s.successor,
|
|
245
|
-
predecessor: s.predecessor
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
return { status: 0, result: e, message: "ok" };
|
|
249
|
-
}
|
|
250
|
-
getConnectionLink(o) {
|
|
251
|
-
const e = [];
|
|
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,
|
|
256
|
-
name: n.name,
|
|
257
|
-
links: n.laneLinks
|
|
258
|
-
}), o !== ""))
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
return { status: 0, result: e, message: "ok" };
|
|
262
|
-
}
|
|
263
|
-
getLaneAngle(o) {
|
|
264
|
-
const e = this.getLane(o);
|
|
265
|
-
if (e) {
|
|
266
|
-
const t = e.drivingAngle;
|
|
267
|
-
if (t)
|
|
268
|
-
return { status: 0, result: t, message: "ok" };
|
|
269
|
-
}
|
|
270
|
-
return { status: -1, message: "车道信息错误" };
|
|
271
|
-
}
|
|
272
|
-
getTurnArrow(o) {
|
|
273
|
-
const e = this.getLane(o.incoming);
|
|
274
|
-
if (!e)
|
|
275
|
-
return { status: -1, message: "进口道信息错误" };
|
|
276
|
-
const t = e.drivingAngle;
|
|
277
|
-
if (!t)
|
|
278
|
-
return { status: -1, message: "进口道信息错误" };
|
|
279
|
-
const s = this.getLane(o.outgoing);
|
|
280
|
-
if (!s)
|
|
281
|
-
return { status: -1, message: "出口道信息错误" };
|
|
282
|
-
const n = s.drivingAngle;
|
|
283
|
-
if (!n)
|
|
284
|
-
return { status: -1, message: "出口道信息错误" };
|
|
285
|
-
let i = n - t;
|
|
286
|
-
i > 180 ? i -= 360 : i < -180 && (i += 360);
|
|
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", {
|
|
289
|
-
status: 0,
|
|
290
|
-
message: "ok",
|
|
291
|
-
result: {
|
|
292
|
-
incomingAngle: t,
|
|
293
|
-
outgoingAngle: n,
|
|
294
|
-
direction: r
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
// public async getShpPolygon(laneInfo: ILaneInfo): Promise<IResult> {
|
|
299
|
-
// const lane = this.getLane(laneInfo);
|
|
300
|
-
// const polygon = lane?.getShpPolygon();
|
|
301
|
-
// if (polygon) {
|
|
302
|
-
// return { status: 0, result: polygon };
|
|
303
|
-
// } else {
|
|
304
|
-
// return { status: -1, message: "车道信息错误" };
|
|
305
|
-
// }
|
|
306
|
-
// }
|
|
307
|
-
// public async getLaneArrowPositions(laneInfo: ILaneInfo): Promise<IResult> {
|
|
308
|
-
// const lane = this.getLane(laneInfo);
|
|
309
|
-
// const positions = lane?.getArrowPositions();
|
|
310
|
-
// if (positions) {
|
|
311
|
-
// return { status: 0, result: positions };
|
|
312
|
-
// } else {
|
|
313
|
-
// return { status: -1, message: "车道信息错误" };
|
|
314
|
-
// }
|
|
315
|
-
// }
|
|
316
|
-
/**
|
|
317
|
-
* 道路路段车道的轮廓
|
|
318
|
-
* @param roadId
|
|
319
|
-
* @param sectionId
|
|
320
|
-
* @param laneId
|
|
321
|
-
* @returns
|
|
322
|
-
*/
|
|
323
|
-
getPolygon(o, e, t) {
|
|
324
|
-
const s = this.roadList.get(o);
|
|
325
|
-
if (!s)
|
|
326
|
-
return { status: -1, message: "道路id错误" };
|
|
327
|
-
if (e !== void 0 && t !== void 0 && !isNaN(e) && !isNaN(t)) {
|
|
328
|
-
const n = this.getLane({ roadId: o, sectionId: e, laneId: t });
|
|
329
|
-
return n ? { status: 0, message: "ok", result: n.ring } : { status: -1, message: "车道信息错误" };
|
|
330
|
-
} else if (e !== void 0 && !isNaN(e)) {
|
|
331
|
-
const n = s.getLaneSection(e);
|
|
332
|
-
return n ? { status: 0, message: "ok", result: n.polygon } : { status: -1, message: "路段信息错误" };
|
|
333
|
-
} else
|
|
334
|
-
return { status: 0, message: "ok", result: s.polygon };
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* 车道长度
|
|
338
|
-
* @param laneInfo
|
|
339
|
-
* @returns
|
|
340
|
-
*/
|
|
341
|
-
getLaneLength(o) {
|
|
342
|
-
const e = this.getLane(o);
|
|
343
|
-
if (e) {
|
|
344
|
-
let t = 0;
|
|
345
|
-
return e.road.isLastLaneSection(e.laneSection.s0) ? t = e.road.length - e.laneSection.s0 : t = e.road.getNextLaneSection(
|
|
346
|
-
e.laneSection.s0
|
|
347
|
-
).s0 - e.laneSection.s0, {
|
|
348
|
-
status: 0,
|
|
349
|
-
message: "ok",
|
|
350
|
-
result: Number(t.toFixed(2))
|
|
351
|
-
};
|
|
352
|
-
} else
|
|
353
|
-
return { status: -1, message: "车道信息错误" };
|
|
354
|
-
}
|
|
355
|
-
getRoadStopLine(o) {
|
|
356
|
-
const e = [];
|
|
357
|
-
for (const t of this.junctionList) {
|
|
358
|
-
const s = t[0], n = t[1];
|
|
359
|
-
if (s === o) {
|
|
360
|
-
const i = n.getRoadStopLine();
|
|
361
|
-
e.push({ junctionId: s, stopLines: i });
|
|
362
|
-
break;
|
|
363
|
-
} else if (o === "") {
|
|
364
|
-
const i = n.getRoadStopLine();
|
|
365
|
-
e.push({ junctionId: s, stopLines: i });
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return { status: 0, message: "ok", result: e };
|
|
369
|
-
}
|
|
370
|
-
getLaneStopLine(o) {
|
|
371
|
-
const e = this.getLane(o);
|
|
372
|
-
return e ? { status: 0, message: "ok", result: e.getStopLine() } : { status: -1, message: "车道信息错误" };
|
|
373
|
-
}
|
|
374
|
-
getLaneCenterLine(o) {
|
|
375
|
-
const e = this.getLane(o);
|
|
376
|
-
return e ? {
|
|
377
|
-
status: 0,
|
|
378
|
-
message: "ok",
|
|
379
|
-
result: e.getLaneEndPoints("middle")
|
|
380
|
-
} : { status: -1, message: "车道信息错误" };
|
|
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
|
-
}
|
|
422
|
-
}
|
|
423
|
-
export {
|
|
424
|
-
u as default
|
|
425
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default class DrawBezier {
|
|
2
|
-
private static sampleCount;
|
|
3
|
-
static drawBezierBetweenLane(incoming: number[][], outgoing: number[][]): number[][];
|
|
4
|
-
/**
|
|
5
|
-
* 生成控制点
|
|
6
|
-
* 进口道的延长线和出口道的反向延长线的交点
|
|
7
|
-
*/
|
|
8
|
-
private static getControlPoint;
|
|
9
|
-
/**
|
|
10
|
-
* @desc 二阶贝塞尔
|
|
11
|
-
* @param {number} t 当前百分比
|
|
12
|
-
* @param {Array} p1 起点坐标
|
|
13
|
-
* @param {Array} p2 终点坐标
|
|
14
|
-
* @param {Array} cp 控制点
|
|
15
|
-
*/
|
|
16
|
-
private static twoBezier;
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@turf/helpers"),y=require("@turf/line-intersect"),p=require("../common-utils.js");function b(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,t.get?t:{enumerable:!0,get:()=>r[n]})}}return e.default=r,Object.freeze(e)}const m=b(P);class d{static drawBezierBetweenLane(e,n){const t=this.getControlPoint(e,n);if(t.length===3){const i=t[0],c=t[1],u=t[2],o=[];for(let s=0;s<=this.sampleCount;s++)o.push(this.twoBezier(s/this.sampleCount,i,c,u));return o}else return t}static getControlPoint(e,n){const t=e[0],i=e[1],c=p.default.getExtensionLine(t,i,100),u=m.lineString([t,c]),o=n[0],s=n[1],a=p.default.getExtensionLine(s,o,100),g=m.lineString([a,s]),l=y(u,g);if(l.features.length===0)return[i,o];const f=l.features[0].geometry.coordinates;return[i,o,f]}static twoBezier(e,n,t,i){const[c,u]=n,[o,s]=i,[a,g]=t,l=(1-e)*(1-e)*c+2*e*(1-e)*o+e*e*a,f=(1-e)*(1-e)*u+2*e*(1-e)*s+e*e*g;return[l,f]}}d.sampleCount=50;exports.default=d;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { IJunctionTableData, ILaneInfo } from '../../../types';
|
|
2
|
-
interface ILink {
|
|
3
|
-
incoming: ILaneInfo;
|
|
4
|
-
connecting: ILaneInfo;
|
|
5
|
-
outgoing: ILaneInfo;
|
|
6
|
-
}
|
|
7
|
-
export default class Junction {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
/** 路口内的行车通道,包含进口道->转接道->出口道三个车道 */
|
|
11
|
-
laneLinks: Array<ILink>;
|
|
12
|
-
tableData: IJunctionTableData | undefined;
|
|
13
|
-
/** 进口车道按roadId归类, */
|
|
14
|
-
private incomingLanes;
|
|
15
|
-
private outline;
|
|
16
|
-
private wasmLoader;
|
|
17
|
-
private roadList;
|
|
18
|
-
constructor(odrJunction: any);
|
|
19
|
-
/**
|
|
20
|
-
* 在路口中,找到进口道的后继转接车道
|
|
21
|
-
* @param {string} roadId 进口道道路id
|
|
22
|
-
* @param {number} laneId 进口道车道id
|
|
23
|
-
* @returns {ILaneInfo[]}
|
|
24
|
-
*/
|
|
25
|
-
getSuccessorForIncoming(roadId: string, laneId: number): ILaneInfo[];
|
|
26
|
-
/**
|
|
27
|
-
* 在路口中,找到出口道的前驱转接车道
|
|
28
|
-
* @param {string} roadId 出口道道路id
|
|
29
|
-
* @param {number} laneId 出口道车道id
|
|
30
|
-
* @returns {ILaneInfo[]}
|
|
31
|
-
*/
|
|
32
|
-
getPredecessorForOutgoing(roadId: string, laneId: number): ILaneInfo[];
|
|
33
|
-
/**
|
|
34
|
-
* 获取路口轮廓线
|
|
35
|
-
* 要等所有路口对象生成之后才能调用,所以不放在初始化中
|
|
36
|
-
* @returns
|
|
37
|
-
*/
|
|
38
|
-
getJunctionOutline(): number[][];
|
|
39
|
-
/**
|
|
40
|
-
* 获取此路口各个进口道的停止线
|
|
41
|
-
*/
|
|
42
|
-
getRoadStopLine(): {
|
|
43
|
-
roadId: string;
|
|
44
|
-
line: number[][];
|
|
45
|
-
}[];
|
|
46
|
-
/**
|
|
47
|
-
* 获取此路口的所有进口车道
|
|
48
|
-
*/
|
|
49
|
-
getAllIncomingLanes(): ILaneInfo[];
|
|
50
|
-
}
|
|
51
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("../common-utils.js"),E=require("./draw-bezier.js"),$=require("./wasm-loader.js");class j{constructor(t){this.laneLinks=[],this.incomingLanes=new Map,this.wasmLoader=$.default.getInstance(),this.id=t.id,this.name=t.name,this.roadList=$.default.getInstance().roadList;const i=m.default.getStdVecEntries(t.odr_connections);for(const o of i){const n=o.connecting_road,e=this.roadList.get(n);if(!e){console.log(`转接道路不存在: ${n}`),console.log(`junction: ${this.id}, connection: ${o.id}`);continue}if(!e.predecessor.elementId){console.log(`转接道路不存在predecessor: ${n}`),console.log(`junction: ${this.id}, connection: ${o.id}`);continue}if(!e.successor.elementId){console.log(`转接道路不存在successor: ${n}`),console.log(`junction: ${this.id}, connection: ${o.id}`);continue}const{elementId:s,contactPoint:c}=e.predecessor,d=this.roadList.get(s);if(!d){console.log(`进口道路不存在: ${s}`),console.log(`junction: ${this.id}, connection: ${o.id}`);continue}const{elementId:a,contactPoint:h}=e.successor,l=this.roadList.get(a);if(!l){console.log(`出口道路不存在: ${a}`),console.log(`junction: ${this.id}, connection: ${o.id}`);continue}const L=m.default.getStdVecEntries(o.odr_lane_links);for(const r of L){const I=c==="start"?0:d.getLastLaneSection().s0,f=r.from;if(f===0){console.log("进口车道id为0"),console.log(`junction: ${this.id}, connection: ${o.id}`);continue}const p=0,u=r.to;if(u===0){console.log("转接车道id为0"),console.log(`junction: ${this.id}, connection: ${o.id}`);continue}const g=e.getFirstLaneSection().getLane(u);if(!g||(g==null?void 0:g.successor)===0){console.log(`转接车道不存在successor: ${n}_0_${u}`),console.log(`junction: ${this.id}, connection: ${o.id}`);continue}const S=h==="start"?0:l.getLastLaneSection().s0,v=g.successor;this.laneLinks.push({incoming:{roadId:s,sectionId:I,laneId:f},connecting:{roadId:n,sectionId:p,laneId:u},outgoing:{roadId:a,sectionId:S,laneId:v}})}}this.laneLinks.forEach(o=>{const n=o.incoming,{roadId:e,laneId:s}=n,c=this.incomingLanes.get(e);c?c.find(d=>d.laneId===s)||c.push(n):this.incomingLanes.set(e,[n])});for(const o of this.incomingLanes.values())o.sort((n,e)=>+(Math.abs(n.laneId)>Math.abs(e.laneId))||+(n.laneId===e.laneId)-1)}getSuccessorForIncoming(t,i){const o=[];return this.laneLinks.forEach(n=>{n.incoming.roadId===t&&n.incoming.laneId===i&&o.push(n.connecting)}),o}getPredecessorForOutgoing(t,i){const o=[];return this.laneLinks.forEach(n=>{n.outgoing.roadId===t&&n.outgoing.laneId===i&&o.push(n.connecting)}),o}getJunctionOutline(){if(this.outline)return this.outline;const t=[],i=[];this.incomingLanes.forEach(o=>{const n=this.wasmLoader.getLane(o[0]);n&&i.push(n)}),i.sort((o,n)=>{const e=o.drivingAngle<0?o.drivingAngle+360:o.drivingAngle,s=n.drivingAngle<0?n.drivingAngle+360:n.drivingAngle;return e-s}),i.push(i[0]);for(let o=0;o<i.length-1;o++){const n=i[o],e=i[o+1],s=n.laneSection.allLaneIds,c=n.id>0?s[0]:s[s.length-1],d=n.laneSection.getLane(c),a=e.laneSection.allLaneIds,h=e.id>0?a[a.length-1]:a[0],l=e.laneSection.getLane(h),L=d.getLaneEndPoints("outer").reverse(),r=l.getLaneEndPoints("outer").reverse(),I=E.default.drawBezierBetweenLane(L,r);t.push(...I)}return t.push(t[0]),this.outline=t,t}getRoadStopLine(){const t=[];for(const i of this.incomingLanes){const o=i[0],n=i[1],e=this.wasmLoader.getLane(n[0]);if(!e||e.isDirEqual===void 0)continue;const s=e.isDirEqual?e.laneSection.borders.top:e.laneSection.borders.bottom;t.push({roadId:o,line:s})}return t}getAllIncomingLanes(){return[...this.incomingLanes.values()].flat()}}exports.default=j;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ISampledLaneSection } from '../../../types';
|
|
2
|
-
import Lane from './lane';
|
|
3
|
-
import Road from './road';
|
|
4
|
-
export default class LaneSection {
|
|
5
|
-
/** 路段id:
|
|
6
|
-
* 在道路参考线上,路段起始点与道路起始点的距离
|
|
7
|
-
*/
|
|
8
|
-
s0: number;
|
|
9
|
-
road: Road;
|
|
10
|
-
/** 路段上下左右的边框 */
|
|
11
|
-
borders: {
|
|
12
|
-
left: number[][];
|
|
13
|
-
right: number[][];
|
|
14
|
-
top: number[][];
|
|
15
|
-
bottom: number[][];
|
|
16
|
-
};
|
|
17
|
-
/** 上下左右边框围成的多边形 */
|
|
18
|
-
polygon: number[][];
|
|
19
|
-
/** 路段内的车道 */
|
|
20
|
-
private idToLane;
|
|
21
|
-
constructor(odrLanesection: any, road: Road);
|
|
22
|
-
/**
|
|
23
|
-
* 获取一个车道
|
|
24
|
-
* @param id
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
getLane(id: number): Lane | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* 获取所有车道
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
get allLanes(): Lane[];
|
|
33
|
-
get laneNumber(): number;
|
|
34
|
-
/**
|
|
35
|
-
* 获取所有车道id,id升序排列
|
|
36
|
-
* @returns
|
|
37
|
-
*/
|
|
38
|
-
get allLaneIds(): number[];
|
|
39
|
-
/**
|
|
40
|
-
* 路段采样后的数据
|
|
41
|
-
*/
|
|
42
|
-
get sampledLaneSection(): ISampledLaneSection;
|
|
43
|
-
/**
|
|
44
|
-
* 计算路段上下左右边框
|
|
45
|
-
* @returns
|
|
46
|
-
*/
|
|
47
|
-
private getBorderLine;
|
|
48
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../common-utils.js"),c=require("./lane.js");class g{constructor(s,r){this.s0=s.s0,this.road=r,this.idToLane=new Map,u.default.getStdVecEntries(s.odr_lanes,!0).forEach(a=>{const n=new c.default(a,r,this);this.idToLane.set(n.id,n)}),this.borders=this.getBorderLine();const e=[];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}getLane(s){return this.idToLane.get(s)}get allLanes(){return[...this.idToLane.values()]}get laneNumber(){return this.idToLane.size}get allLaneIds(){return[...this.idToLane.keys()].sort((s,r)=>s-r)}get sampledLaneSection(){const s=this.allLanes.filter(r=>r.id!==0);return{id:this.s0,lanePaths:s.map(r=>r.sampledLane)}}getBorderLine(){let s=[],r=[];const t=[],e=[],a=this.allLaneIds;return a.filter(n=>n!==0).forEach((n,p)=>{const o=this.getLane(n),i=o.innerBorder[o.innerBorder.length-1],h=o.outerBorder[o.outerBorder.length-1],l=o.innerBorder[0],d=o.outerBorder[0];p===0?(r=o.outerBorder,t.push(i),e.push(l)):p===a.length-2?(s=o.outerBorder,t.push(i),e.push(l)):o.id<0?(u.default.pointsEqual(h,t[t.length-1])||t.push(h),t.push(i),u.default.pointsEqual(d,e[e.length-1])||e.push(d),e.push(l)):(u.default.pointsEqual(i,t[t.length-1])||t.push(i),t.push(h),u.default.pointsEqual(l,e[e.length-1])||e.push(l),e.push(d))}),{left:s,right:r,top:t,bottom:e}}}exports.default=g;
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@turf/bearing"),j=require("@turf/helpers"),a=require("./wasm-loader.js");function h(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const I=h(j),L=class{static isLaneDirEqualDriveDir(e){var t,n;let o=0;if(((t=e.road.predecessor)==null?void 0:t.elementType)==="junction"){const c=e.road.predecessor.elementId,i=a.default.getInstance().junctionList.get(c);if(i){for(const d of i.laneLinks)if(d.outgoing.roadId===e.road.id){o=d.outgoing.laneId;break}}}else if(((n=e.road.successor)==null?void 0:n.elementType)==="junction"){const c=e.road.successor.elementId,i=a.default.getInstance().junctionList.get(c);if(i){for(const d of i.laneLinks)if(d.incoming.roadId===e.road.id){o=d.incoming.laneId;break}}}return o===0?!0:o*e.id>0}static getDriveAngle(e){const o=L.getLaneEndPoints(e),t=I.point(o[0]),n=I.point(o[1]);return m(t,n)}static getLaneEndPoints(e,o="middle"){let t,n,c,i;switch(e.isDirEqual?(t=e.innerBorder[0],n=e.innerBorder[e.innerBorder.length-1],c=e.outerBorder[0],i=e.outerBorder[e.outerBorder.length-1]):(t=e.innerBorder[e.innerBorder.length-1],n=e.innerBorder[0],c=e.outerBorder[e.outerBorder.length-1],i=e.outerBorder[0]),o){case"inner":return[t,n];case"outer":return[c,i];default:{const d=[(t[0]+c[0])/2,(t[1]+c[1])/2],g=[(n[0]+i[0])/2,(n[1]+i[1])/2];return[d,g]}}}static getPrevAndNext(e){var i,d,g,l;const o=[],t=[],n=e.laneSection.s0===0,c=e.road.isLastLaneSection(e.laneSection.s0);if(n){if(((i=e.road.predecessor)==null?void 0:i.elementType)==="junction"){const s=a.default.getInstance().junctionList.get(e.road.predecessor.elementId);if(s){const r=s.getSuccessorForIncoming(e.road.id,e.id);if(r.length>0)t.push(...r);else{const u=s.getPredecessorForOutgoing(e.road.id,e.id);o.push(...u)}}}else if(((d=e.road.predecessor)==null?void 0:d.elementType)==="road"&&e.predecessor!==0){const s=e.road.predecessor.elementId;let r=0;if(e.road.predecessor.contactPoint==="end"){const f=a.default.getInstance().roadList.get(s);f&&(r=f.getLastLaneSection().s0)}const u={roadId:s,sectionId:r,laneId:e.predecessor};e.isDirEqual?o.push(u):t.push(u)}}else if(e.predecessor!==0){const s=e.road.getPrevLaneSection(e.laneSection.s0);if(s){const r={roadId:e.road.id,sectionId:s.s0,laneId:e.predecessor};e.isDirEqual?o.push(r):t.push(r)}}if(c){if(((g=e.road.successor)==null?void 0:g.elementType)==="junction"){const s=a.default.getInstance().junctionList.get(e.road.successor.elementId);if(s){const r=s.getSuccessorForIncoming(e.road.id,e.id);if(r.length>0)t.push(...r);else{const u=s.getPredecessorForOutgoing(e.road.id,e.id);o.push(...u)}}}else if(((l=e.road.successor)==null?void 0:l.elementType)==="road"&&e.successor!==0){const s=e.road.successor.elementId;let r=0;if(e.road.successor.contactPoint==="end"){const f=a.default.getInstance().roadList.get(s);f&&(r=f.getLastLaneSection().s0)}const u={roadId:s,sectionId:r,laneId:e.successor};e.isDirEqual?t.push(u):o.push(u)}}else if(e.successor!==0){const s=e.road.getNextLaneSection(e.laneSection.s0);if(s){const r={roadId:e.road.id,sectionId:s.s0,laneId:e.successor};e.isDirEqual?t.push(r):o.push(r)}}return{predecessorLanes:o,successorLanes:t}}};let p=L;p.shpLanePolygonMap=new Map;p.shpArrowPositionMap=new Map;exports.default=p;
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../common-utils.js"),s=require("./lane-utils.js");class a{constructor(e,t,i){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;const o=n.default.getStdVecEntries(e.inner_border,!0);this.innerBorder=n.default.transformLineProjection(o);const r=n.default.getStdVecEntries(e.outer_border,!0);this.outerBorder=n.default.transformLineProjection(r),this.centerLine=this.getCenterLineFromBorder(this.innerBorder,this.outerBorder);const d=this.innerBorder.concat([...this.outerBorder].reverse());d.push(d[0]),this.ring=d}get isDirEqual(){return this.isDirEqualReady||(this._isDirEqual=s.default.isLaneDirEqualDriveDir(this),this.isDirEqualReady=!0),this._isDirEqual}get laneCode(){return`${this.road.id}_${this.laneSection.s0}_${this.id}`}get sampledLane(){return{id:this.id,type:this.type,innerPath:this.innerBorder,outerPath:this.outerBorder}}get outerMostLaneInTheSameDir(){const e=this.laneSection.allLaneIds,t=this.id>0?e[e.length-1]:e[0];return this.laneSection.getLane(t)}get drivingAngle(){if(!this.angle){const e=s.default.getDriveAngle(this);this.angle=e}return this.angle}getCenterLineFromBorder(e,t){const i=[],o=Math.min(e.length,t.length);for(let r=0;r<o;r++)i.push([(e[r][0]+t[r][0])/2,(e[r][1]+t[r][1])/2]);return i}getLaneEndPoints(e="middle"){return s.default.getLaneEndPoints(this,e)}getLink(){return s.default.getPrevAndNext(this)}getStopLine(){const e=this.getLaneEndPoints("inner"),t=this.getLaneEndPoints("outer");return[e[1],t[1]]}}exports.default=a;
|