@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,145 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _inherits from "@babel/runtime/helpers/inherits";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
- import _isNumber from "lodash/isNumber";
7
-
8
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
-
10
- 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; } }
11
-
12
- import { AttributeType, gl } from '@antv/l7-core';
13
- import { rgb2arr } from '@antv/l7-utils';
14
- import BaseModel from '../../core/BaseModel';
15
- import { LineArcTriangulation } from '../../core/triangulation';
16
- var line_arcmini_frag = "#define Animate 0.0\n\nuniform float u_opacity;\nuniform float u_blur : 0.9;\n// varying vec2 v_normal;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\nuniform float segmentNumber;\nvarying float v_distance_ratio;\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nvoid main() {\n\n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u5E95\u8272\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, v_distance_ratio);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n \n \n gl_FragColor.a *= u_opacity;\n\n if(u_aimate.x == Animate) {\n float animateSpeed = u_time / u_aimate.y; // \u8FD0\u52A8\u901F\u5EA6\n float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + u_time / u_aimate.y);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n }\n}";
17
- var line_arcmini_vert = "#define Animate 0.0\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n\nuniform float u_lineDir: 1.0;\n\n// \u504F\u79FB\u91CF\nuniform float u_thetaOffset: 0.314;\n\nuniform float u_opacity: 1.0;\nvarying float v_distance_ratio;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = u_thetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n}\nvec2 interpolate (vec2 source, vec2 target, float t) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n\n v_distance_ratio = segmentIndex / segmentNumber;\n \n if(u_aimate.x == Animate && u_lineDir != 1.0) {\n v_distance_ratio = 1.0 - v_distance_ratio;\n }\n\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n}\n";
18
-
19
- var ArcMiniModel = function (_BaseModel) {
20
- _inherits(ArcMiniModel, _BaseModel);
21
-
22
- var _super = _createSuper(ArcMiniModel);
23
-
24
- function ArcMiniModel() {
25
- _classCallCheck(this, ArcMiniModel);
26
-
27
- return _super.apply(this, arguments);
28
- }
29
-
30
- _createClass(ArcMiniModel, [{
31
- key: "getUninforms",
32
- value: function getUninforms() {
33
- var _ref = this.layer.getLayerConfig(),
34
- _ref$opacity = _ref.opacity,
35
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
36
- sourceColor = _ref.sourceColor,
37
- targetColor = _ref.targetColor,
38
- _ref$forward = _ref.forward,
39
- forward = _ref$forward === void 0 ? true : _ref$forward,
40
- _ref$segmentNumber = _ref.segmentNumber,
41
- segmentNumber = _ref$segmentNumber === void 0 ? 30 : _ref$segmentNumber,
42
- _ref$thetaOffset = _ref.thetaOffset,
43
- thetaOffset = _ref$thetaOffset === void 0 ? 0.314 : _ref$thetaOffset;
44
-
45
- var useLinearColor = 0;
46
- var sourceColorArr = [0, 0, 0, 0];
47
- var targetColorArr = [0, 0, 0, 0];
48
-
49
- if (sourceColor && targetColor) {
50
- sourceColorArr = rgb2arr(sourceColor);
51
- targetColorArr = rgb2arr(targetColor);
52
- useLinearColor = 1;
53
- }
54
-
55
- return {
56
- u_thetaOffset: thetaOffset,
57
- u_opacity: _isNumber(opacity) ? opacity : 1.0,
58
- segmentNumber: segmentNumber,
59
- u_blur: 0.9,
60
- u_lineDir: forward ? 1 : -1,
61
- u_linearColor: useLinearColor,
62
- u_sourceColor: sourceColorArr,
63
- u_targetColor: targetColorArr
64
- };
65
- }
66
- }, {
67
- key: "getAnimateUniforms",
68
- value: function getAnimateUniforms() {
69
- var _ref2 = this.layer.getLayerConfig(),
70
- animateOption = _ref2.animateOption;
71
-
72
- return {
73
- u_aimate: this.animateOption2Array(animateOption),
74
- u_time: this.layer.getLayerAnimateTime()
75
- };
76
- }
77
- }, {
78
- key: "initModels",
79
- value: function initModels() {
80
- return this.buildModels();
81
- }
82
- }, {
83
- key: "buildModels",
84
- value: function buildModels() {
85
- var _ref3 = this.layer.getLayerConfig(),
86
- _ref3$segmentNumber = _ref3.segmentNumber,
87
- segmentNumber = _ref3$segmentNumber === void 0 ? 30 : _ref3$segmentNumber;
88
-
89
- return [this.layer.buildLayerModel({
90
- moduleName: 'arc2dminiline',
91
- vertexShader: line_arcmini_vert,
92
- fragmentShader: line_arcmini_frag,
93
- triangulation: LineArcTriangulation,
94
- depth: {
95
- enable: false
96
- },
97
- blend: this.getBlend(),
98
- segmentNumber: segmentNumber
99
- })];
100
- }
101
- }, {
102
- key: "registerBuiltinAttributes",
103
- value: function registerBuiltinAttributes() {
104
- this.styleAttributeService.registerStyleAttribute({
105
- name: 'size',
106
- type: AttributeType.Attribute,
107
- descriptor: {
108
- name: 'a_Size',
109
- buffer: {
110
- usage: gl.DYNAMIC_DRAW,
111
- data: [],
112
- type: gl.FLOAT
113
- },
114
- size: 1,
115
- update: function update(feature, featureIdx, vertex, attributeIdx) {
116
- var _feature$size = feature.size,
117
- size = _feature$size === void 0 ? 1 : _feature$size;
118
- return Array.isArray(size) ? [size[0]] : [size];
119
- }
120
- }
121
- });
122
- this.styleAttributeService.registerStyleAttribute({
123
- name: 'instance',
124
- type: AttributeType.Attribute,
125
- descriptor: {
126
- name: 'a_Instance',
127
- buffer: {
128
- usage: gl.STATIC_DRAW,
129
- data: [],
130
- type: gl.FLOAT
131
- },
132
- size: 4,
133
- update: function update(feature, featureIdx, vertex, attributeIdx) {
134
- return [vertex[3], vertex[4], vertex[5], vertex[6]];
135
- }
136
- }
137
- });
138
- }
139
- }]);
140
-
141
- return ArcMiniModel;
142
- }(BaseModel);
143
-
144
- export { ArcMiniModel as default };
145
- //# sourceMappingURL=arcmini.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/line/models/arcmini.ts"],"names":["AttributeType","gl","rgb2arr","BaseModel","LineArcTriangulation","ArcMiniModel","layer","getLayerConfig","opacity","sourceColor","targetColor","forward","segmentNumber","thetaOffset","useLinearColor","sourceColorArr","targetColorArr","u_thetaOffset","u_opacity","u_blur","u_lineDir","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","buildModels","buildLayerModel","moduleName","vertexShader","line_arcmini_vert","fragmentShader","line_arcmini_frag","triangulation","depth","enable","blend","getBlend","styleAttributeService","registerStyleAttribute","name","type","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","data","FLOAT","size","update","feature","featureIdx","vertex","attributeIdx","Array","isArray","STATIC_DRAW"],"mappings":";;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAQO,eARP;AASA,SAASC,OAAT,QAAwB,gBAAxB;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA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AACC,OAAN,CAAcP,IAAd,IAAsB,CAACA,IAAI,CAAC,CAAD,CAAL,CAAtB,GAAkC,CAACA,IAAD,CAAzC;AACD;AAjBS;AAHoC,OAAlD;AAwBA,WAAKX,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,UAD0C;AAEhDC,QAAAA,IAAI,EAAE5C,aAAa,CAAC6C,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVH,UAAAA,IAAI,EAAE,YADI;AAEVI,UAAAA,MAAM,EAAE;AACNC,YAAAA,KAAK,EAAE/C,EAAE,CAAC2D,WADJ;AAENV,YAAAA,IAAI,EAAE,EAFA;AAGNN,YAAAA,IAAI,EAAE3C,EAAE,CAACkD;AAHH,WAFE;AAOVC,UAAAA,IAAI,EAAE,CAPI;AAQVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,EAAYA,MAAM,CAAC,CAAD,CAAlB,EAAuBA,MAAM,CAAC,CAAD,CAA7B,EAAkCA,MAAM,CAAC,CAAD,CAAxC,CAAP;AACD;AAfS;AAHoC,OAAlD;AAqBD;;;;EAlHuCrD,S;;SAArBE,Y","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineArcTriangulation } from '../../core/triangulation';\nimport line_arcmini_frag from '../shaders/line_arcmini_frag.glsl';\nimport line_arcmini_vert from '../shaders/line_arcmini_vert.glsl';\n\nexport default class ArcMiniModel extends BaseModel {\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n forward = true,\n segmentNumber = 30,\n thetaOffset = 0.314,\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 return {\n u_thetaOffset: thetaOffset,\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n\n segmentNumber,\n u_blur: 0.9,\n u_lineDir: forward ? 1 : -1,\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\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 return this.buildModels();\n }\n\n public buildModels(): IModel[] {\n const {\n segmentNumber = 30,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n return [\n this.layer.buildLayerModel({\n moduleName: 'arc2dminiline',\n vertexShader: line_arcmini_vert,\n fragmentShader: line_arcmini_frag,\n triangulation: LineArcTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n segmentNumber,\n }),\n ];\n }\n\n protected registerBuiltinAttributes() {\n // point layer size;\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: 1,\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 as number];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'instance', // 弧线起始点信息\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Instance',\n buffer: {\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4], vertex[5], vertex[6]];\n },\n },\n });\n }\n}\n"],"file":"arcmini.js"}
@@ -1,11 +0,0 @@
1
- import { IModel, IModelUniform } from '@antv/l7-core';
2
- import BaseModel from '../../core/BaseModel';
3
- export default class IconeModel extends BaseModel {
4
- private texture;
5
- getUninforms(): IModelUniform;
6
- initModels(): IModel[];
7
- clearModels(): void;
8
- protected registerBuiltinAttributes(): void;
9
- private updateTexture;
10
- private initIconFontGlyphs;
11
- }
@@ -1,181 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
- 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; } }
12
-
13
- import { AttributeType, gl } from '@antv/l7-core';
14
- import BaseModel from '../../core/BaseModel';
15
- import { PointImageTriangulation } from '../../core/triangulation';
16
- var pointImageFrag = "\nuniform sampler2D u_texture;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nuniform vec2 u_textSize;\nuniform float u_opacity : 1;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main(){\n float opacity = styleMappingMat[0][0];\n float size = styleMappingMat[1][0];\n vec2 pos = v_uv / u_textSize + gl_PointCoord / u_textSize * 64.;\n vec4 textureColor;\n\n // Y = 0.299R + 0.587G + 0.114B // \u4EAE\u5EA6\u63D0\u53D6\n \n textureColor = texture2D(u_texture, pos);\n\n // Tip: \u53BB\u9664\u8FB9\u7F18\u90E8\u5206 mipmap \u5BFC\u81F4\u7684\u6DF7\u5408\u53D8\u6697\n float fragmengTocenter = distance(vec2(0.5), gl_PointCoord);\n if(fragmengTocenter >= 0.5) {\n float luma = 0.299 * textureColor.r + 0.587 * textureColor.g + 0.114 * textureColor.b;\n textureColor.a *= luma;\n }\n \n \n\n if(all(lessThan(v_color, vec4(1.0+0.00001))) && all(greaterThan(v_color, vec4(1.0-0.00001))) || v_color==vec4(1.0)){\n gl_FragColor= textureColor;\n }else {\n gl_FragColor= step(0.01, textureColor.z) * v_color;\n }\n\n gl_FragColor.a = gl_FragColor.a * opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
17
- var pointImageVert = "precision highp float;\nattribute vec3 a_Position;\nattribute vec4 a_Color;\nattribute vec2 a_Uv;\nattribute float a_Size;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec2 u_offsets;\n\nuniform float u_opacity : 1;\n\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\n#pragma include \"projection\"\n#pragma include \"picking\"\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\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\n styleMappingMat[1][0] = a_Size;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n v_color = a_Color;\n v_uv = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n \n // vec2 offset = project_pixel(u_offsets);\n vec2 offset = project_pixel(textrueOffsets);\n\n // gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy + offset),project_pos.z, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(vec2(project_pos.xy + offset),project_pos.z, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy + offset),project_pos.z, 1.0));\n }\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n\n setPickingColor(a_PickingColor);\n}\n";
18
-
19
- var IconeModel = function (_BaseModel) {
20
- _inherits(IconeModel, _BaseModel);
21
-
22
- var _super = _createSuper(IconeModel);
23
-
24
- function IconeModel() {
25
- var _this;
26
-
27
- _classCallCheck(this, IconeModel);
28
-
29
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
- args[_key] = arguments[_key];
31
- }
32
-
33
- _this = _super.call.apply(_super, [this].concat(args));
34
-
35
- _defineProperty(_assertThisInitialized(_this), "texture", void 0);
36
-
37
- return _this;
38
- }
39
-
40
- _createClass(IconeModel, [{
41
- key: "getUninforms",
42
- value: function getUninforms() {
43
- var _ref = this.layer.getLayerConfig(),
44
- opacity = _ref.opacity;
45
-
46
- return {
47
- u_opacity: opacity || 1.0,
48
- u_texture: this.texture,
49
- u_textSize: [1024, this.iconService.canvasHeight || 128]
50
- };
51
- }
52
- }, {
53
- key: "initModels",
54
- value: function initModels() {
55
- var _this2 = this;
56
-
57
- this.initIconFontGlyphs();
58
- this.registerBuiltinAttributes();
59
- this.updateTexture();
60
- this.iconService.on('imageUpdate', function () {
61
- _this2.updateTexture();
62
-
63
- _this2.layer.render();
64
- });
65
- return [this.layer.buildLayerModel({
66
- moduleName: 'pointiconImage',
67
- vertexShader: pointImageVert,
68
- fragmentShader: pointImageFrag,
69
- triangulation: PointImageTriangulation,
70
- primitive: gl.POINTS,
71
- depth: {
72
- enable: false
73
- },
74
- blend: this.getBlend()
75
- })];
76
- }
77
- }, {
78
- key: "clearModels",
79
- value: function clearModels() {
80
- var _this$dataTexture;
81
-
82
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
83
- }
84
- }, {
85
- key: "registerBuiltinAttributes",
86
- value: function registerBuiltinAttributes() {
87
- var _this3 = this;
88
-
89
- this.styleAttributeService.registerStyleAttribute({
90
- name: 'size',
91
- type: AttributeType.Attribute,
92
- descriptor: {
93
- name: 'a_Size',
94
- buffer: {
95
- usage: gl.DYNAMIC_DRAW,
96
- data: [],
97
- type: gl.FLOAT
98
- },
99
- size: 1,
100
- update: function update(feature, featureIdx, vertex, attributeIdx) {
101
- var size = feature.size;
102
- return Array.isArray(size) ? [size[0]] : [size];
103
- }
104
- }
105
- });
106
- this.styleAttributeService.registerStyleAttribute({
107
- name: 'uv',
108
- type: AttributeType.Attribute,
109
- descriptor: {
110
- name: 'a_Uv',
111
- buffer: {
112
- usage: gl.DYNAMIC_DRAW,
113
- data: [],
114
- type: gl.FLOAT
115
- },
116
- size: 2,
117
- update: function update(feature, featureIdx, vertex, attributeIdx) {
118
- var mapping = _this3.fontService.mapping;
119
- var shape = feature.shape;
120
-
121
- var icon = _this3.fontService.getGlyph(shape);
122
-
123
- var _mapping$icon = mapping[icon],
124
- x = _mapping$icon.x,
125
- y = _mapping$icon.y;
126
- return [x, y];
127
- }
128
- }
129
- });
130
- }
131
- }, {
132
- key: "updateTexture",
133
- value: function updateTexture() {
134
- var createTexture2D = this.rendererService.createTexture2D;
135
- var canvas = this.fontService.canvas;
136
- this.texture = createTexture2D({
137
- data: canvas,
138
- mag: gl.LINEAR,
139
- min: gl.LINEAR,
140
- width: canvas.width,
141
- height: canvas.height
142
- });
143
- }
144
- }, {
145
- key: "initIconFontGlyphs",
146
- value: function initIconFontGlyphs() {
147
- var _this4 = this;
148
-
149
- var _ref2 = this.layer.getLayerConfig(),
150
- _ref2$fontWeight = _ref2.fontWeight,
151
- fontWeight = _ref2$fontWeight === void 0 ? 'normal' : _ref2$fontWeight,
152
- _ref2$fontFamily = _ref2.fontFamily,
153
- fontFamily = _ref2$fontFamily === void 0 ? 'sans-serif' : _ref2$fontFamily;
154
-
155
- var data = this.layer.getEncodedData();
156
- var characterSet = [];
157
- data.forEach(function (item) {
158
- var _item$shape = item.shape,
159
- shape = _item$shape === void 0 ? '' : _item$shape;
160
- shape = shape.toString();
161
-
162
- var icon = _this4.fontService.getGlyph(shape);
163
-
164
- if (characterSet.indexOf(icon) === -1) {
165
- characterSet.push(icon);
166
- }
167
- });
168
- this.fontService.setFontOptions({
169
- characterSet: characterSet,
170
- fontWeight: fontWeight,
171
- fontFamily: fontFamily,
172
- fontSize: 48
173
- });
174
- }
175
- }]);
176
-
177
- return IconeModel;
178
- }(BaseModel);
179
-
180
- export { IconeModel as default };
181
- //# sourceMappingURL=icon-font.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/point/models/icon-font.ts"],"names":["AttributeType","gl","BaseModel","PointImageTriangulation","IconeModel","layer","getLayerConfig","opacity","u_opacity","u_texture","texture","u_textSize","iconService","canvasHeight","initIconFontGlyphs","registerBuiltinAttributes","updateTexture","on","render","buildLayerModel","moduleName","vertexShader","pointImageVert","fragmentShader","pointImageFrag","triangulation","primitive","POINTS","depth","enable","blend","getBlend","dataTexture","destroy","styleAttributeService","registerStyleAttribute","name","type","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","data","FLOAT","size","update","feature","featureIdx","vertex","attributeIdx","Array","isArray","mapping","fontService","shape","icon","getGlyph","x","y","createTexture2D","rendererService","canvas","mag","LINEAR","min","width","height","fontWeight","fontFamily","getEncodedData","characterSet","forEach","item","toString","indexOf","push","setFontOptions","fontSize"],"mappings":";;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAOO,eAPP;AASA,OAAOC,SAAP,MAAsB,sBAAtB;AACA,SAASC,uBAAT,QAAwC,0BAAxC;;;;IASqBC,U;;;;;;;;;;;;;;;;;;;;;;;WAGnB,wBAAqC;AACnC,iBAAoB,KAAKC,KAAL,CAAWC,cAAX,EAApB;AAAA,UAAQC,OAAR,QAAQA,OAAR;;AACA,aAAO;AACLC,QAAAA,SAAS,EAAED,OAAO,IAAI,GADjB;AAELE,QAAAA,SAAS,EAAE,KAAKC,OAFX;AAGLC,QAAAA,UAAU,EAAE,CAAC,IAAD,EAAO,KAAKC,WAAL,CAAiBC,YAAjB,IAAiC,GAAxC;AAHP,OAAP;AAKD;;;WAED,sBAA8B;AAAA;;AAC5B,WAAKC,kBAAL;AACA,WAAKC,yBAAL;AACA,WAAKC,aAAL;AACA,WAAKJ,WAAL,CAAiBK,EAAjB,CAAoB,aAApB,EAAmC,YAAM;AACvC,QAAA,MAAI,CAACD,aAAL;;AACA,QAAA,MAAI,CAACX,KAAL,CAAWa,MAAX;AACD,OAHD;AAIA,aAAO,CACL,KAAKb,KAAL,CAAWc,eAAX,CAA2B;AACzBC,QAAAA,UAAU,EAAE,gBADa;AAEzBC,QAAAA,YAAY,EAAEC,cAFW;AAGzBC,QAAAA,cAAc,EAAEC,cAHS;AAIzBC,QAAAA,aAAa,EAAEtB,uBAJU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I,CAAC6B,OAAL,CAAa,UAACC,IAAD,EAA0B;AACrC,0BAAqBA,IAArB,CAAMlB,KAAN;AAAA,YAAMA,KAAN,4BAAc,EAAd;AACAA,QAAAA,KAAK,GAAGA,KAAK,CAACmB,QAAN,EAAR;;AACA,YAAMlB,IAAI,GAAG,MAAI,CAACF,WAAL,CAAiBG,QAAjB,CAA0BF,KAA1B,CAAb;;AACA,YAAIgB,YAAY,CAACI,OAAb,CAAqBnB,IAArB,MAA+B,CAAC,CAApC,EAAuC;AACrCe,UAAAA,YAAY,CAACK,IAAb,CAAkBpB,IAAlB;AACD;AACF,OAPD;AAQA,WAAKF,WAAL,CAAiBuB,cAAjB,CAAgC;AAC9BN,QAAAA,YAAY,EAAZA,YAD8B;AAE9BH,QAAAA,UAAU,EAAVA,UAF8B;AAG9BC,QAAAA,UAAU,EAAVA,UAH8B;AAI9BS,QAAAA,QAAQ,EAAE;AAJoB,OAAhC;AAMD;;;;EA7HqC5E,S;;SAAnBE,U","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\n\nimport BaseModel from '../../core/BaseModel';\nimport { PointImageTriangulation } from '../../core/triangulation';\nimport pointImageFrag from '../shaders/image_frag.glsl';\nimport pointImageVert from '../shaders/image_vert.glsl';\ninterface IIconIFontStyleOptions {\n opacity: number;\n fontWeight: string;\n fontFamily: string;\n}\n\nexport default class IconeModel extends BaseModel {\n private texture: ITexture2D;\n\n public getUninforms(): IModelUniform {\n const { opacity } = this.layer.getLayerConfig() as IIconIFontStyleOptions;\n return {\n u_opacity: opacity || 1.0,\n u_texture: this.texture,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n };\n }\n\n public initModels(): IModel[] {\n this.initIconFontGlyphs();\n this.registerBuiltinAttributes();\n this.updateTexture();\n this.iconService.on('imageUpdate', () => {\n this.updateTexture();\n this.layer.render(); // TODO 调用全局render\n });\n return [\n this.layer.buildLayerModel({\n moduleName: 'pointiconImage',\n vertexShader: pointImageVert,\n fragmentShader: pointImageFrag,\n triangulation: PointImageTriangulation,\n primitive: gl.POINTS,\n depth: { enable: false },\n blend: this.getBlend(),\n }),\n ];\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n protected registerBuiltinAttributes() {\n // point layer size;\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: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size } = feature;\n return Array.isArray(size) ? [size[0]] : [size as number];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Uv',\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 { mapping } = this.fontService;\n const { shape } = feature;\n const icon = this.fontService.getGlyph(shape as string);\n const { x, y } = mapping[icon];\n return [x, y];\n },\n },\n });\n }\n\n private updateTexture() {\n const { createTexture2D } = this.rendererService;\n const { canvas } = this.fontService;\n this.texture = createTexture2D({\n data: canvas,\n mag: gl.LINEAR,\n min: gl.LINEAR,\n width: canvas.width,\n height: canvas.height,\n });\n }\n\n private initIconFontGlyphs() {\n const {\n fontWeight = 'normal',\n fontFamily = 'sans-serif',\n } = this.layer.getLayerConfig() as IIconIFontStyleOptions;\n const data = this.layer.getEncodedData();\n const characterSet: string[] = [];\n data.forEach((item: IEncodeFeature) => {\n let { shape = '' } = item;\n shape = shape.toString();\n const icon = this.fontService.getGlyph(shape);\n if (characterSet.indexOf(icon) === -1) {\n characterSet.push(icon);\n }\n });\n this.fontService.setFontOptions({\n characterSet,\n fontWeight,\n fontFamily,\n fontSize: 48,\n });\n }\n}\n"],"file":"icon-font.js"}
File without changes
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=image.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"image.js"}
@@ -1,27 +0,0 @@
1
- import { ITexture2D } from '@antv/l7-core';
2
- import { IColorRamp } from '@antv/l7-utils';
3
- import BaseLayer from '../core/BaseLayer';
4
- interface IRasterLayerStyleOptions {
5
- opacity: number;
6
- min: number;
7
- max: number;
8
- rampColors: IColorRamp;
9
- }
10
- export default class Raster2dLayer extends BaseLayer<IRasterLayerStyleOptions> {
11
- type: string;
12
- protected rasterTexture: ITexture2D;
13
- protected colorTexture: ITexture2D;
14
- buildModels(): void;
15
- renderModels(): this;
16
- protected getConfigSchema(): {
17
- properties: {
18
- opacity: {
19
- type: string;
20
- minimum: number;
21
- maximum: number;
22
- };
23
- };
24
- };
25
- private registerBuiltinAttributes;
26
- }
27
- export {};
@@ -1,158 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
- 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; } }
12
-
13
- import { AttributeType, gl } from '@antv/l7-core';
14
- import { generateColorRamp } from '@antv/l7-utils';
15
- import BaseLayer from '../core/BaseLayer';
16
- import { RasterImageTriangulation } from '../core/triangulation';
17
- var rasterImageFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\nuniform float u_min;\nuniform float u_max;\nuniform vec2 u_domain;\nuniform float u_noDataValue;\nuniform bool u_clampLow: true;\nuniform bool u_clampHigh: true;\nvarying vec2 v_texCoord;\n\nvoid main() {\n\n float value = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).r;\n if (value == u_noDataValue)\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1]))\n gl_FragColor = vec4(0, 0, 0, 0);\n else {\n float normalisedValue =(value - u_domain[0]) / (u_domain[1] -u_domain[0]);\n vec4 color = texture2D(u_colorTexture,vec2(normalisedValue, 0));\n gl_FragColor = color;\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n }\n\n\n}\n";
18
- var rasterImageVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
19
-
20
- var Raster2dLayer = function (_BaseLayer) {
21
- _inherits(Raster2dLayer, _BaseLayer);
22
-
23
- var _super = _createSuper(Raster2dLayer);
24
-
25
- function Raster2dLayer() {
26
- var _this;
27
-
28
- _classCallCheck(this, Raster2dLayer);
29
-
30
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31
- args[_key] = arguments[_key];
32
- }
33
-
34
- _this = _super.call.apply(_super, [this].concat(args));
35
-
36
- _defineProperty(_assertThisInitialized(_this), "type", 'RasterLayer');
37
-
38
- _defineProperty(_assertThisInitialized(_this), "rasterTexture", void 0);
39
-
40
- _defineProperty(_assertThisInitialized(_this), "colorTexture", void 0);
41
-
42
- return _this;
43
- }
44
-
45
- _createClass(Raster2dLayer, [{
46
- key: "buildModels",
47
- value: function buildModels() {
48
- this.registerBuiltinAttributes();
49
- var source = this.getSource();
50
- var createTexture2D = this.rendererService.createTexture2D;
51
- var parserDataItem = this.getSource().data.dataArray[0];
52
- this.rasterTexture = createTexture2D({
53
- data: parserDataItem.data,
54
- width: parserDataItem.width,
55
- height: parserDataItem.height,
56
- format: gl.LUMINANCE,
57
- type: gl.FLOAT,
58
- aniso: 4
59
- });
60
-
61
- var _this$getLayerConfig = this.getLayerConfig(),
62
- rampColors = _this$getLayerConfig.rampColors;
63
-
64
- var imageData = generateColorRamp(rampColors);
65
- this.colorTexture = createTexture2D({
66
- data: imageData.data,
67
- width: imageData.width,
68
- height: imageData.height,
69
- flipY: false
70
- });
71
- this.models = [this.buildLayerModel({
72
- moduleName: 'Raster3DImage',
73
- vertexShader: rasterImageVert,
74
- fragmentShader: rasterImageFrag,
75
- triangulation: RasterImageTriangulation,
76
- primitive: gl.TRIANGLES,
77
- depth: {
78
- enable: false
79
- },
80
- blend: {
81
- enable: true,
82
- func: {
83
- srcRGB: gl.SRC_ALPHA,
84
- srcAlpha: 1,
85
- dstRGB: gl.ONE_MINUS_SRC_ALPHA,
86
- dstAlpha: 1
87
- }
88
- }
89
- })];
90
- }
91
- }, {
92
- key: "renderModels",
93
- value: function renderModels() {
94
- var _this2 = this;
95
-
96
- var _this$getLayerConfig2 = this.getLayerConfig(),
97
- opacity = _this$getLayerConfig2.opacity;
98
-
99
- var parserDataItem = this.getSource().data.dataArray[0];
100
- var min = parserDataItem.min,
101
- max = parserDataItem.max;
102
-
103
- if (this.rasterTexture) {
104
- this.models.forEach(function (model) {
105
- return model.draw({
106
- uniforms: {
107
- u_opacity: opacity || 1,
108
- u_texture: _this2.rasterTexture,
109
- u_min: min,
110
- u_max: max,
111
- u_colorTexture: _this2.colorTexture
112
- }
113
- });
114
- });
115
- }
116
-
117
- return this;
118
- }
119
- }, {
120
- key: "getConfigSchema",
121
- value: function getConfigSchema() {
122
- return {
123
- properties: {
124
- opacity: {
125
- type: 'number',
126
- minimum: 0,
127
- maximum: 1
128
- }
129
- }
130
- };
131
- }
132
- }, {
133
- key: "registerBuiltinAttributes",
134
- value: function registerBuiltinAttributes() {
135
- this.styleAttributeService.registerStyleAttribute({
136
- name: 'uv',
137
- type: AttributeType.Attribute,
138
- descriptor: {
139
- name: 'a_Uv',
140
- buffer: {
141
- usage: gl.DYNAMIC_DRAW,
142
- data: [],
143
- type: gl.FLOAT
144
- },
145
- size: 2,
146
- update: function update(feature, featureIdx, vertex, attributeIdx) {
147
- return [vertex[3], vertex[4]];
148
- }
149
- }
150
- });
151
- }
152
- }]);
153
-
154
- return Raster2dLayer;
155
- }(BaseLayer);
156
-
157
- export { Raster2dLayer as default };
158
- //# sourceMappingURL=raster2d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/raster/raster2d.ts"],"names":["AttributeType","gl","generateColorRamp","BaseLayer","RasterImageTriangulation","Raster2dLayer","registerBuiltinAttributes","source","getSource","createTexture2D","rendererService","parserDataItem","data","dataArray","rasterTexture","width","height","format","LUMINANCE","type","FLOAT","aniso","getLayerConfig","rampColors","imageData","colorTexture","flipY","models","buildLayerModel","moduleName","vertexShader","rasterImageVert","fragmentShader","rasterImageFrag","triangulation","primitive","TRIANGLES","depth","enable","blend","func","srcRGB","SRC_ALPHA","srcAlpha","dstRGB","ONE_MINUS_SRC_ALPHA","dstAlpha","opacity","min","max","forEach","model","draw","uniforms","u_opacity","u_texture","u_min","u_max","u_colorTexture","properties","minimum","maximum","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx"],"mappings":";;;;;;;;;;;;AAAA,SAASA,aAAT,EAAwBC,EAAxB,QAA8D,eAA9D;AACA,SAASC,iBAAT,QAA8C,gBAA9C;AACA,OAAOC,SAAP,MAAsB,mBAAtB;AACA,SAASC,wBAAT,QAAyC,uBAAzC;;;;IAUqBC,a;;;;;;;;;;;;;;;;2DACG,a;;;;;;;;;;;WAItB,uBAAqB;AACnB,WAAKC,yBAAL;AACA,UAAMC,MAAM,GAAG,KAAKC,SAAL,EAAf;AACA,UAAQC,eAAR,GAA4B,KAAKC,eAAjC,CAAQD,eAAR;AACA,UAAME,cAAc,GAAG,KAAKH,SAAL,GAAiBI,IAAjB,CAAsBC,SAAtB,CAAgC,CAAhC,CAAvB;AACA,WAAKC,aAAL,GAAqBL,eAAe,CAAC;AACnCG,QAAAA,IAAI,EAAED,cAAc,CAACC,IADc;AAEnCG,QAAAA,KAAK,EAAEJ,cAAc,CAACI,KAFa;AAGnCC,QAAAA,MAAM,EAAEL,cAAc,CAACK,MAHY;AAInCC,QAAAA,MAAM,EAAEhB,EAAE,CAACiB,SAJwB;AAKnCC,QAAAA,IAAI,EAAElB,EAAE,CAACmB,KAL0B;AAMnCC,QAAAA,KAAK,EAAE;AAN4B,OAAD,CAApC;;AAQA,iCAAuB,KAAKC,cAAL,EAAvB;AAAA,UAAQC,UAAR,wBAAQA,UAAR;;AACA,UAAMC,SAAS,GAAGtB,iBAAiB,CAACqB,UAAD,CAAnC;AACA,WAAKE,YAAL,GAAoBhB,eAAe,CAAC;AAClCG,QAAAA,IAAI,EAAEY,SAAS,CAACZ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AS,EAAE,MAAI,CAACzC,aAFR;AAGR0C,cAAAA,KAAK,EAAER,GAHC;AAIRS,cAAAA,KAAK,EAAER,GAJC;AAKRS,cAAAA,cAAc,EAAE,MAAI,CAACjC;AALb;AADD,WAAX,CADkB;AAAA,SAApB;AAWD;;AAED,aAAO,IAAP;AACD;;;WAED,2BAA4B;AAC1B,aAAO;AACLkC,QAAAA,UAAU,EAAE;AACVZ,UAAAA,OAAO,EAAE;AACP5B,YAAAA,IAAI,EAAE,QADC;AAEPyC,YAAAA,OAAO,EAAE,CAFF;AAGPC,YAAAA,OAAO,EAAE;AAHF;AADC;AADP,OAAP;AASD;;;WAED,qCAAoC;AAElC,WAAKC,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,IAD0C;AAEhD7C,QAAAA,IAAI,EAAEnB,aAAa,CAACiE,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,MADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEnE,EAAE,CAACoE,YAFJ;AAGNzD,YAAAA,IAAI,EAAE,EAHA;AAINO,YAAAA,IAAI,EAAElB,EAAE,CAACmB;AAJH,WAFE;AAQVkD,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,EAAYA,MAAM,CAAC,CAAD,CAAlB,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAsBD;;;;EAvGwCvE,S;;SAAtBE,a","sourcesContent":["import { AttributeType, gl, IEncodeFeature, ITexture2D } from '@antv/l7-core';\nimport { generateColorRamp, IColorRamp } from '@antv/l7-utils';\nimport BaseLayer from '../core/BaseLayer';\nimport { RasterImageTriangulation } from '../core/triangulation';\nimport rasterImageFrag from './shaders/raster_2d_frag.glsl';\nimport rasterImageVert from './shaders/raster_2d_vert.glsl';\ninterface IRasterLayerStyleOptions {\n opacity: number;\n min: number;\n max: number;\n rampColors: IColorRamp;\n}\n\nexport default class Raster2dLayer extends BaseLayer<IRasterLayerStyleOptions> {\n public type: string = 'RasterLayer';\n protected rasterTexture: ITexture2D;\n protected colorTexture: ITexture2D;\n\n public buildModels() {\n this.registerBuiltinAttributes();\n const source = this.getSource();\n const { createTexture2D } = this.rendererService;\n const parserDataItem = this.getSource().data.dataArray[0];\n this.rasterTexture = createTexture2D({\n data: parserDataItem.data,\n width: parserDataItem.width,\n height: parserDataItem.height,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n aniso: 4,\n });\n const { rampColors } = this.getLayerConfig();\n const imageData = generateColorRamp(rampColors as IColorRamp);\n this.colorTexture = createTexture2D({\n data: imageData.data,\n width: imageData.width,\n height: imageData.height,\n flipY: false,\n });\n this.models = [\n this.buildLayerModel({\n moduleName: 'Raster3DImage',\n vertexShader: rasterImageVert,\n fragmentShader: rasterImageFrag,\n triangulation: RasterImageTriangulation,\n primitive: gl.TRIANGLES,\n depth: { enable: false },\n blend: {\n enable: true,\n func: {\n srcRGB: gl.SRC_ALPHA,\n srcAlpha: 1,\n dstRGB: gl.ONE_MINUS_SRC_ALPHA,\n dstAlpha: 1,\n },\n },\n }),\n ];\n }\n public renderModels() {\n const { opacity } = this.getLayerConfig();\n const parserDataItem = this.getSource().data.dataArray[0];\n const { min, max } = parserDataItem;\n if (this.rasterTexture) {\n this.models.forEach((model) =>\n model.draw({\n uniforms: {\n u_opacity: opacity || 1,\n u_texture: this.rasterTexture,\n u_min: min,\n u_max: max,\n u_colorTexture: this.colorTexture,\n },\n }),\n );\n }\n\n return this;\n }\n\n protected getConfigSchema() {\n return {\n properties: {\n opacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n },\n },\n };\n }\n\n private registerBuiltinAttributes() {\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Uv',\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 return [vertex[3], vertex[4]];\n },\n },\n });\n }\n}\n"],"file":"raster2d.js"}
package/es/utils/geo.d.ts DELETED
@@ -1,12 +0,0 @@
1
- declare type Position = number[];
2
- export declare function calculateCentroid(coord: Position | Position[] | Position[][]): Position;
3
- /**
4
- * 计算
5
- * @param points
6
- * @returns
7
- */
8
- export declare function calculatePointsCenterAndRadius(points: number[]): {
9
- center: number[];
10
- radius: number;
11
- };
12
- export {};