@antv/l7-layers 2.15.5 → 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 (243) 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 +486 -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.d.ts +2 -1
  69. package/es/point/models/text.js +305 -201
  70. package/es/point/shape/extrude.js +13 -4
  71. package/es/polygon/index.js +40 -11
  72. package/es/polygon/models/extrude.js +92 -48
  73. package/es/polygon/models/fill.js +88 -54
  74. package/es/polygon/models/index.js +2 -3
  75. package/es/polygon/models/ocean.js +76 -42
  76. package/es/polygon/models/water.js +71 -37
  77. package/es/raster/buffers/triangulation.js +4 -2
  78. package/es/raster/index.js +32 -9
  79. package/es/raster/models/raster.js +116 -80
  80. package/es/raster/models/rasterRgb.js +127 -84
  81. package/es/raster/models/rasterTerrainRgb.js +84 -56
  82. package/es/tile/interaction/getRasterData.js +20 -14
  83. package/es/tile/interaction/utils.js +9 -7
  84. package/es/tile/manager/base.js +96 -63
  85. package/es/tile/service/TileLayerService.js +55 -33
  86. package/es/tile/service/TilePickService.js +40 -26
  87. package/es/tile/service/TileSourceService.js +7 -3
  88. package/es/tile/tileFactory/DebugTile.js +46 -29
  89. package/es/tile/tileFactory/ImageTile.js +38 -20
  90. package/es/tile/tileFactory/MaskTile.js +43 -22
  91. package/es/tile/tileFactory/RasterRGBTile.js +42 -22
  92. package/es/tile/tileFactory/RasterTerrainRGBTile.js +38 -20
  93. package/es/tile/tileFactory/RasterTile.js +53 -30
  94. package/es/tile/tileFactory/Tile.js +97 -63
  95. package/es/tile/tileFactory/VectorTile.js +68 -41
  96. package/es/tile/tileFactory/index.js +11 -0
  97. package/es/tile/tileFactory/layers/TileDebugLayer.js +27 -6
  98. package/es/tile/tileFactory/util.js +3 -0
  99. package/es/tile/tileLayer/BaseLayer.js +146 -105
  100. package/es/tile/utils.js +1 -1
  101. package/es/utils/blend.js +2 -0
  102. package/es/utils/collision-index.js +16 -9
  103. package/es/utils/dataMappingStyle.js +18 -8
  104. package/es/utils/extrude_polyline.js +149 -101
  105. package/es/utils/grid-index.js +27 -2
  106. package/es/utils/identityScale.js +8 -0
  107. package/es/utils/layerData.js +44 -30
  108. package/es/utils/multiPassRender.js +13 -11
  109. package/es/utils/polylineNormal.js +37 -31
  110. package/es/utils/simpleLine.js +16 -2
  111. package/es/utils/stencil.js +3 -2
  112. package/es/utils/symbol-layout.js +53 -27
  113. package/es/wind/index.js +29 -9
  114. package/es/wind/models/utils.js +51 -26
  115. package/es/wind/models/wind.js +147 -101
  116. package/es/wind/models/windRender.js +66 -53
  117. package/lib/Geometry/index.js +38 -9
  118. package/lib/Geometry/models/billboard.js +97 -51
  119. package/lib/Geometry/models/index.js +5 -0
  120. package/lib/Geometry/models/plane.js +151 -79
  121. package/lib/Geometry/models/sprite.js +127 -60
  122. package/lib/canvas/index.js +40 -10
  123. package/lib/canvas/models/canvas.js +101 -41
  124. package/lib/canvas/models/index.js +3 -0
  125. package/lib/citybuliding/building.js +35 -8
  126. package/lib/citybuliding/models/build.js +92 -57
  127. package/lib/core/BaseLayer.js +480 -321
  128. package/lib/core/BaseModel.js +139 -97
  129. package/lib/core/LayerPickService.js +37 -21
  130. package/lib/core/TextureService.js +16 -0
  131. package/lib/core/interface.js +31 -21
  132. package/lib/core/schema.js +1 -0
  133. package/lib/core/shape/Path.js +31 -14
  134. package/lib/core/shape/extrude.js +54 -10
  135. package/lib/core/triangulation.js +153 -53
  136. package/lib/earth/index.js +43 -9
  137. package/lib/earth/models/atmosphere.js +63 -30
  138. package/lib/earth/models/base.js +90 -47
  139. package/lib/earth/models/bloomsphere.js +63 -30
  140. package/lib/earth/utils.js +31 -7
  141. package/lib/heatmap/index.js +48 -10
  142. package/lib/heatmap/models/grid.js +60 -28
  143. package/lib/heatmap/models/grid3d.js +60 -28
  144. package/lib/heatmap/models/heatmap.js +162 -91
  145. package/lib/heatmap/models/hexagon.js +60 -28
  146. package/lib/heatmap/models/index.js +6 -0
  147. package/lib/heatmap/triangulation.js +5 -0
  148. package/lib/image/index.js +36 -9
  149. package/lib/image/models/image.js +109 -66
  150. package/lib/image/models/index.js +3 -0
  151. package/lib/index.js +61 -7
  152. package/lib/line/index.js +40 -9
  153. package/lib/line/models/arc.js +128 -64
  154. package/lib/line/models/arc_3d.js +119 -58
  155. package/lib/line/models/earthArc_3d.js +122 -61
  156. package/lib/line/models/great_circle.js +111 -56
  157. package/lib/line/models/half.js +87 -46
  158. package/lib/line/models/index.js +11 -0
  159. package/lib/line/models/line.js +156 -92
  160. package/lib/line/models/linearline.js +92 -45
  161. package/lib/line/models/simpleLine.js +84 -41
  162. package/lib/line/models/wall.js +103 -52
  163. package/lib/mask/index.js +36 -9
  164. package/lib/mask/models/fill.js +63 -29
  165. package/lib/mask/models/index.js +3 -0
  166. package/lib/plugins/DataMappingPlugin.js +128 -80
  167. package/lib/plugins/DataSourcePlugin.js +76 -45
  168. package/lib/plugins/FeatureScalePlugin.js +138 -67
  169. package/lib/plugins/LayerAnimateStylePlugin.js +10 -0
  170. package/lib/plugins/LayerMaskPlugin.js +17 -4
  171. package/lib/plugins/LayerModelPlugin.js +113 -68
  172. package/lib/plugins/LayerStylePlugin.js +14 -4
  173. package/lib/plugins/LightingPlugin.js +25 -12
  174. package/lib/plugins/MultiPassRendererPlugin.js +22 -11
  175. package/lib/plugins/PixelPickingPlugin.js +27 -12
  176. package/lib/plugins/RegisterStyleAttributePlugin.js +19 -5
  177. package/lib/plugins/ShaderUniformPlugin.js +34 -13
  178. package/lib/plugins/UpdateModelPlugin.js +10 -1
  179. package/lib/plugins/UpdateStyleAttributePlugin.js +16 -5
  180. package/lib/point/index.js +83 -26
  181. package/lib/point/models/earthExtrude.js +113 -61
  182. package/lib/point/models/earthFill.js +117 -57
  183. package/lib/point/models/extrude.js +111 -60
  184. package/lib/point/models/fill.js +109 -68
  185. package/lib/point/models/fillmage.js +115 -61
  186. package/lib/point/models/image.js +98 -48
  187. package/lib/point/models/index.js +12 -1
  188. package/lib/point/models/normal.js +64 -30
  189. package/lib/point/models/radar.js +74 -40
  190. package/lib/point/models/simplePoint.js +79 -41
  191. package/lib/point/models/text.js +314 -202
  192. package/lib/point/shape/extrude.js +20 -4
  193. package/lib/polygon/index.js +48 -11
  194. package/lib/polygon/models/extrude.js +103 -48
  195. package/lib/polygon/models/fill.js +98 -54
  196. package/lib/polygon/models/index.js +14 -2
  197. package/lib/polygon/models/ocean.js +88 -42
  198. package/lib/polygon/models/water.js +82 -37
  199. package/lib/raster/buffers/triangulation.js +7 -3
  200. package/lib/raster/index.js +40 -9
  201. package/lib/raster/models/index.js +5 -0
  202. package/lib/raster/models/raster.js +125 -80
  203. package/lib/raster/models/rasterRgb.js +139 -84
  204. package/lib/raster/models/rasterTerrainRgb.js +93 -56
  205. package/lib/tile/interaction/getRasterData.js +25 -14
  206. package/lib/tile/interaction/utils.js +19 -7
  207. package/lib/tile/manager/base.js +104 -63
  208. package/lib/tile/service/TileLayerService.js +60 -33
  209. package/lib/tile/service/TilePickService.js +48 -26
  210. package/lib/tile/service/TileSourceService.js +16 -2
  211. package/lib/tile/style/utils.js +3 -0
  212. package/lib/tile/tileFactory/DebugTile.js +54 -29
  213. package/lib/tile/tileFactory/ImageTile.js +46 -20
  214. package/lib/tile/tileFactory/MaskTile.js +51 -22
  215. package/lib/tile/tileFactory/RasterRGBTile.js +50 -22
  216. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +46 -20
  217. package/lib/tile/tileFactory/RasterTile.js +63 -30
  218. package/lib/tile/tileFactory/Tile.js +102 -63
  219. package/lib/tile/tileFactory/VectorTile.js +76 -41
  220. package/lib/tile/tileFactory/index.js +25 -0
  221. package/lib/tile/tileFactory/layers/TileDebugLayer.js +32 -6
  222. package/lib/tile/tileFactory/util.js +9 -0
  223. package/lib/tile/tileLayer/BaseLayer.js +153 -105
  224. package/lib/tile/utils.js +5 -1
  225. package/lib/utils/blend.js +5 -0
  226. package/lib/utils/collision-index.js +25 -9
  227. package/lib/utils/dataMappingStyle.js +19 -8
  228. package/lib/utils/extrude_polyline.js +181 -101
  229. package/lib/utils/grid-index.js +28 -2
  230. package/lib/utils/identityScale.js +9 -0
  231. package/lib/utils/layerData.js +49 -30
  232. package/lib/utils/multiPassRender.js +16 -11
  233. package/lib/utils/polylineNormal.js +66 -31
  234. package/lib/utils/simpleLine.js +21 -2
  235. package/lib/utils/stencil.js +4 -0
  236. package/lib/utils/symbol-layout.js +55 -27
  237. package/lib/wind/index.js +37 -9
  238. package/lib/wind/models/index.js +3 -0
  239. package/lib/wind/models/utils.js +62 -26
  240. package/lib/wind/models/wind.js +157 -101
  241. package/lib/wind/models/windRender.js +71 -53
  242. package/lib/wind/models/windShader.js +1 -0
  243. package/package.json +7 -7
@@ -1,43 +1,61 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
9
+
8
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
9
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
10
14
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
15
+
11
16
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
17
+
12
18
  var _initializerDefineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerDefineProperty"));
19
+
13
20
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
21
+
14
22
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
23
+
15
24
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
+
16
26
  var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
27
+
17
28
  var _initializerWarningHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerWarningHelper"));
29
+
18
30
  var _l7Core = require("@antv/l7-core");
31
+
19
32
  var _l7Utils = require("@antv/l7-utils");
33
+
20
34
  var _d3Color = require("d3-color");
35
+
21
36
  var _lodash = require("lodash");
37
+
22
38
  var _blend = require("../utils/blend");
39
+
23
40
  var _stencil = require("../utils/stencil");
41
+
24
42
  var _dec, _class, _descriptor;
43
+
25
44
  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; } } }; }
45
+
26
46
  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); }
27
- 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; }
47
+
48
+ 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; }
49
+
28
50
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
29
51
  var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
30
52
  // style texture data mapping
31
-
32
53
  // 用于数据传递的数据纹理
33
54
  // 默认有多少列(宽度)
34
55
  // 计算得到的当前数据纹理有多少行(高度)
35
-
36
56
  // 单个 cell 的长度
37
57
  // 需要进行数据映射的属性集合
38
-
39
58
  // style texture data mapping
40
-
41
59
  function BaseModel(layer) {
42
60
  (0, _classCallCheck2.default)(this, BaseModel);
43
61
  (0, _initializerDefineProperty2.default)(this, "configService", _descriptor, this);
@@ -50,15 +68,15 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
50
68
  this.iconService = layer.getContainer().get(_l7Core.TYPES.IIconService);
51
69
  this.fontService = layer.getContainer().get(_l7Core.TYPES.IFontService);
52
70
  this.cameraService = layer.getContainer().get(_l7Core.TYPES.ICameraService);
53
- this.layerService = layer.getContainer().get(_l7Core.TYPES.ILayerService);
71
+ this.layerService = layer.getContainer().get(_l7Core.TYPES.ILayerService); // 注册 Attribute
72
+
73
+ this.registerBuiltinAttributes(); // 开启动画
54
74
 
55
- // 注册 Attribute
56
- this.registerBuiltinAttributes();
57
- // 开启动画
58
75
  this.startModelAnimate();
59
76
  var createTexture2D = this.rendererService.createTexture2D;
60
77
  this.createTexture2D = createTexture2D;
61
78
  this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度
79
+
62
80
  this.rowCount = 1;
63
81
  this.cellLength = 0;
64
82
  this.cellProperties = [];
@@ -78,8 +96,8 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
78
96
  hasStroke: 0,
79
97
  hasOffsets: 0
80
98
  };
81
- this.dataTextureTest = this.layerService.getOESTextureFloat();
82
- // 只有在不支持数据纹理的情况下进行赋值
99
+ this.dataTextureTest = this.layerService.getOESTextureFloat(); // 只有在不支持数据纹理的情况下进行赋值
100
+
83
101
  if (!this.dataTextureTest) {
84
102
  this.dataTexture = this.createTexture2D({
85
103
  // data: new Uint8ClampedArray(4),
@@ -92,18 +110,20 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
92
110
  height: 1
93
111
  });
94
112
  }
95
- }
96
-
97
- // style datatexture mapping
113
+ } // style datatexture mapping
98
114
 
99
115
  /**
100
116
  * 清除上一次的计算结果 - 全量清除
101
117
  */
118
+
119
+
102
120
  (0, _createClass2.default)(BaseModel, [{
103
121
  key: "clearLastCalRes",
104
122
  value: function clearLastCalRes() {
105
123
  this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合
124
+
106
125
  this.cellLength = 0; // 清空上一次计算的 cell 的长度
126
+
107
127
  this.stylePropertiesExist = {
108
128
  // 全量清空上一次是否需要对 style 属性进行数据映射的判断
109
129
  hasThetaOffset: 0,
@@ -118,91 +138,82 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
118
138
  key: "getCellTypeLayout",
119
139
  value: function getCellTypeLayout() {
120
140
  if (this.dataTextureTest) {
121
- return [
122
- // 0
123
- this.rowCount,
124
- // 数据纹理有几行
125
- this.DATA_TEXTURE_WIDTH,
126
- // 数据纹理有几列
127
- 0.0, 0.0,
128
- // 1
129
- this.stylePropertiesExist.hasOpacity,
130
- // cell 中是否存在 opacity
131
- this.stylePropertiesExist.hasStrokeOpacity,
132
- // cell 中是否存在 strokeOpacity
133
- this.stylePropertiesExist.hasStrokeWidth,
134
- // cell 中是否存在 strokeWidth
135
- this.stylePropertiesExist.hasStroke,
136
- // cell 中是否存在 stroke
141
+ return [// 0
142
+ this.rowCount, // 数据纹理有几行
143
+ this.DATA_TEXTURE_WIDTH, // 数据纹理有几列
144
+ 0.0, 0.0, // 1
145
+ this.stylePropertiesExist.hasOpacity, // cell 中是否存在 opacity
146
+ this.stylePropertiesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity
147
+ this.stylePropertiesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth
148
+ this.stylePropertiesExist.hasStroke, // cell 中是否存在 stroke
137
149
  // 2
138
- this.stylePropertiesExist.hasOffsets,
139
- // cell 中是否存在 offsets
140
- this.stylePropertiesExist.hasThetaOffset,
141
- // cell 中是否存在 thetaOffset
142
- 0.0, 0.0,
143
- // 3
150
+ this.stylePropertiesExist.hasOffsets, // cell 中是否存在 offsets
151
+ this.stylePropertiesExist.hasThetaOffset, // cell 中是否存在 thetaOffset
152
+ 0.0, 0.0, // 3
144
153
  0.0, 0.0, 0.0, 1.0];
145
154
  } else {
146
- return [1.0,
147
- // 数据纹理有几行
148
- 1.0,
149
- // 数据纹理有几列
150
- 0.0, 0.0, 0.0,
151
- // cell 中是否存在 opacity
152
- 0.0,
153
- // cell 中是否存在 strokeOpacity
154
- 0.0,
155
- // cell 中是否存在 strokeWidth
156
- 0.0,
157
- // cell 中是否存在 stroke
158
- 0.0,
159
- // cell 中是否存在 offsets
155
+ return [1.0, // 数据纹理有几行
156
+ 1.0, // 数据纹理有几列
157
+ 0.0, 0.0, 0.0, // cell 中是否存在 opacity
158
+ 0.0, // cell 中是否存在 strokeOpacity
159
+ 0.0, // cell 中是否存在 strokeWidth
160
+ 0.0, // cell 中是否存在 stroke
161
+ 0.0, // cell 中是否存在 offsets
160
162
  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0];
161
163
  }
162
164
  }
163
-
164
165
  /**
165
166
  * 判断数据纹理是否需要重新计算 - 根据传入的值进行判断
166
167
  * @param options
167
168
  * @returns
168
169
  */
170
+
169
171
  }, {
170
172
  key: "dataTextureNeedUpdate",
171
173
  value: function dataTextureNeedUpdate(options) {
172
174
  var isUpdate = false;
175
+
173
176
  if (!(0, _lodash.isEqual)(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {
174
177
  isUpdate = true;
175
178
  this.cacheStyleProperties.thetaOffset = options.thetaOffset;
176
179
  }
180
+
177
181
  if (!(0, _lodash.isEqual)(options.opacity, this.cacheStyleProperties.opacity)) {
178
182
  isUpdate = true;
179
183
  this.cacheStyleProperties.opacity = options.opacity;
180
184
  }
185
+
181
186
  if (!(0, _lodash.isEqual)(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)) {
182
187
  isUpdate = true;
183
188
  this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;
184
189
  }
190
+
185
191
  if (!(0, _lodash.isEqual)(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {
186
192
  isUpdate = true;
187
193
  this.cacheStyleProperties.strokeWidth = options.strokeWidth;
188
194
  }
195
+
189
196
  if (!(0, _lodash.isEqual)(options.stroke, this.cacheStyleProperties.stroke)) {
190
197
  isUpdate = true;
191
198
  this.cacheStyleProperties.stroke = options.stroke;
192
199
  }
200
+
193
201
  if (!(0, _lodash.isEqual)(options.offsets, this.cacheStyleProperties.offsets)) {
194
202
  isUpdate = true;
195
203
  this.cacheStyleProperties.offsets = options.offsets;
196
204
  }
205
+
197
206
  if (this.dataTexture === undefined) {
198
207
  isUpdate = true;
199
208
  }
209
+
200
210
  return isUpdate;
201
211
  }
202
212
  /**
203
213
  * 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
204
214
  * @param options
205
215
  */
216
+
206
217
  }, {
207
218
  key: "judgeStyleAttributes",
208
219
  value: function judgeStyleAttributes(options) {
@@ -217,6 +228,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
217
228
  this.stylePropertiesExist.hasOpacity = 1;
218
229
  this.cellLength += 1;
219
230
  }
231
+
220
232
  if (options.strokeOpacity !== undefined && !(0, _lodash.isNumber)(options.strokeOpacity)) {
221
233
  // 数据映射
222
234
  this.cellProperties.push({
@@ -226,6 +238,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
226
238
  this.stylePropertiesExist.hasStrokeOpacity = 1;
227
239
  this.cellLength += 1;
228
240
  }
241
+
229
242
  if (options.strokeWidth !== undefined && !(0, _lodash.isNumber)(options.strokeWidth)) {
230
243
  // 数据映射
231
244
  this.cellProperties.push({
@@ -235,6 +248,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
235
248
  this.stylePropertiesExist.hasStrokeWidth = 1;
236
249
  this.cellLength += 1;
237
250
  }
251
+
238
252
  if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {
239
253
  // 数据映射
240
254
  this.cellProperties.push({
@@ -244,6 +258,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
244
258
  this.stylePropertiesExist.hasStroke = 1;
245
259
  this.cellLength += 4;
246
260
  }
261
+
247
262
  if (options.offsets !== undefined && !this.isOffsetStatic(options.offsets)) {
248
263
  // 数据映射
249
264
  this.cellProperties.push({
@@ -253,6 +268,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
253
268
  this.stylePropertiesExist.hasOffsets = 1;
254
269
  this.cellLength += 2;
255
270
  }
271
+
256
272
  if (options.thetaOffset !== undefined && !(0, _lodash.isNumber)(options.thetaOffset)) {
257
273
  // 数据映射
258
274
  this.cellProperties.push({
@@ -263,12 +279,12 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
263
279
  this.cellLength += 1;
264
280
  }
265
281
  }
266
-
267
282
  /**
268
283
  * 判断变量 stroke 是否是常量值
269
284
  * @param stroke
270
285
  * @returns
271
286
  */
287
+
272
288
  }, {
273
289
  key: "isStaticColor",
274
290
  value: function isStaticColor(stroke) {
@@ -279,6 +295,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
279
295
  return false;
280
296
  }
281
297
  }
298
+
282
299
  return false;
283
300
  }
284
301
  /**
@@ -286,6 +303,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
286
303
  * @param stroke
287
304
  * @returns
288
305
  */
306
+
289
307
  }, {
290
308
  key: "getStrokeColor",
291
309
  value: function getStrokeColor(stroke) {
@@ -300,12 +318,12 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
300
318
  return [0, 0, 0, 0];
301
319
  }
302
320
  }
303
-
304
321
  /**
305
322
  * 判断 offsets 是否是常量
306
323
  * @param offsets
307
324
  * @returns
308
325
  */
326
+
309
327
  }, {
310
328
  key: "isOffsetStatic",
311
329
  value: function isOffsetStatic(offsets) {
@@ -315,12 +333,12 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
315
333
  return false;
316
334
  }
317
335
  }
318
-
319
336
  /**
320
337
  * 补空位
321
338
  * @param d
322
339
  * @param count
323
340
  */
341
+
324
342
  }, {
325
343
  key: "patchMod",
326
344
  value: function patchMod(d, count) {
@@ -328,24 +346,26 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
328
346
  d.push(-1);
329
347
  }
330
348
  }
331
-
332
349
  /**
333
350
  * 根据映射的数据字段往推入数据
334
351
  * @param d
335
352
  * @param cellData
336
353
  * @param cellPropertiesLayouts
337
354
  */
355
+
338
356
  }, {
339
357
  key: "patchData",
340
358
  value: function patchData(d, cellData, cellPropertiesLayouts) {
341
359
  var _iterator = _createForOfIteratorHelper(cellPropertiesLayouts),
342
- _step;
360
+ _step;
361
+
343
362
  try {
344
363
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
345
364
  var layout = _step.value;
346
365
  var attr = layout.attr,
347
- count = layout.count;
366
+ count = layout.count;
348
367
  var value = cellData[attr];
368
+
349
369
  if (value !== undefined) {
350
370
  // 数据中存在该属性
351
371
  if (attr === 'stroke') {
@@ -370,7 +390,6 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
370
390
  _iterator.f();
371
391
  }
372
392
  }
373
-
374
393
  /**
375
394
  * 计算推入数据纹理的数据
376
395
  * @param cellLength
@@ -378,6 +397,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
378
397
  * @param cellPropertiesLayouts
379
398
  * @returns
380
399
  */
400
+
381
401
  }, {
382
402
  key: "calDataFrame",
383
403
  value: function calDataFrame(cellLength, encodeData, cellPropertiesLayouts) {
@@ -386,44 +406,48 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
386
406
 
387
407
  var totalLength = rowCount * this.DATA_TEXTURE_WIDTH;
388
408
  var d = [];
409
+
389
410
  for (var i = 0; i < encodeDatalength; i++) {
390
411
  // 根据 encodeData 数据推入数据
391
412
  var cellData = encodeData[i];
392
413
  this.patchData(d, cellData, cellPropertiesLayouts);
393
414
  }
415
+
394
416
  for (var _i = d.length; _i < totalLength; _i++) {
395
417
  // 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)
396
418
  d.push(-1);
397
- }
398
- // console.log('data', d)
419
+ } // console.log('data', d)
420
+
421
+
399
422
  return {
400
423
  data: d,
401
424
  width: this.DATA_TEXTURE_WIDTH,
402
425
  height: rowCount
403
426
  };
404
- }
427
+ } // style datatexture mapping
405
428
 
406
- // style datatexture mapping
407
429
  }, {
408
430
  key: "getBlend",
409
431
  value: function getBlend() {
410
432
  var _this$layer$getLayerC = this.layer.getLayerConfig(),
411
- _this$layer$getLayerC2 = _this$layer$getLayerC.blend,
412
- blend = _this$layer$getLayerC2 === void 0 ? 'normal' : _this$layer$getLayerC2;
433
+ _this$layer$getLayerC2 = _this$layer$getLayerC.blend,
434
+ blend = _this$layer$getLayerC2 === void 0 ? 'normal' : _this$layer$getLayerC2;
435
+
413
436
  return _blend.BlendTypes[_l7Core.BlendType[blend]];
414
437
  }
415
438
  }, {
416
439
  key: "getStencil",
417
440
  value: function getStencil(option) {
418
441
  var _this$layer$getLayerC3 = this.layer.getLayerConfig(),
419
- _this$layer$getLayerC4 = _this$layer$getLayerC3.mask,
420
- mask = _this$layer$getLayerC4 === void 0 ? false : _this$layer$getLayerC4,
421
- _this$layer$getLayerC5 = _this$layer$getLayerC3.maskInside,
422
- maskInside = _this$layer$getLayerC5 === void 0 ? true : _this$layer$getLayerC5,
423
- enableMask = _this$layer$getLayerC3.enableMask,
424
- _this$layer$getLayerC6 = _this$layer$getLayerC3.maskOperation,
425
- maskOperation = _this$layer$getLayerC6 === void 0 ? _l7Core.MaskOperation.AND : _this$layer$getLayerC6;
426
- // TODO 临时处理,后期移除MaskLayer
442
+ _this$layer$getLayerC4 = _this$layer$getLayerC3.mask,
443
+ mask = _this$layer$getLayerC4 === void 0 ? false : _this$layer$getLayerC4,
444
+ _this$layer$getLayerC5 = _this$layer$getLayerC3.maskInside,
445
+ maskInside = _this$layer$getLayerC5 === void 0 ? true : _this$layer$getLayerC5,
446
+ enableMask = _this$layer$getLayerC3.enableMask,
447
+ _this$layer$getLayerC6 = _this$layer$getLayerC3.maskOperation,
448
+ maskOperation = _this$layer$getLayerC6 === void 0 ? _l7Core.MaskOperation.AND : _this$layer$getLayerC6; // TODO 临时处理,后期移除MaskLayer
449
+
450
+
427
451
  if (this.layer.type === 'MaskLayer') {
428
452
  return (0, _stencil.getStencilMask)({
429
453
  isStencil: true,
@@ -437,12 +461,11 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
437
461
  })); // 用于遮罩的stencil 参数
438
462
  }
439
463
 
440
- var maskflag = mask ||
441
- // mask 兼容历史写法
442
- enableMask && this.layer.masks.length !== 0 ||
443
- // 外部图层的mask
464
+ var maskflag = mask || // mask 兼容历史写法
465
+ enableMask && this.layer.masks.length !== 0 || // 外部图层的mask
444
466
  this.layer.tileMask !== undefined; // 瓦片图层
445
467
  // !!(mask || enableMask || this.layer.tileMask);
468
+
446
469
  return (0, _stencil.getStencil)(maskflag, maskInside);
447
470
  }
448
471
  }, {
@@ -465,58 +488,76 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
465
488
  value: function () {
466
489
  var _needUpdate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
467
490
  return _regenerator.default.wrap(function _callee$(_context) {
468
- while (1) switch (_context.prev = _context.next) {
469
- case 0:
470
- return _context.abrupt("return", false);
471
- case 1:
472
- case "end":
473
- return _context.stop();
491
+ while (1) {
492
+ switch (_context.prev = _context.next) {
493
+ case 0:
494
+ return _context.abrupt("return", false);
495
+
496
+ case 1:
497
+ case "end":
498
+ return _context.stop();
499
+ }
474
500
  }
475
501
  }, _callee);
476
502
  }));
503
+
477
504
  function needUpdate() {
478
505
  return _needUpdate.apply(this, arguments);
479
506
  }
507
+
480
508
  return needUpdate;
481
509
  }() // eslint-disable-next-line @typescript-eslint/no-unused-vars
510
+
482
511
  }, {
483
512
  key: "buildModels",
484
513
  value: function () {
485
514
  var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
486
515
  return _regenerator.default.wrap(function _callee2$(_context2) {
487
- while (1) switch (_context2.prev = _context2.next) {
488
- case 0:
489
- throw new Error('Method not implemented.');
490
- case 1:
491
- case "end":
492
- return _context2.stop();
516
+ while (1) {
517
+ switch (_context2.prev = _context2.next) {
518
+ case 0:
519
+ throw new Error('Method not implemented.');
520
+
521
+ case 1:
522
+ case "end":
523
+ return _context2.stop();
524
+ }
493
525
  }
494
526
  }, _callee2);
495
527
  }));
528
+
496
529
  function buildModels() {
497
530
  return _buildModels.apply(this, arguments);
498
531
  }
532
+
499
533
  return buildModels;
500
534
  }() // eslint-disable-next-line @typescript-eslint/no-unused-vars
535
+
501
536
  }, {
502
537
  key: "initModels",
503
538
  value: function () {
504
539
  var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
505
540
  return _regenerator.default.wrap(function _callee3$(_context3) {
506
- while (1) switch (_context3.prev = _context3.next) {
507
- case 0:
508
- throw new Error('Method not implemented.');
509
- case 1:
510
- case "end":
511
- return _context3.stop();
541
+ while (1) {
542
+ switch (_context3.prev = _context3.next) {
543
+ case 0:
544
+ throw new Error('Method not implemented.');
545
+
546
+ case 1:
547
+ case "end":
548
+ return _context3.stop();
549
+ }
512
550
  }
513
551
  }, _callee3);
514
552
  }));
553
+
515
554
  function initModels() {
516
555
  return _initModels.apply(this, arguments);
517
556
  }
557
+
518
558
  return initModels;
519
559
  }() // eslint-disable-next-line @typescript-eslint/no-unused-vars
560
+
520
561
  }, {
521
562
  key: "clearModels",
522
563
  value: function clearModels() {
@@ -527,8 +568,8 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
527
568
  key: "getAttribute",
528
569
  value: function getAttribute() {
529
570
  throw new Error('Method not implemented.');
530
- }
531
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
571
+ } // eslint-disable-next-line @typescript-eslint/no-unused-vars
572
+
532
573
  }, {
533
574
  key: "render",
534
575
  value: function render(renderOptions) {
@@ -548,7 +589,8 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
548
589
  key: "startModelAnimate",
549
590
  value: function startModelAnimate() {
550
591
  var _ref = this.layer.getLayerConfig(),
551
- animateOption = _ref.animateOption;
592
+ animateOption = _ref.animateOption;
593
+
552
594
  if (animateOption.enable) {
553
595
  this.layer.setAnimateStartTime();
554
596
  }