@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
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
 
14
14
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
15
15
 
@@ -19,8 +19,6 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
19
19
 
20
20
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
21
 
22
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
22
  var _core = require("@luma.gl/core");
25
23
 
26
24
  var _core2 = require("@deck.gl/core");
@@ -105,321 +103,313 @@ var GPUGridLayer = function (_GridAggregationLayer) {
105
103
  return _super.apply(this, arguments);
106
104
  }
107
105
 
108
- (0, _createClass2.default)(GPUGridLayer, [{
109
- key: "initializeState",
110
- value: function initializeState(_ref) {
111
- var _attributeManager$add;
106
+ var _proto = GPUGridLayer.prototype;
112
107
 
113
- var gl = _ref.gl;
108
+ _proto.initializeState = function initializeState(_ref) {
109
+ var _attributeManager$add;
114
110
 
115
- var isSupported = _gpuGridAggregator.default.isSupported(gl);
111
+ var gl = _ref.gl;
116
112
 
117
- if (!isSupported) {
118
- _core2.log.error('GPUGridLayer is not supported on this browser, use GridLayer instead')();
119
- }
113
+ var isSupported = _gpuGridAggregator.default.isSupported(gl);
120
114
 
121
- (0, _get2.default)((0, _getPrototypeOf2.default)(GPUGridLayer.prototype), "initializeAggregationLayer", this).call(this, {
122
- dimensions: DIMENSIONS
123
- });
124
- this.setState({
125
- gpuAggregation: true,
126
- projectPoints: false,
127
- isSupported: isSupported,
128
- weights: {
129
- color: {
130
- needMin: true,
131
- needMax: true,
132
- combineMaxMin: true,
133
- maxMinBuffer: new _core.Buffer(gl, {
134
- byteLength: 4 * 4,
135
- accessor: {
136
- size: 4,
137
- type: 5126,
138
- divisor: 1
139
- }
140
- })
141
- },
142
- elevation: {
143
- needMin: true,
144
- needMax: true,
145
- combineMaxMin: true,
146
- maxMinBuffer: new _core.Buffer(gl, {
147
- byteLength: 4 * 4,
148
- accessor: {
149
- size: 4,
150
- type: 5126,
151
- divisor: 1
152
- }
153
- })
154
- }
115
+ if (!isSupported) {
116
+ _core2.log.error('GPUGridLayer is not supported on this browser, use GridLayer instead')();
117
+ }
118
+
119
+ (0, _get2.default)((0, _getPrototypeOf2.default)(GPUGridLayer.prototype), "initializeAggregationLayer", this).call(this, {
120
+ dimensions: DIMENSIONS
121
+ });
122
+ this.setState({
123
+ gpuAggregation: true,
124
+ projectPoints: false,
125
+ isSupported: isSupported,
126
+ weights: {
127
+ color: {
128
+ needMin: true,
129
+ needMax: true,
130
+ combineMaxMin: true,
131
+ maxMinBuffer: new _core.Buffer(gl, {
132
+ byteLength: 4 * 4,
133
+ accessor: {
134
+ size: 4,
135
+ type: 5126,
136
+ divisor: 1
137
+ }
138
+ })
155
139
  },
156
- positionAttributeName: 'positions'
157
- });
158
- var attributeManager = this.getAttributeManager();
159
- attributeManager.add((_attributeManager$add = {}, (0, _defineProperty2.default)(_attributeManager$add, POSITION_ATTRIBUTE_NAME, {
160
- size: 3,
161
- accessor: 'getPosition',
162
- type: 5130,
163
- fp64: this.use64bitPositions()
164
- }), (0, _defineProperty2.default)(_attributeManager$add, "color", {
165
- size: 3,
166
- accessor: 'getColorWeight'
167
- }), (0, _defineProperty2.default)(_attributeManager$add, "elevation", {
168
- size: 3,
169
- accessor: 'getElevationWeight'
170
- }), _attributeManager$add));
140
+ elevation: {
141
+ needMin: true,
142
+ needMax: true,
143
+ combineMaxMin: true,
144
+ maxMinBuffer: new _core.Buffer(gl, {
145
+ byteLength: 4 * 4,
146
+ accessor: {
147
+ size: 4,
148
+ type: 5126,
149
+ divisor: 1
150
+ }
151
+ })
152
+ }
153
+ },
154
+ positionAttributeName: 'positions'
155
+ });
156
+ var attributeManager = this.getAttributeManager();
157
+ attributeManager.add((_attributeManager$add = {}, (0, _defineProperty2.default)(_attributeManager$add, POSITION_ATTRIBUTE_NAME, {
158
+ size: 3,
159
+ accessor: 'getPosition',
160
+ type: 5130,
161
+ fp64: this.use64bitPositions()
162
+ }), (0, _defineProperty2.default)(_attributeManager$add, "color", {
163
+ size: 3,
164
+ accessor: 'getColorWeight'
165
+ }), (0, _defineProperty2.default)(_attributeManager$add, "elevation", {
166
+ size: 3,
167
+ accessor: 'getElevationWeight'
168
+ }), _attributeManager$add));
169
+ };
170
+
171
+ _proto.updateState = function updateState(opts) {
172
+ if (this.state.isSupported === false) {
173
+ return;
171
174
  }
172
- }, {
173
- key: "updateState",
174
- value: function updateState(opts) {
175
- if (this.state.isSupported === false) {
176
- return;
177
- }
178
175
 
179
- (0, _get2.default)((0, _getPrototypeOf2.default)(GPUGridLayer.prototype), "updateState", this).call(this, opts);
180
- var aggregationDirty = this.state.aggregationDirty;
176
+ (0, _get2.default)((0, _getPrototypeOf2.default)(GPUGridLayer.prototype), "updateState", this).call(this, opts);
177
+ var aggregationDirty = this.state.aggregationDirty;
181
178
 
182
- if (aggregationDirty) {
183
- this.setState({
184
- gridHash: null
185
- });
186
- }
187
- }
188
- }, {
189
- key: "getHashKeyForIndex",
190
- value: function getHashKeyForIndex(index) {
191
- var _this$state = this.state,
192
- numRow = _this$state.numRow,
193
- numCol = _this$state.numCol,
194
- boundingBox = _this$state.boundingBox,
195
- gridOffset = _this$state.gridOffset;
196
- var gridSize = [numCol, numRow];
197
- var gridOrigin = [boundingBox.xMin, boundingBox.yMin];
198
- var cellSize = [gridOffset.xOffset, gridOffset.yOffset];
199
- var yIndex = Math.floor(index / gridSize[0]);
200
- var xIndex = index - yIndex * gridSize[0];
201
- var latIdx = Math.floor((yIndex * cellSize[1] + gridOrigin[1] + 90 + cellSize[1] / 2) / cellSize[1]);
202
- var lonIdx = Math.floor((xIndex * cellSize[0] + gridOrigin[0] + 180 + cellSize[0] / 2) / cellSize[0]);
203
- return "".concat(latIdx, "-").concat(lonIdx);
204
- }
205
- }, {
206
- key: "getPositionForIndex",
207
- value: function getPositionForIndex(index) {
208
- var _this$state2 = this.state,
209
- numRow = _this$state2.numRow,
210
- numCol = _this$state2.numCol,
211
- boundingBox = _this$state2.boundingBox,
212
- gridOffset = _this$state2.gridOffset;
213
- var gridSize = [numCol, numRow];
214
- var gridOrigin = [boundingBox.xMin, boundingBox.yMin];
215
- var cellSize = [gridOffset.xOffset, gridOffset.yOffset];
216
- var yIndex = Math.floor(index / gridSize[0]);
217
- var xIndex = index - yIndex * gridSize[0];
218
- var yPos = yIndex * cellSize[1] + gridOrigin[1];
219
- var xPos = xIndex * cellSize[0] + gridOrigin[0];
220
- return [xPos, yPos];
179
+ if (aggregationDirty) {
180
+ this.setState({
181
+ gridHash: null
182
+ });
221
183
  }
222
- }, {
223
- key: "getPickingInfo",
224
- value: function getPickingInfo(_ref2) {
225
- var info = _ref2.info,
226
- mode = _ref2.mode;
227
- var index = info.index;
228
- var object = null;
229
-
230
- if (index >= 0) {
231
- var gpuGridAggregator = this.state.gpuGridAggregator;
232
- var position = this.getPositionForIndex(index);
233
-
234
- var colorInfo = _gpuGridAggregator.default.getAggregationData(_objectSpread({
235
- pixelIndex: index
236
- }, gpuGridAggregator.getData('color')));
237
-
238
- var elevationInfo = _gpuGridAggregator.default.getAggregationData(_objectSpread({
239
- pixelIndex: index
240
- }, gpuGridAggregator.getData('elevation')));
241
-
242
- object = {
243
- colorValue: colorInfo.cellWeight,
244
- elevationValue: elevationInfo.cellWeight,
245
- count: colorInfo.cellCount || elevationInfo.cellCount,
246
- position: position,
247
- totalCount: colorInfo.totalCount || elevationInfo.totalCount
248
- };
249
-
250
- if (mode !== 'hover') {
251
- var props = this.props;
252
- var gridHash = this.state.gridHash;
253
-
254
- if (!gridHash) {
255
- var _this$state3 = this.state,
256
- gridOffset = _this$state3.gridOffset,
257
- translation = _this$state3.translation,
258
- boundingBox = _this$state3.boundingBox;
259
- var viewport = this.context.viewport;
260
- var attributes = this.getAttributes();
261
- var cpuAggregation = (0, _gridAggregator.pointToDensityGridDataCPU)(props, {
262
- gridOffset: gridOffset,
263
- attributes: attributes,
264
- viewport: viewport,
265
- translation: translation,
266
- boundingBox: boundingBox
267
- });
268
- gridHash = cpuAggregation.gridHash;
269
- this.setState({
270
- gridHash: gridHash
271
- });
272
- }
273
-
274
- var key = this.getHashKeyForIndex(index);
275
- var cpuAggregationData = gridHash[key];
276
- Object.assign(object, cpuAggregationData);
184
+ };
185
+
186
+ _proto.getHashKeyForIndex = function getHashKeyForIndex(index) {
187
+ var _this$state = this.state,
188
+ numRow = _this$state.numRow,
189
+ numCol = _this$state.numCol,
190
+ boundingBox = _this$state.boundingBox,
191
+ gridOffset = _this$state.gridOffset;
192
+ var gridSize = [numCol, numRow];
193
+ var gridOrigin = [boundingBox.xMin, boundingBox.yMin];
194
+ var cellSize = [gridOffset.xOffset, gridOffset.yOffset];
195
+ var yIndex = Math.floor(index / gridSize[0]);
196
+ var xIndex = index - yIndex * gridSize[0];
197
+ var latIdx = Math.floor((yIndex * cellSize[1] + gridOrigin[1] + 90 + cellSize[1] / 2) / cellSize[1]);
198
+ var lonIdx = Math.floor((xIndex * cellSize[0] + gridOrigin[0] + 180 + cellSize[0] / 2) / cellSize[0]);
199
+ return "".concat(latIdx, "-").concat(lonIdx);
200
+ };
201
+
202
+ _proto.getPositionForIndex = function getPositionForIndex(index) {
203
+ var _this$state2 = this.state,
204
+ numRow = _this$state2.numRow,
205
+ numCol = _this$state2.numCol,
206
+ boundingBox = _this$state2.boundingBox,
207
+ gridOffset = _this$state2.gridOffset;
208
+ var gridSize = [numCol, numRow];
209
+ var gridOrigin = [boundingBox.xMin, boundingBox.yMin];
210
+ var cellSize = [gridOffset.xOffset, gridOffset.yOffset];
211
+ var yIndex = Math.floor(index / gridSize[0]);
212
+ var xIndex = index - yIndex * gridSize[0];
213
+ var yPos = yIndex * cellSize[1] + gridOrigin[1];
214
+ var xPos = xIndex * cellSize[0] + gridOrigin[0];
215
+ return [xPos, yPos];
216
+ };
217
+
218
+ _proto.getPickingInfo = function getPickingInfo(_ref2) {
219
+ var info = _ref2.info,
220
+ mode = _ref2.mode;
221
+ var index = info.index;
222
+ var object = null;
223
+
224
+ if (index >= 0) {
225
+ var gpuGridAggregator = this.state.gpuGridAggregator;
226
+ var position = this.getPositionForIndex(index);
227
+
228
+ var colorInfo = _gpuGridAggregator.default.getAggregationData(_objectSpread({
229
+ pixelIndex: index
230
+ }, gpuGridAggregator.getData('color')));
231
+
232
+ var elevationInfo = _gpuGridAggregator.default.getAggregationData(_objectSpread({
233
+ pixelIndex: index
234
+ }, gpuGridAggregator.getData('elevation')));
235
+
236
+ object = {
237
+ colorValue: colorInfo.cellWeight,
238
+ elevationValue: elevationInfo.cellWeight,
239
+ count: colorInfo.cellCount || elevationInfo.cellCount,
240
+ position: position,
241
+ totalCount: colorInfo.totalCount || elevationInfo.totalCount
242
+ };
243
+
244
+ if (mode !== 'hover') {
245
+ var props = this.props;
246
+ var gridHash = this.state.gridHash;
247
+
248
+ if (!gridHash) {
249
+ var _this$state3 = this.state,
250
+ gridOffset = _this$state3.gridOffset,
251
+ translation = _this$state3.translation,
252
+ boundingBox = _this$state3.boundingBox;
253
+ var viewport = this.context.viewport;
254
+ var attributes = this.getAttributes();
255
+ var cpuAggregation = (0, _gridAggregator.pointToDensityGridDataCPU)(props, {
256
+ gridOffset: gridOffset,
257
+ attributes: attributes,
258
+ viewport: viewport,
259
+ translation: translation,
260
+ boundingBox: boundingBox
261
+ });
262
+ gridHash = cpuAggregation.gridHash;
263
+ this.setState({
264
+ gridHash: gridHash
265
+ });
277
266
  }
278
- }
279
267
 
280
- info.picked = Boolean(object);
281
- info.object = object;
282
- return info;
283
- }
284
- }, {
285
- key: "renderLayers",
286
- value: function renderLayers() {
287
- if (!this.state.isSupported) {
288
- return null;
268
+ var key = this.getHashKeyForIndex(index);
269
+ var cpuAggregationData = gridHash[key];
270
+ Object.assign(object, cpuAggregationData);
289
271
  }
290
-
291
- var _this$props = this.props,
292
- elevationScale = _this$props.elevationScale,
293
- extruded = _this$props.extruded,
294
- cellSizeMeters = _this$props.cellSize,
295
- coverage = _this$props.coverage,
296
- material = _this$props.material,
297
- elevationRange = _this$props.elevationRange,
298
- colorDomain = _this$props.colorDomain,
299
- elevationDomain = _this$props.elevationDomain;
300
- var _this$state4 = this.state,
301
- weights = _this$state4.weights,
302
- numRow = _this$state4.numRow,
303
- numCol = _this$state4.numCol,
304
- gridOrigin = _this$state4.gridOrigin,
305
- gridOffset = _this$state4.gridOffset;
306
- var color = weights.color,
307
- elevation = weights.elevation;
308
- var colorRange = (0, _colorUtils.colorRangeToFlatArray)(this.props.colorRange);
309
- var SubLayerClass = this.getSubLayerClass('gpu-grid-cell', _gpuGridCellLayer.default);
310
- return new SubLayerClass({
311
- gridSize: [numCol, numRow],
312
- gridOrigin: gridOrigin,
313
- gridOffset: [gridOffset.xOffset, gridOffset.yOffset],
314
- colorRange: colorRange,
315
- elevationRange: elevationRange,
316
- colorDomain: colorDomain,
317
- elevationDomain: elevationDomain,
318
- cellSize: cellSizeMeters,
319
- coverage: coverage,
320
- material: material,
321
- elevationScale: elevationScale,
322
- extruded: extruded
323
- }, this.getSubLayerProps({
324
- id: 'gpu-grid-cell'
325
- }), {
326
- data: {
327
- attributes: {
328
- colors: color.aggregationBuffer,
329
- elevations: elevation.aggregationBuffer
330
- }
331
- },
332
- colorMaxMinBuffer: color.maxMinBuffer,
333
- elevationMaxMinBuffer: elevation.maxMinBuffer,
334
- numInstances: numCol * numRow
335
- });
336
272
  }
337
- }, {
338
- key: "finalizeState",
339
- value: function finalizeState(context) {
340
- var _this$state$weights = this.state.weights,
341
- color = _this$state$weights.color,
342
- elevation = _this$state$weights.elevation;
343
- [color, elevation].forEach(function (weight) {
344
- var aggregationBuffer = weight.aggregationBuffer,
345
- maxMinBuffer = weight.maxMinBuffer;
346
- maxMinBuffer.delete();
347
- aggregationBuffer === null || aggregationBuffer === void 0 ? void 0 : aggregationBuffer.delete();
348
- });
349
- (0, _get2.default)((0, _getPrototypeOf2.default)(GPUGridLayer.prototype), "finalizeState", this).call(this, context);
350
- }
351
- }, {
352
- key: "updateAggregationState",
353
- value: function updateAggregationState(opts) {
354
- var props = opts.props,
355
- oldProps = opts.oldProps;
356
- var cellSize = props.cellSize,
357
- coordinateSystem = props.coordinateSystem;
358
- var viewport = this.context.viewport;
359
- var cellSizeChanged = oldProps.cellSize !== cellSize;
360
- var dimensions = this.state.dimensions;
361
- var positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
362
- var attributesChanged = positionsChanged || this.isAttributeChanged();
363
- var boundingBox = this.state.boundingBox;
364
-
365
- if (positionsChanged) {
366
- boundingBox = (0, _gridAggregationUtils.getBoundingBox)(this.getAttributes(), this.getNumInstances());
367
- this.setState({
368
- boundingBox: boundingBox
369
- });
370
- }
371
273
 
372
- if (positionsChanged || cellSizeChanged) {
373
- var _getGridParams = (0, _gridAggregationUtils.getGridParams)(boundingBox, cellSize, viewport, coordinateSystem),
374
- gridOffset = _getGridParams.gridOffset,
375
- translation = _getGridParams.translation,
376
- width = _getGridParams.width,
377
- height = _getGridParams.height,
378
- numCol = _getGridParams.numCol,
379
- numRow = _getGridParams.numRow;
380
-
381
- this.allocateResources(numRow, numCol);
382
- this.setState({
383
- gridOffset: gridOffset,
384
- translation: translation,
385
- gridOrigin: [-1 * translation[0], -1 * translation[1]],
386
- width: width,
387
- height: height,
388
- numCol: numCol,
389
- numRow: numRow
390
- });
391
- }
274
+ info.picked = Boolean(object);
275
+ info.object = object;
276
+ return info;
277
+ };
278
+
279
+ _proto.renderLayers = function renderLayers() {
280
+ if (!this.state.isSupported) {
281
+ return null;
282
+ }
392
283
 
393
- var aggregationDataDirty = attributesChanged || this.isAggregationDirty(opts, {
394
- dimension: dimensions.data,
395
- compareAll: true
284
+ var _this$props = this.props,
285
+ elevationScale = _this$props.elevationScale,
286
+ extruded = _this$props.extruded,
287
+ cellSizeMeters = _this$props.cellSize,
288
+ coverage = _this$props.coverage,
289
+ material = _this$props.material,
290
+ elevationRange = _this$props.elevationRange,
291
+ colorDomain = _this$props.colorDomain,
292
+ elevationDomain = _this$props.elevationDomain;
293
+ var _this$state4 = this.state,
294
+ weights = _this$state4.weights,
295
+ numRow = _this$state4.numRow,
296
+ numCol = _this$state4.numCol,
297
+ gridOrigin = _this$state4.gridOrigin,
298
+ gridOffset = _this$state4.gridOffset;
299
+ var color = weights.color,
300
+ elevation = weights.elevation;
301
+ var colorRange = (0, _colorUtils.colorRangeToFlatArray)(this.props.colorRange);
302
+ var SubLayerClass = this.getSubLayerClass('gpu-grid-cell', _gpuGridCellLayer.default);
303
+ return new SubLayerClass({
304
+ gridSize: [numCol, numRow],
305
+ gridOrigin: gridOrigin,
306
+ gridOffset: [gridOffset.xOffset, gridOffset.yOffset],
307
+ colorRange: colorRange,
308
+ elevationRange: elevationRange,
309
+ colorDomain: colorDomain,
310
+ elevationDomain: elevationDomain,
311
+ cellSize: cellSizeMeters,
312
+ coverage: coverage,
313
+ material: material,
314
+ elevationScale: elevationScale,
315
+ extruded: extruded
316
+ }, this.getSubLayerProps({
317
+ id: 'gpu-grid-cell'
318
+ }), {
319
+ data: {
320
+ attributes: {
321
+ colors: color.aggregationBuffer,
322
+ elevations: elevation.aggregationBuffer
323
+ }
324
+ },
325
+ colorMaxMinBuffer: color.maxMinBuffer,
326
+ elevationMaxMinBuffer: elevation.maxMinBuffer,
327
+ numInstances: numCol * numRow
328
+ });
329
+ };
330
+
331
+ _proto.finalizeState = function finalizeState(context) {
332
+ var _this$state$weights = this.state.weights,
333
+ color = _this$state$weights.color,
334
+ elevation = _this$state$weights.elevation;
335
+ [color, elevation].forEach(function (weight) {
336
+ var aggregationBuffer = weight.aggregationBuffer,
337
+ maxMinBuffer = weight.maxMinBuffer;
338
+ maxMinBuffer.delete();
339
+ aggregationBuffer === null || aggregationBuffer === void 0 ? void 0 : aggregationBuffer.delete();
340
+ });
341
+ (0, _get2.default)((0, _getPrototypeOf2.default)(GPUGridLayer.prototype), "finalizeState", this).call(this, context);
342
+ };
343
+
344
+ _proto.updateAggregationState = function updateAggregationState(opts) {
345
+ var props = opts.props,
346
+ oldProps = opts.oldProps;
347
+ var cellSize = props.cellSize,
348
+ coordinateSystem = props.coordinateSystem;
349
+ var viewport = this.context.viewport;
350
+ var cellSizeChanged = oldProps.cellSize !== cellSize;
351
+ var dimensions = this.state.dimensions;
352
+ var positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
353
+ var attributesChanged = positionsChanged || this.isAttributeChanged();
354
+ var boundingBox = this.state.boundingBox;
355
+
356
+ if (positionsChanged) {
357
+ boundingBox = (0, _gridAggregationUtils.getBoundingBox)(this.getAttributes(), this.getNumInstances());
358
+ this.setState({
359
+ boundingBox: boundingBox
396
360
  });
361
+ }
397
362
 
398
- if (aggregationDataDirty) {
399
- this._updateAccessors(opts);
400
- }
363
+ if (positionsChanged || cellSizeChanged) {
364
+ var _getGridParams = (0, _gridAggregationUtils.getGridParams)(boundingBox, cellSize, viewport, coordinateSystem),
365
+ gridOffset = _getGridParams.gridOffset,
366
+ translation = _getGridParams.translation,
367
+ width = _getGridParams.width,
368
+ height = _getGridParams.height,
369
+ numCol = _getGridParams.numCol,
370
+ numRow = _getGridParams.numRow;
401
371
 
372
+ this.allocateResources(numRow, numCol);
402
373
  this.setState({
403
- aggregationDataDirty: aggregationDataDirty
374
+ gridOffset: gridOffset,
375
+ translation: translation,
376
+ gridOrigin: [-1 * translation[0], -1 * translation[1]],
377
+ width: width,
378
+ height: height,
379
+ numCol: numCol,
380
+ numRow: numRow
404
381
  });
405
382
  }
406
- }, {
407
- key: "_updateAccessors",
408
- value: function _updateAccessors(opts) {
409
- var _opts$props = opts.props,
410
- colorAggregation = _opts$props.colorAggregation,
411
- elevationAggregation = _opts$props.elevationAggregation;
412
- var _this$state$weights2 = this.state.weights,
413
- color = _this$state$weights2.color,
414
- elevation = _this$state$weights2.elevation;
415
- color.operation = _aggregationOperationUtils.AGGREGATION_OPERATION[colorAggregation];
416
- elevation.operation = _aggregationOperationUtils.AGGREGATION_OPERATION[elevationAggregation];
383
+
384
+ var aggregationDataDirty = attributesChanged || this.isAggregationDirty(opts, {
385
+ dimension: dimensions.data,
386
+ compareAll: true
387
+ });
388
+
389
+ if (aggregationDataDirty) {
390
+ this._updateAccessors(opts);
417
391
  }
418
- }]);
392
+
393
+ this.setState({
394
+ aggregationDataDirty: aggregationDataDirty
395
+ });
396
+ };
397
+
398
+ _proto._updateAccessors = function _updateAccessors(opts) {
399
+ var _opts$props = opts.props,
400
+ colorAggregation = _opts$props.colorAggregation,
401
+ elevationAggregation = _opts$props.elevationAggregation;
402
+ var _this$state$weights2 = this.state.weights,
403
+ color = _this$state$weights2.color,
404
+ elevation = _this$state$weights2.elevation;
405
+ color.operation = _aggregationOperationUtils.AGGREGATION_OPERATION[colorAggregation];
406
+ elevation.operation = _aggregationOperationUtils.AGGREGATION_OPERATION[elevationAggregation];
407
+ };
408
+
419
409
  return GPUGridLayer;
420
410
  }(_gridAggregationLayer.default);
421
411
 
422
412
  exports.default = GPUGridLayer;
423
- (0, _defineProperty2.default)(GPUGridLayer, "layerName", 'GPUGridLayer');
424
- (0, _defineProperty2.default)(GPUGridLayer, "defaultProps", defaultProps);
413
+ GPUGridLayer.layerName = 'GPUGridLayer';
414
+ GPUGridLayer.defaultProps = defaultProps;
425
415
  //# sourceMappingURL=gpu-grid-layer.js.map