@antv/l7-layers 2.21.1 → 2.21.3
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.
- package/es/canvas/index.js +60 -113
- package/es/canvas/models/canvas.js +95 -135
- package/es/canvas/models/constants.js +1 -1
- package/es/citybuliding/building.js +20 -58
- package/es/citybuliding/models/build.js +142 -199
- package/es/core/BaseLayer.d.ts +1 -1
- package/es/core/BaseLayer.js +1113 -1412
- package/es/core/BaseModel.js +263 -317
- package/es/core/CommonStyleAttribute.js +25 -18
- package/es/core/LayerPickService.js +92 -141
- package/es/core/TextureService.js +58 -69
- package/es/core/constant.js +2 -2
- package/es/core/interface.js +5 -5
- package/es/core/line_trangluation.js +38 -43
- package/es/core/shape/Path.js +21 -12
- package/es/core/shape/arrow.js +50 -62
- package/es/core/shape/extrude.js +54 -62
- package/es/core/triangulation.js +192 -171
- package/es/core/utils.js +5 -5
- package/es/earth/index.js +35 -73
- package/es/earth/models/atmosphere.js +98 -148
- package/es/earth/models/base.js +148 -201
- package/es/earth/models/bloomsphere.js +97 -147
- package/es/earth/utils.js +37 -38
- package/es/geometry/index.js +36 -75
- package/es/geometry/models/billboard.js +147 -204
- package/es/geometry/models/index.js +1 -1
- package/es/geometry/models/plane.js +277 -357
- package/es/geometry/models/sprite.js +182 -240
- package/es/heatmap/index.js +72 -121
- package/es/heatmap/models/grid.js +66 -118
- package/es/heatmap/models/grid3d.js +101 -151
- package/es/heatmap/models/heatmap.js +398 -455
- package/es/heatmap/models/hexagon.js +67 -119
- package/es/heatmap/models/index.js +1 -1
- package/es/heatmap/triangulation.js +20 -20
- package/es/image/index.js +23 -62
- package/es/image/models/image.js +99 -163
- package/es/image/models/index.js +1 -1
- package/es/line/index.js +65 -106
- package/es/line/models/arc.js +200 -248
- package/es/line/models/arc_3d.js +190 -241
- package/es/line/models/flow.js +101 -153
- package/es/line/models/great_circle.js +183 -234
- package/es/line/models/index.js +1 -1
- package/es/line/models/line.js +230 -285
- package/es/line/models/simple_line.js +142 -192
- package/es/line/models/wall.js +221 -273
- package/es/mask/index.js +16 -53
- package/es/mask/models/fill.js +51 -108
- package/es/mask/models/index.js +1 -1
- package/es/plugins/DataMappingPlugin.js +205 -249
- package/es/plugins/DataSourcePlugin.js +64 -92
- package/es/plugins/FeatureScalePlugin.js +258 -302
- package/es/plugins/LayerAnimateStylePlugin.js +12 -22
- package/es/plugins/LayerMaskPlugin.js +15 -24
- package/es/plugins/LayerModelPlugin.js +52 -136
- package/es/plugins/LayerStylePlugin.js +14 -23
- package/es/plugins/LightingPlugin.js +26 -37
- package/es/plugins/MultiPassRendererPlugin.js +34 -39
- package/es/plugins/PixelPickingPlugin.js +129 -150
- package/es/plugins/RegisterStyleAttributePlugin.js +80 -96
- package/es/plugins/ShaderUniformPlugin.js +159 -131
- package/es/plugins/UpdateModelPlugin.js +16 -26
- package/es/plugins/UpdateStyleAttributePlugin.js +47 -65
- package/es/plugins/index.d.ts +1 -1
- package/es/point/index.js +118 -182
- package/es/point/models/billboard_point.js +72 -127
- package/es/point/models/earthExtrude.js +170 -220
- package/es/point/models/earthFill.js +136 -192
- package/es/point/models/extrude.js +167 -217
- package/es/point/models/fill.js +152 -209
- package/es/point/models/fillImage.js +156 -211
- package/es/point/models/image.js +127 -180
- package/es/point/models/index.js +1 -1
- package/es/point/models/normal.js +67 -122
- package/es/point/models/radar.js +93 -148
- package/es/point/models/text.js +447 -578
- package/es/point/shape/extrude.js +19 -25
- package/es/polygon/index.js +61 -99
- package/es/polygon/models/extrude.js +208 -281
- package/es/polygon/models/extrusion.js +95 -142
- package/es/polygon/models/fill.js +102 -153
- package/es/polygon/models/index.js +1 -1
- package/es/polygon/models/ocean.js +139 -198
- package/es/polygon/models/water.js +120 -179
- package/es/raster/buffers/triangulation.js +13 -11
- package/es/raster/index.js +47 -88
- package/es/raster/models/index.js +1 -1
- package/es/raster/models/raster.js +134 -202
- package/es/raster/models/rasterRgb.js +134 -208
- package/es/raster/models/rasterTerrainRgb.js +98 -153
- package/es/tile/core/BaseLayer.d.ts +1 -0
- package/es/tile/core/BaseLayer.js +206 -282
- package/es/tile/core/TileDebugLayer.js +12 -46
- package/es/tile/interaction/getRasterData.js +24 -30
- package/es/tile/interaction/utils.js +15 -33
- package/es/tile/service/TileLayerService.js +104 -177
- package/es/tile/service/TilePickService.js +99 -156
- package/es/tile/service/TileSourceService.js +17 -26
- package/es/tile/tile/DebugTile.js +41 -78
- package/es/tile/tile/ImageTile.js +33 -66
- package/es/tile/tile/MaskTile.js +47 -81
- package/es/tile/tile/RasterRGBTile.js +40 -71
- package/es/tile/tile/RasterTerrainRGBTile.js +33 -66
- package/es/tile/tile/RasterTile.js +69 -104
- package/es/tile/tile/Tile.d.ts +1 -1
- package/es/tile/tile/Tile.js +151 -232
- package/es/tile/tile/VectorTile.js +77 -124
- package/es/tile/tile/index.d.ts +1 -1
- package/es/tile/tile/index.js +4 -2
- package/es/tile/tile/util.d.ts +1 -1
- package/es/tile/utils/constants.js +1 -1
- package/es/tile/utils/utils.js +2 -2
- package/es/utils/blend.js +52 -46
- package/es/utils/collision-index.js +62 -70
- package/es/utils/extrude_polyline.js +441 -471
- package/es/utils/grid-index.js +97 -123
- package/es/utils/identityScale.js +5 -5
- package/es/utils/load-image.js +15 -39
- package/es/utils/multiPassRender.js +7 -9
- package/es/utils/polylineNormal.js +40 -42
- package/es/utils/rampcolor_legend.js +5 -3
- package/es/utils/simpleLine.js +53 -66
- package/es/utils/symbol-layout.js +95 -117
- package/es/wind/index.js +28 -70
- package/es/wind/models/index.js +1 -1
- package/es/wind/models/utils.js +36 -34
- package/es/wind/models/wind.js +203 -260
- package/es/wind/models/windRender.js +258 -269
- package/es/wind/models/windShader.js +145 -6
- package/lib/canvas/index.d.ts +18 -0
- package/lib/canvas/index.js +64 -113
- package/lib/canvas/models/canvas.d.ts +23 -0
- package/lib/canvas/models/canvas.js +97 -136
- package/lib/canvas/models/constants.d.ts +2 -0
- package/lib/canvas/models/constants.js +1 -1
- package/lib/canvas/models/index.d.ts +2 -0
- package/lib/canvas/models/index.js +2 -2
- package/lib/citybuliding/building.d.ts +7 -0
- package/lib/citybuliding/building.js +22 -58
- package/lib/citybuliding/models/build.d.ts +17 -0
- package/lib/citybuliding/models/build.js +144 -199
- package/lib/core/BaseLayer.d.ts +247 -0
- package/lib/core/BaseLayer.js +1115 -1412
- package/lib/core/BaseModel.d.ts +82 -0
- package/lib/core/BaseModel.js +263 -315
- package/lib/core/CommonStyleAttribute.d.ts +20 -0
- package/lib/core/CommonStyleAttribute.js +25 -18
- package/lib/core/LayerPickService.d.ts +12 -0
- package/lib/core/LayerPickService.js +93 -140
- package/lib/core/TextureService.d.ts +15 -0
- package/lib/core/TextureService.js +59 -68
- package/lib/core/constant.d.ts +6 -0
- package/lib/core/constant.js +2 -2
- package/lib/core/interface.d.ts +282 -0
- package/lib/core/interface.js +5 -5
- package/lib/core/line_trangluation.d.ts +19 -0
- package/lib/core/line_trangluation.js +38 -43
- package/lib/core/schema.d.ts +27 -0
- package/lib/core/shape/Path.d.ts +39 -0
- package/lib/core/shape/Path.js +21 -13
- package/lib/core/shape/arrow.d.ts +25 -0
- package/lib/core/shape/arrow.js +50 -62
- package/lib/core/shape/extrude.d.ts +17 -0
- package/lib/core/shape/extrude.js +54 -62
- package/lib/core/triangulation.d.ts +136 -0
- package/lib/core/triangulation.js +194 -174
- package/lib/core/utils.d.ts +4 -0
- package/lib/core/utils.js +5 -5
- package/lib/earth/index.d.ts +22 -0
- package/lib/earth/index.js +37 -73
- package/lib/earth/models/atmosphere.d.ts +15 -0
- package/lib/earth/models/atmosphere.js +100 -148
- package/lib/earth/models/base.d.ts +22 -0
- package/lib/earth/models/base.js +150 -201
- package/lib/earth/models/bloomsphere.d.ts +15 -0
- package/lib/earth/models/bloomsphere.js +99 -147
- package/lib/earth/utils.d.ts +26 -0
- package/lib/earth/utils.js +37 -39
- package/lib/geometry/index.d.ts +22 -0
- package/lib/geometry/index.js +38 -75
- package/lib/geometry/models/billboard.d.ts +24 -0
- package/lib/geometry/models/billboard.js +149 -204
- package/lib/geometry/models/index.d.ts +5 -0
- package/lib/geometry/models/index.js +1 -1
- package/lib/geometry/models/plane.d.ts +43 -0
- package/lib/geometry/models/plane.js +280 -357
- package/lib/geometry/models/sprite.d.ts +48 -0
- package/lib/geometry/models/sprite.js +184 -240
- package/lib/heatmap/index.d.ts +13 -0
- package/lib/heatmap/index.js +74 -121
- package/lib/heatmap/models/grid.d.ts +15 -0
- package/lib/heatmap/models/grid.js +68 -118
- package/lib/heatmap/models/grid3d.d.ts +15 -0
- package/lib/heatmap/models/grid3d.js +103 -151
- package/lib/heatmap/models/heatmap.d.ts +27 -0
- package/lib/heatmap/models/heatmap.js +400 -455
- package/lib/heatmap/models/hexagon.d.ts +15 -0
- package/lib/heatmap/models/hexagon.js +69 -119
- package/lib/heatmap/models/index.d.ts +5 -0
- package/lib/heatmap/models/index.js +1 -1
- package/lib/heatmap/triangulation.d.ts +5 -0
- package/lib/heatmap/triangulation.js +20 -20
- package/lib/image/index.d.ts +9 -0
- package/lib/image/index.js +25 -62
- package/lib/image/models/image.d.ts +17 -0
- package/lib/image/models/image.js +101 -163
- package/lib/image/models/index.d.ts +5 -0
- package/lib/image/models/index.js +1 -1
- package/lib/index.d.ts +18 -0
- package/lib/index.js +17 -17
- package/lib/line/index.d.ts +36 -0
- package/lib/line/index.js +67 -106
- package/lib/line/models/arc.d.ts +22 -0
- package/lib/line/models/arc.js +202 -248
- package/lib/line/models/arc_3d.d.ts +22 -0
- package/lib/line/models/arc_3d.js +193 -241
- package/lib/line/models/flow.d.ts +14 -0
- package/lib/line/models/flow.js +103 -153
- package/lib/line/models/great_circle.d.ts +17 -0
- package/lib/line/models/great_circle.js +185 -234
- package/lib/line/models/index.d.ts +5 -0
- package/lib/line/models/index.js +1 -1
- package/lib/line/models/line.d.ts +27 -0
- package/lib/line/models/line.js +232 -285
- package/lib/line/models/simple_line.d.ts +19 -0
- package/lib/line/models/simple_line.js +144 -192
- package/lib/line/models/wall.d.ts +17 -0
- package/lib/line/models/wall.js +223 -273
- package/lib/mask/index.d.ts +16 -0
- package/lib/mask/index.js +18 -53
- package/lib/mask/models/fill.d.ts +18 -0
- package/lib/mask/models/fill.js +53 -108
- package/lib/mask/models/index.d.ts +5 -0
- package/lib/mask/models/index.js +1 -1
- package/lib/plugins/DataMappingPlugin.d.ts +13 -0
- package/lib/plugins/DataMappingPlugin.js +206 -248
- package/lib/plugins/DataSourcePlugin.d.ts +6 -0
- package/lib/plugins/DataSourcePlugin.js +65 -91
- package/lib/plugins/FeatureScalePlugin.d.ts +20 -0
- package/lib/plugins/FeatureScalePlugin.js +261 -304
- package/lib/plugins/LayerAnimateStylePlugin.d.ts +4 -0
- package/lib/plugins/LayerAnimateStylePlugin.js +13 -21
- package/lib/plugins/LayerMaskPlugin.d.ts +7 -0
- package/lib/plugins/LayerMaskPlugin.js +16 -24
- package/lib/plugins/LayerModelPlugin.d.ts +10 -0
- package/lib/plugins/LayerModelPlugin.js +53 -135
- package/lib/plugins/LayerStylePlugin.d.ts +7 -0
- package/lib/plugins/LayerStylePlugin.js +15 -23
- package/lib/plugins/LightingPlugin.d.ts +35 -0
- package/lib/plugins/LightingPlugin.js +27 -36
- package/lib/plugins/MultiPassRendererPlugin.d.ts +22 -0
- package/lib/plugins/MultiPassRendererPlugin.js +35 -38
- package/lib/plugins/PixelPickingPlugin.d.ts +11 -0
- package/lib/plugins/PixelPickingPlugin.js +130 -149
- package/lib/plugins/RegisterStyleAttributePlugin.d.ts +11 -0
- package/lib/plugins/RegisterStyleAttributePlugin.js +81 -96
- package/lib/plugins/ShaderUniformPlugin.d.ts +22 -0
- package/lib/plugins/ShaderUniformPlugin.js +160 -130
- package/lib/plugins/UpdateModelPlugin.d.ts +7 -0
- package/lib/plugins/UpdateModelPlugin.js +17 -26
- package/lib/plugins/UpdateStyleAttributePlugin.d.ts +9 -0
- package/lib/plugins/UpdateStyleAttributePlugin.js +48 -65
- package/lib/plugins/index.d.ts +15 -0
- package/lib/point/index.d.ts +33 -0
- package/lib/point/index.js +120 -182
- package/lib/point/models/billboard_point.d.ts +21 -0
- package/lib/point/models/billboard_point.js +74 -127
- package/lib/point/models/earthExtrude.d.ts +16 -0
- package/lib/point/models/earthExtrude.js +172 -220
- package/lib/point/models/earthFill.d.ts +15 -0
- package/lib/point/models/earthFill.js +138 -192
- package/lib/point/models/extrude.d.ts +16 -0
- package/lib/point/models/extrude.js +169 -217
- package/lib/point/models/fill.d.ts +31 -0
- package/lib/point/models/fill.js +154 -209
- package/lib/point/models/fillImage.d.ts +26 -0
- package/lib/point/models/fillImage.js +159 -211
- package/lib/point/models/image.d.ts +18 -0
- package/lib/point/models/image.js +129 -180
- package/lib/point/models/index.d.ts +5 -0
- package/lib/point/models/index.js +1 -1
- package/lib/point/models/normal.d.ts +22 -0
- package/lib/point/models/normal.js +69 -122
- package/lib/point/models/radar.d.ts +22 -0
- package/lib/point/models/radar.js +95 -148
- package/lib/point/models/text.d.ts +69 -0
- package/lib/point/models/text.js +449 -578
- package/lib/point/shape/extrude.d.ts +15 -0
- package/lib/point/shape/extrude.js +19 -25
- package/lib/polygon/index.d.ts +18 -0
- package/lib/polygon/index.js +63 -99
- package/lib/polygon/models/extrude.d.ts +25 -0
- package/lib/polygon/models/extrude.js +210 -281
- package/lib/polygon/models/extrusion.d.ts +24 -0
- package/lib/polygon/models/extrusion.js +97 -142
- package/lib/polygon/models/fill.d.ts +18 -0
- package/lib/polygon/models/fill.js +104 -153
- package/lib/polygon/models/index.d.ts +5 -0
- package/lib/polygon/models/index.js +1 -1
- package/lib/polygon/models/ocean.d.ts +23 -0
- package/lib/polygon/models/ocean.js +141 -198
- package/lib/polygon/models/water.d.ts +21 -0
- package/lib/polygon/models/water.js +122 -179
- package/lib/raster/buffers/triangulation.d.ts +6 -0
- package/lib/raster/buffers/triangulation.js +13 -11
- package/lib/raster/index.d.ts +11 -0
- package/lib/raster/index.js +49 -88
- package/lib/raster/models/index.d.ts +5 -0
- package/lib/raster/models/index.js +1 -1
- package/lib/raster/models/raster.d.ts +21 -0
- package/lib/raster/models/raster.js +136 -202
- package/lib/raster/models/rasterRgb.d.ts +21 -0
- package/lib/raster/models/rasterRgb.js +136 -208
- package/lib/raster/models/rasterTerrainRgb.d.ts +16 -0
- package/lib/raster/models/rasterTerrainRgb.js +100 -153
- package/lib/tile/core/BaseLayer.d.ts +48 -0
- package/lib/tile/core/BaseLayer.js +207 -281
- package/lib/tile/core/TileDebugLayer.d.ts +15 -0
- package/lib/tile/core/TileDebugLayer.js +14 -46
- package/lib/tile/interaction/getFeatureData.d.ts +0 -0
- package/lib/tile/interaction/getRasterData.d.ts +4 -0
- package/lib/tile/interaction/getRasterData.js +24 -31
- package/lib/tile/interaction/utils.d.ts +11 -0
- package/lib/tile/interaction/utils.js +15 -34
- package/lib/tile/interface.d.ts +29 -0
- package/lib/tile/service/TileLayerService.d.ts +33 -0
- package/lib/tile/service/TileLayerService.js +105 -177
- package/lib/tile/service/TilePickService.d.ts +26 -0
- package/lib/tile/service/TilePickService.js +100 -156
- package/lib/tile/service/TileSourceService.d.ts +7 -0
- package/lib/tile/service/TileSourceService.js +20 -29
- package/lib/tile/tile/DebugTile.d.ts +16 -0
- package/lib/tile/tile/DebugTile.js +43 -78
- package/lib/tile/tile/ImageTile.d.ts +14 -0
- package/lib/tile/tile/ImageTile.js +35 -66
- package/lib/tile/tile/MaskTile.d.ts +18 -0
- package/lib/tile/tile/MaskTile.js +49 -81
- package/lib/tile/tile/RasterRGBTile.d.ts +11 -0
- package/lib/tile/tile/RasterRGBTile.js +42 -71
- package/lib/tile/tile/RasterTerrainRGBTile.d.ts +14 -0
- package/lib/tile/tile/RasterTerrainRGBTile.js +35 -66
- package/lib/tile/tile/RasterTile.d.ts +18 -0
- package/lib/tile/tile/RasterTile.js +71 -104
- package/lib/tile/tile/Tile.d.ts +114 -0
- package/lib/tile/tile/Tile.js +152 -231
- package/lib/tile/tile/VectorTile.d.ts +26 -0
- package/lib/tile/tile/VectorTile.js +79 -124
- package/lib/tile/tile/index.d.ts +12 -0
- package/lib/tile/tile/index.js +6 -4
- package/lib/tile/tile/util.d.ts +5 -0
- package/lib/tile/utils/constants.d.ts +1 -0
- package/lib/tile/utils/constants.js +1 -1
- package/lib/tile/utils/utils.d.ts +8 -0
- package/lib/tile/utils/utils.js +2 -2
- package/lib/utils/blend.d.ts +2 -0
- package/lib/utils/blend.js +52 -47
- package/lib/utils/collision-index.d.ts +47 -0
- package/lib/utils/collision-index.js +64 -69
- package/lib/utils/extrude_polyline.d.ts +68 -0
- package/lib/utils/extrude_polyline.js +442 -470
- package/lib/utils/grid-index.d.ts +28 -0
- package/lib/utils/grid-index.js +97 -123
- package/lib/utils/identityScale.d.ts +8 -0
- package/lib/utils/identityScale.js +5 -5
- package/lib/utils/load-image.d.ts +1 -0
- package/lib/utils/load-image.js +15 -39
- package/lib/utils/multiPassRender.d.ts +16 -0
- package/lib/utils/multiPassRender.js +7 -10
- package/lib/utils/polylineNormal.d.ts +9 -0
- package/lib/utils/polylineNormal.js +40 -43
- package/lib/utils/rampcolor_legend.d.ts +6 -0
- package/lib/utils/rampcolor_legend.js +5 -4
- package/lib/utils/simpleLine.d.ts +23 -0
- package/lib/utils/simpleLine.js +54 -65
- package/lib/utils/stencil.d.ts +7 -0
- package/lib/utils/symbol-layout.d.ts +43 -0
- package/lib/utils/symbol-layout.js +95 -117
- package/lib/wind/index.d.ts +11 -0
- package/lib/wind/index.js +30 -70
- package/lib/wind/models/index.d.ts +5 -0
- package/lib/wind/models/index.js +1 -1
- package/lib/wind/models/utils.d.ts +19 -0
- package/lib/wind/models/utils.js +36 -34
- package/lib/wind/models/wind.d.ts +24 -0
- package/lib/wind/models/wind.js +205 -260
- package/lib/wind/models/windRender.d.ts +104 -0
- package/lib/wind/models/windRender.js +261 -272
- package/lib/wind/models/windShader.d.ts +12 -0
- package/lib/wind/models/windShader.js +145 -6
- package/package.json +16 -19
- package/es/glsl.d.ts +0 -5
- package/lib/glsl.d.ts +0 -5
package/es/utils/simpleLine.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
11
|
-
|
|
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
|
|
42
|
-
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
|
-
|
|
52
|
-
|
|
48
|
+
const lastPositionedGlyph = positionedGlyphs[end];
|
|
49
|
+
const glyph = lastPositionedGlyph.glyph;
|
|
53
50
|
if (glyph) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
for (
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
lines.forEach(
|
|
92
|
-
line.split('').forEach(
|
|
93
|
-
|
|
94
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
119
|
-
horizontalAlign
|
|
120
|
-
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
|
-
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
iconfonts.forEach(
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
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
|
-
|
|
171
|
-
horizontalAlign
|
|
172
|
-
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
|
-
|
|
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
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
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
|
|
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
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
|
|
239
|
+
// TODO:处理字符旋转的情况
|
|
257
240
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
+
}
|
package/es/wind/models/index.js
CHANGED