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,140 @@
|
|
|
1
|
+
import c from "../../../stores/index.mjs";
|
|
2
|
+
import o from "./cross-renderer.mjs";
|
|
3
|
+
import r from "./district-controller.mjs";
|
|
4
|
+
import a from "./district-renderer.mjs";
|
|
5
|
+
import l from "./signal-renderer.mjs";
|
|
6
|
+
import d from "./sub-district-renderer.mjs";
|
|
7
|
+
class f {
|
|
8
|
+
// private roadLines!: IRoadLine[];
|
|
9
|
+
constructor(t) {
|
|
10
|
+
this.view = t;
|
|
11
|
+
const s = c.useAppDataStore;
|
|
12
|
+
this.mapConfig = JSON.parse(JSON.stringify(s.mapConfig)), this.districtRenderer = new a(t), this.subDistrictRenderer = new d(t), this.signalRenderer = new l(t), this.crossRenderer = new o(t);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 显示所有区控、子区、信号机
|
|
16
|
+
* @param params
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
async showSignalControlArea(t) {
|
|
20
|
+
await this.clearSignalControlArea(), this.districtRenderer.setVisible(!1), this.subDistrictRenderer.setVisible(!1), this.signalRenderer.setClusterVisible(!1), this.signalRenderer.setPointVisible(!1);
|
|
21
|
+
const s = [], e = [];
|
|
22
|
+
for (const i of t.areaList) {
|
|
23
|
+
const n = new r(
|
|
24
|
+
i,
|
|
25
|
+
t.style || ""
|
|
26
|
+
);
|
|
27
|
+
s.push(n), e.push(...n.subDistricts);
|
|
28
|
+
}
|
|
29
|
+
return this.districtRenderer.style = t.style || "", await this.districtRenderer.showDistricts(s), await this.subDistrictRenderer.showSubDistricts(e), this.crossRenderer.addCrosses(s), { status: 0, message: "ok" };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 显示单个区控
|
|
33
|
+
* @param params
|
|
34
|
+
*/
|
|
35
|
+
async showDistrict(t) {
|
|
36
|
+
this.setLayerVisibility({ id: "district", visible: !0 }), this.setLayerVisibility({ id: "subDistrict", visible: !0 });
|
|
37
|
+
const s = new r(
|
|
38
|
+
t.areaList,
|
|
39
|
+
t.style || ""
|
|
40
|
+
);
|
|
41
|
+
await this.districtRenderer.showDistricts([s]), await this.subDistrictRenderer.showSubDistricts(
|
|
42
|
+
s.subDistricts
|
|
43
|
+
), await this.subDistrictRenderer.showRoads({
|
|
44
|
+
id: s.id,
|
|
45
|
+
type: "district"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 显示单个子区
|
|
50
|
+
* @param params
|
|
51
|
+
*/
|
|
52
|
+
async showSubDistrict(t) {
|
|
53
|
+
this.setLayerVisibility({ id: "subDistrict", visible: !0 });
|
|
54
|
+
const s = new r(
|
|
55
|
+
t.areaList,
|
|
56
|
+
t.style || ""
|
|
57
|
+
);
|
|
58
|
+
await this.subDistrictRenderer.showSubDistricts([s]), await this.subDistrictRenderer.showRoads({
|
|
59
|
+
id: s.id,
|
|
60
|
+
type: "subDistrict"
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 清空区控、子区、信号机
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
async clearSignalControlArea() {
|
|
68
|
+
return this.crossRenderer.clearCrosses(), await this.districtRenderer.clearDistricts(), await this.subDistrictRenderer.clearSubDistricts(), this.crossRenderer.clearCrosses(), { status: 0, message: "ok" };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 设置区控、子区、信号机图层可见性
|
|
72
|
+
* @param layerName
|
|
73
|
+
* @param visible
|
|
74
|
+
*/
|
|
75
|
+
setLayerVisibility(t) {
|
|
76
|
+
switch (t.visible === !1 && this.view.closePopup(), t.id) {
|
|
77
|
+
case "district":
|
|
78
|
+
this.districtRenderer.setVisible(t.visible);
|
|
79
|
+
break;
|
|
80
|
+
case "subDistrict":
|
|
81
|
+
this.subDistrictRenderer.setVisible(t.visible);
|
|
82
|
+
break;
|
|
83
|
+
case "signal":
|
|
84
|
+
t.visible === !1 ? this.crossRenderer.hideCrosses() : this.crossRenderer.showScatter();
|
|
85
|
+
break;
|
|
86
|
+
case "signalCluster":
|
|
87
|
+
t.visible === !1 ? this.crossRenderer.hideCrosses() : this.crossRenderer.showCluster();
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
return { status: 0, message: "ok" };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 定位区控、子区、信号机
|
|
94
|
+
* @param params
|
|
95
|
+
* @returns
|
|
96
|
+
*/
|
|
97
|
+
async locateSignalControlArea(t) {
|
|
98
|
+
switch (t.type) {
|
|
99
|
+
case "district":
|
|
100
|
+
return await this.districtRenderer.locateDistrict(t.id);
|
|
101
|
+
case "subDistrict":
|
|
102
|
+
return await this.subDistrictRenderer.locateSubDistrict(t.id);
|
|
103
|
+
case "signal":
|
|
104
|
+
return await this.signalRenderer.locateSignal(t.id);
|
|
105
|
+
default:
|
|
106
|
+
return { status: 1, message: "未知类型" };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* 高亮指定的区控、子区、信号机,其他隐藏
|
|
111
|
+
* @param params
|
|
112
|
+
* @returns
|
|
113
|
+
*/
|
|
114
|
+
async highlightSignalControlArea(t) {
|
|
115
|
+
switch (this.view.closePopup(), t.type) {
|
|
116
|
+
case "district":
|
|
117
|
+
return await this.districtRenderer.highlightDistrict(t) ? (this.subDistrictRenderer.filter(t), this.crossRenderer.filter(t), await this.subDistrictRenderer.showRoads(t), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
|
|
118
|
+
case "subDistrict": {
|
|
119
|
+
const { count: s, parentId: e } = await this.subDistrictRenderer.highlightSubDistrict(t);
|
|
120
|
+
return s > 0 ? (this.districtRenderer.filter(e), this.crossRenderer.filter(t), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
121
|
+
}
|
|
122
|
+
case "signal": {
|
|
123
|
+
const { districtId: s, subDistrictId: e, count: i } = await this.signalRenderer.highlightSignal(t.id);
|
|
124
|
+
return i > 0 ? (this.districtRenderer.filter(s), this.subDistrictRenderer.filter(t), { status: 0, message: "ok" }) : { status: 1, message: "未找到信号机" };
|
|
125
|
+
}
|
|
126
|
+
default:
|
|
127
|
+
return { status: 1, message: "未知类型" };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 重置高亮,恢复全图视角
|
|
132
|
+
* @returns
|
|
133
|
+
*/
|
|
134
|
+
async resetHighlight() {
|
|
135
|
+
return this.districtRenderer.resetFilter(), this.subDistrictRenderer.resetFilter(), this.crossRenderer.resetFilter(), { status: 0, message: "ok" };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
export {
|
|
139
|
+
f as default
|
|
140
|
+
};
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { Point as u } from "@arcgis/core/geometry";
|
|
2
|
+
import y from "@arcgis/core/Graphic";
|
|
3
|
+
import p from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
+
class C {
|
|
5
|
+
constructor(t) {
|
|
6
|
+
this.iconSymbolScale = 1e4, this.largeMarkerScale = 4e4, this.oldScale = 0, this.showName = "detail", this.showStyle = "scatter", this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.clusteredLocations = [], this.locations = [], this.view = t, this.crossLayer = new p({
|
|
7
|
+
id: "signal-control-cross-layer",
|
|
8
|
+
title: "信控路口图层"
|
|
9
|
+
}), this.view.map.add(this.crossLayer);
|
|
10
|
+
}
|
|
11
|
+
didCrossScaleThreshold(t, s, i) {
|
|
12
|
+
return t < i && s >= i || t >= i && s < i;
|
|
13
|
+
}
|
|
14
|
+
locationToScreen() {
|
|
15
|
+
this.clusteredLocations = [], this.locations.forEach((t) => {
|
|
16
|
+
const s = this.view.toScreen(
|
|
17
|
+
new u({ x: t.x, y: t.y })
|
|
18
|
+
);
|
|
19
|
+
s.x > 0 && s.y > 0 && (t.properties.screenX = s.x, t.properties.screenY = s.y, t.visited = !1, t.clusterId = void 0, this.clusteredLocations.push(t));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 显示信控路口
|
|
24
|
+
* @param params
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
showSignalCross(t) {
|
|
28
|
+
if (this.crossLayer.removeAll(), this.showName = t.showName || "detail", this.showStyle = t.style || "scatter", this.oldScale = this.view.scale, this.scaleWatchHandle || (this.scaleWatchHandle = this.view.watch("stationary", () => {
|
|
29
|
+
if (this.showStyle === "scatter") {
|
|
30
|
+
const s = this.view.scale, i = this.didCrossScaleThreshold(
|
|
31
|
+
this.oldScale,
|
|
32
|
+
s,
|
|
33
|
+
this.iconSymbolScale
|
|
34
|
+
), e = this.didCrossScaleThreshold(
|
|
35
|
+
this.oldScale,
|
|
36
|
+
s,
|
|
37
|
+
this.largeMarkerScale
|
|
38
|
+
);
|
|
39
|
+
(i || e) && this.updateScatterSymbol(), this.oldScale = s;
|
|
40
|
+
} else {
|
|
41
|
+
this.locationToScreen();
|
|
42
|
+
const s = this.doPixelCluster(this.clusterRadius);
|
|
43
|
+
this.showClusterResult(s);
|
|
44
|
+
}
|
|
45
|
+
})), this.showStyle === "scatter") {
|
|
46
|
+
const s = [], i = [];
|
|
47
|
+
t.points.forEach((e) => {
|
|
48
|
+
const r = this.getCrossSymbol(e), o = this.getBrandLabel(e.brand), a = this.getOnlineLabel(e.isOnline), l = this.getMalfunctionLabel(
|
|
49
|
+
e.isMalfunction
|
|
50
|
+
), n = new y({
|
|
51
|
+
geometry: {
|
|
52
|
+
type: "point",
|
|
53
|
+
longitude: e.x,
|
|
54
|
+
latitude: e.y
|
|
55
|
+
},
|
|
56
|
+
symbol: r,
|
|
57
|
+
attributes: {
|
|
58
|
+
type: "signal-cross",
|
|
59
|
+
id: e.crossId,
|
|
60
|
+
brandLabel: o,
|
|
61
|
+
isOnlineLabel: a,
|
|
62
|
+
isMalfunctionLabel: l,
|
|
63
|
+
...e
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
e.isMalfunction === !0 || e.isOnline === !1 ? i.push(n) : s.push(n);
|
|
67
|
+
}), this.crossLayer.addMany(s), this.crossLayer.addMany(i);
|
|
68
|
+
} else {
|
|
69
|
+
this.locations = t.points.map((i) => ({
|
|
70
|
+
id: i.crossId,
|
|
71
|
+
x: i.x,
|
|
72
|
+
y: i.y,
|
|
73
|
+
visited: !1,
|
|
74
|
+
clusterId: void 0,
|
|
75
|
+
properties: i
|
|
76
|
+
})), this.locationToScreen();
|
|
77
|
+
const s = this.doPixelCluster(this.clusterRadius);
|
|
78
|
+
this.showClusterResult(s);
|
|
79
|
+
}
|
|
80
|
+
return { status: 0, message: "ok" };
|
|
81
|
+
}
|
|
82
|
+
clearSignalCross() {
|
|
83
|
+
var t;
|
|
84
|
+
this.crossLayer.removeAll(), (t = this.scaleWatchHandle) == null || t.remove(), this.scaleWatchHandle = null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 更改路口显示名称内容
|
|
88
|
+
* @param showName
|
|
89
|
+
*/
|
|
90
|
+
changeShowName(t) {
|
|
91
|
+
this.showName = t, this.showStyle === "scatter" && this.updateScatterSymbol();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 更新散点符号
|
|
95
|
+
*/
|
|
96
|
+
updateScatterSymbol() {
|
|
97
|
+
this.crossLayer.graphics.forEach((t) => {
|
|
98
|
+
t.symbol = this.getCrossSymbol(t.attributes);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 按照像素距离聚类
|
|
103
|
+
* @param locations
|
|
104
|
+
* @param eps
|
|
105
|
+
* @param minPoints
|
|
106
|
+
* @returns
|
|
107
|
+
*/
|
|
108
|
+
doPixelCluster(t) {
|
|
109
|
+
let s = 0;
|
|
110
|
+
for (let i = 0; i < this.clusteredLocations.length; i++) {
|
|
111
|
+
const e = this.clusteredLocations[i];
|
|
112
|
+
if (e.visited)
|
|
113
|
+
continue;
|
|
114
|
+
e.visited = !0;
|
|
115
|
+
const r = this.getNeighbors(e, t);
|
|
116
|
+
r.length < this.minClusterPoints ? e.clusterId = -1 : (r.forEach((o) => {
|
|
117
|
+
o.visited = !0, o.clusterId = s;
|
|
118
|
+
}), e.clusterId = s, s++);
|
|
119
|
+
}
|
|
120
|
+
return this.createClusters();
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* 获取邻居点
|
|
124
|
+
* @param locations
|
|
125
|
+
* @param index
|
|
126
|
+
* @param eps
|
|
127
|
+
* @returns
|
|
128
|
+
*/
|
|
129
|
+
getNeighbors(t, s) {
|
|
130
|
+
return this.clusteredLocations.filter((i) => i.id === t.id || i.visited ? !1 : this.getDistance(t, i) <= s);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 两点间的像素距离
|
|
134
|
+
* @param point1
|
|
135
|
+
* @param point2
|
|
136
|
+
* @returns
|
|
137
|
+
*/
|
|
138
|
+
getDistance(t, s) {
|
|
139
|
+
return Math.sqrt(
|
|
140
|
+
Math.pow(t.properties.screenX - s.properties.screenX, 2) + Math.pow(t.properties.screenY - s.properties.screenY, 2)
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 从聚类结果中创建聚类对象
|
|
145
|
+
* @param locations
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
148
|
+
createClusters() {
|
|
149
|
+
const t = {}, s = [];
|
|
150
|
+
for (const e of this.clusteredLocations)
|
|
151
|
+
e.clusterId === void 0 || e.clusterId === -1 ? s.push(e) : (t[e.clusterId] || (t[e.clusterId] = []), t[e.clusterId].push(e));
|
|
152
|
+
const i = Object.keys(t).map((e, r) => {
|
|
153
|
+
const o = t[Number(e)], a = o.length, l = o.reduce((c, h) => c + h.x, 0), n = o.reduce((c, h) => c + h.y, 0), m = l / a, d = n / a;
|
|
154
|
+
return {
|
|
155
|
+
id: Number(e),
|
|
156
|
+
items: o,
|
|
157
|
+
count: a,
|
|
158
|
+
center: {
|
|
159
|
+
x: m,
|
|
160
|
+
y: d
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
return s.length > 0 && i.push({
|
|
165
|
+
id: -1,
|
|
166
|
+
items: s,
|
|
167
|
+
count: s.length,
|
|
168
|
+
center: null
|
|
169
|
+
}), i;
|
|
170
|
+
}
|
|
171
|
+
showClusterResult(t) {
|
|
172
|
+
this.crossLayer.removeAll();
|
|
173
|
+
let s = Number.MIN_VALUE, i = Number.MAX_VALUE;
|
|
174
|
+
t.forEach((e) => {
|
|
175
|
+
e.count > 1 && (i = Math.min(i, e.count), s = Math.max(s, e.count));
|
|
176
|
+
}), t.forEach((e) => {
|
|
177
|
+
if (e.id !== -1) {
|
|
178
|
+
let r = i === s ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (e.count - i) / (s - i) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
|
|
179
|
+
r *= 0.75;
|
|
180
|
+
const l = (e.count.toString().length * 8 + 6) / 2, n = new y({
|
|
181
|
+
geometry: new u({ x: e.center.x, y: e.center.y }),
|
|
182
|
+
attributes: {
|
|
183
|
+
count: e.count
|
|
184
|
+
},
|
|
185
|
+
symbol: {
|
|
186
|
+
type: "cim",
|
|
187
|
+
data: {
|
|
188
|
+
type: "CIMSymbolReference",
|
|
189
|
+
primitiveOverrides: [
|
|
190
|
+
{
|
|
191
|
+
// 将textGraphic的TextString替换为graphic.attributes.name
|
|
192
|
+
type: "CIMPrimitiveOverride",
|
|
193
|
+
primitiveName: "textGraphic",
|
|
194
|
+
propertyName: "TextString",
|
|
195
|
+
valueExpressionInfo: {
|
|
196
|
+
type: "CIMExpressionInfo",
|
|
197
|
+
title: "Custom",
|
|
198
|
+
expression: "$feature.count",
|
|
199
|
+
returnType: "Default"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
symbol: {
|
|
204
|
+
type: "CIMPointSymbol",
|
|
205
|
+
symbolLayers: [
|
|
206
|
+
// 聚合数量
|
|
207
|
+
{
|
|
208
|
+
type: "CIMVectorMarker",
|
|
209
|
+
size: r,
|
|
210
|
+
colorLocked: !0,
|
|
211
|
+
anchorPointUnits: "Relative",
|
|
212
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
213
|
+
markerGraphics: [
|
|
214
|
+
// 数量文本框
|
|
215
|
+
{
|
|
216
|
+
type: "CIMMarkerGraphic",
|
|
217
|
+
geometry: {
|
|
218
|
+
rings: [
|
|
219
|
+
[
|
|
220
|
+
[-l, 40],
|
|
221
|
+
[l, 40],
|
|
222
|
+
[l, 20],
|
|
223
|
+
[-l, 20],
|
|
224
|
+
[-l, 40]
|
|
225
|
+
]
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
symbol: {
|
|
229
|
+
type: "CIMPolygonSymbol",
|
|
230
|
+
symbolLayers: [
|
|
231
|
+
{
|
|
232
|
+
type: "CIMSolidFill",
|
|
233
|
+
enable: !0,
|
|
234
|
+
color: [2, 72, 200, 255]
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
type: "CIMSolidStroke",
|
|
238
|
+
enable: !0,
|
|
239
|
+
width: 5,
|
|
240
|
+
color: [2, 72, 200, 128]
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
// 数量文字
|
|
246
|
+
{
|
|
247
|
+
type: "CIMMarkerGraphic",
|
|
248
|
+
primitiveName: "textGraphic",
|
|
249
|
+
geometry: { x: 0, y: 0 },
|
|
250
|
+
symbol: {
|
|
251
|
+
type: "CIMTextSymbol",
|
|
252
|
+
height: 16,
|
|
253
|
+
horizontalAlignment: "Center",
|
|
254
|
+
offsetX: 0,
|
|
255
|
+
offsetY: 30,
|
|
256
|
+
symbol: {
|
|
257
|
+
type: "CIMPolygonSymbol",
|
|
258
|
+
symbolLayers: [
|
|
259
|
+
{
|
|
260
|
+
type: "CIMSolidFill",
|
|
261
|
+
enable: !0,
|
|
262
|
+
color: [255, 255, 255, 255]
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
verticalAlignment: "Center"
|
|
267
|
+
},
|
|
268
|
+
textString: ""
|
|
269
|
+
}
|
|
270
|
+
],
|
|
271
|
+
scaleSymbolsProportionally: !0,
|
|
272
|
+
respectFrame: !0
|
|
273
|
+
},
|
|
274
|
+
// 聚合图标
|
|
275
|
+
{
|
|
276
|
+
type: "CIMPictureMarker",
|
|
277
|
+
enable: !0,
|
|
278
|
+
anchorPoint: {
|
|
279
|
+
x: 0,
|
|
280
|
+
y: 0
|
|
281
|
+
},
|
|
282
|
+
anchorPointUnits: "Relative",
|
|
283
|
+
size: r,
|
|
284
|
+
rotateClockwise: !0,
|
|
285
|
+
textureFilter: "Picture",
|
|
286
|
+
url: "/GisViewerAssets/Images/cross/gis_xhj_blue.png"
|
|
287
|
+
}
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
this.crossLayer.add(n);
|
|
294
|
+
} else
|
|
295
|
+
e.items.forEach((r) => {
|
|
296
|
+
const o = new y({
|
|
297
|
+
geometry: new u({ x: r.x, y: r.y }),
|
|
298
|
+
attributes: {
|
|
299
|
+
...r,
|
|
300
|
+
...r.properties,
|
|
301
|
+
type: "signal-cross",
|
|
302
|
+
id: r.id
|
|
303
|
+
},
|
|
304
|
+
symbol: this.getCrossSymbol(r.properties)
|
|
305
|
+
});
|
|
306
|
+
this.crossLayer.add(o);
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
getBrandLabel(t) {
|
|
311
|
+
const s = (t ?? "").toLowerCase();
|
|
312
|
+
return s === "scats" ? "SCATS" : s === "gc" ? "国产" : t ?? "";
|
|
313
|
+
}
|
|
314
|
+
getOnlineLabel(t) {
|
|
315
|
+
return t ? "在线" : "离线";
|
|
316
|
+
}
|
|
317
|
+
getMalfunctionLabel(t) {
|
|
318
|
+
return t ? "故障" : "正常";
|
|
319
|
+
}
|
|
320
|
+
getCrossSymbol(t) {
|
|
321
|
+
var s, i;
|
|
322
|
+
if (this.view.scale <= this.iconSymbolScale) {
|
|
323
|
+
let e = "/GisViewerAssets/Images/cross/ic_";
|
|
324
|
+
return e += ((s = t.brand) == null ? void 0 : s.toLowerCase()) === "scats" ? "scats_" : "gc_", e += t.isOnline ? "online_" : "offline_", e += t.isMalfunction ? "malfunction.png" : "normal.png", {
|
|
325
|
+
type: "cim",
|
|
326
|
+
data: {
|
|
327
|
+
type: "CIMSymbolReference",
|
|
328
|
+
primitiveOverrides: [
|
|
329
|
+
{
|
|
330
|
+
// 将textGraphic的TextString替换为graphic.attributes.name
|
|
331
|
+
type: "CIMPrimitiveOverride",
|
|
332
|
+
primitiveName: "textGraphic",
|
|
333
|
+
propertyName: "TextString",
|
|
334
|
+
valueExpressionInfo: {
|
|
335
|
+
type: "CIMExpressionInfo",
|
|
336
|
+
title: "Custom",
|
|
337
|
+
expression: this.showName === "crossName" ? 'Replace($feature.name, "与", "/")' : this.showName === "signalId" ? "$feature.signalId" : 'Replace($feature.name, "与", "/") + " " + $feature.signalId',
|
|
338
|
+
returnType: "Default"
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
],
|
|
342
|
+
symbol: {
|
|
343
|
+
type: "CIMPointSymbol",
|
|
344
|
+
symbolLayers: [
|
|
345
|
+
// 路口名称
|
|
346
|
+
{
|
|
347
|
+
type: "CIMVectorMarker",
|
|
348
|
+
size: 25,
|
|
349
|
+
colorLocked: !0,
|
|
350
|
+
anchorPointUnits: "Relative",
|
|
351
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
352
|
+
markerGraphics: [
|
|
353
|
+
{
|
|
354
|
+
type: "CIMMarkerGraphic",
|
|
355
|
+
primitiveName: "textGraphic",
|
|
356
|
+
geometry: { x: 0, y: 0 },
|
|
357
|
+
symbol: {
|
|
358
|
+
type: "CIMTextSymbol",
|
|
359
|
+
height: 12,
|
|
360
|
+
horizontalAlignment: "Center",
|
|
361
|
+
offsetX: 0,
|
|
362
|
+
offsetY: 20,
|
|
363
|
+
haloSize: 1,
|
|
364
|
+
haloSymbol: {
|
|
365
|
+
type: "CIMPolygonSymbol",
|
|
366
|
+
symbolLayers: [
|
|
367
|
+
{
|
|
368
|
+
type: "CIMSolidFill",
|
|
369
|
+
enable: !0,
|
|
370
|
+
color: [255, 255, 255, 255]
|
|
371
|
+
}
|
|
372
|
+
]
|
|
373
|
+
},
|
|
374
|
+
symbol: {
|
|
375
|
+
type: "CIMPolygonSymbol",
|
|
376
|
+
symbolLayers: [
|
|
377
|
+
{
|
|
378
|
+
type: "CIMSolidFill",
|
|
379
|
+
enable: !0,
|
|
380
|
+
color: [0, 0, 0, 255]
|
|
381
|
+
}
|
|
382
|
+
]
|
|
383
|
+
},
|
|
384
|
+
verticalAlignment: "Center"
|
|
385
|
+
},
|
|
386
|
+
textString: ""
|
|
387
|
+
}
|
|
388
|
+
],
|
|
389
|
+
scaleSymbolsProportionally: !0,
|
|
390
|
+
respectFrame: !0
|
|
391
|
+
},
|
|
392
|
+
// 路口图标
|
|
393
|
+
{
|
|
394
|
+
type: "CIMPictureMarker",
|
|
395
|
+
enable: !0,
|
|
396
|
+
anchorPoint: {
|
|
397
|
+
x: 0,
|
|
398
|
+
y: 0
|
|
399
|
+
},
|
|
400
|
+
anchorPointUnits: "Relative",
|
|
401
|
+
size: 20,
|
|
402
|
+
rotateClockwise: !0,
|
|
403
|
+
textureFilter: "Picture",
|
|
404
|
+
url: e
|
|
405
|
+
}
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
} else {
|
|
411
|
+
const e = {
|
|
412
|
+
type: "simple-marker",
|
|
413
|
+
style: "circle",
|
|
414
|
+
size: this.view.scale > this.largeMarkerScale ? 3 : 6,
|
|
415
|
+
outline: { width: 1 }
|
|
416
|
+
};
|
|
417
|
+
return ((i = t.brand) == null ? void 0 : i.toLowerCase()) === "scats" ? t.isOnline ? (e.color = [68, 203, 188], e.outline.color = [59, 176, 163]) : (e.color = [100, 100, 100], e.outline.color = [150, 150, 150]) : t.isOnline ? (e.color = [129, 226, 73], e.outline.color = [108, 189, 61]) : (e.color = [100, 100, 100], e.outline.color = [150, 150, 150]), e;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
export {
|
|
422
|
+
C as default
|
|
423
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import l from "@arcgis/core/Graphic";
|
|
2
|
+
import d from "@arcgis/core/layers/FeatureLayer";
|
|
3
|
+
import o from "../common-utils.mjs";
|
|
4
|
+
import { signalMarkerLayerOptions as y, signalPictureLayerOptions as c, signalClusterLayerOptions as p } from "./layer-symbol.mjs";
|
|
5
|
+
class E {
|
|
6
|
+
constructor(e) {
|
|
7
|
+
this.view = e, this.signalMarkerLayer = new d(
|
|
8
|
+
y
|
|
9
|
+
), this.signalMarkerLayer.spatialReference = e.spatialReference, this.signalMarkerLayer.popupEnabled = !0, this.signalPictureLayer = new d(
|
|
10
|
+
c
|
|
11
|
+
), this.signalPictureLayer.spatialReference = e.spatialReference, this.signalPictureLayer.popupEnabled = !0, this.signalClusterLayer = new d(
|
|
12
|
+
p
|
|
13
|
+
), this.signalClusterLayer.spatialReference = e.spatialReference, this.signalClusterLayer.popupEnabled = !0, this.view.map.addMany([
|
|
14
|
+
this.signalMarkerLayer,
|
|
15
|
+
this.signalPictureLayer,
|
|
16
|
+
this.signalClusterLayer
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
19
|
+
async showSignals(e) {
|
|
20
|
+
await this.clearSignals();
|
|
21
|
+
let r = 0;
|
|
22
|
+
const a = [];
|
|
23
|
+
e.forEach((s) => {
|
|
24
|
+
s.signals.forEach((i) => {
|
|
25
|
+
const t = new l({
|
|
26
|
+
geometry: {
|
|
27
|
+
type: "point",
|
|
28
|
+
longitude: i.longitude,
|
|
29
|
+
latitude: i.latitude
|
|
30
|
+
},
|
|
31
|
+
attributes: {
|
|
32
|
+
ObjectID: r++,
|
|
33
|
+
id: i.id,
|
|
34
|
+
name: i.name,
|
|
35
|
+
signalId: i.signalId,
|
|
36
|
+
nodeId: i.nodeId || i.id,
|
|
37
|
+
districtId: s.id,
|
|
38
|
+
districtName: s.name,
|
|
39
|
+
subDistrictId: "",
|
|
40
|
+
subDistrictName: "",
|
|
41
|
+
isKey: i.isKey,
|
|
42
|
+
type: "signal",
|
|
43
|
+
selected: !0
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
a.push(t);
|
|
47
|
+
}), s.subDistricts.forEach((i) => {
|
|
48
|
+
i.signals.forEach((t) => {
|
|
49
|
+
const n = new l({
|
|
50
|
+
geometry: {
|
|
51
|
+
type: "point",
|
|
52
|
+
longitude: t.longitude,
|
|
53
|
+
latitude: t.latitude
|
|
54
|
+
},
|
|
55
|
+
attributes: {
|
|
56
|
+
ObjectID: r++,
|
|
57
|
+
id: t.id,
|
|
58
|
+
name: t.name,
|
|
59
|
+
signalId: t.signalId,
|
|
60
|
+
nodeId: t.nodeId || t.id,
|
|
61
|
+
districtId: s.id,
|
|
62
|
+
districtName: s.name,
|
|
63
|
+
subDistrictId: i.id,
|
|
64
|
+
subDistrictName: i.name,
|
|
65
|
+
isKey: t.isKey,
|
|
66
|
+
type: "signal",
|
|
67
|
+
selected: !0
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
a.push(n);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}), await this.signalMarkerLayer.applyEdits({
|
|
74
|
+
addFeatures: a
|
|
75
|
+
}), await this.signalPictureLayer.applyEdits({
|
|
76
|
+
addFeatures: a
|
|
77
|
+
}), await this.signalClusterLayer.applyEdits({
|
|
78
|
+
addFeatures: a
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async clearSignals() {
|
|
82
|
+
let e = await this.signalMarkerLayer.queryFeatures();
|
|
83
|
+
await this.signalMarkerLayer.applyEdits({
|
|
84
|
+
deleteFeatures: e.features
|
|
85
|
+
}), this.signalMarkerLayer.definitionExpression = "1=1", e = await this.signalPictureLayer.queryFeatures(), await this.signalPictureLayer.applyEdits({
|
|
86
|
+
deleteFeatures: e.features
|
|
87
|
+
}), this.signalPictureLayer.definitionExpression = "1=1", e = await this.signalClusterLayer.queryFeatures(), await this.signalClusterLayer.applyEdits({
|
|
88
|
+
deleteFeatures: e.features
|
|
89
|
+
}), this.signalClusterLayer.definitionExpression = "1=1";
|
|
90
|
+
}
|
|
91
|
+
async setPointVisible(e) {
|
|
92
|
+
this.signalMarkerLayer.visible = e, this.signalPictureLayer.visible = e;
|
|
93
|
+
}
|
|
94
|
+
setClusterVisible(e) {
|
|
95
|
+
this.signalClusterLayer.visible = e;
|
|
96
|
+
}
|
|
97
|
+
async locateSignal(e) {
|
|
98
|
+
return { status: 0, message: "ok" };
|
|
99
|
+
}
|
|
100
|
+
async highlightSignal(e) {
|
|
101
|
+
let r = "", a = "";
|
|
102
|
+
const s = this.signalMarkerLayer.definitionExpression;
|
|
103
|
+
this.signalMarkerLayer.definitionExpression = `signalId = '${e}'`;
|
|
104
|
+
const i = await this.signalMarkerLayer.queryFeatures(), t = i.features.length;
|
|
105
|
+
if (t > 0) {
|
|
106
|
+
const n = i.features[0].attributes.districtId || "", u = i.features[0].attributes.subDistrictId || "";
|
|
107
|
+
return await o.viewGoto(this.view, i.features), { districtId: n, subDistrictId: u, count: t };
|
|
108
|
+
} else
|
|
109
|
+
this.signalMarkerLayer.definitionExpression = s;
|
|
110
|
+
return { districtId: r, subDistrictId: a, count: t };
|
|
111
|
+
}
|
|
112
|
+
filter(e) {
|
|
113
|
+
const { id: r, type: a } = e, s = `${a === "district" ? "districtId" : "subDistrictId"} = '${r}'`;
|
|
114
|
+
this.signalClusterLayer.definitionExpression = s, this.signalMarkerLayer.definitionExpression = s, this.signalPictureLayer.definitionExpression = s;
|
|
115
|
+
}
|
|
116
|
+
resetFilter() {
|
|
117
|
+
const e = "1=1";
|
|
118
|
+
this.signalClusterLayer.definitionExpression = e, this.signalMarkerLayer.definitionExpression = e, this.signalPictureLayer.definitionExpression = e;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
E as default
|
|
123
|
+
};
|