gisviewer-vue3-arcgis 1.0.181 → 1.0.183

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.
Files changed (25) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +4 -1
  2. package/es/src/gis-map/index.d.ts +4 -1
  3. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +0 -2
  4. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +8 -24
  5. package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +162 -156
  6. package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +4 -4
  7. package/es/src/gis-map/utils/map-initializer.mjs +101 -99
  8. package/es/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +1 -1
  9. package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +12 -12
  10. package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +9 -1
  11. package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +10 -2
  12. package/es/src/types/index.d.ts +1 -1
  13. package/lib/src/gis-map/gis-map.vue.d.ts +4 -1
  14. package/lib/src/gis-map/index.d.ts +4 -1
  15. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +0 -2
  16. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
  17. package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -1
  18. package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -1
  19. package/lib/src/gis-map/utils/map-initializer.js +1 -1
  20. package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +1 -1
  21. package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -1
  22. package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +9 -1
  23. package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
  24. package/lib/src/types/index.d.ts +1 -1
  25. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer"),g=require("vue"),m=require("../../stores/index.js");class y{constructor(i){this.appDataStore=m.default.useAppDataStore,this.logTable=[["uuid","ptcId","plateno","timestamp","localTimestamp","timestamp_str","speed","laneNo","objHeight","objLength","latitude","longitude","ptcType","vehicleType","vehicleColor","plateColor","sbdm","heading","fixAngle","roadLayer","status","step","receiveTimestamp"]],this.needInterpolate=!0,this.isPaused=!1,this.showVehiclePlate=!1,this.showGroundVehicle=!0,this.showElevatedVehicle=!0,this.historyPositionMap=new Map,this.vehicleObjectMap=new Map,this.view=i,this.mapConfig=g.toRaw(this.appDataStore.mapConfig),this.vehicleLayer=new p({id:"vehicleLayer"}),this.view.map.add(this.vehicleLayer),this.rafSignal=requestAnimationFrame(()=>this.render())}getLog(){return this.logTable}async init(){}addVehicles(i){return new Promise(t=>{if(this.isPaused){t();return}const e=i.map(s=>{const{vehicleId:o,heading:a,localTimestamp:h}=s,l=Number(s.x),n=Number(s.y);this.historyPositionMap.set(o,[{pos:[l,n,0],heading:a,time:h}]);const r=new c({geometry:{type:"point",x:l,y:n},attributes:{...s,type:"trackVehicle"},symbol:this.createCIMSymbol(s)});return r.visible=!1,this.vehicleObjectMap.set(o,{graphic:r,data:s,waitForDelete:!1,isMoving:!1}),r});this.vehicleLayer.addMany(e),t()})}updateVehicles(i){return new Promise(t=>{if(this.isPaused){t();return}const e=[];i.forEach(s=>{const{vehicleId:o,heading:a,localTimestamp:h}=s,l=Number(s.x),n=Number(s.y),r=this.vehicleObjectMap.get(o);r?(r.data=s,r.graphic.attributes={...s,type:"trackVehicle"},this.historyPositionMap.get(o).push({pos:[l,n,0],heading:a,time:h})):e.push(s)}),this.addVehicles(e),t()})}deleteVehicles(i){this.isPaused||i.forEach(t=>{const e=this.vehicleObjectMap.get(t);e&&(e.waitForDelete=!0)})}clearVehicles(){this.vehicleLayer.removeAll(),this.vehicleObjectMap.clear(),this.historyPositionMap.clear()}toggleGroundVehicle(i){this.showGroundVehicle=i}toggleElevatedVehicle(i){this.showElevatedVehicle=i}toggleTrafficInfo(i){i.name==="vehiclePlate"&&(this.showVehiclePlate=i.visible)}togglePause(i){this.isPaused=i,this.isPaused?cancelAnimationFrame(this.rafSignal):this.rafSignal=requestAnimationFrame(()=>this.render())}updatePanelContent(i){console.log(i)}setInterpolate(i){this.needInterpolate=i}render(){this.isPaused||this.vehicleObjectMap.forEach((i,t)=>{this.updatePosition(t)}),this.rafSignal=requestAnimationFrame(()=>this.render())}updatePosition(i){const t=this.historyPositionMap.get(i),e=this.vehicleObjectMap.get(i);if(!t||!e||!e.isMoving&&t.length<=2)return;e.isMoving=!0,(e.graphic.getAttribute("roadLayer")||"1")==="1"?e.graphic.visible=this.showGroundVehicle:e.graphic.visible=this.showElevatedVehicle,e.segmentStartTime||(e.segmentStartTime=Date.now(),e.segmentTotalTime=t[1].time-t[0].time);const o=Date.now()-e.segmentStartTime,a=Math.min(1,o/e.segmentTotalTime);if(a===1)if(t.shift(),t.length===1){e.waitForDelete?(this.vehicleLayer.remove(e.graphic),this.vehicleObjectMap.delete(i),this.historyPositionMap.delete(i)):(e.segmentStartTime=void 0,e.segmentTotalTime=void 0,e.graphic.visible=!1,e.isMoving=!1);return}else e.segmentStartTime=Date.now(),e.segmentTotalTime=t[1].time-t[0].time,(t[1].heading>=270&&t[0].heading<=90||t[1].heading<=90&&t[0].heading>=270)&&(t[1].heading>t[0].heading?t[0].heading+=360:t[1].heading+=360),e.graphic.geometry={type:"point",x:t[0].pos[0],y:t[0].pos[1]};else{const h=t[0].pos[0]+(t[1].pos[0]-t[0].pos[0])*a,l=t[0].pos[1]+(t[1].pos[1]-t[0].pos[1])*a,n=t[0].heading+(t[1].heading-t[0].heading)*a;e.graphic.geometry={type:"point",x:h,y:l},e.data.heading=n,e.graphic.symbol=this.createCIMSymbol(e.data)}}createCIMSymbol(i){const t=this.getPlateFontColor(i.plateColor),e=this.getCarPic(i.vehicleColor,i.speed);return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.showName",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:this.showVehiclePlate,size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-8,ymin:-8,xmax:8,ymax:8},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:4,horizontalAlignment:"Center",offsetX:0,offsetY:8,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t.backgroundColor}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t.fillColor}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:e.size,rotation:i.heading,rotateClockwise:!0,textureFilter:"Picture",url:`${this.mapConfig.assetsRoot}Images/${e.pic}`}]}}}}getCarPic(i,t){if(this.view.scale>=1e3){let e="point_green.png";return t&&(t<=4.2?e="point_red.png":t<=8.4?e="point_yellow.png":e="point_green.png"),{pic:e,size:15}}else{let e="grey";switch(typeof i=="string"&&(i=i.toLowerCase()),i){case"a":case 1:e="white";break;case"b":case 2:e="grey";break;case"c":case 3:e="yellow";break;case"d":case 4:e="pink";break;case"e":case 5:e="red";break;case"f":case 10:e="purple";break;case"g":case 6:e="green";break;case"h":case 7:e="blue";break;case"i":case 8:e="brown";break;case"j":case 9:e="black";break}return{pic:"/car/"+e+".png",size:30}}}getPlateFontColor(i){let t=[255,255,255,255],e=[169,169,169,255];switch(i){case 0:t=[0,0,0,255],e=[255,255,255,255];break;case 1:t=[0,0,0,255],e=[244,164,96,255];break;case 2:t=[255,255,255,255],e=[65,105,225,255];break;case 3:t=[255,255,255,255],e=[0,0,0,255];break;case 15:t=[244,164,96,255],e=[0,250,154,255];break;case 16:t=[0,0,0,255],e=[0,250,154,255];break}return{fillColor:t,backgroundColor:e}}}exports.default=y;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer"),g=require("vue"),m=require("../../stores/index.js");class y{constructor(i){this.appDataStore=m.default.useAppDataStore,this.logTable=[["uuid","ptcId","plateno","timestamp","localTimestamp","timestamp_str","speed","laneNo","objHeight","objLength","latitude","longitude","ptcType","vehicleType","vehicleColor","plateColor","sbdm","heading","fixAngle","roadLayer","status","step","receiveTimestamp"]],this.needInterpolate=!0,this.isPaused=!1,this.showVehiclePlate=!1,this.showGroundVehicle=!0,this.showElevatedVehicle=!0,this.historyPositionMap=new Map,this.vehicleObjectMap=new Map,this.view=i,this.mapConfig=g.toRaw(this.appDataStore.mapConfig),this.vehicleLayer=new p({id:"vehicleLayer"}),this.view.map.add(this.vehicleLayer),this.rafSignal=requestAnimationFrame(()=>this.render())}getLog(){return this.logTable}async init(){}addVehicles(i){return new Promise(t=>{if(this.isPaused){t();return}const e=i.map(s=>{const{vehicleId:o,heading:a,localTimestamp:c}=s,l=Number(s.x),n=Number(s.y);this.historyPositionMap.set(o,[{pos:[l,n,0],heading:a,time:c}]);const r=new h({geometry:{type:"point",x:l,y:n},attributes:{...s,type:"trackVehicle"},symbol:this.createCIMSymbol(s)});return r.visible=!1,this.vehicleObjectMap.set(o,{graphic:r,data:s,waitForDelete:!1,isMoving:!1}),r});this.vehicleLayer.addMany(e),t()})}updateVehicles(i){return new Promise(t=>{if(this.isPaused){t();return}const e=[];i.forEach(s=>{const{vehicleId:o,heading:a,localTimestamp:c}=s,l=Number(s.x),n=Number(s.y),r=this.vehicleObjectMap.get(o);r?(r.data=s,r.graphic.attributes={...s,type:"trackVehicle"},this.historyPositionMap.get(o).push({pos:[l,n,0],heading:a,time:c})):e.push(s)}),this.addVehicles(e),t()})}deleteVehicles(i){this.isPaused||i.forEach(t=>{const e=this.vehicleObjectMap.get(t);e&&(e.waitForDelete=!0)})}clearVehicles(){this.vehicleLayer.removeAll(),this.vehicleObjectMap.clear(),this.historyPositionMap.clear()}toggleGroundVehicle(i){this.showGroundVehicle=i}toggleElevatedVehicle(i){this.showElevatedVehicle=i}toggleTrafficInfo(i){i.name==="vehiclePlate"&&(this.showVehiclePlate=i.visible)}togglePause(i){this.isPaused=i,this.isPaused?cancelAnimationFrame(this.rafSignal):this.rafSignal=requestAnimationFrame(()=>this.render())}updatePanelContent(i){console.log(i)}setInterpolate(i){this.needInterpolate=i}render(){this.isPaused||this.vehicleObjectMap.forEach((i,t)=>{this.updatePosition(t)}),this.rafSignal=requestAnimationFrame(()=>this.render())}updatePosition(i){const t=this.historyPositionMap.get(i),e=this.vehicleObjectMap.get(i);if(!t||!e||!e.isMoving&&t.length<=2)return;e.isMoving=!0,(e.graphic.getAttribute("roadLayer")||"1")==="1"?e.graphic.visible=this.showGroundVehicle:e.graphic.visible=this.showElevatedVehicle,e.segmentStartTime||(e.segmentStartTime=Date.now(),e.segmentTotalTime=t[1].time-t[0].time);const o=Date.now()-e.segmentStartTime,a=Math.min(1,o/e.segmentTotalTime);if(a===1)if(t.shift(),t.length===1){e.waitForDelete?(this.vehicleLayer.remove(e.graphic),this.vehicleObjectMap.delete(i),this.historyPositionMap.delete(i)):(e.segmentStartTime=void 0,e.segmentTotalTime=void 0,e.graphic.visible=!1,e.isMoving=!1);return}else e.segmentStartTime=Date.now(),e.segmentTotalTime=t[1].time-t[0].time,Math.abs(t[1].heading-t[0].heading)>180&&(t[1].heading>t[0].heading?t[0].heading+=360:t[1].heading+=360),e.graphic.geometry={type:"point",x:t[0].pos[0],y:t[0].pos[1]};else{const c=t[0].pos[0]+(t[1].pos[0]-t[0].pos[0])*a,l=t[0].pos[1]+(t[1].pos[1]-t[0].pos[1])*a,n=t[0].heading+(t[1].heading-t[0].heading)*a;e.graphic.geometry={type:"point",x:c,y:l},e.data.heading=n,e.graphic.symbol=this.createCIMSymbol(e.data)}}createCIMSymbol(i){const t=this.getPlateFontColor(i.plateColor),e=this.getCarPic(i.vehicleColor,i.speed);return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.showName",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:this.showVehiclePlate,size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-8,ymin:-8,xmax:8,ymax:8},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:4,horizontalAlignment:"Center",offsetX:0,offsetY:8,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t.backgroundColor}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t.fillColor}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:e.size,rotation:i.heading,rotateClockwise:!0,textureFilter:"Picture",url:`${this.mapConfig.assetsRoot}Images/${e.pic}`}]}}}}getCarPic(i,t){if(this.view.scale>=1e3){let e="point_green.png";return t&&(t<=4.2?e="point_red.png":t<=8.4?e="point_yellow.png":e="point_green.png"),{pic:e,size:15}}else{let e="grey";switch(typeof i=="string"&&(i=i.toLowerCase()),i){case"a":case 1:e="white";break;case"b":case 2:e="grey";break;case"c":case 3:e="yellow";break;case"d":case 4:e="pink";break;case"e":case 5:e="red";break;case"f":case 10:e="purple";break;case"g":case 6:e="green";break;case"h":case 7:e="blue";break;case"i":case 8:e="brown";break;case"j":case 9:e="black";break}return{pic:"/car/"+e+".png",size:20}}}getPlateFontColor(i){let t=[255,255,255,255],e=[169,169,169,255];switch(i){case 0:t=[0,0,0,255],e=[255,255,255,255];break;case 1:t=[0,0,0,255],e=[244,164,96,255];break;case 2:t=[255,255,255,255],e=[65,105,225,255];break;case 3:t=[255,255,255,255],e=[0,0,0,255];break;case 15:t=[244,164,96,255],e=[0,250,154,255];break;case 16:t=[0,0,0,255],e=[0,250,154,255];break}return{fillColor:t,backgroundColor:e}}}exports.default=y;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("@arcgis/core/Basemap"),d=require("@arcgis/core/config"),z=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/MapImageLayer"),x=require("@arcgis/core/layers/TileLayer"),I=require("@arcgis/core/layers/WebTileLayer"),S=require("@arcgis/core/Map"),R=require("@arcgis/core/views/MapView"),H=require("@arcgis/core/views/SceneView"),_=require("@turf/destination"),G=require("@turf/helpers"),j=require("./custom-layer/custom-wmts-layer.js");function b(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const T=b(z),m=b(L),B=b(G);function q(r,e){return r&&(r.startsWith("http://")||r.startsWith("https://")?r:e+r)}class N{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){var u,y,v,M;this.mapConfig=e.mapConfig;const{container:t,markerClickCallback:s,mapClickCallback:o}=e;d.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,d.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,d.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const n=new S;if(((u=this.mapConfig)==null?void 0:u.mapOptions.mode.toLowerCase())==="2d"?this.view=new R({map:n,container:t,...this.mapConfig.mapOptions}):this.view=new H({map:n,container:t,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(y=this.mapConfig)==null?void 0:y.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!1},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async i=>{var C,P;if(o){let a=i.mapPoint;a.spatialReference.isWebMercator&&(a=m.webMercatorToGeographic(a)),o([a.x,a.y],[i.screenPoint.x,i.screenPoint.y],i)}if(this.view.type==="3d"){const a=this.view.camera;if(this.view.spatialReference.isWebMercator){const p=m.webMercatorToGeographic(a.position),f={heading:a.heading,tilt:a.tilt,position:p.toJSON()};console.log(f),(C=navigator.clipboard)==null||C.writeText(JSON.stringify(f))}else console.log(a.toJSON());console.log(this.view.zoom,this.view.scale)}else{let a=this.view.center;this.view.spatialReference.isWebMercator&&(a=m.webMercatorToGeographic(a)),console.log({center:a.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(P=(await this.view.hitTest(i)).results)==null?void 0:P.filter(a=>a.type==="graphic");c.length>0&&c.forEach(a=>{var f;const p=a.graphic;(f=p.attributes)!=null&&f.type&&s&&s(p.attributes.type,p.attributes.id,p.attributes,i)})}),(v=this.mapConfig)!=null&&v.baseLayers?this.mapConfig.baseLayers.forEach(i=>{const l=q(i.url,this.mapConfig.assetsRoot);switch(i.type.toLowerCase()){case"webTile".toLowerCase():{const c=new I({urlTemplate:l,...i.options});n.add(c);break}case"tile":{const c=new x({url:l,...i.options});n.add(c);break}case"customWMTS".toLowerCase():{const c=new j.default({urlTemplate:l,...i.options});n.add(c);break}case"mapImage".toLowerCase():{const c=new O({url:l,...i.options});n.add(c);break}case"arcgis":{const c=new k(i.options);n.basemap=c;break}}}):n.basemap=new k({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(M=this.mapConfig)!=null&&M.hdLayers){const i=this.mapConfig.hdLayers.map(l=>new W({url:q(l.url,this.mapConfig.assetsRoot),...l.options,title:l.options.id}));n.addMany(i)}this.view.ui.remove("attribution"),await this.view.when();const w=this.mapConfig.camera;let h;if(this.view.type==="2d"){let i=this.view.center;this.view.spatialReference.isWebMercator&&(i=m.webMercatorToGeographic(i)),h={center:[i.x,i.y],zoom:this.view.zoom}}else{let i=this.view.camera.position;this.view.spatialReference.isWebMercator&&(i=m.webMercatorToGeographic(i)),h={position:i,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return w?w.home=h:this.mapConfig.camera={home:h},this.view}setLayerVisibility(e){const{id:t,visible:s}=e,o=this.view.map.findLayerById(t);return o?(o.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var t;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((t=e.target)==null?void 0:t.type){case"point":e.target=new g.Point(e.target);break;case"polyline":e.target=new g.Polyline(e.target);break;case"polygon":e.target=new g.Polygon(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}async lookAt(e){if(this.view.type==="2d")return;const t=e.tilt||0,s=e.heading||0;if(t===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:s,tilt:0},{duration:(e.duration||2)*1e3});else{const o=Math.tan(t*Math.PI/180)*e.height,n=_(B.point(e.center),o,s+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:e.height},heading:s,tilt:t},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:t,duration:s=0}=e,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const n=o[t];return n?(await this.view.goTo(n,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,t){let s=0;const n=1e3/30,w=T.watch(()=>this.view.center,()=>{const h=this.transformPoints(e),u=Date.now();u-s>n&&(t(h),s=u)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,w),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(t=>{const s=new g.Point({x:t[0],y:t[1]}),o=this.view.toScreen(s);return[o.x,o.y]})}cancelCoordinateTransform(e){const t=this.watchHandleMap.get(e);t&&(t.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:t,max:s}=e;!t&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=T.watch(()=>this.view.zoom,o=>{t&&o<=t&&(this.view.zoom=t),s&&o>=s&&(this.view.zoom=s)}))}}exports.default=N;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("@arcgis/core/Basemap"),d=require("@arcgis/core/config"),z=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/MapImageLayer"),x=require("@arcgis/core/layers/TileLayer"),I=require("@arcgis/core/layers/WebTileLayer"),S=require("@arcgis/core/Map"),R=require("@arcgis/core/views/MapView"),H=require("@arcgis/core/views/SceneView"),_=require("@turf/destination"),G=require("@turf/helpers"),j=require("./custom-layer/custom-wmts-layer.js");function b(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const T=b(z),m=b(L),B=b(G);function q(r,e){return r&&(r.startsWith("http://")||r.startsWith("https://")?r:e+r)}class N{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){var u,y,v,M;this.mapConfig=e.mapConfig;const{container:t,markerClickCallback:s,mapClickCallback:o}=e;d.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,d.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,d.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const n=new S;if(((u=this.mapConfig)==null?void 0:u.mapOptions.mode.toLowerCase())==="2d"?(this.view=new R({map:n,container:t,...this.mapConfig.mapOptions}),this.view.on("drag",i=>{i.button===2&&i.stopPropagation()})):this.view=new H({map:n,container:t,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(y=this.mapConfig)==null?void 0:y.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!1},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async i=>{var C,P;if(o){let a=i.mapPoint;a.spatialReference.isWebMercator&&(a=m.webMercatorToGeographic(a)),o([a.x,a.y],[i.screenPoint.x,i.screenPoint.y],i)}if(this.view.type==="3d"){const a=this.view.camera;if(this.view.spatialReference.isWebMercator){const p=m.webMercatorToGeographic(a.position),f={heading:a.heading,tilt:a.tilt,position:p.toJSON()};console.log(f),(C=navigator.clipboard)==null||C.writeText(JSON.stringify(f))}else console.log(a.toJSON());console.log(this.view.zoom,this.view.scale)}else{let a=this.view.center;this.view.spatialReference.isWebMercator&&(a=m.webMercatorToGeographic(a)),console.log({center:a.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(P=(await this.view.hitTest(i)).results)==null?void 0:P.filter(a=>a.type==="graphic");c.length>0&&c.forEach(a=>{var f;const p=a.graphic;(f=p.attributes)!=null&&f.type&&s&&s(p.attributes.type,p.attributes.id,p.attributes,i)})}),(v=this.mapConfig)!=null&&v.baseLayers?this.mapConfig.baseLayers.forEach(i=>{const l=q(i.url,this.mapConfig.assetsRoot);switch(i.type.toLowerCase()){case"webTile".toLowerCase():{const c=new I({urlTemplate:l,...i.options});n.add(c);break}case"tile":{const c=new x({url:l,...i.options});n.add(c);break}case"customWMTS".toLowerCase():{const c=new j.default({urlTemplate:l,...i.options});n.add(c);break}case"mapImage".toLowerCase():{const c=new O({url:l,...i.options});n.add(c);break}case"arcgis":{const c=new k(i.options);n.basemap=c;break}}}):n.basemap=new k({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(M=this.mapConfig)!=null&&M.hdLayers){const i=this.mapConfig.hdLayers.map(l=>new W({url:q(l.url,this.mapConfig.assetsRoot),...l.options,title:l.options.id}));n.addMany(i)}this.view.ui.remove("attribution"),await this.view.when();const w=this.mapConfig.camera;let h;if(this.view.type==="2d"){let i=this.view.center;this.view.spatialReference.isWebMercator&&(i=m.webMercatorToGeographic(i)),h={center:[i.x,i.y],zoom:this.view.zoom}}else{let i=this.view.camera.position;this.view.spatialReference.isWebMercator&&(i=m.webMercatorToGeographic(i)),h={position:i,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return w?w.home=h:this.mapConfig.camera={home:h},this.view}setLayerVisibility(e){const{id:t,visible:s}=e,o=this.view.map.findLayerById(t);return o?(o.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var t;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((t=e.target)==null?void 0:t.type){case"point":e.target=new g.Point(e.target);break;case"polyline":e.target=new g.Polyline(e.target);break;case"polygon":e.target=new g.Polygon(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}async lookAt(e){if(this.view.type==="2d")return;const t=e.tilt||0,s=e.heading||0;if(t===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:s,tilt:0},{duration:(e.duration||2)*1e3});else{const o=Math.tan(t*Math.PI/180)*e.height,n=_(B.point(e.center),o,s+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:e.height},heading:s,tilt:t},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:t,duration:s=0}=e,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const n=o[t];return n?(await this.view.goTo(n,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,t){let s=0;const n=1e3/30,w=T.watch(()=>this.view.center,()=>{const h=this.transformPoints(e),u=Date.now();u-s>n&&(t(h),s=u)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,w),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(t=>{const s=new g.Point({x:t[0],y:t[1]}),o=this.view.toScreen(s);return[o.x,o.y]})}cancelCoordinateTransform(e){const t=this.watchHandleMap.get(e);t&&(t.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:t,max:s}=e;!t&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=T.watch(()=>this.view.zoom,o=>{t&&o<=t&&(this.view.zoom=t),s&&o>=s&&(this.view.zoom=s)}))}}exports.default=N;
@@ -17,7 +17,7 @@ export default class DistrictController {
17
17
  areaColor: number[];
18
18
  crossCount: number;
19
19
  subDistrictCount: number;
20
- constructor(params: any);
20
+ constructor(params: any, style: string);
21
21
  getAllCrossCoordinates(): number[][];
22
22
  }
23
23
  export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../common-utils.js");class e{constructor(t){this.parentName="",this.crosses=[],this.subDistricts=[],this.areaColor=[61,139,249],this.crossCount=0,this.subDistrictCount=0,this.id=t.id,this.name=t.name,this.parentId=t.parentId;for(const s of t.children)if(s.children){const i=new e(s);i.parentName=this.name,i.areaColor=[61,139,249],this.subDistricts.push(i),this.subDistrictCount++,this.crossCount+=i.crossCount}else if(o.default.isCoordinateValid(s)){const i={id:s.id,name:s.name,parentId:s.parentId,latitude:Number(s.latitude),longitude:Number(s.longitude),signalId:s.signalId,isKey:s.isKey===1};this.crosses.push(i),this.crossCount++}}getAllCrossCoordinates(){const t=[];for(const s of this.crosses)t.push([s.longitude,s.latitude]);for(const s of this.subDistricts)t.push(...s.getAllCrossCoordinates());return t}}exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("../common-utils.js");class o{constructor(t,i){this.parentName="",this.crosses=[],this.subDistricts=[],this.crossCount=0,this.subDistrictCount=0,this.id=t.id,this.name=t.name,this.parentId=t.parentId,this.areaColor=i==="alarm"?[255,0,0]:[61,139,249];for(const s of t.children)if(s.children){const e=new o(s,i);e.parentName=this.name,this.subDistricts.push(e),this.subDistrictCount++,this.crossCount+=e.crossCount}else if(r.default.isCoordinateValid(s)){const e={id:s.id,name:s.name,parentId:s.parentId,latitude:Number(s.latitude),longitude:Number(s.longitude),signalId:s.signalId,isKey:s.isKey===1};this.crosses.push(e),this.crossCount++}}getAllCrossCoordinates(){const t=[];for(const i of this.crosses)t.push([i.longitude,i.latitude]);for(const i of this.subDistricts)t.push(...i.getAllCrossCoordinates());return t}}exports.default=o;
@@ -10,7 +10,15 @@ export default class SignalControlAreaController {
10
10
  private readonly crossScale;
11
11
  private openDriveServer;
12
12
  constructor(view: __esri.MapView | __esri.SceneView);
13
- showSignalControlArea(params: any): IResult;
13
+ /**
14
+ * 显示信控区控与子区
15
+ * @param params
16
+ * @returns
17
+ */
18
+ showSignalControlArea(params: {
19
+ areaList: any[];
20
+ style?: string;
21
+ }): IResult;
14
22
  clearSignalControlArea(): IResult;
15
23
  locateSignalControlArea(params: {
16
24
  id: string;
@@ -1 +1 @@
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;
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 e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const L=m(b),c=m(C);class w{constructor(e){var s;this.crossScale=5e3,this.view=e;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(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.areaList){const r=new I.default(t,e.style||"");this.drawArea(r,!0)}return this.scaleWatcher=L.watch(()=>this.view.scale,(t,r)=>{t>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"))})):t<=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 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(i=>i.getAttribute("id")===e.id).toArray().map(i=>{const a=i.clone();return a.symbol.style="none",a}),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("parentId")===e.id).toArray().map(i=>i.clone()),s=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("districtId")===e.id||i.getAttribute("subDistrictId")===e.id).toArray().map(i=>i.clone());if(t.length>0&&this.highlightLayer.addMany(t),r.length>0&&this.highlightLayer.addMany(r),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(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(e){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const r=e.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(e){var i;const r=(i=(await this.view.hitTest(e,{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(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 r=t.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:t.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalArea(e,t){if(this.openDriveServer){this.addCrossCallback=e,this.removeCrossCallback=t,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(e){return this.crossLayer.graphics.forEach(t=>{if(t.getAttribute("id")===e&&!t.getAttribute("selected"))return t.setAttribute("selected",!0),t.symbol=this.getCrossSymbolInSubDistrict(t.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}unselectSubSignalControlAreaCross(e){return this.crossLayer.graphics.forEach(t=>{if(t.getAttribute("id")===e&&t.getAttribute("selected"))return t.setAttribute("selected",!1),t.symbol=this.getCrossSymbolInSubDistrict(t.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e)),t}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>=2){let i=null;if(r.length===2)i=c.lineString(r);else{if(t){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,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 u({geometry:{type:"polygon",rings:a.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.3],outline:{color:e.areaColor,width:3,style:t?"long-dash":"solid"}},attributes:n,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(g):this.subDistrictControllerLayer.add(g)}for(const i of e.subDistricts)this.drawArea(i,!1);const s=[];e.crosses.forEach(i=>{const a={type:"cross",id:i.id,name:i.name,color:e.areaColor,signalId:i.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.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(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:r,color:s}=e;if(t==="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(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: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;
@@ -5,7 +5,7 @@
5
5
  * 45° ~ 135°:东象限。
6
6
  * 135° ~ 225°:南象限。
7
7
  */
8
- import Three from 'three';
8
+ import * as Three from 'three';
9
9
  export declare enum QuadrantCode {
10
10
  West = "1",
11
11
  North = "2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.181",
3
+ "version": "1.0.183",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [