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

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