@antv/l7-layers 2.9.27-alpha.2 → 2.9.27-alpha.4
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/Geometry/index.js +6 -2
- package/es/Geometry/models/billboard.js +3 -7
- package/es/Geometry/models/plane.js +5 -7
- package/es/Geometry/models/sprite.js +4 -7
- package/es/canvas/index.d.ts +4 -0
- package/es/canvas/index.js +38 -2
- package/es/citybuliding/building.js +6 -2
- package/es/citybuliding/models/build.js +2 -3
- package/es/core/BaseLayer.d.ts +20 -12
- package/es/core/BaseLayer.js +61 -85
- package/es/core/BaseModel.d.ts +2 -2
- package/es/core/BaseModel.js +22 -19
- package/es/core/interface.d.ts +20 -1
- package/es/core/triangulation.d.ts +6 -0
- package/es/core/triangulation.js +64 -2
- package/es/earth/index.js +3 -1
- package/es/earth/models/atmosphere.js +4 -7
- package/es/earth/models/base.js +12 -18
- package/es/earth/models/bloomsphere.js +4 -8
- package/es/earth/shaders/atmosphere_frag.glsl +1 -1
- package/es/earth/shaders/bloomsphere_frag.glsl +1 -1
- package/es/heatmap/index.d.ts +2 -2
- package/es/heatmap/index.js +7 -5
- package/es/heatmap/models/grid.js +1 -3
- package/es/heatmap/models/grid3d.js +4 -11
- package/es/heatmap/models/heatmap.js +8 -9
- package/es/heatmap/models/hexagon.js +2 -6
- package/es/heatmap/triangulation.js +0 -1
- package/es/image/index.d.ts +1 -1
- package/es/image/index.js +10 -3
- package/es/image/models/dataImage.d.ts +1 -1
- package/es/image/models/dataImage.js +14 -39
- package/es/image/models/image.js +5 -10
- package/es/image/models/index.d.ts +1 -1
- package/es/image/models/index.js +3 -1
- package/es/image/models/tileDataImage.d.ts +19 -0
- package/es/image/models/tileDataImage.js +174 -0
- package/es/line/index.d.ts +1 -0
- package/es/line/index.js +8 -2
- package/es/line/models/arc.js +10 -10
- package/es/line/models/arc_3d.js +8 -10
- package/es/line/models/earthArc_3d.js +8 -10
- package/es/line/models/great_circle.js +7 -7
- package/es/line/models/half.js +3 -4
- package/es/line/models/line.js +10 -9
- package/es/line/models/linearline.js +3 -4
- package/es/line/models/simpleLine.js +5 -4
- package/es/line/models/simpleTileLine.d.ts +9 -0
- package/es/line/models/simpleTileLine.js +100 -0
- package/es/line/models/tile.d.ts +1 -4
- package/es/line/models/tile.js +50 -223
- package/es/line/models/wall.js +11 -47
- package/es/line/shaders/dash/arc_dash_vert.glsl +2 -0
- package/es/line/shaders/dash/line_dash_frag.glsl +1 -1
- package/es/line/shaders/line_arc2d_vert.glsl +2 -2
- package/es/line/shaders/line_arc_3d_frag.glsl +10 -10
- package/es/line/shaders/line_arc_3d_vert.glsl +5 -6
- package/es/line/shaders/line_arc_frag.glsl +9 -10
- package/es/line/shaders/line_arc_great_circle_frag.glsl +6 -6
- package/es/line/shaders/line_arc_great_circle_vert.glsl +2 -3
- package/es/line/shaders/line_arc_vert.glsl +6 -4
- package/es/line/shaders/line_bezier_vert.glsl +2 -2
- package/es/line/shaders/line_frag.glsl +5 -6
- package/es/line/shaders/line_vert.glsl +1 -1
- package/es/line/shaders/linear/arc3d_linear_frag.glsl +6 -7
- package/es/line/shaders/linear/arc3d_linear_vert.glsl +11 -12
- package/es/line/shaders/linear/arc_linear_frag.glsl +1 -1
- package/es/line/shaders/tile/line_tile_map_vert.glsl +25 -0
- package/es/line/shaders/tile/line_tile_vert.glsl +19 -177
- package/es/line/shaders/tile/simpleline_map_vert.glsl +15 -0
- package/es/line/shaders/tile/simpleline_vert.glsl +21 -0
- package/es/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +21 -25
- package/es/line/shaders/wall/wall_vert.glsl +77 -0
- package/es/mask/index.d.ts +1 -0
- package/es/mask/index.js +80 -5
- package/es/mask/models/fill.d.ts +2 -1
- package/es/mask/models/fill.js +13 -10
- package/es/mask/shaders/mask_vert.glsl +0 -6
- package/es/plugins/DataMappingPlugin.d.ts +4 -3
- package/es/plugins/DataMappingPlugin.js +129 -58
- package/es/plugins/DataSourcePlugin.js +3 -2
- package/es/plugins/FeatureScalePlugin.d.ts +0 -2
- package/es/plugins/FeatureScalePlugin.js +8 -51
- package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -2
- package/es/plugins/LayerAnimateStylePlugin.js +7 -27
- package/es/plugins/LayerModelPlugin.js +2 -6
- package/es/plugins/LightingPlugin.js +1 -7
- package/es/plugins/MultiPassRendererPlugin.d.ts +0 -1
- package/es/plugins/MultiPassRendererPlugin.js +4 -16
- package/es/plugins/PixelPickingPlugin.d.ts +1 -1
- package/es/plugins/PixelPickingPlugin.js +8 -28
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +4 -0
- package/es/plugins/RegisterStyleAttributePlugin.js +56 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +2 -9
- package/es/point/index.js +9 -6
- package/es/point/models/earthExtrude.d.ts +1 -1
- package/es/point/models/earthExtrude.js +9 -14
- package/es/point/models/earthFill.js +2 -2
- package/es/point/models/extrude.d.ts +1 -1
- package/es/point/models/extrude.js +9 -12
- package/es/point/models/fill.d.ts +1 -1
- package/es/point/models/fill.js +8 -9
- package/es/point/models/fillmage.js +5 -6
- package/es/point/models/image.js +3 -3
- package/es/point/models/index.d.ts +1 -1
- package/es/point/models/index.js +3 -3
- package/es/point/models/normal.d.ts +0 -1
- package/es/point/models/normal.js +9 -62
- package/es/point/models/radar.js +5 -70
- package/es/point/models/simplePoint.d.ts +0 -1
- package/es/point/models/simplePoint.js +2 -11
- package/es/point/models/text.js +7 -10
- package/es/point/models/tile.d.ts +0 -7
- package/es/point/models/tile.js +24 -158
- package/es/point/models/tileText.d.ts +0 -4
- package/es/point/models/tileText.js +99 -188
- package/es/point/shaders/animate/wave_frag.glsl +4 -4
- package/es/point/shaders/earth/fill_vert.glsl +0 -1
- package/es/point/shaders/fill_vert.glsl +0 -1
- package/es/point/shaders/normal_frag.glsl +1 -10
- package/es/point/shaders/normal_vert.glsl +5 -60
- package/es/point/shaders/radar/radar_frag.glsl +4 -15
- package/es/point/shaders/radar/radar_vert.glsl +4 -54
- package/es/point/shaders/tile/fill_tile_frag.glsl +10 -17
- package/es/point/shaders/tile/fill_tile_vert.glsl +20 -123
- package/es/point/shaders/tile/text_frag.glsl +33 -0
- package/es/point/shaders/tile/text_map_frag.glsl +31 -0
- package/es/point/shaders/tile/text_map_vert.glsl +38 -0
- package/es/point/shaders/tile/text_vert.glsl +48 -0
- package/es/polygon/index.js +6 -2
- package/es/polygon/models/extrude.js +4 -8
- package/es/polygon/models/fill.js +3 -4
- package/es/polygon/models/ocean.d.ts +0 -2
- package/es/polygon/models/ocean.js +13 -47
- package/es/polygon/models/tile.d.ts +1 -4
- package/es/polygon/models/tile.js +25 -57
- package/es/polygon/models/water.d.ts +0 -2
- package/es/polygon/models/water.js +13 -47
- package/es/polygon/shaders/polygon_frag.glsl +2 -2
- package/es/polygon/shaders/polygon_vert.glsl +2 -2
- package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
- package/es/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
- package/es/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
- package/es/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
- package/es/polygon/shaders/water/polygon_water_frag.glsl +1 -3
- package/es/polygon/shaders/water/polygon_water_vert.glsl +0 -29
- package/es/raster/buffers/triangulation.js +1 -4
- package/es/raster/index.js +6 -2
- package/es/raster/models/raster.d.ts +1 -1
- package/es/raster/models/raster.js +6 -5
- package/es/shader/minify_frag.glsl +7 -0
- package/es/shader/minify_picking_frag.glsl +10 -0
- package/es/tile/manager/baseMapTileLayerManager.d.ts +29 -0
- package/es/tile/manager/baseMapTileLayerManager.js +207 -0
- package/es/tile/manager/tileLayerManager.d.ts +2 -2
- package/es/tile/manager/tileLayerManager.js +12 -2
- package/es/tile/manager/tilePickerManager.d.ts +2 -3
- package/es/tile/manager/tilePickerManager.js +1 -2
- package/es/tile/models/tileModel.d.ts +1 -0
- package/es/tile/models/tileModel.js +18 -2
- package/es/tile/tileFactory/base.d.ts +1 -1
- package/es/tile/tileFactory/base.js +58 -33
- package/es/tile/tileFactory/line.js +3 -0
- package/es/tile/tileFactory/point.js +3 -0
- package/es/tile/tileFactory/polygon.js +3 -0
- package/es/tile/tileFactory/raster.js +3 -0
- package/es/tile/tileFactory/rasterData.js +3 -0
- package/es/tile/tileFactory/rasterDataLayer.js +6 -2
- package/es/tile/tileFactory/test.js +26 -5
- package/es/tile/tileFactory/vectorLayer.d.ts +4 -1
- package/es/tile/tileFactory/vectorLayer.js +110 -7
- package/es/tile/tileLayer/baseMapTileLayer.d.ts +29 -0
- package/es/tile/tileLayer/baseMapTileLayer.js +188 -0
- package/es/tile/tileLayer/baseTileLayer.d.ts +4 -4
- package/es/tile/tileLayer/baseTileLayer.js +46 -75
- package/es/tile/tileTest.d.ts +1 -0
- package/es/tile/tileTest.js +3 -2
- package/es/tile/tmsMapTileLayer.d.ts +9 -0
- package/es/tile/tmsMapTileLayer.js +119 -0
- package/es/tile/tmsTileLayer.d.ts +2 -0
- package/es/tile/tmsTileLayer.js +24 -2
- package/es/tile/utils.d.ts +4 -0
- package/es/tile/utils.js +30 -0
- package/es/utils/dataMappingStyle.js +3 -0
- package/es/utils/layerData.js +2 -2
- package/es/utils/updateShape.js +2 -2
- package/es/wind/index.js +6 -2
- package/es/wind/models/wind.js +8 -8
- package/es/wind/shaders/wind_vert.glsl +1 -1
- package/lib/Geometry/index.js +6 -2
- package/lib/Geometry/models/billboard.js +3 -7
- package/lib/Geometry/models/plane.js +5 -7
- package/lib/Geometry/models/sprite.js +4 -7
- package/lib/canvas/index.js +37 -2
- package/lib/citybuliding/building.js +6 -2
- package/lib/citybuliding/models/build.js +2 -3
- package/lib/core/BaseLayer.js +61 -85
- package/lib/core/BaseModel.js +22 -19
- package/lib/core/triangulation.js +66 -2
- package/lib/earth/index.js +3 -1
- package/lib/earth/models/atmosphere.js +4 -7
- package/lib/earth/models/base.js +12 -18
- package/lib/earth/models/bloomsphere.js +4 -8
- package/lib/earth/shaders/atmosphere_frag.glsl +1 -1
- package/lib/earth/shaders/bloomsphere_frag.glsl +1 -1
- package/lib/heatmap/index.js +7 -5
- package/lib/heatmap/models/grid.js +1 -3
- package/lib/heatmap/models/grid3d.js +4 -11
- package/lib/heatmap/models/heatmap.js +8 -9
- package/lib/heatmap/models/hexagon.js +2 -6
- package/lib/heatmap/triangulation.js +0 -1
- package/lib/image/index.js +10 -3
- package/lib/image/models/dataImage.js +13 -38
- package/lib/image/models/image.js +5 -10
- package/lib/image/models/index.js +4 -1
- package/lib/image/models/tileDataImage.js +188 -0
- package/lib/line/index.js +7 -2
- package/lib/line/models/arc.js +10 -10
- package/lib/line/models/arc_3d.js +8 -10
- package/lib/line/models/earthArc_3d.js +8 -10
- package/lib/line/models/great_circle.js +7 -7
- package/lib/line/models/half.js +3 -4
- package/lib/line/models/line.js +10 -9
- package/lib/line/models/linearline.js +3 -4
- package/lib/line/models/simpleLine.js +5 -4
- package/lib/line/models/simpleTileLine.js +115 -0
- package/lib/line/models/tile.js +50 -224
- package/lib/line/models/wall.js +11 -47
- package/lib/line/shaders/dash/arc_dash_vert.glsl +2 -0
- package/lib/line/shaders/dash/line_dash_frag.glsl +1 -1
- package/lib/line/shaders/line_arc2d_vert.glsl +2 -2
- package/lib/line/shaders/line_arc_3d_frag.glsl +10 -10
- package/lib/line/shaders/line_arc_3d_vert.glsl +5 -6
- package/lib/line/shaders/line_arc_frag.glsl +9 -10
- package/lib/line/shaders/line_arc_great_circle_frag.glsl +6 -6
- package/lib/line/shaders/line_arc_great_circle_vert.glsl +2 -3
- package/lib/line/shaders/line_arc_vert.glsl +6 -4
- package/lib/line/shaders/line_bezier_vert.glsl +2 -2
- package/lib/line/shaders/line_frag.glsl +5 -6
- package/lib/line/shaders/line_vert.glsl +1 -1
- package/lib/line/shaders/linear/arc3d_linear_frag.glsl +6 -7
- package/lib/line/shaders/linear/arc3d_linear_vert.glsl +11 -12
- package/lib/line/shaders/linear/arc_linear_frag.glsl +1 -1
- package/lib/line/shaders/tile/line_tile_map_vert.glsl +25 -0
- package/lib/line/shaders/tile/line_tile_vert.glsl +19 -177
- package/lib/line/shaders/tile/simpleline_map_vert.glsl +15 -0
- package/lib/line/shaders/tile/simpleline_vert.glsl +21 -0
- package/lib/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +21 -25
- package/lib/line/shaders/wall/wall_vert.glsl +77 -0
- package/lib/mask/index.js +82 -5
- package/lib/mask/models/fill.js +14 -10
- package/lib/mask/shaders/mask_vert.glsl +0 -6
- package/lib/plugins/DataMappingPlugin.js +127 -57
- package/lib/plugins/DataSourcePlugin.js +3 -2
- package/lib/plugins/FeatureScalePlugin.js +6 -50
- package/lib/plugins/LayerAnimateStylePlugin.js +6 -29
- package/lib/plugins/LayerModelPlugin.js +2 -6
- package/lib/plugins/LightingPlugin.js +1 -7
- package/lib/plugins/MultiPassRendererPlugin.js +3 -19
- package/lib/plugins/PixelPickingPlugin.js +8 -28
- package/lib/plugins/RegisterStyleAttributePlugin.js +56 -5
- package/lib/plugins/UpdateStyleAttributePlugin.js +2 -9
- package/lib/point/index.js +9 -6
- package/lib/point/models/earthExtrude.js +9 -14
- package/lib/point/models/earthFill.js +2 -2
- package/lib/point/models/extrude.js +9 -12
- package/lib/point/models/fill.js +8 -9
- package/lib/point/models/fillmage.js +5 -6
- package/lib/point/models/image.js +3 -3
- package/lib/point/models/index.js +1 -1
- package/lib/point/models/normal.js +8 -61
- package/lib/point/models/radar.js +5 -70
- package/lib/point/models/simplePoint.js +1 -10
- package/lib/point/models/text.js +7 -10
- package/lib/point/models/tile.js +23 -159
- package/lib/point/models/tileText.js +98 -187
- package/lib/point/shaders/animate/wave_frag.glsl +4 -4
- package/lib/point/shaders/earth/fill_vert.glsl +0 -1
- package/lib/point/shaders/fill_vert.glsl +0 -1
- package/lib/point/shaders/normal_frag.glsl +1 -10
- package/lib/point/shaders/normal_vert.glsl +5 -60
- package/lib/point/shaders/radar/radar_frag.glsl +4 -15
- package/lib/point/shaders/radar/radar_vert.glsl +4 -54
- package/lib/point/shaders/tile/fill_tile_frag.glsl +10 -17
- package/lib/point/shaders/tile/fill_tile_vert.glsl +20 -123
- package/lib/point/shaders/tile/text_frag.glsl +33 -0
- package/lib/point/shaders/tile/text_map_frag.glsl +31 -0
- package/lib/point/shaders/tile/text_map_vert.glsl +38 -0
- package/lib/point/shaders/tile/text_vert.glsl +48 -0
- package/lib/polygon/index.js +6 -2
- package/lib/polygon/models/extrude.js +4 -8
- package/lib/polygon/models/fill.js +3 -4
- package/lib/polygon/models/ocean.js +14 -47
- package/lib/polygon/models/tile.js +24 -57
- package/lib/polygon/models/water.js +14 -47
- package/lib/polygon/shaders/polygon_frag.glsl +2 -2
- package/lib/polygon/shaders/polygon_vert.glsl +2 -2
- package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
- package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
- package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
- package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
- package/lib/polygon/shaders/water/polygon_water_frag.glsl +1 -3
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +0 -29
- package/lib/raster/buffers/triangulation.js +1 -4
- package/lib/raster/index.js +6 -2
- package/lib/raster/models/raster.js +6 -5
- package/lib/shader/minify_frag.glsl +7 -0
- package/lib/shader/minify_picking_frag.glsl +10 -0
- package/lib/tile/manager/baseMapTileLayerManager.js +222 -0
- package/lib/tile/manager/tileLayerManager.js +12 -2
- package/lib/tile/manager/tilePickerManager.js +1 -2
- package/lib/tile/models/tileModel.js +19 -2
- package/lib/tile/tileFactory/base.js +60 -33
- package/lib/tile/tileFactory/line.js +3 -0
- package/lib/tile/tileFactory/point.js +3 -0
- package/lib/tile/tileFactory/polygon.js +3 -0
- package/lib/tile/tileFactory/raster.js +3 -0
- package/lib/tile/tileFactory/rasterData.js +3 -0
- package/lib/tile/tileFactory/rasterDataLayer.js +6 -2
- package/lib/tile/tileFactory/test.js +26 -5
- package/lib/tile/tileFactory/vectorLayer.js +112 -8
- package/lib/tile/tileLayer/baseMapTileLayer.js +195 -0
- package/lib/tile/tileLayer/baseTileLayer.js +46 -75
- package/lib/tile/tileTest.js +3 -2
- package/lib/tile/tmsMapTileLayer.js +136 -0
- package/lib/tile/tmsTileLayer.js +25 -2
- package/lib/tile/utils.js +38 -0
- package/lib/utils/dataMappingStyle.js +3 -0
- package/lib/utils/layerData.js +2 -2
- package/lib/utils/updateShape.js +2 -2
- package/lib/wind/index.js +6 -2
- package/lib/wind/models/wind.js +7 -7
- package/lib/wind/shaders/wind_vert.glsl +1 -1
- package/package.json +8 -7
- package/es/line/shaders/tile/line_tile_frag.glsl +0 -79
- package/es/line/shaders/wall_vert.glsl +0 -111
- package/es/mask/shaders/mask_frag.glsl +0 -7
- package/es/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
- package/lib/line/shaders/tile/line_tile_frag.glsl +0 -79
- package/lib/line/shaders/wall_vert.glsl +0 -111
- package/lib/mask/shaders/mask_frag.glsl +0 -7
- package/lib/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
|
@@ -1,36 +1,32 @@
|
|
|
1
1
|
#define Animate 0.0
|
|
2
2
|
#define LineTexture 1.0
|
|
3
3
|
|
|
4
|
-
uniform float u_opacity : 1.0;
|
|
5
|
-
uniform float u_textureBlend;
|
|
6
|
-
uniform float u_iconStepCount;
|
|
7
|
-
|
|
8
|
-
varying vec4 v_color;
|
|
9
|
-
|
|
10
4
|
// line texture
|
|
11
5
|
uniform float u_line_texture;
|
|
12
6
|
uniform sampler2D u_texture;
|
|
13
7
|
uniform vec2 u_textSize;
|
|
14
|
-
|
|
15
|
-
varying vec2 v_iconMapUV;
|
|
16
|
-
varying float v_blur;
|
|
17
|
-
|
|
18
8
|
uniform float u_linearColor: 0;
|
|
19
9
|
uniform vec4 u_sourceColor;
|
|
20
10
|
uniform vec4 u_targetColor;
|
|
11
|
+
uniform float u_opacity : 1.0;
|
|
12
|
+
uniform float u_textureBlend;
|
|
13
|
+
uniform float u_iconStepCount;
|
|
14
|
+
uniform float u_time;
|
|
15
|
+
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; // 控制运动
|
|
21
16
|
|
|
22
|
-
|
|
17
|
+
varying vec2 v_iconMapUV;
|
|
18
|
+
varying float v_blur;
|
|
19
|
+
varying float v_radio;
|
|
20
|
+
varying vec4 v_color;
|
|
21
|
+
varying vec4 v_dataset;
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // 控制运动
|
|
23
|
+
#pragma include "picking"
|
|
26
24
|
|
|
27
|
-
varying mat4 styleMappingMat;
|
|
28
|
-
// [animate, duration, interval, trailLength],
|
|
29
25
|
void main() {
|
|
30
|
-
float opacity =
|
|
26
|
+
float opacity = u_opacity;
|
|
31
27
|
float animateSpeed = 0.0; // 运动速度
|
|
32
|
-
float d_distance_ratio =
|
|
33
|
-
float v =
|
|
28
|
+
float d_distance_ratio = v_dataset.r; // 当前点位距离占线总长的比例
|
|
29
|
+
float v = v_dataset.a;
|
|
34
30
|
|
|
35
31
|
if(u_linearColor == 1.0) { // 使用渐变颜色
|
|
36
32
|
gl_FragColor = mix(u_sourceColor, u_targetColor, v);
|
|
@@ -39,19 +35,19 @@ void main() {
|
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
gl_FragColor.a *= opacity; // 全局透明度
|
|
42
|
-
if(
|
|
43
|
-
animateSpeed = u_time /
|
|
44
|
-
float alpha =1.0 - fract( mod(1.0- d_distance_ratio,
|
|
45
|
-
alpha = (alpha +
|
|
38
|
+
if(u_animate.x == Animate) {
|
|
39
|
+
animateSpeed = u_time / u_animate.y;
|
|
40
|
+
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);
|
|
41
|
+
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
|
|
46
42
|
alpha = smoothstep(0., 1., alpha);
|
|
47
43
|
gl_FragColor.a *= alpha;
|
|
48
44
|
}
|
|
49
45
|
|
|
50
46
|
if(u_line_texture == LineTexture) { // while load texture
|
|
51
|
-
float aDistance =
|
|
52
|
-
float d_texPixelLen =
|
|
47
|
+
float aDistance = v_dataset.g; // 当前顶点的距离
|
|
48
|
+
float d_texPixelLen = v_dataset.b; // 贴图的像素长度,根据地图层级缩放
|
|
53
49
|
float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);
|
|
54
|
-
float v =
|
|
50
|
+
float v = v_dataset.a; // 线图层贴图部分的 v 坐标值
|
|
55
51
|
|
|
56
52
|
// 计算纹理间隔 start
|
|
57
53
|
float flag = 0.0;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#define Animate 0.0
|
|
2
|
+
|
|
3
|
+
attribute float a_Miter;
|
|
4
|
+
attribute vec4 a_Color;
|
|
5
|
+
attribute vec2 a_Size;
|
|
6
|
+
attribute vec3 a_Normal;
|
|
7
|
+
attribute vec3 a_Position;
|
|
8
|
+
attribute vec2 a_iconMapUV;
|
|
9
|
+
attribute float a_Total_Distance;
|
|
10
|
+
attribute float a_Distance;
|
|
11
|
+
|
|
12
|
+
uniform mat4 u_ModelMatrix;
|
|
13
|
+
uniform mat4 u_Mvp;
|
|
14
|
+
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
|
|
15
|
+
uniform float u_icon_step: 100;
|
|
16
|
+
uniform float u_heightfixed;
|
|
17
|
+
uniform float u_linearColor: 0;
|
|
18
|
+
|
|
19
|
+
#pragma include "projection"
|
|
20
|
+
#pragma include "light"
|
|
21
|
+
#pragma include "picking"
|
|
22
|
+
|
|
23
|
+
// texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
|
|
24
|
+
varying vec2 v_iconMapUV;
|
|
25
|
+
varying vec4 v_color;
|
|
26
|
+
varying float v_blur;
|
|
27
|
+
varying float v_radio;
|
|
28
|
+
varying vec4 v_dataset;
|
|
29
|
+
|
|
30
|
+
void main() {
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
float d_distance_ratio; // 当前点位距离占线总长的比例
|
|
34
|
+
float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
|
|
35
|
+
|
|
36
|
+
v_iconMapUV = a_iconMapUV;
|
|
37
|
+
if(u_heightfixed < 1.0) { // 高度随 zoom 调整
|
|
38
|
+
d_texPixelLen = project_pixel(u_icon_step);
|
|
39
|
+
} else {
|
|
40
|
+
d_texPixelLen = u_icon_step;
|
|
41
|
+
}
|
|
42
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
|
|
43
|
+
d_texPixelLen *= 10.0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if(u_animate.x == Animate || u_linearColor == 1.0) {
|
|
47
|
+
d_distance_ratio = a_Distance / a_Total_Distance;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
float miter = (a_Miter + 1.0)/2.0;
|
|
51
|
+
// 设置数据集的参数
|
|
52
|
+
v_dataset[0] = d_distance_ratio; // 当前点位距离占线总长的比例
|
|
53
|
+
v_dataset[1] = a_Distance; // 当前顶点的距离
|
|
54
|
+
v_dataset[2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
|
|
55
|
+
v_dataset[3] = miter; // 线图层贴图部分的 v 坐标值 0 - 1
|
|
56
|
+
|
|
57
|
+
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
|
|
58
|
+
|
|
59
|
+
float originSize = a_Size.x; // 固定高度
|
|
60
|
+
if(u_heightfixed < 1.0) { // 高度随 zoom 调整
|
|
61
|
+
originSize = project_float_pixel(a_Size.x);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
float wallHeight = originSize * miter;
|
|
65
|
+
float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));
|
|
66
|
+
|
|
67
|
+
v_blur = min(project_float_pixel(2.0) / originSize, 0.05);
|
|
68
|
+
v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);
|
|
69
|
+
|
|
70
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
71
|
+
gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));
|
|
72
|
+
} else {
|
|
73
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
setPickingColor(a_PickingColor);
|
|
77
|
+
}
|
package/es/mask/index.d.ts
CHANGED
package/es/mask/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
@@ -6,12 +7,19 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
9
|
|
|
10
|
+
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; } } }; }
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
9
16
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
17
|
|
|
11
18
|
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
19
|
|
|
13
20
|
import BaseLayer from "../core/BaseLayer";
|
|
14
21
|
import MaskModels from "./models";
|
|
22
|
+
import { TYPES } from '@antv/l7-core';
|
|
15
23
|
|
|
16
24
|
var MaskLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
17
25
|
_inherits(MaskLayer, _BaseLayer);
|
|
@@ -35,25 +43,92 @@ var MaskLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
35
43
|
}
|
|
36
44
|
|
|
37
45
|
_createClass(MaskLayer, [{
|
|
46
|
+
key: "init",
|
|
47
|
+
value: function init() {
|
|
48
|
+
var _this2 = this;
|
|
49
|
+
|
|
50
|
+
// 设置配置项
|
|
51
|
+
var sceneId = this.container.get(TYPES.SceneID);
|
|
52
|
+
this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);
|
|
53
|
+
this.layerType = this.rawConfig.layerType;
|
|
54
|
+
this.rendererService = this.container.get(TYPES.IRendererService);
|
|
55
|
+
this.layerService = this.container.get(TYPES.ILayerService);
|
|
56
|
+
this.mapService = this.container.get(TYPES.IMapService);
|
|
57
|
+
this.cameraService = this.container.get(TYPES.ICameraService);
|
|
58
|
+
this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
|
|
59
|
+
this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
|
|
60
|
+
this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
|
|
61
|
+
this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass); // 图层容器服务
|
|
62
|
+
|
|
63
|
+
this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService); // 完成样式服务注册完成前添加的属性
|
|
64
|
+
|
|
65
|
+
this.pendingStyleAttributes.forEach(function (_ref) {
|
|
66
|
+
var attributeName = _ref.attributeName,
|
|
67
|
+
attributeField = _ref.attributeField,
|
|
68
|
+
attributeValues = _ref.attributeValues,
|
|
69
|
+
updateOptions = _ref.updateOptions;
|
|
70
|
+
|
|
71
|
+
_this2.styleAttributeService.updateStyleAttribute(attributeName, {
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
scale: _objectSpread({
|
|
74
|
+
field: attributeField
|
|
75
|
+
}, _this2.splitValuesAndCallbackInAttribute( // @ts-ignore
|
|
76
|
+
attributeValues, // @ts-ignore
|
|
77
|
+
_this2.getLayerConfig()[attributeName]))
|
|
78
|
+
}, // @ts-ignore
|
|
79
|
+
updateOptions);
|
|
80
|
+
});
|
|
81
|
+
this.pendingStyleAttributes = []; // 获取插件集
|
|
82
|
+
|
|
83
|
+
this.plugins = this.container.getAll(TYPES.ILayerPlugin); // 完成插件注册,传入场景和图层容器内的服务
|
|
84
|
+
|
|
85
|
+
var _iterator = _createForOfIteratorHelper(this.plugins),
|
|
86
|
+
_step;
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
90
|
+
var plugin = _step.value;
|
|
91
|
+
plugin.apply(this, {
|
|
92
|
+
rendererService: this.rendererService,
|
|
93
|
+
mapService: this.mapService,
|
|
94
|
+
styleAttributeService: this.styleAttributeService,
|
|
95
|
+
normalPassFactory: this.normalPassFactory,
|
|
96
|
+
postProcessingPassFactory: this.postProcessingPassFactory
|
|
97
|
+
});
|
|
98
|
+
} // 触发 init 生命周期插件
|
|
99
|
+
|
|
100
|
+
} catch (err) {
|
|
101
|
+
_iterator.e(err);
|
|
102
|
+
} finally {
|
|
103
|
+
_iterator.f();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
this.hooks.init.call();
|
|
107
|
+
this.hooks.afterInit.call();
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
38
111
|
key: "buildModels",
|
|
39
112
|
value: function buildModels() {
|
|
40
|
-
var
|
|
113
|
+
var _this3 = this;
|
|
41
114
|
|
|
42
115
|
var shape = this.getModelType();
|
|
43
116
|
this.layerModel = new MaskModels[shape](this);
|
|
44
117
|
this.layerModel.initModels(function (models) {
|
|
45
|
-
|
|
118
|
+
_this3.models = models;
|
|
46
119
|
|
|
47
|
-
|
|
120
|
+
_this3.emit('modelLoaded', null);
|
|
48
121
|
});
|
|
49
122
|
}
|
|
50
123
|
}, {
|
|
51
124
|
key: "rebuildModels",
|
|
52
125
|
value: function rebuildModels() {
|
|
53
|
-
var
|
|
126
|
+
var _this4 = this;
|
|
54
127
|
|
|
55
128
|
this.layerModel.buildModels(function (models) {
|
|
56
|
-
|
|
129
|
+
_this4.models = models;
|
|
130
|
+
|
|
131
|
+
_this4.emit('modelLoaded', null);
|
|
57
132
|
});
|
|
58
133
|
}
|
|
59
134
|
}, {
|
package/es/mask/models/fill.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ import BaseModel from '../../core/BaseModel';
|
|
|
3
3
|
export default class MaskModel extends BaseModel {
|
|
4
4
|
getUninforms(): {
|
|
5
5
|
u_opacity: number;
|
|
6
|
+
u_color: number[];
|
|
6
7
|
};
|
|
7
8
|
initModels(callbackModel: (models: IModel[]) => void): void;
|
|
8
9
|
buildModels(callbackModel: (models: IModel[]) => void): Promise<void>;
|
|
9
|
-
clearModels(): void;
|
|
10
|
+
clearModels(refresh?: boolean): void;
|
|
10
11
|
protected registerBuiltinAttributes(): string;
|
|
11
12
|
}
|
package/es/mask/models/fill.js
CHANGED
|
@@ -11,15 +11,16 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
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
12
|
|
|
13
13
|
import { gl } from '@antv/l7-core';
|
|
14
|
+
import { rgb2arr } from '@antv/l7-utils';
|
|
14
15
|
import { isNumber } from 'lodash';
|
|
15
16
|
import BaseModel from "../../core/BaseModel";
|
|
16
17
|
import { polygonTriangulation } from "../../core/triangulation";
|
|
17
18
|
|
|
18
|
-
/* babel-plugin-inline-import '
|
|
19
|
-
var mask_frag = "uniform float u_opacity;\
|
|
19
|
+
/* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
|
|
20
|
+
var mask_frag = "uniform float u_opacity : 1.0;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n gl_FragColor.a *= u_opacity;\n}\n";
|
|
20
21
|
|
|
21
22
|
/* babel-plugin-inline-import '../shaders/mask_vert.glsl' */
|
|
22
|
-
var mask_vert = "attribute
|
|
23
|
+
var mask_vert = "attribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#pragma include \"projection\"\n\nvoid main() {\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
|
|
23
24
|
|
|
24
25
|
var MaskModel = /*#__PURE__*/function (_BaseModel) {
|
|
25
26
|
_inherits(MaskModel, _BaseModel);
|
|
@@ -37,10 +38,13 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
37
38
|
value: function getUninforms() {
|
|
38
39
|
var _ref = this.layer.getLayerConfig(),
|
|
39
40
|
_ref$opacity = _ref.opacity,
|
|
40
|
-
opacity = _ref$opacity === void 0 ? 0 : _ref$opacity
|
|
41
|
+
opacity = _ref$opacity === void 0 ? 0 : _ref$opacity,
|
|
42
|
+
_ref$color = _ref.color,
|
|
43
|
+
color = _ref$color === void 0 ? '#000' : _ref$color;
|
|
41
44
|
|
|
42
45
|
return {
|
|
43
|
-
u_opacity: isNumber(opacity) ? opacity : 0.0
|
|
46
|
+
u_opacity: isNumber(opacity) ? opacity : 0.0,
|
|
47
|
+
u_color: rgb2arr(color)
|
|
44
48
|
};
|
|
45
49
|
}
|
|
46
50
|
}, {
|
|
@@ -78,7 +82,8 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
78
82
|
zfail: gl.REPLACE,
|
|
79
83
|
zpass: gl.REPLACE
|
|
80
84
|
}
|
|
81
|
-
}
|
|
85
|
+
},
|
|
86
|
+
pick: false
|
|
82
87
|
}).then(function (model) {
|
|
83
88
|
callbackModel([model]);
|
|
84
89
|
}).catch(function (err) {
|
|
@@ -103,10 +108,8 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
103
108
|
}, {
|
|
104
109
|
key: "clearModels",
|
|
105
110
|
value: function clearModels() {
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
109
|
-
this.layerService.clear();
|
|
111
|
+
var refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
112
|
+
refresh && this.layerService.clear();
|
|
110
113
|
}
|
|
111
114
|
}, {
|
|
112
115
|
key: "registerBuiltinAttributes",
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
attribute vec4 a_Color;
|
|
2
1
|
attribute vec3 a_Position;
|
|
3
2
|
uniform mat4 u_ModelMatrix;
|
|
4
3
|
uniform mat4 u_Mvp;
|
|
5
4
|
|
|
6
|
-
varying vec4 v_Color;
|
|
7
|
-
|
|
8
5
|
#pragma include "projection"
|
|
9
6
|
|
|
10
7
|
void main() {
|
|
11
|
-
|
|
12
|
-
v_Color = a_Color;
|
|
13
8
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
14
|
-
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
15
9
|
|
|
16
10
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
17
11
|
gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { ILayer, ILayerPlugin, IStyleAttributeService } from '@antv/l7-core';
|
|
2
2
|
import 'reflect-metadata';
|
|
3
3
|
export default class DataMappingPlugin implements ILayerPlugin {
|
|
4
|
-
private readonly configService;
|
|
5
4
|
private readonly mapService;
|
|
6
5
|
private readonly fontService;
|
|
7
6
|
apply(layer: ILayer, { styleAttributeService, }: {
|
|
8
7
|
styleAttributeService: IStyleAttributeService;
|
|
9
8
|
}): void;
|
|
10
9
|
private generateMaping;
|
|
11
|
-
private getArrowPoints;
|
|
12
10
|
private mapping;
|
|
11
|
+
private mapLayerMapping;
|
|
13
12
|
private adjustData2Amap2Coordinates;
|
|
14
|
-
private getLayerCenter;
|
|
15
13
|
private adjustData2SimpleCoordinates;
|
|
14
|
+
private getLayerCenter;
|
|
16
15
|
private unProjectCoordinates;
|
|
17
16
|
private applyAttributeMapping;
|
|
17
|
+
private applyMapLayerAttributeMapping;
|
|
18
|
+
private getArrowPoints;
|
|
18
19
|
}
|