gisviewer-vue3-arcgis 1.0.284 → 1.0.285
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/index.mjs +6 -5
- package/es/src/gis-map/gis-map.vue.d.ts +124 -1
- package/es/src/gis-map/gis-map.vue.mjs +63 -63
- package/es/src/gis-map/index.d.ts +124 -1
- package/es/src/gis-map/utils/edpass-device-controller.mjs +278 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +362 -0
- package/es/src/gis-map/utils/holo-flow/index.mjs +101 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +153 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.mjs +4 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +336 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +236 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +106 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +576 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +386 -0
- package/es/src/gis-map/utils/index.mjs +2 -2
- package/es/src/gis-map/utils/police-jurisdiction.mjs +202 -0
- package/es/src/gis-map/utils/road-config-tool/cross.mjs +127 -0
- package/es/src/gis-map/utils/road-config-tool/entrance.mjs +79 -0
- package/es/src/gis-map/utils/road-config-tool/exit.mjs +86 -0
- package/es/src/gis-map/utils/road-config-tool/index.mjs +112 -0
- package/es/src/gis-map/utils/road-config-tool/indicator-area.mjs +44 -0
- package/es/src/gis-map/utils/road-config-tool/lane.mjs +35 -0
- package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.mjs +265 -0
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +593 -0
- package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +84 -0
- package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +122 -0
- package/es/src/gis-map/utils/signal-control-area/edit-area.mjs +550 -0
- package/es/src/gis-map/utils/signal-control-area/layer-symbol.mjs +984 -0
- package/es/src/gis-map/utils/signal-control-area/signal-area-controller.mjs +140 -0
- package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.mjs +423 -0
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +123 -0
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +367 -0
- package/es/src/gis-map/utils/signal-system/signal-system-controller.mjs +137 -0
- package/es/src/gis-map/utils/sketchViewTool.mjs +503 -0
- package/es/src/gis-map-ol/gis-map-ol.vue.d.ts +50 -0
- package/es/src/gis-map-ol/gis-map-ol.vue.mjs +67 -0
- package/es/src/gis-map-ol/gis-map-ol.vue2.mjs +4 -0
- package/es/src/gis-map-ol/gis-map-ol.vue3.mjs +5 -0
- package/es/src/gis-map-ol/index.d.ts +44 -1
- package/es/src/gis-map-ol/index.mjs +8 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.d.ts +28 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.mjs +129 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +42 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.mjs +263 -0
- package/es/src/index.mjs +4 -4
- package/es/src/types/index.mjs +5 -0
- package/lib/index.js +1 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +124 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +124 -1
- package/lib/src/gis-map/utils/edpass-device-controller.js +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +2 -0
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -0
- package/lib/src/gis-map/utils/index.js +1 -1
- package/lib/src/gis-map/utils/police-jurisdiction.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/cross.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/entrance.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/exit.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/index.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/indicator-area.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/lane.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/edit-area.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/layer-symbol.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-area-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-system/signal-system-controller.js +1 -0
- package/lib/src/gis-map/utils/sketchViewTool.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue.d.ts +50 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue2.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue3.js +1 -0
- package/lib/src/gis-map-ol/index.d.ts +44 -1
- package/lib/src/gis-map-ol/index.js +1 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.d.ts +28 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.js +1 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +42 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.js +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/types/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Point as l, Polygon as d } from "@arcgis/core/geometry";
|
|
2
|
+
import f from "../common-utils.mjs";
|
|
3
|
+
import p from "./entrance.mjs";
|
|
4
|
+
import u from "./exit.mjs";
|
|
5
|
+
class C {
|
|
6
|
+
constructor(n) {
|
|
7
|
+
this.nearbyFeatures = /* @__PURE__ */ new Map(), this.entrances = [], this.exits = [], this.initialized = !1, this.id = n.id, this.crossCenter = new l({ x: n.center[0], y: n.center[1] });
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 初始化路口,设置周边车道与停止线
|
|
11
|
+
* @param params
|
|
12
|
+
*/
|
|
13
|
+
async initialize(n) {
|
|
14
|
+
n.lanes.forEach((e) => {
|
|
15
|
+
const t = e.getAttribute("RoadSecID"), s = e.geometry, i = this.nearbyFeatures.get(t);
|
|
16
|
+
i ? i.lanes.push(s) : this.nearbyFeatures.set(t, {
|
|
17
|
+
lanes: [s],
|
|
18
|
+
stopLines: []
|
|
19
|
+
});
|
|
20
|
+
}), n.stopLines.forEach((e) => {
|
|
21
|
+
const t = e.getAttribute("RoadSecID"), s = e.geometry, i = this.nearbyFeatures.get(t);
|
|
22
|
+
i ? i.stopLines.push(s) : this.nearbyFeatures.set(t, {
|
|
23
|
+
lanes: [],
|
|
24
|
+
stopLines: [s]
|
|
25
|
+
});
|
|
26
|
+
}), await this.createEntranceAndExit(), console.log(`${this.id} has ${this.entrances.length} entrance`), this.entrances.forEach((e) => {
|
|
27
|
+
console.log(`${e.id} has ${e.lanes.length} lanes`);
|
|
28
|
+
}), this.orderEntrance(), this.initialized = !0;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 标注车道序号的信息,进口道序号+车道序号
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
getLaneNumberInfo() {
|
|
35
|
+
const n = [];
|
|
36
|
+
return this.entrances.forEach((e) => {
|
|
37
|
+
e.lanes.forEach((t, s) => {
|
|
38
|
+
n.push({
|
|
39
|
+
crossId: this.id,
|
|
40
|
+
// 路口id
|
|
41
|
+
laneNumber: e.id + String(s + 1),
|
|
42
|
+
// 车道序号
|
|
43
|
+
stopLineCenter: [t.stopLineCenter.x, t.stopLineCenter.y],
|
|
44
|
+
// 车道停止线中心点
|
|
45
|
+
laneDirection: t.laneDirection - 180
|
|
46
|
+
// 车道方向
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}), this.exits.forEach((e) => {
|
|
50
|
+
e.lanes.forEach((t, s) => {
|
|
51
|
+
n.push({
|
|
52
|
+
crossId: this.id,
|
|
53
|
+
// 路口id
|
|
54
|
+
laneNumber: "-" + e.id + String(s + 1),
|
|
55
|
+
// 车道序号
|
|
56
|
+
stopLineCenter: [t.stopLineCenter.x, t.stopLineCenter.y],
|
|
57
|
+
// 车道停止线中心点
|
|
58
|
+
laneDirection: t.laneDirection - 180
|
|
59
|
+
// 车道方向
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}), n;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 计算路口指标计算区域。
|
|
66
|
+
* 由相邻进口道的停止线延长线交点围成的区域
|
|
67
|
+
*/
|
|
68
|
+
async calCrossIndicatorArea() {
|
|
69
|
+
const n = [];
|
|
70
|
+
for (let e = 0; e < this.entrances.length; e++) {
|
|
71
|
+
const t = this.entrances[e], s = this.entrances[(e + 1) % this.entrances.length], i = t.furthestLane.extendedStopLine, a = s.furthestLane.extendedStopLine, o = await f.getIntersectPointOfTwoLines(
|
|
72
|
+
i,
|
|
73
|
+
a
|
|
74
|
+
);
|
|
75
|
+
if (o)
|
|
76
|
+
n.push(o);
|
|
77
|
+
else {
|
|
78
|
+
const r = this.findExitOfEntrance(t), c = (r ? r.lanes[r.lanes.length - 1] : t.lanes[t.lanes.length - 1]).stopLine.getPoint(0, 1);
|
|
79
|
+
n.push(c);
|
|
80
|
+
const h = s.lanes[s.lanes.length - 1].stopLine.getPoint(0, 1);
|
|
81
|
+
n.push(h);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (n.length > 2)
|
|
85
|
+
return new d({
|
|
86
|
+
rings: [n.map((e) => [e.x, e.y])]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 创建进口道与出口道,并得到道口的车道与车道停止线
|
|
91
|
+
*/
|
|
92
|
+
async createEntranceAndExit() {
|
|
93
|
+
for (const n of this.nearbyFeatures) {
|
|
94
|
+
const e = n[0], t = n[1];
|
|
95
|
+
if (t.stopLines.length === 0) {
|
|
96
|
+
const s = new u(e);
|
|
97
|
+
s.addLanes(t), this.exits.push(s);
|
|
98
|
+
} else {
|
|
99
|
+
const s = new p(e);
|
|
100
|
+
await s.addLanes(t), this.entrances.push(s);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
for (const n of this.exits)
|
|
104
|
+
await n.findCorrespondingEntrance(this.entrances);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* 进口道排序
|
|
108
|
+
*/
|
|
109
|
+
orderEntrance() {
|
|
110
|
+
this.entrances.sort((n, e) => {
|
|
111
|
+
let t = n.dir, s = e.dir;
|
|
112
|
+
return t < 225 && (t += 360), s < 225 && (s += 360), t - s;
|
|
113
|
+
}), this.entrances.forEach((n, e) => {
|
|
114
|
+
n.id = String(e + 1);
|
|
115
|
+
const t = this.findExitOfEntrance(n);
|
|
116
|
+
t && (t.id = String(e + 1));
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
findExitOfEntrance(n) {
|
|
120
|
+
for (const e of this.exits)
|
|
121
|
+
if (e.entrance === n)
|
|
122
|
+
return e;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
export {
|
|
126
|
+
C as default
|
|
127
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { QuadrantCode as r } from "../../../types/index.mjs";
|
|
2
|
+
import h from "../common-utils.mjs";
|
|
3
|
+
import a from "./lane.mjs";
|
|
4
|
+
import { Polyline as L } from "@arcgis/core/geometry";
|
|
5
|
+
class l {
|
|
6
|
+
constructor(t) {
|
|
7
|
+
this.lanes = [], this.id = t;
|
|
8
|
+
}
|
|
9
|
+
async addLanes(t) {
|
|
10
|
+
for (const n of t.lanes)
|
|
11
|
+
for (const s of t.stopLines) {
|
|
12
|
+
const e = await h.getIntersectPointsOfStopLineAndLane(
|
|
13
|
+
s,
|
|
14
|
+
n,
|
|
15
|
+
[0.5, -0.5]
|
|
16
|
+
);
|
|
17
|
+
if (e.length === 0)
|
|
18
|
+
continue;
|
|
19
|
+
const i = new L({ paths: [e] }), o = new a();
|
|
20
|
+
o.lanePolygon = n, o.stopLine = i, o.isEntry = !0, await o.getLaneDirection(), this.addLane(o);
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 新增车道,并按道路中线至边线的方向排序
|
|
26
|
+
* @param lane
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
addLane(t) {
|
|
30
|
+
this.furthestLane || (this.furthestLane = t), this.dir || (this.dir = t.laneDirection, this.dir < 45 || this.dir > 315 ? this.quadrantCode = r.North : this.dir < 135 ? this.quadrantCode = r.East : this.dir < 225 ? this.quadrantCode = r.South : this.quadrantCode = r.West);
|
|
31
|
+
const n = t.stopLine, s = n.paths[0];
|
|
32
|
+
switch (this.quadrantCode) {
|
|
33
|
+
case r.West:
|
|
34
|
+
t.stopLineCenter.x < this.furthestLane.stopLineCenter.x && (this.furthestLane = t), s[0][1] < s[1][1] && (n.paths = [s.reverse()]);
|
|
35
|
+
for (let e = 0; e < this.lanes.length; e++) {
|
|
36
|
+
const i = this.lanes[e];
|
|
37
|
+
if (t.stopLineCenter.y > i.stopLineCenter.y) {
|
|
38
|
+
this.lanes.splice(e, 0, t);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
break;
|
|
43
|
+
case r.North:
|
|
44
|
+
t.stopLineCenter.y > this.furthestLane.stopLineCenter.y && (this.furthestLane = t), s[0][0] < s[1][0] && (n.paths = [s.reverse()]);
|
|
45
|
+
for (let e = 0; e < this.lanes.length; e++) {
|
|
46
|
+
const i = this.lanes[e];
|
|
47
|
+
if (t.stopLineCenter.x > i.stopLineCenter.x) {
|
|
48
|
+
this.lanes.splice(e, 0, t);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
case r.East:
|
|
54
|
+
t.stopLineCenter.x > this.furthestLane.stopLineCenter.x && (this.furthestLane = t), s[0][1] > s[1][1] && (n.paths = [s.reverse()]);
|
|
55
|
+
for (let e = 0; e < this.lanes.length; e++) {
|
|
56
|
+
const i = this.lanes[e];
|
|
57
|
+
if (t.stopLineCenter.y < i.stopLineCenter.y) {
|
|
58
|
+
this.lanes.splice(e, 0, t);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
case r.South:
|
|
64
|
+
t.stopLineCenter.y < this.furthestLane.stopLineCenter.y && (this.furthestLane = t), s[0][0] > s[1][0] && (n.paths = [s.reverse()]);
|
|
65
|
+
for (let e = 0; e < this.lanes.length; e++) {
|
|
66
|
+
const i = this.lanes[e];
|
|
67
|
+
if (t.stopLineCenter.x < i.stopLineCenter.x) {
|
|
68
|
+
this.lanes.splice(e, 0, t);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
this.lanes.push(t);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
l as default
|
|
79
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import p from "../common-utils.mjs";
|
|
2
|
+
import f from "./lane.mjs";
|
|
3
|
+
import { Polyline as h } from "@arcgis/core/geometry";
|
|
4
|
+
import * as y from "@arcgis/core/geometry/geometryEngineAsync";
|
|
5
|
+
import { QuadrantCode as o } from "../../../types/index.mjs";
|
|
6
|
+
class C {
|
|
7
|
+
constructor(t) {
|
|
8
|
+
this.lanes = [], this.id = t;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 寻找对应的进口道
|
|
12
|
+
* @param entrances
|
|
13
|
+
*/
|
|
14
|
+
async findCorrespondingEntrance(t) {
|
|
15
|
+
var a;
|
|
16
|
+
const e = this.lanes[0], n = e.lanePolygon.centroid;
|
|
17
|
+
let s, r = 1 / 0, i;
|
|
18
|
+
for (const c of t) {
|
|
19
|
+
s = c.lanes[0].lanePolygon.centroid;
|
|
20
|
+
const d = new h({
|
|
21
|
+
paths: [
|
|
22
|
+
[
|
|
23
|
+
[s.x, s.y],
|
|
24
|
+
[n.x, n.y]
|
|
25
|
+
]
|
|
26
|
+
]
|
|
27
|
+
}), l = await y.geodesicLength(d, "meters");
|
|
28
|
+
l < r && (r = l, i = c);
|
|
29
|
+
}
|
|
30
|
+
const L = i.furthestLane.extendedStopLine;
|
|
31
|
+
(await p.getIntersectPointsOfStopLineAndLane(
|
|
32
|
+
L,
|
|
33
|
+
e.lanePolygon,
|
|
34
|
+
[5]
|
|
35
|
+
)).length && (this.entrance = i, await this.splitStopLine(), console.log(`${this.id}的对应进口道是${(a = this.entrance) == null ? void 0 : a.id}`));
|
|
36
|
+
}
|
|
37
|
+
addLanes(t) {
|
|
38
|
+
for (const e of t.lanes) {
|
|
39
|
+
const n = new f();
|
|
40
|
+
n.lanePolygon = e, n.isEntry = !1, this.lanes.push(n);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async splitStopLine() {
|
|
44
|
+
if (this.entrance) {
|
|
45
|
+
for (const t of this.lanes) {
|
|
46
|
+
const e = await p.getIntersectPointsOfStopLineAndLane(
|
|
47
|
+
this.entrance.furthestLane.extendedStopLine,
|
|
48
|
+
t.lanePolygon,
|
|
49
|
+
[0.5, 1, 2, 3, 4, 5, 6, 7, 8]
|
|
50
|
+
);
|
|
51
|
+
if (e.length !== 0) {
|
|
52
|
+
switch (this.entrance.quadrantCode) {
|
|
53
|
+
case o.West:
|
|
54
|
+
e.sort((n, s) => n[1] - s[1]);
|
|
55
|
+
break;
|
|
56
|
+
case o.North:
|
|
57
|
+
e.sort((n, s) => n[0] - s[0]);
|
|
58
|
+
break;
|
|
59
|
+
case o.East:
|
|
60
|
+
e.sort((n, s) => s[1] - n[1]);
|
|
61
|
+
break;
|
|
62
|
+
case o.South:
|
|
63
|
+
e.sort((n, s) => s[0] - n[0]);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
t.stopLine = new h({ paths: [e] }), await t.getLaneDirection();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
this.lanes.sort((t, e) => {
|
|
70
|
+
switch (this.entrance.quadrantCode) {
|
|
71
|
+
case o.West:
|
|
72
|
+
return t.stopLine.extent.center.y - e.stopLine.extent.center.y;
|
|
73
|
+
case o.North:
|
|
74
|
+
return t.stopLine.extent.center.x - e.stopLine.extent.center.x;
|
|
75
|
+
case o.East:
|
|
76
|
+
return e.stopLine.extent.center.y - t.stopLine.extent.center.y;
|
|
77
|
+
case o.South:
|
|
78
|
+
return e.stopLine.extent.center.x - t.stopLine.extent.center.x;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
C as default
|
|
86
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import l from "@arcgis/core/Graphic";
|
|
2
|
+
import { Point as w } from "@arcgis/core/geometry";
|
|
3
|
+
import h from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
+
import { TextSymbol as y, SimpleMarkerSymbol as f } from "@arcgis/core/symbols";
|
|
5
|
+
import p from "../common-utils.mjs";
|
|
6
|
+
import L from "./cross.mjs";
|
|
7
|
+
import A from "./search-nearby-lanes.mjs";
|
|
8
|
+
import N from "./indicator-area.mjs";
|
|
9
|
+
class k {
|
|
10
|
+
/**
|
|
11
|
+
* 道路配置工具相关功能
|
|
12
|
+
* @param map map实例
|
|
13
|
+
* @param mapConfig 地图配置
|
|
14
|
+
*/
|
|
15
|
+
constructor(e) {
|
|
16
|
+
this.view = e, this.laneNumberLayer = new h({
|
|
17
|
+
minScale: 2257
|
|
18
|
+
}), this.view.map.add(this.laneNumberLayer), this.crossIndicatorAreaLayer = new h(), this.view.map.add(this.crossIndicatorAreaLayer);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 在进口道的顶端显示车道序号
|
|
22
|
+
* @param params
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
showLaneNumber(e) {
|
|
26
|
+
const { lanes: i } = e, s = [], o = [];
|
|
27
|
+
for (const m of i) {
|
|
28
|
+
const { crossId: n, laneNumber: a, stopLineCenter: r, laneDirection: c } = m;
|
|
29
|
+
if (!r[0] || !r[1])
|
|
30
|
+
continue;
|
|
31
|
+
let t = new w({
|
|
32
|
+
longitude: r[0],
|
|
33
|
+
latitude: r[1]
|
|
34
|
+
});
|
|
35
|
+
c && (t = p.destinationWithPoint(
|
|
36
|
+
t,
|
|
37
|
+
c,
|
|
38
|
+
-3
|
|
39
|
+
));
|
|
40
|
+
const d = {
|
|
41
|
+
type: "laneNumber",
|
|
42
|
+
id: `${n}_${a}`,
|
|
43
|
+
crossId: n,
|
|
44
|
+
laneNumber: a
|
|
45
|
+
}, u = new l({
|
|
46
|
+
geometry: t,
|
|
47
|
+
symbol: new y({
|
|
48
|
+
text: a,
|
|
49
|
+
color: "red",
|
|
50
|
+
verticalAlignment: "middle",
|
|
51
|
+
font: {
|
|
52
|
+
size: 10
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
o.push(u);
|
|
57
|
+
const b = new l({
|
|
58
|
+
geometry: t,
|
|
59
|
+
// 半透明白色圆点
|
|
60
|
+
symbol: new f({
|
|
61
|
+
style: "circle",
|
|
62
|
+
color: [255, 255, 255, 0.8],
|
|
63
|
+
size: 14,
|
|
64
|
+
outline: {
|
|
65
|
+
color: "white",
|
|
66
|
+
width: 1
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
attributes: d
|
|
70
|
+
});
|
|
71
|
+
s.push(b);
|
|
72
|
+
}
|
|
73
|
+
return this.laneNumberLayer.addMany(s), this.laneNumberLayer.addMany(o), { status: 0, message: "车道序号显示成功" };
|
|
74
|
+
}
|
|
75
|
+
/** 清除车道序号 */
|
|
76
|
+
clearLaneNumber() {
|
|
77
|
+
this.laneNumberLayer.removeAll();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 初始化算法区域生成工具
|
|
81
|
+
* @param params
|
|
82
|
+
* @returns Promise<IResult>
|
|
83
|
+
*/
|
|
84
|
+
async initializeSearch(e) {
|
|
85
|
+
var i;
|
|
86
|
+
return this.searchLaneTool || (this.searchLaneTool = new A(this.view)), this.cross = new L({ id: e.crossId, center: e.crossCenter }), (i = this.indicatorAreaTool) == null || i.clearIndicatorArea(), this.searchLaneTool.initializeSearch(e);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* 生成路口指标计算区
|
|
90
|
+
*/
|
|
91
|
+
async calCrossIndicatorArea() {
|
|
92
|
+
this.cross.initialized || await this.initializeCross(), this.indicatorAreaTool || (this.indicatorAreaTool = new N(this.view)), await this.indicatorAreaTool.showCrossIndicatorArea(this.cross);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 路口初始化,计算周边进口道与车道
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
async initializeCross() {
|
|
99
|
+
if (!this.searchLaneTool)
|
|
100
|
+
return {
|
|
101
|
+
status: -1,
|
|
102
|
+
message: "算法区域生成工具未初始化, 请先执行initializeSearch"
|
|
103
|
+
};
|
|
104
|
+
const e = await this.searchLaneTool.getCurrentSearchResult();
|
|
105
|
+
this.searchLaneTool.clearResult(), await this.cross.initialize(e);
|
|
106
|
+
const i = this.cross.getLaneNumberInfo();
|
|
107
|
+
this.showLaneNumber({ lanes: i });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
k as default
|
|
112
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import a from "@arcgis/core/layers/GraphicsLayer";
|
|
2
|
+
import i from "@arcgis/core/Graphic";
|
|
3
|
+
import { SimpleFillSymbol as o } from "@arcgis/core/symbols";
|
|
4
|
+
import t from "@arcgis/core/widgets/Sketch/SketchViewModel";
|
|
5
|
+
class h {
|
|
6
|
+
constructor(r) {
|
|
7
|
+
this.view = r, this.indicatorAreaLayer = new a(), this.view.map.add(this.indicatorAreaLayer), this.sketchViewModel = new t({
|
|
8
|
+
view: this.view,
|
|
9
|
+
layer: this.indicatorAreaLayer,
|
|
10
|
+
defaultUpdateOptions: {
|
|
11
|
+
tool: "reshape"
|
|
12
|
+
},
|
|
13
|
+
snappingOptions: {
|
|
14
|
+
enabled: !0
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 显示路口指标计算区
|
|
20
|
+
* @param cross
|
|
21
|
+
*/
|
|
22
|
+
async showCrossIndicatorArea(r) {
|
|
23
|
+
this.indicatorAreaLayer.removeAll();
|
|
24
|
+
const e = await r.calCrossIndicatorArea();
|
|
25
|
+
e ? (this.crossIndicatorAreaGraphic = new i({
|
|
26
|
+
geometry: e,
|
|
27
|
+
symbol: new o({
|
|
28
|
+
color: [255, 0, 0, 0.5],
|
|
29
|
+
outline: {
|
|
30
|
+
color: [255, 0, 0]
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
}), this.indicatorAreaLayer.add(this.crossIndicatorAreaGraphic)) : this.sketchViewModel.create("polygon");
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 清除所有指标计算区
|
|
37
|
+
*/
|
|
38
|
+
clearIndicatorArea() {
|
|
39
|
+
this.indicatorAreaLayer.removeAll();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
h as default
|
|
44
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import L from "@turf/bearing";
|
|
2
|
+
import n from "../common-utils.mjs";
|
|
3
|
+
class a {
|
|
4
|
+
set stopLine(t) {
|
|
5
|
+
this._stopLine = t, this.stopLineCenter = t.extent.center;
|
|
6
|
+
}
|
|
7
|
+
get stopLine() {
|
|
8
|
+
return this._stopLine;
|
|
9
|
+
}
|
|
10
|
+
/** 停止线延长线,用于计算和其他进口道停止线的交点 */
|
|
11
|
+
get extendedStopLine() {
|
|
12
|
+
return this._extendedStopLine || (this._extendedStopLine = n.extendLineInTowDir(
|
|
13
|
+
this._stopLine,
|
|
14
|
+
100
|
|
15
|
+
)), this._extendedStopLine;
|
|
16
|
+
}
|
|
17
|
+
async getLaneDirection() {
|
|
18
|
+
const t = n.extendLineInTowDir(this._stopLine, 10), i = this._stopLine.paths[0];
|
|
19
|
+
let e = await n.getIntersectPointOfLineAndPolygon(
|
|
20
|
+
t,
|
|
21
|
+
this.lanePolygon,
|
|
22
|
+
5
|
|
23
|
+
);
|
|
24
|
+
e.length === 0 && (e = await n.getIntersectPointOfLineAndPolygon(
|
|
25
|
+
t,
|
|
26
|
+
this.lanePolygon,
|
|
27
|
+
-5
|
|
28
|
+
)), (!i.length || !e.length) && console.log("计算方位角失败", i, e);
|
|
29
|
+
const s = e[0], r = i[0], o = L(r, s);
|
|
30
|
+
this.laneDirection = o < 0 ? o + 360 : o;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
a as default
|
|
35
|
+
};
|