@antv/l7-layers 2.15.2 → 2.15.3

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 (242) 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 +320 -484
  10. package/es/core/BaseModel.js +97 -126
  11. package/es/core/LayerPickService.js +21 -32
  12. package/es/core/TextureService.js +0 -13
  13. package/es/core/interface.js +17 -24
  14. package/es/core/shape/Path.js +13 -20
  15. package/es/core/shape/extrude.js +10 -31
  16. package/es/core/triangulation.js +54 -114
  17. package/es/earth/index.js +9 -33
  18. package/es/earth/models/atmosphere.js +30 -54
  19. package/es/earth/models/base.js +47 -85
  20. package/es/earth/models/bloomsphere.js +30 -54
  21. package/es/earth/utils.js +9 -13
  22. package/es/heatmap/index.js +10 -40
  23. package/es/heatmap/models/grid.js +28 -52
  24. package/es/heatmap/models/grid3d.js +28 -52
  25. package/es/heatmap/models/heatmap.js +91 -146
  26. package/es/heatmap/models/hexagon.js +28 -52
  27. package/es/heatmap/triangulation.js +0 -4
  28. package/es/image/index.js +9 -28
  29. package/es/image/models/image.js +66 -100
  30. package/es/index.js +9 -17
  31. package/es/line/index.js +9 -34
  32. package/es/line/models/arc.js +66 -118
  33. package/es/line/models/arc_3d.js +60 -108
  34. package/es/line/models/earthArc_3d.js +63 -111
  35. package/es/line/models/great_circle.js +56 -100
  36. package/es/line/models/half.js +46 -77
  37. package/es/line/models/line.js +94 -148
  38. package/es/line/models/linearline.js +45 -80
  39. package/es/line/models/simpleLine.js +41 -74
  40. package/es/line/models/wall.js +52 -92
  41. package/es/mask/index.js +9 -28
  42. package/es/mask/models/fill.js +29 -54
  43. package/es/plugins/DataMappingPlugin.js +80 -117
  44. package/es/plugins/DataSourcePlugin.js +45 -68
  45. package/es/plugins/FeatureScalePlugin.js +67 -122
  46. package/es/plugins/LayerAnimateStylePlugin.js +0 -5
  47. package/es/plugins/LayerMaskPlugin.js +3 -11
  48. package/es/plugins/LayerModelPlugin.js +67 -104
  49. package/es/plugins/LayerStylePlugin.js +3 -9
  50. package/es/plugins/LightingPlugin.js +12 -18
  51. package/es/plugins/MultiPassRendererPlugin.js +11 -16
  52. package/es/plugins/PixelPickingPlugin.js +12 -21
  53. package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
  54. package/es/plugins/ShaderUniformPlugin.js +13 -27
  55. package/es/plugins/UpdateModelPlugin.js +0 -5
  56. package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
  57. package/es/point/index.js +26 -77
  58. package/es/point/models/earthExtrude.js +61 -102
  59. package/es/point/models/earthFill.js +57 -87
  60. package/es/point/models/extrude.js +60 -101
  61. package/es/point/models/fill.js +70 -100
  62. package/es/point/models/fillmage.js +63 -107
  63. package/es/point/models/image.js +48 -88
  64. package/es/point/models/index.js +2 -2
  65. package/es/point/models/normal.js +30 -54
  66. package/es/point/models/radar.js +40 -64
  67. package/es/point/models/simplePoint.js +41 -69
  68. package/es/point/models/text.js +197 -299
  69. package/es/point/shape/extrude.js +4 -13
  70. package/es/polygon/index.js +11 -40
  71. package/es/polygon/models/extrude.js +48 -92
  72. package/es/polygon/models/fill.js +54 -88
  73. package/es/polygon/models/index.js +3 -2
  74. package/es/polygon/models/ocean.js +42 -76
  75. package/es/polygon/models/water.js +37 -71
  76. package/es/raster/buffers/triangulation.js +2 -4
  77. package/es/raster/index.js +9 -32
  78. package/es/raster/models/raster.js +80 -116
  79. package/es/raster/models/rasterRgb.js +84 -127
  80. package/es/raster/models/rasterTerrainRgb.js +56 -84
  81. package/es/tile/interaction/getRasterData.js +14 -20
  82. package/es/tile/interaction/utils.js +7 -9
  83. package/es/tile/manager/base.js +63 -96
  84. package/es/tile/service/TileLayerService.js +30 -52
  85. package/es/tile/service/TilePickService.js +26 -40
  86. package/es/tile/service/TileSourceService.js +3 -7
  87. package/es/tile/tileFactory/DebugTile.js +28 -45
  88. package/es/tile/tileFactory/ImageTile.js +20 -38
  89. package/es/tile/tileFactory/MaskTile.js +22 -43
  90. package/es/tile/tileFactory/RasterRGBTile.js +22 -42
  91. package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
  92. package/es/tile/tileFactory/RasterTile.js +30 -53
  93. package/es/tile/tileFactory/Tile.js +63 -97
  94. package/es/tile/tileFactory/VectorTile.js +41 -68
  95. package/es/tile/tileFactory/index.js +0 -11
  96. package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
  97. package/es/tile/tileFactory/util.js +0 -3
  98. package/es/tile/tileLayer/BaseLayer.js +105 -146
  99. package/es/tile/utils.js +1 -1
  100. package/es/utils/blend.js +0 -2
  101. package/es/utils/collision-index.js +9 -16
  102. package/es/utils/dataMappingStyle.js +8 -18
  103. package/es/utils/extrude_polyline.js +101 -149
  104. package/es/utils/grid-index.js +2 -27
  105. package/es/utils/identityScale.js +0 -8
  106. package/es/utils/layerData.js +30 -44
  107. package/es/utils/multiPassRender.js +11 -13
  108. package/es/utils/polylineNormal.js +31 -37
  109. package/es/utils/simpleLine.js +2 -16
  110. package/es/utils/stencil.js +2 -3
  111. package/es/utils/symbol-layout.js +27 -53
  112. package/es/wind/index.js +9 -29
  113. package/es/wind/models/utils.js +26 -51
  114. package/es/wind/models/wind.js +101 -147
  115. package/es/wind/models/windRender.js +53 -66
  116. package/lib/Geometry/index.js +9 -38
  117. package/lib/Geometry/models/billboard.js +51 -97
  118. package/lib/Geometry/models/index.js +0 -5
  119. package/lib/Geometry/models/plane.js +79 -151
  120. package/lib/Geometry/models/sprite.js +60 -127
  121. package/lib/canvas/index.js +10 -40
  122. package/lib/canvas/models/canvas.js +41 -101
  123. package/lib/canvas/models/index.js +0 -3
  124. package/lib/citybuliding/building.js +8 -35
  125. package/lib/citybuliding/models/build.js +57 -92
  126. package/lib/core/BaseLayer.js +320 -478
  127. package/lib/core/BaseModel.js +97 -139
  128. package/lib/core/LayerPickService.js +21 -37
  129. package/lib/core/TextureService.js +0 -16
  130. package/lib/core/interface.js +21 -31
  131. package/lib/core/schema.js +0 -1
  132. package/lib/core/shape/Path.js +14 -31
  133. package/lib/core/shape/extrude.js +10 -54
  134. package/lib/core/triangulation.js +53 -153
  135. package/lib/earth/index.js +9 -43
  136. package/lib/earth/models/atmosphere.js +30 -63
  137. package/lib/earth/models/base.js +47 -90
  138. package/lib/earth/models/bloomsphere.js +30 -63
  139. package/lib/earth/utils.js +7 -31
  140. package/lib/heatmap/index.js +10 -48
  141. package/lib/heatmap/models/grid.js +28 -60
  142. package/lib/heatmap/models/grid3d.js +28 -60
  143. package/lib/heatmap/models/heatmap.js +91 -162
  144. package/lib/heatmap/models/hexagon.js +28 -60
  145. package/lib/heatmap/models/index.js +0 -6
  146. package/lib/heatmap/triangulation.js +0 -5
  147. package/lib/image/index.js +9 -36
  148. package/lib/image/models/image.js +66 -109
  149. package/lib/image/models/index.js +0 -3
  150. package/lib/index.js +7 -61
  151. package/lib/line/index.js +9 -40
  152. package/lib/line/models/arc.js +64 -128
  153. package/lib/line/models/arc_3d.js +58 -119
  154. package/lib/line/models/earthArc_3d.js +61 -122
  155. package/lib/line/models/great_circle.js +56 -111
  156. package/lib/line/models/half.js +46 -87
  157. package/lib/line/models/index.js +0 -11
  158. package/lib/line/models/line.js +92 -156
  159. package/lib/line/models/linearline.js +45 -92
  160. package/lib/line/models/simpleLine.js +41 -84
  161. package/lib/line/models/wall.js +52 -103
  162. package/lib/mask/index.js +9 -36
  163. package/lib/mask/models/fill.js +29 -63
  164. package/lib/mask/models/index.js +0 -3
  165. package/lib/plugins/DataMappingPlugin.js +80 -128
  166. package/lib/plugins/DataSourcePlugin.js +45 -76
  167. package/lib/plugins/FeatureScalePlugin.js +67 -138
  168. package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
  169. package/lib/plugins/LayerMaskPlugin.js +4 -17
  170. package/lib/plugins/LayerModelPlugin.js +68 -113
  171. package/lib/plugins/LayerStylePlugin.js +4 -14
  172. package/lib/plugins/LightingPlugin.js +12 -25
  173. package/lib/plugins/MultiPassRendererPlugin.js +11 -22
  174. package/lib/plugins/PixelPickingPlugin.js +12 -27
  175. package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
  176. package/lib/plugins/ShaderUniformPlugin.js +13 -34
  177. package/lib/plugins/UpdateModelPlugin.js +1 -10
  178. package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
  179. package/lib/point/index.js +26 -83
  180. package/lib/point/models/earthExtrude.js +61 -113
  181. package/lib/point/models/earthFill.js +57 -117
  182. package/lib/point/models/extrude.js +60 -111
  183. package/lib/point/models/fill.js +68 -109
  184. package/lib/point/models/fillmage.js +61 -115
  185. package/lib/point/models/image.js +48 -98
  186. package/lib/point/models/index.js +1 -12
  187. package/lib/point/models/normal.js +30 -64
  188. package/lib/point/models/radar.js +40 -74
  189. package/lib/point/models/simplePoint.js +41 -79
  190. package/lib/point/models/text.js +197 -307
  191. package/lib/point/shape/extrude.js +4 -20
  192. package/lib/polygon/index.js +11 -48
  193. package/lib/polygon/models/extrude.js +48 -103
  194. package/lib/polygon/models/fill.js +54 -98
  195. package/lib/polygon/models/index.js +2 -14
  196. package/lib/polygon/models/ocean.js +42 -88
  197. package/lib/polygon/models/water.js +37 -82
  198. package/lib/raster/buffers/triangulation.js +3 -7
  199. package/lib/raster/index.js +9 -40
  200. package/lib/raster/models/index.js +0 -5
  201. package/lib/raster/models/raster.js +80 -125
  202. package/lib/raster/models/rasterRgb.js +84 -139
  203. package/lib/raster/models/rasterTerrainRgb.js +56 -93
  204. package/lib/tile/interaction/getRasterData.js +14 -25
  205. package/lib/tile/interaction/utils.js +7 -19
  206. package/lib/tile/manager/base.js +63 -104
  207. package/lib/tile/service/TileLayerService.js +30 -57
  208. package/lib/tile/service/TilePickService.js +26 -48
  209. package/lib/tile/service/TileSourceService.js +2 -16
  210. package/lib/tile/style/utils.js +0 -3
  211. package/lib/tile/tileFactory/DebugTile.js +28 -53
  212. package/lib/tile/tileFactory/ImageTile.js +20 -46
  213. package/lib/tile/tileFactory/MaskTile.js +22 -51
  214. package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
  215. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
  216. package/lib/tile/tileFactory/RasterTile.js +30 -63
  217. package/lib/tile/tileFactory/Tile.js +63 -102
  218. package/lib/tile/tileFactory/VectorTile.js +41 -76
  219. package/lib/tile/tileFactory/index.js +0 -25
  220. package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
  221. package/lib/tile/tileFactory/util.js +0 -9
  222. package/lib/tile/tileLayer/BaseLayer.js +105 -153
  223. package/lib/tile/utils.js +1 -5
  224. package/lib/utils/blend.js +0 -5
  225. package/lib/utils/collision-index.js +9 -25
  226. package/lib/utils/dataMappingStyle.js +8 -19
  227. package/lib/utils/extrude_polyline.js +101 -181
  228. package/lib/utils/grid-index.js +2 -28
  229. package/lib/utils/identityScale.js +0 -9
  230. package/lib/utils/layerData.js +30 -49
  231. package/lib/utils/multiPassRender.js +11 -16
  232. package/lib/utils/polylineNormal.js +31 -66
  233. package/lib/utils/simpleLine.js +2 -21
  234. package/lib/utils/stencil.js +0 -4
  235. package/lib/utils/symbol-layout.js +27 -55
  236. package/lib/wind/index.js +9 -37
  237. package/lib/wind/models/index.js +0 -3
  238. package/lib/wind/models/utils.js +26 -62
  239. package/lib/wind/models/wind.js +101 -157
  240. package/lib/wind/models/windRender.js +53 -71
  241. package/lib/wind/models/windShader.js +0 -1
  242. package/package.json +7 -7
@@ -1,86 +1,61 @@
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 _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
-
14
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
-
16
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
-
18
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
-
20
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
-
22
14
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
-
24
15
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
-
26
16
  var _raster = _interopRequireDefault(require("../../raster"));
27
-
28
17
  var _Tile2 = _interopRequireDefault(require("./Tile"));
29
-
30
18
  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); }; }
31
-
32
19
  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; } }
33
-
34
20
  var RasterTerrainRGBTile = /*#__PURE__*/function (_Tile) {
35
21
  (0, _inherits2.default)(RasterTerrainRGBTile, _Tile);
36
-
37
22
  var _super = _createSuper(RasterTerrainRGBTile);
38
-
39
23
  function RasterTerrainRGBTile() {
40
24
  (0, _classCallCheck2.default)(this, RasterTerrainRGBTile);
41
25
  return _super.apply(this, arguments);
42
26
  }
43
-
44
27
  (0, _createClass2.default)(RasterTerrainRGBTile, [{
45
28
  key: "initTileLayer",
46
29
  value: function () {
47
30
  var _initTileLayer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
48
31
  var attributes, layerOptions, sourceOptions, layer;
49
32
  return _regenerator.default.wrap(function _callee$(_context) {
50
- while (1) {
51
- switch (_context.prev = _context.next) {
52
- case 0:
53
- attributes = this.parent.getLayerAttributeConfig();
54
- layerOptions = this.getLayerOptions();
55
- sourceOptions = this.getSourceOption();
56
- layer = new _raster.default((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
57
- // tslint:disable-next-line: no-unused-expression
58
-
59
- attributes && Object.keys(attributes).forEach(function (type) {
60
- var _attributes$attr, _attributes$attr2;
61
-
62
- var attr = type; // @ts-ignore
63
-
64
- layer[attr]((_attributes$attr = attributes[attr]) === null || _attributes$attr === void 0 ? void 0 : _attributes$attr.field, (_attributes$attr2 = attributes[attr]) === null || _attributes$attr2 === void 0 ? void 0 : _attributes$attr2.values);
65
- });
66
- _context.next = 7;
67
- return this.addLayer(layer);
68
-
69
- case 7:
70
- this.isLoaded = true;
71
-
72
- case 8:
73
- case "end":
74
- return _context.stop();
75
- }
33
+ while (1) switch (_context.prev = _context.next) {
34
+ case 0:
35
+ attributes = this.parent.getLayerAttributeConfig();
36
+ layerOptions = this.getLayerOptions();
37
+ sourceOptions = this.getSourceOption();
38
+ layer = new _raster.default((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
39
+ // tslint:disable-next-line: no-unused-expression
40
+ attributes && Object.keys(attributes).forEach(function (type) {
41
+ var _attributes$attr, _attributes$attr2;
42
+ var attr = type;
43
+ // @ts-ignore
44
+ layer[attr]((_attributes$attr = attributes[attr]) === null || _attributes$attr === void 0 ? void 0 : _attributes$attr.field, (_attributes$attr2 = attributes[attr]) === null || _attributes$attr2 === void 0 ? void 0 : _attributes$attr2.values);
45
+ });
46
+ _context.next = 7;
47
+ return this.addLayer(layer);
48
+ case 7:
49
+ this.isLoaded = true;
50
+ case 8:
51
+ case "end":
52
+ return _context.stop();
76
53
  }
77
54
  }, _callee, this);
78
55
  }));
79
-
80
56
  function initTileLayer() {
81
57
  return _initTileLayer.apply(this, arguments);
82
58
  }
83
-
84
59
  return initTileLayer;
85
60
  }()
86
61
  }, {
@@ -101,5 +76,4 @@ var RasterTerrainRGBTile = /*#__PURE__*/function (_Tile) {
101
76
  }]);
102
77
  return RasterTerrainRGBTile;
103
78
  }(_Tile2.default);
104
-
105
79
  exports.default = RasterTerrainRGBTile;
@@ -1,102 +1,72 @@
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 _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
15
-
16
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
-
18
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
19
-
20
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
21
-
22
14
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
23
-
24
15
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
25
-
26
16
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
27
-
28
17
  var _l7Utils = require("@antv/l7-utils");
29
-
30
18
  var _raster = _interopRequireDefault(require("../../raster"));
31
-
32
19
  var _Tile2 = _interopRequireDefault(require("./Tile"));
33
-
34
20
  var _excluded = ["rasterData"];
35
-
36
21
  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); }; }
37
-
38
22
  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; } }
39
-
40
23
  var DEFAULT_COLOR_TEXTURE_OPTION = {
41
24
  positions: [0, 1],
42
25
  colors: ['#000', '#fff']
43
26
  };
44
-
45
27
  var RasterTile = /*#__PURE__*/function (_Tile) {
46
28
  (0, _inherits2.default)(RasterTile, _Tile);
47
-
48
29
  var _super = _createSuper(RasterTile);
49
-
50
30
  function RasterTile() {
51
31
  (0, _classCallCheck2.default)(this, RasterTile);
52
32
  return _super.apply(this, arguments);
53
33
  }
54
-
55
34
  (0, _createClass2.default)(RasterTile, [{
56
35
  key: "initTileLayer",
57
36
  value: function () {
58
37
  var _initTileLayer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
59
38
  var attributes, layerOptions, sourceOptions, _ref, rampColors, domain, layer;
60
-
61
39
  return _regenerator.default.wrap(function _callee$(_context) {
62
- while (1) {
63
- switch (_context.prev = _context.next) {
64
- case 0:
65
- attributes = this.parent.getLayerAttributeConfig();
66
- layerOptions = this.getLayerOptions();
67
- sourceOptions = this.getSourceOption();
68
- _ref = this.getLayerOptions(), rampColors = _ref.rampColors, domain = _ref.domain;
69
- this.colorTexture = this.parent.textureService.getColorTexture(rampColors, domain);
70
- layer = new _raster.default((0, _objectSpread2.default)((0, _objectSpread2.default)({}, layerOptions), {}, {
71
- colorTexture: this.colorTexture
72
- })).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
73
- // tslint:disable-next-line: no-unused-expression
74
-
75
- attributes && Object.keys(attributes).forEach(function (type) {
76
- var _attributes$attr, _attributes$attr2;
77
-
78
- var attr = type; // @ts-ignore
79
-
80
- layer[attr]((_attributes$attr = attributes[attr]) === null || _attributes$attr === void 0 ? void 0 : _attributes$attr.field, (_attributes$attr2 = attributes[attr]) === null || _attributes$attr2 === void 0 ? void 0 : _attributes$attr2.values);
81
- });
82
- _context.next = 9;
83
- return this.addLayer(layer);
84
-
85
- case 9:
86
- this.isLoaded = true;
87
-
88
- case 10:
89
- case "end":
90
- return _context.stop();
91
- }
40
+ while (1) switch (_context.prev = _context.next) {
41
+ case 0:
42
+ attributes = this.parent.getLayerAttributeConfig();
43
+ layerOptions = this.getLayerOptions();
44
+ sourceOptions = this.getSourceOption();
45
+ _ref = this.getLayerOptions(), rampColors = _ref.rampColors, domain = _ref.domain;
46
+ this.colorTexture = this.parent.textureService.getColorTexture(rampColors, domain);
47
+ layer = new _raster.default((0, _objectSpread2.default)((0, _objectSpread2.default)({}, layerOptions), {}, {
48
+ colorTexture: this.colorTexture
49
+ })).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
50
+ // tslint:disable-next-line: no-unused-expression
51
+ attributes && Object.keys(attributes).forEach(function (type) {
52
+ var _attributes$attr, _attributes$attr2;
53
+ var attr = type;
54
+ // @ts-ignore
55
+ layer[attr]((_attributes$attr = attributes[attr]) === null || _attributes$attr === void 0 ? void 0 : _attributes$attr.field, (_attributes$attr2 = attributes[attr]) === null || _attributes$attr2 === void 0 ? void 0 : _attributes$attr2.values);
56
+ });
57
+ _context.next = 9;
58
+ return this.addLayer(layer);
59
+ case 9:
60
+ this.isLoaded = true;
61
+ case 10:
62
+ case "end":
63
+ return _context.stop();
92
64
  }
93
65
  }, _callee, this);
94
66
  }));
95
-
96
67
  function initTileLayer() {
97
68
  return _initTileLayer.apply(this, arguments);
98
69
  }
99
-
100
70
  return initTileLayer;
101
71
  }()
102
72
  }, {
@@ -104,8 +74,8 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
104
74
  value: function getSourceOption() {
105
75
  var rawSource = this.parent.getSource();
106
76
  var _this$sourceTile$data = this.sourceTile.data.data,
107
- rasterData = _this$sourceTile$data.rasterData,
108
- res = (0, _objectWithoutProperties2.default)(_this$sourceTile$data, _excluded);
77
+ rasterData = _this$sourceTile$data.rasterData,
78
+ res = (0, _objectWithoutProperties2.default)(_this$sourceTile$data, _excluded);
109
79
  return {
110
80
  data: rasterData,
111
81
  options: {
@@ -117,24 +87,22 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
117
87
  }
118
88
  };
119
89
  }
90
+
120
91
  /**
121
92
  * 用于 style 更新 colorTexture 的优化
122
93
  * @param arg
123
94
  */
124
-
125
95
  }, {
126
96
  key: "styleUpdate",
127
97
  value: function styleUpdate() {
128
98
  var _this = this;
129
-
130
99
  for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
131
100
  arg[_key] = arguments[_key];
132
101
  }
133
-
134
102
  var _ref2 = arg,
135
- _ref2$rampColors = _ref2.rampColors,
136
- rampColors = _ref2$rampColors === void 0 ? DEFAULT_COLOR_TEXTURE_OPTION : _ref2$rampColors,
137
- domain = _ref2.domain;
103
+ _ref2$rampColors = _ref2.rampColors,
104
+ rampColors = _ref2$rampColors === void 0 ? DEFAULT_COLOR_TEXTURE_OPTION : _ref2$rampColors,
105
+ domain = _ref2.domain;
138
106
  this.colorTexture = this.parent.textureService.getColorTexture(rampColors, domain || (0, _l7Utils.getDefaultDomain)(rampColors));
139
107
  this.layers.forEach(function (layer) {
140
108
  return layer.style({
@@ -152,5 +120,4 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
152
120
  }]);
153
121
  return RasterTile;
154
122
  }(_Tile2.default);
155
-
156
123
  exports.default = RasterTile;
@@ -1,32 +1,20 @@
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 _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
15
-
16
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
-
18
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
19
-
20
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
21
-
22
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
15
  var _l7Core = require("@antv/l7-core");
25
-
26
16
  var _polygon = _interopRequireDefault(require("../../polygon"));
27
-
28
17
  var _util = require("./util");
29
-
30
18
  var Tile = /*#__PURE__*/function () {
31
19
  function Tile(sourceTile, parent) {
32
20
  (0, _classCallCheck2.default)(this, Tile);
@@ -41,13 +29,13 @@ var Tile = /*#__PURE__*/function () {
41
29
  this.z = sourceTile.z;
42
30
  this.key = "".concat(this.x, "_").concat(this.y, "_").concat(this.z);
43
31
  }
44
-
45
32
  (0, _createClass2.default)(Tile, [{
46
33
  key: "getLayers",
47
34
  value: function getLayers() {
48
35
  return this.layers;
49
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
36
+ }
50
37
 
38
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
51
39
  }, {
52
40
  key: "styleUpdate",
53
41
  value: function styleUpdate() {
@@ -57,20 +45,18 @@ var Tile = /*#__PURE__*/function () {
57
45
  key: "lnglatInBounds",
58
46
  value: function lnglatInBounds(lnglat) {
59
47
  var _this$sourceTile$boun = (0, _slicedToArray2.default)(this.sourceTile.bounds, 4),
60
- minLng = _this$sourceTile$boun[0],
61
- minLat = _this$sourceTile$boun[1],
62
- maxLng = _this$sourceTile$boun[2],
63
- maxLat = _this$sourceTile$boun[3];
64
-
48
+ minLng = _this$sourceTile$boun[0],
49
+ minLat = _this$sourceTile$boun[1],
50
+ maxLng = _this$sourceTile$boun[2],
51
+ maxLat = _this$sourceTile$boun[3];
65
52
  var lng = lnglat.lng,
66
- lat = lnglat.lat;
53
+ lat = lnglat.lat;
67
54
  return lng >= minLng && lng <= maxLng && lat >= minLat && lat <= maxLat;
68
55
  }
69
56
  }, {
70
57
  key: "getLayerOptions",
71
58
  value: function getLayerOptions() {
72
59
  var _options$maskLayers;
73
-
74
60
  var options = this.parent.getLayerConfig();
75
61
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, options), {}, {
76
62
  autoFit: false,
@@ -78,16 +64,14 @@ var Tile = /*#__PURE__*/function () {
78
64
  tileMask: (0, _util.isNeedMask)(this.parent.type),
79
65
  mask: options.mask || ((_options$maskLayers = options.maskLayers) === null || _options$maskLayers === void 0 ? void 0 : _options$maskLayers.length) !== 0 && options.enableMask
80
66
  });
81
- } // 获取Mask 图层
82
-
67
+ }
68
+ // 获取Mask 图层
83
69
  }, {
84
70
  key: "getMaskLayer",
85
71
  value: function getMaskLayer() {
86
72
  var _this = this;
87
-
88
73
  var _this$parent$getLayer = this.parent.getLayerConfig(),
89
- maskLayers = _this$parent$getLayer.maskLayers;
90
-
74
+ maskLayers = _this$parent$getLayer.maskLayers;
91
75
  var layers = [];
92
76
  maskLayers === null || maskLayers === void 0 ? void 0 : maskLayers.forEach(function (layer) {
93
77
  if (!layer.tileLayer) {
@@ -95,11 +79,9 @@ var Tile = /*#__PURE__*/function () {
95
79
  layers.push(layer);
96
80
  return layer;
97
81
  }
98
-
99
82
  var tileLayer = layer.tileLayer;
100
83
  var tile = tileLayer.getTile(_this.sourceTile.key);
101
84
  var l = tile === null || tile === void 0 ? void 0 : tile.getLayers()[0];
102
-
103
85
  if (l) {
104
86
  layers.push(l);
105
87
  }
@@ -112,48 +94,40 @@ var Tile = /*#__PURE__*/function () {
112
94
  var _addTileMask = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
113
95
  var mask, container, mainLayer;
114
96
  return _regenerator.default.wrap(function _callee$(_context) {
115
- while (1) {
116
- switch (_context.prev = _context.next) {
117
- case 0:
118
- mask = new _polygon.default({
119
- visible: false,
120
- enablePicking: false
121
- }).source({
122
- type: 'FeatureCollection',
123
- features: [this.sourceTile.bboxPolygon]
124
- }, {
125
- parser: {
126
- type: 'geojson',
127
- featureId: 'id'
128
- }
129
- }).shape('fill');
130
- container = (0, _l7Core.createLayerContainer)(this.parent.sceneContainer);
131
- mask.setContainer(container, this.parent.sceneContainer);
132
- _context.next = 5;
133
- return mask.init();
134
-
135
- case 5:
136
- this.tileMask = mask;
137
- mainLayer = this.getMainLayer();
138
-
139
- if (mainLayer !== undefined) {
140
- mainLayer.tileMask = mask;
97
+ while (1) switch (_context.prev = _context.next) {
98
+ case 0:
99
+ mask = new _polygon.default({
100
+ visible: false,
101
+ enablePicking: false
102
+ }).source({
103
+ type: 'FeatureCollection',
104
+ features: [this.sourceTile.bboxPolygon]
105
+ }, {
106
+ parser: {
107
+ type: 'geojson',
108
+ featureId: 'id'
141
109
  }
142
-
143
- return _context.abrupt("return", mask);
144
-
145
- case 9:
146
- case "end":
147
- return _context.stop();
148
- }
110
+ }).shape('fill');
111
+ container = (0, _l7Core.createLayerContainer)(this.parent.sceneContainer);
112
+ mask.setContainer(container, this.parent.sceneContainer);
113
+ _context.next = 5;
114
+ return mask.init();
115
+ case 5:
116
+ this.tileMask = mask;
117
+ mainLayer = this.getMainLayer();
118
+ if (mainLayer !== undefined) {
119
+ mainLayer.tileMask = mask;
120
+ }
121
+ return _context.abrupt("return", mask);
122
+ case 9:
123
+ case "end":
124
+ return _context.stop();
149
125
  }
150
126
  }, _callee, this);
151
127
  }));
152
-
153
128
  function addTileMask() {
154
129
  return _addTileMask.apply(this, arguments);
155
130
  }
156
-
157
131
  return addTileMask;
158
132
  }()
159
133
  }, {
@@ -162,30 +136,24 @@ var Tile = /*#__PURE__*/function () {
162
136
  var _addMask = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(layer, mask) {
163
137
  var container;
164
138
  return _regenerator.default.wrap(function _callee2$(_context2) {
165
- while (1) {
166
- switch (_context2.prev = _context2.next) {
167
- case 0:
168
- container = (0, _l7Core.createLayerContainer)(this.parent.sceneContainer);
169
- mask.setContainer(container, this.parent.sceneContainer);
170
- _context2.next = 4;
171
- return mask.init();
172
-
173
- case 4:
174
- layer.addMask(mask);
175
- this.tileMaskLayers.push(mask);
176
-
177
- case 6:
178
- case "end":
179
- return _context2.stop();
180
- }
139
+ while (1) switch (_context2.prev = _context2.next) {
140
+ case 0:
141
+ container = (0, _l7Core.createLayerContainer)(this.parent.sceneContainer);
142
+ mask.setContainer(container, this.parent.sceneContainer);
143
+ _context2.next = 4;
144
+ return mask.init();
145
+ case 4:
146
+ layer.addMask(mask);
147
+ this.tileMaskLayers.push(mask);
148
+ case 6:
149
+ case "end":
150
+ return _context2.stop();
181
151
  }
182
152
  }, _callee2, this);
183
153
  }));
184
-
185
154
  function addMask(_x, _x2) {
186
155
  return _addMask.apply(this, arguments);
187
156
  }
188
-
189
157
  return addMask;
190
158
  }()
191
159
  }, {
@@ -194,29 +162,24 @@ var Tile = /*#__PURE__*/function () {
194
162
  var _addLayer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(layer) {
195
163
  var container;
196
164
  return _regenerator.default.wrap(function _callee3$(_context3) {
197
- while (1) {
198
- switch (_context3.prev = _context3.next) {
199
- case 0:
200
- // set flag
201
- layer.isTileLayer = true;
202
- container = (0, _l7Core.createLayerContainer)(this.parent.sceneContainer);
203
- layer.setContainer(container, this.parent.sceneContainer);
204
- this.layers.push(layer);
205
- _context3.next = 6;
206
- return layer.init();
207
-
208
- case 6:
209
- case "end":
210
- return _context3.stop();
211
- }
165
+ while (1) switch (_context3.prev = _context3.next) {
166
+ case 0:
167
+ // set flag
168
+ layer.isTileLayer = true;
169
+ container = (0, _l7Core.createLayerContainer)(this.parent.sceneContainer);
170
+ layer.setContainer(container, this.parent.sceneContainer);
171
+ this.layers.push(layer);
172
+ _context3.next = 6;
173
+ return layer.init();
174
+ case 6:
175
+ case "end":
176
+ return _context3.stop();
212
177
  }
213
178
  }, _callee3, this);
214
179
  }));
215
-
216
180
  function addLayer(_x3) {
217
181
  return _addLayer.apply(this, arguments);
218
182
  }
219
-
220
183
  return addLayer;
221
184
  }()
222
185
  }, {
@@ -232,10 +195,10 @@ var Tile = /*#__PURE__*/function () {
232
195
  l.updateLayerConfig((0, _defineProperty2.default)({}, key, value));
233
196
  });
234
197
  }
198
+
235
199
  /**
236
200
  * 一个 Tile 可能有多个 layer,但是在发生拾取、点击事件的时候只有一个生效
237
201
  */
238
-
239
202
  }, {
240
203
  key: "getMainLayer",
241
204
  value: function getMainLayer() {
@@ -246,12 +209,12 @@ var Tile = /*#__PURE__*/function () {
246
209
  value: function getFeatures(sourceLayer) {
247
210
  return [];
248
211
  }
212
+
249
213
  /**
250
214
  * 在一个 Tile 中可能存在一个相同 ID 的 feature
251
215
  * @param id
252
216
  * @returns
253
217
  */
254
-
255
218
  }, {
256
219
  key: "getFeatureById",
257
220
  value: function getFeatureById(id) {
@@ -261,7 +224,6 @@ var Tile = /*#__PURE__*/function () {
261
224
  key: "destroy",
262
225
  value: function destroy() {
263
226
  var _this$tileMask;
264
-
265
227
  (_this$tileMask = this.tileMask) === null || _this$tileMask === void 0 ? void 0 : _this$tileMask.destroy();
266
228
  this.layers.forEach(function (layer) {
267
229
  return layer.destroy();
@@ -270,5 +232,4 @@ var Tile = /*#__PURE__*/function () {
270
232
  }]);
271
233
  return Tile;
272
234
  }();
273
-
274
235
  exports.default = Tile;