gisviewer-vue3-arcgis 1.0.85

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 (138) hide show
  1. package/README.md +103 -0
  2. package/es/index.d.ts +8 -0
  3. package/es/index.mjs +16 -0
  4. package/es/src/components.d.ts +9 -0
  5. package/es/src/gis-map/gis-map.vue.d.ts +91 -0
  6. package/es/src/gis-map/gis-map.vue.mjs +124 -0
  7. package/es/src/gis-map/gis-map.vue2.mjs +4 -0
  8. package/es/src/gis-map/index.d.ts +81 -0
  9. package/es/src/gis-map/index.mjs +7 -0
  10. package/es/src/gis-map/stores/appData.d.ts +3 -0
  11. package/es/src/gis-map/stores/appData.mjs +9 -0
  12. package/es/src/gis-map/stores/index.d.ts +7 -0
  13. package/es/src/gis-map/stores/index.mjs +10 -0
  14. package/es/src/gis-map/style/index.css +13 -0
  15. package/es/src/gis-map/utils/FlyToPoints.d.ts +37 -0
  16. package/es/src/gis-map/utils/FlyToPoints.mjs +67 -0
  17. package/es/src/gis-map/utils/GreenWaveline.mjs +193 -0
  18. package/es/src/gis-map/utils/Layers.d.ts +31 -0
  19. package/es/src/gis-map/utils/Layers.mjs +99 -0
  20. package/es/src/gis-map/utils/common-utils.d.ts +65 -0
  21. package/es/src/gis-map/utils/common-utils.mjs +159 -0
  22. package/es/src/gis-map/utils/holo-flow/index.d.ts +15 -0
  23. package/es/src/gis-map/utils/holo-flow/index.mjs +50 -0
  24. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +40 -0
  25. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +209 -0
  26. package/es/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +69 -0
  27. package/es/src/gis-map/utils/holo-flow/trace-external-renderer.mjs +316 -0
  28. package/es/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +18 -0
  29. package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +75 -0
  30. package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +35 -0
  31. package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.mjs +286 -0
  32. package/es/src/gis-map/utils/index.d.ts +21 -0
  33. package/es/src/gis-map/utils/index.mjs +23 -0
  34. package/es/src/gis-map/utils/map-initializer.d.ts +50 -0
  35. package/es/src/gis-map/utils/map-initializer.mjs +248 -0
  36. package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +9 -0
  37. package/es/src/gis-map/utils/open-drive-renderer/index.mjs +271 -0
  38. package/es/src/gis-map/utils/overlay.d.ts +83 -0
  39. package/es/src/gis-map/utils/overlay.mjs +149 -0
  40. package/es/src/gis-map/utils/queue-length.d.ts +14 -0
  41. package/es/src/gis-map/utils/queue-length.mjs +83 -0
  42. package/es/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -0
  43. package/es/src/gis-map/utils/renderer/greenWaveline.mjs +169 -0
  44. package/es/src/gis-map/utils/road-config-tool/cross.d.ts +51 -0
  45. package/es/src/gis-map/utils/road-config-tool/cross.mjs +127 -0
  46. package/es/src/gis-map/utils/road-config-tool/entrance.d.ts +24 -0
  47. package/es/src/gis-map/utils/road-config-tool/entrance.mjs +79 -0
  48. package/es/src/gis-map/utils/road-config-tool/exit.d.ts +18 -0
  49. package/es/src/gis-map/utils/road-config-tool/exit.mjs +86 -0
  50. package/es/src/gis-map/utils/road-config-tool/index.d.ts +44 -0
  51. package/es/src/gis-map/utils/road-config-tool/index.mjs +112 -0
  52. package/es/src/gis-map/utils/road-config-tool/indicator-area.d.ts +22 -0
  53. package/es/src/gis-map/utils/road-config-tool/indicator-area.mjs +44 -0
  54. package/es/src/gis-map/utils/road-config-tool/lane.d.ts +21 -0
  55. package/es/src/gis-map/utils/road-config-tool/lane.mjs +35 -0
  56. package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.d.ts +62 -0
  57. package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.mjs +265 -0
  58. package/es/src/gis-map/utils/sketchView.d.ts +209 -0
  59. package/es/src/gis-map/utils/sketchView.mjs +516 -0
  60. package/es/src/gis-map/utils/sketchViewTool.d.ts +259 -0
  61. package/es/src/gis-map/utils/sketchViewTool.mjs +503 -0
  62. package/es/src/gis-map/utils/syncMapView.d.ts +43 -0
  63. package/es/src/gis-map/utils/syncMapView.mjs +64 -0
  64. package/es/src/gis-map/utils/traffic-flow.d.ts +66 -0
  65. package/es/src/gis-map/utils/traffic-flow.mjs +308 -0
  66. package/es/src/index.d.ts +1 -0
  67. package/es/src/index.mjs +4 -0
  68. package/es/src/types/index.d.ts +142 -0
  69. package/es/src/types/index.mjs +5 -0
  70. package/lib/index.d.ts +8 -0
  71. package/lib/index.js +1 -0
  72. package/lib/src/components.d.ts +9 -0
  73. package/lib/src/gis-map/gis-map.vue.d.ts +91 -0
  74. package/lib/src/gis-map/gis-map.vue.js +1 -0
  75. package/lib/src/gis-map/gis-map.vue2.js +1 -0
  76. package/lib/src/gis-map/index.d.ts +81 -0
  77. package/lib/src/gis-map/index.js +1 -0
  78. package/lib/src/gis-map/stores/appData.d.ts +3 -0
  79. package/lib/src/gis-map/stores/appData.js +1 -0
  80. package/lib/src/gis-map/stores/index.d.ts +7 -0
  81. package/lib/src/gis-map/stores/index.js +1 -0
  82. package/lib/src/gis-map/style/index.css +13 -0
  83. package/lib/src/gis-map/utils/FlyToPoints.d.ts +37 -0
  84. package/lib/src/gis-map/utils/FlyToPoints.js +1 -0
  85. package/lib/src/gis-map/utils/GreenWaveline.js +1 -0
  86. package/lib/src/gis-map/utils/Layers.d.ts +31 -0
  87. package/lib/src/gis-map/utils/Layers.js +1 -0
  88. package/lib/src/gis-map/utils/common-utils.d.ts +65 -0
  89. package/lib/src/gis-map/utils/common-utils.js +1 -0
  90. package/lib/src/gis-map/utils/holo-flow/index.d.ts +15 -0
  91. package/lib/src/gis-map/utils/holo-flow/index.js +1 -0
  92. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +40 -0
  93. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -0
  94. package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +69 -0
  95. package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.js +1 -0
  96. package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +18 -0
  97. package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +1 -0
  98. package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +35 -0
  99. package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.js +1 -0
  100. package/lib/src/gis-map/utils/index.d.ts +21 -0
  101. package/lib/src/gis-map/utils/index.js +1 -0
  102. package/lib/src/gis-map/utils/map-initializer.d.ts +50 -0
  103. package/lib/src/gis-map/utils/map-initializer.js +1 -0
  104. package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +9 -0
  105. package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -0
  106. package/lib/src/gis-map/utils/overlay.d.ts +83 -0
  107. package/lib/src/gis-map/utils/overlay.js +1 -0
  108. package/lib/src/gis-map/utils/queue-length.d.ts +14 -0
  109. package/lib/src/gis-map/utils/queue-length.js +1 -0
  110. package/lib/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -0
  111. package/lib/src/gis-map/utils/renderer/greenWaveline.js +43 -0
  112. package/lib/src/gis-map/utils/road-config-tool/cross.d.ts +51 -0
  113. package/lib/src/gis-map/utils/road-config-tool/cross.js +1 -0
  114. package/lib/src/gis-map/utils/road-config-tool/entrance.d.ts +24 -0
  115. package/lib/src/gis-map/utils/road-config-tool/entrance.js +1 -0
  116. package/lib/src/gis-map/utils/road-config-tool/exit.d.ts +18 -0
  117. package/lib/src/gis-map/utils/road-config-tool/exit.js +1 -0
  118. package/lib/src/gis-map/utils/road-config-tool/index.d.ts +44 -0
  119. package/lib/src/gis-map/utils/road-config-tool/index.js +1 -0
  120. package/lib/src/gis-map/utils/road-config-tool/indicator-area.d.ts +22 -0
  121. package/lib/src/gis-map/utils/road-config-tool/indicator-area.js +1 -0
  122. package/lib/src/gis-map/utils/road-config-tool/lane.d.ts +21 -0
  123. package/lib/src/gis-map/utils/road-config-tool/lane.js +1 -0
  124. package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.d.ts +62 -0
  125. package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.js +1 -0
  126. package/lib/src/gis-map/utils/sketchView.d.ts +209 -0
  127. package/lib/src/gis-map/utils/sketchView.js +1 -0
  128. package/lib/src/gis-map/utils/sketchViewTool.d.ts +259 -0
  129. package/lib/src/gis-map/utils/sketchViewTool.js +1 -0
  130. package/lib/src/gis-map/utils/syncMapView.d.ts +43 -0
  131. package/lib/src/gis-map/utils/syncMapView.js +1 -0
  132. package/lib/src/gis-map/utils/traffic-flow.d.ts +66 -0
  133. package/lib/src/gis-map/utils/traffic-flow.js +1 -0
  134. package/lib/src/index.d.ts +1 -0
  135. package/lib/src/index.js +1 -0
  136. package/lib/src/types/index.d.ts +142 -0
  137. package/lib/src/types/index.js +1 -0
  138. package/package.json +41 -0
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@arcgis/core/Graphic"),o=require("@arcgis/core/layers/GraphicsLayer");class d{constructor(r,s){this.defaultPointSymbol={type:"simple-marker",style:"circle",color:"yellow",size:10},this.view=r,this.overlayLayer=new o({...s}),this.view.map.layers.add(this.overlayLayer)}addOverlays(r){let s=0,i=0;for(const e of r.overlays){e.properties?(e.properties.type||(e.properties.type=r.type),e.properties.id||(e.properties.id=e.id)):e.properties={type:r.type,id:e.id};const t=e.symbol||r.defaultSymbol||this.defaultPointSymbol;this.addOverlay(e,t,e.properties,e.visible).message==="add"?s++:i++}return{status:0,message:`新增${s}, 更新${i}`}}removeOverlaysByType(r){const s=this.overlayLayer.graphics.filter(i=>{const e=i.getAttribute("type");return r.includes(e)});return this.overlayLayer.graphics.removeMany(s),{status:0,message:`删除${s.length}`}}removeOverlaysById(r){const s=this.overlayLayer.graphics.filter(i=>{const e=i.getAttribute("id");return r.includes(e)});return this.overlayLayer.graphics.removeMany(s),{status:0,message:`删除${s.length}`}}isShowOverlaysByIds(r,s){this.overlayLayer.graphics.map(i=>{const e=i.getAttribute("id");r.includes(e)?i.visible=s:i.visible=!s})}showAllOverlays(){this.overlayLayer.graphics.forEach(r=>{r.visible=!0})}removeAllOverlays(){const r=this.overlayLayer.graphics.length;return this.overlayLayer.removeAll(),{status:0,message:`删除${r}`}}destroy(){this.view.map.remove(this.overlayLayer),this.overlayLayer.destroy()}removeGraphics(r){Array.isArray(r)||(r=[r]),this.overlayLayer.graphics.removeMany(r)}async findGraphic(r){var e;return(e=(await this.view.hitTest(r)).results)==null?void 0:e.filter(t=>t.type==="graphic"&&t.graphic.layer===this.overlayLayer)}hideLayer(){this.overlayLayer.visible=!1}showLayer(){this.overlayLayer.visible=!0}addPoint(r,s,i,e){let t,a=!0;return r.id&&(t=this.overlayLayer.graphics.find(y=>y.getAttribute("id")===r.id)),t?t.visible=e??t.visible:(e=e??!0,t=new l({visible:e}),this.overlayLayer.add(t),a=!1),t.geometry=r.geometry,t.symbol=s,t.attributes=i,{status:0,message:a?"add":"update"}}addOverlay(r,s,i,e){let t,a=!0;return r.id&&(t=this.overlayLayer.graphics.find(y=>y.getAttribute("id")===r.id)),t?t.visible=e??t.visible:(e=e??!0,t=new l({visible:e}),this.overlayLayer.add(t),a=!1),t.geometry=r.geometry,t.symbol=s,t.attributes=i,{status:0,message:a?"add":"update"}}}exports.default=d;
@@ -0,0 +1,14 @@
1
+ import View from '@arcgis/core/views/View';
2
+ import { IQueueLengthParams } from '../../types';
3
+ export default class QueueLength {
4
+ private view;
5
+ private mapConfig;
6
+ private readonly queueLengthLayer;
7
+ private initialized;
8
+ private lanePolygonMap;
9
+ constructor(view: View);
10
+ private initializeLaneGraphic;
11
+ updateQueueLength(params: IQueueLengthParams[]): Promise<void>;
12
+ removeQueueLength(): void;
13
+ private generateQueuePolygon;
14
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("../stores/index.js"),q=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/helpers"),P=require("@turf/destination"),C=require("@arcgis/core/Graphic"),S=require("@turf/intersect"),w=require("@turf/buffer"),h=require("@turf/area");function O(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const p=O(b);class v{constructor(e){this.initialized=!1,this.lanePolygonMap=new Map,this.view=e;const t=m.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.queueLengthLayer=new q,this.view.map.add(this.queueLengthLayer)}async initializeLaneGraphic(){if(!this.mapConfig.lanePolygonLayer)return;const e=`${this.mapConfig.assetsRoot}/${this.mapConfig.lanePolygonLayer}`,n=await(await fetch(e)).json(),{features:i}=n;i.forEach(s=>{const{properties:o,geometry:a}=s,l=p.polygon(a.coordinates,{code:o.code,laneDirection:o.laneDirection,stopLineCenter:o.stopLineCenter});this.lanePolygonMap.set(o.code,l)}),this.initialized=!0}async updateQueueLength(e){if(this.initialized||await this.initializeLaneGraphic(),this.lanePolygonMap.size!==0)for(const t of e){const n=String(t.laneId),i=`${t.crossNo}+${n[0]}+${n[1]}`,s=this.lanePolygonMap.get(i);if(!s)continue;const o=this.queueLengthLayer.graphics.find(a=>a.getAttribute("code")===i);o&&this.queueLengthLayer.remove(o),t.queueLength!==0&&this.generateQueuePolygon(s,t.queueLength)}}removeQueueLength(){this.queueLengthLayer.removeAll()}generateQueuePolygon(e,t){const n=e.properties.laneDirection,i=JSON.parse(e.properties.stopLineCenter),s=p.point(i),o=n>0?n-180:n+180,a=P(s,t,o,{units:"meters"}),l=p.lineString([i,a.geometry.coordinates]),f=w(l,10,{units:"meters"}),c=S(e,f);if(!c)return;const d=h(c.geometry),y=h(e),g=d/y,u=g>.8?[139,0,0,.6]:g>.6?[255,165,0,.5]:[46,139,87,.5],L=new C({geometry:{type:"polygon",rings:c==null?void 0:c.geometry.coordinates},symbol:{type:"polygon-3d",symbolLayers:[{type:"fill",material:{color:u},outline:{color:[u[0],u[1],u[2]],size:3}}]},attributes:{code:e.properties.code}});this.queueLengthLayer.add(L)}}exports.default=v;
@@ -0,0 +1,2 @@
1
+ declare const greenWavelineView: any;
2
+ export default greenWavelineView;
@@ -0,0 +1,43 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("@arcgis/core/views/2d/layers/BaseLayerViewGL2D"),o=require("gl-matrix"),R=require("@arcgis/core/layers/GraphicsLayer"),T=require("@arcgis/core/core/reactiveUtils");function U(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(a,s,l.get?l:{enumerable:!0,get:()=>t[s]})}}return a.default=t,Object.freeze(a)}const B=U(T),V=E.createSubclass({aPosition:0,aOffset:1,aDistance:2,aSide:3,aColor:4,constructor:function(){this.transform=o.mat3.create(),this.extrude=o.mat3.create(),this.translationToCenter=o.vec2.create(),this.screenTranslation=o.vec2.create(),this.display=o.mat3.fromValues(NaN,0,0,0,NaN,0,-1,1,1),this.screenScaling=o.vec3.fromValues(NaN,NaN,1),this.needsUpdate=!1},attach:function(){const t=this.context,a=()=>{this.needsUpdate=!0,this.requestRender()};this.watcher=B.on(()=>this.layer.graphics,"change",a);const s=`
2
+ precision highp float;
3
+
4
+ uniform mat3 u_transform;
5
+ uniform mat3 u_extrude;
6
+ uniform mat3 u_display;
7
+
8
+ attribute vec2 a_position;
9
+ attribute vec2 a_offset;
10
+ attribute float a_distance;
11
+ attribute float a_side;
12
+ attribute vec4 a_color;
13
+
14
+ varying float v_distance;
15
+ varying float v_side;
16
+ varying vec4 v_color;
17
+
18
+ void main(void) {
19
+ gl_Position.xy = (u_display * (u_transform * vec3(a_position, 1.0) + u_extrude * vec3(a_offset, 0.0))).xy;
20
+ gl_Position.zw = vec2(0.0, 1.0);
21
+ v_distance = a_distance;
22
+ v_side = a_side;
23
+ v_color = a_color;
24
+ }`,l=`
25
+ precision highp float;
26
+
27
+ uniform float u_current_time;
28
+
29
+ varying float v_distance;
30
+ varying float v_side;
31
+ varying vec4 v_color;
32
+
33
+ const float TRAIL_SPEED = 90.0;
34
+ const float TRAIL_LENGTH = 300.0;
35
+ const float TRAIL_CYCLE = 1000.0;
36
+
37
+ void main(void) {
38
+ float d = mod(v_distance - u_current_time * TRAIL_SPEED, TRAIL_CYCLE);
39
+ float a1 = d < TRAIL_LENGTH ? mix(0.0, 1.0, d / TRAIL_LENGTH) : 0.0;
40
+ float a2 = exp(-abs(v_side) * 3.0);
41
+ float a = a1 * a2;
42
+ gl_FragColor = v_color * a;
43
+ }`,u=t.createShader(t.VERTEX_SHADER);t.shaderSource(u,s),t.compileShader(u);const m=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(m,l),t.compileShader(m),this.program=t.createProgram(),t.attachShader(this.program,u),t.attachShader(this.program,m),t.bindAttribLocation(this.program,this.aPosition,"a_position"),t.bindAttribLocation(this.program,this.aOffset,"a_offset"),t.bindAttribLocation(this.program,this.aDistance,"a_distance"),t.bindAttribLocation(this.program,this.aSide,"a_side"),t.bindAttribLocation(this.program,this.aColor,"a_color"),t.linkProgram(this.program),t.deleteShader(u),t.deleteShader(m),this.uTransform=t.getUniformLocation(this.program,"u_transform"),this.uExtrude=t.getUniformLocation(this.program,"u_extrude"),this.uDisplay=t.getUniformLocation(this.program,"u_display"),this.uCurrentTime=t.getUniformLocation(this.program,"u_current_time"),this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.indexBufferSize=0,t.getParameter(t.VERSION).startsWith("WebGL 2.0"))this.vao=t.createVertexArray(),this.bindVertexArray=d=>t.bindVertexArray(d),this.deleteVertexArray=d=>t.deleteVertexArray(d);else{const d=t.getExtension("OES_vertex_array_object");this.vao=d.createVertexArrayOES(),this.bindVertexArray=A=>d.bindVertexArrayOES(A),this.deleteVertexArray=A=>d.deleteVertexArrayOES(A)}this.bindVertexArray(this.vao),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.enableVertexAttribArray(this.aPosition),t.enableVertexAttribArray(this.aOffset),t.enableVertexAttribArray(this.aDistance),t.enableVertexAttribArray(this.aSide),t.enableVertexAttribArray(this.aColor),t.vertexAttribPointer(this.aPosition,2,t.FLOAT,!1,28,0),t.vertexAttribPointer(this.aOffset,2,t.FLOAT,!1,28,8),t.vertexAttribPointer(this.aDistance,1,t.FLOAT,!1,28,16),t.vertexAttribPointer(this.aSide,1,t.FLOAT,!1,28,20),t.vertexAttribPointer(this.aColor,4,t.UNSIGNED_BYTE,!0,28,24),this.bindVertexArray(null),this.centerAtLastUpdate=o.vec2.fromValues(this.view.state.center[0],this.view.state.center[1])},detach:function(){this.watcher.remove();const t=this.context;t.deleteBuffer(this.vertexBuffer),t.deleteBuffer(this.indexBuffer),this.deleteVertexArray(this.vao),t.deleteProgram(this.program)},render:function(t){const a=t.context,s=t.state;if(this.updatePositions(t),this.indexBufferSize===0)return;o.mat3.identity(this.transform),this.screenTranslation[0]=s.pixelRatio*s.size[0]/2,this.screenTranslation[1]=s.pixelRatio*s.size[1]/2,o.mat3.translate(this.transform,this.transform,this.screenTranslation),o.mat3.rotate(this.transform,this.transform,Math.PI*s.rotation/180),this.screenScaling[0]=s.pixelRatio/s.resolution,this.screenScaling[1]=-s.pixelRatio/s.resolution,o.mat3.scale(this.transform,this.transform,this.screenScaling),o.mat3.translate(this.transform,this.transform,this.translationToCenter),o.mat3.identity(this.extrude),o.mat3.rotate(this.extrude,this.extrude,Math.PI*s.rotation/180);const l=8;o.mat3.scale(this.extrude,this.extrude,[l,-l,1]),this.display[0]=2/(s.pixelRatio*s.size[0]),this.display[4]=-2/(s.pixelRatio*s.size[1]),a.useProgram(this.program),a.uniformMatrix3fv(this.uTransform,!1,this.transform),a.uniformMatrix3fv(this.uExtrude,!1,this.extrude),a.uniformMatrix3fv(this.uDisplay,!1,this.display),a.uniform1f(this.uCurrentTime,performance.now()/1e3),this.bindVertexArray(this.vao),a.enable(a.BLEND),a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.drawElements(a.TRIANGLES,this.indexBufferSize,a.UNSIGNED_SHORT,0),this.requestRender()},updatePositions:function(t){const a=t.context,s=t.stationary,l=t.state;if(!s){o.vec2.sub(this.translationToCenter,this.centerAtLastUpdate,l.center),this.requestRender();return}if(!this.needsUpdate&&this.translationToCenter[0]===0&&this.translationToCenter[1]===0)return;this.centerAtLastUpdate.set(l.center),this.translationToCenter[0]=0,this.translationToCenter[1]=0,this.needsUpdate=!1;const u=this.layer.graphics;let m=0,d=0;for(let p=0;p<u.items.length;++p){const _=u.items[p].geometry.paths[0];m+=_.length*2,d+=(_.length-1)*6}const A=new ArrayBuffer(7*m*4),i=new Float32Array(A),n=new Uint8Array(A),c=new Uint16Array(d);let r=0,f=0;for(let p=0;p<u.items.length;++p){const v=u.items[p],_=v.geometry.paths[0],h=v.attributes.color,e={};for(let g=0;g<_.length;++g){const b=_[g];if(e.current){e.delta=[b[0]-e.current[0],b[1]-e.current[1]];const y=Math.sqrt(e.delta[0]*e.delta[0]+e.delta[1]*e.delta[1]);e.direction=[e.delta[0]/y,e.delta[1]/y];const x=[-e.direction[1],e.direction[0]];if(e.normal){e.offset=[e.normal[0]+x[0],e.normal[1]+x[1]];const L=Math.sqrt(e.offset[0]*e.offset[0]+e.offset[1]*e.offset[1]);e.offset[0]/=L,e.offset[1]/=L;const S=e.normal[0]*e.offset[0]+e.normal[1]*e.offset[1];e.offset[0]/=S,e.offset[1]/=S}else e.offset=[x[0],x[1]];i[r*7+0]=e.current[0]-this.centerAtLastUpdate[0],i[r*7+1]=e.current[1]-this.centerAtLastUpdate[1],i[r*7+2]=e.offset[0],i[r*7+3]=e.offset[1],i[r*7+4]=e.distance,i[r*7+5]=1,n[4*(r*7+6)+0]=h[0],n[4*(r*7+6)+1]=h[1],n[4*(r*7+6)+2]=h[2],n[4*(r*7+6)+3]=255,i[r*7+7]=e.current[0]-this.centerAtLastUpdate[0],i[r*7+8]=e.current[1]-this.centerAtLastUpdate[1],i[r*7+9]=-e.offset[0],i[r*7+10]=-e.offset[1],i[r*7+11]=e.distance,i[r*7+12]=-1,n[4*(r*7+13)+0]=h[0],n[4*(r*7+13)+1]=h[1],n[4*(r*7+13)+2]=h[2],n[4*(r*7+13)+3]=255,r+=2,g>=2&&(c[f+0]=r-4,c[f+1]=r-3,c[f+2]=r-2,c[f+3]=r-3,c[f+4]=r-1,c[f+5]=r-2,f+=6),e.normal=x,e.distance+=y}else e.distance=0;e.current=b}e.offset=[e.normal[0],e.normal[1]],i[r*7+0]=e.current[0]-this.centerAtLastUpdate[0],i[r*7+1]=e.current[1]-this.centerAtLastUpdate[1],i[r*7+2]=e.offset[0],i[r*7+3]=e.offset[1],i[r*7+4]=e.distance,i[r*7+5]=1,n[4*(r*7+6)+0]=h[0],n[4*(r*7+6)+1]=h[1],n[4*(r*7+6)+2]=h[2],n[4*(r*7+6)+3]=255,i[r*7+7]=e.current[0]-this.centerAtLastUpdate[0],i[r*7+8]=e.current[1]-this.centerAtLastUpdate[1],i[r*7+9]=-e.offset[0],i[r*7+10]=-e.offset[1],i[r*7+11]=e.distance,i[r*7+12]=-1,n[4*(r*7+13)+0]=h[0],n[4*(r*7+13)+1]=h[1],n[4*(r*7+13)+2]=h[2],n[4*(r*7+13)+3]=255,r+=2,c[f+0]=r-4,c[f+1]=r-3,c[f+2]=r-2,c[f+3]=r-3,c[f+4]=r-1,c[f+5]=r-2,f+=6,e.current=null}a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,A,a.STATIC_DRAW),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,c,a.STATIC_DRAW),this.indexBufferSize=c.length}}),C=R.createSubclass({createLayerView:function(t){if(t.type==="2d")return new V({view:t,layer:this})}});exports.default=C;
@@ -0,0 +1,51 @@
1
+ import Graphic from '@arcgis/core/Graphic';
2
+ import { Polygon } from '@arcgis/core/geometry';
3
+ export default class Cross {
4
+ /** 路口id */
5
+ private id;
6
+ /** 路口中心点 */
7
+ private crossCenter;
8
+ /** 按道路存放的路口周边车道、停止线 */
9
+ private nearbyFeatures;
10
+ /** 此路口的所有进口道 */
11
+ private entrances;
12
+ /** 此路口的所有出口道 */
13
+ private exits;
14
+ initialized: boolean;
15
+ constructor(params: {
16
+ id: string;
17
+ center: number[];
18
+ });
19
+ /**
20
+ * 初始化路口,设置周边车道与停止线
21
+ * @param params
22
+ */
23
+ initialize(params: {
24
+ lanes: Graphic[];
25
+ stopLines: Graphic[];
26
+ }): Promise<void>;
27
+ /**
28
+ * 标注车道序号的信息,进口道序号+车道序号
29
+ * @returns
30
+ */
31
+ getLaneNumberInfo(): {
32
+ crossId: string;
33
+ laneNumber: string;
34
+ stopLineCenter: number[];
35
+ laneDirection: number;
36
+ }[];
37
+ /**
38
+ * 计算路口指标计算区域。
39
+ * 由相邻进口道的停止线延长线交点围成的区域
40
+ */
41
+ calCrossIndicatorArea(): Promise<Polygon | undefined>;
42
+ /**
43
+ * 创建进口道与出口道,并得到道口的车道与车道停止线
44
+ */
45
+ private createEntranceAndExit;
46
+ /**
47
+ * 进口道排序
48
+ */
49
+ private orderEntrance;
50
+ private findExitOfEntrance;
51
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@arcgis/core/geometry"),d=require("../common-utils.js"),u=require("./entrance.js"),f=require("./exit.js");class g{constructor(n){this.nearbyFeatures=new Map,this.entrances=[],this.exits=[],this.initialized=!1,this.id=n.id,this.crossCenter=new a.Point({x:n.center[0],y:n.center[1]})}async initialize(n){n.lanes.forEach(e=>{const t=e.getAttribute("RoadSecID"),s=e.geometry,i=this.nearbyFeatures.get(t);i?i.lanes.push(s):this.nearbyFeatures.set(t,{lanes:[s],stopLines:[]})}),n.stopLines.forEach(e=>{const t=e.getAttribute("RoadSecID"),s=e.geometry,i=this.nearbyFeatures.get(t);i?i.stopLines.push(s):this.nearbyFeatures.set(t,{lanes:[],stopLines:[s]})}),await this.createEntranceAndExit(),console.log(`${this.id} has ${this.entrances.length} entrance`),this.entrances.forEach(e=>{console.log(`${e.id} has ${e.lanes.length} lanes`)}),this.orderEntrance(),this.initialized=!0}getLaneNumberInfo(){const n=[];return this.entrances.forEach(e=>{e.lanes.forEach((t,s)=>{n.push({crossId:this.id,laneNumber:e.id+String(s+1),stopLineCenter:[t.stopLineCenter.x,t.stopLineCenter.y],laneDirection:t.laneDirection-180})})}),this.exits.forEach(e=>{e.lanes.forEach((t,s)=>{n.push({crossId:this.id,laneNumber:"-"+e.id+String(s+1),stopLineCenter:[t.stopLineCenter.x,t.stopLineCenter.y],laneDirection:t.laneDirection-180})})}),n}async calCrossIndicatorArea(){const n=[];for(let e=0;e<this.entrances.length;e++){const t=this.entrances[e],s=this.entrances[(e+1)%this.entrances.length],i=t.furthestLane.extendedStopLine,c=s.furthestLane.extendedStopLine,o=await d.default.getIntersectPointOfTwoLines(i,c);if(o)n.push(o);else{const r=this.findExitOfEntrance(t),h=(r?r.lanes[r.lanes.length-1]:t.lanes[t.lanes.length-1]).stopLine.getPoint(0,1);n.push(h);const l=s.lanes[s.lanes.length-1].stopLine.getPoint(0,1);n.push(l)}}if(n.length>2)return new a.Polygon({rings:[n.map(e=>[e.x,e.y])]})}async createEntranceAndExit(){for(const n of this.nearbyFeatures){const e=n[0],t=n[1];if(t.stopLines.length===0){const s=new f.default(e);s.addLanes(t),this.exits.push(s)}else{const s=new u.default(e);await s.addLanes(t),this.entrances.push(s)}}for(const n of this.exits)await n.findCorrespondingEntrance(this.entrances)}orderEntrance(){this.entrances.sort((n,e)=>{let t=n.dir,s=e.dir;return t<225&&(t+=360),s<225&&(s+=360),t-s}),this.entrances.forEach((n,e)=>{n.id=String(e+1);const t=this.findExitOfEntrance(n);t&&(t.id=String(e+1))})}findExitOfEntrance(n){for(const e of this.exits)if(e.entrance===n)return e}}exports.default=g;
@@ -0,0 +1,24 @@
1
+ import { QuadrantCode } from '../../../types';
2
+ import Lane from './lane';
3
+ import { Polygon, Polyline } from '@arcgis/core/geometry';
4
+ export default class Entrance {
5
+ id: string;
6
+ lanes: Lane[];
7
+ /** 进口道方向 */
8
+ dir: number;
9
+ /** 进口道所在象限 */
10
+ quadrantCode: QuadrantCode;
11
+ /** 停止线里路口最远的车道 */
12
+ furthestLane: Lane;
13
+ constructor(id: string);
14
+ addLanes(road: {
15
+ lanes: Polygon[];
16
+ stopLines: Polyline[];
17
+ }): Promise<void>;
18
+ /**
19
+ * 新增车道,并按道路中线至边线的方向排序
20
+ * @param lane
21
+ * @returns
22
+ */
23
+ private addLane;
24
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("../../../types/index.js"),a=require("../common-utils.js"),h=require("./lane.js"),d=require("@arcgis/core/geometry");class u{constructor(e){this.lanes=[],this.id=e}async addLanes(e){for(const i of e.lanes)for(const s of e.stopLines){const t=await a.default.getIntersectPointsOfStopLineAndLane(s,i,[.5,-.5]);if(t.length===0)continue;const n=new d.Polyline({paths:[t]}),o=new h.default;o.lanePolygon=i,o.stopLine=n,o.isEntry=!0,await o.getLaneDirection(),this.addLane(o);break}}addLane(e){this.furthestLane||(this.furthestLane=e),this.dir||(this.dir=e.laneDirection,this.dir<45||this.dir>315?this.quadrantCode=r.QuadrantCode.North:this.dir<135?this.quadrantCode=r.QuadrantCode.East:this.dir<225?this.quadrantCode=r.QuadrantCode.South:this.quadrantCode=r.QuadrantCode.West);const i=e.stopLine,s=i.paths[0];switch(this.quadrantCode){case r.QuadrantCode.West:e.stopLineCenter.x<this.furthestLane.stopLineCenter.x&&(this.furthestLane=e),s[0][1]<s[1][1]&&(i.paths=[s.reverse()]);for(let t=0;t<this.lanes.length;t++){const n=this.lanes[t];if(e.stopLineCenter.y>n.stopLineCenter.y){this.lanes.splice(t,0,e);return}}break;case r.QuadrantCode.North:e.stopLineCenter.y>this.furthestLane.stopLineCenter.y&&(this.furthestLane=e),s[0][0]<s[1][0]&&(i.paths=[s.reverse()]);for(let t=0;t<this.lanes.length;t++){const n=this.lanes[t];if(e.stopLineCenter.x>n.stopLineCenter.x){this.lanes.splice(t,0,e);return}}break;case r.QuadrantCode.East:e.stopLineCenter.x>this.furthestLane.stopLineCenter.x&&(this.furthestLane=e),s[0][1]>s[1][1]&&(i.paths=[s.reverse()]);for(let t=0;t<this.lanes.length;t++){const n=this.lanes[t];if(e.stopLineCenter.y<n.stopLineCenter.y){this.lanes.splice(t,0,e);return}}break;case r.QuadrantCode.South:e.stopLineCenter.y<this.furthestLane.stopLineCenter.y&&(this.furthestLane=e),s[0][0]>s[1][0]&&(i.paths=[s.reverse()]);for(let t=0;t<this.lanes.length;t++){const n=this.lanes[t];if(e.stopLineCenter.x<n.stopLineCenter.x){this.lanes.splice(t,0,e);return}}break}this.lanes.push(e)}}exports.default=u;
@@ -0,0 +1,18 @@
1
+ import Entrance from './entrance';
2
+ import Lane from './lane';
3
+ import { Polygon } from '@arcgis/core/geometry';
4
+ export default class Exit {
5
+ lanes: Lane[];
6
+ id: string;
7
+ entrance: Entrance;
8
+ constructor(id: string);
9
+ /**
10
+ * 寻找对应的进口道
11
+ * @param entrances
12
+ */
13
+ findCorrespondingEntrance(entrances: Entrance[]): Promise<void>;
14
+ addLanes(road: {
15
+ lanes: Polygon[];
16
+ }): void;
17
+ private splitStopLine;
18
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../common-utils.js"),h=require("./lane.js"),p=require("@arcgis/core/geometry"),g=require("@arcgis/core/geometry/geometryEngineAsync"),s=require("../../../types/index.js");function L(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const x=L(g);class C{constructor(t){this.lanes=[],this.id=t}async findCorrespondingEntrance(t){var c;const e=this.lanes[0],n=e.lanePolygon.centroid;let o,i=1/0,r;for(const l of t){o=l.lanes[0].lanePolygon.centroid;const y=new p.Polyline({paths:[[[o.x,o.y],[n.x,n.y]]]}),d=await x.geodesicLength(y,"meters");d<i&&(i=d,r=l)}const f=r.furthestLane.extendedStopLine;(await u.default.getIntersectPointsOfStopLineAndLane(f,e.lanePolygon,[5])).length&&(this.entrance=r,await this.splitStopLine(),console.log(`${this.id}的对应进口道是${(c=this.entrance)==null?void 0:c.id}`))}addLanes(t){for(const e of t.lanes){const n=new h.default;n.lanePolygon=e,n.isEntry=!1,this.lanes.push(n)}}async splitStopLine(){if(this.entrance){for(const t of this.lanes){const e=await u.default.getIntersectPointsOfStopLineAndLane(this.entrance.furthestLane.extendedStopLine,t.lanePolygon,[.5,1,2,3,4,5,6,7,8]);if(e.length!==0){switch(this.entrance.quadrantCode){case s.QuadrantCode.West:e.sort((n,o)=>n[1]-o[1]);break;case s.QuadrantCode.North:e.sort((n,o)=>n[0]-o[0]);break;case s.QuadrantCode.East:e.sort((n,o)=>o[1]-n[1]);break;case s.QuadrantCode.South:e.sort((n,o)=>o[0]-n[0]);break}t.stopLine=new p.Polyline({paths:[e]}),await t.getLaneDirection()}}this.lanes.sort((t,e)=>{switch(this.entrance.quadrantCode){case s.QuadrantCode.West:return t.stopLine.extent.center.y-e.stopLine.extent.center.y;case s.QuadrantCode.North:return t.stopLine.extent.center.x-e.stopLine.extent.center.x;case s.QuadrantCode.East:return e.stopLine.extent.center.y-t.stopLine.extent.center.y;case s.QuadrantCode.South:return e.stopLine.extent.center.x-t.stopLine.extent.center.x}})}}}exports.default=C;
@@ -0,0 +1,44 @@
1
+ import MapView from '@arcgis/core/views/MapView';
2
+ import SceneView from '@arcgis/core/views/SceneView';
3
+ import { IResult, ILaneNumberParams as IShowLaneNumberParams, IStartCrossBufferParam } from '../../../types';
4
+ export default class RoadConfigTool {
5
+ private view;
6
+ /** 显示车道序号的图层 */
7
+ private laneNumberLayer;
8
+ /** 路口指标计算区图层 */
9
+ private crossIndicatorAreaLayer;
10
+ /** 路口周边搜索工具 */
11
+ private searchLaneTool;
12
+ private indicatorAreaTool;
13
+ /** 当前正在处理的路口 */
14
+ private cross;
15
+ /**
16
+ * 道路配置工具相关功能
17
+ * @param map map实例
18
+ * @param mapConfig 地图配置
19
+ */
20
+ constructor(view: MapView | SceneView);
21
+ /**
22
+ * 在进口道的顶端显示车道序号
23
+ * @param params
24
+ * @returns
25
+ */
26
+ showLaneNumber(params: IShowLaneNumberParams): IResult;
27
+ /** 清除车道序号 */
28
+ clearLaneNumber(): void;
29
+ /**
30
+ * 初始化算法区域生成工具
31
+ * @param params
32
+ * @returns Promise<IResult>
33
+ */
34
+ initializeSearch(params: IStartCrossBufferParam): Promise<IResult>;
35
+ /**
36
+ * 生成路口指标计算区
37
+ */
38
+ calCrossIndicatorArea(): Promise<void>;
39
+ /**
40
+ * 路口初始化,计算周边进口道与车道
41
+ * @returns
42
+ */
43
+ private initializeCross;
44
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@arcgis/core/Graphic"),w=require("@arcgis/core/geometry"),h=require("@arcgis/core/layers/GraphicsLayer"),u=require("@arcgis/core/symbols"),L=require("../common-utils.js"),f=require("./cross.js"),g=require("./search-nearby-lanes.js"),A=require("./indicator-area.js");class N{constructor(e){this.view=e,this.laneNumberLayer=new h({minScale:2257}),this.view.map.add(this.laneNumberLayer),this.crossIndicatorAreaLayer=new h,this.view.map.add(this.crossIndicatorAreaLayer)}showLaneNumber(e){const{lanes:i}=e,a=[],o=[];for(const d of i){const{crossId:n,laneNumber:s,stopLineCenter:t,laneDirection:c}=d;if(!t[0]||!t[1])continue;let r=new w.Point({longitude:t[0],latitude:t[1]});c&&(r=L.default.destinationWithPoint(r,c,-3));const m={type:"laneNumber",id:`${n}_${s}`,crossId:n,laneNumber:s},b=new l({geometry:r,symbol:new u.TextSymbol({text:s,color:"red",verticalAlignment:"middle",font:{size:10}})});o.push(b);const y=new l({geometry:r,symbol:new u.SimpleMarkerSymbol({style:"circle",color:[255,255,255,.8],size:14,outline:{color:"white",width:1}}),attributes:m});a.push(y)}return this.laneNumberLayer.addMany(a),this.laneNumberLayer.addMany(o),{status:0,message:"车道序号显示成功"}}clearLaneNumber(){this.laneNumberLayer.removeAll()}async initializeSearch(e){var i;return this.searchLaneTool||(this.searchLaneTool=new g.default(this.view)),this.cross=new f.default({id:e.crossId,center:e.crossCenter}),(i=this.indicatorAreaTool)==null||i.clearIndicatorArea(),this.searchLaneTool.initializeSearch(e)}async calCrossIndicatorArea(){this.cross.initialized||await this.initializeCross(),this.indicatorAreaTool||(this.indicatorAreaTool=new A.default(this.view)),await this.indicatorAreaTool.showCrossIndicatorArea(this.cross)}async initializeCross(){if(!this.searchLaneTool)return{status:-1,message:"算法区域生成工具未初始化, 请先执行initializeSearch"};const e=await this.searchLaneTool.getCurrentSearchResult();this.searchLaneTool.clearResult(),await this.cross.initialize(e);const i=this.cross.getLaneNumberInfo();this.showLaneNumber({lanes:i})}}exports.default=N;
@@ -0,0 +1,22 @@
1
+ import MapView from '@arcgis/core/views/MapView';
2
+ import SceneView from '@arcgis/core/views/SceneView';
3
+ import Cross from './cross';
4
+ export default class IndicatorArea {
5
+ private view;
6
+ /** 路口指标计算区图层 */
7
+ private indicatorAreaLayer;
8
+ /** 路口指标计算区Graphic */
9
+ private crossIndicatorAreaGraphic?;
10
+ /** 移动graphic的工具类 */
11
+ private sketchViewModel;
12
+ constructor(view: MapView | SceneView);
13
+ /**
14
+ * 显示路口指标计算区
15
+ * @param cross
16
+ */
17
+ showCrossIndicatorArea(cross: Cross): Promise<void>;
18
+ /**
19
+ * 清除所有指标计算区
20
+ */
21
+ clearIndicatorArea(): void;
22
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("@arcgis/core/layers/GraphicsLayer"),a=require("@arcgis/core/Graphic"),t=require("@arcgis/core/symbols"),o=require("@arcgis/core/widgets/Sketch/SketchViewModel");class s{constructor(e){this.view=e,this.indicatorAreaLayer=new i,this.view.map.add(this.indicatorAreaLayer),this.sketchViewModel=new o({view:this.view,layer:this.indicatorAreaLayer,defaultUpdateOptions:{tool:"reshape"},snappingOptions:{enabled:!0}})}async showCrossIndicatorArea(e){this.indicatorAreaLayer.removeAll();const r=await e.calCrossIndicatorArea();r?(this.crossIndicatorAreaGraphic=new a({geometry:r,symbol:new t.SimpleFillSymbol({color:[255,0,0,.5],outline:{color:[255,0,0]}})}),this.indicatorAreaLayer.add(this.crossIndicatorAreaGraphic)):this.sketchViewModel.create("polygon")}clearIndicatorArea(){this.indicatorAreaLayer.removeAll()}}exports.default=s;
@@ -0,0 +1,21 @@
1
+ import { Point, Polygon, Polyline } from '@arcgis/core/geometry';
2
+ export default class Lane {
3
+ /** 停止线 */
4
+ private _stopLine;
5
+ /** 停止线中点 */
6
+ stopLineCenter: Point;
7
+ set stopLine(line: Polyline);
8
+ get stopLine(): Polyline;
9
+ private _extendedStopLine;
10
+ /** 停止线延长线,用于计算和其他进口道停止线的交点 */
11
+ get extendedStopLine(): __esri.Polyline;
12
+ /** 行车方向 */
13
+ laneDirection: number;
14
+ /** 车道轮廓 */
15
+ lanePolygon: Polygon;
16
+ /** 车道id(路口号_进口道号_车道序号(>0为进口道, <0为出口道)) */
17
+ code: string;
18
+ /** 是否为进口道 */
19
+ isEntry: boolean;
20
+ getLaneDirection(): Promise<void>;
21
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@turf/bearing"),n=require("../common-utils.js");class d{set stopLine(e){this._stopLine=e,this.stopLineCenter=e.extent.center}get stopLine(){return this._stopLine}get extendedStopLine(){return this._extendedStopLine||(this._extendedStopLine=n.default.extendLineInTowDir(this._stopLine,100)),this._extendedStopLine}async getLaneDirection(){const e=n.default.extendLineInTowDir(this._stopLine,10),i=this._stopLine.paths[0];let t=await n.default.getIntersectPointOfLineAndPolygon(e,this.lanePolygon,5);t.length===0&&(t=await n.default.getIntersectPointOfLineAndPolygon(e,this.lanePolygon,-5)),(!i.length||!t.length)&&console.log("计算方位角失败",i,t);const s=t[0],r=i[0],o=l(r,s);this.laneDirection=o<0?o+360:o}}exports.default=d;
@@ -0,0 +1,62 @@
1
+ import Graphic from '@arcgis/core/Graphic';
2
+ import MapView from '@arcgis/core/views/MapView';
3
+ import SceneView from '@arcgis/core/views/SceneView';
4
+ import { IResult, IStartCrossBufferParam } from '../../../types';
5
+ export default class SearchNearbyLanes {
6
+ private view;
7
+ /** 显示圆心和边缘点的图层,可响应拖拽事件 */
8
+ private pointLayer;
9
+ /** 显示缓冲结果的图层 */
10
+ private bufferAreaLayer;
11
+ /** 车道图层 */
12
+ private laneLayer;
13
+ /** 停止线图层 */
14
+ private stopLineLayer;
15
+ /** 移动graphic的工具类 */
16
+ private sketchViewModel;
17
+ /** 显示圆心点的graphic */
18
+ private centerGraphic;
19
+ /** 显示边缘点的graphic */
20
+ private edgeGraphic;
21
+ /** 显示缓冲圆形的graphic */
22
+ private bufferGraphic;
23
+ /** 显示圆心与边缘点连线的graphic */
24
+ private radiusLineGraphic;
25
+ /** 鼠标开始拖动边缘点时,圆心点的位置 */
26
+ private centerGeometryAtStart;
27
+ /** 地理计算单位,统一为米 */
28
+ private readonly geometryUnit;
29
+ constructor(view: MapView | SceneView);
30
+ /**
31
+ * 搜索路口中心点周边车道
32
+ * @param params
33
+ * @returns Promise<IResult>
34
+ */
35
+ initializeSearch(params: IStartCrossBufferParam): Promise<IResult>;
36
+ /**
37
+ * 获取当前缓冲区的搜索结果
38
+ */
39
+ getCurrentSearchResult(): Promise<{
40
+ lanes: Graphic[];
41
+ stopLines: Graphic[];
42
+ }>;
43
+ /**
44
+ * 清除地图上显示的搜索结果
45
+ */
46
+ clearResult(): void;
47
+ /**
48
+ * 计算缓冲区
49
+ * 移动边缘点或圆心点后调用
50
+ * @param vertices 圆心点与边缘点的坐标
51
+ */
52
+ private calculateBuffer;
53
+ /**
54
+ * 载入车道和停止线图层
55
+ */
56
+ private loadLaneAndStopLineLayer;
57
+ /**
58
+ * 更新车道与停止线图层的filter,高亮缓冲区内部的要素
59
+ * @param buffer
60
+ */
61
+ private updateLayerFilter;
62
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/Graphic"),w=require("@arcgis/core/core/promiseUtils"),f=require("@arcgis/core/geometry"),S=require("@arcgis/core/geometry/SpatialReference"),G=require("@arcgis/core/geometry/geometryEngineAsync"),d=require("@arcgis/core/layers/FeatureLayer"),m=require("@arcgis/core/layers/GraphicsLayer"),R=require("@arcgis/core/layers/support/FeatureEffect"),v=require("@arcgis/core/layers/support/FeatureFilter"),g=require("@arcgis/core/renderers/SimpleRenderer"),q=require("@arcgis/core/rest/support/Query"),y=require("@arcgis/core/symbols"),F=require("@arcgis/core/widgets/Sketch/SketchViewModel"),P=require("../../stores/index.js"),A=require("../common-utils.js");function b(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const L=b(w),p=b(G);class M{constructor(e){this.geometryUnit="meters",this.view=e,this.pointLayer=new m,this.bufferAreaLayer=new m({blendMode:"color-burn"}),this.view.map.layers.addMany([this.bufferAreaLayer,this.pointLayer]);const t=L.debounce(async r=>{const i=await this.calculateBuffer(r);this.updateLayerFilter(i)});this.sketchViewModel=new F({view:e,layer:this.pointLayer}),this.sketchViewModel.on("update",r=>{var l,o;((o=(l=r.toolEventInfo)==null?void 0:l.mover)==null?void 0:o.attributes.type)==="edge"&&(r.toolEventInfo.type==="move-start"?this.centerGeometryAtStart=this.centerGraphic.geometry:this.centerGraphic.geometry=this.centerGeometryAtStart);const i=this.centerGraphic.geometry,a=this.edgeGraphic.geometry,c=[[i.x,i.y],[a.x,a.y]];t(c).catch(h=>{if(!L.isAbortError(h))throw h})})}async initializeSearch(e){if(this.laneLayer)this.laneLayer.visible=!0,this.stopLineLayer.visible=!0;else{const o=await this.loadLaneAndStopLineLayer();if(o.status!==0)return o}const{crossId:t,crossCenter:r}=e,i=new f.Point({longitude:r[0],latitude:r[1]});this.view.goTo({target:i,zoom:18},{duration:2e3}),this.centerGraphic=new u({geometry:i,symbol:new y.SimpleMarkerSymbol({style:"circle",color:[0,255,255,.5],size:10}),attributes:{crossId:t,type:"center"}});const a=A.default.destinationWithPoint(i,90,e.bufferRadius||70);this.edgeGraphic=new u({geometry:a,symbol:new y.SimpleMarkerSymbol({style:"circle",color:[0,255,255,.5],size:10}),attributes:{crossId:t,type:"edge"}});const c=new f.Polyline({paths:[[[i.x,i.y],[a.x,a.y]]]});this.radiusLineGraphic=new u({geometry:c,symbol:new y.SimpleLineSymbol({color:[0,255,255],width:2})}),this.pointLayer.addMany([this.centerGraphic,this.edgeGraphic,this.radiusLineGraphic]);const l=await p.geodesicBuffer(i,e.bufferRadius||70,this.geometryUnit);return this.bufferGraphic=new u({geometry:l,symbol:new y.SimpleFillSymbol({color:[150,150,150],outline:{color:"#FFEB00",width:"3px"}})}),this.bufferAreaLayer.add(this.bufferGraphic),this.sketchViewModel.update([this.edgeGraphic,this.centerGraphic],{tool:"move"}),{status:0,message:"初始化成功"}}async getCurrentSearchResult(){const e=new q;e.relationParameter="intersects",e.geometry=this.bufferGraphic.geometry,e.returnGeometry=!0,e.outSpatialReference=new S({wkid:4326}),e.outFields=["*"];const t=(await this.laneLayer.queryFeatures(e)).features,r=(await this.stopLineLayer.queryFeatures(e)).features;return{lanes:t,stopLines:r}}clearResult(){this.sketchViewModel.complete(),this.pointLayer.removeAll(),this.bufferAreaLayer.removeAll(),this.laneLayer.visible=!1,this.stopLineLayer.visible=!1}async calculateBuffer(e){this.radiusLineGraphic.geometry=new f.Polyline({paths:[e],spatialReference:this.view.spatialReference});const t=await p.geodesicLength(this.radiusLineGraphic.geometry,this.geometryUnit),r=await p.geodesicBuffer(this.centerGraphic.geometry,t,this.geometryUnit);return this.bufferGraphic.geometry=r,r}async loadLaneAndStopLineLayer(){var o,h;const e=P.default.useAppDataStore,t=JSON.parse(JSON.stringify(e.mapConfig));if(!((o=t.roadConfigTool)!=null&&o.initLanePolygonLayer))return{status:-1,message:"roadConfigTool.initLanePolygonLayer未配置"};if(!((h=t.roadConfigTool)!=null&&h.initStopLineLayer))return{status:-1,message:"roadConfigTool.initStopLineLayer"};const r=`${t.assetsRoot}${t.roadConfigTool.initLanePolygonLayer}`;let i;try{i=await(await fetch(r)).json()}catch(s){return{status:-2,message:`${r}读取失败`,result:s.message}}const a=i.features.filter(s=>s.attributes.RoadSecID!=="").map(s=>u.fromJSON(s));this.laneLayer=new d({objectIdField:"FID",spatialReference:i.spatialReference,geometryType:"polygon",source:a,fields:[{name:"RoadSecID",alias:"RoadSecID",type:"string"}],renderer:new g({symbol:new y.SimpleFillSymbol({color:[255,0,0,.3],outline:{color:"white"}})})}),this.view.map.layers.add(this.laneLayer);const c=`${t.assetsRoot}${t.roadConfigTool.initStopLineLayer}`;try{i=await(await fetch(c)).json()}catch(s){return{status:-2,message:`${c}读取失败`,result:s.message}}const l=i.features.filter(s=>s.attributes.RoadSecID!=="").map(s=>u.fromJSON(s));return this.stopLineLayer=new d({objectIdField:"FID",spatialReference:i.spatialReference,geometryType:"polyline",source:l,fields:[{name:"RoadSecID",alias:"RoadSecID",type:"string"}],renderer:new g({symbol:new y.SimpleLineSymbol({color:"red",width:4,cap:"butt",join:"miter"})})}),this.view.map.layers.add(this.stopLineLayer),{status:0,message:"ok"}}updateLayerFilter(e){const t=new v({geometry:e,spatialRelationship:"intersects"}),r=new R({filter:t,excludedEffect:"opacity(0%)"});this.laneLayer.featureEffect=r,this.stopLineLayer.featureEffect=r}}exports.default=M;
@@ -0,0 +1,209 @@
1
+ import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer';
2
+ import MapView from '@arcgis/core/views/MapView';
3
+ import SceneView from '@arcgis/core/views/SceneView';
4
+ import SketchViewModel from '@arcgis/core/widgets/Sketch/SketchViewModel';
5
+ import Sketch from '@arcgis/core/widgets/Sketch';
6
+ import Graphic from '@arcgis/core/Graphic';
7
+ interface sketchViewOptions {
8
+ /**
9
+ * 最大允许绘制的图形数量
10
+ */
11
+ maxAllowedGraphics?: number;
12
+ /**
13
+ * 图形图层配置
14
+ */
15
+ GraphicsLayer?: {};
16
+ /**
17
+ * 绘制工具显示的元素
18
+ */
19
+ sketchvisibleElements?: {};
20
+ /**
21
+ * 绘制工具显示的位置
22
+ */
23
+ sketchPosition?: string;
24
+ /**
25
+ * 绘制工具默认是否显示
26
+ *
27
+ * @type {boolean}
28
+ * @memberof sketchViewOptions
29
+ */
30
+ defaultsketchVisible?: boolean;
31
+ sketchViewModelItemSymbol?: {
32
+ polylineSymbol?: any;
33
+ polygonSymbol?: any;
34
+ pointSymbol?: any;
35
+ };
36
+ }
37
+ interface ITPoint {
38
+ x: number;
39
+ y: number;
40
+ }
41
+ declare type LinearUnits = 'meters' | 'feet' | 'kilometers' | 'miles' | 'nautical-miles' | 'yards' | number;
42
+ export default class SketchView {
43
+ private viewer;
44
+ graphicsLayer: GraphicsLayer;
45
+ TextgraphicsLayer: GraphicsLayer;
46
+ sketchViewModel: SketchViewModel;
47
+ sketch: Sketch;
48
+ options: sketchViewOptions;
49
+ constructor(view: MapView | SceneView, options?: sketchViewOptions);
50
+ init(): void;
51
+ /**
52
+ * 初始化绘图
53
+ *
54
+ * @param {*} data
55
+ * @param {string} [type='crossArea']
56
+ * @param {boolean} [reverse=false] 是否反转
57
+ * @returns
58
+ * @memberof SketchView
59
+ */
60
+ initPoint(data: any, type?: string, reverse?: boolean): void;
61
+ /**
62
+ * 初始化进口道融合区
63
+ *
64
+ * @param {any[]} data
65
+ * @memberof SketchView
66
+ */
67
+ initEntranceFusionZone(data: any[]): void;
68
+ initCrossArea(data: any): Graphic;
69
+ /**
70
+ * 初始进出口道计算区域
71
+ *
72
+ * @param {*} data
73
+ * @param {boolean} [reverse=false] 是否反转
74
+ * @returns
75
+ * @memberof SketchView
76
+ */
77
+ inintSectionArea(data: any, reverse?: boolean): any;
78
+ createPolylineGraphic(paths: any, lineSymbol: any, attributes: any): Graphic;
79
+ createPolygonGraphic(rings: any, lineSymbol: any, attributes: any): Graphic;
80
+ on(callcack?: (type: string, points: any, event?: any) => void): void;
81
+ /**
82
+ * 获取当前绘制的计算区域
83
+ * @returns
84
+ */
85
+ graphicPoint(): any[];
86
+ /**
87
+ * 获取进口道区域
88
+ *
89
+ * @memberof SketchView
90
+ */
91
+ getEntranceRoad(): any;
92
+ /**
93
+ * 获进口道融合区
94
+ *
95
+ * @param {armData} armData 进口道编号区域
96
+ * @param {number[]} armNoList 进口道编号列表
97
+ * @returns
98
+ * @memberof SketchView
99
+ */
100
+ getEntranceFusionZone(armNoList: number[]): {
101
+ graphics: {
102
+ [key: number]: {
103
+ point: any;
104
+ type: string;
105
+ attributes: any;
106
+ };
107
+ };
108
+ rawdata: {
109
+ point: any;
110
+ type: string;
111
+ attributes: any;
112
+ }[];
113
+ };
114
+ /**
115
+ * 获取进口道所在的进口道编号
116
+ *
117
+ * @param {armData} armData 进口道编号区域
118
+ * @param {*} graphicPpolygon 绘制的区域
119
+ * @returns
120
+ * @memberof SketchView
121
+ */
122
+ private getIntersectionArea;
123
+ private filterData;
124
+ /**
125
+ *
126
+ *
127
+ * @private
128
+ * @param {*} geometry
129
+ * @param {boolean} [isfilterData=true] 是否过滤首尾相同点数据
130
+ * @returns
131
+ * @memberof SketchView
132
+ */
133
+ private getGraphicPoint;
134
+ close(): void;
135
+ show(): void;
136
+ removeAll(): void;
137
+ /**
138
+ * 获取两点的角度
139
+ *
140
+ * @param {ITPoint} startPoint
141
+ * @param {ITPoint} endPoint
142
+ * @returns
143
+ * @memberof SketchView
144
+ */
145
+ getAngle(startPoint: ITPoint, endPoint: ITPoint): number;
146
+ /**
147
+ * 获取线平移后的坐标
148
+ *
149
+ * @param {Polyline} lineGeometry 线的几何图形
150
+ * @param {number} distance 平移的距离,默认米
151
+ * @param {LinearUnits} [offsetUnit='meters']
152
+ * @returns
153
+ * @memberof SketchView
154
+ */
155
+ getshiftLine(lineGeometry: __esri.Geometry, distance: number, offsetUnit?: LinearUnits): __esri.Geometry | __esri.Geometry[];
156
+ /**
157
+ * 设置线的平移
158
+ *
159
+ * @param {number} distance 平移的距离,默认米
160
+ * @param {LinearUnits} [offsetUnit='meters'] 平移的单位
161
+ * @param {*} symbol 线的样式
162
+ * @memberof SketchView
163
+ */
164
+ setshiftLine(distance: number, offsetUnit?: LinearUnits, symbol?: any): void;
165
+ /**
166
+ * 移除平移线
167
+ *
168
+ * @memberof SketchView
169
+ */
170
+ removeShiftLine(): void;
171
+ /**
172
+ * 移除绘制的线
173
+ *
174
+ * @memberof SketchView
175
+ */
176
+ removedraw(): void;
177
+ addGraphic(geometry: any, symbol?: any, attributes?: any): void;
178
+ /**
179
+ * 获取方向
180
+ *
181
+ * @param {ITPoint} startPoint 起点
182
+ * @param {ITPoint} endPoint 终点
183
+ * @returns
184
+ * @memberof SketchView
185
+ */
186
+ getDirection(startPoint: ITPoint, endPoint: ITPoint): 0 | 1 | 3 | 2;
187
+ findLayerById(id: string): __esri.Layer;
188
+ /**
189
+ * 根据id查找平移线graphic
190
+ *
191
+ * @param {string} id
192
+ * @returns
193
+ * @memberof SketchView
194
+ */
195
+ findShiftLineGraphicsById(id: string): Graphic;
196
+ /**
197
+ * 删除指定的图形
198
+ * @param graphic 删除指定的图形
199
+ */
200
+ remove(graphic: any): void;
201
+ /**
202
+ * 设置最大允许绘制的图形数量
203
+ * @param num 数量
204
+ */
205
+ setmaxAllowedGraphics(num: number): void;
206
+ deepClone(obj: any): void;
207
+ destroy(): void;
208
+ }
209
+ export {};
@@ -0,0 +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;