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,57 +1,58 @@
1
- import L from "@arcgis/core/Graphic";
2
- import m from "@arcgis/core/layers/FeatureLayer";
3
- import v from "../common-utils.mjs";
4
- import { subDistrictPointLayerOptions as I, subDistrictLineLayerOptions as z } from "./layer-symbol.mjs";
1
+ import m from "@arcgis/core/Graphic";
2
+ import v from "@arcgis/core/layers/FeatureLayer";
3
+ import D from "../common-utils.mjs";
4
+ import { subDistrictPointLayerOptions as I, subDistrictLineLayerOptions as g } from "./layer-symbol.mjs";
5
5
  class C {
6
- constructor(e) {
7
- this.roadConnections = [], this.view = e, this.subDistrictPointLayer = new m(
6
+ constructor(i) {
7
+ this.roadConnections = [], this.view = i, this.subDistrictPointLayer = new v(
8
8
  I
9
- ), this.subDistrictPointLayer.spatialReference = e.spatialReference, this.subDistrictPointLayer.popupEnabled = !0, this.subDistrictLineLayer = new m(
10
- z
11
- ), this.subDistrictLineLayer.spatialReference = e.spatialReference, this.subDistrictLineLayer.popupEnabled = !0, this.view.map.addMany([
9
+ ), this.subDistrictPointLayer.spatialReference = i.spatialReference, this.subDistrictPointLayer.popupEnabled = !0, this.subDistrictLineLayer = new v(
10
+ g
11
+ ), this.subDistrictLineLayer.spatialReference = i.spatialReference, this.subDistrictLineLayer.popupEnabled = !0, this.view.map.addMany([
12
12
  this.subDistrictLineLayer,
13
13
  this.subDistrictPointLayer
14
14
  ]);
15
15
  }
16
- async showSubDistricts(e) {
17
- await this.clearSubDistricts(), this.clickHandler = this.view.on("click", this.viewHitTest.bind(this));
16
+ async showSubDistricts(i) {
17
+ var a;
18
+ console.log(i), await this.clearSubDistricts(), (a = this.clickHandler) == null || a.remove(), this.clickHandler = this.view.on("click", this.viewHitTest.bind(this));
18
19
  let s = 0;
19
- const t = [], r = [];
20
- e.forEach((i) => {
21
- i.roadConnections.length > 0 && this.roadConnections.push(...i.roadConnections), r.push({
22
- value: i.id,
23
- label: i.name,
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,
24
25
  symbol: {
25
26
  type: "simple-marker",
26
27
  style: "circle",
27
- color: [...i.areaColor, 0.8],
28
+ color: [...t.areaColor, 0.8],
28
29
  size: "8px",
29
30
  outline: {
30
- color: [...i.areaColor],
31
+ color: [...t.areaColor],
31
32
  width: 4
32
33
  }
33
34
  }
34
- }), i.signals.forEach((a) => {
35
- const n = new L({
35
+ }), t.signals.forEach((n) => {
36
+ const d = new m({
36
37
  geometry: {
37
38
  type: "point",
38
- longitude: a.longitude,
39
- latitude: a.latitude
39
+ longitude: n.longitude,
40
+ latitude: n.latitude
40
41
  },
41
42
  attributes: {
42
43
  ObjectID: s++,
43
- id: a.nodeId,
44
- name: a.name,
45
- subDistrictId: i.id,
46
- subDistrictName: i.name,
47
- districtId: i.parentId,
48
- districtName: i.parentName,
49
- signalCount: i.signalCount,
50
- color: i.areaColor.join(","),
44
+ id: n.nodeId,
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(","),
51
52
  type: "subDistrict"
52
53
  }
53
54
  });
54
- t.push(n);
55
+ e.push(d);
55
56
  });
56
57
  }), this.subDistrictPointLayer.renderer = {
57
58
  type: "unique-value",
@@ -96,42 +97,42 @@ class C {
96
97
  }
97
98
  ]
98
99
  }, this.currentPointRenderer = this.subDistrictPointLayer.renderer.clone(), await this.subDistrictPointLayer.applyEdits({
99
- addFeatures: t
100
- });
100
+ addFeatures: e
101
+ }), await D.viewGoto(this.view, e);
101
102
  }
102
103
  /**
103
104
  * 显示区控下的所有子区,用道路线表示
104
105
  * @param id 区控ID
105
106
  */
106
- async showRoads(e) {
107
- const { type: s, id: t } = e, r = this.subDistrictPointLayer.createQuery(), i = s === "district" ? "districtId" : "subDistrictId";
108
- r.where = `${i} = '${t}'`;
109
- const a = await this.subDistrictPointLayer.queryFeatures(
107
+ async showRoads(i) {
108
+ const { type: s, id: e } = i, r = this.subDistrictPointLayer.createQuery(), a = s === "district" ? "districtId" : "subDistrictId";
109
+ r.where = `${a} = '${e}'`;
110
+ const t = await this.subDistrictPointLayer.queryFeatures(
110
111
  r
111
112
  ), n = /* @__PURE__ */ new Map();
112
- a.features.forEach((u) => {
113
+ t.features.forEach((u) => {
113
114
  var y;
114
115
  const {
115
116
  subDistrictId: o,
116
117
  color: c,
117
- id: d,
118
- districtName: p,
119
- subDistrictName: f,
118
+ id: p,
119
+ districtName: h,
120
+ subDistrictName: L,
120
121
  signalCount: b
121
122
  } = u.attributes;
122
123
  n.has(o) || n.set(o, {
123
124
  color: c,
124
125
  signalIds: [],
125
- districtName: p,
126
- subDistrictName: f,
126
+ districtName: h,
127
+ subDistrictName: L,
127
128
  signalCount: b
128
- }), (y = n.get(o)) == null || y.signalIds.push(d);
129
+ }), (y = n.get(o)) == null || y.signalIds.push(p);
129
130
  });
130
- const h = [], D = [];
131
+ const d = [], f = [];
131
132
  for (const u of n) {
132
133
  let o = 0;
133
134
  const c = u[0];
134
- h.push({
135
+ d.push({
135
136
  value: c,
136
137
  symbol: {
137
138
  type: "simple-line",
@@ -140,11 +141,11 @@ class C {
140
141
  style: "solid"
141
142
  }
142
143
  });
143
- const { districtName: d, subDistrictName: p, signalIds: f, signalCount: b } = u[1];
144
+ const { districtName: p, subDistrictName: h, signalIds: L, signalCount: b } = u[1];
144
145
  this.roadConnections.filter(
145
146
  (l) => l.subDistrictId === c
146
147
  ).forEach((l) => {
147
- const w = new L({
148
+ const w = new m({
148
149
  geometry: {
149
150
  type: "polyline",
150
151
  paths: l.coordinates
@@ -154,13 +155,13 @@ class C {
154
155
  id: l.id,
155
156
  districtId: l.districtId,
156
157
  subDistrictId: c,
157
- subDistrictName: p,
158
- districtName: d,
158
+ subDistrictName: h,
159
+ districtName: p,
159
160
  signalCount: b,
160
161
  color: u[1].color
161
162
  }
162
163
  });
163
- D.push(w);
164
+ f.push(w);
164
165
  });
165
166
  }
166
167
  this.subDistrictLineLayer.renderer = {
@@ -173,7 +174,7 @@ class C {
173
174
  style: "solid"
174
175
  },
175
176
  defaultLabel: "其他子区",
176
- uniqueValueInfos: h,
177
+ uniqueValueInfos: d,
177
178
  visualVariables: [
178
179
  {
179
180
  type: "size",
@@ -203,56 +204,56 @@ class C {
203
204
  }
204
205
  ]
205
206
  }, this.currentLineRenderer = this.subDistrictLineLayer.renderer.clone(), await this.subDistrictLineLayer.applyEdits({
206
- addFeatures: D
207
+ addFeatures: f
207
208
  });
208
209
  }
209
210
  async clearSubDistricts() {
210
- var t;
211
- const e = await this.subDistrictPointLayer.queryFeatures();
212
- e.features.length > 0 && await this.subDistrictPointLayer.applyEdits({
213
- deleteFeatures: e.features
211
+ var e;
212
+ const i = await this.subDistrictPointLayer.queryFeatures();
213
+ i.features.length > 0 && await this.subDistrictPointLayer.applyEdits({
214
+ deleteFeatures: i.features
214
215
  }), this.subDistrictPointLayer.definitionExpression = "1=1";
215
216
  const s = await this.subDistrictLineLayer.queryFeatures();
216
217
  s.features.length > 0 && await this.subDistrictLineLayer.applyEdits({
217
218
  deleteFeatures: s.features
218
- }), this.subDistrictLineLayer.definitionExpression = "1=1", (t = this.clickHandler) == null || t.remove();
219
+ }), this.subDistrictLineLayer.definitionExpression = "1=1", (e = this.clickHandler) == null || e.remove();
219
220
  }
220
- setVisible(e) {
221
- this.subDistrictPointLayer.visible = e, this.subDistrictLineLayer.visible = e;
221
+ setVisible(i) {
222
+ this.subDistrictPointLayer.visible = i, this.subDistrictLineLayer.visible = i;
222
223
  }
223
224
  /**
224
225
  * 定位子区
225
226
  * @param id 子区ID
226
227
  */
227
- async locateSubDistrict(e) {
228
+ async locateSubDistrict(i) {
228
229
  const s = this.subDistrictPointLayer.createQuery();
229
- s.where = `subDistrictId = '${e}'`, s.returnGeometry = !0;
230
- const t = await this.subDistrictPointLayer.queryFeatures(s);
231
- return t.features.length > 0 ? (await v.viewGoto(this.view, t.features, !1), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
230
+ 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: "未找到子区" };
232
233
  }
233
234
  /**
234
235
  * 高亮子区, 其他子区隐藏
235
236
  * @param id 子区ID
236
237
  * @return 返回高亮子区的数量以及区控id
237
238
  */
238
- async highlightSubDistrict(e) {
239
+ async highlightSubDistrict(i) {
239
240
  let s = "";
240
- const t = this.subDistrictPointLayer.definitionExpression;
241
- this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${e.id}'`;
242
- const r = await this.subDistrictPointLayer.queryFeatures(), i = r.features.length;
243
- return i > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${e.id}'`, s = r.features[0].attributes.districtId, await v.viewGoto(
241
+ const e = this.subDistrictPointLayer.definitionExpression;
242
+ this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${i.id}'`;
243
+ const r = await this.subDistrictPointLayer.queryFeatures(), a = r.features.length;
244
+ return a > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${i.id}'`, s = r.features[0].attributes.districtId, await D.viewGoto(
244
245
  this.view,
245
246
  r.features,
246
- e.needZoom !== !1
247
- )) : this.subDistrictPointLayer.definitionExpression = t, { count: i, parentId: s };
247
+ i.needZoom !== !1
248
+ )) : this.subDistrictPointLayer.definitionExpression = e, { count: a, parentId: s };
248
249
  }
249
250
  /**
250
251
  * 按照区控、子区id显示子区
251
252
  * @param type 类型,district 或 subDistrict
252
253
  * @param id
253
254
  */
254
- filter(e) {
255
- const { type: s, id: t } = e, r = `${s === "district" ? "districtId" : "subDistrictId"} = '${t}'`;
255
+ filter(i) {
256
+ const { type: s, id: e } = i, r = `${s === "district" ? "districtId" : "subDistrictId"} = '${e}'`;
256
257
  this.subDistrictPointLayer.definitionExpression = r, this.subDistrictLineLayer.definitionExpression = r;
257
258
  }
258
259
  /**
@@ -265,17 +266,17 @@ class C {
265
266
  * 监听地图点击事件,进行子区高亮
266
267
  * @param event
267
268
  */
268
- async viewHitTest(e) {
269
+ async viewHitTest(i) {
269
270
  var r;
270
- const t = (r = (await this.view.hitTest(e, {
271
+ const e = (r = (await this.view.hitTest(i, {
271
272
  include: [this.subDistrictPointLayer, this.subDistrictLineLayer]
272
273
  })).results) == null ? void 0 : r.filter(
273
- (i) => i.type === "graphic"
274
+ (a) => a.type === "graphic"
274
275
  );
275
- if (t.length === 0)
276
+ if (e.length === 0)
276
277
  console.time("resetRenderer"), this.subDistrictPointLayer.renderer = this.currentPointRenderer, this.subDistrictLineLayer.renderer = this.currentLineRenderer;
277
278
  else {
278
- const i = t[0].graphic, a = i.attributes.color.split(",").map(Number);
279
+ const a = e[0].graphic, t = a.attributes.color.split(",").map(Number);
279
280
  this.subDistrictPointLayer.renderer = {
280
281
  type: "unique-value",
281
282
  field: "subDistrictId",
@@ -292,14 +293,14 @@ class C {
292
293
  defaultLabel: "其他子区",
293
294
  uniqueValueInfos: [
294
295
  {
295
- value: i.attributes.subDistrictId,
296
+ value: a.attributes.subDistrictId,
296
297
  symbol: {
297
298
  type: "simple-marker",
298
299
  style: "circle",
299
- color: [...a, 0.8],
300
+ color: [...t, 0.8],
300
301
  size: "8px",
301
302
  outline: {
302
- color: a,
303
+ color: t,
303
304
  width: 4
304
305
  }
305
306
  }
@@ -345,11 +346,11 @@ class C {
345
346
  defaultLabel: "其他子区",
346
347
  uniqueValueInfos: [
347
348
  {
348
- value: i.attributes.subDistrictId,
349
+ value: a.attributes.subDistrictId,
349
350
  symbol: {
350
351
  type: "simple-line",
351
352
  style: "solid",
352
- color: i.attributes.color.split(",").map(Number),
353
+ color: a.attributes.color.split(",").map(Number),
353
354
  width: "8px"
354
355
  }
355
356
  }
@@ -146,8 +146,8 @@ export interface IOverlayParam {
146
146
  }
147
147
  export interface IClusterPointParams {
148
148
  type?: string;
149
- clusterSymbol?: IPointSymbol;
150
- pointSymbol?: IPointSymbol;
149
+ clusterSymbol?: any;
150
+ pointSymbol?: any;
151
151
  points: IClusterLocation[];
152
152
  }
153
153
  export interface IClusterLocation {
@@ -157,7 +157,7 @@ export interface IClusterLocation {
157
157
  properties?: any;
158
158
  visited?: boolean;
159
159
  clusterId?: number;
160
- symbol?: IPointSymbol;
160
+ symbol?: any;
161
161
  }
162
162
  export interface ICluster {
163
163
  id: number;
@@ -86,7 +86,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
86
86
  zoom: number;
87
87
  }) => import("../types").IResult;
88
88
  lookAt: (params: ILookAtParams) => Promise<void>;
89
- setLayerVisibility: (params: ILayerVisibleParams) => import("../types").IResult;
89
+ setLayerVisibility: (params: ILayerVisibleParams) => Promise<import("../types").IResult>;
90
90
  requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
91
91
  handle: number;
92
92
  points: number[][];
@@ -143,6 +143,8 @@ declare const _sfc_main: import("vue").DefineComponent<{
143
143
  message: string;
144
144
  }>;
145
145
  showSignalControlArea: (params: IShowSignalControlAreaParams) => Promise<import("../types").IResult>;
146
+ showDistrictArea: (params: IShowSignalControlAreaParams) => Promise<void>;
147
+ showSubDistrictArea: (params: IShowSignalControlAreaParams) => Promise<void>;
146
148
  clearSignalControlArea: () => Promise<import("../types").IResult>;
147
149
  setSignalControlAreaVisibility: (params: ILayerVisibleParams) => import("../types").IResult;
148
150
  locateSignalControlArea: (params: IFindSignalControlAreaParams) => Promise<import("../types").IResult>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),T=require("./stores/index.js");require("./style/index.css");const st=require("./utils/dbscan-cluster/index.js"),ot=require("./utils/detect-gpu.js"),it=require("./utils/edpass-device-controller.js"),M=require("./utils/green-wave-band-controller/index.js"),ct=require("./utils/holo-flow/index.js"),lt=require("./utils/holo-flow/signal-countdown-panel.vue.js"),ut=require("./utils/map-initializer.js"),x=require("./utils/open-drive-renderer/index.js"),P=require("./utils/overlay.js"),dt=require("./utils/police-jurisdiction.js"),mt=require("./utils/queue-length.js"),z=require("./utils/road-config-tool/index.js"),pt=require("./utils/signal-control-area/edit-area.js"),gt=require("./utils/signal-control-area/show-area.js"),ft=require("./utils/traffic-flow.js"),yt={class:"gis-viewer"},vt={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},St=r.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(E,{expose:N,emit:H}){const h=r.ref(null);let n,p,l,i,a,s,f,t,u,o,g,v,b,y;const O=r.ref(!1);T.registerStore();const q=T.default.useAppDataStore,V=r.reactive([]),_=e=>Math.log2(591657527591555e-6/e);let S=null,B=null;const A=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==B&&(B=d,w("update:zoom",d))};ot.default(),r.onMounted(async()=>{if(!h.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(O.value=!O.value)});const e=r.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(I.config)).json();c.assetsRoot=I.assetsRoot||d,q.mapConfig=c,p=new ut.default,q.mapInitializer=p,n=await p.initialize({container:h.value,mapConfig:c,markerClickCallback:(m,L,D,rt)=>{w("markerClick",m,L,D,rt)},mapClickCallback:(m,L,D)=>{w("mapClick",m,L,D)}});const C=n.zoom??(n.scale?_(n.scale):void 0);typeof C=="number"&&A(C);const at=n.zoom!==void 0?n.watch("zoom",m=>{A(m)}):n.watch("scale",m=>{typeof m=="number"&&m>0&&A(_(m))});S=()=>at.remove(),a=new ct.default(n,V),await a.init(),w("mapLoaded")}),r.onUnmounted(()=>{o==null||o.clearSignalControlArea(),t==null||t.clearOpenDrive(),a.clearHoloTrace(),a.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),S==null||S(),S=null});const G=r.computed(()=>n),Z=()=>{const e=T.default.useAppDataStore;e.saveTrackLog=!0},W=()=>{a.downloadTrackLog()},j=()=>{k("vehicleId")},J=()=>{k("plateNumber")},Q=async e=>await p.setMapCenter(e),U=async e=>await p.setMapCamera(e),K=e=>p.setMapZoom(e),F=async e=>await p.lookAt(e),X=e=>p.setLayerVisibility(e),Y=(e,d)=>p.requestCoordinateTransform(e,d),R=e=>{p.cancelCoordinateTransform(e)},$=e=>{p.setMapZoomRange(e)},ee=e=>(l||(l=new z.default(n)),l.showLaneNumber(e)),te=()=>{l==null||l.clearLaneNumber()},ne=async e=>(l||(l=new z.default(n)),await l.initializeSearch(e)),ae=async()=>l==null?void 0:l.calCrossIndicatorArea(),re=async()=>{},se=async(e,d)=>{i||(i=new ft.default(n)),i.connectTrafficFlow(e,d)},oe=()=>{i==null||i.disconnectTrafficFlow()},ie=async e=>{a.handleVehicleTraceData(e)},ce=()=>{a.clearHoloTrace()},le=e=>{a.setInterpolate(e)},ue=async e=>{await a.handleSignalData(e)},de=async e=>{await a.initializeLampGroup(e)},me=e=>{a.handleUniSignalData(e)},pe=()=>{a.clearHoloSignal()},ge=e=>{i==null||i.toggleTrafficInfo(e),a==null||a.toggleTrafficInfo(e)},fe=e=>{a==null||a.togglePause(e)},ye=e=>{i==null||i.toggleTrafficObject(e),a==null||a.toggleTrafficObject(e)},k=e=>{a==null||a.updatePanelContent(e)},ve=async e=>(s||(s=new P.default(n)),s.addOverlays(e)),Se=async e=>(y||(y=new st.default(n)),y.addClusterPoints(e)),we=()=>{y==null||y.removeAllClusterPoints()},Ce=e=>(s||(s=new P.default(n)),s.addMask(e)),he=()=>{s==null||s.removeMask()},be=e=>s==null?void 0:s.removeOverlaysByType(e),Oe=e=>s==null?void 0:s.removeOverlaysById(e),Ae=()=>s==null?void 0:s.removeAllOverlays(),ke=()=>{s==null||s.showAllOverlays()},Le=e=>{f||(f=new mt.default(n)),f.updateQueueLength(e)},De=()=>{f==null||f.removeQueueLength()},Te=async(e,d)=>(t||(t=new x.default(n)),await t.showOpenDriveFromServer(e,d)),qe=async e=>(t||(t=new x.default(n)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),Ve=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},_e=async()=>await(t==null?void 0:t.clearOpenDrive()),Be=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},Ie=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Me=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},Pe=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Ee=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ne=async e=>(o||(o=new gt.default(n)),await o.showSignalControlArea(e)),He=async()=>await(o==null?void 0:o.clearSignalControlArea()),Ge=e=>o==null?void 0:o.setLayerVisibility(e),Ze=async e=>o?await(o==null?void 0:o.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},We=async e=>o?await o.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},je=()=>o?o.resetHighlight():{status:-1,message:"未加载信号控制区"},Je=e=>(u||(u=new pt.default(n)),u.showSubSignalControlArea(e)),Qe=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Ue=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},Ke=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Fe=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Xe=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},Ye=e=>(g||(g=new M.default(n)),g.addGreenWaveBand(e)),Re=()=>{if(!g)return{status:-1,message:"未加载绿波带"};g.stopAddGreenWaveBand()},$e=async e=>(g||(g=new M.default(n)),await g.showGreenWaveBand(e)),et=async e=>(v||(v=new dt.default(n)),await v.showJurisdiction(e)),tt=()=>{if(!v)return{status:-1,message:"未加载警务管辖区"};v.clearJurisdiction()},nt=async e=>(b||(b=new it.default(n)),await b.setEdpassLayerVisibility(e)),I=E,w=H;return N({mapViewer:G,setLayerVisibility:X,setMapCenter:Q,lookAt:F,setMapCamera:U,setMapZoom:K,setMapZoomRange:$,requestCoordinateTransform:Y,cancelCoordinateTransform:R,addOverlays:ve,addClusterPoints:Se,removeAllClusterPoints:we,addMask:Ce,removeMask:he,showAllOverlays:ke,removeOverlaysByType:be,removeOverlaysById:Oe,removeAllOverlays:Ae,showLaneNumber:ee,clearLaneNumber:te,initializeAreaTool:ne,calCrossIndicatorArea:ae,calRoadIndicatorArea:re,connectCarFlow:se,disconnectCarFlow:oe,handleHoloVehicleTraceData:ie,clearHoloTrace:ce,initializeLampGroup:de,handleUniSignalData:me,handleHoloSignalData:ue,clearHoloSignal:pe,setInterpolate:le,toggleTrafficInfo:ge,toggleTrafficObject:ye,toggleVehicleInfo:k,togglePause:fe,updateQueueLength:Le,removeQueueLength:De,showOpenDriveFromServer:Te,showOpenDriveFromFile:qe,clearOpenDrive:_e,setOpendriveVisibility:Ve,geometrySearchInOpenDrive:xe,findSumoInOpenDrive:Be,selectSumoInOpenDrive:Ie,unselectSumoInOpenDrive:Me,getSumoInfo:Pe,splitOpenDriveLane:ze,clearSplitOpenDriveLane:Ee,showSignalControlArea:Ne,clearSignalControlArea:He,setSignalControlAreaVisibility:Ge,locateSignalControlArea:Ze,highlightSignalControlArea:We,resetHighlightSignalControlArea:je,showSubSignalControlArea:Je,editSubSignalControlArea:Qe,stopEditSubSignalControlArea:Ue,selectSubSignalControlAreaCross:Ke,unselectSubSignalControlAreaCross:Fe,changeSubSignalControlAreaBorderVisibility:Xe,addGreenWaveBand:Ye,stopAddGreenWaveBand:Re,showGreenWaveBand:$e,showPoliceArea:et,clearPoliceArea:tt,setEdpassLayerVisibility:nt}),(e,d)=>(r.openBlock(),r.createElementBlock("div",yt,[r.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:h},[r.withDirectives(r.createElementVNode("div",vt,[r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:Z}," 开始记录 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:W}," 下载日志 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 显示车辆id "),r.createElementVNode("button",{onClick:J},"显示车辆号牌")],512),[[r.vShow,O.value]])],512),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(V,(c,C)=>(r.openBlock(),r.createBlock(lt.default,{key:C,"display-mode":c.displayMode,flash:c.flash,"road-id":c.crossId,"cross-id":c.roadId,"map-point":c.mapPoint,"stop-line":c.stopLine,position:c.position,rotation:c.rotation,scale:c.scale,"lamp-status":c.lampStatus},null,8,["display-mode","flash","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=St;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("vue"),T=require("./stores/index.js");require("./style/index.css");const ct=require("./utils/dbscan-cluster/index.js"),lt=require("./utils/detect-gpu.js"),ut=require("./utils/edpass-device-controller.js"),x=require("./utils/green-wave-band-controller/index.js"),dt=require("./utils/holo-flow/index.js"),mt=require("./utils/holo-flow/signal-countdown-panel.vue.js"),pt=require("./utils/map-initializer.js"),P=require("./utils/open-drive-renderer/index.js"),z=require("./utils/overlay.js"),gt=require("./utils/police-jurisdiction.js"),ft=require("./utils/queue-length.js"),E=require("./utils/road-config-tool/index.js"),yt=require("./utils/signal-control-area/edit-area.js"),q=require("./utils/signal-control-area/show-area.js"),wt=require("./utils/traffic-flow.js"),vt={class:"gis-viewer"},St={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},ht=s.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(N,{expose:H,emit:G}){const C=s.ref(null);let n,p,l,i,r,o,f,t,u,a,g,w,b,y;const A=s.ref(!1);T.registerStore();const V=T.default.useAppDataStore,_=s.reactive([]),B=e=>Math.log2(591657527591555e-6/e);let v=null,I=null;const O=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==I&&(I=d,S("update:zoom",d))};lt.default(),s.onMounted(async()=>{if(!C.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(A.value=!A.value)});const e=s.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(M.config)).json();c.assetsRoot=M.assetsRoot||d,V.mapConfig=c,p=new pt.default,V.mapInitializer=p,n=await p.initialize({container:C.value,mapConfig:c,markerClickCallback:(m,D,L,it)=>{S("markerClick",m,D,L,it)},mapClickCallback:(m,D,L)=>{S("mapClick",m,D,L)}});const h=n.zoom??(n.scale?B(n.scale):void 0);typeof h=="number"&&O(h);const ot=n.zoom!==void 0?n.watch("zoom",m=>{O(m)}):n.watch("scale",m=>{typeof m=="number"&&m>0&&O(B(m))});v=()=>ot.remove(),r=new dt.default(n,_),await r.init(),S("mapLoaded")}),s.onUnmounted(()=>{a==null||a.clearSignalControlArea(),t==null||t.clearOpenDrive(),r.clearHoloTrace(),r.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),v==null||v(),v=null});const Z=s.computed(()=>n),W=()=>{const e=T.default.useAppDataStore;e.saveTrackLog=!0},j=()=>{r.downloadTrackLog()},J=()=>{k("vehicleId")},Q=()=>{k("plateNumber")},U=async e=>await p.setMapCenter(e),K=async e=>await p.setMapCamera(e),F=e=>p.setMapZoom(e),X=async e=>await p.lookAt(e),Y=e=>p.setLayerVisibility(e),R=(e,d)=>p.requestCoordinateTransform(e,d),$=e=>{p.cancelCoordinateTransform(e)},ee=e=>{p.setMapZoomRange(e)},te=e=>(l||(l=new E.default(n)),l.showLaneNumber(e)),ne=()=>{l==null||l.clearLaneNumber()},ae=async e=>(l||(l=new E.default(n)),await l.initializeSearch(e)),re=async()=>l==null?void 0:l.calCrossIndicatorArea(),se=async()=>{},oe=async(e,d)=>{i||(i=new wt.default(n)),i.connectTrafficFlow(e,d)},ie=()=>{i==null||i.disconnectTrafficFlow()},ce=async e=>{r.handleVehicleTraceData(e)},le=()=>{r.clearHoloTrace()},ue=e=>{r.setInterpolate(e)},de=async e=>{await r.handleSignalData(e)},me=async e=>{await r.initializeLampGroup(e)},pe=e=>{r.handleUniSignalData(e)},ge=()=>{r.clearHoloSignal()},fe=e=>{i==null||i.toggleTrafficInfo(e),r==null||r.toggleTrafficInfo(e)},ye=e=>{r==null||r.togglePause(e)},we=e=>{i==null||i.toggleTrafficObject(e),r==null||r.toggleTrafficObject(e)},k=e=>{r==null||r.updatePanelContent(e)},ve=async e=>(o||(o=new z.default(n)),o.addOverlays(e)),Se=async e=>(y||(y=new ct.default(n)),y.addClusterPoints(e)),he=()=>{y==null||y.removeAllClusterPoints()},Ce=e=>(o||(o=new z.default(n)),o.addMask(e)),be=()=>{o==null||o.removeMask()},Ae=e=>o==null?void 0:o.removeOverlaysByType(e),Oe=e=>o==null?void 0:o.removeOverlaysById(e),ke=()=>o==null?void 0:o.removeAllOverlays(),De=()=>{o==null||o.showAllOverlays()},Le=e=>{f||(f=new ft.default(n)),f.updateQueueLength(e)},Te=()=>{f==null||f.removeQueueLength()},qe=async(e,d)=>(t||(t=new P.default(n)),await t.showOpenDriveFromServer(e,d)),Ve=async e=>(t||(t=new P.default(n)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),_e=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},Be=async()=>await(t==null?void 0:t.clearOpenDrive()),Ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},Me=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Pe=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Ee=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Ne=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},He=async e=>(a||(a=new q.default(n)),await a.showSignalControlArea(e)),Ge=async e=>(a||(a=new q.default(n)),await a.showDistrict(e)),Ze=async e=>(a||(a=new q.default(n)),await a.showSubDistrict(e)),We=async()=>await(a==null?void 0:a.clearSignalControlArea()),je=e=>a==null?void 0:a.setLayerVisibility(e),Je=async e=>a?await(a==null?void 0:a.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Qe=async e=>a?await a.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Ue=()=>a?a.resetHighlight():{status:-1,message:"未加载信号控制区"},Ke=e=>(u||(u=new yt.default(n)),u.showSubSignalControlArea(e)),Fe=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Xe=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},Ye=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Re=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},$e=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},et=e=>(g||(g=new x.default(n)),g.addGreenWaveBand(e)),tt=()=>{if(!g)return{status:-1,message:"未加载绿波带"};g.stopAddGreenWaveBand()},nt=async e=>(g||(g=new x.default(n)),await g.showGreenWaveBand(e)),at=async e=>(w||(w=new gt.default(n)),await w.showJurisdiction(e)),rt=()=>{if(!w)return{status:-1,message:"未加载警务管辖区"};w.clearJurisdiction()},st=async e=>(b||(b=new ut.default(n)),await b.setEdpassLayerVisibility(e)),M=N,S=G;return H({mapViewer:Z,setLayerVisibility:Y,setMapCenter:U,lookAt:X,setMapCamera:K,setMapZoom:F,setMapZoomRange:ee,requestCoordinateTransform:R,cancelCoordinateTransform:$,addOverlays:ve,addClusterPoints:Se,removeAllClusterPoints:he,addMask:Ce,removeMask:be,showAllOverlays:De,removeOverlaysByType:Ae,removeOverlaysById:Oe,removeAllOverlays:ke,showLaneNumber:te,clearLaneNumber:ne,initializeAreaTool:ae,calCrossIndicatorArea:re,calRoadIndicatorArea:se,connectCarFlow:oe,disconnectCarFlow:ie,handleHoloVehicleTraceData:ce,clearHoloTrace:le,initializeLampGroup:me,handleUniSignalData:pe,handleHoloSignalData:de,clearHoloSignal:ge,setInterpolate:ue,toggleTrafficInfo:fe,toggleTrafficObject:we,toggleVehicleInfo:k,togglePause:ye,updateQueueLength:Le,removeQueueLength:Te,showOpenDriveFromServer:qe,showOpenDriveFromFile:Ve,clearOpenDrive:Be,setOpendriveVisibility:_e,geometrySearchInOpenDrive:Pe,findSumoInOpenDrive:Ie,selectSumoInOpenDrive:Me,unselectSumoInOpenDrive:xe,getSumoInfo:ze,splitOpenDriveLane:Ee,clearSplitOpenDriveLane:Ne,showSignalControlArea:He,showDistrictArea:Ge,showSubDistrictArea:Ze,clearSignalControlArea:We,setSignalControlAreaVisibility:je,locateSignalControlArea:Je,highlightSignalControlArea:Qe,resetHighlightSignalControlArea:Ue,showSubSignalControlArea:Ke,editSubSignalControlArea:Fe,stopEditSubSignalControlArea:Xe,selectSubSignalControlAreaCross:Ye,unselectSubSignalControlAreaCross:Re,changeSubSignalControlAreaBorderVisibility:$e,addGreenWaveBand:et,stopAddGreenWaveBand:tt,showGreenWaveBand:nt,showPoliceArea:at,clearPoliceArea:rt,setEdpassLayerVisibility:st}),(e,d)=>(s.openBlock(),s.createElementBlock("div",vt,[s.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:C},[s.withDirectives(s.createElementVNode("div",St,[s.createElementVNode("button",{style:{"margin-right":"10px"},onClick:W}," 开始记录 "),s.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 下载日志 "),s.createElementVNode("button",{style:{"margin-right":"10px"},onClick:J}," 显示车辆id "),s.createElementVNode("button",{onClick:Q},"显示车辆号牌")],512),[[s.vShow,A.value]])],512),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(_,(c,h)=>(s.openBlock(),s.createBlock(mt.default,{key:h,"display-mode":c.displayMode,flash:c.flash,"road-id":c.crossId,"cross-id":c.roadId,"map-point":c.mapPoint,"stop-line":c.stopLine,position:c.position,rotation:c.rotation,scale:c.scale,"lamp-status":c.lampStatus},null,8,["display-mode","flash","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=ht;
@@ -70,7 +70,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
70
70
  zoom: number;
71
71
  }) => import("../types").IResult;
72
72
  lookAt: (params: import("../types").ILookAtParams) => Promise<void>;
73
- setLayerVisibility: (params: import("../types").ILayerVisibleParams) => import("../types").IResult;
73
+ setLayerVisibility: (params: import("../types").ILayerVisibleParams) => Promise<import("../types").IResult>;
74
74
  requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
75
75
  handle: number;
76
76
  points: number[][];
@@ -127,6 +127,8 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
127
127
  message: string;
128
128
  }>;
129
129
  showSignalControlArea: (params: import("../types").IShowSignalControlAreaParams) => Promise<import("../types").IResult>;
130
+ showDistrictArea: (params: import("../types").IShowSignalControlAreaParams) => Promise<void>;
131
+ showSubDistrictArea: (params: import("../types").IShowSignalControlAreaParams) => Promise<void>;
130
132
  clearSignalControlArea: () => Promise<import("../types").IResult>;
131
133
  setSignalControlAreaVisibility: (params: import("../types").ILayerVisibleParams) => import("../types").IResult;
132
134
  locateSignalControlArea: (params: import("../types").IFindSignalControlAreaParams) => Promise<import("../types").IResult>;
@@ -2,8 +2,10 @@ import { IClusterPointParams } from 'packages/components/src/types';
2
2
  export default class DbscanCluster {
3
3
  private view;
4
4
  private clusterLayer;
5
- private maxClusterSymbolSize;
6
- private minClusterSymbolSize;
5
+ private readonly maxClusterSymbolSize;
6
+ private readonly minClusterSymbolSize;
7
+ private readonly clusterRadius;
8
+ private readonly minClusterPoints;
7
9
  constructor(view: __esri.MapView | __esri.SceneView);
8
10
  private zoomWatchHandle;
9
11
  private locations;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils"),m=require("@arcgis/core/geometry"),h=require("@arcgis/core/Graphic"),S=require("@arcgis/core/layers/GraphicsLayer");function C(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const g=C(b);class x{constructor(e){this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.zoomWatchHandle=null,this.locations=[],this.clusterMarkUrl="",this.currentZoom=0,this.view=e,this.currentZoom=e.zoom,this.clusterLayer=new S,this.view.map.add(this.clusterLayer)}locationToScreen(){this.locations.forEach(e=>{const t=this.view.toScreen(new m.Point({x:e.x,y:e.y}));e.properties.screenX=t.x,e.properties.screenY=t.y})}addClusterPoints(e){var o;this.locations=e.points,this.clusterMarkUrl=((o=e.clusterSymbol)==null?void 0:o.url)||"/GisViewerAssets/Images/cross/gis_xhj_blue.png",e.points.forEach(s=>{s.symbol||(s.symbol=e.pointSymbol||{type:"simple-marker",style:"circle",color:"#3388ff",size:8,outline:{color:"#ffffff",width:1}})}),this.zoomWatchHandle||(this.zoomWatchHandle=g.watch(()=>this.view.zoom,()=>{Math.abs(this.currentZoom-this.view.zoom)>=1&&(this.currentZoom=this.view.zoom,this.locationToScreen(),this.clusterLayer.removeAll(),this.addClusterPoints(e))})),this.locationToScreen(),console.time("cluster");const t=this.doPixelCluster(e.points,120,3);console.timeEnd("cluster"),this.showClusters(t)}removeAllClusterPoints(){var e;(e=this.zoomWatchHandle)==null||e.remove(),this.zoomWatchHandle=null,this.clusterLayer.removeAll()}showClusters(e){let t=Number.MIN_VALUE,o=Number.MAX_VALUE;e.forEach(s=>{s.count>1&&(o=Math.min(o,s.count),t=Math.max(t,s.count))}),e.forEach(s=>{if(s.id!==-1){let r=o===t?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(s.count-o)/(t-o)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const i=new h({geometry:new m.Point({x:s.center.x,y:s.center.y}),attributes:{count:s.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:[[[-15,40],[15,40],[15,20],[-15,20],[-15,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:this.clusterMarkUrl}]}}}});this.clusterLayer.add(i)}else s.items.forEach(r=>{const i=new h({geometry:new m.Point({x:r.x,y:r.y}),attributes:r.properties,symbol:r.symbol});this.clusterLayer.add(i)})})}getNeighbors(e,t,o){const s=e[t];return e.filter(r=>r.id===s.id||r.visited?!1:this.getDistance(s,r)<=o)}getDistance(e,t){return Math.sqrt(Math.pow(e.properties.screenX-t.properties.screenX,2)+Math.pow(e.properties.screenY-t.properties.screenY,2))}createClusters(e){const t={},o=[];for(let r=0;r<e.length;r++){const i=e[r];i.clusterId===void 0||i.clusterId===-1?o.push(i):(t[i.clusterId]||(t[i.clusterId]=[]),t[i.clusterId].push(i))}const s=Object.keys(t).map((r,i)=>{const l=t[Number(r)],c=l.length,y=l.reduce((u,a)=>u+a.x,0),d=l.reduce((u,a)=>u+a.y,0),p=y/c,f=d/c;return{id:Number(r),items:l,count:c,center:{x:p,y:f}}});return o.length>0&&s.push({id:-1,items:o,count:o.length,center:null}),s}doPixelCluster(e,t,o){let s=0;e.forEach(r=>r.visited=!1);for(let r=0;r<e.length;r++){const i=e[r];if(i.visited)continue;i.visited=!0;const l=this.getNeighbors(e,r,t);l.length<o?i.clusterId=-1:(l.forEach(c=>{c.visited=!0,c.clusterId=s}),i.clusterId=s,s++)}return this.createClusters(e)}}exports.default=x;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils"),m=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),C=require("@arcgis/core/layers/GraphicsLayer");function g(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const r in c)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(c,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>c[r]})}}return t.default=c,Object.freeze(t)}const x=g(b);class S{constructor(t){this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusterRadius=120,this.minClusterPoints=2,this.zoomWatchHandle=null,this.locations=[],this.clusterMarkUrl="",this.currentZoom=0,this.view=t,this.currentZoom=t.zoom,this.clusterLayer=new C,this.view.map.add(this.clusterLayer)}locationToScreen(){this.locations.forEach(t=>{const r=this.view.toScreen(new m.Point({x:t.x,y:t.y}));t.properties.screenX=r.x,t.properties.screenY=r.y})}addClusterPoints(t){var s;this.locations=t.points,this.clusterMarkUrl=((s=t.clusterSymbol)==null?void 0:s.url)||"/GisViewerAssets/Images/cross/gis_xhj_blue.png",this.locations=this.locations.filter(e=>e.x!==null&&e.y!==null&&!isNaN(e.x)&&!isNaN(e.y)),this.locations.forEach(e=>{e.x=Number(e.x),e.y=Number(e.y),e.symbol||(e.symbol=t.pointSymbol||{type:"simple-marker",style:"circle",color:"#3388ff",size:8,outline:{color:"#ffffff",width:1}})}),this.zoomWatchHandle||(this.zoomWatchHandle=x.watch(()=>this.view.zoom,()=>{if(Math.abs(this.currentZoom-this.view.zoom)>=1){this.currentZoom=this.view.zoom,this.locationToScreen(),console.time("cluster");const e=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);console.timeEnd("cluster"),this.showClusters(e)}})),this.locationToScreen();const r=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);this.showClusters(r)}removeAllClusterPoints(){var t;(t=this.zoomWatchHandle)==null||t.remove(),this.zoomWatchHandle=null,this.clusterLayer.removeAll()}showClusters(t){this.clusterLayer.removeAll();let r=Number.MIN_VALUE,s=Number.MAX_VALUE;t.forEach(e=>{e.count>1&&(s=Math.min(s,e.count),r=Math.max(r,e.count))}),t.forEach(e=>{if(e.id!==-1){let i=s===r?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(e.count-s)/(r-s)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);i*=.75;const l=(e.count.toString().length*8+6)/2,u=new y({geometry:new m.Point({x:e.center.x,y:e.center.y}),attributes:{count:e.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:i,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:i,rotateClockwise:!0,textureFilter:"Picture",url:this.clusterMarkUrl}]}}}});this.clusterLayer.add(u)}else e.items.forEach(i=>{const o=new y({geometry:new m.Point({x:i.x,y:i.y}),attributes:{...i,...i.properties,type:"clusterPoint",id:i.id},symbol:i.symbol});this.clusterLayer.add(o)})})}getNeighbors(t,r){return this.locations.filter(s=>s.id===t.id||s.visited?!1:this.getDistance(t,s)<=r)}getDistance(t,r){return Math.sqrt(Math.pow(t.properties.screenX-r.properties.screenX,2)+Math.pow(t.properties.screenY-r.properties.screenY,2))}createClusters(t){const r={},s=[];for(let i=0;i<t.length;i++){const o=t[i];o.clusterId===void 0||o.clusterId===-1?s.push(o):(r[o.clusterId]||(r[o.clusterId]=[]),r[o.clusterId].push(o))}const e=Object.keys(r).map((i,o)=>{const n=r[Number(i)],l=n.length,u=n.reduce((a,h)=>a+h.x,0),d=n.reduce((a,h)=>a+h.y,0),f=u/l,p=d/l;return{id:Number(i),items:n,count:l,center:{x:f,y:p}}});return s.length>0&&e.push({id:-1,items:s,count:s.length,center:null}),e}doPixelCluster(t,r){let s=0;this.locations.forEach(e=>{e.visited=!1,e.clusterId=void 0});for(let e=0;e<this.locations.length;e++){const i=this.locations[e];if(i.visited)continue;i.visited=!0;const o=this.getNeighbors(i,t);o.length<r?i.clusterId=-1:(o.forEach(n=>{n.visited=!0,n.clusterId=s}),i.clusterId=s,s++)}return this.createClusters(this.locations)}}exports.default=S;
@@ -16,7 +16,7 @@ export default class MapInitializer {
16
16
  markerClickCallback?: (type: string, id: string, detail: any, event?: any) => void;
17
17
  mapClickCallback?: (mapPoint: number[], screenPoint: number[], event?: any) => void;
18
18
  }): Promise<MapView | SceneView>;
19
- setLayerVisibility(params: ILayerVisibleParams): IResult;
19
+ setLayerVisibility(params: ILayerVisibleParams): Promise<IResult>;
20
20
  /**
21
21
  * 设置地图中心点
22
22
  * @param params
@@ -53,4 +53,13 @@ export default class MapInitializer {
53
53
  min?: number;
54
54
  max?: number;
55
55
  }): void;
56
+ /** 支队图层 */
57
+ private detachmentLayer;
58
+ private detachmentLayerLoaded;
59
+ /**
60
+ * 加载支队图层
61
+ * 现场环境用url创建FeatureLayer有各种问题,
62
+ * 改为图层导出为json,用json创建Graphic,再将Graphic添加到FeatureLayer
63
+ */
64
+ private loadDetachmentLayer;
56
65
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("@arcgis/core/Basemap"),v=require("@arcgis/core/config"),z=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),C=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/FeatureLayer"),O=require("@arcgis/core/layers/GeoJSONLayer"),S=require("@arcgis/core/layers/GroupLayer"),x=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),I=require("@arcgis/core/layers/MapImageLayer"),G=require("@arcgis/core/layers/TileLayer"),H=require("@arcgis/core/layers/WebTileLayer"),R=require("@arcgis/core/layers/WMSLayer"),_=require("@arcgis/core/Map"),B=require("@arcgis/core/views/MapView"),U=require("@arcgis/core/views/SceneView"),j=require("@turf/destination"),N=require("@turf/helpers"),E=require("./custom-layer/custom-wmts-layer.js");function y(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const i in u)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(u,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>u[i]})}}return e.default=u,Object.freeze(e)}const L=y(z),d=y(C),A=y(N);class J{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}processUrl(e){return e&&(e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("{{")?e.replace("{{geoServer}}",this.mapConfig.geoServer):this.mapConfig.assetsRoot+e)}async initialize(e){var m,M,k,P;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:a}=e;v.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,v.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,v.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const r=new _;((m=this.mapConfig)==null?void 0:m.mapOptions.mode.toLowerCase())==="2d"?(this.view=new B({map:r,container:i,...this.mapConfig.mapOptions}),this.view.on("drag",t=>{t.button===2&&t.stopPropagation()})):this.view=new U({map:r,container:i,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(M=this.mapConfig)==null?void 0:M.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async t=>{var l,f;if(a){let o=t.mapPoint;o.spatialReference.isWebMercator&&(o=d.webMercatorToGeographic(o)),a([o.x,o.y],[t.screenPoint.x,t.screenPoint.y],t)}if(this.view.type==="3d"){const o=this.view.camera;if(this.view.spatialReference.isWebMercator){const h=d.webMercatorToGeographic(o.position),p={heading:o.heading,tilt:o.tilt,position:h.toJSON()};console.log(p),(l=navigator.clipboard)==null||l.writeText(JSON.stringify(p))}else console.log(o.toJSON());console.log(this.view.zoom,this.view.scale)}else{let o=this.view.center;this.view.spatialReference.isWebMercator&&(o=d.webMercatorToGeographic(o)),console.log({center:o.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(f=(await this.view.hitTest(t)).results)==null?void 0:f.filter(o=>o.type==="graphic");c.length>0&&c.forEach(o=>{var p;const h=o.graphic;(p=h.attributes)!=null&&p.type&&s&&s(h.attributes.type,h.attributes.id,h.attributes,t)})});{let t=0,n=!1;this.view.on("pointer-move",async c=>{var f;const l=performance.now();if(!(n||l-t<100)){t=l,n=!0;try{const h=(f=(await this.view.hitTest(c)).results)==null?void 0:f.some(q=>q.type==="graphic"),p=this.view.container;p&&(p.style.cursor=h?"pointer":"default")}finally{n=!1}}})}if(this.view.on("pointer-leave",()=>{const t=this.view.container;t&&(t.style.cursor="default")}),(k=this.mapConfig)!=null&&k.baseLayers?this.mapConfig.baseLayers.forEach(t=>{const n=this.processUrl(t.url);let c=null;switch(t.type.toLowerCase()){case"webTile".toLowerCase():{c=new H({urlTemplate:n,...t.options});break}case"tile":{c=new G({url:n,...t.options});break}case"customwmts".toLowerCase():{c=new E.default({urlTemplate:n,...t.options});break}case"mapimage".toLowerCase():{c=new I({url:n,...t.options});break}case"arcgis":{const l=new T(t.options);r.basemap=l;break}case"feature":{c=new W({url:n,...t.options});break}case"3dtiles":{c=new x({url:n,...t.options});break}case"wms":{c=new R({url:n,...t.options});break}default:console.warn(`不支持的图层类型: ${t.type}`);break}if(c)if(t.group){let l=r.findLayerById(t.group);l&&l.type==="group"?l.add(c):(l=new S({id:t.group,title:t.groupTitle,visibilityMode:"inherited",layers:[c],visible:t.groupVisible!==!1}),r.add(l))}else r.add(c)}):r.basemap=new T({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(P=this.mapConfig)!=null&&P.hdLayers){const t=this.mapConfig.hdLayers.map(n=>new O({url:this.processUrl(n.url),...n.options,title:n.options.id}));r.addMany(t)}this.view.ui.remove("attribution"),await this.view.when();const b=this.mapConfig.camera;let w;if(this.view.type==="2d"){let t=this.view.center;this.view.spatialReference.isWebMercator&&(t=d.webMercatorToGeographic(t)),w={center:[t.x,t.y],zoom:this.view.zoom}}else{let t=this.view.camera.position;this.view.spatialReference.isWebMercator&&(t=d.webMercatorToGeographic(t)),w={position:t,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return b?b.home=w:this.mapConfig.camera={home:w},this.view}setLayerVisibility(e){const{id:i,visible:s}=e,a=this.view.map.findLayerById(i);return a?(a.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type.toLowerCase()){case"point":e.target=new g.Point(e.target);break;case"polyline":e.target=new g.Polyline(e.target);break;case"polygon":e.target=new g.Polygon(e.target);break;case"multipoint":e.target=new g.Multipoint(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}setMapZoom(e){return this.view?(this.view.zoom=e.zoom,{status:0,message:"成功"}):{status:-1,message:"未初始化"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,s=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:s,tilt:0},{duration:(e.duration||2)*1e3});else{const a=Math.tan(i*Math.PI/180)*e.height,r=j(A.point(e.center),a,s+180,{units:"meters"});await this.view.goTo({position:{x:r.geometry.coordinates[0],y:r.geometry.coordinates[1],z:e.height},heading:s,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:s=0}=e,{camera:a}=this.mapConfig;if(!a)return{status:-1,message:"未配置camera"};const r=a[i];return r?(await this.view.goTo(r,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let s=0;const r=1e3/30,b=L.watch(()=>this.view.center,()=>{const w=this.transformPoints(e),m=Date.now();m-s>r&&(i(w),s=m)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,b),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const s=new g.Point({x:i[0],y:i[1]}),a=this.view.toScreen(s);return[a.x,a.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:s}=e;!i&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=L.watch(()=>this.view.zoom,a=>{i&&a<=i&&(this.view.zoom=i),s&&a>=s&&(this.view.zoom=s)}))}}exports.default=J;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/Basemap"),M=require("@arcgis/core/config"),W=require("@arcgis/core/core/reactiveUtils"),b=require("@arcgis/core/geometry"),C=require("@arcgis/core/geometry/support/webMercatorUtils"),T=require("@arcgis/core/Graphic"),I=require("@arcgis/core/layers/FeatureLayer"),G=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/GroupLayer"),S=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),x=require("@arcgis/core/layers/MapImageLayer"),_=require("@arcgis/core/layers/TileLayer"),j=require("@arcgis/core/layers/WebTileLayer"),H=require("@arcgis/core/layers/WMSLayer"),B=require("@arcgis/core/Map"),N=require("@arcgis/core/views/MapView"),R=require("@arcgis/core/views/SceneView"),E=require("@turf/destination"),U=require("@turf/helpers"),A=require("@arcgis/core/layers/GraphicsLayer"),D=require("./custom-layer/custom-wmts-layer.js");function k(y){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(y){for(const i in y)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(y,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>y[i]})}}return e.default=y,Object.freeze(e)}const q=k(W),L=k(C),V=k(U);class J{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null,this.detachmentLayerLoaded=!1}processUrl(e){return e&&(e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("{{")?e.replace("{{geoServer}}",this.mapConfig.geoServer):this.mapConfig.assetsRoot+e)}async initialize(e){var p,w,g,m;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:o}=e;M.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,M.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,M.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const a=new B;((p=this.mapConfig)==null?void 0:p.mapOptions.mode.toLowerCase())==="2d"?(this.view=new N({map:a,container:i,...this.mapConfig.mapOptions}),this.view.on("drag",t=>{t.button===2&&t.stopPropagation()})):this.view=new R({map:a,container:i,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(w=this.mapConfig)==null?void 0:w.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async t=>{var l,v;if(o){let n=t.mapPoint;n.spatialReference.isWebMercator&&(n=L.webMercatorToGeographic(n)),o([n.x,n.y],[t.screenPoint.x,t.screenPoint.y],t)}if(this.view.type==="3d"){const n=this.view.camera;if(this.view.spatialReference.isWebMercator){const d=L.webMercatorToGeographic(n.position),f={heading:n.heading,tilt:n.tilt,position:d.toJSON()};console.log(f),(l=navigator.clipboard)==null||l.writeText(JSON.stringify(f))}else console.log(n.toJSON());console.log(this.view.zoom,this.view.scale)}else{let n=this.view.center;this.view.spatialReference.isWebMercator&&(n=L.webMercatorToGeographic(n)),console.log({center:n.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(v=(await this.view.hitTest(t)).results)==null?void 0:v.filter(n=>n.type==="graphic");c.length>0&&c.forEach(n=>{var f;const d=n.graphic;(f=d.attributes)!=null&&f.type&&s&&s(d.attributes.type,d.attributes.id,d.attributes,t)})});{let t=0,r=!1;this.view.on("pointer-move",async c=>{var v;const l=performance.now();if(!(r||l-t<100)){t=l,r=!0;try{const d=(v=(await this.view.hitTest(c)).results)==null?void 0:v.some(z=>z.type==="graphic"),f=this.view.container;f&&(f.style.cursor=d?"pointer":"default")}finally{r=!1}}})}if(this.view.on("pointer-leave",()=>{const t=this.view.container;t&&(t.style.cursor="default")}),(g=this.mapConfig)!=null&&g.baseLayers?this.mapConfig.baseLayers.forEach(t=>{const r=this.processUrl(t.url);let c=null;switch(t.type.toLowerCase()){case"webTile".toLowerCase():{c=new j({urlTemplate:r,...t.options});break}case"tile":{c=new _({url:r,...t.options});break}case"customwmts".toLowerCase():{c=new D.default({urlTemplate:r,...t.options});break}case"mapimage".toLowerCase():{c=new x({url:r,...t.options});break}case"arcgis":{const l=new P(t.options);a.basemap=l;break}case"feature":{c=new I({url:r,...t.options});break}case"3dtiles":{c=new S({url:r,...t.options});break}case"wms":{c=new H({url:r,...t.options});break}}if(c)if(t.group){let l=a.findLayerById(t.group);l&&l.type==="group"?l.add(c):(l=new O({id:t.group,title:t.groupTitle,visibilityMode:"inherited",layers:[c],visible:t.groupVisible!==!1}),a.add(l))}else a.add(c)}):a.basemap=new P({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(m=this.mapConfig)!=null&&m.hdLayers){const t=this.mapConfig.hdLayers.map(r=>new G({url:this.processUrl(r.url),...r.options,title:r.options.id}));a.addMany(t)}this.view.ui.remove("attribution"),await this.view.when();const h=this.mapConfig.camera;let u;if(this.view.type==="2d"){let t=this.view.center;this.view.spatialReference.isWebMercator&&(t=L.webMercatorToGeographic(t)),u={center:[t.x,t.y],zoom:this.view.zoom}}else{let t=this.view.camera.position;this.view.spatialReference.isWebMercator&&(t=L.webMercatorToGeographic(t)),u={position:t,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return h?h.home=u:this.mapConfig.camera={home:u},this.view}async setLayerVisibility(e){const{id:i,visible:s}=e;if(i==="shanghai_district")return this.detachmentLayerLoaded?this.detachmentLayer.visible=s:await this.loadDetachmentLayer(),{status:0,message:"ok"};{const o=this.view.map.findLayerById(i);return o?(o.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type.toLowerCase()){case"point":e.target=new b.Point(e.target);break;case"polyline":e.target=new b.Polyline(e.target);break;case"polygon":e.target=new b.Polygon(e.target);break;case"multipoint":e.target=new b.Multipoint(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}setMapZoom(e){return this.view?(this.view.zoom=e.zoom,{status:0,message:"成功"}):{status:-1,message:"未初始化"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,s=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:s,tilt:0},{duration:(e.duration||2)*1e3});else{const o=Math.tan(i*Math.PI/180)*e.height,a=E(V.point(e.center),o,s+180,{units:"meters"});await this.view.goTo({position:{x:a.geometry.coordinates[0],y:a.geometry.coordinates[1],z:e.height},heading:s,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:s=0}=e,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const a=o[i];return a?(await this.view.goTo(a,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let s=0;const a=1e3/30,h=q.watch(()=>this.view.center,()=>{const u=this.transformPoints(e),p=Date.now();p-s>a&&(i(u),s=p)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,h),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const s=new b.Point({x:i[0],y:i[1]}),o=this.view.toScreen(s);return[o.x,o.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:s}=e;!i&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=q.watch(()=>this.view.zoom,o=>{i&&o<=i&&(this.view.zoom=i),s&&o>=s&&(this.view.zoom=s)}))}async loadDetachmentLayer(){this.detachmentLayer=new A({id:"detachmentLayer",title:"支队图层",effect:void 0}),this.view.map.add(this.detachmentLayer);const e=this.mapConfig.baseLayers;if(!e)return;const i=e.find(s=>s.options.id==="shanghai_district");if(i)try{const o=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),a=[],{renderer:h,labelingInfo:u}=i.options;o.features.forEach(p=>{const w=p.attributes.ZD_NAME;if(w!=="高架支队"){let g=new b.Polygon({rings:p.geometry.rings});g=C.webMercatorToGeographic(g);const m=new T({geometry:g,attributes:p.attributes});if(h){if(h.type==="simple")m.symbol=h.symbol;else if(h.type==="unique-value"){const t=m.getAttribute("OBJECTID"),r=h.uniqueValueInfos.find(c=>c.value==t);m.symbol=r?r.symbol:h.defaultSymbol}}else m.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(a.push(m),u&&w!=="边防港航支队"&&w!=="机场支队"){const t=new T({geometry:g.centroid,symbol:{...u.symbol,text:w}});a.push(t)}}}),this.detachmentLayer.addMany(a),this.detachmentLayerLoaded=!0}catch(s){console.error("加载支队图层失败:",s);return}}}exports.default=J;
@@ -0,0 +1,9 @@
1
+ import DistrictController from './district-controller';
2
+ export default class CrossRenderer {
3
+ private view;
4
+ private crossLayer;
5
+ private crossGraphics;
6
+ private crossGraphicSymbol;
7
+ constructor(view: __esri.MapView | __esri.SceneView);
8
+ showCrosses(controllers: DistrictController[]): Promise<void>;
9
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("@arcgis/core/Graphic"),a=require("@arcgis/core/layers/GraphicsLayer");class c{constructor(s){this.crossGraphics=[],this.crossGraphicSymbol={type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,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:18,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:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}},this.view=s,this.crossLayer=new a,this.view.map.add(this.crossLayer)}async showCrosses(s){this.crossLayer.removeAll(),s.forEach(i=>{i.signals.forEach(e=>{const t=new r({geometry:{type:"point",longitude:e.longitude,latitude:e.latitude},symbol:this.crossGraphicSymbol,attributes:{id:e.id,name:e.name,signalId:e.signalId,nodeId:e.nodeId||e.id,districtId:i.id,districtName:i.name,subDistrictId:"",subDistrictName:"",isKey:e.isKey,type:"signal",selected:!0}});this.crossGraphics.push(t)}),i.subDistricts.forEach(e=>{e.signals.forEach(t=>{const o=new r({geometry:{type:"point",longitude:t.longitude,latitude:t.latitude},symbol:this.crossGraphicSymbol,attributes:{id:t.id,name:t.name,signalId:t.signalId,nodeId:t.nodeId||t.id,districtId:i.id,districtName:i.name,subDistrictId:e.id,subDistrictName:e.name,isKey:t.isKey,type:"signal",selected:!0}});this.crossGraphics.push(o)})})}),this.crossLayer.addMany(this.crossGraphics)}}exports.default=c;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("pako"),c=require("../common-utils.js");class r{constructor(o,s){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]);for(const t of o.children)if(t.children){const i=new r(t,s);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)try{const a=t.mapConnectList,n=new Uint8Array(window.atob(a).split("").map(e=>e.charCodeAt(0))),l=h.inflate(n,{to:"string"}),d=JSON.parse(l);i.roadConnections.push(...d.map(e=>({id:e.roadsectId,coordinates:JSON.parse(e.geomData).coordinates,districtId:i.parentId,subDistrictId:i.id}))),console.log(i.roadConnections)}catch(a){console.error("解压子区路段连接信息失败:",a)}}else if(c.default.isCoordinateValid(t)){const i={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId,nodeId:t.nodeId,isKey:t.isKey===1};this.signals.push(i),this.signalCount++}}getAllSignalCoordinates(){const o=[];for(const s of this.signals)o.push([s.longitude,s.latitude]);for(const s of this.subDistricts)o.push(...s.getAllSignalCoordinates());return o}getDarkNonGrayColor(o){let s,t,i;if(o){const a=this.cyrb53(o);s=((a&16711680)>>16)%200,t=((a&65280)>>8)%200,i=(a&255)%200}else s=Math.floor(Math.random()*256),t=Math.floor(Math.random()*256),i=Math.floor(Math.random()*256);return[s,t,i]}cyrb53(o,s=0){let t=3735928559^s,i=1103547991^s;for(let a=0,n;a<o.length;a++)n=o.charCodeAt(a),t=Math.imul(t^n,2654435761),i=Math.imul(i^n,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&i)+(t>>>0)}}exports.default=r;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("pako"),h=require("../common-utils.js");class d{constructor(o,s){if(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]),o.mapConnectList)try{const t=o.mapConnectList,i=new Uint8Array(window.atob(t).split("").map(e=>e.charCodeAt(0))),n=c.inflate(i,{to:"string"}),a=JSON.parse(n);this.roadConnections.push(...a.map(e=>({id:e.roadsectId,coordinates:JSON.parse(e.geomData).coordinates,districtId:this.parentId,subDistrictId:this.id})))}catch(t){console.error("解压子区路段连接信息失败:",t)}console.log(o);for(const t of o.children)if(t.children){const i=new d(t,s);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)try{const n=t.mapConnectList,a=new Uint8Array(window.atob(n).split("").map(r=>r.charCodeAt(0))),e=c.inflate(a,{to:"string"}),l=JSON.parse(e);i.roadConnections.push(...l.map(r=>({id:r.roadsectId,coordinates:JSON.parse(r.geomData).coordinates,districtId:i.parentId,subDistrictId:i.id})))}catch(n){console.error("解压子区路段连接信息失败:",n)}}else if(h.default.isCoordinateValid(t)){const i={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId,nodeId:t.nodeId,isKey:t.isKey===1};this.signals.push(i),this.signalCount++}}getAllSignalCoordinates(){const o=[];for(const s of this.signals)o.push([s.longitude,s.latitude]);for(const s of this.subDistricts)o.push(...s.getAllSignalCoordinates());return o}getDarkNonGrayColor(o){let s,t,i;if(o){const n=this.cyrb53(o);s=((n&16711680)>>16)%200,t=((n&65280)>>8)%200,i=(n&255)%200}else s=Math.floor(Math.random()*256),t=Math.floor(Math.random()*256),i=Math.floor(Math.random()*256);return[s,t,i]}cyrb53(o,s=0){let t=3735928559^s,i=1103547991^s;for(let n=0,a;n<o.length;n++)a=o.charCodeAt(n),t=Math.imul(t^a,2654435761),i=Math.imul(i^a,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&i)+(t>>>0)}}exports.default=d;