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