@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
@@ -18,18 +18,12 @@
18
18
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  // THE SOFTWARE.
20
20
 
21
- import GL from '@luma.gl/constants';
22
- import {
23
- Model,
24
- Transform,
25
- FEATURES,
26
- hasFeatures,
27
- isWebGL2,
28
- readPixelsToBuffer,
29
- withParameters
30
- } from '@luma.gl/core';
21
+ import type {Device, DeviceFeature} from '@luma.gl/core';
22
+ import {Model, Transform} from '@luma.gl/engine';
31
23
  import {fp64arithmetic} from '@luma.gl/shadertools';
32
- import {log, project32, _mergeShaders as mergeShaders} from '@deck.gl/core';
24
+ import {readPixelsToBuffer, withGLParameters, clear} from '@luma.gl/webgl';
25
+ import {GL} from '@luma.gl/constants';
26
+ import {log, project32, _mergeShaders as mergeShaders, getShaderAssembler} from '@deck.gl/core';
33
27
 
34
28
  import {
35
29
  DEFAULT_RUN_PARAMS,
@@ -48,7 +42,7 @@ import AGGREGATE_TO_GRID_FS from './aggregate-to-grid-fs.glsl';
48
42
  import AGGREGATE_ALL_VS from './aggregate-all-vs.glsl';
49
43
  import AGGREGATE_ALL_FS from './aggregate-all-fs.glsl';
50
44
  import TRANSFORM_MEAN_VS from './transform-mean-vs.glsl';
51
- import {getFloatTexture, getFramebuffer} from './../resource-utils.js';
45
+ import {getFloatTexture, getFramebuffer} from './../resource-utils';
52
46
 
53
47
  const BUFFER_NAMES = ['aggregationBuffer', 'maxMinBuffer', 'minBuffer', 'maxBuffer'];
54
48
  const ARRAY_BUFFER_MAP = {
@@ -57,19 +51,35 @@ const ARRAY_BUFFER_MAP = {
57
51
  maxMinData: 'maxMinBuffer'
58
52
  };
59
53
 
60
- const REQUIRED_FEATURES = [
61
- FEATURES.WEBGL2, // TODO: Remove after trannsform refactor
62
- FEATURES.COLOR_ATTACHMENT_RGBA32F,
63
- FEATURES.BLEND_EQUATION_MINMAX,
64
- FEATURES.FLOAT_BLEND,
65
- FEATURES.TEXTURE_FLOAT
54
+ const REQUIRED_FEATURES: DeviceFeature[] = [
55
+ 'webgl2',
56
+ 'blend-minmax-webgl1',
57
+ 'texture-renderable-float32-webgl',
58
+ 'texture-blend-float-webgl1',
59
+ 'texture-formats-float32-webgl1'
66
60
  ];
67
61
 
62
+ export type GPUGridAggregatorProps = {
63
+ id?: string;
64
+ };
65
+
68
66
  export default class GPUGridAggregator {
69
67
  // Decode and return aggregation data of given pixel.
70
- static getAggregationData({aggregationData, maxData, minData, maxMinData, pixelIndex}) {
68
+ static getAggregationData({
69
+ aggregationData,
70
+ maxData,
71
+ minData,
72
+ maxMinData,
73
+ pixelIndex
74
+ }: {
75
+ aggregationData?: Float32Array;
76
+ maxData?: Float32Array;
77
+ minData?: Float32Array;
78
+ maxMinData?: Float32Array;
79
+ pixelIndex: number;
80
+ }) {
71
81
  const index = pixelIndex * PIXEL_SIZE;
72
- const results = {};
82
+ const results: {cellCount?; cellWeight?; maxCellWieght?; minCellWeight?; totalCount?} = {};
73
83
  if (aggregationData) {
74
84
  results.cellCount = aggregationData[index + 3];
75
85
  results.cellWeight = aggregationData[index];
@@ -84,7 +94,7 @@ export default class GPUGridAggregator {
84
94
  }
85
95
  if (minData) {
86
96
  results.minCellWeight = minData[0];
87
- results.totalCount = maxData[3];
97
+ results.totalCount = minData[3];
88
98
  }
89
99
  }
90
100
  return results;
@@ -106,8 +116,8 @@ export default class GPUGridAggregator {
106
116
  return {cellCounts, cellWeights};
107
117
  }
108
118
 
109
- static isSupported(gl) {
110
- return hasFeatures(gl, REQUIRED_FEATURES);
119
+ static isSupported(device: Device) {
120
+ return REQUIRED_FEATURES.every(feature => device.features.has(feature));
111
121
  }
112
122
 
113
123
  // DEBUG ONLY
@@ -135,35 +145,50 @@ export default class GPUGridAggregator {
135
145
  // }
136
146
  // }
137
147
 
138
- constructor(gl, opts = {}) {
139
- this.id = opts.id || 'gpu-grid-aggregator';
140
- this.gl = gl;
141
- this.state = {
142
- // per weight GPU resources
143
- weightAttributes: {},
144
- textures: {},
145
- meanTextures: {},
146
- buffers: {},
147
- framebuffers: {},
148
- maxMinFramebuffers: {},
149
- minFramebuffers: {},
150
- maxFramebuffers: {},
151
- equations: {},
152
-
153
- // common resources to be deleted
154
- resources: {},
155
-
156
- // results
157
- results: {}
158
- };
148
+ state = {
149
+ // per weight GPU resources
150
+ weightAttributes: {},
151
+ textures: {},
152
+ meanTextures: {},
153
+ buffers: {},
154
+ framebuffers: {},
155
+ maxMinFramebuffers: {},
156
+ minFramebuffers: {},
157
+ maxFramebuffers: {},
158
+ equations: {},
159
+
160
+ shaderOptions: {},
161
+ modelDirty: false,
162
+
163
+ // common resources to be deleted
164
+ resources: {},
165
+
166
+ // results
167
+ results: {}
168
+ };
169
+
170
+ id: string;
171
+ device: Device;
172
+ _hasGPUSupport: boolean;
173
+
174
+ gridAggregationModel;
175
+ allAggregationModel;
176
+ meanTransform;
177
+
178
+ constructor(device: Device, props: GPUGridAggregatorProps = {}) {
179
+ this.id = props.id || 'gpu-grid-aggregator';
180
+ this.device = device;
181
+
182
+ const REQUIRED_FEATURES: DeviceFeature[] = [
183
+ 'blend-minmax-webgl1', // set min/max blend modes
184
+ 'texture-renderable-float32-webgl', // render to float texture
185
+ 'texture-formats-float32-webgl1' // sample from a float texture
186
+ ];
187
+
188
+ // gl_InstanceID usage in min/max calculation shaders
159
189
  this._hasGPUSupport =
160
- isWebGL2(gl) && // gl_InstanceID usage in min/max calculation shaders
161
- hasFeatures(
162
- this.gl,
163
- FEATURES.BLEND_EQUATION_MINMAX, // set min/max blend modes
164
- FEATURES.COLOR_ATTACHMENT_RGBA32F, // render to float texture
165
- FEATURES.TEXTURE_FLOAT // sample from a float texture
166
- );
190
+ this.device.info.type === 'webgl2' &&
191
+ REQUIRED_FEATURES.every(feature => device.features.has(feature));
167
192
  if (this._hasGPUSupport) {
168
193
  this._setupModels();
169
194
  }
@@ -182,9 +207,9 @@ export default class GPUGridAggregator {
182
207
  resources
183
208
  } = this.state;
184
209
 
185
- gridAggregationModel?.delete();
186
- allAggregationModel?.delete();
187
- meanTransform?.delete();
210
+ gridAggregationModel?.destroy();
211
+ allAggregationModel?.destroy();
212
+ meanTransform?.destroy();
188
213
 
189
214
  deleteResources([
190
215
  framebuffers,
@@ -212,7 +237,12 @@ export default class GPUGridAggregator {
212
237
  // For WebGL1, data is available in JS Array objects already.
213
238
  // For WebGL2, data is read from Buffer objects and cached for subsequent queries.
214
239
  getData(weightId) {
215
- const data = {};
240
+ const data: {
241
+ aggregationData?: Float32Array;
242
+ maxData?: Float32Array;
243
+ minData?: Float32Array;
244
+ maxMinData?: Float32Array;
245
+ } = {};
216
246
  const results = this.state.results;
217
247
  if (!results[weightId].aggregationData) {
218
248
  // cache the results if reading from the buffer (WebGL2 path)
@@ -381,26 +411,24 @@ export default class GPUGridAggregator {
381
411
  _renderToMaxMinTexture(opts) {
382
412
  const {id, parameters, gridSize, minOrMaxFb, combineMaxMin, clearParams = {}} = opts;
383
413
  const {framebuffers} = this.state;
384
- const {gl, allAggregationModel} = this;
414
+ const {allAggregationModel} = this;
385
415
 
386
- withParameters(
387
- gl,
416
+ withGLParameters(
417
+ this.device,
388
418
  {
389
419
  ...clearParams,
390
420
  framebuffer: minOrMaxFb,
391
421
  viewport: [0, 0, gridSize[0], gridSize[1]]
392
422
  },
393
423
  () => {
394
- gl.clear(gl.COLOR_BUFFER_BIT);
395
-
396
- allAggregationModel.draw({
397
- parameters,
398
- uniforms: {
399
- uSampler: framebuffers[id].texture,
400
- gridSize,
401
- combineMaxMin
402
- }
403
- });
424
+ clear(this.device, {color: true});
425
+
426
+ // allAggregationModel.setParameters(parameters);
427
+ allAggregationModel.setUniforms({gridSize, combineMaxMin});
428
+ allAggregationModel.setBindings({uSampler: framebuffers[id].texture});
429
+ allAggregationModel.draw();
430
+ // TODO - we need to create a render pass for the aggregation
431
+ // allAggregationModel.draw(renderPass);
404
432
  }
405
433
  );
406
434
  }
@@ -409,22 +437,22 @@ export default class GPUGridAggregator {
409
437
  _renderToWeightsTexture(opts) {
410
438
  const {id, parameters, moduleSettings, uniforms, gridSize, weights} = opts;
411
439
  const {framebuffers, equations, weightAttributes} = this.state;
412
- const {gl, gridAggregationModel} = this;
440
+ const {gridAggregationModel} = this;
413
441
  const {operation} = weights[id];
414
442
 
415
443
  const clearColor =
416
444
  operation === AGGREGATION_OPERATION.MIN
417
445
  ? [MAX_32_BIT_FLOAT, MAX_32_BIT_FLOAT, MAX_32_BIT_FLOAT, 0]
418
446
  : [0, 0, 0, 0];
419
- withParameters(
420
- gl,
447
+ withGLParameters(
448
+ this.device,
421
449
  {
422
450
  framebuffer: framebuffers[id],
423
451
  viewport: [0, 0, gridSize[0], gridSize[1]],
424
452
  clearColor
425
453
  },
426
454
  () => {
427
- gl.clear(gl.COLOR_BUFFER_BIT);
455
+ clear(this.device, {color: true});
428
456
 
429
457
  const attributes = {weights: weightAttributes[id]};
430
458
  gridAggregationModel.draw({
@@ -446,7 +474,7 @@ export default class GPUGridAggregator {
446
474
  if (this.meanTransform) {
447
475
  this.meanTransform.update(transformOptions);
448
476
  } else {
449
- this.meanTransform = getMeanTransform(gl, transformOptions);
477
+ this.meanTransform = getMeanTransform(this.device, transformOptions);
450
478
  }
451
479
  this.meanTransform.run({
452
480
  parameters: {
@@ -489,21 +517,21 @@ export default class GPUGridAggregator {
489
517
  textures[id] =
490
518
  weights[id].aggregationTexture ||
491
519
  textures[id] ||
492
- getFloatTexture(this.gl, {id: `${id}-texture`, width: numCol, height: numRow});
520
+ getFloatTexture(this.device, {id: `${id}-texture`, width: numCol, height: numRow});
493
521
  textures[id].resize(framebufferSize);
494
522
  let texture = textures[id];
495
523
  if (operation === AGGREGATION_OPERATION.MEAN) {
496
524
  // For MEAN, we first aggregatet into a temp texture
497
525
  meanTextures[id] =
498
526
  meanTextures[id] ||
499
- getFloatTexture(this.gl, {id: `${id}-mean-texture`, width: numCol, height: numRow});
527
+ getFloatTexture(this.device, {id: `${id}-mean-texture`, width: numCol, height: numRow});
500
528
  meanTextures[id].resize(framebufferSize);
501
529
  texture = meanTextures[id];
502
530
  }
503
531
  if (framebuffers[id]) {
504
532
  framebuffers[id].attach({[GL.COLOR_ATTACHMENT0]: texture});
505
533
  } else {
506
- framebuffers[id] = getFramebuffer(this.gl, {
534
+ framebuffers[id] = getFramebuffer(this.device, {
507
535
  id: `${id}-fb`,
508
536
  width: numCol,
509
537
  height: numRow,
@@ -511,19 +539,19 @@ export default class GPUGridAggregator {
511
539
  });
512
540
  }
513
541
  framebuffers[id].resize(framebufferSize);
514
- equations[id] = EQUATION_MAP[operation] || EQUATION_MAP.SUM;
542
+ equations[id] = EQUATION_MAP[operation] || EQUATION_MAP[AGGREGATION_OPERATION.SUM];
515
543
  // For min/max framebuffers will use default size 1X1
516
544
  if (needMin || needMax) {
517
545
  if (needMin && needMax && combineMaxMin) {
518
546
  if (!maxMinFramebuffers[id]) {
519
547
  texture = weights[id].maxMinTexture || this._getMinMaxTexture(`${id}-maxMinTexture`);
520
- maxMinFramebuffers[id] = getFramebuffer(this.gl, {id: `${id}-maxMinFb`, texture});
548
+ maxMinFramebuffers[id] = getFramebuffer(this.device, {id: `${id}-maxMinFb`, texture});
521
549
  }
522
550
  } else {
523
551
  if (needMin) {
524
552
  if (!minFramebuffers[id]) {
525
553
  texture = weights[id].minTexture || this._getMinMaxTexture(`${id}-minTexture`);
526
- minFramebuffers[id] = getFramebuffer(this.gl, {
554
+ minFramebuffers[id] = getFramebuffer(this.device, {
527
555
  id: `${id}-minFb`,
528
556
  texture
529
557
  });
@@ -532,7 +560,7 @@ export default class GPUGridAggregator {
532
560
  if (needMax) {
533
561
  if (!maxFramebuffers[id]) {
534
562
  texture = weights[id].maxTexture || this._getMinMaxTexture(`${id}-maxTexture`);
535
- maxFramebuffers[id] = getFramebuffer(this.gl, {
563
+ maxFramebuffers[id] = getFramebuffer(this.device, {
536
564
  id: `${id}-maxFb`,
537
565
  texture
538
566
  });
@@ -547,19 +575,18 @@ export default class GPUGridAggregator {
547
575
  _getMinMaxTexture(name) {
548
576
  const {resources} = this.state;
549
577
  if (!resources[name]) {
550
- resources[name] = getFloatTexture(this.gl, {id: `resourceName`});
578
+ resources[name] = getFloatTexture(this.device, {id: 'resourceName'});
551
579
  }
552
580
  return resources[name];
553
581
  }
554
582
 
555
583
  _setupModels({numCol = 0, numRow = 0} = {}) {
556
- const {gl} = this;
557
584
  const {shaderOptions} = this.state;
558
- this.gridAggregationModel?.delete();
559
- this.gridAggregationModel = getAggregationModel(gl, shaderOptions);
585
+ this.gridAggregationModel?.destroy();
586
+ this.gridAggregationModel = getAggregationModel(this.device, shaderOptions);
560
587
  if (!this.allAggregationModel) {
561
588
  const instanceCount = numCol * numRow;
562
- this.allAggregationModel = getAllAggregationModel(gl, instanceCount);
589
+ this.allAggregationModel = getAllAggregationModel(this.device, instanceCount);
563
590
  }
564
591
  }
565
592
 
@@ -572,7 +599,7 @@ export default class GPUGridAggregator {
572
599
  }
573
600
  }
574
601
 
575
- // GPU Aggregation results are provided in Buffers, if new Buffer objects are created track them for later deletion.
602
+ /** GPU Aggregation results are provided in Buffers, if new Buffer objects are created track them for later deletion. */
576
603
  /* eslint-disable max-depth */
577
604
  _trackGPUResultBuffers(results, weights) {
578
605
  const {resources} = this.state;
@@ -632,7 +659,7 @@ function deleteResources(resources) {
632
659
  });
633
660
  }
634
661
 
635
- function getAggregationModel(gl, shaderOptions) {
662
+ function getAggregationModel(device: Device, shaderOptions) {
636
663
  const shaders = mergeShaders(
637
664
  {
638
665
  vs: AGGREGATE_TO_GRID_VS,
@@ -642,32 +669,34 @@ function getAggregationModel(gl, shaderOptions) {
642
669
  shaderOptions
643
670
  );
644
671
 
645
- return new Model(gl, {
646
- id: 'Gird-Aggregation-Model',
672
+ return new Model(device, {
673
+ id: 'Grid-Aggregation-Model',
647
674
  vertexCount: 1,
648
675
  drawMode: GL.POINTS,
676
+ shaderAssembler: getShaderAssembler(),
649
677
  ...shaders
650
678
  });
651
679
  }
652
680
 
653
- function getAllAggregationModel(gl, instanceCount) {
654
- return new Model(gl, {
681
+ function getAllAggregationModel(device: Device, instanceCount: number): Model {
682
+ return new Model(device, {
655
683
  id: 'All-Aggregation-Model',
656
684
  vs: AGGREGATE_ALL_VS,
657
685
  fs: AGGREGATE_ALL_FS,
658
686
  modules: [fp64arithmetic],
659
687
  vertexCount: 1,
660
- drawMode: GL.POINTS,
688
+ topology: 'point-list',
661
689
  isInstanced: true,
662
690
  instanceCount,
663
691
  attributes: {
692
+ // @ts-expect-error
664
693
  position: [0, 0]
665
694
  }
666
695
  });
667
696
  }
668
697
 
669
- function getMeanTransform(gl, opts) {
670
- return new Transform(gl, {
698
+ function getMeanTransform(device: Device, opts) {
699
+ return new Transform(device, {
671
700
  vs: TRANSFORM_MEAN_VS,
672
701
  _targetTextureVarying: 'meanValues',
673
702
  ...opts
@@ -6,7 +6,7 @@ function toFinite(n) {
6
6
  }
7
7
 
8
8
  // Parse input data to build positions, wights and bounding box.
9
- /* eslint-disable max-statements */
9
+ /* eslint-disable-next-line max-statements */
10
10
  export function getBoundingBox(attributes, vertexCount) {
11
11
  // TODO - value might not exist (e.g. attribute transition)
12
12
  const positions = attributes.positions.value;
@@ -0,0 +1,59 @@
1
+ import {Device, Sampler, SamplerProps} from '@luma.gl/core';
2
+
3
+ const DEFAULT_PARAMETERS: SamplerProps = {
4
+ minFilter: 'nearest',
5
+ magFilter: 'nearest'
6
+ };
7
+
8
+ type FloatTextureOptions = {
9
+ id: string;
10
+ width?: number;
11
+ height?: number;
12
+ data?: any;
13
+ unpackFlipY?: boolean;
14
+ parameters?: SamplerProps;
15
+ };
16
+
17
+ // TODO - not working
18
+ export function getFloatTexture(device: Device, opts: FloatTextureOptions) {
19
+ const {
20
+ width = 1,
21
+ height = 1,
22
+ data = null,
23
+ unpackFlipY = true,
24
+ parameters = DEFAULT_PARAMETERS
25
+ } = opts;
26
+ const texture = device.createTexture({
27
+ data,
28
+ format: 'rgba32float', // device.info.type === 'webgl2' ? 'rgba32float' : GL.RGBA,
29
+ // type: GL.FLOAT,
30
+ // border: 0,
31
+ mipmaps: false,
32
+ sampler: parameters,
33
+ // dataFormat: GL.RGBA,
34
+ width,
35
+ height
36
+ // ts-expect-error
37
+ // unpackFlipY
38
+ });
39
+ return texture;
40
+ }
41
+
42
+ export function getFramebuffer(device: Device, opts) {
43
+ const {id, width = 1, height = 1, texture} = opts;
44
+ const fb = device.createFramebuffer({
45
+ id,
46
+ width,
47
+ height,
48
+ colorAttachments: [texture]
49
+ });
50
+
51
+ return fb;
52
+ }
53
+
54
+ export function getFloatArray(array, size, fillValue = 0) {
55
+ if (!array || array.length < size) {
56
+ return new Float32Array(size).fill(fillValue);
57
+ }
58
+ return array;
59
+ }
@@ -4,15 +4,16 @@ export declare type AggregationLayerProps<DataT> = CompositeLayerProps & {
4
4
  };
5
5
  export default abstract class AggregationLayer<DataT, ExtraPropsT extends {} = {}> extends CompositeLayer<Required<AggregationLayer<DataT>> & ExtraPropsT> {
6
6
  static layerName: string;
7
- state: CompositeLayer['state'] & {
7
+ state: {
8
8
  ignoreProps?: Record<string, any>;
9
9
  dimensions?: any;
10
+ changedAttributes?: Record<string, any>;
10
11
  };
11
12
  initializeAggregationLayer(dimensions: any): void;
12
13
  updateState(opts: UpdateParameters<this>): void;
13
14
  updateAttributes(changedAttributes: any): void;
14
15
  getAttributes(): {
15
- [id: string]: import("modules/core/src/lib/attribute/shader-attribute").IShaderAttribute;
16
+ [id: string]: import("modules/core/src/lib/attribute/attribute").default;
16
17
  };
17
18
  getModuleSettings(): any;
18
19
  updateShaders(shaders: any): void;
@@ -34,7 +35,7 @@ export default abstract class AggregationLayer<DataT, ExtraPropsT extends {} = {
34
35
  * @returns {Boolean} - `true` if attribute `name` is changed, `false` otherwise,
35
36
  * If `name` is not passed or `undefiend`, `true` if any attribute is changed, `false` otherwise
36
37
  **/
37
- isAttributeChanged(name?: string): any;
38
+ isAttributeChanged(name?: string): boolean | undefined;
38
39
  _getAttributeManager(): AttributeManager;
39
40
  }
40
41
  //# sourceMappingURL=aggregation-layer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregation-layer.d.ts","sourceRoot":"","sources":["../src/aggregation-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,eAAe,EAEf,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAIvB,oBAAY,qBAAqB,CAAC,K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MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,gBAAgB,CAC5C,KAAK,EACL,WAAW,SAAS,EAAE,GAAG,EAAE,CAC3B,SAAQ,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC;IACvE,MAAM,CAAC,SAAS,SAAsB;IAEtC,KAAK,EAAG;QACN,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAClC,UAAU,CAAC,EAAE,GAAG,CAAC;QACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACzC,CAAC;IAEF,0BAA0B,CAAC,UAAU,EAAE,GAAG;IAU1C,WAAW,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAexC,gBAAgB,CAAC,iBAAiB,KAAA;IAMlC,aAAa;;;IAIb,iBAAiB;IAejB,aAAa,CAAC,OAAO,KAAA;IAIrB;;;;;;;QAOI;IACJ,kBAAkB,CAChB,UAAU,KAAA,EACV,MAAM,GAAE;QAAC,UAAU,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,GAAG,CAAA;KAAM,GACnD,MAAM,GAAG,OAAO;IAyCnB;;;;;QAKI;IACJ,kBAAkB,CAAC,IAAI,CAAC,EAAE,MAAM;IAYhC,oBAAoB;CAMrB"}
@@ -1,7 +1,7 @@
1
- import { Accessor, AccessorFunction, Color, Layer, Position, UpdateParameters, DefaultProps } from '@deck.gl/core/typed';
1
+ import { Accessor, AccessorFunction, Color, Position, UpdateParameters, DefaultProps, LayersList } from '@deck.gl/core/typed';
2
2
  import GridAggregationLayer, { GridAggregationLayerProps } from '../grid-aggregation-layer';
3
3
  /** All properties supported by ContourLayer. */
4
- export declare type ContourLayerProps<DataT = any> = _ContourLayerProps<DataT> & GridAggregationLayerProps<DataT>;
4
+ export declare type ContourLayerProps<DataT = unknown> = _ContourLayerProps<DataT> & GridAggregationLayerProps<DataT>;
5
5
  /** Properties added by ContourLayer. */
6
6
  export declare type _ContourLayerProps<DataT> = {
7
7
  /**
@@ -62,11 +62,25 @@ export declare type _ContourLayerProps<DataT> = {
62
62
  /** Aggregate data into iso-lines or iso-bands for a given threshold and cell size. */
63
63
  export default class ContourLayer<DataT = any, ExtraPropsT extends {} = {}> extends GridAggregationLayer<DataT, ExtraPropsT & Required<_ContourLayerProps<DataT>>> {
64
64
  static layerName: string;
65
- static defaultProps: DefaultProps<ContourLayerProps<any>>;
65
+ static defaultProps: DefaultProps<ContourLayerProps<unknown>>;
66
+ state: GridAggregationLayer<DataT>['state'] & {
67
+ contourData: {
68
+ contourSegments: {
69
+ start: number[];
70
+ end: number[];
71
+ contour: any;
72
+ }[];
73
+ contourPolygons: {
74
+ vertices: number[][];
75
+ contour: any;
76
+ }[];
77
+ };
78
+ thresholdData: any;
79
+ };
66
80
  initializeState(): void;
67
81
  updateState(opts: UpdateParameters<this>): void;
68
- renderLayers(): Layer[];
69
- updateAggregationState(opts: any): void;
82
+ renderLayers(): LayersList;
83
+ updateAggregationState(opts: UpdateParameters<this>): void;
70
84
  private _updateAccessors;
71
85
  private _resetResults;
72
86
  private _generateContours;
@@ -1 +1 @@
1
- {"version":3,"file":"contour-layer.d.ts","sourceRoot":"","sources":["../../src/contour-layer/contour-layer.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,KAAK,EACL,KAAK,EAEL,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACb,MAAM,eAAe,CAAC;AAKvB,OAAO,oBAAoB,EAAE,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AAqC1F,gDAAgD;AAChD,oBAAY,iBAAiB,CAAC,KAAK,GAAG,GAAG,IAAI,kBAAkB,CAAC,KAAK,CAAC,GACpE,yBAAyB,CAAC,KAAK,CAAC,CAAC;AAEnC,wCAAwC;AACxC,oBAAY,kBAAkB,CAAC,KAAK,IAAI;IACtC;;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AAS,EAAE,GAAG,EAAE,CAC3B,SAAQ,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACtF,MAAM,CAAC,SAAS,SAAkB;IAClC,MAAM,CAAC,YAAY,2CAAgB;IAEnC,KAAK,EAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG;QAC7C,WAAW,EAAE;YACX,eAAe,EAAE;gBACf,KAAK,EAAE,MAAM,EAAE,CAAC;gBAChB,GAAG,EAAE,MAAM,EAAE,CAAC;gBACd,OAAO,EAAE,GAAG,CAAC;aACd,EAAE,CAAC;YACJ,eAAe,EAAE;gBACf,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC;gBACrB,OAAO,EAAE,GAAG,CAAC;aACd,EAAE,CAAC;SACL,CAAC;QACF,aAAa,EAAE,GAAG,CAAC;KACpB,CAAC;IAEF,eAAe,IAAI,IAAI;IA2BvB,WAAW,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI;IAgB/C,YAAY,IAAI,UAAU;IA4C1B,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAyEnD,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,iBAAiB;IAsBzB,OAAO,CAAC,oBAAoB;CAc7B"}
@@ -1,9 +1,10 @@
1
1
  import { Accessor, AccessorFunction, Color, Position, Material, DefaultProps } from '@deck.gl/core/typed';
2
+ import CPUAggregator from '../utils/cpu-aggregator';
2
3
  import AggregationLayer, { AggregationLayerProps } from '../aggregation-layer';
3
4
  import { Layer, UpdateParameters, GetPickingInfoParams, PickingInfo } from '@deck.gl/core/typed';
4
5
  import { AggregateAccessor } from '../types';
5
6
  /** All properties supported by CPUGridLayer. */
6
- export declare type CPUGridLayerProps<DataT = any> = _CPUGridLayerProps<DataT> & AggregationLayerProps<DataT>;
7
+ export declare type CPUGridLayerProps<DataT = unknown> = _CPUGridLayerProps<DataT> & AggregationLayerProps<DataT>;
7
8
  /** Properties added by CPUGridLayer. */
8
9
  declare type _CPUGridLayerProps<DataT> = {
9
10
  /**
@@ -140,13 +141,17 @@ declare type _CPUGridLayerProps<DataT> = {
140
141
  /** Aggregate data into a grid-based heatmap. Aggregation is performed on CPU. */
141
142
  export default class CPUGridLayer<DataT = any, ExtraPropsT extends {} = {}> extends AggregationLayer<DataT, ExtraPropsT & Required<_CPUGridLayerProps<DataT>>> {
142
143
  static layerName: string;
143
- static defaultProps: DefaultProps<CPUGridLayerProps<any>>;
144
+ static defaultProps: DefaultProps<CPUGridLayerProps<unknown>>;
145
+ state: AggregationLayer<DataT>['state'] & {
146
+ cpuAggregator: CPUAggregator;
147
+ aggregatorState: CPUAggregator['state'];
148
+ };
144
149
  initializeState(): void;
145
150
  updateState(opts: UpdateParameters<this>): void;
146
151
  getPickingInfo({ info }: GetPickingInfoParams): PickingInfo;
147
152
  _onGetSublayerColor(cell: any): any;
148
153
  _onGetSublayerElevation(cell: any): any;
149
- _getSublayerUpdateTriggers(): any;
154
+ _getSublayerUpdateTriggers(): {};
150
155
  renderLayers(): Layer;
151
156
  }
152
157
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"cpu-grid-layer.d.ts","sourceRoot":"","sources":["../../src/cpu-grid-layer/cpu-grid-layer.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAKlG,OAAO,gBAAgB,EAAE,EAAC,qBAAqB,EAAC,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAC,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACzF,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AA4C3C,gDAAgD;AAChD,oBAAY,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AAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IAEtD;;;OAGG;IACH,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IAE1D;;OAEG;IACH,WAAW,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,OAAO,CAAC,CAAC;CAC7C,CAAC;AAEF,iFAAiF;AACjF,MAAM,CAAC,OAAO,OAAO,YAAY,CAC/B,KAAK,GAAG,GAAG,EACX,WAAW,SAAS,EAAE,GAAG,EAAE,CAC3B,SAAQ,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAClF,MAAM,CAAC,SAAS,SAAkB;IAClC,MAAM,CAAC,YAAY,2CAAgB;IAEnC,KAAK,EAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG;QACzC,aAAa,EAAE,aAAa,CAAC;QAC7B,eAAe,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;KACzC,CAAC;IAEF,eAAe,IAAI,IAAI;IAkBvB,WAAW,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAYxC,cAAc,CAAC,EAAC,IAAI,EAAC,EAAE,oBAAoB,GAAG,WAAW;IAKzD,mBAAmB,CAAC,IAAI,KAAA;IAKxB,uBAAuB,CAAC,IAAI,KAAA;IAI5B,0BAA0B;IAI1B,YAAY,IAAI,KAAK;CA8BtB"}
@@ -1,3 +1,11 @@
1
+ export declare type GridHash = {
2
+ [key: string]: {
3
+ count: number;
4
+ points: unknown[];
5
+ lonIdx: number;
6
+ latIdx: number;
7
+ };
8
+ };
1
9
  /**
2
10
  * Calculate density grid from an array of points
3
11
  * @param {Object} props - object containing :
@@ -16,8 +24,12 @@
16
24
  *
17
25
  * @returns {object} - grid data, cell dimension
18
26
  */
19
- export function pointToDensityGridDataCPU(props: {
20
- data?: Iterable<any> | undefined;
21
- cellSize?: any;
22
- }, aggregationParams: any): object;
27
+ export declare function pointToDensityGridDataCPU(props: any, aggregationParams: any): {
28
+ gridHash: GridHash;
29
+ gridOffset: {
30
+ xOffset: number;
31
+ yOffset: number;
32
+ };
33
+ data: any[];
34
+ };
23
35
  //# sourceMappingURL=grid-aggregator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grid-aggregator.d.ts","sourceRoot":"","sources":["../../src/cpu-grid-layer/grid-aggregator.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;GAiBG;AACH;IAf4B,IAAI;IACL,QAAQ;4BAYtB,MAAM,CAWlB"}
1
+ {"version":3,"file":"grid-aggregator.d.ts","sourceRoot":"","sources":["../../src/cpu-grid-layer/grid-aggregator.ts"],"names":[],"mappings":"AAuBA,oBAAY,QAAQ,GAAG;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,OAAO,EAAE,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,KAAA,EAAE,iBAAiB,KAAA;;;;;;;EASjE"}