gisviewer-vue3-arcgis 1.0.265 → 1.0.267

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 (26) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +10 -3
  2. package/es/src/gis-map/gis-map.vue.mjs +177 -174
  3. package/es/src/gis-map/index.d.ts +8 -2
  4. package/es/src/gis-map/utils/map-initializer.mjs +86 -79
  5. package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +6 -1
  6. package/es/src/gis-map/utils/open-drive-renderer/index.mjs +15 -12
  7. package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +101 -45
  8. package/es/src/gis-map/utils/signal-control-area/{show-area.d.ts → signal-area-controller.d.ts} +3 -0
  9. package/es/src/gis-map/utils/signal-control-area/{show-area.mjs → signal-area-controller.mjs} +11 -11
  10. package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.d.ts +24 -0
  11. package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.mjs +193 -0
  12. package/es/src/types/index.d.ts +15 -0
  13. package/lib/src/gis-map/gis-map.vue.d.ts +10 -3
  14. package/lib/src/gis-map/gis-map.vue.js +1 -1
  15. package/lib/src/gis-map/index.d.ts +8 -2
  16. package/lib/src/gis-map/utils/map-initializer.js +1 -1
  17. package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +6 -1
  18. package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
  19. package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -1
  20. package/lib/src/gis-map/utils/signal-control-area/{show-area.d.ts → signal-area-controller.d.ts} +3 -0
  21. package/lib/src/gis-map/utils/signal-control-area/signal-area-controller.js +1 -0
  22. package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.d.ts +24 -0
  23. package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.js +1 -0
  24. package/lib/src/types/index.d.ts +15 -0
  25. package/package.json +1 -1
  26. package/lib/src/gis-map/utils/signal-control-area/show-area.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),T=require("./stores/index.js");require("./style/index.css");const dt=require("./utils/dbscan-cluster/index.js"),mt=require("./utils/detect-gpu.js"),pt=require("./utils/edpass-device-controller.js"),x=require("./utils/green-wave-band-controller/index.js"),gt=require("./utils/holo-flow/index.js"),ft=require("./utils/holo-flow/signal-countdown-panel.vue.js"),yt=require("./utils/map-initializer.js"),P=require("./utils/open-drive-renderer/index.js"),z=require("./utils/overlay.js"),wt=require("./utils/police-jurisdiction.js"),vt=require("./utils/queue-length.js"),E=require("./utils/road-config-tool/index.js"),St=require("./utils/signal-control-area/edit-area.js"),q=require("./utils/signal-control-area/show-area.js"),ht=require("./utils/traffic-flow.js"),Ct={class:"gis-viewer"},bt={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},Ot=r.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(N,{expose:H,emit:G}){const C=r.ref(null);let a,p,l,i,s,o,f,t,u,n,g,w,b,y;const O=r.ref(!1);T.registerStore();const V=T.default.useAppDataStore,_=r.reactive([]),B=e=>Math.log2(591657527591555e-6/e);let v=null,I=null;const A=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==I&&(I=d,S("update:zoom",d))};mt.default(),r.onMounted(async()=>{if(!C.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(O.value=!O.value)});const e=r.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(M.config)).json();c.assetsRoot=M.assetsRoot||d,V.mapConfig=c,p=new yt.default,V.mapInitializer=p,a=await p.initialize({container:C.value,mapConfig:c,markerClickCallback:(m,D,L,ut)=>{S("markerClick",m,D,L,ut)},mapClickCallback:(m,D,L)=>{S("mapClick",m,D,L)}});const h=a.zoom??(a.scale?B(a.scale):void 0);typeof h=="number"&&A(h);const lt=a.zoom!==void 0?a.watch("zoom",m=>{A(m)}):a.watch("scale",m=>{typeof m=="number"&&m>0&&A(B(m))});v=()=>lt.remove(),s=new gt.default(a,_),await s.init(),S("mapLoaded")}),r.onUnmounted(()=>{n==null||n.clearSignalControlArea(),t==null||t.clearOpenDrive(),s.clearHoloTrace(),s.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),v==null||v(),v=null});const Z=r.computed(()=>a),W=()=>{const e=T.default.useAppDataStore;e.saveTrackLog=!0},j=()=>{s.downloadTrackLog()},J=()=>{k("vehicleId")},Q=()=>{k("plateNumber")},U=async e=>await p.setMapCenter(e),K=async e=>await p.setMapCamera(e),F=e=>p.setMapZoom(e),X=async e=>await p.lookAt(e),Y=e=>p.setLayerVisibility(e),R=(e,d)=>p.requestCoordinateTransform(e,d),$=e=>{p.cancelCoordinateTransform(e)},ee=e=>{p.setMapZoomRange(e)},te=e=>(l||(l=new E.default(a)),l.showLaneNumber(e)),ae=()=>{l==null||l.clearLaneNumber()},ne=async e=>(l||(l=new E.default(a)),await l.initializeSearch(e)),se=async()=>l==null?void 0:l.calCrossIndicatorArea(),re=async()=>{},oe=async(e,d)=>{i||(i=new ht.default(a)),i.connectTrafficFlow(e,d)},ie=()=>{i==null||i.disconnectTrafficFlow()},ce=async e=>{s.handleVehicleTraceData(e)},le=()=>{s.clearHoloTrace()},ue=e=>{s.setInterpolate(e)},de=async e=>{await s.handleSignalData(e)},me=async e=>{await s.initializeLampGroup(e)},pe=e=>{s.handleUniSignalData(e)},ge=()=>{s.clearHoloSignal()},fe=e=>{i==null||i.toggleTrafficInfo(e),s==null||s.toggleTrafficInfo(e)},ye=e=>{s==null||s.togglePause(e)},we=e=>{i==null||i.toggleTrafficObject(e),s==null||s.toggleTrafficObject(e)},k=e=>{s==null||s.updatePanelContent(e)},ve=async e=>(o||(o=new z.default(a)),o.addOverlays(e)),Se=async e=>(y||(y=new dt.default(a)),y.addClusterPoints(e)),he=()=>{y==null||y.removeAllClusterPoints()},Ce=e=>(o||(o=new z.default(a)),o.addMask(e)),be=()=>{o==null||o.removeMask()},Oe=e=>o==null?void 0:o.removeOverlaysByType(e),Ae=e=>o==null?void 0:o.removeOverlaysById(e),ke=()=>o==null?void 0:o.removeAllOverlays(),De=()=>{o==null||o.showAllOverlays()},Le=e=>{f||(f=new vt.default(a)),f.updateQueueLength(e)},Te=()=>{f==null||f.removeQueueLength()},qe=async(e,d)=>(t||(t=new P.default(a)),await t.showOpenDriveFromServer(e,d)),Ve=async e=>(t||(t=new P.default(a)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),_e=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},Be=async()=>await(t==null?void 0:t.clearOpenDrive()),Ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},Me=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Pe=async e=>t?t.selectComputable(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},Ee=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Ne=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},He=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ge=async e=>t?t==null?void 0:t.blockLane(e):{status:-1,message:"未加载OpenDrive地图"},Ze=()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},We=async e=>(n||(n=new q.default(a)),await n.showSignalControlArea(e)),je=async e=>(n||(n=new q.default(a)),await n.showDistrict(e)),Je=async e=>(n||(n=new q.default(a)),await n.showSubDistrict(e)),Qe=async()=>await(n==null?void 0:n.clearSignalControlArea()),Ue=e=>n==null?void 0:n.setLayerVisibility(e),Ke=async e=>n?await(n==null?void 0:n.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Fe=async e=>n?await n.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Xe=()=>n?n.resetHighlight():{status:-1,message:"未加载信号控制区"},Ye=e=>(u||(u=new St.default(a)),u.showSubSignalControlArea(e)),Re=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},$e=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},et=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},tt=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},at=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},nt=e=>(g||(g=new x.default(a)),g.addGreenWaveBand(e)),st=()=>{if(!g)return{status:-1,message:"未加载绿波带"};g.stopAddGreenWaveBand()},rt=async e=>(g||(g=new x.default(a)),await g.showGreenWaveBand(e)),ot=async e=>(w||(w=new wt.default(a)),await w.showJurisdiction(e)),it=()=>{if(!w)return{status:-1,message:"未加载警务管辖区"};w.clearJurisdiction()},ct=async e=>(b||(b=new pt.default(a)),await b.setEdpassLayerVisibility(e)),M=N,S=G;return H({mapViewer:Z,setLayerVisibility:Y,setMapCenter:U,lookAt:X,setMapCamera:K,setMapZoom:F,setMapZoomRange:ee,requestCoordinateTransform:R,cancelCoordinateTransform:$,addOverlays:ve,addClusterPoints:Se,removeAllClusterPoints:he,addMask:Ce,removeMask:be,showAllOverlays:De,removeOverlaysByType:Oe,removeOverlaysById:Ae,removeAllOverlays:ke,showLaneNumber:te,clearLaneNumber:ae,initializeAreaTool:ne,calCrossIndicatorArea:se,calRoadIndicatorArea:re,connectCarFlow:oe,disconnectCarFlow:ie,handleHoloVehicleTraceData:ce,clearHoloTrace:le,initializeLampGroup:me,handleUniSignalData:pe,handleHoloSignalData:de,clearHoloSignal:ge,setInterpolate:ue,toggleTrafficInfo:fe,toggleTrafficObject:we,toggleVehicleInfo:k,togglePause:ye,updateQueueLength:Le,removeQueueLength:Te,showOpenDriveFromServer:qe,showOpenDriveFromFile:Ve,clearOpenDrive:Be,setOpendriveVisibility:_e,geometrySearchInOpenDrive:ze,findSumoInOpenDrive:Ie,selectSumoInOpenDrive:Me,unselectSumoInOpenDrive:xe,selectComputableInOpenDrive:Pe,getSumoInfo:Ee,splitOpenDriveLane:Ne,clearSplitOpenDriveLane:He,blockOpenDriveLane:Ge,clearBlockOpenDriveLane:Ze,showSignalControlArea:We,showDistrictArea:je,showSubDistrictArea:Je,clearSignalControlArea:Qe,setSignalControlAreaVisibility:Ue,locateSignalControlArea:Ke,highlightSignalControlArea:Fe,resetHighlightSignalControlArea:Xe,showSubSignalControlArea:Ye,editSubSignalControlArea:Re,stopEditSubSignalControlArea:$e,selectSubSignalControlAreaCross:et,unselectSubSignalControlAreaCross:tt,changeSubSignalControlAreaBorderVisibility:at,addGreenWaveBand:nt,stopAddGreenWaveBand:st,showGreenWaveBand:rt,showPoliceArea:ot,clearPoliceArea:it,setEdpassLayerVisibility:ct}),(e,d)=>(r.openBlock(),r.createElementBlock("div",Ct,[r.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:C},[r.withDirectives(r.createElementVNode("div",bt,[r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:W}," 开始记录 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 下载日志 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:J}," 显示车辆id "),r.createElementVNode("button",{onClick:Q},"显示车辆号牌")],512),[[r.vShow,O.value]])],512),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_,(c,h)=>(r.openBlock(),r.createBlock(ft.default,{key:h,"display-mode":c.displayMode,flash:c.flash,"road-id":c.crossId,"cross-id":c.roadId,"map-point":c.mapPoint,"stop-line":c.stopLine,position:c.position,rotation:c.rotation,scale:c.scale,"lamp-status":c.lampStatus},null,8,["display-mode","flash","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=Ot;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),q=require("./stores/index.js");require("./style/index.css");const pt=require("./utils/dbscan-cluster/index.js"),ft=require("./utils/detect-gpu.js"),wt=require("./utils/edpass-device-controller.js"),P=require("./utils/green-wave-band-controller/index.js"),yt=require("./utils/holo-flow/index.js"),St=require("./utils/holo-flow/signal-countdown-panel.vue.js"),Ct=require("./utils/map-initializer.js"),z=require("./utils/open-drive-renderer/index.js"),E=require("./utils/overlay.js"),ht=require("./utils/police-jurisdiction.js"),vt=require("./utils/queue-length.js"),N=require("./utils/road-config-tool/index.js"),bt=require("./utils/signal-control-area/edit-area.js"),B=require("./utils/signal-control-area/signal-area-controller.js"),Ot=require("./utils/signal-control-area/signal-cross-controller.js"),kt=require("./utils/traffic-flow.js"),At={class:"gis-viewer"},Dt={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},Lt=r.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(H,{expose:G,emit:Z}){const b=r.ref(null);let n,g,l,i,s,o,f,t,u,a,y,p,S,O,w;const k=r.ref(!1);q.registerStore();const V=q.default.useAppDataStore,_=r.reactive([]),I=e=>Math.log2(591657527591555e-6/e);let C=null,M=null;const A=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==M&&(M=d,h("update:zoom",d))};ft.default(),r.onMounted(async()=>{if(!b.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(k.value=!k.value)});const e=r.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(x.config)).json();c.assetsRoot=x.assetsRoot||d,V.mapConfig=c,g=new Ct.default,V.mapInitializer=g,n=await g.initialize({container:b.value,mapConfig:c,markerClickCallback:(m,L,T,gt)=>{h("markerClick",m,L,T,gt)},mapClickCallback:(m,L,T)=>{h("mapClick",m,L,T)}});const v=n.zoom??(n.scale?I(n.scale):void 0);typeof v=="number"&&A(v);const mt=n.zoom!==void 0?n.watch("zoom",m=>{A(m)}):n.watch("scale",m=>{typeof m=="number"&&m>0&&A(I(m))});C=()=>mt.remove(),s=new yt.default(n,_),await s.init(),h("mapLoaded")}),r.onUnmounted(()=>{a==null||a.clearSignalControlArea(),t==null||t.clearOpenDrive(),s.clearHoloTrace(),s.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),C==null||C(),C=null});const W=r.computed(()=>n),j=()=>{const e=q.default.useAppDataStore;e.saveTrackLog=!0},J=()=>{s.downloadTrackLog()},Q=()=>{D("vehicleId")},U=()=>{D("plateNumber")},K=async e=>await g.setMapCenter(e),F=async e=>await g.setMapCamera(e),X=e=>g.setMapZoom(e),Y=async e=>await g.lookAt(e),R=e=>g.setLayerVisibility(e),$=(e,d)=>g.requestCoordinateTransform(e,d),ee=e=>{g.cancelCoordinateTransform(e)},te=e=>{g.setMapZoomRange(e)},ne=e=>(l||(l=new N.default(n)),l.showLaneNumber(e)),ae=()=>{l==null||l.clearLaneNumber()},se=async e=>(l||(l=new N.default(n)),await l.initializeSearch(e)),re=async()=>l==null?void 0:l.calCrossIndicatorArea(),oe=async()=>{},ie=async(e,d)=>{i||(i=new kt.default(n)),i.connectTrafficFlow(e,d)},ce=()=>{i==null||i.disconnectTrafficFlow()},le=async e=>{s.handleVehicleTraceData(e)},ue=()=>{s.clearHoloTrace()},de=e=>{s.setInterpolate(e)},me=async e=>{await s.handleSignalData(e)},ge=async e=>{await s.initializeLampGroup(e)},pe=e=>{s.handleUniSignalData(e)},fe=()=>{s.clearHoloSignal()},we=e=>{i==null||i.toggleTrafficInfo(e),s==null||s.toggleTrafficInfo(e)},ye=e=>{s==null||s.togglePause(e)},Se=e=>{i==null||i.toggleTrafficObject(e),s==null||s.toggleTrafficObject(e)},D=e=>{s==null||s.updatePanelContent(e)},Ce=async e=>(o||(o=new E.default(n)),o.addOverlays(e)),he=async e=>(w||(w=new pt.default(n)),w.addClusterPoints(e)),ve=()=>{w==null||w.removeAllClusterPoints()},be=e=>(o||(o=new E.default(n)),o.addMask(e)),Oe=()=>{o==null||o.removeMask()},ke=e=>o==null?void 0:o.removeOverlaysByType(e),Ae=e=>o==null?void 0:o.removeOverlaysById(e),De=()=>o==null?void 0:o.removeAllOverlays(),Le=()=>{o==null||o.showAllOverlays()},Te=e=>{f||(f=new vt.default(n)),f.updateQueueLength(e)},qe=()=>{f==null||f.removeQueueLength()},Be=async(e,d)=>(t||(t=new z.default(n)),await t.showOpenDriveFromServer(e,d)),Ve=async e=>(t||(t=new z.default(n)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),_e=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},Ie=async()=>await(t==null?void 0:t.clearOpenDrive()),Me=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Pe=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?t.selectComputable(e):{status:-1,message:"未加载OpenDrive地图"},Ee=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},Ne=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},He=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Ge=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ze=async e=>t?t==null?void 0:t.blockLane(e):{status:-1,message:"未加载OpenDrive地图"},We=e=>t?t==null?void 0:t.clearBlockLane(e):{status:-1,message:"未加载OpenDrive地图"},je=async e=>(a||(a=new B.default(n)),await a.showSignalControlArea(e)),Je=async e=>(a||(a=new B.default(n)),await a.showDistrict(e)),Qe=async e=>(a||(a=new B.default(n)),await a.showSubDistrict(e)),Ue=async()=>await(a==null?void 0:a.clearSignalControlArea()),Ke=e=>a==null?void 0:a.setLayerVisibility(e),Fe=async e=>a?await(a==null?void 0:a.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Xe=async e=>a?await a.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Ye=()=>a?a.resetHighlight():{status:-1,message:"未加载信号控制区"},Re=e=>(u||(u=new bt.default(n)),u.showSubSignalControlArea(e)),$e=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},et=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},tt=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},nt=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},at=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},st=e=>(y||(y=new Ot.default(n)),y.showSignalCross(e)),rt=()=>y?y.clearSignalCross():{status:-1,message:"未加载信号路口"},ot=e=>(p||(p=new P.default(n)),p.addGreenWaveBand(e)),it=()=>{if(!p)return{status:-1,message:"未加载绿波带"};p.stopAddGreenWaveBand()},ct=async e=>(p||(p=new P.default(n)),await p.showGreenWaveBand(e)),lt=async e=>(S||(S=new ht.default(n)),await S.showJurisdiction(e)),ut=()=>{if(!S)return{status:-1,message:"未加载警务管辖区"};S.clearJurisdiction()},dt=async e=>(O||(O=new wt.default(n)),await O.setEdpassLayerVisibility(e)),x=H,h=Z;return G({mapViewer:W,setLayerVisibility:R,setMapCenter:K,lookAt:Y,setMapCamera:F,setMapZoom:X,setMapZoomRange:te,requestCoordinateTransform:$,cancelCoordinateTransform:ee,addOverlays:Ce,addClusterPoints:he,removeAllClusterPoints:ve,addMask:be,removeMask:Oe,showAllOverlays:Le,removeOverlaysByType:ke,removeOverlaysById:Ae,removeAllOverlays:De,showLaneNumber:ne,clearLaneNumber:ae,initializeAreaTool:se,calCrossIndicatorArea:re,calRoadIndicatorArea:oe,connectCarFlow:ie,disconnectCarFlow:ce,handleHoloVehicleTraceData:le,clearHoloTrace:ue,initializeLampGroup:ge,handleUniSignalData:pe,handleHoloSignalData:me,clearHoloSignal:fe,setInterpolate:de,toggleTrafficInfo:we,toggleTrafficObject:Se,toggleVehicleInfo:D,togglePause:ye,updateQueueLength:Te,removeQueueLength:qe,showOpenDriveFromServer:Be,showOpenDriveFromFile:Ve,clearOpenDrive:Ie,setOpendriveVisibility:_e,geometrySearchInOpenDrive:Ee,findSumoInOpenDrive:Me,selectSumoInOpenDrive:xe,unselectSumoInOpenDrive:Pe,selectComputableInOpenDrive:ze,getSumoInfo:Ne,splitOpenDriveLane:He,clearSplitOpenDriveLane:Ge,blockOpenDriveLane:Ze,clearBlockOpenDriveLane:We,showSignalControlArea:je,showDistrictArea:Je,showSubDistrictArea:Qe,clearSignalControlArea:Ue,setSignalControlAreaVisibility:Ke,locateSignalControlArea:Fe,highlightSignalControlArea:Xe,resetHighlightSignalControlArea:Ye,showSubSignalControlArea:Re,editSubSignalControlArea:$e,stopEditSubSignalControlArea:et,selectSubSignalControlAreaCross:tt,unselectSubSignalControlAreaCross:nt,changeSubSignalControlAreaBorderVisibility:at,showSignalCross:st,clearSignalCross:rt,addGreenWaveBand:ot,stopAddGreenWaveBand:it,showGreenWaveBand:ct,showPoliceArea:lt,clearPoliceArea:ut,setEdpassLayerVisibility:dt}),(e,d)=>(r.openBlock(),r.createElementBlock("div",At,[r.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:b},[r.withDirectives(r.createElementVNode("div",Dt,[r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 开始记录 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:J}," 下载日志 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:Q}," 显示车辆id "),r.createElementVNode("button",{onClick:U},"显示车辆号牌")],512),[[r.vShow,k.value]])],512),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_,(c,v)=>(r.openBlock(),r.createBlock(St.default,{key:v,"display-mode":c.displayMode,flash:c.flash,"road-id":c.crossId,"cross-id":c.roadId,"map-point":c.mapPoint,"stop-line":c.stopLine,position:c.position,rotation:c.rotation,scale:c.scale,"lamp-status":c.lampStatus},null,8,["display-mode","flash","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=Lt;
@@ -18,7 +18,8 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
18
18
  queueLength: import("./utils/queue-length").default;
19
19
  openDriveRenderer: import("./utils/open-drive-renderer").default;
20
20
  editSignalAreaController: import("./utils/signal-control-area/edit-area").default;
21
- showSignalAreaController: import("./utils/signal-control-area/show-area").default;
21
+ signalAreaController: import("./utils/signal-control-area/signal-area-controller").default;
22
+ signalCrossController: import("./utils/signal-control-area/signal-cross-controller").default;
22
23
  greenWaveBandController: import("./utils/green-wave-band-controller").default;
23
24
  policeJurisdictionController: import("./utils/police-jurisdiction").default;
24
25
  edpassDeviceController: import("./utils/edpass-device-controller").default;
@@ -134,7 +135,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
134
135
  status: number;
135
136
  message: string;
136
137
  }>;
137
- clearBlockOpenDriveLane: () => void | {
138
+ clearBlockOpenDriveLane: (params: import("../types").IBlockOpenDriveLaneParams) => void | {
138
139
  status: number;
139
140
  message: string;
140
141
  };
@@ -170,6 +171,11 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
170
171
  status: number;
171
172
  message: string;
172
173
  } | undefined;
174
+ showSignalCross: (params: any) => import("../types").IResult;
175
+ clearSignalCross: () => void | {
176
+ status: number;
177
+ message: string;
178
+ };
173
179
  addGreenWaveBand: (params: import("../types").IEditSignalControlAreaParams) => void;
174
180
  stopAddGreenWaveBand: () => {
175
181
  status: number;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/Basemap"),M=require("@arcgis/core/config"),W=require("@arcgis/core/core/reactiveUtils"),b=require("@arcgis/core/geometry"),C=require("@arcgis/core/geometry/support/webMercatorUtils"),T=require("@arcgis/core/Graphic"),I=require("@arcgis/core/layers/FeatureLayer"),G=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/GroupLayer"),S=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),x=require("@arcgis/core/layers/MapImageLayer"),_=require("@arcgis/core/layers/TileLayer"),j=require("@arcgis/core/layers/WebTileLayer"),H=require("@arcgis/core/layers/WMSLayer"),B=require("@arcgis/core/Map"),N=require("@arcgis/core/views/MapView"),R=require("@arcgis/core/views/SceneView"),E=require("@turf/destination"),U=require("@turf/helpers"),A=require("@arcgis/core/layers/GraphicsLayer"),D=require("./custom-layer/custom-wmts-layer.js");function k(y){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(y){for(const i in y)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(y,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>y[i]})}}return e.default=y,Object.freeze(e)}const q=k(W),L=k(C),V=k(U);class J{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null,this.detachmentLayerLoaded=!1}processUrl(e){return e&&(e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("{{")?e.replace("{{geoServer}}",this.mapConfig.geoServer):this.mapConfig.assetsRoot+e)}async initialize(e){var p,w,g,m;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:o}=e;M.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,M.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,M.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const a=new B;((p=this.mapConfig)==null?void 0:p.mapOptions.mode.toLowerCase())==="2d"?(this.view=new N({map:a,container:i,...this.mapConfig.mapOptions}),this.view.on("drag",t=>{t.button===2&&t.stopPropagation()})):this.view=new R({map:a,container:i,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(w=this.mapConfig)==null?void 0:w.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async t=>{var l,v;if(o){let n=t.mapPoint;n.spatialReference.isWebMercator&&(n=L.webMercatorToGeographic(n)),o([n.x,n.y],[t.screenPoint.x,t.screenPoint.y],t)}if(this.view.type==="3d"){const n=this.view.camera;if(this.view.spatialReference.isWebMercator){const d=L.webMercatorToGeographic(n.position),f={heading:n.heading,tilt:n.tilt,position:d.toJSON()};console.log(f),(l=navigator.clipboard)==null||l.writeText(JSON.stringify(f))}else console.log(n.toJSON());console.log(this.view.zoom,this.view.scale)}else{let n=this.view.center;this.view.spatialReference.isWebMercator&&(n=L.webMercatorToGeographic(n)),console.log({center:n.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(v=(await this.view.hitTest(t)).results)==null?void 0:v.filter(n=>n.type==="graphic");c.length>0&&c.forEach(n=>{var f;const d=n.graphic;(f=d.attributes)!=null&&f.type&&s&&s(d.attributes.type,d.attributes.id,d.attributes,t)})});{let t=0,r=!1;this.view.on("pointer-move",async c=>{var v;const l=performance.now();if(!(r||l-t<100)){t=l,r=!0;try{const d=(v=(await this.view.hitTest(c)).results)==null?void 0:v.some(z=>z.type==="graphic"),f=this.view.container;f&&(f.style.cursor=d?"pointer":"default")}finally{r=!1}}})}if(this.view.on("pointer-leave",()=>{const t=this.view.container;t&&(t.style.cursor="default")}),(g=this.mapConfig)!=null&&g.baseLayers?this.mapConfig.baseLayers.forEach(t=>{const r=this.processUrl(t.url);let c=null;switch(t.type.toLowerCase()){case"webTile".toLowerCase():{c=new j({urlTemplate:r,...t.options});break}case"tile":{c=new _({url:r,...t.options});break}case"customwmts".toLowerCase():{c=new D.default({urlTemplate:r,...t.options});break}case"mapimage".toLowerCase():{c=new x({url:r,...t.options});break}case"arcgis":{const l=new P(t.options);a.basemap=l;break}case"feature":{c=new I({url:r,...t.options});break}case"3dtiles":{c=new S({url:r,...t.options});break}case"wms":{c=new H({url:r,...t.options});break}}if(c)if(t.group){let l=a.findLayerById(t.group);l&&l.type==="group"?l.add(c):(l=new O({id:t.group,title:t.groupTitle,visibilityMode:"inherited",layers:[c],visible:t.groupVisible!==!1}),a.add(l))}else a.add(c)}):a.basemap=new P({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(m=this.mapConfig)!=null&&m.hdLayers){const t=this.mapConfig.hdLayers.map(r=>new G({url:this.processUrl(r.url),...r.options,title:r.options.id}));a.addMany(t)}this.view.ui.remove("attribution"),await this.view.when();const h=this.mapConfig.camera;let u;if(this.view.type==="2d"){let t=this.view.center;this.view.spatialReference.isWebMercator&&(t=L.webMercatorToGeographic(t)),u={center:[t.x,t.y],zoom:this.view.zoom}}else{let t=this.view.camera.position;this.view.spatialReference.isWebMercator&&(t=L.webMercatorToGeographic(t)),u={position:t,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return h?h.home=u:this.mapConfig.camera={home:u},this.view}async setLayerVisibility(e){const{id:i,visible:s}=e;if(i==="shanghai_district")return!this.detachmentLayerLoaded&&e.visible?await this.loadDetachmentLayer():this.detachmentLayer&&(this.detachmentLayer.visible=s),{status:0,message:"ok"};{const o=this.view.map.findLayerById(i);return o?(o.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type.toLowerCase()){case"point":e.target=new b.Point(e.target);break;case"polyline":e.target=new b.Polyline(e.target);break;case"polygon":e.target=new b.Polygon(e.target);break;case"multipoint":e.target=new b.Multipoint(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}setMapZoom(e){return this.view?(this.view.zoom=e.zoom,{status:0,message:"成功"}):{status:-1,message:"未初始化"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,s=e.heading||0;if(i===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(i*Math.PI/180)*e.height,a=E(V.point(e.center),o,s+180,{units:"meters"});await this.view.goTo({position:{x:a.geometry.coordinates[0],y:a.geometry.coordinates[1],z:e.height},heading:s,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:s=0}=e,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const a=o[i];return a?(await this.view.goTo(a,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let s=0;const a=1e3/30,h=q.watch(()=>this.view.center,()=>{const u=this.transformPoints(e),p=Date.now();p-s>a&&(i(u),s=p)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,h),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const s=new b.Point({x:i[0],y:i[1]}),o=this.view.toScreen(s);return[o.x,o.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:s}=e;!i&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=q.watch(()=>this.view.zoom,o=>{i&&o<=i&&(this.view.zoom=i),s&&o>=s&&(this.view.zoom=s)}))}async loadDetachmentLayer(){this.detachmentLayer=new A({id:"detachmentLayer",title:"支队图层",effect:void 0}),this.view.map.add(this.detachmentLayer);const e=this.mapConfig.baseLayers;if(!e)return;const i=e.find(s=>s.options.id==="shanghai_district");if(i)try{const o=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),a=[],{renderer:h,labelingInfo:u}=i.options;o.features.forEach(p=>{const w=p.attributes.ZD_NAME;if(w!=="高架支队"){let g=new b.Polygon({rings:p.geometry.rings});g=C.webMercatorToGeographic(g);const m=new T({geometry:g,attributes:p.attributes});if(h){if(h.type==="simple")m.symbol=h.symbol;else if(h.type==="unique-value"){const t=m.getAttribute("OBJECTID"),r=h.uniqueValueInfos.find(c=>c.value==t);m.symbol=r?r.symbol:h.defaultSymbol}}else m.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(a.push(m),u&&w!=="边防港航支队"&&w!=="机场支队"){const t=new T({geometry:g.centroid,symbol:{...u.symbol,text:w}});a.push(t)}}}),this.detachmentLayer.addMany(a),this.detachmentLayerLoaded=!0}catch(s){console.error("加载支队图层失败:",s);return}}}exports.default=J;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/Basemap"),M=require("@arcgis/core/config"),I=require("@arcgis/core/core/reactiveUtils"),b=require("@arcgis/core/geometry"),z=require("@arcgis/core/geometry/support/webMercatorUtils"),T=require("@arcgis/core/Graphic"),G=require("@arcgis/core/layers/FeatureLayer"),q=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/GroupLayer"),S=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),x=require("@arcgis/core/layers/MapImageLayer"),_=require("@arcgis/core/layers/TileLayer"),j=require("@arcgis/core/layers/WebTileLayer"),H=require("@arcgis/core/layers/WMSLayer"),B=require("@arcgis/core/Map"),N=require("@arcgis/core/views/MapView"),R=require("@arcgis/core/views/SceneView"),E=require("@turf/destination"),U=require("@turf/helpers"),A=require("@arcgis/core/layers/GraphicsLayer"),D=require("./custom-layer/custom-wmts-layer.js");function k(y){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(y){for(const i in y)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(y,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>y[i]})}}return e.default=y,Object.freeze(e)}const C=k(I),L=k(z),V=k(U);class J{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null,this.detachmentLayerLoaded=!1}processUrl(e){return e&&(e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("{{")?e.replace("{{geoServer}}",this.mapConfig.geoServer):this.mapConfig.assetsRoot+e)}async initialize(e){var p,w,g,m;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:r}=e;M.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,M.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,M.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const o=new B;((p=this.mapConfig)==null?void 0:p.mapOptions.mode.toLowerCase())==="2d"?(this.view=new N({map:o,container:i,...this.mapConfig.mapOptions}),this.view.on("drag",t=>{t.button===2&&t.stopPropagation()})):this.view=new R({map:o,container:i,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(w=this.mapConfig)==null?void 0:w.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async t=>{var l,v;if(r){let c=t.mapPoint;c.spatialReference.isWebMercator&&(c=L.webMercatorToGeographic(c)),r([c.x,c.y],[t.screenPoint.x,t.screenPoint.y],t)}if(this.view.type==="3d"){const c=this.view.camera;if(this.view.spatialReference.isWebMercator){const d=L.webMercatorToGeographic(c.position),f={heading:c.heading,tilt:c.tilt,position:d.toJSON()};console.log(f),(l=navigator.clipboard)==null||l.writeText(JSON.stringify(f))}else console.log(c.toJSON());console.log(this.view.zoom,this.view.scale)}else{let c=this.view.center;this.view.spatialReference.isWebMercator&&(c=L.webMercatorToGeographic(c)),console.log({center:c.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const n=(v=(await this.view.hitTest(t)).results)==null?void 0:v.filter(c=>c.type==="graphic");n.length>0&&n.forEach(c=>{var f;const d=c.graphic;(f=d.attributes)!=null&&f.type&&s&&s(d.attributes.type,d.attributes.id,d.attributes,t)})});{let t=0,a=!1;this.view.on("pointer-move",async n=>{var v;const l=performance.now();if(!(a||l-t<100)){t=l,a=!0;try{const d=(v=(await this.view.hitTest(n)).results)==null?void 0:v.some(W=>W.type==="graphic"),f=this.view.container;f&&(f.style.cursor=d?"pointer":"default")}finally{a=!1}}})}if(this.view.on("pointer-leave",()=>{const t=this.view.container;t&&(t.style.cursor="default")}),(g=this.mapConfig)!=null&&g.baseLayers?this.mapConfig.baseLayers.forEach(t=>{const a=this.processUrl(t.url);let n=null;switch(t.type.toLowerCase()){case"webTile".toLowerCase():{n=new j({urlTemplate:a,...t.options});break}case"tile":{n=new _({url:a,...t.options});break}case"customwmts".toLowerCase():{n=new D.default({urlTemplate:a,...t.options});break}case"mapimage".toLowerCase():{n=new x({url:a,...t.options});break}case"arcgis":{const l=new P(t.options);o.basemap=l;break}case"feature":{n=new G({url:a,...t.options});break}case"3dtiles":{n=new S({url:a,...t.options});break}case"wms":{n=new H({url:a,...t.options});break}case"geojson":{n=new q({url:a,...t.options});break}}if(n)if(t.group){let l=o.findLayerById(t.group);l&&l.type==="group"?l.add(n):(l=new O({id:t.group,title:t.groupTitle,visibilityMode:"inherited",layers:[n],visible:t.groupVisible!==!1}),o.add(l))}else o.add(n)}):o.basemap=new P({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(m=this.mapConfig)!=null&&m.hdLayers){const t=this.mapConfig.hdLayers.map(a=>new q({url:this.processUrl(a.url),...a.options,title:a.options.id}));o.addMany(t)}this.view.ui.remove("attribution"),await this.view.when();const h=this.mapConfig.camera;let u;if(this.view.type==="2d"){let t=this.view.center;this.view.spatialReference.isWebMercator&&(t=L.webMercatorToGeographic(t)),u={center:[t.x,t.y],zoom:this.view.zoom}}else{let t=this.view.camera.position;this.view.spatialReference.isWebMercator&&(t=L.webMercatorToGeographic(t)),u={position:t,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return h?h.home=u:this.mapConfig.camera={home:u},this.view}async setLayerVisibility(e){const{id:i,visible:s}=e;if(i==="shanghai_district")return!this.detachmentLayerLoaded&&e.visible?await this.loadDetachmentLayer():this.detachmentLayer&&(this.detachmentLayer.visible=s),{status:0,message:"ok"};{const r=this.view.map.findLayerById(i);return r?(r.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type.toLowerCase()){case"point":e.target=new b.Point(e.target);break;case"polyline":e.target=new b.Polyline(e.target);break;case"polygon":e.target=new b.Polygon(e.target);break;case"multipoint":e.target=new b.Multipoint(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}setMapZoom(e){return this.view?(this.view.zoom=e.zoom,{status:0,message:"成功"}):{status:-1,message:"未初始化"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,s=e.heading||0;if(i===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 r=Math.tan(i*Math.PI/180)*e.height,o=E(V.point(e.center),r,s+180,{units:"meters"});await this.view.goTo({position:{x:o.geometry.coordinates[0],y:o.geometry.coordinates[1],z:e.height},heading:s,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:s=0}=e,{camera:r}=this.mapConfig;if(!r)return{status:-1,message:"未配置camera"};const o=r[i];return o?(await this.view.goTo(o,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let s=0;const o=1e3/30,h=C.watch(()=>this.view.center,()=>{const u=this.transformPoints(e),p=Date.now();p-s>o&&(i(u),s=p)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,h),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const s=new b.Point({x:i[0],y:i[1]}),r=this.view.toScreen(s);return[r.x,r.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:s}=e;!i&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=C.watch(()=>this.view.zoom,r=>{i&&r<=i&&(this.view.zoom=i),s&&r>=s&&(this.view.zoom=s)}))}async loadDetachmentLayer(){this.detachmentLayer=new A({id:"detachmentLayer",title:"支队图层",effect:void 0}),this.view.map.add(this.detachmentLayer);const e=this.mapConfig.baseLayers;if(!e)return;const i=e.find(s=>s.options.id==="shanghai_district");if(i)try{const r=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),o=[],{renderer:h,labelingInfo:u}=i.options;r.features.forEach(p=>{const w=p.attributes.ZD_NAME;if(w!=="高架支队"){let g=new b.Polygon({rings:p.geometry.rings});g=z.webMercatorToGeographic(g);const m=new T({geometry:g,attributes:p.attributes});if(h){if(h.type==="simple")m.symbol=h.symbol;else if(h.type==="unique-value"){const t=m.getAttribute("OBJECTID"),a=h.uniqueValueInfos.find(n=>n.value==t);m.symbol=a?a.symbol:h.defaultSymbol}}else m.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(o.push(m),u&&w!=="边防港航支队"&&w!=="机场支队"){const t=new T({geometry:g.centroid,symbol:{...u.symbol,text:w}});o.push(t)}}}),this.detachmentLayer.addMany(o),this.detachmentLayerLoaded=!0}catch(s){console.error("加载支队图层失败:",s);return}}}exports.default=J;
@@ -118,12 +118,17 @@ export default class OpenDriveRenderer {
118
118
  * @returns
119
119
  */
120
120
  splitLane(params: ISplitOpenDriveLaneParams): Promise<IResult>;
121
+ clearSplitLane(): void;
121
122
  /**
122
123
  * 封闭车道,使用可计算路网的id
123
124
  * @param params
124
125
  */
125
126
  blockLane(params: IBlockOpenDriveLaneParams): void;
126
- clearSplitLane(): void;
127
+ /**
128
+ * 解除封闭车道,使用可计算路网id
129
+ * @param params
130
+ */
131
+ clearBlockLane(params: IBlockOpenDriveLaneParams): void;
127
132
  selectComputable(params: IFindSumoParams): void;
128
133
  /**
129
134
  * 更新所有路口的symbol
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("@arcgis/core/Graphic"),J=require("@arcgis/core/core/promiseUtils"),E=require("@arcgis/core/core/reactiveUtils.js"),A=require("@arcgis/core/geometry"),q=require("@arcgis/core/geometry/geometryEngine"),x=require("@arcgis/core/layers/FeatureLayer"),v=require("@arcgis/core/layers/GraphicsLayer"),T=require("@turf/helpers"),O=require("@turf/line-slice-along"),w=require("axios"),_=require("fast-xml-parser"),R=require("md5"),M=require("pako"),z=require("vue"),H=require("../../stores/index.js"),k=require("../common-utils.js");function N(S){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(S){for(const t in S)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(S,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>S[t]})}}return e.default=S,Object.freeze(e)}const P=N(J),U=N(E),L=N(q),B=N(T);class C{constructor(e){this.junctionNames=new Map,this.junctionScale=5e3,this.xodrBorder=[],this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.selectedSectionIds=[],this.currentJunctionId="",this.view=e,this.laneLayer=new x({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"sectionIndex",alias:"路段序号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"},{name:"fromNode",alias:"起点路口",type:"string"},{name:"toNode",alias:"终点路口",type:"string"},{name:"roadsectBaseIds",alias:"基本段编号",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new x({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new v({id:"OpenDriveJunction"}),this.sectionLayer=new v({id:"OpenDriveSection"}),this.highlightLayer=new v({id:"OpenDriveHighlight"}),this.flashLayer=new v({id:"OpenDriveFlash"}),this.drawLayer=new v({id:"Draw"}),this.splitLaneLayer=new v({id:"SplitLane"}),this.borderLayer=new v({id:"OpenDriveBorder"}),this.view.map.addMany([this.laneLayer,this.sectionLayer,this.roadNameLayer,this.junctionLayer,this.highlightLayer,this.flashLayer,this.drawLayer,this.splitLaneLayer,this.borderLayer])}static getInstance(e){return this.instance||(this.instance=new C(e)),this.instance}async makeMd5FromFile(e){var t;try{const o=await(await fetch(e)).text();let r=(t=new _.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(o).OpenDRIVE.userData)==null?void 0:t.border;return r?r=JSON.parse(r):r=[],{status:0,message:"ok",result:{md5:R(o),border:r}}}catch(s){return{status:-1,message:s.message}}}async showOpenDriveFromFile(e){var d,m,u;this.openDriveClickCallback=e.selectedCallback,this.scaleWatch=U.watch(()=>this.view.scale,(h,p)=>{h>this.junctionScale&&p<=this.junctionScale?this.updateAllJunctionSymbol("marker"):h<=this.junctionScale&&p>this.junctionScale&&this.updateAllJunctionSymbol("picture")});let t=e.file.split("/").pop()||"";t=t.split(".").slice(0,-1).join("."),this.openDriveServer=e.server;const s=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await w.post(s,{},{params:{url:e.file,projectName:t}})}catch(h){return{status:-1,message:h.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const i=o.data.result.geoSetting;k.default.setGeoData(i.geoReference,i.offsetX,i.offsetY);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e.server}${l}`);const r=await fetch(l);let a;if(l.endsWith("bin")){const h=await r.arrayBuffer(),p=M.inflate(h,{to:"string"});a=JSON.parse(p)}else a=await r.json();if(await this.showAllLanes(a,((d=e.options)==null?void 0:d.showJunctionLane)||!1,((m=e.options)==null?void 0:m.showRoadName)||!0),((u=e.options)==null?void 0:u.showJunctionPoint)!==!1){const h=o.data.result.junctions;this.showJunction(h)}e.options&&e.options.centerMap!==!1&&await this.view.goTo(this.allLaneGraphics),this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick();const n=H.default.useAppDataStore;return z.watch(()=>n.isSketching,()=>{var h,p;n.isSketching?((h=this.mouseMoveHandler)==null||h.remove(),this.mouseMoveHandler=void 0,(p=this.mouseClickHandler)==null||p.remove(),this.mouseClickHandler=void 0):(this.monitorMouseMove(),this.monitorMouseClick())}),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const s=`http://${e}/api/openDrive/analyzeXodr`,o=await w.get(s,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let i=o.data.result.json;i.startsWith(window.location.protocol)||(i=`${window.location.protocol}//${e}${i}`);const l=await fetch(i);let r;if(i.endsWith("bin")){const a=await l.arrayBuffer(),c=M.inflate(a,{to:"string"});r=JSON.parse(c)}else r=await l.json();return await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,s){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=s,new Promise(i=>{var c;let l=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const r=[];for(const n of e){if(!t&&n.junction!=="-1")continue;const{id:d,refLine:m}=n;let u=n.name;u.includes("(")&&(u=u.slice(0,u.indexOf("("))),u=u.replace(/(.)/g,"$1 ");const h=new I({geometry:{type:"polyline",paths:[m]},attributes:{ObjectID:l++,roadId:d,roadName:u}});this.allRefLineGraphics.push(h),n.laneSections.sort((p,g)=>Number(p.id)-Number(g.id));for(let p=0;p<n.laneSections.length;p++){const g=n.laneSections[p],y=Number(g.id);for(const f of g.lanePaths){const b=Number(f.id);if(b===0)continue;const $=f.type,F=[...f.outerPath],j=f.innerPath.concat(F.reverse());if(j.length<=3){console.warn(`lane ${b} has less than 3 points`);continue}j.push(f.innerPath[0]);const D=new A.Polygon({rings:[j]});if(D){const G=new I({geometry:D,attributes:{ObjectID:l++,id:`${d}+${y}+${b}`,fromNode:n.fromNode,toNode:n.toNode,roadId:String(d),roadName:n.name,sectionId:String(y),sectionIndex:p,laneId:b,type:$,sumoId:"",leftLine:f.innerPath,rightLine:f.outerPath,roadsectBaseIds:(c=g.roadsectBaseIds)==null?void 0:c.toString()}});this.allLaneGraphics.push(G),r.push(G)}}}}const a=setInterval(()=>{if(r.length>0||this.allRefLineGraphics.length>0){if(r.length>0){const n=r.splice(0,100);this.laneLayer.applyEdits({addFeatures:n})}if(this.allRefLineGraphics.length>0){const n=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:n})}}else clearInterval(a),i()},10)})}showJunction(e){const t=[];let s;this.xodrBorder.length>0&&(s=new A.Polygon({rings:[this.xodrBorder]}));for(const o of e)if(o&&(this.junctionNames.set(o.id,o.name),o.nodeType=o.type,o.crossId)){const i=new A.Point({x:o.coordinates[0],y:o.coordinates[1]});let l=!0;if(s&&(l=L.contains(s,i)),l){const r=new I({geometry:i,attributes:{...o,selected:!1,type:"OpenDriveJunction"},symbol:this.getCrossGraphicSymbol(o,"marker")});t.push(r)}}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=P.debounce(async t=>{var l;const o=(l=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.filter(r=>r.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId=""),this.view.closePopup();return}const i=o[0];if(this.hitGraphic=i.graphic,i.layer.id==="OpenDriveLane"){const r=`${this.hitGraphic.getAttribute("roadId")}+${this.hitGraphic.getAttribute("sectionId")}`,a=this.hitGraphic.getAttribute("roadsectBaseIds");if(this.currentSectionCode===r||this.selectedSectionIds.includes(a)||this.sectionLayer.graphics.findIndex(y=>y.getAttribute("id")===r)>=0)return;this.currentSectionCode=r;const n=this.allLaneGraphics.filter(y=>`${y.attributes.roadId}+${y.attributes.sectionId}`===r),d=L.union(n.map(y=>y.geometry)),m=this.hitGraphic.getAttribute("fromNode"),u=this.hitGraphic.getAttribute("toNode"),h=this.junctionNames.get(m)||m,p=this.junctionNames.get(u)||u,g=new I({geometry:d,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:r,selected:!1,fromNodeName:h,toNodeName:p,laneCount:n.length,roadsectBaseIds:this.hitGraphic.getAttribute("roadsectBaseIds"),roadId:this.hitGraphic.getAttribute("roadId")},popupTemplate:{title:this.hitGraphic.getAttribute("roadName"),content:[{type:"fields",fieldInfos:[{fieldName:"fromNodeName",label:"起点路口"},{fieldName:"toNodeName",label:"终点路口"},{fieldName:"laneCount",label:"车道数量"}]}]}});this.highlightLayer.removeAll(),this.highlightLayer.add(g)}else if(i.layer.id==="OpenDriveJunction"){const r=this.hitGraphic.getAttribute("id");if(r===this.currentJunctionId)return;this.currentJunctionId=r}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=P.debounce(async t=>{var a;const o=(a=(await this.view.hitTest(t,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:a.filter(c=>c.type==="graphic");if(o.length===0)return;const i=o[0].graphic,l=i.getAttribute("type"),r=i.getAttribute("id");if(l==="OpenDriveJunction")if(i.getAttribute("selected")===!1){const c=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,n=await w.get(c,{params:{id:r,projectName:this.projectName}});n.status===200&&n.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:n.data.result}),i.setAttribute("selected",!0),i.symbol={type:"picture-marker",url:"/GisViewerAssets/Images/point_red.png",width:"20px",height:"20px"},this.increasePictureMarkerSize(i,50))}else this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:void 0}),i.setAttribute("selected",!1),i.symbol=this.getCrossGraphicSymbol(i.attributes,this.view.scale<this.junctionScale?"picture":"marker");else l==="OpenDriveSection"&&(i.layer.id==="OpenDriveHighlight"?(this.highlightLayer.removeAll(),this.sectionLayer.removeAll(),this.selectedSectionIds=[],this.sectionLayer.add(i),i.setAttribute("selected",!0),this.selectedSectionIds.push(r),this.splitLaneLayer.graphics.filter(n=>n.getAttribute("roadsectBaseIds")===i.getAttribute("roadsectBaseIds")).forEach(n=>n.symbol={type:"simple-fill",color:[255,69,0],outline:{color:"red",width:2}}),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:i.getAttribute("id"),details:{roadsectId:i.getAttribute("roadId"),roadsectBaseIds:i.getAttribute("roadsectBaseIds")}})):(this.splitLaneLayer.graphics.filter(n=>n.getAttribute("roadsectBaseIds")===i.getAttribute("roadsectBaseIds")).forEach(n=>n.symbol={type:"simple-fill",color:[255,0,0,.8],outline:{color:"red",width:1}}),this.sectionLayer.remove(i),this.selectedSectionIds=[],this.openDriveClickCallback&&this.openDriveClickCallback({type:"CloseOpenDriveSection",id:i.getAttribute("roadsectBaseIds"),details:{roadsectId:i.getAttribute("roadId"),roadsectBaseIds:i.getAttribute("roadsectBaseIds")}})))});this.mouseClickHandler=this.view.on("immediate-click",async t=>{e(t).catch(()=>{})})}increasePictureMarkerSize(e,t){const s=setInterval(()=>{const o=e.symbol,i=o.width;i<t?e.symbol={type:"picture-marker",url:o.url,width:i+1,height:i+1}:clearInterval(s)},20)}decreasePictureMarkerSize(e,t){const s=setInterval(()=>{const o=e.symbol,i=o.width;i>t?e.symbol={type:"picture-marker",url:o.url,width:i-1,height:i-1}:clearInterval(s)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const t=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,s=await w.get(t,{params:{id:e.id,projectName:this.projectName}});return s.status===200?s.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const t=e.id.split("#");let s=t[0];s.startsWith("-")&&(s=s.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const i=this.allLaneGraphics.find(l=>l.getAttribute("roadId")===s&&l.getAttribute("sectionIndex")===o);if(i){const l=`${s}+${i.getAttribute("sectionId")}`,r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await w.get(r,{params:{id:l,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${l}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}setOpendriveVisibility(e){this.laneLayer.visible=e}async clearOpenDrive(){var t,s,o;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.sectionLayer.removeAll(),this.flashLayer.removeAll(),this.borderLayer.removeAll(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(s=this.mouseClickHandler)==null||s.remove(),this.mouseClickHandler=void 0,(o=this.scaleWatch)==null||o.remove(),this.scaleWatch=void 0}async findSumo(e){const{type:t,id:s}=e,o=e.flash===void 0?!0:e.flash;if(t==="junction")return await this.findJunction(s,o);if(t==="edge"){const i=s.split("_");if(i.length>2)return{status:-1,message:"id格式错误"};const l=i.length===2?Number(i[1]):void 0,r=i[0].split("#");if(r.length>2)return{status:-1,message:"id格式错误"};const a=r[0],c=r.length===2?Number(r[1]):void 0;return await this.findLane({roadsectId:a,segmentId:c,laneId:l,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,t){const s=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!s)return{status:-1,message:"未找到。请检查路口编号"};if(t){const o=new I({geometry:s.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[0,255,255,.8],outline:{color:[0,255,255],width:1}}});this.flashGraphic(o)}return await this.view.goTo(s.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:t,segmentId:s,laneId:o}=e;t.startsWith("-")&&(t=t.slice(1));let i=this.allLaneGraphics.filter(a=>a.attributes.roadId===t);if(i.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(s!==void 0){const a=[];if(i.forEach(c=>{const n=Number(c.attributes.sectionId);a.indexOf(n)===-1&&a.push(n)}),a.sort((c,n)=>c-n),s>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};s=a[s],i=i.filter(c=>Number(c.attributes.sectionId)===s)}if(o!==void 0){const a=[];if(i.forEach(c=>{const n=Number(c.attributes.laneId);a.indexOf(n)===-1&&a.push(n)}),a.sort((c,n)=>c-n),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],i=i.filter(c=>Number(c.attributes.laneId)===o)}const l=i.map(a=>a.geometry),r=L.union(l);if(e.flash){const a=new I({geometry:r,symbol:{type:"simple-fill",color:[0,255,255,.6],style:"solid",outline:{width:0}}});this.flashGraphic(a)}return await this.view.goTo(r,{duration:1e3}),{status:0,message:"ok"}}flashGraphic(e){this.flashLayer.removeAll(),this.flashLayer.add(e);let t=0,s=!0;const o=setInterval(()=>{s?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(s=!1,t++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(s=!0)),t>=5&&(this.flashLayer.removeAll(),this.flashLayer.opacity=1,clearInterval(o))},10)}unselectSumo(e){if(e?e.type==="junction"&&this.junctionLayer.graphics.forEach(t=>{(!e||!e.id||e.id===""||e.id===t.getAttribute("id"))&&t.getAttribute("selected")&&(t.setAttribute("selected",!1),t.symbol=this.getCrossGraphicSymbol(t.attributes,this.view.scale<this.junctionScale?"picture":"marker"))}):(this.highlightLayer.removeAll(),this.sectionLayer.removeAll(),this.selectedSectionIds=[],this.splitLaneLayer.removeAll()),!e||e.type==="edge"){let t;!e||!e.id||e.id===""?t=this.sectionLayer.graphics.toArray():t=this.sectionLayer.graphics.filter(s=>s.getAttribute("edgeId")===e.id).toArray(),t.length>0&&(t.forEach(s=>{const o=s.getAttribute("id");this.selectedSectionIds=this.selectedSectionIds.filter(i=>i!==o)}),this.sectionLayer.removeMany(t))}return{status:0,message:"ok"}}async selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(t=>{if(e.id===t.getAttribute("id"))return t.setAttribute("selected",!0),t.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(t,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const t=e.id.split("#");let s=String(t[0]);s.startsWith("-")&&(s=s.slice(1));let o=0;t.length===2&&(o=Number(t[1]));let i=[];if(t.length===1?i=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===s):t.length===2&&(i=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===s&&l.getAttribute("sectionIndex")===o)),i.length>0){const l=new Map;return i.forEach(r=>{const a=r.getAttribute("roadId")+"+"+r.getAttribute("sectionId");this.selectedSectionIds.includes(a)||this.selectedSectionIds.push(a);let c=l.get(a);c?c.push(r.geometry):(c=[r.geometry],l.set(a,c))}),l.forEach(async(r,a)=>{const c=L.union(r),n=new I({geometry:c,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:a,edgeId:e.id,selected:!0}});this.sectionLayer.add(n),await this.view.goTo(n)}),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async geometrySearch(e){const t=new A.Polygon({rings:[e]}),s=await this.laneLayer.queryFeatures({geometry:t,outFields:["*"]}),o=[],i=[];for(const a of s.features){const c=a.getAttribute("roadId"),n=a.getAttribute("sectionIndex"),d=`${c}#${n}`;if(o.indexOf(d)===-1){o.push(d),this.selectSumo({type:"edge",id:d});const m=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,u=await w.get(m,{params:{id:`${c}+${a.getAttribute("sectionId")}`,projectName:this.projectName}});u.status===200&&u.data.status===0&&i.push(u.data.result)}}const l=this.junctionLayer.graphics.filter(a=>{const c=a.geometry;return L.contains(t,c)}),r=[];for(const a of l){const c=a.getAttribute("id");this.selectSumo({type:"junction",id:c});const n=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,d=await w.get(n,{params:{id:c,projectName:this.projectName}});d.status===200&&d.data.status===0&&r.push(d.data.result)}return{status:0,message:"ok",result:{junctions:r,edges:i}}}async splitLane(e){const s=e.id.split("_");if(s.length!==2)return{status:-1,message:"车道编号格式错误"};const o=Number(s[1]),i=s[0].split("#"),l=i.length===2?Number(i[1]):0;let r=i[0];r.startsWith("-")&&(r=r.slice(1));const a=this.allLaneGraphics.filter(b=>b.getAttribute("roadId")===r&&b.getAttribute("sectionIndex")===l);if(a.length===0)return{status:-1,message:"未找到路段"};const c=a.length-o,n=a.find(b=>Math.abs(b.getAttribute("laneId"))===c);if(!n)return{status:-1,message:"未找到车道"};const d=e.start||0,m=e.end||100,u=B.lineString(n.getAttribute("leftLine")),h=O.lineSliceAlong(u,d,m,{units:"meters"}),p=B.lineString(n.getAttribute("rightLine")),g=O.lineSliceAlong(p,d,m,{units:"meters"}),y=h.geometry.coordinates.concat(g.geometry.coordinates.reverse());y.push(y[y.length-1]);const f=new I({geometry:new A.Polygon({rings:[y]}),attributes:{ObjectID:n.getAttribute("ObjectID"),id:n.getAttribute("id"),fromNode:n.getAttribute("fromNode"),toNode:n.getAttribute("toNode"),roadId:n.getAttribute("roadId"),roadName:n.getAttribute("roadName"),sectionId:n.getAttribute("sectionId"),sectionIndex:n.getAttribute("sectionIndex"),laneId:n.getAttribute("laneId"),type:n.getAttribute("type"),sumoId:n.getAttribute("sumoId"),leftLine:h.geometry.coordinates,rightLine:g.geometry.coordinates},symbol:{type:"simple-fill",color:[255,0,0,.8],outline:{color:"red"}}});return this.splitLaneLayer.add(f),k.default.viewGoto(this.view,[f]),{status:0,message:"ok",result:{coordinates:y}}}blockLane(e){const t=this.allLaneGraphics.filter(o=>{var l;let i=String(o.getAttribute("laneId"));return i.startsWith("-")&&(i=i.slice(1)),o.getAttribute("roadId")===e.roadsectId&&((l=o.getAttribute("roadsectBaseIds"))==null?void 0:l.includes(e.roadsectBaseId))&&i===String(e.laneId)}),s=t.map(o=>{const i=o.clone();return console.log(t[0].getAttribute("roadsectBaseIds"),this.selectedSectionIds,this.selectedSectionIds.includes(t[0].getAttribute("roadsectBaseIds"))),i.symbol={type:"simple-fill",color:this.selectedSectionIds.includes(t[0].getAttribute("roadsectBaseIds"))?[255,69,0,.8]:[255,0,0,.8],outline:{color:"red"}},i});this.splitLaneLayer.addMany(s),k.default.viewGoto(this.view,s)}clearSplitLane(){this.splitLaneLayer.removeAll()}selectComputable(e){if(e.type==="roadsectBase"){this.allLaneGraphics.forEach(s=>{s.getAttribute("roadsectBaseIds")||console.log(s.attributes)});const t=this.allLaneGraphics.filter(s=>{var o;return(o=s.getAttribute("roadsectBaseIds"))==null?void 0:o.includes(e.id)});if(t.length>0){const s=L.union(t.map(r=>r.geometry)),o=t[0].getAttribute("roadsectBaseIds"),i=new I({geometry:s,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",roadsectBaseIds:o}});this.sectionLayer.removeAll(),this.sectionLayer.add(i),k.default.viewGoto(this.view,[i]),this.selectedSectionIds=[o];const l=this.splitLaneLayer.graphics.filter(r=>{var a;return(a=r.getAttribute("roadsectBaseIds"))==null?void 0:a.includes(e.id)});l.length>0&&l.forEach(r=>r.symbol={type:"simple-fill",color:[255,69,0],outline:{color:"red",width:2}})}}}updateAllJunctionSymbol(e){const t=this.junctionLayer.graphics.clone();this.junctionLayer.removeAll(),t.forEach(s=>{s.getAttribute("selected")||(s.symbol=this.getCrossGraphicSymbol(s.attributes,e))}),this.junctionLayer.addMany(t.toArray())}getCrossGraphicSymbol(e,t){const s=e.crossId!==""&&e.crossId!==void 0&&e.crossId!==null;if(t==="marker")return{type:"picture-marker",url:`/GisViewerAssets/Images/cross/${s?"gis_xhj_blue":"gis_lkcz_xz"}.png`,width:"32px",height:"32px"};if(t==="picture")return s?{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.crossId',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:s?25:15,haloSize:2,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:32,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz_xz.png",width:"32px",height:"32px"}}}exports.default=C;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("@arcgis/core/Graphic"),J=require("@arcgis/core/core/promiseUtils"),E=require("@arcgis/core/core/reactiveUtils.js"),A=require("@arcgis/core/geometry"),q=require("@arcgis/core/geometry/geometryEngine"),x=require("@arcgis/core/layers/FeatureLayer"),v=require("@arcgis/core/layers/GraphicsLayer"),T=require("@turf/helpers"),O=require("@turf/line-slice-along"),w=require("axios"),_=require("fast-xml-parser"),R=require("md5"),M=require("pako"),z=require("vue"),H=require("../../stores/index.js"),k=require("../common-utils.js");function N(S){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(S){for(const i in S)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(S,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>S[i]})}}return e.default=S,Object.freeze(e)}const P=N(J),U=N(E),L=N(q),B=N(T);class C{constructor(e){this.junctionNames=new Map,this.junctionScale=5e3,this.xodrBorder=[],this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.selectedSectionIds=[],this.currentJunctionId="",this.view=e,this.laneLayer=new x({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"sectionIndex",alias:"路段序号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"},{name:"fromNode",alias:"起点路口",type:"string"},{name:"toNode",alias:"终点路口",type:"string"},{name:"roadsectBaseIds",alias:"基本段编号",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new x({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new v({id:"OpenDriveJunction"}),this.sectionLayer=new v({id:"OpenDriveSection"}),this.highlightLayer=new v({id:"OpenDriveHighlight"}),this.flashLayer=new v({id:"OpenDriveFlash"}),this.drawLayer=new v({id:"Draw"}),this.splitLaneLayer=new v({id:"SplitLane"}),this.borderLayer=new v({id:"OpenDriveBorder"}),this.view.map.addMany([this.laneLayer,this.sectionLayer,this.roadNameLayer,this.junctionLayer,this.highlightLayer,this.flashLayer,this.drawLayer,this.splitLaneLayer,this.borderLayer])}static getInstance(e){return this.instance||(this.instance=new C(e)),this.instance}async makeMd5FromFile(e){var i;try{const o=await(await fetch(e)).text();let r=(i=new _.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(o).OpenDRIVE.userData)==null?void 0:i.border;return r?r=JSON.parse(r):r=[],{status:0,message:"ok",result:{md5:R(o),border:r}}}catch(s){return{status:-1,message:s.message}}}async showOpenDriveFromFile(e){var d,m,u;this.openDriveClickCallback=e.selectedCallback,this.scaleWatch=U.watch(()=>this.view.scale,(h,p)=>{h>this.junctionScale&&p<=this.junctionScale?this.updateAllJunctionSymbol("marker"):h<=this.junctionScale&&p>this.junctionScale&&this.updateAllJunctionSymbol("picture")});let i=e.file.split("/").pop()||"";i=i.split(".").slice(0,-1).join("."),this.openDriveServer=e.server;const s=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await w.post(s,{},{params:{url:e.file,projectName:i}})}catch(h){return{status:-1,message:h.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const t=o.data.result.geoSetting;k.default.setGeoData(t.geoReference,t.offsetX,t.offsetY);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e.server}${l}`);const r=await fetch(l);let a;if(l.endsWith("bin")){const h=await r.arrayBuffer(),p=M.inflate(h,{to:"string"});a=JSON.parse(p)}else a=await r.json();if(await this.showAllLanes(a,((d=e.options)==null?void 0:d.showJunctionLane)||!1,((m=e.options)==null?void 0:m.showRoadName)||!0),((u=e.options)==null?void 0:u.showJunctionPoint)!==!1){const h=o.data.result.junctions;this.showJunction(h)}e.options&&e.options.centerMap!==!1&&await this.view.goTo(this.allLaneGraphics),this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick();const n=H.default.useAppDataStore;return z.watch(()=>n.isSketching,()=>{var h,p;n.isSketching?((h=this.mouseMoveHandler)==null||h.remove(),this.mouseMoveHandler=void 0,(p=this.mouseClickHandler)==null||p.remove(),this.mouseClickHandler=void 0):(this.monitorMouseMove(),this.monitorMouseClick())}),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,i){const s=`http://${e}/api/openDrive/analyzeXodr`,o=await w.get(s,{headers:{projectName:i},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let t=o.data.result.json;t.startsWith(window.location.protocol)||(t=`${window.location.protocol}//${e}${t}`);const l=await fetch(t);let r;if(t.endsWith("bin")){const a=await l.arrayBuffer(),c=M.inflate(a,{to:"string"});r=JSON.parse(c)}else r=await l.json();return await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,i,s){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=s,new Promise(t=>{var c;let l=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const r=[];for(const n of e){if(!i&&n.junction!=="-1")continue;const{id:d,refLine:m}=n;let u=n.name;u.includes("(")&&(u=u.slice(0,u.indexOf("("))),u=u.replace(/(.)/g,"$1 ");const h=new I({geometry:{type:"polyline",paths:[m]},attributes:{ObjectID:l++,roadId:d,roadName:u}});this.allRefLineGraphics.push(h),n.laneSections.sort((p,g)=>Number(p.id)-Number(g.id));for(let p=0;p<n.laneSections.length;p++){const g=n.laneSections[p],y=Number(g.id);for(const f of g.lanePaths){const b=Number(f.id);if(b===0)continue;const $=f.type,F=[...f.outerPath],j=f.innerPath.concat(F.reverse());if(j.length<=3){console.warn(`lane ${b} has less than 3 points`);continue}j.push(f.innerPath[0]);const D=new A.Polygon({rings:[j]});if(D){const G=new I({geometry:D,attributes:{ObjectID:l++,id:`${d}+${y}+${b}`,fromNode:n.fromNode,toNode:n.toNode,roadId:String(d),roadName:n.name,sectionId:String(y),sectionIndex:p,laneId:b,type:$,sumoId:"",leftLine:f.innerPath,rightLine:f.outerPath,roadsectBaseIds:(c=g.roadsectBaseIds)==null?void 0:c.toString()}});this.allLaneGraphics.push(G),r.push(G)}}}}const a=setInterval(()=>{if(r.length>0||this.allRefLineGraphics.length>0){if(r.length>0){const n=r.splice(0,100);this.laneLayer.applyEdits({addFeatures:n})}if(this.allRefLineGraphics.length>0){const n=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:n})}}else clearInterval(a),t()},10)})}showJunction(e){const i=[];let s;this.xodrBorder.length>0&&(s=new A.Polygon({rings:[this.xodrBorder]}));for(const o of e)if(o&&(this.junctionNames.set(o.id,o.name),o.nodeType=o.type,o.crossId)){const t=new A.Point({x:o.coordinates[0],y:o.coordinates[1]});let l=!0;if(s&&(l=L.contains(s,t)),l){const r=new I({geometry:t,attributes:{...o,selected:!1,type:"OpenDriveJunction"},symbol:this.getCrossGraphicSymbol(o,"marker")});i.push(r)}}this.junctionLayer.addMany(i)}monitorMouseMove(){const e=P.debounce(async i=>{var l;const o=(l=(await this.view.hitTest(i,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.filter(r=>r.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId=""),this.view.closePopup();return}const t=o[0];if(this.hitGraphic=t.graphic,t.layer.id==="OpenDriveLane"){const r=`${this.hitGraphic.getAttribute("roadId")}+${this.hitGraphic.getAttribute("sectionId")}`,a=this.hitGraphic.getAttribute("roadsectBaseIds");if(this.currentSectionCode===r||this.selectedSectionIds.includes(a)||this.sectionLayer.graphics.findIndex(y=>y.getAttribute("id")===r)>=0)return;this.currentSectionCode=r;const n=this.allLaneGraphics.filter(y=>`${y.attributes.roadId}+${y.attributes.sectionId}`===r),d=L.union(n.map(y=>y.geometry)),m=this.hitGraphic.getAttribute("fromNode"),u=this.hitGraphic.getAttribute("toNode"),h=this.junctionNames.get(m)||m,p=this.junctionNames.get(u)||u,g=new I({geometry:d,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:r,selected:!1,fromNodeName:h,toNodeName:p,laneCount:n.length,roadsectBaseIds:this.hitGraphic.getAttribute("roadsectBaseIds"),roadId:this.hitGraphic.getAttribute("roadId")},popupTemplate:{title:this.hitGraphic.getAttribute("roadName"),content:[{type:"fields",fieldInfos:[{fieldName:"fromNodeName",label:"起点路口"},{fieldName:"toNodeName",label:"终点路口"},{fieldName:"laneCount",label:"车道数量"}]}]}});this.highlightLayer.removeAll(),this.highlightLayer.add(g)}else if(t.layer.id==="OpenDriveJunction"){const r=this.hitGraphic.getAttribute("id");if(r===this.currentJunctionId)return;this.currentJunctionId=r}});this.mouseMoveHandler=this.view.on("pointer-move",async i=>{e(i).catch(()=>{})})}monitorMouseClick(){const e=P.debounce(async i=>{var a;const o=(a=(await this.view.hitTest(i,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:a.filter(c=>c.type==="graphic");if(o.length===0)return;const t=o[0].graphic,l=t.getAttribute("type"),r=t.getAttribute("id");if(l==="OpenDriveJunction")if(t.getAttribute("selected")===!1){const c=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,n=await w.get(c,{params:{id:r,projectName:this.projectName}});n.status===200&&n.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:n.data.result}),t.setAttribute("selected",!0),t.symbol={type:"picture-marker",url:"/GisViewerAssets/Images/point_red.png",width:"20px",height:"20px"},this.increasePictureMarkerSize(t,50))}else this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:r,details:void 0}),t.setAttribute("selected",!1),t.symbol=this.getCrossGraphicSymbol(t.attributes,this.view.scale<this.junctionScale?"picture":"marker");else l==="OpenDriveSection"&&(t.layer.id==="OpenDriveHighlight"?(this.highlightLayer.removeAll(),this.sectionLayer.removeAll(),this.selectedSectionIds=[],this.sectionLayer.add(t),t.setAttribute("selected",!0),this.selectedSectionIds.push(r),this.splitLaneLayer.graphics.filter(n=>n.getAttribute("roadsectBaseIds")===t.getAttribute("roadsectBaseIds")).forEach(n=>n.symbol={type:"simple-fill",color:[255,69,0],outline:{color:"red",width:2}}),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:t.getAttribute("id"),details:{roadsectId:t.getAttribute("roadId"),roadsectBaseIds:t.getAttribute("roadsectBaseIds")}})):(this.splitLaneLayer.graphics.filter(n=>n.getAttribute("roadsectBaseIds")===t.getAttribute("roadsectBaseIds")).forEach(n=>n.symbol={type:"simple-fill",color:[255,0,0,.8],outline:{color:"red",width:1}}),this.sectionLayer.remove(t),this.selectedSectionIds=[],this.openDriveClickCallback&&this.openDriveClickCallback({type:"CloseOpenDriveSection",id:t.getAttribute("roadsectBaseIds"),details:{roadsectId:t.getAttribute("roadId"),roadsectBaseIds:t.getAttribute("roadsectBaseIds")}})))});this.mouseClickHandler=this.view.on("immediate-click",async i=>{e(i).catch(()=>{})})}increasePictureMarkerSize(e,i){const s=setInterval(()=>{const o=e.symbol,t=o.width;t<i?e.symbol={type:"picture-marker",url:o.url,width:t+1,height:t+1}:clearInterval(s)},20)}decreasePictureMarkerSize(e,i){const s=setInterval(()=>{const o=e.symbol,t=o.width;t>i?e.symbol={type:"picture-marker",url:o.url,width:t-1,height:t-1}:clearInterval(s)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const i=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,s=await w.get(i,{params:{id:e.id,projectName:this.projectName}});return s.status===200?s.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const i=e.id.split("#");let s=i[0];s.startsWith("-")&&(s=s.slice(1));let o=0;i.length===2&&(o=Number(i[1]));const t=this.allLaneGraphics.find(l=>l.getAttribute("roadId")===s&&l.getAttribute("sectionIndex")===o);if(t){const l=`${s}+${t.getAttribute("sectionId")}`,r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await w.get(r,{params:{id:l,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${l}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}setOpendriveVisibility(e){this.laneLayer.visible=e}async clearOpenDrive(){var i,s,o;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.sectionLayer.removeAll(),this.flashLayer.removeAll(),this.borderLayer.removeAll(),(i=this.mouseMoveHandler)==null||i.remove(),this.mouseMoveHandler=void 0,(s=this.mouseClickHandler)==null||s.remove(),this.mouseClickHandler=void 0,(o=this.scaleWatch)==null||o.remove(),this.scaleWatch=void 0}async findSumo(e){const{type:i,id:s}=e,o=e.flash===void 0?!0:e.flash;if(i==="junction")return await this.findJunction(s,o);if(i==="edge"){const t=s.split("_");if(t.length>2)return{status:-1,message:"id格式错误"};const l=t.length===2?Number(t[1]):void 0,r=t[0].split("#");if(r.length>2)return{status:-1,message:"id格式错误"};const a=r[0],c=r.length===2?Number(r[1]):void 0;return await this.findLane({roadsectId:a,segmentId:c,laneId:l,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,i){const s=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!s)return{status:-1,message:"未找到。请检查路口编号"};if(i){const o=new I({geometry:s.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[0,255,255,.8],outline:{color:[0,255,255],width:1}}});this.flashGraphic(o)}return await this.view.goTo(s.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:i,segmentId:s,laneId:o}=e;i.startsWith("-")&&(i=i.slice(1));let t=this.allLaneGraphics.filter(a=>a.attributes.roadId===i);if(t.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(s!==void 0){const a=[];if(t.forEach(c=>{const n=Number(c.attributes.sectionId);a.indexOf(n)===-1&&a.push(n)}),a.sort((c,n)=>c-n),s>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};s=a[s],t=t.filter(c=>Number(c.attributes.sectionId)===s)}if(o!==void 0){const a=[];if(t.forEach(c=>{const n=Number(c.attributes.laneId);a.indexOf(n)===-1&&a.push(n)}),a.sort((c,n)=>c-n),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],t=t.filter(c=>Number(c.attributes.laneId)===o)}const l=t.map(a=>a.geometry),r=L.union(l);if(e.flash){const a=new I({geometry:r,symbol:{type:"simple-fill",color:[0,255,255,.6],style:"solid",outline:{width:0}}});this.flashGraphic(a)}return await this.view.goTo(r,{duration:1e3}),{status:0,message:"ok"}}flashGraphic(e){this.flashLayer.removeAll(),this.flashLayer.add(e);let i=0,s=!0;const o=setInterval(()=>{s?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(s=!1,i++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(s=!0)),i>=5&&(this.flashLayer.removeAll(),this.flashLayer.opacity=1,clearInterval(o))},10)}unselectSumo(e){if(e?e.type==="junction"&&this.junctionLayer.graphics.forEach(i=>{(!e||!e.id||e.id===""||e.id===i.getAttribute("id"))&&i.getAttribute("selected")&&(i.setAttribute("selected",!1),i.symbol=this.getCrossGraphicSymbol(i.attributes,this.view.scale<this.junctionScale?"picture":"marker"))}):(this.highlightLayer.removeAll(),this.sectionLayer.removeAll(),this.selectedSectionIds=[],this.splitLaneLayer.removeAll()),!e||e.type==="edge"){let i;!e||!e.id||e.id===""?i=this.sectionLayer.graphics.toArray():i=this.sectionLayer.graphics.filter(s=>s.getAttribute("edgeId")===e.id).toArray(),i.length>0&&(i.forEach(s=>{const o=s.getAttribute("id");this.selectedSectionIds=this.selectedSectionIds.filter(t=>t!==o)}),this.sectionLayer.removeMany(i))}return{status:0,message:"ok"}}async selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(i=>{if(e.id===i.getAttribute("id"))return i.setAttribute("selected",!0),i.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(i,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const i=e.id.split("#");let s=String(i[0]);s.startsWith("-")&&(s=s.slice(1));let o=0;i.length===2&&(o=Number(i[1]));let t=[];if(i.length===1?t=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===s):i.length===2&&(t=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===s&&l.getAttribute("sectionIndex")===o)),t.length>0){const l=new Map;return t.forEach(r=>{const a=r.getAttribute("roadId")+"+"+r.getAttribute("sectionId");this.selectedSectionIds.includes(a)||this.selectedSectionIds.push(a);let c=l.get(a);c?c.push(r.geometry):(c=[r.geometry],l.set(a,c))}),l.forEach(async(r,a)=>{const c=L.union(r),n=new I({geometry:c,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:a,edgeId:e.id,selected:!0}});this.sectionLayer.add(n),await this.view.goTo(n)}),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async geometrySearch(e){const i=new A.Polygon({rings:[e]}),s=await this.laneLayer.queryFeatures({geometry:i,outFields:["*"]}),o=[],t=[];for(const a of s.features){const c=a.getAttribute("roadId"),n=a.getAttribute("sectionIndex"),d=`${c}#${n}`;if(o.indexOf(d)===-1){o.push(d),this.selectSumo({type:"edge",id:d});const m=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,u=await w.get(m,{params:{id:`${c}+${a.getAttribute("sectionId")}`,projectName:this.projectName}});u.status===200&&u.data.status===0&&t.push(u.data.result)}}const l=this.junctionLayer.graphics.filter(a=>{const c=a.geometry;return L.contains(i,c)}),r=[];for(const a of l){const c=a.getAttribute("id");this.selectSumo({type:"junction",id:c});const n=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,d=await w.get(n,{params:{id:c,projectName:this.projectName}});d.status===200&&d.data.status===0&&r.push(d.data.result)}return{status:0,message:"ok",result:{junctions:r,edges:t}}}async splitLane(e){const s=e.id.split("_");if(s.length!==2)return{status:-1,message:"车道编号格式错误"};const o=Number(s[1]),t=s[0].split("#"),l=t.length===2?Number(t[1]):0;let r=t[0];r.startsWith("-")&&(r=r.slice(1));const a=this.allLaneGraphics.filter(b=>b.getAttribute("roadId")===r&&b.getAttribute("sectionIndex")===l);if(a.length===0)return{status:-1,message:"未找到路段"};const c=a.length-o,n=a.find(b=>Math.abs(b.getAttribute("laneId"))===c);if(!n)return{status:-1,message:"未找到车道"};const d=e.start||0,m=e.end||100,u=B.lineString(n.getAttribute("leftLine")),h=O.lineSliceAlong(u,d,m,{units:"meters"}),p=B.lineString(n.getAttribute("rightLine")),g=O.lineSliceAlong(p,d,m,{units:"meters"}),y=h.geometry.coordinates.concat(g.geometry.coordinates.reverse());y.push(y[y.length-1]);const f=new I({geometry:new A.Polygon({rings:[y]}),attributes:{ObjectID:n.getAttribute("ObjectID"),id:n.getAttribute("id"),fromNode:n.getAttribute("fromNode"),toNode:n.getAttribute("toNode"),roadId:n.getAttribute("roadId"),roadName:n.getAttribute("roadName"),sectionId:n.getAttribute("sectionId"),sectionIndex:n.getAttribute("sectionIndex"),laneId:n.getAttribute("laneId"),type:n.getAttribute("type"),sumoId:n.getAttribute("sumoId"),leftLine:h.geometry.coordinates,rightLine:g.geometry.coordinates},symbol:{type:"simple-fill",color:[255,0,0,.8],outline:{color:"red"}}});return this.splitLaneLayer.add(f),k.default.viewGoto(this.view,[f]),{status:0,message:"ok",result:{coordinates:y}}}clearSplitLane(){this.splitLaneLayer.removeAll()}blockLane(e){const i=this.allLaneGraphics.filter(o=>{var l;let t=String(o.getAttribute("laneId"));return t.startsWith("-")&&(t=t.slice(1)),o.getAttribute("roadId")===e.roadsectId&&((l=o.getAttribute("roadsectBaseIds"))==null?void 0:l.includes(e.roadsectBaseId))&&t===String(e.laneId)}),s=i.map(o=>{const t=o.clone();return t.symbol={type:"simple-fill",color:this.selectedSectionIds.includes(i[0].getAttribute("roadsectBaseIds"))?[255,69,0,.8]:[255,0,0,.8],outline:{color:"red"}},t});this.splitLaneLayer.addMany(s),k.default.viewGoto(this.view,s)}clearBlockLane(e){const i=this.splitLaneLayer.graphics.filter(s=>{const o=s.getAttribute("roadId"),t=s.getAttribute("roadsectBaseIds");let l=String(s.getAttribute("laneId"));return l.startsWith("-")&&(l=l.slice(1)),o===e.roadsectId&&(t==null?void 0:t.includes(e.roadsectBaseId))&&l===String(e.laneId)});this.splitLaneLayer.removeMany(i.toArray())}selectComputable(e){if(e.type==="roadsectBase"){const i=this.allLaneGraphics.filter(s=>{var o;return(o=s.getAttribute("roadsectBaseIds"))==null?void 0:o.includes(e.id)});if(i.length>0){const s=L.union(i.map(r=>r.geometry)),o=i[0].getAttribute("roadsectBaseIds"),t=new I({geometry:s,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",roadsectBaseIds:o}});this.sectionLayer.removeAll(),this.sectionLayer.add(t),k.default.viewGoto(this.view,[t]),this.selectedSectionIds=[o];const l=this.splitLaneLayer.graphics.filter(r=>{var a;return(a=r.getAttribute("roadsectBaseIds"))==null?void 0:a.includes(e.id)});l.length>0&&l.forEach(r=>r.symbol={type:"simple-fill",color:[255,69,0],outline:{color:"red",width:2}})}}}updateAllJunctionSymbol(e){const i=this.junctionLayer.graphics.clone();this.junctionLayer.removeAll(),i.forEach(s=>{s.getAttribute("selected")||(s.symbol=this.getCrossGraphicSymbol(s.attributes,e))}),this.junctionLayer.addMany(i.toArray())}getCrossGraphicSymbol(e,i){const s=e.crossId!==""&&e.crossId!==void 0&&e.crossId!==null;if(i==="marker")return{type:"picture-marker",url:`/GisViewerAssets/Images/cross/${s?"gis_xhj_blue":"gis_lkcz_xz"}.png`,width:"32px",height:"32px"};if(i==="picture")return s?{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.crossId',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:s?25:15,haloSize:2,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:32,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz_xz.png",width:"32px",height:"32px"}}}exports.default=C;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/geometry"),h=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class f{constructor(e){this.crossGraphicSymbol={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:18,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:20,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}},this.locations=[],this.clusteredLocations=[],this.filteredLocations=[],this.currentShowMode="scatter",this.symbolScale=5e3,this.oldScale=0,this.clusterRadius=120,this.minClusterPoints=2,this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.view=e,this.crossLayer=new p,this.view.map.add(this.crossLayer),this.oldScale=e.scale}async addCrosses(e){e.forEach(t=>{t.signals.forEach(r=>{r.longitude&&r.latitude&&!isNaN(r.longitude)&&!isNaN(r.latitude)&&this.locations.push({id:r.id,x:r.longitude,y:r.latitude,visited:!1,filtered:!1,clusterId:void 0,properties:{...r,districtId:t.id,subDistrictId:""}})}),t.subDistricts.forEach(r=>{r.signals.forEach(s=>{s.longitude&&s.latitude&&!isNaN(s.longitude)&&!isNaN(s.latitude)&&this.locations.push({id:s.id,x:s.longitude,y:s.latitude,visited:!1,filtered:!1,clusterId:void 0,properties:{...s,districtId:t.id,subDistrictId:r.id}})})})}),this.zoomWatchHandle=this.view.watch("stationary",()=>{if(this.view.stationary!==!1){if(this.currentShowMode==="scatter")(this.oldScale<this.symbolScale&&this.view.scale>=this.symbolScale||this.oldScale>=this.symbolScale&&this.view.scale<this.symbolScale)&&this.updateScatterSymbol(),this.oldScale=this.view.scale;else if(this.currentShowMode==="cluster"){this.locationToScreen(),console.time("cluster");const t=this.doPixelCluster(this.clusterRadius);console.timeEnd("cluster"),this.showClusterResult(t)}}})}clearCrosses(){var e;console.log("Clearing crosses"),this.crossLayer.removeAll(),this.locations=[],this.clusteredLocations=[],(e=this.zoomWatchHandle)==null||e.remove()}updateScatterSymbol(){this.crossLayer.graphics.forEach(e=>{e.symbol=this.getCrossSymbol(e.attributes)})}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(e=>{const t=this.view.toScreen(new y.Point({x:e.x,y:e.y}));e.filtered===!1&&t.x>0&&t.y>0&&(e.properties.screenX=t.x,e.properties.screenY=t.y,e.visited=!1,e.clusterId=void 0,this.clusteredLocations.push(e))})}showCluster(){this.crossLayer.removeAll(),this.currentShowMode="cluster",this.locationToScreen();const e=this.doPixelCluster(this.clusterRadius);this.showClusterResult(e)}showScatter(){this.crossLayer.removeAll(),this.currentShowMode="scatter";const e=[];this.locations.forEach(t=>{if(!t.filtered){const r=new h({geometry:{type:"point",longitude:t.x,latitude:t.y},symbol:this.getCrossSymbol(t.properties),attributes:t.properties});e.push(r)}}),this.crossLayer.addMany(e)}hideCrosses(){this.crossLayer.removeAll()}filter(e){this.locations.forEach(t=>{if(e.type==="district")t.filtered=t.properties.districtId===e.id;else if(e.type==="subDistrict")t.filtered=t.properties.subDistrictId===e.id;else if(e.type==="signal"&&(t.filtered=t.id===e.id,t.filtered))return t.properties})}resetFilter(){this.locations.forEach(e=>{e.filtered=!1})}getCrossSymbol(e){if(this.view.scale>this.symbolScale)return e.isKey?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"20px",height:"20px"}:{type:"simple-marker",style:"circle",color:[5,116,255,.8],size:8,outline:{color:"white",width:0}};{const t=e.isKey?"/GisViewerAssets/Images/cross/gis_gjxklk_orange.png":"/GisViewerAssets/Images/cross/gis_xhj_blue.png";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: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:20,rotateClockwise:!0,textureFilter:"Picture",url:t}]}}}}}getNeighbors(e,t){return this.clusteredLocations.filter(r=>r.id===e.id||r.visited?!1:this.getDistance(e,r)<=t)}getDistance(e,t){return Math.sqrt(Math.pow(e.properties.screenX-t.properties.screenX,2)+Math.pow(e.properties.screenY-t.properties.screenY,2))}createClusters(){const e={},t=[];for(const s of this.clusteredLocations)s.clusterId===void 0||s.clusterId===-1?t.push(s):(e[s.clusterId]||(e[s.clusterId]=[]),e[s.clusterId].push(s));const r=Object.keys(e).map((s,i)=>{const o=e[Number(s)],c=o.length,l=o.reduce((n,u)=>n+u.x,0),a=o.reduce((n,u)=>n+u.y,0),m=l/c,d=a/c;return{id:Number(s),items:o,count:c,center:{x:m,y:d}}});return t.length>0&&r.push({id:-1,items:t,count:t.length,center:null}),r}doPixelCluster(e){let t=0;for(let r=0;r<this.clusteredLocations.length;r++){const s=this.clusteredLocations[r];if(s.visited)continue;s.visited=!0;const i=this.getNeighbors(s,e);i.length<this.minClusterPoints?s.clusterId=-1:(i.forEach(o=>{o.visited=!0,o.clusterId=t}),s.clusterId=t,t++)}return this.createClusters()}showClusterResult(e){this.crossLayer.removeAll();let t=Number.MIN_VALUE,r=Number.MAX_VALUE;e.forEach(s=>{s.count>1&&(r=Math.min(r,s.count),t=Math.max(t,s.count))}),e.forEach(s=>{if(s.id!==-1){let i=r===t?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(s.count-r)/(t-r)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);i*=.75;const l=(s.count.toString().length*8+6)/2,a=new h({geometry:new y.Point({x:s.center.x,y:s.center.y}),attributes:{count:s.count},symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:i,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-l,40],[l,40],[l,20],[-l,20],[-l,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]}]}},{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:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:i,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}});this.crossLayer.add(a)}else s.items.forEach(i=>{const o=new h({geometry:new y.Point({x:i.x,y:i.y}),attributes:{...i,...i.properties,type:"clusterPoint",id:i.id},symbol:this.crossGraphicSymbol});this.crossLayer.add(o)})})}}exports.default=f;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class f{constructor(e){this.crossGraphicSymbol={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:18,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:20,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}},this.locations=[],this.clusteredLocations=[],this.filteredLocations=[],this.currentShowMode="scatter",this.symbolScale=5e3,this.oldScale=0,this.clusterRadius=120,this.minClusterPoints=2,this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.view=e,this.crossLayer=new p,this.view.map.add(this.crossLayer),this.oldScale=e.scale}async addCrosses(e){e.forEach(t=>{t.signals.forEach(i=>{i.longitude&&i.latitude&&!isNaN(i.longitude)&&!isNaN(i.latitude)&&this.locations.push({id:i.id,x:i.longitude,y:i.latitude,visited:!1,filtered:!1,clusterId:void 0,properties:{...i,districtId:t.id,districtName:t.name,subDistrictId:"",subDistrictName:""}})}),t.subDistricts.forEach(i=>{i.signals.forEach(s=>{s.longitude&&s.latitude&&!isNaN(s.longitude)&&!isNaN(s.latitude)&&this.locations.push({id:s.id,x:s.longitude,y:s.latitude,visited:!1,filtered:!1,clusterId:void 0,properties:{...s,districtId:t.id,districtName:t.name,subDistrictId:i.id,subDistrictName:i.name}})})})}),this.zoomWatchHandle=this.view.watch("stationary",()=>{if(this.view.stationary!==!1){if(this.currentShowMode==="scatter")(this.oldScale<this.symbolScale&&this.view.scale>=this.symbolScale||this.oldScale>=this.symbolScale&&this.view.scale<this.symbolScale)&&this.updateScatterSymbol(),this.oldScale=this.view.scale;else if(this.currentShowMode==="cluster"){this.locationToScreen(),console.time("cluster");const t=this.doPixelCluster(this.clusterRadius);console.timeEnd("cluster"),this.showClusterResult(t)}}})}clearCrosses(){var e;this.crossLayer.removeAll(),this.locations=[],this.clusteredLocations=[],(e=this.zoomWatchHandle)==null||e.remove()}updateScatterSymbol(){this.crossLayer.graphics.forEach(e=>{e.symbol=this.getCrossSymbol(e.attributes)})}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(e=>{const t=this.view.toScreen(new h.Point({x:e.x,y:e.y}));e.filtered===!1&&t.x>0&&t.y>0&&(e.properties.screenX=t.x,e.properties.screenY=t.y,e.visited=!1,e.clusterId=void 0,this.clusteredLocations.push(e))})}showCluster(){this.crossLayer.removeAll(),this.currentShowMode="cluster",this.locationToScreen();const e=this.doPixelCluster(this.clusterRadius);this.showClusterResult(e)}showScatter(){this.crossLayer.removeAll(),this.currentShowMode="scatter";const e=[];this.locations.forEach(t=>{if(!t.filtered){const i=new y({geometry:{type:"point",longitude:t.x,latitude:t.y},symbol:this.getCrossSymbol(t.properties),attributes:t.properties,popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"},{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"}]}]}});e.push(i)}}),this.crossLayer.addMany(e)}hideCrosses(){this.crossLayer.removeAll()}filter(e){this.locations.forEach(t=>{if(e.type==="district")t.filtered=t.properties.districtId!==e.id;else if(e.type==="subDistrict")t.filtered=t.properties.subDistrictId!==e.id;else if(e.type==="signal"&&(t.filtered=t.id!==e.id,t.filtered))return t.properties})}resetFilter(){this.locations.forEach(e=>{e.filtered=!1}),this.currentShowMode==="scatter"?this.showScatter():this.currentShowMode==="cluster"&&this.showCluster()}getCrossSymbol(e){if(this.view.scale>this.symbolScale)return e.isKey?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"20px",height:"20px"}:{type:"simple-marker",style:"circle",color:[5,116,255,.8],size:8,outline:{color:"white",width:0}};{const t=e.isKey?"/GisViewerAssets/Images/cross/gis_gjxklk_orange.png":"/GisViewerAssets/Images/cross/gis_xhj_blue.png";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: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:20,rotateClockwise:!0,textureFilter:"Picture",url:t}]}}}}}getNeighbors(e,t){return this.clusteredLocations.filter(i=>i.id===e.id||i.visited?!1:this.getDistance(e,i)<=t)}getDistance(e,t){return Math.sqrt(Math.pow(e.properties.screenX-t.properties.screenX,2)+Math.pow(e.properties.screenY-t.properties.screenY,2))}createClusters(){const e={},t=[];for(const s of this.clusteredLocations)s.clusterId===void 0||s.clusterId===-1?t.push(s):(e[s.clusterId]||(e[s.clusterId]=[]),e[s.clusterId].push(s));const i=Object.keys(e).map((s,r)=>{const o=e[Number(s)],a=o.length,l=o.reduce((n,u)=>n+u.x,0),c=o.reduce((n,u)=>n+u.y,0),m=l/a,d=c/a;return{id:Number(s),items:o,count:a,center:{x:m,y:d}}});return t.length>0&&i.push({id:-1,items:t,count:t.length,center:null}),i}doPixelCluster(e){let t=0;for(let i=0;i<this.clusteredLocations.length;i++){const s=this.clusteredLocations[i];if(s.visited)continue;s.visited=!0;const r=this.getNeighbors(s,e);r.length<this.minClusterPoints?s.clusterId=-1:(r.forEach(o=>{o.visited=!0,o.clusterId=t}),s.clusterId=t,t++)}return this.createClusters()}showClusterResult(e){this.crossLayer.removeAll();let t=Number.MIN_VALUE,i=Number.MAX_VALUE;e.forEach(s=>{s.count>1&&(i=Math.min(i,s.count),t=Math.max(t,s.count))}),e.forEach(s=>{if(s.id!==-1){let r=i===t?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(s.count-i)/(t-i)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const l=(s.count.toString().length*8+6)/2,c=new y({geometry:new h.Point({x:s.center.x,y:s.center.y}),attributes:{count:s.count},symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:r,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-l,40],[l,40],[l,20],[-l,20],[-l,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]}]}},{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:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}});this.crossLayer.add(c)}else s.items.forEach(r=>{const o=new y({geometry:new h.Point({x:r.x,y:r.y}),attributes:{...r,...r.properties,type:"clusterPoint",id:r.id},symbol:this.crossGraphicSymbol,popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"},{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"}]}]}});this.crossLayer.add(o)})})}}exports.default=f;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * 信控区域
3
+ */
1
4
  import { IFindSignalControlAreaParams, ILayerVisibleParams, IResult, IShowSignalControlAreaParams } from '../../../types';
2
5
  export default class SignalControlAreaController1 {
3
6
  private view;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("../../stores/index.js"),a=require("./cross-renderer.js"),r=require("./district-controller.js"),l=require("./district-renderer.js"),o=require("./signal-renderer.js"),d=require("./sub-district-renderer.js");class u{constructor(e){this.view=e;const t=c.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.districtRenderer=new l.default(e),this.subDistrictRenderer=new d.default(e),this.signalRenderer=new o.default(e),this.crossRenderer=new a.default(e)}async showSignalControlArea(e){await this.clearSignalControlArea(),this.districtRenderer.setVisible(!1),this.subDistrictRenderer.setVisible(!1),this.signalRenderer.setClusterVisible(!1),this.signalRenderer.setPointVisible(!1);const t=[],s=[];for(const i of e.areaList){const n=new r.default(i,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),this.crossRenderer.addCrosses(t),{status:0,message:"ok"}}async showDistrict(e){this.setLayerVisibility({id:"district",visible:!0}),this.setLayerVisibility({id:"subDistrict",visible:!0});const t=new r.default(e.areaList,e.style||"");await this.districtRenderer.showDistricts([t]),await this.subDistrictRenderer.showSubDistricts(t.subDistricts),await this.subDistrictRenderer.showRoads({id:t.id,type:"district"})}async showSubDistrict(e){this.setLayerVisibility({id:"subDistrict",visible:!0});const t=new r.default(e.areaList,e.style||"");await this.subDistrictRenderer.showSubDistricts([t]),await this.subDistrictRenderer.showRoads({id:t.id,type:"subDistrict"})}async clearSignalControlArea(){return this.crossRenderer.clearCrosses(),await this.districtRenderer.clearDistricts(),await this.subDistrictRenderer.clearSubDistricts(),this.crossRenderer.clearCrosses(),{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":e.visible===!1?this.crossRenderer.hideCrosses():this.crossRenderer.showScatter();break;case"signalCluster":e.visible===!1?this.crossRenderer.hideCrosses():this.crossRenderer.showCluster();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)?(this.subDistrictRenderer.filter(e),this.crossRenderer.filter(e),await this.subDistrictRenderer.showRoads(e),{status:0,message:"ok"}):{status:1,message:"未找到区控"};case"subDistrict":{const{count:t,parentId:s}=await this.subDistrictRenderer.highlightSubDistrict(e);return t>0?(this.districtRenderer.filter(s),this.crossRenderer.filter(e),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}case"signal":{const{districtId:t,subDistrictId:s,count:i}=await this.signalRenderer.highlightSignal(e.id);return i>0?(this.districtRenderer.filter(t),this.subDistrictRenderer.filter(e),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){return this.districtRenderer.resetFilter(),this.subDistrictRenderer.resetFilter(),this.crossRenderer.resetFilter(),{status:0,message:"ok"}}}exports.default=u;
@@ -0,0 +1,24 @@
1
+ import { IResult, IShowSignalCrossParams } from 'packages/components/src/types';
2
+ /**
3
+ * 信控路口
4
+ */
5
+ export default class SignalCrossController {
6
+ private view;
7
+ private crossLayer;
8
+ private readonly symbolScale;
9
+ private scaleWatchHandle;
10
+ private showName;
11
+ private showStyle;
12
+ constructor(view: __esri.MapView | __esri.SceneView);
13
+ /**
14
+ * 显示信控路口
15
+ * @param params
16
+ * @returns
17
+ */
18
+ showSignalCross(params: IShowSignalCrossParams): IResult;
19
+ clearSignalCross(): void;
20
+ private getBrandLabel;
21
+ private getOnlineLabel;
22
+ private getMalfunctionLabel;
23
+ private getCrossSymbol;
24
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/GraphicsLayer");class c{constructor(e){this.symbolScale=6e3,this.showName="signalId",this.showStyle="scatter",this.view=e,this.crossLayer=new n({id:"signal-control-cross-layer",title:"信控路口图层"}),this.view.map.add(this.crossLayer)}showSignalCross(e){if(this.crossLayer.removeAll(),this.showName=e.showName||"signalId",this.showStyle=e.style||"scatter",this.scaleWatchHandle||(this.scaleWatchHandle=this.view.watch("scale",(t,i)=>{(t<=this.symbolScale&&i>this.symbolScale||t>this.symbolScale&&i<=this.symbolScale)&&this.crossLayer.graphics.forEach(l=>{const s=l.attributes;l.symbol=this.getCrossSymbol(s)})})),this.showStyle==="scatter"){const t=e.points.map(i=>{const l=this.getCrossSymbol(i),s=this.getBrandLabel(i.brand),a=this.getOnlineLabel(i.isOnline),r=this.getMalfunctionLabel(i.isMalfunction);return new o({geometry:{type:"point",longitude:i.x,latitude:i.y},symbol:l,attributes:{type:"signal-cross",id:i.crossId,brandLabel:s,isOnlineLabel:a,isMalfunctionLabel:r,...i},popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"signalId",label:"信号机编号"},{fieldName:"crossId",label:"路口编号"},{fieldName:"brandLabel",label:"品牌"},{fieldName:"isOnlineLabel",label:"是否在线"},{fieldName:"isMalfunctionLabel",label:"是否故障"}]}]}})});this.crossLayer.addMany(t)}return{status:0,message:"ok"}}clearSignalCross(){var e;this.crossLayer.removeAll(),(e=this.scaleWatchHandle)==null||e.remove(),this.scaleWatchHandle=null}getBrandLabel(e){const t=(e??"").toLowerCase();return t==="scats"?"SCATS":t==="gc"?"国产":e??""}getOnlineLabel(e){return e?"在线":"离线"}getMalfunctionLabel(e){return e?"故障":"正常"}getCrossSymbol(e){if(this.view.scale<=this.symbolScale){let t="/GisViewerAssets/Images/cross/ic_";return t+=e.brand==="scats"?"scats_":"gc_",t+=e.isOnline?"online_":"offline_",t+=e.isMalfunction?"malfunction.png":"normal.png",{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:this.showName==="signalId"?'Replace($feature.name, "与", "/") + " " + $feature.signalId':'Replace($feature.name, "与", "/") + " " + $feature.crossId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:25,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:20,rotateClockwise:!0,textureFilter:"Picture",url:t}]}}}}else{const t={type:"simple-marker",style:"circle",size:6,outline:{width:0}};return e.brand.toLowerCase()==="scats"?(e.isOnline?t.color=[23,169,100]:t.color=[202,202,202],t.outline.color=[23,169,100]):e.isOnline?t.color=[33,240,142]:t.color=[202,202,202],t}}}exports.default=c;
@@ -309,6 +309,21 @@ export interface IShowSignalControlAreaParams {
309
309
  areaList: any[];
310
310
  style?: string;
311
311
  }
312
+ export interface ISignalCross {
313
+ signalId: string;
314
+ crossId: string;
315
+ name: string;
316
+ brand: string;
317
+ isOnline: boolean;
318
+ isMalfunction: boolean;
319
+ x: number;
320
+ y: number;
321
+ }
322
+ export interface IShowSignalCrossParams {
323
+ style: string;
324
+ showName: string;
325
+ points: ISignalCross[];
326
+ }
312
327
  export interface IDistrictRoad {
313
328
  id: string;
314
329
  coordinates: number[][];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.265",
3
+ "version": "1.0.267",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../stores/index.js"),c=require("./cross-renderer.js"),r=require("./district-controller.js"),l=require("./district-renderer.js"),d=require("./signal-renderer.js"),o=require("./sub-district-renderer.js");class u{constructor(t){this.view=t;const e=a.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(e.mapConfig)),this.districtRenderer=new l.default(t),this.subDistrictRenderer=new o.default(t),this.signalRenderer=new d.default(t),this.crossRenderer=new c.default(t)}async showSignalControlArea(t){await this.clearSignalControlArea(),this.districtRenderer.setVisible(!1),this.subDistrictRenderer.setVisible(!1),this.signalRenderer.setClusterVisible(!1),this.signalRenderer.setPointVisible(!1);const e=[],s=[];for(const i of t.areaList){const n=new r.default(i,t.style||"");e.push(n),s.push(...n.subDistricts)}return this.districtRenderer.style=t.style||"",await this.districtRenderer.showDistricts(e),await this.subDistrictRenderer.showSubDistricts(s),await this.signalRenderer.showSignals(e),{status:0,message:"ok"}}async showDistrict(t){this.setLayerVisibility({id:"district",visible:!0}),this.setLayerVisibility({id:"subDistrict",visible:!0});const e=new r.default(t.areaList,t.style||"");await this.districtRenderer.showDistricts([e]),await this.subDistrictRenderer.showSubDistricts(e.subDistricts),await this.subDistrictRenderer.showRoads({id:e.id,type:"district"})}async showSubDistrict(t){this.setLayerVisibility({id:"subDistrict",visible:!0});const e=new r.default(t.areaList,t.style||"");await this.subDistrictRenderer.showSubDistricts([e]),await this.subDistrictRenderer.showRoads({id:e.id,type:"subDistrict"})}async clearSignalControlArea(){return this.crossRenderer.clearCrosses(),await this.districtRenderer.clearDistricts(),await this.subDistrictRenderer.clearSubDistricts(),await this.signalRenderer.clearSignals(),{status:0,message:"ok"}}setLayerVisibility(t){switch(t.visible===!1&&this.view.closePopup(),t.id){case"district":this.districtRenderer.setVisible(t.visible);break;case"subDistrict":this.subDistrictRenderer.setVisible(t.visible);break;case"signal":t.visible===!1?this.crossRenderer.hideCrosses():this.crossRenderer.showScatter();break;case"signalCluster":t.visible===!1?this.crossRenderer.hideCrosses():this.crossRenderer.showCluster();break}return{status:0,message:"ok"}}async locateSignalControlArea(t){switch(t.type){case"district":return await this.districtRenderer.locateDistrict(t.id);case"subDistrict":return await this.subDistrictRenderer.locateSubDistrict(t.id);case"signal":return await this.signalRenderer.locateSignal(t.id);default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(t){switch(this.view.closePopup(),t.type){case"district":return await this.districtRenderer.highlightDistrict(t)?(this.subDistrictRenderer.filter(t),this.signalRenderer.filter(t),await this.subDistrictRenderer.showRoads(t),{status:0,message:"ok"}):{status:1,message:"未找到区控"};case"subDistrict":{const{count:e,parentId:s}=await this.subDistrictRenderer.highlightSubDistrict(t);return e>0?(this.districtRenderer.filter(s),this.signalRenderer.filter(t),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}case"signal":{const{districtId:e,subDistrictId:s,count:i}=await this.signalRenderer.highlightSignal(t.id);return i>0?(this.districtRenderer.filter(e),this.subDistrictRenderer.filter(t),{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"}}}exports.default=u;