@antv/l7-layers 2.9.26-alpha.0 → 2.9.26-alpha.1

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 (579) hide show
  1. package/es/Geometry/index.d.ts +19 -0
  2. package/es/Geometry/index.js +106 -0
  3. package/es/Geometry/models/billboard.d.ts +26 -0
  4. package/es/Geometry/models/billboard.js +232 -0
  5. package/es/Geometry/models/index.d.ts +5 -0
  6. package/es/Geometry/models/index.js +9 -0
  7. package/es/Geometry/models/plane.d.ts +45 -0
  8. package/es/Geometry/models/plane.js +421 -0
  9. package/es/Geometry/models/sprite.d.ts +47 -0
  10. package/es/Geometry/models/sprite.js +304 -0
  11. package/es/Geometry/shaders/billboard_frag.glsl +13 -0
  12. package/es/Geometry/shaders/billboard_vert.glsl +50 -0
  13. package/es/Geometry/shaders/plane_frag.glsl +22 -0
  14. package/es/Geometry/shaders/plane_vert.glsl +53 -0
  15. package/es/Geometry/shaders/sprite_frag.glsl +21 -0
  16. package/es/Geometry/shaders/sprite_vert.glsl +28 -0
  17. package/es/canvas/index.d.ts +19 -0
  18. package/es/canvas/index.js +91 -0
  19. package/es/canvas/models/canvas.d.ts +18 -0
  20. package/es/canvas/models/canvas.js +212 -0
  21. package/es/canvas/models/index.d.ts +5 -0
  22. package/es/canvas/models/index.js +5 -0
  23. package/es/citybuliding/building.d.ts +17 -0
  24. package/es/citybuliding/building.js +88 -0
  25. package/es/citybuliding/models/build.d.ts +22 -0
  26. package/es/citybuliding/models/build.js +188 -0
  27. package/es/citybuliding/shaders/build_frag.glsl +117 -0
  28. package/es/citybuliding/shaders/build_vert.glsl +54 -0
  29. package/es/core/BaseLayer.d.ts +208 -0
  30. package/es/core/BaseLayer.js +1409 -0
  31. package/es/core/BaseModel.d.ts +140 -0
  32. package/es/core/BaseModel.js +486 -0
  33. package/es/core/interface.d.ts +201 -0
  34. package/es/core/interface.js +30 -0
  35. package/es/core/schema.d.ts +27 -0
  36. package/es/core/schema.js +25 -0
  37. package/es/core/shape/Path.d.ts +39 -0
  38. package/es/core/shape/Path.js +62 -0
  39. package/es/core/shape/extrude.d.ts +17 -0
  40. package/es/core/shape/extrude.js +148 -0
  41. package/es/core/triangulation.d.ts +122 -0
  42. package/es/core/triangulation.js +491 -0
  43. package/es/earth/index.d.ts +17 -0
  44. package/es/earth/index.js +91 -0
  45. package/es/earth/models/atmosphere.d.ts +9 -0
  46. package/es/earth/models/atmosphere.js +138 -0
  47. package/es/earth/models/base.d.ts +16 -0
  48. package/es/earth/models/base.js +212 -0
  49. package/es/earth/models/bloomsphere.d.ts +9 -0
  50. package/es/earth/models/bloomsphere.js +138 -0
  51. package/es/earth/shaders/atmosphere_frag.glsl +17 -0
  52. package/es/earth/shaders/atmosphere_vert.glsl +26 -0
  53. package/es/earth/shaders/base_frag.glsl +13 -0
  54. package/es/earth/shaders/base_vert.glsl +52 -0
  55. package/es/earth/shaders/bloomsphere_frag.glsl +15 -0
  56. package/es/earth/shaders/bloomsphere_vert.glsl +20 -0
  57. package/es/earth/utils.d.ts +26 -0
  58. package/es/earth/utils.js +104 -0
  59. package/es/heatmap/index.d.ts +21 -0
  60. package/es/heatmap/index.js +145 -0
  61. package/es/heatmap/models/grid.d.ts +8 -0
  62. package/es/heatmap/models/grid.js +108 -0
  63. package/es/heatmap/models/grid3d.d.ts +8 -0
  64. package/es/heatmap/models/grid3d.js +147 -0
  65. package/es/heatmap/models/heatmap.d.ts +24 -0
  66. package/es/heatmap/models/heatmap.js +464 -0
  67. package/es/heatmap/models/hexagon.d.ts +8 -0
  68. package/es/heatmap/models/hexagon.js +111 -0
  69. package/es/heatmap/models/index.d.ts +5 -0
  70. package/es/heatmap/models/index.js +12 -0
  71. package/es/heatmap/shaders/grid_vert.glsl +42 -0
  72. package/es/heatmap/shaders/heatmap_3d_frag.glsl +14 -0
  73. package/es/heatmap/shaders/heatmap_3d_vert.glsl +46 -0
  74. package/es/heatmap/shaders/heatmap_frag.glsl +47 -0
  75. package/es/heatmap/shaders/heatmap_framebuffer_frag.glsl +10 -0
  76. package/es/heatmap/shaders/heatmap_framebuffer_vert.glsl +35 -0
  77. package/es/heatmap/shaders/heatmap_vert.glsl +10 -0
  78. package/es/heatmap/shaders/hexagon_3d_frag.glsl +0 -0
  79. package/es/heatmap/shaders/hexagon_3d_vert.glsl +64 -0
  80. package/es/heatmap/shaders/hexagon_frag.glsl +12 -0
  81. package/es/heatmap/shaders/hexagon_vert.glsl +41 -0
  82. package/es/heatmap/triangulation.d.ts +5 -0
  83. package/es/heatmap/triangulation.js +38 -0
  84. package/es/image/index.d.ts +19 -0
  85. package/es/image/index.js +103 -0
  86. package/es/image/models/dataImage.d.ts +22 -0
  87. package/es/image/models/dataImage.js +225 -0
  88. package/es/image/models/image.d.ts +19 -0
  89. package/es/image/models/image.js +169 -0
  90. package/es/image/models/index.d.ts +5 -0
  91. package/es/image/models/index.js +7 -0
  92. package/es/image/shaders/dataImage_frag.glsl +38 -0
  93. package/es/image/shaders/image_frag.glsl +9 -0
  94. package/es/image/shaders/image_vert.glsl +17 -0
  95. package/es/index.d.ts +16 -0
  96. package/es/index.js +106 -0
  97. package/es/line/index.d.ts +25 -0
  98. package/es/line/index.js +122 -0
  99. package/es/line/models/arc.d.ts +17 -0
  100. package/es/line/models/arc.js +356 -0
  101. package/es/line/models/arc_3d.d.ts +17 -0
  102. package/es/line/models/arc_3d.js +335 -0
  103. package/es/line/models/earthArc_3d.d.ts +17 -0
  104. package/es/line/models/earthArc_3d.js +338 -0
  105. package/es/line/models/great_circle.d.ts +12 -0
  106. package/es/line/models/great_circle.js +294 -0
  107. package/es/line/models/half.d.ts +18 -0
  108. package/es/line/models/half.js +282 -0
  109. package/es/line/models/index.d.ts +5 -0
  110. package/es/line/models/index.js +25 -0
  111. package/es/line/models/line.d.ts +21 -0
  112. package/es/line/models/line.js +442 -0
  113. package/es/line/models/linearline.d.ts +11 -0
  114. package/es/line/models/linearline.js +276 -0
  115. package/es/line/models/simpleLine.d.ts +14 -0
  116. package/es/line/models/simpleLine.js +233 -0
  117. package/es/line/models/tile.d.ts +11 -0
  118. package/es/line/models/tile.js +351 -0
  119. package/es/line/models/wall.d.ts +12 -0
  120. package/es/line/models/wall.js +329 -0
  121. package/es/line/shaders/arc_chunks.vert.glsl +21 -0
  122. package/es/line/shaders/dash/arc_dash_frag.glsl +28 -0
  123. package/es/line/shaders/dash/arc_dash_vert.glsl +148 -0
  124. package/es/line/shaders/dash/line_dash_frag.glsl +31 -0
  125. package/es/line/shaders/dash/line_dash_vert.glsl +93 -0
  126. package/es/line/shaders/half/line_half_frag.glsl +53 -0
  127. package/es/line/shaders/half/line_half_vert.glsl +169 -0
  128. package/es/line/shaders/line_arc2d_vert.glsl +114 -0
  129. package/es/line/shaders/line_arc_3d_frag.glsl +103 -0
  130. package/es/line/shaders/line_arc_3d_vert.glsl +207 -0
  131. package/es/line/shaders/line_arc_frag.glsl +89 -0
  132. package/es/line/shaders/line_arc_great_circle_frag.glsl +101 -0
  133. package/es/line/shaders/line_arc_great_circle_vert.glsl +215 -0
  134. package/es/line/shaders/line_arc_vert.glsl +176 -0
  135. package/es/line/shaders/line_bezier_vert.glsl +85 -0
  136. package/es/line/shaders/line_frag.glsl +100 -0
  137. package/es/line/shaders/line_vert.glsl +192 -0
  138. package/es/line/shaders/linear/arc3d_linear_frag.glsl +47 -0
  139. package/es/line/shaders/linear/arc3d_linear_vert.glsl +207 -0
  140. package/es/line/shaders/linear/arc_linear_frag.glsl +38 -0
  141. package/es/line/shaders/linear/arc_linear_vert.glsl +138 -0
  142. package/es/line/shaders/linear/line_linear_frag.glsl +27 -0
  143. package/es/line/shaders/linearLine/line_linear_frag.glsl +20 -0
  144. package/es/line/shaders/linearLine/line_linear_vert.glsl +112 -0
  145. package/es/line/shaders/simple/simpleline_frag.glsl +10 -0
  146. package/es/line/shaders/simple/simpleline_linear_frag.glsl +11 -0
  147. package/es/line/shaders/simple/simpleline_vert.glsl +79 -0
  148. package/es/line/shaders/tile/line_tile_frag.glsl +79 -0
  149. package/es/line/shaders/tile/line_tile_vert.glsl +210 -0
  150. package/es/line/shaders/wall_frag.glsl +93 -0
  151. package/es/line/shaders/wall_vert.glsl +111 -0
  152. package/es/mask/index.d.ts +18 -0
  153. package/es/mask/index.js +82 -0
  154. package/es/mask/models/fill.d.ts +11 -0
  155. package/es/mask/models/fill.js +121 -0
  156. package/es/mask/models/index.d.ts +5 -0
  157. package/es/mask/models/index.js +5 -0
  158. package/es/mask/shaders/mask_frag.glsl +7 -0
  159. package/es/mask/shaders/mask_vert.glsl +22 -0
  160. package/es/plugins/DataMappingPlugin.d.ts +18 -0
  161. package/es/plugins/DataMappingPlugin.js +345 -0
  162. package/es/plugins/DataSourcePlugin.d.ts +7 -0
  163. package/es/plugins/DataSourcePlugin.js +89 -0
  164. package/es/plugins/FeatureScalePlugin.d.ts +25 -0
  165. package/es/plugins/FeatureScalePlugin.js +324 -0
  166. package/es/plugins/LayerAnimateStylePlugin.d.ts +7 -0
  167. package/es/plugins/LayerAnimateStylePlugin.js +49 -0
  168. package/es/plugins/LayerModelPlugin.d.ts +10 -0
  169. package/es/plugins/LayerModelPlugin.js +71 -0
  170. package/es/plugins/LayerStylePlugin.d.ts +8 -0
  171. package/es/plugins/LayerStylePlugin.js +39 -0
  172. package/es/plugins/LightingPlugin.d.ts +36 -0
  173. package/es/plugins/LightingPlugin.js +110 -0
  174. package/es/plugins/MultiPassRendererPlugin.d.ts +24 -0
  175. package/es/plugins/MultiPassRendererPlugin.js +77 -0
  176. package/es/plugins/PixelPickingPlugin.d.ts +8 -0
  177. package/es/plugins/PixelPickingPlugin.js +146 -0
  178. package/es/plugins/RegisterStyleAttributePlugin.d.ts +11 -0
  179. package/es/plugins/RegisterStyleAttributePlugin.js +105 -0
  180. package/es/plugins/ShaderUniformPlugin.d.ts +17 -0
  181. package/es/plugins/ShaderUniformPlugin.js +107 -0
  182. package/es/plugins/UpdateModelPlugin.d.ts +8 -0
  183. package/es/plugins/UpdateModelPlugin.js +31 -0
  184. package/es/plugins/UpdateStyleAttributePlugin.d.ts +12 -0
  185. package/es/plugins/UpdateStyleAttributePlugin.js +87 -0
  186. package/es/point/index.d.ts +30 -0
  187. package/es/point/index.js +224 -0
  188. package/es/point/models/earthExtrude.d.ts +24 -0
  189. package/es/point/models/earthExtrude.js +279 -0
  190. package/es/point/models/earthFill.d.ts +11 -0
  191. package/es/point/models/earthFill.js +258 -0
  192. package/es/point/models/extrude.d.ts +24 -0
  193. package/es/point/models/extrude.js +298 -0
  194. package/es/point/models/fill.d.ts +40 -0
  195. package/es/point/models/fill.js +404 -0
  196. package/es/point/models/fillmage.d.ts +25 -0
  197. package/es/point/models/fillmage.js +367 -0
  198. package/es/point/models/image.d.ts +11 -0
  199. package/es/point/models/image.js +239 -0
  200. package/es/point/models/index.d.ts +5 -0
  201. package/es/point/models/index.js +28 -0
  202. package/es/point/models/normal.d.ts +17 -0
  203. package/es/point/models/normal.js +177 -0
  204. package/es/point/models/radar.d.ts +24 -0
  205. package/es/point/models/radar.js +297 -0
  206. package/es/point/models/simplePoint.d.ts +17 -0
  207. package/es/point/models/simplePoint.js +188 -0
  208. package/es/point/models/text.d.ts +57 -0
  209. package/es/point/models/text.js +622 -0
  210. package/es/point/models/tile.d.ts +22 -0
  211. package/es/point/models/tile.js +309 -0
  212. package/es/point/shaders/animate/wave_frag.glsl +65 -0
  213. package/es/point/shaders/earth/extrude_frag.glsl +44 -0
  214. package/es/point/shaders/earth/extrude_vert.glsl +140 -0
  215. package/es/point/shaders/earth/fill_frag.glsl +86 -0
  216. package/es/point/shaders/earth/fill_vert.glsl +126 -0
  217. package/es/point/shaders/extrude/extrude_frag.glsl +44 -0
  218. package/es/point/shaders/extrude/extrude_vert.glsl +121 -0
  219. package/es/point/shaders/fill_frag.glsl +84 -0
  220. package/es/point/shaders/fill_vert.glsl +189 -0
  221. package/es/point/shaders/image/fillImage_frag.glsl +20 -0
  222. package/es/point/shaders/image/fillImage_vert.glsl +116 -0
  223. package/es/point/shaders/image_frag.glsl +39 -0
  224. package/es/point/shaders/image_vert.glsl +90 -0
  225. package/es/point/shaders/normal_frag.glsl +15 -0
  226. package/es/point/shaders/normal_vert.glsl +79 -0
  227. package/es/point/shaders/radar/radar_frag.glsl +64 -0
  228. package/es/point/shaders/radar/radar_vert.glsl +120 -0
  229. package/es/point/shaders/simplePoint_frag.glsl +53 -0
  230. package/es/point/shaders/simplePoint_vert.glsl +79 -0
  231. package/es/point/shaders/text_frag.glsl +48 -0
  232. package/es/point/shaders/text_vert.glsl +131 -0
  233. package/es/point/shaders/tile/fill_tile_frag.glsl +83 -0
  234. package/es/point/shaders/tile/fill_tile_vert.glsl +181 -0
  235. package/es/point/shape/extrude.d.ts +15 -0
  236. package/es/point/shape/extrude.js +63 -0
  237. package/es/polygon/index.d.ts +19 -0
  238. package/es/polygon/index.js +148 -0
  239. package/es/polygon/models/extrude.d.ts +28 -0
  240. package/es/polygon/models/extrude.js +306 -0
  241. package/es/polygon/models/fill.d.ts +17 -0
  242. package/es/polygon/models/fill.js +211 -0
  243. package/es/polygon/models/index.d.ts +5 -0
  244. package/es/polygon/models/index.js +28 -0
  245. package/es/polygon/models/ocean.d.ts +23 -0
  246. package/es/polygon/models/ocean.js +236 -0
  247. package/es/polygon/models/tile.d.ts +15 -0
  248. package/es/polygon/models/tile.js +133 -0
  249. package/es/polygon/models/water.d.ts +18 -0
  250. package/es/polygon/models/water.js +213 -0
  251. package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +44 -0
  252. package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +44 -0
  253. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +85 -0
  254. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +90 -0
  255. package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +48 -0
  256. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +93 -0
  257. package/es/polygon/shaders/polygon_frag.glsl +12 -0
  258. package/es/polygon/shaders/polygon_linear_frag.glsl +22 -0
  259. package/es/polygon/shaders/polygon_linear_vert.glsl +74 -0
  260. package/es/polygon/shaders/polygon_vert.glsl +66 -0
  261. package/es/polygon/shaders/tile/polygon_tile_frag.glsl +12 -0
  262. package/es/polygon/shaders/tile/polygon_tile_vert.glsl +82 -0
  263. package/es/polygon/shaders/water/polygon_ocean_frag.glsl +248 -0
  264. package/es/polygon/shaders/water/polygon_ocean_vert.glsl +52 -0
  265. package/es/polygon/shaders/water/polygon_water_frag.glsl +73 -0
  266. package/es/polygon/shaders/water/polygon_water_vert.glsl +55 -0
  267. package/es/raster/buffers/triangulation.d.ts +6 -0
  268. package/es/raster/buffers/triangulation.js +28 -0
  269. package/es/raster/index.d.ts +19 -0
  270. package/es/raster/index.js +106 -0
  271. package/es/raster/models/index.d.ts +5 -0
  272. package/es/raster/models/index.js +8 -0
  273. package/es/raster/models/raster.d.ts +21 -0
  274. package/es/raster/models/raster.js +167 -0
  275. package/es/raster/raster.d.ts +30 -0
  276. package/es/raster/raster.js +174 -0
  277. package/es/raster/shaders/raster_2d_frag.glsl +28 -0
  278. package/es/raster/shaders/raster_2d_vert.glsl +18 -0
  279. package/es/raster/shaders/raster_frag.glsl +9 -0
  280. package/es/raster/shaders/raster_vert.glsl +44 -0
  281. package/es/tile/interface.d.ts +28 -0
  282. package/es/tile/interface.js +1 -0
  283. package/es/tile/manager/tileConfigManager.d.ts +17 -0
  284. package/es/tile/manager/tileConfigManager.js +121 -0
  285. package/es/tile/manager/tileLayerManager.d.ts +36 -0
  286. package/es/tile/manager/tileLayerManager.js +312 -0
  287. package/es/tile/manager/tilePickerManager.d.ts +21 -0
  288. package/es/tile/manager/tilePickerManager.js +190 -0
  289. package/es/tile/models/tileModel.d.ts +8 -0
  290. package/es/tile/models/tileModel.js +62 -0
  291. package/es/tile/tileFactory/base.d.ts +44 -0
  292. package/es/tile/tileFactory/base.js +444 -0
  293. package/es/tile/tileFactory/index.d.ts +5 -0
  294. package/es/tile/tileFactory/index.js +29 -0
  295. package/es/tile/tileFactory/line.d.ts +12 -0
  296. package/es/tile/tileFactory/line.js +59 -0
  297. package/es/tile/tileFactory/point.d.ts +12 -0
  298. package/es/tile/tileFactory/point.js +59 -0
  299. package/es/tile/tileFactory/polygon.d.ts +12 -0
  300. package/es/tile/tileFactory/polygon.js +59 -0
  301. package/es/tile/tileFactory/raster.d.ts +12 -0
  302. package/es/tile/tileFactory/raster.js +55 -0
  303. package/es/tile/tileFactory/rasterData.d.ts +12 -0
  304. package/es/tile/tileFactory/rasterData.js +80 -0
  305. package/es/tile/tileFactory/rasterDataLayer.d.ts +19 -0
  306. package/es/tile/tileFactory/rasterDataLayer.js +87 -0
  307. package/es/tile/tileFactory/vectorLayer.d.ts +29 -0
  308. package/es/tile/tileFactory/vectorLayer.js +161 -0
  309. package/es/tile/tileLayer/baseTileLayer.d.ts +47 -0
  310. package/es/tile/tileLayer/baseTileLayer.js +438 -0
  311. package/es/tile/tmsTileLayer.d.ts +7 -0
  312. package/es/tile/tmsTileLayer.js +101 -0
  313. package/es/tile/utils.d.ts +13 -0
  314. package/es/tile/utils.js +131 -0
  315. package/es/utils/blend.d.ts +2 -0
  316. package/es/utils/blend.js +54 -0
  317. package/es/utils/collision-index.d.ts +47 -0
  318. package/es/utils/collision-index.js +102 -0
  319. package/es/utils/dataMappingStyle.d.ts +31 -0
  320. package/es/utils/dataMappingStyle.js +147 -0
  321. package/es/utils/extrude_polyline.d.ts +67 -0
  322. package/es/utils/extrude_polyline.js +611 -0
  323. package/es/utils/grid-index.d.ts +28 -0
  324. package/es/utils/grid-index.js +179 -0
  325. package/es/utils/layerData.d.ts +2 -0
  326. package/es/utils/layerData.js +176 -0
  327. package/es/utils/multiPassRender.d.ts +16 -0
  328. package/es/utils/multiPassRender.js +50 -0
  329. package/es/utils/polylineNormal.d.ts +9 -0
  330. package/es/utils/polylineNormal.js +191 -0
  331. package/es/utils/simpleLine.d.ts +23 -0
  332. package/es/utils/simpleLine.js +103 -0
  333. package/es/utils/symbol-layout.d.ts +43 -0
  334. package/es/utils/symbol-layout.js +299 -0
  335. package/es/utils/updateShape.d.ts +2 -0
  336. package/es/utils/updateShape.js +20 -0
  337. package/es/wind/index.d.ts +20 -0
  338. package/es/wind/index.js +100 -0
  339. package/es/wind/models/index.d.ts +5 -0
  340. package/es/wind/models/index.js +5 -0
  341. package/es/wind/models/utils.d.ts +19 -0
  342. package/es/wind/models/utils.js +226 -0
  343. package/es/wind/models/wind.d.ts +33 -0
  344. package/es/wind/models/wind.js +331 -0
  345. package/es/wind/models/windRender.d.ts +104 -0
  346. package/es/wind/models/windRender.js +357 -0
  347. package/es/wind/models/windShader.d.ts +12 -0
  348. package/es/wind/models/windShader.js +12 -0
  349. package/es/wind/shaders/wind_frag.glsl +9 -0
  350. package/es/wind/shaders/wind_vert.glsl +17 -0
  351. package/lib/Geometry/index.js +119 -0
  352. package/lib/Geometry/models/billboard.js +246 -0
  353. package/lib/Geometry/models/index.js +22 -0
  354. package/lib/Geometry/models/plane.js +436 -0
  355. package/lib/Geometry/models/sprite.js +318 -0
  356. package/lib/Geometry/shaders/billboard_frag.glsl +13 -0
  357. package/lib/Geometry/shaders/billboard_vert.glsl +50 -0
  358. package/lib/Geometry/shaders/plane_frag.glsl +22 -0
  359. package/lib/Geometry/shaders/plane_vert.glsl +53 -0
  360. package/lib/Geometry/shaders/sprite_frag.glsl +21 -0
  361. package/lib/Geometry/shaders/sprite_vert.glsl +28 -0
  362. package/lib/canvas/index.js +104 -0
  363. package/lib/canvas/models/canvas.js +221 -0
  364. package/lib/canvas/models/index.js +16 -0
  365. package/lib/citybuliding/building.js +101 -0
  366. package/lib/citybuliding/models/build.js +203 -0
  367. package/lib/citybuliding/shaders/build_frag.glsl +117 -0
  368. package/lib/citybuliding/shaders/build_vert.glsl +54 -0
  369. package/lib/core/BaseLayer.js +1408 -0
  370. package/lib/core/BaseModel.js +503 -0
  371. package/lib/core/interface.js +41 -0
  372. package/lib/core/schema.js +33 -0
  373. package/lib/core/shape/Path.js +88 -0
  374. package/lib/core/shape/extrude.js +180 -0
  375. package/lib/core/triangulation.js +555 -0
  376. package/lib/earth/index.js +107 -0
  377. package/lib/earth/models/atmosphere.js +152 -0
  378. package/lib/earth/models/base.js +222 -0
  379. package/lib/earth/models/bloomsphere.js +152 -0
  380. package/lib/earth/shaders/atmosphere_frag.glsl +17 -0
  381. package/lib/earth/shaders/atmosphere_vert.glsl +26 -0
  382. package/lib/earth/shaders/base_frag.glsl +13 -0
  383. package/lib/earth/shaders/base_vert.glsl +52 -0
  384. package/lib/earth/shaders/bloomsphere_frag.glsl +15 -0
  385. package/lib/earth/shaders/bloomsphere_vert.glsl +20 -0
  386. package/lib/earth/utils.js +136 -0
  387. package/lib/heatmap/index.js +158 -0
  388. package/lib/heatmap/models/grid.js +122 -0
  389. package/lib/heatmap/models/grid3d.js +161 -0
  390. package/lib/heatmap/models/heatmap.js +487 -0
  391. package/lib/heatmap/models/hexagon.js +125 -0
  392. package/lib/heatmap/models/index.js +26 -0
  393. package/lib/heatmap/shaders/grid_vert.glsl +42 -0
  394. package/lib/heatmap/shaders/heatmap_3d_frag.glsl +14 -0
  395. package/lib/heatmap/shaders/heatmap_3d_vert.glsl +46 -0
  396. package/lib/heatmap/shaders/heatmap_frag.glsl +47 -0
  397. package/lib/heatmap/shaders/heatmap_framebuffer_frag.glsl +10 -0
  398. package/lib/heatmap/shaders/heatmap_framebuffer_vert.glsl +35 -0
  399. package/lib/heatmap/shaders/heatmap_vert.glsl +10 -0
  400. package/lib/heatmap/shaders/hexagon_3d_frag.glsl +0 -0
  401. package/lib/heatmap/shaders/hexagon_3d_vert.glsl +64 -0
  402. package/lib/heatmap/shaders/hexagon_frag.glsl +12 -0
  403. package/lib/heatmap/shaders/hexagon_vert.glsl +41 -0
  404. package/lib/heatmap/triangulation.js +45 -0
  405. package/lib/image/index.js +116 -0
  406. package/lib/image/models/dataImage.js +240 -0
  407. package/lib/image/models/image.js +183 -0
  408. package/lib/image/models/index.js +19 -0
  409. package/lib/image/shaders/dataImage_frag.glsl +38 -0
  410. package/lib/image/shaders/image_frag.glsl +9 -0
  411. package/lib/image/shaders/image_vert.glsl +17 -0
  412. package/lib/index.js +266 -0
  413. package/lib/line/index.js +136 -0
  414. package/lib/line/models/arc.js +373 -0
  415. package/lib/line/models/arc_3d.js +353 -0
  416. package/lib/line/models/earthArc_3d.js +356 -0
  417. package/lib/line/models/great_circle.js +310 -0
  418. package/lib/line/models/half.js +299 -0
  419. package/lib/line/models/index.js +46 -0
  420. package/lib/line/models/line.js +459 -0
  421. package/lib/line/models/linearline.js +293 -0
  422. package/lib/line/models/simpleLine.js +248 -0
  423. package/lib/line/models/tile.js +368 -0
  424. package/lib/line/models/wall.js +345 -0
  425. package/lib/line/shaders/arc_chunks.vert.glsl +21 -0
  426. package/lib/line/shaders/dash/arc_dash_frag.glsl +28 -0
  427. package/lib/line/shaders/dash/arc_dash_vert.glsl +148 -0
  428. package/lib/line/shaders/dash/line_dash_frag.glsl +31 -0
  429. package/lib/line/shaders/dash/line_dash_vert.glsl +93 -0
  430. package/lib/line/shaders/half/line_half_frag.glsl +53 -0
  431. package/lib/line/shaders/half/line_half_vert.glsl +169 -0
  432. package/lib/line/shaders/line_arc2d_vert.glsl +114 -0
  433. package/lib/line/shaders/line_arc_3d_frag.glsl +103 -0
  434. package/lib/line/shaders/line_arc_3d_vert.glsl +207 -0
  435. package/lib/line/shaders/line_arc_frag.glsl +89 -0
  436. package/lib/line/shaders/line_arc_great_circle_frag.glsl +101 -0
  437. package/lib/line/shaders/line_arc_great_circle_vert.glsl +215 -0
  438. package/lib/line/shaders/line_arc_vert.glsl +176 -0
  439. package/lib/line/shaders/line_bezier_vert.glsl +85 -0
  440. package/lib/line/shaders/line_frag.glsl +100 -0
  441. package/lib/line/shaders/line_vert.glsl +192 -0
  442. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +47 -0
  443. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +207 -0
  444. package/lib/line/shaders/linear/arc_linear_frag.glsl +38 -0
  445. package/lib/line/shaders/linear/arc_linear_vert.glsl +138 -0
  446. package/lib/line/shaders/linear/line_linear_frag.glsl +27 -0
  447. package/lib/line/shaders/linearLine/line_linear_frag.glsl +20 -0
  448. package/lib/line/shaders/linearLine/line_linear_vert.glsl +112 -0
  449. package/lib/line/shaders/simple/simpleline_frag.glsl +10 -0
  450. package/lib/line/shaders/simple/simpleline_linear_frag.glsl +11 -0
  451. package/lib/line/shaders/simple/simpleline_vert.glsl +79 -0
  452. package/lib/line/shaders/tile/line_tile_frag.glsl +79 -0
  453. package/lib/line/shaders/tile/line_tile_vert.glsl +210 -0
  454. package/lib/line/shaders/wall_frag.glsl +93 -0
  455. package/lib/line/shaders/wall_vert.glsl +111 -0
  456. package/lib/mask/index.js +95 -0
  457. package/lib/mask/models/fill.js +137 -0
  458. package/lib/mask/models/index.js +16 -0
  459. package/lib/mask/shaders/mask_frag.glsl +7 -0
  460. package/lib/mask/shaders/mask_vert.glsl +22 -0
  461. package/lib/plugins/DataMappingPlugin.js +360 -0
  462. package/lib/plugins/DataSourcePlugin.js +108 -0
  463. package/lib/plugins/FeatureScalePlugin.js +348 -0
  464. package/lib/plugins/LayerAnimateStylePlugin.js +64 -0
  465. package/lib/plugins/LayerModelPlugin.js +82 -0
  466. package/lib/plugins/LayerStylePlugin.js +50 -0
  467. package/lib/plugins/LightingPlugin.js +125 -0
  468. package/lib/plugins/MultiPassRendererPlugin.js +93 -0
  469. package/lib/plugins/PixelPickingPlugin.js +159 -0
  470. package/lib/plugins/RegisterStyleAttributePlugin.js +117 -0
  471. package/lib/plugins/ShaderUniformPlugin.js +120 -0
  472. package/lib/plugins/UpdateModelPlugin.js +42 -0
  473. package/lib/plugins/UpdateStyleAttributePlugin.js +98 -0
  474. package/lib/point/index.js +238 -0
  475. package/lib/point/models/earthExtrude.js +295 -0
  476. package/lib/point/models/earthFill.js +293 -0
  477. package/lib/point/models/extrude.js +315 -0
  478. package/lib/point/models/fill.js +420 -0
  479. package/lib/point/models/fillmage.js +383 -0
  480. package/lib/point/models/image.js +255 -0
  481. package/lib/point/models/index.js +50 -0
  482. package/lib/point/models/normal.js +194 -0
  483. package/lib/point/models/radar.js +314 -0
  484. package/lib/point/models/simplePoint.js +205 -0
  485. package/lib/point/models/text.js +637 -0
  486. package/lib/point/models/tile.js +325 -0
  487. package/lib/point/shaders/animate/wave_frag.glsl +65 -0
  488. package/lib/point/shaders/earth/extrude_frag.glsl +44 -0
  489. package/lib/point/shaders/earth/extrude_vert.glsl +140 -0
  490. package/lib/point/shaders/earth/fill_frag.glsl +86 -0
  491. package/lib/point/shaders/earth/fill_vert.glsl +126 -0
  492. package/lib/point/shaders/extrude/extrude_frag.glsl +44 -0
  493. package/lib/point/shaders/extrude/extrude_vert.glsl +121 -0
  494. package/lib/point/shaders/fill_frag.glsl +84 -0
  495. package/lib/point/shaders/fill_vert.glsl +189 -0
  496. package/lib/point/shaders/image/fillImage_frag.glsl +20 -0
  497. package/lib/point/shaders/image/fillImage_vert.glsl +116 -0
  498. package/lib/point/shaders/image_frag.glsl +39 -0
  499. package/lib/point/shaders/image_vert.glsl +90 -0
  500. package/lib/point/shaders/normal_frag.glsl +15 -0
  501. package/lib/point/shaders/normal_vert.glsl +79 -0
  502. package/lib/point/shaders/radar/radar_frag.glsl +64 -0
  503. package/lib/point/shaders/radar/radar_vert.glsl +120 -0
  504. package/lib/point/shaders/simplePoint_frag.glsl +53 -0
  505. package/lib/point/shaders/simplePoint_vert.glsl +79 -0
  506. package/lib/point/shaders/text_frag.glsl +48 -0
  507. package/lib/point/shaders/text_vert.glsl +131 -0
  508. package/lib/point/shaders/tile/fill_tile_frag.glsl +83 -0
  509. package/lib/point/shaders/tile/fill_tile_vert.glsl +181 -0
  510. package/lib/point/shape/extrude.js +78 -0
  511. package/lib/polygon/index.js +162 -0
  512. package/lib/polygon/models/extrude.js +322 -0
  513. package/lib/polygon/models/fill.js +226 -0
  514. package/lib/polygon/models/index.js +50 -0
  515. package/lib/polygon/models/ocean.js +252 -0
  516. package/lib/polygon/models/tile.js +147 -0
  517. package/lib/polygon/models/water.js +229 -0
  518. package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +44 -0
  519. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +44 -0
  520. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +85 -0
  521. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +90 -0
  522. package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +48 -0
  523. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +93 -0
  524. package/lib/polygon/shaders/polygon_frag.glsl +12 -0
  525. package/lib/polygon/shaders/polygon_linear_frag.glsl +22 -0
  526. package/lib/polygon/shaders/polygon_linear_vert.glsl +74 -0
  527. package/lib/polygon/shaders/polygon_vert.glsl +66 -0
  528. package/lib/polygon/shaders/tile/polygon_tile_frag.glsl +12 -0
  529. package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +82 -0
  530. package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +248 -0
  531. package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +52 -0
  532. package/lib/polygon/shaders/water/polygon_water_frag.glsl +73 -0
  533. package/lib/polygon/shaders/water/polygon_water_vert.glsl +55 -0
  534. package/lib/raster/buffers/triangulation.js +38 -0
  535. package/lib/raster/index.js +119 -0
  536. package/lib/raster/models/index.js +20 -0
  537. package/lib/raster/models/raster.js +182 -0
  538. package/lib/raster/raster.js +191 -0
  539. package/lib/raster/shaders/raster_2d_frag.glsl +28 -0
  540. package/lib/raster/shaders/raster_2d_vert.glsl +18 -0
  541. package/lib/raster/shaders/raster_frag.glsl +9 -0
  542. package/lib/raster/shaders/raster_vert.glsl +44 -0
  543. package/lib/tile/interface.js +5 -0
  544. package/lib/tile/manager/tileConfigManager.js +133 -0
  545. package/lib/tile/manager/tileLayerManager.js +330 -0
  546. package/lib/tile/manager/tilePickerManager.js +201 -0
  547. package/lib/tile/models/tileModel.js +74 -0
  548. package/lib/tile/tileFactory/base.js +466 -0
  549. package/lib/tile/tileFactory/index.js +59 -0
  550. package/lib/tile/tileFactory/line.js +70 -0
  551. package/lib/tile/tileFactory/point.js +70 -0
  552. package/lib/tile/tileFactory/polygon.js +70 -0
  553. package/lib/tile/tileFactory/raster.js +68 -0
  554. package/lib/tile/tileFactory/rasterData.js +93 -0
  555. package/lib/tile/tileFactory/rasterDataLayer.js +100 -0
  556. package/lib/tile/tileFactory/vectorLayer.js +176 -0
  557. package/lib/tile/tileLayer/baseTileLayer.js +447 -0
  558. package/lib/tile/tmsTileLayer.js +117 -0
  559. package/lib/tile/utils.js +158 -0
  560. package/lib/utils/blend.js +65 -0
  561. package/lib/utils/collision-index.js +118 -0
  562. package/lib/utils/dataMappingStyle.js +151 -0
  563. package/lib/utils/extrude_polyline.js +653 -0
  564. package/lib/utils/grid-index.js +188 -0
  565. package/lib/utils/layerData.js +187 -0
  566. package/lib/utils/multiPassRender.js +61 -0
  567. package/lib/utils/polylineNormal.js +230 -0
  568. package/lib/utils/simpleLine.js +116 -0
  569. package/lib/utils/symbol-layout.js +308 -0
  570. package/lib/utils/updateShape.js +27 -0
  571. package/lib/wind/index.js +113 -0
  572. package/lib/wind/models/index.js +16 -0
  573. package/lib/wind/models/utils.js +253 -0
  574. package/lib/wind/models/wind.js +346 -0
  575. package/lib/wind/models/windRender.js +373 -0
  576. package/lib/wind/models/windShader.js +25 -0
  577. package/lib/wind/shaders/wind_frag.glsl +9 -0
  578. package/lib/wind/shaders/wind_vert.glsl +17 -0
  579. package/package.json +6 -6
@@ -0,0 +1,1409 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
4
+ import _initializerDefineProperty from "@babel/runtime/helpers/initializerDefineProperty";
5
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
6
+ import _createClass from "@babel/runtime/helpers/createClass";
7
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
8
+ import _inherits from "@babel/runtime/helpers/inherits";
9
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
10
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
11
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
12
+ import _applyDecoratedDescriptor from "@babel/runtime/helpers/applyDecoratedDescriptor";
13
+ import _initializerWarningHelper from "@babel/runtime/helpers/initializerWarningHelper";
14
+ var _excluded = ["passes"],
15
+ _excluded2 = ["moduleName", "vertexShader", "fragmentShader", "triangulation", "segmentNumber", "workerEnabled", "workerOptions"];
16
+
17
+ var _dec, _class, _descriptor;
18
+
19
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
20
+
21
+ 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; } } }; }
22
+
23
+ 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); }
24
+
25
+ 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; }
26
+
27
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
28
+
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
+
31
+ // @ts-ignore
32
+ import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';
33
+ import { BlendType, lazyInject, TYPES } from '@antv/l7-core';
34
+ import Source from '@antv/l7-source';
35
+ import { encodePickingColor, WorkerSourceMap } from '@antv/l7-utils';
36
+ import { EventEmitter } from 'eventemitter3';
37
+ import { isFunction, isObject, isUndefined } from 'lodash';
38
+ import { BlendTypes } from "../utils/blend";
39
+ import { handleStyleDataMapping } from "../utils/dataMappingStyle";
40
+ import { calculateData } from "../utils/layerData";
41
+ import { createMultiPassRenderer, normalizePasses } from "../utils/multiPassRender";
42
+ import { updateShape } from "../utils/updateShape";
43
+ /**
44
+ * 分配 layer id
45
+ */
46
+
47
+ var layerIdCounter = 0;
48
+ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function (_ref) {
49
+ _inherits(BaseLayer, _ref);
50
+
51
+ var _super = _createSuper(BaseLayer);
52
+
53
+ // 生命周期钩子
54
+ // 待渲染 model 列表
55
+ // TODO: 用于保存子图层对象
56
+ // Tip: 用于标识矢量图层
57
+
58
+ /**
59
+ * 待更新样式属性,在初始化阶段完成注册
60
+ */
61
+ // TODO: layer 保底颜色
62
+ // private pickingPassRender: IPass<'pixelPicking'>;
63
+ function BaseLayer() {
64
+ var _this;
65
+
66
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
67
+
68
+ _classCallCheck(this, BaseLayer);
69
+
70
+ _this = _super.call(this);
71
+
72
+ _defineProperty(_assertThisInitialized(_this), "id", "".concat(layerIdCounter++));
73
+
74
+ _defineProperty(_assertThisInitialized(_this), "name", "".concat(layerIdCounter));
75
+
76
+ _defineProperty(_assertThisInitialized(_this), "visible", true);
77
+
78
+ _defineProperty(_assertThisInitialized(_this), "zIndex", 0);
79
+
80
+ _defineProperty(_assertThisInitialized(_this), "inited", false);
81
+
82
+ _defineProperty(_assertThisInitialized(_this), "layerModelNeedUpdate", false);
83
+
84
+ _defineProperty(_assertThisInitialized(_this), "pickedFeatureID", null);
85
+
86
+ _defineProperty(_assertThisInitialized(_this), "selectedFeatureID", null);
87
+
88
+ _defineProperty(_assertThisInitialized(_this), "styleNeedUpdate", false);
89
+
90
+ _defineProperty(_assertThisInitialized(_this), "clusterZoom", 0);
91
+
92
+ _defineProperty(_assertThisInitialized(_this), "dataState", {
93
+ dataSourceNeedUpdate: false,
94
+ dataMappingNeedUpdate: false,
95
+ filterNeedUpdate: false,
96
+ featureScaleNeedUpdate: false,
97
+ StyleAttrNeedUpdate: false
98
+ });
99
+
100
+ _defineProperty(_assertThisInitialized(_this), "hooks", {
101
+ init: new SyncBailHook(),
102
+ afterInit: new SyncBailHook(),
103
+ beforeRender: new SyncBailHook(),
104
+ beforeRenderData: new SyncWaterfallHook(),
105
+ afterRender: new SyncHook(),
106
+ beforePickingEncode: new SyncHook(),
107
+ afterPickingEncode: new SyncHook(),
108
+ beforeHighlight: new SyncHook(['pickedColor']),
109
+ afterHighlight: new SyncHook(),
110
+ beforeSelect: new SyncHook(['pickedColor']),
111
+ afterSelect: new SyncHook(),
112
+ beforeDestroy: new SyncHook(),
113
+ afterDestroy: new SyncHook()
114
+ });
115
+
116
+ _defineProperty(_assertThisInitialized(_this), "models", []);
117
+
118
+ _defineProperty(_assertThisInitialized(_this), "layerChildren", []);
119
+
120
+ _defineProperty(_assertThisInitialized(_this), "masks", []);
121
+
122
+ _defineProperty(_assertThisInitialized(_this), "isVector", false);
123
+
124
+ _initializerDefineProperty(_assertThisInitialized(_this), "configService", _descriptor, _assertThisInitialized(_this));
125
+
126
+ _defineProperty(_assertThisInitialized(_this), "animateOptions", {
127
+ enable: false
128
+ });
129
+
130
+ _defineProperty(_assertThisInitialized(_this), "currentPickId", null);
131
+
132
+ _defineProperty(_assertThisInitialized(_this), "pendingStyleAttributes", []);
133
+
134
+ _defineProperty(_assertThisInitialized(_this), "scaleOptions", {});
135
+
136
+ _defineProperty(_assertThisInitialized(_this), "aniamateStatus", false);
137
+
138
+ _defineProperty(_assertThisInitialized(_this), "bottomColor", 'rgba(0, 0, 0, 0)');
139
+
140
+ _defineProperty(_assertThisInitialized(_this), "isDestroied", false);
141
+
142
+ _defineProperty(_assertThisInitialized(_this), "sourceEvent", function () {
143
+ _this.dataState.dataSourceNeedUpdate = true;
144
+
145
+ var layerConfig = _this.getLayerConfig();
146
+
147
+ if (layerConfig && layerConfig.autoFit) {
148
+ _this.fitBounds(layerConfig.fitBoundsOptions);
149
+ } // 对外暴露事件 迁移到 DataMappingPlugin generateMapping,保证在重新重新映射后触发
150
+ // this.emit('dataUpdate');
151
+
152
+
153
+ _this.reRender();
154
+ });
155
+
156
+ _this.name = config.name || _this.id;
157
+ _this.zIndex = config.zIndex || 0;
158
+ _this.rawConfig = config;
159
+ return _this;
160
+ }
161
+
162
+ _createClass(BaseLayer, [{
163
+ key: "addMaskLayer",
164
+ value: function addMaskLayer(maskLayer) {
165
+ this.masks.push(maskLayer);
166
+ }
167
+ }, {
168
+ key: "removeMaskLayer",
169
+ value: function removeMaskLayer(maskLayer) {
170
+ var layerIndex = this.masks.indexOf(maskLayer);
171
+
172
+ if (layerIndex > -1) {
173
+ this.masks.splice(layerIndex, 1);
174
+ }
175
+
176
+ maskLayer.destroy();
177
+ }
178
+ }, {
179
+ key: "getAttribute",
180
+ value: function getAttribute(name) {
181
+ return this.styleAttributeService.getLayerStyleAttribute(name);
182
+ }
183
+ }, {
184
+ key: "getLayerConfig",
185
+ value: function getLayerConfig() {
186
+ return this.configService.getLayerConfig(this.id);
187
+ }
188
+ }, {
189
+ key: "updateLayerConfig",
190
+ value: function updateLayerConfig(configToUpdate) {
191
+ var _this2 = this;
192
+
193
+ // 同步 rawConfig
194
+ Object.keys(configToUpdate).map(function (key) {
195
+ if (key in _this2.rawConfig) {
196
+ // @ts-ignore
197
+ _this2.rawConfig[key] = configToUpdate[key];
198
+ }
199
+ });
200
+
201
+ if (!this.inited) {
202
+ this.needUpdateConfig = _objectSpread(_objectSpread({}, this.needUpdateConfig), configToUpdate);
203
+ } else {
204
+ var sceneId = this.container.get(TYPES.SceneID); // @ts-ignore
205
+
206
+ handleStyleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
207
+
208
+ this.configService.setLayerConfig(sceneId, this.id, _objectSpread(_objectSpread(_objectSpread({}, this.configService.getLayerConfig(this.id)), this.needUpdateConfig), configToUpdate));
209
+ this.needUpdateConfig = {};
210
+ }
211
+ }
212
+ /**
213
+ * 注入图层容器,父容器为场景容器
214
+ * RootContainer 1
215
+ * -> SceneContainer 1.*
216
+ * -> LayerContainer 1.*
217
+ */
218
+
219
+ }, {
220
+ key: "setContainer",
221
+ value: function setContainer(container, sceneContainer) {
222
+ this.container = container;
223
+ this.sceneContainer = sceneContainer;
224
+ }
225
+ }, {
226
+ key: "getContainer",
227
+ value: function getContainer() {
228
+ return this.container;
229
+ }
230
+ }, {
231
+ key: "setBottomColor",
232
+ value: function setBottomColor(color) {
233
+ this.bottomColor = color;
234
+ }
235
+ }, {
236
+ key: "getBottomColor",
237
+ value: function getBottomColor() {
238
+ return this.bottomColor;
239
+ }
240
+ }, {
241
+ key: "addPlugin",
242
+ value: function addPlugin(plugin) {
243
+ // TODO: 控制插件注册顺序
244
+ // @example:
245
+ // pointLayer.addPlugin(new MyCustomPlugin(), {
246
+ // before: 'L7BuiltinPlugin'
247
+ // });
248
+ this.plugins.push(plugin);
249
+ return this;
250
+ }
251
+ }, {
252
+ key: "init",
253
+ value: function init() {
254
+ var _this3 = this;
255
+
256
+ // 设置配置项
257
+ var sceneId = this.container.get(TYPES.SceneID); // 初始化图层配置项
258
+ // const { enableMultiPassRenderer = false } = this.rawConfig;
259
+ // this.configService.setLayerConfig(sceneId, this.id, {
260
+ // enableMultiPassRenderer,
261
+ // });
262
+
263
+ this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);
264
+ this.layerType = this.rawConfig.layerType; // 全局容器服务
265
+ // 场景容器服务
266
+
267
+ this.iconService = this.container.get(TYPES.IIconService);
268
+ this.fontService = this.container.get(TYPES.IFontService);
269
+ this.rendererService = this.container.get(TYPES.IRendererService);
270
+ this.layerService = this.container.get(TYPES.ILayerService);
271
+ this.interactionService = this.container.get(TYPES.IInteractionService);
272
+ this.pickingService = this.container.get(TYPES.IPickingService);
273
+ this.mapService = this.container.get(TYPES.IMapService);
274
+
275
+ var _this$getLayerConfig = this.getLayerConfig(),
276
+ enableMultiPassRenderer = _this$getLayerConfig.enableMultiPassRenderer,
277
+ passes = _this$getLayerConfig.passes;
278
+
279
+ if (enableMultiPassRenderer && passes !== null && passes !== void 0 && passes.length && passes.length > 0) {
280
+ // Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom
281
+ this.mapService.on('mapAfterFrameChange', function () {
282
+ _this3.renderLayers();
283
+ });
284
+ }
285
+
286
+ this.cameraService = this.container.get(TYPES.ICameraService);
287
+ this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
288
+ this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
289
+ this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
290
+ this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass); // 图层容器服务
291
+
292
+ this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService);
293
+ this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
294
+ this.multiPassRenderer.setLayer(this); // 完成样式服务注册完成前添加的属性
295
+
296
+ this.pendingStyleAttributes.forEach(function (_ref2) {
297
+ var attributeName = _ref2.attributeName,
298
+ attributeField = _ref2.attributeField,
299
+ attributeValues = _ref2.attributeValues,
300
+ updateOptions = _ref2.updateOptions;
301
+
302
+ _this3.styleAttributeService.updateStyleAttribute(attributeName, {
303
+ // @ts-ignore
304
+ scale: _objectSpread({
305
+ field: attributeField
306
+ }, _this3.splitValuesAndCallbackInAttribute( // @ts-ignore
307
+ attributeValues, // @ts-ignore
308
+ _this3.getLayerConfig()[attributeName]))
309
+ }, // @ts-ignore
310
+ updateOptions);
311
+ });
312
+ this.pendingStyleAttributes = []; // 获取插件集
313
+
314
+ this.plugins = this.container.getAll(TYPES.ILayerPlugin); // 完成插件注册,传入场景和图层容器内的服务
315
+
316
+ var _iterator = _createForOfIteratorHelper(this.plugins),
317
+ _step;
318
+
319
+ try {
320
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
321
+ var plugin = _step.value;
322
+ plugin.apply(this, {
323
+ rendererService: this.rendererService,
324
+ mapService: this.mapService,
325
+ styleAttributeService: this.styleAttributeService,
326
+ normalPassFactory: this.normalPassFactory,
327
+ postProcessingPassFactory: this.postProcessingPassFactory
328
+ });
329
+ } // 触发 init 生命周期插件
330
+
331
+ } catch (err) {
332
+ _iterator.e(err);
333
+ } finally {
334
+ _iterator.f();
335
+ }
336
+
337
+ this.hooks.init.call(); // this.pickingPassRender = this.normalPassFactory('pixelPicking');
338
+ // this.pickingPassRender.init(this);
339
+
340
+ this.hooks.afterInit.call(); // 触发初始化完成事件;
341
+
342
+ this.emit('inited', {
343
+ target: this,
344
+ type: 'inited'
345
+ });
346
+ this.emit('add', {
347
+ target: this,
348
+ type: 'add'
349
+ });
350
+ return this;
351
+ }
352
+ }, {
353
+ key: "updateModelData",
354
+ value: function updateModelData(data) {
355
+ if (data.attributes && data.elements) {
356
+ this.models.map(function (m) {
357
+ m.updateAttributesAndElements(data.attributes, data.elements);
358
+ });
359
+ } else {
360
+ console.warn('data error');
361
+ }
362
+ }
363
+ }, {
364
+ key: "createModelData",
365
+ value: function createModelData(data, option) {
366
+ var _this$layerModel;
367
+
368
+ if ((_this$layerModel = this.layerModel) !== null && _this$layerModel !== void 0 && _this$layerModel.createModelData) {
369
+ // 在某些特殊图层中单独构建 attribute & elements
370
+ return this.layerModel.createModelData(option);
371
+ }
372
+
373
+ var calEncodeData = this.calculateEncodeData(data, option);
374
+ var triangulation = this.triangulation;
375
+
376
+ if (calEncodeData && triangulation) {
377
+ return this.styleAttributeService.createAttributesAndIndices(calEncodeData, triangulation);
378
+ } else {
379
+ return {
380
+ attributes: undefined,
381
+ elements: undefined
382
+ };
383
+ }
384
+ }
385
+ }, {
386
+ key: "calculateEncodeData",
387
+ value: function calculateEncodeData(data, option) {
388
+ if (this.inited) {
389
+ return calculateData(this, this.fontService, this.mapService, this.styleAttributeService, data, option);
390
+ } else {
391
+ console.warn('layer not inited!');
392
+ return null;
393
+ }
394
+ }
395
+ /**
396
+ * Model初始化前需要更新Model样式
397
+ */
398
+
399
+ }, {
400
+ key: "prepareBuildModel",
401
+ value: function prepareBuildModel() {
402
+ this.inited = true;
403
+ this.updateLayerConfig(_objectSpread(_objectSpread({}, this.getDefaultConfig()), this.rawConfig)); // 启动动画
404
+
405
+ var _this$getLayerConfig2 = this.getLayerConfig(),
406
+ animateOption = _this$getLayerConfig2.animateOption;
407
+
408
+ if (animateOption !== null && animateOption !== void 0 && animateOption.enable) {
409
+ this.layerService.startAnimate();
410
+ this.aniamateStatus = true;
411
+ }
412
+ }
413
+ }, {
414
+ key: "color",
415
+ value: function color(field, values, updateOptions) {
416
+ // 设置 color、size、shape、style 时由于场景服务尚未完成(并没有调用 scene.addLayer),因此暂时加入待更新属性列表
417
+ this.updateStyleAttribute('color', field, values, updateOptions); // this.pendingStyleAttributes.push({
418
+ // attributeName: 'color',
419
+ // attributeField: field,
420
+ // attributeValues: values,
421
+ // defaultName: 'colors',
422
+ // updateOptions,
423
+ // });
424
+
425
+ return this;
426
+ } // 为对应的图层传入纹理的编号名称(point/image 在 shape 方法中传入纹理名称的方法并不通用)
427
+
428
+ }, {
429
+ key: "texture",
430
+ value: function texture(field, values, updateOptions) {
431
+ this.updateStyleAttribute('texture', field, values, updateOptions);
432
+ return this;
433
+ }
434
+ }, {
435
+ key: "rotate",
436
+ value: function rotate(field, values, updateOptions) {
437
+ this.updateStyleAttribute('rotate', field, values, updateOptions);
438
+ return this;
439
+ }
440
+ }, {
441
+ key: "size",
442
+ value: function size(field, values, updateOptions) {
443
+ this.updateStyleAttribute('size', field, values, updateOptions);
444
+ return this;
445
+ } // 对mapping后的数据过滤,scale保持不变
446
+
447
+ }, {
448
+ key: "filter",
449
+ value: function filter(field, values, updateOptions) {
450
+ this.updateStyleAttribute('filter', field, values, updateOptions);
451
+ return this;
452
+ }
453
+ }, {
454
+ key: "shape",
455
+ value: function shape(field, values, updateOptions) {
456
+ var _this$styleAttributeS, _this$styleAttributeS2, _this$styleAttributeS3;
457
+
458
+ var lastShape = (_this$styleAttributeS = this.styleAttributeService) === null || _this$styleAttributeS === void 0 ? void 0 : (_this$styleAttributeS2 = _this$styleAttributeS.getLayerStyleAttribute('shape')) === null || _this$styleAttributeS2 === void 0 ? void 0 : (_this$styleAttributeS3 = _this$styleAttributeS2.scale) === null || _this$styleAttributeS3 === void 0 ? void 0 : _this$styleAttributeS3.field;
459
+ var currentShape = field;
460
+ this.shapeOption = {
461
+ field: field,
462
+ values: values
463
+ };
464
+ this.updateStyleAttribute('shape', field, values, updateOptions); // TODO: 根据 shape 判断是否需要更新 model
465
+
466
+ if (!this.tileLayer) {
467
+ updateShape(this, lastShape, currentShape);
468
+ }
469
+
470
+ return this;
471
+ }
472
+ }, {
473
+ key: "label",
474
+ value: function label(field, values, updateOptions) {
475
+ this.pendingStyleAttributes.push({
476
+ attributeName: 'label',
477
+ attributeField: field,
478
+ attributeValues: values,
479
+ updateOptions: updateOptions
480
+ });
481
+ return this;
482
+ }
483
+ }, {
484
+ key: "animate",
485
+ value: function animate(options) {
486
+ var rawAnimate = {};
487
+
488
+ if (isObject(options)) {
489
+ rawAnimate.enable = true;
490
+ rawAnimate = _objectSpread(_objectSpread({}, rawAnimate), options);
491
+ } else {
492
+ rawAnimate.enable = options;
493
+ }
494
+
495
+ this.updateLayerConfig({
496
+ animateOption: rawAnimate
497
+ }); // this.animateOptions = options;
498
+
499
+ return this;
500
+ }
501
+ }, {
502
+ key: "source",
503
+ value: function source(data, options) {
504
+ if (data !== null && data !== void 0 && data.data) {
505
+ // 判断是否为source
506
+ this.setSource(data);
507
+ return this;
508
+ }
509
+
510
+ this.sourceOption = {
511
+ data: data,
512
+ options: options
513
+ };
514
+ this.clusterZoom = 0;
515
+ return this;
516
+ }
517
+ }, {
518
+ key: "setData",
519
+ value: function setData(data, options) {
520
+ var _this4 = this;
521
+
522
+ if (this.inited) {
523
+ this.layerSource.setData(data, options);
524
+ } else {
525
+ this.on('inited', function () {
526
+ var currentSource = _this4.getSource();
527
+
528
+ if (!currentSource) {
529
+ // 执行 setData 的时候 source 还不存在(还未执行 addLayer)
530
+ _this4.source(new Source(data, options));
531
+
532
+ _this4.sourceEvent();
533
+ } else {
534
+ _this4.layerSource.setData(data, options);
535
+ } // this.layerSource.setData(data, options);
536
+
537
+ });
538
+ }
539
+
540
+ return this;
541
+ }
542
+ }, {
543
+ key: "style",
544
+ value: function style(options) {
545
+ var _this5 = this;
546
+
547
+ var lastConfig = this.getLayerConfig();
548
+
549
+ var passes = options.passes,
550
+ rest = _objectWithoutProperties(options, _excluded); // passes 特殊处理
551
+
552
+
553
+ if (passes) {
554
+ normalizePasses(passes).forEach(function (pass) {
555
+ var postProcessingPass = _this5.multiPassRenderer.getPostProcessor().getPostProcessingPassByName(pass[0]);
556
+
557
+ if (postProcessingPass) {
558
+ postProcessingPass.updateOptions(pass[1]);
559
+ }
560
+ });
561
+ }
562
+
563
+ this.rawConfig = _objectSpread(_objectSpread({}, this.rawConfig), rest);
564
+
565
+ if (this.container) {
566
+ this.updateLayerConfig(this.rawConfig);
567
+ this.styleNeedUpdate = true;
568
+ } // @ts-ignore
569
+
570
+
571
+ if (lastConfig && lastConfig.mask === true && options.mask === false) {
572
+ this.clearModels();
573
+ this.layerModel.buildModels(function (models) {
574
+ _this5.models = models;
575
+ });
576
+ }
577
+
578
+ return this;
579
+ }
580
+ }, {
581
+ key: "scale",
582
+ value: function scale(field, cfg) {
583
+ if (isObject(field)) {
584
+ this.scaleOptions = _objectSpread(_objectSpread({}, this.scaleOptions), field);
585
+ } else {
586
+ this.scaleOptions[field] = cfg;
587
+ }
588
+
589
+ return this;
590
+ }
591
+ /**
592
+ * 渲染所有的图层
593
+ */
594
+
595
+ }, {
596
+ key: "renderLayers",
597
+ value: function renderLayers() {
598
+ this.rendering = true;
599
+ this.layerService.renderLayers();
600
+ this.rendering = false;
601
+ }
602
+ }, {
603
+ key: "render",
604
+ value: function render() {
605
+ if (this.tileLayer !== undefined) {
606
+ // 瓦片图层执行单独的 render 渲染队列
607
+ this.tileLayer.render();
608
+ return this;
609
+ } // TODO: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
610
+
611
+
612
+ if (this.getEncodedData() && this.getEncodedData().length !== 0) {
613
+ this.renderModels();
614
+ }
615
+
616
+ return this;
617
+ }
618
+ /**
619
+ * renderMultiPass 专门用于渲染支持 multipass 的 layer
620
+ */
621
+
622
+ }, {
623
+ key: "renderMultiPass",
624
+ value: function () {
625
+ var _renderMultiPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
626
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
627
+ while (1) {
628
+ switch (_context.prev = _context.next) {
629
+ case 0:
630
+ if (!(this.getEncodedData() && this.getEncodedData().length !== 0)) {
631
+ _context.next = 7;
632
+ break;
633
+ }
634
+
635
+ if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
636
+ _context.next = 6;
637
+ break;
638
+ }
639
+
640
+ _context.next = 4;
641
+ return this.multiPassRenderer.render();
642
+
643
+ case 4:
644
+ _context.next = 7;
645
+ break;
646
+
647
+ case 6:
648
+ if (this.multiPassRenderer) {
649
+ // renderPass 触发的渲染
650
+ this.renderModels();
651
+ } else {
652
+ this.renderModels();
653
+ }
654
+
655
+ case 7:
656
+ case "end":
657
+ return _context.stop();
658
+ }
659
+ }
660
+ }, _callee, this);
661
+ }));
662
+
663
+ function renderMultiPass() {
664
+ return _renderMultiPass.apply(this, arguments);
665
+ }
666
+
667
+ return renderMultiPass;
668
+ }()
669
+ }, {
670
+ key: "active",
671
+ value: function active(options) {
672
+ var activeOption = {};
673
+ activeOption.enableHighlight = isObject(options) ? true : options;
674
+
675
+ if (isObject(options)) {
676
+ activeOption.enableHighlight = true;
677
+
678
+ if (options.color) {
679
+ activeOption.highlightColor = options.color;
680
+ }
681
+
682
+ if (options.mix) {
683
+ activeOption.activeMix = options.mix;
684
+ }
685
+ } else {
686
+ activeOption.enableHighlight = !!options;
687
+ }
688
+
689
+ this.updateLayerConfig(activeOption);
690
+ return this;
691
+ }
692
+ }, {
693
+ key: "setActive",
694
+ value: function setActive(id, options) {
695
+ var _this6 = this;
696
+
697
+ if (isObject(id)) {
698
+ var _id$x = id.x,
699
+ x = _id$x === void 0 ? 0 : _id$x,
700
+ _id$y = id.y,
701
+ y = _id$y === void 0 ? 0 : _id$y;
702
+ this.updateLayerConfig({
703
+ highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
704
+ activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
705
+ });
706
+ this.pick({
707
+ x: x,
708
+ y: y
709
+ });
710
+ } else {
711
+ this.updateLayerConfig({
712
+ pickedFeatureID: id,
713
+ highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
714
+ activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
715
+ });
716
+ this.hooks.beforeSelect.call(encodePickingColor(id)) // @ts-ignore
717
+ .then(function () {
718
+ setTimeout(function () {
719
+ _this6.reRender();
720
+ }, 1);
721
+ });
722
+ }
723
+ }
724
+ }, {
725
+ key: "select",
726
+ value: function select(option) {
727
+ var activeOption = {};
728
+ activeOption.enableSelect = isObject(option) ? true : option;
729
+
730
+ if (isObject(option)) {
731
+ activeOption.enableSelect = true;
732
+
733
+ if (option.color) {
734
+ activeOption.selectColor = option.color;
735
+ }
736
+
737
+ if (option.mix) {
738
+ activeOption.selectMix = option.mix;
739
+ }
740
+ } else {
741
+ activeOption.enableSelect = !!option;
742
+ }
743
+
744
+ this.updateLayerConfig(activeOption);
745
+ return this;
746
+ }
747
+ }, {
748
+ key: "setSelect",
749
+ value: function setSelect(id, options) {
750
+ var _this7 = this;
751
+
752
+ if (isObject(id)) {
753
+ var _id$x2 = id.x,
754
+ x = _id$x2 === void 0 ? 0 : _id$x2,
755
+ _id$y2 = id.y,
756
+ y = _id$y2 === void 0 ? 0 : _id$y2;
757
+ this.updateLayerConfig({
758
+ selectColor: isObject(options) ? options.color : this.getLayerConfig().selectColor,
759
+ selectMix: isObject(options) ? options.mix : this.getLayerConfig().selectMix
760
+ });
761
+ this.pick({
762
+ x: x,
763
+ y: y
764
+ });
765
+ } else {
766
+ this.updateLayerConfig({
767
+ pickedFeatureID: id,
768
+ selectColor: isObject(options) ? options.color : this.getLayerConfig().selectColor,
769
+ selectMix: isObject(options) ? options.mix : this.getLayerConfig().selectMix
770
+ });
771
+ this.hooks.beforeSelect.call(encodePickingColor(id)) // @ts-ignore
772
+ .then(function () {
773
+ setTimeout(function () {
774
+ _this7.reRender();
775
+ }, 1);
776
+ });
777
+ }
778
+ }
779
+ }, {
780
+ key: "setBlend",
781
+ value: function setBlend(type) {
782
+ this.updateLayerConfig({
783
+ blend: type
784
+ });
785
+ this.layerModelNeedUpdate = true;
786
+ this.reRender();
787
+ return this;
788
+ }
789
+ }, {
790
+ key: "show",
791
+ value: function show() {
792
+ this.updateLayerConfig({
793
+ visible: true
794
+ });
795
+ this.reRender();
796
+ return this;
797
+ }
798
+ }, {
799
+ key: "hide",
800
+ value: function hide() {
801
+ if (this.type === 'CanvasLayer' && this.layerModel.clearCanvas) {
802
+ // 对 canvasLayer 的 hide 操作做特殊处理
803
+ this.layerModel.clearCanvas();
804
+ }
805
+
806
+ this.updateLayerConfig({
807
+ visible: false
808
+ });
809
+ this.reRender();
810
+ return this;
811
+ }
812
+ }, {
813
+ key: "setIndex",
814
+ value: function setIndex(index) {
815
+ this.zIndex = index;
816
+ this.layerService.updateLayerRenderList();
817
+ this.layerService.renderLayers();
818
+ return this;
819
+ }
820
+ }, {
821
+ key: "setCurrentPickId",
822
+ value: function setCurrentPickId(id) {
823
+ this.currentPickId = id;
824
+ }
825
+ }, {
826
+ key: "getCurrentPickId",
827
+ value: function getCurrentPickId() {
828
+ return this.currentPickId;
829
+ }
830
+ }, {
831
+ key: "setCurrentSelectedId",
832
+ value: function setCurrentSelectedId(id) {
833
+ this.selectedFeatureID = id;
834
+ }
835
+ }, {
836
+ key: "getCurrentSelectedId",
837
+ value: function getCurrentSelectedId() {
838
+ return this.selectedFeatureID;
839
+ }
840
+ }, {
841
+ key: "isVisible",
842
+ value: function isVisible() {
843
+ var zoom = this.mapService.getZoom();
844
+
845
+ var _this$getLayerConfig3 = this.getLayerConfig(),
846
+ visible = _this$getLayerConfig3.visible,
847
+ _this$getLayerConfig4 = _this$getLayerConfig3.minZoom,
848
+ minZoom = _this$getLayerConfig4 === void 0 ? -Infinity : _this$getLayerConfig4,
849
+ _this$getLayerConfig5 = _this$getLayerConfig3.maxZoom,
850
+ maxZoom = _this$getLayerConfig5 === void 0 ? Infinity : _this$getLayerConfig5;
851
+
852
+ return !!visible && zoom >= minZoom && zoom <= maxZoom;
853
+ }
854
+ }, {
855
+ key: "setMultiPass",
856
+ value: function setMultiPass(enableMultiPass, currentPasses) {
857
+ this.updateLayerConfig({
858
+ enableMultiPassRenderer: enableMultiPass
859
+ });
860
+
861
+ if (currentPasses) {
862
+ this.updateLayerConfig({
863
+ passes: currentPasses
864
+ });
865
+ }
866
+
867
+ if (enableMultiPass) {
868
+ var _this$getLayerConfig6 = this.getLayerConfig(),
869
+ _this$getLayerConfig7 = _this$getLayerConfig6.passes,
870
+ passes = _this$getLayerConfig7 === void 0 ? [] : _this$getLayerConfig7;
871
+
872
+ this.multiPassRenderer = createMultiPassRenderer(this, passes, this.postProcessingPassFactory, this.normalPassFactory);
873
+ this.multiPassRenderer.setRenderFlag(true);
874
+
875
+ var _this$rendererService = this.rendererService.getViewportSize(),
876
+ width = _this$rendererService.width,
877
+ height = _this$rendererService.height;
878
+
879
+ this.multiPassRenderer.resize(width, height);
880
+ }
881
+
882
+ return this;
883
+ }
884
+ }, {
885
+ key: "setMinZoom",
886
+ value: function setMinZoom(minZoom) {
887
+ this.updateLayerConfig({
888
+ minZoom: minZoom
889
+ });
890
+ return this;
891
+ }
892
+ }, {
893
+ key: "getMinZoom",
894
+ value: function getMinZoom() {
895
+ var _this$getLayerConfig8 = this.getLayerConfig(),
896
+ minZoom = _this$getLayerConfig8.minZoom;
897
+
898
+ return minZoom;
899
+ }
900
+ }, {
901
+ key: "getMaxZoom",
902
+ value: function getMaxZoom() {
903
+ var _this$getLayerConfig9 = this.getLayerConfig(),
904
+ maxZoom = _this$getLayerConfig9.maxZoom;
905
+
906
+ return maxZoom;
907
+ }
908
+ }, {
909
+ key: "get",
910
+ value: function get(name) {
911
+ var cfg = this.getLayerConfig(); // @ts-ignore
912
+
913
+ return cfg[name];
914
+ }
915
+ }, {
916
+ key: "setMaxZoom",
917
+ value: function setMaxZoom(maxZoom) {
918
+ this.updateLayerConfig({
919
+ maxZoom: maxZoom
920
+ });
921
+ return this;
922
+ }
923
+ }, {
924
+ key: "setAutoFit",
925
+ value: function setAutoFit(autoFit) {
926
+ this.updateLayerConfig({
927
+ autoFit: autoFit
928
+ });
929
+ return this;
930
+ }
931
+ /**
932
+ * zoom to layer Bounds
933
+ */
934
+
935
+ }, {
936
+ key: "fitBounds",
937
+ value: function fitBounds(fitBoundsOptions) {
938
+ if (!this.inited) {
939
+ this.updateLayerConfig({
940
+ autoFit: true
941
+ });
942
+ return this;
943
+ }
944
+
945
+ var source = this.getSource();
946
+ var extent = source.extent;
947
+ var isValid = extent.some(function (v) {
948
+ return Math.abs(v) === Infinity;
949
+ });
950
+
951
+ if (isValid) {
952
+ return this;
953
+ }
954
+
955
+ this.mapService.fitBounds([[extent[0], extent[1]], [extent[2], extent[3]]], fitBoundsOptions);
956
+ return this;
957
+ }
958
+ }, {
959
+ key: "destroy",
960
+ value: function destroy() {
961
+ var _this$layerModel2;
962
+
963
+ var refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
964
+
965
+ if (this.isDestroied) {
966
+ return;
967
+ } // remove child layer
968
+
969
+
970
+ this.layerChildren.map(function (child) {
971
+ return child.destroy();
972
+ });
973
+ this.layerChildren = []; // remove mask list
974
+
975
+ this.masks.map(function (mask) {
976
+ return mask.destroy();
977
+ });
978
+ this.masks = [];
979
+ this.hooks.beforeDestroy.call(); // 清除sources事件
980
+
981
+ this.layerSource.off('sourceUpdate', this.sourceEvent);
982
+ this.multiPassRenderer.destroy(); // console.log(this.styleAttributeService.getAttributes())
983
+ // 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());
984
+
985
+ this.styleAttributeService.clearAllAttributes(); // 执行每个图层单独的 clearModels 方法 (清除一些额外的 texture、program、buffer 等)
986
+
987
+ this.hooks.afterDestroy.call(); // TODO: 清除各个图层自定义的 models 资源
988
+
989
+ (_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels();
990
+ this.models = [];
991
+ this.layerService.cleanRemove(this, refresh);
992
+ this.emit('remove', {
993
+ target: this,
994
+ type: 'remove'
995
+ });
996
+ this.emit('destroy', {
997
+ target: this,
998
+ type: 'destroy'
999
+ });
1000
+ this.removeAllListeners(); // 解绑图层容器中的服务
1001
+ // this.container.unbind(TYPES.IStyleAttributeService);
1002
+
1003
+ this.isDestroied = true;
1004
+ }
1005
+ }, {
1006
+ key: "clear",
1007
+ value: function clear() {
1008
+ this.styleAttributeService.clearAllAttributes(); // 销毁所有 model
1009
+ }
1010
+ }, {
1011
+ key: "clearModels",
1012
+ value: function clearModels() {
1013
+ var _this$layerModel3;
1014
+
1015
+ this.models.forEach(function (model) {
1016
+ return model.destroy();
1017
+ });
1018
+ (_this$layerModel3 = this.layerModel) === null || _this$layerModel3 === void 0 ? void 0 : _this$layerModel3.clearModels();
1019
+ this.models = [];
1020
+ }
1021
+ }, {
1022
+ key: "isDirty",
1023
+ value: function isDirty() {
1024
+ return !!(this.styleAttributeService.getLayerStyleAttributes() || []).filter(function (attribute) {
1025
+ return attribute.needRescale || attribute.needRemapping || attribute.needRegenerateVertices;
1026
+ }).length;
1027
+ }
1028
+ }, {
1029
+ key: "setSource",
1030
+ value: function setSource(source) {
1031
+ var _this8 = this;
1032
+
1033
+ // 清除旧 sources 事件
1034
+ if (this.layerSource) {
1035
+ this.layerSource.off('sourceUpdate', this.sourceEvent);
1036
+ }
1037
+
1038
+ this.layerSource = source;
1039
+ this.clusterZoom = 0; // 已 inited 且启用聚合进行更新聚合数据
1040
+
1041
+ if (this.inited && this.layerSource.cluster) {
1042
+ var zoom = this.mapService.getZoom();
1043
+ this.layerSource.updateClusterData(zoom);
1044
+ } // source 可能会复用,会在其它layer被修改
1045
+
1046
+
1047
+ if (this.layerSource.inited) {
1048
+ this.sourceEvent();
1049
+ } // this.layerSource.inited 为 true 后,sourceUpdate 事件不会再触发
1050
+
1051
+
1052
+ this.layerSource.on('sourceUpdate', function () {
1053
+ _this8.sourceEvent();
1054
+ });
1055
+ }
1056
+ }, {
1057
+ key: "getSource",
1058
+ value: function getSource() {
1059
+ return this.layerSource;
1060
+ }
1061
+ }, {
1062
+ key: "getScaleOptions",
1063
+ value: function getScaleOptions() {
1064
+ return this.scaleOptions;
1065
+ }
1066
+ }, {
1067
+ key: "setEncodedData",
1068
+ value: function setEncodedData(encodedData) {
1069
+ this.encodedData = encodedData;
1070
+ }
1071
+ }, {
1072
+ key: "getEncodedData",
1073
+ value: function getEncodedData() {
1074
+ return this.encodedData;
1075
+ }
1076
+ }, {
1077
+ key: "getScale",
1078
+ value: function getScale(name) {
1079
+ return this.styleAttributeService.getLayerAttributeScale(name);
1080
+ }
1081
+ }, {
1082
+ key: "getLegendItems",
1083
+ value: function getLegendItems(name) {
1084
+ var scale = this.styleAttributeService.getLayerAttributeScale(name); // 函数自定义映射,没有 scale 返回为空数组
1085
+
1086
+ if (!scale) {
1087
+ return [];
1088
+ }
1089
+
1090
+ if (scale.invertExtent) {
1091
+ // 分段类型 Quantize、Quantile、Threshold
1092
+ var items = scale.range().map(function (item) {
1093
+ return _defineProperty({
1094
+ value: scale.invertExtent(item)
1095
+ }, name, item);
1096
+ });
1097
+ return items;
1098
+ } else if (scale.ticks) {
1099
+ // 连续类型 Continuous (Linear, Power, Log, Identity, Time)
1100
+ var _items = scale.ticks().map(function (item) {
1101
+ return _defineProperty({
1102
+ value: item
1103
+ }, name, scale(item));
1104
+ });
1105
+
1106
+ return _items;
1107
+ } else if (scale !== null && scale !== void 0 && scale.domain) {
1108
+ // 枚举类型 Cat
1109
+ var _items2 = scale.domain().filter(function (item) {
1110
+ return !isUndefined(item);
1111
+ }).map(function (item) {
1112
+ return _defineProperty({
1113
+ value: item
1114
+ }, name, scale(item));
1115
+ });
1116
+
1117
+ return _items2;
1118
+ }
1119
+
1120
+ return [];
1121
+ }
1122
+ }, {
1123
+ key: "pick",
1124
+ value: function pick(_ref6) {
1125
+ var x = _ref6.x,
1126
+ y = _ref6.y;
1127
+ this.interactionService.triggerHover({
1128
+ x: x,
1129
+ y: y
1130
+ });
1131
+ }
1132
+ }, {
1133
+ key: "boxSelect",
1134
+ value: function boxSelect(box, cb) {
1135
+ this.pickingService.boxPickLayer(this, box, cb);
1136
+ }
1137
+ }, {
1138
+ key: "buildLayerModel",
1139
+ value: function buildLayerModel(options) {
1140
+ var _this9 = this;
1141
+
1142
+ var moduleName = options.moduleName,
1143
+ vertexShader = options.vertexShader,
1144
+ fragmentShader = options.fragmentShader,
1145
+ triangulation = options.triangulation,
1146
+ segmentNumber = options.segmentNumber,
1147
+ _options$workerEnable = options.workerEnabled,
1148
+ workerEnabled = _options$workerEnable === void 0 ? false : _options$workerEnable,
1149
+ workerOptions = options.workerOptions,
1150
+ rest = _objectWithoutProperties(options, _excluded2);
1151
+
1152
+ this.shaderModuleService.registerModule(moduleName, {
1153
+ vs: vertexShader,
1154
+ fs: fragmentShader
1155
+ });
1156
+
1157
+ var _this$shaderModuleSer = this.shaderModuleService.getModule(moduleName),
1158
+ vs = _this$shaderModuleSer.vs,
1159
+ fs = _this$shaderModuleSer.fs,
1160
+ uniforms = _this$shaderModuleSer.uniforms;
1161
+
1162
+ var createModel = this.rendererService.createModel;
1163
+ return new Promise(function (resolve, reject) {
1164
+ // filter supported worker & worker enabled layer
1165
+ if (workerOptions && workerOptions.modelType in WorkerSourceMap && workerEnabled) {
1166
+ _this9.styleAttributeService.createAttributesAndIndicesAscy(_this9.encodedData, segmentNumber, workerOptions).then(function (_ref7) {
1167
+ var attributes = _ref7.attributes,
1168
+ elements = _ref7.elements;
1169
+ var m = createModel(_objectSpread({
1170
+ attributes: attributes,
1171
+ uniforms: uniforms,
1172
+ fs: fs,
1173
+ vs: vs,
1174
+ elements: elements,
1175
+ blend: BlendTypes[BlendType.normal]
1176
+ }, rest));
1177
+ resolve(m);
1178
+ }).catch(function (err) {
1179
+ return reject(err);
1180
+ });
1181
+ } else {
1182
+ var _this9$styleAttribute = _this9.styleAttributeService.createAttributesAndIndices(_this9.encodedData, triangulation, segmentNumber),
1183
+ attributes = _this9$styleAttribute.attributes,
1184
+ elements = _this9$styleAttribute.elements,
1185
+ count = _this9$styleAttribute.count;
1186
+
1187
+ var modeloptions = _objectSpread({
1188
+ attributes: attributes,
1189
+ uniforms: uniforms,
1190
+ fs: fs,
1191
+ vs: vs,
1192
+ elements: elements,
1193
+ blend: BlendTypes[BlendType.normal]
1194
+ }, rest);
1195
+
1196
+ if (count) {
1197
+ modeloptions.count = count;
1198
+ }
1199
+
1200
+ var m = createModel(modeloptions);
1201
+ resolve(m);
1202
+ }
1203
+ });
1204
+ }
1205
+ }, {
1206
+ key: "createAttrubutes",
1207
+ value: function createAttrubutes(options) {
1208
+ var triangulation = options.triangulation; // @ts-ignore
1209
+
1210
+ var _this$styleAttributeS4 = this.styleAttributeService.createAttributes(this.encodedData, triangulation),
1211
+ attributes = _this$styleAttributeS4.attributes;
1212
+
1213
+ return attributes;
1214
+ }
1215
+ }, {
1216
+ key: "getTime",
1217
+ value: function getTime() {
1218
+ return this.layerService.clock.getDelta();
1219
+ }
1220
+ }, {
1221
+ key: "setAnimateStartTime",
1222
+ value: function setAnimateStartTime() {
1223
+ this.animateStartTime = this.layerService.clock.getElapsedTime();
1224
+ }
1225
+ }, {
1226
+ key: "stopAnimate",
1227
+ value: function stopAnimate() {
1228
+ if (this.aniamateStatus) {
1229
+ this.layerService.stopAnimate();
1230
+ this.aniamateStatus = false;
1231
+ this.updateLayerConfig({
1232
+ animateOption: {
1233
+ enable: false
1234
+ }
1235
+ });
1236
+ }
1237
+ }
1238
+ }, {
1239
+ key: "getLayerAnimateTime",
1240
+ value: function getLayerAnimateTime() {
1241
+ return this.layerService.clock.getElapsedTime() - this.animateStartTime;
1242
+ }
1243
+ }, {
1244
+ key: "needPick",
1245
+ value: function needPick(type) {
1246
+ var _this$getLayerConfig10 = this.getLayerConfig(),
1247
+ _this$getLayerConfig11 = _this$getLayerConfig10.enableHighlight,
1248
+ enableHighlight = _this$getLayerConfig11 === void 0 ? true : _this$getLayerConfig11,
1249
+ _this$getLayerConfig12 = _this$getLayerConfig10.enableSelect,
1250
+ enableSelect = _this$getLayerConfig12 === void 0 ? true : _this$getLayerConfig12; // 判断layer是否监听事件;
1251
+
1252
+
1253
+ var isPick = this.eventNames().indexOf(type) !== -1 || this.eventNames().indexOf('un' + type) !== -1;
1254
+
1255
+ if ((type === 'click' || type === 'dblclick') && enableSelect) {
1256
+ isPick = true;
1257
+ }
1258
+
1259
+ if (type === 'mousemove' && (enableHighlight || this.eventNames().indexOf('mouseenter') !== -1 || this.eventNames().indexOf('unmousemove') !== -1 || this.eventNames().indexOf('mouseout') !== -1)) {
1260
+ isPick = true;
1261
+ }
1262
+
1263
+ return this.isVisible() && isPick;
1264
+ }
1265
+ }, {
1266
+ key: "buildModels",
1267
+ value: function buildModels() {
1268
+ throw new Error('Method not implemented.');
1269
+ }
1270
+ }, {
1271
+ key: "rebuildModels",
1272
+ value: function rebuildModels() {
1273
+ throw new Error('Method not implemented.');
1274
+ }
1275
+ }, {
1276
+ key: "renderMulPass",
1277
+ value: function () {
1278
+ var _renderMulPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(multiPassRenderer) {
1279
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1280
+ while (1) {
1281
+ switch (_context2.prev = _context2.next) {
1282
+ case 0:
1283
+ _context2.next = 2;
1284
+ return multiPassRenderer.render();
1285
+
1286
+ case 2:
1287
+ case "end":
1288
+ return _context2.stop();
1289
+ }
1290
+ }
1291
+ }, _callee2);
1292
+ }));
1293
+
1294
+ function renderMulPass(_x) {
1295
+ return _renderMulPass.apply(this, arguments);
1296
+ }
1297
+
1298
+ return renderMulPass;
1299
+ }()
1300
+ }, {
1301
+ key: "renderModels",
1302
+ value: function renderModels(isPicking) {
1303
+ var _this10 = this;
1304
+
1305
+ // TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
1306
+ if (this.getEncodedData() && this.getEncodedData().length > 0) {
1307
+ var _this$layerModel4;
1308
+
1309
+ if (this.layerModelNeedUpdate && this.layerModel) {
1310
+ this.layerModel.buildModels(function (models) {
1311
+ _this10.models = models;
1312
+
1313
+ _this10.hooks.beforeRender.call();
1314
+
1315
+ _this10.layerModelNeedUpdate = false;
1316
+ });
1317
+ }
1318
+
1319
+ if (this !== null && this !== void 0 && (_this$layerModel4 = this.layerModel) !== null && _this$layerModel4 !== void 0 && _this$layerModel4.renderUpdate) {
1320
+ this.layerModel.renderUpdate();
1321
+ }
1322
+
1323
+ this.models.forEach(function (model) {
1324
+ model.draw({
1325
+ uniforms: _this10.layerModel.getUninforms()
1326
+ }, isPicking);
1327
+ });
1328
+ }
1329
+
1330
+ return this;
1331
+ }
1332
+ }, {
1333
+ key: "updateStyleAttribute",
1334
+ value: function updateStyleAttribute(type, field, values, updateOptions) {
1335
+ if (!this.inited) {
1336
+ this.pendingStyleAttributes.push({
1337
+ attributeName: type,
1338
+ attributeField: field,
1339
+ attributeValues: values,
1340
+ updateOptions: updateOptions
1341
+ });
1342
+ } else {
1343
+ this.styleAttributeService.updateStyleAttribute(type, {
1344
+ // @ts-ignore
1345
+ scale: _objectSpread({
1346
+ field: field
1347
+ }, this.splitValuesAndCallbackInAttribute( // @ts-ignore
1348
+ values, // @ts-ignore
1349
+ this.getLayerConfig()[field]))
1350
+ }, // @ts-ignore
1351
+ updateOptions);
1352
+ }
1353
+ }
1354
+ }, {
1355
+ key: "getShaderPickStat",
1356
+ value: function getShaderPickStat() {
1357
+ return this.layerService.getShaderPickStat();
1358
+ }
1359
+ /**
1360
+ * 继承空方法
1361
+ * @param time
1362
+ */
1363
+
1364
+ }, {
1365
+ key: "setEarthTime",
1366
+ value: function setEarthTime(time) {
1367
+ console.warn('empty fn');
1368
+ }
1369
+ }, {
1370
+ key: "getConfigSchema",
1371
+ value: function getConfigSchema() {
1372
+ throw new Error('Method not implemented.');
1373
+ }
1374
+ }, {
1375
+ key: "getModelType",
1376
+ value: function getModelType() {
1377
+ throw new Error('Method not implemented.');
1378
+ }
1379
+ }, {
1380
+ key: "getDefaultConfig",
1381
+ value: function getDefaultConfig() {
1382
+ return {};
1383
+ }
1384
+ }, {
1385
+ key: "reRender",
1386
+ value: function reRender() {
1387
+ if (this.inited) {
1388
+ this.layerService.updateLayerRenderList();
1389
+ this.layerService.renderLayers();
1390
+ }
1391
+ }
1392
+ }, {
1393
+ key: "splitValuesAndCallbackInAttribute",
1394
+ value: function splitValuesAndCallbackInAttribute(valuesOrCallback, defaultValues) {
1395
+ return {
1396
+ values: isFunction(valuesOrCallback) ? undefined : valuesOrCallback || defaultValues,
1397
+ callback: isFunction(valuesOrCallback) ? valuesOrCallback : undefined
1398
+ };
1399
+ }
1400
+ }]);
1401
+
1402
+ return BaseLayer;
1403
+ }(EventEmitter), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "configService", [_dec], {
1404
+ configurable: true,
1405
+ enumerable: true,
1406
+ writable: true,
1407
+ initializer: null
1408
+ })), _class));
1409
+ export { BaseLayer as default };