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