@deck.gl/aggregation-layers 8.10.0-alpha.7 → 9.0.0-alpha.4
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 +9372 -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/LICENSE +0 -19
- 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
|
@@ -31,17 +31,17 @@ import {
|
|
|
31
31
|
UpdateParameters,
|
|
32
32
|
DefaultProps
|
|
33
33
|
} from '@deck.gl/core';
|
|
34
|
-
import
|
|
35
|
-
import
|
|
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
|
|
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 =
|
|
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?:
|
|
154
|
+
maxTexture?: Texture;
|
|
155
|
+
aggregationBuffer?: Buffer;
|
|
156
|
+
maxBuffer?: Buffer;
|
|
155
157
|
};
|
|
156
158
|
|
|
157
159
|
initializeState() {
|
|
158
|
-
|
|
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(
|
|
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.
|
|
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
|
-
|
|
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(
|
package/src/utils/bin-sorter.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
144
|
-
|
|
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:
|
|
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
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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(
|
|
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(
|
|
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
|
-
*
|
|
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
|
|