@antv/l7-layers 2.9.18 → 2.9.19

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 (354) hide show
  1. package/es/Geometry/index.js +12 -2
  2. package/es/Geometry/index.js.map +1 -1
  3. package/es/Geometry/models/billboard.d.ts +3 -3
  4. package/es/Geometry/models/billboard.js +11 -6
  5. package/es/Geometry/models/billboard.js.map +1 -1
  6. package/es/Geometry/models/plane.d.ts +3 -3
  7. package/es/Geometry/models/plane.js +12 -7
  8. package/es/Geometry/models/plane.js.map +1 -1
  9. package/es/Geometry/models/sprite.d.ts +3 -3
  10. package/es/Geometry/models/sprite.js +11 -6
  11. package/es/Geometry/models/sprite.js.map +1 -1
  12. package/es/canvas/index.js +12 -2
  13. package/es/canvas/index.js.map +1 -1
  14. package/es/citybuliding/building.js +12 -2
  15. package/es/citybuliding/building.js.map +1 -1
  16. package/es/citybuliding/models/build.d.ts +2 -1
  17. package/es/citybuliding/models/build.js +16 -3
  18. package/es/citybuliding/models/build.js.map +1 -1
  19. package/es/core/BaseLayer.d.ts +1 -1
  20. package/es/core/BaseLayer.js +105 -62
  21. package/es/core/BaseLayer.js.map +1 -1
  22. package/es/core/BaseModel.d.ts +2 -2
  23. package/es/core/BaseModel.js +2 -2
  24. package/es/core/BaseModel.js.map +1 -1
  25. package/es/core/interface.d.ts +2 -0
  26. package/es/core/interface.js.map +1 -1
  27. package/es/core/triangulation.js +1 -2
  28. package/es/core/triangulation.js.map +1 -1
  29. package/es/earth/index.js +8 -2
  30. package/es/earth/index.js.map +1 -1
  31. package/es/earth/models/atmosphere.d.ts +2 -2
  32. package/es/earth/models/atmosphere.js +11 -6
  33. package/es/earth/models/atmosphere.js.map +1 -1
  34. package/es/earth/models/base.d.ts +2 -2
  35. package/es/earth/models/base.js +11 -6
  36. package/es/earth/models/base.js.map +1 -1
  37. package/es/earth/models/bloomsphere.d.ts +2 -2
  38. package/es/earth/models/bloomsphere.js +11 -6
  39. package/es/earth/models/bloomsphere.js.map +1 -1
  40. package/es/heatmap/index.js +17 -5
  41. package/es/heatmap/index.js.map +1 -1
  42. package/es/heatmap/models/grid.d.ts +2 -2
  43. package/es/heatmap/models/grid.js +12 -8
  44. package/es/heatmap/models/grid.js.map +1 -1
  45. package/es/heatmap/models/grid3d.d.ts +2 -2
  46. package/es/heatmap/models/grid3d.js +12 -6
  47. package/es/heatmap/models/grid3d.js.map +1 -1
  48. package/es/heatmap/models/heatmap.d.ts +2 -2
  49. package/es/heatmap/models/heatmap.js +112 -62
  50. package/es/heatmap/models/heatmap.js.map +1 -1
  51. package/es/heatmap/models/hexagon.d.ts +2 -2
  52. package/es/heatmap/models/hexagon.js +11 -6
  53. package/es/heatmap/models/hexagon.js.map +1 -1
  54. package/es/image/index.js +12 -2
  55. package/es/image/index.js.map +1 -1
  56. package/es/image/models/dataImage.d.ts +3 -3
  57. package/es/image/models/dataImage.js +10 -5
  58. package/es/image/models/dataImage.js.map +1 -1
  59. package/es/image/models/image.d.ts +3 -3
  60. package/es/image/models/image.js +11 -7
  61. package/es/image/models/image.js.map +1 -1
  62. package/es/line/index.d.ts +0 -2
  63. package/es/line/index.js +12 -5
  64. package/es/line/index.js.map +1 -1
  65. package/es/line/models/arc.d.ts +2 -2
  66. package/es/line/models/arc.js +14 -9
  67. package/es/line/models/arc.js.map +1 -1
  68. package/es/line/models/arc_3d.d.ts +2 -2
  69. package/es/line/models/arc_3d.js +13 -8
  70. package/es/line/models/arc_3d.js.map +1 -1
  71. package/es/line/models/earthArc_3d.d.ts +2 -2
  72. package/es/line/models/earthArc_3d.js +17 -9
  73. package/es/line/models/earthArc_3d.js.map +1 -1
  74. package/es/line/models/great_circle.d.ts +2 -2
  75. package/es/line/models/great_circle.js +11 -6
  76. package/es/line/models/great_circle.js.map +1 -1
  77. package/es/line/models/half.d.ts +2 -2
  78. package/es/line/models/half.js +46 -29
  79. package/es/line/models/half.js.map +1 -1
  80. package/es/line/models/index.d.ts +1 -1
  81. package/es/line/models/index.js +0 -2
  82. package/es/line/models/index.js.map +1 -1
  83. package/es/line/models/line.d.ts +2 -2
  84. package/es/line/models/line.js +27 -15
  85. package/es/line/models/line.js.map +1 -1
  86. package/es/line/models/linearline.d.ts +2 -11
  87. package/es/line/models/linearline.js +14 -24
  88. package/es/line/models/linearline.js.map +1 -1
  89. package/es/line/models/simpleLine.d.ts +2 -2
  90. package/es/line/models/simpleLine.js +13 -8
  91. package/es/line/models/simpleLine.js.map +1 -1
  92. package/es/line/models/tile.d.ts +2 -11
  93. package/es/line/models/tile.js +45 -39
  94. package/es/line/models/tile.js.map +1 -1
  95. package/es/line/models/wall.d.ts +2 -2
  96. package/es/line/models/wall.js +13 -9
  97. package/es/line/models/wall.js.map +1 -1
  98. package/es/mask/index.js +12 -2
  99. package/es/mask/index.js.map +1 -1
  100. package/es/mask/models/fill.d.ts +2 -2
  101. package/es/mask/models/fill.js +53 -27
  102. package/es/mask/models/fill.js.map +1 -1
  103. package/es/plugins/DataMappingPlugin.js +29 -8
  104. package/es/plugins/DataMappingPlugin.js.map +1 -1
  105. package/es/plugins/DataSourcePlugin.js +14 -5
  106. package/es/plugins/DataSourcePlugin.js.map +1 -1
  107. package/es/plugins/LayerModelPlugin.d.ts +2 -0
  108. package/es/plugins/LayerModelPlugin.js +35 -7
  109. package/es/plugins/LayerModelPlugin.js.map +1 -1
  110. package/es/plugins/PixelPickingPlugin.js +16 -13
  111. package/es/plugins/PixelPickingPlugin.js.map +1 -1
  112. package/es/point/index.d.ts +1 -1
  113. package/es/point/index.js +26 -15
  114. package/es/point/index.js.map +1 -1
  115. package/es/point/models/earthExtrude.d.ts +2 -2
  116. package/es/point/models/earthExtrude.js +16 -14
  117. package/es/point/models/earthExtrude.js.map +1 -1
  118. package/es/point/models/earthFill.d.ts +2 -11
  119. package/es/point/models/earthFill.js +13 -22
  120. package/es/point/models/earthFill.js.map +1 -1
  121. package/es/point/models/extrude.d.ts +2 -2
  122. package/es/point/models/extrude.js +49 -27
  123. package/es/point/models/extrude.js.map +1 -1
  124. package/es/point/models/fill.d.ts +2 -2
  125. package/es/point/models/fill.js +59 -41
  126. package/es/point/models/fill.js.map +1 -1
  127. package/es/point/models/fillmage.d.ts +2 -7
  128. package/es/point/models/fillmage.js +13 -22
  129. package/es/point/models/fillmage.js.map +1 -1
  130. package/es/point/models/image.d.ts +2 -2
  131. package/es/point/models/image.js +11 -6
  132. package/es/point/models/image.js.map +1 -1
  133. package/es/point/models/index.d.ts +1 -1
  134. package/es/point/models/index.js +0 -2
  135. package/es/point/models/index.js.map +1 -1
  136. package/es/point/models/normal.d.ts +2 -2
  137. package/es/point/models/normal.js +11 -6
  138. package/es/point/models/normal.js.map +1 -1
  139. package/es/point/models/radar.d.ts +2 -11
  140. package/es/point/models/radar.js +13 -22
  141. package/es/point/models/radar.js.map +1 -1
  142. package/es/point/models/simplePoint.d.ts +2 -2
  143. package/es/point/models/simplePoint.js +11 -6
  144. package/es/point/models/simplePoint.js.map +1 -1
  145. package/es/point/models/text.d.ts +3 -2
  146. package/es/point/models/text.js +110 -75
  147. package/es/point/models/text.js.map +1 -1
  148. package/es/point/models/tile.d.ts +2 -11
  149. package/es/point/models/tile.js +22 -25
  150. package/es/point/models/tile.js.map +1 -1
  151. package/es/polygon/index.js +12 -2
  152. package/es/polygon/index.js.map +1 -1
  153. package/es/polygon/models/extrude.d.ts +2 -2
  154. package/es/polygon/models/extrude.js +10 -5
  155. package/es/polygon/models/extrude.js.map +1 -1
  156. package/es/polygon/models/fill.d.ts +2 -2
  157. package/es/polygon/models/fill.js +27 -13
  158. package/es/polygon/models/fill.js.map +1 -1
  159. package/es/polygon/models/ocean.d.ts +2 -2
  160. package/es/polygon/models/ocean.js +12 -6
  161. package/es/polygon/models/ocean.js.map +1 -1
  162. package/es/polygon/models/tile.d.ts +2 -3
  163. package/es/polygon/models/tile.js +17 -27
  164. package/es/polygon/models/tile.js.map +1 -1
  165. package/es/polygon/models/water.d.ts +2 -2
  166. package/es/polygon/models/water.js +12 -6
  167. package/es/polygon/models/water.js.map +1 -1
  168. package/es/raster/index.js +12 -2
  169. package/es/raster/index.js.map +1 -1
  170. package/es/raster/models/raster.d.ts +3 -3
  171. package/es/raster/models/raster.js +11 -7
  172. package/es/raster/models/raster.js.map +1 -1
  173. package/es/tile/manager/tileLayerManager.js +3 -0
  174. package/es/tile/manager/tileLayerManager.js.map +1 -1
  175. package/es/tile/manager/tilePickerManager.js +1 -0
  176. package/es/tile/manager/tilePickerManager.js.map +1 -1
  177. package/es/tile/tileFactory/base.js.map +1 -1
  178. package/es/tile/tileFactory/point.js.map +1 -1
  179. package/es/tile/tileFactory/rasterDataLayer.js +12 -2
  180. package/es/tile/tileFactory/rasterDataLayer.js.map +1 -1
  181. package/es/tile/tileFactory/vectorLayer.js +12 -2
  182. package/es/tile/tileFactory/vectorLayer.js.map +1 -1
  183. package/es/wind/index.js +12 -2
  184. package/es/wind/index.js.map +1 -1
  185. package/es/wind/models/wind.d.ts +4 -2
  186. package/es/wind/models/wind.js +50 -18
  187. package/es/wind/models/wind.js.map +1 -1
  188. package/es/wind/models/windRender.js +1 -1
  189. package/es/wind/models/windRender.js.map +1 -1
  190. package/lib/Geometry/index.js +12 -2
  191. package/lib/Geometry/index.js.map +1 -1
  192. package/lib/Geometry/models/billboard.js +11 -6
  193. package/lib/Geometry/models/billboard.js.map +1 -1
  194. package/lib/Geometry/models/plane.js +12 -7
  195. package/lib/Geometry/models/plane.js.map +1 -1
  196. package/lib/Geometry/models/sprite.js +11 -6
  197. package/lib/Geometry/models/sprite.js.map +1 -1
  198. package/lib/canvas/index.js +12 -2
  199. package/lib/canvas/index.js.map +1 -1
  200. package/lib/citybuliding/building.js +12 -2
  201. package/lib/citybuliding/building.js.map +1 -1
  202. package/lib/citybuliding/models/build.js +16 -3
  203. package/lib/citybuliding/models/build.js.map +1 -1
  204. package/lib/core/BaseLayer.js +104 -61
  205. package/lib/core/BaseLayer.js.map +1 -1
  206. package/lib/core/BaseModel.js +2 -2
  207. package/lib/core/BaseModel.js.map +1 -1
  208. package/lib/core/interface.js.map +1 -1
  209. package/lib/core/triangulation.js +4 -6
  210. package/lib/core/triangulation.js.map +1 -1
  211. package/lib/earth/index.js +8 -2
  212. package/lib/earth/index.js.map +1 -1
  213. package/lib/earth/models/atmosphere.js +11 -6
  214. package/lib/earth/models/atmosphere.js.map +1 -1
  215. package/lib/earth/models/base.js +11 -6
  216. package/lib/earth/models/base.js.map +1 -1
  217. package/lib/earth/models/bloomsphere.js +11 -6
  218. package/lib/earth/models/bloomsphere.js.map +1 -1
  219. package/lib/heatmap/index.js +17 -5
  220. package/lib/heatmap/index.js.map +1 -1
  221. package/lib/heatmap/models/grid.js +12 -8
  222. package/lib/heatmap/models/grid.js.map +1 -1
  223. package/lib/heatmap/models/grid3d.js +12 -6
  224. package/lib/heatmap/models/grid3d.js.map +1 -1
  225. package/lib/heatmap/models/heatmap.js +113 -62
  226. package/lib/heatmap/models/heatmap.js.map +1 -1
  227. package/lib/heatmap/models/hexagon.js +11 -6
  228. package/lib/heatmap/models/hexagon.js.map +1 -1
  229. package/lib/image/index.js +12 -2
  230. package/lib/image/index.js.map +1 -1
  231. package/lib/image/models/dataImage.js +10 -5
  232. package/lib/image/models/dataImage.js.map +1 -1
  233. package/lib/image/models/image.js +11 -7
  234. package/lib/image/models/image.js.map +1 -1
  235. package/lib/line/index.js +12 -5
  236. package/lib/line/index.js.map +1 -1
  237. package/lib/line/models/arc.js +14 -9
  238. package/lib/line/models/arc.js.map +1 -1
  239. package/lib/line/models/arc_3d.js +13 -8
  240. package/lib/line/models/arc_3d.js.map +1 -1
  241. package/lib/line/models/earthArc_3d.js +17 -9
  242. package/lib/line/models/earthArc_3d.js.map +1 -1
  243. package/lib/line/models/great_circle.js +11 -6
  244. package/lib/line/models/great_circle.js.map +1 -1
  245. package/lib/line/models/half.js +48 -29
  246. package/lib/line/models/half.js.map +1 -1
  247. package/lib/line/models/index.js +0 -3
  248. package/lib/line/models/index.js.map +1 -1
  249. package/lib/line/models/line.js +28 -17
  250. package/lib/line/models/line.js.map +1 -1
  251. package/lib/line/models/linearline.js +14 -24
  252. package/lib/line/models/linearline.js.map +1 -1
  253. package/lib/line/models/simpleLine.js +13 -8
  254. package/lib/line/models/simpleLine.js.map +1 -1
  255. package/lib/line/models/tile.js +47 -39
  256. package/lib/line/models/tile.js.map +1 -1
  257. package/lib/line/models/wall.js +13 -9
  258. package/lib/line/models/wall.js.map +1 -1
  259. package/lib/mask/index.js +12 -2
  260. package/lib/mask/index.js.map +1 -1
  261. package/lib/mask/models/fill.js +55 -27
  262. package/lib/mask/models/fill.js.map +1 -1
  263. package/lib/plugins/DataMappingPlugin.js +29 -8
  264. package/lib/plugins/DataMappingPlugin.js.map +1 -1
  265. package/lib/plugins/DataSourcePlugin.js +13 -4
  266. package/lib/plugins/DataSourcePlugin.js.map +1 -1
  267. package/lib/plugins/LayerModelPlugin.js +35 -7
  268. package/lib/plugins/LayerModelPlugin.js.map +1 -1
  269. package/lib/plugins/PixelPickingPlugin.js +16 -13
  270. package/lib/plugins/PixelPickingPlugin.js.map +1 -1
  271. package/lib/point/index.js +26 -15
  272. package/lib/point/index.js.map +1 -1
  273. package/lib/point/models/earthExtrude.js +16 -15
  274. package/lib/point/models/earthExtrude.js.map +1 -1
  275. package/lib/point/models/earthFill.js +13 -22
  276. package/lib/point/models/earthFill.js.map +1 -1
  277. package/lib/point/models/extrude.js +51 -28
  278. package/lib/point/models/extrude.js.map +1 -1
  279. package/lib/point/models/fill.js +61 -42
  280. package/lib/point/models/fill.js.map +1 -1
  281. package/lib/point/models/fillmage.js +13 -22
  282. package/lib/point/models/fillmage.js.map +1 -1
  283. package/lib/point/models/image.js +11 -6
  284. package/lib/point/models/image.js.map +1 -1
  285. package/lib/point/models/index.js +0 -3
  286. package/lib/point/models/index.js.map +1 -1
  287. package/lib/point/models/normal.js +11 -6
  288. package/lib/point/models/normal.js.map +1 -1
  289. package/lib/point/models/radar.js +13 -22
  290. package/lib/point/models/radar.js.map +1 -1
  291. package/lib/point/models/simplePoint.js +11 -6
  292. package/lib/point/models/simplePoint.js.map +1 -1
  293. package/lib/point/models/text.js +112 -78
  294. package/lib/point/models/text.js.map +1 -1
  295. package/lib/point/models/tile.js +22 -25
  296. package/lib/point/models/tile.js.map +1 -1
  297. package/lib/polygon/index.js +12 -2
  298. package/lib/polygon/index.js.map +1 -1
  299. package/lib/polygon/models/extrude.js +10 -5
  300. package/lib/polygon/models/extrude.js.map +1 -1
  301. package/lib/polygon/models/fill.js +25 -11
  302. package/lib/polygon/models/fill.js.map +1 -1
  303. package/lib/polygon/models/ocean.js +12 -6
  304. package/lib/polygon/models/ocean.js.map +1 -1
  305. package/lib/polygon/models/tile.js +17 -27
  306. package/lib/polygon/models/tile.js.map +1 -1
  307. package/lib/polygon/models/water.js +12 -6
  308. package/lib/polygon/models/water.js.map +1 -1
  309. package/lib/raster/index.js +12 -2
  310. package/lib/raster/index.js.map +1 -1
  311. package/lib/raster/models/raster.js +11 -7
  312. package/lib/raster/models/raster.js.map +1 -1
  313. package/lib/tile/manager/tileLayerManager.js +3 -0
  314. package/lib/tile/manager/tileLayerManager.js.map +1 -1
  315. package/lib/tile/manager/tilePickerManager.js +1 -0
  316. package/lib/tile/manager/tilePickerManager.js.map +1 -1
  317. package/lib/tile/tileFactory/base.js.map +1 -1
  318. package/lib/tile/tileFactory/point.js.map +1 -1
  319. package/lib/tile/tileFactory/rasterDataLayer.js +12 -2
  320. package/lib/tile/tileFactory/rasterDataLayer.js.map +1 -1
  321. package/lib/tile/tileFactory/vectorLayer.js +12 -2
  322. package/lib/tile/tileFactory/vectorLayer.js.map +1 -1
  323. package/lib/wind/index.js +12 -2
  324. package/lib/wind/index.js.map +1 -1
  325. package/lib/wind/models/wind.js +49 -18
  326. package/lib/wind/models/wind.js.map +1 -1
  327. package/lib/wind/models/windRender.js +1 -1
  328. package/lib/wind/models/windRender.js.map +1 -1
  329. package/package.json +9 -8
  330. package/es/line/models/arcmini.d.ts +0 -9
  331. package/es/line/models/arcmini.js +0 -145
  332. package/es/line/models/arcmini.js.map +0 -1
  333. package/es/point/models/icon-font.d.ts +0 -11
  334. package/es/point/models/icon-font.js +0 -181
  335. package/es/point/models/icon-font.js.map +0 -1
  336. package/es/raster/image.d.ts +0 -0
  337. package/es/raster/image.js +0 -2
  338. package/es/raster/image.js.map +0 -1
  339. package/es/raster/raster2d.d.ts +0 -27
  340. package/es/raster/raster2d.js +0 -158
  341. package/es/raster/raster2d.js.map +0 -1
  342. package/es/utils/geo.d.ts +0 -12
  343. package/es/utils/geo.js +0 -53
  344. package/es/utils/geo.js.map +0 -1
  345. package/lib/line/models/arcmini.js +0 -161
  346. package/lib/line/models/arcmini.js.map +0 -1
  347. package/lib/point/models/icon-font.js +0 -196
  348. package/lib/point/models/icon-font.js.map +0 -1
  349. package/lib/raster/image.js +0 -2
  350. package/lib/raster/image.js.map +0 -1
  351. package/lib/raster/raster2d.js +0 -172
  352. package/lib/raster/raster2d.js.map +0 -1
  353. package/lib/utils/geo.js +0 -65
  354. package/lib/utils/geo.js.map +0 -1
@@ -1,7 +1,6 @@
1
1
  import LineTileModel from '../../tile/models/tileModel';
2
2
  import ArcModel from './arc';
3
3
  import Arc3DModel from './arc_3d';
4
- import ArcMiniModel from './arcmini';
5
4
  import EarthArc3DModel from './earthArc_3d';
6
5
  import GreatCircleModel from './great_circle';
7
6
  import LineHalfModel from './half';
@@ -12,7 +11,6 @@ import TileLineModel from './tile';
12
11
  import LineWallModel from './wall';
13
12
  var LineModels = {
14
13
  arc: ArcModel,
15
- arcmini: ArcMiniModel,
16
14
  arc3d: Arc3DModel,
17
15
  greatcircle: GreatCircleModel,
18
16
  wall: LineWallModel,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/line/models/index.ts"],"names":["LineTileModel","ArcModel","Arc3DModel","ArcMiniModel","EarthArc3DModel","GreatCircleModel","LineHalfModel","LineModel","LinearLine","SimpleLineModel","TileLineModel","LineWallModel","LineModels","arc","arcmini","arc3d","greatcircle","wall","line","halfLine","simple","linearline","vectorline","tileLine","earthArc3d"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,6BAA1B;AACA,OAAOC,QAAP,MAAqB,OAArB;AACA,OAAOC,UAAP,MAAuB,UAAvB;AACA,OAAOC,YAAP,MAAyB,WAAzB;AACA,OAAOC,eAAP,MAA4B,eAA5B;AACA,OAAOC,gBAAP,MAA6B,gBAA7B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AACA,OAAOC,SAAP,MAAsB,QAAtB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,eAAP,MAA4B,cAA5B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AAgBA,IAAMC,UAA2C,GAAG;AAClDC,EAAAA,GAAG,EAAEZ,QAD6C;AAElDa,EAAAA,OAAO,EAAEX,YAFyC;AAGlDY,EAAAA,KAAK,EAAEb,UAH2C;AAIlDc,EAAAA,WAAW,EAAEX,gBAJqC;AAKlDY,EAAAA,IAAI,EAAEN,aAL4C;AAMlDO,EAAAA,IAAI,EAAEX,SAN4C;AAOlDY,EAAAA,QAAQ,EAAEb,aAPwC;AAQlDc,EAAAA,MAAM,EAAEX,eAR0C;AASlDY,EAAAA,UAAU,EAAEb,UATsC;AAUlDc,EAAAA,UAAU,EAAEtB,aAVsC;AAWlDuB,EAAAA,QAAQ,EAAEb,aAXwC;AAYlDc,EAAAA,UAAU,EAAEpB;AAZsC,CAApD;AAeA,eAAeQ,UAAf","sourcesContent":["import LineTileModel from '../../tile/models/tileModel';\nimport ArcModel from './arc';\nimport Arc3DModel from './arc_3d';\nimport ArcMiniModel from './arcmini';\nimport EarthArc3DModel from './earthArc_3d';\nimport GreatCircleModel from './great_circle';\nimport LineHalfModel from './half';\nimport LineModel from './line';\nimport LinearLine from './linearline';\nimport SimpleLineModel from './simpleLine';\nimport TileLineModel from './tile';\nimport LineWallModel from './wall';\n\nexport type LineModelType =\n | 'arc'\n | 'arcmini'\n | 'arc3d'\n | 'greatcircle'\n | 'wall'\n | 'simple'\n | 'line'\n | 'halfLine'\n | 'linearline'\n | 'vectorline'\n | 'tileLine'\n | 'earthArc3d';\n\nconst LineModels: { [key in LineModelType]: any } = {\n arc: ArcModel,\n arcmini: ArcMiniModel,\n arc3d: Arc3DModel,\n greatcircle: GreatCircleModel,\n wall: LineWallModel,\n line: LineModel,\n halfLine: LineHalfModel,\n simple: SimpleLineModel,\n linearline: LinearLine,\n vectorline: LineTileModel,\n tileLine: TileLineModel,\n earthArc3d: EarthArc3DModel,\n};\n\nexport default LineModels;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/line/models/index.ts"],"names":["LineTileModel","ArcModel","Arc3DModel","EarthArc3DModel","GreatCircleModel","LineHalfModel","LineModel","LinearLine","SimpleLineModel","TileLineModel","LineWallModel","LineModels","arc","arc3d","greatcircle","wall","line","halfLine","simple","linearline","vectorline","tileLine","earthArc3d"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,6BAA1B;AACA,OAAOC,QAAP,MAAqB,OAArB;AACA,OAAOC,UAAP,MAAuB,UAAvB;AACA,OAAOC,eAAP,MAA4B,eAA5B;AACA,OAAOC,gBAAP,MAA6B,gBAA7B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AACA,OAAOC,SAAP,MAAsB,QAAtB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,eAAP,MAA4B,cAA5B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AAeA,IAAMC,UAA2C,GAAG;AAClDC,EAAAA,GAAG,EAAEX,QAD6C;AAElDY,EAAAA,KAAK,EAAEX,UAF2C;AAGlDY,EAAAA,WAAW,EAAEV,gBAHqC;AAIlDW,EAAAA,IAAI,EAAEL,aAJ4C;AAKlDM,EAAAA,IAAI,EAAEV,SAL4C;AAMlDW,EAAAA,QAAQ,EAAEZ,aANwC;AAOlDa,EAAAA,MAAM,EAAEV,eAP0C;AAQlDW,EAAAA,UAAU,EAAEZ,UARsC;AASlDa,EAAAA,UAAU,EAAEpB,aATsC;AAUlDqB,EAAAA,QAAQ,EAAEZ,aAVwC;AAWlDa,EAAAA,UAAU,EAAEnB;AAXsC,CAApD;AAcA,eAAeQ,UAAf","sourcesContent":["import LineTileModel from '../../tile/models/tileModel';\nimport ArcModel from './arc';\nimport Arc3DModel from './arc_3d';\nimport EarthArc3DModel from './earthArc_3d';\nimport GreatCircleModel from './great_circle';\nimport LineHalfModel from './half';\nimport LineModel from './line';\nimport LinearLine from './linearline';\nimport SimpleLineModel from './simpleLine';\nimport TileLineModel from './tile';\nimport LineWallModel from './wall';\n\nexport type LineModelType =\n | 'arc'\n | 'arc3d'\n | 'greatcircle'\n | 'wall'\n | 'simple'\n | 'line'\n | 'halfLine'\n | 'linearline'\n | 'vectorline'\n | 'tileLine'\n | 'earthArc3d';\n\nconst LineModels: { [key in LineModelType]: any } = {\n arc: ArcModel,\n arc3d: Arc3DModel,\n greatcircle: GreatCircleModel,\n wall: LineWallModel,\n line: LineModel,\n halfLine: LineHalfModel,\n simple: SimpleLineModel,\n linearline: LinearLine,\n vectorline: LineTileModel,\n tileLine: TileLineModel,\n earthArc3d: EarthArc3DModel,\n};\n\nexport default LineModels;\n"],"file":"index.js"}
@@ -4,9 +4,9 @@ export default class LineModel extends BaseModel {
4
4
  protected texture: ITexture2D;
5
5
  getUninforms(): IModelUniform;
6
6
  getAnimateUniforms(): IModelUniform;
7
- initModels(): IModel[];
7
+ initModels(callbackModel: (models: IModel[]) => void): void;
8
8
  clearModels(): void;
9
- buildModels(): IModel[];
9
+ buildModels(callbackModel: (models: IModel[]) => void): void;
10
10
  /**
11
11
  * 根据参数获取不同的 shader 代码
12
12
  * @returns
@@ -12,9 +12,8 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
12
12
  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; } }
13
13
 
14
14
  import { AttributeType, gl } from '@antv/l7-core';
15
- import { getMask, rgb2arr } from '@antv/l7-utils';
15
+ import { getMask, LineTriangulation, rgb2arr } from '@antv/l7-utils';
16
16
  import BaseModel from '../../core/BaseModel';
17
- import { LineTriangulation } from '../../core/triangulation';
18
17
  var line_dash_frag = "#define LineTypeSolid 0.0\nuniform float u_opacity : 1.0;\n\nvarying vec4 v_color;\n\n// dash\nvarying vec4 v_dash_array;\n\n#pragma include \"picking\"\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying mat4 styleMappingMat;\n// [animate, duration, interval, trailLength],\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n gl_FragColor = v_color;\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n \n float dashLength = mod(d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n // \u5B9E\u7EBF\u90E8\u5206\n } else {\n // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
19
18
  var line_dash_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nattribute vec2 a_iconMapUV;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\n\nuniform float u_vertexScale: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\nvarying vec4 v_dash_array;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n vec2 offset = project_pixel(size.xy);\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = a_DistanceAndIndex.x / a_Total_Distance; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = a_DistanceAndIndex.x; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, project_pixel(a_Size.y), 1.0));\n } else {\n float lineHeight = a_Size.y;\n \n // #define COORDINATE_SYSTEM_P20 5.0\n // #define COORDINATE_SYSTEM_P20_OFFSET 6.0\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
20
19
  var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\nuniform float u_blur : 0.99;\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\n\nuniform float u_borderWidth: 0.0;\nuniform vec4 u_borderColor;\nvarying vec4 v_color;\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nvarying vec2 v_iconMapUV;\n\n#pragma include \"picking\"\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying mat4 styleMappingMat;\n// [animate, duration, interval, trailLength],\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n gl_FragColor = v_color;\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_aimate.x == Animate) {\n animateSpeed = u_time / u_aimate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + animateSpeed);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = styleMappingMat[3].g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = styleMappingMat[3].b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = styleMappingMat[3].a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n \n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));\n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor += pattern;\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = pattern;\n }\n } \n\n float v = styleMappingMat[3].a;\n float borderWidth = min(0.5, u_borderWidth);\n // \u7ED8\u5236 border\n if(borderWidth > 0.01) {\n float borderOuterWidth = borderWidth/2.0;\n\n if(v >= 1.0 - borderWidth || v <= borderWidth) {\n if(v > borderWidth) {\n float linear = smoothstep(0.0, 1.0, (v - (1.0 - borderWidth))/borderWidth);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, u_borderColor.rgb, linear);\n } else if(v <= borderWidth) {\n float linear = smoothstep(0.0, 1.0, v/borderWidth);\n gl_FragColor.rgb = mix(u_borderColor.rgb, gl_FragColor.rgb, linear);\n }\n }\n\n if(v < borderOuterWidth) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/borderOuterWidth);\n } else if(v > 1.0 - borderOuterWidth) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);\n }\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
@@ -192,10 +191,10 @@ var LineModel = function (_BaseModel) {
192
191
  }
193
192
  }, {
194
193
  key: "initModels",
195
- value: function initModels() {
194
+ value: function initModels(callbackModel) {
196
195
  this.updateTexture();
197
196
  this.iconService.on('imageUpdate', this.updateTexture);
198
- return this.buildModels();
197
+ this.buildModels(callbackModel);
199
198
  }
200
199
  }, {
201
200
  key: "clearModels",
@@ -208,14 +207,17 @@ var LineModel = function (_BaseModel) {
208
207
  }
209
208
  }, {
210
209
  key: "buildModels",
211
- value: function buildModels() {
210
+ value: function buildModels(callbackModel) {
212
211
  var _ref3 = this.layer.getLayerConfig(),
213
212
  _ref3$mask = _ref3.mask,
214
213
  mask = _ref3$mask === void 0 ? false : _ref3$mask,
215
214
  _ref3$maskInside = _ref3.maskInside,
216
215
  maskInside = _ref3$maskInside === void 0 ? true : _ref3$maskInside,
217
216
  _ref3$depth = _ref3.depth,
218
- depth = _ref3$depth === void 0 ? false : _ref3$depth;
217
+ depth = _ref3$depth === void 0 ? false : _ref3$depth,
218
+ _ref3$workerEnabled = _ref3.workerEnabled,
219
+ workerEnabled = _ref3$workerEnabled === void 0 ? false : _ref3$workerEnabled,
220
+ enablePicking = _ref3.enablePicking;
219
221
 
220
222
  var _this$getShaders = this.getShaders(),
221
223
  frag = _this$getShaders.frag,
@@ -223,18 +225,28 @@ var LineModel = function (_BaseModel) {
223
225
  type = _this$getShaders.type;
224
226
 
225
227
  this.layer.triangulation = LineTriangulation;
226
- return [this.layer.buildLayerModel({
227
- moduleName: 'line_' + type,
228
+ this.layer.buildLayerModel({
229
+ moduleName: 'line' + type,
228
230
  vertexShader: vert,
229
231
  fragmentShader: frag,
230
232
  triangulation: LineTriangulation,
231
- primitive: gl.TRIANGLES,
232
- blend: this.getBlend(),
233
233
  depth: {
234
234
  enable: depth
235
235
  },
236
- stencil: getMask(mask, maskInside)
237
- })];
236
+ blend: this.getBlend(),
237
+ stencil: getMask(mask, maskInside),
238
+ workerEnabled: workerEnabled,
239
+ workerOptions: {
240
+ modelType: 'line' + type,
241
+ enablePicking: enablePicking,
242
+ iconMap: this.iconService.getIconMap()
243
+ }
244
+ }).then(function (model) {
245
+ callbackModel([model]);
246
+ }).catch(function (err) {
247
+ console.warn(err);
248
+ callbackModel([]);
249
+ });
238
250
  }
239
251
  }, {
240
252
  key: "getShaders",
@@ -248,7 +260,7 @@ var LineModel = function (_BaseModel) {
248
260
  return {
249
261
  frag: line_dash_frag,
250
262
  vert: line_dash_vert,
251
- type: 'dash'
263
+ type: 'Dash'
252
264
  };
253
265
  }
254
266
 
@@ -256,13 +268,13 @@ var LineModel = function (_BaseModel) {
256
268
  return {
257
269
  frag: linear_line_frag,
258
270
  vert: line_vert,
259
- type: 'linear'
271
+ type: 'Linear'
260
272
  };
261
273
  } else {
262
274
  return {
263
275
  frag: line_frag,
264
276
  vert: line_vert,
265
- type: 'normal'
277
+ type: ''
266
278
  };
267
279
  }
268
280
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/line/models/line.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","LineTriangulation","lineStyleObj","solid","dash","LineModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","lineTexture","iconStep","vertexHeightScale","borderWidth","borderColor","raisingHeight","heightfixed","arrow","enable","arrowWidth","arrowHeight","tailWidth","length","push","getDirty","bind","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_texture","u_line_texture","u_icon_step","u_textSize","u_borderWidth","u_borderColor","u_linearColor","u_sourceColor","u_targetColor","u_heightfixed","Number","u_vertexScale","u_raisingHeight","u_arrow","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","updateTexture","on","buildModels","destroy","off","mask","maskInside","depth","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","primitive","TRIANGLES","blend","getBlend","stencil","line_dash_frag","line_dash_vert","linear_line_frag","line_vert","line_frag","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","DYNAMIC_DRAW","Array","isArray","iconMap","getIconMap","x","y"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAUO,eAVP;AAWA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,iBAAT,QAAkC,0BAAlC;;;;;;AAUA,IAAMC,YAAuC,GAAG;AAC9CC,EAAAA,KAAK,EAAE,GADuC;AAE9CC,EAAAA,IAAI,EAAE;AAFwC,CAAhD;;IAIqBC,S;;;;;;;;;;;;;;;;;;oEAgVK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB;AADY,SAApB;;AAGA,cAAKC,KAAL,CAAWC,MAAX;;AACA;AACD;;AACD,YAAKN,OAAL,GAAeF,eAAe,CAAC;AAC7BI,QAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADuB;AAE7BG,QAAAA,GAAG,EAAElB,EAAE,CAACmB,OAFqB;AAG7BC,QAAAA,GAAG,EAAEpB,EAAE,CAACmB,OAHqB;AAI7BE,QAAAA,gBAAgB,EAAE,KAJW;AAK7BC,QAAAA,KAAK,EAAE,IALsB;AAM7BC,QAAAA,MAAM,EAAE,MAAKT,WAAL,CAAiBU,YAAjB,IAAiC;AANZ,OA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CAAJ,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EA9UoC5I,S;;SAAlBK,S","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n IImage,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\n// dash line shader\nimport line_dash_frag from '../shaders/dash/line_dash_frag.glsl';\nimport line_dash_vert from '../shaders/dash/line_dash_vert.glsl';\n// basic line shader\nimport line_frag from '../shaders/line_frag.glsl';\nimport line_vert from '../shaders/line_vert.glsl';\n// other function shaders\nimport linear_line_frag from '../shaders/linear/line_linear_frag.glsl';\n\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\nexport default class LineModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n lineType = 'solid',\n dashArray = [10, 5, 0, 0],\n lineTexture = false,\n iconStep = 100,\n vertexHeightScale = 20.0,\n borderWidth = 0.0,\n borderColor = '#ccc',\n raisingHeight = 0,\n heightfixed = false,\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n if (dashArray.length === 2) {\n dashArray.push(0, 0);\n }\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n u_line_type: lineStyleObj[lineType],\n u_dash_array: dashArray,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // line border 参数\n u_borderWidth: borderWidth,\n u_borderColor: rgb2arr(borderColor),\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // 是否固定高度\n u_heightfixed: Number(heightfixed),\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n u_raisingHeight: Number(raisingHeight),\n\n // arrow\n u_arrow: Number(arrow.enable),\n u_arrowHeight: arrow.arrowHeight || 3,\n u_arrowWidth: arrow.arrowWidth || 2,\n u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth,\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n return this.buildModels();\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: 'line_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: depth },\n // depth: { enable: true },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n /**\n * 根据参数获取不同的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n lineType,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (lineType === 'dash') {\n return {\n frag: line_dash_frag,\n vert: line_dash_vert,\n type: 'dash',\n };\n }\n\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: linear_line_frag,\n vert: line_vert,\n type: 'linear',\n };\n } else {\n return {\n frag: line_frag,\n vert: line_vert,\n type: 'normal',\n };\n }\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10]\n : [vertex[3], vertexIndex];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"line.js"}
1
+ {"version":3,"sources":["../../../src/line/models/line.ts"],"names":["AttributeType","gl","getMask","LineTriangulation","rgb2arr","BaseModel","lineStyleObj","solid","dash","LineModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","lineTexture","iconStep","vertexHeightScale","borderWidth","borderColor","raisingHeight","heightfixed","arrow","enable","arrowWidth","arrowHeight","tailWidth","length","push","getDirty","bind","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_texture","u_line_texture","u_icon_step","u_textSize","u_borderWidth","u_borderColor","u_linearColor","u_sourceColor","u_targetColor","u_heightfixed","Number","u_vertexScale","u_raisingHeight","u_arrow","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","callbackModel","updateTexture","on","buildModels","destroy","off","mask","maskInside","depth","workerEnabled","enablePicking","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","blend","getBlend","stencil","workerOptions","modelType","iconMap","getIconMap","then","model","catch","err","console","warn","line_dash_frag","line_dash_vert","linear_line_frag","line_vert","line_frag","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","DYNAMIC_DRAW","Array","isArray","x","y"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAUO,eAVP;AAWA,SAASC,OAAT,EAAkBC,iBAAlB,EAAqCC,OAArC,QAAoD,gBAApD;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;;;;;;AAYA,IAAMC,YAAuC,GAAG;AAC9CC,EAAAA,KAAK,EAAE,GADuC;AAE9CC,EAAAA,IAAI,EAAE;AAFwC,CAAhD;;IAIqBC,S;;;;;;;;;;;;;;;;;;oEA4VK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB;AADY,SAApB;;AAGA,cAAKC,KAAL,CAAWC,MAAX;;AACA;AACD;;AACD,YAAKN,OAAL,GAAeF,eAAe,CAAC;AAC7BI,QAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADuB;AAE7BG,QAAAA,GAAG,EAAElB,EAAE,CAACmB,OAFqB;AAG7BC,QAAAA,GAAG,EAAEpB,EAAE,CAACmB,OAHqB;AAI7BE,QAAAA,gBAAgB,EAAE,KAJW;AAK7BC,QAAAA,KAAK,EAAE,IALsB;AAM7BC,QAAAA,MAAM,EAAE,MAAKT,WAAL,CAAiBU,YAAjB,IAAiC;AANZ,OAAD,CAA9B;AAQD,K;;;;;;;WA3WD,wBAAqC;AACnC,iBAoBI,K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AE,CARI;AASVjI,UAAAA,MAAM,EAAE,gBACNkI,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAMzB,OAAO,GAAG,MAAI,CAAC1G,WAAL,CAAiB2G,UAAjB,EAAhB;;AACA,gBAAQ9G,OAAR,GAAoBmI,OAApB,CAAQnI,OAAR;;AACA,wBAAiB6G,OAAO,CAAC7G,OAAD,CAAP,IAA8B;AAAE4I,cAAAA,CAAC,EAAE,CAAL;AAAQC,cAAAA,CAAC,EAAE;AAAX,aAA/C;AAAA,gBAAQD,CAAR,SAAQA,CAAR;AAAA,gBAAWC,CAAX,SAAWA,CAAX;;AACA,mBAAO,CAACD,CAAD,EAAIC,CAAJ,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EA1VoCpJ,S;;SAAlBI,S","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n IImage,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getMask, LineTriangulation, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\n// import { LineTriangulation } from '../../core/triangulation';\n// dash line shader\nimport line_dash_frag from '../shaders/dash/line_dash_frag.glsl';\nimport line_dash_vert from '../shaders/dash/line_dash_vert.glsl';\n// basic line shader\nimport line_frag from '../shaders/line_frag.glsl';\nimport line_vert from '../shaders/line_vert.glsl';\n// other function shaders\nimport linear_line_frag from '../shaders/linear/line_linear_frag.glsl';\n\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\nexport default class LineModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n lineType = 'solid',\n dashArray = [10, 5, 0, 0],\n lineTexture = false,\n iconStep = 100,\n vertexHeightScale = 20.0,\n borderWidth = 0.0,\n borderColor = '#ccc',\n raisingHeight = 0,\n heightfixed = false,\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n if (dashArray.length === 2) {\n dashArray.push(0, 0);\n }\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n u_line_type: lineStyleObj[lineType],\n u_dash_array: dashArray,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // line border 参数\n u_borderWidth: borderWidth,\n u_borderColor: rgb2arr(borderColor),\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // 是否固定高度\n u_heightfixed: Number(heightfixed),\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n u_raisingHeight: Number(raisingHeight),\n\n // arrow\n u_arrow: Number(arrow.enable),\n u_arrowHeight: arrow.arrowHeight || 3,\n u_arrowWidth: arrow.arrowWidth || 2,\n u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth,\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(callbackModel: (models: IModel[]) => void) {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n this.buildModels(callbackModel);\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public buildModels(callbackModel: (models: IModel[]) => void) {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n workerEnabled = false,\n enablePicking,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n this.layer\n .buildLayerModel({\n moduleName: 'line' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n depth: { enable: depth },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n workerEnabled,\n workerOptions: {\n modelType: 'line' + type,\n enablePicking,\n iconMap: this.iconService.getIconMap(),\n },\n })\n .then((model) => {\n callbackModel([model]);\n })\n .catch((err) => {\n console.warn(err);\n callbackModel([]);\n });\n }\n\n /**\n * 根据参数获取不同的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n lineType,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (lineType === 'dash') {\n return {\n frag: line_dash_frag,\n vert: line_dash_vert,\n type: 'Dash',\n };\n }\n\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: linear_line_frag,\n vert: line_vert,\n type: 'Linear',\n };\n } else {\n return {\n frag: line_frag,\n vert: line_vert,\n type: '',\n };\n }\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10]\n : [vertex[3], vertexIndex];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"line.js"}
@@ -3,18 +3,9 @@ import BaseModel from '../../core/BaseModel';
3
3
  export default class LinearLineModel extends BaseModel {
4
4
  protected colorTexture: ITexture2D;
5
5
  getUninforms(): IModelUniform;
6
- initModels(): IModel[];
6
+ initModels(callbackModel: (models: IModel[]) => void): void;
7
7
  clearModels(): void;
8
- buildModels(): IModel[];
9
- /**
10
- * 根据参数获取不同的 shader 代码
11
- * @returns
12
- */
13
- getShaders(): {
14
- frag: string;
15
- vert: string;
16
- type: string;
17
- };
8
+ buildModels(callbackModel: (models: IModel[]) => void): void;
18
9
  protected registerBuiltinAttributes(): void;
19
10
  private updateTexture;
20
11
  }
@@ -122,9 +122,9 @@ var LinearLineModel = function (_BaseModel) {
122
122
  }
123
123
  }, {
124
124
  key: "initModels",
125
- value: function initModels() {
125
+ value: function initModels(callbackModel) {
126
126
  this.updateTexture();
127
- return this.buildModels();
127
+ this.buildModels(callbackModel);
128
128
  }
129
129
  }, {
130
130
  key: "clearModels",
@@ -136,7 +136,7 @@ var LinearLineModel = function (_BaseModel) {
136
136
  }
137
137
  }, {
138
138
  key: "buildModels",
139
- value: function buildModels() {
139
+ value: function buildModels(callbackModel) {
140
140
  var _ref3 = this.layer.getLayerConfig(),
141
141
  _ref3$mask = _ref3.mask,
142
142
  mask = _ref3$mask === void 0 ? false : _ref3$mask,
@@ -145,33 +145,23 @@ var LinearLineModel = function (_BaseModel) {
145
145
  _ref3$depth = _ref3.depth,
146
146
  depth = _ref3$depth === void 0 ? false : _ref3$depth;
147
147
 
148
- var _this$getShaders = this.getShaders(),
149
- frag = _this$getShaders.frag,
150
- vert = _this$getShaders.vert,
151
- type = _this$getShaders.type;
152
-
153
148
  this.layer.triangulation = LineTriangulation;
154
- return [this.layer.buildLayerModel({
155
- moduleName: 'line_' + type,
156
- vertexShader: vert,
157
- fragmentShader: frag,
149
+ this.layer.buildLayerModel({
150
+ moduleName: 'lineRampColors',
151
+ vertexShader: linear_line_vert,
152
+ fragmentShader: linear_line_frag,
158
153
  triangulation: LineTriangulation,
159
- primitive: gl.TRIANGLES,
160
- blend: this.getBlend(),
161
154
  depth: {
162
155
  enable: depth
163
156
  },
157
+ blend: this.getBlend(),
164
158
  stencil: getMask(mask, maskInside)
165
- })];
166
- }
167
- }, {
168
- key: "getShaders",
169
- value: function getShaders() {
170
- return {
171
- frag: linear_line_frag,
172
- vert: linear_line_vert,
173
- type: 'linear_rampColors'
174
- };
159
+ }).then(function (model) {
160
+ callbackModel([model]);
161
+ }).catch(function (err) {
162
+ console.warn(err);
163
+ callbackModel([]);
164
+ });
175
165
  }
176
166
  }, {
177
167
  key: "registerBuiltinAttributes",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/line/models/linearline.ts"],"names":["AttributeType","gl","generateColorRamp","getMask","BaseModel","LineTriangulation","LinearLineModel","createTexture2D","rendererService","colorTexture","destroy","layer","getLayerConfig","rampColors","imageData","data","Uint8Array","width","height","wrapS","CLAMP_TO_EDGE","wrapT","min","NEAREST","mag","flipY","opacity","vertexHeightScale","raisingHeight","heightfixed","getDirty","bind","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_texture","u_heightfixed","Number","u_vertexScale","u_raisingHeight","updateTexture","buildModels","mask","maskInside","depth","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","primitive","TRIANGLES","blend","getBlend","enable","stencil","linear_line_frag","linear_line_vert","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","undefined","DYNAMIC_DRAW","Array","isArray"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAOO,eAPP;AAQA,SAASC,iBAAT,EAA4BC,OAA5B,QAAuD,gBAAvD;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,iBAAT,QAAkC,0BAAlC;;;;IAIqBC,e;;;;;;;;;;;;;;;;;;oEAoOK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,YAAT,EAA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AlBS;AAHoC,OAAlD;AAyBA,WAAKd,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,OAD0C;AAEhDlC,QAAAA,IAAI,EAAE7C,aAAa,CAACgF,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,SADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAElF,EAAE,CAACmF,WAFJ;AAGNrE,YAAAA,IAAI,EAAE,EAHA;AAIN8B,YAAAA,IAAI,EAAE5C,EAAE,CAAC6C;AAJH,WAFE;AAQVuC,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAsBD;;;;EAlO0CrF,S;;SAAxBE,e","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { generateColorRamp, getMask, IColorRamp } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport linear_line_frag from '../shaders/linearLine/line_linear_frag.glsl';\nimport linear_line_vert from '../shaders/linearLine/line_linear_vert.glsl';\n\nexport default class LinearLineModel extends BaseModel {\n protected colorTexture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n vertexHeightScale = 20.0,\n raisingHeight = 0,\n heightfixed = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.colorTexture.bind();\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n // 纹理支持参数\n u_texture: this.colorTexture, // 贴图\n\n // 是否固定高度\n u_heightfixed: Number(heightfixed),\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n u_raisingHeight: Number(raisingHeight),\n };\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n return this.buildModels();\n }\n\n public clearModels() {\n this.colorTexture?.destroy();\n this.dataTexture?.destroy();\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: 'line_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: depth },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n /**\n * 根据参数获取不同的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: linear_line_frag,\n vert: linear_line_vert,\n type: 'linear_rampColors',\n };\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10]\n : [vertex[3], vertexIndex];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n // @ts-ignore\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.colorTexture) {\n this.colorTexture.destroy();\n }\n const {\n rampColors,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const imageData = generateColorRamp(rampColors as IColorRamp);\n this.colorTexture = createTexture2D({\n data: new Uint8Array(imageData.data),\n width: imageData.width,\n height: imageData.height,\n wrapS: gl.CLAMP_TO_EDGE,\n wrapT: gl.CLAMP_TO_EDGE,\n min: gl.NEAREST,\n mag: gl.NEAREST,\n flipY: false,\n });\n };\n}\n"],"file":"linearline.js"}
1
+ {"version":3,"sources":["../../../src/line/models/linearline.ts"],"names":["AttributeType","gl","generateColorRamp","getMask","BaseModel","LineTriangulation","LinearLineModel","createTexture2D","rendererService","colorTexture","destroy","layer","getLayerConfig","rampColors","imageData","data","Uint8Array","width","height","wrapS","CLAMP_TO_EDGE","wrapT","min","NEAREST","mag","flipY","opacity","vertexHeightScale","raisingHeight","heightfixed","getDirty","bind","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_texture","u_heightfixed","Number","u_vertexScale","u_raisingHeight","callbackModel","updateTexture","buildModels","mask","maskInside","depth","triangulation","buildLayerModel","moduleName","vertexShader","linear_line_vert","fragmentShader","linear_line_frag","enable","blend","getBlend","stencil","then","model","catch","err","console","warn","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","undefined","DYNAMIC_DRAW","Array","isArray"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EA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,EAAE,CAAC6C;AAJH,WAFE;AAQVyC,UAAAA,IAAI,EAAE,CARI;AAUVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKNC,MALM,EAMH;AACH,mBAAOA,MAAP;AACD;AAlBS;AAHoC,OAAlD;AAyBA,WAAKd,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,OAD0C;AAEhDpC,QAAAA,IAAI,EAAE7C,aAAa,CAACkF,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,SADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEpF,EAAE,CAACqF,WAFJ;AAGNvE,YAAAA,IAAI,EAAE,EAHA;AAIN8B,YAAAA,IAAI,EAAE5C,EAAE,CAAC6C;AAJH,WAFE;AAQVyC,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAsBD;;;;EA5N0CvF,S;;SAAxBE,e","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { generateColorRamp, getMask, IColorRamp } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport linear_line_frag from '../shaders/linearLine/line_linear_frag.glsl';\nimport linear_line_vert from '../shaders/linearLine/line_linear_vert.glsl';\n\nexport default class LinearLineModel extends BaseModel {\n protected colorTexture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n vertexHeightScale = 20.0,\n raisingHeight = 0,\n heightfixed = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.colorTexture.bind();\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n // 纹理支持参数\n u_texture: this.colorTexture, // 贴图\n\n // 是否固定高度\n u_heightfixed: Number(heightfixed),\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n u_raisingHeight: Number(raisingHeight),\n };\n }\n\n public initModels(callbackModel: (models: IModel[]) => void) {\n this.updateTexture();\n this.buildModels(callbackModel);\n }\n\n public clearModels() {\n this.colorTexture?.destroy();\n this.dataTexture?.destroy();\n }\n\n public buildModels(callbackModel: (models: IModel[]) => void) {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n this.layer.triangulation = LineTriangulation;\n\n this.layer\n .buildLayerModel({\n moduleName: 'lineRampColors',\n vertexShader: linear_line_vert,\n fragmentShader: linear_line_frag,\n triangulation: LineTriangulation,\n depth: { enable: depth },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n })\n .then((model) => {\n callbackModel([model]);\n })\n .catch((err) => {\n console.warn(err);\n callbackModel([]);\n });\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10]\n : [vertex[3], vertexIndex];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n // @ts-ignore\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.colorTexture) {\n this.colorTexture.destroy();\n }\n const {\n rampColors,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const imageData = generateColorRamp(rampColors as IColorRamp);\n this.colorTexture = createTexture2D({\n data: new Uint8Array(imageData.data),\n width: imageData.width,\n height: imageData.height,\n wrapS: gl.CLAMP_TO_EDGE,\n wrapT: gl.CLAMP_TO_EDGE,\n min: gl.NEAREST,\n mag: gl.NEAREST,\n flipY: false,\n });\n };\n}\n"],"file":"linearline.js"}
@@ -2,13 +2,13 @@ import { IModel, IModelUniform } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class SimpleLineModel extends BaseModel {
4
4
  getUninforms(): IModelUniform;
5
- initModels(): IModel[];
5
+ initModels(callbackModel: (models: IModel[]) => void): void;
6
6
  clearModels(): void;
7
7
  getShaders(): {
8
8
  frag: string;
9
9
  vert: string;
10
10
  type: string;
11
11
  };
12
- buildModels(): IModel[];
12
+ buildModels(callbackModel: (models: IModel[]) => void): void;
13
13
  protected registerBuiltinAttributes(): void;
14
14
  }
@@ -92,8 +92,8 @@ var SimpleLineModel = function (_BaseModel) {
92
92
  }
93
93
  }, {
94
94
  key: "initModels",
95
- value: function initModels() {
96
- return this.buildModels();
95
+ value: function initModels(callbackModel) {
96
+ this.buildModels(callbackModel);
97
97
  }
98
98
  }, {
99
99
  key: "clearModels",
@@ -113,19 +113,19 @@ var SimpleLineModel = function (_BaseModel) {
113
113
  return {
114
114
  frag: simle_linear_frag,
115
115
  vert: simple_line_vert,
116
- type: 'simple_linear'
116
+ type: 'lineSimpleLinear'
117
117
  };
118
118
  } else {
119
119
  return {
120
120
  frag: simple_line_frag,
121
121
  vert: simple_line_vert,
122
- type: 'simple_normal'
122
+ type: 'lineSimpleNormal'
123
123
  };
124
124
  }
125
125
  }
126
126
  }, {
127
127
  key: "buildModels",
128
- value: function buildModels() {
128
+ value: function buildModels(callbackModel) {
129
129
  var _ref3 = this.layer.getLayerConfig(),
130
130
  _ref3$mask = _ref3.mask,
131
131
  mask = _ref3$mask === void 0 ? false : _ref3$mask,
@@ -137,18 +137,23 @@ var SimpleLineModel = function (_BaseModel) {
137
137
  vert = _this$getShaders.vert,
138
138
  type = _this$getShaders.type;
139
139
 
140
- return [this.layer.buildLayerModel({
140
+ this.layer.buildLayerModel({
141
141
  moduleName: type,
142
142
  vertexShader: vert,
143
143
  fragmentShader: frag,
144
144
  triangulation: SimpleLineTriangulation,
145
145
  primitive: gl.LINES,
146
- blend: this.getBlend(),
147
146
  depth: {
148
147
  enable: false
149
148
  },
149
+ blend: this.getBlend(),
150
150
  stencil: getMask(mask, maskInside)
151
- })];
151
+ }).then(function (model) {
152
+ callbackModel([model]);
153
+ }).catch(function (err) {
154
+ console.warn(err);
155
+ callbackModel([]);
156
+ });
152
157
  }
153
158
  }, {
154
159
  key: "registerBuiltinAttributes",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/line/models/simpleLine.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","SimpleLineTriangulation","SimpleLineModel","layer","getLayerConfig","opacity","sourceColor","targetColor","vertexHeightScale","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_linearColor","u_sourceColor","u_targetColor","u_vertexScale","buildModels","destroy","frag","simle_linear_frag","vert","simple_line_vert","simple_line_frag","mask","maskInside","getShaders","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","primitive","LINES","blend","getBlend","depth","enable","stencil","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","DYNAMIC_DRAW","Array","isArray"],"mappings":";;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAMO,eANP;AAOA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,uBAAT,QAAwC,0BAAxC;;;;;IAKqBC,e;;;;;;;;;;;;;WACnB,wBAAqC;AACnC,iBAKI,KAAKC,KAAL,CAAWC,cAAX,EALJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,UAEEC,WAFF,QAEEA,WAFF;AAAA,UAGEC,WAHF,QAGEA,WAHF;AAAA,uCAIEC,iBAJF;AAAA,UAIEA,iBAJF,sCAIsB,IAJtB;;AAQA,UAAIC,cAAc,GAAG,CAArB;AACA,UAAIC,cAAc,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CAArB;AACA,UAAIC,cAAc,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CAArB;;AACA,UAAIL,WAAW,IAAIC,WAAnB,EAAgC;AAC9BG,QAAAA,cAAc,GAAGX,OAAO,CAACO,WAAD,CAAxB;AACAK,QAAAA,cAAc,GAAGZ,OAAO,CAACQ,WAAD,CAAxB;AACAE,QAAAA,cAAc,GAAG,CAAjB;AACD;;AAED,UAAI,KAAKG,eAAL,IAAwB,KAAKC,qBAAL,CAA2B;AAAER,QAAAA,OAAO,EAAPA;AAAF,OAA3B,CAA5B,EAAqE;AACnE,aAAKS,oBAAL,CAA0B;AAAET,UAAAA,OAAO,EAAPA;AAAF,SA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,CAAkD;AAChDC,QAAAA,IAAI,EAAE,MAD0C;AAEhDlC,QAAAA,IAAI,EAAElC,aAAa,CAACqE,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,QADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEvE,EAAE,CAAC+E,YAFJ;AAGNxD,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAEjC,EAAE,CAACkC;AAJH,WAFE;AAQVuC,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gCAAqBH,OAArB,CAAQF,IAAR;AAAA,gBAAQA,IAAR,8BAAe,CAAf;AACA,mBAAOO,KAAK,CAACC,OAAN,CAAcR,IAAd,IAAsB,CAACA,IAAI,CAAC,CAAD,CAAL,EAAUA,IAAI,CAAC,CAAD,CAAd,CAAtB,GAA2C,CAACA,IAAD,EAAiB,CAAjB,CAAlD;AACD;AAjBS;AAHoC,OAAlD;AAuBD;;;;EAtL0CtE,S;;SAAxBE,e","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { SimpleLineTriangulation } from '../../core/triangulation';\nimport simple_line_frag from '../shaders/simple/simpleline_frag.glsl';\n// linear simple line shader\nimport simle_linear_frag from '../shaders/simple/simpleline_linear_frag.glsl';\nimport simple_line_vert from '../shaders/simple/simpleline_vert.glsl';\nexport default class SimpleLineModel extends BaseModel {\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n vertexHeightScale = 20.0,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n };\n }\n\n public initModels(): IModel[] {\n return this.buildModels();\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n public getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: simle_linear_frag,\n vert: simple_line_vert,\n type: 'simple_linear',\n };\n } else {\n return {\n frag: simple_line_frag,\n vert: simple_line_vert,\n type: 'simple_normal',\n };\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n const { frag, vert, type } = this.getShaders();\n return [\n this.layer.buildLayerModel({\n moduleName: type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: SimpleLineTriangulation,\n primitive: gl.LINES, // gl.LINES gl.TRIANGLES\n blend: this.getBlend(),\n depth: { enable: false },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n }\n}\n"],"file":"simpleLine.js"}
1
+ {"version":3,"sources":["../../../src/line/models/simpleLine.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","SimpleLineTriangulation","SimpleLineModel","layer","getLayerConfig","opacity","sourceColor","targetColor","vertexHeightScale","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_linearColor","u_sourceColor","u_targetColor","u_vertexScale","callbackModel","buildModels","destroy","frag","simle_linear_frag","vert","simple_line_vert","simple_line_frag","mask","maskInside","getShaders","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","primitive","LINES","depth","enable","blend","getBlend","stencil","then","model","catch","err","console","warn","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","DYNAMIC_DRAW","Array","isArray"],"mappings":";;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAMO,eANP;AAOA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,uBAAT,QAAwC,0BAAxC;;;;;IAKqBC,e;;;;;;;;;;;;;WACnB,wBAAqC;AACnC,iBAKI,KAAKC,KAAL,CAAWC,cAAX,EALJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,UAEEC,WAFF,QAEEA,WAFF;AAAA,UAGEC,WAHF,QAGEA,WAHF;AAAA,uCAIEC,iBAJF;AAAA,UAIEA,iBAJF,sCAIsB,IAJtB;;AAQA,UAAIC,cAAc,GAAG,CAArB;AACA,UAAIC,cAAc,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CAArB;AACA,UAAIC,cAAc,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CAArB;;AACA,UAAIL,WAAW,IAAIC,WAAnB,EAAgC;AAC9BG,QAAAA,cAAc,GAAGX,OAAO,CAACO,WAAD,CAAxB;AACAK,QAA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ributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { SimpleLineTriangulation } from '../../core/triangulation';\nimport simple_line_frag from '../shaders/simple/simpleline_frag.glsl';\n// linear simple line shader\nimport simle_linear_frag from '../shaders/simple/simpleline_linear_frag.glsl';\nimport simple_line_vert from '../shaders/simple/simpleline_vert.glsl';\nexport default class SimpleLineModel extends BaseModel {\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n vertexHeightScale = 20.0,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n };\n }\n\n public initModels(callbackModel: (models: IModel[]) => void) {\n this.buildModels(callbackModel);\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n public getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: simle_linear_frag,\n vert: simple_line_vert,\n type: 'lineSimpleLinear',\n };\n } else {\n return {\n frag: simple_line_frag,\n vert: simple_line_vert,\n type: 'lineSimpleNormal',\n };\n }\n }\n\n public buildModels(callbackModel: (models: IModel[]) => void) {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n const { frag, vert, type } = this.getShaders();\n\n this.layer\n .buildLayerModel({\n moduleName: type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: SimpleLineTriangulation,\n primitive: gl.LINES,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n })\n .then((model) => {\n callbackModel([model]);\n })\n .catch((err) => {\n console.warn(err);\n callbackModel([]);\n });\n }\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n }\n}\n"],"file":"simpleLine.js"}
@@ -3,18 +3,9 @@ import BaseModel from '../../core/BaseModel';
3
3
  export default class LineModel extends BaseModel {
4
4
  protected texture: ITexture2D;
5
5
  getUninforms(): IModelUniform;
6
- initModels(): IModel[];
6
+ initModels(callbackModel: (models: IModel[]) => void): void;
7
7
  clearModels(): void;
8
- buildModels(): IModel[];
9
- /**
10
- * 根据参数获取不同的 shader 代码
11
- * @returns
12
- */
13
- getShaders(): {
14
- frag: string;
15
- vert: string;
16
- type: string;
17
- };
8
+ buildModels(callbackModel: (models: IModel[]) => void): Promise<void>;
18
9
  protected registerBuiltinAttributes(): void;
19
10
  private updateTexture;
20
11
  }