@antv/l7-layers 2.21.0 → 2.21.2

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 (397) hide show
  1. package/es/canvas/index.js +60 -113
  2. package/es/canvas/models/canvas.js +95 -135
  3. package/es/canvas/models/constants.js +1 -1
  4. package/es/citybuliding/building.js +20 -58
  5. package/es/citybuliding/models/build.js +142 -199
  6. package/es/core/BaseLayer.d.ts +2 -1
  7. package/es/core/BaseLayer.js +1113 -1405
  8. package/es/core/BaseModel.js +262 -318
  9. package/es/core/CommonStyleAttribute.js +25 -18
  10. package/es/core/LayerPickService.js +92 -142
  11. package/es/core/TextureService.js +58 -69
  12. package/es/core/constant.js +2 -2
  13. package/es/core/interface.js +5 -5
  14. package/es/core/line_trangluation.js +38 -43
  15. package/es/core/shape/Path.js +21 -13
  16. package/es/core/shape/arrow.js +50 -62
  17. package/es/core/shape/extrude.js +54 -63
  18. package/es/core/triangulation.js +192 -171
  19. package/es/core/utils.js +5 -5
  20. package/es/earth/index.js +35 -73
  21. package/es/earth/models/atmosphere.js +98 -148
  22. package/es/earth/models/base.js +148 -202
  23. package/es/earth/models/bloomsphere.js +97 -147
  24. package/es/earth/utils.js +37 -38
  25. package/es/geometry/index.js +36 -75
  26. package/es/geometry/models/billboard.js +147 -204
  27. package/es/geometry/models/index.js +1 -1
  28. package/es/geometry/models/plane.js +277 -357
  29. package/es/geometry/models/sprite.js +182 -240
  30. package/es/heatmap/index.js +72 -122
  31. package/es/heatmap/models/grid.js +66 -118
  32. package/es/heatmap/models/grid3d.js +101 -151
  33. package/es/heatmap/models/heatmap.js +398 -455
  34. package/es/heatmap/models/hexagon.js +67 -119
  35. package/es/heatmap/models/index.js +1 -1
  36. package/es/heatmap/triangulation.js +20 -20
  37. package/es/image/index.js +23 -62
  38. package/es/image/models/image.js +99 -163
  39. package/es/image/models/index.js +1 -1
  40. package/es/line/index.js +65 -106
  41. package/es/line/models/arc.js +200 -248
  42. package/es/line/models/arc_3d.js +190 -242
  43. package/es/line/models/flow.js +101 -153
  44. package/es/line/models/great_circle.js +183 -234
  45. package/es/line/models/index.js +1 -1
  46. package/es/line/models/line.js +232 -288
  47. package/es/line/models/simple_line.js +142 -192
  48. package/es/line/models/wall.js +221 -273
  49. package/es/line/shaders/line/line_vert.glsl +0 -2
  50. package/es/line/shaders/wall/wall_vert.glsl +15 -0
  51. package/es/mask/index.js +16 -53
  52. package/es/mask/models/fill.js +51 -108
  53. package/es/mask/models/index.js +1 -1
  54. package/es/plugins/DataMappingPlugin.js +205 -251
  55. package/es/plugins/DataSourcePlugin.js +64 -92
  56. package/es/plugins/FeatureScalePlugin.js +258 -302
  57. package/es/plugins/LayerAnimateStylePlugin.js +12 -22
  58. package/es/plugins/LayerMaskPlugin.js +15 -24
  59. package/es/plugins/LayerModelPlugin.js +52 -136
  60. package/es/plugins/LayerStylePlugin.js +14 -23
  61. package/es/plugins/LightingPlugin.js +26 -37
  62. package/es/plugins/MultiPassRendererPlugin.js +34 -39
  63. package/es/plugins/PixelPickingPlugin.js +129 -151
  64. package/es/plugins/RegisterStyleAttributePlugin.js +80 -96
  65. package/es/plugins/ShaderUniformPlugin.js +159 -131
  66. package/es/plugins/UpdateModelPlugin.js +16 -26
  67. package/es/plugins/UpdateStyleAttributePlugin.js +47 -65
  68. package/es/point/index.js +118 -182
  69. package/es/point/models/billboard_point.js +72 -127
  70. package/es/point/models/earthExtrude.js +170 -220
  71. package/es/point/models/earthFill.js +136 -192
  72. package/es/point/models/extrude.js +167 -217
  73. package/es/point/models/fill.js +153 -210
  74. package/es/point/models/fillImage.js +156 -211
  75. package/es/point/models/image.js +127 -180
  76. package/es/point/models/index.js +1 -1
  77. package/es/point/models/normal.js +67 -122
  78. package/es/point/models/radar.js +93 -148
  79. package/es/point/models/text.js +447 -578
  80. package/es/point/shape/extrude.js +19 -25
  81. package/es/polygon/index.js +61 -99
  82. package/es/polygon/models/extrude.js +208 -281
  83. package/es/polygon/models/extrusion.js +95 -142
  84. package/es/polygon/models/fill.js +103 -155
  85. package/es/polygon/models/index.js +1 -2
  86. package/es/polygon/models/ocean.js +139 -198
  87. package/es/polygon/models/water.js +120 -179
  88. package/es/raster/buffers/triangulation.js +13 -11
  89. package/es/raster/index.js +47 -88
  90. package/es/raster/models/index.js +1 -1
  91. package/es/raster/models/raster.js +134 -202
  92. package/es/raster/models/rasterRgb.js +134 -208
  93. package/es/raster/models/rasterTerrainRgb.js +98 -153
  94. package/es/tile/core/BaseLayer.d.ts +1 -0
  95. package/es/tile/core/BaseLayer.js +206 -282
  96. package/es/tile/core/TileDebugLayer.js +12 -46
  97. package/es/tile/interaction/getRasterData.js +24 -31
  98. package/es/tile/interaction/utils.js +15 -33
  99. package/es/tile/service/TileLayerService.js +104 -177
  100. package/es/tile/service/TilePickService.js +99 -156
  101. package/es/tile/service/TileSourceService.js +17 -26
  102. package/es/tile/tile/DebugTile.js +41 -78
  103. package/es/tile/tile/ImageTile.js +33 -66
  104. package/es/tile/tile/MaskTile.js +47 -81
  105. package/es/tile/tile/RasterRGBTile.js +40 -71
  106. package/es/tile/tile/RasterTerrainRGBTile.js +33 -66
  107. package/es/tile/tile/RasterTile.js +69 -104
  108. package/es/tile/tile/Tile.d.ts +1 -1
  109. package/es/tile/tile/Tile.js +151 -232
  110. package/es/tile/tile/VectorTile.js +77 -124
  111. package/es/tile/tile/index.js +4 -2
  112. package/es/tile/utils/constants.js +1 -1
  113. package/es/tile/utils/utils.js +2 -2
  114. package/es/utils/blend.js +52 -47
  115. package/es/utils/collision-index.js +62 -70
  116. package/es/utils/extrude_polyline.js +441 -471
  117. package/es/utils/grid-index.js +97 -123
  118. package/es/utils/identityScale.js +5 -5
  119. package/es/utils/load-image.js +15 -39
  120. package/es/utils/multiPassRender.js +7 -9
  121. package/es/utils/polylineNormal.js +40 -43
  122. package/es/utils/rampcolor_legend.js +5 -4
  123. package/es/utils/simpleLine.js +53 -66
  124. package/es/utils/symbol-layout.js +95 -117
  125. package/es/wind/index.js +28 -71
  126. package/es/wind/models/index.js +1 -1
  127. package/es/wind/models/utils.js +36 -34
  128. package/es/wind/models/wind.js +203 -260
  129. package/es/wind/models/windRender.js +258 -269
  130. package/es/wind/models/windShader.js +145 -6
  131. package/lib/canvas/index.d.ts +18 -0
  132. package/lib/canvas/index.js +64 -113
  133. package/lib/canvas/models/canvas.d.ts +23 -0
  134. package/lib/canvas/models/canvas.js +97 -136
  135. package/lib/canvas/models/constants.d.ts +2 -0
  136. package/lib/canvas/models/constants.js +1 -1
  137. package/lib/canvas/models/index.d.ts +2 -0
  138. package/lib/canvas/models/index.js +2 -2
  139. package/lib/citybuliding/building.d.ts +7 -0
  140. package/lib/citybuliding/building.js +22 -58
  141. package/lib/citybuliding/models/build.d.ts +17 -0
  142. package/lib/citybuliding/models/build.js +144 -199
  143. package/lib/core/BaseLayer.d.ts +247 -0
  144. package/lib/core/BaseLayer.js +1115 -1405
  145. package/lib/core/BaseModel.d.ts +82 -0
  146. package/lib/core/BaseModel.js +262 -316
  147. package/lib/core/CommonStyleAttribute.d.ts +20 -0
  148. package/lib/core/CommonStyleAttribute.js +25 -18
  149. package/lib/core/LayerPickService.d.ts +12 -0
  150. package/lib/core/LayerPickService.js +93 -141
  151. package/lib/core/TextureService.d.ts +15 -0
  152. package/lib/core/TextureService.js +59 -68
  153. package/lib/core/constant.d.ts +6 -0
  154. package/lib/core/constant.js +2 -2
  155. package/lib/core/interface.d.ts +282 -0
  156. package/lib/core/interface.js +5 -5
  157. package/lib/core/line_trangluation.d.ts +19 -0
  158. package/lib/core/line_trangluation.js +38 -43
  159. package/lib/core/schema.d.ts +27 -0
  160. package/lib/core/shape/Path.d.ts +39 -0
  161. package/lib/core/shape/Path.js +21 -14
  162. package/lib/core/shape/arrow.d.ts +25 -0
  163. package/lib/core/shape/arrow.js +50 -62
  164. package/lib/core/shape/extrude.d.ts +17 -0
  165. package/lib/core/shape/extrude.js +54 -63
  166. package/lib/core/triangulation.d.ts +136 -0
  167. package/lib/core/triangulation.js +194 -174
  168. package/lib/core/utils.d.ts +4 -0
  169. package/lib/core/utils.js +5 -5
  170. package/lib/earth/index.d.ts +22 -0
  171. package/lib/earth/index.js +37 -73
  172. package/lib/earth/models/atmosphere.d.ts +15 -0
  173. package/lib/earth/models/atmosphere.js +100 -148
  174. package/lib/earth/models/base.d.ts +22 -0
  175. package/lib/earth/models/base.js +150 -202
  176. package/lib/earth/models/bloomsphere.d.ts +15 -0
  177. package/lib/earth/models/bloomsphere.js +99 -147
  178. package/lib/earth/utils.d.ts +26 -0
  179. package/lib/earth/utils.js +37 -39
  180. package/lib/geometry/index.d.ts +22 -0
  181. package/lib/geometry/index.js +38 -75
  182. package/lib/geometry/models/billboard.d.ts +24 -0
  183. package/lib/geometry/models/billboard.js +149 -204
  184. package/lib/geometry/models/index.d.ts +5 -0
  185. package/lib/geometry/models/index.js +1 -1
  186. package/lib/geometry/models/plane.d.ts +43 -0
  187. package/lib/geometry/models/plane.js +280 -357
  188. package/lib/geometry/models/sprite.d.ts +48 -0
  189. package/lib/geometry/models/sprite.js +184 -240
  190. package/lib/heatmap/index.d.ts +13 -0
  191. package/lib/heatmap/index.js +74 -122
  192. package/lib/heatmap/models/grid.d.ts +15 -0
  193. package/lib/heatmap/models/grid.js +68 -118
  194. package/lib/heatmap/models/grid3d.d.ts +15 -0
  195. package/lib/heatmap/models/grid3d.js +103 -151
  196. package/lib/heatmap/models/heatmap.d.ts +27 -0
  197. package/lib/heatmap/models/heatmap.js +400 -455
  198. package/lib/heatmap/models/hexagon.d.ts +15 -0
  199. package/lib/heatmap/models/hexagon.js +69 -119
  200. package/lib/heatmap/models/index.d.ts +5 -0
  201. package/lib/heatmap/models/index.js +1 -1
  202. package/lib/heatmap/triangulation.d.ts +5 -0
  203. package/lib/heatmap/triangulation.js +20 -20
  204. package/lib/image/index.d.ts +9 -0
  205. package/lib/image/index.js +25 -62
  206. package/lib/image/models/image.d.ts +17 -0
  207. package/lib/image/models/image.js +101 -163
  208. package/lib/image/models/index.d.ts +5 -0
  209. package/lib/image/models/index.js +1 -1
  210. package/lib/index.d.ts +18 -0
  211. package/lib/index.js +17 -17
  212. package/lib/line/index.d.ts +36 -0
  213. package/lib/line/index.js +67 -106
  214. package/lib/line/models/arc.d.ts +22 -0
  215. package/lib/line/models/arc.js +202 -248
  216. package/lib/line/models/arc_3d.d.ts +22 -0
  217. package/lib/line/models/arc_3d.js +193 -242
  218. package/lib/line/models/flow.d.ts +14 -0
  219. package/lib/line/models/flow.js +103 -153
  220. package/lib/line/models/great_circle.d.ts +17 -0
  221. package/lib/line/models/great_circle.js +185 -234
  222. package/lib/line/models/index.d.ts +5 -0
  223. package/lib/line/models/index.js +1 -1
  224. package/lib/line/models/line.d.ts +27 -0
  225. package/lib/line/models/line.js +233 -285
  226. package/lib/line/models/simple_line.d.ts +19 -0
  227. package/lib/line/models/simple_line.js +144 -192
  228. package/lib/line/models/wall.d.ts +17 -0
  229. package/lib/line/models/wall.js +223 -273
  230. package/lib/line/shaders/line/line_vert.glsl +0 -2
  231. package/lib/line/shaders/wall/wall_vert.glsl +15 -0
  232. package/lib/mask/index.d.ts +16 -0
  233. package/lib/mask/index.js +18 -53
  234. package/lib/mask/models/fill.d.ts +18 -0
  235. package/lib/mask/models/fill.js +53 -108
  236. package/lib/mask/models/index.d.ts +5 -0
  237. package/lib/mask/models/index.js +1 -1
  238. package/lib/plugins/DataMappingPlugin.d.ts +13 -0
  239. package/lib/plugins/DataMappingPlugin.js +206 -250
  240. package/lib/plugins/DataSourcePlugin.d.ts +6 -0
  241. package/lib/plugins/DataSourcePlugin.js +65 -91
  242. package/lib/plugins/FeatureScalePlugin.d.ts +20 -0
  243. package/lib/plugins/FeatureScalePlugin.js +261 -304
  244. package/lib/plugins/LayerAnimateStylePlugin.d.ts +4 -0
  245. package/lib/plugins/LayerAnimateStylePlugin.js +13 -21
  246. package/lib/plugins/LayerMaskPlugin.d.ts +7 -0
  247. package/lib/plugins/LayerMaskPlugin.js +16 -24
  248. package/lib/plugins/LayerModelPlugin.d.ts +10 -0
  249. package/lib/plugins/LayerModelPlugin.js +53 -135
  250. package/lib/plugins/LayerStylePlugin.d.ts +7 -0
  251. package/lib/plugins/LayerStylePlugin.js +15 -23
  252. package/lib/plugins/LightingPlugin.d.ts +35 -0
  253. package/lib/plugins/LightingPlugin.js +27 -36
  254. package/lib/plugins/MultiPassRendererPlugin.d.ts +22 -0
  255. package/lib/plugins/MultiPassRendererPlugin.js +35 -38
  256. package/lib/plugins/PixelPickingPlugin.d.ts +11 -0
  257. package/lib/plugins/PixelPickingPlugin.js +130 -150
  258. package/lib/plugins/RegisterStyleAttributePlugin.d.ts +11 -0
  259. package/lib/plugins/RegisterStyleAttributePlugin.js +81 -96
  260. package/lib/plugins/ShaderUniformPlugin.d.ts +22 -0
  261. package/lib/plugins/ShaderUniformPlugin.js +160 -130
  262. package/lib/plugins/UpdateModelPlugin.d.ts +7 -0
  263. package/lib/plugins/UpdateModelPlugin.js +17 -26
  264. package/lib/plugins/UpdateStyleAttributePlugin.d.ts +9 -0
  265. package/lib/plugins/UpdateStyleAttributePlugin.js +48 -65
  266. package/lib/plugins/index.d.ts +15 -0
  267. package/lib/point/index.d.ts +33 -0
  268. package/lib/point/index.js +120 -182
  269. package/lib/point/models/billboard_point.d.ts +21 -0
  270. package/lib/point/models/billboard_point.js +74 -127
  271. package/lib/point/models/earthExtrude.d.ts +16 -0
  272. package/lib/point/models/earthExtrude.js +172 -220
  273. package/lib/point/models/earthFill.d.ts +15 -0
  274. package/lib/point/models/earthFill.js +138 -192
  275. package/lib/point/models/extrude.d.ts +16 -0
  276. package/lib/point/models/extrude.js +169 -217
  277. package/lib/point/models/fill.d.ts +31 -0
  278. package/lib/point/models/fill.js +155 -210
  279. package/lib/point/models/fillImage.d.ts +26 -0
  280. package/lib/point/models/fillImage.js +159 -211
  281. package/lib/point/models/image.d.ts +18 -0
  282. package/lib/point/models/image.js +129 -180
  283. package/lib/point/models/index.d.ts +5 -0
  284. package/lib/point/models/index.js +1 -1
  285. package/lib/point/models/normal.d.ts +22 -0
  286. package/lib/point/models/normal.js +69 -122
  287. package/lib/point/models/radar.d.ts +22 -0
  288. package/lib/point/models/radar.js +95 -148
  289. package/lib/point/models/text.d.ts +69 -0
  290. package/lib/point/models/text.js +449 -578
  291. package/lib/point/shape/extrude.d.ts +15 -0
  292. package/lib/point/shape/extrude.js +19 -25
  293. package/lib/polygon/index.d.ts +18 -0
  294. package/lib/polygon/index.js +63 -99
  295. package/lib/polygon/models/extrude.d.ts +25 -0
  296. package/lib/polygon/models/extrude.js +210 -281
  297. package/lib/polygon/models/extrusion.d.ts +24 -0
  298. package/lib/polygon/models/extrusion.js +97 -142
  299. package/lib/polygon/models/fill.d.ts +18 -0
  300. package/lib/polygon/models/fill.js +104 -154
  301. package/lib/polygon/models/index.d.ts +5 -0
  302. package/lib/polygon/models/index.js +1 -1
  303. package/lib/polygon/models/ocean.d.ts +23 -0
  304. package/lib/polygon/models/ocean.js +141 -198
  305. package/lib/polygon/models/water.d.ts +21 -0
  306. package/lib/polygon/models/water.js +122 -179
  307. package/lib/raster/buffers/triangulation.d.ts +6 -0
  308. package/lib/raster/buffers/triangulation.js +13 -11
  309. package/lib/raster/index.d.ts +11 -0
  310. package/lib/raster/index.js +49 -88
  311. package/lib/raster/models/index.d.ts +5 -0
  312. package/lib/raster/models/index.js +1 -1
  313. package/lib/raster/models/raster.d.ts +21 -0
  314. package/lib/raster/models/raster.js +136 -202
  315. package/lib/raster/models/rasterRgb.d.ts +21 -0
  316. package/lib/raster/models/rasterRgb.js +136 -208
  317. package/lib/raster/models/rasterTerrainRgb.d.ts +16 -0
  318. package/lib/raster/models/rasterTerrainRgb.js +100 -153
  319. package/lib/tile/core/BaseLayer.d.ts +48 -0
  320. package/lib/tile/core/BaseLayer.js +207 -281
  321. package/lib/tile/core/TileDebugLayer.d.ts +15 -0
  322. package/lib/tile/core/TileDebugLayer.js +14 -46
  323. package/lib/tile/interaction/getFeatureData.d.ts +0 -0
  324. package/lib/tile/interaction/getRasterData.d.ts +4 -0
  325. package/lib/tile/interaction/getRasterData.js +24 -32
  326. package/lib/tile/interaction/utils.d.ts +11 -0
  327. package/lib/tile/interaction/utils.js +15 -34
  328. package/lib/tile/interface.d.ts +29 -0
  329. package/lib/tile/service/TileLayerService.d.ts +33 -0
  330. package/lib/tile/service/TileLayerService.js +105 -177
  331. package/lib/tile/service/TilePickService.d.ts +26 -0
  332. package/lib/tile/service/TilePickService.js +100 -156
  333. package/lib/tile/service/TileSourceService.d.ts +7 -0
  334. package/lib/tile/service/TileSourceService.js +20 -29
  335. package/lib/tile/tile/DebugTile.d.ts +16 -0
  336. package/lib/tile/tile/DebugTile.js +43 -78
  337. package/lib/tile/tile/ImageTile.d.ts +14 -0
  338. package/lib/tile/tile/ImageTile.js +35 -66
  339. package/lib/tile/tile/MaskTile.d.ts +18 -0
  340. package/lib/tile/tile/MaskTile.js +49 -81
  341. package/lib/tile/tile/RasterRGBTile.d.ts +11 -0
  342. package/lib/tile/tile/RasterRGBTile.js +42 -71
  343. package/lib/tile/tile/RasterTerrainRGBTile.d.ts +14 -0
  344. package/lib/tile/tile/RasterTerrainRGBTile.js +35 -66
  345. package/lib/tile/tile/RasterTile.d.ts +18 -0
  346. package/lib/tile/tile/RasterTile.js +71 -104
  347. package/lib/tile/tile/Tile.d.ts +114 -0
  348. package/lib/tile/tile/Tile.js +152 -231
  349. package/lib/tile/tile/VectorTile.d.ts +26 -0
  350. package/lib/tile/tile/VectorTile.js +79 -124
  351. package/lib/tile/tile/index.d.ts +12 -0
  352. package/lib/tile/tile/index.js +6 -4
  353. package/lib/tile/tile/util.d.ts +5 -0
  354. package/lib/tile/utils/constants.d.ts +1 -0
  355. package/lib/tile/utils/constants.js +1 -1
  356. package/lib/tile/utils/utils.d.ts +8 -0
  357. package/lib/tile/utils/utils.js +2 -2
  358. package/lib/utils/blend.d.ts +2 -0
  359. package/lib/utils/blend.js +52 -48
  360. package/lib/utils/collision-index.d.ts +47 -0
  361. package/lib/utils/collision-index.js +64 -69
  362. package/lib/utils/extrude_polyline.d.ts +68 -0
  363. package/lib/utils/extrude_polyline.js +442 -470
  364. package/lib/utils/grid-index.d.ts +28 -0
  365. package/lib/utils/grid-index.js +97 -123
  366. package/lib/utils/identityScale.d.ts +8 -0
  367. package/lib/utils/identityScale.js +5 -5
  368. package/lib/utils/load-image.d.ts +1 -0
  369. package/lib/utils/load-image.js +15 -39
  370. package/lib/utils/multiPassRender.d.ts +16 -0
  371. package/lib/utils/multiPassRender.js +7 -10
  372. package/lib/utils/polylineNormal.d.ts +9 -0
  373. package/lib/utils/polylineNormal.js +40 -44
  374. package/lib/utils/rampcolor_legend.d.ts +6 -0
  375. package/lib/utils/rampcolor_legend.js +5 -5
  376. package/lib/utils/simpleLine.d.ts +23 -0
  377. package/lib/utils/simpleLine.js +54 -65
  378. package/lib/utils/stencil.d.ts +7 -0
  379. package/lib/utils/symbol-layout.d.ts +43 -0
  380. package/lib/utils/symbol-layout.js +95 -117
  381. package/lib/wind/index.d.ts +11 -0
  382. package/lib/wind/index.js +30 -71
  383. package/lib/wind/models/index.d.ts +5 -0
  384. package/lib/wind/models/index.js +1 -1
  385. package/lib/wind/models/utils.d.ts +19 -0
  386. package/lib/wind/models/utils.js +36 -34
  387. package/lib/wind/models/wind.d.ts +24 -0
  388. package/lib/wind/models/wind.js +205 -260
  389. package/lib/wind/models/windRender.d.ts +104 -0
  390. package/lib/wind/models/windRender.js +261 -272
  391. package/lib/wind/models/windShader.d.ts +12 -0
  392. package/lib/wind/models/windShader.js +145 -6
  393. package/package.json +16 -19
  394. package/CHANGELOG.md +0 -492
  395. package/LICENSE.md +0 -21
  396. package/es/glsl.d.ts +0 -5
  397. package/lib/glsl.d.ts +0 -5
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.rampColor2legend = rampColor2legend;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  function rampColor2legend(rampColors, name) {
10
8
  return {
11
9
  type: rampColors.type,
12
10
  field: 'value',
13
- items: rampColors.positions.map(function (value, index) {
14
- var _ref;
15
- return _ref = {}, (0, _defineProperty2.default)(_ref, name, index >= rampColors.colors.length ? null : rampColors.colors[index]), (0, _defineProperty2.default)(_ref, "value", value), _ref;
11
+ items: rampColors.positions.map((value, index) => {
12
+ return {
13
+ [name]: index >= rampColors.colors.length ? null : rampColors.colors[index],
14
+ value
15
+ };
16
16
  })
17
17
  };
18
18
  }
@@ -0,0 +1,23 @@
1
+ import { vec2 } from 'gl-matrix';
2
+ export declare function direction(out: vec2, a: vec2, b: vec2): vec2;
3
+ export default class ExtrudePolyline {
4
+ complex: {
5
+ positions: number[];
6
+ indices: number[];
7
+ startIndex: number;
8
+ indexes: number[];
9
+ };
10
+ private started;
11
+ private totalDistance;
12
+ private currentIndex;
13
+ constructor();
14
+ simpleExtrude(points: number[][]): {
15
+ positions: number[];
16
+ indices: number[];
17
+ startIndex: number;
18
+ indexes: number[];
19
+ };
20
+ private simpleSegment;
21
+ private extrusions;
22
+ private lineSegmentDistance;
23
+ }
@@ -6,20 +6,18 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  exports.direction = direction;
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
10
  var _l7Utils = require("@antv/l7-utils");
13
11
  var _glMatrix = require("gl-matrix");
14
- var lineA = _glMatrix.vec2.create();
12
+ const lineA = _glMatrix.vec2.create();
15
13
  function direction(out, a, b) {
16
14
  _glMatrix.vec2.sub(out, a, b);
17
15
  _glMatrix.vec2.normalize(out, out);
18
16
  return out;
19
17
  }
20
- var ExtrudePolyline = exports.default = /*#__PURE__*/function () {
21
- function ExtrudePolyline() {
22
- (0, _classCallCheck2.default)(this, ExtrudePolyline);
18
+ class ExtrudePolyline {
19
+ constructor() {
20
+ (0, _defineProperty2.default)(this, "complex", void 0);
23
21
  (0, _defineProperty2.default)(this, "started", false);
24
22
  (0, _defineProperty2.default)(this, "totalDistance", 0);
25
23
  (0, _defineProperty2.default)(this, "currentIndex", 0);
@@ -30,67 +28,58 @@ var ExtrudePolyline = exports.default = /*#__PURE__*/function () {
30
28
  indexes: []
31
29
  };
32
30
  }
33
- (0, _createClass2.default)(ExtrudePolyline, [{
34
- key: "simpleExtrude",
35
- value: function simpleExtrude(points) {
36
- var complex = this.complex;
37
- if (points.length <= 1) {
38
- return complex;
39
- }
40
- this.started = false;
41
- this.totalDistance = 0;
42
- var total = points.length;
43
- var count = complex.startIndex;
44
- for (var i = 1; i < total; i++) {
45
- var last = points[i - 1];
46
- var cur = points[i];
47
- var amt = this.simpleSegment(complex, count, last, cur);
48
- count += amt;
49
- }
50
- for (var _i = 0; _i < complex.positions.length / 6; _i++) {
51
- complex.positions[_i * 6 + 5] = this.totalDistance;
52
- }
31
+ simpleExtrude(points) {
32
+ const complex = this.complex;
33
+ if (points.length <= 1) {
53
34
  return complex;
54
35
  }
55
- }, {
56
- key: "simpleSegment",
57
- value: function simpleSegment(complex, index, last, cur) {
58
- var count = 0;
59
- var indices = complex.indices;
60
- var positions = complex.positions;
61
- var flatCur = (0, _l7Utils.aProjectFlat)([cur[0], cur[1]]);
62
- var flatLast = (0, _l7Utils.aProjectFlat)([last[0], last[1]]);
63
- direction(lineA, flatCur, flatLast);
64
- var segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
65
- this.totalDistance += segmentDistance;
66
- if (!this.started) {
67
- this.started = true;
68
- this.extrusions(positions, last, this.totalDistance - segmentDistance);
69
- }
70
- this.extrusions(positions, cur, this.totalDistance);
71
- indices.push(index + 0, index + 1, index + 2);
72
- indices.push(index + 2, index + 1, index + 3);
73
- count += 2;
74
- return count;
36
+ this.started = false;
37
+ this.totalDistance = 0;
38
+ const total = points.length;
39
+ let count = complex.startIndex;
40
+ for (let i = 1; i < total; i++) {
41
+ const last = points[i - 1];
42
+ const cur = points[i];
43
+ const amt = this.simpleSegment(complex, count, last, cur);
44
+ count += amt;
75
45
  }
76
- }, {
77
- key: "extrusions",
78
- value: function extrusions(positions, point,
79
- // 顶点
80
- distanceRadio) {
81
- positions.push(point[0], point[1], point[2] | 0, distanceRadio, 0, point[2] | 0);
82
- this.complex.indexes.push(this.currentIndex);
83
- positions.push(point[0], point[1], point[2] | 0, distanceRadio, 0, point[2] | 0);
84
- this.complex.indexes.push(this.currentIndex);
85
- this.currentIndex++;
46
+ for (let i = 0; i < complex.positions.length / 6; i++) {
47
+ complex.positions[i * 6 + 5] = this.totalDistance;
86
48
  }
87
- }, {
88
- key: "lineSegmentDistance",
89
- value: function lineSegmentDistance(b1, a1) {
90
- var dx = a1[0] - b1[0];
91
- var dy = a1[1] - b1[1];
92
- return Math.sqrt(dx * dx + dy * dy);
49
+ return complex;
50
+ }
51
+ simpleSegment(complex, index, last, cur) {
52
+ let count = 0;
53
+ const indices = complex.indices;
54
+ const positions = complex.positions;
55
+ const flatCur = (0, _l7Utils.aProjectFlat)([cur[0], cur[1]]);
56
+ const flatLast = (0, _l7Utils.aProjectFlat)([last[0], last[1]]);
57
+ direction(lineA, flatCur, flatLast);
58
+ const segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
59
+ this.totalDistance += segmentDistance;
60
+ if (!this.started) {
61
+ this.started = true;
62
+ this.extrusions(positions, last, this.totalDistance - segmentDistance);
93
63
  }
94
- }]);
95
- return ExtrudePolyline;
96
- }();
64
+ this.extrusions(positions, cur, this.totalDistance);
65
+ indices.push(index + 0, index + 1, index + 2);
66
+ indices.push(index + 2, index + 1, index + 3);
67
+ count += 2;
68
+ return count;
69
+ }
70
+ extrusions(positions, point,
71
+ // 顶点
72
+ distanceRadio) {
73
+ positions.push(point[0], point[1], point[2] | 0, distanceRadio, 0, point[2] | 0);
74
+ this.complex.indexes.push(this.currentIndex);
75
+ positions.push(point[0], point[1], point[2] | 0, distanceRadio, 0, point[2] | 0);
76
+ this.complex.indexes.push(this.currentIndex);
77
+ this.currentIndex++;
78
+ }
79
+ lineSegmentDistance(b1, a1) {
80
+ const dx = a1[0] - b1[0];
81
+ const dy = a1[1] - b1[1];
82
+ return Math.sqrt(dx * dx + dy * dy);
83
+ }
84
+ }
85
+ exports.default = ExtrudePolyline;
@@ -0,0 +1,7 @@
1
+ import type { IRenderOptions, IStencilOptions, MaskOperationType } from '@antv/l7-core';
2
+ export declare function getStencil(mask: boolean, maskInside: boolean): Partial<IStencilOptions>;
3
+ interface IStencilMaskOptions extends IRenderOptions {
4
+ maskOperation?: MaskOperationType;
5
+ }
6
+ export declare function getStencilMask(option: Partial<IStencilMaskOptions>): Partial<IStencilOptions>;
7
+ export {};
@@ -0,0 +1,43 @@
1
+ interface IPoint {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ export type anchorType = 'right' | 'top-right' | 'left' | 'bottom-right' | 'left' | 'top-left' | 'bottom-left' | 'bottom' | 'bottom-right' | 'bottom-left' | 'top' | 'top-right' | 'top-left' | 'center';
6
+ export interface IGlyphQuad {
7
+ tr: IPoint;
8
+ tl: IPoint;
9
+ bl: IPoint;
10
+ br: IPoint;
11
+ tex: {
12
+ x: number;
13
+ y: number;
14
+ height: number;
15
+ width: number;
16
+ advance: number;
17
+ };
18
+ glyphOffset: [number, number];
19
+ }
20
+ /**
21
+ * 计算文本中每个独立字符相对锚点的位置
22
+ *
23
+ * @param {string} text 原始文本
24
+ * @param {*} glyphs mapping
25
+ * @param {number} lineHeight 行高
26
+ * @param {string} textAnchor 文本相对于锚点的位置
27
+ * @param {string} textJustify 左右对齐
28
+ * @param {number} spacing 字符间距
29
+ * @param {[number, number]} translate 文本水平 & 垂直偏移量
30
+ * @param {[boolean]} isIconFont 是否是 iconfont
31
+ * @return {boolean|shaping} 每个字符相对于锚点的位置
32
+ */
33
+ export declare function shapeText(text: string, glyphs: any, lineHeight: number, textAnchor: anchorType, textJustify: string, spacing: number, translate: [number, number] | undefined, isIconFont: boolean): false | {
34
+ positionedGlyphs: any[];
35
+ top: number;
36
+ bottom: number;
37
+ left: number;
38
+ right: number;
39
+ lineCount: number;
40
+ text: string;
41
+ };
42
+ export declare function getGlyphQuads(shaping: any, textOffset: [number, number] | undefined, alongLine: boolean): IGlyphQuad[];
43
+ export {};
@@ -5,17 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getGlyphQuads = getGlyphQuads;
7
7
  exports.shapeText = shapeText;
8
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
9
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
8
  /**
12
9
  * 返回文本相对锚点位置
13
10
  * @param {string} anchor 锚点位置
14
11
  * @return {alignment} alignment
15
12
  */
16
13
  function getAnchorAlignment(anchor) {
17
- var horizontalAlign = 0.5;
18
- var verticalAlign = 0.5;
14
+ let horizontalAlign = 0.5;
15
+ let verticalAlign = 0.5;
19
16
  switch (anchor) {
20
17
  case 'right':
21
18
  case 'top-right':
@@ -45,8 +42,8 @@ function getAnchorAlignment(anchor) {
45
42
  verticalAlign = 0.5;
46
43
  }
47
44
  return {
48
- horizontalAlign: horizontalAlign,
49
- verticalAlign: verticalAlign
45
+ horizontalAlign,
46
+ verticalAlign
50
47
  };
51
48
  }
52
49
 
@@ -55,12 +52,12 @@ function justifyLine(positionedGlyphs, glyphMap, start, end, justify) {
55
52
  if (!justify) {
56
53
  return;
57
54
  }
58
- var lastPositionedGlyph = positionedGlyphs[end];
59
- var glyph = lastPositionedGlyph.glyph;
55
+ const lastPositionedGlyph = positionedGlyphs[end];
56
+ const glyph = lastPositionedGlyph.glyph;
60
57
  if (glyph) {
61
- var lastAdvance = glyphMap[glyph].advance * lastPositionedGlyph.scale;
62
- var lineIndent = (positionedGlyphs[end].x + lastAdvance) * justify;
63
- for (var j = start; j <= end; j++) {
58
+ const lastAdvance = glyphMap[glyph].advance * lastPositionedGlyph.scale;
59
+ const lineIndent = (positionedGlyphs[end].x + lastAdvance) * justify;
60
+ for (let j = start; j <= end; j++) {
64
61
  positionedGlyphs[j].x -= lineIndent;
65
62
  }
66
63
  }
@@ -70,39 +67,30 @@ function justifyLine(positionedGlyphs, glyphMap, start, end, justify) {
70
67
  // horizontalAlign right=1 left=0 center=0.5
71
68
  // verticalAlign right=1 left=0 center=0.5
72
69
  function align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, lineCount) {
73
- var shiftX = (justify - horizontalAlign) * maxLineLength;
74
- var shiftY = (-verticalAlign * lineCount + 0.5) * lineHeight;
75
- var _iterator = _createForOfIteratorHelper(positionedGlyphs),
76
- _step;
77
- try {
78
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
79
- var glyphs = _step.value;
80
- glyphs.x += shiftX;
81
- glyphs.y += shiftY;
82
- }
83
- } catch (err) {
84
- _iterator.e(err);
85
- } finally {
86
- _iterator.f();
70
+ const shiftX = (justify - horizontalAlign) * maxLineLength;
71
+ const shiftY = (-verticalAlign * lineCount + 0.5) * lineHeight;
72
+ for (const glyphs of positionedGlyphs) {
73
+ glyphs.x += shiftX;
74
+ glyphs.y += shiftY;
87
75
  }
88
76
  }
89
77
  function shapeLines(shaping, glyphMap, lines, lineHeight, textAnchor, textJustify, spacing) {
90
78
  // buffer 为 4
91
- var yOffset = -8;
92
- var x = 0;
93
- var y = yOffset;
94
- var maxLineLength = 0;
95
- var positionedGlyphs = shaping.positionedGlyphs;
96
- var justify = textJustify === 'right' ? 1 : textJustify === 'left' ? 0 : 0.5;
97
- var lineStartIndex = positionedGlyphs.length;
98
- lines.forEach(function (line) {
99
- line.split('').forEach(function (char) {
100
- var glyph = glyphMap[char];
101
- var baselineOffset = 0;
79
+ const yOffset = -8;
80
+ let x = 0;
81
+ let y = yOffset;
82
+ let maxLineLength = 0;
83
+ const positionedGlyphs = shaping.positionedGlyphs;
84
+ const justify = textJustify === 'right' ? 1 : textJustify === 'left' ? 0 : 0.5;
85
+ const lineStartIndex = positionedGlyphs.length;
86
+ lines.forEach(line => {
87
+ line.split('').forEach(char => {
88
+ const glyph = glyphMap[char];
89
+ const baselineOffset = 0;
102
90
  if (glyph) {
103
91
  positionedGlyphs.push({
104
92
  glyph: char,
105
- x: x,
93
+ x,
106
94
  y: y + baselineOffset,
107
95
  vertical: false,
108
96
  // TODO:目前只支持水平方向
@@ -115,20 +103,21 @@ function shapeLines(shaping, glyphMap, lines, lineHeight, textAnchor, textJustif
115
103
 
116
104
  // 左右对齐
117
105
  if (positionedGlyphs.length !== lineStartIndex) {
118
- var lineLength = x - spacing;
106
+ const lineLength = x - spacing;
119
107
  maxLineLength = Math.max(lineLength, maxLineLength);
120
108
  justifyLine(positionedGlyphs, glyphMap, lineStartIndex, positionedGlyphs.length - 1, justify);
121
109
  }
122
110
  x = 0;
123
111
  y -= lineHeight + 5;
124
112
  });
125
- var _getAnchorAlignment = getAnchorAlignment(textAnchor),
126
- horizontalAlign = _getAnchorAlignment.horizontalAlign,
127
- verticalAlign = _getAnchorAlignment.verticalAlign;
113
+ const {
114
+ horizontalAlign,
115
+ verticalAlign
116
+ } = getAnchorAlignment(textAnchor);
128
117
  align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, lines.length);
129
118
 
130
119
  // 计算包围盒
131
- var height = y - yOffset;
120
+ const height = y - yOffset;
132
121
  shaping.top += -verticalAlign * height;
133
122
  shaping.bottom = shaping.top - height;
134
123
  shaping.left += -horizontalAlign * maxLineLength;
@@ -136,16 +125,16 @@ function shapeLines(shaping, glyphMap, lines, lineHeight, textAnchor, textJustif
136
125
  }
137
126
  function shapeIconFont(shaping, glyphMap, iconfonts, lineHeight, textAnchor, textJustify, spacing) {
138
127
  // buffer 为 4
139
- var yOffset = -8;
140
- var x = 0;
141
- var y = yOffset;
142
- var maxLineLength = 0;
143
- var positionedGlyphs = shaping.positionedGlyphs;
144
- var justify = textJustify === 'right' ? 1 : textJustify === 'left' ? 0 : 0.5;
145
- var lineStartIndex = positionedGlyphs.length;
146
- iconfonts.forEach(function (iconfont) {
147
- var glyph = glyphMap[iconfont];
148
- var baselineOffset = 0;
128
+ const yOffset = -8;
129
+ let x = 0;
130
+ let y = yOffset;
131
+ let maxLineLength = 0;
132
+ const positionedGlyphs = shaping.positionedGlyphs;
133
+ const justify = textJustify === 'right' ? 1 : textJustify === 'left' ? 0 : 0.5;
134
+ const lineStartIndex = positionedGlyphs.length;
135
+ iconfonts.forEach(iconfont => {
136
+ const glyph = glyphMap[iconfont];
137
+ const baselineOffset = 0;
149
138
  if (glyph) {
150
139
  positionedGlyphs.push({
151
140
  glyph: iconfont,
@@ -167,20 +156,21 @@ function shapeIconFont(shaping, glyphMap, iconfonts, lineHeight, textAnchor, tex
167
156
 
168
157
  // 左右对齐
169
158
  if (positionedGlyphs.length !== lineStartIndex) {
170
- var lineLength = x - spacing;
159
+ const lineLength = x - spacing;
171
160
  maxLineLength = Math.max(lineLength, maxLineLength);
172
161
  justifyLine(positionedGlyphs, glyphMap, lineStartIndex, positionedGlyphs.length - 1, justify);
173
162
  }
174
163
  x = 0;
175
164
  y -= lineHeight + 5;
176
165
  });
177
- var _getAnchorAlignment2 = getAnchorAlignment(textAnchor),
178
- horizontalAlign = _getAnchorAlignment2.horizontalAlign,
179
- verticalAlign = _getAnchorAlignment2.verticalAlign;
166
+ const {
167
+ horizontalAlign,
168
+ verticalAlign
169
+ } = getAnchorAlignment(textAnchor);
180
170
  align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, iconfonts.length);
181
171
 
182
172
  // 计算包围盒
183
- var height = y - yOffset;
173
+ const height = y - yOffset;
184
174
  shaping.top += -verticalAlign * height;
185
175
  shaping.bottom = shaping.top - height;
186
176
  shaping.left += -horizontalAlign * maxLineLength;
@@ -200,20 +190,18 @@ function shapeIconFont(shaping, glyphMap, iconfonts, lineHeight, textAnchor, tex
200
190
  * @param {[boolean]} isIconFont 是否是 iconfont
201
191
  * @return {boolean|shaping} 每个字符相对于锚点的位置
202
192
  */
203
- function shapeText(text, glyphs, lineHeight, textAnchor, textJustify, spacing) {
204
- var translate = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [0, 0];
205
- var isIconFont = arguments.length > 7 ? arguments[7] : undefined;
193
+ function shapeText(text, glyphs, lineHeight, textAnchor, textJustify, spacing, translate = [0, 0], isIconFont) {
206
194
  // TODO:处理换行
207
- var lines = text.split('\n');
208
- var positionedGlyphs = [];
209
- var shaping = {
210
- positionedGlyphs: positionedGlyphs,
195
+ const lines = text.split('\n');
196
+ const positionedGlyphs = [];
197
+ const shaping = {
198
+ positionedGlyphs,
211
199
  top: translate[1],
212
200
  bottom: translate[1],
213
201
  left: translate[0],
214
202
  right: translate[0],
215
203
  lineCount: lines.length,
216
- text: text
204
+ text
217
205
  };
218
206
  isIconFont ? shapeIconFont(shaping, glyphs, lines, lineHeight, textAnchor, textJustify, spacing) : shapeLines(shaping, glyphs, lines, lineHeight, textAnchor, textJustify, spacing);
219
207
  if (!positionedGlyphs.length) {
@@ -221,60 +209,50 @@ function shapeText(text, glyphs, lineHeight, textAnchor, textJustify, spacing) {
221
209
  }
222
210
  return shaping;
223
211
  }
224
- function getGlyphQuads(shaping) {
225
- var textOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0];
226
- var alongLine = arguments.length > 2 ? arguments[2] : undefined;
227
- var _shaping$positionedGl = shaping.positionedGlyphs,
228
- positionedGlyphs = _shaping$positionedGl === void 0 ? [] : _shaping$positionedGl;
229
- var quads = [];
230
- var _iterator2 = _createForOfIteratorHelper(positionedGlyphs),
231
- _step2;
232
- try {
233
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
234
- var positionedGlyph = _step2.value;
235
- var rect = positionedGlyph.metrics;
212
+ function getGlyphQuads(shaping, textOffset = [0, 0], alongLine) {
213
+ const {
214
+ positionedGlyphs = []
215
+ } = shaping;
216
+ const quads = [];
217
+ for (const positionedGlyph of positionedGlyphs) {
218
+ const rect = positionedGlyph.metrics;
236
219
 
237
- // The rects have an addditional buffer that is not included in their size.
238
- var rectBuffer = 4;
239
- var halfAdvance = rect.advance * positionedGlyph.scale / 2;
240
- var glyphOffset = alongLine ? [positionedGlyph.x + halfAdvance, positionedGlyph.y] : [0, 0];
241
- var builtInOffset = alongLine ? [0, 0] : [positionedGlyph.x + halfAdvance + textOffset[0], positionedGlyph.y + textOffset[1]];
242
- var x1 = (0 - rectBuffer) * positionedGlyph.scale - halfAdvance + builtInOffset[0];
243
- var y1 = (0 - rectBuffer) * positionedGlyph.scale + builtInOffset[1];
244
- var x2 = x1 + rect.width * positionedGlyph.scale;
245
- var y2 = y1 + rect.height * positionedGlyph.scale;
246
- var tl = {
247
- x: x1,
248
- y: y1
249
- };
250
- var tr = {
251
- x: x2,
252
- y: y1
253
- };
254
- var bl = {
255
- x: x1,
256
- y: y2
257
- };
258
- var br = {
259
- x: x2,
260
- y: y2
261
- };
220
+ // The rects have an addditional buffer that is not included in their size.
221
+ const rectBuffer = 4;
222
+ const halfAdvance = rect.advance * positionedGlyph.scale / 2;
223
+ const glyphOffset = alongLine ? [positionedGlyph.x + halfAdvance, positionedGlyph.y] : [0, 0];
224
+ const builtInOffset = alongLine ? [0, 0] : [positionedGlyph.x + halfAdvance + textOffset[0], positionedGlyph.y + textOffset[1]];
225
+ const x1 = (0 - rectBuffer) * positionedGlyph.scale - halfAdvance + builtInOffset[0];
226
+ const y1 = (0 - rectBuffer) * positionedGlyph.scale + builtInOffset[1];
227
+ const x2 = x1 + rect.width * positionedGlyph.scale;
228
+ const y2 = y1 + rect.height * positionedGlyph.scale;
229
+ const tl = {
230
+ x: x1,
231
+ y: y1
232
+ };
233
+ const tr = {
234
+ x: x2,
235
+ y: y1
236
+ };
237
+ const bl = {
238
+ x: x1,
239
+ y: y2
240
+ };
241
+ const br = {
242
+ x: x2,
243
+ y: y2
244
+ };
262
245
 
263
- // TODO:处理字符旋转的情况
246
+ // TODO:处理字符旋转的情况
264
247
 
265
- quads.push({
266
- tl: tl,
267
- tr: tr,
268
- bl: bl,
269
- br: br,
270
- tex: rect,
271
- glyphOffset: glyphOffset
272
- });
273
- }
274
- } catch (err) {
275
- _iterator2.e(err);
276
- } finally {
277
- _iterator2.f();
248
+ quads.push({
249
+ tl,
250
+ tr,
251
+ bl,
252
+ br,
253
+ tex: rect,
254
+ glyphOffset
255
+ });
278
256
  }
279
257
  return quads;
280
258
  }
@@ -0,0 +1,11 @@
1
+ import type { IRenderOptions } from '@antv/l7-core';
2
+ import BaseLayer from '../core/BaseLayer';
3
+ import type { IWindLayerStyleOptions } from '../core/interface';
4
+ import type { WindModelType } from './models';
5
+ export default class WindLayer extends BaseLayer<IWindLayerStyleOptions> {
6
+ type: string;
7
+ buildModels(): Promise<void>;
8
+ renderModels(options?: Partial<IRenderOptions>): this;
9
+ protected getDefaultConfig(): {};
10
+ getModelType(): WindModelType;
11
+ }