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,122 @@
|
|
|
1
|
+
import u from "@arcgis/core/Graphic";
|
|
2
|
+
import l from "@arcgis/core/layers/FeatureLayer";
|
|
3
|
+
import * as a from "@turf/helpers";
|
|
4
|
+
import { convex as p, buffer as f } from "@turf/turf";
|
|
5
|
+
import n from "../common-utils.mjs";
|
|
6
|
+
import { districtDashLineLayerOptions as C, districtSolidLineLayerOptions as L } from "./layer-symbol.mjs";
|
|
7
|
+
class x {
|
|
8
|
+
constructor(t) {
|
|
9
|
+
this.style = "", this.view = t, this.districtControllerDashLayer = new l(
|
|
10
|
+
C
|
|
11
|
+
), this.districtControllerDashLayer.spatialReference = t.spatialReference, this.districtControllerSolidLayer = new l(
|
|
12
|
+
L
|
|
13
|
+
), this.districtControllerSolidLayer.spatialReference = t.spatialReference, this.districtControllerSolidLayer.popupEnabled = !0, this.view.map.addMany([
|
|
14
|
+
this.districtControllerDashLayer,
|
|
15
|
+
this.districtControllerSolidLayer
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 显示区控
|
|
20
|
+
* @param controllers 区控控制器数组
|
|
21
|
+
*/
|
|
22
|
+
async showDistricts(t) {
|
|
23
|
+
await this.clearDistricts();
|
|
24
|
+
const i = [];
|
|
25
|
+
for (let e = 0; e < t.length; e++) {
|
|
26
|
+
const r = t[e], s = r.getAllSignalCoordinates();
|
|
27
|
+
let o = null;
|
|
28
|
+
if (s.length >= 2)
|
|
29
|
+
if (s.length === 2)
|
|
30
|
+
o = a.lineString(s);
|
|
31
|
+
else {
|
|
32
|
+
const h = a.featureCollection(
|
|
33
|
+
s.map((y) => a.point(y))
|
|
34
|
+
);
|
|
35
|
+
o = p(h), o || (o = a.lineString(s));
|
|
36
|
+
}
|
|
37
|
+
else if (s.length === 1)
|
|
38
|
+
o = a.point(s[0]);
|
|
39
|
+
else
|
|
40
|
+
continue;
|
|
41
|
+
const d = f(o.geometry, 200, {
|
|
42
|
+
units: "meters"
|
|
43
|
+
}), c = new u({
|
|
44
|
+
geometry: {
|
|
45
|
+
type: "polyline",
|
|
46
|
+
paths: d.geometry.coordinates
|
|
47
|
+
},
|
|
48
|
+
attributes: {
|
|
49
|
+
ObjectID: e,
|
|
50
|
+
id: r.id,
|
|
51
|
+
name: r.name,
|
|
52
|
+
subDistrictCount: r.subDistrictCount,
|
|
53
|
+
signalCount: r.signalCount,
|
|
54
|
+
parentId: r.parentId,
|
|
55
|
+
parentName: r.parentName,
|
|
56
|
+
selected: this.style,
|
|
57
|
+
type: "district"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
i.push(c);
|
|
61
|
+
}
|
|
62
|
+
await this.districtControllerDashLayer.applyEdits({
|
|
63
|
+
addFeatures: i
|
|
64
|
+
}), await this.districtControllerSolidLayer.applyEdits({
|
|
65
|
+
addFeatures: i
|
|
66
|
+
}), await n.viewGoto(this.view, i);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 清除区控图层
|
|
70
|
+
*/
|
|
71
|
+
async clearDistricts() {
|
|
72
|
+
let t = await this.districtControllerDashLayer.queryFeatures();
|
|
73
|
+
await this.districtControllerDashLayer.applyEdits({
|
|
74
|
+
deleteFeatures: t.features
|
|
75
|
+
}), this.districtControllerDashLayer.definitionExpression = "1=1", t = await this.districtControllerSolidLayer.queryFeatures(), await this.districtControllerSolidLayer.applyEdits({
|
|
76
|
+
deleteFeatures: t.features
|
|
77
|
+
}), this.districtControllerSolidLayer.definitionExpression = "1=1";
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 设置区控图层可见性
|
|
81
|
+
* @param visible
|
|
82
|
+
*/
|
|
83
|
+
setVisible(t) {
|
|
84
|
+
this.districtControllerDashLayer.visible = t, this.districtControllerSolidLayer.visible = t;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 定位区控
|
|
88
|
+
* @param id
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
async locateDistrict(t) {
|
|
92
|
+
const i = this.districtControllerDashLayer.createQuery();
|
|
93
|
+
i.where = `id = '${t}'`, i.returnGeometry = !0, i.outFields = ["*"];
|
|
94
|
+
const e = await this.districtControllerDashLayer.queryFeatures(i);
|
|
95
|
+
return e.features.length > 0 ? (await n.viewGoto(this.view, e.features), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 高亮区控, 其他区控隐藏
|
|
99
|
+
* @param id 区控ID
|
|
100
|
+
* @return 返回高亮区控的数量
|
|
101
|
+
*/
|
|
102
|
+
async highlightDistrict(t) {
|
|
103
|
+
const i = this.districtControllerDashLayer.definitionExpression;
|
|
104
|
+
this.districtControllerDashLayer.definitionExpression = `id = '${t.id}'`;
|
|
105
|
+
const e = await this.districtControllerDashLayer.queryFeatures(), r = e.features.length;
|
|
106
|
+
return r > 0 ? (this.districtControllerSolidLayer.definitionExpression = `id = '${t.id}'`, await n.viewGoto(
|
|
107
|
+
this.view,
|
|
108
|
+
e.features,
|
|
109
|
+
t.needZoom !== !1
|
|
110
|
+
)) : this.districtControllerDashLayer.definitionExpression = i, r;
|
|
111
|
+
}
|
|
112
|
+
filter(t) {
|
|
113
|
+
const i = `id = '${t}'`;
|
|
114
|
+
this.districtControllerDashLayer.definitionExpression = i, this.districtControllerSolidLayer.definitionExpression = i;
|
|
115
|
+
}
|
|
116
|
+
resetFilter() {
|
|
117
|
+
this.districtControllerDashLayer.definitionExpression = "1=1", this.districtControllerSolidLayer.definitionExpression = "1=1";
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
x as default
|
|
122
|
+
};
|
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import n from "@arcgis/core/Graphic";
|
|
2
|
+
import u from "@arcgis/core/layers/GraphicsLayer";
|
|
3
|
+
import g from "@turf/buffer";
|
|
4
|
+
import p from "@turf/convex";
|
|
5
|
+
import * as a from "@turf/helpers";
|
|
6
|
+
import h from "axios";
|
|
7
|
+
import b from "concaveman";
|
|
8
|
+
import f from "../../../stores/index.mjs";
|
|
9
|
+
class L {
|
|
10
|
+
constructor(e) {
|
|
11
|
+
var i;
|
|
12
|
+
this.crossScale = 5e3, this.hasGpu = !1, this.crossIdsInDistrict = [], this.view = e, this.hasGpu = localStorage.getItem("gpu") !== "Unknown";
|
|
13
|
+
const r = f.useAppDataStore.mapConfig;
|
|
14
|
+
this.openDriveServer = (i = r.openDriveServer) == null ? void 0 : i.url, this.districtControllerLayer = new u({
|
|
15
|
+
id: "districtControllerLayer"
|
|
16
|
+
}), this.subDistrictControllerLayer = new u({
|
|
17
|
+
id: "subDistrictControllerLayer"
|
|
18
|
+
}), this.crossLayer = new u({
|
|
19
|
+
id: "crossLayer"
|
|
20
|
+
}), this.view.map.addMany([
|
|
21
|
+
this.districtControllerLayer,
|
|
22
|
+
this.subDistrictControllerLayer,
|
|
23
|
+
this.crossLayer
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 显示单个子区
|
|
28
|
+
* @param params
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
showSubSignalControlArea(e) {
|
|
32
|
+
this.crossLayer.removeAll(), this.crossLayer.visible = !0;
|
|
33
|
+
const r = e.children.map((i) => {
|
|
34
|
+
const s = { ...i, selected: !0 };
|
|
35
|
+
return new n({
|
|
36
|
+
geometry: {
|
|
37
|
+
type: "point",
|
|
38
|
+
x: i.longitude,
|
|
39
|
+
y: i.latitude
|
|
40
|
+
},
|
|
41
|
+
symbol: this.getCrossSymbolInSubDistrict(s),
|
|
42
|
+
attributes: s
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
return this.crossLayer.addMany(r), this.view.goTo(r, {
|
|
46
|
+
duration: this.hasGpu ? 1e3 : 0
|
|
47
|
+
}), { status: 0, message: "ok" };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 点击路口时
|
|
51
|
+
* @param event
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
async handleViewClick(e) {
|
|
55
|
+
var s;
|
|
56
|
+
const r = (s = (await this.view.hitTest(e, {
|
|
57
|
+
include: [this.crossLayer]
|
|
58
|
+
})).results) == null ? void 0 : s.filter(
|
|
59
|
+
(o) => o.type === "graphic"
|
|
60
|
+
);
|
|
61
|
+
if (r.length === 0)
|
|
62
|
+
return;
|
|
63
|
+
const i = r[0].graphic;
|
|
64
|
+
i.getAttribute("selected") ? i.getAttribute("signalId") && (this.removeCrossCallback && this.removeCrossCallback({ id: i.getAttribute("id") }), i.setAttribute("selected", !1), i.symbol = this.getCrossSymbolInSubDistrict(
|
|
65
|
+
i.attributes
|
|
66
|
+
)) : (i.getAttribute("signalId") && (this.addCrossCallback && this.addCrossCallback(i.attributes), i.setAttribute("selected", !0), i.symbol = this.getCrossSymbolInSubDistrict(
|
|
67
|
+
i.attributes
|
|
68
|
+
)), await this.showNearbyCrosses(i.getAttribute("id")));
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 显示周边的路口
|
|
72
|
+
* @param crossIds
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
75
|
+
async showNearbyCrosses(e) {
|
|
76
|
+
const t = await h.get(
|
|
77
|
+
`http://${this.openDriveServer}/api/computable/getRelatedNodesForNode`,
|
|
78
|
+
{ params: { nodeIds: e } }
|
|
79
|
+
);
|
|
80
|
+
if (t.status === 200)
|
|
81
|
+
if (t.data.status === 0) {
|
|
82
|
+
const r = t.data.result, i = [];
|
|
83
|
+
for (const s of r) {
|
|
84
|
+
const o = s.nodeId;
|
|
85
|
+
if (o.startsWith("-"))
|
|
86
|
+
continue;
|
|
87
|
+
if (s.signalId && !this.crossIdsInDistrict.includes(o)) {
|
|
88
|
+
console.log("不是此区控内的路口", o);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (this.crossLayer.graphics.some(
|
|
92
|
+
(c) => c.getAttribute("id") === o
|
|
93
|
+
))
|
|
94
|
+
continue;
|
|
95
|
+
const m = new n({
|
|
96
|
+
geometry: {
|
|
97
|
+
type: "point",
|
|
98
|
+
x: s.lon,
|
|
99
|
+
y: s.lat
|
|
100
|
+
},
|
|
101
|
+
symbol: this.getCrossSymbolInSubDistrict(s),
|
|
102
|
+
attributes: {
|
|
103
|
+
id: o,
|
|
104
|
+
name: s.name,
|
|
105
|
+
signalId: s.signalId,
|
|
106
|
+
selected: !1
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
i.push(m);
|
|
110
|
+
}
|
|
111
|
+
return this.crossLayer.addMany(i), { status: 0, message: "ok" };
|
|
112
|
+
} else
|
|
113
|
+
return { status: -1, message: t.data.message };
|
|
114
|
+
else
|
|
115
|
+
return { status: -1, message: "请求失败" };
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 编辑子区的路口
|
|
119
|
+
* @returns
|
|
120
|
+
*/
|
|
121
|
+
async editSubSignalControlArea(e) {
|
|
122
|
+
if (e.odrServer) {
|
|
123
|
+
this.openDriveServer = e.odrServer, this.crossIdsInDistrict = e.crossesInArea.map((s) => s.id);
|
|
124
|
+
const t = a.featureCollection(
|
|
125
|
+
e.crossesInArea.map(
|
|
126
|
+
(s) => a.point([s.longitude, s.latitude])
|
|
127
|
+
)
|
|
128
|
+
), r = p(t);
|
|
129
|
+
r && (this.districtControllerLayer.removeAll(), this.districtControllerLayer.add(
|
|
130
|
+
new n({
|
|
131
|
+
geometry: {
|
|
132
|
+
type: "polygon",
|
|
133
|
+
rings: r.geometry.coordinates
|
|
134
|
+
},
|
|
135
|
+
symbol: {
|
|
136
|
+
type: "simple-fill",
|
|
137
|
+
style: "none",
|
|
138
|
+
outline: {
|
|
139
|
+
color: [61, 139, 249],
|
|
140
|
+
width: 3,
|
|
141
|
+
style: "long-dash"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
)), this.addCrossCallback = e.addCrossCallback, this.removeCrossCallback = e.removeCrossCallback, this.viewClickWatcher || (this.viewClickWatcher = this.view.on("click", async (s) => {
|
|
146
|
+
await this.handleViewClick(s);
|
|
147
|
+
}));
|
|
148
|
+
const i = this.crossLayer.graphics.toArray().map((s) => s.getAttribute("id")).join(",");
|
|
149
|
+
return await this.showNearbyCrosses(i);
|
|
150
|
+
} else
|
|
151
|
+
return { status: 1, message: "未配置OpenDriveServer" };
|
|
152
|
+
}
|
|
153
|
+
stopEditSubSignalControlArea() {
|
|
154
|
+
var t;
|
|
155
|
+
(t = this.viewClickWatcher) == null || t.remove(), this.viewClickWatcher = void 0;
|
|
156
|
+
const e = this.crossLayer.graphics.filter(
|
|
157
|
+
(r) => r.getAttribute("signalId") === "" || !r.getAttribute("signalId") || !r.getAttribute("selected")
|
|
158
|
+
);
|
|
159
|
+
this.crossLayer.removeMany(e.toArray()), this.districtControllerLayer.removeAll();
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* 从外部接口选中一个路口
|
|
163
|
+
* @param id
|
|
164
|
+
*/
|
|
165
|
+
selectSubSignalControlAreaCross(e) {
|
|
166
|
+
return this.crossLayer.graphics.forEach((t) => {
|
|
167
|
+
if (t.getAttribute("id") === e && !t.getAttribute("selected"))
|
|
168
|
+
return t.setAttribute("selected", !0), t.symbol = this.getCrossSymbolInSubDistrict(
|
|
169
|
+
t.attributes
|
|
170
|
+
), { status: 0, message: "ok" };
|
|
171
|
+
}), { status: 0, message: "未找到" };
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* 从外部接口取消选中一个路口
|
|
175
|
+
* @param id
|
|
176
|
+
*/
|
|
177
|
+
unselectSubSignalControlAreaCross(e) {
|
|
178
|
+
return this.crossLayer.graphics.forEach((t) => {
|
|
179
|
+
if (t.getAttribute("id") === e && t.getAttribute("selected"))
|
|
180
|
+
return t.setAttribute("selected", !1), t.symbol = this.getCrossSymbolInSubDistrict(
|
|
181
|
+
t.attributes
|
|
182
|
+
), { status: 0, message: "ok" };
|
|
183
|
+
}), { status: 0, message: "未找到" };
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* 在区控\子区\路口图层中查找对应的graphic
|
|
187
|
+
* @param id
|
|
188
|
+
* @returns
|
|
189
|
+
*/
|
|
190
|
+
findAreaGraphic(e) {
|
|
191
|
+
let t = this.districtControllerLayer.graphics.find(
|
|
192
|
+
(r) => r.attributes.id === e
|
|
193
|
+
);
|
|
194
|
+
return t || (t = this.subDistrictControllerLayer.graphics.find(
|
|
195
|
+
(r) => r.attributes.id === e
|
|
196
|
+
)), t || (t = this.crossLayer.graphics.find((r) => r.attributes.id === e)), t;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* 绘制区控与子区
|
|
200
|
+
* @param districtController
|
|
201
|
+
* @param isDistrict 是否是区控
|
|
202
|
+
* @returns
|
|
203
|
+
*/
|
|
204
|
+
drawArea(e, t) {
|
|
205
|
+
const r = e.getAllSignalCoordinates();
|
|
206
|
+
if (r.length >= 2) {
|
|
207
|
+
let s = null;
|
|
208
|
+
if (r.length === 2)
|
|
209
|
+
s = a.lineString(r);
|
|
210
|
+
else {
|
|
211
|
+
if (t) {
|
|
212
|
+
const y = a.featureCollection(
|
|
213
|
+
r.map((d) => a.point(d))
|
|
214
|
+
);
|
|
215
|
+
s = p(y);
|
|
216
|
+
} else {
|
|
217
|
+
const y = b(r, 0.5);
|
|
218
|
+
y.length >= 4 && (s = a.polygon([y]));
|
|
219
|
+
}
|
|
220
|
+
s || (s = a.lineString(r));
|
|
221
|
+
}
|
|
222
|
+
const o = g(
|
|
223
|
+
s.geometry,
|
|
224
|
+
// 区控面积更大,需要更大的缓冲半径
|
|
225
|
+
t ? 200 : 30,
|
|
226
|
+
{
|
|
227
|
+
units: "meters"
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
let l;
|
|
231
|
+
t ? l = [
|
|
232
|
+
{
|
|
233
|
+
fieldName: "id",
|
|
234
|
+
label: "区控编号"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
fieldName: "crossCount",
|
|
238
|
+
label: "路口数量"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
fieldName: "subDistrictCount",
|
|
242
|
+
label: "子区数量"
|
|
243
|
+
}
|
|
244
|
+
] : l = [
|
|
245
|
+
{
|
|
246
|
+
fieldName: "parentName",
|
|
247
|
+
label: "所属区控"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
fieldName: "crossCount",
|
|
251
|
+
label: "路口数量"
|
|
252
|
+
}
|
|
253
|
+
];
|
|
254
|
+
const m = {
|
|
255
|
+
type: "signalControlArea",
|
|
256
|
+
id: e.id,
|
|
257
|
+
name: e.name,
|
|
258
|
+
parentId: e.parentId,
|
|
259
|
+
parentName: e.parentName,
|
|
260
|
+
crossCount: e.signalCount,
|
|
261
|
+
subDistrictCount: e.subDistrictCount
|
|
262
|
+
}, c = new n({
|
|
263
|
+
geometry: {
|
|
264
|
+
type: "polygon",
|
|
265
|
+
rings: o.geometry.coordinates
|
|
266
|
+
},
|
|
267
|
+
symbol: {
|
|
268
|
+
type: "simple-fill",
|
|
269
|
+
style: "none",
|
|
270
|
+
// color: [...districtController.areaColor, 0.3],
|
|
271
|
+
outline: {
|
|
272
|
+
color: t ? [111, 100, 255] : [5, 196, 104],
|
|
273
|
+
width: 3,
|
|
274
|
+
style: t ? "long-dash" : "solid"
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
attributes: m,
|
|
278
|
+
popupTemplate: {
|
|
279
|
+
title: `${e.name}`,
|
|
280
|
+
content: [
|
|
281
|
+
{
|
|
282
|
+
type: "fields",
|
|
283
|
+
fieldInfos: l
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
t ? this.districtControllerLayer.add(c) : this.subDistrictControllerLayer.add(c);
|
|
289
|
+
}
|
|
290
|
+
for (const s of e.subDistricts)
|
|
291
|
+
this.drawArea(s, !1);
|
|
292
|
+
const i = [];
|
|
293
|
+
e.signals.forEach((s) => {
|
|
294
|
+
const o = {
|
|
295
|
+
type: "cross",
|
|
296
|
+
id: s.id,
|
|
297
|
+
name: s.name,
|
|
298
|
+
signalId: s.signalId,
|
|
299
|
+
nodeId: s.nodeId,
|
|
300
|
+
districtId: t ? e.id : e.parentId,
|
|
301
|
+
districtName: t ? e.name : e.parentName,
|
|
302
|
+
subDistrictId: t ? "" : e.id,
|
|
303
|
+
subDistrictName: t ? "" : e.name,
|
|
304
|
+
isKey: s.isKey
|
|
305
|
+
}, l = new n({
|
|
306
|
+
geometry: {
|
|
307
|
+
type: "point",
|
|
308
|
+
x: s.longitude,
|
|
309
|
+
y: s.latitude
|
|
310
|
+
},
|
|
311
|
+
symbol: this.getCrossGraphicSymbol(o, "marker"),
|
|
312
|
+
attributes: o,
|
|
313
|
+
popupTemplate: {
|
|
314
|
+
title: s.name,
|
|
315
|
+
content: [
|
|
316
|
+
{
|
|
317
|
+
type: "fields",
|
|
318
|
+
fieldInfos: [
|
|
319
|
+
{
|
|
320
|
+
fieldName: "districtName",
|
|
321
|
+
label: "区控名称"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
fieldName: "subDistrictName",
|
|
325
|
+
label: "子区名称"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
fieldName: "signalId",
|
|
329
|
+
label: "信号机编号"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
fieldName: "nodeId",
|
|
333
|
+
label: "路口编号"
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
}
|
|
337
|
+
]
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
i.push(l);
|
|
341
|
+
}), this.crossLayer.addMany(i);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* 显示子区时路口的样式
|
|
345
|
+
* @param attributes
|
|
346
|
+
* @returns
|
|
347
|
+
*/
|
|
348
|
+
getCrossSymbolInSubDistrict(e) {
|
|
349
|
+
return e.signalId && e.signalId !== "" ? {
|
|
350
|
+
type: "cim",
|
|
351
|
+
data: {
|
|
352
|
+
type: "CIMSymbolReference",
|
|
353
|
+
primitiveOverrides: [
|
|
354
|
+
{
|
|
355
|
+
type: "CIMPrimitiveOverride",
|
|
356
|
+
primitiveName: "textGraphic",
|
|
357
|
+
propertyName: "TextString",
|
|
358
|
+
valueExpressionInfo: {
|
|
359
|
+
type: "CIMExpressionInfo",
|
|
360
|
+
title: "Custom",
|
|
361
|
+
expression: 'Replace($feature.name, "与", "/") + " " + $feature.signalId',
|
|
362
|
+
returnType: "Default"
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
],
|
|
366
|
+
symbol: {
|
|
367
|
+
type: "CIMPointSymbol",
|
|
368
|
+
symbolLayers: [
|
|
369
|
+
// 路口名称
|
|
370
|
+
{
|
|
371
|
+
type: "CIMVectorMarker",
|
|
372
|
+
size: 32,
|
|
373
|
+
colorLocked: !0,
|
|
374
|
+
anchorPointUnits: "Relative",
|
|
375
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
376
|
+
markerGraphics: [
|
|
377
|
+
{
|
|
378
|
+
type: "CIMMarkerGraphic",
|
|
379
|
+
primitiveName: "textGraphic",
|
|
380
|
+
geometry: { x: 0, y: 0 },
|
|
381
|
+
symbol: {
|
|
382
|
+
type: "CIMTextSymbol",
|
|
383
|
+
height: 12,
|
|
384
|
+
horizontalAlignment: "Center",
|
|
385
|
+
offsetX: 0,
|
|
386
|
+
offsetY: 20,
|
|
387
|
+
haloSize: 1,
|
|
388
|
+
haloSymbol: {
|
|
389
|
+
type: "CIMPolygonSymbol",
|
|
390
|
+
symbolLayers: [
|
|
391
|
+
{
|
|
392
|
+
type: "CIMSolidFill",
|
|
393
|
+
enable: !0,
|
|
394
|
+
color: [255, 255, 255, 255]
|
|
395
|
+
}
|
|
396
|
+
]
|
|
397
|
+
},
|
|
398
|
+
symbol: {
|
|
399
|
+
type: "CIMPolygonSymbol",
|
|
400
|
+
symbolLayers: [
|
|
401
|
+
{
|
|
402
|
+
type: "CIMSolidFill",
|
|
403
|
+
enable: !0,
|
|
404
|
+
color: [0, 0, 0, 255]
|
|
405
|
+
}
|
|
406
|
+
]
|
|
407
|
+
},
|
|
408
|
+
verticalAlignment: "Center"
|
|
409
|
+
},
|
|
410
|
+
textString: ""
|
|
411
|
+
}
|
|
412
|
+
],
|
|
413
|
+
scaleSymbolsProportionally: !0,
|
|
414
|
+
respectFrame: !0
|
|
415
|
+
},
|
|
416
|
+
// 路口图标
|
|
417
|
+
{
|
|
418
|
+
type: "CIMPictureMarker",
|
|
419
|
+
enable: !0,
|
|
420
|
+
anchorPoint: {
|
|
421
|
+
x: 0,
|
|
422
|
+
y: 0
|
|
423
|
+
},
|
|
424
|
+
anchorPointUnits: "Relative",
|
|
425
|
+
size: 30,
|
|
426
|
+
rotateClockwise: !0,
|
|
427
|
+
textureFilter: "Picture",
|
|
428
|
+
url: `/GisViewerAssets/Images/cross/${e.selected ? "gis_xhj_blue" : "gis_xhj_gray"}.png`
|
|
429
|
+
}
|
|
430
|
+
]
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
} : {
|
|
434
|
+
type: "picture-marker",
|
|
435
|
+
url: "/GisViewerAssets/Images/cross/gis_lkcz.png",
|
|
436
|
+
width: "20px",
|
|
437
|
+
height: "20px"
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* 生成路口点符号。在不同比例尺下,使用不同的符号
|
|
442
|
+
* @param attributes
|
|
443
|
+
* @param symbolType
|
|
444
|
+
* @returns
|
|
445
|
+
*/
|
|
446
|
+
getCrossGraphicSymbol(e, t) {
|
|
447
|
+
const r = e.isKey;
|
|
448
|
+
if (t === "marker")
|
|
449
|
+
return {
|
|
450
|
+
type: "simple-marker",
|
|
451
|
+
style: "circle",
|
|
452
|
+
color: r ? [254, 172, 22] : [5, 116, 255],
|
|
453
|
+
size: r ? 12 : 8,
|
|
454
|
+
outline: {
|
|
455
|
+
color: "white",
|
|
456
|
+
width: 1
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
if (t === "picture")
|
|
460
|
+
return {
|
|
461
|
+
type: "cim",
|
|
462
|
+
data: {
|
|
463
|
+
type: "CIMSymbolReference",
|
|
464
|
+
primitiveOverrides: [
|
|
465
|
+
{
|
|
466
|
+
// 将textGraphic的TextString替换为graphic.attributes.name
|
|
467
|
+
type: "CIMPrimitiveOverride",
|
|
468
|
+
primitiveName: "textGraphic",
|
|
469
|
+
propertyName: "TextString",
|
|
470
|
+
valueExpressionInfo: {
|
|
471
|
+
type: "CIMExpressionInfo",
|
|
472
|
+
title: "Custom",
|
|
473
|
+
expression: 'Replace($feature.name, "与", "/") + " " + $feature.signalId',
|
|
474
|
+
returnType: "Default"
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
],
|
|
478
|
+
symbol: {
|
|
479
|
+
type: "CIMPointSymbol",
|
|
480
|
+
symbolLayers: [
|
|
481
|
+
// 路口名称
|
|
482
|
+
{
|
|
483
|
+
type: "CIMVectorMarker",
|
|
484
|
+
size: 32,
|
|
485
|
+
colorLocked: !0,
|
|
486
|
+
anchorPointUnits: "Relative",
|
|
487
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
488
|
+
markerGraphics: [
|
|
489
|
+
{
|
|
490
|
+
type: "CIMMarkerGraphic",
|
|
491
|
+
primitiveName: "textGraphic",
|
|
492
|
+
geometry: { x: 0, y: 0 },
|
|
493
|
+
symbol: {
|
|
494
|
+
type: "CIMTextSymbol",
|
|
495
|
+
height: 12,
|
|
496
|
+
horizontalAlignment: "Center",
|
|
497
|
+
offsetX: 0,
|
|
498
|
+
offsetY: r ? 30 : 15,
|
|
499
|
+
haloSize: 1,
|
|
500
|
+
haloSymbol: {
|
|
501
|
+
type: "CIMPolygonSymbol",
|
|
502
|
+
symbolLayers: [
|
|
503
|
+
{
|
|
504
|
+
type: "CIMSolidFill",
|
|
505
|
+
enable: !0,
|
|
506
|
+
color: [255, 255, 255, 255]
|
|
507
|
+
}
|
|
508
|
+
]
|
|
509
|
+
},
|
|
510
|
+
symbol: {
|
|
511
|
+
type: "CIMPolygonSymbol",
|
|
512
|
+
symbolLayers: [
|
|
513
|
+
{
|
|
514
|
+
type: "CIMSolidFill",
|
|
515
|
+
enable: !0,
|
|
516
|
+
color: [0, 0, 0, 255]
|
|
517
|
+
}
|
|
518
|
+
]
|
|
519
|
+
},
|
|
520
|
+
verticalAlignment: "Center"
|
|
521
|
+
},
|
|
522
|
+
textString: ""
|
|
523
|
+
}
|
|
524
|
+
],
|
|
525
|
+
scaleSymbolsProportionally: !0,
|
|
526
|
+
respectFrame: !0
|
|
527
|
+
},
|
|
528
|
+
// 路口图标
|
|
529
|
+
{
|
|
530
|
+
type: "CIMPictureMarker",
|
|
531
|
+
enable: !0,
|
|
532
|
+
anchorPoint: {
|
|
533
|
+
x: 0,
|
|
534
|
+
y: 0
|
|
535
|
+
},
|
|
536
|
+
anchorPointUnits: "Relative",
|
|
537
|
+
size: r ? 40 : 20,
|
|
538
|
+
rotateClockwise: !0,
|
|
539
|
+
textureFilter: "Picture",
|
|
540
|
+
url: `/GisViewerAssets/Images/cross/${r ? "gis_gjxklk_orange" : "gis_xhj_blue"}.png`
|
|
541
|
+
}
|
|
542
|
+
]
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
export {
|
|
549
|
+
L as default
|
|
550
|
+
};
|