gisviewer-vue3-arcgis 1.0.270 → 1.0.272

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.
@@ -1,14 +1,14 @@
1
- import { Point as L, Polyline as l } from "@arcgis/core/geometry";
1
+ import { Point as d, Polyline as l } from "@arcgis/core/geometry";
2
2
  import * as u from "@arcgis/core/geometry/geometryEngineAsync";
3
3
  import * as y from "@arcgis/core/geometry/support/webMercatorUtils";
4
4
  import h from "@turf/bearing";
5
5
  import p from "@turf/destination";
6
6
  import * as f from "@turf/helpers";
7
- import d from "@turf/length";
7
+ import L from "@turf/length";
8
8
  import O from "@turf/line-slice-along";
9
9
  import w from "pako";
10
10
  import P from "proj4";
11
- class s {
11
+ class o {
12
12
  /**
13
13
  * 得到某个点在一定方向、距离之外的另一个点
14
14
  * @param point
@@ -20,7 +20,7 @@ class s {
20
20
  const r = f.point([t.x, t.y]), i = p(r, n, e, {
21
21
  units: "meters"
22
22
  });
23
- return new L({
23
+ return new d({
24
24
  x: i.geometry.coordinates[0],
25
25
  y: i.geometry.coordinates[1]
26
26
  });
@@ -42,12 +42,12 @@ class s {
42
42
  static extendLineInTowDir(t, e) {
43
43
  const n = t.paths[0], r = f.point(n[0]), i = f.point(n[1]), a = h(i, r), c = p(r, e, a, {
44
44
  units: "meters"
45
- }), g = a > 0 ? a - 180 : a + 180, o = p(i, e, g, {
45
+ }), g = a > 0 ? a - 180 : a + 180, s = p(i, e, g, {
46
46
  units: "meters"
47
47
  });
48
48
  return new l({
49
49
  paths: [
50
- [c.geometry.coordinates, o.geometry.coordinates]
50
+ [c.geometry.coordinates, s.geometry.coordinates]
51
51
  ]
52
52
  });
53
53
  }
@@ -73,19 +73,19 @@ class s {
73
73
  * @returns
74
74
  */
75
75
  static async getIntersectPointsOfStopLineAndLane(t, e, n) {
76
- let r = await s.getIntersectPointOfLineAndPolygon(
76
+ let r = await o.getIntersectPointOfLineAndPolygon(
77
77
  t,
78
78
  e
79
79
  );
80
- if (await s.pointDistance(r) < 3 && n) {
80
+ if (await o.pointDistance(r) < 3 && n) {
81
81
  for (const i of n)
82
- if (r = await s.getIntersectPointOfLineAndPolygon(
82
+ if (r = await o.getIntersectPointOfLineAndPolygon(
83
83
  t,
84
84
  e,
85
85
  i
86
- ), await s.pointDistance(r) > 2.5) {
86
+ ), await o.pointDistance(r) > 2.5) {
87
87
  const a = new l({ paths: [r] });
88
- return (await s.getOffsetLine(
88
+ return (await o.getOffsetLine(
89
89
  a,
90
90
  -i
91
91
  )).paths[0];
@@ -113,7 +113,7 @@ class s {
113
113
  * @returns 线面交线的头尾端点
114
114
  */
115
115
  static async getIntersectPointOfLineAndPolygon(t, e, n = 0) {
116
- n !== 0 && (t = await s.getOffsetLine(t, n));
116
+ n !== 0 && (t = await o.getOffsetLine(t, n));
117
117
  const r = await u.intersect(t, e);
118
118
  if (r instanceof l) {
119
119
  const i = r.paths[0], a = i[0], c = i[i.length - 1];
@@ -164,7 +164,7 @@ class s {
164
164
  }
165
165
  static getStdMapEntries(t) {
166
166
  const e = [];
167
- for (const n of s.getStdMapKeys(t))
167
+ for (const n of o.getStdMapKeys(t))
168
168
  e.push([n, t.get(n)]);
169
169
  return e;
170
170
  }
@@ -175,7 +175,7 @@ class s {
175
175
  return r.delete(), e && t.delete(), n;
176
176
  }
177
177
  static setGeoData(t, e, n) {
178
- s.geoReference = t, s.xOffset = e, s.yOffset = n;
178
+ o.geoReference = t, o.xOffset = e, o.yOffset = n;
179
179
  }
180
180
  /**
181
181
  * OpenDrive坐标转换为WGS84坐标
@@ -185,28 +185,28 @@ class s {
185
185
  static transformLineProjection(t) {
186
186
  try {
187
187
  return t.map(
188
- (e) => P(s.geoReference).inverse([
189
- e[0] - s.xOffset,
190
- e[1] - s.yOffset
188
+ (e) => P(o.geoReference).inverse([
189
+ e[0] - o.xOffset,
190
+ e[1] - o.yOffset
191
191
  ])
192
192
  );
193
193
  } catch {
194
194
  return console.error(
195
195
  "OpenDrive坐标转换为WGS84坐标失败",
196
- s.geoReference
196
+ o.geoReference
197
197
  ), t;
198
198
  }
199
199
  }
200
200
  static transformPointProjection(t) {
201
201
  try {
202
- return P(s.geoReference).inverse([
203
- t[0] - s.xOffset,
204
- t[1] - s.yOffset
202
+ return P(o.geoReference).inverse([
203
+ t[0] - o.xOffset,
204
+ t[1] - o.yOffset
205
205
  ]);
206
206
  } catch {
207
207
  return console.error(
208
208
  "OpenDrive坐标转换为WGS84坐标失败",
209
- s.geoReference
209
+ o.geoReference
210
210
  ), t;
211
211
  }
212
212
  }
@@ -226,7 +226,7 @@ class s {
226
226
  * @returns
227
227
  */
228
228
  static getCenterPointInLine(t) {
229
- const e = f.lineString(t), n = d(e, { units: "meters" }) / 2, r = O(e, 0, n, {
229
+ const e = f.lineString(t), n = L(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];
@@ -236,12 +236,12 @@ class s {
236
236
  const i = localStorage.getItem("gpu") !== "Unknown";
237
237
  if (!n) {
238
238
  if (e.length > 0) {
239
- const g = e.map((o) => o.geometry).filter((o) => o);
239
+ const g = e.map((s) => s.geometry).filter((s) => s);
240
240
  if (g.length > 0) {
241
- const o = (a = await u.union(g)) == null ? void 0 : a.extent;
242
- o && (i ? await t.goTo(o.center, {
241
+ let s = (a = await u.union(g)) == null ? void 0 : a.extent;
242
+ s && (s = s.expand(1.3), i ? await t.goTo(s.center, {
243
243
  duration: 1e3
244
- }) : t.center = o.center);
244
+ }) : t.center = s.center);
245
245
  }
246
246
  }
247
247
  return;
@@ -251,14 +251,14 @@ class s {
251
251
  duration: 1e3
252
252
  });
253
253
  else if (e.length > 0) {
254
- const g = e.map((o) => o.geometry).filter((o) => o);
254
+ const g = e.map((s) => s.geometry).filter((s) => s);
255
255
  if (g.length > 0) {
256
- const o = (c = await u.union(g)) == null ? void 0 : c.extent;
257
- o && (t.extent = o);
256
+ let s = (c = await u.union(g)) == null ? void 0 : c.extent;
257
+ s && (s = s.expand(1.3), t.extent = s);
258
258
  }
259
259
  }
260
260
  }
261
261
  }
262
262
  export {
263
- s as default
263
+ o as default
264
264
  };
@@ -412,9 +412,9 @@ class C {
412
412
  type: "simple-marker",
413
413
  style: "circle",
414
414
  size: this.view.scale > this.largeMarkerScale ? 3 : 6,
415
- outline: { width: 0 }
415
+ outline: { width: 1 }
416
416
  };
417
- return ((s = e.brand) == null ? void 0 : s.toLowerCase()) === "scats" ? (e.isOnline ? t.color = [104, 203, 188] : t.color = [120, 131, 81], t.outline.color = [104, 203, 188]) : (e.isOnline ? t.color = [201, 226, 73] : t.color = [120, 131, 81], t.outline.color = [201, 226, 73]), t;
417
+ return ((s = e.brand) == null ? void 0 : s.toLowerCase()) === "scats" ? (e.isOnline ? t.color = [68, 203, 188] : t.color = [200, 200, 200], t.outline.color = [32, 97, 90]) : (e.isOnline ? t.color = [129, 226, 73] : t.color = [200, 200, 200], t.outline.color = [65, 115, 37]), t;
418
418
  }
419
419
  }
420
420
  }
@@ -1,13 +1,13 @@
1
1
  import m from "@arcgis/core/Graphic";
2
- import v from "@arcgis/core/layers/FeatureLayer";
2
+ import w from "@arcgis/core/layers/FeatureLayer";
3
3
  import D from "../common-utils.mjs";
4
- import { subDistrictPointLayerOptions as I, subDistrictLineLayerOptions as z } from "./layer-symbol.mjs";
5
- class C {
4
+ import { subDistrictPointLayerOptions as I, subDistrictLineLayerOptions as P } from "./layer-symbol.mjs";
5
+ class R {
6
6
  constructor(i) {
7
- this.roadConnections = [], this.view = i, this.subDistrictPointLayer = new v(
7
+ this.roadConnections = [], this.view = i, this.subDistrictPointLayer = new w(
8
8
  I
9
- ), this.subDistrictPointLayer.spatialReference = i.spatialReference, this.subDistrictPointLayer.popupEnabled = !0, this.subDistrictLineLayer = new v(
10
- z
9
+ ), this.subDistrictPointLayer.spatialReference = i.spatialReference, this.subDistrictPointLayer.popupEnabled = !0, this.subDistrictLineLayer = new w(
10
+ P
11
11
  ), this.subDistrictLineLayer.spatialReference = i.spatialReference, this.subDistrictLineLayer.popupEnabled = !0, this.view.map.addMany([
12
12
  this.subDistrictLineLayer,
13
13
  this.subDistrictPointLayer
@@ -17,22 +17,22 @@ class C {
17
17
  var a;
18
18
  await this.clearSubDistricts(), (a = this.clickHandler) == null || a.remove(), this.clickHandler = this.view.on("click", this.viewHitTest.bind(this));
19
19
  let s = 0;
20
- const e = [], r = [];
21
- i.forEach((t) => {
22
- t.roadConnections.length > 0 && this.roadConnections.push(...t.roadConnections), r.push({
23
- value: t.id,
24
- label: t.name,
20
+ const t = [], r = [];
21
+ i.forEach((e) => {
22
+ e.roadConnections.length > 0 && this.roadConnections.push(...e.roadConnections), r.push({
23
+ value: e.id,
24
+ label: e.name,
25
25
  symbol: {
26
26
  type: "simple-marker",
27
27
  style: "circle",
28
- color: [...t.areaColor, 0.8],
28
+ color: [...e.areaColor, 0.8],
29
29
  size: "8px",
30
30
  outline: {
31
- color: [...t.areaColor],
31
+ color: [...e.areaColor],
32
32
  width: 4
33
33
  }
34
34
  }
35
- }), t.signals.forEach((n) => {
35
+ }), e.signals.forEach((n) => {
36
36
  const d = new m({
37
37
  geometry: {
38
38
  type: "point",
@@ -43,16 +43,16 @@ class C {
43
43
  ObjectID: s++,
44
44
  id: n.nodeId,
45
45
  name: n.name,
46
- subDistrictId: t.id,
47
- subDistrictName: t.name,
48
- districtId: t.parentId,
49
- districtName: t.parentName,
50
- signalCount: t.signalCount,
51
- color: t.areaColor.join(","),
46
+ subDistrictId: e.id,
47
+ subDistrictName: e.name,
48
+ districtId: e.parentId,
49
+ districtName: e.parentName,
50
+ signalCount: e.signalCount,
51
+ color: e.areaColor.join(","),
52
52
  type: "subDistrict"
53
53
  }
54
54
  });
55
- e.push(d);
55
+ t.push(d);
56
56
  });
57
57
  }), this.subDistrictPointLayer.renderer = {
58
58
  type: "unique-value",
@@ -97,118 +97,124 @@ class C {
97
97
  }
98
98
  ]
99
99
  }, this.currentPointRenderer = this.subDistrictPointLayer.renderer.clone(), await this.subDistrictPointLayer.applyEdits({
100
- addFeatures: e
101
- }), await D.viewGoto(this.view, e);
100
+ addFeatures: t
101
+ }), await D.viewGoto(this.view, t);
102
102
  }
103
103
  /**
104
104
  * 显示区控下的所有子区,用道路线表示
105
105
  * @param id 区控ID
106
106
  */
107
107
  async showRoads(i) {
108
- const { type: s, id: e } = i, r = this.subDistrictPointLayer.createQuery(), a = s === "district" ? "districtId" : "subDistrictId";
109
- e !== "" ? r.where = `${a} = '${e}'` : r.where = "1=1";
110
- const t = await this.subDistrictPointLayer.queryFeatures(
108
+ const { type: s, id: t } = i, r = this.subDistrictPointLayer.createQuery(), a = s === "district" ? "districtId" : "subDistrictId";
109
+ t !== "" ? r.where = `${a} = '${t}'` : r.where = "1=1";
110
+ const e = await this.subDistrictPointLayer.queryFeatures(
111
111
  r
112
112
  ), n = /* @__PURE__ */ new Map();
113
- t.features.forEach((u) => {
113
+ e.features.forEach((o) => {
114
114
  var b;
115
115
  const {
116
- subDistrictId: o,
116
+ subDistrictId: u,
117
117
  color: c,
118
- id: p,
119
- districtName: h,
120
- subDistrictName: L,
118
+ id: h,
119
+ districtName: p,
120
+ subDistrictName: f,
121
121
  signalCount: y
122
- } = u.attributes;
123
- n.has(o) || n.set(o, {
122
+ } = o.attributes;
123
+ n.has(u) || n.set(u, {
124
124
  color: c,
125
125
  signalIds: [],
126
- districtName: h,
127
- subDistrictName: L,
126
+ districtName: p,
127
+ subDistrictName: f,
128
128
  signalCount: y
129
- }), (b = n.get(o)) == null || b.signalIds.push(p);
129
+ }), (b = n.get(u)) == null || b.signalIds.push(h);
130
130
  });
131
- const d = [], f = [];
132
- for (const u of n) {
133
- let o = 0;
134
- const c = u[0];
131
+ const d = [], L = [];
132
+ for (const o of n) {
133
+ let u = 0;
134
+ const c = o[0];
135
135
  d.push({
136
136
  value: c,
137
137
  symbol: {
138
138
  type: "simple-line",
139
- color: u[1].color.split(",").map(Number),
139
+ color: o[1].color.split(",").map(Number),
140
140
  width: 2,
141
141
  style: "solid"
142
142
  }
143
143
  });
144
- const { districtName: p, subDistrictName: h, signalIds: L, signalCount: y } = u[1];
144
+ const { districtName: h, subDistrictName: p, signalIds: f, signalCount: y } = o[1];
145
145
  this.roadConnections.filter(
146
146
  (l) => l.subDistrictId === c
147
147
  ).forEach((l) => {
148
- const w = new m({
148
+ const v = new m({
149
149
  geometry: {
150
150
  type: "polyline",
151
151
  paths: l.coordinates
152
152
  },
153
153
  attributes: {
154
- ObjectID: o++,
154
+ ObjectID: u++,
155
155
  id: l.id,
156
156
  districtId: l.districtId,
157
157
  subDistrictId: c,
158
- subDistrictName: h,
159
- districtName: p,
158
+ subDistrictName: p,
159
+ districtName: h,
160
160
  signalCount: y,
161
- color: u[1].color
161
+ color: o[1].color
162
162
  }
163
163
  });
164
- f.push(w);
164
+ L.push(v);
165
165
  });
166
166
  }
167
167
  this.subDistrictLineLayer.renderer = {
168
- type: "unique-value",
169
- field: "subDistrictId",
170
- defaultSymbol: {
168
+ type: "simple",
169
+ symbol: {
171
170
  type: "simple-line",
172
- color: [180, 180, 180, 0.5],
173
- width: 2,
174
- style: "solid"
175
- },
176
- defaultLabel: "其他子区",
177
- uniqueValueInfos: d,
178
- visualVariables: [
179
- {
180
- type: "size",
181
- valueExpression: "$view.scale",
182
- stops: [
183
- {
184
- size: 6,
185
- value: 2500
186
- },
187
- {
188
- size: 5,
189
- value: 5e3
190
- },
191
- {
192
- size: 4,
193
- value: 18055.954822000003
194
- },
195
- {
196
- size: 3,
197
- value: 144447.638572
198
- },
199
- {
200
- size: 2,
201
- value: 1155581108577e-6
202
- }
203
- ]
204
- }
205
- ]
171
+ color: [23, 151, 255],
172
+ width: 2
173
+ }
174
+ // type: 'unique-value',
175
+ // field: 'subDistrictId',
176
+ // defaultSymbol: {
177
+ // type: 'simple-line',
178
+ // color: [180, 180, 180, 0.5],
179
+ // width: 2,
180
+ // style: 'solid'
181
+ // },
182
+ // defaultLabel: '其他子区',
183
+ // uniqueValueInfos,
184
+ // visualVariables: [
185
+ // {
186
+ // type: 'size',
187
+ // valueExpression: '$view.scale',
188
+ // stops: [
189
+ // {
190
+ // size: 6,
191
+ // value: 2500
192
+ // },
193
+ // {
194
+ // size: 5,
195
+ // value: 5000
196
+ // },
197
+ // {
198
+ // size: 4,
199
+ // value: 18055.954822000003
200
+ // },
201
+ // {
202
+ // size: 3,
203
+ // value: 144447.638572
204
+ // },
205
+ // {
206
+ // size: 2,
207
+ // value: 1155581.108577
208
+ // }
209
+ // ]
210
+ // }
211
+ // ]
206
212
  }, this.currentLineRenderer = this.subDistrictLineLayer.renderer.clone(), await this.subDistrictLineLayer.applyEdits({
207
- addFeatures: f
213
+ addFeatures: L
208
214
  });
209
215
  }
210
216
  async clearSubDistricts() {
211
- var e;
217
+ var t;
212
218
  const i = await this.subDistrictPointLayer.queryFeatures();
213
219
  i.features.length > 0 && await this.subDistrictPointLayer.applyEdits({
214
220
  deleteFeatures: i.features
@@ -216,7 +222,7 @@ class C {
216
222
  const s = await this.subDistrictLineLayer.queryFeatures();
217
223
  s.features.length > 0 && await this.subDistrictLineLayer.applyEdits({
218
224
  deleteFeatures: s.features
219
- }), this.subDistrictLineLayer.definitionExpression = "1=1", this.roadConnections = [], (e = this.clickHandler) == null || e.remove();
225
+ }), this.subDistrictLineLayer.definitionExpression = "1=1", this.roadConnections = [], (t = this.clickHandler) == null || t.remove();
220
226
  }
221
227
  setVisible(i) {
222
228
  this.showRoads({ type: "district", id: "" }), this.subDistrictPointLayer.visible = i, this.subDistrictLineLayer.visible = i;
@@ -228,8 +234,8 @@ class C {
228
234
  async locateSubDistrict(i) {
229
235
  const s = this.subDistrictPointLayer.createQuery();
230
236
  s.where = `subDistrictId = '${i}'`, s.returnGeometry = !0;
231
- const e = await this.subDistrictPointLayer.queryFeatures(s);
232
- return e.features.length > 0 ? (await D.viewGoto(this.view, e.features, !1), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
237
+ const t = await this.subDistrictPointLayer.queryFeatures(s);
238
+ return t.features.length > 0 ? (await D.viewGoto(this.view, t.features, !1), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
233
239
  }
234
240
  /**
235
241
  * 高亮子区, 其他子区隐藏
@@ -238,14 +244,14 @@ class C {
238
244
  */
239
245
  async highlightSubDistrict(i) {
240
246
  let s = "";
241
- const e = this.subDistrictPointLayer.definitionExpression;
247
+ const t = this.subDistrictPointLayer.definitionExpression;
242
248
  this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${i.id}'`;
243
249
  const r = await this.subDistrictPointLayer.queryFeatures(), a = r.features.length;
244
250
  return a > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${i.id}'`, s = r.features[0].attributes.districtId, await D.viewGoto(
245
251
  this.view,
246
252
  r.features,
247
253
  i.needZoom !== !1
248
- )) : this.subDistrictPointLayer.definitionExpression = e, { count: a, parentId: s };
254
+ )) : this.subDistrictPointLayer.definitionExpression = t, { count: a, parentId: s };
249
255
  }
250
256
  /**
251
257
  * 按照区控、子区id显示子区
@@ -253,7 +259,7 @@ class C {
253
259
  * @param id
254
260
  */
255
261
  filter(i) {
256
- const { type: s, id: e } = i, r = `${s === "district" ? "districtId" : "subDistrictId"} = '${e}'`;
262
+ const { type: s, id: t } = i, r = `${s === "district" ? "districtId" : "subDistrictId"} = '${t}'`;
257
263
  this.subDistrictPointLayer.definitionExpression = r, this.subDistrictLineLayer.definitionExpression = r;
258
264
  }
259
265
  /**
@@ -268,15 +274,15 @@ class C {
268
274
  */
269
275
  async viewHitTest(i) {
270
276
  var r;
271
- const e = (r = (await this.view.hitTest(i, {
277
+ const t = (r = (await this.view.hitTest(i, {
272
278
  include: [this.subDistrictPointLayer, this.subDistrictLineLayer]
273
279
  })).results) == null ? void 0 : r.filter(
274
280
  (a) => a.type === "graphic"
275
281
  );
276
- if (e.length === 0)
282
+ if (t.length === 0)
277
283
  console.time("resetRenderer"), this.subDistrictPointLayer.renderer = this.currentPointRenderer, this.subDistrictLineLayer.renderer = this.currentLineRenderer;
278
284
  else {
279
- const a = e[0].graphic, t = a.attributes.color.split(",").map(Number);
285
+ const a = t[0].graphic, e = a.attributes.color.split(",").map(Number);
280
286
  this.subDistrictPointLayer.renderer = {
281
287
  type: "unique-value",
282
288
  field: "subDistrictId",
@@ -297,10 +303,10 @@ class C {
297
303
  symbol: {
298
304
  type: "simple-marker",
299
305
  style: "circle",
300
- color: [...t, 0.8],
306
+ color: [...e, 0.8],
301
307
  size: "8px",
302
308
  outline: {
303
- color: t,
309
+ color: e,
304
310
  width: 4
305
311
  }
306
312
  }
@@ -388,5 +394,5 @@ class C {
388
394
  }
389
395
  }
390
396
  export {
391
- C as default
397
+ R as default
392
398
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),h=require("@turf/bearing"),y=require("@turf/destination"),b=require("@turf/helpers"),S=require("@turf/length"),x=require("@turf/line-slice-along"),A=require("pako"),d=require("proj4");function P(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const g=P(L),O=P(w),f=P(b);class s{static destinationWithPoint(e,t,n){const r=f.point([e.x,e.y]),i=y(r,n,t,{units:"meters"});return new p.Point({x:i.geometry.coordinates[0],y:i.geometry.coordinates[1]})}static angleOfLine(e){const t=e.paths[0],n=f.point(t[0]),r=f.point(t[t.length-1]);return h(n,r)}static extendLineInTowDir(e,t){const n=e.paths[0],r=f.point(n[0]),i=f.point(n[1]),c=h(i,r),a=y(r,t,c,{units:"meters"}),u=c>0?c-180:c+180,o=y(i,t,u,{units:"meters"});return new p.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 s.getIntersectPointOfLineAndPolygon(e,t);if(await s.pointDistance(r)<3&&n){for(const i of n)if(r=await s.getIntersectPointOfLineAndPolygon(e,t,i),await s.pointDistance(r)>2.5){const c=new p.Polyline({paths:[r]});return(await s.getOffsetLine(c,-i)).paths[0]}}else return r;return[]}static async pointDistance(e){if(e.length<2)return 0;const t=new p.Polyline({paths:[e]});return await g.geodesicLength(t,"meters")}static async getIntersectPointOfLineAndPolygon(e,t,n=0){n!==0&&(e=await s.getOffsetLine(e,n));const r=await g.intersect(e,t);if(r instanceof p.Polyline){const i=r.paths[0],c=i[0],a=i[i.length-1];return[c,a]}return[]}static async getOffsetLine(e,t){const n=O.geographicToWebMercator(e),r=await g.offset(n,t,"meters");return O.webMercatorToGeographic(r,!1)}static unzip(e){try{const t=[],n=e.split("");for(let i=0;i<n.length;i++){const c=n[i];t.push(c.charCodeAt(0))}const r=new Uint8Array(t);return A.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 s.getStdMapKeys(e))t.push([n,e.get(n)]);return t}static getStdMapKeys(e,t=!1){const n=[],r=e.keys();for(let i=0;i<r.size();i++)n.push(r.get(i));return r.delete(),t&&e.delete(),n}static setGeoData(e,t,n){s.geoReference=e,s.xOffset=t,s.yOffset=n}static transformLineProjection(e){try{return e.map(t=>d(s.geoReference).inverse([t[0]-s.xOffset,t[1]-s.yOffset]))}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",s.geoReference),e}}static transformPointProjection(e){try{return d(s.geoReference).inverse([e[0]-s.xOffset,e[1]-s.yOffset])}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",s.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=f.point(e),i=f.point(t),c=h(r,i);return y(i,n,c,{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=f.lineString(e),n=S(t,{units:"meters"})/2,r=x(t,0,n,{units:"meters"});return r.geometry.coordinates[r.geometry.coordinates.length-1]}static async viewGoto(e,t,n=!0){var c,a;const i=localStorage.getItem("gpu")!=="Unknown";if(!n){if(t.length>0){const u=t.map(o=>o.geometry).filter(o=>o);if(u.length>0){const o=(c=await g.union(u))==null?void 0:c.extent;o&&(i?await e.goTo(o.center,{duration:1e3}):e.center=o.center)}}return}if(i)await e.goTo(t,{duration:1e3});else if(t.length>0){const u=t.map(o=>o.geometry).filter(o=>o);if(u.length>0){const o=(a=await g.union(u))==null?void 0:a.extent;o&&(e.extent=o)}}}}exports.default=s;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),h=require("@turf/bearing"),y=require("@turf/destination"),b=require("@turf/helpers"),S=require("@turf/length"),x=require("@turf/line-slice-along"),A=require("pako"),P=require("proj4");function d(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const g=d(L),O=d(w),f=d(b);class o{static destinationWithPoint(e,t,n){const r=f.point([e.x,e.y]),i=y(r,n,t,{units:"meters"});return new p.Point({x:i.geometry.coordinates[0],y:i.geometry.coordinates[1]})}static angleOfLine(e){const t=e.paths[0],n=f.point(t[0]),r=f.point(t[t.length-1]);return h(n,r)}static extendLineInTowDir(e,t){const n=e.paths[0],r=f.point(n[0]),i=f.point(n[1]),a=h(i,r),c=y(r,t,a,{units:"meters"}),u=a>0?a-180:a+180,s=y(i,t,u,{units:"meters"});return new p.Polyline({paths:[[c.geometry.coordinates,s.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 o.getIntersectPointOfLineAndPolygon(e,t);if(await o.pointDistance(r)<3&&n){for(const i of n)if(r=await o.getIntersectPointOfLineAndPolygon(e,t,i),await o.pointDistance(r)>2.5){const a=new p.Polyline({paths:[r]});return(await o.getOffsetLine(a,-i)).paths[0]}}else return r;return[]}static async pointDistance(e){if(e.length<2)return 0;const t=new p.Polyline({paths:[e]});return await g.geodesicLength(t,"meters")}static async getIntersectPointOfLineAndPolygon(e,t,n=0){n!==0&&(e=await o.getOffsetLine(e,n));const r=await g.intersect(e,t);if(r instanceof p.Polyline){const i=r.paths[0],a=i[0],c=i[i.length-1];return[a,c]}return[]}static async getOffsetLine(e,t){const n=O.geographicToWebMercator(e),r=await g.offset(n,t,"meters");return O.webMercatorToGeographic(r,!1)}static unzip(e){try{const t=[],n=e.split("");for(let i=0;i<n.length;i++){const a=n[i];t.push(a.charCodeAt(0))}const r=new Uint8Array(t);return A.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 o.getStdMapKeys(e))t.push([n,e.get(n)]);return t}static getStdMapKeys(e,t=!1){const n=[],r=e.keys();for(let i=0;i<r.size();i++)n.push(r.get(i));return r.delete(),t&&e.delete(),n}static setGeoData(e,t,n){o.geoReference=e,o.xOffset=t,o.yOffset=n}static transformLineProjection(e){try{return e.map(t=>P(o.geoReference).inverse([t[0]-o.xOffset,t[1]-o.yOffset]))}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",o.geoReference),e}}static transformPointProjection(e){try{return P(o.geoReference).inverse([e[0]-o.xOffset,e[1]-o.yOffset])}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",o.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=f.point(e),i=f.point(t),a=h(r,i);return y(i,n,a,{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=f.lineString(e),n=S(t,{units:"meters"})/2,r=x(t,0,n,{units:"meters"});return r.geometry.coordinates[r.geometry.coordinates.length-1]}static async viewGoto(e,t,n=!0){var a,c;const i=localStorage.getItem("gpu")!=="Unknown";if(!n){if(t.length>0){const u=t.map(s=>s.geometry).filter(s=>s);if(u.length>0){let s=(a=await g.union(u))==null?void 0:a.extent;s&&(s=s.expand(1.3),i?await e.goTo(s.center,{duration:1e3}):e.center=s.center)}}return}if(i)await e.goTo(t,{duration:1e3});else if(t.length>0){const u=t.map(s=>s.geometry).filter(s=>s);if(u.length>0){let s=(c=await g.union(u))==null?void 0:c.extent;s&&(s=s.expand(1.3),e.extent=s)}}}}exports.default=o;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class S{constructor(e){this.iconSymbolScale=1e4,this.largeMarkerScale=4e4,this.oldScale=0,this.showName="detail",this.showStyle="scatter",this.clusterRadius=120,this.minClusterPoints=2,this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusteredLocations=[],this.locations=[],this.view=e,this.crossLayer=new p({id:"signal-control-cross-layer",title:"信控路口图层"}),this.view.map.add(this.crossLayer)}didCrossScaleThreshold(e,s,t){return e<t&&s>=t||e>=t&&s<t}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(e=>{const s=this.view.toScreen(new u.Point({x:e.x,y:e.y}));s.x>0&&s.y>0&&(e.properties.screenX=s.x,e.properties.screenY=s.y,e.visited=!1,e.clusterId=void 0,this.clusteredLocations.push(e))})}showSignalCross(e){if(this.crossLayer.removeAll(),this.showName=e.showName||"detail",this.showStyle=e.style||"scatter",this.oldScale=this.view.scale,this.scaleWatchHandle||(this.scaleWatchHandle=this.view.watch("stationary",()=>{if(this.showStyle==="scatter"){const s=this.view.scale,t=this.didCrossScaleThreshold(this.oldScale,s,this.iconSymbolScale),i=this.didCrossScaleThreshold(this.oldScale,s,this.largeMarkerScale);(t||i)&&this.updateScatterSymbol(),this.oldScale=s}else{this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}})),this.showStyle==="scatter"){const s=e.points.map(t=>{const i=this.getCrossSymbol(t),r=this.getBrandLabel(t.brand),o=this.getOnlineLabel(t.isOnline),n=this.getMalfunctionLabel(t.isMalfunction);return new y({geometry:{type:"point",longitude:t.x,latitude:t.y},symbol:i,attributes:{type:"signal-cross",id:t.crossId,brandLabel:r,isOnlineLabel:o,isMalfunctionLabel:n,...t}})});this.crossLayer.addMany(s)}else{this.locations=e.points.map(t=>({id:t.crossId,x:t.x,y:t.y,visited:!1,clusterId:void 0,properties:t})),this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}return{status:0,message:"ok"}}clearSignalCross(){var e;this.crossLayer.removeAll(),(e=this.scaleWatchHandle)==null||e.remove(),this.scaleWatchHandle=null}changeShowName(e){this.showName=e,this.showStyle==="scatter"&&this.updateScatterSymbol()}updateScatterSymbol(){this.crossLayer.graphics.forEach(e=>{e.symbol=this.getCrossSymbol(e.attributes)})}doPixelCluster(e){let s=0;for(let t=0;t<this.clusteredLocations.length;t++){const i=this.clusteredLocations[t];if(i.visited)continue;i.visited=!0;const r=this.getNeighbors(i,e);r.length<this.minClusterPoints?i.clusterId=-1:(r.forEach(o=>{o.visited=!0,o.clusterId=s}),i.clusterId=s,s++)}return this.createClusters()}getNeighbors(e,s){return this.clusteredLocations.filter(t=>t.id===e.id||t.visited?!1:this.getDistance(e,t)<=s)}getDistance(e,s){return Math.sqrt(Math.pow(e.properties.screenX-s.properties.screenX,2)+Math.pow(e.properties.screenY-s.properties.screenY,2))}createClusters(){const e={},s=[];for(const i of this.clusteredLocations)i.clusterId===void 0||i.clusterId===-1?s.push(i):(e[i.clusterId]||(e[i.clusterId]=[]),e[i.clusterId].push(i));const t=Object.keys(e).map((i,r)=>{const o=e[Number(i)],n=o.length,l=o.reduce((c,h)=>c+h.x,0),a=o.reduce((c,h)=>c+h.y,0),m=l/n,d=a/n;return{id:Number(i),items:o,count:n,center:{x:m,y:d}}});return s.length>0&&t.push({id:-1,items:s,count:s.length,center:null}),t}showClusterResult(e){this.crossLayer.removeAll();let s=Number.MIN_VALUE,t=Number.MAX_VALUE;e.forEach(i=>{i.count>1&&(t=Math.min(t,i.count),s=Math.max(s,i.count))}),e.forEach(i=>{if(i.id!==-1){let r=t===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(i.count-t)/(s-t)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const l=(i.count.toString().length*8+6)/2,a=new y({geometry:new u.Point({x:i.center.x,y:i.center.y}),attributes:{count:i.count},symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:r,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-l,40],[l,40],[l,20],[-l,20],[-l,40]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[2,72,200,255]},{type:"CIMSolidStroke",enable:!0,width:5,color:[2,72,200,128]}]}},{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}});this.crossLayer.add(a)}else i.items.forEach(r=>{const o=new y({geometry:new u.Point({x:r.x,y:r.y}),attributes:{...r,...r.properties,type:"signal-cross",id:r.id},symbol:this.getCrossSymbol(r.properties)});this.crossLayer.add(o)})})}getBrandLabel(e){const s=(e??"").toLowerCase();return s==="scats"?"SCATS":s==="gc"?"国产":e??""}getOnlineLabel(e){return e?"在线":"离线"}getMalfunctionLabel(e){return e?"故障":"正常"}getCrossSymbol(e){var s;if(this.view.scale<=this.iconSymbolScale){let t="/GisViewerAssets/Images/cross/ic_";return t+=e.brand==="scats"?"scats_":"gc_",t+=e.isOnline?"online_":"offline_",t+=e.isMalfunction?"malfunction.png":"normal.png",{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:this.showName==="crossName"?'Replace($feature.name, "与", "/")':this.showName==="signalId"?"$feature.signalId":'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:25,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:20,rotateClockwise:!0,textureFilter:"Picture",url:t}]}}}}else{const t={type:"simple-marker",style:"circle",size:this.view.scale>this.largeMarkerScale?3:6,outline:{width:0}};return((s=e.brand)==null?void 0:s.toLowerCase())==="scats"?(e.isOnline?t.color=[104,203,188]:t.color=[120,131,81],t.outline.color=[104,203,188]):(e.isOnline?t.color=[201,226,73]:t.color=[120,131,81],t.outline.color=[201,226,73]),t}}}exports.default=S;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class S{constructor(e){this.iconSymbolScale=1e4,this.largeMarkerScale=4e4,this.oldScale=0,this.showName="detail",this.showStyle="scatter",this.clusterRadius=120,this.minClusterPoints=2,this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusteredLocations=[],this.locations=[],this.view=e,this.crossLayer=new p({id:"signal-control-cross-layer",title:"信控路口图层"}),this.view.map.add(this.crossLayer)}didCrossScaleThreshold(e,s,t){return e<t&&s>=t||e>=t&&s<t}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(e=>{const s=this.view.toScreen(new u.Point({x:e.x,y:e.y}));s.x>0&&s.y>0&&(e.properties.screenX=s.x,e.properties.screenY=s.y,e.visited=!1,e.clusterId=void 0,this.clusteredLocations.push(e))})}showSignalCross(e){if(this.crossLayer.removeAll(),this.showName=e.showName||"detail",this.showStyle=e.style||"scatter",this.oldScale=this.view.scale,this.scaleWatchHandle||(this.scaleWatchHandle=this.view.watch("stationary",()=>{if(this.showStyle==="scatter"){const s=this.view.scale,t=this.didCrossScaleThreshold(this.oldScale,s,this.iconSymbolScale),i=this.didCrossScaleThreshold(this.oldScale,s,this.largeMarkerScale);(t||i)&&this.updateScatterSymbol(),this.oldScale=s}else{this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}})),this.showStyle==="scatter"){const s=e.points.map(t=>{const i=this.getCrossSymbol(t),r=this.getBrandLabel(t.brand),o=this.getOnlineLabel(t.isOnline),n=this.getMalfunctionLabel(t.isMalfunction);return new y({geometry:{type:"point",longitude:t.x,latitude:t.y},symbol:i,attributes:{type:"signal-cross",id:t.crossId,brandLabel:r,isOnlineLabel:o,isMalfunctionLabel:n,...t}})});this.crossLayer.addMany(s)}else{this.locations=e.points.map(t=>({id:t.crossId,x:t.x,y:t.y,visited:!1,clusterId:void 0,properties:t})),this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}return{status:0,message:"ok"}}clearSignalCross(){var e;this.crossLayer.removeAll(),(e=this.scaleWatchHandle)==null||e.remove(),this.scaleWatchHandle=null}changeShowName(e){this.showName=e,this.showStyle==="scatter"&&this.updateScatterSymbol()}updateScatterSymbol(){this.crossLayer.graphics.forEach(e=>{e.symbol=this.getCrossSymbol(e.attributes)})}doPixelCluster(e){let s=0;for(let t=0;t<this.clusteredLocations.length;t++){const i=this.clusteredLocations[t];if(i.visited)continue;i.visited=!0;const r=this.getNeighbors(i,e);r.length<this.minClusterPoints?i.clusterId=-1:(r.forEach(o=>{o.visited=!0,o.clusterId=s}),i.clusterId=s,s++)}return this.createClusters()}getNeighbors(e,s){return this.clusteredLocations.filter(t=>t.id===e.id||t.visited?!1:this.getDistance(e,t)<=s)}getDistance(e,s){return Math.sqrt(Math.pow(e.properties.screenX-s.properties.screenX,2)+Math.pow(e.properties.screenY-s.properties.screenY,2))}createClusters(){const e={},s=[];for(const i of this.clusteredLocations)i.clusterId===void 0||i.clusterId===-1?s.push(i):(e[i.clusterId]||(e[i.clusterId]=[]),e[i.clusterId].push(i));const t=Object.keys(e).map((i,r)=>{const o=e[Number(i)],n=o.length,l=o.reduce((c,h)=>c+h.x,0),a=o.reduce((c,h)=>c+h.y,0),m=l/n,d=a/n;return{id:Number(i),items:o,count:n,center:{x:m,y:d}}});return s.length>0&&t.push({id:-1,items:s,count:s.length,center:null}),t}showClusterResult(e){this.crossLayer.removeAll();let s=Number.MIN_VALUE,t=Number.MAX_VALUE;e.forEach(i=>{i.count>1&&(t=Math.min(t,i.count),s=Math.max(s,i.count))}),e.forEach(i=>{if(i.id!==-1){let r=t===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(i.count-t)/(s-t)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const l=(i.count.toString().length*8+6)/2,a=new y({geometry:new u.Point({x:i.center.x,y:i.center.y}),attributes:{count:i.count},symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:r,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-l,40],[l,40],[l,20],[-l,20],[-l,40]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[2,72,200,255]},{type:"CIMSolidStroke",enable:!0,width:5,color:[2,72,200,128]}]}},{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}});this.crossLayer.add(a)}else i.items.forEach(r=>{const o=new y({geometry:new u.Point({x:r.x,y:r.y}),attributes:{...r,...r.properties,type:"signal-cross",id:r.id},symbol:this.getCrossSymbol(r.properties)});this.crossLayer.add(o)})})}getBrandLabel(e){const s=(e??"").toLowerCase();return s==="scats"?"SCATS":s==="gc"?"国产":e??""}getOnlineLabel(e){return e?"在线":"离线"}getMalfunctionLabel(e){return e?"故障":"正常"}getCrossSymbol(e){var s;if(this.view.scale<=this.iconSymbolScale){let t="/GisViewerAssets/Images/cross/ic_";return t+=e.brand==="scats"?"scats_":"gc_",t+=e.isOnline?"online_":"offline_",t+=e.isMalfunction?"malfunction.png":"normal.png",{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:this.showName==="crossName"?'Replace($feature.name, "与", "/")':this.showName==="signalId"?"$feature.signalId":'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:25,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:20,rotateClockwise:!0,textureFilter:"Picture",url:t}]}}}}else{const t={type:"simple-marker",style:"circle",size:this.view.scale>this.largeMarkerScale?3:6,outline:{width:1}};return((s=e.brand)==null?void 0:s.toLowerCase())==="scats"?(e.isOnline?t.color=[68,203,188]:t.color=[200,200,200],t.outline.color=[32,97,90]):(e.isOnline?t.color=[129,226,73]:t.color=[200,200,200],t.outline.color=[65,115,37]),t}}}exports.default=S;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("@arcgis/core/Graphic"),m=require("@arcgis/core/layers/FeatureLayer"),D=require("../common-utils.js"),w=require("./layer-symbol.js");class g{constructor(e){this.roadConnections=[],this.view=e,this.subDistrictPointLayer=new m(w.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=e.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new m(w.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=e.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(e){var a;await this.clearSubDistricts(),(a=this.clickHandler)==null||a.remove(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const i=[],r=[];e.forEach(t=>{t.roadConnections.length>0&&this.roadConnections.push(...t.roadConnections),r.push({value:t.id,label:t.name,symbol:{type:"simple-marker",style:"circle",color:[...t.areaColor,.8],size:"8px",outline:{color:[...t.areaColor],width:4}}}),t.signals.forEach(n=>{const d=new v({geometry:{type:"point",longitude:n.longitude,latitude:n.latitude},attributes:{ObjectID:s++,id:n.nodeId,name:n.name,subDistrictId:t.id,subDistrictName:t.name,districtId:t.parentId,districtName:t.parentName,signalCount:t.signalCount,color:t.areaColor.join(","),type:"subDistrict"}});i.push(d)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:[180,180,180,.5],size:"8px",outline:{color:"white",width:1}},defaultLabel:"其他子区",uniqueValueInfos:r,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:i}),await D.default.viewGoto(this.view,i)}async showRoads(e){const{type:s,id:i}=e,r=this.subDistrictPointLayer.createQuery(),a=s==="district"?"districtId":"subDistrictId";i!==""?r.where=`${a} = '${i}'`:r.where="1=1";const t=await this.subDistrictPointLayer.queryFeatures(r),n=new Map;t.features.forEach(u=>{var p;const{subDistrictId:o,color:c,id:h,districtName:y,subDistrictName:L,signalCount:b}=u.attributes;n.has(o)||n.set(o,{color:c,signalIds:[],districtName:y,subDistrictName:L,signalCount:b}),(p=n.get(o))==null||p.signalIds.push(h)});const d=[],f=[];for(const u of n){let o=0;const c=u[0];d.push({value:c,symbol:{type:"simple-line",color:u[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:h,subDistrictName:y,signalIds:L,signalCount:b}=u[1];this.roadConnections.filter(l=>l.subDistrictId===c).forEach(l=>{const I=new v({geometry:{type:"polyline",paths:l.coordinates},attributes:{ObjectID:o++,id:l.id,districtId:l.districtId,subDistrictId:c,subDistrictName:y,districtName:h,signalCount:b,color:u[1].color}});f.push(I)})}this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",color:[180,180,180,.5],width:2,style:"solid"},defaultLabel:"其他子区",uniqueValueInfos:d,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentLineRenderer=this.subDistrictLineLayer.renderer.clone(),await this.subDistrictLineLayer.applyEdits({addFeatures:f})}async clearSubDistricts(){var i;const e=await this.subDistrictPointLayer.queryFeatures();e.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictPointLayer.definitionExpression="1=1";const s=await this.subDistrictLineLayer.queryFeatures();s.features.length>0&&await this.subDistrictLineLayer.applyEdits({deleteFeatures:s.features}),this.subDistrictLineLayer.definitionExpression="1=1",this.roadConnections=[],(i=this.clickHandler)==null||i.remove()}setVisible(e){this.showRoads({type:"district",id:""}),this.subDistrictPointLayer.visible=e,this.subDistrictLineLayer.visible=e}async locateSubDistrict(e){const s=this.subDistrictPointLayer.createQuery();s.where=`subDistrictId = '${e}'`,s.returnGeometry=!0;const i=await this.subDistrictPointLayer.queryFeatures(s);return i.features.length>0?(await D.default.viewGoto(this.view,i.features,!1),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(e){let s="";const i=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${e.id}'`;const r=await this.subDistrictPointLayer.queryFeatures(),a=r.features.length;return a>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${e.id}'`,s=r.features[0].attributes.districtId,await D.default.viewGoto(this.view,r.features,e.needZoom!==!1)):this.subDistrictPointLayer.definitionExpression=i,{count:a,parentId:s}}filter(e){const{type:s,id:i}=e,r=`${s==="district"?"districtId":"subDistrictId"} = '${i}'`;this.subDistrictPointLayer.definitionExpression=r,this.subDistrictLineLayer.definitionExpression=r}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(e){var r;const i=(r=(await this.view.hitTest(e,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(a=>a.type==="graphic");if(i.length===0)console.time("resetRenderer"),this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const a=i[0].graphic,t=a.attributes.color.split(",").map(Number);this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[180,180,180,.5],width:4}},defaultLabel:"其他子区",uniqueValueInfos:[{value:a.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[...t,.8],size:"8px",outline:{color:t,width:4}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",style:"solid",color:[180,180,180,.5],width:"8px"},defaultLabel:"其他子区",uniqueValueInfos:[{value:a.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:a.attributes.color.split(",").map(Number),width:"8px"}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]}}}}exports.default=g;
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"),D=require("../common-utils.js"),v=require("./layer-symbol.js");class g{constructor(i){this.roadConnections=[],this.view=i,this.subDistrictPointLayer=new w(v.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=i.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new w(v.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=i.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(i){var a;await this.clearSubDistricts(),(a=this.clickHandler)==null||a.remove(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const e=[],r=[];i.forEach(t=>{t.roadConnections.length>0&&this.roadConnections.push(...t.roadConnections),r.push({value:t.id,label:t.name,symbol:{type:"simple-marker",style:"circle",color:[...t.areaColor,.8],size:"8px",outline:{color:[...t.areaColor],width:4}}}),t.signals.forEach(n=>{const d=new m({geometry:{type:"point",longitude:n.longitude,latitude:n.latitude},attributes:{ObjectID:s++,id:n.nodeId,name:n.name,subDistrictId:t.id,subDistrictName:t.name,districtId:t.parentId,districtName:t.parentName,signalCount:t.signalCount,color:t.areaColor.join(","),type:"subDistrict"}});e.push(d)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:[180,180,180,.5],size:"8px",outline:{color:"white",width:1}},defaultLabel:"其他子区",uniqueValueInfos:r,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:e}),await D.default.viewGoto(this.view,e)}async showRoads(i){const{type:s,id:e}=i,r=this.subDistrictPointLayer.createQuery(),a=s==="district"?"districtId":"subDistrictId";e!==""?r.where=`${a} = '${e}'`:r.where="1=1";const t=await this.subDistrictPointLayer.queryFeatures(r),n=new Map;t.features.forEach(u=>{var p;const{subDistrictId:o,color:c,id:h,districtName:y,subDistrictName:f,signalCount:b}=u.attributes;n.has(o)||n.set(o,{color:c,signalIds:[],districtName:y,subDistrictName:f,signalCount:b}),(p=n.get(o))==null||p.signalIds.push(h)});const d=[],L=[];for(const u of n){let o=0;const c=u[0];d.push({value:c,symbol:{type:"simple-line",color:u[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:h,subDistrictName:y,signalIds:f,signalCount:b}=u[1];this.roadConnections.filter(l=>l.subDistrictId===c).forEach(l=>{const I=new m({geometry:{type:"polyline",paths:l.coordinates},attributes:{ObjectID:o++,id:l.id,districtId:l.districtId,subDistrictId:c,subDistrictName:y,districtName:h,signalCount:b,color:u[1].color}});L.push(I)})}this.subDistrictLineLayer.renderer={type:"simple",symbol:{type:"simple-line",color:[23,151,255],width:2}},this.currentLineRenderer=this.subDistrictLineLayer.renderer.clone(),await this.subDistrictLineLayer.applyEdits({addFeatures:L})}async clearSubDistricts(){var e;const i=await this.subDistrictPointLayer.queryFeatures();i.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:i.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",this.roadConnections=[],(e=this.clickHandler)==null||e.remove()}setVisible(i){this.showRoads({type:"district",id:""}),this.subDistrictPointLayer.visible=i,this.subDistrictLineLayer.visible=i}async locateSubDistrict(i){const s=this.subDistrictPointLayer.createQuery();s.where=`subDistrictId = '${i}'`,s.returnGeometry=!0;const e=await this.subDistrictPointLayer.queryFeatures(s);return e.features.length>0?(await D.default.viewGoto(this.view,e.features,!1),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(i){let s="";const e=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${i.id}'`;const r=await this.subDistrictPointLayer.queryFeatures(),a=r.features.length;return a>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${i.id}'`,s=r.features[0].attributes.districtId,await D.default.viewGoto(this.view,r.features,i.needZoom!==!1)):this.subDistrictPointLayer.definitionExpression=e,{count:a,parentId:s}}filter(i){const{type:s,id:e}=i,r=`${s==="district"?"districtId":"subDistrictId"} = '${e}'`;this.subDistrictPointLayer.definitionExpression=r,this.subDistrictLineLayer.definitionExpression=r}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(i){var r;const e=(r=(await this.view.hitTest(i,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(a=>a.type==="graphic");if(e.length===0)console.time("resetRenderer"),this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const a=e[0].graphic,t=a.attributes.color.split(",").map(Number);this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[180,180,180,.5],width:4}},defaultLabel:"其他子区",uniqueValueInfos:[{value:a.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[...t,.8],size:"8px",outline:{color:t,width:4}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",style:"solid",color:[180,180,180,.5],width:"8px"},defaultLabel:"其他子区",uniqueValueInfos:[{value:a.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:a.attributes.color.split(",").map(Number),width:"8px"}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]}}}}exports.default=g;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.270",
3
+ "version": "1.0.272",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [