gisviewer-vue3-arcgis 1.0.133 → 1.0.135

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 (58) hide show
  1. package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
  2. package/es/src/gis-map/gis-map.vue.d.ts +17 -0
  3. package/es/src/gis-map/gis-map.vue.mjs +118 -113
  4. package/es/src/gis-map/index.d.ts +17 -0
  5. package/es/src/gis-map/utils/components/sketch-tool.vue.d.ts +18 -0
  6. package/es/src/gis-map/utils/components/sketch-tool.vue.mjs +7 -0
  7. package/es/src/gis-map/utils/components/sketch-tool.vue2.mjs +48 -0
  8. package/es/src/gis-map/utils/components/sketch-tool.vue3.mjs +4 -0
  9. package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +2 -1
  10. package/es/src/gis-map/utils/open-drive-renderer/index.mjs +18 -16
  11. package/es/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +1 -0
  12. package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +5 -4
  13. package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +2 -1
  14. package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +52 -24
  15. package/es/style.css +1 -1
  16. package/lib/_virtual/_plugin-vue_export-helper.js +1 -0
  17. package/lib/src/gis-map/gis-map.vue.d.ts +17 -0
  18. package/lib/src/gis-map/gis-map.vue.js +1 -1
  19. package/lib/src/gis-map/index.d.ts +17 -0
  20. package/lib/src/gis-map/utils/components/sketch-tool.vue.d.ts +18 -0
  21. package/lib/src/gis-map/utils/components/sketch-tool.vue.js +1 -0
  22. package/lib/src/gis-map/utils/components/sketch-tool.vue2.js +1 -0
  23. package/lib/src/gis-map/utils/components/sketch-tool.vue3.js +1 -0
  24. package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +2 -1
  25. package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
  26. package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +1 -0
  27. package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -1
  28. package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +2 -1
  29. package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
  30. package/package.json +1 -1
  31. package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +0 -17
  32. package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.mjs +0 -49
  33. package/es/src/gis-map/utils/open-drive-renderer/junction.d.ts +0 -51
  34. package/es/src/gis-map/utils/open-drive-renderer/junction.mjs +0 -151
  35. package/es/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +0 -48
  36. package/es/src/gis-map/utils/open-drive-renderer/lane-section.mjs +0 -82
  37. package/es/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +0 -29
  38. package/es/src/gis-map/utils/open-drive-renderer/lane-utils.mjs +0 -265
  39. package/es/src/gis-map/utils/open-drive-renderer/lane.d.ts +0 -77
  40. package/es/src/gis-map/utils/open-drive-renderer/lane.mjs +0 -110
  41. package/es/src/gis-map/utils/open-drive-renderer/road.d.ts +0 -62
  42. package/es/src/gis-map/utils/open-drive-renderer/road.mjs +0 -121
  43. package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +0 -108
  44. package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.mjs +0 -425
  45. package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +0 -17
  46. package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.js +0 -1
  47. package/lib/src/gis-map/utils/open-drive-renderer/junction.d.ts +0 -51
  48. package/lib/src/gis-map/utils/open-drive-renderer/junction.js +0 -1
  49. package/lib/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +0 -48
  50. package/lib/src/gis-map/utils/open-drive-renderer/lane-section.js +0 -1
  51. package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +0 -29
  52. package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.js +0 -1
  53. package/lib/src/gis-map/utils/open-drive-renderer/lane.d.ts +0 -77
  54. package/lib/src/gis-map/utils/open-drive-renderer/lane.js +0 -1
  55. package/lib/src/gis-map/utils/open-drive-renderer/road.d.ts +0 -62
  56. package/lib/src/gis-map/utils/open-drive-renderer/road.js +0 -1
  57. package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +0 -108
  58. package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.js +0 -1
@@ -1,12 +1,13 @@
1
- import h from "@arcgis/core/Graphic";
1
+ import * as y from "@arcgis/core/core/reactiveUtils.js";
2
+ import n from "@arcgis/core/Graphic";
2
3
  import a from "@arcgis/core/layers/GraphicsLayer";
3
- import y from "@turf/buffer";
4
- import g from "@turf/convex";
4
+ import g from "@turf/buffer";
5
+ import d from "@turf/convex";
5
6
  import * as c from "@turf/helpers";
6
- import m from "./district-controller.mjs";
7
+ import p from "./district-controller.mjs";
7
8
  class C {
8
9
  constructor(e) {
9
- this.view = e, this.view.popup.visibleElements = {
10
+ this.crossScale = 1500, this.view = e, this.view.popup.visibleElements = {
10
11
  closeButton: !0,
11
12
  collapseButton: !1,
12
13
  actionBar: !0
@@ -34,19 +35,42 @@ class C {
34
35
  showSignalControlArea(e) {
35
36
  this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0;
36
37
  for (const t of e) {
37
- const r = new m(t);
38
+ const r = new p(t);
38
39
  this.drawArea(r, !0);
39
40
  }
40
- return { status: 0, message: "ok" };
41
+ return this.watchHandle = y.watch(
42
+ () => this.view.scale,
43
+ (t, r) => {
44
+ t > this.crossScale && r <= this.crossScale ? this.crossLayer.graphics.forEach((s) => {
45
+ s.symbol = {
46
+ type: "simple-marker",
47
+ color: s.getAttribute("color"),
48
+ size: 8,
49
+ outline: {
50
+ color: "white",
51
+ width: 1
52
+ }
53
+ };
54
+ }) : t <= this.crossScale && r > this.crossScale && this.crossLayer.graphics.forEach((s) => {
55
+ s.symbol = {
56
+ type: "picture-marker",
57
+ url: "/GisViewerAssets/images/xhj_1.png",
58
+ width: "37px",
59
+ height: "57px",
60
+ yoffset: "25px"
61
+ };
62
+ });
63
+ }
64
+ ), { status: 0, message: "ok" };
41
65
  }
42
66
  clearSignalControlArea() {
43
67
  var e;
44
- return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), (e = this.eventHandle) == null || e.remove(), this.view.closePopup(), { status: 0, message: "ok" };
68
+ return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), (e = this.watchHandle) == null || e.remove(), this.view.closePopup(), { status: 0, message: "ok" };
45
69
  }
46
70
  async locateSignalControlArea(e) {
47
71
  const t = this.findAreaGraphic(e.id);
48
72
  if (t) {
49
- await this.view.goTo(t.geometry);
73
+ t.attributes.type === "cross" ? await this.view.goTo({ target: t.geometry, scale: 3e3 }) : await this.view.goTo(t.geometry);
50
74
  const r = t.geometry.type === "point" ? t.geometry : t.geometry.centroid;
51
75
  return this.view.openPopup({
52
76
  features: [t],
@@ -93,10 +117,10 @@ class C {
93
117
  if (r.length > 2) {
94
118
  const i = c.featureCollection(
95
119
  r.map((u) => c.point(u))
96
- ), l = g(i);
120
+ ), l = d(i);
97
121
  if (!l)
98
122
  return;
99
- const d = y(
123
+ const m = g(
100
124
  l.geometry,
101
125
  // 区控面积更大,需要更大的缓冲半径
102
126
  t ? 200 : 30,
@@ -119,10 +143,6 @@ class C {
119
143
  label: "子区数量"
120
144
  }
121
145
  ] : o = [
122
- {
123
- fieldName: "parentId",
124
- label: "区控编号"
125
- },
126
146
  {
127
147
  fieldName: "parentName",
128
148
  label: "区控名称"
@@ -136,10 +156,10 @@ class C {
136
156
  label: "路口数量"
137
157
  }
138
158
  ];
139
- const n = new h({
159
+ const h = new n({
140
160
  geometry: {
141
161
  type: "polygon",
142
- rings: d.geometry.coordinates
162
+ rings: m.geometry.coordinates
143
163
  },
144
164
  symbol: {
145
165
  type: "simple-fill",
@@ -169,11 +189,11 @@ class C {
169
189
  ]
170
190
  }
171
191
  });
172
- t ? this.districtControllerLayer.add(n) : this.subDistrictControllerLayer.add(n);
192
+ t ? this.districtControllerLayer.add(h) : this.subDistrictControllerLayer.add(h);
173
193
  }
174
194
  for (const i of e.subDistricts)
175
195
  this.drawArea(i, !1);
176
- const s = e.crosses.map((i) => new h({
196
+ const s = e.crosses.map((i) => new n({
177
197
  geometry: {
178
198
  type: "point",
179
199
  x: i.longitude,
@@ -192,8 +212,12 @@ class C {
192
212
  type: "cross",
193
213
  id: i.id,
194
214
  name: i.name,
215
+ color: e.areaColor,
216
+ signalId: i.signalId,
195
217
  districtId: t ? e.id : e.parentId,
196
- subDistrictId: t ? "" : e.id
218
+ districtName: t ? e.name : e.parentName,
219
+ subDistrictId: t ? "" : e.id,
220
+ subDistrictName: t ? "" : e.name
197
221
  },
198
222
  popupTemplate: {
199
223
  title: i.name,
@@ -202,16 +226,20 @@ class C {
202
226
  type: "fields",
203
227
  fieldInfos: [
204
228
  {
205
- fieldName: "districtId",
206
- label: "区控编号"
229
+ fieldName: "districtName",
230
+ label: "区控名称"
207
231
  },
208
232
  {
209
- fieldName: "subDistrictId",
210
- label: "子区编号"
233
+ fieldName: "subDistrictName",
234
+ label: "子区名称"
211
235
  },
212
236
  {
213
237
  fieldName: "id",
214
238
  label: "路口编号"
239
+ },
240
+ {
241
+ fieldName: "signalId",
242
+ label: "信号机编号"
215
243
  }
216
244
  ]
217
245
  }
package/es/style.css CHANGED
@@ -1 +1 @@
1
- .gis-viewer{overflow:auto;scrollbar-width:none;-ms-overflow-style:none;&::-webkit-scrollbar{display:none}}
1
+ .gis-viewer{overflow:auto;scrollbar-width:none;-ms-overflow-style:none;&::-webkit-scrollbar{display:none}}.gisviewer-sketch-tool-position[data-v-ac0f5d06]{position:absolute;top:10px;right:10px;z-index:1000}.gisviewer-sketch-tool[data-v-ac0f5d06]{display:flex;flex-direction:row}.geometry-button-selected[data-v-ac0f5d06]{background:#4c4c4c;color:#fff}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=(e,o)=>{const t=e.__vccOpts||e;for(const[r,s]of o)t[r]=s;return t};exports.default=u;
@@ -30,6 +30,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
30
30
  openDriveRenderer: OpenDriveRenderer;
31
31
  signalControlAreaController: SignalControlAreaController;
32
32
  showLogDiv: import("vue").Ref<boolean>;
33
+ showGroupSelect: import("vue").Ref<boolean>;
33
34
  mapViewer: import("vue").ComputedRef<MapView | SceneView>;
34
35
  startSaveTrackLog: () => void;
35
36
  downloadTrackLog: () => void;
@@ -88,6 +89,22 @@ declare const _sfc_main: import("vue").DefineComponent<{
88
89
  resetHighlightSignalControlArea: () => import("../types").IResult;
89
90
  props: any;
90
91
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
92
+ sketchTool: import("vue").DefineComponent<{
93
+ view: {
94
+ type: null;
95
+ required: true;
96
+ };
97
+ }, {
98
+ props: any;
99
+ sketchVM: __esri.SketchViewModel;
100
+ resetButtonHandler: () => void;
101
+ geometrySelectionHandler: (event: any) => void;
102
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
103
+ view: {
104
+ type: null;
105
+ required: true;
106
+ };
107
+ }>>, {}, {}>;
91
108
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
92
109
  config: {
93
110
  type: StringConstructor;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),y=require("./stores/index.js");require("./style/index.css");const Se=require("./utils/holo-flow/index.js"),Ce=require("./utils/map-initializer.js"),C=require("./utils/open-drive-renderer/index.js"),Oe=require("./utils/overlay.js"),ke=require("./utils/queue-length.js"),O=require("./utils/road-config-tool/index.js"),Te=require("./utils/signal-control-area-controller/index.js"),Ae=require("./utils/traffic-flow.js"),De={class:"gis-viewer"},Le={style:{position:"absolute",bottom:"10px",left:"10px"}},Ie=o.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:T,emit:A}){const d=o.ref(null);let i,l,c,n,a,r,g,t,s;const p=o.ref(!1);o.onMounted(async()=>{if(y.registerStore(),!d.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(p.value=!p.value)});const e=o.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,S=await(await fetch(h.config)).json();S.assetsRoot=h.assetsRoot||u;const ye=y.default.useAppDataStore;ye.mapConfig=S,l=new Ce.default,i=await l.initialize({container:d.value,markerClickCallback:(m,w,v,he)=>{f("markerClick",m,w,v,he)},mapClickCallback:(m,w,v)=>{f("mapClick",m,w,v)}}),a=new Se.default(i),await a.init(),f("mapLoaded")}),o.onUnmounted(()=>{s==null||s.clearSignalControlArea(),t==null||t.clearOpenDrive(),a==null||a.clearHoloTrace(),a==null||a.clearHoloSignal(),n==null||n.disconnectTrafficFlow()});const D=o.computed(()=>i),L=()=>{const e=y.default.useAppDataStore;e.saveTrackLog=!0},I=()=>{a.downloadTrackLog()},b=async e=>await l.setMapCenter(e),q=async e=>await l.setMapCamera(e),_=async e=>await l.lookAt(e),x=e=>l.setLayerVisibility(e),H=(e,u)=>l.requestCoordinateTransform(e,u),V=e=>{l.cancelCoordinateTransform(e)},M=e=>{l.setMapZoomRange(e)},N=e=>(c||(c=new O.default(i)),c.showLaneNumber(e)),B=()=>{c==null||c.clearLaneNumber()},E=async e=>(c||(c=new O.default(i)),await c.initializeSearch(e)),j=async()=>c==null?void 0:c.calCrossIndicatorArea(),z=async()=>{},P=async(e,u)=>{n||(n=new Ae.default(i)),n.connectTrafficFlow(e,u)},Q=()=>{n==null||n.disconnectTrafficFlow()},F=e=>{a.handleVehicleTraceData(e)},Z=()=>{a.clearHoloTrace()},K=e=>{a.setInterpolate(e)},U=async e=>{await a.handleSignalData(e)},G=()=>{a.clearHoloSignal()},J=e=>{n==null||n.toggleTrafficInfo(e),a.toggleTrafficInfo(e)},R=e=>{a.togglePause(e)},W=e=>{n==null||n.toggleTrafficObject(e),a.toggleTrafficObject(e)},X=e=>{a.updatePanelContent(e)},Y=async e=>(r||(r=new Oe.default(i)),r.addOverlays(e)),$=e=>r==null?void 0:r.removeOverlaysByType(e),ee=e=>r==null?void 0:r.removeOverlaysById(e),te=()=>r==null?void 0:r.removeAllOverlays(),ae=()=>{r==null||r.showAllOverlays()},ne=e=>{g||(g=new ke.default(i)),g.updateQueueLength(e)},re=()=>{g==null||g.removeQueueLength()},se=async(e,u)=>(t||(t=new C.default(i)),await t.showOpenDriveFromServer(e,u)),oe=async e=>(t||(t=new C.default(i)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),ce=async()=>await(t==null?void 0:t.clearOpenDrive()),ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},le=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ue=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ge=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},me=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},de=e=>(s||(s=new Te.default(i)),s.showSignalControlArea(e)),pe=()=>{s==null||s.clearSignalControlArea()},fe=async e=>s?await s.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},we=async e=>s?await s.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},ve=()=>s?s.resetHighlight():{status:-1,message:"未加载信号控制区"},h=k,f=A;return T({mapViewer:D,setLayerVisibility:x,setMapCenter:b,lookAt:_,setMapCamera:q,setMapZoomRange:M,requestCoordinateTransform:H,cancelCoordinateTransform:V,addOverlays:Y,showAllOverlays:ae,removeOverlaysByType:$,removeOverlaysById:ee,removeAllOverlays:te,showLaneNumber:N,clearLaneNumber:B,initializeAreaTool:E,calCrossIndicatorArea:j,calRoadIndicatorArea:z,connectCarFlow:P,disconnectCarFlow:Q,handleHoloVehicleTraceData:F,clearHoloTrace:Z,handleHoloSignalData:U,clearHoloSignal:G,setInterpolate:K,toggleTrafficInfo:J,toggleTrafficObject:W,toggleVehicleInfo:X,togglePause:R,updateQueueLength:ne,removeQueueLength:re,showOpenDriveFromServer:se,showOpenDriveFromFile:oe,clearOpenDrive:ce,findSumoInOpenDrive:ie,selectSumoInOpenDrive:le,unselectSumoInOpenDrive:ue,getSumoInfo:ge,splitOpenDriveLane:me,showSignalControlArea:de,clearSignalControlArea:pe,locateSignalControlArea:fe,highlightSignalControlArea:we,resetHighlightSignalControlArea:ve}),(e,u)=>(o.openBlock(),o.createElementBlock("div",De,[o.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:d},[o.withDirectives(o.createElementVNode("div",Le,[o.createElementVNode("button",{style:{"margin-right":"10px"},onClick:L}," 开始记录 "),o.createElementVNode("button",{onClick:I},"下载日志")],512),[[o.vShow,p.value]])],512)]))}});exports.default=Ie;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),y=require("./stores/index.js");require("./style/index.css");const Ce=require("./utils/components/sketch-tool.vue.js"),Oe=require("./utils/holo-flow/index.js"),ke=require("./utils/map-initializer.js"),C=require("./utils/open-drive-renderer/index.js"),Te=require("./utils/overlay.js"),Ae=require("./utils/queue-length.js"),O=require("./utils/road-config-tool/index.js"),De=require("./utils/signal-control-area-controller/index.js"),Le=require("./utils/traffic-flow.js"),Ie={class:"gis-viewer"},be={style:{position:"absolute",bottom:"10px",left:"10px"}},qe=a.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:T,emit:A}){const f=a.ref(null);let c,l,i,r,n,o,m,t,s;const d=a.ref(!1),D=a.ref(!1);a.onMounted(async()=>{if(y.registerStore(),!f.value)return;document.addEventListener("keydown",g=>{g.ctrlKey&&g.key==="i"&&(d.value=!d.value)});const e=a.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,S=await(await fetch(h.config)).json();S.assetsRoot=h.assetsRoot||u;const he=y.default.useAppDataStore;he.mapConfig=S,l=new ke.default,c=await l.initialize({container:f.value,markerClickCallback:(g,w,v,Se)=>{p("markerClick",g,w,v,Se)},mapClickCallback:(g,w,v)=>{p("mapClick",g,w,v)}}),n=new Oe.default(c),await n.init(),p("mapLoaded")}),a.onUnmounted(()=>{s==null||s.clearSignalControlArea(),t==null||t.clearOpenDrive(),n==null||n.clearHoloTrace(),n==null||n.clearHoloSignal(),r==null||r.disconnectTrafficFlow()});const L=a.computed(()=>c),I=()=>{const e=y.default.useAppDataStore;e.saveTrackLog=!0},b=()=>{n.downloadTrackLog()},q=async e=>await l.setMapCenter(e),_=async e=>await l.setMapCamera(e),x=async e=>await l.lookAt(e),V=e=>l.setLayerVisibility(e),H=(e,u)=>l.requestCoordinateTransform(e,u),M=e=>{l.cancelCoordinateTransform(e)},N=e=>{l.setMapZoomRange(e)},B=e=>(i||(i=new O.default(c)),i.showLaneNumber(e)),E=()=>{i==null||i.clearLaneNumber()},j=async e=>(i||(i=new O.default(c)),await i.initializeSearch(e)),z=async()=>i==null?void 0:i.calCrossIndicatorArea(),P=async()=>{},Q=async(e,u)=>{r||(r=new Le.default(c)),r.connectTrafficFlow(e,u)},F=()=>{r==null||r.disconnectTrafficFlow()},Z=e=>{n.handleVehicleTraceData(e)},G=()=>{n.clearHoloTrace()},K=e=>{n.setInterpolate(e)},U=async e=>{await n.handleSignalData(e)},J=()=>{n.clearHoloSignal()},R=e=>{r==null||r.toggleTrafficInfo(e),n.toggleTrafficInfo(e)},W=e=>{n.togglePause(e)},X=e=>{r==null||r.toggleTrafficObject(e),n.toggleTrafficObject(e)},Y=e=>{n.updatePanelContent(e)},$=async e=>(o||(o=new Te.default(c)),o.addOverlays(e)),ee=e=>o==null?void 0:o.removeOverlaysByType(e),te=e=>o==null?void 0:o.removeOverlaysById(e),ae=()=>o==null?void 0:o.removeAllOverlays(),ne=()=>{o==null||o.showAllOverlays()},re=e=>{m||(m=new Ae.default(c)),m.updateQueueLength(e)},oe=()=>{m==null||m.removeQueueLength()},se=async(e,u)=>(t||(t=new C.default(c)),await t.showOpenDriveFromServer(e,u)),ce=async e=>(t||(t=new C.default(c)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),ie=async()=>await(t==null?void 0:t.clearOpenDrive()),le=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},ue=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},me=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ge=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},fe=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},de=e=>(s||(s=new De.default(c)),s.showSignalControlArea(e)),pe=()=>{s==null||s.clearSignalControlArea()},we=async e=>s?await s.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},ve=async e=>s?await s.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},ye=()=>s?s.resetHighlight():{status:-1,message:"未加载信号控制区"},h=k,p=A;return T({mapViewer:L,setLayerVisibility:V,setMapCenter:q,lookAt:x,setMapCamera:_,setMapZoomRange:N,requestCoordinateTransform:H,cancelCoordinateTransform:M,addOverlays:$,showAllOverlays:ne,removeOverlaysByType:ee,removeOverlaysById:te,removeAllOverlays:ae,showLaneNumber:B,clearLaneNumber:E,initializeAreaTool:j,calCrossIndicatorArea:z,calRoadIndicatorArea:P,connectCarFlow:Q,disconnectCarFlow:F,handleHoloVehicleTraceData:Z,clearHoloTrace:G,handleHoloSignalData:U,clearHoloSignal:J,setInterpolate:K,toggleTrafficInfo:R,toggleTrafficObject:X,toggleVehicleInfo:Y,togglePause:W,updateQueueLength:re,removeQueueLength:oe,showOpenDriveFromServer:se,showOpenDriveFromFile:ce,clearOpenDrive:ie,findSumoInOpenDrive:le,selectSumoInOpenDrive:ue,unselectSumoInOpenDrive:me,getSumoInfo:ge,splitOpenDriveLane:fe,showSignalControlArea:de,clearSignalControlArea:pe,locateSignalControlArea:we,highlightSignalControlArea:ve,resetHighlightSignalControlArea:ye}),(e,u)=>(a.openBlock(),a.createElementBlock("div",Ie,[a.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:f},[a.withDirectives(a.createElementVNode("div",be,[a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:I}," 开始记录 "),a.createElementVNode("button",{onClick:b},"下载日志")],512),[[a.vShow,d.value]]),D.value?(a.openBlock(),a.createBlock(Ce.default,{key:0,view:a.unref(c)},null,8,["view"])):a.createCommentVNode("",!0)],512)]))}});exports.default=qe;
@@ -19,6 +19,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
19
19
  openDriveRenderer: import("./utils/open-drive-renderer").default;
20
20
  signalControlAreaController: import("./utils/signal-control-area-controller").default;
21
21
  showLogDiv: import("vue").Ref<boolean>;
22
+ showGroupSelect: import("vue").Ref<boolean>;
22
23
  mapViewer: import("vue").ComputedRef<__esri.MapView | __esri.SceneView>;
23
24
  startSaveTrackLog: () => void;
24
25
  downloadTrackLog: () => void;
@@ -77,6 +78,22 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
77
78
  resetHighlightSignalControlArea: () => import("../types").IResult;
78
79
  props: any;
79
80
  emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
81
+ sketchTool: import("vue").DefineComponent<{
82
+ view: {
83
+ type: null;
84
+ required: true;
85
+ };
86
+ }, {
87
+ props: any;
88
+ sketchVM: __esri.SketchViewModel;
89
+ resetButtonHandler: () => void;
90
+ geometrySelectionHandler: (event: any) => void;
91
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
92
+ view: {
93
+ type: null;
94
+ required: true;
95
+ };
96
+ }>>, {}, {}>;
80
97
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
81
98
  config: {
82
99
  type: StringConstructor;
@@ -0,0 +1,18 @@
1
+ import SketchViewModel from '@arcgis/core/widgets/Sketch/SketchViewModel';
2
+ declare const _sfc_main: import("vue").DefineComponent<{
3
+ view: {
4
+ type: null;
5
+ required: true;
6
+ };
7
+ }, {
8
+ props: any;
9
+ sketchVM: SketchViewModel;
10
+ resetButtonHandler: () => void;
11
+ geometrySelectionHandler: (event: any) => void;
12
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
+ view: {
14
+ type: null;
15
+ required: true;
16
+ };
17
+ }>>, {}, {}>;
18
+ export default _sfc_main;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./sketch-tool.vue2.js");require("./sketch-tool.vue3.js");const t=require("../../../../_virtual/_plugin-vue_export-helper.js"),u=t.default(e.default,[["__scopeId","data-v-ac0f5d06"]]);exports.default=u;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),a=require("@arcgis/core/layers/GraphicsLayer"),u=require("@arcgis/core/widgets/Sketch/SketchViewModel"),d={class:"gisviewer-sketch-tool gisviewer-sketch-tool-position"},g=e.defineComponent({__name:"sketch-tool",props:{view:{}},setup(l){const c=l;let t;e.onMounted(()=>{const o=new a;c.view.map.add(o),t=new u({layer:o,view:c.view})}),e.onUnmounted(()=>{t.destroy()});const i=()=>{},s=o=>{var r;console.log(o);const n=(r=o.target)==null?void 0:r.value;console.log(n),t.create(n)};return(o,n)=>(e.openBlock(),e.createElementBlock("div",d,[e.createElementVNode("button",{class:"esri-icon-pan geometry-button",onClick:i}),e.createElementVNode("button",{class:"esri-icon-checkbox-unchecked geometry-button",value:"rectangle",onClick:s}),e.createElementVNode("button",{class:"esri-icon-polygon geometry-button",value:"polygon",onClick:s})]))}});exports.default=g;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="";exports.default=e;
@@ -9,11 +9,11 @@ export default class OpenDriveRenderer {
9
9
  private sectionLayer;
10
10
  private highlightLayer;
11
11
  private flashLayer;
12
+ private drawLayer;
12
13
  private allLaneGraphics;
13
14
  private allRefLineGraphics;
14
15
  private mouseMoveHandler;
15
16
  private mouseClickHandler;
16
- private wasmLoader;
17
17
  constructor(view: __esri.MapView | __esri.SceneView);
18
18
  private projectName;
19
19
  private openDriveServer;
@@ -49,6 +49,7 @@ export default class OpenDriveRenderer {
49
49
  private currentJunctionId;
50
50
  private hitGraphic;
51
51
  private highlightGraphic;
52
+ private monitorMouseDrag;
52
53
  /**
53
54
  * 监听鼠标移动事件,高亮显示鼠标所在路段和路口
54
55
  */
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),$=require("@arcgis/core/core/promiseUtils"),M=require("@arcgis/core/geometry"),P=require("@arcgis/core/geometry/geometryEngine"),G=require("@arcgis/core/layers/FeatureLayer"),v=require("@arcgis/core/layers/GraphicsLayer"),y=require("axios"),J=require("md5"),A=require("pako"),C=require("../common-utils.js"),x=require("./wasm-loader.js");function O(m){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const t in m)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(m,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>m[t]})}}return e.default=m,Object.freeze(e)}const N=O($),L=O(P);class D{constructor(e){this.wasmLoader=x.default.getInstance(),this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.currentJunctionId="",this.view=e,this.view.popup.visibleElements={closeButton:!1,collapseButton:!1,actionBar:!1},this.laneLayer=new G({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new G({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new v({id:"OpenDriveJunction"}),this.sectionLayer=new v({id:"OpenDriveSection"}),this.highlightLayer=new v({id:"OpenDriveHighlight"}),this.flashLayer=new v({id:"OpenDriveFlash"}),this.view.map.addMany([this.laneLayer,this.junctionLayer,this.sectionLayer,this.roadNameLayer,this.highlightLayer,this.flashLayer])}static getInstance(e){return this.instance||(this.instance=new D(e)),this.instance}async makeMd5FromFile(e){try{const i=await(await fetch(e)).text();return{status:0,message:"ok",result:J(i)}}catch(t){return{status:-1,message:t.message}}}async showOpenDriveFromFile(e){var h,g;this.openDriveClickCallback=e.selectedCallback,console.time("md5用时");const t=await this.makeMd5FromFile(e.file);if(t.status!==0)return t;this.projectName=t.result,console.timeEnd("md5用时"),this.openDriveServer=e.server,await this.makeMd5FromFile(e.file);const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await y.post(i,{},{params:{url:e.file,projectName:this.projectName}})}catch(d){return{status:-1,message:d.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;C.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e.server}${l}`);const a=await(await fetch(l)).arrayBuffer(),r=A.inflate(a,{to:"string"}),c=JSON.parse(r);await this.showAllLanes(c,((h=e.options)==null?void 0:h.showJunctionLane)||!1,((g=e.options)==null?void 0:g.showRoadName)||!0);const u=o.data.result.junctions;if(this.showJunction(u),e.options&&e.options.centerMap!==!1){const d=C.default.transformPointProjection([0,0]);await this.view.goTo(d)}return this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick(),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await y.get(i,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let s=o.data.result.json;s.startsWith(window.location.protocol)||(s=`${window.location.protocol}//${e}${s}`);const n=await(await fetch(s)).arrayBuffer(),a=A.inflate(n,{to:"string"}),r=JSON.parse(a);return await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=i,new Promise(s=>{let l=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const r of e){if(!t&&r.junction!=="-1")continue;const{id:c,refLine:u}=r;let h=r.name;h.includes("(")&&(h=h.slice(0,h.indexOf("("))),h=h.replace(/(.)/g,"$1 ");const g=new p({geometry:{type:"polyline",paths:[u]},attributes:{ObjectID:l++,roadId:c,roadName:h}});this.allRefLineGraphics.push(g),r.laneSections.sort((d,b)=>Number(d.id)-Number(b.id));for(let d=0;d<r.laneSections.length;d++){const b=r.laneSections[d],k=Number(b.id);for(const f of b.lanePaths){const w=Number(f.id);if(w===0)continue;const F=f.type,I=f.innerPath.concat(f.outerPath.reverse());if(I.length<=3){console.warn(`lane ${w} has less than 3 points`);continue}I.push(f.innerPath[0]);const j=new M.Polygon({rings:[I]});if(j){const S=new p({geometry:j,attributes:{ObjectID:l++,id:`${c}+${k}+${w}`,roadId:c,roadName:r.name,sectionId:k,sectionIndex:d,laneId:w,type:F,sumoId:""}});this.allLaneGraphics.push(S),n.push(S)}}}}const a=setInterval(()=>{if(n.length>0||this.allRefLineGraphics.length>0){if(n.length>0){const r=n.splice(0,100);this.laneLayer.applyEdits({addFeatures:r})}if(this.allRefLineGraphics.length>0){const r=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:r})}}else clearInterval(a),s()},10)})}showJunction(e){const t=[];for(const i of e){if(!i)continue;i.nodeType=i.type;const o=new p({geometry:{type:"point",x:i.coordinates[0],y:i.coordinates[1]},attributes:{...i,selected:!1,type:"OpenDriveJunction"},symbol:{type:"picture-marker",url:i.crossId?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",width:30,height:30}});t.push(o)}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=N.debounce(async t=>{var l;const o=(l=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.filter(n=>n.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightGraphic=void 0,this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId="",this.view.closePopup());return}const s=o[0];if(this.hitGraphic=s.graphic,s.layer.id==="OpenDriveLane"){const n=`${this.hitGraphic.attributes.roadId}+${this.hitGraphic.attributes.sectionId}`;if(n===this.currentSectionCode||this.sectionLayer.graphics.findIndex(u=>u.getAttribute("id")===n)>=0)return;this.currentSectionCode=n;const r=this.allLaneGraphics.filter(u=>`${u.attributes.roadId}+${u.attributes.sectionId}`===n),c=L.union(r.map(u=>u.geometry));this.highlightGraphic=new p({geometry:c,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:n,selected:!1}}),this.highlightLayer.removeAll(),this.highlightLayer.add(this.highlightGraphic)}else if(s.layer.id==="OpenDriveJunction"){const n=this.hitGraphic.getAttribute("id");if(n===this.currentJunctionId)return;this.currentJunctionId=n;const a=this.hitGraphic.getAttribute("name"),r=this.hitGraphic.getAttribute("crossId");this.view.openPopup({title:a,content:`<table>
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),$=require("@arcgis/core/core/promiseUtils"),M=require("@arcgis/core/geometry"),P=require("@arcgis/core/geometry/geometryEngine"),G=require("@arcgis/core/layers/FeatureLayer"),g=require("@arcgis/core/layers/GraphicsLayer"),y=require("axios"),J=require("md5"),A=require("pako"),C=require("../common-utils.js");function O(m){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const t in m)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(m,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>m[t]})}}return e.default=m,Object.freeze(e)}const N=O($),L=O(P);class D{constructor(e){this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.currentJunctionId="",this.view=e,this.view.popup.visibleElements={closeButton:!1,collapseButton:!1,actionBar:!1},this.laneLayer=new G({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new G({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new g({id:"OpenDriveJunction"}),this.sectionLayer=new g({id:"OpenDriveSection"}),this.highlightLayer=new g({id:"OpenDriveHighlight"}),this.flashLayer=new g({id:"OpenDriveFlash"}),this.drawLayer=new g({id:"Draw"}),this.view.map.addMany([this.laneLayer,this.junctionLayer,this.sectionLayer,this.roadNameLayer,this.highlightLayer,this.flashLayer,this.drawLayer])}static getInstance(e){return this.instance||(this.instance=new D(e)),this.instance}async makeMd5FromFile(e){try{const i=await(await fetch(e)).text();return{status:0,message:"ok",result:J(i)}}catch(t){return{status:-1,message:t.message}}}async showOpenDriveFromFile(e){var h,b;this.openDriveClickCallback=e.selectedCallback,console.time("md5用时");const t=await this.makeMd5FromFile(e.file);if(t.status!==0)return t;this.projectName=t.result,console.timeEnd("md5用时"),this.openDriveServer=e.server,await this.makeMd5FromFile(e.file);const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await y.post(i,{},{params:{url:e.file,projectName:this.projectName}})}catch(d){return{status:-1,message:d.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;C.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e.server}${l}`);const a=await(await fetch(l)).arrayBuffer(),r=A.inflate(a,{to:"string"}),c=JSON.parse(r);await this.showAllLanes(c,((h=e.options)==null?void 0:h.showJunctionLane)||!1,((b=e.options)==null?void 0:b.showRoadName)||!0);const u=o.data.result.junctions;if(this.showJunction(u),e.options&&e.options.centerMap!==!1){const d=C.default.transformPointProjection([0,0]);await this.view.goTo(d)}return this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick(),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await y.get(i,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let s=o.data.result.json;s.startsWith(window.location.protocol)||(s=`${window.location.protocol}//${e}${s}`);const n=await(await fetch(s)).arrayBuffer(),a=A.inflate(n,{to:"string"}),r=JSON.parse(a);return await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=i,new Promise(s=>{let l=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const r of e){if(!t&&r.junction!=="-1")continue;const{id:c,refLine:u}=r;let h=r.name;h.includes("(")&&(h=h.slice(0,h.indexOf("("))),h=h.replace(/(.)/g,"$1 ");const b=new p({geometry:{type:"polyline",paths:[u]},attributes:{ObjectID:l++,roadId:c,roadName:h}});this.allRefLineGraphics.push(b),r.laneSections.sort((d,w)=>Number(d.id)-Number(w.id));for(let d=0;d<r.laneSections.length;d++){const w=r.laneSections[d],k=Number(w.id);for(const f of w.lanePaths){const v=Number(f.id);if(v===0)continue;const F=f.type,I=f.innerPath.concat(f.outerPath.reverse());if(I.length<=3){console.warn(`lane ${v} has less than 3 points`);continue}I.push(f.innerPath[0]);const j=new M.Polygon({rings:[I]});if(j){const S=new p({geometry:j,attributes:{ObjectID:l++,id:`${c}+${k}+${v}`,roadId:c,roadName:r.name,sectionId:k,sectionIndex:d,laneId:v,type:F,sumoId:""}});this.allLaneGraphics.push(S),n.push(S)}}}}const a=setInterval(()=>{if(n.length>0||this.allRefLineGraphics.length>0){if(n.length>0){const r=n.splice(0,100);this.laneLayer.applyEdits({addFeatures:r})}if(this.allRefLineGraphics.length>0){const r=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:r})}}else clearInterval(a),s()},10)})}showJunction(e){const t=[];for(const i of e){if(!i)continue;i.nodeType=i.type;const o=new p({geometry:{type:"point",x:i.coordinates[0],y:i.coordinates[1]},attributes:{...i,selected:!1,type:"OpenDriveJunction"},symbol:{type:"picture-marker",url:i.crossId?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",width:30,height:30}});t.push(o)}this.junctionLayer.addMany(t)}monitorMouseDrag(){}monitorMouseMove(){const e=N.debounce(async t=>{var l;const o=(l=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.filter(n=>n.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightGraphic=void 0,this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId="",this.view.closePopup());return}const s=o[0];if(this.hitGraphic=s.graphic,s.layer.id==="OpenDriveLane"){const n=`${this.hitGraphic.attributes.roadId}+${this.hitGraphic.attributes.sectionId}`;if(n===this.currentSectionCode||this.sectionLayer.graphics.findIndex(u=>u.getAttribute("id")===n)>=0)return;this.currentSectionCode=n;const r=this.allLaneGraphics.filter(u=>`${u.attributes.roadId}+${u.attributes.sectionId}`===n),c=L.union(r.map(u=>u.geometry));this.highlightGraphic=new p({geometry:c,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:n,selected:!1}}),this.highlightLayer.removeAll(),this.highlightLayer.add(this.highlightGraphic)}else if(s.layer.id==="OpenDriveJunction"){const n=this.hitGraphic.getAttribute("id");if(n===this.currentJunctionId)return;this.currentJunctionId=n;const a=this.hitGraphic.getAttribute("name"),r=this.hitGraphic.getAttribute("crossId");this.view.openPopup({title:a,content:`<table>
2
2
  <tr><td>路口编号</td><td>${n}</td></tr>
3
3
  <tr><td>信号机编号</td><td>${r||"无信控"}</td></tr>
4
4
  </table>`,location:this.hitGraphic.geometry})}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=N.debounce(async t=>{var a;const o=(a=(await this.view.hitTest(t,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:a.filter(r=>r.type==="graphic");if(o.length===0)return;const s=o[0].graphic,l=s.getAttribute("type"),n=s.getAttribute("id");if(l==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const r=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,c=await y.get(r,{params:{id:n,projectName:this.projectName}});c.status===200&&c.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:c.data.result}),s.setAttribute("selected",!0),s.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(s,50))}else{this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:void 0}),s.setAttribute("selected",!1);const r=s.getAttribute("crossId");s.symbol.url=r?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(s,30)}else if(l==="OpenDriveSection")if(s.getAttribute("selected"))this.sectionLayer.remove(s),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:n,details:void 0});else{this.highlightLayer.remove(s),this.sectionLayer.add(s),s.setAttribute("selected",!0);const r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,c=await y.get(r,{params:{id:n,projectName:this.projectName}});c.status===200&&c.data.status===0&&this.openDriveClickCallback&&(s.setAttribute("edgeId",c.data.result.obj_id),this.openDriveClickCallback({type:"OpenDriveSection",id:n,details:c.data.result}))}});this.mouseClickHandler=this.view.on("immediate-click",async t=>{e(t).catch(()=>{})})}increasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s<t?e.symbol={type:"picture-marker",url:o.url,width:s+1,height:s+1}:clearInterval(i)},20)}decreasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s>t?e.symbol={type:"picture-marker",url:o.url,width:s-1,height:s-1}:clearInterval(i)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const t=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,i=await y.get(t,{params:{id:e.id,projectName:this.projectName}});return i.status===200?i.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.find(l=>l.getAttribute("roadId")===i&&l.getAttribute("sectionIndex")===o);if(s){const l=`${i}+${s.getAttribute("sectionId")}`,n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await y.get(n,{params:{id:l,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${l}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}async clearOpenDrive(){var t,i;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.sectionLayer.removeAll(),this.flashLayer.removeAll(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=void 0}async findSumo(e){const{type:t,id:i}=e,o=e.flash===void 0?!0:e.flash;if(t==="junction")return await this.findJunction(i,o);if(t==="edge"){const s=i.split("+");if(s.length>2)return{status:-1,message:"id格式错误"};const l=s.length===2?Number(s[1]):void 0,n=s[0].split("#");if(n.length>2)return{status:-1,message:"id格式错误"};const a=n[0],r=n.length===2?Number(n[1]):void 0;return await this.findLane({roadsectId:a,segmentId:r,laneId:l,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,t){const i=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!i)return{status:-1,message:"未找到。请检查路口编号"};if(t){const o=new p({geometry:i.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[255,0,0,.6],outline:{color:"red",width:1}}});this.flashGraphic(o)}return await this.view.goTo(i.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:t,segmentId:i,laneId:o}=e;t.startsWith("-")&&(t=t.slice(1));let s=this.allLaneGraphics.filter(a=>a.attributes.roadId===t);if(s.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(i!==void 0){const a=[];if(s.forEach(r=>{const c=Number(r.attributes.sectionId);a.indexOf(c)===-1&&a.push(c)}),a.sort((r,c)=>r-c),i>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};i=a[i],s=s.filter(r=>Number(r.attributes.sectionId)===i)}if(o!==void 0){const a=[];if(s.forEach(r=>{const c=Number(r.attributes.laneId);a.indexOf(c)===-1&&a.push(c)}),a.sort((r,c)=>r-c),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],s=s.filter(r=>Number(r.attributes.laneId)===o)}const l=s.map(a=>a.geometry),n=L.union(l);if(e.flash){const a=new p({geometry:n,symbol:{type:"simple-fill",color:[255,0,0,.5],style:"solid",outline:{color:"red",width:0}}});this.flashGraphic(a)}return await this.view.goTo(n,{duration:1e3}),{status:0,message:"ok"}}flashGraphic(e){this.flashLayer.removeAll(),this.flashLayer.add(e);let t=0,i=!0;const o=setInterval(()=>{i?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(i=!1,t++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(i=!0)),t>=5&&(this.flashLayer.removeAll(),this.flashLayer.opacity=1,clearInterval(o))},10)}unselectSumo(e){if((!e||e.type==="junction")&&this.junctionLayer.graphics.forEach(t=>{if((!e||!e.id||e.id===""||e.id===t.getAttribute("id"))&&t.getAttribute("selected")){t.setAttribute("selected",!1);const i=t.getAttribute("crossId");t.symbol.url=i?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(t,30)}}),!e||e.type==="edge")if(!e||!e.id||e.id==="")this.sectionLayer.removeAll();else{const t=this.sectionLayer.graphics.find(i=>i.getAttribute("edgeId")===e.id);t&&this.sectionLayer.remove(t)}return{status:0,message:"ok"}}selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(t=>{if(e.id===t.getAttribute("id"))return t.setAttribute("selected",!0),t.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(t,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===i&&l.getAttribute("sectionIndex")===o);if(s.length>0){const l=L.union(s.map(a=>a.geometry)),n=new p({geometry:l,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",edgeId:e.id,selected:!0}});return this.sectionLayer.add(n),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async splitLane(e){return{status:0,message:"ok",result:e}}}exports.default=D;
@@ -4,6 +4,7 @@ interface ICross {
4
4
  parentId: string;
5
5
  latitude: number;
6
6
  longitude: number;
7
+ signalId: string;
7
8
  }
8
9
  export default class DistrictController {
9
10
  id: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class e{constructor(s){this.parentName="",this.crosses=[],this.subDistricts=[],this.areaColor=[Math.floor(Math.random()*255),Math.floor(Math.random()*255),Math.floor(Math.random()*255)],this.crossCount=0,this.subDistrictCount=0,this.id=s.id,this.name=s.name,this.parentId=s.parentId;for(const t of s.children)if(t.children){const o=new e(t);o.parentName=this.name,o.areaColor=this.areaColor,this.subDistricts.push(o),this.subDistrictCount++,this.crossCount+=o.crossCount}else{const o={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude)};this.crosses.push(o),this.crossCount++}}getAllCrossCoordinates(){const s=[];for(const t of this.crosses)s.push([t.longitude,t.latitude]);for(const t of this.subDistricts)s.push(...t.getAllCrossCoordinates());return s}}exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class e{constructor(s){this.parentName="",this.crosses=[],this.subDistricts=[],this.areaColor=[Math.floor(Math.random()*255),Math.floor(Math.random()*255),Math.floor(Math.random()*255)],this.crossCount=0,this.subDistrictCount=0,this.id=s.id,this.name=s.name,this.parentId=s.parentId;for(const t of s.children)if(t.children){const o=new e(t);o.parentName=this.name,o.areaColor=this.areaColor,this.subDistricts.push(o),this.subDistrictCount++,this.crossCount+=o.crossCount}else{const o={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId};this.crosses.push(o),this.crossCount++}}getAllCrossCoordinates(){const s=[];for(const t of this.crosses)s.push([t.longitude,t.latitude]);for(const t of this.subDistricts)s.push(...t.getAllCrossCoordinates());return s}}exports.default=e;
@@ -5,7 +5,8 @@ export default class SignalControlAreaController {
5
5
  private subDistrictControllerLayer;
6
6
  private crossLayer;
7
7
  private highlightLayer;
8
- private eventHandle?;
8
+ private watchHandle?;
9
+ private readonly crossScale;
9
10
  constructor(view: __esri.MapView | __esri.SceneView);
10
11
  showSignalControlArea(params: any): IResult;
11
12
  clearSignalControlArea(): IResult;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/GraphicsLayer"),y=require("@turf/buffer"),p=require("@turf/convex"),m=require("@turf/helpers"),f=require("./district-controller.js");function b(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=b(m);class L{constructor(e){this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!0},this.districtControllerLayer=new l({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new l({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new l({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new l({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const t of e){const i=new f.default(t);this.drawArea(i,!0)}return{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.eventHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);if(t){await this.view.goTo(t.geometry);const i=t.geometry.type==="point"?t.geometry:t.geometry.centroid;return this.view.openPopup({features:[t],location:i}),{status:0,message:"ok"}}else return{status:1,message:"未找到"}}async highlightSignalControlArea(e){this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id).toArray().map(r=>r.clone()),i=this.subDistrictControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("parentId")===e.id).toArray().map(r=>r.clone()),a=this.crossLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("districtId")===e.id||r.getAttribute("subDistrictId")===e.id).toArray().map(r=>r.clone());return t.length>0&&this.highlightLayer.addMany(t),i.length>0&&this.highlightLayer.addMany(i),a.length>0&&this.highlightLayer.addMany(a),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(await this.view.goTo(t.length>0?t:i.length>0?i:a),{status:0,message:"ok"})}resetHighlight(){return this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(i=>i.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(i=>i.attributes.id===e)),t||(t=this.crossLayer.graphics.find(i=>i.attributes.id===e)),t}drawArea(e,t){const i=e.getAllCrossCoordinates();if(i.length>2){const r=u.featureCollection(i.map(g=>u.point(g))),n=p(r);if(!n)return;const d=y(n.geometry,t?200:30,{units:"meters"});let o;t?o=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:o=[{fieldName:"parentId",label:"区控编号"},{fieldName:"parentName",label:"区控名称"},{fieldName:"id",label:"子区编号"},{fieldName:"crossCount",label:"路口数量"}];const h=new c({geometry:{type:"polygon",rings:d.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:{type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:e.name,content:[{type:"fields",fieldInfos:o}]}});t?this.districtControllerLayer.add(h):this.subDistrictControllerLayer.add(h)}for(const r of e.subDistricts)this.drawArea(r,!1);const a=e.crosses.map(r=>new c({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:{type:"simple-marker",color:e.areaColor,size:8,outline:{color:"white",width:1}},attributes:{type:"cross",id:r.id,name:r.name,districtId:t?e.id:e.parentId,subDistrictId:t?"":e.id},popupTemplate:{title:r.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtId",label:"区控编号"},{fieldName:"subDistrictId",label:"子区编号"},{fieldName:"id",label:"路口编号"}]}]}}));this.crossLayer.addMany(a)}}exports.default=L;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/core/reactiveUtils.js"),h=require("@arcgis/core/Graphic"),o=require("@arcgis/core/layers/GraphicsLayer"),p=require("@turf/buffer"),f=require("@turf/convex"),b=require("@turf/helpers"),L=require("./district-controller.js");function g(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const v=g(m),u=g(b);class w{constructor(e){this.crossScale=1500,this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!0},this.districtControllerLayer=new o({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new o({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new o({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new o({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const t of e){const r=new L.default(t);this.drawArea(r,!0)}return this.watchHandle=v.watch(()=>this.view.scale,(t,r)=>{t>this.crossScale&&r<=this.crossScale?this.crossLayer.graphics.forEach(s=>{s.symbol={type:"simple-marker",color:s.getAttribute("color"),size:8,outline:{color:"white",width:1}}}):t<=this.crossScale&&r>this.crossScale&&this.crossLayer.graphics.forEach(s=>{s.symbol={type:"picture-marker",url:"/GisViewerAssets/images/xhj_1.png",width:"37px",height:"57px",yoffset:"25px"}})}),{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.watchHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);if(t){t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:3e3}):await this.view.goTo(t.geometry);const r=t.geometry.type==="point"?t.geometry:t.geometry.centroid;return this.view.openPopup({features:[t],location:r}),{status:0,message:"ok"}}else return{status:1,message:"未找到"}}async highlightSignalControlArea(e){this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id).toArray().map(i=>i.clone()),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("parentId")===e.id).toArray().map(i=>i.clone()),s=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("districtId")===e.id||i.getAttribute("subDistrictId")===e.id).toArray().map(i=>i.clone());return t.length>0&&this.highlightLayer.addMany(t),r.length>0&&this.highlightLayer.addMany(r),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(await this.view.goTo(t.length>0?t:r.length>0?r:s),{status:0,message:"ok"})}resetHighlight(){return this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(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){const i=u.featureCollection(r.map(y=>u.point(y))),n=f(i);if(!n)return;const d=p(n.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"区控名称"},{fieldName:"id",label:"子区编号"},{fieldName:"crossCount",label:"路口数量"}];const c=new h({geometry:{type:"polygon",rings:d.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:{type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:e.name,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(c):this.subDistrictControllerLayer.add(c)}for(const i of e.subDistricts)this.drawArea(i,!1);const s=e.crosses.map(i=>new h({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:{type:"simple-marker",color:e.areaColor,size:8,outline:{color:"white",width:1}},attributes:{type:"cross",id:i.id,name:i.name,color:e.areaColor,signalId:i.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name},popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}}));this.crossLayer.addMany(s)}}exports.default=w;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.133",
3
+ "version": "1.0.135",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [
@@ -1,17 +0,0 @@
1
- export default class DrawBezier {
2
- private static sampleCount;
3
- static drawBezierBetweenLane(incoming: number[][], outgoing: number[][]): number[][];
4
- /**
5
- * 生成控制点
6
- * 进口道的延长线和出口道的反向延长线的交点
7
- */
8
- private static getControlPoint;
9
- /**
10
- * @desc 二阶贝塞尔
11
- * @param {number} t 当前百分比
12
- * @param {Array} p1 起点坐标
13
- * @param {Array} p2 终点坐标
14
- * @param {Array} cp 控制点
15
- */
16
- private static twoBezier;
17
- }
@@ -1,49 +0,0 @@
1
- import * as m from "@turf/helpers";
2
- import f from "@turf/line-intersect";
3
- import p from "../common-utils.mjs";
4
- class P {
5
- static drawBezierBetweenLane(t, i) {
6
- const n = this.getControlPoint(t, i);
7
- if (n.length === 3) {
8
- const s = n[0], r = n[1], c = n[2], o = [];
9
- for (let e = 0; e <= this.sampleCount; e++)
10
- o.push(this.twoBezier(e / this.sampleCount, s, r, c));
11
- return o;
12
- } else
13
- return n;
14
- }
15
- /**
16
- * 生成控制点
17
- * 进口道的延长线和出口道的反向延长线的交点
18
- */
19
- static getControlPoint(t, i) {
20
- const n = t[0], s = t[1], r = p.getExtensionLine(
21
- n,
22
- s,
23
- 100
24
- ), c = m.lineString([n, r]), o = i[0], e = i[1], l = p.getExtensionLine(
25
- e,
26
- o,
27
- 100
28
- ), u = m.lineString([l, e]), g = f(c, u);
29
- if (g.features.length === 0)
30
- return [s, o];
31
- const a = g.features[0].geometry.coordinates;
32
- return [s, o, a];
33
- }
34
- /**
35
- * @desc 二阶贝塞尔
36
- * @param {number} t 当前百分比
37
- * @param {Array} p1 起点坐标
38
- * @param {Array} p2 终点坐标
39
- * @param {Array} cp 控制点
40
- */
41
- static twoBezier(t, i, n, s) {
42
- const [r, c] = i, [o, e] = s, [l, u] = n, g = (1 - t) * (1 - t) * r + 2 * t * (1 - t) * o + t * t * l, a = (1 - t) * (1 - t) * c + 2 * t * (1 - t) * e + t * t * u;
43
- return [g, a];
44
- }
45
- }
46
- P.sampleCount = 50;
47
- export {
48
- P as default
49
- };
@@ -1,51 +0,0 @@
1
- import { IJunctionTableData, ILaneInfo } from '../../../types';
2
- interface ILink {
3
- incoming: ILaneInfo;
4
- connecting: ILaneInfo;
5
- outgoing: ILaneInfo;
6
- }
7
- export default class Junction {
8
- id: string;
9
- name: string;
10
- /** 路口内的行车通道,包含进口道->转接道->出口道三个车道 */
11
- laneLinks: Array<ILink>;
12
- tableData: IJunctionTableData | undefined;
13
- /** 进口车道按roadId归类, */
14
- private incomingLanes;
15
- private outline;
16
- private wasmLoader;
17
- private roadList;
18
- constructor(odrJunction: any);
19
- /**
20
- * 在路口中,找到进口道的后继转接车道
21
- * @param {string} roadId 进口道道路id
22
- * @param {number} laneId 进口道车道id
23
- * @returns {ILaneInfo[]}
24
- */
25
- getSuccessorForIncoming(roadId: string, laneId: number): ILaneInfo[];
26
- /**
27
- * 在路口中,找到出口道的前驱转接车道
28
- * @param {string} roadId 出口道道路id
29
- * @param {number} laneId 出口道车道id
30
- * @returns {ILaneInfo[]}
31
- */
32
- getPredecessorForOutgoing(roadId: string, laneId: number): ILaneInfo[];
33
- /**
34
- * 获取路口轮廓线
35
- * 要等所有路口对象生成之后才能调用,所以不放在初始化中
36
- * @returns
37
- */
38
- getJunctionOutline(): number[][];
39
- /**
40
- * 获取此路口各个进口道的停止线
41
- */
42
- getRoadStopLine(): {
43
- roadId: string;
44
- line: number[][];
45
- }[];
46
- /**
47
- * 获取此路口的所有进口车道
48
- */
49
- getAllIncomingLanes(): ILaneInfo[];
50
- }
51
- export {};