@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,43 +1,29 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
4
3
  import _initializerDefineProperty from "@babel/runtime/helpers/esm/initializerDefineProperty";
5
4
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
6
5
  import _createClass from "@babel/runtime/helpers/esm/createClass";
7
6
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
7
  import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
9
8
  import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
10
-
11
9
  var _dec, _class, _descriptor;
12
-
13
10
  import _regeneratorRuntime from "@babel/runtime/regenerator";
14
-
15
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
16
-
17
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
-
19
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
20
-
21
- import { BlendType, gl, lazyInject, MaskOperation, StencilType, TYPES } from '@antv/l7-core';
11
+ import { BlendType, lazyInject, MaskOperation, StencilType, TYPES } from '@antv/l7-core';
22
12
  import { rgb2arr } from '@antv/l7-utils';
23
- import { color } from 'd3-color';
24
- import { isEqual, isNumber, isString } from 'lodash';
25
13
  import { BlendTypes } from "../utils/blend";
26
14
  import { getStencil as _getStencil, getStencilMask } from "../utils/stencil";
15
+ import { getCommonStyleAttributeOptions } from "./CommonStyleAttribute";
27
16
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
28
17
  var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
29
18
  // style texture data mapping
30
- // 用于数据传递的数据纹理
31
- // 默认有多少列(宽度)
32
- // 计算得到的当前数据纹理有多少行(高度)
33
- // 单个 cell 的长度
34
- // 需要进行数据映射的属性集合
19
+
35
20
  // style texture data mapping
21
+
36
22
  function BaseModel(layer) {
37
23
  _classCallCheck(this, BaseModel);
38
-
24
+ _defineProperty(this, "preStyleAttribute", {});
25
+ _defineProperty(this, "encodeStyleAttribute", {});
39
26
  _initializerDefineProperty(this, "configService", _descriptor, this);
40
-
41
27
  this.layer = layer;
42
28
  this.rendererService = layer.getContainer().get(TYPES.IRendererService);
43
29
  this.pickingService = layer.getContainer().get(TYPES.IPickingService);
@@ -47,386 +33,39 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
47
33
  this.iconService = layer.getContainer().get(TYPES.IIconService);
48
34
  this.fontService = layer.getContainer().get(TYPES.IFontService);
49
35
  this.cameraService = layer.getContainer().get(TYPES.ICameraService);
50
- this.layerService = layer.getContainer().get(TYPES.ILayerService); // 注册 Attribute
51
-
52
- this.registerBuiltinAttributes(); // 开启动画
36
+ this.layerService = layer.getContainer().get(TYPES.ILayerService);
37
+ // 初始化支持数据映射的 Style 属性
53
38
 
39
+ this.registerStyleAttribute();
40
+ // 注册 Attribute
41
+ this.registerBuiltinAttributes();
42
+ // 开启动画
54
43
  this.startModelAnimate();
55
44
  var createTexture2D = this.rendererService.createTexture2D;
56
45
  this.createTexture2D = createTexture2D;
57
- this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度
58
-
59
- this.rowCount = 1;
60
- this.cellLength = 0;
61
- this.cellProperties = [];
62
- this.cacheStyleProperties = {
63
- thetaOffset: undefined,
64
- opacity: undefined,
65
- strokeOpacity: undefined,
66
- strokeWidth: undefined,
67
- stroke: undefined,
68
- offsets: undefined
69
- };
70
- this.stylePropertiesExist = {
71
- hasThetaOffset: 0,
72
- hasOpacity: 0,
73
- hasStrokeOpacity: 0,
74
- hasStrokeWidth: 0,
75
- hasStroke: 0,
76
- hasOffsets: 0
77
- };
78
- this.dataTextureTest = this.layerService.getOESTextureFloat(); // 只有在不支持数据纹理的情况下进行赋值
79
-
80
- if (!this.dataTextureTest) {
81
- this.dataTexture = this.createTexture2D({
82
- // data: new Uint8ClampedArray(4),
83
- // 使用 Uint8ClampedArray 在 支付宝 环境中可能存在问题 UC 内核对格式有要求 L7 v2.7.18 版本发现
84
- // Uint8ClampedArray 和 Uint8Array 没有实质性的区别
85
- data: new Uint8Array(4),
86
- mag: gl.NEAREST,
87
- min: gl.NEAREST,
88
- width: 1,
89
- height: 1
90
- });
91
- }
92
- } // style datatexture mapping
93
-
94
- /**
95
- * 清除上一次的计算结果 - 全量清除
96
- */
97
-
46
+ }
98
47
 
48
+ // style datatexture mapping
99
49
  _createClass(BaseModel, [{
100
- key: "clearLastCalRes",
101
- value: function clearLastCalRes() {
102
- this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合
103
-
104
- this.cellLength = 0; // 清空上一次计算的 cell 的长度
105
-
106
- this.stylePropertiesExist = {
107
- // 全量清空上一次是否需要对 style 属性进行数据映射的判断
108
- hasThetaOffset: 0,
109
- hasOpacity: 0,
110
- hasStrokeOpacity: 0,
111
- hasStrokeWidth: 0,
112
- hasStroke: 0,
113
- hasOffsets: 0
114
- };
115
- }
116
- }, {
117
- key: "getCellTypeLayout",
118
- value: function getCellTypeLayout() {
119
- if (this.dataTextureTest) {
120
- return [// 0
121
- this.rowCount, // 数据纹理有几行
122
- this.DATA_TEXTURE_WIDTH, // 数据纹理有几列
123
- 0.0, 0.0, // 1
124
- this.stylePropertiesExist.hasOpacity, // cell 中是否存在 opacity
125
- this.stylePropertiesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity
126
- this.stylePropertiesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth
127
- this.stylePropertiesExist.hasStroke, // cell 中是否存在 stroke
128
- // 2
129
- this.stylePropertiesExist.hasOffsets, // cell 中是否存在 offsets
130
- this.stylePropertiesExist.hasThetaOffset, // cell 中是否存在 thetaOffset
131
- 0.0, 0.0, // 3
132
- 0.0, 0.0, 0.0, 1.0];
133
- } else {
134
- return [1.0, // 数据纹理有几行
135
- 1.0, // 数据纹理有几列
136
- 0.0, 0.0, 0.0, // cell 中是否存在 opacity
137
- 0.0, // cell 中是否存在 strokeOpacity
138
- 0.0, // cell 中是否存在 strokeWidth
139
- 0.0, // cell 中是否存在 stroke
140
- 0.0, // cell 中是否存在 offsets
141
- 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0];
142
- }
143
- }
144
- /**
145
- * 判断数据纹理是否需要重新计算 - 根据传入的值进行判断
146
- * @param options
147
- * @returns
148
- */
149
-
150
- }, {
151
- key: "dataTextureNeedUpdate",
152
- value: function dataTextureNeedUpdate(options) {
153
- var isUpdate = false;
154
-
155
- if (!isEqual(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {
156
- isUpdate = true;
157
- this.cacheStyleProperties.thetaOffset = options.thetaOffset;
158
- }
159
-
160
- if (!isEqual(options.opacity, this.cacheStyleProperties.opacity)) {
161
- isUpdate = true;
162
- this.cacheStyleProperties.opacity = options.opacity;
163
- }
164
-
165
- if (!isEqual(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)) {
166
- isUpdate = true;
167
- this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;
168
- }
169
-
170
- if (!isEqual(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {
171
- isUpdate = true;
172
- this.cacheStyleProperties.strokeWidth = options.strokeWidth;
173
- }
174
-
175
- if (!isEqual(options.stroke, this.cacheStyleProperties.stroke)) {
176
- isUpdate = true;
177
- this.cacheStyleProperties.stroke = options.stroke;
178
- }
179
-
180
- if (!isEqual(options.offsets, this.cacheStyleProperties.offsets)) {
181
- isUpdate = true;
182
- this.cacheStyleProperties.offsets = options.offsets;
183
- }
184
-
185
- if (this.dataTexture === undefined) {
186
- isUpdate = true;
187
- }
188
-
189
- return isUpdate;
190
- }
191
- /**
192
- * 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
193
- * @param options
194
- */
195
-
196
- }, {
197
- key: "judgeStyleAttributes",
198
- value: function judgeStyleAttributes(options) {
199
- this.clearLastCalRes(); // 清除上一次的计算结果 - 全量清除
200
-
201
- if (options.opacity !== undefined && !isNumber(options.opacity)) {
202
- // 数据映射
203
- this.cellProperties.push({
204
- attr: 'opacity',
205
- count: 1
206
- });
207
- this.stylePropertiesExist.hasOpacity = 1;
208
- this.cellLength += 1;
209
- }
210
-
211
- if (options.strokeOpacity !== undefined && !isNumber(options.strokeOpacity)) {
212
- // 数据映射
213
- this.cellProperties.push({
214
- attr: 'strokeOpacity',
215
- count: 1
216
- });
217
- this.stylePropertiesExist.hasStrokeOpacity = 1;
218
- this.cellLength += 1;
219
- }
220
-
221
- if (options.strokeWidth !== undefined && !isNumber(options.strokeWidth)) {
222
- // 数据映射
223
- this.cellProperties.push({
224
- attr: 'strokeWidth',
225
- count: 1
226
- });
227
- this.stylePropertiesExist.hasStrokeWidth = 1;
228
- this.cellLength += 1;
229
- }
230
-
231
- if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {
232
- // 数据映射
233
- this.cellProperties.push({
234
- attr: 'stroke',
235
- count: 4
236
- });
237
- this.stylePropertiesExist.hasStroke = 1;
238
- this.cellLength += 4;
239
- }
240
-
241
- if (options.offsets !== undefined && !this.isOffsetStatic(options.offsets)) {
242
- // 数据映射
243
- this.cellProperties.push({
244
- attr: 'offsets',
245
- count: 2
246
- });
247
- this.stylePropertiesExist.hasOffsets = 1;
248
- this.cellLength += 2;
249
- }
250
-
251
- if (options.thetaOffset !== undefined && !isNumber(options.thetaOffset)) {
252
- // 数据映射
253
- this.cellProperties.push({
254
- attr: 'thetaOffset',
255
- count: 1
256
- });
257
- this.stylePropertiesExist.hasThetaOffset = 1;
258
- this.cellLength += 1;
259
- }
260
- }
261
- /**
262
- * 判断变量 stroke 是否是常量值
263
- * @param stroke
264
- * @returns
265
- */
266
-
267
- }, {
268
- key: "isStaticColor",
269
- value: function isStaticColor(stroke) {
270
- if (isString(stroke)) {
271
- if (color(stroke)) {
272
- return true;
273
- } else {
274
- return false;
275
- }
276
- }
277
-
278
- return false;
279
- }
280
- /**
281
- * 获取 stroke 颜色并做兼容处理
282
- * @param stroke
283
- * @returns
284
- */
285
-
286
- }, {
287
- key: "getStrokeColor",
288
- value: function getStrokeColor(stroke) {
289
- if (this.isStaticColor(stroke)) {
290
- var strokeColor = rgb2arr(stroke);
291
- strokeColor[0] = strokeColor[0] ? strokeColor[0] : 0;
292
- strokeColor[1] = strokeColor[1] ? strokeColor[1] : 0;
293
- strokeColor[2] = strokeColor[2] ? strokeColor[2] : 0;
294
- strokeColor[3] = strokeColor[3] ? strokeColor[3] : 0;
295
- return strokeColor;
296
- } else {
297
- return [0, 0, 0, 0];
298
- }
299
- }
300
- /**
301
- * 判断 offsets 是否是常量
302
- * @param offsets
303
- * @returns
304
- */
305
-
306
- }, {
307
- key: "isOffsetStatic",
308
- value: function isOffsetStatic(offsets) {
309
- if (Array.isArray(offsets) && offsets.length === 2 && isNumber(offsets[0]) && isNumber(offsets[1])) {
310
- return true;
311
- } else {
312
- return false;
313
- }
314
- }
315
- /**
316
- * 补空位
317
- * @param d
318
- * @param count
319
- */
320
-
321
- }, {
322
- key: "patchMod",
323
- value: function patchMod(d, count) {
324
- for (var i = 0; i < count; i++) {
325
- d.push(-1);
326
- }
327
- }
328
- /**
329
- * 根据映射的数据字段往推入数据
330
- * @param d
331
- * @param cellData
332
- * @param cellPropertiesLayouts
333
- */
334
-
335
- }, {
336
- key: "patchData",
337
- value: function patchData(d, cellData, cellPropertiesLayouts) {
338
- var _iterator = _createForOfIteratorHelper(cellPropertiesLayouts),
339
- _step;
340
-
341
- try {
342
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
343
- var layout = _step.value;
344
- var attr = layout.attr,
345
- count = layout.count;
346
- var value = cellData[attr];
347
-
348
- if (value !== undefined) {
349
- // 数据中存在该属性
350
- if (attr === 'stroke') {
351
- d.push.apply(d, _toConsumableArray(rgb2arr(value)));
352
- } else if (attr === 'offsets') {
353
- if (this.isOffsetStatic(value)) {
354
- d.push(-value[0], value[1]);
355
- } else {
356
- d.push(0, 0);
357
- }
358
- } else {
359
- d.push(isNumber(value) ? value : 1.0);
360
- }
361
- } else {
362
- // 若不存在时则补位
363
- this.patchMod(d, count);
364
- }
365
- }
366
- } catch (err) {
367
- _iterator.e(err);
368
- } finally {
369
- _iterator.f();
370
- }
371
- }
372
- /**
373
- * 计算推入数据纹理的数据
374
- * @param cellLength
375
- * @param encodeData
376
- * @param cellPropertiesLayouts
377
- * @returns
378
- */
379
-
380
- }, {
381
- key: "calDataFrame",
382
- value: function calDataFrame(cellLength, encodeData, cellPropertiesLayouts) {
383
- var encodeDatalength = encodeData.length;
384
- var rowCount = Math.ceil(encodeDatalength * cellLength / this.DATA_TEXTURE_WIDTH); // 有多少行
385
-
386
- var totalLength = rowCount * this.DATA_TEXTURE_WIDTH;
387
- var d = [];
388
-
389
- for (var i = 0; i < encodeDatalength; i++) {
390
- // 根据 encodeData 数据推入数据
391
- var cellData = encodeData[i];
392
- this.patchData(d, cellData, cellPropertiesLayouts);
393
- }
394
-
395
- for (var _i = d.length; _i < totalLength; _i++) {
396
- // 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)
397
- d.push(-1);
398
- } // console.log('data', d)
399
-
400
-
401
- return {
402
- data: d,
403
- width: this.DATA_TEXTURE_WIDTH,
404
- height: rowCount
405
- };
406
- } // style datatexture mapping
407
-
408
- }, {
409
50
  key: "getBlend",
410
51
  value: function getBlend() {
411
52
  var _this$layer$getLayerC = this.layer.getLayerConfig(),
412
- _this$layer$getLayerC2 = _this$layer$getLayerC.blend,
413
- blend = _this$layer$getLayerC2 === void 0 ? 'normal' : _this$layer$getLayerC2;
414
-
53
+ _this$layer$getLayerC2 = _this$layer$getLayerC.blend,
54
+ blend = _this$layer$getLayerC2 === void 0 ? 'normal' : _this$layer$getLayerC2;
415
55
  return BlendTypes[BlendType[blend]];
416
56
  }
417
57
  }, {
418
58
  key: "getStencil",
419
59
  value: function getStencil(option) {
420
60
  var _this$layer$getLayerC3 = this.layer.getLayerConfig(),
421
- _this$layer$getLayerC4 = _this$layer$getLayerC3.mask,
422
- mask = _this$layer$getLayerC4 === void 0 ? false : _this$layer$getLayerC4,
423
- _this$layer$getLayerC5 = _this$layer$getLayerC3.maskInside,
424
- maskInside = _this$layer$getLayerC5 === void 0 ? true : _this$layer$getLayerC5,
425
- enableMask = _this$layer$getLayerC3.enableMask,
426
- _this$layer$getLayerC6 = _this$layer$getLayerC3.maskOperation,
427
- maskOperation = _this$layer$getLayerC6 === void 0 ? MaskOperation.AND : _this$layer$getLayerC6; // TODO 临时处理,后期移除MaskLayer
428
-
429
-
61
+ _this$layer$getLayerC4 = _this$layer$getLayerC3.mask,
62
+ mask = _this$layer$getLayerC4 === void 0 ? false : _this$layer$getLayerC4,
63
+ _this$layer$getLayerC5 = _this$layer$getLayerC3.maskInside,
64
+ maskInside = _this$layer$getLayerC5 === void 0 ? true : _this$layer$getLayerC5,
65
+ enableMask = _this$layer$getLayerC3.enableMask,
66
+ _this$layer$getLayerC6 = _this$layer$getLayerC3.maskOperation,
67
+ maskOperation = _this$layer$getLayerC6 === void 0 ? MaskOperation.AND : _this$layer$getLayerC6;
68
+ // TODO 临时处理,后期移除MaskLayer
430
69
  if (this.layer.type === 'MaskLayer') {
431
70
  return getStencilMask({
432
71
  isStencil: true,
@@ -440,11 +79,12 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
440
79
  })); // 用于遮罩的stencil 参数
441
80
  }
442
81
 
443
- var maskflag = mask || // mask 兼容历史写法
444
- enableMask && this.layer.masks.length !== 0 || // 外部图层的mask
82
+ var maskflag = mask ||
83
+ // mask 兼容历史写法
84
+ enableMask && this.layer.masks.length !== 0 ||
85
+ // 外部图层的mask
445
86
  this.layer.tileMask !== undefined; // 瓦片图层
446
87
  // !!(mask || enableMask || this.layer.tileMask);
447
-
448
88
  return _getStencil(maskflag, maskInside);
449
89
  }
450
90
  }, {
@@ -467,76 +107,58 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
467
107
  value: function () {
468
108
  var _needUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
469
109
  return _regeneratorRuntime.wrap(function _callee$(_context) {
470
- while (1) {
471
- switch (_context.prev = _context.next) {
472
- case 0:
473
- return _context.abrupt("return", false);
474
-
475
- case 1:
476
- case "end":
477
- return _context.stop();
478
- }
110
+ while (1) switch (_context.prev = _context.next) {
111
+ case 0:
112
+ return _context.abrupt("return", false);
113
+ case 1:
114
+ case "end":
115
+ return _context.stop();
479
116
  }
480
117
  }, _callee);
481
118
  }));
482
-
483
119
  function needUpdate() {
484
120
  return _needUpdate.apply(this, arguments);
485
121
  }
486
-
487
122
  return needUpdate;
488
123
  }() // eslint-disable-next-line @typescript-eslint/no-unused-vars
489
-
490
124
  }, {
491
125
  key: "buildModels",
492
126
  value: function () {
493
127
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
494
128
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
495
- while (1) {
496
- switch (_context2.prev = _context2.next) {
497
- case 0:
498
- throw new Error('Method not implemented.');
499
-
500
- case 1:
501
- case "end":
502
- return _context2.stop();
503
- }
129
+ while (1) switch (_context2.prev = _context2.next) {
130
+ case 0:
131
+ throw new Error('Method not implemented.');
132
+ case 1:
133
+ case "end":
134
+ return _context2.stop();
504
135
  }
505
136
  }, _callee2);
506
137
  }));
507
-
508
138
  function buildModels() {
509
139
  return _buildModels.apply(this, arguments);
510
140
  }
511
-
512
141
  return buildModels;
513
142
  }() // eslint-disable-next-line @typescript-eslint/no-unused-vars
514
-
515
143
  }, {
516
144
  key: "initModels",
517
145
  value: function () {
518
146
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
519
147
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
520
- while (1) {
521
- switch (_context3.prev = _context3.next) {
522
- case 0:
523
- throw new Error('Method not implemented.');
524
-
525
- case 1:
526
- case "end":
527
- return _context3.stop();
528
- }
148
+ while (1) switch (_context3.prev = _context3.next) {
149
+ case 0:
150
+ throw new Error('Method not implemented.');
151
+ case 1:
152
+ case "end":
153
+ return _context3.stop();
529
154
  }
530
155
  }, _callee3);
531
156
  }));
532
-
533
157
  function initModels() {
534
158
  return _initModels.apply(this, arguments);
535
159
  }
536
-
537
160
  return initModels;
538
161
  }() // eslint-disable-next-line @typescript-eslint/no-unused-vars
539
-
540
162
  }, {
541
163
  key: "clearModels",
542
164
  value: function clearModels() {
@@ -547,8 +169,8 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
547
169
  key: "getAttribute",
548
170
  value: function getAttribute() {
549
171
  throw new Error('Method not implemented.');
550
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
551
-
172
+ }
173
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
552
174
  }, {
553
175
  key: "render",
554
176
  value: function render(renderOptions) {
@@ -568,14 +190,81 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
568
190
  key: "startModelAnimate",
569
191
  value: function startModelAnimate() {
570
192
  var _ref = this.layer.getLayerConfig(),
571
- animateOption = _ref.animateOption;
572
-
193
+ animateOption = _ref.animateOption;
573
194
  if (animateOption.enable) {
574
195
  this.layer.setAnimateStartTime();
575
196
  }
576
197
  }
577
- }]);
198
+ }, {
199
+ key: "getInject",
200
+ value: function getInject() {
201
+ var encodeStyleAttribute = this.layer.encodeStyleAttribute;
202
+ var str = '';
203
+ var attrType = {
204
+ opacity: 'float',
205
+ stroke: 'vec4',
206
+ offsets: 'vec2',
207
+ textOffset: 'vec2'
208
+ };
209
+ this.layer.enableEncodeStyles.forEach(function (key) {
210
+ if (encodeStyleAttribute[key]) {
211
+ str += "#define USE_ATTRIBUTE_".concat(key.toUpperCase(), " 0.0; \n\n");
212
+ }
213
+ str += "\n #ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n attribute ").concat(attrType[key], " a_").concat(key.charAt(0).toUpperCase() + key.slice(1), ";\n#else\n uniform ").concat(attrType[key], " u_").concat(key, ";\n#endif\n\n");
214
+ });
215
+ var innerStr = '';
216
+ this.layer.enableEncodeStyles.forEach(function (key) {
217
+ innerStr += "\n\n#ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n ").concat(attrType[key], " ").concat(key, " = a_").concat(key.charAt(0).toUpperCase() + key.slice(1), ";\n#else\n ").concat(attrType[key], " ").concat(key, " = u_").concat(key, ";\n#endif\n\n");
218
+ });
219
+ return {
220
+ 'vs:#decl': str,
221
+ 'vs:#main-start': innerStr
222
+ };
223
+ }
578
224
 
225
+ // 获取数据映射样式
226
+ }, {
227
+ key: "getStyleAttribute",
228
+ value: function getStyleAttribute() {
229
+ var _this = this;
230
+ var options = {};
231
+ // TODO: 优化
232
+
233
+ var defualtValue = {
234
+ opacity: 1,
235
+ stroke: [1, 0, 0, 1],
236
+ offsets: [0, 0]
237
+ };
238
+ this.layer.enableEncodeStyles.forEach(function (key) {
239
+ if (!_this.layer.encodeStyleAttribute[key]) {
240
+ // @ts-ignore
241
+ var value = _this.layer.getLayerConfig()[key] || defualtValue[key];
242
+ if (key === 'stroke') {
243
+ value = rgb2arr(value);
244
+ }
245
+ options['u_' + key] = value;
246
+ }
247
+ });
248
+ return options;
249
+ }
250
+ // 注册数据映射样式
251
+ }, {
252
+ key: "registerStyleAttribute",
253
+ value: function registerStyleAttribute() {
254
+ var _this2 = this;
255
+ Object.keys(this.layer.encodeStyleAttribute).forEach(function (key) {
256
+ var options = getCommonStyleAttributeOptions(key);
257
+ if (options) {
258
+ _this2.styleAttributeService.registerStyleAttribute(options);
259
+ }
260
+ });
261
+ }
262
+ }, {
263
+ key: "updateEncodeAttribute",
264
+ value: function updateEncodeAttribute(type, flag) {
265
+ this.encodeStyleAttribute[type] = flag;
266
+ }
267
+ }]);
579
268
  return BaseModel;
580
269
  }(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "configService", [_dec], {
581
270
  configurable: true,
@@ -0,0 +1,2 @@
1
+ import { IStyleAttribute } from '@antv/l7-core';
2
+ export declare function getCommonStyleAttributeOptions(name: string): Partial<IStyleAttribute> | undefined;