gisviewer-vue3-arcgis 1.0.253 → 1.0.255

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 (33) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +3 -1
  2. package/es/src/gis-map/gis-map.vue.mjs +175 -173
  3. package/es/src/gis-map/index.d.ts +3 -1
  4. package/es/src/gis-map/utils/dbscan-cluster/index.d.ts +4 -2
  5. package/es/src/gis-map/utils/dbscan-cluster/index.mjs +89 -72
  6. package/es/src/gis-map/utils/map-initializer.d.ts +10 -1
  7. package/es/src/gis-map/utils/map-initializer.mjs +181 -111
  8. package/es/src/gis-map/utils/signal-control-area/cross-renderer.d.ts +9 -0
  9. package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +145 -0
  10. package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +53 -37
  11. package/es/src/gis-map/utils/signal-control-area/show-area.d.ts +3 -8
  12. package/es/src/gis-map/utils/signal-control-area/show-area.mjs +63 -105
  13. package/es/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +1 -1
  14. package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +5 -5
  15. package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +84 -83
  16. package/es/src/types/index.d.ts +3 -3
  17. package/lib/src/gis-map/gis-map.vue.d.ts +3 -1
  18. package/lib/src/gis-map/gis-map.vue.js +1 -1
  19. package/lib/src/gis-map/index.d.ts +3 -1
  20. package/lib/src/gis-map/utils/dbscan-cluster/index.d.ts +4 -2
  21. package/lib/src/gis-map/utils/dbscan-cluster/index.js +1 -1
  22. package/lib/src/gis-map/utils/map-initializer.d.ts +10 -1
  23. package/lib/src/gis-map/utils/map-initializer.js +1 -1
  24. package/lib/src/gis-map/utils/signal-control-area/cross-renderer.d.ts +9 -0
  25. package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -0
  26. package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -1
  27. package/lib/src/gis-map/utils/signal-control-area/show-area.d.ts +3 -8
  28. package/lib/src/gis-map/utils/signal-control-area/show-area.js +1 -1
  29. package/lib/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +1 -1
  30. package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -1
  31. package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
  32. package/lib/src/types/index.d.ts +3 -3
  33. package/package.json +1 -1
@@ -1,29 +1,45 @@
1
- import h from "pako";
2
- import c from "../common-utils.mjs";
3
- class e {
4
- constructor(o, s) {
5
- this.parentName = "", this.signals = [], this.subDistricts = [], this.areaColor = this.getDarkNonGrayColor(), this.signalCount = 0, this.subDistrictCount = 0, this.roadConnections = [], this.id = o.name, this.name = o.areaDesc, this.parentId = o.parentId, s === "alarm" && (this.areaColor = [255, 0, 0]);
6
- for (const t of o.children)
1
+ import d from "pako";
2
+ import h from "../common-utils.mjs";
3
+ class c {
4
+ constructor(i, s) {
5
+ if (this.parentName = "", this.signals = [], this.subDistricts = [], this.areaColor = this.getDarkNonGrayColor(), this.signalCount = 0, this.subDistrictCount = 0, this.roadConnections = [], this.id = i.name, this.name = i.areaDesc, this.parentId = i.parentId, s === "alarm" && (this.areaColor = [255, 0, 0]), i.mapConnectList)
6
+ try {
7
+ const t = i.mapConnectList, o = new Uint8Array(
8
+ window.atob(t).split("").map((r) => r.charCodeAt(0))
9
+ ), a = d.inflate(o, { to: "string" }), n = JSON.parse(a);
10
+ this.roadConnections.push(
11
+ ...n.map((r) => ({
12
+ id: r.roadsectId,
13
+ coordinates: JSON.parse(r.geomData).coordinates,
14
+ districtId: this.parentId,
15
+ subDistrictId: this.id
16
+ }))
17
+ );
18
+ } catch (t) {
19
+ console.error("解压子区路段连接信息失败:", t);
20
+ }
21
+ console.log(i);
22
+ for (const t of i.children)
7
23
  if (t.children) {
8
- const i = new e(t, s);
9
- if (i.id = t.id, i.name = `SS ${t.name}`, i.parentId = this.id, i.parentName = this.name, i.areaColor = this.getDarkNonGrayColor(t.id), this.subDistricts.push(i), this.subDistrictCount++, this.signalCount += i.signalCount, t.mapConnectList)
24
+ const o = new c(t, s);
25
+ if (o.id = t.id, o.name = `SS ${t.name}`, o.parentId = this.id, o.parentName = this.name, o.areaColor = this.getDarkNonGrayColor(t.id), this.subDistricts.push(o), this.subDistrictCount++, this.signalCount += o.signalCount, t.mapConnectList)
10
26
  try {
11
27
  const a = t.mapConnectList, n = new Uint8Array(
12
- window.atob(a).split("").map((r) => r.charCodeAt(0))
13
- ), l = h.inflate(n, { to: "string" }), d = JSON.parse(l);
14
- i.roadConnections.push(
15
- ...d.map((r) => ({
16
- id: r.roadsectId,
17
- coordinates: JSON.parse(r.geomData).coordinates,
18
- districtId: i.parentId,
19
- subDistrictId: i.id
28
+ window.atob(a).split("").map((e) => e.charCodeAt(0))
29
+ ), r = d.inflate(n, { to: "string" }), l = JSON.parse(r);
30
+ o.roadConnections.push(
31
+ ...l.map((e) => ({
32
+ id: e.roadsectId,
33
+ coordinates: JSON.parse(e.geomData).coordinates,
34
+ districtId: o.parentId,
35
+ subDistrictId: o.id
20
36
  }))
21
- ), console.log(i.roadConnections);
37
+ );
22
38
  } catch (a) {
23
39
  console.error("解压子区路段连接信息失败:", a);
24
40
  }
25
- } else if (c.isCoordinateValid(t)) {
26
- const i = {
41
+ } else if (h.isCoordinateValid(t)) {
42
+ const o = {
27
43
  id: t.id,
28
44
  name: t.name,
29
45
  parentId: t.parentId,
@@ -33,7 +49,7 @@ class e {
33
49
  nodeId: t.nodeId,
34
50
  isKey: t.isKey === 1
35
51
  };
36
- this.signals.push(i), this.signalCount++;
52
+ this.signals.push(o), this.signalCount++;
37
53
  }
38
54
  }
39
55
  /**
@@ -41,29 +57,29 @@ class e {
41
57
  * @returns
42
58
  */
43
59
  getAllSignalCoordinates() {
44
- const o = [];
60
+ const i = [];
45
61
  for (const s of this.signals)
46
- o.push([s.longitude, s.latitude]);
62
+ i.push([s.longitude, s.latitude]);
47
63
  for (const s of this.subDistricts)
48
- o.push(...s.getAllSignalCoordinates());
49
- return o;
64
+ i.push(...s.getAllSignalCoordinates());
65
+ return i;
50
66
  }
51
- getDarkNonGrayColor(o) {
52
- let s, t, i;
53
- if (o) {
54
- const a = this.cyrb53(o);
55
- s = ((a & 16711680) >> 16) % 200, t = ((a & 65280) >> 8) % 200, i = (a & 255) % 200;
67
+ getDarkNonGrayColor(i) {
68
+ let s, t, o;
69
+ if (i) {
70
+ const a = this.cyrb53(i);
71
+ s = ((a & 16711680) >> 16) % 200, t = ((a & 65280) >> 8) % 200, o = (a & 255) % 200;
56
72
  } else
57
- s = Math.floor(Math.random() * 256), t = Math.floor(Math.random() * 256), i = Math.floor(Math.random() * 256);
58
- return [s, t, i];
73
+ s = Math.floor(Math.random() * 256), t = Math.floor(Math.random() * 256), o = Math.floor(Math.random() * 256);
74
+ return [s, t, o];
59
75
  }
60
- cyrb53(o, s = 0) {
61
- let t = 3735928559 ^ s, i = 1103547991 ^ s;
62
- for (let a = 0, n; a < o.length; a++)
63
- n = o.charCodeAt(a), t = Math.imul(t ^ n, 2654435761), i = Math.imul(i ^ n, 1597334677);
64
- 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);
76
+ cyrb53(i, s = 0) {
77
+ let t = 3735928559 ^ s, o = 1103547991 ^ s;
78
+ for (let a = 0, n; a < i.length; a++)
79
+ n = i.charCodeAt(a), t = Math.imul(t ^ n, 2654435761), o = Math.imul(o ^ n, 1597334677);
80
+ return t = Math.imul(t ^ t >>> 16, 2246822507), t ^= Math.imul(o ^ o >>> 13, 3266489909), o = Math.imul(o ^ o >>> 16, 2246822507), o ^= Math.imul(t ^ t >>> 13, 3266489909), 4294967296 * (2097151 & o) + (t >>> 0);
65
81
  }
66
82
  }
67
83
  export {
68
- e as default
84
+ c as default
69
85
  };
@@ -2,11 +2,10 @@ import { IFindSignalControlAreaParams, ILayerVisibleParams, IResult, IShowSignal
2
2
  export default class SignalControlAreaController1 {
3
3
  private view;
4
4
  /** 支队图层 */
5
- private detachmentLayer;
6
- private detachmentLayerLoaded;
7
5
  private districtRenderer;
8
6
  private subDistrictRenderer;
9
7
  private signalRenderer;
8
+ private crossRenderer;
10
9
  private mapConfig;
11
10
  constructor(view: __esri.MapView | __esri.SceneView);
12
11
  /**
@@ -15,6 +14,8 @@ export default class SignalControlAreaController1 {
15
14
  * @returns
16
15
  */
17
16
  showSignalControlArea(params: IShowSignalControlAreaParams): Promise<IResult>;
17
+ showDistrict(params: IShowSignalControlAreaParams): Promise<void>;
18
+ showSubDistrict(params: IShowSignalControlAreaParams): Promise<void>;
18
19
  /**
19
20
  * 清空区控、子区、信号机
20
21
  * @returns
@@ -49,10 +50,4 @@ export default class SignalControlAreaController1 {
49
50
  status: number;
50
51
  message: string;
51
52
  }>;
52
- /**
53
- * 加载支队图层
54
- * 现场环境用url创建FeatureLayer有各种问题,
55
- * 改为图层导出为json,用json创建Graphic,再将Graphic添加到FeatureLayer
56
- */
57
- private loadDetachmentLayer;
58
53
  }
@@ -1,35 +1,56 @@
1
- import { Polygon as f } from "@arcgis/core/geometry";
2
- import { webMercatorToGeographic as y } from "@arcgis/core/geometry/support/webMercatorUtils";
3
- import g from "@arcgis/core/Graphic";
4
- import m from "@arcgis/core/layers/GraphicsLayer";
5
- import R from "../../stores/index.mjs";
6
- import w from "./district-controller.mjs";
7
- import D from "./district-renderer.mjs";
8
- import p from "./signal-renderer.mjs";
9
- import C from "./sub-district-renderer.mjs";
10
- class N {
1
+ import a from "../../stores/index.mjs";
2
+ import l from "./cross-renderer.mjs";
3
+ import r from "./district-controller.mjs";
4
+ import c from "./district-renderer.mjs";
5
+ import o from "./signal-renderer.mjs";
6
+ import d from "./sub-district-renderer.mjs";
7
+ class f {
11
8
  // private roadLines!: IRoadLine[];
12
- constructor(e) {
13
- this.detachmentLayerLoaded = !1, this.view = e;
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 D(e), this.subDistrictRenderer = new C(e), this.signalRenderer = new p(e);
9
+ constructor(t) {
10
+ this.view = t;
11
+ const i = a.useAppDataStore;
12
+ this.mapConfig = JSON.parse(JSON.stringify(i.mapConfig)), this.districtRenderer = new c(t), this.subDistrictRenderer = new d(t), this.signalRenderer = new o(t), this.crossRenderer = new l(t);
16
13
  }
17
14
  /**
18
15
  * 显示所有区控、子区、信号机
19
16
  * @param params
20
17
  * @returns
21
18
  */
22
- async showSignalControlArea(e) {
23
- this.detachmentLayerLoaded || await this.loadDetachmentLayer(), await this.clearSignalControlArea(), this.districtRenderer.setVisible(!1), this.subDistrictRenderer.setVisible(!1), this.signalRenderer.setClusterVisible(!1), this.signalRenderer.setPointVisible(!1);
24
- const t = [], s = [];
25
- for (const n of e.areaList) {
26
- const i = new w(
27
- n,
28
- e.style || ""
19
+ async showSignalControlArea(t) {
20
+ await this.clearSignalControlArea(), this.districtRenderer.setVisible(!1), this.subDistrictRenderer.setVisible(!1), this.signalRenderer.setClusterVisible(!1), this.signalRenderer.setPointVisible(!1);
21
+ const i = [], s = [];
22
+ for (const e of t.areaList) {
23
+ const n = new r(
24
+ e,
25
+ t.style || ""
29
26
  );
30
- t.push(i), s.push(...i.subDistricts);
27
+ i.push(n), s.push(...n.subDistricts);
31
28
  }
32
- return this.districtRenderer.style = e.style || "", await this.districtRenderer.showDistricts(t), await this.subDistrictRenderer.showSubDistricts(s), await this.signalRenderer.showSignals(t), { status: 0, message: "ok" };
29
+ return this.districtRenderer.style = t.style || "", await this.districtRenderer.showDistricts(i), await this.subDistrictRenderer.showSubDistricts(s), await this.signalRenderer.showSignals(i), { status: 0, message: "ok" };
30
+ }
31
+ async showDistrict(t) {
32
+ this.setLayerVisibility({ id: "district", visible: !0 }), this.setLayerVisibility({ id: "subDistrict", visible: !0 });
33
+ const i = new r(
34
+ t.areaList,
35
+ t.style || ""
36
+ );
37
+ await this.districtRenderer.showDistricts([i]), await this.subDistrictRenderer.showSubDistricts(
38
+ i.subDistricts
39
+ ), await this.subDistrictRenderer.showRoads({
40
+ id: i.id,
41
+ type: "district"
42
+ });
43
+ }
44
+ async showSubDistrict(t) {
45
+ this.setLayerVisibility({ id: "subDistrict", visible: !0 });
46
+ const i = new r(
47
+ t.areaList,
48
+ t.style || ""
49
+ );
50
+ await this.subDistrictRenderer.showSubDistricts([i]), await this.subDistrictRenderer.showRoads({
51
+ id: i.id,
52
+ type: "subDistrict"
53
+ });
33
54
  }
34
55
  /**
35
56
  * 清空区控、子区、信号机
@@ -43,22 +64,19 @@ class N {
43
64
  * @param layerName
44
65
  * @param visible
45
66
  */
46
- setLayerVisibility(e) {
47
- switch (e.visible === !1 && this.view.closePopup(), e.id) {
67
+ setLayerVisibility(t) {
68
+ switch (t.visible === !1 && this.view.closePopup(), t.id) {
48
69
  case "district":
49
- this.districtRenderer.setVisible(e.visible);
70
+ this.districtRenderer.setVisible(t.visible);
50
71
  break;
51
72
  case "subDistrict":
52
- this.subDistrictRenderer.setVisible(e.visible);
73
+ this.subDistrictRenderer.setVisible(t.visible);
53
74
  break;
54
75
  case "signal":
55
- this.signalRenderer.setPointVisible(e.visible);
76
+ this.signalRenderer.setPointVisible(t.visible);
56
77
  break;
57
78
  case "signalCluster":
58
- this.signalRenderer.setClusterVisible(e.visible);
59
- break;
60
- case "shanghai_district":
61
- this.detachmentLayer.visible = e.visible;
79
+ this.signalRenderer.setClusterVisible(t.visible);
62
80
  break;
63
81
  }
64
82
  return { status: 0, message: "ok" };
@@ -68,14 +86,14 @@ class N {
68
86
  * @param params
69
87
  * @returns
70
88
  */
71
- async locateSignalControlArea(e) {
72
- switch (e.type) {
89
+ async locateSignalControlArea(t) {
90
+ switch (t.type) {
73
91
  case "district":
74
- return await this.districtRenderer.locateDistrict(e.id);
92
+ return await this.districtRenderer.locateDistrict(t.id);
75
93
  case "subDistrict":
76
- return await this.subDistrictRenderer.locateSubDistrict(e.id);
94
+ return await this.subDistrictRenderer.locateSubDistrict(t.id);
77
95
  case "signal":
78
- return await this.signalRenderer.locateSignal(e.id);
96
+ return await this.signalRenderer.locateSignal(t.id);
79
97
  default:
80
98
  return { status: 1, message: "未知类型" };
81
99
  }
@@ -85,17 +103,17 @@ class N {
85
103
  * @param params
86
104
  * @returns
87
105
  */
88
- async highlightSignalControlArea(e) {
89
- switch (this.view.closePopup(), e.type) {
106
+ async highlightSignalControlArea(t) {
107
+ switch (this.view.closePopup(), t.type) {
90
108
  case "district":
91
- return await this.districtRenderer.highlightDistrict(e) ? (this.subDistrictRenderer.filter(e), this.signalRenderer.filter(e), await this.subDistrictRenderer.showRoads(e), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
109
+ return await this.districtRenderer.highlightDistrict(t) ? (this.subDistrictRenderer.filter(t), this.signalRenderer.filter(t), await this.subDistrictRenderer.showRoads(t), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
92
110
  case "subDistrict": {
93
- const { count: t, parentId: s } = await this.subDistrictRenderer.highlightSubDistrict(e);
94
- return t > 0 ? (this.districtRenderer.filter(s), this.signalRenderer.filter(e), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
111
+ const { count: i, parentId: s } = await this.subDistrictRenderer.highlightSubDistrict(t);
112
+ return i > 0 ? (this.districtRenderer.filter(s), this.signalRenderer.filter(t), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
95
113
  }
96
114
  case "signal": {
97
- const { districtId: t, subDistrictId: s, count: n } = await this.signalRenderer.highlightSignal(e.id);
98
- return n > 0 ? (this.districtRenderer.filter(t), this.subDistrictRenderer.filter(e), { status: 0, message: "ok" }) : { status: 1, message: "未找到信号机" };
115
+ const { districtId: i, subDistrictId: s, count: e } = await this.signalRenderer.highlightSignal(t.id);
116
+ return e > 0 ? (this.districtRenderer.filter(i), this.subDistrictRenderer.filter(t), { status: 0, message: "ok" }) : { status: 1, message: "未找到信号机" };
99
117
  }
100
118
  default:
101
119
  return { status: 1, message: "未知类型" };
@@ -108,67 +126,7 @@ class N {
108
126
  async resetHighlight() {
109
127
  return this.districtRenderer.resetFilter(), this.subDistrictRenderer.resetFilter(), this.signalRenderer.resetFilter(), { status: 0, message: "ok" };
110
128
  }
111
- /**
112
- * 加载支队图层
113
- * 现场环境用url创建FeatureLayer有各种问题,
114
- * 改为图层导出为json,用json创建Graphic,再将Graphic添加到FeatureLayer
115
- */
116
- async loadDetachmentLayer() {
117
- const e = this.mapConfig.baseLayers;
118
- if (!e)
119
- return;
120
- const t = e.find(
121
- (s) => s.options.id === "shanghai_district"
122
- );
123
- if (t)
124
- try {
125
- const n = await (await fetch(
126
- "/GisViewerAssets/ShangHai/Layers/district.json"
127
- )).json(), i = [], { renderer: r, labelingInfo: d } = t.options;
128
- n.features.forEach((c) => {
129
- const o = c.attributes.ZD_NAME;
130
- if (o !== "高架支队") {
131
- let l = new f({
132
- rings: c.geometry.rings
133
- });
134
- l = y(l);
135
- const a = new g({
136
- geometry: l,
137
- attributes: c.attributes
138
- });
139
- if (r) {
140
- if (r.type === "simple")
141
- a.symbol = r.symbol;
142
- else if (r.type === "unique-value") {
143
- const h = a.getAttribute("OBJECTID"), u = r.uniqueValueInfos.find(
144
- (b) => b.value == h
145
- );
146
- a.symbol = u ? u.symbol : r.defaultSymbol;
147
- }
148
- } else
149
- a.symbol = {
150
- type: "simple-fill",
151
- color: [227, 237, 255, 0.4],
152
- outline: {
153
- color: [255, 195, 153],
154
- width: 2
155
- }
156
- };
157
- if (i.push(a), d && o !== "边防港航支队" && o !== "机场支队") {
158
- const h = new g({
159
- geometry: l.centroid,
160
- symbol: { ...d.symbol, text: o }
161
- });
162
- i.push(h);
163
- }
164
- }
165
- }), this.detachmentLayer.addMany(i), this.detachmentLayerLoaded = !0;
166
- } catch (s) {
167
- console.error("加载支队图层失败:", s);
168
- return;
169
- }
170
- }
171
129
  }
172
130
  export {
173
- N as default
131
+ f as default
174
132
  };
@@ -1,6 +1,6 @@
1
1
  import { IFindSignalControlAreaParams, IResult } from '../../../types';
2
2
  import DistrictController from './district-controller';
3
- export default class CrossRenderer {
3
+ export default class SignalRenderer {
4
4
  private view;
5
5
  private signalMarkerLayer;
6
6
  private signalPictureLayer;
@@ -1,4 +1,4 @@
1
- import u from "@arcgis/core/Graphic";
1
+ import l from "@arcgis/core/Graphic";
2
2
  import d from "@arcgis/core/layers/FeatureLayer";
3
3
  import o from "../common-utils.mjs";
4
4
  import { signalMarkerLayerOptions as y, signalPictureLayerOptions as c, signalClusterLayerOptions as p } from "./layer-symbol.mjs";
@@ -22,7 +22,7 @@ class E {
22
22
  const a = [];
23
23
  e.forEach((s) => {
24
24
  s.signals.forEach((i) => {
25
- const t = new u({
25
+ const t = new l({
26
26
  geometry: {
27
27
  type: "point",
28
28
  longitude: i.longitude,
@@ -46,7 +46,7 @@ class E {
46
46
  a.push(t);
47
47
  }), s.subDistricts.forEach((i) => {
48
48
  i.signals.forEach((t) => {
49
- const n = new u({
49
+ const n = new l({
50
50
  geometry: {
51
51
  type: "point",
52
52
  longitude: t.longitude,
@@ -103,8 +103,8 @@ class E {
103
103
  this.signalMarkerLayer.definitionExpression = `signalId = '${e}'`;
104
104
  const i = await this.signalMarkerLayer.queryFeatures(), t = i.features.length;
105
105
  if (t > 0) {
106
- const n = i.features[0].attributes.districtId || "", l = i.features[0].attributes.subDistrictId || "";
107
- return await o.viewGoto(this.view, i.features), { districtId: n, subDistrictId: l, count: t };
106
+ const n = i.features[0].attributes.districtId || "", u = i.features[0].attributes.subDistrictId || "";
107
+ return await o.viewGoto(this.view, i.features), { districtId: n, subDistrictId: u, count: t };
108
108
  } else
109
109
  this.signalMarkerLayer.definitionExpression = s;
110
110
  return { districtId: r, subDistrictId: a, count: t };