@deck.gl/aggregation-layers 9.0.40 → 9.1.0-beta.3
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 +70 -0
- package/dist/common/aggregation-layer.js.map +1 -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 +5 -0
- package/dist/common/aggregator/aggregator.js.map +1 -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 +67 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.js.map +1 -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 +140 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js.map +1 -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 +44 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.js.map +1 -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 +56 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js.map +1 -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 +21 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js.map +1 -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 +18 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js.map +1 -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 +25 -0
- package/dist/common/aggregator/gpu-aggregator/utils.js.map +1 -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 +216 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js.map +1 -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 +202 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js.map +1 -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 +224 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js.map +1 -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 +6 -0
- package/dist/common/aggregator/index.js.map +1 -0
- package/dist/common/types.d.ts +11 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/common/types.js +5 -0
- package/dist/common/types.js.map +1 -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 +21 -0
- package/dist/common/utils/bounds-utils.js.map +1 -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 +66 -0
- package/dist/common/utils/color-utils.js.map +1 -0
- package/dist/common/utils/prop-utils.d.ts.map +1 -0
- package/dist/common/utils/prop-utils.js +13 -0
- package/dist/common/utils/prop-utils.js.map +1 -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 +181 -0
- package/dist/common/utils/scale-utils.js.map +1 -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 +18 -0
- package/dist/contour-layer/bin-options-uniforms.js.map +1 -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 +233 -192
- package/dist/contour-layer/contour-layer.js.map +1 -0
- 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 +25 -29
- package/dist/contour-layer/contour-utils.js.map +1 -0
- package/dist/contour-layer/marching-squares-codes.d.ts.map +1 -1
- package/dist/contour-layer/marching-squares-codes.js +4 -0
- package/dist/contour-layer/marching-squares-codes.js.map +1 -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 +72 -68
- package/dist/contour-layer/marching-squares.js.map +1 -0
- 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 +47 -0
- package/dist/contour-layer/value-reader.js.map +1 -0
- package/dist/dist.dev.js +4844 -4083
- 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 +18 -0
- package/dist/grid-layer/bin-options-uniforms.js.map +1 -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 +52 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.js.map +1 -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 +94 -0
- package/dist/grid-layer/grid-cell-layer.js.map +1 -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 +24 -0
- package/dist/grid-layer/grid-layer-uniforms.js.map +1 -0
- package/dist/grid-layer/grid-layer.d.ts +176 -14
- package/dist/grid-layer/grid-layer.d.ts.map +1 -1
- package/dist/grid-layer/grid-layer.js +343 -46
- package/dist/grid-layer/grid-layer.js.map +1 -0
- 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} +7 -21
- package/dist/heatmap-layer/aggregation-layer.js.map +1 -0
- 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 +33 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.js.map +1 -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 +4 -0
- package/dist/heatmap-layer/heatmap-layer-utils.js.map +1 -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 +44 -33
- package/dist/heatmap-layer/heatmap-layer.js.map +1 -0
- package/dist/heatmap-layer/max-fs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/max-fs.glsl.js +4 -0
- package/dist/heatmap-layer/max-fs.glsl.js.map +1 -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 +7 -4
- package/dist/heatmap-layer/max-vs.glsl.js.map +1 -0
- 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 +6 -23
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.js.map +1 -0
- 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 +23 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.js.map +1 -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 +11 -30
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.js.map +1 -0
- 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 +18 -30
- package/dist/heatmap-layer/triangle-layer.js.map +1 -0
- package/dist/heatmap-layer/weights-fs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/weights-fs.glsl.js +4 -0
- package/dist/heatmap-layer/weights-fs.glsl.js.map +1 -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 +7 -7
- package/dist/heatmap-layer/weights-vs.glsl.js.map +1 -0
- 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 +18 -0
- package/dist/hexagon-layer/bin-options-uniforms.js.map +1 -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 +56 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js.map +1 -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 +95 -0
- package/dist/hexagon-layer/hexagon-cell-layer.js.map +1 -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 +22 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.js.map +1 -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 +308 -123
- package/dist/hexagon-layer/hexagon-layer.js.map +1 -0
- 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 +70 -0
- package/dist/hexagon-layer/hexbin.js.map +1 -0
- package/dist/index.cjs +3026 -2947
- 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 +6 -27
- package/dist/index.js.map +1 -0
- 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 +16 -0
- package/dist/screen-grid-layer/bin-options-uniforms.js.map +1 -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 +53 -134
- package/dist/screen-grid-layer/screen-grid-cell-layer.js.map +1 -0
- 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 +5 -24
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +1 -0
- 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 +20 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.js.map +1 -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 +22 -62
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +1 -0
- 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 +158 -174
- package/dist/screen-grid-layer/screen-grid-layer.js.map +1 -0
- 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,112 +1,653 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import {
|
|
2
|
-
|
|
6
|
+
log,
|
|
7
|
+
Accessor,
|
|
8
|
+
Color,
|
|
9
|
+
GetPickingInfoParams,
|
|
3
10
|
CompositeLayerProps,
|
|
11
|
+
createIterable,
|
|
4
12
|
Layer,
|
|
13
|
+
Material,
|
|
14
|
+
project32,
|
|
15
|
+
LayersList,
|
|
16
|
+
PickingInfo,
|
|
17
|
+
Position,
|
|
18
|
+
Viewport,
|
|
5
19
|
UpdateParameters,
|
|
6
20
|
DefaultProps
|
|
7
21
|
} from '@deck.gl/core';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
22
|
+
import {WebGLAggregator, CPUAggregator, AggregationOperation} from '../common/aggregator/index';
|
|
23
|
+
import AggregationLayer from '../common/aggregation-layer';
|
|
24
|
+
import {AggregateAccessor} from '../common/types';
|
|
25
|
+
import {defaultColorRange} from '../common/utils/color-utils';
|
|
26
|
+
import {AttributeWithScale} from '../common/utils/scale-utils';
|
|
27
|
+
import {getBinIdRange} from '../common/utils/bounds-utils';
|
|
28
|
+
|
|
29
|
+
import {GridCellLayer} from './grid-cell-layer';
|
|
30
|
+
import {BinOptions, binOptionsUniforms} from './bin-options-uniforms';
|
|
31
|
+
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
33
|
+
function noop() {}
|
|
11
34
|
|
|
12
35
|
const defaultProps: DefaultProps<GridLayerProps> = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
36
|
+
gpuAggregation: true,
|
|
37
|
+
|
|
38
|
+
// color
|
|
39
|
+
colorDomain: null,
|
|
40
|
+
colorRange: defaultColorRange,
|
|
41
|
+
getColorValue: {type: 'accessor', value: null}, // default value is calculated from `getColorWeight` and `colorAggregation`
|
|
42
|
+
getColorWeight: {type: 'accessor', value: 1},
|
|
43
|
+
colorAggregation: 'SUM',
|
|
44
|
+
lowerPercentile: {type: 'number', min: 0, max: 100, value: 0},
|
|
45
|
+
upperPercentile: {type: 'number', min: 0, max: 100, value: 100},
|
|
46
|
+
colorScaleType: 'quantize',
|
|
47
|
+
onSetColorDomain: noop,
|
|
48
|
+
|
|
49
|
+
// elevation
|
|
50
|
+
elevationDomain: null,
|
|
51
|
+
elevationRange: [0, 1000],
|
|
52
|
+
getElevationValue: {type: 'accessor', value: null}, // default value is calculated from `getElevationWeight` and `elevationAggregation`
|
|
53
|
+
getElevationWeight: {type: 'accessor', value: 1},
|
|
54
|
+
elevationAggregation: 'SUM',
|
|
55
|
+
elevationScale: {type: 'number', min: 0, value: 1},
|
|
56
|
+
elevationLowerPercentile: {type: 'number', min: 0, max: 100, value: 0},
|
|
57
|
+
elevationUpperPercentile: {type: 'number', min: 0, max: 100, value: 100},
|
|
58
|
+
elevationScaleType: 'linear',
|
|
59
|
+
onSetElevationDomain: noop,
|
|
60
|
+
|
|
61
|
+
// grid
|
|
62
|
+
cellSize: {type: 'number', min: 0, value: 1000},
|
|
63
|
+
coverage: {type: 'number', min: 0, max: 1, value: 1},
|
|
64
|
+
getPosition: {type: 'accessor', value: (x: any) => x.position},
|
|
65
|
+
gridAggregator: {type: 'function', optional: true, value: null},
|
|
66
|
+
extruded: false,
|
|
67
|
+
|
|
68
|
+
// Optional material for 'lighting' shader module
|
|
69
|
+
material: true
|
|
16
70
|
};
|
|
17
71
|
|
|
18
72
|
/** All properties supported by GridLayer. */
|
|
19
73
|
export type GridLayerProps<DataT = unknown> = _GridLayerProps<DataT> & CompositeLayerProps;
|
|
20
74
|
|
|
21
75
|
/** Properties added by GridLayer. */
|
|
22
|
-
type _GridLayerProps<DataT> =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
76
|
+
type _GridLayerProps<DataT> = {
|
|
77
|
+
/**
|
|
78
|
+
* Custom accessor to retrieve a grid bin index from each data object.
|
|
79
|
+
* Not supported by GPU aggregation.
|
|
80
|
+
*/
|
|
81
|
+
gridAggregator?: ((position: number[], cellSize: number) => [number, number]) | null;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Size of each cell in meters.
|
|
85
|
+
* @default 1000
|
|
86
|
+
*/
|
|
87
|
+
cellSize?: number;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Color scale domain, default is set to the extent of aggregated weights in each cell.
|
|
91
|
+
* @default [min(colorWeight), max(colorWeight)]
|
|
92
|
+
*/
|
|
93
|
+
colorDomain?: [number, number] | null;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Default: [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6) `6-class YlOrRd`
|
|
97
|
+
*/
|
|
98
|
+
colorRange?: Color[];
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Cell size multiplier, clamped between 0 - 1.
|
|
102
|
+
* @default 1
|
|
103
|
+
*/
|
|
104
|
+
coverage?: number;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Elevation scale input domain, default is set to between 0 and the max of aggregated weights in each cell.
|
|
108
|
+
* @default [0, max(elevationWeight)]
|
|
109
|
+
*/
|
|
110
|
+
elevationDomain?: [number, number] | null;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Elevation scale output range.
|
|
114
|
+
* @default [0, 1000]
|
|
115
|
+
*/
|
|
116
|
+
elevationRange?: [number, number];
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Cell elevation multiplier.
|
|
120
|
+
* @default 1
|
|
121
|
+
*/
|
|
122
|
+
elevationScale?: number;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Whether to enable cell elevation. If set to false, all cell will be flat.
|
|
126
|
+
* @default true
|
|
127
|
+
*/
|
|
128
|
+
extruded?: boolean;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Filter cells and re-calculate color by `upperPercentile`.
|
|
132
|
+
* Cells with value larger than the upperPercentile will be hidden.
|
|
133
|
+
* @default 100
|
|
134
|
+
*/
|
|
135
|
+
upperPercentile?: number;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Filter cells and re-calculate color by `lowerPercentile`.
|
|
139
|
+
* Cells with value smaller than the lowerPercentile will be hidden.
|
|
140
|
+
* @default 0
|
|
141
|
+
*/
|
|
142
|
+
lowerPercentile?: number;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Filter cells and re-calculate elevation by `elevationUpperPercentile`.
|
|
146
|
+
* Cells with elevation value larger than the `elevationUpperPercentile` will be hidden.
|
|
147
|
+
* @default 100
|
|
148
|
+
*/
|
|
149
|
+
elevationUpperPercentile?: number;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Filter cells and re-calculate elevation by `elevationLowerPercentile`.
|
|
153
|
+
* Cells with elevation value larger than the `elevationLowerPercentile` will be hidden.
|
|
154
|
+
* @default 0
|
|
155
|
+
*/
|
|
156
|
+
elevationLowerPercentile?: number;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Scaling function used to determine the color of the grid cell.
|
|
160
|
+
* Supported Values are 'quantize', 'linear', 'quantile' and 'ordinal'.
|
|
161
|
+
* @default 'quantize'
|
|
162
|
+
*/
|
|
163
|
+
colorScaleType?: 'quantize' | 'linear' | 'quantile' | 'ordinal';
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Scaling function used to determine the elevation of the grid cell.
|
|
167
|
+
* Supported Values are 'linear' and 'quantile'.
|
|
168
|
+
* @default 'linear'
|
|
169
|
+
*/
|
|
170
|
+
elevationScaleType?: 'linear' | 'quantile';
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Material settings for lighting effect. Applies if `extruded: true`.
|
|
174
|
+
*
|
|
175
|
+
* @default true
|
|
176
|
+
* @see https://deck.gl/docs/developer-guide/using-lighting
|
|
177
|
+
*/
|
|
178
|
+
material?: Material;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Defines the operation used to aggregate all data object weights to calculate a cell's color value.
|
|
182
|
+
* Valid values are 'SUM', 'MEAN', 'MIN', 'MAX', 'COUNT'.
|
|
183
|
+
*
|
|
184
|
+
* @default 'SUM'
|
|
185
|
+
*/
|
|
186
|
+
colorAggregation?: AggregationOperation;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Defines the operation used to aggregate all data object weights to calculate a cell's elevation value.
|
|
190
|
+
* Valid values are 'SUM', 'MEAN', 'MIN', 'MAX', 'COUNT'.
|
|
191
|
+
*
|
|
192
|
+
* @default 'SUM'
|
|
193
|
+
*/
|
|
194
|
+
elevationAggregation?: AggregationOperation;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Method called to retrieve the position of each object.
|
|
198
|
+
* @default object => object.position
|
|
199
|
+
*/
|
|
200
|
+
getPosition?: Accessor<DataT, Position>;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* The weight of a data object used to calculate the color value for a cell.
|
|
204
|
+
* @default 1
|
|
205
|
+
*/
|
|
206
|
+
getColorWeight?: Accessor<DataT, number>;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* After data objects are aggregated into cells, this accessor is called on each cell to get the value that its color is based on.
|
|
210
|
+
* Not supported by GPU aggregation.
|
|
211
|
+
* @default null
|
|
212
|
+
*/
|
|
213
|
+
getColorValue?: AggregateAccessor<DataT> | null;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* The weight of a data object used to calculate the elevation value for a cell.
|
|
217
|
+
* @default 1
|
|
218
|
+
*/
|
|
219
|
+
getElevationWeight?: Accessor<DataT, number>;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* After data objects are aggregated into cells, this accessor is called on each cell to get the value that its elevation is based on.
|
|
223
|
+
* Not supported by GPU aggregation.
|
|
224
|
+
* @default null
|
|
225
|
+
*/
|
|
226
|
+
getElevationValue?: AggregateAccessor<DataT> | null;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* This callback will be called when bin color domain has been calculated.
|
|
230
|
+
* @default () => {}
|
|
231
|
+
*/
|
|
232
|
+
onSetColorDomain?: (minMax: [number, number]) => void;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* This callback will be called when bin elevation domain has been calculated.
|
|
236
|
+
* @default () => {}
|
|
237
|
+
*/
|
|
238
|
+
onSetElevationDomain?: (minMax: [number, number]) => void;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* When set to true, aggregation is performed on GPU, provided other conditions are met.
|
|
242
|
+
* @default true
|
|
243
|
+
*/
|
|
244
|
+
gpuAggregation?: boolean;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export type GridLayerPickingInfo<DataT> = PickingInfo<{
|
|
248
|
+
/** Column index of the picked cell */
|
|
249
|
+
col: number;
|
|
250
|
+
/** Row index of the picked cell */
|
|
251
|
+
row: number;
|
|
252
|
+
/** Aggregated color value, as determined by `getColorWeight` and `colorAggregation` */
|
|
253
|
+
colorValue: number;
|
|
254
|
+
/** Aggregated elevation value, as determined by `getElevationWeight` and `elevationAggregation` */
|
|
255
|
+
elevationValue: number;
|
|
256
|
+
/** Number of data points in the picked cell */
|
|
257
|
+
count: number;
|
|
258
|
+
/** Indices of the data objects in the picked cell. Only available if using CPU aggregation. */
|
|
259
|
+
pointIndices?: number[];
|
|
260
|
+
/** The data objects in the picked cell. Only available if using CPU aggregation and layer data is an array. */
|
|
261
|
+
points?: DataT[];
|
|
262
|
+
}>;
|
|
36
263
|
|
|
37
264
|
/** Aggregate data into a grid-based heatmap. The color and height of a cell are determined based on the objects it contains. */
|
|
38
|
-
export default class GridLayer<DataT = any, ExtraPropsT extends {} = {}> extends
|
|
265
|
+
export default class GridLayer<DataT = any, ExtraPropsT extends {} = {}> extends AggregationLayer<
|
|
266
|
+
DataT,
|
|
39
267
|
ExtraPropsT & Required<_GridLayerProps<DataT>>
|
|
40
268
|
> {
|
|
41
269
|
static layerName = 'GridLayer';
|
|
42
270
|
static defaultProps = defaultProps;
|
|
43
271
|
|
|
44
|
-
state!:
|
|
45
|
-
|
|
46
|
-
|
|
272
|
+
state!: AggregationLayer<DataT>['state'] &
|
|
273
|
+
BinOptions & {
|
|
274
|
+
// Needed if getColorValue, getElevationValue are used
|
|
275
|
+
dataAsArray?: DataT[];
|
|
47
276
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
277
|
+
colors?: AttributeWithScale;
|
|
278
|
+
elevations?: AttributeWithScale;
|
|
279
|
+
|
|
280
|
+
binIdRange: [number, number][];
|
|
281
|
+
aggregatorViewport: Viewport;
|
|
51
282
|
};
|
|
283
|
+
|
|
284
|
+
getAggregatorType(): string {
|
|
285
|
+
const {gpuAggregation, gridAggregator, getColorValue, getElevationValue} = this.props;
|
|
286
|
+
if (gpuAggregation && (gridAggregator || getColorValue || getElevationValue)) {
|
|
287
|
+
// If these features are desired by the app, the user should explicitly use CPU aggregation
|
|
288
|
+
log.warn('Features not supported by GPU aggregation, falling back to CPU')();
|
|
289
|
+
return 'cpu';
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (
|
|
293
|
+
// GPU aggregation is requested
|
|
294
|
+
gpuAggregation &&
|
|
295
|
+
// GPU aggregation is supported by the device
|
|
296
|
+
WebGLAggregator.isSupported(this.context.device)
|
|
297
|
+
) {
|
|
298
|
+
return 'gpu';
|
|
299
|
+
}
|
|
300
|
+
return 'cpu';
|
|
52
301
|
}
|
|
53
302
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
303
|
+
createAggregator(type: string): WebGLAggregator | CPUAggregator {
|
|
304
|
+
if (type === 'cpu') {
|
|
305
|
+
const {gridAggregator, cellSize} = this.props;
|
|
306
|
+
return new CPUAggregator({
|
|
307
|
+
dimensions: 2,
|
|
308
|
+
getBin: {
|
|
309
|
+
sources: ['positions'],
|
|
310
|
+
getValue: ({positions}: {positions: number[]}, index: number, opts: BinOptions) => {
|
|
311
|
+
if (gridAggregator) {
|
|
312
|
+
return gridAggregator(positions, cellSize);
|
|
313
|
+
}
|
|
314
|
+
const viewport = this.state.aggregatorViewport;
|
|
315
|
+
// project to common space
|
|
316
|
+
const p = viewport.projectPosition(positions);
|
|
317
|
+
const {cellSizeCommon, cellOriginCommon} = opts;
|
|
318
|
+
return [
|
|
319
|
+
Math.floor((p[0] - cellOriginCommon[0]) / cellSizeCommon[0]),
|
|
320
|
+
Math.floor((p[1] - cellOriginCommon[1]) / cellSizeCommon[1])
|
|
321
|
+
];
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
getValue: [
|
|
325
|
+
{sources: ['colorWeights'], getValue: ({colorWeights}) => colorWeights},
|
|
326
|
+
{sources: ['elevationWeights'], getValue: ({elevationWeights}) => elevationWeights}
|
|
327
|
+
]
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
return new WebGLAggregator(this.context.device, {
|
|
331
|
+
dimensions: 2,
|
|
332
|
+
channelCount: 2,
|
|
333
|
+
bufferLayout: this.getAttributeManager()!.getBufferLayouts({isInstanced: false}),
|
|
334
|
+
...super.getShaders({
|
|
335
|
+
modules: [project32, binOptionsUniforms],
|
|
336
|
+
vs: /* glsl */ `
|
|
337
|
+
in vec3 positions;
|
|
338
|
+
in vec3 positions64Low;
|
|
339
|
+
in float colorWeights;
|
|
340
|
+
in float elevationWeights;
|
|
341
|
+
|
|
342
|
+
void getBin(out ivec2 binId) {
|
|
343
|
+
vec3 positionCommon = project_position(positions, positions64Low);
|
|
344
|
+
vec2 gridCoords = floor(positionCommon.xy / binOptions.cellSizeCommon);
|
|
345
|
+
binId = ivec2(gridCoords);
|
|
346
|
+
}
|
|
347
|
+
void getValue(out vec2 value) {
|
|
348
|
+
value = vec2(colorWeights, elevationWeights);
|
|
349
|
+
}
|
|
350
|
+
`
|
|
351
|
+
})
|
|
59
352
|
});
|
|
60
353
|
}
|
|
61
354
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
{
|
|
75
|
-
|
|
355
|
+
initializeState() {
|
|
356
|
+
super.initializeState();
|
|
357
|
+
|
|
358
|
+
const attributeManager = this.getAttributeManager()!;
|
|
359
|
+
attributeManager.add({
|
|
360
|
+
positions: {
|
|
361
|
+
size: 3,
|
|
362
|
+
accessor: 'getPosition',
|
|
363
|
+
type: 'float64',
|
|
364
|
+
fp64: this.use64bitPositions()
|
|
365
|
+
},
|
|
366
|
+
colorWeights: {size: 1, accessor: 'getColorWeight'},
|
|
367
|
+
elevationWeights: {size: 1, accessor: 'getElevationWeight'}
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
updateState(params: UpdateParameters<this>) {
|
|
372
|
+
const aggregatorChanged = super.updateState(params);
|
|
373
|
+
|
|
374
|
+
const {props, oldProps, changeFlags} = params;
|
|
375
|
+
const {aggregator} = this.state;
|
|
376
|
+
if (
|
|
377
|
+
(changeFlags.dataChanged || !this.state.dataAsArray) &&
|
|
378
|
+
(props.getColorValue || props.getElevationValue)
|
|
379
|
+
) {
|
|
380
|
+
// Convert data to array
|
|
381
|
+
this.state.dataAsArray = Array.from(createIterable(props.data).iterable);
|
|
382
|
+
}
|
|
383
|
+
if (
|
|
384
|
+
aggregatorChanged ||
|
|
385
|
+
changeFlags.dataChanged ||
|
|
386
|
+
props.cellSize !== oldProps.cellSize ||
|
|
387
|
+
props.getColorValue !== oldProps.getColorValue ||
|
|
388
|
+
props.getElevationValue !== oldProps.getElevationValue ||
|
|
389
|
+
props.colorAggregation !== oldProps.colorAggregation ||
|
|
390
|
+
props.elevationAggregation !== oldProps.elevationAggregation
|
|
391
|
+
) {
|
|
392
|
+
this._updateBinOptions();
|
|
393
|
+
const {cellSizeCommon, cellOriginCommon, binIdRange, dataAsArray} = this.state;
|
|
394
|
+
|
|
395
|
+
aggregator.setProps({
|
|
396
|
+
// @ts-expect-error only used by GPUAggregator
|
|
397
|
+
binIdRange,
|
|
398
|
+
pointCount: this.getNumInstances(),
|
|
399
|
+
operations: [props.colorAggregation, props.elevationAggregation],
|
|
400
|
+
binOptions: {
|
|
401
|
+
cellSizeCommon,
|
|
402
|
+
cellOriginCommon
|
|
403
|
+
},
|
|
404
|
+
onUpdate: this._onAggregationUpdate.bind(this)
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
if (dataAsArray) {
|
|
408
|
+
const {getColorValue, getElevationValue} = this.props;
|
|
409
|
+
aggregator.setProps({
|
|
410
|
+
// @ts-expect-error only used by CPUAggregator
|
|
411
|
+
customOperations: [
|
|
412
|
+
getColorValue &&
|
|
413
|
+
((indices: number[]) =>
|
|
414
|
+
getColorValue(
|
|
415
|
+
indices.map(i => dataAsArray[i]),
|
|
416
|
+
{indices, data: props.data}
|
|
417
|
+
)),
|
|
418
|
+
getElevationValue &&
|
|
419
|
+
((indices: number[]) =>
|
|
420
|
+
getElevationValue(
|
|
421
|
+
indices.map(i => dataAsArray[i]),
|
|
422
|
+
{indices, data: props.data}
|
|
423
|
+
))
|
|
424
|
+
]
|
|
425
|
+
});
|
|
76
426
|
}
|
|
77
|
-
|
|
427
|
+
}
|
|
428
|
+
if (changeFlags.updateTriggersChanged && changeFlags.updateTriggersChanged.getColorValue) {
|
|
429
|
+
aggregator.setNeedsUpdate(0);
|
|
430
|
+
}
|
|
431
|
+
if (changeFlags.updateTriggersChanged && changeFlags.updateTriggersChanged.getElevationValue) {
|
|
432
|
+
aggregator.setNeedsUpdate(1);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
return aggregatorChanged;
|
|
78
436
|
}
|
|
79
437
|
|
|
80
|
-
|
|
438
|
+
private _updateBinOptions() {
|
|
439
|
+
const bounds = this.getBounds();
|
|
440
|
+
const cellSizeCommon: [number, number] = [1, 1];
|
|
441
|
+
let cellOriginCommon: [number, number] = [0, 0];
|
|
442
|
+
let binIdRange: [number, number][] = [
|
|
443
|
+
[0, 1],
|
|
444
|
+
[0, 1]
|
|
445
|
+
];
|
|
446
|
+
let viewport = this.context.viewport;
|
|
81
447
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
448
|
+
if (bounds && Number.isFinite(bounds[0][0])) {
|
|
449
|
+
let centroid = [(bounds[0][0] + bounds[1][0]) / 2, (bounds[0][1] + bounds[1][1]) / 2];
|
|
450
|
+
const {cellSize} = this.props;
|
|
451
|
+
const {unitsPerMeter} = viewport.getDistanceScales(centroid);
|
|
452
|
+
cellSizeCommon[0] = unitsPerMeter[0] * cellSize;
|
|
453
|
+
cellSizeCommon[1] = unitsPerMeter[1] * cellSize;
|
|
454
|
+
|
|
455
|
+
// Offset common space to center at the origin of the grid cell where the data center is in
|
|
456
|
+
// This improves precision without affecting the cell positions
|
|
457
|
+
const centroidCommon = viewport.projectFlat(centroid);
|
|
458
|
+
cellOriginCommon = [
|
|
459
|
+
Math.floor(centroidCommon[0] / cellSizeCommon[0]) * cellSizeCommon[0],
|
|
460
|
+
Math.floor(centroidCommon[1] / cellSizeCommon[1]) * cellSizeCommon[1]
|
|
461
|
+
];
|
|
462
|
+
centroid = viewport.unprojectFlat(cellOriginCommon);
|
|
463
|
+
|
|
464
|
+
const ViewportType = viewport.constructor as any;
|
|
465
|
+
// We construct a viewport for the GPU aggregator's project module
|
|
466
|
+
// This viewport is determined by data
|
|
467
|
+
// removes arbitrary precision variance that depends on initial view state
|
|
468
|
+
viewport = viewport.isGeospatial
|
|
469
|
+
? new ViewportType({longitude: centroid[0], latitude: centroid[1], zoom: 12})
|
|
470
|
+
: new Viewport({position: [centroid[0], centroid[1], 0], zoom: 12});
|
|
471
|
+
|
|
472
|
+
// Round to the nearest 32-bit float to match CPU and GPU results
|
|
473
|
+
cellOriginCommon = [Math.fround(viewport.center[0]), Math.fround(viewport.center[1])];
|
|
474
|
+
|
|
475
|
+
binIdRange = getBinIdRange({
|
|
476
|
+
dataBounds: bounds,
|
|
477
|
+
getBinId: (p: number[]) => {
|
|
478
|
+
const positionCommon = viewport.projectFlat(p);
|
|
479
|
+
return [
|
|
480
|
+
Math.floor((positionCommon[0] - cellOriginCommon[0]) / cellSizeCommon[0]),
|
|
481
|
+
Math.floor((positionCommon[1] - cellOriginCommon[1]) / cellSizeCommon[1])
|
|
482
|
+
];
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
this.setState({cellSizeCommon, cellOriginCommon, binIdRange, aggregatorViewport: viewport});
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
override draw(opts) {
|
|
491
|
+
// Replaces render time viewport with our own
|
|
492
|
+
if (opts.shaderModuleProps.project) {
|
|
493
|
+
opts.shaderModuleProps.project.viewport = this.state.aggregatorViewport;
|
|
94
494
|
}
|
|
95
|
-
|
|
96
|
-
|
|
495
|
+
super.draw(opts);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
private _onAggregationUpdate({channel}: {channel: number}) {
|
|
499
|
+
const props = this.getCurrentLayer()!.props;
|
|
500
|
+
const {aggregator} = this.state;
|
|
501
|
+
if (channel === 0) {
|
|
502
|
+
const result = aggregator.getResult(0)!;
|
|
503
|
+
this.setState({
|
|
504
|
+
colors: new AttributeWithScale(result, aggregator.binCount)
|
|
505
|
+
});
|
|
506
|
+
props.onSetColorDomain(aggregator.getResultDomain(0));
|
|
507
|
+
} else if (channel === 1) {
|
|
508
|
+
const result = aggregator.getResult(1)!;
|
|
509
|
+
this.setState({
|
|
510
|
+
elevations: new AttributeWithScale(result, aggregator.binCount)
|
|
511
|
+
});
|
|
512
|
+
props.onSetElevationDomain(aggregator.getResultDomain(1));
|
|
97
513
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
onAttributeChange(id: string) {
|
|
517
|
+
const {aggregator} = this.state;
|
|
518
|
+
switch (id) {
|
|
519
|
+
case 'positions':
|
|
520
|
+
aggregator.setNeedsUpdate();
|
|
521
|
+
|
|
522
|
+
this._updateBinOptions();
|
|
523
|
+
const {cellSizeCommon, cellOriginCommon, binIdRange} = this.state;
|
|
524
|
+
aggregator.setProps({
|
|
525
|
+
// @ts-expect-error only used by GPUAggregator
|
|
526
|
+
binIdRange,
|
|
527
|
+
binOptions: {
|
|
528
|
+
cellSizeCommon,
|
|
529
|
+
cellOriginCommon
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
break;
|
|
533
|
+
|
|
534
|
+
case 'colorWeights':
|
|
535
|
+
aggregator.setNeedsUpdate(0);
|
|
536
|
+
break;
|
|
537
|
+
|
|
538
|
+
case 'elevationWeights':
|
|
539
|
+
aggregator.setNeedsUpdate(1);
|
|
540
|
+
break;
|
|
541
|
+
|
|
542
|
+
default:
|
|
543
|
+
// This should not happen
|
|
101
544
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
renderLayers(): LayersList | Layer | null {
|
|
548
|
+
const {aggregator, cellOriginCommon, cellSizeCommon} = this.state;
|
|
549
|
+
const {
|
|
550
|
+
elevationScale,
|
|
551
|
+
colorRange,
|
|
552
|
+
elevationRange,
|
|
553
|
+
extruded,
|
|
554
|
+
coverage,
|
|
555
|
+
material,
|
|
556
|
+
transitions,
|
|
557
|
+
colorScaleType,
|
|
558
|
+
lowerPercentile,
|
|
559
|
+
upperPercentile,
|
|
560
|
+
colorDomain,
|
|
561
|
+
elevationScaleType,
|
|
562
|
+
elevationLowerPercentile,
|
|
563
|
+
elevationUpperPercentile,
|
|
564
|
+
elevationDomain
|
|
565
|
+
} = this.props;
|
|
566
|
+
const CellLayerClass = this.getSubLayerClass('cells', GridCellLayer);
|
|
567
|
+
const binAttribute = aggregator.getBins();
|
|
568
|
+
|
|
569
|
+
const colors = this.state.colors?.update({
|
|
570
|
+
scaleType: colorScaleType,
|
|
571
|
+
lowerPercentile,
|
|
572
|
+
upperPercentile
|
|
573
|
+
});
|
|
574
|
+
const elevations = this.state.elevations?.update({
|
|
575
|
+
scaleType: elevationScaleType,
|
|
576
|
+
lowerPercentile: elevationLowerPercentile,
|
|
577
|
+
upperPercentile: elevationUpperPercentile
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
if (!colors || !elevations) {
|
|
581
|
+
return null;
|
|
105
582
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
583
|
+
|
|
584
|
+
return new CellLayerClass(
|
|
585
|
+
this.getSubLayerProps({
|
|
586
|
+
id: 'cells'
|
|
587
|
+
}),
|
|
588
|
+
{
|
|
589
|
+
data: {
|
|
590
|
+
length: aggregator.binCount,
|
|
591
|
+
attributes: {
|
|
592
|
+
getBin: binAttribute,
|
|
593
|
+
getColorValue: colors.attribute,
|
|
594
|
+
getElevationValue: elevations.attribute
|
|
595
|
+
}
|
|
596
|
+
},
|
|
597
|
+
// Data has changed shallowly, but we likely don't need to update the attributes
|
|
598
|
+
dataComparator: (data, oldData) => data.length === oldData.length,
|
|
599
|
+
updateTriggers: {
|
|
600
|
+
getBin: [binAttribute],
|
|
601
|
+
getColorValue: [colors.attribute],
|
|
602
|
+
getElevationValue: [elevations.attribute]
|
|
603
|
+
},
|
|
604
|
+
cellOriginCommon,
|
|
605
|
+
cellSizeCommon,
|
|
606
|
+
elevationScale,
|
|
607
|
+
colorRange,
|
|
608
|
+
colorScaleType,
|
|
609
|
+
elevationRange,
|
|
610
|
+
extruded,
|
|
611
|
+
coverage,
|
|
612
|
+
material,
|
|
613
|
+
colorDomain: colors.domain || colorDomain || aggregator.getResultDomain(0),
|
|
614
|
+
elevationDomain: elevations.domain || elevationDomain || aggregator.getResultDomain(1),
|
|
615
|
+
colorCutoff: colors.cutoff,
|
|
616
|
+
elevationCutoff: elevations.cutoff,
|
|
617
|
+
transitions: transitions && {
|
|
618
|
+
getFillColor: transitions.getColorValue || transitions.getColorWeight,
|
|
619
|
+
getElevation: transitions.getElevationValue || transitions.getElevationWeight
|
|
620
|
+
},
|
|
621
|
+
// Extensions are already handled by the GPUAggregator, do not pass it down
|
|
622
|
+
extensions: []
|
|
623
|
+
}
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
getPickingInfo(params: GetPickingInfoParams): GridLayerPickingInfo<DataT> {
|
|
628
|
+
const info: GridLayerPickingInfo<DataT> = params.info;
|
|
629
|
+
const {index} = info;
|
|
630
|
+
if (index >= 0) {
|
|
631
|
+
const bin = this.state.aggregator.getBin(index);
|
|
632
|
+
let object: GridLayerPickingInfo<DataT>['object'];
|
|
633
|
+
if (bin) {
|
|
634
|
+
object = {
|
|
635
|
+
col: bin.id[0],
|
|
636
|
+
row: bin.id[1],
|
|
637
|
+
colorValue: bin.value[0],
|
|
638
|
+
elevationValue: bin.value[1],
|
|
639
|
+
count: bin.count
|
|
640
|
+
};
|
|
641
|
+
if (bin.pointIndices) {
|
|
642
|
+
object.pointIndices = bin.pointIndices;
|
|
643
|
+
object.points = Array.isArray(this.props.data)
|
|
644
|
+
? bin.pointIndices.map(i => (this.props.data as DataT[])[i])
|
|
645
|
+
: [];
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
info.object = object;
|
|
109
649
|
}
|
|
110
|
-
|
|
650
|
+
|
|
651
|
+
return info;
|
|
111
652
|
}
|
|
112
653
|
}
|