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