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