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