gisviewer-vue3-arcgis 1.0.259 → 1.0.262

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("vue"),T=require("./stores/index.js");require("./style/index.css");const ct=require("./utils/dbscan-cluster/index.js"),lt=require("./utils/detect-gpu.js"),ut=require("./utils/edpass-device-controller.js"),x=require("./utils/green-wave-band-controller/index.js"),dt=require("./utils/holo-flow/index.js"),mt=require("./utils/holo-flow/signal-countdown-panel.vue.js"),pt=require("./utils/map-initializer.js"),P=require("./utils/open-drive-renderer/index.js"),z=require("./utils/overlay.js"),gt=require("./utils/police-jurisdiction.js"),ft=require("./utils/queue-length.js"),E=require("./utils/road-config-tool/index.js"),yt=require("./utils/signal-control-area/edit-area.js"),q=require("./utils/signal-control-area/show-area.js"),wt=require("./utils/traffic-flow.js"),vt={class:"gis-viewer"},St={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},ht=s.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(N,{expose:H,emit:G}){const C=s.ref(null);let n,p,l,i,r,o,f,t,u,a,g,w,b,y;const A=s.ref(!1);T.registerStore();const V=T.default.useAppDataStore,_=s.reactive([]),B=e=>Math.log2(591657527591555e-6/e);let v=null,I=null;const O=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==I&&(I=d,S("update:zoom",d))};lt.default(),s.onMounted(async()=>{if(!C.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(A.value=!A.value)});const e=s.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(M.config)).json();c.assetsRoot=M.assetsRoot||d,V.mapConfig=c,p=new pt.default,V.mapInitializer=p,n=await p.initialize({container:C.value,mapConfig:c,markerClickCallback:(m,D,L,it)=>{S("markerClick",m,D,L,it)},mapClickCallback:(m,D,L)=>{S("mapClick",m,D,L)}});const h=n.zoom??(n.scale?B(n.scale):void 0);typeof h=="number"&&O(h);const ot=n.zoom!==void 0?n.watch("zoom",m=>{O(m)}):n.watch("scale",m=>{typeof m=="number"&&m>0&&O(B(m))});v=()=>ot.remove(),r=new dt.default(n,_),await r.init(),S("mapLoaded")}),s.onUnmounted(()=>{a==null||a.clearSignalControlArea(),t==null||t.clearOpenDrive(),r.clearHoloTrace(),r.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),v==null||v(),v=null});const Z=s.computed(()=>n),W=()=>{const e=T.default.useAppDataStore;e.saveTrackLog=!0},j=()=>{r.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(n)),l.showLaneNumber(e)),ne=()=>{l==null||l.clearLaneNumber()},ae=async e=>(l||(l=new E.default(n)),await l.initializeSearch(e)),re=async()=>l==null?void 0:l.calCrossIndicatorArea(),se=async()=>{},oe=async(e,d)=>{i||(i=new wt.default(n)),i.connectTrafficFlow(e,d)},ie=()=>{i==null||i.disconnectTrafficFlow()},ce=async e=>{r.handleVehicleTraceData(e)},le=()=>{r.clearHoloTrace()},ue=e=>{r.setInterpolate(e)},de=async e=>{await r.handleSignalData(e)},me=async e=>{await r.initializeLampGroup(e)},pe=e=>{r.handleUniSignalData(e)},ge=()=>{r.clearHoloSignal()},fe=e=>{i==null||i.toggleTrafficInfo(e),r==null||r.toggleTrafficInfo(e)},ye=e=>{r==null||r.togglePause(e)},we=e=>{i==null||i.toggleTrafficObject(e),r==null||r.toggleTrafficObject(e)},k=e=>{r==null||r.updatePanelContent(e)},ve=async e=>(o||(o=new z.default(n)),o.addOverlays(e)),Se=async e=>(y||(y=new ct.default(n)),y.addClusterPoints(e)),he=()=>{y==null||y.removeAllClusterPoints()},Ce=e=>(o||(o=new z.default(n)),o.addMask(e)),be=()=>{o==null||o.removeMask()},Ae=e=>o==null?void 0:o.removeOverlaysByType(e),Oe=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 ft.default(n)),f.updateQueueLength(e)},Te=()=>{f==null||f.removeQueueLength()},qe=async(e,d)=>(t||(t=new P.default(n)),await t.showOpenDriveFromServer(e,d)),Ve=async e=>(t||(t=new P.default(n)),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?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Ee=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Ne=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},He=async e=>(a||(a=new q.default(n)),await a.showSignalControlArea(e)),Ge=async e=>(a||(a=new q.default(n)),await a.showDistrict(e)),Ze=async e=>(a||(a=new q.default(n)),await a.showSubDistrict(e)),We=async()=>await(a==null?void 0:a.clearSignalControlArea()),je=e=>a==null?void 0:a.setLayerVisibility(e),Je=async e=>a?await(a==null?void 0:a.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Qe=async e=>a?await a.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Ue=()=>a?a.resetHighlight():{status:-1,message:"未加载信号控制区"},Ke=e=>(u||(u=new yt.default(n)),u.showSubSignalControlArea(e)),Fe=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Xe=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},Ye=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Re=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},$e=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},et=e=>(g||(g=new x.default(n)),g.addGreenWaveBand(e)),tt=()=>{if(!g)return{status:-1,message:"未加载绿波带"};g.stopAddGreenWaveBand()},nt=async e=>(g||(g=new x.default(n)),await g.showGreenWaveBand(e)),at=async e=>(w||(w=new gt.default(n)),await w.showJurisdiction(e)),rt=()=>{if(!w)return{status:-1,message:"未加载警务管辖区"};w.clearJurisdiction()},st=async e=>(b||(b=new ut.default(n)),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:Ae,removeOverlaysById:Oe,removeAllOverlays:ke,showLaneNumber:te,clearLaneNumber:ne,initializeAreaTool:ae,calCrossIndicatorArea:re,calRoadIndicatorArea:se,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:Pe,findSumoInOpenDrive:Ie,selectSumoInOpenDrive:Me,unselectSumoInOpenDrive:xe,getSumoInfo:ze,splitOpenDriveLane:Ee,clearSplitOpenDriveLane:Ne,showSignalControlArea:He,showDistrictArea:Ge,showSubDistrictArea:Ze,clearSignalControlArea:We,setSignalControlAreaVisibility:je,locateSignalControlArea:Je,highlightSignalControlArea:Qe,resetHighlightSignalControlArea:Ue,showSubSignalControlArea:Ke,editSubSignalControlArea:Fe,stopEditSubSignalControlArea:Xe,selectSubSignalControlAreaCross:Ye,unselectSubSignalControlAreaCross:Re,changeSubSignalControlAreaBorderVisibility:$e,addGreenWaveBand:et,stopAddGreenWaveBand:tt,showGreenWaveBand:nt,showPoliceArea:at,clearPoliceArea:rt,setEdpassLayerVisibility:st}),(e,d)=>(s.openBlock(),s.createElementBlock("div",vt,[s.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:C},[s.withDirectives(s.createElementVNode("div",St,[s.createElementVNode("button",{style:{"margin-right":"10px"},onClick:W}," 开始记录 "),s.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 下载日志 "),s.createElementVNode("button",{style:{"margin-right":"10px"},onClick:J}," 显示车辆id "),s.createElementVNode("button",{onClick:Q},"显示车辆号牌")],512),[[s.vShow,A.value]])],512),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(_,(c,h)=>(s.openBlock(),s.createBlock(mt.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=ht;
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 ut=require("./utils/dbscan-cluster/index.js"),dt=require("./utils/detect-gpu.js"),mt=require("./utils/edpass-device-controller.js"),x=require("./utils/green-wave-band-controller/index.js"),pt=require("./utils/holo-flow/index.js"),gt=require("./utils/holo-flow/signal-countdown-panel.vue.js"),ft=require("./utils/map-initializer.js"),P=require("./utils/open-drive-renderer/index.js"),z=require("./utils/overlay.js"),yt=require("./utils/police-jurisdiction.js"),wt=require("./utils/queue-length.js"),E=require("./utils/road-config-tool/index.js"),vt=require("./utils/signal-control-area/edit-area.js"),q=require("./utils/signal-control-area/show-area.js"),St=require("./utils/traffic-flow.js"),ht={class:"gis-viewer"},Ct={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},bt=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))};dt.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 ft.default,V.mapInitializer=p,a=await p.initialize({container:C.value,mapConfig:c,markerClickCallback:(m,D,L,lt)=>{S("markerClick",m,D,L,lt)},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 ct=a.zoom!==void 0?a.watch("zoom",m=>{A(m)}):a.watch("scale",m=>{typeof m=="number"&&m>0&&A(B(m))});v=()=>ct.remove(),s=new pt.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 St.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 ut.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 wt.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?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Ee=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Ne=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},He=async e=>t?t==null?void 0:t.blockOpenDriveLane(e):{status:-1,message:"未加载OpenDrive地图"},Ge=()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ze=async e=>(n||(n=new q.default(a)),await n.showSignalControlArea(e)),We=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)),Je=async()=>await(n==null?void 0:n.clearSignalControlArea()),Qe=e=>n==null?void 0:n.setLayerVisibility(e),Ue=async e=>n?await(n==null?void 0:n.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Ke=async e=>n?await n.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Fe=()=>n?n.resetHighlight():{status:-1,message:"未加载信号控制区"},Xe=e=>(u||(u=new vt.default(a)),u.showSubSignalControlArea(e)),Ye=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Re=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},$e=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},et=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},tt=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},at=e=>(g||(g=new x.default(a)),g.addGreenWaveBand(e)),nt=()=>{if(!g)return{status:-1,message:"未加载绿波带"};g.stopAddGreenWaveBand()},st=async e=>(g||(g=new x.default(a)),await g.showGreenWaveBand(e)),rt=async e=>(w||(w=new yt.default(a)),await w.showJurisdiction(e)),ot=()=>{if(!w)return{status:-1,message:"未加载警务管辖区"};w.clearJurisdiction()},it=async e=>(b||(b=new mt.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:Pe,findSumoInOpenDrive:Ie,selectSumoInOpenDrive:Me,unselectSumoInOpenDrive:xe,getSumoInfo:ze,splitOpenDriveLane:Ee,clearSplitOpenDriveLane:Ne,blockOpenDriveLane:He,clearBlockOpenDriveLane:Ge,showSignalControlArea:Ze,showDistrictArea:We,showSubDistrictArea:je,clearSignalControlArea:Je,setSignalControlAreaVisibility:Qe,locateSignalControlArea:Ue,highlightSignalControlArea:Ke,resetHighlightSignalControlArea:Fe,showSubSignalControlArea:Xe,editSubSignalControlArea:Ye,stopEditSubSignalControlArea:Re,selectSubSignalControlAreaCross:$e,unselectSubSignalControlAreaCross:et,changeSubSignalControlAreaBorderVisibility:tt,addGreenWaveBand:at,stopAddGreenWaveBand:nt,showGreenWaveBand:st,showPoliceArea:rt,clearPoliceArea:ot,setEdpassLayerVisibility:it}),(e,d)=>(r.openBlock(),r.createElementBlock("div",ht,[r.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:C},[r.withDirectives(r.createElementVNode("div",Ct,[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(gt.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=bt;
@@ -126,6 +126,14 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
126
126
  status: number;
127
127
  message: string;
128
128
  }>;
129
+ blockOpenDriveLane: (params: import("../types").IBlockOpenDriveLaneParams) => Promise<void | {
130
+ status: number;
131
+ message: string;
132
+ }>;
133
+ clearBlockOpenDriveLane: () => void | {
134
+ status: number;
135
+ message: string;
136
+ };
129
137
  showSignalControlArea: (params: import("../types").IShowSignalControlAreaParams) => Promise<import("../types").IResult>;
130
138
  showDistrictArea: (params: import("../types").IShowSignalControlAreaParams) => Promise<void>;
131
139
  showSubDistrictArea: (params: import("../types").IShowSignalControlAreaParams) => Promise<void>;
@@ -0,0 +1,68 @@
1
+ import Graphic from '@arcgis/core/Graphic';
2
+ import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer';
3
+ import MapView from '@arcgis/core/views/MapView';
4
+ import SceneView from '@arcgis/core/views/SceneView';
5
+ interface GreenWaveLineOptions {
6
+ viewer: MapView | SceneView;
7
+ graphicsLayerOptions: {
8
+ id: string;
9
+ };
10
+ }
11
+ interface roadPath {
12
+ paths: [number, number][];
13
+ symbol: any;
14
+ attributes: any;
15
+ visible?: boolean;
16
+ }
17
+ interface animationOptions {
18
+ isAnimation: boolean;
19
+ positive?: boolean;
20
+ positiveColor?: number[];
21
+ negative?: boolean;
22
+ negativeColor?: number[];
23
+ }
24
+ export default class GreenWaveLine {
25
+ private viewer;
26
+ overlayLayer: GraphicsLayer;
27
+ customGreenWaveLineView: any;
28
+ material: THREE.ShaderMaterial;
29
+ renderer: THREE.WebGLRenderer;
30
+ threeScene: THREE.Scene;
31
+ camera: THREE.PerspectiveCamera;
32
+ private defaultAnimationOptions;
33
+ constructor(options: GreenWaveLineOptions);
34
+ addGreenWaveLine(paths: roadPath[], options?: animationOptions): void;
35
+ getAnimationPath(paths: [number, number][], options?: animationOptions): any;
36
+ createLine(paths: any, symbol: any, attributes: any, visible: boolean): Graphic;
37
+ addPointText(points: any[]): void;
38
+ createPointText(point: any, symbol: any, attributes: any, visible: boolean): Graphic;
39
+ /**
40
+ * 隐藏覆盖物
41
+ *
42
+ * @param {string[]} [ids]
43
+ * @memberof GreenWaveLine
44
+ */
45
+ hideWaveLine(ids?: string[]): void;
46
+ /**
47
+ * 显示覆盖物
48
+ *
49
+ * @param {string[]} [ids]
50
+ * @memberof GreenWaveLine
51
+ */
52
+ showWaveLine(ids?: string[]): void;
53
+ /**
54
+ * 隐藏图层
55
+ *
56
+ * @memberof GreenWaveLine
57
+ */
58
+ hideLayer(): void;
59
+ /**
60
+ * 显示图层
61
+ *
62
+ * @memberof Overlay
63
+ */
64
+ showLayer(): void;
65
+ clearGreenWaveLine(): void;
66
+ destroy(): void;
67
+ }
68
+ export {};
@@ -9,6 +9,7 @@ export default class DbscanCluster {
9
9
  constructor(view: __esri.MapView | __esri.SceneView);
10
10
  private zoomWatchHandle;
11
11
  private locations;
12
+ private clusteredLocations;
12
13
  private clusterMarkUrl;
13
14
  private currentZoom;
14
15
  /**
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils"),m=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),C=require("@arcgis/core/layers/GraphicsLayer");function g(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const r in c)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(c,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>c[r]})}}return t.default=c,Object.freeze(t)}const x=g(b);class S{constructor(t){this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusterRadius=120,this.minClusterPoints=2,this.zoomWatchHandle=null,this.locations=[],this.clusterMarkUrl="",this.currentZoom=0,this.view=t,this.currentZoom=t.zoom,this.clusterLayer=new C,this.view.map.add(this.clusterLayer)}locationToScreen(){this.locations.forEach(t=>{const r=this.view.toScreen(new m.Point({x:t.x,y:t.y}));t.properties.screenX=r.x,t.properties.screenY=r.y})}addClusterPoints(t){var s;this.locations=t.points,this.clusterMarkUrl=((s=t.clusterSymbol)==null?void 0:s.url)||"/GisViewerAssets/Images/cross/gis_xhj_blue.png",this.locations=this.locations.filter(e=>e.x!==null&&e.y!==null&&!isNaN(e.x)&&!isNaN(e.y)),this.locations.forEach(e=>{e.x=Number(e.x),e.y=Number(e.y),e.symbol||(e.symbol=t.pointSymbol||{type:"simple-marker",style:"circle",color:"#3388ff",size:8,outline:{color:"#ffffff",width:1}})}),this.zoomWatchHandle||(this.zoomWatchHandle=x.watch(()=>this.view.zoom,()=>{if(Math.abs(this.currentZoom-this.view.zoom)>=1){this.currentZoom=this.view.zoom,this.locationToScreen(),console.time("cluster");const e=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);console.timeEnd("cluster"),this.showClusters(e)}})),this.locationToScreen();const r=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);this.showClusters(r)}removeAllClusterPoints(){var t;(t=this.zoomWatchHandle)==null||t.remove(),this.zoomWatchHandle=null,this.clusterLayer.removeAll()}showClusters(t){this.clusterLayer.removeAll();let r=Number.MIN_VALUE,s=Number.MAX_VALUE;t.forEach(e=>{e.count>1&&(s=Math.min(s,e.count),r=Math.max(r,e.count))}),t.forEach(e=>{if(e.id!==-1){let i=s===r?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(e.count-s)/(r-s)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);i*=.75;const l=(e.count.toString().length*8+6)/2,u=new y({geometry:new m.Point({x:e.center.x,y:e.center.y}),attributes:{count:e.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:this.clusterMarkUrl}]}}}});this.clusterLayer.add(u)}else e.items.forEach(i=>{const o=new y({geometry:new m.Point({x:i.x,y:i.y}),attributes:{...i,...i.properties,type:"clusterPoint",id:i.id},symbol:i.symbol});this.clusterLayer.add(o)})})}getNeighbors(t,r){return this.locations.filter(s=>s.id===t.id||s.visited?!1:this.getDistance(t,s)<=r)}getDistance(t,r){return Math.sqrt(Math.pow(t.properties.screenX-r.properties.screenX,2)+Math.pow(t.properties.screenY-r.properties.screenY,2))}createClusters(t){const r={},s=[];for(let i=0;i<t.length;i++){const o=t[i];o.clusterId===void 0||o.clusterId===-1?s.push(o):(r[o.clusterId]||(r[o.clusterId]=[]),r[o.clusterId].push(o))}const e=Object.keys(r).map((i,o)=>{const n=r[Number(i)],l=n.length,u=n.reduce((a,h)=>a+h.x,0),d=n.reduce((a,h)=>a+h.y,0),f=u/l,p=d/l;return{id:Number(i),items:n,count:l,center:{x:f,y:p}}});return s.length>0&&e.push({id:-1,items:s,count:s.length,center:null}),e}doPixelCluster(t,r){let s=0;this.locations.forEach(e=>{e.visited=!1,e.clusterId=void 0});for(let e=0;e<this.locations.length;e++){const i=this.locations[e];if(i.visited)continue;i.visited=!0;const o=this.getNeighbors(i,t);o.length<r?i.clusterId=-1:(o.forEach(n=>{n.visited=!0,n.clusterId=s}),i.clusterId=s,s++)}return this.createClusters(this.locations)}}exports.default=S;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@arcgis/core/geometry"),m=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class b{constructor(t){this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusterRadius=120,this.minClusterPoints=2,this.zoomWatchHandle=null,this.locations=[],this.clusteredLocations=[],this.clusterMarkUrl="",this.currentZoom=0,this.view=t,this.currentZoom=t.zoom,this.clusterLayer=new p,this.view.map.add(this.clusterLayer)}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(t=>{const s=this.view.toScreen(new h.Point({x:t.x,y:t.y}));s.x>0&&s.y>0&&(t.properties.screenX=s.x,t.properties.screenY=s.y,t.visited=!1,t.clusterId=void 0,this.clusteredLocations.push(t))})}addClusterPoints(t){var r;this.locations=t.points,this.clusterMarkUrl=((r=t.clusterSymbol)==null?void 0:r.url)||"/GisViewerAssets/Images/cross/gis_xhj_blue.png",this.locations=this.locations.filter(e=>e.x!==null&&e.y!==null&&!isNaN(e.x)&&!isNaN(e.y)),this.locations.forEach(e=>{e.x=Number(e.x),e.y=Number(e.y),e.symbol||(e.symbol=t.pointSymbol||{type:"simple-marker",style:"circle",color:"#3388ff",size:8,outline:{color:"#ffffff",width:1}})}),this.zoomWatchHandle||(this.zoomWatchHandle=this.view.watch("stationary",()=>{if(Math.abs(this.currentZoom-this.view.zoom)>=1){this.currentZoom=this.view.zoom,this.locationToScreen(),console.time("cluster");const e=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);console.timeEnd("cluster"),this.showClusters(e)}})),this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);this.showClusters(s)}removeAllClusterPoints(){var t;(t=this.zoomWatchHandle)==null||t.remove(),this.zoomWatchHandle=null,this.clusterLayer.removeAll()}showClusters(t){this.clusterLayer.removeAll();let s=Number.MIN_VALUE,r=Number.MAX_VALUE;t.forEach(e=>{e.count>1&&(r=Math.min(r,e.count),s=Math.max(s,e.count))}),t.forEach(e=>{if(e.id!==-1){let i=r===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(e.count-r)/(s-r)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);i*=.75;const n=(e.count.toString().length*8+6)/2,c=new m({geometry:new h.Point({x:e.center.x,y:e.center.y}),attributes:{count:e.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:[[[-n,40],[n,40],[n,20],[-n,20],[-n,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:this.clusterMarkUrl}]}}}});this.clusterLayer.add(c)}else e.items.forEach(i=>{const o=new m({geometry:new h.Point({x:i.x,y:i.y}),attributes:{...i,...i.properties,type:"clusterPoint",id:i.id},symbol:i.symbol});this.clusterLayer.add(o)})})}getNeighbors(t,s){return this.clusteredLocations.filter(r=>r.id===t.id||r.visited?!1:this.getDistance(t,r)<=s)}getDistance(t,s){return Math.sqrt(Math.pow(t.properties.screenX-s.properties.screenX,2)+Math.pow(t.properties.screenY-s.properties.screenY,2))}createClusters(){const t={},s=[];for(const e of this.clusteredLocations)e.clusterId===void 0||e.clusterId===-1?s.push(e):(t[e.clusterId]||(t[e.clusterId]=[]),t[e.clusterId].push(e));const r=Object.keys(t).map((e,i)=>{const o=t[Number(e)],l=o.length,n=o.reduce((u,a)=>u+a.x,0),c=o.reduce((u,a)=>u+a.y,0),y=n/l,d=c/l;return{id:Number(e),items:o,count:l,center:{x:y,y:d}}});return s.length>0&&r.push({id:-1,items:s,count:s.length,center:null}),r}doPixelCluster(t,s){let r=0;for(let e=0;e<this.clusteredLocations.length;e++){const i=this.clusteredLocations[e];if(i.visited)continue;i.visited=!0;const o=this.getNeighbors(i,t);o.length<s?i.clusterId=-1:(o.forEach(l=>{l.visited=!0,l.clusterId=r}),i.clusterId=r,r++)}return this.createClusters()}}exports.default=b;
@@ -1,4 +1,4 @@
1
- import { IFindSumoParams, IResult, IShowOpenDriveFromFileParams, ISplitOpenDriveLaneParams, IUnselectSumoParams } from '../../../types';
1
+ import { IBlockOpenDriveLaneParams, IFindSumoParams, IResult, IShowOpenDriveFromFileParams, ISplitOpenDriveLaneParams, IUnselectSumoParams } from '../../../types';
2
2
  export default class OpenDriveRenderer {
3
3
  private static instance;
4
4
  static getInstance(view: __esri.MapView | __esri.SceneView): OpenDriveRenderer;
@@ -113,6 +113,7 @@ export default class OpenDriveRenderer {
113
113
  selectSumo(params: IFindSumoParams): Promise<IResult>;
114
114
  geometrySearch(coordinate: number[][]): Promise<IResult>;
115
115
  splitLane(params: ISplitOpenDriveLaneParams): Promise<IResult>;
116
+ blockOpenDriveLane(params: IBlockOpenDriveLaneParams): void;
116
117
  clearSplitLane(): void;
117
118
  /**
118
119
  * 更新所有路口的symbol
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/Graphic"),F=require("@arcgis/core/core/promiseUtils"),J=require("@arcgis/core/core/reactiveUtils.js"),S=require("@arcgis/core/geometry"),q=require("@arcgis/core/geometry/geometryEngine"),x=require("@arcgis/core/layers/FeatureLayer"),w=require("@arcgis/core/layers/GraphicsLayer"),E=require("@turf/helpers"),G=require("@turf/line-slice-along"),b=require("axios"),R=require("fast-xml-parser"),T=require("md5"),O=require("pako"),_=require("vue"),z=require("../../stores/index.js"),H=require("../common-utils.js");function N(L){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(L){for(const t in L)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(L,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>L[t]})}}return e.default=L,Object.freeze(e)}const M=N(F),U=N(J),A=N(q),P=N(E);class D{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"}],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 w({id:"OpenDriveJunction"}),this.sectionLayer=new w({id:"OpenDriveSection"}),this.highlightLayer=new w({id:"OpenDriveHighlight"}),this.flashLayer=new w({id:"OpenDriveFlash"}),this.drawLayer=new w({id:"Draw"}),this.splitLaneLayer=new w({id:"SplitLane"}),this.borderLayer=new w({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 D(e)),this.instance}async makeMd5FromFile(e){var t;try{const o=await(await fetch(e)).text();let n=(t=new R.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(o).OpenDRIVE.userData)==null?void 0:t.border;return n?n=JSON.parse(n):n=[],{status:0,message:"ok",result:{md5:T(o),border:n}}}catch(i){return{status:-1,message:i.message}}}async showOpenDriveFromFile(e){var y,m,g;this.openDriveClickCallback=e.selectedCallback,this.scaleWatch=U.watch(()=>this.view.scale,(u,h)=>{u>this.junctionScale&&h<=this.junctionScale?this.updateAllJunctionSymbol("marker"):u<=this.junctionScale&&h>this.junctionScale&&this.updateAllJunctionSymbol("picture")});let t=e.file.split("/").pop()||"";t=t.split(".").slice(0,-1).join("."),console.log(`OpenDriveRenderer: 显示OpenDrive文件 ${t}`),this.openDriveServer=e.server;const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await b.post(i,{},{params:{url:e.file,projectName:t}})}catch(u){return{status:-1,message:u.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;H.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let c=o.data.result.json;c.startsWith(window.location.protocol)||(c=`${window.location.protocol}//${e.server}${c}`);const a=await(await fetch(c)).arrayBuffer(),r=O.inflate(a,{to:"string"}),l=JSON.parse(r);if(await this.showAllLanes(l,((y=e.options)==null?void 0:y.showJunctionLane)||!1,((m=e.options)==null?void 0:m.showRoadName)||!0),((g=e.options)==null?void 0:g.showJunctionPoint)!==!1){const u=o.data.result.junctions;this.showJunction(u)}e.options&&e.options.centerMap!==!1&&await this.view.goTo(this.allLaneGraphics),this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick();const p=z.default.useAppDataStore;return _.watch(()=>p.isSketching,()=>{var u,h;p.isSketching?((u=this.mouseMoveHandler)==null||u.remove(),this.mouseMoveHandler=void 0,(h=this.mouseClickHandler)==null||h.remove(),this.mouseClickHandler=void 0):(this.monitorMouseMove(),this.monitorMouseClick())}),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await b.get(i,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let s=o.data.result.json;s.startsWith(window.location.protocol)||(s=`${window.location.protocol}//${e}${s}`);const n=await(await fetch(s)).arrayBuffer(),a=O.inflate(n,{to:"string"}),r=JSON.parse(a);return console.log(r),await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){console.log(e);const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=i,new Promise(s=>{let c=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const r of e){if(!t&&r.junction!=="-1")continue;const{id:l,refLine:d}=r;let p=r.name;p.includes("(")&&(p=p.slice(0,p.indexOf("("))),p=p.replace(/(.)/g,"$1 ");const y=new f({geometry:{type:"polyline",paths:[d]},attributes:{ObjectID:c++,roadId:l,roadName:p}});this.allRefLineGraphics.push(y),r.laneSections.sort((m,g)=>Number(m.id)-Number(g.id));for(let m=0;m<r.laneSections.length;m++){const g=r.laneSections[m],u=Number(g.id);for(const h of g.lanePaths){const v=Number(h.id);if(v===0)continue;const I=h.type,$=[...h.outerPath],j=h.innerPath.concat($.reverse());if(j.length<=3){console.warn(`lane ${v} has less than 3 points`);continue}j.push(h.innerPath[0]);const k=new S.Polygon({rings:[j]});if(k){const C=new f({geometry:k,attributes:{ObjectID:c++,id:`${l}+${u}+${v}`,fromNode:r.fromNode,toNode:r.toNode,roadId:String(l),roadName:r.name,sectionId:String(u),sectionIndex:m,laneId:v,type:I,sumoId:"",leftLine:h.innerPath,rightLine:h.outerPath}});this.allLaneGraphics.push(C),n.push(C)}}}}const a=setInterval(()=>{if(n.length>0||this.allRefLineGraphics.length>0){if(n.length>0){const r=n.splice(0,100);this.laneLayer.applyEdits({addFeatures:r})}if(this.allRefLineGraphics.length>0){const r=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:r})}}else clearInterval(a),s()},10)})}showJunction(e){const t=[];let i;this.xodrBorder.length>0&&(i=new S.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 s=new S.Point({x:o.coordinates[0],y:o.coordinates[1]});let c=!0;if(i&&(c=A.contains(i,s)),c){const n=new f({geometry:s,attributes:{...o,selected:!1,type:"OpenDriveJunction"},symbol:this.getCrossGraphicSymbol(o,"marker")});t.push(n)}}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=M.debounce(async t=>{var c;const o=(c=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:c.filter(n=>n.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId=""),this.view.closePopup();return}const s=o[0];if(this.hitGraphic=s.graphic,s.layer.id==="OpenDriveLane"){const n=`${this.hitGraphic.getAttribute("roadId")}+${this.hitGraphic.getAttribute("sectionId")}`;if(this.currentSectionCode===n||this.selectedSectionIds.includes(n)||this.sectionLayer.graphics.findIndex(u=>u.getAttribute("id")===n)>=0)return;this.currentSectionCode=n;const r=this.allLaneGraphics.filter(u=>`${u.attributes.roadId}+${u.attributes.sectionId}`===n),l=A.union(r.map(u=>u.geometry)),d=this.hitGraphic.getAttribute("fromNode"),p=this.hitGraphic.getAttribute("toNode"),y=this.junctionNames.get(d)||d,m=this.junctionNames.get(p)||p,g=new f({geometry:l,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:n,selected:!1,fromNodeName:y,toNodeName:m,laneCount:r.length},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(s.layer.id==="OpenDriveJunction"){const n=this.hitGraphic.getAttribute("id");if(n===this.currentJunctionId)return;this.currentJunctionId=n}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=M.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(r=>r.type==="graphic");if(o.length===0)return;const s=o[0].graphic,c=s.getAttribute("type"),n=s.getAttribute("id");if(c==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const r=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,l=await b.get(r,{params:{id:n,projectName:this.projectName}});l.status===200&&l.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:l.data.result}),s.setAttribute("selected",!0),s.symbol={type:"picture-marker",url:"/GisViewerAssets/Images/point_red.png",width:"20px",height:"20px"},this.increasePictureMarkerSize(s,50))}else this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:void 0}),s.setAttribute("selected",!1),s.symbol=this.getCrossGraphicSymbol(s.attributes,this.view.scale<this.junctionScale?"picture":"marker");else if(c==="OpenDriveSection")if(s.layer.id==="OpenDriveHighlight"){this.highlightLayer.remove(s),this.sectionLayer.add(s),s.setAttribute("selected",!0),this.selectedSectionIds.push(n);const r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,l=await b.get(r,{params:{id:n,projectName:this.projectName}});if(l.status===200&&l.data.status===0&&this.openDriveClickCallback){const d=l.data.result.obj_id;s.setAttribute("edgeId",d),this.openDriveClickCallback({type:"OpenDriveSection",id:d,details:l.data.result})}}else this.sectionLayer.remove(s),this.selectedSectionIds=this.selectedSectionIds.filter(r=>r!==n),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:s.getAttribute("edgeId"),details:void 0})});this.mouseClickHandler=this.view.on("immediate-click",async t=>{e(t).catch(()=>{})})}increasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s<t?e.symbol={type:"picture-marker",url:o.url,width:s+1,height:s+1}:clearInterval(i)},20)}decreasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s>t?e.symbol={type:"picture-marker",url:o.url,width:s-1,height:s-1}:clearInterval(i)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const t=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,i=await b.get(t,{params:{id:e.id,projectName:this.projectName}});return i.status===200?i.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.find(c=>c.getAttribute("roadId")===i&&c.getAttribute("sectionIndex")===o);if(s){const c=`${i}+${s.getAttribute("sectionId")}`,n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await b.get(n,{params:{id:c,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${c}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}setOpendriveVisibility(e){this.laneLayer.visible=e}async clearOpenDrive(){var t,i,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,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=void 0,(o=this.scaleWatch)==null||o.remove(),this.scaleWatch=void 0}async findSumo(e){const{type:t,id:i}=e,o=e.flash===void 0?!0:e.flash;if(t==="junction")return await this.findJunction(i,o);if(t==="edge"){const s=i.split("_");if(s.length>2)return{status:-1,message:"id格式错误"};const c=s.length===2?Number(s[1]):void 0,n=s[0].split("#");if(n.length>2)return{status:-1,message:"id格式错误"};const a=n[0],r=n.length===2?Number(n[1]):void 0;return await this.findLane({roadsectId:a,segmentId:r,laneId:c,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,t){const i=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!i)return{status:-1,message:"未找到。请检查路口编号"};if(t){const o=new f({geometry:i.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(i.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:t,segmentId:i,laneId:o}=e;t.startsWith("-")&&(t=t.slice(1));let s=this.allLaneGraphics.filter(a=>a.attributes.roadId===t);if(s.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(i!==void 0){const a=[];if(s.forEach(r=>{const l=Number(r.attributes.sectionId);a.indexOf(l)===-1&&a.push(l)}),a.sort((r,l)=>r-l),i>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};i=a[i],s=s.filter(r=>Number(r.attributes.sectionId)===i)}if(o!==void 0){const a=[];if(s.forEach(r=>{const l=Number(r.attributes.laneId);a.indexOf(l)===-1&&a.push(l)}),a.sort((r,l)=>r-l),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],s=s.filter(r=>Number(r.attributes.laneId)===o)}const c=s.map(a=>a.geometry),n=A.union(c);if(e.flash){const a=new f({geometry:n,symbol:{type:"simple-fill",color:[0,255,255,.6],style:"solid",outline:{width:0}}});this.flashGraphic(a)}return await this.view.goTo(n,{duration:1e3}),{status:0,message:"ok"}}flashGraphic(e){this.flashLayer.removeAll(),this.flashLayer.add(e);let t=0,i=!0;const o=setInterval(()=>{i?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(i=!1,t++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(i=!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"))}),!e||e.type==="edge"){let t;!e||!e.id||e.id===""?t=this.sectionLayer.graphics.toArray():t=this.sectionLayer.graphics.filter(i=>i.getAttribute("edgeId")===e.id).toArray(),t.length>0&&(t.forEach(i=>{const o=i.getAttribute("id");this.selectedSectionIds=this.selectedSectionIds.filter(s=>s!==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 i=String(t[0]);i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));let s=[];if(t.length===1?s=this.allLaneGraphics.filter(c=>c.getAttribute("roadId")===i):t.length===2&&(s=this.allLaneGraphics.filter(c=>c.getAttribute("roadId")===i&&c.getAttribute("sectionIndex")===o)),s.length>0){const c=new Map;return s.forEach(n=>{const a=n.getAttribute("roadId")+"+"+n.getAttribute("sectionId");this.selectedSectionIds.includes(a)||this.selectedSectionIds.push(a);let r=c.get(a);r?r.push(n.geometry):(r=[n.geometry],c.set(a,r))}),c.forEach(async(n,a)=>{const r=A.union(n),l=new f({geometry:r,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(l),await this.view.goTo(l)}),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async geometrySearch(e){const t=new S.Polygon({rings:[e]}),i=await this.laneLayer.queryFeatures({geometry:t,outFields:["*"]}),o=[],s=[];for(const a of i.features){const r=a.getAttribute("roadId"),l=a.getAttribute("sectionIndex"),d=`${r}#${l}`;if(o.indexOf(d)===-1){o.push(d),this.selectSumo({type:"edge",id:d});const p=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,y=await b.get(p,{params:{id:`${r}+${a.getAttribute("sectionId")}`,projectName:this.projectName}});y.status===200&&y.data.status===0&&s.push(y.data.result)}}const c=this.junctionLayer.graphics.filter(a=>{const r=a.geometry;return A.contains(t,r)}),n=[];for(const a of c){const r=a.getAttribute("id");this.selectSumo({type:"junction",id:r});const l=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,d=await b.get(l,{params:{id:r,projectName:this.projectName}});d.status===200&&d.data.status===0&&n.push(d.data.result)}return{status:0,message:"ok",result:{junctions:n,edges:s}}}async splitLane(e){const i=e.id.split("_");if(i.length!==2)return{status:-1,message:"车道编号格式错误"};const o=Number(i[1]),s=i[0].split("#"),c=s.length===2?Number(s[1]):0;let n=s[0];n.startsWith("-")&&(n=n.slice(1));const a=this.allLaneGraphics.filter(I=>I.getAttribute("roadId")===n&&I.getAttribute("sectionIndex")===c);if(a.length===0)return{status:-1,message:"未找到路段"};const r=a.length-o,l=a.find(I=>Math.abs(I.getAttribute("laneId"))===r);if(!l)return{status:-1,message:"未找到车道"};const d=e.start||0,p=e.end||100,y=P.lineString(l.getAttribute("leftLine")),m=G.lineSliceAlong(y,d,p,{units:"meters"}),g=P.lineString(l.getAttribute("rightLine")),u=G.lineSliceAlong(g,d,p,{units:"meters"}),h=m.geometry.coordinates.concat(u.geometry.coordinates.reverse());h.push(h[h.length-1]);const v=new f({geometry:new S.Polygon({rings:[h]}),attributes:{ObjectID:l.getAttribute("ObjectID"),id:l.getAttribute("id"),fromNode:l.getAttribute("fromNode"),toNode:l.getAttribute("toNode"),roadId:l.getAttribute("roadId"),roadName:l.getAttribute("roadName"),sectionId:l.getAttribute("sectionId"),sectionIndex:l.getAttribute("sectionIndex"),laneId:l.getAttribute("laneId"),type:l.getAttribute("type"),sumoId:l.getAttribute("sumoId"),leftLine:m.geometry.coordinates,rightLine:u.geometry.coordinates},symbol:{type:"simple-fill",color:[255,0,0,.8],outline:{color:"red"}}});return this.splitLaneLayer.add(v),this.view.goTo(v),{status:0,message:"ok",result:{coordinates:h}}}clearSplitLane(){this.splitLaneLayer.removeAll()}updateAllJunctionSymbol(e){const t=this.junctionLayer.graphics.clone();this.junctionLayer.removeAll(),t.forEach(i=>{i.getAttribute("selected")||(i.symbol=this.getCrossGraphicSymbol(i.attributes,e))}),this.junctionLayer.addMany(t.toArray())}getCrossGraphicSymbol(e,t){const i=e.crossId!==""&&e.crossId!==void 0&&e.crossId!==null;if(t==="marker")return{type:"picture-marker",url:`/GisViewerAssets/Images/cross/${i?"gis_xhj_blue":"gis_lkcz_xz"}.png`,width:"32px",height:"32px"};if(t==="picture")return i?{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:i?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=D;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("@arcgis/core/Graphic"),E=require("@arcgis/core/core/promiseUtils"),q=require("@arcgis/core/core/reactiveUtils.js"),S=require("@arcgis/core/geometry"),B=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(L){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(L){for(const t in L)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(L,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>L[t]})}}return e.default=L,Object.freeze(e)}const P=N(E),U=N(q),A=N(B),$=N(T);class D{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 D(e)),this.instance}async makeMd5FromFile(e){var t;try{const o=await(await fetch(e)).text();let n=(t=new _.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(o).OpenDRIVE.userData)==null?void 0:t.border;return n?n=JSON.parse(n):n=[],{status:0,message:"ok",result:{md5:R(o),border:n}}}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 c=o.data.result.json;c.startsWith(window.location.protocol)||(c=`${window.location.protocol}//${e.server}${c}`);const n=await fetch(c);let a;if(c.endsWith("bin")){const h=await n.arrayBuffer(),p=M.inflate(h,{to:"string"});a=JSON.parse(p)}else a=await n.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 r=H.default.useAppDataStore;return z.watch(()=>r.isSketching,()=>{var h,p;r.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 c=await fetch(i);let n;if(i.endsWith("bin")){const a=await c.arrayBuffer(),l=M.inflate(a,{to:"string"});n=JSON.parse(l)}else n=await c.json();return await this.showAllLanes(n,!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 l;let c=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const r of e){if(!t&&r.junction!=="-1")continue;const{id:d,refLine:m}=r;let u=r.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:c++,roadId:d,roadName:u}});this.allRefLineGraphics.push(h),r.laneSections.sort((p,y)=>Number(p.id)-Number(y.id));for(let p=0;p<r.laneSections.length;p++){const y=r.laneSections[p],b=Number(y.id);for(const g of y.lanePaths){const f=Number(g.id);if(f===0)continue;const F=g.type,J=[...g.outerPath],j=g.innerPath.concat(J.reverse());if(j.length<=3){console.warn(`lane ${f} has less than 3 points`);continue}j.push(g.innerPath[0]);const C=new S.Polygon({rings:[j]});if(C){const G=new I({geometry:C,attributes:{ObjectID:c++,id:`${d}+${b}+${f}`,fromNode:r.fromNode,toNode:r.toNode,roadId:String(d),roadName:r.name,sectionId:String(b),sectionIndex:p,laneId:f,type:F,sumoId:"",leftLine:g.innerPath,rightLine:g.outerPath,roadsectBaseIds:(l=y.roadsectBaseIds)==null?void 0:l.toString()}});this.allLaneGraphics.push(G),n.push(G)}}}}const a=setInterval(()=>{if(n.length>0||this.allRefLineGraphics.length>0){if(n.length>0){const r=n.splice(0,100);this.laneLayer.applyEdits({addFeatures:r})}if(this.allRefLineGraphics.length>0){const r=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:r})}}else clearInterval(a),i()},10)})}showJunction(e){const t=[];let s;this.xodrBorder.length>0&&(s=new S.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 S.Point({x:o.coordinates[0],y:o.coordinates[1]});let c=!0;if(s&&(c=A.contains(s,i)),c){const n=new I({geometry:i,attributes:{...o,selected:!1,type:"OpenDriveJunction"},symbol:this.getCrossGraphicSymbol(o,"marker")});t.push(n)}}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=P.debounce(async t=>{var c;const o=(c=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:c.filter(n=>n.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 n=`${this.hitGraphic.getAttribute("roadId")}+${this.hitGraphic.getAttribute("sectionId")}`;if(this.currentSectionCode===n||this.selectedSectionIds.includes(n)||this.sectionLayer.graphics.findIndex(y=>y.getAttribute("id")===n)>=0)return;this.currentSectionCode=n;const l=this.allLaneGraphics.filter(y=>`${y.attributes.roadId}+${y.attributes.sectionId}`===n),r=A.union(l.map(y=>y.geometry)),d=this.hitGraphic.getAttribute("fromNode"),m=this.hitGraphic.getAttribute("toNode"),u=this.junctionNames.get(d)||d,h=this.junctionNames.get(m)||m,p=new I({geometry:r,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:n,selected:!1,fromNodeName:u,toNodeName:h,laneCount:l.length,roadsectBaseIds:this.hitGraphic.getAttribute("roadsectBaseIds")},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(p)}else if(i.layer.id==="OpenDriveJunction"){const n=this.hitGraphic.getAttribute("id");if(n===this.currentJunctionId)return;this.currentJunctionId=n}});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(l=>l.type==="graphic");if(o.length===0)return;const i=o[0].graphic,c=i.getAttribute("type"),n=i.getAttribute("id");if(c==="OpenDriveJunction")if(i.getAttribute("selected")===!1){const l=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,r=await w.get(l,{params:{id:n,projectName:this.projectName}});r.status===200&&r.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:r.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:n,details:void 0}),i.setAttribute("selected",!1),i.symbol=this.getCrossGraphicSymbol(i.attributes,this.view.scale<this.junctionScale?"picture":"marker");else c==="OpenDriveSection"&&(i.layer.id==="OpenDriveHighlight"?(this.highlightLayer.remove(i),this.sectionLayer.add(i),i.setAttribute("selected",!0),this.selectedSectionIds.push(n),this.splitLaneLayer.graphics.filter(r=>r.getAttribute("roadsectBaseIds")===i.getAttribute("roadsectBaseIds")).forEach(r=>r.symbol={type:"simple-fill",color:[255,69,0],outline:{color:"red",width:2}})):(this.splitLaneLayer.graphics.filter(r=>r.getAttribute("roadsectBaseIds")===i.getAttribute("roadsectBaseIds")).forEach(r=>r.symbol={type:"simple-fill",color:[255,0,0,.8],outline:{color:"red",width:1}}),this.sectionLayer.remove(i),this.selectedSectionIds=this.selectedSectionIds.filter(r=>r!==n),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:i.getAttribute("edgeId"),details:void 0})))});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(c=>c.getAttribute("roadId")===s&&c.getAttribute("sectionIndex")===o);if(i){const c=`${s}+${i.getAttribute("sectionId")}`,n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await w.get(n,{params:{id:c,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${c}`}}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 c=i.length===2?Number(i[1]):void 0,n=i[0].split("#");if(n.length>2)return{status:-1,message:"id格式错误"};const a=n[0],l=n.length===2?Number(n[1]):void 0;return await this.findLane({roadsectId:a,segmentId:l,laneId:c,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(l=>{const r=Number(l.attributes.sectionId);a.indexOf(r)===-1&&a.push(r)}),a.sort((l,r)=>l-r),s>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};s=a[s],i=i.filter(l=>Number(l.attributes.sectionId)===s)}if(o!==void 0){const a=[];if(i.forEach(l=>{const r=Number(l.attributes.laneId);a.indexOf(r)===-1&&a.push(r)}),a.sort((l,r)=>l-r),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],i=i.filter(l=>Number(l.attributes.laneId)===o)}const c=i.map(a=>a.geometry),n=A.union(c);if(e.flash){const a=new I({geometry:n,symbol:{type:"simple-fill",color:[0,255,255,.6],style:"solid",outline:{width:0}}});this.flashGraphic(a)}return await this.view.goTo(n,{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"))}),!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(c=>c.getAttribute("roadId")===s):t.length===2&&(i=this.allLaneGraphics.filter(c=>c.getAttribute("roadId")===s&&c.getAttribute("sectionIndex")===o)),i.length>0){const c=new Map;return i.forEach(n=>{const a=n.getAttribute("roadId")+"+"+n.getAttribute("sectionId");this.selectedSectionIds.includes(a)||this.selectedSectionIds.push(a);let l=c.get(a);l?l.push(n.geometry):(l=[n.geometry],c.set(a,l))}),c.forEach(async(n,a)=>{const l=A.union(n),r=new I({geometry:l,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(r),await this.view.goTo(r)}),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async geometrySearch(e){const t=new S.Polygon({rings:[e]}),s=await this.laneLayer.queryFeatures({geometry:t,outFields:["*"]}),o=[],i=[];for(const a of s.features){const l=a.getAttribute("roadId"),r=a.getAttribute("sectionIndex"),d=`${l}#${r}`;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:`${l}+${a.getAttribute("sectionId")}`,projectName:this.projectName}});u.status===200&&u.data.status===0&&i.push(u.data.result)}}const c=this.junctionLayer.graphics.filter(a=>{const l=a.geometry;return A.contains(t,l)}),n=[];for(const a of c){const l=a.getAttribute("id");this.selectSumo({type:"junction",id:l});const r=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,d=await w.get(r,{params:{id:l,projectName:this.projectName}});d.status===200&&d.data.status===0&&n.push(d.data.result)}return{status:0,message:"ok",result:{junctions:n,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("#"),c=i.length===2?Number(i[1]):0;let n=i[0];n.startsWith("-")&&(n=n.slice(1));const a=this.allLaneGraphics.filter(f=>f.getAttribute("roadId")===n&&f.getAttribute("sectionIndex")===c);if(a.length===0)return{status:-1,message:"未找到路段"};const l=a.length-o,r=a.find(f=>Math.abs(f.getAttribute("laneId"))===l);if(!r)return{status:-1,message:"未找到车道"};const d=e.start||0,m=e.end||100,u=$.lineString(r.getAttribute("leftLine")),h=O.lineSliceAlong(u,d,m,{units:"meters"}),p=$.lineString(r.getAttribute("rightLine")),y=O.lineSliceAlong(p,d,m,{units:"meters"}),b=h.geometry.coordinates.concat(y.geometry.coordinates.reverse());b.push(b[b.length-1]);const g=new I({geometry:new S.Polygon({rings:[b]}),attributes:{ObjectID:r.getAttribute("ObjectID"),id:r.getAttribute("id"),fromNode:r.getAttribute("fromNode"),toNode:r.getAttribute("toNode"),roadId:r.getAttribute("roadId"),roadName:r.getAttribute("roadName"),sectionId:r.getAttribute("sectionId"),sectionIndex:r.getAttribute("sectionIndex"),laneId:r.getAttribute("laneId"),type:r.getAttribute("type"),sumoId:r.getAttribute("sumoId"),leftLine:h.geometry.coordinates,rightLine:y.geometry.coordinates},symbol:{type:"simple-fill",color:[255,0,0,.8],outline:{color:"red"}}});return this.splitLaneLayer.add(g),k.default.viewGoto(this.view,[g]),{status:0,message:"ok",result:{coordinates:b}}}blockOpenDriveLane(e){const s=this.allLaneGraphics.filter(o=>{let i=String(o.getAttribute("laneId"));return i.startsWith("-")&&(i=i.slice(1)),o.getAttribute("roadId")===e.roadsectId&&o.getAttribute("roadsectBaseIds").includes(e.roadsectBaseId)&&i===String(e.laneId)}).map(o=>{const i=o.clone();return i.symbol={type:"simple-fill",color:[255,0,0,.8],outline:{color:"red"}},i});this.splitLaneLayer.addMany(s),k.default.viewGoto(this.view,s)}clearSplitLane(){this.splitLaneLayer.removeAll()}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=D;
@@ -4,8 +4,22 @@ export default class CrossRenderer {
4
4
  private crossLayer;
5
5
  private crossGraphicSymbol;
6
6
  private locations;
7
+ private currentShowMode;
8
+ private zoomWatchHandle;
9
+ private symbolScale;
10
+ private currentZoom;
11
+ private readonly clusterRadius;
12
+ private readonly minClusterPoints;
13
+ private readonly maxClusterSymbolSize;
14
+ private readonly minClusterSymbolSize;
7
15
  constructor(view: __esri.MapView | __esri.SceneView);
8
- showCrosses(controllers: DistrictController[]): Promise<void>;
16
+ addCrosses(controllers: DistrictController[]): Promise<void>;
17
+ clearCrosses(): void;
18
+ private updateScatterSymbol;
19
+ /**
20
+ * 将地理位置转换为屏幕坐标
21
+ */
22
+ private locationToScreen;
9
23
  /**
10
24
  * 显示聚合点
11
25
  */
@@ -14,4 +28,40 @@ export default class CrossRenderer {
14
28
  * 显示散点
15
29
  */
16
30
  showScatter(): void;
31
+ /**
32
+ * 确定路口符号
33
+ * @param attributes
34
+ * @returns
35
+ */
36
+ private getCrossSymbol;
37
+ /**
38
+ * 获取邻居点
39
+ * @param locations
40
+ * @param index
41
+ * @param eps
42
+ * @returns
43
+ */
44
+ private getNeighbors;
45
+ /**
46
+ * 两点间的像素距离
47
+ * @param point1
48
+ * @param point2
49
+ * @returns
50
+ */
51
+ private getDistance;
52
+ /**
53
+ * 从聚类结果中创建聚类对象
54
+ * @param locations
55
+ * @returns
56
+ */
57
+ private createClusters;
58
+ /**
59
+ * 按照像素距离聚类
60
+ * @param locations
61
+ * @param eps
62
+ * @param minPoints
63
+ * @returns
64
+ */
65
+ private doPixelCluster;
66
+ private showClusterResult;
17
67
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@arcgis/core/layers/GraphicsLayer");class s{constructor(r){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.view=r,this.crossLayer=new o,this.view.map.add(this.crossLayer)}async showCrosses(r){r.forEach(i=>{i.signals.forEach(e=>{e.longitude&&e.latitude&&!isNaN(e.longitude)&&!isNaN(e.latitude)&&this.locations.push({id:e.id,x:e.longitude,y:e.latitude,visited:!1,clusterId:void 0,properties:e})}),i.subDistricts.forEach(e=>{e.signals.forEach(t=>{t.longitude&&t.latitude&&!isNaN(t.longitude)&&!isNaN(t.latitude)&&this.locations.push({id:t.id,x:t.longitude,y:t.latitude,visited:!1,clusterId:void 0,properties:t})})})})}showCluster(){}showScatter(){}}exports.default=s;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/geometry"),m=require("@arcgis/core/Graphic"),b=require("@arcgis/core/layers/GraphicsLayer");class S{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.currentShowMode="scatter",this.symbolScale=5e3,this.currentZoom=0,this.clusterRadius=120,this.minClusterPoints=2,this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.view=e,this.crossLayer=new b,this.view.map.add(this.crossLayer),this.currentZoom=e.zoom}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,clusterId:void 0,properties:r})}),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,clusterId:void 0,properties:s})})})}),this.zoomWatchHandle=this.view.watch("scale",(t,r)=>{if(this.currentShowMode==="scatter")(t<this.symbolScale&&r>=this.symbolScale||t>=this.symbolScale&&r<this.symbolScale)&&(console.log("Scale changed, updating cross display symbol"),this.updateScatterSymbol());else if(this.currentShowMode==="cluster"&&Math.abs(this.view.zoom-this.currentZoom)>=1){this.currentZoom=this.view.zoom,this.locationToScreen(),console.time("cluster");const s=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);console.timeEnd("cluster"),this.showClusterResult(s)}})}clearCrosses(){var e;console.log("Clearing crosses"),this.crossLayer.removeAll(),this.locations=[],(e=this.zoomWatchHandle)==null||e.remove()}updateScatterSymbol(){this.crossLayer.graphics.forEach(e=>{e.symbol=this.getCrossSymbol(e.attributes)})}locationToScreen(){this.locations.forEach(e=>{const t=this.view.toScreen(new y.Point({x:e.x,y:e.y}));e.properties.screenX=t.x,e.properties.screenY=t.y})}showCluster(){this.crossLayer.removeAll(),this.currentShowMode="cluster",this.locationToScreen();const e=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);this.showClusterResult(e)}showScatter(){this.crossLayer.removeAll(),this.currentShowMode="scatter";const e=this.locations.map(t=>new m({geometry:{type:"point",longitude:t.x,latitude:t.y},symbol:this.getCrossSymbol(t.properties),attributes:t.properties}));this.crossLayer.addMany(e)}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.locations.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(e){const t={},r=[];for(let i=0;i<e.length;i++){const o=e[i];o.clusterId===void 0||o.clusterId===-1?r.push(o):(t[o.clusterId]||(t[o.clusterId]=[]),t[o.clusterId].push(o))}const s=Object.keys(t).map((i,o)=>{const n=t[Number(i)],l=n.length,a=n.reduce((c,u)=>c+u.x,0),h=n.reduce((c,u)=>c+u.y,0),p=a/l,d=h/l;return{id:Number(i),items:n,count:l,center:{x:p,y:d}}});return r.length>0&&s.push({id:-1,items:r,count:r.length,center:null}),s}doPixelCluster(e,t){let r=0;this.locations.forEach(s=>{s.visited=!1,s.clusterId=void 0});for(let s=0;s<this.locations.length;s++){const i=this.locations[s];if(i.visited)continue;i.visited=!0;const o=this.getNeighbors(i,e);o.length<t?i.clusterId=-1:(o.forEach(n=>{n.visited=!0,n.clusterId=r}),i.clusterId=r,r++)}return this.createClusters(this.locations)}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 m({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 m({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=S;
@@ -1 +1 @@
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"),u=require("./sub-district-renderer.js");class o{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 u.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),this.crossRenderer.showCrosses(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 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}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=o;
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),this.crossRenderer.addCrosses(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":this.crossRenderer.showScatter();break;case"signalCluster":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;
@@ -265,6 +265,11 @@ export interface ISplitOpenDriveLaneParams {
265
265
  start?: number;
266
266
  end?: number;
267
267
  }
268
+ export interface IBlockOpenDriveLaneParams {
269
+ roadsectId: string;
270
+ roadsectBaseId: string;
271
+ laneId: string;
272
+ }
268
273
  export interface IJunctionTableData {
269
274
  id: string;
270
275
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.259",
3
+ "version": "1.0.262",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [