@deck.gl/aggregation-layers 8.10.0-alpha.7 → 9.0.0-alpha.3

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 (184) hide show
  1. package/dist/dist.dev.js +9369 -356
  2. package/dist/es5/aggregation-layer.js +4 -6
  3. package/dist/es5/aggregation-layer.js.map +1 -1
  4. package/dist/es5/contour-layer/contour-layer.js +13 -2
  5. package/dist/es5/contour-layer/contour-layer.js.map +1 -1
  6. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +12 -1
  7. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
  8. package/dist/es5/cpu-grid-layer/grid-aggregator.js +12 -8
  9. package/dist/es5/cpu-grid-layer/grid-aggregator.js.map +1 -1
  10. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +27 -13
  11. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
  12. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +19 -10
  13. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
  14. package/dist/es5/grid-aggregation-layer.js +7 -9
  15. package/dist/es5/grid-aggregation-layer.js.map +1 -1
  16. package/dist/es5/grid-layer/grid-layer.js +1 -1
  17. package/dist/es5/grid-layer/grid-layer.js.map +1 -1
  18. package/dist/es5/heatmap-layer/heatmap-layer-utils.js +3 -3
  19. package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +1 -1
  20. package/dist/es5/heatmap-layer/heatmap-layer.js +58 -55
  21. package/dist/es5/heatmap-layer/heatmap-layer.js.map +1 -1
  22. package/dist/es5/heatmap-layer/triangle-layer.js +22 -12
  23. package/dist/es5/heatmap-layer/triangle-layer.js.map +1 -1
  24. package/dist/es5/hexagon-layer/hexagon-aggregator.js.map +1 -1
  25. package/dist/es5/hexagon-layer/hexagon-layer.js +2 -0
  26. package/dist/es5/hexagon-layer/hexagon-layer.js.map +1 -1
  27. package/dist/es5/index.js.map +1 -1
  28. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +23 -20
  29. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
  30. package/dist/es5/screen-grid-layer/screen-grid-layer.js +6 -6
  31. package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +1 -1
  32. package/dist/es5/utils/aggregation-operation-utils.js.map +1 -1
  33. package/dist/es5/utils/bin-sorter.js.map +1 -1
  34. package/dist/es5/utils/cpu-aggregator.js +11 -7
  35. package/dist/es5/utils/cpu-aggregator.js.map +1 -1
  36. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +7 -2
  37. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +1 -1
  38. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +83 -60
  39. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
  40. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +3 -3
  41. package/dist/es5/utils/grid-aggregation-utils.js.map +1 -1
  42. package/dist/es5/utils/prop-utils.js.map +1 -1
  43. package/dist/es5/utils/resource-utils.js +12 -23
  44. package/dist/es5/utils/resource-utils.js.map +1 -1
  45. package/dist/esm/aggregation-layer.js +4 -5
  46. package/dist/esm/aggregation-layer.js.map +1 -1
  47. package/dist/esm/contour-layer/contour-layer.js +7 -1
  48. package/dist/esm/contour-layer/contour-layer.js.map +1 -1
  49. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +6 -0
  50. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
  51. package/dist/esm/cpu-grid-layer/grid-aggregator.js +2 -1
  52. package/dist/esm/cpu-grid-layer/grid-aggregator.js.map +1 -1
  53. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +19 -10
  54. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
  55. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +13 -10
  56. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
  57. package/dist/esm/grid-aggregation-layer.js +4 -8
  58. package/dist/esm/grid-aggregation-layer.js.map +1 -1
  59. package/dist/esm/grid-layer/grid-layer.js +1 -1
  60. package/dist/esm/grid-layer/grid-layer.js.map +1 -1
  61. package/dist/esm/heatmap-layer/heatmap-layer-utils.js +3 -3
  62. package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +1 -1
  63. package/dist/esm/heatmap-layer/heatmap-layer.js +40 -58
  64. package/dist/esm/heatmap-layer/heatmap-layer.js.map +1 -1
  65. package/dist/esm/heatmap-layer/triangle-layer.js +13 -7
  66. package/dist/esm/heatmap-layer/triangle-layer.js.map +1 -1
  67. package/dist/esm/hexagon-layer/hexagon-aggregator.js.map +1 -1
  68. package/dist/esm/hexagon-layer/hexagon-layer.js +1 -0
  69. package/dist/esm/hexagon-layer/hexagon-layer.js.map +1 -1
  70. package/dist/esm/index.js.map +1 -1
  71. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +21 -24
  72. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
  73. package/dist/esm/screen-grid-layer/screen-grid-layer.js +5 -8
  74. package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +1 -1
  75. package/dist/esm/utils/aggregation-operation-utils.js.map +1 -1
  76. package/dist/esm/utils/bin-sorter.js.map +1 -1
  77. package/dist/esm/utils/cpu-aggregator.js +11 -7
  78. package/dist/esm/utils/cpu-aggregator.js.map +1 -1
  79. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +1 -1
  80. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +1 -1
  81. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +1 -1
  82. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +1 -1
  83. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +4 -3
  84. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +1 -1
  85. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +62 -51
  86. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
  87. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +3 -3
  88. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +1 -1
  89. package/dist/esm/utils/grid-aggregation-utils.js.map +1 -1
  90. package/dist/esm/utils/prop-utils.js.map +1 -1
  91. package/dist/esm/utils/resource-utils.js +10 -17
  92. package/dist/esm/utils/resource-utils.js.map +1 -1
  93. package/dist.min.js +185 -30
  94. package/package.json +7 -5
  95. package/src/aggregation-layer.ts +7 -6
  96. package/src/contour-layer/contour-layer.ts +25 -9
  97. package/src/cpu-grid-layer/cpu-grid-layer.ts +8 -3
  98. package/src/cpu-grid-layer/{grid-aggregator.js → grid-aggregator.ts} +28 -4
  99. package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +38 -27
  100. package/src/gpu-grid-layer/gpu-grid-layer.ts +18 -12
  101. package/src/grid-aggregation-layer.ts +39 -13
  102. package/src/grid-layer/grid-layer.ts +2 -2
  103. package/src/heatmap-layer/heatmap-layer-utils.ts +10 -4
  104. package/src/heatmap-layer/heatmap-layer.ts +74 -67
  105. package/src/heatmap-layer/triangle-layer.ts +26 -22
  106. package/src/hexagon-layer/{hexagon-aggregator.js → hexagon-aggregator.ts} +5 -1
  107. package/src/hexagon-layer/hexagon-layer.ts +8 -5
  108. package/src/index.ts +0 -1
  109. package/src/screen-grid-layer/screen-grid-cell-layer.ts +36 -33
  110. package/src/screen-grid-layer/screen-grid-layer.ts +12 -11
  111. package/src/utils/{aggregation-operation-utils.js → aggregation-operation-utils.ts} +8 -2
  112. package/src/utils/bin-sorter.ts +1 -1
  113. package/src/utils/{cpu-aggregator.js → cpu-aggregator.ts} +42 -30
  114. package/src/utils/gpu-grid-aggregation/{gpu-grid-aggregator-constants.js → gpu-grid-aggregator-constants.ts} +4 -4
  115. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +3 -3
  116. package/src/utils/gpu-grid-aggregation/{gpu-grid-aggregator.js → gpu-grid-aggregator.ts} +123 -94
  117. package/src/utils/{grid-aggregation-utils.js → grid-aggregation-utils.ts} +1 -1
  118. package/src/utils/resource-utils.ts +59 -0
  119. package/typed/aggregation-layer.d.ts +4 -3
  120. package/typed/aggregation-layer.d.ts.map +1 -1
  121. package/typed/contour-layer/contour-layer.d.ts +19 -5
  122. package/typed/contour-layer/contour-layer.d.ts.map +1 -1
  123. package/typed/cpu-grid-layer/cpu-grid-layer.d.ts +8 -3
  124. package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -1
  125. package/typed/cpu-grid-layer/grid-aggregator.d.ts +16 -4
  126. package/typed/cpu-grid-layer/grid-aggregator.d.ts.map +1 -1
  127. package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts +18 -4
  128. package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -1
  129. package/typed/gpu-grid-layer/gpu-grid-layer.d.ts +8 -3
  130. package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -1
  131. package/typed/grid-aggregation-layer.d.ts +39 -4
  132. package/typed/grid-aggregation-layer.d.ts.map +1 -1
  133. package/typed/grid-layer/grid-layer.d.ts +2 -2
  134. package/typed/grid-layer/grid-layer.d.ts.map +1 -1
  135. package/typed/heatmap-layer/heatmap-layer-utils.d.ts +7 -5
  136. package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
  137. package/typed/heatmap-layer/heatmap-layer.d.ts +19 -6
  138. package/typed/heatmap-layer/heatmap-layer.d.ts.map +1 -1
  139. package/typed/heatmap-layer/triangle-layer.d.ts +10 -6
  140. package/typed/heatmap-layer/triangle-layer.d.ts.map +1 -1
  141. package/typed/hexagon-layer/hexagon-aggregator.d.ts +6 -3
  142. package/typed/hexagon-layer/hexagon-aggregator.d.ts.map +1 -1
  143. package/typed/hexagon-layer/hexagon-layer.d.ts +5 -4
  144. package/typed/hexagon-layer/hexagon-layer.d.ts.map +1 -1
  145. package/typed/index.d.ts.map +1 -1
  146. package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts +10 -9
  147. package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
  148. package/typed/screen-grid-layer/screen-grid-layer.d.ts +6 -4
  149. package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
  150. package/typed/utils/aggregation-operation-utils.d.ts +18 -12
  151. package/typed/utils/aggregation-operation-utils.d.ts.map +1 -1
  152. package/typed/utils/bin-sorter.d.ts +1 -1
  153. package/typed/utils/bin-sorter.d.ts.map +1 -1
  154. package/typed/utils/cpu-aggregator.d.ts +28 -14
  155. package/typed/utils/cpu-aggregator.d.ts.map +1 -1
  156. package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +1 -1
  157. package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +1 -1
  158. package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +1 -1
  159. package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +1 -1
  160. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +1 -1
  161. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +1 -1
  162. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +1 -1
  163. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +1 -1
  164. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +35 -33
  165. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +1 -1
  166. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +1 -1
  167. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +29 -19
  168. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
  169. package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +1 -1
  170. package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +1 -1
  171. package/typed/utils/grid-aggregation-utils.d.ts +11 -5
  172. package/typed/utils/grid-aggregation-utils.d.ts.map +1 -1
  173. package/typed/utils/prop-utils.d.ts +1 -1
  174. package/typed/utils/prop-utils.d.ts.map +1 -1
  175. package/typed/utils/resource-utils.d.ts +13 -3
  176. package/typed/utils/resource-utils.d.ts.map +1 -1
  177. package/src/utils/resource-utils.js +0 -51
  178. /package/src/utils/gpu-grid-aggregation/{aggregate-all-fs.glsl.js → aggregate-all-fs.glsl.ts} +0 -0
  179. /package/src/utils/gpu-grid-aggregation/{aggregate-all-vs.glsl.js → aggregate-all-vs.glsl.ts} +0 -0
  180. /package/src/utils/gpu-grid-aggregation/{aggregate-to-grid-fs.glsl.js → aggregate-to-grid-fs.glsl.ts} +0 -0
  181. /package/src/utils/gpu-grid-aggregation/{aggregate-to-grid-vs.glsl.js → aggregate-to-grid-vs.glsl.ts} +0 -0
  182. /package/src/utils/gpu-grid-aggregation/{gpu-grid-aggregator-utils.js → gpu-grid-aggregator-utils.ts} +0 -0
  183. /package/src/utils/gpu-grid-aggregation/{transform-mean-vs.glsl.js → transform-mean-vs.glsl.ts} +0 -0
  184. /package/src/utils/{prop-utils.js → prop-utils.ts} +0 -0
@@ -31,17 +31,17 @@ import {
31
31
  UpdateParameters,
32
32
  DefaultProps
33
33
  } from '@deck.gl/core';
34
- import GL from '@luma.gl/constants';
35
- import type {Texture2D} from '@luma.gl/core';
34
+ import type {Buffer, Texture} from '@luma.gl/core';
35
+ import {GL} from '@luma.gl/constants';
36
36
  import GPUGridAggregator from '../utils/gpu-grid-aggregation/gpu-grid-aggregator';
37
37
  import {AGGREGATION_OPERATION, getValueFunc} from '../utils/aggregation-operation-utils';
38
38
  import ScreenGridCellLayer from './screen-grid-cell-layer';
39
39
  import GridAggregationLayer, {GridAggregationLayerProps} from '../grid-aggregation-layer';
40
- import {getFloatTexture} from '../utils/resource-utils.js';
40
+ import {getFloatTexture} from '../utils/resource-utils';
41
41
 
42
42
  const defaultProps: DefaultProps<ScreenGridLayerProps> = {
43
- ...ScreenGridCellLayer.defaultProps,
44
- getPosition: {type: 'accessor', value: d => d.position},
43
+ ...(ScreenGridCellLayer.defaultProps as DefaultProps<ScreenGridLayerProps<unknown>>),
44
+ getPosition: {type: 'accessor', value: (d: any) => d.position},
45
45
  getWeight: {type: 'accessor', value: 1},
46
46
 
47
47
  gpuAggregation: true,
@@ -60,7 +60,7 @@ const DIMENSIONS = {
60
60
  };
61
61
 
62
62
  /** All properties supported by ScreenGridLayer. */
63
- export type ScreenGridLayerProps<DataT = any> = _ScreenGridLayerProps<DataT> &
63
+ export type ScreenGridLayerProps<DataT = unknown> = _ScreenGridLayerProps<DataT> &
64
64
  GridAggregationLayerProps<DataT>;
65
65
 
66
66
  /** Properties added by ScreenGridLayer. */
@@ -151,12 +151,13 @@ export default class ScreenGridLayer<
151
151
  gpuGridAggregator?: any;
152
152
  gpuAggregation?: any;
153
153
  weights?: any;
154
- maxTexture?: Texture2D;
154
+ maxTexture?: Texture;
155
+ aggregationBuffer?: Buffer;
156
+ maxBuffer?: Buffer;
155
157
  };
156
158
 
157
159
  initializeState() {
158
- const {gl} = this.context;
159
- if (!ScreenGridCellLayer.isSupported(gl)) {
160
+ if (!ScreenGridCellLayer.isSupported(this.context.device)) {
160
161
  // max aggregated value is sampled from a float texture
161
162
  this.setState({supported: false});
162
163
  log.error(`ScreenGridLayer: ${this.id} is not supported on this browser`)();
@@ -172,7 +173,7 @@ export default class ScreenGridLayer<
172
173
  size: 1,
173
174
  operation: AGGREGATION_OPERATION.SUM,
174
175
  needMax: true,
175
- maxTexture: getFloatTexture(gl, {id: `${this.id}-max-texture`})
176
+ maxTexture: getFloatTexture(this.context.device, {id: `${this.id}-max-texture`})
176
177
  }
177
178
  };
178
179
  this.setState({
@@ -276,7 +277,7 @@ export default class ScreenGridLayer<
276
277
  const {viewportChanged} = opts.changeFlags;
277
278
  let gpuAggregation = opts.props.gpuAggregation;
278
279
  if (this.state.gpuAggregation !== opts.props.gpuAggregation) {
279
- if (gpuAggregation && !GPUGridAggregator.isSupported(this.context.gl)) {
280
+ if (gpuAggregation && !GPUGridAggregator.isSupported(this.context.device)) {
280
281
  log.warn('GPU Grid Aggregation not supported, falling back to CPU')();
281
282
  gpuAggregation = false;
282
283
  }
@@ -91,7 +91,13 @@ export function getValueFunc(aggregation, accessor, context) {
91
91
  }
92
92
  }
93
93
 
94
- function wrapAccessor(accessor, context = {}) {
94
+ type AccessorContext = {
95
+ data?;
96
+ index?: number;
97
+ indices?: number[];
98
+ };
99
+
100
+ function wrapAccessor(accessor, context: AccessorContext = {}) {
95
101
  if (Number.isFinite(accessor)) {
96
102
  return accessor;
97
103
  }
@@ -101,7 +107,7 @@ function wrapAccessor(accessor, context = {}) {
101
107
  };
102
108
  }
103
109
 
104
- export function wrapGetValueFunc(getValue, context = {}) {
110
+ export function wrapGetValueFunc(getValue, context: AccessorContext = {}) {
105
111
  return pts => {
106
112
  context.indices = pts.map(pt => pt.index);
107
113
  return getValue(
@@ -59,7 +59,7 @@ export default class BinSorter {
59
59
  sortedBins!: AggregatedBin[];
60
60
  binMap: Record<number, AggregatedBin>;
61
61
 
62
- constructor(bins = [], props: Partial<typeof defaultProps> = defaultProps) {
62
+ constructor(bins: unknown[] = [], props: Partial<typeof defaultProps> = defaultProps) {
63
63
  this.aggregatedBins = this.getAggregatedBins(bins, props);
64
64
  this._updateMinMaxValues();
65
65
  this.binMap = this.getBinMap();
@@ -21,7 +21,8 @@ import BinSorter from './bin-sorter';
21
21
  import {getScaleFunctionByScaleType} from './scale-utils';
22
22
  import {getValueFunc, wrapGetValueFunc} from './aggregation-operation-utils';
23
23
 
24
- function nop() {}
24
+ // @eslint-disable-next-line @typescript-eslint/no-empty-function
25
+ function noop() {}
25
26
 
26
27
  const dimensionSteps = ['getBins', 'getDomain', 'getScaleFunc'];
27
28
  const defaultDimensions = [
@@ -122,27 +123,37 @@ const defaultDimensions = [
122
123
  ];
123
124
  const defaultGetCellSize = props => props.cellSize;
124
125
  export default class CPUAggregator {
125
- constructor(opts) {
126
- this.state = {
127
- layerData: {},
128
- dimensions: {
129
- // color: {
130
- // getValue: null,
131
- // domain: null,
132
- // sortedBins: null,
133
- // scaleFunc: nop
134
- // },
135
- // elevation: {
136
- // getValue: null,
137
- // domain: null,
138
- // sortedBins: null,
139
- // scaleFunc: nop
140
- // }
141
- }
126
+ state: {
127
+ layerData: {
128
+ data?: any[];
142
129
  };
143
- this.changeFlags = {};
144
- this.dimensionUpdaters = {};
130
+ dimensions: Record<string, any>;
131
+ } = {
132
+ layerData: {
133
+ data: undefined
134
+ },
135
+ dimensions: {
136
+ // color: {
137
+ // getValue: null,
138
+ // domain: null,
139
+ // sortedBins: null,
140
+ // scaleFunc: noop
141
+ // },
142
+ // elevation: {
143
+ // getValue: null,
144
+ // domain: null,
145
+ // sortedBins: null,
146
+ // scaleFunc: noop
147
+ // }
148
+ }
149
+ };
150
+ changeFlags: Record<string, any> = {};
151
+ dimensionUpdaters: Record<string, any> = {};
152
+
153
+ _getCellSize;
154
+ _getAggregator;
145
155
 
156
+ constructor(opts) {
146
157
  this._getCellSize = opts.getCellSize || defaultGetCellSize;
147
158
  this._getAggregator = opts.getAggregator;
148
159
  this._addDimension(opts.dimensions || defaultDimensions);
@@ -187,7 +198,7 @@ export default class CPUAggregator {
187
198
  });
188
199
  }
189
200
 
190
- normalizeResult(result = {}) {
201
+ normalizeResult(result: {hexagons?; layerData?} = {}) {
191
202
  // support previous hexagonAggregator API
192
203
  if (result.hexagons) {
193
204
  return {data: result.hexagons, ...result};
@@ -259,7 +270,7 @@ export default class CPUAggregator {
259
270
  getValue: null,
260
271
  domain: null,
261
272
  sortedBins: null,
262
- scaleFunc: nop
273
+ scaleFunc: noop
263
274
  };
264
275
  });
265
276
  }
@@ -269,9 +280,9 @@ export default class CPUAggregator {
269
280
  key,
270
281
  accessor,
271
282
  pickingInfo,
272
- getBins: {updater: this.getDimensionSortedBins, ...getBins},
273
- getDomain: {updater: this.getDimensionValueDomain, ...getDomain},
274
- getScaleFunc: {updater: this.getDimensionScale, ...getScaleFunc},
283
+ getBins: {updater: this.getDimensionSortedBins.bind(this), ...getBins},
284
+ getDomain: {updater: this.getDimensionValueDomain.bind(this), ...getDomain},
285
+ getScaleFunc: {updater: this.getDimensionScale.bind(this), ...getScaleFunc},
275
286
  attributeAccessor: this.getSubLayerDimensionAttribute(key, nullValue)
276
287
  };
277
288
  }
@@ -294,7 +305,7 @@ export default class CPUAggregator {
294
305
  // prop: 'elevationAggregation'
295
306
  // }
296
307
  // }
297
- return Object.values(dimensionStep.triggers).some(item => {
308
+ return Object.values(dimensionStep.triggers).some((item: any) => {
298
309
  if (item.updateTrigger) {
299
310
  // check based on updateTriggers change first
300
311
  // if data has changed, always update value
@@ -310,9 +321,9 @@ export default class CPUAggregator {
310
321
  });
311
322
  }
312
323
 
313
- getDimensionChanges(oldProps, props, changeFlags) {
324
+ getDimensionChanges(oldProps: any, props: any, changeFlags: any): Function[] | null {
314
325
  // const {dimensionUpdaters} = this.state;
315
- const updaters = [];
326
+ const updaters: Function[] = [];
316
327
 
317
328
  // get dimension to be updated
318
329
  for (const key in this.dimensionUpdaters) {
@@ -351,7 +362,7 @@ export default class CPUAggregator {
351
362
 
352
363
  dimensionSteps.forEach(step => {
353
364
  Object.values(this.dimensionUpdaters[key][step].triggers).forEach(
354
- ({prop, updateTrigger}) => {
365
+ ({prop, updateTrigger}: any) => {
355
366
  if (updateTrigger) {
356
367
  // if prop is based on updateTrigger e.g. getColorValue, getColorWeight
357
368
  // and updateTriggers is passed in from layer prop
@@ -460,6 +471,7 @@ export default class CPUAggregator {
460
471
  if (isPicked) {
461
472
  // const {sortedColorBins, sortedElevationBins} = this.state;
462
473
 
474
+ // @ts-expect-error
463
475
  const cell = this.state.layerData.data[info.index];
464
476
 
465
477
  const binInfo = {};
@@ -484,7 +496,7 @@ export default class CPUAggregator {
484
496
 
485
497
  getAccessor(dimensionKey) {
486
498
  if (!this.dimensionUpdaters.hasOwnProperty(dimensionKey)) {
487
- return nop;
499
+ return noop;
488
500
  }
489
501
  return this.dimensionUpdaters[dimensionKey].attributeAccessor;
490
502
  }
@@ -1,4 +1,4 @@
1
- import GL from '@luma.gl/constants';
1
+ import {GL} from '@luma.gl/constants';
2
2
  import {AGGREGATION_OPERATION} from '../aggregation-operation-utils';
3
3
 
4
4
  export const DEFAULT_RUN_PARAMS = {
@@ -36,9 +36,9 @@ export const MAX_MIN_TEXTURE_OPTS = {
36
36
  type: GL.FLOAT,
37
37
  border: 0,
38
38
  mipmaps: false,
39
- parameters: {
40
- [GL.TEXTURE_MAG_FILTER]: GL.NEAREST,
41
- [GL.TEXTURE_MIN_FILTER]: GL.NEAREST
39
+ sampler: {
40
+ minFilter: 'nearest',
41
+ magFilter: 'nearest'
42
42
  },
43
43
  dataFormat: GL.RGBA,
44
44
  width: 1,
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Usage (Aggregation in World space)
6
6
  ```
7
- const aggregator = new GPUGridAggregator(gl);
7
+ const aggregator = new GPUGridAggregator(device);
8
8
 
9
9
  const results = aggregator.run({
10
10
  attributes, // position and weight attributes
@@ -29,7 +29,7 @@ const results = aggregator.run({
29
29
  You can also perform aggregation in screen space by provide a viewport and set `projectPoints` to true. Aggregator will first project positions and then aggregate them in screen space.
30
30
 
31
31
  ```
32
- const aggregator = new GPUGridAggregator(gl);
32
+ const aggregator = new GPUGridAggregator(device);
33
33
 
34
34
  const results = aggregator.run({
35
35
  attributes, // position and weight attributes
@@ -57,7 +57,7 @@ const results = aggregator.run({
57
57
 
58
58
  ‘ScreenGridAggregator’ constructor takes following arguments and constructs an object.
59
59
 
60
- * gl (WebGLContext) : used for querying WebGL features and creating required webgl resources.
60
+ * device (WebGLContext) : used for querying WebGL features and creating required webgl resources.
61
61
  * opts (Object) : Optionally contains and ‘id’ and ‘sahderCache’ object for caching/re-using shaders.
62
62
 
63
63