@antv/l7-layers 2.17.4 → 2.17.6

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 (250) hide show
  1. package/es/Geometry/index.js +9 -31
  2. package/es/Geometry/models/billboard.js +51 -89
  3. package/es/Geometry/models/plane.js +81 -143
  4. package/es/Geometry/models/sprite.js +60 -118
  5. package/es/canvas/index.js +10 -33
  6. package/es/canvas/models/canvas.js +41 -97
  7. package/es/citybuliding/building.js +8 -27
  8. package/es/citybuliding/models/build.js +57 -82
  9. package/es/core/BaseLayer.js +325 -483
  10. package/es/core/BaseModel.js +51 -80
  11. package/es/core/CommonStyleAttribute.js +2 -5
  12. package/es/core/LayerPickService.js +21 -32
  13. package/es/core/TextureService.js +0 -13
  14. package/es/core/interface.js +17 -24
  15. package/es/core/shape/Path.js +13 -20
  16. package/es/core/shape/extrude.js +27 -39
  17. package/es/core/triangulation.js +99 -136
  18. package/es/earth/index.js +9 -33
  19. package/es/earth/models/atmosphere.js +30 -54
  20. package/es/earth/models/base.js +47 -85
  21. package/es/earth/models/bloomsphere.js +30 -54
  22. package/es/earth/utils.js +9 -13
  23. package/es/heatmap/index.js +10 -40
  24. package/es/heatmap/models/grid.js +28 -52
  25. package/es/heatmap/models/grid3d.js +28 -52
  26. package/es/heatmap/models/heatmap.js +92 -149
  27. package/es/heatmap/models/hexagon.js +28 -52
  28. package/es/heatmap/triangulation.js +0 -4
  29. package/es/image/index.js +9 -28
  30. package/es/image/models/image.js +66 -100
  31. package/es/index.js +9 -17
  32. package/es/line/index.js +9 -35
  33. package/es/line/models/arc.js +63 -112
  34. package/es/line/models/arc_3d.js +58 -102
  35. package/es/line/models/earthArc_3d.js +60 -105
  36. package/es/line/models/flow.js +36 -60
  37. package/es/line/models/great_circle.js +53 -94
  38. package/es/line/models/line.js +92 -144
  39. package/es/line/models/linearline.js +42 -74
  40. package/es/line/models/simpleLine.js +38 -67
  41. package/es/line/models/wall.js +52 -92
  42. package/es/line/shaders/dash/line_dash_vert.glsl +1 -2
  43. package/es/line/shaders/line_frag.glsl +1 -3
  44. package/es/line/shaders/line_vert.glsl +2 -0
  45. package/es/line/shaders/linear/line_linear_frag.glsl +1 -1
  46. package/es/mask/index.js +9 -28
  47. package/es/mask/models/fill.js +29 -54
  48. package/es/plugins/DataMappingPlugin.js +78 -114
  49. package/es/plugins/DataSourcePlugin.js +45 -68
  50. package/es/plugins/FeatureScalePlugin.js +67 -122
  51. package/es/plugins/LayerAnimateStylePlugin.js +0 -5
  52. package/es/plugins/LayerMaskPlugin.js +3 -11
  53. package/es/plugins/LayerModelPlugin.js +69 -118
  54. package/es/plugins/LayerStylePlugin.js +4 -9
  55. package/es/plugins/LightingPlugin.js +12 -18
  56. package/es/plugins/MultiPassRendererPlugin.js +11 -16
  57. package/es/plugins/PixelPickingPlugin.js +12 -21
  58. package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
  59. package/es/plugins/ShaderUniformPlugin.js +13 -27
  60. package/es/plugins/UpdateModelPlugin.js +0 -5
  61. package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
  62. package/es/point/index.js +26 -78
  63. package/es/point/models/earthExtrude.js +58 -95
  64. package/es/point/models/earthFill.js +52 -80
  65. package/es/point/models/extrude.js +57 -94
  66. package/es/point/models/fill.js +56 -81
  67. package/es/point/models/fillmage.js +60 -100
  68. package/es/point/models/image.js +47 -83
  69. package/es/point/models/index.js +2 -2
  70. package/es/point/models/normal.js +30 -54
  71. package/es/point/models/radar.js +38 -63
  72. package/es/point/models/simplePoint.js +38 -62
  73. package/es/point/models/text.js +199 -296
  74. package/es/point/shape/extrude.js +4 -13
  75. package/es/polygon/index.js +11 -41
  76. package/es/polygon/models/extrude.js +87 -135
  77. package/es/polygon/models/fill.js +50 -79
  78. package/es/polygon/models/index.js +3 -2
  79. package/es/polygon/models/ocean.js +42 -76
  80. package/es/polygon/models/water.js +37 -71
  81. package/es/raster/buffers/triangulation.js +2 -4
  82. package/es/raster/index.js +9 -32
  83. package/es/raster/models/raster.js +80 -116
  84. package/es/raster/models/rasterRgb.js +84 -127
  85. package/es/raster/models/rasterTerrainRgb.js +56 -84
  86. package/es/tile/interaction/getRasterData.js +14 -20
  87. package/es/tile/interaction/utils.js +7 -9
  88. package/es/tile/manager/base.js +63 -96
  89. package/es/tile/service/TileLayerService.js +33 -55
  90. package/es/tile/service/TilePickService.js +26 -40
  91. package/es/tile/service/TileSourceService.js +3 -7
  92. package/es/tile/tileFactory/DebugTile.js +29 -46
  93. package/es/tile/tileFactory/ImageTile.js +20 -38
  94. package/es/tile/tileFactory/MaskTile.js +22 -43
  95. package/es/tile/tileFactory/RasterRGBTile.js +22 -42
  96. package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
  97. package/es/tile/tileFactory/RasterTile.js +30 -53
  98. package/es/tile/tileFactory/Tile.js +63 -97
  99. package/es/tile/tileFactory/VectorTile.js +41 -68
  100. package/es/tile/tileFactory/index.js +0 -11
  101. package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
  102. package/es/tile/tileFactory/util.js +0 -3
  103. package/es/tile/tileLayer/BaseLayer.js +105 -146
  104. package/es/tile/utils.js +1 -1
  105. package/es/utils/blend.js +0 -2
  106. package/es/utils/collision-index.js +9 -16
  107. package/es/utils/extrude_polyline.js +101 -149
  108. package/es/utils/grid-index.js +2 -27
  109. package/es/utils/identityScale.js +0 -8
  110. package/es/utils/layerData.js +30 -44
  111. package/es/utils/multiPassRender.js +11 -13
  112. package/es/utils/polylineNormal.js +31 -37
  113. package/es/utils/simpleLine.js +2 -16
  114. package/es/utils/stencil.js +2 -3
  115. package/es/utils/symbol-layout.js +27 -53
  116. package/es/wind/index.js +9 -29
  117. package/es/wind/models/utils.js +26 -51
  118. package/es/wind/models/wind.js +101 -147
  119. package/es/wind/models/windRender.js +53 -66
  120. package/lib/Geometry/index.js +9 -38
  121. package/lib/Geometry/models/billboard.js +51 -97
  122. package/lib/Geometry/models/index.js +0 -5
  123. package/lib/Geometry/models/plane.js +79 -151
  124. package/lib/Geometry/models/sprite.js +60 -127
  125. package/lib/canvas/index.js +10 -40
  126. package/lib/canvas/models/canvas.js +41 -101
  127. package/lib/canvas/models/index.js +0 -3
  128. package/lib/citybuliding/building.js +8 -35
  129. package/lib/citybuliding/models/build.js +57 -92
  130. package/lib/core/BaseLayer.js +325 -474
  131. package/lib/core/BaseModel.js +51 -90
  132. package/lib/core/CommonStyleAttribute.js +2 -7
  133. package/lib/core/LayerPickService.js +21 -37
  134. package/lib/core/TextureService.js +0 -16
  135. package/lib/core/interface.js +21 -31
  136. package/lib/core/schema.js +0 -1
  137. package/lib/core/shape/Path.js +14 -31
  138. package/lib/core/shape/extrude.js +27 -62
  139. package/lib/core/triangulation.js +98 -177
  140. package/lib/earth/index.js +9 -43
  141. package/lib/earth/models/atmosphere.js +30 -63
  142. package/lib/earth/models/base.js +47 -90
  143. package/lib/earth/models/bloomsphere.js +30 -63
  144. package/lib/earth/utils.js +7 -31
  145. package/lib/heatmap/index.js +10 -48
  146. package/lib/heatmap/models/grid.js +28 -60
  147. package/lib/heatmap/models/grid3d.js +28 -60
  148. package/lib/heatmap/models/heatmap.js +92 -166
  149. package/lib/heatmap/models/hexagon.js +28 -60
  150. package/lib/heatmap/models/index.js +0 -6
  151. package/lib/heatmap/triangulation.js +0 -5
  152. package/lib/image/index.js +9 -36
  153. package/lib/image/models/image.js +66 -109
  154. package/lib/image/models/index.js +0 -3
  155. package/lib/index.js +7 -61
  156. package/lib/line/index.js +9 -40
  157. package/lib/line/models/arc.js +61 -122
  158. package/lib/line/models/arc_3d.js +56 -113
  159. package/lib/line/models/earthArc_3d.js +58 -115
  160. package/lib/line/models/flow.js +36 -70
  161. package/lib/line/models/great_circle.js +53 -104
  162. package/lib/line/models/index.js +0 -11
  163. package/lib/line/models/line.js +90 -152
  164. package/lib/line/models/linearline.js +42 -86
  165. package/lib/line/models/simpleLine.js +38 -77
  166. package/lib/line/models/wall.js +52 -103
  167. package/lib/line/shaders/dash/line_dash_vert.glsl +1 -2
  168. package/lib/line/shaders/line_frag.glsl +1 -3
  169. package/lib/line/shaders/line_vert.glsl +2 -0
  170. package/lib/line/shaders/linear/line_linear_frag.glsl +1 -1
  171. package/lib/mask/index.js +9 -36
  172. package/lib/mask/models/fill.js +29 -63
  173. package/lib/mask/models/index.js +0 -3
  174. package/lib/plugins/DataMappingPlugin.js +78 -125
  175. package/lib/plugins/DataSourcePlugin.js +45 -76
  176. package/lib/plugins/FeatureScalePlugin.js +67 -138
  177. package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
  178. package/lib/plugins/LayerMaskPlugin.js +4 -17
  179. package/lib/plugins/LayerModelPlugin.js +70 -127
  180. package/lib/plugins/LayerStylePlugin.js +5 -14
  181. package/lib/plugins/LightingPlugin.js +12 -25
  182. package/lib/plugins/MultiPassRendererPlugin.js +11 -22
  183. package/lib/plugins/PixelPickingPlugin.js +12 -27
  184. package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
  185. package/lib/plugins/ShaderUniformPlugin.js +13 -34
  186. package/lib/plugins/UpdateModelPlugin.js +1 -10
  187. package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
  188. package/lib/point/index.js +26 -83
  189. package/lib/point/models/earthExtrude.js +58 -106
  190. package/lib/point/models/earthFill.js +52 -110
  191. package/lib/point/models/extrude.js +57 -103
  192. package/lib/point/models/fill.js +54 -90
  193. package/lib/point/models/fillmage.js +58 -107
  194. package/lib/point/models/image.js +47 -92
  195. package/lib/point/models/index.js +1 -12
  196. package/lib/point/models/normal.js +30 -64
  197. package/lib/point/models/radar.js +38 -72
  198. package/lib/point/models/simplePoint.js +38 -72
  199. package/lib/point/models/text.js +199 -305
  200. package/lib/point/shape/extrude.js +4 -20
  201. package/lib/polygon/index.js +11 -48
  202. package/lib/polygon/models/extrude.js +87 -146
  203. package/lib/polygon/models/fill.js +50 -89
  204. package/lib/polygon/models/index.js +2 -14
  205. package/lib/polygon/models/ocean.js +42 -88
  206. package/lib/polygon/models/water.js +37 -82
  207. package/lib/raster/buffers/triangulation.js +3 -7
  208. package/lib/raster/index.js +9 -40
  209. package/lib/raster/models/index.js +0 -5
  210. package/lib/raster/models/raster.js +80 -125
  211. package/lib/raster/models/rasterRgb.js +84 -139
  212. package/lib/raster/models/rasterTerrainRgb.js +56 -93
  213. package/lib/tile/interaction/getRasterData.js +14 -25
  214. package/lib/tile/interaction/utils.js +7 -19
  215. package/lib/tile/manager/base.js +63 -104
  216. package/lib/tile/service/TileLayerService.js +33 -60
  217. package/lib/tile/service/TilePickService.js +26 -48
  218. package/lib/tile/service/TileSourceService.js +2 -16
  219. package/lib/tile/style/utils.js +0 -3
  220. package/lib/tile/tileFactory/DebugTile.js +29 -54
  221. package/lib/tile/tileFactory/ImageTile.js +20 -46
  222. package/lib/tile/tileFactory/MaskTile.js +22 -51
  223. package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
  224. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
  225. package/lib/tile/tileFactory/RasterTile.js +30 -63
  226. package/lib/tile/tileFactory/Tile.js +63 -102
  227. package/lib/tile/tileFactory/VectorTile.js +41 -76
  228. package/lib/tile/tileFactory/index.js +0 -25
  229. package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
  230. package/lib/tile/tileFactory/util.js +0 -9
  231. package/lib/tile/tileLayer/BaseLayer.js +105 -153
  232. package/lib/tile/utils.js +1 -5
  233. package/lib/utils/blend.js +0 -5
  234. package/lib/utils/collision-index.js +9 -25
  235. package/lib/utils/extrude_polyline.js +101 -181
  236. package/lib/utils/grid-index.js +2 -28
  237. package/lib/utils/identityScale.js +0 -9
  238. package/lib/utils/layerData.js +30 -49
  239. package/lib/utils/multiPassRender.js +11 -16
  240. package/lib/utils/polylineNormal.js +31 -66
  241. package/lib/utils/simpleLine.js +2 -21
  242. package/lib/utils/stencil.js +0 -4
  243. package/lib/utils/symbol-layout.js +27 -55
  244. package/lib/wind/index.js +9 -37
  245. package/lib/wind/models/index.js +0 -3
  246. package/lib/wind/models/utils.js +26 -62
  247. package/lib/wind/models/wind.js +101 -157
  248. package/lib/wind/models/windRender.js +53 -71
  249. package/lib/wind/models/windShader.js +0 -1
  250. package/package.json +7 -7
@@ -7,62 +7,45 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
9
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
-
11
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
-
13
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
-
15
12
  import { AttributeType, gl } from '@antv/l7-core';
16
13
  import { rgb2arr } from '@antv/l7-utils';
17
14
  import BaseModel from "../../core/BaseModel";
18
15
  import { LineArcTriangulation } from "../../core/triangulation";
19
- import { EARTH_RADIUS } from "../../earth/utils"; // arc3d line layer
20
-
16
+ import { EARTH_RADIUS } from "../../earth/utils";
17
+ // arc3d line layer
21
18
  /* babel-plugin-inline-import '../shaders/line_arc_3d_frag.glsl' */
22
19
  var arc3d_line_frag = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\nvarying vec4 v_line_data;\n\nuniform float u_line_texture: 0.0;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\nvarying float v_segmentIndex;\nuniform float segmentNumber;\nuniform float u_opacity;\n\nvarying vec2 v_iconMapUV;\n\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_line_data.g; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n gl_FragColor = v_color;\n\n gl_FragColor.a *= opacity;\n if(u_line_type == LineTypeDash) {\n float flag = 0.;\n float dashLength = mod(d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n flag = 1.;\n }\n gl_FragColor.a *=flag;\n }\n\n if(u_animate.x == Animate && u_line_texture != LineTexture) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);\n\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n\n // u_animate \n // x enable\n // y duration\n // z interval\n // w trailLength\n }\n\n if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture\n // float arcRadio = smoothstep( 0.0, 1.0, (v_segmentIndex / segmentNumber));\n float arcRadio = v_segmentIndex / (segmentNumber - 1.0);\n float count = v_line_data.b; // // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float time = 0.0;\n if(u_animate.x == Animate) {\n time = u_time / u_animate.y;\n }\n float redioCount = arcRadio * count;\n\n float u = fract(redioCount - time);\n\n float v = v_line_data.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_animate.x == Animate) {\n float currentPlane = floor(redioCount - time);\n float textureStep = floor(count * u_animate.z);\n float a = mod(currentPlane, textureStep);\n if(a < textureStep - 1.0) {\n pattern = vec4(0.0);\n }\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n discard;\n } else {\n gl_FragColor = filterColor(pattern);\n }\n }\n\n } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
23
-
24
20
  /* babel-plugin-inline-import '../shaders/line_arc_3d_vert.glsl' */
25
21
  var arc3d_line_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute vec4 a_Color;\nattribute float a_Size;\n\nuniform float u_globel;\nuniform float u_globel_radius;\nuniform float u_global_height: 10;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n\nuniform float u_line_type: 0.0;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nvarying vec4 v_dash_array;\n\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nvarying float v_segmentIndex;\n\nattribute vec2 a_iconMapUV;\nvarying vec2 v_iconMapUV;\nvarying vec4 v_line_data;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat maps (float value, float start1, float stop1, float start2, float stop2) {\n return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));\n}\n\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0));\n}\n\nfloat paraboloid(vec2 source, vec2 target, float ratio) {\n vec2 x = mix(source, target, ratio);\n vec2 center = mix(source, target, 0.5);\n float dSourceCenter = distance(source, center);\n float dXCenter = distance(x, center);\n return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);\n}\n\nvec3 getPos(vec2 source, vec2 target, float segmentRatio) {\n float vertex_height = paraboloid(source, target, segmentRatio);\n\n return vec3(\n mix(source, target, segmentRatio),\n sqrt(max(0.0, vertex_height))\n );\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nfloat torad(float deg) {\n return (deg / 180.0) * acos(-1.0);\n}\n\nvec3 lglt2xyz(vec2 lnglat) {\n float pi = 3.1415926;\n // + Math.PI/2 \u662F\u4E3A\u4E86\u5BF9\u9F50\u5750\u6807\n float lng = torad(lnglat.x) + pi / 2.0;\n float lat = torad(lnglat.y);\n\n // \u624B\u52A8\u589E\u52A0\u4E00\u4E9B\u504F\u79FB\uFF0C\u51CF\u8F7B\u9762\u7684\u51B2\u7A81\n float radius = u_globel_radius;\n\n float z = radius * cos(lat) * cos(lng);\n float x = radius * cos(lat) * sin(lng);\n float y = radius * sin(lat);\n return vec3(x, y, z);\n}\n\nvoid main() {\n\n v_color = a_Color;\n vec2 source = project_position(vec4(a_Instance.rg, 0, 0)).xy;\n vec2 target = project_position(vec4(a_Instance.ba, 0, 0)).xy;\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n\n float d_distance_ratio;\n if(u_line_type == LineTypeDash) {\n d_distance_ratio = segmentIndex / segmentNumber;\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);\n }\n if(u_animate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n }\n v_line_data.g = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n vec3 curr = getPos(source, target, segmentRatio);\n vec3 next = getPos(source, target, nextSegmentRatio);\n vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y);\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n\n\n v_segmentIndex = a_Position.x;\n if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F \n\n float arcDistrance = length(source - target);\n float pixelLen = project_pixel_texture(u_icon_step);\n v_line_data.b = floor(arcDistrance/pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n vec2 projectOffset = project_pixel(offset);\n float lineOffsetWidth = length(projectOffset + projectOffset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB\n v_line_data.a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n v_iconMapUV = a_iconMapUV;\n }\n \n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n }\n\n // \u5730\u7403\u6A21\u5F0F\n if(u_globel > 0.0) {\n vec3 startLngLat = lglt2xyz(a_Instance.rg);\n vec3 endLngLat = lglt2xyz(a_Instance.ba);\n float globalRadius = length(startLngLat);\n\n vec3 lineDir = normalize(endLngLat - startLngLat);\n vec3 midPointDir = normalize((startLngLat + endLngLat)/2.0);\n\n // \u7EBF\u7684\u504F\u79FB\n vec3 lnglatOffset = cross(lineDir, midPointDir) * a_Position.y;\n // \u8BA1\u7B97\u8D77\u59CB\u70B9\u548C\u7EC8\u6B62\u70B9\u7684\u8DDD\u79BB\n float lnglatLength = length(a_Instance.rg - a_Instance.ba)/50.0;\n // \u8BA1\u7B97\u98DE\u7EBF\u5404\u4E2A\u8282\u70B9\u76F8\u5E94\u7684\u9AD8\u5EA6\n float lineHeight = u_global_height * (-4.0*segmentRatio*segmentRatio + 4.0 * segmentRatio) * lnglatLength;\n // \u5730\u7403\u70B9\u4F4D\n vec3 globalPoint = normalize(mix(startLngLat, endLngLat, segmentRatio)) * (globalRadius + lineHeight) + lnglatOffset * a_Size;\n \n gl_Position = u_ViewProjectionMatrix * vec4(globalPoint, 1.0);\n }\n \n\n setPickingColor(a_PickingColor);\n}\n"; // arc3d linear layer
26
-
27
22
  /* babel-plugin-inline-import '../shaders/linear/arc3d_linear_frag.glsl' */
28
23
  var arc3d_linear_frag = "\n#define Animate 0.0\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nvarying vec4 v_Color;\n\nvarying float v_distance_ratio;\n#pragma include \"picking\"\n\nvoid main() {\n\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n gl_FragColor = v_Color;\n\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);\n\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n\n // u_animate \n // x enable\n // y duration\n // z interval\n // w trailLength\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
29
-
30
24
  /* babel-plugin-inline-import '../shaders/linear/arc3d_linear_vert.glsl' */
31
25
  var arc3d_linear_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute vec4 a_Color;\nattribute float a_Size;\nattribute vec2 a_iconMapUV;\n\nuniform float u_globel;\nuniform float u_globel_radius;\nuniform float u_global_height: 10;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\nuniform float u_line_type: 0.0;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nvarying float v_distance_ratio;\n\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\nvarying vec2 v_iconMapUV;\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat maps (float value, float start1, float stop1, float start2, float stop2) {\n return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));\n}\n\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0));\n}\n\nfloat paraboloid(vec2 source, vec2 target, float ratio) {\n vec2 x = mix(source, target, ratio);\n vec2 center = mix(source, target, 0.5);\n float dSourceCenter = distance(source, center);\n float dXCenter = distance(x, center);\n return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);\n}\n\nvec3 getPos(vec2 source, vec2 target, float segmentRatio) {\n float vertex_height = paraboloid(source, target, segmentRatio);\n\n return vec3(\n mix(source, target, segmentRatio),\n sqrt(max(0.0, vertex_height))\n );\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nfloat torad(float deg) {\n return (deg / 180.0) * acos(-1.0);\n}\n\nvec3 lglt2xyz(vec2 lnglat) {\n float pi = 3.1415926;\n // + Math.PI/2 \u662F\u4E3A\u4E86\u5BF9\u9F50\u5750\u6807\n float lng = torad(lnglat.x) + pi / 2.0;\n float lat = torad(lnglat.y);\n\n // \u624B\u52A8\u589E\u52A0\u4E00\u4E9B\u504F\u79FB\uFF0C\u51CF\u8F7B\u9762\u7684\u51B2\u7A81\n float radius = u_globel_radius;\n\n float z = radius * cos(lat) * cos(lng);\n float x = radius * cos(lat) * sin(lng);\n float y = radius * sin(lat);\n return vec3(x, y, z);\n}\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = a_Color;\n vec2 source = project_position(vec4(a_Instance.rg, 0, 0)).xy;\n vec2 target = project_position(vec4(a_Instance.ba, 0, 0)).xy;\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n\n float d_distance_ratio;\n if(u_line_type == LineTypeDash) {\n d_distance_ratio = segmentIndex / segmentNumber;\n // float total_Distance = pixelDistance(a_Instance.rg, a_Instance.ba) / 2.0 * PI;\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);\n }\n if(u_animate.x == Animate) {\n v_distance_ratio = segmentIndex / segmentNumber;\n }\n\n\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n vec3 curr = getPos(source, target, segmentRatio);\n vec3 next = getPos(source, target, nextSegmentRatio);\n vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y);\n\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n v_Color = mix(u_sourceColor, u_targetColor, a_Position.x/segmentNumber);\n\n v_Color.a *= opacity;\n\n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z, 1.0));\n }\n\n // \u5730\u7403\u6A21\u5F0F\n if(u_globel > 0.0) {\n vec3 startLngLat = lglt2xyz(a_Instance.rg);\n vec3 endLngLat = lglt2xyz(a_Instance.ba);\n float globalRadius = length(startLngLat);\n\n vec3 lineDir = normalize(endLngLat - startLngLat);\n vec3 midPointDir = normalize((startLngLat + endLngLat)/2.0);\n\n // \u7EBF\u7684\u504F\u79FB\n vec3 lnglatOffset = cross(lineDir, midPointDir) * a_Position.y;\n // \u8BA1\u7B97\u8D77\u59CB\u70B9\u548C\u7EC8\u6B62\u70B9\u7684\u8DDD\u79BB\n float lnglatLength = length(a_Instance.rg - a_Instance.ba)/50.0;\n // \u8BA1\u7B97\u98DE\u7EBF\u5404\u4E2A\u8282\u70B9\u76F8\u5E94\u7684\u9AD8\u5EA6\n float lineHeight = u_global_height * (-4.0*segmentRatio*segmentRatio + 4.0 * segmentRatio) * lnglatLength;\n // \u5730\u7403\u70B9\u4F4D\n vec3 globalPoint = normalize(mix(startLngLat, endLngLat, segmentRatio)) * (globalRadius + lineHeight) + lnglatOffset * a_Size;\n \n gl_Position = u_ViewProjectionMatrix * vec4(globalPoint, 1.0);\n }\n \n\n setPickingColor(a_PickingColor);\n}\n";
32
26
  var lineStyleObj = {
33
27
  solid: 0.0,
34
28
  dash: 1.0
35
29
  };
36
-
37
30
  var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
38
31
  _inherits(Arc3DModel, _BaseModel);
39
-
40
32
  var _super = _createSuper(Arc3DModel);
41
-
42
33
  function Arc3DModel() {
43
34
  var _this;
44
-
45
35
  _classCallCheck(this, Arc3DModel);
46
-
47
36
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
37
  args[_key] = arguments[_key];
49
38
  }
50
-
51
39
  _this = _super.call.apply(_super, [this].concat(args));
52
-
53
40
  _defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
54
41
  var createTexture2D = _this.rendererService.createTexture2D;
55
-
56
42
  if (_this.texture) {
57
43
  _this.texture.update({
58
44
  data: _this.iconService.getCanvas()
59
45
  });
60
-
61
46
  _this.layer.render();
62
-
63
47
  return;
64
48
  }
65
-
66
49
  _this.texture = createTexture2D({
67
50
  data: _this.iconService.getCanvas(),
68
51
  mag: gl.NEAREST,
@@ -72,53 +55,46 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
72
55
  height: _this.iconService.canvasHeight || 128
73
56
  });
74
57
  });
75
-
76
58
  return _this;
77
59
  }
78
-
79
60
  _createClass(Arc3DModel, [{
80
61
  key: "getUninforms",
81
62
  value: function getUninforms() {
82
63
  var _ref = this.layer.getLayerConfig(),
83
- _ref$opacity = _ref.opacity,
84
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
85
- sourceColor = _ref.sourceColor,
86
- targetColor = _ref.targetColor,
87
- _ref$textureBlend = _ref.textureBlend,
88
- textureBlend = _ref$textureBlend === void 0 ? 'normal' : _ref$textureBlend,
89
- _ref$lineType = _ref.lineType,
90
- lineType = _ref$lineType === void 0 ? 'solid' : _ref$lineType,
91
- _ref$dashArray = _ref.dashArray,
92
- dashArray = _ref$dashArray === void 0 ? [10, 5] : _ref$dashArray,
93
- _ref$lineTexture = _ref.lineTexture,
94
- lineTexture = _ref$lineTexture === void 0 ? false : _ref$lineTexture,
95
- _ref$iconStep = _ref.iconStep,
96
- iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
97
- _ref$segmentNumber = _ref.segmentNumber,
98
- segmentNumber = _ref$segmentNumber === void 0 ? 30 : _ref$segmentNumber,
99
- _ref$globalArcHeight = _ref.globalArcHeight,
100
- globalArcHeight = _ref$globalArcHeight === void 0 ? 10 : _ref$globalArcHeight;
101
-
64
+ _ref$opacity = _ref.opacity,
65
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
66
+ sourceColor = _ref.sourceColor,
67
+ targetColor = _ref.targetColor,
68
+ _ref$textureBlend = _ref.textureBlend,
69
+ textureBlend = _ref$textureBlend === void 0 ? 'normal' : _ref$textureBlend,
70
+ _ref$lineType = _ref.lineType,
71
+ lineType = _ref$lineType === void 0 ? 'solid' : _ref$lineType,
72
+ _ref$dashArray = _ref.dashArray,
73
+ dashArray = _ref$dashArray === void 0 ? [10, 5] : _ref$dashArray,
74
+ _ref$lineTexture = _ref.lineTexture,
75
+ lineTexture = _ref$lineTexture === void 0 ? false : _ref$lineTexture,
76
+ _ref$iconStep = _ref.iconStep,
77
+ iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
78
+ _ref$segmentNumber = _ref.segmentNumber,
79
+ segmentNumber = _ref$segmentNumber === void 0 ? 30 : _ref$segmentNumber,
80
+ _ref$globalArcHeight = _ref.globalArcHeight,
81
+ globalArcHeight = _ref$globalArcHeight === void 0 ? 10 : _ref$globalArcHeight;
102
82
  if (dashArray.length === 2) {
103
83
  dashArray.push(0, 0);
104
- } // 转化渐变色
105
-
84
+ }
106
85
 
86
+ // 转化渐变色
107
87
  var useLinearColor = 0; // 默认不生效
108
-
109
88
  var sourceColorArr = [0, 0, 0, 0];
110
89
  var targetColorArr = [0, 0, 0, 0];
111
-
112
90
  if (sourceColor && targetColor) {
113
91
  sourceColorArr = rgb2arr(sourceColor);
114
92
  targetColorArr = rgb2arr(targetColor);
115
93
  useLinearColor = 1;
116
94
  }
117
-
118
95
  if (this.rendererService.getDirty()) {
119
96
  this.texture.bind();
120
97
  }
121
-
122
98
  return {
123
99
  u_globel: 1,
124
100
  u_globel_radius: EARTH_RADIUS,
@@ -146,8 +122,7 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
146
122
  key: "getAnimateUniforms",
147
123
  value: function getAnimateUniforms() {
148
124
  var _ref2 = this.layer.getLayerConfig(),
149
- animateOption = _ref2.animateOption;
150
-
125
+ animateOption = _ref2.animateOption;
151
126
  return {
152
127
  u_animate: this.animateOption2Array(animateOption),
153
128
  u_time: this.layer.getLayerAnimateTime()
@@ -158,32 +133,26 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
158
133
  value: function () {
159
134
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
160
135
  return _regeneratorRuntime.wrap(function _callee$(_context) {
161
- while (1) {
162
- switch (_context.prev = _context.next) {
163
- case 0:
164
- this.updateTexture();
165
- this.iconService.on('imageUpdate', this.updateTexture);
166
- return _context.abrupt("return", this.buildModels());
167
-
168
- case 3:
169
- case "end":
170
- return _context.stop();
171
- }
136
+ while (1) switch (_context.prev = _context.next) {
137
+ case 0:
138
+ this.updateTexture();
139
+ this.iconService.on('imageUpdate', this.updateTexture);
140
+ return _context.abrupt("return", this.buildModels());
141
+ case 3:
142
+ case "end":
143
+ return _context.stop();
172
144
  }
173
145
  }, _callee, this);
174
146
  }));
175
-
176
147
  function initModels() {
177
148
  return _initModels.apply(this, arguments);
178
149
  }
179
-
180
150
  return initModels;
181
151
  }()
182
152
  }, {
183
153
  key: "clearModels",
184
154
  value: function clearModels() {
185
155
  var _this$texture;
186
-
187
156
  (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
188
157
  this.iconService.off('imageUpdate', this.updateTexture);
189
158
  }
@@ -191,9 +160,8 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
191
160
  key: "getShaders",
192
161
  value: function getShaders() {
193
162
  var _ref3 = this.layer.getLayerConfig(),
194
- sourceColor = _ref3.sourceColor,
195
- targetColor = _ref3.targetColor;
196
-
163
+ sourceColor = _ref3.sourceColor,
164
+ targetColor = _ref3.targetColor;
197
165
  if (sourceColor && targetColor) {
198
166
  // 分离 linear 功能
199
167
  return {
@@ -214,48 +182,40 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
214
182
  value: function () {
215
183
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
216
184
  var _ref4, _ref4$segmentNumber, segmentNumber, _this$getShaders, frag, vert, type, model;
217
-
218
185
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
219
- while (1) {
220
- switch (_context2.prev = _context2.next) {
221
- case 0:
222
- _ref4 = this.layer.getLayerConfig(), _ref4$segmentNumber = _ref4.segmentNumber, segmentNumber = _ref4$segmentNumber === void 0 ? 30 : _ref4$segmentNumber;
223
- _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
224
- _context2.next = 4;
225
- return this.layer.buildLayerModel({
226
- moduleName: 'lineEarthArc3d' + type,
227
- vertexShader: vert,
228
- fragmentShader: frag,
229
- triangulation: LineArcTriangulation,
230
- depth: {
231
- enable: true
232
- },
233
- segmentNumber: segmentNumber
234
- });
235
-
236
- case 4:
237
- model = _context2.sent;
238
- return _context2.abrupt("return", [model]);
239
-
240
- case 6:
241
- case "end":
242
- return _context2.stop();
243
- }
186
+ while (1) switch (_context2.prev = _context2.next) {
187
+ case 0:
188
+ _ref4 = this.layer.getLayerConfig(), _ref4$segmentNumber = _ref4.segmentNumber, segmentNumber = _ref4$segmentNumber === void 0 ? 30 : _ref4$segmentNumber;
189
+ _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
190
+ _context2.next = 4;
191
+ return this.layer.buildLayerModel({
192
+ moduleName: 'lineEarthArc3d' + type,
193
+ vertexShader: vert,
194
+ fragmentShader: frag,
195
+ triangulation: LineArcTriangulation,
196
+ depth: {
197
+ enable: true
198
+ },
199
+ segmentNumber: segmentNumber
200
+ });
201
+ case 4:
202
+ model = _context2.sent;
203
+ return _context2.abrupt("return", [model]);
204
+ case 6:
205
+ case "end":
206
+ return _context2.stop();
244
207
  }
245
208
  }, _callee2, this);
246
209
  }));
247
-
248
210
  function buildModels() {
249
211
  return _buildModels.apply(this, arguments);
250
212
  }
251
-
252
213
  return buildModels;
253
214
  }()
254
215
  }, {
255
216
  key: "registerBuiltinAttributes",
256
217
  value: function registerBuiltinAttributes() {
257
218
  var _this2 = this;
258
-
259
219
  this.styleAttributeService.registerStyleAttribute({
260
220
  name: 'size',
261
221
  type: AttributeType.Attribute,
@@ -270,7 +230,7 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
270
230
  size: 1,
271
231
  update: function update(feature) {
272
232
  var _feature$size = feature.size,
273
- size = _feature$size === void 0 ? 1 : _feature$size;
233
+ size = _feature$size === void 0 ? 1 : _feature$size;
274
234
  return Array.isArray(size) ? [size[0]] : [size];
275
235
  }
276
236
  }
@@ -305,24 +265,19 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
305
265
  size: 2,
306
266
  update: function update(feature) {
307
267
  var iconMap = _this2.iconService.getIconMap();
308
-
309
268
  var texture = feature.texture;
310
-
311
269
  var _ref5 = iconMap[texture] || {
312
- x: 0,
313
- y: 0
314
- },
315
- x = _ref5.x,
316
- y = _ref5.y;
317
-
270
+ x: 0,
271
+ y: 0
272
+ },
273
+ x = _ref5.x,
274
+ y = _ref5.y;
318
275
  return [x, y];
319
276
  }
320
277
  }
321
278
  });
322
279
  }
323
280
  }]);
324
-
325
281
  return Arc3DModel;
326
282
  }(BaseModel);
327
-
328
283
  export { Arc3DModel as default };
@@ -6,46 +6,35 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
-
10
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
-
12
10
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
-
14
11
  import { AttributeType, gl } from '@antv/l7-core';
15
12
  import { rgb2arr } from '@antv/l7-utils';
16
13
  import BaseModel from "../../core/BaseModel";
17
14
  import { FlowLineFillTriangulation } from "../../core/triangulation";
18
-
19
15
  /* babel-plugin-inline-import '../shaders/flow/flow_line_frag.glsl' */
20
16
  var flow_line_frag = "#extension GL_OES_standard_derivatives : enable\n\nvarying vec4 v_color;\n\n\n// line texture\n\n#pragma include \"picking\"\n\nvoid main() {\ngl_FragColor = v_color;\ngl_FragColor = filterColor(gl_FragColor);\n}\n"; // linear simple line shader
21
-
22
17
  /* babel-plugin-inline-import '../shaders/flow/flow_line_vert.glsl' */
23
18
  var flow_line_vert = "attribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec4 a_Instance;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvarying vec4 v_color;\nuniform float u_gap_width: 1.0;\nuniform float u_stroke_width: 1.0;\nuniform float u_stroke_opacity: 1.0;\n\n\nvoid main() {\n\n// #ifdef USE_ATTRIBUTE_OPACITY\n// float opacity = a_Opacity;\n// #else\n// float opacity = u_opacity;\n// #endif\n\n\n// #ifdef USE_ATTRIBUTE_OFFSETS\n// vec2 offsets = a_Offsets;\n// #else\n// vec2 offsets = u_offsets;\n// #endif\n\n // float opacity = u_opacity;\n// \u900F\u660E\u5EA6\u8BA1\u7B97\n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n vec2 flowlineDir = normalize(target - source);\n vec2 perpendicularDir = vec2(-flowlineDir.y, flowlineDir.x);\n\n\n vec2 position = mix(source, target, a_Position.x);\n\n float lengthCommon = length(target - source); \n vec2 offsetDistances = a_Size.x * project_pixel(a_Position.yz);\n vec2 limitedOffsetDistances = clamp( \n offsetDistances,\n -lengthCommon*.8, lengthCommon*.8\n );\n\n float startOffsetCommon = project_pixel(offsets[0]);\n float endOffsetCommon = project_pixel(offsets[1]);\n float endpointOffset = mix(\n clamp(startOffsetCommon, 0.0, lengthCommon*.2),\n -clamp(endOffsetCommon, 0.0, lengthCommon*.2),\n a_Position.x\n );\n\n vec2 normalsCommon = u_stroke_width * project_pixel(a_Normal.xy);\n\n float gapCommon = project_pixel(u_gap_width);\n vec3 offsetCommon = vec3(\n flowlineDir * (limitedOffsetDistances[1] + normalsCommon.y + endpointOffset * 1.05) -\n perpendicularDir * (limitedOffsetDistances[0] + gapCommon + normalsCommon.x),\n 0.0\n );\n\n\n vec4 project_pos = project_position(vec4(position.xy, 0, 1.0));\n\n vec4 fillColor = vec4(a_Color.rgb, a_Color.a * opacity);\n v_color = mix(fillColor, vec4(u_stroke.xyz, u_stroke.w * fillColor.w * u_stroke_opacity), a_Normal.z);\n\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offsetCommon.xy, 0., 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offsetCommon.xy, 0., 1.0));\n }\n\n\n\n setPickingColor(a_PickingColor);\n}\n";
24
-
25
19
  var FlowLineModel = /*#__PURE__*/function (_BaseModel) {
26
20
  _inherits(FlowLineModel, _BaseModel);
27
-
28
21
  var _super = _createSuper(FlowLineModel);
29
-
30
22
  function FlowLineModel() {
31
23
  _classCallCheck(this, FlowLineModel);
32
-
33
24
  return _super.apply(this, arguments);
34
25
  }
35
-
36
26
  _createClass(FlowLineModel, [{
37
27
  key: "getUninforms",
38
28
  value: function getUninforms() {
39
29
  var _ref = this.layer.getLayerConfig(),
40
- _ref$gapWidth = _ref.gapWidth,
41
- gapWidth = _ref$gapWidth === void 0 ? 2 : _ref$gapWidth,
42
- _ref$strokeWidth = _ref.strokeWidth,
43
- strokeWidth = _ref$strokeWidth === void 0 ? 1 : _ref$strokeWidth,
44
- _ref$stroke = _ref.stroke,
45
- stroke = _ref$stroke === void 0 ? '#000' : _ref$stroke,
46
- _ref$strokeOpacity = _ref.strokeOpacity,
47
- strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity;
48
-
30
+ _ref$gapWidth = _ref.gapWidth,
31
+ gapWidth = _ref$gapWidth === void 0 ? 2 : _ref$gapWidth,
32
+ _ref$strokeWidth = _ref.strokeWidth,
33
+ strokeWidth = _ref$strokeWidth === void 0 ? 1 : _ref$strokeWidth,
34
+ _ref$stroke = _ref.stroke,
35
+ stroke = _ref$stroke === void 0 ? '#000' : _ref$stroke,
36
+ _ref$strokeOpacity = _ref.strokeOpacity,
37
+ strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity;
49
38
  return _objectSpread({
50
39
  // u_opacity: opacity,
51
40
  // u_offsets: offsets,
@@ -60,23 +49,18 @@ var FlowLineModel = /*#__PURE__*/function (_BaseModel) {
60
49
  value: function () {
61
50
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
62
51
  return _regeneratorRuntime.wrap(function _callee$(_context) {
63
- while (1) {
64
- switch (_context.prev = _context.next) {
65
- case 0:
66
- return _context.abrupt("return", this.buildModels());
67
-
68
- case 1:
69
- case "end":
70
- return _context.stop();
71
- }
52
+ while (1) switch (_context.prev = _context.next) {
53
+ case 0:
54
+ return _context.abrupt("return", this.buildModels());
55
+ case 1:
56
+ case "end":
57
+ return _context.stop();
72
58
  }
73
59
  }, _callee, this);
74
60
  }));
75
-
76
61
  function initModels() {
77
62
  return _initModels.apply(this, arguments);
78
63
  }
79
-
80
64
  return initModels;
81
65
  }()
82
66
  }, {
@@ -85,39 +69,33 @@ var FlowLineModel = /*#__PURE__*/function (_BaseModel) {
85
69
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
86
70
  var modelFill;
87
71
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
88
- while (1) {
89
- switch (_context2.prev = _context2.next) {
90
- case 0:
91
- _context2.next = 2;
92
- return this.layer.buildLayerModel({
93
- moduleName: 'flow_line',
94
- vertexShader: flow_line_vert,
95
- fragmentShader: flow_line_frag,
96
- inject: this.getInject(),
97
- triangulation: FlowLineFillTriangulation,
98
- primitive: gl.TRIANGLES,
99
- depth: {
100
- enable: false
101
- },
102
- pick: false
103
- });
104
-
105
- case 2:
106
- modelFill = _context2.sent;
107
- return _context2.abrupt("return", [modelFill]);
108
-
109
- case 4:
110
- case "end":
111
- return _context2.stop();
112
- }
72
+ while (1) switch (_context2.prev = _context2.next) {
73
+ case 0:
74
+ _context2.next = 2;
75
+ return this.layer.buildLayerModel({
76
+ moduleName: 'flow_line',
77
+ vertexShader: flow_line_vert,
78
+ fragmentShader: flow_line_frag,
79
+ inject: this.getInject(),
80
+ triangulation: FlowLineFillTriangulation,
81
+ primitive: gl.TRIANGLES,
82
+ depth: {
83
+ enable: false
84
+ },
85
+ pick: false
86
+ });
87
+ case 2:
88
+ modelFill = _context2.sent;
89
+ return _context2.abrupt("return", [modelFill]);
90
+ case 4:
91
+ case "end":
92
+ return _context2.stop();
113
93
  }
114
94
  }, _callee2, this);
115
95
  }));
116
-
117
96
  function buildModels() {
118
97
  return _buildModels.apply(this, arguments);
119
98
  }
120
-
121
99
  return buildModels;
122
100
  }()
123
101
  }, {
@@ -139,7 +117,7 @@ var FlowLineModel = /*#__PURE__*/function (_BaseModel) {
139
117
  size: 2,
140
118
  update: function update(feature) {
141
119
  var _feature$size = feature.size,
142
- size = _feature$size === void 0 ? 1 : _feature$size;
120
+ size = _feature$size === void 0 ? 1 : _feature$size;
143
121
  return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
144
122
  }
145
123
  }
@@ -180,8 +158,6 @@ var FlowLineModel = /*#__PURE__*/function (_BaseModel) {
180
158
  });
181
159
  }
182
160
  }]);
183
-
184
161
  return FlowLineModel;
185
162
  }(BaseModel);
186
-
187
163
  export { FlowLineModel as default };