gisviewer-vue3-arcgis 1.0.196 → 1.0.198
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.
- package/es/src/gis-map/gis-map.vue.d.ts +2 -1
- package/es/src/gis-map/gis-map.vue.mjs +143 -141
- package/es/src/gis-map/index.d.ts +1 -0
- package/es/src/gis-map/utils/detect-gpu.d.ts +2 -0
- package/es/src/gis-map/utils/detect-gpu.mjs +44 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.d.ts +20 -5
- package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +106 -52
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.d.ts +0 -4
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +18 -60
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +2 -2
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +1 -0
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +60 -40
- package/es/src/types/index.d.ts +6 -4
- package/lib/src/gis-map/gis-map.vue.d.ts +2 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +1 -0
- package/lib/src/gis-map/utils/detect-gpu.d.ts +2 -0
- package/lib/src/gis-map/utils/detect-gpu.js +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.d.ts +20 -5
- package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.d.ts +0 -4
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +1 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/lib/src/types/index.d.ts +6 -4
- package/package.json +1 -1
|
@@ -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, IShowOpenDriveFromFileParams, IShowSignalControlAreaParams, ISignalCountdownProps, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams, IUnselectSumoParams } from '../types';
|
|
3
|
+
import { IEditSignalControlAreaParams, 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';
|
|
@@ -146,6 +146,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
146
146
|
status: number;
|
|
147
147
|
message: string;
|
|
148
148
|
} | undefined;
|
|
149
|
+
showGreenWaveBand: (params: IShowGreenWaveBandParams) => Promise<void>;
|
|
149
150
|
props: any;
|
|
150
151
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
151
152
|
SignalCountdownPanel: import("vue").DefineComponent<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),
|
|
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;
|
|
@@ -134,6 +134,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
134
134
|
status: number;
|
|
135
135
|
message: string;
|
|
136
136
|
} | undefined;
|
|
137
|
+
showGreenWaveBand: (params: import("../types").IShowGreenWaveBandParams) => Promise<void>;
|
|
137
138
|
props: any;
|
|
138
139
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
139
140
|
SignalCountdownPanel: import("vue").DefineComponent<{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=e=>{const r=[],o=e.split("");for(let t=0;t<o.length;t++)if(o[t]==="(")r.push(t);else if(o[t]===")"){const n=r.pop();n!==void 0&&(o.splice(n,t-n+1),t=n-1)}return o.join("")},i=e=>s(e).replace(/\/PCIe\/SSE2/g,"").replace(/\s+/g," ").trim(),c=()=>{try{const e=document.createElement("canvas"),r=e.getContext("webgl")||e.getContext("experimental-webgl");if(!r)return"Unknown";const o=r.getExtension("WEBGL_debug_renderer_info");return o&&r.getParameter(o.UNMASKED_RENDERER_WEBGL)||"Unknown"}catch{return"Unknown"}},l=()=>{const e=c();try{if(/, or similar$/.test(e)||/SwiftShader/.test(e))return"Unknown";if(/^ANGLE/.test(e)){const r=e.match(/\((.+)\)$/);if(r){const o=r[1],t=o.split(/,\s*/g);let n=t[1];return/^ANGLE Metal Renderer: /.test(n)&&(n=e.split(": ")[1].split(",")[0]),t.length===1&&(n=t[0].split(" ").slice(1).join(" ")),/Direct3D/.test(n)&&(n=n.split("Direct3D")[0].trim()),n}}}catch{return"Unknown"}return i(e)},u=()=>{const e=l();return console.log("GPU:",e),localStorage.setItem("gpu",e),e};exports.default=u;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { IEditSignalControlAreaParams } from '../../../types';
|
|
1
|
+
import { IEditSignalControlAreaParams, IShowGreenWaveBandParams } from '../../../types';
|
|
2
2
|
export default class GreenWaveBandController {
|
|
3
3
|
private view;
|
|
4
|
+
/** 新增时显示路口的图层 */
|
|
4
5
|
private allNodesLayer;
|
|
6
|
+
/** 新增时显示路段的图层 */
|
|
5
7
|
private roadsectLayer;
|
|
8
|
+
/** 显示现有绿波带的图层 */
|
|
9
|
+
private bandLayer;
|
|
6
10
|
private viewClickWatcher?;
|
|
7
11
|
private openDriveServer;
|
|
8
12
|
private selectedNodeIds;
|
|
9
|
-
private
|
|
10
|
-
private
|
|
11
|
-
private
|
|
13
|
+
private scaleWatcher?;
|
|
14
|
+
private readonly nodeScale;
|
|
15
|
+
private hasGpu;
|
|
16
|
+
private addNodeCallback;
|
|
17
|
+
private removeNodeCallback;
|
|
18
|
+
private removeAllNodeCallback;
|
|
12
19
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
13
20
|
/**
|
|
14
21
|
* 新增绿波带
|
|
@@ -16,6 +23,7 @@ export default class GreenWaveBandController {
|
|
|
16
23
|
*/
|
|
17
24
|
addGreenWaveBand(params: IEditSignalControlAreaParams): void;
|
|
18
25
|
stopAddGreenWaveBand(): void;
|
|
26
|
+
showGreenWaveBand(params: IShowGreenWaveBandParams): Promise<void>;
|
|
19
27
|
/**
|
|
20
28
|
* 显示所有路口,进入待选状态
|
|
21
29
|
* @param nodeAttributes
|
|
@@ -33,5 +41,12 @@ export default class GreenWaveBandController {
|
|
|
33
41
|
*/
|
|
34
42
|
private showDownstreamNodes;
|
|
35
43
|
private getLineSymbol;
|
|
36
|
-
private
|
|
44
|
+
private getShowNodeSymbol;
|
|
45
|
+
/**
|
|
46
|
+
* 编辑状态时的路口符号
|
|
47
|
+
* 全部用cim符号,是否选中用不同的图标
|
|
48
|
+
* @param selected 是否选中
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
private getEditableNodeSymbol;
|
|
37
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("@arcgis/core/Graphic"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/core/reactiveUtils.js"),b=require("@arcgis/core/geometry"),n=require("@arcgis/core/Graphic"),y=require("@arcgis/core/layers/GraphicsLayer"),u=require("axios");function p(c){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const s in c)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(c,s);Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>c[s]})}}return e.default=c,Object.freeze(e)}const g=p(m);class f{constructor(e){this.selectedNodeIds=[],this.nodeScale=5e3,this.hasGpu=!1,this.hasGpu=localStorage.getItem("gpu")!=="Unknown",this.view=e,this.roadsectLayer=new y({id:"roadsectLayer"}),this.view.map.add(this.roadsectLayer),this.allNodesLayer=new y({id:"allNodesLayer"}),this.view.map.add(this.allNodesLayer),this.bandLayer=new y({id:"bandLayer"}),this.view.map.add(this.bandLayer)}addGreenWaveBand(e){this.addNodeCallback=e.addCrossCallback,this.removeNodeCallback=e.removeCrossCallback,e.removeAllCrossCallback&&(this.removeAllNodeCallback=e.removeAllCrossCallback),this.selectedNodeIds=[],this.openDriveServer=e.odrServer,this.showAllNodes(e.crossesInArea),this.viewClickWatcher||(this.viewClickWatcher=this.view.on("click",s=>{this.handleViewClick(s)}))}stopAddGreenWaveBand(){var e;(e=this.viewClickWatcher)==null||e.remove(),this.viewClickWatcher=void 0,this.allNodesLayer.removeAll(),this.selectedNodeIds=[],this.roadsectLayer.removeAll(),this.bandLayer.removeAll()}async showGreenWaveBand(e){this.scaleWatcher||(this.scaleWatcher=g.watch(()=>this.view.scale,(i,r)=>{i>this.nodeScale&&r<=this.nodeScale?this.bandLayer.graphics.forEach(l=>{l.geometry.type==="point"&&(l.symbol=this.getShowNodeSymbol("marker"))}):i<=this.nodeScale&&r>this.nodeScale&&this.bandLayer.graphics.forEach(l=>{l.geometry.type==="point"&&(l.symbol=this.getShowNodeSymbol("picture"))})}));const s=new b.Polyline({paths:[e.coordinates]}),a=new n({geometry:s,symbol:this.getLineSymbol(!0),attributes:{bandId:e.bandId}});this.roadsectLayer.add(a),await this.view.goTo(a),e.nodeList.forEach(i=>{const r=new n({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getShowNodeSymbol("picture"),attributes:i});this.bandLayer.add(r)})}showAllNodes(e){const s=[];e.forEach(a=>{s.push(new n({geometry:{type:"point",x:a.longitude,y:a.latitude},symbol:this.getEditableNodeSymbol(!1),attributes:{...a,selected:!1}}))}),this.allNodesLayer.addMany(s)}async handleViewClick(e){var l;const a=(l=(await this.view.hitTest(e,{include:[this.allNodesLayer]})).results)==null?void 0:l.filter(d=>d.type==="graphic");if(a.length===0)return;const i=a[0].graphic,r=i.getAttribute("id");if(this.selectedNodeIds.includes(r)){const d=this.selectedNodeIds.indexOf(r)+1;if(d===1)this.removeAllNodeCallback&&this.removeAllNodeCallback(),this.selectedNodeIds=[],this.allNodesLayer.graphics.forEach(t=>{t.setAttribute("selected",!1),t.symbol=this.getEditableNodeSymbol(!1),t.visible=!0}),this.roadsectLayer.removeAll();else{for(let t=d;t<this.selectedNodeIds.length;t++){this.removeNodeCallback&&this.removeNodeCallback({id:this.selectedNodeIds[t]});for(let o=0;o<this.roadsectLayer.graphics.length;o++){const h=this.roadsectLayer.graphics.getItemAt(o);(h.getAttribute("id")===this.selectedNodeIds[t]||!h.getAttribute("selected"))&&(this.roadsectLayer.remove(h),o--)}}this.selectedNodeIds=this.selectedNodeIds.slice(0,d),this.allNodesLayer.graphics.forEach(t=>{const o=this.selectedNodeIds.includes(t.getAttribute("id"));t.setAttribute("selected",o),t.symbol=this.getEditableNodeSymbol(o),t.visible=o}),await this.showDownstreamNodes(r)}}else{i.setAttribute("selected",!0),i.symbol=this.getEditableNodeSymbol(!0),this.selectedNodeIds.push(r),this.allNodesLayer.graphics.forEach(t=>{t.visible=t.getAttribute("selected")});let d=[];for(let t=0;t<this.roadsectLayer.graphics.length;t++){const o=this.roadsectLayer.graphics.getItemAt(t);o.getAttribute("id")===r?(o.symbol=this.getLineSymbol(!0),o.setAttribute("selected",!0),d=o.geometry.paths[0]):o.getAttribute("selected")||(this.roadsectLayer.remove(o),t--)}this.addNodeCallback&&this.addNodeCallback({...i.attributes,roadsect:d}),await this.showDownstreamNodes(r)}}async showDownstreamNodes(e){this.view.container.style.cursor="progress";const s=await u.get(`http://${this.openDriveServer}/api/computable/getDownstreamNodes`,{params:{nodeId:e}});if(s.status!==200||s.data.status!==0){this.view.container.style.cursor="default";return}s.data.result.forEach(i=>{this.allNodesLayer.graphics.forEach(r=>{if(r.getAttribute("nodeId")===i.id&&r.getAttribute("selected")===!1&&(r.visible=!0,i.coordinates)){const l=new n({geometry:{type:"polyline",paths:[i.coordinates]},symbol:this.getLineSymbol(!1),attributes:{...i,selected:!1}});this.roadsectLayer.add(l)}})}),this.view.container.style.cursor="default"}getLineSymbol(e){return e?{type:"cim",data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:4,markerPlacement:{type:"CIMMarkerPlacementAlongLineSameSize",endings:"WithMarkers",placementTemplate:[40],angleToLine:!0},frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[4,-4],[12,0],[4,4]],[[-4,4],[-12,0],[-4,-4]]]},symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,width:1.5,color:[255,255,255,255]}]}}]},{type:"CIMSolidStroke",enable:!0,width:4,color:[55,125,34,255]}]}}}:{type:"simple-line",color:"gray",width:2}}getShowNodeSymbol(e){return e==="marker"?{type:"simple-marker",style:"circle",color:[61,139,249],size:8,outline:{color:"white",width:1}}:this.getEditableNodeSymbol(!0)}getEditableNodeSymbol(e){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:30,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:2,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:25,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${e?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}}}exports.default=f;
|
|
@@ -8,10 +8,6 @@ export default class TraceRendererLayer implements ITraceRendererInterface {
|
|
|
8
8
|
private appDataStore;
|
|
9
9
|
private logTable;
|
|
10
10
|
constructor(view: __esri.MapView);
|
|
11
|
-
private getRendererText;
|
|
12
|
-
private em;
|
|
13
|
-
private el;
|
|
14
|
-
private getGpuText;
|
|
15
11
|
getLog(): (string | number)[][];
|
|
16
12
|
init(): Promise<void>;
|
|
17
13
|
private needInterpolate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),g=require("@arcgis/core/layers/GraphicsLayer"),m=require("vue"),u=require("../../stores/index.js");class y{constructor(i){this.hasGpu=!1,this.appDataStore=u.default.useAppDataStore,this.logTable=[["uuid","ptcId","plateno","timestamp","localTimestamp","timestamp_str","speed","laneNo","objHeight","objLength","latitude","longitude","ptcType","vehicleType","vehicleColor","plateColor","sbdm","heading","fixAngle","roadLayer","status","step","receiveTimestamp"]],this.needInterpolate=!0,this.isPaused=!1,this.showVehiclePlate=!1,this.showGroundVehicle=!0,this.showElevatedVehicle=!0,this.historyPositionMap=new Map,this.vehicleObjectMap=new Map,this.view=i,this.mapConfig=m.toRaw(this.appDataStore.mapConfig),this.vehicleLayer=new g({id:"vehicleLayer"}),this.view.map.add(this.vehicleLayer);const t=
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),g=require("@arcgis/core/layers/GraphicsLayer"),m=require("vue"),u=require("../../stores/index.js");class y{constructor(i){this.hasGpu=!1,this.appDataStore=u.default.useAppDataStore,this.logTable=[["uuid","ptcId","plateno","timestamp","localTimestamp","timestamp_str","speed","laneNo","objHeight","objLength","latitude","longitude","ptcType","vehicleType","vehicleColor","plateColor","sbdm","heading","fixAngle","roadLayer","status","step","receiveTimestamp"]],this.needInterpolate=!0,this.isPaused=!1,this.showVehiclePlate=!1,this.showGroundVehicle=!0,this.showElevatedVehicle=!0,this.historyPositionMap=new Map,this.vehicleObjectMap=new Map,this.view=i,this.mapConfig=m.toRaw(this.appDataStore.mapConfig),this.vehicleLayer=new g({id:"vehicleLayer"}),this.view.map.add(this.vehicleLayer);const t=localStorage.getItem("gpu");this.hasGpu=t!=="Unknown"}getLog(){return this.logTable}async init(){}addVehicles(i){return new Promise(t=>{if(this.isPaused){t();return}const e=i.map(s=>{const{vehicleId:o,heading:r,localTimestamp:h}=s,l=Number(s.x),n=Number(s.y),a=new p({geometry:{type:"point",x:l,y:n},attributes:{...s,type:"trackVehicle"},symbol:this.hasGpu?this.createCIMSymbol(s):this.createMarkerSymbol()});return this.hasGpu&&(a.visible=!1,this.historyPositionMap.set(o,[{pos:[l,n,0],heading:r,time:h}]),this.vehicleObjectMap.set(o,{graphic:a,data:s,waitForDelete:!1,isMoving:!1})),a});this.vehicleLayer.addMany(e),t()})}updateVehicles(i){return new Promise(t=>{if(this.isPaused){t();return}const e=[];i.forEach(s=>{const{vehicleId:o,heading:r,localTimestamp:h}=s,l=Number(s.x),n=Number(s.y);if(this.hasGpu){const a=this.vehicleObjectMap.get(o);a?(a.data=s,a.graphic.attributes={...s,type:"trackVehicle"},this.historyPositionMap.get(o).push({pos:[l,n,0],heading:r,time:h})):e.push(s)}else{const a=this.vehicleLayer.graphics.find(c=>c.getAttribute("vehicleId")==s.vehicleId);a?a.geometry={type:"point",x:l,y:n}:e.push(s)}}),this.addVehicles(e),t()})}deleteVehicles(i){this.isPaused||(this.hasGpu?i.forEach(t=>{const e=this.vehicleObjectMap.get(t);e&&(e.waitForDelete=!0)}):i.forEach(t=>{const e=this.vehicleLayer.graphics.find(s=>s.getAttribute("vehicleId")==t);e&&this.vehicleLayer.remove(e)}))}clearVehicles(){this.vehicleLayer.removeAll(),this.vehicleObjectMap.clear(),this.historyPositionMap.clear()}toggleGroundVehicle(i){this.showGroundVehicle=i}toggleElevatedVehicle(i){this.showElevatedVehicle=i}toggleTrafficInfo(i){i.name==="vehiclePlate"&&(this.showVehiclePlate=i.visible)}togglePause(i){this.isPaused=i,this.isPaused&&this.rafSignal?cancelAnimationFrame(this.rafSignal):this.rafSignal=requestAnimationFrame(()=>this.render())}updatePanelContent(i){console.log(i)}setInterpolate(i){this.needInterpolate=i}render(){this.isPaused||this.vehicleObjectMap.forEach((i,t)=>{this.updatePosition(t)}),this.rafSignal=requestAnimationFrame(()=>this.render())}updatePosition(i){const t=this.historyPositionMap.get(i),e=this.vehicleObjectMap.get(i);if(!t||!e||!e.isMoving&&t.length<=2)return;e.isMoving=!0,(e.graphic.getAttribute("roadLayer")||"1")==="1"?e.graphic.visible=this.showGroundVehicle:e.graphic.visible=this.showElevatedVehicle,e.segmentStartTime||(e.segmentStartTime=Date.now(),e.segmentTotalTime=t[1].time-t[0].time);const o=Date.now()-e.segmentStartTime,r=Math.min(1,o/e.segmentTotalTime);if(r===1)if(t.shift(),t.length===1){e.waitForDelete?(this.vehicleLayer.remove(e.graphic),this.vehicleObjectMap.delete(i),this.historyPositionMap.delete(i)):(e.segmentStartTime=void 0,e.segmentTotalTime=void 0,e.graphic.visible=!1,e.isMoving=!1);return}else e.segmentStartTime=Date.now(),e.segmentTotalTime=t[1].time-t[0].time,Math.abs(t[1].heading-t[0].heading)>180&&(t[1].heading>t[0].heading?t[0].heading+=360:t[1].heading+=360),e.graphic.geometry={type:"point",x:t[0].pos[0],y:t[0].pos[1]};else{const h=t[0].pos[0]+(t[1].pos[0]-t[0].pos[0])*r,l=t[0].pos[1]+(t[1].pos[1]-t[0].pos[1])*r,n=t[0].heading+(t[1].heading-t[0].heading)*r;e.graphic.geometry={type:"point",x:h,y:l},e.data.heading=n,e.graphic.symbol=this.hasGpu?this.createCIMSymbol(e.data):this.createMarkerSymbol()}}createCIMSymbol(i){const t=this.getPlateFontColor(i.plateColor),e=this.getCarPic(i.vehicleColor,i.speed);return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.showName",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:this.showVehiclePlate,size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-8,ymin:-8,xmax:8,ymax:8},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:4,horizontalAlignment:"Center",offsetX:0,offsetY:8,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t.backgroundColor}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t.fillColor}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:e.size,rotation:i.heading,rotateClockwise:!0,textureFilter:"Picture",url:`${this.mapConfig.assetsRoot}Images/${e.pic}`}]}}}}createMarkerSymbol(){return{type:"simple-marker",color:"green",size:5,outline:{color:"white",width:1}}}getCarPic(i,t){if(this.view.scale>=1e3){let e="point_green.png";return t&&(t<=4.2?e="point_red.png":t<=8.4?e="point_yellow.png":e="point_green.png"),{pic:e,size:15}}else{let e="grey";switch(typeof i=="string"&&(i=i.toLowerCase()),i){case"a":case 1:e="white";break;case"b":case 2:e="grey";break;case"c":case 3:e="yellow";break;case"d":case 4:e="pink";break;case"e":case 5:e="red";break;case"f":case 10:e="purple";break;case"g":case 6:e="green";break;case"h":case 7:e="blue";break;case"i":case 8:e="brown";break;case"j":case 9:e="black";break}return{pic:"/car/"+e+".png",size:20}}}getPlateFontColor(i){let t=[255,255,255,255],e=[169,169,169,255];switch(i){case 0:t=[0,0,0,255],e=[255,255,255,255];break;case 1:t=[0,0,0,255],e=[244,164,96,255];break;case 2:t=[255,255,255,255],e=[65,105,225,255];break;case 3:t=[255,255,255,255],e=[0,0,0,255];break;case 15:t=[244,164,96,255],e=[0,250,154,255];break;case 16:t=[0,0,0,255],e=[0,250,154,255];break}return{fillColor:t,backgroundColor:e}}}exports.default=y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("../common-utils.js");class o{constructor(t,
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=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(p),a=m(C);class w{constructor(e){var i;this.crossScale=5e3,this.crossIdsInDistrict=[],this.view=e;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}):await this.view.goTo(t.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}async highlightSignalControlArea(e){if(!e.id||e.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(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("id")===e.id||s.getAttribute("districtId")===e.id||s.getAttribute("subDistrictId")===e.id).toArray().map(s=>s.clone());if(t.length>0&&this.highlightLayer.addMany(t),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);else if(r.length>0){const s=r[0].geometry.centroid;await this.view.goTo({target:s,scale:this.crossScale-500})}else i.length>1?await this.view.goTo(i):await this.view.goTo({target:i[0].geometry,scale:1500});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,{status:0,message:"ok"}}showSubSignalControlArea(e){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const r=e.children.map(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),{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({id:i.getAttribute("id"),name:i.getAttribute("name")}),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())}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(b=>a.point(b)));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:`${t?"区控":"子区"} ${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;
|
|
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("id")===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())}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;
|
package/lib/src/types/index.d.ts
CHANGED
|
@@ -284,13 +284,15 @@ export interface INode {
|
|
|
284
284
|
}
|
|
285
285
|
export interface IEditSignalControlAreaParams {
|
|
286
286
|
crossesInArea: INode[];
|
|
287
|
-
addCrossCallback: (params:
|
|
288
|
-
id: string;
|
|
289
|
-
name: string;
|
|
290
|
-
}) => void;
|
|
287
|
+
addCrossCallback: (params: INode) => void;
|
|
291
288
|
removeCrossCallback: (params: {
|
|
292
289
|
id: string;
|
|
293
290
|
}) => void;
|
|
294
291
|
removeAllCrossCallback?: () => void;
|
|
295
292
|
odrServer: string;
|
|
296
293
|
}
|
|
294
|
+
export interface IShowGreenWaveBandParams {
|
|
295
|
+
bandId: string;
|
|
296
|
+
coordinates: number[][];
|
|
297
|
+
nodeList: INode[];
|
|
298
|
+
}
|