gisviewer-vue3-arcgis 1.0.208 → 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.
@@ -63,10 +63,10 @@ export default class SignalControlAreaController1 {
63
63
  message: string;
64
64
  }>;
65
65
  /**
66
- * 绘制区控、子区和信号机
66
+ * 生成区控、子区和信号机graphic
67
67
  * @param districtController
68
68
  * @param isDistrict 是否是区控
69
69
  * @returns
70
70
  */
71
- private drawArea;
71
+ private generateGraphic;
72
72
  }
@@ -1,5 +1,5 @@
1
1
  import u from "@arcgis/core/Graphic";
2
- import l from "@arcgis/core/layers/FeatureLayer";
2
+ import o from "@arcgis/core/layers/FeatureLayer";
3
3
  import y from "@turf/buffer";
4
4
  import c from "@turf/convex";
5
5
  import * as n from "@turf/helpers";
@@ -11,7 +11,7 @@ class x {
11
11
  var i;
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
13
  const t = h.useAppDataStore.mapConfig;
14
- this.openDriveServer = (i = t.openDriveServer) == null ? void 0 : i.url, this.districtControllerDashLayer = new l({
14
+ this.openDriveServer = (i = t.openDriveServer) == null ? void 0 : i.url, this.districtControllerDashLayer = new o({
15
15
  id: "districtController",
16
16
  spatialReference: e.spatialReference,
17
17
  source: [],
@@ -49,7 +49,7 @@ class x {
49
49
  width: 3
50
50
  }
51
51
  }
52
- }), this.districtControllerSolidLayer = new l({
52
+ }), this.districtControllerSolidLayer = new o({
53
53
  id: "districtController",
54
54
  spatialReference: e.spatialReference,
55
55
  source: [],
@@ -109,7 +109,7 @@ class x {
109
109
  width: 3
110
110
  }
111
111
  }
112
- }), this.subDistrictControllerLayer = new l({
112
+ }), this.subDistrictControllerLayer = new o({
113
113
  id: "subDistrictController",
114
114
  spatialReference: e.spatialReference,
115
115
  source: [],
@@ -173,7 +173,7 @@ class x {
173
173
  width: 3
174
174
  }
175
175
  }
176
- }), this.signalMarkerLayer = new l({
176
+ }), this.signalMarkerLayer = new o({
177
177
  id: "signalLayer",
178
178
  spatialReference: e.spatialReference,
179
179
  source: [],
@@ -291,7 +291,7 @@ class x {
291
291
  }
292
292
  ]
293
293
  }
294
- }), this.signalPictureLayer = new l({
294
+ }), this.signalPictureLayer = new o({
295
295
  id: "signalLayer",
296
296
  spatialReference: e.spatialReference,
297
297
  source: [],
@@ -581,7 +581,7 @@ class x {
581
581
  s,
582
582
  e.style || ""
583
583
  );
584
- this.drawArea(t, !0);
584
+ this.generateGraphic(t, !0);
585
585
  }
586
586
  return await this.districtControllerDashLayer.applyEdits({
587
587
  addFeatures: this.districtGraphics
@@ -604,15 +604,15 @@ class x {
604
604
  let e = await this.districtControllerDashLayer.queryFeatures();
605
605
  return await this.districtControllerDashLayer.applyEdits({
606
606
  deleteFeatures: e.features
607
- }), e = await this.districtControllerSolidLayer.queryFeatures(), await this.districtControllerSolidLayer.applyEdits({
607
+ }), this.districtControllerDashLayer.definitionExpression = "1=1", e = await this.districtControllerSolidLayer.queryFeatures(), await this.districtControllerSolidLayer.applyEdits({
608
608
  deleteFeatures: e.features
609
- }), e = await this.subDistrictControllerLayer.queryFeatures(), await this.subDistrictControllerLayer.applyEdits({
609
+ }), this.districtControllerSolidLayer.definitionExpression = "1=1", e = await this.subDistrictControllerLayer.queryFeatures(), await this.subDistrictControllerLayer.applyEdits({
610
610
  deleteFeatures: e.features
611
- }), e = await this.signalMarkerLayer.queryFeatures(), await this.signalMarkerLayer.applyEdits({
611
+ }), this.subDistrictControllerLayer.definitionExpression = "1=1", e = await this.signalMarkerLayer.queryFeatures(), await this.signalMarkerLayer.applyEdits({
612
612
  deleteFeatures: e.features
613
- }), e = await this.signalPictureLayer.queryFeatures(), await this.signalPictureLayer.applyEdits({
613
+ }), this.signalMarkerLayer.definitionExpression = "1=1", e = await this.signalPictureLayer.queryFeatures(), await this.signalPictureLayer.applyEdits({
614
614
  deleteFeatures: e.features
615
- }), { status: 0, message: "ok" };
615
+ }), this.signalPictureLayer.definitionExpression = "1=1", { status: 0, message: "ok" };
616
616
  }
617
617
  /**
618
618
  * 设置区控、子区、信号机图层可见性
@@ -708,8 +708,8 @@ class x {
708
708
  const t = await this.signalMarkerLayer.queryFeatures();
709
709
  if (t.features.length > 0) {
710
710
  this.signalPictureLayer.definitionExpression = `id = '${e.id}'`;
711
- const i = t.features[0], { districtId: a, subDistrictId: o } = i.attributes;
712
- return this.districtControllerDashLayer.definitionExpression = `id = '${a}'`, this.districtControllerSolidLayer.definitionExpression = `id = '${a}'`, this.subDistrictControllerLayer.definitionExpression = `id = '${o}'`, await this.view.goTo(
711
+ const i = t.features[0], { districtId: a, subDistrictId: l } = i.attributes;
712
+ return this.districtControllerDashLayer.definitionExpression = `id = '${a}'`, this.districtControllerSolidLayer.definitionExpression = `id = '${a}'`, this.subDistrictControllerLayer.definitionExpression = `id = '${l}'`, await this.view.goTo(
713
713
  { target: t.features, zoom: 2500 },
714
714
  {
715
715
  duration: this.hasGpu ? 1e3 : 0
@@ -734,14 +734,14 @@ class x {
734
734
  }), { status: 0, message: "ok" };
735
735
  }
736
736
  /**
737
- * 绘制区控、子区和信号机
737
+ * 生成区控、子区和信号机graphic
738
738
  * @param districtController
739
739
  * @param isDistrict 是否是区控
740
740
  * @returns
741
741
  */
742
- drawArea(e, s) {
742
+ generateGraphic(e, s) {
743
743
  const t = e.getAllSignalCoordinates();
744
- let i;
744
+ let i = null;
745
745
  if (t.length >= 2)
746
746
  if (t.length === 2)
747
747
  i = n.lineString(t);
@@ -768,7 +768,7 @@ class x {
768
768
  {
769
769
  units: "meters"
770
770
  }
771
- ), o = new u({
771
+ ), l = new u({
772
772
  geometry: {
773
773
  type: "polyline",
774
774
  paths: a.geometry.coordinates
@@ -783,9 +783,9 @@ class x {
783
783
  parentName: e.parentName
784
784
  }
785
785
  });
786
- s ? this.districtGraphics.push(o) : this.subDistrictGraphics.push(o);
786
+ s ? this.districtGraphics.push(l) : this.subDistrictGraphics.push(l);
787
787
  for (const r of e.subDistricts)
788
- this.drawArea(r, !1);
788
+ this.generateGraphic(r, !1);
789
789
  e.signals.forEach((r) => {
790
790
  const d = new u({
791
791
  geometry: {
@@ -63,10 +63,10 @@ export default class SignalControlAreaController1 {
63
63
  message: string;
64
64
  }>;
65
65
  /**
66
- * 绘制区控、子区和信号机
66
+ * 生成区控、子区和信号机graphic
67
67
  * @param districtController
68
68
  * @param isDistrict 是否是区控
69
69
  * @returns
70
70
  */
71
- private drawArea;
71
+ private generateGraphic;
72
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"),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.drawArea(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}),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 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"}}drawArea(e,i){const t=e.getAllSignalCoordinates();let s;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.drawArea(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;
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.208",
3
+ "version": "1.0.209",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [