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