gisviewer-vue3-arcgis 1.0.285 → 1.0.286
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/src/gis-map/gis-map.vue.d.ts +2 -2
- package/es/src/gis-map/index.d.ts +2 -2
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +6 -2
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +5 -3
- package/es/src/gis-map/utils/overlay.d.ts +2 -2
- package/es/src/gis-map/utils/overlay.mjs +2 -2
- package/es/src/gis-map/utils/police-jurisdiction.mjs +1 -1
- package/es/src/gis-map/utils/signal-system/signal-system-controller.mjs +2 -2
- package/es/src/gis-map-ol/gis-map-ol.vue.d.ts +30 -1
- package/es/src/gis-map-ol/gis-map-ol.vue.mjs +69 -43
- package/es/src/gis-map-ol/index.d.ts +25 -0
- package/es/src/gis-map-ol/utils/cluster/index.d.ts +2 -0
- package/es/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.d.ts +65 -0
- package/es/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.mjs +122 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.d.ts +1 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.mjs +95 -41
- package/es/src/gis-map-ol/utils/overlay/cluster-point-controller.d.ts +23 -0
- package/es/src/gis-map-ol/utils/overlay/cluster-point-controller.mjs +102 -0
- package/es/src/gis-map-ol/utils/overlay/overlay-controller.d.ts +116 -0
- package/es/src/gis-map-ol/utils/overlay/overlay-controller.mjs +276 -0
- package/es/src/gis-map-ol/utils/police-area-controller.d.ts +16 -0
- package/es/src/gis-map-ol/utils/police-area-controller.mjs +155 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +1 -10
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.mjs +124 -166
- package/es/src/gis-map-ol/utils/signal-control/signal-system-controller.d.ts +49 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-system-controller.mjs +127 -0
- package/es/src/gis-map-ol/utils/style/line-style.d.ts +64 -0
- package/es/src/gis-map-ol/utils/style/line-style.mjs +151 -0
- package/es/src/gis-map-ol/utils/style/point-style.d.ts +78 -0
- package/es/src/gis-map-ol/utils/style/point-style.mjs +206 -0
- package/es/src/gis-map-ol/utils/style/polygon-style.d.ts +60 -0
- package/es/src/gis-map-ol/utils/style/polygon-style.mjs +166 -0
- package/es/src/types/index.d.ts +2 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +2 -2
- package/lib/src/gis-map/index.d.ts +2 -2
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -1
- package/lib/src/gis-map/utils/overlay.d.ts +2 -2
- package/lib/src/gis-map/utils/overlay.js +1 -1
- package/lib/src/gis-map/utils/police-jurisdiction.js +1 -1
- package/lib/src/gis-map/utils/signal-system/signal-system-controller.js +1 -1
- package/lib/src/gis-map-ol/gis-map-ol.vue.d.ts +30 -1
- package/lib/src/gis-map-ol/gis-map-ol.vue.js +1 -1
- package/lib/src/gis-map-ol/index.d.ts +25 -0
- package/lib/src/gis-map-ol/utils/cluster/index.d.ts +2 -0
- package/lib/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.d.ts +65 -0
- package/lib/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.js +1 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.d.ts +1 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.js +1 -1
- package/lib/src/gis-map-ol/utils/overlay/cluster-point-controller.d.ts +23 -0
- package/lib/src/gis-map-ol/utils/overlay/cluster-point-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/overlay/overlay-controller.d.ts +116 -0
- package/lib/src/gis-map-ol/utils/overlay/overlay-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/police-area-controller.d.ts +16 -0
- package/lib/src/gis-map-ol/utils/police-area-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +1 -10
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.js +1 -1
- package/lib/src/gis-map-ol/utils/signal-control/signal-system-controller.d.ts +49 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-system-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/style/line-style.d.ts +64 -0
- package/lib/src/gis-map-ol/utils/style/line-style.js +1 -0
- package/lib/src/gis-map-ol/utils/style/point-style.d.ts +78 -0
- package/lib/src/gis-map-ol/utils/style/point-style.js +1 -0
- package/lib/src/gis-map-ol/utils/style/polygon-style.d.ts +60 -0
- package/lib/src/gis-map-ol/utils/style/polygon-style.js +1 -0
- package/lib/src/types/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { unByKey as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
1
|
+
import L from "ol/Feature";
|
|
2
|
+
import x from "ol/geom/Point";
|
|
3
|
+
import U from "ol/layer/Vector";
|
|
4
|
+
import { unByKey as N } from "ol/Observable";
|
|
5
|
+
import X from "ol/source/Vector";
|
|
6
|
+
import F from "ol/style/Circle";
|
|
7
|
+
import h from "ol/style/Fill";
|
|
8
|
+
import v from "ol/style/Icon";
|
|
9
|
+
import m from "ol/style/Stroke";
|
|
10
|
+
import a from "ol/style/Style";
|
|
11
11
|
import K from "ol/style/Text";
|
|
12
|
-
|
|
12
|
+
import { PixelClusterCalculator as $ } from "../cluster/pixel-cluster-calculator.mjs";
|
|
13
|
+
class re {
|
|
13
14
|
constructor(e) {
|
|
14
|
-
this.showName = "detail", this.showStyle = "scatter", this.viewChangeKey = null, this.mapMoveKey = null, this.resolutionChangeTimeout = null, this.
|
|
15
|
+
this.showName = "detail", this.showStyle = "scatter", this.viewChangeKey = null, this.mapMoveKey = null, this.resolutionChangeTimeout = null, this.locations = [], this.map = e, this.view = e.getView(), this.clusterCalculator = new $(e), this.source = new X(), this.crossLayer = new U({
|
|
15
16
|
source: this.source
|
|
16
17
|
}), this.crossLayer.set("id", "signal-control-cross-layer"), this.map.addLayer(this.crossLayer), this.configureVectorLayerStyle();
|
|
17
18
|
}
|
|
@@ -23,19 +24,19 @@ class se {
|
|
|
23
24
|
})), this.mapMoveKey || (this.mapMoveKey = this.map.on("moveend", () => {
|
|
24
25
|
this.showStyle === "cluster" && this.calculateCluster();
|
|
25
26
|
})), this.showStyle === "scatter") {
|
|
26
|
-
const
|
|
27
|
-
e.points.forEach((
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
}), this.source.addFeatures(
|
|
27
|
+
const t = [], i = [];
|
|
28
|
+
e.points.forEach((l) => {
|
|
29
|
+
const c = this.createCrossFeature(l);
|
|
30
|
+
l.isMalfunction === !0 || l.isOnline === !1 ? i.push(c) : t.push(c);
|
|
31
|
+
}), this.source.addFeatures(t), this.source.addFeatures(i), this.crossLayer.changed();
|
|
31
32
|
} else
|
|
32
|
-
this.locations = e.points.map((
|
|
33
|
-
id:
|
|
34
|
-
x:
|
|
35
|
-
y:
|
|
33
|
+
this.locations = e.points.map((t) => ({
|
|
34
|
+
id: t.crossId,
|
|
35
|
+
x: t.x,
|
|
36
|
+
y: t.y,
|
|
36
37
|
visited: !1,
|
|
37
38
|
clusterId: void 0,
|
|
38
|
-
properties:
|
|
39
|
+
properties: t
|
|
39
40
|
})), this.calculateCluster();
|
|
40
41
|
return {
|
|
41
42
|
status: 0,
|
|
@@ -43,12 +44,11 @@ class se {
|
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
calculateCluster() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.showClusterResult(e), console.timeEnd("cluster");
|
|
47
|
+
const e = this.clusterCalculator.calculate(this.locations), t = this.clusterCalculator.calculateSymbolSizes(e);
|
|
48
|
+
this.showClusterResult(t);
|
|
49
49
|
}
|
|
50
50
|
clearSignalCross() {
|
|
51
|
-
this.source.clear(), this.viewChangeKey && (
|
|
51
|
+
this.source.clear(), this.viewChangeKey && (N(this.viewChangeKey), this.viewChangeKey = null), this.mapMoveKey && (N(this.mapMoveKey), this.mapMoveKey = null), this.resolutionChangeTimeout && (clearTimeout(this.resolutionChangeTimeout), this.resolutionChangeTimeout = null);
|
|
52
52
|
}
|
|
53
53
|
changeShowName(e) {
|
|
54
54
|
this.showName = e, this.showStyle === "scatter" && this.updateScatterSymbol();
|
|
@@ -62,33 +62,48 @@ class se {
|
|
|
62
62
|
* - 使用缓存避免每次渲染都创建新的 Style/Icon/数组对象
|
|
63
63
|
*/
|
|
64
64
|
configureVectorLayerStyle() {
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
//
|
|
70
|
-
},
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
return
|
|
74
|
-
const
|
|
75
|
-
new
|
|
76
|
-
image: new
|
|
77
|
-
radius:
|
|
78
|
-
fill: new
|
|
79
|
-
stroke:
|
|
65
|
+
const y = this.map.getView(), E = y.getResolutionForZoom(13), Z = y.getResolutionForZoom(15), z = y.getResolutionForZoom(17), k = (s, o, n) => `/GisViewerAssets/Images/cross/ic_${(s ?? "gc").toLowerCase() === "scats" ? "scats" : "gc"}_${o === !1 ? "offline" : "online"}_${n ? "malfunction" : "normal"}.png`, w = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new WeakMap(), C = {
|
|
66
|
+
online: "#22c55e",
|
|
67
|
+
// 绿色 - 在线
|
|
68
|
+
offline: "#9ca3af"
|
|
69
|
+
// 灰色 - 离线
|
|
70
|
+
}, p = new m({ color: "#ffffff", width: 1.5 }), O = /* @__PURE__ */ new Map(), A = (s) => {
|
|
71
|
+
const o = s === !1 ? "offline" : "online", n = O.get(o);
|
|
72
|
+
if (n)
|
|
73
|
+
return n;
|
|
74
|
+
const r = [
|
|
75
|
+
new a({
|
|
76
|
+
image: new F({
|
|
77
|
+
radius: 3,
|
|
78
|
+
fill: new h({ color: C[o] }),
|
|
79
|
+
stroke: p
|
|
80
80
|
}),
|
|
81
81
|
zIndex: 1
|
|
82
82
|
})
|
|
83
83
|
];
|
|
84
|
-
return
|
|
85
|
-
},
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
return
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
return O.set(o, r), r;
|
|
85
|
+
}, M = /* @__PURE__ */ new Map(), B = (s) => {
|
|
86
|
+
const o = s === !1 ? "offline" : "online", n = M.get(o);
|
|
87
|
+
if (n)
|
|
88
|
+
return n;
|
|
89
|
+
const r = [
|
|
90
|
+
new a({
|
|
91
|
+
image: new F({
|
|
92
|
+
radius: 6,
|
|
93
|
+
fill: new h({ color: C[o] }),
|
|
94
|
+
stroke: p
|
|
95
|
+
}),
|
|
96
|
+
zIndex: 1
|
|
97
|
+
})
|
|
98
|
+
];
|
|
99
|
+
return M.set(o, r), r;
|
|
100
|
+
}, R = new h({ color: "#1f2937" }), V = new m({ color: "#ffffff", width: 3 }), I = (s) => {
|
|
101
|
+
const o = w.get(s);
|
|
102
|
+
if (o)
|
|
103
|
+
return o;
|
|
104
|
+
const n = new a({
|
|
105
|
+
image: new v({
|
|
106
|
+
src: s,
|
|
92
107
|
scale: 0.5,
|
|
93
108
|
anchor: [0.5, 1],
|
|
94
109
|
anchorXUnits: "fraction",
|
|
@@ -96,47 +111,49 @@ class se {
|
|
|
96
111
|
}),
|
|
97
112
|
zIndex: 1
|
|
98
113
|
});
|
|
99
|
-
return
|
|
100
|
-
},
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
103
|
-
return
|
|
104
|
-
const
|
|
105
|
-
return
|
|
114
|
+
return w.set(s, n), n;
|
|
115
|
+
}, D = (s) => {
|
|
116
|
+
const o = d.get(s);
|
|
117
|
+
if (o)
|
|
118
|
+
return o;
|
|
119
|
+
const n = [I(s)];
|
|
120
|
+
return d.set(s, n), n;
|
|
106
121
|
};
|
|
107
|
-
this.crossLayer.setStyle((
|
|
108
|
-
if ((
|
|
109
|
-
return this.getClusterStyle(
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
112
|
-
return
|
|
113
|
-
if (
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
this.crossLayer.setStyle((s, o) => {
|
|
123
|
+
if ((s.get("type") ?? "") === "signal-cluster")
|
|
124
|
+
return this.getClusterStyle(s.getProperties());
|
|
125
|
+
const r = this.showName === "crossName" ? s.get("name") : this.showName === "signalId" ? s.get("signalId") : `${s.get("name")}(${s.get("signalId")})`, b = s.get("brand") ?? "gc", u = s.get("isOnline"), T = s.get("isMalfunction"), f = k(b, u, T);
|
|
126
|
+
if (o > E)
|
|
127
|
+
return A(u);
|
|
128
|
+
if (o > Z)
|
|
129
|
+
return B(u);
|
|
130
|
+
if (o > z)
|
|
131
|
+
return D(f);
|
|
132
|
+
const g = S.get(s);
|
|
133
|
+
if (g && g.label === r && g.iconKey === f)
|
|
134
|
+
return g.styles;
|
|
135
|
+
const P = I(f), Y = new a({
|
|
119
136
|
text: new K({
|
|
120
|
-
text:
|
|
137
|
+
text: r,
|
|
121
138
|
font: '12px "Microsoft YaHei"',
|
|
122
139
|
textAlign: "center",
|
|
123
140
|
textBaseline: "bottom",
|
|
124
141
|
offsetY: -28,
|
|
125
|
-
fill:
|
|
126
|
-
stroke:
|
|
142
|
+
fill: R,
|
|
143
|
+
stroke: V
|
|
127
144
|
}),
|
|
128
145
|
zIndex: 2
|
|
129
|
-
}),
|
|
130
|
-
return
|
|
131
|
-
label:
|
|
132
|
-
iconKey:
|
|
133
|
-
styles:
|
|
134
|
-
}),
|
|
146
|
+
}), _ = [P, Y];
|
|
147
|
+
return S.set(s, {
|
|
148
|
+
label: r,
|
|
149
|
+
iconKey: f,
|
|
150
|
+
styles: _
|
|
151
|
+
}), _;
|
|
135
152
|
});
|
|
136
153
|
}
|
|
137
154
|
createCrossFeature(e) {
|
|
138
|
-
return e.brand = e.brand.toLowerCase(), new
|
|
139
|
-
geometry: new
|
|
155
|
+
return e.brand = e.brand.toLowerCase(), new L({
|
|
156
|
+
geometry: new x([e.x, e.y]),
|
|
140
157
|
type: "signal-cross",
|
|
141
158
|
id: e.crossId,
|
|
142
159
|
brandLabel: this.getBrandLabel(e.brand),
|
|
@@ -146,28 +163,30 @@ class se {
|
|
|
146
163
|
});
|
|
147
164
|
}
|
|
148
165
|
getClusterStyle(e) {
|
|
149
|
-
const
|
|
166
|
+
const t = e.clusterSymbolSize, i = new v({
|
|
150
167
|
src: "/GisViewerAssets/Images/cross/gis_xhj_blue.png",
|
|
151
|
-
scale:
|
|
168
|
+
scale: t / 32
|
|
152
169
|
// 近似缩放
|
|
153
|
-
}),
|
|
170
|
+
}), l = -(t + 10), c = new K({
|
|
154
171
|
text: String(e.count ?? 0),
|
|
155
|
-
font: "16px
|
|
156
|
-
fill: new
|
|
157
|
-
backgroundFill: new
|
|
158
|
-
backgroundStroke: new
|
|
159
|
-
padding: [
|
|
160
|
-
offsetY:
|
|
161
|
-
textAlign: "center"
|
|
172
|
+
font: "16px Arial Unicode MS",
|
|
173
|
+
fill: new h({ color: [255, 255, 255, 255] }),
|
|
174
|
+
backgroundFill: new h({ color: [2, 72, 200, 1] }),
|
|
175
|
+
backgroundStroke: new m({ color: [2, 72, 200, 0.5], width: 2 }),
|
|
176
|
+
padding: [1, 2, 1, 2],
|
|
177
|
+
offsetY: l,
|
|
178
|
+
textAlign: "center",
|
|
179
|
+
justify: "center",
|
|
180
|
+
textBaseline: "middle"
|
|
162
181
|
});
|
|
163
|
-
return [new
|
|
182
|
+
return [new a({ image: i }), new a({ text: c })];
|
|
164
183
|
}
|
|
165
184
|
// private formatCrossName(name?: string) {
|
|
166
185
|
// return (name || '').replace(/与/g, '/');
|
|
167
186
|
// }
|
|
168
187
|
getBrandLabel(e) {
|
|
169
|
-
const
|
|
170
|
-
return
|
|
188
|
+
const t = (e ?? "").toLowerCase();
|
|
189
|
+
return t === "scats" ? "SCATS" : t === "gc" ? "国产" : e ?? "";
|
|
171
190
|
}
|
|
172
191
|
getOnlineLabel(e) {
|
|
173
192
|
return e ? "在线" : "离线";
|
|
@@ -175,89 +194,28 @@ class se {
|
|
|
175
194
|
getMalfunctionLabel(e) {
|
|
176
195
|
return e ? "故障" : "正常";
|
|
177
196
|
}
|
|
178
|
-
locationToScreen() {
|
|
179
|
-
this.clusteredLocations = [], this.locations.forEach((e) => {
|
|
180
|
-
const s = this.map.getPixelFromCoordinate([e.x, e.y]), [o, t] = s || [NaN, NaN];
|
|
181
|
-
Number.isFinite(o) && Number.isFinite(t) && o > 0 && t > 0 && (e.properties = e.properties || {}, e.properties.screenX = o, e.properties.screenY = t, e.visited = !1, e.clusterId = void 0, this.clusteredLocations.push(e));
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
doPixelCluster(e) {
|
|
185
|
-
let s = 0;
|
|
186
|
-
for (let o = 0; o < this.clusteredLocations.length; o++) {
|
|
187
|
-
const t = this.clusteredLocations[o];
|
|
188
|
-
if (t.visited)
|
|
189
|
-
continue;
|
|
190
|
-
t.visited = !0;
|
|
191
|
-
const n = this.getNeighbors(t, e);
|
|
192
|
-
n.length < this.minClusterPoints ? t.clusterId = -1 : (n.forEach((r) => {
|
|
193
|
-
r.visited = !0, r.clusterId = s;
|
|
194
|
-
}), t.clusterId = s, s++);
|
|
195
|
-
}
|
|
196
|
-
return this.createClusters();
|
|
197
|
-
}
|
|
198
|
-
getNeighbors(e, s) {
|
|
199
|
-
return this.clusteredLocations.filter((o) => o.id === e.id || o.visited ? !1 : this.getDistance(e, o) <= s);
|
|
200
|
-
}
|
|
201
|
-
getDistance(e, s) {
|
|
202
|
-
var o, t, n, r;
|
|
203
|
-
return Math.sqrt(
|
|
204
|
-
Math.pow(
|
|
205
|
-
(((o = e.properties) == null ? void 0 : o.screenX) ?? 0) - (((t = s.properties) == null ? void 0 : t.screenX) ?? 0),
|
|
206
|
-
2
|
|
207
|
-
) + Math.pow(
|
|
208
|
-
(((n = e.properties) == null ? void 0 : n.screenY) ?? 0) - (((r = s.properties) == null ? void 0 : r.screenY) ?? 0),
|
|
209
|
-
2
|
|
210
|
-
)
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
createClusters() {
|
|
214
|
-
const e = {}, s = [];
|
|
215
|
-
for (const t of this.clusteredLocations)
|
|
216
|
-
t.clusterId === void 0 || t.clusterId === -1 ? s.push(t) : (e[t.clusterId] || (e[t.clusterId] = []), e[t.clusterId].push(t));
|
|
217
|
-
const o = Object.keys(e).map((t) => {
|
|
218
|
-
const n = e[Number(t)], r = n.length, p = n.reduce((u, h) => u + h.x, 0), w = n.reduce((u, h) => u + h.y, 0), S = p / r, C = w / r;
|
|
219
|
-
return {
|
|
220
|
-
id: Number(t),
|
|
221
|
-
items: n,
|
|
222
|
-
count: r,
|
|
223
|
-
center: { x: S, y: C }
|
|
224
|
-
};
|
|
225
|
-
});
|
|
226
|
-
return s.length > 0 && o.push({
|
|
227
|
-
id: -1,
|
|
228
|
-
items: s,
|
|
229
|
-
count: s.length,
|
|
230
|
-
center: null
|
|
231
|
-
}), o;
|
|
232
|
-
}
|
|
233
197
|
showClusterResult(e) {
|
|
234
|
-
this.source.clear()
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}), e.forEach((t) => {
|
|
239
|
-
if (t.id !== -1 && t.center) {
|
|
240
|
-
let n = o === s ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (t.count - o) / (s - o) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
|
|
241
|
-
n *= 0.75;
|
|
242
|
-
const r = new _({
|
|
243
|
-
geometry: new v([t.center.x, t.center.y]),
|
|
198
|
+
this.source.clear(), e.forEach((t) => {
|
|
199
|
+
if (t.id !== -1 && t.center && t.symbolSize) {
|
|
200
|
+
const i = new L({
|
|
201
|
+
geometry: new x([t.center.x, t.center.y]),
|
|
244
202
|
type: "signal-cluster",
|
|
245
203
|
count: t.count,
|
|
246
|
-
clusterSymbolSize:
|
|
204
|
+
clusterSymbolSize: t.symbolSize
|
|
247
205
|
});
|
|
248
|
-
this.source.addFeature(
|
|
206
|
+
this.source.addFeature(i);
|
|
249
207
|
} else
|
|
250
|
-
t.items.forEach((
|
|
251
|
-
const
|
|
252
|
-
...
|
|
253
|
-
x:
|
|
254
|
-
y:
|
|
208
|
+
t.items.forEach((i) => {
|
|
209
|
+
const l = this.createCrossFeature({
|
|
210
|
+
...i.properties,
|
|
211
|
+
x: i.x,
|
|
212
|
+
y: i.y
|
|
255
213
|
});
|
|
256
|
-
this.source.addFeature(
|
|
214
|
+
this.source.addFeature(l);
|
|
257
215
|
});
|
|
258
216
|
}), this.crossLayer.changed();
|
|
259
217
|
}
|
|
260
218
|
}
|
|
261
219
|
export {
|
|
262
|
-
|
|
220
|
+
re as default
|
|
263
221
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { default as OlMap } from 'ol/Map';
|
|
2
|
+
import { IResult, IShowSignalSystemParams, IShowSubSignalSystemParams } from 'packages/components/src/types';
|
|
3
|
+
/**
|
|
4
|
+
* 信号系统控制器
|
|
5
|
+
* 用于在 OpenLayers 地图上展示和管理信号子区系统
|
|
6
|
+
* 包括子区道路线(LineString)和路口节点(Point)的渲染
|
|
7
|
+
*/
|
|
8
|
+
export default class SignalSystemController {
|
|
9
|
+
/** OpenLayers 地图实例 */
|
|
10
|
+
private map;
|
|
11
|
+
/** 矢量数据源,存储所有信号系统要素 */
|
|
12
|
+
private source;
|
|
13
|
+
/** 信号系统图层 */
|
|
14
|
+
private signalSystemLayer;
|
|
15
|
+
/**
|
|
16
|
+
* 构造函数
|
|
17
|
+
* @param map - OpenLayers 地图实例
|
|
18
|
+
*/
|
|
19
|
+
constructor(map: OlMap);
|
|
20
|
+
showSignalSystem(params: IShowSignalSystemParams): Promise<IResult> | {
|
|
21
|
+
status: number;
|
|
22
|
+
message: string;
|
|
23
|
+
};
|
|
24
|
+
removeSignalSystem(areaCode?: string): void;
|
|
25
|
+
private showSystem;
|
|
26
|
+
/**
|
|
27
|
+
* 展示多个信号子区系统
|
|
28
|
+
* 遍历所有子区并渲染,完成后自动缩放地图视角以显示所有子区
|
|
29
|
+
*
|
|
30
|
+
* @param params - 展示参数,包含子区列表
|
|
31
|
+
* @returns 操作结果
|
|
32
|
+
*/
|
|
33
|
+
showSubSignalSystem(params: IShowSubSignalSystemParams): Promise<IResult>;
|
|
34
|
+
/**
|
|
35
|
+
* 移除信号子区系统
|
|
36
|
+
* 若不传 subCode,则清除所有子区;否则只清除指定子区
|
|
37
|
+
*
|
|
38
|
+
* @param subCode - 可选,子区编码。不传则清除全部
|
|
39
|
+
*/
|
|
40
|
+
removeSubSignalSystem(subCode?: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* 渲染单个信号子区系统
|
|
43
|
+
* 包括子区道路线和路口节点的渲染
|
|
44
|
+
*
|
|
45
|
+
* @param subSystem - 信号子区系统数据
|
|
46
|
+
* @param areaCode - 区域编码,用于关联要素
|
|
47
|
+
*/
|
|
48
|
+
private showSubSystem;
|
|
49
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import n from "ol/Feature";
|
|
2
|
+
import { LineString as u, Point as l } from "ol/geom";
|
|
3
|
+
import h from "ol/layer/Vector";
|
|
4
|
+
import f from "ol/source/Vector";
|
|
5
|
+
import { getLineStyle as c } from "../style/line-style.mjs";
|
|
6
|
+
import { getPointStyle as m } from "../style/point-style.mjs";
|
|
7
|
+
class F {
|
|
8
|
+
/**
|
|
9
|
+
* 构造函数
|
|
10
|
+
* @param map - OpenLayers 地图实例
|
|
11
|
+
*/
|
|
12
|
+
constructor(e) {
|
|
13
|
+
this.map = e, this.source = new f(), this.signalSystemLayer = new h({
|
|
14
|
+
source: this.source
|
|
15
|
+
}), this.signalSystemLayer.set("id", "signal-system-layer"), this.map.addLayer(this.signalSystemLayer);
|
|
16
|
+
}
|
|
17
|
+
showSignalSystem(e) {
|
|
18
|
+
e.areaList.forEach((t) => {
|
|
19
|
+
this.showSystem(t);
|
|
20
|
+
});
|
|
21
|
+
const r = this.source.getExtent();
|
|
22
|
+
return r && r[0] !== 1 / 0 ? new Promise((t) => {
|
|
23
|
+
this.map.getView().fit(r, {
|
|
24
|
+
padding: [50, 50, 50, 50],
|
|
25
|
+
callback: () => {
|
|
26
|
+
t({ status: 0, message: "success" });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}) : { status: 1, message: "No features to display" };
|
|
30
|
+
}
|
|
31
|
+
removeSignalSystem(e) {
|
|
32
|
+
if (!e) {
|
|
33
|
+
this.source.clear();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this.source.getFeatures().filter((t) => t.get("areaCode") === e).forEach((t) => {
|
|
37
|
+
this.source.removeFeature(t);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
showSystem(e) {
|
|
41
|
+
if (e.shape) {
|
|
42
|
+
let r;
|
|
43
|
+
typeof e.shape == "string" ? r = JSON.parse(e.shape) : r = e.shape;
|
|
44
|
+
const t = c(e.lineSymbol, e), s = new n({
|
|
45
|
+
geometry: new u(r),
|
|
46
|
+
areaCode: e.areaCode
|
|
47
|
+
});
|
|
48
|
+
s.setStyle(t), this.source.addFeature(s);
|
|
49
|
+
}
|
|
50
|
+
e.children && e.children.forEach((r) => {
|
|
51
|
+
this.showSubSystem(r, e.areaCode);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 展示多个信号子区系统
|
|
56
|
+
* 遍历所有子区并渲染,完成后自动缩放地图视角以显示所有子区
|
|
57
|
+
*
|
|
58
|
+
* @param params - 展示参数,包含子区列表
|
|
59
|
+
* @returns 操作结果
|
|
60
|
+
*/
|
|
61
|
+
async showSubSignalSystem(e) {
|
|
62
|
+
e.areaList.forEach((t) => {
|
|
63
|
+
this.showSubSystem(t);
|
|
64
|
+
});
|
|
65
|
+
const r = this.source.getExtent();
|
|
66
|
+
return r && r[0] !== 1 / 0 ? new Promise((t) => {
|
|
67
|
+
this.map.getView().fit(r, {
|
|
68
|
+
padding: [50, 50, 50, 50],
|
|
69
|
+
callback: () => {
|
|
70
|
+
t({ status: 0, message: "success" });
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}) : { status: 1, message: "No features to display" };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 移除信号子区系统
|
|
77
|
+
* 若不传 subCode,则清除所有子区;否则只清除指定子区
|
|
78
|
+
*
|
|
79
|
+
* @param subCode - 可选,子区编码。不传则清除全部
|
|
80
|
+
*/
|
|
81
|
+
removeSubSignalSystem(e) {
|
|
82
|
+
if (!e) {
|
|
83
|
+
this.source.clear();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.source.getFeatures().filter((t) => t.get("subCode") === e).forEach((t) => {
|
|
87
|
+
this.source.removeFeature(t);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 渲染单个信号子区系统
|
|
92
|
+
* 包括子区道路线和路口节点的渲染
|
|
93
|
+
*
|
|
94
|
+
* @param subSystem - 信号子区系统数据
|
|
95
|
+
* @param areaCode - 区域编码,用于关联要素
|
|
96
|
+
*/
|
|
97
|
+
showSubSystem(e, r) {
|
|
98
|
+
if (e.subShape) {
|
|
99
|
+
let t;
|
|
100
|
+
typeof e.subShape == "string" ? t = JSON.parse(e.subShape) : t = e.subShape;
|
|
101
|
+
const s = c(e.roadSymbol, e), o = t.map((i) => {
|
|
102
|
+
const a = new n({
|
|
103
|
+
geometry: new u(i),
|
|
104
|
+
subCode: e.subAreaCode,
|
|
105
|
+
areaCode: r || ""
|
|
106
|
+
});
|
|
107
|
+
return a.setStyle(s), a;
|
|
108
|
+
});
|
|
109
|
+
this.source.addFeatures(o);
|
|
110
|
+
}
|
|
111
|
+
if (e.children) {
|
|
112
|
+
const t = e.children.map((s) => {
|
|
113
|
+
const o = s.symbol || e.nodeSymbol, i = m(o, s), a = new n({
|
|
114
|
+
...s,
|
|
115
|
+
subCode: e.subAreaCode,
|
|
116
|
+
areaCode: r || "",
|
|
117
|
+
geometry: new l([s.x, s.y])
|
|
118
|
+
});
|
|
119
|
+
return a.setStyle(i), a;
|
|
120
|
+
});
|
|
121
|
+
this.source.addFeatures(t);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
export {
|
|
126
|
+
F as default
|
|
127
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import Style from 'ol/style/Style';
|
|
2
|
+
/**
|
|
3
|
+
* 根据 ArcGIS simple-line 的 style 获取 lineDash 配置
|
|
4
|
+
* @param style ArcGIS line style
|
|
5
|
+
* @param width 线宽,用于计算 dash 长度
|
|
6
|
+
*/
|
|
7
|
+
export declare function getLineDashByStyle(style: string, width: number): number[] | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* 清除样式缓存
|
|
10
|
+
*/
|
|
11
|
+
export declare function clearStyleCache(): void;
|
|
12
|
+
/**
|
|
13
|
+
* 获取当前缓存大小
|
|
14
|
+
*/
|
|
15
|
+
export declare function getStyleCacheSize(): number;
|
|
16
|
+
/**
|
|
17
|
+
* 获取线样式
|
|
18
|
+
* 支持 symbol 数组配置(line + text),或单个 symbol 配置
|
|
19
|
+
* 若 symbol 为空则显示蓝色线
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // 简单线样式配置
|
|
23
|
+
* { symbol: { strokeColor: '#ff0000', strokeWidth: 3 } }
|
|
24
|
+
*
|
|
25
|
+
* // 虚线样式配置
|
|
26
|
+
* { symbol: { strokeColor: '#2563eb', strokeWidth: 2, lineDash: [10, 5] } }
|
|
27
|
+
*
|
|
28
|
+
* // 带边框的线样式配置
|
|
29
|
+
* { symbol: { type: 'bordered', strokeColor: '#ffffff', strokeWidth: 4, borderColor: '#000000', borderWidth: 1 } }
|
|
30
|
+
*
|
|
31
|
+
* // 数组配置(线 + 文字)
|
|
32
|
+
* {
|
|
33
|
+
* symbol: [
|
|
34
|
+
* { type: 'line', strokeColor: '#2563eb', strokeWidth: 3 },
|
|
35
|
+
* { type: 'text', field: 'name', font: '14px Arial', fillColor: [0,0,0], placement: 'line' }
|
|
36
|
+
* ]
|
|
37
|
+
* }
|
|
38
|
+
*
|
|
39
|
+
* // 数组配置(带边框线 + 文字)
|
|
40
|
+
* {
|
|
41
|
+
* symbol: [
|
|
42
|
+
* { type: 'bordered', strokeColor: '#ffffff', strokeWidth: 4, borderColor: '#333333', borderWidth: 1 },
|
|
43
|
+
* { type: 'text', field: 'roadName', font: '12px Arial', fillColor: [0,0,0], placement: 'line', overflow: true }
|
|
44
|
+
* ]
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* // ArcGIS simple-line 配置
|
|
48
|
+
* // style 可选值: 'solid', 'dash', 'dot', 'dash-dot', 'long-dash', 'long-dash-dot',
|
|
49
|
+
* // 'long-dash-dot-dot', 'short-dash', 'short-dot', 'short-dash-dot', 'short-dash-dot-dot', 'none'
|
|
50
|
+
* { symbol: { type: 'simple-line', style: 'solid', color: [255, 0, 0, 1], width: 2 } }
|
|
51
|
+
* { symbol: { type: 'simple-line', style: 'dash', color: [0, 0, 255, 1], width: 3 } }
|
|
52
|
+
* { symbol: { type: 'simple-line', style: 'dot', color: [0, 128, 0, 1], width: 2 } }
|
|
53
|
+
* { symbol: { type: 'simple-line', style: 'dash-dot', color: [255, 128, 0, 1], width: 2 } }
|
|
54
|
+
* { symbol: { type: 'simple-line', style: 'long-dash-dot-dot', color: [128, 0, 128, 1], width: 2 } }
|
|
55
|
+
*
|
|
56
|
+
* // 数组配置(ArcGIS simple-line + 文字)
|
|
57
|
+
* {
|
|
58
|
+
* symbol: [
|
|
59
|
+
* { type: 'simple-line', style: 'dash', color: [0, 0, 255, 1], width: 3, cap: 'butt', join: 'miter' },
|
|
60
|
+
* { type: 'text', field: 'name', font: '12px Arial', fillColor: [0,0,0], placement: 'line' }
|
|
61
|
+
* ]
|
|
62
|
+
* }
|
|
63
|
+
*/
|
|
64
|
+
export declare function getLineStyle(symbol: any, attributes?: any): Style | Style[];
|