gisviewer-vue3-arcgis 1.0.226 → 1.0.228
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/holo-flow/signal-holo-flow-lsr.mjs +11 -11
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +2 -1
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +22 -15
- package/es/src/gis-map/utils/signal-control-area-controller/layer-symbol.d.ts +8 -1
- package/es/src/gis-map/utils/signal-control-area-controller/layer-symbol.mjs +74 -56
- package/es/src/gis-map/utils/signal-control-area-controller/renderer/district-renderer.d.ts +40 -0
- package/es/src/gis-map/utils/signal-control-area-controller/renderer/district-renderer.mjs +123 -0
- package/es/src/gis-map/utils/signal-control-area-controller/renderer/signal-renderer.d.ts +22 -0
- package/es/src/gis-map/utils/signal-control-area-controller/renderer/signal-renderer.mjs +124 -0
- package/es/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.d.ts +27 -0
- package/es/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.mjs +142 -0
- package/es/src/gis-map/utils/signal-control-area-controller/show-area.d.ts +4 -14
- package/es/src/gis-map/utils/signal-control-area-controller/show-area.mjs +284 -341
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +2 -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/layer-symbol.d.ts +8 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/layer-symbol.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/renderer/district-renderer.d.ts +40 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/renderer/district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/renderer/signal-renderer.d.ts +22 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/renderer/signal-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.d.ts +27 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/show-area.d.ts +4 -14
- package/lib/src/gis-map/utils/signal-control-area-controller/show-area.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/core/reactiveUtils"),d=require("@arcgis/core/geometry"),S=require("@arcgis/core/geometry/support/webMercatorUtils.js"),b=require("@arcgis/core/layers/GraphicsLayer"),L=require("./signal-holo-flow.js");function P(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const t in u)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(e,t,l.get?l:{enumerable:!0,get:()=>u[t]})}}return e.default=u,Object.freeze(e)}const w=P(y),m=P(S);class M extends L.default{constructor(e,t){var l,i;super(e),this.stopLineLayer=new b,this.watchHandle=null,this.trajectoryDelayTime=2,this.stopLineMap=new Map,this.lampGroupMap=new Map,this.countdownPanelProps=t,this.view.map.add(this.stopLineLayer),this.trajectoryDelayTime=(
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/core/reactiveUtils"),d=require("@arcgis/core/geometry"),S=require("@arcgis/core/geometry/support/webMercatorUtils.js"),b=require("@arcgis/core/layers/GraphicsLayer"),L=require("./signal-holo-flow.js");function P(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const t in u)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(e,t,l.get?l:{enumerable:!0,get:()=>u[t]})}}return e.default=u,Object.freeze(e)}const w=P(y),m=P(S);class M extends L.default{constructor(e,t){var l,i;super(e),this.stopLineLayer=new b,this.watchHandle=null,this.trajectoryDelayTime=2,this.stopLineMap=new Map,this.lampGroupMap=new Map,this.countdownPanelProps=t,this.view.map.add(this.stopLineLayer),this.trajectoryDelayTime=(i=(l=this.mapConfig.holoFlow)==null?void 0:l.signal)==null?void 0:i.delay,this.trajectoryDelayTime===void 0&&(this.trajectoryDelayTime=2)}async initializeLayer(){var i,o;if(this.stopLineMap.size>0)return;console.time("初始化停止线图层");let e=(o=(i=this.mapConfig.holoFlow)==null?void 0:i.signal)==null?void 0:o.stopLineLayer;if(!e)return;e=this.mapConfig.assetsRoot+"/"+e;const l=await(await fetch(e)).json();for(const n of l.features){const{roadId:s}=n.properties;let{destinationPoint:a}=n.properties;const{coordinates:r}=n.geometry;if(a){if(typeof a=="string")try{a=JSON.parse(a)}catch(c){console.error("解析面板基准点失败",c);continue}}else{const c=r[0],h=r[r.length-1],p=(c[0]+h[0])/2,f=(c[1]+h[1])/2;a=[p,f]}this.stopLineMap.set(s,{coord:r,panelPoint:a})}console.timeEnd("初始化停止线图层")}initializeLampGroup(e){const{sigId:t,lampGroupList:l}=e,i=[];l.forEach(o=>{const{lampGroupNo:n,lampGroupType:s,crossFlowList:a,pedList:r}=o;if(a.length>0)for(const c of a){if(s===81)continue;const h=c.upSectionId;let p="s";switch(c.turn){case 1:p="s";break;case 2:p="l";break;case 4:p="r";break;case 8:p="u";break}i.push({lampGroupId:n,roadId:h,dir:p})}r.length>0}),this.lampGroupMap.set(t,i)}handleUniSignalData(e){this.watchHandle||(this.watchHandle=w.watch(()=>this.view.extent,()=>this.updatePanelPosition()));const{sigId:t,runningStatus:l}=e.data.basicInfo,i=this.lampGroupMap.get(t);if(!i)return{status:-1,message:"灯组未初始化"};const o=new Map;let n=!1;switch(String(l)){case"4":{n=!0,i.forEach(s=>{const{roadId:a,dir:r}=s;o.set(a,{...o.get(a)||{},[`${r}Number`]:"",[`${r}Color`]:"yellow"})});break}case"5":{i.forEach(s=>{const{roadId:a,dir:r}=s;o.set(a,{...o.get(a)||{},[`${r}Number`]:"",[`${r}Color`]:"red"})});break}case"6":case"9":{i.forEach(s=>{const{roadId:a,dir:r}=s;o.set(a,{...o.get(a)||{},[`${r}Number`]:"",[`${r}Color`]:"off"})});break}default:{const{curSigColorInfo:s}=e.data;s.forEach(a=>{const r=String(a.lamgroupId),{color:c,leftTime:h}=a,p=i.find(f=>f.lampGroupId===r);if(p){const{roadId:f,dir:g}=p;o.set(f,{...o.get(f)||{},[`${g}Number`]:h,[`${g}Color`]:c===1?"red":c===2?"yellow":"green"})}})}}return this.updateLampGroupPanelStatus(t,o,n),{status:0,message:"ok"}}getPanelScale(){const e=this.view.scale;let t=1;return e<500?t=1.2:e<1e3?t=1:e<2e3?t=.8:e<4e3?t=.4:t=0,t}updatePanelPosition(){const e=this.getPanelScale();for(const t of this.countdownPanelProps){e!==this.currentPanelScale&&(t.scale=e);const{mapPoint:l}=t;let i=new d.Point({x:l[0],y:l[1]});this.view.spatialReference.isWebMercator&&(i=m.geographicToWebMercator(i));const o=this.view.toScreen(i);if(t.position.left=o.x,t.position.top=o.y,this.view.type==="3d"){const n=this.getPanelRotation(t.stopLine);t.rotation=n}}this.currentPanelScale=e}doHoloSignalData(e){const t=e.crossId,l=e.phaseCountDownList,i=new Map;for(const o of l){let n="";for(let c of o.roadIdList)if(c.startsWith("-")&&(c=c.slice(1)),this.stopLineMap.has(c)){n=c;break}if(!n){console.log(`没有找到对应的进口道${t}--${n}`);continue}let s=i.get(n);if(s||(s={},i.set(n,s)),!o.direction)continue;const a=o.direction.toLowerCase(),r=o.color===1?"red":o.color===2?"yellow":"green";a==="u"?(s.uNumber=o.leftTime,s.uColor=r):a==="l"?(s.lNumber=o.leftTime,s.lColor=r):a==="s"?(s.sNumber=o.leftTime,s.sColor=r):a==="r"&&(s.rNumber=o.leftTime,s.rColor=r)}this.updateLampGroupPanelStatus(t,i)}updateLampGroupPanelStatus(e,t,l=!1){t.forEach((i,o)=>{const n=this.stopLineMap.get(o);if(!n)return;const s=this.countdownPanelProps.find(a=>a.roadId===o);if(s)s.lampStatus=i,s.flash=l;else{let a=new d.Point({x:n.panelPoint[0],y:n.panelPoint[1]});this.view.spatialReference.isWebMercator&&(a=m.geographicToWebMercator(a));const r=this.view.toScreen(a),c=this.getPanelRotation(n.coord);this.countdownPanelProps.push({displayMode:"complex",flash:l,crossId:e,roadId:o,mapPoint:n.panelPoint,stopLine:n.coord,position:{left:r.x,top:r.y},rotation:c,scale:this.getPanelScale(),lampStatus:i})}})}async handleHoloSignalData(e){this.watchHandle||(this.watchHandle=w.watch(()=>this.view.extent,()=>this.updatePanelPosition())),this.trajectoryDelayTime===0?this.doHoloSignalData(e):setTimeout(()=>this.doHoloSignalData(e),this.trajectoryDelayTime*1e3)}clearSignal(){var e;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(e=this.watchHandle)==null||e.remove(),this.watchHandle=null}getPanelRotation(e){const t=e[0];let l=new d.Point({x:t[0],y:t[1]});this.view.spatialReference.isWebMercator&&(l=m.geographicToWebMercator(l));const i=this.view.toScreen(l),o=e[e.length-1];let n=new d.Point({x:o[0],y:o[1]});this.view.spatialReference.isWebMercator&&(n=m.geographicToWebMercator(n));const s=this.view.toScreen(n),a=s.x-i.x,r=s.y-i.y;return Math.atan2(r,a)*(180/Math.PI)}}exports.default=M;
|
|
@@ -15,7 +15,7 @@ export default class DistrictController {
|
|
|
15
15
|
parentName: string;
|
|
16
16
|
signals: ICross[];
|
|
17
17
|
subDistricts: DistrictController[];
|
|
18
|
-
areaColor: number
|
|
18
|
+
areaColor: [number, number, number];
|
|
19
19
|
signalCount: number;
|
|
20
20
|
subDistrictCount: number;
|
|
21
21
|
constructor(params: any, style: string);
|
|
@@ -24,5 +24,6 @@ export default class DistrictController {
|
|
|
24
24
|
* @returns
|
|
25
25
|
*/
|
|
26
26
|
getAllSignalCoordinates(): number[][];
|
|
27
|
+
private getDarkNonGrayColor;
|
|
27
28
|
}
|
|
28
29
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("../common-utils.js");class e{constructor(s,n){this.parentName="",this.signals=[],this.subDistricts=[],this.areaColor=this.getDarkNonGrayColor(),this.signalCount=0,this.subDistrictCount=0,this.id=s.name,this.name=s.areaDesc,this.parentId=s.parentId,n==="alarm"&&(this.areaColor=[255,0,0]);for(const t of s.children)if(t.children){const i=new e(t,n);i.id=t.id,i.name=`SS ${t.name}`,i.parentId=this.id,i.parentName=this.name,this.subDistricts.push(i),this.subDistrictCount++,this.signalCount+=i.signalCount}else if(d.default.isCoordinateValid(t)){const i={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(i),this.signalCount++}}getAllSignalCoordinates(){const s=[];for(const n of this.signals)s.push([n.longitude,n.latitude]);for(const n of this.subDistricts)s.push(...n.getAllSignalCoordinates());return s}getDarkNonGrayColor(){const s=Math.floor(Math.random()*360),n=80+Math.random()*20,t=15+Math.random()*15,i=n/100*Math.min(t/100,1-t/100),o=r=>{const a=(r+s/30)%12,l=t/100-i*Math.max(Math.min(a-3,9-a,1),-1);return Math.round(255*l)};return[o(0),o(8),o(4)]}}exports.default=e;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
/** 区控的虚线边框图层 */
|
|
1
2
|
declare const districtDashLineLayerOptions: any;
|
|
3
|
+
/** 区控的实线边框图层 */
|
|
2
4
|
declare const districtSolidLineLayerOptions: any;
|
|
5
|
+
/** 子区图层 */
|
|
3
6
|
declare const subDistrictLayerOptions: any;
|
|
7
|
+
declare const subDistrictPointLayerOptions: any;
|
|
8
|
+
/** 信号机圆点图层 */
|
|
4
9
|
declare const signalMarkerLayerOptions: any;
|
|
10
|
+
/** 信号机图标图层 */
|
|
5
11
|
declare const signalPictureLayerOptions: any;
|
|
12
|
+
/** 信号机聚合图层 */
|
|
6
13
|
declare const signalClusterLayerOptions: any;
|
|
7
|
-
export { districtDashLineLayerOptions, districtSolidLineLayerOptions, signalClusterLayerOptions, signalMarkerLayerOptions, signalPictureLayerOptions, subDistrictLayerOptions };
|
|
14
|
+
export { districtDashLineLayerOptions, districtSolidLineLayerOptions, signalClusterLayerOptions, signalMarkerLayerOptions, signalPictureLayerOptions, subDistrictLayerOptions, subDistrictPointLayerOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={id:"districtController",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"},{name:"selected",type:"string"}],renderer:{type:"unique-value",field:"selected",defaultSymbol:{type:"simple-line",style:"long-dash",color:[111,100,255],width:2},uniqueValueInfos:[{value:"false",symbol:{type:"simple-line",style:"long-dash",color:[180,180,180],width:1}}]}},t={id:"districtController",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"},{name:"type",type:"string"},{name:"selected",type:"string"}],popupTemplate:{title:"{name}",content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"区控编号"},{fieldName:"subDistrictCount",label:"子区数量"},{fieldName:"signalCount",label:"信号机数量"}]}]},renderer:{type:"unique-value",field:"selected",defaultSymbol:{type:"simple-line",style:"solid",color:[111,100,255,.4],width:2},uniqueValueInfos:[{value:"false",symbol:{type:"simple-line",style:"solid",color:[180,180,180,.4],width:1}}]}},i={id:"subDistrictController",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={id:"districtController",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"},{name:"selected",type:"string"}],renderer:{type:"unique-value",field:"selected",defaultSymbol:{type:"simple-line",style:"long-dash",color:[111,100,255],width:2},uniqueValueInfos:[{value:"false",symbol:{type:"simple-line",style:"long-dash",color:[180,180,180],width:1}}]}},t={id:"districtController",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"},{name:"type",type:"string"},{name:"selected",type:"string"}],popupTemplate:{title:"{name}",content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"区控编号"},{fieldName:"subDistrictCount",label:"子区数量"},{fieldName:"signalCount",label:"信号机数量"}]}]},renderer:{type:"unique-value",field:"selected",defaultSymbol:{type:"simple-line",style:"solid",color:[111,100,255,.4],width:2},uniqueValueInfos:[{value:"false",symbol:{type:"simple-line",style:"solid",color:[180,180,180,.4],width:1}}]}},i={id:"subDistrictController",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"signalCount",type:"integer"},{name:"selected",type:"string"},{name:"type",type:"string"}],popupTemplate:{title:"{subDistrictName} 子区",content:[{type:"fields",fieldInfos:[{fieldName:"subDistrictId",label:"子区编号"},{fieldName:"districtName",label:"所属区控"},{fieldName:"signalCount",label:"信号机数量"}]}]}},r={id:"signalLayer",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"},{name:"type",type:"string"},{name:"selected",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",field2:"selected",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:0}},uniqueValueInfos:[{value:"true,true",symbol:{type:"simple-marker",style:"circle",color:[254,172,22,.8],size:8,outline:{color:"white",width:0}}},{value:"false,true",symbol:{type:"simple-marker",style:"circle",color:[5,116,255,.8],size:8,outline:{color:"white",width:0}}},{value:"true,false",symbol:{type:"simple-marker",style:"circle",color:[180,180,180,.8],size:8,outline:{color:"white",width:0}}},{value:"false,false",symbol:{type:"simple-marker",style:"circle",color:[180,180,180,.8],size:8,outline:{color:"white",width:0}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:8,value:9000.954822000003},{size:6,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]}},l={id:"signalLayer",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"},{name:"type",type:"string"},{name:"selected",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",field2:"selected",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:1}},uniqueValueInfos:[{value:"true,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:20,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_gjxklk_orange.png"}]}}}},{value:"false,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: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"}]}}}},{value:"true,false",symbol:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_gjxk_gray.png",width:20,height:20}},{value:"false,false",symbol:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_xhj_gray.png",width:20,height:20}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:28,value:2250},{size:24,value:4500}]}]}},s={id:"signalLayer",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"},{name:"type",type:"string"},{name:"type",type:"string"},{name:"selected",type:"string"}],featureReduction:{type:"cluster",clusterRadius:"120px",clusterMaxSize:"50px",clusterMinSize:"30px",symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.cluster_count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""},{type:"CIMMarkerGraphic",geometry:{rings:[[[-15,40],[15,40],[15,20],[-15,20],[-15,40]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[2,72,200,255]},{type:"CIMSolidStroke",enable:!0,width:5,color:[2,72,200,128]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:40,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}},popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]},renderer:{type:"simple",symbol:{type:"simple-marker",style:"circle",color:[5,116,255],size:8,outline:{color:"white",width:1}}}};exports.districtDashLineLayerOptions=e;exports.districtSolidLineLayerOptions=t;exports.signalClusterLayerOptions=s;exports.signalMarkerLayerOptions=r;exports.signalPictureLayerOptions=l;exports.subDistrictPointLayerOptions=i;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IResult } from '../../../../types';
|
|
2
|
+
import DistrictController from '../district-controller';
|
|
3
|
+
export default class DistrictRenderer {
|
|
4
|
+
private view;
|
|
5
|
+
/** 区控虚线图层 */
|
|
6
|
+
private districtControllerDashLayer;
|
|
7
|
+
/** 区控实线图层,区控符号由半透明实线+不透明虚线组成 */
|
|
8
|
+
private districtControllerSolidLayer;
|
|
9
|
+
style: string;
|
|
10
|
+
private hasGpu;
|
|
11
|
+
constructor(view: __esri.MapView | __esri.SceneView, hasGpu: boolean);
|
|
12
|
+
/**
|
|
13
|
+
* 显示区控
|
|
14
|
+
* @param controllers 区控控制器数组
|
|
15
|
+
*/
|
|
16
|
+
showDistricts(controllers: DistrictController[]): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* 清除区控图层
|
|
19
|
+
*/
|
|
20
|
+
clearDistricts(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* 设置区控图层可见性
|
|
23
|
+
* @param visible
|
|
24
|
+
*/
|
|
25
|
+
setVisible(visible: boolean): void;
|
|
26
|
+
/**
|
|
27
|
+
* 定位区控
|
|
28
|
+
* @param id
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
locateDistrict(id: string): Promise<IResult>;
|
|
32
|
+
/**
|
|
33
|
+
* 高亮区控, 其他区控隐藏
|
|
34
|
+
* @param id 区控ID
|
|
35
|
+
* @return 返回高亮区控的数量
|
|
36
|
+
*/
|
|
37
|
+
highlightDistrict(id: string): Promise<number>;
|
|
38
|
+
filter(id: string): void;
|
|
39
|
+
resetFilter(): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/FeatureLayer"),C=require("@turf/helpers"),c=require("@turf/turf"),d=require("../layer-symbol.js");function g(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const n=g(C);class L{constructor(t,e){this.style="",this.hasGpu=!0,this.view=t,this.hasGpu=e,this.districtControllerDashLayer=new l(d.districtDashLineLayerOptions),this.districtControllerDashLayer.spatialReference=t.spatialReference,this.districtControllerSolidLayer=new l(d.districtSolidLineLayerOptions),this.districtControllerSolidLayer.spatialReference=t.spatialReference,this.districtControllerSolidLayer.popupEnabled=!0,this.view.map.addMany([this.districtControllerDashLayer,this.districtControllerSolidLayer])}async showDistricts(t){await this.clearDistricts();const e=[];for(let i=0;i<t.length;i++){const r=t[i],s=r.getAllSignalCoordinates();let a=null;if(s.length>=2)if(s.length===2)a=n.lineString(s);else{const y=n.featureCollection(s.map(p=>n.point(p)));a=c.convex(y),a||(a=n.lineString(s))}else if(s.length===1)a=n.point(s[0]);else continue;const u=c.buffer(a.geometry,200,{units:"meters"}),h=new f({geometry:{type:"polyline",paths:u.geometry.coordinates},attributes:{ObjectID:i,id:r.id,name:r.name,subDistrictCount:r.subDistrictCount,signalCount:r.signalCount,parentId:r.parentId,parentName:r.parentName,selected:this.style,type:"district"}});e.push(h)}await this.districtControllerDashLayer.applyEdits({addFeatures:e}),await this.districtControllerSolidLayer.applyEdits({addFeatures:e}),await this.view.goTo(e,{duration:this.hasGpu?1e3:0})}async clearDistricts(){let t=await this.districtControllerDashLayer.queryFeatures();await this.districtControllerDashLayer.applyEdits({deleteFeatures:t.features}),this.districtControllerDashLayer.definitionExpression="1=1",t=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:t.features}),this.districtControllerSolidLayer.definitionExpression="1=1"}setVisible(t){this.districtControllerDashLayer.visible=t,this.districtControllerSolidLayer.visible=t}async locateDistrict(t){const e=this.districtControllerDashLayer.createQuery();e.where=`id = '${t}'`,e.returnGeometry=!0,e.outFields=["*"];const i=await this.districtControllerDashLayer.queryFeatures(e);return i.features.length>0?(await this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}async highlightDistrict(t){const e=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${t}'`;const i=await this.districtControllerDashLayer.queryFeatures(),r=i.features.length;return r>0?(this.districtControllerSolidLayer.definitionExpression=`id = '${t}'`,await this.view.goTo(i.features,{duration:this.hasGpu?1e3:0})):this.districtControllerDashLayer.definitionExpression=e,r}filter(t){const e=`id = '${t}'`;this.districtControllerDashLayer.definitionExpression=e,this.districtControllerSolidLayer.definitionExpression=e}resetFilter(){this.districtControllerDashLayer.definitionExpression="1=1",this.districtControllerSolidLayer.definitionExpression="1=1"}}exports.default=L;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IResult } from '../../../../types';
|
|
2
|
+
import DistrictController from '../district-controller';
|
|
3
|
+
export default class CrossRenderer {
|
|
4
|
+
private view;
|
|
5
|
+
private hasGpu;
|
|
6
|
+
private signalMarkerLayer;
|
|
7
|
+
private signalPictureLayer;
|
|
8
|
+
private signalClusterLayer;
|
|
9
|
+
constructor(view: __esri.MapView | __esri.SceneView, hasGpu: boolean);
|
|
10
|
+
showSignals(controllers: DistrictController[]): Promise<void>;
|
|
11
|
+
clearSignals(): Promise<void>;
|
|
12
|
+
setPointVisible(visible: boolean): Promise<void>;
|
|
13
|
+
setClusterVisible(visible: boolean): void;
|
|
14
|
+
locateSignal(id: string): Promise<IResult>;
|
|
15
|
+
highlightSignal(id: string): Promise<{
|
|
16
|
+
districtId: string;
|
|
17
|
+
subDistrictId: string;
|
|
18
|
+
count: number;
|
|
19
|
+
}>;
|
|
20
|
+
filter(type: string, id: string): void;
|
|
21
|
+
resetFilter(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/Graphic"),u=require("@arcgis/core/layers/FeatureLayer"),l=require("../layer-symbol.js");class y{constructor(e,a){this.view=e,this.hasGpu=a,this.signalMarkerLayer=new u(l.signalMarkerLayerOptions),this.signalMarkerLayer.spatialReference=e.spatialReference,this.signalMarkerLayer.popupEnabled=!0,this.signalPictureLayer=new u(l.signalPictureLayerOptions),this.signalPictureLayer.spatialReference=e.spatialReference,this.signalPictureLayer.popupEnabled=!0,this.signalClusterLayer=new u(l.signalClusterLayerOptions),this.signalClusterLayer.spatialReference=e.spatialReference,this.signalClusterLayer.popupEnabled=!0,this.view.map.addMany([this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer])}async showSignals(e){await this.clearSignals();let a=0;const s=[];e.forEach(r=>{r.signals.forEach(i=>{const t=new d({geometry:{type:"point",longitude:i.longitude,latitude:i.latitude},attributes:{ObjectID:a++,id:i.id,name:i.name,signalId:i.signalId,nodeId:i.nodeId||i.id,districtId:r.id,districtName:r.name,subDistrictId:"",subDistrictName:"",isKey:i.isKey,type:"signal",selected:!0}});s.push(t)}),r.subDistricts.forEach(i=>{i.signals.forEach(t=>{const n=new d({geometry:{type:"point",longitude:t.longitude,latitude:t.latitude},attributes:{ObjectID:a++,id:t.id,name:t.name,signalId:t.signalId,nodeId:t.nodeId||t.id,districtId:r.id,districtName:r.name,subDistrictId:i.id,subDistrictName:i.name,isKey:t.isKey,type:"signal",selected:!0}});s.push(n)})})}),await this.signalMarkerLayer.applyEdits({addFeatures:s}),await this.signalPictureLayer.applyEdits({addFeatures:s}),await this.signalClusterLayer.applyEdits({addFeatures:s})}async clearSignals(){let e=await this.signalMarkerLayer.queryFeatures();await this.signalMarkerLayer.applyEdits({deleteFeatures:e.features}),this.signalMarkerLayer.definitionExpression="1=1",e=await this.signalPictureLayer.queryFeatures(),await this.signalPictureLayer.applyEdits({deleteFeatures:e.features}),this.signalPictureLayer.definitionExpression="1=1",e=await this.signalClusterLayer.queryFeatures(),await this.signalClusterLayer.applyEdits({deleteFeatures:e.features}),this.signalClusterLayer.definitionExpression="1=1"}async setPointVisible(e){this.signalMarkerLayer.visible=e,this.signalPictureLayer.visible=e}setClusterVisible(e){this.signalClusterLayer.visible=e}async locateSignal(e){return{status:0,message:"ok"}}async highlightSignal(e){let a="",s="";const r=this.signalMarkerLayer.definitionExpression;this.signalMarkerLayer.definitionExpression=`signalId = '${e}'`;const i=await this.signalMarkerLayer.queryFeatures(),t=i.features.length;if(t>0){const n=i.features[0].attributes.districtId||"",c=i.features[0].attributes.subDistrictId||"";return await this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{districtId:n,subDistrictId:c,count:t}}else this.signalMarkerLayer.definitionExpression=r;return{districtId:a,subDistrictId:s,count:t}}filter(e,a){const s=`${e==="district"?"districtId":"subDistrictId"} = '${a}'`;this.signalClusterLayer.definitionExpression=s,this.signalMarkerLayer.definitionExpression=s,this.signalPictureLayer.definitionExpression=s}resetFilter(){const e="1=1";this.signalClusterLayer.definitionExpression=e,this.signalMarkerLayer.definitionExpression=e,this.signalPictureLayer.definitionExpression=e}}exports.default=y;
|
package/lib/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IResult } from '../../../../types';
|
|
2
|
+
import DistrictController from '../district-controller';
|
|
3
|
+
export default class SubDistrictRenderer {
|
|
4
|
+
private view;
|
|
5
|
+
private hasGpu;
|
|
6
|
+
private subDistrictPointLayer;
|
|
7
|
+
constructor(view: __esri.MapView | __esri.SceneView, hasGpu: boolean);
|
|
8
|
+
showSubDistricts(controllers: DistrictController[]): Promise<void>;
|
|
9
|
+
clearSubDistricts(): Promise<void>;
|
|
10
|
+
setVisible(visible: boolean): void;
|
|
11
|
+
/**
|
|
12
|
+
* 定位子区
|
|
13
|
+
* @param id 子区ID
|
|
14
|
+
*/
|
|
15
|
+
locateSubDistrict(id: string): Promise<IResult>;
|
|
16
|
+
/**
|
|
17
|
+
* 高亮子区, 其他子区隐藏
|
|
18
|
+
* @param id 子区ID
|
|
19
|
+
* @return 返回高亮子区的数量以及区控id
|
|
20
|
+
*/
|
|
21
|
+
highlightSubDistrict(id: string): Promise<{
|
|
22
|
+
count: number;
|
|
23
|
+
parentId: string;
|
|
24
|
+
}>;
|
|
25
|
+
filter(type: string, id: string): void;
|
|
26
|
+
resetFilter(): void;
|
|
27
|
+
}
|
package/lib/src/gis-map/utils/signal-control-area-controller/renderer/sub-district-renderer.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("@arcgis/core/Graphic"),o=require("@arcgis/core/layers/FeatureLayer"),c=require("../layer-symbol.js");class d{constructor(t,i){this.view=t,this.hasGpu=i,this.subDistrictPointLayer=new o(c.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=t.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.view.map.add(this.subDistrictPointLayer)}async showSubDistricts(t){await this.clearSubDistricts();let i=0;const s=[],r=[];t.forEach(e=>{r.push({value:e.id,label:e.name,symbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[...e.areaColor],width:4}}}),e.signals.forEach(a=>{const u=new n({geometry:{type:"point",longitude:a.longitude,latitude:a.latitude},attributes:{ObjectID:i++,id:a.id,name:a.name,subDistrictId:e.id,subDistrictName:e.name,districtId:e.parentId,districtName:e.parentName,signalCount:e.signalCount}});s.push(u)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:"gray",size:"8px",outline:{color:"white",width:1}},defaultLabel:"其他子区",uniqueValueInfos:r,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},await this.subDistrictPointLayer.applyEdits({addFeatures:s}),await this.view.goTo(s,{duration:this.hasGpu?1e3:0})}async clearSubDistricts(){const t=await this.subDistrictPointLayer.queryFeatures();t.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:t.features}),this.subDistrictPointLayer.definitionExpression="1=1"}setVisible(t){this.subDistrictPointLayer.visible=t}async locateSubDistrict(t){const i=this.subDistrictPointLayer.createQuery();i.where=`subDistrictId = '${t}'`,i.returnGeometry=!0;const s=await this.subDistrictPointLayer.queryFeatures(i);return s.features.length>0?(await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}async highlightSubDistrict(t){let i="";const s=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${t}'`;const r=await this.subDistrictPointLayer.queryFeatures(),e=r.features.length;return e>0?(i=r.features[0].attributes.districtId,await this.view.goTo(r.features,{duration:this.hasGpu?1e3:0})):this.subDistrictPointLayer.definitionExpression=s,{count:e,parentId:i}}filter(t,i){const s=`${t==="district"?"districtId":"subDistrictId"} = '${i}'`;this.subDistrictPointLayer.definitionExpression=s}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1"}}exports.default=d;
|
|
@@ -5,18 +5,10 @@ export default class SignalControlAreaController1 {
|
|
|
5
5
|
/** 支队图层 */
|
|
6
6
|
private detachmentLayer;
|
|
7
7
|
private detachmentLayerLoaded;
|
|
8
|
-
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
private districtControllerSolidLayer;
|
|
8
|
+
private districtRenderer;
|
|
9
|
+
private subDistrictRenderer;
|
|
10
|
+
private signalRenderer;
|
|
12
11
|
/** 子区图层 */
|
|
13
|
-
private subDistrictControllerLayer;
|
|
14
|
-
/** 信号机圆点图层 */
|
|
15
|
-
private signalMarkerLayer;
|
|
16
|
-
/** 信号机图标图层 */
|
|
17
|
-
private signalPictureLayer;
|
|
18
|
-
/** 信号机聚合图层 */
|
|
19
|
-
private signalClusterLayer;
|
|
20
12
|
private clickHandler;
|
|
21
13
|
private districtControllerOid;
|
|
22
14
|
private subDistrictControllerOid;
|
|
@@ -77,15 +69,13 @@ export default class SignalControlAreaController1 {
|
|
|
77
69
|
* @returns
|
|
78
70
|
*/
|
|
79
71
|
private generateGraphic;
|
|
80
|
-
private viewHitTest;
|
|
81
72
|
/**
|
|
82
73
|
* 重置所有graphic的置灰状态
|
|
83
74
|
*/
|
|
84
|
-
private resetSelectedSymbol;
|
|
85
75
|
/**
|
|
86
76
|
* 加载支队图层
|
|
87
77
|
* 现场环境用url创建FeatureLayer有各种问题,
|
|
88
|
-
*
|
|
78
|
+
* 改为图层导出为json,用json创建Graphic,再将Graphic添加到FeatureLayer
|
|
89
79
|
*/
|
|
90
80
|
private loadDetachmentLayer;
|
|
91
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("@arcgis/core/core/reactiveUtils"),E=require("@arcgis/core/geometry"),D=require("@arcgis/core/geometry/support/webMercatorUtils"),g=require("@arcgis/core/Graphic"),d=require("@arcgis/core/layers/FeatureLayer"),m=require("@arcgis/core/layers/GraphicsLayer"),F=require("@turf/buffer"),k=require("@turf/convex"),v=require("@turf/helpers"),S=require("concaveman"),G=require("../../stores/index.js"),q=require("./district-controller.js"),y=require("./layer-symbol.js");function L(h){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>h[t]})}}return e.default=h,Object.freeze(e)}const x=L(C),p=L(v);class M{constructor(e){this.detachmentLayerLoaded=!1,this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,this.popupEnabled=!0,this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const t=G.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.detachmentLayer=new m,this.districtControllerDashLayer=new d(y.districtDashLineLayerOptions),this.districtControllerDashLayer.spatialReference=e.spatialReference,this.districtControllerSolidLayer=new d(y.districtSolidLineLayerOptions),this.districtControllerSolidLayer.spatialReference=e.spatialReference,this.districtControllerSolidLayer.popupEnabled=this.popupEnabled,this.subDistrictControllerLayer=new d(y.subDistrictLayerOptions),this.subDistrictControllerLayer.spatialReference=e.spatialReference,this.subDistrictControllerLayer.popupEnabled=this.popupEnabled,this.signalMarkerLayer=new d(y.signalMarkerLayerOptions),this.signalMarkerLayer.spatialReference=e.spatialReference,this.signalMarkerLayer.popupEnabled=this.popupEnabled,this.signalPictureLayer=new d(y.signalPictureLayerOptions),this.signalPictureLayer.spatialReference=e.spatialReference,this.signalPictureLayer.popupEnabled=this.popupEnabled,this.signalClusterLayer=new d(y.signalClusterLayerOptions),this.signalClusterLayer.spatialReference=e.spatialReference,this.signalClusterLayer.popupEnabled=this.popupEnabled,this.view.map.addMany([this.detachmentLayer,this.districtControllerSolidLayer,this.districtControllerDashLayer,this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer,this.subDistrictControllerLayer]),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this))}async showSignalControlArea(e){this.detachmentLayerLoaded||await this.loadDetachmentLayer(),await this.clearSignalControlArea(),this.districtControllerDashLayer.visible=!1,this.districtControllerSolidLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.signalMarkerLayer.visible=!1,this.signalPictureLayer.visible=!1,this.signalClusterLayer.visible=!0;for(const t of e.areaList){const s=new q.default(t,e.style||"");this.generateGraphic(s,!0,e.style)}return await this.districtControllerDashLayer.applyEdits({addFeatures:this.districtGraphics}),await this.districtControllerSolidLayer.applyEdits({addFeatures:this.districtGraphics}),this.view.goTo(this.districtGraphics),this.districtGraphics=[],await this.subDistrictControllerLayer.applyEdits({addFeatures:this.subDistrictGraphics}),this.subDistrictGraphics=[],await this.signalMarkerLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalPictureLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalClusterLayer.applyEdits({addFeatures:this.signalGraphics}),this.signalGraphics=[],{status:0,message:"ok"}}async clearSignalControlArea(){this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0;let e=await this.districtControllerDashLayer.queryFeatures();return await this.districtControllerDashLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerDashLayer.definitionExpression="1=1",e=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerSolidLayer.definitionExpression="1=1",e=await this.subDistrictControllerLayer.queryFeatures(),await this.subDistrictControllerLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictControllerLayer.definitionExpression="1=1",e=await this.signalMarkerLayer.queryFeatures(),await this.signalMarkerLayer.applyEdits({deleteFeatures:e.features}),this.signalMarkerLayer.definitionExpression="1=1",e=await this.signalPictureLayer.queryFeatures(),await this.signalPictureLayer.applyEdits({deleteFeatures:e.features}),this.signalPictureLayer.definitionExpression="1=1",e=await this.signalClusterLayer.queryFeatures(),await this.signalClusterLayer.applyEdits({deleteFeatures:e.features}),this.signalClusterLayer.definitionExpression="1=1",{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtControllerDashLayer.visible=e.visible,this.districtControllerSolidLayer.visible=e.visible;break;case"subDistrict":this.subDistrictControllerLayer.visible=e.visible;break;case"signal":this.signalMarkerLayer.visible=e.visible,this.signalPictureLayer.visible=e.visible;break;case"signalCluster":this.signalClusterLayer.visible=e.visible;break;case"shanghai_district":this.detachmentLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":{const i=this.districtControllerDashLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.districtControllerDashLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo(r.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}case"subDistrict":const t=this.subDistrictControllerLayer.createQuery();t.where=`id = '${e.id}'`,t.returnGeometry=!0,t.outFields=["*"];const s=await this.subDistrictControllerLayer.queryFeatures(t);return s.features.length>0?(await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到子区"};case"signal":{const i=this.signalMarkerLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.signalMarkerLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo({target:r.features[0],scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){var t;switch((t=this.view.popup)!=null&&t.visible&&this.view.popup.close(),e.type){case"district":{const s=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${e.id}'`;const i=await this.districtControllerDashLayer.queryFeatures();return i.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}'`,this.signalClusterLayer.definitionExpression=`districtId = '${e.id}'`,await this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):(this.districtControllerDashLayer.definitionExpression=s,{status:1,message:"未找到区控"})}case"subDistrict":{const s=this.subDistrictControllerLayer.definitionExpression;this.subDistrictControllerLayer.definitionExpression=`id = '${e.id}'`;const i=await this.subDistrictControllerLayer.queryFeatures();if(i.features.length>0){this.signalMarkerLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalClusterLayer.definitionExpression=`subDistrictId = '${e.id}'`;const l=i.features[0].attributes.parentId;return this.districtControllerDashLayer.definitionExpression=`id = '${l}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${l}'`,await this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.subDistrictControllerLayer.definitionExpression=s,{status:1,message:"未找到子区"}}case"signal":{const s=this.signalMarkerLayer.definitionExpression;this.signalMarkerLayer.definitionExpression=`id = '${e.id}'`;const i=await this.signalMarkerLayer.queryFeatures();if(i.features.length>0){this.signalPictureLayer.definitionExpression=`id = '${e.id}'`,this.signalClusterLayer.definitionExpression=`id = '${e.id}'`;const r=i.features[0],{districtId:l,subDistrictId:c}=r.attributes;return this.districtControllerDashLayer.definitionExpression=`id = '${l}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${l}'`,this.subDistrictControllerLayer.definitionExpression=`id = '${c}'`,await this.view.goTo({target:i.features,scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.signalMarkerLayer.definitionExpression=s,{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",this.signalClusterLayer.definitionExpression="1=1",this.signalPictureLayer.definitionExpression="1=1";const e=await this.districtControllerDashLayer.queryFeatures();return this.view.goTo(e.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}generateGraphic(e,t,s){const i=e.getAllSignalCoordinates();let r=null;if(i.length>=2)if(i.length===2)r=p.lineString(i);else{if(t){const n=p.featureCollection(i.map(a=>p.point(a)));r=k(n)}else{const n=S(i,.5);n.length>=4&&(r=p.polygon([n]))}r||(r=p.lineString(i))}else if(i.length===1)r=p.point(i[0]);else return;const l=F(r.geometry,t?200:30,{units:"meters"}),c=new g({geometry:{type:"polyline",paths:l.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,selected:s,type:t?"district":"subDistrict"}});t?this.districtGraphics.push(c):this.subDistrictGraphics.push(c);for(const n of e.subDistricts)this.generateGraphic(n,!1,s);e.signals.forEach(n=>{const a=new g({geometry:{type:"point",x:n.longitude,y:n.latitude},attributes:{ObjectID:this.signalOid++,id:n.id,name:n.name,signalId:n.signalId,nodeId:n.nodeId,isKey:n.isKey,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,type:"signal",selected:!0}});this.signalGraphics.push(a)})}async viewHitTest(e){var n;const s=(n=(await this.view.hitTest(e,{include:[this.districtControllerSolidLayer,this.subDistrictControllerLayer,this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer]})).results)==null?void 0:n.filter(a=>a.type==="graphic");if(s.length===0)return;const i=s[0].graphic;let r=null;i.geometry.type==="point"?r=i.geometry:i.geometry.type==="polyline"?r=i.geometry.extent.center:i.geometry.type==="polygon"&&(r=i.geometry.centroid),r!==null&&await this.view.goTo(r,{duration:1e3});const l=i.getAttribute("type"),c=i.getAttribute("id");switch(l){case"district":{let a=await this.districtControllerSolidLayer.queryFeatures();a.features.forEach(o=>{o.attributes.selected=o.attributes.id===c}),await this.districtControllerSolidLayer.applyEdits({updateFeatures:a.features}),a=await this.districtControllerDashLayer.queryFeatures(),a.features.forEach(o=>{o.attributes.selected=o.attributes.id===c}),await this.districtControllerDashLayer.applyEdits({updateFeatures:a.features});break}case"subDistrict":{let a=await this.subDistrictControllerLayer.queryFeatures();a.features.forEach(u=>{u.attributes.selected=u.attributes.id===c}),await this.subDistrictControllerLayer.applyEdits({updateFeatures:a.features}),a=await this.signalMarkerLayer.queryFeatures(),a.features.forEach(u=>{u.attributes.selected=u.attributes.subDistrictId===c});let o=await this.signalMarkerLayer.applyEdits({updateFeatures:a.features});console.log(o),a=await this.signalPictureLayer.queryFeatures(),a.features.forEach(u=>{u.attributes.selected=u.attributes.subDistrictId===c}),o=await this.signalPictureLayer.applyEdits({updateFeatures:a.features}),console.log(o);break}}x.when(()=>this.view.popup.visible===!1,async()=>{await this.resetSelectedSymbol(l)},{once:!0})}async resetSelectedSymbol(e){switch(e){case"district":{let t=await this.districtControllerSolidLayer.queryFeatures();t.features.forEach(s=>{s.attributes.selected=!0}),await this.districtControllerSolidLayer.applyEdits({updateFeatures:t.features}),t=await this.districtControllerDashLayer.queryFeatures(),t.features.forEach(s=>{s.attributes.selected=!0}),await this.districtControllerDashLayer.applyEdits({updateFeatures:t.features});break}case"subDistrict":{let t=await this.subDistrictControllerLayer.queryFeatures();t.features.forEach(s=>{s.attributes.selected=!0}),await this.subDistrictControllerLayer.applyEdits({updateFeatures:t.features}),t=await this.signalMarkerLayer.queryFeatures(),t.features.forEach(s=>{s.attributes.selected=!0}),await this.signalMarkerLayer.applyEdits({updateFeatures:t.features}),t=await this.signalPictureLayer.queryFeatures(),t.features.forEach(s=>{s.attributes.selected=!0}),await this.signalPictureLayer.applyEdits({updateFeatures:t.features});break}}}async loadDetachmentLayer(){const e=this.mapConfig.baseLayers;if(!e)return;const t=e.find(n=>n.options.id==="shanghai_district");if(!t)return;const i=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),r=[],{renderer:l,labelingInfo:c}=t.options;i.features.forEach(n=>{const a=n.attributes.ZD_NAME;if(a!=="高架支队"){let o=new E.Polygon({rings:n.geometry.rings});o=D.webMercatorToGeographic(o);const u=new g({geometry:o,attributes:n.attributes});if(l){if(l.type==="simple")u.symbol=l.symbol;else if(l.type==="unique-value"){const f=u.getAttribute("OBJECTID"),b=l.uniqueValueInfos.find(w=>w.value==f);u.symbol=b?b.symbol:l.defaultSymbol}}else u.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(r.push(u),c&&a!=="边防港航支队"&&a!=="机场支队"){const f=new g({geometry:o.centroid,symbol:{...c.symbol,text:a}});r.push(f)}}}),this.detachmentLayer.addMany(r),this.detachmentLayerLoaded=!0}}exports.default=M;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/geometry"),m=require("@arcgis/core/geometry/support/webMercatorUtils"),g=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/GraphicsLayer"),D=require("@turf/buffer"),R=require("@turf/convex"),S=require("@turf/helpers"),G=require("concaveman"),O=require("../../stores/index.js"),C=require("./district-controller.js"),I=require("./renderer/district-renderer.js"),v=require("./renderer/signal-renderer.js"),L=require("./renderer/sub-district-renderer.js");function q(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const l=q(S);class k{constructor(e){this.detachmentLayerLoaded=!1,this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,this.popupEnabled=!0,this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const t=O.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.detachmentLayer=new w,this.view.map.add(this.detachmentLayer),this.districtRenderer=new I.default(e,this.hasGpu),this.subDistrictRenderer=new L.default(e,this.hasGpu),this.signalRenderer=new v.default(e,this.hasGpu)}async showSignalControlArea(e){this.detachmentLayerLoaded||await this.loadDetachmentLayer(),await this.clearSignalControlArea(),this.districtRenderer.setVisible(!1),this.subDistrictRenderer.setVisible(!1),this.signalRenderer.setClusterVisible(!1),this.signalRenderer.setPointVisible(!1);const t=[],s=[];for(const r of e.areaList){const n=new C.default(r,e.style||"");t.push(n),s.push(...n.subDistricts)}return this.districtRenderer.style=e.style||"",await this.districtRenderer.showDistricts(t),await this.subDistrictRenderer.showSubDistricts(s),await this.signalRenderer.showSignals(t),{status:0,message:"ok"}}async clearSignalControlArea(){return this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,await this.districtRenderer.clearDistricts(),await this.subDistrictRenderer.clearSubDistricts(),await this.signalRenderer.clearSignals(),{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtRenderer.setVisible(e.visible);break;case"subDistrict":this.subDistrictRenderer.setVisible(e.visible);break;case"signal":this.signalRenderer.setPointVisible(e.visible);break;case"signalCluster":this.signalRenderer.setClusterVisible(e.visible);break;case"shanghai_district":this.detachmentLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":return await this.districtRenderer.locateDistrict(e.id);case"subDistrict":return await this.subDistrictRenderer.locateSubDistrict(e.id);case"signal":return await this.signalRenderer.locateSignal(e.id);default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){switch(this.view.closePopup(),e.type){case"district":return await this.districtRenderer.highlightDistrict(e.id)?(this.subDistrictRenderer.filter("district",e.id),this.signalRenderer.filter("district",e.id),{status:0,message:"ok"}):{status:1,message:"未找到区控"};case"subDistrict":{const{count:t,parentId:s}=await this.subDistrictRenderer.highlightSubDistrict(e.id);return t>0?(this.districtRenderer.filter(s),this.signalRenderer.filter("subDistrict",e.id),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}case"signal":{const{districtId:t,subDistrictId:s,count:r}=await this.signalRenderer.highlightSignal(e.id);return r>0?(this.districtRenderer.filter(t),this.subDistrictRenderer.filter("subDistrict",s),await this.view.goTo({target:this.signalGraphics,scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){return this.districtRenderer.resetFilter(),this.subDistrictRenderer.resetFilter(),this.signalRenderer.resetFilter(),{status:0,message:"ok"}}generateGraphic(e,t,s){const r=e.getAllSignalCoordinates();let n=null;if(r.length>=2)if(r.length===2)n=l.lineString(r);else{if(t){const i=l.featureCollection(r.map(c=>l.point(c)));n=R(i)}else{const i=G(r,.5);i.length>=4&&(n=l.polygon([i]))}n||(n=l.lineString(r))}else if(r.length===1)n=l.point(r[0]);else return;const a=D(n.geometry,t?200:30,{units:"meters"}),u=new g({geometry:{type:"polyline",paths:a.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,selected:s,type:t?"district":"subDistrict"}});t?this.districtGraphics.push(u):this.subDistrictGraphics.push(u);for(const i of e.subDistricts)this.generateGraphic(i,!1,s);e.signals.forEach(i=>{const c=new g({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,type:"signal",selected:!0}});this.signalGraphics.push(c)})}async loadDetachmentLayer(){const e=this.mapConfig.baseLayers;if(!e)return;const t=e.find(s=>s.options.id==="shanghai_district");if(t)try{const r=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),n=[],{renderer:a,labelingInfo:u}=t.options;r.features.forEach(i=>{const c=i.attributes.ZD_NAME;if(c!=="高架支队"){let d=new y.Polygon({rings:i.geometry.rings});d=m.webMercatorToGeographic(d);const h=new g({geometry:d,attributes:i.attributes});if(a){if(a.type==="simple")h.symbol=a.symbol;else if(a.type==="unique-value"){const b=h.getAttribute("OBJECTID"),f=a.uniqueValueInfos.find(p=>p.value==b);h.symbol=f?f.symbol:a.defaultSymbol}}else h.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(n.push(h),u&&c!=="边防港航支队"&&c!=="机场支队"){const b=new g({geometry:d.centroid,symbol:{...u.symbol,text:c}});n.push(b)}}}),this.detachmentLayer.addMany(n),this.detachmentLayerLoaded=!0}catch(s){console.error("加载支队图层失败:",s);return}}}exports.default=k;
|