@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.
- 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/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.js +4 -2
- 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/CHANGELOG.md +0 -492
- package/LICENSE.md +0 -21
- package/es/glsl.d.ts +0 -5
- package/lib/glsl.d.ts +0 -5
|
@@ -1,17 +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(
|
|
14
|
-
return
|
|
11
|
+
items: rampColors.positions.map((value, index) => {
|
|
12
|
+
return {
|
|
13
|
+
[name]: index >= rampColors.colors.length ? null : rampColors.colors[index],
|
|
14
|
+
value
|
|
15
|
+
};
|
|
15
16
|
})
|
|
16
17
|
};
|
|
17
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
|
+
}
|
package/lib/utils/simpleLine.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
(0,
|
|
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
|
-
(
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
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
|
-
|
|
18
|
-
|
|
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
|
|
49
|
-
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
|
-
|
|
59
|
-
|
|
55
|
+
const lastPositionedGlyph = positionedGlyphs[end];
|
|
56
|
+
const glyph = lastPositionedGlyph.glyph;
|
|
60
57
|
if (glyph) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
for (
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
lines.forEach(
|
|
99
|
-
line.split('').forEach(
|
|
100
|
-
|
|
101
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
126
|
-
horizontalAlign
|
|
127
|
-
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
|
-
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
iconfonts.forEach(
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
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
|
-
|
|
178
|
-
horizontalAlign
|
|
179
|
-
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
|
-
|
|
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
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
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
|
|
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
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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
|
-
|
|
246
|
+
// TODO:处理字符旋转的情况
|
|
264
247
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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
|
+
}
|