gisviewer-vue3-arcgis 1.0.235 → 1.0.237

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 (31) 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.d.ts +2 -0
  5. package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +42 -26
  6. package/es/src/gis-map/utils/signal-control-area/district-renderer.d.ts +1 -2
  7. package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +19 -24
  8. package/es/src/gis-map/utils/signal-control-area/layer-symbol.mjs +30 -34
  9. package/es/src/gis-map/utils/signal-control-area/show-area.d.ts +0 -7
  10. package/es/src/gis-map/utils/signal-control-area/show-area.mjs +39 -72
  11. package/es/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +3 -4
  12. package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +36 -37
  13. package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +13 -6
  14. package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +95 -107
  15. package/es/src/types/index.d.ts +6 -0
  16. package/lib/src/gis-map/utils/common-utils.d.ts +2 -0
  17. package/lib/src/gis-map/utils/common-utils.js +1 -1
  18. package/lib/src/gis-map/utils/detect-gpu.js +1 -1
  19. package/lib/src/gis-map/utils/signal-control-area/district-controller.d.ts +2 -0
  20. package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -1
  21. package/lib/src/gis-map/utils/signal-control-area/district-renderer.d.ts +1 -2
  22. package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -1
  23. package/lib/src/gis-map/utils/signal-control-area/layer-symbol.js +1 -1
  24. package/lib/src/gis-map/utils/signal-control-area/show-area.d.ts +0 -7
  25. package/lib/src/gis-map/utils/signal-control-area/show-area.js +1 -1
  26. package/lib/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +3 -4
  27. package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -1
  28. package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +13 -6
  29. package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
  30. package/lib/src/types/index.d.ts +6 -0
  31. package/package.json +1 -1
@@ -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
5
  import R from "../../stores/index.mjs";
7
- import D from "./district-controller.mjs";
8
- import w from "./district-renderer.mjs";
9
- import L from "./signal-renderer.mjs";
6
+ import w from "./district-controller.mjs";
7
+ import D from "./district-renderer.mjs";
8
+ import p from "./signal-renderer.mjs";
10
9
  import C from "./sub-district-renderer.mjs";
11
- class P {
10
+ class N {
11
+ // private roadLines!: IRoadLine[];
12
12
  constructor(e) {
13
- this.detachmentLayerLoaded = !1, this.view = e, this.hasGpu = localStorage.getItem("gpu") !== "Unknown";
13
+ this.detachmentLayerLoaded = !1, this.view = e;
14
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);
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);
16
16
  }
17
17
  /**
18
18
  * 显示所有区控、子区、信号机
@@ -20,16 +20,16 @@ class P {
20
20
  * @returns
21
21
  */
22
22
  async showSignalControlArea(e) {
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
- const t = [], s = [];
25
- for (const a of e.areaList) {
26
- const i = new D(
27
- a,
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 = [], i = [];
25
+ for (const n of e.areaList) {
26
+ const s = new w(
27
+ n,
28
28
  e.style || ""
29
29
  );
30
- t.push(i), s.push(...i.subDistricts);
30
+ t.push(s), i.push(...s.subDistricts);
31
31
  }
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" };
32
+ return this.districtRenderer.style = e.style || "", await this.districtRenderer.showDistricts(t), await this.subDistrictRenderer.showSubDistricts(i), await this.signalRenderer.showSignals(t), { status: 0, message: "ok" };
33
33
  }
34
34
  /**
35
35
  * 清空区控、子区、信号机
@@ -88,14 +88,14 @@ class P {
88
88
  async highlightSignalControlArea(e) {
89
89
  switch (this.view.closePopup(), e.type) {
90
90
  case "district":
91
- 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: "未找到区控" };
91
+ return await this.districtRenderer.highlightDistrict(e.id) ? (this.subDistrictRenderer.filter(e), this.signalRenderer.filter(e), await this.subDistrictRenderer.showRoads(e), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
92
92
  case "subDistrict": {
93
- const { count: t, parentId: s } = await this.subDistrictRenderer.highlightSubDistrict(e.id);
94
- return t > 0 ? (this.districtRenderer.filter(s), this.signalRenderer.filter("subDistrict", e.id), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
93
+ const { count: t, parentId: i } = await this.subDistrictRenderer.highlightSubDistrict(e.id);
94
+ return t > 0 ? (this.districtRenderer.filter(i), this.signalRenderer.filter(e), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
95
95
  }
96
96
  case "signal": {
97
- const { districtId: t, subDistrictId: s, count: a } = await this.signalRenderer.highlightSignal(e.id);
98
- return a > 0 ? (this.districtRenderer.filter(t), this.subDistrictRenderer.filter("subDistrict", s), { status: 0, message: "ok" }) : { status: 1, message: "未找到信号机" };
97
+ const { districtId: t, subDistrictId: i, 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: "未找到信号机" };
99
99
  }
100
100
  default:
101
101
  return { status: 1, message: "未知类型" };
@@ -108,39 +108,6 @@ class P {
108
108
  async resetHighlight() {
109
109
  return this.districtRenderer.resetFilter(), this.subDistrictRenderer.resetFilter(), this.signalRenderer.resetFilter(), { status: 0, message: "ok" };
110
110
  }
111
- /**
112
- * 获取道路线
113
- * @returns
114
- */
115
- async loadRoadLine() {
116
- var t;
117
- const e = (t = this.mapConfig.signalControlArea) == null ? void 0 : t.roadLayerUrl;
118
- if (!e) {
119
- console.warn("未配置道路线图层URL");
120
- return;
121
- }
122
- try {
123
- const a = await (await fetch(`/GisViewerAssets/${e}`)).text();
124
- p.parse(a, {
125
- header: !0,
126
- skipEmptyLines: !0,
127
- complete: (i) => {
128
- const { data: r } = i;
129
- this.roadLines = r.map((n) => ({
130
- id: n.ROADSECT_ID,
131
- fromNode: n.FROM_NODE_ID,
132
- toNode: n.TO_NODE_ID,
133
- coordinates: JSON.parse(n.GEOM).coordinates
134
- }));
135
- },
136
- error: (i) => {
137
- console.error("道路线CSV解析失败:", i);
138
- }
139
- });
140
- } catch (s) {
141
- console.error("读取道路线CSV失败:", s);
142
- }
143
- }
144
111
  /**
145
112
  * 加载支队图层
146
113
  * 现场环境用url创建FeatureLayer有各种问题,
@@ -151,35 +118,35 @@ class P {
151
118
  if (!e)
152
119
  return;
153
120
  const t = e.find(
154
- (s) => s.options.id === "shanghai_district"
121
+ (i) => i.options.id === "shanghai_district"
155
122
  );
156
123
  if (t)
157
124
  try {
158
- const a = await (await fetch(
125
+ const n = await (await fetch(
159
126
  "/GisViewerAssets/ShangHai/Layers/district.json"
160
- )).json(), i = [], { renderer: r, labelingInfo: n } = t.options;
161
- a.features.forEach((d) => {
162
- const c = d.attributes.ZD_NAME;
163
- if (c !== "高架支队") {
127
+ )).json(), s = [], { renderer: r, labelingInfo: d } = t.options;
128
+ n.features.forEach((c) => {
129
+ const o = c.attributes.ZD_NAME;
130
+ if (o !== "高架支队") {
164
131
  let l = new f({
165
- rings: d.geometry.rings
132
+ rings: c.geometry.rings
166
133
  });
167
134
  l = y(l);
168
- const o = new g({
135
+ const a = new g({
169
136
  geometry: l,
170
- attributes: d.attributes
137
+ attributes: c.attributes
171
138
  });
172
139
  if (r) {
173
140
  if (r.type === "simple")
174
- o.symbol = r.symbol;
141
+ a.symbol = r.symbol;
175
142
  else if (r.type === "unique-value") {
176
- const h = o.getAttribute("OBJECTID"), u = r.uniqueValueInfos.find(
143
+ const h = a.getAttribute("OBJECTID"), u = r.uniqueValueInfos.find(
177
144
  (b) => b.value == h
178
145
  );
179
- o.symbol = u ? u.symbol : r.defaultSymbol;
146
+ a.symbol = u ? u.symbol : r.defaultSymbol;
180
147
  }
181
148
  } else
182
- o.symbol = {
149
+ a.symbol = {
183
150
  type: "simple-fill",
184
151
  color: [227, 237, 255, 0.4],
185
152
  outline: {
@@ -187,21 +154,21 @@ class P {
187
154
  width: 2
188
155
  }
189
156
  };
190
- if (i.push(o), n && c !== "边防港航支队" && c !== "机场支队") {
157
+ if (s.push(a), d && o !== "边防港航支队" && o !== "机场支队") {
191
158
  const h = new g({
192
159
  geometry: l.centroid,
193
- symbol: { ...n.symbol, text: c }
160
+ symbol: { ...d.symbol, text: o }
194
161
  });
195
- i.push(h);
162
+ s.push(h);
196
163
  }
197
164
  }
198
- }), this.detachmentLayer.addMany(i), this.detachmentLayerLoaded = !0;
199
- } catch (s) {
200
- console.error("加载支队图层失败:", s);
165
+ }), this.detachmentLayer.addMany(s), this.detachmentLayerLoaded = !0;
166
+ } catch (i) {
167
+ console.error("加载支队图层失败:", i);
201
168
  return;
202
169
  }
203
170
  }
204
171
  }
205
172
  export {
206
- P as default
173
+ N as default
207
174
  };
@@ -1,12 +1,11 @@
1
- import { IResult } from '../../../types';
1
+ import { IFindSignalControlAreaParams, 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>;
@@ -17,6 +16,6 @@ export default class CrossRenderer {
17
16
  subDistrictId: string;
18
17
  count: number;
19
18
  }>;
20
- filter(type: string, id: string): void;
19
+ filter(params: IFindSignalControlAreaParams): void;
21
20
  resetFilter(): void;
22
21
  }
@@ -1,14 +1,15 @@
1
- import d from "@arcgis/core/Graphic";
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(
1
+ import u from "@arcgis/core/Graphic";
2
+ import d from "@arcgis/core/layers/FeatureLayer";
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 d(
7
8
  y
8
- ), this.signalMarkerLayer.spatialReference = e.spatialReference, this.signalMarkerLayer.popupEnabled = !0, this.signalPictureLayer = new u(
9
+ ), this.signalMarkerLayer.spatialReference = e.spatialReference, this.signalMarkerLayer.popupEnabled = !0, this.signalPictureLayer = new d(
9
10
  c
10
- ), this.signalPictureLayer.spatialReference = e.spatialReference, this.signalPictureLayer.popupEnabled = !0, this.signalClusterLayer = new u(
11
- o
11
+ ), this.signalPictureLayer.spatialReference = e.spatialReference, this.signalPictureLayer.popupEnabled = !0, this.signalClusterLayer = new d(
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,24 +18,24 @@ class f {
17
18
  }
18
19
  async showSignals(e) {
19
20
  await this.clearSignals();
20
- let a = 0;
21
- const s = [];
22
- e.forEach((r) => {
23
- r.signals.forEach((i) => {
24
- const t = new d({
21
+ let r = 0;
22
+ const a = [];
23
+ e.forEach((s) => {
24
+ s.signals.forEach((i) => {
25
+ const t = new u({
25
26
  geometry: {
26
27
  type: "point",
27
28
  longitude: i.longitude,
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: s.id,
38
+ districtName: s.name,
38
39
  subDistrictId: "",
39
40
  subDistrictName: "",
40
41
  isKey: i.isKey,
@@ -42,23 +43,23 @@ class f {
42
43
  selected: !0
43
44
  }
44
45
  });
45
- s.push(t);
46
- }), r.subDistricts.forEach((i) => {
46
+ a.push(t);
47
+ }), s.subDistricts.forEach((i) => {
47
48
  i.signals.forEach((t) => {
48
- const n = new d({
49
+ const n = new u({
49
50
  geometry: {
50
51
  type: "point",
51
52
  longitude: t.longitude,
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: s.id,
62
+ districtName: s.name,
62
63
  subDistrictId: i.id,
63
64
  subDistrictName: i.name,
64
65
  isKey: t.isKey,
@@ -66,15 +67,15 @@ class f {
66
67
  selected: !0
67
68
  }
68
69
  });
69
- s.push(n);
70
+ a.push(n);
70
71
  });
71
72
  });
72
73
  }), await this.signalMarkerLayer.applyEdits({
73
- addFeatures: s
74
+ addFeatures: a
74
75
  }), await this.signalPictureLayer.applyEdits({
75
- addFeatures: s
76
+ addFeatures: a
76
77
  }), await this.signalClusterLayer.applyEdits({
77
- addFeatures: s
78
+ addFeatures: a
78
79
  });
79
80
  }
80
81
  async clearSignals() {
@@ -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 = "", a = "";
102
+ const s = 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 = s;
110
+ return { districtId: r, subDistrictId: a, count: t };
112
111
  }
113
- filter(e, a) {
114
- const s = `${e === "district" ? "districtId" : "subDistrictId"} = '${a}'`;
112
+ filter(e) {
113
+ const { id: r, type: a } = e, s = `${a === "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
  };
@@ -1,15 +1,18 @@
1
- import { IResult, IRoadLine } from '../../../types';
1
+ import { IDistrictRoad, IFindSignalControlAreaParams, IResult } 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
- roadLines: IRoadLine[];
10
- constructor(view: __esri.MapView | __esri.SceneView, hasGpu: boolean);
8
+ roadConnections: IDistrictRoad[];
9
+ constructor(view: __esri.MapView | __esri.SceneView);
11
10
  showSubDistricts(controllers: DistrictController[]): Promise<void>;
12
- showRoads(districtId: string): Promise<void>;
11
+ /**
12
+ * 显示区控下的所有子区,用道路线表示
13
+ * @param id 区控ID
14
+ */
15
+ showRoads(params: IFindSignalControlAreaParams): Promise<void>;
13
16
  clearSubDistricts(): Promise<void>;
14
17
  setVisible(visible: boolean): void;
15
18
  /**
@@ -31,12 +34,16 @@ export default class SubDistrictRenderer {
31
34
  * @param type 类型,district 或 subDistrict
32
35
  * @param id
33
36
  */
34
- filter(type: string, id: string): void;
37
+ filter(param: IFindSignalControlAreaParams): void;
35
38
  /**
36
39
  * 重置过滤器,显示所有子区
37
40
  */
38
41
  resetFilter(): void;
39
42
  private currentPointRenderer;
40
43
  private currentLineRenderer;
44
+ /**
45
+ * 监听地图点击事件,进行子区高亮
46
+ * @param event
47
+ */
41
48
  private viewHitTest;
42
49
  }