@antv/l7-layers 2.15.1 → 2.15.3
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 +320 -484
- package/es/core/BaseModel.js +97 -126
- 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 +10 -31
- package/es/core/triangulation.js +54 -114
- 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 +91 -146
- 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 -34
- package/es/line/models/arc.js +66 -118
- package/es/line/models/arc_3d.js +60 -108
- package/es/line/models/earthArc_3d.js +63 -111
- package/es/line/models/great_circle.js +56 -100
- package/es/line/models/half.js +46 -77
- package/es/line/models/line.js +94 -148
- package/es/line/models/linearline.js +45 -80
- package/es/line/models/simpleLine.js +41 -74
- package/es/line/models/wall.js +52 -92
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +80 -117
- 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 +67 -104
- package/es/plugins/LayerStylePlugin.js +3 -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 -77
- package/es/point/models/earthExtrude.js +61 -102
- package/es/point/models/earthFill.js +57 -87
- package/es/point/models/extrude.js +60 -101
- package/es/point/models/fill.js +70 -100
- package/es/point/models/fillmage.js +63 -107
- package/es/point/models/image.js +48 -88
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +40 -64
- package/es/point/models/simplePoint.js +41 -69
- package/es/point/models/text.d.ts +2 -0
- package/es/point/models/text.js +214 -295
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -40
- package/es/polygon/models/extrude.js +48 -92
- package/es/polygon/models/fill.js +54 -88
- 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 +30 -52
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +28 -45
- 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/dataMappingStyle.js +8 -18
- 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 +320 -478
- package/lib/core/BaseModel.js +97 -139
- 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 +10 -54
- package/lib/core/triangulation.js +53 -153
- 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 +91 -162
- 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 +64 -128
- package/lib/line/models/arc_3d.js +58 -119
- package/lib/line/models/earthArc_3d.js +61 -122
- package/lib/line/models/great_circle.js +56 -111
- package/lib/line/models/half.js +46 -87
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +92 -156
- package/lib/line/models/linearline.js +45 -92
- package/lib/line/models/simpleLine.js +41 -84
- package/lib/line/models/wall.js +52 -103
- 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 +80 -128
- 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 +68 -113
- package/lib/plugins/LayerStylePlugin.js +4 -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 +61 -113
- package/lib/point/models/earthFill.js +57 -117
- package/lib/point/models/extrude.js +60 -111
- package/lib/point/models/fill.js +68 -109
- package/lib/point/models/fillmage.js +61 -115
- package/lib/point/models/image.js +48 -98
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +40 -74
- package/lib/point/models/simplePoint.js +41 -79
- package/lib/point/models/text.js +214 -303
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +48 -103
- package/lib/polygon/models/fill.js +54 -98
- 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 +30 -57
- 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 +28 -53
- 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/dataMappingStyle.js +8 -19
- 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", "triangulation", "segmentNumber", "workerEnabled", "workerOptions"];
|
|
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';
|
|
@@ -44,52 +36,38 @@ import TextureService from "./TextureService";
|
|
|
44
36
|
/**
|
|
45
37
|
* 分配 layer id
|
|
46
38
|
*/
|
|
47
|
-
|
|
48
39
|
var layerIdCounter = 0;
|
|
49
40
|
var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function (_ref) {
|
|
50
41
|
_inherits(BaseLayer, _ref);
|
|
51
|
-
|
|
52
42
|
var _super = _createSuper(BaseLayer);
|
|
53
|
-
|
|
54
43
|
// 生命周期钩子
|
|
44
|
+
|
|
55
45
|
// 待渲染 model 列表
|
|
46
|
+
|
|
56
47
|
// 用于保存子图层对象
|
|
57
48
|
|
|
58
49
|
/**
|
|
59
50
|
* 待更新样式属性,在初始化阶段完成注册
|
|
60
51
|
*/
|
|
52
|
+
|
|
61
53
|
// private pickingPassRender: IPass<'pixelPicking'>;
|
|
54
|
+
|
|
62
55
|
function BaseLayer() {
|
|
63
56
|
var _this;
|
|
64
|
-
|
|
65
57
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
66
|
-
|
|
67
58
|
_classCallCheck(this, BaseLayer);
|
|
68
|
-
|
|
69
59
|
_this = _super.call(this);
|
|
70
|
-
|
|
71
60
|
_defineProperty(_assertThisInitialized(_this), "id", "".concat(layerIdCounter++));
|
|
72
|
-
|
|
73
61
|
_defineProperty(_assertThisInitialized(_this), "name", "".concat(layerIdCounter));
|
|
74
|
-
|
|
75
62
|
_defineProperty(_assertThisInitialized(_this), "visible", true);
|
|
76
|
-
|
|
77
63
|
_defineProperty(_assertThisInitialized(_this), "zIndex", 0);
|
|
78
|
-
|
|
79
64
|
_defineProperty(_assertThisInitialized(_this), "inited", false);
|
|
80
|
-
|
|
81
65
|
_defineProperty(_assertThisInitialized(_this), "layerModelNeedUpdate", false);
|
|
82
|
-
|
|
83
66
|
_defineProperty(_assertThisInitialized(_this), "pickedFeatureID", null);
|
|
84
|
-
|
|
85
67
|
_defineProperty(_assertThisInitialized(_this), "selectedFeatureID", null);
|
|
86
|
-
|
|
87
68
|
_defineProperty(_assertThisInitialized(_this), "styleNeedUpdate", false);
|
|
88
|
-
|
|
89
69
|
_defineProperty(_assertThisInitialized(_this), "forceRender", false);
|
|
90
|
-
|
|
91
70
|
_defineProperty(_assertThisInitialized(_this), "clusterZoom", 0);
|
|
92
|
-
|
|
93
71
|
_defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
|
|
94
72
|
data: [],
|
|
95
73
|
options: {
|
|
@@ -98,7 +76,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
98
76
|
}
|
|
99
77
|
}
|
|
100
78
|
});
|
|
101
|
-
|
|
102
79
|
_defineProperty(_assertThisInitialized(_this), "dataState", {
|
|
103
80
|
dataSourceNeedUpdate: false,
|
|
104
81
|
dataMappingNeedUpdate: false,
|
|
@@ -106,7 +83,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
106
83
|
featureScaleNeedUpdate: false,
|
|
107
84
|
StyleAttrNeedUpdate: false
|
|
108
85
|
});
|
|
109
|
-
|
|
110
86
|
_defineProperty(_assertThisInitialized(_this), "hooks", {
|
|
111
87
|
init: new AsyncSeriesBailHook(),
|
|
112
88
|
afterInit: new SyncBailHook(),
|
|
@@ -122,56 +98,37 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
122
98
|
beforeDestroy: new SyncHook(),
|
|
123
99
|
afterDestroy: new SyncHook()
|
|
124
100
|
});
|
|
125
|
-
|
|
126
101
|
_defineProperty(_assertThisInitialized(_this), "models", []);
|
|
127
|
-
|
|
128
102
|
_defineProperty(_assertThisInitialized(_this), "startInit", false);
|
|
129
|
-
|
|
130
103
|
_defineProperty(_assertThisInitialized(_this), "layerChildren", []);
|
|
131
|
-
|
|
132
104
|
_defineProperty(_assertThisInitialized(_this), "masks", []);
|
|
133
|
-
|
|
134
105
|
_initializerDefineProperty(_assertThisInitialized(_this), "configService", _descriptor, _assertThisInitialized(_this));
|
|
135
|
-
|
|
136
106
|
_defineProperty(_assertThisInitialized(_this), "animateOptions", {
|
|
137
107
|
enable: false
|
|
138
108
|
});
|
|
139
|
-
|
|
140
109
|
_defineProperty(_assertThisInitialized(_this), "currentPickId", null);
|
|
141
|
-
|
|
142
110
|
_defineProperty(_assertThisInitialized(_this), "pendingStyleAttributes", []);
|
|
143
|
-
|
|
144
111
|
_defineProperty(_assertThisInitialized(_this), "scaleOptions", {});
|
|
145
|
-
|
|
146
112
|
_defineProperty(_assertThisInitialized(_this), "animateStatus", false);
|
|
147
|
-
|
|
148
113
|
_defineProperty(_assertThisInitialized(_this), "isDestroyed", false);
|
|
149
|
-
|
|
150
114
|
_defineProperty(_assertThisInitialized(_this), "encodeDataLength", 0);
|
|
151
|
-
|
|
152
115
|
_defineProperty(_assertThisInitialized(_this), "sourceEvent", function () {
|
|
153
116
|
_this.dataState.dataSourceNeedUpdate = true;
|
|
154
|
-
|
|
155
117
|
var layerConfig = _this.getLayerConfig();
|
|
156
|
-
|
|
157
118
|
if (layerConfig && layerConfig.autoFit) {
|
|
158
119
|
_this.fitBounds(layerConfig.fitBoundsOptions);
|
|
159
120
|
}
|
|
160
|
-
|
|
161
121
|
var autoRender = _this.layerSource.getSourceCfg().autoRender;
|
|
162
|
-
|
|
163
122
|
if (autoRender) {
|
|
164
123
|
_this.reRender();
|
|
165
124
|
}
|
|
166
125
|
});
|
|
167
|
-
|
|
168
126
|
_this.name = config.name || _this.id;
|
|
169
127
|
_this.zIndex = config.zIndex || 0;
|
|
170
|
-
_this.rawConfig = config;
|
|
171
|
-
|
|
128
|
+
_this.rawConfig = config;
|
|
129
|
+
// this.parent = this;
|
|
172
130
|
return _this;
|
|
173
131
|
}
|
|
174
|
-
|
|
175
132
|
_createClass(BaseLayer, [{
|
|
176
133
|
key: "addMask",
|
|
177
134
|
value: function addMask(layer) {
|
|
@@ -182,7 +139,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
182
139
|
key: "removeMask",
|
|
183
140
|
value: function removeMask(layer) {
|
|
184
141
|
var layerIndex = this.masks.indexOf(layer);
|
|
185
|
-
|
|
186
142
|
if (layerIndex > -1) {
|
|
187
143
|
this.masks.splice(layerIndex, 1);
|
|
188
144
|
}
|
|
@@ -200,23 +156,21 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
200
156
|
this.updateLayerConfig({
|
|
201
157
|
enableMask: true
|
|
202
158
|
});
|
|
203
|
-
}
|
|
204
|
-
|
|
159
|
+
}
|
|
160
|
+
// 将废弃
|
|
205
161
|
}, {
|
|
206
162
|
key: "addMaskLayer",
|
|
207
163
|
value: function addMaskLayer(maskLayer) {
|
|
208
164
|
this.masks.push(maskLayer);
|
|
209
|
-
}
|
|
210
|
-
|
|
165
|
+
}
|
|
166
|
+
// 将废弃
|
|
211
167
|
}, {
|
|
212
168
|
key: "removeMaskLayer",
|
|
213
169
|
value: function removeMaskLayer(maskLayer) {
|
|
214
170
|
var layerIndex = this.masks.indexOf(maskLayer);
|
|
215
|
-
|
|
216
171
|
if (layerIndex > -1) {
|
|
217
172
|
this.masks.splice(layerIndex, 1);
|
|
218
173
|
}
|
|
219
|
-
|
|
220
174
|
maskLayer.destroy();
|
|
221
175
|
}
|
|
222
176
|
}, {
|
|
@@ -233,7 +187,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
233
187
|
key: "updateLayerConfig",
|
|
234
188
|
value: function updateLayerConfig(configToUpdate) {
|
|
235
189
|
var _this2 = this;
|
|
236
|
-
|
|
237
190
|
// 同步 rawConfig
|
|
238
191
|
Object.keys(configToUpdate).map(function (key) {
|
|
239
192
|
if (key in _this2.rawConfig) {
|
|
@@ -241,25 +194,23 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
241
194
|
_this2.rawConfig[key] = configToUpdate[key];
|
|
242
195
|
}
|
|
243
196
|
});
|
|
244
|
-
|
|
245
197
|
if (!this.startInit) {
|
|
246
198
|
this.needUpdateConfig = _objectSpread(_objectSpread({}, this.needUpdateConfig), configToUpdate);
|
|
247
199
|
} else {
|
|
248
|
-
var sceneId = this.container.get(TYPES.SceneID);
|
|
249
|
-
|
|
200
|
+
var sceneId = this.container.get(TYPES.SceneID);
|
|
201
|
+
// @ts-ignore
|
|
250
202
|
styleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
|
|
251
|
-
|
|
252
203
|
this.configService.setLayerConfig(sceneId, this.id, _objectSpread(_objectSpread(_objectSpread({}, this.configService.getLayerConfig(this.id)), this.needUpdateConfig), configToUpdate));
|
|
253
204
|
this.needUpdateConfig = {};
|
|
254
205
|
}
|
|
255
206
|
}
|
|
207
|
+
|
|
256
208
|
/**
|
|
257
209
|
* 注入图层容器,父容器为场景容器
|
|
258
210
|
* RootContainer 1
|
|
259
211
|
* -> SceneContainer 1.*
|
|
260
212
|
* -> LayerContainer 1.*
|
|
261
213
|
*/
|
|
262
|
-
|
|
263
214
|
}, {
|
|
264
215
|
key: "setContainer",
|
|
265
216
|
value: function setContainer(container, sceneContainer) {
|
|
@@ -282,146 +233,137 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
282
233
|
value: function () {
|
|
283
234
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
284
235
|
var _this3 = this;
|
|
285
|
-
|
|
286
236
|
var sceneId, _this$getLayerConfig, enableMultiPassRenderer, passes, _iterator, _step, plugin;
|
|
287
|
-
|
|
288
237
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
289
|
-
while (1) {
|
|
290
|
-
|
|
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
|
-
this.cameraService = this.container.get(TYPES.ICameraService);
|
|
322
|
-
this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
|
|
323
|
-
this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
|
|
324
|
-
this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
|
|
325
|
-
this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass); // 图层容器服务
|
|
326
|
-
|
|
327
|
-
this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService);
|
|
328
|
-
|
|
329
|
-
if (enableMultiPassRenderer) {
|
|
330
|
-
// 按需初始化 瓦片频繁报错
|
|
331
|
-
this.multiPassRenderer = this.container.get(TYPES.IMultiPassRenderer);
|
|
332
|
-
this.multiPassRenderer.setLayer(this);
|
|
333
|
-
} // 完成样式服务注册完成前添加的属性
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
this.pendingStyleAttributes.forEach(function (_ref2) {
|
|
337
|
-
var attributeName = _ref2.attributeName,
|
|
338
|
-
attributeField = _ref2.attributeField,
|
|
339
|
-
attributeValues = _ref2.attributeValues,
|
|
340
|
-
updateOptions = _ref2.updateOptions;
|
|
341
|
-
|
|
342
|
-
_this3.styleAttributeService.updateStyleAttribute(attributeName, {
|
|
343
|
-
// @ts-ignore
|
|
344
|
-
scale: _objectSpread({
|
|
345
|
-
field: attributeField
|
|
346
|
-
}, _this3.splitValuesAndCallbackInAttribute( // @ts-ignore
|
|
347
|
-
attributeValues, // @ts-ignore
|
|
348
|
-
_this3.getLayerConfig()[attributeName]))
|
|
349
|
-
}, // @ts-ignore
|
|
350
|
-
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();
|
|
351
267
|
});
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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
|
+
});
|
|
374
317
|
}
|
|
375
318
|
|
|
376
|
-
|
|
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
|
-
|
|
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();
|
|
403
350
|
}
|
|
404
351
|
}, _callee, this);
|
|
405
352
|
}));
|
|
406
|
-
|
|
407
353
|
function init() {
|
|
408
354
|
return _init.apply(this, arguments);
|
|
409
355
|
}
|
|
410
|
-
|
|
411
356
|
return init;
|
|
412
357
|
}()
|
|
413
358
|
}, {
|
|
414
359
|
key: "log",
|
|
415
360
|
value: function log(logType) {
|
|
416
361
|
var _this$debugService;
|
|
417
|
-
|
|
418
362
|
var step = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'init';
|
|
419
|
-
|
|
420
363
|
// @ts-ignore 瓦片、瓦片图层目前不参与日志
|
|
421
364
|
if (this.tileLayer || this.isTileLayer) {
|
|
422
365
|
return;
|
|
423
366
|
}
|
|
424
|
-
|
|
425
367
|
var key = "".concat(this.id, ".").concat(step, ".").concat(logType);
|
|
426
368
|
var values = {
|
|
427
369
|
id: this.id,
|
|
@@ -444,15 +386,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
444
386
|
key: "createModelData",
|
|
445
387
|
value: function createModelData(data, option) {
|
|
446
388
|
var _this$layerModel;
|
|
447
|
-
|
|
448
389
|
if ((_this$layerModel = this.layerModel) !== null && _this$layerModel !== void 0 && _this$layerModel.createModelData) {
|
|
449
390
|
// 在某些特殊图层中单独构建 attribute & elements
|
|
450
391
|
return this.layerModel.createModelData(option);
|
|
451
392
|
}
|
|
452
|
-
|
|
453
393
|
var calEncodeData = this.calculateEncodeData(data, option);
|
|
454
394
|
var triangulation = this.triangulation;
|
|
455
|
-
|
|
456
395
|
if (calEncodeData && triangulation) {
|
|
457
396
|
return this.styleAttributeService.createAttributesAndIndices(calEncodeData, triangulation);
|
|
458
397
|
} else {
|
|
@@ -480,15 +419,14 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
480
419
|
/**
|
|
481
420
|
* Model初始化前需要更新Model样式
|
|
482
421
|
*/
|
|
483
|
-
|
|
484
422
|
}, {
|
|
485
423
|
key: "prepareBuildModel",
|
|
486
424
|
value: function prepareBuildModel() {
|
|
487
|
-
this.updateLayerConfig(_objectSpread(_objectSpread(_objectSpread({}, this.getDefaultConfig()), this.rawConfig), this.needUpdateConfig));
|
|
425
|
+
this.updateLayerConfig(_objectSpread(_objectSpread(_objectSpread({}, this.getDefaultConfig()), this.rawConfig), this.needUpdateConfig));
|
|
488
426
|
|
|
427
|
+
// 启动动画
|
|
489
428
|
var _this$getLayerConfig2 = this.getLayerConfig(),
|
|
490
|
-
|
|
491
|
-
|
|
429
|
+
animateOption = _this$getLayerConfig2.animateOption;
|
|
492
430
|
if (animateOption !== null && animateOption !== void 0 && animateOption.enable) {
|
|
493
431
|
this.layerService.startAnimate();
|
|
494
432
|
this.animateStatus = true;
|
|
@@ -499,8 +437,9 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
499
437
|
value: function color(field, values, updateOptions) {
|
|
500
438
|
this.updateStyleAttribute('color', field, values, updateOptions);
|
|
501
439
|
return this;
|
|
502
|
-
}
|
|
440
|
+
}
|
|
503
441
|
|
|
442
|
+
// 为对应的图层传入纹理的编号名称(point/image 在 shape 方法中传入纹理名称的方法并不通用)
|
|
504
443
|
}, {
|
|
505
444
|
key: "texture",
|
|
506
445
|
value: function texture(field, values, updateOptions) {
|
|
@@ -518,8 +457,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
518
457
|
value: function size(field, values, updateOptions) {
|
|
519
458
|
this.updateStyleAttribute('size', field, values, updateOptions);
|
|
520
459
|
return this;
|
|
521
|
-
}
|
|
522
|
-
|
|
460
|
+
}
|
|
461
|
+
// 对mapping后的数据过滤,scale保持不变
|
|
523
462
|
}, {
|
|
524
463
|
key: "filter",
|
|
525
464
|
value: function filter(field, values, updateOptions) {
|
|
@@ -553,14 +492,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
553
492
|
key: "animate",
|
|
554
493
|
value: function animate(options) {
|
|
555
494
|
var rawAnimate = {};
|
|
556
|
-
|
|
557
495
|
if (isObject(options)) {
|
|
558
496
|
rawAnimate.enable = true;
|
|
559
497
|
rawAnimate = _objectSpread(_objectSpread({}, rawAnimate), options);
|
|
560
498
|
} else {
|
|
561
499
|
rawAnimate.enable = options;
|
|
562
500
|
}
|
|
563
|
-
|
|
564
501
|
this.updateLayerConfig({
|
|
565
502
|
animateOption: rawAnimate
|
|
566
503
|
});
|
|
@@ -573,9 +510,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
573
510
|
// 判断是否为source
|
|
574
511
|
this.setSource(data);
|
|
575
512
|
return this;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
|
|
513
|
+
}
|
|
514
|
+
// 设置source 配置
|
|
579
515
|
this.sourceOption = {
|
|
580
516
|
data: data,
|
|
581
517
|
options: options
|
|
@@ -587,7 +523,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
587
523
|
key: "setData",
|
|
588
524
|
value: function setData(data, options) {
|
|
589
525
|
var _this4 = this;
|
|
590
|
-
|
|
591
526
|
if (this.inited) {
|
|
592
527
|
this.log(IDebugLog.SourceInitStart, ILayerStage.UPDATE);
|
|
593
528
|
this.layerSource.setData(data, options);
|
|
@@ -595,49 +530,41 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
595
530
|
} else {
|
|
596
531
|
this.on('inited', function () {
|
|
597
532
|
_this4.log(IDebugLog.SourceInitStart, ILayerStage.UPDATE);
|
|
598
|
-
|
|
599
533
|
var currentSource = _this4.getSource();
|
|
600
|
-
|
|
601
534
|
if (!currentSource) {
|
|
602
535
|
// 执行 setData 的时候 source 还不存在(还未执行 addLayer)
|
|
603
536
|
_this4.source(new Source(data, options));
|
|
604
537
|
} else {
|
|
605
538
|
_this4.layerSource.setData(data, options);
|
|
606
539
|
}
|
|
607
|
-
|
|
608
540
|
_this4.layerSource.once('update', function () {
|
|
609
541
|
_this4.log(IDebugLog.SourceInitEnd, ILayerStage.UPDATE);
|
|
610
542
|
});
|
|
611
543
|
});
|
|
612
544
|
}
|
|
613
|
-
|
|
614
545
|
return this;
|
|
615
546
|
}
|
|
616
547
|
}, {
|
|
617
548
|
key: "style",
|
|
618
549
|
value: function style(options) {
|
|
619
550
|
var _this5 = this;
|
|
620
|
-
|
|
621
551
|
var passes = options.passes,
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
552
|
+
rest = _objectWithoutProperties(options, _excluded);
|
|
553
|
+
// passes 特殊处理
|
|
625
554
|
if (passes) {
|
|
626
555
|
normalizePasses(passes).forEach(function (pass) {
|
|
627
556
|
var postProcessingPass = _this5.multiPassRenderer.getPostProcessor().getPostProcessingPassByName(pass[0]);
|
|
628
|
-
|
|
629
557
|
if (postProcessingPass) {
|
|
630
558
|
postProcessingPass.updateOptions(pass[1]);
|
|
631
559
|
}
|
|
632
560
|
});
|
|
633
561
|
}
|
|
634
|
-
|
|
635
562
|
this.rawConfig = _objectSpread(_objectSpread({}, this.rawConfig), rest);
|
|
636
|
-
|
|
637
563
|
if (this.container) {
|
|
638
564
|
this.updateLayerConfig(this.rawConfig);
|
|
639
565
|
this.styleNeedUpdate = true;
|
|
640
|
-
}
|
|
566
|
+
}
|
|
567
|
+
// TODO style model 更新
|
|
641
568
|
// @ts-ignore
|
|
642
569
|
// if (lastConfig && lastConfig.mask === true && options.mask === false) {
|
|
643
570
|
// this.clearModels();
|
|
@@ -645,32 +572,27 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
645
572
|
// this.models = models;
|
|
646
573
|
// });
|
|
647
574
|
// }
|
|
648
|
-
|
|
649
|
-
|
|
650
575
|
return this;
|
|
651
576
|
}
|
|
652
577
|
}, {
|
|
653
578
|
key: "scale",
|
|
654
579
|
value: function scale(field, cfg) {
|
|
655
580
|
var preOption = _objectSpread({}, this.scaleOptions);
|
|
656
|
-
|
|
657
581
|
if (isObject(field)) {
|
|
658
582
|
this.scaleOptions = _objectSpread(_objectSpread({}, this.scaleOptions), field);
|
|
659
583
|
} else {
|
|
660
584
|
this.scaleOptions[field] = cfg;
|
|
661
585
|
}
|
|
662
|
-
|
|
663
586
|
if (this.styleAttributeService && !isEqual(preOption, this.scaleOptions)) {
|
|
664
587
|
var scaleOptions = isObject(field) ? field : _defineProperty({}, field, cfg);
|
|
665
588
|
this.styleAttributeService.updateScaleAttribute(scaleOptions);
|
|
666
589
|
}
|
|
667
|
-
|
|
668
590
|
return this;
|
|
669
591
|
}
|
|
592
|
+
|
|
670
593
|
/**
|
|
671
594
|
* 渲染所有的图层
|
|
672
595
|
*/
|
|
673
|
-
|
|
674
596
|
}, {
|
|
675
597
|
key: "renderLayers",
|
|
676
598
|
value: function renderLayers() {
|
|
@@ -682,75 +604,61 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
682
604
|
key: "render",
|
|
683
605
|
value: function render() {
|
|
684
606
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
685
|
-
|
|
686
607
|
if (this.tileLayer) {
|
|
687
608
|
// 瓦片图层执行单独的 render 渲染队列
|
|
688
609
|
this.tileLayer.render();
|
|
689
610
|
return this;
|
|
690
611
|
}
|
|
691
|
-
|
|
692
612
|
this.layerService.beforeRenderData(this);
|
|
693
|
-
|
|
694
613
|
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
695
614
|
return this;
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
|
|
615
|
+
}
|
|
616
|
+
// Tip: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
699
617
|
this.renderModels(options);
|
|
700
618
|
return this;
|
|
701
619
|
}
|
|
620
|
+
|
|
702
621
|
/**
|
|
703
622
|
* renderMultiPass 专门用于渲染支持 multipass 的 layer
|
|
704
623
|
*/
|
|
705
|
-
|
|
706
624
|
}, {
|
|
707
625
|
key: "renderMultiPass",
|
|
708
626
|
value: function () {
|
|
709
627
|
var _renderMultiPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
710
628
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
711
|
-
while (1) {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
_context2.next = 2;
|
|
716
|
-
break;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
return _context2.abrupt("return");
|
|
720
|
-
|
|
721
|
-
case 2:
|
|
722
|
-
if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
|
|
723
|
-
_context2.next = 7;
|
|
724
|
-
break;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
_context2.next = 5;
|
|
728
|
-
return this.multiPassRenderer.render();
|
|
729
|
-
|
|
730
|
-
case 5:
|
|
731
|
-
_context2.next = 8;
|
|
629
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
630
|
+
case 0:
|
|
631
|
+
if (!(this.encodeDataLength <= 0 && !this.forceRender)) {
|
|
632
|
+
_context2.next = 2;
|
|
732
633
|
break;
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
634
|
+
}
|
|
635
|
+
return _context2.abrupt("return");
|
|
636
|
+
case 2:
|
|
637
|
+
if (!(this.multiPassRenderer && this.multiPassRenderer.getRenderFlag())) {
|
|
638
|
+
_context2.next = 7;
|
|
639
|
+
break;
|
|
640
|
+
}
|
|
641
|
+
_context2.next = 5;
|
|
642
|
+
return this.multiPassRenderer.render();
|
|
643
|
+
case 5:
|
|
644
|
+
_context2.next = 8;
|
|
645
|
+
break;
|
|
646
|
+
case 7:
|
|
647
|
+
if (this.multiPassRenderer) {
|
|
648
|
+
// renderPass 触发的渲染
|
|
649
|
+
this.renderModels();
|
|
650
|
+
} else {
|
|
651
|
+
this.renderModels();
|
|
652
|
+
}
|
|
653
|
+
case 8:
|
|
654
|
+
case "end":
|
|
655
|
+
return _context2.stop();
|
|
746
656
|
}
|
|
747
657
|
}, _callee2, this);
|
|
748
658
|
}));
|
|
749
|
-
|
|
750
659
|
function renderMultiPass() {
|
|
751
660
|
return _renderMultiPass.apply(this, arguments);
|
|
752
661
|
}
|
|
753
|
-
|
|
754
662
|
return renderMultiPass;
|
|
755
663
|
}()
|
|
756
664
|
}, {
|
|
@@ -758,21 +666,17 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
758
666
|
value: function active(options) {
|
|
759
667
|
var activeOption = {};
|
|
760
668
|
activeOption.enableHighlight = isObject(options) ? true : options;
|
|
761
|
-
|
|
762
669
|
if (isObject(options)) {
|
|
763
670
|
activeOption.enableHighlight = true;
|
|
764
|
-
|
|
765
671
|
if (options.color) {
|
|
766
672
|
activeOption.highlightColor = options.color;
|
|
767
673
|
}
|
|
768
|
-
|
|
769
674
|
if (options.mix) {
|
|
770
675
|
activeOption.activeMix = options.mix;
|
|
771
676
|
}
|
|
772
677
|
} else {
|
|
773
678
|
activeOption.enableHighlight = !!options;
|
|
774
679
|
}
|
|
775
|
-
|
|
776
680
|
this.updateLayerConfig(activeOption);
|
|
777
681
|
return this;
|
|
778
682
|
}
|
|
@@ -780,12 +684,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
780
684
|
key: "setActive",
|
|
781
685
|
value: function setActive(id, options) {
|
|
782
686
|
var _this6 = this;
|
|
783
|
-
|
|
784
687
|
if (isObject(id)) {
|
|
785
688
|
var _id$x = id.x,
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
689
|
+
x = _id$x === void 0 ? 0 : _id$x,
|
|
690
|
+
_id$y = id.y,
|
|
691
|
+
y = _id$y === void 0 ? 0 : _id$y;
|
|
789
692
|
this.updateLayerConfig({
|
|
790
693
|
highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
|
|
791
694
|
activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
|
|
@@ -800,7 +703,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
800
703
|
highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
|
|
801
704
|
activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
|
|
802
705
|
});
|
|
803
|
-
this.hooks.beforeHighlight.call(encodePickingColor(id))
|
|
706
|
+
this.hooks.beforeHighlight.call(encodePickingColor(id))
|
|
707
|
+
// @ts-ignore
|
|
804
708
|
.then(function () {
|
|
805
709
|
setTimeout(function () {
|
|
806
710
|
_this6.reRender();
|
|
@@ -813,21 +717,17 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
813
717
|
value: function select(option) {
|
|
814
718
|
var activeOption = {};
|
|
815
719
|
activeOption.enableSelect = isObject(option) ? true : option;
|
|
816
|
-
|
|
817
720
|
if (isObject(option)) {
|
|
818
721
|
activeOption.enableSelect = true;
|
|
819
|
-
|
|
820
722
|
if (option.color) {
|
|
821
723
|
activeOption.selectColor = option.color;
|
|
822
724
|
}
|
|
823
|
-
|
|
824
725
|
if (option.mix) {
|
|
825
726
|
activeOption.selectMix = option.mix;
|
|
826
727
|
}
|
|
827
728
|
} else {
|
|
828
729
|
activeOption.enableSelect = !!option;
|
|
829
730
|
}
|
|
830
|
-
|
|
831
731
|
this.updateLayerConfig(activeOption);
|
|
832
732
|
return this;
|
|
833
733
|
}
|
|
@@ -835,12 +735,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
835
735
|
key: "setSelect",
|
|
836
736
|
value: function setSelect(id, options) {
|
|
837
737
|
var _this7 = this;
|
|
838
|
-
|
|
839
738
|
if (isObject(id)) {
|
|
840
739
|
var _id$x2 = id.x,
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
740
|
+
x = _id$x2 === void 0 ? 0 : _id$x2,
|
|
741
|
+
_id$y2 = id.y,
|
|
742
|
+
y = _id$y2 === void 0 ? 0 : _id$y2;
|
|
844
743
|
this.updateLayerConfig({
|
|
845
744
|
selectColor: isObject(options) ? options.color : this.getLayerConfig().selectColor,
|
|
846
745
|
selectMix: isObject(options) ? options.mix : this.getLayerConfig().selectMix
|
|
@@ -855,7 +754,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
855
754
|
selectColor: isObject(options) ? options.color : this.getLayerConfig().selectColor,
|
|
856
755
|
selectMix: isObject(options) ? options.mix : this.getLayerConfig().selectMix
|
|
857
756
|
});
|
|
858
|
-
this.hooks.beforeSelect.call(encodePickingColor(id))
|
|
757
|
+
this.hooks.beforeSelect.call(encodePickingColor(id))
|
|
758
|
+
// @ts-ignore
|
|
859
759
|
.then(function () {
|
|
860
760
|
setTimeout(function () {
|
|
861
761
|
_this7.reRender();
|
|
@@ -868,8 +768,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
868
768
|
value: function setBlend(type) {
|
|
869
769
|
this.updateLayerConfig({
|
|
870
770
|
blend: type
|
|
871
|
-
});
|
|
872
|
-
|
|
771
|
+
});
|
|
772
|
+
// this.layerModelNeedUpdate = true;
|
|
873
773
|
this.reRender();
|
|
874
774
|
return this;
|
|
875
775
|
}
|
|
@@ -925,14 +825,12 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
925
825
|
key: "isVisible",
|
|
926
826
|
value: function isVisible() {
|
|
927
827
|
var zoom = this.mapService.getZoom();
|
|
928
|
-
|
|
929
828
|
var _this$getLayerConfig3 = this.getLayerConfig(),
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
829
|
+
visible = _this$getLayerConfig3.visible,
|
|
830
|
+
_this$getLayerConfig4 = _this$getLayerConfig3.minZoom,
|
|
831
|
+
minZoom = _this$getLayerConfig4 === void 0 ? -Infinity : _this$getLayerConfig4,
|
|
832
|
+
_this$getLayerConfig5 = _this$getLayerConfig3.maxZoom,
|
|
833
|
+
maxZoom = _this$getLayerConfig5 === void 0 ? Infinity : _this$getLayerConfig5;
|
|
936
834
|
return !!visible && zoom >= minZoom && zoom < maxZoom;
|
|
937
835
|
}
|
|
938
836
|
}, {
|
|
@@ -941,28 +839,22 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
941
839
|
this.updateLayerConfig({
|
|
942
840
|
enableMultiPassRenderer: enableMultiPass
|
|
943
841
|
});
|
|
944
|
-
|
|
945
842
|
if (currentPasses) {
|
|
946
843
|
this.updateLayerConfig({
|
|
947
844
|
passes: currentPasses
|
|
948
845
|
});
|
|
949
846
|
}
|
|
950
|
-
|
|
951
847
|
if (enableMultiPass) {
|
|
952
848
|
var _this$getLayerConfig6 = this.getLayerConfig(),
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
849
|
+
_this$getLayerConfig7 = _this$getLayerConfig6.passes,
|
|
850
|
+
passes = _this$getLayerConfig7 === void 0 ? [] : _this$getLayerConfig7;
|
|
956
851
|
this.multiPassRenderer = createMultiPassRenderer(this, passes, this.postProcessingPassFactory, this.normalPassFactory);
|
|
957
852
|
this.multiPassRenderer.setRenderFlag(true);
|
|
958
|
-
|
|
959
853
|
var _this$rendererService = this.rendererService.getViewportSize(),
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
854
|
+
width = _this$rendererService.width,
|
|
855
|
+
height = _this$rendererService.height;
|
|
963
856
|
this.multiPassRenderer.resize(width, height);
|
|
964
857
|
}
|
|
965
|
-
|
|
966
858
|
return this;
|
|
967
859
|
}
|
|
968
860
|
}, {
|
|
@@ -977,23 +869,21 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
977
869
|
key: "getMinZoom",
|
|
978
870
|
value: function getMinZoom() {
|
|
979
871
|
var _this$getLayerConfig8 = this.getLayerConfig(),
|
|
980
|
-
|
|
981
|
-
|
|
872
|
+
minZoom = _this$getLayerConfig8.minZoom;
|
|
982
873
|
return minZoom;
|
|
983
874
|
}
|
|
984
875
|
}, {
|
|
985
876
|
key: "getMaxZoom",
|
|
986
877
|
value: function getMaxZoom() {
|
|
987
878
|
var _this$getLayerConfig9 = this.getLayerConfig(),
|
|
988
|
-
|
|
989
|
-
|
|
879
|
+
maxZoom = _this$getLayerConfig9.maxZoom;
|
|
990
880
|
return maxZoom;
|
|
991
881
|
}
|
|
992
882
|
}, {
|
|
993
883
|
key: "get",
|
|
994
884
|
value: function get(name) {
|
|
995
|
-
var cfg = this.getLayerConfig();
|
|
996
|
-
|
|
885
|
+
var cfg = this.getLayerConfig();
|
|
886
|
+
// @ts-ignore
|
|
997
887
|
return cfg[name];
|
|
998
888
|
}
|
|
999
889
|
}, {
|
|
@@ -1012,10 +902,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1012
902
|
});
|
|
1013
903
|
return this;
|
|
1014
904
|
}
|
|
905
|
+
|
|
1015
906
|
/**
|
|
1016
907
|
* zoom to layer Bounds
|
|
1017
908
|
*/
|
|
1018
|
-
|
|
1019
909
|
}, {
|
|
1020
910
|
key: "fitBounds",
|
|
1021
911
|
value: function fitBounds(fitBoundsOptions) {
|
|
@@ -1025,17 +915,14 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1025
915
|
});
|
|
1026
916
|
return this;
|
|
1027
917
|
}
|
|
1028
|
-
|
|
1029
918
|
var source = this.getSource();
|
|
1030
919
|
var extent = source.extent;
|
|
1031
920
|
var isValid = extent.some(function (v) {
|
|
1032
921
|
return Math.abs(v) === Infinity;
|
|
1033
922
|
});
|
|
1034
|
-
|
|
1035
923
|
if (isValid) {
|
|
1036
924
|
return this;
|
|
1037
925
|
}
|
|
1038
|
-
|
|
1039
926
|
this.mapService.fitBounds([[extent[0], extent[1]], [extent[2], extent[3]]], fitBoundsOptions);
|
|
1040
927
|
return this;
|
|
1041
928
|
}
|
|
@@ -1043,43 +930,43 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1043
930
|
key: "destroy",
|
|
1044
931
|
value: function destroy() {
|
|
1045
932
|
var _this$multiPassRender, _this$layerModel2, _this$tileLayer, _this$debugService2;
|
|
1046
|
-
|
|
1047
933
|
var refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1048
|
-
|
|
1049
934
|
if (this.isDestroyed) {
|
|
1050
935
|
return;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
936
|
+
}
|
|
1053
937
|
|
|
938
|
+
// remove child layer
|
|
1054
939
|
this.layerChildren.map(function (child) {
|
|
1055
940
|
return child.destroy(false);
|
|
1056
941
|
});
|
|
1057
|
-
this.layerChildren = [];
|
|
942
|
+
this.layerChildren = [];
|
|
1058
943
|
|
|
944
|
+
// remove mask list maskfence 掩膜需要销毁
|
|
1059
945
|
var _this$getLayerConfig10 = this.getLayerConfig(),
|
|
1060
|
-
|
|
1061
|
-
|
|
946
|
+
maskfence = _this$getLayerConfig10.maskfence;
|
|
1062
947
|
if (maskfence) {
|
|
1063
948
|
this.masks.map(function (mask) {
|
|
1064
949
|
return mask.destroy(false);
|
|
1065
950
|
});
|
|
1066
951
|
this.masks = [];
|
|
1067
952
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
953
|
+
this.hooks.beforeDestroy.call();
|
|
954
|
+
// 清除sources事件
|
|
1071
955
|
this.layerSource.off('update', this.sourceEvent);
|
|
1072
956
|
(_this$multiPassRender = this.multiPassRenderer) === null || _this$multiPassRender === void 0 ? void 0 : _this$multiPassRender.destroy();
|
|
1073
|
-
this.textureService.destroy();
|
|
957
|
+
this.textureService.destroy();
|
|
1074
958
|
|
|
1075
|
-
this.
|
|
959
|
+
// 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());
|
|
960
|
+
this.styleAttributeService.clearAllAttributes();
|
|
1076
961
|
|
|
1077
|
-
|
|
962
|
+
// 执行每个图层单独的 clearModels 方法 (清除一些额外的 texture、program、buffer 等)
|
|
1078
963
|
|
|
964
|
+
this.hooks.afterDestroy.call();
|
|
965
|
+
// Tip: 清除各个图层自定义的 models 资源
|
|
1079
966
|
(_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels(refresh);
|
|
1080
967
|
(_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0 ? void 0 : _this$tileLayer.destroy();
|
|
1081
|
-
this.models = [];
|
|
1082
|
-
|
|
968
|
+
this.models = [];
|
|
969
|
+
// 清除图层日志(如果有的话:非瓦片相关)
|
|
1083
970
|
(_this$debugService2 = this.debugService) === null || _this$debugService2 === void 0 ? void 0 : _this$debugService2.removeLog(this.id);
|
|
1084
971
|
this.emit('remove', {
|
|
1085
972
|
target: this,
|
|
@@ -1089,7 +976,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1089
976
|
target: this,
|
|
1090
977
|
type: 'destroy'
|
|
1091
978
|
});
|
|
1092
|
-
this.removeAllListeners();
|
|
979
|
+
this.removeAllListeners();
|
|
980
|
+
// 解绑图层容器中的服务
|
|
1093
981
|
// this.container.unbind(TYPES.IStyleAttributeService);
|
|
1094
982
|
|
|
1095
983
|
this.isDestroyed = true;
|
|
@@ -1097,13 +985,13 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1097
985
|
}, {
|
|
1098
986
|
key: "clear",
|
|
1099
987
|
value: function clear() {
|
|
1100
|
-
this.styleAttributeService.clearAllAttributes();
|
|
988
|
+
this.styleAttributeService.clearAllAttributes();
|
|
989
|
+
// 销毁所有 model
|
|
1101
990
|
}
|
|
1102
991
|
}, {
|
|
1103
992
|
key: "clearModels",
|
|
1104
993
|
value: function clearModels() {
|
|
1105
994
|
var _this$layerModel3;
|
|
1106
|
-
|
|
1107
995
|
this.models.forEach(function (model) {
|
|
1108
996
|
return model.destroy();
|
|
1109
997
|
});
|
|
@@ -1116,54 +1004,45 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1116
1004
|
return !!(this.styleAttributeService.getLayerStyleAttributes() || []).filter(function (attribute) {
|
|
1117
1005
|
return attribute.needRescale || attribute.needRemapping || attribute.needRegenerateVertices;
|
|
1118
1006
|
}).length;
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1007
|
+
}
|
|
1008
|
+
// 外部初始化Source
|
|
1121
1009
|
}, {
|
|
1122
1010
|
key: "setSource",
|
|
1123
1011
|
value: function setSource(source) {
|
|
1124
1012
|
var _this8 = this;
|
|
1125
|
-
|
|
1126
1013
|
// 解除原 sources 事件
|
|
1127
1014
|
if (this.layerSource) {
|
|
1128
1015
|
this.layerSource.off('update', this.sourceEvent);
|
|
1129
1016
|
}
|
|
1130
|
-
|
|
1131
1017
|
this.layerSource = source;
|
|
1132
|
-
this.clusterZoom = 0;
|
|
1018
|
+
this.clusterZoom = 0;
|
|
1133
1019
|
|
|
1020
|
+
// 已 inited 且启用聚合进行更新聚合数据
|
|
1134
1021
|
if (this.inited && this.layerSource.cluster) {
|
|
1135
1022
|
var zoom = this.mapService.getZoom();
|
|
1136
1023
|
this.layerSource.updateClusterData(zoom);
|
|
1137
1024
|
}
|
|
1138
|
-
|
|
1139
1025
|
if (this.layerSource.inited) {
|
|
1140
1026
|
this.sourceEvent();
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1027
|
+
}
|
|
1028
|
+
// this.layerSource.inited 为 true update 事件不会再触发
|
|
1144
1029
|
this.layerSource.on('update', function (_ref4) {
|
|
1145
1030
|
var type = _ref4.type;
|
|
1146
|
-
|
|
1147
1031
|
if (_this8.coordCenter === undefined) {
|
|
1148
1032
|
var _this8$mapService;
|
|
1149
|
-
|
|
1150
1033
|
var layerCenter = _this8.layerSource.center;
|
|
1151
1034
|
_this8.coordCenter = layerCenter;
|
|
1152
|
-
|
|
1153
1035
|
if ((_this8$mapService = _this8.mapService) !== null && _this8$mapService !== void 0 && _this8$mapService.setCoordCenter) {
|
|
1154
1036
|
_this8.mapService.setCoordCenter(layerCenter);
|
|
1155
1037
|
}
|
|
1156
1038
|
}
|
|
1157
|
-
|
|
1158
1039
|
if (type === 'update') {
|
|
1159
1040
|
if (_this8.tileLayer) {
|
|
1160
1041
|
// 瓦片图层独立更新
|
|
1161
1042
|
_this8.tileLayer.reload();
|
|
1162
|
-
|
|
1163
1043
|
return;
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1044
|
+
}
|
|
1045
|
+
// source 初始化不需要处理
|
|
1167
1046
|
_this8.sourceEvent();
|
|
1168
1047
|
}
|
|
1169
1048
|
});
|
|
@@ -1198,7 +1077,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1198
1077
|
key: "getLegend",
|
|
1199
1078
|
value: function getLegend(name) {
|
|
1200
1079
|
var _attribute$scale, _scales$0$option, _attribute$scale2;
|
|
1201
|
-
|
|
1202
1080
|
var attribute = this.styleAttributeService.getLayerStyleAttribute(name);
|
|
1203
1081
|
var scales = (attribute === null || attribute === void 0 ? void 0 : (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.scalers) || [];
|
|
1204
1082
|
return {
|
|
@@ -1210,12 +1088,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1210
1088
|
}, {
|
|
1211
1089
|
key: "getLegendItems",
|
|
1212
1090
|
value: function getLegendItems(name) {
|
|
1213
|
-
var scale = this.styleAttributeService.getLayerAttributeScale(name);
|
|
1214
|
-
|
|
1091
|
+
var scale = this.styleAttributeService.getLayerAttributeScale(name);
|
|
1092
|
+
// 函数自定义映射,没有 scale 返回为空数组
|
|
1215
1093
|
if (!scale) {
|
|
1216
1094
|
return [];
|
|
1217
1095
|
}
|
|
1218
|
-
|
|
1219
1096
|
if (scale.invertExtent) {
|
|
1220
1097
|
// 分段类型 Quantize、Quantile、Threshold
|
|
1221
1098
|
var items = scale.range().map(function (item) {
|
|
@@ -1231,7 +1108,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1231
1108
|
value: item
|
|
1232
1109
|
}, name, scale(item));
|
|
1233
1110
|
});
|
|
1234
|
-
|
|
1235
1111
|
return _items;
|
|
1236
1112
|
} else if (scale !== null && scale !== void 0 && scale.domain) {
|
|
1237
1113
|
// 枚举类型 Cat
|
|
@@ -1242,17 +1118,15 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1242
1118
|
value: item
|
|
1243
1119
|
}, name, scale(item));
|
|
1244
1120
|
});
|
|
1245
|
-
|
|
1246
1121
|
return _items2;
|
|
1247
1122
|
}
|
|
1248
|
-
|
|
1249
1123
|
return [];
|
|
1250
1124
|
}
|
|
1251
1125
|
}, {
|
|
1252
1126
|
key: "pick",
|
|
1253
1127
|
value: function pick(_ref8) {
|
|
1254
1128
|
var x = _ref8.x,
|
|
1255
|
-
|
|
1129
|
+
y = _ref8.y;
|
|
1256
1130
|
this.interactionService.triggerHover({
|
|
1257
1131
|
x: x,
|
|
1258
1132
|
y: y
|
|
@@ -1268,84 +1142,73 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1268
1142
|
value: function () {
|
|
1269
1143
|
var _buildLayerModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
|
|
1270
1144
|
var _this9 = this;
|
|
1271
|
-
|
|
1272
1145
|
var moduleName, vertexShader, fragmentShader, triangulation, segmentNumber, _options$workerEnable, workerEnabled, workerOptions, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
|
|
1273
|
-
|
|
1274
1146
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
1275
|
-
while (1) {
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
var m = createModel(_objectSpread({
|
|
1292
|
-
attributes: attributes,
|
|
1293
|
-
uniforms: uniforms,
|
|
1294
|
-
fs: fs,
|
|
1295
|
-
vs: vs,
|
|
1296
|
-
elements: elements,
|
|
1297
|
-
blend: BlendTypes[BlendType.normal]
|
|
1298
|
-
}, rest));
|
|
1299
|
-
resolve(m);
|
|
1300
|
-
}).catch(function (err) {
|
|
1301
|
-
return reject(err);
|
|
1302
|
-
});
|
|
1303
|
-
} else {
|
|
1304
|
-
var _this9$styleAttribute = _this9.styleAttributeService.createAttributesAndIndices(_this9.encodedData, triangulation, segmentNumber),
|
|
1305
|
-
attributes = _this9$styleAttribute.attributes,
|
|
1306
|
-
elements = _this9$styleAttribute.elements,
|
|
1307
|
-
count = _this9$styleAttribute.count;
|
|
1308
|
-
|
|
1309
|
-
var modelOptions = _objectSpread({
|
|
1147
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1148
|
+
case 0:
|
|
1149
|
+
moduleName = options.moduleName, vertexShader = options.vertexShader, fragmentShader = options.fragmentShader, triangulation = options.triangulation, segmentNumber = options.segmentNumber, _options$workerEnable = options.workerEnabled, workerEnabled = _options$workerEnable === void 0 ? false : _options$workerEnable, workerOptions = options.workerOptions, rest = _objectWithoutProperties(options, _excluded2);
|
|
1150
|
+
this.shaderModuleService.registerModule(moduleName, {
|
|
1151
|
+
vs: vertexShader,
|
|
1152
|
+
fs: fragmentShader
|
|
1153
|
+
});
|
|
1154
|
+
_this$shaderModuleSer = this.shaderModuleService.getModule(moduleName), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, uniforms = _this$shaderModuleSer.uniforms;
|
|
1155
|
+
createModel = this.rendererService.createModel;
|
|
1156
|
+
return _context3.abrupt("return", new Promise(function (resolve, reject) {
|
|
1157
|
+
// filter supported worker & worker enabled layer
|
|
1158
|
+
if (workerOptions && workerOptions.modelType in WorkerSourceMap && workerEnabled) {
|
|
1159
|
+
_this9.styleAttributeService.createAttributesAndIndicesAscy(_this9.encodedData, segmentNumber, workerOptions).then(function (_ref9) {
|
|
1160
|
+
var attributes = _ref9.attributes,
|
|
1161
|
+
elements = _ref9.elements;
|
|
1162
|
+
var m = createModel(_objectSpread({
|
|
1310
1163
|
attributes: attributes,
|
|
1311
1164
|
uniforms: uniforms,
|
|
1312
1165
|
fs: fs,
|
|
1313
1166
|
vs: vs,
|
|
1314
1167
|
elements: elements,
|
|
1315
1168
|
blend: BlendTypes[BlendType.normal]
|
|
1316
|
-
}, rest);
|
|
1317
|
-
|
|
1318
|
-
if (count) {
|
|
1319
|
-
modelOptions.count = count;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
var m = createModel(modelOptions);
|
|
1169
|
+
}, rest));
|
|
1323
1170
|
resolve(m);
|
|
1171
|
+
}).catch(function (err) {
|
|
1172
|
+
return reject(err);
|
|
1173
|
+
});
|
|
1174
|
+
} else {
|
|
1175
|
+
var _this9$styleAttribute = _this9.styleAttributeService.createAttributesAndIndices(_this9.encodedData, triangulation, segmentNumber),
|
|
1176
|
+
attributes = _this9$styleAttribute.attributes,
|
|
1177
|
+
elements = _this9$styleAttribute.elements,
|
|
1178
|
+
count = _this9$styleAttribute.count;
|
|
1179
|
+
var modelOptions = _objectSpread({
|
|
1180
|
+
attributes: attributes,
|
|
1181
|
+
uniforms: uniforms,
|
|
1182
|
+
fs: fs,
|
|
1183
|
+
vs: vs,
|
|
1184
|
+
elements: elements,
|
|
1185
|
+
blend: BlendTypes[BlendType.normal]
|
|
1186
|
+
}, rest);
|
|
1187
|
+
if (count) {
|
|
1188
|
+
modelOptions.count = count;
|
|
1324
1189
|
}
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1190
|
+
var m = createModel(modelOptions);
|
|
1191
|
+
resolve(m);
|
|
1192
|
+
}
|
|
1193
|
+
}));
|
|
1194
|
+
case 5:
|
|
1195
|
+
case "end":
|
|
1196
|
+
return _context3.stop();
|
|
1331
1197
|
}
|
|
1332
1198
|
}, _callee3, this);
|
|
1333
1199
|
}));
|
|
1334
|
-
|
|
1335
1200
|
function buildLayerModel(_x) {
|
|
1336
1201
|
return _buildLayerModel.apply(this, arguments);
|
|
1337
1202
|
}
|
|
1338
|
-
|
|
1339
1203
|
return buildLayerModel;
|
|
1340
1204
|
}()
|
|
1341
1205
|
}, {
|
|
1342
1206
|
key: "createAttributes",
|
|
1343
1207
|
value: function createAttributes(options) {
|
|
1344
|
-
var triangulation = options.triangulation;
|
|
1345
|
-
|
|
1208
|
+
var triangulation = options.triangulation;
|
|
1209
|
+
// @ts-ignore
|
|
1346
1210
|
var _this$styleAttributeS = this.styleAttributeService.createAttributes(this.encodedData, triangulation),
|
|
1347
|
-
|
|
1348
|
-
|
|
1211
|
+
attributes = _this$styleAttributeS.attributes;
|
|
1349
1212
|
return attributes;
|
|
1350
1213
|
}
|
|
1351
1214
|
}, {
|
|
@@ -1380,22 +1243,18 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1380
1243
|
key: "needPick",
|
|
1381
1244
|
value: function needPick(type) {
|
|
1382
1245
|
var _this$getLayerConfig11 = this.getLayerConfig(),
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1246
|
+
_this$getLayerConfig12 = _this$getLayerConfig11.enableHighlight,
|
|
1247
|
+
enableHighlight = _this$getLayerConfig12 === void 0 ? true : _this$getLayerConfig12,
|
|
1248
|
+
_this$getLayerConfig13 = _this$getLayerConfig11.enableSelect,
|
|
1249
|
+
enableSelect = _this$getLayerConfig13 === void 0 ? true : _this$getLayerConfig13;
|
|
1250
|
+
// 判断layer是否监听事件;
|
|
1389
1251
|
var isPick = this.eventNames().indexOf(type) !== -1 || this.eventNames().indexOf('un' + type) !== -1;
|
|
1390
|
-
|
|
1391
1252
|
if ((type === 'click' || type === 'dblclick') && enableSelect) {
|
|
1392
1253
|
isPick = true;
|
|
1393
1254
|
}
|
|
1394
|
-
|
|
1395
1255
|
if (type === 'mousemove' && (enableHighlight || this.eventNames().indexOf('mouseenter') !== -1 || this.eventNames().indexOf('unmousemove') !== -1 || this.eventNames().indexOf('mouseout') !== -1)) {
|
|
1396
1256
|
isPick = true;
|
|
1397
1257
|
}
|
|
1398
|
-
|
|
1399
1258
|
return this.isVisible() && isPick;
|
|
1400
1259
|
}
|
|
1401
1260
|
}, {
|
|
@@ -1403,23 +1262,18 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1403
1262
|
value: function () {
|
|
1404
1263
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
1405
1264
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
1406
|
-
while (1) {
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
case "end":
|
|
1413
|
-
return _context4.stop();
|
|
1414
|
-
}
|
|
1265
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1266
|
+
case 0:
|
|
1267
|
+
throw new Error('Method not implemented.');
|
|
1268
|
+
case 1:
|
|
1269
|
+
case "end":
|
|
1270
|
+
return _context4.stop();
|
|
1415
1271
|
}
|
|
1416
1272
|
}, _callee4);
|
|
1417
1273
|
}));
|
|
1418
|
-
|
|
1419
1274
|
function buildModels() {
|
|
1420
1275
|
return _buildModels.apply(this, arguments);
|
|
1421
1276
|
}
|
|
1422
|
-
|
|
1423
1277
|
return buildModels;
|
|
1424
1278
|
}()
|
|
1425
1279
|
}, {
|
|
@@ -1427,24 +1281,19 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1427
1281
|
value: function () {
|
|
1428
1282
|
var _rebuildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
1429
1283
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
1430
|
-
while (1) {
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
case "end":
|
|
1438
|
-
return _context5.stop();
|
|
1439
|
-
}
|
|
1284
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
1285
|
+
case 0:
|
|
1286
|
+
_context5.next = 2;
|
|
1287
|
+
return this.buildModels();
|
|
1288
|
+
case 2:
|
|
1289
|
+
case "end":
|
|
1290
|
+
return _context5.stop();
|
|
1440
1291
|
}
|
|
1441
1292
|
}, _callee5, this);
|
|
1442
1293
|
}));
|
|
1443
|
-
|
|
1444
1294
|
function rebuildModels() {
|
|
1445
1295
|
return _rebuildModels.apply(this, arguments);
|
|
1446
1296
|
}
|
|
1447
|
-
|
|
1448
1297
|
return rebuildModels;
|
|
1449
1298
|
}()
|
|
1450
1299
|
}, {
|
|
@@ -1452,38 +1301,30 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1452
1301
|
value: function () {
|
|
1453
1302
|
var _renderMulPass = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(multiPassRenderer) {
|
|
1454
1303
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
1455
|
-
while (1) {
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
case "end":
|
|
1463
|
-
return _context6.stop();
|
|
1464
|
-
}
|
|
1304
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1305
|
+
case 0:
|
|
1306
|
+
_context6.next = 2;
|
|
1307
|
+
return multiPassRenderer.render();
|
|
1308
|
+
case 2:
|
|
1309
|
+
case "end":
|
|
1310
|
+
return _context6.stop();
|
|
1465
1311
|
}
|
|
1466
1312
|
}, _callee6);
|
|
1467
1313
|
}));
|
|
1468
|
-
|
|
1469
1314
|
function renderMulPass(_x2) {
|
|
1470
1315
|
return _renderMulPass.apply(this, arguments);
|
|
1471
1316
|
}
|
|
1472
|
-
|
|
1473
1317
|
return renderMulPass;
|
|
1474
1318
|
}()
|
|
1475
1319
|
}, {
|
|
1476
1320
|
key: "renderModels",
|
|
1477
1321
|
value: function renderModels() {
|
|
1478
1322
|
var _this10 = this;
|
|
1479
|
-
|
|
1480
1323
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1481
|
-
|
|
1482
1324
|
// TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
1483
1325
|
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
1484
1326
|
return this;
|
|
1485
1327
|
}
|
|
1486
|
-
|
|
1487
1328
|
this.hooks.beforeRender.call();
|
|
1488
1329
|
this.models.forEach(function (model) {
|
|
1489
1330
|
model.draw({
|
|
@@ -1499,23 +1340,22 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1499
1340
|
key: "updateStyleAttribute",
|
|
1500
1341
|
value: function updateStyleAttribute(type, field, values, updateOptions) {
|
|
1501
1342
|
// encode diff
|
|
1502
|
-
var preAttribute = this.configService.getAttributeConfig(this.id) || {};
|
|
1503
|
-
|
|
1343
|
+
var preAttribute = this.configService.getAttributeConfig(this.id) || {};
|
|
1344
|
+
// @ts-ignore
|
|
1504
1345
|
if (isEqual(preAttribute[type], {
|
|
1505
1346
|
field: field,
|
|
1506
1347
|
values: values
|
|
1507
1348
|
})) {
|
|
1508
1349
|
return false;
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1350
|
+
}
|
|
1511
1351
|
|
|
1352
|
+
// 存储 Attribute
|
|
1512
1353
|
if (['color', 'size', 'texture', 'rotate', 'filter', 'label', 'shape'].indexOf(type) !== -1) {
|
|
1513
1354
|
this.configService.setAttributeConfig(this.id, _defineProperty({}, type, {
|
|
1514
1355
|
field: field,
|
|
1515
1356
|
values: values
|
|
1516
1357
|
}));
|
|
1517
1358
|
}
|
|
1518
|
-
|
|
1519
1359
|
if (!this.startInit) {
|
|
1520
1360
|
// 开始初始化执行
|
|
1521
1361
|
this.pendingStyleAttributes.push({
|
|
@@ -1529,13 +1369,15 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1529
1369
|
// @ts-ignore
|
|
1530
1370
|
scale: _objectSpread({
|
|
1531
1371
|
field: field
|
|
1532
|
-
}, this.splitValuesAndCallbackInAttribute(
|
|
1533
|
-
|
|
1372
|
+
}, this.splitValuesAndCallbackInAttribute(
|
|
1373
|
+
// @ts-ignore
|
|
1374
|
+
values,
|
|
1375
|
+
// @ts-ignore
|
|
1534
1376
|
this.getLayerConfig()[field]))
|
|
1535
|
-
},
|
|
1377
|
+
},
|
|
1378
|
+
// @ts-ignore
|
|
1536
1379
|
updateOptions);
|
|
1537
1380
|
}
|
|
1538
|
-
|
|
1539
1381
|
return true;
|
|
1540
1382
|
}
|
|
1541
1383
|
}, {
|
|
@@ -1548,19 +1390,20 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1548
1390
|
value: function getShaderPickStat() {
|
|
1549
1391
|
return this.layerService.getShaderPickStat();
|
|
1550
1392
|
}
|
|
1393
|
+
|
|
1551
1394
|
/**
|
|
1552
1395
|
* 继承空方法
|
|
1553
1396
|
* @param time
|
|
1554
1397
|
*/
|
|
1555
1398
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1556
|
-
|
|
1557
1399
|
}, {
|
|
1558
1400
|
key: "setEarthTime",
|
|
1559
1401
|
value: function setEarthTime(time) {
|
|
1560
1402
|
console.warn('empty fn');
|
|
1561
|
-
}
|
|
1562
|
-
// 在各个 layer 中继承
|
|
1403
|
+
}
|
|
1563
1404
|
|
|
1405
|
+
// 数据处理 在数据进行 mapping 生成 encodeData 之前对数据进行处理
|
|
1406
|
+
// 在各个 layer 中继承
|
|
1564
1407
|
}, {
|
|
1565
1408
|
key: "processData",
|
|
1566
1409
|
value: function processData(filterData) {
|
|
@@ -1581,31 +1424,25 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1581
1424
|
value: function () {
|
|
1582
1425
|
var _initLayerModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
1583
1426
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
1584
|
-
while (1) {
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
case 5:
|
|
1598
|
-
case "end":
|
|
1599
|
-
return _context7.stop();
|
|
1600
|
-
}
|
|
1427
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1428
|
+
case 0:
|
|
1429
|
+
this.models.forEach(function (model) {
|
|
1430
|
+
return model.destroy();
|
|
1431
|
+
});
|
|
1432
|
+
this.models = [];
|
|
1433
|
+
_context7.next = 4;
|
|
1434
|
+
return this.layerModel.initModels();
|
|
1435
|
+
case 4:
|
|
1436
|
+
this.models = _context7.sent;
|
|
1437
|
+
case 5:
|
|
1438
|
+
case "end":
|
|
1439
|
+
return _context7.stop();
|
|
1601
1440
|
}
|
|
1602
1441
|
}, _callee7, this);
|
|
1603
1442
|
}));
|
|
1604
|
-
|
|
1605
1443
|
function initLayerModels() {
|
|
1606
1444
|
return _initLayerModels.apply(this, arguments);
|
|
1607
1445
|
}
|
|
1608
|
-
|
|
1609
1446
|
return initLayerModels;
|
|
1610
1447
|
}()
|
|
1611
1448
|
}, {
|
|
@@ -1624,7 +1461,6 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1624
1461
|
};
|
|
1625
1462
|
}
|
|
1626
1463
|
}]);
|
|
1627
|
-
|
|
1628
1464
|
return BaseLayer;
|
|
1629
1465
|
}(EventEmitter), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "configService", [_dec], {
|
|
1630
1466
|
configurable: true,
|