@deck.gl/aggregation-layers 8.10.0-alpha.4 → 8.10.0-alpha.5

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 (95) hide show
  1. package/dist/dist.dev.js +58 -709
  2. package/dist/es5/aggregation-layer.js +120 -134
  3. package/dist/es5/aggregation-layer.js.map +1 -1
  4. package/dist/es5/contour-layer/contour-layer.js +225 -234
  5. package/dist/es5/contour-layer/contour-layer.js.map +1 -1
  6. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +90 -100
  7. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
  8. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +131 -140
  9. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
  10. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +285 -295
  11. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
  12. package/dist/es5/grid-aggregation-layer.js +194 -209
  13. package/dist/es5/grid-aggregation-layer.js.map +1 -1
  14. package/dist/es5/grid-layer/grid-layer.js +59 -66
  15. package/dist/es5/grid-layer/grid-layer.js.map +1 -1
  16. package/dist/es5/heatmap-layer/heatmap-layer.js +471 -497
  17. package/dist/es5/heatmap-layer/heatmap-layer.js.map +1 -1
  18. package/dist/es5/heatmap-layer/triangle-layer.js +64 -69
  19. package/dist/es5/heatmap-layer/triangle-layer.js.map +1 -1
  20. package/dist/es5/hexagon-layer/hexagon-layer.js +129 -140
  21. package/dist/es5/hexagon-layer/hexagon-layer.js.map +1 -1
  22. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +153 -166
  23. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
  24. package/dist/es5/screen-grid-layer/screen-grid-layer.js +207 -220
  25. package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +1 -1
  26. package/dist/es5/utils/bin-sorter.js +163 -173
  27. package/dist/es5/utils/bin-sorter.js.map +1 -1
  28. package/dist/es5/utils/cpu-aggregator.js +300 -323
  29. package/dist/es5/utils/cpu-aggregator.js.map +1 -1
  30. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +483 -504
  31. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
  32. package/dist/esm/aggregation-layer.js +2 -5
  33. package/dist/esm/aggregation-layer.js.map +1 -1
  34. package/dist/esm/contour-layer/contour-layer.js +2 -5
  35. package/dist/esm/contour-layer/contour-layer.js.map +1 -1
  36. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +2 -5
  37. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
  38. package/dist/esm/cpu-grid-layer/grid-aggregator.js +1 -1
  39. package/dist/esm/cpu-grid-layer/grid-aggregator.js.map +1 -1
  40. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +15 -1
  41. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +1 -1
  42. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +121 -1
  43. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +1 -1
  44. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +2 -5
  45. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
  46. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +3 -6
  47. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
  48. package/dist/esm/grid-aggregation-layer.js +3 -6
  49. package/dist/esm/grid-aggregation-layer.js.map +1 -1
  50. package/dist/esm/grid-layer/grid-layer.js +3 -7
  51. package/dist/esm/grid-layer/grid-layer.js.map +1 -1
  52. package/dist/esm/heatmap-layer/heatmap-layer.js +7 -11
  53. package/dist/esm/heatmap-layer/heatmap-layer.js.map +1 -1
  54. package/dist/esm/heatmap-layer/max-fs.glsl.js +7 -1
  55. package/dist/esm/heatmap-layer/max-fs.glsl.js.map +1 -1
  56. package/dist/esm/heatmap-layer/max-vs.glsl.js +12 -1
  57. package/dist/esm/heatmap-layer/max-vs.glsl.js.map +1 -1
  58. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +39 -1
  59. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +1 -1
  60. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js +31 -1
  61. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js.map +1 -1
  62. package/dist/esm/heatmap-layer/triangle-layer.js +1 -3
  63. package/dist/esm/heatmap-layer/triangle-layer.js.map +1 -1
  64. package/dist/esm/heatmap-layer/weights-fs.glsl.js +19 -1
  65. package/dist/esm/heatmap-layer/weights-fs.glsl.js.map +1 -1
  66. package/dist/esm/heatmap-layer/weights-vs.glsl.js +23 -1
  67. package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +1 -1
  68. package/dist/esm/hexagon-layer/hexagon-layer.js +3 -7
  69. package/dist/esm/hexagon-layer/hexagon-layer.js.map +1 -1
  70. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +3 -7
  71. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
  72. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js +17 -1
  73. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +1 -1
  74. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js +64 -1
  75. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +1 -1
  76. package/dist/esm/screen-grid-layer/screen-grid-layer.js +5 -9
  77. package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +1 -1
  78. package/dist/esm/utils/bin-sorter.js +7 -16
  79. package/dist/esm/utils/bin-sorter.js.map +1 -1
  80. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +20 -1
  81. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +1 -1
  82. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +34 -1
  83. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +1 -1
  84. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +12 -1
  85. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +1 -1
  86. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +58 -1
  87. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +1 -1
  88. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +14 -14
  89. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
  90. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +17 -1
  91. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +1 -1
  92. package/dist/esm/utils/scale-utils.js +2 -2
  93. package/dist/esm/utils/scale-utils.js.map +1 -1
  94. package/dist.min.js +30 -27
  95. package/package.json +2 -2
@@ -11,8 +11,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
11
 
12
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
 
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
14
  var _core = require("@luma.gl/core");
17
15
 
18
16
  var _shadertools = require("@luma.gl/shadertools");
@@ -54,6 +52,64 @@ var ARRAY_BUFFER_MAP = {
54
52
  var REQUIRED_FEATURES = [_core.FEATURES.WEBGL2, _core.FEATURES.COLOR_ATTACHMENT_RGBA32F, _core.FEATURES.BLEND_EQUATION_MINMAX, _core.FEATURES.FLOAT_BLEND, _core.FEATURES.TEXTURE_FLOAT];
55
53
 
56
54
  var GPUGridAggregator = function () {
55
+ GPUGridAggregator.getAggregationData = function getAggregationData(_ref) {
56
+ var aggregationData = _ref.aggregationData,
57
+ maxData = _ref.maxData,
58
+ minData = _ref.minData,
59
+ maxMinData = _ref.maxMinData,
60
+ pixelIndex = _ref.pixelIndex;
61
+ var index = pixelIndex * _gpuGridAggregatorConstants.PIXEL_SIZE;
62
+ var results = {};
63
+
64
+ if (aggregationData) {
65
+ results.cellCount = aggregationData[index + 3];
66
+ results.cellWeight = aggregationData[index];
67
+ }
68
+
69
+ if (maxMinData) {
70
+ results.maxCellWieght = maxMinData[0];
71
+ results.minCellWeight = maxMinData[3];
72
+ } else {
73
+ if (maxData) {
74
+ results.maxCellWieght = maxData[0];
75
+ results.totalCount = maxData[3];
76
+ }
77
+
78
+ if (minData) {
79
+ results.minCellWeight = minData[0];
80
+ results.totalCount = maxData[3];
81
+ }
82
+ }
83
+
84
+ return results;
85
+ };
86
+
87
+ GPUGridAggregator.getCellData = function getCellData(_ref2) {
88
+ var countsData = _ref2.countsData,
89
+ _ref2$size = _ref2.size,
90
+ size = _ref2$size === void 0 ? 1 : _ref2$size;
91
+ var numCells = countsData.length / 4;
92
+ var cellWeights = new Float32Array(numCells * size);
93
+ var cellCounts = new Uint32Array(numCells);
94
+
95
+ for (var i = 0; i < numCells; i++) {
96
+ for (var sizeIndex = 0; sizeIndex < size; sizeIndex++) {
97
+ cellWeights[i * size + sizeIndex] = countsData[i * 4 + sizeIndex];
98
+ }
99
+
100
+ cellCounts[i] = countsData[i * 4 + 3];
101
+ }
102
+
103
+ return {
104
+ cellCounts: cellCounts,
105
+ cellWeights: cellWeights
106
+ };
107
+ };
108
+
109
+ GPUGridAggregator.isSupported = function isSupported(gl) {
110
+ return (0, _core.hasFeatures)(gl, REQUIRED_FEATURES);
111
+ };
112
+
57
113
  function GPUGridAggregator(gl) {
58
114
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
59
115
  (0, _classCallCheck2.default)(this, GPUGridAggregator);
@@ -79,595 +135,518 @@ var GPUGridAggregator = function () {
79
135
  }
80
136
  }
81
137
 
82
- (0, _createClass2.default)(GPUGridAggregator, [{
83
- key: "delete",
84
- value: function _delete() {
85
- var gridAggregationModel = this.gridAggregationModel,
86
- allAggregationModel = this.allAggregationModel,
87
- meanTransform = this.meanTransform;
88
- var _this$state = this.state,
89
- textures = _this$state.textures,
90
- framebuffers = _this$state.framebuffers,
91
- maxMinFramebuffers = _this$state.maxMinFramebuffers,
92
- minFramebuffers = _this$state.minFramebuffers,
93
- maxFramebuffers = _this$state.maxFramebuffers,
94
- meanTextures = _this$state.meanTextures,
95
- resources = _this$state.resources;
96
- gridAggregationModel === null || gridAggregationModel === void 0 ? void 0 : gridAggregationModel.delete();
97
- allAggregationModel === null || allAggregationModel === void 0 ? void 0 : allAggregationModel.delete();
98
- meanTransform === null || meanTransform === void 0 ? void 0 : meanTransform.delete();
99
- deleteResources([framebuffers, textures, maxMinFramebuffers, minFramebuffers, maxFramebuffers, meanTextures, resources]);
138
+ var _proto = GPUGridAggregator.prototype;
139
+
140
+ _proto.delete = function _delete() {
141
+ var gridAggregationModel = this.gridAggregationModel,
142
+ allAggregationModel = this.allAggregationModel,
143
+ meanTransform = this.meanTransform;
144
+ var _this$state = this.state,
145
+ textures = _this$state.textures,
146
+ framebuffers = _this$state.framebuffers,
147
+ maxMinFramebuffers = _this$state.maxMinFramebuffers,
148
+ minFramebuffers = _this$state.minFramebuffers,
149
+ maxFramebuffers = _this$state.maxFramebuffers,
150
+ meanTextures = _this$state.meanTextures,
151
+ resources = _this$state.resources;
152
+ gridAggregationModel === null || gridAggregationModel === void 0 ? void 0 : gridAggregationModel.delete();
153
+ allAggregationModel === null || allAggregationModel === void 0 ? void 0 : allAggregationModel.delete();
154
+ meanTransform === null || meanTransform === void 0 ? void 0 : meanTransform.delete();
155
+ deleteResources([framebuffers, textures, maxMinFramebuffers, minFramebuffers, maxFramebuffers, meanTextures, resources]);
156
+ };
157
+
158
+ _proto.run = function run() {
159
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
160
+ this.setState({
161
+ results: {}
162
+ });
163
+
164
+ var aggregationParams = this._normalizeAggregationParams(opts);
165
+
166
+ if (!this._hasGPUSupport) {
167
+ _core2.log.log(1, 'GPUGridAggregator: not supported')();
100
168
  }
101
- }, {
102
- key: "run",
103
- value: function run() {
104
- var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
105
- this.setState({
106
- results: {}
107
- });
108
169
 
109
- var aggregationParams = this._normalizeAggregationParams(opts);
170
+ return this._runAggregation(aggregationParams);
171
+ };
110
172
 
111
- if (!this._hasGPUSupport) {
112
- _core2.log.log(1, 'GPUGridAggregator: not supported')();
113
- }
173
+ _proto.getData = function getData(weightId) {
174
+ var data = {};
175
+ var results = this.state.results;
114
176
 
115
- return this._runAggregation(aggregationParams);
177
+ if (!results[weightId].aggregationData) {
178
+ results[weightId].aggregationData = results[weightId].aggregationBuffer.getData();
116
179
  }
117
- }, {
118
- key: "getData",
119
- value: function getData(weightId) {
120
- var data = {};
121
- var results = this.state.results;
122
-
123
- if (!results[weightId].aggregationData) {
124
- results[weightId].aggregationData = results[weightId].aggregationBuffer.getData();
125
- }
126
180
 
127
- data.aggregationData = results[weightId].aggregationData;
181
+ data.aggregationData = results[weightId].aggregationData;
128
182
 
129
- for (var arrayName in ARRAY_BUFFER_MAP) {
130
- var bufferName = ARRAY_BUFFER_MAP[arrayName];
183
+ for (var arrayName in ARRAY_BUFFER_MAP) {
184
+ var bufferName = ARRAY_BUFFER_MAP[arrayName];
131
185
 
132
- if (results[weightId][arrayName] || results[weightId][bufferName]) {
133
- results[weightId][arrayName] = results[weightId][arrayName] || results[weightId][bufferName].getData();
134
- data[arrayName] = results[weightId][arrayName];
135
- }
186
+ if (results[weightId][arrayName] || results[weightId][bufferName]) {
187
+ results[weightId][arrayName] = results[weightId][arrayName] || results[weightId][bufferName].getData();
188
+ data[arrayName] = results[weightId][arrayName];
136
189
  }
137
-
138
- return data;
139
190
  }
140
- }, {
141
- key: "updateShaders",
142
- value: function updateShaders() {
143
- var shaderOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
144
- this.setState({
145
- shaderOptions: shaderOptions,
146
- modelDirty: true
147
- });
148
- }
149
- }, {
150
- key: "_normalizeAggregationParams",
151
- value: function _normalizeAggregationParams(opts) {
152
- var aggregationParams = _objectSpread(_objectSpread({}, _gpuGridAggregatorConstants.DEFAULT_RUN_PARAMS), opts);
153
191
 
154
- var weights = aggregationParams.weights;
192
+ return data;
193
+ };
155
194
 
156
- if (weights) {
157
- aggregationParams.weights = normalizeWeightParams(weights);
158
- }
195
+ _proto.updateShaders = function updateShaders() {
196
+ var shaderOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
197
+ this.setState({
198
+ shaderOptions: shaderOptions,
199
+ modelDirty: true
200
+ });
201
+ };
159
202
 
160
- return aggregationParams;
161
- }
162
- }, {
163
- key: "setState",
164
- value: function setState(updateObject) {
165
- Object.assign(this.state, updateObject);
203
+ _proto._normalizeAggregationParams = function _normalizeAggregationParams(opts) {
204
+ var aggregationParams = _objectSpread(_objectSpread({}, _gpuGridAggregatorConstants.DEFAULT_RUN_PARAMS), opts);
205
+
206
+ var weights = aggregationParams.weights;
207
+
208
+ if (weights) {
209
+ aggregationParams.weights = normalizeWeightParams(weights);
166
210
  }
167
- }, {
168
- key: "_getAggregateData",
169
- value: function _getAggregateData(opts) {
170
- var results = {};
171
- var _this$state2 = this.state,
172
- textures = _this$state2.textures,
173
- framebuffers = _this$state2.framebuffers,
174
- maxMinFramebuffers = _this$state2.maxMinFramebuffers,
175
- minFramebuffers = _this$state2.minFramebuffers,
176
- maxFramebuffers = _this$state2.maxFramebuffers,
177
- resources = _this$state2.resources;
178
- var weights = opts.weights;
179
-
180
- for (var id in weights) {
181
- results[id] = {};
182
- var _weights$id = weights[id],
183
- needMin = _weights$id.needMin,
184
- needMax = _weights$id.needMax,
185
- combineMaxMin = _weights$id.combineMaxMin;
186
- results[id].aggregationTexture = textures[id];
187
- results[id].aggregationBuffer = (0, _core.readPixelsToBuffer)(framebuffers[id], {
188
- target: weights[id].aggregationBuffer,
211
+
212
+ return aggregationParams;
213
+ };
214
+
215
+ _proto.setState = function setState(updateObject) {
216
+ Object.assign(this.state, updateObject);
217
+ };
218
+
219
+ _proto._getAggregateData = function _getAggregateData(opts) {
220
+ var results = {};
221
+ var _this$state2 = this.state,
222
+ textures = _this$state2.textures,
223
+ framebuffers = _this$state2.framebuffers,
224
+ maxMinFramebuffers = _this$state2.maxMinFramebuffers,
225
+ minFramebuffers = _this$state2.minFramebuffers,
226
+ maxFramebuffers = _this$state2.maxFramebuffers,
227
+ resources = _this$state2.resources;
228
+ var weights = opts.weights;
229
+
230
+ for (var id in weights) {
231
+ results[id] = {};
232
+ var _weights$id = weights[id],
233
+ needMin = _weights$id.needMin,
234
+ needMax = _weights$id.needMax,
235
+ combineMaxMin = _weights$id.combineMaxMin;
236
+ results[id].aggregationTexture = textures[id];
237
+ results[id].aggregationBuffer = (0, _core.readPixelsToBuffer)(framebuffers[id], {
238
+ target: weights[id].aggregationBuffer,
239
+ sourceType: 5126
240
+ });
241
+
242
+ if (needMin && needMax && combineMaxMin) {
243
+ results[id].maxMinBuffer = (0, _core.readPixelsToBuffer)(maxMinFramebuffers[id], {
244
+ target: weights[id].maxMinBuffer,
189
245
  sourceType: 5126
190
246
  });
191
-
192
- if (needMin && needMax && combineMaxMin) {
193
- results[id].maxMinBuffer = (0, _core.readPixelsToBuffer)(maxMinFramebuffers[id], {
194
- target: weights[id].maxMinBuffer,
247
+ results[id].maxMinTexture = resources["".concat(id, "-maxMinTexture")];
248
+ } else {
249
+ if (needMin) {
250
+ results[id].minBuffer = (0, _core.readPixelsToBuffer)(minFramebuffers[id], {
251
+ target: weights[id].minBuffer,
195
252
  sourceType: 5126
196
253
  });
197
- results[id].maxMinTexture = resources["".concat(id, "-maxMinTexture")];
198
- } else {
199
- if (needMin) {
200
- results[id].minBuffer = (0, _core.readPixelsToBuffer)(minFramebuffers[id], {
201
- target: weights[id].minBuffer,
202
- sourceType: 5126
203
- });
204
- results[id].minTexture = resources["".concat(id, "-minTexture")];
205
- }
254
+ results[id].minTexture = resources["".concat(id, "-minTexture")];
255
+ }
206
256
 
207
- if (needMax) {
208
- results[id].maxBuffer = (0, _core.readPixelsToBuffer)(maxFramebuffers[id], {
209
- target: weights[id].maxBuffer,
210
- sourceType: 5126
211
- });
212
- results[id].maxTexture = resources["".concat(id, "-maxTexture")];
213
- }
257
+ if (needMax) {
258
+ results[id].maxBuffer = (0, _core.readPixelsToBuffer)(maxFramebuffers[id], {
259
+ target: weights[id].maxBuffer,
260
+ sourceType: 5126
261
+ });
262
+ results[id].maxTexture = resources["".concat(id, "-maxTexture")];
214
263
  }
215
264
  }
265
+ }
216
266
 
217
- this._trackGPUResultBuffers(results, weights);
267
+ this._trackGPUResultBuffers(results, weights);
268
+
269
+ return results;
270
+ };
271
+
272
+ _proto._renderAggregateData = function _renderAggregateData(opts) {
273
+ var cellSize = opts.cellSize,
274
+ projectPoints = opts.projectPoints,
275
+ attributes = opts.attributes,
276
+ moduleSettings = opts.moduleSettings,
277
+ numCol = opts.numCol,
278
+ numRow = opts.numRow,
279
+ weights = opts.weights,
280
+ translation = opts.translation,
281
+ scaling = opts.scaling;
282
+ var _this$state3 = this.state,
283
+ maxMinFramebuffers = _this$state3.maxMinFramebuffers,
284
+ minFramebuffers = _this$state3.minFramebuffers,
285
+ maxFramebuffers = _this$state3.maxFramebuffers;
286
+ var gridSize = [numCol, numRow];
287
+ var parameters = {
288
+ blend: true,
289
+ depthTest: false,
290
+ blendFunc: [1, 1]
291
+ };
292
+ var uniforms = {
293
+ cellSize: cellSize,
294
+ gridSize: gridSize,
295
+ projectPoints: projectPoints,
296
+ translation: translation,
297
+ scaling: scaling
298
+ };
218
299
 
219
- return results;
220
- }
221
- }, {
222
- key: "_renderAggregateData",
223
- value: function _renderAggregateData(opts) {
224
- var cellSize = opts.cellSize,
225
- projectPoints = opts.projectPoints,
226
- attributes = opts.attributes,
227
- moduleSettings = opts.moduleSettings,
228
- numCol = opts.numCol,
229
- numRow = opts.numRow,
230
- weights = opts.weights,
231
- translation = opts.translation,
232
- scaling = opts.scaling;
233
- var _this$state3 = this.state,
234
- maxMinFramebuffers = _this$state3.maxMinFramebuffers,
235
- minFramebuffers = _this$state3.minFramebuffers,
236
- maxFramebuffers = _this$state3.maxFramebuffers;
237
- var gridSize = [numCol, numRow];
238
- var parameters = {
239
- blend: true,
240
- depthTest: false,
241
- blendFunc: [1, 1]
242
- };
243
- var uniforms = {
244
- cellSize: cellSize,
300
+ for (var id in weights) {
301
+ var _weights$id2 = weights[id],
302
+ needMin = _weights$id2.needMin,
303
+ needMax = _weights$id2.needMax;
304
+ var combineMaxMin = needMin && needMax && weights[id].combineMaxMin;
305
+
306
+ this._renderToWeightsTexture({
307
+ id: id,
308
+ parameters: parameters,
309
+ moduleSettings: moduleSettings,
310
+ uniforms: uniforms,
245
311
  gridSize: gridSize,
246
- projectPoints: projectPoints,
247
- translation: translation,
248
- scaling: scaling
249
- };
250
-
251
- for (var id in weights) {
252
- var _weights$id2 = weights[id],
253
- needMin = _weights$id2.needMin,
254
- needMax = _weights$id2.needMax;
255
- var combineMaxMin = needMin && needMax && weights[id].combineMaxMin;
312
+ attributes: attributes,
313
+ weights: weights
314
+ });
256
315
 
257
- this._renderToWeightsTexture({
316
+ if (combineMaxMin) {
317
+ this._renderToMaxMinTexture({
258
318
  id: id,
259
- parameters: parameters,
260
- moduleSettings: moduleSettings,
261
- uniforms: uniforms,
319
+ parameters: _objectSpread(_objectSpread({}, parameters), {}, {
320
+ blendEquation: _gpuGridAggregatorConstants.MAX_MIN_BLEND_EQUATION
321
+ }),
262
322
  gridSize: gridSize,
263
- attributes: attributes,
264
- weights: weights
323
+ minOrMaxFb: maxMinFramebuffers[id],
324
+ clearParams: {
325
+ clearColor: [0, 0, 0, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT]
326
+ },
327
+ combineMaxMin: combineMaxMin
265
328
  });
266
-
267
- if (combineMaxMin) {
329
+ } else {
330
+ if (needMin) {
268
331
  this._renderToMaxMinTexture({
269
332
  id: id,
270
333
  parameters: _objectSpread(_objectSpread({}, parameters), {}, {
271
- blendEquation: _gpuGridAggregatorConstants.MAX_MIN_BLEND_EQUATION
334
+ blendEquation: _gpuGridAggregatorConstants.MIN_BLEND_EQUATION
272
335
  }),
273
336
  gridSize: gridSize,
274
- minOrMaxFb: maxMinFramebuffers[id],
337
+ minOrMaxFb: minFramebuffers[id],
275
338
  clearParams: {
276
- clearColor: [0, 0, 0, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT]
339
+ clearColor: [_gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, 0]
277
340
  },
278
341
  combineMaxMin: combineMaxMin
279
342
  });
280
- } else {
281
- if (needMin) {
282
- this._renderToMaxMinTexture({
283
- id: id,
284
- parameters: _objectSpread(_objectSpread({}, parameters), {}, {
285
- blendEquation: _gpuGridAggregatorConstants.MIN_BLEND_EQUATION
286
- }),
287
- gridSize: gridSize,
288
- minOrMaxFb: minFramebuffers[id],
289
- clearParams: {
290
- clearColor: [_gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, 0]
291
- },
292
- combineMaxMin: combineMaxMin
293
- });
294
- }
343
+ }
295
344
 
296
- if (needMax) {
297
- this._renderToMaxMinTexture({
298
- id: id,
299
- parameters: _objectSpread(_objectSpread({}, parameters), {}, {
300
- blendEquation: _gpuGridAggregatorConstants.MAX_BLEND_EQUATION
301
- }),
302
- gridSize: gridSize,
303
- minOrMaxFb: maxFramebuffers[id],
304
- clearParams: {
305
- clearColor: [0, 0, 0, 0]
306
- },
307
- combineMaxMin: combineMaxMin
308
- });
309
- }
345
+ if (needMax) {
346
+ this._renderToMaxMinTexture({
347
+ id: id,
348
+ parameters: _objectSpread(_objectSpread({}, parameters), {}, {
349
+ blendEquation: _gpuGridAggregatorConstants.MAX_BLEND_EQUATION
350
+ }),
351
+ gridSize: gridSize,
352
+ minOrMaxFb: maxFramebuffers[id],
353
+ clearParams: {
354
+ clearColor: [0, 0, 0, 0]
355
+ },
356
+ combineMaxMin: combineMaxMin
357
+ });
310
358
  }
311
359
  }
312
360
  }
313
- }, {
314
- key: "_renderToMaxMinTexture",
315
- value: function _renderToMaxMinTexture(opts) {
316
- var id = opts.id,
317
- parameters = opts.parameters,
318
- gridSize = opts.gridSize,
319
- minOrMaxFb = opts.minOrMaxFb,
320
- combineMaxMin = opts.combineMaxMin,
321
- _opts$clearParams = opts.clearParams,
322
- clearParams = _opts$clearParams === void 0 ? {} : _opts$clearParams;
323
- var framebuffers = this.state.framebuffers;
324
- var gl = this.gl,
325
- allAggregationModel = this.allAggregationModel;
326
- (0, _core.withParameters)(gl, _objectSpread(_objectSpread({}, clearParams), {}, {
327
- framebuffer: minOrMaxFb,
328
- viewport: [0, 0, gridSize[0], gridSize[1]]
329
- }), function () {
330
- gl.clear(16384);
331
- allAggregationModel.draw({
332
- parameters: parameters,
333
- uniforms: {
334
- uSampler: framebuffers[id].texture,
335
- gridSize: gridSize,
336
- combineMaxMin: combineMaxMin
337
- }
338
- });
361
+ };
362
+
363
+ _proto._renderToMaxMinTexture = function _renderToMaxMinTexture(opts) {
364
+ var id = opts.id,
365
+ parameters = opts.parameters,
366
+ gridSize = opts.gridSize,
367
+ minOrMaxFb = opts.minOrMaxFb,
368
+ combineMaxMin = opts.combineMaxMin,
369
+ _opts$clearParams = opts.clearParams,
370
+ clearParams = _opts$clearParams === void 0 ? {} : _opts$clearParams;
371
+ var framebuffers = this.state.framebuffers;
372
+ var gl = this.gl,
373
+ allAggregationModel = this.allAggregationModel;
374
+ (0, _core.withParameters)(gl, _objectSpread(_objectSpread({}, clearParams), {}, {
375
+ framebuffer: minOrMaxFb,
376
+ viewport: [0, 0, gridSize[0], gridSize[1]]
377
+ }), function () {
378
+ gl.clear(16384);
379
+ allAggregationModel.draw({
380
+ parameters: parameters,
381
+ uniforms: {
382
+ uSampler: framebuffers[id].texture,
383
+ gridSize: gridSize,
384
+ combineMaxMin: combineMaxMin
385
+ }
339
386
  });
340
- }
341
- }, {
342
- key: "_renderToWeightsTexture",
343
- value: function _renderToWeightsTexture(opts) {
344
- var id = opts.id,
345
- parameters = opts.parameters,
346
- moduleSettings = opts.moduleSettings,
347
- uniforms = opts.uniforms,
348
- gridSize = opts.gridSize,
349
- weights = opts.weights;
350
- var _this$state4 = this.state,
351
- framebuffers = _this$state4.framebuffers,
352
- equations = _this$state4.equations,
353
- weightAttributes = _this$state4.weightAttributes;
354
- var gl = this.gl,
355
- gridAggregationModel = this.gridAggregationModel;
356
- var operation = weights[id].operation;
357
- var clearColor = operation === _aggregationOperationUtils.AGGREGATION_OPERATION.MIN ? [_gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, 0] : [0, 0, 0, 0];
358
- (0, _core.withParameters)(gl, {
359
- framebuffer: framebuffers[id],
360
- viewport: [0, 0, gridSize[0], gridSize[1]],
361
- clearColor: clearColor
362
- }, function () {
363
- gl.clear(16384);
364
- var attributes = {
365
- weights: weightAttributes[id]
366
- };
367
- gridAggregationModel.draw({
368
- parameters: _objectSpread(_objectSpread({}, parameters), {}, {
369
- blendEquation: equations[id]
370
- }),
371
- moduleSettings: moduleSettings,
372
- uniforms: uniforms,
373
- attributes: attributes
374
- });
387
+ });
388
+ };
389
+
390
+ _proto._renderToWeightsTexture = function _renderToWeightsTexture(opts) {
391
+ var id = opts.id,
392
+ parameters = opts.parameters,
393
+ moduleSettings = opts.moduleSettings,
394
+ uniforms = opts.uniforms,
395
+ gridSize = opts.gridSize,
396
+ weights = opts.weights;
397
+ var _this$state4 = this.state,
398
+ framebuffers = _this$state4.framebuffers,
399
+ equations = _this$state4.equations,
400
+ weightAttributes = _this$state4.weightAttributes;
401
+ var gl = this.gl,
402
+ gridAggregationModel = this.gridAggregationModel;
403
+ var operation = weights[id].operation;
404
+ var clearColor = operation === _aggregationOperationUtils.AGGREGATION_OPERATION.MIN ? [_gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, _gpuGridAggregatorConstants.MAX_32_BIT_FLOAT, 0] : [0, 0, 0, 0];
405
+ (0, _core.withParameters)(gl, {
406
+ framebuffer: framebuffers[id],
407
+ viewport: [0, 0, gridSize[0], gridSize[1]],
408
+ clearColor: clearColor
409
+ }, function () {
410
+ gl.clear(16384);
411
+ var attributes = {
412
+ weights: weightAttributes[id]
413
+ };
414
+ gridAggregationModel.draw({
415
+ parameters: _objectSpread(_objectSpread({}, parameters), {}, {
416
+ blendEquation: equations[id]
417
+ }),
418
+ moduleSettings: moduleSettings,
419
+ uniforms: uniforms,
420
+ attributes: attributes
375
421
  });
422
+ });
423
+
424
+ if (operation === _aggregationOperationUtils.AGGREGATION_OPERATION.MEAN) {
425
+ var _this$state5 = this.state,
426
+ meanTextures = _this$state5.meanTextures,
427
+ textures = _this$state5.textures;
428
+ var transformOptions = {
429
+ _sourceTextures: {
430
+ aggregationValues: meanTextures[id]
431
+ },
432
+ _targetTexture: textures[id],
433
+ elementCount: textures[id].width * textures[id].height
434
+ };
376
435
 
377
- if (operation === _aggregationOperationUtils.AGGREGATION_OPERATION.MEAN) {
378
- var _this$state5 = this.state,
379
- meanTextures = _this$state5.meanTextures,
380
- textures = _this$state5.textures;
381
- var transformOptions = {
382
- _sourceTextures: {
383
- aggregationValues: meanTextures[id]
384
- },
385
- _targetTexture: textures[id],
386
- elementCount: textures[id].width * textures[id].height
387
- };
388
-
389
- if (this.meanTransform) {
390
- this.meanTransform.update(transformOptions);
391
- } else {
392
- this.meanTransform = getMeanTransform(gl, transformOptions);
393
- }
394
-
395
- this.meanTransform.run({
396
- parameters: {
397
- blend: false,
398
- depthTest: false
399
- }
400
- });
401
- framebuffers[id].attach((0, _defineProperty2.default)({}, 36064, textures[id]));
436
+ if (this.meanTransform) {
437
+ this.meanTransform.update(transformOptions);
438
+ } else {
439
+ this.meanTransform = getMeanTransform(gl, transformOptions);
402
440
  }
403
- }
404
- }, {
405
- key: "_runAggregation",
406
- value: function _runAggregation(opts) {
407
- this._updateModels(opts);
408
-
409
- this._setupFramebuffers(opts);
410
-
411
- this._renderAggregateData(opts);
412
-
413
- var results = this._getAggregateData(opts);
414
441
 
415
- this.setState({
416
- results: results
442
+ this.meanTransform.run({
443
+ parameters: {
444
+ blend: false,
445
+ depthTest: false
446
+ }
417
447
  });
418
- return results;
448
+ framebuffers[id].attach((0, _defineProperty2.default)({}, 36064, textures[id]));
419
449
  }
420
- }, {
421
- key: "_setupFramebuffers",
422
- value: function _setupFramebuffers(opts) {
423
- var _this$state6 = this.state,
424
- textures = _this$state6.textures,
425
- framebuffers = _this$state6.framebuffers,
426
- maxMinFramebuffers = _this$state6.maxMinFramebuffers,
427
- minFramebuffers = _this$state6.minFramebuffers,
428
- maxFramebuffers = _this$state6.maxFramebuffers,
429
- meanTextures = _this$state6.meanTextures,
430
- equations = _this$state6.equations;
431
- var weights = opts.weights;
432
- var numCol = opts.numCol,
433
- numRow = opts.numRow;
434
- var framebufferSize = {
450
+ };
451
+
452
+ _proto._runAggregation = function _runAggregation(opts) {
453
+ this._updateModels(opts);
454
+
455
+ this._setupFramebuffers(opts);
456
+
457
+ this._renderAggregateData(opts);
458
+
459
+ var results = this._getAggregateData(opts);
460
+
461
+ this.setState({
462
+ results: results
463
+ });
464
+ return results;
465
+ };
466
+
467
+ _proto._setupFramebuffers = function _setupFramebuffers(opts) {
468
+ var _this$state6 = this.state,
469
+ textures = _this$state6.textures,
470
+ framebuffers = _this$state6.framebuffers,
471
+ maxMinFramebuffers = _this$state6.maxMinFramebuffers,
472
+ minFramebuffers = _this$state6.minFramebuffers,
473
+ maxFramebuffers = _this$state6.maxFramebuffers,
474
+ meanTextures = _this$state6.meanTextures,
475
+ equations = _this$state6.equations;
476
+ var weights = opts.weights;
477
+ var numCol = opts.numCol,
478
+ numRow = opts.numRow;
479
+ var framebufferSize = {
480
+ width: numCol,
481
+ height: numRow
482
+ };
483
+
484
+ for (var id in weights) {
485
+ var _weights$id3 = weights[id],
486
+ needMin = _weights$id3.needMin,
487
+ needMax = _weights$id3.needMax,
488
+ combineMaxMin = _weights$id3.combineMaxMin,
489
+ operation = _weights$id3.operation;
490
+ textures[id] = weights[id].aggregationTexture || textures[id] || (0, _resourceUtils.getFloatTexture)(this.gl, {
491
+ id: "".concat(id, "-texture"),
435
492
  width: numCol,
436
493
  height: numRow
437
- };
494
+ });
495
+ textures[id].resize(framebufferSize);
496
+ var texture = textures[id];
438
497
 
439
- for (var id in weights) {
440
- var _weights$id3 = weights[id],
441
- needMin = _weights$id3.needMin,
442
- needMax = _weights$id3.needMax,
443
- combineMaxMin = _weights$id3.combineMaxMin,
444
- operation = _weights$id3.operation;
445
- textures[id] = weights[id].aggregationTexture || textures[id] || (0, _resourceUtils.getFloatTexture)(this.gl, {
446
- id: "".concat(id, "-texture"),
498
+ if (operation === _aggregationOperationUtils.AGGREGATION_OPERATION.MEAN) {
499
+ meanTextures[id] = meanTextures[id] || (0, _resourceUtils.getFloatTexture)(this.gl, {
500
+ id: "".concat(id, "-mean-texture"),
447
501
  width: numCol,
448
502
  height: numRow
449
503
  });
450
- textures[id].resize(framebufferSize);
451
- var texture = textures[id];
452
-
453
- if (operation === _aggregationOperationUtils.AGGREGATION_OPERATION.MEAN) {
454
- meanTextures[id] = meanTextures[id] || (0, _resourceUtils.getFloatTexture)(this.gl, {
455
- id: "".concat(id, "-mean-texture"),
456
- width: numCol,
457
- height: numRow
458
- });
459
- meanTextures[id].resize(framebufferSize);
460
- texture = meanTextures[id];
461
- }
504
+ meanTextures[id].resize(framebufferSize);
505
+ texture = meanTextures[id];
506
+ }
462
507
 
463
- if (framebuffers[id]) {
464
- framebuffers[id].attach((0, _defineProperty2.default)({}, 36064, texture));
465
- } else {
466
- framebuffers[id] = (0, _resourceUtils.getFramebuffer)(this.gl, {
467
- id: "".concat(id, "-fb"),
468
- width: numCol,
469
- height: numRow,
470
- texture: texture
471
- });
472
- }
508
+ if (framebuffers[id]) {
509
+ framebuffers[id].attach((0, _defineProperty2.default)({}, 36064, texture));
510
+ } else {
511
+ framebuffers[id] = (0, _resourceUtils.getFramebuffer)(this.gl, {
512
+ id: "".concat(id, "-fb"),
513
+ width: numCol,
514
+ height: numRow,
515
+ texture: texture
516
+ });
517
+ }
473
518
 
474
- framebuffers[id].resize(framebufferSize);
475
- equations[id] = _gpuGridAggregatorConstants.EQUATION_MAP[operation] || _gpuGridAggregatorConstants.EQUATION_MAP.SUM;
519
+ framebuffers[id].resize(framebufferSize);
520
+ equations[id] = _gpuGridAggregatorConstants.EQUATION_MAP[operation] || _gpuGridAggregatorConstants.EQUATION_MAP.SUM;
476
521
 
477
- if (needMin || needMax) {
478
- if (needMin && needMax && combineMaxMin) {
479
- if (!maxMinFramebuffers[id]) {
480
- texture = weights[id].maxMinTexture || this._getMinMaxTexture("".concat(id, "-maxMinTexture"));
481
- maxMinFramebuffers[id] = (0, _resourceUtils.getFramebuffer)(this.gl, {
482
- id: "".concat(id, "-maxMinFb"),
522
+ if (needMin || needMax) {
523
+ if (needMin && needMax && combineMaxMin) {
524
+ if (!maxMinFramebuffers[id]) {
525
+ texture = weights[id].maxMinTexture || this._getMinMaxTexture("".concat(id, "-maxMinTexture"));
526
+ maxMinFramebuffers[id] = (0, _resourceUtils.getFramebuffer)(this.gl, {
527
+ id: "".concat(id, "-maxMinFb"),
528
+ texture: texture
529
+ });
530
+ }
531
+ } else {
532
+ if (needMin) {
533
+ if (!minFramebuffers[id]) {
534
+ texture = weights[id].minTexture || this._getMinMaxTexture("".concat(id, "-minTexture"));
535
+ minFramebuffers[id] = (0, _resourceUtils.getFramebuffer)(this.gl, {
536
+ id: "".concat(id, "-minFb"),
483
537
  texture: texture
484
538
  });
485
539
  }
486
- } else {
487
- if (needMin) {
488
- if (!minFramebuffers[id]) {
489
- texture = weights[id].minTexture || this._getMinMaxTexture("".concat(id, "-minTexture"));
490
- minFramebuffers[id] = (0, _resourceUtils.getFramebuffer)(this.gl, {
491
- id: "".concat(id, "-minFb"),
492
- texture: texture
493
- });
494
- }
495
- }
540
+ }
496
541
 
497
- if (needMax) {
498
- if (!maxFramebuffers[id]) {
499
- texture = weights[id].maxTexture || this._getMinMaxTexture("".concat(id, "-maxTexture"));
500
- maxFramebuffers[id] = (0, _resourceUtils.getFramebuffer)(this.gl, {
501
- id: "".concat(id, "-maxFb"),
502
- texture: texture
503
- });
504
- }
542
+ if (needMax) {
543
+ if (!maxFramebuffers[id]) {
544
+ texture = weights[id].maxTexture || this._getMinMaxTexture("".concat(id, "-maxTexture"));
545
+ maxFramebuffers[id] = (0, _resourceUtils.getFramebuffer)(this.gl, {
546
+ id: "".concat(id, "-maxFb"),
547
+ texture: texture
548
+ });
505
549
  }
506
550
  }
507
551
  }
508
552
  }
509
553
  }
510
- }, {
511
- key: "_getMinMaxTexture",
512
- value: function _getMinMaxTexture(name) {
513
- var resources = this.state.resources;
514
-
515
- if (!resources[name]) {
516
- resources[name] = (0, _resourceUtils.getFloatTexture)(this.gl, {
517
- id: "resourceName"
518
- });
519
- }
554
+ };
520
555
 
521
- return resources[name];
556
+ _proto._getMinMaxTexture = function _getMinMaxTexture(name) {
557
+ var resources = this.state.resources;
558
+
559
+ if (!resources[name]) {
560
+ resources[name] = (0, _resourceUtils.getFloatTexture)(this.gl, {
561
+ id: "resourceName"
562
+ });
522
563
  }
523
- }, {
524
- key: "_setupModels",
525
- value: function _setupModels() {
526
- var _this$gridAggregation;
527
-
528
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
529
- _ref$numCol = _ref.numCol,
530
- numCol = _ref$numCol === void 0 ? 0 : _ref$numCol,
531
- _ref$numRow = _ref.numRow,
532
- numRow = _ref$numRow === void 0 ? 0 : _ref$numRow;
533
-
534
- var gl = this.gl;
535
- var shaderOptions = this.state.shaderOptions;
536
- (_this$gridAggregation = this.gridAggregationModel) === null || _this$gridAggregation === void 0 ? void 0 : _this$gridAggregation.delete();
537
- this.gridAggregationModel = getAggregationModel(gl, shaderOptions);
538
-
539
- if (!this.allAggregationModel) {
540
- var instanceCount = numCol * numRow;
541
- this.allAggregationModel = getAllAggregationModel(gl, instanceCount);
542
- }
564
+
565
+ return resources[name];
566
+ };
567
+
568
+ _proto._setupModels = function _setupModels() {
569
+ var _this$gridAggregation;
570
+
571
+ var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
572
+ _ref3$numCol = _ref3.numCol,
573
+ numCol = _ref3$numCol === void 0 ? 0 : _ref3$numCol,
574
+ _ref3$numRow = _ref3.numRow,
575
+ numRow = _ref3$numRow === void 0 ? 0 : _ref3$numRow;
576
+
577
+ var gl = this.gl;
578
+ var shaderOptions = this.state.shaderOptions;
579
+ (_this$gridAggregation = this.gridAggregationModel) === null || _this$gridAggregation === void 0 ? void 0 : _this$gridAggregation.delete();
580
+ this.gridAggregationModel = getAggregationModel(gl, shaderOptions);
581
+
582
+ if (!this.allAggregationModel) {
583
+ var instanceCount = numCol * numRow;
584
+ this.allAggregationModel = getAllAggregationModel(gl, instanceCount);
543
585
  }
544
- }, {
545
- key: "_setupWeightAttributes",
546
- value: function _setupWeightAttributes(opts) {
547
- var weightAttributes = this.state.weightAttributes;
548
- var weights = opts.weights;
549
-
550
- for (var id in weights) {
551
- weightAttributes[id] = opts.attributes[id];
552
- }
586
+ };
587
+
588
+ _proto._setupWeightAttributes = function _setupWeightAttributes(opts) {
589
+ var weightAttributes = this.state.weightAttributes;
590
+ var weights = opts.weights;
591
+
592
+ for (var id in weights) {
593
+ weightAttributes[id] = opts.attributes[id];
553
594
  }
554
- }, {
555
- key: "_trackGPUResultBuffers",
556
- value: function _trackGPUResultBuffers(results, weights) {
557
- var resources = this.state.resources;
595
+ };
558
596
 
559
- for (var id in results) {
560
- if (results[id]) {
561
- var _iterator = _createForOfIteratorHelper(BUFFER_NAMES),
562
- _step;
597
+ _proto._trackGPUResultBuffers = function _trackGPUResultBuffers(results, weights) {
598
+ var resources = this.state.resources;
563
599
 
564
- try {
565
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
566
- var bufferName = _step.value;
600
+ for (var id in results) {
601
+ if (results[id]) {
602
+ var _iterator = _createForOfIteratorHelper(BUFFER_NAMES),
603
+ _step;
567
604
 
568
- if (results[id][bufferName] && weights[id][bufferName] !== results[id][bufferName]) {
569
- var name = "gpu-result-".concat(id, "-").concat(bufferName);
605
+ try {
606
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
607
+ var bufferName = _step.value;
570
608
 
571
- if (resources[name]) {
572
- resources[name].delete();
573
- }
609
+ if (results[id][bufferName] && weights[id][bufferName] !== results[id][bufferName]) {
610
+ var name = "gpu-result-".concat(id, "-").concat(bufferName);
574
611
 
575
- resources[name] = results[id][bufferName];
612
+ if (resources[name]) {
613
+ resources[name].delete();
576
614
  }
615
+
616
+ resources[name] = results[id][bufferName];
577
617
  }
578
- } catch (err) {
579
- _iterator.e(err);
580
- } finally {
581
- _iterator.f();
582
618
  }
619
+ } catch (err) {
620
+ _iterator.e(err);
621
+ } finally {
622
+ _iterator.f();
583
623
  }
584
624
  }
585
625
  }
586
- }, {
587
- key: "_updateModels",
588
- value: function _updateModels(opts) {
589
- var vertexCount = opts.vertexCount,
590
- attributes = opts.attributes,
591
- numCol = opts.numCol,
592
- numRow = opts.numRow;
593
- var modelDirty = this.state.modelDirty;
594
-
595
- if (modelDirty) {
596
- this._setupModels(opts);
597
-
598
- this.setState({
599
- modelDirty: false
600
- });
601
- }
602
-
603
- this._setupWeightAttributes(opts);
604
-
605
- this.gridAggregationModel.setVertexCount(vertexCount);
606
- this.gridAggregationModel.setAttributes(attributes);
607
- this.allAggregationModel.setInstanceCount(numCol * numRow);
608
- }
609
- }], [{
610
- key: "getAggregationData",
611
- value: function getAggregationData(_ref2) {
612
- var aggregationData = _ref2.aggregationData,
613
- maxData = _ref2.maxData,
614
- minData = _ref2.minData,
615
- maxMinData = _ref2.maxMinData,
616
- pixelIndex = _ref2.pixelIndex;
617
- var index = pixelIndex * _gpuGridAggregatorConstants.PIXEL_SIZE;
618
- var results = {};
619
-
620
- if (aggregationData) {
621
- results.cellCount = aggregationData[index + 3];
622
- results.cellWeight = aggregationData[index];
623
- }
626
+ };
624
627
 
625
- if (maxMinData) {
626
- results.maxCellWieght = maxMinData[0];
627
- results.minCellWeight = maxMinData[3];
628
- } else {
629
- if (maxData) {
630
- results.maxCellWieght = maxData[0];
631
- results.totalCount = maxData[3];
632
- }
628
+ _proto._updateModels = function _updateModels(opts) {
629
+ var vertexCount = opts.vertexCount,
630
+ attributes = opts.attributes,
631
+ numCol = opts.numCol,
632
+ numRow = opts.numRow;
633
+ var modelDirty = this.state.modelDirty;
633
634
 
634
- if (minData) {
635
- results.minCellWeight = minData[0];
636
- results.totalCount = maxData[3];
637
- }
638
- }
635
+ if (modelDirty) {
636
+ this._setupModels(opts);
639
637
 
640
- return results;
638
+ this.setState({
639
+ modelDirty: false
640
+ });
641
641
  }
642
- }, {
643
- key: "getCellData",
644
- value: function getCellData(_ref3) {
645
- var countsData = _ref3.countsData,
646
- _ref3$size = _ref3.size,
647
- size = _ref3$size === void 0 ? 1 : _ref3$size;
648
- var numCells = countsData.length / 4;
649
- var cellWeights = new Float32Array(numCells * size);
650
- var cellCounts = new Uint32Array(numCells);
651
-
652
- for (var i = 0; i < numCells; i++) {
653
- for (var sizeIndex = 0; sizeIndex < size; sizeIndex++) {
654
- cellWeights[i * size + sizeIndex] = countsData[i * 4 + sizeIndex];
655
- }
656
642
 
657
- cellCounts[i] = countsData[i * 4 + 3];
658
- }
643
+ this._setupWeightAttributes(opts);
644
+
645
+ this.gridAggregationModel.setVertexCount(vertexCount);
646
+ this.gridAggregationModel.setAttributes(attributes);
647
+ this.allAggregationModel.setInstanceCount(numCol * numRow);
648
+ };
659
649
 
660
- return {
661
- cellCounts: cellCounts,
662
- cellWeights: cellWeights
663
- };
664
- }
665
- }, {
666
- key: "isSupported",
667
- value: function isSupported(gl) {
668
- return (0, _core.hasFeatures)(gl, REQUIRED_FEATURES);
669
- }
670
- }]);
671
650
  return GPUGridAggregator;
672
651
  }();
673
652