@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
@@ -7,17 +7,11 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
7
7
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
8
  import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
9
9
  import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWarningHelper";
10
-
11
10
  var _dec, _class, _descriptor;
12
-
13
11
  import _regeneratorRuntime from "@babel/runtime/regenerator";
14
-
15
12
  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; } } }; }
16
-
17
13
  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); }
18
-
19
- 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; }
20
-
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; }
21
15
  import { BlendType, gl, lazyInject, MaskOperation, StencilType, TYPES } from '@antv/l7-core';
22
16
  import { rgb2arr } from '@antv/l7-utils';
23
17
  import { color } from 'd3-color';
@@ -27,17 +21,19 @@ import { getStencil as _getStencil, getStencilMask } from "../utils/stencil";
27
21
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
28
22
  var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
29
23
  // style texture data mapping
24
+
30
25
  // 用于数据传递的数据纹理
31
26
  // 默认有多少列(宽度)
32
27
  // 计算得到的当前数据纹理有多少行(高度)
28
+
33
29
  // 单个 cell 的长度
34
30
  // 需要进行数据映射的属性集合
31
+
35
32
  // style texture data mapping
33
+
36
34
  function BaseModel(layer) {
37
35
  _classCallCheck(this, BaseModel);
38
-
39
36
  _initializerDefineProperty(this, "configService", _descriptor, this);
40
-
41
37
  this.layer = layer;
42
38
  this.rendererService = layer.getContainer().get(TYPES.IRendererService);
43
39
  this.pickingService = layer.getContainer().get(TYPES.IPickingService);
@@ -47,15 +43,15 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
47
43
  this.iconService = layer.getContainer().get(TYPES.IIconService);
48
44
  this.fontService = layer.getContainer().get(TYPES.IFontService);
49
45
  this.cameraService = layer.getContainer().get(TYPES.ICameraService);
50
- this.layerService = layer.getContainer().get(TYPES.ILayerService); // 注册 Attribute
51
-
52
- this.registerBuiltinAttributes(); // 开启动画
46
+ this.layerService = layer.getContainer().get(TYPES.ILayerService);
53
47
 
48
+ // 注册 Attribute
49
+ this.registerBuiltinAttributes();
50
+ // 开启动画
54
51
  this.startModelAnimate();
55
52
  var createTexture2D = this.rendererService.createTexture2D;
56
53
  this.createTexture2D = createTexture2D;
57
54
  this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度
58
-
59
55
  this.rowCount = 1;
60
56
  this.cellLength = 0;
61
57
  this.cellProperties = [];
@@ -75,8 +71,8 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
75
71
  hasStroke: 0,
76
72
  hasOffsets: 0
77
73
  };
78
- this.dataTextureTest = this.layerService.getOESTextureFloat(); // 只有在不支持数据纹理的情况下进行赋值
79
-
74
+ this.dataTextureTest = this.layerService.getOESTextureFloat();
75
+ // 只有在不支持数据纹理的情况下进行赋值
80
76
  if (!this.dataTextureTest) {
81
77
  this.dataTexture = this.createTexture2D({
82
78
  // data: new Uint8ClampedArray(4),
@@ -89,20 +85,18 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
89
85
  height: 1
90
86
  });
91
87
  }
92
- } // style datatexture mapping
88
+ }
89
+
90
+ // style datatexture mapping
93
91
 
94
92
  /**
95
93
  * 清除上一次的计算结果 - 全量清除
96
94
  */
97
-
98
-
99
95
  _createClass(BaseModel, [{
100
96
  key: "clearLastCalRes",
101
97
  value: function clearLastCalRes() {
102
98
  this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合
103
-
104
99
  this.cellLength = 0; // 清空上一次计算的 cell 的长度
105
-
106
100
  this.stylePropertiesExist = {
107
101
  // 全量清空上一次是否需要对 style 属性进行数据映射的判断
108
102
  hasThetaOffset: 0,
@@ -117,82 +111,91 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
117
111
  key: "getCellTypeLayout",
118
112
  value: function getCellTypeLayout() {
119
113
  if (this.dataTextureTest) {
120
- return [// 0
121
- this.rowCount, // 数据纹理有几行
122
- this.DATA_TEXTURE_WIDTH, // 数据纹理有几列
123
- 0.0, 0.0, // 1
124
- this.stylePropertiesExist.hasOpacity, // cell 中是否存在 opacity
125
- this.stylePropertiesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity
126
- this.stylePropertiesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth
127
- this.stylePropertiesExist.hasStroke, // cell 中是否存在 stroke
114
+ return [
115
+ // 0
116
+ this.rowCount,
117
+ // 数据纹理有几行
118
+ this.DATA_TEXTURE_WIDTH,
119
+ // 数据纹理有几列
120
+ 0.0, 0.0,
121
+ // 1
122
+ this.stylePropertiesExist.hasOpacity,
123
+ // cell 中是否存在 opacity
124
+ this.stylePropertiesExist.hasStrokeOpacity,
125
+ // cell 中是否存在 strokeOpacity
126
+ this.stylePropertiesExist.hasStrokeWidth,
127
+ // cell 中是否存在 strokeWidth
128
+ this.stylePropertiesExist.hasStroke,
129
+ // cell 中是否存在 stroke
128
130
  // 2
129
- this.stylePropertiesExist.hasOffsets, // cell 中是否存在 offsets
130
- this.stylePropertiesExist.hasThetaOffset, // cell 中是否存在 thetaOffset
131
- 0.0, 0.0, // 3
131
+ this.stylePropertiesExist.hasOffsets,
132
+ // cell 中是否存在 offsets
133
+ this.stylePropertiesExist.hasThetaOffset,
134
+ // cell 中是否存在 thetaOffset
135
+ 0.0, 0.0,
136
+ // 3
132
137
  0.0, 0.0, 0.0, 1.0];
133
138
  } else {
134
- return [1.0, // 数据纹理有几行
135
- 1.0, // 数据纹理有几列
136
- 0.0, 0.0, 0.0, // cell 中是否存在 opacity
137
- 0.0, // cell 中是否存在 strokeOpacity
138
- 0.0, // cell 中是否存在 strokeWidth
139
- 0.0, // cell 中是否存在 stroke
140
- 0.0, // cell 中是否存在 offsets
139
+ return [1.0,
140
+ // 数据纹理有几行
141
+ 1.0,
142
+ // 数据纹理有几列
143
+ 0.0, 0.0, 0.0,
144
+ // cell 中是否存在 opacity
145
+ 0.0,
146
+ // cell 中是否存在 strokeOpacity
147
+ 0.0,
148
+ // cell 中是否存在 strokeWidth
149
+ 0.0,
150
+ // cell 中是否存在 stroke
151
+ 0.0,
152
+ // cell 中是否存在 offsets
141
153
  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0];
142
154
  }
143
155
  }
156
+
144
157
  /**
145
158
  * 判断数据纹理是否需要重新计算 - 根据传入的值进行判断
146
159
  * @param options
147
160
  * @returns
148
161
  */
149
-
150
162
  }, {
151
163
  key: "dataTextureNeedUpdate",
152
164
  value: function dataTextureNeedUpdate(options) {
153
165
  var isUpdate = false;
154
-
155
166
  if (!isEqual(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {
156
167
  isUpdate = true;
157
168
  this.cacheStyleProperties.thetaOffset = options.thetaOffset;
158
169
  }
159
-
160
170
  if (!isEqual(options.opacity, this.cacheStyleProperties.opacity)) {
161
171
  isUpdate = true;
162
172
  this.cacheStyleProperties.opacity = options.opacity;
163
173
  }
164
-
165
174
  if (!isEqual(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)) {
166
175
  isUpdate = true;
167
176
  this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;
168
177
  }
169
-
170
178
  if (!isEqual(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {
171
179
  isUpdate = true;
172
180
  this.cacheStyleProperties.strokeWidth = options.strokeWidth;
173
181
  }
174
-
175
182
  if (!isEqual(options.stroke, this.cacheStyleProperties.stroke)) {
176
183
  isUpdate = true;
177
184
  this.cacheStyleProperties.stroke = options.stroke;
178
185
  }
179
-
180
186
  if (!isEqual(options.offsets, this.cacheStyleProperties.offsets)) {
181
187
  isUpdate = true;
182
188
  this.cacheStyleProperties.offsets = options.offsets;
183
189
  }
184
-
185
190
  if (this.dataTexture === undefined) {
186
191
  isUpdate = true;
187
192
  }
188
-
189
193
  return isUpdate;
190
194
  }
191
195
  /**
192
196
  * 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
193
197
  * @param options
194
198
  */
195
-
196
199
  }, {
197
200
  key: "judgeStyleAttributes",
198
201
  value: function judgeStyleAttributes(options) {
@@ -207,7 +210,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
207
210
  this.stylePropertiesExist.hasOpacity = 1;
208
211
  this.cellLength += 1;
209
212
  }
210
-
211
213
  if (options.strokeOpacity !== undefined && !isNumber(options.strokeOpacity)) {
212
214
  // 数据映射
213
215
  this.cellProperties.push({
@@ -217,7 +219,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
217
219
  this.stylePropertiesExist.hasStrokeOpacity = 1;
218
220
  this.cellLength += 1;
219
221
  }
220
-
221
222
  if (options.strokeWidth !== undefined && !isNumber(options.strokeWidth)) {
222
223
  // 数据映射
223
224
  this.cellProperties.push({
@@ -227,7 +228,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
227
228
  this.stylePropertiesExist.hasStrokeWidth = 1;
228
229
  this.cellLength += 1;
229
230
  }
230
-
231
231
  if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {
232
232
  // 数据映射
233
233
  this.cellProperties.push({
@@ -237,7 +237,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
237
237
  this.stylePropertiesExist.hasStroke = 1;
238
238
  this.cellLength += 4;
239
239
  }
240
-
241
240
  if (options.offsets !== undefined && !this.isOffsetStatic(options.offsets)) {
242
241
  // 数据映射
243
242
  this.cellProperties.push({
@@ -247,7 +246,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
247
246
  this.stylePropertiesExist.hasOffsets = 1;
248
247
  this.cellLength += 2;
249
248
  }
250
-
251
249
  if (options.thetaOffset !== undefined && !isNumber(options.thetaOffset)) {
252
250
  // 数据映射
253
251
  this.cellProperties.push({
@@ -258,12 +256,12 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
258
256
  this.cellLength += 1;
259
257
  }
260
258
  }
259
+
261
260
  /**
262
261
  * 判断变量 stroke 是否是常量值
263
262
  * @param stroke
264
263
  * @returns
265
264
  */
266
-
267
265
  }, {
268
266
  key: "isStaticColor",
269
267
  value: function isStaticColor(stroke) {
@@ -274,7 +272,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
274
272
  return false;
275
273
  }
276
274
  }
277
-
278
275
  return false;
279
276
  }
280
277
  /**
@@ -282,7 +279,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
282
279
  * @param stroke
283
280
  * @returns
284
281
  */
285
-
286
282
  }, {
287
283
  key: "getStrokeColor",
288
284
  value: function getStrokeColor(stroke) {
@@ -297,12 +293,12 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
297
293
  return [0, 0, 0, 0];
298
294
  }
299
295
  }
296
+
300
297
  /**
301
298
  * 判断 offsets 是否是常量
302
299
  * @param offsets
303
300
  * @returns
304
301
  */
305
-
306
302
  }, {
307
303
  key: "isOffsetStatic",
308
304
  value: function isOffsetStatic(offsets) {
@@ -312,12 +308,12 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
312
308
  return false;
313
309
  }
314
310
  }
311
+
315
312
  /**
316
313
  * 补空位
317
314
  * @param d
318
315
  * @param count
319
316
  */
320
-
321
317
  }, {
322
318
  key: "patchMod",
323
319
  value: function patchMod(d, count) {
@@ -325,26 +321,24 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
325
321
  d.push(-1);
326
322
  }
327
323
  }
324
+
328
325
  /**
329
326
  * 根据映射的数据字段往推入数据
330
327
  * @param d
331
328
  * @param cellData
332
329
  * @param cellPropertiesLayouts
333
330
  */
334
-
335
331
  }, {
336
332
  key: "patchData",
337
333
  value: function patchData(d, cellData, cellPropertiesLayouts) {
338
334
  var _iterator = _createForOfIteratorHelper(cellPropertiesLayouts),
339
- _step;
340
-
335
+ _step;
341
336
  try {
342
337
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
343
338
  var layout = _step.value;
344
339
  var attr = layout.attr,
345
- count = layout.count;
340
+ count = layout.count;
346
341
  var value = cellData[attr];
347
-
348
342
  if (value !== undefined) {
349
343
  // 数据中存在该属性
350
344
  if (attr === 'stroke') {
@@ -369,6 +363,7 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
369
363
  _iterator.f();
370
364
  }
371
365
  }
366
+
372
367
  /**
373
368
  * 计算推入数据纹理的数据
374
369
  * @param cellLength
@@ -376,7 +371,6 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
376
371
  * @param cellPropertiesLayouts
377
372
  * @returns
378
373
  */
379
-
380
374
  }, {
381
375
  key: "calDataFrame",
382
376
  value: function calDataFrame(cellLength, encodeData, cellPropertiesLayouts) {
@@ -385,48 +379,44 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
385
379
 
386
380
  var totalLength = rowCount * this.DATA_TEXTURE_WIDTH;
387
381
  var d = [];
388
-
389
382
  for (var i = 0; i < encodeDatalength; i++) {
390
383
  // 根据 encodeData 数据推入数据
391
384
  var cellData = encodeData[i];
392
385
  this.patchData(d, cellData, cellPropertiesLayouts);
393
386
  }
394
-
395
387
  for (var _i = d.length; _i < totalLength; _i++) {
396
388
  // 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)
397
389
  d.push(-1);
398
- } // console.log('data', d)
399
-
400
-
390
+ }
391
+ // console.log('data', d)
401
392
  return {
402
393
  data: d,
403
394
  width: this.DATA_TEXTURE_WIDTH,
404
395
  height: rowCount
405
396
  };
406
- } // style datatexture mapping
397
+ }
407
398
 
399
+ // style datatexture mapping
408
400
  }, {
409
401
  key: "getBlend",
410
402
  value: function getBlend() {
411
403
  var _this$layer$getLayerC = this.layer.getLayerConfig(),
412
- _this$layer$getLayerC2 = _this$layer$getLayerC.blend,
413
- blend = _this$layer$getLayerC2 === void 0 ? 'normal' : _this$layer$getLayerC2;
414
-
404
+ _this$layer$getLayerC2 = _this$layer$getLayerC.blend,
405
+ blend = _this$layer$getLayerC2 === void 0 ? 'normal' : _this$layer$getLayerC2;
415
406
  return BlendTypes[BlendType[blend]];
416
407
  }
417
408
  }, {
418
409
  key: "getStencil",
419
410
  value: function getStencil(option) {
420
411
  var _this$layer$getLayerC3 = this.layer.getLayerConfig(),
421
- _this$layer$getLayerC4 = _this$layer$getLayerC3.mask,
422
- mask = _this$layer$getLayerC4 === void 0 ? false : _this$layer$getLayerC4,
423
- _this$layer$getLayerC5 = _this$layer$getLayerC3.maskInside,
424
- maskInside = _this$layer$getLayerC5 === void 0 ? true : _this$layer$getLayerC5,
425
- enableMask = _this$layer$getLayerC3.enableMask,
426
- _this$layer$getLayerC6 = _this$layer$getLayerC3.maskOperation,
427
- maskOperation = _this$layer$getLayerC6 === void 0 ? MaskOperation.AND : _this$layer$getLayerC6; // TODO 临时处理,后期移除MaskLayer
428
-
429
-
412
+ _this$layer$getLayerC4 = _this$layer$getLayerC3.mask,
413
+ mask = _this$layer$getLayerC4 === void 0 ? false : _this$layer$getLayerC4,
414
+ _this$layer$getLayerC5 = _this$layer$getLayerC3.maskInside,
415
+ maskInside = _this$layer$getLayerC5 === void 0 ? true : _this$layer$getLayerC5,
416
+ enableMask = _this$layer$getLayerC3.enableMask,
417
+ _this$layer$getLayerC6 = _this$layer$getLayerC3.maskOperation,
418
+ maskOperation = _this$layer$getLayerC6 === void 0 ? MaskOperation.AND : _this$layer$getLayerC6;
419
+ // TODO 临时处理,后期移除MaskLayer
430
420
  if (this.layer.type === 'MaskLayer') {
431
421
  return getStencilMask({
432
422
  isStencil: true,
@@ -440,11 +430,12 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
440
430
  })); // 用于遮罩的stencil 参数
441
431
  }
442
432
 
443
- var maskflag = mask || // mask 兼容历史写法
444
- enableMask && this.layer.masks.length !== 0 || // 外部图层的mask
433
+ var maskflag = mask ||
434
+ // mask 兼容历史写法
435
+ enableMask && this.layer.masks.length !== 0 ||
436
+ // 外部图层的mask
445
437
  this.layer.tileMask !== undefined; // 瓦片图层
446
438
  // !!(mask || enableMask || this.layer.tileMask);
447
-
448
439
  return _getStencil(maskflag, maskInside);
449
440
  }
450
441
  }, {
@@ -467,76 +458,58 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
467
458
  value: function () {
468
459
  var _needUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
469
460
  return _regeneratorRuntime.wrap(function _callee$(_context) {
470
- while (1) {
471
- switch (_context.prev = _context.next) {
472
- case 0:
473
- return _context.abrupt("return", false);
474
-
475
- case 1:
476
- case "end":
477
- return _context.stop();
478
- }
461
+ while (1) switch (_context.prev = _context.next) {
462
+ case 0:
463
+ return _context.abrupt("return", false);
464
+ case 1:
465
+ case "end":
466
+ return _context.stop();
479
467
  }
480
468
  }, _callee);
481
469
  }));
482
-
483
470
  function needUpdate() {
484
471
  return _needUpdate.apply(this, arguments);
485
472
  }
486
-
487
473
  return needUpdate;
488
474
  }() // eslint-disable-next-line @typescript-eslint/no-unused-vars
489
-
490
475
  }, {
491
476
  key: "buildModels",
492
477
  value: function () {
493
478
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
494
479
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
495
- while (1) {
496
- switch (_context2.prev = _context2.next) {
497
- case 0:
498
- throw new Error('Method not implemented.');
499
-
500
- case 1:
501
- case "end":
502
- return _context2.stop();
503
- }
480
+ while (1) switch (_context2.prev = _context2.next) {
481
+ case 0:
482
+ throw new Error('Method not implemented.');
483
+ case 1:
484
+ case "end":
485
+ return _context2.stop();
504
486
  }
505
487
  }, _callee2);
506
488
  }));
507
-
508
489
  function buildModels() {
509
490
  return _buildModels.apply(this, arguments);
510
491
  }
511
-
512
492
  return buildModels;
513
493
  }() // eslint-disable-next-line @typescript-eslint/no-unused-vars
514
-
515
494
  }, {
516
495
  key: "initModels",
517
496
  value: function () {
518
497
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
519
498
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
520
- while (1) {
521
- switch (_context3.prev = _context3.next) {
522
- case 0:
523
- throw new Error('Method not implemented.');
524
-
525
- case 1:
526
- case "end":
527
- return _context3.stop();
528
- }
499
+ while (1) switch (_context3.prev = _context3.next) {
500
+ case 0:
501
+ throw new Error('Method not implemented.');
502
+ case 1:
503
+ case "end":
504
+ return _context3.stop();
529
505
  }
530
506
  }, _callee3);
531
507
  }));
532
-
533
508
  function initModels() {
534
509
  return _initModels.apply(this, arguments);
535
510
  }
536
-
537
511
  return initModels;
538
512
  }() // eslint-disable-next-line @typescript-eslint/no-unused-vars
539
-
540
513
  }, {
541
514
  key: "clearModels",
542
515
  value: function clearModels() {
@@ -547,8 +520,8 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
547
520
  key: "getAttribute",
548
521
  value: function getAttribute() {
549
522
  throw new Error('Method not implemented.');
550
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
551
-
523
+ }
524
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
552
525
  }, {
553
526
  key: "render",
554
527
  value: function render(renderOptions) {
@@ -568,14 +541,12 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
568
541
  key: "startModelAnimate",
569
542
  value: function startModelAnimate() {
570
543
  var _ref = this.layer.getLayerConfig(),
571
- animateOption = _ref.animateOption;
572
-
544
+ animateOption = _ref.animateOption;
573
545
  if (animateOption.enable) {
574
546
  this.layer.setAnimateStartTime();
575
547
  }
576
548
  }
577
549
  }]);
578
-
579
550
  return BaseModel;
580
551
  }(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "configService", [_dec], {
581
552
  configurable: true,
@@ -4,25 +4,21 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
5
  import { TYPES } from '@antv/l7-core';
6
6
  import { lngLatInExtent } from '@antv/l7-utils';
7
-
8
7
  var BaseLayerPickService = /*#__PURE__*/function () {
9
8
  function BaseLayerPickService(layer) {
10
9
  _classCallCheck(this, BaseLayerPickService);
11
-
12
10
  this.layer = layer;
13
11
  }
14
-
15
12
  _createClass(BaseLayerPickService, [{
16
13
  key: "pickRender",
17
14
  value: function pickRender(target) {
18
15
  var container = this.layer.getContainer();
19
16
  var layerService = container.get(TYPES.ILayerService);
20
- var layer = this.layer; // 瓦片图层的拾取绘制
21
-
17
+ var layer = this.layer;
18
+ // 瓦片图层的拾取绘制
22
19
  if (layer.tileLayer) {
23
20
  return layer.tileLayer.pickRender(target);
24
21
  }
25
-
26
22
  layer.hooks.beforePickingEncode.call();
27
23
  layerService.renderTileLayerMask(layer);
28
24
  layer.renderModels({
@@ -35,11 +31,9 @@ var BaseLayerPickService = /*#__PURE__*/function () {
35
31
  value: function pick(layer, target) {
36
32
  var container = this.layer.getContainer();
37
33
  var pickingService = container.get(TYPES.IPickingService);
38
-
39
34
  if (layer.type === 'RasterLayer') {
40
35
  return this.pickRasterLayer(layer, target);
41
36
  }
42
-
43
37
  this.pickRender(target);
44
38
  return pickingService.pickFromPickingFBO(layer, target);
45
39
  }
@@ -60,7 +54,6 @@ var BaseLayerPickService = /*#__PURE__*/function () {
60
54
  rasterValue: null
61
55
  };
62
56
  var adviceTarget = parent ? parent : layer;
63
-
64
57
  if (isPick) {
65
58
  var rasterValue = this.readRasterValue(layer, extent, mapService, target.x, target.y);
66
59
  layerTarget.rasterValue = rasterValue;
@@ -79,24 +72,24 @@ var BaseLayerPickService = /*#__PURE__*/function () {
79
72
  key: "readRasterValue",
80
73
  value: function readRasterValue(layer, bbox, mapService, x, y) {
81
74
  var rasterData = layer.getSource().data.dataArray[0];
82
-
83
75
  var _bbox = _slicedToArray(bbox, 4),
84
- _bbox$ = _bbox[0],
85
- minLng = _bbox$ === void 0 ? 0 : _bbox$,
86
- _bbox$2 = _bbox[1],
87
- minLat = _bbox$2 === void 0 ? 0 : _bbox$2,
88
- _bbox$3 = _bbox[2],
89
- maxLng = _bbox$3 === void 0 ? 10 : _bbox$3,
90
- _bbox$4 = _bbox[3],
91
- maxLat = _bbox$4 === void 0 ? -10 : _bbox$4;
92
-
76
+ _bbox$ = _bbox[0],
77
+ minLng = _bbox$ === void 0 ? 0 : _bbox$,
78
+ _bbox$2 = _bbox[1],
79
+ minLat = _bbox$2 === void 0 ? 0 : _bbox$2,
80
+ _bbox$3 = _bbox[2],
81
+ maxLng = _bbox$3 === void 0 ? 10 : _bbox$3,
82
+ _bbox$4 = _bbox[3],
83
+ maxLat = _bbox$4 === void 0 ? -10 : _bbox$4;
93
84
  var tileXY = mapService.lngLatToContainer([minLng, minLat]);
94
85
  var tileMaxXY = mapService.lngLatToContainer([maxLng, maxLat]);
95
86
  var tilePixelWidth = tileMaxXY.x - tileXY.x;
96
87
  var tilePixelHeight = tileXY.y - tileMaxXY.y;
97
- var pos = [(x - tileXY.x) / tilePixelWidth, // x
88
+ var pos = [(x - tileXY.x) / tilePixelWidth,
89
+ // x
98
90
  (y - tileMaxXY.y) / tilePixelHeight // y
99
91
  ];
92
+
100
93
  var tileWidth = rasterData.width || 1;
101
94
  var tileHeight = rasterData.height || 1;
102
95
  var indexX = Math.floor(pos[0] * tileWidth);
@@ -108,13 +101,12 @@ var BaseLayerPickService = /*#__PURE__*/function () {
108
101
  }, {
109
102
  key: "selectFeature",
110
103
  value: function selectFeature(pickedColors) {
111
- var layer = this.layer; // @ts-ignore
112
-
104
+ var layer = this.layer;
105
+ // @ts-ignore
113
106
  var _pickedColors = _slicedToArray(pickedColors, 3),
114
- r = _pickedColors[0],
115
- g = _pickedColors[1],
116
- b = _pickedColors[2];
117
-
107
+ r = _pickedColors[0],
108
+ g = _pickedColors[1],
109
+ b = _pickedColors[2];
118
110
  layer.hooks.beforeSelect.call([r, g, b]);
119
111
  }
120
112
  }, {
@@ -122,10 +114,9 @@ var BaseLayerPickService = /*#__PURE__*/function () {
122
114
  value: function highlightPickedFeature(pickedColors) {
123
115
  // @ts-ignore
124
116
  var _pickedColors2 = _slicedToArray(pickedColors, 3),
125
- r = _pickedColors2[0],
126
- g = _pickedColors2[1],
127
- b = _pickedColors2[2];
128
-
117
+ r = _pickedColors2[0],
118
+ g = _pickedColors2[1],
119
+ b = _pickedColors2[2];
129
120
  this.layer.hooks.beforeHighlight.call([r, g, b]);
130
121
  }
131
122
  }, {
@@ -134,8 +125,6 @@ var BaseLayerPickService = /*#__PURE__*/function () {
134
125
  return this.layer.getSource().getFeatureById(pickedFeatureIdx);
135
126
  }
136
127
  }]);
137
-
138
128
  return BaseLayerPickService;
139
129
  }();
140
-
141
130
  export { BaseLayerPickService as default };