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