@antv/l7-layers 2.15.1 → 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 (243) 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.d.ts +2 -0
  69. package/es/point/models/text.js +214 -295
  70. package/es/point/shape/extrude.js +4 -13
  71. package/es/polygon/index.js +11 -40
  72. package/es/polygon/models/extrude.js +48 -92
  73. package/es/polygon/models/fill.js +54 -88
  74. package/es/polygon/models/index.js +3 -2
  75. package/es/polygon/models/ocean.js +42 -76
  76. package/es/polygon/models/water.js +37 -71
  77. package/es/raster/buffers/triangulation.js +2 -4
  78. package/es/raster/index.js +9 -32
  79. package/es/raster/models/raster.js +80 -116
  80. package/es/raster/models/rasterRgb.js +84 -127
  81. package/es/raster/models/rasterTerrainRgb.js +56 -84
  82. package/es/tile/interaction/getRasterData.js +14 -20
  83. package/es/tile/interaction/utils.js +7 -9
  84. package/es/tile/manager/base.js +63 -96
  85. package/es/tile/service/TileLayerService.js +30 -52
  86. package/es/tile/service/TilePickService.js +26 -40
  87. package/es/tile/service/TileSourceService.js +3 -7
  88. package/es/tile/tileFactory/DebugTile.js +28 -45
  89. package/es/tile/tileFactory/ImageTile.js +20 -38
  90. package/es/tile/tileFactory/MaskTile.js +22 -43
  91. package/es/tile/tileFactory/RasterRGBTile.js +22 -42
  92. package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
  93. package/es/tile/tileFactory/RasterTile.js +30 -53
  94. package/es/tile/tileFactory/Tile.js +63 -97
  95. package/es/tile/tileFactory/VectorTile.js +41 -68
  96. package/es/tile/tileFactory/index.js +0 -11
  97. package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
  98. package/es/tile/tileFactory/util.js +0 -3
  99. package/es/tile/tileLayer/BaseLayer.js +105 -146
  100. package/es/tile/utils.js +1 -1
  101. package/es/utils/blend.js +0 -2
  102. package/es/utils/collision-index.js +9 -16
  103. package/es/utils/dataMappingStyle.js +8 -18
  104. package/es/utils/extrude_polyline.js +101 -149
  105. package/es/utils/grid-index.js +2 -27
  106. package/es/utils/identityScale.js +0 -8
  107. package/es/utils/layerData.js +30 -44
  108. package/es/utils/multiPassRender.js +11 -13
  109. package/es/utils/polylineNormal.js +31 -37
  110. package/es/utils/simpleLine.js +2 -16
  111. package/es/utils/stencil.js +2 -3
  112. package/es/utils/symbol-layout.js +27 -53
  113. package/es/wind/index.js +9 -29
  114. package/es/wind/models/utils.js +26 -51
  115. package/es/wind/models/wind.js +101 -147
  116. package/es/wind/models/windRender.js +53 -66
  117. package/lib/Geometry/index.js +9 -38
  118. package/lib/Geometry/models/billboard.js +51 -97
  119. package/lib/Geometry/models/index.js +0 -5
  120. package/lib/Geometry/models/plane.js +79 -151
  121. package/lib/Geometry/models/sprite.js +60 -127
  122. package/lib/canvas/index.js +10 -40
  123. package/lib/canvas/models/canvas.js +41 -101
  124. package/lib/canvas/models/index.js +0 -3
  125. package/lib/citybuliding/building.js +8 -35
  126. package/lib/citybuliding/models/build.js +57 -92
  127. package/lib/core/BaseLayer.js +320 -478
  128. package/lib/core/BaseModel.js +97 -139
  129. package/lib/core/LayerPickService.js +21 -37
  130. package/lib/core/TextureService.js +0 -16
  131. package/lib/core/interface.js +21 -31
  132. package/lib/core/schema.js +0 -1
  133. package/lib/core/shape/Path.js +14 -31
  134. package/lib/core/shape/extrude.js +10 -54
  135. package/lib/core/triangulation.js +53 -153
  136. package/lib/earth/index.js +9 -43
  137. package/lib/earth/models/atmosphere.js +30 -63
  138. package/lib/earth/models/base.js +47 -90
  139. package/lib/earth/models/bloomsphere.js +30 -63
  140. package/lib/earth/utils.js +7 -31
  141. package/lib/heatmap/index.js +10 -48
  142. package/lib/heatmap/models/grid.js +28 -60
  143. package/lib/heatmap/models/grid3d.js +28 -60
  144. package/lib/heatmap/models/heatmap.js +91 -162
  145. package/lib/heatmap/models/hexagon.js +28 -60
  146. package/lib/heatmap/models/index.js +0 -6
  147. package/lib/heatmap/triangulation.js +0 -5
  148. package/lib/image/index.js +9 -36
  149. package/lib/image/models/image.js +66 -109
  150. package/lib/image/models/index.js +0 -3
  151. package/lib/index.js +7 -61
  152. package/lib/line/index.js +9 -40
  153. package/lib/line/models/arc.js +64 -128
  154. package/lib/line/models/arc_3d.js +58 -119
  155. package/lib/line/models/earthArc_3d.js +61 -122
  156. package/lib/line/models/great_circle.js +56 -111
  157. package/lib/line/models/half.js +46 -87
  158. package/lib/line/models/index.js +0 -11
  159. package/lib/line/models/line.js +92 -156
  160. package/lib/line/models/linearline.js +45 -92
  161. package/lib/line/models/simpleLine.js +41 -84
  162. package/lib/line/models/wall.js +52 -103
  163. package/lib/mask/index.js +9 -36
  164. package/lib/mask/models/fill.js +29 -63
  165. package/lib/mask/models/index.js +0 -3
  166. package/lib/plugins/DataMappingPlugin.js +80 -128
  167. package/lib/plugins/DataSourcePlugin.js +45 -76
  168. package/lib/plugins/FeatureScalePlugin.js +67 -138
  169. package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
  170. package/lib/plugins/LayerMaskPlugin.js +4 -17
  171. package/lib/plugins/LayerModelPlugin.js +68 -113
  172. package/lib/plugins/LayerStylePlugin.js +4 -14
  173. package/lib/plugins/LightingPlugin.js +12 -25
  174. package/lib/plugins/MultiPassRendererPlugin.js +11 -22
  175. package/lib/plugins/PixelPickingPlugin.js +12 -27
  176. package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
  177. package/lib/plugins/ShaderUniformPlugin.js +13 -34
  178. package/lib/plugins/UpdateModelPlugin.js +1 -10
  179. package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
  180. package/lib/point/index.js +26 -83
  181. package/lib/point/models/earthExtrude.js +61 -113
  182. package/lib/point/models/earthFill.js +57 -117
  183. package/lib/point/models/extrude.js +60 -111
  184. package/lib/point/models/fill.js +68 -109
  185. package/lib/point/models/fillmage.js +61 -115
  186. package/lib/point/models/image.js +48 -98
  187. package/lib/point/models/index.js +1 -12
  188. package/lib/point/models/normal.js +30 -64
  189. package/lib/point/models/radar.js +40 -74
  190. package/lib/point/models/simplePoint.js +41 -79
  191. package/lib/point/models/text.js +214 -303
  192. package/lib/point/shape/extrude.js +4 -20
  193. package/lib/polygon/index.js +11 -48
  194. package/lib/polygon/models/extrude.js +48 -103
  195. package/lib/polygon/models/fill.js +54 -98
  196. package/lib/polygon/models/index.js +2 -14
  197. package/lib/polygon/models/ocean.js +42 -88
  198. package/lib/polygon/models/water.js +37 -82
  199. package/lib/raster/buffers/triangulation.js +3 -7
  200. package/lib/raster/index.js +9 -40
  201. package/lib/raster/models/index.js +0 -5
  202. package/lib/raster/models/raster.js +80 -125
  203. package/lib/raster/models/rasterRgb.js +84 -139
  204. package/lib/raster/models/rasterTerrainRgb.js +56 -93
  205. package/lib/tile/interaction/getRasterData.js +14 -25
  206. package/lib/tile/interaction/utils.js +7 -19
  207. package/lib/tile/manager/base.js +63 -104
  208. package/lib/tile/service/TileLayerService.js +30 -57
  209. package/lib/tile/service/TilePickService.js +26 -48
  210. package/lib/tile/service/TileSourceService.js +2 -16
  211. package/lib/tile/style/utils.js +0 -3
  212. package/lib/tile/tileFactory/DebugTile.js +28 -53
  213. package/lib/tile/tileFactory/ImageTile.js +20 -46
  214. package/lib/tile/tileFactory/MaskTile.js +22 -51
  215. package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
  216. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
  217. package/lib/tile/tileFactory/RasterTile.js +30 -63
  218. package/lib/tile/tileFactory/Tile.js +63 -102
  219. package/lib/tile/tileFactory/VectorTile.js +41 -76
  220. package/lib/tile/tileFactory/index.js +0 -25
  221. package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
  222. package/lib/tile/tileFactory/util.js +0 -9
  223. package/lib/tile/tileLayer/BaseLayer.js +105 -153
  224. package/lib/tile/utils.js +1 -5
  225. package/lib/utils/blend.js +0 -5
  226. package/lib/utils/collision-index.js +9 -25
  227. package/lib/utils/dataMappingStyle.js +8 -19
  228. package/lib/utils/extrude_polyline.js +101 -181
  229. package/lib/utils/grid-index.js +2 -28
  230. package/lib/utils/identityScale.js +0 -9
  231. package/lib/utils/layerData.js +30 -49
  232. package/lib/utils/multiPassRender.js +11 -16
  233. package/lib/utils/polylineNormal.js +31 -66
  234. package/lib/utils/simpleLine.js +2 -21
  235. package/lib/utils/stencil.js +0 -4
  236. package/lib/utils/symbol-layout.js +27 -55
  237. package/lib/wind/index.js +9 -37
  238. package/lib/wind/models/index.js +0 -3
  239. package/lib/wind/models/utils.js +26 -62
  240. package/lib/wind/models/wind.js +101 -157
  241. package/lib/wind/models/windRender.js +53 -71
  242. package/lib/wind/models/windShader.js +0 -1
  243. package/package.json +7 -7
@@ -3,9 +3,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
5
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
-
7
6
  var _scaleMap, _dec, _class;
8
-
9
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
8
  import { IDebugLog, ILayerStage, ScaleTypes, StyleScaleType } from '@antv/l7-core';
11
9
  import { extent } from 'd3-array';
@@ -20,96 +18,75 @@ var scaleMap = (_scaleMap = {}, _defineProperty(_scaleMap, ScaleTypes.LINEAR, d3
20
18
  /**
21
19
  * 根据 Source 原始数据为指定字段创建 Scale,保存在 StyleAttribute 上,供下游插件使用
22
20
  */
23
-
24
21
  var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
25
22
  function FeatureScalePlugin() {
26
23
  _classCallCheck(this, FeatureScalePlugin);
27
-
28
24
  _defineProperty(this, "scaleOptions", {});
29
25
  }
30
-
31
26
  _createClass(FeatureScalePlugin, [{
32
27
  key: "apply",
33
28
  value: function apply(layer, _ref) {
34
29
  var _this = this;
35
-
36
30
  var styleAttributeService = _ref.styleAttributeService;
37
31
  layer.hooks.init.tapPromise('FeatureScalePlugin', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
38
32
  var _layer$getSource;
39
-
40
33
  var attributes, dataArray;
41
34
  return _regeneratorRuntime.wrap(function _callee$(_context) {
42
- while (1) {
43
- switch (_context.prev = _context.next) {
35
+ while (1) switch (_context.prev = _context.next) {
36
+ case 0:
37
+ layer.log(IDebugLog.ScaleInitStart, ILayerStage.INIT);
38
+ _this.scaleOptions = layer.getScaleOptions();
39
+ attributes = styleAttributeService.getLayerStyleAttributes();
40
+ dataArray = (_layer$getSource = layer.getSource()) === null || _layer$getSource === void 0 ? void 0 : _layer$getSource.data.dataArray;
41
+ if (!(Array.isArray(dataArray) && dataArray.length === 0)) {
42
+ _context.next = 8;
43
+ break;
44
+ }
45
+ return _context.abrupt("return");
46
+ case 8:
47
+ _this.caculateScalesForAttributes(attributes || [], dataArray);
48
+ case 9:
49
+ layer.log(IDebugLog.ScaleInitEnd, ILayerStage.INIT);
50
+ case 10:
51
+ case "end":
52
+ return _context.stop();
53
+ }
54
+ }, _callee);
55
+ })));
56
+
57
+ // 检测数据是否需要更新
58
+ layer.hooks.beforeRenderData.tapPromise('FeatureScalePlugin', /*#__PURE__*/function () {
59
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(flag) {
60
+ var attributes, dataArray;
61
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
62
+ while (1) switch (_context2.prev = _context2.next) {
44
63
  case 0:
45
- layer.log(IDebugLog.ScaleInitStart, ILayerStage.INIT);
64
+ if (flag) {
65
+ _context2.next = 2;
66
+ break;
67
+ }
68
+ return _context2.abrupt("return", flag);
69
+ case 2:
70
+ layer.log(IDebugLog.ScaleInitStart, ILayerStage.UPDATE);
46
71
  _this.scaleOptions = layer.getScaleOptions();
47
72
  attributes = styleAttributeService.getLayerStyleAttributes();
48
- dataArray = (_layer$getSource = layer.getSource()) === null || _layer$getSource === void 0 ? void 0 : _layer$getSource.data.dataArray;
49
-
73
+ dataArray = layer.getSource().data.dataArray;
50
74
  if (!(Array.isArray(dataArray) && dataArray.length === 0)) {
51
- _context.next = 8;
75
+ _context2.next = 8;
52
76
  break;
53
77
  }
54
-
55
- return _context.abrupt("return");
56
-
78
+ return _context2.abrupt("return", true);
57
79
  case 8:
58
80
  _this.caculateScalesForAttributes(attributes || [], dataArray);
59
-
60
- case 9:
61
- layer.log(IDebugLog.ScaleInitEnd, ILayerStage.INIT);
62
-
63
- case 10:
81
+ layer.log(IDebugLog.ScaleInitEnd, ILayerStage.UPDATE);
82
+ layer.layerModelNeedUpdate = true;
83
+ return _context2.abrupt("return", true);
84
+ case 12:
64
85
  case "end":
65
- return _context.stop();
66
- }
67
- }
68
- }, _callee);
69
- }))); // 检测数据是否需要更新
70
-
71
- layer.hooks.beforeRenderData.tapPromise('FeatureScalePlugin', /*#__PURE__*/function () {
72
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(flag) {
73
- var attributes, dataArray;
74
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
75
- while (1) {
76
- switch (_context2.prev = _context2.next) {
77
- case 0:
78
- if (flag) {
79
- _context2.next = 2;
80
- break;
81
- }
82
-
83
- return _context2.abrupt("return", flag);
84
-
85
- case 2:
86
- layer.log(IDebugLog.ScaleInitStart, ILayerStage.UPDATE);
87
- _this.scaleOptions = layer.getScaleOptions();
88
- attributes = styleAttributeService.getLayerStyleAttributes();
89
- dataArray = layer.getSource().data.dataArray;
90
-
91
- if (!(Array.isArray(dataArray) && dataArray.length === 0)) {
92
- _context2.next = 8;
93
- break;
94
- }
95
-
96
- return _context2.abrupt("return", true);
97
-
98
- case 8:
99
- _this.caculateScalesForAttributes(attributes || [], dataArray);
100
-
101
- layer.log(IDebugLog.ScaleInitEnd, ILayerStage.UPDATE);
102
- layer.layerModelNeedUpdate = true;
103
- return _context2.abrupt("return", true);
104
-
105
- case 12:
106
- case "end":
107
- return _context2.stop();
108
- }
86
+ return _context2.stop();
109
87
  }
110
88
  }, _callee2);
111
89
  }));
112
-
113
90
  return function (_x) {
114
91
  return _ref3.apply(this, arguments);
115
92
  };
@@ -118,20 +95,16 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
118
95
  if (layer.layerModelNeedUpdate) {
119
96
  return;
120
97
  }
121
-
122
98
  _this.scaleOptions = layer.getScaleOptions();
123
99
  var attributes = styleAttributeService.getLayerStyleAttributes();
124
100
  var dataArray = layer.getSource().data.dataArray;
125
-
126
101
  if (Array.isArray(dataArray) && dataArray.length === 0) {
127
102
  return;
128
103
  }
129
-
130
104
  if (attributes) {
131
105
  var attributesToRescale = attributes.filter(function (attribute) {
132
106
  return attribute.needRescale;
133
107
  });
134
-
135
108
  if (attributesToRescale.length) {
136
109
  _this.caculateScalesForAttributes(attributesToRescale, dataArray);
137
110
  }
@@ -147,30 +120,28 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
147
120
  key: "caculateScalesForAttributes",
148
121
  value: function caculateScalesForAttributes(attributes, dataArray) {
149
122
  var _this2 = this;
150
-
151
123
  attributes.forEach(function (attribute) {
152
124
  if (attribute.scale) {
153
125
  // 创建Scale
154
- var attributeScale = attribute.scale; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
155
-
126
+ var attributeScale = attribute.scale;
127
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
156
128
  attributeScale.names = _this2.parseFields(attribute.scale.field || []);
157
- var scales = []; // 为每个字段创建 Scale
158
-
129
+ var scales = [];
130
+ // 为每个字段创建 Scale
159
131
  attributeScale.names.forEach(function (field) {
160
132
  var _attribute$scale;
161
-
162
133
  scales.push(_this2.createScale(field, attribute.name, (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.values, dataArray));
163
- }); // 为scales 设置值区间 Range
134
+ });
164
135
 
136
+ // 为scales 设置值区间 Range
165
137
  if (scales.some(function (scale) {
166
138
  return scale.type === StyleScaleType.VARIABLE;
167
139
  })) {
168
140
  attributeScale.type = StyleScaleType.VARIABLE;
169
141
  scales.forEach(function (scale) {
170
- var _scale$option;
171
-
172
142
  // 如果设置了回调, 这不需要设置range
173
143
  if (!attributeScale.callback && attributeScale.values !== 'text') {
144
+ var _scale$option;
174
145
  switch ((_scale$option = scale.option) === null || _scale$option === void 0 ? void 0 : _scale$option.type) {
175
146
  case ScaleTypes.LOG:
176
147
  case ScaleTypes.LINEAR:
@@ -179,36 +150,29 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
179
150
  var tick = scale.scale.ticks(attributeScale.values.length);
180
151
  scale.scale.domain(tick);
181
152
  }
182
-
183
153
  attributeScale.values ? scale.scale.range(attributeScale.values) : scale.scale.range(scale.option.domain);
184
154
  break;
185
-
186
155
  case ScaleTypes.QUANTILE:
187
156
  case ScaleTypes.QUANTIZE:
188
157
  case ScaleTypes.THRESHOLD:
189
158
  scale.scale.range(attributeScale.values); //
190
-
191
159
  break;
192
-
193
160
  case ScaleTypes.IDENTITY:
194
161
  // 不做处理xe
195
162
  break;
196
-
197
163
  case ScaleTypes.CAT:
198
164
  attributeScale.values ? scale.scale.range(attributeScale.values) : scale.scale.range(scale.option.domain);
199
165
  break;
200
-
201
166
  case ScaleTypes.DIVERGING:
202
167
  case ScaleTypes.SEQUENTIAL:
203
- scale.scale.interpolator( // @ts-ignore
168
+ scale.scale.interpolator(
169
+ // @ts-ignore
204
170
  d3interpolate.interpolateRgbBasis(attributeScale.values));
205
171
  break;
206
172
  }
207
173
  }
208
-
209
174
  if (attributeScale.values === 'text') {
210
175
  var _scale$option2;
211
-
212
176
  scale.scale.range((_scale$option2 = scale.option) === null || _scale$option2 === void 0 ? void 0 : _scale$option2.domain);
213
177
  }
214
178
  });
@@ -219,7 +183,6 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
219
183
  return scale.scale(attributeScale.names[index]);
220
184
  });
221
185
  }
222
-
223
186
  attributeScale.scalers = scales.map(function (scale) {
224
187
  return {
225
188
  field: scale.field,
@@ -231,30 +194,27 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
231
194
  }
232
195
  });
233
196
  }
197
+
234
198
  /**
235
199
  * @example
236
200
  * 'w*h' => ['w', 'h']
237
201
  * 'w' => ['w']
238
202
  */
239
-
240
203
  }, {
241
204
  key: "parseFields",
242
205
  value: function parseFields(field) {
243
206
  if (Array.isArray(field)) {
244
207
  return field;
245
208
  }
246
-
247
209
  if (isString(field)) {
248
210
  return field.split('*');
249
211
  }
250
-
251
212
  return [field];
252
213
  }
253
214
  }, {
254
215
  key: "createScale",
255
216
  value: function createScale(field, name, values, data) {
256
217
  var _this$scaleOptions$na, _find;
257
-
258
218
  // scale 支持根据视觉通道和字段
259
219
  var scaleOption = this.scaleOptions[name] && ((_this$scaleOptions$na = this.scaleOptions[name]) === null || _this$scaleOptions$na === void 0 ? void 0 : _this$scaleOptions$na.field) === field ? this.scaleOptions[name] // TODO zi
260
220
  : this.scaleOptions[field];
@@ -264,7 +224,6 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
264
224
  type: StyleScaleType.VARIABLE,
265
225
  option: scaleOption
266
226
  };
267
-
268
227
  if (!data || !data.length) {
269
228
  if (scaleOption && scaleOption.type) {
270
229
  styleScale.scale = this.createDefaultScale(scaleOption);
@@ -272,46 +231,39 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
272
231
  styleScale.scale = d3.scaleOrdinal([field]);
273
232
  styleScale.type = StyleScaleType.CONSTANT;
274
233
  }
275
-
276
234
  return styleScale;
277
- } // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
278
-
279
-
235
+ }
236
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
280
237
  var firstValue = (_find = data.find(function (d) {
281
238
  return !isNil(d[field]);
282
- })) === null || _find === void 0 ? void 0 : _find[field]; // 常量 Scale
283
-
239
+ })) === null || _find === void 0 ? void 0 : _find[field];
240
+ // 常量 Scale
284
241
  if (this.isNumber(field) || isNil(firstValue) && !scaleOption) {
285
242
  styleScale.scale = d3.scaleOrdinal([field]);
286
243
  styleScale.type = StyleScaleType.CONSTANT;
287
244
  } else {
288
245
  // 根据数据类型判断 默认等分位,时间,和枚举类型
289
246
  var type = scaleOption && scaleOption.type || this.getDefaultType(firstValue);
290
-
291
247
  if (values === 'text') {
292
248
  // text 为内置变 如果是文本则为cat
293
249
  type = ScaleTypes.CAT;
294
250
  }
295
-
296
251
  var cfg = this.createScaleConfig(type, field, scaleOption, data);
297
252
  styleScale.scale = this.createDefaultScale(cfg);
298
253
  styleScale.option = cfg;
299
254
  }
300
-
301
255
  return styleScale;
302
256
  }
303
257
  }, {
304
258
  key: "getDefaultType",
305
259
  value: function getDefaultType(firstValue) {
306
260
  var type = ScaleTypes.LINEAR;
307
-
308
261
  if (typeof firstValue === 'string') {
309
262
  type = dateRegex.test(firstValue) ? ScaleTypes.TIME : ScaleTypes.CAT;
310
263
  }
311
-
312
264
  return type;
313
- } // 生成Scale 默认配置
314
-
265
+ }
266
+ // 生成Scale 默认配置
315
267
  }, {
316
268
  key: "createScaleConfig",
317
269
  value: function createScaleConfig(type, field, scaleOption, data) {
@@ -321,7 +273,6 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
321
273
  var values = (data === null || data === void 0 ? void 0 : data.map(function (item) {
322
274
  return item[field];
323
275
  })) || [];
324
-
325
276
  if (scaleOption !== null && scaleOption !== void 0 && scaleOption.domain) {
326
277
  cfg.domain = scaleOption === null || scaleOption === void 0 ? void 0 : scaleOption.domain;
327
278
  } else if (type === ScaleTypes.CAT || type === ScaleTypes.IDENTITY) {
@@ -336,42 +287,36 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
336
287
  // linear/Power/log
337
288
  cfg.domain = extent(values);
338
289
  }
339
-
340
290
  return _objectSpread(_objectSpread({}, cfg), scaleOption);
341
- } // 创建Scale 实例
291
+ }
342
292
 
293
+ // 创建Scale 实例
343
294
  }, {
344
295
  key: "createDefaultScale",
345
296
  value: function createDefaultScale(_ref4) {
346
297
  var type = _ref4.type,
347
- domain = _ref4.domain,
348
- unknown = _ref4.unknown,
349
- clamp = _ref4.clamp,
350
- nice = _ref4.nice;
298
+ domain = _ref4.domain,
299
+ unknown = _ref4.unknown,
300
+ clamp = _ref4.clamp,
301
+ nice = _ref4.nice;
351
302
  // @ts-ignore
352
303
  var scale = scaleMap[type]();
353
-
354
304
  if (domain && scale.domain) {
355
305
  scale.domain(domain);
356
306
  }
357
-
358
307
  if (unknown) {
359
308
  scale.unknown(unknown);
360
309
  }
361
-
362
310
  if (clamp !== undefined && scale.clamp) {
363
311
  scale.clamp(clamp);
364
312
  }
365
-
366
313
  if (nice !== undefined && scale.nice) {
367
314
  scale.nice(nice);
368
- } // TODO 其他属性支持
369
-
370
-
315
+ }
316
+ // TODO 其他属性支持
371
317
  return scale;
372
318
  }
373
319
  }]);
374
-
375
320
  return FeatureScalePlugin;
376
321
  }()) || _class);
377
322
  export { FeatureScalePlugin as default };
@@ -1,23 +1,19 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
-
5
4
  var _dec, _class;
6
-
7
5
  import { injectable } from 'inversify';
8
6
  import 'reflect-metadata';
9
7
  var LayerAnimateStylePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
10
8
  function LayerAnimateStylePlugin() {
11
9
  _classCallCheck(this, LayerAnimateStylePlugin);
12
10
  }
13
-
14
11
  _createClass(LayerAnimateStylePlugin, [{
15
12
  key: "apply",
16
13
  value: function apply(layer) {
17
14
  layer.hooks.beforeRender.tap('LayerAnimateStylePlugin', function () {
18
15
  // @ts-ignore
19
16
  var animateStatus = layer.animateStatus;
20
-
21
17
  if (animateStatus) {
22
18
  layer.models.forEach(function (model) {
23
19
  model.addUniforms(_objectSpread({}, layer.layerModel.getAnimateUniforms()));
@@ -26,7 +22,6 @@ var LayerAnimateStylePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/f
26
22
  });
27
23
  }
28
24
  }]);
29
-
30
25
  return LayerAnimateStylePlugin;
31
26
  }()) || _class);
32
27
  export { LayerAnimateStylePlugin as default };
@@ -1,34 +1,27 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
-
5
4
  var _dec, _class;
6
-
7
5
  import { injectable } from 'inversify';
8
6
  import 'reflect-metadata';
9
7
  /**
10
8
  * 更新图层样式,初始图层相关配置
11
9
  */
12
-
13
10
  var LayerStylePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
14
11
  function LayerStylePlugin() {
15
12
  _classCallCheck(this, LayerStylePlugin);
16
13
  }
17
-
18
14
  _createClass(LayerStylePlugin, [{
19
15
  key: "apply",
20
16
  value: function apply(layer) {
21
17
  layer.hooks.afterInit.tap('LayerMaskPlugin', function () {
22
18
  var _layer$getLayerConfig = layer.getLayerConfig(),
23
- maskLayers = _layer$getLayerConfig.maskLayers,
24
- enableMask = _layer$getLayerConfig.enableMask; // mask 初始化
25
-
26
-
19
+ maskLayers = _layer$getLayerConfig.maskLayers,
20
+ enableMask = _layer$getLayerConfig.enableMask;
21
+ // mask 初始化
27
22
  if (!layer.tileLayer && maskLayers && maskLayers.length > 0) {
28
23
  var _layer$masks;
29
-
30
24
  (_layer$masks = layer.masks).push.apply(_layer$masks, _toConsumableArray(maskLayers));
31
-
32
25
  layer.updateLayerConfig({
33
26
  mask: true && enableMask
34
27
  });
@@ -36,7 +29,6 @@ var LayerStylePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
36
29
  });
37
30
  }
38
31
  }]);
39
-
40
32
  return LayerStylePlugin;
41
33
  }()) || _class);
42
34
  export { LayerStylePlugin as default };