gisviewer-vue3-arcgis 1.0.234 → 1.0.236
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/common-utils.d.ts +2 -0
- package/es/src/gis-map/utils/common-utils.mjs +37 -23
- package/es/src/gis-map/utils/detect-gpu.mjs +4 -4
- package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +20 -24
- package/es/src/gis-map/utils/signal-control-area/district-renderer.d.ts +1 -2
- package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +19 -24
- package/es/src/gis-map/utils/signal-control-area/show-area.mjs +8 -8
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +1 -2
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +24 -25
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +1 -2
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +63 -68
- package/lib/src/gis-map/utils/common-utils.d.ts +2 -0
- package/lib/src/gis-map/utils/common-utils.js +1 -1
- package/lib/src/gis-map/utils/detect-gpu.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/district-renderer.d.ts +1 -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/signal-renderer.d.ts +1 -2
- package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +1 -2
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Point, Polygon, Polyline } from '@arcgis/core/geometry';
|
|
2
|
+
import Graphic from '@arcgis/core/Graphic';
|
|
2
3
|
import * as turf from '@turf/helpers';
|
|
3
4
|
export default class CommonUtils {
|
|
4
5
|
/**
|
|
@@ -89,4 +90,5 @@ export default class CommonUtils {
|
|
|
89
90
|
* @returns
|
|
90
91
|
*/
|
|
91
92
|
static getCenterPointInLine(line: number[][]): number[];
|
|
93
|
+
static viewGoto(view: __esri.MapView | __esri.SceneView, target: Graphic[]): Promise<void>;
|
|
92
94
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Point as L, Polyline as
|
|
2
|
-
import * as
|
|
1
|
+
import { Point as L, Polyline as g } from "@arcgis/core/geometry";
|
|
2
|
+
import * as f from "@arcgis/core/geometry/geometryEngineAsync";
|
|
3
3
|
import * as l from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
4
4
|
import p from "@turf/bearing";
|
|
5
5
|
import u from "@turf/destination";
|
|
6
|
-
import * as
|
|
6
|
+
import * as c from "@turf/helpers";
|
|
7
7
|
import d from "@turf/length";
|
|
8
8
|
import O from "@turf/line-slice-along";
|
|
9
9
|
import w from "pako";
|
|
10
|
-
import
|
|
10
|
+
import h from "proj4";
|
|
11
11
|
class s {
|
|
12
12
|
/**
|
|
13
13
|
* 得到某个点在一定方向、距离之外的另一个点
|
|
@@ -17,7 +17,7 @@ class s {
|
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
19
|
static destinationWithPoint(t, e, n) {
|
|
20
|
-
const r =
|
|
20
|
+
const r = c.point([t.x, t.y]), i = u(r, n, e, {
|
|
21
21
|
units: "meters"
|
|
22
22
|
});
|
|
23
23
|
return new L({
|
|
@@ -31,7 +31,7 @@ class s {
|
|
|
31
31
|
* @returns
|
|
32
32
|
*/
|
|
33
33
|
static angleOfLine(t) {
|
|
34
|
-
const e = t.paths[0], n =
|
|
34
|
+
const e = t.paths[0], n = c.point(e[0]), r = c.point(e[e.length - 1]);
|
|
35
35
|
return p(n, r);
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
@@ -40,14 +40,14 @@ class s {
|
|
|
40
40
|
* @param distance
|
|
41
41
|
*/
|
|
42
42
|
static extendLineInTowDir(t, e) {
|
|
43
|
-
const n = t.paths[0], r =
|
|
43
|
+
const n = t.paths[0], r = c.point(n[0]), i = c.point(n[1]), o = p(i, r), a = u(r, e, o, {
|
|
44
44
|
units: "meters"
|
|
45
|
-
}),
|
|
45
|
+
}), y = o > 0 ? o - 180 : o + 180, P = u(i, e, y, {
|
|
46
46
|
units: "meters"
|
|
47
47
|
});
|
|
48
|
-
return new
|
|
48
|
+
return new g({
|
|
49
49
|
paths: [
|
|
50
|
-
[
|
|
50
|
+
[a.geometry.coordinates, P.geometry.coordinates]
|
|
51
51
|
]
|
|
52
52
|
});
|
|
53
53
|
}
|
|
@@ -58,7 +58,7 @@ class s {
|
|
|
58
58
|
* @returns
|
|
59
59
|
*/
|
|
60
60
|
static async getIntersectPointOfTwoLines(t, e) {
|
|
61
|
-
const n = await
|
|
61
|
+
const n = await f.intersectLinesToPoints(
|
|
62
62
|
t,
|
|
63
63
|
e
|
|
64
64
|
);
|
|
@@ -84,7 +84,7 @@ class s {
|
|
|
84
84
|
e,
|
|
85
85
|
i
|
|
86
86
|
), await s.pointDistance(r) > 2.5) {
|
|
87
|
-
const o = new
|
|
87
|
+
const o = new g({ paths: [r] });
|
|
88
88
|
return (await s.getOffsetLine(
|
|
89
89
|
o,
|
|
90
90
|
-i
|
|
@@ -102,8 +102,8 @@ class s {
|
|
|
102
102
|
static async pointDistance(t) {
|
|
103
103
|
if (t.length < 2)
|
|
104
104
|
return 0;
|
|
105
|
-
const e = new
|
|
106
|
-
return await
|
|
105
|
+
const e = new g({ paths: [t] });
|
|
106
|
+
return await f.geodesicLength(e, "meters");
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* 线按一定距离平移之后,与面相交的两个端点
|
|
@@ -114,10 +114,10 @@ class s {
|
|
|
114
114
|
*/
|
|
115
115
|
static async getIntersectPointOfLineAndPolygon(t, e, n = 0) {
|
|
116
116
|
n !== 0 && (t = await s.getOffsetLine(t, n));
|
|
117
|
-
const r = await
|
|
118
|
-
if (r instanceof
|
|
119
|
-
const i = r.paths[0], o = i[0],
|
|
120
|
-
return [o,
|
|
117
|
+
const r = await f.intersect(t, e);
|
|
118
|
+
if (r instanceof g) {
|
|
119
|
+
const i = r.paths[0], o = i[0], a = i[i.length - 1];
|
|
120
|
+
return [o, a];
|
|
121
121
|
}
|
|
122
122
|
return [];
|
|
123
123
|
}
|
|
@@ -128,7 +128,7 @@ class s {
|
|
|
128
128
|
* @returns 平移后的polyline
|
|
129
129
|
*/
|
|
130
130
|
static async getOffsetLine(t, e) {
|
|
131
|
-
const n = l.geographicToWebMercator(t), r = await
|
|
131
|
+
const n = l.geographicToWebMercator(t), r = await f.offset(
|
|
132
132
|
n,
|
|
133
133
|
e,
|
|
134
134
|
"meters"
|
|
@@ -185,7 +185,7 @@ class s {
|
|
|
185
185
|
static transformLineProjection(t) {
|
|
186
186
|
try {
|
|
187
187
|
return t.map(
|
|
188
|
-
(e) =>
|
|
188
|
+
(e) => h(s.geoReference).inverse([
|
|
189
189
|
e[0] - s.xOffset,
|
|
190
190
|
e[1] - s.yOffset
|
|
191
191
|
])
|
|
@@ -199,7 +199,7 @@ class s {
|
|
|
199
199
|
}
|
|
200
200
|
static transformPointProjection(t) {
|
|
201
201
|
try {
|
|
202
|
-
return
|
|
202
|
+
return h(s.geoReference).inverse([
|
|
203
203
|
t[0] - s.xOffset,
|
|
204
204
|
t[1] - s.yOffset
|
|
205
205
|
]);
|
|
@@ -214,7 +214,7 @@ class s {
|
|
|
214
214
|
return Math.abs(t[0] - e[0]) < Number.EPSILON && Math.abs(t[1] - e[1]) < Number.EPSILON;
|
|
215
215
|
}
|
|
216
216
|
static getExtensionLine(t, e, n) {
|
|
217
|
-
const r =
|
|
217
|
+
const r = c.point(t), i = c.point(e), o = p(r, i);
|
|
218
218
|
return u(i, n, o, { units: "meters" }).geometry.coordinates;
|
|
219
219
|
}
|
|
220
220
|
static isCoordinateValid(t) {
|
|
@@ -226,11 +226,25 @@ class s {
|
|
|
226
226
|
* @returns
|
|
227
227
|
*/
|
|
228
228
|
static getCenterPointInLine(t) {
|
|
229
|
-
const e =
|
|
229
|
+
const e = c.lineString(t), n = d(e, { units: "meters" }) / 2, r = O(e, 0, n, {
|
|
230
230
|
units: "meters"
|
|
231
231
|
});
|
|
232
232
|
return r.geometry.coordinates[r.geometry.coordinates.length - 1];
|
|
233
233
|
}
|
|
234
|
+
static async viewGoto(t, e) {
|
|
235
|
+
var i;
|
|
236
|
+
if (localStorage.getItem("gpu") !== "Unknown")
|
|
237
|
+
await t.goTo(e, {
|
|
238
|
+
duration: 1e3
|
|
239
|
+
});
|
|
240
|
+
else if (e.length > 0) {
|
|
241
|
+
const o = e.map((a) => a.geometry).filter((a) => a);
|
|
242
|
+
if (o.length > 0) {
|
|
243
|
+
const a = (i = await f.union(o)) == null ? void 0 : i.extent;
|
|
244
|
+
a && (t.extent = a);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
234
248
|
}
|
|
235
249
|
export {
|
|
236
250
|
s as default
|
|
@@ -35,10 +35,10 @@ const s = (e) => {
|
|
|
35
35
|
return "Unknown";
|
|
36
36
|
}
|
|
37
37
|
return i(e);
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
return console.log("GPU:", e), localStorage.setItem("gpu", e), e;
|
|
38
|
+
}, a = () => {
|
|
39
|
+
let e = l();
|
|
40
|
+
return console.log("GPU:", e), (!e.toLowerCase().includes("nvidia") && !e.toLowerCase().includes("amd") && !e.toLowerCase().includes("intel") || e.toLowerCase().includes("520") || e.toLowerCase().includes("swiftshader")) && (console.log("GPU is not supported or unknown:", e), e = "Unknown"), localStorage.setItem("gpu", e), e;
|
|
41
41
|
};
|
|
42
42
|
export {
|
|
43
|
-
|
|
43
|
+
a as default
|
|
44
44
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
class
|
|
3
|
-
constructor(s,
|
|
4
|
-
this.parentName = "", this.signals = [], this.subDistricts = [], this.areaColor = this.getDarkNonGrayColor(), this.signalCount = 0, this.subDistrictCount = 0, this.id = s.name, this.name = s.areaDesc, this.parentId = s.parentId,
|
|
1
|
+
import e from "../common-utils.mjs";
|
|
2
|
+
class r {
|
|
3
|
+
constructor(s, o) {
|
|
4
|
+
this.parentName = "", this.signals = [], this.subDistricts = [], this.areaColor = this.getDarkNonGrayColor(), this.signalCount = 0, this.subDistrictCount = 0, this.id = s.name, this.name = s.areaDesc, this.parentId = s.parentId, o === "alarm" && (this.areaColor = [255, 0, 0]);
|
|
5
5
|
for (const t of s.children)
|
|
6
6
|
if (t.children) {
|
|
7
|
-
const i = new
|
|
7
|
+
const i = new r(t, o);
|
|
8
8
|
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;
|
|
9
|
-
} else if (
|
|
9
|
+
} else if (e.isCoordinateValid(t)) {
|
|
10
10
|
const i = {
|
|
11
11
|
id: t.id,
|
|
12
12
|
name: t.name,
|
|
@@ -26,32 +26,28 @@ class h {
|
|
|
26
26
|
*/
|
|
27
27
|
getAllSignalCoordinates() {
|
|
28
28
|
const s = [];
|
|
29
|
-
for (const
|
|
30
|
-
s.push([
|
|
31
|
-
for (const
|
|
32
|
-
s.push(...
|
|
29
|
+
for (const o of this.signals)
|
|
30
|
+
s.push([o.longitude, o.latitude]);
|
|
31
|
+
for (const o of this.subDistricts)
|
|
32
|
+
s.push(...o.getAllSignalCoordinates());
|
|
33
33
|
return s;
|
|
34
34
|
}
|
|
35
35
|
getDarkNonGrayColor(s) {
|
|
36
|
-
let
|
|
36
|
+
let o, t, i;
|
|
37
37
|
if (s) {
|
|
38
|
-
const
|
|
39
|
-
|
|
38
|
+
const a = this.cyrb53(s);
|
|
39
|
+
o = ((a & 16711680) >> 16) % 200, t = ((a & 65280) >> 8) % 200, i = (a & 255) % 200;
|
|
40
40
|
} else
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const e = (r + a / 30) % 12, l = i / 100 - o * Math.max(Math.min(e - 3, 9 - e, 1), -1);
|
|
44
|
-
return Math.round(255 * l);
|
|
45
|
-
};
|
|
46
|
-
return [n(0), n(8), n(4)];
|
|
41
|
+
o = Math.floor(Math.random() * 256), t = Math.floor(Math.random() * 256), i = Math.floor(Math.random() * 256);
|
|
42
|
+
return [o, t, i];
|
|
47
43
|
}
|
|
48
|
-
cyrb53(s,
|
|
49
|
-
let t = 3735928559 ^
|
|
50
|
-
for (let
|
|
51
|
-
n = s.charCodeAt(
|
|
44
|
+
cyrb53(s, o = 0) {
|
|
45
|
+
let t = 3735928559 ^ o, i = 1103547991 ^ o;
|
|
46
|
+
for (let a = 0, n; a < s.length; a++)
|
|
47
|
+
n = s.charCodeAt(a), t = Math.imul(t ^ n, 2654435761), i = Math.imul(i ^ n, 1597334677);
|
|
52
48
|
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);
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
51
|
export {
|
|
56
|
-
|
|
52
|
+
r as default
|
|
57
53
|
};
|
|
@@ -7,8 +7,7 @@ export default class DistrictRenderer {
|
|
|
7
7
|
/** 区控实线图层,区控符号由半透明实线+不透明虚线组成 */
|
|
8
8
|
private districtControllerSolidLayer;
|
|
9
9
|
style: string;
|
|
10
|
-
|
|
11
|
-
constructor(view: __esri.MapView | __esri.SceneView, hasGpu: boolean);
|
|
10
|
+
constructor(view: __esri.MapView | __esri.SceneView);
|
|
12
11
|
/**
|
|
13
12
|
* 显示区控
|
|
14
13
|
* @param controllers 区控控制器数组
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import u from "@arcgis/core/Graphic";
|
|
2
|
-
import
|
|
2
|
+
import l from "@arcgis/core/layers/FeatureLayer";
|
|
3
3
|
import * as a from "@turf/helpers";
|
|
4
|
-
import { convex as
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
), this.districtControllerDashLayer.spatialReference = t.spatialReference, this.districtControllerSolidLayer = new n(
|
|
4
|
+
import { convex as p, buffer as f } from "@turf/turf";
|
|
5
|
+
import n from "../common-utils.mjs";
|
|
6
|
+
import { districtDashLineLayerOptions as C, districtSolidLineLayerOptions as L } from "./layer-symbol.mjs";
|
|
7
|
+
class x {
|
|
8
|
+
constructor(t) {
|
|
9
|
+
this.style = "", this.view = t, this.districtControllerDashLayer = new l(
|
|
11
10
|
C
|
|
11
|
+
), this.districtControllerDashLayer.spatialReference = t.spatialReference, this.districtControllerSolidLayer = new l(
|
|
12
|
+
L
|
|
12
13
|
), this.districtControllerSolidLayer.spatialReference = t.spatialReference, this.districtControllerSolidLayer.popupEnabled = !0, this.view.map.addMany([
|
|
13
14
|
this.districtControllerDashLayer,
|
|
14
15
|
this.districtControllerSolidLayer
|
|
@@ -29,20 +30,20 @@ class S {
|
|
|
29
30
|
o = a.lineString(s);
|
|
30
31
|
else {
|
|
31
32
|
const h = a.featureCollection(
|
|
32
|
-
s.map((
|
|
33
|
+
s.map((y) => a.point(y))
|
|
33
34
|
);
|
|
34
|
-
o =
|
|
35
|
+
o = p(h), o || (o = a.lineString(s));
|
|
35
36
|
}
|
|
36
37
|
else if (s.length === 1)
|
|
37
38
|
o = a.point(s[0]);
|
|
38
39
|
else
|
|
39
40
|
continue;
|
|
40
|
-
const
|
|
41
|
+
const d = f(o.geometry, 200, {
|
|
41
42
|
units: "meters"
|
|
42
|
-
}),
|
|
43
|
+
}), c = new u({
|
|
43
44
|
geometry: {
|
|
44
45
|
type: "polyline",
|
|
45
|
-
paths:
|
|
46
|
+
paths: d.geometry.coordinates
|
|
46
47
|
},
|
|
47
48
|
attributes: {
|
|
48
49
|
ObjectID: e,
|
|
@@ -56,15 +57,13 @@ class S {
|
|
|
56
57
|
type: "district"
|
|
57
58
|
}
|
|
58
59
|
});
|
|
59
|
-
i.push(
|
|
60
|
+
i.push(c);
|
|
60
61
|
}
|
|
61
62
|
await this.districtControllerDashLayer.applyEdits({
|
|
62
63
|
addFeatures: i
|
|
63
64
|
}), await this.districtControllerSolidLayer.applyEdits({
|
|
64
65
|
addFeatures: i
|
|
65
|
-
}), await this.view
|
|
66
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
67
|
-
});
|
|
66
|
+
}), await n.viewGoto(this.view, i);
|
|
68
67
|
}
|
|
69
68
|
/**
|
|
70
69
|
* 清除区控图层
|
|
@@ -93,9 +92,7 @@ class S {
|
|
|
93
92
|
const i = this.districtControllerDashLayer.createQuery();
|
|
94
93
|
i.where = `id = '${t}'`, i.returnGeometry = !0, i.outFields = ["*"];
|
|
95
94
|
const e = await this.districtControllerDashLayer.queryFeatures(i);
|
|
96
|
-
return e.features.length > 0 ? (await this.view
|
|
97
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
98
|
-
}), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
|
|
95
|
+
return e.features.length > 0 ? (await n.viewGoto(this.view, e.features), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
|
|
99
96
|
}
|
|
100
97
|
/**
|
|
101
98
|
* 高亮区控, 其他区控隐藏
|
|
@@ -106,9 +103,7 @@ class S {
|
|
|
106
103
|
const i = this.districtControllerDashLayer.definitionExpression;
|
|
107
104
|
this.districtControllerDashLayer.definitionExpression = `id = '${t}'`;
|
|
108
105
|
const e = await this.districtControllerDashLayer.queryFeatures(), r = e.features.length;
|
|
109
|
-
return r > 0 ? (this.districtControllerSolidLayer.definitionExpression = `id = '${t}'`, await this.view
|
|
110
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
111
|
-
})) : this.districtControllerDashLayer.definitionExpression = i, r;
|
|
106
|
+
return r > 0 ? (this.districtControllerSolidLayer.definitionExpression = `id = '${t}'`, await n.viewGoto(this.view, e.features)) : this.districtControllerDashLayer.definitionExpression = i, r;
|
|
112
107
|
}
|
|
113
108
|
filter(t) {
|
|
114
109
|
const i = `id = '${t}'`;
|
|
@@ -119,5 +114,5 @@ class S {
|
|
|
119
114
|
}
|
|
120
115
|
}
|
|
121
116
|
export {
|
|
122
|
-
|
|
117
|
+
x as default
|
|
123
118
|
};
|
|
@@ -2,17 +2,17 @@ import { Polygon as f } from "@arcgis/core/geometry";
|
|
|
2
2
|
import { webMercatorToGeographic as y } from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
3
3
|
import g from "@arcgis/core/Graphic";
|
|
4
4
|
import m from "@arcgis/core/layers/GraphicsLayer";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import R from "papaparse";
|
|
6
|
+
import D from "../../stores/index.mjs";
|
|
7
|
+
import p from "./district-controller.mjs";
|
|
8
8
|
import w from "./district-renderer.mjs";
|
|
9
9
|
import L from "./signal-renderer.mjs";
|
|
10
10
|
import C from "./sub-district-renderer.mjs";
|
|
11
11
|
class P {
|
|
12
12
|
constructor(e) {
|
|
13
|
-
this.detachmentLayerLoaded = !1, this.view = e, this.hasGpu =
|
|
14
|
-
const t =
|
|
15
|
-
this.mapConfig = JSON.parse(JSON.stringify(t.mapConfig)), this.detachmentLayer = new m(), this.view.map.add(this.detachmentLayer), this.districtRenderer = new w(e
|
|
13
|
+
this.detachmentLayerLoaded = !1, this.view = e, this.hasGpu = !1;
|
|
14
|
+
const t = D.useAppDataStore;
|
|
15
|
+
this.mapConfig = JSON.parse(JSON.stringify(t.mapConfig)), this.detachmentLayer = new m(), this.view.map.add(this.detachmentLayer), this.districtRenderer = new w(e), this.subDistrictRenderer = new C(e), this.signalRenderer = new L(e);
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* 显示所有区控、子区、信号机
|
|
@@ -23,7 +23,7 @@ class P {
|
|
|
23
23
|
this.detachmentLayerLoaded || await this.loadDetachmentLayer(), this.roadLines || (await this.loadRoadLine(), this.subDistrictRenderer.roadLines = this.roadLines), await this.clearSignalControlArea(), this.districtRenderer.setVisible(!1), this.subDistrictRenderer.setVisible(!1), this.signalRenderer.setClusterVisible(!1), this.signalRenderer.setPointVisible(!1);
|
|
24
24
|
const t = [], s = [];
|
|
25
25
|
for (const a of e.areaList) {
|
|
26
|
-
const i = new
|
|
26
|
+
const i = new p(
|
|
27
27
|
a,
|
|
28
28
|
e.style || ""
|
|
29
29
|
);
|
|
@@ -121,7 +121,7 @@ class P {
|
|
|
121
121
|
}
|
|
122
122
|
try {
|
|
123
123
|
const a = await (await fetch(`/GisViewerAssets/${e}`)).text();
|
|
124
|
-
|
|
124
|
+
R.parse(a, {
|
|
125
125
|
header: !0,
|
|
126
126
|
skipEmptyLines: !0,
|
|
127
127
|
complete: (i) => {
|
|
@@ -2,11 +2,10 @@ import { IResult } from '../../../types';
|
|
|
2
2
|
import DistrictController from './district-controller';
|
|
3
3
|
export default class CrossRenderer {
|
|
4
4
|
private view;
|
|
5
|
-
private hasGpu;
|
|
6
5
|
private signalMarkerLayer;
|
|
7
6
|
private signalPictureLayer;
|
|
8
7
|
private signalClusterLayer;
|
|
9
|
-
constructor(view: __esri.MapView | __esri.SceneView
|
|
8
|
+
constructor(view: __esri.MapView | __esri.SceneView);
|
|
10
9
|
showSignals(controllers: DistrictController[]): Promise<void>;
|
|
11
10
|
clearSignals(): Promise<void>;
|
|
12
11
|
setPointVisible(visible: boolean): Promise<void>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import d from "@arcgis/core/Graphic";
|
|
2
2
|
import u from "@arcgis/core/layers/FeatureLayer";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import o from "../common-utils.mjs";
|
|
4
|
+
import { signalMarkerLayerOptions as y, signalPictureLayerOptions as c, signalClusterLayerOptions as p } from "./layer-symbol.mjs";
|
|
5
|
+
class E {
|
|
6
|
+
constructor(e) {
|
|
7
|
+
this.view = e, this.signalMarkerLayer = new u(
|
|
7
8
|
y
|
|
8
9
|
), this.signalMarkerLayer.spatialReference = e.spatialReference, this.signalMarkerLayer.popupEnabled = !0, this.signalPictureLayer = new u(
|
|
9
10
|
c
|
|
10
11
|
), this.signalPictureLayer.spatialReference = e.spatialReference, this.signalPictureLayer.popupEnabled = !0, this.signalClusterLayer = new u(
|
|
11
|
-
|
|
12
|
+
p
|
|
12
13
|
), this.signalClusterLayer.spatialReference = e.spatialReference, this.signalClusterLayer.popupEnabled = !0, this.view.map.addMany([
|
|
13
14
|
this.signalMarkerLayer,
|
|
14
15
|
this.signalPictureLayer,
|
|
@@ -17,10 +18,10 @@ class f {
|
|
|
17
18
|
}
|
|
18
19
|
async showSignals(e) {
|
|
19
20
|
await this.clearSignals();
|
|
20
|
-
let
|
|
21
|
+
let r = 0;
|
|
21
22
|
const s = [];
|
|
22
|
-
e.forEach((
|
|
23
|
-
|
|
23
|
+
e.forEach((a) => {
|
|
24
|
+
a.signals.forEach((i) => {
|
|
24
25
|
const t = new d({
|
|
25
26
|
geometry: {
|
|
26
27
|
type: "point",
|
|
@@ -28,13 +29,13 @@ class f {
|
|
|
28
29
|
latitude: i.latitude
|
|
29
30
|
},
|
|
30
31
|
attributes: {
|
|
31
|
-
ObjectID:
|
|
32
|
+
ObjectID: r++,
|
|
32
33
|
id: i.id,
|
|
33
34
|
name: i.name,
|
|
34
35
|
signalId: i.signalId,
|
|
35
36
|
nodeId: i.nodeId || i.id,
|
|
36
|
-
districtId:
|
|
37
|
-
districtName:
|
|
37
|
+
districtId: a.id,
|
|
38
|
+
districtName: a.name,
|
|
38
39
|
subDistrictId: "",
|
|
39
40
|
subDistrictName: "",
|
|
40
41
|
isKey: i.isKey,
|
|
@@ -43,7 +44,7 @@ class f {
|
|
|
43
44
|
}
|
|
44
45
|
});
|
|
45
46
|
s.push(t);
|
|
46
|
-
}),
|
|
47
|
+
}), a.subDistricts.forEach((i) => {
|
|
47
48
|
i.signals.forEach((t) => {
|
|
48
49
|
const n = new d({
|
|
49
50
|
geometry: {
|
|
@@ -52,13 +53,13 @@ class f {
|
|
|
52
53
|
latitude: t.latitude
|
|
53
54
|
},
|
|
54
55
|
attributes: {
|
|
55
|
-
ObjectID:
|
|
56
|
+
ObjectID: r++,
|
|
56
57
|
id: t.id,
|
|
57
58
|
name: t.name,
|
|
58
59
|
signalId: t.signalId,
|
|
59
60
|
nodeId: t.nodeId || t.id,
|
|
60
|
-
districtId:
|
|
61
|
-
districtName:
|
|
61
|
+
districtId: a.id,
|
|
62
|
+
districtName: a.name,
|
|
62
63
|
subDistrictId: i.id,
|
|
63
64
|
subDistrictName: i.name,
|
|
64
65
|
isKey: t.isKey,
|
|
@@ -97,21 +98,19 @@ class f {
|
|
|
97
98
|
return { status: 0, message: "ok" };
|
|
98
99
|
}
|
|
99
100
|
async highlightSignal(e) {
|
|
100
|
-
let
|
|
101
|
-
const
|
|
101
|
+
let r = "", s = "";
|
|
102
|
+
const a = this.signalMarkerLayer.definitionExpression;
|
|
102
103
|
this.signalMarkerLayer.definitionExpression = `signalId = '${e}'`;
|
|
103
104
|
const i = await this.signalMarkerLayer.queryFeatures(), t = i.features.length;
|
|
104
105
|
if (t > 0) {
|
|
105
106
|
const n = i.features[0].attributes.districtId || "", l = i.features[0].attributes.subDistrictId || "";
|
|
106
|
-
return await this.view
|
|
107
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
108
|
-
}), { districtId: n, subDistrictId: l, count: t };
|
|
107
|
+
return await o.viewGoto(this.view, i.features), { districtId: n, subDistrictId: l, count: t };
|
|
109
108
|
} else
|
|
110
|
-
this.signalMarkerLayer.definitionExpression =
|
|
111
|
-
return { districtId:
|
|
109
|
+
this.signalMarkerLayer.definitionExpression = a;
|
|
110
|
+
return { districtId: r, subDistrictId: s, count: t };
|
|
112
111
|
}
|
|
113
|
-
filter(e,
|
|
114
|
-
const s = `${e === "district" ? "districtId" : "subDistrictId"} = '${
|
|
112
|
+
filter(e, r) {
|
|
113
|
+
const s = `${e === "district" ? "districtId" : "subDistrictId"} = '${r}'`;
|
|
115
114
|
this.signalClusterLayer.definitionExpression = s, this.signalMarkerLayer.definitionExpression = s, this.signalPictureLayer.definitionExpression = s;
|
|
116
115
|
}
|
|
117
116
|
resetFilter() {
|
|
@@ -120,5 +119,5 @@ class f {
|
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
121
|
export {
|
|
123
|
-
|
|
122
|
+
E as default
|
|
124
123
|
};
|
|
@@ -2,12 +2,11 @@ import { IResult, IRoadLine } from '../../../types';
|
|
|
2
2
|
import DistrictController from './district-controller';
|
|
3
3
|
export default class SubDistrictRenderer {
|
|
4
4
|
private view;
|
|
5
|
-
private hasGpu;
|
|
6
5
|
private clickHandler;
|
|
7
6
|
private subDistrictPointLayer;
|
|
8
7
|
private subDistrictLineLayer;
|
|
9
8
|
roadLines: IRoadLine[];
|
|
10
|
-
constructor(view: __esri.MapView | __esri.SceneView
|
|
9
|
+
constructor(view: __esri.MapView | __esri.SceneView);
|
|
11
10
|
showSubDistricts(controllers: DistrictController[]): Promise<void>;
|
|
12
11
|
showRoads(districtId: string): Promise<void>;
|
|
13
12
|
clearSubDistricts(): Promise<void>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import v from "@arcgis/core/Graphic";
|
|
2
2
|
import w from "@arcgis/core/layers/FeatureLayer";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import g from "../common-utils.mjs";
|
|
4
|
+
import { subDistrictPointLayerOptions as I, subDistrictLineLayerOptions as P } from "./layer-symbol.mjs";
|
|
5
|
+
class S {
|
|
6
|
+
constructor(e) {
|
|
7
|
+
this.view = e, this.subDistrictPointLayer = new w(
|
|
8
|
+
I
|
|
8
9
|
), this.subDistrictPointLayer.spatialReference = e.spatialReference, this.subDistrictPointLayer.popupEnabled = !0, this.subDistrictLineLayer = new w(
|
|
9
10
|
P
|
|
10
11
|
), this.subDistrictLineLayer.spatialReference = e.spatialReference, this.subDistrictLineLayer.popupEnabled = !0, this.view.map.addMany([
|
|
@@ -14,8 +15,8 @@ class F {
|
|
|
14
15
|
}
|
|
15
16
|
async showSubDistricts(e) {
|
|
16
17
|
await this.clearSubDistricts(), this.clickHandler = this.view.on("click", this.viewHitTest.bind(this));
|
|
17
|
-
let
|
|
18
|
-
const
|
|
18
|
+
let s = 0;
|
|
19
|
+
const t = [], r = [];
|
|
19
20
|
e.forEach((i) => {
|
|
20
21
|
r.push({
|
|
21
22
|
value: i.id,
|
|
@@ -31,15 +32,15 @@ class F {
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
}), i.signals.forEach((a) => {
|
|
34
|
-
const
|
|
35
|
+
const n = new v({
|
|
35
36
|
geometry: {
|
|
36
37
|
type: "point",
|
|
37
38
|
longitude: a.longitude,
|
|
38
39
|
latitude: a.latitude
|
|
39
40
|
},
|
|
40
41
|
attributes: {
|
|
41
|
-
ObjectID:
|
|
42
|
-
id: a.
|
|
42
|
+
ObjectID: s++,
|
|
43
|
+
id: a.nodeId,
|
|
43
44
|
name: a.name,
|
|
44
45
|
subDistrictId: i.id,
|
|
45
46
|
subDistrictName: i.name,
|
|
@@ -50,7 +51,7 @@ class F {
|
|
|
50
51
|
type: "subDistrict"
|
|
51
52
|
}
|
|
52
53
|
});
|
|
53
|
-
|
|
54
|
+
t.push(n);
|
|
54
55
|
});
|
|
55
56
|
}), this.subDistrictPointLayer.renderer = {
|
|
56
57
|
type: "unique-value",
|
|
@@ -95,66 +96,64 @@ class F {
|
|
|
95
96
|
}
|
|
96
97
|
]
|
|
97
98
|
}, this.currentPointRenderer = this.subDistrictPointLayer.renderer.clone(), await this.subDistrictPointLayer.applyEdits({
|
|
98
|
-
addFeatures:
|
|
99
|
-
}), await this.view.goTo(s, {
|
|
100
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
99
|
+
addFeatures: t
|
|
101
100
|
});
|
|
102
101
|
}
|
|
103
102
|
async showRoads(e) {
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
103
|
+
const s = this.subDistrictPointLayer.createQuery();
|
|
104
|
+
s.where = `districtId = '${e}'`;
|
|
105
|
+
const t = await this.subDistrictPointLayer.queryFeatures(
|
|
106
|
+
s
|
|
108
107
|
), r = /* @__PURE__ */ new Map();
|
|
109
|
-
|
|
108
|
+
t.features.forEach((n) => {
|
|
110
109
|
var o;
|
|
111
110
|
const {
|
|
112
111
|
subDistrictId: c,
|
|
113
112
|
color: l,
|
|
114
|
-
id:
|
|
115
|
-
districtName:
|
|
116
|
-
subDistrictName:
|
|
113
|
+
id: b,
|
|
114
|
+
districtName: h,
|
|
115
|
+
subDistrictName: u,
|
|
117
116
|
signalCount: y
|
|
118
|
-
} =
|
|
117
|
+
} = n.attributes;
|
|
119
118
|
r.has(c) || r.set(c, {
|
|
120
119
|
color: l,
|
|
121
120
|
signalIds: [],
|
|
122
|
-
districtName:
|
|
123
|
-
subDistrictName:
|
|
121
|
+
districtName: h,
|
|
122
|
+
subDistrictName: u,
|
|
124
123
|
signalCount: y
|
|
125
|
-
}), (o = r.get(c)) == null || o.signalIds.push(
|
|
124
|
+
}), (o = r.get(c)) == null || o.signalIds.push(b);
|
|
126
125
|
});
|
|
127
126
|
const i = [], a = [];
|
|
128
|
-
for (const
|
|
127
|
+
for (const n of r) {
|
|
129
128
|
let c = 0;
|
|
130
|
-
const l =
|
|
129
|
+
const l = n[0];
|
|
131
130
|
i.push({
|
|
132
131
|
value: l,
|
|
133
132
|
symbol: {
|
|
134
133
|
type: "simple-line",
|
|
135
|
-
color:
|
|
134
|
+
color: n[1].color.split(",").map(Number),
|
|
136
135
|
width: 2,
|
|
137
136
|
style: "solid"
|
|
138
137
|
}
|
|
139
138
|
});
|
|
140
|
-
const { districtName:
|
|
141
|
-
if (!(
|
|
142
|
-
for (let o = 0; o <
|
|
143
|
-
for (let d = 0; d <
|
|
139
|
+
const { districtName: b, subDistrictName: h, signalIds: u, signalCount: y } = n[1];
|
|
140
|
+
if (!(u.length < 2))
|
|
141
|
+
for (let o = 0; o < u.length; o++)
|
|
142
|
+
for (let d = 0; d < u.length; d++) {
|
|
144
143
|
if (o === d)
|
|
145
144
|
continue;
|
|
146
|
-
const
|
|
147
|
-
if (a.some((
|
|
148
|
-
const m =
|
|
149
|
-
return m && m.fromNode ===
|
|
145
|
+
const f = u[o], L = u[d];
|
|
146
|
+
if (a.some((p) => {
|
|
147
|
+
const m = p.attributes;
|
|
148
|
+
return m && m.fromNode === L && m.toNode === f;
|
|
150
149
|
}))
|
|
151
150
|
continue;
|
|
152
151
|
const D = this.roadLines.find(
|
|
153
|
-
(
|
|
152
|
+
(p) => p.fromNode === f && p.toNode === L
|
|
154
153
|
);
|
|
155
154
|
if (!D)
|
|
156
155
|
continue;
|
|
157
|
-
const
|
|
156
|
+
const z = new v({
|
|
158
157
|
geometry: {
|
|
159
158
|
type: "polyline",
|
|
160
159
|
paths: [D.coordinates]
|
|
@@ -164,15 +163,15 @@ class F {
|
|
|
164
163
|
id: D.id,
|
|
165
164
|
districtId: e,
|
|
166
165
|
subDistrictId: l,
|
|
167
|
-
subDistrictName:
|
|
168
|
-
districtName:
|
|
166
|
+
subDistrictName: h,
|
|
167
|
+
districtName: b,
|
|
169
168
|
signalCount: y,
|
|
170
|
-
fromNode:
|
|
171
|
-
toNode:
|
|
172
|
-
color:
|
|
169
|
+
fromNode: f,
|
|
170
|
+
toNode: L,
|
|
171
|
+
color: n[1].color
|
|
173
172
|
}
|
|
174
173
|
});
|
|
175
|
-
a.push(
|
|
174
|
+
a.push(z);
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
177
|
this.subDistrictLineLayer.renderer = {
|
|
@@ -219,15 +218,15 @@ class F {
|
|
|
219
218
|
});
|
|
220
219
|
}
|
|
221
220
|
async clearSubDistricts() {
|
|
222
|
-
var
|
|
221
|
+
var t;
|
|
223
222
|
const e = await this.subDistrictPointLayer.queryFeatures();
|
|
224
223
|
e.features.length > 0 && await this.subDistrictPointLayer.applyEdits({
|
|
225
224
|
deleteFeatures: e.features
|
|
226
225
|
}), this.subDistrictPointLayer.definitionExpression = "1=1";
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
deleteFeatures:
|
|
230
|
-
}), this.subDistrictLineLayer.definitionExpression = "1=1", (
|
|
226
|
+
const s = await this.subDistrictLineLayer.queryFeatures();
|
|
227
|
+
s.features.length > 0 && await this.subDistrictLineLayer.applyEdits({
|
|
228
|
+
deleteFeatures: s.features
|
|
229
|
+
}), this.subDistrictLineLayer.definitionExpression = "1=1", (t = this.clickHandler) == null || t.remove();
|
|
231
230
|
}
|
|
232
231
|
setVisible(e) {
|
|
233
232
|
this.subDistrictPointLayer.visible = e, this.subDistrictLineLayer.visible = e;
|
|
@@ -237,12 +236,10 @@ class F {
|
|
|
237
236
|
* @param id 子区ID
|
|
238
237
|
*/
|
|
239
238
|
async locateSubDistrict(e) {
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
return
|
|
244
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
245
|
-
}), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
239
|
+
const s = this.subDistrictPointLayer.createQuery();
|
|
240
|
+
s.where = `subDistrictId = '${e}'`, s.returnGeometry = !0;
|
|
241
|
+
const t = await this.subDistrictPointLayer.queryFeatures(s);
|
|
242
|
+
return t.features.length > 0 ? (await g.viewGoto(this.view, t.features), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
246
243
|
}
|
|
247
244
|
/**
|
|
248
245
|
* 高亮子区, 其他子区隐藏
|
|
@@ -250,22 +247,20 @@ class F {
|
|
|
250
247
|
* @return 返回高亮子区的数量以及区控id
|
|
251
248
|
*/
|
|
252
249
|
async highlightSubDistrict(e) {
|
|
253
|
-
let
|
|
254
|
-
const
|
|
250
|
+
let s = "";
|
|
251
|
+
const t = this.subDistrictPointLayer.definitionExpression;
|
|
255
252
|
this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${e}'`;
|
|
256
253
|
const r = await this.subDistrictPointLayer.queryFeatures(), i = r.features.length;
|
|
257
|
-
return i > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${e}'`,
|
|
258
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
259
|
-
})) : this.subDistrictPointLayer.definitionExpression = s, { count: i, parentId: t };
|
|
254
|
+
return i > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${e}'`, s = r.features[0].attributes.districtId, await g.viewGoto(this.view, r.features)) : this.subDistrictPointLayer.definitionExpression = t, { count: i, parentId: s };
|
|
260
255
|
}
|
|
261
256
|
/**
|
|
262
257
|
* 按照区控、子区id显示子区
|
|
263
258
|
* @param type 类型,district 或 subDistrict
|
|
264
259
|
* @param id
|
|
265
260
|
*/
|
|
266
|
-
filter(e,
|
|
267
|
-
const
|
|
268
|
-
this.subDistrictPointLayer.definitionExpression =
|
|
261
|
+
filter(e, s) {
|
|
262
|
+
const t = `${e === "district" ? "districtId" : "subDistrictId"} = '${s}'`;
|
|
263
|
+
this.subDistrictPointLayer.definitionExpression = t, this.subDistrictLineLayer.definitionExpression = t;
|
|
269
264
|
}
|
|
270
265
|
/**
|
|
271
266
|
* 重置过滤器,显示所有子区
|
|
@@ -275,15 +270,15 @@ class F {
|
|
|
275
270
|
}
|
|
276
271
|
async viewHitTest(e) {
|
|
277
272
|
var r;
|
|
278
|
-
const
|
|
273
|
+
const t = (r = (await this.view.hitTest(e, {
|
|
279
274
|
include: [this.subDistrictPointLayer, this.subDistrictLineLayer]
|
|
280
275
|
})).results) == null ? void 0 : r.filter(
|
|
281
276
|
(i) => i.type === "graphic"
|
|
282
277
|
);
|
|
283
|
-
if (
|
|
278
|
+
if (t.length === 0)
|
|
284
279
|
this.subDistrictPointLayer.renderer = this.currentPointRenderer, this.subDistrictLineLayer.renderer = this.currentLineRenderer;
|
|
285
280
|
else {
|
|
286
|
-
const i =
|
|
281
|
+
const i = t[0].graphic;
|
|
287
282
|
this.subDistrictPointLayer.renderer = {
|
|
288
283
|
type: "unique-value",
|
|
289
284
|
field: "subDistrictId",
|
|
@@ -395,5 +390,5 @@ class F {
|
|
|
395
390
|
}
|
|
396
391
|
}
|
|
397
392
|
export {
|
|
398
|
-
|
|
393
|
+
S as default
|
|
399
394
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Point, Polygon, Polyline } from '@arcgis/core/geometry';
|
|
2
|
+
import Graphic from '@arcgis/core/Graphic';
|
|
2
3
|
import * as turf from '@turf/helpers';
|
|
3
4
|
export default class CommonUtils {
|
|
4
5
|
/**
|
|
@@ -89,4 +90,5 @@ export default class CommonUtils {
|
|
|
89
90
|
* @returns
|
|
90
91
|
*/
|
|
91
92
|
static getCenterPointInLine(line: number[][]): number[];
|
|
93
|
+
static viewGoto(view: __esri.MapView | __esri.SceneView, target: Graphic[]): Promise<void>;
|
|
92
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),p=require("@turf/bearing"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),p=require("@turf/bearing"),l=require("@turf/destination"),b=require("@turf/helpers"),S=require("@turf/length"),A=require("@turf/line-slice-along"),x=require("pako"),h=require("proj4");function y(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const t in u)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>u[t]})}}return e.default=u,Object.freeze(e)}const g=y(L),P=y(w),c=y(b);class i{static destinationWithPoint(e,t,n){const r=c.point([e.x,e.y]),s=l(r,n,t,{units:"meters"});return new f.Point({x:s.geometry.coordinates[0],y:s.geometry.coordinates[1]})}static angleOfLine(e){const t=e.paths[0],n=c.point(t[0]),r=c.point(t[t.length-1]);return p(n,r)}static extendLineInTowDir(e,t){const n=e.paths[0],r=c.point(n[0]),s=c.point(n[1]),o=p(s,r),a=l(r,t,o,{units:"meters"}),d=o>0?o-180:o+180,O=l(s,t,d,{units:"meters"});return new f.Polyline({paths:[[a.geometry.coordinates,O.geometry.coordinates]]})}static async getIntersectPointOfTwoLines(e,t){const n=await g.intersectLinesToPoints(e,t);if(n.length)return n[0]}static async getIntersectPointsOfStopLineAndLane(e,t,n){let r=await i.getIntersectPointOfLineAndPolygon(e,t);if(await i.pointDistance(r)<3&&n){for(const s of n)if(r=await i.getIntersectPointOfLineAndPolygon(e,t,s),await i.pointDistance(r)>2.5){const o=new f.Polyline({paths:[r]});return(await i.getOffsetLine(o,-s)).paths[0]}}else return r;return[]}static async pointDistance(e){if(e.length<2)return 0;const t=new f.Polyline({paths:[e]});return await g.geodesicLength(t,"meters")}static async getIntersectPointOfLineAndPolygon(e,t,n=0){n!==0&&(e=await i.getOffsetLine(e,n));const r=await g.intersect(e,t);if(r instanceof f.Polyline){const s=r.paths[0],o=s[0],a=s[s.length-1];return[o,a]}return[]}static async getOffsetLine(e,t){const n=P.geographicToWebMercator(e),r=await g.offset(n,t,"meters");return P.webMercatorToGeographic(r,!1)}static unzip(e){try{const t=[],n=e.split("");for(let s=0;s<n.length;s++){const o=n[s];t.push(o.charCodeAt(0))}const r=new Uint8Array(t);return x.inflate(r,{to:"string"})}catch{console.log(`非压缩内容: ${e}`)}}static getStdVecEntries(e,t=!1){const n=new Array(e.size());for(let r=0;r<e.size();r++)n[r]=e.get(r);return t&&e.delete(),n}static getStdMapEntries(e){const t=[];for(const n of i.getStdMapKeys(e))t.push([n,e.get(n)]);return t}static getStdMapKeys(e,t=!1){const n=[],r=e.keys();for(let s=0;s<r.size();s++)n.push(r.get(s));return r.delete(),t&&e.delete(),n}static setGeoData(e,t,n){i.geoReference=e,i.xOffset=t,i.yOffset=n}static transformLineProjection(e){try{return e.map(t=>h(i.geoReference).inverse([t[0]-i.xOffset,t[1]-i.yOffset]))}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",i.geoReference),e}}static transformPointProjection(e){try{return h(i.geoReference).inverse([e[0]-i.xOffset,e[1]-i.yOffset])}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",i.geoReference),e}}static pointsEqual(e,t){return Math.abs(e[0]-t[0])<Number.EPSILON&&Math.abs(e[1]-t[1])<Number.EPSILON}static getExtensionLine(e,t,n){const r=c.point(e),s=c.point(t),o=p(r,s);return l(s,n,o,{units:"meters"}).geometry.coordinates}static isCoordinateValid(e){return typeof e.latitude=="string"&&(e.latitude=Number(e.latitude)),typeof e.longitude=="string"&&(e.longitude=Number(e.longitude)),e.latitude!==null&&e.longitude!==null&&!isNaN(e.latitude)&&!isNaN(e.longitude)&&e.latitude!==0&&e.longitude!==0}static getCenterPointInLine(e){const t=c.lineString(e),n=S(t,{units:"meters"})/2,r=A(t,0,n,{units:"meters"});return r.geometry.coordinates[r.geometry.coordinates.length-1]}static async viewGoto(e,t){var s;if(localStorage.getItem("gpu")!=="Unknown")await e.goTo(t,{duration:1e3});else if(t.length>0){const o=t.map(a=>a.geometry).filter(a=>a);if(o.length>0){const a=(s=await g.union(o))==null?void 0:s.extent;a&&(e.extent=a)}}}}exports.default=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=e=>{const r=[],o=e.split("");for(let t=0;t<o.length;t++)if(o[t]==="(")r.push(t);else if(o[t]===")"){const n=r.pop();n!==void 0&&(o.splice(n,t-n+1),t=n-1)}return o.join("")},i=e=>s(e).replace(/\/PCIe\/SSE2/g,"").replace(/\s+/g," ").trim(),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=e=>{const r=[],o=e.split("");for(let t=0;t<o.length;t++)if(o[t]==="(")r.push(t);else if(o[t]===")"){const n=r.pop();n!==void 0&&(o.splice(n,t-n+1),t=n-1)}return o.join("")},i=e=>s(e).replace(/\/PCIe\/SSE2/g,"").replace(/\s+/g," ").trim(),l=()=>{try{const e=document.createElement("canvas"),r=e.getContext("webgl")||e.getContext("experimental-webgl");if(!r)return"Unknown";const o=r.getExtension("WEBGL_debug_renderer_info");return o&&r.getParameter(o.UNMASKED_RENDERER_WEBGL)||"Unknown"}catch{return"Unknown"}},c=()=>{const e=l();try{if(/, or similar$/.test(e)||/SwiftShader/.test(e))return"Unknown";if(/^ANGLE/.test(e)){const r=e.match(/\((.+)\)$/);if(r){const o=r[1],t=o.split(/,\s*/g);let n=t[1];return/^ANGLE Metal Renderer: /.test(n)&&(n=e.split(": ")[1].split(",")[0]),t.length===1&&(n=t[0].split(" ").slice(1).join(" ")),/Direct3D/.test(n)&&(n=n.split("Direct3D")[0].trim()),n}}}catch{return"Unknown"}return i(e)},u=()=>{let e=c();return console.log("GPU:",e),(!e.toLowerCase().includes("nvidia")&&!e.toLowerCase().includes("amd")&&!e.toLowerCase().includes("intel")||e.toLowerCase().includes("520")||e.toLowerCase().includes("swiftshader"))&&(console.log("GPU is not supported or unknown:",e),e="Unknown"),localStorage.setItem("gpu",e),e};exports.default=u;
|
|
@@ -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("../common-utils.js");class n{constructor(s,e){this.parentName="",this.signals=[],this.subDistricts=[],this.areaColor=this.getDarkNonGrayColor(),this.signalCount=0,this.subDistrictCount=0,this.id=s.name,this.name=s.areaDesc,this.parentId=s.parentId,e==="alarm"&&(this.areaColor=[255,0,0]);for(const t of s.children)if(t.children){const i=new n(t,e);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}else if(r.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 s=[];for(const e of this.signals)s.push([e.longitude,e.latitude]);for(const e of this.subDistricts)s.push(...e.getAllSignalCoordinates());return s}getDarkNonGrayColor(s){let e,t,i;if(s){const o=this.cyrb53(s);e=((o&16711680)>>16)%200,t=((o&65280)>>8)%200,i=(o&255)%200}else e=Math.floor(Math.random()*256),t=Math.floor(Math.random()*256),i=Math.floor(Math.random()*256);return[e,t,i]}cyrb53(s,e=0){let t=3735928559^e,i=1103547991^e;for(let o=0,a;o<s.length;o++)a=s.charCodeAt(o),t=Math.imul(t^a,2654435761),i=Math.imul(i^a,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=n;
|
|
@@ -7,8 +7,7 @@ export default class DistrictRenderer {
|
|
|
7
7
|
/** 区控实线图层,区控符号由半透明实线+不透明虚线组成 */
|
|
8
8
|
private districtControllerSolidLayer;
|
|
9
9
|
style: string;
|
|
10
|
-
|
|
11
|
-
constructor(view: __esri.MapView | __esri.SceneView, hasGpu: boolean);
|
|
10
|
+
constructor(view: __esri.MapView | __esri.SceneView);
|
|
12
11
|
/**
|
|
13
12
|
* 显示区控
|
|
14
13
|
* @param controllers 区控控制器数组
|
|
@@ -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 C=require("@arcgis/core/Graphic"),c=require("@arcgis/core/layers/FeatureLayer"),L=require("@turf/helpers"),d=require("@turf/turf"),l=require("../common-utils.js"),u=require("./layer-symbol.js");function g(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const n=g(L);class D{constructor(t){this.style="",this.view=t,this.districtControllerDashLayer=new c(u.districtDashLineLayerOptions),this.districtControllerDashLayer.spatialReference=t.spatialReference,this.districtControllerSolidLayer=new c(u.districtSolidLineLayerOptions),this.districtControllerSolidLayer.spatialReference=t.spatialReference,this.districtControllerSolidLayer.popupEnabled=!0,this.view.map.addMany([this.districtControllerDashLayer,this.districtControllerSolidLayer])}async showDistricts(t){await this.clearDistricts();const e=[];for(let i=0;i<t.length;i++){const r=t[i],s=r.getAllSignalCoordinates();let a=null;if(s.length>=2)if(s.length===2)a=n.lineString(s);else{const f=n.featureCollection(s.map(p=>n.point(p)));a=d.convex(f),a||(a=n.lineString(s))}else if(s.length===1)a=n.point(s[0]);else continue;const h=d.buffer(a.geometry,200,{units:"meters"}),y=new C({geometry:{type:"polyline",paths:h.geometry.coordinates},attributes:{ObjectID:i,id:r.id,name:r.name,subDistrictCount:r.subDistrictCount,signalCount:r.signalCount,parentId:r.parentId,parentName:r.parentName,selected:this.style,type:"district"}});e.push(y)}await this.districtControllerDashLayer.applyEdits({addFeatures:e}),await this.districtControllerSolidLayer.applyEdits({addFeatures:e}),await l.default.viewGoto(this.view,e)}async clearDistricts(){let t=await this.districtControllerDashLayer.queryFeatures();await this.districtControllerDashLayer.applyEdits({deleteFeatures:t.features}),this.districtControllerDashLayer.definitionExpression="1=1",t=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:t.features}),this.districtControllerSolidLayer.definitionExpression="1=1"}setVisible(t){this.districtControllerDashLayer.visible=t,this.districtControllerSolidLayer.visible=t}async locateDistrict(t){const e=this.districtControllerDashLayer.createQuery();e.where=`id = '${t}'`,e.returnGeometry=!0,e.outFields=["*"];const i=await this.districtControllerDashLayer.queryFeatures(e);return i.features.length>0?(await l.default.viewGoto(this.view,i.features),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}async highlightDistrict(t){const e=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${t}'`;const i=await this.districtControllerDashLayer.queryFeatures(),r=i.features.length;return r>0?(this.districtControllerSolidLayer.definitionExpression=`id = '${t}'`,await l.default.viewGoto(this.view,i.features)):this.districtControllerDashLayer.definitionExpression=e,r}filter(t){const e=`id = '${t}'`;this.districtControllerDashLayer.definitionExpression=e,this.districtControllerSolidLayer.definitionExpression=e}resetFilter(){this.districtControllerDashLayer.definitionExpression="1=1",this.districtControllerSolidLayer.definitionExpression="1=1"}}exports.default=D;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/geometry"),y=require("@arcgis/core/geometry/support/webMercatorUtils"),g=require("@arcgis/core/Graphic"),R=require("@arcgis/core/layers/GraphicsLayer"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/geometry"),y=require("@arcgis/core/geometry/support/webMercatorUtils"),g=require("@arcgis/core/Graphic"),R=require("@arcgis/core/layers/GraphicsLayer"),D=require("papaparse"),w=require("../../stores/index.js"),m=require("./district-controller.js"),p=require("./district-renderer.js"),L=require("./signal-renderer.js"),C=require("./sub-district-renderer.js");class S{constructor(e){this.detachmentLayerLoaded=!1,this.view=e,this.hasGpu=!1;const t=w.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.detachmentLayer=new R,this.view.map.add(this.detachmentLayer),this.districtRenderer=new p.default(e),this.subDistrictRenderer=new C.default(e),this.signalRenderer=new L.default(e)}async showSignalControlArea(e){this.detachmentLayerLoaded||await this.loadDetachmentLayer(),this.roadLines||(await this.loadRoadLine(),this.subDistrictRenderer.roadLines=this.roadLines),await this.clearSignalControlArea(),this.districtRenderer.setVisible(!1),this.subDistrictRenderer.setVisible(!1),this.signalRenderer.setClusterVisible(!1),this.signalRenderer.setPointVisible(!1);const t=[],s=[];for(const n of e.areaList){const i=new m.default(n,e.style||"");t.push(i),s.push(...i.subDistricts)}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"}}async clearSignalControlArea(){return await this.districtRenderer.clearDistricts(),await this.subDistrictRenderer.clearSubDistricts(),await this.signalRenderer.clearSignals(),{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtRenderer.setVisible(e.visible);break;case"subDistrict":this.subDistrictRenderer.setVisible(e.visible);break;case"signal":this.signalRenderer.setPointVisible(e.visible);break;case"signalCluster":this.signalRenderer.setClusterVisible(e.visible);break;case"shanghai_district":this.detachmentLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":return await this.districtRenderer.locateDistrict(e.id);case"subDistrict":return await this.subDistrictRenderer.locateSubDistrict(e.id);case"signal":return await this.signalRenderer.locateSignal(e.id);default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){switch(this.view.closePopup(),e.type){case"district":return await this.districtRenderer.highlightDistrict(e.id)?(this.subDistrictRenderer.filter("district",e.id),this.signalRenderer.filter("district",e.id),this.roadLines&&this.roadLines.length>0&&await this.subDistrictRenderer.showRoads(e.id),{status:0,message:"ok"}):{status:1,message:"未找到区控"};case"subDistrict":{const{count:t,parentId:s}=await this.subDistrictRenderer.highlightSubDistrict(e.id);return t>0?(this.districtRenderer.filter(s),this.signalRenderer.filter("subDistrict",e.id),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}case"signal":{const{districtId:t,subDistrictId:s,count:n}=await this.signalRenderer.highlightSignal(e.id);return n>0?(this.districtRenderer.filter(t),this.subDistrictRenderer.filter("subDistrict",s),{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"}}async loadRoadLine(){var t;const e=(t=this.mapConfig.signalControlArea)==null?void 0:t.roadLayerUrl;if(!e){console.warn("未配置道路线图层URL");return}try{const n=await(await fetch(`/GisViewerAssets/${e}`)).text();D.parse(n,{header:!0,skipEmptyLines:!0,complete:i=>{const{data:r}=i;this.roadLines=r.map(a=>({id:a.ROADSECT_ID,fromNode:a.FROM_NODE_ID,toNode:a.TO_NODE_ID,coordinates:JSON.parse(a.GEOM).coordinates}))},error:i=>{console.error("道路线CSV解析失败:",i)}})}catch(s){console.error("读取道路线CSV失败:",s)}}async loadDetachmentLayer(){const e=this.mapConfig.baseLayers;if(!e)return;const t=e.find(s=>s.options.id==="shanghai_district");if(t)try{const n=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),i=[],{renderer:r,labelingInfo:a}=t.options;n.features.forEach(d=>{const c=d.attributes.ZD_NAME;if(c!=="高架支队"){let l=new f.Polygon({rings:d.geometry.rings});l=y.webMercatorToGeographic(l);const o=new g({geometry:l,attributes:d.attributes});if(r){if(r.type==="simple")o.symbol=r.symbol;else if(r.type==="unique-value"){const h=o.getAttribute("OBJECTID"),u=r.uniqueValueInfos.find(b=>b.value==h);o.symbol=u?u.symbol:r.defaultSymbol}}else o.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(i.push(o),a&&c!=="边防港航支队"&&c!=="机场支队"){const h=new g({geometry:l.centroid,symbol:{...a.symbol,text:c}});i.push(h)}}}),this.detachmentLayer.addMany(i),this.detachmentLayerLoaded=!0}catch(s){console.error("加载支队图层失败:",s);return}}}exports.default=S;
|
|
@@ -2,11 +2,10 @@ import { IResult } from '../../../types';
|
|
|
2
2
|
import DistrictController from './district-controller';
|
|
3
3
|
export default class CrossRenderer {
|
|
4
4
|
private view;
|
|
5
|
-
private hasGpu;
|
|
6
5
|
private signalMarkerLayer;
|
|
7
6
|
private signalPictureLayer;
|
|
8
7
|
private signalClusterLayer;
|
|
9
|
-
constructor(view: __esri.MapView | __esri.SceneView
|
|
8
|
+
constructor(view: __esri.MapView | __esri.SceneView);
|
|
10
9
|
showSignals(controllers: DistrictController[]): Promise<void>;
|
|
11
10
|
clearSignals(): Promise<void>;
|
|
12
11
|
setPointVisible(visible: boolean): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/Graphic"),u=require("@arcgis/core/layers/FeatureLayer"),l=require("./layer-symbol.js");class y{constructor(e
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/Graphic"),u=require("@arcgis/core/layers/FeatureLayer"),o=require("../common-utils.js"),l=require("./layer-symbol.js");class y{constructor(e){this.view=e,this.signalMarkerLayer=new u(l.signalMarkerLayerOptions),this.signalMarkerLayer.spatialReference=e.spatialReference,this.signalMarkerLayer.popupEnabled=!0,this.signalPictureLayer=new u(l.signalPictureLayerOptions),this.signalPictureLayer.spatialReference=e.spatialReference,this.signalPictureLayer.popupEnabled=!0,this.signalClusterLayer=new u(l.signalClusterLayerOptions),this.signalClusterLayer.spatialReference=e.spatialReference,this.signalClusterLayer.popupEnabled=!0,this.view.map.addMany([this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer])}async showSignals(e){await this.clearSignals();let r=0;const s=[];e.forEach(a=>{a.signals.forEach(i=>{const t=new d({geometry:{type:"point",longitude:i.longitude,latitude:i.latitude},attributes:{ObjectID:r++,id:i.id,name:i.name,signalId:i.signalId,nodeId:i.nodeId||i.id,districtId:a.id,districtName:a.name,subDistrictId:"",subDistrictName:"",isKey:i.isKey,type:"signal",selected:!0}});s.push(t)}),a.subDistricts.forEach(i=>{i.signals.forEach(t=>{const n=new d({geometry:{type:"point",longitude:t.longitude,latitude:t.latitude},attributes:{ObjectID:r++,id:t.id,name:t.name,signalId:t.signalId,nodeId:t.nodeId||t.id,districtId:a.id,districtName:a.name,subDistrictId:i.id,subDistrictName:i.name,isKey:t.isKey,type:"signal",selected:!0}});s.push(n)})})}),await this.signalMarkerLayer.applyEdits({addFeatures:s}),await this.signalPictureLayer.applyEdits({addFeatures:s}),await this.signalClusterLayer.applyEdits({addFeatures:s})}async clearSignals(){let e=await this.signalMarkerLayer.queryFeatures();await this.signalMarkerLayer.applyEdits({deleteFeatures:e.features}),this.signalMarkerLayer.definitionExpression="1=1",e=await this.signalPictureLayer.queryFeatures(),await this.signalPictureLayer.applyEdits({deleteFeatures:e.features}),this.signalPictureLayer.definitionExpression="1=1",e=await this.signalClusterLayer.queryFeatures(),await this.signalClusterLayer.applyEdits({deleteFeatures:e.features}),this.signalClusterLayer.definitionExpression="1=1"}async setPointVisible(e){this.signalMarkerLayer.visible=e,this.signalPictureLayer.visible=e}setClusterVisible(e){this.signalClusterLayer.visible=e}async locateSignal(e){return{status:0,message:"ok"}}async highlightSignal(e){let r="",s="";const a=this.signalMarkerLayer.definitionExpression;this.signalMarkerLayer.definitionExpression=`signalId = '${e}'`;const i=await this.signalMarkerLayer.queryFeatures(),t=i.features.length;if(t>0){const n=i.features[0].attributes.districtId||"",c=i.features[0].attributes.subDistrictId||"";return await o.default.viewGoto(this.view,i.features),{districtId:n,subDistrictId:c,count:t}}else this.signalMarkerLayer.definitionExpression=a;return{districtId:r,subDistrictId:s,count:t}}filter(e,r){const s=`${e==="district"?"districtId":"subDistrictId"} = '${r}'`;this.signalClusterLayer.definitionExpression=s,this.signalMarkerLayer.definitionExpression=s,this.signalPictureLayer.definitionExpression=s}resetFilter(){const e="1=1";this.signalClusterLayer.definitionExpression=e,this.signalMarkerLayer.definitionExpression=e,this.signalPictureLayer.definitionExpression=e}}exports.default=y;
|
|
@@ -2,12 +2,11 @@ import { IResult, IRoadLine } from '../../../types';
|
|
|
2
2
|
import DistrictController from './district-controller';
|
|
3
3
|
export default class SubDistrictRenderer {
|
|
4
4
|
private view;
|
|
5
|
-
private hasGpu;
|
|
6
5
|
private clickHandler;
|
|
7
6
|
private subDistrictPointLayer;
|
|
8
7
|
private subDistrictLineLayer;
|
|
9
8
|
roadLines: IRoadLine[];
|
|
10
|
-
constructor(view: __esri.MapView | __esri.SceneView
|
|
9
|
+
constructor(view: __esri.MapView | __esri.SceneView);
|
|
11
10
|
showSubDistricts(controllers: DistrictController[]): Promise<void>;
|
|
12
11
|
showRoads(districtId: string): Promise<void>;
|
|
13
12
|
clearSubDistricts(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/FeatureLayer"),g=require("./layer-symbol.js");class
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/FeatureLayer"),g=require("../common-utils.js"),P=require("./layer-symbol.js");class I{constructor(e){this.view=e,this.subDistrictPointLayer=new w(P.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=e.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new w(P.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=e.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(e){await this.clearSubDistricts(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const t=[],r=[];e.forEach(i=>{r.push({value:i.id,label:i.name,symbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[...i.areaColor],width:4}}}),i.signals.forEach(a=>{const u=new m({geometry:{type:"point",longitude:a.longitude,latitude:a.latitude},attributes:{ObjectID:s++,id:a.nodeId,name:a.name,subDistrictId:i.id,subDistrictName:i.name,districtId:i.parentId,districtName:i.parentName,signalCount:i.signalCount,color:i.areaColor.join(","),type:"subDistrict"}});t.push(u)})}),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:t})}async showRoads(e){const s=this.subDistrictPointLayer.createQuery();s.where=`districtId = '${e}'`;const t=await this.subDistrictPointLayer.queryFeatures(s),r=new Map;t.features.forEach(u=>{var o;const{subDistrictId:l,color:c,id:y,districtName:p,subDistrictName:n,signalCount:h}=u.attributes;r.has(l)||r.set(l,{color:c,signalIds:[],districtName:p,subDistrictName:n,signalCount:h}),(o=r.get(l))==null||o.signalIds.push(y)});const i=[],a=[];for(const u of r){let l=0;const c=u[0];i.push({value:c,symbol:{type:"simple-line",color:u[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:y,subDistrictName:p,signalIds:n,signalCount:h}=u[1];if(!(n.length<2))for(let o=0;o<n.length;o++)for(let d=0;d<n.length;d++){if(o===d)continue;const L=n[o],f=n[d];if(a.some(b=>{const v=b.attributes;return v&&v.fromNode===f&&v.toNode===L}))continue;const D=this.roadLines.find(b=>b.fromNode===L&&b.toNode===f);if(!D)continue;const z=new m({geometry:{type:"polyline",paths:[D.coordinates]},attributes:{ObjectID:l++,id:D.id,districtId:e,subDistrictId:c,subDistrictName:p,districtName:y,signalCount:h,fromNode:L,toNode:f,color:u[1].color}});a.push(z)}}this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",color:[180,180,180,.5],width:2,style:"solid"},defaultLabel:"其他子区",uniqueValueInfos:i,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:a})}async clearSubDistricts(){var t;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",(t=this.clickHandler)==null||t.remove()}setVisible(e){this.subDistrictPointLayer.visible=e,this.subDistrictLineLayer.visible=e}async locateSubDistrict(e){const s=this.subDistrictPointLayer.createQuery();s.where=`subDistrictId = '${e}'`,s.returnGeometry=!0;const t=await this.subDistrictPointLayer.queryFeatures(s);return t.features.length>0?(await g.default.viewGoto(this.view,t.features),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(e){let s="";const t=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${e}'`;const r=await this.subDistrictPointLayer.queryFeatures(),i=r.features.length;return i>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${e}'`,s=r.features[0].attributes.districtId,await g.default.viewGoto(this.view,r.features)):this.subDistrictPointLayer.definitionExpression=t,{count:i,parentId:s}}filter(e,s){const t=`${e==="district"?"districtId":"subDistrictId"} = '${s}'`;this.subDistrictPointLayer.definitionExpression=t,this.subDistrictLineLayer.definitionExpression=t}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(e){var r;const t=(r=(await this.view.hitTest(e,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(i=>i.type==="graphic");if(t.length===0)this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const i=t[0].graphic;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:i.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:i.attributes.color.split(",").map(Number),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:i.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:i.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=I;
|