@antv/l7-layers 2.10.5 → 2.10.7

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 (387) hide show
  1. package/es/Geometry/index.d.ts +2 -3
  2. package/es/Geometry/index.js +27 -17
  3. package/es/Geometry/models/billboard.d.ts +2 -2
  4. package/es/Geometry/models/billboard.js +77 -37
  5. package/es/Geometry/models/plane.d.ts +2 -2
  6. package/es/Geometry/models/plane.js +80 -40
  7. package/es/Geometry/models/sprite.d.ts +2 -2
  8. package/es/Geometry/models/sprite.js +83 -45
  9. package/es/canvas/index.d.ts +2 -3
  10. package/es/canvas/index.js +29 -19
  11. package/es/canvas/models/canvas.d.ts +2 -2
  12. package/es/canvas/models/canvas.js +54 -15
  13. package/es/citybuliding/building.d.ts +2 -3
  14. package/es/citybuliding/building.js +26 -17
  15. package/es/citybuliding/models/build.d.ts +2 -2
  16. package/es/citybuliding/models/build.js +70 -25
  17. package/es/core/BaseLayer.d.ts +22 -18
  18. package/es/core/BaseLayer.js +387 -266
  19. package/es/core/BaseModel.d.ts +2 -2
  20. package/es/core/BaseModel.js +47 -6
  21. package/es/core/LayerPickService.d.ts +12 -0
  22. package/es/core/LayerPickService.js +165 -0
  23. package/es/core/TextureService.d.ts +14 -0
  24. package/es/core/TextureService.js +67 -0
  25. package/es/core/triangulation.js +8 -1
  26. package/es/earth/index.d.ts +2 -2
  27. package/es/earth/index.js +28 -9
  28. package/es/earth/models/atmosphere.d.ts +2 -2
  29. package/es/earth/models/atmosphere.js +67 -22
  30. package/es/earth/models/base.d.ts +2 -2
  31. package/es/earth/models/base.js +89 -43
  32. package/es/earth/models/bloomsphere.d.ts +2 -2
  33. package/es/earth/models/bloomsphere.js +67 -22
  34. package/es/heatmap/index.d.ts +2 -3
  35. package/es/heatmap/index.js +33 -24
  36. package/es/heatmap/models/grid.d.ts +2 -2
  37. package/es/heatmap/models/grid.js +68 -27
  38. package/es/heatmap/models/grid3d.d.ts +2 -2
  39. package/es/heatmap/models/grid3d.js +70 -29
  40. package/es/heatmap/models/heatmap.d.ts +2 -2
  41. package/es/heatmap/models/heatmap.js +40 -14
  42. package/es/heatmap/models/hexagon.d.ts +2 -2
  43. package/es/heatmap/models/hexagon.js +69 -28
  44. package/es/heatmap/shaders/hexagon_3d_vert.glsl +2 -13
  45. package/es/image/index.d.ts +3 -4
  46. package/es/image/index.js +29 -34
  47. package/es/image/models/image.d.ts +2 -2
  48. package/es/image/models/image.js +117 -67
  49. package/es/image/models/index.d.ts +1 -1
  50. package/es/image/models/index.js +1 -5
  51. package/es/image/shaders/dataImage_frag.glsl +10 -16
  52. package/es/index.d.ts +2 -2
  53. package/es/index.js +2 -2
  54. package/es/line/index.d.ts +5 -4
  55. package/es/line/index.js +51 -25
  56. package/es/line/models/arc.d.ts +2 -2
  57. package/es/line/models/arc.js +73 -38
  58. package/es/line/models/arc_3d.d.ts +2 -2
  59. package/es/line/models/arc_3d.js +69 -34
  60. package/es/line/models/earthArc_3d.d.ts +2 -2
  61. package/es/line/models/earthArc_3d.js +72 -37
  62. package/es/line/models/great_circle.d.ts +2 -2
  63. package/es/line/models/great_circle.js +70 -29
  64. package/es/line/models/half.d.ts +2 -2
  65. package/es/line/models/half.js +40 -17
  66. package/es/line/models/index.d.ts +1 -1
  67. package/es/line/models/index.js +0 -2
  68. package/es/line/models/line.d.ts +2 -2
  69. package/es/line/models/line.js +79 -47
  70. package/es/line/models/linearline.d.ts +2 -2
  71. package/es/line/models/linearline.js +70 -31
  72. package/es/line/models/simpleLine.d.ts +2 -2
  73. package/es/line/models/simpleLine.js +71 -34
  74. package/es/line/models/simpleTileLine.d.ts +2 -2
  75. package/es/line/models/simpleTileLine.js +70 -30
  76. package/es/line/models/tile.d.ts +2 -2
  77. package/es/line/models/tile.js +40 -17
  78. package/es/line/models/wall.d.ts +2 -2
  79. package/es/line/models/wall.js +67 -22
  80. package/es/mask/index.d.ts +2 -4
  81. package/es/mask/index.js +27 -97
  82. package/es/mask/models/fill.d.ts +2 -2
  83. package/es/mask/models/fill.js +40 -16
  84. package/es/mask/models/index.d.ts +1 -1
  85. package/es/mask/models/index.js +1 -3
  86. package/es/plugins/DataMappingPlugin.d.ts +0 -2
  87. package/es/plugins/DataMappingPlugin.js +90 -152
  88. package/es/plugins/DataSourcePlugin.js +67 -30
  89. package/es/plugins/FeatureScalePlugin.d.ts +0 -1
  90. package/es/plugins/FeatureScalePlugin.js +85 -61
  91. package/es/plugins/LayerModelPlugin.d.ts +2 -2
  92. package/es/plugins/LayerModelPlugin.js +121 -37
  93. package/es/plugins/LayerStylePlugin.js +1 -6
  94. package/es/plugins/MultiPassRendererPlugin.js +1 -1
  95. package/es/plugins/PixelPickingPlugin.js +1 -1
  96. package/es/plugins/RegisterStyleAttributePlugin.js +1 -16
  97. package/es/plugins/UpdateModelPlugin.js +3 -0
  98. package/es/plugins/UpdateStyleAttributePlugin.js +3 -6
  99. package/es/point/index.d.ts +4 -4
  100. package/es/point/index.js +55 -23
  101. package/es/point/models/earthExtrude.d.ts +2 -2
  102. package/es/point/models/earthExtrude.js +73 -30
  103. package/es/point/models/earthFill.d.ts +2 -2
  104. package/es/point/models/earthFill.js +66 -21
  105. package/es/point/models/extrude.d.ts +2 -2
  106. package/es/point/models/extrude.js +40 -17
  107. package/es/point/models/fill.d.ts +2 -2
  108. package/es/point/models/fill.js +43 -20
  109. package/es/point/models/fillmage.d.ts +2 -2
  110. package/es/point/models/fillmage.js +82 -43
  111. package/es/point/models/image.d.ts +2 -2
  112. package/es/point/models/image.js +72 -31
  113. package/es/point/models/index.d.ts +1 -1
  114. package/es/point/models/index.js +0 -2
  115. package/es/point/models/normal.d.ts +2 -2
  116. package/es/point/models/normal.js +71 -30
  117. package/es/point/models/radar.d.ts +2 -2
  118. package/es/point/models/radar.js +75 -35
  119. package/es/point/models/simplePoint.d.ts +2 -2
  120. package/es/point/models/simplePoint.js +70 -29
  121. package/es/point/models/text.d.ts +3 -2
  122. package/es/point/models/text.js +185 -112
  123. package/es/point/models/tile.d.ts +2 -2
  124. package/es/point/models/tile.js +77 -35
  125. package/es/point/models/tileText.d.ts +2 -2
  126. package/es/point/models/tileText.js +151 -116
  127. package/es/polygon/index.d.ts +2 -3
  128. package/es/polygon/index.js +27 -24
  129. package/es/polygon/models/extrude.d.ts +2 -2
  130. package/es/polygon/models/extrude.js +69 -32
  131. package/es/polygon/models/fill.d.ts +2 -2
  132. package/es/polygon/models/fill.js +76 -43
  133. package/es/polygon/models/index.d.ts +1 -1
  134. package/es/polygon/models/index.js +0 -2
  135. package/es/polygon/models/ocean.d.ts +2 -2
  136. package/es/polygon/models/ocean.js +69 -28
  137. package/es/polygon/models/tile.d.ts +2 -2
  138. package/es/polygon/models/tile.js +70 -30
  139. package/es/polygon/models/water.d.ts +2 -2
  140. package/es/polygon/models/water.js +69 -28
  141. package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +1 -2
  142. package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +1 -2
  143. package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +1 -2
  144. package/es/raster/index.d.ts +2 -3
  145. package/es/raster/index.js +30 -20
  146. package/es/raster/models/index.d.ts +1 -1
  147. package/es/raster/models/index.js +2 -2
  148. package/es/raster/models/raster.d.ts +2 -2
  149. package/es/raster/models/raster.js +39 -28
  150. package/es/raster/models/rasterRgb.d.ts +7 -8
  151. package/es/raster/models/rasterRgb.js +75 -45
  152. package/es/{image/models/tileDataImage.d.ts → raster/models/rasterTerrainRgb.d.ts} +3 -3
  153. package/es/raster/models/rasterTerrainRgb.js +184 -0
  154. package/es/raster/models/rasterTile.d.ts +2 -2
  155. package/es/raster/models/rasterTile.js +78 -37
  156. package/es/raster/shaders/raster_2d_frag.glsl +2 -38
  157. package/es/raster/shaders/raster_rgb_frag.glsl +10 -4
  158. package/es/raster/shaders/raster_terrain_rgb_frag.glsl +31 -0
  159. package/es/raster/shaders/rater_terrain_rgb_vert.glsl +17 -0
  160. package/es/tile/interaction/getRasterData.d.ts +2 -2
  161. package/es/tile/interaction/utils.js +3 -11
  162. package/es/tile/interface.d.ts +5 -4
  163. package/es/tile/manager/base.d.ts +17 -12
  164. package/es/tile/manager/base.js +212 -47
  165. package/es/tile/service/TileLayerService.d.ts +34 -0
  166. package/es/tile/service/TileLayerService.js +220 -0
  167. package/es/tile/service/TilePickService.d.ts +26 -0
  168. package/es/tile/service/TilePickService.js +174 -0
  169. package/es/tile/service/TileSourceService.d.ts +7 -0
  170. package/es/tile/service/TileSourceService.js +39 -0
  171. package/es/tile/style/constants.d.ts +1 -13
  172. package/es/tile/style/constants.js +6 -15
  173. package/es/tile/style/utils.d.ts +1 -8
  174. package/es/tile/style/utils.js +0 -126
  175. package/es/tile/tileFactory/DebugTile.d.ts +16 -0
  176. package/es/tile/tileFactory/DebugTile.js +100 -0
  177. package/es/tile/tileFactory/ImageTile.d.ts +14 -0
  178. package/es/tile/tileFactory/ImageTile.js +89 -0
  179. package/es/tile/tileFactory/MaskTile.d.ts +18 -0
  180. package/es/tile/tileFactory/MaskTile.js +105 -0
  181. package/es/tile/tileFactory/RasterRGBTile.d.ts +11 -0
  182. package/es/tile/tileFactory/RasterRGBTile.js +98 -0
  183. package/es/tile/tileFactory/RasterTerrainRGBTile.d.ts +14 -0
  184. package/es/tile/tileFactory/RasterTerrainRGBTile.js +89 -0
  185. package/es/tile/tileFactory/RasterTile.d.ts +18 -0
  186. package/es/tile/tileFactory/RasterTile.js +133 -0
  187. package/es/tile/tileFactory/Tile.d.ts +34 -0
  188. package/es/tile/tileFactory/Tile.js +161 -0
  189. package/es/tile/tileFactory/VectorTile.d.ts +27 -0
  190. package/es/tile/tileFactory/VectorTile.js +198 -0
  191. package/es/tile/tileFactory/index.d.ts +11 -4
  192. package/es/tile/tileFactory/index.js +34 -23
  193. package/es/tile/tileFactory/layers/{rasterDataLayer.d.ts → RasterDataLayer.d.ts} +3 -3
  194. package/es/tile/tileFactory/layers/{rasterDataLayer.js → RasterDataLayer.js} +34 -22
  195. package/es/tile/tileFactory/layers/{tileTest.d.ts → TileDebugLayer.d.ts} +2 -2
  196. package/es/tile/tileFactory/layers/{tileTest.js → TileDebugLayer.js} +23 -10
  197. package/es/tile/tileFactory/util.d.ts +5 -0
  198. package/es/tile/tileFactory/util.js +21 -0
  199. package/es/tile/tileLayer/BaseLayer.d.ts +45 -0
  200. package/es/tile/tileLayer/BaseLayer.js +348 -0
  201. package/es/tile/utils.d.ts +1 -11
  202. package/es/tile/utils.js +0 -129
  203. package/es/utils/dataMappingStyle.d.ts +4 -4
  204. package/es/utils/dataMappingStyle.js +16 -18
  205. package/es/utils/layerData.js +5 -11
  206. package/es/wind/index.d.ts +2 -3
  207. package/es/wind/index.js +27 -17
  208. package/es/wind/models/wind.d.ts +2 -2
  209. package/es/wind/models/wind.js +123 -104
  210. package/lib/Geometry/index.js +29 -17
  211. package/lib/Geometry/models/billboard.js +79 -37
  212. package/lib/Geometry/models/plane.js +82 -40
  213. package/lib/Geometry/models/sprite.js +85 -45
  214. package/lib/canvas/index.js +31 -19
  215. package/lib/canvas/models/canvas.js +56 -15
  216. package/lib/citybuliding/building.js +28 -17
  217. package/lib/citybuliding/models/build.js +72 -25
  218. package/lib/core/BaseLayer.js +388 -261
  219. package/lib/core/BaseModel.js +48 -6
  220. package/lib/core/LayerPickService.js +179 -0
  221. package/lib/core/TextureService.js +77 -0
  222. package/lib/core/triangulation.js +8 -1
  223. package/lib/earth/index.js +30 -9
  224. package/lib/earth/models/atmosphere.js +69 -22
  225. package/lib/earth/models/base.js +90 -42
  226. package/lib/earth/models/bloomsphere.js +69 -22
  227. package/lib/heatmap/index.js +35 -24
  228. package/lib/heatmap/models/grid.js +70 -27
  229. package/lib/heatmap/models/grid3d.js +72 -29
  230. package/lib/heatmap/models/heatmap.js +40 -14
  231. package/lib/heatmap/models/hexagon.js +71 -28
  232. package/lib/heatmap/shaders/hexagon_3d_vert.glsl +2 -13
  233. package/lib/image/index.js +31 -34
  234. package/lib/image/models/image.js +119 -67
  235. package/lib/image/models/index.js +1 -7
  236. package/lib/image/shaders/dataImage_frag.glsl +10 -16
  237. package/lib/index.js +5 -5
  238. package/lib/line/index.js +53 -26
  239. package/lib/line/models/arc.js +75 -38
  240. package/lib/line/models/arc_3d.js +71 -34
  241. package/lib/line/models/earthArc_3d.js +74 -37
  242. package/lib/line/models/great_circle.js +72 -29
  243. package/lib/line/models/half.js +40 -17
  244. package/lib/line/models/index.js +0 -3
  245. package/lib/line/models/line.js +81 -47
  246. package/lib/line/models/linearline.js +72 -31
  247. package/lib/line/models/simpleLine.js +73 -34
  248. package/lib/line/models/simpleTileLine.js +72 -30
  249. package/lib/line/models/tile.js +40 -17
  250. package/lib/line/models/wall.js +69 -22
  251. package/lib/mask/index.js +28 -99
  252. package/lib/mask/models/fill.js +40 -16
  253. package/lib/mask/models/index.js +1 -4
  254. package/lib/plugins/DataMappingPlugin.js +91 -149
  255. package/lib/plugins/DataSourcePlugin.js +69 -30
  256. package/lib/plugins/FeatureScalePlugin.js +87 -61
  257. package/lib/plugins/LayerModelPlugin.js +128 -41
  258. package/lib/plugins/LayerStylePlugin.js +1 -6
  259. package/lib/plugins/MultiPassRendererPlugin.js +1 -1
  260. package/lib/plugins/PixelPickingPlugin.js +1 -1
  261. package/lib/plugins/RegisterStyleAttributePlugin.js +1 -16
  262. package/lib/plugins/UpdateModelPlugin.js +3 -0
  263. package/lib/plugins/UpdateStyleAttributePlugin.js +3 -6
  264. package/lib/point/index.js +56 -24
  265. package/lib/point/models/earthExtrude.js +75 -30
  266. package/lib/point/models/earthFill.js +68 -21
  267. package/lib/point/models/extrude.js +40 -17
  268. package/lib/point/models/fill.js +44 -21
  269. package/lib/point/models/fillmage.js +84 -43
  270. package/lib/point/models/image.js +74 -31
  271. package/lib/point/models/index.js +0 -3
  272. package/lib/point/models/normal.js +73 -30
  273. package/lib/point/models/radar.js +77 -35
  274. package/lib/point/models/simplePoint.js +72 -29
  275. package/lib/point/models/text.js +185 -111
  276. package/lib/point/models/tile.js +79 -35
  277. package/lib/point/models/tileText.js +151 -115
  278. package/lib/polygon/index.js +29 -25
  279. package/lib/polygon/models/extrude.js +71 -32
  280. package/lib/polygon/models/fill.js +78 -43
  281. package/lib/polygon/models/index.js +0 -3
  282. package/lib/polygon/models/ocean.js +71 -28
  283. package/lib/polygon/models/tile.js +72 -30
  284. package/lib/polygon/models/water.js +71 -28
  285. package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +1 -2
  286. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +1 -2
  287. package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +1 -2
  288. package/lib/raster/index.js +32 -20
  289. package/lib/raster/models/index.js +3 -3
  290. package/lib/raster/models/raster.js +39 -29
  291. package/lib/raster/models/rasterRgb.js +78 -43
  292. package/lib/raster/models/rasterTerrainRgb.js +200 -0
  293. package/lib/raster/models/rasterTile.js +80 -37
  294. package/lib/raster/shaders/raster_2d_frag.glsl +2 -38
  295. package/lib/raster/shaders/raster_rgb_frag.glsl +10 -4
  296. package/lib/raster/shaders/raster_terrain_rgb_frag.glsl +31 -0
  297. package/lib/raster/shaders/rater_terrain_rgb_vert.glsl +17 -0
  298. package/lib/tile/interaction/utils.js +3 -11
  299. package/lib/tile/manager/base.js +213 -47
  300. package/lib/tile/service/TileLayerService.js +233 -0
  301. package/lib/tile/service/TilePickService.js +190 -0
  302. package/lib/tile/service/TileSourceService.js +59 -0
  303. package/lib/tile/style/constants.js +8 -19
  304. package/lib/tile/style/utils.js +0 -140
  305. package/lib/tile/tileFactory/DebugTile.js +115 -0
  306. package/lib/tile/tileFactory/ImageTile.js +104 -0
  307. package/lib/tile/tileFactory/MaskTile.js +120 -0
  308. package/lib/tile/tileFactory/RasterRGBTile.js +112 -0
  309. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +104 -0
  310. package/lib/tile/tileFactory/RasterTile.js +149 -0
  311. package/lib/tile/tileFactory/Tile.js +171 -0
  312. package/lib/tile/tileFactory/VectorTile.js +214 -0
  313. package/lib/tile/tileFactory/index.js +46 -23
  314. package/lib/tile/tileFactory/layers/{rasterDataLayer.js → RasterDataLayer.js} +36 -22
  315. package/lib/tile/tileFactory/layers/{tileTest.js → TileDebugLayer.js} +24 -11
  316. package/lib/tile/tileFactory/util.js +35 -0
  317. package/lib/tile/tileLayer/BaseLayer.js +363 -0
  318. package/lib/tile/utils.js +0 -148
  319. package/lib/utils/dataMappingStyle.js +18 -20
  320. package/lib/utils/layerData.js +4 -10
  321. package/lib/wind/index.js +29 -17
  322. package/lib/wind/models/wind.js +125 -104
  323. package/package.json +7 -7
  324. package/es/heatmap/shaders/hexagon_3d_frag.glsl +0 -0
  325. package/es/image/models/dataImage.d.ts +0 -13
  326. package/es/image/models/dataImage.js +0 -186
  327. package/es/image/models/tileDataImage.js +0 -160
  328. package/es/raster/raster.d.ts +0 -21
  329. package/es/raster/raster.js +0 -161
  330. package/es/tile/interaction/TilePickService.d.ts +0 -16
  331. package/es/tile/interaction/TilePickService.js +0 -129
  332. package/es/tile/manager/layerManager.d.ts +0 -19
  333. package/es/tile/manager/layerManager.js +0 -254
  334. package/es/tile/manager/mapLayerManager.d.ts +0 -7
  335. package/es/tile/manager/mapLayerManager.js +0 -119
  336. package/es/tile/models/tileModel.d.ts +0 -10
  337. package/es/tile/models/tileModel.js +0 -81
  338. package/es/tile/render/TileRenderService.d.ts +0 -10
  339. package/es/tile/render/TileRenderService.js +0 -68
  340. package/es/tile/style/TileStyleService.d.ts +0 -17
  341. package/es/tile/style/TileStyleService.js +0 -118
  342. package/es/tile/tileFactory/base.d.ts +0 -45
  343. package/es/tile/tileFactory/base.js +0 -403
  344. package/es/tile/tileFactory/layers/vectorLayer.d.ts +0 -30
  345. package/es/tile/tileFactory/layers/vectorLayer.js +0 -253
  346. package/es/tile/tileFactory/line.d.ts +0 -12
  347. package/es/tile/tileFactory/line.js +0 -59
  348. package/es/tile/tileFactory/mask.d.ts +0 -12
  349. package/es/tile/tileFactory/mask.js +0 -60
  350. package/es/tile/tileFactory/point.d.ts +0 -12
  351. package/es/tile/tileFactory/point.js +0 -60
  352. package/es/tile/tileFactory/polygon.d.ts +0 -12
  353. package/es/tile/tileFactory/polygon.js +0 -59
  354. package/es/tile/tileFactory/raster.d.ts +0 -12
  355. package/es/tile/tileFactory/raster.js +0 -55
  356. package/es/tile/tileFactory/rasterData.d.ts +0 -12
  357. package/es/tile/tileFactory/rasterData.js +0 -81
  358. package/es/tile/tileFactory/test.d.ts +0 -12
  359. package/es/tile/tileFactory/test.js +0 -94
  360. package/es/tile/tileLayer/MapTileLayer.d.ts +0 -6
  361. package/es/tile/tileLayer/MapTileLayer.js +0 -48
  362. package/es/tile/tileLayer/TileLayer.d.ts +0 -22
  363. package/es/tile/tileLayer/TileLayer.js +0 -198
  364. package/es/tile/tileLayer/base.d.ts +0 -33
  365. package/es/tile/tileLayer/base.js +0 -212
  366. package/lib/heatmap/shaders/hexagon_3d_frag.glsl +0 -0
  367. package/lib/image/models/dataImage.js +0 -201
  368. package/lib/image/models/tileDataImage.js +0 -174
  369. package/lib/raster/raster.js +0 -178
  370. package/lib/tile/interaction/TilePickService.js +0 -143
  371. package/lib/tile/manager/layerManager.js +0 -275
  372. package/lib/tile/manager/mapLayerManager.js +0 -134
  373. package/lib/tile/models/tileModel.js +0 -94
  374. package/lib/tile/render/TileRenderService.js +0 -78
  375. package/lib/tile/style/TileStyleService.js +0 -133
  376. package/lib/tile/tileFactory/base.js +0 -427
  377. package/lib/tile/tileFactory/layers/vectorLayer.js +0 -268
  378. package/lib/tile/tileFactory/line.js +0 -70
  379. package/lib/tile/tileFactory/mask.js +0 -71
  380. package/lib/tile/tileFactory/point.js +0 -71
  381. package/lib/tile/tileFactory/polygon.js +0 -70
  382. package/lib/tile/tileFactory/raster.js +0 -68
  383. package/lib/tile/tileFactory/rasterData.js +0 -93
  384. package/lib/tile/tileFactory/test.js +0 -106
  385. package/lib/tile/tileLayer/MapTileLayer.js +0 -63
  386. package/lib/tile/tileLayer/TileLayer.js +0 -215
  387. package/lib/tile/tileLayer/base.js +0 -225
@@ -1,5 +1,5 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import _initializerDefineProperty from "@babel/runtime/helpers/esm/initializerDefineProperty";
5
5
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
@@ -29,17 +29,19 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
29
29
  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; } }
30
30
 
31
31
  // @ts-ignore
32
- import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';
32
+ import { AsyncSeriesBailHook, AsyncWaterfallHook, SyncBailHook, SyncHook } from '@antv/async-hook';
33
33
  import { BlendType, lazyInject, TYPES } from '@antv/l7-core';
34
34
  import Source from '@antv/l7-source';
35
35
  import { encodePickingColor, WorkerSourceMap } from '@antv/l7-utils';
36
36
  import { EventEmitter } from 'eventemitter3';
37
37
  import { isFunction, isObject, isUndefined } from 'lodash';
38
38
  import { BlendTypes } from "../utils/blend";
39
- import { handleStyleDataMapping } from "../utils/dataMappingStyle";
39
+ import { styleDataMapping } from "../utils/dataMappingStyle";
40
40
  import { calculateData } from "../utils/layerData";
41
41
  import { createMultiPassRenderer, normalizePasses } from "../utils/multiPassRender";
42
42
  import { updateShape } from "../utils/updateShape";
43
+ import LayerPickService from "./LayerPickService";
44
+ import TextureService from "./TextureService";
43
45
  /**
44
46
  * 分配 layer id
45
47
  */
@@ -53,12 +55,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
53
55
  // 生命周期钩子
54
56
  // 待渲染 model 列表
55
57
  // 用于保存子图层对象
56
- // Tip: 用于标识矢量图层
57
58
 
58
59
  /**
59
60
  * 待更新样式属性,在初始化阶段完成注册
60
61
  */
61
- // Tip: layer 保底颜色
62
62
  // private pickingPassRender: IPass<'pixelPicking'>;
63
63
  function BaseLayer() {
64
64
  var _this;
@@ -109,10 +109,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
109
109
  });
110
110
 
111
111
  _defineProperty(_assertThisInitialized(_this), "hooks", {
112
- init: new SyncBailHook(),
112
+ init: new AsyncSeriesBailHook(),
113
113
  afterInit: new SyncBailHook(),
114
114
  beforeRender: new SyncBailHook(),
115
- beforeRenderData: new SyncWaterfallHook(),
115
+ beforeRenderData: new AsyncWaterfallHook(),
116
116
  afterRender: new SyncHook(),
117
117
  beforePickingEncode: new SyncHook(),
118
118
  afterPickingEncode: new SyncHook(),
@@ -126,14 +126,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
126
126
 
127
127
  _defineProperty(_assertThisInitialized(_this), "models", []);
128
128
 
129
- _defineProperty(_assertThisInitialized(_this), "modelLoaded", false);
129
+ _defineProperty(_assertThisInitialized(_this), "startInit", false);
130
130
 
131
131
  _defineProperty(_assertThisInitialized(_this), "layerChildren", []);
132
132
 
133
133
  _defineProperty(_assertThisInitialized(_this), "masks", []);
134
134
 
135
- _defineProperty(_assertThisInitialized(_this), "isVector", false);
136
-
137
135
  _initializerDefineProperty(_assertThisInitialized(_this), "configService", _descriptor, _assertThisInitialized(_this));
138
136
 
139
137
  _defineProperty(_assertThisInitialized(_this), "animateOptions", {
@@ -148,8 +146,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
148
146
 
149
147
  _defineProperty(_assertThisInitialized(_this), "animateStatus", false);
150
148
 
151
- _defineProperty(_assertThisInitialized(_this), "bottomColor", 'rgba(0, 0, 0, 0)');
152
-
153
149
  _defineProperty(_assertThisInitialized(_this), "isDestroyed", false);
154
150
 
155
151
  _defineProperty(_assertThisInitialized(_this), "encodeDataLength", 0);
@@ -163,12 +159,17 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
163
159
  _this.fitBounds(layerConfig.fitBoundsOptions);
164
160
  }
165
161
 
166
- _this.reRender();
162
+ var autoRender = _this.layerSource.getSourceCfg().autoRender;
163
+
164
+ if (autoRender) {
165
+ _this.reRender();
166
+ }
167
167
  });
168
168
 
169
169
  _this.name = config.name || _this.id;
170
170
  _this.zIndex = config.zIndex || 0;
171
- _this.rawConfig = config;
171
+ _this.rawConfig = config; // this.parent = this;
172
+
172
173
  return _this;
173
174
  }
174
175
 
@@ -211,12 +212,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
211
212
  }
212
213
  });
213
214
 
214
- if (!this.inited) {
215
+ if (!this.startInit) {
215
216
  this.needUpdateConfig = _objectSpread(_objectSpread({}, this.needUpdateConfig), configToUpdate);
216
217
  } else {
217
218
  var sceneId = this.container.get(TYPES.SceneID); // @ts-ignore
218
219
 
219
- handleStyleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
220
+ styleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
220
221
 
221
222
  this.configService.setLayerConfig(sceneId, this.id, _objectSpread(_objectSpread(_objectSpread({}, this.configService.getLayerConfig(this.id)), this.needUpdateConfig), configToUpdate));
222
223
  this.needUpdateConfig = {};
@@ -240,16 +241,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
240
241
  value: function getContainer() {
241
242
  return this.container;
242
243
  }
243
- }, {
244
- key: "setBottomColor",
245
- value: function setBottomColor(color) {
246
- this.bottomColor = color;
247
- }
248
- }, {
249
- key: "getBottomColor",
250
- value: function getBottomColor() {
251
- return this.bottomColor;
252
- }
253
244
  }, {
254
245
  key: "addPlugin",
255
246
  value: function addPlugin(plugin) {
@@ -258,105 +249,133 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
258
249
  }
259
250
  }, {
260
251
  key: "init",
261
- value: function init() {
262
- var _this3 = this;
263
-
264
- // 设置配置项
265
- var sceneId = this.container.get(TYPES.SceneID); // 初始化图层配置项
266
- // const { enableMultiPassRenderer = false } = this.rawConfig;
267
- // this.configService.setLayerConfig(sceneId, this.id, {
268
- // enableMultiPassRenderer,
269
- // });
270
-
271
- this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);
272
- this.layerType = this.rawConfig.layerType; // 全局容器服务
273
- // 场景容器服务
274
-
275
- this.iconService = this.container.get(TYPES.IIconService);
276
- this.fontService = this.container.get(TYPES.IFontService);
277
- this.rendererService = this.container.get(TYPES.IRendererService);
278
- this.layerService = this.container.get(TYPES.ILayerService);
279
- this.interactionService = this.container.get(TYPES.IInteractionService);
280
- this.pickingService = this.container.get(TYPES.IPickingService);
281
- this.mapService = this.container.get(TYPES.IMapService);
282
-
283
- var _this$getLayerConfig = this.getLayerConfig(),
284
- enableMultiPassRenderer = _this$getLayerConfig.enableMultiPassRenderer,
285
- passes = _this$getLayerConfig.passes;
286
-
287
- if (enableMultiPassRenderer && passes !== null && passes !== void 0 && passes.length && passes.length > 0) {
288
- // Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom
289
- this.mapService.on('mapAfterFrameChange', function () {
290
- _this3.renderLayers();
291
- });
292
- }
252
+ value: function () {
253
+ var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
254
+ var _this3 = this;
255
+
256
+ var sceneId, _this$getLayerConfig, enableMultiPassRenderer, passes, _iterator, _step, plugin;
257
+
258
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
259
+ while (1) {
260
+ switch (_context.prev = _context.next) {
261
+ case 0:
262
+ // 设置配置项
263
+ sceneId = this.container.get(TYPES.SceneID);
264
+ this.startInit = true; // 初始化图层配置项
265
+ // const { enableMultiPassRenderer = false } = this.rawConfig;
266
+ // this.configService.setLayerConfig(sceneId, this.id, {
267
+ // enableMultiPassRenderer,
268
+ // });
269
+
270
+ this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);
271
+ this.layerType = this.rawConfig.layerType; // 全局容器服务
272
+ // 场景容器服务
273
+
274
+ this.iconService = this.container.get(TYPES.IIconService);
275
+ this.fontService = this.container.get(TYPES.IFontService);
276
+ this.rendererService = this.container.get(TYPES.IRendererService);
277
+ this.layerService = this.container.get(TYPES.ILayerService);
278
+ this.interactionService = this.container.get(TYPES.IInteractionService);
279
+ this.pickingService = this.container.get(TYPES.IPickingService);
280
+ this.mapService = this.container.get(TYPES.IMapService);
281
+ _this$getLayerConfig = this.getLayerConfig(), enableMultiPassRenderer = _this$getLayerConfig.enableMultiPassRenderer, passes = _this$getLayerConfig.passes;
282
+
283
+ if (enableMultiPassRenderer && passes !== null && passes !== void 0 && passes.length && passes.length > 0) {
284
+ // Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom
285
+ this.mapService.on('mapAfterFrameChange', function () {
286
+ _this3.renderLayers();
287
+ });
288
+ }
293
289
 
294
- this.cameraService = this.container.get(TYPES.ICameraService);
295
- this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
296
- this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
297
- this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
298
- this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass); // 图层容器服务
290
+ this.cameraService = this.container.get(TYPES.ICameraService);
291
+ this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
292
+ this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
293
+ this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
294
+ this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass); // 图层容器服务
295
+
296
+ this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService);
297
+
298
+ if (enableMultiPassRenderer) {
299
+ // 按需初始化 瓦片频繁报错
300
+ this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
301
+ this.multiPassRenderer.setLayer(this);
302
+ } // 完成样式服务注册完成前添加的属性
303
+
304
+
305
+ this.pendingStyleAttributes.forEach(function (_ref2) {
306
+ var attributeName = _ref2.attributeName,
307
+ attributeField = _ref2.attributeField,
308
+ attributeValues = _ref2.attributeValues,
309
+ updateOptions = _ref2.updateOptions;
310
+
311
+ _this3.styleAttributeService.updateStyleAttribute(attributeName, {
312
+ // @ts-ignore
313
+ scale: _objectSpread({
314
+ field: attributeField
315
+ }, _this3.splitValuesAndCallbackInAttribute( // @ts-ignore
316
+ attributeValues, // @ts-ignore
317
+ _this3.getLayerConfig()[attributeName]))
318
+ }, // @ts-ignore
319
+ updateOptions);
320
+ });
321
+ this.pendingStyleAttributes = []; // 获取插件集
322
+
323
+ this.plugins = this.container.getAll(TYPES.ILayerPlugin); // 完成插件注册,传入场景和图层容器内的服务
324
+
325
+ _iterator = _createForOfIteratorHelper(this.plugins);
326
+
327
+ try {
328
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
329
+ plugin = _step.value;
330
+ plugin.apply(this, {
331
+ rendererService: this.rendererService,
332
+ mapService: this.mapService,
333
+ styleAttributeService: this.styleAttributeService,
334
+ normalPassFactory: this.normalPassFactory,
335
+ postProcessingPassFactory: this.postProcessingPassFactory
336
+ });
337
+ } // 初始化其他服务
338
+
339
+ } catch (err) {
340
+ _iterator.e(err);
341
+ } finally {
342
+ _iterator.f();
343
+ }
299
344
 
300
- this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService);
301
- this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
302
- this.multiPassRenderer.setLayer(this); // 完成样式服务注册完成前添加的属性
345
+ this.layerPickService = new LayerPickService(this); // 颜色纹理服务
303
346
 
304
- this.pendingStyleAttributes.forEach(function (_ref2) {
305
- var attributeName = _ref2.attributeName,
306
- attributeField = _ref2.attributeField,
307
- attributeValues = _ref2.attributeValues,
308
- updateOptions = _ref2.updateOptions;
347
+ this.textureService = new TextureService(this); // 触发 init 生命周期插件
309
348
 
310
- _this3.styleAttributeService.updateStyleAttribute(attributeName, {
311
- // @ts-ignore
312
- scale: _objectSpread({
313
- field: attributeField
314
- }, _this3.splitValuesAndCallbackInAttribute( // @ts-ignore
315
- attributeValues, // @ts-ignore
316
- _this3.getLayerConfig()[attributeName]))
317
- }, // @ts-ignore
318
- updateOptions);
319
- });
320
- this.pendingStyleAttributes = []; // 获取插件集
321
-
322
- this.plugins = this.container.getAll(TYPES.ILayerPlugin); // 完成插件注册,传入场景和图层容器内的服务
323
-
324
- var _iterator = _createForOfIteratorHelper(this.plugins),
325
- _step;
326
-
327
- try {
328
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
329
- var plugin = _step.value;
330
- plugin.apply(this, {
331
- rendererService: this.rendererService,
332
- mapService: this.mapService,
333
- styleAttributeService: this.styleAttributeService,
334
- normalPassFactory: this.normalPassFactory,
335
- postProcessingPassFactory: this.postProcessingPassFactory
336
- });
337
- } // 触发 init 生命周期插件
338
-
339
- } catch (err) {
340
- _iterator.e(err);
341
- } finally {
342
- _iterator.f();
343
- }
349
+ _context.next = 29;
350
+ return this.hooks.init.promise();
344
351
 
345
- this.hooks.init.call(); // this.pickingPassRender = this.normalPassFactory('pixelPicking');
346
- // this.pickingPassRender.init(this);
352
+ case 29:
353
+ this.inited = true; // 触发初始化完成事件;
347
354
 
348
- this.hooks.afterInit.call(); // 触发初始化完成事件;
355
+ this.emit('inited', {
356
+ target: this,
357
+ type: 'inited'
358
+ });
359
+ this.emit('add', {
360
+ target: this,
361
+ type: 'add'
362
+ });
363
+ this.hooks.afterInit.call();
349
364
 
350
- this.emit('inited', {
351
- target: this,
352
- type: 'inited'
353
- });
354
- this.emit('add', {
355
- target: this,
356
- type: 'add'
357
- });
358
- return this;
359
- }
365
+ case 33:
366
+ case "end":
367
+ return _context.stop();
368
+ }
369
+ }
370
+ }, _callee, this);
371
+ }));
372
+
373
+ function init() {
374
+ return _init.apply(this, arguments);
375
+ }
376
+
377
+ return init;
378
+ }()
360
379
  }, {
361
380
  key: "updateModelData",
362
381
  value: function updateModelData(data) {
@@ -390,6 +409,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
390
409
  };
391
410
  }
392
411
  }
412
+ }, {
413
+ key: "setLayerPickService",
414
+ value: function setLayerPickService(layerPickService) {
415
+ this.layerPickService = layerPickService;
416
+ }
393
417
  }, {
394
418
  key: "calculateEncodeData",
395
419
  value: function calculateEncodeData(data, option) {
@@ -407,8 +431,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
407
431
  }, {
408
432
  key: "prepareBuildModel",
409
433
  value: function prepareBuildModel() {
410
- this.inited = true;
411
- this.updateLayerConfig(_objectSpread(_objectSpread({}, this.getDefaultConfig()), this.rawConfig)); // 启动动画
434
+ this.updateLayerConfig(_objectSpread(_objectSpread(_objectSpread({}, this.getDefaultConfig()), this.rawConfig), this.needUpdateConfig)); // 启动动画
412
435
 
413
436
  var _this$getLayerConfig2 = this.getLayerConfig(),
414
437
  animateOption = _this$getLayerConfig2.animateOption;
@@ -504,7 +527,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
504
527
  // 判断是否为source
505
528
  this.setSource(data);
506
529
  return this;
507
- }
530
+ } // 设置source 配置
531
+
508
532
 
509
533
  this.sourceOption = {
510
534
  data: data,
@@ -527,8 +551,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
527
551
  if (!currentSource) {
528
552
  // 执行 setData 的时候 source 还不存在(还未执行 addLayer)
529
553
  _this4.source(new Source(data, options));
530
-
531
- _this4.sourceEvent();
532
554
  } else {
533
555
  _this4.layerSource.setData(data, options);
534
556
  } // this.layerSource.setData(data, options);
@@ -543,8 +565,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
543
565
  value: function style(options) {
544
566
  var _this5 = this;
545
567
 
546
- var lastConfig = this.getLayerConfig();
547
-
548
568
  var passes = options.passes,
549
569
  rest = _objectWithoutProperties(options, _excluded); // passes 特殊处理
550
570
 
@@ -564,16 +584,16 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
564
584
  if (this.container) {
565
585
  this.updateLayerConfig(this.rawConfig);
566
586
  this.styleNeedUpdate = true;
567
- } // @ts-ignore
587
+ } // TODO style model 更新
588
+ // @ts-ignore
589
+ // if (lastConfig && lastConfig.mask === true && options.mask === false) {
590
+ // this.clearModels();
591
+ // this.layerModel.buildModels((models) => {
592
+ // this.models = models;
593
+ // });
594
+ // }
568
595
 
569
596
 
570
- if (lastConfig && lastConfig.mask === true && options.mask === false) {
571
- this.clearModels();
572
- this.layerModel.buildModels(function (models) {
573
- _this5.models = models;
574
- });
575
- }
576
-
577
597
  return this;
578
598
  }
579
599
  }, {
@@ -607,6 +627,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
607
627
  return this;
608
628
  }
609
629
 
630
+ this.layerService.beforeRenderData(this);
631
+
610
632
  if (this.encodeDataLength <= 0 && !this.forceRender) {
611
633
  return this;
612
634
  } // Tip: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
@@ -622,29 +644,29 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
622
644
  }, {
623
645
  key: "renderMultiPass",
624
646
  value: function () {
625
- var _renderMultiPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
626
- return _regeneratorRuntime.wrap(function _callee$(_context) {
647
+ var _renderMultiPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
648
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
627
649
  while (1) {
628
- switch (_context.prev = _context.next) {
650
+ switch (_context2.prev = _context2.next) {
629
651
  case 0:
630
652
  if (!(this.encodeDataLength <= 0 && !this.forceRender)) {
631
- _context.next = 2;
653
+ _context2.next = 2;
632
654
  break;
633
655
  }
634
656
 
635
- return _context.abrupt("return");
657
+ return _context2.abrupt("return");
636
658
 
637
659
  case 2:
638
660
  if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
639
- _context.next = 7;
661
+ _context2.next = 7;
640
662
  break;
641
663
  }
642
664
 
643
- _context.next = 5;
665
+ _context2.next = 5;
644
666
  return this.multiPassRenderer.render();
645
667
 
646
668
  case 5:
647
- _context.next = 8;
669
+ _context2.next = 8;
648
670
  break;
649
671
 
650
672
  case 7:
@@ -657,10 +679,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
657
679
 
658
680
  case 8:
659
681
  case "end":
660
- return _context.stop();
682
+ return _context2.stop();
661
683
  }
662
684
  }
663
- }, _callee, this);
685
+ }, _callee2, this);
664
686
  }));
665
687
 
666
688
  function renderMultiPass() {
@@ -849,7 +871,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
849
871
  _this$getLayerConfig5 = _this$getLayerConfig3.maxZoom,
850
872
  maxZoom = _this$getLayerConfig5 === void 0 ? Infinity : _this$getLayerConfig5;
851
873
 
852
- return !!visible && zoom >= minZoom && zoom <= maxZoom;
874
+ return !!visible && zoom >= minZoom && zoom < maxZoom;
853
875
  }
854
876
  }, {
855
877
  key: "setMultiPass",
@@ -979,7 +1001,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
979
1001
  this.hooks.beforeDestroy.call(); // 清除sources事件
980
1002
 
981
1003
  this.layerSource.off('update', this.sourceEvent);
982
- (_this$multiPassRender = this.multiPassRenderer) === null || _this$multiPassRender === void 0 ? void 0 : _this$multiPassRender.destroy(); // 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());
1004
+ (_this$multiPassRender = this.multiPassRenderer) === null || _this$multiPassRender === void 0 ? void 0 : _this$multiPassRender.destroy();
1005
+ this.textureService.destroy(); // 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());
983
1006
 
984
1007
  this.styleAttributeService.clearAllAttributes(); // 执行每个图层单独的 clearModels 方法 (清除一些额外的 texture、program、buffer 等)
985
1008
 
@@ -1024,13 +1047,14 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1024
1047
  return !!(this.styleAttributeService.getLayerStyleAttributes() || []).filter(function (attribute) {
1025
1048
  return attribute.needRescale || attribute.needRemapping || attribute.needRegenerateVertices;
1026
1049
  }).length;
1027
- }
1050
+ } // 外部初始化Source
1051
+
1028
1052
  }, {
1029
1053
  key: "setSource",
1030
1054
  value: function setSource(source) {
1031
1055
  var _this8 = this;
1032
1056
 
1033
- // 清除旧 sources 事件
1057
+ // 解除原 sources 事件
1034
1058
  if (this.layerSource) {
1035
1059
  this.layerSource.off('update', this.sourceEvent);
1036
1060
  }
@@ -1041,15 +1065,16 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1041
1065
  if (this.inited && this.layerSource.cluster) {
1042
1066
  var zoom = this.mapService.getZoom();
1043
1067
  this.layerSource.updateClusterData(zoom);
1044
- } // source 可能会复用,会在其它layer被修改
1045
-
1068
+ }
1046
1069
 
1047
1070
  if (this.layerSource.inited) {
1048
1071
  this.sourceEvent();
1049
1072
  } // this.layerSource.inited 为 true update 事件不会再触发
1050
1073
 
1051
1074
 
1052
- this.layerSource.on('update', function () {
1075
+ this.layerSource.on('update', function (_ref3) {
1076
+ var type = _ref3.type;
1077
+
1053
1078
  if (_this8.coordCenter === undefined) {
1054
1079
  var _this8$mapService;
1055
1080
 
@@ -1061,13 +1086,45 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1061
1086
  }
1062
1087
  }
1063
1088
 
1064
- _this8.sourceEvent();
1089
+ if (type === 'update') {
1090
+ // source 初始化不需要处理
1091
+ _this8.sourceEvent();
1092
+ }
1065
1093
  });
1094
+ } // layer 初始化source
1095
+
1096
+ }, {
1097
+ key: "initSource",
1098
+ value: function initSource(source) {
1099
+ this.layerSource = source;
1100
+ this.clusterZoom = 0;
1101
+ this.addSourceEvent();
1066
1102
  }
1067
1103
  }, {
1068
1104
  key: "getSource",
1069
1105
  value: function getSource() {
1070
1106
  return this.layerSource;
1107
+ } // 注册source 更新事件
1108
+
1109
+ }, {
1110
+ key: "addSourceEvent",
1111
+ value: function addSourceEvent() {
1112
+ var _this9 = this;
1113
+
1114
+ this.layerSource.on('update', function () {
1115
+ if (_this9.coordCenter === undefined) {
1116
+ var _this9$mapService;
1117
+
1118
+ var layerCenter = _this9.layerSource.center;
1119
+ _this9.coordCenter = layerCenter;
1120
+
1121
+ if ((_this9$mapService = _this9.mapService) !== null && _this9$mapService !== void 0 && _this9$mapService.setCoordCenter) {
1122
+ _this9.mapService.setCoordCenter(layerCenter);
1123
+ }
1124
+ }
1125
+
1126
+ _this9.sourceEvent();
1127
+ });
1071
1128
  }
1072
1129
  }, {
1073
1130
  key: "getScaleOptions",
@@ -1146,9 +1203,9 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1146
1203
  }
1147
1204
  }, {
1148
1205
  key: "pick",
1149
- value: function pick(_ref6) {
1150
- var x = _ref6.x,
1151
- y = _ref6.y;
1206
+ value: function pick(_ref7) {
1207
+ var x = _ref7.x,
1208
+ y = _ref7.y;
1152
1209
  this.interactionService.triggerHover({
1153
1210
  x: x,
1154
1211
  y: y
@@ -1161,76 +1218,79 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1161
1218
  }
1162
1219
  }, {
1163
1220
  key: "buildLayerModel",
1164
- value: function buildLayerModel(options) {
1165
- var _this9 = this;
1221
+ value: function () {
1222
+ var _buildLayerModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
1223
+ var _this10 = this;
1166
1224
 
1167
- var moduleName = options.moduleName,
1168
- vertexShader = options.vertexShader,
1169
- fragmentShader = options.fragmentShader,
1170
- triangulation = options.triangulation,
1171
- segmentNumber = options.segmentNumber,
1172
- _options$workerEnable = options.workerEnabled,
1173
- workerEnabled = _options$workerEnable === void 0 ? false : _options$workerEnable,
1174
- workerOptions = options.workerOptions,
1175
- rest = _objectWithoutProperties(options, _excluded2);
1176
-
1177
- this.shaderModuleService.registerModule(moduleName, {
1178
- vs: vertexShader,
1179
- fs: fragmentShader
1180
- });
1225
+ var moduleName, vertexShader, fragmentShader, triangulation, segmentNumber, _options$workerEnable, workerEnabled, workerOptions, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
1181
1226
 
1182
- var _this$shaderModuleSer = this.shaderModuleService.getModule(moduleName),
1183
- vs = _this$shaderModuleSer.vs,
1184
- fs = _this$shaderModuleSer.fs,
1185
- uniforms = _this$shaderModuleSer.uniforms;
1186
-
1187
- var createModel = this.rendererService.createModel;
1188
- return new Promise(function (resolve, reject) {
1189
- setTimeout(function () {
1190
- // filter supported worker & worker enabled layer
1191
- if (workerOptions && workerOptions.modelType in WorkerSourceMap && workerEnabled) {
1192
- _this9.styleAttributeService.createAttributesAndIndicesAscy(_this9.encodedData, segmentNumber, workerOptions).then(function (_ref7) {
1193
- var attributes = _ref7.attributes,
1194
- elements = _ref7.elements;
1195
- var m = createModel(_objectSpread({
1196
- attributes: attributes,
1197
- uniforms: uniforms,
1198
- fs: fs,
1199
- vs: vs,
1200
- elements: elements,
1201
- blend: BlendTypes[BlendType.normal]
1202
- }, rest));
1203
- resolve(m);
1204
- }).catch(function (err) {
1205
- return reject(err);
1206
- });
1207
- } else {
1208
- // console.log(this.encodedData[1].originCoordinates[0])
1209
- // console.log(this.encodedData[1].coordinates[0])
1210
- var _this9$styleAttribute = _this9.styleAttributeService.createAttributesAndIndices(_this9.encodedData, triangulation, segmentNumber),
1211
- attributes = _this9$styleAttribute.attributes,
1212
- elements = _this9$styleAttribute.elements,
1213
- count = _this9$styleAttribute.count;
1214
-
1215
- var modelOptions = _objectSpread({
1216
- attributes: attributes,
1217
- uniforms: uniforms,
1218
- fs: fs,
1219
- vs: vs,
1220
- elements: elements,
1221
- blend: BlendTypes[BlendType.normal]
1222
- }, rest);
1223
-
1224
- if (count) {
1225
- modelOptions.count = count;
1226
- }
1227
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
1228
+ while (1) {
1229
+ switch (_context3.prev = _context3.next) {
1230
+ case 0:
1231
+ moduleName = options.moduleName, vertexShader = options.vertexShader, fragmentShader = options.fragmentShader, triangulation = options.triangulation, segmentNumber = options.segmentNumber, _options$workerEnable = options.workerEnabled, workerEnabled = _options$workerEnable === void 0 ? false : _options$workerEnable, workerOptions = options.workerOptions, rest = _objectWithoutProperties(options, _excluded2);
1232
+ this.shaderModuleService.registerModule(moduleName, {
1233
+ vs: vertexShader,
1234
+ fs: fragmentShader
1235
+ });
1236
+ _this$shaderModuleSer = this.shaderModuleService.getModule(moduleName), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, uniforms = _this$shaderModuleSer.uniforms;
1237
+ createModel = this.rendererService.createModel;
1238
+ return _context3.abrupt("return", new Promise(function (resolve, reject) {
1239
+ // filter supported worker & worker enabled layer
1240
+ if (workerOptions && workerOptions.modelType in WorkerSourceMap && workerEnabled) {
1241
+ _this10.styleAttributeService.createAttributesAndIndicesAscy(_this10.encodedData, segmentNumber, workerOptions).then(function (_ref8) {
1242
+ var attributes = _ref8.attributes,
1243
+ elements = _ref8.elements;
1244
+ var m = createModel(_objectSpread({
1245
+ attributes: attributes,
1246
+ uniforms: uniforms,
1247
+ fs: fs,
1248
+ vs: vs,
1249
+ elements: elements,
1250
+ blend: BlendTypes[BlendType.normal]
1251
+ }, rest));
1252
+ resolve(m);
1253
+ }).catch(function (err) {
1254
+ return reject(err);
1255
+ });
1256
+ } else {
1257
+ var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, segmentNumber),
1258
+ attributes = _this10$styleAttribut.attributes,
1259
+ elements = _this10$styleAttribut.elements,
1260
+ count = _this10$styleAttribut.count;
1261
+
1262
+ var modelOptions = _objectSpread({
1263
+ attributes: attributes,
1264
+ uniforms: uniforms,
1265
+ fs: fs,
1266
+ vs: vs,
1267
+ elements: elements,
1268
+ blend: BlendTypes[BlendType.normal]
1269
+ }, rest);
1270
+
1271
+ if (count) {
1272
+ modelOptions.count = count;
1273
+ }
1274
+
1275
+ var m = createModel(modelOptions);
1276
+ resolve(m);
1277
+ }
1278
+ }));
1227
1279
 
1228
- var m = createModel(modelOptions);
1229
- resolve(m);
1280
+ case 5:
1281
+ case "end":
1282
+ return _context3.stop();
1283
+ }
1230
1284
  }
1231
- });
1232
- });
1233
- }
1285
+ }, _callee3, this);
1286
+ }));
1287
+
1288
+ function buildLayerModel(_x) {
1289
+ return _buildLayerModel.apply(this, arguments);
1290
+ }
1291
+
1292
+ return buildLayerModel;
1293
+ }()
1234
1294
  }, {
1235
1295
  key: "createAttributes",
1236
1296
  value: function createAttributes(options) {
@@ -1272,11 +1332,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1272
1332
  }, {
1273
1333
  key: "needPick",
1274
1334
  value: function needPick(type) {
1275
- // 地图图层的判断
1276
- if (this.rawConfig.usage === 'basemap') {
1277
- return false;
1278
- }
1279
-
1280
1335
  var _this$getLayerConfig10 = this.getLayerConfig(),
1281
1336
  _this$getLayerConfig11 = _this$getLayerConfig10.enableHighlight,
1282
1337
  enableHighlight = _this$getLayerConfig11 === void 0 ? true : _this$getLayerConfig11,
@@ -1298,34 +1353,73 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1298
1353
  }
1299
1354
  }, {
1300
1355
  key: "buildModels",
1301
- value: function buildModels() {
1302
- throw new Error('Method not implemented.');
1303
- }
1356
+ value: function () {
1357
+ var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
1358
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
1359
+ while (1) {
1360
+ switch (_context4.prev = _context4.next) {
1361
+ case 0:
1362
+ throw new Error('Method not implemented.');
1363
+
1364
+ case 1:
1365
+ case "end":
1366
+ return _context4.stop();
1367
+ }
1368
+ }
1369
+ }, _callee4);
1370
+ }));
1371
+
1372
+ function buildModels() {
1373
+ return _buildModels.apply(this, arguments);
1374
+ }
1375
+
1376
+ return buildModels;
1377
+ }()
1304
1378
  }, {
1305
1379
  key: "rebuildModels",
1306
- value: function rebuildModels() {
1307
- throw new Error('Method not implemented.');
1308
- }
1380
+ value: function () {
1381
+ var _rebuildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
1382
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
1383
+ while (1) {
1384
+ switch (_context5.prev = _context5.next) {
1385
+ case 0:
1386
+ _context5.next = 2;
1387
+ return this.buildModels();
1388
+
1389
+ case 2:
1390
+ case "end":
1391
+ return _context5.stop();
1392
+ }
1393
+ }
1394
+ }, _callee5, this);
1395
+ }));
1396
+
1397
+ function rebuildModels() {
1398
+ return _rebuildModels.apply(this, arguments);
1399
+ }
1400
+
1401
+ return rebuildModels;
1402
+ }()
1309
1403
  }, {
1310
1404
  key: "renderMulPass",
1311
1405
  value: function () {
1312
- var _renderMulPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(multiPassRenderer) {
1313
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1406
+ var _renderMulPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(multiPassRenderer) {
1407
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
1314
1408
  while (1) {
1315
- switch (_context2.prev = _context2.next) {
1409
+ switch (_context6.prev = _context6.next) {
1316
1410
  case 0:
1317
- _context2.next = 2;
1411
+ _context6.next = 2;
1318
1412
  return multiPassRenderer.render();
1319
1413
 
1320
1414
  case 2:
1321
1415
  case "end":
1322
- return _context2.stop();
1416
+ return _context6.stop();
1323
1417
  }
1324
1418
  }
1325
- }, _callee2);
1419
+ }, _callee6);
1326
1420
  }));
1327
1421
 
1328
- function renderMulPass(_x) {
1422
+ function renderMulPass(_x2) {
1329
1423
  return _renderMulPass.apply(this, arguments);
1330
1424
  }
1331
1425
 
@@ -1334,34 +1428,35 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1334
1428
  }, {
1335
1429
  key: "renderModels",
1336
1430
  value: function renderModels(isPicking) {
1337
- var _this10 = this;
1431
+ var _this11 = this;
1338
1432
 
1339
1433
  // TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
1340
1434
  if (this.encodeDataLength <= 0 && !this.forceRender) {
1341
1435
  return this;
1342
1436
  }
1343
1437
 
1344
- if (this.layerModelNeedUpdate && this.layerModel) {
1345
- this.layerModel.buildModels(function (models) {
1346
- _this10.models = models;
1347
-
1348
- _this10.hooks.beforeRender.call();
1349
-
1350
- _this10.layerModelNeedUpdate = false;
1351
- });
1352
- }
1353
-
1438
+ this.hooks.beforeRender.call();
1354
1439
  this.models.forEach(function (model) {
1355
1440
  model.draw({
1356
- uniforms: _this10.layerModel.getUninforms()
1441
+ uniforms: _this11.layerModel.getUninforms()
1357
1442
  }, isPicking);
1358
1443
  });
1444
+ this.hooks.afterRender.call();
1359
1445
  return this;
1360
1446
  }
1361
1447
  }, {
1362
1448
  key: "updateStyleAttribute",
1363
1449
  value: function updateStyleAttribute(type, field, values, updateOptions) {
1364
- if (!this.inited) {
1450
+ // 存储 Attribute
1451
+ if (['color', 'size', 'texture', 'rotate', 'filter', 'label', 'shape'].indexOf(type) !== -1) {
1452
+ this.configService.setAttributeConfig(this.id, _defineProperty({}, type, {
1453
+ field: field,
1454
+ values: values
1455
+ }));
1456
+ }
1457
+
1458
+ if (!this.startInit) {
1459
+ // 开始初始化执行
1365
1460
  this.pendingStyleAttributes.push({
1366
1461
  attributeName: type,
1367
1462
  attributeField: field,
@@ -1380,6 +1475,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1380
1475
  updateOptions);
1381
1476
  }
1382
1477
  }
1478
+ }, {
1479
+ key: "getLayerAttributeConfig",
1480
+ value: function getLayerAttributeConfig() {
1481
+ return this.configService.getAttributeConfig(this.id);
1482
+ }
1383
1483
  }, {
1384
1484
  key: "getShaderPickStat",
1385
1485
  value: function getShaderPickStat() {
@@ -1395,6 +1495,13 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1395
1495
  key: "setEarthTime",
1396
1496
  value: function setEarthTime(time) {
1397
1497
  console.warn('empty fn');
1498
+ } // 数据处理 在数据进行 mapping 生成 encodeData 之前对数据进行处理
1499
+ // 在各个 layer 中继承
1500
+
1501
+ }, {
1502
+ key: "processData",
1503
+ value: function processData(filterData) {
1504
+ return filterData;
1398
1505
  }
1399
1506
  }, {
1400
1507
  key: "getModelType",
@@ -1407,23 +1514,37 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1407
1514
  return {};
1408
1515
  }
1409
1516
  }, {
1410
- key: "dispatchModelLoad",
1411
- value: function dispatchModelLoad(models) {
1412
- var _this11 = this;
1517
+ key: "initLayerModels",
1518
+ value: function () {
1519
+ var _initLayerModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
1520
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
1521
+ while (1) {
1522
+ switch (_context7.prev = _context7.next) {
1523
+ case 0:
1524
+ this.models.forEach(function (model) {
1525
+ return model.destroy();
1526
+ });
1527
+ this.models = [];
1528
+ _context7.next = 4;
1529
+ return this.layerModel.initModels();
1413
1530
 
1414
- this.models.forEach(function (model) {
1415
- return model.destroy();
1416
- });
1417
- this.models = [];
1418
- this.models = models;
1419
- this.emit('modelLoaded', null);
1420
- this.modelLoaded = true; // Tip: setTimeout 用于延迟绘制,可以让拖动图层时连续的 setData 更加平滑 - L7Draw
1531
+ case 4:
1532
+ this.models = _context7.sent;
1421
1533
 
1422
- setTimeout(function () {
1423
- // Tip: 使用 renderLayers 而不是 throttleRenderLayers,让图层之间的 setData 更新绘制不存在延迟
1424
- _this11.layerService.renderLayers();
1425
- }, 32);
1426
- }
1534
+ case 5:
1535
+ case "end":
1536
+ return _context7.stop();
1537
+ }
1538
+ }
1539
+ }, _callee7, this);
1540
+ }));
1541
+
1542
+ function initLayerModels() {
1543
+ return _initLayerModels.apply(this, arguments);
1544
+ }
1545
+
1546
+ return initLayerModels;
1547
+ }()
1427
1548
  }, {
1428
1549
  key: "reRender",
1429
1550
  value: function reRender() {