@deck.gl/aggregation-layers 8.8.0-alpha.5 → 8.8.0-beta.2
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 +753 -640
- package/dist/es5/aggregation-layer.js +19 -7
- package/dist/es5/aggregation-layer.js.map +1 -1
- package/dist/es5/contour-layer/contour-layer.js +5 -5
- package/dist/es5/contour-layer/contour-layer.js.map +1 -1
- package/dist/es5/contour-layer/contour-utils.js +1 -1
- package/dist/es5/contour-layer/contour-utils.js.map +1 -1
- package/dist/es5/contour-layer/marching-squares-codes.js.map +1 -1
- package/dist/es5/contour-layer/marching-squares.js.map +1 -1
- package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +5 -3
- package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +1 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +8 -12
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +12 -12
- package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
- package/dist/es5/grid-aggregation-layer.js +25 -12
- package/dist/es5/grid-aggregation-layer.js.map +1 -1
- package/dist/es5/grid-layer/grid-layer.js +18 -9
- package/dist/es5/grid-layer/grid-layer.js.map +1 -1
- package/dist/es5/heatmap-layer/heatmap-layer-utils.js +5 -2
- package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +1 -1
- package/dist/es5/heatmap-layer/heatmap-layer.js +19 -7
- package/dist/es5/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/es5/heatmap-layer/max-vs.glsl.js +1 -1
- package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js +1 -1
- package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js +1 -1
- package/dist/es5/heatmap-layer/triangle-layer.js +7 -7
- package/dist/es5/heatmap-layer/triangle-layer.js.map +1 -1
- package/dist/es5/heatmap-layer/weights-fs.glsl.js +1 -1
- package/dist/es5/heatmap-layer/weights-vs.glsl.js +1 -1
- package/dist/es5/hexagon-layer/hexagon-layer.js +16 -5
- 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 +26 -19
- package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
- package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js +1 -1
- package/dist/es5/screen-grid-layer/screen-grid-layer.js +18 -8
- package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +1 -1
- package/dist/es5/types.js +2 -0
- package/dist/es5/types.js.map +1 -0
- package/dist/es5/utils/bin-sorter.js +9 -0
- package/dist/es5/utils/bin-sorter.js.map +1 -1
- package/dist/es5/utils/color-utils.js.map +1 -1
- package/dist/esm/aggregation-layer.js +12 -5
- package/dist/esm/aggregation-layer.js.map +1 -1
- package/dist/esm/contour-layer/contour-layer.js +6 -3
- package/dist/esm/contour-layer/contour-layer.js.map +1 -1
- package/dist/esm/contour-layer/contour-utils.js +1 -1
- package/dist/esm/contour-layer/contour-utils.js.map +1 -1
- package/dist/esm/contour-layer/marching-squares-codes.js.map +1 -1
- package/dist/esm/contour-layer/marching-squares.js.map +1 -1
- package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +6 -3
- package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +1 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +1 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +1 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +8 -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 +11 -9
- package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
- package/dist/esm/grid-aggregation-layer.js +13 -5
- package/dist/esm/grid-aggregation-layer.js.map +1 -1
- package/dist/esm/grid-layer/grid-layer.js +15 -8
- package/dist/esm/grid-layer/grid-layer.js.map +1 -1
- package/dist/esm/heatmap-layer/heatmap-layer-utils.js +5 -2
- package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +1 -1
- package/dist/esm/heatmap-layer/heatmap-layer.js +24 -14
- package/dist/esm/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/esm/heatmap-layer/max-fs.glsl.js.map +1 -1
- package/dist/esm/heatmap-layer/max-vs.glsl.js +1 -1
- package/dist/esm/heatmap-layer/max-vs.glsl.js.map +1 -1
- package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +1 -1
- package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +1 -1
- package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js +1 -1
- package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js.map +1 -1
- package/dist/esm/heatmap-layer/triangle-layer.js +6 -5
- package/dist/esm/heatmap-layer/triangle-layer.js.map +1 -1
- package/dist/esm/heatmap-layer/weights-fs.glsl.js +1 -1
- package/dist/esm/heatmap-layer/weights-fs.glsl.js.map +1 -1
- package/dist/esm/heatmap-layer/weights-vs.glsl.js +1 -1
- package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +1 -1
- package/dist/esm/hexagon-layer/hexagon-layer.js +11 -2
- 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 +16 -10
- package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer.js +15 -7
- package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +1 -1
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/bin-sorter.js +16 -0
- package/dist/esm/utils/bin-sorter.js.map +1 -1
- package/dist/esm/utils/color-utils.js.map +1 -1
- package/dist.min.js +1 -1
- package/package.json +7 -5
- package/src/{aggregation-layer.js → aggregation-layer.ts} +32 -15
- package/src/contour-layer/{contour-layer.js → contour-layer.ts} +97 -16
- package/src/contour-layer/{contour-utils.js → contour-utils.ts} +11 -5
- package/src/contour-layer/{marching-squares-codes.js → marching-squares-codes.ts} +0 -0
- package/src/contour-layer/{marching-squares.js → marching-squares.ts} +6 -6
- package/src/cpu-grid-layer/cpu-grid-layer.ts +324 -0
- package/src/gpu-grid-layer/{gpu-grid-cell-layer-fragment.glsl.js → gpu-grid-cell-layer-fragment.glsl.ts} +0 -0
- package/src/gpu-grid-layer/{gpu-grid-cell-layer-vertex.glsl.js → gpu-grid-cell-layer-vertex.glsl.ts} +0 -0
- package/src/gpu-grid-layer/{gpu-grid-cell-layer.js → gpu-grid-cell-layer.ts} +36 -19
- package/src/gpu-grid-layer/{gpu-grid-layer.js → gpu-grid-layer.ts} +125 -18
- package/src/{grid-aggregation-layer.js → grid-aggregation-layer.ts} +25 -13
- package/src/grid-layer/{grid-layer.js → grid-layer.ts} +45 -14
- package/src/heatmap-layer/{heatmap-layer-utils.js → heatmap-layer-utils.ts} +15 -10
- package/src/heatmap-layer/{heatmap-layer.js → heatmap-layer.ts} +147 -32
- package/src/heatmap-layer/{max-fs.glsl.js → max-fs.glsl.ts} +0 -0
- package/src/heatmap-layer/{max-vs.glsl.js → max-vs.glsl.ts} +0 -0
- package/src/heatmap-layer/{triangle-layer-fragment.glsl.js → triangle-layer-fragment.glsl.ts} +0 -0
- package/src/heatmap-layer/{triangle-layer-vertex.glsl.js → triangle-layer-vertex.glsl.ts} +0 -0
- package/src/heatmap-layer/{triangle-layer.js → triangle-layer.ts} +20 -10
- package/src/heatmap-layer/{weights-fs.glsl.js → weights-fs.glsl.ts} +0 -0
- package/src/heatmap-layer/{weights-vs.glsl.js → weights-vs.glsl.ts} +0 -0
- package/src/hexagon-layer/{hexagon-layer.js → hexagon-layer.ts} +194 -9
- package/src/index.ts +9 -0
- package/src/screen-grid-layer/{screen-grid-cell-layer.js → screen-grid-cell-layer.ts} +33 -15
- package/src/screen-grid-layer/{screen-grid-layer-fragment.glsl.js → screen-grid-layer-fragment.glsl.ts} +0 -0
- package/src/screen-grid-layer/{screen-grid-layer-vertex.glsl.js → screen-grid-layer-vertex.glsl.ts} +0 -0
- package/src/screen-grid-layer/{screen-grid-layer.js → screen-grid-layer.ts} +119 -16
- package/src/types.ts +10 -0
- package/src/utils/{bin-sorter.js → bin-sorter.ts} +26 -11
- package/src/utils/{color-utils.js → color-utils.ts} +1 -1
- package/typed/aggregation-layer.d.ts +38 -0
- package/typed/aggregation-layer.d.ts.map +1 -0
- package/typed/aggregation-layer.js +151 -0
- package/typed/contour-layer/contour-layer.d.ts +74 -0
- package/typed/contour-layer/contour-layer.d.ts.map +1 -0
- package/typed/contour-layer/contour-layer.js +234 -0
- package/typed/contour-layer/contour-utils.d.ts +18 -0
- package/typed/contour-layer/contour-utils.d.ts.map +1 -0
- package/typed/contour-layer/contour-utils.js +64 -0
- package/typed/contour-layer/marching-squares-codes.d.ts +32 -0
- package/typed/contour-layer/marching-squares-codes.d.ts.map +1 -0
- package/typed/contour-layer/marching-squares-codes.js +337 -0
- package/typed/contour-layer/marching-squares.d.ts +10 -0
- package/typed/contour-layer/marching-squares.d.ts.map +1 -0
- package/typed/contour-layer/marching-squares.js +147 -0
- package/typed/cpu-grid-layer/cpu-grid-layer.d.ts +152 -0
- package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -0
- package/typed/cpu-grid-layer/cpu-grid-layer.js +129 -0
- package/typed/cpu-grid-layer/grid-aggregator.d.ts +23 -0
- package/typed/cpu-grid-layer/grid-aggregator.d.ts.map +1 -0
- package/typed/cpu-grid-layer/grid-aggregator.js +141 -0
- package/typed/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +3 -0
- package/typed/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +1 -0
- package/typed/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +34 -0
- package/typed/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +3 -0
- package/typed/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +1 -0
- package/typed/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +141 -0
- package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts +34 -0
- package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -0
- package/typed/gpu-grid-layer/gpu-grid-cell-layer.js +143 -0
- package/typed/gpu-grid-layer/gpu-grid-layer.d.ts +96 -0
- package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -0
- package/typed/gpu-grid-layer/gpu-grid-layer.js +289 -0
- package/typed/grid-aggregation-layer.d.ts +32 -0
- package/typed/grid-aggregation-layer.d.ts.map +1 -0
- package/typed/grid-aggregation-layer.js +172 -0
- package/typed/grid-layer/grid-layer.d.ts +31 -0
- package/typed/grid-layer/grid-layer.d.ts.map +1 -0
- package/typed/grid-layer/grid-layer.js +60 -0
- package/typed/heatmap-layer/heatmap-layer-utils.d.ts +13 -0
- package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -0
- package/typed/heatmap-layer/heatmap-layer-utils.js +78 -0
- package/typed/heatmap-layer/heatmap-layer.d.ts +116 -0
- package/typed/heatmap-layer/heatmap-layer.d.ts.map +1 -0
- package/typed/heatmap-layer/heatmap-layer.js +478 -0
- package/typed/heatmap-layer/max-fs.glsl.d.ts +3 -0
- package/typed/heatmap-layer/max-fs.glsl.d.ts.map +1 -0
- package/typed/heatmap-layer/max-fs.glsl.js +7 -0
- package/typed/heatmap-layer/max-vs.glsl.d.ts +3 -0
- package/typed/heatmap-layer/max-vs.glsl.d.ts.map +1 -0
- package/typed/heatmap-layer/max-vs.glsl.js +12 -0
- package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts +3 -0
- package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -0
- package/typed/heatmap-layer/triangle-layer-fragment.glsl.js +58 -0
- package/typed/heatmap-layer/triangle-layer-vertex.glsl.d.ts +3 -0
- package/typed/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -0
- package/typed/heatmap-layer/triangle-layer-vertex.glsl.js +51 -0
- package/typed/heatmap-layer/triangle-layer.d.ts +27 -0
- package/typed/heatmap-layer/triangle-layer.d.ts.map +1 -0
- package/typed/heatmap-layer/triangle-layer.js +67 -0
- package/typed/heatmap-layer/weights-fs.glsl.d.ts +3 -0
- package/typed/heatmap-layer/weights-fs.glsl.d.ts.map +1 -0
- package/typed/heatmap-layer/weights-fs.glsl.js +19 -0
- package/typed/heatmap-layer/weights-vs.glsl.d.ts +3 -0
- package/typed/heatmap-layer/weights-vs.glsl.d.ts.map +1 -0
- package/typed/heatmap-layer/weights-vs.glsl.js +23 -0
- package/typed/hexagon-layer/hexagon-aggregator.d.ts +24 -0
- package/typed/hexagon-layer/hexagon-aggregator.d.ts.map +1 -0
- package/typed/hexagon-layer/hexagon-aggregator.js +112 -0
- package/typed/hexagon-layer/hexagon-layer.d.ts +165 -0
- package/typed/hexagon-layer/hexagon-layer.d.ts.map +1 -0
- package/typed/hexagon-layer/hexagon-layer.js +171 -0
- package/typed/index.d.ts +20 -0
- package/typed/index.d.ts.map +1 -0
- package/typed/index.js +33 -0
- package/typed/package.json +6 -0
- package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts +42 -0
- package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -0
- package/typed/screen-grid-layer/screen-grid-cell-layer.js +159 -0
- package/typed/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +3 -0
- package/typed/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -0
- package/typed/screen-grid-layer/screen-grid-layer-fragment.glsl.js +37 -0
- package/typed/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +3 -0
- package/typed/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -0
- package/typed/screen-grid-layer/screen-grid-layer-vertex.glsl.js +83 -0
- package/typed/screen-grid-layer/screen-grid-layer.d.ts +95 -0
- package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +1 -0
- package/typed/screen-grid-layer/screen-grid-layer.js +216 -0
- package/typed/types.d.ts +11 -0
- package/typed/types.d.ts.map +1 -0
- package/typed/types.js +1 -0
- package/typed/utils/aggregation-operation-utils.d.ts +13 -0
- package/typed/utils/aggregation-operation-utils.d.ts.map +1 -0
- package/typed/utils/aggregation-operation-utils.js +94 -0
- package/typed/utils/bin-sorter.d.ts +52 -0
- package/typed/utils/bin-sorter.d.ts.map +1 -0
- package/typed/utils/bin-sorter.js +167 -0
- package/typed/utils/color-utils.d.ts +3 -0
- package/typed/utils/color-utils.d.ts.map +1 -0
- package/typed/utils/color-utils.js +53 -0
- package/typed/utils/cpu-aggregator.d.ts +155 -0
- package/typed/utils/cpu-aggregator.d.ts.map +1 -0
- package/typed/utils/cpu-aggregator.js +417 -0
- package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +3 -0
- package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +1 -0
- package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +39 -0
- package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +3 -0
- package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +1 -0
- package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +53 -0
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +3 -0
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +1 -0
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +31 -0
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +3 -0
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +1 -0
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +77 -0
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +36 -0
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +1 -0
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +41 -0
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +1 -0
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +1 -0
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +1 -0
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +66 -0
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -0
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +562 -0
- package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +3 -0
- package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +1 -0
- package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +36 -0
- package/typed/utils/grid-aggregation-utils.d.ts +24 -0
- package/typed/utils/grid-aggregation-utils.d.ts.map +1 -0
- package/typed/utils/grid-aggregation-utils.js +114 -0
- package/typed/utils/prop-utils.d.ts +2 -0
- package/typed/utils/prop-utils.d.ts.map +1 -0
- package/typed/utils/prop-utils.js +28 -0
- package/typed/utils/resource-utils.d.ts +4 -0
- package/typed/utils/resource-utils.d.ts.map +1 -0
- package/typed/utils/resource-utils.js +40 -0
- package/typed/utils/scale-utils.d.ts +15 -0
- package/typed/utils/scale-utils.d.ts.map +1 -0
- package/typed/utils/scale-utils.js +184 -0
- package/src/cpu-grid-layer/cpu-grid-layer.js +0 -153
|
@@ -18,18 +18,32 @@
|
|
|
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 AggregationLayer from './aggregation-layer';
|
|
21
|
+
import AggregationLayer, {AggregationLayerProps} from './aggregation-layer';
|
|
22
22
|
import GPUGridAggregator from './utils/gpu-grid-aggregation/gpu-grid-aggregator';
|
|
23
23
|
import {Buffer} from '@luma.gl/core';
|
|
24
|
-
import {log} from '@deck.gl/core';
|
|
24
|
+
import {LayerContext, log, UpdateParameters} from '@deck.gl/core';
|
|
25
25
|
import GL from '@luma.gl/constants';
|
|
26
26
|
import BinSorter from './utils/bin-sorter';
|
|
27
27
|
import {pointToDensityGridDataCPU} from './cpu-grid-layer/grid-aggregator';
|
|
28
28
|
|
|
29
|
-
export
|
|
30
|
-
|
|
29
|
+
export type GridAggregationLayerProps<DataT = any> = AggregationLayerProps<DataT>;
|
|
30
|
+
|
|
31
|
+
export default abstract class GridAggregationLayer<
|
|
32
|
+
ExtraPropsT = {}
|
|
33
|
+
> extends AggregationLayer<ExtraPropsT> {
|
|
34
|
+
static layerName = 'GridAggregationLayer';
|
|
35
|
+
|
|
36
|
+
state!: AggregationLayer['state'] & {
|
|
37
|
+
aggregationDataDirty?: any;
|
|
38
|
+
aggregationWeightsDirty?: any;
|
|
39
|
+
gpuAggregation?: any;
|
|
40
|
+
getValue?: () => any;
|
|
41
|
+
sortedBins?: BinSorter;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
initializeAggregationLayer({dimensions}) {
|
|
31
45
|
const {gl} = this.context;
|
|
32
|
-
super.
|
|
46
|
+
super.initializeAggregationLayer(dimensions);
|
|
33
47
|
this.setState({
|
|
34
48
|
// CPU aggregation results
|
|
35
49
|
layerData: {},
|
|
@@ -38,7 +52,7 @@ export default class GridAggregationLayer extends AggregationLayer {
|
|
|
38
52
|
});
|
|
39
53
|
}
|
|
40
54
|
|
|
41
|
-
updateState(opts) {
|
|
55
|
+
updateState(opts: UpdateParameters<this>) {
|
|
42
56
|
// get current attributes
|
|
43
57
|
super.updateState(opts);
|
|
44
58
|
|
|
@@ -68,16 +82,16 @@ export default class GridAggregationLayer extends AggregationLayer {
|
|
|
68
82
|
this.setState({aggregationDirty});
|
|
69
83
|
}
|
|
70
84
|
|
|
71
|
-
finalizeState() {
|
|
85
|
+
finalizeState(context: LayerContext) {
|
|
72
86
|
const {count} = this.state.weights;
|
|
73
87
|
if (count && count.aggregationBuffer) {
|
|
74
88
|
count.aggregationBuffer.delete();
|
|
75
89
|
}
|
|
76
90
|
this.state.gpuGridAggregator?.delete();
|
|
77
|
-
super.finalizeState();
|
|
91
|
+
super.finalizeState(context);
|
|
78
92
|
}
|
|
79
93
|
|
|
80
|
-
updateShaders(shaders) {
|
|
94
|
+
updateShaders(shaders: any): void {
|
|
81
95
|
if (this.state.gpuAggregation) {
|
|
82
96
|
this.state.gpuGridAggregator.updateShaders(shaders);
|
|
83
97
|
}
|
|
@@ -179,10 +193,10 @@ export default class GridAggregationLayer extends AggregationLayer {
|
|
|
179
193
|
this.setState({sortedBins});
|
|
180
194
|
}
|
|
181
195
|
|
|
182
|
-
_uploadAggregationResults() {
|
|
196
|
+
_uploadAggregationResults(): void {
|
|
183
197
|
const {numCol, numRow} = this.state;
|
|
184
198
|
const {data} = this.state.layerData;
|
|
185
|
-
const {aggregatedBins, minValue, maxValue, totalCount} = this.state.sortedBins
|
|
199
|
+
const {aggregatedBins, minValue, maxValue, totalCount} = this.state.sortedBins!;
|
|
186
200
|
|
|
187
201
|
const ELEMENTCOUNT = 4;
|
|
188
202
|
const aggregationSize = numCol * numRow * ELEMENTCOUNT;
|
|
@@ -200,5 +214,3 @@ export default class GridAggregationLayer extends AggregationLayer {
|
|
|
200
214
|
this.updateResults({aggregationData, maxMinData, maxData, minData});
|
|
201
215
|
}
|
|
202
216
|
}
|
|
203
|
-
|
|
204
|
-
GridAggregationLayer.layerName = 'GridAggregationLayer';
|
|
@@ -1,28 +1,62 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CompositeLayer,
|
|
3
|
+
CompositeLayerProps,
|
|
4
|
+
Layer,
|
|
5
|
+
UpdateParameters,
|
|
6
|
+
DefaultProps
|
|
7
|
+
} from '@deck.gl/core';
|
|
2
8
|
import GPUGridAggregator from '../utils/gpu-grid-aggregation/gpu-grid-aggregator';
|
|
3
|
-
import GPUGridLayer from '../gpu-grid-layer/gpu-grid-layer';
|
|
4
|
-
import CPUGridLayer from '../cpu-grid-layer/cpu-grid-layer';
|
|
9
|
+
import GPUGridLayer, {_GPUGridLayerProps} from '../gpu-grid-layer/gpu-grid-layer';
|
|
10
|
+
import CPUGridLayer, {_CPUGridLayerProps} from '../cpu-grid-layer/cpu-grid-layer';
|
|
5
11
|
|
|
6
|
-
const defaultProps = {
|
|
12
|
+
const defaultProps: DefaultProps<GridLayerProps> = {
|
|
7
13
|
...GPUGridLayer.defaultProps,
|
|
8
14
|
...CPUGridLayer.defaultProps,
|
|
9
15
|
gpuAggregation: false
|
|
10
16
|
};
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
/** All properties supported by GridLayer. */
|
|
19
|
+
export type GridLayerProps<DataT = any> = _GridLayerProps<DataT> & CompositeLayerProps<DataT>;
|
|
20
|
+
|
|
21
|
+
/** Properties added by GridLayer. */
|
|
22
|
+
type _GridLayerProps<DataT> = _CPUGridLayerProps<DataT> &
|
|
23
|
+
_GPUGridLayerProps<DataT> & {
|
|
24
|
+
/**
|
|
25
|
+
* Whether the aggregation should be performed in high-precision 64-bit mode.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
fp64?: boolean;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* When set to true, aggregation is performed on GPU, provided other conditions are met.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
gpuAggregation?: boolean;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default class GridLayer<DataT = any, ExtraPropsT = {}> extends CompositeLayer<
|
|
38
|
+
ExtraPropsT & Required<_GridLayerProps<DataT>>
|
|
39
|
+
> {
|
|
40
|
+
static layerName = 'GridLayer';
|
|
41
|
+
static defaultProps = defaultProps;
|
|
42
|
+
|
|
43
|
+
state!: CompositeLayer['state'] & {
|
|
44
|
+
useGPUAggregation: boolean;
|
|
45
|
+
};
|
|
46
|
+
|
|
13
47
|
initializeState() {
|
|
14
48
|
this.state = {
|
|
15
49
|
useGPUAggregation: true
|
|
16
50
|
};
|
|
17
51
|
}
|
|
18
52
|
|
|
19
|
-
updateState({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
53
|
+
updateState({props}: UpdateParameters<this>) {
|
|
54
|
+
this.setState({
|
|
55
|
+
useGPUAggregation: this.canUseGPUAggregation(props)
|
|
56
|
+
});
|
|
23
57
|
}
|
|
24
58
|
|
|
25
|
-
renderLayers() {
|
|
59
|
+
renderLayers(): Layer {
|
|
26
60
|
const {data, updateTriggers} = this.props;
|
|
27
61
|
const id = this.state.useGPUAggregation ? 'GPU' : 'CPU';
|
|
28
62
|
const LayerType = this.state.useGPUAggregation
|
|
@@ -42,7 +76,7 @@ export default class GridLayer extends CompositeLayer {
|
|
|
42
76
|
|
|
43
77
|
// Private methods
|
|
44
78
|
|
|
45
|
-
canUseGPUAggregation(props) {
|
|
79
|
+
canUseGPUAggregation(props: GridLayer['props']) {
|
|
46
80
|
const {
|
|
47
81
|
gpuAggregation,
|
|
48
82
|
lowerPercentile,
|
|
@@ -73,6 +107,3 @@ export default class GridLayer extends CompositeLayer {
|
|
|
73
107
|
return true;
|
|
74
108
|
}
|
|
75
109
|
}
|
|
76
|
-
|
|
77
|
-
GridLayer.layerName = 'GridLayer';
|
|
78
|
-
GridLayer.defaultProps = defaultProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import GL from '@luma.gl/constants';
|
|
2
2
|
import {isWebGL2} from '@luma.gl/core';
|
|
3
3
|
|
|
4
|
-
export function getBounds(points) {
|
|
4
|
+
export function getBounds(points: number[][]): number[] {
|
|
5
5
|
// Now build bounding box in world space (aligned to world coordiante system)
|
|
6
6
|
const x = points.map(p => p[0]);
|
|
7
7
|
const y = points.map(p => p[1]);
|
|
@@ -15,7 +15,7 @@ export function getBounds(points) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// true if currentBounds contains targetBounds, false otherwise
|
|
18
|
-
export function boundsContain(currentBounds, targetBounds) {
|
|
18
|
+
export function boundsContain(currentBounds: number[], targetBounds: number[]): boolean {
|
|
19
19
|
if (
|
|
20
20
|
targetBounds[0] >= currentBounds[0] &&
|
|
21
21
|
targetBounds[2] <= currentBounds[2] &&
|
|
@@ -30,7 +30,7 @@ export function boundsContain(currentBounds, targetBounds) {
|
|
|
30
30
|
const scratchArray = new Float32Array(12);
|
|
31
31
|
|
|
32
32
|
// For given rectangle bounds generates two triangles vertices that coverit completely
|
|
33
|
-
export function packVertices(points, dimensions = 2) {
|
|
33
|
+
export function packVertices(points: number[][], dimensions: number = 2): Float32Array {
|
|
34
34
|
let index = 0;
|
|
35
35
|
for (const point of points) {
|
|
36
36
|
for (let i = 0; i < dimensions; i++) {
|
|
@@ -41,7 +41,7 @@ export function packVertices(points, dimensions = 2) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// Expands boundingBox:[xMin, yMin, xMax, yMax] to match aspect ratio of given width and height
|
|
44
|
-
export function scaleToAspectRatio(boundingBox, width, height) {
|
|
44
|
+
export function scaleToAspectRatio(boundingBox: number[], width: number, height: number): number[] {
|
|
45
45
|
const [xMin, yMin, xMax, yMax] = boundingBox;
|
|
46
46
|
|
|
47
47
|
const currentWidth = xMax - xMin;
|
|
@@ -73,16 +73,21 @@ export function scaleToAspectRatio(boundingBox, width, height) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// Get texture coordiante of point inside a bounding box
|
|
76
|
-
export function getTextureCoordinates(point, bounds) {
|
|
76
|
+
export function getTextureCoordinates(point: number[], bounds: number[]) {
|
|
77
77
|
const [xMin, yMin, xMax, yMax] = bounds;
|
|
78
78
|
return [(point[0] - xMin) / (xMax - xMin), (point[1] - yMin) / (yMax - yMin)];
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// Returns format and type for creating texture objects
|
|
82
82
|
export function getTextureParams({gl, floatTargetSupport}) {
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
return floatTargetSupport
|
|
84
|
+
? {
|
|
85
|
+
// format: should be RGBA32F on WebGL2 (float textures), RGBA in WebGL1 for float or non float textures
|
|
86
|
+
format: isWebGL2(gl) ? GL.RGBA32F : GL.RGBA,
|
|
87
|
+
type: GL.FLOAT
|
|
88
|
+
}
|
|
89
|
+
: {
|
|
90
|
+
format: GL.RGBA,
|
|
91
|
+
type: GL.UNSIGNED_BYTE
|
|
92
|
+
};
|
|
88
93
|
}
|
|
@@ -29,14 +29,28 @@ import {
|
|
|
29
29
|
getTextureParams
|
|
30
30
|
} from './heatmap-layer-utils';
|
|
31
31
|
import {Buffer, Texture2D, Transform, getParameters, FEATURES, hasFeatures} from '@luma.gl/core';
|
|
32
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
Accessor,
|
|
34
|
+
AccessorFunction,
|
|
35
|
+
AttributeManager,
|
|
36
|
+
ChangeFlags,
|
|
37
|
+
Color,
|
|
38
|
+
COORDINATE_SYSTEM,
|
|
39
|
+
Layer,
|
|
40
|
+
LayerContext,
|
|
41
|
+
LayersList,
|
|
42
|
+
log,
|
|
43
|
+
Position,
|
|
44
|
+
UpdateParameters,
|
|
45
|
+
DefaultProps
|
|
46
|
+
} from '@deck.gl/core';
|
|
33
47
|
import TriangleLayer from './triangle-layer';
|
|
34
|
-
import AggregationLayer from '../aggregation-layer';
|
|
48
|
+
import AggregationLayer, {AggregationLayerProps} from '../aggregation-layer';
|
|
35
49
|
import {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
50
|
+
import weightsVs from './weights-vs.glsl';
|
|
51
|
+
import weightsFs from './weights-fs.glsl';
|
|
52
|
+
import vsMax from './max-vs.glsl';
|
|
53
|
+
import fsMax from './max-fs.glsl';
|
|
40
54
|
|
|
41
55
|
const RESOLUTION = 2; // (number of common space pixels) / (number texels)
|
|
42
56
|
const TEXTURE_OPTIONS = {
|
|
@@ -55,7 +69,7 @@ const AGGREGATION_MODE = {
|
|
|
55
69
|
MEAN: 1
|
|
56
70
|
};
|
|
57
71
|
|
|
58
|
-
const defaultProps = {
|
|
72
|
+
const defaultProps: DefaultProps<HeatmapLayerProps> = {
|
|
59
73
|
getPosition: {type: 'accessor', value: x => x.position},
|
|
60
74
|
getWeight: {type: 'accessor', value: 1},
|
|
61
75
|
intensity: {type: 'number', min: 0, value: 1},
|
|
@@ -72,7 +86,11 @@ const defaultProps = {
|
|
|
72
86
|
const REQUIRED_FEATURES = [
|
|
73
87
|
FEATURES.BLEND_EQUATION_MINMAX, // max weight calculation
|
|
74
88
|
FEATURES.TEXTURE_FLOAT // weight-map as texture
|
|
75
|
-
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
const FLOAT_TARGET_FEATURES = [
|
|
92
|
+
FEATURES.COLOR_ATTACHMENT_RGBA32F, // ability to render to float texture
|
|
93
|
+
FEATURES.FLOAT_BLEND // ability to blend when rendering to float texture
|
|
76
94
|
];
|
|
77
95
|
|
|
78
96
|
const DIMENSIONS = {
|
|
@@ -81,7 +99,104 @@ const DIMENSIONS = {
|
|
|
81
99
|
}
|
|
82
100
|
};
|
|
83
101
|
|
|
84
|
-
export
|
|
102
|
+
export type HeatmapLayerProps<DataT = any> = _HeatmapLayerProps<DataT> &
|
|
103
|
+
AggregationLayerProps<DataT>;
|
|
104
|
+
|
|
105
|
+
type _HeatmapLayerProps<DataT> = {
|
|
106
|
+
/**
|
|
107
|
+
* Radius of the circle in pixels, to which the weight of an object is distributed.
|
|
108
|
+
*
|
|
109
|
+
* @default 30
|
|
110
|
+
*/
|
|
111
|
+
radiusPixels?: number;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Specified as an array of colors [color1, color2, ...].
|
|
115
|
+
*
|
|
116
|
+
* @default `6-class YlOrRd` - [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6)
|
|
117
|
+
*/
|
|
118
|
+
colorRange?: Color[];
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Value that is multiplied with the total weight at a pixel to obtain the final weight.
|
|
122
|
+
*
|
|
123
|
+
* @default 1
|
|
124
|
+
*/
|
|
125
|
+
intensity?: number;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Ratio of the fading weight to the max weight, between `0` and `1`.
|
|
129
|
+
*
|
|
130
|
+
* For example, `0.1` affects all pixels with weight under 10% of the max.
|
|
131
|
+
*
|
|
132
|
+
* Ignored when `colorDomain` is specified.
|
|
133
|
+
* @default 0.05
|
|
134
|
+
*/
|
|
135
|
+
threshold?: number;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Controls how weight values are mapped to the `colorRange`, as an array of two numbers [`minValue`, `maxValue`].
|
|
139
|
+
*
|
|
140
|
+
* @default null
|
|
141
|
+
*/
|
|
142
|
+
colorDomain?: [number, number] | null;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Defines the type of aggregation operation
|
|
146
|
+
*
|
|
147
|
+
* V valid values are 'SUM', 'MEAN'.
|
|
148
|
+
*
|
|
149
|
+
* @default 'SUM'
|
|
150
|
+
*/
|
|
151
|
+
aggregation?: 'SUM' | 'MEAN';
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Specifies the size of weight texture.
|
|
155
|
+
* @default 2048
|
|
156
|
+
*/
|
|
157
|
+
weightsTextureSize?: number;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Interval in milliseconds during which changes to the viewport don't trigger aggregation.
|
|
161
|
+
*
|
|
162
|
+
* @default 500
|
|
163
|
+
*/
|
|
164
|
+
debounceTimeout?: number;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Method called to retrieve the position of each object.
|
|
168
|
+
*
|
|
169
|
+
* @default d => d.position
|
|
170
|
+
*/
|
|
171
|
+
getPosition?: AccessorFunction<DataT, Position>;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* The weight of each object.
|
|
175
|
+
*
|
|
176
|
+
* @default 1
|
|
177
|
+
*/
|
|
178
|
+
getWeight?: Accessor<DataT, number>;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export default class HeatmapLayer<DataT = any, ExtraPropsT = {}> extends AggregationLayer<
|
|
182
|
+
ExtraPropsT & Required<_HeatmapLayerProps<DataT>>
|
|
183
|
+
> {
|
|
184
|
+
static layerName = 'HeatmapLayer';
|
|
185
|
+
static defaultProps = defaultProps;
|
|
186
|
+
|
|
187
|
+
state!: AggregationLayer['state'] & {
|
|
188
|
+
supported: boolean;
|
|
189
|
+
colorDomain?: number[];
|
|
190
|
+
isWeightMapDirty?: boolean;
|
|
191
|
+
weightsTexture?: Texture2D;
|
|
192
|
+
zoom?: number;
|
|
193
|
+
worldBounds?: number[];
|
|
194
|
+
normalizedCommonBounds?: number[];
|
|
195
|
+
updateTimer?: any;
|
|
196
|
+
triPositionBuffer?: Buffer;
|
|
197
|
+
triTexCoordBuffer?: Buffer;
|
|
198
|
+
};
|
|
199
|
+
|
|
85
200
|
initializeState() {
|
|
86
201
|
const {gl} = this.context;
|
|
87
202
|
if (!hasFeatures(gl, REQUIRED_FEATURES)) {
|
|
@@ -89,20 +204,20 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
89
204
|
log.error(`HeatmapLayer: ${this.id} is not supported on this browser`)();
|
|
90
205
|
return;
|
|
91
206
|
}
|
|
92
|
-
super.
|
|
207
|
+
super.initializeAggregationLayer(DIMENSIONS);
|
|
93
208
|
this.setState({supported: true, colorDomain: DEFAULT_COLOR_DOMAIN});
|
|
94
209
|
this._setupTextureParams();
|
|
95
210
|
this._setupAttributes();
|
|
96
211
|
this._setupResources();
|
|
97
212
|
}
|
|
98
213
|
|
|
99
|
-
shouldUpdateState({changeFlags}) {
|
|
214
|
+
shouldUpdateState({changeFlags}: UpdateParameters<this>) {
|
|
100
215
|
// Need to be updated when viewport changes
|
|
101
216
|
return changeFlags.somethingChanged;
|
|
102
217
|
}
|
|
103
218
|
|
|
104
219
|
/* eslint-disable max-statements,complexity */
|
|
105
|
-
updateState(opts) {
|
|
220
|
+
updateState(opts: UpdateParameters<this>) {
|
|
106
221
|
if (!this.state.supported) {
|
|
107
222
|
return;
|
|
108
223
|
}
|
|
@@ -110,7 +225,7 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
110
225
|
this._updateHeatmapState(opts);
|
|
111
226
|
}
|
|
112
227
|
|
|
113
|
-
_updateHeatmapState(opts) {
|
|
228
|
+
_updateHeatmapState(opts: UpdateParameters<this>) {
|
|
114
229
|
const {props, oldProps} = opts;
|
|
115
230
|
const changeFlags = this._getChangeFlags(opts);
|
|
116
231
|
|
|
@@ -140,7 +255,7 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
140
255
|
this.setState({zoom: opts.context.viewport.zoom});
|
|
141
256
|
}
|
|
142
257
|
|
|
143
|
-
renderLayers() {
|
|
258
|
+
renderLayers(): LayersList | Layer {
|
|
144
259
|
if (!this.state.supported) {
|
|
145
260
|
return [];
|
|
146
261
|
}
|
|
@@ -183,8 +298,8 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
183
298
|
);
|
|
184
299
|
}
|
|
185
300
|
|
|
186
|
-
finalizeState() {
|
|
187
|
-
super.finalizeState();
|
|
301
|
+
finalizeState(context: LayerContext) {
|
|
302
|
+
super.finalizeState(context);
|
|
188
303
|
const {
|
|
189
304
|
weightsTransform,
|
|
190
305
|
weightsTexture,
|
|
@@ -217,8 +332,11 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
217
332
|
});
|
|
218
333
|
}
|
|
219
334
|
|
|
220
|
-
_getChangeFlags(opts) {
|
|
221
|
-
const changeFlags
|
|
335
|
+
_getChangeFlags(opts: UpdateParameters<this>) {
|
|
336
|
+
const changeFlags: Partial<ChangeFlags> & {
|
|
337
|
+
boundsChanged?: boolean;
|
|
338
|
+
viewportZoomChanged?: boolean;
|
|
339
|
+
} = {};
|
|
222
340
|
const {dimensions} = this.state;
|
|
223
341
|
changeFlags.dataChanged =
|
|
224
342
|
this.isAttributeChanged() || // if any attribute is changed
|
|
@@ -253,7 +371,7 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
253
371
|
}
|
|
254
372
|
|
|
255
373
|
_setupAttributes() {
|
|
256
|
-
const attributeManager = this.getAttributeManager()
|
|
374
|
+
const attributeManager = this.getAttributeManager()!;
|
|
257
375
|
attributeManager.add({
|
|
258
376
|
positions: {size: 3, type: GL.DOUBLE, accessor: 'getPosition'},
|
|
259
377
|
weights: {size: 1, accessor: 'getWeight'}
|
|
@@ -266,7 +384,7 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
266
384
|
const {weightsTextureSize} = this.props;
|
|
267
385
|
|
|
268
386
|
const textureSize = Math.min(weightsTextureSize, getParameters(gl, gl.MAX_TEXTURE_SIZE));
|
|
269
|
-
const floatTargetSupport = hasFeatures(gl,
|
|
387
|
+
const floatTargetSupport = hasFeatures(gl, FLOAT_TARGET_FEATURES);
|
|
270
388
|
const {format, type} = getTextureParams({gl, floatTargetSupport});
|
|
271
389
|
const weightsScale = floatTargetSupport ? 1 : 1 / 255;
|
|
272
390
|
this.setState({textureSize, format, type, weightsScale});
|
|
@@ -281,12 +399,12 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
281
399
|
return super.getShaders(
|
|
282
400
|
type === 'max-weights-transform'
|
|
283
401
|
? {
|
|
284
|
-
vs:
|
|
285
|
-
_fs:
|
|
402
|
+
vs: vsMax,
|
|
403
|
+
_fs: fsMax
|
|
286
404
|
}
|
|
287
405
|
: {
|
|
288
|
-
vs:
|
|
289
|
-
_fs:
|
|
406
|
+
vs: weightsVs,
|
|
407
|
+
_fs: weightsFs
|
|
290
408
|
}
|
|
291
409
|
);
|
|
292
410
|
}
|
|
@@ -362,7 +480,7 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
362
480
|
}
|
|
363
481
|
|
|
364
482
|
// Computes world bounds area that needs to be processed for generate heatmap
|
|
365
|
-
_updateBounds(forceUpdate = false) {
|
|
483
|
+
_updateBounds(forceUpdate: any = false): boolean {
|
|
366
484
|
const {viewport} = this.context;
|
|
367
485
|
|
|
368
486
|
// Unproject all 4 corners of the current screen coordinates into world coordinates (lng/lat)
|
|
@@ -377,7 +495,7 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
377
495
|
// #1: get world bounds for current viewport extends
|
|
378
496
|
const visibleWorldBounds = getBounds(viewportCorners); // TODO: Change to visible bounds
|
|
379
497
|
|
|
380
|
-
const newState = {visibleWorldBounds, viewportCorners};
|
|
498
|
+
const newState: Partial<HeatmapLayer['state']> = {visibleWorldBounds, viewportCorners};
|
|
381
499
|
let boundsChanged = false;
|
|
382
500
|
|
|
383
501
|
if (
|
|
@@ -422,7 +540,7 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
422
540
|
triPositionBuffer.subData(packVertices(viewportCorners, 3));
|
|
423
541
|
|
|
424
542
|
const textureBounds = viewportCorners.map(p =>
|
|
425
|
-
getTextureCoordinates(viewport.projectPosition(p), normalizedCommonBounds)
|
|
543
|
+
getTextureCoordinates(viewport.projectPosition(p), normalizedCommonBounds!)
|
|
426
544
|
);
|
|
427
545
|
triTexCoordBuffer.subData(packVertices(textureBounds, 2));
|
|
428
546
|
}
|
|
@@ -430,7 +548,7 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
430
548
|
_updateColorTexture(opts) {
|
|
431
549
|
const {colorRange} = opts.props;
|
|
432
550
|
let {colorTexture} = this.state;
|
|
433
|
-
const colors = colorRangeToFlatArray(colorRange, false, Uint8Array);
|
|
551
|
+
const colors = colorRangeToFlatArray(colorRange, false, Uint8Array as any);
|
|
434
552
|
|
|
435
553
|
if (colorTexture) {
|
|
436
554
|
colorTexture.setImageData({
|
|
@@ -523,7 +641,7 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
523
641
|
// input: worldBounds: [minLong, minLat, maxLong, maxLat]
|
|
524
642
|
// input: opts.useLayerCoordinateSystem : layers coordiante system is used
|
|
525
643
|
// optput: commonBounds: [minX, minY, maxX, maxY] scaled to fit the current texture
|
|
526
|
-
_worldToCommonBounds(worldBounds, opts = {}) {
|
|
644
|
+
_worldToCommonBounds(worldBounds, opts: {useLayerCoordinateSystem?: boolean} = {}) {
|
|
527
645
|
const {useLayerCoordinateSystem = false} = opts;
|
|
528
646
|
const [minLong, minLat, maxLong, maxLat] = worldBounds;
|
|
529
647
|
const {viewport} = this.context;
|
|
@@ -574,6 +692,3 @@ export default class HeatmapLayer extends AggregationLayer {
|
|
|
574
692
|
return bottomLeftWorld.slice(0, 2).concat(topRightWorld.slice(0, 2));
|
|
575
693
|
}
|
|
576
694
|
}
|
|
577
|
-
|
|
578
|
-
HeatmapLayer.layerName = 'HeatmapLayer';
|
|
579
|
-
HeatmapLayer.defaultProps = defaultProps;
|
|
File without changes
|
|
File without changes
|
package/src/heatmap-layer/{triangle-layer-fragment.glsl.js → triangle-layer-fragment.glsl.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -19,19 +19,31 @@
|
|
|
19
19
|
// THE SOFTWARE.
|
|
20
20
|
|
|
21
21
|
import GL from '@luma.gl/constants';
|
|
22
|
-
import {Model, Geometry} from '@luma.gl/core';
|
|
23
|
-
import {Layer, project32} from '@deck.gl/core';
|
|
22
|
+
import {Model, Geometry, Texture2D} from '@luma.gl/core';
|
|
23
|
+
import {Layer, LayerContext, project32} from '@deck.gl/core';
|
|
24
24
|
import vs from './triangle-layer-vertex.glsl';
|
|
25
25
|
import fs from './triangle-layer-fragment.glsl';
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
type _TriangleLayerProps = {
|
|
28
|
+
colorDomain: number[];
|
|
29
|
+
aggregationMode: string;
|
|
30
|
+
threshold: number;
|
|
31
|
+
intensity: number;
|
|
32
|
+
vertexCount: number;
|
|
33
|
+
colorTexture: Texture2D;
|
|
34
|
+
maxTexture: Texture2D;
|
|
35
|
+
texture: Texture2D;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default class TriangleLayer extends Layer<_TriangleLayerProps> {
|
|
39
|
+
static layerName = 'TriangleLayer';
|
|
40
|
+
|
|
28
41
|
getShaders() {
|
|
29
42
|
return {vs, fs, modules: [project32]};
|
|
30
43
|
}
|
|
31
44
|
|
|
32
|
-
initializeState() {
|
|
33
|
-
const
|
|
34
|
-
const attributeManager = this.getAttributeManager();
|
|
45
|
+
initializeState({gl}: LayerContext): void {
|
|
46
|
+
const attributeManager = this.getAttributeManager()!;
|
|
35
47
|
attributeManager.add({
|
|
36
48
|
positions: {size: 3, noAlloc: true},
|
|
37
49
|
texCoords: {size: 2, noAlloc: true}
|
|
@@ -41,7 +53,7 @@ export default class TriangleLayer extends Layer {
|
|
|
41
53
|
});
|
|
42
54
|
}
|
|
43
55
|
|
|
44
|
-
_getModel(gl) {
|
|
56
|
+
_getModel(gl: WebGLRenderingContext): Model {
|
|
45
57
|
const {vertexCount} = this.props;
|
|
46
58
|
|
|
47
59
|
return new Model(gl, {
|
|
@@ -54,7 +66,7 @@ export default class TriangleLayer extends Layer {
|
|
|
54
66
|
});
|
|
55
67
|
}
|
|
56
68
|
|
|
57
|
-
draw({uniforms}) {
|
|
69
|
+
draw({uniforms}): void {
|
|
58
70
|
const {model} = this.state;
|
|
59
71
|
|
|
60
72
|
const {texture, maxTexture, colorTexture, intensity, threshold, aggregationMode, colorDomain} =
|
|
@@ -74,5 +86,3 @@ export default class TriangleLayer extends Layer {
|
|
|
74
86
|
.draw();
|
|
75
87
|
}
|
|
76
88
|
}
|
|
77
|
-
|
|
78
|
-
TriangleLayer.layerName = 'TriangleLayer';
|
|
File without changes
|
|
File without changes
|