@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
package/lib/tile/tmsTileLayer.js
CHANGED
|
@@ -25,6 +25,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
25
25
|
|
|
26
26
|
var _baseTileLayer = _interopRequireDefault(require("./tileLayer/baseTileLayer"));
|
|
27
27
|
|
|
28
|
+
var _utils = require("./utils");
|
|
29
|
+
|
|
28
30
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
29
31
|
|
|
30
32
|
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; } }
|
|
@@ -98,18 +100,39 @@ var TMSTileLayer = /*#__PURE__*/function (_BaseTileLayer) {
|
|
|
98
100
|
|
|
99
101
|
var _layers = _this2.tileLayerManager.getChilds(tile.layerIDList);
|
|
100
102
|
|
|
101
|
-
_this2.
|
|
103
|
+
_this2.updateTileVisible(tile, _layers);
|
|
102
104
|
|
|
103
105
|
_this2.setPickState(_layers);
|
|
104
106
|
}
|
|
105
107
|
});
|
|
106
|
-
this.parent.renderLayers();
|
|
107
108
|
|
|
108
109
|
if (this.tilesetManager.isLoaded) {
|
|
109
110
|
// 将事件抛出,图层上可以使用瓦片
|
|
110
111
|
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
111
112
|
}
|
|
112
113
|
}
|
|
114
|
+
}, {
|
|
115
|
+
key: "emitTileVisibleEvent",
|
|
116
|
+
value: function emitTileVisibleEvent(tile, callback) {
|
|
117
|
+
if (tile.isVisible) {
|
|
118
|
+
callback();
|
|
119
|
+
} else {
|
|
120
|
+
(0, _utils.tileAllLoad)(tile, function () {
|
|
121
|
+
callback();
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "updateTileVisible",
|
|
127
|
+
value: function updateTileVisible(tile, layers) {
|
|
128
|
+
var _this3 = this;
|
|
129
|
+
|
|
130
|
+
this.emitTileVisibleEvent(tile, function () {
|
|
131
|
+
_this3.tileLayerManager.updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
132
|
+
|
|
133
|
+
_this3.layerService.reRender();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
113
136
|
}]);
|
|
114
137
|
return TMSTileLayer;
|
|
115
138
|
}(_baseTileLayer.default);
|
package/lib/tile/utils.js
CHANGED
|
@@ -8,10 +8,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.getContainerSize = getContainerSize;
|
|
9
9
|
exports.getLayerShape = getLayerShape;
|
|
10
10
|
exports.getMaskValue = getMaskValue;
|
|
11
|
+
exports.isTileChildLoaded = isTileChildLoaded;
|
|
12
|
+
exports.isTileLoaded = isTileLoaded;
|
|
13
|
+
exports.isTileParentLoaded = isTileParentLoaded;
|
|
11
14
|
exports.isVectorTile = isVectorTile;
|
|
12
15
|
exports.readPixel = readPixel;
|
|
13
16
|
exports.readRasterValue = readRasterValue;
|
|
14
17
|
exports.registerLayers = registerLayers;
|
|
18
|
+
exports.tileAllLoad = tileAllLoad;
|
|
15
19
|
exports.tileVectorParser = void 0;
|
|
16
20
|
|
|
17
21
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -155,4 +159,38 @@ function readPixel(x, y, rendererService) {
|
|
|
155
159
|
data: new Uint8Array(1 * 1 * 4)
|
|
156
160
|
});
|
|
157
161
|
return pickedColors;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function isTileLoaded(tile) {
|
|
165
|
+
return tile.layerIDList.length === tile.loadedLayers;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function isTileChildLoaded(tile) {
|
|
169
|
+
var childs = tile.children;
|
|
170
|
+
return childs.filter(function (child) {
|
|
171
|
+
return isTileLoaded(child);
|
|
172
|
+
}).length === childs.length;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function isTileParentLoaded(tile) {
|
|
176
|
+
var parent = tile.parent;
|
|
177
|
+
|
|
178
|
+
if (!parent) {
|
|
179
|
+
return true;
|
|
180
|
+
} else {
|
|
181
|
+
return isTileLoaded(parent);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function tileAllLoad(tile, callback) {
|
|
186
|
+
var timer = window.setInterval(function () {
|
|
187
|
+
var tileLoaded = isTileLoaded(tile);
|
|
188
|
+
var tileChildLoaded = isTileChildLoaded(tile);
|
|
189
|
+
var tileParentLoaded = isTileParentLoaded(tile);
|
|
190
|
+
|
|
191
|
+
if (tileLoaded && tileChildLoaded && tileParentLoaded) {
|
|
192
|
+
callback();
|
|
193
|
+
window.clearInterval(timer);
|
|
194
|
+
}
|
|
195
|
+
}, 36);
|
|
158
196
|
}
|
|
@@ -29,6 +29,9 @@ function registerStyleAttribute(fieldName, layer, field, values, updateOptions)
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
function handleStyleDataMapping(configToUpdate, layer) {
|
|
32
|
+
// 瓦片图层不需要进行样式数据映射
|
|
33
|
+
if (layer.tileLayer || layer.isTileLayer) return;
|
|
34
|
+
|
|
32
35
|
if (configToUpdate.opacity) {
|
|
33
36
|
// 处理 style 中 opacity 属性的数据映射
|
|
34
37
|
handleStyleFloat('opacity', layer, configToUpdate.opacity);
|
package/lib/utils/layerData.js
CHANGED
|
@@ -28,7 +28,7 @@ function adjustData2Amap2Coordinates(mappedData, mapService) {
|
|
|
28
28
|
if (typeof mappedData[0].coordinates[0] === 'number') {
|
|
29
29
|
// 单个的点数据
|
|
30
30
|
// @ts-ignore
|
|
31
|
-
mappedData //
|
|
31
|
+
mappedData // 避免经纬度被重复计算导致坐标位置偏移
|
|
32
32
|
.filter(function (d) {
|
|
33
33
|
return !d.originCoordinates;
|
|
34
34
|
}).map(function (d) {
|
|
@@ -42,7 +42,7 @@ function adjustData2Amap2Coordinates(mappedData, mapService) {
|
|
|
42
42
|
} else {
|
|
43
43
|
// 连续的线、面数据
|
|
44
44
|
// @ts-ignore
|
|
45
|
-
mappedData //
|
|
45
|
+
mappedData // 避免经纬度被重复计算导致坐标位置偏移
|
|
46
46
|
.filter(function (d) {
|
|
47
47
|
return !d.originCoordinates;
|
|
48
48
|
}).map(function (d) {
|
package/lib/utils/updateShape.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.updateShape = updateShape;
|
|
7
|
-
//
|
|
7
|
+
// shapeUpdateList 存储一系列的 shape 类型
|
|
8
8
|
// 当这一系列的 shape 相互切换的时候需要重构 layer 的 model (顶点数据集)
|
|
9
9
|
var shapeUpdateList = [// PointLayer
|
|
10
10
|
['circle', 'cylinder'], ['square', 'cylinder'], ['triangle', 'cylinder'], ['pentagon', 'cylinder'], ['hexagon', 'cylinder'], ['octogon', 'cylinder'], ['hexagram', 'cylinder'], ['rhombus', 'cylinder'], ['vesica', 'cylinder']];
|
|
@@ -18,7 +18,7 @@ function updateShape(layer, lastShape, currentShape) {
|
|
|
18
18
|
|
|
19
19
|
shapeUpdateList.map(function (shapes) {
|
|
20
20
|
if (shapes.includes(lastShape) && shapes.includes(currentShape)) {
|
|
21
|
-
//
|
|
21
|
+
// dataSourceNeedUpdate 借用数据更新时更新 layer model 的工作流
|
|
22
22
|
layer.dataState.dataSourceNeedUpdate = true;
|
|
23
23
|
return;
|
|
24
24
|
}
|
package/lib/wind/index.js
CHANGED
|
@@ -58,7 +58,9 @@ var WindLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
58
58
|
this.layerModel.initModels(function (models) {
|
|
59
59
|
_this2.models = models;
|
|
60
60
|
|
|
61
|
-
_this2.
|
|
61
|
+
_this2.emit('modelLoaded', null);
|
|
62
|
+
|
|
63
|
+
_this2.layerService.throttleRenderLayers();
|
|
62
64
|
});
|
|
63
65
|
}
|
|
64
66
|
}, {
|
|
@@ -67,7 +69,9 @@ var WindLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
67
69
|
var _this3 = this;
|
|
68
70
|
|
|
69
71
|
this.layerModel.buildModels(function (models) {
|
|
70
|
-
|
|
72
|
+
_this3.models = models;
|
|
73
|
+
|
|
74
|
+
_this3.emit('modelLoaded', null);
|
|
71
75
|
});
|
|
72
76
|
}
|
|
73
77
|
}, {
|
package/lib/wind/models/wind.js
CHANGED
|
@@ -39,7 +39,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
39
39
|
var WindFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 color = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y));\n gl_FragColor = color;\n gl_FragColor.a *= u_opacity;\n}\n";
|
|
40
40
|
|
|
41
41
|
/* babel-plugin-inline-import '../shaders/wind_vert.glsl' */
|
|
42
|
-
var WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n
|
|
42
|
+
var WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\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.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
|
|
43
43
|
var defaultRampColors = {
|
|
44
44
|
0.0: '#3288bd',
|
|
45
45
|
0.1: '#66c2a5',
|
|
@@ -165,9 +165,7 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
165
165
|
height: imageHeight
|
|
166
166
|
});
|
|
167
167
|
|
|
168
|
-
_this3.layerService.
|
|
169
|
-
|
|
170
|
-
_this3.layerService.renderLayers();
|
|
168
|
+
_this3.layerService.reRender();
|
|
171
169
|
});
|
|
172
170
|
this.layer.buildLayerModel({
|
|
173
171
|
moduleName: 'wind',
|
|
@@ -178,7 +176,9 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
178
176
|
depth: {
|
|
179
177
|
enable: false
|
|
180
178
|
},
|
|
181
|
-
|
|
179
|
+
stencil: (0, _l7Utils.getMask)(mask, maskInside),
|
|
180
|
+
blend: this.getBlend(),
|
|
181
|
+
pick: false
|
|
182
182
|
}).then(function (model) {
|
|
183
183
|
_this3.colorModel = model;
|
|
184
184
|
callbackModel([model]);
|
|
@@ -241,7 +241,7 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
241
241
|
type: _l7Core.gl.FLOAT
|
|
242
242
|
},
|
|
243
243
|
size: 2,
|
|
244
|
-
update: function update(feature, featureIdx, vertex
|
|
244
|
+
update: function update(feature, featureIdx, vertex) {
|
|
245
245
|
return [vertex[3], vertex[4]];
|
|
246
246
|
}
|
|
247
247
|
}
|
|
@@ -307,7 +307,7 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
307
307
|
var _this$wind$draw = this.wind.draw(),
|
|
308
308
|
d = _this$wind$draw.d,
|
|
309
309
|
w = _this$wind$draw.w,
|
|
310
|
-
h = _this$wind$draw.h; //
|
|
310
|
+
h = _this$wind$draw.h; // 恢复 L7 渲染流程中 gl 状态
|
|
311
311
|
|
|
312
312
|
|
|
313
313
|
this.rendererService.setBaseState();
|
|
@@ -8,7 +8,7 @@ varying vec2 v_texCoord;
|
|
|
8
8
|
void main() {
|
|
9
9
|
v_texCoord = a_Uv;
|
|
10
10
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
13
13
|
gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));
|
|
14
14
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.9.27-alpha.
|
|
3
|
+
"version": "2.9.27-alpha.4",
|
|
4
4
|
"description": "L7's collection of built-in layers",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -26,13 +26,14 @@
|
|
|
26
26
|
"author": "xiaoiver",
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@antv/async-hook": "^2.
|
|
30
|
-
"@antv/l7-core": "2.9.27-alpha.
|
|
31
|
-
"@antv/l7-maps": "2.9.27-alpha.
|
|
32
|
-
"@antv/l7-source": "2.9.27-alpha.
|
|
33
|
-
"@antv/l7-utils": "2.9.27-alpha.
|
|
29
|
+
"@antv/async-hook": "^2.2.2",
|
|
30
|
+
"@antv/l7-core": "2.9.27-alpha.4",
|
|
31
|
+
"@antv/l7-maps": "2.9.27-alpha.4",
|
|
32
|
+
"@antv/l7-source": "2.9.27-alpha.4",
|
|
33
|
+
"@antv/l7-utils": "2.9.27-alpha.4",
|
|
34
34
|
"@babel/runtime": "^7.7.7",
|
|
35
35
|
"@mapbox/martini": "^0.2.0",
|
|
36
|
+
"@turf/clone": "^6.5.0",
|
|
36
37
|
"@turf/helpers": "^6.1.4",
|
|
37
38
|
"@turf/meta": "^6.0.2",
|
|
38
39
|
"@turf/polygon-to-line": "^6.5.0",
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"@types/gl-matrix": "^2.4.5",
|
|
61
62
|
"@types/lodash": "^4.14.138"
|
|
62
63
|
},
|
|
63
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "9e77012376360246d49d7b5392eecd16b43b9109",
|
|
64
65
|
"publishConfig": {
|
|
65
66
|
"access": "public"
|
|
66
67
|
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
#define LineTexture 1.0
|
|
2
|
-
uniform float u_blur : 0.99;
|
|
3
|
-
uniform float u_opacity : 1.0;
|
|
4
|
-
uniform float u_textureBlend;
|
|
5
|
-
|
|
6
|
-
uniform float u_borderWidth: 0.0;
|
|
7
|
-
uniform vec4 u_borderColor;
|
|
8
|
-
varying vec4 v_color;
|
|
9
|
-
|
|
10
|
-
// line texture
|
|
11
|
-
uniform float u_line_texture;
|
|
12
|
-
uniform sampler2D u_texture;
|
|
13
|
-
uniform vec2 u_textSize;
|
|
14
|
-
|
|
15
|
-
varying vec2 v_iconMapUV;
|
|
16
|
-
|
|
17
|
-
#pragma include "picking"
|
|
18
|
-
|
|
19
|
-
varying mat4 styleMappingMat;
|
|
20
|
-
|
|
21
|
-
void main() {
|
|
22
|
-
float opacity = styleMappingMat[0][0];
|
|
23
|
-
float d_distance_ratio = styleMappingMat[3].r; // 当前点位距离占线总长的比例
|
|
24
|
-
gl_FragColor = v_color;
|
|
25
|
-
// anti-alias
|
|
26
|
-
// float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));
|
|
27
|
-
gl_FragColor.a *= opacity; // 全局透明度
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if(u_line_texture == LineTexture) { // while load texture
|
|
31
|
-
float aDistance = styleMappingMat[3].g; // 当前顶点的距离
|
|
32
|
-
float d_texPixelLen = styleMappingMat[3].b; // 贴图的像素长度,根据地图层级缩放
|
|
33
|
-
float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen);
|
|
34
|
-
float v = styleMappingMat[3].a; // 线图层贴图部分的 v 坐标值
|
|
35
|
-
|
|
36
|
-
// v = max(smoothstep(0.95, 1.0, v), v);
|
|
37
|
-
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
|
|
38
|
-
|
|
39
|
-
// gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));
|
|
40
|
-
// gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));
|
|
41
|
-
vec4 pattern = texture2D(u_texture, uv);
|
|
42
|
-
|
|
43
|
-
if(u_textureBlend == 0.0) { // normal
|
|
44
|
-
pattern.a = 0.0;
|
|
45
|
-
gl_FragColor += pattern;
|
|
46
|
-
} else { // replace
|
|
47
|
-
pattern.a *= opacity;
|
|
48
|
-
if(gl_FragColor.a <= 0.0) {
|
|
49
|
-
pattern.a = 0.0;
|
|
50
|
-
}
|
|
51
|
-
gl_FragColor = pattern;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
float v = styleMappingMat[3].a;
|
|
56
|
-
float borderWidth = min(0.5, u_borderWidth);
|
|
57
|
-
// 绘制 border
|
|
58
|
-
if(borderWidth > 0.01) {
|
|
59
|
-
float borderOuterWidth = borderWidth/2.0;
|
|
60
|
-
|
|
61
|
-
if(v >= 1.0 - borderWidth || v <= borderWidth) {
|
|
62
|
-
if(v > borderWidth) {
|
|
63
|
-
float linear = smoothstep(0.0, 1.0, (v - (1.0 - borderWidth))/borderWidth);
|
|
64
|
-
gl_FragColor.rgb = mix(gl_FragColor.rgb, u_borderColor.rgb, linear);
|
|
65
|
-
} else if(v <= borderWidth) {
|
|
66
|
-
float linear = smoothstep(0.0, 1.0, v/borderWidth);
|
|
67
|
-
gl_FragColor.rgb = mix(u_borderColor.rgb, gl_FragColor.rgb, linear);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if(v < borderOuterWidth) {
|
|
72
|
-
gl_FragColor.a = mix(0.0, gl_FragColor.a, v/borderOuterWidth);
|
|
73
|
-
} else if(v > 1.0 - borderOuterWidth) {
|
|
74
|
-
gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
gl_FragColor = filterColor(gl_FragColor);
|
|
79
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
attribute float a_Total_Distance;
|
|
11
|
-
attribute float a_Distance;
|
|
12
|
-
|
|
13
|
-
uniform mat4 u_ModelMatrix;
|
|
14
|
-
uniform mat4 u_Mvp;
|
|
15
|
-
uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
|
|
16
|
-
uniform float u_icon_step: 100;
|
|
17
|
-
uniform float u_heightfixed;
|
|
18
|
-
|
|
19
|
-
#pragma include "projection"
|
|
20
|
-
#pragma include "light"
|
|
21
|
-
#pragma include "picking"
|
|
22
|
-
|
|
23
|
-
varying vec4 v_color;
|
|
24
|
-
varying float v_blur;
|
|
25
|
-
|
|
26
|
-
// texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
|
|
27
|
-
varying vec2 v_iconMapUV;
|
|
28
|
-
|
|
29
|
-
uniform float u_linearColor: 0;
|
|
30
|
-
|
|
31
|
-
uniform float u_opacity: 1.0;
|
|
32
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
33
|
-
|
|
34
|
-
#pragma include "styleMapping"
|
|
35
|
-
#pragma include "light"
|
|
36
|
-
#pragma include "styleMappingCalOpacity"
|
|
37
|
-
|
|
38
|
-
void main() {
|
|
39
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
40
|
-
styleMappingMat = mat4(
|
|
41
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
42
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
43
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
44
|
-
0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
48
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
49
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
50
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
51
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
52
|
-
float id = a_vertexId; // 第n个顶点
|
|
53
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
54
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
55
|
-
|
|
56
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
57
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
58
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
59
|
-
|
|
60
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
61
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
62
|
-
textureOffset = opacityAndOffset.g;
|
|
63
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
64
|
-
|
|
65
|
-
float d_distance_ratio; // 当前点位距离占线总长的比例
|
|
66
|
-
float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
|
|
67
|
-
|
|
68
|
-
v_iconMapUV = a_iconMapUV;
|
|
69
|
-
if(u_heightfixed < 1.0) { // 高度随 zoom 调整
|
|
70
|
-
d_texPixelLen = project_pixel(u_icon_step);
|
|
71
|
-
} else {
|
|
72
|
-
d_texPixelLen = u_icon_step;
|
|
73
|
-
}
|
|
74
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
|
|
75
|
-
d_texPixelLen *= 10.0;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if(u_aimate.x == Animate || u_linearColor == 1.0) {
|
|
79
|
-
d_distance_ratio = a_Distance / a_Total_Distance;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
float miter = (a_Miter + 1.0)/2.0;
|
|
83
|
-
// 设置数据集的参数
|
|
84
|
-
styleMappingMat[3][0] = d_distance_ratio; // 当前点位距离占线总长的比例
|
|
85
|
-
styleMappingMat[3][1] = a_Distance; // 当前顶点的距离
|
|
86
|
-
styleMappingMat[3][2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
|
|
87
|
-
styleMappingMat[3][3] = miter; // 线图层贴图部分的 v 坐标值 0 - 1
|
|
88
|
-
|
|
89
|
-
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
|
|
90
|
-
|
|
91
|
-
float originSize = a_Size.x; // 固定高度
|
|
92
|
-
if(u_heightfixed < 1.0) { // 高度随 zoom 调整
|
|
93
|
-
originSize = project_float_pixel(a_Size.x);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
float wallHeight = originSize * miter;
|
|
97
|
-
float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));
|
|
98
|
-
|
|
99
|
-
v_blur = min(project_float_pixel(2.0) / originSize, 0.05);
|
|
100
|
-
|
|
101
|
-
v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);
|
|
102
|
-
// v_color = a_Color;
|
|
103
|
-
|
|
104
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
105
|
-
gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));
|
|
106
|
-
} else {
|
|
107
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
setPickingColor(a_PickingColor);
|
|
111
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
uniform float u_opacity: 1.0;
|
|
2
|
-
varying vec4 v_Color;
|
|
3
|
-
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
|
|
4
|
-
|
|
5
|
-
#pragma include "picking"
|
|
6
|
-
|
|
7
|
-
void main() {
|
|
8
|
-
float opacity = styleMappingMat[0][0];
|
|
9
|
-
gl_FragColor = v_Color;
|
|
10
|
-
gl_FragColor.a *= opacity;
|
|
11
|
-
gl_FragColor = filterColor(gl_FragColor);
|
|
12
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
#define LineTexture 1.0
|
|
2
|
-
uniform float u_blur : 0.99;
|
|
3
|
-
uniform float u_opacity : 1.0;
|
|
4
|
-
uniform float u_textureBlend;
|
|
5
|
-
|
|
6
|
-
uniform float u_borderWidth: 0.0;
|
|
7
|
-
uniform vec4 u_borderColor;
|
|
8
|
-
varying vec4 v_color;
|
|
9
|
-
|
|
10
|
-
// line texture
|
|
11
|
-
uniform float u_line_texture;
|
|
12
|
-
uniform sampler2D u_texture;
|
|
13
|
-
uniform vec2 u_textSize;
|
|
14
|
-
|
|
15
|
-
varying vec2 v_iconMapUV;
|
|
16
|
-
|
|
17
|
-
#pragma include "picking"
|
|
18
|
-
|
|
19
|
-
varying mat4 styleMappingMat;
|
|
20
|
-
|
|
21
|
-
void main() {
|
|
22
|
-
float opacity = styleMappingMat[0][0];
|
|
23
|
-
float d_distance_ratio = styleMappingMat[3].r; // 当前点位距离占线总长的比例
|
|
24
|
-
gl_FragColor = v_color;
|
|
25
|
-
// anti-alias
|
|
26
|
-
// float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));
|
|
27
|
-
gl_FragColor.a *= opacity; // 全局透明度
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if(u_line_texture == LineTexture) { // while load texture
|
|
31
|
-
float aDistance = styleMappingMat[3].g; // 当前顶点的距离
|
|
32
|
-
float d_texPixelLen = styleMappingMat[3].b; // 贴图的像素长度,根据地图层级缩放
|
|
33
|
-
float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen);
|
|
34
|
-
float v = styleMappingMat[3].a; // 线图层贴图部分的 v 坐标值
|
|
35
|
-
|
|
36
|
-
// v = max(smoothstep(0.95, 1.0, v), v);
|
|
37
|
-
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
|
|
38
|
-
|
|
39
|
-
// gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));
|
|
40
|
-
// gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));
|
|
41
|
-
vec4 pattern = texture2D(u_texture, uv);
|
|
42
|
-
|
|
43
|
-
if(u_textureBlend == 0.0) { // normal
|
|
44
|
-
pattern.a = 0.0;
|
|
45
|
-
gl_FragColor += pattern;
|
|
46
|
-
} else { // replace
|
|
47
|
-
pattern.a *= opacity;
|
|
48
|
-
if(gl_FragColor.a <= 0.0) {
|
|
49
|
-
pattern.a = 0.0;
|
|
50
|
-
}
|
|
51
|
-
gl_FragColor = pattern;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
float v = styleMappingMat[3].a;
|
|
56
|
-
float borderWidth = min(0.5, u_borderWidth);
|
|
57
|
-
// 绘制 border
|
|
58
|
-
if(borderWidth > 0.01) {
|
|
59
|
-
float borderOuterWidth = borderWidth/2.0;
|
|
60
|
-
|
|
61
|
-
if(v >= 1.0 - borderWidth || v <= borderWidth) {
|
|
62
|
-
if(v > borderWidth) {
|
|
63
|
-
float linear = smoothstep(0.0, 1.0, (v - (1.0 - borderWidth))/borderWidth);
|
|
64
|
-
gl_FragColor.rgb = mix(gl_FragColor.rgb, u_borderColor.rgb, linear);
|
|
65
|
-
} else if(v <= borderWidth) {
|
|
66
|
-
float linear = smoothstep(0.0, 1.0, v/borderWidth);
|
|
67
|
-
gl_FragColor.rgb = mix(u_borderColor.rgb, gl_FragColor.rgb, linear);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if(v < borderOuterWidth) {
|
|
72
|
-
gl_FragColor.a = mix(0.0, gl_FragColor.a, v/borderOuterWidth);
|
|
73
|
-
} else if(v > 1.0 - borderOuterWidth) {
|
|
74
|
-
gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
gl_FragColor = filterColor(gl_FragColor);
|
|
79
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
attribute float a_Total_Distance;
|
|
11
|
-
attribute float a_Distance;
|
|
12
|
-
|
|
13
|
-
uniform mat4 u_ModelMatrix;
|
|
14
|
-
uniform mat4 u_Mvp;
|
|
15
|
-
uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
|
|
16
|
-
uniform float u_icon_step: 100;
|
|
17
|
-
uniform float u_heightfixed;
|
|
18
|
-
|
|
19
|
-
#pragma include "projection"
|
|
20
|
-
#pragma include "light"
|
|
21
|
-
#pragma include "picking"
|
|
22
|
-
|
|
23
|
-
varying vec4 v_color;
|
|
24
|
-
varying float v_blur;
|
|
25
|
-
|
|
26
|
-
// texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
|
|
27
|
-
varying vec2 v_iconMapUV;
|
|
28
|
-
|
|
29
|
-
uniform float u_linearColor: 0;
|
|
30
|
-
|
|
31
|
-
uniform float u_opacity: 1.0;
|
|
32
|
-
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
33
|
-
|
|
34
|
-
#pragma include "styleMapping"
|
|
35
|
-
#pragma include "light"
|
|
36
|
-
#pragma include "styleMappingCalOpacity"
|
|
37
|
-
|
|
38
|
-
void main() {
|
|
39
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
40
|
-
styleMappingMat = mat4(
|
|
41
|
-
0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
|
|
42
|
-
0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
|
|
43
|
-
0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
|
|
44
|
-
0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
|
|
48
|
-
float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
|
|
49
|
-
float columnWidth = 1.0/columnCount; // 列宽
|
|
50
|
-
float rowHeight = 1.0/rowCount; // 行高
|
|
51
|
-
float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
|
|
52
|
-
float id = a_vertexId; // 第n个顶点
|
|
53
|
-
float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
|
|
54
|
-
float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
|
|
55
|
-
|
|
56
|
-
// cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
|
|
57
|
-
// 按顺序从 cell 中取值、若没有则自动往下取值
|
|
58
|
-
float textureOffset = 0.0; // 在 cell 中取值的偏移量
|
|
59
|
-
|
|
60
|
-
vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
|
|
61
|
-
styleMappingMat[0][0] = opacityAndOffset.r;
|
|
62
|
-
textureOffset = opacityAndOffset.g;
|
|
63
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
64
|
-
|
|
65
|
-
float d_distance_ratio; // 当前点位距离占线总长的比例
|
|
66
|
-
float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
|
|
67
|
-
|
|
68
|
-
v_iconMapUV = a_iconMapUV;
|
|
69
|
-
if(u_heightfixed < 1.0) { // 高度随 zoom 调整
|
|
70
|
-
d_texPixelLen = project_pixel(u_icon_step);
|
|
71
|
-
} else {
|
|
72
|
-
d_texPixelLen = u_icon_step;
|
|
73
|
-
}
|
|
74
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
|
|
75
|
-
d_texPixelLen *= 10.0;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if(u_aimate.x == Animate || u_linearColor == 1.0) {
|
|
79
|
-
d_distance_ratio = a_Distance / a_Total_Distance;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
float miter = (a_Miter + 1.0)/2.0;
|
|
83
|
-
// 设置数据集的参数
|
|
84
|
-
styleMappingMat[3][0] = d_distance_ratio; // 当前点位距离占线总长的比例
|
|
85
|
-
styleMappingMat[3][1] = a_Distance; // 当前顶点的距离
|
|
86
|
-
styleMappingMat[3][2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
|
|
87
|
-
styleMappingMat[3][3] = miter; // 线图层贴图部分的 v 坐标值 0 - 1
|
|
88
|
-
|
|
89
|
-
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
|
|
90
|
-
|
|
91
|
-
float originSize = a_Size.x; // 固定高度
|
|
92
|
-
if(u_heightfixed < 1.0) { // 高度随 zoom 调整
|
|
93
|
-
originSize = project_float_pixel(a_Size.x);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
float wallHeight = originSize * miter;
|
|
97
|
-
float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));
|
|
98
|
-
|
|
99
|
-
v_blur = min(project_float_pixel(2.0) / originSize, 0.05);
|
|
100
|
-
|
|
101
|
-
v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);
|
|
102
|
-
// v_color = a_Color;
|
|
103
|
-
|
|
104
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
105
|
-
gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));
|
|
106
|
-
} else {
|
|
107
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
setPickingColor(a_PickingColor);
|
|
111
|
-
}
|