@antv/l7-layers 2.17.4 → 2.17.6

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