@antv/l7-layers 2.10.3 → 2.10.5
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.d.ts +3 -2
- package/es/Geometry/index.js +17 -27
- package/es/Geometry/models/billboard.d.ts +2 -2
- package/es/Geometry/models/billboard.js +37 -77
- package/es/Geometry/models/plane.d.ts +2 -2
- package/es/Geometry/models/plane.js +40 -80
- package/es/Geometry/models/sprite.d.ts +2 -2
- package/es/Geometry/models/sprite.js +45 -83
- package/es/canvas/index.d.ts +3 -2
- package/es/canvas/index.js +19 -29
- package/es/canvas/models/canvas.d.ts +2 -2
- package/es/canvas/models/canvas.js +15 -54
- package/es/citybuliding/building.d.ts +3 -2
- package/es/citybuliding/building.js +17 -26
- package/es/citybuliding/models/build.d.ts +2 -2
- package/es/citybuliding/models/build.js +25 -70
- package/es/core/BaseLayer.d.ts +18 -21
- package/es/core/BaseLayer.js +273 -382
- package/es/core/BaseModel.d.ts +2 -2
- package/es/core/BaseModel.js +6 -47
- package/es/core/triangulation.js +1 -8
- package/es/earth/index.d.ts +2 -2
- package/es/earth/index.js +9 -28
- package/es/earth/models/atmosphere.d.ts +2 -2
- package/es/earth/models/atmosphere.js +22 -67
- package/es/earth/models/base.d.ts +2 -2
- package/es/earth/models/base.js +43 -89
- package/es/earth/models/bloomsphere.d.ts +2 -2
- package/es/earth/models/bloomsphere.js +22 -67
- package/es/heatmap/index.d.ts +3 -2
- package/es/heatmap/index.js +22 -33
- package/es/heatmap/models/grid.d.ts +2 -2
- package/es/heatmap/models/grid.js +27 -68
- package/es/heatmap/models/grid3d.d.ts +2 -2
- package/es/heatmap/models/grid3d.js +28 -69
- package/es/heatmap/models/heatmap.d.ts +2 -2
- package/es/heatmap/models/heatmap.js +14 -40
- package/es/heatmap/models/hexagon.d.ts +2 -2
- package/es/heatmap/models/hexagon.js +28 -69
- package/es/image/index.d.ts +3 -2
- package/es/image/index.js +17 -27
- package/es/image/models/dataImage.d.ts +2 -2
- package/es/image/models/dataImage.js +54 -93
- package/es/image/models/image.d.ts +2 -2
- package/es/image/models/image.js +67 -108
- package/es/image/models/tileDataImage.d.ts +2 -2
- package/es/image/models/tileDataImage.js +43 -84
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/line/index.d.ts +4 -5
- package/es/line/index.js +25 -51
- package/es/line/models/arc.d.ts +2 -2
- package/es/line/models/arc.js +38 -73
- package/es/line/models/arc_3d.d.ts +2 -2
- package/es/line/models/arc_3d.js +34 -69
- package/es/line/models/earthArc_3d.d.ts +2 -2
- package/es/line/models/earthArc_3d.js +37 -72
- package/es/line/models/great_circle.d.ts +2 -2
- package/es/line/models/great_circle.js +29 -70
- package/es/line/models/half.d.ts +2 -2
- package/es/line/models/half.js +17 -40
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +2 -0
- package/es/line/models/line.d.ts +2 -2
- package/es/line/models/line.js +47 -79
- package/es/line/models/linearline.d.ts +2 -2
- package/es/line/models/linearline.js +31 -70
- package/es/line/models/simpleLine.d.ts +2 -2
- package/es/line/models/simpleLine.js +34 -71
- package/es/line/models/simpleTileLine.d.ts +2 -2
- package/es/line/models/simpleTileLine.js +30 -70
- package/es/line/models/tile.d.ts +2 -2
- package/es/line/models/tile.js +17 -40
- package/es/line/models/wall.d.ts +2 -2
- package/es/line/models/wall.js +22 -67
- package/es/mask/index.d.ts +4 -2
- package/es/mask/index.js +97 -27
- package/es/mask/models/fill.d.ts +2 -2
- package/es/mask/models/fill.js +16 -40
- package/es/mask/models/index.d.ts +1 -1
- package/es/mask/models/index.js +3 -1
- package/es/plugins/DataMappingPlugin.d.ts +2 -0
- package/es/plugins/DataMappingPlugin.js +152 -90
- package/es/plugins/DataSourcePlugin.js +30 -74
- package/es/plugins/FeatureScalePlugin.d.ts +1 -0
- package/es/plugins/FeatureScalePlugin.js +61 -85
- package/es/plugins/LayerModelPlugin.d.ts +2 -2
- package/es/plugins/LayerModelPlugin.js +37 -121
- package/es/plugins/LayerStylePlugin.js +6 -1
- package/es/plugins/MultiPassRendererPlugin.js +1 -1
- package/es/plugins/PixelPickingPlugin.js +1 -1
- package/es/plugins/RegisterStyleAttributePlugin.js +16 -1
- package/es/plugins/UpdateModelPlugin.js +0 -3
- package/es/plugins/UpdateStyleAttributePlugin.js +6 -3
- package/es/point/index.d.ts +4 -4
- package/es/point/index.js +23 -55
- package/es/point/models/earthExtrude.d.ts +2 -2
- package/es/point/models/earthExtrude.js +30 -73
- package/es/point/models/earthFill.d.ts +2 -2
- package/es/point/models/earthFill.js +21 -66
- package/es/point/models/extrude.d.ts +2 -2
- package/es/point/models/extrude.js +17 -40
- package/es/point/models/fill.d.ts +2 -2
- package/es/point/models/fill.js +20 -43
- package/es/point/models/fillmage.d.ts +2 -2
- package/es/point/models/fillmage.js +43 -82
- package/es/point/models/image.d.ts +2 -2
- package/es/point/models/image.js +31 -72
- package/es/point/models/index.d.ts +1 -1
- package/es/point/models/index.js +2 -0
- package/es/point/models/normal.d.ts +2 -2
- package/es/point/models/normal.js +30 -71
- package/es/point/models/radar.d.ts +2 -2
- package/es/point/models/radar.js +35 -75
- package/es/point/models/simplePoint.d.ts +2 -2
- package/es/point/models/simplePoint.js +29 -70
- package/es/point/models/text.d.ts +2 -3
- package/es/point/models/text.js +110 -183
- package/es/point/models/tile.d.ts +2 -2
- package/es/point/models/tile.js +35 -77
- package/es/point/models/tileText.d.ts +2 -2
- package/es/point/models/tileText.js +116 -151
- package/es/polygon/index.d.ts +3 -2
- package/es/polygon/index.js +24 -27
- package/es/polygon/models/extrude.d.ts +2 -2
- package/es/polygon/models/extrude.js +32 -69
- package/es/polygon/models/fill.d.ts +2 -2
- package/es/polygon/models/fill.js +43 -76
- package/es/polygon/models/index.d.ts +1 -1
- package/es/polygon/models/index.js +2 -0
- package/es/polygon/models/ocean.d.ts +2 -2
- package/es/polygon/models/ocean.js +28 -69
- package/es/polygon/models/tile.d.ts +2 -2
- package/es/polygon/models/tile.js +30 -70
- package/es/polygon/models/water.d.ts +2 -2
- package/es/polygon/models/water.js +28 -69
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -1
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +2 -1
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +2 -1
- package/es/raster/index.d.ts +4 -3
- package/es/raster/index.js +22 -28
- package/es/raster/models/index.d.ts +1 -1
- package/es/raster/models/index.js +3 -1
- package/es/raster/models/raster.d.ts +2 -2
- package/es/raster/models/raster.js +13 -36
- package/es/raster/models/rasterRgb.d.ts +2 -2
- package/es/raster/models/rasterRgb.js +13 -36
- package/es/raster/models/rasterTile.d.ts +2 -2
- package/es/raster/models/rasterTile.js +36 -77
- package/es/raster/raster.d.ts +1 -1
- package/es/raster/raster.js +22 -42
- package/es/tile/interaction/TilePickService.d.ts +16 -0
- package/es/tile/interaction/TilePickService.js +129 -0
- package/es/tile/interaction/getRasterData.d.ts +2 -2
- package/es/tile/interaction/utils.js +11 -3
- package/es/tile/interface.d.ts +4 -5
- package/es/tile/manager/base.d.ts +12 -17
- package/es/tile/manager/base.js +47 -212
- package/es/tile/manager/layerManager.d.ts +19 -0
- package/es/tile/manager/layerManager.js +254 -0
- package/es/tile/manager/mapLayerManager.d.ts +7 -0
- package/es/tile/manager/mapLayerManager.js +119 -0
- package/es/tile/models/tileModel.d.ts +10 -0
- package/es/tile/models/tileModel.js +81 -0
- package/es/tile/render/TileRenderService.d.ts +10 -0
- package/es/tile/render/TileRenderService.js +68 -0
- package/es/tile/style/TileStyleService.d.ts +17 -0
- package/es/tile/style/TileStyleService.js +118 -0
- package/es/tile/style/constants.d.ts +13 -1
- package/es/tile/style/constants.js +15 -6
- package/es/tile/style/utils.d.ts +8 -1
- package/es/tile/style/utils.js +126 -0
- package/es/tile/tileFactory/base.d.ts +45 -0
- package/es/tile/tileFactory/base.js +403 -0
- package/es/tile/tileFactory/index.d.ts +4 -10
- package/es/tile/tileFactory/index.js +23 -30
- package/es/tile/tileFactory/layers/{RasterDataLayer.d.ts → rasterDataLayer.d.ts} +3 -3
- package/es/tile/tileFactory/layers/{RasterDataLayer.js → rasterDataLayer.js} +21 -33
- package/es/tile/tileFactory/layers/{TileDebugLayer.d.ts → tileTest.d.ts} +2 -2
- package/es/tile/tileFactory/layers/{TileDebugLayer.js → tileTest.js} +10 -23
- package/es/tile/tileFactory/layers/vectorLayer.d.ts +30 -0
- package/es/tile/tileFactory/layers/vectorLayer.js +253 -0
- package/es/tile/tileFactory/line.d.ts +12 -0
- package/es/tile/tileFactory/line.js +59 -0
- package/es/tile/tileFactory/mask.d.ts +12 -0
- package/es/tile/tileFactory/mask.js +60 -0
- package/es/tile/tileFactory/point.d.ts +12 -0
- package/es/tile/tileFactory/point.js +60 -0
- package/es/tile/tileFactory/polygon.d.ts +12 -0
- package/es/tile/tileFactory/polygon.js +59 -0
- package/es/tile/tileFactory/raster.d.ts +12 -0
- package/es/tile/tileFactory/raster.js +55 -0
- package/es/tile/tileFactory/rasterData.d.ts +12 -0
- package/es/tile/tileFactory/rasterData.js +81 -0
- package/es/tile/tileFactory/test.d.ts +12 -0
- package/es/tile/tileFactory/test.js +94 -0
- package/es/tile/tileLayer/MapTileLayer.d.ts +6 -0
- package/es/tile/tileLayer/MapTileLayer.js +48 -0
- package/es/tile/tileLayer/TileLayer.d.ts +22 -0
- package/es/tile/tileLayer/TileLayer.js +198 -0
- package/es/tile/tileLayer/base.d.ts +33 -0
- package/es/tile/tileLayer/base.js +212 -0
- package/es/tile/utils.d.ts +11 -1
- package/es/tile/utils.js +129 -0
- package/es/utils/dataMappingStyle.d.ts +4 -4
- package/es/utils/dataMappingStyle.js +18 -16
- package/es/utils/layerData.js +11 -5
- package/es/wind/index.d.ts +3 -2
- package/es/wind/index.js +17 -27
- package/es/wind/models/wind.d.ts +2 -2
- package/es/wind/models/wind.js +104 -123
- package/lib/Geometry/index.js +17 -29
- package/lib/Geometry/models/billboard.js +37 -79
- package/lib/Geometry/models/plane.js +40 -82
- package/lib/Geometry/models/sprite.js +45 -85
- package/lib/canvas/index.js +19 -31
- package/lib/canvas/models/canvas.js +15 -56
- package/lib/citybuliding/building.js +17 -28
- package/lib/citybuliding/models/build.js +25 -72
- package/lib/core/BaseLayer.js +268 -382
- package/lib/core/BaseModel.js +6 -48
- package/lib/core/triangulation.js +1 -8
- package/lib/earth/index.js +9 -30
- package/lib/earth/models/atmosphere.js +22 -69
- package/lib/earth/models/base.js +42 -90
- package/lib/earth/models/bloomsphere.js +22 -69
- package/lib/heatmap/index.js +22 -35
- package/lib/heatmap/models/grid.js +27 -70
- package/lib/heatmap/models/grid3d.js +28 -71
- package/lib/heatmap/models/heatmap.js +14 -40
- package/lib/heatmap/models/hexagon.js +28 -71
- package/lib/image/index.js +17 -29
- package/lib/image/models/dataImage.js +54 -95
- package/lib/image/models/image.js +67 -110
- package/lib/image/models/tileDataImage.js +43 -86
- package/lib/index.js +5 -5
- package/lib/line/index.js +26 -53
- package/lib/line/models/arc.js +38 -75
- package/lib/line/models/arc_3d.js +34 -71
- package/lib/line/models/earthArc_3d.js +37 -74
- package/lib/line/models/great_circle.js +29 -72
- package/lib/line/models/half.js +17 -40
- package/lib/line/models/index.js +3 -0
- package/lib/line/models/line.js +47 -81
- package/lib/line/models/linearline.js +31 -72
- package/lib/line/models/simpleLine.js +34 -73
- package/lib/line/models/simpleTileLine.js +30 -72
- package/lib/line/models/tile.js +17 -40
- package/lib/line/models/wall.js +22 -69
- package/lib/mask/index.js +99 -28
- package/lib/mask/models/fill.js +16 -40
- package/lib/mask/models/index.js +4 -1
- package/lib/plugins/DataMappingPlugin.js +149 -91
- package/lib/plugins/DataSourcePlugin.js +30 -76
- package/lib/plugins/FeatureScalePlugin.js +61 -87
- package/lib/plugins/LayerModelPlugin.js +41 -128
- package/lib/plugins/LayerStylePlugin.js +6 -1
- package/lib/plugins/MultiPassRendererPlugin.js +1 -1
- package/lib/plugins/PixelPickingPlugin.js +1 -1
- package/lib/plugins/RegisterStyleAttributePlugin.js +16 -1
- package/lib/plugins/UpdateModelPlugin.js +0 -3
- package/lib/plugins/UpdateStyleAttributePlugin.js +6 -3
- package/lib/point/index.js +24 -56
- package/lib/point/models/earthExtrude.js +30 -75
- package/lib/point/models/earthFill.js +21 -68
- package/lib/point/models/extrude.js +17 -40
- package/lib/point/models/fill.js +21 -44
- package/lib/point/models/fillmage.js +43 -84
- package/lib/point/models/image.js +31 -74
- package/lib/point/models/index.js +3 -0
- package/lib/point/models/normal.js +30 -73
- package/lib/point/models/radar.js +35 -77
- package/lib/point/models/simplePoint.js +29 -72
- package/lib/point/models/text.js +109 -183
- package/lib/point/models/tile.js +35 -79
- package/lib/point/models/tileText.js +115 -151
- package/lib/polygon/index.js +25 -29
- package/lib/polygon/models/extrude.js +32 -71
- package/lib/polygon/models/fill.js +43 -78
- package/lib/polygon/models/index.js +3 -0
- package/lib/polygon/models/ocean.js +28 -71
- package/lib/polygon/models/tile.js +30 -72
- package/lib/polygon/models/water.js +28 -71
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -1
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +2 -1
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +2 -1
- package/lib/raster/index.js +22 -30
- package/lib/raster/models/index.js +4 -1
- package/lib/raster/models/raster.js +13 -36
- package/lib/raster/models/rasterRgb.js +13 -36
- package/lib/raster/models/rasterTile.js +36 -79
- package/lib/raster/raster.js +22 -44
- package/lib/tile/interaction/TilePickService.js +143 -0
- package/lib/tile/interaction/utils.js +11 -3
- package/lib/tile/manager/base.js +47 -213
- package/lib/tile/manager/layerManager.js +275 -0
- package/lib/tile/manager/mapLayerManager.js +134 -0
- package/lib/tile/models/tileModel.js +94 -0
- package/lib/tile/render/TileRenderService.js +78 -0
- package/lib/tile/style/TileStyleService.js +133 -0
- package/lib/tile/style/constants.js +19 -8
- package/lib/tile/style/utils.js +140 -0
- package/lib/tile/tileFactory/base.js +427 -0
- package/lib/tile/tileFactory/index.js +24 -42
- package/lib/tile/tileFactory/layers/{RasterDataLayer.js → rasterDataLayer.js} +21 -35
- package/lib/tile/tileFactory/layers/{TileDebugLayer.js → tileTest.js} +11 -24
- package/lib/tile/tileFactory/layers/vectorLayer.js +268 -0
- package/lib/tile/tileFactory/line.js +70 -0
- package/lib/tile/tileFactory/mask.js +71 -0
- package/lib/tile/tileFactory/point.js +71 -0
- package/lib/tile/tileFactory/polygon.js +70 -0
- package/lib/tile/tileFactory/raster.js +68 -0
- package/lib/tile/tileFactory/rasterData.js +93 -0
- package/lib/tile/tileFactory/test.js +106 -0
- package/lib/tile/tileLayer/MapTileLayer.js +63 -0
- package/lib/tile/tileLayer/TileLayer.js +215 -0
- package/lib/tile/tileLayer/base.js +225 -0
- package/lib/tile/utils.js +148 -0
- package/lib/utils/dataMappingStyle.js +20 -18
- package/lib/utils/layerData.js +10 -4
- package/lib/wind/index.js +17 -29
- package/lib/wind/models/wind.js +104 -125
- package/package.json +7 -7
- package/es/core/LayerPickService.d.ts +0 -9
- package/es/core/LayerPickService.js +0 -85
- package/es/tile/service/TileLayerService.d.ts +0 -33
- package/es/tile/service/TileLayerService.js +0 -172
- package/es/tile/service/TilePickService.d.ts +0 -22
- package/es/tile/service/TilePickService.js +0 -148
- package/es/tile/service/TileSourceService.d.ts +0 -7
- package/es/tile/service/TileSourceService.js +0 -39
- package/es/tile/tileFactory/DebugTile.d.ts +0 -16
- package/es/tile/tileFactory/DebugTile.js +0 -100
- package/es/tile/tileFactory/ImageTile.d.ts +0 -14
- package/es/tile/tileFactory/ImageTile.js +0 -89
- package/es/tile/tileFactory/MaskTile.d.ts +0 -17
- package/es/tile/tileFactory/MaskTile.js +0 -98
- package/es/tile/tileFactory/RasterRGBTile.d.ts +0 -16
- package/es/tile/tileFactory/RasterRGBTile.js +0 -91
- package/es/tile/tileFactory/RasterTile.d.ts +0 -27
- package/es/tile/tileFactory/RasterTile.js +0 -186
- package/es/tile/tileFactory/Tile.d.ts +0 -34
- package/es/tile/tileFactory/Tile.js +0 -199
- package/es/tile/tileFactory/VectorTile.d.ts +0 -20
- package/es/tile/tileFactory/VectorTile.js +0 -152
- package/es/tile/tileFactory/util.d.ts +0 -6
- package/es/tile/tileFactory/util.js +0 -33
- package/es/tile/tileLayer/BaseLayer.d.ts +0 -46
- package/es/tile/tileLayer/BaseLayer.js +0 -358
- package/lib/core/LayerPickService.js +0 -96
- package/lib/tile/service/TileLayerService.js +0 -185
- package/lib/tile/service/TilePickService.js +0 -162
- package/lib/tile/service/TileSourceService.js +0 -59
- package/lib/tile/tileFactory/DebugTile.js +0 -115
- package/lib/tile/tileFactory/ImageTile.js +0 -104
- package/lib/tile/tileFactory/MaskTile.js +0 -113
- package/lib/tile/tileFactory/RasterRGBTile.js +0 -106
- package/lib/tile/tileFactory/RasterTile.js +0 -205
- package/lib/tile/tileFactory/Tile.js +0 -210
- package/lib/tile/tileFactory/VectorTile.js +0 -167
- package/lib/tile/tileFactory/util.js +0 -48
- package/lib/tile/tileLayer/BaseLayer.js +0 -373
package/lib/tile/manager/base.js
CHANGED
|
@@ -7,152 +7,63 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.Base = void 0;
|
|
9
9
|
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
11
|
|
|
14
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
-
|
|
16
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
13
|
|
|
18
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
15
|
|
|
20
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
17
|
|
|
22
|
-
var
|
|
18
|
+
var _tileFactory = require("../tileFactory");
|
|
23
19
|
|
|
24
|
-
var _utils = require("../
|
|
20
|
+
var _utils = require("../utils");
|
|
25
21
|
|
|
26
22
|
var Base = /*#__PURE__*/function () {
|
|
27
23
|
function Base() {
|
|
28
24
|
(0, _classCallCheck2.default)(this, Base);
|
|
29
25
|
(0, _defineProperty2.default)(this, "tileCache", new Map());
|
|
30
|
-
(0, _defineProperty2.default)(this, "tileLayerCache", new Map());
|
|
31
26
|
}
|
|
32
27
|
|
|
33
28
|
(0, _createClass2.default)(Base, [{
|
|
34
|
-
key: "initTileLayers",
|
|
35
|
-
value: function () {
|
|
36
|
-
var _initTileLayers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(layers, tile) {
|
|
37
|
-
var _this = this;
|
|
38
|
-
|
|
39
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
40
|
-
while (1) {
|
|
41
|
-
switch (_context2.prev = _context2.next) {
|
|
42
|
-
case 0:
|
|
43
|
-
return _context2.abrupt("return", Promise.all(layers.map( /*#__PURE__*/function () {
|
|
44
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(layer) {
|
|
45
|
-
var container;
|
|
46
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
47
|
-
while (1) {
|
|
48
|
-
switch (_context.prev = _context.next) {
|
|
49
|
-
case 0:
|
|
50
|
-
container = (0, _l7Core.createLayerContainer)(_this.parent.sceneContainer);
|
|
51
|
-
layer.setContainer(container, _this.parent.sceneContainer);
|
|
52
|
-
_context.next = 4;
|
|
53
|
-
return layer.init();
|
|
54
|
-
|
|
55
|
-
case 4:
|
|
56
|
-
_this.addChild(layer);
|
|
57
|
-
|
|
58
|
-
tile.layerLoad();
|
|
59
|
-
|
|
60
|
-
_this.render();
|
|
61
|
-
|
|
62
|
-
case 7:
|
|
63
|
-
case "end":
|
|
64
|
-
return _context.stop();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}, _callee);
|
|
68
|
-
}));
|
|
69
|
-
|
|
70
|
-
return function (_x3) {
|
|
71
|
-
return _ref.apply(this, arguments);
|
|
72
|
-
};
|
|
73
|
-
}())));
|
|
74
|
-
|
|
75
|
-
case 1:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context2.stop();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, _callee2);
|
|
81
|
-
}));
|
|
82
|
-
|
|
83
|
-
function initTileLayers(_x, _x2) {
|
|
84
|
-
return _initTileLayers.apply(this, arguments);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return initTileLayers;
|
|
88
|
-
}()
|
|
89
|
-
}, {
|
|
90
|
-
key: "render",
|
|
91
|
-
value: function render() {
|
|
92
|
-
this.parent.renderLayers();
|
|
93
|
-
}
|
|
94
|
-
}, {
|
|
95
29
|
key: "hasTile",
|
|
96
30
|
value: function hasTile(tile) {
|
|
97
|
-
return this.tileCache.has(tile.key);
|
|
98
|
-
}
|
|
99
|
-
|
|
31
|
+
return !!this.tileCache.has(tile.key);
|
|
32
|
+
}
|
|
100
33
|
}, {
|
|
101
34
|
key: "addTile",
|
|
102
|
-
value: function () {
|
|
103
|
-
var
|
|
104
|
-
var layerCollections;
|
|
105
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
106
|
-
while (1) {
|
|
107
|
-
switch (_context3.prev = _context3.next) {
|
|
108
|
-
case 0:
|
|
109
|
-
if (!this.hasTile(tile)) {
|
|
110
|
-
_context3.next = 2;
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
35
|
+
value: function addTile(tile) {
|
|
36
|
+
var _tile$layerIDList;
|
|
113
37
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
38
|
+
// oldTile 存在的时候暂时直接结束
|
|
39
|
+
// TODO:合并不存在的时候
|
|
40
|
+
if (this.hasTile(tile)) return {
|
|
41
|
+
layers: [],
|
|
42
|
+
layerIDList: []
|
|
43
|
+
}; // 存储当前 tile
|
|
117
44
|
|
|
118
|
-
|
|
119
|
-
// 存储当前 tile
|
|
120
|
-
this.tileCache.set(tile.key, tile); // 创建 tile 对应的 layers
|
|
45
|
+
this.tileCache.set(tile.key, tile); // 创建 tile 对应的 layers
|
|
121
46
|
|
|
122
|
-
|
|
47
|
+
var layerCollections = this.tileFactory.createTile(tile, this.initOptions); // regist layer 将创建出来的 layer 进行注册初始化操作
|
|
123
48
|
|
|
124
|
-
|
|
125
|
-
return this.initTileLayers(layerCollections.layers, tile);
|
|
49
|
+
(0, _utils.registerLayers)(this.parent, layerCollections.layers);
|
|
126
50
|
|
|
127
|
-
|
|
128
|
-
this.tileLayerCache.set(tile.key, layerCollections.layers); // const visible = tile.parent ? tile.parent.children.every(t=>this.tileLayerCache.has(t.key)) : true
|
|
129
|
-
// tile.parent?.children.forEach((t)=>{
|
|
130
|
-
// updateLayersConfig(this.getLayers(t),'visible',visible)
|
|
131
|
-
// })
|
|
51
|
+
(_tile$layerIDList = tile.layerIDList).push.apply(_tile$layerIDList, (0, _toConsumableArray2.default)(layerCollections.layerIDList)); // add layer into layerGroup
|
|
132
52
|
|
|
133
|
-
return _context3.abrupt("return", layerCollections);
|
|
134
|
-
|
|
135
|
-
case 8:
|
|
136
|
-
case "end":
|
|
137
|
-
return _context3.stop();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}, _callee3, this);
|
|
141
|
-
}));
|
|
142
|
-
|
|
143
|
-
function addTile(_x4) {
|
|
144
|
-
return _addTile.apply(this, arguments);
|
|
145
|
-
}
|
|
146
53
|
|
|
147
|
-
|
|
148
|
-
|
|
54
|
+
this.addChildren(layerCollections.layers);
|
|
55
|
+
layerCollections.layers.map(function (layer) {
|
|
56
|
+
layer.once('modelLoaded', function () {
|
|
57
|
+
tile.layerLoad();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
return layerCollections;
|
|
61
|
+
}
|
|
149
62
|
}, {
|
|
150
63
|
key: "removeTile",
|
|
151
64
|
value: function removeTile(tile) {
|
|
152
65
|
this.tileCache.delete(tile.key);
|
|
153
|
-
|
|
154
|
-
this.tileLayerCache.delete(tile.key);
|
|
155
|
-
this.removeLayers(layers, false);
|
|
66
|
+
this.removeChildren(tile.layerIDList, false);
|
|
156
67
|
}
|
|
157
68
|
}, {
|
|
158
69
|
key: "addChild",
|
|
@@ -167,16 +78,18 @@ var Base = /*#__PURE__*/function () {
|
|
|
167
78
|
(_this$children = this.children).push.apply(_this$children, (0, _toConsumableArray2.default)(layers));
|
|
168
79
|
}
|
|
169
80
|
}, {
|
|
170
|
-
key: "
|
|
171
|
-
value: function
|
|
172
|
-
var layers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
81
|
+
key: "removeChildren",
|
|
82
|
+
value: function removeChildren(layerIDList) {
|
|
173
83
|
var refresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
174
|
-
|
|
175
|
-
|
|
84
|
+
var remveLayerList = [];
|
|
85
|
+
var cacheLayerList = [];
|
|
86
|
+
this.children.filter(function (child) {
|
|
87
|
+
layerIDList.includes(child.id) ? remveLayerList.push(child) : cacheLayerList.push(child);
|
|
176
88
|
});
|
|
177
|
-
|
|
89
|
+
remveLayerList.map(function (layer) {
|
|
178
90
|
return layer.destroy(refresh);
|
|
179
91
|
});
|
|
92
|
+
this.children = cacheLayerList;
|
|
180
93
|
}
|
|
181
94
|
}, {
|
|
182
95
|
key: "removeChild",
|
|
@@ -190,10 +103,11 @@ var Base = /*#__PURE__*/function () {
|
|
|
190
103
|
layer.destroy();
|
|
191
104
|
}
|
|
192
105
|
}, {
|
|
193
|
-
key: "
|
|
194
|
-
value: function
|
|
195
|
-
|
|
196
|
-
|
|
106
|
+
key: "getChildren",
|
|
107
|
+
value: function getChildren(layerIDList) {
|
|
108
|
+
return this.children.filter(function (child) {
|
|
109
|
+
return layerIDList.includes(child.id);
|
|
110
|
+
});
|
|
197
111
|
}
|
|
198
112
|
}, {
|
|
199
113
|
key: "getChild",
|
|
@@ -217,11 +131,14 @@ var Base = /*#__PURE__*/function () {
|
|
|
217
131
|
}
|
|
218
132
|
}, {
|
|
219
133
|
key: "initTileFactory",
|
|
220
|
-
value: function initTileFactory() {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
134
|
+
value: function initTileFactory() {
|
|
135
|
+
var source = this.parent.getSource();
|
|
136
|
+
var TileFactory = (0, _tileFactory.getTileFactory)(this.parent.type, source.parser);
|
|
137
|
+
this.tileFactory = new TileFactory({
|
|
138
|
+
parent: this.parent,
|
|
139
|
+
mapService: this.mapService,
|
|
140
|
+
rendererService: this.rendererService
|
|
141
|
+
});
|
|
225
142
|
}
|
|
226
143
|
}, {
|
|
227
144
|
key: "getSourceLayer",
|
|
@@ -234,92 +151,9 @@ var Base = /*#__PURE__*/function () {
|
|
|
234
151
|
return sourceLayer;
|
|
235
152
|
}
|
|
236
153
|
}
|
|
237
|
-
}, {
|
|
238
|
-
key: "updateTileVisible",
|
|
239
|
-
value: function updateTileVisible(tile, layerService) {
|
|
240
|
-
var layers = this.getLayers(tile);
|
|
241
|
-
if (layers.length === 0) return;
|
|
242
|
-
|
|
243
|
-
if (tile.isVisible) {
|
|
244
|
-
// 如果可见直接进行渲染,父级发
|
|
245
|
-
(0, _utils.updateLayersConfig)(layers, 'visible', tile.isVisible);
|
|
246
|
-
} else {
|
|
247
|
-
// 如果不可见,放大,等到子瓦片渲染完成,缩小:父级渲染成功
|
|
248
|
-
// console.log('updateTileVisible',`${tile.x}_${tile.y}_${tile.z}`,tile.isVisible)
|
|
249
|
-
// console.log(tile);
|
|
250
|
-
// console.log(`子瓦片${tile.x}/${tile.y}/${tile.z}`,tile.children.length)
|
|
251
|
-
// tile.children.forEach((t)=>{
|
|
252
|
-
// console.log(`${t.x}/${t.y}/${t.z}`)
|
|
253
|
-
// })
|
|
254
|
-
(0, _utils.updateLayersConfig)(layers, 'visible', tile.isVisible);
|
|
255
|
-
} // this.listenLoad(tile, () => {
|
|
256
|
-
// this.isTileAllLoad(tile) && updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
257
|
-
// })
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
}, {
|
|
261
|
-
key: "listenLoad",
|
|
262
|
-
value: function listenLoad(tile, callback) {
|
|
263
|
-
var _tile$parent;
|
|
264
|
-
|
|
265
|
-
tile.once('layerLoaded', function () {
|
|
266
|
-
callback();
|
|
267
|
-
});
|
|
268
|
-
tile.children.map(function (childTile) {
|
|
269
|
-
childTile.once('layerLoaded', function () {
|
|
270
|
-
callback();
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
(_tile$parent = tile.parent) === null || _tile$parent === void 0 ? void 0 : _tile$parent.once('layerLoaded', function () {
|
|
274
|
-
callback();
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
}, {
|
|
278
|
-
key: "isTileLoaded",
|
|
279
|
-
value: function isTileLoaded(tile) {
|
|
280
|
-
if (tile.isLoad) return true;
|
|
281
|
-
var isLoad = this.getLayers(tile).length === tile.loadedLayers;
|
|
282
|
-
tile.isLoad = isLoad;
|
|
283
|
-
return isLoad;
|
|
284
|
-
}
|
|
285
|
-
}, {
|
|
286
|
-
key: "isTileChildLoaded",
|
|
287
|
-
value: function isTileChildLoaded(tile) {
|
|
288
|
-
var _this2 = this;
|
|
289
|
-
|
|
290
|
-
if (tile.isChildLoad) return true;
|
|
291
|
-
var children = tile.children;
|
|
292
|
-
var isLoad = children.filter(function (child) {
|
|
293
|
-
return _this2.isTileLoaded(child);
|
|
294
|
-
}).length === children.length;
|
|
295
|
-
tile.isChildLoad = isLoad;
|
|
296
|
-
return isLoad;
|
|
297
|
-
}
|
|
298
|
-
}, {
|
|
299
|
-
key: "isTileParentLoaded",
|
|
300
|
-
value: function isTileParentLoaded(tile) {
|
|
301
|
-
var parent = tile.parent;
|
|
302
|
-
|
|
303
|
-
if (!parent) {
|
|
304
|
-
return true;
|
|
305
|
-
} else {
|
|
306
|
-
return this.isTileLoaded(parent);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}, {
|
|
310
|
-
key: "isTileAllLoad",
|
|
311
|
-
value: function isTileAllLoad(tile) {
|
|
312
|
-
var tileLoaded = this.isTileLoaded(tile);
|
|
313
|
-
var tileChildLoaded = this.isTileChildLoaded(tile);
|
|
314
|
-
var tileParentLoaded = this.isTileParentLoaded(tile);
|
|
315
|
-
return tileLoaded && tileChildLoaded && tileParentLoaded;
|
|
316
|
-
}
|
|
317
154
|
}, {
|
|
318
155
|
key: "destroy",
|
|
319
|
-
value: function destroy() {
|
|
320
|
-
this.tileCache.clear();
|
|
321
|
-
this.tileLayerCache.clear();
|
|
322
|
-
}
|
|
156
|
+
value: function destroy() {}
|
|
323
157
|
}]);
|
|
324
158
|
return Base;
|
|
325
159
|
}();
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.TileLayerManager = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
|
|
16
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
+
|
|
18
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
+
|
|
20
|
+
var _base = require("./base");
|
|
21
|
+
|
|
22
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
23
|
+
|
|
24
|
+
var _utils = require("../utils");
|
|
25
|
+
|
|
26
|
+
var _TileStyleService = require("../style/TileStyleService");
|
|
27
|
+
|
|
28
|
+
var _TilePickService = require("../interaction/TilePickService");
|
|
29
|
+
|
|
30
|
+
var _TileRenderService = require("../render/TileRenderService");
|
|
31
|
+
|
|
32
|
+
var _constants = require("../style/constants");
|
|
33
|
+
|
|
34
|
+
var _utils2 = require("../style/utils");
|
|
35
|
+
|
|
36
|
+
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); }; }
|
|
37
|
+
|
|
38
|
+
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; } }
|
|
39
|
+
|
|
40
|
+
var TileLayerManager = /*#__PURE__*/function (_Base) {
|
|
41
|
+
(0, _inherits2.default)(TileLayerManager, _Base);
|
|
42
|
+
|
|
43
|
+
var _super = _createSuper(TileLayerManager);
|
|
44
|
+
|
|
45
|
+
function TileLayerManager(parent, mapService, rendererService, pickingService, transforms) {
|
|
46
|
+
var _this;
|
|
47
|
+
|
|
48
|
+
(0, _classCallCheck2.default)(this, TileLayerManager);
|
|
49
|
+
_this = _super.call(this);
|
|
50
|
+
_this.parent = parent;
|
|
51
|
+
_this.children = parent.layerChildren;
|
|
52
|
+
_this.mapService = mapService;
|
|
53
|
+
_this.rendererService = rendererService;
|
|
54
|
+
_this.transforms = transforms;
|
|
55
|
+
_this.tileRenderService = new _TileRenderService.TileRenderService(rendererService);
|
|
56
|
+
_this.tilePickService = new _TilePickService.TilePickService(parent, rendererService, pickingService, _this.children, _this.tileRenderService);
|
|
57
|
+
_this.tileStyleService = new _TileStyleService.TileStyleService();
|
|
58
|
+
|
|
59
|
+
_this.setSubLayerInitOption();
|
|
60
|
+
|
|
61
|
+
_this.setConfigListener();
|
|
62
|
+
|
|
63
|
+
_this.initTileFactory();
|
|
64
|
+
|
|
65
|
+
return _this;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
(0, _createClass2.default)(TileLayerManager, [{
|
|
69
|
+
key: "render",
|
|
70
|
+
value: function render() {
|
|
71
|
+
this.tileStyleService.checkConfig(this.parent);
|
|
72
|
+
this.tileRenderService.render(this.children);
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "pickLayers",
|
|
76
|
+
value: function pickLayers(target) {
|
|
77
|
+
return this.tilePickService.pick(this.children, target);
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
key: "setSubLayerInitOption",
|
|
81
|
+
value: function setSubLayerInitOption() {
|
|
82
|
+
var _source$data;
|
|
83
|
+
|
|
84
|
+
var _ref = this.parent.getLayerConfig(),
|
|
85
|
+
_ref$zIndex = _ref.zIndex,
|
|
86
|
+
zIndex = _ref$zIndex === void 0 ? 0 : _ref$zIndex,
|
|
87
|
+
_ref$opacity = _ref.opacity,
|
|
88
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
89
|
+
_ref$mask = _ref.mask,
|
|
90
|
+
mask = _ref$mask === void 0 ? false : _ref$mask,
|
|
91
|
+
_ref$stroke = _ref.stroke,
|
|
92
|
+
stroke = _ref$stroke === void 0 ? '#fff' : _ref$stroke,
|
|
93
|
+
_ref$strokeWidth = _ref.strokeWidth,
|
|
94
|
+
strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
|
|
95
|
+
_ref$strokeOpacity = _ref.strokeOpacity,
|
|
96
|
+
strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity,
|
|
97
|
+
_ref$clampLow = _ref.clampLow,
|
|
98
|
+
clampLow = _ref$clampLow === void 0 ? true : _ref$clampLow,
|
|
99
|
+
_ref$clampHigh = _ref.clampHigh,
|
|
100
|
+
clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
|
|
101
|
+
_ref$domain = _ref.domain,
|
|
102
|
+
domain = _ref$domain === void 0 ? [0, 1] : _ref$domain,
|
|
103
|
+
_ref$rampColors = _ref.rampColors,
|
|
104
|
+
rampColors = _ref$rampColors === void 0 ? {
|
|
105
|
+
colors: ['rgb(166,97,26)', 'rgb(223,194,125)', 'rgb(245,245,245)', 'rgb(128,205,193)', 'rgb(1,133,113)'],
|
|
106
|
+
positions: [0, 0.25, 0.5, 0.75, 1.0]
|
|
107
|
+
} : _ref$rampColors,
|
|
108
|
+
_ref$featureId = _ref.featureId,
|
|
109
|
+
featureId = _ref$featureId === void 0 ? 'id' : _ref$featureId,
|
|
110
|
+
_ref$workerEnabled = _ref.workerEnabled,
|
|
111
|
+
workerEnabled = _ref$workerEnabled === void 0 ? false : _ref$workerEnabled,
|
|
112
|
+
sourceLayer = _ref.sourceLayer,
|
|
113
|
+
_ref$pixelConstant = _ref.pixelConstant,
|
|
114
|
+
pixelConstant = _ref$pixelConstant === void 0 ? 0 : _ref$pixelConstant,
|
|
115
|
+
_ref$pixelConstantR = _ref.pixelConstantR,
|
|
116
|
+
pixelConstantR = _ref$pixelConstantR === void 0 ? 256 * 256 : _ref$pixelConstantR,
|
|
117
|
+
_ref$pixelConstantG = _ref.pixelConstantG,
|
|
118
|
+
pixelConstantG = _ref$pixelConstantG === void 0 ? 256 : _ref$pixelConstantG,
|
|
119
|
+
_ref$pixelConstantB = _ref.pixelConstantB,
|
|
120
|
+
pixelConstantB = _ref$pixelConstantB === void 0 ? 1 : _ref$pixelConstantB,
|
|
121
|
+
_ref$pixelConstantRGB = _ref.pixelConstantRGB,
|
|
122
|
+
pixelConstantRGB = _ref$pixelConstantRGB === void 0 ? 0.1 : _ref$pixelConstantRGB;
|
|
123
|
+
|
|
124
|
+
var colorValue = this.tileStyleService.getAttributeScale(this.parent, 'color');
|
|
125
|
+
var sizeValue = this.tileStyleService.getAttributeScale(this.parent, 'size');
|
|
126
|
+
var source = this.parent.getSource();
|
|
127
|
+
|
|
128
|
+
var _ref2 = (source === null || source === void 0 ? void 0 : (_source$data = source.data) === null || _source$data === void 0 ? void 0 : _source$data.tilesetOptions) || {},
|
|
129
|
+
coords = _ref2.coords;
|
|
130
|
+
|
|
131
|
+
var parentParserType = source.getParserType();
|
|
132
|
+
var layerShape = (0, _utils.getLayerShape)(this.parent.type, this.parent);
|
|
133
|
+
this.initOptions = {
|
|
134
|
+
layerType: this.parent.type,
|
|
135
|
+
transforms: this.transforms,
|
|
136
|
+
shape: layerShape,
|
|
137
|
+
zIndex: zIndex,
|
|
138
|
+
opacity: opacity,
|
|
139
|
+
sourceLayer: this.getSourceLayer(parentParserType, sourceLayer),
|
|
140
|
+
coords: coords,
|
|
141
|
+
featureId: featureId,
|
|
142
|
+
color: colorValue,
|
|
143
|
+
size: sizeValue,
|
|
144
|
+
mask: (0, _utils.getMaskValue)(this.parent.type, mask),
|
|
145
|
+
stroke: stroke,
|
|
146
|
+
strokeWidth: strokeWidth,
|
|
147
|
+
strokeOpacity: strokeOpacity,
|
|
148
|
+
// raster tiff
|
|
149
|
+
clampLow: clampLow,
|
|
150
|
+
clampHigh: clampHigh,
|
|
151
|
+
domain: domain,
|
|
152
|
+
rampColors: rampColors,
|
|
153
|
+
// worker
|
|
154
|
+
workerEnabled: workerEnabled,
|
|
155
|
+
pixelConstant: pixelConstant,
|
|
156
|
+
pixelConstantR: pixelConstantR,
|
|
157
|
+
pixelConstantG: pixelConstantG,
|
|
158
|
+
pixelConstantB: pixelConstantB,
|
|
159
|
+
pixelConstantRGB: pixelConstantRGB
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
if (rampColors) {
|
|
163
|
+
// 构建统一的色带贴图
|
|
164
|
+
var createTexture2D = this.rendererService.createTexture2D;
|
|
165
|
+
var imageData = (0, _l7Utils.generateColorRamp)(rampColors);
|
|
166
|
+
var colorTexture = createTexture2D({
|
|
167
|
+
data: imageData.data,
|
|
168
|
+
width: imageData.width,
|
|
169
|
+
height: imageData.height,
|
|
170
|
+
flipY: false
|
|
171
|
+
});
|
|
172
|
+
this.initOptions.colorTexture = colorTexture;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}, {
|
|
176
|
+
key: "getInitOptionValue",
|
|
177
|
+
value: function getInitOptionValue(field) {
|
|
178
|
+
var _this$parent$getAttri, _this$parent$getAttri2, _this$parent$getAttri3;
|
|
179
|
+
|
|
180
|
+
switch (field) {
|
|
181
|
+
case 'color':
|
|
182
|
+
return (_this$parent$getAttri = this.parent.getAttribute('color')) === null || _this$parent$getAttri === void 0 ? void 0 : _this$parent$getAttri.scale;
|
|
183
|
+
|
|
184
|
+
case 'shape':
|
|
185
|
+
return (_this$parent$getAttri2 = this.parent.getAttribute('shape')) === null || _this$parent$getAttri2 === void 0 ? void 0 : _this$parent$getAttri2.scale;
|
|
186
|
+
|
|
187
|
+
case 'size':
|
|
188
|
+
return (_this$parent$getAttri3 = this.parent.getAttribute('size')) === null || _this$parent$getAttri3 === void 0 ? void 0 : _this$parent$getAttri3.scale;
|
|
189
|
+
// @ts-ignore
|
|
190
|
+
|
|
191
|
+
default:
|
|
192
|
+
return this.initOptions[field];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}, {
|
|
196
|
+
key: "setInitOptionValue",
|
|
197
|
+
value: function setInitOptionValue(field, value) {
|
|
198
|
+
// @ts-ignore
|
|
199
|
+
this.initOptions[field] = value;
|
|
200
|
+
}
|
|
201
|
+
}, {
|
|
202
|
+
key: "setConfigListener",
|
|
203
|
+
value: function setConfigListener() {
|
|
204
|
+
var _this2 = this;
|
|
205
|
+
|
|
206
|
+
var styleConfigs = _constants.styles[this.parent.type] || [];
|
|
207
|
+
styleConfigs.map(function (style) {
|
|
208
|
+
_this2.tileStyleService.setConfig(style, _this2.getInitOptionValue(style));
|
|
209
|
+
});
|
|
210
|
+
this.tileStyleService.on('updateConfig', function (updateConfigs) {
|
|
211
|
+
updateConfigs.map(function (key) {
|
|
212
|
+
return _this2.updateStyle(key);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}, {
|
|
217
|
+
key: "updateAttribute",
|
|
218
|
+
value: function updateAttribute(style) {
|
|
219
|
+
var _this3 = this;
|
|
220
|
+
|
|
221
|
+
if (_constants.Attributes.includes(style)) {
|
|
222
|
+
var _this$parent$getAttri4;
|
|
223
|
+
|
|
224
|
+
var scaleValue = (_this$parent$getAttri4 = this.parent.getAttribute(style)) === null || _this$parent$getAttri4 === void 0 ? void 0 : _this$parent$getAttri4.scale;
|
|
225
|
+
|
|
226
|
+
if (!scaleValue) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
this.children.map(function (child) {
|
|
231
|
+
return (0, _utils2.setStyleAttributeField)(child, _this3.parent, style, scaleValue);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}, {
|
|
236
|
+
key: "updateStyle",
|
|
237
|
+
value: function updateStyle(style) {
|
|
238
|
+
var updateValue = null;
|
|
239
|
+
|
|
240
|
+
if (_constants.Attributes.includes(style)) {
|
|
241
|
+
this.updateAttribute(style);
|
|
242
|
+
} else {
|
|
243
|
+
var layerConfig = this.parent.getLayerConfig();
|
|
244
|
+
|
|
245
|
+
if (!(style in layerConfig)) {
|
|
246
|
+
return;
|
|
247
|
+
} // @ts-ignore
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
var config = layerConfig[style];
|
|
251
|
+
updateValue = config;
|
|
252
|
+
|
|
253
|
+
switch (style) {
|
|
254
|
+
case 'rampColors':
|
|
255
|
+
var texture = (0, _utils2.updateTexture)(config, this.children, this.rendererService);
|
|
256
|
+
this.initOptions.colorTexture = texture;
|
|
257
|
+
break;
|
|
258
|
+
|
|
259
|
+
default:
|
|
260
|
+
(0, _utils2.updateLayersConfig)(this.children, style, config);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
this.setInitOptionValue(style, updateValue);
|
|
265
|
+
}
|
|
266
|
+
}, {
|
|
267
|
+
key: "destroy",
|
|
268
|
+
value: function destroy() {
|
|
269
|
+
this.tilePickService.destroy();
|
|
270
|
+
}
|
|
271
|
+
}]);
|
|
272
|
+
return TileLayerManager;
|
|
273
|
+
}(_base.Base);
|
|
274
|
+
|
|
275
|
+
exports.TileLayerManager = TileLayerManager;
|