gisviewer-vue3-arcgis 1.0.133 → 1.0.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
  2. package/es/src/gis-map/gis-map.vue.d.ts +17 -0
  3. package/es/src/gis-map/gis-map.vue.mjs +118 -113
  4. package/es/src/gis-map/index.d.ts +17 -0
  5. package/es/src/gis-map/utils/components/sketch-tool.vue.d.ts +18 -0
  6. package/es/src/gis-map/utils/components/sketch-tool.vue.mjs +7 -0
  7. package/es/src/gis-map/utils/components/sketch-tool.vue2.mjs +48 -0
  8. package/es/src/gis-map/utils/components/sketch-tool.vue3.mjs +4 -0
  9. package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +2 -1
  10. package/es/src/gis-map/utils/open-drive-renderer/index.mjs +18 -16
  11. package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +3 -7
  12. package/es/style.css +1 -1
  13. package/lib/_virtual/_plugin-vue_export-helper.js +1 -0
  14. package/lib/src/gis-map/gis-map.vue.d.ts +17 -0
  15. package/lib/src/gis-map/gis-map.vue.js +1 -1
  16. package/lib/src/gis-map/index.d.ts +17 -0
  17. package/lib/src/gis-map/utils/components/sketch-tool.vue.d.ts +18 -0
  18. package/lib/src/gis-map/utils/components/sketch-tool.vue.js +1 -0
  19. package/lib/src/gis-map/utils/components/sketch-tool.vue2.js +1 -0
  20. package/lib/src/gis-map/utils/components/sketch-tool.vue3.js +1 -0
  21. package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +2 -1
  22. package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
  23. package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
  24. package/package.json +1 -1
  25. package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +0 -17
  26. package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.mjs +0 -49
  27. package/es/src/gis-map/utils/open-drive-renderer/junction.d.ts +0 -51
  28. package/es/src/gis-map/utils/open-drive-renderer/junction.mjs +0 -151
  29. package/es/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +0 -48
  30. package/es/src/gis-map/utils/open-drive-renderer/lane-section.mjs +0 -82
  31. package/es/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +0 -29
  32. package/es/src/gis-map/utils/open-drive-renderer/lane-utils.mjs +0 -265
  33. package/es/src/gis-map/utils/open-drive-renderer/lane.d.ts +0 -77
  34. package/es/src/gis-map/utils/open-drive-renderer/lane.mjs +0 -110
  35. package/es/src/gis-map/utils/open-drive-renderer/road.d.ts +0 -62
  36. package/es/src/gis-map/utils/open-drive-renderer/road.mjs +0 -121
  37. package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +0 -108
  38. package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.mjs +0 -425
  39. package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +0 -17
  40. package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.js +0 -1
  41. package/lib/src/gis-map/utils/open-drive-renderer/junction.d.ts +0 -51
  42. package/lib/src/gis-map/utils/open-drive-renderer/junction.js +0 -1
  43. package/lib/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +0 -48
  44. package/lib/src/gis-map/utils/open-drive-renderer/lane-section.js +0 -1
  45. package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +0 -29
  46. package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.js +0 -1
  47. package/lib/src/gis-map/utils/open-drive-renderer/lane.d.ts +0 -77
  48. package/lib/src/gis-map/utils/open-drive-renderer/lane.js +0 -1
  49. package/lib/src/gis-map/utils/open-drive-renderer/road.d.ts +0 -62
  50. package/lib/src/gis-map/utils/open-drive-renderer/road.js +0 -1
  51. package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +0 -108
  52. package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),y=require("./stores/index.js");require("./style/index.css");const Se=require("./utils/holo-flow/index.js"),Ce=require("./utils/map-initializer.js"),C=require("./utils/open-drive-renderer/index.js"),Oe=require("./utils/overlay.js"),ke=require("./utils/queue-length.js"),O=require("./utils/road-config-tool/index.js"),Te=require("./utils/signal-control-area-controller/index.js"),Ae=require("./utils/traffic-flow.js"),De={class:"gis-viewer"},Le={style:{position:"absolute",bottom:"10px",left:"10px"}},Ie=o.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:T,emit:A}){const d=o.ref(null);let i,l,c,n,a,r,g,t,s;const p=o.ref(!1);o.onMounted(async()=>{if(y.registerStore(),!d.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(p.value=!p.value)});const e=o.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,S=await(await fetch(h.config)).json();S.assetsRoot=h.assetsRoot||u;const ye=y.default.useAppDataStore;ye.mapConfig=S,l=new Ce.default,i=await l.initialize({container:d.value,markerClickCallback:(m,w,v,he)=>{f("markerClick",m,w,v,he)},mapClickCallback:(m,w,v)=>{f("mapClick",m,w,v)}}),a=new Se.default(i),await a.init(),f("mapLoaded")}),o.onUnmounted(()=>{s==null||s.clearSignalControlArea(),t==null||t.clearOpenDrive(),a==null||a.clearHoloTrace(),a==null||a.clearHoloSignal(),n==null||n.disconnectTrafficFlow()});const D=o.computed(()=>i),L=()=>{const e=y.default.useAppDataStore;e.saveTrackLog=!0},I=()=>{a.downloadTrackLog()},b=async e=>await l.setMapCenter(e),q=async e=>await l.setMapCamera(e),_=async e=>await l.lookAt(e),x=e=>l.setLayerVisibility(e),H=(e,u)=>l.requestCoordinateTransform(e,u),V=e=>{l.cancelCoordinateTransform(e)},M=e=>{l.setMapZoomRange(e)},N=e=>(c||(c=new O.default(i)),c.showLaneNumber(e)),B=()=>{c==null||c.clearLaneNumber()},E=async e=>(c||(c=new O.default(i)),await c.initializeSearch(e)),j=async()=>c==null?void 0:c.calCrossIndicatorArea(),z=async()=>{},P=async(e,u)=>{n||(n=new Ae.default(i)),n.connectTrafficFlow(e,u)},Q=()=>{n==null||n.disconnectTrafficFlow()},F=e=>{a.handleVehicleTraceData(e)},Z=()=>{a.clearHoloTrace()},K=e=>{a.setInterpolate(e)},U=async e=>{await a.handleSignalData(e)},G=()=>{a.clearHoloSignal()},J=e=>{n==null||n.toggleTrafficInfo(e),a.toggleTrafficInfo(e)},R=e=>{a.togglePause(e)},W=e=>{n==null||n.toggleTrafficObject(e),a.toggleTrafficObject(e)},X=e=>{a.updatePanelContent(e)},Y=async e=>(r||(r=new Oe.default(i)),r.addOverlays(e)),$=e=>r==null?void 0:r.removeOverlaysByType(e),ee=e=>r==null?void 0:r.removeOverlaysById(e),te=()=>r==null?void 0:r.removeAllOverlays(),ae=()=>{r==null||r.showAllOverlays()},ne=e=>{g||(g=new ke.default(i)),g.updateQueueLength(e)},re=()=>{g==null||g.removeQueueLength()},se=async(e,u)=>(t||(t=new C.default(i)),await t.showOpenDriveFromServer(e,u)),oe=async e=>(t||(t=new C.default(i)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),ce=async()=>await(t==null?void 0:t.clearOpenDrive()),ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},le=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ue=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ge=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},me=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},de=e=>(s||(s=new Te.default(i)),s.showSignalControlArea(e)),pe=()=>{s==null||s.clearSignalControlArea()},fe=async e=>s?await s.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},we=async e=>s?await s.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},ve=()=>s?s.resetHighlight():{status:-1,message:"未加载信号控制区"},h=k,f=A;return T({mapViewer:D,setLayerVisibility:x,setMapCenter:b,lookAt:_,setMapCamera:q,setMapZoomRange:M,requestCoordinateTransform:H,cancelCoordinateTransform:V,addOverlays:Y,showAllOverlays:ae,removeOverlaysByType:$,removeOverlaysById:ee,removeAllOverlays:te,showLaneNumber:N,clearLaneNumber:B,initializeAreaTool:E,calCrossIndicatorArea:j,calRoadIndicatorArea:z,connectCarFlow:P,disconnectCarFlow:Q,handleHoloVehicleTraceData:F,clearHoloTrace:Z,handleHoloSignalData:U,clearHoloSignal:G,setInterpolate:K,toggleTrafficInfo:J,toggleTrafficObject:W,toggleVehicleInfo:X,togglePause:R,updateQueueLength:ne,removeQueueLength:re,showOpenDriveFromServer:se,showOpenDriveFromFile:oe,clearOpenDrive:ce,findSumoInOpenDrive:ie,selectSumoInOpenDrive:le,unselectSumoInOpenDrive:ue,getSumoInfo:ge,splitOpenDriveLane:me,showSignalControlArea:de,clearSignalControlArea:pe,locateSignalControlArea:fe,highlightSignalControlArea:we,resetHighlightSignalControlArea:ve}),(e,u)=>(o.openBlock(),o.createElementBlock("div",De,[o.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:d},[o.withDirectives(o.createElementVNode("div",Le,[o.createElementVNode("button",{style:{"margin-right":"10px"},onClick:L}," 开始记录 "),o.createElementVNode("button",{onClick:I},"下载日志")],512),[[o.vShow,p.value]])],512)]))}});exports.default=Ie;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),y=require("./stores/index.js");require("./style/index.css");const Ce=require("./utils/components/sketch-tool.vue.js"),Oe=require("./utils/holo-flow/index.js"),ke=require("./utils/map-initializer.js"),C=require("./utils/open-drive-renderer/index.js"),Te=require("./utils/overlay.js"),Ae=require("./utils/queue-length.js"),O=require("./utils/road-config-tool/index.js"),De=require("./utils/signal-control-area-controller/index.js"),Le=require("./utils/traffic-flow.js"),Ie={class:"gis-viewer"},be={style:{position:"absolute",bottom:"10px",left:"10px"}},qe=a.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:T,emit:A}){const f=a.ref(null);let c,l,i,r,n,o,m,t,s;const d=a.ref(!1),D=a.ref(!1);a.onMounted(async()=>{if(y.registerStore(),!f.value)return;document.addEventListener("keydown",g=>{g.ctrlKey&&g.key==="i"&&(d.value=!d.value)});const e=a.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,S=await(await fetch(h.config)).json();S.assetsRoot=h.assetsRoot||u;const he=y.default.useAppDataStore;he.mapConfig=S,l=new ke.default,c=await l.initialize({container:f.value,markerClickCallback:(g,w,v,Se)=>{p("markerClick",g,w,v,Se)},mapClickCallback:(g,w,v)=>{p("mapClick",g,w,v)}}),n=new Oe.default(c),await n.init(),p("mapLoaded")}),a.onUnmounted(()=>{s==null||s.clearSignalControlArea(),t==null||t.clearOpenDrive(),n==null||n.clearHoloTrace(),n==null||n.clearHoloSignal(),r==null||r.disconnectTrafficFlow()});const L=a.computed(()=>c),I=()=>{const e=y.default.useAppDataStore;e.saveTrackLog=!0},b=()=>{n.downloadTrackLog()},q=async e=>await l.setMapCenter(e),_=async e=>await l.setMapCamera(e),x=async e=>await l.lookAt(e),V=e=>l.setLayerVisibility(e),H=(e,u)=>l.requestCoordinateTransform(e,u),M=e=>{l.cancelCoordinateTransform(e)},N=e=>{l.setMapZoomRange(e)},B=e=>(i||(i=new O.default(c)),i.showLaneNumber(e)),E=()=>{i==null||i.clearLaneNumber()},j=async e=>(i||(i=new O.default(c)),await i.initializeSearch(e)),z=async()=>i==null?void 0:i.calCrossIndicatorArea(),P=async()=>{},Q=async(e,u)=>{r||(r=new Le.default(c)),r.connectTrafficFlow(e,u)},F=()=>{r==null||r.disconnectTrafficFlow()},Z=e=>{n.handleVehicleTraceData(e)},G=()=>{n.clearHoloTrace()},K=e=>{n.setInterpolate(e)},U=async e=>{await n.handleSignalData(e)},J=()=>{n.clearHoloSignal()},R=e=>{r==null||r.toggleTrafficInfo(e),n.toggleTrafficInfo(e)},W=e=>{n.togglePause(e)},X=e=>{r==null||r.toggleTrafficObject(e),n.toggleTrafficObject(e)},Y=e=>{n.updatePanelContent(e)},$=async e=>(o||(o=new Te.default(c)),o.addOverlays(e)),ee=e=>o==null?void 0:o.removeOverlaysByType(e),te=e=>o==null?void 0:o.removeOverlaysById(e),ae=()=>o==null?void 0:o.removeAllOverlays(),ne=()=>{o==null||o.showAllOverlays()},re=e=>{m||(m=new Ae.default(c)),m.updateQueueLength(e)},oe=()=>{m==null||m.removeQueueLength()},se=async(e,u)=>(t||(t=new C.default(c)),await t.showOpenDriveFromServer(e,u)),ce=async e=>(t||(t=new C.default(c)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),ie=async()=>await(t==null?void 0:t.clearOpenDrive()),le=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},ue=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},me=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ge=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},fe=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},de=e=>(s||(s=new De.default(c)),s.showSignalControlArea(e)),pe=()=>{s==null||s.clearSignalControlArea()},we=async e=>s?await s.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},ve=async e=>s?await s.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},ye=()=>s?s.resetHighlight():{status:-1,message:"未加载信号控制区"},h=k,p=A;return T({mapViewer:L,setLayerVisibility:V,setMapCenter:q,lookAt:x,setMapCamera:_,setMapZoomRange:N,requestCoordinateTransform:H,cancelCoordinateTransform:M,addOverlays:$,showAllOverlays:ne,removeOverlaysByType:ee,removeOverlaysById:te,removeAllOverlays:ae,showLaneNumber:B,clearLaneNumber:E,initializeAreaTool:j,calCrossIndicatorArea:z,calRoadIndicatorArea:P,connectCarFlow:Q,disconnectCarFlow:F,handleHoloVehicleTraceData:Z,clearHoloTrace:G,handleHoloSignalData:U,clearHoloSignal:J,setInterpolate:K,toggleTrafficInfo:R,toggleTrafficObject:X,toggleVehicleInfo:Y,togglePause:W,updateQueueLength:re,removeQueueLength:oe,showOpenDriveFromServer:se,showOpenDriveFromFile:ce,clearOpenDrive:ie,findSumoInOpenDrive:le,selectSumoInOpenDrive:ue,unselectSumoInOpenDrive:me,getSumoInfo:ge,splitOpenDriveLane:fe,showSignalControlArea:de,clearSignalControlArea:pe,locateSignalControlArea:we,highlightSignalControlArea:ve,resetHighlightSignalControlArea:ye}),(e,u)=>(a.openBlock(),a.createElementBlock("div",Ie,[a.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:f},[a.withDirectives(a.createElementVNode("div",be,[a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:I}," 开始记录 "),a.createElementVNode("button",{onClick:b},"下载日志")],512),[[a.vShow,d.value]]),D.value?(a.openBlock(),a.createBlock(Ce.default,{key:0,view:a.unref(c)},null,8,["view"])):a.createCommentVNode("",!0)],512)]))}});exports.default=qe;
@@ -19,6 +19,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
19
19
  openDriveRenderer: import("./utils/open-drive-renderer").default;
20
20
  signalControlAreaController: import("./utils/signal-control-area-controller").default;
21
21
  showLogDiv: import("vue").Ref<boolean>;
22
+ showGroupSelect: import("vue").Ref<boolean>;
22
23
  mapViewer: import("vue").ComputedRef<__esri.MapView | __esri.SceneView>;
23
24
  startSaveTrackLog: () => void;
24
25
  downloadTrackLog: () => void;
@@ -77,6 +78,22 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
77
78
  resetHighlightSignalControlArea: () => import("../types").IResult;
78
79
  props: any;
79
80
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
81
+ sketchTool: import("vue").DefineComponent<{
82
+ view: {
83
+ type: null;
84
+ required: true;
85
+ };
86
+ }, {
87
+ props: any;
88
+ sketchVM: __esri.SketchViewModel;
89
+ resetButtonHandler: () => void;
90
+ geometrySelectionHandler: (event: any) => void;
91
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
92
+ view: {
93
+ type: null;
94
+ required: true;
95
+ };
96
+ }>>, {}, {}>;
80
97
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
81
98
  config: {
82
99
  type: StringConstructor;
@@ -0,0 +1,18 @@
1
+ import SketchViewModel from '@arcgis/core/widgets/Sketch/SketchViewModel';
2
+ declare const _sfc_main: import("vue").DefineComponent<{
3
+ view: {
4
+ type: null;
5
+ required: true;
6
+ };
7
+ }, {
8
+ props: any;
9
+ sketchVM: SketchViewModel;
10
+ resetButtonHandler: () => void;
11
+ geometrySelectionHandler: (event: any) => void;
12
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
+ view: {
14
+ type: null;
15
+ required: true;
16
+ };
17
+ }>>, {}, {}>;
18
+ export default _sfc_main;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./sketch-tool.vue2.js");require("./sketch-tool.vue3.js");const t=require("../../../../_virtual/_plugin-vue_export-helper.js"),u=t.default(e.default,[["__scopeId","data-v-ac0f5d06"]]);exports.default=u;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),a=require("@arcgis/core/layers/GraphicsLayer"),u=require("@arcgis/core/widgets/Sketch/SketchViewModel"),d={class:"gisviewer-sketch-tool gisviewer-sketch-tool-position"},g=e.defineComponent({__name:"sketch-tool",props:{view:{}},setup(l){const c=l;let t;e.onMounted(()=>{const o=new a;c.view.map.add(o),t=new u({layer:o,view:c.view})}),e.onUnmounted(()=>{t.destroy()});const i=()=>{},s=o=>{var r;console.log(o);const n=(r=o.target)==null?void 0:r.value;console.log(n),t.create(n)};return(o,n)=>(e.openBlock(),e.createElementBlock("div",d,[e.createElementVNode("button",{class:"esri-icon-pan geometry-button",onClick:i}),e.createElementVNode("button",{class:"esri-icon-checkbox-unchecked geometry-button",value:"rectangle",onClick:s}),e.createElementVNode("button",{class:"esri-icon-polygon geometry-button",value:"polygon",onClick:s})]))}});exports.default=g;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="";exports.default=e;
@@ -9,11 +9,11 @@ export default class OpenDriveRenderer {
9
9
  private sectionLayer;
10
10
  private highlightLayer;
11
11
  private flashLayer;
12
+ private drawLayer;
12
13
  private allLaneGraphics;
13
14
  private allRefLineGraphics;
14
15
  private mouseMoveHandler;
15
16
  private mouseClickHandler;
16
- private wasmLoader;
17
17
  constructor(view: __esri.MapView | __esri.SceneView);
18
18
  private projectName;
19
19
  private openDriveServer;
@@ -49,6 +49,7 @@ export default class OpenDriveRenderer {
49
49
  private currentJunctionId;
50
50
  private hitGraphic;
51
51
  private highlightGraphic;
52
+ private monitorMouseDrag;
52
53
  /**
53
54
  * 监听鼠标移动事件,高亮显示鼠标所在路段和路口
54
55
  */
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),$=require("@arcgis/core/core/promiseUtils"),M=require("@arcgis/core/geometry"),P=require("@arcgis/core/geometry/geometryEngine"),G=require("@arcgis/core/layers/FeatureLayer"),v=require("@arcgis/core/layers/GraphicsLayer"),y=require("axios"),J=require("md5"),A=require("pako"),C=require("../common-utils.js"),x=require("./wasm-loader.js");function O(m){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const t in m)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(m,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>m[t]})}}return e.default=m,Object.freeze(e)}const N=O($),L=O(P);class D{constructor(e){this.wasmLoader=x.default.getInstance(),this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.currentJunctionId="",this.view=e,this.view.popup.visibleElements={closeButton:!1,collapseButton:!1,actionBar:!1},this.laneLayer=new G({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:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",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 G({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.view.map.addMany([this.laneLayer,this.junctionLayer,this.sectionLayer,this.roadNameLayer,this.highlightLayer,this.flashLayer])}static getInstance(e){return this.instance||(this.instance=new D(e)),this.instance}async makeMd5FromFile(e){try{const i=await(await fetch(e)).text();return{status:0,message:"ok",result:J(i)}}catch(t){return{status:-1,message:t.message}}}async showOpenDriveFromFile(e){var h,g;this.openDriveClickCallback=e.selectedCallback,console.time("md5用时");const t=await this.makeMd5FromFile(e.file);if(t.status!==0)return t;this.projectName=t.result,console.timeEnd("md5用时"),this.openDriveServer=e.server,await this.makeMd5FromFile(e.file);const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await y.post(i,{},{params:{url:e.file,projectName:this.projectName}})}catch(d){return{status:-1,message:d.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;C.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e.server}${l}`);const a=await(await fetch(l)).arrayBuffer(),r=A.inflate(a,{to:"string"}),c=JSON.parse(r);await this.showAllLanes(c,((h=e.options)==null?void 0:h.showJunctionLane)||!1,((g=e.options)==null?void 0:g.showRoadName)||!0);const u=o.data.result.junctions;if(this.showJunction(u),e.options&&e.options.centerMap!==!1){const d=C.default.transformPointProjection([0,0]);await this.view.goTo(d)}return this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick(),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await y.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=A.inflate(n,{to:"string"}),r=JSON.parse(a);return await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){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 l=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const r of e){if(!t&&r.junction!=="-1")continue;const{id:c,refLine:u}=r;let h=r.name;h.includes("(")&&(h=h.slice(0,h.indexOf("("))),h=h.replace(/(.)/g,"$1 ");const g=new p({geometry:{type:"polyline",paths:[u]},attributes:{ObjectID:l++,roadId:c,roadName:h}});this.allRefLineGraphics.push(g),r.laneSections.sort((d,b)=>Number(d.id)-Number(b.id));for(let d=0;d<r.laneSections.length;d++){const b=r.laneSections[d],k=Number(b.id);for(const f of b.lanePaths){const w=Number(f.id);if(w===0)continue;const F=f.type,I=f.innerPath.concat(f.outerPath.reverse());if(I.length<=3){console.warn(`lane ${w} has less than 3 points`);continue}I.push(f.innerPath[0]);const j=new M.Polygon({rings:[I]});if(j){const S=new p({geometry:j,attributes:{ObjectID:l++,id:`${c}+${k}+${w}`,roadId:c,roadName:r.name,sectionId:k,sectionIndex:d,laneId:w,type:F,sumoId:""}});this.allLaneGraphics.push(S),n.push(S)}}}}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=[];for(const i of e){if(!i)continue;i.nodeType=i.type;const o=new p({geometry:{type:"point",x:i.coordinates[0],y:i.coordinates[1]},attributes:{...i,selected:!1,type:"OpenDriveJunction"},symbol:{type:"picture-marker",url:i.crossId?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",width:30,height:30}});t.push(o)}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=N.debounce(async t=>{var l;const o=(l=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.filter(n=>n.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightGraphic=void 0,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.attributes.roadId}+${this.hitGraphic.attributes.sectionId}`;if(n===this.currentSectionCode||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),c=L.union(r.map(u=>u.geometry));this.highlightGraphic=new p({geometry:c,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}}),this.highlightLayer.removeAll(),this.highlightLayer.add(this.highlightGraphic)}else if(s.layer.id==="OpenDriveJunction"){const n=this.hitGraphic.getAttribute("id");if(n===this.currentJunctionId)return;this.currentJunctionId=n;const a=this.hitGraphic.getAttribute("name"),r=this.hitGraphic.getAttribute("crossId");this.view.openPopup({title:a,content:`<table>
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),$=require("@arcgis/core/core/promiseUtils"),M=require("@arcgis/core/geometry"),P=require("@arcgis/core/geometry/geometryEngine"),G=require("@arcgis/core/layers/FeatureLayer"),g=require("@arcgis/core/layers/GraphicsLayer"),y=require("axios"),J=require("md5"),A=require("pako"),C=require("../common-utils.js");function O(m){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const t in m)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(m,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>m[t]})}}return e.default=m,Object.freeze(e)}const N=O($),L=O(P);class D{constructor(e){this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.currentJunctionId="",this.view=e,this.view.popup.visibleElements={closeButton:!1,collapseButton:!1,actionBar:!1},this.laneLayer=new G({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:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",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 G({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 g({id:"OpenDriveJunction"}),this.sectionLayer=new g({id:"OpenDriveSection"}),this.highlightLayer=new g({id:"OpenDriveHighlight"}),this.flashLayer=new g({id:"OpenDriveFlash"}),this.drawLayer=new g({id:"Draw"}),this.view.map.addMany([this.laneLayer,this.junctionLayer,this.sectionLayer,this.roadNameLayer,this.highlightLayer,this.flashLayer,this.drawLayer])}static getInstance(e){return this.instance||(this.instance=new D(e)),this.instance}async makeMd5FromFile(e){try{const i=await(await fetch(e)).text();return{status:0,message:"ok",result:J(i)}}catch(t){return{status:-1,message:t.message}}}async showOpenDriveFromFile(e){var h,b;this.openDriveClickCallback=e.selectedCallback,console.time("md5用时");const t=await this.makeMd5FromFile(e.file);if(t.status!==0)return t;this.projectName=t.result,console.timeEnd("md5用时"),this.openDriveServer=e.server,await this.makeMd5FromFile(e.file);const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await y.post(i,{},{params:{url:e.file,projectName:this.projectName}})}catch(d){return{status:-1,message:d.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;C.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e.server}${l}`);const a=await(await fetch(l)).arrayBuffer(),r=A.inflate(a,{to:"string"}),c=JSON.parse(r);await this.showAllLanes(c,((h=e.options)==null?void 0:h.showJunctionLane)||!1,((b=e.options)==null?void 0:b.showRoadName)||!0);const u=o.data.result.junctions;if(this.showJunction(u),e.options&&e.options.centerMap!==!1){const d=C.default.transformPointProjection([0,0]);await this.view.goTo(d)}return this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick(),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await y.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=A.inflate(n,{to:"string"}),r=JSON.parse(a);return await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){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 l=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const r of e){if(!t&&r.junction!=="-1")continue;const{id:c,refLine:u}=r;let h=r.name;h.includes("(")&&(h=h.slice(0,h.indexOf("("))),h=h.replace(/(.)/g,"$1 ");const b=new p({geometry:{type:"polyline",paths:[u]},attributes:{ObjectID:l++,roadId:c,roadName:h}});this.allRefLineGraphics.push(b),r.laneSections.sort((d,w)=>Number(d.id)-Number(w.id));for(let d=0;d<r.laneSections.length;d++){const w=r.laneSections[d],k=Number(w.id);for(const f of w.lanePaths){const v=Number(f.id);if(v===0)continue;const F=f.type,I=f.innerPath.concat(f.outerPath.reverse());if(I.length<=3){console.warn(`lane ${v} has less than 3 points`);continue}I.push(f.innerPath[0]);const j=new M.Polygon({rings:[I]});if(j){const S=new p({geometry:j,attributes:{ObjectID:l++,id:`${c}+${k}+${v}`,roadId:c,roadName:r.name,sectionId:k,sectionIndex:d,laneId:v,type:F,sumoId:""}});this.allLaneGraphics.push(S),n.push(S)}}}}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=[];for(const i of e){if(!i)continue;i.nodeType=i.type;const o=new p({geometry:{type:"point",x:i.coordinates[0],y:i.coordinates[1]},attributes:{...i,selected:!1,type:"OpenDriveJunction"},symbol:{type:"picture-marker",url:i.crossId?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",width:30,height:30}});t.push(o)}this.junctionLayer.addMany(t)}monitorMouseDrag(){}monitorMouseMove(){const e=N.debounce(async t=>{var l;const o=(l=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.filter(n=>n.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightGraphic=void 0,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.attributes.roadId}+${this.hitGraphic.attributes.sectionId}`;if(n===this.currentSectionCode||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),c=L.union(r.map(u=>u.geometry));this.highlightGraphic=new p({geometry:c,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}}),this.highlightLayer.removeAll(),this.highlightLayer.add(this.highlightGraphic)}else if(s.layer.id==="OpenDriveJunction"){const n=this.hitGraphic.getAttribute("id");if(n===this.currentJunctionId)return;this.currentJunctionId=n;const a=this.hitGraphic.getAttribute("name"),r=this.hitGraphic.getAttribute("crossId");this.view.openPopup({title:a,content:`<table>
2
2
  <tr><td>路口编号</td><td>${n}</td></tr>
3
3
  <tr><td>信号机编号</td><td>${r||"无信控"}</td></tr>
4
4
  </table>`,location:this.hitGraphic.geometry})}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=N.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,l=s.getAttribute("type"),n=s.getAttribute("id");if(l==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const r=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,c=await y.get(r,{params:{id:n,projectName:this.projectName}});c.status===200&&c.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:c.data.result}),s.setAttribute("selected",!0),s.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(s,50))}else{this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:void 0}),s.setAttribute("selected",!1);const r=s.getAttribute("crossId");s.symbol.url=r?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(s,30)}else if(l==="OpenDriveSection")if(s.getAttribute("selected"))this.sectionLayer.remove(s),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:n,details:void 0});else{this.highlightLayer.remove(s),this.sectionLayer.add(s),s.setAttribute("selected",!0);const r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,c=await y.get(r,{params:{id:n,projectName:this.projectName}});c.status===200&&c.data.status===0&&this.openDriveClickCallback&&(s.setAttribute("edgeId",c.data.result.obj_id),this.openDriveClickCallback({type:"OpenDriveSection",id:n,details:c.data.result}))}});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 y.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(l=>l.getAttribute("roadId")===i&&l.getAttribute("sectionIndex")===o);if(s){const l=`${i}+${s.getAttribute("sectionId")}`,n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await y.get(n,{params:{id:l,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${l}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}async clearOpenDrive(){var t,i;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(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=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 l=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:l,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 p({geometry:i.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[255,0,0,.6],outline:{color:"red",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 c=Number(r.attributes.sectionId);a.indexOf(c)===-1&&a.push(c)}),a.sort((r,c)=>r-c),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 c=Number(r.attributes.laneId);a.indexOf(c)===-1&&a.push(c)}),a.sort((r,c)=>r-c),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],s=s.filter(r=>Number(r.attributes.laneId)===o)}const l=s.map(a=>a.geometry),n=L.union(l);if(e.flash){const a=new p({geometry:n,symbol:{type:"simple-fill",color:[255,0,0,.5],style:"solid",outline:{color:"red",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=>{if((!e||!e.id||e.id===""||e.id===t.getAttribute("id"))&&t.getAttribute("selected")){t.setAttribute("selected",!1);const i=t.getAttribute("crossId");t.symbol.url=i?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(t,30)}}),!e||e.type==="edge")if(!e||!e.id||e.id==="")this.sectionLayer.removeAll();else{const t=this.sectionLayer.graphics.find(i=>i.getAttribute("edgeId")===e.id);t&&this.sectionLayer.remove(t)}return{status:0,message:"ok"}}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=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===i&&l.getAttribute("sectionIndex")===o);if(s.length>0){const l=L.union(s.map(a=>a.geometry)),n=new p({geometry:l,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",edgeId:e.id,selected:!0}});return this.sectionLayer.add(n),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async splitLane(e){return{status:0,message:"ok",result:e}}}exports.default=D;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/GraphicsLayer"),y=require("@turf/buffer"),p=require("@turf/convex"),m=require("@turf/helpers"),f=require("./district-controller.js");function b(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=b(m);class L{constructor(e){this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!0},this.districtControllerLayer=new l({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new l({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new l({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new l({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const t of e){const i=new f.default(t);this.drawArea(i,!0)}return{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.eventHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);if(t){await this.view.goTo(t.geometry);const i=t.geometry.type==="point"?t.geometry:t.geometry.centroid;return this.view.openPopup({features:[t],location:i}),{status:0,message:"ok"}}else return{status:1,message:"未找到"}}async highlightSignalControlArea(e){this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id).toArray().map(r=>r.clone()),i=this.subDistrictControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("parentId")===e.id).toArray().map(r=>r.clone()),a=this.crossLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("districtId")===e.id||r.getAttribute("subDistrictId")===e.id).toArray().map(r=>r.clone());return t.length>0&&this.highlightLayer.addMany(t),i.length>0&&this.highlightLayer.addMany(i),a.length>0&&this.highlightLayer.addMany(a),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(await this.view.goTo(t.length>0?t:i.length>0?i:a),{status:0,message:"ok"})}resetHighlight(){return this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(i=>i.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(i=>i.attributes.id===e)),t||(t=this.crossLayer.graphics.find(i=>i.attributes.id===e)),t}drawArea(e,t){const i=e.getAllCrossCoordinates();if(i.length>2){const r=u.featureCollection(i.map(g=>u.point(g))),n=p(r);if(!n)return;const d=y(n.geometry,t?200:30,{units:"meters"});let o;t?o=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:o=[{fieldName:"parentId",label:"区控编号"},{fieldName:"parentName",label:"区控名称"},{fieldName:"id",label:"子区编号"},{fieldName:"crossCount",label:"路口数量"}];const h=new c({geometry:{type:"polygon",rings:d.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:{type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:e.name,content:[{type:"fields",fieldInfos:o}]}});t?this.districtControllerLayer.add(h):this.subDistrictControllerLayer.add(h)}for(const r of e.subDistricts)this.drawArea(r,!1);const a=e.crosses.map(r=>new c({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:{type:"simple-marker",color:e.areaColor,size:8,outline:{color:"white",width:1}},attributes:{type:"cross",id:r.id,name:r.name,districtId:t?e.id:e.parentId,subDistrictId:t?"":e.id},popupTemplate:{title:r.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtId",label:"区控编号"},{fieldName:"subDistrictId",label:"子区编号"},{fieldName:"id",label:"路口编号"}]}]}}));this.crossLayer.addMany(a)}}exports.default=L;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),o=require("@arcgis/core/layers/GraphicsLayer"),y=require("@turf/buffer"),p=require("@turf/convex"),m=require("@turf/helpers"),f=require("./district-controller.js");function b(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=b(m);class L{constructor(e){this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!0},this.districtControllerLayer=new o({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new o({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new o({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new o({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const t of e){const i=new f.default(t);this.drawArea(i,!0)}return{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.eventHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);if(t){await this.view.goTo(t.geometry);const i=t.geometry.type==="point"?t.geometry:t.geometry.centroid;return this.view.openPopup({features:[t],location:i}),{status:0,message:"ok"}}else return{status:1,message:"未找到"}}async highlightSignalControlArea(e){this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id).toArray().map(r=>r.clone()),i=this.subDistrictControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("parentId")===e.id).toArray().map(r=>r.clone()),a=this.crossLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("districtId")===e.id||r.getAttribute("subDistrictId")===e.id).toArray().map(r=>r.clone());return t.length>0&&this.highlightLayer.addMany(t),i.length>0&&this.highlightLayer.addMany(i),a.length>0&&this.highlightLayer.addMany(a),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(await this.view.goTo(t.length>0?t:i.length>0?i:a),{status:0,message:"ok"})}resetHighlight(){return this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(i=>i.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(i=>i.attributes.id===e)),t||(t=this.crossLayer.graphics.find(i=>i.attributes.id===e)),t}drawArea(e,t){const i=e.getAllCrossCoordinates();if(i.length>2){const r=u.featureCollection(i.map(g=>u.point(g))),n=p(r);if(!n)return;const d=y(n.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"区控名称"},{fieldName:"id",label:"子区编号"},{fieldName:"crossCount",label:"路口数量"}];const h=new c({geometry:{type:"polygon",rings:d.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:{type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:e.name,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(h):this.subDistrictControllerLayer.add(h)}for(const r of e.subDistricts)this.drawArea(r,!1);const a=e.crosses.map(r=>new c({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:{type:"simple-marker",color:e.areaColor,size:8,outline:{color:"white",width:1}},attributes:{type:"cross",id:r.id,name:r.name,districtId:t?e.id:e.parentId,subDistrictId:t?"":e.id},popupTemplate:{title:r.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtId",label:"区控编号"},{fieldName:"subDistrictId",label:"子区编号"},{fieldName:"id",label:"路口编号"}]}]}}));this.crossLayer.addMany(a)}}exports.default=L;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.133",
3
+ "version": "1.0.134",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [
@@ -1,17 +0,0 @@
1
- export default class DrawBezier {
2
- private static sampleCount;
3
- static drawBezierBetweenLane(incoming: number[][], outgoing: number[][]): number[][];
4
- /**
5
- * 生成控制点
6
- * 进口道的延长线和出口道的反向延长线的交点
7
- */
8
- private static getControlPoint;
9
- /**
10
- * @desc 二阶贝塞尔
11
- * @param {number} t 当前百分比
12
- * @param {Array} p1 起点坐标
13
- * @param {Array} p2 终点坐标
14
- * @param {Array} cp 控制点
15
- */
16
- private static twoBezier;
17
- }
@@ -1,49 +0,0 @@
1
- import * as m from "@turf/helpers";
2
- import f from "@turf/line-intersect";
3
- import p from "../common-utils.mjs";
4
- class P {
5
- static drawBezierBetweenLane(t, i) {
6
- const n = this.getControlPoint(t, i);
7
- if (n.length === 3) {
8
- const s = n[0], r = n[1], c = n[2], o = [];
9
- for (let e = 0; e <= this.sampleCount; e++)
10
- o.push(this.twoBezier(e / this.sampleCount, s, r, c));
11
- return o;
12
- } else
13
- return n;
14
- }
15
- /**
16
- * 生成控制点
17
- * 进口道的延长线和出口道的反向延长线的交点
18
- */
19
- static getControlPoint(t, i) {
20
- const n = t[0], s = t[1], r = p.getExtensionLine(
21
- n,
22
- s,
23
- 100
24
- ), c = m.lineString([n, r]), o = i[0], e = i[1], l = p.getExtensionLine(
25
- e,
26
- o,
27
- 100
28
- ), u = m.lineString([l, e]), g = f(c, u);
29
- if (g.features.length === 0)
30
- return [s, o];
31
- const a = g.features[0].geometry.coordinates;
32
- return [s, o, a];
33
- }
34
- /**
35
- * @desc 二阶贝塞尔
36
- * @param {number} t 当前百分比
37
- * @param {Array} p1 起点坐标
38
- * @param {Array} p2 终点坐标
39
- * @param {Array} cp 控制点
40
- */
41
- static twoBezier(t, i, n, s) {
42
- const [r, c] = i, [o, e] = s, [l, u] = n, g = (1 - t) * (1 - t) * r + 2 * t * (1 - t) * o + t * t * l, a = (1 - t) * (1 - t) * c + 2 * t * (1 - t) * e + t * t * u;
43
- return [g, a];
44
- }
45
- }
46
- P.sampleCount = 50;
47
- export {
48
- P as default
49
- };
@@ -1,51 +0,0 @@
1
- import { IJunctionTableData, ILaneInfo } from '../../../types';
2
- interface ILink {
3
- incoming: ILaneInfo;
4
- connecting: ILaneInfo;
5
- outgoing: ILaneInfo;
6
- }
7
- export default class Junction {
8
- id: string;
9
- name: string;
10
- /** 路口内的行车通道,包含进口道->转接道->出口道三个车道 */
11
- laneLinks: Array<ILink>;
12
- tableData: IJunctionTableData | undefined;
13
- /** 进口车道按roadId归类, */
14
- private incomingLanes;
15
- private outline;
16
- private wasmLoader;
17
- private roadList;
18
- constructor(odrJunction: any);
19
- /**
20
- * 在路口中,找到进口道的后继转接车道
21
- * @param {string} roadId 进口道道路id
22
- * @param {number} laneId 进口道车道id
23
- * @returns {ILaneInfo[]}
24
- */
25
- getSuccessorForIncoming(roadId: string, laneId: number): ILaneInfo[];
26
- /**
27
- * 在路口中,找到出口道的前驱转接车道
28
- * @param {string} roadId 出口道道路id
29
- * @param {number} laneId 出口道车道id
30
- * @returns {ILaneInfo[]}
31
- */
32
- getPredecessorForOutgoing(roadId: string, laneId: number): ILaneInfo[];
33
- /**
34
- * 获取路口轮廓线
35
- * 要等所有路口对象生成之后才能调用,所以不放在初始化中
36
- * @returns
37
- */
38
- getJunctionOutline(): number[][];
39
- /**
40
- * 获取此路口各个进口道的停止线
41
- */
42
- getRoadStopLine(): {
43
- roadId: string;
44
- line: number[][];
45
- }[];
46
- /**
47
- * 获取此路口的所有进口车道
48
- */
49
- getAllIncomingLanes(): ILaneInfo[];
50
- }
51
- export {};
@@ -1,151 +0,0 @@
1
- import f from "../common-utils.mjs";
2
- import E from "./draw-bezier.mjs";
3
- import p from "./wasm-loader.mjs";
4
- class R {
5
- constructor(t) {
6
- this.laneLinks = [], this.incomingLanes = /* @__PURE__ */ new Map(), this.wasmLoader = p.getInstance(), this.id = t.id, this.name = t.name, this.roadList = p.getInstance().roadList;
7
- const i = f.getStdVecEntries(
8
- t.odr_connections
9
- );
10
- for (const o of i) {
11
- const n = o.connecting_road, e = this.roadList.get(n);
12
- if (!e) {
13
- console.log(`转接道路不存在: ${n}`), console.log(`junction: ${this.id}, connection: ${o.id}`);
14
- continue;
15
- }
16
- if (!e.predecessor.elementId) {
17
- console.log(`转接道路不存在predecessor: ${n}`), console.log(`junction: ${this.id}, connection: ${o.id}`);
18
- continue;
19
- }
20
- if (!e.successor.elementId) {
21
- console.log(`转接道路不存在successor: ${n}`), console.log(`junction: ${this.id}, connection: ${o.id}`);
22
- continue;
23
- }
24
- const { elementId: s, contactPoint: c } = e.predecessor, g = this.roadList.get(s);
25
- if (!g) {
26
- console.log(`进口道路不存在: ${s}`), console.log(`junction: ${this.id}, connection: ${o.id}`);
27
- continue;
28
- }
29
- const { elementId: a, contactPoint: h } = e.successor, r = this.roadList.get(a);
30
- if (!r) {
31
- console.log(`出口道路不存在: ${a}`), console.log(`junction: ${this.id}, connection: ${o.id}`);
32
- continue;
33
- }
34
- const L = f.getStdVecEntries(o.odr_lane_links);
35
- for (const l of L) {
36
- const I = c === "start" ? 0 : g.getLastLaneSection().s0, m = l.from;
37
- if (m === 0) {
38
- console.log("进口车道id为0"), console.log(`junction: ${this.id}, connection: ${o.id}`);
39
- continue;
40
- }
41
- const $ = 0, u = l.to;
42
- if (u === 0) {
43
- console.log("转接车道id为0"), console.log(`junction: ${this.id}, connection: ${o.id}`);
44
- continue;
45
- }
46
- const d = e.getFirstLaneSection().getLane(u);
47
- if (!d || (d == null ? void 0 : d.successor) === 0) {
48
- console.log(
49
- `转接车道不存在successor: ${n}_0_${u}`
50
- ), console.log(`junction: ${this.id}, connection: ${o.id}`);
51
- continue;
52
- }
53
- const S = h === "start" ? 0 : r.getLastLaneSection().s0, v = d.successor;
54
- this.laneLinks.push({
55
- incoming: {
56
- roadId: s,
57
- sectionId: I,
58
- laneId: m
59
- },
60
- connecting: {
61
- roadId: n,
62
- sectionId: $,
63
- laneId: u
64
- },
65
- outgoing: {
66
- roadId: a,
67
- sectionId: S,
68
- laneId: v
69
- }
70
- });
71
- }
72
- }
73
- this.laneLinks.forEach((o) => {
74
- const n = o.incoming, { roadId: e, laneId: s } = n, c = this.incomingLanes.get(e);
75
- c ? c.find((g) => g.laneId === s) || c.push(n) : this.incomingLanes.set(e, [n]);
76
- });
77
- for (const o of this.incomingLanes.values())
78
- o.sort(
79
- (n, e) => +(Math.abs(n.laneId) > Math.abs(e.laneId)) || +(n.laneId === e.laneId) - 1
80
- );
81
- }
82
- /**
83
- * 在路口中,找到进口道的后继转接车道
84
- * @param {string} roadId 进口道道路id
85
- * @param {number} laneId 进口道车道id
86
- * @returns {ILaneInfo[]}
87
- */
88
- getSuccessorForIncoming(t, i) {
89
- const o = [];
90
- return this.laneLinks.forEach((n) => {
91
- n.incoming.roadId === t && n.incoming.laneId === i && o.push(n.connecting);
92
- }), o;
93
- }
94
- /**
95
- * 在路口中,找到出口道的前驱转接车道
96
- * @param {string} roadId 出口道道路id
97
- * @param {number} laneId 出口道车道id
98
- * @returns {ILaneInfo[]}
99
- */
100
- getPredecessorForOutgoing(t, i) {
101
- const o = [];
102
- return this.laneLinks.forEach((n) => {
103
- n.outgoing.roadId === t && n.outgoing.laneId === i && o.push(n.connecting);
104
- }), o;
105
- }
106
- /**
107
- * 获取路口轮廓线
108
- * 要等所有路口对象生成之后才能调用,所以不放在初始化中
109
- * @returns
110
- */
111
- getJunctionOutline() {
112
- if (this.outline)
113
- return this.outline;
114
- const t = [], i = [];
115
- this.incomingLanes.forEach((o) => {
116
- const n = this.wasmLoader.getLane(o[0]);
117
- n && i.push(n);
118
- }), i.sort((o, n) => {
119
- const e = o.drivingAngle < 0 ? o.drivingAngle + 360 : o.drivingAngle, s = n.drivingAngle < 0 ? n.drivingAngle + 360 : n.drivingAngle;
120
- return e - s;
121
- }), i.push(i[0]);
122
- for (let o = 0; o < i.length - 1; o++) {
123
- const n = i[o], e = i[o + 1], s = n.laneSection.allLaneIds, c = n.id > 0 ? s[0] : s[s.length - 1], g = n.laneSection.getLane(c), a = e.laneSection.allLaneIds, h = e.id > 0 ? a[a.length - 1] : a[0], r = e.laneSection.getLane(h), L = g.getLaneEndPoints("outer").reverse(), l = r.getLaneEndPoints("outer").reverse(), I = E.drawBezierBetweenLane(L, l);
124
- t.push(...I);
125
- }
126
- return t.push(t[0]), this.outline = t, t;
127
- }
128
- /**
129
- * 获取此路口各个进口道的停止线
130
- */
131
- getRoadStopLine() {
132
- const t = [];
133
- for (const i of this.incomingLanes) {
134
- const o = i[0], n = i[1], e = this.wasmLoader.getLane(n[0]);
135
- if (!e || e.isDirEqual === void 0)
136
- continue;
137
- const s = e.isDirEqual ? e.laneSection.borders.top : e.laneSection.borders.bottom;
138
- t.push({ roadId: o, line: s });
139
- }
140
- return t;
141
- }
142
- /**
143
- * 获取此路口的所有进口车道
144
- */
145
- getAllIncomingLanes() {
146
- return [...this.incomingLanes.values()].flat();
147
- }
148
- }
149
- export {
150
- R as default
151
- };
@@ -1,48 +0,0 @@
1
- import { ISampledLaneSection } from '../../../types';
2
- import Lane from './lane';
3
- import Road from './road';
4
- export default class LaneSection {
5
- /** 路段id:
6
- * 在道路参考线上,路段起始点与道路起始点的距离
7
- */
8
- s0: number;
9
- road: Road;
10
- /** 路段上下左右的边框 */
11
- borders: {
12
- left: number[][];
13
- right: number[][];
14
- top: number[][];
15
- bottom: number[][];
16
- };
17
- /** 上下左右边框围成的多边形 */
18
- polygon: number[][];
19
- /** 路段内的车道 */
20
- private idToLane;
21
- constructor(odrLanesection: any, road: Road);
22
- /**
23
- * 获取一个车道
24
- * @param id
25
- * @returns
26
- */
27
- getLane(id: number): Lane | undefined;
28
- /**
29
- * 获取所有车道
30
- * @returns
31
- */
32
- get allLanes(): Lane[];
33
- get laneNumber(): number;
34
- /**
35
- * 获取所有车道id,id升序排列
36
- * @returns
37
- */
38
- get allLaneIds(): number[];
39
- /**
40
- * 路段采样后的数据
41
- */
42
- get sampledLaneSection(): ISampledLaneSection;
43
- /**
44
- * 计算路段上下左右边框
45
- * @returns
46
- */
47
- private getBorderLine;
48
- }
@@ -1,82 +0,0 @@
1
- import a from "../common-utils.mjs";
2
- import g from "./lane.mjs";
3
- class m {
4
- constructor(s, r) {
5
- this.s0 = s.s0, this.road = r, this.idToLane = /* @__PURE__ */ new Map(), a.getStdVecEntries(
6
- s.odr_lanes,
7
- !0
8
- ).forEach((l) => {
9
- const n = new g(l, r, this);
10
- this.idToLane.set(n.id, n);
11
- }), this.borders = this.getBorderLine();
12
- const e = [];
13
- e.push(...this.borders.right), e.push(...this.borders.top), e.push(...[...this.borders.left].reverse()), e.push(...[...this.borders.bottom].reverse()), e.push(e[0]), this.polygon = e;
14
- }
15
- /**
16
- * 获取一个车道
17
- * @param id
18
- * @returns
19
- */
20
- getLane(s) {
21
- return this.idToLane.get(s);
22
- }
23
- /**
24
- * 获取所有车道
25
- * @returns
26
- */
27
- get allLanes() {
28
- return [...this.idToLane.values()];
29
- }
30
- get laneNumber() {
31
- return this.idToLane.size;
32
- }
33
- /**
34
- * 获取所有车道id,id升序排列
35
- * @returns
36
- */
37
- get allLaneIds() {
38
- return [...this.idToLane.keys()].sort((s, r) => s - r);
39
- }
40
- /**
41
- * 路段采样后的数据
42
- */
43
- get sampledLaneSection() {
44
- const s = this.allLanes.filter((r) => r.id !== 0);
45
- return {
46
- id: this.s0,
47
- lanePaths: s.map((r) => r.sampledLane)
48
- };
49
- }
50
- /**
51
- * 计算路段上下左右边框
52
- * @returns
53
- */
54
- getBorderLine() {
55
- let s = [], r = [];
56
- const t = [], e = [], l = this.allLaneIds;
57
- return l.filter((n) => n !== 0).forEach((n, p) => {
58
- const o = this.getLane(n), i = o.innerBorder[o.innerBorder.length - 1], u = o.outerBorder[o.outerBorder.length - 1], h = o.innerBorder[0], d = o.outerBorder[0];
59
- p === 0 ? (r = o.outerBorder, t.push(i), e.push(h)) : p === l.length - 2 ? (s = o.outerBorder, t.push(i), e.push(h)) : o.id < 0 ? (a.pointsEqual(
60
- u,
61
- t[t.length - 1]
62
- ) || t.push(u), t.push(i), a.pointsEqual(
63
- d,
64
- e[e.length - 1]
65
- ) || e.push(d), e.push(h)) : (a.pointsEqual(
66
- i,
67
- t[t.length - 1]
68
- ) || t.push(i), t.push(u), a.pointsEqual(
69
- h,
70
- e[e.length - 1]
71
- ) || e.push(h), e.push(d));
72
- }), {
73
- left: s,
74
- right: r,
75
- top: t,
76
- bottom: e
77
- };
78
- }
79
- }
80
- export {
81
- m as default
82
- };