@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
|
@@ -20,14 +20,11 @@ var PixelPickingPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
|
|
|
20
20
|
_createClass(PixelPickingPlugin, [{
|
|
21
21
|
key: "apply",
|
|
22
22
|
value: function apply(layer, _ref) {
|
|
23
|
-
var
|
|
24
|
-
styleAttributeService = _ref.styleAttributeService;
|
|
23
|
+
var styleAttributeService = _ref.styleAttributeService;
|
|
25
24
|
// TODO: 由于 Shader 目前无法根据是否开启拾取进行内容修改,因此即使不开启也需要生成 a_PickingColor
|
|
26
25
|
layer.hooks.init.tap('PixelPickingPlugin', function () {
|
|
27
26
|
var _layer$getLayerConfig = layer.getLayerConfig(),
|
|
28
|
-
enablePicking = _layer$getLayerConfig.enablePicking
|
|
29
|
-
enableMultiPassRenderer = _layer$getLayerConfig.enableMultiPassRenderer; // const enablePicking = true;
|
|
30
|
-
|
|
27
|
+
enablePicking = _layer$getLayerConfig.enablePicking;
|
|
31
28
|
|
|
32
29
|
styleAttributeService.registerStyleAttribute({
|
|
33
30
|
name: 'pickingColor',
|
|
@@ -40,7 +37,7 @@ var PixelPickingPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
|
|
|
40
37
|
},
|
|
41
38
|
size: 3,
|
|
42
39
|
// TODO: 固定 feature range 范围内的 pickingColor 都是固定的,可以生成 cache
|
|
43
|
-
update: function update(feature
|
|
40
|
+
update: function update(feature) {
|
|
44
41
|
// 只有开启拾取才需要 encode
|
|
45
42
|
var id = feature.id;
|
|
46
43
|
return enablePicking ? encodePickingColor(id) : [0, 0, 0];
|
|
@@ -48,7 +45,6 @@ var PixelPickingPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
|
|
|
48
45
|
}
|
|
49
46
|
});
|
|
50
47
|
}); // 必须要与 PixelPickingPass 结合使用,因此必须开启 multiPassRenderer
|
|
51
|
-
// if (layer.multiPassRenderer) {
|
|
52
48
|
|
|
53
49
|
layer.hooks.beforePickingEncode.tap('PixelPickingPlugin', function () {
|
|
54
50
|
var _layer$getLayerConfig2 = layer.getLayerConfig(),
|
|
@@ -79,23 +75,12 @@ var PixelPickingPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
|
|
|
79
75
|
var _layer$getLayerConfig4 = layer.getLayerConfig(),
|
|
80
76
|
highlightColor = _layer$getLayerConfig4.highlightColor,
|
|
81
77
|
_layer$getLayerConfig5 = _layer$getLayerConfig4.activeMix,
|
|
82
|
-
activeMix = _layer$getLayerConfig5 === void 0 ? 0 : _layer$getLayerConfig5;
|
|
83
|
-
// highlightColor,
|
|
84
|
-
// activeMix = 0,
|
|
85
|
-
// enableSelect,
|
|
86
|
-
// } = layer.getLayerConfig();
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var highlightColorInArray = typeof highlightColor === 'string' ? rgb2arr(highlightColor) : highlightColor || [1, 0, 0, 1]; // const { selectColor } = layer.getLayerConfig();
|
|
90
|
-
// const selectColorInArray =
|
|
91
|
-
// typeof selectColor === 'string'
|
|
92
|
-
// ? rgb2arr(selectColor)
|
|
93
|
-
// : selectColor || [1, 0, 0, 1];
|
|
78
|
+
activeMix = _layer$getLayerConfig5 === void 0 ? 0 : _layer$getLayerConfig5;
|
|
94
79
|
|
|
80
|
+
var highlightColorInArray = typeof highlightColor === 'string' ? rgb2arr(highlightColor) : highlightColor || [1, 0, 0, 1];
|
|
95
81
|
layer.updateLayerConfig({
|
|
96
82
|
pickedFeatureID: decodePickingColor(new Uint8Array(pickedColor))
|
|
97
|
-
});
|
|
98
|
-
|
|
83
|
+
});
|
|
99
84
|
layer.models.forEach(function (model) {
|
|
100
85
|
return model.addUniforms({
|
|
101
86
|
u_PickingStage: PickingStage.HIGHLIGHT,
|
|
@@ -103,12 +88,7 @@ var PixelPickingPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
|
|
|
103
88
|
u_HighlightColor: highlightColorInArray.map(function (c) {
|
|
104
89
|
return c * 255;
|
|
105
90
|
}),
|
|
106
|
-
u_activeMix: activeMix
|
|
107
|
-
// ? encodePickingColor(layer.getCurrentSelectedId()!)
|
|
108
|
-
// : [0, 0, 0],
|
|
109
|
-
// u_SelectColor: selectColorInArray.map((c) => c * 255),
|
|
110
|
-
// u_EnableSelect: +(enableSelect || false),
|
|
111
|
-
|
|
91
|
+
u_activeMix: activeMix
|
|
112
92
|
});
|
|
113
93
|
});
|
|
114
94
|
});
|
|
@@ -137,7 +117,7 @@ var PixelPickingPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
|
|
|
137
117
|
u_EnableSelect: 1
|
|
138
118
|
});
|
|
139
119
|
});
|
|
140
|
-
});
|
|
120
|
+
});
|
|
141
121
|
}
|
|
142
122
|
}]);
|
|
143
123
|
|
|
@@ -8,4 +8,8 @@ export default class RegisterStyleAttributePlugin implements ILayerPlugin {
|
|
|
8
8
|
styleAttributeService: IStyleAttributeService;
|
|
9
9
|
}): void;
|
|
10
10
|
private registerBuiltinAttributes;
|
|
11
|
+
private registerPositionAttribute;
|
|
12
|
+
private registerFilterAttribute;
|
|
13
|
+
private registerColorAttribute;
|
|
14
|
+
private registerVertexIdAttribute;
|
|
11
15
|
}
|
|
@@ -22,12 +22,51 @@ var RegisterStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE
|
|
|
22
22
|
|
|
23
23
|
var styleAttributeService = _ref.styleAttributeService;
|
|
24
24
|
layer.hooks.init.tap('RegisterStyleAttributePlugin', function () {
|
|
25
|
-
_this.registerBuiltinAttributes(styleAttributeService);
|
|
25
|
+
_this.registerBuiltinAttributes(styleAttributeService, layer);
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
}, {
|
|
29
29
|
key: "registerBuiltinAttributes",
|
|
30
|
-
value: function registerBuiltinAttributes(styleAttributeService) {
|
|
30
|
+
value: function registerBuiltinAttributes(styleAttributeService, layer) {
|
|
31
|
+
// 过滤 tileGroup layer (瓦片图层)
|
|
32
|
+
var source = layer.getSource();
|
|
33
|
+
|
|
34
|
+
switch (source.parser.type) {
|
|
35
|
+
case 'mvt':
|
|
36
|
+
case 'testTile':
|
|
37
|
+
case 'rasterTile':
|
|
38
|
+
// layer 仅作为 group 使用
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (layer.type === 'MaskLayer') {
|
|
43
|
+
this.registerPositionAttribute(styleAttributeService);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var _layer$getLayerConfig = layer.getLayerConfig(),
|
|
48
|
+
usage = _layer$getLayerConfig.usage;
|
|
49
|
+
|
|
50
|
+
if (usage === 'basemap ') {
|
|
51
|
+
this.registerPositionAttribute(styleAttributeService);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (layer.isTileLayer) {
|
|
56
|
+
this.registerPositionAttribute(styleAttributeService);
|
|
57
|
+
this.registerColorAttribute(styleAttributeService);
|
|
58
|
+
return;
|
|
59
|
+
} // Tip: normal render layer
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
this.registerPositionAttribute(styleAttributeService);
|
|
63
|
+
this.registerFilterAttribute(styleAttributeService);
|
|
64
|
+
this.registerColorAttribute(styleAttributeService);
|
|
65
|
+
this.registerVertexIdAttribute(styleAttributeService);
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "registerPositionAttribute",
|
|
69
|
+
value: function registerPositionAttribute(styleAttributeService) {
|
|
31
70
|
styleAttributeService.registerStyleAttribute({
|
|
32
71
|
name: 'position',
|
|
33
72
|
type: AttributeType.Attribute,
|
|
@@ -43,6 +82,10 @@ var RegisterStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE
|
|
|
43
82
|
}
|
|
44
83
|
}
|
|
45
84
|
});
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "registerFilterAttribute",
|
|
88
|
+
value: function registerFilterAttribute(styleAttributeService) {
|
|
46
89
|
styleAttributeService.registerStyleAttribute({
|
|
47
90
|
name: 'filter',
|
|
48
91
|
type: AttributeType.Attribute,
|
|
@@ -55,12 +98,16 @@ var RegisterStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE
|
|
|
55
98
|
type: gl.FLOAT
|
|
56
99
|
},
|
|
57
100
|
size: 1,
|
|
58
|
-
update: function update(feature
|
|
101
|
+
update: function update(feature) {
|
|
59
102
|
var filter = feature.filter;
|
|
60
103
|
return filter ? [1] : [0];
|
|
61
104
|
}
|
|
62
105
|
}
|
|
63
106
|
});
|
|
107
|
+
}
|
|
108
|
+
}, {
|
|
109
|
+
key: "registerColorAttribute",
|
|
110
|
+
value: function registerColorAttribute(styleAttributeService) {
|
|
64
111
|
styleAttributeService.registerStyleAttribute({
|
|
65
112
|
name: 'color',
|
|
66
113
|
type: AttributeType.Attribute,
|
|
@@ -73,12 +120,16 @@ var RegisterStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE
|
|
|
73
120
|
type: gl.FLOAT
|
|
74
121
|
},
|
|
75
122
|
size: 4,
|
|
76
|
-
update: function update(feature
|
|
123
|
+
update: function update(feature) {
|
|
77
124
|
var color = feature.color;
|
|
78
125
|
return !color || !color.length ? [1, 1, 1, 1] : color;
|
|
79
126
|
}
|
|
80
127
|
}
|
|
81
128
|
});
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
key: "registerVertexIdAttribute",
|
|
132
|
+
value: function registerVertexIdAttribute(styleAttributeService) {
|
|
82
133
|
styleAttributeService.registerStyleAttribute({
|
|
83
134
|
// 统一注册每个顶点的唯一编号(目前用于样式的数据映射计算使用)
|
|
84
135
|
name: 'vertexId',
|
|
@@ -92,7 +143,7 @@ var RegisterStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE
|
|
|
92
143
|
type: gl.FLOAT
|
|
93
144
|
},
|
|
94
145
|
size: 1,
|
|
95
|
-
update: function update(feature, featureIdx
|
|
146
|
+
update: function update(feature, featureIdx) {
|
|
96
147
|
return [featureIdx];
|
|
97
148
|
}
|
|
98
149
|
}
|
|
@@ -24,11 +24,7 @@ var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__
|
|
|
24
24
|
_this.initStyleAttribute(layer, {
|
|
25
25
|
styleAttributeService: styleAttributeService
|
|
26
26
|
});
|
|
27
|
-
});
|
|
28
|
-
// // layer.layerModelNeedUpdate = true;
|
|
29
|
-
// return true;
|
|
30
|
-
// });
|
|
31
|
-
|
|
27
|
+
});
|
|
32
28
|
layer.hooks.beforeRender.tap('UpdateStyleAttributePlugin', function () {
|
|
33
29
|
if (layer.layerModelNeedUpdate) {
|
|
34
30
|
return;
|
|
@@ -45,11 +41,8 @@ var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__
|
|
|
45
41
|
var styleAttributeService = _ref2.styleAttributeService;
|
|
46
42
|
var attributes = styleAttributeService.getLayerStyleAttributes() || [];
|
|
47
43
|
var filter = styleAttributeService.getLayerStyleAttribute('filter');
|
|
48
|
-
var shape = styleAttributeService.getLayerStyleAttribute('shape');
|
|
49
44
|
|
|
50
|
-
if (filter && filter.needRegenerateVertices
|
|
51
|
-
// (shape && shape.needRegenerateVertices) // TODO:Shape 更新重新build
|
|
52
|
-
) {
|
|
45
|
+
if (filter && filter.needRegenerateVertices) {
|
|
53
46
|
layer.layerModelNeedUpdate = true;
|
|
54
47
|
attributes.forEach(function (attr) {
|
|
55
48
|
return attr.needRegenerateVertices = false;
|
package/es/point/index.js
CHANGED
|
@@ -64,7 +64,9 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
64
64
|
|
|
65
65
|
_this2.layerService.updateLayerRenderList();
|
|
66
66
|
|
|
67
|
-
_this2.
|
|
67
|
+
_this2.emit('modelLoaded', null);
|
|
68
|
+
|
|
69
|
+
_this2.layerService.throttleRenderLayers();
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
72
|
}, {
|
|
@@ -73,7 +75,9 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
73
75
|
var _this3 = this;
|
|
74
76
|
|
|
75
77
|
this.layerModel.buildModels(function (models) {
|
|
76
|
-
|
|
78
|
+
_this3.models = models;
|
|
79
|
+
|
|
80
|
+
_this3.emit('modelLoaded', null);
|
|
77
81
|
});
|
|
78
82
|
}
|
|
79
83
|
/**
|
|
@@ -152,7 +156,7 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
152
156
|
text: {
|
|
153
157
|
blend: 'normal'
|
|
154
158
|
},
|
|
155
|
-
|
|
159
|
+
vectorPoint: {},
|
|
156
160
|
tile: {},
|
|
157
161
|
tileText: {},
|
|
158
162
|
earthFill: {},
|
|
@@ -166,9 +170,8 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
166
170
|
var parserType = this.layerSource.getParserType();
|
|
167
171
|
|
|
168
172
|
if (isVectorTile(parserType)) {
|
|
169
|
-
return '
|
|
170
|
-
} //
|
|
171
|
-
// 2D、 3d、 shape、image、text、normal、
|
|
173
|
+
return 'vectorPoint';
|
|
174
|
+
} // 2D、 3d、 shape、image、text、normal、
|
|
172
175
|
|
|
173
176
|
|
|
174
177
|
var layerData = this.getEncodedData();
|
|
@@ -2,7 +2,7 @@ import { IModel } from '@antv/l7-core';
|
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class ExtrudeModel extends BaseModel {
|
|
4
4
|
private raiseCount;
|
|
5
|
-
private
|
|
5
|
+
private raiseRepeat;
|
|
6
6
|
getUninforms(): {
|
|
7
7
|
u_pickLight: number;
|
|
8
8
|
u_heightfixed: number;
|
|
@@ -41,7 +41,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
41
41
|
|
|
42
42
|
_defineProperty(_assertThisInitialized(_this), "raiseCount", 0);
|
|
43
43
|
|
|
44
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
44
|
+
_defineProperty(_assertThisInitialized(_this), "raiseRepeat", 0);
|
|
45
45
|
|
|
46
46
|
return _this;
|
|
47
47
|
}
|
|
@@ -116,18 +116,16 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
116
116
|
useLinearColor = 1;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
if (this.raiseCount < 1 && this.
|
|
119
|
+
if (this.raiseCount < 1 && this.raiseRepeat > 0) {
|
|
120
120
|
if (animateOption.enable) {
|
|
121
121
|
var _animateOption$speed = animateOption.speed,
|
|
122
|
-
speed = _animateOption$speed === void 0 ? 0.01 : _animateOption$speed
|
|
123
|
-
_animateOption$repeat = animateOption.repeat,
|
|
124
|
-
repeat = _animateOption$repeat === void 0 ? false : _animateOption$repeat;
|
|
122
|
+
speed = _animateOption$speed === void 0 ? 0.01 : _animateOption$speed;
|
|
125
123
|
this.raiseCount += speed;
|
|
126
124
|
|
|
127
125
|
if (this.raiseCount >= 1) {
|
|
128
|
-
if (this.
|
|
126
|
+
if (this.raiseRepeat > 1) {
|
|
129
127
|
this.raiseCount = 0;
|
|
130
|
-
this.
|
|
128
|
+
this.raiseRepeat--;
|
|
131
129
|
} else {
|
|
132
130
|
this.raiseCount = 1;
|
|
133
131
|
}
|
|
@@ -140,7 +138,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
140
138
|
u_pickLight: Number(pickLight),
|
|
141
139
|
// 圆柱体是否固定高度
|
|
142
140
|
u_heightfixed: Number(heightfixed),
|
|
143
|
-
u_r: animateOption.enable && this.
|
|
141
|
+
u_r: animateOption.enable && this.raiseRepeat > 0 ? this.raiseCount : 1.0,
|
|
144
142
|
u_dataTexture: this.dataTexture,
|
|
145
143
|
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
146
144
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
@@ -169,7 +167,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
169
167
|
_ref2$animateOption$r = _ref2.animateOption.repeat,
|
|
170
168
|
repeat = _ref2$animateOption$r === void 0 ? 1 : _ref2$animateOption$r;
|
|
171
169
|
|
|
172
|
-
this.
|
|
170
|
+
this.raiseRepeat = repeat;
|
|
173
171
|
this.layer.buildLayerModel({
|
|
174
172
|
moduleName: 'pointEarthExtrude',
|
|
175
173
|
vertexShader: pointExtrudeVert,
|
|
@@ -200,20 +198,18 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
200
198
|
}, {
|
|
201
199
|
key: "registerBuiltinAttributes",
|
|
202
200
|
value: function registerBuiltinAttributes() {
|
|
203
|
-
// point layer size;
|
|
204
201
|
this.styleAttributeService.registerStyleAttribute({
|
|
205
202
|
name: 'size',
|
|
206
203
|
type: AttributeType.Attribute,
|
|
207
204
|
descriptor: {
|
|
208
205
|
name: 'a_Size',
|
|
209
206
|
buffer: {
|
|
210
|
-
// give the WebGL driver a hint that this buffer may change
|
|
211
207
|
usage: gl.DYNAMIC_DRAW,
|
|
212
208
|
data: [],
|
|
213
209
|
type: gl.FLOAT
|
|
214
210
|
},
|
|
215
211
|
size: 3,
|
|
216
|
-
update: function update(feature
|
|
212
|
+
update: function update(feature) {
|
|
217
213
|
var size = feature.size;
|
|
218
214
|
|
|
219
215
|
if (size) {
|
|
@@ -258,13 +254,12 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
258
254
|
descriptor: {
|
|
259
255
|
name: 'a_Pos',
|
|
260
256
|
buffer: {
|
|
261
|
-
// give the WebGL driver a hint that this buffer may change
|
|
262
257
|
usage: gl.DYNAMIC_DRAW,
|
|
263
258
|
data: [],
|
|
264
259
|
type: gl.FLOAT
|
|
265
260
|
},
|
|
266
261
|
size: 3,
|
|
267
|
-
update: function update(feature
|
|
262
|
+
update: function update(feature) {
|
|
268
263
|
var coordinates = calculateCentroid(feature.coordinates);
|
|
269
264
|
return lglt2xyz([coordinates[0], coordinates[1]]);
|
|
270
265
|
}
|
|
@@ -19,7 +19,7 @@ import { GlobelPointFillTriangulation } from "../../core/triangulation";
|
|
|
19
19
|
var pointFillFrag = "uniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + strokeWidth);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n if(outer_df > antialiasblur + 0.018) discard;\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(strokeWidth < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor.a *= opacity_t;\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
|
|
20
20
|
|
|
21
21
|
/* babel-plugin-inline-import '../shaders/earth/fill_vert.glsl' */
|
|
22
|
-
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n */\n float newSize = setPickingSize(a_Size);\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n //
|
|
22
|
+
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n */\n float newSize = setPickingSize(a_Size);\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1, 1.0);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
23
23
|
import { mat4, vec3 } from 'gl-matrix';
|
|
24
24
|
|
|
25
25
|
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
@@ -115,7 +115,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
115
115
|
} : _ref2$animateOption;
|
|
116
116
|
|
|
117
117
|
return {
|
|
118
|
-
|
|
118
|
+
u_animate: this.animateOption2Array(animateOption),
|
|
119
119
|
u_time: this.layer.getLayerAnimateTime()
|
|
120
120
|
};
|
|
121
121
|
}
|
|
@@ -2,7 +2,7 @@ import { IModel } from '@antv/l7-core';
|
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class ExtrudeModel extends BaseModel {
|
|
4
4
|
private raiseCount;
|
|
5
|
-
private
|
|
5
|
+
private raiseRepeat;
|
|
6
6
|
getUninforms(): {
|
|
7
7
|
u_pickLight: number;
|
|
8
8
|
u_heightfixed: number;
|
|
@@ -42,7 +42,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
42
42
|
|
|
43
43
|
_defineProperty(_assertThisInitialized(_this), "raiseCount", 0);
|
|
44
44
|
|
|
45
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "raiseRepeat", 0);
|
|
46
46
|
|
|
47
47
|
return _this;
|
|
48
48
|
}
|
|
@@ -117,18 +117,16 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
117
117
|
useLinearColor = 1;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
if (this.raiseCount < 1 && this.
|
|
120
|
+
if (this.raiseCount < 1 && this.raiseRepeat > 0) {
|
|
121
121
|
if (animateOption.enable) {
|
|
122
122
|
var _animateOption$speed = animateOption.speed,
|
|
123
|
-
speed = _animateOption$speed === void 0 ? 0.01 : _animateOption$speed
|
|
124
|
-
_animateOption$repeat = animateOption.repeat,
|
|
125
|
-
repeat = _animateOption$repeat === void 0 ? false : _animateOption$repeat;
|
|
123
|
+
speed = _animateOption$speed === void 0 ? 0.01 : _animateOption$speed;
|
|
126
124
|
this.raiseCount += speed;
|
|
127
125
|
|
|
128
126
|
if (this.raiseCount >= 1) {
|
|
129
|
-
if (this.
|
|
127
|
+
if (this.raiseRepeat > 1) {
|
|
130
128
|
this.raiseCount = 0;
|
|
131
|
-
this.
|
|
129
|
+
this.raiseRepeat--;
|
|
132
130
|
} else {
|
|
133
131
|
this.raiseCount = 1;
|
|
134
132
|
}
|
|
@@ -141,7 +139,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
141
139
|
u_pickLight: Number(pickLight),
|
|
142
140
|
// 圆柱体是否固定高度
|
|
143
141
|
u_heightfixed: Number(heightfixed),
|
|
144
|
-
u_r: animateOption.enable && this.
|
|
142
|
+
u_r: animateOption.enable && this.raiseRepeat > 0 ? this.raiseCount : 1.0,
|
|
145
143
|
u_dataTexture: this.dataTexture,
|
|
146
144
|
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
147
145
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
@@ -174,7 +172,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
174
172
|
case 0:
|
|
175
173
|
// GAODE1.x GAODE2.x MAPBOX
|
|
176
174
|
_ref2 = this.layer.getLayerConfig(), _ref2$depth = _ref2.depth, depth = _ref2$depth === void 0 ? true : _ref2$depth, _ref2$animateOption$r = _ref2.animateOption.repeat, repeat = _ref2$animateOption$r === void 0 ? 1 : _ref2$animateOption$r;
|
|
177
|
-
this.
|
|
175
|
+
this.raiseRepeat = repeat;
|
|
178
176
|
this.layer.buildLayerModel({
|
|
179
177
|
moduleName: 'pointExtrude',
|
|
180
178
|
vertexShader: pointExtrudeVert,
|
|
@@ -226,13 +224,12 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
226
224
|
descriptor: {
|
|
227
225
|
name: 'a_Size',
|
|
228
226
|
buffer: {
|
|
229
|
-
// give the WebGL driver a hint that this buffer may change
|
|
230
227
|
usage: gl.DYNAMIC_DRAW,
|
|
231
228
|
data: [],
|
|
232
229
|
type: gl.FLOAT
|
|
233
230
|
},
|
|
234
231
|
size: 3,
|
|
235
|
-
update: function update(feature
|
|
232
|
+
update: function update(feature) {
|
|
236
233
|
var size = feature.size;
|
|
237
234
|
|
|
238
235
|
if (size) {
|
|
@@ -283,7 +280,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
283
280
|
type: gl.FLOAT
|
|
284
281
|
},
|
|
285
282
|
size: 3,
|
|
286
|
-
update: function update(feature
|
|
283
|
+
update: function update(feature) {
|
|
287
284
|
var coordinates = calculateCentroid(feature.coordinates);
|
|
288
285
|
return [coordinates[0], coordinates[1], 0];
|
|
289
286
|
}
|
|
@@ -2,7 +2,7 @@ import { IAnimateOption, IAttribute, IElements, IModel, IModelUniform } from '@a
|
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class FillModel extends BaseModel {
|
|
4
4
|
private meter2coord;
|
|
5
|
-
private
|
|
5
|
+
private meterYScale;
|
|
6
6
|
private isMeter;
|
|
7
7
|
private unit;
|
|
8
8
|
getUninforms(): IModelUniform;
|
package/es/point/models/fill.js
CHANGED
|
@@ -19,15 +19,14 @@ import { isNumber } from 'lodash';
|
|
|
19
19
|
import BaseModel from "../../core/BaseModel";
|
|
20
20
|
|
|
21
21
|
/* babel-plugin-inline-import '../shaders/animate/wave_frag.glsl' */
|
|
22
|
-
// import { PointFillTriangulation } from '../../core/triangulation';
|
|
23
22
|
// animate pointLayer shader - support animate
|
|
24
|
-
var waveFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nuniform float u_time;\nuniform vec4
|
|
23
|
+
var waveFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n \n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n float PI = 3.14159;\n float N_RINGS = 3.0;\n float FREQ = 1.0;\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n\n float d = length(v_data.xy);\n if(d > 0.5) {\n discard;\n }\n float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_animate.z - u_animate.y * u_time)), 0.0, 1.0);\n \n // \u6839\u636E\u53E0\u52A0\u6A21\u5F0F\u9009\u62E9\u6548\u679C\n if(u_additive > 0.0) {\n gl_FragColor *= intensity;\n // \u4F18\u5316\u6C34\u6CE2\u70B9 blend additive \u6A21\u5F0F\u4E0B\u6709\u7684\u62FE\u53D6\u6548\u679C \n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor = vec4(gl_FragColor.xyz, gl_FragColor.a * intensity);\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n"; // static pointLayer shader - not support animate
|
|
25
24
|
|
|
26
25
|
/* babel-plugin-inline-import '../shaders/fill_frag.glsl' */
|
|
27
26
|
var pointFillFrag = "uniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + strokeWidth);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(strokeWidth < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor.a *= opacity_t;\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
|
|
28
27
|
|
|
29
28
|
/* babel-plugin-inline-import '../shaders/fill_vert.glsl' */
|
|
30
|
-
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_meter2coord;\nuniform float u_meteryScale;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n * u_meter2coord \u5728\u7B49\u9762\u79EF\u5927\u5C0F\u7684\u65F6\u5019\u8BBE\u7F6E\u5355\u4F4D\n */\n float newSize = setPickingSize(a_Size) * u_meter2coord;\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n //
|
|
29
|
+
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_meter2coord;\nuniform float u_meteryScale;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n * u_meter2coord \u5728\u7B49\u9762\u79EF\u5927\u5C0F\u7684\u65F6\u5019\u8BBE\u7F6E\u5355\u4F4D\n */\n float newSize = setPickingSize(a_Size) * u_meter2coord;\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n if(newSize * pow(2.0, u_Zoom) < 48.0) {\n antialiasblur = max(antialiasblur, -0.05);\n } else if(newSize * pow(2.0, u_Zoom) < 128.0) {\n antialiasblur = max(antialiasblur, -0.6/pow(u_Zoom, 2.0));\n } else {\n antialiasblur = max(antialiasblur, -0.8/pow(u_Zoom, 2.0));\n }\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.x += offset.x / u_meteryScale;\n aPosition.y += offset.y;\n offset = vec2(0.0);\n }\n }\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n float raisingHeight = u_raisingHeight;\n\n if(u_heightfixed < 1.0) { // false\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n \n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
31
30
|
import { Version } from '@antv/l7-maps';
|
|
32
31
|
|
|
33
32
|
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
@@ -48,7 +47,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
48
47
|
|
|
49
48
|
_defineProperty(_assertThisInitialized(_this), "meter2coord", 1);
|
|
50
49
|
|
|
51
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "meterYScale", 1);
|
|
52
51
|
|
|
53
52
|
_defineProperty(_assertThisInitialized(_this), "isMeter", false);
|
|
54
53
|
|
|
@@ -128,7 +127,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
128
127
|
u_raisingHeight: Number(raisingHeight),
|
|
129
128
|
u_heightfixed: Number(heightfixed),
|
|
130
129
|
u_meter2coord: this.meter2coord,
|
|
131
|
-
u_meteryScale: this.
|
|
130
|
+
u_meteryScale: this.meterYScale,
|
|
132
131
|
u_isMeter: Number(this.isMeter),
|
|
133
132
|
u_blur: blur,
|
|
134
133
|
u_additive: blend === 'additive' ? 1.0 : 0.0,
|
|
@@ -152,7 +151,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
152
151
|
} : _ref2$animateOption;
|
|
153
152
|
|
|
154
153
|
return {
|
|
155
|
-
|
|
154
|
+
u_animate: this.animateOption2Array(animateOption),
|
|
156
155
|
u_time: this.layer.getLayerAnimateTime()
|
|
157
156
|
};
|
|
158
157
|
}
|
|
@@ -198,7 +197,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
198
197
|
var southCoord = new mapboxContext.MercatorCoordinate(coord.x, coord.y - offsetInMercatorCoordinateUnits, coord.z);
|
|
199
198
|
var southLnglat = southCoord.toLngLat();
|
|
200
199
|
this.meter2coord = center[0] - westLnglat.lng;
|
|
201
|
-
this.
|
|
200
|
+
this.meterYScale = (southLnglat.lat - center[1]) / this.meter2coord;
|
|
202
201
|
return;
|
|
203
202
|
}
|
|
204
203
|
|
|
@@ -344,7 +343,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
344
343
|
type: gl.FLOAT
|
|
345
344
|
},
|
|
346
345
|
size: 1,
|
|
347
|
-
update: function update(feature
|
|
346
|
+
update: function update(feature) {
|
|
348
347
|
var _feature$size = feature.size,
|
|
349
348
|
size = _feature$size === void 0 ? 5 : _feature$size;
|
|
350
349
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
@@ -364,7 +363,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
364
363
|
type: gl.FLOAT
|
|
365
364
|
},
|
|
366
365
|
size: 1,
|
|
367
|
-
update: function update(feature
|
|
366
|
+
update: function update(feature) {
|
|
368
367
|
var _feature$shape = feature.shape,
|
|
369
368
|
shape = _feature$shape === void 0 ? 2 : _feature$shape;
|
|
370
369
|
var shapeIndex = shape2d.indexOf(shape);
|