@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.
- package/dist/dist.dev.js +9369 -356
- package/dist/es5/aggregation-layer.js +4 -6
- package/dist/es5/aggregation-layer.js.map +1 -1
- package/dist/es5/contour-layer/contour-layer.js +13 -2
- package/dist/es5/contour-layer/contour-layer.js.map +1 -1
- package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +12 -1
- package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
- package/dist/es5/cpu-grid-layer/grid-aggregator.js +12 -8
- package/dist/es5/cpu-grid-layer/grid-aggregator.js.map +1 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +27 -13
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +19 -10
- package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
- package/dist/es5/grid-aggregation-layer.js +7 -9
- package/dist/es5/grid-aggregation-layer.js.map +1 -1
- package/dist/es5/grid-layer/grid-layer.js +1 -1
- package/dist/es5/grid-layer/grid-layer.js.map +1 -1
- package/dist/es5/heatmap-layer/heatmap-layer-utils.js +3 -3
- package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +1 -1
- package/dist/es5/heatmap-layer/heatmap-layer.js +58 -55
- package/dist/es5/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/es5/heatmap-layer/triangle-layer.js +22 -12
- package/dist/es5/heatmap-layer/triangle-layer.js.map +1 -1
- package/dist/es5/hexagon-layer/hexagon-aggregator.js.map +1 -1
- package/dist/es5/hexagon-layer/hexagon-layer.js +2 -0
- package/dist/es5/hexagon-layer/hexagon-layer.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +23 -20
- package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
- package/dist/es5/screen-grid-layer/screen-grid-layer.js +6 -6
- package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +1 -1
- package/dist/es5/utils/aggregation-operation-utils.js.map +1 -1
- package/dist/es5/utils/bin-sorter.js.map +1 -1
- package/dist/es5/utils/cpu-aggregator.js +11 -7
- package/dist/es5/utils/cpu-aggregator.js.map +1 -1
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +7 -2
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +1 -1
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +83 -60
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +3 -3
- package/dist/es5/utils/grid-aggregation-utils.js.map +1 -1
- package/dist/es5/utils/prop-utils.js.map +1 -1
- package/dist/es5/utils/resource-utils.js +12 -23
- package/dist/es5/utils/resource-utils.js.map +1 -1
- package/dist/esm/aggregation-layer.js +4 -5
- package/dist/esm/aggregation-layer.js.map +1 -1
- package/dist/esm/contour-layer/contour-layer.js +7 -1
- package/dist/esm/contour-layer/contour-layer.js.map +1 -1
- package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +6 -0
- package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
- package/dist/esm/cpu-grid-layer/grid-aggregator.js +2 -1
- package/dist/esm/cpu-grid-layer/grid-aggregator.js.map +1 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +19 -10
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +13 -10
- package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
- package/dist/esm/grid-aggregation-layer.js +4 -8
- package/dist/esm/grid-aggregation-layer.js.map +1 -1
- package/dist/esm/grid-layer/grid-layer.js +1 -1
- package/dist/esm/grid-layer/grid-layer.js.map +1 -1
- package/dist/esm/heatmap-layer/heatmap-layer-utils.js +3 -3
- package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +1 -1
- package/dist/esm/heatmap-layer/heatmap-layer.js +40 -58
- package/dist/esm/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/esm/heatmap-layer/triangle-layer.js +13 -7
- package/dist/esm/heatmap-layer/triangle-layer.js.map +1 -1
- package/dist/esm/hexagon-layer/hexagon-aggregator.js.map +1 -1
- package/dist/esm/hexagon-layer/hexagon-layer.js +1 -0
- package/dist/esm/hexagon-layer/hexagon-layer.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +21 -24
- package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer.js +5 -8
- package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +1 -1
- package/dist/esm/utils/aggregation-operation-utils.js.map +1 -1
- package/dist/esm/utils/bin-sorter.js.map +1 -1
- package/dist/esm/utils/cpu-aggregator.js +11 -7
- package/dist/esm/utils/cpu-aggregator.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +4 -3
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +62 -51
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +3 -3
- package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +1 -1
- package/dist/esm/utils/grid-aggregation-utils.js.map +1 -1
- package/dist/esm/utils/prop-utils.js.map +1 -1
- package/dist/esm/utils/resource-utils.js +10 -17
- package/dist/esm/utils/resource-utils.js.map +1 -1
- package/dist.min.js +185 -30
- package/package.json +7 -5
- package/src/aggregation-layer.ts +7 -6
- package/src/contour-layer/contour-layer.ts +25 -9
- package/src/cpu-grid-layer/cpu-grid-layer.ts +8 -3
- package/src/cpu-grid-layer/{grid-aggregator.js → grid-aggregator.ts} +28 -4
- package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +38 -27
- package/src/gpu-grid-layer/gpu-grid-layer.ts +18 -12
- package/src/grid-aggregation-layer.ts +39 -13
- package/src/grid-layer/grid-layer.ts +2 -2
- package/src/heatmap-layer/heatmap-layer-utils.ts +10 -4
- package/src/heatmap-layer/heatmap-layer.ts +74 -67
- package/src/heatmap-layer/triangle-layer.ts +26 -22
- package/src/hexagon-layer/{hexagon-aggregator.js → hexagon-aggregator.ts} +5 -1
- package/src/hexagon-layer/hexagon-layer.ts +8 -5
- package/src/index.ts +0 -1
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +36 -33
- package/src/screen-grid-layer/screen-grid-layer.ts +12 -11
- package/src/utils/{aggregation-operation-utils.js → aggregation-operation-utils.ts} +8 -2
- package/src/utils/bin-sorter.ts +1 -1
- package/src/utils/{cpu-aggregator.js → cpu-aggregator.ts} +42 -30
- package/src/utils/gpu-grid-aggregation/{gpu-grid-aggregator-constants.js → gpu-grid-aggregator-constants.ts} +4 -4
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +3 -3
- package/src/utils/gpu-grid-aggregation/{gpu-grid-aggregator.js → gpu-grid-aggregator.ts} +123 -94
- package/src/utils/{grid-aggregation-utils.js → grid-aggregation-utils.ts} +1 -1
- package/src/utils/resource-utils.ts +59 -0
- package/typed/aggregation-layer.d.ts +4 -3
- package/typed/aggregation-layer.d.ts.map +1 -1
- package/typed/contour-layer/contour-layer.d.ts +19 -5
- package/typed/contour-layer/contour-layer.d.ts.map +1 -1
- package/typed/cpu-grid-layer/cpu-grid-layer.d.ts +8 -3
- package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -1
- package/typed/cpu-grid-layer/grid-aggregator.d.ts +16 -4
- package/typed/cpu-grid-layer/grid-aggregator.d.ts.map +1 -1
- package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts +18 -4
- package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -1
- package/typed/gpu-grid-layer/gpu-grid-layer.d.ts +8 -3
- package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -1
- package/typed/grid-aggregation-layer.d.ts +39 -4
- package/typed/grid-aggregation-layer.d.ts.map +1 -1
- package/typed/grid-layer/grid-layer.d.ts +2 -2
- package/typed/grid-layer/grid-layer.d.ts.map +1 -1
- package/typed/heatmap-layer/heatmap-layer-utils.d.ts +7 -5
- package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
- package/typed/heatmap-layer/heatmap-layer.d.ts +19 -6
- package/typed/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/typed/heatmap-layer/triangle-layer.d.ts +10 -6
- package/typed/heatmap-layer/triangle-layer.d.ts.map +1 -1
- package/typed/hexagon-layer/hexagon-aggregator.d.ts +6 -3
- package/typed/hexagon-layer/hexagon-aggregator.d.ts.map +1 -1
- package/typed/hexagon-layer/hexagon-layer.d.ts +5 -4
- package/typed/hexagon-layer/hexagon-layer.d.ts.map +1 -1
- package/typed/index.d.ts.map +1 -1
- package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts +10 -9
- package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/typed/screen-grid-layer/screen-grid-layer.d.ts +6 -4
- package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
- package/typed/utils/aggregation-operation-utils.d.ts +18 -12
- package/typed/utils/aggregation-operation-utils.d.ts.map +1 -1
- package/typed/utils/bin-sorter.d.ts +1 -1
- package/typed/utils/bin-sorter.d.ts.map +1 -1
- package/typed/utils/cpu-aggregator.d.ts +28 -14
- package/typed/utils/cpu-aggregator.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +35 -33
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +29 -19
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +1 -1
- package/typed/utils/grid-aggregation-utils.d.ts +11 -5
- package/typed/utils/grid-aggregation-utils.d.ts.map +1 -1
- package/typed/utils/prop-utils.d.ts +1 -1
- package/typed/utils/prop-utils.d.ts.map +1 -1
- package/typed/utils/resource-utils.d.ts +13 -3
- package/typed/utils/resource-utils.d.ts.map +1 -1
- package/src/utils/resource-utils.js +0 -51
- /package/src/utils/gpu-grid-aggregation/{aggregate-all-fs.glsl.js → aggregate-all-fs.glsl.ts} +0 -0
- /package/src/utils/gpu-grid-aggregation/{aggregate-all-vs.glsl.js → aggregate-all-vs.glsl.ts} +0 -0
- /package/src/utils/gpu-grid-aggregation/{aggregate-to-grid-fs.glsl.js → aggregate-to-grid-fs.glsl.ts} +0 -0
- /package/src/utils/gpu-grid-aggregation/{aggregate-to-grid-vs.glsl.js → aggregate-to-grid-vs.glsl.ts} +0 -0
- /package/src/utils/gpu-grid-aggregation/{gpu-grid-aggregator-utils.js → gpu-grid-aggregator-utils.ts} +0 -0
- /package/src/utils/gpu-grid-aggregation/{transform-mean-vs.glsl.js → transform-mean-vs.glsl.ts} +0 -0
- /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
|
|
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 {
|
|
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
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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({
|
|
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 =
|
|
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(
|
|
110
|
-
return
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
-
|
|
161
|
-
|
|
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?.
|
|
186
|
-
allAggregationModel?.
|
|
187
|
-
meanTransform?.
|
|
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 {
|
|
414
|
+
const {allAggregationModel} = this;
|
|
385
415
|
|
|
386
|
-
|
|
387
|
-
|
|
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
|
-
|
|
395
|
-
|
|
396
|
-
allAggregationModel.
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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 {
|
|
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
|
-
|
|
420
|
-
|
|
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
|
-
|
|
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(
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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?.
|
|
559
|
-
this.gridAggregationModel = getAggregationModel(
|
|
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(
|
|
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
|
-
|
|
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(
|
|
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(
|
|
646
|
-
id: '
|
|
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(
|
|
654
|
-
return new Model(
|
|
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
|
-
|
|
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(
|
|
670
|
-
return new Transform(
|
|
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:
|
|
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/
|
|
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):
|
|
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;
|
|
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;AAGvB,oBAAY,qBAAqB,CAAC,KAAK,IAAI,mBAAmB,GAAG;IAC/D,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;CAC9B,CAAC;AAEF,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,
|
|
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 =
|
|
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<
|
|
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():
|
|
69
|
-
updateAggregationState(opts:
|
|
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,
|
|
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,EAGL,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACX,MAAM,eAAe,CAAC;AAKvB,OAAO,oBAAoB,EAAE,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;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AE;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 =
|
|
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<
|
|
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():
|
|
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;
|
|
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;AAIlG,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,gBAAgB,EAAE,EAAC,qBAAqB,EAAC,MAAM,sBAAsB,CAAC;AAE7E,OAA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,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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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.
|
|
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"}
|