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,169 @@
1
+ import R from "@arcgis/core/views/2d/layers/BaseLayerViewGL2D";
2
+ import { mat3 as h, vec2 as v, vec3 as T } from "gl-matrix";
3
+ import U from "@arcgis/core/layers/GraphicsLayer";
4
+ import * as B from "@arcgis/core/core/reactiveUtils";
5
+ const V = R.createSubclass({
6
+ // Locations of the two vertex attributes that we use. They
7
+ // will be bound to the shader program before linking.
8
+ aPosition: 0,
9
+ aOffset: 1,
10
+ aDistance: 2,
11
+ aSide: 3,
12
+ aColor: 4,
13
+ constructor: function() {
14
+ this.transform = h.create(), this.extrude = h.create(), this.translationToCenter = v.create(), this.screenTranslation = v.create(), this.display = h.fromValues(NaN, 0, 0, 0, NaN, 0, -1, 1, 1), this.screenScaling = T.fromValues(NaN, NaN, 1), this.needsUpdate = !1;
15
+ },
16
+ // Called once a custom layer is added to the map.layers collection and this layer view is instantiated.
17
+ attach: function() {
18
+ const t = this.context, i = () => {
19
+ this.needsUpdate = !0, this.requestRender();
20
+ };
21
+ this.watcher = B.on(
22
+ () => this.layer.graphics,
23
+ "change",
24
+ i
25
+ );
26
+ const s = `
27
+ precision highp float;
28
+
29
+ uniform mat3 u_transform;
30
+ uniform mat3 u_extrude;
31
+ uniform mat3 u_display;
32
+
33
+ attribute vec2 a_position;
34
+ attribute vec2 a_offset;
35
+ attribute float a_distance;
36
+ attribute float a_side;
37
+ attribute vec4 a_color;
38
+
39
+ varying float v_distance;
40
+ varying float v_side;
41
+ varying vec4 v_color;
42
+
43
+ void main(void) {
44
+ gl_Position.xy = (u_display * (u_transform * vec3(a_position, 1.0) + u_extrude * vec3(a_offset, 0.0))).xy;
45
+ gl_Position.zw = vec2(0.0, 1.0);
46
+ v_distance = a_distance;
47
+ v_side = a_side;
48
+ v_color = a_color;
49
+ }`, u = `
50
+ precision highp float;
51
+
52
+ uniform float u_current_time;
53
+
54
+ varying float v_distance;
55
+ varying float v_side;
56
+ varying vec4 v_color;
57
+
58
+ const float TRAIL_SPEED = 90.0;
59
+ const float TRAIL_LENGTH = 300.0;
60
+ const float TRAIL_CYCLE = 1000.0;
61
+
62
+ void main(void) {
63
+ float d = mod(v_distance - u_current_time * TRAIL_SPEED, TRAIL_CYCLE);
64
+ float a1 = d < TRAIL_LENGTH ? mix(0.0, 1.0, d / TRAIL_LENGTH) : 0.0;
65
+ float a2 = exp(-abs(v_side) * 3.0);
66
+ float a = a1 * a2;
67
+ gl_FragColor = v_color * a;
68
+ }`, d = t.createShader(t.VERTEX_SHADER);
69
+ t.shaderSource(d, s), t.compileShader(d);
70
+ const m = t.createShader(t.FRAGMENT_SHADER);
71
+ if (t.shaderSource(m, u), t.compileShader(m), this.program = t.createProgram(), t.attachShader(this.program, d), 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(d), 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"))
72
+ this.vao = t.createVertexArray(), this.bindVertexArray = (l) => t.bindVertexArray(l), this.deleteVertexArray = (l) => t.deleteVertexArray(l);
73
+ else {
74
+ const l = t.getExtension("OES_vertex_array_object");
75
+ this.vao = l.createVertexArrayOES(), this.bindVertexArray = (A) => l.bindVertexArrayOES(A), this.deleteVertexArray = (A) => l.deleteVertexArrayOES(A);
76
+ }
77
+ 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 = v.fromValues(
78
+ this.view.state.center[0],
79
+ this.view.state.center[1]
80
+ );
81
+ },
82
+ // Called once a custom layer is removed from the map.layers collection and this layer view is destroyed.
83
+ detach: function() {
84
+ this.watcher.remove();
85
+ const t = this.context;
86
+ t.deleteBuffer(this.vertexBuffer), t.deleteBuffer(this.indexBuffer), this.deleteVertexArray(this.vao), t.deleteProgram(this.program);
87
+ },
88
+ // Called every time a frame is rendered.
89
+ //@ts-ignore
90
+ render: function(t) {
91
+ const i = t.context, s = t.state;
92
+ if (this.updatePositions(t), this.indexBufferSize === 0)
93
+ return;
94
+ h.identity(this.transform), this.screenTranslation[0] = s.pixelRatio * s.size[0] / 2, this.screenTranslation[1] = s.pixelRatio * s.size[1] / 2, h.translate(this.transform, this.transform, this.screenTranslation), h.rotate(
95
+ this.transform,
96
+ this.transform,
97
+ Math.PI * s.rotation / 180
98
+ ), this.screenScaling[0] = s.pixelRatio / s.resolution, this.screenScaling[1] = -s.pixelRatio / s.resolution, h.scale(this.transform, this.transform, this.screenScaling), h.translate(this.transform, this.transform, this.translationToCenter), h.identity(this.extrude), h.rotate(this.extrude, this.extrude, Math.PI * s.rotation / 180);
99
+ const u = 8;
100
+ h.scale(this.extrude, this.extrude, [u, -u, 1]), this.display[0] = 2 / (s.pixelRatio * s.size[0]), this.display[4] = -2 / (s.pixelRatio * s.size[1]), i.useProgram(this.program), i.uniformMatrix3fv(this.uTransform, !1, this.transform), i.uniformMatrix3fv(this.uExtrude, !1, this.extrude), i.uniformMatrix3fv(this.uDisplay, !1, this.display), i.uniform1f(this.uCurrentTime, performance.now() / 1e3), this.bindVertexArray(this.vao), i.enable(i.BLEND), i.blendFunc(i.ONE, i.ONE_MINUS_SRC_ALPHA), i.drawElements(i.TRIANGLES, this.indexBufferSize, i.UNSIGNED_SHORT, 0), this.requestRender();
101
+ },
102
+ // Called internally from render().
103
+ //@ts-ignore
104
+ updatePositions: function(t) {
105
+ const i = t.context, s = t.stationary, u = t.state;
106
+ if (!s) {
107
+ v.sub(this.translationToCenter, this.centerAtLastUpdate, u.center), this.requestRender();
108
+ return;
109
+ }
110
+ if (!this.needsUpdate && this.translationToCenter[0] === 0 && this.translationToCenter[1] === 0)
111
+ return;
112
+ this.centerAtLastUpdate.set(u.center), this.translationToCenter[0] = 0, this.translationToCenter[1] = 0, this.needsUpdate = !1;
113
+ const d = this.layer.graphics;
114
+ let m = 0, l = 0;
115
+ for (let p = 0; p < d.items.length; ++p) {
116
+ const x = d.items[p].geometry.paths[0];
117
+ m += x.length * 2, l += (x.length - 1) * 6;
118
+ }
119
+ const A = new ArrayBuffer(7 * m * 4), a = new Float32Array(A), o = new Uint8Array(A), n = new Uint16Array(l);
120
+ let r = 0, f = 0;
121
+ for (let p = 0; p < d.items.length; ++p) {
122
+ const y = d.items[p], x = y.geometry.paths[0], c = y.attributes.color, e = {};
123
+ for (let g = 0; g < x.length; ++g) {
124
+ const b = x[g];
125
+ if (e.current) {
126
+ e.delta = [b[0] - e.current[0], b[1] - e.current[1]];
127
+ const L = Math.sqrt(
128
+ //@ts-ignore
129
+ e.delta[0] * e.delta[0] + e.delta[1] * e.delta[1]
130
+ );
131
+ e.direction = [e.delta[0] / L, e.delta[1] / L];
132
+ const _ = [-e.direction[1], e.direction[0]];
133
+ if (e.normal) {
134
+ e.offset = [e.normal[0] + _[0], e.normal[1] + _[1]];
135
+ const E = Math.sqrt(
136
+ //@ts-ignore
137
+ e.offset[0] * e.offset[0] + e.offset[1] * e.offset[1]
138
+ );
139
+ e.offset[0] /= E, e.offset[1] /= E;
140
+ const S = e.normal[0] * e.offset[0] + e.normal[1] * e.offset[1];
141
+ e.offset[0] /= S, e.offset[1] /= S;
142
+ } else
143
+ e.offset = [_[0], _[1]];
144
+ a[r * 7 + 0] = //@ts-ignore
145
+ e.current[0] - this.centerAtLastUpdate[0], a[r * 7 + 1] = //@ts-ignore
146
+ e.current[1] - this.centerAtLastUpdate[1], a[r * 7 + 2] = e.offset[0], a[r * 7 + 3] = e.offset[1], a[r * 7 + 4] = e.distance, a[r * 7 + 5] = 1, o[4 * (r * 7 + 6) + 0] = c[0], o[4 * (r * 7 + 6) + 1] = c[1], o[4 * (r * 7 + 6) + 2] = c[2], o[4 * (r * 7 + 6) + 3] = 255, a[r * 7 + 7] = //@ts-ignore
147
+ e.current[0] - this.centerAtLastUpdate[0], a[r * 7 + 8] = //@ts-ignore
148
+ e.current[1] - this.centerAtLastUpdate[1], a[r * 7 + 9] = -e.offset[0], a[r * 7 + 10] = -e.offset[1], a[r * 7 + 11] = e.distance, a[r * 7 + 12] = -1, o[4 * (r * 7 + 13) + 0] = c[0], o[4 * (r * 7 + 13) + 1] = c[1], o[4 * (r * 7 + 13) + 2] = c[2], o[4 * (r * 7 + 13) + 3] = 255, r += 2, g >= 2 && (n[f + 0] = r - 4, n[f + 1] = r - 3, n[f + 2] = r - 2, n[f + 3] = r - 3, n[f + 4] = r - 1, n[f + 5] = r - 2, f += 6), e.normal = _, e.distance += L;
149
+ } else
150
+ e.distance = 0;
151
+ e.current = b;
152
+ }
153
+ e.offset = [e.normal[0], e.normal[1]], a[r * 7 + 0] = e.current[0] - this.centerAtLastUpdate[0], a[r * 7 + 1] = e.current[1] - this.centerAtLastUpdate[1], a[r * 7 + 2] = e.offset[0], a[r * 7 + 3] = e.offset[1], a[r * 7 + 4] = e.distance, a[r * 7 + 5] = 1, o[4 * (r * 7 + 6) + 0] = c[0], o[4 * (r * 7 + 6) + 1] = c[1], o[4 * (r * 7 + 6) + 2] = c[2], o[4 * (r * 7 + 6) + 3] = 255, a[r * 7 + 7] = e.current[0] - this.centerAtLastUpdate[0], a[r * 7 + 8] = e.current[1] - this.centerAtLastUpdate[1], a[r * 7 + 9] = -e.offset[0], a[r * 7 + 10] = -e.offset[1], a[r * 7 + 11] = e.distance, a[r * 7 + 12] = -1, o[4 * (r * 7 + 13) + 0] = c[0], o[4 * (r * 7 + 13) + 1] = c[1], o[4 * (r * 7 + 13) + 2] = c[2], o[4 * (r * 7 + 13) + 3] = 255, r += 2, n[f + 0] = r - 4, n[f + 1] = r - 3, n[f + 2] = r - 2, n[f + 3] = r - 3, n[f + 4] = r - 1, n[f + 5] = r - 2, f += 6, e.current = null;
154
+ }
155
+ i.bindBuffer(i.ARRAY_BUFFER, this.vertexBuffer), i.bufferData(i.ARRAY_BUFFER, A, i.STATIC_DRAW), i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, this.indexBuffer), i.bufferData(i.ELEMENT_ARRAY_BUFFER, n, i.STATIC_DRAW), this.indexBufferSize = n.length;
156
+ }
157
+ }), F = U.createSubclass({
158
+ //@ts-ignore
159
+ createLayerView: function(t) {
160
+ if (t.type === "2d")
161
+ return new V({
162
+ view: t,
163
+ layer: this
164
+ });
165
+ }
166
+ });
167
+ export {
168
+ F as default
169
+ };
@@ -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,127 @@
1
+ import { Point as l, Polygon as d } from "@arcgis/core/geometry";
2
+ import f from "../common-utils.mjs";
3
+ import p from "./entrance.mjs";
4
+ import u from "./exit.mjs";
5
+ class C {
6
+ constructor(n) {
7
+ this.nearbyFeatures = /* @__PURE__ */ new Map(), this.entrances = [], this.exits = [], this.initialized = !1, this.id = n.id, this.crossCenter = new l({ x: n.center[0], y: n.center[1] });
8
+ }
9
+ /**
10
+ * 初始化路口,设置周边车道与停止线
11
+ * @param params
12
+ */
13
+ async initialize(n) {
14
+ n.lanes.forEach((e) => {
15
+ const t = e.getAttribute("RoadSecID"), s = e.geometry, i = this.nearbyFeatures.get(t);
16
+ i ? i.lanes.push(s) : this.nearbyFeatures.set(t, {
17
+ lanes: [s],
18
+ stopLines: []
19
+ });
20
+ }), n.stopLines.forEach((e) => {
21
+ const t = e.getAttribute("RoadSecID"), s = e.geometry, i = this.nearbyFeatures.get(t);
22
+ i ? i.stopLines.push(s) : this.nearbyFeatures.set(t, {
23
+ lanes: [],
24
+ stopLines: [s]
25
+ });
26
+ }), await this.createEntranceAndExit(), console.log(`${this.id} has ${this.entrances.length} entrance`), this.entrances.forEach((e) => {
27
+ console.log(`${e.id} has ${e.lanes.length} lanes`);
28
+ }), this.orderEntrance(), this.initialized = !0;
29
+ }
30
+ /**
31
+ * 标注车道序号的信息,进口道序号+车道序号
32
+ * @returns
33
+ */
34
+ getLaneNumberInfo() {
35
+ const n = [];
36
+ return this.entrances.forEach((e) => {
37
+ e.lanes.forEach((t, s) => {
38
+ n.push({
39
+ crossId: this.id,
40
+ // 路口id
41
+ laneNumber: e.id + String(s + 1),
42
+ // 车道序号
43
+ stopLineCenter: [t.stopLineCenter.x, t.stopLineCenter.y],
44
+ // 车道停止线中心点
45
+ laneDirection: t.laneDirection - 180
46
+ // 车道方向
47
+ });
48
+ });
49
+ }), this.exits.forEach((e) => {
50
+ e.lanes.forEach((t, s) => {
51
+ n.push({
52
+ crossId: this.id,
53
+ // 路口id
54
+ laneNumber: "-" + e.id + String(s + 1),
55
+ // 车道序号
56
+ stopLineCenter: [t.stopLineCenter.x, t.stopLineCenter.y],
57
+ // 车道停止线中心点
58
+ laneDirection: t.laneDirection - 180
59
+ // 车道方向
60
+ });
61
+ });
62
+ }), n;
63
+ }
64
+ /**
65
+ * 计算路口指标计算区域。
66
+ * 由相邻进口道的停止线延长线交点围成的区域
67
+ */
68
+ async calCrossIndicatorArea() {
69
+ const n = [];
70
+ for (let e = 0; e < this.entrances.length; e++) {
71
+ const t = this.entrances[e], s = this.entrances[(e + 1) % this.entrances.length], i = t.furthestLane.extendedStopLine, a = s.furthestLane.extendedStopLine, o = await f.getIntersectPointOfTwoLines(
72
+ i,
73
+ a
74
+ );
75
+ if (o)
76
+ n.push(o);
77
+ else {
78
+ const r = this.findExitOfEntrance(t), c = (r ? r.lanes[r.lanes.length - 1] : t.lanes[t.lanes.length - 1]).stopLine.getPoint(0, 1);
79
+ n.push(c);
80
+ const h = s.lanes[s.lanes.length - 1].stopLine.getPoint(0, 1);
81
+ n.push(h);
82
+ }
83
+ }
84
+ if (n.length > 2)
85
+ return new d({
86
+ rings: [n.map((e) => [e.x, e.y])]
87
+ });
88
+ }
89
+ /**
90
+ * 创建进口道与出口道,并得到道口的车道与车道停止线
91
+ */
92
+ async createEntranceAndExit() {
93
+ for (const n of this.nearbyFeatures) {
94
+ const e = n[0], t = n[1];
95
+ if (t.stopLines.length === 0) {
96
+ const s = new u(e);
97
+ s.addLanes(t), this.exits.push(s);
98
+ } else {
99
+ const s = new p(e);
100
+ await s.addLanes(t), this.entrances.push(s);
101
+ }
102
+ }
103
+ for (const n of this.exits)
104
+ await n.findCorrespondingEntrance(this.entrances);
105
+ }
106
+ /**
107
+ * 进口道排序
108
+ */
109
+ orderEntrance() {
110
+ this.entrances.sort((n, e) => {
111
+ let t = n.dir, s = e.dir;
112
+ return t < 225 && (t += 360), s < 225 && (s += 360), t - s;
113
+ }), this.entrances.forEach((n, e) => {
114
+ n.id = String(e + 1);
115
+ const t = this.findExitOfEntrance(n);
116
+ t && (t.id = String(e + 1));
117
+ });
118
+ }
119
+ findExitOfEntrance(n) {
120
+ for (const e of this.exits)
121
+ if (e.entrance === n)
122
+ return e;
123
+ }
124
+ }
125
+ export {
126
+ C as default
127
+ };
@@ -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,79 @@
1
+ import { QuadrantCode as r } from "../../../types/index.mjs";
2
+ import h from "../common-utils.mjs";
3
+ import a from "./lane.mjs";
4
+ import { Polyline as L } from "@arcgis/core/geometry";
5
+ class l {
6
+ constructor(t) {
7
+ this.lanes = [], this.id = t;
8
+ }
9
+ async addLanes(t) {
10
+ for (const n of t.lanes)
11
+ for (const s of t.stopLines) {
12
+ const e = await h.getIntersectPointsOfStopLineAndLane(
13
+ s,
14
+ n,
15
+ [0.5, -0.5]
16
+ );
17
+ if (e.length === 0)
18
+ continue;
19
+ const i = new L({ paths: [e] }), o = new a();
20
+ o.lanePolygon = n, o.stopLine = i, o.isEntry = !0, await o.getLaneDirection(), this.addLane(o);
21
+ break;
22
+ }
23
+ }
24
+ /**
25
+ * 新增车道,并按道路中线至边线的方向排序
26
+ * @param lane
27
+ * @returns
28
+ */
29
+ addLane(t) {
30
+ this.furthestLane || (this.furthestLane = t), this.dir || (this.dir = t.laneDirection, this.dir < 45 || this.dir > 315 ? this.quadrantCode = r.North : this.dir < 135 ? this.quadrantCode = r.East : this.dir < 225 ? this.quadrantCode = r.South : this.quadrantCode = r.West);
31
+ const n = t.stopLine, s = n.paths[0];
32
+ switch (this.quadrantCode) {
33
+ case r.West:
34
+ t.stopLineCenter.x < this.furthestLane.stopLineCenter.x && (this.furthestLane = t), s[0][1] < s[1][1] && (n.paths = [s.reverse()]);
35
+ for (let e = 0; e < this.lanes.length; e++) {
36
+ const i = this.lanes[e];
37
+ if (t.stopLineCenter.y > i.stopLineCenter.y) {
38
+ this.lanes.splice(e, 0, t);
39
+ return;
40
+ }
41
+ }
42
+ break;
43
+ case r.North:
44
+ t.stopLineCenter.y > this.furthestLane.stopLineCenter.y && (this.furthestLane = t), s[0][0] < s[1][0] && (n.paths = [s.reverse()]);
45
+ for (let e = 0; e < this.lanes.length; e++) {
46
+ const i = this.lanes[e];
47
+ if (t.stopLineCenter.x > i.stopLineCenter.x) {
48
+ this.lanes.splice(e, 0, t);
49
+ return;
50
+ }
51
+ }
52
+ break;
53
+ case r.East:
54
+ t.stopLineCenter.x > this.furthestLane.stopLineCenter.x && (this.furthestLane = t), s[0][1] > s[1][1] && (n.paths = [s.reverse()]);
55
+ for (let e = 0; e < this.lanes.length; e++) {
56
+ const i = this.lanes[e];
57
+ if (t.stopLineCenter.y < i.stopLineCenter.y) {
58
+ this.lanes.splice(e, 0, t);
59
+ return;
60
+ }
61
+ }
62
+ break;
63
+ case r.South:
64
+ t.stopLineCenter.y < this.furthestLane.stopLineCenter.y && (this.furthestLane = t), s[0][0] > s[1][0] && (n.paths = [s.reverse()]);
65
+ for (let e = 0; e < this.lanes.length; e++) {
66
+ const i = this.lanes[e];
67
+ if (t.stopLineCenter.x < i.stopLineCenter.x) {
68
+ this.lanes.splice(e, 0, t);
69
+ return;
70
+ }
71
+ }
72
+ break;
73
+ }
74
+ this.lanes.push(t);
75
+ }
76
+ }
77
+ export {
78
+ l as default
79
+ };
@@ -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,86 @@
1
+ import p from "../common-utils.mjs";
2
+ import f from "./lane.mjs";
3
+ import { Polyline as h } from "@arcgis/core/geometry";
4
+ import * as y from "@arcgis/core/geometry/geometryEngineAsync";
5
+ import { QuadrantCode as o } from "../../../types/index.mjs";
6
+ class C {
7
+ constructor(t) {
8
+ this.lanes = [], this.id = t;
9
+ }
10
+ /**
11
+ * 寻找对应的进口道
12
+ * @param entrances
13
+ */
14
+ async findCorrespondingEntrance(t) {
15
+ var a;
16
+ const e = this.lanes[0], n = e.lanePolygon.centroid;
17
+ let s, r = 1 / 0, i;
18
+ for (const c of t) {
19
+ s = c.lanes[0].lanePolygon.centroid;
20
+ const d = new h({
21
+ paths: [
22
+ [
23
+ [s.x, s.y],
24
+ [n.x, n.y]
25
+ ]
26
+ ]
27
+ }), l = await y.geodesicLength(d, "meters");
28
+ l < r && (r = l, i = c);
29
+ }
30
+ const L = i.furthestLane.extendedStopLine;
31
+ (await p.getIntersectPointsOfStopLineAndLane(
32
+ L,
33
+ e.lanePolygon,
34
+ [5]
35
+ )).length && (this.entrance = i, await this.splitStopLine(), console.log(`${this.id}的对应进口道是${(a = this.entrance) == null ? void 0 : a.id}`));
36
+ }
37
+ addLanes(t) {
38
+ for (const e of t.lanes) {
39
+ const n = new f();
40
+ n.lanePolygon = e, n.isEntry = !1, this.lanes.push(n);
41
+ }
42
+ }
43
+ async splitStopLine() {
44
+ if (this.entrance) {
45
+ for (const t of this.lanes) {
46
+ const e = await p.getIntersectPointsOfStopLineAndLane(
47
+ this.entrance.furthestLane.extendedStopLine,
48
+ t.lanePolygon,
49
+ [0.5, 1, 2, 3, 4, 5, 6, 7, 8]
50
+ );
51
+ if (e.length !== 0) {
52
+ switch (this.entrance.quadrantCode) {
53
+ case o.West:
54
+ e.sort((n, s) => n[1] - s[1]);
55
+ break;
56
+ case o.North:
57
+ e.sort((n, s) => n[0] - s[0]);
58
+ break;
59
+ case o.East:
60
+ e.sort((n, s) => s[1] - n[1]);
61
+ break;
62
+ case o.South:
63
+ e.sort((n, s) => s[0] - n[0]);
64
+ break;
65
+ }
66
+ t.stopLine = new h({ paths: [e] }), await t.getLaneDirection();
67
+ }
68
+ }
69
+ this.lanes.sort((t, e) => {
70
+ switch (this.entrance.quadrantCode) {
71
+ case o.West:
72
+ return t.stopLine.extent.center.y - e.stopLine.extent.center.y;
73
+ case o.North:
74
+ return t.stopLine.extent.center.x - e.stopLine.extent.center.x;
75
+ case o.East:
76
+ return e.stopLine.extent.center.y - t.stopLine.extent.center.y;
77
+ case o.South:
78
+ return e.stopLine.extent.center.x - t.stopLine.extent.center.x;
79
+ }
80
+ });
81
+ }
82
+ }
83
+ }
84
+ export {
85
+ C as default
86
+ };
@@ -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
+ }