@antv/l7-layers 2.9.23 → 2.9.25

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 (166) hide show
  1. package/es/Geometry/models/plane.d.ts +1 -0
  2. package/es/citybuliding/building.js +1 -1
  3. package/es/core/BaseLayer.js +10 -3
  4. package/es/core/interface.d.ts +26 -48
  5. package/es/core/interface.js +3 -0
  6. package/es/core/schema.d.ts +3 -3
  7. package/es/core/triangulation.d.ts +4 -3
  8. package/es/core/triangulation.js +54 -39
  9. package/es/heatmap/models/heatmap.js +1 -1
  10. package/es/image/models/image.js +7 -1
  11. package/es/line/index.js +4 -1
  12. package/es/line/models/arc.js +1 -1
  13. package/es/line/models/simpleLine.js +1 -1
  14. package/es/line/shaders/line_arc_vert.glsl +5 -3
  15. package/es/line/shaders/simple/simpleline_vert.glsl +1 -0
  16. package/es/plugins/FeatureScalePlugin.js +0 -1
  17. package/es/point/index.js +3 -1
  18. package/es/point/models/fill.js +5 -2
  19. package/es/point/models/fillmage.js +9 -3
  20. package/es/point/models/image.js +8 -2
  21. package/es/point/models/radar.js +2 -3
  22. package/es/point/models/tile.js +1 -1
  23. package/es/point/shaders/fill_vert.glsl +13 -6
  24. package/es/point/shaders/image/fillImage_vert.glsl +13 -5
  25. package/es/point/shaders/image_vert.glsl +17 -8
  26. package/es/polygon/index.js +4 -1
  27. package/es/raster/index.js +3 -1
  28. package/es/tile/manager/tileLayerManager.d.ts +3 -2
  29. package/es/tile/manager/tileLayerManager.js +5 -2
  30. package/es/tile/models/tileModel.js +4 -3
  31. package/es/tile/tileFactory/base.d.ts +1 -1
  32. package/es/tile/tileFactory/base.js +32 -5
  33. package/es/tile/tileFactory/vectorLayer.d.ts +3 -1
  34. package/es/tile/tileFactory/vectorLayer.js +22 -1
  35. package/es/tile/tileLayer/baseTileLayer.d.ts +1 -1
  36. package/es/tile/tileLayer/baseTileLayer.js +3 -2
  37. package/es/tile/utils.d.ts +2 -0
  38. package/es/tile/utils.js +5 -1
  39. package/lib/Geometry/index.js +114 -77
  40. package/lib/Geometry/models/billboard.js +232 -181
  41. package/lib/Geometry/models/index.js +18 -34
  42. package/lib/Geometry/models/plane.js +407 -278
  43. package/lib/Geometry/models/sprite.js +291 -189
  44. package/lib/canvas/index.js +101 -66
  45. package/lib/canvas/models/canvas.js +207 -140
  46. package/lib/canvas/models/index.js +12 -30
  47. package/lib/citybuliding/building.js +98 -63
  48. package/lib/citybuliding/models/build.js +192 -146
  49. package/lib/core/BaseLayer.js +1331 -809
  50. package/lib/core/BaseModel.js +457 -279
  51. package/lib/core/interface.js +40 -53
  52. package/lib/core/schema.js +21 -39
  53. package/lib/core/shape/Path.js +67 -79
  54. package/lib/core/shape/extrude.js +132 -91
  55. package/lib/core/triangulation.js +412 -213
  56. package/lib/earth/index.js +100 -62
  57. package/lib/earth/models/atmosphere.js +146 -112
  58. package/lib/earth/models/base.js +210 -150
  59. package/lib/earth/models/bloomsphere.js +146 -112
  60. package/lib/earth/utils.js +111 -91
  61. package/lib/heatmap/index.js +149 -92
  62. package/lib/heatmap/models/grid.js +118 -91
  63. package/lib/heatmap/models/grid3d.js +155 -123
  64. package/lib/heatmap/models/heatmap.js +475 -338
  65. package/lib/heatmap/models/hexagon.js +121 -92
  66. package/lib/heatmap/models/index.js +22 -37
  67. package/lib/heatmap/triangulation.js +31 -47
  68. package/lib/image/index.js +111 -74
  69. package/lib/image/models/dataImage.js +232 -174
  70. package/lib/image/models/image.js +175 -123
  71. package/lib/image/models/index.js +15 -32
  72. package/lib/index.js +263 -97
  73. package/lib/line/index.js +131 -83
  74. package/lib/line/models/arc.js +352 -237
  75. package/lib/line/models/arc_3d.js +334 -228
  76. package/lib/line/models/earthArc_3d.js +336 -228
  77. package/lib/line/models/great_circle.js +291 -200
  78. package/lib/line/models/half.js +286 -201
  79. package/lib/line/models/index.js +42 -50
  80. package/lib/line/models/line.js +428 -299
  81. package/lib/line/models/linearline.js +277 -203
  82. package/lib/line/models/simpleLine.js +239 -175
  83. package/lib/line/models/tile.js +348 -237
  84. package/lib/line/models/wall.js +327 -235
  85. package/lib/line/shaders/line_arc_vert.glsl +5 -3
  86. package/lib/line/shaders/simple/simpleline_vert.glsl +1 -0
  87. package/lib/mask/index.js +92 -59
  88. package/lib/mask/models/fill.js +134 -82
  89. package/lib/mask/models/index.js +12 -30
  90. package/lib/plugins/DataMappingPlugin.js +342 -224
  91. package/lib/plugins/DataSourcePlugin.js +102 -87
  92. package/lib/plugins/FeatureScalePlugin.js +330 -241
  93. package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
  94. package/lib/plugins/LayerModelPlugin.js +80 -73
  95. package/lib/plugins/LayerStylePlugin.js +48 -51
  96. package/lib/plugins/LightingPlugin.js +80 -68
  97. package/lib/plugins/MultiPassRendererPlugin.js +91 -65
  98. package/lib/plugins/PixelPickingPlugin.js +150 -109
  99. package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
  100. package/lib/plugins/ShaderUniformPlugin.js +118 -99
  101. package/lib/plugins/UpdateModelPlugin.js +40 -47
  102. package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
  103. package/lib/point/index.js +226 -148
  104. package/lib/point/models/earthExtrude.js +279 -201
  105. package/lib/point/models/earthFill.js +287 -202
  106. package/lib/point/models/extrude.js +299 -203
  107. package/lib/point/models/fill.js +406 -273
  108. package/lib/point/models/fillmage.js +365 -252
  109. package/lib/point/models/image.js +241 -164
  110. package/lib/point/models/index.js +46 -52
  111. package/lib/point/models/normal.js +183 -134
  112. package/lib/point/models/radar.js +304 -212
  113. package/lib/point/models/simplePoint.js +194 -142
  114. package/lib/point/models/text.js +608 -385
  115. package/lib/point/models/tile.js +314 -223
  116. package/lib/point/shaders/fill_vert.glsl +13 -6
  117. package/lib/point/shaders/image/fillImage_vert.glsl +13 -5
  118. package/lib/point/shaders/image_vert.glsl +17 -8
  119. package/lib/point/shape/extrude.js +56 -52
  120. package/lib/polygon/index.js +154 -100
  121. package/lib/polygon/models/extrude.js +311 -223
  122. package/lib/polygon/models/fill.js +215 -153
  123. package/lib/polygon/models/index.js +46 -52
  124. package/lib/polygon/models/ocean.js +244 -173
  125. package/lib/polygon/models/tile.js +144 -100
  126. package/lib/polygon/models/water.js +222 -153
  127. package/lib/raster/buffers/triangulation.js +27 -40
  128. package/lib/raster/index.js +115 -74
  129. package/lib/raster/models/index.js +16 -33
  130. package/lib/raster/models/raster.js +178 -135
  131. package/lib/raster/raster.js +187 -132
  132. package/lib/tile/interface.js +4 -16
  133. package/lib/tile/manager/tileConfigManager.js +125 -86
  134. package/lib/tile/manager/tileLayerManager.js +314 -227
  135. package/lib/tile/manager/tilePickerManager.js +192 -123
  136. package/lib/tile/models/tileModel.js +71 -51
  137. package/lib/tile/tileFactory/base.js +433 -292
  138. package/lib/tile/tileFactory/index.js +51 -49
  139. package/lib/tile/tileFactory/line.js +65 -50
  140. package/lib/tile/tileFactory/point.js +65 -50
  141. package/lib/tile/tileFactory/polygon.js +65 -50
  142. package/lib/tile/tileFactory/raster.js +66 -54
  143. package/lib/tile/tileFactory/rasterData.js +88 -76
  144. package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
  145. package/lib/tile/tileFactory/vectorLayer.js +169 -95
  146. package/lib/tile/tileLayer/baseTileLayer.js +420 -220
  147. package/lib/tile/tmsTileLayer.js +110 -67
  148. package/lib/tile/utils.js +113 -87
  149. package/lib/utils/blend.js +59 -79
  150. package/lib/utils/collision-index.js +107 -64
  151. package/lib/utils/dataMappingStyle.js +105 -60
  152. package/lib/utils/extrude_polyline.js +600 -398
  153. package/lib/utils/grid-index.js +163 -111
  154. package/lib/utils/layerData.js +130 -99
  155. package/lib/utils/multiPassRender.js +49 -41
  156. package/lib/utils/polylineNormal.js +148 -96
  157. package/lib/utils/simpleLine.js +100 -85
  158. package/lib/utils/symbol-layout.js +219 -116
  159. package/lib/utils/updateShape.js +15 -41
  160. package/lib/wind/index.js +109 -71
  161. package/lib/wind/models/index.js +12 -30
  162. package/lib/wind/models/utils.js +144 -105
  163. package/lib/wind/models/wind.js +333 -224
  164. package/lib/wind/models/windRender.js +329 -218
  165. package/lib/wind/models/windShader.js +23 -181
  166. package/package.json +7 -6
@@ -1,68 +1,83 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var __decorateClass = (decorators, target, key, kind) => {
19
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
20
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
21
- if (decorator = decorators[i])
22
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
23
- if (kind && result)
24
- __defProp(target, key, result);
25
- return result;
26
- };
27
-
28
- // src/core/BaseModel.ts
29
- var BaseModel_exports = {};
30
- __export(BaseModel_exports, {
31
- default: () => BaseModel
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
32
7
  });
33
- module.exports = __toCommonJS(BaseModel_exports);
34
- var import_l7_core = require("@antv/l7-core");
35
- var import_l7_utils = require("@antv/l7-utils");
36
- var import_d3_color = require("d3-color");
37
- var import_lodash = require("lodash");
38
- var import_blend = require("../utils/blend");
39
- var BaseModel = class {
40
- constructor(layer) {
8
+ exports.default = void 0;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+
12
+ var _initializerDefineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerDefineProperty"));
13
+
14
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
+
16
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
18
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
19
+
20
+ var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
21
+
22
+ var _initializerWarningHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerWarningHelper"));
23
+
24
+ var _l7Core = require("@antv/l7-core");
25
+
26
+ var _l7Utils = require("@antv/l7-utils");
27
+
28
+ var _d3Color = require("d3-color");
29
+
30
+ var _lodash = require("lodash");
31
+
32
+ var _blend = require("../utils/blend");
33
+
34
+ var _dec, _class, _descriptor;
35
+
36
+ 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; } } }; }
37
+
38
+ 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); }
39
+
40
+ 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; }
41
+
42
+ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
43
+ // style texture data mapping
44
+ // 用于数据传递的数据纹理
45
+ // 默认有多少列(宽度)
46
+ // 计算得到的当前数据纹理有多少行(高度)
47
+ // 单个 cell 的长度
48
+ // 需要进行数据映射的属性集合
49
+ // style texture data mapping
50
+ function BaseModel(layer) {
51
+ (0, _classCallCheck2.default)(this, BaseModel);
52
+ (0, _initializerDefineProperty2.default)(this, "configService", _descriptor, this);
41
53
  this.layer = layer;
42
- this.rendererService = layer.getContainer().get(import_l7_core.TYPES.IRendererService);
43
- this.pickingService = layer.getContainer().get(import_l7_core.TYPES.IPickingService);
44
- this.shaderModuleService = layer.getContainer().get(import_l7_core.TYPES.IShaderModuleService);
45
- this.styleAttributeService = layer.getContainer().get(import_l7_core.TYPES.IStyleAttributeService);
46
- this.mapService = layer.getContainer().get(import_l7_core.TYPES.IMapService);
47
- this.iconService = layer.getContainer().get(import_l7_core.TYPES.IIconService);
48
- this.fontService = layer.getContainer().get(import_l7_core.TYPES.IFontService);
49
- this.cameraService = layer.getContainer().get(import_l7_core.TYPES.ICameraService);
50
- this.layerService = layer.getContainer().get(import_l7_core.TYPES.ILayerService);
51
- this.registerBuiltinAttributes();
54
+ this.rendererService = layer.getContainer().get(_l7Core.TYPES.IRendererService);
55
+ this.pickingService = layer.getContainer().get(_l7Core.TYPES.IPickingService);
56
+ this.shaderModuleService = layer.getContainer().get(_l7Core.TYPES.IShaderModuleService);
57
+ this.styleAttributeService = layer.getContainer().get(_l7Core.TYPES.IStyleAttributeService);
58
+ this.mapService = layer.getContainer().get(_l7Core.TYPES.IMapService);
59
+ this.iconService = layer.getContainer().get(_l7Core.TYPES.IIconService);
60
+ this.fontService = layer.getContainer().get(_l7Core.TYPES.IFontService);
61
+ this.cameraService = layer.getContainer().get(_l7Core.TYPES.ICameraService);
62
+ this.layerService = layer.getContainer().get(_l7Core.TYPES.ILayerService); // 注册 Attribute
63
+
64
+ this.registerBuiltinAttributes(); // 开启动画
65
+
52
66
  this.startModelAnimate();
53
- const { createTexture2D } = this.rendererService;
67
+ var createTexture2D = this.rendererService.createTexture2D;
54
68
  this.createTexture2D = createTexture2D;
55
- this.DATA_TEXTURE_WIDTH = 1024;
69
+ this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度
70
+
56
71
  this.rowCount = 1;
57
72
  this.cellLength = 0;
58
73
  this.cellProperties = [];
59
74
  this.cacheStyleProperties = {
60
- thetaOffset: void 0,
61
- opacity: void 0,
62
- strokeOpacity: void 0,
63
- strokeWidth: void 0,
64
- stroke: void 0,
65
- offsets: void 0
75
+ thetaOffset: undefined,
76
+ opacity: undefined,
77
+ strokeOpacity: undefined,
78
+ strokeWidth: undefined,
79
+ stroke: undefined,
80
+ offsets: undefined
66
81
  };
67
82
  this.stylePropertyesExist = {
68
83
  hasThetaOffset: 0,
@@ -72,254 +87,417 @@ var BaseModel = class {
72
87
  hasStroke: 0,
73
88
  hasOffsets: 0
74
89
  };
75
- this.dataTextureTest = this.layerService.getOESTextureFloat();
90
+ this.dataTextureTest = this.layerService.getOESTextureFloat(); // 只有在不支持数据纹理的情况下进行赋值
91
+
76
92
  if (!this.dataTextureTest) {
77
93
  this.dataTexture = this.createTexture2D({
94
+ // data: new Uint8ClampedArray(4),
95
+ // 使用 Uint8ClampedArray 在 支付宝 环境中可能存在问题 UC 内核对格式有要求 L7 v2.7.18 版本发现
96
+ // Uint8ClampedArray 和 Uint8Array 没有实质性的区别
78
97
  data: new Uint8Array(4),
79
- mag: import_l7_core.gl.NEAREST,
80
- min: import_l7_core.gl.NEAREST,
98
+ mag: _l7Core.gl.NEAREST,
99
+ min: _l7Core.gl.NEAREST,
81
100
  width: 1,
82
101
  height: 1
83
102
  });
84
103
  }
85
- }
86
- clearLastCalRes() {
87
- this.cellProperties = [];
88
- this.cellLength = 0;
89
- this.stylePropertyesExist = {
90
- hasThetaOffset: 0,
91
- hasOpacity: 0,
92
- hasStrokeOpacity: 0,
93
- hasStrokeWidth: 0,
94
- hasStroke: 0,
95
- hasOffsets: 0
96
- };
97
- }
98
- getCellTypeLayout() {
99
- if (this.dataTextureTest) {
100
- return [
101
- this.rowCount,
102
- this.DATA_TEXTURE_WIDTH,
103
- 0,
104
- 0,
105
- this.stylePropertyesExist.hasOpacity,
106
- this.stylePropertyesExist.hasStrokeOpacity,
107
- this.stylePropertyesExist.hasStrokeWidth,
108
- this.stylePropertyesExist.hasStroke,
109
- this.stylePropertyesExist.hasOffsets,
110
- this.stylePropertyesExist.hasThetaOffset,
111
- 0,
112
- 0,
113
- 0,
114
- 0,
115
- 0,
116
- 1
117
- ];
118
- } else {
119
- return [
120
- 1,
121
- 1,
122
- 0,
123
- 0,
124
- 0,
125
- 0,
126
- 0,
127
- 0,
128
- 0,
129
- 0,
130
- 0,
131
- 0,
132
- 0,
133
- 0,
134
- 0,
135
- -1
136
- ];
104
+ } // style datatexture mapping
105
+
106
+ /**
107
+ * 清除上一次的计算结果 - 全量清除
108
+ */
109
+
110
+
111
+ (0, _createClass2.default)(BaseModel, [{
112
+ key: "clearLastCalRes",
113
+ value: function clearLastCalRes() {
114
+ this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合
115
+
116
+ this.cellLength = 0; // 清空上一次计算的 cell 的长度
117
+
118
+ this.stylePropertyesExist = {
119
+ // 全量清空上一次是否需要对 style 属性进行数据映射的判断
120
+ hasThetaOffset: 0,
121
+ hasOpacity: 0,
122
+ hasStrokeOpacity: 0,
123
+ hasStrokeWidth: 0,
124
+ hasStroke: 0,
125
+ hasOffsets: 0
126
+ };
137
127
  }
138
- }
139
- dataTextureNeedUpdate(options) {
140
- let isUpdate = false;
141
- if (!(0, import_lodash.isEqual)(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {
142
- isUpdate = true;
143
- this.cacheStyleProperties.thetaOffset = options.thetaOffset;
128
+ }, {
129
+ key: "getCellTypeLayout",
130
+ value: function getCellTypeLayout() {
131
+ if (this.dataTextureTest) {
132
+ return [// 0
133
+ this.rowCount, // 数据纹理有几行
134
+ this.DATA_TEXTURE_WIDTH, // 数据纹理有几列
135
+ 0.0, 0.0, // 1
136
+ this.stylePropertyesExist.hasOpacity, // cell 中是否存在 opacity
137
+ this.stylePropertyesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity
138
+ this.stylePropertyesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth
139
+ this.stylePropertyesExist.hasStroke, // cell 中是否存在 stroke
140
+ // 2
141
+ this.stylePropertyesExist.hasOffsets, // cell 中是否存在 offsets
142
+ this.stylePropertyesExist.hasThetaOffset, // cell 中是否存在 thetaOffset
143
+ 0.0, 0.0, // 3
144
+ 0.0, 0.0, 0.0, 1.0];
145
+ } else {
146
+ return [1.0, // 数据纹理有几行
147
+ 1.0, // 数据纹理有几列
148
+ 0.0, 0.0, 0.0, // cell 中是否存在 opacity
149
+ 0.0, // cell 中是否存在 strokeOpacity
150
+ 0.0, // cell 中是否存在 strokeWidth
151
+ 0.0, // cell 中是否存在 stroke
152
+ 0.0, // cell 中是否存在 offsets
153
+ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0];
154
+ }
144
155
  }
145
- if (!(0, import_lodash.isEqual)(options.opacity, this.cacheStyleProperties.opacity)) {
146
- isUpdate = true;
147
- this.cacheStyleProperties.opacity = options.opacity;
156
+ /**
157
+ * 判断数据纹理是否需要重新计算 - 根据传入的值进行判断
158
+ * @param options
159
+ * @returns
160
+ */
161
+
162
+ }, {
163
+ key: "dataTextureNeedUpdate",
164
+ value: function dataTextureNeedUpdate(options) {
165
+ var isUpdate = false;
166
+
167
+ if (!(0, _lodash.isEqual)(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {
168
+ isUpdate = true;
169
+ this.cacheStyleProperties.thetaOffset = options.thetaOffset;
170
+ }
171
+
172
+ if (!(0, _lodash.isEqual)(options.opacity, this.cacheStyleProperties.opacity)) {
173
+ isUpdate = true;
174
+ this.cacheStyleProperties.opacity = options.opacity;
175
+ }
176
+
177
+ if (!(0, _lodash.isEqual)(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)) {
178
+ isUpdate = true;
179
+ this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;
180
+ }
181
+
182
+ if (!(0, _lodash.isEqual)(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {
183
+ isUpdate = true;
184
+ this.cacheStyleProperties.strokeWidth = options.strokeWidth;
185
+ }
186
+
187
+ if (!(0, _lodash.isEqual)(options.stroke, this.cacheStyleProperties.stroke)) {
188
+ isUpdate = true;
189
+ this.cacheStyleProperties.stroke = options.stroke;
190
+ }
191
+
192
+ if (!(0, _lodash.isEqual)(options.offsets, this.cacheStyleProperties.offsets)) {
193
+ isUpdate = true;
194
+ this.cacheStyleProperties.offsets = options.offsets;
195
+ }
196
+
197
+ if (this.dataTexture === undefined) {
198
+ isUpdate = true;
199
+ }
200
+
201
+ return isUpdate;
148
202
  }
149
- if (!(0, import_lodash.isEqual)(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)) {
150
- isUpdate = true;
151
- this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;
203
+ /**
204
+ * 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
205
+ * @param options
206
+ */
207
+
208
+ }, {
209
+ key: "judgeStyleAttributes",
210
+ value: function judgeStyleAttributes(options) {
211
+ this.clearLastCalRes(); // 清除上一次的计算结果 - 全量清除
212
+
213
+ if (options.opacity !== undefined && !(0, _lodash.isNumber)(options.opacity)) {
214
+ // 数据映射
215
+ this.cellProperties.push({
216
+ attr: 'opacity',
217
+ count: 1
218
+ });
219
+ this.stylePropertyesExist.hasOpacity = 1;
220
+ this.cellLength += 1;
221
+ }
222
+
223
+ if (options.strokeOpacity !== undefined && !(0, _lodash.isNumber)(options.strokeOpacity)) {
224
+ // 数据映射
225
+ this.cellProperties.push({
226
+ attr: 'strokeOpacity',
227
+ count: 1
228
+ });
229
+ this.stylePropertyesExist.hasStrokeOpacity = 1;
230
+ this.cellLength += 1;
231
+ }
232
+
233
+ if (options.strokeWidth !== undefined && !(0, _lodash.isNumber)(options.strokeWidth)) {
234
+ // 数据映射
235
+ this.cellProperties.push({
236
+ attr: 'strokeWidth',
237
+ count: 1
238
+ });
239
+ this.stylePropertyesExist.hasStrokeWidth = 1;
240
+ this.cellLength += 1;
241
+ }
242
+
243
+ if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {
244
+ // 数据映射
245
+ this.cellProperties.push({
246
+ attr: 'stroke',
247
+ count: 4
248
+ });
249
+ this.stylePropertyesExist.hasStroke = 1;
250
+ this.cellLength += 4;
251
+ }
252
+
253
+ if (options.offsets !== undefined && !this.isOffsetStatic(options.offsets)) {
254
+ // 数据映射
255
+ this.cellProperties.push({
256
+ attr: 'offsets',
257
+ count: 2
258
+ });
259
+ this.stylePropertyesExist.hasOffsets = 1;
260
+ this.cellLength += 2;
261
+ }
262
+
263
+ if (options.thetaOffset !== undefined && !(0, _lodash.isNumber)(options.thetaOffset)) {
264
+ // 数据映射
265
+ this.cellProperties.push({
266
+ attr: 'thetaOffset',
267
+ count: 1
268
+ });
269
+ this.stylePropertyesExist.hasThetaOffset = 1;
270
+ this.cellLength += 1;
271
+ } // console.log('this.cellLength', this.cellLength)
272
+
152
273
  }
153
- if (!(0, import_lodash.isEqual)(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {
154
- isUpdate = true;
155
- this.cacheStyleProperties.strokeWidth = options.strokeWidth;
274
+ /**
275
+ * 判断变量 stroke 是否是常量值
276
+ * @param stroke
277
+ * @returns
278
+ */
279
+
280
+ }, {
281
+ key: "isStaticColor",
282
+ value: function isStaticColor(stroke) {
283
+ if ((0, _lodash.isString)(stroke)) {
284
+ if ((0, _d3Color.color)(stroke)) {
285
+ return true;
286
+ } else {
287
+ return false;
288
+ }
289
+ }
290
+
291
+ return false;
156
292
  }
157
- if (!(0, import_lodash.isEqual)(options.stroke, this.cacheStyleProperties.stroke)) {
158
- isUpdate = true;
159
- this.cacheStyleProperties.stroke = options.stroke;
293
+ /**
294
+ * 获取 stroke 颜色并做兼容处理
295
+ * @param stroke
296
+ * @returns
297
+ */
298
+
299
+ }, {
300
+ key: "getStrokeColor",
301
+ value: function getStrokeColor(stroke) {
302
+ if (this.isStaticColor(stroke)) {
303
+ var strokeColor = (0, _l7Utils.rgb2arr)(stroke);
304
+ strokeColor[0] = strokeColor[0] ? strokeColor[0] : 0;
305
+ strokeColor[1] = strokeColor[1] ? strokeColor[1] : 0;
306
+ strokeColor[2] = strokeColor[2] ? strokeColor[2] : 0;
307
+ strokeColor[3] = strokeColor[3] ? strokeColor[3] : 0;
308
+ return strokeColor;
309
+ } else {
310
+ return [0, 0, 0, 0];
311
+ }
160
312
  }
161
- if (!(0, import_lodash.isEqual)(options.offsets, this.cacheStyleProperties.offsets)) {
162
- isUpdate = true;
163
- this.cacheStyleProperties.offsets = options.offsets;
313
+ /**
314
+ * 判断 offsets 是否是常量
315
+ * @param offsets
316
+ * @returns
317
+ */
318
+
319
+ }, {
320
+ key: "isOffsetStatic",
321
+ value: function isOffsetStatic(offsets) {
322
+ if (Array.isArray(offsets) && offsets.length === 2 && (0, _lodash.isNumber)(offsets[0]) && (0, _lodash.isNumber)(offsets[1])) {
323
+ return true;
324
+ } else {
325
+ return false;
326
+ }
164
327
  }
165
- if (this.dataTexture === void 0) {
166
- isUpdate = true;
328
+ /**
329
+ * 补空位
330
+ * @param d
331
+ * @param count
332
+ */
333
+
334
+ }, {
335
+ key: "patchMod",
336
+ value: function patchMod(d, count) {
337
+ for (var i = 0; i < count; i++) {
338
+ d.push(-1);
339
+ }
167
340
  }
168
- return isUpdate;
169
- }
170
- judgeStyleAttributes(options) {
171
- this.clearLastCalRes();
172
- if (options.opacity !== void 0 && !(0, import_lodash.isNumber)(options.opacity)) {
173
- this.cellProperties.push({ attr: "opacity", count: 1 });
174
- this.stylePropertyesExist.hasOpacity = 1;
175
- this.cellLength += 1;
341
+ /**
342
+ * 根据映射的数据字段往推入数据
343
+ * @param d
344
+ * @param cellData
345
+ * @param cellPropertiesLayouts
346
+ */
347
+
348
+ }, {
349
+ key: "patchData",
350
+ value: function patchData(d, cellData, cellPropertiesLayouts) {
351
+ var _iterator = _createForOfIteratorHelper(cellPropertiesLayouts),
352
+ _step;
353
+
354
+ try {
355
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
356
+ var layout = _step.value;
357
+ var attr = layout.attr,
358
+ count = layout.count;
359
+ var value = cellData[attr];
360
+
361
+ if (value !== undefined) {
362
+ // 数据中存在该属性
363
+ if (attr === 'stroke') {
364
+ d.push.apply(d, (0, _toConsumableArray2.default)((0, _l7Utils.rgb2arr)(value)));
365
+ } else if (attr === 'offsets') {
366
+ if (this.isOffsetStatic(value)) {
367
+ d.push(-value[0], value[1]);
368
+ } else {
369
+ d.push(0, 0);
370
+ }
371
+ } else {
372
+ d.push((0, _lodash.isNumber)(value) ? value : 1.0);
373
+ }
374
+ } else {
375
+ // 若不存在时则补位
376
+ this.patchMod(d, count);
377
+ }
378
+ }
379
+ } catch (err) {
380
+ _iterator.e(err);
381
+ } finally {
382
+ _iterator.f();
383
+ }
176
384
  }
177
- if (options.strokeOpacity !== void 0 && !(0, import_lodash.isNumber)(options.strokeOpacity)) {
178
- this.cellProperties.push({ attr: "strokeOpacity", count: 1 });
179
- this.stylePropertyesExist.hasStrokeOpacity = 1;
180
- this.cellLength += 1;
385
+ /**
386
+ * 计算推入数据纹理的数据
387
+ * @param cellLength
388
+ * @param encodeData
389
+ * @param cellPropertiesLayouts
390
+ * @returns
391
+ */
392
+
393
+ }, {
394
+ key: "calDataFrame",
395
+ value: function calDataFrame(cellLength, encodeData, cellPropertiesLayouts) {
396
+ var encodeDatalength = encodeData.length;
397
+ var rowCount = Math.ceil(encodeDatalength * cellLength / this.DATA_TEXTURE_WIDTH); // 有多少行
398
+
399
+ var totalLength = rowCount * this.DATA_TEXTURE_WIDTH;
400
+ var d = [];
401
+
402
+ for (var i = 0; i < encodeDatalength; i++) {
403
+ // 根据 encodeData 数据推入数据
404
+ var cellData = encodeData[i];
405
+ this.patchData(d, cellData, cellPropertiesLayouts);
406
+ }
407
+
408
+ for (var _i = d.length; _i < totalLength; _i++) {
409
+ // 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)
410
+ d.push(-1);
411
+ } // console.log('data', d)
412
+
413
+
414
+ return {
415
+ data: d,
416
+ width: this.DATA_TEXTURE_WIDTH,
417
+ height: rowCount
418
+ };
419
+ } // style datatexture mapping
420
+
421
+ }, {
422
+ key: "getBlend",
423
+ value: function getBlend() {
424
+ var _this$layer$getLayerC = this.layer.getLayerConfig(),
425
+ _this$layer$getLayerC2 = _this$layer$getLayerC.blend,
426
+ blend = _this$layer$getLayerC2 === void 0 ? 'normal' : _this$layer$getLayerC2;
427
+
428
+ return _blend.BlendTypes[_l7Core.BlendType[blend]];
181
429
  }
182
- if (options.strokeWidth !== void 0 && !(0, import_lodash.isNumber)(options.strokeWidth)) {
183
- this.cellProperties.push({ attr: "strokeWidth", count: 1 });
184
- this.stylePropertyesExist.hasStrokeWidth = 1;
185
- this.cellLength += 1;
430
+ }, {
431
+ key: "getDefaultStyle",
432
+ value: function getDefaultStyle() {
433
+ return {};
186
434
  }
187
- if (options.stroke !== void 0 && !this.isStaticColor(options.stroke)) {
188
- this.cellProperties.push({ attr: "stroke", count: 4 });
189
- this.stylePropertyesExist.hasStroke = 1;
190
- this.cellLength += 4;
435
+ }, {
436
+ key: "getUninforms",
437
+ value: function getUninforms() {
438
+ throw new Error('Method not implemented.');
191
439
  }
192
- if (options.offsets !== void 0 && !this.isOffsetStatic(options.offsets)) {
193
- this.cellProperties.push({ attr: "offsets", count: 2 });
194
- this.stylePropertyesExist.hasOffsets = 1;
195
- this.cellLength += 2;
440
+ }, {
441
+ key: "getAnimateUniforms",
442
+ value: function getAnimateUniforms() {
443
+ return {};
196
444
  }
197
- if (options.thetaOffset !== void 0 && !(0, import_lodash.isNumber)(options.thetaOffset)) {
198
- this.cellProperties.push({ attr: "thetaOffset", count: 1 });
199
- this.stylePropertyesExist.hasThetaOffset = 1;
200
- this.cellLength += 1;
445
+ }, {
446
+ key: "needUpdate",
447
+ value: function needUpdate() {
448
+ return false;
201
449
  }
202
- }
203
- isStaticColor(stroke) {
204
- if ((0, import_lodash.isString)(stroke)) {
205
- if ((0, import_d3_color.color)(stroke)) {
206
- return true;
207
- } else {
208
- return false;
209
- }
450
+ }, {
451
+ key: "buildModels",
452
+ value: function buildModels(callbackModel) {
453
+ throw new Error('Method not implemented.');
210
454
  }
211
- return false;
212
- }
213
- getStrokeColor(stroke) {
214
- if (this.isStaticColor(stroke)) {
215
- const strokeColor = (0, import_l7_utils.rgb2arr)(stroke);
216
- strokeColor[0] = strokeColor[0] ? strokeColor[0] : 0;
217
- strokeColor[1] = strokeColor[1] ? strokeColor[1] : 0;
218
- strokeColor[2] = strokeColor[2] ? strokeColor[2] : 0;
219
- strokeColor[3] = strokeColor[3] ? strokeColor[3] : 0;
220
- return strokeColor;
221
- } else {
222
- return [0, 0, 0, 0];
455
+ }, {
456
+ key: "initModels",
457
+ value: function initModels(callbackModel) {
458
+ throw new Error('Method not implemented.');
223
459
  }
224
- }
225
- isOffsetStatic(offsets) {
226
- if (Array.isArray(offsets) && offsets.length === 2 && (0, import_lodash.isNumber)(offsets[0]) && (0, import_lodash.isNumber)(offsets[1])) {
227
- return true;
228
- } else {
229
- return false;
460
+ }, {
461
+ key: "clearModels",
462
+ value: function clearModels() {
463
+ return;
230
464
  }
231
- }
232
- patchMod(d, count) {
233
- for (let i = 0; i < count; i++) {
234
- d.push(-1);
465
+ }, {
466
+ key: "getAttribute",
467
+ value: function getAttribute() {
468
+ throw new Error('Method not implemented.');
235
469
  }
236
- }
237
- patchData(d, cellData, cellPropertiesLayouts) {
238
- for (const layout of cellPropertiesLayouts) {
239
- const { attr, count } = layout;
240
- const value = cellData[attr];
241
- if (value !== void 0) {
242
- if (attr === "stroke") {
243
- d.push(...(0, import_l7_utils.rgb2arr)(value));
244
- } else if (attr === "offsets") {
245
- if (this.isOffsetStatic(value)) {
246
- d.push(-value[0], value[1]);
247
- } else {
248
- d.push(0, 0);
249
- }
250
- } else {
251
- d.push((0, import_lodash.isNumber)(value) ? value : 1);
252
- }
253
- } else {
254
- this.patchMod(d, count);
255
- }
470
+ }, {
471
+ key: "render",
472
+ value: function render() {
473
+ throw new Error('Method not implemented.');
256
474
  }
257
- }
258
- calDataFrame(cellLength, encodeData, cellPropertiesLayouts) {
259
- const encodeDatalength = encodeData.length;
260
- const rowCount = Math.ceil(encodeDatalength * cellLength / this.DATA_TEXTURE_WIDTH);
261
- const totalLength = rowCount * this.DATA_TEXTURE_WIDTH;
262
- const d = [];
263
- for (let i = 0; i < encodeDatalength; i++) {
264
- const cellData = encodeData[i];
265
- this.patchData(d, cellData, cellPropertiesLayouts);
475
+ }, {
476
+ key: "registerBuiltinAttributes",
477
+ value: function registerBuiltinAttributes() {
478
+ throw new Error('Method not implemented.');
266
479
  }
267
- for (let i = d.length; i < totalLength; i++) {
268
- d.push(-1);
480
+ }, {
481
+ key: "animateOption2Array",
482
+ value: function animateOption2Array(option) {
483
+ return [option.enable ? 0 : 1.0, option.duration || 4.0, option.interval || 0.2, option.trailLength || 0.1];
269
484
  }
270
- return { data: d, width: this.DATA_TEXTURE_WIDTH, height: rowCount };
271
- }
272
- getBlend() {
273
- const { blend = "normal" } = this.layer.getLayerConfig();
274
- return import_blend.BlendTypes[import_l7_core.BlendType[blend]];
275
- }
276
- getDefaultStyle() {
277
- return {};
278
- }
279
- getUninforms() {
280
- throw new Error("Method not implemented.");
281
- }
282
- getAnimateUniforms() {
283
- return {};
284
- }
285
- needUpdate() {
286
- return false;
287
- }
288
- buildModels(callbackModel) {
289
- throw new Error("Method not implemented.");
290
- }
291
- initModels(callbackModel) {
292
- throw new Error("Method not implemented.");
293
- }
294
- clearModels() {
295
- return;
296
- }
297
- getAttribute() {
298
- throw new Error("Method not implemented.");
299
- }
300
- render() {
301
- throw new Error("Method not implemented.");
302
- }
303
- registerBuiltinAttributes() {
304
- throw new Error("Method not implemented.");
305
- }
306
- animateOption2Array(option) {
307
- return [
308
- option.enable ? 0 : 1,
309
- option.duration || 4,
310
- option.interval || 0.2,
311
- option.trailLength || 0.1
312
- ];
313
- }
314
- startModelAnimate() {
315
- const { animateOption } = this.layer.getLayerConfig();
316
- if (animateOption.enable) {
317
- this.layer.setAnimateStartTime();
485
+ }, {
486
+ key: "startModelAnimate",
487
+ value: function startModelAnimate() {
488
+ var _ref = this.layer.getLayerConfig(),
489
+ animateOption = _ref.animateOption;
490
+
491
+ if (animateOption.enable) {
492
+ this.layer.setAnimateStartTime();
493
+ }
318
494
  }
319
- }
320
- };
321
- __decorateClass([
322
- (0, import_l7_core.lazyInject)(import_l7_core.TYPES.IGlobalConfigService)
323
- ], BaseModel.prototype, "configService", 2);
324
- // Annotate the CommonJS export names for ESM import in node:
325
- 0 && (module.exports = {});
495
+ }]);
496
+ return BaseModel;
497
+ }(), (_descriptor = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "configService", [_dec], {
498
+ configurable: true,
499
+ enumerable: true,
500
+ writable: true,
501
+ initializer: null
502
+ })), _class));
503
+ exports.default = BaseModel;