@antv/l7-layers 2.16.1 → 2.16.2

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 (386) 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.d.ts +3 -0
  10. package/es/core/BaseLayer.js +360 -528
  11. package/es/core/BaseModel.d.ts +9 -71
  12. package/es/core/BaseModel.js +118 -429
  13. package/es/core/CommonStyleAttribute.d.ts +2 -0
  14. package/es/core/CommonStyleAttribute.js +66 -0
  15. package/es/core/LayerPickService.js +21 -32
  16. package/es/core/TextureService.js +0 -13
  17. package/es/core/interface.d.ts +13 -3
  18. package/es/core/interface.js +17 -24
  19. package/es/core/shape/Path.js +13 -20
  20. package/es/core/shape/extrude.js +27 -36
  21. package/es/core/triangulation.d.ts +12 -0
  22. package/es/core/triangulation.js +124 -114
  23. package/es/earth/index.js +9 -33
  24. package/es/earth/models/atmosphere.js +30 -54
  25. package/es/earth/models/base.js +47 -85
  26. package/es/earth/models/bloomsphere.js +30 -54
  27. package/es/earth/utils.js +9 -13
  28. package/es/heatmap/index.js +10 -40
  29. package/es/heatmap/models/grid.js +29 -53
  30. package/es/heatmap/models/grid3d.js +29 -53
  31. package/es/heatmap/models/heatmap.d.ts +1 -0
  32. package/es/heatmap/models/heatmap.js +99 -150
  33. package/es/heatmap/models/hexagon.js +29 -53
  34. package/es/heatmap/shaders/grid_vert.glsl +2 -2
  35. package/es/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
  36. package/es/heatmap/shaders/hexagon_vert.glsl +2 -2
  37. package/es/heatmap/triangulation.js +0 -4
  38. package/es/image/index.js +9 -28
  39. package/es/image/models/image.js +66 -100
  40. package/es/index.js +9 -17
  41. package/es/line/index.d.ts +1 -0
  42. package/es/line/index.js +12 -36
  43. package/es/line/models/arc.js +72 -160
  44. package/es/line/models/arc_3d.js +67 -148
  45. package/es/line/models/earthArc_3d.js +66 -148
  46. package/es/line/models/{half.d.ts → flow.d.ts} +1 -11
  47. package/es/line/models/flow.js +167 -0
  48. package/es/line/models/great_circle.js +57 -135
  49. package/es/line/models/index.d.ts +1 -1
  50. package/es/line/models/index.js +3 -3
  51. package/es/line/models/line.js +98 -186
  52. package/es/line/models/linearline.js +46 -115
  53. package/es/line/models/simpleLine.d.ts +0 -1
  54. package/es/line/models/simpleLine.js +42 -114
  55. package/es/line/models/wall.js +52 -92
  56. package/es/line/shaders/dash/arc_dash_frag.glsl +3 -6
  57. package/es/line/shaders/dash/arc_dash_vert.glsl +6 -46
  58. package/es/line/shaders/dash/line_dash_frag.glsl +4 -7
  59. package/es/line/shaders/dash/line_dash_vert.glsl +3 -33
  60. package/es/line/shaders/flow/flow_line_frag.glsl +13 -0
  61. package/es/line/shaders/flow/flow_line_vert.glsl +83 -0
  62. package/es/line/shaders/line_arc_3d_frag.glsl +6 -6
  63. package/es/line/shaders/line_arc_3d_vert.glsl +4 -34
  64. package/es/line/shaders/line_arc_frag.glsl +7 -11
  65. package/es/line/shaders/line_arc_great_circle_frag.glsl +5 -6
  66. package/es/line/shaders/line_arc_great_circle_vert.glsl +4 -32
  67. package/es/line/shaders/line_arc_vert.glsl +9 -45
  68. package/es/line/shaders/line_frag.glsl +15 -17
  69. package/es/line/shaders/line_vert.glsl +3 -34
  70. package/es/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
  71. package/es/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
  72. package/es/line/shaders/linear/arc_linear_frag.glsl +2 -30
  73. package/es/line/shaders/linear/arc_linear_vert.glsl +9 -45
  74. package/es/line/shaders/linear/line_linear_frag.glsl +5 -6
  75. package/es/line/shaders/linearLine/line_linear_frag.glsl +2 -14
  76. package/es/line/shaders/linearLine/line_linear_vert.glsl +14 -32
  77. package/es/line/shaders/simple/simpleline_frag.glsl +1 -5
  78. package/es/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
  79. package/es/line/shaders/simple/simpleline_vert.glsl +7 -33
  80. package/es/mask/index.js +9 -28
  81. package/es/mask/models/fill.js +29 -54
  82. package/es/plugins/DataMappingPlugin.js +90 -141
  83. package/es/plugins/DataSourcePlugin.js +45 -68
  84. package/es/plugins/FeatureScalePlugin.js +67 -122
  85. package/es/plugins/LayerAnimateStylePlugin.js +0 -5
  86. package/es/plugins/LayerMaskPlugin.js +3 -11
  87. package/es/plugins/LayerModelPlugin.js +79 -104
  88. package/es/plugins/LayerStylePlugin.js +3 -9
  89. package/es/plugins/LightingPlugin.js +12 -18
  90. package/es/plugins/MultiPassRendererPlugin.js +11 -16
  91. package/es/plugins/PixelPickingPlugin.js +12 -21
  92. package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
  93. package/es/plugins/ShaderUniformPlugin.js +15 -29
  94. package/es/plugins/UpdateModelPlugin.js +0 -5
  95. package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
  96. package/es/point/index.d.ts +1 -0
  97. package/es/point/index.js +27 -77
  98. package/es/point/models/earthExtrude.d.ts +0 -3
  99. package/es/point/models/earthExtrude.js +60 -139
  100. package/es/point/models/earthFill.d.ts +0 -1
  101. package/es/point/models/earthFill.js +59 -140
  102. package/es/point/models/extrude.d.ts +0 -3
  103. package/es/point/models/extrude.js +60 -140
  104. package/es/point/models/fill.d.ts +0 -1
  105. package/es/point/models/fill.js +67 -158
  106. package/es/point/models/fillmage.js +66 -147
  107. package/es/point/models/image.js +52 -126
  108. package/es/point/models/index.js +2 -2
  109. package/es/point/models/normal.js +32 -56
  110. package/es/point/models/radar.d.ts +0 -1
  111. package/es/point/models/radar.js +42 -75
  112. package/es/point/models/simplePoint.d.ts +0 -1
  113. package/es/point/models/simplePoint.js +46 -115
  114. package/es/point/models/text.js +211 -344
  115. package/es/point/shaders/animate/wave_frag.glsl +1 -11
  116. package/es/point/shaders/earth/extrude_frag.glsl +5 -17
  117. package/es/point/shaders/earth/extrude_vert.glsl +14 -29
  118. package/es/point/shaders/earth/fill_frag.glsl +5 -14
  119. package/es/point/shaders/earth/fill_vert.glsl +1 -75
  120. package/es/point/shaders/extrude/extrude_frag.glsl +3 -29
  121. package/es/point/shaders/extrude/extrude_vert.glsl +27 -35
  122. package/es/point/shaders/fill_frag.glsl +9 -20
  123. package/es/point/shaders/fill_vert.glsl +16 -101
  124. package/es/point/shaders/image/fillImage_frag.glsl +2 -5
  125. package/es/point/shaders/image/fillImage_vert.glsl +4 -47
  126. package/es/point/shaders/image_frag.glsl +1 -5
  127. package/es/point/shaders/image_vert.glsl +1 -44
  128. package/es/point/shaders/normal_frag.glsl +0 -2
  129. package/es/point/shaders/normal_vert.glsl +2 -1
  130. package/es/point/shaders/radar/radar_vert.glsl +2 -2
  131. package/es/point/shaders/simplePoint_frag.glsl +0 -7
  132. package/es/point/shaders/simplePoint_vert.glsl +3 -45
  133. package/es/point/shaders/text_frag.glsl +6 -19
  134. package/es/point/shaders/text_vert.glsl +5 -66
  135. package/es/point/shape/extrude.js +4 -13
  136. package/es/polygon/index.d.ts +1 -0
  137. package/es/polygon/index.js +12 -40
  138. package/es/polygon/models/extrude.d.ts +0 -3
  139. package/es/polygon/models/extrude.js +122 -162
  140. package/es/polygon/models/fill.d.ts +0 -4
  141. package/es/polygon/models/fill.js +57 -130
  142. package/es/polygon/models/index.js +3 -2
  143. package/es/polygon/models/ocean.js +42 -76
  144. package/es/polygon/models/water.js +37 -71
  145. package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
  146. package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
  147. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
  148. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
  149. package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
  150. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
  151. package/es/polygon/shaders/polygon_frag.glsl +0 -5
  152. package/es/polygon/shaders/polygon_linear_frag.glsl +0 -8
  153. package/es/polygon/shaders/polygon_linear_vert.glsl +0 -32
  154. package/es/polygon/shaders/polygon_vert.glsl +1 -27
  155. package/es/raster/buffers/triangulation.js +2 -4
  156. package/es/raster/index.js +9 -32
  157. package/es/raster/models/raster.js +80 -116
  158. package/es/raster/models/rasterRgb.js +84 -127
  159. package/es/raster/models/rasterTerrainRgb.js +56 -84
  160. package/es/tile/interaction/getRasterData.js +14 -20
  161. package/es/tile/interaction/utils.js +7 -9
  162. package/es/tile/manager/base.js +63 -96
  163. package/es/tile/service/TileLayerService.js +33 -55
  164. package/es/tile/service/TilePickService.js +26 -40
  165. package/es/tile/service/TileSourceService.js +3 -7
  166. package/es/tile/tileFactory/DebugTile.js +29 -46
  167. package/es/tile/tileFactory/ImageTile.js +20 -38
  168. package/es/tile/tileFactory/MaskTile.js +22 -43
  169. package/es/tile/tileFactory/RasterRGBTile.js +22 -42
  170. package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
  171. package/es/tile/tileFactory/RasterTile.js +30 -53
  172. package/es/tile/tileFactory/Tile.js +63 -97
  173. package/es/tile/tileFactory/VectorTile.js +41 -68
  174. package/es/tile/tileFactory/index.js +0 -11
  175. package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
  176. package/es/tile/tileFactory/util.js +0 -3
  177. package/es/tile/tileLayer/BaseLayer.js +105 -146
  178. package/es/tile/utils.js +1 -1
  179. package/es/utils/blend.js +0 -2
  180. package/es/utils/collision-index.js +9 -16
  181. package/es/utils/extrude_polyline.js +101 -149
  182. package/es/utils/grid-index.js +2 -27
  183. package/es/utils/identityScale.js +0 -8
  184. package/es/utils/layerData.js +32 -46
  185. package/es/utils/multiPassRender.js +11 -13
  186. package/es/utils/polylineNormal.js +31 -37
  187. package/es/utils/simpleLine.js +2 -16
  188. package/es/utils/stencil.js +2 -3
  189. package/es/utils/symbol-layout.js +27 -53
  190. package/es/wind/index.js +9 -29
  191. package/es/wind/models/utils.js +26 -51
  192. package/es/wind/models/wind.js +101 -147
  193. package/es/wind/models/windRender.js +53 -66
  194. package/lib/Geometry/index.js +9 -38
  195. package/lib/Geometry/models/billboard.js +51 -97
  196. package/lib/Geometry/models/index.js +0 -5
  197. package/lib/Geometry/models/plane.js +79 -151
  198. package/lib/Geometry/models/sprite.js +60 -127
  199. package/lib/canvas/index.js +10 -40
  200. package/lib/canvas/models/canvas.js +41 -101
  201. package/lib/canvas/models/index.js +0 -3
  202. package/lib/citybuliding/building.js +8 -35
  203. package/lib/citybuliding/models/build.js +57 -92
  204. package/lib/core/BaseLayer.js +358 -520
  205. package/lib/core/BaseModel.js +117 -441
  206. package/lib/core/CommonStyleAttribute.js +72 -0
  207. package/lib/core/LayerPickService.js +21 -37
  208. package/lib/core/TextureService.js +0 -16
  209. package/lib/core/interface.js +21 -31
  210. package/lib/core/schema.js +0 -1
  211. package/lib/core/shape/Path.js +14 -31
  212. package/lib/core/shape/extrude.js +27 -59
  213. package/lib/core/triangulation.js +125 -153
  214. package/lib/earth/index.js +9 -43
  215. package/lib/earth/models/atmosphere.js +30 -63
  216. package/lib/earth/models/base.js +47 -90
  217. package/lib/earth/models/bloomsphere.js +30 -63
  218. package/lib/earth/utils.js +7 -31
  219. package/lib/heatmap/index.js +10 -48
  220. package/lib/heatmap/models/grid.js +29 -61
  221. package/lib/heatmap/models/grid3d.js +29 -61
  222. package/lib/heatmap/models/heatmap.js +99 -166
  223. package/lib/heatmap/models/hexagon.js +29 -61
  224. package/lib/heatmap/models/index.js +0 -6
  225. package/lib/heatmap/shaders/grid_vert.glsl +2 -2
  226. package/lib/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
  227. package/lib/heatmap/shaders/hexagon_vert.glsl +2 -2
  228. package/lib/heatmap/triangulation.js +0 -5
  229. package/lib/image/index.js +9 -36
  230. package/lib/image/models/image.js +66 -109
  231. package/lib/image/models/index.js +0 -3
  232. package/lib/index.js +7 -61
  233. package/lib/line/index.js +12 -42
  234. package/lib/line/models/arc.js +70 -170
  235. package/lib/line/models/arc_3d.js +65 -159
  236. package/lib/line/models/earthArc_3d.js +64 -159
  237. package/lib/line/models/flow.js +174 -0
  238. package/lib/line/models/great_circle.js +57 -146
  239. package/lib/line/models/index.js +3 -14
  240. package/lib/line/models/line.js +96 -194
  241. package/lib/line/models/linearline.js +46 -127
  242. package/lib/line/models/simpleLine.js +42 -124
  243. package/lib/line/models/wall.js +52 -103
  244. package/lib/line/shaders/dash/arc_dash_frag.glsl +3 -6
  245. package/lib/line/shaders/dash/arc_dash_vert.glsl +6 -46
  246. package/lib/line/shaders/dash/line_dash_frag.glsl +4 -7
  247. package/lib/line/shaders/dash/line_dash_vert.glsl +3 -33
  248. package/lib/line/shaders/flow/flow_line_frag.glsl +13 -0
  249. package/lib/line/shaders/flow/flow_line_vert.glsl +83 -0
  250. package/lib/line/shaders/line_arc_3d_frag.glsl +6 -6
  251. package/lib/line/shaders/line_arc_3d_vert.glsl +4 -34
  252. package/lib/line/shaders/line_arc_frag.glsl +7 -11
  253. package/lib/line/shaders/line_arc_great_circle_frag.glsl +5 -6
  254. package/lib/line/shaders/line_arc_great_circle_vert.glsl +4 -32
  255. package/lib/line/shaders/line_arc_vert.glsl +9 -45
  256. package/lib/line/shaders/line_frag.glsl +15 -17
  257. package/lib/line/shaders/line_vert.glsl +3 -34
  258. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
  259. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
  260. package/lib/line/shaders/linear/arc_linear_frag.glsl +2 -30
  261. package/lib/line/shaders/linear/arc_linear_vert.glsl +9 -45
  262. package/lib/line/shaders/linear/line_linear_frag.glsl +5 -6
  263. package/lib/line/shaders/linearLine/line_linear_frag.glsl +2 -14
  264. package/lib/line/shaders/linearLine/line_linear_vert.glsl +14 -32
  265. package/lib/line/shaders/simple/simpleline_frag.glsl +1 -5
  266. package/lib/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
  267. package/lib/line/shaders/simple/simpleline_vert.glsl +7 -33
  268. package/lib/mask/index.js +9 -36
  269. package/lib/mask/models/fill.js +29 -63
  270. package/lib/mask/models/index.js +0 -3
  271. package/lib/plugins/DataMappingPlugin.js +90 -152
  272. package/lib/plugins/DataSourcePlugin.js +45 -76
  273. package/lib/plugins/FeatureScalePlugin.js +67 -138
  274. package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
  275. package/lib/plugins/LayerMaskPlugin.js +4 -17
  276. package/lib/plugins/LayerModelPlugin.js +80 -113
  277. package/lib/plugins/LayerStylePlugin.js +4 -14
  278. package/lib/plugins/LightingPlugin.js +12 -25
  279. package/lib/plugins/MultiPassRendererPlugin.js +11 -22
  280. package/lib/plugins/PixelPickingPlugin.js +12 -27
  281. package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
  282. package/lib/plugins/ShaderUniformPlugin.js +15 -36
  283. package/lib/plugins/UpdateModelPlugin.js +1 -10
  284. package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
  285. package/lib/point/index.js +27 -83
  286. package/lib/point/models/earthExtrude.js +60 -150
  287. package/lib/point/models/earthFill.js +59 -170
  288. package/lib/point/models/extrude.js +60 -150
  289. package/lib/point/models/fill.js +65 -167
  290. package/lib/point/models/fillmage.js +64 -155
  291. package/lib/point/models/image.js +52 -136
  292. package/lib/point/models/index.js +1 -12
  293. package/lib/point/models/normal.js +32 -66
  294. package/lib/point/models/radar.js +42 -85
  295. package/lib/point/models/simplePoint.js +46 -125
  296. package/lib/point/models/text.js +209 -350
  297. package/lib/point/shaders/animate/wave_frag.glsl +1 -11
  298. package/lib/point/shaders/earth/extrude_frag.glsl +5 -17
  299. package/lib/point/shaders/earth/extrude_vert.glsl +14 -29
  300. package/lib/point/shaders/earth/fill_frag.glsl +5 -14
  301. package/lib/point/shaders/earth/fill_vert.glsl +1 -75
  302. package/lib/point/shaders/extrude/extrude_frag.glsl +3 -29
  303. package/lib/point/shaders/extrude/extrude_vert.glsl +27 -35
  304. package/lib/point/shaders/fill_frag.glsl +9 -20
  305. package/lib/point/shaders/fill_vert.glsl +16 -101
  306. package/lib/point/shaders/image/fillImage_frag.glsl +2 -5
  307. package/lib/point/shaders/image/fillImage_vert.glsl +4 -47
  308. package/lib/point/shaders/image_frag.glsl +1 -5
  309. package/lib/point/shaders/image_vert.glsl +1 -44
  310. package/lib/point/shaders/normal_frag.glsl +0 -2
  311. package/lib/point/shaders/normal_vert.glsl +2 -1
  312. package/lib/point/shaders/radar/radar_vert.glsl +2 -2
  313. package/lib/point/shaders/simplePoint_frag.glsl +0 -7
  314. package/lib/point/shaders/simplePoint_vert.glsl +3 -45
  315. package/lib/point/shaders/text_frag.glsl +6 -19
  316. package/lib/point/shaders/text_vert.glsl +5 -66
  317. package/lib/point/shape/extrude.js +4 -20
  318. package/lib/polygon/index.js +12 -48
  319. package/lib/polygon/models/extrude.js +122 -173
  320. package/lib/polygon/models/fill.js +57 -140
  321. package/lib/polygon/models/index.js +2 -14
  322. package/lib/polygon/models/ocean.js +42 -88
  323. package/lib/polygon/models/water.js +37 -82
  324. package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
  325. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
  326. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
  327. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
  328. package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
  329. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
  330. package/lib/polygon/shaders/polygon_frag.glsl +0 -5
  331. package/lib/polygon/shaders/polygon_linear_frag.glsl +0 -8
  332. package/lib/polygon/shaders/polygon_linear_vert.glsl +0 -32
  333. package/lib/polygon/shaders/polygon_vert.glsl +1 -27
  334. package/lib/raster/buffers/triangulation.js +3 -7
  335. package/lib/raster/index.js +9 -40
  336. package/lib/raster/models/index.js +0 -5
  337. package/lib/raster/models/raster.js +80 -125
  338. package/lib/raster/models/rasterRgb.js +84 -139
  339. package/lib/raster/models/rasterTerrainRgb.js +56 -93
  340. package/lib/tile/interaction/getRasterData.js +14 -25
  341. package/lib/tile/interaction/utils.js +7 -19
  342. package/lib/tile/manager/base.js +63 -104
  343. package/lib/tile/service/TileLayerService.js +33 -60
  344. package/lib/tile/service/TilePickService.js +26 -48
  345. package/lib/tile/service/TileSourceService.js +2 -16
  346. package/lib/tile/style/utils.js +0 -3
  347. package/lib/tile/tileFactory/DebugTile.js +29 -54
  348. package/lib/tile/tileFactory/ImageTile.js +20 -46
  349. package/lib/tile/tileFactory/MaskTile.js +22 -51
  350. package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
  351. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
  352. package/lib/tile/tileFactory/RasterTile.js +30 -63
  353. package/lib/tile/tileFactory/Tile.js +63 -102
  354. package/lib/tile/tileFactory/VectorTile.js +41 -76
  355. package/lib/tile/tileFactory/index.js +0 -25
  356. package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
  357. package/lib/tile/tileFactory/util.js +0 -9
  358. package/lib/tile/tileLayer/BaseLayer.js +105 -153
  359. package/lib/tile/utils.js +1 -5
  360. package/lib/utils/blend.js +0 -5
  361. package/lib/utils/collision-index.js +9 -25
  362. package/lib/utils/extrude_polyline.js +101 -181
  363. package/lib/utils/grid-index.js +2 -28
  364. package/lib/utils/identityScale.js +0 -9
  365. package/lib/utils/layerData.js +32 -51
  366. package/lib/utils/multiPassRender.js +11 -16
  367. package/lib/utils/polylineNormal.js +31 -66
  368. package/lib/utils/simpleLine.js +2 -21
  369. package/lib/utils/stencil.js +0 -4
  370. package/lib/utils/symbol-layout.js +27 -55
  371. package/lib/wind/index.js +9 -37
  372. package/lib/wind/models/index.js +0 -3
  373. package/lib/wind/models/utils.js +26 -62
  374. package/lib/wind/models/wind.js +101 -157
  375. package/lib/wind/models/windRender.js +53 -71
  376. package/lib/wind/models/windShader.js +0 -1
  377. package/package.json +7 -7
  378. package/es/line/models/half.js +0 -298
  379. package/es/line/shaders/half/line_half_frag.glsl +0 -53
  380. package/es/line/shaders/half/line_half_vert.glsl +0 -169
  381. package/es/utils/dataMappingStyle.d.ts +0 -31
  382. package/es/utils/dataMappingStyle.js +0 -147
  383. package/lib/line/models/half.js +0 -315
  384. package/lib/line/shaders/half/line_half_frag.glsl +0 -53
  385. package/lib/line/shaders/half/line_half_vert.glsl +0 -169
  386. package/lib/utils/dataMappingStyle.js +0 -151
@@ -1,61 +1,46 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.Wind = void 0;
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
-
18
12
  var glUtils = _interopRequireWildcard(require("./utils"));
19
-
20
13
  var _windShader = require("./windShader");
21
-
22
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
16
  function getColorRamp(colors) {
27
17
  var canvas = document.createElement('canvas');
28
18
  var ctx = canvas.getContext('2d');
29
19
  canvas.width = 256;
30
20
  canvas.height = 1;
31
21
  var gradient = ctx.createLinearGradient(0, 0, 256, 0);
32
-
33
22
  for (var _i = 0, _Object$keys = Object.keys(colors); _i < _Object$keys.length; _i++) {
34
23
  var stop = _Object$keys[_i];
35
24
  gradient.addColorStop(+stop, colors[+stop]);
36
25
  }
37
-
38
26
  ctx.fillStyle = gradient;
39
- ctx.fillRect(0, 0, 256, 1); // @ts-ignore dispose canvas element
27
+ ctx.fillRect(0, 0, 256, 1);
40
28
 
29
+ // @ts-ignore dispose canvas element
41
30
  canvas = null;
42
31
  return new Uint8Array(ctx.getImageData(0, 0, 256, 1).data);
43
32
  }
44
-
45
33
  function bindAttribute(gl, buffer, attribute, numComponents) {
46
34
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
47
35
  gl.enableVertexAttribArray(attribute);
48
36
  gl.vertexAttribPointer(attribute, numComponents, gl.FLOAT, false, 0, 0);
49
37
  }
50
-
51
38
  function bindFramebuffer(gl, framebuffer, texture) {
52
39
  gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
53
-
54
40
  if (texture) {
55
41
  gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
56
42
  }
57
43
  }
58
-
59
44
  var Wind = /*#__PURE__*/function () {
60
45
  function Wind(options) {
61
46
  (0, _classCallCheck2.default)(this, Wind);
@@ -72,17 +57,13 @@ var Wind = /*#__PURE__*/function () {
72
57
  this.rampColors = options.rampColors;
73
58
  this.init();
74
59
  }
75
-
76
60
  (0, _createClass2.default)(Wind, [{
77
61
  key: "init",
78
62
  value: function init() {
79
63
  var gl = this.gl;
80
64
  this.fadeOpacity = 0.996; // how fast the particle trails fade on each frame
81
-
82
65
  this.speedFactor = 0.25; // how fast the particles move
83
-
84
66
  this.dropRate = 0.003; // how often the particles move to a random place
85
-
86
67
  this.dropRateBump = 0.01; // drop rate increase relative to individual particle speed
87
68
 
88
69
  this.drawProgram = glUtils.createProgram(gl, _windShader.drawVert, _windShader.drawFrag);
@@ -91,29 +72,28 @@ var Wind = /*#__PURE__*/function () {
91
72
  this.quadBuffer = glUtils.createBuffer(gl, new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]));
92
73
  this.framebuffer = gl.createFramebuffer();
93
74
  this.colorRampTexture = glUtils.createTexture(this.gl, this.gl.LINEAR, getColorRamp(this.rampColors), 16, 16);
94
- var emptyPixels = new Uint8Array(this.width * this.height * 4); // screen textures to hold the drawn screen for the previous and the current frame
75
+ var emptyPixels = new Uint8Array(this.width * this.height * 4);
95
76
 
96
- this.backgroundTexture = glUtils.createTexture(gl, gl.NEAREST, emptyPixels, this.width, this.height);
97
- this.screenTexture = glUtils.createTexture(gl, gl.NEAREST, emptyPixels, this.width, this.height); // we create a square texture where each pixel will hold a particle position encoded as RGBA
77
+ // screen textures to hold the drawn screen for the previous and the current frame
98
78
 
99
- var particleRes = this.particleStateResolution = Math.ceil(Math.sqrt(this.numParticles)); // particleRes size
79
+ this.backgroundTexture = glUtils.createTexture(gl, gl.NEAREST, emptyPixels, this.width, this.height);
80
+ this.screenTexture = glUtils.createTexture(gl, gl.NEAREST, emptyPixels, this.width, this.height);
100
81
 
82
+ // we create a square texture where each pixel will hold a particle position encoded as RGBA
83
+ var particleRes = this.particleStateResolution = Math.ceil(Math.sqrt(this.numParticles));
84
+ // particleRes size
101
85
  this.numParticlesSize = particleRes * particleRes;
102
86
  var particleState = new Uint8Array(this.numParticlesSize * 4);
103
-
104
87
  for (var i = 0; i < particleState.length; i++) {
105
88
  particleState[i] = Math.floor(Math.random() * 256); // randomize the initial particle positions
106
- } // textures to hold the particle state for the current and the next frame
107
-
108
-
89
+ }
90
+ // textures to hold the particle state for the current and the next frame
109
91
  this.particleStateTexture0 = glUtils.createTexture(gl, gl.NEAREST, particleState, particleRes, particleRes);
110
92
  this.particleStateTexture1 = glUtils.createTexture(gl, gl.NEAREST, particleState, particleRes, particleRes);
111
93
  var particleIndices = new Float32Array(this.numParticlesSize);
112
-
113
94
  for (var i$1 = 0; i$1 < this.numParticlesSize; i$1++) {
114
95
  particleIndices[i$1] = i$1;
115
96
  }
116
-
117
97
  this.particleIndexBuffer = glUtils.createBuffer(gl, particleIndices);
118
98
  }
119
99
  }, {
@@ -122,40 +102,36 @@ var Wind = /*#__PURE__*/function () {
122
102
  this.windData = windData;
123
103
  this.windTexture = glUtils.createDataTexture(this.gl, this.gl.LINEAR, windData.image);
124
104
  }
105
+
125
106
  /**
126
107
  * 更新风场粒子数量
127
108
  * @param num
128
109
  */
129
-
130
110
  }, {
131
111
  key: "updateParticelNum",
132
112
  value: function updateParticelNum(num) {
133
113
  var gl = this.gl;
134
-
135
114
  if (num !== this.numParticles) {
136
115
  this.numParticles = num; // params number
137
- // we create a square texture where each pixel will hold a particle position encoded as RGBA
138
116
 
117
+ // we create a square texture where each pixel will hold a particle position encoded as RGBA
139
118
  var particleRes = this.particleStateResolution = Math.ceil(Math.sqrt(this.numParticles));
140
119
  this.numParticlesSize = particleRes * particleRes;
141
120
  var particleState = new Uint8Array(this.numParticlesSize * 4);
142
-
143
121
  for (var i = 0; i < particleState.length; i++) {
144
122
  particleState[i] = Math.floor(Math.random() * 256); // randomize the initial particle positions
145
- } // textures to hold the particle state for the current and the next frame
146
-
147
-
123
+ }
124
+ // textures to hold the particle state for the current and the next frame
148
125
  this.particleStateTexture0 = glUtils.createTexture(gl, gl.NEAREST, particleState, particleRes, particleRes);
149
126
  this.particleStateTexture1 = glUtils.createTexture(gl, gl.NEAREST, particleState, particleRes, particleRes);
150
127
  var particleIndices = new Float32Array(this.numParticlesSize);
151
-
152
128
  for (var i$1 = 0; i$1 < this.numParticlesSize; i$1++) {
153
129
  particleIndices[i$1] = i$1;
154
130
  }
155
-
156
131
  this.particleIndexBuffer = glUtils.createBuffer(gl, particleIndices);
157
132
  }
158
133
  }
134
+
159
135
  /**
160
136
  * 更新风场风向风速
161
137
  * @param uMin
@@ -163,7 +139,6 @@ var Wind = /*#__PURE__*/function () {
163
139
  * @param vMin
164
140
  * @param vMax
165
141
  */
166
-
167
142
  }, {
168
143
  key: "updateWindDir",
169
144
  value: function updateWindDir(uMin, uMax, vMin, vMax) {
@@ -172,11 +147,11 @@ var Wind = /*#__PURE__*/function () {
172
147
  this.windData.vMin = vMin;
173
148
  this.windData.vMax = vMax;
174
149
  }
150
+
175
151
  /**
176
152
  * update rampColors
177
153
  * @param rampColors
178
154
  */
179
-
180
155
  }, {
181
156
  key: "updateColorRampTexture",
182
157
  value: function updateColorRampTexture(rampColors) {
@@ -191,23 +166,18 @@ var Wind = /*#__PURE__*/function () {
191
166
  key: "isColorChanged",
192
167
  value: function isColorChanged(rampColors) {
193
168
  var keys = Object.keys(rampColors);
194
-
195
169
  for (var _i2 = 0, _keys = keys; _i2 < _keys.length; _i2++) {
196
170
  var item = _keys[_i2];
197
-
198
- var _key = Number(item); // exist new key -> color need update
199
-
200
-
171
+ var _key = Number(item);
172
+ // exist new key -> color need update
201
173
  if (!this.rampColors[_key]) {
202
174
  return true;
203
- } // value changed -> color need update
204
-
205
-
175
+ }
176
+ // value changed -> color need update
206
177
  if (this.rampColors[_key] && this.rampColors[_key] !== rampColors[_key]) {
207
178
  return true;
208
179
  }
209
180
  }
210
-
211
181
  return false;
212
182
  }
213
183
  }, {
@@ -219,8 +189,8 @@ var Wind = /*#__PURE__*/function () {
219
189
  gl.deleteTexture(this.screenTexture);
220
190
  this.width = width;
221
191
  this.height = height;
222
- var emptyPixels = new Uint8Array(width * height * 4); // screen textures to hold the drawn screen for the previous and the current frame
223
-
192
+ var emptyPixels = new Uint8Array(width * height * 4);
193
+ // screen textures to hold the drawn screen for the previous and the current frame
224
194
  this.backgroundTexture = glUtils.createTexture(gl, gl.NEAREST, emptyPixels, width, height);
225
195
  this.screenTexture = glUtils.createTexture(gl, gl.NEAREST, emptyPixels, width, height);
226
196
  }
@@ -229,13 +199,11 @@ var Wind = /*#__PURE__*/function () {
229
199
  key: "draw",
230
200
  value: function draw() {
231
201
  var _this$windData;
232
-
233
202
  if ((_this$windData = this.windData) !== null && _this$windData !== void 0 && _this$windData.image) {
234
203
  var gl = this.gl;
235
204
  glUtils.bindTexture(gl, this.windTexture, 0);
236
205
  glUtils.bindTexture(gl, this.particleStateTexture0, 1);
237
206
  this.drawScreen(); // draw Particles into framebuffer
238
-
239
207
  this.updateParticles();
240
208
  return {
241
209
  d: this.pixels,
@@ -253,8 +221,9 @@ var Wind = /*#__PURE__*/function () {
253
221
  }, {
254
222
  key: "drawScreen",
255
223
  value: function drawScreen() {
256
- var gl = this.gl; // draw the screen into a temporary framebuffer to retain it as the background on the next frame
224
+ var gl = this.gl;
257
225
 
226
+ // draw the screen into a temporary framebuffer to retain it as the background on the next frame
258
227
  bindFramebuffer(gl, this.framebuffer, this.screenTexture);
259
228
  gl.viewport(0, 0, this.width, this.height);
260
229
  gl.disable(gl.BLEND);
@@ -263,8 +232,9 @@ var Wind = /*#__PURE__*/function () {
263
232
  this.pixels = new Uint8Array(4 * this.width * this.height);
264
233
  gl.readPixels(0, 0, this.width, this.height, gl.RGBA, gl.UNSIGNED_BYTE, this.pixels);
265
234
  bindFramebuffer(gl, null, null);
266
- gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height); // save the current screen as the background for the next frame
235
+ gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);
267
236
 
237
+ // save the current screen as the background for the next frame
268
238
  var temp = this.backgroundTexture;
269
239
  this.backgroundTexture = this.screenTexture;
270
240
  this.screenTexture = temp;
@@ -274,7 +244,9 @@ var Wind = /*#__PURE__*/function () {
274
244
  value: function drawFullTexture(texture, opacity) {
275
245
  var gl = this.gl;
276
246
  var program = this.fullScreenProgram;
277
- gl.useProgram(program); // bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
247
+ gl.useProgram(program);
248
+
249
+ // bindAttribute(gl, this.quadBuffer, program.a_pos, 2);
278
250
 
279
251
  gl.bindBuffer(gl.ARRAY_BUFFER, this.quadBuffer);
280
252
  gl.vertexAttribPointer(program.a_pos, 2, gl.FLOAT, false, 0, 0);
@@ -283,7 +255,8 @@ var Wind = /*#__PURE__*/function () {
283
255
  glUtils.bindTexture(gl, texture, 2);
284
256
  gl.uniform1i(program.u_screen, 2);
285
257
  gl.uniform1f(program.u_opacity, opacity);
286
- gl.drawArrays(gl.TRIANGLES, 0, 6); // gl.drawArrays(gl.POINTS, 0, 6);
258
+ gl.drawArrays(gl.TRIANGLES, 0, 6);
259
+ // gl.drawArrays(gl.POINTS, 0, 6);
287
260
  }
288
261
  }, {
289
262
  key: "drawParticles",
@@ -319,12 +292,15 @@ var Wind = /*#__PURE__*/function () {
319
292
  gl.uniform1f(program.u_speed_factor, this.speedFactor);
320
293
  gl.uniform1f(program.u_drop_rate, this.dropRate);
321
294
  gl.uniform1f(program.u_drop_rate_bump, this.dropRateBump);
322
- gl.drawArrays(gl.TRIANGLES, 0, 6); // swap the particle state textures so the new one becomes the current one
295
+ gl.drawArrays(gl.TRIANGLES, 0, 6);
323
296
 
297
+ // swap the particle state textures so the new one becomes the current one
324
298
  var temp = this.particleStateTexture0;
325
299
  this.particleStateTexture0 = this.particleStateTexture1;
326
300
  this.particleStateTexture1 = temp;
327
- bindFramebuffer(gl, null, null); // gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);
301
+ bindFramebuffer(gl, null, null);
302
+
303
+ // gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);
328
304
  }
329
305
  }, {
330
306
  key: "destroy",
@@ -332,31 +308,38 @@ var Wind = /*#__PURE__*/function () {
332
308
  // private drawProgram: WebGLProgram;
333
309
  // private fullScreenProgram: WebGLProgram;
334
310
  // private updateProgram: WebGLProgram;
311
+
335
312
  // private quadBuffer: WebGLBuffer | null;
336
313
  // private particleIndexBuffer: WebGLBuffer | null;
314
+
337
315
  // private framebuffer: WebGLFramebuffer | null;
316
+
338
317
  // private colorRampTexture: WebGLTexture | null;
339
318
  // private backgroundTexture: WebGLTexture | null;
340
319
  // private screenTexture: WebGLTexture | null;
341
320
  // private particleStateTexture0: WebGLTexture | null;
342
321
  // private particleStateTexture1: WebGLTexture | null;
343
322
  // private windTexture: WebGLTexture | null;
323
+
344
324
  this.gl.deleteBuffer(this.quadBuffer);
345
325
  this.gl.deleteBuffer(this.particleIndexBuffer);
346
- this.gl.deleteFramebuffer(this.framebuffer); // @ts-ignore
347
-
348
- this.gl.deleteShader(this.drawProgram.vertexShader); // @ts-ignore
326
+ this.gl.deleteFramebuffer(this.framebuffer);
349
327
 
328
+ // @ts-ignore
329
+ this.gl.deleteShader(this.drawProgram.vertexShader);
330
+ // @ts-ignore
350
331
  this.gl.deleteShader(this.drawProgram.fragmentShader);
351
- this.gl.deleteProgram(this.drawProgram); // @ts-ignore
352
-
353
- this.gl.deleteShader(this.fullScreenProgram.vertexShader); // @ts-ignore
332
+ this.gl.deleteProgram(this.drawProgram);
354
333
 
334
+ // @ts-ignore
335
+ this.gl.deleteShader(this.fullScreenProgram.vertexShader);
336
+ // @ts-ignore
355
337
  this.gl.deleteShader(this.fullScreenProgram.fragmentShader);
356
- this.gl.deleteProgram(this.fullScreenProgram); // @ts-ignore
357
-
358
- this.gl.deleteShader(this.updateProgram.vertexShader); // @ts-ignore
338
+ this.gl.deleteProgram(this.fullScreenProgram);
359
339
 
340
+ // @ts-ignore
341
+ this.gl.deleteShader(this.updateProgram.vertexShader);
342
+ // @ts-ignore
360
343
  this.gl.deleteShader(this.updateProgram.fragmentShader);
361
344
  this.gl.deleteProgram(this.updateProgram);
362
345
  this.gl.deleteTexture(this.colorRampTexture);
@@ -369,5 +352,4 @@ var Wind = /*#__PURE__*/function () {
369
352
  }]);
370
353
  return Wind;
371
354
  }();
372
-
373
355
  exports.Wind = Wind;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.updateVert = exports.updateFrag = exports.fullScreenVert = exports.fullScreenFrag = exports.drawVert = exports.drawFrag = void 0;
7
-
8
7
  /**
9
8
  * drawProgram drawVert drawFrag
10
9
  * screenProgram screenVert screenFrag
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.16.1",
3
+ "version": "2.16.2",
4
4
  "description": "L7's collection of built-in layers",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -27,10 +27,10 @@
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
29
  "@antv/async-hook": "^2.2.9",
30
- "@antv/l7-core": "2.16.1",
31
- "@antv/l7-maps": "2.16.1",
32
- "@antv/l7-source": "2.16.1",
33
- "@antv/l7-utils": "2.16.1",
30
+ "@antv/l7-core": "2.16.2",
31
+ "@antv/l7-maps": "2.16.2",
32
+ "@antv/l7-source": "2.16.2",
33
+ "@antv/l7-utils": "2.16.2",
34
34
  "@babel/runtime": "^7.7.7",
35
35
  "@mapbox/martini": "^0.2.0",
36
36
  "@turf/clone": "^6.5.0",
@@ -53,7 +53,7 @@
53
53
  "reflect-metadata": "^0.1.13"
54
54
  },
55
55
  "devDependencies": {
56
- "@antv/l7-test-utils": "2.16.1",
56
+ "@antv/l7-test-utils": "2.16.2",
57
57
  "@types/d3-array": "^2.0.0",
58
58
  "@types/d3-color": "^1.2.2",
59
59
  "@types/d3-interpolate": "1.1.6",
@@ -62,7 +62,7 @@
62
62
  "@types/gl-matrix": "^2.4.5",
63
63
  "@types/lodash": "^4.14.138"
64
64
  },
65
- "gitHead": "0976422540e1c3e23563239847110b40c6cb852a",
65
+ "gitHead": "93b6d071e7d9c07c8bafcf1e6ce37b5f21185905",
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  }