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,151 +0,0 @@
|
|
|
1
|
-
import f from "../common-utils.mjs";
|
|
2
|
-
import E from "./draw-bezier.mjs";
|
|
3
|
-
import p from "./wasm-loader.mjs";
|
|
4
|
-
class R {
|
|
5
|
-
constructor(t) {
|
|
6
|
-
this.laneLinks = [], this.incomingLanes = /* @__PURE__ */ new Map(), this.wasmLoader = p.getInstance(), this.id = t.id, this.name = t.name, this.roadList = p.getInstance().roadList;
|
|
7
|
-
const i = f.getStdVecEntries(
|
|
8
|
-
t.odr_connections
|
|
9
|
-
);
|
|
10
|
-
for (const o of i) {
|
|
11
|
-
const n = o.connecting_road, e = this.roadList.get(n);
|
|
12
|
-
if (!e) {
|
|
13
|
-
console.log(`转接道路不存在: ${n}`), console.log(`junction: ${this.id}, connection: ${o.id}`);
|
|
14
|
-
continue;
|
|
15
|
-
}
|
|
16
|
-
if (!e.predecessor.elementId) {
|
|
17
|
-
console.log(`转接道路不存在predecessor: ${n}`), console.log(`junction: ${this.id}, connection: ${o.id}`);
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
if (!e.successor.elementId) {
|
|
21
|
-
console.log(`转接道路不存在successor: ${n}`), console.log(`junction: ${this.id}, connection: ${o.id}`);
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
const { elementId: s, contactPoint: c } = e.predecessor, g = this.roadList.get(s);
|
|
25
|
-
if (!g) {
|
|
26
|
-
console.log(`进口道路不存在: ${s}`), console.log(`junction: ${this.id}, connection: ${o.id}`);
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
const { elementId: a, contactPoint: h } = e.successor, r = this.roadList.get(a);
|
|
30
|
-
if (!r) {
|
|
31
|
-
console.log(`出口道路不存在: ${a}`), console.log(`junction: ${this.id}, connection: ${o.id}`);
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
const L = f.getStdVecEntries(o.odr_lane_links);
|
|
35
|
-
for (const l of L) {
|
|
36
|
-
const I = c === "start" ? 0 : g.getLastLaneSection().s0, m = l.from;
|
|
37
|
-
if (m === 0) {
|
|
38
|
-
console.log("进口车道id为0"), console.log(`junction: ${this.id}, connection: ${o.id}`);
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
const $ = 0, u = l.to;
|
|
42
|
-
if (u === 0) {
|
|
43
|
-
console.log("转接车道id为0"), console.log(`junction: ${this.id}, connection: ${o.id}`);
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
const d = e.getFirstLaneSection().getLane(u);
|
|
47
|
-
if (!d || (d == null ? void 0 : d.successor) === 0) {
|
|
48
|
-
console.log(
|
|
49
|
-
`转接车道不存在successor: ${n}_0_${u}`
|
|
50
|
-
), console.log(`junction: ${this.id}, connection: ${o.id}`);
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
const S = h === "start" ? 0 : r.getLastLaneSection().s0, v = d.successor;
|
|
54
|
-
this.laneLinks.push({
|
|
55
|
-
incoming: {
|
|
56
|
-
roadId: s,
|
|
57
|
-
sectionId: I,
|
|
58
|
-
laneId: m
|
|
59
|
-
},
|
|
60
|
-
connecting: {
|
|
61
|
-
roadId: n,
|
|
62
|
-
sectionId: $,
|
|
63
|
-
laneId: u
|
|
64
|
-
},
|
|
65
|
-
outgoing: {
|
|
66
|
-
roadId: a,
|
|
67
|
-
sectionId: S,
|
|
68
|
-
laneId: v
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
this.laneLinks.forEach((o) => {
|
|
74
|
-
const n = o.incoming, { roadId: e, laneId: s } = n, c = this.incomingLanes.get(e);
|
|
75
|
-
c ? c.find((g) => g.laneId === s) || c.push(n) : this.incomingLanes.set(e, [n]);
|
|
76
|
-
});
|
|
77
|
-
for (const o of this.incomingLanes.values())
|
|
78
|
-
o.sort(
|
|
79
|
-
(n, e) => +(Math.abs(n.laneId) > Math.abs(e.laneId)) || +(n.laneId === e.laneId) - 1
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* 在路口中,找到进口道的后继转接车道
|
|
84
|
-
* @param {string} roadId 进口道道路id
|
|
85
|
-
* @param {number} laneId 进口道车道id
|
|
86
|
-
* @returns {ILaneInfo[]}
|
|
87
|
-
*/
|
|
88
|
-
getSuccessorForIncoming(t, i) {
|
|
89
|
-
const o = [];
|
|
90
|
-
return this.laneLinks.forEach((n) => {
|
|
91
|
-
n.incoming.roadId === t && n.incoming.laneId === i && o.push(n.connecting);
|
|
92
|
-
}), o;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* 在路口中,找到出口道的前驱转接车道
|
|
96
|
-
* @param {string} roadId 出口道道路id
|
|
97
|
-
* @param {number} laneId 出口道车道id
|
|
98
|
-
* @returns {ILaneInfo[]}
|
|
99
|
-
*/
|
|
100
|
-
getPredecessorForOutgoing(t, i) {
|
|
101
|
-
const o = [];
|
|
102
|
-
return this.laneLinks.forEach((n) => {
|
|
103
|
-
n.outgoing.roadId === t && n.outgoing.laneId === i && o.push(n.connecting);
|
|
104
|
-
}), o;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* 获取路口轮廓线
|
|
108
|
-
* 要等所有路口对象生成之后才能调用,所以不放在初始化中
|
|
109
|
-
* @returns
|
|
110
|
-
*/
|
|
111
|
-
getJunctionOutline() {
|
|
112
|
-
if (this.outline)
|
|
113
|
-
return this.outline;
|
|
114
|
-
const t = [], i = [];
|
|
115
|
-
this.incomingLanes.forEach((o) => {
|
|
116
|
-
const n = this.wasmLoader.getLane(o[0]);
|
|
117
|
-
n && i.push(n);
|
|
118
|
-
}), i.sort((o, n) => {
|
|
119
|
-
const e = o.drivingAngle < 0 ? o.drivingAngle + 360 : o.drivingAngle, s = n.drivingAngle < 0 ? n.drivingAngle + 360 : n.drivingAngle;
|
|
120
|
-
return e - s;
|
|
121
|
-
}), i.push(i[0]);
|
|
122
|
-
for (let o = 0; o < i.length - 1; o++) {
|
|
123
|
-
const n = i[o], e = i[o + 1], s = n.laneSection.allLaneIds, c = n.id > 0 ? s[0] : s[s.length - 1], g = n.laneSection.getLane(c), a = e.laneSection.allLaneIds, h = e.id > 0 ? a[a.length - 1] : a[0], r = e.laneSection.getLane(h), L = g.getLaneEndPoints("outer").reverse(), l = r.getLaneEndPoints("outer").reverse(), I = E.drawBezierBetweenLane(L, l);
|
|
124
|
-
t.push(...I);
|
|
125
|
-
}
|
|
126
|
-
return t.push(t[0]), this.outline = t, t;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* 获取此路口各个进口道的停止线
|
|
130
|
-
*/
|
|
131
|
-
getRoadStopLine() {
|
|
132
|
-
const t = [];
|
|
133
|
-
for (const i of this.incomingLanes) {
|
|
134
|
-
const o = i[0], n = i[1], e = this.wasmLoader.getLane(n[0]);
|
|
135
|
-
if (!e || e.isDirEqual === void 0)
|
|
136
|
-
continue;
|
|
137
|
-
const s = e.isDirEqual ? e.laneSection.borders.top : e.laneSection.borders.bottom;
|
|
138
|
-
t.push({ roadId: o, line: s });
|
|
139
|
-
}
|
|
140
|
-
return t;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* 获取此路口的所有进口车道
|
|
144
|
-
*/
|
|
145
|
-
getAllIncomingLanes() {
|
|
146
|
-
return [...this.incomingLanes.values()].flat();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
export {
|
|
150
|
-
R as default
|
|
151
|
-
};
|
|
@@ -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,82 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -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
|
-
}
|