@antv/l7-layers 2.10.0 → 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/es/core/BaseLayer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
4
4
|
import _initializerDefineProperty from "@babel/runtime/helpers/initializerDefineProperty";
|
|
5
5
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
@@ -29,17 +29,18 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
29
29
|
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; } }
|
|
30
30
|
|
|
31
31
|
// @ts-ignore
|
|
32
|
-
import { SyncBailHook, SyncHook
|
|
32
|
+
import { AsyncSeriesBailHook, AsyncWaterfallHook, SyncBailHook, SyncHook } from '@antv/async-hook';
|
|
33
33
|
import { BlendType, lazyInject, TYPES } from '@antv/l7-core';
|
|
34
34
|
import Source from '@antv/l7-source';
|
|
35
35
|
import { encodePickingColor, WorkerSourceMap } from '@antv/l7-utils';
|
|
36
36
|
import { EventEmitter } from 'eventemitter3';
|
|
37
37
|
import { isFunction, isObject, isUndefined } from 'lodash';
|
|
38
38
|
import { BlendTypes } from "../utils/blend";
|
|
39
|
-
import {
|
|
39
|
+
import { styleDataMapping } from "../utils/dataMappingStyle";
|
|
40
40
|
import { calculateData } from "../utils/layerData";
|
|
41
41
|
import { createMultiPassRenderer, normalizePasses } from "../utils/multiPassRender";
|
|
42
42
|
import { updateShape } from "../utils/updateShape";
|
|
43
|
+
import LayerPickService from "./LayerPickService";
|
|
43
44
|
/**
|
|
44
45
|
* 分配 layer id
|
|
45
46
|
*/
|
|
@@ -53,12 +54,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
53
54
|
// 生命周期钩子
|
|
54
55
|
// 待渲染 model 列表
|
|
55
56
|
// 用于保存子图层对象
|
|
56
|
-
// Tip: 用于标识矢量图层
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* 待更新样式属性,在初始化阶段完成注册
|
|
60
60
|
*/
|
|
61
|
-
// Tip: layer 保底颜色
|
|
62
61
|
// private pickingPassRender: IPass<'pixelPicking'>;
|
|
63
62
|
function BaseLayer() {
|
|
64
63
|
var _this;
|
|
@@ -109,10 +108,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
109
108
|
});
|
|
110
109
|
|
|
111
110
|
_defineProperty(_assertThisInitialized(_this), "hooks", {
|
|
112
|
-
init: new
|
|
111
|
+
init: new AsyncSeriesBailHook(),
|
|
113
112
|
afterInit: new SyncBailHook(),
|
|
114
113
|
beforeRender: new SyncBailHook(),
|
|
115
|
-
beforeRenderData: new
|
|
114
|
+
beforeRenderData: new AsyncWaterfallHook(),
|
|
116
115
|
afterRender: new SyncHook(),
|
|
117
116
|
beforePickingEncode: new SyncHook(),
|
|
118
117
|
afterPickingEncode: new SyncHook(),
|
|
@@ -126,14 +125,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
126
125
|
|
|
127
126
|
_defineProperty(_assertThisInitialized(_this), "models", []);
|
|
128
127
|
|
|
129
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
128
|
+
_defineProperty(_assertThisInitialized(_this), "startInit", false);
|
|
130
129
|
|
|
131
130
|
_defineProperty(_assertThisInitialized(_this), "layerChildren", []);
|
|
132
131
|
|
|
133
132
|
_defineProperty(_assertThisInitialized(_this), "masks", []);
|
|
134
133
|
|
|
135
|
-
_defineProperty(_assertThisInitialized(_this), "isVector", false);
|
|
136
|
-
|
|
137
134
|
_initializerDefineProperty(_assertThisInitialized(_this), "configService", _descriptor, _assertThisInitialized(_this));
|
|
138
135
|
|
|
139
136
|
_defineProperty(_assertThisInitialized(_this), "animateOptions", {
|
|
@@ -148,8 +145,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
148
145
|
|
|
149
146
|
_defineProperty(_assertThisInitialized(_this), "animateStatus", false);
|
|
150
147
|
|
|
151
|
-
_defineProperty(_assertThisInitialized(_this), "bottomColor", 'rgba(0, 0, 0, 0)');
|
|
152
|
-
|
|
153
148
|
_defineProperty(_assertThisInitialized(_this), "isDestroyed", false);
|
|
154
149
|
|
|
155
150
|
_defineProperty(_assertThisInitialized(_this), "encodeDataLength", 0);
|
|
@@ -163,12 +158,17 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
163
158
|
_this.fitBounds(layerConfig.fitBoundsOptions);
|
|
164
159
|
}
|
|
165
160
|
|
|
166
|
-
_this.
|
|
161
|
+
var autoRender = _this.layerSource.getSourceCfg().autoRender;
|
|
162
|
+
|
|
163
|
+
if (autoRender) {
|
|
164
|
+
_this.reRender();
|
|
165
|
+
}
|
|
167
166
|
});
|
|
168
167
|
|
|
169
168
|
_this.name = config.name || _this.id;
|
|
170
169
|
_this.zIndex = config.zIndex || 0;
|
|
171
|
-
_this.rawConfig = config;
|
|
170
|
+
_this.rawConfig = config; // this.parent = this;
|
|
171
|
+
|
|
172
172
|
return _this;
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -211,12 +211,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
213
|
|
|
214
|
-
if (!this.
|
|
214
|
+
if (!this.startInit) {
|
|
215
215
|
this.needUpdateConfig = _objectSpread(_objectSpread({}, this.needUpdateConfig), configToUpdate);
|
|
216
216
|
} else {
|
|
217
217
|
var sceneId = this.container.get(TYPES.SceneID); // @ts-ignore
|
|
218
218
|
|
|
219
|
-
|
|
219
|
+
styleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
|
|
220
220
|
|
|
221
221
|
this.configService.setLayerConfig(sceneId, this.id, _objectSpread(_objectSpread(_objectSpread({}, this.configService.getLayerConfig(this.id)), this.needUpdateConfig), configToUpdate));
|
|
222
222
|
this.needUpdateConfig = {};
|
|
@@ -240,16 +240,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
240
240
|
value: function getContainer() {
|
|
241
241
|
return this.container;
|
|
242
242
|
}
|
|
243
|
-
}, {
|
|
244
|
-
key: "setBottomColor",
|
|
245
|
-
value: function setBottomColor(color) {
|
|
246
|
-
this.bottomColor = color;
|
|
247
|
-
}
|
|
248
|
-
}, {
|
|
249
|
-
key: "getBottomColor",
|
|
250
|
-
value: function getBottomColor() {
|
|
251
|
-
return this.bottomColor;
|
|
252
|
-
}
|
|
253
243
|
}, {
|
|
254
244
|
key: "addPlugin",
|
|
255
245
|
value: function addPlugin(plugin) {
|
|
@@ -258,105 +248,131 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
258
248
|
}
|
|
259
249
|
}, {
|
|
260
250
|
key: "init",
|
|
261
|
-
value: function
|
|
262
|
-
var
|
|
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
|
-
|
|
292
|
-
|
|
251
|
+
value: function () {
|
|
252
|
+
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
253
|
+
var _this3 = this;
|
|
254
|
+
|
|
255
|
+
var sceneId, _this$getLayerConfig, enableMultiPassRenderer, passes, _iterator, _step, plugin;
|
|
256
|
+
|
|
257
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
258
|
+
while (1) {
|
|
259
|
+
switch (_context.prev = _context.next) {
|
|
260
|
+
case 0:
|
|
261
|
+
// 设置配置项
|
|
262
|
+
sceneId = this.container.get(TYPES.SceneID);
|
|
263
|
+
this.startInit = true; // 初始化图层配置项
|
|
264
|
+
// const { enableMultiPassRenderer = false } = this.rawConfig;
|
|
265
|
+
// this.configService.setLayerConfig(sceneId, this.id, {
|
|
266
|
+
// enableMultiPassRenderer,
|
|
267
|
+
// });
|
|
268
|
+
|
|
269
|
+
this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);
|
|
270
|
+
this.layerType = this.rawConfig.layerType; // 全局容器服务
|
|
271
|
+
// 场景容器服务
|
|
272
|
+
|
|
273
|
+
this.iconService = this.container.get(TYPES.IIconService);
|
|
274
|
+
this.fontService = this.container.get(TYPES.IFontService);
|
|
275
|
+
this.rendererService = this.container.get(TYPES.IRendererService);
|
|
276
|
+
this.layerService = this.container.get(TYPES.ILayerService);
|
|
277
|
+
this.interactionService = this.container.get(TYPES.IInteractionService);
|
|
278
|
+
this.pickingService = this.container.get(TYPES.IPickingService);
|
|
279
|
+
this.mapService = this.container.get(TYPES.IMapService);
|
|
280
|
+
_this$getLayerConfig = this.getLayerConfig(), enableMultiPassRenderer = _this$getLayerConfig.enableMultiPassRenderer, passes = _this$getLayerConfig.passes;
|
|
281
|
+
|
|
282
|
+
if (enableMultiPassRenderer && passes !== null && passes !== void 0 && passes.length && passes.length > 0) {
|
|
283
|
+
// Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom
|
|
284
|
+
this.mapService.on('mapAfterFrameChange', function () {
|
|
285
|
+
_this3.renderLayers();
|
|
286
|
+
});
|
|
287
|
+
}
|
|
293
288
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
289
|
+
this.cameraService = this.container.get(TYPES.ICameraService);
|
|
290
|
+
this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
|
|
291
|
+
this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
|
|
292
|
+
this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
|
|
293
|
+
this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass); // 图层容器服务
|
|
294
|
+
|
|
295
|
+
this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService);
|
|
296
|
+
|
|
297
|
+
if (enableMultiPassRenderer) {
|
|
298
|
+
// 按需初始化 瓦片频繁报错
|
|
299
|
+
this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
|
|
300
|
+
this.multiPassRenderer.setLayer(this);
|
|
301
|
+
} // 完成样式服务注册完成前添加的属性
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
this.pendingStyleAttributes.forEach(function (_ref2) {
|
|
305
|
+
var attributeName = _ref2.attributeName,
|
|
306
|
+
attributeField = _ref2.attributeField,
|
|
307
|
+
attributeValues = _ref2.attributeValues,
|
|
308
|
+
updateOptions = _ref2.updateOptions;
|
|
309
|
+
|
|
310
|
+
_this3.styleAttributeService.updateStyleAttribute(attributeName, {
|
|
311
|
+
// @ts-ignore
|
|
312
|
+
scale: _objectSpread({
|
|
313
|
+
field: attributeField
|
|
314
|
+
}, _this3.splitValuesAndCallbackInAttribute( // @ts-ignore
|
|
315
|
+
attributeValues, // @ts-ignore
|
|
316
|
+
_this3.getLayerConfig()[attributeName]))
|
|
317
|
+
}, // @ts-ignore
|
|
318
|
+
updateOptions);
|
|
319
|
+
});
|
|
320
|
+
this.pendingStyleAttributes = []; // 获取插件集
|
|
321
|
+
|
|
322
|
+
this.plugins = this.container.getAll(TYPES.ILayerPlugin); // 完成插件注册,传入场景和图层容器内的服务
|
|
323
|
+
|
|
324
|
+
_iterator = _createForOfIteratorHelper(this.plugins);
|
|
325
|
+
|
|
326
|
+
try {
|
|
327
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
328
|
+
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
|
+
} // 初始化其他服务
|
|
337
|
+
|
|
338
|
+
} catch (err) {
|
|
339
|
+
_iterator.e(err);
|
|
340
|
+
} finally {
|
|
341
|
+
_iterator.f();
|
|
342
|
+
}
|
|
299
343
|
|
|
300
|
-
|
|
301
|
-
this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
|
|
302
|
-
this.multiPassRenderer.setLayer(this); // 完成样式服务注册完成前添加的属性
|
|
344
|
+
this.layerPickService = new LayerPickService(this); // 触发 init 生命周期插件
|
|
303
345
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
attributeField = _ref2.attributeField,
|
|
307
|
-
attributeValues = _ref2.attributeValues,
|
|
308
|
-
updateOptions = _ref2.updateOptions;
|
|
346
|
+
_context.next = 28;
|
|
347
|
+
return this.hooks.init.promise();
|
|
309
348
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
scale: _objectSpread({
|
|
313
|
-
field: attributeField
|
|
314
|
-
}, _this3.splitValuesAndCallbackInAttribute( // @ts-ignore
|
|
315
|
-
attributeValues, // @ts-ignore
|
|
316
|
-
_this3.getLayerConfig()[attributeName]))
|
|
317
|
-
}, // @ts-ignore
|
|
318
|
-
updateOptions);
|
|
319
|
-
});
|
|
320
|
-
this.pendingStyleAttributes = []; // 获取插件集
|
|
321
|
-
|
|
322
|
-
this.plugins = this.container.getAll(TYPES.ILayerPlugin); // 完成插件注册,传入场景和图层容器内的服务
|
|
323
|
-
|
|
324
|
-
var _iterator = _createForOfIteratorHelper(this.plugins),
|
|
325
|
-
_step;
|
|
326
|
-
|
|
327
|
-
try {
|
|
328
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
329
|
-
var plugin = _step.value;
|
|
330
|
-
plugin.apply(this, {
|
|
331
|
-
rendererService: this.rendererService,
|
|
332
|
-
mapService: this.mapService,
|
|
333
|
-
styleAttributeService: this.styleAttributeService,
|
|
334
|
-
normalPassFactory: this.normalPassFactory,
|
|
335
|
-
postProcessingPassFactory: this.postProcessingPassFactory
|
|
336
|
-
});
|
|
337
|
-
} // 触发 init 生命周期插件
|
|
338
|
-
|
|
339
|
-
} catch (err) {
|
|
340
|
-
_iterator.e(err);
|
|
341
|
-
} finally {
|
|
342
|
-
_iterator.f();
|
|
343
|
-
}
|
|
349
|
+
case 28:
|
|
350
|
+
this.inited = true; // 触发初始化完成事件;
|
|
344
351
|
|
|
345
|
-
|
|
346
|
-
|
|
352
|
+
this.emit('inited', {
|
|
353
|
+
target: this,
|
|
354
|
+
type: 'inited'
|
|
355
|
+
});
|
|
356
|
+
this.emit('add', {
|
|
357
|
+
target: this,
|
|
358
|
+
type: 'add'
|
|
359
|
+
});
|
|
360
|
+
this.hooks.afterInit.call();
|
|
347
361
|
|
|
348
|
-
|
|
362
|
+
case 32:
|
|
363
|
+
case "end":
|
|
364
|
+
return _context.stop();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}, _callee, this);
|
|
368
|
+
}));
|
|
349
369
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
type: 'add'
|
|
357
|
-
});
|
|
358
|
-
return this;
|
|
359
|
-
}
|
|
370
|
+
function init() {
|
|
371
|
+
return _init.apply(this, arguments);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return init;
|
|
375
|
+
}()
|
|
360
376
|
}, {
|
|
361
377
|
key: "updateModelData",
|
|
362
378
|
value: function updateModelData(data) {
|
|
@@ -390,6 +406,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
390
406
|
};
|
|
391
407
|
}
|
|
392
408
|
}
|
|
409
|
+
}, {
|
|
410
|
+
key: "setLayerPickService",
|
|
411
|
+
value: function setLayerPickService(layerPickService) {
|
|
412
|
+
this.layerPickService = layerPickService;
|
|
413
|
+
}
|
|
393
414
|
}, {
|
|
394
415
|
key: "calculateEncodeData",
|
|
395
416
|
value: function calculateEncodeData(data, option) {
|
|
@@ -407,8 +428,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
407
428
|
}, {
|
|
408
429
|
key: "prepareBuildModel",
|
|
409
430
|
value: function prepareBuildModel() {
|
|
410
|
-
this.
|
|
411
|
-
this.updateLayerConfig(_objectSpread(_objectSpread({}, this.getDefaultConfig()), this.rawConfig)); // 启动动画
|
|
431
|
+
this.updateLayerConfig(_objectSpread(_objectSpread(_objectSpread({}, this.getDefaultConfig()), this.rawConfig), this.needUpdateConfig)); // 启动动画
|
|
412
432
|
|
|
413
433
|
var _this$getLayerConfig2 = this.getLayerConfig(),
|
|
414
434
|
animateOption = _this$getLayerConfig2.animateOption;
|
|
@@ -504,7 +524,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
504
524
|
// 判断是否为source
|
|
505
525
|
this.setSource(data);
|
|
506
526
|
return this;
|
|
507
|
-
}
|
|
527
|
+
} // 设置source 配置
|
|
528
|
+
|
|
508
529
|
|
|
509
530
|
this.sourceOption = {
|
|
510
531
|
data: data,
|
|
@@ -527,8 +548,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
527
548
|
if (!currentSource) {
|
|
528
549
|
// 执行 setData 的时候 source 还不存在(还未执行 addLayer)
|
|
529
550
|
_this4.source(new Source(data, options));
|
|
530
|
-
|
|
531
|
-
_this4.sourceEvent();
|
|
532
551
|
} else {
|
|
533
552
|
_this4.layerSource.setData(data, options);
|
|
534
553
|
} // this.layerSource.setData(data, options);
|
|
@@ -543,8 +562,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
543
562
|
value: function style(options) {
|
|
544
563
|
var _this5 = this;
|
|
545
564
|
|
|
546
|
-
var lastConfig = this.getLayerConfig();
|
|
547
|
-
|
|
548
565
|
var passes = options.passes,
|
|
549
566
|
rest = _objectWithoutProperties(options, _excluded); // passes 特殊处理
|
|
550
567
|
|
|
@@ -564,15 +581,15 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
564
581
|
if (this.container) {
|
|
565
582
|
this.updateLayerConfig(this.rawConfig);
|
|
566
583
|
this.styleNeedUpdate = true;
|
|
567
|
-
} //
|
|
568
|
-
|
|
584
|
+
} // TODO style model 更新
|
|
585
|
+
// @ts-ignore
|
|
586
|
+
// if (lastConfig && lastConfig.mask === true && options.mask === false) {
|
|
587
|
+
// this.clearModels();
|
|
588
|
+
// this.layerModel.buildModels((models) => {
|
|
589
|
+
// this.models = models;
|
|
590
|
+
// });
|
|
591
|
+
// }
|
|
569
592
|
|
|
570
|
-
if (lastConfig && lastConfig.mask === true && options.mask === false) {
|
|
571
|
-
this.clearModels();
|
|
572
|
-
this.layerModel.buildModels(function (models) {
|
|
573
|
-
_this5.models = models;
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
593
|
|
|
577
594
|
return this;
|
|
578
595
|
}
|
|
@@ -607,7 +624,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
607
624
|
return this;
|
|
608
625
|
}
|
|
609
626
|
|
|
610
|
-
if (this.encodeDataLength <= 0 && !this.forceRender)
|
|
627
|
+
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
628
|
+
return this;
|
|
629
|
+
} // Tip: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
630
|
+
|
|
611
631
|
|
|
612
632
|
this.renderModels();
|
|
613
633
|
return this;
|
|
@@ -619,29 +639,29 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
619
639
|
}, {
|
|
620
640
|
key: "renderMultiPass",
|
|
621
641
|
value: function () {
|
|
622
|
-
var _renderMultiPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
623
|
-
return _regeneratorRuntime.wrap(function
|
|
642
|
+
var _renderMultiPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
643
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
624
644
|
while (1) {
|
|
625
|
-
switch (
|
|
645
|
+
switch (_context2.prev = _context2.next) {
|
|
626
646
|
case 0:
|
|
627
647
|
if (!(this.encodeDataLength <= 0 && !this.forceRender)) {
|
|
628
|
-
|
|
648
|
+
_context2.next = 2;
|
|
629
649
|
break;
|
|
630
650
|
}
|
|
631
651
|
|
|
632
|
-
return
|
|
652
|
+
return _context2.abrupt("return");
|
|
633
653
|
|
|
634
654
|
case 2:
|
|
635
655
|
if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
|
|
636
|
-
|
|
656
|
+
_context2.next = 7;
|
|
637
657
|
break;
|
|
638
658
|
}
|
|
639
659
|
|
|
640
|
-
|
|
660
|
+
_context2.next = 5;
|
|
641
661
|
return this.multiPassRenderer.render();
|
|
642
662
|
|
|
643
663
|
case 5:
|
|
644
|
-
|
|
664
|
+
_context2.next = 8;
|
|
645
665
|
break;
|
|
646
666
|
|
|
647
667
|
case 7:
|
|
@@ -654,10 +674,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
654
674
|
|
|
655
675
|
case 8:
|
|
656
676
|
case "end":
|
|
657
|
-
return
|
|
677
|
+
return _context2.stop();
|
|
658
678
|
}
|
|
659
679
|
}
|
|
660
|
-
},
|
|
680
|
+
}, _callee2, this);
|
|
661
681
|
}));
|
|
662
682
|
|
|
663
683
|
function renderMultiPass() {
|
|
@@ -1021,13 +1041,14 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1021
1041
|
return !!(this.styleAttributeService.getLayerStyleAttributes() || []).filter(function (attribute) {
|
|
1022
1042
|
return attribute.needRescale || attribute.needRemapping || attribute.needRegenerateVertices;
|
|
1023
1043
|
}).length;
|
|
1024
|
-
}
|
|
1044
|
+
} // 外部初始化Source
|
|
1045
|
+
|
|
1025
1046
|
}, {
|
|
1026
1047
|
key: "setSource",
|
|
1027
1048
|
value: function setSource(source) {
|
|
1028
1049
|
var _this8 = this;
|
|
1029
1050
|
|
|
1030
|
-
//
|
|
1051
|
+
// 解除原 sources 事件
|
|
1031
1052
|
if (this.layerSource) {
|
|
1032
1053
|
this.layerSource.off('update', this.sourceEvent);
|
|
1033
1054
|
}
|
|
@@ -1038,8 +1059,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1038
1059
|
if (this.inited && this.layerSource.cluster) {
|
|
1039
1060
|
var zoom = this.mapService.getZoom();
|
|
1040
1061
|
this.layerSource.updateClusterData(zoom);
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1062
|
+
}
|
|
1043
1063
|
|
|
1044
1064
|
if (this.layerSource.inited) {
|
|
1045
1065
|
this.sourceEvent();
|
|
@@ -1052,16 +1072,48 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1052
1072
|
|
|
1053
1073
|
var layerCenter = _this8.layerSource.center;
|
|
1054
1074
|
_this8.coordCenter = layerCenter;
|
|
1055
|
-
|
|
1075
|
+
|
|
1076
|
+
if ((_this8$mapService = _this8.mapService) !== null && _this8$mapService !== void 0 && _this8$mapService.setCoordCenter) {
|
|
1077
|
+
_this8.mapService.setCoordCenter(layerCenter);
|
|
1078
|
+
}
|
|
1056
1079
|
}
|
|
1057
1080
|
|
|
1058
1081
|
_this8.sourceEvent();
|
|
1059
1082
|
});
|
|
1083
|
+
} // layer 初始化source
|
|
1084
|
+
|
|
1085
|
+
}, {
|
|
1086
|
+
key: "initSource",
|
|
1087
|
+
value: function initSource(source) {
|
|
1088
|
+
this.layerSource = source;
|
|
1089
|
+
this.clusterZoom = 0;
|
|
1090
|
+
this.addSourceEvent();
|
|
1060
1091
|
}
|
|
1061
1092
|
}, {
|
|
1062
1093
|
key: "getSource",
|
|
1063
1094
|
value: function getSource() {
|
|
1064
1095
|
return this.layerSource;
|
|
1096
|
+
} // 注册source 更新事件
|
|
1097
|
+
|
|
1098
|
+
}, {
|
|
1099
|
+
key: "addSourceEvent",
|
|
1100
|
+
value: function addSourceEvent() {
|
|
1101
|
+
var _this9 = this;
|
|
1102
|
+
|
|
1103
|
+
this.layerSource.on('update', function () {
|
|
1104
|
+
if (_this9.coordCenter === undefined) {
|
|
1105
|
+
var _this9$mapService;
|
|
1106
|
+
|
|
1107
|
+
var layerCenter = _this9.layerSource.center;
|
|
1108
|
+
_this9.coordCenter = layerCenter;
|
|
1109
|
+
|
|
1110
|
+
if ((_this9$mapService = _this9.mapService) !== null && _this9$mapService !== void 0 && _this9$mapService.setCoordCenter) {
|
|
1111
|
+
_this9.mapService.setCoordCenter(layerCenter);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
_this9.sourceEvent();
|
|
1116
|
+
});
|
|
1065
1117
|
}
|
|
1066
1118
|
}, {
|
|
1067
1119
|
key: "getScaleOptions",
|
|
@@ -1155,76 +1207,79 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1155
1207
|
}
|
|
1156
1208
|
}, {
|
|
1157
1209
|
key: "buildLayerModel",
|
|
1158
|
-
value: function
|
|
1159
|
-
var
|
|
1210
|
+
value: function () {
|
|
1211
|
+
var _buildLayerModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
|
|
1212
|
+
var _this10 = this;
|
|
1160
1213
|
|
|
1161
|
-
|
|
1162
|
-
vertexShader = options.vertexShader,
|
|
1163
|
-
fragmentShader = options.fragmentShader,
|
|
1164
|
-
triangulation = options.triangulation,
|
|
1165
|
-
segmentNumber = options.segmentNumber,
|
|
1166
|
-
_options$workerEnable = options.workerEnabled,
|
|
1167
|
-
workerEnabled = _options$workerEnable === void 0 ? false : _options$workerEnable,
|
|
1168
|
-
workerOptions = options.workerOptions,
|
|
1169
|
-
rest = _objectWithoutProperties(options, _excluded2);
|
|
1170
|
-
|
|
1171
|
-
this.shaderModuleService.registerModule(moduleName, {
|
|
1172
|
-
vs: vertexShader,
|
|
1173
|
-
fs: fragmentShader
|
|
1174
|
-
});
|
|
1214
|
+
var moduleName, vertexShader, fragmentShader, triangulation, segmentNumber, _options$workerEnable, workerEnabled, workerOptions, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
|
|
1175
1215
|
|
|
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
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1216
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
1217
|
+
while (1) {
|
|
1218
|
+
switch (_context3.prev = _context3.next) {
|
|
1219
|
+
case 0:
|
|
1220
|
+
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 = _objectWithoutProperties(options, _excluded2);
|
|
1221
|
+
this.shaderModuleService.registerModule(moduleName, {
|
|
1222
|
+
vs: vertexShader,
|
|
1223
|
+
fs: fragmentShader
|
|
1224
|
+
});
|
|
1225
|
+
_this$shaderModuleSer = this.shaderModuleService.getModule(moduleName), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, uniforms = _this$shaderModuleSer.uniforms;
|
|
1226
|
+
createModel = this.rendererService.createModel;
|
|
1227
|
+
return _context3.abrupt("return", new Promise(function (resolve, reject) {
|
|
1228
|
+
// filter supported worker & worker enabled layer
|
|
1229
|
+
if (workerOptions && workerOptions.modelType in WorkerSourceMap && workerEnabled) {
|
|
1230
|
+
_this10.styleAttributeService.createAttributesAndIndicesAscy(_this10.encodedData, segmentNumber, workerOptions).then(function (_ref7) {
|
|
1231
|
+
var attributes = _ref7.attributes,
|
|
1232
|
+
elements = _ref7.elements;
|
|
1233
|
+
var m = createModel(_objectSpread({
|
|
1234
|
+
attributes: attributes,
|
|
1235
|
+
uniforms: uniforms,
|
|
1236
|
+
fs: fs,
|
|
1237
|
+
vs: vs,
|
|
1238
|
+
elements: elements,
|
|
1239
|
+
blend: BlendTypes[BlendType.normal]
|
|
1240
|
+
}, rest));
|
|
1241
|
+
resolve(m);
|
|
1242
|
+
}).catch(function (err) {
|
|
1243
|
+
return reject(err);
|
|
1244
|
+
});
|
|
1245
|
+
} else {
|
|
1246
|
+
var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, segmentNumber),
|
|
1247
|
+
attributes = _this10$styleAttribut.attributes,
|
|
1248
|
+
elements = _this10$styleAttribut.elements,
|
|
1249
|
+
count = _this10$styleAttribut.count;
|
|
1250
|
+
|
|
1251
|
+
var modelOptions = _objectSpread({
|
|
1252
|
+
attributes: attributes,
|
|
1253
|
+
uniforms: uniforms,
|
|
1254
|
+
fs: fs,
|
|
1255
|
+
vs: vs,
|
|
1256
|
+
elements: elements,
|
|
1257
|
+
blend: BlendTypes[BlendType.normal]
|
|
1258
|
+
}, rest);
|
|
1259
|
+
|
|
1260
|
+
if (count) {
|
|
1261
|
+
modelOptions.count = count;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
var m = createModel(modelOptions);
|
|
1265
|
+
resolve(m);
|
|
1266
|
+
}
|
|
1267
|
+
}));
|
|
1221
1268
|
|
|
1222
|
-
|
|
1223
|
-
|
|
1269
|
+
case 5:
|
|
1270
|
+
case "end":
|
|
1271
|
+
return _context3.stop();
|
|
1272
|
+
}
|
|
1224
1273
|
}
|
|
1225
|
-
});
|
|
1226
|
-
});
|
|
1227
|
-
|
|
1274
|
+
}, _callee3, this);
|
|
1275
|
+
}));
|
|
1276
|
+
|
|
1277
|
+
function buildLayerModel(_x) {
|
|
1278
|
+
return _buildLayerModel.apply(this, arguments);
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
return buildLayerModel;
|
|
1282
|
+
}()
|
|
1228
1283
|
}, {
|
|
1229
1284
|
key: "createAttributes",
|
|
1230
1285
|
value: function createAttributes(options) {
|
|
@@ -1266,9 +1321,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1266
1321
|
}, {
|
|
1267
1322
|
key: "needPick",
|
|
1268
1323
|
value: function needPick(type) {
|
|
1269
|
-
// 地图图层的判断
|
|
1270
|
-
if (this.rawConfig.usage === 'basemap') return false;
|
|
1271
|
-
|
|
1272
1324
|
var _this$getLayerConfig10 = this.getLayerConfig(),
|
|
1273
1325
|
_this$getLayerConfig11 = _this$getLayerConfig10.enableHighlight,
|
|
1274
1326
|
enableHighlight = _this$getLayerConfig11 === void 0 ? true : _this$getLayerConfig11,
|
|
@@ -1290,34 +1342,73 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1290
1342
|
}
|
|
1291
1343
|
}, {
|
|
1292
1344
|
key: "buildModels",
|
|
1293
|
-
value: function
|
|
1294
|
-
|
|
1295
|
-
|
|
1345
|
+
value: function () {
|
|
1346
|
+
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
1347
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
1348
|
+
while (1) {
|
|
1349
|
+
switch (_context4.prev = _context4.next) {
|
|
1350
|
+
case 0:
|
|
1351
|
+
throw new Error('Method not implemented.');
|
|
1352
|
+
|
|
1353
|
+
case 1:
|
|
1354
|
+
case "end":
|
|
1355
|
+
return _context4.stop();
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
}, _callee4);
|
|
1359
|
+
}));
|
|
1360
|
+
|
|
1361
|
+
function buildModels() {
|
|
1362
|
+
return _buildModels.apply(this, arguments);
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
return buildModels;
|
|
1366
|
+
}()
|
|
1296
1367
|
}, {
|
|
1297
1368
|
key: "rebuildModels",
|
|
1298
|
-
value: function
|
|
1299
|
-
|
|
1300
|
-
|
|
1369
|
+
value: function () {
|
|
1370
|
+
var _rebuildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
1371
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
1372
|
+
while (1) {
|
|
1373
|
+
switch (_context5.prev = _context5.next) {
|
|
1374
|
+
case 0:
|
|
1375
|
+
_context5.next = 2;
|
|
1376
|
+
return this.buildModels();
|
|
1377
|
+
|
|
1378
|
+
case 2:
|
|
1379
|
+
case "end":
|
|
1380
|
+
return _context5.stop();
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
}, _callee5, this);
|
|
1384
|
+
}));
|
|
1385
|
+
|
|
1386
|
+
function rebuildModels() {
|
|
1387
|
+
return _rebuildModels.apply(this, arguments);
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
return rebuildModels;
|
|
1391
|
+
}()
|
|
1301
1392
|
}, {
|
|
1302
1393
|
key: "renderMulPass",
|
|
1303
1394
|
value: function () {
|
|
1304
|
-
var _renderMulPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1305
|
-
return _regeneratorRuntime.wrap(function
|
|
1395
|
+
var _renderMulPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(multiPassRenderer) {
|
|
1396
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
1306
1397
|
while (1) {
|
|
1307
|
-
switch (
|
|
1398
|
+
switch (_context6.prev = _context6.next) {
|
|
1308
1399
|
case 0:
|
|
1309
|
-
|
|
1400
|
+
_context6.next = 2;
|
|
1310
1401
|
return multiPassRenderer.render();
|
|
1311
1402
|
|
|
1312
1403
|
case 2:
|
|
1313
1404
|
case "end":
|
|
1314
|
-
return
|
|
1405
|
+
return _context6.stop();
|
|
1315
1406
|
}
|
|
1316
1407
|
}
|
|
1317
|
-
},
|
|
1408
|
+
}, _callee6);
|
|
1318
1409
|
}));
|
|
1319
1410
|
|
|
1320
|
-
function renderMulPass(
|
|
1411
|
+
function renderMulPass(_x2) {
|
|
1321
1412
|
return _renderMulPass.apply(this, arguments);
|
|
1322
1413
|
}
|
|
1323
1414
|
|
|
@@ -1326,31 +1417,42 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1326
1417
|
}, {
|
|
1327
1418
|
key: "renderModels",
|
|
1328
1419
|
value: function renderModels(isPicking) {
|
|
1329
|
-
var
|
|
1420
|
+
var _this11 = this;
|
|
1330
1421
|
|
|
1331
1422
|
// TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
1332
|
-
if (this.encodeDataLength <= 0 && !this.forceRender)
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1423
|
+
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
1424
|
+
return this;
|
|
1425
|
+
} // TODO 待评估
|
|
1426
|
+
// if (this.layerModelNeedUpdate && this.layerModel) {
|
|
1427
|
+
// this.layerModel.buildModels((models: IModel[]) => {
|
|
1428
|
+
// this.models = models;
|
|
1429
|
+
// this.hooks.beforeRender.call();
|
|
1430
|
+
// this.layerModelNeedUpdate = false;
|
|
1431
|
+
// });
|
|
1432
|
+
// }
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
this.layerService.beforeRenderData(this);
|
|
1436
|
+
this.hooks.beforeRender.call();
|
|
1344
1437
|
this.models.forEach(function (model) {
|
|
1345
1438
|
model.draw({
|
|
1346
|
-
uniforms:
|
|
1439
|
+
uniforms: _this11.layerModel.getUninforms()
|
|
1347
1440
|
}, isPicking);
|
|
1348
1441
|
});
|
|
1442
|
+
this.hooks.afterRender.call();
|
|
1349
1443
|
return this;
|
|
1350
1444
|
}
|
|
1351
1445
|
}, {
|
|
1352
1446
|
key: "updateStyleAttribute",
|
|
1353
1447
|
value: function updateStyleAttribute(type, field, values, updateOptions) {
|
|
1448
|
+
// 存储 Attribute
|
|
1449
|
+
if (['color', 'size', 'texture', 'rotate', 'filter', 'label', 'shape'].indexOf(type) !== -1) {
|
|
1450
|
+
this.configService.setAttributeConfig(this.id, _defineProperty({}, type, {
|
|
1451
|
+
field: field,
|
|
1452
|
+
values: values
|
|
1453
|
+
}));
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1354
1456
|
if (!this.inited) {
|
|
1355
1457
|
this.pendingStyleAttributes.push({
|
|
1356
1458
|
attributeName: type,
|
|
@@ -1370,6 +1472,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1370
1472
|
updateOptions);
|
|
1371
1473
|
}
|
|
1372
1474
|
}
|
|
1475
|
+
}, {
|
|
1476
|
+
key: "getLayerAttributeConfig",
|
|
1477
|
+
value: function getLayerAttributeConfig() {
|
|
1478
|
+
return this.configService.getAttributeConfig(this.id);
|
|
1479
|
+
}
|
|
1373
1480
|
}, {
|
|
1374
1481
|
key: "getShaderPickStat",
|
|
1375
1482
|
value: function getShaderPickStat() {
|
|
@@ -1385,6 +1492,13 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1385
1492
|
key: "setEarthTime",
|
|
1386
1493
|
value: function setEarthTime(time) {
|
|
1387
1494
|
console.warn('empty fn');
|
|
1495
|
+
} // 数据处理 在数据进行 mapping 生成 encodeData 之前对数据进行处理
|
|
1496
|
+
// 在各个 layer 中继承
|
|
1497
|
+
|
|
1498
|
+
}, {
|
|
1499
|
+
key: "processData",
|
|
1500
|
+
value: function processData(filterData) {
|
|
1501
|
+
return filterData;
|
|
1388
1502
|
}
|
|
1389
1503
|
}, {
|
|
1390
1504
|
key: "getModelType",
|
|
@@ -1397,27 +1511,43 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1397
1511
|
return {};
|
|
1398
1512
|
}
|
|
1399
1513
|
}, {
|
|
1400
|
-
key: "
|
|
1401
|
-
value: function
|
|
1402
|
-
var
|
|
1514
|
+
key: "initLayerModels",
|
|
1515
|
+
value: function () {
|
|
1516
|
+
var _initLayerModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
1517
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
1518
|
+
while (1) {
|
|
1519
|
+
switch (_context7.prev = _context7.next) {
|
|
1520
|
+
case 0:
|
|
1521
|
+
this.models.forEach(function (model) {
|
|
1522
|
+
return model.destroy();
|
|
1523
|
+
});
|
|
1524
|
+
this.models = [];
|
|
1525
|
+
_context7.next = 4;
|
|
1526
|
+
return this.layerModel.initModels();
|
|
1403
1527
|
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
});
|
|
1407
|
-
this.models = [];
|
|
1408
|
-
this.models = models;
|
|
1409
|
-
this.emit('modelLoaded', null);
|
|
1410
|
-
this.modelLoaded = true; // Tip: setTimeout 用于延迟绘制,可以让拖动图层时连续的 setData 更加平滑 - L7Draw
|
|
1528
|
+
case 4:
|
|
1529
|
+
this.models = _context7.sent;
|
|
1411
1530
|
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1531
|
+
case 5:
|
|
1532
|
+
case "end":
|
|
1533
|
+
return _context7.stop();
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
}, _callee7, this);
|
|
1537
|
+
}));
|
|
1538
|
+
|
|
1539
|
+
function initLayerModels() {
|
|
1540
|
+
return _initLayerModels.apply(this, arguments);
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
return initLayerModels;
|
|
1544
|
+
}()
|
|
1417
1545
|
}, {
|
|
1418
1546
|
key: "reRender",
|
|
1419
1547
|
value: function reRender() {
|
|
1420
|
-
this.inited
|
|
1548
|
+
if (this.inited) {
|
|
1549
|
+
this.layerService.reRender();
|
|
1550
|
+
}
|
|
1421
1551
|
}
|
|
1422
1552
|
}, {
|
|
1423
1553
|
key: "splitValuesAndCallbackInAttribute",
|