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