@antv/l7-layers 2.10.3 → 2.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/index.d.ts +3 -2
- package/es/Geometry/index.js +17 -27
- package/es/Geometry/models/billboard.d.ts +2 -2
- package/es/Geometry/models/billboard.js +37 -77
- package/es/Geometry/models/plane.d.ts +2 -2
- package/es/Geometry/models/plane.js +40 -80
- package/es/Geometry/models/sprite.d.ts +2 -2
- package/es/Geometry/models/sprite.js +45 -83
- package/es/canvas/index.d.ts +3 -2
- package/es/canvas/index.js +19 -29
- package/es/canvas/models/canvas.d.ts +2 -2
- package/es/canvas/models/canvas.js +15 -54
- package/es/citybuliding/building.d.ts +3 -2
- package/es/citybuliding/building.js +17 -26
- package/es/citybuliding/models/build.d.ts +2 -2
- package/es/citybuliding/models/build.js +25 -70
- package/es/core/BaseLayer.d.ts +18 -21
- package/es/core/BaseLayer.js +273 -382
- package/es/core/BaseModel.d.ts +2 -2
- package/es/core/BaseModel.js +6 -47
- package/es/core/triangulation.js +1 -8
- package/es/earth/index.d.ts +2 -2
- package/es/earth/index.js +9 -28
- package/es/earth/models/atmosphere.d.ts +2 -2
- package/es/earth/models/atmosphere.js +22 -67
- package/es/earth/models/base.d.ts +2 -2
- package/es/earth/models/base.js +43 -89
- package/es/earth/models/bloomsphere.d.ts +2 -2
- package/es/earth/models/bloomsphere.js +22 -67
- package/es/heatmap/index.d.ts +3 -2
- package/es/heatmap/index.js +22 -33
- package/es/heatmap/models/grid.d.ts +2 -2
- package/es/heatmap/models/grid.js +27 -68
- package/es/heatmap/models/grid3d.d.ts +2 -2
- package/es/heatmap/models/grid3d.js +28 -69
- package/es/heatmap/models/heatmap.d.ts +2 -2
- package/es/heatmap/models/heatmap.js +14 -40
- package/es/heatmap/models/hexagon.d.ts +2 -2
- package/es/heatmap/models/hexagon.js +28 -69
- package/es/image/index.d.ts +3 -2
- package/es/image/index.js +17 -27
- package/es/image/models/dataImage.d.ts +2 -2
- package/es/image/models/dataImage.js +54 -93
- package/es/image/models/image.d.ts +2 -2
- package/es/image/models/image.js +67 -108
- package/es/image/models/tileDataImage.d.ts +2 -2
- package/es/image/models/tileDataImage.js +43 -84
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/line/index.d.ts +4 -5
- package/es/line/index.js +25 -51
- package/es/line/models/arc.d.ts +2 -2
- package/es/line/models/arc.js +38 -73
- package/es/line/models/arc_3d.d.ts +2 -2
- package/es/line/models/arc_3d.js +34 -69
- package/es/line/models/earthArc_3d.d.ts +2 -2
- package/es/line/models/earthArc_3d.js +37 -72
- package/es/line/models/great_circle.d.ts +2 -2
- package/es/line/models/great_circle.js +29 -70
- package/es/line/models/half.d.ts +2 -2
- package/es/line/models/half.js +17 -40
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +2 -0
- package/es/line/models/line.d.ts +2 -2
- package/es/line/models/line.js +47 -79
- package/es/line/models/linearline.d.ts +2 -2
- package/es/line/models/linearline.js +31 -70
- package/es/line/models/simpleLine.d.ts +2 -2
- package/es/line/models/simpleLine.js +34 -71
- package/es/line/models/simpleTileLine.d.ts +2 -2
- package/es/line/models/simpleTileLine.js +30 -70
- package/es/line/models/tile.d.ts +2 -2
- package/es/line/models/tile.js +17 -40
- package/es/line/models/wall.d.ts +2 -2
- package/es/line/models/wall.js +22 -67
- package/es/mask/index.d.ts +4 -2
- package/es/mask/index.js +97 -27
- package/es/mask/models/fill.d.ts +2 -2
- package/es/mask/models/fill.js +16 -40
- package/es/mask/models/index.d.ts +1 -1
- package/es/mask/models/index.js +3 -1
- package/es/plugins/DataMappingPlugin.d.ts +2 -0
- package/es/plugins/DataMappingPlugin.js +152 -90
- package/es/plugins/DataSourcePlugin.js +30 -74
- package/es/plugins/FeatureScalePlugin.d.ts +1 -0
- package/es/plugins/FeatureScalePlugin.js +61 -85
- package/es/plugins/LayerModelPlugin.d.ts +2 -2
- package/es/plugins/LayerModelPlugin.js +37 -121
- package/es/plugins/LayerStylePlugin.js +6 -1
- package/es/plugins/MultiPassRendererPlugin.js +1 -1
- package/es/plugins/PixelPickingPlugin.js +1 -1
- package/es/plugins/RegisterStyleAttributePlugin.js +16 -1
- package/es/plugins/UpdateModelPlugin.js +0 -3
- package/es/plugins/UpdateStyleAttributePlugin.js +6 -3
- package/es/point/index.d.ts +4 -4
- package/es/point/index.js +23 -55
- package/es/point/models/earthExtrude.d.ts +2 -2
- package/es/point/models/earthExtrude.js +30 -73
- package/es/point/models/earthFill.d.ts +2 -2
- package/es/point/models/earthFill.js +21 -66
- package/es/point/models/extrude.d.ts +2 -2
- package/es/point/models/extrude.js +17 -40
- package/es/point/models/fill.d.ts +2 -2
- package/es/point/models/fill.js +20 -43
- package/es/point/models/fillmage.d.ts +2 -2
- package/es/point/models/fillmage.js +43 -82
- package/es/point/models/image.d.ts +2 -2
- package/es/point/models/image.js +31 -72
- package/es/point/models/index.d.ts +1 -1
- package/es/point/models/index.js +2 -0
- package/es/point/models/normal.d.ts +2 -2
- package/es/point/models/normal.js +30 -71
- package/es/point/models/radar.d.ts +2 -2
- package/es/point/models/radar.js +35 -75
- package/es/point/models/simplePoint.d.ts +2 -2
- package/es/point/models/simplePoint.js +29 -70
- package/es/point/models/text.d.ts +2 -3
- package/es/point/models/text.js +110 -183
- package/es/point/models/tile.d.ts +2 -2
- package/es/point/models/tile.js +35 -77
- package/es/point/models/tileText.d.ts +2 -2
- package/es/point/models/tileText.js +116 -151
- package/es/polygon/index.d.ts +3 -2
- package/es/polygon/index.js +24 -27
- package/es/polygon/models/extrude.d.ts +2 -2
- package/es/polygon/models/extrude.js +32 -69
- package/es/polygon/models/fill.d.ts +2 -2
- package/es/polygon/models/fill.js +43 -76
- package/es/polygon/models/index.d.ts +1 -1
- package/es/polygon/models/index.js +2 -0
- package/es/polygon/models/ocean.d.ts +2 -2
- package/es/polygon/models/ocean.js +28 -69
- package/es/polygon/models/tile.d.ts +2 -2
- package/es/polygon/models/tile.js +30 -70
- package/es/polygon/models/water.d.ts +2 -2
- package/es/polygon/models/water.js +28 -69
- package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -1
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +2 -1
- package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +2 -1
- package/es/raster/index.d.ts +4 -3
- package/es/raster/index.js +22 -28
- package/es/raster/models/index.d.ts +1 -1
- package/es/raster/models/index.js +3 -1
- package/es/raster/models/raster.d.ts +2 -2
- package/es/raster/models/raster.js +13 -36
- package/es/raster/models/rasterRgb.d.ts +2 -2
- package/es/raster/models/rasterRgb.js +13 -36
- package/es/raster/models/rasterTile.d.ts +2 -2
- package/es/raster/models/rasterTile.js +36 -77
- package/es/raster/raster.d.ts +1 -1
- package/es/raster/raster.js +22 -42
- package/es/tile/interaction/TilePickService.d.ts +16 -0
- package/es/tile/interaction/TilePickService.js +129 -0
- package/es/tile/interaction/getRasterData.d.ts +2 -2
- package/es/tile/interaction/utils.js +11 -3
- package/es/tile/interface.d.ts +4 -5
- package/es/tile/manager/base.d.ts +12 -17
- package/es/tile/manager/base.js +47 -212
- package/es/tile/manager/layerManager.d.ts +19 -0
- package/es/tile/manager/layerManager.js +254 -0
- package/es/tile/manager/mapLayerManager.d.ts +7 -0
- package/es/tile/manager/mapLayerManager.js +119 -0
- package/es/tile/models/tileModel.d.ts +10 -0
- package/es/tile/models/tileModel.js +81 -0
- package/es/tile/render/TileRenderService.d.ts +10 -0
- package/es/tile/render/TileRenderService.js +68 -0
- package/es/tile/style/TileStyleService.d.ts +17 -0
- package/es/tile/style/TileStyleService.js +118 -0
- package/es/tile/style/constants.d.ts +13 -1
- package/es/tile/style/constants.js +15 -6
- package/es/tile/style/utils.d.ts +8 -1
- package/es/tile/style/utils.js +126 -0
- package/es/tile/tileFactory/base.d.ts +45 -0
- package/es/tile/tileFactory/base.js +403 -0
- package/es/tile/tileFactory/index.d.ts +4 -10
- package/es/tile/tileFactory/index.js +23 -30
- package/es/tile/tileFactory/layers/{RasterDataLayer.d.ts → rasterDataLayer.d.ts} +3 -3
- package/es/tile/tileFactory/layers/{RasterDataLayer.js → rasterDataLayer.js} +21 -33
- package/es/tile/tileFactory/layers/{TileDebugLayer.d.ts → tileTest.d.ts} +2 -2
- package/es/tile/tileFactory/layers/{TileDebugLayer.js → tileTest.js} +10 -23
- package/es/tile/tileFactory/layers/vectorLayer.d.ts +30 -0
- package/es/tile/tileFactory/layers/vectorLayer.js +253 -0
- package/es/tile/tileFactory/line.d.ts +12 -0
- package/es/tile/tileFactory/line.js +59 -0
- package/es/tile/tileFactory/mask.d.ts +12 -0
- package/es/tile/tileFactory/mask.js +60 -0
- package/es/tile/tileFactory/point.d.ts +12 -0
- package/es/tile/tileFactory/point.js +60 -0
- package/es/tile/tileFactory/polygon.d.ts +12 -0
- package/es/tile/tileFactory/polygon.js +59 -0
- package/es/tile/tileFactory/raster.d.ts +12 -0
- package/es/tile/tileFactory/raster.js +55 -0
- package/es/tile/tileFactory/rasterData.d.ts +12 -0
- package/es/tile/tileFactory/rasterData.js +81 -0
- package/es/tile/tileFactory/test.d.ts +12 -0
- package/es/tile/tileFactory/test.js +94 -0
- package/es/tile/tileLayer/MapTileLayer.d.ts +6 -0
- package/es/tile/tileLayer/MapTileLayer.js +48 -0
- package/es/tile/tileLayer/TileLayer.d.ts +22 -0
- package/es/tile/tileLayer/TileLayer.js +198 -0
- package/es/tile/tileLayer/base.d.ts +33 -0
- package/es/tile/tileLayer/base.js +212 -0
- package/es/tile/utils.d.ts +11 -1
- package/es/tile/utils.js +129 -0
- package/es/utils/dataMappingStyle.d.ts +4 -4
- package/es/utils/dataMappingStyle.js +18 -16
- package/es/utils/layerData.js +11 -5
- package/es/wind/index.d.ts +3 -2
- package/es/wind/index.js +17 -27
- package/es/wind/models/wind.d.ts +2 -2
- package/es/wind/models/wind.js +104 -123
- package/lib/Geometry/index.js +17 -29
- package/lib/Geometry/models/billboard.js +37 -79
- package/lib/Geometry/models/plane.js +40 -82
- package/lib/Geometry/models/sprite.js +45 -85
- package/lib/canvas/index.js +19 -31
- package/lib/canvas/models/canvas.js +15 -56
- package/lib/citybuliding/building.js +17 -28
- package/lib/citybuliding/models/build.js +25 -72
- package/lib/core/BaseLayer.js +268 -382
- package/lib/core/BaseModel.js +6 -48
- package/lib/core/triangulation.js +1 -8
- package/lib/earth/index.js +9 -30
- package/lib/earth/models/atmosphere.js +22 -69
- package/lib/earth/models/base.js +42 -90
- package/lib/earth/models/bloomsphere.js +22 -69
- package/lib/heatmap/index.js +22 -35
- package/lib/heatmap/models/grid.js +27 -70
- package/lib/heatmap/models/grid3d.js +28 -71
- package/lib/heatmap/models/heatmap.js +14 -40
- package/lib/heatmap/models/hexagon.js +28 -71
- package/lib/image/index.js +17 -29
- package/lib/image/models/dataImage.js +54 -95
- package/lib/image/models/image.js +67 -110
- package/lib/image/models/tileDataImage.js +43 -86
- package/lib/index.js +5 -5
- package/lib/line/index.js +26 -53
- package/lib/line/models/arc.js +38 -75
- package/lib/line/models/arc_3d.js +34 -71
- package/lib/line/models/earthArc_3d.js +37 -74
- package/lib/line/models/great_circle.js +29 -72
- package/lib/line/models/half.js +17 -40
- package/lib/line/models/index.js +3 -0
- package/lib/line/models/line.js +47 -81
- package/lib/line/models/linearline.js +31 -72
- package/lib/line/models/simpleLine.js +34 -73
- package/lib/line/models/simpleTileLine.js +30 -72
- package/lib/line/models/tile.js +17 -40
- package/lib/line/models/wall.js +22 -69
- package/lib/mask/index.js +99 -28
- package/lib/mask/models/fill.js +16 -40
- package/lib/mask/models/index.js +4 -1
- package/lib/plugins/DataMappingPlugin.js +149 -91
- package/lib/plugins/DataSourcePlugin.js +30 -76
- package/lib/plugins/FeatureScalePlugin.js +61 -87
- package/lib/plugins/LayerModelPlugin.js +41 -128
- package/lib/plugins/LayerStylePlugin.js +6 -1
- package/lib/plugins/MultiPassRendererPlugin.js +1 -1
- package/lib/plugins/PixelPickingPlugin.js +1 -1
- package/lib/plugins/RegisterStyleAttributePlugin.js +16 -1
- package/lib/plugins/UpdateModelPlugin.js +0 -3
- package/lib/plugins/UpdateStyleAttributePlugin.js +6 -3
- package/lib/point/index.js +24 -56
- package/lib/point/models/earthExtrude.js +30 -75
- package/lib/point/models/earthFill.js +21 -68
- package/lib/point/models/extrude.js +17 -40
- package/lib/point/models/fill.js +21 -44
- package/lib/point/models/fillmage.js +43 -84
- package/lib/point/models/image.js +31 -74
- package/lib/point/models/index.js +3 -0
- package/lib/point/models/normal.js +30 -73
- package/lib/point/models/radar.js +35 -77
- package/lib/point/models/simplePoint.js +29 -72
- package/lib/point/models/text.js +109 -183
- package/lib/point/models/tile.js +35 -79
- package/lib/point/models/tileText.js +115 -151
- package/lib/polygon/index.js +25 -29
- package/lib/polygon/models/extrude.js +32 -71
- package/lib/polygon/models/fill.js +43 -78
- package/lib/polygon/models/index.js +3 -0
- package/lib/polygon/models/ocean.js +28 -71
- package/lib/polygon/models/tile.js +30 -72
- package/lib/polygon/models/water.js +28 -71
- package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -1
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +2 -1
- package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +2 -1
- package/lib/raster/index.js +22 -30
- package/lib/raster/models/index.js +4 -1
- package/lib/raster/models/raster.js +13 -36
- package/lib/raster/models/rasterRgb.js +13 -36
- package/lib/raster/models/rasterTile.js +36 -79
- package/lib/raster/raster.js +22 -44
- package/lib/tile/interaction/TilePickService.js +143 -0
- package/lib/tile/interaction/utils.js +11 -3
- package/lib/tile/manager/base.js +47 -213
- package/lib/tile/manager/layerManager.js +275 -0
- package/lib/tile/manager/mapLayerManager.js +134 -0
- package/lib/tile/models/tileModel.js +94 -0
- package/lib/tile/render/TileRenderService.js +78 -0
- package/lib/tile/style/TileStyleService.js +133 -0
- package/lib/tile/style/constants.js +19 -8
- package/lib/tile/style/utils.js +140 -0
- package/lib/tile/tileFactory/base.js +427 -0
- package/lib/tile/tileFactory/index.js +24 -42
- package/lib/tile/tileFactory/layers/{RasterDataLayer.js → rasterDataLayer.js} +21 -35
- package/lib/tile/tileFactory/layers/{TileDebugLayer.js → tileTest.js} +11 -24
- package/lib/tile/tileFactory/layers/vectorLayer.js +268 -0
- package/lib/tile/tileFactory/line.js +70 -0
- package/lib/tile/tileFactory/mask.js +71 -0
- package/lib/tile/tileFactory/point.js +71 -0
- package/lib/tile/tileFactory/polygon.js +70 -0
- package/lib/tile/tileFactory/raster.js +68 -0
- package/lib/tile/tileFactory/rasterData.js +93 -0
- package/lib/tile/tileFactory/test.js +106 -0
- package/lib/tile/tileLayer/MapTileLayer.js +63 -0
- package/lib/tile/tileLayer/TileLayer.js +215 -0
- package/lib/tile/tileLayer/base.js +225 -0
- package/lib/tile/utils.js +148 -0
- package/lib/utils/dataMappingStyle.js +20 -18
- package/lib/utils/layerData.js +10 -4
- package/lib/wind/index.js +17 -29
- package/lib/wind/models/wind.js +104 -125
- package/package.json +7 -7
- package/es/core/LayerPickService.d.ts +0 -9
- package/es/core/LayerPickService.js +0 -85
- package/es/tile/service/TileLayerService.d.ts +0 -33
- package/es/tile/service/TileLayerService.js +0 -172
- package/es/tile/service/TilePickService.d.ts +0 -22
- package/es/tile/service/TilePickService.js +0 -148
- package/es/tile/service/TileSourceService.d.ts +0 -7
- package/es/tile/service/TileSourceService.js +0 -39
- package/es/tile/tileFactory/DebugTile.d.ts +0 -16
- package/es/tile/tileFactory/DebugTile.js +0 -100
- package/es/tile/tileFactory/ImageTile.d.ts +0 -14
- package/es/tile/tileFactory/ImageTile.js +0 -89
- package/es/tile/tileFactory/MaskTile.d.ts +0 -17
- package/es/tile/tileFactory/MaskTile.js +0 -98
- package/es/tile/tileFactory/RasterRGBTile.d.ts +0 -16
- package/es/tile/tileFactory/RasterRGBTile.js +0 -91
- package/es/tile/tileFactory/RasterTile.d.ts +0 -27
- package/es/tile/tileFactory/RasterTile.js +0 -186
- package/es/tile/tileFactory/Tile.d.ts +0 -34
- package/es/tile/tileFactory/Tile.js +0 -199
- package/es/tile/tileFactory/VectorTile.d.ts +0 -20
- package/es/tile/tileFactory/VectorTile.js +0 -152
- package/es/tile/tileFactory/util.d.ts +0 -6
- package/es/tile/tileFactory/util.js +0 -33
- package/es/tile/tileLayer/BaseLayer.d.ts +0 -46
- package/es/tile/tileLayer/BaseLayer.js +0 -358
- package/lib/core/LayerPickService.js +0 -96
- package/lib/tile/service/TileLayerService.js +0 -185
- package/lib/tile/service/TilePickService.js +0 -162
- package/lib/tile/service/TileSourceService.js +0 -59
- package/lib/tile/tileFactory/DebugTile.js +0 -115
- package/lib/tile/tileFactory/ImageTile.js +0 -104
- package/lib/tile/tileFactory/MaskTile.js +0 -113
- package/lib/tile/tileFactory/RasterRGBTile.js +0 -106
- package/lib/tile/tileFactory/RasterTile.js +0 -205
- package/lib/tile/tileFactory/Tile.js +0 -210
- package/lib/tile/tileFactory/VectorTile.js +0 -167
- package/lib/tile/tileFactory/util.js +0 -48
- package/lib/tile/tileLayer/BaseLayer.js +0 -373
package/es/core/BaseLayer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _initializerDefineProperty from "@babel/runtime/helpers/esm/initializerDefineProperty";
|
|
5
5
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
@@ -29,18 +29,17 @@ 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 {
|
|
32
|
+
import { SyncBailHook, SyncHook, SyncWaterfallHook } 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 { handleStyleDataMapping } 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";
|
|
44
43
|
/**
|
|
45
44
|
* 分配 layer id
|
|
46
45
|
*/
|
|
@@ -54,10 +53,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
54
53
|
// 生命周期钩子
|
|
55
54
|
// 待渲染 model 列表
|
|
56
55
|
// 用于保存子图层对象
|
|
56
|
+
// Tip: 用于标识矢量图层
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* 待更新样式属性,在初始化阶段完成注册
|
|
60
60
|
*/
|
|
61
|
+
// Tip: layer 保底颜色
|
|
61
62
|
// private pickingPassRender: IPass<'pixelPicking'>;
|
|
62
63
|
function BaseLayer() {
|
|
63
64
|
var _this;
|
|
@@ -108,10 +109,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
108
109
|
});
|
|
109
110
|
|
|
110
111
|
_defineProperty(_assertThisInitialized(_this), "hooks", {
|
|
111
|
-
init: new
|
|
112
|
+
init: new SyncBailHook(),
|
|
112
113
|
afterInit: new SyncBailHook(),
|
|
113
114
|
beforeRender: new SyncBailHook(),
|
|
114
|
-
beforeRenderData: new
|
|
115
|
+
beforeRenderData: new SyncWaterfallHook(),
|
|
115
116
|
afterRender: new SyncHook(),
|
|
116
117
|
beforePickingEncode: new SyncHook(),
|
|
117
118
|
afterPickingEncode: new SyncHook(),
|
|
@@ -125,12 +126,14 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
125
126
|
|
|
126
127
|
_defineProperty(_assertThisInitialized(_this), "models", []);
|
|
127
128
|
|
|
128
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
129
|
+
_defineProperty(_assertThisInitialized(_this), "modelLoaded", false);
|
|
129
130
|
|
|
130
131
|
_defineProperty(_assertThisInitialized(_this), "layerChildren", []);
|
|
131
132
|
|
|
132
133
|
_defineProperty(_assertThisInitialized(_this), "masks", []);
|
|
133
134
|
|
|
135
|
+
_defineProperty(_assertThisInitialized(_this), "isVector", false);
|
|
136
|
+
|
|
134
137
|
_initializerDefineProperty(_assertThisInitialized(_this), "configService", _descriptor, _assertThisInitialized(_this));
|
|
135
138
|
|
|
136
139
|
_defineProperty(_assertThisInitialized(_this), "animateOptions", {
|
|
@@ -145,6 +148,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
145
148
|
|
|
146
149
|
_defineProperty(_assertThisInitialized(_this), "animateStatus", false);
|
|
147
150
|
|
|
151
|
+
_defineProperty(_assertThisInitialized(_this), "bottomColor", 'rgba(0, 0, 0, 0)');
|
|
152
|
+
|
|
148
153
|
_defineProperty(_assertThisInitialized(_this), "isDestroyed", false);
|
|
149
154
|
|
|
150
155
|
_defineProperty(_assertThisInitialized(_this), "encodeDataLength", 0);
|
|
@@ -158,17 +163,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
158
163
|
_this.fitBounds(layerConfig.fitBoundsOptions);
|
|
159
164
|
}
|
|
160
165
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if (autoRender) {
|
|
164
|
-
_this.reRender();
|
|
165
|
-
}
|
|
166
|
+
_this.reRender();
|
|
166
167
|
});
|
|
167
168
|
|
|
168
169
|
_this.name = config.name || _this.id;
|
|
169
170
|
_this.zIndex = config.zIndex || 0;
|
|
170
|
-
_this.rawConfig = config;
|
|
171
|
-
|
|
171
|
+
_this.rawConfig = config;
|
|
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.inited) {
|
|
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
|
+
handleStyleDataMapping(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,6 +240,16 @@ 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
|
+
}
|
|
243
253
|
}, {
|
|
244
254
|
key: "addPlugin",
|
|
245
255
|
value: function addPlugin(plugin) {
|
|
@@ -248,131 +258,105 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
248
258
|
}
|
|
249
259
|
}, {
|
|
250
260
|
key: "init",
|
|
251
|
-
value: function () {
|
|
252
|
-
var
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
// Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom
|
|
284
|
-
this.mapService.on('mapAfterFrameChange', function () {
|
|
285
|
-
_this3.renderLayers();
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
|
|
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
|
-
}
|
|
261
|
+
value: function init() {
|
|
262
|
+
var _this3 = this;
|
|
263
|
+
|
|
264
|
+
// 设置配置项
|
|
265
|
+
var sceneId = this.container.get(TYPES.SceneID); // 初始化图层配置项
|
|
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(TYPES.IIconService);
|
|
276
|
+
this.fontService = this.container.get(TYPES.IFontService);
|
|
277
|
+
this.rendererService = this.container.get(TYPES.IRendererService);
|
|
278
|
+
this.layerService = this.container.get(TYPES.ILayerService);
|
|
279
|
+
this.interactionService = this.container.get(TYPES.IInteractionService);
|
|
280
|
+
this.pickingService = this.container.get(TYPES.IPickingService);
|
|
281
|
+
this.mapService = this.container.get(TYPES.IMapService);
|
|
282
|
+
|
|
283
|
+
var _this$getLayerConfig = this.getLayerConfig(),
|
|
284
|
+
enableMultiPassRenderer = _this$getLayerConfig.enableMultiPassRenderer,
|
|
285
|
+
passes = _this$getLayerConfig.passes;
|
|
286
|
+
|
|
287
|
+
if (enableMultiPassRenderer && passes !== null && passes !== void 0 && passes.length && passes.length > 0) {
|
|
288
|
+
// Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom
|
|
289
|
+
this.mapService.on('mapAfterFrameChange', function () {
|
|
290
|
+
_this3.renderLayers();
|
|
291
|
+
});
|
|
292
|
+
}
|
|
343
293
|
|
|
344
|
-
|
|
294
|
+
this.cameraService = this.container.get(TYPES.ICameraService);
|
|
295
|
+
this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
|
|
296
|
+
this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
|
|
297
|
+
this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
|
|
298
|
+
this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass); // 图层容器服务
|
|
345
299
|
|
|
346
|
-
|
|
347
|
-
|
|
300
|
+
this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService);
|
|
301
|
+
this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
|
|
302
|
+
this.multiPassRenderer.setLayer(this); // 完成样式服务注册完成前添加的属性
|
|
348
303
|
|
|
349
|
-
|
|
350
|
-
|
|
304
|
+
this.pendingStyleAttributes.forEach(function (_ref2) {
|
|
305
|
+
var attributeName = _ref2.attributeName,
|
|
306
|
+
attributeField = _ref2.attributeField,
|
|
307
|
+
attributeValues = _ref2.attributeValues,
|
|
308
|
+
updateOptions = _ref2.updateOptions;
|
|
351
309
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
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
|
+
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
|
+
}
|
|
361
344
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
return _context.stop();
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}, _callee, this);
|
|
368
|
-
}));
|
|
345
|
+
this.hooks.init.call(); // this.pickingPassRender = this.normalPassFactory('pixelPicking');
|
|
346
|
+
// this.pickingPassRender.init(this);
|
|
369
347
|
|
|
370
|
-
|
|
371
|
-
return _init.apply(this, arguments);
|
|
372
|
-
}
|
|
348
|
+
this.hooks.afterInit.call(); // 触发初始化完成事件;
|
|
373
349
|
|
|
374
|
-
|
|
375
|
-
|
|
350
|
+
this.emit('inited', {
|
|
351
|
+
target: this,
|
|
352
|
+
type: 'inited'
|
|
353
|
+
});
|
|
354
|
+
this.emit('add', {
|
|
355
|
+
target: this,
|
|
356
|
+
type: 'add'
|
|
357
|
+
});
|
|
358
|
+
return this;
|
|
359
|
+
}
|
|
376
360
|
}, {
|
|
377
361
|
key: "updateModelData",
|
|
378
362
|
value: function updateModelData(data) {
|
|
@@ -406,11 +390,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
406
390
|
};
|
|
407
391
|
}
|
|
408
392
|
}
|
|
409
|
-
}, {
|
|
410
|
-
key: "setLayerPickService",
|
|
411
|
-
value: function setLayerPickService(layerPickService) {
|
|
412
|
-
this.layerPickService = layerPickService;
|
|
413
|
-
}
|
|
414
393
|
}, {
|
|
415
394
|
key: "calculateEncodeData",
|
|
416
395
|
value: function calculateEncodeData(data, option) {
|
|
@@ -428,7 +407,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
428
407
|
}, {
|
|
429
408
|
key: "prepareBuildModel",
|
|
430
409
|
value: function prepareBuildModel() {
|
|
431
|
-
this.
|
|
410
|
+
this.inited = true;
|
|
411
|
+
this.updateLayerConfig(_objectSpread(_objectSpread({}, this.getDefaultConfig()), this.rawConfig)); // 启动动画
|
|
432
412
|
|
|
433
413
|
var _this$getLayerConfig2 = this.getLayerConfig(),
|
|
434
414
|
animateOption = _this$getLayerConfig2.animateOption;
|
|
@@ -524,8 +504,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
524
504
|
// 判断是否为source
|
|
525
505
|
this.setSource(data);
|
|
526
506
|
return this;
|
|
527
|
-
}
|
|
528
|
-
|
|
507
|
+
}
|
|
529
508
|
|
|
530
509
|
this.sourceOption = {
|
|
531
510
|
data: data,
|
|
@@ -548,6 +527,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
548
527
|
if (!currentSource) {
|
|
549
528
|
// 执行 setData 的时候 source 还不存在(还未执行 addLayer)
|
|
550
529
|
_this4.source(new Source(data, options));
|
|
530
|
+
|
|
531
|
+
_this4.sourceEvent();
|
|
551
532
|
} else {
|
|
552
533
|
_this4.layerSource.setData(data, options);
|
|
553
534
|
} // this.layerSource.setData(data, options);
|
|
@@ -562,6 +543,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
562
543
|
value: function style(options) {
|
|
563
544
|
var _this5 = this;
|
|
564
545
|
|
|
546
|
+
var lastConfig = this.getLayerConfig();
|
|
547
|
+
|
|
565
548
|
var passes = options.passes,
|
|
566
549
|
rest = _objectWithoutProperties(options, _excluded); // passes 特殊处理
|
|
567
550
|
|
|
@@ -581,16 +564,16 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
581
564
|
if (this.container) {
|
|
582
565
|
this.updateLayerConfig(this.rawConfig);
|
|
583
566
|
this.styleNeedUpdate = true;
|
|
584
|
-
} //
|
|
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
|
-
// }
|
|
567
|
+
} // @ts-ignore
|
|
592
568
|
|
|
593
569
|
|
|
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
|
+
|
|
594
577
|
return this;
|
|
595
578
|
}
|
|
596
579
|
}, {
|
|
@@ -624,8 +607,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
624
607
|
return this;
|
|
625
608
|
}
|
|
626
609
|
|
|
627
|
-
this.layerService.beforeRenderData(this);
|
|
628
|
-
|
|
629
610
|
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
630
611
|
return this;
|
|
631
612
|
} // Tip: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
@@ -641,24 +622,32 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
641
622
|
}, {
|
|
642
623
|
key: "renderMultiPass",
|
|
643
624
|
value: function () {
|
|
644
|
-
var _renderMultiPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
645
|
-
return _regeneratorRuntime.wrap(function
|
|
625
|
+
var _renderMultiPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
626
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
646
627
|
while (1) {
|
|
647
|
-
switch (
|
|
628
|
+
switch (_context.prev = _context.next) {
|
|
648
629
|
case 0:
|
|
630
|
+
if (!(this.encodeDataLength <= 0 && !this.forceRender)) {
|
|
631
|
+
_context.next = 2;
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
return _context.abrupt("return");
|
|
636
|
+
|
|
637
|
+
case 2:
|
|
649
638
|
if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
|
|
650
|
-
|
|
639
|
+
_context.next = 7;
|
|
651
640
|
break;
|
|
652
641
|
}
|
|
653
642
|
|
|
654
|
-
|
|
643
|
+
_context.next = 5;
|
|
655
644
|
return this.multiPassRenderer.render();
|
|
656
645
|
|
|
657
|
-
case
|
|
658
|
-
|
|
646
|
+
case 5:
|
|
647
|
+
_context.next = 8;
|
|
659
648
|
break;
|
|
660
649
|
|
|
661
|
-
case
|
|
650
|
+
case 7:
|
|
662
651
|
if (this.multiPassRenderer) {
|
|
663
652
|
// renderPass 触发的渲染
|
|
664
653
|
this.renderModels();
|
|
@@ -666,12 +655,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
666
655
|
this.renderModels();
|
|
667
656
|
}
|
|
668
657
|
|
|
669
|
-
case
|
|
658
|
+
case 8:
|
|
670
659
|
case "end":
|
|
671
|
-
return
|
|
660
|
+
return _context.stop();
|
|
672
661
|
}
|
|
673
662
|
}
|
|
674
|
-
},
|
|
663
|
+
}, _callee, this);
|
|
675
664
|
}));
|
|
676
665
|
|
|
677
666
|
function renderMultiPass() {
|
|
@@ -1035,14 +1024,13 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1035
1024
|
return !!(this.styleAttributeService.getLayerStyleAttributes() || []).filter(function (attribute) {
|
|
1036
1025
|
return attribute.needRescale || attribute.needRemapping || attribute.needRegenerateVertices;
|
|
1037
1026
|
}).length;
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1027
|
+
}
|
|
1040
1028
|
}, {
|
|
1041
1029
|
key: "setSource",
|
|
1042
1030
|
value: function setSource(source) {
|
|
1043
1031
|
var _this8 = this;
|
|
1044
1032
|
|
|
1045
|
-
//
|
|
1033
|
+
// 清除旧 sources 事件
|
|
1046
1034
|
if (this.layerSource) {
|
|
1047
1035
|
this.layerSource.off('update', this.sourceEvent);
|
|
1048
1036
|
}
|
|
@@ -1053,16 +1041,15 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1053
1041
|
if (this.inited && this.layerSource.cluster) {
|
|
1054
1042
|
var zoom = this.mapService.getZoom();
|
|
1055
1043
|
this.layerSource.updateClusterData(zoom);
|
|
1056
|
-
}
|
|
1044
|
+
} // source 可能会复用,会在其它layer被修改
|
|
1045
|
+
|
|
1057
1046
|
|
|
1058
1047
|
if (this.layerSource.inited) {
|
|
1059
1048
|
this.sourceEvent();
|
|
1060
1049
|
} // this.layerSource.inited 为 true update 事件不会再触发
|
|
1061
1050
|
|
|
1062
1051
|
|
|
1063
|
-
this.layerSource.on('update', function (
|
|
1064
|
-
var type = _ref3.type;
|
|
1065
|
-
|
|
1052
|
+
this.layerSource.on('update', function () {
|
|
1066
1053
|
if (_this8.coordCenter === undefined) {
|
|
1067
1054
|
var _this8$mapService;
|
|
1068
1055
|
|
|
@@ -1074,45 +1061,13 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1074
1061
|
}
|
|
1075
1062
|
}
|
|
1076
1063
|
|
|
1077
|
-
|
|
1078
|
-
// source 初始化不需要处理
|
|
1079
|
-
_this8.sourceEvent();
|
|
1080
|
-
}
|
|
1064
|
+
_this8.sourceEvent();
|
|
1081
1065
|
});
|
|
1082
|
-
} // layer 初始化source
|
|
1083
|
-
|
|
1084
|
-
}, {
|
|
1085
|
-
key: "initSource",
|
|
1086
|
-
value: function initSource(source) {
|
|
1087
|
-
this.layerSource = source;
|
|
1088
|
-
this.clusterZoom = 0;
|
|
1089
|
-
this.addSourceEvent();
|
|
1090
1066
|
}
|
|
1091
1067
|
}, {
|
|
1092
1068
|
key: "getSource",
|
|
1093
1069
|
value: function getSource() {
|
|
1094
1070
|
return this.layerSource;
|
|
1095
|
-
} // 注册source 更新事件
|
|
1096
|
-
|
|
1097
|
-
}, {
|
|
1098
|
-
key: "addSourceEvent",
|
|
1099
|
-
value: function addSourceEvent() {
|
|
1100
|
-
var _this9 = this;
|
|
1101
|
-
|
|
1102
|
-
this.layerSource.on('update', function () {
|
|
1103
|
-
if (_this9.coordCenter === undefined) {
|
|
1104
|
-
var _this9$mapService;
|
|
1105
|
-
|
|
1106
|
-
var layerCenter = _this9.layerSource.center;
|
|
1107
|
-
_this9.coordCenter = layerCenter;
|
|
1108
|
-
|
|
1109
|
-
if ((_this9$mapService = _this9.mapService) !== null && _this9$mapService !== void 0 && _this9$mapService.setCoordCenter) {
|
|
1110
|
-
_this9.mapService.setCoordCenter(layerCenter);
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
_this9.sourceEvent();
|
|
1115
|
-
});
|
|
1116
1071
|
}
|
|
1117
1072
|
}, {
|
|
1118
1073
|
key: "getScaleOptions",
|
|
@@ -1191,9 +1146,9 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1191
1146
|
}
|
|
1192
1147
|
}, {
|
|
1193
1148
|
key: "pick",
|
|
1194
|
-
value: function pick(
|
|
1195
|
-
var x =
|
|
1196
|
-
y =
|
|
1149
|
+
value: function pick(_ref6) {
|
|
1150
|
+
var x = _ref6.x,
|
|
1151
|
+
y = _ref6.y;
|
|
1197
1152
|
this.interactionService.triggerHover({
|
|
1198
1153
|
x: x,
|
|
1199
1154
|
y: y
|
|
@@ -1206,79 +1161,76 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1206
1161
|
}
|
|
1207
1162
|
}, {
|
|
1208
1163
|
key: "buildLayerModel",
|
|
1209
|
-
value: function () {
|
|
1210
|
-
var
|
|
1211
|
-
var _this10 = this;
|
|
1212
|
-
|
|
1213
|
-
var moduleName, vertexShader, fragmentShader, triangulation, segmentNumber, _options$workerEnable, workerEnabled, workerOptions, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
|
|
1164
|
+
value: function buildLayerModel(options) {
|
|
1165
|
+
var _this9 = this;
|
|
1214
1166
|
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
_this10.styleAttributeService.createAttributesAndIndicesAscy(_this10.encodedData, segmentNumber, workerOptions).then(function (_ref8) {
|
|
1230
|
-
var attributes = _ref8.attributes,
|
|
1231
|
-
elements = _ref8.elements;
|
|
1232
|
-
var m = createModel(_objectSpread({
|
|
1233
|
-
attributes: attributes,
|
|
1234
|
-
uniforms: uniforms,
|
|
1235
|
-
fs: fs,
|
|
1236
|
-
vs: vs,
|
|
1237
|
-
elements: elements,
|
|
1238
|
-
blend: BlendTypes[BlendType.normal]
|
|
1239
|
-
}, rest));
|
|
1240
|
-
resolve(m);
|
|
1241
|
-
}).catch(function (err) {
|
|
1242
|
-
return reject(err);
|
|
1243
|
-
});
|
|
1244
|
-
} else {
|
|
1245
|
-
var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, segmentNumber),
|
|
1246
|
-
attributes = _this10$styleAttribut.attributes,
|
|
1247
|
-
elements = _this10$styleAttribut.elements,
|
|
1248
|
-
count = _this10$styleAttribut.count;
|
|
1249
|
-
|
|
1250
|
-
var modelOptions = _objectSpread({
|
|
1251
|
-
attributes: attributes,
|
|
1252
|
-
uniforms: uniforms,
|
|
1253
|
-
fs: fs,
|
|
1254
|
-
vs: vs,
|
|
1255
|
-
elements: elements,
|
|
1256
|
-
blend: BlendTypes[BlendType.normal]
|
|
1257
|
-
}, rest);
|
|
1258
|
-
|
|
1259
|
-
if (count) {
|
|
1260
|
-
modelOptions.count = count;
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
var m = createModel(modelOptions);
|
|
1264
|
-
resolve(m);
|
|
1265
|
-
}
|
|
1266
|
-
}));
|
|
1167
|
+
var moduleName = options.moduleName,
|
|
1168
|
+
vertexShader = options.vertexShader,
|
|
1169
|
+
fragmentShader = options.fragmentShader,
|
|
1170
|
+
triangulation = options.triangulation,
|
|
1171
|
+
segmentNumber = options.segmentNumber,
|
|
1172
|
+
_options$workerEnable = options.workerEnabled,
|
|
1173
|
+
workerEnabled = _options$workerEnable === void 0 ? false : _options$workerEnable,
|
|
1174
|
+
workerOptions = options.workerOptions,
|
|
1175
|
+
rest = _objectWithoutProperties(options, _excluded2);
|
|
1176
|
+
|
|
1177
|
+
this.shaderModuleService.registerModule(moduleName, {
|
|
1178
|
+
vs: vertexShader,
|
|
1179
|
+
fs: fragmentShader
|
|
1180
|
+
});
|
|
1267
1181
|
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1182
|
+
var _this$shaderModuleSer = this.shaderModuleService.getModule(moduleName),
|
|
1183
|
+
vs = _this$shaderModuleSer.vs,
|
|
1184
|
+
fs = _this$shaderModuleSer.fs,
|
|
1185
|
+
uniforms = _this$shaderModuleSer.uniforms;
|
|
1186
|
+
|
|
1187
|
+
var createModel = this.rendererService.createModel;
|
|
1188
|
+
return new Promise(function (resolve, reject) {
|
|
1189
|
+
setTimeout(function () {
|
|
1190
|
+
// filter supported worker & worker enabled layer
|
|
1191
|
+
if (workerOptions && workerOptions.modelType in WorkerSourceMap && workerEnabled) {
|
|
1192
|
+
_this9.styleAttributeService.createAttributesAndIndicesAscy(_this9.encodedData, segmentNumber, workerOptions).then(function (_ref7) {
|
|
1193
|
+
var attributes = _ref7.attributes,
|
|
1194
|
+
elements = _ref7.elements;
|
|
1195
|
+
var m = createModel(_objectSpread({
|
|
1196
|
+
attributes: attributes,
|
|
1197
|
+
uniforms: uniforms,
|
|
1198
|
+
fs: fs,
|
|
1199
|
+
vs: vs,
|
|
1200
|
+
elements: elements,
|
|
1201
|
+
blend: BlendTypes[BlendType.normal]
|
|
1202
|
+
}, rest));
|
|
1203
|
+
resolve(m);
|
|
1204
|
+
}).catch(function (err) {
|
|
1205
|
+
return reject(err);
|
|
1206
|
+
});
|
|
1207
|
+
} else {
|
|
1208
|
+
// console.log(this.encodedData[1].originCoordinates[0])
|
|
1209
|
+
// console.log(this.encodedData[1].coordinates[0])
|
|
1210
|
+
var _this9$styleAttribute = _this9.styleAttributeService.createAttributesAndIndices(_this9.encodedData, triangulation, segmentNumber),
|
|
1211
|
+
attributes = _this9$styleAttribute.attributes,
|
|
1212
|
+
elements = _this9$styleAttribute.elements,
|
|
1213
|
+
count = _this9$styleAttribute.count;
|
|
1214
|
+
|
|
1215
|
+
var modelOptions = _objectSpread({
|
|
1216
|
+
attributes: attributes,
|
|
1217
|
+
uniforms: uniforms,
|
|
1218
|
+
fs: fs,
|
|
1219
|
+
vs: vs,
|
|
1220
|
+
elements: elements,
|
|
1221
|
+
blend: BlendTypes[BlendType.normal]
|
|
1222
|
+
}, rest);
|
|
1223
|
+
|
|
1224
|
+
if (count) {
|
|
1225
|
+
modelOptions.count = count;
|
|
1271
1226
|
}
|
|
1272
|
-
}
|
|
1273
|
-
}, _callee3, this);
|
|
1274
|
-
}));
|
|
1275
1227
|
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
}
|
|
1228
|
+
var m = createModel(modelOptions);
|
|
1229
|
+
resolve(m);
|
|
1230
|
+
}
|
|
1231
|
+
});
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1282
1234
|
}, {
|
|
1283
1235
|
key: "createAttributes",
|
|
1284
1236
|
value: function createAttributes(options) {
|
|
@@ -1320,6 +1272,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1320
1272
|
}, {
|
|
1321
1273
|
key: "needPick",
|
|
1322
1274
|
value: function needPick(type) {
|
|
1275
|
+
// 地图图层的判断
|
|
1276
|
+
if (this.rawConfig.usage === 'basemap') {
|
|
1277
|
+
return false;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1323
1280
|
var _this$getLayerConfig10 = this.getLayerConfig(),
|
|
1324
1281
|
_this$getLayerConfig11 = _this$getLayerConfig10.enableHighlight,
|
|
1325
1282
|
enableHighlight = _this$getLayerConfig11 === void 0 ? true : _this$getLayerConfig11,
|
|
@@ -1341,73 +1298,34 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1341
1298
|
}
|
|
1342
1299
|
}, {
|
|
1343
1300
|
key: "buildModels",
|
|
1344
|
-
value: function () {
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
while (1) {
|
|
1348
|
-
switch (_context4.prev = _context4.next) {
|
|
1349
|
-
case 0:
|
|
1350
|
-
throw new Error('Method not implemented.');
|
|
1351
|
-
|
|
1352
|
-
case 1:
|
|
1353
|
-
case "end":
|
|
1354
|
-
return _context4.stop();
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
}, _callee4);
|
|
1358
|
-
}));
|
|
1359
|
-
|
|
1360
|
-
function buildModels() {
|
|
1361
|
-
return _buildModels.apply(this, arguments);
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
return buildModels;
|
|
1365
|
-
}()
|
|
1301
|
+
value: function buildModels() {
|
|
1302
|
+
throw new Error('Method not implemented.');
|
|
1303
|
+
}
|
|
1366
1304
|
}, {
|
|
1367
1305
|
key: "rebuildModels",
|
|
1368
|
-
value: function () {
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
while (1) {
|
|
1372
|
-
switch (_context5.prev = _context5.next) {
|
|
1373
|
-
case 0:
|
|
1374
|
-
_context5.next = 2;
|
|
1375
|
-
return this.buildModels();
|
|
1376
|
-
|
|
1377
|
-
case 2:
|
|
1378
|
-
case "end":
|
|
1379
|
-
return _context5.stop();
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
}, _callee5, this);
|
|
1383
|
-
}));
|
|
1384
|
-
|
|
1385
|
-
function rebuildModels() {
|
|
1386
|
-
return _rebuildModels.apply(this, arguments);
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
return rebuildModels;
|
|
1390
|
-
}()
|
|
1306
|
+
value: function rebuildModels() {
|
|
1307
|
+
throw new Error('Method not implemented.');
|
|
1308
|
+
}
|
|
1391
1309
|
}, {
|
|
1392
1310
|
key: "renderMulPass",
|
|
1393
1311
|
value: function () {
|
|
1394
|
-
var _renderMulPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1395
|
-
return _regeneratorRuntime.wrap(function
|
|
1312
|
+
var _renderMulPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(multiPassRenderer) {
|
|
1313
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
1396
1314
|
while (1) {
|
|
1397
|
-
switch (
|
|
1315
|
+
switch (_context2.prev = _context2.next) {
|
|
1398
1316
|
case 0:
|
|
1399
|
-
|
|
1317
|
+
_context2.next = 2;
|
|
1400
1318
|
return multiPassRenderer.render();
|
|
1401
1319
|
|
|
1402
1320
|
case 2:
|
|
1403
1321
|
case "end":
|
|
1404
|
-
return
|
|
1322
|
+
return _context2.stop();
|
|
1405
1323
|
}
|
|
1406
1324
|
}
|
|
1407
|
-
},
|
|
1325
|
+
}, _callee2);
|
|
1408
1326
|
}));
|
|
1409
1327
|
|
|
1410
|
-
function renderMulPass(
|
|
1328
|
+
function renderMulPass(_x) {
|
|
1411
1329
|
return _renderMulPass.apply(this, arguments);
|
|
1412
1330
|
}
|
|
1413
1331
|
|
|
@@ -1416,35 +1334,34 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1416
1334
|
}, {
|
|
1417
1335
|
key: "renderModels",
|
|
1418
1336
|
value: function renderModels(isPicking) {
|
|
1419
|
-
var
|
|
1337
|
+
var _this10 = this;
|
|
1420
1338
|
|
|
1421
1339
|
// TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
1422
1340
|
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
1423
1341
|
return this;
|
|
1424
1342
|
}
|
|
1425
1343
|
|
|
1426
|
-
this.
|
|
1344
|
+
if (this.layerModelNeedUpdate && this.layerModel) {
|
|
1345
|
+
this.layerModel.buildModels(function (models) {
|
|
1346
|
+
_this10.models = models;
|
|
1347
|
+
|
|
1348
|
+
_this10.hooks.beforeRender.call();
|
|
1349
|
+
|
|
1350
|
+
_this10.layerModelNeedUpdate = false;
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1427
1354
|
this.models.forEach(function (model) {
|
|
1428
1355
|
model.draw({
|
|
1429
|
-
uniforms:
|
|
1356
|
+
uniforms: _this10.layerModel.getUninforms()
|
|
1430
1357
|
}, isPicking);
|
|
1431
1358
|
});
|
|
1432
|
-
this.hooks.afterRender.call();
|
|
1433
1359
|
return this;
|
|
1434
1360
|
}
|
|
1435
1361
|
}, {
|
|
1436
1362
|
key: "updateStyleAttribute",
|
|
1437
1363
|
value: function updateStyleAttribute(type, field, values, updateOptions) {
|
|
1438
|
-
|
|
1439
|
-
if (['color', 'size', 'texture', 'rotate', 'filter', 'label', 'shape'].indexOf(type) !== -1) {
|
|
1440
|
-
this.configService.setAttributeConfig(this.id, _defineProperty({}, type, {
|
|
1441
|
-
field: field,
|
|
1442
|
-
values: values
|
|
1443
|
-
}));
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
if (!this.startInit) {
|
|
1447
|
-
// 开始初始化执行
|
|
1364
|
+
if (!this.inited) {
|
|
1448
1365
|
this.pendingStyleAttributes.push({
|
|
1449
1366
|
attributeName: type,
|
|
1450
1367
|
attributeField: field,
|
|
@@ -1463,11 +1380,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1463
1380
|
updateOptions);
|
|
1464
1381
|
}
|
|
1465
1382
|
}
|
|
1466
|
-
}, {
|
|
1467
|
-
key: "getLayerAttributeConfig",
|
|
1468
|
-
value: function getLayerAttributeConfig() {
|
|
1469
|
-
return this.configService.getAttributeConfig(this.id);
|
|
1470
|
-
}
|
|
1471
1383
|
}, {
|
|
1472
1384
|
key: "getShaderPickStat",
|
|
1473
1385
|
value: function getShaderPickStat() {
|
|
@@ -1483,13 +1395,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1483
1395
|
key: "setEarthTime",
|
|
1484
1396
|
value: function setEarthTime(time) {
|
|
1485
1397
|
console.warn('empty fn');
|
|
1486
|
-
} // 数据处理 在数据进行 mapping 生成 encodeData 之前对数据进行处理
|
|
1487
|
-
// 在各个 layer 中继承
|
|
1488
|
-
|
|
1489
|
-
}, {
|
|
1490
|
-
key: "processData",
|
|
1491
|
-
value: function processData(filterData) {
|
|
1492
|
-
return filterData;
|
|
1493
1398
|
}
|
|
1494
1399
|
}, {
|
|
1495
1400
|
key: "getModelType",
|
|
@@ -1502,37 +1407,23 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1502
1407
|
return {};
|
|
1503
1408
|
}
|
|
1504
1409
|
}, {
|
|
1505
|
-
key: "
|
|
1506
|
-
value: function () {
|
|
1507
|
-
var
|
|
1508
|
-
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
1509
|
-
while (1) {
|
|
1510
|
-
switch (_context7.prev = _context7.next) {
|
|
1511
|
-
case 0:
|
|
1512
|
-
this.models.forEach(function (model) {
|
|
1513
|
-
return model.destroy();
|
|
1514
|
-
});
|
|
1515
|
-
this.models = [];
|
|
1516
|
-
_context7.next = 4;
|
|
1517
|
-
return this.layerModel.initModels();
|
|
1518
|
-
|
|
1519
|
-
case 4:
|
|
1520
|
-
this.models = _context7.sent;
|
|
1521
|
-
|
|
1522
|
-
case 5:
|
|
1523
|
-
case "end":
|
|
1524
|
-
return _context7.stop();
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
}, _callee7, this);
|
|
1528
|
-
}));
|
|
1410
|
+
key: "dispatchModelLoad",
|
|
1411
|
+
value: function dispatchModelLoad(models) {
|
|
1412
|
+
var _this11 = this;
|
|
1529
1413
|
|
|
1530
|
-
function
|
|
1531
|
-
return
|
|
1532
|
-
}
|
|
1414
|
+
this.models.forEach(function (model) {
|
|
1415
|
+
return model.destroy();
|
|
1416
|
+
});
|
|
1417
|
+
this.models = [];
|
|
1418
|
+
this.models = models;
|
|
1419
|
+
this.emit('modelLoaded', null);
|
|
1420
|
+
this.modelLoaded = true; // Tip: setTimeout 用于延迟绘制,可以让拖动图层时连续的 setData 更加平滑 - L7Draw
|
|
1533
1421
|
|
|
1534
|
-
|
|
1535
|
-
|
|
1422
|
+
setTimeout(function () {
|
|
1423
|
+
// Tip: 使用 renderLayers 而不是 throttleRenderLayers,让图层之间的 setData 更新绘制不存在延迟
|
|
1424
|
+
_this11.layerService.renderLayers();
|
|
1425
|
+
}, 32);
|
|
1426
|
+
}
|
|
1536
1427
|
}, {
|
|
1537
1428
|
key: "reRender",
|
|
1538
1429
|
value: function reRender() {
|