gisviewer-vue3-arcgis 1.0.230 → 1.0.232

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,17 +1,22 @@
1
- import n from "@arcgis/core/Graphic";
2
- import o from "@arcgis/core/layers/FeatureLayer";
3
- import { subDistrictPointLayerOptions as c } from "./layer-symbol.mjs";
4
- class b {
5
- constructor(t, e) {
6
- this.view = t, this.hasGpu = e, this.subDistrictPointLayer = new o(
7
- c
8
- ), this.subDistrictPointLayer.spatialReference = t.spatialReference, this.subDistrictPointLayer.popupEnabled = !0, this.view.map.add(this.subDistrictPointLayer), this.clickHandler = this.view.on("click", this.viewHitTest.bind(this));
1
+ import L from "@arcgis/core/Graphic";
2
+ import D from "@arcgis/core/layers/FeatureLayer";
3
+ import { subDistrictPointLayerOptions as m, subDistrictLineLayerOptions as w } from "./layer-symbol.mjs";
4
+ class x {
5
+ constructor(e, t) {
6
+ this.view = e, this.hasGpu = t, this.subDistrictPointLayer = new D(
7
+ m
8
+ ), this.subDistrictPointLayer.spatialReference = e.spatialReference, this.subDistrictPointLayer.popupEnabled = !0, this.subDistrictLineLayer = new D(
9
+ w
10
+ ), this.subDistrictLineLayer.spatialReference = e.spatialReference, this.subDistrictLineLayer.popupEnabled = !1, this.view.map.addMany([
11
+ this.subDistrictLineLayer,
12
+ this.subDistrictPointLayer
13
+ ]);
9
14
  }
10
- async showSubDistricts(t) {
11
- await this.clearSubDistricts();
12
- let e = 0;
15
+ async showSubDistricts(e) {
16
+ await this.clearSubDistricts(), this.clickHandler = this.view.on("click", this.viewHitTest.bind(this));
17
+ let t = 0;
13
18
  const s = [], r = [];
14
- t.forEach((i) => {
19
+ e.forEach((i) => {
15
20
  r.push({
16
21
  value: i.id,
17
22
  label: i.name,
@@ -26,14 +31,14 @@ class b {
26
31
  }
27
32
  }
28
33
  }), i.signals.forEach((a) => {
29
- const u = new n({
34
+ const u = new L({
30
35
  geometry: {
31
36
  type: "point",
32
37
  longitude: a.longitude,
33
38
  latitude: a.latitude
34
39
  },
35
40
  attributes: {
36
- ObjectID: e++,
41
+ ObjectID: t++,
37
42
  id: a.id,
38
43
  name: a.name,
39
44
  subDistrictId: i.id,
@@ -52,7 +57,7 @@ class b {
52
57
  field: "subDistrictId",
53
58
  defaultSymbol: {
54
59
  type: "simple-marker",
55
- color: "gray",
60
+ color: [180, 180, 180, 0.5],
56
61
  size: "8px",
57
62
  outline: {
58
63
  color: "white",
@@ -89,63 +94,178 @@ class b {
89
94
  ]
90
95
  }
91
96
  ]
92
- }, this.currentRenderer = this.subDistrictPointLayer.renderer.clone(), await this.subDistrictPointLayer.applyEdits({
97
+ }, this.currentPointRenderer = this.subDistrictPointLayer.renderer.clone(), await this.subDistrictPointLayer.applyEdits({
93
98
  addFeatures: s
94
99
  }), await this.view.goTo(s, {
95
100
  duration: this.hasGpu ? 1e3 : 0
96
101
  });
97
102
  }
103
+ async showRoads(e) {
104
+ const t = this.subDistrictPointLayer.createQuery();
105
+ t.where = `districtId = '${e}'`;
106
+ const s = await this.subDistrictPointLayer.queryFeatures(
107
+ t
108
+ ), r = /* @__PURE__ */ new Map();
109
+ s.features.forEach((u) => {
110
+ var o;
111
+ const { subDistrictId: l, color: c, id: n } = u.attributes;
112
+ r.has(l) || r.set(l, { color: c, signalIds: [] }), (o = r.get(l)) == null || o.signalIds.push(n);
113
+ });
114
+ const i = [], a = [];
115
+ for (const u of r) {
116
+ let l = 0;
117
+ const c = u[0];
118
+ i.push({
119
+ value: c,
120
+ symbol: {
121
+ type: "simple-line",
122
+ color: u[1].color.split(",").map(Number),
123
+ width: 2,
124
+ style: "solid"
125
+ }
126
+ });
127
+ const n = u[1].signalIds;
128
+ if (!(n.length < 2))
129
+ for (let o = 0; o < n.length; o++)
130
+ for (let d = 0; d < n.length; d++) {
131
+ if (o === d)
132
+ continue;
133
+ const p = n[o], y = n[d];
134
+ if (a.some((h) => {
135
+ const f = h.attributes;
136
+ return f && f.fromNode === y && f.toNode === p;
137
+ }))
138
+ continue;
139
+ const b = this.roadLines.find(
140
+ (h) => h.fromNode === p && h.toNode === y
141
+ );
142
+ if (!b)
143
+ continue;
144
+ const v = new L({
145
+ geometry: {
146
+ type: "polyline",
147
+ paths: [b.coordinates]
148
+ },
149
+ attributes: {
150
+ ObjectID: l++,
151
+ id: b.id,
152
+ districtId: e,
153
+ subDistrictId: c,
154
+ fromNode: p,
155
+ toNode: y,
156
+ color: u[1].color
157
+ }
158
+ });
159
+ a.push(v);
160
+ }
161
+ }
162
+ this.subDistrictLineLayer.renderer = {
163
+ type: "unique-value",
164
+ field: "subDistrictId",
165
+ defaultSymbol: {
166
+ type: "simple-line",
167
+ color: [180, 180, 180, 0.5],
168
+ width: 2,
169
+ style: "solid"
170
+ },
171
+ defaultLabel: "其他子区",
172
+ uniqueValueInfos: i,
173
+ visualVariables: [
174
+ {
175
+ type: "size",
176
+ valueExpression: "$view.scale",
177
+ stops: [
178
+ {
179
+ size: 6,
180
+ value: 2500
181
+ },
182
+ {
183
+ size: 5,
184
+ value: 5e3
185
+ },
186
+ {
187
+ size: 4,
188
+ value: 18055.954822000003
189
+ },
190
+ {
191
+ size: 3,
192
+ value: 144447.638572
193
+ },
194
+ {
195
+ size: 2,
196
+ value: 1155581108577e-6
197
+ }
198
+ ]
199
+ }
200
+ ]
201
+ }, this.currentLineRenderer = this.subDistrictLineLayer.renderer.clone(), await this.subDistrictLineLayer.applyEdits({
202
+ addFeatures: a
203
+ });
204
+ }
98
205
  async clearSubDistricts() {
99
- const t = await this.subDistrictPointLayer.queryFeatures();
100
- t.features.length > 0 && await this.subDistrictPointLayer.applyEdits({
101
- deleteFeatures: t.features
206
+ var s;
207
+ const e = await this.subDistrictPointLayer.queryFeatures();
208
+ e.features.length > 0 && await this.subDistrictPointLayer.applyEdits({
209
+ deleteFeatures: e.features
102
210
  }), this.subDistrictPointLayer.definitionExpression = "1=1";
211
+ const t = await this.subDistrictLineLayer.queryFeatures();
212
+ t.features.length > 0 && await this.subDistrictLineLayer.applyEdits({
213
+ deleteFeatures: t.features
214
+ }), this.subDistrictLineLayer.definitionExpression = "1=1", (s = this.clickHandler) == null || s.remove();
103
215
  }
104
- setVisible(t) {
105
- this.subDistrictPointLayer.visible = t;
216
+ setVisible(e) {
217
+ this.subDistrictPointLayer.visible = e, this.subDistrictLineLayer.visible = e;
106
218
  }
107
219
  /**
108
220
  * 定位子区
109
221
  * @param id 子区ID
110
222
  */
111
- async locateSubDistrict(t) {
112
- const e = this.subDistrictPointLayer.createQuery();
113
- e.where = `subDistrictId = '${t}'`, e.returnGeometry = !0;
114
- const s = await this.subDistrictPointLayer.queryFeatures(e);
223
+ async locateSubDistrict(e) {
224
+ const t = this.subDistrictPointLayer.createQuery();
225
+ t.where = `subDistrictId = '${e}'`, t.returnGeometry = !0;
226
+ const s = await this.subDistrictPointLayer.queryFeatures(t);
115
227
  return s.features.length > 0 ? (await this.view.goTo(s.features, {
116
228
  duration: this.hasGpu ? 1e3 : 0
117
- }), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
229
+ }), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
118
230
  }
119
231
  /**
120
232
  * 高亮子区, 其他子区隐藏
121
233
  * @param id 子区ID
122
234
  * @return 返回高亮子区的数量以及区控id
123
235
  */
124
- async highlightSubDistrict(t) {
125
- let e = "";
236
+ async highlightSubDistrict(e) {
237
+ let t = "";
126
238
  const s = this.subDistrictPointLayer.definitionExpression;
127
- this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${t}'`;
239
+ this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${e}'`;
128
240
  const r = await this.subDistrictPointLayer.queryFeatures(), i = r.features.length;
129
- return i > 0 ? (e = r.features[0].attributes.districtId, await this.view.goTo(r.features, {
241
+ return i > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${e}'`, t = r.features[0].attributes.districtId, await this.view.goTo(r.features, {
130
242
  duration: this.hasGpu ? 1e3 : 0
131
- })) : this.subDistrictPointLayer.definitionExpression = s, { count: i, parentId: e };
243
+ })) : this.subDistrictPointLayer.definitionExpression = s, { count: i, parentId: t };
132
244
  }
133
- filter(t, e) {
134
- const s = `${t === "district" ? "districtId" : "subDistrictId"} = '${e}'`;
135
- this.subDistrictPointLayer.definitionExpression = s;
245
+ /**
246
+ * 按照区控、子区id显示子区
247
+ * @param type 类型,district 或 subDistrict
248
+ * @param id
249
+ */
250
+ filter(e, t) {
251
+ const s = `${e === "district" ? "districtId" : "subDistrictId"} = '${t}'`;
252
+ this.subDistrictPointLayer.definitionExpression = s, this.subDistrictLineLayer.definitionExpression = s;
136
253
  }
254
+ /**
255
+ * 重置过滤器,显示所有子区
256
+ */
137
257
  resetFilter() {
138
- this.subDistrictPointLayer.definitionExpression = "1=1";
258
+ this.subDistrictPointLayer.definitionExpression = "1=1", this.subDistrictLineLayer.definitionExpression = "1=1";
139
259
  }
140
- async viewHitTest(t) {
260
+ async viewHitTest(e) {
141
261
  var r;
142
- const s = (r = (await this.view.hitTest(t, {
262
+ const s = (r = (await this.view.hitTest(e, {
143
263
  include: [this.subDistrictPointLayer]
144
264
  })).results) == null ? void 0 : r.filter(
145
265
  (i) => i.type === "graphic"
146
266
  );
147
267
  if (s.length === 0)
148
- this.currentRenderer && (this.subDistrictPointLayer.renderer = this.currentRenderer);
268
+ this.subDistrictPointLayer.renderer = this.currentPointRenderer, this.subDistrictLineLayer.renderer = this.currentLineRenderer;
149
269
  else {
150
270
  const i = s[0].graphic;
151
271
  this.subDistrictPointLayer.renderer = {
@@ -205,10 +325,59 @@ class b {
205
325
  ]
206
326
  }
207
327
  ]
328
+ }, this.subDistrictLineLayer.renderer = {
329
+ type: "unique-value",
330
+ field: "subDistrictId",
331
+ defaultSymbol: {
332
+ type: "simple-line",
333
+ style: "solid",
334
+ color: [180, 180, 180, 0.5],
335
+ width: "8px"
336
+ },
337
+ defaultLabel: "其他子区",
338
+ uniqueValueInfos: [
339
+ {
340
+ value: i.attributes.subDistrictId,
341
+ symbol: {
342
+ type: "simple-line",
343
+ style: "solid",
344
+ color: i.attributes.color.split(",").map(Number),
345
+ width: "8px"
346
+ }
347
+ }
348
+ ],
349
+ visualVariables: [
350
+ {
351
+ type: "size",
352
+ valueExpression: "$view.scale",
353
+ stops: [
354
+ {
355
+ size: 6,
356
+ value: 2500
357
+ },
358
+ {
359
+ size: 5,
360
+ value: 5e3
361
+ },
362
+ {
363
+ size: 4,
364
+ value: 18055.954822000003
365
+ },
366
+ {
367
+ size: 3,
368
+ value: 144447.638572
369
+ },
370
+ {
371
+ size: 2,
372
+ value: 1155581108577e-6
373
+ }
374
+ ]
375
+ }
376
+ ]
208
377
  };
209
378
  }
210
379
  }
211
380
  }
212
381
  export {
213
- b as default
382
+ x as default
214
383
  };
@@ -302,3 +302,9 @@ export interface IShowGreenWaveBandParams {
302
302
  coordinates: number[][];
303
303
  nodeList: INode[];
304
304
  }
305
+ export interface IRoadLine {
306
+ id: string;
307
+ fromNode: string;
308
+ toNode: string;
309
+ coordinates: number[][];
310
+ }
@@ -25,5 +25,6 @@ export default class DistrictController {
25
25
  */
26
26
  getAllSignalCoordinates(): number[][];
27
27
  private getDarkNonGrayColor;
28
+ private cyrb53;
28
29
  }
29
30
  export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("../common-utils.js");class e{constructor(s,n){this.parentName="",this.signals=[],this.subDistricts=[],this.areaColor=this.getDarkNonGrayColor(),this.signalCount=0,this.subDistrictCount=0,this.id=s.name,this.name=s.areaDesc,this.parentId=s.parentId,n==="alarm"&&(this.areaColor=[255,0,0]);for(const t of s.children)if(t.children){const i=new e(t,n);i.id=t.id,i.name=`SS ${t.name}`,i.parentId=this.id,i.parentName=this.name,this.subDistricts.push(i),this.subDistrictCount++,this.signalCount+=i.signalCount}else if(d.default.isCoordinateValid(t)){const i={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId,nodeId:t.nodeId,isKey:t.isKey===1};this.signals.push(i),this.signalCount++}}getAllSignalCoordinates(){const s=[];for(const n of this.signals)s.push([n.longitude,n.latitude]);for(const n of this.subDistricts)s.push(...n.getAllSignalCoordinates());return s}getDarkNonGrayColor(){const s=Math.floor(Math.random()*360),n=80+Math.random()*20,t=15+Math.random()*15,i=n/100*Math.min(t/100,1-t/100),o=r=>{const a=(r+s/30)%12,l=t/100-i*Math.max(Math.min(a-3,9-a,1),-1);return Math.round(255*l)};return[o(0),o(8),o(4)]}}exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../common-utils.js");class r{constructor(s,a){this.parentName="",this.signals=[],this.subDistricts=[],this.areaColor=this.getDarkNonGrayColor(),this.signalCount=0,this.subDistrictCount=0,this.id=s.name,this.name=s.areaDesc,this.parentId=s.parentId,a==="alarm"&&(this.areaColor=[255,0,0]);for(const t of s.children)if(t.children){const i=new r(t,a);i.id=t.id,i.name=`SS ${t.name}`,i.parentId=this.id,i.parentName=this.name,i.areaColor=this.getDarkNonGrayColor(t.id),this.subDistricts.push(i),this.subDistrictCount++,this.signalCount+=i.signalCount}else if(u.default.isCoordinateValid(t)){const i={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId,nodeId:t.nodeId,isKey:t.isKey===1};this.signals.push(i),this.signalCount++}}getAllSignalCoordinates(){const s=[];for(const a of this.signals)s.push([a.longitude,a.latitude]);for(const a of this.subDistricts)s.push(...a.getAllSignalCoordinates());return s}getDarkNonGrayColor(s){let a,t,i;if(s){const e=this.cyrb53(s);a=Math.abs(e)%360,t=80+Math.abs(e>>3)%21,i=10+Math.abs(e>>7)%41}else a=Math.floor(Math.random()*360),t=80+Math.random()*20,i=15+Math.random()*35;const o=t/100*Math.min(i/100,1-i/100),n=e=>{const l=(e+a/30)%12,h=i/100-o*Math.max(Math.min(l-3,9-l,1),-1);return Math.round(255*h)};return[n(0),n(8),n(4)]}cyrb53(s,a=0){let t=3735928559^a,i=1103547991^a;for(let o=0,n;o<s.length;o++)n=s.charCodeAt(o),t=Math.imul(t^n,2654435761),i=Math.imul(i^n,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&i)+(t>>>0)}}exports.default=r;
@@ -5,10 +5,11 @@ declare const districtSolidLineLayerOptions: any;
5
5
  /** 子区图层 */
6
6
  declare const subDistrictLayerOptions: any;
7
7
  declare const subDistrictPointLayerOptions: any;
8
+ declare const subDistrictLineLayerOptions: any;
8
9
  /** 信号机圆点图层 */
9
10
  declare const signalMarkerLayerOptions: any;
10
11
  /** 信号机图标图层 */
11
12
  declare const signalPictureLayerOptions: any;
12
13
  /** 信号机聚合图层 */
13
14
  declare const signalClusterLayerOptions: any;
14
- export { districtDashLineLayerOptions, districtSolidLineLayerOptions, signalClusterLayerOptions, signalMarkerLayerOptions, signalPictureLayerOptions, subDistrictLayerOptions, subDistrictPointLayerOptions };
15
+ export { districtDashLineLayerOptions, districtSolidLineLayerOptions, signalClusterLayerOptions, signalMarkerLayerOptions, signalPictureLayerOptions, subDistrictLayerOptions, subDistrictLineLayerOptions, subDistrictPointLayerOptions };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={id:"districtController",source:[],objectIdField:"ObjectID",geometryType:"polyline",outFields:["*"],fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"subDistrictCount",type:"integer"},{name:"signalCount",type:"integer"},{name:"selected",type:"string"}],renderer:{type:"unique-value",field:"selected",defaultSymbol:{type:"simple-line",style:"long-dash",color:[111,100,255],width:2},uniqueValueInfos:[{value:"false",symbol:{type:"simple-line",style:"long-dash",color:[180,180,180],width:1}}]}},t={id:"districtController",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"polyline",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"subDistrictCount",type:"integer"},{name:"signalCount",type:"integer"},{name:"type",type:"string"},{name:"selected",type:"string"}],popupTemplate:{title:"{name}",content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"区控编号"},{fieldName:"subDistrictCount",label:"子区数量"},{fieldName:"signalCount",label:"信号机数量"}]}]},renderer:{type:"unique-value",field:"selected",defaultSymbol:{type:"simple-line",style:"solid",color:[111,100,255,.4],width:2},uniqueValueInfos:[{value:"false",symbol:{type:"simple-line",style:"solid",color:[180,180,180,.4],width:1}}]}},i={id:"subDistrictController",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"signalCount",type:"integer"},{name:"selected",type:"string"},{name:"type",type:"string"},{name:"color",type:"string"}],popupTemplate:{title:"{subDistrictName} 子区",content:[{type:"fields",fieldInfos:[{fieldName:"subDistrictId",label:"子区编号"},{fieldName:"districtName",label:"所属区控"},{fieldName:"signalCount",label:"信号机数量"}]}]}},r={id:"signalLayer",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",maxScale:5e3,fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"signalId",type:"string"},{name:"nodeId",type:"string"},{name:"isKey",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"type",type:"string"},{name:"selected",type:"string"}],popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]},renderer:{type:"unique-value",field:"isKey",field2:"selected",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:0}},uniqueValueInfos:[{value:"true,true",symbol:{type:"simple-marker",style:"circle",color:[254,172,22,.8],size:8,outline:{color:"white",width:0}}},{value:"false,true",symbol:{type:"simple-marker",style:"circle",color:[5,116,255,.8],size:8,outline:{color:"white",width:0}}},{value:"true,false",symbol:{type:"simple-marker",style:"circle",color:[180,180,180,.8],size:8,outline:{color:"white",width:0}}},{value:"false,false",symbol:{type:"simple-marker",style:"circle",color:[180,180,180,.8],size:8,outline:{color:"white",width:0}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:8,value:9000.954822000003},{size:6,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]}},l={id:"signalLayer",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",minScale:5e3,fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"signalId",type:"string"},{name:"nodeId",type:"string"},{name:"isKey",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"type",type:"string"},{name:"selected",type:"string"}],popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]},renderer:{type:"unique-value",field:"isKey",field2:"selected",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:1}},uniqueValueInfos:[{value:"true,true",symbol:{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:30,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_gjxklk_orange.png"}]}}}},{value:"false,true",symbol:{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:15,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"}]}}}},{value:"true,false",symbol:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_gjxk_gray.png",width:20,height:20}},{value:"false,false",symbol:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_xhj_gray.png",width:20,height:20}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:28,value:2250},{size:24,value:4500}]}]}},s={id:"signalLayer",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",maxScale:5e3,fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"signalId",type:"string"},{name:"nodeId",type:"string"},{name:"isKey",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"type",type:"string"},{name:"type",type:"string"},{name:"selected",type:"string"}],featureReduction:{type:"cluster",clusterRadius:"120px",clusterMaxSize:"50px",clusterMinSize:"30px",symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.cluster_count",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:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""},{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]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:40,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}},popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]},renderer:{type:"simple",symbol:{type:"simple-marker",style:"circle",color:[5,116,255],size:8,outline:{color:"white",width:1}}}};exports.districtDashLineLayerOptions=e;exports.districtSolidLineLayerOptions=t;exports.signalClusterLayerOptions=s;exports.signalMarkerLayerOptions=r;exports.signalPictureLayerOptions=l;exports.subDistrictPointLayerOptions=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={id:"districtController",source:[],objectIdField:"ObjectID",geometryType:"polyline",outFields:["*"],fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"subDistrictCount",type:"integer"},{name:"signalCount",type:"integer"},{name:"selected",type:"string"}],renderer:{type:"unique-value",field:"selected",defaultSymbol:{type:"simple-line",style:"long-dash",color:[111,100,255],width:2},uniqueValueInfos:[{value:"false",symbol:{type:"simple-line",style:"long-dash",color:[180,180,180],width:1}}]}},t={id:"districtController",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"polyline",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"subDistrictCount",type:"integer"},{name:"signalCount",type:"integer"},{name:"type",type:"string"},{name:"selected",type:"string"}],popupTemplate:{title:"{name}",content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"区控编号"},{fieldName:"subDistrictCount",label:"子区数量"},{fieldName:"signalCount",label:"信号机数量"}]}]},renderer:{type:"unique-value",field:"selected",defaultSymbol:{type:"simple-line",style:"solid",color:[111,100,255,.4],width:2},uniqueValueInfos:[{value:"false",symbol:{type:"simple-line",style:"solid",color:[180,180,180,.4],width:1}}]}},i={id:"subDistrictPointController",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"signalCount",type:"integer"},{name:"selected",type:"string"},{name:"type",type:"string"},{name:"color",type:"string"}],popupTemplate:{title:"{subDistrictName} 子区",content:[{type:"fields",fieldInfos:[{fieldName:"subDistrictId",label:"子区编号"},{fieldName:"districtName",label:"所属区控"},{fieldName:"signalCount",label:"信号机数量"}]}]}},r={id:"subDistrictLineController",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"polyline",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"districtId",type:"string"},{name:"subDistrictId",type:"string"},{name:"fromNode",type:"string"},{name:"toNode",type:"string"},{name:"color",type:"string"}]},s={id:"signalLayer",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",maxScale:5e3,fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"signalId",type:"string"},{name:"nodeId",type:"string"},{name:"isKey",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"type",type:"string"},{name:"selected",type:"string"}],popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]},renderer:{type:"unique-value",field:"isKey",field2:"selected",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:0}},uniqueValueInfos:[{value:"true,true",symbol:{type:"simple-marker",style:"circle",color:[254,172,22,.8],size:8,outline:{color:"white",width:0}}},{value:"false,true",symbol:{type:"simple-marker",style:"circle",color:[5,116,255,.8],size:8,outline:{color:"white",width:0}}},{value:"true,false",symbol:{type:"simple-marker",style:"circle",color:[180,180,180,.8],size:8,outline:{color:"white",width:0}}},{value:"false,false",symbol:{type:"simple-marker",style:"circle",color:[180,180,180,.8],size:8,outline:{color:"white",width:0}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:8,value:9000.954822000003},{size:6,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]}},l={id:"signalLayer",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",minScale:5e3,fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"signalId",type:"string"},{name:"nodeId",type:"string"},{name:"isKey",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"type",type:"string"},{name:"selected",type:"string"}],popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]},renderer:{type:"unique-value",field:"isKey",field2:"selected",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:1}},uniqueValueInfos:[{value:"true,true",symbol:{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:30,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_gjxklk_orange.png"}]}}}},{value:"false,true",symbol:{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:15,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"}]}}}},{value:"true,false",symbol:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_gjxk_gray.png",width:20,height:20}},{value:"false,false",symbol:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_xhj_gray.png",width:20,height:20}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:28,value:2250},{size:24,value:4500}]}]}},n={id:"signalLayer",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",maxScale:5e3,fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"signalId",type:"string"},{name:"nodeId",type:"string"},{name:"isKey",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"type",type:"string"},{name:"type",type:"string"},{name:"selected",type:"string"}],featureReduction:{type:"cluster",clusterRadius:"120px",clusterMaxSize:"50px",clusterMinSize:"30px",symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.cluster_count",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:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""},{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]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:40,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}},popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]},renderer:{type:"simple",symbol:{type:"simple-marker",style:"circle",color:[5,116,255],size:8,outline:{color:"white",width:1}}}};exports.districtDashLineLayerOptions=e;exports.districtSolidLineLayerOptions=t;exports.signalClusterLayerOptions=n;exports.signalMarkerLayerOptions=s;exports.signalPictureLayerOptions=l;exports.subDistrictLineLayerOptions=r;exports.subDistrictPointLayerOptions=i;
@@ -8,19 +8,9 @@ export default class SignalControlAreaController1 {
8
8
  private districtRenderer;
9
9
  private subDistrictRenderer;
10
10
  private signalRenderer;
11
- private clickHandler;
12
- private districtControllerOid;
13
- private subDistrictControllerOid;
14
- private signalOid;
15
- private popupEnabled;
16
11
  private mapConfig;
12
+ private roadLines;
17
13
  constructor(view: __esri.MapView | __esri.SceneView);
18
- /** 暂存等待绘制的区控graphic */
19
- private districtGraphics;
20
- /** 暂存等待绘制的子区graphic */
21
- private subDistrictGraphics;
22
- /** 暂存等待绘制的信号机graphic */
23
- private signalGraphics;
24
14
  /**
25
15
  * 显示所有区控、子区、信号机
26
16
  * @param params
@@ -62,15 +52,10 @@ export default class SignalControlAreaController1 {
62
52
  message: string;
63
53
  }>;
64
54
  /**
65
- * 生成区控、子区和信号机graphic
66
- * @param districtController
67
- * @param isDistrict 是否是区控
55
+ * 获取道路线
68
56
  * @returns
69
57
  */
70
- private generateGraphic;
71
- /**
72
- * 重置所有graphic的置灰状态
73
- */
58
+ private loadRoadLine;
74
59
  /**
75
60
  * 加载支队图层
76
61
  * 现场环境用url创建FeatureLayer有各种问题,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/geometry"),m=require("@arcgis/core/geometry/support/webMercatorUtils"),g=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/GraphicsLayer"),D=require("@turf/buffer"),R=require("@turf/convex"),S=require("@turf/helpers"),G=require("concaveman"),O=require("../../stores/index.js"),C=require("./district-controller.js"),I=require("./district-renderer.js"),v=require("./signal-renderer.js"),L=require("./sub-district-renderer.js");function q(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const l=q(S);class k{constructor(e){this.detachmentLayerLoaded=!1,this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,this.popupEnabled=!0,this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const t=O.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.detachmentLayer=new w,this.view.map.add(this.detachmentLayer),this.districtRenderer=new I.default(e,this.hasGpu),this.subDistrictRenderer=new L.default(e,this.hasGpu),this.signalRenderer=new v.default(e,this.hasGpu)}async showSignalControlArea(e){this.detachmentLayerLoaded||await this.loadDetachmentLayer(),await this.clearSignalControlArea(),this.districtRenderer.setVisible(!1),this.subDistrictRenderer.setVisible(!1),this.signalRenderer.setClusterVisible(!1),this.signalRenderer.setPointVisible(!1);const t=[],s=[];for(const r of e.areaList){const n=new C.default(r,e.style||"");t.push(n),s.push(...n.subDistricts)}return this.districtRenderer.style=e.style||"",await this.districtRenderer.showDistricts(t),await this.subDistrictRenderer.showSubDistricts(s),await this.signalRenderer.showSignals(t),{status:0,message:"ok"}}async clearSignalControlArea(){return this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,await this.districtRenderer.clearDistricts(),await this.subDistrictRenderer.clearSubDistricts(),await this.signalRenderer.clearSignals(),{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtRenderer.setVisible(e.visible);break;case"subDistrict":this.subDistrictRenderer.setVisible(e.visible);break;case"signal":this.signalRenderer.setPointVisible(e.visible);break;case"signalCluster":this.signalRenderer.setClusterVisible(e.visible);break;case"shanghai_district":this.detachmentLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":return await this.districtRenderer.locateDistrict(e.id);case"subDistrict":return await this.subDistrictRenderer.locateSubDistrict(e.id);case"signal":return await this.signalRenderer.locateSignal(e.id);default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){switch(this.view.closePopup(),e.type){case"district":return await this.districtRenderer.highlightDistrict(e.id)?(this.subDistrictRenderer.filter("district",e.id),this.signalRenderer.filter("district",e.id),{status:0,message:"ok"}):{status:1,message:"未找到区控"};case"subDistrict":{const{count:t,parentId:s}=await this.subDistrictRenderer.highlightSubDistrict(e.id);return t>0?(this.districtRenderer.filter(s),this.signalRenderer.filter("subDistrict",e.id),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}case"signal":{const{districtId:t,subDistrictId:s,count:r}=await this.signalRenderer.highlightSignal(e.id);return r>0?(this.districtRenderer.filter(t),this.subDistrictRenderer.filter("subDistrict",s),await this.view.goTo({target:this.signalGraphics,scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){return this.districtRenderer.resetFilter(),this.subDistrictRenderer.resetFilter(),this.signalRenderer.resetFilter(),{status:0,message:"ok"}}generateGraphic(e,t,s){const r=e.getAllSignalCoordinates();let n=null;if(r.length>=2)if(r.length===2)n=l.lineString(r);else{if(t){const i=l.featureCollection(r.map(c=>l.point(c)));n=R(i)}else{const i=G(r,.5);i.length>=4&&(n=l.polygon([i]))}n||(n=l.lineString(r))}else if(r.length===1)n=l.point(r[0]);else return;const a=D(n.geometry,t?200:30,{units:"meters"}),u=new g({geometry:{type:"polyline",paths:a.geometry.coordinates},attributes:{ObjectID:t?this.districtControllerOid++:this.subDistrictControllerOid++,id:e.id,name:e.name,subDistrictCount:e.subDistrictCount,signalCount:e.signalCount,parentId:e.parentId,parentName:e.parentName,selected:s,type:t?"district":"subDistrict"}});t?this.districtGraphics.push(u):this.subDistrictGraphics.push(u);for(const i of e.subDistricts)this.generateGraphic(i,!1,s);e.signals.forEach(i=>{const c=new g({geometry:{type:"point",x:i.longitude,y:i.latitude},attributes:{ObjectID:this.signalOid++,id:i.id,name:i.name,signalId:i.signalId,nodeId:i.nodeId,isKey:i.isKey,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,type:"signal",selected:!0}});this.signalGraphics.push(c)})}async loadDetachmentLayer(){const e=this.mapConfig.baseLayers;if(!e)return;const t=e.find(s=>s.options.id==="shanghai_district");if(t)try{const r=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),n=[],{renderer:a,labelingInfo:u}=t.options;r.features.forEach(i=>{const c=i.attributes.ZD_NAME;if(c!=="高架支队"){let d=new y.Polygon({rings:i.geometry.rings});d=m.webMercatorToGeographic(d);const h=new g({geometry:d,attributes:i.attributes});if(a){if(a.type==="simple")h.symbol=a.symbol;else if(a.type==="unique-value"){const b=h.getAttribute("OBJECTID"),f=a.uniqueValueInfos.find(p=>p.value==b);h.symbol=f?f.symbol:a.defaultSymbol}}else h.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(n.push(h),u&&c!=="边防港航支队"&&c!=="机场支队"){const b=new g({geometry:d.centroid,symbol:{...u.symbol,text:c}});n.push(b)}}}),this.detachmentLayer.addMany(n),this.detachmentLayerLoaded=!0}catch(s){console.error("加载支队图层失败:",s);return}}}exports.default=k;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/geometry"),y=require("@arcgis/core/geometry/support/webMercatorUtils"),g=require("@arcgis/core/Graphic"),R=require("@arcgis/core/layers/GraphicsLayer"),w=require("papaparse"),D=require("../../stores/index.js"),p=require("./district-controller.js"),m=require("./district-renderer.js"),L=require("./signal-renderer.js"),S=require("./sub-district-renderer.js");class C{constructor(e){this.detachmentLayerLoaded=!1,this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const t=D.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.detachmentLayer=new R,this.view.map.add(this.detachmentLayer),this.districtRenderer=new m.default(e,this.hasGpu),this.subDistrictRenderer=new S.default(e,this.hasGpu),this.signalRenderer=new L.default(e,this.hasGpu)}async showSignalControlArea(e){this.detachmentLayerLoaded||await this.loadDetachmentLayer(),this.roadLines||(await this.loadRoadLine(),this.subDistrictRenderer.roadLines=this.roadLines),await this.clearSignalControlArea(),this.districtRenderer.setVisible(!1),this.subDistrictRenderer.setVisible(!1),this.signalRenderer.setClusterVisible(!1),this.signalRenderer.setPointVisible(!1);const t=[],s=[];for(const a of e.areaList){const i=new p.default(a,e.style||"");t.push(i),s.push(...i.subDistricts)}return this.districtRenderer.style=e.style||"",await this.districtRenderer.showDistricts(t),await this.subDistrictRenderer.showSubDistricts(s),await this.signalRenderer.showSignals(t),{status:0,message:"ok"}}async clearSignalControlArea(){return await this.districtRenderer.clearDistricts(),await this.subDistrictRenderer.clearSubDistricts(),await this.signalRenderer.clearSignals(),{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtRenderer.setVisible(e.visible);break;case"subDistrict":this.subDistrictRenderer.setVisible(e.visible);break;case"signal":this.signalRenderer.setPointVisible(e.visible);break;case"signalCluster":this.signalRenderer.setClusterVisible(e.visible);break;case"shanghai_district":this.detachmentLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":return await this.districtRenderer.locateDistrict(e.id);case"subDistrict":return await this.subDistrictRenderer.locateSubDistrict(e.id);case"signal":return await this.signalRenderer.locateSignal(e.id);default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){switch(this.view.closePopup(),e.type){case"district":return await this.districtRenderer.highlightDistrict(e.id)?(this.subDistrictRenderer.filter("district",e.id),this.signalRenderer.filter("district",e.id),this.roadLines&&this.roadLines.length>0&&await this.subDistrictRenderer.showRoads(e.id),{status:0,message:"ok"}):{status:1,message:"未找到区控"};case"subDistrict":{const{count:t,parentId:s}=await this.subDistrictRenderer.highlightSubDistrict(e.id);return t>0?(this.districtRenderer.filter(s),this.signalRenderer.filter("subDistrict",e.id),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}case"signal":{const{districtId:t,subDistrictId:s,count:a}=await this.signalRenderer.highlightSignal(e.id);return a>0?(this.districtRenderer.filter(t),this.subDistrictRenderer.filter("subDistrict",s),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){return this.districtRenderer.resetFilter(),this.subDistrictRenderer.resetFilter(),this.signalRenderer.resetFilter(),{status:0,message:"ok"}}async loadRoadLine(){var t;const e=(t=this.mapConfig.signalControlArea)==null?void 0:t.roadLayerUrl;if(!e){console.warn("未配置道路线图层URL");return}try{const a=await(await fetch(`/GisViewerAssets/${e}`)).text();w.parse(a,{header:!0,skipEmptyLines:!0,complete:i=>{const{data:r}=i;this.roadLines=r.map(n=>({id:n.ROADSECT_ID,fromNode:n.FROM_NODE_ID,toNode:n.TO_NODE_ID,coordinates:JSON.parse(n.GEOM).coordinates}))},error:i=>{console.error("道路线CSV解析失败:",i)}})}catch(s){console.error("读取道路线CSV失败:",s)}}async loadDetachmentLayer(){const e=this.mapConfig.baseLayers;if(!e)return;const t=e.find(s=>s.options.id==="shanghai_district");if(t)try{const a=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),i=[],{renderer:r,labelingInfo:n}=t.options;a.features.forEach(d=>{const c=d.attributes.ZD_NAME;if(c!=="高架支队"){let l=new f.Polygon({rings:d.geometry.rings});l=y.webMercatorToGeographic(l);const o=new g({geometry:l,attributes:d.attributes});if(r){if(r.type==="simple")o.symbol=r.symbol;else if(r.type==="unique-value"){const h=o.getAttribute("OBJECTID"),u=r.uniqueValueInfos.find(b=>b.value==h);o.symbol=u?u.symbol:r.defaultSymbol}}else o.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(i.push(o),n&&c!=="边防港航支队"&&c!=="机场支队"){const h=new g({geometry:l.centroid,symbol:{...n.symbol,text:c}});i.push(h)}}}),this.detachmentLayer.addMany(i),this.detachmentLayerLoaded=!0}catch(s){console.error("加载支队图层失败:",s);return}}}exports.default=C;
@@ -1,12 +1,15 @@
1
- import { IResult } from '../../../types';
1
+ import { IResult, IRoadLine } from '../../../types';
2
2
  import DistrictController from './district-controller';
3
3
  export default class SubDistrictRenderer {
4
4
  private view;
5
5
  private hasGpu;
6
6
  private clickHandler;
7
7
  private subDistrictPointLayer;
8
+ private subDistrictLineLayer;
9
+ roadLines: IRoadLine[];
8
10
  constructor(view: __esri.MapView | __esri.SceneView, hasGpu: boolean);
9
11
  showSubDistricts(controllers: DistrictController[]): Promise<void>;
12
+ showRoads(districtId: string): Promise<void>;
10
13
  clearSubDistricts(): Promise<void>;
11
14
  setVisible(visible: boolean): void;
12
15
  /**
@@ -23,8 +26,17 @@ export default class SubDistrictRenderer {
23
26
  count: number;
24
27
  parentId: string;
25
28
  }>;
29
+ /**
30
+ * 按照区控、子区id显示子区
31
+ * @param type 类型,district 或 subDistrict
32
+ * @param id
33
+ */
26
34
  filter(type: string, id: string): void;
35
+ /**
36
+ * 重置过滤器,显示所有子区
37
+ */
27
38
  resetFilter(): void;
28
- private currentRenderer;
39
+ private currentPointRenderer;
40
+ private currentLineRenderer;
29
41
  private viewHitTest;
30
42
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("@arcgis/core/Graphic"),o=require("@arcgis/core/layers/FeatureLayer"),c=require("./layer-symbol.js");class l{constructor(e,i){this.view=e,this.hasGpu=i,this.subDistrictPointLayer=new o(c.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=e.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.view.map.add(this.subDistrictPointLayer),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this))}async showSubDistricts(e){await this.clearSubDistricts();let i=0;const s=[],r=[];e.forEach(t=>{r.push({value:t.id,label:t.name,symbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[...t.areaColor],width:4}}}),t.signals.forEach(a=>{const u=new n({geometry:{type:"point",longitude:a.longitude,latitude:a.latitude},attributes:{ObjectID:i++,id:a.id,name:a.name,subDistrictId:t.id,subDistrictName:t.name,districtId:t.parentId,districtName:t.parentName,signalCount:t.signalCount,color:t.areaColor.join(","),type:"subDistrict"}});s.push(u)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:"gray",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.currentRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:s}),await this.view.goTo(s,{duration:this.hasGpu?1e3:0})}async clearSubDistricts(){const e=await this.subDistrictPointLayer.queryFeatures();e.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictPointLayer.definitionExpression="1=1"}setVisible(e){this.subDistrictPointLayer.visible=e}async locateSubDistrict(e){const i=this.subDistrictPointLayer.createQuery();i.where=`subDistrictId = '${e}'`,i.returnGeometry=!0;const s=await this.subDistrictPointLayer.queryFeatures(i);return s.features.length>0?(await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}async highlightSubDistrict(e){let i="";const s=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${e}'`;const r=await this.subDistrictPointLayer.queryFeatures(),t=r.features.length;return t>0?(i=r.features[0].attributes.districtId,await this.view.goTo(r.features,{duration:this.hasGpu?1e3:0})):this.subDistrictPointLayer.definitionExpression=s,{count:t,parentId:i}}filter(e,i){const s=`${e==="district"?"districtId":"subDistrictId"} = '${i}'`;this.subDistrictPointLayer.definitionExpression=s}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1"}async viewHitTest(e){var r;const s=(r=(await this.view.hitTest(e,{include:[this.subDistrictPointLayer]})).results)==null?void 0:r.filter(t=>t.type==="graphic");if(s.length===0)this.currentRenderer&&(this.subDistrictPointLayer.renderer=this.currentRenderer);else{const t=s[0].graphic;this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[180,180,180,.5],width:4}},defaultLabel:"其他子区",uniqueValueInfos:[{value:t.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:t.attributes.color.split(",").map(Number),width:4}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]}}}}exports.default=l;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("@arcgis/core/Graphic"),D=require("@arcgis/core/layers/FeatureLayer"),v=require("./layer-symbol.js");class w{constructor(e,t){this.view=e,this.hasGpu=t,this.subDistrictPointLayer=new D(v.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=e.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new D(v.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=e.spatialReference,this.subDistrictLineLayer.popupEnabled=!1,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(e){await this.clearSubDistricts(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let t=0;const s=[],r=[];e.forEach(i=>{r.push({value:i.id,label:i.name,symbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[...i.areaColor],width:4}}}),i.signals.forEach(a=>{const u=new L({geometry:{type:"point",longitude:a.longitude,latitude:a.latitude},attributes:{ObjectID:t++,id:a.id,name:a.name,subDistrictId:i.id,subDistrictName:i.name,districtId:i.parentId,districtName:i.parentName,signalCount:i.signalCount,color:i.areaColor.join(","),type:"subDistrict"}});s.push(u)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:[180,180,180,.5],size:"8px",outline:{color:"white",width:1}},defaultLabel:"其他子区",uniqueValueInfos:r,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:s}),await this.view.goTo(s,{duration:this.hasGpu?1e3:0})}async showRoads(e){const t=this.subDistrictPointLayer.createQuery();t.where=`districtId = '${e}'`;const s=await this.subDistrictPointLayer.queryFeatures(t),r=new Map;s.features.forEach(u=>{var o;const{subDistrictId:l,color:c,id:n}=u.attributes;r.has(l)||r.set(l,{color:c,signalIds:[]}),(o=r.get(l))==null||o.signalIds.push(n)});const i=[],a=[];for(const u of r){let l=0;const c=u[0];i.push({value:c,symbol:{type:"simple-line",color:u[1].color.split(",").map(Number),width:2,style:"solid"}});const n=u[1].signalIds;if(!(n.length<2))for(let o=0;o<n.length;o++)for(let d=0;d<n.length;d++){if(o===d)continue;const p=n[o],y=n[d];if(a.some(h=>{const f=h.attributes;return f&&f.fromNode===y&&f.toNode===p}))continue;const b=this.roadLines.find(h=>h.fromNode===p&&h.toNode===y);if(!b)continue;const m=new L({geometry:{type:"polyline",paths:[b.coordinates]},attributes:{ObjectID:l++,id:b.id,districtId:e,subDistrictId:c,fromNode:p,toNode:y,color:u[1].color}});a.push(m)}}this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",color:[180,180,180,.5],width:2,style:"solid"},defaultLabel:"其他子区",uniqueValueInfos:i,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentLineRenderer=this.subDistrictLineLayer.renderer.clone(),await this.subDistrictLineLayer.applyEdits({addFeatures:a})}async clearSubDistricts(){var s;const e=await this.subDistrictPointLayer.queryFeatures();e.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictPointLayer.definitionExpression="1=1";const t=await this.subDistrictLineLayer.queryFeatures();t.features.length>0&&await this.subDistrictLineLayer.applyEdits({deleteFeatures:t.features}),this.subDistrictLineLayer.definitionExpression="1=1",(s=this.clickHandler)==null||s.remove()}setVisible(e){this.subDistrictPointLayer.visible=e,this.subDistrictLineLayer.visible=e}async locateSubDistrict(e){const t=this.subDistrictPointLayer.createQuery();t.where=`subDistrictId = '${e}'`,t.returnGeometry=!0;const s=await this.subDistrictPointLayer.queryFeatures(t);return s.features.length>0?(await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(e){let t="";const s=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${e}'`;const r=await this.subDistrictPointLayer.queryFeatures(),i=r.features.length;return i>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${e}'`,t=r.features[0].attributes.districtId,await this.view.goTo(r.features,{duration:this.hasGpu?1e3:0})):this.subDistrictPointLayer.definitionExpression=s,{count:i,parentId:t}}filter(e,t){const s=`${e==="district"?"districtId":"subDistrictId"} = '${t}'`;this.subDistrictPointLayer.definitionExpression=s,this.subDistrictLineLayer.definitionExpression=s}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(e){var r;const s=(r=(await this.view.hitTest(e,{include:[this.subDistrictPointLayer]})).results)==null?void 0:r.filter(i=>i.type==="graphic");if(s.length===0)this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const i=s[0].graphic;this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[180,180,180,.5],width:4}},defaultLabel:"其他子区",uniqueValueInfos:[{value:i.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:i.attributes.color.split(",").map(Number),width:4}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",style:"solid",color:[180,180,180,.5],width:"8px"},defaultLabel:"其他子区",uniqueValueInfos:[{value:i.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:i.attributes.color.split(",").map(Number),width:"8px"}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]}}}}exports.default=w;
@@ -302,3 +302,9 @@ export interface IShowGreenWaveBandParams {
302
302
  coordinates: number[][];
303
303
  nodeList: INode[];
304
304
  }
305
+ export interface IRoadLine {
306
+ id: string;
307
+ fromNode: string;
308
+ toNode: string;
309
+ coordinates: number[][];
310
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.230",
3
+ "version": "1.0.232",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [
@@ -40,6 +40,7 @@
40
40
  "fast-xml-parser": "^4.4.0",
41
41
  "md5": "^2.3.0",
42
42
  "pako": "^2.1.0",
43
+ "papaparse": "^5.5.3",
43
44
  "pinia": "^2.0.33",
44
45
  "proj4": "^2.11.0",
45
46
  "three": "^0.156.1",