@antv/l7-layers 2.16.0 → 2.16.1

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