@antv/l7-layers 2.10.1 → 2.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/index.d.ts +2 -3
- package/es/Geometry/index.js +27 -17
- package/es/Geometry/models/billboard.d.ts +2 -2
- package/es/Geometry/models/billboard.js +77 -37
- package/es/Geometry/models/plane.d.ts +2 -2
- package/es/Geometry/models/plane.js +80 -40
- package/es/Geometry/models/sprite.d.ts +2 -2
- package/es/Geometry/models/sprite.js +83 -45
- package/es/canvas/index.d.ts +3 -4
- package/es/canvas/index.js +35 -24
- package/es/canvas/models/canvas.d.ts +2 -2
- package/es/canvas/models/canvas.js +54 -15
- package/es/citybuliding/building.d.ts +2 -3
- package/es/citybuliding/building.js +26 -17
- package/es/citybuliding/models/build.d.ts +2 -2
- package/es/citybuliding/models/build.js +70 -25
- package/es/core/BaseLayer.d.ts +21 -18
- package/es/core/BaseLayer.js +391 -261
- package/es/core/BaseModel.d.ts +2 -2
- package/es/core/BaseModel.js +47 -6
- package/es/core/LayerPickService.d.ts +9 -0
- package/es/core/LayerPickService.js +85 -0
- package/es/core/triangulation.js +8 -1
- package/es/earth/index.d.ts +3 -3
- package/es/earth/index.js +28 -9
- package/es/earth/models/atmosphere.d.ts +2 -2
- package/es/earth/models/atmosphere.js +67 -22
- package/es/earth/models/base.d.ts +2 -2
- package/es/earth/models/base.js +89 -43
- package/es/earth/models/bloomsphere.d.ts +2 -2
- package/es/earth/models/bloomsphere.js +67 -22
- package/es/heatmap/index.d.ts +2 -3
- package/es/heatmap/index.js +33 -22
- package/es/heatmap/models/grid.d.ts +2 -2
- package/es/heatmap/models/grid.js +68 -27
- package/es/heatmap/models/grid3d.d.ts +2 -2
- package/es/heatmap/models/grid3d.js +69 -28
- package/es/heatmap/models/heatmap.d.ts +2 -2
- package/es/heatmap/models/heatmap.js +40 -14
- package/es/heatmap/models/hexagon.d.ts +2 -2
- package/es/heatmap/models/hexagon.js +69 -28
- package/es/image/index.d.ts +2 -3
- package/es/image/index.js +27 -17
- package/es/image/models/dataImage.d.ts +2 -2
- package/es/image/models/dataImage.js +93 -54
- package/es/image/models/image.d.ts +2 -2
- package/es/image/models/image.js +108 -67
- package/es/image/models/tileDataImage.d.ts +2 -2
- package/es/image/models/tileDataImage.js +84 -43
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/line/index.d.ts +5 -4
- package/es/line/index.js +51 -25
- package/es/line/models/arc.d.ts +2 -2
- package/es/line/models/arc.js +73 -38
- package/es/line/models/arc_3d.d.ts +2 -2
- package/es/line/models/arc_3d.js +69 -34
- package/es/line/models/earthArc_3d.d.ts +2 -2
- package/es/line/models/earthArc_3d.js +72 -37
- package/es/line/models/great_circle.d.ts +2 -2
- package/es/line/models/great_circle.js +70 -29
- package/es/line/models/half.d.ts +2 -2
- package/es/line/models/half.js +40 -17
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +0 -2
- package/es/line/models/line.d.ts +2 -2
- package/es/line/models/line.js +79 -47
- package/es/line/models/linearline.d.ts +2 -2
- package/es/line/models/linearline.js +70 -31
- package/es/line/models/simpleLine.d.ts +2 -2
- package/es/line/models/simpleLine.js +71 -34
- package/es/line/models/simpleTileLine.d.ts +2 -2
- package/es/line/models/simpleTileLine.js +70 -30
- package/es/line/models/tile.d.ts +2 -2
- package/es/line/models/tile.js +40 -17
- package/es/line/models/wall.d.ts +2 -2
- package/es/line/models/wall.js +67 -22
- package/es/mask/index.d.ts +2 -4
- package/es/mask/index.js +27 -97
- package/es/mask/models/fill.d.ts +2 -2
- package/es/mask/models/fill.js +40 -16
- package/es/mask/models/index.d.ts +1 -1
- package/es/mask/models/index.js +1 -3
- package/es/plugins/DataMappingPlugin.js +80 -66
- package/es/plugins/DataSourcePlugin.js +64 -25
- package/es/plugins/FeatureScalePlugin.js +84 -44
- package/es/plugins/LayerAnimateStylePlugin.js +6 -3
- package/es/plugins/LayerModelPlugin.d.ts +2 -2
- package/es/plugins/LayerModelPlugin.js +124 -37
- package/es/plugins/LayerStylePlugin.js +1 -6
- package/es/plugins/MultiPassRendererPlugin.js +1 -1
- package/es/plugins/PixelPickingPlugin.js +1 -1
- package/es/plugins/RegisterStyleAttributePlugin.js +4 -17
- package/es/plugins/ShaderUniformPlugin.js +7 -2
- package/es/plugins/UpdateStyleAttributePlugin.js +8 -5
- package/es/point/index.d.ts +4 -4
- package/es/point/index.js +55 -23
- package/es/point/models/earthExtrude.d.ts +2 -2
- package/es/point/models/earthExtrude.js +73 -30
- package/es/point/models/earthFill.d.ts +2 -2
- package/es/point/models/earthFill.js +66 -21
- package/es/point/models/extrude.d.ts +2 -2
- package/es/point/models/extrude.js +40 -17
- package/es/point/models/fill.d.ts +2 -2
- package/es/point/models/fill.js +43 -20
- package/es/point/models/fillmage.d.ts +2 -2
- package/es/point/models/fillmage.js +82 -43
- package/es/point/models/image.d.ts +2 -2
- package/es/point/models/image.js +72 -31
- package/es/point/models/index.d.ts +1 -1
- package/es/point/models/index.js +0 -2
- package/es/point/models/normal.d.ts +2 -2
- package/es/point/models/normal.js +71 -30
- package/es/point/models/radar.d.ts +2 -2
- package/es/point/models/radar.js +75 -35
- package/es/point/models/simplePoint.d.ts +2 -2
- package/es/point/models/simplePoint.js +70 -29
- package/es/point/models/text.d.ts +3 -2
- package/es/point/models/text.js +164 -107
- package/es/point/models/tile.d.ts +2 -2
- package/es/point/models/tile.js +77 -35
- package/es/point/models/tileText.d.ts +2 -2
- package/es/point/models/tileText.js +151 -116
- package/es/polygon/index.d.ts +2 -3
- package/es/polygon/index.js +27 -24
- package/es/polygon/models/extrude.d.ts +2 -2
- package/es/polygon/models/extrude.js +66 -29
- package/es/polygon/models/fill.d.ts +2 -2
- package/es/polygon/models/fill.js +76 -43
- package/es/polygon/models/index.d.ts +1 -1
- package/es/polygon/models/index.js +0 -2
- package/es/polygon/models/ocean.d.ts +2 -2
- package/es/polygon/models/ocean.js +69 -28
- package/es/polygon/models/tile.d.ts +2 -2
- package/es/polygon/models/tile.js +70 -30
- package/es/polygon/models/water.d.ts +2 -2
- package/es/polygon/models/water.js +69 -28
- package/es/raster/index.d.ts +3 -4
- package/es/raster/index.js +28 -22
- package/es/raster/models/index.d.ts +1 -1
- package/es/raster/models/index.js +1 -3
- package/es/raster/models/raster.d.ts +2 -2
- package/es/raster/models/raster.js +36 -13
- package/es/raster/models/rasterRgb.d.ts +2 -2
- package/es/raster/models/rasterRgb.js +36 -13
- package/es/raster/models/rasterTile.d.ts +2 -2
- package/es/raster/models/rasterTile.js +77 -36
- package/es/raster/raster.d.ts +1 -1
- package/es/raster/raster.js +42 -22
- package/es/tile/interaction/getRasterData.d.ts +2 -2
- package/es/tile/interaction/utils.js +3 -11
- package/es/tile/interface.d.ts +5 -4
- package/es/tile/manager/base.d.ts +17 -12
- package/es/tile/manager/base.js +212 -47
- package/es/tile/service/TileLayerService.d.ts +33 -0
- package/es/tile/service/TileLayerService.js +172 -0
- package/es/tile/service/TilePickService.d.ts +22 -0
- package/es/tile/service/TilePickService.js +124 -0
- package/es/tile/style/constants.d.ts +1 -13
- package/es/tile/style/constants.js +6 -15
- package/es/tile/style/utils.d.ts +1 -8
- package/es/tile/style/utils.js +0 -126
- package/es/tile/tileFactory/DebugTile.d.ts +16 -0
- package/es/tile/tileFactory/DebugTile.js +100 -0
- package/es/tile/tileFactory/ImageTile.d.ts +14 -0
- package/es/tile/tileFactory/ImageTile.js +89 -0
- package/es/tile/tileFactory/MaskTile.d.ts +17 -0
- package/es/tile/tileFactory/MaskTile.js +98 -0
- package/es/tile/tileFactory/RasterRGBTile.d.ts +16 -0
- package/es/tile/tileFactory/RasterRGBTile.js +91 -0
- package/es/tile/tileFactory/RasterTile.d.ts +27 -0
- package/es/tile/tileFactory/RasterTile.js +186 -0
- package/es/tile/tileFactory/Tile.d.ts +23 -0
- package/es/tile/tileFactory/Tile.js +136 -0
- package/es/tile/tileFactory/VectorTile.d.ts +20 -0
- package/es/tile/tileFactory/VectorTile.js +158 -0
- package/es/tile/tileFactory/index.d.ts +10 -4
- package/es/tile/tileFactory/index.js +30 -23
- package/es/tile/tileFactory/layers/{rasterDataLayer.d.ts → RasterDataLayer.d.ts} +3 -3
- package/es/tile/tileFactory/layers/{rasterDataLayer.js → RasterDataLayer.js} +33 -21
- package/es/tile/tileFactory/layers/{tileTest.d.ts → TileDebugLayer.d.ts} +2 -2
- package/es/tile/tileFactory/layers/{tileTest.js → TileDebugLayer.js} +23 -10
- package/es/tile/tileFactory/util.d.ts +6 -0
- package/es/tile/tileFactory/util.js +33 -0
- package/es/tile/tileLayer/BaseLayer.d.ts +46 -0
- package/es/tile/tileLayer/BaseLayer.js +358 -0
- package/es/tile/utils.d.ts +1 -11
- package/es/tile/utils.js +0 -127
- package/es/utils/dataMappingStyle.d.ts +4 -4
- package/es/utils/dataMappingStyle.js +19 -19
- package/es/utils/layerData.js +5 -11
- package/es/wind/index.d.ts +2 -3
- package/es/wind/index.js +27 -17
- package/es/wind/models/wind.d.ts +2 -2
- package/es/wind/models/wind.js +120 -104
- package/lib/Geometry/index.js +29 -17
- package/lib/Geometry/models/billboard.js +79 -37
- package/lib/Geometry/models/plane.js +82 -40
- package/lib/Geometry/models/sprite.js +85 -45
- package/lib/canvas/index.js +37 -24
- package/lib/canvas/models/canvas.js +56 -15
- package/lib/citybuliding/building.js +28 -17
- package/lib/citybuliding/models/build.js +72 -25
- package/lib/core/BaseLayer.js +391 -256
- package/lib/core/BaseModel.js +48 -6
- package/lib/core/LayerPickService.js +96 -0
- package/lib/core/triangulation.js +8 -1
- package/lib/earth/index.js +30 -9
- package/lib/earth/models/atmosphere.js +69 -22
- package/lib/earth/models/base.js +90 -42
- package/lib/earth/models/bloomsphere.js +69 -22
- package/lib/heatmap/index.js +35 -22
- package/lib/heatmap/models/grid.js +70 -27
- package/lib/heatmap/models/grid3d.js +71 -28
- package/lib/heatmap/models/heatmap.js +40 -14
- package/lib/heatmap/models/hexagon.js +71 -28
- package/lib/image/index.js +29 -17
- package/lib/image/models/dataImage.js +95 -54
- package/lib/image/models/image.js +110 -67
- package/lib/image/models/tileDataImage.js +86 -43
- package/lib/index.js +5 -5
- package/lib/line/index.js +53 -26
- package/lib/line/models/arc.js +75 -38
- package/lib/line/models/arc_3d.js +71 -34
- package/lib/line/models/earthArc_3d.js +74 -37
- package/lib/line/models/great_circle.js +72 -29
- package/lib/line/models/half.js +40 -17
- package/lib/line/models/index.js +0 -3
- package/lib/line/models/line.js +81 -47
- package/lib/line/models/linearline.js +72 -31
- package/lib/line/models/simpleLine.js +73 -34
- package/lib/line/models/simpleTileLine.js +72 -30
- package/lib/line/models/tile.js +40 -17
- package/lib/line/models/wall.js +69 -22
- package/lib/mask/index.js +28 -99
- package/lib/mask/models/fill.js +40 -16
- package/lib/mask/models/index.js +1 -4
- package/lib/plugins/DataMappingPlugin.js +81 -65
- package/lib/plugins/DataSourcePlugin.js +71 -30
- package/lib/plugins/FeatureScalePlugin.js +86 -44
- package/lib/plugins/LayerAnimateStylePlugin.js +6 -3
- package/lib/plugins/LayerModelPlugin.js +131 -41
- package/lib/plugins/LayerStylePlugin.js +1 -6
- package/lib/plugins/MultiPassRendererPlugin.js +1 -1
- package/lib/plugins/PixelPickingPlugin.js +1 -1
- package/lib/plugins/RegisterStyleAttributePlugin.js +4 -17
- package/lib/plugins/ShaderUniformPlugin.js +7 -2
- package/lib/plugins/UpdateStyleAttributePlugin.js +8 -5
- package/lib/point/index.js +56 -24
- package/lib/point/models/earthExtrude.js +75 -30
- package/lib/point/models/earthFill.js +68 -21
- package/lib/point/models/extrude.js +40 -17
- package/lib/point/models/fill.js +44 -21
- package/lib/point/models/fillmage.js +84 -43
- package/lib/point/models/image.js +74 -31
- package/lib/point/models/index.js +0 -3
- package/lib/point/models/normal.js +73 -30
- package/lib/point/models/radar.js +77 -35
- package/lib/point/models/simplePoint.js +72 -29
- package/lib/point/models/text.js +164 -106
- package/lib/point/models/tile.js +79 -35
- package/lib/point/models/tileText.js +151 -115
- package/lib/polygon/index.js +29 -25
- package/lib/polygon/models/extrude.js +68 -29
- package/lib/polygon/models/fill.js +78 -43
- package/lib/polygon/models/index.js +0 -3
- package/lib/polygon/models/ocean.js +71 -28
- package/lib/polygon/models/tile.js +72 -30
- package/lib/polygon/models/water.js +71 -28
- package/lib/raster/index.js +30 -22
- package/lib/raster/models/index.js +1 -4
- package/lib/raster/models/raster.js +36 -13
- package/lib/raster/models/rasterRgb.js +36 -13
- package/lib/raster/models/rasterTile.js +79 -36
- package/lib/raster/raster.js +44 -22
- package/lib/tile/interaction/utils.js +3 -11
- package/lib/tile/manager/base.js +213 -47
- package/lib/tile/service/TileLayerService.js +185 -0
- package/lib/tile/service/TilePickService.js +136 -0
- package/lib/tile/style/constants.js +8 -19
- package/lib/tile/style/utils.js +0 -140
- package/lib/tile/tileFactory/DebugTile.js +115 -0
- package/lib/tile/tileFactory/ImageTile.js +104 -0
- package/lib/tile/tileFactory/MaskTile.js +113 -0
- package/lib/tile/tileFactory/RasterRGBTile.js +106 -0
- package/lib/tile/tileFactory/RasterTile.js +205 -0
- package/lib/tile/tileFactory/Tile.js +146 -0
- package/lib/tile/tileFactory/VectorTile.js +173 -0
- package/lib/tile/tileFactory/index.js +42 -24
- package/lib/tile/tileFactory/layers/{rasterDataLayer.js → RasterDataLayer.js} +35 -21
- package/lib/tile/tileFactory/layers/{tileTest.js → TileDebugLayer.js} +24 -11
- package/lib/tile/tileFactory/util.js +48 -0
- package/lib/tile/tileLayer/BaseLayer.js +373 -0
- package/lib/tile/utils.js +0 -146
- package/lib/utils/dataMappingStyle.js +21 -21
- package/lib/utils/layerData.js +4 -10
- package/lib/wind/index.js +29 -17
- package/lib/wind/models/wind.js +122 -104
- package/package.json +7 -7
- package/es/tile/interaction/TilePickService.d.ts +0 -16
- package/es/tile/interaction/TilePickService.js +0 -129
- package/es/tile/manager/layerManager.d.ts +0 -19
- package/es/tile/manager/layerManager.js +0 -254
- package/es/tile/manager/mapLayerManager.d.ts +0 -7
- package/es/tile/manager/mapLayerManager.js +0 -119
- package/es/tile/models/tileModel.d.ts +0 -10
- package/es/tile/models/tileModel.js +0 -81
- package/es/tile/render/TileRenderService.d.ts +0 -10
- package/es/tile/render/TileRenderService.js +0 -68
- package/es/tile/style/TileStyleService.d.ts +0 -17
- package/es/tile/style/TileStyleService.js +0 -118
- package/es/tile/tileFactory/base.d.ts +0 -45
- package/es/tile/tileFactory/base.js +0 -403
- package/es/tile/tileFactory/layers/vectorLayer.d.ts +0 -30
- package/es/tile/tileFactory/layers/vectorLayer.js +0 -253
- package/es/tile/tileFactory/line.d.ts +0 -12
- package/es/tile/tileFactory/line.js +0 -59
- package/es/tile/tileFactory/mask.d.ts +0 -12
- package/es/tile/tileFactory/mask.js +0 -60
- package/es/tile/tileFactory/point.d.ts +0 -12
- package/es/tile/tileFactory/point.js +0 -60
- package/es/tile/tileFactory/polygon.d.ts +0 -12
- package/es/tile/tileFactory/polygon.js +0 -59
- package/es/tile/tileFactory/raster.d.ts +0 -12
- package/es/tile/tileFactory/raster.js +0 -55
- package/es/tile/tileFactory/rasterData.d.ts +0 -12
- package/es/tile/tileFactory/rasterData.js +0 -81
- package/es/tile/tileFactory/test.d.ts +0 -12
- package/es/tile/tileFactory/test.js +0 -94
- package/es/tile/tileLayer/MapTileLayer.d.ts +0 -6
- package/es/tile/tileLayer/MapTileLayer.js +0 -48
- package/es/tile/tileLayer/TileLayer.d.ts +0 -22
- package/es/tile/tileLayer/TileLayer.js +0 -198
- package/es/tile/tileLayer/base.d.ts +0 -33
- package/es/tile/tileLayer/base.js +0 -212
- package/lib/tile/interaction/TilePickService.js +0 -143
- package/lib/tile/manager/layerManager.js +0 -275
- package/lib/tile/manager/mapLayerManager.js +0 -134
- package/lib/tile/models/tileModel.js +0 -94
- package/lib/tile/render/TileRenderService.js +0 -78
- package/lib/tile/style/TileStyleService.js +0 -133
- package/lib/tile/tileFactory/base.js +0 -427
- package/lib/tile/tileFactory/layers/vectorLayer.js +0 -268
- package/lib/tile/tileFactory/line.js +0 -70
- package/lib/tile/tileFactory/mask.js +0 -71
- package/lib/tile/tileFactory/point.js +0 -71
- package/lib/tile/tileFactory/polygon.js +0 -70
- package/lib/tile/tileFactory/raster.js +0 -68
- package/lib/tile/tileFactory/rasterData.js +0 -93
- package/lib/tile/tileFactory/test.js +0 -106
- package/lib/tile/tileLayer/MapTileLayer.js +0 -63
- package/lib/tile/tileLayer/TileLayer.js +0 -215
- package/lib/tile/tileLayer/base.js +0 -225
package/lib/core/BaseLayer.js
CHANGED
|
@@ -7,12 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
|
|
10
12
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
13
|
|
|
12
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
15
|
|
|
14
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
16
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
17
17
|
|
|
18
18
|
var _initializerDefineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerDefineProperty"));
|
|
@@ -57,6 +57,8 @@ var _multiPassRender = require("../utils/multiPassRender");
|
|
|
57
57
|
|
|
58
58
|
var _updateShape = require("../utils/updateShape");
|
|
59
59
|
|
|
60
|
+
var _LayerPickService = _interopRequireDefault(require("./LayerPickService"));
|
|
61
|
+
|
|
60
62
|
var _excluded = ["passes"],
|
|
61
63
|
_excluded2 = ["moduleName", "vertexShader", "fragmentShader", "triangulation", "segmentNumber", "workerEnabled", "workerOptions"];
|
|
62
64
|
|
|
@@ -84,12 +86,10 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
84
86
|
// 生命周期钩子
|
|
85
87
|
// 待渲染 model 列表
|
|
86
88
|
// 用于保存子图层对象
|
|
87
|
-
// Tip: 用于标识矢量图层
|
|
88
89
|
|
|
89
90
|
/**
|
|
90
91
|
* 待更新样式属性,在初始化阶段完成注册
|
|
91
92
|
*/
|
|
92
|
-
// Tip: layer 保底颜色
|
|
93
93
|
// private pickingPassRender: IPass<'pixelPicking'>;
|
|
94
94
|
function BaseLayer() {
|
|
95
95
|
var _this;
|
|
@@ -124,10 +124,10 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
124
124
|
StyleAttrNeedUpdate: false
|
|
125
125
|
});
|
|
126
126
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hooks", {
|
|
127
|
-
init: new _asyncHook.
|
|
127
|
+
init: new _asyncHook.AsyncSeriesBailHook(),
|
|
128
128
|
afterInit: new _asyncHook.SyncBailHook(),
|
|
129
129
|
beforeRender: new _asyncHook.SyncBailHook(),
|
|
130
|
-
beforeRenderData: new _asyncHook.
|
|
130
|
+
beforeRenderData: new _asyncHook.AsyncWaterfallHook(),
|
|
131
131
|
afterRender: new _asyncHook.SyncHook(),
|
|
132
132
|
beforePickingEncode: new _asyncHook.SyncHook(),
|
|
133
133
|
afterPickingEncode: new _asyncHook.SyncHook(),
|
|
@@ -139,10 +139,9 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
139
139
|
afterDestroy: new _asyncHook.SyncHook()
|
|
140
140
|
});
|
|
141
141
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "models", []);
|
|
142
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
142
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "startInit", false);
|
|
143
143
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "layerChildren", []);
|
|
144
144
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "masks", []);
|
|
145
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isVector", false);
|
|
146
145
|
(0, _initializerDefineProperty2.default)((0, _assertThisInitialized2.default)(_this), "configService", _descriptor, (0, _assertThisInitialized2.default)(_this));
|
|
147
146
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "animateOptions", {
|
|
148
147
|
enable: false
|
|
@@ -151,7 +150,6 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
151
150
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "pendingStyleAttributes", []);
|
|
152
151
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scaleOptions", {});
|
|
153
152
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "animateStatus", false);
|
|
154
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "bottomColor", 'rgba(0, 0, 0, 0)');
|
|
155
153
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isDestroyed", false);
|
|
156
154
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "encodeDataLength", 0);
|
|
157
155
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sourceEvent", function () {
|
|
@@ -163,11 +161,16 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
163
161
|
_this.fitBounds(layerConfig.fitBoundsOptions);
|
|
164
162
|
}
|
|
165
163
|
|
|
166
|
-
_this.
|
|
164
|
+
var autoRender = _this.layerSource.getSourceCfg().autoRender;
|
|
165
|
+
|
|
166
|
+
if (autoRender) {
|
|
167
|
+
_this.reRender();
|
|
168
|
+
}
|
|
167
169
|
});
|
|
168
170
|
_this.name = config.name || _this.id;
|
|
169
171
|
_this.zIndex = config.zIndex || 0;
|
|
170
|
-
_this.rawConfig = config;
|
|
172
|
+
_this.rawConfig = config; // this.parent = this;
|
|
173
|
+
|
|
171
174
|
return _this;
|
|
172
175
|
}
|
|
173
176
|
|
|
@@ -210,12 +213,12 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
210
213
|
}
|
|
211
214
|
});
|
|
212
215
|
|
|
213
|
-
if (!this.
|
|
216
|
+
if (!this.startInit) {
|
|
214
217
|
this.needUpdateConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.needUpdateConfig), configToUpdate);
|
|
215
218
|
} else {
|
|
216
219
|
var sceneId = this.container.get(_l7Core.TYPES.SceneID); // @ts-ignore
|
|
217
220
|
|
|
218
|
-
(0, _dataMappingStyle.
|
|
221
|
+
(0, _dataMappingStyle.styleDataMapping)(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
|
|
219
222
|
|
|
220
223
|
this.configService.setLayerConfig(sceneId, this.id, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.configService.getLayerConfig(this.id)), this.needUpdateConfig), configToUpdate));
|
|
221
224
|
this.needUpdateConfig = {};
|
|
@@ -239,16 +242,6 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
239
242
|
value: function getContainer() {
|
|
240
243
|
return this.container;
|
|
241
244
|
}
|
|
242
|
-
}, {
|
|
243
|
-
key: "setBottomColor",
|
|
244
|
-
value: function setBottomColor(color) {
|
|
245
|
-
this.bottomColor = color;
|
|
246
|
-
}
|
|
247
|
-
}, {
|
|
248
|
-
key: "getBottomColor",
|
|
249
|
-
value: function getBottomColor() {
|
|
250
|
-
return this.bottomColor;
|
|
251
|
-
}
|
|
252
245
|
}, {
|
|
253
246
|
key: "addPlugin",
|
|
254
247
|
value: function addPlugin(plugin) {
|
|
@@ -257,105 +250,131 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
257
250
|
}
|
|
258
251
|
}, {
|
|
259
252
|
key: "init",
|
|
260
|
-
value: function
|
|
261
|
-
var
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
253
|
+
value: function () {
|
|
254
|
+
var _init = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
255
|
+
var _this3 = this;
|
|
256
|
+
|
|
257
|
+
var sceneId, _this$getLayerConfig, enableMultiPassRenderer, passes, _iterator, _step, plugin;
|
|
258
|
+
|
|
259
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
260
|
+
while (1) {
|
|
261
|
+
switch (_context.prev = _context.next) {
|
|
262
|
+
case 0:
|
|
263
|
+
// 设置配置项
|
|
264
|
+
sceneId = this.container.get(_l7Core.TYPES.SceneID);
|
|
265
|
+
this.startInit = true; // 初始化图层配置项
|
|
266
|
+
// const { enableMultiPassRenderer = false } = this.rawConfig;
|
|
267
|
+
// this.configService.setLayerConfig(sceneId, this.id, {
|
|
268
|
+
// enableMultiPassRenderer,
|
|
269
|
+
// });
|
|
270
|
+
|
|
271
|
+
this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);
|
|
272
|
+
this.layerType = this.rawConfig.layerType; // 全局容器服务
|
|
273
|
+
// 场景容器服务
|
|
274
|
+
|
|
275
|
+
this.iconService = this.container.get(_l7Core.TYPES.IIconService);
|
|
276
|
+
this.fontService = this.container.get(_l7Core.TYPES.IFontService);
|
|
277
|
+
this.rendererService = this.container.get(_l7Core.TYPES.IRendererService);
|
|
278
|
+
this.layerService = this.container.get(_l7Core.TYPES.ILayerService);
|
|
279
|
+
this.interactionService = this.container.get(_l7Core.TYPES.IInteractionService);
|
|
280
|
+
this.pickingService = this.container.get(_l7Core.TYPES.IPickingService);
|
|
281
|
+
this.mapService = this.container.get(_l7Core.TYPES.IMapService);
|
|
282
|
+
_this$getLayerConfig = this.getLayerConfig(), enableMultiPassRenderer = _this$getLayerConfig.enableMultiPassRenderer, passes = _this$getLayerConfig.passes;
|
|
283
|
+
|
|
284
|
+
if (enableMultiPassRenderer && passes !== null && passes !== void 0 && passes.length && passes.length > 0) {
|
|
285
|
+
// Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom
|
|
286
|
+
this.mapService.on('mapAfterFrameChange', function () {
|
|
287
|
+
_this3.renderLayers();
|
|
288
|
+
});
|
|
289
|
+
}
|
|
292
290
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
291
|
+
this.cameraService = this.container.get(_l7Core.TYPES.ICameraService);
|
|
292
|
+
this.coordinateService = this.container.get(_l7Core.TYPES.ICoordinateSystemService);
|
|
293
|
+
this.shaderModuleService = this.container.get(_l7Core.TYPES.IShaderModuleService);
|
|
294
|
+
this.postProcessingPassFactory = this.container.get(_l7Core.TYPES.IFactoryPostProcessingPass);
|
|
295
|
+
this.normalPassFactory = this.container.get(_l7Core.TYPES.IFactoryNormalPass); // 图层容器服务
|
|
296
|
+
|
|
297
|
+
this.styleAttributeService = this.container.get(_l7Core.TYPES.IStyleAttributeService);
|
|
298
|
+
|
|
299
|
+
if (enableMultiPassRenderer) {
|
|
300
|
+
// 按需初始化 瓦片频繁报错
|
|
301
|
+
this.multiPassRenderer = this.container.get(_l7Core.TYPES.IMultiPassRenderer);
|
|
302
|
+
this.multiPassRenderer.setLayer(this);
|
|
303
|
+
} // 完成样式服务注册完成前添加的属性
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
this.pendingStyleAttributes.forEach(function (_ref2) {
|
|
307
|
+
var attributeName = _ref2.attributeName,
|
|
308
|
+
attributeField = _ref2.attributeField,
|
|
309
|
+
attributeValues = _ref2.attributeValues,
|
|
310
|
+
updateOptions = _ref2.updateOptions;
|
|
311
|
+
|
|
312
|
+
_this3.styleAttributeService.updateStyleAttribute(attributeName, {
|
|
313
|
+
// @ts-ignore
|
|
314
|
+
scale: (0, _objectSpread2.default)({
|
|
315
|
+
field: attributeField
|
|
316
|
+
}, _this3.splitValuesAndCallbackInAttribute( // @ts-ignore
|
|
317
|
+
attributeValues, // @ts-ignore
|
|
318
|
+
_this3.getLayerConfig()[attributeName]))
|
|
319
|
+
}, // @ts-ignore
|
|
320
|
+
updateOptions);
|
|
321
|
+
});
|
|
322
|
+
this.pendingStyleAttributes = []; // 获取插件集
|
|
323
|
+
|
|
324
|
+
this.plugins = this.container.getAll(_l7Core.TYPES.ILayerPlugin); // 完成插件注册,传入场景和图层容器内的服务
|
|
325
|
+
|
|
326
|
+
_iterator = _createForOfIteratorHelper(this.plugins);
|
|
327
|
+
|
|
328
|
+
try {
|
|
329
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
330
|
+
plugin = _step.value;
|
|
331
|
+
plugin.apply(this, {
|
|
332
|
+
rendererService: this.rendererService,
|
|
333
|
+
mapService: this.mapService,
|
|
334
|
+
styleAttributeService: this.styleAttributeService,
|
|
335
|
+
normalPassFactory: this.normalPassFactory,
|
|
336
|
+
postProcessingPassFactory: this.postProcessingPassFactory
|
|
337
|
+
});
|
|
338
|
+
} // 初始化其他服务
|
|
339
|
+
|
|
340
|
+
} catch (err) {
|
|
341
|
+
_iterator.e(err);
|
|
342
|
+
} finally {
|
|
343
|
+
_iterator.f();
|
|
344
|
+
}
|
|
298
345
|
|
|
299
|
-
|
|
300
|
-
this.multiPassRenderer = this.container.get(_l7Core.TYPES.IMultiPassRenderer);
|
|
301
|
-
this.multiPassRenderer.setLayer(this); // 完成样式服务注册完成前添加的属性
|
|
346
|
+
this.layerPickService = new _LayerPickService.default(this); // 触发 init 生命周期插件
|
|
302
347
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
attributeField = _ref2.attributeField,
|
|
306
|
-
attributeValues = _ref2.attributeValues,
|
|
307
|
-
updateOptions = _ref2.updateOptions;
|
|
348
|
+
_context.next = 28;
|
|
349
|
+
return this.hooks.init.promise();
|
|
308
350
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
scale: (0, _objectSpread2.default)({
|
|
312
|
-
field: attributeField
|
|
313
|
-
}, _this3.splitValuesAndCallbackInAttribute( // @ts-ignore
|
|
314
|
-
attributeValues, // @ts-ignore
|
|
315
|
-
_this3.getLayerConfig()[attributeName]))
|
|
316
|
-
}, // @ts-ignore
|
|
317
|
-
updateOptions);
|
|
318
|
-
});
|
|
319
|
-
this.pendingStyleAttributes = []; // 获取插件集
|
|
320
|
-
|
|
321
|
-
this.plugins = this.container.getAll(_l7Core.TYPES.ILayerPlugin); // 完成插件注册,传入场景和图层容器内的服务
|
|
322
|
-
|
|
323
|
-
var _iterator = _createForOfIteratorHelper(this.plugins),
|
|
324
|
-
_step;
|
|
325
|
-
|
|
326
|
-
try {
|
|
327
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
328
|
-
var plugin = _step.value;
|
|
329
|
-
plugin.apply(this, {
|
|
330
|
-
rendererService: this.rendererService,
|
|
331
|
-
mapService: this.mapService,
|
|
332
|
-
styleAttributeService: this.styleAttributeService,
|
|
333
|
-
normalPassFactory: this.normalPassFactory,
|
|
334
|
-
postProcessingPassFactory: this.postProcessingPassFactory
|
|
335
|
-
});
|
|
336
|
-
} // 触发 init 生命周期插件
|
|
337
|
-
|
|
338
|
-
} catch (err) {
|
|
339
|
-
_iterator.e(err);
|
|
340
|
-
} finally {
|
|
341
|
-
_iterator.f();
|
|
342
|
-
}
|
|
351
|
+
case 28:
|
|
352
|
+
this.inited = true; // 触发初始化完成事件;
|
|
343
353
|
|
|
344
|
-
|
|
345
|
-
|
|
354
|
+
this.emit('inited', {
|
|
355
|
+
target: this,
|
|
356
|
+
type: 'inited'
|
|
357
|
+
});
|
|
358
|
+
this.emit('add', {
|
|
359
|
+
target: this,
|
|
360
|
+
type: 'add'
|
|
361
|
+
});
|
|
362
|
+
this.hooks.afterInit.call();
|
|
346
363
|
|
|
347
|
-
|
|
364
|
+
case 32:
|
|
365
|
+
case "end":
|
|
366
|
+
return _context.stop();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}, _callee, this);
|
|
370
|
+
}));
|
|
348
371
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
type: 'add'
|
|
356
|
-
});
|
|
357
|
-
return this;
|
|
358
|
-
}
|
|
372
|
+
function init() {
|
|
373
|
+
return _init.apply(this, arguments);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return init;
|
|
377
|
+
}()
|
|
359
378
|
}, {
|
|
360
379
|
key: "updateModelData",
|
|
361
380
|
value: function updateModelData(data) {
|
|
@@ -389,6 +408,11 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
389
408
|
};
|
|
390
409
|
}
|
|
391
410
|
}
|
|
411
|
+
}, {
|
|
412
|
+
key: "setLayerPickService",
|
|
413
|
+
value: function setLayerPickService(layerPickService) {
|
|
414
|
+
this.layerPickService = layerPickService;
|
|
415
|
+
}
|
|
392
416
|
}, {
|
|
393
417
|
key: "calculateEncodeData",
|
|
394
418
|
value: function calculateEncodeData(data, option) {
|
|
@@ -406,8 +430,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
406
430
|
}, {
|
|
407
431
|
key: "prepareBuildModel",
|
|
408
432
|
value: function prepareBuildModel() {
|
|
409
|
-
this.
|
|
410
|
-
this.updateLayerConfig((0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.getDefaultConfig()), this.rawConfig)); // 启动动画
|
|
433
|
+
this.updateLayerConfig((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.getDefaultConfig()), this.rawConfig), this.needUpdateConfig)); // 启动动画
|
|
411
434
|
|
|
412
435
|
var _this$getLayerConfig2 = this.getLayerConfig(),
|
|
413
436
|
animateOption = _this$getLayerConfig2.animateOption;
|
|
@@ -503,7 +526,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
503
526
|
// 判断是否为source
|
|
504
527
|
this.setSource(data);
|
|
505
528
|
return this;
|
|
506
|
-
}
|
|
529
|
+
} // 设置source 配置
|
|
530
|
+
|
|
507
531
|
|
|
508
532
|
this.sourceOption = {
|
|
509
533
|
data: data,
|
|
@@ -526,8 +550,6 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
526
550
|
if (!currentSource) {
|
|
527
551
|
// 执行 setData 的时候 source 还不存在(还未执行 addLayer)
|
|
528
552
|
_this4.source(new _l7Source.default(data, options));
|
|
529
|
-
|
|
530
|
-
_this4.sourceEvent();
|
|
531
553
|
} else {
|
|
532
554
|
_this4.layerSource.setData(data, options);
|
|
533
555
|
} // this.layerSource.setData(data, options);
|
|
@@ -542,7 +564,6 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
542
564
|
value: function style(options) {
|
|
543
565
|
var _this5 = this;
|
|
544
566
|
|
|
545
|
-
var lastConfig = this.getLayerConfig();
|
|
546
567
|
var passes = options.passes,
|
|
547
568
|
rest = (0, _objectWithoutProperties2.default)(options, _excluded); // passes 特殊处理
|
|
548
569
|
|
|
@@ -561,15 +582,15 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
561
582
|
if (this.container) {
|
|
562
583
|
this.updateLayerConfig(this.rawConfig);
|
|
563
584
|
this.styleNeedUpdate = true;
|
|
564
|
-
} //
|
|
565
|
-
|
|
585
|
+
} // TODO style model 更新
|
|
586
|
+
// @ts-ignore
|
|
587
|
+
// if (lastConfig && lastConfig.mask === true && options.mask === false) {
|
|
588
|
+
// this.clearModels();
|
|
589
|
+
// this.layerModel.buildModels((models) => {
|
|
590
|
+
// this.models = models;
|
|
591
|
+
// });
|
|
592
|
+
// }
|
|
566
593
|
|
|
567
|
-
if (lastConfig && lastConfig.mask === true && options.mask === false) {
|
|
568
|
-
this.clearModels();
|
|
569
|
-
this.layerModel.buildModels(function (models) {
|
|
570
|
-
_this5.models = models;
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
594
|
|
|
574
595
|
return this;
|
|
575
596
|
}
|
|
@@ -604,7 +625,10 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
604
625
|
return this;
|
|
605
626
|
}
|
|
606
627
|
|
|
607
|
-
if (this.encodeDataLength <= 0 && !this.forceRender)
|
|
628
|
+
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
629
|
+
return this;
|
|
630
|
+
} // Tip: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
631
|
+
|
|
608
632
|
|
|
609
633
|
this.renderModels();
|
|
610
634
|
return this;
|
|
@@ -616,29 +640,29 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
616
640
|
}, {
|
|
617
641
|
key: "renderMultiPass",
|
|
618
642
|
value: function () {
|
|
619
|
-
var _renderMultiPass = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
620
|
-
return _regenerator.default.wrap(function
|
|
643
|
+
var _renderMultiPass = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
644
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
621
645
|
while (1) {
|
|
622
|
-
switch (
|
|
646
|
+
switch (_context2.prev = _context2.next) {
|
|
623
647
|
case 0:
|
|
624
648
|
if (!(this.encodeDataLength <= 0 && !this.forceRender)) {
|
|
625
|
-
|
|
649
|
+
_context2.next = 2;
|
|
626
650
|
break;
|
|
627
651
|
}
|
|
628
652
|
|
|
629
|
-
return
|
|
653
|
+
return _context2.abrupt("return");
|
|
630
654
|
|
|
631
655
|
case 2:
|
|
632
656
|
if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
|
|
633
|
-
|
|
657
|
+
_context2.next = 7;
|
|
634
658
|
break;
|
|
635
659
|
}
|
|
636
660
|
|
|
637
|
-
|
|
661
|
+
_context2.next = 5;
|
|
638
662
|
return this.multiPassRenderer.render();
|
|
639
663
|
|
|
640
664
|
case 5:
|
|
641
|
-
|
|
665
|
+
_context2.next = 8;
|
|
642
666
|
break;
|
|
643
667
|
|
|
644
668
|
case 7:
|
|
@@ -651,10 +675,10 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
651
675
|
|
|
652
676
|
case 8:
|
|
653
677
|
case "end":
|
|
654
|
-
return
|
|
678
|
+
return _context2.stop();
|
|
655
679
|
}
|
|
656
680
|
}
|
|
657
|
-
},
|
|
681
|
+
}, _callee2, this);
|
|
658
682
|
}));
|
|
659
683
|
|
|
660
684
|
function renderMultiPass() {
|
|
@@ -1018,13 +1042,14 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1018
1042
|
return !!(this.styleAttributeService.getLayerStyleAttributes() || []).filter(function (attribute) {
|
|
1019
1043
|
return attribute.needRescale || attribute.needRemapping || attribute.needRegenerateVertices;
|
|
1020
1044
|
}).length;
|
|
1021
|
-
}
|
|
1045
|
+
} // 外部初始化Source
|
|
1046
|
+
|
|
1022
1047
|
}, {
|
|
1023
1048
|
key: "setSource",
|
|
1024
1049
|
value: function setSource(source) {
|
|
1025
1050
|
var _this8 = this;
|
|
1026
1051
|
|
|
1027
|
-
//
|
|
1052
|
+
// 解除原 sources 事件
|
|
1028
1053
|
if (this.layerSource) {
|
|
1029
1054
|
this.layerSource.off('update', this.sourceEvent);
|
|
1030
1055
|
}
|
|
@@ -1035,8 +1060,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1035
1060
|
if (this.inited && this.layerSource.cluster) {
|
|
1036
1061
|
var zoom = this.mapService.getZoom();
|
|
1037
1062
|
this.layerSource.updateClusterData(zoom);
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1063
|
+
}
|
|
1040
1064
|
|
|
1041
1065
|
if (this.layerSource.inited) {
|
|
1042
1066
|
this.sourceEvent();
|
|
@@ -1049,16 +1073,48 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1049
1073
|
|
|
1050
1074
|
var layerCenter = _this8.layerSource.center;
|
|
1051
1075
|
_this8.coordCenter = layerCenter;
|
|
1052
|
-
|
|
1076
|
+
|
|
1077
|
+
if ((_this8$mapService = _this8.mapService) !== null && _this8$mapService !== void 0 && _this8$mapService.setCoordCenter) {
|
|
1078
|
+
_this8.mapService.setCoordCenter(layerCenter);
|
|
1079
|
+
}
|
|
1053
1080
|
}
|
|
1054
1081
|
|
|
1055
1082
|
_this8.sourceEvent();
|
|
1056
1083
|
});
|
|
1084
|
+
} // layer 初始化source
|
|
1085
|
+
|
|
1086
|
+
}, {
|
|
1087
|
+
key: "initSource",
|
|
1088
|
+
value: function initSource(source) {
|
|
1089
|
+
this.layerSource = source;
|
|
1090
|
+
this.clusterZoom = 0;
|
|
1091
|
+
this.addSourceEvent();
|
|
1057
1092
|
}
|
|
1058
1093
|
}, {
|
|
1059
1094
|
key: "getSource",
|
|
1060
1095
|
value: function getSource() {
|
|
1061
1096
|
return this.layerSource;
|
|
1097
|
+
} // 注册source 更新事件
|
|
1098
|
+
|
|
1099
|
+
}, {
|
|
1100
|
+
key: "addSourceEvent",
|
|
1101
|
+
value: function addSourceEvent() {
|
|
1102
|
+
var _this9 = this;
|
|
1103
|
+
|
|
1104
|
+
this.layerSource.on('update', function () {
|
|
1105
|
+
if (_this9.coordCenter === undefined) {
|
|
1106
|
+
var _this9$mapService;
|
|
1107
|
+
|
|
1108
|
+
var layerCenter = _this9.layerSource.center;
|
|
1109
|
+
_this9.coordCenter = layerCenter;
|
|
1110
|
+
|
|
1111
|
+
if ((_this9$mapService = _this9.mapService) !== null && _this9$mapService !== void 0 && _this9$mapService.setCoordCenter) {
|
|
1112
|
+
_this9.mapService.setCoordCenter(layerCenter);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
_this9.sourceEvent();
|
|
1117
|
+
});
|
|
1062
1118
|
}
|
|
1063
1119
|
}, {
|
|
1064
1120
|
key: "getScaleOptions",
|
|
@@ -1152,75 +1208,79 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1152
1208
|
}
|
|
1153
1209
|
}, {
|
|
1154
1210
|
key: "buildLayerModel",
|
|
1155
|
-
value: function
|
|
1156
|
-
var
|
|
1211
|
+
value: function () {
|
|
1212
|
+
var _buildLayerModel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(options) {
|
|
1213
|
+
var _this10 = this;
|
|
1157
1214
|
|
|
1158
|
-
|
|
1159
|
-
vertexShader = options.vertexShader,
|
|
1160
|
-
fragmentShader = options.fragmentShader,
|
|
1161
|
-
triangulation = options.triangulation,
|
|
1162
|
-
segmentNumber = options.segmentNumber,
|
|
1163
|
-
_options$workerEnable = options.workerEnabled,
|
|
1164
|
-
workerEnabled = _options$workerEnable === void 0 ? false : _options$workerEnable,
|
|
1165
|
-
workerOptions = options.workerOptions,
|
|
1166
|
-
rest = (0, _objectWithoutProperties2.default)(options, _excluded2);
|
|
1167
|
-
this.shaderModuleService.registerModule(moduleName, {
|
|
1168
|
-
vs: vertexShader,
|
|
1169
|
-
fs: fragmentShader
|
|
1170
|
-
});
|
|
1215
|
+
var moduleName, vertexShader, fragmentShader, triangulation, segmentNumber, _options$workerEnable, workerEnabled, workerOptions, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
|
|
1171
1216
|
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
1218
|
+
while (1) {
|
|
1219
|
+
switch (_context3.prev = _context3.next) {
|
|
1220
|
+
case 0:
|
|
1221
|
+
moduleName = options.moduleName, vertexShader = options.vertexShader, fragmentShader = options.fragmentShader, triangulation = options.triangulation, segmentNumber = options.segmentNumber, _options$workerEnable = options.workerEnabled, workerEnabled = _options$workerEnable === void 0 ? false : _options$workerEnable, workerOptions = options.workerOptions, rest = (0, _objectWithoutProperties2.default)(options, _excluded2);
|
|
1222
|
+
this.shaderModuleService.registerModule(moduleName, {
|
|
1223
|
+
vs: vertexShader,
|
|
1224
|
+
fs: fragmentShader
|
|
1225
|
+
});
|
|
1226
|
+
_this$shaderModuleSer = this.shaderModuleService.getModule(moduleName), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, uniforms = _this$shaderModuleSer.uniforms;
|
|
1227
|
+
createModel = this.rendererService.createModel;
|
|
1228
|
+
return _context3.abrupt("return", new Promise(function (resolve, reject) {
|
|
1229
|
+
// filter supported worker & worker enabled layer
|
|
1230
|
+
if (workerOptions && workerOptions.modelType in _l7Utils.WorkerSourceMap && workerEnabled) {
|
|
1231
|
+
_this10.styleAttributeService.createAttributesAndIndicesAscy(_this10.encodedData, segmentNumber, workerOptions).then(function (_ref7) {
|
|
1232
|
+
var attributes = _ref7.attributes,
|
|
1233
|
+
elements = _ref7.elements;
|
|
1234
|
+
var m = createModel((0, _objectSpread2.default)({
|
|
1235
|
+
attributes: attributes,
|
|
1236
|
+
uniforms: uniforms,
|
|
1237
|
+
fs: fs,
|
|
1238
|
+
vs: vs,
|
|
1239
|
+
elements: elements,
|
|
1240
|
+
blend: _blend.BlendTypes[_l7Core.BlendType.normal]
|
|
1241
|
+
}, rest));
|
|
1242
|
+
resolve(m);
|
|
1243
|
+
}).catch(function (err) {
|
|
1244
|
+
return reject(err);
|
|
1245
|
+
});
|
|
1246
|
+
} else {
|
|
1247
|
+
var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, segmentNumber),
|
|
1248
|
+
attributes = _this10$styleAttribut.attributes,
|
|
1249
|
+
elements = _this10$styleAttribut.elements,
|
|
1250
|
+
count = _this10$styleAttribut.count;
|
|
1251
|
+
|
|
1252
|
+
var modelOptions = (0, _objectSpread2.default)({
|
|
1253
|
+
attributes: attributes,
|
|
1254
|
+
uniforms: uniforms,
|
|
1255
|
+
fs: fs,
|
|
1256
|
+
vs: vs,
|
|
1257
|
+
elements: elements,
|
|
1258
|
+
blend: _blend.BlendTypes[_l7Core.BlendType.normal]
|
|
1259
|
+
}, rest);
|
|
1260
|
+
|
|
1261
|
+
if (count) {
|
|
1262
|
+
modelOptions.count = count;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
var m = createModel(modelOptions);
|
|
1266
|
+
resolve(m);
|
|
1267
|
+
}
|
|
1268
|
+
}));
|
|
1217
1269
|
|
|
1218
|
-
|
|
1219
|
-
|
|
1270
|
+
case 5:
|
|
1271
|
+
case "end":
|
|
1272
|
+
return _context3.stop();
|
|
1273
|
+
}
|
|
1220
1274
|
}
|
|
1221
|
-
});
|
|
1222
|
-
});
|
|
1223
|
-
|
|
1275
|
+
}, _callee3, this);
|
|
1276
|
+
}));
|
|
1277
|
+
|
|
1278
|
+
function buildLayerModel(_x) {
|
|
1279
|
+
return _buildLayerModel.apply(this, arguments);
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
return buildLayerModel;
|
|
1283
|
+
}()
|
|
1224
1284
|
}, {
|
|
1225
1285
|
key: "createAttributes",
|
|
1226
1286
|
value: function createAttributes(options) {
|
|
@@ -1262,9 +1322,6 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1262
1322
|
}, {
|
|
1263
1323
|
key: "needPick",
|
|
1264
1324
|
value: function needPick(type) {
|
|
1265
|
-
// 地图图层的判断
|
|
1266
|
-
if (this.rawConfig.usage === 'basemap') return false;
|
|
1267
|
-
|
|
1268
1325
|
var _this$getLayerConfig10 = this.getLayerConfig(),
|
|
1269
1326
|
_this$getLayerConfig11 = _this$getLayerConfig10.enableHighlight,
|
|
1270
1327
|
enableHighlight = _this$getLayerConfig11 === void 0 ? true : _this$getLayerConfig11,
|
|
@@ -1286,34 +1343,73 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1286
1343
|
}
|
|
1287
1344
|
}, {
|
|
1288
1345
|
key: "buildModels",
|
|
1289
|
-
value: function
|
|
1290
|
-
|
|
1291
|
-
|
|
1346
|
+
value: function () {
|
|
1347
|
+
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
1348
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
1349
|
+
while (1) {
|
|
1350
|
+
switch (_context4.prev = _context4.next) {
|
|
1351
|
+
case 0:
|
|
1352
|
+
throw new Error('Method not implemented.');
|
|
1353
|
+
|
|
1354
|
+
case 1:
|
|
1355
|
+
case "end":
|
|
1356
|
+
return _context4.stop();
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
}, _callee4);
|
|
1360
|
+
}));
|
|
1361
|
+
|
|
1362
|
+
function buildModels() {
|
|
1363
|
+
return _buildModels.apply(this, arguments);
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
return buildModels;
|
|
1367
|
+
}()
|
|
1292
1368
|
}, {
|
|
1293
1369
|
key: "rebuildModels",
|
|
1294
|
-
value: function
|
|
1295
|
-
|
|
1296
|
-
|
|
1370
|
+
value: function () {
|
|
1371
|
+
var _rebuildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
1372
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
1373
|
+
while (1) {
|
|
1374
|
+
switch (_context5.prev = _context5.next) {
|
|
1375
|
+
case 0:
|
|
1376
|
+
_context5.next = 2;
|
|
1377
|
+
return this.buildModels();
|
|
1378
|
+
|
|
1379
|
+
case 2:
|
|
1380
|
+
case "end":
|
|
1381
|
+
return _context5.stop();
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
}, _callee5, this);
|
|
1385
|
+
}));
|
|
1386
|
+
|
|
1387
|
+
function rebuildModels() {
|
|
1388
|
+
return _rebuildModels.apply(this, arguments);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
return rebuildModels;
|
|
1392
|
+
}()
|
|
1297
1393
|
}, {
|
|
1298
1394
|
key: "renderMulPass",
|
|
1299
1395
|
value: function () {
|
|
1300
|
-
var _renderMulPass = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1301
|
-
return _regenerator.default.wrap(function
|
|
1396
|
+
var _renderMulPass = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(multiPassRenderer) {
|
|
1397
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1302
1398
|
while (1) {
|
|
1303
|
-
switch (
|
|
1399
|
+
switch (_context6.prev = _context6.next) {
|
|
1304
1400
|
case 0:
|
|
1305
|
-
|
|
1401
|
+
_context6.next = 2;
|
|
1306
1402
|
return multiPassRenderer.render();
|
|
1307
1403
|
|
|
1308
1404
|
case 2:
|
|
1309
1405
|
case "end":
|
|
1310
|
-
return
|
|
1406
|
+
return _context6.stop();
|
|
1311
1407
|
}
|
|
1312
1408
|
}
|
|
1313
|
-
},
|
|
1409
|
+
}, _callee6);
|
|
1314
1410
|
}));
|
|
1315
1411
|
|
|
1316
|
-
function renderMulPass(
|
|
1412
|
+
function renderMulPass(_x2) {
|
|
1317
1413
|
return _renderMulPass.apply(this, arguments);
|
|
1318
1414
|
}
|
|
1319
1415
|
|
|
@@ -1322,31 +1418,42 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1322
1418
|
}, {
|
|
1323
1419
|
key: "renderModels",
|
|
1324
1420
|
value: function renderModels(isPicking) {
|
|
1325
|
-
var
|
|
1421
|
+
var _this11 = this;
|
|
1326
1422
|
|
|
1327
1423
|
// TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
1328
|
-
if (this.encodeDataLength <= 0 && !this.forceRender)
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1424
|
+
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
1425
|
+
return this;
|
|
1426
|
+
} // TODO 待评估
|
|
1427
|
+
// if (this.layerModelNeedUpdate && this.layerModel) {
|
|
1428
|
+
// this.layerModel.buildModels((models: IModel[]) => {
|
|
1429
|
+
// this.models = models;
|
|
1430
|
+
// this.hooks.beforeRender.call();
|
|
1431
|
+
// this.layerModelNeedUpdate = false;
|
|
1432
|
+
// });
|
|
1433
|
+
// }
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
this.layerService.beforeRenderData(this);
|
|
1437
|
+
this.hooks.beforeRender.call();
|
|
1340
1438
|
this.models.forEach(function (model) {
|
|
1341
1439
|
model.draw({
|
|
1342
|
-
uniforms:
|
|
1440
|
+
uniforms: _this11.layerModel.getUninforms()
|
|
1343
1441
|
}, isPicking);
|
|
1344
1442
|
});
|
|
1443
|
+
this.hooks.afterRender.call();
|
|
1345
1444
|
return this;
|
|
1346
1445
|
}
|
|
1347
1446
|
}, {
|
|
1348
1447
|
key: "updateStyleAttribute",
|
|
1349
1448
|
value: function updateStyleAttribute(type, field, values, updateOptions) {
|
|
1449
|
+
// 存储 Attribute
|
|
1450
|
+
if (['color', 'size', 'texture', 'rotate', 'filter', 'label', 'shape'].indexOf(type) !== -1) {
|
|
1451
|
+
this.configService.setAttributeConfig(this.id, (0, _defineProperty2.default)({}, type, {
|
|
1452
|
+
field: field,
|
|
1453
|
+
values: values
|
|
1454
|
+
}));
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1350
1457
|
if (!this.inited) {
|
|
1351
1458
|
this.pendingStyleAttributes.push({
|
|
1352
1459
|
attributeName: type,
|
|
@@ -1366,6 +1473,11 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1366
1473
|
updateOptions);
|
|
1367
1474
|
}
|
|
1368
1475
|
}
|
|
1476
|
+
}, {
|
|
1477
|
+
key: "getLayerAttributeConfig",
|
|
1478
|
+
value: function getLayerAttributeConfig() {
|
|
1479
|
+
return this.configService.getAttributeConfig(this.id);
|
|
1480
|
+
}
|
|
1369
1481
|
}, {
|
|
1370
1482
|
key: "getShaderPickStat",
|
|
1371
1483
|
value: function getShaderPickStat() {
|
|
@@ -1381,6 +1493,13 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1381
1493
|
key: "setEarthTime",
|
|
1382
1494
|
value: function setEarthTime(time) {
|
|
1383
1495
|
console.warn('empty fn');
|
|
1496
|
+
} // 数据处理 在数据进行 mapping 生成 encodeData 之前对数据进行处理
|
|
1497
|
+
// 在各个 layer 中继承
|
|
1498
|
+
|
|
1499
|
+
}, {
|
|
1500
|
+
key: "processData",
|
|
1501
|
+
value: function processData(filterData) {
|
|
1502
|
+
return filterData;
|
|
1384
1503
|
}
|
|
1385
1504
|
}, {
|
|
1386
1505
|
key: "getModelType",
|
|
@@ -1393,27 +1512,43 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1393
1512
|
return {};
|
|
1394
1513
|
}
|
|
1395
1514
|
}, {
|
|
1396
|
-
key: "
|
|
1397
|
-
value: function
|
|
1398
|
-
var
|
|
1515
|
+
key: "initLayerModels",
|
|
1516
|
+
value: function () {
|
|
1517
|
+
var _initLayerModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
1518
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1519
|
+
while (1) {
|
|
1520
|
+
switch (_context7.prev = _context7.next) {
|
|
1521
|
+
case 0:
|
|
1522
|
+
this.models.forEach(function (model) {
|
|
1523
|
+
return model.destroy();
|
|
1524
|
+
});
|
|
1525
|
+
this.models = [];
|
|
1526
|
+
_context7.next = 4;
|
|
1527
|
+
return this.layerModel.initModels();
|
|
1399
1528
|
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
});
|
|
1403
|
-
this.models = [];
|
|
1404
|
-
this.models = models;
|
|
1405
|
-
this.emit('modelLoaded', null);
|
|
1406
|
-
this.modelLoaded = true; // Tip: setTimeout 用于延迟绘制,可以让拖动图层时连续的 setData 更加平滑 - L7Draw
|
|
1529
|
+
case 4:
|
|
1530
|
+
this.models = _context7.sent;
|
|
1407
1531
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1532
|
+
case 5:
|
|
1533
|
+
case "end":
|
|
1534
|
+
return _context7.stop();
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
}, _callee7, this);
|
|
1538
|
+
}));
|
|
1539
|
+
|
|
1540
|
+
function initLayerModels() {
|
|
1541
|
+
return _initLayerModels.apply(this, arguments);
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
return initLayerModels;
|
|
1545
|
+
}()
|
|
1413
1546
|
}, {
|
|
1414
1547
|
key: "reRender",
|
|
1415
1548
|
value: function reRender() {
|
|
1416
|
-
this.inited
|
|
1549
|
+
if (this.inited) {
|
|
1550
|
+
this.layerService.reRender();
|
|
1551
|
+
}
|
|
1417
1552
|
}
|
|
1418
1553
|
}, {
|
|
1419
1554
|
key: "splitValuesAndCallbackInAttribute",
|