@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,173 +1,357 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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.
|
|
20
|
-
import { log } from '@deck.gl/core';
|
|
21
|
-
import { ColumnLayer } from '@deck.gl/layers';
|
|
22
|
-
import { defaultColorRange } from "../utils/color-utils.js";
|
|
23
|
-
import { pointToHexbin } from "./hexagon-aggregator.js";
|
|
24
|
-
import CPUAggregator from "../utils/cpu-aggregator.js";
|
|
25
|
-
import AggregationLayer from "../aggregation-layer.js";
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { log, createIterable, project32, Viewport } from '@deck.gl/core';
|
|
5
|
+
import { WebGLAggregator, CPUAggregator } from "../common/aggregator/index.js";
|
|
6
|
+
import AggregationLayer from "../common/aggregation-layer.js";
|
|
7
|
+
import { defaultColorRange } from "../common/utils/color-utils.js";
|
|
8
|
+
import { AttributeWithScale } from "../common/utils/scale-utils.js";
|
|
9
|
+
import { getBinIdRange } from "../common/utils/bounds-utils.js";
|
|
10
|
+
import HexagonCellLayer from "./hexagon-cell-layer.js";
|
|
11
|
+
import { pointToHexbin, HexbinVertices, getHexbinCentroid, pointToHexbinGLSL } from "./hexbin.js";
|
|
12
|
+
import { binOptionsUniforms } from "./bin-options-uniforms.js";
|
|
26
13
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
27
|
-
function
|
|
14
|
+
function noop() { }
|
|
28
15
|
const defaultProps = {
|
|
16
|
+
gpuAggregation: false,
|
|
29
17
|
// color
|
|
30
18
|
colorDomain: null,
|
|
31
19
|
colorRange: defaultColorRange,
|
|
32
|
-
getColorValue: { type: 'accessor', value: null }, // default value is
|
|
20
|
+
getColorValue: { type: 'accessor', value: null }, // default value is calculated from `getColorWeight` and `colorAggregation`
|
|
33
21
|
getColorWeight: { type: 'accessor', value: 1 },
|
|
34
22
|
colorAggregation: 'SUM',
|
|
35
|
-
lowerPercentile: { type: 'number',
|
|
36
|
-
upperPercentile: { type: 'number',
|
|
23
|
+
lowerPercentile: { type: 'number', min: 0, max: 100, value: 0 },
|
|
24
|
+
upperPercentile: { type: 'number', min: 0, max: 100, value: 100 },
|
|
37
25
|
colorScaleType: 'quantize',
|
|
38
|
-
onSetColorDomain:
|
|
26
|
+
onSetColorDomain: noop,
|
|
39
27
|
// elevation
|
|
40
28
|
elevationDomain: null,
|
|
41
29
|
elevationRange: [0, 1000],
|
|
42
|
-
getElevationValue: { type: 'accessor', value: null }, // default value is
|
|
30
|
+
getElevationValue: { type: 'accessor', value: null }, // default value is calculated from `getElevationWeight` and `elevationAggregation`
|
|
43
31
|
getElevationWeight: { type: 'accessor', value: 1 },
|
|
44
32
|
elevationAggregation: 'SUM',
|
|
45
|
-
elevationLowerPercentile: { type: 'number', value: 0, min: 0, max: 100 },
|
|
46
|
-
elevationUpperPercentile: { type: 'number', value: 100, min: 0, max: 100 },
|
|
47
33
|
elevationScale: { type: 'number', min: 0, value: 1 },
|
|
34
|
+
elevationLowerPercentile: { type: 'number', min: 0, max: 100, value: 0 },
|
|
35
|
+
elevationUpperPercentile: { type: 'number', min: 0, max: 100, value: 100 },
|
|
48
36
|
elevationScaleType: 'linear',
|
|
49
|
-
onSetElevationDomain:
|
|
50
|
-
|
|
37
|
+
onSetElevationDomain: noop,
|
|
38
|
+
// hexbin
|
|
39
|
+
radius: { type: 'number', min: 1, value: 1000 },
|
|
51
40
|
coverage: { type: 'number', min: 0, max: 1, value: 1 },
|
|
52
|
-
extruded: false,
|
|
53
|
-
hexagonAggregator: pointToHexbin,
|
|
54
41
|
getPosition: { type: 'accessor', value: (x) => x.position },
|
|
42
|
+
hexagonAggregator: { type: 'function', optional: true, value: null },
|
|
43
|
+
extruded: false,
|
|
55
44
|
// Optional material for 'lighting' shader module
|
|
56
|
-
material: true
|
|
57
|
-
// data filter
|
|
58
|
-
_filterData: { type: 'function', value: null, optional: true }
|
|
45
|
+
material: true
|
|
59
46
|
};
|
|
60
|
-
/**
|
|
47
|
+
/** Aggregate data into a grid-based heatmap. The color and height of a cell are determined based on the objects it contains. */
|
|
61
48
|
class HexagonLayer extends AggregationLayer {
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
49
|
+
getAggregatorType() {
|
|
50
|
+
const { gpuAggregation, hexagonAggregator, getColorValue, getElevationValue } = this.props;
|
|
51
|
+
if (gpuAggregation && (hexagonAggregator || getColorValue || getElevationValue)) {
|
|
52
|
+
// If these features are desired by the app, the user should explicitly use CPU aggregation
|
|
53
|
+
log.warn('Features not supported by GPU aggregation, falling back to CPU')();
|
|
54
|
+
return 'cpu';
|
|
55
|
+
}
|
|
56
|
+
if (
|
|
57
|
+
// GPU aggregation is requested
|
|
58
|
+
gpuAggregation &&
|
|
59
|
+
// GPU aggregation is supported by the device
|
|
60
|
+
WebGLAggregator.isSupported(this.context.device)) {
|
|
61
|
+
return 'gpu';
|
|
62
|
+
}
|
|
63
|
+
return 'cpu';
|
|
64
|
+
}
|
|
65
|
+
createAggregator(type) {
|
|
66
|
+
if (type === 'cpu') {
|
|
67
|
+
const { hexagonAggregator, radius } = this.props;
|
|
68
|
+
return new CPUAggregator({
|
|
69
|
+
dimensions: 2,
|
|
70
|
+
getBin: {
|
|
71
|
+
sources: ['positions'],
|
|
72
|
+
getValue: ({ positions }, index, opts) => {
|
|
73
|
+
if (hexagonAggregator) {
|
|
74
|
+
return hexagonAggregator(positions, radius);
|
|
75
|
+
}
|
|
76
|
+
const viewport = this.state.aggregatorViewport;
|
|
77
|
+
// project to common space
|
|
78
|
+
const p = viewport.projectPosition(positions);
|
|
79
|
+
const { radiusCommon, hexOriginCommon } = opts;
|
|
80
|
+
return pointToHexbin([p[0] - hexOriginCommon[0], p[1] - hexOriginCommon[1]], radiusCommon);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
getValue: [
|
|
84
|
+
{ sources: ['colorWeights'], getValue: ({ colorWeights }) => colorWeights },
|
|
85
|
+
{ sources: ['elevationWeights'], getValue: ({ elevationWeights }) => elevationWeights }
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return new WebGLAggregator(this.context.device, {
|
|
90
|
+
dimensions: 2,
|
|
91
|
+
channelCount: 2,
|
|
92
|
+
bufferLayout: this.getAttributeManager().getBufferLayouts({ isInstanced: false }),
|
|
93
|
+
...super.getShaders({
|
|
94
|
+
modules: [project32, binOptionsUniforms],
|
|
95
|
+
vs: /* glsl */ `
|
|
96
|
+
in vec3 positions;
|
|
97
|
+
in vec3 positions64Low;
|
|
98
|
+
in float colorWeights;
|
|
99
|
+
in float elevationWeights;
|
|
100
|
+
|
|
101
|
+
${pointToHexbinGLSL}
|
|
102
|
+
|
|
103
|
+
void getBin(out ivec2 binId) {
|
|
104
|
+
vec3 positionCommon = project_position(positions, positions64Low);
|
|
105
|
+
binId = pointToHexbin(positionCommon.xy, binOptions.radiusCommon);
|
|
106
|
+
}
|
|
107
|
+
void getValue(out vec2 value) {
|
|
108
|
+
value = vec2(colorWeights, elevationWeights);
|
|
109
|
+
}
|
|
110
|
+
`
|
|
111
|
+
})
|
|
66
112
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
vertices: null
|
|
71
|
-
};
|
|
113
|
+
}
|
|
114
|
+
initializeState() {
|
|
115
|
+
super.initializeState();
|
|
72
116
|
const attributeManager = this.getAttributeManager();
|
|
73
117
|
attributeManager.add({
|
|
74
|
-
positions: {
|
|
118
|
+
positions: {
|
|
119
|
+
size: 3,
|
|
120
|
+
accessor: 'getPosition',
|
|
121
|
+
type: 'float64',
|
|
122
|
+
fp64: this.use64bitPositions()
|
|
123
|
+
},
|
|
124
|
+
colorWeights: { size: 1, accessor: 'getColorWeight' },
|
|
125
|
+
elevationWeights: { size: 1, accessor: 'getElevationWeight' }
|
|
75
126
|
});
|
|
76
|
-
// color and elevation attributes can't be added as attributes
|
|
77
|
-
// they are calculated using 'getValue' accessor that takes an array of pints.
|
|
78
127
|
}
|
|
79
|
-
updateState(
|
|
80
|
-
super.updateState(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
128
|
+
updateState(params) {
|
|
129
|
+
const aggregatorChanged = super.updateState(params);
|
|
130
|
+
const { props, oldProps, changeFlags } = params;
|
|
131
|
+
const { aggregator } = this.state;
|
|
132
|
+
if ((changeFlags.dataChanged || !this.state.dataAsArray) &&
|
|
133
|
+
(props.getColorValue || props.getElevationValue)) {
|
|
134
|
+
// Convert data to array
|
|
135
|
+
this.state.dataAsArray = Array.from(createIterable(props.data).iterable);
|
|
136
|
+
}
|
|
137
|
+
if (aggregatorChanged ||
|
|
138
|
+
changeFlags.dataChanged ||
|
|
139
|
+
props.radius !== oldProps.radius ||
|
|
140
|
+
props.getColorValue !== oldProps.getColorValue ||
|
|
141
|
+
props.getElevationValue !== oldProps.getElevationValue ||
|
|
142
|
+
props.colorAggregation !== oldProps.colorAggregation ||
|
|
143
|
+
props.elevationAggregation !== oldProps.elevationAggregation) {
|
|
144
|
+
this._updateBinOptions();
|
|
145
|
+
const { radiusCommon, hexOriginCommon, binIdRange, dataAsArray } = this.state;
|
|
146
|
+
aggregator.setProps({
|
|
147
|
+
// @ts-expect-error only used by GPUAggregator
|
|
148
|
+
binIdRange,
|
|
149
|
+
pointCount: this.getNumInstances(),
|
|
150
|
+
operations: [props.colorAggregation, props.elevationAggregation],
|
|
151
|
+
binOptions: {
|
|
152
|
+
radiusCommon,
|
|
153
|
+
hexOriginCommon
|
|
154
|
+
},
|
|
155
|
+
onUpdate: this._onAggregationUpdate.bind(this)
|
|
85
156
|
});
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
157
|
+
if (dataAsArray) {
|
|
158
|
+
const { getColorValue, getElevationValue } = this.props;
|
|
159
|
+
aggregator.setProps({
|
|
160
|
+
// @ts-expect-error only used by CPUAggregator
|
|
161
|
+
customOperations: [
|
|
162
|
+
getColorValue &&
|
|
163
|
+
((indices) => getColorValue(indices.map(i => dataAsArray[i]), { indices, data: props.data })),
|
|
164
|
+
getElevationValue &&
|
|
165
|
+
((indices) => getElevationValue(indices.map(i => dataAsArray[i]), { indices, data: props.data }))
|
|
166
|
+
]
|
|
93
167
|
});
|
|
94
168
|
}
|
|
95
|
-
this.setState({
|
|
96
|
-
// make a copy of the internal state of cpuAggregator for testing
|
|
97
|
-
aggregatorState
|
|
98
|
-
});
|
|
99
169
|
}
|
|
170
|
+
if (changeFlags.updateTriggersChanged && changeFlags.updateTriggersChanged.getColorValue) {
|
|
171
|
+
aggregator.setNeedsUpdate(0);
|
|
172
|
+
}
|
|
173
|
+
if (changeFlags.updateTriggersChanged && changeFlags.updateTriggersChanged.getElevationValue) {
|
|
174
|
+
aggregator.setNeedsUpdate(1);
|
|
175
|
+
}
|
|
176
|
+
return aggregatorChanged;
|
|
100
177
|
}
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
178
|
+
_updateBinOptions() {
|
|
179
|
+
const bounds = this.getBounds();
|
|
180
|
+
let radiusCommon = 1;
|
|
181
|
+
let hexOriginCommon = [0, 0];
|
|
182
|
+
let binIdRange = [
|
|
183
|
+
[0, 1],
|
|
184
|
+
[0, 1]
|
|
185
|
+
];
|
|
186
|
+
let viewport = this.context.viewport;
|
|
187
|
+
if (bounds && Number.isFinite(bounds[0][0])) {
|
|
188
|
+
let centroid = [(bounds[0][0] + bounds[1][0]) / 2, (bounds[0][1] + bounds[1][1]) / 2];
|
|
189
|
+
const { radius } = this.props;
|
|
190
|
+
const { unitsPerMeter } = viewport.getDistanceScales(centroid);
|
|
191
|
+
radiusCommon = unitsPerMeter[0] * radius;
|
|
192
|
+
// Use the centroid of the hex at the center of the data
|
|
193
|
+
// This offsets the common space without changing the bins
|
|
194
|
+
const centerHex = pointToHexbin(viewport.projectFlat(centroid), radiusCommon);
|
|
195
|
+
centroid = viewport.unprojectFlat(getHexbinCentroid(centerHex, radiusCommon));
|
|
196
|
+
const ViewportType = viewport.constructor;
|
|
197
|
+
// We construct a viewport for the GPU aggregator's project module
|
|
198
|
+
// This viewport is determined by data
|
|
199
|
+
// removes arbitrary precision variance that depends on initial view state
|
|
200
|
+
viewport = viewport.isGeospatial
|
|
201
|
+
? new ViewportType({ longitude: centroid[0], latitude: centroid[1], zoom: 12 })
|
|
202
|
+
: new Viewport({ position: [centroid[0], centroid[1], 0], zoom: 12 });
|
|
203
|
+
hexOriginCommon = [Math.fround(viewport.center[0]), Math.fround(viewport.center[1])];
|
|
204
|
+
binIdRange = getBinIdRange({
|
|
205
|
+
dataBounds: bounds,
|
|
206
|
+
getBinId: (p) => {
|
|
207
|
+
const positionCommon = viewport.projectFlat(p);
|
|
208
|
+
positionCommon[0] -= hexOriginCommon[0];
|
|
209
|
+
positionCommon[1] -= hexOriginCommon[1];
|
|
210
|
+
return pointToHexbin(positionCommon, radiusCommon);
|
|
211
|
+
},
|
|
212
|
+
padding: 1
|
|
117
213
|
});
|
|
118
|
-
return vertices;
|
|
119
214
|
}
|
|
120
|
-
|
|
121
|
-
return null;
|
|
215
|
+
this.setState({ radiusCommon, hexOriginCommon, binIdRange, aggregatorViewport: viewport });
|
|
122
216
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
217
|
+
draw(opts) {
|
|
218
|
+
// Replaces render time viewport with our own
|
|
219
|
+
if (opts.shaderModuleProps.project) {
|
|
220
|
+
opts.shaderModuleProps.project.viewport = this.state.aggregatorViewport;
|
|
221
|
+
}
|
|
222
|
+
super.draw(opts);
|
|
129
223
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
224
|
+
_onAggregationUpdate({ channel }) {
|
|
225
|
+
const props = this.getCurrentLayer().props;
|
|
226
|
+
const { aggregator } = this.state;
|
|
227
|
+
if (channel === 0) {
|
|
228
|
+
const result = aggregator.getResult(0);
|
|
229
|
+
this.setState({
|
|
230
|
+
colors: new AttributeWithScale(result, aggregator.binCount)
|
|
231
|
+
});
|
|
232
|
+
props.onSetColorDomain(aggregator.getResultDomain(0));
|
|
233
|
+
}
|
|
234
|
+
else if (channel === 1) {
|
|
235
|
+
const result = aggregator.getResult(1);
|
|
236
|
+
this.setState({
|
|
237
|
+
elevations: new AttributeWithScale(result, aggregator.binCount)
|
|
238
|
+
});
|
|
239
|
+
props.onSetElevationDomain(aggregator.getResultDomain(1));
|
|
240
|
+
}
|
|
133
241
|
}
|
|
134
|
-
|
|
135
|
-
|
|
242
|
+
onAttributeChange(id) {
|
|
243
|
+
const { aggregator } = this.state;
|
|
244
|
+
switch (id) {
|
|
245
|
+
case 'positions':
|
|
246
|
+
aggregator.setNeedsUpdate();
|
|
247
|
+
this._updateBinOptions();
|
|
248
|
+
const { radiusCommon, hexOriginCommon, binIdRange } = this.state;
|
|
249
|
+
aggregator.setProps({
|
|
250
|
+
// @ts-expect-error only used by GPUAggregator
|
|
251
|
+
binIdRange,
|
|
252
|
+
binOptions: {
|
|
253
|
+
radiusCommon,
|
|
254
|
+
hexOriginCommon
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
break;
|
|
258
|
+
case 'colorWeights':
|
|
259
|
+
aggregator.setNeedsUpdate(0);
|
|
260
|
+
break;
|
|
261
|
+
case 'elevationWeights':
|
|
262
|
+
aggregator.setNeedsUpdate(1);
|
|
263
|
+
break;
|
|
264
|
+
default:
|
|
265
|
+
// This should not happen
|
|
266
|
+
}
|
|
136
267
|
}
|
|
137
268
|
renderLayers() {
|
|
138
|
-
const {
|
|
139
|
-
const {
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
269
|
+
const { aggregator, radiusCommon, hexOriginCommon } = this.state;
|
|
270
|
+
const { elevationScale, colorRange, elevationRange, extruded, coverage, material, transitions, colorScaleType, lowerPercentile, upperPercentile, colorDomain, elevationScaleType, elevationLowerPercentile, elevationUpperPercentile, elevationDomain } = this.props;
|
|
271
|
+
const CellLayerClass = this.getSubLayerClass('cells', HexagonCellLayer);
|
|
272
|
+
const binAttribute = aggregator.getBins();
|
|
273
|
+
const colors = this.state.colors?.update({
|
|
274
|
+
scaleType: colorScaleType,
|
|
275
|
+
lowerPercentile,
|
|
276
|
+
upperPercentile
|
|
277
|
+
});
|
|
278
|
+
const elevations = this.state.elevations?.update({
|
|
279
|
+
scaleType: elevationScaleType,
|
|
280
|
+
lowerPercentile: elevationLowerPercentile,
|
|
281
|
+
upperPercentile: elevationUpperPercentile
|
|
282
|
+
});
|
|
283
|
+
if (!colors || !elevations) {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
return new CellLayerClass(this.getSubLayerProps({
|
|
287
|
+
id: 'cells'
|
|
288
|
+
}), {
|
|
289
|
+
data: {
|
|
290
|
+
length: aggregator.binCount,
|
|
291
|
+
attributes: {
|
|
292
|
+
getBin: binAttribute,
|
|
293
|
+
getColorValue: colors.attribute,
|
|
294
|
+
getElevationValue: elevations.attribute
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
// Data has changed shallowly, but we likely don't need to update the attributes
|
|
298
|
+
dataComparator: (data, oldData) => data.length === oldData.length,
|
|
299
|
+
updateTriggers: {
|
|
300
|
+
getBin: [binAttribute],
|
|
301
|
+
getColorValue: [colors.attribute],
|
|
302
|
+
getElevationValue: [elevations.attribute]
|
|
303
|
+
},
|
|
153
304
|
diskResolution: 6,
|
|
305
|
+
vertices: HexbinVertices,
|
|
306
|
+
radius: radiusCommon,
|
|
307
|
+
hexOriginCommon,
|
|
154
308
|
elevationScale,
|
|
309
|
+
colorRange,
|
|
310
|
+
colorScaleType,
|
|
311
|
+
elevationRange,
|
|
155
312
|
extruded,
|
|
156
313
|
coverage,
|
|
157
314
|
material,
|
|
158
|
-
|
|
159
|
-
|
|
315
|
+
colorDomain: colors.domain || colorDomain || aggregator.getResultDomain(0),
|
|
316
|
+
elevationDomain: elevations.domain || elevationDomain || aggregator.getResultDomain(1),
|
|
317
|
+
colorCutoff: colors.cutoff,
|
|
318
|
+
elevationCutoff: elevations.cutoff,
|
|
160
319
|
transitions: transitions && {
|
|
161
320
|
getFillColor: transitions.getColorValue || transitions.getColorWeight,
|
|
162
321
|
getElevation: transitions.getElevationValue || transitions.getElevationWeight
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
updateTriggers
|
|
167
|
-
}), {
|
|
168
|
-
data: aggregatorState.layerData.data
|
|
322
|
+
},
|
|
323
|
+
// Extensions are already handled by the GPUAggregator, do not pass it down
|
|
324
|
+
extensions: []
|
|
169
325
|
});
|
|
170
326
|
}
|
|
327
|
+
getPickingInfo(params) {
|
|
328
|
+
const info = params.info;
|
|
329
|
+
const { index } = info;
|
|
330
|
+
if (index >= 0) {
|
|
331
|
+
const bin = this.state.aggregator.getBin(index);
|
|
332
|
+
let object;
|
|
333
|
+
if (bin) {
|
|
334
|
+
const centroidCommon = getHexbinCentroid(bin.id, this.state.radiusCommon);
|
|
335
|
+
const centroid = this.context.viewport.unprojectFlat(centroidCommon);
|
|
336
|
+
object = {
|
|
337
|
+
col: bin.id[0],
|
|
338
|
+
row: bin.id[1],
|
|
339
|
+
position: centroid,
|
|
340
|
+
colorValue: bin.value[0],
|
|
341
|
+
elevationValue: bin.value[1],
|
|
342
|
+
count: bin.count
|
|
343
|
+
};
|
|
344
|
+
if (bin.pointIndices) {
|
|
345
|
+
object.pointIndices = bin.pointIndices;
|
|
346
|
+
object.points = Array.isArray(this.props.data)
|
|
347
|
+
? bin.pointIndices.map(i => this.props.data[i])
|
|
348
|
+
: [];
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
info.object = object;
|
|
352
|
+
}
|
|
353
|
+
return info;
|
|
354
|
+
}
|
|
171
355
|
}
|
|
172
356
|
HexagonLayer.layerName = 'HexagonLayer';
|
|
173
357
|
HexagonLayer.defaultProps = defaultProps;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type HexBin = [i: number, j: number];
|
|
2
|
+
type Point = [x: number, y: number];
|
|
3
|
+
export declare const HexbinVertices: number[][];
|
|
4
|
+
/**
|
|
5
|
+
* Adapted from d3-hexbin
|
|
6
|
+
* Copyright Mike Bostock, 2012-2016
|
|
7
|
+
All rights reserved.
|
|
8
|
+
* https://github.com/d3/d3-hexbin/blob/master/src/hexbin.js
|
|
9
|
+
*
|
|
10
|
+
* Returns the hexbin that a point (x,y) falls into
|
|
11
|
+
*/
|
|
12
|
+
export declare function pointToHexbin([px, py]: Point, radius: number): HexBin;
|
|
13
|
+
export declare const pointToHexbinGLSL: string;
|
|
14
|
+
export declare function getHexbinCentroid([i, j]: HexBin, radius: number): Point;
|
|
15
|
+
export declare const getHexbinCentroidGLSL: string;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=hexbin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hexbin.d.ts","sourceRoot":"","sources":["../../src/hexagon-layer/hexbin.ts"],"names":[],"mappings":"AAQA,KAAK,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AACrC,KAAK,KAAK,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAEpC,eAAO,MAAM,cAAc,YAGzB,CAAC;AAEH;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAiBrE;AAED,eAAO,MAAM,iBAAiB,QAsB7B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAEvE;AAED,eAAO,MAAM,qBAAqB,QAOjC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
const THIRD_PI = Math.PI / 3;
|
|
5
|
+
const DIST_X = 2 * Math.sin(THIRD_PI);
|
|
6
|
+
const DIST_Y = 1.5;
|
|
7
|
+
export const HexbinVertices = Array.from({ length: 6 }, (_, i) => {
|
|
8
|
+
const angle = i * THIRD_PI;
|
|
9
|
+
return [Math.sin(angle), -Math.cos(angle)];
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Adapted from d3-hexbin
|
|
13
|
+
* Copyright Mike Bostock, 2012-2016
|
|
14
|
+
All rights reserved.
|
|
15
|
+
* https://github.com/d3/d3-hexbin/blob/master/src/hexbin.js
|
|
16
|
+
*
|
|
17
|
+
* Returns the hexbin that a point (x,y) falls into
|
|
18
|
+
*/
|
|
19
|
+
export function pointToHexbin([px, py], radius) {
|
|
20
|
+
let pj = Math.round((py = py / radius / DIST_Y));
|
|
21
|
+
let pi = Math.round((px = px / radius / DIST_X - (pj & 1) / 2));
|
|
22
|
+
const py1 = py - pj;
|
|
23
|
+
if (Math.abs(py1) * 3 > 1) {
|
|
24
|
+
const px1 = px - pi;
|
|
25
|
+
const pi2 = pi + (px < pi ? -1 : 1) / 2;
|
|
26
|
+
const pj2 = pj + (py < pj ? -1 : 1);
|
|
27
|
+
const px2 = px - pi2;
|
|
28
|
+
const py2 = py - pj2;
|
|
29
|
+
if (px1 * px1 + py1 * py1 > px2 * px2 + py2 * py2) {
|
|
30
|
+
pi = pi2 + (pj & 1 ? 1 : -1) / 2;
|
|
31
|
+
pj = pj2;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return [pi, pj];
|
|
35
|
+
}
|
|
36
|
+
export const pointToHexbinGLSL = /* glsl */ `
|
|
37
|
+
const vec2 DIST = vec2(${DIST_X}, ${DIST_Y});
|
|
38
|
+
|
|
39
|
+
ivec2 pointToHexbin(vec2 p, float radius) {
|
|
40
|
+
p /= radius * DIST;
|
|
41
|
+
float pj = round(p.y);
|
|
42
|
+
float pjm2 = mod(pj, 2.0);
|
|
43
|
+
p.x -= pjm2 * 0.5;
|
|
44
|
+
float pi = round(p.x);
|
|
45
|
+
vec2 d1 = p - vec2(pi, pj);
|
|
46
|
+
|
|
47
|
+
if (abs(d1.y) * 3. > 1.) {
|
|
48
|
+
vec2 v2 = step(0.0, d1) - 0.5;
|
|
49
|
+
v2.y *= 2.0;
|
|
50
|
+
vec2 d2 = d1 - v2;
|
|
51
|
+
if (dot(d1, d1) > dot(d2, d2)) {
|
|
52
|
+
pi += v2.x + pjm2 - 0.5;
|
|
53
|
+
pj += v2.y;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return ivec2(pi, pj);
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
export function getHexbinCentroid([i, j], radius) {
|
|
60
|
+
return [(i + (j & 1) / 2) * radius * DIST_X, j * radius * DIST_Y];
|
|
61
|
+
}
|
|
62
|
+
export const getHexbinCentroidGLSL = `
|
|
63
|
+
const vec2 DIST = vec2(${DIST_X}, ${DIST_Y});
|
|
64
|
+
|
|
65
|
+
vec2 hexbinCentroid(vec2 binId, float radius) {
|
|
66
|
+
binId.x += fract(binId.y * 0.5);
|
|
67
|
+
return binId * DIST * radius;
|
|
68
|
+
}
|
|
69
|
+
`;
|