gisviewer-vue3-arcgis 1.0.202 → 1.0.204

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 (28) hide show
  1. package/es/index.d.ts +1 -1
  2. package/es/index.mjs +11 -10
  3. package/es/src/gis-map/gis-map.vue.d.ts +22 -14
  4. package/es/src/gis-map/gis-map.vue.mjs +101 -100
  5. package/es/src/gis-map/index.d.ts +19 -12
  6. package/es/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +7 -3
  7. package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +29 -25
  8. package/es/src/gis-map/utils/signal-control-area-controller/{index.d.ts → edit-area.d.ts} +2 -14
  9. package/es/src/gis-map/utils/signal-control-area-controller/{index.mjs → edit-area.mjs} +40 -162
  10. package/es/src/gis-map/utils/signal-control-area-controller/show-area.d.ts +68 -0
  11. package/es/src/gis-map/utils/signal-control-area-controller/show-area.mjs +806 -0
  12. package/es/src/types/index.d.ts +4 -0
  13. package/lib/index.d.ts +1 -1
  14. package/lib/index.js +1 -1
  15. package/lib/src/gis-map/gis-map.vue.d.ts +22 -14
  16. package/lib/src/gis-map/gis-map.vue.js +1 -1
  17. package/lib/src/gis-map/index.d.ts +19 -12
  18. package/lib/src/gis-map/utils/queue-length.js +1 -1
  19. package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +7 -3
  20. package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -1
  21. package/lib/src/gis-map/utils/signal-control-area-controller/{index.d.ts → edit-area.d.ts} +2 -14
  22. package/lib/src/gis-map/utils/signal-control-area-controller/edit-area.js +1 -0
  23. package/lib/src/gis-map/utils/signal-control-area-controller/show-area.d.ts +68 -0
  24. package/lib/src/gis-map/utils/signal-control-area-controller/show-area.js +1 -0
  25. package/lib/src/gis-map/utils/sketchView.js +1 -1
  26. package/lib/src/types/index.d.ts +4 -0
  27. package/package.json +2 -1
  28. package/lib/src/gis-map/utils/signal-control-area-controller/index.js +0 -1
@@ -274,6 +274,10 @@ export interface IShowSignalControlAreaParams {
274
274
  areaList: any[];
275
275
  style?: string;
276
276
  }
277
+ export interface IFindSignalControlAreaParams {
278
+ type: string;
279
+ id: string;
280
+ }
277
281
  export interface INode {
278
282
  id: string;
279
283
  longitude: number;
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { App } from 'vue';
2
- export * from './src/index';
3
2
  import MapUtils from './src/gis-map/utils';
3
+ export * from './src/index';
4
4
  export { MapUtils };
5
5
  declare const _default: {
6
6
  install: (app: App, options: any) => void;
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("./src/index.js"),r=require("./src/gis-map/utils/index.js"),n=require("./src/gis-map/index.js"),l={install:(e,i)=>{for(const o in s)e.use(s[o]);const{gisviewerAssetsRoot:t}=i;e.config.globalProperties.$gisviewerAssetsRoot=t||""}};exports.MapUtils=r.default;exports.GisMap=n.GisMap;exports.default=l;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("core-js/stable/array/at");const r=require("./src/gis-map/utils/index.js"),s=require("./src/index.js"),n=require("./src/gis-map/index.js"),u={install:(e,i)=>{for(const o in s)e.use(s[o]);const{gisviewerAssetsRoot:t}=i;e.config.globalProperties.$gisviewerAssetsRoot=t||""}};exports.MapUtils=r.default;exports.GisMap=n.GisMap;exports.default=u;
@@ -1,6 +1,6 @@
1
1
  import MapView from '@arcgis/core/views/MapView';
2
2
  import SceneView from '@arcgis/core/views/SceneView';
3
- import { IEditSignalControlAreaParams, IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IMaskParam, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowGreenWaveBandParams, IShowOpenDriveFromFileParams, IShowSignalControlAreaParams, ISignalCountdownProps, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams, IUnselectSumoParams } from '../types';
3
+ import { IEditSignalControlAreaParams, IFindSignalControlAreaParams, IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IMaskParam, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowGreenWaveBandParams, IShowOpenDriveFromFileParams, IShowSignalControlAreaParams, ISignalCountdownProps, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams, IUnselectSumoParams } from '../types';
4
4
  import GreenWaveBandController from './utils/green-wave-band-controller';
5
5
  import HoloFlow from './utils/holo-flow';
6
6
  import MapInitializer from './utils/map-initializer';
@@ -8,7 +8,8 @@ import OpenDriveRenderer from './utils/open-drive-renderer';
8
8
  import Overlay from './utils/overlay';
9
9
  import QueueLength from './utils/queue-length';
10
10
  import RoadConfigTool from './utils/road-config-tool';
11
- import SignalControlAreaController from './utils/signal-control-area-controller';
11
+ import EditSignalArea from './utils/signal-control-area-controller/edit-area';
12
+ import ShowSignalArea from './utils/signal-control-area-controller/show-area';
12
13
  import TrafficFlow from './utils/traffic-flow';
13
14
  declare const _sfc_main: import("vue").DefineComponent<{
14
15
  config: {
@@ -29,7 +30,8 @@ declare const _sfc_main: import("vue").DefineComponent<{
29
30
  overlay: Overlay;
30
31
  queueLength: QueueLength;
31
32
  openDriveRenderer: OpenDriveRenderer;
32
- signalControlAreaController: SignalControlAreaController;
33
+ editSignalAreaController: EditSignalArea;
34
+ showSignalAreaController: ShowSignalArea;
33
35
  greenWaveBandController: GreenWaveBandController;
34
36
  showLogDiv: import("vue").Ref<boolean>;
35
37
  appDataStore: import("pinia").Store<"appData", {
@@ -117,15 +119,21 @@ declare const _sfc_main: import("vue").DefineComponent<{
117
119
  status: number;
118
120
  message: string;
119
121
  }>;
120
- showSignalControlArea: (params: IShowSignalControlAreaParams) => import("../types").IResult;
121
- clearSignalControlArea: () => void;
122
- locateSignalControlArea: (params: {
123
- id: string;
124
- }) => Promise<import("../types").IResult>;
125
- highlightSignalControlArea: (params: {
126
- id: string;
127
- }) => Promise<import("../types").IResult>;
128
- resetHighlightSignalControlArea: () => import("../types").IResult;
122
+ showSignalControlArea: (params: IShowSignalControlAreaParams) => Promise<import("../types").IResult>;
123
+ clearSignalControlArea: () => Promise<import("../types").IResult>;
124
+ setSignalControlAreaVisibility: (params: ILayerVisibleParams) => import("../types").IResult;
125
+ locateSignalControlArea: (params: IFindSignalControlAreaParams) => Promise<import("../types").IResult>;
126
+ highlightSignalControlArea: (params: IFindSignalControlAreaParams) => Promise<{
127
+ status: number;
128
+ message: string;
129
+ }>;
130
+ resetHighlightSignalControlArea: () => Promise<{
131
+ status: number;
132
+ message: string;
133
+ }> | {
134
+ status: number;
135
+ message: string;
136
+ };
129
137
  showSubSignalControlArea: (params: any) => import("../types").IResult;
130
138
  editSubSignalControlArea: (params: IEditSignalControlAreaParams) => Promise<import("../types").IResult> | {
131
139
  status: number;
@@ -137,10 +145,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
137
145
  };
138
146
  selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
139
147
  unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
140
- changeSubSignalControlAreaBorderVisibility: (params: any) => void | {
148
+ changeSubSignalControlAreaBorderVisibility: (params: any) => {
141
149
  status: number;
142
150
  message: string;
143
- };
151
+ } | undefined;
144
152
  addGreenWaveBand: (params: IEditSignalControlAreaParams) => void;
145
153
  stopAddGreenWaveBand: () => {
146
154
  status: number;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),C=require("./stores/index.js");require("./style/index.css");const Ge=require("./utils/detect-gpu.js"),O=require("./utils/green-wave-band-controller/index.js"),We=require("./utils/holo-flow/index.js"),ze=require("./utils/holo-flow/signal-countdown-panel.vue.js"),je=require("./utils/map-initializer.js"),A=require("./utils/open-drive-renderer/index.js"),L=require("./utils/overlay.js"),Qe=require("./utils/queue-length.js"),D=require("./utils/road-config-tool/index.js"),T=require("./utils/signal-control-area-controller/index.js"),Ze=require("./utils/traffic-flow.js"),Ke={class:"gis-viewer"},Ue={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},Je=a.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(_,{expose:B,emit:q}){const f=a.ref(null);let o,u,l,i,r,s,p,t,n,d;const S=a.ref(!1);C.registerStore();const x=C.default.useAppDataStore,b=a.reactive([]);Ge.default(),a.onMounted(async()=>{if(!f.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(S.value=!S.value)});const e=a.getCurrentInstance(),{$gisviewerAssetsRoot:g}=e.appContext.config.globalProperties,c=await(await fetch(k.config)).json();c.assetsRoot=k.assetsRoot||g,x.mapConfig=c,u=new je.default,o=await u.initialize({container:f.value,mapConfig:c,markerClickCallback:(m,y,h,Pe)=>{w("markerClick",m,y,h,Pe)},mapClickCallback:(m,y,h)=>{w("mapClick",m,y,h)}}),r=new We.default(o,b),await r.init(),w("mapLoaded")}),a.onUnmounted(()=>{n==null||n.clearSignalControlArea(),t==null||t.clearOpenDrive(),r.clearHoloTrace(),r.clearHoloSignal(),i==null||i.disconnectTrafficFlow()});const I=a.computed(()=>o),V=()=>{const e=C.default.useAppDataStore;e.saveTrackLog=!0},M=()=>{r.downloadTrackLog()},N=()=>{v("vehicleId")},E=()=>{v("plateNumber")},H=async e=>await u.setMapCenter(e),P=async e=>await u.setMapCamera(e),G=async e=>await u.lookAt(e),W=e=>u.setLayerVisibility(e),z=(e,g)=>u.requestCoordinateTransform(e,g),j=e=>{u.cancelCoordinateTransform(e)},Q=e=>{u.setMapZoomRange(e)},Z=e=>(l||(l=new D.default(o)),l.showLaneNumber(e)),K=()=>{l==null||l.clearLaneNumber()},U=async e=>(l||(l=new D.default(o)),await l.initializeSearch(e)),J=async()=>l==null?void 0:l.calCrossIndicatorArea(),X=async()=>{},Y=async(e,g)=>{i||(i=new Ze.default(o)),i.connectTrafficFlow(e,g)},F=()=>{i==null||i.disconnectTrafficFlow()},R=async e=>{r.handleVehicleTraceData(e)},$=()=>{r.clearHoloTrace()},ee=e=>{r.setInterpolate(e)},te=async e=>{await r.handleSignalData(e)},ne=()=>{r.clearHoloSignal()},ae=e=>{i==null||i.toggleTrafficInfo(e),r==null||r.toggleTrafficInfo(e)},re=e=>{r==null||r.togglePause(e)},se=e=>{i==null||i.toggleTrafficObject(e),r==null||r.toggleTrafficObject(e)},v=e=>{r==null||r.updatePanelContent(e)},oe=async e=>(s||(s=new L.default(o)),s.addOverlays(e)),ie=e=>(s||(s=new L.default(o)),s.addMask(e)),ce=()=>{s==null||s.removeMask()},le=e=>s==null?void 0:s.removeOverlaysByType(e),ue=e=>s==null?void 0:s.removeOverlaysById(e),de=()=>s==null?void 0:s.removeAllOverlays(),ge=()=>{s==null||s.showAllOverlays()},me=e=>{p||(p=new Qe.default(o)),p.updateQueueLength(e)},pe=()=>{p==null||p.removeQueueLength()},fe=async(e,g)=>(t||(t=new A.default(o)),await t.showOpenDriveFromServer(e,g)),Se=async e=>(t||(t=new A.default(o)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),ve=async()=>await(t==null?void 0:t.clearOpenDrive()),we=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},ye=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},he=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Ce=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},be=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},ke=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Oe=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ae=e=>(n||(n=new T.default(o)),n.showSignalControlArea(e)),Le=()=>{n==null||n.clearSignalControlArea()},De=async e=>n?await n.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Te=async e=>n?await n.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},_e=()=>n?n.resetHighlight():{status:-1,message:"未加载信号控制区"},Be=e=>(n||(n=new T.default(o)),n.showSubSignalControlArea(e)),qe=e=>n?n.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},xe=()=>n?n.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},Ie=e=>n?n.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Ve=e=>n?n.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Me=e=>n?n.changeSubSignalControlAreaBorderVisibility(e):{status:-1,message:"未加载信号控制区"},Ne=e=>(d||(d=new O.default(o)),d.addGreenWaveBand(e)),Ee=()=>{if(!d)return{status:-1,message:"未加载绿波带"};d.stopAddGreenWaveBand()},He=async e=>(d||(d=new O.default(o)),await d.showGreenWaveBand(e)),k=_,w=q;return B({mapViewer:I,setLayerVisibility:W,setMapCenter:H,lookAt:G,setMapCamera:P,setMapZoomRange:Q,requestCoordinateTransform:z,cancelCoordinateTransform:j,addOverlays:oe,addMask:ie,removeMask:ce,showAllOverlays:ge,removeOverlaysByType:le,removeOverlaysById:ue,removeAllOverlays:de,showLaneNumber:Z,clearLaneNumber:K,initializeAreaTool:U,calCrossIndicatorArea:J,calRoadIndicatorArea:X,connectCarFlow:Y,disconnectCarFlow:F,handleHoloVehicleTraceData:R,clearHoloTrace:$,handleHoloSignalData:te,clearHoloSignal:ne,setInterpolate:ee,toggleTrafficInfo:ae,toggleTrafficObject:se,toggleVehicleInfo:v,togglePause:re,updateQueueLength:me,removeQueueLength:pe,showOpenDriveFromServer:fe,showOpenDriveFromFile:Se,clearOpenDrive:ve,geometrySearchInOpenDrive:Ce,findSumoInOpenDrive:we,selectSumoInOpenDrive:ye,unselectSumoInOpenDrive:he,getSumoInfo:be,splitOpenDriveLane:ke,clearSplitOpenDriveLane:Oe,showSignalControlArea:Ae,clearSignalControlArea:Le,locateSignalControlArea:De,highlightSignalControlArea:Te,resetHighlightSignalControlArea:_e,showSubSignalControlArea:Be,editSubSignalControlArea:qe,stopEditSubSignalControlArea:xe,selectSubSignalControlAreaCross:Ie,unselectSubSignalControlAreaCross:Ve,changeSubSignalControlAreaBorderVisibility:Me,addGreenWaveBand:Ne,stopAddGreenWaveBand:Ee,showGreenWaveBand:He}),(e,g)=>(a.openBlock(),a.createElementBlock("div",Ke,[a.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:f},[a.withDirectives(a.createElementVNode("div",Ue,[a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:V}," 开始记录 "),a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:M}," 下载日志 "),a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:N}," 显示车辆id "),a.createElementVNode("button",{onClick:E},"显示车辆号牌")],512),[[a.vShow,S.value]])],512),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(b,(c,m)=>(a.openBlock(),a.createBlock(ze.default,{key:m,"display-mode":c.displayMode,"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","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=Je;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),b=require("./stores/index.js");require("./style/index.css");const We=require("./utils/detect-gpu.js"),A=require("./utils/green-wave-band-controller/index.js"),ze=require("./utils/holo-flow/index.js"),je=require("./utils/holo-flow/signal-countdown-panel.vue.js"),Qe=require("./utils/map-initializer.js"),L=require("./utils/open-drive-renderer/index.js"),D=require("./utils/overlay.js"),Ze=require("./utils/queue-length.js"),T=require("./utils/road-config-tool/index.js"),Ke=require("./utils/signal-control-area-controller/edit-area.js"),Ue=require("./utils/signal-control-area-controller/show-area.js"),Je=require("./utils/traffic-flow.js"),Xe={class:"gis-viewer"},Ye={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},Fe=a.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(_,{expose:B,emit:q}){const S=a.ref(null);let o,d,l,i,n,r,f,t,u,s,m;const y=a.ref(!1);b.registerStore();const I=b.default.useAppDataStore,k=a.reactive([]);We.default(),a.onMounted(async()=>{if(!S.value)return;document.addEventListener("keydown",p=>{p.ctrlKey&&p.key==="i"&&(y.value=!y.value)});const e=a.getCurrentInstance(),{$gisviewerAssetsRoot:g}=e.appContext.config.globalProperties,c=await(await fetch(O.config)).json();c.assetsRoot=O.assetsRoot||g,I.mapConfig=c,d=new Qe.default,o=await d.initialize({container:S.value,mapConfig:c,markerClickCallback:(p,C,h,Ge)=>{w("markerClick",p,C,h,Ge)},mapClickCallback:(p,C,h)=>{w("mapClick",p,C,h)}}),n=new ze.default(o,k),await n.init(),w("mapLoaded")}),a.onUnmounted(()=>{s==null||s.clearSignalControlArea(),t==null||t.clearOpenDrive(),n.clearHoloTrace(),n.clearHoloSignal(),i==null||i.disconnectTrafficFlow()});const V=a.computed(()=>o),x=()=>{const e=b.default.useAppDataStore;e.saveTrackLog=!0},M=()=>{n.downloadTrackLog()},N=()=>{v("vehicleId")},E=()=>{v("plateNumber")},H=async e=>await d.setMapCenter(e),P=async e=>await d.setMapCamera(e),G=async e=>await d.lookAt(e),W=e=>d.setLayerVisibility(e),z=(e,g)=>d.requestCoordinateTransform(e,g),j=e=>{d.cancelCoordinateTransform(e)},Q=e=>{d.setMapZoomRange(e)},Z=e=>(l||(l=new T.default(o)),l.showLaneNumber(e)),K=()=>{l==null||l.clearLaneNumber()},U=async e=>(l||(l=new T.default(o)),await l.initializeSearch(e)),J=async()=>l==null?void 0:l.calCrossIndicatorArea(),X=async()=>{},Y=async(e,g)=>{i||(i=new Je.default(o)),i.connectTrafficFlow(e,g)},F=()=>{i==null||i.disconnectTrafficFlow()},R=async e=>{n.handleVehicleTraceData(e)},$=()=>{n.clearHoloTrace()},ee=e=>{n.setInterpolate(e)},te=async e=>{await n.handleSignalData(e)},ae=()=>{n.clearHoloSignal()},ne=e=>{i==null||i.toggleTrafficInfo(e),n==null||n.toggleTrafficInfo(e)},re=e=>{n==null||n.togglePause(e)},se=e=>{i==null||i.toggleTrafficObject(e),n==null||n.toggleTrafficObject(e)},v=e=>{n==null||n.updatePanelContent(e)},oe=async e=>(r||(r=new D.default(o)),r.addOverlays(e)),ie=e=>(r||(r=new D.default(o)),r.addMask(e)),ce=()=>{r==null||r.removeMask()},le=e=>r==null?void 0:r.removeOverlaysByType(e),ue=e=>r==null?void 0:r.removeOverlaysById(e),de=()=>r==null?void 0:r.removeAllOverlays(),me=()=>{r==null||r.showAllOverlays()},ge=e=>{f||(f=new Ze.default(o)),f.updateQueueLength(e)},pe=()=>{f==null||f.removeQueueLength()},fe=async(e,g)=>(t||(t=new L.default(o)),await t.showOpenDriveFromServer(e,g)),Se=async e=>(t||(t=new L.default(o)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),ye=async()=>await(t==null?void 0:t.clearOpenDrive()),ve=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},we=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Ce=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},he=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},be=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},ke=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Oe=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ae=async e=>(s||(s=new Ue.default(o)),await s.showSignalControlArea(e)),Le=async()=>await(s==null?void 0:s.clearSignalControlArea()),De=e=>s==null?void 0:s.setLayerVisibility(e),Te=async e=>s?await(s==null?void 0:s.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},_e=async e=>s?await s.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Be=()=>s?s.resetHighlight():{status:-1,message:"未加载信号控制区"},qe=e=>(u||(u=new Ke.default(o)),u.showSubSignalControlArea(e)),Ie=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Ve=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},xe=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Me=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Ne=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},Ee=e=>(m||(m=new A.default(o)),m.addGreenWaveBand(e)),He=()=>{if(!m)return{status:-1,message:"未加载绿波带"};m.stopAddGreenWaveBand()},Pe=async e=>(m||(m=new A.default(o)),await m.showGreenWaveBand(e)),O=_,w=q;return B({mapViewer:V,setLayerVisibility:W,setMapCenter:H,lookAt:G,setMapCamera:P,setMapZoomRange:Q,requestCoordinateTransform:z,cancelCoordinateTransform:j,addOverlays:oe,addMask:ie,removeMask:ce,showAllOverlays:me,removeOverlaysByType:le,removeOverlaysById:ue,removeAllOverlays:de,showLaneNumber:Z,clearLaneNumber:K,initializeAreaTool:U,calCrossIndicatorArea:J,calRoadIndicatorArea:X,connectCarFlow:Y,disconnectCarFlow:F,handleHoloVehicleTraceData:R,clearHoloTrace:$,handleHoloSignalData:te,clearHoloSignal:ae,setInterpolate:ee,toggleTrafficInfo:ne,toggleTrafficObject:se,toggleVehicleInfo:v,togglePause:re,updateQueueLength:ge,removeQueueLength:pe,showOpenDriveFromServer:fe,showOpenDriveFromFile:Se,clearOpenDrive:ye,geometrySearchInOpenDrive:he,findSumoInOpenDrive:ve,selectSumoInOpenDrive:we,unselectSumoInOpenDrive:Ce,getSumoInfo:be,splitOpenDriveLane:ke,clearSplitOpenDriveLane:Oe,showSignalControlArea:Ae,clearSignalControlArea:Le,setSignalControlAreaVisibility:De,locateSignalControlArea:Te,highlightSignalControlArea:_e,resetHighlightSignalControlArea:Be,showSubSignalControlArea:qe,editSubSignalControlArea:Ie,stopEditSubSignalControlArea:Ve,selectSubSignalControlAreaCross:xe,unselectSubSignalControlAreaCross:Me,changeSubSignalControlAreaBorderVisibility:Ne,addGreenWaveBand:Ee,stopAddGreenWaveBand:He,showGreenWaveBand:Pe}),(e,g)=>(a.openBlock(),a.createElementBlock("div",Xe,[a.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:S},[a.withDirectives(a.createElementVNode("div",Ye,[a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:x}," 开始记录 "),a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:M}," 下载日志 "),a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:N}," 显示车辆id "),a.createElementVNode("button",{onClick:E},"显示车辆号牌")],512),[[a.vShow,y.value]])],512),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(k,(c,p)=>(a.openBlock(),a.createBlock(je.default,{key:p,"display-mode":c.displayMode,"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","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=Fe;
@@ -17,7 +17,8 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
17
17
  overlay: import("./utils/overlay").default;
18
18
  queueLength: import("./utils/queue-length").default;
19
19
  openDriveRenderer: import("./utils/open-drive-renderer").default;
20
- signalControlAreaController: import("./utils/signal-control-area-controller").default;
20
+ editSignalAreaController: import("./utils/signal-control-area-controller/edit-area").default;
21
+ showSignalAreaController: import("./utils/signal-control-area-controller/show-area").default;
21
22
  greenWaveBandController: import("./utils/green-wave-band-controller").default;
22
23
  showLogDiv: import("vue").Ref<boolean>;
23
24
  appDataStore: import("pinia").Store<"appData", {
@@ -105,15 +106,21 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
105
106
  status: number;
106
107
  message: string;
107
108
  }>;
108
- showSignalControlArea: (params: import("../types").IShowSignalControlAreaParams) => import("../types").IResult;
109
- clearSignalControlArea: () => void;
110
- locateSignalControlArea: (params: {
111
- id: string;
112
- }) => Promise<import("../types").IResult>;
113
- highlightSignalControlArea: (params: {
114
- id: string;
115
- }) => Promise<import("../types").IResult>;
116
- resetHighlightSignalControlArea: () => import("../types").IResult;
109
+ showSignalControlArea: (params: import("../types").IShowSignalControlAreaParams) => Promise<import("../types").IResult>;
110
+ clearSignalControlArea: () => Promise<import("../types").IResult>;
111
+ setSignalControlAreaVisibility: (params: import("../types").ILayerVisibleParams) => import("../types").IResult;
112
+ locateSignalControlArea: (params: import("../types").IFindSignalControlAreaParams) => Promise<import("../types").IResult>;
113
+ highlightSignalControlArea: (params: import("../types").IFindSignalControlAreaParams) => Promise<{
114
+ status: number;
115
+ message: string;
116
+ }>;
117
+ resetHighlightSignalControlArea: () => Promise<{
118
+ status: number;
119
+ message: string;
120
+ }> | {
121
+ status: number;
122
+ message: string;
123
+ };
117
124
  showSubSignalControlArea: (params: any) => import("../types").IResult;
118
125
  editSubSignalControlArea: (params: import("../types").IEditSignalControlAreaParams) => Promise<import("../types").IResult> | {
119
126
  status: number;
@@ -125,10 +132,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
125
132
  };
126
133
  selectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
127
134
  unselectSubSignalControlAreaCross: (id: string) => import("../types").IResult;
128
- changeSubSignalControlAreaBorderVisibility: (params: any) => void | {
135
+ changeSubSignalControlAreaBorderVisibility: (params: any) => {
129
136
  status: number;
130
137
  message: string;
131
- };
138
+ } | undefined;
132
139
  addGreenWaveBand: (params: import("../types").IEditSignalControlAreaParams) => void;
133
140
  stopAddGreenWaveBand: () => {
134
141
  status: number;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("../stores/index.js"),q=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/helpers"),P=require("@turf/destination"),C=require("@arcgis/core/Graphic"),S=require("@turf/intersect"),w=require("@turf/buffer"),h=require("@turf/area");function O(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const p=O(b);class v{constructor(e){this.initialized=!1,this.lanePolygonMap=new Map,this.view=e;const t=m.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.queueLengthLayer=new q,this.view.map.add(this.queueLengthLayer)}async initializeLaneGraphic(){if(!this.mapConfig.lanePolygonLayer)return;const e=`${this.mapConfig.assetsRoot}/${this.mapConfig.lanePolygonLayer}`,n=await(await fetch(e)).json(),{features:i}=n;i.forEach(s=>{const{properties:o,geometry:a}=s,l=p.polygon(a.coordinates,{code:o.code,laneDirection:o.laneDirection,stopLineCenter:o.stopLineCenter});this.lanePolygonMap.set(o.code,l)}),this.initialized=!0}async updateQueueLength(e){if(this.initialized||await this.initializeLaneGraphic(),this.lanePolygonMap.size!==0)for(const t of e){const n=String(t.laneId),i=`${t.crossNo}+${n[0]}+${n[1]}`,s=this.lanePolygonMap.get(i);if(!s)continue;const o=this.queueLengthLayer.graphics.find(a=>a.getAttribute("code")===i);o&&this.queueLengthLayer.remove(o),t.queueLength!==0&&this.generateQueuePolygon(s,t.queueLength)}}removeQueueLength(){this.queueLengthLayer.removeAll()}generateQueuePolygon(e,t){const n=e.properties.laneDirection,i=JSON.parse(e.properties.stopLineCenter),s=p.point(i),o=n>0?n-180:n+180,a=P(s,t,o,{units:"meters"}),l=p.lineString([i,a.geometry.coordinates]),f=w(l,10,{units:"meters"}),c=S(e,f);if(!c)return;const d=h(c.geometry),y=h(e),g=d/y,u=g>.8?[139,0,0,.6]:g>.6?[255,165,0,.5]:[46,139,87,.5],L=new C({geometry:{type:"polygon",rings:c==null?void 0:c.geometry.coordinates},symbol:{type:"polygon-3d",symbolLayers:[{type:"fill",material:{color:u},outline:{color:[u[0],u[1],u[2]],size:3}}]},attributes:{code:e.properties.code}});this.queueLengthLayer.add(L)}}exports.default=v;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("../stores/index.js"),q=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/helpers"),P=require("@turf/destination"),C=require("@arcgis/core/Graphic"),S=require("@turf/intersect"),w=require("@turf/buffer"),f=require("@turf/area");function O(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const p=O(b);class v{constructor(e){this.initialized=!1,this.lanePolygonMap=new Map,this.view=e;const t=m.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.queueLengthLayer=new q,this.view.map.add(this.queueLengthLayer)}async initializeLaneGraphic(){if(!this.mapConfig.lanePolygonLayer)return;const e=`${this.mapConfig.assetsRoot}/${this.mapConfig.lanePolygonLayer}`,n=await(await fetch(e)).json(),{features:i}=n;i.forEach(s=>{const{properties:o,geometry:a}=s,l=p.polygon(a.coordinates,{code:o.code,laneDirection:o.laneDirection,stopLineCenter:o.stopLineCenter});this.lanePolygonMap.set(o.code,l)}),this.initialized=!0}async updateQueueLength(e){if(this.initialized||await this.initializeLaneGraphic(),this.lanePolygonMap.size!==0)for(const t of e){const n=String(t.laneId),i=`${t.crossNo}+${n[0]}+${n[1]}`,s=this.lanePolygonMap.get(i);if(!s)continue;const o=this.queueLengthLayer.graphics.find(a=>a.getAttribute("code")===i);o&&this.queueLengthLayer.remove(o),t.queueLength!==0&&this.generateQueuePolygon(s,t.queueLength)}}removeQueueLength(){this.queueLengthLayer.removeAll()}generateQueuePolygon(e,t){const n=e.properties.laneDirection,i=JSON.parse(e.properties.stopLineCenter),s=p.point(i),o=n>0?n-180:n+180,a=P(s,t,o,{units:"meters"}),l=p.lineString([i,a.geometry.coordinates]),h=w(l,10,{units:"meters"}),c=S(e,h);if(!c)return;const d=f(c.geometry),y=f(e),g=d/y,u=g>.8?[139,0,0,.6]:g>.6?[255,165,0,.5]:[46,139,87,.5],L=new C({geometry:{type:"polygon",rings:c==null?void 0:c.geometry.coordinates},symbol:{type:"polygon-3d",symbolLayers:[{type:"fill",material:{color:u},outline:{color:[u[0],u[1],u[2]],size:3}}]},attributes:{code:e.properties.code}});this.queueLengthLayer.add(L)}}exports.default=v;
@@ -13,12 +13,16 @@ export default class DistrictController {
13
13
  name: string;
14
14
  parentId: string;
15
15
  parentName: string;
16
- crosses: ICross[];
16
+ signals: ICross[];
17
17
  subDistricts: DistrictController[];
18
18
  areaColor: number[];
19
- crossCount: number;
19
+ signalCount: number;
20
20
  subDistrictCount: number;
21
21
  constructor(params: any, style: string);
22
- getAllCrossCoordinates(): number[][];
22
+ /**
23
+ * 获取区控/子区下的所有信号机
24
+ * @returns
25
+ */
26
+ getAllSignalCoordinates(): number[][];
23
27
  }
24
28
  export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("../common-utils.js");class o{constructor(t,e){this.parentName="",this.crosses=[],this.subDistricts=[],this.crossCount=0,this.subDistrictCount=0,this.id=t.name,this.name=t.areaDesc,this.parentId=t.parentId,this.areaColor=e==="alarm"?[255,0,0]:[61,139,249];for(const s of t.children)if(s.children){const i=new o(s,e);i.id=s.id,i.name=`SS ${s.name}`,i.parentName=this.name,this.subDistricts.push(i),this.subDistrictCount++,this.crossCount+=i.crossCount}else if(r.default.isCoordinateValid(s)){const i={id:s.id,name:s.name,parentId:s.parentId,latitude:Number(s.latitude),longitude:Number(s.longitude),signalId:s.id,nodeId:s.nodeId,isKey:s.isKey===1};this.crosses.push(i),this.crossCount++}}getAllCrossCoordinates(){const t=[];for(const e of this.crosses)t.push([e.longitude,e.latitude]);for(const e of this.subDistricts)t.push(...e.getAllCrossCoordinates());return t}}exports.default=o;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../common-utils.js");class n{constructor(i,e){this.parentName="",this.signals=[],this.subDistricts=[],this.signalCount=0,this.subDistrictCount=0,this.id=i.name,this.name=i.areaDesc,this.parentId=i.parentId,this.areaColor=e==="alarm"?[255,0,0]:[61,139,249];for(const t of i.children)if(t.children){const s=new n(t,e);s.id=t.id,s.name=`SS ${t.name}`,s.parentId=this.id,s.parentName=this.name,this.subDistricts.push(s),this.subDistrictCount++,this.signalCount+=s.signalCount}else if(o.default.isCoordinateValid(t)){const s={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId,nodeId:t.id,isKey:t.isKey===1};this.signals.push(s),this.signalCount++}}getAllSignalCoordinates(){const i=[];for(const e of this.signals)i.push([e.longitude,e.latitude]);for(const e of this.subDistricts)i.push(...e.getAllSignalCoordinates());return i}}exports.default=n;
@@ -1,30 +1,19 @@
1
- import { IEditSignalControlAreaParams, IResult, IShowSignalControlAreaParams } from '../../../types';
1
+ import { IEditSignalControlAreaParams, IResult } from '../../../types';
2
2
  export default class SignalControlAreaController {
3
3
  private view;
4
4
  private districtControllerLayer;
5
5
  private subDistrictControllerLayer;
6
6
  private crossLayer;
7
- private highlightLayer;
8
- private scaleWatcher?;
9
7
  private viewClickWatcher?;
10
8
  private readonly crossScale;
11
9
  private hasGpu;
12
10
  private openDriveServer;
13
11
  constructor(view: __esri.MapView | __esri.SceneView);
14
12
  /**
15
- * 显示信控区控与子区
13
+ * 显示单个子区
16
14
  * @param params
17
15
  * @returns
18
16
  */
19
- showSignalControlArea(params: IShowSignalControlAreaParams): IResult;
20
- clearSignalControlArea(): IResult;
21
- locateSignalControlArea(params: {
22
- id: string;
23
- }): Promise<IResult>;
24
- highlightSignalControlArea(params: {
25
- id: string;
26
- }): Promise<IResult>;
27
- resetHighlight(): IResult;
28
17
  showSubSignalControlArea(params: any): IResult;
29
18
  /**
30
19
  * 点击路口时
@@ -57,7 +46,6 @@ export default class SignalControlAreaController {
57
46
  * @param id
58
47
  */
59
48
  unselectSubSignalControlAreaCross(id: string): IResult;
60
- changeSubSignalControlAreaBorderVisibility(visible: boolean): void;
61
49
  /**
62
50
  * 在区控\子区\路口图层中查找对应的graphic
63
51
  * @param id
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),d=require("@arcgis/core/layers/GraphicsLayer"),h=require("@turf/buffer"),p=require("@turf/convex"),b=require("@turf/helpers"),f=require("axios"),C=require("concaveman"),I=require("../../stores/index.js");function S(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const o=S(b);class v{constructor(e){var i;this.crossScale=5e3,this.hasGpu=!1,this.crossIdsInDistrict=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const r=I.default.useAppDataStore.mapConfig;this.openDriveServer=(i=r.openDriveServer)==null?void 0:i.url,this.districtControllerLayer=new d({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new d({id:"subDistrictControllerLayer"}),this.crossLayer=new d({id:"crossLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer])}showSubSignalControlArea(e){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const r=e.children.map(i=>{const s={...i,selected:!0};return new c({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossSymbolInSubDistrict(s),attributes:s})});return this.crossLayer.addMany(r),this.view.goTo(r,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}async handleViewClick(e){var s;const r=(s=(await this.view.hitTest(e,{include:[this.crossLayer]})).results)==null?void 0:s.filter(a=>a.type==="graphic");if(r.length===0)return;const i=r[0].graphic;i.getAttribute("selected")?i.getAttribute("signalId")&&(this.removeCrossCallback&&this.removeCrossCallback({id:i.getAttribute("id")}),i.setAttribute("selected",!1),i.symbol=this.getCrossSymbolInSubDistrict(i.attributes)):(i.getAttribute("signalId")&&(this.addCrossCallback&&this.addCrossCallback(i.attributes),i.setAttribute("selected",!0),i.symbol=this.getCrossSymbolInSubDistrict(i.attributes)),await this.showNearbyCrosses(i.getAttribute("id")))}async showNearbyCrosses(e){const t=await f.get(`http://${this.openDriveServer}/api/computable/getRelatedNodesForNode`,{params:{nodeIds:e}});if(t.status===200)if(t.data.status===0){const r=t.data.result,i=[];for(const s of r){const a=s.nodeId;if(a.startsWith("-"))continue;if(s.signalId&&!this.crossIdsInDistrict.includes(a)){console.log("不是此区控内的路口",a);continue}if(this.crossLayer.graphics.some(u=>u.getAttribute("id")===a))continue;const m=new c({geometry:{type:"point",x:s.lon,y:s.lat},symbol:this.getCrossSymbolInSubDistrict(s),attributes:{id:a,name:s.name,signalId:s.signalId,selected:!1}});i.push(m)}return this.crossLayer.addMany(i),{status:0,message:"ok"}}else return{status:-1,message:t.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalControlArea(e){if(e.odrServer){this.openDriveServer=e.odrServer,this.crossIdsInDistrict=e.crossesInArea.map(s=>s.id);const t=o.featureCollection(e.crossesInArea.map(s=>o.point([s.longitude,s.latitude]))),r=p(t);r&&(this.districtControllerLayer.removeAll(),this.districtControllerLayer.add(new c({geometry:{type:"polygon",rings:r.geometry.coordinates},symbol:{type:"simple-fill",style:"none",outline:{color:[61,139,249],width:3,style:"long-dash"}}}))),this.addCrossCallback=e.addCrossCallback,this.removeCrossCallback=e.removeCrossCallback,this.viewClickWatcher||(this.viewClickWatcher=this.view.on("click",async s=>{await this.handleViewClick(s)}));const i=this.crossLayer.graphics.toArray().map(s=>s.getAttribute("id")).join(",");return await this.showNearbyCrosses(i)}else return{status:1,message:"未配置OpenDriveServer"}}stopEditSubSignalControlArea(){var t;(t=this.viewClickWatcher)==null||t.remove(),this.viewClickWatcher=void 0;const e=this.crossLayer.graphics.filter(r=>r.getAttribute("signalId")===""||!r.getAttribute("signalId")||!r.getAttribute("selected"));this.crossLayer.removeMany(e.toArray()),this.districtControllerLayer.removeAll()}selectSubSignalControlAreaCross(e){return this.crossLayer.graphics.forEach(t=>{if(t.getAttribute("id")===e&&!t.getAttribute("selected"))return t.setAttribute("selected",!0),t.symbol=this.getCrossSymbolInSubDistrict(t.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}unselectSubSignalControlAreaCross(e){return this.crossLayer.graphics.forEach(t=>{if(t.getAttribute("id")===e&&t.getAttribute("selected"))return t.setAttribute("selected",!1),t.symbol=this.getCrossSymbolInSubDistrict(t.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e)),t}drawArea(e,t){const r=e.getAllSignalCoordinates();if(r.length>=2){let s=null;if(r.length===2)s=o.lineString(r);else{if(t){const y=o.featureCollection(r.map(g=>o.point(g)));s=p(y)}else{const y=C(r,.5);y.length>=4&&(s=o.polygon([y]))}s||(s=o.lineString(r))}const a=h(s.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const m={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.signalCount,subDistrictCount:e.subDistrictCount},u=new c({geometry:{type:"polygon",rings:a.geometry.coordinates},symbol:{type:"simple-fill",style:"none",outline:{color:t?[111,100,255]:[5,196,104],width:3,style:t?"long-dash":"solid"}},attributes:m,popupTemplate:{title:`${e.name}`,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(u):this.subDistrictControllerLayer.add(u)}for(const s of e.subDistricts)this.drawArea(s,!1);const i=[];e.signals.forEach(s=>{const a={type:"cross",id:s.id,name:s.name,signalId:s.signalId,nodeId:s.nodeId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:s.isKey},l=new c({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossGraphicSymbol(a,"marker"),attributes:a,popupTemplate:{title:s.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]}});i.push(l)}),this.crossLayer.addMany(i)}getCrossSymbolInSubDistrict(e){return e.signalId&&e.signalId!==""?{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${e.selected?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz.png",width:"20px",height:"20px"}}getCrossGraphicSymbol(e,t){const r=e.isKey;if(t==="marker")return{type:"simple-marker",style:"circle",color:r?[254,172,22]:[5,116,255],size:r?12:8,outline:{color:"white",width:1}};if(t==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:r?30:15,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r?40:20,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${r?"gis_gjxklk_orange":"gis_xhj_blue"}.png`}]}}}}}exports.default=v;
@@ -0,0 +1,68 @@
1
+ import { IFindSignalControlAreaParams, ILayerVisibleParams, IResult, IShowSignalControlAreaParams } from '../../../types';
2
+ export default class SignalControlAreaController1 {
3
+ private view;
4
+ private hasGpu;
5
+ private openDriveServer;
6
+ /** 区控虚线图层 */
7
+ private districtControllerDashLayer;
8
+ /** 区控虚线图层,区控由透明实线+不透明虚线组成 */
9
+ private districtControllerSolidLayer;
10
+ /** 子区图层 */
11
+ private subDistrictControllerLayer;
12
+ /** 信号机图层 */
13
+ private signalMarkerLayer;
14
+ private signalPictureLayer;
15
+ private districtControllerOid;
16
+ private subDistrictControllerOid;
17
+ private signalOid;
18
+ constructor(view: __esri.MapView | __esri.SceneView);
19
+ /** 暂存等待绘制的子区graphic */
20
+ private subDistrictGraphics;
21
+ /**
22
+ * 显示所有区控、子区、信号机
23
+ * @param params
24
+ * @returns
25
+ */
26
+ showSignalControlArea(params: IShowSignalControlAreaParams): Promise<IResult>;
27
+ /**
28
+ * 清空区控、子区、信号机
29
+ * @returns
30
+ */
31
+ clearSignalControlArea(): Promise<IResult>;
32
+ /**
33
+ * 设置区控、子区、信号机图层可见性
34
+ * @param layerName
35
+ * @param visible
36
+ */
37
+ setLayerVisibility(params: ILayerVisibleParams): IResult;
38
+ /**
39
+ * 定位区控、子区、信号机
40
+ * @param params
41
+ * @returns
42
+ */
43
+ locateSignalControlArea(params: IFindSignalControlAreaParams): Promise<IResult>;
44
+ /**
45
+ * 高亮指定的区控、子区、信号机,其他隐藏
46
+ * @param params
47
+ * @returns
48
+ */
49
+ highlightSignalControlArea(params: IFindSignalControlAreaParams): Promise<{
50
+ status: number;
51
+ message: string;
52
+ }>;
53
+ /**
54
+ * 重置高亮,恢复全图视角
55
+ * @returns
56
+ */
57
+ resetHighlight(): Promise<{
58
+ status: number;
59
+ message: string;
60
+ }>;
61
+ /**
62
+ * 绘制区控、子区和信号机
63
+ * @param districtController
64
+ * @param isDistrict 是否是区控
65
+ * @returns
66
+ */
67
+ private drawArea;
68
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/FeatureLayer"),p=require("@turf/buffer"),m=require("@turf/convex"),h=require("@turf/helpers"),g=require("concaveman"),f=require("../../stores/index.js"),b=require("./district-controller.js");function C(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const l=C(h);class I{constructor(e){var r;this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,this.subDistrictGraphics=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const s=f.default.useAppDataStore.mapConfig;this.openDriveServer=(r=s.openDriveServer)==null?void 0:r.url,this.districtControllerDashLayer=new n({id:"districtController",spatialReference:e.spatialReference,source:[],objectIdField:"ObjectID",geometryType:"polyline",outFields:["*"],fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"subDistrictCount",type:"integer"},{name:"signalCount",type:"integer"}],renderer:{type:"simple",symbol:{type:"simple-line",style:"long-dash",color:[111,100,255],width:3}}}),this.districtControllerSolidLayer=new n({id:"districtController",spatialReference:e.spatialReference,source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"polyline",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"subDistrictCount",type:"integer"},{name:"signalCount",type:"integer"}],popupTemplate:{title:"{name}",content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"区控编号"},{fieldName:"subDistrictCount",label:"子区数量"},{fieldName:"signalCount",label:"信号机数量"}]}]},renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[111,100,255,.4],width:3}}}),this.subDistrictControllerLayer=new n({id:"subDistrictController",spatialReference:e.spatialReference,source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"polyline",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"parentId",type:"string"},{name:"parentName",type:"string"},{name:"signalCount",type:"integer"}],popupTemplate:{title:"{name} 子区",content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"区控编号"},{fieldName:"parentName",label:"所属区控"},{fieldName:"signalCount",label:"信号机数量"}]}]},renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[5,196,104],width:3}}}),this.signalMarkerLayer=new n({id:"signalLayer",spatialReference:e.spatialReference,source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",maxScale:5e3,fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"signalId",type:"string"},{name:"nodeId",type:"string"},{name:"isKey",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"}],popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]},renderer:{type:"unique-value",field:"isKey",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:1}},uniqueValueInfos:[{value:"true",symbol:{type:"simple-marker",style:"circle",color:[254,172,22],size:12,outline:{color:"white",width:1}}},{value:"false",symbol:{type:"simple-marker",style:"circle",color:[5,116,255],size:8,outline:{color:"white",width:1}}}]}}),this.signalPictureLayer=new n({id:"signalLayer",spatialReference:e.spatialReference,source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",minScale:5e3,fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"signalId",type:"string"},{name:"nodeId",type:"string"},{name:"isKey",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"}],popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]},renderer:{type:"unique-value",field:"isKey",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:1}},uniqueValueInfos:[{value:"true",symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:30,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:40,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_gjxklk_orange.png"}]}}}},{value:"false",symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:15,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:20,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}}]}}),this.view.map.addMany([this.districtControllerSolidLayer,this.districtControllerDashLayer,this.subDistrictControllerLayer,this.signalMarkerLayer,this.signalPictureLayer])}async showSignalControlArea(e){await this.clearSignalControlArea(),this.districtControllerDashLayer.visible=!0,this.districtControllerSolidLayer.visible=!0,this.subDistrictControllerLayer.visible=!1,this.signalMarkerLayer.visible=!1,this.signalPictureLayer.visible=!1;for(const s of e.areaList){const r=new b.default(s,e.style||"");await this.drawArea(r,!0),await this.subDistrictControllerLayer.applyEdits({addFeatures:this.subDistrictGraphics}),this.subDistrictGraphics=[]}const t=await this.districtControllerDashLayer.queryFeatures();return this.view.goTo(t.features),{status:0,message:"ok"}}async clearSignalControlArea(){this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0;let e=await this.districtControllerDashLayer.queryFeatures();return await this.districtControllerDashLayer.applyEdits({deleteFeatures:e.features}),e=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:e.features}),e=await this.subDistrictControllerLayer.queryFeatures(),await this.subDistrictControllerLayer.applyEdits({deleteFeatures:e.features}),e=await this.signalMarkerLayer.queryFeatures(),await this.signalMarkerLayer.applyEdits({deleteFeatures:e.features}),e=await this.signalPictureLayer.queryFeatures(),await this.signalPictureLayer.applyEdits({deleteFeatures:e.features}),{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtControllerDashLayer.visible=e.visible,this.districtControllerSolidLayer.visible=e.visible;break;case"subDistrict":this.subDistrictControllerLayer.visible=e.visible;break;case"signal":this.signalMarkerLayer.visible=e.visible,this.signalPictureLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":{const r=this.districtControllerDashLayer.createQuery();r.where=`id = '${e.id}'`,r.returnGeometry=!0,r.outFields=["*"];const i=await this.districtControllerDashLayer.queryFeatures(r);return i.features.length>0?(await this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}case"subDistrict":const t=this.subDistrictControllerLayer.createQuery();t.where=`id = '${e.id}'`,t.returnGeometry=!0,t.outFields=["*"];const s=await this.subDistrictControllerLayer.queryFeatures(t);return s.features.length>0?(await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到子区"};case"signal":{const r=this.signalMarkerLayer.createQuery();r.where=`id = '${e.id}'`,r.returnGeometry=!0,r.outFields=["*"];const i=await this.signalMarkerLayer.queryFeatures(r);return i.features.length>0?(await this.view.goTo({target:i.features[0],scale:2500},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){switch(e.type){case"district":{this.districtControllerDashLayer.definitionExpression=`id = '${e.id}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${e.id}'`,this.subDistrictControllerLayer.definitionExpression=`parentId = '${e.id}'`,this.signalMarkerLayer.definitionExpression=`districtId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`districtId = '${e.id}'`;const t=await this.districtControllerDashLayer.queryFeatures();return t.features.length>0?(await this.view.goTo(t.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}case"subDistrict":{this.subDistrictControllerLayer.definitionExpression=`id = '${e.id}'`,this.signalMarkerLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`subDistrictId = '${e.id}'`;const t=await this.subDistrictControllerLayer.queryFeatures();if(t.features.length>0){const r=t.features[0].attributes.parentId;return this.districtControllerDashLayer.definitionExpression=`id = '${r}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${r}'`,await this.view.goTo(t.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return{status:1,message:"未找到子区"}}case"signal":{this.signalMarkerLayer.definitionExpression=`id = '${e.id}'`,this.signalPictureLayer.definitionExpression=`id = '${e.id}'`;const t=await this.signalMarkerLayer.queryFeatures();if(t.features.length>0){const s=t.features[0],{districtId:r,subDistrictId:i}=s.attributes;return this.districtControllerDashLayer.definitionExpression=`id = '${r}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${r}'`,this.subDistrictControllerLayer.definitionExpression=`id = '${i}'`,await this.view.goTo({target:t.features,zoom:2500},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){this.districtControllerDashLayer.definitionExpression="1=1",this.districtControllerSolidLayer.definitionExpression="1=1",this.subDistrictControllerLayer.definitionExpression="1=1",this.signalMarkerLayer.definitionExpression="1=1";const e=await this.districtControllerDashLayer.queryFeatures();return this.view.goTo(e.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}async drawArea(e,t){const s=e.getAllSignalCoordinates();if(s.length>=2){let i=null;if(s.length===2)i=l.lineString(s);else{if(t){const o=l.featureCollection(s.map(c=>l.point(c)));i=m(o)}else{const o=g(s,.5);o.length>=4&&(i=l.polygon([o]))}i||(i=l.lineString(s))}const y=p(i.geometry,t?200:30,{units:"meters"}),u=new d({geometry:{type:"polyline",paths:y.geometry.coordinates},attributes:{ObjectID:t?this.districtControllerOid++:this.subDistrictControllerOid++,id:e.id,name:e.name,subDistrictCount:e.subDistrictCount,signalCount:e.signalCount,parentId:e.parentId,parentName:e.parentName}});t?(await this.districtControllerDashLayer.applyEdits({addFeatures:[u]}),await this.districtControllerSolidLayer.applyEdits({addFeatures:[u]})):this.subDistrictGraphics.push(u)}for(const i of e.subDistricts)await this.drawArea(i,!1);const r=e.signals.map(i=>new d({geometry:{type:"point",x:i.longitude,y:i.latitude},attributes:{ObjectID:this.signalOid++,id:i.id,name:i.name,signalId:i.signalId,nodeId:i.id,isKey:i.isKey,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name}}));await this.signalMarkerLayer.applyEdits({addFeatures:r}),await this.signalPictureLayer.applyEdits({addFeatures:r})}}exports.default=I;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/geometry/geometryEngine.js"),P=require("@arcgis/core/geometry/support/webMercatorUtils.js"),l=require("@arcgis/core/Graphic"),d=require("@arcgis/core/layers/GraphicsLayer"),G=require("@arcgis/core/widgets/Sketch"),S=require("@arcgis/core/widgets/Sketch/SketchViewModel"),k=require("@arcgis/core/geometry/Polygon.js"),M=require("@arcgis/core/geometry/Polyline.js"),A=require("@turf/helpers"),x=require("@turf/intersect"),v=require("uuid"),E=require("../stores/index.js");function f(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const V=f(b),g=f(P),u=f(A);function w(a,e=[]){if(a===null||typeof a!="object")return a;if(Object.prototype.toString.call(a)==="[object Date]")return new Date(a);if(Object.prototype.toString.call(a)==="[object RegExp]")return new RegExp(a);if(Object.prototype.toString.call(a)==="[object Error]")return new Error(a);const t=e.filter(s=>s.original===a)[0];if(t)return t.copy;const i=Array.isArray(a)?[]:{};return e.push({original:a,copy:i}),Object.keys(a).forEach(s=>{i[s]=w(a[s],e)}),i}const O={maxAllowedGraphics:0,GraphicsLayer:{},sketchVisibleElements:{},sketchPosition:"top-right",defaultSketchVisible:!0,sketchViewModelItemSymbol:{}},m={type:"simple-line",color:"#556DEA",width:2},y={type:"simple-fill",color:[227,139,79,.4],outline:{color:[255,255,255],width:1}};class D{constructor(e,t){this.viewer=e,this.options={...O,...t},this.graphicsLayer=new d({...this.options.GraphicsLayer}),this.TextGraphicsLayer=new d,this.viewer.map.layers.add(this.graphicsLayer),this.viewer.map.layers.add(this.TextGraphicsLayer),this.init()}init(){this.sketchViewModel=new S({layer:this.graphicsLayer,view:this.viewer,updateOnGraphicClick:!0,polylineSymbol:m,polygonSymbol:y,...this.options.sketchViewModelItemSymbol});const e=this.findLayerById("TrafficMarkings"),t=[];e&&t.push({layer:e,enabled:!0}),this.sketch=new G({view:this.viewer,viewModel:this.sketchViewModel,layer:this.graphicsLayer,visible:this.options.defaultSketchVisible,creationMode:this.options.creationMode||"single",snappingOptions:{enabled:!0,featureSources:t}}),this.sketch.visibleElements={...this.options.sketchVisibleElements},this.viewer.ui.add(this.sketch,this.options.sketchPosition);const i=E.default.useAppDataStore;this.sketch.on("create",s=>{s.state==="complete"?i.isSketching=!1:s.state==="start"&&(i.isSketching=!0)})}initPoint(e,t="all",i=!1){if(!e)return;const{crossArea:s,sectionArea:r}=e;if(s&&(t=="crossArea"||t=="all")){const o=this.initCrossArea(s);this.graphicsLayer.add(o)}if(r&&(t=="sectionArea"||t=="all")){const o=this.initSectionArea(r,i);this.graphicsLayer.addMany(o)}}initEntranceFusionZone(e){const t=[];e.map(i=>{t.push(this.createPolygonGraphic(i,y,{}))}),this.graphicsLayer.addMany(t)}initCrossArea(e){return this.createPolygonGraphic(e,y,{})}initSectionArea(e,t=!1){const i=[],s={type:"simple-line",color:[0,0,255],width:2};return Object.keys(e).map(r=>{const o=e[r][0],c=e[r][1];t&&(o.reverse(),c.reverse());const n=v.v4(),h=this.createPolylineGraphic(o,m,{type:"draw",id:n}),p=this.createPolylineGraphic(c,s,{type:"shiftLine",id:n});i.push(h,p)}),i}createPolylineGraphic(e,t,i){const s=new M({paths:e}),r=g.geographicToWebMercator(s);return new l({geometry:r,symbol:t,attributes:i})}createPolygonGraphic(e,t,i){const s=new k({rings:e}),r=g.geographicToWebMercator(s);return new l({geometry:r,symbol:t,attributes:i})}on(e){const t=this;this.sketchViewModel.on("create",function(i){var r,o,c;const s=t.graphicsLayer.graphics;if((r=t.options)!=null&&r.maxAllowedGraphics&&s.length>((o=t.options)==null?void 0:o.maxAllowedGraphics)){t.graphicsLayer.remove(i.graphic),console.log("已达到最大图形数量,无法继续绘制!");return}if(i.state==="complete"&&((c=i.graphic)!=null&&c.geometry)){const n=i.graphic.geometry;i.graphic.setAttribute("type","draw"),i.graphic.setAttribute("id",new Date().getTime());const h=t.getGraphicPoint(n);e&&e("create",h,i)}}),this.sketchViewModel.on("update",function(i){if(i.aborted){const s=i.graphics[0];t.graphicsLayer.remove(s);return}if(i.state==="complete"&&i.graphics.length>0){const r=i.graphics[0].geometry,o=t.getGraphicPoint(r);e&&e("update",o,i)}}),this.sketchViewModel.on("delete",function(i){if(console.log("delete",i,t.graphicsLayer.graphics),i.graphics.length>0){const r=i.graphics[0].geometry,o=t.getGraphicPoint(r);e&&e("delete",o,i)}})}graphicPoint(){const e=[];return this.graphicsLayer.graphics.map(t=>{var r;const i=t.geometry,s=this.getGraphicPoint(i);e.push({point:s,type:(r=t.attributes)==null?void 0:r.type,attributes:t.attributes})}),e}getEntranceRoad(){const e={},t=this.graphicPoint().filter(n=>n.point.type==="polyline");if(console.log("🚀 ~ file: sketchView.ts:378 ~ SketchView ~ getEntranceRoad ~ graphics:",t),!t.length)return!1;const i=t.filter(n=>n.type=="draw"),s=t.filter(n=>n.type=="shiftLine");if(s.length==0)throw"未绘制平移!";if(i.length!=s.length)throw"绘制的线和平移的线数量不一致!";const r=i.sort((n,h)=>n.point.angle-h.point.angle),o=r.findIndex(n=>n.point.angle>135);return[...r.slice(o),...r.slice(0,o).reverse()].map((n,h)=>{const p=s.find(L=>L.attributes.id==n.attributes.id);if(!p)throw"绘制的线和平移的线不匹配!";console.log("🚀 ~ file: sketchView.ts:393 ~ SketchView ~ getEntranceRoad ~ m:",n,p),e[h+1]={0:[n.point.paths[0],n.point.paths[n.point.paths.length-1]],1:[p.point.paths[0],p.point.paths[p.point.paths.length-1]]}}),e}getEntranceFusionZone(e){const t=[],i={};this.graphicsLayer.graphics.map(r=>{var n;const o=r.geometry,c=this.getGraphicPoint(o,!1);t.push({point:c,type:(n=r.attributes)==null?void 0:n.type,attributes:r.attributes})});const s=t;return e.map((r,o)=>{i[r]=t[o]}),{graphics:i,rawData:s}}getIntersectionArea(e,t){const i=Object.keys(e);let s=!1;for(let r=0;r<i.length;r++){const o=i[r],c=e[o];if(x(u.polygon(t),u.polygon(c))){s=o;break}}return s}filterData(e){const t=w(e);return t.length>0&&t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&t.pop(),t}getGraphicPoint(e,t=!0){let i=e;this.viewer.spatialReference.isWebMercator&&(i=g.webMercatorToGeographic(e));let s;if(e.type==="point")s={type:e.type,x:i.x,y:i.y};else if(e.type==="polyline"){s={type:e.type,paths:[]},i.paths.forEach(n=>{let h=n;t&&(h=this.filterData(n)),h.forEach(p=>{s.paths.push(p)})});const r={x:s.paths[0][0],y:s.paths[0][1]},o={x:s.paths[s.paths.length-1][0],y:s.paths[s.paths.length-1][1]},c=this.getAngle(r,o);s.angle=c}else e.type==="polygon"&&(s={type:e.type,rings:[]},i.rings.forEach(r=>{let o=r;t&&(o=this.filterData(r)),o.forEach(c=>{s.rings.push(c)})}));return s}close(){this.sketch.visible=!1}show(){this.sketch.visible=!0}removeAll(){this.graphicsLayer.removeAll()}getAngle(e,t){const i=t.x-e.x,s=t.y-e.y;return Math.atan2(s,i)*180/Math.PI}getShiftLine(e,t,i="meters"){const s=e,r=-t;return V.offset(s,r,i)}setShiftLine(e,t="meters",i){i||(i={type:"simple-line",color:[0,0,255],width:2}),this.removeShiftLine(),this.graphicsLayer.graphics.map(s=>{const r=s.geometry,o=s.attributes;if((r==null?void 0:r.type)==="polyline"&&(o==null?void 0:o.type)==="draw"){const c=o.id,n=this.getShiftLine(r,e,t),h=new l({geometry:n,symbol:i,attributes:{type:"shiftLine",id:c}});this.graphicsLayer.add(h)}})}removeShiftLine(){const e=[];this.graphicsLayer.graphics.map(t=>{const i=t.attributes;(i==null?void 0:i.type)==="shiftLine"&&e.push(t)}),this.graphicsLayer.removeMany(e)}removeDraw(){const e=[];this.graphicsLayer.graphics.map(t=>{const i=t.attributes;(i==null?void 0:i.type)==="draw"&&e.push(t)}),this.graphicsLayer.removeMany(e)}addGraphic(e,t={type:"simple-line",color:[0,0,255],width:2},i){const s=new l({geometry:e,symbol:t,attributes:i});this.graphicsLayer.add(s)}getDirection(e,t){const i=t.x-e.x,s=t.y-e.y,o=Math.atan2(s,i)*180/Math.PI;return o>=-45&&o<=45?0:o>45&&o<=135?1:o>135||o<=-135?2:3}findLayerById(e){return this.viewer.map.findLayerById(e)}findShiftLineGraphicsById(e){return this.graphicsLayer.graphics.find(i=>i.attributes.id===e&&i.attributes.type==="shiftLine")}remove(e){this.graphicsLayer.remove(e)}setMaxAllowedGraphics(e){this.options.maxAllowedGraphics=e===0?void 0:e}destroy(){var e,t;this.viewer.map.remove(this.graphicsLayer),this.viewer.map.remove(this.TextGraphicsLayer),(e=this.sketch)==null||e.destroy(),(t=this.sketchViewModel)==null||t.destroy()}}exports.default=D;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/geometry/geometryEngine.js"),P=require("@arcgis/core/geometry/support/webMercatorUtils.js"),l=require("@arcgis/core/Graphic"),u=require("@arcgis/core/layers/GraphicsLayer"),G=require("@arcgis/core/widgets/Sketch"),S=require("@arcgis/core/widgets/Sketch/SketchViewModel"),k=require("@arcgis/core/geometry/Polygon.js"),M=require("@arcgis/core/geometry/Polyline.js"),A=require("@turf/helpers"),x=require("@turf/intersect"),v=require("uuid"),E=require("../stores/index.js");function f(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const V=f(b),g=f(P),d=f(A);function w(a,e=[]){if(a===null||typeof a!="object")return a;if(Object.prototype.toString.call(a)==="[object Date]")return new Date(a);if(Object.prototype.toString.call(a)==="[object RegExp]")return new RegExp(a);if(Object.prototype.toString.call(a)==="[object Error]")return new Error(a);const t=e.filter(s=>s.original===a)[0];if(t)return t.copy;const i=Array.isArray(a)?[]:{};return e.push({original:a,copy:i}),Object.keys(a).forEach(s=>{i[s]=w(a[s],e)}),i}const O={maxAllowedGraphics:0,GraphicsLayer:{},sketchVisibleElements:{},sketchPosition:"top-right",defaultSketchVisible:!0,sketchViewModelItemSymbol:{}},m={type:"simple-line",color:"#556DEA",width:2},y={type:"simple-fill",color:[227,139,79,.4],outline:{color:[255,255,255],width:1}};class D{constructor(e,t){this.viewer=e,this.options={...O,...t},this.graphicsLayer=new u({...this.options.GraphicsLayer}),this.TextGraphicsLayer=new u,this.viewer.map.layers.add(this.graphicsLayer),this.viewer.map.layers.add(this.TextGraphicsLayer),this.init()}init(){this.sketchViewModel=new S({layer:this.graphicsLayer,view:this.viewer,updateOnGraphicClick:!0,polylineSymbol:m,polygonSymbol:y,...this.options.sketchViewModelItemSymbol});const e=this.findLayerById("TrafficMarkings"),t=[];e&&t.push({layer:e,enabled:!0}),this.sketch=new G({view:this.viewer,viewModel:this.sketchViewModel,layer:this.graphicsLayer,visible:this.options.defaultSketchVisible,creationMode:this.options.creationMode||"single",snappingOptions:{enabled:!0,featureSources:t}}),this.sketch.visibleElements={...this.options.sketchVisibleElements},this.viewer.ui.add(this.sketch,this.options.sketchPosition);const i=E.default.useAppDataStore;this.sketch.on("create",s=>{s.state==="complete"?i.isSketching=!1:s.state==="start"&&(i.isSketching=!0)})}initPoint(e,t="all",i=!1){if(!e)return;const{crossArea:s,sectionArea:r}=e;if(s&&(t=="crossArea"||t=="all")){const o=this.initCrossArea(s);this.graphicsLayer.add(o)}if(r&&(t=="sectionArea"||t=="all")){const o=this.initSectionArea(r,i);this.graphicsLayer.addMany(o)}}initEntranceFusionZone(e){const t=[];e.map(i=>{t.push(this.createPolygonGraphic(i,y,{}))}),this.graphicsLayer.addMany(t)}initCrossArea(e){return this.createPolygonGraphic(e,y,{})}initSectionArea(e,t=!1){const i=[],s={type:"simple-line",color:[0,0,255],width:2};return Object.keys(e).map(r=>{const o=e[r][0],c=e[r][1];t&&(o.reverse(),c.reverse());const n=v.v4(),h=this.createPolylineGraphic(o,m,{type:"draw",id:n}),p=this.createPolylineGraphic(c,s,{type:"shiftLine",id:n});i.push(h,p)}),i}createPolylineGraphic(e,t,i){const s=new M({paths:e}),r=g.geographicToWebMercator(s);return new l({geometry:r,symbol:t,attributes:i})}createPolygonGraphic(e,t,i){const s=new k({rings:e}),r=g.geographicToWebMercator(s);return new l({geometry:r,symbol:t,attributes:i})}on(e){const t=this;this.sketchViewModel.on("create",function(i){var r,o,c;const s=t.graphicsLayer.graphics;if((r=t.options)!=null&&r.maxAllowedGraphics&&s.length>((o=t.options)==null?void 0:o.maxAllowedGraphics)){t.graphicsLayer.remove(i.graphic),console.log("已达到最大图形数量,无法继续绘制!");return}if(i.state==="complete"&&((c=i.graphic)!=null&&c.geometry)){const n=i.graphic.geometry;i.graphic.setAttribute("type","draw"),i.graphic.setAttribute("id",new Date().getTime());const h=t.getGraphicPoint(n);e&&e("create",h,i)}}),this.sketchViewModel.on("update",function(i){if(i.aborted){const s=i.graphics[0];t.graphicsLayer.remove(s);return}if(i.state==="complete"&&i.graphics.length>0){const r=i.graphics[0].geometry,o=t.getGraphicPoint(r);e&&e("update",o,i)}}),this.sketchViewModel.on("delete",function(i){if(console.log("delete",i,t.graphicsLayer.graphics),i.graphics.length>0){const r=i.graphics[0].geometry,o=t.getGraphicPoint(r);e&&e("delete",o,i)}})}graphicPoint(){const e=[];return this.graphicsLayer.graphics.map(t=>{var r;const i=t.geometry,s=this.getGraphicPoint(i);e.push({point:s,type:(r=t.attributes)==null?void 0:r.type,attributes:t.attributes})}),e}getEntranceRoad(){const e={},t=this.graphicPoint().filter(n=>n.point.type==="polyline");if(console.log("🚀 ~ file: sketchView.ts:378 ~ SketchView ~ getEntranceRoad ~ graphics:",t),!t.length)return!1;const i=t.filter(n=>n.type=="draw"),s=t.filter(n=>n.type=="shiftLine");if(s.length==0)throw"未绘制平移!";if(i.length!=s.length)throw"绘制的线和平移的线数量不一致!";const r=i.sort((n,h)=>n.point.angle-h.point.angle),o=r.findIndex(n=>n.point.angle>135);return[...r.slice(o),...r.slice(0,o).reverse()].map((n,h)=>{const p=s.find(L=>L.attributes.id==n.attributes.id);if(!p)throw"绘制的线和平移的线不匹配!";console.log("🚀 ~ file: sketchView.ts:393 ~ SketchView ~ getEntranceRoad ~ m:",n,p),e[h+1]={0:[n.point.paths[0],n.point.paths[n.point.paths.length-1]],1:[p.point.paths[0],p.point.paths[p.point.paths.length-1]]}}),e}getEntranceFusionZone(e){const t=[],i={};this.graphicsLayer.graphics.map(r=>{var n;const o=r.geometry,c=this.getGraphicPoint(o,!1);t.push({point:c,type:(n=r.attributes)==null?void 0:n.type,attributes:r.attributes})});const s=t;return e.map((r,o)=>{i[r]=t[o]}),{graphics:i,rawData:s}}getIntersectionArea(e,t){const i=Object.keys(e);let s=!1;for(let r=0;r<i.length;r++){const o=i[r],c=e[o];if(x(d.polygon(t),d.polygon(c))){s=o;break}}return s}filterData(e){const t=w(e);return t.length>0&&t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&t.pop(),t}getGraphicPoint(e,t=!0){let i=e;this.viewer.spatialReference.isWebMercator&&(i=g.webMercatorToGeographic(e));let s;if(e.type==="point")s={type:e.type,x:i.x,y:i.y};else if(e.type==="polyline"){s={type:e.type,paths:[]},i.paths.forEach(n=>{let h=n;t&&(h=this.filterData(n)),h.forEach(p=>{s.paths.push(p)})});const r={x:s.paths[0][0],y:s.paths[0][1]},o={x:s.paths[s.paths.length-1][0],y:s.paths[s.paths.length-1][1]},c=this.getAngle(r,o);s.angle=c}else e.type==="polygon"&&(s={type:e.type,rings:[]},i.rings.forEach(r=>{let o=r;t&&(o=this.filterData(r)),o.forEach(c=>{s.rings.push(c)})}));return s}close(){this.sketch.visible=!1}show(){this.sketch.visible=!0}removeAll(){this.graphicsLayer.removeAll()}getAngle(e,t){const i=t.x-e.x,s=t.y-e.y;return Math.atan2(s,i)*180/Math.PI}getShiftLine(e,t,i="meters"){const s=e,r=-t;return V.offset(s,r,i)}setShiftLine(e,t="meters",i){i||(i={type:"simple-line",color:[0,0,255],width:2}),this.removeShiftLine(),this.graphicsLayer.graphics.map(s=>{const r=s.geometry,o=s.attributes;if((r==null?void 0:r.type)==="polyline"&&(o==null?void 0:o.type)==="draw"){const c=o.id,n=this.getShiftLine(r,e,t),h=new l({geometry:n,symbol:i,attributes:{type:"shiftLine",id:c}});this.graphicsLayer.add(h)}})}removeShiftLine(){const e=[];this.graphicsLayer.graphics.map(t=>{const i=t.attributes;(i==null?void 0:i.type)==="shiftLine"&&e.push(t)}),this.graphicsLayer.removeMany(e)}removeDraw(){const e=[];this.graphicsLayer.graphics.map(t=>{const i=t.attributes;(i==null?void 0:i.type)==="draw"&&e.push(t)}),this.graphicsLayer.removeMany(e)}addGraphic(e,t={type:"simple-line",color:[0,0,255],width:2},i){const s=new l({geometry:e,symbol:t,attributes:i});this.graphicsLayer.add(s)}getDirection(e,t){const i=t.x-e.x,s=t.y-e.y,o=Math.atan2(s,i)*180/Math.PI;return o>=-45&&o<=45?0:o>45&&o<=135?1:o>135||o<=-135?2:3}findLayerById(e){return this.viewer.map.findLayerById(e)}findShiftLineGraphicsById(e){return this.graphicsLayer.graphics.find(i=>i.attributes.id===e&&i.attributes.type==="shiftLine")}remove(e){this.graphicsLayer.remove(e)}setMaxAllowedGraphics(e){this.options.maxAllowedGraphics=e===0?void 0:e}destroy(){var e,t;this.viewer.map.remove(this.graphicsLayer),this.viewer.map.remove(this.TextGraphicsLayer),(e=this.sketch)==null||e.destroy(),(t=this.sketchViewModel)==null||t.destroy()}}exports.default=D;
@@ -274,6 +274,10 @@ export interface IShowSignalControlAreaParams {
274
274
  areaList: any[];
275
275
  style?: string;
276
276
  }
277
+ export interface IFindSignalControlAreaParams {
278
+ type: string;
279
+ id: string;
280
+ }
277
281
  export interface INode {
278
282
  id: string;
279
283
  longitude: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.202",
3
+ "version": "1.0.204",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [
@@ -36,6 +36,7 @@
36
36
  "@vitest/coverage-c8": "^0.29.2",
37
37
  "axios": "^1.4.0",
38
38
  "concaveman": "^1.2.1",
39
+ "core-js": "^3.40.0",
39
40
  "fast-xml-parser": "^4.4.0",
40
41
  "md5": "^2.3.0",
41
42
  "pako": "^2.1.0",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),c=require("@arcgis/core/Graphic"),y=require("@arcgis/core/layers/GraphicsLayer"),f=require("@turf/buffer"),d=require("@turf/convex"),C=require("@turf/helpers"),v=require("axios"),S=require("concaveman"),I=require("../../stores/index.js"),A=require("./district-controller.js");function m(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const L=m(b),a=m(C);class w{constructor(e){var i;this.crossScale=5e3,this.hasGpu=!1,this.crossIdsInDistrict=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const r=I.default.useAppDataStore.mapConfig;this.openDriveServer=(i=r.openDriveServer)==null?void 0:i.url,this.districtControllerLayer=new y({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new y({id:"subDistrictControllerLayer",visible:!1}),this.crossLayer=new y({id:"crossLayer",visible:!1}),this.highlightLayer=new y({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1,this.districtControllerLayer.visible=!0;for(const t of e.areaList){const r=new A.default(t,e.style||"");this.drawArea(r,!0)}return this.scaleWatcher=L.watch(()=>this.view.scale,(t,r)=>{t>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(i=>{i.symbol=this.getCrossGraphicSymbol(i.attributes,"marker")}),this.highlightLayer.graphics.forEach(i=>{i.getAttribute("type")==="cross"&&(i.symbol=this.getCrossGraphicSymbol(i.attributes,"marker"))})):t<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(i=>{i.symbol=this.getCrossGraphicSymbol(i.attributes,"picture")}),this.highlightLayer.graphics.forEach(i=>{i.getAttribute("type")==="cross"&&(i.symbol=this.getCrossGraphicSymbol(i.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var e,t;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.scaleWatcher)==null||e.remove(),this.scaleWatcher=void 0,(t=this.viewClickWatcher)==null||t.remove(),this.viewClickWatcher=void 0,this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500},{duration:this.hasGpu?1e3:0}):await this.view.goTo(t.geometry,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到"}}async highlightSignalControlArea(e){if(!e.id||e.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(s=>s.getAttribute("id")===e.id).toArray().map(s=>{const o=s.clone();return o.symbol.style="none",o}),r=this.subDistrictControllerLayer.graphics.filter(s=>s.getAttribute("id")===e.id||s.getAttribute("parentId")===e.id).toArray().map(s=>s.clone()),i=this.crossLayer.graphics.filter(s=>s.getAttribute("nodeId")===e.id||s.getAttribute("districtId")===e.id||s.getAttribute("subDistrictId")===e.id).toArray().map(s=>s.clone());if(r.length>0&&this.highlightLayer.addMany(r),i.length>0&&this.highlightLayer.addMany(i),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(t.length>0)await this.view.goTo(t,{duration:this.hasGpu?1e3:0});else if(r.length>0){const s=r[0].geometry.centroid;await this.view.goTo({target:s,scale:this.crossScale-500},{duration:this.hasGpu?1e3:0})}else i.length>1?await this.view.goTo(i,{duration:this.hasGpu?1e3:0}):await this.view.goTo({target:i[0].geometry,scale:1500},{duration:this.hasGpu?1e3:0});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,{status:0,message:"ok"}}showSubSignalControlArea(e){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const r=e.children.map(i=>{const s={...i,selected:!0};return new c({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossSymbolInSubDistrict(s),attributes:s})});return this.crossLayer.addMany(r),this.view.goTo(r,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}async handleViewClick(e){var s;const r=(s=(await this.view.hitTest(e,{include:[this.crossLayer]})).results)==null?void 0:s.filter(o=>o.type==="graphic");if(r.length===0)return;const i=r[0].graphic;i.getAttribute("selected")?i.getAttribute("signalId")&&(this.removeCrossCallback&&this.removeCrossCallback({id:i.getAttribute("id")}),i.setAttribute("selected",!1),i.symbol=this.getCrossSymbolInSubDistrict(i.attributes)):(i.getAttribute("signalId")&&(this.addCrossCallback&&this.addCrossCallback(i.attributes),i.setAttribute("selected",!0),i.symbol=this.getCrossSymbolInSubDistrict(i.attributes)),await this.showNearbyCrosses(i.getAttribute("id")))}async showNearbyCrosses(e){const t=await v.get(`http://${this.openDriveServer}/api/computable/getRelatedNodesForNode`,{params:{nodeIds:e}});if(t.status===200)if(t.data.status===0){const r=t.data.result,i=[];for(const s of r){const o=s.nodeId;if(o.startsWith("-"))continue;if(s.signalId&&!this.crossIdsInDistrict.includes(o)){console.log("不是此区控内的路口",o);continue}if(this.crossLayer.graphics.some(h=>h.getAttribute("id")===o))continue;const g=new c({geometry:{type:"point",x:s.lon,y:s.lat},symbol:this.getCrossSymbolInSubDistrict(s),attributes:{id:o,name:s.name,signalId:s.signalId,selected:!1}});i.push(g)}return this.crossLayer.addMany(i),{status:0,message:"ok"}}else return{status:-1,message:t.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalControlArea(e){if(e.odrServer){this.openDriveServer=e.odrServer,this.crossIdsInDistrict=e.crossesInArea.map(s=>s.id);const t=a.featureCollection(e.crossesInArea.map(s=>a.point([s.longitude,s.latitude]))),r=d(t);r&&(this.districtControllerLayer.removeAll(),this.districtControllerLayer.add(new c({geometry:{type:"polygon",rings:r.geometry.coordinates},symbol:{type:"simple-fill",style:"none",outline:{color:[61,139,249],width:3,style:"long-dash"}}}))),this.addCrossCallback=e.addCrossCallback,this.removeCrossCallback=e.removeCrossCallback,this.viewClickWatcher||(this.viewClickWatcher=this.view.on("click",async s=>{await this.handleViewClick(s)}));const i=this.crossLayer.graphics.toArray().map(s=>s.getAttribute("id")).join(",");return await this.showNearbyCrosses(i)}else return{status:1,message:"未配置OpenDriveServer"}}stopEditSubSignalControlArea(){var t;(t=this.viewClickWatcher)==null||t.remove(),this.viewClickWatcher=void 0;const e=this.crossLayer.graphics.filter(r=>r.getAttribute("signalId")===""||!r.getAttribute("signalId")||!r.getAttribute("selected"));this.crossLayer.removeMany(e.toArray()),this.districtControllerLayer.removeAll()}selectSubSignalControlAreaCross(e){return this.crossLayer.graphics.forEach(t=>{if(t.getAttribute("id")===e&&!t.getAttribute("selected"))return t.setAttribute("selected",!0),t.symbol=this.getCrossSymbolInSubDistrict(t.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}unselectSubSignalControlAreaCross(e){return this.crossLayer.graphics.forEach(t=>{if(t.getAttribute("id")===e&&t.getAttribute("selected"))return t.setAttribute("selected",!1),t.symbol=this.getCrossSymbolInSubDistrict(t.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}changeSubSignalControlAreaBorderVisibility(e){this.highlightLayer.graphics.forEach(t=>{t.getAttribute("type")==="signalControlArea"&&(t.visible=e)})}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e)),t}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>=2){let s=null;if(r.length===2)s=a.lineString(r);else{if(t){const u=a.featureCollection(r.map(p=>a.point(p)));s=d(u)}else{const u=S(r,.5);u.length>=4&&(s=a.polygon([u]))}s||(s=a.lineString(r))}const o=f(s.geometry,t?200:30,{units:"meters"});let n;t?n=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:n=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const g={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},h=new c({geometry:{type:"polygon",rings:o.geometry.coordinates},symbol:{type:"simple-fill",style:"none",color:[...e.areaColor,.3],outline:{color:e.areaColor,width:3,style:t?"long-dash":"solid"}},attributes:g,popupTemplate:{title:`${e.name}`,content:[{type:"fields",fieldInfos:n}]}});t?this.districtControllerLayer.add(h):this.subDistrictControllerLayer.add(h)}for(const s of e.subDistricts)this.drawArea(s,!1);const i=[];e.crosses.forEach(s=>{const o={type:"cross",id:s.id,name:s.name,color:e.areaColor,signalId:s.signalId,nodeId:s.nodeId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:s.isKey},n=new c({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossGraphicSymbol(o,"marker"),attributes:o,popupTemplate:{title:s.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]}});i.push(n)}),this.crossLayer.addMany(i)}getCrossSymbolInSubDistrict(e){return e.signalId&&e.signalId!==""?{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${e.selected?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz.png",width:"20px",height:"20px"}}getCrossGraphicSymbol(e,t){const{isKey:r,color:i}=e;if(t==="marker")return r?{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_gjxklk_orange.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:i,size:8,outline:{color:"white",width:1}};if(t==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:r?30:15,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r?40:20,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${r?"gis_gjxklk_orange":"gis_xhj_blue"}.png`}]}}}}}exports.default=w;