@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
@@ -25,6 +25,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
25
25
 
26
26
  var _baseTileLayer = _interopRequireDefault(require("./tileLayer/baseTileLayer"));
27
27
 
28
+ var _utils = require("./utils");
29
+
28
30
  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
31
 
30
32
  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; } }
@@ -98,18 +100,39 @@ var TMSTileLayer = /*#__PURE__*/function (_BaseTileLayer) {
98
100
 
99
101
  var _layers = _this2.tileLayerManager.getChilds(tile.layerIDList);
100
102
 
101
- _this2.tileLayerManager.updateLayersConfig(_layers, 'visible', tile.isVisible);
103
+ _this2.updateTileVisible(tile, _layers);
102
104
 
103
105
  _this2.setPickState(_layers);
104
106
  }
105
107
  });
106
- this.parent.renderLayers();
107
108
 
108
109
  if (this.tilesetManager.isLoaded) {
109
110
  // 将事件抛出,图层上可以使用瓦片
110
111
  this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
111
112
  }
112
113
  }
114
+ }, {
115
+ key: "emitTileVisibleEvent",
116
+ value: function emitTileVisibleEvent(tile, callback) {
117
+ if (tile.isVisible) {
118
+ callback();
119
+ } else {
120
+ (0, _utils.tileAllLoad)(tile, function () {
121
+ callback();
122
+ });
123
+ }
124
+ }
125
+ }, {
126
+ key: "updateTileVisible",
127
+ value: function updateTileVisible(tile, layers) {
128
+ var _this3 = this;
129
+
130
+ this.emitTileVisibleEvent(tile, function () {
131
+ _this3.tileLayerManager.updateLayersConfig(layers, 'visible', tile.isVisible);
132
+
133
+ _this3.layerService.reRender();
134
+ });
135
+ }
113
136
  }]);
114
137
  return TMSTileLayer;
115
138
  }(_baseTileLayer.default);
package/lib/tile/utils.js CHANGED
@@ -8,10 +8,14 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.getContainerSize = getContainerSize;
9
9
  exports.getLayerShape = getLayerShape;
10
10
  exports.getMaskValue = getMaskValue;
11
+ exports.isTileChildLoaded = isTileChildLoaded;
12
+ exports.isTileLoaded = isTileLoaded;
13
+ exports.isTileParentLoaded = isTileParentLoaded;
11
14
  exports.isVectorTile = isVectorTile;
12
15
  exports.readPixel = readPixel;
13
16
  exports.readRasterValue = readRasterValue;
14
17
  exports.registerLayers = registerLayers;
18
+ exports.tileAllLoad = tileAllLoad;
15
19
  exports.tileVectorParser = void 0;
16
20
 
17
21
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -155,4 +159,38 @@ function readPixel(x, y, rendererService) {
155
159
  data: new Uint8Array(1 * 1 * 4)
156
160
  });
157
161
  return pickedColors;
162
+ }
163
+
164
+ function isTileLoaded(tile) {
165
+ return tile.layerIDList.length === tile.loadedLayers;
166
+ }
167
+
168
+ function isTileChildLoaded(tile) {
169
+ var childs = tile.children;
170
+ return childs.filter(function (child) {
171
+ return isTileLoaded(child);
172
+ }).length === childs.length;
173
+ }
174
+
175
+ function isTileParentLoaded(tile) {
176
+ var parent = tile.parent;
177
+
178
+ if (!parent) {
179
+ return true;
180
+ } else {
181
+ return isTileLoaded(parent);
182
+ }
183
+ }
184
+
185
+ function tileAllLoad(tile, callback) {
186
+ var timer = window.setInterval(function () {
187
+ var tileLoaded = isTileLoaded(tile);
188
+ var tileChildLoaded = isTileChildLoaded(tile);
189
+ var tileParentLoaded = isTileParentLoaded(tile);
190
+
191
+ if (tileLoaded && tileChildLoaded && tileParentLoaded) {
192
+ callback();
193
+ window.clearInterval(timer);
194
+ }
195
+ }, 36);
158
196
  }
@@ -29,6 +29,9 @@ function registerStyleAttribute(fieldName, layer, field, values, updateOptions)
29
29
 
30
30
 
31
31
  function handleStyleDataMapping(configToUpdate, layer) {
32
+ // 瓦片图层不需要进行样式数据映射
33
+ if (layer.tileLayer || layer.isTileLayer) return;
34
+
32
35
  if (configToUpdate.opacity) {
33
36
  // 处理 style 中 opacity 属性的数据映射
34
37
  handleStyleFloat('opacity', layer, configToUpdate.opacity);
@@ -28,7 +28,7 @@ function adjustData2Amap2Coordinates(mappedData, mapService) {
28
28
  if (typeof mappedData[0].coordinates[0] === 'number') {
29
29
  // 单个的点数据
30
30
  // @ts-ignore
31
- mappedData // TODO: 避免经纬度被重复计算导致坐标位置偏移
31
+ mappedData // 避免经纬度被重复计算导致坐标位置偏移
32
32
  .filter(function (d) {
33
33
  return !d.originCoordinates;
34
34
  }).map(function (d) {
@@ -42,7 +42,7 @@ function adjustData2Amap2Coordinates(mappedData, mapService) {
42
42
  } else {
43
43
  // 连续的线、面数据
44
44
  // @ts-ignore
45
- mappedData // TODO: 避免经纬度被重复计算导致坐标位置偏移
45
+ mappedData // 避免经纬度被重复计算导致坐标位置偏移
46
46
  .filter(function (d) {
47
47
  return !d.originCoordinates;
48
48
  }).map(function (d) {
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.updateShape = updateShape;
7
- // TODO: shapeUpdateList 存储一系列的 shape 类型
7
+ // shapeUpdateList 存储一系列的 shape 类型
8
8
  // 当这一系列的 shape 相互切换的时候需要重构 layer 的 model (顶点数据集)
9
9
  var shapeUpdateList = [// PointLayer
10
10
  ['circle', 'cylinder'], ['square', 'cylinder'], ['triangle', 'cylinder'], ['pentagon', 'cylinder'], ['hexagon', 'cylinder'], ['octogon', 'cylinder'], ['hexagram', 'cylinder'], ['rhombus', 'cylinder'], ['vesica', 'cylinder']];
@@ -18,7 +18,7 @@ function updateShape(layer, lastShape, currentShape) {
18
18
 
19
19
  shapeUpdateList.map(function (shapes) {
20
20
  if (shapes.includes(lastShape) && shapes.includes(currentShape)) {
21
- // TODO: dataSourceNeedUpdate 借用数据更新时更新 layer model 的工作流
21
+ // dataSourceNeedUpdate 借用数据更新时更新 layer model 的工作流
22
22
  layer.dataState.dataSourceNeedUpdate = true;
23
23
  return;
24
24
  }
package/lib/wind/index.js CHANGED
@@ -58,7 +58,9 @@ var WindLayer = /*#__PURE__*/function (_BaseLayer) {
58
58
  this.layerModel.initModels(function (models) {
59
59
  _this2.models = models;
60
60
 
61
- _this2.renderLayers();
61
+ _this2.emit('modelLoaded', null);
62
+
63
+ _this2.layerService.throttleRenderLayers();
62
64
  });
63
65
  }
64
66
  }, {
@@ -67,7 +69,9 @@ var WindLayer = /*#__PURE__*/function (_BaseLayer) {
67
69
  var _this3 = this;
68
70
 
69
71
  this.layerModel.buildModels(function (models) {
70
- return _this3.models = models;
72
+ _this3.models = models;
73
+
74
+ _this3.emit('modelLoaded', null);
71
75
  });
72
76
  }
73
77
  }, {
@@ -39,7 +39,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
39
39
  var WindFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 color = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y));\n gl_FragColor = color;\n gl_FragColor.a *= u_opacity;\n}\n";
40
40
 
41
41
  /* babel-plugin-inline-import '../shaders/wind_vert.glsl' */
42
- var WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
42
+ var WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\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.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
43
43
  var defaultRampColors = {
44
44
  0.0: '#3288bd',
45
45
  0.1: '#66c2a5',
@@ -165,9 +165,7 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
165
165
  height: imageHeight
166
166
  });
167
167
 
168
- _this3.layerService.updateLayerRenderList();
169
-
170
- _this3.layerService.renderLayers();
168
+ _this3.layerService.reRender();
171
169
  });
172
170
  this.layer.buildLayerModel({
173
171
  moduleName: 'wind',
@@ -178,7 +176,9 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
178
176
  depth: {
179
177
  enable: false
180
178
  },
181
- blend: this.getBlend()
179
+ stencil: (0, _l7Utils.getMask)(mask, maskInside),
180
+ blend: this.getBlend(),
181
+ pick: false
182
182
  }).then(function (model) {
183
183
  _this3.colorModel = model;
184
184
  callbackModel([model]);
@@ -241,7 +241,7 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
241
241
  type: _l7Core.gl.FLOAT
242
242
  },
243
243
  size: 2,
244
- update: function update(feature, featureIdx, vertex, attributeIdx) {
244
+ update: function update(feature, featureIdx, vertex) {
245
245
  return [vertex[3], vertex[4]];
246
246
  }
247
247
  }
@@ -307,7 +307,7 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
307
307
  var _this$wind$draw = this.wind.draw(),
308
308
  d = _this$wind$draw.d,
309
309
  w = _this$wind$draw.w,
310
- h = _this$wind$draw.h; // TODO: 恢复 L7 渲染流程中 gl 状态
310
+ h = _this$wind$draw.h; // 恢复 L7 渲染流程中 gl 状态
311
311
 
312
312
 
313
313
  this.rendererService.setBaseState();
@@ -8,7 +8,7 @@ varying vec2 v_texCoord;
8
8
  void main() {
9
9
  v_texCoord = a_Uv;
10
10
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
11
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));
11
+
12
12
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
13
13
  gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));
14
14
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.9.27-alpha.2",
3
+ "version": "2.9.27-alpha.4",
4
4
  "description": "L7's collection of built-in layers",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -26,13 +26,14 @@
26
26
  "author": "xiaoiver",
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
- "@antv/async-hook": "^2.1.0",
30
- "@antv/l7-core": "2.9.27-alpha.2",
31
- "@antv/l7-maps": "2.9.27-alpha.2",
32
- "@antv/l7-source": "2.9.27-alpha.2",
33
- "@antv/l7-utils": "2.9.27-alpha.2",
29
+ "@antv/async-hook": "^2.2.2",
30
+ "@antv/l7-core": "2.9.27-alpha.4",
31
+ "@antv/l7-maps": "2.9.27-alpha.4",
32
+ "@antv/l7-source": "2.9.27-alpha.4",
33
+ "@antv/l7-utils": "2.9.27-alpha.4",
34
34
  "@babel/runtime": "^7.7.7",
35
35
  "@mapbox/martini": "^0.2.0",
36
+ "@turf/clone": "^6.5.0",
36
37
  "@turf/helpers": "^6.1.4",
37
38
  "@turf/meta": "^6.0.2",
38
39
  "@turf/polygon-to-line": "^6.5.0",
@@ -60,7 +61,7 @@
60
61
  "@types/gl-matrix": "^2.4.5",
61
62
  "@types/lodash": "^4.14.138"
62
63
  },
63
- "gitHead": "209f0b76af7ad1c7342f5ea21aa1c2179e8c460d",
64
+ "gitHead": "9e77012376360246d49d7b5392eecd16b43b9109",
64
65
  "publishConfig": {
65
66
  "access": "public"
66
67
  }
@@ -1,79 +0,0 @@
1
- #define LineTexture 1.0
2
- uniform float u_blur : 0.99;
3
- uniform float u_opacity : 1.0;
4
- uniform float u_textureBlend;
5
-
6
- uniform float u_borderWidth: 0.0;
7
- uniform vec4 u_borderColor;
8
- varying vec4 v_color;
9
-
10
- // line texture
11
- uniform float u_line_texture;
12
- uniform sampler2D u_texture;
13
- uniform vec2 u_textSize;
14
-
15
- varying vec2 v_iconMapUV;
16
-
17
- #pragma include "picking"
18
-
19
- varying mat4 styleMappingMat;
20
-
21
- void main() {
22
- float opacity = styleMappingMat[0][0];
23
- float d_distance_ratio = styleMappingMat[3].r; // 当前点位距离占线总长的比例
24
- gl_FragColor = v_color;
25
- // anti-alias
26
- // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));
27
- gl_FragColor.a *= opacity; // 全局透明度
28
-
29
-
30
- if(u_line_texture == LineTexture) { // while load texture
31
- float aDistance = styleMappingMat[3].g; // 当前顶点的距离
32
- float d_texPixelLen = styleMappingMat[3].b; // 贴图的像素长度,根据地图层级缩放
33
- float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen);
34
- float v = styleMappingMat[3].a; // 线图层贴图部分的 v 坐标值
35
-
36
- // v = max(smoothstep(0.95, 1.0, v), v);
37
- vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
38
-
39
- // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));
40
- // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));
41
- vec4 pattern = texture2D(u_texture, uv);
42
-
43
- if(u_textureBlend == 0.0) { // normal
44
- pattern.a = 0.0;
45
- gl_FragColor += pattern;
46
- } else { // replace
47
- pattern.a *= opacity;
48
- if(gl_FragColor.a <= 0.0) {
49
- pattern.a = 0.0;
50
- }
51
- gl_FragColor = pattern;
52
- }
53
- }
54
-
55
- float v = styleMappingMat[3].a;
56
- float borderWidth = min(0.5, u_borderWidth);
57
- // 绘制 border
58
- if(borderWidth > 0.01) {
59
- float borderOuterWidth = borderWidth/2.0;
60
-
61
- if(v >= 1.0 - borderWidth || v <= borderWidth) {
62
- if(v > borderWidth) {
63
- float linear = smoothstep(0.0, 1.0, (v - (1.0 - borderWidth))/borderWidth);
64
- gl_FragColor.rgb = mix(gl_FragColor.rgb, u_borderColor.rgb, linear);
65
- } else if(v <= borderWidth) {
66
- float linear = smoothstep(0.0, 1.0, v/borderWidth);
67
- gl_FragColor.rgb = mix(u_borderColor.rgb, gl_FragColor.rgb, linear);
68
- }
69
- }
70
-
71
- if(v < borderOuterWidth) {
72
- gl_FragColor.a = mix(0.0, gl_FragColor.a, v/borderOuterWidth);
73
- } else if(v > 1.0 - borderOuterWidth) {
74
- gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);
75
- }
76
- }
77
-
78
- gl_FragColor = filterColor(gl_FragColor);
79
- }
@@ -1,111 +0,0 @@
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
-
10
- attribute float a_Total_Distance;
11
- attribute float a_Distance;
12
-
13
- uniform mat4 u_ModelMatrix;
14
- uniform mat4 u_Mvp;
15
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
16
- uniform float u_icon_step: 100;
17
- uniform float u_heightfixed;
18
-
19
- #pragma include "projection"
20
- #pragma include "light"
21
- #pragma include "picking"
22
-
23
- varying vec4 v_color;
24
- varying float v_blur;
25
-
26
- // texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
27
- varying vec2 v_iconMapUV;
28
-
29
- uniform float u_linearColor: 0;
30
-
31
- uniform float u_opacity: 1.0;
32
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
33
-
34
- #pragma include "styleMapping"
35
- #pragma include "light"
36
- #pragma include "styleMappingCalOpacity"
37
-
38
- void main() {
39
- // cal style mapping - 数据纹理映射部分的计算
40
- styleMappingMat = mat4(
41
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
42
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
43
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
44
- 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV
45
- );
46
-
47
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
48
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
49
- float columnWidth = 1.0/columnCount; // 列宽
50
- float rowHeight = 1.0/rowCount; // 行高
51
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
52
- float id = a_vertexId; // 第n个顶点
53
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
54
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
55
-
56
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
57
- // 按顺序从 cell 中取值、若没有则自动往下取值
58
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
59
-
60
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
61
- styleMappingMat[0][0] = opacityAndOffset.r;
62
- textureOffset = opacityAndOffset.g;
63
- // cal style mapping - 数据纹理映射部分的计算
64
-
65
- float d_distance_ratio; // 当前点位距离占线总长的比例
66
- float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
67
-
68
- v_iconMapUV = a_iconMapUV;
69
- if(u_heightfixed < 1.0) { // 高度随 zoom 调整
70
- d_texPixelLen = project_pixel(u_icon_step);
71
- } else {
72
- d_texPixelLen = u_icon_step;
73
- }
74
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
75
- d_texPixelLen *= 10.0;
76
- }
77
-
78
- if(u_aimate.x == Animate || u_linearColor == 1.0) {
79
- d_distance_ratio = a_Distance / a_Total_Distance;
80
- }
81
-
82
- float miter = (a_Miter + 1.0)/2.0;
83
- // 设置数据集的参数
84
- styleMappingMat[3][0] = d_distance_ratio; // 当前点位距离占线总长的比例
85
- styleMappingMat[3][1] = a_Distance; // 当前顶点的距离
86
- styleMappingMat[3][2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
87
- styleMappingMat[3][3] = miter; // 线图层贴图部分的 v 坐标值 0 - 1
88
-
89
- vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
90
-
91
- float originSize = a_Size.x; // 固定高度
92
- if(u_heightfixed < 1.0) { // 高度随 zoom 调整
93
- originSize = project_float_pixel(a_Size.x);
94
- }
95
-
96
- float wallHeight = originSize * miter;
97
- float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));
98
-
99
- v_blur = min(project_float_pixel(2.0) / originSize, 0.05);
100
-
101
- v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);
102
- // v_color = a_Color;
103
-
104
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
105
- gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));
106
- } else {
107
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
108
- }
109
-
110
- setPickingColor(a_PickingColor);
111
- }
@@ -1,7 +0,0 @@
1
- uniform float u_opacity;
2
- varying vec4 v_Color;
3
-
4
- void main() {
5
- gl_FragColor = v_Color;
6
- gl_FragColor.a *= u_opacity;
7
- }
@@ -1,12 +0,0 @@
1
- uniform float u_opacity: 1.0;
2
- varying vec4 v_Color;
3
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
4
-
5
- #pragma include "picking"
6
-
7
- void main() {
8
- float opacity = styleMappingMat[0][0];
9
- gl_FragColor = v_Color;
10
- gl_FragColor.a *= opacity;
11
- gl_FragColor = filterColor(gl_FragColor);
12
- }
@@ -1,79 +0,0 @@
1
- #define LineTexture 1.0
2
- uniform float u_blur : 0.99;
3
- uniform float u_opacity : 1.0;
4
- uniform float u_textureBlend;
5
-
6
- uniform float u_borderWidth: 0.0;
7
- uniform vec4 u_borderColor;
8
- varying vec4 v_color;
9
-
10
- // line texture
11
- uniform float u_line_texture;
12
- uniform sampler2D u_texture;
13
- uniform vec2 u_textSize;
14
-
15
- varying vec2 v_iconMapUV;
16
-
17
- #pragma include "picking"
18
-
19
- varying mat4 styleMappingMat;
20
-
21
- void main() {
22
- float opacity = styleMappingMat[0][0];
23
- float d_distance_ratio = styleMappingMat[3].r; // 当前点位距离占线总长的比例
24
- gl_FragColor = v_color;
25
- // anti-alias
26
- // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));
27
- gl_FragColor.a *= opacity; // 全局透明度
28
-
29
-
30
- if(u_line_texture == LineTexture) { // while load texture
31
- float aDistance = styleMappingMat[3].g; // 当前顶点的距离
32
- float d_texPixelLen = styleMappingMat[3].b; // 贴图的像素长度,根据地图层级缩放
33
- float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen);
34
- float v = styleMappingMat[3].a; // 线图层贴图部分的 v 坐标值
35
-
36
- // v = max(smoothstep(0.95, 1.0, v), v);
37
- vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
38
-
39
- // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));
40
- // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));
41
- vec4 pattern = texture2D(u_texture, uv);
42
-
43
- if(u_textureBlend == 0.0) { // normal
44
- pattern.a = 0.0;
45
- gl_FragColor += pattern;
46
- } else { // replace
47
- pattern.a *= opacity;
48
- if(gl_FragColor.a <= 0.0) {
49
- pattern.a = 0.0;
50
- }
51
- gl_FragColor = pattern;
52
- }
53
- }
54
-
55
- float v = styleMappingMat[3].a;
56
- float borderWidth = min(0.5, u_borderWidth);
57
- // 绘制 border
58
- if(borderWidth > 0.01) {
59
- float borderOuterWidth = borderWidth/2.0;
60
-
61
- if(v >= 1.0 - borderWidth || v <= borderWidth) {
62
- if(v > borderWidth) {
63
- float linear = smoothstep(0.0, 1.0, (v - (1.0 - borderWidth))/borderWidth);
64
- gl_FragColor.rgb = mix(gl_FragColor.rgb, u_borderColor.rgb, linear);
65
- } else if(v <= borderWidth) {
66
- float linear = smoothstep(0.0, 1.0, v/borderWidth);
67
- gl_FragColor.rgb = mix(u_borderColor.rgb, gl_FragColor.rgb, linear);
68
- }
69
- }
70
-
71
- if(v < borderOuterWidth) {
72
- gl_FragColor.a = mix(0.0, gl_FragColor.a, v/borderOuterWidth);
73
- } else if(v > 1.0 - borderOuterWidth) {
74
- gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);
75
- }
76
- }
77
-
78
- gl_FragColor = filterColor(gl_FragColor);
79
- }
@@ -1,111 +0,0 @@
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
-
10
- attribute float a_Total_Distance;
11
- attribute float a_Distance;
12
-
13
- uniform mat4 u_ModelMatrix;
14
- uniform mat4 u_Mvp;
15
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
16
- uniform float u_icon_step: 100;
17
- uniform float u_heightfixed;
18
-
19
- #pragma include "projection"
20
- #pragma include "light"
21
- #pragma include "picking"
22
-
23
- varying vec4 v_color;
24
- varying float v_blur;
25
-
26
- // texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
27
- varying vec2 v_iconMapUV;
28
-
29
- uniform float u_linearColor: 0;
30
-
31
- uniform float u_opacity: 1.0;
32
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
33
-
34
- #pragma include "styleMapping"
35
- #pragma include "light"
36
- #pragma include "styleMappingCalOpacity"
37
-
38
- void main() {
39
- // cal style mapping - 数据纹理映射部分的计算
40
- styleMappingMat = mat4(
41
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
42
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
43
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
44
- 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV
45
- );
46
-
47
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
48
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
49
- float columnWidth = 1.0/columnCount; // 列宽
50
- float rowHeight = 1.0/rowCount; // 行高
51
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
52
- float id = a_vertexId; // 第n个顶点
53
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
54
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
55
-
56
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
57
- // 按顺序从 cell 中取值、若没有则自动往下取值
58
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
59
-
60
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
61
- styleMappingMat[0][0] = opacityAndOffset.r;
62
- textureOffset = opacityAndOffset.g;
63
- // cal style mapping - 数据纹理映射部分的计算
64
-
65
- float d_distance_ratio; // 当前点位距离占线总长的比例
66
- float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
67
-
68
- v_iconMapUV = a_iconMapUV;
69
- if(u_heightfixed < 1.0) { // 高度随 zoom 调整
70
- d_texPixelLen = project_pixel(u_icon_step);
71
- } else {
72
- d_texPixelLen = u_icon_step;
73
- }
74
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
75
- d_texPixelLen *= 10.0;
76
- }
77
-
78
- if(u_aimate.x == Animate || u_linearColor == 1.0) {
79
- d_distance_ratio = a_Distance / a_Total_Distance;
80
- }
81
-
82
- float miter = (a_Miter + 1.0)/2.0;
83
- // 设置数据集的参数
84
- styleMappingMat[3][0] = d_distance_ratio; // 当前点位距离占线总长的比例
85
- styleMappingMat[3][1] = a_Distance; // 当前顶点的距离
86
- styleMappingMat[3][2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
87
- styleMappingMat[3][3] = miter; // 线图层贴图部分的 v 坐标值 0 - 1
88
-
89
- vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
90
-
91
- float originSize = a_Size.x; // 固定高度
92
- if(u_heightfixed < 1.0) { // 高度随 zoom 调整
93
- originSize = project_float_pixel(a_Size.x);
94
- }
95
-
96
- float wallHeight = originSize * miter;
97
- float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));
98
-
99
- v_blur = min(project_float_pixel(2.0) / originSize, 0.05);
100
-
101
- v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);
102
- // v_color = a_Color;
103
-
104
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
105
- gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));
106
- } else {
107
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
108
- }
109
-
110
- setPickingColor(a_PickingColor);
111
- }