gisviewer-vue3-arcgis 1.0.141 → 1.0.143

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
+ import Graphic from '@arcgis/core/Graphic.js';
1
2
  import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer';
2
3
  import MapView from '@arcgis/core/views/MapView';
3
4
  import SceneView from '@arcgis/core/views/SceneView';
4
- import SketchViewModel from '@arcgis/core/widgets/Sketch/SketchViewModel';
5
5
  import Sketch from '@arcgis/core/widgets/Sketch';
6
- import Graphic from '@arcgis/core/Graphic.js';
6
+ import SketchViewModel from '@arcgis/core/widgets/Sketch/SketchViewModel';
7
7
  import * as turf from '@turf/turf';
8
8
  interface sketchViewOptions {
9
9
  /**
@@ -17,7 +17,7 @@ interface sketchViewOptions {
17
17
  /**
18
18
  * 绘制工具显示的元素
19
19
  */
20
- sketchvisibleElements?: {};
20
+ sketchVisibleElements?: {};
21
21
  /**
22
22
  * 绘制工具显示的位置
23
23
  */
@@ -28,7 +28,7 @@ interface sketchViewOptions {
28
28
  * @type {boolean}
29
29
  * @memberof sketchViewOptions
30
30
  */
31
- defaultsketchVisible?: boolean;
31
+ defaultSketchVisible?: boolean;
32
32
  sketchViewModelItemSymbol?: {
33
33
  polylineSymbol?: any;
34
34
  polygonSymbol?: any;
@@ -45,7 +45,7 @@ declare type dimensionTypeFace = 'distance' | 'area' | 'angle' | null;
45
45
  export default class sketchViewTool {
46
46
  private viewer;
47
47
  graphicsLayer: GraphicsLayer;
48
- TextgraphicsLayer: GraphicsLayer;
48
+ textGraphicsLayer: GraphicsLayer;
49
49
  sketchViewModel: SketchViewModel;
50
50
  sketch: Sketch;
51
51
  options: sketchViewOptions;
@@ -78,12 +78,12 @@ export default class sketchViewTool {
78
78
  dimensionType: dimensionTypeFace;
79
79
  constructor(view: MapView | SceneView, options?: sketchViewOptions);
80
80
  init(): void;
81
- on(callcack?: (type: string, state: string, event: any) => void): void;
82
- onCreate(event: __esri.SketchCreateEvent, callcack?: (type: string, state: string, event?: any) => void): void;
81
+ on(callback?: (type: string, state: string, event: any) => void): void;
82
+ onCreate(event: __esri.SketchCreateEvent, callback?: (type: string, state: string, event?: any) => void): void;
83
83
  onCreateToCancel(): void;
84
- onUpdate(event: __esri.SketchUpdateEvent, callcack?: (type: string, state: string, event?: any) => void): void;
85
- onDelete(event: __esri.SketchDeleteEvent, callcack?: (type: string, state: string, event: any) => void): void;
86
- addpolyline(paths: number[][][]): void;
84
+ onUpdate(event: __esri.SketchUpdateEvent, callback?: (type: string, state: string, event?: any) => void): void;
85
+ onDelete(event: __esri.SketchDeleteEvent, callback?: (type: string, state: string, event: any) => void): void;
86
+ addPolyline(paths: number[][][]): void;
87
87
  createPolylineGraphic(paths: number[][], lineSymbol: any, attributes: any): Graphic;
88
88
  createDom(): HTMLDivElement | undefined;
89
89
  removeDom(): void;
@@ -145,8 +145,8 @@ export default class sketchViewTool {
145
145
  */
146
146
  calculatePointHeading(path: number[][], direction?: string): number;
147
147
  drawPolylinePoint(drawStartGraphic: __esri.Geometry, parentId: string, actions?: string): void;
148
- updatePpolylinePoint(drawStartGraphic: Graphic[]): void;
149
- delPpolylinePoint(drawStartGraphic: Graphic[]): void;
148
+ updatePolylinePoint(drawStartGraphic: Graphic[]): void;
149
+ deletePolylinePoint(drawStartGraphic: Graphic[]): void;
150
150
  /**
151
151
  * 添加或者更新标记点
152
152
  *
@@ -186,7 +186,7 @@ export default class sketchViewTool {
186
186
  * 获取当前绘制的图形的长度
187
187
  * @returns
188
188
  */
189
- getDrawgraphicLength(): string | 0;
189
+ getDrawGraphicLength(): string | 0;
190
190
  /**
191
191
  * 获取两点的角度
192
192
  *
@@ -204,7 +204,7 @@ export default class sketchViewTool {
204
204
  * @returns
205
205
  * @memberof sketchViewTool
206
206
  */
207
- getbearing(startPoint: ITPoint, endPoint: ITPoint): number;
207
+ getBearing(startPoint: ITPoint, endPoint: ITPoint): number;
208
208
  /**
209
209
  * 获取两点的距离
210
210
  * @param startPoint
@@ -243,11 +243,11 @@ export default class sketchViewTool {
243
243
  /**
244
244
  * 开启图层捕捉
245
245
  */
246
- turnonlayerSnap(): void;
246
+ turnOnLayerSnap(): void;
247
247
  /**
248
248
  * 关闭图层捕捉
249
249
  */
250
- turnofflayerSnap(): void;
250
+ turnOffLayerSnap(): void;
251
251
  setDimensionType(Type: dimensionTypeFace): void;
252
252
  /**
253
253
  * 删除指定的图形
@@ -1,23 +1,23 @@
1
- import g from "@arcgis/core/layers/GraphicsLayer";
2
- import x from "@arcgis/core/widgets/Sketch/SketchViewModel";
3
- import P from "@arcgis/core/widgets/Sketch";
4
- import * as p from "@arcgis/core/geometry/support/webMercatorUtils.js";
5
1
  import * as y from "@arcgis/core/geometry/geometryEngine.js";
2
+ import g from "@arcgis/core/geometry/Polyline.js";
3
+ import * as p from "@arcgis/core/geometry/support/webMercatorUtils.js";
6
4
  import m from "@arcgis/core/Graphic.js";
7
- import u from "@arcgis/core/geometry/Polyline.js";
5
+ import u from "@arcgis/core/layers/GraphicsLayer";
6
+ import G from "@arcgis/core/widgets/Sketch";
7
+ import x from "@arcgis/core/widgets/Sketch/SketchViewModel";
8
8
  import * as c from "@turf/turf";
9
- const G = {
9
+ const P = {
10
10
  maxAllowedGraphics: 0,
11
11
  GraphicsLayer: {},
12
- sketchvisibleElements: {},
12
+ sketchVisibleElements: {},
13
13
  sketchPosition: "top-left",
14
- defaultsketchVisible: !0,
14
+ defaultSketchVisible: !0,
15
15
  sketchViewModelItemSymbol: {}
16
16
  }, f = {
17
17
  type: "simple-line",
18
18
  color: "#556DEA",
19
19
  width: 2
20
- }, b = {
20
+ }, M = {
21
21
  type: "simple-fill",
22
22
  // autocasts as new SimpleFillSymbol()
23
23
  color: [227, 139, 79, 0.4],
@@ -30,9 +30,9 @@ const G = {
30
30
  class $ {
31
31
  constructor(t, e) {
32
32
  this.isDraw = !1, this.drawStartGraphicId = null, this.drawPointGraphic = /* @__PURE__ */ new Map(), this.dimensionType = null, this.viewer = t, this.options = {
33
- ...G,
33
+ ...P,
34
34
  ...e
35
- }, this.graphicsLayer = new g({ ...this.options.GraphicsLayer }), this.TextgraphicsLayer = new g(), this.viewer.map.layers.add(this.graphicsLayer), this.viewer.map.layers.add(this.TextgraphicsLayer), this.init();
35
+ }, this.graphicsLayer = new u({ ...this.options.GraphicsLayer }), this.textGraphicsLayer = new u(), this.viewer.map.layers.add(this.graphicsLayer), this.viewer.map.layers.add(this.textGraphicsLayer), this.init();
36
36
  }
37
37
  init() {
38
38
  this.sketchViewModel = new x({
@@ -40,15 +40,15 @@ class $ {
40
40
  view: this.viewer,
41
41
  updateOnGraphicClick: !0,
42
42
  polylineSymbol: f,
43
- polygonSymbol: b,
43
+ polygonSymbol: M,
44
44
  ...this.options.sketchViewModelItemSymbol
45
45
  });
46
46
  const t = this.findLayerById("TrafficToolMarkings"), e = [];
47
- t && e.push({ layer: t, enabled: !0 }), this.sketch = new P({
47
+ t && e.push({ layer: t, enabled: !0 }), this.sketch = new G({
48
48
  view: this.viewer,
49
49
  viewModel: this.sketchViewModel,
50
50
  layer: this.graphicsLayer,
51
- visible: this.options.defaultsketchVisible,
51
+ visible: this.options.defaultSketchVisible,
52
52
  snappingOptions: {
53
53
  // autocasts to SnappingOptions()
54
54
  enabled: !0,
@@ -57,7 +57,7 @@ class $ {
57
57
  featureSources: e
58
58
  }
59
59
  }), this.sketch.visibleElements = {
60
- ...this.options.sketchvisibleElements
60
+ ...this.options.sketchVisibleElements
61
61
  }, this.viewer.ui.add(this.sketch, this.options.sketchPosition);
62
62
  const i = this;
63
63
  this.viewer.on("pointer-move", function(s) {
@@ -67,7 +67,7 @@ class $ {
67
67
  };
68
68
  if (i.isDraw && i.dimensionType == "distance") {
69
69
  i.tipsDom || (i.tipsDom = i.createDom());
70
- const o = i.getDrawgraphicLength();
70
+ const o = i.getDrawGraphicLength();
71
71
  i.tipsDom.innerText = `${o}米`, i.tipsDom.style.left = `${r.x}px`, i.tipsDom.style.top = `${r.y + 3}px`, i.tipsDom.style.pointerEvents = "none";
72
72
  }
73
73
  });
@@ -100,7 +100,7 @@ class $ {
100
100
  this.dimensionType == "distance" && (this.drawPolylinePoint(i, s), this.drawStartGraphic = i);
101
101
  }
102
102
  if (t.state === "complete" && t.graphic.geometry.type === "polyline" && this.dimensionType == "distance") {
103
- const i = this.getDrawgraphicLength(), s = `${this.drawStartGraphicId}-end`, r = p.webMercatorToGeographic(
103
+ const i = this.getDrawGraphicLength(), s = `${this.drawStartGraphicId}-end`, r = p.webMercatorToGeographic(
104
104
  t.graphic.geometry
105
105
  ), o = r.paths[0], n = this.getGeometryXY(r, o.length - 1);
106
106
  this.addOrUpdateMarkPoint(`总长度:${i}米`, n, s), this.drawStartGraphic = null, this.removeDom(), this.isDraw = !1, this.drawStartGraphicId = null;
@@ -111,34 +111,34 @@ class $ {
111
111
  this.removeDom(), this.isDraw = !1, this.drawStartGraphic = null;
112
112
  const t = this.drawStartGraphicId;
113
113
  this.drawPointGraphic.forEach((e, i) => {
114
- new RegExp(`^${t}-`).test(i) && (this.TextgraphicsLayer.remove(e), this.drawPointGraphic.delete(i));
114
+ new RegExp(`^${t}-`).test(i) && (this.textGraphicsLayer.remove(e), this.drawPointGraphic.delete(i));
115
115
  }), this.drawStartGraphicId = null;
116
116
  }
117
117
  onUpdate(t, e) {
118
- console.log("update", t), this.updatePpolylinePoint(
118
+ console.log("update", t), this.updatePolylinePoint(
119
119
  t.graphics.filter((i) => i.geometry.type === "polyline")
120
120
  ), e && e("update", t.state, t.graphics);
121
121
  }
122
122
  onDelete(t, e) {
123
- console.log("delete", t), this.delPpolylinePoint(
123
+ console.log("delete", t), this.deletePolylinePoint(
124
124
  t.graphics.filter((i) => i.geometry.type === "polyline")
125
125
  ), e && e("delete", "complete", t.graphics);
126
126
  }
127
- addpolyline(t) {
128
- const e = [], i = f, s = {
127
+ addPolyline(t) {
128
+ const e = [], i = {
129
129
  type: "draw",
130
130
  id: new Date().getTime().toString()
131
131
  };
132
- t.map((r) => {
132
+ t.map((s) => {
133
133
  e.push(
134
- this.createPolylineGraphic(r, i, {
135
- ...s
134
+ this.createPolylineGraphic(s, f, {
135
+ ...i
136
136
  })
137
137
  );
138
138
  }), this.graphicsLayer.addMany(e);
139
139
  }
140
140
  createPolylineGraphic(t, e, i) {
141
- const s = new u({
141
+ const s = new g({
142
142
  paths: [t]
143
143
  }), r = p.geographicToWebMercator(s);
144
144
  return new m({
@@ -218,7 +218,7 @@ class $ {
218
218
  this.sketch.visible = !0;
219
219
  }
220
220
  removeAll() {
221
- this.graphicsLayer.removeAll(), this.TextgraphicsLayer.removeAll(), this.drawPointGraphic.clear();
221
+ this.graphicsLayer.removeAll(), this.textGraphicsLayer.removeAll(), this.drawPointGraphic.clear();
222
222
  }
223
223
  calculateDistance(t, e = "meters") {
224
224
  return y.geodesicLength(
@@ -287,7 +287,7 @@ class $ {
287
287
  );
288
288
  }
289
289
  }
290
- updatePpolylinePoint(t) {
290
+ updatePolylinePoint(t) {
291
291
  for (let e = 0; e < t.length; e++) {
292
292
  console.log(t[e]);
293
293
  const i = t[e].getAttribute("id"), s = p.webMercatorToGeographic(
@@ -296,7 +296,7 @@ class $ {
296
296
  this.drawPolylinePoint(s, i, "update");
297
297
  }
298
298
  }
299
- delPpolylinePoint(t) {
299
+ deletePolylinePoint(t) {
300
300
  var e;
301
301
  for (let i = 0; i < t.length; i++) {
302
302
  const s = t[i].getAttribute("id"), r = `${s}-start`, o = `${s}-end`, n = [r, o];
@@ -306,7 +306,7 @@ class $ {
306
306
  }
307
307
  ), n.map((a) => {
308
308
  const h = this.drawPointGraphic.get(a);
309
- h && (this.TextgraphicsLayer.remove(h), this.drawPointGraphic.delete(a));
309
+ h && (this.textGraphicsLayer.remove(h), this.drawPointGraphic.delete(a));
310
310
  });
311
311
  }
312
312
  }
@@ -323,19 +323,19 @@ class $ {
323
323
  addOrUpdateMarkPoint(t, e, i, s = {}) {
324
324
  if (this.drawPointGraphic.has(i)) {
325
325
  const o = this.drawPointGraphic.get(i);
326
- this.TextgraphicsLayer.remove(o);
326
+ this.textGraphicsLayer.remove(o);
327
327
  const n = this.createTextGraphic(t, e, {
328
328
  ...s,
329
329
  id: i
330
330
  });
331
- this.drawPointGraphic.set(i, n), this.TextgraphicsLayer.add(n);
331
+ this.drawPointGraphic.set(i, n), this.textGraphicsLayer.add(n);
332
332
  return;
333
333
  }
334
334
  const r = this.createTextGraphic(t, e, {
335
335
  ...s,
336
336
  id: i
337
337
  });
338
- this.drawPointGraphic.set(i, r), this.TextgraphicsLayer.add(r);
338
+ this.drawPointGraphic.set(i, r), this.textGraphicsLayer.add(r);
339
339
  }
340
340
  /**
341
341
  * 获取图形的点位
@@ -387,7 +387,7 @@ class $ {
387
387
  * 获取当前绘制的图形的长度
388
388
  * @returns
389
389
  */
390
- getDrawgraphicLength() {
390
+ getDrawGraphicLength() {
391
391
  return this.drawStartGraphic ? this.calculateDistance(this.drawStartGraphic, "meters").toFixed(2) : 0;
392
392
  }
393
393
  /**
@@ -410,7 +410,7 @@ class $ {
410
410
  * @returns
411
411
  * @memberof sketchViewTool
412
412
  */
413
- getbearing(t, e) {
413
+ getBearing(t, e) {
414
414
  return c.bearing(
415
415
  c.point([t.x, t.y]),
416
416
  c.point([e.x, e.y])
@@ -424,7 +424,7 @@ class $ {
424
424
  * @returns
425
425
  */
426
426
  getPointLength(t, e = "meters") {
427
- const i = new u({
427
+ const i = new g({
428
428
  paths: [t]
429
429
  });
430
430
  return y.geodesicLength(i, e);
@@ -474,13 +474,13 @@ class $ {
474
474
  /**
475
475
  * 开启图层捕捉
476
476
  */
477
- turnonlayerSnap() {
477
+ turnOnLayerSnap() {
478
478
  this.sketchViewModel.snappingOptions.enabled = !0;
479
479
  }
480
480
  /**
481
481
  * 关闭图层捕捉
482
482
  */
483
- turnofflayerSnap() {
483
+ turnOffLayerSnap() {
484
484
  this.sketchViewModel.snappingOptions.enabled = !1;
485
485
  }
486
486
  setDimensionType(t) {
@@ -495,7 +495,7 @@ class $ {
495
495
  }
496
496
  destroy() {
497
497
  var t, e;
498
- this.viewer.map.remove(this.graphicsLayer), this.viewer.map.remove(this.TextgraphicsLayer), (t = this.sketch) == null || t.destroy(), (e = this.sketchViewModel) == null || e.destroy();
498
+ this.viewer.map.remove(this.graphicsLayer), this.viewer.map.remove(this.textGraphicsLayer), (t = this.sketch) == null || t.destroy(), (e = this.sketchViewModel) == null || e.destroy();
499
499
  }
500
500
  }
501
501
  export {
package/es/style.css CHANGED
@@ -1 +1 @@
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}
1
+ .gis-viewer{overflow:auto;scrollbar-width:none;-ms-overflow-style:none;&::-webkit-scrollbar{display:none}}.gisviewer-sketch-tool-position[data-v-f302a42f]{position:absolute;top:10px;right:10px;z-index:1000}.gisviewer-sketch-tool[data-v-f302a42f]{display:flex;flex-direction:row}.geometry-button-selected[data-v-f302a42f]{background:#4c4c4c;color:#fff}
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),h=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"),O=require("./utils/open-drive-renderer/index.js"),Te=require("./utils/overlay.js"),Ae=require("./utils/queue-length.js"),k=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(T,{expose:A,emit:D}){const f=a.ref(null);let c,l,i,r,n,o,m,t,s;const d=a.ref(!1),p=a.ref(!1);a.onMounted(async()=>{if(h.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,C=await(await fetch(S.config)).json();C.assetsRoot=S.assetsRoot||u;const he=h.default.useAppDataStore;he.mapConfig=C,l=new ke.default,c=await l.initialize({container:f.value,markerClickCallback:(g,w,y,Se)=>{v("markerClick",g,w,y,Se)},mapClickCallback:(g,w,y)=>{v("mapClick",g,w,y)}}),n=new Oe.default(c),await n.init(),v("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=h.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 k.default(c)),i.showLaneNumber(e)),E=()=>{i==null||i.clearLaneNumber()},j=async e=>(i||(i=new k.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 O.default(c)),await t.showOpenDriveFromServer(e,u)),ce=async e=>(t||(t=new O.default(c)),await t.clearOpenDrive(),p.value=!0,await t.showOpenDriveFromFile(e)),ie=async()=>(p.value=!1,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()},ve=async e=>s?await s.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},we=async e=>s?await s.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},ye=()=>s?s.resetHighlight():{status:-1,message:"未加载信号控制区"},S=T,v=D;return A({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:ve,highlightSignalControlArea:we,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]]),p.value?(a.openBlock(),a.createBlock(Ce.default,{key:0,view:a.unref(c)},null,8,["view"])):a.createCommentVNode("",!0)],512)]))}});exports.default=qe;
@@ -1 +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;
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-f302a42f"]]);exports.default=u;
@@ -1 +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;
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=()=>{},r=o=>{var s;console.log(o);const n=(s=o.target)==null?void 0:s.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-cursor geometry-button",value:"rectangle",onClick:r}),e.createElementVNode("button",{class:"esri-icon-polygon geometry-button",value:"polygon",onClick:r})]))}});exports.default=g;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/Basemap"),y=require("@arcgis/core/config"),q=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),z=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/TileLayer"),S=require("@arcgis/core/layers/WebTileLayer"),L=require("@arcgis/core/Map"),x=require("@arcgis/core/views/MapView"),R=require("@arcgis/core/views/SceneView"),H=require("@turf/destination"),I=require("@turf/helpers"),_=require("../stores/index.js"),C=require("./custom-layer/custom-wmts-layer.js");function b(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const t=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,t.get?t:{enumerable:!0,get:()=>r[i]})}}return e.default=r,Object.freeze(e)}const T=b(q),p=b(z),G=b(I);function k(r,e){return r&&(r.startsWith("http://")||r.startsWith("https://")?r:e+r)}class N{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){const i=_.default.useAppDataStore,t=JSON.parse(JSON.stringify(i.mapConfig));this.mapConfig=t;const{container:o,markerClickCallback:n,mapClickCallback:f}=e;y.assetsPath=`${t.assetsRoot}/ArcgisAssets`,y.fontsUrl=`${t.assetsRoot}/fonts`,y.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const c=new L;if((t==null?void 0:t.mapOptions.mode.toLowerCase())==="2d"?this.view=new x({map:c,container:o,...t.mapOptions}):this.view=new R({map:c,container:o,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...t==null?void 0:t.mapOptions}),this.view.on("click",async s=>{var v,M;if(f){let a=s.mapPoint;a.spatialReference.isWebMercator&&(a=p.webMercatorToGeographic(a)),f([a.x,a.y],[s.screenPoint.x,s.screenPoint.y],s)}if(this.view.type==="3d"){const a=this.view.camera;if(this.view.spatialReference.isWebMercator){const u=p.webMercatorToGeographic(a.position),d={heading:a.heading,tilt:a.tilt,position:u.toJSON()};console.log(d),(v=navigator.clipboard)==null||v.writeText(JSON.stringify(d))}else console.log(a.toJSON());console.log(this.view.zoom,this.view.scale)}else{let a=this.view.center;this.view.spatialReference.isWebMercator&&(a=p.webMercatorToGeographic(a)),console.log({center:a.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const l=(M=(await this.view.hitTest(s)).results)==null?void 0:M.filter(a=>a.type==="graphic");l.length>0&&l.forEach(a=>{var d;const u=a.graphic;(d=u.attributes)!=null&&d.type&&n&&n(u.attributes.type,u.attributes.id,u.attributes,s)})}),t!=null&&t.baseLayers?t.baseLayers.forEach(s=>{const h=k(s.url,t.assetsRoot);switch(s.type.toLowerCase()){case"webTile".toLowerCase():{const l=new S({urlTemplate:h,...s.options});c.add(l);break}case"tile":{const l=new O({url:h,...s.options});c.add(l);break}case"customWMTS".toLowerCase():{const l=new C.default({urlTemplate:h,...s.options});c.add(l);break}case"arcgis":{const l=new P(s.options);c.basemap=l;break}}}):c.basemap=new P({style:{id:"arcgis/dark-gray",language:"zh-CN"}}),t!=null&&t.hdLayers){const s=t.hdLayers.map(h=>new W({url:k(h.url,t.assetsRoot),...h.options,title:h.options.id}));c.addMany(s)}this.view.ui.remove("attribution"),this.view.ui.add("compass","top-left"),await this.view.when();const w=this.mapConfig.camera;let m;if(this.view.type==="2d"){let s=this.view.center;this.view.spatialReference.isWebMercator&&(s=p.webMercatorToGeographic(s)),m={center:[s.x,s.y],zoom:this.view.zoom}}else{let s=this.view.camera.position;this.view.spatialReference.isWebMercator&&(s=p.webMercatorToGeographic(s)),m={position:s,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return w?w.home=m:this.mapConfig.camera={home:m},this.view}setLayerVisibility(e){const{id:i,visible:t}=e,o=this.view.map.findLayerById(i);return o?(o.visible=t,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type){case"point":e.target=new g.Point(e.target);break;case"polyline":e.target=new g.Polyline(e.target);break;case"polygon":e.target=new g.Polygon(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,t=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:t,tilt:0},{duration:(e.duration||2)*1e3});else{const o=Math.tan(i*Math.PI/180)*e.height,n=H(G.point(e.center),o,t+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:e.height},heading:t,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:t=0}=e,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const n=o[i];return n?(await this.view.goTo(n,{duration:t*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let t=0;const n=1e3/30,f=T.watch(()=>this.view.center,()=>{const c=this.transformPoints(e),w=Date.now();w-t>n&&(i(c),t=w)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,f),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const t=new g.Point({x:i[0],y:i[1]}),o=this.view.toScreen(t);return[o.x,o.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:t}=e;!i&&!t||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=T.watch(()=>this.view.zoom,o=>{i&&o<=i&&(this.view.zoom=i),t&&o>=t&&(this.view.zoom=t)}))}}exports.default=N;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/Basemap"),y=require("@arcgis/core/config"),q=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),z=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/TileLayer"),S=require("@arcgis/core/layers/WebTileLayer"),L=require("@arcgis/core/Map"),x=require("@arcgis/core/views/MapView"),R=require("@arcgis/core/views/SceneView"),H=require("@turf/destination"),I=require("@turf/helpers"),_=require("../stores/index.js"),C=require("./custom-layer/custom-wmts-layer.js");function b(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const t=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,t.get?t:{enumerable:!0,get:()=>r[i]})}}return e.default=r,Object.freeze(e)}const T=b(q),p=b(z),G=b(I);function k(r,e){return r&&(r.startsWith("http://")||r.startsWith("https://")?r:e+r)}class N{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){const i=_.default.useAppDataStore,t=JSON.parse(JSON.stringify(i.mapConfig));this.mapConfig=t;const{container:o,markerClickCallback:n,mapClickCallback:f}=e;y.assetsPath=`${t.assetsRoot}/ArcgisAssets`,y.fontsUrl=`${t.assetsRoot}/fonts`,y.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const c=new L;if((t==null?void 0:t.mapOptions.mode.toLowerCase())==="2d"?this.view=new x({map:c,container:o,...t.mapOptions}):this.view=new R({map:c,container:o,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...t==null?void 0:t.mapOptions}),this.view.on("click",async s=>{var v,M;if(f){let a=s.mapPoint;a.spatialReference.isWebMercator&&(a=p.webMercatorToGeographic(a)),f([a.x,a.y],[s.screenPoint.x,s.screenPoint.y],s)}if(this.view.type==="3d"){const a=this.view.camera;if(this.view.spatialReference.isWebMercator){const u=p.webMercatorToGeographic(a.position),d={heading:a.heading,tilt:a.tilt,position:u.toJSON()};console.log(d),(v=navigator.clipboard)==null||v.writeText(JSON.stringify(d))}else console.log(a.toJSON());console.log(this.view.zoom,this.view.scale)}else{let a=this.view.center;this.view.spatialReference.isWebMercator&&(a=p.webMercatorToGeographic(a)),console.log({center:a.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const l=(M=(await this.view.hitTest(s)).results)==null?void 0:M.filter(a=>a.type==="graphic");l.length>0&&l.forEach(a=>{var d;const u=a.graphic;(d=u.attributes)!=null&&d.type&&n&&n(u.attributes.type,u.attributes.id,u.attributes,s)})}),t!=null&&t.baseLayers?t.baseLayers.forEach(s=>{const h=k(s.url,t.assetsRoot);switch(s.type.toLowerCase()){case"webTile".toLowerCase():{const l=new S({urlTemplate:h,...s.options});c.add(l);break}case"tile":{const l=new O({url:h,...s.options});c.add(l);break}case"customWMTS".toLowerCase():{const l=new C.default({urlTemplate:h,...s.options});c.add(l);break}case"arcgis":{const l=new P(s.options);c.basemap=l;break}}}):c.basemap=new P({style:{id:"arcgis/light-gray",language:"zh-CN"}}),t!=null&&t.hdLayers){const s=t.hdLayers.map(h=>new W({url:k(h.url,t.assetsRoot),...h.options,title:h.options.id}));c.addMany(s)}this.view.ui.remove("attribution"),this.view.ui.add("compass","top-left"),await this.view.when();const w=this.mapConfig.camera;let m;if(this.view.type==="2d"){let s=this.view.center;this.view.spatialReference.isWebMercator&&(s=p.webMercatorToGeographic(s)),m={center:[s.x,s.y],zoom:this.view.zoom}}else{let s=this.view.camera.position;this.view.spatialReference.isWebMercator&&(s=p.webMercatorToGeographic(s)),m={position:s,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return w?w.home=m:this.mapConfig.camera={home:m},this.view}setLayerVisibility(e){const{id:i,visible:t}=e,o=this.view.map.findLayerById(i);return o?(o.visible=t,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type){case"point":e.target=new g.Point(e.target);break;case"polyline":e.target=new g.Polyline(e.target);break;case"polygon":e.target=new g.Polygon(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,t=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:t,tilt:0},{duration:(e.duration||2)*1e3});else{const o=Math.tan(i*Math.PI/180)*e.height,n=H(G.point(e.center),o,t+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:e.height},heading:t,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:t=0}=e,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const n=o[i];return n?(await this.view.goTo(n,{duration:t*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let t=0;const n=1e3/30,f=T.watch(()=>this.view.center,()=>{const c=this.transformPoints(e),w=Date.now();w-t>n&&(i(c),t=w)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,f),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const t=new g.Point({x:i[0],y:i[1]}),o=this.view.toScreen(t);return[o.x,o.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:t}=e;!i&&!t||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=T.watch(()=>this.view.zoom,o=>{i&&o<=i&&(this.view.zoom=i),t&&o>=t&&(this.view.zoom=t)}))}}exports.default=N;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils.js"),y=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/buffer"),f=require("@turf/concave"),L=require("@turf/convex"),v=require("@turf/helpers"),C=require("./district-controller.js");function m(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const w=m(d),h=m(v);class S{constructor(e){this.crossScale=3e3,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 C.default(t);this.drawArea(i,!0)}return this.watchHandle=w.watch(()=>this.view.scale,(t,i)=>{t>this.crossScale&&i<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):t<=this.crossScale&&i>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{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);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),this.showPopup(t),{status:0,message:"ok"}):{status:1,message:"未找到"}}showPopup(e){const t=e.geometry.type==="point"?e.geometry:e.geometry.centroid;this.view.openPopup({features:[e],location:t})}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()),s=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),this.showPopup(i[0])),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(t.length>0?(await this.view.goTo(t),this.showPopup(t[0])):i.length>0?(await this.view.goTo(i),this.showPopup(i[0])):(s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500}),this.showPopup(s[0])),{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){let r=null;if(i.length===2)r=h.lineString(i);else if(i.length>2){const u=h.featureCollection(i.map(p=>h.point(p)));r=f(u,{maxEdge:400,units:"meters"}),r||(r=L(u))}if(!r){console.log("生成区控面失败",e);return}const o=b(r.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},c=new y({geometry:{type:"polygon",rings:o.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:g,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:n}]}});t?this.districtControllerLayer.add(c):this.subDistrictControllerLayer.add(c)}for(const r of e.subDistricts)this.drawArea(r,!1);const s=e.crosses.map(r=>{const o={type:"cross",id:r.id,name:r.name,color:e.areaColor,signalId:r.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:r.isKey};return new y({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:this.getCrossGraphicSymbol(o,"marker"),attributes:o,popupTemplate:{title:r.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}})});this.crossLayer.addMany(s)}getCrossGraphicSymbol(e,t){const{isKey:i,color:s}=e;if(t==="marker")return{type:"simple-marker",style:i?"diamond":"circle",color:s,size:i?16:8,outline:{color:i?"red":"white",width:i?2: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:i?30:22,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:i?45:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/xhj_${i?4:1}.png`}]}}}}}exports.default=S;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),y=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/GraphicsLayer"),f=require("@turf/buffer"),L=require("@turf/concave"),m=require("@turf/convex"),v=require("@turf/helpers"),C=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 i=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const w=g(b),c=g(v);class S{constructor(e){this.crossScale=3e3,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 C.default(t);this.drawArea(i,!0)}return this.watchHandle=w.watch(()=>this.view.scale,(t,i)=>{t>this.crossScale&&i<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):t<=this.crossScale&&i>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{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);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),this.showPopup(t),{status:0,message:"ok"}):{status:1,message:"未找到"}}showPopup(e){const t=e.geometry.type==="point"?e.geometry:e.geometry.centroid;this.view.openPopup({features:[e],location:t})}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()),s=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),this.showPopup(i[0])),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(t.length>0?(await this.view.goTo(t),this.showPopup(t[0])):i.length>0?(await this.view.goTo(i),this.showPopup(i[0])):(s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500}),this.showPopup(s[0])),{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){let r=null;if(i.length===2)r=c.lineString(i);else if(i.length>2){const h=c.featureCollection(i.map(d=>c.point(d)));t?r=m(h):(r=L(h,{maxEdge:400,units:"meters"}),r||(r=m(h)))}if(!r){console.log("生成区控面失败",e);return}const o=f(r.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 p={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},u=new y({geometry:{type:"polygon",rings:o.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:p,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:n}]}});t?this.districtControllerLayer.add(u):this.subDistrictControllerLayer.add(u)}for(const r of e.subDistricts)this.drawArea(r,!1);const s=e.crosses.map(r=>{const o={type:"cross",id:r.id,name:r.name,color:e.areaColor,signalId:r.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:r.isKey};return new y({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:this.getCrossGraphicSymbol(o,"marker"),attributes:o,popupTemplate:{title:r.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}})});this.crossLayer.addMany(s)}getCrossGraphicSymbol(e,t){const{isKey:i,color:s}=e;if(t==="marker")return{type:"simple-marker",style:i?"diamond":"circle",color:s,size:i?16:8,outline:{color:i?"red":"white",width:i?2: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:i?30:22,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:i?45:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/xhj_${i?4:1}.png`}]}}}}}exports.default=S;
@@ -1,9 +1,9 @@
1
+ import Graphic from '@arcgis/core/Graphic';
1
2
  import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer';
2
3
  import MapView from '@arcgis/core/views/MapView';
3
4
  import SceneView from '@arcgis/core/views/SceneView';
4
- import SketchViewModel from '@arcgis/core/widgets/Sketch/SketchViewModel';
5
5
  import Sketch from '@arcgis/core/widgets/Sketch';
6
- import Graphic from '@arcgis/core/Graphic';
6
+ import SketchViewModel from '@arcgis/core/widgets/Sketch/SketchViewModel';
7
7
  interface sketchViewOptions {
8
8
  /**
9
9
  * 最大允许绘制的图形数量
@@ -16,7 +16,7 @@ interface sketchViewOptions {
16
16
  /**
17
17
  * 绘制工具显示的元素
18
18
  */
19
- sketchvisibleElements?: {};
19
+ sketchVisibleElements?: {};
20
20
  /**
21
21
  * 绘制工具显示的位置
22
22
  */
@@ -27,7 +27,7 @@ interface sketchViewOptions {
27
27
  * @type {boolean}
28
28
  * @memberof sketchViewOptions
29
29
  */
30
- defaultsketchVisible?: boolean;
30
+ defaultSketchVisible?: boolean;
31
31
  sketchViewModelItemSymbol?: {
32
32
  polylineSymbol?: any;
33
33
  polygonSymbol?: any;
@@ -42,7 +42,7 @@ declare type LinearUnits = 'meters' | 'feet' | 'kilometers' | 'miles' | 'nautica
42
42
  export default class SketchView {
43
43
  private viewer;
44
44
  graphicsLayer: GraphicsLayer;
45
- TextgraphicsLayer: GraphicsLayer;
45
+ TextGraphicsLayer: GraphicsLayer;
46
46
  sketchViewModel: SketchViewModel;
47
47
  sketch: Sketch;
48
48
  options: sketchViewOptions;
@@ -74,10 +74,10 @@ export default class SketchView {
74
74
  * @returns
75
75
  * @memberof SketchView
76
76
  */
77
- inintSectionArea(data: any, reverse?: boolean): any;
77
+ initSectionArea(data: any, reverse?: boolean): any;
78
78
  createPolylineGraphic(paths: any, lineSymbol: any, attributes: any): Graphic;
79
79
  createPolygonGraphic(rings: any, lineSymbol: any, attributes: any): Graphic;
80
- on(callcack?: (type: string, points: any, event?: any) => void): void;
80
+ on(callback?: (type: string, points: any, event?: any) => void): void;
81
81
  /**
82
82
  * 获取当前绘制的计算区域
83
83
  * @returns
@@ -105,7 +105,7 @@ export default class SketchView {
105
105
  attributes: any;
106
106
  };
107
107
  };
108
- rawdata: {
108
+ rawData: {
109
109
  point: any;
110
110
  type: string;
111
111
  attributes: any;
@@ -115,7 +115,7 @@ export default class SketchView {
115
115
  * 获取进口道所在的进口道编号
116
116
  *
117
117
  * @param {armData} armData 进口道编号区域
118
- * @param {*} graphicPpolygon 绘制的区域
118
+ * @param {*} graphicPolygon 绘制的区域
119
119
  * @returns
120
120
  * @memberof SketchView
121
121
  */
@@ -126,7 +126,7 @@ export default class SketchView {
126
126
  *
127
127
  * @private
128
128
  * @param {*} geometry
129
- * @param {boolean} [isfilterData=true] 是否过滤首尾相同点数据
129
+ * @param {boolean} [isFilterData=true] 是否过滤首尾相同点数据
130
130
  * @returns
131
131
  * @memberof SketchView
132
132
  */
@@ -152,7 +152,7 @@ export default class SketchView {
152
152
  * @returns
153
153
  * @memberof SketchView
154
154
  */
155
- getshiftLine(lineGeometry: __esri.Geometry, distance: number, offsetUnit?: LinearUnits): __esri.Geometry | __esri.Geometry[];
155
+ getShiftLine(lineGeometry: __esri.Geometry, distance: number, offsetUnit?: LinearUnits): __esri.Geometry | __esri.Geometry[];
156
156
  /**
157
157
  * 设置线的平移
158
158
  *
@@ -161,7 +161,7 @@ export default class SketchView {
161
161
  * @param {*} symbol 线的样式
162
162
  * @memberof SketchView
163
163
  */
164
- setshiftLine(distance: number, offsetUnit?: LinearUnits, symbol?: any): void;
164
+ setShiftLine(distance: number, offsetUnit?: LinearUnits, symbol?: any): void;
165
165
  /**
166
166
  * 移除平移线
167
167
  *
@@ -173,7 +173,7 @@ export default class SketchView {
173
173
  *
174
174
  * @memberof SketchView
175
175
  */
176
- removedraw(): void;
176
+ removeDraw(): void;
177
177
  addGraphic(geometry: any, symbol?: any, attributes?: any): void;
178
178
  /**
179
179
  * 获取方向
@@ -202,7 +202,7 @@ export default class SketchView {
202
202
  * 设置最大允许绘制的图形数量
203
203
  * @param num 数量
204
204
  */
205
- setmaxAllowedGraphics(num: number): void;
205
+ setMaxAllowedGraphics(num: number): void;
206
206
  deepClone(obj: any): void;
207
207
  destroy(): void;
208
208
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/layers/GraphicsLayer"),b=require("@arcgis/core/widgets/Sketch/SketchViewModel"),P=require("@arcgis/core/widgets/Sketch"),G=require("@arcgis/core/geometry/support/webMercatorUtils.js"),k=require("@arcgis/core/geometry/geometryEngine.js"),l=require("@arcgis/core/Graphic"),S=require("uuid"),M=require("@arcgis/core/geometry/Polygon.js"),A=require("@arcgis/core/geometry/Polyline.js"),v=require("@turf/intersect"),x=require("@turf/helpers");function f(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const y=f(G),E=f(k),m=f(x);function L(a,t=[]){if(a===null||typeof a!="object")return a;if(Object.prototype.toString.call(a)==="[object Date]")return new Date(a);if(Object.prototype.toString.call(a)==="[object RegExp]")return new RegExp(a);if(Object.prototype.toString.call(a)==="[object Error]")return new Error(a);const e=t.filter(s=>s.original===a)[0];if(e)return e.copy;const i=Array.isArray(a)?[]:{};return t.push({original:a,copy:i}),Object.keys(a).forEach(s=>{i[s]=L(a[s],t)}),i}const V={maxAllowedGraphics:0,GraphicsLayer:{},sketchvisibleElements:{},sketchPosition:"top-left",defaultsketchVisible:!0,sketchViewModelItemSymbol:{}},w={type:"simple-line",color:"#556DEA",width:2},d={type:"simple-fill",color:[227,139,79,.4],outline:{color:[255,255,255],width:1}};class O{constructor(t,e){this.viewer=t,this.options={...V,...e},this.graphicsLayer=new u({...this.options.GraphicsLayer}),this.TextgraphicsLayer=new u,this.viewer.map.layers.add(this.graphicsLayer),this.viewer.map.layers.add(this.TextgraphicsLayer),this.init()}init(){this.sketchViewModel=new b({layer:this.graphicsLayer,view:this.viewer,updateOnGraphicClick:!0,polylineSymbol:w,polygonSymbol:d,...this.options.sketchViewModelItemSymbol});const t=this.findLayerById("TrafficMarkings"),e=[];t&&e.push({layer:t,enabled:!0}),this.sketch=new P({view:this.viewer,viewModel:this.sketchViewModel,layer:this.graphicsLayer,visible:this.options.defaultsketchVisible,snappingOptions:{enabled:!0,featureSources:e}}),this.sketch.visibleElements={...this.options.sketchvisibleElements},this.viewer.ui.add(this.sketch,this.options.sketchPosition)}initPoint(t,e="all",i=!1){if(!t)return;const{crossArea:s,sectionArea:r}=t;if(s&&(e=="crossArea"||e=="all")){const o=this.initCrossArea(s);this.graphicsLayer.add(o)}if(r&&(e=="sectionArea"||e=="all")){const o=this.inintSectionArea(r,i);this.graphicsLayer.addMany(o)}}initEntranceFusionZone(t){const e=[],i=d;t.map(s=>{e.push(this.createPolygonGraphic(s,i,{}))}),this.graphicsLayer.addMany(e)}initCrossArea(t){const e=d;return this.createPolygonGraphic(t,e,{})}inintSectionArea(t,e=!1){const i=[],s=w,r={type:"simple-line",color:[0,0,255],width:2};return Object.keys(t).map(o=>{const c=t[o][0],n=t[o][1];e&&(c.reverse(),n.reverse());const h=S.v4(),p=this.createPolylineGraphic(c,s,{type:"draw",id:h}),g=this.createPolylineGraphic(n,r,{type:"shiftLine",id:h});i.push(p,g)}),i}createPolylineGraphic(t,e,i){const s=new A({paths:t}),r=y.geographicToWebMercator(s);return new l({geometry:r,symbol:e,attributes:i})}createPolygonGraphic(t,e,i){const s=new M({rings:t}),r=y.geographicToWebMercator(s);return new l({geometry:r,symbol:e,attributes:i})}on(t){const e=this;this.sketchViewModel.on("create",function(i){var r,o,c;const s=e.graphicsLayer.graphics;if((r=e.options)!=null&&r.maxAllowedGraphics&&s.length>((o=e.options)==null?void 0:o.maxAllowedGraphics)){e.graphicsLayer.remove(i.graphic),console.log("已达到最大图形数量,无法继续绘制!");return}if(i.state==="complete"&&((c=i.graphic)!=null&&c.geometry)){console.log(i.graphic);const n=i.graphic.geometry;i.graphic.setAttribute("type","draw"),i.graphic.setAttribute("id",new Date().getTime());const h=e.getGraphicPoint(n);t&&t("create",h,i)}}),this.sketchViewModel.on("update",function(i){if(console.log("update",i),i.aborted){const s=i.graphics[0];e.graphicsLayer.remove(s);return}if(i.state==="complete"&&i.graphics.length>0){const r=i.graphics[0].geometry,o=e.getGraphicPoint(r);t&&t("update",o,i)}}),this.sketchViewModel.on("delete",function(i){if(console.log("delete",i,e.graphicsLayer.graphics),i.graphics.length>0){const r=i.graphics[0].geometry,o=e.getGraphicPoint(r);t&&t("delete",o,i)}})}graphicPoint(){const t=[];return this.graphicsLayer.graphics.map(e=>{var r;const i=e.geometry,s=this.getGraphicPoint(i);t.push({point:s,type:(r=e.attributes)==null?void 0:r.type,attributes:e.attributes})}),t}getEntranceRoad(){const t={},e=this.graphicPoint().filter(n=>n.point.type==="polyline");if(console.log("🚀 ~ file: sketchView.ts:378 ~ SketchView ~ getEntranceRoad ~ graphics:",e),!e.length)return!1;const i=e.filter(n=>n.type=="draw"),s=e.filter(n=>n.type=="shiftLine");if(s.length==0)throw"未绘制平移!";if(i.length!=s.length)throw"绘制的线和平移的线数量不一致!";const r=i.sort((n,h)=>n.point.angle-h.point.angle),o=r.findIndex(n=>n.point.angle>135);return[...r.slice(o),...r.slice(0,o).reverse()].map((n,h)=>{const p=s.find(g=>g.attributes.id==n.attributes.id);if(!p)throw"绘制的线和平移的线不匹配!";console.log("🚀 ~ file: sketchView.ts:393 ~ SketchView ~ getEntranceRoad ~ m:",n,p),t[h+1]={0:[n.point.paths[0],n.point.paths[n.point.paths.length-1]],1:[p.point.paths[0],p.point.paths[p.point.paths.length-1]]}}),t}getEntranceFusionZone(t){const e=[],i={};this.graphicsLayer.graphics.map(r=>{var n;const o=r.geometry,c=this.getGraphicPoint(o,!1);e.push({point:c,type:(n=r.attributes)==null?void 0:n.type,attributes:r.attributes})});const s=e;return t.map((r,o)=>{i[r]=e[o]}),{graphics:i,rawdata:s}}getIntersectionArea(t,e){const i=Object.keys(t);let s=!1;for(let r=0;r<i.length;r++){const o=i[r],c=t[o];if(v(m.polygon(e),m.polygon(c))){s=o;break}}return s}filterData(t){const e=L(t);return e.length>0&&e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&e.pop(),e}getGraphicPoint(t,e=!0){const i=y.webMercatorToGeographic(t);let s;if(t.type==="point")s={type:t.type,x:i.x,y:i.y};else if(t.type==="polyline"){s={type:t.type,paths:[]},i.paths.forEach(n=>{let h=n;e&&(h=this.filterData(n)),h.forEach(p=>{s.paths.push(p)})});const r={x:s.paths[0][0],y:s.paths[0][1]},o={x:s.paths[s.paths.length-1][0],y:s.paths[s.paths.length-1][1]},c=this.getAngle(r,o);s.angle=c}else t.type==="polygon"&&(s={type:t.type,rings:[]},i.rings.forEach(r=>{let o=r;e&&(o=this.filterData(r)),o.forEach(c=>{s.rings.push(c)})}));return s}close(){this.sketch.visible=!1}show(){this.sketch.visible=!0}removeAll(){this.graphicsLayer.removeAll()}getAngle(t,e){const i=e.x-t.x,s=e.y-t.y;return Math.atan2(s,i)*180/Math.PI}getshiftLine(t,e,i="meters"){const s=t,r=-e;return E.offset(s,r,i)}setshiftLine(t,e="meters",i){i||(i={type:"simple-line",color:[0,0,255],width:2}),this.removeShiftLine(),this.graphicsLayer.graphics.map(s=>{const r=s.geometry,o=s.attributes;if((r==null?void 0:r.type)==="polyline"&&(o==null?void 0:o.type)==="draw"){const c=o.id,n=this.getshiftLine(r,t,e),h=new l({geometry:n,symbol:i,attributes:{type:"shiftLine",id:c}});this.graphicsLayer.add(h)}})}removeShiftLine(){const t=[];this.graphicsLayer.graphics.map(e=>{const i=e.attributes;(i==null?void 0:i.type)==="shiftLine"&&t.push(e)}),this.graphicsLayer.removeMany(t)}removedraw(){const t=[];this.graphicsLayer.graphics.map(e=>{const i=e.attributes;(i==null?void 0:i.type)==="draw"&&t.push(e)}),this.graphicsLayer.removeMany(t)}addGraphic(t,e={type:"simple-line",color:[0,0,255],width:2},i){const s=new l({geometry:t,symbol:e,attributes:i});this.graphicsLayer.add(s)}getDirection(t,e){const i=e.x-t.x,s=e.y-t.y,o=Math.atan2(s,i)*180/Math.PI;return o>=-45&&o<=45?0:o>45&&o<=135?1:o>135||o<=-135?2:3}findLayerById(t){return this.viewer.map.findLayerById(t)}findShiftLineGraphicsById(t){return this.graphicsLayer.graphics.find(i=>i.attributes.id===t&&i.attributes.type==="shiftLine")}remove(t){this.graphicsLayer.remove(t)}setmaxAllowedGraphics(t){this.options.maxAllowedGraphics=t===0?void 0:t}deepClone(t){}destroy(){var t,e;this.viewer.map.remove(this.graphicsLayer),this.viewer.map.remove(this.TextgraphicsLayer),(t=this.sketch)==null||t.destroy(),(e=this.sketchViewModel)==null||e.destroy()}}exports.default=O;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/geometry/geometryEngine.js"),P=require("@arcgis/core/geometry/support/webMercatorUtils.js"),l=require("@arcgis/core/Graphic"),d=require("@arcgis/core/layers/GraphicsLayer"),G=require("@arcgis/core/widgets/Sketch"),S=require("@arcgis/core/widgets/Sketch/SketchViewModel"),M=require("@arcgis/core/geometry/Polygon.js"),k=require("@arcgis/core/geometry/Polyline.js"),A=require("@turf/helpers"),x=require("@turf/intersect"),v=require("uuid");function f(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const E=f(b),g=f(P),u=f(A);function w(a,e=[]){if(a===null||typeof a!="object")return a;if(Object.prototype.toString.call(a)==="[object Date]")return new Date(a);if(Object.prototype.toString.call(a)==="[object RegExp]")return new RegExp(a);if(Object.prototype.toString.call(a)==="[object Error]")return new Error(a);const t=e.filter(s=>s.original===a)[0];if(t)return t.copy;const i=Array.isArray(a)?[]:{};return e.push({original:a,copy:i}),Object.keys(a).forEach(s=>{i[s]=w(a[s],e)}),i}const V={maxAllowedGraphics:0,GraphicsLayer:{},sketchVisibleElements:{},sketchPosition:"top-left",defaultSketchVisible:!0,sketchViewModelItemSymbol:{}},m={type:"simple-line",color:"#556DEA",width:2},y={type:"simple-fill",color:[227,139,79,.4],outline:{color:[255,255,255],width:1}};class O{constructor(e,t){this.viewer=e,this.options={...V,...t},this.graphicsLayer=new d({...this.options.GraphicsLayer}),this.TextGraphicsLayer=new d,this.viewer.map.layers.add(this.graphicsLayer),this.viewer.map.layers.add(this.TextGraphicsLayer),this.init()}init(){this.sketchViewModel=new S({layer:this.graphicsLayer,view:this.viewer,updateOnGraphicClick:!0,polylineSymbol:m,polygonSymbol:y,...this.options.sketchViewModelItemSymbol});const e=this.findLayerById("TrafficMarkings"),t=[];e&&t.push({layer:e,enabled:!0}),this.sketch=new G({view:this.viewer,viewModel:this.sketchViewModel,layer:this.graphicsLayer,visible:this.options.defaultSketchVisible,snappingOptions:{enabled:!0,featureSources:t}}),this.sketch.visibleElements={...this.options.sketchVisibleElements},this.viewer.ui.add(this.sketch,this.options.sketchPosition)}initPoint(e,t="all",i=!1){if(!e)return;const{crossArea:s,sectionArea:r}=e;if(s&&(t=="crossArea"||t=="all")){const o=this.initCrossArea(s);this.graphicsLayer.add(o)}if(r&&(t=="sectionArea"||t=="all")){const o=this.initSectionArea(r,i);this.graphicsLayer.addMany(o)}}initEntranceFusionZone(e){const t=[];e.map(i=>{t.push(this.createPolygonGraphic(i,y,{}))}),this.graphicsLayer.addMany(t)}initCrossArea(e){return this.createPolygonGraphic(e,y,{})}initSectionArea(e,t=!1){const i=[],s={type:"simple-line",color:[0,0,255],width:2};return Object.keys(e).map(r=>{const o=e[r][0],c=e[r][1];t&&(o.reverse(),c.reverse());const n=v.v4(),h=this.createPolylineGraphic(o,m,{type:"draw",id:n}),p=this.createPolylineGraphic(c,s,{type:"shiftLine",id:n});i.push(h,p)}),i}createPolylineGraphic(e,t,i){const s=new k({paths:e}),r=g.geographicToWebMercator(s);return new l({geometry:r,symbol:t,attributes:i})}createPolygonGraphic(e,t,i){const s=new M({rings:e}),r=g.geographicToWebMercator(s);return new l({geometry:r,symbol:t,attributes:i})}on(e){const t=this;this.sketchViewModel.on("create",function(i){var r,o,c;const s=t.graphicsLayer.graphics;if((r=t.options)!=null&&r.maxAllowedGraphics&&s.length>((o=t.options)==null?void 0:o.maxAllowedGraphics)){t.graphicsLayer.remove(i.graphic),console.log("已达到最大图形数量,无法继续绘制!");return}if(i.state==="complete"&&((c=i.graphic)!=null&&c.geometry)){console.log(i.graphic);const n=i.graphic.geometry;i.graphic.setAttribute("type","draw"),i.graphic.setAttribute("id",new Date().getTime());const h=t.getGraphicPoint(n);e&&e("create",h,i)}}),this.sketchViewModel.on("update",function(i){if(console.log("update",i),i.aborted){const s=i.graphics[0];t.graphicsLayer.remove(s);return}if(i.state==="complete"&&i.graphics.length>0){const r=i.graphics[0].geometry,o=t.getGraphicPoint(r);e&&e("update",o,i)}}),this.sketchViewModel.on("delete",function(i){if(console.log("delete",i,t.graphicsLayer.graphics),i.graphics.length>0){const r=i.graphics[0].geometry,o=t.getGraphicPoint(r);e&&e("delete",o,i)}})}graphicPoint(){const e=[];return this.graphicsLayer.graphics.map(t=>{var r;const i=t.geometry,s=this.getGraphicPoint(i);e.push({point:s,type:(r=t.attributes)==null?void 0:r.type,attributes:t.attributes})}),e}getEntranceRoad(){const e={},t=this.graphicPoint().filter(n=>n.point.type==="polyline");if(console.log("🚀 ~ file: sketchView.ts:378 ~ SketchView ~ getEntranceRoad ~ graphics:",t),!t.length)return!1;const i=t.filter(n=>n.type=="draw"),s=t.filter(n=>n.type=="shiftLine");if(s.length==0)throw"未绘制平移!";if(i.length!=s.length)throw"绘制的线和平移的线数量不一致!";const r=i.sort((n,h)=>n.point.angle-h.point.angle),o=r.findIndex(n=>n.point.angle>135);return[...r.slice(o),...r.slice(0,o).reverse()].map((n,h)=>{const p=s.find(L=>L.attributes.id==n.attributes.id);if(!p)throw"绘制的线和平移的线不匹配!";console.log("🚀 ~ file: sketchView.ts:393 ~ SketchView ~ getEntranceRoad ~ m:",n,p),e[h+1]={0:[n.point.paths[0],n.point.paths[n.point.paths.length-1]],1:[p.point.paths[0],p.point.paths[p.point.paths.length-1]]}}),e}getEntranceFusionZone(e){const t=[],i={};this.graphicsLayer.graphics.map(r=>{var n;const o=r.geometry,c=this.getGraphicPoint(o,!1);t.push({point:c,type:(n=r.attributes)==null?void 0:n.type,attributes:r.attributes})});const s=t;return e.map((r,o)=>{i[r]=t[o]}),{graphics:i,rawData:s}}getIntersectionArea(e,t){const i=Object.keys(e);let s=!1;for(let r=0;r<i.length;r++){const o=i[r],c=e[o];if(x(u.polygon(t),u.polygon(c))){s=o;break}}return s}filterData(e){const t=w(e);return t.length>0&&t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&t.pop(),t}getGraphicPoint(e,t=!0){let i=e;this.viewer.spatialReference.isWebMercator&&(i=g.webMercatorToGeographic(e));let s;if(e.type==="point")s={type:e.type,x:i.x,y:i.y};else if(e.type==="polyline"){s={type:e.type,paths:[]},i.paths.forEach(n=>{let h=n;t&&(h=this.filterData(n)),h.forEach(p=>{s.paths.push(p)})});const r={x:s.paths[0][0],y:s.paths[0][1]},o={x:s.paths[s.paths.length-1][0],y:s.paths[s.paths.length-1][1]},c=this.getAngle(r,o);s.angle=c}else e.type==="polygon"&&(s={type:e.type,rings:[]},i.rings.forEach(r=>{let o=r;t&&(o=this.filterData(r)),o.forEach(c=>{s.rings.push(c)})}));return s}close(){this.sketch.visible=!1}show(){this.sketch.visible=!0}removeAll(){this.graphicsLayer.removeAll()}getAngle(e,t){const i=t.x-e.x,s=t.y-e.y;return Math.atan2(s,i)*180/Math.PI}getShiftLine(e,t,i="meters"){const s=e,r=-t;return E.offset(s,r,i)}setShiftLine(e,t="meters",i){i||(i={type:"simple-line",color:[0,0,255],width:2}),this.removeShiftLine(),this.graphicsLayer.graphics.map(s=>{const r=s.geometry,o=s.attributes;if((r==null?void 0:r.type)==="polyline"&&(o==null?void 0:o.type)==="draw"){const c=o.id,n=this.getShiftLine(r,e,t),h=new l({geometry:n,symbol:i,attributes:{type:"shiftLine",id:c}});this.graphicsLayer.add(h)}})}removeShiftLine(){const e=[];this.graphicsLayer.graphics.map(t=>{const i=t.attributes;(i==null?void 0:i.type)==="shiftLine"&&e.push(t)}),this.graphicsLayer.removeMany(e)}removeDraw(){const e=[];this.graphicsLayer.graphics.map(t=>{const i=t.attributes;(i==null?void 0:i.type)==="draw"&&e.push(t)}),this.graphicsLayer.removeMany(e)}addGraphic(e,t={type:"simple-line",color:[0,0,255],width:2},i){const s=new l({geometry:e,symbol:t,attributes:i});this.graphicsLayer.add(s)}getDirection(e,t){const i=t.x-e.x,s=t.y-e.y,o=Math.atan2(s,i)*180/Math.PI;return o>=-45&&o<=45?0:o>45&&o<=135?1:o>135||o<=-135?2:3}findLayerById(e){return this.viewer.map.findLayerById(e)}findShiftLineGraphicsById(e){return this.graphicsLayer.graphics.find(i=>i.attributes.id===e&&i.attributes.type==="shiftLine")}remove(e){this.graphicsLayer.remove(e)}setMaxAllowedGraphics(e){this.options.maxAllowedGraphics=e===0?void 0:e}deepClone(e){}destroy(){var e,t;this.viewer.map.remove(this.graphicsLayer),this.viewer.map.remove(this.TextGraphicsLayer),(e=this.sketch)==null||e.destroy(),(t=this.sketchViewModel)==null||t.destroy()}}exports.default=O;