@antv/l7-layers 2.9.25-alpha.0 → 2.9.26-alpha.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 (126) hide show
  1. package/es/heatmap/models/heatmap.js +1 -1
  2. package/es/tile/tileFactory/base.d.ts +1 -1
  3. package/es/tile/utils.js +1 -1
  4. package/lib/Geometry/index.js +114 -77
  5. package/lib/Geometry/models/billboard.js +232 -181
  6. package/lib/Geometry/models/index.js +18 -34
  7. package/lib/Geometry/models/plane.js +407 -278
  8. package/lib/Geometry/models/sprite.js +291 -189
  9. package/lib/canvas/index.js +101 -66
  10. package/lib/canvas/models/canvas.js +207 -140
  11. package/lib/canvas/models/index.js +12 -30
  12. package/lib/citybuliding/building.js +98 -63
  13. package/lib/citybuliding/models/build.js +192 -146
  14. package/lib/core/BaseLayer.js +1331 -814
  15. package/lib/core/BaseModel.js +457 -279
  16. package/lib/core/interface.js +40 -53
  17. package/lib/core/schema.js +21 -39
  18. package/lib/core/shape/Path.js +67 -79
  19. package/lib/core/shape/extrude.js +132 -91
  20. package/lib/core/triangulation.js +378 -196
  21. package/lib/earth/index.js +100 -62
  22. package/lib/earth/models/atmosphere.js +146 -112
  23. package/lib/earth/models/base.js +210 -150
  24. package/lib/earth/models/bloomsphere.js +146 -112
  25. package/lib/earth/utils.js +111 -91
  26. package/lib/heatmap/index.js +149 -92
  27. package/lib/heatmap/models/grid.js +118 -91
  28. package/lib/heatmap/models/grid3d.js +155 -123
  29. package/lib/heatmap/models/heatmap.js +475 -338
  30. package/lib/heatmap/models/hexagon.js +121 -92
  31. package/lib/heatmap/models/index.js +22 -37
  32. package/lib/heatmap/triangulation.js +31 -47
  33. package/lib/image/index.js +111 -74
  34. package/lib/image/models/dataImage.js +232 -174
  35. package/lib/image/models/image.js +175 -128
  36. package/lib/image/models/index.js +15 -32
  37. package/lib/index.js +263 -97
  38. package/lib/line/index.js +131 -85
  39. package/lib/line/models/arc.js +352 -237
  40. package/lib/line/models/arc_3d.js +334 -228
  41. package/lib/line/models/earthArc_3d.js +336 -228
  42. package/lib/line/models/great_circle.js +291 -200
  43. package/lib/line/models/half.js +286 -201
  44. package/lib/line/models/index.js +42 -50
  45. package/lib/line/models/line.js +428 -299
  46. package/lib/line/models/linearline.js +277 -203
  47. package/lib/line/models/simpleLine.js +239 -175
  48. package/lib/line/models/tile.js +348 -237
  49. package/lib/line/models/wall.js +327 -235
  50. package/lib/mask/index.js +92 -59
  51. package/lib/mask/models/fill.js +134 -82
  52. package/lib/mask/models/index.js +12 -30
  53. package/lib/plugins/DataMappingPlugin.js +342 -224
  54. package/lib/plugins/DataSourcePlugin.js +102 -87
  55. package/lib/plugins/FeatureScalePlugin.js +330 -240
  56. package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
  57. package/lib/plugins/LayerModelPlugin.js +80 -73
  58. package/lib/plugins/LayerStylePlugin.js +48 -51
  59. package/lib/plugins/LightingPlugin.js +80 -68
  60. package/lib/plugins/MultiPassRendererPlugin.js +91 -65
  61. package/lib/plugins/PixelPickingPlugin.js +150 -109
  62. package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
  63. package/lib/plugins/ShaderUniformPlugin.js +118 -99
  64. package/lib/plugins/UpdateModelPlugin.js +40 -47
  65. package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
  66. package/lib/point/index.js +226 -150
  67. package/lib/point/models/earthExtrude.js +279 -201
  68. package/lib/point/models/earthFill.js +287 -202
  69. package/lib/point/models/extrude.js +299 -203
  70. package/lib/point/models/fill.js +406 -275
  71. package/lib/point/models/fillmage.js +365 -256
  72. package/lib/point/models/image.js +241 -168
  73. package/lib/point/models/index.js +46 -52
  74. package/lib/point/models/normal.js +183 -134
  75. package/lib/point/models/radar.js +304 -211
  76. package/lib/point/models/simplePoint.js +194 -142
  77. package/lib/point/models/text.js +608 -385
  78. package/lib/point/models/tile.js +314 -223
  79. package/lib/point/shape/extrude.js +56 -52
  80. package/lib/polygon/index.js +154 -102
  81. package/lib/polygon/models/extrude.js +311 -223
  82. package/lib/polygon/models/fill.js +215 -153
  83. package/lib/polygon/models/index.js +46 -52
  84. package/lib/polygon/models/ocean.js +244 -173
  85. package/lib/polygon/models/tile.js +144 -100
  86. package/lib/polygon/models/water.js +222 -153
  87. package/lib/raster/buffers/triangulation.js +27 -40
  88. package/lib/raster/index.js +115 -75
  89. package/lib/raster/models/index.js +16 -33
  90. package/lib/raster/models/raster.js +178 -135
  91. package/lib/raster/raster.js +187 -132
  92. package/lib/tile/interface.js +4 -16
  93. package/lib/tile/manager/tileConfigManager.js +125 -86
  94. package/lib/tile/manager/tileLayerManager.js +313 -229
  95. package/lib/tile/manager/tilePickerManager.js +192 -123
  96. package/lib/tile/models/tileModel.js +71 -52
  97. package/lib/tile/tileFactory/base.js +432 -309
  98. package/lib/tile/tileFactory/index.js +51 -49
  99. package/lib/tile/tileFactory/line.js +65 -50
  100. package/lib/tile/tileFactory/point.js +65 -50
  101. package/lib/tile/tileFactory/polygon.js +65 -50
  102. package/lib/tile/tileFactory/raster.js +66 -54
  103. package/lib/tile/tileFactory/rasterData.js +88 -76
  104. package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
  105. package/lib/tile/tileFactory/vectorLayer.js +168 -109
  106. package/lib/tile/tileLayer/baseTileLayer.js +420 -221
  107. package/lib/tile/tmsTileLayer.js +110 -67
  108. package/lib/tile/utils.js +110 -92
  109. package/lib/utils/blend.js +59 -79
  110. package/lib/utils/collision-index.js +107 -64
  111. package/lib/utils/dataMappingStyle.js +105 -60
  112. package/lib/utils/extrude_polyline.js +600 -398
  113. package/lib/utils/grid-index.js +163 -111
  114. package/lib/utils/layerData.js +130 -99
  115. package/lib/utils/multiPassRender.js +49 -41
  116. package/lib/utils/polylineNormal.js +148 -96
  117. package/lib/utils/simpleLine.js +100 -85
  118. package/lib/utils/symbol-layout.js +219 -116
  119. package/lib/utils/updateShape.js +15 -41
  120. package/lib/wind/index.js +109 -71
  121. package/lib/wind/models/index.js +12 -30
  122. package/lib/wind/models/utils.js +144 -105
  123. package/lib/wind/models/wind.js +333 -224
  124. package/lib/wind/models/windRender.js +329 -218
  125. package/lib/wind/models/windShader.js +23 -181
  126. package/package.json +6 -6
@@ -1,116 +1,136 @@
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
-
19
- // src/earth/utils.ts
20
- var utils_exports = {};
21
- __export(utils_exports, {
22
- EARTH_RADIUS: () => EARTH_RADIUS,
23
- EARTH_RADIUS_OUTER: () => EARTH_RADIUS_OUTER,
24
- EARTH_SEGMENTS: () => EARTH_SEGMENTS,
25
- lglt2xyz: () => lglt2xyz,
26
- primitiveSphere: () => primitiveSphere
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
27
7
  });
28
- module.exports = __toCommonJS(utils_exports);
29
- var import_gl_matrix = require("gl-matrix");
8
+ exports.EARTH_SEGMENTS = exports.EARTH_RADIUS_OUTER = exports.EARTH_RADIUS = void 0;
9
+ exports.lglt2xyz = lglt2xyz;
10
+ exports.primitiveSphere = primitiveSphere;
11
+
12
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
+
14
+ var _glMatrix = require("gl-matrix");
15
+
16
+ // 该文件专门记录地球模式的数值
17
+ // 地球网格半径
30
18
  var EARTH_RADIUS = 100;
19
+ exports.EARTH_RADIUS = EARTH_RADIUS;
31
20
  var EARTH_SEGMENTS = 36;
21
+ exports.EARTH_SEGMENTS = EARTH_SEGMENTS;
32
22
  var EARTH_RADIUS_OUTER = 40;
23
+ /**
24
+ * 角度转弧度
25
+ * @param deg
26
+ * @returns
27
+ */
28
+
29
+ exports.EARTH_RADIUS_OUTER = EARTH_RADIUS_OUTER;
30
+
33
31
  function torad(deg) {
34
32
  return deg / 180 * Math.acos(-1);
35
33
  }
34
+ /**
35
+ * 经纬度转xyz
36
+ * @param longitude 经度
37
+ * @param latitude 纬度
38
+ * @param radius 半径
39
+ */
40
+
41
+
36
42
  function lglt2xyz(lnglat) {
37
- const lng = torad(lnglat[0]) + Math.PI / 2;
38
- const lat = torad(lnglat[1]);
39
- const radius = EARTH_RADIUS + Math.random() * 0.4;
40
- const z = radius * Math.cos(lat) * Math.cos(lng);
41
- const x = radius * Math.cos(lat) * Math.sin(lng);
42
- const y = radius * Math.sin(lat);
43
+ // TODO: + Math.PI/2 是为了对齐坐标
44
+ var lng = torad(lnglat[0]) + Math.PI / 2;
45
+ var lat = torad(lnglat[1]); // TODO: 手动增加一些偏移,减轻面的冲突
46
+
47
+ var radius = EARTH_RADIUS + Math.random() * 0.4;
48
+ var z = radius * Math.cos(lat) * Math.cos(lng);
49
+ var x = radius * Math.cos(lat) * Math.sin(lng);
50
+ var y = radius * Math.sin(lat);
43
51
  return [x, y, z];
44
52
  }
53
+ /**
54
+ * 构建地球球体网格
55
+ * @param radius
56
+ * @param opt
57
+ * @returns
58
+ */
59
+
60
+
45
61
  function primitiveSphere(radius, opt) {
46
- const matRotY = import_gl_matrix.mat4.create();
47
- const matRotZ = import_gl_matrix.mat4.create();
48
- const up = import_gl_matrix.vec3.fromValues(0, 1, 0);
49
- const tmpVec3 = import_gl_matrix.vec3.fromValues(0, 0, 0);
62
+ var matRotY = _glMatrix.mat4.create();
63
+
64
+ var matRotZ = _glMatrix.mat4.create();
65
+
66
+ var up = _glMatrix.vec3.fromValues(0, 1, 0);
67
+
68
+ var tmpVec3 = _glMatrix.vec3.fromValues(0, 0, 0);
69
+
50
70
  opt = opt || {};
51
- radius = typeof radius !== "undefined" ? radius : 1;
52
- const segments = typeof opt.segments !== "undefined" ? opt.segments : 32;
53
- const totalZRotationSteps = 2 + segments;
54
- const totalYRotationSteps = 2 * totalZRotationSteps;
55
- const indices = [];
56
- const indicesArr = [];
57
- const positions = [];
58
- const positionsArr = [];
59
- const normalArr = [];
60
- const uvs = [];
61
- for (let zRotationStep = 0; zRotationStep <= totalZRotationSteps; zRotationStep++) {
62
- const normalizedZ = zRotationStep / totalZRotationSteps;
63
- const angleZ = normalizedZ * Math.PI;
64
- for (let yRotationStep = 0; yRotationStep <= totalYRotationSteps; yRotationStep++) {
65
- const normalizedY = yRotationStep / totalYRotationSteps;
66
- const angleY = normalizedY * Math.PI * 2;
67
- import_gl_matrix.mat4.identity(matRotZ);
68
- import_gl_matrix.mat4.rotateZ(matRotZ, matRotZ, -angleZ);
69
- import_gl_matrix.mat4.identity(matRotY);
70
- import_gl_matrix.mat4.rotateY(matRotY, matRotY, angleY);
71
- import_gl_matrix.vec3.transformMat4(tmpVec3, up, matRotZ);
72
- import_gl_matrix.vec3.transformMat4(tmpVec3, tmpVec3, matRotY);
73
- import_gl_matrix.vec3.scale(tmpVec3, tmpVec3, -radius);
71
+ radius = typeof radius !== 'undefined' ? radius : 1;
72
+ var segments = typeof opt.segments !== 'undefined' ? opt.segments : 32;
73
+ var totalZRotationSteps = 2 + segments;
74
+ var totalYRotationSteps = 2 * totalZRotationSteps;
75
+ var indices = [];
76
+ var indicesArr = [];
77
+ var positions = [];
78
+ var positionsArr = [];
79
+ var normalArr = [];
80
+ var uvs = [];
81
+
82
+ for (var zRotationStep = 0; zRotationStep <= totalZRotationSteps; zRotationStep++) {
83
+ var normalizedZ = zRotationStep / totalZRotationSteps;
84
+ var angleZ = normalizedZ * Math.PI;
85
+
86
+ for (var yRotationStep = 0; yRotationStep <= totalYRotationSteps; yRotationStep++) {
87
+ var normalizedY = yRotationStep / totalYRotationSteps;
88
+ var angleY = normalizedY * Math.PI * 2;
89
+
90
+ _glMatrix.mat4.identity(matRotZ);
91
+
92
+ _glMatrix.mat4.rotateZ(matRotZ, matRotZ, -angleZ);
93
+
94
+ _glMatrix.mat4.identity(matRotY);
95
+
96
+ _glMatrix.mat4.rotateY(matRotY, matRotY, angleY);
97
+
98
+ _glMatrix.vec3.transformMat4(tmpVec3, up, matRotZ);
99
+
100
+ _glMatrix.vec3.transformMat4(tmpVec3, tmpVec3, matRotY);
101
+
102
+ _glMatrix.vec3.scale(tmpVec3, tmpVec3, -radius);
103
+
74
104
  positions.push(tmpVec3.slice());
75
- positionsArr.push(...tmpVec3.slice());
76
- import_gl_matrix.vec3.normalize(tmpVec3, tmpVec3);
77
- normalArr.push(...tmpVec3.slice());
78
- uvs.push([normalizedY, 1 - normalizedZ]);
105
+ positionsArr.push.apply(positionsArr, (0, _toConsumableArray2.default)(tmpVec3.slice()));
106
+
107
+ _glMatrix.vec3.normalize(tmpVec3, tmpVec3);
108
+
109
+ normalArr.push.apply(normalArr, (0, _toConsumableArray2.default)(tmpVec3.slice()));
110
+ uvs.push([normalizedY, 1 - normalizedZ]); // position 和 uv 一起存储
111
+
79
112
  positionsArr.push(normalizedY, 1 - normalizedZ);
80
113
  }
114
+
81
115
  if (zRotationStep > 0) {
82
- const verticesCount = positions.length;
83
- let firstIndex = verticesCount - 2 * (totalYRotationSteps + 1);
116
+ var verticesCount = positions.length;
117
+ var firstIndex = verticesCount - 2 * (totalYRotationSteps + 1);
118
+
84
119
  for (; firstIndex + totalYRotationSteps + 2 < verticesCount; firstIndex++) {
85
- indices.push([
86
- firstIndex,
87
- firstIndex + 1,
88
- firstIndex + totalYRotationSteps + 1
89
- ]);
120
+ indices.push([firstIndex, firstIndex + 1, firstIndex + totalYRotationSteps + 1]);
90
121
  indicesArr.push(firstIndex, firstIndex + 1, firstIndex + totalYRotationSteps + 1);
91
- indices.push([
92
- firstIndex + totalYRotationSteps + 1,
93
- firstIndex + 1,
94
- firstIndex + totalYRotationSteps + 2
95
- ]);
122
+ indices.push([firstIndex + totalYRotationSteps + 1, firstIndex + 1, firstIndex + totalYRotationSteps + 2]);
96
123
  indicesArr.push(firstIndex + totalYRotationSteps + 1, firstIndex + 1, firstIndex + totalYRotationSteps + 2);
97
124
  }
98
125
  }
99
126
  }
127
+
100
128
  return {
101
129
  cells: indices,
102
- positions,
103
- uvs,
104
- positionsArr,
105
- indicesArr,
106
- normalArr
130
+ positions: positions,
131
+ uvs: uvs,
132
+ positionsArr: positionsArr,
133
+ indicesArr: indicesArr,
134
+ normalArr: normalArr
107
135
  };
108
- }
109
- // Annotate the CommonJS export names for ESM import in node:
110
- 0 && (module.exports = {
111
- EARTH_RADIUS,
112
- EARTH_RADIUS_OUTER,
113
- EARTH_SEGMENTS,
114
- lglt2xyz,
115
- primitiveSphere
116
- });
136
+ }
@@ -1,101 +1,158 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
-
22
- // src/heatmap/index.ts
23
- var heatmap_exports = {};
24
- __export(heatmap_exports, {
25
- default: () => HeatMapLayer
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
26
7
  });
27
- module.exports = __toCommonJS(heatmap_exports);
28
- var import_BaseLayer = __toESM(require("../core/BaseLayer"));
29
- var import_models = __toESM(require("./models"));
30
- var HeatMapLayer = class extends import_BaseLayer.default {
31
- constructor() {
32
- super(...arguments);
33
- this.type = "HeatMapLayer";
34
- }
35
- buildModels() {
36
- const shape = this.getModelType();
37
- this.layerModel = new import_models.default[shape](this);
38
- this.layerModel.initModels((models) => {
39
- this.models = models;
40
- this.renderLayers();
41
- });
42
- }
43
- rebuildModels() {
44
- this.layerModel.buildModels((models) => this.models = models);
45
- }
46
- renderModels() {
47
- const shape = this.getModelType();
48
- if (shape === "heatmap") {
49
- if (this.layerModel) {
50
- this.layerModel.render();
51
- }
52
- return this;
53
- }
54
- if (this.layerModelNeedUpdate) {
55
- this.layerModel.buildModels((models) => this.models = models);
56
- this.layerModelNeedUpdate = false;
8
+ exports.default = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
+
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
+
18
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
+
20
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
+
22
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
+
24
+ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
25
+
26
+ var _models = _interopRequireDefault(require("./models"));
27
+
28
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
29
+
30
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
31
+
32
+ var HeatMapLayer = /*#__PURE__*/function (_BaseLayer) {
33
+ (0, _inherits2.default)(HeatMapLayer, _BaseLayer);
34
+
35
+ var _super = _createSuper(HeatMapLayer);
36
+
37
+ function HeatMapLayer() {
38
+ var _this;
39
+
40
+ (0, _classCallCheck2.default)(this, HeatMapLayer);
41
+
42
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
+ args[_key] = arguments[_key];
57
44
  }
58
- this.models.forEach((model) => model.draw({
59
- uniforms: this.layerModel.getUninforms()
60
- }));
61
- return this;
45
+
46
+ _this = _super.call.apply(_super, [this].concat(args));
47
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", 'HeatMapLayer');
48
+ return _this;
62
49
  }
63
- updateModelData(data) {
64
- if (data.attributes && data.elements) {
65
- this.models[0].updateAttributesAndElements(data.attributes, data.elements);
66
- } else {
67
- console.warn("data error");
50
+
51
+ (0, _createClass2.default)(HeatMapLayer, [{
52
+ key: "buildModels",
53
+ value: function buildModels() {
54
+ var _this2 = this;
55
+
56
+ var shape = this.getModelType();
57
+ this.layerModel = new _models.default[shape](this);
58
+ this.layerModel.initModels(function (models) {
59
+ _this2.models = models;
60
+
61
+ _this2.renderLayers();
62
+ });
68
63
  }
69
- }
70
- getConfigSchema() {
71
- return {
72
- properties: {
73
- opacity: {
74
- type: "number",
75
- minimum: 0,
76
- maximum: 1
64
+ }, {
65
+ key: "rebuildModels",
66
+ value: function rebuildModels() {
67
+ var _this3 = this;
68
+
69
+ this.layerModel.buildModels(function (models) {
70
+ return _this3.models = models;
71
+ });
72
+ }
73
+ }, {
74
+ key: "renderModels",
75
+ value: function renderModels() {
76
+ var _this4 = this;
77
+
78
+ var shape = this.getModelType();
79
+
80
+ if (shape === 'heatmap') {
81
+ if (this.layerModel) {
82
+ this.layerModel.render(); // 独立的渲染流程
77
83
  }
84
+
85
+ return this;
86
+ }
87
+
88
+ if (this.layerModelNeedUpdate) {
89
+ this.layerModel.buildModels(function (models) {
90
+ return _this4.models = models;
91
+ }); // @ts-ignore
92
+ // this.models = this.layerModel.buildModels();
93
+
94
+ this.layerModelNeedUpdate = false;
95
+ }
96
+
97
+ this.models.forEach(function (model) {
98
+ return model.draw({
99
+ uniforms: _this4.layerModel.getUninforms()
100
+ });
101
+ });
102
+ return this;
103
+ }
104
+ }, {
105
+ key: "updateModelData",
106
+ value: function updateModelData(data) {
107
+ if (data.attributes && data.elements) {
108
+ this.models[0].updateAttributesAndElements(data.attributes, data.elements);
109
+ } else {
110
+ console.warn('data error');
78
111
  }
79
- };
80
- }
81
- getModelType() {
82
- var _a;
83
- const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute("shape");
84
- const { shape3d } = this.getLayerConfig();
85
- const source = this.getSource();
86
- const sourceType = source.data.type;
87
- const shape = ((_a = shapeAttribute == null ? void 0 : shapeAttribute.scale) == null ? void 0 : _a.field) || "heatmap";
88
- if (shape === "heatmap" || shape === "heatmap3d") {
89
- return "heatmap";
90
112
  }
91
- if (sourceType === "hexagon") {
92
- return (shape3d == null ? void 0 : shape3d.indexOf(shape)) === -1 ? "hexagon" : "grid3d";
113
+ }, {
114
+ key: "getConfigSchema",
115
+ value: function getConfigSchema() {
116
+ return {
117
+ properties: {
118
+ opacity: {
119
+ type: 'number',
120
+ minimum: 0,
121
+ maximum: 1
122
+ }
123
+ }
124
+ };
93
125
  }
94
- if (sourceType === "grid") {
95
- return (shape3d == null ? void 0 : shape3d.indexOf(shape)) === -1 ? "grid" : "grid3d";
126
+ }, {
127
+ key: "getModelType",
128
+ value: function getModelType() {
129
+ var _shapeAttribute$scale;
130
+
131
+ var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
132
+
133
+ var _this$getLayerConfig = this.getLayerConfig(),
134
+ shape3d = _this$getLayerConfig.shape3d;
135
+
136
+ var source = this.getSource();
137
+ var sourceType = source.data.type;
138
+ var shape = (shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field) || 'heatmap';
139
+
140
+ if (shape === 'heatmap' || shape === 'heatmap3d') {
141
+ return 'heatmap';
142
+ }
143
+
144
+ if (sourceType === 'hexagon') {
145
+ return (shape3d === null || shape3d === void 0 ? void 0 : shape3d.indexOf(shape)) === -1 ? 'hexagon' : 'grid3d';
146
+ }
147
+
148
+ if (sourceType === 'grid') {
149
+ return (shape3d === null || shape3d === void 0 ? void 0 : shape3d.indexOf(shape)) === -1 ? 'grid' : 'grid3d';
150
+ }
151
+
152
+ return 'heatmap';
96
153
  }
97
- return "heatmap";
98
- }
99
- };
100
- // Annotate the CommonJS export names for ESM import in node:
101
- 0 && (module.exports = {});
154
+ }]);
155
+ return HeatMapLayer;
156
+ }(_BaseLayer2.default);
157
+
158
+ exports.default = HeatMapLayer;