gisviewer-vue3-arcgis 1.0.207 → 1.0.209

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.
@@ -20,6 +20,8 @@ export default class SignalControlAreaController1 {
20
20
  private districtGraphics;
21
21
  /** 暂存等待绘制的子区graphic */
22
22
  private subDistrictGraphics;
23
+ /** 暂存等待绘制的信号机graphic */
24
+ private signalGraphics;
23
25
  /**
24
26
  * 显示所有区控、子区、信号机
25
27
  * @param params
@@ -61,10 +63,10 @@ export default class SignalControlAreaController1 {
61
63
  message: string;
62
64
  }>;
63
65
  /**
64
- * 绘制区控、子区和信号机
66
+ * 生成区控、子区和信号机graphic
65
67
  * @param districtController
66
68
  * @param isDistrict 是否是区控
67
69
  * @returns
68
70
  */
69
- private drawArea;
71
+ private generateGraphic;
70
72
  }
@@ -1,16 +1,16 @@
1
- import y from "@arcgis/core/Graphic";
1
+ import u from "@arcgis/core/Graphic";
2
2
  import o from "@arcgis/core/layers/FeatureLayer";
3
- import c from "@turf/buffer";
4
- import p from "@turf/convex";
3
+ import y from "@turf/buffer";
4
+ import c from "@turf/convex";
5
5
  import * as n from "@turf/helpers";
6
- import h from "concaveman";
7
- import m from "../../stores/index.mjs";
8
- import g from "./district-controller.mjs";
9
- class S {
6
+ import p from "concaveman";
7
+ import h from "../../stores/index.mjs";
8
+ import m from "./district-controller.mjs";
9
+ class x {
10
10
  constructor(e) {
11
11
  var i;
12
- this.districtControllerOid = 0, this.subDistrictControllerOid = 0, this.signalOid = 0, this.districtGraphics = [], this.subDistrictGraphics = [], this.view = e, this.hasGpu = localStorage.getItem("gpu") !== "Unknown";
13
- const t = m.useAppDataStore.mapConfig;
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 t = h.useAppDataStore.mapConfig;
14
14
  this.openDriveServer = (i = t.openDriveServer) == null ? void 0 : i.url, this.districtControllerDashLayer = new o({
15
15
  id: "districtController",
16
16
  spatialReference: e.spatialReference,
@@ -576,20 +576,24 @@ class S {
576
576
  */
577
577
  async showSignalControlArea(e) {
578
578
  await this.clearSignalControlArea(), this.districtControllerDashLayer.visible = !0, this.districtControllerSolidLayer.visible = !0, this.subDistrictControllerLayer.visible = !1, this.signalMarkerLayer.visible = !1, this.signalPictureLayer.visible = !1;
579
- for (const r of e.areaList) {
580
- const t = new g(
581
- r,
579
+ for (const s of e.areaList) {
580
+ const t = new m(
581
+ s,
582
582
  e.style || ""
583
583
  );
584
- await this.drawArea(t, !0), await this.subDistrictControllerLayer.applyEdits({
585
- addFeatures: this.subDistrictGraphics
586
- }), this.subDistrictGraphics = [];
584
+ this.generateGraphic(t, !0);
587
585
  }
588
586
  return await this.districtControllerDashLayer.applyEdits({
589
587
  addFeatures: this.districtGraphics
590
588
  }), await this.districtControllerSolidLayer.applyEdits({
591
589
  addFeatures: this.districtGraphics
592
- }), this.view.goTo(this.districtGraphics), this.districtGraphics = [], { status: 0, message: "ok" };
590
+ }), this.view.goTo(this.districtGraphics), this.districtGraphics = [], await this.subDistrictControllerLayer.applyEdits({
591
+ addFeatures: this.subDistrictGraphics
592
+ }), this.subDistrictGraphics = [], await this.signalMarkerLayer.applyEdits({
593
+ addFeatures: this.signalGraphics
594
+ }), await this.signalPictureLayer.applyEdits({
595
+ addFeatures: this.signalGraphics
596
+ }), this.signalGraphics = [], { status: 0, message: "ok" };
593
597
  }
594
598
  /**
595
599
  * 清空区控、子区、信号机
@@ -600,15 +604,15 @@ class S {
600
604
  let e = await this.districtControllerDashLayer.queryFeatures();
601
605
  return await this.districtControllerDashLayer.applyEdits({
602
606
  deleteFeatures: e.features
603
- }), e = await this.districtControllerSolidLayer.queryFeatures(), await this.districtControllerSolidLayer.applyEdits({
607
+ }), this.districtControllerDashLayer.definitionExpression = "1=1", e = await this.districtControllerSolidLayer.queryFeatures(), await this.districtControllerSolidLayer.applyEdits({
604
608
  deleteFeatures: e.features
605
- }), e = await this.subDistrictControllerLayer.queryFeatures(), await this.subDistrictControllerLayer.applyEdits({
609
+ }), this.districtControllerSolidLayer.definitionExpression = "1=1", e = await this.subDistrictControllerLayer.queryFeatures(), await this.subDistrictControllerLayer.applyEdits({
606
610
  deleteFeatures: e.features
607
- }), e = await this.signalMarkerLayer.queryFeatures(), await this.signalMarkerLayer.applyEdits({
611
+ }), this.subDistrictControllerLayer.definitionExpression = "1=1", e = await this.signalMarkerLayer.queryFeatures(), await this.signalMarkerLayer.applyEdits({
608
612
  deleteFeatures: e.features
609
- }), e = await this.signalPictureLayer.queryFeatures(), await this.signalPictureLayer.applyEdits({
613
+ }), this.signalMarkerLayer.definitionExpression = "1=1", e = await this.signalPictureLayer.queryFeatures(), await this.signalPictureLayer.applyEdits({
610
614
  deleteFeatures: e.features
611
- }), { status: 0, message: "ok" };
615
+ }), this.signalPictureLayer.definitionExpression = "1=1", { status: 0, message: "ok" };
612
616
  }
613
617
  /**
614
618
  * 设置区控、子区、信号机图层可见性
@@ -647,10 +651,10 @@ class S {
647
651
  }), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
648
652
  }
649
653
  case "subDistrict":
650
- const r = this.subDistrictControllerLayer.createQuery();
651
- r.where = `id = '${e.id}'`, r.returnGeometry = !0, r.outFields = ["*"];
654
+ const s = this.subDistrictControllerLayer.createQuery();
655
+ s.where = `id = '${e.id}'`, s.returnGeometry = !0, s.outFields = ["*"];
652
656
  const t = await this.subDistrictControllerLayer.queryFeatures(
653
- r
657
+ s
654
658
  );
655
659
  return t.features.length > 0 ? (await this.view.goTo(t.features, {
656
660
  duration: this.hasGpu ? 1e3 : 0
@@ -678,15 +682,15 @@ class S {
678
682
  async highlightSignalControlArea(e) {
679
683
  switch (e.type) {
680
684
  case "district": {
681
- const r = this.districtControllerDashLayer.definitionExpression;
685
+ const s = this.districtControllerDashLayer.definitionExpression;
682
686
  this.districtControllerDashLayer.definitionExpression = `id = '${e.id}'`;
683
687
  const t = await this.districtControllerDashLayer.queryFeatures();
684
688
  return t.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(t.features, {
685
689
  duration: this.hasGpu ? 1e3 : 0
686
- }), { status: 0, message: "ok" }) : (this.districtControllerDashLayer.definitionExpression = r, { status: 1, message: "未找到区控" });
690
+ }), { status: 0, message: "ok" }) : (this.districtControllerDashLayer.definitionExpression = s, { status: 1, message: "未找到区控" });
687
691
  }
688
692
  case "subDistrict": {
689
- const r = this.subDistrictControllerLayer.definitionExpression;
693
+ const s = this.subDistrictControllerLayer.definitionExpression;
690
694
  this.subDistrictControllerLayer.definitionExpression = `id = '${e.id}'`;
691
695
  const t = await this.subDistrictControllerLayer.queryFeatures();
692
696
  if (t.features.length > 0) {
@@ -696,10 +700,10 @@ class S {
696
700
  duration: this.hasGpu ? 1e3 : 0
697
701
  }), { status: 0, message: "ok" };
698
702
  } else
699
- return this.subDistrictControllerLayer.definitionExpression = r, { status: 1, message: "未找到子区" };
703
+ return this.subDistrictControllerLayer.definitionExpression = s, { status: 1, message: "未找到子区" };
700
704
  }
701
705
  case "signal": {
702
- const r = this.signalMarkerLayer.definitionExpression;
706
+ const s = this.signalMarkerLayer.definitionExpression;
703
707
  this.signalMarkerLayer.definitionExpression = `id = '${e.id}'`;
704
708
  const t = await this.signalMarkerLayer.queryFeatures();
705
709
  if (t.features.length > 0) {
@@ -712,7 +716,7 @@ class S {
712
716
  }
713
717
  ), { status: 0, message: "ok" };
714
718
  } else
715
- return this.signalMarkerLayer.definitionExpression = r, { status: 1, message: "未找到信号机" };
719
+ return this.signalMarkerLayer.definitionExpression = s, { status: 1, message: "未找到信号机" };
716
720
  }
717
721
  default:
718
722
  return { status: 1, message: "未知类型" };
@@ -730,26 +734,26 @@ class S {
730
734
  }), { status: 0, message: "ok" };
731
735
  }
732
736
  /**
733
- * 绘制区控、子区和信号机
737
+ * 生成区控、子区和信号机graphic
734
738
  * @param districtController
735
739
  * @param isDistrict 是否是区控
736
740
  * @returns
737
741
  */
738
- async drawArea(e, r) {
742
+ generateGraphic(e, s) {
739
743
  const t = e.getAllSignalCoordinates();
740
- let i;
744
+ let i = null;
741
745
  if (t.length >= 2)
742
746
  if (t.length === 2)
743
747
  i = n.lineString(t);
744
748
  else {
745
- if (r) {
746
- const s = n.featureCollection(
747
- t.map((u) => n.point(u))
749
+ if (s) {
750
+ const r = n.featureCollection(
751
+ t.map((d) => n.point(d))
748
752
  );
749
- i = p(s);
753
+ i = c(r);
750
754
  } else {
751
- const s = h(t, 0.5);
752
- s.length >= 4 && (i = n.polygon([s]));
755
+ const r = p(t, 0.5);
756
+ r.length >= 4 && (i = n.polygon([r]));
753
757
  }
754
758
  i || (i = n.lineString(t));
755
759
  }
@@ -757,20 +761,20 @@ class S {
757
761
  i = n.point(t[0]);
758
762
  else
759
763
  return;
760
- const a = c(
764
+ const a = y(
761
765
  i.geometry,
762
766
  // 区控面积更大,需要更大的缓冲半径
763
- r ? 200 : 30,
767
+ s ? 200 : 30,
764
768
  {
765
769
  units: "meters"
766
770
  }
767
- ), l = new y({
771
+ ), l = new u({
768
772
  geometry: {
769
773
  type: "polyline",
770
774
  paths: a.geometry.coordinates
771
775
  },
772
776
  attributes: {
773
- ObjectID: r ? this.districtControllerOid++ : this.subDistrictControllerOid++,
777
+ ObjectID: s ? this.districtControllerOid++ : this.subDistrictControllerOid++,
774
778
  id: e.id,
775
779
  name: e.name,
776
780
  subDistrictCount: e.subDistrictCount,
@@ -779,35 +783,33 @@ class S {
779
783
  parentName: e.parentName
780
784
  }
781
785
  });
782
- r ? this.districtGraphics.push(l) : this.subDistrictGraphics.push(l);
783
- for (const s of e.subDistricts)
784
- await this.drawArea(s, !1);
785
- const d = e.signals.map((s) => new y({
786
- geometry: {
787
- type: "point",
788
- x: s.longitude,
789
- y: s.latitude
790
- },
791
- attributes: {
792
- ObjectID: this.signalOid++,
793
- id: s.id,
794
- name: s.name,
795
- signalId: s.signalId,
796
- nodeId: s.nodeId,
797
- isKey: s.isKey,
798
- districtId: r ? e.id : e.parentId,
799
- districtName: r ? e.name : e.parentName,
800
- subDistrictId: r ? "" : e.id,
801
- subDistrictName: r ? "" : e.name
802
- }
803
- }));
804
- await this.signalMarkerLayer.applyEdits({
805
- addFeatures: d
806
- }), await this.signalPictureLayer.applyEdits({
807
- addFeatures: d
786
+ s ? this.districtGraphics.push(l) : this.subDistrictGraphics.push(l);
787
+ for (const r of e.subDistricts)
788
+ this.generateGraphic(r, !1);
789
+ e.signals.forEach((r) => {
790
+ const d = new u({
791
+ geometry: {
792
+ type: "point",
793
+ x: r.longitude,
794
+ y: r.latitude
795
+ },
796
+ attributes: {
797
+ ObjectID: this.signalOid++,
798
+ id: r.id,
799
+ name: r.name,
800
+ signalId: r.signalId,
801
+ nodeId: r.nodeId,
802
+ isKey: r.isKey,
803
+ districtId: s ? e.id : e.parentId,
804
+ districtName: s ? e.name : e.parentName,
805
+ subDistrictId: s ? "" : e.id,
806
+ subDistrictName: s ? "" : e.name
807
+ }
808
+ });
809
+ this.signalGraphics.push(d);
808
810
  });
809
811
  }
810
812
  }
811
813
  export {
812
- S as default
814
+ x as default
813
815
  };
@@ -20,6 +20,8 @@ export default class SignalControlAreaController1 {
20
20
  private districtGraphics;
21
21
  /** 暂存等待绘制的子区graphic */
22
22
  private subDistrictGraphics;
23
+ /** 暂存等待绘制的信号机graphic */
24
+ private signalGraphics;
23
25
  /**
24
26
  * 显示所有区控、子区、信号机
25
27
  * @param params
@@ -61,10 +63,10 @@ export default class SignalControlAreaController1 {
61
63
  message: string;
62
64
  }>;
63
65
  /**
64
- * 绘制区控、子区和信号机
66
+ * 生成区控、子区和信号机graphic
65
67
  * @param districtController
66
68
  * @param isDistrict 是否是区控
67
69
  * @returns
68
70
  */
69
- private drawArea;
71
+ private generateGraphic;
70
72
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=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 i in n)if(i!=="default"){const t=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,t.get?t:{enumerable:!0,get:()=>n[i]})}}return e.default=n,Object.freeze(e)}const l=C(m);class I{constructor(e){var r;this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,this.districtGraphics=[],this.subDistrictGraphics=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const t=f.default.useAppDataStore.mapConfig;this.openDriveServer=(r=t.openDriveServer)==null?void 0:r.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"}],popupTemplate:{title:"{name} 子区",content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"区控编号"},{fieldName:"parentName",label:"所属区控"},{fieldName:"signalCount",label:"信号机数量"}]}]},renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[5,196,104],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 i of e.areaList){const t=new b.default(i,e.style||"");await this.drawArea(t,!0),await this.subDistrictControllerLayer.applyEdits({addFeatures:this.subDistrictGraphics}),this.subDistrictGraphics=[]}return await this.districtControllerDashLayer.applyEdits({addFeatures:this.districtGraphics}),await this.districtControllerSolidLayer.applyEdits({addFeatures:this.districtGraphics}),this.view.goTo(this.districtGraphics),this.districtGraphics=[],{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}),e=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:e.features}),e=await this.subDistrictControllerLayer.queryFeatures(),await this.subDistrictControllerLayer.applyEdits({deleteFeatures:e.features}),e=await this.signalMarkerLayer.queryFeatures(),await this.signalMarkerLayer.applyEdits({deleteFeatures:e.features}),e=await this.signalPictureLayer.queryFeatures(),await this.signalPictureLayer.applyEdits({deleteFeatures:e.features}),{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 r=this.districtControllerDashLayer.createQuery();r.where=`id = '${e.id}'`,r.returnGeometry=!0,r.outFields=["*"];const a=await this.districtControllerDashLayer.queryFeatures(r);return a.features.length>0?(await this.view.goTo(a.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}case"subDistrict":const i=this.subDistrictControllerLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const t=await this.subDistrictControllerLayer.queryFeatures(i);return t.features.length>0?(await this.view.goTo(t.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到子区"};case"signal":{const r=this.signalMarkerLayer.createQuery();r.where=`id = '${e.id}'`,r.returnGeometry=!0,r.outFields=["*"];const a=await this.signalMarkerLayer.queryFeatures(r);return a.features.length>0?(await this.view.goTo({target:a.features[0],scale:2500},{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 i=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${e.id}'`;const t=await this.districtControllerDashLayer.queryFeatures();return t.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(t.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):(this.districtControllerDashLayer.definitionExpression=i,{status:1,message:"未找到区控"})}case"subDistrict":{const i=this.subDistrictControllerLayer.definitionExpression;this.subDistrictControllerLayer.definitionExpression=`id = '${e.id}'`;const t=await this.subDistrictControllerLayer.queryFeatures();if(t.features.length>0){this.signalMarkerLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`subDistrictId = '${e.id}'`;const a=t.features[0].attributes.parentId;return this.districtControllerDashLayer.definitionExpression=`id = '${a}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${a}'`,await this.view.goTo(t.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.subDistrictControllerLayer.definitionExpression=i,{status:1,message:"未找到子区"}}case"signal":{const i=this.signalMarkerLayer.definitionExpression;this.signalMarkerLayer.definitionExpression=`id = '${e.id}'`;const t=await this.signalMarkerLayer.queryFeatures();if(t.features.length>0){this.signalPictureLayer.definitionExpression=`id = '${e.id}'`;const r=t.features[0],{districtId:a,subDistrictId:u}=r.attributes;return this.districtControllerDashLayer.definitionExpression=`id = '${a}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${a}'`,this.subDistrictControllerLayer.definitionExpression=`id = '${u}'`,await this.view.goTo({target:t.features,zoom:2500},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.signalMarkerLayer.definitionExpression=i,{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"}}async drawArea(e,i){const t=e.getAllSignalCoordinates();let r;if(t.length>=2)if(t.length===2)r=l.lineString(t);else{if(i){const s=l.featureCollection(t.map(y=>l.point(y)));r=h(s)}else{const s=g(t,.5);s.length>=4&&(r=l.polygon([s]))}r||(r=l.lineString(t))}else if(t.length===1)r=l.point(t[0]);else return;const a=p(r.geometry,i?200:30,{units:"meters"}),u=new c({geometry:{type:"polyline",paths:a.geometry.coordinates},attributes:{ObjectID:i?this.districtControllerOid++:this.subDistrictControllerOid++,id:e.id,name:e.name,subDistrictCount:e.subDistrictCount,signalCount:e.signalCount,parentId:e.parentId,parentName:e.parentName}});i?this.districtGraphics.push(u):this.subDistrictGraphics.push(u);for(const s of e.subDistricts)await this.drawArea(s,!1);const d=e.signals.map(s=>new c({geometry:{type:"point",x:s.longitude,y:s.latitude},attributes:{ObjectID:this.signalOid++,id:s.id,name:s.name,signalId:s.signalId,nodeId:s.nodeId,isKey:s.isKey,districtId:i?e.id:e.parentId,districtName:i?e.name:e.parentName,subDistrictId:i?"":e.id,subDistrictName:i?"":e.name}}));await this.signalMarkerLayer.applyEdits({addFeatures:d}),await this.signalPictureLayer.applyEdits({addFeatures:d})}}exports.default=I;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),o=require("@arcgis/core/layers/FeatureLayer"),y=require("@turf/buffer"),p=require("@turf/convex"),h=require("@turf/helpers"),m=require("concaveman"),g=require("../../stores/index.js"),f=require("./district-controller.js");function b(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const i in n)if(i!=="default"){const t=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,t.get?t:{enumerable:!0,get:()=>n[i]})}}return e.default=n,Object.freeze(e)}const l=b(h);class C{constructor(e){var s;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 t=g.default.useAppDataStore.mapConfig;this.openDriveServer=(s=t.openDriveServer)==null?void 0:s.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"}],popupTemplate:{title:"{name} 子区",content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"区控编号"},{fieldName:"parentName",label:"所属区控"},{fieldName:"signalCount",label:"信号机数量"}]}]},renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[5,196,104],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 i of e.areaList){const t=new f.default(i,e.style||"");this.generateGraphic(t,!0)}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 s=this.districtControllerDashLayer.createQuery();s.where=`id = '${e.id}'`,s.returnGeometry=!0,s.outFields=["*"];const a=await this.districtControllerDashLayer.queryFeatures(s);return a.features.length>0?(await this.view.goTo(a.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}case"subDistrict":const i=this.subDistrictControllerLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const t=await this.subDistrictControllerLayer.queryFeatures(i);return t.features.length>0?(await this.view.goTo(t.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到子区"};case"signal":{const s=this.signalMarkerLayer.createQuery();s.where=`id = '${e.id}'`,s.returnGeometry=!0,s.outFields=["*"];const a=await this.signalMarkerLayer.queryFeatures(s);return a.features.length>0?(await this.view.goTo({target:a.features[0],scale:2500},{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 i=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${e.id}'`;const t=await this.districtControllerDashLayer.queryFeatures();return t.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(t.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):(this.districtControllerDashLayer.definitionExpression=i,{status:1,message:"未找到区控"})}case"subDistrict":{const i=this.subDistrictControllerLayer.definitionExpression;this.subDistrictControllerLayer.definitionExpression=`id = '${e.id}'`;const t=await this.subDistrictControllerLayer.queryFeatures();if(t.features.length>0){this.signalMarkerLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`subDistrictId = '${e.id}'`;const a=t.features[0].attributes.parentId;return this.districtControllerDashLayer.definitionExpression=`id = '${a}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${a}'`,await this.view.goTo(t.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.subDistrictControllerLayer.definitionExpression=i,{status:1,message:"未找到子区"}}case"signal":{const i=this.signalMarkerLayer.definitionExpression;this.signalMarkerLayer.definitionExpression=`id = '${e.id}'`;const t=await this.signalMarkerLayer.queryFeatures();if(t.features.length>0){this.signalPictureLayer.definitionExpression=`id = '${e.id}'`;const s=t.features[0],{districtId:a,subDistrictId:u}=s.attributes;return this.districtControllerDashLayer.definitionExpression=`id = '${a}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${a}'`,this.subDistrictControllerLayer.definitionExpression=`id = '${u}'`,await this.view.goTo({target:t.features,zoom:2500},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.signalMarkerLayer.definitionExpression=i,{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,i){const t=e.getAllSignalCoordinates();let s=null;if(t.length>=2)if(t.length===2)s=l.lineString(t);else{if(i){const r=l.featureCollection(t.map(d=>l.point(d)));s=p(r)}else{const r=m(t,.5);r.length>=4&&(s=l.polygon([r]))}s||(s=l.lineString(t))}else if(t.length===1)s=l.point(t[0]);else return;const a=y(s.geometry,i?200:30,{units:"meters"}),u=new c({geometry:{type:"polyline",paths:a.geometry.coordinates},attributes:{ObjectID:i?this.districtControllerOid++:this.subDistrictControllerOid++,id:e.id,name:e.name,subDistrictCount:e.subDistrictCount,signalCount:e.signalCount,parentId:e.parentId,parentName:e.parentName}});i?this.districtGraphics.push(u):this.subDistrictGraphics.push(u);for(const r of e.subDistricts)this.generateGraphic(r,!1);e.signals.forEach(r=>{const d=new c({geometry:{type:"point",x:r.longitude,y:r.latitude},attributes:{ObjectID:this.signalOid++,id:r.id,name:r.name,signalId:r.signalId,nodeId:r.nodeId,isKey:r.isKey,districtId:i?e.id:e.parentId,districtName:i?e.name:e.parentName,subDistrictId:i?"":e.id,subDistrictName:i?"":e.name}});this.signalGraphics.push(d)})}}exports.default=C;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.207",
3
+ "version": "1.0.209",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [