@deck.gl/aggregation-layers 9.0.34 → 9.1.0-beta.1
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/common/aggregation-layer.d.ts +30 -0
- package/dist/common/aggregation-layer.d.ts.map +1 -0
- package/dist/common/aggregation-layer.js +69 -0
- package/dist/common/aggregator/aggregator.d.ts +76 -0
- package/dist/common/aggregator/aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/aggregator.js +4 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts +27 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.js +66 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts +70 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js +139 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts +15 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.js +43 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts +21 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js +55 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts +18 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +20 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts +14 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +17 -0
- package/dist/common/aggregator/gpu-aggregator/utils.d.ts +6 -0
- package/dist/common/aggregator/gpu-aggregator/utils.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/utils.js +24 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts +24 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +215 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts +81 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js +201 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts +38 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +223 -0
- package/dist/common/aggregator/index.d.ts +6 -0
- package/dist/common/aggregator/index.d.ts.map +1 -0
- package/dist/common/aggregator/index.js +5 -0
- package/dist/common/types.d.ts +11 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/common/types.js +4 -0
- package/dist/common/utils/bounds-utils.d.ts +10 -0
- package/dist/common/utils/bounds-utils.d.ts.map +1 -0
- package/dist/common/utils/bounds-utils.js +20 -0
- package/dist/common/utils/color-utils.d.ts +10 -0
- package/dist/common/utils/color-utils.d.ts.map +1 -0
- package/dist/common/utils/color-utils.js +65 -0
- package/dist/common/utils/prop-utils.d.ts.map +1 -0
- package/dist/common/utils/prop-utils.js +12 -0
- package/dist/common/utils/scale-utils.d.ts +46 -0
- package/dist/common/utils/scale-utils.d.ts.map +1 -0
- package/dist/common/utils/scale-utils.js +180 -0
- package/dist/contour-layer/bin-options-uniforms.d.ts +13 -0
- package/dist/contour-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/contour-layer/bin-options-uniforms.js +17 -0
- package/dist/contour-layer/contour-layer.d.ts +42 -50
- package/dist/contour-layer/contour-layer.d.ts.map +1 -1
- package/dist/contour-layer/contour-layer.js +232 -192
- package/dist/contour-layer/contour-utils.d.ts +36 -15
- package/dist/contour-layer/contour-utils.d.ts.map +1 -1
- package/dist/contour-layer/contour-utils.js +24 -29
- package/dist/contour-layer/marching-squares-codes.d.ts.map +1 -1
- package/dist/contour-layer/marching-squares-codes.js +3 -0
- package/dist/contour-layer/marching-squares.d.ts +22 -6
- package/dist/contour-layer/marching-squares.d.ts.map +1 -1
- package/dist/contour-layer/marching-squares.js +71 -68
- package/dist/contour-layer/value-reader.d.ts +10 -0
- package/dist/contour-layer/value-reader.d.ts.map +1 -0
- package/dist/contour-layer/value-reader.js +46 -0
- package/dist/dist.dev.js +4842 -4081
- package/dist/grid-layer/bin-options-uniforms.d.ts +13 -0
- package/dist/grid-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/grid-layer/bin-options-uniforms.js +17 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts +3 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts.map +1 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.js +51 -0
- package/dist/grid-layer/grid-cell-layer.d.ts +32 -0
- package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -0
- package/dist/grid-layer/grid-cell-layer.js +93 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts +21 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts.map +1 -0
- package/dist/grid-layer/grid-layer-uniforms.js +23 -0
- package/dist/grid-layer/grid-layer.d.ts +175 -13
- package/dist/grid-layer/grid-layer.d.ts.map +1 -1
- package/dist/grid-layer/grid-layer.js +342 -46
- package/dist/{aggregation-layer.d.ts → heatmap-layer/aggregation-layer.d.ts} +1 -0
- package/dist/heatmap-layer/aggregation-layer.d.ts.map +1 -0
- package/dist/{aggregation-layer.js → heatmap-layer/aggregation-layer.js} +6 -21
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +30 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.js +32 -0
- package/dist/heatmap-layer/heatmap-layer-utils.d.ts +1 -1
- package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer-utils.js +3 -0
- package/dist/heatmap-layer/heatmap-layer.d.ts +6 -4
- package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer.js +43 -33
- package/dist/heatmap-layer/max-fs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/max-fs.glsl.js +3 -0
- package/dist/heatmap-layer/max-vs.glsl.d.ts +1 -1
- package/dist/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/max-vs.glsl.js +6 -4
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +5 -23
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +22 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.js +22 -0
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts +1 -1
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +10 -30
- package/dist/heatmap-layer/triangle-layer.d.ts +4 -10
- package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer.js +17 -30
- package/dist/heatmap-layer/weights-fs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/weights-fs.glsl.js +3 -0
- package/dist/heatmap-layer/weights-vs.glsl.d.ts +1 -1
- package/dist/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/weights-vs.glsl.js +6 -7
- package/dist/hexagon-layer/bin-options-uniforms.d.ts +14 -0
- package/dist/hexagon-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/hexagon-layer/bin-options-uniforms.js +17 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts +3 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js +55 -0
- package/dist/hexagon-layer/hexagon-cell-layer.d.ts +29 -0
- package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer.js +94 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +19 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.js +21 -0
- package/dist/hexagon-layer/hexagon-layer.d.ts +84 -54
- package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
- package/dist/hexagon-layer/hexagon-layer.js +307 -123
- package/dist/hexagon-layer/hexbin.d.ts +17 -0
- package/dist/hexagon-layer/hexbin.d.ts.map +1 -0
- package/dist/hexagon-layer/hexbin.js +69 -0
- package/dist/index.cjs +3025 -2946
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +7 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -27
- package/dist/screen-grid-layer/bin-options-uniforms.d.ts +11 -0
- package/dist/screen-grid-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/screen-grid-layer/bin-options-uniforms.js +15 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +11 -16
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-cell-layer.js +52 -134
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +4 -24
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +17 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +19 -0
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +21 -62
- package/dist/screen-grid-layer/screen-grid-layer.d.ts +33 -40
- package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer.js +157 -174
- package/dist.min.js +401 -382
- package/package.json +10 -9
- package/src/common/aggregation-layer.ts +107 -0
- package/src/common/aggregator/aggregator.ts +88 -0
- package/src/common/aggregator/cpu-aggregator/aggregate.ts +101 -0
- package/src/common/aggregator/cpu-aggregator/cpu-aggregator.ts +203 -0
- package/src/common/aggregator/cpu-aggregator/sort-bins.ts +63 -0
- package/src/common/aggregator/cpu-aggregator/vertex-accessor.ts +86 -0
- package/src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts +33 -0
- package/src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts +27 -0
- package/src/common/aggregator/gpu-aggregator/utils.ts +27 -0
- package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +247 -0
- package/src/common/aggregator/gpu-aggregator/webgl-aggregator.ts +274 -0
- package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +258 -0
- package/src/common/aggregator/index.ts +10 -0
- package/src/{types.ts → common/types.ts} +10 -4
- package/src/common/utils/bounds-utils.ts +34 -0
- package/src/common/utils/color-utils.ts +86 -0
- package/src/common/utils/prop-utils.ts +13 -0
- package/src/common/utils/scale-utils.ts +236 -0
- package/src/contour-layer/bin-options-uniforms.ts +26 -0
- package/src/contour-layer/contour-layer.ts +300 -265
- package/src/contour-layer/contour-utils.ts +68 -39
- package/src/contour-layer/marching-squares-codes.ts +4 -0
- package/src/contour-layer/marching-squares.ts +93 -82
- package/src/contour-layer/value-reader.ts +65 -0
- package/src/grid-layer/bin-options-uniforms.ts +26 -0
- package/src/grid-layer/grid-cell-layer-vertex.glsl.ts +68 -0
- package/src/grid-layer/grid-cell-layer.ts +141 -0
- package/src/grid-layer/grid-layer-uniforms.ts +37 -0
- package/src/grid-layer/grid-layer.ts +614 -73
- package/src/{aggregation-layer.ts → heatmap-layer/aggregation-layer.ts} +6 -21
- package/src/heatmap-layer/heatmap-layer-uniforms.ts +50 -0
- package/src/heatmap-layer/heatmap-layer-utils.ts +9 -1
- package/src/heatmap-layer/heatmap-layer.ts +59 -36
- package/src/heatmap-layer/max-fs.glsl.ts +4 -0
- package/src/heatmap-layer/max-vs.glsl.ts +7 -4
- package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +5 -23
- package/src/heatmap-layer/triangle-layer-uniforms.ts +37 -0
- package/src/heatmap-layer/triangle-layer-vertex.glsl.ts +10 -30
- package/src/heatmap-layer/triangle-layer.ts +26 -31
- package/src/heatmap-layer/weights-fs.glsl.ts +4 -0
- package/src/heatmap-layer/weights-vs.glsl.ts +7 -7
- package/src/hexagon-layer/bin-options-uniforms.ts +27 -0
- package/src/hexagon-layer/hexagon-cell-layer-vertex.glsl.ts +73 -0
- package/src/hexagon-layer/hexagon-cell-layer.ts +141 -0
- package/src/hexagon-layer/hexagon-layer-uniforms.ts +34 -0
- package/src/hexagon-layer/hexagon-layer.ts +454 -186
- package/src/hexagon-layer/hexbin.ts +79 -0
- package/src/index.ts +21 -34
- package/src/screen-grid-layer/bin-options-uniforms.ts +23 -0
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +71 -156
- package/src/screen-grid-layer/screen-grid-layer-fragment.glsl.ts +4 -24
- package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +31 -0
- package/src/screen-grid-layer/screen-grid-layer-vertex.glsl.ts +21 -64
- package/src/screen-grid-layer/screen-grid-layer.ts +194 -222
- package/dist/aggregation-layer.d.ts.map +0 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts +0 -158
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.js +0 -130
- package/dist/cpu-grid-layer/grid-aggregator.d.ts +0 -35
- package/dist/cpu-grid-layer/grid-aggregator.d.ts.map +0 -1
- package/dist/cpu-grid-layer/grid-aggregator.js +0 -141
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -3
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -30
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -3
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -112
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts +0 -48
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +0 -146
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +0 -99
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-layer.js +0 -289
- package/dist/grid-aggregation-layer.d.ts +0 -67
- package/dist/grid-aggregation-layer.d.ts.map +0 -1
- package/dist/grid-aggregation-layer.js +0 -173
- package/dist/hexagon-layer/hexagon-aggregator.d.ts +0 -27
- package/dist/hexagon-layer/hexagon-aggregator.d.ts.map +0 -1
- package/dist/hexagon-layer/hexagon-aggregator.js +0 -112
- package/dist/types.d.ts +0 -12
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/utils/aggregation-operation-utils.d.ts +0 -19
- package/dist/utils/aggregation-operation-utils.d.ts.map +0 -1
- package/dist/utils/aggregation-operation-utils.js +0 -94
- package/dist/utils/bin-sorter.d.ts +0 -52
- package/dist/utils/bin-sorter.d.ts.map +0 -1
- package/dist/utils/bin-sorter.js +0 -167
- package/dist/utils/color-utils.d.ts +0 -3
- package/dist/utils/color-utils.d.ts.map +0 -1
- package/dist/utils/color-utils.js +0 -53
- package/dist/utils/cpu-aggregator.d.ts +0 -169
- package/dist/utils/cpu-aggregator.d.ts.map +0 -1
- package/dist/utils/cpu-aggregator.js +0 -421
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -36
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -42
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -30
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -61
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -38
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -41
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -76
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -555
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -32
- package/dist/utils/grid-aggregation-utils.d.ts +0 -30
- package/dist/utils/grid-aggregation-utils.d.ts.map +0 -1
- package/dist/utils/grid-aggregation-utils.js +0 -114
- package/dist/utils/prop-utils.d.ts.map +0 -1
- package/dist/utils/prop-utils.js +0 -28
- package/dist/utils/resource-utils.d.ts +0 -14
- package/dist/utils/resource-utils.d.ts.map +0 -1
- package/dist/utils/resource-utils.js +0 -38
- package/dist/utils/scale-utils.d.ts +0 -15
- package/dist/utils/scale-utils.d.ts.map +0 -1
- package/dist/utils/scale-utils.js +0 -184
- package/src/cpu-grid-layer/cpu-grid-layer.ts +0 -329
- package/src/cpu-grid-layer/grid-aggregator.ts +0 -184
- package/src/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.ts +0 -35
- package/src/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.ts +0 -143
- package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +0 -201
- package/src/gpu-grid-layer/gpu-grid-layer.ts +0 -455
- package/src/grid-aggregation-layer.ts +0 -243
- package/src/hexagon-layer/hexagon-aggregator.ts +0 -127
- package/src/utils/aggregation-operation-utils.ts +0 -118
- package/src/utils/bin-sorter.ts +0 -218
- package/src/utils/color-utils.ts +0 -57
- package/src/utils/cpu-aggregator.ts +0 -503
- package/src/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.ts +0 -40
- package/src/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.ts +0 -54
- package/src/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.ts +0 -35
- package/src/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.ts +0 -79
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.ts +0 -46
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.ts +0 -0
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +0 -690
- package/src/utils/gpu-grid-aggregation/transform-mean-vs.glsl.ts +0 -38
- package/src/utils/grid-aggregation-utils.ts +0 -147
- package/src/utils/prop-utils.ts +0 -29
- package/src/utils/resource-utils.ts +0 -53
- package/src/utils/scale-utils.js +0 -219
- /package/dist/{utils → common/utils}/prop-utils.d.ts +0 -0
|
@@ -1,66 +1,41 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
20
4
|
|
|
21
5
|
import {
|
|
22
6
|
Accessor,
|
|
23
7
|
Color,
|
|
24
8
|
GetPickingInfoParams,
|
|
9
|
+
CompositeLayerProps,
|
|
25
10
|
Layer,
|
|
26
|
-
|
|
11
|
+
project32,
|
|
27
12
|
LayersList,
|
|
28
|
-
log,
|
|
29
13
|
PickingInfo,
|
|
30
14
|
Position,
|
|
31
15
|
UpdateParameters,
|
|
32
16
|
DefaultProps
|
|
33
17
|
} from '@deck.gl/core';
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import {AGGREGATION_OPERATION, getValueFunc} from '../utils/aggregation-operation-utils';
|
|
18
|
+
import {WebGLAggregator, CPUAggregator, AggregationOperation} from '../common/aggregator/index';
|
|
19
|
+
import AggregationLayer from '../common/aggregation-layer';
|
|
37
20
|
import ScreenGridCellLayer from './screen-grid-cell-layer';
|
|
38
|
-
import
|
|
39
|
-
import {
|
|
21
|
+
import {BinOptions, binOptionsUniforms} from './bin-options-uniforms';
|
|
22
|
+
import {defaultColorRange} from '../common/utils/color-utils';
|
|
40
23
|
|
|
41
24
|
const defaultProps: DefaultProps<ScreenGridLayerProps> = {
|
|
42
|
-
|
|
25
|
+
cellSizePixels: {type: 'number', value: 100, min: 1},
|
|
26
|
+
cellMarginPixels: {type: 'number', value: 2, min: 0},
|
|
27
|
+
colorRange: defaultColorRange,
|
|
28
|
+
colorScaleType: 'linear',
|
|
43
29
|
getPosition: {type: 'accessor', value: (d: any) => d.position},
|
|
44
30
|
getWeight: {type: 'accessor', value: 1},
|
|
45
31
|
|
|
46
|
-
gpuAggregation: false,
|
|
32
|
+
gpuAggregation: false,
|
|
47
33
|
aggregation: 'SUM'
|
|
48
34
|
};
|
|
49
35
|
|
|
50
|
-
const POSITION_ATTRIBUTE_NAME = 'positions';
|
|
51
|
-
const DIMENSIONS = {
|
|
52
|
-
data: {
|
|
53
|
-
props: ['cellSizePixels']
|
|
54
|
-
},
|
|
55
|
-
weights: {
|
|
56
|
-
props: ['aggregation'],
|
|
57
|
-
accessors: ['getWeight']
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
36
|
/** All properties supported by ScreenGridLayer. */
|
|
62
37
|
export type ScreenGridLayerProps<DataT = unknown> = _ScreenGridLayerProps<DataT> &
|
|
63
|
-
|
|
38
|
+
CompositeLayerProps;
|
|
64
39
|
|
|
65
40
|
/** Properties added by ScreenGridLayer. */
|
|
66
41
|
export type _ScreenGridLayerProps<DataT> = {
|
|
@@ -76,20 +51,6 @@ export type _ScreenGridLayerProps<DataT> = {
|
|
|
76
51
|
*/
|
|
77
52
|
cellMarginPixels?: number;
|
|
78
53
|
|
|
79
|
-
/**
|
|
80
|
-
* Expressed as an rgba array, minimal color that could be rendered by a tile.
|
|
81
|
-
* @default [0, 0, 0, 255]
|
|
82
|
-
* @deprecated Deprecated in version 5.2.0, use `colorRange` and `colorDomain` instead.
|
|
83
|
-
*/
|
|
84
|
-
minColor?: Color | null;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Expressed as an rgba array, maximal color that could be rendered by a tile.
|
|
88
|
-
* @default [0, 255, 0, 255]
|
|
89
|
-
* @deprecated Deprecated in version 5.2.0, use `colorRange` and `colorDomain` instead.
|
|
90
|
-
*/
|
|
91
|
-
maxColor?: Color | null;
|
|
92
|
-
|
|
93
54
|
/**
|
|
94
55
|
* Color scale input domain. The color scale maps continues numeric domain into discrete color range.
|
|
95
56
|
* @default [1, max(weight)]
|
|
@@ -103,6 +64,13 @@ export type _ScreenGridLayerProps<DataT> = {
|
|
|
103
64
|
*/
|
|
104
65
|
colorRange?: Color[];
|
|
105
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Scaling function used to determine the color of the grid cell.
|
|
69
|
+
* Supported Values are 'quantize', 'linear', 'quantile' and 'ordinal'.
|
|
70
|
+
* @default 'quantize'
|
|
71
|
+
*/
|
|
72
|
+
colorScaleType?: 'linear' | 'quantize';
|
|
73
|
+
|
|
106
74
|
/**
|
|
107
75
|
* Method called to retrieve the position of each object.
|
|
108
76
|
*
|
|
@@ -126,220 +94,224 @@ export type _ScreenGridLayerProps<DataT> = {
|
|
|
126
94
|
|
|
127
95
|
/**
|
|
128
96
|
* Defines the type of aggregation operation
|
|
129
|
-
*
|
|
130
|
-
* V valid values are 'SUM', 'MEAN', 'MIN' and 'MAX'.
|
|
97
|
+
* Valid values are 'SUM', 'MEAN', 'MIN', 'MAX', 'COUNT'.
|
|
131
98
|
*
|
|
132
99
|
* @default 'SUM'
|
|
133
100
|
*/
|
|
134
|
-
aggregation?:
|
|
101
|
+
aggregation?: AggregationOperation;
|
|
135
102
|
};
|
|
136
103
|
|
|
104
|
+
export type ScreenGridLayerPickingInfo<DataT> = PickingInfo<{
|
|
105
|
+
/** Column index of the picked cell, starting from 0 at the left of the viewport */
|
|
106
|
+
col: number;
|
|
107
|
+
/** Row index of the picked cell, starting from 0 at the top of the viewport */
|
|
108
|
+
row: number;
|
|
109
|
+
/** Aggregated value */
|
|
110
|
+
value: number;
|
|
111
|
+
/** Number of data points in the picked cell */
|
|
112
|
+
count: number;
|
|
113
|
+
/** Indices of the data objects in the picked cell. Only available if using CPU aggregation. */
|
|
114
|
+
pointIndices?: number[];
|
|
115
|
+
/** The data objects in the picked cell. Only available if using CPU aggregation and layer data is an array. */
|
|
116
|
+
points?: DataT[];
|
|
117
|
+
}>;
|
|
118
|
+
|
|
137
119
|
/** Aggregates data into histogram bins and renders them as a grid. */
|
|
138
120
|
export default class ScreenGridLayer<
|
|
139
121
|
DataT = any,
|
|
140
122
|
ExtraProps extends {} = {}
|
|
141
|
-
> extends
|
|
123
|
+
> extends AggregationLayer<DataT, ExtraProps & Required<_ScreenGridLayerProps<DataT>>> {
|
|
142
124
|
static layerName = 'ScreenGridLayer';
|
|
143
125
|
static defaultProps = defaultProps;
|
|
144
126
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
maxTexture?: Texture;
|
|
151
|
-
aggregationBuffer?: Buffer;
|
|
152
|
-
maxBuffer?: Buffer;
|
|
153
|
-
};
|
|
127
|
+
getAggregatorType(): string {
|
|
128
|
+
return this.props.gpuAggregation && WebGLAggregator.isSupported(this.context.device)
|
|
129
|
+
? 'gpu'
|
|
130
|
+
: 'cpu';
|
|
131
|
+
}
|
|
154
132
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
133
|
+
createAggregator(type: string): WebGLAggregator | CPUAggregator {
|
|
134
|
+
if (type === 'cpu' || !WebGLAggregator.isSupported(this.context.device)) {
|
|
135
|
+
return new CPUAggregator({
|
|
136
|
+
dimensions: 2,
|
|
137
|
+
getBin: {
|
|
138
|
+
sources: ['positions'],
|
|
139
|
+
getValue: ({positions}: {positions: number[]}, index: number, opts: BinOptions) => {
|
|
140
|
+
const viewport = this.context.viewport;
|
|
141
|
+
const p = viewport.project(positions);
|
|
142
|
+
const cellSizePixels: number = opts.cellSizePixels;
|
|
143
|
+
if (p[0] < 0 || p[0] >= viewport.width || p[1] < 0 || p[1] >= viewport.height) {
|
|
144
|
+
// Not on screen
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
return [Math.floor(p[0] / cellSizePixels), Math.floor(p[1] / cellSizePixels)];
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
getValue: [{sources: ['counts'], getValue: ({counts}) => counts}]
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return new WebGLAggregator(this.context.device, {
|
|
154
|
+
dimensions: 2,
|
|
155
|
+
channelCount: 1,
|
|
156
|
+
bufferLayout: this.getAttributeManager()!.getBufferLayouts({isInstanced: false}),
|
|
157
|
+
...super.getShaders({
|
|
158
|
+
modules: [project32, binOptionsUniforms],
|
|
159
|
+
vs: `
|
|
160
|
+
in vec3 positions;
|
|
161
|
+
in vec3 positions64Low;
|
|
162
|
+
in float counts;
|
|
163
|
+
|
|
164
|
+
void getBin(out ivec2 binId) {
|
|
165
|
+
vec4 pos = project_position_to_clipspace(positions, positions64Low, vec3(0.0));
|
|
166
|
+
vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize / project.devicePixelRatio;
|
|
167
|
+
vec2 gridCoords = floor(screenCoords / binOptions.cellSizePixels);
|
|
168
|
+
binId = ivec2(gridCoords);
|
|
169
|
+
}
|
|
170
|
+
void getValue(out float weight) {
|
|
171
|
+
weight = counts;
|
|
172
|
+
}
|
|
173
|
+
`
|
|
174
|
+
})
|
|
178
175
|
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
initializeState() {
|
|
179
|
+
super.initializeState();
|
|
180
|
+
|
|
179
181
|
const attributeManager = this.getAttributeManager()!;
|
|
180
182
|
attributeManager.add({
|
|
181
|
-
|
|
183
|
+
positions: {
|
|
182
184
|
size: 3,
|
|
183
185
|
accessor: 'getPosition',
|
|
184
186
|
type: 'float64',
|
|
185
187
|
fp64: this.use64bitPositions()
|
|
186
188
|
},
|
|
187
189
|
// this attribute is used in gpu aggregation path only
|
|
188
|
-
|
|
190
|
+
counts: {size: 1, accessor: 'getWeight'}
|
|
189
191
|
});
|
|
190
192
|
}
|
|
191
193
|
|
|
192
194
|
shouldUpdateState({changeFlags}: UpdateParameters<this>) {
|
|
193
|
-
return
|
|
195
|
+
return changeFlags.somethingChanged;
|
|
194
196
|
}
|
|
195
197
|
|
|
196
|
-
updateState(
|
|
197
|
-
super.updateState(
|
|
198
|
+
updateState(params: UpdateParameters<this>) {
|
|
199
|
+
const aggregatorChanged = super.updateState(params);
|
|
200
|
+
|
|
201
|
+
const {props, oldProps, changeFlags} = params;
|
|
202
|
+
const {cellSizePixels, aggregation} = props;
|
|
203
|
+
if (
|
|
204
|
+
aggregatorChanged ||
|
|
205
|
+
changeFlags.dataChanged ||
|
|
206
|
+
changeFlags.updateTriggersChanged ||
|
|
207
|
+
changeFlags.viewportChanged ||
|
|
208
|
+
aggregation !== oldProps.aggregation ||
|
|
209
|
+
cellSizePixels !== oldProps.cellSizePixels
|
|
210
|
+
) {
|
|
211
|
+
const {width, height} = this.context.viewport;
|
|
212
|
+
const {aggregator} = this.state;
|
|
213
|
+
|
|
214
|
+
if (aggregator instanceof WebGLAggregator) {
|
|
215
|
+
aggregator.setProps({
|
|
216
|
+
binIdRange: [
|
|
217
|
+
[0, Math.ceil(width / cellSizePixels)],
|
|
218
|
+
[0, Math.ceil(height / cellSizePixels)]
|
|
219
|
+
]
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
aggregator.setProps({
|
|
224
|
+
pointCount: this.getNumInstances(),
|
|
225
|
+
operations: [aggregation],
|
|
226
|
+
binOptions: {
|
|
227
|
+
cellSizePixels
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (changeFlags.viewportChanged) {
|
|
233
|
+
// Rerun aggregation on viewport change
|
|
234
|
+
this.state.aggregator.setNeedsUpdate();
|
|
235
|
+
}
|
|
236
|
+
return aggregatorChanged;
|
|
198
237
|
}
|
|
199
238
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
239
|
+
onAttributeChange(id: string) {
|
|
240
|
+
const {aggregator} = this.state;
|
|
241
|
+
switch (id) {
|
|
242
|
+
case 'positions':
|
|
243
|
+
aggregator.setNeedsUpdate();
|
|
244
|
+
break;
|
|
245
|
+
|
|
246
|
+
case 'counts':
|
|
247
|
+
aggregator.setNeedsUpdate(0);
|
|
248
|
+
break;
|
|
249
|
+
|
|
250
|
+
default:
|
|
251
|
+
// This should not happen
|
|
203
252
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
renderLayers(): LayersList | Layer | null {
|
|
256
|
+
const {aggregator} = this.state;
|
|
207
257
|
const CellLayerClass = this.getSubLayerClass('cells', ScreenGridCellLayer);
|
|
258
|
+
const binAttribute = aggregator.getBins();
|
|
259
|
+
const weightAttribute = aggregator.getResult(0);
|
|
208
260
|
|
|
209
261
|
return new CellLayerClass(
|
|
210
262
|
this.props,
|
|
211
263
|
this.getSubLayerProps({
|
|
212
|
-
id: 'cell-layer'
|
|
213
|
-
updateTriggers
|
|
264
|
+
id: 'cell-layer'
|
|
214
265
|
}),
|
|
215
266
|
{
|
|
216
|
-
data: {
|
|
217
|
-
|
|
218
|
-
|
|
267
|
+
data: {
|
|
268
|
+
length: aggregator.binCount,
|
|
269
|
+
attributes: {
|
|
270
|
+
getBin: binAttribute,
|
|
271
|
+
getWeight: weightAttribute
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
// Data has changed shallowly, but we likely don't need to update the attributes
|
|
275
|
+
dataComparator: (data, oldData) => data.length === oldData.length,
|
|
276
|
+
updateTriggers: {
|
|
277
|
+
getBin: [binAttribute],
|
|
278
|
+
getWeight: [weightAttribute]
|
|
279
|
+
},
|
|
280
|
+
parameters: {
|
|
281
|
+
depthWriteEnabled: false,
|
|
282
|
+
...this.props.parameters
|
|
283
|
+
},
|
|
284
|
+
// Evaluate domain at draw() time
|
|
285
|
+
colorDomain: () => this.props.colorDomain || aggregator.getResultDomain(0),
|
|
286
|
+
// Extensions are already handled by the GPUAggregator, do not pass it down
|
|
287
|
+
extensions: []
|
|
219
288
|
}
|
|
220
289
|
);
|
|
221
290
|
}
|
|
222
291
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
const {aggregationBuffer, maxBuffer, maxTexture} = this.state;
|
|
227
|
-
|
|
228
|
-
aggregationBuffer?.delete();
|
|
229
|
-
maxBuffer?.delete();
|
|
230
|
-
maxTexture?.delete();
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
getPickingInfo({info}: GetPickingInfoParams): PickingInfo {
|
|
292
|
+
getPickingInfo(params: GetPickingInfoParams): ScreenGridLayerPickingInfo<DataT> {
|
|
293
|
+
const info: ScreenGridLayerPickingInfo<DataT> = params.info;
|
|
234
294
|
const {index} = info;
|
|
235
295
|
if (index >= 0) {
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Aggregation Overrides
|
|
254
|
-
|
|
255
|
-
updateResults({aggregationData, maxData}) {
|
|
256
|
-
const {count} = this.state.weights;
|
|
257
|
-
count.aggregationData = aggregationData;
|
|
258
|
-
count.aggregationBuffer.write(aggregationData);
|
|
259
|
-
count.maxData = maxData;
|
|
260
|
-
count.maxTexture.setImageData({data: maxData});
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/* eslint-disable complexity, max-statements */
|
|
264
|
-
updateAggregationState(opts) {
|
|
265
|
-
const cellSize = opts.props.cellSizePixels;
|
|
266
|
-
const cellSizeChanged = opts.oldProps.cellSizePixels !== cellSize;
|
|
267
|
-
const {viewportChanged} = opts.changeFlags;
|
|
268
|
-
let gpuAggregation = opts.props.gpuAggregation;
|
|
269
|
-
if (this.state.gpuAggregation !== opts.props.gpuAggregation) {
|
|
270
|
-
if (gpuAggregation && !GPUGridAggregator.isSupported(this.context.device)) {
|
|
271
|
-
log.warn('GPU Grid Aggregation not supported, falling back to CPU')();
|
|
272
|
-
gpuAggregation = false;
|
|
296
|
+
const bin = this.state.aggregator.getBin(index);
|
|
297
|
+
let object: ScreenGridLayerPickingInfo<DataT>['object'];
|
|
298
|
+
if (bin) {
|
|
299
|
+
object = {
|
|
300
|
+
col: bin.id[0],
|
|
301
|
+
row: bin.id[1],
|
|
302
|
+
value: bin.value[0],
|
|
303
|
+
count: bin.count
|
|
304
|
+
};
|
|
305
|
+
if (bin.pointIndices) {
|
|
306
|
+
object.pointIndices = bin.pointIndices;
|
|
307
|
+
object.points = Array.isArray(this.props.data)
|
|
308
|
+
? bin.pointIndices.map(i => (this.props.data as DataT[])[i])
|
|
309
|
+
: [];
|
|
310
|
+
}
|
|
273
311
|
}
|
|
312
|
+
info.object = object;
|
|
274
313
|
}
|
|
275
|
-
const gpuAggregationChanged = gpuAggregation !== this.state.gpuAggregation;
|
|
276
|
-
this.setState({
|
|
277
|
-
gpuAggregation
|
|
278
|
-
});
|
|
279
314
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const {dimensions} = this.state;
|
|
283
|
-
const {data, weights} = dimensions;
|
|
284
|
-
const aggregationDataDirty =
|
|
285
|
-
positionsChanged ||
|
|
286
|
-
gpuAggregationChanged ||
|
|
287
|
-
viewportChanged ||
|
|
288
|
-
this.isAggregationDirty(opts, {
|
|
289
|
-
compareAll: gpuAggregation, // check for all (including extentions props) when using gpu aggregation
|
|
290
|
-
dimension: data
|
|
291
|
-
});
|
|
292
|
-
const aggregationWeightsDirty = this.isAggregationDirty(opts, {dimension: weights});
|
|
293
|
-
|
|
294
|
-
this.setState({
|
|
295
|
-
aggregationDataDirty,
|
|
296
|
-
aggregationWeightsDirty
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
const {viewport} = this.context;
|
|
300
|
-
|
|
301
|
-
if (viewportChanged || cellSizeChanged) {
|
|
302
|
-
const {width, height} = viewport;
|
|
303
|
-
const numCol = Math.ceil(width / cellSize);
|
|
304
|
-
const numRow = Math.ceil(height / cellSize);
|
|
305
|
-
this.allocateResources(numRow, numCol);
|
|
306
|
-
this.setState({
|
|
307
|
-
// transformation from clipspace to screen(pixel) space
|
|
308
|
-
scaling: [width / 2, -height / 2, 1],
|
|
309
|
-
|
|
310
|
-
gridOffset: {xOffset: cellSize, yOffset: cellSize},
|
|
311
|
-
width,
|
|
312
|
-
height,
|
|
313
|
-
numCol,
|
|
314
|
-
numRow
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
if (aggregationWeightsDirty) {
|
|
319
|
-
this._updateAccessors(opts);
|
|
320
|
-
}
|
|
321
|
-
if (aggregationDataDirty || aggregationWeightsDirty) {
|
|
322
|
-
this._resetResults();
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
/* eslint-enable complexity, max-statements */
|
|
326
|
-
|
|
327
|
-
// Private
|
|
328
|
-
|
|
329
|
-
_updateAccessors(opts) {
|
|
330
|
-
const {getWeight, aggregation, data} = opts.props;
|
|
331
|
-
const {count} = this.state.weights;
|
|
332
|
-
if (count) {
|
|
333
|
-
count.getWeight = getWeight;
|
|
334
|
-
count.operation = AGGREGATION_OPERATION[aggregation];
|
|
335
|
-
}
|
|
336
|
-
this.setState({getValue: getValueFunc(aggregation, getWeight, {data})});
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
_resetResults() {
|
|
340
|
-
const {count} = this.state.weights;
|
|
341
|
-
if (count) {
|
|
342
|
-
count.aggregationData = null;
|
|
343
|
-
}
|
|
315
|
+
return info;
|
|
344
316
|
}
|
|
345
317
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregation-layer.d.ts","sourceRoot":"","sources":["../src/aggregation-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,cAAc,EACd,gBAAgB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
|
-
import CPUAggregator from "../utils/cpu-aggregator.js";
|
|
3
|
-
import AggregationLayer, { AggregationLayerProps } from "../aggregation-layer.js";
|
|
4
|
-
import { Layer, UpdateParameters, GetPickingInfoParams, PickingInfo } from '@deck.gl/core';
|
|
5
|
-
import { AggregateAccessor } from "../types.js";
|
|
6
|
-
/** All properties supported by CPUGridLayer. */
|
|
7
|
-
export type CPUGridLayerProps<DataT = unknown> = _CPUGridLayerProps<DataT> & AggregationLayerProps<DataT>;
|
|
8
|
-
/** Properties added by CPUGridLayer. */
|
|
9
|
-
type _CPUGridLayerProps<DataT> = {
|
|
10
|
-
/**
|
|
11
|
-
* Size of each cell in meters.
|
|
12
|
-
* @default 1000
|
|
13
|
-
*/
|
|
14
|
-
cellSize?: number;
|
|
15
|
-
/**
|
|
16
|
-
* Color scale domain, default is set to the extent of aggregated weights in each cell.
|
|
17
|
-
* @default [min(colorWeight), max(colorWeight)]
|
|
18
|
-
*/
|
|
19
|
-
colorDomain?: [number, number] | null;
|
|
20
|
-
/**
|
|
21
|
-
* Default: [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6) `6-class YlOrRd`
|
|
22
|
-
*/
|
|
23
|
-
colorRange?: Color[];
|
|
24
|
-
/**
|
|
25
|
-
* Cell size multiplier, clamped between 0 - 1.
|
|
26
|
-
* @default 1
|
|
27
|
-
*/
|
|
28
|
-
coverage?: number;
|
|
29
|
-
/**
|
|
30
|
-
* Elevation scale input domain, default is set to between 0 and the max of aggregated weights in each cell.
|
|
31
|
-
* @default [0, max(elevationWeight)]
|
|
32
|
-
*/
|
|
33
|
-
elevationDomain?: [number, number] | null;
|
|
34
|
-
/**
|
|
35
|
-
* Elevation scale output range.
|
|
36
|
-
* @default [0, 1000]
|
|
37
|
-
*/
|
|
38
|
-
elevationRange?: [number, number];
|
|
39
|
-
/**
|
|
40
|
-
* Cell elevation multiplier.
|
|
41
|
-
* @default 1
|
|
42
|
-
*/
|
|
43
|
-
elevationScale?: number;
|
|
44
|
-
/**
|
|
45
|
-
* Whether to enable cell elevation. If set to false, all cell will be flat.
|
|
46
|
-
* @default true
|
|
47
|
-
*/
|
|
48
|
-
extruded?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Filter cells and re-calculate color by `upperPercentile`.
|
|
51
|
-
* Cells with value arger than the upperPercentile will be hidden.
|
|
52
|
-
* @default 100
|
|
53
|
-
*/
|
|
54
|
-
upperPercentile?: number;
|
|
55
|
-
/**
|
|
56
|
-
* Filter cells and re-calculate color by `lowerPercentile`.
|
|
57
|
-
* Cells with value smaller than the lowerPercentile will be hidden.
|
|
58
|
-
* @default 0
|
|
59
|
-
*/
|
|
60
|
-
lowerPercentile?: number;
|
|
61
|
-
/**
|
|
62
|
-
* Filter cells and re-calculate elevation by `elevationUpperPercentile`.
|
|
63
|
-
* Cells with elevation value larger than the `elevationUpperPercentile` will be hidden.
|
|
64
|
-
* @default 100
|
|
65
|
-
*/
|
|
66
|
-
elevationUpperPercentile?: number;
|
|
67
|
-
/**
|
|
68
|
-
* Filter cells and re-calculate elevation by `elevationLowerPercentile`.
|
|
69
|
-
* Cells with elevation value larger than the `elevationLowerPercentile` will be hidden.
|
|
70
|
-
* @default 0
|
|
71
|
-
*/
|
|
72
|
-
elevationLowerPercentile?: number;
|
|
73
|
-
/**
|
|
74
|
-
* Scaling function used to determine the color of the grid cell, default value is 'quantize'.
|
|
75
|
-
* Supported Values are 'quantize', 'linear', 'quantile' and 'ordinal'.
|
|
76
|
-
* @default 'quantize'
|
|
77
|
-
*/
|
|
78
|
-
colorScaleType?: 'quantize' | 'linear' | 'quantile' | 'ordinal';
|
|
79
|
-
/**
|
|
80
|
-
* Scaling function used to determine the elevation of the grid cell, only supports 'linear'.
|
|
81
|
-
*/
|
|
82
|
-
elevationScaleType?: 'linear';
|
|
83
|
-
gridAggregator?: (props: any, params: any) => any;
|
|
84
|
-
/**
|
|
85
|
-
* Material settings for lighting effect. Applies if `extruded: true`.
|
|
86
|
-
*
|
|
87
|
-
* @default true
|
|
88
|
-
* @see https://deck.gl/docs/developer-guide/using-lighting
|
|
89
|
-
*/
|
|
90
|
-
material?: Material;
|
|
91
|
-
/**
|
|
92
|
-
* Defines the operation used to aggregate all data object weights to calculate a cell's color value.
|
|
93
|
-
* @default 'SUM'
|
|
94
|
-
*/
|
|
95
|
-
colorAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
|
|
96
|
-
/**
|
|
97
|
-
* Defines the operation used to aggregate all data object weights to calculate a cell's elevation value.
|
|
98
|
-
* @default 'SUM'
|
|
99
|
-
*/
|
|
100
|
-
elevationAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
|
|
101
|
-
/**
|
|
102
|
-
* Method called to retrieve the position of each object.
|
|
103
|
-
* @default object => object.position
|
|
104
|
-
*/
|
|
105
|
-
getPosition?: AccessorFunction<DataT, Position>;
|
|
106
|
-
/**
|
|
107
|
-
* The weight of a data object used to calculate the color value for a cell.
|
|
108
|
-
* @default 1
|
|
109
|
-
*/
|
|
110
|
-
getColorWeight?: Accessor<DataT, number>;
|
|
111
|
-
/**
|
|
112
|
-
* After data objects are aggregated into cells, this accessor is called on each cell to get the value that its color is based on.
|
|
113
|
-
* @default null
|
|
114
|
-
*/
|
|
115
|
-
getColorValue?: AggregateAccessor<DataT> | null;
|
|
116
|
-
/**
|
|
117
|
-
* The weight of a data object used to calculate the elevation value for a cell.
|
|
118
|
-
* @default 1
|
|
119
|
-
*/
|
|
120
|
-
getElevationWeight?: Accessor<DataT, number>;
|
|
121
|
-
/**
|
|
122
|
-
* After data objects are aggregated into cells, this accessor is called on each cell to get the value that its elevation is based on.
|
|
123
|
-
* @default null
|
|
124
|
-
*/
|
|
125
|
-
getElevationValue?: AggregateAccessor<DataT> | null;
|
|
126
|
-
/**
|
|
127
|
-
* This callback will be called when bin color domain has been calculated.
|
|
128
|
-
* @default () => {}
|
|
129
|
-
*/
|
|
130
|
-
onSetColorDomain?: (minMax: [number, number]) => void;
|
|
131
|
-
/**
|
|
132
|
-
* This callback will be called when bin elevation domain has been calculated.
|
|
133
|
-
* @default () => {}
|
|
134
|
-
*/
|
|
135
|
-
onSetElevationDomain?: (minMax: [number, number]) => void;
|
|
136
|
-
/**
|
|
137
|
-
* (Experimental) Filter data objects
|
|
138
|
-
*/
|
|
139
|
-
_filterData: null | ((d: DataT) => boolean);
|
|
140
|
-
};
|
|
141
|
-
/** Aggregate data into a grid-based heatmap. Aggregation is performed on CPU. */
|
|
142
|
-
export default class CPUGridLayer<DataT = any, ExtraPropsT extends {} = {}> extends AggregationLayer<DataT, ExtraPropsT & Required<_CPUGridLayerProps<DataT>>> {
|
|
143
|
-
static layerName: string;
|
|
144
|
-
static defaultProps: DefaultProps<CPUGridLayerProps<unknown>>;
|
|
145
|
-
state: AggregationLayer<DataT>['state'] & {
|
|
146
|
-
cpuAggregator: CPUAggregator;
|
|
147
|
-
aggregatorState: CPUAggregator['state'];
|
|
148
|
-
};
|
|
149
|
-
initializeState(): void;
|
|
150
|
-
updateState(opts: UpdateParameters<this>): void;
|
|
151
|
-
getPickingInfo({ info }: GetPickingInfoParams): PickingInfo;
|
|
152
|
-
_onGetSublayerColor(cell: any): any;
|
|
153
|
-
_onGetSublayerElevation(cell: any): any;
|
|
154
|
-
_getSublayerUpdateTriggers(): {};
|
|
155
|
-
renderLayers(): Layer;
|
|
156
|
-
}
|
|
157
|
-
export {};
|
|
158
|
-
//# sourceMappingURL=cpu-grid-layer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cpu-grid-layer.d.ts","sourceRoot":"","sources":["../../src/cpu-grid-layer/cpu-grid-layer.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAIlG,OAAO,aAAa,mCAAgC;AACpD,OAAO,gBAAgB,EAAE,EAAC,qBAAqB,EAAC,gCAA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