@antv/l7-layers 2.17.4 → 2.17.5

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
@@ -4,13 +4,12 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
5
  import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
6
6
  import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
7
-
8
7
  var _dec, _dec2, _dec3, _dec4, _dec5, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
9
-
10
8
  import { CameraUniform, CoordinateUniform, TYPES } from '@antv/l7-core';
11
9
  import { $window } from '@antv/l7-utils';
12
10
  import { inject, injectable } from 'inversify';
13
11
  import 'reflect-metadata';
12
+
14
13
  /**
15
14
  * 在渲染之前需要获取当前 Shader 所需 Uniform,例如:
16
15
  * 1. 从相机服务中获取 View & ProjectionMatrix,当前缩放等级等等
@@ -18,74 +17,61 @@ import 'reflect-metadata';
18
17
  * @see https://yuque.antfin-inc.com/yuqi.pyq/fgetpa/doml91
19
18
  * 3. 当前 Layer 本身的样式属性
20
19
  */
21
-
22
20
  var ShaderUniformPlugin = (_dec = injectable(), _dec2 = inject(TYPES.ICameraService), _dec3 = inject(TYPES.ICoordinateSystemService), _dec4 = inject(TYPES.IRendererService), _dec5 = inject(TYPES.IMapService), _dec(_class = (_class2 = /*#__PURE__*/function () {
23
21
  function ShaderUniformPlugin() {
24
22
  _classCallCheck(this, ShaderUniformPlugin);
25
-
26
23
  _initializerDefineProperty(this, "cameraService", _descriptor, this);
27
-
28
24
  _initializerDefineProperty(this, "coordinateSystemService", _descriptor2, this);
29
-
30
25
  _initializerDefineProperty(this, "rendererService", _descriptor3, this);
31
-
32
26
  _initializerDefineProperty(this, "mapService", _descriptor4, this);
33
27
  }
34
-
35
28
  _createClass(ShaderUniformPlugin, [{
36
29
  key: "apply",
37
30
  value: function apply(layer) {
38
31
  var _this = this;
39
-
40
32
  var version = this.mapService.version;
41
33
  var mvp = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; // default matrix (for gaode2.x)
42
-
43
34
  var sceneCenterMercator = [0, 0];
44
35
  layer.hooks.beforeRender.tap('ShaderUniformPlugin', function () {
45
36
  // @ts-ignore
46
- var offset = layer.getLayerConfig().tileOrigin; // 重新计算坐标系参数
47
-
37
+ var offset = layer.getLayerConfig().tileOrigin;
38
+ // 重新计算坐标系参数
48
39
  _this.coordinateSystemService.refresh(offset);
49
-
50
40
  if (version === 'GAODE2.x') {
51
- _this.setLayerCenter(layer); // @ts-ignore
52
-
53
-
54
- mvp = _this.mapService.map.customCoords.getMVPMatrix(); // mvp = amapCustomCoords.getMVPMatrix()
41
+ _this.setLayerCenter(layer);
42
+ // @ts-ignore
43
+ mvp = _this.mapService.map.customCoords.getMVPMatrix();
44
+ // mvp = amapCustomCoords.getMVPMatrix()
55
45
  // @ts-ignore
56
-
57
46
  sceneCenterMercator = _this.mapService.getCustomCoordCenter();
58
47
  }
59
-
60
48
  var _this$rendererService = _this.rendererService.getViewportSize(),
61
- width = _this$rendererService.width,
62
- height = _this$rendererService.height;
63
-
49
+ width = _this$rendererService.width,
50
+ height = _this$rendererService.height;
64
51
  layer.models.forEach(function (model) {
65
52
  var _model$addUniforms;
66
-
67
53
  model.addUniforms((_model$addUniforms = {}, _defineProperty(_model$addUniforms, CameraUniform.ProjectionMatrix, _this.cameraService.getProjectionMatrix()), _defineProperty(_model$addUniforms, CameraUniform.ViewMatrix, _this.cameraService.getViewMatrix()), _defineProperty(_model$addUniforms, CameraUniform.ViewProjectionMatrix, _this.cameraService.getViewProjectionMatrix()), _defineProperty(_model$addUniforms, CameraUniform.Zoom, _this.cameraService.getZoom()), _defineProperty(_model$addUniforms, CameraUniform.ZoomScale, _this.cameraService.getZoomScale()), _defineProperty(_model$addUniforms, CameraUniform.FocalDistance, _this.cameraService.getFocalDistance()), _defineProperty(_model$addUniforms, CameraUniform.CameraPosition, _this.cameraService.getCameraPosition()), _defineProperty(_model$addUniforms, CoordinateUniform.CoordinateSystem, _this.coordinateSystemService.getCoordinateSystem()), _defineProperty(_model$addUniforms, CoordinateUniform.ViewportCenter, _this.coordinateSystemService.getViewportCenter()), _defineProperty(_model$addUniforms, CoordinateUniform.ViewportCenterProjection, _this.coordinateSystemService.getViewportCenterProjection()), _defineProperty(_model$addUniforms, CoordinateUniform.PixelsPerDegree, _this.coordinateSystemService.getPixelsPerDegree()), _defineProperty(_model$addUniforms, CoordinateUniform.PixelsPerDegree2, _this.coordinateSystemService.getPixelsPerDegree2()), _defineProperty(_model$addUniforms, CoordinateUniform.PixelsPerMeter, _this.coordinateSystemService.getPixelsPerMeter()), _defineProperty(_model$addUniforms, CoordinateUniform.Mvp, mvp), _defineProperty(_model$addUniforms, "u_sceneCenterMercator", sceneCenterMercator), _defineProperty(_model$addUniforms, "u_ViewportSize", [width, height]), _defineProperty(_model$addUniforms, "u_ModelMatrix", _this.cameraService.getModelMatrix()), _defineProperty(_model$addUniforms, "u_DevicePixelRatio", $window.devicePixelRatio), _defineProperty(_model$addUniforms, "u_PickingBuffer", layer.getLayerConfig().pickingBuffer || 0), _defineProperty(_model$addUniforms, "u_shaderPick", Number(layer.getShaderPickStat())), _model$addUniforms));
68
- }); // TODO:脏检查,决定是否需要渲染
54
+ });
55
+
56
+ // TODO:脏检查,决定是否需要渲染
69
57
  });
70
58
  }
59
+
71
60
  /**
72
61
  * 对于每个 layer 都有不同的几何中心点,因此在绘制每个 layer 的时候都需要重新设置
73
62
  * @param layer
74
63
  */
75
-
76
64
  }, {
77
65
  key: "setLayerCenter",
78
66
  value: function setLayerCenter(layer) {
79
67
  if (layer.coordCenter === undefined) {
80
68
  layer.coordCenter = layer.getSource().center;
81
69
  }
82
-
83
70
  if (this.mapService.setCoordCenter) {
84
71
  this.mapService.setCoordCenter(layer.coordCenter);
85
72
  }
86
73
  }
87
74
  }]);
88
-
89
75
  return ShaderUniformPlugin;
90
76
  }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "cameraService", [_dec2], {
91
77
  configurable: true,
@@ -1,19 +1,15 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
-
4
3
  var _dec, _class;
5
-
6
4
  import { injectable } from 'inversify';
7
5
  import 'reflect-metadata';
8
6
  /**
9
7
  * Model 更新
10
8
  */
11
-
12
9
  var UpdateModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
13
10
  function UpdateModelPlugin() {
14
11
  _classCallCheck(this, UpdateModelPlugin);
15
12
  }
16
-
17
13
  _createClass(UpdateModelPlugin, [{
18
14
  key: "apply",
19
15
  value: function apply(layer) {
@@ -32,7 +28,6 @@ var UpdateModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functio
32
28
  });
33
29
  }
34
30
  }]);
35
-
36
31
  return UpdateModelPlugin;
37
32
  }()) || _class);
38
33
  export { UpdateModelPlugin as default };
@@ -1,24 +1,20 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
-
4
3
  var _dec, _class;
5
-
6
4
  import { injectable } from 'inversify';
7
5
  import 'reflect-metadata';
6
+
8
7
  /**
9
8
  * 在初始化阶段完成属性的注册,以及首次根据 Layer 指定的三角化方法完成 indices 和 attribute 的创建
10
9
  */
11
-
12
10
  var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
13
11
  function UpdateStyleAttributePlugin() {
14
12
  _classCallCheck(this, UpdateStyleAttributePlugin);
15
13
  }
16
-
17
14
  _createClass(UpdateStyleAttributePlugin, [{
18
15
  key: "apply",
19
16
  value: function apply(layer, _ref) {
20
17
  var _this = this;
21
-
22
18
  var styleAttributeService = _ref.styleAttributeService;
23
19
  layer.hooks.init.tapPromise('UpdateStyleAttributePlugin', function () {
24
20
  _this.initStyleAttribute(layer, {
@@ -29,7 +25,6 @@ var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__
29
25
  if (layer.layerModelNeedUpdate) {
30
26
  return;
31
27
  }
32
-
33
28
  if (layer.inited) {
34
29
  _this.updateStyleAttribute(layer, {
35
30
  styleAttributeService: styleAttributeService
@@ -43,7 +38,6 @@ var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__
43
38
  var styleAttributeService = _ref2.styleAttributeService;
44
39
  var attributes = styleAttributeService.getLayerStyleAttributes() || [];
45
40
  var filter = styleAttributeService.getLayerStyleAttribute('filter');
46
-
47
41
  if (filter && filter.needRegenerateVertices) {
48
42
  layer.layerModelNeedUpdate = true;
49
43
  attributes.forEach(function (attr) {
@@ -51,12 +45,12 @@ var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__
51
45
  });
52
46
  return;
53
47
  }
54
-
55
48
  attributes.filter(function (attribute) {
56
49
  return attribute.needRegenerateVertices;
57
50
  }).forEach(function (attribute) {
58
51
  // 精确更新某个/某些 feature(s),需要传入 featureIdx d
59
- styleAttributeService.updateAttributeByFeatureRange(attribute.name, layer.getEncodedData(), // 获取经过 mapping 最新的数据
52
+ styleAttributeService.updateAttributeByFeatureRange(attribute.name, layer.getEncodedData(),
53
+ // 获取经过 mapping 最新的数据
60
54
  attribute.featureRange.startIndex, attribute.featureRange.endIndex, layer);
61
55
  attribute.needRegenerateVertices = false;
62
56
  });
@@ -70,13 +64,13 @@ var UpdateStyleAttributePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__
70
64
  return attribute.needRegenerateVertices;
71
65
  }).forEach(function (attribute) {
72
66
  // 精确更新某个/某些 feature(s),需要传入 featureIdx d
73
- styleAttributeService.updateAttributeByFeatureRange(attribute.name, layer.getEncodedData(), // 获取经过 mapping 最新的数据
67
+ styleAttributeService.updateAttributeByFeatureRange(attribute.name, layer.getEncodedData(),
68
+ // 获取经过 mapping 最新的数据
74
69
  attribute.featureRange.startIndex, attribute.featureRange.endIndex);
75
70
  attribute.needRegenerateVertices = false;
76
71
  });
77
72
  }
78
73
  }]);
79
-
80
74
  return UpdateStyleAttributePlugin;
81
75
  }()) || _class);
82
76
  export { UpdateStyleAttributePlugin as default };
package/es/point/index.js CHANGED
@@ -6,42 +6,26 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
-
10
9
  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; } } }; }
11
-
12
10
  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); }
13
-
14
- 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; }
15
-
11
+ 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; }
16
12
  import _regeneratorRuntime from "@babel/runtime/regenerator";
17
-
18
13
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
19
-
20
14
  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; } }
21
-
22
15
  import BaseLayer from "../core/BaseLayer";
23
16
  import PointModels from "./models/index";
24
-
25
17
  var PointLayer = /*#__PURE__*/function (_BaseLayer) {
26
18
  _inherits(PointLayer, _BaseLayer);
27
-
28
19
  var _super = _createSuper(PointLayer);
29
-
30
20
  function PointLayer() {
31
21
  var _this;
32
-
33
22
  _classCallCheck(this, PointLayer);
34
-
35
23
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
36
24
  args[_key] = arguments[_key];
37
25
  }
38
-
39
26
  _this = _super.call.apply(_super, [this].concat(args));
40
-
41
27
  _defineProperty(_assertThisInitialized(_this), "type", 'PointLayer');
42
-
43
28
  _defineProperty(_assertThisInitialized(_this), "enableEncodeStyles", ['opacity', 'offsets', 'stroke']);
44
-
45
29
  _defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
46
30
  data: [],
47
31
  options: {
@@ -52,41 +36,32 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
52
36
  }
53
37
  }
54
38
  });
55
-
56
39
  return _this;
57
40
  }
58
-
59
41
  _createClass(PointLayer, [{
60
42
  key: "buildModels",
61
43
  value: function () {
62
44
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
63
45
  var modelType;
64
46
  return _regeneratorRuntime.wrap(function _callee$(_context) {
65
- while (1) {
66
- switch (_context.prev = _context.next) {
67
- case 0:
68
- modelType = this.getModelType();
69
-
70
- if (this.layerModel) {
71
- this.layerModel.clearModels();
72
- }
73
-
74
- this.layerModel = new PointModels[modelType](this);
75
- _context.next = 5;
76
- return this.initLayerModels();
77
-
78
- case 5:
79
- case "end":
80
- return _context.stop();
81
- }
47
+ while (1) switch (_context.prev = _context.next) {
48
+ case 0:
49
+ modelType = this.getModelType();
50
+ if (this.layerModel) {
51
+ this.layerModel.clearModels();
52
+ }
53
+ this.layerModel = new PointModels[modelType](this);
54
+ _context.next = 5;
55
+ return this.initLayerModels();
56
+ case 5:
57
+ case "end":
58
+ return _context.stop();
82
59
  }
83
60
  }, _callee, this);
84
61
  }));
85
-
86
62
  function buildModels() {
87
63
  return _buildModels.apply(this, arguments);
88
64
  }
89
-
90
65
  return buildModels;
91
66
  }()
92
67
  }, {
@@ -94,60 +69,47 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
94
69
  value: function () {
95
70
  var _rebuildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
96
71
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
97
- while (1) {
98
- switch (_context2.prev = _context2.next) {
99
- case 0:
100
- _context2.next = 2;
101
- return this.buildModels();
102
-
103
- case 2:
104
- case "end":
105
- return _context2.stop();
106
- }
72
+ while (1) switch (_context2.prev = _context2.next) {
73
+ case 0:
74
+ _context2.next = 2;
75
+ return this.buildModels();
76
+ case 2:
77
+ case "end":
78
+ return _context2.stop();
107
79
  }
108
80
  }, _callee2, this);
109
81
  }));
110
-
111
82
  function rebuildModels() {
112
83
  return _rebuildModels.apply(this, arguments);
113
84
  }
114
-
115
85
  return rebuildModels;
116
86
  }()
117
87
  /**
118
88
  * 在未传入数据的时候判断点图层的 shape 类型
119
89
  * @returns
120
90
  */
121
-
122
91
  }, {
123
92
  key: "getModelTypeWillEmptyData",
124
93
  value: function getModelTypeWillEmptyData() {
125
94
  if (this.shapeOption) {
126
95
  var _this$shapeOption = this.shapeOption,
127
- field = _this$shapeOption.field,
128
- values = _this$shapeOption.values;
129
-
96
+ field = _this$shapeOption.field,
97
+ values = _this$shapeOption.values;
130
98
  var _this$getLayerConfig = this.getLayerConfig(),
131
- shape2d = _this$getLayerConfig.shape2d;
132
-
99
+ shape2d = _this$getLayerConfig.shape2d;
133
100
  var iconMap = this.iconService.getIconMap();
134
-
135
101
  if (field && (shape2d === null || shape2d === void 0 ? void 0 : shape2d.indexOf(field)) !== -1) {
136
102
  return 'fill';
137
103
  }
138
-
139
104
  if (values === 'text') {
140
105
  return 'text';
141
106
  }
142
-
143
107
  if (values && values instanceof Array) {
144
108
  var _iterator = _createForOfIteratorHelper(values),
145
- _step;
146
-
109
+ _step;
147
110
  try {
148
111
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
149
112
  var v = _step.value;
150
-
151
113
  if (typeof v === 'string' && iconMap.hasOwnProperty(v)) {
152
114
  return 'image';
153
115
  }
@@ -159,7 +121,6 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
159
121
  }
160
122
  }
161
123
  }
162
-
163
124
  return 'normal';
164
125
  }
165
126
  }, {
@@ -193,37 +154,29 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
193
154
  value: function getModelType() {
194
155
  // 2D、 3d、 shape、image、text、normal、
195
156
  var layerData = this.getEncodedData();
196
-
197
157
  var _this$getLayerConfig2 = this.getLayerConfig(),
198
- shape2d = _this$getLayerConfig2.shape2d,
199
- shape3d = _this$getLayerConfig2.shape3d;
200
-
158
+ shape2d = _this$getLayerConfig2.shape2d,
159
+ shape3d = _this$getLayerConfig2.shape3d;
201
160
  var iconMap = this.iconService.getIconMap();
202
161
  var item = layerData.find(function (fe) {
203
162
  return fe.hasOwnProperty('shape');
204
163
  });
205
-
206
164
  if (!item) {
207
165
  return this.getModelTypeWillEmptyData();
208
166
  } else {
209
167
  var shape = item.shape;
210
-
211
168
  if (shape === 'dot') {
212
169
  return 'normal';
213
170
  }
214
-
215
171
  if (shape === 'simple') {
216
172
  return 'simplePoint';
217
173
  }
218
-
219
174
  if (shape === 'radar') {
220
175
  return 'radar';
221
176
  }
222
-
223
177
  if (this.layerType === 'fillImage') {
224
178
  return 'fillImage';
225
179
  }
226
-
227
180
  if ((shape2d === null || shape2d === void 0 ? void 0 : shape2d.indexOf(shape)) !== -1) {
228
181
  if (this.mapService.version === 'GLOBEL') {
229
182
  return 'earthFill';
@@ -231,7 +184,6 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
231
184
  return 'fill';
232
185
  }
233
186
  }
234
-
235
187
  if ((shape3d === null || shape3d === void 0 ? void 0 : shape3d.indexOf(shape)) !== -1) {
236
188
  if (this.mapService.version === 'GLOBEL') {
237
189
  return 'earthExtrude';
@@ -239,17 +191,13 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
239
191
  return 'extrude';
240
192
  }
241
193
  }
242
-
243
194
  if (iconMap.hasOwnProperty(shape)) {
244
195
  return 'image';
245
196
  }
246
-
247
197
  return 'text';
248
198
  }
249
199
  }
250
200
  }]);
251
-
252
201
  return PointLayer;
253
202
  }(BaseLayer);
254
-
255
203
  export { PointLayer as default };