gisviewer-vue3-arcgis 1.0.211 → 1.0.212

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.
@@ -50,8 +50,8 @@ class Z {
50
50
  }), this.view.popup.visibleElements = {
51
51
  closeButton: !0,
52
52
  collapseButton: !1,
53
- actionBar: !1,
54
- featureNavigation: !1
53
+ actionBar: !0,
54
+ featureNavigation: !0
55
55
  }, this.view.popup.dockOptions = {
56
56
  buttonEnabled: !1,
57
57
  breakpoint: !1
@@ -12,6 +12,7 @@ export default class SignalControlAreaController1 {
12
12
  /** 信号机图层 */
13
13
  private signalMarkerLayer;
14
14
  private signalPictureLayer;
15
+ private signalClusterLayer;
15
16
  private districtControllerOid;
16
17
  private subDistrictControllerOid;
17
18
  private signalOid;
@@ -1,16 +1,16 @@
1
- import y from "@arcgis/core/Graphic";
1
+ import d from "@arcgis/core/Graphic";
2
2
  import l from "@arcgis/core/layers/FeatureLayer";
3
3
  import c from "@turf/buffer";
4
4
  import p from "@turf/convex";
5
5
  import * as n from "@turf/helpers";
6
- import h from "concaveman";
7
- import m from "../../stores/index.mjs";
6
+ import m from "concaveman";
7
+ import h from "../../stores/index.mjs";
8
8
  import g from "./district-controller.mjs";
9
9
  class S {
10
10
  constructor(e) {
11
11
  var t;
12
12
  this.districtControllerOid = 0, this.subDistrictControllerOid = 0, this.signalOid = 0, this.districtGraphics = [], this.subDistrictGraphics = [], this.signalGraphics = [], this.view = e, this.hasGpu = localStorage.getItem("gpu") !== "Unknown";
13
- const s = m.useAppDataStore.mapConfig;
13
+ const s = h.useAppDataStore.mapConfig;
14
14
  this.openDriveServer = (t = s.openDriveServer) == null ? void 0 : t.url, this.districtControllerDashLayer = new l({
15
15
  id: "districtController",
16
16
  spatialReference: e.spatialReference,
@@ -307,6 +307,220 @@ class S {
307
307
  }
308
308
  ]
309
309
  }
310
+ }), this.signalClusterLayer = new l({
311
+ id: "signalLayer",
312
+ spatialReference: e.spatialReference,
313
+ source: [],
314
+ objectIdField: "ObjectID",
315
+ outFields: ["*"],
316
+ geometryType: "point",
317
+ maxScale: 5e3,
318
+ fields: [
319
+ {
320
+ name: "ObjectID",
321
+ type: "oid"
322
+ },
323
+ {
324
+ name: "id",
325
+ type: "string"
326
+ },
327
+ {
328
+ name: "name",
329
+ type: "string"
330
+ },
331
+ {
332
+ name: "signalId",
333
+ type: "string"
334
+ },
335
+ {
336
+ name: "nodeId",
337
+ type: "string"
338
+ },
339
+ {
340
+ name: "isKey",
341
+ type: "string"
342
+ },
343
+ {
344
+ name: "districtId",
345
+ type: "string"
346
+ },
347
+ {
348
+ name: "districtName",
349
+ type: "string"
350
+ },
351
+ {
352
+ name: "subDistrictId",
353
+ type: "string"
354
+ },
355
+ {
356
+ name: "subDistrictName",
357
+ type: "string"
358
+ }
359
+ ],
360
+ featureReduction: {
361
+ type: "cluster",
362
+ clusterRadius: "120px",
363
+ clusterMaxSize: "50px",
364
+ clusterMinSize: "30px",
365
+ symbol: {
366
+ type: "cim",
367
+ data: {
368
+ type: "CIMSymbolReference",
369
+ primitiveOverrides: [
370
+ {
371
+ // 将textGraphic的TextString替换为graphic.attributes.name
372
+ type: "CIMPrimitiveOverride",
373
+ primitiveName: "textGraphic",
374
+ propertyName: "TextString",
375
+ valueExpressionInfo: {
376
+ type: "CIMExpressionInfo",
377
+ title: "Custom",
378
+ expression: "$feature.cluster_count",
379
+ returnType: "Default"
380
+ }
381
+ }
382
+ ],
383
+ symbol: {
384
+ type: "CIMPointSymbol",
385
+ symbolLayers: [
386
+ // 路口名称
387
+ {
388
+ type: "CIMVectorMarker",
389
+ size: 32,
390
+ colorLocked: !0,
391
+ anchorPointUnits: "Relative",
392
+ frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
393
+ markerGraphics: [
394
+ {
395
+ type: "CIMMarkerGraphic",
396
+ primitiveName: "textGraphic",
397
+ geometry: { x: 0, y: 0 },
398
+ symbol: {
399
+ type: "CIMTextSymbol",
400
+ height: 16,
401
+ horizontalAlignment: "Center",
402
+ offsetX: 0,
403
+ offsetY: 30,
404
+ symbol: {
405
+ type: "CIMPolygonSymbol",
406
+ symbolLayers: [
407
+ {
408
+ type: "CIMSolidFill",
409
+ enable: !0,
410
+ color: [255, 255, 255, 255]
411
+ }
412
+ ]
413
+ },
414
+ verticalAlignment: "Center"
415
+ },
416
+ textString: ""
417
+ },
418
+ {
419
+ type: "CIMMarkerGraphic",
420
+ geometry: {
421
+ rings: [
422
+ [
423
+ [-15, 40],
424
+ [15, 40],
425
+ [15, 20],
426
+ [-15, 20],
427
+ [-15, 40]
428
+ ]
429
+ ]
430
+ },
431
+ symbol: {
432
+ type: "CIMPolygonSymbol",
433
+ symbolLayers: [
434
+ {
435
+ type: "CIMSolidFill",
436
+ enable: !0,
437
+ color: [2, 72, 200, 255]
438
+ },
439
+ // 边框
440
+ {
441
+ type: "CIMSolidStroke",
442
+ enable: !0,
443
+ width: 5,
444
+ color: [2, 72, 200, 128]
445
+ }
446
+ ]
447
+ }
448
+ }
449
+ ],
450
+ scaleSymbolsProportionally: !0,
451
+ respectFrame: !0
452
+ },
453
+ // 路口图标
454
+ {
455
+ type: "CIMPictureMarker",
456
+ enable: !0,
457
+ anchorPoint: {
458
+ x: 0,
459
+ y: 0
460
+ },
461
+ anchorPointUnits: "Relative",
462
+ size: 40,
463
+ rotateClockwise: !0,
464
+ textureFilter: "Picture",
465
+ url: "/GisViewerAssets/Images/cross/gis_xhj_blue.png"
466
+ }
467
+ ]
468
+ }
469
+ }
470
+ },
471
+ popupTemplate: {
472
+ title: "聚合详情",
473
+ content: "聚合信号机 <b>{cluster_count}</b> 个",
474
+ fieldInfos: [
475
+ {
476
+ fieldName: "cluster_count",
477
+ format: {
478
+ digitSeparator: !0,
479
+ places: 0
480
+ }
481
+ }
482
+ ]
483
+ }
484
+ },
485
+ popupTemplate: {
486
+ title: "{name}信号机",
487
+ content: [
488
+ {
489
+ type: "fields",
490
+ fieldInfos: [
491
+ {
492
+ fieldName: "districtName",
493
+ label: "区控名称"
494
+ },
495
+ {
496
+ fieldName: "subDistrictName",
497
+ label: "子区名称"
498
+ },
499
+ {
500
+ fieldName: "signalId",
501
+ label: "信号机编号"
502
+ },
503
+ {
504
+ fieldName: "nodeId",
505
+ label: "路口编号"
506
+ }
507
+ ]
508
+ }
509
+ ]
510
+ },
511
+ renderer: {
512
+ type: "simple",
513
+ symbol: {
514
+ type: "simple-marker",
515
+ style: "circle",
516
+ color: [5, 116, 255],
517
+ size: 8,
518
+ outline: {
519
+ color: "white",
520
+ width: 1
521
+ }
522
+ }
523
+ }
310
524
  }), this.signalPictureLayer = new l({
311
525
  id: "signalLayer",
312
526
  spatialReference: e.spatialReference,
@@ -582,7 +796,8 @@ class S {
582
796
  this.districtControllerDashLayer,
583
797
  this.subDistrictControllerLayer,
584
798
  this.signalMarkerLayer,
585
- this.signalPictureLayer
799
+ this.signalPictureLayer,
800
+ this.signalClusterLayer
586
801
  ]);
587
802
  }
588
803
  /**
@@ -591,7 +806,7 @@ class S {
591
806
  * @returns
592
807
  */
593
808
  async showSignalControlArea(e) {
594
- await this.clearSignalControlArea(), this.districtControllerDashLayer.visible = !0, this.districtControllerSolidLayer.visible = !0, this.subDistrictControllerLayer.visible = !1, this.signalMarkerLayer.visible = !1, this.signalPictureLayer.visible = !1;
809
+ await this.clearSignalControlArea(), this.districtControllerDashLayer.visible = !1, this.districtControllerSolidLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.signalMarkerLayer.visible = !1, this.signalPictureLayer.visible = !1, this.signalClusterLayer.visible = !0;
595
810
  for (const i of e.areaList) {
596
811
  const s = new g(
597
812
  i,
@@ -609,6 +824,8 @@ class S {
609
824
  addFeatures: this.signalGraphics
610
825
  }), await this.signalPictureLayer.applyEdits({
611
826
  addFeatures: this.signalGraphics
827
+ }), await this.signalClusterLayer.applyEdits({
828
+ addFeatures: this.signalGraphics
612
829
  }), this.signalGraphics = [], { status: 0, message: "ok" };
613
830
  }
614
831
  /**
@@ -628,7 +845,9 @@ class S {
628
845
  deleteFeatures: e.features
629
846
  }), this.signalMarkerLayer.definitionExpression = "1=1", e = await this.signalPictureLayer.queryFeatures(), await this.signalPictureLayer.applyEdits({
630
847
  deleteFeatures: e.features
631
- }), this.signalPictureLayer.definitionExpression = "1=1", { status: 0, message: "ok" };
848
+ }), this.signalPictureLayer.definitionExpression = "1=1", e = await this.signalClusterLayer.queryFeatures(), await this.signalClusterLayer.applyEdits({
849
+ deleteFeatures: e.features
850
+ }), this.signalClusterLayer.definitionExpression = "1=1", { status: 0, message: "ok" };
632
851
  }
633
852
  /**
634
853
  * 设置区控、子区、信号机图层可见性
@@ -646,6 +865,9 @@ class S {
646
865
  case "signal":
647
866
  this.signalMarkerLayer.visible = e.visible, this.signalPictureLayer.visible = e.visible;
648
867
  break;
868
+ case "signalCluster":
869
+ this.signalClusterLayer.visible = e.visible;
870
+ break;
649
871
  }
650
872
  return { status: 0, message: "ok" };
651
873
  }
@@ -764,11 +986,11 @@ class S {
764
986
  else {
765
987
  if (i) {
766
988
  const a = n.featureCollection(
767
- t.map((u) => n.point(u))
989
+ t.map((y) => n.point(y))
768
990
  );
769
991
  r = p(a);
770
992
  } else {
771
- const a = h(t, 0.5);
993
+ const a = m(t, 0.5);
772
994
  a.length >= 4 && (r = n.polygon([a]));
773
995
  }
774
996
  r || (r = n.lineString(t));
@@ -784,7 +1006,7 @@ class S {
784
1006
  {
785
1007
  units: "meters"
786
1008
  }
787
- ), d = new y({
1009
+ ), u = new d({
788
1010
  geometry: {
789
1011
  type: "polyline",
790
1012
  paths: o.geometry.coordinates
@@ -800,11 +1022,11 @@ class S {
800
1022
  style: s
801
1023
  }
802
1024
  });
803
- i ? this.districtGraphics.push(d) : this.subDistrictGraphics.push(d);
1025
+ i ? this.districtGraphics.push(u) : this.subDistrictGraphics.push(u);
804
1026
  for (const a of e.subDistricts)
805
1027
  this.generateGraphic(a, !1, s);
806
1028
  e.signals.forEach((a) => {
807
- const u = new y({
1029
+ const y = new d({
808
1030
  geometry: {
809
1031
  type: "point",
810
1032
  x: a.longitude,
@@ -823,7 +1045,7 @@ class S {
823
1045
  subDistrictName: i ? "" : e.name
824
1046
  }
825
1047
  });
826
- this.signalGraphics.push(u);
1048
+ this.signalGraphics.push(y);
827
1049
  });
828
1050
  }
829
1051
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("@arcgis/core/Basemap"),d=require("@arcgis/core/config"),z=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/MapImageLayer"),x=require("@arcgis/core/layers/TileLayer"),I=require("@arcgis/core/layers/WebTileLayer"),S=require("@arcgis/core/Map"),R=require("@arcgis/core/views/MapView"),H=require("@arcgis/core/views/SceneView"),_=require("@turf/destination"),G=require("@turf/helpers"),j=require("./custom-layer/custom-wmts-layer.js");function b(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const T=b(z),m=b(L),B=b(G);function q(r,e){return r&&(r.startsWith("http://")||r.startsWith("https://")?r:e+r)}class N{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){var u,y,v,M;this.mapConfig=e.mapConfig;const{container:t,markerClickCallback:s,mapClickCallback:o}=e;d.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,d.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,d.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const n=new S;if(((u=this.mapConfig)==null?void 0:u.mapOptions.mode.toLowerCase())==="2d"?(this.view=new R({map:n,container:t,...this.mapConfig.mapOptions}),this.view.on("drag",i=>{i.button===2&&i.stopPropagation()})):this.view=new H({map:n,container:t,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(y=this.mapConfig)==null?void 0:y.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!1},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async i=>{var C,P;if(o){let a=i.mapPoint;a.spatialReference.isWebMercator&&(a=m.webMercatorToGeographic(a)),o([a.x,a.y],[i.screenPoint.x,i.screenPoint.y],i)}if(this.view.type==="3d"){const a=this.view.camera;if(this.view.spatialReference.isWebMercator){const p=m.webMercatorToGeographic(a.position),f={heading:a.heading,tilt:a.tilt,position:p.toJSON()};console.log(f),(C=navigator.clipboard)==null||C.writeText(JSON.stringify(f))}else console.log(a.toJSON());console.log(this.view.zoom,this.view.scale)}else{let a=this.view.center;this.view.spatialReference.isWebMercator&&(a=m.webMercatorToGeographic(a)),console.log({center:a.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(P=(await this.view.hitTest(i)).results)==null?void 0:P.filter(a=>a.type==="graphic");c.length>0&&c.forEach(a=>{var f;const p=a.graphic;(f=p.attributes)!=null&&f.type&&s&&s(p.attributes.type,p.attributes.id,p.attributes,i)})}),(v=this.mapConfig)!=null&&v.baseLayers?this.mapConfig.baseLayers.forEach(i=>{const l=q(i.url,this.mapConfig.assetsRoot);switch(i.type.toLowerCase()){case"webTile".toLowerCase():{const c=new I({urlTemplate:l,...i.options});n.add(c);break}case"tile":{const c=new x({url:l,...i.options});n.add(c);break}case"customWMTS".toLowerCase():{const c=new j.default({urlTemplate:l,...i.options});n.add(c);break}case"mapImage".toLowerCase():{const c=new O({url:l,...i.options});n.add(c);break}case"arcgis":{const c=new k(i.options);n.basemap=c;break}}}):n.basemap=new k({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(M=this.mapConfig)!=null&&M.hdLayers){const i=this.mapConfig.hdLayers.map(l=>new W({url:q(l.url,this.mapConfig.assetsRoot),...l.options,title:l.options.id}));n.addMany(i)}this.view.ui.remove("attribution"),await this.view.when();const w=this.mapConfig.camera;let h;if(this.view.type==="2d"){let i=this.view.center;this.view.spatialReference.isWebMercator&&(i=m.webMercatorToGeographic(i)),h={center:[i.x,i.y],zoom:this.view.zoom}}else{let i=this.view.camera.position;this.view.spatialReference.isWebMercator&&(i=m.webMercatorToGeographic(i)),h={position:i,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return w?w.home=h:this.mapConfig.camera={home:h},this.view}setLayerVisibility(e){const{id:t,visible:s}=e,o=this.view.map.findLayerById(t);return o?(o.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var t;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((t=e.target)==null?void 0:t.type){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}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}async lookAt(e){if(this.view.type==="2d")return;const t=e.tilt||0,s=e.heading||0;if(t===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(t*Math.PI/180)*e.height,n=_(B.point(e.center),o,s+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:e.height},heading:s,tilt:t},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:t,duration:s=0}=e,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const n=o[t];return n?(await this.view.goTo(n,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,t){let s=0;const n=1e3/30,w=T.watch(()=>this.view.center,()=>{const h=this.transformPoints(e),u=Date.now();u-s>n&&(t(h),s=u)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,w),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(t=>{const s=new g.Point({x:t[0],y:t[1]}),o=this.view.toScreen(s);return[o.x,o.y]})}cancelCoordinateTransform(e){const t=this.watchHandleMap.get(e);t&&(t.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:t,max:s}=e;!t&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=T.watch(()=>this.view.zoom,o=>{t&&o<=t&&(this.view.zoom=t),s&&o>=s&&(this.view.zoom=s)}))}}exports.default=N;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("@arcgis/core/Basemap"),d=require("@arcgis/core/config"),z=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/MapImageLayer"),x=require("@arcgis/core/layers/TileLayer"),I=require("@arcgis/core/layers/WebTileLayer"),S=require("@arcgis/core/Map"),R=require("@arcgis/core/views/MapView"),H=require("@arcgis/core/views/SceneView"),_=require("@turf/destination"),G=require("@turf/helpers"),j=require("./custom-layer/custom-wmts-layer.js");function b(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const T=b(z),w=b(L),B=b(G);function q(r,e){return r&&(r.startsWith("http://")||r.startsWith("https://")?r:e+r)}class N{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){var u,y,v,M;this.mapConfig=e.mapConfig;const{container:t,markerClickCallback:s,mapClickCallback:o}=e;d.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,d.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,d.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const n=new S;if(((u=this.mapConfig)==null?void 0:u.mapOptions.mode.toLowerCase())==="2d"?(this.view=new R({map:n,container:t,...this.mapConfig.mapOptions}),this.view.on("drag",i=>{i.button===2&&i.stopPropagation()})):this.view=new H({map:n,container:t,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(y=this.mapConfig)==null?void 0:y.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!0,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async i=>{var C,P;if(o){let a=i.mapPoint;a.spatialReference.isWebMercator&&(a=w.webMercatorToGeographic(a)),o([a.x,a.y],[i.screenPoint.x,i.screenPoint.y],i)}if(this.view.type==="3d"){const a=this.view.camera;if(this.view.spatialReference.isWebMercator){const p=w.webMercatorToGeographic(a.position),m={heading:a.heading,tilt:a.tilt,position:p.toJSON()};console.log(m),(C=navigator.clipboard)==null||C.writeText(JSON.stringify(m))}else console.log(a.toJSON());console.log(this.view.zoom,this.view.scale)}else{let a=this.view.center;this.view.spatialReference.isWebMercator&&(a=w.webMercatorToGeographic(a)),console.log({center:a.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(P=(await this.view.hitTest(i)).results)==null?void 0:P.filter(a=>a.type==="graphic");c.length>0&&c.forEach(a=>{var m;const p=a.graphic;(m=p.attributes)!=null&&m.type&&s&&s(p.attributes.type,p.attributes.id,p.attributes,i)})}),(v=this.mapConfig)!=null&&v.baseLayers?this.mapConfig.baseLayers.forEach(i=>{const h=q(i.url,this.mapConfig.assetsRoot);switch(i.type.toLowerCase()){case"webTile".toLowerCase():{const c=new I({urlTemplate:h,...i.options});n.add(c);break}case"tile":{const c=new x({url:h,...i.options});n.add(c);break}case"customWMTS".toLowerCase():{const c=new j.default({urlTemplate:h,...i.options});n.add(c);break}case"mapImage".toLowerCase():{const c=new O({url:h,...i.options});n.add(c);break}case"arcgis":{const c=new k(i.options);n.basemap=c;break}}}):n.basemap=new k({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(M=this.mapConfig)!=null&&M.hdLayers){const i=this.mapConfig.hdLayers.map(h=>new W({url:q(h.url,this.mapConfig.assetsRoot),...h.options,title:h.options.id}));n.addMany(i)}this.view.ui.remove("attribution"),await this.view.when();const f=this.mapConfig.camera;let l;if(this.view.type==="2d"){let i=this.view.center;this.view.spatialReference.isWebMercator&&(i=w.webMercatorToGeographic(i)),l={center:[i.x,i.y],zoom:this.view.zoom}}else{let i=this.view.camera.position;this.view.spatialReference.isWebMercator&&(i=w.webMercatorToGeographic(i)),l={position:i,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return f?f.home=l:this.mapConfig.camera={home:l},this.view}setLayerVisibility(e){const{id:t,visible:s}=e,o=this.view.map.findLayerById(t);return o?(o.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var t;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((t=e.target)==null?void 0:t.type){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}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}async lookAt(e){if(this.view.type==="2d")return;const t=e.tilt||0,s=e.heading||0;if(t===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(t*Math.PI/180)*e.height,n=_(B.point(e.center),o,s+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:e.height},heading:s,tilt:t},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:t,duration:s=0}=e,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const n=o[t];return n?(await this.view.goTo(n,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,t){let s=0;const n=1e3/30,f=T.watch(()=>this.view.center,()=>{const l=this.transformPoints(e),u=Date.now();u-s>n&&(t(l),s=u)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,f),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(t=>{const s=new g.Point({x:t[0],y:t[1]}),o=this.view.toScreen(s);return[o.x,o.y]})}cancelCoordinateTransform(e){const t=this.watchHandleMap.get(e);t&&(t.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:t,max:s}=e;!t&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=T.watch(()=>this.view.zoom,o=>{t&&o<=t&&(this.view.zoom=t),s&&o>=s&&(this.view.zoom=s)}))}}exports.default=N;
@@ -12,6 +12,7 @@ export default class SignalControlAreaController1 {
12
12
  /** 信号机图层 */
13
13
  private signalMarkerLayer;
14
14
  private signalPictureLayer;
15
+ private signalClusterLayer;
15
16
  private districtControllerOid;
16
17
  private subDistrictControllerOid;
17
18
  private signalOid;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/Graphic"),o=require("@arcgis/core/layers/FeatureLayer"),p=require("@turf/buffer"),h=require("@turf/convex"),m=require("@turf/helpers"),g=require("concaveman"),f=require("../../stores/index.js"),b=require("./district-controller.js");function C(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const l=C(m);class I{constructor(e){var i;this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const s=f.default.useAppDataStore.mapConfig;this.openDriveServer=(i=s.openDriveServer)==null?void 0:i.url,this.districtControllerDashLayer=new o({id:"districtController",spatialReference:e.spatialReference,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"}],renderer:{type:"simple",symbol:{type:"simple-line",style:"long-dash",color:[111,100,255],width:3}}}),this.districtControllerSolidLayer=new o({id:"districtController",spatialReference:e.spatialReference,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"}],popupTemplate:{title:"{name}",content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"区控编号"},{fieldName:"subDistrictCount",label:"子区数量"},{fieldName:"signalCount",label:"信号机数量"}]}]},renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[111,100,255,.4],width:3}}}),this.subDistrictControllerLayer=new o({id:"subDistrictController",spatialReference:e.spatialReference,source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"polyline",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"parentId",type:"string"},{name:"parentName",type:"string"},{name:"signalCount",type:"integer"},{name:"style",type:"string"}],popupTemplate:{title:"{name} 子区",content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"区控编号"},{fieldName:"parentName",label:"所属区控"},{fieldName:"signalCount",label:"信号机数量"}]}]},renderer:{type:"unique-value",field:"style",defaultSymbol:{type:"simple-line",style:"solid",color:[5,196,104],width:3},uniqueValueInfos:[{value:"alert",symbol:{type:"simple-line",style:"solid",color:[255,0,0],width:3}}]}}),this.signalMarkerLayer=new o({id:"signalLayer",spatialReference:e.spatialReference,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"}],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",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:1}},uniqueValueInfos:[{value:"true",symbol:{type:"simple-marker",style:"circle",color:[254,172,22],size:12,outline:{color:"white",width:1}}},{value:"false",symbol:{type:"simple-marker",style:"circle",color:[5,116,255],size:8,outline:{color:"white",width:1}}}]}}),this.signalPictureLayer=new o({id:"signalLayer",spatialReference:e.spatialReference,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"}],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",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:1}},uniqueValueInfos:[{value:"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:40,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_gjxklk_orange.png"}]}}}},{value:"false",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"}]}}}}]}}),this.view.map.addMany([this.districtControllerSolidLayer,this.districtControllerDashLayer,this.subDistrictControllerLayer,this.signalMarkerLayer,this.signalPictureLayer])}async showSignalControlArea(e){await this.clearSignalControlArea(),this.districtControllerDashLayer.visible=!0,this.districtControllerSolidLayer.visible=!0,this.subDistrictControllerLayer.visible=!1,this.signalMarkerLayer.visible=!1,this.signalPictureLayer.visible=!1;for(const t of e.areaList){const s=new b.default(t,e.style||"");this.generateGraphic(s,!0,e.style)}return await this.districtControllerDashLayer.applyEdits({addFeatures:this.districtGraphics}),await this.districtControllerSolidLayer.applyEdits({addFeatures:this.districtGraphics}),this.view.goTo(this.districtGraphics),this.districtGraphics=[],await this.subDistrictControllerLayer.applyEdits({addFeatures:this.subDistrictGraphics}),this.subDistrictGraphics=[],await this.signalMarkerLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalPictureLayer.applyEdits({addFeatures:this.signalGraphics}),this.signalGraphics=[],{status:0,message:"ok"}}async clearSignalControlArea(){this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0;let e=await this.districtControllerDashLayer.queryFeatures();return await this.districtControllerDashLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerDashLayer.definitionExpression="1=1",e=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerSolidLayer.definitionExpression="1=1",e=await this.subDistrictControllerLayer.queryFeatures(),await this.subDistrictControllerLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictControllerLayer.definitionExpression="1=1",e=await this.signalMarkerLayer.queryFeatures(),await this.signalMarkerLayer.applyEdits({deleteFeatures:e.features}),this.signalMarkerLayer.definitionExpression="1=1",e=await this.signalPictureLayer.queryFeatures(),await this.signalPictureLayer.applyEdits({deleteFeatures:e.features}),this.signalPictureLayer.definitionExpression="1=1",{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtControllerDashLayer.visible=e.visible,this.districtControllerSolidLayer.visible=e.visible;break;case"subDistrict":this.subDistrictControllerLayer.visible=e.visible;break;case"signal":this.signalMarkerLayer.visible=e.visible,this.signalPictureLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":{const i=this.districtControllerDashLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.districtControllerDashLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo(r.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}case"subDistrict":const t=this.subDistrictControllerLayer.createQuery();t.where=`id = '${e.id}'`,t.returnGeometry=!0,t.outFields=["*"];const s=await this.subDistrictControllerLayer.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:"未找到子区"};case"signal":{const i=this.signalMarkerLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.signalMarkerLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo({target:r.features[0],scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){switch(e.type){case"district":{const t=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${e.id}'`;const s=await this.districtControllerDashLayer.queryFeatures();return s.features.length>0?(this.districtControllerSolidLayer.definitionExpression=`id = '${e.id}'`,this.subDistrictControllerLayer.definitionExpression=`parentId = '${e.id}'`,this.signalMarkerLayer.definitionExpression=`districtId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`districtId = '${e.id}'`,await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):(this.districtControllerDashLayer.definitionExpression=t,{status:1,message:"未找到区控"})}case"subDistrict":{const t=this.subDistrictControllerLayer.definitionExpression;this.subDistrictControllerLayer.definitionExpression=`id = '${e.id}'`;const s=await this.subDistrictControllerLayer.queryFeatures();if(s.features.length>0){this.signalMarkerLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`subDistrictId = '${e.id}'`;const r=s.features[0].attributes.parentId;return this.districtControllerDashLayer.definitionExpression=`id = '${r}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${r}'`,await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.subDistrictControllerLayer.definitionExpression=t,{status:1,message:"未找到子区"}}case"signal":{const t=this.signalMarkerLayer.definitionExpression;this.signalMarkerLayer.definitionExpression=`id = '${e.id}'`;const s=await this.signalMarkerLayer.queryFeatures();if(s.features.length>0){this.signalPictureLayer.definitionExpression=`id = '${e.id}'`;const i=s.features[0],{districtId:r,subDistrictId:u}=i.attributes;return this.districtControllerDashLayer.definitionExpression=`id = '${r}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${r}'`,this.subDistrictControllerLayer.definitionExpression=`id = '${u}'`,await this.view.goTo({target:s.features,scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.signalMarkerLayer.definitionExpression=t,{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){this.districtControllerDashLayer.definitionExpression="1=1",this.districtControllerSolidLayer.definitionExpression="1=1",this.subDistrictControllerLayer.definitionExpression="1=1",this.signalMarkerLayer.definitionExpression="1=1";const e=await this.districtControllerDashLayer.queryFeatures();return this.view.goTo(e.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}generateGraphic(e,t,s){const i=e.getAllSignalCoordinates();let r=null;if(i.length>=2)if(i.length===2)r=l.lineString(i);else{if(t){const a=l.featureCollection(i.map(d=>l.point(d)));r=h(a)}else{const a=g(i,.5);a.length>=4&&(r=l.polygon([a]))}r||(r=l.lineString(i))}else if(i.length===1)r=l.point(i[0]);else return;const u=p(r.geometry,t?200:30,{units:"meters"}),c=new y({geometry:{type:"polyline",paths:u.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,style:s}});t?this.districtGraphics.push(c):this.subDistrictGraphics.push(c);for(const a of e.subDistricts)this.generateGraphic(a,!1,s);e.signals.forEach(a=>{const d=new y({geometry:{type:"point",x:a.longitude,y:a.latitude},attributes:{ObjectID:this.signalOid++,id:a.id,name:a.name,signalId:a.signalId,nodeId:a.nodeId,isKey:a.isKey,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name}});this.signalGraphics.push(d)})}}exports.default=I;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/FeatureLayer"),p=require("@turf/buffer"),h=require("@turf/convex"),m=require("@turf/helpers"),g=require("concaveman"),f=require("../../stores/index.js"),b=require("./district-controller.js");function C(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const o=C(m);class I{constructor(e){var i;this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const s=f.default.useAppDataStore.mapConfig;this.openDriveServer=(i=s.openDriveServer)==null?void 0:i.url,this.districtControllerDashLayer=new l({id:"districtController",spatialReference:e.spatialReference,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"}],renderer:{type:"simple",symbol:{type:"simple-line",style:"long-dash",color:[111,100,255],width:3}}}),this.districtControllerSolidLayer=new l({id:"districtController",spatialReference:e.spatialReference,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"}],popupTemplate:{title:"{name}",content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"区控编号"},{fieldName:"subDistrictCount",label:"子区数量"},{fieldName:"signalCount",label:"信号机数量"}]}]},renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[111,100,255,.4],width:3}}}),this.subDistrictControllerLayer=new l({id:"subDistrictController",spatialReference:e.spatialReference,source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"polyline",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"parentId",type:"string"},{name:"parentName",type:"string"},{name:"signalCount",type:"integer"},{name:"style",type:"string"}],popupTemplate:{title:"{name} 子区",content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"区控编号"},{fieldName:"parentName",label:"所属区控"},{fieldName:"signalCount",label:"信号机数量"}]}]},renderer:{type:"unique-value",field:"style",defaultSymbol:{type:"simple-line",style:"solid",color:[5,196,104],width:3},uniqueValueInfos:[{value:"alert",symbol:{type:"simple-line",style:"solid",color:[255,0,0],width:3}}]}}),this.signalMarkerLayer=new l({id:"signalLayer",spatialReference:e.spatialReference,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"}],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",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:1}},uniqueValueInfos:[{value:"true",symbol:{type:"simple-marker",style:"circle",color:[254,172,22],size:12,outline:{color:"white",width:1}}},{value:"false",symbol:{type:"simple-marker",style:"circle",color:[5,116,255],size:8,outline:{color:"white",width:1}}}]}}),this.signalClusterLayer=new l({id:"signalLayer",spatialReference:e.spatialReference,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"}],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:"聚合详情",content:"聚合信号机 <b>{cluster_count}</b> 个",fieldInfos:[{fieldName:"cluster_count",format:{digitSeparator:!0,places:0}}]}},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}}}}),this.signalPictureLayer=new l({id:"signalLayer",spatialReference:e.spatialReference,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"}],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",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:1}},uniqueValueInfos:[{value:"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:40,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_gjxklk_orange.png"}]}}}},{value:"false",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"}]}}}}]}}),this.view.map.addMany([this.districtControllerSolidLayer,this.districtControllerDashLayer,this.subDistrictControllerLayer,this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer])}async showSignalControlArea(e){await this.clearSignalControlArea(),this.districtControllerDashLayer.visible=!1,this.districtControllerSolidLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.signalMarkerLayer.visible=!1,this.signalPictureLayer.visible=!1,this.signalClusterLayer.visible=!0;for(const t of e.areaList){const s=new b.default(t,e.style||"");this.generateGraphic(s,!0,e.style)}return await this.districtControllerDashLayer.applyEdits({addFeatures:this.districtGraphics}),await this.districtControllerSolidLayer.applyEdits({addFeatures:this.districtGraphics}),this.view.goTo(this.districtGraphics),this.districtGraphics=[],await this.subDistrictControllerLayer.applyEdits({addFeatures:this.subDistrictGraphics}),this.subDistrictGraphics=[],await this.signalMarkerLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalPictureLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalClusterLayer.applyEdits({addFeatures:this.signalGraphics}),this.signalGraphics=[],{status:0,message:"ok"}}async clearSignalControlArea(){this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0;let e=await this.districtControllerDashLayer.queryFeatures();return await this.districtControllerDashLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerDashLayer.definitionExpression="1=1",e=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerSolidLayer.definitionExpression="1=1",e=await this.subDistrictControllerLayer.queryFeatures(),await this.subDistrictControllerLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictControllerLayer.definitionExpression="1=1",e=await this.signalMarkerLayer.queryFeatures(),await this.signalMarkerLayer.applyEdits({deleteFeatures:e.features}),this.signalMarkerLayer.definitionExpression="1=1",e=await this.signalPictureLayer.queryFeatures(),await this.signalPictureLayer.applyEdits({deleteFeatures:e.features}),this.signalPictureLayer.definitionExpression="1=1",e=await this.signalClusterLayer.queryFeatures(),await this.signalClusterLayer.applyEdits({deleteFeatures:e.features}),this.signalClusterLayer.definitionExpression="1=1",{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtControllerDashLayer.visible=e.visible,this.districtControllerSolidLayer.visible=e.visible;break;case"subDistrict":this.subDistrictControllerLayer.visible=e.visible;break;case"signal":this.signalMarkerLayer.visible=e.visible,this.signalPictureLayer.visible=e.visible;break;case"signalCluster":this.signalClusterLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":{const i=this.districtControllerDashLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.districtControllerDashLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo(r.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}case"subDistrict":const t=this.subDistrictControllerLayer.createQuery();t.where=`id = '${e.id}'`,t.returnGeometry=!0,t.outFields=["*"];const s=await this.subDistrictControllerLayer.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:"未找到子区"};case"signal":{const i=this.signalMarkerLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.signalMarkerLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo({target:r.features[0],scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){switch(e.type){case"district":{const t=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${e.id}'`;const s=await this.districtControllerDashLayer.queryFeatures();return s.features.length>0?(this.districtControllerSolidLayer.definitionExpression=`id = '${e.id}'`,this.subDistrictControllerLayer.definitionExpression=`parentId = '${e.id}'`,this.signalMarkerLayer.definitionExpression=`districtId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`districtId = '${e.id}'`,await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):(this.districtControllerDashLayer.definitionExpression=t,{status:1,message:"未找到区控"})}case"subDistrict":{const t=this.subDistrictControllerLayer.definitionExpression;this.subDistrictControllerLayer.definitionExpression=`id = '${e.id}'`;const s=await this.subDistrictControllerLayer.queryFeatures();if(s.features.length>0){this.signalMarkerLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`subDistrictId = '${e.id}'`;const r=s.features[0].attributes.parentId;return this.districtControllerDashLayer.definitionExpression=`id = '${r}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${r}'`,await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.subDistrictControllerLayer.definitionExpression=t,{status:1,message:"未找到子区"}}case"signal":{const t=this.signalMarkerLayer.definitionExpression;this.signalMarkerLayer.definitionExpression=`id = '${e.id}'`;const s=await this.signalMarkerLayer.queryFeatures();if(s.features.length>0){this.signalPictureLayer.definitionExpression=`id = '${e.id}'`;const i=s.features[0],{districtId:r,subDistrictId:u}=i.attributes;return this.districtControllerDashLayer.definitionExpression=`id = '${r}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${r}'`,this.subDistrictControllerLayer.definitionExpression=`id = '${u}'`,await this.view.goTo({target:s.features,scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.signalMarkerLayer.definitionExpression=t,{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){this.districtControllerDashLayer.definitionExpression="1=1",this.districtControllerSolidLayer.definitionExpression="1=1",this.subDistrictControllerLayer.definitionExpression="1=1",this.signalMarkerLayer.definitionExpression="1=1";const e=await this.districtControllerDashLayer.queryFeatures();return this.view.goTo(e.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}generateGraphic(e,t,s){const i=e.getAllSignalCoordinates();let r=null;if(i.length>=2)if(i.length===2)r=o.lineString(i);else{if(t){const a=o.featureCollection(i.map(y=>o.point(y)));r=h(a)}else{const a=g(i,.5);a.length>=4&&(r=o.polygon([a]))}r||(r=o.lineString(i))}else if(i.length===1)r=o.point(i[0]);else return;const u=p(r.geometry,t?200:30,{units:"meters"}),c=new d({geometry:{type:"polyline",paths:u.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,style:s}});t?this.districtGraphics.push(c):this.subDistrictGraphics.push(c);for(const a of e.subDistricts)this.generateGraphic(a,!1,s);e.signals.forEach(a=>{const y=new d({geometry:{type:"point",x:a.longitude,y:a.latitude},attributes:{ObjectID:this.signalOid++,id:a.id,name:a.name,signalId:a.signalId,nodeId:a.nodeId,isKey:a.isKey,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name}});this.signalGraphics.push(y)})}}exports.default=I;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.211",
3
+ "version": "1.0.212",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [