@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,4 +1,5 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
3
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
5
  import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
@@ -7,63 +8,45 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
7
8
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
9
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
10
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
-
11
11
  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
12
  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
13
  import { AttributeType, gl } from '@antv/l7-core';
16
14
  import { rgb2arr } from '@antv/l7-utils';
17
- import { isNumber } from 'lodash';
18
15
  import BaseModel from "../../core/BaseModel";
19
16
  import { LineArcTriangulation } from "../../core/triangulation";
20
- import { EARTH_RADIUS } from "../../earth/utils"; // arc3d line layer
21
-
17
+ import { EARTH_RADIUS } from "../../earth/utils";
18
+ // arc3d line layer
22
19
  /* babel-plugin-inline-import '../shaders/line_arc_3d_frag.glsl' */
23
- 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_opacity;\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;\n\nuniform float u_line_texture: 0.0;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\nvarying float v_segmentIndex;\nuniform float segmentNumber;\n\nvarying vec2 v_iconMapUV;\n\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n\nvarying mat4 styleMappingMat;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = styleMappingMat[3].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 = styleMappingMat[3].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 = styleMappingMat[3].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";
24
-
20
+ 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";
25
21
  /* babel-plugin-inline-import '../shaders/line_arc_3d_vert.glsl' */
26
- 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;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\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 styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // dataset \u6570\u636E\u96C6\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\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 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 styleMappingMat[3].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 styleMappingMat[3].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 styleMappingMat[3].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
27
-
22
+ 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
28
23
  /* babel-plugin-inline-import '../shaders/linear/arc3d_linear_frag.glsl' */
29
- var arc3d_linear_frag = "\n#define Animate 0.0\n\nuniform float u_opacity;\nuniform float u_blur : 0.9;\nvarying float v_segmentIndex;\nuniform float segmentNumber;\n\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\nvarying mat4 styleMappingMat;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = styleMappingMat[3].g; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n\n gl_FragColor = mix(u_sourceColor, u_targetColor, v_segmentIndex/segmentNumber);\n\n gl_FragColor.a *= opacity;\n\n if(u_animate.x == Animate) {\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 gl_FragColor = filterColor(gl_FragColor);\n}\n";
30
-
24
+ 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";
31
25
  /* babel-plugin-inline-import '../shaders/linear/arc3d_linear_vert.glsl' */
32
- 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 ];\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;\nuniform float u_opacity: 1.0;\n\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\nvarying float v_segmentIndex;\nvarying vec2 v_iconMapUV;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\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 styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // dataset \u6570\u636E\u96C6\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\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 d_distance_ratio = segmentIndex / segmentNumber;\n }\n styleMappingMat[3].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 styleMappingMat[3].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 styleMappingMat[3].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";
26
+ 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";
33
27
  var lineStyleObj = {
34
28
  solid: 0.0,
35
29
  dash: 1.0
36
30
  };
37
-
38
31
  var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
39
32
  _inherits(Arc3DModel, _BaseModel);
40
-
41
33
  var _super = _createSuper(Arc3DModel);
42
-
43
34
  function Arc3DModel() {
44
35
  var _this;
45
-
46
36
  _classCallCheck(this, Arc3DModel);
47
-
48
37
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
49
38
  args[_key] = arguments[_key];
50
39
  }
51
-
52
40
  _this = _super.call.apply(_super, [this].concat(args));
53
-
54
41
  _defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
55
42
  var createTexture2D = _this.rendererService.createTexture2D;
56
-
57
43
  if (_this.texture) {
58
44
  _this.texture.update({
59
45
  data: _this.iconService.getCanvas()
60
46
  });
61
-
62
47
  _this.layer.render();
63
-
64
48
  return;
65
49
  }
66
-
67
50
  _this.texture = createTexture2D({
68
51
  data: _this.iconService.getCanvas(),
69
52
  mag: gl.NEAREST,
@@ -73,94 +56,51 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
73
56
  height: _this.iconService.canvasHeight || 128
74
57
  });
75
58
  });
76
-
77
59
  return _this;
78
60
  }
79
-
80
61
  _createClass(Arc3DModel, [{
81
62
  key: "getUninforms",
82
- value: function getUninforms() {
63
+ value:
64
+ // public enableEncodeStyles = ['opacity'];
65
+ function getUninforms() {
83
66
  var _ref = this.layer.getLayerConfig(),
84
- _ref$opacity = _ref.opacity,
85
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
86
- sourceColor = _ref.sourceColor,
87
- targetColor = _ref.targetColor,
88
- _ref$textureBlend = _ref.textureBlend,
89
- textureBlend = _ref$textureBlend === void 0 ? 'normal' : _ref$textureBlend,
90
- _ref$lineType = _ref.lineType,
91
- lineType = _ref$lineType === void 0 ? 'solid' : _ref$lineType,
92
- _ref$dashArray = _ref.dashArray,
93
- dashArray = _ref$dashArray === void 0 ? [10, 5] : _ref$dashArray,
94
- _ref$lineTexture = _ref.lineTexture,
95
- lineTexture = _ref$lineTexture === void 0 ? false : _ref$lineTexture,
96
- _ref$iconStep = _ref.iconStep,
97
- iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
98
- _ref$segmentNumber = _ref.segmentNumber,
99
- segmentNumber = _ref$segmentNumber === void 0 ? 30 : _ref$segmentNumber,
100
- _ref$globalArcHeight = _ref.globalArcHeight,
101
- globalArcHeight = _ref$globalArcHeight === void 0 ? 10 : _ref$globalArcHeight;
102
-
67
+ sourceColor = _ref.sourceColor,
68
+ targetColor = _ref.targetColor,
69
+ _ref$textureBlend = _ref.textureBlend,
70
+ textureBlend = _ref$textureBlend === void 0 ? 'normal' : _ref$textureBlend,
71
+ _ref$lineType = _ref.lineType,
72
+ lineType = _ref$lineType === void 0 ? 'solid' : _ref$lineType,
73
+ _ref$dashArray = _ref.dashArray,
74
+ dashArray = _ref$dashArray === void 0 ? [10, 5] : _ref$dashArray,
75
+ _ref$lineTexture = _ref.lineTexture,
76
+ lineTexture = _ref$lineTexture === void 0 ? false : _ref$lineTexture,
77
+ _ref$iconStep = _ref.iconStep,
78
+ iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
79
+ _ref$segmentNumber = _ref.segmentNumber,
80
+ segmentNumber = _ref$segmentNumber === void 0 ? 30 : _ref$segmentNumber,
81
+ _ref$globalArcHeight = _ref.globalArcHeight,
82
+ globalArcHeight = _ref$globalArcHeight === void 0 ? 10 : _ref$globalArcHeight;
103
83
  if (dashArray.length === 2) {
104
84
  dashArray.push(0, 0);
105
- } // 转化渐变色
106
-
85
+ }
107
86
 
87
+ // 转化渐变色
108
88
  var useLinearColor = 0; // 默认不生效
109
-
110
89
  var sourceColorArr = [0, 0, 0, 0];
111
90
  var targetColorArr = [0, 0, 0, 0];
112
-
113
91
  if (sourceColor && targetColor) {
114
92
  sourceColorArr = rgb2arr(sourceColor);
115
93
  targetColorArr = rgb2arr(targetColor);
116
94
  useLinearColor = 1;
117
95
  }
118
-
119
96
  if (this.rendererService.getDirty()) {
120
97
  this.texture.bind();
121
98
  }
122
-
123
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
124
- opacity: opacity
125
- })) {
126
- this.judgeStyleAttributes({
127
- opacity: opacity
128
- });
129
- var encodeData = this.layer.getEncodedData();
130
-
131
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
132
- data = _this$calDataFrame.data,
133
- width = _this$calDataFrame.width,
134
- height = _this$calDataFrame.height;
135
-
136
- this.rowCount = height; // 当前数据纹理有多少行
137
-
138
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
139
- flipY: true,
140
- data: data,
141
- format: gl.LUMINANCE,
142
- type: gl.FLOAT,
143
- width: width,
144
- height: height
145
- }) : this.createTexture2D({
146
- flipY: true,
147
- data: [1],
148
- format: gl.LUMINANCE,
149
- type: gl.FLOAT,
150
- width: 1,
151
- height: 1
152
- });
153
- }
154
-
155
- return {
99
+ return _objectSpread({
156
100
  u_globel: this.mapService.version === 'GLOBEL' ? 1 : 0,
157
101
  u_globel_radius: EARTH_RADIUS,
158
102
  // 地球半径
159
103
  u_global_height: globalArcHeight,
160
- u_dataTexture: this.dataTexture,
161
- // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
162
- u_cellTypeLayout: this.getCellTypeLayout(),
163
- u_opacity: isNumber(opacity) ? opacity : 1.0,
164
104
  u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
165
105
  segmentNumber: segmentNumber,
166
106
  u_line_type: lineStyleObj[lineType] || 0.0,
@@ -176,14 +116,13 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
176
116
  u_linearColor: useLinearColor,
177
117
  u_sourceColor: sourceColorArr,
178
118
  u_targetColor: targetColorArr
179
- };
119
+ }, this.getStyleAttribute());
180
120
  }
181
121
  }, {
182
122
  key: "getAnimateUniforms",
183
123
  value: function getAnimateUniforms() {
184
124
  var _ref2 = this.layer.getLayerConfig(),
185
- animateOption = _ref2.animateOption;
186
-
125
+ animateOption = _ref2.animateOption;
187
126
  return {
188
127
  u_animate: this.animateOption2Array(animateOption),
189
128
  u_time: this.layer.getLayerAnimateTime()
@@ -194,43 +133,35 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
194
133
  value: function () {
195
134
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
196
135
  return _regeneratorRuntime.wrap(function _callee$(_context) {
197
- while (1) {
198
- switch (_context.prev = _context.next) {
199
- case 0:
200
- this.updateTexture();
201
- this.iconService.on('imageUpdate', this.updateTexture);
202
- return _context.abrupt("return", this.buildModels());
203
-
204
- case 3:
205
- case "end":
206
- return _context.stop();
207
- }
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();
208
144
  }
209
145
  }, _callee, this);
210
146
  }));
211
-
212
147
  function initModels() {
213
148
  return _initModels.apply(this, arguments);
214
149
  }
215
-
216
150
  return initModels;
217
151
  }()
218
152
  }, {
219
153
  key: "clearModels",
220
154
  value: function clearModels() {
221
- var _this$texture, _this$dataTexture;
222
-
155
+ var _this$texture;
223
156
  (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
224
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
225
157
  this.iconService.off('imageUpdate', this.updateTexture);
226
158
  }
227
159
  }, {
228
160
  key: "getShaders",
229
161
  value: function getShaders() {
230
162
  var _ref3 = this.layer.getLayerConfig(),
231
- sourceColor = _ref3.sourceColor,
232
- targetColor = _ref3.targetColor;
233
-
163
+ sourceColor = _ref3.sourceColor,
164
+ targetColor = _ref3.targetColor;
234
165
  if (sourceColor && targetColor) {
235
166
  // 分离 linear 功能
236
167
  return {
@@ -251,45 +182,38 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
251
182
  value: function () {
252
183
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
253
184
  var _ref4, _ref4$segmentNumber, segmentNumber, _this$getShaders, frag, vert, type, model;
254
-
255
185
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
256
- while (1) {
257
- switch (_context2.prev = _context2.next) {
258
- case 0:
259
- _ref4 = this.layer.getLayerConfig(), _ref4$segmentNumber = _ref4.segmentNumber, segmentNumber = _ref4$segmentNumber === void 0 ? 30 : _ref4$segmentNumber;
260
- _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
261
- _context2.next = 4;
262
- return this.layer.buildLayerModel({
263
- moduleName: 'lineArc3d' + type,
264
- vertexShader: vert,
265
- fragmentShader: frag,
266
- triangulation: LineArcTriangulation,
267
- segmentNumber: segmentNumber
268
- });
269
-
270
- case 4:
271
- model = _context2.sent;
272
- return _context2.abrupt("return", [model]);
273
-
274
- case 6:
275
- case "end":
276
- return _context2.stop();
277
- }
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: 'lineArc3d' + type,
193
+ vertexShader: vert,
194
+ fragmentShader: frag,
195
+ inject: this.getInject(),
196
+ triangulation: LineArcTriangulation,
197
+ segmentNumber: segmentNumber
198
+ });
199
+ case 4:
200
+ model = _context2.sent;
201
+ return _context2.abrupt("return", [model]);
202
+ case 6:
203
+ case "end":
204
+ return _context2.stop();
278
205
  }
279
206
  }, _callee2, this);
280
207
  }));
281
-
282
208
  function buildModels() {
283
209
  return _buildModels.apply(this, arguments);
284
210
  }
285
-
286
211
  return buildModels;
287
212
  }()
288
213
  }, {
289
214
  key: "registerBuiltinAttributes",
290
215
  value: function registerBuiltinAttributes() {
291
216
  var _this2 = this;
292
-
293
217
  this.styleAttributeService.registerStyleAttribute({
294
218
  name: 'size',
295
219
  type: AttributeType.Attribute,
@@ -304,7 +228,7 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
304
228
  size: 1,
305
229
  update: function update(feature) {
306
230
  var _feature$size = feature.size,
307
- size = _feature$size === void 0 ? 1 : _feature$size;
231
+ size = _feature$size === void 0 ? 1 : _feature$size;
308
232
  return Array.isArray(size) ? [size[0]] : [size];
309
233
  }
310
234
  }
@@ -339,24 +263,19 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
339
263
  size: 2,
340
264
  update: function update(feature) {
341
265
  var iconMap = _this2.iconService.getIconMap();
342
-
343
266
  var texture = feature.texture;
344
-
345
267
  var _ref5 = iconMap[texture] || {
346
- x: 0,
347
- y: 0
348
- },
349
- x = _ref5.x,
350
- y = _ref5.y;
351
-
268
+ x: 0,
269
+ y: 0
270
+ },
271
+ x = _ref5.x,
272
+ y = _ref5.y;
352
273
  return [x, y];
353
274
  }
354
275
  }
355
276
  });
356
277
  }
357
278
  }]);
358
-
359
279
  return Arc3DModel;
360
280
  }(BaseModel);
361
-
362
281
  export { Arc3DModel as default };