@antv/l7-layers 2.17.4 → 2.17.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.js +9 -31
- package/es/Geometry/models/billboard.js +51 -89
- package/es/Geometry/models/plane.js +81 -143
- package/es/Geometry/models/sprite.js +60 -118
- package/es/canvas/index.js +10 -33
- package/es/canvas/models/canvas.js +41 -97
- package/es/citybuliding/building.js +8 -27
- package/es/citybuliding/models/build.js +57 -82
- package/es/core/BaseLayer.js +325 -483
- package/es/core/BaseModel.js +51 -80
- package/es/core/CommonStyleAttribute.js +2 -5
- package/es/core/LayerPickService.js +21 -32
- package/es/core/TextureService.js +0 -13
- package/es/core/interface.js +17 -24
- package/es/core/shape/Path.js +13 -20
- package/es/core/shape/extrude.js +27 -39
- package/es/core/triangulation.js +99 -136
- package/es/earth/index.js +9 -33
- package/es/earth/models/atmosphere.js +30 -54
- package/es/earth/models/base.js +47 -85
- package/es/earth/models/bloomsphere.js +30 -54
- package/es/earth/utils.js +9 -13
- package/es/heatmap/index.js +10 -40
- package/es/heatmap/models/grid.js +28 -52
- package/es/heatmap/models/grid3d.js +28 -52
- package/es/heatmap/models/heatmap.js +92 -149
- package/es/heatmap/models/hexagon.js +28 -52
- package/es/heatmap/triangulation.js +0 -4
- package/es/image/index.js +9 -28
- package/es/image/models/image.js +66 -100
- package/es/index.js +9 -17
- package/es/line/index.js +9 -35
- package/es/line/models/arc.js +63 -112
- package/es/line/models/arc_3d.js +58 -102
- package/es/line/models/earthArc_3d.js +60 -105
- package/es/line/models/flow.js +36 -60
- package/es/line/models/great_circle.js +53 -94
- package/es/line/models/line.js +92 -144
- package/es/line/models/linearline.js +42 -74
- package/es/line/models/simpleLine.js +38 -67
- package/es/line/models/wall.js +52 -92
- package/es/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/es/line/shaders/line_frag.glsl +1 -3
- package/es/line/shaders/line_vert.glsl +2 -0
- package/es/line/shaders/linear/line_linear_frag.glsl +1 -1
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +78 -114
- package/es/plugins/DataSourcePlugin.js +45 -68
- package/es/plugins/FeatureScalePlugin.js +67 -122
- package/es/plugins/LayerAnimateStylePlugin.js +0 -5
- package/es/plugins/LayerMaskPlugin.js +3 -11
- package/es/plugins/LayerModelPlugin.js +69 -118
- package/es/plugins/LayerStylePlugin.js +4 -9
- package/es/plugins/LightingPlugin.js +12 -18
- package/es/plugins/MultiPassRendererPlugin.js +11 -16
- package/es/plugins/PixelPickingPlugin.js +12 -21
- package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
- package/es/plugins/ShaderUniformPlugin.js +13 -27
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.js +26 -78
- package/es/point/models/earthExtrude.js +58 -95
- package/es/point/models/earthFill.js +52 -80
- package/es/point/models/extrude.js +57 -94
- package/es/point/models/fill.js +56 -81
- package/es/point/models/fillmage.js +60 -100
- package/es/point/models/image.js +47 -83
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +38 -63
- package/es/point/models/simplePoint.js +38 -62
- package/es/point/models/text.js +199 -296
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -41
- package/es/polygon/models/extrude.js +87 -135
- package/es/polygon/models/fill.js +50 -79
- package/es/polygon/models/index.js +3 -2
- package/es/polygon/models/ocean.js +42 -76
- package/es/polygon/models/water.js +37 -71
- package/es/raster/buffers/triangulation.js +2 -4
- package/es/raster/index.js +9 -32
- package/es/raster/models/raster.js +80 -116
- package/es/raster/models/rasterRgb.js +84 -127
- package/es/raster/models/rasterTerrainRgb.js +56 -84
- package/es/tile/interaction/getRasterData.js +14 -20
- package/es/tile/interaction/utils.js +7 -9
- package/es/tile/manager/base.js +63 -96
- package/es/tile/service/TileLayerService.js +33 -55
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +29 -46
- package/es/tile/tileFactory/ImageTile.js +20 -38
- package/es/tile/tileFactory/MaskTile.js +22 -43
- package/es/tile/tileFactory/RasterRGBTile.js +22 -42
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
- package/es/tile/tileFactory/RasterTile.js +30 -53
- package/es/tile/tileFactory/Tile.js +63 -97
- package/es/tile/tileFactory/VectorTile.js +41 -68
- package/es/tile/tileFactory/index.js +0 -11
- package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
- package/es/tile/tileFactory/util.js +0 -3
- package/es/tile/tileLayer/BaseLayer.js +105 -146
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +0 -2
- package/es/utils/collision-index.js +9 -16
- package/es/utils/extrude_polyline.js +101 -149
- package/es/utils/grid-index.js +2 -27
- package/es/utils/identityScale.js +0 -8
- package/es/utils/layerData.js +30 -44
- package/es/utils/multiPassRender.js +11 -13
- package/es/utils/polylineNormal.js +31 -37
- package/es/utils/simpleLine.js +2 -16
- package/es/utils/stencil.js +2 -3
- package/es/utils/symbol-layout.js +27 -53
- package/es/wind/index.js +9 -29
- package/es/wind/models/utils.js +26 -51
- package/es/wind/models/wind.js +101 -147
- package/es/wind/models/windRender.js +53 -66
- package/lib/Geometry/index.js +9 -38
- package/lib/Geometry/models/billboard.js +51 -97
- package/lib/Geometry/models/index.js +0 -5
- package/lib/Geometry/models/plane.js +79 -151
- package/lib/Geometry/models/sprite.js +60 -127
- package/lib/canvas/index.js +10 -40
- package/lib/canvas/models/canvas.js +41 -101
- package/lib/canvas/models/index.js +0 -3
- package/lib/citybuliding/building.js +8 -35
- package/lib/citybuliding/models/build.js +57 -92
- package/lib/core/BaseLayer.js +325 -474
- package/lib/core/BaseModel.js +51 -90
- package/lib/core/CommonStyleAttribute.js +2 -7
- package/lib/core/LayerPickService.js +21 -37
- package/lib/core/TextureService.js +0 -16
- package/lib/core/interface.js +21 -31
- package/lib/core/schema.js +0 -1
- package/lib/core/shape/Path.js +14 -31
- package/lib/core/shape/extrude.js +27 -62
- package/lib/core/triangulation.js +98 -177
- package/lib/earth/index.js +9 -43
- package/lib/earth/models/atmosphere.js +30 -63
- package/lib/earth/models/base.js +47 -90
- package/lib/earth/models/bloomsphere.js +30 -63
- package/lib/earth/utils.js +7 -31
- package/lib/heatmap/index.js +10 -48
- package/lib/heatmap/models/grid.js +28 -60
- package/lib/heatmap/models/grid3d.js +28 -60
- package/lib/heatmap/models/heatmap.js +92 -166
- package/lib/heatmap/models/hexagon.js +28 -60
- package/lib/heatmap/models/index.js +0 -6
- package/lib/heatmap/triangulation.js +0 -5
- package/lib/image/index.js +9 -36
- package/lib/image/models/image.js +66 -109
- package/lib/image/models/index.js +0 -3
- package/lib/index.js +7 -61
- package/lib/line/index.js +9 -40
- package/lib/line/models/arc.js +61 -122
- package/lib/line/models/arc_3d.js +56 -113
- package/lib/line/models/earthArc_3d.js +58 -115
- package/lib/line/models/flow.js +36 -70
- package/lib/line/models/great_circle.js +53 -104
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +90 -152
- package/lib/line/models/linearline.js +42 -86
- package/lib/line/models/simpleLine.js +38 -77
- package/lib/line/models/wall.js +52 -103
- package/lib/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/lib/line/shaders/line_frag.glsl +1 -3
- package/lib/line/shaders/line_vert.glsl +2 -0
- package/lib/line/shaders/linear/line_linear_frag.glsl +1 -1
- package/lib/mask/index.js +9 -36
- package/lib/mask/models/fill.js +29 -63
- package/lib/mask/models/index.js +0 -3
- package/lib/plugins/DataMappingPlugin.js +78 -125
- package/lib/plugins/DataSourcePlugin.js +45 -76
- package/lib/plugins/FeatureScalePlugin.js +67 -138
- package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
- package/lib/plugins/LayerMaskPlugin.js +4 -17
- package/lib/plugins/LayerModelPlugin.js +70 -127
- package/lib/plugins/LayerStylePlugin.js +5 -14
- package/lib/plugins/LightingPlugin.js +12 -25
- package/lib/plugins/MultiPassRendererPlugin.js +11 -22
- package/lib/plugins/PixelPickingPlugin.js +12 -27
- package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
- package/lib/plugins/ShaderUniformPlugin.js +13 -34
- package/lib/plugins/UpdateModelPlugin.js +1 -10
- package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
- package/lib/point/index.js +26 -83
- package/lib/point/models/earthExtrude.js +58 -106
- package/lib/point/models/earthFill.js +52 -110
- package/lib/point/models/extrude.js +57 -103
- package/lib/point/models/fill.js +54 -90
- package/lib/point/models/fillmage.js +58 -107
- package/lib/point/models/image.js +47 -92
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +38 -72
- package/lib/point/models/simplePoint.js +38 -72
- package/lib/point/models/text.js +199 -305
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +87 -146
- package/lib/polygon/models/fill.js +50 -89
- package/lib/polygon/models/index.js +2 -14
- package/lib/polygon/models/ocean.js +42 -88
- package/lib/polygon/models/water.js +37 -82
- package/lib/raster/buffers/triangulation.js +3 -7
- package/lib/raster/index.js +9 -40
- package/lib/raster/models/index.js +0 -5
- package/lib/raster/models/raster.js +80 -125
- package/lib/raster/models/rasterRgb.js +84 -139
- package/lib/raster/models/rasterTerrainRgb.js +56 -93
- package/lib/tile/interaction/getRasterData.js +14 -25
- package/lib/tile/interaction/utils.js +7 -19
- package/lib/tile/manager/base.js +63 -104
- package/lib/tile/service/TileLayerService.js +33 -60
- package/lib/tile/service/TilePickService.js +26 -48
- package/lib/tile/service/TileSourceService.js +2 -16
- package/lib/tile/style/utils.js +0 -3
- package/lib/tile/tileFactory/DebugTile.js +29 -54
- package/lib/tile/tileFactory/ImageTile.js +20 -46
- package/lib/tile/tileFactory/MaskTile.js +22 -51
- package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
- package/lib/tile/tileFactory/RasterTile.js +30 -63
- package/lib/tile/tileFactory/Tile.js +63 -102
- package/lib/tile/tileFactory/VectorTile.js +41 -76
- package/lib/tile/tileFactory/index.js +0 -25
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
- package/lib/tile/tileFactory/util.js +0 -9
- package/lib/tile/tileLayer/BaseLayer.js +105 -153
- package/lib/tile/utils.js +1 -5
- package/lib/utils/blend.js +0 -5
- package/lib/utils/collision-index.js +9 -25
- package/lib/utils/extrude_polyline.js +101 -181
- package/lib/utils/grid-index.js +2 -28
- package/lib/utils/identityScale.js +0 -9
- package/lib/utils/layerData.js +30 -49
- package/lib/utils/multiPassRender.js +11 -16
- package/lib/utils/polylineNormal.js +31 -66
- package/lib/utils/simpleLine.js +2 -21
- package/lib/utils/stencil.js +0 -4
- package/lib/utils/symbol-layout.js +27 -55
- package/lib/wind/index.js +9 -37
- package/lib/wind/models/index.js +0 -3
- package/lib/wind/models/utils.js +26 -62
- package/lib/wind/models/wind.js +101 -157
- package/lib/wind/models/windRender.js +53 -71
- package/lib/wind/models/windShader.js +0 -1
- package/package.json +7 -7
package/es/core/BaseLayer.js
CHANGED
|
@@ -12,22 +12,14 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
12
12
|
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
|
|
13
13
|
import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
|
|
14
14
|
var _excluded = ["passes"],
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
_excluded2 = ["moduleName", "vertexShader", "fragmentShader", "inject", "triangulation", "segmentNumber"];
|
|
17
16
|
var _dec, _class, _descriptor;
|
|
18
|
-
|
|
19
17
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
20
|
-
|
|
21
18
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
22
|
-
|
|
23
19
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
24
|
-
|
|
25
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
26
|
-
|
|
20
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
27
21
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
28
|
-
|
|
29
22
|
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
|
-
|
|
31
23
|
// @ts-ignore
|
|
32
24
|
import { AsyncSeriesBailHook, AsyncWaterfallHook, SyncBailHook, SyncHook } from '@antv/async-hook';
|
|
33
25
|
import { BlendType, IDebugLog, ILayerStage, lazyInject, TYPES } from '@antv/l7-core';
|
|
@@ -43,52 +35,38 @@ import TextureService from "./TextureService";
|
|
|
43
35
|
/**
|
|
44
36
|
* 分配 layer id
|
|
45
37
|
*/
|
|
46
|
-
|
|
47
38
|
var layerIdCounter = 0;
|
|
48
39
|
var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function (_ref) {
|
|
49
40
|
_inherits(BaseLayer, _ref);
|
|
50
|
-
|
|
51
41
|
var _super = _createSuper(BaseLayer);
|
|
52
|
-
|
|
53
42
|
// 生命周期钩子
|
|
43
|
+
|
|
54
44
|
// 待渲染 model 列表
|
|
45
|
+
|
|
55
46
|
// 用于保存子图层对象
|
|
56
47
|
|
|
57
48
|
/**
|
|
58
49
|
* 待更新样式属性,在初始化阶段完成注册
|
|
59
50
|
*/
|
|
51
|
+
|
|
60
52
|
// private pickingPassRender: IPass<'pixelPicking'>;
|
|
53
|
+
|
|
61
54
|
function BaseLayer() {
|
|
62
55
|
var _this;
|
|
63
|
-
|
|
64
56
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
65
|
-
|
|
66
57
|
_classCallCheck(this, BaseLayer);
|
|
67
|
-
|
|
68
58
|
_this = _super.call(this);
|
|
69
|
-
|
|
70
59
|
_defineProperty(_assertThisInitialized(_this), "id", "".concat(layerIdCounter++));
|
|
71
|
-
|
|
72
60
|
_defineProperty(_assertThisInitialized(_this), "name", "".concat(layerIdCounter));
|
|
73
|
-
|
|
74
61
|
_defineProperty(_assertThisInitialized(_this), "visible", true);
|
|
75
|
-
|
|
76
62
|
_defineProperty(_assertThisInitialized(_this), "zIndex", 0);
|
|
77
|
-
|
|
78
63
|
_defineProperty(_assertThisInitialized(_this), "inited", false);
|
|
79
|
-
|
|
80
64
|
_defineProperty(_assertThisInitialized(_this), "layerModelNeedUpdate", false);
|
|
81
|
-
|
|
82
65
|
_defineProperty(_assertThisInitialized(_this), "pickedFeatureID", null);
|
|
83
|
-
|
|
84
66
|
_defineProperty(_assertThisInitialized(_this), "selectedFeatureID", null);
|
|
85
|
-
|
|
86
67
|
_defineProperty(_assertThisInitialized(_this), "styleNeedUpdate", false);
|
|
87
|
-
|
|
88
68
|
_defineProperty(_assertThisInitialized(_this), "forceRender", false);
|
|
89
|
-
|
|
90
69
|
_defineProperty(_assertThisInitialized(_this), "clusterZoom", 0);
|
|
91
|
-
|
|
92
70
|
_defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
|
|
93
71
|
data: [],
|
|
94
72
|
options: {
|
|
@@ -97,7 +75,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
97
75
|
}
|
|
98
76
|
}
|
|
99
77
|
});
|
|
100
|
-
|
|
101
78
|
_defineProperty(_assertThisInitialized(_this), "dataState", {
|
|
102
79
|
dataSourceNeedUpdate: false,
|
|
103
80
|
dataMappingNeedUpdate: false,
|
|
@@ -105,7 +82,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
105
82
|
featureScaleNeedUpdate: false,
|
|
106
83
|
StyleAttrNeedUpdate: false
|
|
107
84
|
});
|
|
108
|
-
|
|
109
85
|
_defineProperty(_assertThisInitialized(_this), "hooks", {
|
|
110
86
|
init: new AsyncSeriesBailHook(),
|
|
111
87
|
afterInit: new SyncBailHook(),
|
|
@@ -121,59 +97,38 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
121
97
|
beforeDestroy: new SyncHook(),
|
|
122
98
|
afterDestroy: new SyncHook()
|
|
123
99
|
});
|
|
124
|
-
|
|
125
100
|
_defineProperty(_assertThisInitialized(_this), "models", []);
|
|
126
|
-
|
|
127
101
|
_defineProperty(_assertThisInitialized(_this), "startInit", false);
|
|
128
|
-
|
|
129
102
|
_defineProperty(_assertThisInitialized(_this), "layerChildren", []);
|
|
130
|
-
|
|
131
103
|
_defineProperty(_assertThisInitialized(_this), "masks", []);
|
|
132
|
-
|
|
133
104
|
_initializerDefineProperty(_assertThisInitialized(_this), "configService", _descriptor, _assertThisInitialized(_this));
|
|
134
|
-
|
|
135
105
|
_defineProperty(_assertThisInitialized(_this), "animateOptions", {
|
|
136
106
|
enable: false
|
|
137
107
|
});
|
|
138
|
-
|
|
139
108
|
_defineProperty(_assertThisInitialized(_this), "currentPickId", null);
|
|
140
|
-
|
|
141
109
|
_defineProperty(_assertThisInitialized(_this), "encodeStyleAttribute", {});
|
|
142
|
-
|
|
143
110
|
_defineProperty(_assertThisInitialized(_this), "enableEncodeStyles", []);
|
|
144
|
-
|
|
145
111
|
_defineProperty(_assertThisInitialized(_this), "pendingStyleAttributes", []);
|
|
146
|
-
|
|
147
112
|
_defineProperty(_assertThisInitialized(_this), "scaleOptions", {});
|
|
148
|
-
|
|
149
113
|
_defineProperty(_assertThisInitialized(_this), "animateStatus", false);
|
|
150
|
-
|
|
151
114
|
_defineProperty(_assertThisInitialized(_this), "isDestroyed", false);
|
|
152
|
-
|
|
153
115
|
_defineProperty(_assertThisInitialized(_this), "encodeDataLength", 0);
|
|
154
|
-
|
|
155
116
|
_defineProperty(_assertThisInitialized(_this), "sourceEvent", function () {
|
|
156
117
|
_this.dataState.dataSourceNeedUpdate = true;
|
|
157
|
-
|
|
158
118
|
var layerConfig = _this.getLayerConfig();
|
|
159
|
-
|
|
160
119
|
if (layerConfig && layerConfig.autoFit) {
|
|
161
120
|
_this.fitBounds(layerConfig.fitBoundsOptions);
|
|
162
121
|
}
|
|
163
|
-
|
|
164
122
|
var autoRender = _this.layerSource.getSourceCfg().autoRender;
|
|
165
|
-
|
|
166
123
|
if (autoRender) {
|
|
167
124
|
_this.reRender();
|
|
168
125
|
}
|
|
169
126
|
});
|
|
170
|
-
|
|
171
127
|
_this.name = config.name || _this.id;
|
|
172
128
|
_this.zIndex = config.zIndex || 0;
|
|
173
129
|
_this.rawConfig = config;
|
|
174
130
|
return _this;
|
|
175
131
|
}
|
|
176
|
-
|
|
177
132
|
_createClass(BaseLayer, [{
|
|
178
133
|
key: "addMask",
|
|
179
134
|
value: function addMask(layer) {
|
|
@@ -184,7 +139,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
184
139
|
key: "removeMask",
|
|
185
140
|
value: function removeMask(layer) {
|
|
186
141
|
var layerIndex = this.masks.indexOf(layer);
|
|
187
|
-
|
|
188
142
|
if (layerIndex > -1) {
|
|
189
143
|
this.masks.splice(layerIndex, 1);
|
|
190
144
|
}
|
|
@@ -202,23 +156,21 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
202
156
|
this.updateLayerConfig({
|
|
203
157
|
enableMask: true
|
|
204
158
|
});
|
|
205
|
-
}
|
|
206
|
-
|
|
159
|
+
}
|
|
160
|
+
// 将废弃
|
|
207
161
|
}, {
|
|
208
162
|
key: "addMaskLayer",
|
|
209
163
|
value: function addMaskLayer(maskLayer) {
|
|
210
164
|
this.masks.push(maskLayer);
|
|
211
|
-
}
|
|
212
|
-
|
|
165
|
+
}
|
|
166
|
+
// 将废弃
|
|
213
167
|
}, {
|
|
214
168
|
key: "removeMaskLayer",
|
|
215
169
|
value: function removeMaskLayer(maskLayer) {
|
|
216
170
|
var layerIndex = this.masks.indexOf(maskLayer);
|
|
217
|
-
|
|
218
171
|
if (layerIndex > -1) {
|
|
219
172
|
this.masks.splice(layerIndex, 1);
|
|
220
173
|
}
|
|
221
|
-
|
|
222
174
|
maskLayer.destroy();
|
|
223
175
|
}
|
|
224
176
|
}, {
|
|
@@ -235,7 +187,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
235
187
|
key: "updateLayerConfig",
|
|
236
188
|
value: function updateLayerConfig(configToUpdate) {
|
|
237
189
|
var _this2 = this;
|
|
238
|
-
|
|
239
190
|
// 同步 rawConfig
|
|
240
191
|
Object.keys(configToUpdate).map(function (key) {
|
|
241
192
|
if (key in _this2.rawConfig) {
|
|
@@ -243,24 +194,23 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
243
194
|
_this2.rawConfig[key] = configToUpdate[key];
|
|
244
195
|
}
|
|
245
196
|
});
|
|
246
|
-
|
|
247
197
|
if (!this.startInit) {
|
|
248
198
|
this.needUpdateConfig = _objectSpread(_objectSpread({}, this.needUpdateConfig), configToUpdate);
|
|
249
199
|
} else {
|
|
250
|
-
var sceneId = this.container.get(TYPES.SceneID);
|
|
200
|
+
var sceneId = this.container.get(TYPES.SceneID);
|
|
201
|
+
// @ts-ignore
|
|
251
202
|
// styleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
|
|
252
|
-
|
|
253
203
|
this.configService.setLayerConfig(sceneId, this.id, _objectSpread(_objectSpread(_objectSpread({}, this.configService.getLayerConfig(this.id)), this.needUpdateConfig), configToUpdate));
|
|
254
204
|
this.needUpdateConfig = {};
|
|
255
205
|
}
|
|
256
206
|
}
|
|
207
|
+
|
|
257
208
|
/**
|
|
258
209
|
* 注入图层容器,父容器为场景容器
|
|
259
210
|
* RootContainer 1
|
|
260
211
|
* -> SceneContainer 1.*
|
|
261
212
|
* -> LayerContainer 1.*
|
|
262
213
|
*/
|
|
263
|
-
|
|
264
214
|
}, {
|
|
265
215
|
key: "setContainer",
|
|
266
216
|
value: function setContainer(container, sceneContainer) {
|
|
@@ -283,146 +233,137 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
283
233
|
value: function () {
|
|
284
234
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
285
235
|
var _this3 = this;
|
|
286
|
-
|
|
287
236
|
var sceneId, _this$getLayerConfig, enableMultiPassRenderer, passes, _iterator, _step, plugin;
|
|
288
|
-
|
|
289
237
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
290
|
-
while (1) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
this.cameraService = this.container.get(TYPES.ICameraService);
|
|
323
|
-
this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
|
|
324
|
-
this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
|
|
325
|
-
this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
|
|
326
|
-
this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass); // 图层容器服务
|
|
327
|
-
|
|
328
|
-
this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService);
|
|
329
|
-
|
|
330
|
-
if (enableMultiPassRenderer) {
|
|
331
|
-
// 按需初始化 瓦片频繁报错
|
|
332
|
-
this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
|
|
333
|
-
this.multiPassRenderer.setLayer(this);
|
|
334
|
-
} // 完成样式服务注册完成前添加的属性
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
this.pendingStyleAttributes.forEach(function (_ref2) {
|
|
338
|
-
var attributeName = _ref2.attributeName,
|
|
339
|
-
attributeField = _ref2.attributeField,
|
|
340
|
-
attributeValues = _ref2.attributeValues,
|
|
341
|
-
updateOptions = _ref2.updateOptions;
|
|
342
|
-
|
|
343
|
-
_this3.styleAttributeService.updateStyleAttribute(attributeName, {
|
|
344
|
-
// @ts-ignore
|
|
345
|
-
scale: _objectSpread({
|
|
346
|
-
field: attributeField
|
|
347
|
-
}, _this3.splitValuesAndCallbackInAttribute( // @ts-ignore
|
|
348
|
-
attributeValues, // @ts-ignore
|
|
349
|
-
_this3.getLayerConfig()[attributeName]))
|
|
350
|
-
}, // @ts-ignore
|
|
351
|
-
updateOptions);
|
|
238
|
+
while (1) switch (_context.prev = _context.next) {
|
|
239
|
+
case 0:
|
|
240
|
+
// 设置配置项
|
|
241
|
+
sceneId = this.container.get(TYPES.SceneID);
|
|
242
|
+
this.startInit = true;
|
|
243
|
+
// 初始化图层配置项
|
|
244
|
+
// const { enableMultiPassRenderer = false } = this.rawConfig;
|
|
245
|
+
// this.configService.setLayerConfig(sceneId, this.id, {
|
|
246
|
+
// enableMultiPassRenderer,
|
|
247
|
+
// });
|
|
248
|
+
this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);
|
|
249
|
+
this.layerType = this.rawConfig.layerType;
|
|
250
|
+
|
|
251
|
+
// 全局容器服务
|
|
252
|
+
|
|
253
|
+
// 场景容器服务
|
|
254
|
+
this.iconService = this.container.get(TYPES.IIconService);
|
|
255
|
+
this.fontService = this.container.get(TYPES.IFontService);
|
|
256
|
+
this.rendererService = this.container.get(TYPES.IRendererService);
|
|
257
|
+
this.layerService = this.container.get(TYPES.ILayerService);
|
|
258
|
+
this.debugService = this.container.get(TYPES.IDebugService);
|
|
259
|
+
this.interactionService = this.container.get(TYPES.IInteractionService);
|
|
260
|
+
this.pickingService = this.container.get(TYPES.IPickingService);
|
|
261
|
+
this.mapService = this.container.get(TYPES.IMapService);
|
|
262
|
+
_this$getLayerConfig = this.getLayerConfig(), enableMultiPassRenderer = _this$getLayerConfig.enableMultiPassRenderer, passes = _this$getLayerConfig.passes;
|
|
263
|
+
if (enableMultiPassRenderer && passes !== null && passes !== void 0 && passes.length && passes.length > 0) {
|
|
264
|
+
// Tip: 兼容 multiPassRender 在 amap1 时存在的图层不同步问题 zoom
|
|
265
|
+
this.mapService.on('mapAfterFrameChange', function () {
|
|
266
|
+
_this3.renderLayers();
|
|
352
267
|
});
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
268
|
+
}
|
|
269
|
+
this.cameraService = this.container.get(TYPES.ICameraService);
|
|
270
|
+
this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
|
|
271
|
+
this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
|
|
272
|
+
this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
|
|
273
|
+
this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass);
|
|
274
|
+
|
|
275
|
+
// 图层容器服务
|
|
276
|
+
this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService);
|
|
277
|
+
if (enableMultiPassRenderer) {
|
|
278
|
+
// 按需初始化 瓦片频繁报错
|
|
279
|
+
this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
|
|
280
|
+
this.multiPassRenderer.setLayer(this);
|
|
281
|
+
}
|
|
282
|
+
// 完成样式服务注册完成前添加的属性
|
|
283
|
+
this.pendingStyleAttributes.forEach(function (_ref2) {
|
|
284
|
+
var attributeName = _ref2.attributeName,
|
|
285
|
+
attributeField = _ref2.attributeField,
|
|
286
|
+
attributeValues = _ref2.attributeValues,
|
|
287
|
+
updateOptions = _ref2.updateOptions;
|
|
288
|
+
_this3.styleAttributeService.updateStyleAttribute(attributeName, {
|
|
289
|
+
// @ts-ignore
|
|
290
|
+
scale: _objectSpread({
|
|
291
|
+
field: attributeField
|
|
292
|
+
}, _this3.splitValuesAndCallbackInAttribute(
|
|
293
|
+
// @ts-ignore
|
|
294
|
+
attributeValues,
|
|
295
|
+
// @ts-ignore
|
|
296
|
+
_this3.getLayerConfig()[attributeName]))
|
|
297
|
+
},
|
|
298
|
+
// @ts-ignore
|
|
299
|
+
updateOptions);
|
|
300
|
+
});
|
|
301
|
+
this.pendingStyleAttributes = [];
|
|
302
|
+
|
|
303
|
+
// 获取插件集
|
|
304
|
+
this.plugins = this.container.getAll(TYPES.ILayerPlugin);
|
|
305
|
+
// 完成插件注册,传入场景和图层容器内的服务
|
|
306
|
+
_iterator = _createForOfIteratorHelper(this.plugins);
|
|
307
|
+
try {
|
|
308
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
309
|
+
plugin = _step.value;
|
|
310
|
+
plugin.apply(this, {
|
|
311
|
+
rendererService: this.rendererService,
|
|
312
|
+
mapService: this.mapService,
|
|
313
|
+
styleAttributeService: this.styleAttributeService,
|
|
314
|
+
normalPassFactory: this.normalPassFactory,
|
|
315
|
+
postProcessingPassFactory: this.postProcessingPassFactory
|
|
316
|
+
});
|
|
375
317
|
}
|
|
376
318
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
319
|
+
// 初始化其他服务
|
|
320
|
+
} catch (err) {
|
|
321
|
+
_iterator.e(err);
|
|
322
|
+
} finally {
|
|
323
|
+
_iterator.f();
|
|
324
|
+
}
|
|
325
|
+
this.layerPickService = new LayerPickService(this);
|
|
326
|
+
|
|
327
|
+
// 颜色纹理服务
|
|
328
|
+
this.textureService = new TextureService(this);
|
|
329
|
+
this.log(IDebugLog.LayerInitStart);
|
|
330
|
+
// 触发 init 生命周期插件
|
|
331
|
+
_context.next = 31;
|
|
332
|
+
return this.hooks.init.promise();
|
|
333
|
+
case 31:
|
|
334
|
+
this.log(IDebugLog.LayerInitEnd);
|
|
335
|
+
this.inited = true;
|
|
336
|
+
// add mask layer
|
|
337
|
+
// 触发初始化完成事件;
|
|
338
|
+
this.emit('inited', {
|
|
339
|
+
target: this,
|
|
340
|
+
type: 'inited'
|
|
341
|
+
});
|
|
342
|
+
this.emit('add', {
|
|
343
|
+
target: this,
|
|
344
|
+
type: 'add'
|
|
345
|
+
});
|
|
346
|
+
this.hooks.afterInit.call();
|
|
347
|
+
case 36:
|
|
348
|
+
case "end":
|
|
349
|
+
return _context.stop();
|
|
404
350
|
}
|
|
405
351
|
}, _callee, this);
|
|
406
352
|
}));
|
|
407
|
-
|
|
408
353
|
function init() {
|
|
409
354
|
return _init.apply(this, arguments);
|
|
410
355
|
}
|
|
411
|
-
|
|
412
356
|
return init;
|
|
413
357
|
}()
|
|
414
358
|
}, {
|
|
415
359
|
key: "log",
|
|
416
360
|
value: function log(logType) {
|
|
417
361
|
var _this$debugService;
|
|
418
|
-
|
|
419
362
|
var step = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'init';
|
|
420
|
-
|
|
421
363
|
// @ts-ignore 瓦片、瓦片图层目前不参与日志
|
|
422
364
|
if (this.tileLayer || this.isTileLayer) {
|
|
423
365
|
return;
|
|
424
366
|
}
|
|
425
|
-
|
|
426
367
|
var key = "".concat(this.id, ".").concat(step, ".").concat(logType);
|
|
427
368
|
var values = {
|
|
428
369
|
id: this.id,
|
|
@@ -445,15 +386,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
445
386
|
key: "createModelData",
|
|
446
387
|
value: function createModelData(data, option) {
|
|
447
388
|
var _this$layerModel;
|
|
448
|
-
|
|
449
389
|
if ((_this$layerModel = this.layerModel) !== null && _this$layerModel !== void 0 && _this$layerModel.createModelData) {
|
|
450
390
|
// 在某些特殊图层中单独构建 attribute & elements
|
|
451
391
|
return this.layerModel.createModelData(option);
|
|
452
392
|
}
|
|
453
|
-
|
|
454
393
|
var calEncodeData = this.calculateEncodeData(data, option);
|
|
455
394
|
var triangulation = this.triangulation;
|
|
456
|
-
|
|
457
395
|
if (calEncodeData && triangulation) {
|
|
458
396
|
return this.styleAttributeService.createAttributesAndIndices(calEncodeData, triangulation);
|
|
459
397
|
} else {
|
|
@@ -481,18 +419,16 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
481
419
|
/**
|
|
482
420
|
* Model初始化前需要更新Model样式
|
|
483
421
|
*/
|
|
484
|
-
|
|
485
422
|
}, {
|
|
486
423
|
key: "prepareBuildModel",
|
|
487
424
|
value: function prepareBuildModel() {
|
|
488
425
|
if (Object.keys(this.needUpdateConfig || {}).length !== 0) {
|
|
489
426
|
this.updateLayerConfig({});
|
|
490
|
-
}
|
|
491
|
-
|
|
427
|
+
}
|
|
492
428
|
|
|
429
|
+
// 启动动画
|
|
493
430
|
var _this$getLayerConfig2 = this.getLayerConfig(),
|
|
494
|
-
|
|
495
|
-
|
|
431
|
+
animateOption = _this$getLayerConfig2.animateOption;
|
|
496
432
|
if (animateOption !== null && animateOption !== void 0 && animateOption.enable) {
|
|
497
433
|
this.layerService.startAnimate();
|
|
498
434
|
this.animateStatus = true;
|
|
@@ -503,8 +439,9 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
503
439
|
value: function color(field, values, updateOptions) {
|
|
504
440
|
this.updateStyleAttribute('color', field, values, updateOptions);
|
|
505
441
|
return this;
|
|
506
|
-
}
|
|
442
|
+
}
|
|
507
443
|
|
|
444
|
+
// 为对应的图层传入纹理的编号名称(point/image 在 shape 方法中传入纹理名称的方法并不通用)
|
|
508
445
|
}, {
|
|
509
446
|
key: "texture",
|
|
510
447
|
value: function texture(field, values, updateOptions) {
|
|
@@ -522,8 +459,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
522
459
|
value: function size(field, values, updateOptions) {
|
|
523
460
|
this.updateStyleAttribute('size', field, values, updateOptions);
|
|
524
461
|
return this;
|
|
525
|
-
}
|
|
526
|
-
|
|
462
|
+
}
|
|
463
|
+
// 对mapping后的数据过滤,scale保持不变
|
|
527
464
|
}, {
|
|
528
465
|
key: "filter",
|
|
529
466
|
value: function filter(field, values, updateOptions) {
|
|
@@ -557,14 +494,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
557
494
|
key: "animate",
|
|
558
495
|
value: function animate(options) {
|
|
559
496
|
var rawAnimate = {};
|
|
560
|
-
|
|
561
497
|
if (isObject(options)) {
|
|
562
498
|
rawAnimate.enable = true;
|
|
563
499
|
rawAnimate = _objectSpread(_objectSpread({}, rawAnimate), options);
|
|
564
500
|
} else {
|
|
565
501
|
rawAnimate.enable = options;
|
|
566
502
|
}
|
|
567
|
-
|
|
568
503
|
this.updateLayerConfig({
|
|
569
504
|
animateOption: rawAnimate
|
|
570
505
|
});
|
|
@@ -577,9 +512,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
577
512
|
// 判断是否为source
|
|
578
513
|
this.setSource(data);
|
|
579
514
|
return this;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
|
|
515
|
+
}
|
|
516
|
+
// 设置source 配置
|
|
583
517
|
this.sourceOption = {
|
|
584
518
|
data: data,
|
|
585
519
|
options: options
|
|
@@ -591,7 +525,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
591
525
|
key: "setData",
|
|
592
526
|
value: function setData(data, options) {
|
|
593
527
|
var _this4 = this;
|
|
594
|
-
|
|
595
528
|
if (this.inited) {
|
|
596
529
|
this.log(IDebugLog.SourceInitStart, ILayerStage.UPDATE);
|
|
597
530
|
this.layerSource.setData(data, options);
|
|
@@ -599,49 +532,41 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
599
532
|
} else {
|
|
600
533
|
this.on('inited', function () {
|
|
601
534
|
_this4.log(IDebugLog.SourceInitStart, ILayerStage.UPDATE);
|
|
602
|
-
|
|
603
535
|
var currentSource = _this4.getSource();
|
|
604
|
-
|
|
605
536
|
if (!currentSource) {
|
|
606
537
|
// 执行 setData 的时候 source 还不存在(还未执行 addLayer)
|
|
607
538
|
_this4.source(new Source(data, options));
|
|
608
539
|
} else {
|
|
609
540
|
_this4.layerSource.setData(data, options);
|
|
610
541
|
}
|
|
611
|
-
|
|
612
542
|
_this4.layerSource.once('update', function () {
|
|
613
543
|
_this4.log(IDebugLog.SourceInitEnd, ILayerStage.UPDATE);
|
|
614
544
|
});
|
|
615
545
|
});
|
|
616
546
|
}
|
|
617
|
-
|
|
618
547
|
return this;
|
|
619
548
|
}
|
|
620
549
|
}, {
|
|
621
550
|
key: "style",
|
|
622
551
|
value: function style(options) {
|
|
623
552
|
var _this5 = this;
|
|
624
|
-
|
|
625
553
|
var passes = options.passes,
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
554
|
+
rest = _objectWithoutProperties(options, _excluded);
|
|
555
|
+
// passes 特殊处理
|
|
629
556
|
if (passes) {
|
|
630
557
|
normalizePasses(passes).forEach(function (pass) {
|
|
631
558
|
var postProcessingPass = _this5.multiPassRenderer.getPostProcessor().getPostProcessingPassByName(pass[0]);
|
|
632
|
-
|
|
633
559
|
if (postProcessingPass) {
|
|
634
560
|
postProcessingPass.updateOptions(pass[1]);
|
|
635
561
|
}
|
|
636
562
|
});
|
|
637
|
-
}
|
|
638
|
-
|
|
563
|
+
}
|
|
639
564
|
|
|
565
|
+
// 兼容老版本的写法 ['field, 'value']
|
|
640
566
|
var newOption = rest;
|
|
641
567
|
Object.keys(rest).forEach(function (key) {
|
|
642
568
|
// @ts-ignore
|
|
643
569
|
var values = rest[key];
|
|
644
|
-
|
|
645
570
|
if (Array.isArray(values) && values.length === 2 && !isNumber(values[0]) && !isNumber(values[1])) {
|
|
646
571
|
newOption[key] = {
|
|
647
572
|
field: values[0],
|
|
@@ -652,26 +577,34 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
652
577
|
this.encodeStyle(newOption);
|
|
653
578
|
this.updateLayerConfig(newOption);
|
|
654
579
|
return this;
|
|
655
|
-
}
|
|
580
|
+
}
|
|
656
581
|
|
|
582
|
+
// 参与数据映射的字段 encodeing
|
|
657
583
|
}, {
|
|
658
584
|
key: "encodeStyle",
|
|
659
585
|
value: function encodeStyle(options) {
|
|
660
586
|
var _this6 = this;
|
|
661
|
-
|
|
662
587
|
Object.keys(options).forEach(function (key) {
|
|
663
|
-
if (
|
|
664
|
-
|
|
588
|
+
if (
|
|
589
|
+
// 需要数据映射
|
|
590
|
+
_this6.enableEncodeStyles.includes(key) &&
|
|
591
|
+
// 支持的数据映射类型
|
|
592
|
+
isPlainObject(options[key]) && (
|
|
593
|
+
//
|
|
594
|
+
options[key].field || options[key].value) &&
|
|
595
|
+
// 有数据映射的配置
|
|
596
|
+
!isEqual(_this6.encodeStyleAttribute[key], options[key]) // 防止计算属性重复计算
|
|
665
597
|
) {
|
|
666
598
|
_this6.encodeStyleAttribute[key] = options[key];
|
|
667
|
-
|
|
668
599
|
_this6.updateStyleAttribute(key, options[key].field, options[key].value);
|
|
669
|
-
|
|
670
|
-
|
|
600
|
+
if (_this6.inited) {
|
|
601
|
+
_this6.dataState.dataMappingNeedUpdate = true;
|
|
602
|
+
}
|
|
671
603
|
} else {
|
|
672
604
|
// 不需要数据映射
|
|
673
605
|
if (_this6.encodeStyleAttribute[key]) {
|
|
674
606
|
delete _this6.encodeStyleAttribute[key]; // 删除已经存在的属性
|
|
607
|
+
_this6.dataState.dataSourceNeedUpdate = true;
|
|
675
608
|
}
|
|
676
609
|
}
|
|
677
610
|
});
|
|
@@ -680,24 +613,21 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
680
613
|
key: "scale",
|
|
681
614
|
value: function scale(field, cfg) {
|
|
682
615
|
var preOption = _objectSpread({}, this.scaleOptions);
|
|
683
|
-
|
|
684
616
|
if (isObject(field)) {
|
|
685
617
|
this.scaleOptions = _objectSpread(_objectSpread({}, this.scaleOptions), field);
|
|
686
618
|
} else {
|
|
687
619
|
this.scaleOptions[field] = cfg;
|
|
688
620
|
}
|
|
689
|
-
|
|
690
621
|
if (this.styleAttributeService && !isEqual(preOption, this.scaleOptions)) {
|
|
691
622
|
var scaleOptions = isObject(field) ? field : _defineProperty({}, field, cfg);
|
|
692
623
|
this.styleAttributeService.updateScaleAttribute(scaleOptions);
|
|
693
624
|
}
|
|
694
|
-
|
|
695
625
|
return this;
|
|
696
626
|
}
|
|
627
|
+
|
|
697
628
|
/**
|
|
698
629
|
* 渲染所有的图层
|
|
699
630
|
*/
|
|
700
|
-
|
|
701
631
|
}, {
|
|
702
632
|
key: "renderLayers",
|
|
703
633
|
value: function renderLayers() {
|
|
@@ -709,75 +639,61 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
709
639
|
key: "render",
|
|
710
640
|
value: function render() {
|
|
711
641
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
712
|
-
|
|
713
642
|
if (this.tileLayer) {
|
|
714
643
|
// 瓦片图层执行单独的 render 渲染队列
|
|
715
644
|
this.tileLayer.render();
|
|
716
645
|
return this;
|
|
717
646
|
}
|
|
718
|
-
|
|
719
647
|
this.layerService.beforeRenderData(this);
|
|
720
|
-
|
|
721
648
|
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
722
649
|
return this;
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
|
|
650
|
+
}
|
|
651
|
+
// Tip: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
726
652
|
this.renderModels(options);
|
|
727
653
|
return this;
|
|
728
654
|
}
|
|
655
|
+
|
|
729
656
|
/**
|
|
730
657
|
* renderMultiPass 专门用于渲染支持 multipass 的 layer
|
|
731
658
|
*/
|
|
732
|
-
|
|
733
659
|
}, {
|
|
734
660
|
key: "renderMultiPass",
|
|
735
661
|
value: function () {
|
|
736
662
|
var _renderMultiPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
737
663
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
738
|
-
while (1) {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
_context2.next = 2;
|
|
743
|
-
break;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
return _context2.abrupt("return");
|
|
747
|
-
|
|
748
|
-
case 2:
|
|
749
|
-
if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
|
|
750
|
-
_context2.next = 7;
|
|
751
|
-
break;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
_context2.next = 5;
|
|
755
|
-
return this.multiPassRenderer.render();
|
|
756
|
-
|
|
757
|
-
case 5:
|
|
758
|
-
_context2.next = 8;
|
|
664
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
665
|
+
case 0:
|
|
666
|
+
if (!(this.encodeDataLength <= 0 && !this.forceRender)) {
|
|
667
|
+
_context2.next = 2;
|
|
759
668
|
break;
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
669
|
+
}
|
|
670
|
+
return _context2.abrupt("return");
|
|
671
|
+
case 2:
|
|
672
|
+
if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
|
|
673
|
+
_context2.next = 7;
|
|
674
|
+
break;
|
|
675
|
+
}
|
|
676
|
+
_context2.next = 5;
|
|
677
|
+
return this.multiPassRenderer.render();
|
|
678
|
+
case 5:
|
|
679
|
+
_context2.next = 8;
|
|
680
|
+
break;
|
|
681
|
+
case 7:
|
|
682
|
+
if (this.multiPassRenderer) {
|
|
683
|
+
// renderPass 触发的渲染
|
|
684
|
+
this.renderModels();
|
|
685
|
+
} else {
|
|
686
|
+
this.renderModels();
|
|
687
|
+
}
|
|
688
|
+
case 8:
|
|
689
|
+
case "end":
|
|
690
|
+
return _context2.stop();
|
|
773
691
|
}
|
|
774
692
|
}, _callee2, this);
|
|
775
693
|
}));
|
|
776
|
-
|
|
777
694
|
function renderMultiPass() {
|
|
778
695
|
return _renderMultiPass.apply(this, arguments);
|
|
779
696
|
}
|
|
780
|
-
|
|
781
697
|
return renderMultiPass;
|
|
782
698
|
}()
|
|
783
699
|
}, {
|
|
@@ -785,21 +701,17 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
785
701
|
value: function active(options) {
|
|
786
702
|
var activeOption = {};
|
|
787
703
|
activeOption.enableHighlight = isObject(options) ? true : options;
|
|
788
|
-
|
|
789
704
|
if (isObject(options)) {
|
|
790
705
|
activeOption.enableHighlight = true;
|
|
791
|
-
|
|
792
706
|
if (options.color) {
|
|
793
707
|
activeOption.highlightColor = options.color;
|
|
794
708
|
}
|
|
795
|
-
|
|
796
709
|
if (options.mix) {
|
|
797
710
|
activeOption.activeMix = options.mix;
|
|
798
711
|
}
|
|
799
712
|
} else {
|
|
800
713
|
activeOption.enableHighlight = !!options;
|
|
801
714
|
}
|
|
802
|
-
|
|
803
715
|
this.updateLayerConfig(activeOption);
|
|
804
716
|
return this;
|
|
805
717
|
}
|
|
@@ -807,12 +719,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
807
719
|
key: "setActive",
|
|
808
720
|
value: function setActive(id, options) {
|
|
809
721
|
var _this7 = this;
|
|
810
|
-
|
|
811
722
|
if (isObject(id)) {
|
|
812
723
|
var _id$x = id.x,
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
724
|
+
x = _id$x === void 0 ? 0 : _id$x,
|
|
725
|
+
_id$y = id.y,
|
|
726
|
+
y = _id$y === void 0 ? 0 : _id$y;
|
|
816
727
|
this.updateLayerConfig({
|
|
817
728
|
highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
|
|
818
729
|
activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
|
|
@@ -827,7 +738,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
827
738
|
highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
|
|
828
739
|
activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
|
|
829
740
|
});
|
|
830
|
-
this.hooks.beforeHighlight.call(encodePickingColor(id))
|
|
741
|
+
this.hooks.beforeHighlight.call(encodePickingColor(id))
|
|
742
|
+
// @ts-ignore
|
|
831
743
|
.then(function () {
|
|
832
744
|
setTimeout(function () {
|
|
833
745
|
_this7.reRender();
|
|
@@ -840,21 +752,17 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
840
752
|
value: function select(option) {
|
|
841
753
|
var activeOption = {};
|
|
842
754
|
activeOption.enableSelect = isObject(option) ? true : option;
|
|
843
|
-
|
|
844
755
|
if (isObject(option)) {
|
|
845
756
|
activeOption.enableSelect = true;
|
|
846
|
-
|
|
847
757
|
if (option.color) {
|
|
848
758
|
activeOption.selectColor = option.color;
|
|
849
759
|
}
|
|
850
|
-
|
|
851
760
|
if (option.mix) {
|
|
852
761
|
activeOption.selectMix = option.mix;
|
|
853
762
|
}
|
|
854
763
|
} else {
|
|
855
764
|
activeOption.enableSelect = !!option;
|
|
856
765
|
}
|
|
857
|
-
|
|
858
766
|
this.updateLayerConfig(activeOption);
|
|
859
767
|
return this;
|
|
860
768
|
}
|
|
@@ -862,12 +770,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
862
770
|
key: "setSelect",
|
|
863
771
|
value: function setSelect(id, options) {
|
|
864
772
|
var _this8 = this;
|
|
865
|
-
|
|
866
773
|
if (isObject(id)) {
|
|
867
774
|
var _id$x2 = id.x,
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
775
|
+
x = _id$x2 === void 0 ? 0 : _id$x2,
|
|
776
|
+
_id$y2 = id.y,
|
|
777
|
+
y = _id$y2 === void 0 ? 0 : _id$y2;
|
|
871
778
|
this.updateLayerConfig({
|
|
872
779
|
selectColor: isObject(options) ? options.color : this.getLayerConfig().selectColor,
|
|
873
780
|
selectMix: isObject(options) ? options.mix : this.getLayerConfig().selectMix
|
|
@@ -882,7 +789,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
882
789
|
selectColor: isObject(options) ? options.color : this.getLayerConfig().selectColor,
|
|
883
790
|
selectMix: isObject(options) ? options.mix : this.getLayerConfig().selectMix
|
|
884
791
|
});
|
|
885
|
-
this.hooks.beforeSelect.call(encodePickingColor(id))
|
|
792
|
+
this.hooks.beforeSelect.call(encodePickingColor(id))
|
|
793
|
+
// @ts-ignore
|
|
886
794
|
.then(function () {
|
|
887
795
|
setTimeout(function () {
|
|
888
796
|
_this8.reRender();
|
|
@@ -895,8 +803,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
895
803
|
value: function setBlend(type) {
|
|
896
804
|
this.updateLayerConfig({
|
|
897
805
|
blend: type
|
|
898
|
-
});
|
|
899
|
-
|
|
806
|
+
});
|
|
807
|
+
// this.layerModelNeedUpdate = true;
|
|
900
808
|
this.reRender();
|
|
901
809
|
return this;
|
|
902
810
|
}
|
|
@@ -952,14 +860,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
952
860
|
key: "isVisible",
|
|
953
861
|
value: function isVisible() {
|
|
954
862
|
var zoom = this.mapService.getZoom();
|
|
955
|
-
|
|
956
863
|
var _this$getLayerConfig3 = this.getLayerConfig(),
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
864
|
+
visible = _this$getLayerConfig3.visible,
|
|
865
|
+
_this$getLayerConfig4 = _this$getLayerConfig3.minZoom,
|
|
866
|
+
minZoom = _this$getLayerConfig4 === void 0 ? -Infinity : _this$getLayerConfig4,
|
|
867
|
+
_this$getLayerConfig5 = _this$getLayerConfig3.maxZoom,
|
|
868
|
+
maxZoom = _this$getLayerConfig5 === void 0 ? Infinity : _this$getLayerConfig5;
|
|
963
869
|
return !!visible && zoom >= minZoom && zoom < maxZoom;
|
|
964
870
|
}
|
|
965
871
|
}, {
|
|
@@ -968,28 +874,22 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
968
874
|
this.updateLayerConfig({
|
|
969
875
|
enableMultiPassRenderer: enableMultiPass
|
|
970
876
|
});
|
|
971
|
-
|
|
972
877
|
if (currentPasses) {
|
|
973
878
|
this.updateLayerConfig({
|
|
974
879
|
passes: currentPasses
|
|
975
880
|
});
|
|
976
881
|
}
|
|
977
|
-
|
|
978
882
|
if (enableMultiPass) {
|
|
979
883
|
var _this$getLayerConfig6 = this.getLayerConfig(),
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
884
|
+
_this$getLayerConfig7 = _this$getLayerConfig6.passes,
|
|
885
|
+
passes = _this$getLayerConfig7 === void 0 ? [] : _this$getLayerConfig7;
|
|
983
886
|
this.multiPassRenderer = createMultiPassRenderer(this, passes, this.postProcessingPassFactory, this.normalPassFactory);
|
|
984
887
|
this.multiPassRenderer.setRenderFlag(true);
|
|
985
|
-
|
|
986
888
|
var _this$rendererService = this.rendererService.getViewportSize(),
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
889
|
+
width = _this$rendererService.width,
|
|
890
|
+
height = _this$rendererService.height;
|
|
990
891
|
this.multiPassRenderer.resize(width, height);
|
|
991
892
|
}
|
|
992
|
-
|
|
993
893
|
return this;
|
|
994
894
|
}
|
|
995
895
|
}, {
|
|
@@ -1004,23 +904,21 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1004
904
|
key: "getMinZoom",
|
|
1005
905
|
value: function getMinZoom() {
|
|
1006
906
|
var _this$getLayerConfig8 = this.getLayerConfig(),
|
|
1007
|
-
|
|
1008
|
-
|
|
907
|
+
minZoom = _this$getLayerConfig8.minZoom;
|
|
1009
908
|
return minZoom;
|
|
1010
909
|
}
|
|
1011
910
|
}, {
|
|
1012
911
|
key: "getMaxZoom",
|
|
1013
912
|
value: function getMaxZoom() {
|
|
1014
913
|
var _this$getLayerConfig9 = this.getLayerConfig(),
|
|
1015
|
-
|
|
1016
|
-
|
|
914
|
+
maxZoom = _this$getLayerConfig9.maxZoom;
|
|
1017
915
|
return maxZoom;
|
|
1018
916
|
}
|
|
1019
917
|
}, {
|
|
1020
918
|
key: "get",
|
|
1021
919
|
value: function get(name) {
|
|
1022
|
-
var cfg = this.getLayerConfig();
|
|
1023
|
-
|
|
920
|
+
var cfg = this.getLayerConfig();
|
|
921
|
+
// @ts-ignore
|
|
1024
922
|
return cfg[name];
|
|
1025
923
|
}
|
|
1026
924
|
}, {
|
|
@@ -1039,10 +937,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1039
937
|
});
|
|
1040
938
|
return this;
|
|
1041
939
|
}
|
|
940
|
+
|
|
1042
941
|
/**
|
|
1043
942
|
* zoom to layer Bounds
|
|
1044
943
|
*/
|
|
1045
|
-
|
|
1046
944
|
}, {
|
|
1047
945
|
key: "fitBounds",
|
|
1048
946
|
value: function fitBounds(fitBoundsOptions) {
|
|
@@ -1052,17 +950,14 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1052
950
|
});
|
|
1053
951
|
return this;
|
|
1054
952
|
}
|
|
1055
|
-
|
|
1056
953
|
var source = this.getSource();
|
|
1057
954
|
var extent = source.extent;
|
|
1058
955
|
var isValid = extent.some(function (v) {
|
|
1059
956
|
return Math.abs(v) === Infinity;
|
|
1060
957
|
});
|
|
1061
|
-
|
|
1062
958
|
if (isValid) {
|
|
1063
959
|
return this;
|
|
1064
960
|
}
|
|
1065
|
-
|
|
1066
961
|
this.mapService.fitBounds([[extent[0], extent[1]], [extent[2], extent[3]]], fitBoundsOptions);
|
|
1067
962
|
return this;
|
|
1068
963
|
}
|
|
@@ -1070,43 +965,42 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1070
965
|
key: "destroy",
|
|
1071
966
|
value: function destroy() {
|
|
1072
967
|
var _this$multiPassRender, _this$layerModel2, _this$tileLayer, _this$debugService2;
|
|
1073
|
-
|
|
1074
968
|
var refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1075
|
-
|
|
1076
969
|
if (this.isDestroyed) {
|
|
1077
970
|
return;
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
|
|
971
|
+
}
|
|
972
|
+
// remove child layer
|
|
1081
973
|
this.layerChildren.map(function (child) {
|
|
1082
974
|
return child.destroy(false);
|
|
1083
975
|
});
|
|
1084
|
-
this.layerChildren = [];
|
|
976
|
+
this.layerChildren = [];
|
|
1085
977
|
|
|
978
|
+
// remove mask list maskfence 掩膜需要销毁
|
|
1086
979
|
var _this$getLayerConfig10 = this.getLayerConfig(),
|
|
1087
|
-
|
|
1088
|
-
|
|
980
|
+
maskfence = _this$getLayerConfig10.maskfence;
|
|
1089
981
|
if (maskfence) {
|
|
1090
982
|
this.masks.map(function (mask) {
|
|
1091
983
|
return mask.destroy(false);
|
|
1092
984
|
});
|
|
1093
985
|
this.masks = [];
|
|
1094
986
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
987
|
+
this.hooks.beforeDestroy.call();
|
|
988
|
+
// 清除sources事件
|
|
1098
989
|
this.layerSource.off('update', this.sourceEvent);
|
|
1099
990
|
(_this$multiPassRender = this.multiPassRenderer) === null || _this$multiPassRender === void 0 ? void 0 : _this$multiPassRender.destroy();
|
|
1100
|
-
this.textureService.destroy();
|
|
991
|
+
this.textureService.destroy();
|
|
1101
992
|
|
|
1102
|
-
this.
|
|
993
|
+
// 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());
|
|
994
|
+
this.styleAttributeService.clearAllAttributes();
|
|
1103
995
|
|
|
1104
|
-
|
|
996
|
+
// 执行每个图层单独的 clearModels 方法 (清除一些额外的 texture、program、buffer 等)
|
|
1105
997
|
|
|
998
|
+
this.hooks.afterDestroy.call();
|
|
999
|
+
// Tip: 清除各个图层自定义的 models 资源
|
|
1106
1000
|
(_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels(refresh);
|
|
1107
1001
|
(_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0 ? void 0 : _this$tileLayer.destroy();
|
|
1108
|
-
this.models = [];
|
|
1109
|
-
|
|
1002
|
+
this.models = [];
|
|
1003
|
+
// 清除图层日志(如果有的话:非瓦片相关)
|
|
1110
1004
|
(_this$debugService2 = this.debugService) === null || _this$debugService2 === void 0 ? void 0 : _this$debugService2.removeLog(this.id);
|
|
1111
1005
|
this.emit('remove', {
|
|
1112
1006
|
target: this,
|
|
@@ -1116,21 +1010,21 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1116
1010
|
target: this,
|
|
1117
1011
|
type: 'destroy'
|
|
1118
1012
|
});
|
|
1119
|
-
this.removeAllListeners();
|
|
1120
|
-
// this.container.unbind(TYPES.IStyleAttributeService);
|
|
1121
|
-
|
|
1013
|
+
this.removeAllListeners();
|
|
1122
1014
|
this.isDestroyed = true;
|
|
1015
|
+
// 解绑图层容器中的服务
|
|
1016
|
+
// this.container.unbind(TYPES.IStyleAttributeService);
|
|
1123
1017
|
}
|
|
1124
1018
|
}, {
|
|
1125
1019
|
key: "clear",
|
|
1126
1020
|
value: function clear() {
|
|
1127
|
-
this.styleAttributeService.clearAllAttributes();
|
|
1021
|
+
this.styleAttributeService.clearAllAttributes();
|
|
1022
|
+
// 销毁所有 model
|
|
1128
1023
|
}
|
|
1129
1024
|
}, {
|
|
1130
1025
|
key: "clearModels",
|
|
1131
1026
|
value: function clearModels() {
|
|
1132
1027
|
var _this$layerModel3;
|
|
1133
|
-
|
|
1134
1028
|
this.models.forEach(function (model) {
|
|
1135
1029
|
return model.destroy();
|
|
1136
1030
|
});
|
|
@@ -1143,54 +1037,45 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1143
1037
|
return !!(this.styleAttributeService.getLayerStyleAttributes() || []).filter(function (attribute) {
|
|
1144
1038
|
return attribute.needRescale || attribute.needRemapping || attribute.needRegenerateVertices;
|
|
1145
1039
|
}).length;
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1040
|
+
}
|
|
1041
|
+
// 外部初始化Source
|
|
1148
1042
|
}, {
|
|
1149
1043
|
key: "setSource",
|
|
1150
1044
|
value: function setSource(source) {
|
|
1151
1045
|
var _this9 = this;
|
|
1152
|
-
|
|
1153
1046
|
// 解除原 sources 事件
|
|
1154
1047
|
if (this.layerSource) {
|
|
1155
1048
|
this.layerSource.off('update', this.sourceEvent);
|
|
1156
1049
|
}
|
|
1157
|
-
|
|
1158
1050
|
this.layerSource = source;
|
|
1159
|
-
this.clusterZoom = 0;
|
|
1051
|
+
this.clusterZoom = 0;
|
|
1160
1052
|
|
|
1053
|
+
// 已 inited 且启用聚合进行更新聚合数据
|
|
1161
1054
|
if (this.inited && this.layerSource.cluster) {
|
|
1162
1055
|
var zoom = this.mapService.getZoom();
|
|
1163
1056
|
this.layerSource.updateClusterData(zoom);
|
|
1164
1057
|
}
|
|
1165
|
-
|
|
1166
1058
|
if (this.layerSource.inited) {
|
|
1167
1059
|
this.sourceEvent();
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1060
|
+
}
|
|
1061
|
+
// this.layerSource.inited 为 true update 事件不会再触发
|
|
1171
1062
|
this.layerSource.on('update', function (_ref4) {
|
|
1172
1063
|
var type = _ref4.type;
|
|
1173
|
-
|
|
1174
1064
|
if (_this9.coordCenter === undefined) {
|
|
1175
1065
|
var _this9$mapService;
|
|
1176
|
-
|
|
1177
1066
|
var layerCenter = _this9.layerSource.center;
|
|
1178
1067
|
_this9.coordCenter = layerCenter;
|
|
1179
|
-
|
|
1180
1068
|
if ((_this9$mapService = _this9.mapService) !== null && _this9$mapService !== void 0 && _this9$mapService.setCoordCenter) {
|
|
1181
1069
|
_this9.mapService.setCoordCenter(layerCenter);
|
|
1182
1070
|
}
|
|
1183
1071
|
}
|
|
1184
|
-
|
|
1185
1072
|
if (type === 'update') {
|
|
1186
1073
|
if (_this9.tileLayer) {
|
|
1187
1074
|
// 瓦片图层独立更新
|
|
1188
1075
|
_this9.tileLayer.reload();
|
|
1189
|
-
|
|
1190
1076
|
return;
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
|
|
1077
|
+
}
|
|
1078
|
+
// source 初始化不需要处理
|
|
1194
1079
|
_this9.sourceEvent();
|
|
1195
1080
|
}
|
|
1196
1081
|
});
|
|
@@ -1225,7 +1110,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1225
1110
|
key: "getLegend",
|
|
1226
1111
|
value: function getLegend(name) {
|
|
1227
1112
|
var _attribute$scale, _scales$0$option, _attribute$scale2;
|
|
1228
|
-
|
|
1229
1113
|
var attribute = this.styleAttributeService.getLayerStyleAttribute(name);
|
|
1230
1114
|
var scales = (attribute === null || attribute === void 0 ? void 0 : (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.scalers) || [];
|
|
1231
1115
|
return {
|
|
@@ -1237,12 +1121,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1237
1121
|
}, {
|
|
1238
1122
|
key: "getLegendItems",
|
|
1239
1123
|
value: function getLegendItems(name) {
|
|
1240
|
-
var scale = this.styleAttributeService.getLayerAttributeScale(name);
|
|
1241
|
-
|
|
1124
|
+
var scale = this.styleAttributeService.getLayerAttributeScale(name);
|
|
1125
|
+
// 函数自定义映射,没有 scale 返回为空数组
|
|
1242
1126
|
if (!scale) {
|
|
1243
1127
|
return [];
|
|
1244
1128
|
}
|
|
1245
|
-
|
|
1246
1129
|
if (scale.invertExtent) {
|
|
1247
1130
|
// 分段类型 Quantize、Quantile、Threshold
|
|
1248
1131
|
var items = scale.range().map(function (item) {
|
|
@@ -1258,7 +1141,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1258
1141
|
value: item
|
|
1259
1142
|
}, name, scale(item));
|
|
1260
1143
|
});
|
|
1261
|
-
|
|
1262
1144
|
return _items;
|
|
1263
1145
|
} else if (scale !== null && scale !== void 0 && scale.domain) {
|
|
1264
1146
|
// 枚举类型 Cat
|
|
@@ -1269,17 +1151,15 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1269
1151
|
value: item
|
|
1270
1152
|
}, name, scale(item));
|
|
1271
1153
|
});
|
|
1272
|
-
|
|
1273
1154
|
return _items2;
|
|
1274
1155
|
}
|
|
1275
|
-
|
|
1276
1156
|
return [];
|
|
1277
1157
|
}
|
|
1278
1158
|
}, {
|
|
1279
1159
|
key: "pick",
|
|
1280
1160
|
value: function pick(_ref8) {
|
|
1281
1161
|
var x = _ref8.x,
|
|
1282
|
-
|
|
1162
|
+
y = _ref8.y;
|
|
1283
1163
|
this.interactionService.triggerHover({
|
|
1284
1164
|
x: x,
|
|
1285
1165
|
y: y
|
|
@@ -1295,67 +1175,56 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1295
1175
|
value: function () {
|
|
1296
1176
|
var _buildLayerModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
|
|
1297
1177
|
var _this10 = this;
|
|
1298
|
-
|
|
1299
1178
|
var moduleName, vertexShader, fragmentShader, inject, triangulation, segmentNumber, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
|
|
1300
|
-
|
|
1301
1179
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
1302
|
-
while (1) {
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
}));
|
|
1336
|
-
|
|
1337
|
-
case 5:
|
|
1338
|
-
case "end":
|
|
1339
|
-
return _context3.stop();
|
|
1340
|
-
}
|
|
1180
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1181
|
+
case 0:
|
|
1182
|
+
moduleName = options.moduleName, vertexShader = options.vertexShader, fragmentShader = options.fragmentShader, inject = options.inject, triangulation = options.triangulation, segmentNumber = options.segmentNumber, rest = _objectWithoutProperties(options, _excluded2);
|
|
1183
|
+
this.shaderModuleService.registerModule(moduleName, {
|
|
1184
|
+
vs: vertexShader,
|
|
1185
|
+
fs: fragmentShader,
|
|
1186
|
+
inject: inject
|
|
1187
|
+
});
|
|
1188
|
+
_this$shaderModuleSer = this.shaderModuleService.getModule(moduleName), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, uniforms = _this$shaderModuleSer.uniforms;
|
|
1189
|
+
createModel = this.rendererService.createModel;
|
|
1190
|
+
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
1191
|
+
// console.log(this.encodedData)
|
|
1192
|
+
var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, segmentNumber),
|
|
1193
|
+
attributes = _this10$styleAttribut.attributes,
|
|
1194
|
+
elements = _this10$styleAttribut.elements,
|
|
1195
|
+
count = _this10$styleAttribut.count;
|
|
1196
|
+
var modelOptions = _objectSpread({
|
|
1197
|
+
attributes: attributes,
|
|
1198
|
+
uniforms: uniforms,
|
|
1199
|
+
fs: fs,
|
|
1200
|
+
vs: vs,
|
|
1201
|
+
elements: elements,
|
|
1202
|
+
blend: BlendTypes[BlendType.normal]
|
|
1203
|
+
}, rest);
|
|
1204
|
+
if (count) {
|
|
1205
|
+
modelOptions.count = count;
|
|
1206
|
+
}
|
|
1207
|
+
var m = createModel(modelOptions);
|
|
1208
|
+
resolve(m);
|
|
1209
|
+
}));
|
|
1210
|
+
case 5:
|
|
1211
|
+
case "end":
|
|
1212
|
+
return _context3.stop();
|
|
1341
1213
|
}
|
|
1342
1214
|
}, _callee3, this);
|
|
1343
1215
|
}));
|
|
1344
|
-
|
|
1345
1216
|
function buildLayerModel(_x) {
|
|
1346
1217
|
return _buildLayerModel.apply(this, arguments);
|
|
1347
1218
|
}
|
|
1348
|
-
|
|
1349
1219
|
return buildLayerModel;
|
|
1350
1220
|
}()
|
|
1351
1221
|
}, {
|
|
1352
1222
|
key: "createAttributes",
|
|
1353
1223
|
value: function createAttributes(options) {
|
|
1354
|
-
var triangulation = options.triangulation;
|
|
1355
|
-
|
|
1224
|
+
var triangulation = options.triangulation;
|
|
1225
|
+
// @ts-ignore
|
|
1356
1226
|
var _this$styleAttributeS = this.styleAttributeService.createAttributes(this.encodedData, triangulation),
|
|
1357
|
-
|
|
1358
|
-
|
|
1227
|
+
attributes = _this$styleAttributeS.attributes;
|
|
1359
1228
|
return attributes;
|
|
1360
1229
|
}
|
|
1361
1230
|
}, {
|
|
@@ -1390,22 +1259,18 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1390
1259
|
key: "needPick",
|
|
1391
1260
|
value: function needPick(type) {
|
|
1392
1261
|
var _this$getLayerConfig11 = this.getLayerConfig(),
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1262
|
+
_this$getLayerConfig12 = _this$getLayerConfig11.enableHighlight,
|
|
1263
|
+
enableHighlight = _this$getLayerConfig12 === void 0 ? true : _this$getLayerConfig12,
|
|
1264
|
+
_this$getLayerConfig13 = _this$getLayerConfig11.enableSelect,
|
|
1265
|
+
enableSelect = _this$getLayerConfig13 === void 0 ? true : _this$getLayerConfig13;
|
|
1266
|
+
// 判断layer是否监听事件;
|
|
1399
1267
|
var isPick = this.eventNames().indexOf(type) !== -1 || this.eventNames().indexOf('un' + type) !== -1;
|
|
1400
|
-
|
|
1401
1268
|
if ((type === 'click' || type === 'dblclick') && enableSelect) {
|
|
1402
1269
|
isPick = true;
|
|
1403
1270
|
}
|
|
1404
|
-
|
|
1405
1271
|
if (type === 'mousemove' && (enableHighlight || this.eventNames().indexOf('mouseenter') !== -1 || this.eventNames().indexOf('unmousemove') !== -1 || this.eventNames().indexOf('mouseout') !== -1)) {
|
|
1406
1272
|
isPick = true;
|
|
1407
1273
|
}
|
|
1408
|
-
|
|
1409
1274
|
return this.isVisible() && isPick;
|
|
1410
1275
|
}
|
|
1411
1276
|
}, {
|
|
@@ -1413,23 +1278,18 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1413
1278
|
value: function () {
|
|
1414
1279
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
1415
1280
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
1416
|
-
while (1) {
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
case "end":
|
|
1423
|
-
return _context4.stop();
|
|
1424
|
-
}
|
|
1281
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1282
|
+
case 0:
|
|
1283
|
+
throw new Error('Method not implemented.');
|
|
1284
|
+
case 1:
|
|
1285
|
+
case "end":
|
|
1286
|
+
return _context4.stop();
|
|
1425
1287
|
}
|
|
1426
1288
|
}, _callee4);
|
|
1427
1289
|
}));
|
|
1428
|
-
|
|
1429
1290
|
function buildModels() {
|
|
1430
1291
|
return _buildModels.apply(this, arguments);
|
|
1431
1292
|
}
|
|
1432
|
-
|
|
1433
1293
|
return buildModels;
|
|
1434
1294
|
}()
|
|
1435
1295
|
}, {
|
|
@@ -1437,24 +1297,19 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1437
1297
|
value: function () {
|
|
1438
1298
|
var _rebuildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
1439
1299
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
1440
|
-
while (1) {
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
case "end":
|
|
1448
|
-
return _context5.stop();
|
|
1449
|
-
}
|
|
1300
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
1301
|
+
case 0:
|
|
1302
|
+
_context5.next = 2;
|
|
1303
|
+
return this.buildModels();
|
|
1304
|
+
case 2:
|
|
1305
|
+
case "end":
|
|
1306
|
+
return _context5.stop();
|
|
1450
1307
|
}
|
|
1451
1308
|
}, _callee5, this);
|
|
1452
1309
|
}));
|
|
1453
|
-
|
|
1454
1310
|
function rebuildModels() {
|
|
1455
1311
|
return _rebuildModels.apply(this, arguments);
|
|
1456
1312
|
}
|
|
1457
|
-
|
|
1458
1313
|
return rebuildModels;
|
|
1459
1314
|
}()
|
|
1460
1315
|
}, {
|
|
@@ -1462,40 +1317,32 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1462
1317
|
value: function () {
|
|
1463
1318
|
var _renderMulPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(multiPassRenderer) {
|
|
1464
1319
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
1465
|
-
while (1) {
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
case "end":
|
|
1473
|
-
return _context6.stop();
|
|
1474
|
-
}
|
|
1320
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1321
|
+
case 0:
|
|
1322
|
+
_context6.next = 2;
|
|
1323
|
+
return multiPassRenderer.render();
|
|
1324
|
+
case 2:
|
|
1325
|
+
case "end":
|
|
1326
|
+
return _context6.stop();
|
|
1475
1327
|
}
|
|
1476
1328
|
}, _callee6);
|
|
1477
1329
|
}));
|
|
1478
|
-
|
|
1479
1330
|
function renderMulPass(_x2) {
|
|
1480
1331
|
return _renderMulPass.apply(this, arguments);
|
|
1481
1332
|
}
|
|
1482
|
-
|
|
1483
1333
|
return renderMulPass;
|
|
1484
1334
|
}()
|
|
1485
1335
|
}, {
|
|
1486
1336
|
key: "renderModels",
|
|
1487
1337
|
value: function renderModels() {
|
|
1488
1338
|
var _this11 = this;
|
|
1489
|
-
|
|
1490
1339
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1491
|
-
|
|
1492
1340
|
// TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
1493
1341
|
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
1494
1342
|
// 数据为空销毁model
|
|
1495
1343
|
this.clearModels();
|
|
1496
1344
|
return this;
|
|
1497
1345
|
}
|
|
1498
|
-
|
|
1499
1346
|
this.hooks.beforeRender.call();
|
|
1500
1347
|
this.models.forEach(function (model) {
|
|
1501
1348
|
model.draw({
|
|
@@ -1511,24 +1358,23 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1511
1358
|
key: "updateStyleAttribute",
|
|
1512
1359
|
value: function updateStyleAttribute(type, field, values, updateOptions) {
|
|
1513
1360
|
// encode diff
|
|
1514
|
-
var preAttribute = this.configService.getAttributeConfig(this.id) || {};
|
|
1515
|
-
|
|
1361
|
+
var preAttribute = this.configService.getAttributeConfig(this.id) || {};
|
|
1362
|
+
// @ts-ignore
|
|
1516
1363
|
if (isEqual(preAttribute[type], {
|
|
1517
1364
|
field: field,
|
|
1518
1365
|
values: values
|
|
1519
1366
|
})) {
|
|
1520
1367
|
// 检测是否发生更新
|
|
1521
1368
|
return false;
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1369
|
+
}
|
|
1524
1370
|
|
|
1371
|
+
// 存储 Attribute 瓦片图层使用
|
|
1525
1372
|
if (['color', 'size', 'texture', 'rotate', 'filter', 'label', 'shape'].indexOf(type) !== -1) {
|
|
1526
1373
|
this.configService.setAttributeConfig(this.id, _defineProperty({}, type, {
|
|
1527
1374
|
field: field,
|
|
1528
1375
|
values: values
|
|
1529
1376
|
}));
|
|
1530
1377
|
}
|
|
1531
|
-
|
|
1532
1378
|
if (!this.startInit) {
|
|
1533
1379
|
// 开始初始化执行
|
|
1534
1380
|
this.pendingStyleAttributes.push({
|
|
@@ -1542,13 +1388,15 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1542
1388
|
// @ts-ignore
|
|
1543
1389
|
scale: _objectSpread({
|
|
1544
1390
|
field: field
|
|
1545
|
-
}, this.splitValuesAndCallbackInAttribute(
|
|
1546
|
-
|
|
1391
|
+
}, this.splitValuesAndCallbackInAttribute(
|
|
1392
|
+
// @ts-ignore
|
|
1393
|
+
values,
|
|
1394
|
+
// @ts-ignore
|
|
1547
1395
|
this.getLayerConfig()[field]))
|
|
1548
|
-
},
|
|
1396
|
+
},
|
|
1397
|
+
// @ts-ignore
|
|
1549
1398
|
updateOptions);
|
|
1550
1399
|
}
|
|
1551
|
-
|
|
1552
1400
|
return true;
|
|
1553
1401
|
}
|
|
1554
1402
|
}, {
|
|
@@ -1561,19 +1409,20 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1561
1409
|
value: function getShaderPickStat() {
|
|
1562
1410
|
return this.layerService.getShaderPickStat();
|
|
1563
1411
|
}
|
|
1412
|
+
|
|
1564
1413
|
/**
|
|
1565
1414
|
* 继承空方法
|
|
1566
1415
|
* @param time
|
|
1567
1416
|
*/
|
|
1568
1417
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1569
|
-
|
|
1570
1418
|
}, {
|
|
1571
1419
|
key: "setEarthTime",
|
|
1572
1420
|
value: function setEarthTime(time) {
|
|
1573
1421
|
console.warn('empty fn');
|
|
1574
|
-
}
|
|
1575
|
-
// 在各个 layer 中继承
|
|
1422
|
+
}
|
|
1576
1423
|
|
|
1424
|
+
// 数据处理 在数据进行 mapping 生成 encodeData 之前对数据进行处理
|
|
1425
|
+
// 在各个 layer 中继承
|
|
1577
1426
|
}, {
|
|
1578
1427
|
key: "processData",
|
|
1579
1428
|
value: function processData(filterData) {
|
|
@@ -1594,31 +1443,25 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1594
1443
|
value: function () {
|
|
1595
1444
|
var _initLayerModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
1596
1445
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
1597
|
-
while (1) {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
case 5:
|
|
1611
|
-
case "end":
|
|
1612
|
-
return _context7.stop();
|
|
1613
|
-
}
|
|
1446
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1447
|
+
case 0:
|
|
1448
|
+
this.models.forEach(function (model) {
|
|
1449
|
+
return model.destroy();
|
|
1450
|
+
});
|
|
1451
|
+
this.models = [];
|
|
1452
|
+
_context7.next = 4;
|
|
1453
|
+
return this.layerModel.initModels();
|
|
1454
|
+
case 4:
|
|
1455
|
+
this.models = _context7.sent;
|
|
1456
|
+
case 5:
|
|
1457
|
+
case "end":
|
|
1458
|
+
return _context7.stop();
|
|
1614
1459
|
}
|
|
1615
1460
|
}, _callee7, this);
|
|
1616
1461
|
}));
|
|
1617
|
-
|
|
1618
1462
|
function initLayerModels() {
|
|
1619
1463
|
return _initLayerModels.apply(this, arguments);
|
|
1620
1464
|
}
|
|
1621
|
-
|
|
1622
1465
|
return initLayerModels;
|
|
1623
1466
|
}()
|
|
1624
1467
|
}, {
|
|
@@ -1637,7 +1480,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1637
1480
|
};
|
|
1638
1481
|
}
|
|
1639
1482
|
}]);
|
|
1640
|
-
|
|
1641
1483
|
return BaseLayer;
|
|
1642
1484
|
}(EventEmitter), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "configService", [_dec], {
|
|
1643
1485
|
configurable: true,
|