gisviewer-vue3-arcgis 1.0.256 → 1.0.257
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/utils/map-initializer.mjs +1 -1
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.d.ts +9 -1
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +31 -50
- package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +32 -33
- package/es/src/gis-map/utils/signal-control-area/show-area.d.ts +8 -0
- package/es/src/gis-map/utils/signal-control-area/show-area.mjs +12 -10
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +10 -10
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.d.ts +9 -1
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/show-area.d.ts +8 -0
- 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.js +1 -1
- package/package.json +1 -1
|
@@ -242,7 +242,7 @@ class me {
|
|
|
242
242
|
async setLayerVisibility(e) {
|
|
243
243
|
const { id: i, visible: s } = e;
|
|
244
244
|
if (i === "shanghai_district")
|
|
245
|
-
return this.detachmentLayerLoaded
|
|
245
|
+
return !this.detachmentLayerLoaded && e.visible ? await this.loadDetachmentLayer() : this.detachmentLayer.visible = s, { status: 0, message: "ok" };
|
|
246
246
|
{
|
|
247
247
|
const a = this.view.map.findLayerById(i);
|
|
248
248
|
return a ? (a.visible = s, { status: 0, message: "ok" }) : { status: -1, message: "未找到图层" };
|
|
@@ -2,8 +2,16 @@ import DistrictController from './district-controller';
|
|
|
2
2
|
export default class CrossRenderer {
|
|
3
3
|
private view;
|
|
4
4
|
private crossLayer;
|
|
5
|
-
private crossGraphics;
|
|
6
5
|
private crossGraphicSymbol;
|
|
6
|
+
private locations;
|
|
7
7
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
8
8
|
showCrosses(controllers: DistrictController[]): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* 显示聚合点
|
|
11
|
+
*/
|
|
12
|
+
showCluster(): void;
|
|
13
|
+
/**
|
|
14
|
+
* 显示散点
|
|
15
|
+
*/
|
|
16
|
+
showScatter(): void;
|
|
9
17
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
class p {
|
|
1
|
+
import o from "@arcgis/core/layers/GraphicsLayer";
|
|
2
|
+
class l {
|
|
4
3
|
constructor(r) {
|
|
5
|
-
this.
|
|
4
|
+
this.crossGraphicSymbol = {
|
|
6
5
|
type: "cim",
|
|
7
6
|
data: {
|
|
8
7
|
type: "CIMSymbolReference",
|
|
@@ -84,62 +83,44 @@ class p {
|
|
|
84
83
|
]
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
|
-
}, this.view = r, this.crossLayer = new
|
|
86
|
+
}, this.locations = [], this.view = r, this.crossLayer = new o(), this.view.map.add(this.crossLayer);
|
|
88
87
|
}
|
|
89
88
|
async showCrosses(r) {
|
|
90
|
-
|
|
89
|
+
r.forEach((i) => {
|
|
91
90
|
i.signals.forEach((e) => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
attributes: {
|
|
100
|
-
id: e.id,
|
|
101
|
-
name: e.name,
|
|
102
|
-
signalId: e.signalId,
|
|
103
|
-
nodeId: e.nodeId || e.id,
|
|
104
|
-
districtId: i.id,
|
|
105
|
-
districtName: i.name,
|
|
106
|
-
subDistrictId: "",
|
|
107
|
-
subDistrictName: "",
|
|
108
|
-
isKey: e.isKey,
|
|
109
|
-
type: "signal",
|
|
110
|
-
selected: !0
|
|
111
|
-
}
|
|
91
|
+
e.longitude && e.latitude && !isNaN(e.longitude) && !isNaN(e.latitude) && this.locations.push({
|
|
92
|
+
id: e.id,
|
|
93
|
+
x: e.longitude,
|
|
94
|
+
y: e.latitude,
|
|
95
|
+
visited: !1,
|
|
96
|
+
clusterId: void 0,
|
|
97
|
+
properties: e
|
|
112
98
|
});
|
|
113
|
-
this.crossGraphics.push(t);
|
|
114
99
|
}), i.subDistricts.forEach((e) => {
|
|
115
100
|
e.signals.forEach((t) => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
attributes: {
|
|
124
|
-
id: t.id,
|
|
125
|
-
name: t.name,
|
|
126
|
-
signalId: t.signalId,
|
|
127
|
-
nodeId: t.nodeId || t.id,
|
|
128
|
-
districtId: i.id,
|
|
129
|
-
districtName: i.name,
|
|
130
|
-
subDistrictId: e.id,
|
|
131
|
-
subDistrictName: e.name,
|
|
132
|
-
isKey: t.isKey,
|
|
133
|
-
type: "signal",
|
|
134
|
-
selected: !0
|
|
135
|
-
}
|
|
101
|
+
t.longitude && t.latitude && !isNaN(t.longitude) && !isNaN(t.latitude) && this.locations.push({
|
|
102
|
+
id: t.id,
|
|
103
|
+
x: t.longitude,
|
|
104
|
+
y: t.latitude,
|
|
105
|
+
visited: !1,
|
|
106
|
+
clusterId: void 0,
|
|
107
|
+
properties: t
|
|
136
108
|
});
|
|
137
|
-
this.crossGraphics.push(o);
|
|
138
109
|
});
|
|
139
110
|
});
|
|
140
|
-
})
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 显示聚合点
|
|
115
|
+
*/
|
|
116
|
+
showCluster() {
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* 显示散点
|
|
120
|
+
*/
|
|
121
|
+
showScatter() {
|
|
141
122
|
}
|
|
142
123
|
}
|
|
143
124
|
export {
|
|
144
|
-
|
|
125
|
+
l as default
|
|
145
126
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import d from "pako";
|
|
2
|
-
import
|
|
2
|
+
import l from "../common-utils.mjs";
|
|
3
3
|
class c {
|
|
4
|
-
constructor(
|
|
5
|
-
if (this.parentName = "", this.signals = [], this.subDistricts = [], this.areaColor = this.getDarkNonGrayColor(), this.signalCount = 0, this.subDistrictCount = 0, this.roadConnections = [], this.id =
|
|
4
|
+
constructor(o, s) {
|
|
5
|
+
if (this.parentName = "", this.signals = [], this.subDistricts = [], this.areaColor = this.getDarkNonGrayColor(), this.signalCount = 0, this.subDistrictCount = 0, this.roadConnections = [], this.id = o.name, this.name = o.areaDesc, this.parentId = o.parentId, s === "alarm" && (this.areaColor = [255, 0, 0]), o.mapConnectList)
|
|
6
6
|
try {
|
|
7
|
-
const t =
|
|
7
|
+
const t = o.mapConnectList, i = new Uint8Array(
|
|
8
8
|
window.atob(t).split("").map((r) => r.charCodeAt(0))
|
|
9
|
-
), a = d.inflate(
|
|
9
|
+
), a = d.inflate(i, { to: "string" }), n = JSON.parse(a);
|
|
10
10
|
this.roadConnections.push(
|
|
11
11
|
...n.map((r) => ({
|
|
12
12
|
id: r.roadsectId,
|
|
@@ -18,28 +18,27 @@ class c {
|
|
|
18
18
|
} catch (t) {
|
|
19
19
|
console.error("解压子区路段连接信息失败:", t);
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
for (const t of i.children)
|
|
21
|
+
for (const t of o.children)
|
|
23
22
|
if (t.children) {
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
23
|
+
const i = new c(t, s);
|
|
24
|
+
if (i.id = t.id, i.name = `SS ${t.name}`, i.parentId = this.id, i.parentName = this.name, i.areaColor = this.getDarkNonGrayColor(t.id), this.subDistricts.push(i), this.subDistrictCount++, this.signalCount += i.signalCount, t.mapConnectList)
|
|
26
25
|
try {
|
|
27
26
|
const a = t.mapConnectList, n = new Uint8Array(
|
|
28
27
|
window.atob(a).split("").map((e) => e.charCodeAt(0))
|
|
29
|
-
), r = d.inflate(n, { to: "string" }),
|
|
30
|
-
|
|
31
|
-
...
|
|
28
|
+
), r = d.inflate(n, { to: "string" }), h = JSON.parse(r);
|
|
29
|
+
i.roadConnections.push(
|
|
30
|
+
...h.map((e) => ({
|
|
32
31
|
id: e.roadsectId,
|
|
33
32
|
coordinates: JSON.parse(e.geomData).coordinates,
|
|
34
|
-
districtId:
|
|
35
|
-
subDistrictId:
|
|
33
|
+
districtId: i.parentId,
|
|
34
|
+
subDistrictId: i.id
|
|
36
35
|
}))
|
|
37
36
|
);
|
|
38
37
|
} catch (a) {
|
|
39
38
|
console.error("解压子区路段连接信息失败:", a);
|
|
40
39
|
}
|
|
41
|
-
} else if (
|
|
42
|
-
const
|
|
40
|
+
} else if (l.isCoordinateValid(t)) {
|
|
41
|
+
const i = {
|
|
43
42
|
id: t.id,
|
|
44
43
|
name: t.name,
|
|
45
44
|
parentId: t.parentId,
|
|
@@ -49,7 +48,7 @@ class c {
|
|
|
49
48
|
nodeId: t.nodeId,
|
|
50
49
|
isKey: t.isKey === 1
|
|
51
50
|
};
|
|
52
|
-
this.signals.push(
|
|
51
|
+
this.signals.push(i), this.signalCount++;
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
/**
|
|
@@ -57,27 +56,27 @@ class c {
|
|
|
57
56
|
* @returns
|
|
58
57
|
*/
|
|
59
58
|
getAllSignalCoordinates() {
|
|
60
|
-
const
|
|
59
|
+
const o = [];
|
|
61
60
|
for (const s of this.signals)
|
|
62
|
-
|
|
61
|
+
o.push([s.longitude, s.latitude]);
|
|
63
62
|
for (const s of this.subDistricts)
|
|
64
|
-
|
|
65
|
-
return
|
|
63
|
+
o.push(...s.getAllSignalCoordinates());
|
|
64
|
+
return o;
|
|
66
65
|
}
|
|
67
|
-
getDarkNonGrayColor(
|
|
68
|
-
let s, t,
|
|
69
|
-
if (
|
|
70
|
-
const a = this.cyrb53(
|
|
71
|
-
s = ((a & 16711680) >> 16) % 200, t = ((a & 65280) >> 8) % 200,
|
|
66
|
+
getDarkNonGrayColor(o) {
|
|
67
|
+
let s, t, i;
|
|
68
|
+
if (o) {
|
|
69
|
+
const a = this.cyrb53(o);
|
|
70
|
+
s = ((a & 16711680) >> 16) % 200, t = ((a & 65280) >> 8) % 200, i = (a & 255) % 200;
|
|
72
71
|
} else
|
|
73
|
-
s = Math.floor(Math.random() * 256), t = Math.floor(Math.random() * 256),
|
|
74
|
-
return [s, t,
|
|
72
|
+
s = Math.floor(Math.random() * 256), t = Math.floor(Math.random() * 256), i = Math.floor(Math.random() * 256);
|
|
73
|
+
return [s, t, i];
|
|
75
74
|
}
|
|
76
|
-
cyrb53(
|
|
77
|
-
let t = 3735928559 ^ s,
|
|
78
|
-
for (let a = 0, n; a <
|
|
79
|
-
n =
|
|
80
|
-
return t = Math.imul(t ^ t >>> 16, 2246822507), t ^= Math.imul(
|
|
75
|
+
cyrb53(o, s = 0) {
|
|
76
|
+
let t = 3735928559 ^ s, i = 1103547991 ^ s;
|
|
77
|
+
for (let a = 0, n; a < o.length; a++)
|
|
78
|
+
n = o.charCodeAt(a), t = Math.imul(t ^ n, 2654435761), i = Math.imul(i ^ n, 1597334677);
|
|
79
|
+
return t = Math.imul(t ^ t >>> 16, 2246822507), t ^= Math.imul(i ^ i >>> 13, 3266489909), i = Math.imul(i ^ i >>> 16, 2246822507), i ^= Math.imul(t ^ t >>> 13, 3266489909), 4294967296 * (2097151 & i) + (t >>> 0);
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
82
|
export {
|
|
@@ -14,7 +14,15 @@ export default class SignalControlAreaController1 {
|
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
16
|
showSignalControlArea(params: IShowSignalControlAreaParams): Promise<IResult>;
|
|
17
|
+
/**
|
|
18
|
+
* 显示单个区控
|
|
19
|
+
* @param params
|
|
20
|
+
*/
|
|
17
21
|
showDistrict(params: IShowSignalControlAreaParams): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* 显示单个子区
|
|
24
|
+
* @param params
|
|
25
|
+
*/
|
|
18
26
|
showSubDistrict(params: IShowSignalControlAreaParams): Promise<void>;
|
|
19
27
|
/**
|
|
20
28
|
* 清空区控、子区、信号机
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import a from "../../stores/index.mjs";
|
|
2
|
-
import
|
|
2
|
+
import c from "./cross-renderer.mjs";
|
|
3
3
|
import r from "./district-controller.mjs";
|
|
4
|
-
import
|
|
4
|
+
import l from "./district-renderer.mjs";
|
|
5
5
|
import o from "./signal-renderer.mjs";
|
|
6
6
|
import d from "./sub-district-renderer.mjs";
|
|
7
7
|
class f {
|
|
@@ -9,7 +9,7 @@ class f {
|
|
|
9
9
|
constructor(t) {
|
|
10
10
|
this.view = t;
|
|
11
11
|
const i = a.useAppDataStore;
|
|
12
|
-
this.mapConfig = JSON.parse(JSON.stringify(i.mapConfig)), this.districtRenderer = new
|
|
12
|
+
this.mapConfig = JSON.parse(JSON.stringify(i.mapConfig)), this.districtRenderer = new l(t), this.subDistrictRenderer = new d(t), this.signalRenderer = new o(t), this.crossRenderer = new c(t);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* 显示所有区控、子区、信号机
|
|
@@ -26,8 +26,12 @@ class f {
|
|
|
26
26
|
);
|
|
27
27
|
i.push(n), s.push(...n.subDistricts);
|
|
28
28
|
}
|
|
29
|
-
return this.districtRenderer.style = t.style || "", await this.districtRenderer.showDistricts(i), await this.subDistrictRenderer.showSubDistricts(s),
|
|
29
|
+
return this.districtRenderer.style = t.style || "", await this.districtRenderer.showDistricts(i), await this.subDistrictRenderer.showSubDistricts(s), this.crossRenderer.showCrosses(i), { status: 0, message: "ok" };
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* 显示单个区控
|
|
33
|
+
* @param params
|
|
34
|
+
*/
|
|
31
35
|
async showDistrict(t) {
|
|
32
36
|
this.setLayerVisibility({ id: "district", visible: !0 }), this.setLayerVisibility({ id: "subDistrict", visible: !0 });
|
|
33
37
|
const i = new r(
|
|
@@ -41,6 +45,10 @@ class f {
|
|
|
41
45
|
type: "district"
|
|
42
46
|
});
|
|
43
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* 显示单个子区
|
|
50
|
+
* @param params
|
|
51
|
+
*/
|
|
44
52
|
async showSubDistrict(t) {
|
|
45
53
|
this.setLayerVisibility({ id: "subDistrict", visible: !0 });
|
|
46
54
|
const i = new r(
|
|
@@ -72,12 +80,6 @@ class f {
|
|
|
72
80
|
case "subDistrict":
|
|
73
81
|
this.subDistrictRenderer.setVisible(t.visible);
|
|
74
82
|
break;
|
|
75
|
-
case "signal":
|
|
76
|
-
this.signalRenderer.setPointVisible(t.visible);
|
|
77
|
-
break;
|
|
78
|
-
case "signalCluster":
|
|
79
|
-
this.signalRenderer.setClusterVisible(t.visible);
|
|
80
|
-
break;
|
|
81
83
|
}
|
|
82
84
|
return { status: 0, message: "ok" };
|
|
83
85
|
}
|
|
@@ -2,7 +2,7 @@ import m from "@arcgis/core/Graphic";
|
|
|
2
2
|
import v from "@arcgis/core/layers/FeatureLayer";
|
|
3
3
|
import D from "../common-utils.mjs";
|
|
4
4
|
import { subDistrictPointLayerOptions as I, subDistrictLineLayerOptions as z } from "./layer-symbol.mjs";
|
|
5
|
-
class
|
|
5
|
+
class R {
|
|
6
6
|
constructor(i) {
|
|
7
7
|
this.roadConnections = [], this.view = i, this.subDistrictPointLayer = new v(
|
|
8
8
|
I
|
|
@@ -106,27 +106,27 @@ class C {
|
|
|
106
106
|
*/
|
|
107
107
|
async showRoads(i) {
|
|
108
108
|
const { type: s, id: e } = i, r = this.subDistrictPointLayer.createQuery(), a = s === "district" ? "districtId" : "subDistrictId";
|
|
109
|
-
r.where = `${a} = '${e}'
|
|
109
|
+
e !== "" ? r.where = `${a} = '${e}'` : r.where = "1=1";
|
|
110
110
|
const t = await this.subDistrictPointLayer.queryFeatures(
|
|
111
111
|
r
|
|
112
112
|
), n = /* @__PURE__ */ new Map();
|
|
113
113
|
t.features.forEach((u) => {
|
|
114
|
-
var
|
|
114
|
+
var b;
|
|
115
115
|
const {
|
|
116
116
|
subDistrictId: o,
|
|
117
117
|
color: c,
|
|
118
118
|
id: p,
|
|
119
119
|
districtName: h,
|
|
120
120
|
subDistrictName: L,
|
|
121
|
-
signalCount:
|
|
121
|
+
signalCount: y
|
|
122
122
|
} = u.attributes;
|
|
123
123
|
n.has(o) || n.set(o, {
|
|
124
124
|
color: c,
|
|
125
125
|
signalIds: [],
|
|
126
126
|
districtName: h,
|
|
127
127
|
subDistrictName: L,
|
|
128
|
-
signalCount:
|
|
129
|
-
}), (
|
|
128
|
+
signalCount: y
|
|
129
|
+
}), (b = n.get(o)) == null || b.signalIds.push(p);
|
|
130
130
|
});
|
|
131
131
|
const d = [], f = [];
|
|
132
132
|
for (const u of n) {
|
|
@@ -141,7 +141,7 @@ class C {
|
|
|
141
141
|
style: "solid"
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
|
-
const { districtName: p, subDistrictName: h, signalIds: L, signalCount:
|
|
144
|
+
const { districtName: p, subDistrictName: h, signalIds: L, signalCount: y } = u[1];
|
|
145
145
|
this.roadConnections.filter(
|
|
146
146
|
(l) => l.subDistrictId === c
|
|
147
147
|
).forEach((l) => {
|
|
@@ -157,7 +157,7 @@ class C {
|
|
|
157
157
|
subDistrictId: c,
|
|
158
158
|
subDistrictName: h,
|
|
159
159
|
districtName: p,
|
|
160
|
-
signalCount:
|
|
160
|
+
signalCount: y,
|
|
161
161
|
color: u[1].color
|
|
162
162
|
}
|
|
163
163
|
});
|
|
@@ -219,7 +219,7 @@ class C {
|
|
|
219
219
|
}), this.subDistrictLineLayer.definitionExpression = "1=1", (e = this.clickHandler) == null || e.remove();
|
|
220
220
|
}
|
|
221
221
|
setVisible(i) {
|
|
222
|
-
this.subDistrictPointLayer.visible = i, this.subDistrictLineLayer.visible = i;
|
|
222
|
+
this.showRoads({ type: "district", id: "" }), this.subDistrictPointLayer.visible = i, this.subDistrictLineLayer.visible = i;
|
|
223
223
|
}
|
|
224
224
|
/**
|
|
225
225
|
* 定位子区
|
|
@@ -388,5 +388,5 @@ class C {
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
export {
|
|
391
|
-
|
|
391
|
+
R as default
|
|
392
392
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/Basemap"),M=require("@arcgis/core/config"),W=require("@arcgis/core/core/reactiveUtils"),b=require("@arcgis/core/geometry"),C=require("@arcgis/core/geometry/support/webMercatorUtils"),T=require("@arcgis/core/Graphic"),I=require("@arcgis/core/layers/FeatureLayer"),G=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/GroupLayer"),S=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),x=require("@arcgis/core/layers/MapImageLayer"),_=require("@arcgis/core/layers/TileLayer"),j=require("@arcgis/core/layers/WebTileLayer"),H=require("@arcgis/core/layers/WMSLayer"),B=require("@arcgis/core/Map"),N=require("@arcgis/core/views/MapView"),R=require("@arcgis/core/views/SceneView"),E=require("@turf/destination"),U=require("@turf/helpers"),A=require("@arcgis/core/layers/GraphicsLayer"),D=require("./custom-layer/custom-wmts-layer.js");function k(y){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(y){for(const i in y)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(y,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>y[i]})}}return e.default=y,Object.freeze(e)}const q=k(W),L=k(C),V=k(U);class J{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null,this.detachmentLayerLoaded=!1}processUrl(e){return e&&(e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("{{")?e.replace("{{geoServer}}",this.mapConfig.geoServer):this.mapConfig.assetsRoot+e)}async initialize(e){var p,w,g,m;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/Basemap"),M=require("@arcgis/core/config"),W=require("@arcgis/core/core/reactiveUtils"),b=require("@arcgis/core/geometry"),C=require("@arcgis/core/geometry/support/webMercatorUtils"),T=require("@arcgis/core/Graphic"),I=require("@arcgis/core/layers/FeatureLayer"),G=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/GroupLayer"),S=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),x=require("@arcgis/core/layers/MapImageLayer"),_=require("@arcgis/core/layers/TileLayer"),j=require("@arcgis/core/layers/WebTileLayer"),H=require("@arcgis/core/layers/WMSLayer"),B=require("@arcgis/core/Map"),N=require("@arcgis/core/views/MapView"),R=require("@arcgis/core/views/SceneView"),E=require("@turf/destination"),U=require("@turf/helpers"),A=require("@arcgis/core/layers/GraphicsLayer"),D=require("./custom-layer/custom-wmts-layer.js");function k(y){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(y){for(const i in y)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(y,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>y[i]})}}return e.default=y,Object.freeze(e)}const q=k(W),L=k(C),V=k(U);class J{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null,this.detachmentLayerLoaded=!1}processUrl(e){return e&&(e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("{{")?e.replace("{{geoServer}}",this.mapConfig.geoServer):this.mapConfig.assetsRoot+e)}async initialize(e){var p,w,g,m;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:a}=e;M.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,M.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,M.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const o=new B;((p=this.mapConfig)==null?void 0:p.mapOptions.mode.toLowerCase())==="2d"?(this.view=new N({map:o,container:i,...this.mapConfig.mapOptions}),this.view.on("drag",t=>{t.button===2&&t.stopPropagation()})):this.view=new R({map:o,container:i,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(w=this.mapConfig)==null?void 0:w.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async t=>{var l,v;if(a){let n=t.mapPoint;n.spatialReference.isWebMercator&&(n=L.webMercatorToGeographic(n)),a([n.x,n.y],[t.screenPoint.x,t.screenPoint.y],t)}if(this.view.type==="3d"){const n=this.view.camera;if(this.view.spatialReference.isWebMercator){const d=L.webMercatorToGeographic(n.position),f={heading:n.heading,tilt:n.tilt,position:d.toJSON()};console.log(f),(l=navigator.clipboard)==null||l.writeText(JSON.stringify(f))}else console.log(n.toJSON());console.log(this.view.zoom,this.view.scale)}else{let n=this.view.center;this.view.spatialReference.isWebMercator&&(n=L.webMercatorToGeographic(n)),console.log({center:n.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(v=(await this.view.hitTest(t)).results)==null?void 0:v.filter(n=>n.type==="graphic");c.length>0&&c.forEach(n=>{var f;const d=n.graphic;(f=d.attributes)!=null&&f.type&&s&&s(d.attributes.type,d.attributes.id,d.attributes,t)})});{let t=0,r=!1;this.view.on("pointer-move",async c=>{var v;const l=performance.now();if(!(r||l-t<100)){t=l,r=!0;try{const d=(v=(await this.view.hitTest(c)).results)==null?void 0:v.some(z=>z.type==="graphic"),f=this.view.container;f&&(f.style.cursor=d?"pointer":"default")}finally{r=!1}}})}if(this.view.on("pointer-leave",()=>{const t=this.view.container;t&&(t.style.cursor="default")}),(g=this.mapConfig)!=null&&g.baseLayers?this.mapConfig.baseLayers.forEach(t=>{const r=this.processUrl(t.url);let c=null;switch(t.type.toLowerCase()){case"webTile".toLowerCase():{c=new j({urlTemplate:r,...t.options});break}case"tile":{c=new _({url:r,...t.options});break}case"customwmts".toLowerCase():{c=new D.default({urlTemplate:r,...t.options});break}case"mapimage".toLowerCase():{c=new x({url:r,...t.options});break}case"arcgis":{const l=new P(t.options);o.basemap=l;break}case"feature":{c=new I({url:r,...t.options});break}case"3dtiles":{c=new S({url:r,...t.options});break}case"wms":{c=new H({url:r,...t.options});break}}if(c)if(t.group){let l=o.findLayerById(t.group);l&&l.type==="group"?l.add(c):(l=new O({id:t.group,title:t.groupTitle,visibilityMode:"inherited",layers:[c],visible:t.groupVisible!==!1}),o.add(l))}else o.add(c)}):o.basemap=new P({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(m=this.mapConfig)!=null&&m.hdLayers){const t=this.mapConfig.hdLayers.map(r=>new G({url:this.processUrl(r.url),...r.options,title:r.options.id}));o.addMany(t)}this.view.ui.remove("attribution"),await this.view.when();const h=this.mapConfig.camera;let u;if(this.view.type==="2d"){let t=this.view.center;this.view.spatialReference.isWebMercator&&(t=L.webMercatorToGeographic(t)),u={center:[t.x,t.y],zoom:this.view.zoom}}else{let t=this.view.camera.position;this.view.spatialReference.isWebMercator&&(t=L.webMercatorToGeographic(t)),u={position:t,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return h?h.home=u:this.mapConfig.camera={home:u},this.view}async setLayerVisibility(e){const{id:i,visible:s}=e;if(i==="shanghai_district")return!this.detachmentLayerLoaded&&e.visible?await this.loadDetachmentLayer():this.detachmentLayer.visible=s,{status:0,message:"ok"};{const a=this.view.map.findLayerById(i);return a?(a.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type.toLowerCase()){case"point":e.target=new b.Point(e.target);break;case"polyline":e.target=new b.Polyline(e.target);break;case"polygon":e.target=new b.Polygon(e.target);break;case"multipoint":e.target=new b.Multipoint(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}setMapZoom(e){return this.view?(this.view.zoom=e.zoom,{status:0,message:"成功"}):{status:-1,message:"未初始化"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,s=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:s,tilt:0},{duration:(e.duration||2)*1e3});else{const a=Math.tan(i*Math.PI/180)*e.height,o=E(V.point(e.center),a,s+180,{units:"meters"});await this.view.goTo({position:{x:o.geometry.coordinates[0],y:o.geometry.coordinates[1],z:e.height},heading:s,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:s=0}=e,{camera:a}=this.mapConfig;if(!a)return{status:-1,message:"未配置camera"};const o=a[i];return o?(await this.view.goTo(o,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let s=0;const o=1e3/30,h=q.watch(()=>this.view.center,()=>{const u=this.transformPoints(e),p=Date.now();p-s>o&&(i(u),s=p)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,h),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const s=new b.Point({x:i[0],y:i[1]}),a=this.view.toScreen(s);return[a.x,a.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:s}=e;!i&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=q.watch(()=>this.view.zoom,a=>{i&&a<=i&&(this.view.zoom=i),s&&a>=s&&(this.view.zoom=s)}))}async loadDetachmentLayer(){this.detachmentLayer=new A({id:"detachmentLayer",title:"支队图层",effect:void 0}),this.view.map.add(this.detachmentLayer);const e=this.mapConfig.baseLayers;if(!e)return;const i=e.find(s=>s.options.id==="shanghai_district");if(i)try{const a=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),o=[],{renderer:h,labelingInfo:u}=i.options;a.features.forEach(p=>{const w=p.attributes.ZD_NAME;if(w!=="高架支队"){let g=new b.Polygon({rings:p.geometry.rings});g=C.webMercatorToGeographic(g);const m=new T({geometry:g,attributes:p.attributes});if(h){if(h.type==="simple")m.symbol=h.symbol;else if(h.type==="unique-value"){const t=m.getAttribute("OBJECTID"),r=h.uniqueValueInfos.find(c=>c.value==t);m.symbol=r?r.symbol:h.defaultSymbol}}else m.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(o.push(m),u&&w!=="边防港航支队"&&w!=="机场支队"){const t=new T({geometry:g.centroid,symbol:{...u.symbol,text:w}});o.push(t)}}}),this.detachmentLayer.addMany(o),this.detachmentLayerLoaded=!0}catch(s){console.error("加载支队图层失败:",s);return}}}exports.default=J;
|
|
@@ -2,8 +2,16 @@ import DistrictController from './district-controller';
|
|
|
2
2
|
export default class CrossRenderer {
|
|
3
3
|
private view;
|
|
4
4
|
private crossLayer;
|
|
5
|
-
private crossGraphics;
|
|
6
5
|
private crossGraphicSymbol;
|
|
6
|
+
private locations;
|
|
7
7
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
8
8
|
showCrosses(controllers: DistrictController[]): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* 显示聚合点
|
|
11
|
+
*/
|
|
12
|
+
showCluster(): void;
|
|
13
|
+
/**
|
|
14
|
+
* 显示散点
|
|
15
|
+
*/
|
|
16
|
+
showScatter(): void;
|
|
9
17
|
}
|
|
@@ -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 o=require("@arcgis/core/layers/GraphicsLayer");class s{constructor(r){this.crossGraphicSymbol={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:32,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:18,haloSize:1,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:20,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}},this.locations=[],this.view=r,this.crossLayer=new o,this.view.map.add(this.crossLayer)}async showCrosses(r){r.forEach(i=>{i.signals.forEach(e=>{e.longitude&&e.latitude&&!isNaN(e.longitude)&&!isNaN(e.latitude)&&this.locations.push({id:e.id,x:e.longitude,y:e.latitude,visited:!1,clusterId:void 0,properties:e})}),i.subDistricts.forEach(e=>{e.signals.forEach(t=>{t.longitude&&t.latitude&&!isNaN(t.longitude)&&!isNaN(t.latitude)&&this.locations.push({id:t.id,x:t.longitude,y:t.latitude,visited:!1,clusterId:void 0,properties:t})})})})}showCluster(){}showScatter(){}}exports.default=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("pako"),h=require("../common-utils.js");class d{constructor(o,s){if(this.parentName="",this.signals=[],this.subDistricts=[],this.areaColor=this.getDarkNonGrayColor(),this.signalCount=0,this.subDistrictCount=0,this.roadConnections=[],this.id=o.name,this.name=o.areaDesc,this.parentId=o.parentId,s==="alarm"&&(this.areaColor=[255,0,0]),o.mapConnectList)try{const t=o.mapConnectList,i=new Uint8Array(window.atob(t).split("").map(
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("pako"),h=require("../common-utils.js");class d{constructor(o,s){if(this.parentName="",this.signals=[],this.subDistricts=[],this.areaColor=this.getDarkNonGrayColor(),this.signalCount=0,this.subDistrictCount=0,this.roadConnections=[],this.id=o.name,this.name=o.areaDesc,this.parentId=o.parentId,s==="alarm"&&(this.areaColor=[255,0,0]),o.mapConnectList)try{const t=o.mapConnectList,i=new Uint8Array(window.atob(t).split("").map(r=>r.charCodeAt(0))),a=c.inflate(i,{to:"string"}),n=JSON.parse(a);this.roadConnections.push(...n.map(r=>({id:r.roadsectId,coordinates:JSON.parse(r.geomData).coordinates,districtId:this.parentId,subDistrictId:this.id})))}catch(t){console.error("解压子区路段连接信息失败:",t)}for(const t of o.children)if(t.children){const i=new d(t,s);if(i.id=t.id,i.name=`SS ${t.name}`,i.parentId=this.id,i.parentName=this.name,i.areaColor=this.getDarkNonGrayColor(t.id),this.subDistricts.push(i),this.subDistrictCount++,this.signalCount+=i.signalCount,t.mapConnectList)try{const a=t.mapConnectList,n=new Uint8Array(window.atob(a).split("").map(e=>e.charCodeAt(0))),r=c.inflate(n,{to:"string"}),l=JSON.parse(r);i.roadConnections.push(...l.map(e=>({id:e.roadsectId,coordinates:JSON.parse(e.geomData).coordinates,districtId:i.parentId,subDistrictId:i.id})))}catch(a){console.error("解压子区路段连接信息失败:",a)}}else if(h.default.isCoordinateValid(t)){const i={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId,nodeId:t.nodeId,isKey:t.isKey===1};this.signals.push(i),this.signalCount++}}getAllSignalCoordinates(){const o=[];for(const s of this.signals)o.push([s.longitude,s.latitude]);for(const s of this.subDistricts)o.push(...s.getAllSignalCoordinates());return o}getDarkNonGrayColor(o){let s,t,i;if(o){const a=this.cyrb53(o);s=((a&16711680)>>16)%200,t=((a&65280)>>8)%200,i=(a&255)%200}else s=Math.floor(Math.random()*256),t=Math.floor(Math.random()*256),i=Math.floor(Math.random()*256);return[s,t,i]}cyrb53(o,s=0){let t=3735928559^s,i=1103547991^s;for(let a=0,n;a<o.length;a++)n=o.charCodeAt(a),t=Math.imul(t^n,2654435761),i=Math.imul(i^n,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&i)+(t>>>0)}}exports.default=d;
|
|
@@ -14,7 +14,15 @@ export default class SignalControlAreaController1 {
|
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
16
|
showSignalControlArea(params: IShowSignalControlAreaParams): Promise<IResult>;
|
|
17
|
+
/**
|
|
18
|
+
* 显示单个区控
|
|
19
|
+
* @param params
|
|
20
|
+
*/
|
|
17
21
|
showDistrict(params: IShowSignalControlAreaParams): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* 显示单个子区
|
|
24
|
+
* @param params
|
|
25
|
+
*/
|
|
18
26
|
showSubDistrict(params: IShowSignalControlAreaParams): Promise<void>;
|
|
19
27
|
/**
|
|
20
28
|
* 清空区控、子区、信号机
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../stores/index.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../stores/index.js"),c=require("./cross-renderer.js"),r=require("./district-controller.js"),l=require("./district-renderer.js"),d=require("./signal-renderer.js"),u=require("./sub-district-renderer.js");class o{constructor(t){this.view=t;const e=a.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(e.mapConfig)),this.districtRenderer=new l.default(t),this.subDistrictRenderer=new u.default(t),this.signalRenderer=new d.default(t),this.crossRenderer=new c.default(t)}async showSignalControlArea(t){await this.clearSignalControlArea(),this.districtRenderer.setVisible(!1),this.subDistrictRenderer.setVisible(!1),this.signalRenderer.setClusterVisible(!1),this.signalRenderer.setPointVisible(!1);const e=[],s=[];for(const i of t.areaList){const n=new r.default(i,t.style||"");e.push(n),s.push(...n.subDistricts)}return this.districtRenderer.style=t.style||"",await this.districtRenderer.showDistricts(e),await this.subDistrictRenderer.showSubDistricts(s),this.crossRenderer.showCrosses(e),{status:0,message:"ok"}}async showDistrict(t){this.setLayerVisibility({id:"district",visible:!0}),this.setLayerVisibility({id:"subDistrict",visible:!0});const e=new r.default(t.areaList,t.style||"");await this.districtRenderer.showDistricts([e]),await this.subDistrictRenderer.showSubDistricts(e.subDistricts),await this.subDistrictRenderer.showRoads({id:e.id,type:"district"})}async showSubDistrict(t){this.setLayerVisibility({id:"subDistrict",visible:!0});const e=new r.default(t.areaList,t.style||"");await this.subDistrictRenderer.showSubDistricts([e]),await this.subDistrictRenderer.showRoads({id:e.id,type:"subDistrict"})}async clearSignalControlArea(){return await this.districtRenderer.clearDistricts(),await this.subDistrictRenderer.clearSubDistricts(),await this.signalRenderer.clearSignals(),{status:0,message:"ok"}}setLayerVisibility(t){switch(t.visible===!1&&this.view.closePopup(),t.id){case"district":this.districtRenderer.setVisible(t.visible);break;case"subDistrict":this.subDistrictRenderer.setVisible(t.visible);break}return{status:0,message:"ok"}}async locateSignalControlArea(t){switch(t.type){case"district":return await this.districtRenderer.locateDistrict(t.id);case"subDistrict":return await this.subDistrictRenderer.locateSubDistrict(t.id);case"signal":return await this.signalRenderer.locateSignal(t.id);default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(t){switch(this.view.closePopup(),t.type){case"district":return await this.districtRenderer.highlightDistrict(t)?(this.subDistrictRenderer.filter(t),this.signalRenderer.filter(t),await this.subDistrictRenderer.showRoads(t),{status:0,message:"ok"}):{status:1,message:"未找到区控"};case"subDistrict":{const{count:e,parentId:s}=await this.subDistrictRenderer.highlightSubDistrict(t);return e>0?(this.districtRenderer.filter(s),this.signalRenderer.filter(t),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}case"signal":{const{districtId:e,subDistrictId:s,count:i}=await this.signalRenderer.highlightSignal(t.id);return i>0?(this.districtRenderer.filter(e),this.subDistrictRenderer.filter(t),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){return this.districtRenderer.resetFilter(),this.subDistrictRenderer.resetFilter(),this.signalRenderer.resetFilter(),{status:0,message:"ok"}}}exports.default=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("@arcgis/core/Graphic"),m=require("@arcgis/core/layers/FeatureLayer"),D=require("../common-utils.js"),w=require("./layer-symbol.js");class g{constructor(e){this.roadConnections=[],this.view=e,this.subDistrictPointLayer=new m(w.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=e.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new m(w.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=e.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(e){var a;await this.clearSubDistricts(),(a=this.clickHandler)==null||a.remove(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const i=[],r=[];e.forEach(t=>{t.roadConnections.length>0&&this.roadConnections.push(...t.roadConnections),r.push({value:t.id,label:t.name,symbol:{type:"simple-marker",style:"circle",color:[...t.areaColor,.8],size:"8px",outline:{color:[...t.areaColor],width:4}}}),t.signals.forEach(u=>{const d=new v({geometry:{type:"point",longitude:u.longitude,latitude:u.latitude},attributes:{ObjectID:s++,id:u.nodeId,name:u.name,subDistrictId:t.id,subDistrictName:t.name,districtId:t.parentId,districtName:t.parentName,signalCount:t.signalCount,color:t.areaColor.join(","),type:"subDistrict"}});i.push(d)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:[180,180,180,.5],size:"8px",outline:{color:"white",width:1}},defaultLabel:"其他子区",uniqueValueInfos:r,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:i}),await D.default.viewGoto(this.view,i)}async showRoads(e){const{type:s,id:i}=e,r=this.subDistrictPointLayer.createQuery(),a=s==="district"?"districtId":"subDistrictId";r.where=`${a} = '${i}'
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("@arcgis/core/Graphic"),m=require("@arcgis/core/layers/FeatureLayer"),D=require("../common-utils.js"),w=require("./layer-symbol.js");class g{constructor(e){this.roadConnections=[],this.view=e,this.subDistrictPointLayer=new m(w.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=e.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new m(w.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=e.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(e){var a;await this.clearSubDistricts(),(a=this.clickHandler)==null||a.remove(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const i=[],r=[];e.forEach(t=>{t.roadConnections.length>0&&this.roadConnections.push(...t.roadConnections),r.push({value:t.id,label:t.name,symbol:{type:"simple-marker",style:"circle",color:[...t.areaColor,.8],size:"8px",outline:{color:[...t.areaColor],width:4}}}),t.signals.forEach(u=>{const d=new v({geometry:{type:"point",longitude:u.longitude,latitude:u.latitude},attributes:{ObjectID:s++,id:u.nodeId,name:u.name,subDistrictId:t.id,subDistrictName:t.name,districtId:t.parentId,districtName:t.parentName,signalCount:t.signalCount,color:t.areaColor.join(","),type:"subDistrict"}});i.push(d)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:[180,180,180,.5],size:"8px",outline:{color:"white",width:1}},defaultLabel:"其他子区",uniqueValueInfos:r,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:i}),await D.default.viewGoto(this.view,i)}async showRoads(e){const{type:s,id:i}=e,r=this.subDistrictPointLayer.createQuery(),a=s==="district"?"districtId":"subDistrictId";i!==""?r.where=`${a} = '${i}'`:r.where="1=1";const t=await this.subDistrictPointLayer.queryFeatures(r),u=new Map;t.features.forEach(n=>{var p;const{subDistrictId:o,color:c,id:h,districtName:y,subDistrictName:L,signalCount:b}=n.attributes;u.has(o)||u.set(o,{color:c,signalIds:[],districtName:y,subDistrictName:L,signalCount:b}),(p=u.get(o))==null||p.signalIds.push(h)});const d=[],f=[];for(const n of u){let o=0;const c=n[0];d.push({value:c,symbol:{type:"simple-line",color:n[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:h,subDistrictName:y,signalIds:L,signalCount:b}=n[1];this.roadConnections.filter(l=>l.subDistrictId===c).forEach(l=>{const I=new v({geometry:{type:"polyline",paths:l.coordinates},attributes:{ObjectID:o++,id:l.id,districtId:l.districtId,subDistrictId:c,subDistrictName:y,districtName:h,signalCount:b,color:n[1].color}});f.push(I)})}this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",color:[180,180,180,.5],width:2,style:"solid"},defaultLabel:"其他子区",uniqueValueInfos:d,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentLineRenderer=this.subDistrictLineLayer.renderer.clone(),await this.subDistrictLineLayer.applyEdits({addFeatures:f})}async clearSubDistricts(){var i;const e=await this.subDistrictPointLayer.queryFeatures();e.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictPointLayer.definitionExpression="1=1";const s=await this.subDistrictLineLayer.queryFeatures();s.features.length>0&&await this.subDistrictLineLayer.applyEdits({deleteFeatures:s.features}),this.subDistrictLineLayer.definitionExpression="1=1",(i=this.clickHandler)==null||i.remove()}setVisible(e){this.showRoads({type:"district",id:""}),this.subDistrictPointLayer.visible=e,this.subDistrictLineLayer.visible=e}async locateSubDistrict(e){const s=this.subDistrictPointLayer.createQuery();s.where=`subDistrictId = '${e}'`,s.returnGeometry=!0;const i=await this.subDistrictPointLayer.queryFeatures(s);return i.features.length>0?(await D.default.viewGoto(this.view,i.features,!1),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(e){let s="";const i=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${e.id}'`;const r=await this.subDistrictPointLayer.queryFeatures(),a=r.features.length;return a>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${e.id}'`,s=r.features[0].attributes.districtId,await D.default.viewGoto(this.view,r.features,e.needZoom!==!1)):this.subDistrictPointLayer.definitionExpression=i,{count:a,parentId:s}}filter(e){const{type:s,id:i}=e,r=`${s==="district"?"districtId":"subDistrictId"} = '${i}'`;this.subDistrictPointLayer.definitionExpression=r,this.subDistrictLineLayer.definitionExpression=r}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(e){var r;const i=(r=(await this.view.hitTest(e,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(a=>a.type==="graphic");if(i.length===0)console.time("resetRenderer"),this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const a=i[0].graphic,t=a.attributes.color.split(",").map(Number);this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[180,180,180,.5],width:4}},defaultLabel:"其他子区",uniqueValueInfos:[{value:a.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[...t,.8],size:"8px",outline:{color:t,width:4}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",style:"solid",color:[180,180,180,.5],width:"8px"},defaultLabel:"其他子区",uniqueValueInfos:[{value:a.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:a.attributes.color.split(",").map(Number),width:"8px"}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]}}}}exports.default=g;
|