gisviewer-vue3-arcgis 1.0.179 → 1.0.181
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/gis-map.vue.d.ts +9 -1
- package/es/src/gis-map/gis-map.vue.mjs +65 -60
- package/es/src/gis-map/index.d.ts +9 -1
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +1 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +58 -73
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +3 -5
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +21 -21
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +25 -35
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +23 -1
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +53 -17
- package/lib/src/gis-map/gis-map.vue.d.ts +9 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +9 -1
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- 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/index.d.ts +23 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -26,12 +26,34 @@ export default class SignalControlAreaController {
|
|
|
26
26
|
* @returns
|
|
27
27
|
*/
|
|
28
28
|
private handleViewClick;
|
|
29
|
+
/**
|
|
30
|
+
* 显示周边的路口
|
|
31
|
+
* @param crossIds
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
29
34
|
private showNearbyCrosses;
|
|
35
|
+
private addCrossCallback;
|
|
36
|
+
private removeCrossCallback;
|
|
30
37
|
/**
|
|
31
38
|
* 编辑子区的路口
|
|
32
39
|
* @returns
|
|
33
40
|
*/
|
|
34
|
-
editSubSignalArea(
|
|
41
|
+
editSubSignalArea(addCrossCallback: (params: {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
}) => void, removeCrossCallback: (params: {
|
|
45
|
+
id: string;
|
|
46
|
+
}) => void): Promise<IResult>;
|
|
47
|
+
/**
|
|
48
|
+
* 从外部接口选中一个路口
|
|
49
|
+
* @param id
|
|
50
|
+
*/
|
|
51
|
+
selectSubSignalControlAreaCross(id: string): IResult;
|
|
52
|
+
/**
|
|
53
|
+
* 从外部接口取消选中一个路口
|
|
54
|
+
* @param id
|
|
55
|
+
*/
|
|
56
|
+
unselectSubSignalControlAreaCross(id: string): IResult;
|
|
35
57
|
/**
|
|
36
58
|
* 在区控\子区\路口图层中查找对应的graphic
|
|
37
59
|
* @param id
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils.js"),y=require("@arcgis/core/Graphic"),u=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/buffer"),f=require("@turf/convex"),C=require("@turf/helpers"),v=require("axios"),S=require("concaveman"),L=require("../../stores/index.js"),w=require("./district-controller.js");function p(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const I=p(d),c=p(C);class A{constructor(e){var s;this.crossScale=5e3,this.view=e;const i=L.default.useAppDataStore.mapConfig;this.openDriveServer=(s=i.openDriveServer)==null?void 0:s.url,this.districtControllerLayer=new u({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new u({id:"subDistrictControllerLayer",visible:!1}),this.crossLayer=new u({id:"crossLayer",visible:!1}),this.highlightLayer=new u({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1,this.districtControllerLayer.visible=!0;for(const t of e){const i=new w.default(t);this.drawArea(i,!0)}return this.scaleWatcher=I.watch(()=>this.view.scale,(t,i)=>{t>this.crossScale&&i<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):t<=this.crossScale&&i>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var e,t;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.scaleWatcher)==null||e.remove(),this.scaleWatcher=void 0,(t=this.clickWatcher)==null||t.remove(),this.clickWatcher=void 0,this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}async highlightSignalControlArea(e){if(!e.id||e.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id).toArray().map(r=>{const a=r.clone();return a.symbol.style="none",a}),i=this.subDistrictControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("parentId")===e.id).toArray().map(r=>r.clone()),s=this.crossLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("districtId")===e.id||r.getAttribute("subDistrictId")===e.id).toArray().map(r=>r.clone());if(t.length>0&&this.highlightLayer.addMany(t),i.length>0&&this.highlightLayer.addMany(i),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(t.length>0)await this.view.goTo(t);else if(i.length>0){const r=i[0].geometry.centroid;await this.view.goTo({target:r,scale:this.crossScale-500})}else s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,{status:0,message:"ok"}}showSubSignalControlArea(e){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const i=e.children.map(s=>{const r={...s,selected:!0};return new y({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossSymbolInSubDistrict(r),attributes:r})});return this.crossLayer.addMany(i),this.view.goTo(i),{status:0,message:"ok"}}async handleViewClick(e){var r;const i=(r=(await this.view.hitTest(e,{include:[this.crossLayer]})).results)==null?void 0:r.filter(a=>a.type==="graphic");if(i.length===0)return;const s=i[0].graphic;s.getAttribute("selected")||await this.showNearbyCrosses(s.getAttribute("id"))}async showNearbyCrosses(e){const t=await v.get(`http://${this.openDriveServer}/api/computable/getRelatedJunctionsForJunction`,{params:{junctionIds:e}});if(t.status===200)if(t.data.status===0){const i=t.data.result,s=[];return i.forEach(r=>{const{junctionId:a}=r;if(!this.crossLayer.graphics.some(n=>n.getAttribute("id")===a)){const n=new y({geometry:{type:"point",x:r.lon,y:r.lat},symbol:this.getCrossSymbolInSubDistrict(r),attributes:{id:r.junctionId,name:r.name,signalId:r.signalId,selected:!1}});s.push(n)}}),this.crossLayer.addMany(s),{status:0,message:"ok"}}else return{status:-1,message:t.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalArea(){if(this.openDriveServer){this.clickWatcher||(this.clickWatcher=this.view.on("click",async t=>{await this.handleViewClick(t)}));const e=this.crossLayer.graphics.toArray().map(t=>t.getAttribute("id")).join(",");return await this.showNearbyCrosses(e)}else return{status:1,message:"未配置OpenDriveServer"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(i=>i.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(i=>i.attributes.id===e)),t||(t=this.crossLayer.graphics.find(i=>i.attributes.id===e)),t}drawArea(e,t){const i=e.getAllCrossCoordinates();if(i.length>=2){let r=null;if(i.length===2)r=c.lineString(i);else{if(t){const h=c.featureCollection(i.map(m=>c.point(m)));r=f(h)}else{const h=S(i,.5);h.length>=4&&(r=c.polygon([h]))}r||(r=c.lineString(i))}const a=b(r.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const n={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},g=new y({geometry:{type:"polygon",rings:a.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.2],outline:{color:e.areaColor,width:3,style:t?"solid":"long-dash"}},attributes:n,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(g):this.subDistrictControllerLayer.add(g)}for(const r of e.subDistricts)this.drawArea(r,!1);const s=[];e.crosses.forEach(r=>{const a={type:"cross",id:r.id,name:r.name,color:e.areaColor,signalId:r.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:r.isKey},l=new y({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:this.getCrossGraphicSymbol(a,"marker"),attributes:a,popupTemplate:{title:r.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});s.push(l)}),this.crossLayer.addMany(s)}getCrossSymbolInSubDistrict(e){return e.signalId&&e.signalId!==""?{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:20,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:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${e.selected?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz.png",width:"20px",height:"20px"}}getCrossGraphicSymbol(e,t){const{isKey:i,color:s}=e;if(t==="marker")return i?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:s,size:8,outline:{color:"white",width:1}};if(t==="picture")return{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:i?30: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:i?40:20,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${i?"gis_gjxk_blue":"gis_xhj_blue"}.png`}]}}}}}exports.default=A;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),u=require("@arcgis/core/Graphic"),y=require("@arcgis/core/layers/GraphicsLayer"),d=require("@turf/buffer"),f=require("@turf/convex"),C=require("@turf/helpers"),v=require("axios"),S=require("concaveman"),A=require("../../stores/index.js"),I=require("./district-controller.js");function m(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const L=m(b),c=m(C);class w{constructor(t){var s;this.crossScale=5e3,this.view=t;const r=A.default.useAppDataStore.mapConfig;this.openDriveServer=(s=r.openDriveServer)==null?void 0:s.url,this.districtControllerLayer=new y({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new y({id:"subDistrictControllerLayer",visible:!1}),this.crossLayer=new y({id:"crossLayer",visible:!1}),this.highlightLayer=new y({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(t){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1,this.districtControllerLayer.visible=!0;for(const e of t){const r=new I.default(e);this.drawArea(r,!0)}return this.scaleWatcher=L.watch(()=>this.view.scale,(e,r)=>{e>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):e<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var t,e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(t=this.scaleWatcher)==null||t.remove(),this.scaleWatcher=void 0,(e=this.clickWatcher)==null||e.remove(),this.clickWatcher=void 0,this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(t){const e=this.findAreaGraphic(t.id);return e?(e.attributes.type==="cross"?await this.view.goTo({target:e.geometry,scale:1500}):await this.view.goTo(e.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}async highlightSignalControlArea(t){if(!t.id||t.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1;const e=this.districtControllerLayer.graphics.filter(i=>i.getAttribute("id")===t.id).toArray().map(i=>{const a=i.clone();return a.symbol.style="none",a}),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===t.id||i.getAttribute("parentId")===t.id).toArray().map(i=>i.clone()),s=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===t.id||i.getAttribute("districtId")===t.id||i.getAttribute("subDistrictId")===t.id).toArray().map(i=>i.clone());if(e.length>0&&this.highlightLayer.addMany(e),r.length>0&&this.highlightLayer.addMany(r),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(e.length>0)await this.view.goTo(e);else if(r.length>0){const i=r[0].geometry.centroid;await this.view.goTo({target:i,scale:this.crossScale-500})}else s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,{status:0,message:"ok"}}showSubSignalControlArea(t){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const r=t.children.map(s=>{const i={...s,selected:!0};return new u({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossSymbolInSubDistrict(i),attributes:i})});return this.crossLayer.addMany(r),this.view.goTo(r),{status:0,message:"ok"}}async handleViewClick(t){var i;const r=(i=(await this.view.hitTest(t,{include:[this.crossLayer]})).results)==null?void 0:i.filter(a=>a.type==="graphic");if(r.length===0)return;const s=r[0].graphic;s.getAttribute("selected")?s.getAttribute("signalId")&&(this.removeCrossCallback&&this.removeCrossCallback({id:s.getAttribute("id")}),s.setAttribute("selected",!1),s.symbol=this.getCrossSymbolInSubDistrict(s.attributes)):(s.getAttribute("signalId")&&(this.addCrossCallback&&this.addCrossCallback({id:s.getAttribute("id"),name:s.getAttribute("name")}),s.setAttribute("selected",!0),s.symbol=this.getCrossSymbolInSubDistrict(s.attributes)),await this.showNearbyCrosses(s.getAttribute("id")))}async showNearbyCrosses(t){const e=await v.get(`http://${this.openDriveServer}/api/computable/getRelatedJunctionsForJunction`,{params:{junctionIds:t}});if(e.status===200)if(e.data.status===0){const r=e.data.result,s=[];return r.forEach(i=>{const{junctionId:a}=i;if(!this.crossLayer.graphics.some(n=>n.getAttribute("id")===a)){const n=new u({geometry:{type:"point",x:i.lon,y:i.lat},symbol:this.getCrossSymbolInSubDistrict(i),attributes:{id:i.junctionId,name:i.name,signalId:i.signalId,selected:!1}});s.push(n)}}),this.crossLayer.addMany(s),{status:0,message:"ok"}}else return{status:-1,message:e.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalArea(t,e){if(this.openDriveServer){this.addCrossCallback=t,this.removeCrossCallback=e,this.clickWatcher||(this.clickWatcher=this.view.on("click",async s=>{await this.handleViewClick(s)}));const r=this.crossLayer.graphics.toArray().map(s=>s.getAttribute("id")).join(",");return await this.showNearbyCrosses(r)}else return{status:1,message:"未配置OpenDriveServer"}}selectSubSignalControlAreaCross(t){return this.crossLayer.graphics.forEach(e=>{if(e.getAttribute("id")===t&&!e.getAttribute("selected"))return e.setAttribute("selected",!0),e.symbol=this.getCrossSymbolInSubDistrict(e.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}unselectSubSignalControlAreaCross(t){return this.crossLayer.graphics.forEach(e=>{if(e.getAttribute("id")===t&&e.getAttribute("selected"))return e.setAttribute("selected",!1),e.symbol=this.getCrossSymbolInSubDistrict(e.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}findAreaGraphic(t){let e=this.districtControllerLayer.graphics.find(r=>r.attributes.id===t);return e||(e=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===t)),e||(e=this.crossLayer.graphics.find(r=>r.attributes.id===t)),e}drawArea(t,e){const r=t.getAllCrossCoordinates();if(r.length>=2){let i=null;if(r.length===2)i=c.lineString(r);else{if(e){const h=c.featureCollection(r.map(p=>c.point(p)));i=f(h)}else{const h=S(r,.5);h.length>=4&&(i=c.polygon([h]))}i||(i=c.lineString(r))}const a=d(i.geometry,e?200:30,{units:"meters"});let l;e?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const n={type:"signalControlArea",id:t.id,name:t.name,parentId:t.parentId,parentName:t.parentName,crossCount:t.crossCount,subDistrictCount:t.subDistrictCount},g=new u({geometry:{type:"polygon",rings:a.geometry.coordinates},symbol:{type:"simple-fill",color:[...t.areaColor,.3],outline:{color:t.areaColor,width:3,style:e?"long-dash":"solid"}},attributes:n,popupTemplate:{title:`${e?"区控":"子区"} ${t.name}`,content:[{type:"fields",fieldInfos:l}]}});e?this.districtControllerLayer.add(g):this.subDistrictControllerLayer.add(g)}for(const i of t.subDistricts)this.drawArea(i,!1);const s=[];t.crosses.forEach(i=>{const a={type:"cross",id:i.id,name:i.name,color:t.areaColor,signalId:i.signalId,districtId:e?t.id:t.parentId,districtName:e?t.name:t.parentName,subDistrictId:e?"":t.id,subDistrictName:e?"":t.name,isKey:i.isKey},l=new u({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossGraphicSymbol(a,"marker"),attributes:a,popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});s.push(l)}),this.crossLayer.addMany(s)}getCrossSymbolInSubDistrict(t){return t.signalId&&t.signalId!==""?{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:20,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:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${t.selected?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz.png",width:"20px",height:"20px"}}getCrossGraphicSymbol(t,e){const{isKey:r,color:s}=t;if(e==="marker")return r?{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_gjxklk_orange.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:s,size:8,outline:{color:"white",width:1}};if(e==="picture")return{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:r?30: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:r?40:20,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${r?"gis_gjxklk_orange":"gis_xhj_blue"}.png`}]}}}}}exports.default=w;
|