gisviewer-vue3-arcgis 1.0.251 → 1.0.252
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 +4 -1
- package/es/src/gis-map/gis-map.vue.mjs +155 -153
- package/es/src/gis-map/index.d.ts +2 -0
- package/es/src/gis-map/utils/dbscan-cluster/index.d.ts +51 -0
- package/es/src/gis-map/utils/dbscan-cluster/index.mjs +256 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.d.ts +1 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +69 -65
- package/es/src/gis-map/utils/overlay.d.ts +3 -8
- package/es/src/gis-map/utils/overlay.mjs +48 -52
- package/es/src/gis-map/utils/signal-control-area/district-renderer.d.ts +2 -2
- package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +6 -2
- package/es/src/gis-map/utils/signal-control-area/show-area.mjs +15 -15
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +1 -1
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +6 -2
- package/es/src/types/index.d.ts +29 -2
- package/lib/src/gis-map/gis-map.vue.d.ts +4 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +2 -0
- package/lib/src/gis-map/utils/dbscan-cluster/index.d.ts +51 -0
- package/lib/src/gis-map/utils/dbscan-cluster/index.js +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.d.ts +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -1
- package/lib/src/gis-map/utils/overlay.d.ts +3 -8
- package/lib/src/gis-map/utils/overlay.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.d.ts +2 -2
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/show-area.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
- package/lib/src/types/index.d.ts +29 -2
- package/package.json +1 -1
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
import { Polygon as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import c from "@arcgis/core/layers/
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Polygon as n } from "@arcgis/core/geometry";
|
|
2
|
+
import * as y from "@arcgis/core/geometry/geometryEngine";
|
|
3
|
+
import d from "@arcgis/core/Graphic";
|
|
4
|
+
import c from "@arcgis/core/layers/FeatureLayer";
|
|
5
|
+
import v from "@arcgis/core/layers/GraphicsLayer";
|
|
6
|
+
class L {
|
|
7
|
+
constructor(e, t) {
|
|
7
8
|
this.defaultPointSymbol = {
|
|
8
9
|
type: "simple-marker",
|
|
9
10
|
style: "circle",
|
|
10
11
|
color: "yellow",
|
|
11
12
|
size: 10
|
|
12
|
-
}, this.view = e, this.overlayLayer = new
|
|
13
|
-
...
|
|
13
|
+
}, this.view = e, this.overlayLayer = new v({
|
|
14
|
+
...t
|
|
14
15
|
}), this.view.map.layers.add(this.overlayLayer);
|
|
15
16
|
}
|
|
16
17
|
addMask(e) {
|
|
17
18
|
this.removeMask();
|
|
18
|
-
const
|
|
19
|
-
let r = new
|
|
19
|
+
const t = e.maskColor || [100, 100, 100, 0.8], i = e.maskSize || 100;
|
|
20
|
+
let r = new n({
|
|
20
21
|
rings: [e.geometry.rings[0]]
|
|
21
22
|
});
|
|
22
|
-
const
|
|
23
|
-
|
|
23
|
+
const s = r.centroid, a = y.geodesicBuffer(
|
|
24
|
+
s,
|
|
24
25
|
i,
|
|
25
26
|
"kilometers"
|
|
26
27
|
);
|
|
27
|
-
let o =
|
|
28
|
+
let o = y.difference(
|
|
28
29
|
a,
|
|
29
30
|
r
|
|
30
31
|
);
|
|
31
32
|
if (e.geometry.rings.length > 1)
|
|
32
|
-
for (let
|
|
33
|
-
r = new
|
|
34
|
-
rings: [e.geometry.rings[
|
|
35
|
-
}), o =
|
|
33
|
+
for (let l = 1; l < e.geometry.rings.length; l++)
|
|
34
|
+
r = new n({
|
|
35
|
+
rings: [e.geometry.rings[l]]
|
|
36
|
+
}), o = y.difference(
|
|
36
37
|
o,
|
|
37
38
|
r
|
|
38
39
|
);
|
|
39
|
-
const h = new
|
|
40
|
+
const h = new d({
|
|
40
41
|
geometry: o,
|
|
41
42
|
symbol: {
|
|
42
43
|
type: "simple-fill",
|
|
43
|
-
color:
|
|
44
|
+
color: t,
|
|
44
45
|
outline: {
|
|
45
46
|
style: "long-dash",
|
|
46
47
|
color: "white"
|
|
@@ -52,7 +53,7 @@ class u {
|
|
|
52
53
|
}
|
|
53
54
|
removeMask() {
|
|
54
55
|
const e = this.overlayLayer.graphics.find(
|
|
55
|
-
(
|
|
56
|
+
(t) => t.getAttribute("type") === "mask"
|
|
56
57
|
);
|
|
57
58
|
e && this.overlayLayer.remove(e);
|
|
58
59
|
}
|
|
@@ -61,50 +62,51 @@ class u {
|
|
|
61
62
|
* @param params
|
|
62
63
|
*/
|
|
63
64
|
addOverlays(e) {
|
|
64
|
-
let
|
|
65
|
+
let t = 0, i = 0;
|
|
66
|
+
e.defaultVisible == null && (e.defaultVisible = !0);
|
|
65
67
|
for (const r of e.overlays) {
|
|
66
68
|
r.properties ? (r.properties.type || (r.properties.type = e.type), r.properties.id || (r.properties.id = r.id)) : r.properties = { type: e.type, id: r.id };
|
|
67
|
-
const
|
|
69
|
+
const s = r.symbol || e.defaultSymbol || this.defaultPointSymbol, a = r.visible == null ? e.defaultVisible : r.visible;
|
|
68
70
|
this.addOverlay(
|
|
69
71
|
r,
|
|
70
|
-
|
|
72
|
+
s,
|
|
71
73
|
r.properties,
|
|
72
|
-
|
|
73
|
-
).message === "add" ?
|
|
74
|
+
a
|
|
75
|
+
).message === "add" ? t++ : i++;
|
|
74
76
|
}
|
|
75
|
-
return { status: 0, message: `新增${
|
|
77
|
+
return { status: 0, message: `新增${t}, 更新${i}` };
|
|
76
78
|
}
|
|
77
79
|
/**
|
|
78
80
|
* 按type移除覆盖物
|
|
79
81
|
* @param types
|
|
80
82
|
*/
|
|
81
83
|
removeOverlaysByType(e) {
|
|
82
|
-
const
|
|
84
|
+
const t = this.overlayLayer.graphics.filter((i) => {
|
|
83
85
|
const r = i.getAttribute("type");
|
|
84
86
|
return e.includes(r);
|
|
85
87
|
});
|
|
86
|
-
return this.overlayLayer.graphics.removeMany(
|
|
88
|
+
return this.overlayLayer.graphics.removeMany(t), { status: 0, message: `删除${t.length}` };
|
|
87
89
|
}
|
|
88
90
|
/**
|
|
89
91
|
* 按id移除覆盖物
|
|
90
92
|
* @param ids
|
|
91
93
|
*/
|
|
92
94
|
removeOverlaysById(e) {
|
|
93
|
-
const
|
|
95
|
+
const t = this.overlayLayer.graphics.filter((i) => {
|
|
94
96
|
const r = i.getAttribute("id");
|
|
95
97
|
return e.includes(r);
|
|
96
98
|
});
|
|
97
|
-
return this.overlayLayer.graphics.removeMany(
|
|
99
|
+
return this.overlayLayer.graphics.removeMany(t), { status: 0, message: `删除${t.length}` };
|
|
98
100
|
}
|
|
99
101
|
/**
|
|
100
102
|
* 按id显示或隐藏覆盖物
|
|
101
103
|
* @param ids
|
|
102
104
|
* @param isShow
|
|
103
105
|
*/
|
|
104
|
-
isShowOverlaysByIds(e,
|
|
106
|
+
isShowOverlaysByIds(e, t) {
|
|
105
107
|
this.overlayLayer.graphics.map((i) => {
|
|
106
108
|
const r = i.getAttribute("id");
|
|
107
|
-
e.includes(r) ? i.visible =
|
|
109
|
+
e.includes(r) ? i.visible = t : i.visible = !t;
|
|
108
110
|
});
|
|
109
111
|
}
|
|
110
112
|
/**
|
|
@@ -147,7 +149,7 @@ class u {
|
|
|
147
149
|
async findGraphic(e) {
|
|
148
150
|
var r;
|
|
149
151
|
return (r = (await this.view.hitTest(e)).results) == null ? void 0 : r.filter(
|
|
150
|
-
(
|
|
152
|
+
(s) => s.type === "graphic" && s.graphic.layer === this.overlayLayer
|
|
151
153
|
);
|
|
152
154
|
}
|
|
153
155
|
/**
|
|
@@ -166,29 +168,23 @@ class u {
|
|
|
166
168
|
showLayer() {
|
|
167
169
|
this.overlayLayer.visible = !0;
|
|
168
170
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
* @param symbol
|
|
173
|
-
* @param properties
|
|
174
|
-
*/
|
|
175
|
-
addPoint(e, s, i, r) {
|
|
176
|
-
let t, a = !0;
|
|
177
|
-
return e.id && (t = this.overlayLayer.graphics.find(
|
|
171
|
+
addOverlay(e, t, i, r) {
|
|
172
|
+
let s, a = !0;
|
|
173
|
+
return e.id && (s = this.overlayLayer.graphics.find(
|
|
178
174
|
(o) => o.getAttribute("id") === e.id
|
|
179
|
-
)),
|
|
175
|
+
)), s ? s.visible = r : (s = new d({
|
|
180
176
|
visible: r
|
|
181
|
-
}), this.overlayLayer.add(
|
|
177
|
+
}), this.overlayLayer.add(s), a = !1), s.geometry = e.geometry, s.symbol = t, s.attributes = i, { status: 0, message: a ? "add" : "update" };
|
|
182
178
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}), this.
|
|
179
|
+
addClusterPoint(e) {
|
|
180
|
+
this.clusterLayer || (this.clusterLayer = new c({
|
|
181
|
+
id: "clusterPointLayer",
|
|
182
|
+
source: [],
|
|
183
|
+
outFields: ["*"],
|
|
184
|
+
geometryType: "point"
|
|
185
|
+
}), this.view.map.add(this.clusterLayer));
|
|
190
186
|
}
|
|
191
187
|
}
|
|
192
188
|
export {
|
|
193
|
-
|
|
189
|
+
L as default
|
|
194
190
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IResult } from '../../../types';
|
|
1
|
+
import { IFindSignalControlAreaParams, IResult } from '../../../types';
|
|
2
2
|
import DistrictController from './district-controller';
|
|
3
3
|
export default class DistrictRenderer {
|
|
4
4
|
private view;
|
|
@@ -33,7 +33,7 @@ export default class DistrictRenderer {
|
|
|
33
33
|
* @param id 区控ID
|
|
34
34
|
* @return 返回高亮区控的数量
|
|
35
35
|
*/
|
|
36
|
-
highlightDistrict(
|
|
36
|
+
highlightDistrict(params: IFindSignalControlAreaParams): Promise<number>;
|
|
37
37
|
filter(id: string): void;
|
|
38
38
|
resetFilter(): void;
|
|
39
39
|
}
|
|
@@ -101,9 +101,13 @@ class x {
|
|
|
101
101
|
*/
|
|
102
102
|
async highlightDistrict(t) {
|
|
103
103
|
const i = this.districtControllerDashLayer.definitionExpression;
|
|
104
|
-
this.districtControllerDashLayer.definitionExpression = `id = '${t}'`;
|
|
104
|
+
this.districtControllerDashLayer.definitionExpression = `id = '${t.id}'`;
|
|
105
105
|
const e = await this.districtControllerDashLayer.queryFeatures(), r = e.features.length;
|
|
106
|
-
return r > 0 ? (this.districtControllerSolidLayer.definitionExpression = `id = '${t}'`, await n.viewGoto(
|
|
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;
|
|
107
111
|
}
|
|
108
112
|
filter(t) {
|
|
109
113
|
const i = `id = '${t}'`;
|
|
@@ -21,15 +21,15 @@ class N {
|
|
|
21
21
|
*/
|
|
22
22
|
async showSignalControlArea(e) {
|
|
23
23
|
this.detachmentLayerLoaded || await this.loadDetachmentLayer(), await this.clearSignalControlArea(), this.districtRenderer.setVisible(!1), this.subDistrictRenderer.setVisible(!1), this.signalRenderer.setClusterVisible(!1), this.signalRenderer.setPointVisible(!1);
|
|
24
|
-
const t = [],
|
|
24
|
+
const t = [], s = [];
|
|
25
25
|
for (const n of e.areaList) {
|
|
26
|
-
const
|
|
26
|
+
const i = new w(
|
|
27
27
|
n,
|
|
28
28
|
e.style || ""
|
|
29
29
|
);
|
|
30
|
-
t.push(
|
|
30
|
+
t.push(i), s.push(...i.subDistricts);
|
|
31
31
|
}
|
|
32
|
-
return this.districtRenderer.style = e.style || "", await this.districtRenderer.showDistricts(t), await this.subDistrictRenderer.showSubDistricts(
|
|
32
|
+
return this.districtRenderer.style = e.style || "", await this.districtRenderer.showDistricts(t), await this.subDistrictRenderer.showSubDistricts(s), await this.signalRenderer.showSignals(t), { status: 0, message: "ok" };
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* 清空区控、子区、信号机
|
|
@@ -88,13 +88,13 @@ class N {
|
|
|
88
88
|
async highlightSignalControlArea(e) {
|
|
89
89
|
switch (this.view.closePopup(), e.type) {
|
|
90
90
|
case "district":
|
|
91
|
-
return await this.districtRenderer.highlightDistrict(e
|
|
91
|
+
return await this.districtRenderer.highlightDistrict(e) ? (this.subDistrictRenderer.filter(e), this.signalRenderer.filter(e), await this.subDistrictRenderer.showRoads(e), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
|
|
92
92
|
case "subDistrict": {
|
|
93
|
-
const { count: t, parentId:
|
|
94
|
-
return t > 0 ? (this.districtRenderer.filter(
|
|
93
|
+
const { count: t, parentId: s } = await this.subDistrictRenderer.highlightSubDistrict(e);
|
|
94
|
+
return t > 0 ? (this.districtRenderer.filter(s), this.signalRenderer.filter(e), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
95
95
|
}
|
|
96
96
|
case "signal": {
|
|
97
|
-
const { districtId: t, subDistrictId:
|
|
97
|
+
const { districtId: t, subDistrictId: s, count: n } = await this.signalRenderer.highlightSignal(e.id);
|
|
98
98
|
return n > 0 ? (this.districtRenderer.filter(t), this.subDistrictRenderer.filter(e), { status: 0, message: "ok" }) : { status: 1, message: "未找到信号机" };
|
|
99
99
|
}
|
|
100
100
|
default:
|
|
@@ -118,13 +118,13 @@ class N {
|
|
|
118
118
|
if (!e)
|
|
119
119
|
return;
|
|
120
120
|
const t = e.find(
|
|
121
|
-
(
|
|
121
|
+
(s) => s.options.id === "shanghai_district"
|
|
122
122
|
);
|
|
123
123
|
if (t)
|
|
124
124
|
try {
|
|
125
125
|
const n = await (await fetch(
|
|
126
126
|
"/GisViewerAssets/ShangHai/Layers/district.json"
|
|
127
|
-
)).json(),
|
|
127
|
+
)).json(), i = [], { renderer: r, labelingInfo: d } = t.options;
|
|
128
128
|
n.features.forEach((c) => {
|
|
129
129
|
const o = c.attributes.ZD_NAME;
|
|
130
130
|
if (o !== "高架支队") {
|
|
@@ -154,17 +154,17 @@ class N {
|
|
|
154
154
|
width: 2
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
|
-
if (
|
|
157
|
+
if (i.push(a), d && o !== "边防港航支队" && o !== "机场支队") {
|
|
158
158
|
const h = new g({
|
|
159
159
|
geometry: l.centroid,
|
|
160
160
|
symbol: { ...d.symbol, text: o }
|
|
161
161
|
});
|
|
162
|
-
|
|
162
|
+
i.push(h);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
}), this.detachmentLayer.addMany(
|
|
166
|
-
} catch (
|
|
167
|
-
console.error("加载支队图层失败:",
|
|
165
|
+
}), this.detachmentLayer.addMany(i), this.detachmentLayerLoaded = !0;
|
|
166
|
+
} catch (s) {
|
|
167
|
+
console.error("加载支队图层失败:", s);
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
@@ -25,7 +25,7 @@ export default class SubDistrictRenderer {
|
|
|
25
25
|
* @param id 子区ID
|
|
26
26
|
* @return 返回高亮子区的数量以及区控id
|
|
27
27
|
*/
|
|
28
|
-
highlightSubDistrict(
|
|
28
|
+
highlightSubDistrict(params: IFindSignalControlAreaParams): Promise<{
|
|
29
29
|
count: number;
|
|
30
30
|
parentId: string;
|
|
31
31
|
}>;
|
|
@@ -238,9 +238,13 @@ class C {
|
|
|
238
238
|
async highlightSubDistrict(e) {
|
|
239
239
|
let s = "";
|
|
240
240
|
const t = this.subDistrictPointLayer.definitionExpression;
|
|
241
|
-
this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${e}'`;
|
|
241
|
+
this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${e.id}'`;
|
|
242
242
|
const r = await this.subDistrictPointLayer.queryFeatures(), i = r.features.length;
|
|
243
|
-
return i > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${e}'`, s = r.features[0].attributes.districtId, await v.viewGoto(
|
|
243
|
+
return i > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${e.id}'`, s = r.features[0].attributes.districtId, await v.viewGoto(
|
|
244
|
+
this.view,
|
|
245
|
+
r.features,
|
|
246
|
+
e.needZoom !== !1
|
|
247
|
+
)) : this.subDistrictPointLayer.definitionExpression = t, { count: i, parentId: s };
|
|
244
248
|
}
|
|
245
249
|
/**
|
|
246
250
|
* 按照区控、子区id显示子区
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -104,6 +104,10 @@ export interface IPointSymbol {
|
|
|
104
104
|
verticalOrigin?: string;
|
|
105
105
|
color?: string;
|
|
106
106
|
size?: number;
|
|
107
|
+
outline?: {
|
|
108
|
+
color?: string | number[];
|
|
109
|
+
width?: number;
|
|
110
|
+
};
|
|
107
111
|
}
|
|
108
112
|
export interface ILineSymbol {
|
|
109
113
|
type: string;
|
|
@@ -139,7 +143,30 @@ export interface IOverlayParam {
|
|
|
139
143
|
defaultSymbol?: IPointSymbol | ILineSymbol | IPolygonSymbol;
|
|
140
144
|
defaultVisible?: boolean;
|
|
141
145
|
overlays: Array<IOverlay>;
|
|
142
|
-
|
|
146
|
+
}
|
|
147
|
+
export interface IClusterPointParams {
|
|
148
|
+
type?: string;
|
|
149
|
+
clusterSymbol?: IPointSymbol;
|
|
150
|
+
pointSymbol?: IPointSymbol;
|
|
151
|
+
points: IClusterLocation[];
|
|
152
|
+
}
|
|
153
|
+
export interface IClusterLocation {
|
|
154
|
+
id: string;
|
|
155
|
+
x: number;
|
|
156
|
+
y: number;
|
|
157
|
+
properties?: any;
|
|
158
|
+
visited?: boolean;
|
|
159
|
+
clusterId?: number;
|
|
160
|
+
symbol?: IPointSymbol;
|
|
161
|
+
}
|
|
162
|
+
export interface ICluster {
|
|
163
|
+
id: number;
|
|
164
|
+
items: IClusterLocation[];
|
|
165
|
+
count: number;
|
|
166
|
+
center: {
|
|
167
|
+
x: number;
|
|
168
|
+
y: number;
|
|
169
|
+
} | null;
|
|
143
170
|
}
|
|
144
171
|
export interface ISetMapCameraParams {
|
|
145
172
|
name: string;
|
|
@@ -285,7 +312,7 @@ export interface IDistrictRoad {
|
|
|
285
312
|
export interface IFindSignalControlAreaParams {
|
|
286
313
|
type: string;
|
|
287
314
|
id: string;
|
|
288
|
-
|
|
315
|
+
needZoom?: boolean;
|
|
289
316
|
}
|
|
290
317
|
export interface INode {
|
|
291
318
|
id: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import MapView from '@arcgis/core/views/MapView';
|
|
2
2
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
-
import { IEditSignalControlAreaParams, IFindSignalControlAreaParams, IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IMaskParam, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowEdpassDeviceParams, IShowGreenWaveBandParams, IShowJurisdictionParams, IShowOpenDriveFromFileParams, IShowSignalControlAreaParams, ISignalCountdownProps, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams, IUnselectSumoParams } from '../types';
|
|
3
|
+
import { IClusterPointParams, IEditSignalControlAreaParams, IFindSignalControlAreaParams, IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IMaskParam, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowEdpassDeviceParams, IShowGreenWaveBandParams, IShowJurisdictionParams, IShowOpenDriveFromFileParams, IShowSignalControlAreaParams, ISignalCountdownProps, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams, IUnselectSumoParams } from '../types';
|
|
4
|
+
import DbscanCluster from './utils/dbscan-cluster';
|
|
4
5
|
import EdpassDeviceController from './utils/edpass-device-controller';
|
|
5
6
|
import GreenWaveBandController from './utils/green-wave-band-controller';
|
|
6
7
|
import HoloFlow from './utils/holo-flow';
|
|
@@ -37,6 +38,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
37
38
|
greenWaveBandController: GreenWaveBandController;
|
|
38
39
|
policeJurisdictionController: PoliceJurisdiction;
|
|
39
40
|
edpassDeviceController: EdpassDeviceController;
|
|
41
|
+
dbscanCluster: DbscanCluster;
|
|
40
42
|
showLogDiv: import("vue").Ref<boolean>;
|
|
41
43
|
appDataStore: import("pinia").Store<"appData", {
|
|
42
44
|
mapConfig: {};
|
|
@@ -113,6 +115,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
113
115
|
toggleTrafficObject: (params: IToggleTrafficInfoParams) => void;
|
|
114
116
|
toggleVehicleInfo: (contentType: string) => void;
|
|
115
117
|
addOverlays: (params: IOverlayParam) => Promise<import("../types").IResult>;
|
|
118
|
+
addClusterPoints: (params: IClusterPointParams) => Promise<void>;
|
|
116
119
|
addMask: (params: IMaskParam) => void;
|
|
117
120
|
removeMask: () => void;
|
|
118
121
|
removeOverlaysByType: (types: string[]) => import("../types").IResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),T=require("./stores/index.js");require("./style/index.css");const rt=require("./utils/dbscan-cluster/index.js"),st=require("./utils/detect-gpu.js"),ot=require("./utils/edpass-device-controller.js"),M=require("./utils/green-wave-band-controller/index.js"),it=require("./utils/holo-flow/index.js"),ct=require("./utils/holo-flow/signal-countdown-panel.vue.js"),lt=require("./utils/map-initializer.js"),x=require("./utils/open-drive-renderer/index.js"),z=require("./utils/overlay.js"),ut=require("./utils/police-jurisdiction.js"),dt=require("./utils/queue-length.js"),E=require("./utils/road-config-tool/index.js"),mt=require("./utils/signal-control-area/edit-area.js"),pt=require("./utils/signal-control-area/show-area.js"),gt=require("./utils/traffic-flow.js"),ft={class:"gis-viewer"},yt={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},vt=r.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(P,{expose:N,emit:H}){const C=r.ref(null);let n,p,l,i,a,s,f,t,u,o,g,y,h,b;const O=r.ref(!1);T.registerStore();const q=T.default.useAppDataStore,V=r.reactive([]),_=e=>Math.log2(591657527591555e-6/e);let v=null,B=null;const k=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==B&&(B=d,S("update:zoom",d))};st.default(),r.onMounted(async()=>{if(!C.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(O.value=!O.value)});const e=r.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(I.config)).json();c.assetsRoot=I.assetsRoot||d,q.mapConfig=c,p=new lt.default,q.mapInitializer=p,n=await p.initialize({container:C.value,mapConfig:c,markerClickCallback:(m,L,D,at)=>{S("markerClick",m,L,D,at)},mapClickCallback:(m,L,D)=>{S("mapClick",m,L,D)}});const w=n.zoom??(n.scale?_(n.scale):void 0);typeof w=="number"&&k(w);const nt=n.zoom!==void 0?n.watch("zoom",m=>{k(m)}):n.watch("scale",m=>{typeof m=="number"&&m>0&&k(_(m))});v=()=>nt.remove(),a=new it.default(n,V),await a.init(),S("mapLoaded")}),r.onUnmounted(()=>{o==null||o.clearSignalControlArea(),t==null||t.clearOpenDrive(),a.clearHoloTrace(),a.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),v==null||v(),v=null});const G=r.computed(()=>n),Z=()=>{const e=T.default.useAppDataStore;e.saveTrackLog=!0},W=()=>{a.downloadTrackLog()},j=()=>{A("vehicleId")},J=()=>{A("plateNumber")},Q=async e=>await p.setMapCenter(e),U=async e=>await p.setMapCamera(e),K=e=>p.setMapZoom(e),F=async e=>await p.lookAt(e),X=e=>p.setLayerVisibility(e),Y=(e,d)=>p.requestCoordinateTransform(e,d),R=e=>{p.cancelCoordinateTransform(e)},$=e=>{p.setMapZoomRange(e)},ee=e=>(l||(l=new E.default(n)),l.showLaneNumber(e)),te=()=>{l==null||l.clearLaneNumber()},ne=async e=>(l||(l=new E.default(n)),await l.initializeSearch(e)),ae=async()=>l==null?void 0:l.calCrossIndicatorArea(),re=async()=>{},se=async(e,d)=>{i||(i=new gt.default(n)),i.connectTrafficFlow(e,d)},oe=()=>{i==null||i.disconnectTrafficFlow()},ie=async e=>{a.handleVehicleTraceData(e)},ce=()=>{a.clearHoloTrace()},le=e=>{a.setInterpolate(e)},ue=async e=>{await a.handleSignalData(e)},de=async e=>{await a.initializeLampGroup(e)},me=e=>{a.handleUniSignalData(e)},pe=()=>{a.clearHoloSignal()},ge=e=>{i==null||i.toggleTrafficInfo(e),a==null||a.toggleTrafficInfo(e)},fe=e=>{a==null||a.togglePause(e)},ye=e=>{i==null||i.toggleTrafficObject(e),a==null||a.toggleTrafficObject(e)},A=e=>{a==null||a.updatePanelContent(e)},ve=async e=>(s||(s=new z.default(n)),s.addOverlays(e)),Se=async e=>(b||(b=new rt.default(n)),b.addClusterPoints(e)),we=e=>(s||(s=new z.default(n)),s.addMask(e)),Ce=()=>{s==null||s.removeMask()},he=e=>s==null?void 0:s.removeOverlaysByType(e),be=e=>s==null?void 0:s.removeOverlaysById(e),Oe=()=>s==null?void 0:s.removeAllOverlays(),ke=()=>{s==null||s.showAllOverlays()},Ae=e=>{f||(f=new dt.default(n)),f.updateQueueLength(e)},Le=()=>{f==null||f.removeQueueLength()},De=async(e,d)=>(t||(t=new x.default(n)),await t.showOpenDriveFromServer(e,d)),Te=async e=>(t||(t=new x.default(n)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),qe=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},Ve=async()=>await(t==null?void 0:t.clearOpenDrive()),_e=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},Be=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Ie=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Me=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Ee=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Pe=async e=>(o||(o=new pt.default(n)),await o.showSignalControlArea(e)),Ne=async()=>await(o==null?void 0:o.clearSignalControlArea()),He=e=>o==null?void 0:o.setLayerVisibility(e),Ge=async e=>o?await(o==null?void 0:o.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Ze=async e=>o?await o.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},We=()=>o?o.resetHighlight():{status:-1,message:"未加载信号控制区"},je=e=>(u||(u=new mt.default(n)),u.showSubSignalControlArea(e)),Je=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Qe=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},Ue=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Ke=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Fe=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},Xe=e=>(g||(g=new M.default(n)),g.addGreenWaveBand(e)),Ye=()=>{if(!g)return{status:-1,message:"未加载绿波带"};g.stopAddGreenWaveBand()},Re=async e=>(g||(g=new M.default(n)),await g.showGreenWaveBand(e)),$e=async e=>(y||(y=new ut.default(n)),await y.showJurisdiction(e)),et=()=>{if(!y)return{status:-1,message:"未加载警务管辖区"};y.clearJurisdiction()},tt=async e=>(h||(h=new ot.default(n)),await h.setEdpassLayerVisibility(e)),I=P,S=H;return N({mapViewer:G,setLayerVisibility:X,setMapCenter:Q,lookAt:F,setMapCamera:U,setMapZoom:K,setMapZoomRange:$,requestCoordinateTransform:Y,cancelCoordinateTransform:R,addOverlays:ve,addClusterPoints:Se,addMask:we,removeMask:Ce,showAllOverlays:ke,removeOverlaysByType:he,removeOverlaysById:be,removeAllOverlays:Oe,showLaneNumber:ee,clearLaneNumber:te,initializeAreaTool:ne,calCrossIndicatorArea:ae,calRoadIndicatorArea:re,connectCarFlow:se,disconnectCarFlow:oe,handleHoloVehicleTraceData:ie,clearHoloTrace:ce,initializeLampGroup:de,handleUniSignalData:me,handleHoloSignalData:ue,clearHoloSignal:pe,setInterpolate:le,toggleTrafficInfo:ge,toggleTrafficObject:ye,toggleVehicleInfo:A,togglePause:fe,updateQueueLength:Ae,removeQueueLength:Le,showOpenDriveFromServer:De,showOpenDriveFromFile:Te,clearOpenDrive:Ve,setOpendriveVisibility:qe,geometrySearchInOpenDrive:Me,findSumoInOpenDrive:_e,selectSumoInOpenDrive:Be,unselectSumoInOpenDrive:Ie,getSumoInfo:xe,splitOpenDriveLane:ze,clearSplitOpenDriveLane:Ee,showSignalControlArea:Pe,clearSignalControlArea:Ne,setSignalControlAreaVisibility:He,locateSignalControlArea:Ge,highlightSignalControlArea:Ze,resetHighlightSignalControlArea:We,showSubSignalControlArea:je,editSubSignalControlArea:Je,stopEditSubSignalControlArea:Qe,selectSubSignalControlAreaCross:Ue,unselectSubSignalControlAreaCross:Ke,changeSubSignalControlAreaBorderVisibility:Fe,addGreenWaveBand:Xe,stopAddGreenWaveBand:Ye,showGreenWaveBand:Re,showPoliceArea:$e,clearPoliceArea:et,setEdpassLayerVisibility:tt}),(e,d)=>(r.openBlock(),r.createElementBlock("div",ft,[r.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:C},[r.withDirectives(r.createElementVNode("div",yt,[r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:Z}," 开始记录 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:W}," 下载日志 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 显示车辆id "),r.createElementVNode("button",{onClick:J},"显示车辆号牌")],512),[[r.vShow,O.value]])],512),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(V,(c,w)=>(r.openBlock(),r.createBlock(ct.default,{key:w,"display-mode":c.displayMode,flash:c.flash,"road-id":c.crossId,"cross-id":c.roadId,"map-point":c.mapPoint,"stop-line":c.stopLine,position:c.position,rotation:c.rotation,scale:c.scale,"lamp-status":c.lampStatus},null,8,["display-mode","flash","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=vt;
|
|
@@ -22,6 +22,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
22
22
|
greenWaveBandController: import("./utils/green-wave-band-controller").default;
|
|
23
23
|
policeJurisdictionController: import("./utils/police-jurisdiction").default;
|
|
24
24
|
edpassDeviceController: import("./utils/edpass-device-controller").default;
|
|
25
|
+
dbscanCluster: import("./utils/dbscan-cluster").default;
|
|
25
26
|
showLogDiv: import("vue").Ref<boolean>;
|
|
26
27
|
appDataStore: import("pinia").Store<"appData", {
|
|
27
28
|
mapConfig: {};
|
|
@@ -98,6 +99,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
98
99
|
toggleTrafficObject: (params: import("../types").IToggleTrafficInfoParams) => void;
|
|
99
100
|
toggleVehicleInfo: (contentType: string) => void;
|
|
100
101
|
addOverlays: (params: import("../types").IOverlayParam) => Promise<import("../types").IResult>;
|
|
102
|
+
addClusterPoints: (params: import("../types").IClusterPointParams) => Promise<void>;
|
|
101
103
|
addMask: (params: import("../types").IMaskParam) => void;
|
|
102
104
|
removeMask: () => void;
|
|
103
105
|
removeOverlaysByType: (types: string[]) => import("../types").IResult;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { IClusterPointParams } from 'packages/components/src/types';
|
|
2
|
+
export default class DbscanCluster {
|
|
3
|
+
private view;
|
|
4
|
+
private clusterLayer;
|
|
5
|
+
private maxClusterSymbolSize;
|
|
6
|
+
private minClusterSymbolSize;
|
|
7
|
+
constructor(view: __esri.MapView | __esri.SceneView);
|
|
8
|
+
private zoomWatchHandle;
|
|
9
|
+
private locations;
|
|
10
|
+
private clusterMarkUrl;
|
|
11
|
+
private currentZoom;
|
|
12
|
+
/**
|
|
13
|
+
* 将地理位置转换为屏幕坐标
|
|
14
|
+
*/
|
|
15
|
+
private locationToScreen;
|
|
16
|
+
/**
|
|
17
|
+
* 添加聚类点到视图
|
|
18
|
+
* @param params
|
|
19
|
+
*/
|
|
20
|
+
addClusterPoints(params: IClusterPointParams): void;
|
|
21
|
+
private showClusters;
|
|
22
|
+
/**
|
|
23
|
+
* 获取邻居点
|
|
24
|
+
* @param locations
|
|
25
|
+
* @param index
|
|
26
|
+
* @param eps
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
private getNeighbors;
|
|
30
|
+
/**
|
|
31
|
+
* 两点间的像素距离
|
|
32
|
+
* @param point1
|
|
33
|
+
* @param point2
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
private getDistance;
|
|
37
|
+
/**
|
|
38
|
+
* 从聚类结果中创建聚类对象
|
|
39
|
+
* @param locations
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
private createClusters;
|
|
43
|
+
/**
|
|
44
|
+
* 按照像素距离聚类
|
|
45
|
+
* @param locations
|
|
46
|
+
* @param eps
|
|
47
|
+
* @param minPoints
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
private doPixelCluster;
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils"),m=require("@arcgis/core/geometry"),h=require("@arcgis/core/Graphic"),S=require("@arcgis/core/layers/GraphicsLayer");function g(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const C=g(b);class x{constructor(e){this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.zoomWatchHandle=null,this.locations=[],this.clusterMarkUrl="",this.currentZoom=0,this.view=e,this.currentZoom=e.zoom,this.clusterLayer=new S,this.view.map.add(this.clusterLayer)}locationToScreen(){this.locations.forEach(e=>{const t=this.view.toScreen(new m.Point({x:e.x,y:e.y}));e.properties.screenX=t.x,e.properties.screenY=t.y})}addClusterPoints(e){var i;this.locations=e.points,this.clusterMarkUrl=((i=e.clusterSymbol)==null?void 0:i.url)||"/GisViewerAssets/Images/cross/gis_xhj_blue.png",e.points.forEach(s=>{s.symbol||(s.symbol=e.pointSymbol||{type:"simple-marker",style:"circle",color:"#3388ff",size:8,outline:{color:"#ffffff",width:1}})}),this.zoomWatchHandle||(this.zoomWatchHandle=C.watch(()=>this.view.zoom,()=>{Math.abs(this.currentZoom-this.view.zoom)>=1&&(this.currentZoom=this.view.zoom,this.locationToScreen(),this.clusterLayer.removeAll(),this.addClusterPoints(e))})),this.locationToScreen(),console.time("cluster");const t=this.doPixelCluster(e.points,120,3);console.timeEnd("cluster"),this.showClusters(t)}showClusters(e){let t=Number.MIN_VALUE,i=Number.MAX_VALUE;e.forEach(s=>{s.count>1&&(i=Math.min(i,s.count),t=Math.max(t,s.count))}),e.forEach(s=>{if(s.id!==-1){let r=i===t?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(s.count-i)/(t-i)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const o=new h({geometry:new m.Point({x:s.center.x,y:s.center.y}),attributes:{count:s.count},symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:r,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-15,40],[15,40],[15,20],[-15,20],[-15,40]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[2,72,200,255]},{type:"CIMSolidStroke",enable:!0,width:5,color:[2,72,200,128]}]}},{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r,rotateClockwise:!0,textureFilter:"Picture",url:this.clusterMarkUrl}]}}}});this.clusterLayer.add(o)}else s.items.forEach(r=>{const o=new h({geometry:new m.Point({x:r.x,y:r.y}),attributes:r.properties,symbol:r.symbol});this.clusterLayer.add(o)})})}getNeighbors(e,t,i){const s=e[t];return e.filter(r=>r.id===s.id||r.visited?!1:this.getDistance(s,r)<=i)}getDistance(e,t){return Math.sqrt(Math.pow(e.properties.screenX-t.properties.screenX,2)+Math.pow(e.properties.screenY-t.properties.screenY,2))}createClusters(e){const t={},i=[];for(let r=0;r<e.length;r++){const o=e[r];o.clusterId===void 0||o.clusterId===-1?i.push(o):(t[o.clusterId]||(t[o.clusterId]=[]),t[o.clusterId].push(o))}const s=Object.keys(t).map((r,o)=>{const n=t[Number(r)],c=n.length,y=n.reduce((u,a)=>u+a.x,0),d=n.reduce((u,a)=>u+a.y,0),p=y/c,f=d/c;return{id:Number(r),items:n,count:c,center:{x:p,y:f}}});return i.length>0&&s.push({id:-1,items:i,count:i.length,center:null}),s}doPixelCluster(e,t,i){let s=0;e.forEach(r=>r.visited=!1);for(let r=0;r<e.length;r++){const o=e[r];if(o.visited)continue;o.visited=!0;const n=this.getNeighbors(e,r,t);n.length<i?o.clusterId=-1:(n.forEach(c=>{c.visited=!0,c.clusterId=s}),o.clusterId=s,s++)}return this.createClusters(e)}}exports.default=x;
|
|
@@ -24,6 +24,7 @@ export default class GreenWaveBandController {
|
|
|
24
24
|
addGreenWaveBand(params: IEditSignalControlAreaParams): void;
|
|
25
25
|
stopAddGreenWaveBand(): void;
|
|
26
26
|
showGreenWaveBand(params: IShowGreenWaveBandParams): Promise<void>;
|
|
27
|
+
removeGreenWaveBand(bandId: string): void;
|
|
27
28
|
/**
|
|
28
29
|
* 显示所有路口,进入待选状态
|
|
29
30
|
* @param nodeAttributes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),m=require("@arcgis/core/geometry"),c=require("@arcgis/core/Graphic"),y=require("@arcgis/core/layers/GraphicsLayer"),u=require("axios");function g(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),m=require("@arcgis/core/geometry"),c=require("@arcgis/core/Graphic"),y=require("@arcgis/core/layers/GraphicsLayer"),u=require("axios");function g(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const p=g(b);class f{constructor(e){this.selectedNodeIds=[],this.nodeScale=5e3,this.hasGpu=!1,this.hasGpu=localStorage.getItem("gpu")!=="Unknown",this.view=e,this.roadsectLayer=new y({id:"roadsectLayer"}),this.view.map.add(this.roadsectLayer),this.allNodesLayer=new y({id:"allNodesLayer"}),this.view.map.add(this.allNodesLayer),this.bandLayer=new y({id:"bandLayer"}),this.view.map.add(this.bandLayer)}addGreenWaveBand(e){this.addNodeCallback=e.addCrossCallback,this.removeNodeCallback=e.removeCrossCallback,e.removeAllCrossCallback&&(this.removeAllNodeCallback=e.removeAllCrossCallback),this.selectedNodeIds=[],this.openDriveServer=e.odrServer,this.showAllNodes(e.crossesInArea),this.viewClickWatcher||(this.viewClickWatcher=this.view.on("click",t=>{this.handleViewClick(t)}))}stopAddGreenWaveBand(){var e;(e=this.viewClickWatcher)==null||e.remove(),this.viewClickWatcher=void 0,this.allNodesLayer.removeAll(),this.selectedNodeIds=[],this.roadsectLayer.removeAll(),this.bandLayer.removeAll()}async showGreenWaveBand(e){this.removeGreenWaveBand(e.bandId),this.scaleWatcher||(this.scaleWatcher=p.watch(()=>this.view.scale,(i,o)=>{i>this.nodeScale&&o<=this.nodeScale?this.bandLayer.graphics.forEach(a=>{a.geometry.type==="point"&&(a.symbol=this.getShowNodeSymbol("marker"))}):i<=this.nodeScale&&o>this.nodeScale&&this.bandLayer.graphics.forEach(a=>{a.geometry.type==="point"&&(a.symbol=this.getShowNodeSymbol("picture"))})}));const t=new m.Polyline({paths:[e.coordinates]}),s=new c({geometry:t,symbol:this.getLineSymbol(!0,e),attributes:{bandId:e.bandId,type:"greenWaveBand",id:e.bandId}});this.roadsectLayer.add(s),await this.view.goTo(s),e.nodeList&&e.nodeList.forEach(i=>{const o=new c({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getShowNodeSymbol("picture"),attributes:{...i,bandId:e.bandId,type:"greenWaveBandNode"}});this.bandLayer.add(o)})}removeGreenWaveBand(e){let t=this.bandLayer.graphics.filter(s=>s.getAttribute("bandId")===e);this.bandLayer.removeMany(t.toArray()),t=this.roadsectLayer.graphics.filter(s=>s.getAttribute("bandId")===e),this.roadsectLayer.removeMany(t.toArray())}showAllNodes(e){const t=[];e.forEach(s=>{t.push(new c({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getEditableNodeSymbol(!1),attributes:{...s,selected:!1}}))}),this.allNodesLayer.addMany(t)}async handleViewClick(e){var a;const s=(a=(await this.view.hitTest(e,{include:[this.allNodesLayer]})).results)==null?void 0:a.filter(d=>d.type==="graphic");if(s.length===0)return;const i=s[0].graphic,o=i.getAttribute("id");if(this.selectedNodeIds.includes(o)){const d=this.selectedNodeIds.indexOf(o)+1;if(d===1)this.removeAllNodeCallback&&this.removeAllNodeCallback(),this.selectedNodeIds=[],this.allNodesLayer.graphics.forEach(r=>{r.setAttribute("selected",!1),r.symbol=this.getEditableNodeSymbol(!1),r.visible=!0}),this.roadsectLayer.removeAll();else{for(let r=d;r<this.selectedNodeIds.length;r++){this.removeNodeCallback&&this.removeNodeCallback({id:this.selectedNodeIds[r]});for(let l=0;l<this.roadsectLayer.graphics.length;l++){const h=this.roadsectLayer.graphics.getItemAt(l);(h.getAttribute("id")===this.selectedNodeIds[r]||!h.getAttribute("selected"))&&(this.roadsectLayer.remove(h),l--)}}this.selectedNodeIds=this.selectedNodeIds.slice(0,d),this.allNodesLayer.graphics.forEach(r=>{const l=this.selectedNodeIds.includes(r.getAttribute("id"));r.setAttribute("selected",l),r.symbol=this.getEditableNodeSymbol(l),r.visible=l}),await this.showDownstreamNodes(o)}}else{i.setAttribute("selected",!0),i.symbol=this.getEditableNodeSymbol(!0),this.selectedNodeIds.push(o),this.allNodesLayer.graphics.forEach(r=>{r.visible=r.getAttribute("selected")});let d=[];for(let r=0;r<this.roadsectLayer.graphics.length;r++){const l=this.roadsectLayer.graphics.getItemAt(r);l.getAttribute("id")===o?(l.symbol=this.getLineSymbol(!0),l.setAttribute("selected",!0),d=l.geometry.paths[0]):l.getAttribute("selected")||(this.roadsectLayer.remove(l),r--)}this.addNodeCallback&&this.addNodeCallback({...i.attributes,roadsect:d}),await this.showDownstreamNodes(o)}}async showDownstreamNodes(e){this.view.container.style.cursor="progress";const t=await u.get(`http://${this.openDriveServer}/api/computable/getDownstreamNodes`,{params:{nodeId:e}});if(t.status!==200||t.data.status!==0){this.view.container.style.cursor="default";return}t.data.result.forEach(i=>{this.allNodesLayer.graphics.forEach(o=>{if(o.getAttribute("nodeId")===i.id&&o.getAttribute("selected")===!1&&(o.visible=!0,i.coordinates)){const a=new c({geometry:{type:"polyline",paths:[i.coordinates]},symbol:this.getLineSymbol(!1),attributes:{...i,selected:!1}});this.roadsectLayer.add(a)}})}),this.view.container.style.cursor="default"}getLineSymbol(e,t){if(e){const s=(t==null?void 0:t.lineWidth)||4,i=(t==null?void 0:t.lineColor)||[55,125,34,255],o=(t==null?void 0:t.arrowColor)||[255,255,255,255];return Array.isArray(i)&&i.length===3&&i.push(255),Array.isArray(o)&&o.length===3&&o.push(255),{type:"cim",data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:4,markerPlacement:{type:"CIMMarkerPlacementAlongLineSameSize",endings:"WithMarkers",placementTemplate:[40],angleToLine:!0},frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[s,-s],[3*s,0],[s,s]],[[-s,s],[-3*s,0],[-s,-s]]]},symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,width:1.5,color:o}]}}]},{type:"CIMSolidStroke",enable:!0,width:s,color:i}]}}}}else return{type:"simple-line",color:"gray",width:2}}getShowNodeSymbol(e){return e==="marker"?{type:"simple-marker",style:"circle",color:[61,139,249],size:8,outline:{color:"white",width:1}}:this.getEditableNodeSymbol(!0)}getEditableNodeSymbol(e){return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:30,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:2,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:25,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${e?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}}}exports.default=f;
|
|
@@ -2,7 +2,7 @@ import Graphic from '@arcgis/core/Graphic';
|
|
|
2
2
|
import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer';
|
|
3
3
|
import MapView from '@arcgis/core/views/MapView';
|
|
4
4
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
5
|
-
import {
|
|
5
|
+
import { IClusterPointParams, IMaskParam, IOverlayParam, IResult } from '../../types';
|
|
6
6
|
interface IOverlayOptions {
|
|
7
7
|
id: string;
|
|
8
8
|
}
|
|
@@ -73,13 +73,8 @@ export default class Overlay {
|
|
|
73
73
|
* @memberof Overlay
|
|
74
74
|
*/
|
|
75
75
|
showLayer(): void;
|
|
76
|
-
/**
|
|
77
|
-
* 添加点覆盖物
|
|
78
|
-
* @param overlay
|
|
79
|
-
* @param symbol
|
|
80
|
-
* @param properties
|
|
81
|
-
*/
|
|
82
|
-
addPoint(overlay: IOverlay, symbol: IPointSymbol, properties: any, visible?: boolean): IResult;
|
|
83
76
|
private addOverlay;
|
|
77
|
+
private clusterLayer;
|
|
78
|
+
addClusterPoint(params: IClusterPointParams): void;
|
|
84
79
|
}
|
|
85
80
|
export {};
|