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.
Files changed (23) hide show
  1. package/es/src/gis-map/utils/common-utils.d.ts +2 -0
  2. package/es/src/gis-map/utils/common-utils.mjs +37 -23
  3. package/es/src/gis-map/utils/detect-gpu.mjs +4 -4
  4. package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +20 -24
  5. package/es/src/gis-map/utils/signal-control-area/district-renderer.d.ts +1 -2
  6. package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +19 -24
  7. package/es/src/gis-map/utils/signal-control-area/show-area.mjs +8 -8
  8. package/es/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +1 -2
  9. package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +24 -25
  10. package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +1 -2
  11. package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +63 -68
  12. package/lib/src/gis-map/utils/common-utils.d.ts +2 -0
  13. package/lib/src/gis-map/utils/common-utils.js +1 -1
  14. package/lib/src/gis-map/utils/detect-gpu.js +1 -1
  15. package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -1
  16. package/lib/src/gis-map/utils/signal-control-area/district-renderer.d.ts +1 -2
  17. package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -1
  18. package/lib/src/gis-map/utils/signal-control-area/show-area.js +1 -1
  19. package/lib/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +1 -2
  20. package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -1
  21. package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +1 -2
  22. package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
  23. 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 f } from "@arcgis/core/geometry";
2
- import * as g from "@arcgis/core/geometry/geometryEngineAsync";
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 a from "@turf/helpers";
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 y from "proj4";
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 = a.point([t.x, t.y]), i = u(r, n, e, {
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 = a.point(e[0]), r = a.point(e[e.length - 1]);
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 = a.point(n[0]), i = a.point(n[1]), o = p(i, r), c = u(r, e, o, {
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
- }), h = o > 0 ? o - 180 : o + 180, P = u(i, e, h, {
45
+ }), y = o > 0 ? o - 180 : o + 180, P = u(i, e, y, {
46
46
  units: "meters"
47
47
  });
48
- return new f({
48
+ return new g({
49
49
  paths: [
50
- [c.geometry.coordinates, P.geometry.coordinates]
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 g.intersectLinesToPoints(
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 f({ paths: [r] });
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 f({ paths: [t] });
106
- return await g.geodesicLength(e, "meters");
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 g.intersect(t, e);
118
- if (r instanceof f) {
119
- const i = r.paths[0], o = i[0], c = i[i.length - 1];
120
- return [o, c];
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 g.offset(
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) => y(s.geoReference).inverse([
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 y(s.geoReference).inverse([
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 = a.point(t), i = a.point(e), o = p(r, i);
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 = a.lineString(t), n = d(e, { units: "meters" }) / 2, r = O(e, 0, n, {
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
- }, u = () => {
39
- const e = l();
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
- u as default
43
+ a as default
44
44
  };
@@ -1,12 +1,12 @@
1
- import u from "../common-utils.mjs";
2
- class h {
3
- constructor(s, a) {
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, a === "alarm" && (this.areaColor = [255, 0, 0]);
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 h(t, a);
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 (u.isCoordinateValid(t)) {
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 a of this.signals)
30
- s.push([a.longitude, a.latitude]);
31
- for (const a of this.subDistricts)
32
- s.push(...a.getAllSignalCoordinates());
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 a, t, i;
36
+ let o, t, i;
37
37
  if (s) {
38
- const r = this.cyrb53(s);
39
- a = Math.abs(r) % 360, t = 80 + Math.abs(r >> 3) % 21, i = 10 + Math.abs(r >> 7) % 41;
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
- a = Math.floor(Math.random() * 360), t = 80 + Math.random() * 20, i = 15 + Math.random() * 35;
42
- const o = t / 100 * Math.min(i / 100, 1 - i / 100), n = (r) => {
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, a = 0) {
49
- let t = 3735928559 ^ a, i = 1103547991 ^ a;
50
- for (let o = 0, n; o < s.length; o++)
51
- n = s.charCodeAt(o), t = Math.imul(t ^ n, 2654435761), i = Math.imul(i ^ n, 1597334677);
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
- h as default
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
- private hasGpu;
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 n from "@arcgis/core/layers/FeatureLayer";
2
+ import l from "@arcgis/core/layers/FeatureLayer";
3
3
  import * as a from "@turf/helpers";
4
- import { convex as y, buffer as p } from "@turf/turf";
5
- import { districtDashLineLayerOptions as f, districtSolidLineLayerOptions as C } from "./layer-symbol.mjs";
6
- class S {
7
- constructor(t, i) {
8
- this.style = "", this.hasGpu = !0, this.view = t, this.hasGpu = i, this.districtControllerDashLayer = new n(
9
- f
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((c) => a.point(c))
33
+ s.map((y) => a.point(y))
33
34
  );
34
- o = y(h), o || (o = a.lineString(s));
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 l = p(o.geometry, 200, {
41
+ const d = f(o.geometry, 200, {
41
42
  units: "meters"
42
- }), d = new u({
43
+ }), c = new u({
43
44
  geometry: {
44
45
  type: "polyline",
45
- paths: l.geometry.coordinates
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(d);
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.goTo(i, {
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.goTo(e.features, {
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.goTo(e.features, {
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
- S as default
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 p from "papaparse";
6
- import R from "../../stores/index.mjs";
7
- import D from "./district-controller.mjs";
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 = localStorage.getItem("gpu") !== "Unknown";
14
- const t = R.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.hasGpu), this.subDistrictRenderer = new C(e, this.hasGpu), this.signalRenderer = new L(e, this.hasGpu);
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 D(
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
- p.parse(a, {
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, hasGpu: boolean);
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 { signalMarkerLayerOptions as y, signalPictureLayerOptions as c, signalClusterLayerOptions as o } from "./layer-symbol.mjs";
4
- class f {
5
- constructor(e, a) {
6
- this.view = e, this.hasGpu = a, this.signalMarkerLayer = new u(
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
- o
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 a = 0;
21
+ let r = 0;
21
22
  const s = [];
22
- e.forEach((r) => {
23
- r.signals.forEach((i) => {
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: a++,
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: r.id,
37
- districtName: r.name,
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
- }), r.subDistricts.forEach((i) => {
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: a++,
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: r.id,
61
- districtName: r.name,
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 a = "", s = "";
101
- const r = this.signalMarkerLayer.definitionExpression;
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.goTo(i.features, {
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 = r;
111
- return { districtId: a, subDistrictId: s, count: t };
109
+ this.signalMarkerLayer.definitionExpression = a;
110
+ return { districtId: r, subDistrictId: s, count: t };
112
111
  }
113
- filter(e, a) {
114
- const s = `${e === "district" ? "districtId" : "subDistrictId"} = '${a}'`;
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
- f as default
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, hasGpu: boolean);
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 { subDistrictPointLayerOptions as z, subDistrictLineLayerOptions as P } from "./layer-symbol.mjs";
4
- class F {
5
- constructor(e, t) {
6
- this.view = e, this.hasGpu = t, this.subDistrictPointLayer = new w(
7
- z
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 t = 0;
18
- const s = [], r = [];
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 u = new v({
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: t++,
42
- id: a.id,
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
- s.push(u);
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: s
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 t = this.subDistrictPointLayer.createQuery();
105
- t.where = `districtId = '${e}'`;
106
- const s = await this.subDistrictPointLayer.queryFeatures(
107
- t
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
- s.features.forEach((u) => {
108
+ t.features.forEach((n) => {
110
109
  var o;
111
110
  const {
112
111
  subDistrictId: c,
113
112
  color: l,
114
- id: p,
115
- districtName: b,
116
- subDistrictName: n,
113
+ id: b,
114
+ districtName: h,
115
+ subDistrictName: u,
117
116
  signalCount: y
118
- } = u.attributes;
117
+ } = n.attributes;
119
118
  r.has(c) || r.set(c, {
120
119
  color: l,
121
120
  signalIds: [],
122
- districtName: b,
123
- subDistrictName: n,
121
+ districtName: h,
122
+ subDistrictName: u,
124
123
  signalCount: y
125
- }), (o = r.get(c)) == null || o.signalIds.push(p);
124
+ }), (o = r.get(c)) == null || o.signalIds.push(b);
126
125
  });
127
126
  const i = [], a = [];
128
- for (const u of r) {
127
+ for (const n of r) {
129
128
  let c = 0;
130
- const l = u[0];
129
+ const l = n[0];
131
130
  i.push({
132
131
  value: l,
133
132
  symbol: {
134
133
  type: "simple-line",
135
- color: u[1].color.split(",").map(Number),
134
+ color: n[1].color.split(",").map(Number),
136
135
  width: 2,
137
136
  style: "solid"
138
137
  }
139
138
  });
140
- const { districtName: p, subDistrictName: b, signalIds: n, signalCount: y } = u[1];
141
- if (!(n.length < 2))
142
- for (let o = 0; o < n.length; o++)
143
- for (let d = 0; d < n.length; 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 L = n[o], f = n[d];
147
- if (a.some((h) => {
148
- const m = h.attributes;
149
- return m && m.fromNode === f && m.toNode === L;
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
- (h) => h.fromNode === L && h.toNode === f
152
+ (p) => p.fromNode === f && p.toNode === L
154
153
  );
155
154
  if (!D)
156
155
  continue;
157
- const g = new v({
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: b,
168
- districtName: p,
166
+ subDistrictName: h,
167
+ districtName: b,
169
168
  signalCount: y,
170
- fromNode: L,
171
- toNode: f,
172
- color: u[1].color
169
+ fromNode: f,
170
+ toNode: L,
171
+ color: n[1].color
173
172
  }
174
173
  });
175
- a.push(g);
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 s;
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 t = await this.subDistrictLineLayer.queryFeatures();
228
- t.features.length > 0 && await this.subDistrictLineLayer.applyEdits({
229
- deleteFeatures: t.features
230
- }), this.subDistrictLineLayer.definitionExpression = "1=1", (s = this.clickHandler) == null || s.remove();
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 t = this.subDistrictPointLayer.createQuery();
241
- t.where = `subDistrictId = '${e}'`, t.returnGeometry = !0;
242
- const s = await this.subDistrictPointLayer.queryFeatures(t);
243
- return s.features.length > 0 ? (await this.view.goTo(s.features, {
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 t = "";
254
- const s = this.subDistrictPointLayer.definitionExpression;
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}'`, t = r.features[0].attributes.districtId, await this.view.goTo(r.features, {
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, t) {
267
- const s = `${e === "district" ? "districtId" : "subDistrictId"} = '${t}'`;
268
- this.subDistrictPointLayer.definitionExpression = s, this.subDistrictLineLayer.definitionExpression = s;
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 s = (r = (await this.view.hitTest(e, {
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 (s.length === 0)
278
+ if (t.length === 0)
284
279
  this.subDistrictPointLayer.renderer = this.currentPointRenderer, this.subDistrictLineLayer.renderer = this.currentLineRenderer;
285
280
  else {
286
- const i = s[0].graphic;
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
- F as default
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"),g=require("@turf/destination"),b=require("@turf/helpers"),S=require("@turf/length"),A=require("@turf/line-slice-along"),M=require("pako"),h=require("proj4");function y(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const l=y(L),P=y(w),c=y(b);class i{static destinationWithPoint(e,t,n){const r=c.point([e.x,e.y]),s=g(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),u=g(r,t,o,{units:"meters"}),d=o>0?o-180:o+180,O=g(s,t,d,{units:"meters"});return new f.Polyline({paths:[[u.geometry.coordinates,O.geometry.coordinates]]})}static async getIntersectPointOfTwoLines(e,t){const n=await l.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 l.geodesicLength(t,"meters")}static async getIntersectPointOfLineAndPolygon(e,t,n=0){n!==0&&(e=await i.getOffsetLine(e,n));const r=await l.intersect(e,t);if(r instanceof f.Polyline){const s=r.paths[0],o=s[0],u=s[s.length-1];return[o,u]}return[]}static async getOffsetLine(e,t){const n=P.geographicToWebMercator(e),r=await l.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 M.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 g(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]}}exports.default=i;
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(),c=()=>{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"}},l=()=>{const e=c();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=()=>{const e=l();return console.log("GPU:",e),localStorage.setItem("gpu",e),e};exports.default=u;
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 u=require("../common-utils.js");class r{constructor(s,a){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,a==="alarm"&&(this.areaColor=[255,0,0]);for(const t of s.children)if(t.children){const i=new r(t,a);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(u.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 a of this.signals)s.push([a.longitude,a.latitude]);for(const a of this.subDistricts)s.push(...a.getAllSignalCoordinates());return s}getDarkNonGrayColor(s){let a,t,i;if(s){const e=this.cyrb53(s);a=Math.abs(e)%360,t=80+Math.abs(e>>3)%21,i=10+Math.abs(e>>7)%41}else a=Math.floor(Math.random()*360),t=80+Math.random()*20,i=15+Math.random()*35;const o=t/100*Math.min(i/100,1-i/100),n=e=>{const l=(e+a/30)%12,h=i/100-o*Math.max(Math.min(l-3,9-l,1),-1);return Math.round(255*h)};return[n(0),n(8),n(4)]}cyrb53(s,a=0){let t=3735928559^a,i=1103547991^a;for(let o=0,n;o<s.length;o++)n=s.charCodeAt(o),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=r;
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
- private hasGpu;
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 f=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/FeatureLayer"),C=require("@turf/helpers"),c=require("@turf/turf"),d=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(C);class L{constructor(t,e){this.style="",this.hasGpu=!0,this.view=t,this.hasGpu=e,this.districtControllerDashLayer=new l(d.districtDashLineLayerOptions),this.districtControllerDashLayer.spatialReference=t.spatialReference,this.districtControllerSolidLayer=new l(d.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 y=n.featureCollection(s.map(p=>n.point(p)));a=c.convex(y),a||(a=n.lineString(s))}else if(s.length===1)a=n.point(s[0]);else continue;const u=c.buffer(a.geometry,200,{units:"meters"}),h=new f({geometry:{type:"polyline",paths:u.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(h)}await this.districtControllerDashLayer.applyEdits({addFeatures:e}),await this.districtControllerSolidLayer.applyEdits({addFeatures:e}),await this.view.goTo(e,{duration:this.hasGpu?1e3:0})}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 this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{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 this.view.goTo(i.features,{duration:this.hasGpu?1e3:0})):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=L;
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"),w=require("papaparse"),D=require("../../stores/index.js"),p=require("./district-controller.js"),m=require("./district-renderer.js"),L=require("./signal-renderer.js"),S=require("./sub-district-renderer.js");class C{constructor(e){this.detachmentLayerLoaded=!1,this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const t=D.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.detachmentLayer=new R,this.view.map.add(this.detachmentLayer),this.districtRenderer=new m.default(e,this.hasGpu),this.subDistrictRenderer=new S.default(e,this.hasGpu),this.signalRenderer=new L.default(e,this.hasGpu)}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 a of e.areaList){const i=new p.default(a,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:a}=await this.signalRenderer.highlightSignal(e.id);return a>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 a=await(await fetch(`/GisViewerAssets/${e}`)).text();w.parse(a,{header:!0,skipEmptyLines:!0,complete:i=>{const{data:r}=i;this.roadLines=r.map(n=>({id:n.ROADSECT_ID,fromNode:n.FROM_NODE_ID,toNode:n.TO_NODE_ID,coordinates:JSON.parse(n.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 a=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),i=[],{renderer:r,labelingInfo:n}=t.options;a.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),n&&c!=="边防港航支队"&&c!=="机场支队"){const h=new g({geometry:l.centroid,symbol:{...n.symbol,text:c}});i.push(h)}}}),this.detachmentLayer.addMany(i),this.detachmentLayerLoaded=!0}catch(s){console.error("加载支队图层失败:",s);return}}}exports.default=C;
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, hasGpu: boolean);
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,a){this.view=e,this.hasGpu=a,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 a=0;const s=[];e.forEach(r=>{r.signals.forEach(i=>{const t=new d({geometry:{type:"point",longitude:i.longitude,latitude:i.latitude},attributes:{ObjectID:a++,id:i.id,name:i.name,signalId:i.signalId,nodeId:i.nodeId||i.id,districtId:r.id,districtName:r.name,subDistrictId:"",subDistrictName:"",isKey:i.isKey,type:"signal",selected:!0}});s.push(t)}),r.subDistricts.forEach(i=>{i.signals.forEach(t=>{const n=new d({geometry:{type:"point",longitude:t.longitude,latitude:t.latitude},attributes:{ObjectID:a++,id:t.id,name:t.name,signalId:t.signalId,nodeId:t.nodeId||t.id,districtId:r.id,districtName:r.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 a="",s="";const r=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 this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{districtId:n,subDistrictId:c,count:t}}else this.signalMarkerLayer.definitionExpression=r;return{districtId:a,subDistrictId:s,count:t}}filter(e,a){const s=`${e==="district"?"districtId":"subDistrictId"} = '${a}'`;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;
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, hasGpu: boolean);
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 z{constructor(e,t){this.view=e,this.hasGpu=t,this.subDistrictPointLayer=new w(g.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=e.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new w(g.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 t=0;const s=[],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:t++,id:a.id,name:a.name,subDistrictId:i.id,subDistrictName:i.name,districtId:i.parentId,districtName:i.parentName,signalCount:i.signalCount,color:i.areaColor.join(","),type:"subDistrict"}});s.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:s}),await this.view.goTo(s,{duration:this.hasGpu?1e3:0})}async showRoads(e){const t=this.subDistrictPointLayer.createQuery();t.where=`districtId = '${e}'`;const s=await this.subDistrictPointLayer.queryFeatures(t),r=new Map;s.features.forEach(u=>{var o;const{subDistrictId:c,color:l,id:p,districtName:b,subDistrictName:n,signalCount:y}=u.attributes;r.has(c)||r.set(c,{color:l,signalIds:[],districtName:b,subDistrictName:n,signalCount:y}),(o=r.get(c))==null||o.signalIds.push(p)});const i=[],a=[];for(const u of r){let c=0;const l=u[0];i.push({value:l,symbol:{type:"simple-line",color:u[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:p,subDistrictName:b,signalIds:n,signalCount:y}=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],D=n[d];if(a.some(h=>{const v=h.attributes;return v&&v.fromNode===D&&v.toNode===L}))continue;const f=this.roadLines.find(h=>h.fromNode===L&&h.toNode===D);if(!f)continue;const P=new m({geometry:{type:"polyline",paths:[f.coordinates]},attributes:{ObjectID:c++,id:f.id,districtId:e,subDistrictId:l,subDistrictName:b,districtName:p,signalCount:y,fromNode:L,toNode:D,color:u[1].color}});a.push(P)}}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 s;const e=await this.subDistrictPointLayer.queryFeatures();e.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictPointLayer.definitionExpression="1=1";const t=await this.subDistrictLineLayer.queryFeatures();t.features.length>0&&await this.subDistrictLineLayer.applyEdits({deleteFeatures:t.features}),this.subDistrictLineLayer.definitionExpression="1=1",(s=this.clickHandler)==null||s.remove()}setVisible(e){this.subDistrictPointLayer.visible=e,this.subDistrictLineLayer.visible=e}async locateSubDistrict(e){const t=this.subDistrictPointLayer.createQuery();t.where=`subDistrictId = '${e}'`,t.returnGeometry=!0;const s=await this.subDistrictPointLayer.queryFeatures(t);return s.features.length>0?(await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(e){let t="";const s=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}'`,t=r.features[0].attributes.districtId,await this.view.goTo(r.features,{duration:this.hasGpu?1e3:0})):this.subDistrictPointLayer.definitionExpression=s,{count:i,parentId:t}}filter(e,t){const s=`${e==="district"?"districtId":"subDistrictId"} = '${t}'`;this.subDistrictPointLayer.definitionExpression=s,this.subDistrictLineLayer.definitionExpression=s}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(e){var r;const s=(r=(await this.view.hitTest(e,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(i=>i.type==="graphic");if(s.length===0)this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const i=s[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=z;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.234",
3
+ "version": "1.0.236",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [