@antv/l7-layers 2.9.27-alpha.2 → 2.9.27-alpha.4

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 (342) hide show
  1. package/es/Geometry/index.js +6 -2
  2. package/es/Geometry/models/billboard.js +3 -7
  3. package/es/Geometry/models/plane.js +5 -7
  4. package/es/Geometry/models/sprite.js +4 -7
  5. package/es/canvas/index.d.ts +4 -0
  6. package/es/canvas/index.js +38 -2
  7. package/es/citybuliding/building.js +6 -2
  8. package/es/citybuliding/models/build.js +2 -3
  9. package/es/core/BaseLayer.d.ts +20 -12
  10. package/es/core/BaseLayer.js +61 -85
  11. package/es/core/BaseModel.d.ts +2 -2
  12. package/es/core/BaseModel.js +22 -19
  13. package/es/core/interface.d.ts +20 -1
  14. package/es/core/triangulation.d.ts +6 -0
  15. package/es/core/triangulation.js +64 -2
  16. package/es/earth/index.js +3 -1
  17. package/es/earth/models/atmosphere.js +4 -7
  18. package/es/earth/models/base.js +12 -18
  19. package/es/earth/models/bloomsphere.js +4 -8
  20. package/es/earth/shaders/atmosphere_frag.glsl +1 -1
  21. package/es/earth/shaders/bloomsphere_frag.glsl +1 -1
  22. package/es/heatmap/index.d.ts +2 -2
  23. package/es/heatmap/index.js +7 -5
  24. package/es/heatmap/models/grid.js +1 -3
  25. package/es/heatmap/models/grid3d.js +4 -11
  26. package/es/heatmap/models/heatmap.js +8 -9
  27. package/es/heatmap/models/hexagon.js +2 -6
  28. package/es/heatmap/triangulation.js +0 -1
  29. package/es/image/index.d.ts +1 -1
  30. package/es/image/index.js +10 -3
  31. package/es/image/models/dataImage.d.ts +1 -1
  32. package/es/image/models/dataImage.js +14 -39
  33. package/es/image/models/image.js +5 -10
  34. package/es/image/models/index.d.ts +1 -1
  35. package/es/image/models/index.js +3 -1
  36. package/es/image/models/tileDataImage.d.ts +19 -0
  37. package/es/image/models/tileDataImage.js +174 -0
  38. package/es/line/index.d.ts +1 -0
  39. package/es/line/index.js +8 -2
  40. package/es/line/models/arc.js +10 -10
  41. package/es/line/models/arc_3d.js +8 -10
  42. package/es/line/models/earthArc_3d.js +8 -10
  43. package/es/line/models/great_circle.js +7 -7
  44. package/es/line/models/half.js +3 -4
  45. package/es/line/models/line.js +10 -9
  46. package/es/line/models/linearline.js +3 -4
  47. package/es/line/models/simpleLine.js +5 -4
  48. package/es/line/models/simpleTileLine.d.ts +9 -0
  49. package/es/line/models/simpleTileLine.js +100 -0
  50. package/es/line/models/tile.d.ts +1 -4
  51. package/es/line/models/tile.js +50 -223
  52. package/es/line/models/wall.js +11 -47
  53. package/es/line/shaders/dash/arc_dash_vert.glsl +2 -0
  54. package/es/line/shaders/dash/line_dash_frag.glsl +1 -1
  55. package/es/line/shaders/line_arc2d_vert.glsl +2 -2
  56. package/es/line/shaders/line_arc_3d_frag.glsl +10 -10
  57. package/es/line/shaders/line_arc_3d_vert.glsl +5 -6
  58. package/es/line/shaders/line_arc_frag.glsl +9 -10
  59. package/es/line/shaders/line_arc_great_circle_frag.glsl +6 -6
  60. package/es/line/shaders/line_arc_great_circle_vert.glsl +2 -3
  61. package/es/line/shaders/line_arc_vert.glsl +6 -4
  62. package/es/line/shaders/line_bezier_vert.glsl +2 -2
  63. package/es/line/shaders/line_frag.glsl +5 -6
  64. package/es/line/shaders/line_vert.glsl +1 -1
  65. package/es/line/shaders/linear/arc3d_linear_frag.glsl +6 -7
  66. package/es/line/shaders/linear/arc3d_linear_vert.glsl +11 -12
  67. package/es/line/shaders/linear/arc_linear_frag.glsl +1 -1
  68. package/es/line/shaders/tile/line_tile_map_vert.glsl +25 -0
  69. package/es/line/shaders/tile/line_tile_vert.glsl +19 -177
  70. package/es/line/shaders/tile/simpleline_map_vert.glsl +15 -0
  71. package/es/line/shaders/tile/simpleline_vert.glsl +21 -0
  72. package/es/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +21 -25
  73. package/es/line/shaders/wall/wall_vert.glsl +77 -0
  74. package/es/mask/index.d.ts +1 -0
  75. package/es/mask/index.js +80 -5
  76. package/es/mask/models/fill.d.ts +2 -1
  77. package/es/mask/models/fill.js +13 -10
  78. package/es/mask/shaders/mask_vert.glsl +0 -6
  79. package/es/plugins/DataMappingPlugin.d.ts +4 -3
  80. package/es/plugins/DataMappingPlugin.js +129 -58
  81. package/es/plugins/DataSourcePlugin.js +3 -2
  82. package/es/plugins/FeatureScalePlugin.d.ts +0 -2
  83. package/es/plugins/FeatureScalePlugin.js +8 -51
  84. package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -2
  85. package/es/plugins/LayerAnimateStylePlugin.js +7 -27
  86. package/es/plugins/LayerModelPlugin.js +2 -6
  87. package/es/plugins/LightingPlugin.js +1 -7
  88. package/es/plugins/MultiPassRendererPlugin.d.ts +0 -1
  89. package/es/plugins/MultiPassRendererPlugin.js +4 -16
  90. package/es/plugins/PixelPickingPlugin.d.ts +1 -1
  91. package/es/plugins/PixelPickingPlugin.js +8 -28
  92. package/es/plugins/RegisterStyleAttributePlugin.d.ts +4 -0
  93. package/es/plugins/RegisterStyleAttributePlugin.js +56 -5
  94. package/es/plugins/UpdateStyleAttributePlugin.js +2 -9
  95. package/es/point/index.js +9 -6
  96. package/es/point/models/earthExtrude.d.ts +1 -1
  97. package/es/point/models/earthExtrude.js +9 -14
  98. package/es/point/models/earthFill.js +2 -2
  99. package/es/point/models/extrude.d.ts +1 -1
  100. package/es/point/models/extrude.js +9 -12
  101. package/es/point/models/fill.d.ts +1 -1
  102. package/es/point/models/fill.js +8 -9
  103. package/es/point/models/fillmage.js +5 -6
  104. package/es/point/models/image.js +3 -3
  105. package/es/point/models/index.d.ts +1 -1
  106. package/es/point/models/index.js +3 -3
  107. package/es/point/models/normal.d.ts +0 -1
  108. package/es/point/models/normal.js +9 -62
  109. package/es/point/models/radar.js +5 -70
  110. package/es/point/models/simplePoint.d.ts +0 -1
  111. package/es/point/models/simplePoint.js +2 -11
  112. package/es/point/models/text.js +7 -10
  113. package/es/point/models/tile.d.ts +0 -7
  114. package/es/point/models/tile.js +24 -158
  115. package/es/point/models/tileText.d.ts +0 -4
  116. package/es/point/models/tileText.js +99 -188
  117. package/es/point/shaders/animate/wave_frag.glsl +4 -4
  118. package/es/point/shaders/earth/fill_vert.glsl +0 -1
  119. package/es/point/shaders/fill_vert.glsl +0 -1
  120. package/es/point/shaders/normal_frag.glsl +1 -10
  121. package/es/point/shaders/normal_vert.glsl +5 -60
  122. package/es/point/shaders/radar/radar_frag.glsl +4 -15
  123. package/es/point/shaders/radar/radar_vert.glsl +4 -54
  124. package/es/point/shaders/tile/fill_tile_frag.glsl +10 -17
  125. package/es/point/shaders/tile/fill_tile_vert.glsl +20 -123
  126. package/es/point/shaders/tile/text_frag.glsl +33 -0
  127. package/es/point/shaders/tile/text_map_frag.glsl +31 -0
  128. package/es/point/shaders/tile/text_map_vert.glsl +38 -0
  129. package/es/point/shaders/tile/text_vert.glsl +48 -0
  130. package/es/polygon/index.js +6 -2
  131. package/es/polygon/models/extrude.js +4 -8
  132. package/es/polygon/models/fill.js +3 -4
  133. package/es/polygon/models/ocean.d.ts +0 -2
  134. package/es/polygon/models/ocean.js +13 -47
  135. package/es/polygon/models/tile.d.ts +1 -4
  136. package/es/polygon/models/tile.js +25 -57
  137. package/es/polygon/models/water.d.ts +0 -2
  138. package/es/polygon/models/water.js +13 -47
  139. package/es/polygon/shaders/polygon_frag.glsl +2 -2
  140. package/es/polygon/shaders/polygon_vert.glsl +2 -2
  141. package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
  142. package/es/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
  143. package/es/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
  144. package/es/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
  145. package/es/polygon/shaders/water/polygon_water_frag.glsl +1 -3
  146. package/es/polygon/shaders/water/polygon_water_vert.glsl +0 -29
  147. package/es/raster/buffers/triangulation.js +1 -4
  148. package/es/raster/index.js +6 -2
  149. package/es/raster/models/raster.d.ts +1 -1
  150. package/es/raster/models/raster.js +6 -5
  151. package/es/shader/minify_frag.glsl +7 -0
  152. package/es/shader/minify_picking_frag.glsl +10 -0
  153. package/es/tile/manager/baseMapTileLayerManager.d.ts +29 -0
  154. package/es/tile/manager/baseMapTileLayerManager.js +207 -0
  155. package/es/tile/manager/tileLayerManager.d.ts +2 -2
  156. package/es/tile/manager/tileLayerManager.js +12 -2
  157. package/es/tile/manager/tilePickerManager.d.ts +2 -3
  158. package/es/tile/manager/tilePickerManager.js +1 -2
  159. package/es/tile/models/tileModel.d.ts +1 -0
  160. package/es/tile/models/tileModel.js +18 -2
  161. package/es/tile/tileFactory/base.d.ts +1 -1
  162. package/es/tile/tileFactory/base.js +58 -33
  163. package/es/tile/tileFactory/line.js +3 -0
  164. package/es/tile/tileFactory/point.js +3 -0
  165. package/es/tile/tileFactory/polygon.js +3 -0
  166. package/es/tile/tileFactory/raster.js +3 -0
  167. package/es/tile/tileFactory/rasterData.js +3 -0
  168. package/es/tile/tileFactory/rasterDataLayer.js +6 -2
  169. package/es/tile/tileFactory/test.js +26 -5
  170. package/es/tile/tileFactory/vectorLayer.d.ts +4 -1
  171. package/es/tile/tileFactory/vectorLayer.js +110 -7
  172. package/es/tile/tileLayer/baseMapTileLayer.d.ts +29 -0
  173. package/es/tile/tileLayer/baseMapTileLayer.js +188 -0
  174. package/es/tile/tileLayer/baseTileLayer.d.ts +4 -4
  175. package/es/tile/tileLayer/baseTileLayer.js +46 -75
  176. package/es/tile/tileTest.d.ts +1 -0
  177. package/es/tile/tileTest.js +3 -2
  178. package/es/tile/tmsMapTileLayer.d.ts +9 -0
  179. package/es/tile/tmsMapTileLayer.js +119 -0
  180. package/es/tile/tmsTileLayer.d.ts +2 -0
  181. package/es/tile/tmsTileLayer.js +24 -2
  182. package/es/tile/utils.d.ts +4 -0
  183. package/es/tile/utils.js +30 -0
  184. package/es/utils/dataMappingStyle.js +3 -0
  185. package/es/utils/layerData.js +2 -2
  186. package/es/utils/updateShape.js +2 -2
  187. package/es/wind/index.js +6 -2
  188. package/es/wind/models/wind.js +8 -8
  189. package/es/wind/shaders/wind_vert.glsl +1 -1
  190. package/lib/Geometry/index.js +6 -2
  191. package/lib/Geometry/models/billboard.js +3 -7
  192. package/lib/Geometry/models/plane.js +5 -7
  193. package/lib/Geometry/models/sprite.js +4 -7
  194. package/lib/canvas/index.js +37 -2
  195. package/lib/citybuliding/building.js +6 -2
  196. package/lib/citybuliding/models/build.js +2 -3
  197. package/lib/core/BaseLayer.js +61 -85
  198. package/lib/core/BaseModel.js +22 -19
  199. package/lib/core/triangulation.js +66 -2
  200. package/lib/earth/index.js +3 -1
  201. package/lib/earth/models/atmosphere.js +4 -7
  202. package/lib/earth/models/base.js +12 -18
  203. package/lib/earth/models/bloomsphere.js +4 -8
  204. package/lib/earth/shaders/atmosphere_frag.glsl +1 -1
  205. package/lib/earth/shaders/bloomsphere_frag.glsl +1 -1
  206. package/lib/heatmap/index.js +7 -5
  207. package/lib/heatmap/models/grid.js +1 -3
  208. package/lib/heatmap/models/grid3d.js +4 -11
  209. package/lib/heatmap/models/heatmap.js +8 -9
  210. package/lib/heatmap/models/hexagon.js +2 -6
  211. package/lib/heatmap/triangulation.js +0 -1
  212. package/lib/image/index.js +10 -3
  213. package/lib/image/models/dataImage.js +13 -38
  214. package/lib/image/models/image.js +5 -10
  215. package/lib/image/models/index.js +4 -1
  216. package/lib/image/models/tileDataImage.js +188 -0
  217. package/lib/line/index.js +7 -2
  218. package/lib/line/models/arc.js +10 -10
  219. package/lib/line/models/arc_3d.js +8 -10
  220. package/lib/line/models/earthArc_3d.js +8 -10
  221. package/lib/line/models/great_circle.js +7 -7
  222. package/lib/line/models/half.js +3 -4
  223. package/lib/line/models/line.js +10 -9
  224. package/lib/line/models/linearline.js +3 -4
  225. package/lib/line/models/simpleLine.js +5 -4
  226. package/lib/line/models/simpleTileLine.js +115 -0
  227. package/lib/line/models/tile.js +50 -224
  228. package/lib/line/models/wall.js +11 -47
  229. package/lib/line/shaders/dash/arc_dash_vert.glsl +2 -0
  230. package/lib/line/shaders/dash/line_dash_frag.glsl +1 -1
  231. package/lib/line/shaders/line_arc2d_vert.glsl +2 -2
  232. package/lib/line/shaders/line_arc_3d_frag.glsl +10 -10
  233. package/lib/line/shaders/line_arc_3d_vert.glsl +5 -6
  234. package/lib/line/shaders/line_arc_frag.glsl +9 -10
  235. package/lib/line/shaders/line_arc_great_circle_frag.glsl +6 -6
  236. package/lib/line/shaders/line_arc_great_circle_vert.glsl +2 -3
  237. package/lib/line/shaders/line_arc_vert.glsl +6 -4
  238. package/lib/line/shaders/line_bezier_vert.glsl +2 -2
  239. package/lib/line/shaders/line_frag.glsl +5 -6
  240. package/lib/line/shaders/line_vert.glsl +1 -1
  241. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +6 -7
  242. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +11 -12
  243. package/lib/line/shaders/linear/arc_linear_frag.glsl +1 -1
  244. package/lib/line/shaders/tile/line_tile_map_vert.glsl +25 -0
  245. package/lib/line/shaders/tile/line_tile_vert.glsl +19 -177
  246. package/lib/line/shaders/tile/simpleline_map_vert.glsl +15 -0
  247. package/lib/line/shaders/tile/simpleline_vert.glsl +21 -0
  248. package/lib/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +21 -25
  249. package/lib/line/shaders/wall/wall_vert.glsl +77 -0
  250. package/lib/mask/index.js +82 -5
  251. package/lib/mask/models/fill.js +14 -10
  252. package/lib/mask/shaders/mask_vert.glsl +0 -6
  253. package/lib/plugins/DataMappingPlugin.js +127 -57
  254. package/lib/plugins/DataSourcePlugin.js +3 -2
  255. package/lib/plugins/FeatureScalePlugin.js +6 -50
  256. package/lib/plugins/LayerAnimateStylePlugin.js +6 -29
  257. package/lib/plugins/LayerModelPlugin.js +2 -6
  258. package/lib/plugins/LightingPlugin.js +1 -7
  259. package/lib/plugins/MultiPassRendererPlugin.js +3 -19
  260. package/lib/plugins/PixelPickingPlugin.js +8 -28
  261. package/lib/plugins/RegisterStyleAttributePlugin.js +56 -5
  262. package/lib/plugins/UpdateStyleAttributePlugin.js +2 -9
  263. package/lib/point/index.js +9 -6
  264. package/lib/point/models/earthExtrude.js +9 -14
  265. package/lib/point/models/earthFill.js +2 -2
  266. package/lib/point/models/extrude.js +9 -12
  267. package/lib/point/models/fill.js +8 -9
  268. package/lib/point/models/fillmage.js +5 -6
  269. package/lib/point/models/image.js +3 -3
  270. package/lib/point/models/index.js +1 -1
  271. package/lib/point/models/normal.js +8 -61
  272. package/lib/point/models/radar.js +5 -70
  273. package/lib/point/models/simplePoint.js +1 -10
  274. package/lib/point/models/text.js +7 -10
  275. package/lib/point/models/tile.js +23 -159
  276. package/lib/point/models/tileText.js +98 -187
  277. package/lib/point/shaders/animate/wave_frag.glsl +4 -4
  278. package/lib/point/shaders/earth/fill_vert.glsl +0 -1
  279. package/lib/point/shaders/fill_vert.glsl +0 -1
  280. package/lib/point/shaders/normal_frag.glsl +1 -10
  281. package/lib/point/shaders/normal_vert.glsl +5 -60
  282. package/lib/point/shaders/radar/radar_frag.glsl +4 -15
  283. package/lib/point/shaders/radar/radar_vert.glsl +4 -54
  284. package/lib/point/shaders/tile/fill_tile_frag.glsl +10 -17
  285. package/lib/point/shaders/tile/fill_tile_vert.glsl +20 -123
  286. package/lib/point/shaders/tile/text_frag.glsl +33 -0
  287. package/lib/point/shaders/tile/text_map_frag.glsl +31 -0
  288. package/lib/point/shaders/tile/text_map_vert.glsl +38 -0
  289. package/lib/point/shaders/tile/text_vert.glsl +48 -0
  290. package/lib/polygon/index.js +6 -2
  291. package/lib/polygon/models/extrude.js +4 -8
  292. package/lib/polygon/models/fill.js +3 -4
  293. package/lib/polygon/models/ocean.js +14 -47
  294. package/lib/polygon/models/tile.js +24 -57
  295. package/lib/polygon/models/water.js +14 -47
  296. package/lib/polygon/shaders/polygon_frag.glsl +2 -2
  297. package/lib/polygon/shaders/polygon_vert.glsl +2 -2
  298. package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
  299. package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
  300. package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
  301. package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
  302. package/lib/polygon/shaders/water/polygon_water_frag.glsl +1 -3
  303. package/lib/polygon/shaders/water/polygon_water_vert.glsl +0 -29
  304. package/lib/raster/buffers/triangulation.js +1 -4
  305. package/lib/raster/index.js +6 -2
  306. package/lib/raster/models/raster.js +6 -5
  307. package/lib/shader/minify_frag.glsl +7 -0
  308. package/lib/shader/minify_picking_frag.glsl +10 -0
  309. package/lib/tile/manager/baseMapTileLayerManager.js +222 -0
  310. package/lib/tile/manager/tileLayerManager.js +12 -2
  311. package/lib/tile/manager/tilePickerManager.js +1 -2
  312. package/lib/tile/models/tileModel.js +19 -2
  313. package/lib/tile/tileFactory/base.js +60 -33
  314. package/lib/tile/tileFactory/line.js +3 -0
  315. package/lib/tile/tileFactory/point.js +3 -0
  316. package/lib/tile/tileFactory/polygon.js +3 -0
  317. package/lib/tile/tileFactory/raster.js +3 -0
  318. package/lib/tile/tileFactory/rasterData.js +3 -0
  319. package/lib/tile/tileFactory/rasterDataLayer.js +6 -2
  320. package/lib/tile/tileFactory/test.js +26 -5
  321. package/lib/tile/tileFactory/vectorLayer.js +112 -8
  322. package/lib/tile/tileLayer/baseMapTileLayer.js +195 -0
  323. package/lib/tile/tileLayer/baseTileLayer.js +46 -75
  324. package/lib/tile/tileTest.js +3 -2
  325. package/lib/tile/tmsMapTileLayer.js +136 -0
  326. package/lib/tile/tmsTileLayer.js +25 -2
  327. package/lib/tile/utils.js +38 -0
  328. package/lib/utils/dataMappingStyle.js +3 -0
  329. package/lib/utils/layerData.js +2 -2
  330. package/lib/utils/updateShape.js +2 -2
  331. package/lib/wind/index.js +6 -2
  332. package/lib/wind/models/wind.js +7 -7
  333. package/lib/wind/shaders/wind_vert.glsl +1 -1
  334. package/package.json +8 -7
  335. package/es/line/shaders/tile/line_tile_frag.glsl +0 -79
  336. package/es/line/shaders/wall_vert.glsl +0 -111
  337. package/es/mask/shaders/mask_frag.glsl +0 -7
  338. package/es/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
  339. package/lib/line/shaders/tile/line_tile_frag.glsl +0 -79
  340. package/lib/line/shaders/wall_vert.glsl +0 -111
  341. package/lib/mask/shaders/mask_frag.glsl +0 -7
  342. package/lib/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
@@ -1,210 +1,52 @@
1
-
2
1
  attribute float a_Miter;
3
2
  attribute vec4 a_Color;
4
3
  attribute vec2 a_Size;
5
4
  attribute vec3 a_Normal;
6
5
  attribute vec3 a_Position;
7
6
 
8
- attribute vec2 a_iconMapUV;
9
-
10
- // dash line
11
- attribute float a_Total_Distance;
12
- attribute vec2 a_DistanceAndIndex;
13
-
14
- uniform vec2 u_tileOrigin;
15
- uniform float u_coord;
7
+ // uniform vec2 u_tileOrigin;
8
+ // uniform float u_coord;
16
9
 
17
10
  uniform mat4 u_ModelMatrix;
18
11
  uniform mat4 u_Mvp;
19
- uniform float u_icon_step: 100;
20
12
 
21
- uniform float u_heightfixed: 0.0;
22
- uniform float u_vertexScale: 1.0;
23
13
 
24
14
  #pragma include "projection"
25
15
  #pragma include "picking"
26
16
 
27
17
  varying vec4 v_color;
28
18
 
29
- // texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
30
- varying vec2 v_iconMapUV;
31
-
32
-
33
- uniform float u_linearColor: 0;
34
- uniform float u_arrow: 0.0;
35
- uniform float u_arrowHeight: 3.0;
36
- uniform float u_arrowWidth: 2.0;
37
- uniform float u_tailWidth: 1.0;
38
-
39
- uniform float u_opacity: 1.0;
40
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
41
-
42
- #pragma include "styleMapping"
43
- #pragma include "styleMappingCalOpacity"
44
-
45
- vec2 calculateArrow(vec2 offset) {
46
- /*
47
- * 在支持箭头的时候,第二、第三组顶点是额外插入用于构建顶点的
48
- */
49
- float arrowFlag = -1.0;
50
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
51
- // 高德 2.0 的旋转角度不同
52
- arrowFlag = 1.0;
53
- }
54
- float pi = arrowFlag * 3.1415926/2.;
55
- if(a_Miter < 0.) {
56
- // 根据线的两侧偏移不同、旋转的方向相反
57
- pi = -pi;
58
- }
59
- highp float angle_sin = sin(pi);
60
- highp float angle_cos = cos(pi);
61
- // 计算垂直与线方向的旋转矩阵
62
- mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);
63
- float arrowWidth = u_arrowWidth;
64
- float arrowHeight = u_arrowHeight;
65
-
66
- vec2 arrowOffset = vec2(0.0);
67
- /*
68
- * a_DistanceAndIndex.y 用于标记当前顶点属于哪一组(两个顶点一组,构成线的其实是矩形,最简需要四个顶点、两组顶点构成)
69
- */
70
- if(a_DistanceAndIndex.y == 0.0) {
71
- // 箭头尖部
72
- offset = vec2(0.0);
73
- } else if(a_DistanceAndIndex.y == 1.0) {
74
- // 箭头两侧
75
- arrowOffset = rotation_matrix*(offset * arrowHeight);
76
- offset += arrowOffset; // 沿线偏移
77
- offset = offset * arrowWidth; // 垂直线向外偏移(是构建箭头两侧的顶点)
78
- } else if(a_DistanceAndIndex.y == 2.0 || a_DistanceAndIndex.y == 3.0 || a_DistanceAndIndex.y == 4.0) {
79
- // 偏移其余的点位(将长度让位给箭头)
80
- arrowOffset = rotation_matrix*(offset * arrowHeight) * arrowWidth;
81
- offset += arrowOffset;// 沿线偏移
82
- }
83
-
84
- return offset;
85
- }
86
-
87
19
  void main() {
88
- // cal style mapping - 数据纹理映射部分的计算
89
- styleMappingMat = mat4(
90
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
91
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
92
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
93
- 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV
94
- );
95
-
96
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
97
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
98
- float columnWidth = 1.0/columnCount; // 列宽
99
- float rowHeight = 1.0/rowCount; // 行高
100
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
101
- float id = a_vertexId; // 第n个顶点
102
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
103
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
104
-
105
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
106
- // 按顺序从 cell 中取值、若没有则自动往下取值
107
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
108
-
109
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
110
- styleMappingMat[0][0] = opacityAndOffset.r;
111
- textureOffset = opacityAndOffset.g;
112
- // cal style mapping - 数据纹理映射部分的计算
113
-
114
- float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
115
-
116
- v_iconMapUV = a_iconMapUV;
117
- d_texPixelLen = project_float_pixel(u_icon_step);
118
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
119
- d_texPixelLen *= 10.0;
120
- }
121
-
122
20
  v_color = a_Color;
123
21
 
124
22
  vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);
125
23
 
126
24
  vec2 offset = project_pixel(size.xy);
127
25
 
128
- float lineDistance = a_DistanceAndIndex.x;
129
- float currentLinePointRatio = lineDistance / a_Total_Distance;
130
-
131
- if(u_arrow > 0.0) {
132
- // 计算箭头
133
- offset = calculateArrow(offset);
134
-
135
- if(a_DistanceAndIndex.y > 4.0) {
136
- offset *= mix(1.0, u_tailWidth, currentLinePointRatio);
137
- }
138
- }
139
-
140
- float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // 线横向偏移的距离(向两侧偏移的和)
141
- float linePixelSize = project_pixel(a_Size.x) * 2.0; // 定点位置偏移,按地图等级缩放后的距离 单侧 * 2
142
- float texV = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
143
-
144
- // 设置数据集的参数
145
- styleMappingMat[3][0] = currentLinePointRatio; // 当前点位距离占线总长的比例
146
- styleMappingMat[3][1] = lineDistance; // 当前顶点的距离
147
- styleMappingMat[3][2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
148
- styleMappingMat[3][3] = texV; // 线图层贴图部分的 v 坐标值
149
-
150
26
  vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
151
27
 
152
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));
153
-
154
- float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况 vertex height
155
- float lineHeight = a_Size.y; // size 第二个参数代表的高度 [linewidth, lineheight]
156
-
157
- if(u_coord > 0.0) {
158
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
159
- lineHeight *= 0.2; // 保持和 amap/mapbox 一致的效果
160
- h *= 0.2;
161
- if(u_heightfixed < 1.0) {
162
- lineHeight = project_pixel(a_Size.y);
163
- }
164
- gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h, 1.0));
165
- } else {
166
- // mapbox - amap
167
-
168
- // 兼容 mapbox 在线高度上的效果表现基本一致
169
- if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
170
- // mapbox
171
- // 保持高度相对不变
172
- float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
173
- h *= mapboxZoomScale;
174
- if(u_heightfixed > 0.0) {
175
- lineHeight *= mapboxZoomScale;
176
- }
177
-
28
+ // if(u_coord > 0.0) { // 使用经纬度坐标
29
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
30
+ gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));
178
31
  } else {
179
- // amap
180
- // lineHeight 顶点偏移高度
181
- if(u_heightfixed < 1.0) {
182
- lineHeight *= pow(2.0, 20.0 - u_Zoom);
183
- }
32
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
184
33
  }
34
+ // } else { // 使用偏移坐标
35
+ // vec2 pointPos = a_Position.xy;
36
+ // vec4 tileWorld = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // 瓦片起始点的世界坐标
185
37
 
186
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));
187
- }
188
- } else {
189
- vec2 pointPos = a_Position.xy;
190
- vec4 tileWorld = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // 瓦片起始点的世界坐标
191
-
192
- vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // 瓦片内的点的偏移坐标
193
-
194
- tileWorld.xy += pointOffset;
195
-
196
- tileWorld.xy += offset;
197
-
198
- if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
199
- // Needs to be divided with project_uCommonUnitsPerMeter
200
- tileWorld.w *= u_PixelsPerMeter.z;
201
- }
38
+ // vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // 瓦片内的点的偏移坐标
39
+
40
+ // tileWorld.xy += pointOffset;
202
41
 
203
- gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;
204
- }
42
+ // tileWorld.xy += offset;
205
43
 
44
+ // if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
45
+ // // Needs to be divided with project_uCommonUnitsPerMeter
46
+ // tileWorld.w *= u_PixelsPerMeter.z;
47
+ // }
48
+ // gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;
49
+ // }
206
50
 
207
51
  setPickingColor(a_PickingColor);
208
-
209
-
210
52
  }
@@ -0,0 +1,15 @@
1
+ attribute vec3 a_Position;
2
+ uniform mat4 u_ModelMatrix;
3
+ uniform mat4 u_Mvp;
4
+
5
+ #pragma include "projection"
6
+
7
+ void main() {
8
+ vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
9
+
10
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
11
+ gl_Position = u_Mvp * (vec4(project_pos.xy, 0.0, 1.0));
12
+ } else {
13
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
14
+ }
15
+ }
@@ -0,0 +1,21 @@
1
+ attribute vec4 a_Color;
2
+ attribute vec3 a_Position;
3
+
4
+ uniform mat4 u_ModelMatrix;
5
+ uniform mat4 u_Mvp;
6
+
7
+ #pragma include "projection"
8
+
9
+ varying vec4 v_color;
10
+
11
+ void main() {
12
+ v_color = a_Color;
13
+
14
+ vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
15
+
16
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
17
+ gl_Position = u_Mvp * (vec4(project_pos.xy, 0.0, 1.0));
18
+ } else {
19
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
20
+ }
21
+ }
@@ -1,36 +1,32 @@
1
1
  #define Animate 0.0
2
2
  #define LineTexture 1.0
3
3
 
4
- uniform float u_opacity : 1.0;
5
- uniform float u_textureBlend;
6
- uniform float u_iconStepCount;
7
-
8
- varying vec4 v_color;
9
-
10
4
  // line texture
11
5
  uniform float u_line_texture;
12
6
  uniform sampler2D u_texture;
13
7
  uniform vec2 u_textSize;
14
-
15
- varying vec2 v_iconMapUV;
16
- varying float v_blur;
17
-
18
8
  uniform float u_linearColor: 0;
19
9
  uniform vec4 u_sourceColor;
20
10
  uniform vec4 u_targetColor;
11
+ uniform float u_opacity : 1.0;
12
+ uniform float u_textureBlend;
13
+ uniform float u_iconStepCount;
14
+ uniform float u_time;
15
+ uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; // 控制运动
21
16
 
22
- #pragma include "picking"
17
+ varying vec2 v_iconMapUV;
18
+ varying float v_blur;
19
+ varying float v_radio;
20
+ varying vec4 v_color;
21
+ varying vec4 v_dataset;
23
22
 
24
- uniform float u_time;
25
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // 控制运动
23
+ #pragma include "picking"
26
24
 
27
- varying mat4 styleMappingMat;
28
- // [animate, duration, interval, trailLength],
29
25
  void main() {
30
- float opacity = styleMappingMat[0][0];
26
+ float opacity = u_opacity;
31
27
  float animateSpeed = 0.0; // 运动速度
32
- float d_distance_ratio = styleMappingMat[3].r; // 当前点位距离占线总长的比例
33
- float v = styleMappingMat[3].a;
28
+ float d_distance_ratio = v_dataset.r; // 当前点位距离占线总长的比例
29
+ float v = v_dataset.a;
34
30
 
35
31
  if(u_linearColor == 1.0) { // 使用渐变颜色
36
32
  gl_FragColor = mix(u_sourceColor, u_targetColor, v);
@@ -39,19 +35,19 @@ void main() {
39
35
  }
40
36
 
41
37
  gl_FragColor.a *= opacity; // 全局透明度
42
- if(u_aimate.x == Animate) {
43
- animateSpeed = u_time / u_aimate.y;
44
- float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + animateSpeed);
45
- alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;
38
+ if(u_animate.x == Animate) {
39
+ animateSpeed = u_time / u_animate.y;
40
+ float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);
41
+ alpha = (alpha + u_animate.w -1.0) / u_animate.w;
46
42
  alpha = smoothstep(0., 1., alpha);
47
43
  gl_FragColor.a *= alpha;
48
44
  }
49
45
 
50
46
  if(u_line_texture == LineTexture) { // while load texture
51
- float aDistance = styleMappingMat[3].g; // 当前顶点的距离
52
- float d_texPixelLen = styleMappingMat[3].b; // 贴图的像素长度,根据地图层级缩放
47
+ float aDistance = v_dataset.g; // 当前顶点的距离
48
+ float d_texPixelLen = v_dataset.b; // 贴图的像素长度,根据地图层级缩放
53
49
  float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);
54
- float v = styleMappingMat[3].a; // 线图层贴图部分的 v 坐标值
50
+ float v = v_dataset.a; // 线图层贴图部分的 v 坐标值
55
51
 
56
52
  // 计算纹理间隔 start
57
53
  float flag = 0.0;
@@ -0,0 +1,77 @@
1
+ #define Animate 0.0
2
+
3
+ attribute float a_Miter;
4
+ attribute vec4 a_Color;
5
+ attribute vec2 a_Size;
6
+ attribute vec3 a_Normal;
7
+ attribute vec3 a_Position;
8
+ attribute vec2 a_iconMapUV;
9
+ attribute float a_Total_Distance;
10
+ attribute float a_Distance;
11
+
12
+ uniform mat4 u_ModelMatrix;
13
+ uniform mat4 u_Mvp;
14
+ uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
15
+ uniform float u_icon_step: 100;
16
+ uniform float u_heightfixed;
17
+ uniform float u_linearColor: 0;
18
+
19
+ #pragma include "projection"
20
+ #pragma include "light"
21
+ #pragma include "picking"
22
+
23
+ // texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
24
+ varying vec2 v_iconMapUV;
25
+ varying vec4 v_color;
26
+ varying float v_blur;
27
+ varying float v_radio;
28
+ varying vec4 v_dataset;
29
+
30
+ void main() {
31
+
32
+
33
+ float d_distance_ratio; // 当前点位距离占线总长的比例
34
+ float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
35
+
36
+ v_iconMapUV = a_iconMapUV;
37
+ if(u_heightfixed < 1.0) { // 高度随 zoom 调整
38
+ d_texPixelLen = project_pixel(u_icon_step);
39
+ } else {
40
+ d_texPixelLen = u_icon_step;
41
+ }
42
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
43
+ d_texPixelLen *= 10.0;
44
+ }
45
+
46
+ if(u_animate.x == Animate || u_linearColor == 1.0) {
47
+ d_distance_ratio = a_Distance / a_Total_Distance;
48
+ }
49
+
50
+ float miter = (a_Miter + 1.0)/2.0;
51
+ // 设置数据集的参数
52
+ v_dataset[0] = d_distance_ratio; // 当前点位距离占线总长的比例
53
+ v_dataset[1] = a_Distance; // 当前顶点的距离
54
+ v_dataset[2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
55
+ v_dataset[3] = miter; // 线图层贴图部分的 v 坐标值 0 - 1
56
+
57
+ vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
58
+
59
+ float originSize = a_Size.x; // 固定高度
60
+ if(u_heightfixed < 1.0) { // 高度随 zoom 调整
61
+ originSize = project_float_pixel(a_Size.x);
62
+ }
63
+
64
+ float wallHeight = originSize * miter;
65
+ float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));
66
+
67
+ v_blur = min(project_float_pixel(2.0) / originSize, 0.05);
68
+ v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);
69
+
70
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
71
+ gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));
72
+ } else {
73
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
74
+ }
75
+
76
+ setPickingColor(a_PickingColor);
77
+ }
package/lib/mask/index.js CHANGED
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
10
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
13
 
12
14
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -25,6 +27,14 @@ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
25
27
 
26
28
  var _models = _interopRequireDefault(require("./models"));
27
29
 
30
+ var _l7Core = require("@antv/l7-core");
31
+
32
+ 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; } } }; }
33
+
34
+ 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); }
35
+
36
+ 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; }
37
+
28
38
  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); }; }
29
39
 
30
40
  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; } }
@@ -49,25 +59,92 @@ var MaskLayer = /*#__PURE__*/function (_BaseLayer) {
49
59
  }
50
60
 
51
61
  (0, _createClass2.default)(MaskLayer, [{
62
+ key: "init",
63
+ value: function init() {
64
+ var _this2 = this;
65
+
66
+ // 设置配置项
67
+ var sceneId = this.container.get(_l7Core.TYPES.SceneID);
68
+ this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);
69
+ this.layerType = this.rawConfig.layerType;
70
+ this.rendererService = this.container.get(_l7Core.TYPES.IRendererService);
71
+ this.layerService = this.container.get(_l7Core.TYPES.ILayerService);
72
+ this.mapService = this.container.get(_l7Core.TYPES.IMapService);
73
+ this.cameraService = this.container.get(_l7Core.TYPES.ICameraService);
74
+ this.coordinateService = this.container.get(_l7Core.TYPES.ICoordinateSystemService);
75
+ this.shaderModuleService = this.container.get(_l7Core.TYPES.IShaderModuleService);
76
+ this.postProcessingPassFactory = this.container.get(_l7Core.TYPES.IFactoryPostProcessingPass);
77
+ this.normalPassFactory = this.container.get(_l7Core.TYPES.IFactoryNormalPass); // 图层容器服务
78
+
79
+ this.styleAttributeService = this.container.get(_l7Core.TYPES.IStyleAttributeService); // 完成样式服务注册完成前添加的属性
80
+
81
+ this.pendingStyleAttributes.forEach(function (_ref) {
82
+ var attributeName = _ref.attributeName,
83
+ attributeField = _ref.attributeField,
84
+ attributeValues = _ref.attributeValues,
85
+ updateOptions = _ref.updateOptions;
86
+
87
+ _this2.styleAttributeService.updateStyleAttribute(attributeName, {
88
+ // @ts-ignore
89
+ scale: (0, _objectSpread2.default)({
90
+ field: attributeField
91
+ }, _this2.splitValuesAndCallbackInAttribute( // @ts-ignore
92
+ attributeValues, // @ts-ignore
93
+ _this2.getLayerConfig()[attributeName]))
94
+ }, // @ts-ignore
95
+ updateOptions);
96
+ });
97
+ this.pendingStyleAttributes = []; // 获取插件集
98
+
99
+ this.plugins = this.container.getAll(_l7Core.TYPES.ILayerPlugin); // 完成插件注册,传入场景和图层容器内的服务
100
+
101
+ var _iterator = _createForOfIteratorHelper(this.plugins),
102
+ _step;
103
+
104
+ try {
105
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
106
+ var plugin = _step.value;
107
+ plugin.apply(this, {
108
+ rendererService: this.rendererService,
109
+ mapService: this.mapService,
110
+ styleAttributeService: this.styleAttributeService,
111
+ normalPassFactory: this.normalPassFactory,
112
+ postProcessingPassFactory: this.postProcessingPassFactory
113
+ });
114
+ } // 触发 init 生命周期插件
115
+
116
+ } catch (err) {
117
+ _iterator.e(err);
118
+ } finally {
119
+ _iterator.f();
120
+ }
121
+
122
+ this.hooks.init.call();
123
+ this.hooks.afterInit.call();
124
+ return this;
125
+ }
126
+ }, {
52
127
  key: "buildModels",
53
128
  value: function buildModels() {
54
- var _this2 = this;
129
+ var _this3 = this;
55
130
 
56
131
  var shape = this.getModelType();
57
132
  this.layerModel = new _models.default[shape](this);
58
133
  this.layerModel.initModels(function (models) {
59
- _this2.models = models;
134
+ _this3.models = models;
60
135
 
61
- _this2.renderLayers();
136
+ _this3.emit('modelLoaded', null);
62
137
  });
63
138
  }
64
139
  }, {
65
140
  key: "rebuildModels",
66
141
  value: function rebuildModels() {
67
- var _this3 = this;
142
+ var _this4 = this;
68
143
 
69
144
  this.layerModel.buildModels(function (models) {
70
- return _this3.models = models;
145
+ _this4.models = models;
146
+
147
+ _this4.emit('modelLoaded', null);
71
148
  });
72
149
  }
73
150
  }, {
@@ -23,6 +23,8 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
23
23
 
24
24
  var _l7Core = require("@antv/l7-core");
25
25
 
26
+ var _l7Utils = require("@antv/l7-utils");
27
+
26
28
  var _lodash = require("lodash");
27
29
 
28
30
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
@@ -33,11 +35,11 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
33
35
 
34
36
  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; } }
35
37
 
36
- /* babel-plugin-inline-import '../shaders/mask_frag.glsl' */
37
- var mask_frag = "uniform float u_opacity;\nvarying vec4 v_Color;\n\nvoid main() {\n gl_FragColor = v_Color;\n gl_FragColor.a *= u_opacity;\n}\n";
38
+ /* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
39
+ var mask_frag = "uniform float u_opacity : 1.0;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n gl_FragColor.a *= u_opacity;\n}\n";
38
40
 
39
41
  /* babel-plugin-inline-import '../shaders/mask_vert.glsl' */
40
- var mask_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n\nvoid main() {\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
42
+ var mask_vert = "attribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#pragma include \"projection\"\n\nvoid main() {\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
41
43
 
42
44
  var MaskModel = /*#__PURE__*/function (_BaseModel) {
43
45
  (0, _inherits2.default)(MaskModel, _BaseModel);
@@ -54,10 +56,13 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
54
56
  value: function getUninforms() {
55
57
  var _ref = this.layer.getLayerConfig(),
56
58
  _ref$opacity = _ref.opacity,
57
- opacity = _ref$opacity === void 0 ? 0 : _ref$opacity;
59
+ opacity = _ref$opacity === void 0 ? 0 : _ref$opacity,
60
+ _ref$color = _ref.color,
61
+ color = _ref$color === void 0 ? '#000' : _ref$color;
58
62
 
59
63
  return {
60
- u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 0.0
64
+ u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 0.0,
65
+ u_color: (0, _l7Utils.rgb2arr)(color)
61
66
  };
62
67
  }
63
68
  }, {
@@ -95,7 +100,8 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
95
100
  zfail: _l7Core.gl.REPLACE,
96
101
  zpass: _l7Core.gl.REPLACE
97
102
  }
98
- }
103
+ },
104
+ pick: false
99
105
  }).then(function (model) {
100
106
  callbackModel([model]);
101
107
  }).catch(function (err) {
@@ -120,10 +126,8 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
120
126
  }, {
121
127
  key: "clearModels",
122
128
  value: function clearModels() {
123
- var _this$dataTexture;
124
-
125
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
126
- this.layerService.clear();
129
+ var refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
130
+ refresh && this.layerService.clear();
127
131
  }
128
132
  }, {
129
133
  key: "registerBuiltinAttributes",
@@ -1,17 +1,11 @@
1
- attribute vec4 a_Color;
2
1
  attribute vec3 a_Position;
3
2
  uniform mat4 u_ModelMatrix;
4
3
  uniform mat4 u_Mvp;
5
4
 
6
- varying vec4 v_Color;
7
-
8
5
  #pragma include "projection"
9
6
 
10
7
  void main() {
11
-
12
- v_Color = a_Color;
13
8
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
14
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
15
9
 
16
10
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
17
11
  gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));