gisviewer-vue3-arcgis 1.0.204 → 1.0.205
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.
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +1 -1
- package/es/src/gis-map/utils/signal-control-area-controller/show-area.mjs +18 -16
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/show-area.js +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import y from "@arcgis/core/Graphic";
|
|
|
2
2
|
import a from "@arcgis/core/layers/FeatureLayer";
|
|
3
3
|
import c from "@turf/buffer";
|
|
4
4
|
import p from "@turf/convex";
|
|
5
|
-
import * as
|
|
5
|
+
import * as n from "@turf/helpers";
|
|
6
6
|
import m from "concaveman";
|
|
7
7
|
import h from "../../stores/index.mjs";
|
|
8
8
|
import g from "./district-controller.mjs";
|
|
@@ -675,27 +675,29 @@ class S {
|
|
|
675
675
|
async highlightSignalControlArea(e) {
|
|
676
676
|
switch (e.type) {
|
|
677
677
|
case "district": {
|
|
678
|
-
this.districtControllerDashLayer.definitionExpression = `id = '${e.id}'
|
|
678
|
+
this.districtControllerDashLayer.definitionExpression = `id = '${e.id}'`;
|
|
679
679
|
const t = await this.districtControllerDashLayer.queryFeatures();
|
|
680
|
-
return t.features.length > 0 ? (await this.view.goTo(t.features, {
|
|
680
|
+
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, {
|
|
681
681
|
duration: this.hasGpu ? 1e3 : 0
|
|
682
|
-
}), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
|
|
682
|
+
}), { status: 0, message: "ok" }) : (this.districtControllerDashLayer.definitionExpression = "1=1", { status: 1, message: "未找到区控" });
|
|
683
683
|
}
|
|
684
684
|
case "subDistrict": {
|
|
685
|
-
this.subDistrictControllerLayer.definitionExpression = `id = '${e.id}'
|
|
685
|
+
this.subDistrictControllerLayer.definitionExpression = `id = '${e.id}'`;
|
|
686
686
|
const t = await this.subDistrictControllerLayer.queryFeatures();
|
|
687
687
|
if (t.features.length > 0) {
|
|
688
|
+
this.signalMarkerLayer.definitionExpression = `subDistrictId = '${e.id}'`, this.signalPictureLayer.definitionExpression = `subDistrictId = '${e.id}'`;
|
|
688
689
|
const r = t.features[0].attributes.parentId;
|
|
689
690
|
return this.districtControllerDashLayer.definitionExpression = `id = '${r}'`, this.districtControllerSolidLayer.definitionExpression = `id = '${r}'`, await this.view.goTo(t.features, {
|
|
690
691
|
duration: this.hasGpu ? 1e3 : 0
|
|
691
692
|
}), { status: 0, message: "ok" };
|
|
692
693
|
} else
|
|
693
|
-
return { status: 1, message: "未找到子区" };
|
|
694
|
+
return this.subDistrictControllerLayer.definitionExpression = "1=1", { status: 1, message: "未找到子区" };
|
|
694
695
|
}
|
|
695
696
|
case "signal": {
|
|
696
|
-
this.signalMarkerLayer.definitionExpression = `id = '${e.id}'
|
|
697
|
+
this.signalMarkerLayer.definitionExpression = `id = '${e.id}'`;
|
|
697
698
|
const t = await this.signalMarkerLayer.queryFeatures();
|
|
698
699
|
if (t.features.length > 0) {
|
|
700
|
+
this.signalPictureLayer.definitionExpression = `id = '${e.id}'`;
|
|
699
701
|
const s = t.features[0], { districtId: r, subDistrictId: i } = s.attributes;
|
|
700
702
|
return this.districtControllerDashLayer.definitionExpression = `id = '${r}'`, this.districtControllerSolidLayer.definitionExpression = `id = '${r}'`, this.subDistrictControllerLayer.definitionExpression = `id = '${i}'`, await this.view.goTo(
|
|
701
703
|
{ target: t.features, zoom: 2500 },
|
|
@@ -704,7 +706,7 @@ class S {
|
|
|
704
706
|
}
|
|
705
707
|
), { status: 0, message: "ok" };
|
|
706
708
|
} else
|
|
707
|
-
return { status: 1, message: "未找到信号机" };
|
|
709
|
+
return this.signalMarkerLayer.definitionExpression = "1=1", { status: 1, message: "未找到信号机" };
|
|
708
710
|
}
|
|
709
711
|
default:
|
|
710
712
|
return { status: 1, message: "未知类型" };
|
|
@@ -732,18 +734,18 @@ class S {
|
|
|
732
734
|
if (s.length >= 2) {
|
|
733
735
|
let i = null;
|
|
734
736
|
if (s.length === 2)
|
|
735
|
-
i =
|
|
737
|
+
i = n.lineString(s);
|
|
736
738
|
else {
|
|
737
739
|
if (t) {
|
|
738
|
-
const
|
|
739
|
-
s.map((d) =>
|
|
740
|
+
const l = n.featureCollection(
|
|
741
|
+
s.map((d) => n.point(d))
|
|
740
742
|
);
|
|
741
|
-
i = p(
|
|
743
|
+
i = p(l);
|
|
742
744
|
} else {
|
|
743
|
-
const
|
|
744
|
-
|
|
745
|
+
const l = m(s, 0.5);
|
|
746
|
+
l.length >= 4 && (i = n.polygon([l]));
|
|
745
747
|
}
|
|
746
|
-
i || (i =
|
|
748
|
+
i || (i = n.lineString(s));
|
|
747
749
|
}
|
|
748
750
|
const u = c(
|
|
749
751
|
i.geometry,
|
|
@@ -786,7 +788,7 @@ class S {
|
|
|
786
788
|
id: i.id,
|
|
787
789
|
name: i.name,
|
|
788
790
|
signalId: i.signalId,
|
|
789
|
-
nodeId: i.
|
|
791
|
+
nodeId: i.nodeId,
|
|
790
792
|
isKey: i.isKey,
|
|
791
793
|
districtId: t ? e.id : e.parentId,
|
|
792
794
|
districtName: t ? e.name : e.parentName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../common-utils.js");class n{constructor(i,e){this.parentName="",this.signals=[],this.subDistricts=[],this.signalCount=0,this.subDistrictCount=0,this.id=i.name,this.name=i.areaDesc,this.parentId=i.parentId,this.areaColor=e==="alarm"?[255,0,0]:[61,139,249];for(const t of i.children)if(t.children){const s=new n(t,e);s.id=t.id,s.name=`SS ${t.name}`,s.parentId=this.id,s.parentName=this.name,this.subDistricts.push(s),this.subDistrictCount++,this.signalCount+=s.signalCount}else if(o.default.isCoordinateValid(t)){const s={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId,nodeId:t.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../common-utils.js");class n{constructor(i,e){this.parentName="",this.signals=[],this.subDistricts=[],this.signalCount=0,this.subDistrictCount=0,this.id=i.name,this.name=i.areaDesc,this.parentId=i.parentId,this.areaColor=e==="alarm"?[255,0,0]:[61,139,249];for(const t of i.children)if(t.children){const s=new n(t,e);s.id=t.id,s.name=`SS ${t.name}`,s.parentId=this.id,s.parentName=this.name,this.subDistricts.push(s),this.subDistrictCount++,this.signalCount+=s.signalCount}else if(o.default.isCoordinateValid(t)){const s={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId,nodeId:t.nodeId,isKey:t.isKey===1};this.signals.push(s),this.signalCount++}}getAllSignalCoordinates(){const i=[];for(const e of this.signals)i.push([e.longitude,e.latitude]);for(const e of this.subDistricts)i.push(...e.getAllSignalCoordinates());return i}}exports.default=n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/FeatureLayer"),p=require("@turf/buffer"),m=require("@turf/convex"),h=require("@turf/helpers"),g=require("concaveman"),f=require("../../stores/index.js"),b=require("./district-controller.js");function C(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const l=C(h);class I{constructor(e){var r;this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,this.subDistrictGraphics=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const s=f.default.useAppDataStore.mapConfig;this.openDriveServer=(r=s.openDriveServer)==null?void 0:r.url,this.districtControllerDashLayer=new n({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 n({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 n({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 n({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 n({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 s of e.areaList){const r=new b.default(s,e.style||"");await this.drawArea(r,!0),await this.subDistrictControllerLayer.applyEdits({addFeatures:this.subDistrictGraphics}),this.subDistrictGraphics=[]}const t=await this.districtControllerDashLayer.queryFeatures();return this.view.goTo(t.features),{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 i=await this.districtControllerDashLayer.queryFeatures(r);return i.features.length>0?(await this.view.goTo(i.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 r=this.signalMarkerLayer.createQuery();r.where=`id = '${e.id}'`,r.returnGeometry=!0,r.outFields=["*"];const i=await this.signalMarkerLayer.queryFeatures(r);return i.features.length>0?(await this.view.goTo({target:i.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":{this.districtControllerDashLayer.definitionExpression=`id = '${e.id}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${e.id}'`,this.subDistrictControllerLayer.definitionExpression=`parentId = '${e.id}'`,this.signalMarkerLayer.definitionExpression=`districtId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`districtId = '${e.id}'`;const t=await this.districtControllerDashLayer.queryFeatures();return t.features.length>0?(await this.view.goTo(t.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}case"subDistrict":{this.subDistrictControllerLayer.definitionExpression=`id = '${e.id}'`,this.signalMarkerLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`subDistrictId = '${e.id}'`;const t=await this.subDistrictControllerLayer.queryFeatures();if(t.features.length>0){const r=t.features[0].attributes.parentId;return this.districtControllerDashLayer.definitionExpression=`id = '${r}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${r}'`,await this.view.goTo(t.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return{status:1,message:"未找到子区"}}case"signal":{this.signalMarkerLayer.definitionExpression=`id = '${e.id}'`,this.signalPictureLayer.definitionExpression=`id = '${e.id}'`;const t=await this.signalMarkerLayer.queryFeatures();if(t.features.length>0){const s=t.features[0],{districtId:r,subDistrictId:i}=s.attributes;return this.districtControllerDashLayer.definitionExpression=`id = '${r}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${r}'`,this.subDistrictControllerLayer.definitionExpression=`id = '${i}'`,await this.view.goTo({target:t.features,zoom:2500},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return{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,t){const s=e.getAllSignalCoordinates();if(s.length>=2){let i=null;if(s.length===2)i=l.lineString(s);else{if(t){const o=l.featureCollection(s.map(c=>l.point(c)));i=m(o)}else{const o=g(s,.5);o.length>=4&&(i=l.polygon([o]))}i||(i=l.lineString(s))}const y=p(i.geometry,t?200:30,{units:"meters"}),u=new d({geometry:{type:"polyline",paths:y.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}});t?(await this.districtControllerDashLayer.applyEdits({addFeatures:[u]}),await this.districtControllerSolidLayer.applyEdits({addFeatures:[u]})):this.subDistrictGraphics.push(u)}for(const i of e.subDistricts)await this.drawArea(i,!1);const r=e.signals.map(i=>new d({geometry:{type:"point",x:i.longitude,y:i.latitude},attributes:{ObjectID:this.signalOid++,id:i.id,name:i.name,signalId:i.signalId,nodeId:i.id,isKey:i.isKey,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name}}));await this.signalMarkerLayer.applyEdits({addFeatures:r}),await this.signalPictureLayer.applyEdits({addFeatures:r})}}exports.default=I;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/Graphic"),n=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(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const l=C(m);class I{constructor(e){var r;this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,this.subDistrictGraphics=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const s=f.default.useAppDataStore.mapConfig;this.openDriveServer=(r=s.openDriveServer)==null?void 0:r.url,this.districtControllerDashLayer=new n({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 n({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 n({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 n({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 n({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 s of e.areaList){const r=new b.default(s,e.style||"");await this.drawArea(r,!0),await this.subDistrictControllerLayer.applyEdits({addFeatures:this.subDistrictGraphics}),this.subDistrictGraphics=[]}const t=await this.districtControllerDashLayer.queryFeatures();return this.view.goTo(t.features),{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 i=await this.districtControllerDashLayer.queryFeatures(r);return i.features.length>0?(await this.view.goTo(i.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 r=this.signalMarkerLayer.createQuery();r.where=`id = '${e.id}'`,r.returnGeometry=!0,r.outFields=["*"];const i=await this.signalMarkerLayer.queryFeatures(r);return i.features.length>0?(await this.view.goTo({target:i.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":{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="1=1",{status:1,message:"未找到区控"})}case"subDistrict":{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 r=t.features[0].attributes.parentId;return this.districtControllerDashLayer.definitionExpression=`id = '${r}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${r}'`,await this.view.goTo(t.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.subDistrictControllerLayer.definitionExpression="1=1",{status:1,message:"未找到子区"}}case"signal":{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:r,subDistrictId:i}=s.attributes;return this.districtControllerDashLayer.definitionExpression=`id = '${r}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${r}'`,this.subDistrictControllerLayer.definitionExpression=`id = '${i}'`,await this.view.goTo({target:t.features,zoom:2500},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.signalMarkerLayer.definitionExpression="1=1",{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,t){const s=e.getAllSignalCoordinates();if(s.length>=2){let i=null;if(s.length===2)i=l.lineString(s);else{if(t){const o=l.featureCollection(s.map(c=>l.point(c)));i=h(o)}else{const o=g(s,.5);o.length>=4&&(i=l.polygon([o]))}i||(i=l.lineString(s))}const y=p(i.geometry,t?200:30,{units:"meters"}),u=new d({geometry:{type:"polyline",paths:y.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}});t?(await this.districtControllerDashLayer.applyEdits({addFeatures:[u]}),await this.districtControllerSolidLayer.applyEdits({addFeatures:[u]})):this.subDistrictGraphics.push(u)}for(const i of e.subDistricts)await this.drawArea(i,!1);const r=e.signals.map(i=>new d({geometry:{type:"point",x:i.longitude,y:i.latitude},attributes:{ObjectID:this.signalOid++,id:i.id,name:i.name,signalId:i.signalId,nodeId:i.nodeId,isKey:i.isKey,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name}}));await this.signalMarkerLayer.applyEdits({addFeatures:r}),await this.signalPictureLayer.applyEdits({addFeatures:r})}}exports.default=I;
|