@deck.gl/aggregation-layers 9.0.35 → 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,201 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
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.
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
Layer,
|
|
23
|
-
fp64LowPart,
|
|
24
|
-
project32,
|
|
25
|
-
gouraudLighting,
|
|
26
|
-
picking,
|
|
27
|
-
LayerProps,
|
|
28
|
-
DefaultProps
|
|
29
|
-
} from '@deck.gl/core';
|
|
30
|
-
import {CubeGeometry} from '@luma.gl/engine';
|
|
31
|
-
import {fp64arithmetic} from '@luma.gl/shadertools';
|
|
32
|
-
import {Model} from '@luma.gl/engine';
|
|
33
|
-
import {Buffer} from '@luma.gl/core';
|
|
34
|
-
import {GL} from '@luma.gl/constants';
|
|
35
|
-
import {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';
|
|
36
|
-
import type {_GPUGridLayerProps} from './gpu-grid-layer';
|
|
37
|
-
import vs from './gpu-grid-cell-layer-vertex.glsl';
|
|
38
|
-
import fs from './gpu-grid-cell-layer-fragment.glsl';
|
|
39
|
-
|
|
40
|
-
const COLOR_DATA_UBO_INDEX = 0;
|
|
41
|
-
const ELEVATION_DATA_UBO_INDEX = 1;
|
|
42
|
-
|
|
43
|
-
const defaultProps: DefaultProps<_GPUGridCellLayerProps & LayerProps> = {
|
|
44
|
-
// color
|
|
45
|
-
colorDomain: null,
|
|
46
|
-
colorRange: defaultColorRange,
|
|
47
|
-
|
|
48
|
-
// elevation
|
|
49
|
-
elevationDomain: null,
|
|
50
|
-
elevationRange: [0, 1000],
|
|
51
|
-
elevationScale: {type: 'number', min: 0, value: 1},
|
|
52
|
-
|
|
53
|
-
// grid
|
|
54
|
-
gridSize: {type: 'array', value: [1, 1]},
|
|
55
|
-
gridOrigin: {type: 'array', value: [0, 0]},
|
|
56
|
-
gridOffset: {type: 'array', value: [0, 0]},
|
|
57
|
-
|
|
58
|
-
cellSize: {type: 'number', min: 0, max: 1000, value: 1000},
|
|
59
|
-
offset: {type: 'array', value: [1, 1]},
|
|
60
|
-
coverage: {type: 'number', min: 0, max: 1, value: 1},
|
|
61
|
-
extruded: true,
|
|
62
|
-
|
|
63
|
-
material: true // Use lighting module defaults
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
type _GPUGridCellLayerProps = _GPUGridLayerProps<any> & {
|
|
67
|
-
cellSize: number;
|
|
68
|
-
offset: number[];
|
|
69
|
-
coverage: number;
|
|
70
|
-
extruded: boolean;
|
|
71
|
-
elevationScale: number;
|
|
72
|
-
elevationRange: [number, number];
|
|
73
|
-
gridSize: number[];
|
|
74
|
-
gridOrigin: number[];
|
|
75
|
-
gridOffset: number[];
|
|
76
|
-
colorMaxMinBuffer: Buffer;
|
|
77
|
-
elevationMaxMinBuffer: Buffer;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export default class GPUGridCellLayer extends Layer<_GPUGridCellLayerProps> {
|
|
81
|
-
static layerName = 'GPUGridCellLayer';
|
|
82
|
-
static defaultProps = defaultProps;
|
|
83
|
-
|
|
84
|
-
state!: {
|
|
85
|
-
model?: Model;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
getShaders() {
|
|
89
|
-
return super.getShaders({
|
|
90
|
-
vs,
|
|
91
|
-
fs,
|
|
92
|
-
modules: [project32, gouraudLighting, picking, fp64arithmetic]
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
initializeState(): void {
|
|
97
|
-
const attributeManager = this.getAttributeManager()!;
|
|
98
|
-
attributeManager.addInstanced({
|
|
99
|
-
colors: {
|
|
100
|
-
size: 4,
|
|
101
|
-
noAlloc: true
|
|
102
|
-
},
|
|
103
|
-
elevations: {
|
|
104
|
-
size: 4,
|
|
105
|
-
noAlloc: true
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
const model = this._getModel();
|
|
109
|
-
this._setupUniformBuffer(model);
|
|
110
|
-
this.setState({model});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
_getModel(): Model {
|
|
114
|
-
return new Model(this.context.device, {
|
|
115
|
-
...this.getShaders(),
|
|
116
|
-
id: this.props.id,
|
|
117
|
-
geometry: new CubeGeometry(),
|
|
118
|
-
isInstanced: true
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
draw({uniforms}) {
|
|
123
|
-
const {
|
|
124
|
-
cellSize,
|
|
125
|
-
offset,
|
|
126
|
-
extruded,
|
|
127
|
-
elevationScale,
|
|
128
|
-
coverage,
|
|
129
|
-
gridSize,
|
|
130
|
-
gridOrigin,
|
|
131
|
-
gridOffset,
|
|
132
|
-
elevationRange,
|
|
133
|
-
colorMaxMinBuffer,
|
|
134
|
-
elevationMaxMinBuffer
|
|
135
|
-
} = this.props;
|
|
136
|
-
const model = this.state.model!;
|
|
137
|
-
|
|
138
|
-
const gridOriginLow = [fp64LowPart(gridOrigin[0]), fp64LowPart(gridOrigin[1])];
|
|
139
|
-
const gridOffsetLow = [fp64LowPart(gridOffset[0]), fp64LowPart(gridOffset[1])];
|
|
140
|
-
const domainUniforms = this.getDomainUniforms();
|
|
141
|
-
const colorRange = colorRangeToFlatArray(this.props.colorRange);
|
|
142
|
-
this.bindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer);
|
|
143
|
-
model.setUniforms(uniforms);
|
|
144
|
-
model.setUniforms(domainUniforms);
|
|
145
|
-
model.setUniforms({
|
|
146
|
-
cellSize,
|
|
147
|
-
offset,
|
|
148
|
-
extruded,
|
|
149
|
-
elevationScale,
|
|
150
|
-
coverage,
|
|
151
|
-
gridSize,
|
|
152
|
-
gridOrigin,
|
|
153
|
-
gridOriginLow,
|
|
154
|
-
gridOffset,
|
|
155
|
-
gridOffsetLow,
|
|
156
|
-
colorRange,
|
|
157
|
-
elevationRange
|
|
158
|
-
});
|
|
159
|
-
model.draw(this.context.renderPass);
|
|
160
|
-
this.unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
bindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
|
|
164
|
-
colorMaxMinBuffer.bind({target: GL.UNIFORM_BUFFER, index: COLOR_DATA_UBO_INDEX});
|
|
165
|
-
elevationMaxMinBuffer.bind({target: GL.UNIFORM_BUFFER, index: ELEVATION_DATA_UBO_INDEX});
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
|
|
169
|
-
colorMaxMinBuffer.unbind({target: GL.UNIFORM_BUFFER, index: COLOR_DATA_UBO_INDEX});
|
|
170
|
-
elevationMaxMinBuffer.unbind({target: GL.UNIFORM_BUFFER, index: ELEVATION_DATA_UBO_INDEX});
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
getDomainUniforms() {
|
|
174
|
-
const {colorDomain, elevationDomain} = this.props;
|
|
175
|
-
const domainUniforms: Record<string, any> = {};
|
|
176
|
-
if (colorDomain !== null) {
|
|
177
|
-
domainUniforms.colorDomainValid = true;
|
|
178
|
-
domainUniforms.colorDomain = colorDomain;
|
|
179
|
-
} else {
|
|
180
|
-
domainUniforms.colorDomainValid = false;
|
|
181
|
-
}
|
|
182
|
-
if (elevationDomain !== null) {
|
|
183
|
-
domainUniforms.elevationDomainValid = true;
|
|
184
|
-
domainUniforms.elevationDomain = elevationDomain;
|
|
185
|
-
} else {
|
|
186
|
-
domainUniforms.elevationDomainValid = false;
|
|
187
|
-
}
|
|
188
|
-
return domainUniforms;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
private _setupUniformBuffer(model: Model): void {
|
|
192
|
-
// @ts-expect-error TODO v9 This code is not portable to WebGPU
|
|
193
|
-
const programHandle = model.pipeline.handle;
|
|
194
|
-
|
|
195
|
-
const gl = this.context.gl;
|
|
196
|
-
const colorIndex = gl.getUniformBlockIndex(programHandle, 'ColorData');
|
|
197
|
-
const elevationIndex = gl.getUniformBlockIndex(programHandle, 'ElevationData');
|
|
198
|
-
gl.uniformBlockBinding(programHandle, colorIndex, COLOR_DATA_UBO_INDEX);
|
|
199
|
-
gl.uniformBlockBinding(programHandle, elevationIndex, ELEVATION_DATA_UBO_INDEX);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
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.
|
|
20
|
-
|
|
21
|
-
import {GL} from '@luma.gl/constants';
|
|
22
|
-
import {
|
|
23
|
-
Accessor,
|
|
24
|
-
AccessorFunction,
|
|
25
|
-
Color,
|
|
26
|
-
Material,
|
|
27
|
-
GetPickingInfoParams,
|
|
28
|
-
LayerContext,
|
|
29
|
-
log,
|
|
30
|
-
PickingInfo,
|
|
31
|
-
Position,
|
|
32
|
-
DefaultProps
|
|
33
|
-
} from '@deck.gl/core';
|
|
34
|
-
|
|
35
|
-
import GPUGridAggregator from '../utils/gpu-grid-aggregation/gpu-grid-aggregator';
|
|
36
|
-
import {AGGREGATION_OPERATION} from '../utils/aggregation-operation-utils';
|
|
37
|
-
import {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';
|
|
38
|
-
import GPUGridCellLayer from './gpu-grid-cell-layer';
|
|
39
|
-
import {pointToDensityGridDataCPU, GridHash} from './../cpu-grid-layer/grid-aggregator';
|
|
40
|
-
import GridAggregationLayer, {GridAggregationLayerProps} from '../grid-aggregation-layer';
|
|
41
|
-
import {getBoundingBox, getGridParams} from '../utils/grid-aggregation-utils';
|
|
42
|
-
|
|
43
|
-
const defaultProps: DefaultProps<GPUGridLayerProps> = {
|
|
44
|
-
// color
|
|
45
|
-
colorDomain: null,
|
|
46
|
-
colorRange: defaultColorRange,
|
|
47
|
-
getColorWeight: {type: 'accessor', value: 1},
|
|
48
|
-
colorAggregation: 'SUM',
|
|
49
|
-
|
|
50
|
-
// elevation
|
|
51
|
-
elevationDomain: null,
|
|
52
|
-
elevationRange: [0, 1000],
|
|
53
|
-
getElevationWeight: {type: 'accessor', value: 1},
|
|
54
|
-
elevationAggregation: 'SUM',
|
|
55
|
-
elevationScale: {type: 'number', min: 0, value: 1},
|
|
56
|
-
|
|
57
|
-
// grid
|
|
58
|
-
cellSize: {type: 'number', min: 1, max: 1000, value: 1000},
|
|
59
|
-
coverage: {type: 'number', min: 0, max: 1, value: 1},
|
|
60
|
-
getPosition: {type: 'accessor', value: (x: any) => x.position},
|
|
61
|
-
extruded: false,
|
|
62
|
-
|
|
63
|
-
// Optional material for 'lighting' shader module
|
|
64
|
-
material: true
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// This layer only perform GPU aggregation, no need to seperate data and weight props
|
|
68
|
-
// aggregation will be dirty when any of the props are changed.
|
|
69
|
-
|
|
70
|
-
const DIMENSIONS = {
|
|
71
|
-
data: {
|
|
72
|
-
props: ['cellSize', 'colorAggregation', 'elevationAggregation']
|
|
73
|
-
}
|
|
74
|
-
// rest of the changes are detected by `state.attributesChanged`
|
|
75
|
-
};
|
|
76
|
-
const POSITION_ATTRIBUTE_NAME = 'positions';
|
|
77
|
-
|
|
78
|
-
/** All properties supported by GPUGridLayer. */
|
|
79
|
-
export type GPUGridLayerProps<DataT = unknown> = _GPUGridLayerProps<DataT> &
|
|
80
|
-
GridAggregationLayerProps<DataT>;
|
|
81
|
-
|
|
82
|
-
/** Properties added by GPUGridLayer. */
|
|
83
|
-
export type _GPUGridLayerProps<DataT> = {
|
|
84
|
-
/**
|
|
85
|
-
* Size of each cell in meters.
|
|
86
|
-
* @default 1000
|
|
87
|
-
*/
|
|
88
|
-
cellSize?: number;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Color scale domain, default is set to the extent of aggregated weights in each cell.
|
|
92
|
-
* @default [min(colorWeight), max(colorWeight)]
|
|
93
|
-
*/
|
|
94
|
-
colorDomain?: [number, number] | null;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Default: [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6) `6-class YlOrRd`
|
|
98
|
-
*/
|
|
99
|
-
colorRange?: Color[];
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Cell size multiplier, clamped between 0 - 1.
|
|
103
|
-
* @default 1
|
|
104
|
-
*/
|
|
105
|
-
coverage?: number;
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Elevation scale input domain, default is set to between 0 and the max of aggregated weights in each cell.
|
|
109
|
-
* @default [0, max(elevationWeight)]
|
|
110
|
-
*/
|
|
111
|
-
elevationDomain?: [number, number] | null;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Elevation scale output range.
|
|
115
|
-
* @default [0, 1000]
|
|
116
|
-
*/
|
|
117
|
-
elevationRange?: [number, number];
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Cell elevation multiplier.
|
|
121
|
-
* @default 1
|
|
122
|
-
*/
|
|
123
|
-
elevationScale?: number;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Whether to enable cell elevation. If set to false, all cell will be flat.
|
|
127
|
-
* @default true
|
|
128
|
-
*/
|
|
129
|
-
extruded?: boolean;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Material settings for lighting effect. Applies if `extruded: true`.
|
|
133
|
-
*
|
|
134
|
-
* @default true
|
|
135
|
-
* @see https://deck.gl/docs/developer-guide/using-lighting
|
|
136
|
-
*/
|
|
137
|
-
material?: Material;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Defines the operation used to aggregate all data object weights to calculate a cell's color value.
|
|
141
|
-
* @default 'SUM'
|
|
142
|
-
*/
|
|
143
|
-
colorAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Defines the operation used to aggregate all data object weights to calculate a cell's elevation value.
|
|
147
|
-
* @default 'SUM'
|
|
148
|
-
*/
|
|
149
|
-
elevationAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Method called to retrieve the position of each object.
|
|
153
|
-
* @default object => object.position
|
|
154
|
-
*/
|
|
155
|
-
getPosition?: AccessorFunction<DataT, Position>;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* The weight of a data object used to calculate the color value for a cell.
|
|
159
|
-
* @default 1
|
|
160
|
-
*/
|
|
161
|
-
getColorWeight?: Accessor<DataT, number>;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* The weight of a data object used to calculate the elevation value for a cell.
|
|
165
|
-
* @default 1
|
|
166
|
-
*/
|
|
167
|
-
getElevationWeight?: Accessor<DataT, number>;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU. */
|
|
171
|
-
export default class GPUGridLayer<
|
|
172
|
-
DataT = any,
|
|
173
|
-
ExtraPropsT extends {} = {}
|
|
174
|
-
> extends GridAggregationLayer<DataT, ExtraPropsT & Required<_GPUGridLayerProps<DataT>>> {
|
|
175
|
-
static layerName = 'GPUGridLayer';
|
|
176
|
-
static defaultProps = defaultProps;
|
|
177
|
-
|
|
178
|
-
state!: GridAggregationLayer<DataT>['state'] & {
|
|
179
|
-
isSupported: boolean;
|
|
180
|
-
gridHash?: GridHash;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
initializeState({device}: LayerContext): void {
|
|
184
|
-
const isSupported = GPUGridAggregator.isSupported(device);
|
|
185
|
-
if (!isSupported) {
|
|
186
|
-
log.error('GPUGridLayer is not supported on this browser, use GridLayer instead')();
|
|
187
|
-
}
|
|
188
|
-
super.initializeAggregationLayer({
|
|
189
|
-
dimensions: DIMENSIONS
|
|
190
|
-
});
|
|
191
|
-
this.setState({
|
|
192
|
-
gpuAggregation: false, // TODO(v9): Re-enable GPU aggregation.
|
|
193
|
-
projectPoints: false, // aggregation in world space
|
|
194
|
-
isSupported,
|
|
195
|
-
weights: {
|
|
196
|
-
color: {
|
|
197
|
-
needMin: true,
|
|
198
|
-
needMax: true,
|
|
199
|
-
combineMaxMin: true,
|
|
200
|
-
maxMinBuffer: device.createBuffer({
|
|
201
|
-
byteLength: 4 * 4,
|
|
202
|
-
// @ts-expect-error webgl-legacy
|
|
203
|
-
accessor: {size: 4, type: GL.FLOAT, divisor: 1}
|
|
204
|
-
})
|
|
205
|
-
},
|
|
206
|
-
elevation: {
|
|
207
|
-
needMin: true,
|
|
208
|
-
needMax: true,
|
|
209
|
-
combineMaxMin: true,
|
|
210
|
-
maxMinBuffer: device.createBuffer({
|
|
211
|
-
byteLength: 4 * 4,
|
|
212
|
-
// @ts-expect-error
|
|
213
|
-
accessor: {size: 4, type: GL.FLOAT, divisor: 1}
|
|
214
|
-
})
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
positionAttributeName: 'positions'
|
|
218
|
-
});
|
|
219
|
-
const attributeManager = this.getAttributeManager()!;
|
|
220
|
-
attributeManager.add({
|
|
221
|
-
[POSITION_ATTRIBUTE_NAME]: {
|
|
222
|
-
size: 3,
|
|
223
|
-
accessor: 'getPosition',
|
|
224
|
-
type: 'float64',
|
|
225
|
-
fp64: this.use64bitPositions()
|
|
226
|
-
},
|
|
227
|
-
color: {size: 3, accessor: 'getColorWeight'},
|
|
228
|
-
elevation: {size: 3, accessor: 'getElevationWeight'}
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
updateState(opts) {
|
|
233
|
-
if (this.state.isSupported === false) {
|
|
234
|
-
// Skip update, layer not supported
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
super.updateState(opts);
|
|
238
|
-
const {aggregationDirty} = this.state;
|
|
239
|
-
if (aggregationDirty) {
|
|
240
|
-
// reset cached CPU Aggregation results (used for picking)
|
|
241
|
-
this.setState({
|
|
242
|
-
gridHash: null
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
getHashKeyForIndex(index: number): string {
|
|
248
|
-
const {numRow, numCol, boundingBox, gridOffset} = this.state;
|
|
249
|
-
const gridSize = [numCol, numRow];
|
|
250
|
-
const gridOrigin = [boundingBox.xMin, boundingBox.yMin];
|
|
251
|
-
const cellSize = [gridOffset.xOffset, gridOffset.yOffset];
|
|
252
|
-
|
|
253
|
-
const yIndex = Math.floor(index / gridSize[0]);
|
|
254
|
-
const xIndex = index - yIndex * gridSize[0];
|
|
255
|
-
// This will match the index to the hash-key to access aggregation data from CPU aggregation results.
|
|
256
|
-
const latIdx = Math.floor(
|
|
257
|
-
(yIndex * cellSize[1] + gridOrigin[1] + 90 + cellSize[1] / 2) / cellSize[1]
|
|
258
|
-
);
|
|
259
|
-
const lonIdx = Math.floor(
|
|
260
|
-
(xIndex * cellSize[0] + gridOrigin[0] + 180 + cellSize[0] / 2) / cellSize[0]
|
|
261
|
-
);
|
|
262
|
-
return `${latIdx}-${lonIdx}`;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
getPositionForIndex(index: number): Position {
|
|
266
|
-
const {numRow, numCol, boundingBox, gridOffset} = this.state;
|
|
267
|
-
const gridSize = [numCol, numRow];
|
|
268
|
-
const gridOrigin = [boundingBox.xMin, boundingBox.yMin];
|
|
269
|
-
const cellSize = [gridOffset.xOffset, gridOffset.yOffset];
|
|
270
|
-
|
|
271
|
-
const yIndex = Math.floor(index / gridSize[0]);
|
|
272
|
-
const xIndex = index - yIndex * gridSize[0];
|
|
273
|
-
const yPos = yIndex * cellSize[1] + gridOrigin[1];
|
|
274
|
-
const xPos = xIndex * cellSize[0] + gridOrigin[0];
|
|
275
|
-
return [xPos, yPos];
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
getPickingInfo({info, mode}: GetPickingInfoParams): PickingInfo {
|
|
279
|
-
const {index} = info;
|
|
280
|
-
let object: any = null;
|
|
281
|
-
if (index >= 0) {
|
|
282
|
-
const gpuGridAggregator = this.state.gpuGridAggregator!;
|
|
283
|
-
const position = this.getPositionForIndex(index);
|
|
284
|
-
const colorInfo = GPUGridAggregator.getAggregationData({
|
|
285
|
-
pixelIndex: index,
|
|
286
|
-
...gpuGridAggregator.getData('color')
|
|
287
|
-
});
|
|
288
|
-
const elevationInfo = GPUGridAggregator.getAggregationData({
|
|
289
|
-
pixelIndex: index,
|
|
290
|
-
...gpuGridAggregator.getData('elevation')
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
object = {
|
|
294
|
-
colorValue: colorInfo.cellWeight,
|
|
295
|
-
elevationValue: elevationInfo.cellWeight,
|
|
296
|
-
count: colorInfo.cellCount || elevationInfo.cellCount,
|
|
297
|
-
position,
|
|
298
|
-
totalCount: colorInfo.totalCount || elevationInfo.totalCount
|
|
299
|
-
};
|
|
300
|
-
if (mode !== 'hover') {
|
|
301
|
-
// perform CPU aggregation for full list of points for each cell
|
|
302
|
-
const {props} = this;
|
|
303
|
-
let {gridHash} = this.state;
|
|
304
|
-
if (!gridHash) {
|
|
305
|
-
const {gridOffset, translation, boundingBox} = this.state;
|
|
306
|
-
const {viewport} = this.context;
|
|
307
|
-
const attributes = this.getAttributes();
|
|
308
|
-
const cpuAggregation = pointToDensityGridDataCPU(props as any, {
|
|
309
|
-
gridOffset,
|
|
310
|
-
attributes,
|
|
311
|
-
viewport,
|
|
312
|
-
translation,
|
|
313
|
-
boundingBox
|
|
314
|
-
});
|
|
315
|
-
gridHash = cpuAggregation.gridHash;
|
|
316
|
-
this.setState({gridHash});
|
|
317
|
-
}
|
|
318
|
-
const key = this.getHashKeyForIndex(index);
|
|
319
|
-
const cpuAggregationData = gridHash[key];
|
|
320
|
-
Object.assign(object, cpuAggregationData);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// override object with picked cell
|
|
325
|
-
info.picked = Boolean(object);
|
|
326
|
-
info.object = object;
|
|
327
|
-
|
|
328
|
-
return info;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
renderLayers() {
|
|
332
|
-
if (!this.state.isSupported) {
|
|
333
|
-
return null;
|
|
334
|
-
}
|
|
335
|
-
const {
|
|
336
|
-
elevationScale,
|
|
337
|
-
extruded,
|
|
338
|
-
cellSize: cellSizeMeters,
|
|
339
|
-
coverage,
|
|
340
|
-
material,
|
|
341
|
-
elevationRange,
|
|
342
|
-
colorDomain,
|
|
343
|
-
elevationDomain
|
|
344
|
-
} = this.props;
|
|
345
|
-
|
|
346
|
-
const {weights, numRow, numCol, gridOrigin, gridOffset} = this.state;
|
|
347
|
-
const {color, elevation} = weights;
|
|
348
|
-
const colorRange = colorRangeToFlatArray(this.props.colorRange);
|
|
349
|
-
|
|
350
|
-
const SubLayerClass = this.getSubLayerClass('gpu-grid-cell', GPUGridCellLayer);
|
|
351
|
-
|
|
352
|
-
return new SubLayerClass(
|
|
353
|
-
{
|
|
354
|
-
gridSize: [numCol, numRow],
|
|
355
|
-
gridOrigin,
|
|
356
|
-
gridOffset: [gridOffset.xOffset, gridOffset.yOffset],
|
|
357
|
-
colorRange,
|
|
358
|
-
elevationRange,
|
|
359
|
-
colorDomain,
|
|
360
|
-
elevationDomain,
|
|
361
|
-
|
|
362
|
-
cellSize: cellSizeMeters,
|
|
363
|
-
coverage,
|
|
364
|
-
material,
|
|
365
|
-
elevationScale,
|
|
366
|
-
extruded
|
|
367
|
-
},
|
|
368
|
-
this.getSubLayerProps({
|
|
369
|
-
id: 'gpu-grid-cell'
|
|
370
|
-
}),
|
|
371
|
-
{
|
|
372
|
-
data: {
|
|
373
|
-
attributes: {
|
|
374
|
-
colors: color.aggregationBuffer,
|
|
375
|
-
elevations: elevation.aggregationBuffer
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
colorMaxMinBuffer: color.maxMinBuffer,
|
|
379
|
-
elevationMaxMinBuffer: elevation.maxMinBuffer,
|
|
380
|
-
numInstances: numCol * numRow
|
|
381
|
-
}
|
|
382
|
-
);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
finalizeState(context: LayerContext) {
|
|
386
|
-
const {color, elevation} = this.state.weights;
|
|
387
|
-
[color, elevation].forEach(weight => {
|
|
388
|
-
const {aggregationBuffer, maxMinBuffer} = weight;
|
|
389
|
-
maxMinBuffer?.destroy();
|
|
390
|
-
aggregationBuffer?.destroy();
|
|
391
|
-
});
|
|
392
|
-
super.finalizeState(context);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// Aggregation Overrides
|
|
396
|
-
|
|
397
|
-
updateAggregationState(opts) {
|
|
398
|
-
const {props, oldProps} = opts;
|
|
399
|
-
const {cellSize, coordinateSystem} = props;
|
|
400
|
-
const {viewport} = this.context;
|
|
401
|
-
const cellSizeChanged = oldProps.cellSize !== cellSize;
|
|
402
|
-
const {dimensions} = this.state;
|
|
403
|
-
|
|
404
|
-
const positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
|
|
405
|
-
// any attribute changed
|
|
406
|
-
const attributesChanged = positionsChanged || this.isAttributeChanged();
|
|
407
|
-
|
|
408
|
-
let {boundingBox} = this.state;
|
|
409
|
-
if (positionsChanged) {
|
|
410
|
-
boundingBox = getBoundingBox(this.getAttributes(), this.getNumInstances());
|
|
411
|
-
this.setState({boundingBox});
|
|
412
|
-
}
|
|
413
|
-
if (positionsChanged || cellSizeChanged) {
|
|
414
|
-
const {gridOffset, translation, width, height, numCol, numRow} = getGridParams(
|
|
415
|
-
boundingBox,
|
|
416
|
-
cellSize,
|
|
417
|
-
viewport,
|
|
418
|
-
coordinateSystem
|
|
419
|
-
);
|
|
420
|
-
this.allocateResources(numRow, numCol);
|
|
421
|
-
this.setState({
|
|
422
|
-
gridOffset,
|
|
423
|
-
translation,
|
|
424
|
-
gridOrigin: [-1 * translation[0], -1 * translation[1]],
|
|
425
|
-
width,
|
|
426
|
-
height,
|
|
427
|
-
numCol,
|
|
428
|
-
numRow
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
const aggregationDataDirty =
|
|
433
|
-
attributesChanged ||
|
|
434
|
-
this.isAggregationDirty(opts, {
|
|
435
|
-
dimension: dimensions.data,
|
|
436
|
-
compareAll: true
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
if (aggregationDataDirty) {
|
|
440
|
-
this._updateAccessors(opts);
|
|
441
|
-
}
|
|
442
|
-
this.setState({
|
|
443
|
-
aggregationDataDirty
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
// Private
|
|
448
|
-
|
|
449
|
-
_updateAccessors(opts) {
|
|
450
|
-
const {colorAggregation, elevationAggregation} = opts.props;
|
|
451
|
-
const {color, elevation} = this.state.weights;
|
|
452
|
-
color.operation = AGGREGATION_OPERATION[colorAggregation];
|
|
453
|
-
elevation.operation = AGGREGATION_OPERATION[elevationAggregation];
|
|
454
|
-
}
|
|
455
|
-
}
|