@deck.gl/aggregation-layers 9.0.35 → 9.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/aggregation-layer.d.ts +30 -0
- package/dist/common/aggregation-layer.d.ts.map +1 -0
- package/dist/common/aggregation-layer.js +69 -0
- package/dist/common/aggregator/aggregator.d.ts +76 -0
- package/dist/common/aggregator/aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/aggregator.js +4 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts +27 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.js +66 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts +70 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js +139 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts +15 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.js +43 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts +21 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js +55 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts +18 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +20 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts +14 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +17 -0
- package/dist/common/aggregator/gpu-aggregator/utils.d.ts +6 -0
- package/dist/common/aggregator/gpu-aggregator/utils.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/utils.js +24 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts +24 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +215 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts +81 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js +201 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts +38 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +223 -0
- package/dist/common/aggregator/index.d.ts +6 -0
- package/dist/common/aggregator/index.d.ts.map +1 -0
- package/dist/common/aggregator/index.js +5 -0
- package/dist/common/types.d.ts +11 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/common/types.js +4 -0
- package/dist/common/utils/bounds-utils.d.ts +10 -0
- package/dist/common/utils/bounds-utils.d.ts.map +1 -0
- package/dist/common/utils/bounds-utils.js +20 -0
- package/dist/common/utils/color-utils.d.ts +10 -0
- package/dist/common/utils/color-utils.d.ts.map +1 -0
- package/dist/common/utils/color-utils.js +65 -0
- package/dist/common/utils/prop-utils.d.ts.map +1 -0
- package/dist/common/utils/prop-utils.js +12 -0
- package/dist/common/utils/scale-utils.d.ts +46 -0
- package/dist/common/utils/scale-utils.d.ts.map +1 -0
- package/dist/common/utils/scale-utils.js +180 -0
- package/dist/contour-layer/bin-options-uniforms.d.ts +13 -0
- package/dist/contour-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/contour-layer/bin-options-uniforms.js +17 -0
- package/dist/contour-layer/contour-layer.d.ts +42 -50
- package/dist/contour-layer/contour-layer.d.ts.map +1 -1
- package/dist/contour-layer/contour-layer.js +232 -192
- package/dist/contour-layer/contour-utils.d.ts +36 -15
- package/dist/contour-layer/contour-utils.d.ts.map +1 -1
- package/dist/contour-layer/contour-utils.js +24 -29
- package/dist/contour-layer/marching-squares-codes.d.ts.map +1 -1
- package/dist/contour-layer/marching-squares-codes.js +3 -0
- package/dist/contour-layer/marching-squares.d.ts +22 -6
- package/dist/contour-layer/marching-squares.d.ts.map +1 -1
- package/dist/contour-layer/marching-squares.js +71 -68
- package/dist/contour-layer/value-reader.d.ts +10 -0
- package/dist/contour-layer/value-reader.d.ts.map +1 -0
- package/dist/contour-layer/value-reader.js +46 -0
- package/dist/dist.dev.js +4842 -4081
- package/dist/grid-layer/bin-options-uniforms.d.ts +13 -0
- package/dist/grid-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/grid-layer/bin-options-uniforms.js +17 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts +3 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts.map +1 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.js +51 -0
- package/dist/grid-layer/grid-cell-layer.d.ts +32 -0
- package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -0
- package/dist/grid-layer/grid-cell-layer.js +93 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts +21 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts.map +1 -0
- package/dist/grid-layer/grid-layer-uniforms.js +23 -0
- package/dist/grid-layer/grid-layer.d.ts +175 -13
- package/dist/grid-layer/grid-layer.d.ts.map +1 -1
- package/dist/grid-layer/grid-layer.js +342 -46
- package/dist/{aggregation-layer.d.ts → heatmap-layer/aggregation-layer.d.ts} +1 -0
- package/dist/heatmap-layer/aggregation-layer.d.ts.map +1 -0
- package/dist/{aggregation-layer.js → heatmap-layer/aggregation-layer.js} +6 -21
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +30 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.js +32 -0
- package/dist/heatmap-layer/heatmap-layer-utils.d.ts +1 -1
- package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer-utils.js +3 -0
- package/dist/heatmap-layer/heatmap-layer.d.ts +6 -4
- package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer.js +43 -33
- package/dist/heatmap-layer/max-fs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/max-fs.glsl.js +3 -0
- package/dist/heatmap-layer/max-vs.glsl.d.ts +1 -1
- package/dist/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/max-vs.glsl.js +6 -4
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +5 -23
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +22 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.js +22 -0
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts +1 -1
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +10 -30
- package/dist/heatmap-layer/triangle-layer.d.ts +4 -10
- package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer.js +17 -30
- package/dist/heatmap-layer/weights-fs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/weights-fs.glsl.js +3 -0
- package/dist/heatmap-layer/weights-vs.glsl.d.ts +1 -1
- package/dist/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/weights-vs.glsl.js +6 -7
- package/dist/hexagon-layer/bin-options-uniforms.d.ts +14 -0
- package/dist/hexagon-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/hexagon-layer/bin-options-uniforms.js +17 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts +3 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js +55 -0
- package/dist/hexagon-layer/hexagon-cell-layer.d.ts +29 -0
- package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer.js +94 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +19 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.js +21 -0
- package/dist/hexagon-layer/hexagon-layer.d.ts +84 -54
- package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
- package/dist/hexagon-layer/hexagon-layer.js +307 -123
- package/dist/hexagon-layer/hexbin.d.ts +17 -0
- package/dist/hexagon-layer/hexbin.d.ts.map +1 -0
- package/dist/hexagon-layer/hexbin.js +69 -0
- package/dist/index.cjs +3025 -2946
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +7 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -27
- package/dist/screen-grid-layer/bin-options-uniforms.d.ts +11 -0
- package/dist/screen-grid-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/screen-grid-layer/bin-options-uniforms.js +15 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +11 -16
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-cell-layer.js +52 -134
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +4 -24
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +17 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +19 -0
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +21 -62
- package/dist/screen-grid-layer/screen-grid-layer.d.ts +33 -40
- package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer.js +157 -174
- package/dist.min.js +401 -382
- package/package.json +10 -9
- package/src/common/aggregation-layer.ts +107 -0
- package/src/common/aggregator/aggregator.ts +88 -0
- package/src/common/aggregator/cpu-aggregator/aggregate.ts +101 -0
- package/src/common/aggregator/cpu-aggregator/cpu-aggregator.ts +203 -0
- package/src/common/aggregator/cpu-aggregator/sort-bins.ts +63 -0
- package/src/common/aggregator/cpu-aggregator/vertex-accessor.ts +86 -0
- package/src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts +33 -0
- package/src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts +27 -0
- package/src/common/aggregator/gpu-aggregator/utils.ts +27 -0
- package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +247 -0
- package/src/common/aggregator/gpu-aggregator/webgl-aggregator.ts +274 -0
- package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +258 -0
- package/src/common/aggregator/index.ts +10 -0
- package/src/{types.ts → common/types.ts} +10 -4
- package/src/common/utils/bounds-utils.ts +34 -0
- package/src/common/utils/color-utils.ts +86 -0
- package/src/common/utils/prop-utils.ts +13 -0
- package/src/common/utils/scale-utils.ts +236 -0
- package/src/contour-layer/bin-options-uniforms.ts +26 -0
- package/src/contour-layer/contour-layer.ts +300 -265
- package/src/contour-layer/contour-utils.ts +68 -39
- package/src/contour-layer/marching-squares-codes.ts +4 -0
- package/src/contour-layer/marching-squares.ts +93 -82
- package/src/contour-layer/value-reader.ts +65 -0
- package/src/grid-layer/bin-options-uniforms.ts +26 -0
- package/src/grid-layer/grid-cell-layer-vertex.glsl.ts +68 -0
- package/src/grid-layer/grid-cell-layer.ts +141 -0
- package/src/grid-layer/grid-layer-uniforms.ts +37 -0
- package/src/grid-layer/grid-layer.ts +614 -73
- package/src/{aggregation-layer.ts → heatmap-layer/aggregation-layer.ts} +6 -21
- package/src/heatmap-layer/heatmap-layer-uniforms.ts +50 -0
- package/src/heatmap-layer/heatmap-layer-utils.ts +9 -1
- package/src/heatmap-layer/heatmap-layer.ts +59 -36
- package/src/heatmap-layer/max-fs.glsl.ts +4 -0
- package/src/heatmap-layer/max-vs.glsl.ts +7 -4
- package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +5 -23
- package/src/heatmap-layer/triangle-layer-uniforms.ts +37 -0
- package/src/heatmap-layer/triangle-layer-vertex.glsl.ts +10 -30
- package/src/heatmap-layer/triangle-layer.ts +26 -31
- package/src/heatmap-layer/weights-fs.glsl.ts +4 -0
- package/src/heatmap-layer/weights-vs.glsl.ts +7 -7
- package/src/hexagon-layer/bin-options-uniforms.ts +27 -0
- package/src/hexagon-layer/hexagon-cell-layer-vertex.glsl.ts +73 -0
- package/src/hexagon-layer/hexagon-cell-layer.ts +141 -0
- package/src/hexagon-layer/hexagon-layer-uniforms.ts +34 -0
- package/src/hexagon-layer/hexagon-layer.ts +454 -186
- package/src/hexagon-layer/hexbin.ts +79 -0
- package/src/index.ts +21 -34
- package/src/screen-grid-layer/bin-options-uniforms.ts +23 -0
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +71 -156
- package/src/screen-grid-layer/screen-grid-layer-fragment.glsl.ts +4 -24
- package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +31 -0
- package/src/screen-grid-layer/screen-grid-layer-vertex.glsl.ts +21 -64
- package/src/screen-grid-layer/screen-grid-layer.ts +194 -222
- package/dist/aggregation-layer.d.ts.map +0 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts +0 -158
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.js +0 -130
- package/dist/cpu-grid-layer/grid-aggregator.d.ts +0 -35
- package/dist/cpu-grid-layer/grid-aggregator.d.ts.map +0 -1
- package/dist/cpu-grid-layer/grid-aggregator.js +0 -141
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -3
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -30
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -3
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -112
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts +0 -48
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +0 -146
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +0 -99
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-layer.js +0 -289
- package/dist/grid-aggregation-layer.d.ts +0 -67
- package/dist/grid-aggregation-layer.d.ts.map +0 -1
- package/dist/grid-aggregation-layer.js +0 -173
- package/dist/hexagon-layer/hexagon-aggregator.d.ts +0 -27
- package/dist/hexagon-layer/hexagon-aggregator.d.ts.map +0 -1
- package/dist/hexagon-layer/hexagon-aggregator.js +0 -112
- package/dist/types.d.ts +0 -12
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/utils/aggregation-operation-utils.d.ts +0 -19
- package/dist/utils/aggregation-operation-utils.d.ts.map +0 -1
- package/dist/utils/aggregation-operation-utils.js +0 -94
- package/dist/utils/bin-sorter.d.ts +0 -52
- package/dist/utils/bin-sorter.d.ts.map +0 -1
- package/dist/utils/bin-sorter.js +0 -167
- package/dist/utils/color-utils.d.ts +0 -3
- package/dist/utils/color-utils.d.ts.map +0 -1
- package/dist/utils/color-utils.js +0 -53
- package/dist/utils/cpu-aggregator.d.ts +0 -169
- package/dist/utils/cpu-aggregator.d.ts.map +0 -1
- package/dist/utils/cpu-aggregator.js +0 -421
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -36
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -42
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -30
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -61
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -38
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -41
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -76
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -555
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -32
- package/dist/utils/grid-aggregation-utils.d.ts +0 -30
- package/dist/utils/grid-aggregation-utils.d.ts.map +0 -1
- package/dist/utils/grid-aggregation-utils.js +0 -114
- package/dist/utils/prop-utils.d.ts.map +0 -1
- package/dist/utils/prop-utils.js +0 -28
- package/dist/utils/resource-utils.d.ts +0 -14
- package/dist/utils/resource-utils.d.ts.map +0 -1
- package/dist/utils/resource-utils.js +0 -38
- package/dist/utils/scale-utils.d.ts +0 -15
- package/dist/utils/scale-utils.d.ts.map +0 -1
- package/dist/utils/scale-utils.js +0 -184
- package/src/cpu-grid-layer/cpu-grid-layer.ts +0 -329
- package/src/cpu-grid-layer/grid-aggregator.ts +0 -184
- package/src/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.ts +0 -35
- package/src/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.ts +0 -143
- package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +0 -201
- package/src/gpu-grid-layer/gpu-grid-layer.ts +0 -455
- package/src/grid-aggregation-layer.ts +0 -243
- package/src/hexagon-layer/hexagon-aggregator.ts +0 -127
- package/src/utils/aggregation-operation-utils.ts +0 -118
- package/src/utils/bin-sorter.ts +0 -218
- package/src/utils/color-utils.ts +0 -57
- package/src/utils/cpu-aggregator.ts +0 -503
- package/src/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.ts +0 -40
- package/src/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.ts +0 -54
- package/src/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.ts +0 -35
- package/src/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.ts +0 -79
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.ts +0 -46
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.ts +0 -0
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +0 -690
- package/src/utils/gpu-grid-aggregation/transform-mean-vs.glsl.ts +0 -38
- package/src/utils/grid-aggregation-utils.ts +0 -147
- package/src/utils/prop-utils.ts +0 -29
- package/src/utils/resource-utils.ts +0 -53
- package/src/utils/scale-utils.js +0 -219
- /package/dist/{utils → common/utils}/prop-utils.d.ts +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type BinOptions = {
|
|
2
|
+
cellOriginCommon: [number, number];
|
|
3
|
+
cellSizeCommon: [number, number];
|
|
4
|
+
};
|
|
5
|
+
export declare const binOptionsUniforms: {
|
|
6
|
+
readonly name: "binOptions";
|
|
7
|
+
readonly vs: "uniform binOptionsUniforms {\n vec2 cellOriginCommon;\n vec2 cellSizeCommon;\n} binOptions;\n";
|
|
8
|
+
readonly uniformTypes: {
|
|
9
|
+
readonly cellOriginCommon: "vec2<f32>";
|
|
10
|
+
readonly cellSizeCommon: "vec2<f32>";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=bin-options-uniforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin-options-uniforms.d.ts","sourceRoot":"","sources":["../../src/contour-layer/bin-options-uniforms.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,UAAU,GAAG;IACvB,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;CAOc,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
const uniformBlock = /* glsl */ `\
|
|
5
|
+
uniform binOptionsUniforms {
|
|
6
|
+
vec2 cellOriginCommon;
|
|
7
|
+
vec2 cellSizeCommon;
|
|
8
|
+
} binOptions;
|
|
9
|
+
`;
|
|
10
|
+
export const binOptionsUniforms = {
|
|
11
|
+
name: 'binOptions',
|
|
12
|
+
vs: uniformBlock,
|
|
13
|
+
uniformTypes: {
|
|
14
|
+
cellOriginCommon: 'vec2<f32>',
|
|
15
|
+
cellSizeCommon: 'vec2<f32>'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -1,48 +1,38 @@
|
|
|
1
|
-
import { Accessor,
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Accessor, GetPickingInfoParams, LayersList, PickingInfo, Position, Viewport, UpdateParameters, DefaultProps } from '@deck.gl/core';
|
|
2
|
+
import { WebGLAggregator, CPUAggregator, AggregationOperation } from "../common/aggregator/index.js";
|
|
3
|
+
import AggregationLayer from "../common/aggregation-layer.js";
|
|
4
|
+
import { AggregationLayerProps } from "../common/aggregation-layer.js";
|
|
5
|
+
import { Contour, ContourLine, ContourPolygon } from "./contour-utils.js";
|
|
6
|
+
import { BinOptions } from "./bin-options-uniforms.js";
|
|
7
|
+
/** All properties supported by GridLayer. */
|
|
8
|
+
export type ContourLayerProps<DataT = unknown> = _ContourLayerProps<DataT> & AggregationLayerProps<DataT>;
|
|
9
|
+
/** Properties added by GridLayer. */
|
|
10
|
+
type _ContourLayerProps<DataT> = {
|
|
7
11
|
/**
|
|
8
12
|
* Size of each cell in meters.
|
|
9
13
|
* @default 1000
|
|
10
14
|
*/
|
|
11
15
|
cellSize?: number;
|
|
16
|
+
/**
|
|
17
|
+
* The grid origin
|
|
18
|
+
* @default [0, 0]
|
|
19
|
+
*/
|
|
20
|
+
gridOrigin?: [number, number];
|
|
12
21
|
/**
|
|
13
22
|
* When set to true, aggregation is performed on GPU, provided other conditions are met.
|
|
14
|
-
* @default
|
|
23
|
+
* @default false
|
|
15
24
|
*/
|
|
16
25
|
gpuAggregation?: boolean;
|
|
17
26
|
/**
|
|
18
27
|
* Defines the type of aggregation operation, valid values are 'SUM', 'MEAN', 'MIN' and 'MAX'.
|
|
19
28
|
* @default 'SUM'
|
|
20
29
|
*/
|
|
21
|
-
aggregation?:
|
|
30
|
+
aggregation?: AggregationOperation;
|
|
22
31
|
/**
|
|
23
32
|
* Definition of contours to be drawn.
|
|
24
33
|
* @default [{threshold: 1}]
|
|
25
34
|
*/
|
|
26
|
-
contours
|
|
27
|
-
/**
|
|
28
|
-
* Isolines: `threshold` value must be a single `Number`, Isolines are generated based on this threshold value.
|
|
29
|
-
*
|
|
30
|
-
* Isobands: `threshold` value must be an Array of two `Number`s. Isobands are generated using `[threshold[0], threshold[1])` as threshold range, i.e area that has values `>= threshold[0]` and `< threshold[1]` are rendered with corresponding color. NOTE: `threshold[0]` is inclusive and `threshold[1]` is not inclusive.
|
|
31
|
-
*/
|
|
32
|
-
threshold: number | number[];
|
|
33
|
-
/**
|
|
34
|
-
* RGBA color array to be used to render the contour.
|
|
35
|
-
* @default [255, 255, 255, 255]
|
|
36
|
-
*/
|
|
37
|
-
color?: Color;
|
|
38
|
-
/**
|
|
39
|
-
* Applicable for `Isoline`s only, width of the Isoline in pixels.
|
|
40
|
-
* @default 1
|
|
41
|
-
*/
|
|
42
|
-
strokeWidth?: number;
|
|
43
|
-
/** Defines z order of the contour. */
|
|
44
|
-
zIndex?: number;
|
|
45
|
-
}[];
|
|
35
|
+
contours?: Contour[];
|
|
46
36
|
/**
|
|
47
37
|
* A very small z offset that is added for each vertex of a contour (Isoline or Isoband).
|
|
48
38
|
* @default 0.005
|
|
@@ -52,38 +42,40 @@ export type _ContourLayerProps<DataT> = {
|
|
|
52
42
|
* Method called to retrieve the position of each object.
|
|
53
43
|
* @default object => object.position
|
|
54
44
|
*/
|
|
55
|
-
getPosition?:
|
|
45
|
+
getPosition?: Accessor<DataT, Position>;
|
|
56
46
|
/**
|
|
57
47
|
* The weight of each object.
|
|
58
48
|
* @default 1
|
|
59
49
|
*/
|
|
60
50
|
getWeight?: Accessor<DataT, number>;
|
|
61
51
|
};
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
export type ContourLayerPickingInfo = PickingInfo<{
|
|
53
|
+
contour: Contour;
|
|
54
|
+
}>;
|
|
55
|
+
/** Aggregate data into a grid-based heatmap. The color and height of a cell are determined based on the objects it contains. */
|
|
56
|
+
export default class GridLayer<DataT = any, ExtraPropsT extends {} = {}> extends AggregationLayer<DataT, ExtraPropsT & Required<_ContourLayerProps<DataT>>> {
|
|
64
57
|
static layerName: string;
|
|
65
58
|
static defaultProps: DefaultProps<ContourLayerProps<unknown>>;
|
|
66
|
-
state:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
contour: any;
|
|
72
|
-
}[];
|
|
73
|
-
contourPolygons: {
|
|
74
|
-
vertices: number[][];
|
|
75
|
-
contour: any;
|
|
76
|
-
}[];
|
|
59
|
+
state: AggregationLayer<DataT>['state'] & BinOptions & {
|
|
60
|
+
aggregatedValueReader?: (x: number, y: number) => number;
|
|
61
|
+
contourData?: {
|
|
62
|
+
lines: ContourLine[];
|
|
63
|
+
polygons: ContourPolygon[];
|
|
77
64
|
};
|
|
78
|
-
|
|
65
|
+
binIdRange: [number, number][];
|
|
66
|
+
aggregatorViewport: Viewport;
|
|
79
67
|
};
|
|
68
|
+
getAggregatorType(): string;
|
|
69
|
+
createAggregator(type: string): WebGLAggregator | CPUAggregator;
|
|
80
70
|
initializeState(): void;
|
|
81
|
-
updateState(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
private
|
|
85
|
-
private
|
|
86
|
-
|
|
87
|
-
|
|
71
|
+
updateState(params: UpdateParameters<this>): boolean;
|
|
72
|
+
private _updateBinOptions;
|
|
73
|
+
draw(opts: any): void;
|
|
74
|
+
private _onAggregationUpdate;
|
|
75
|
+
private _getContours;
|
|
76
|
+
onAttributeChange(id: string): void;
|
|
77
|
+
renderLayers(): LayersList | null;
|
|
78
|
+
getPickingInfo(params: GetPickingInfoParams): ContourLayerPickingInfo;
|
|
88
79
|
}
|
|
80
|
+
export {};
|
|
89
81
|
//# sourceMappingURL=contour-layer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contour-layer.d.ts","sourceRoot":"","sources":["../../src/contour-layer/contour-layer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contour-layer.d.ts","sourceRoot":"","sources":["../../src/contour-layer/contour-layer.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,QAAQ,EAER,oBAAoB,EAEpB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,QAAQ,EAER,gBAAgB,EAChB,YAAY,EACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,eAAe,EAAE,aAAa,EAAE,oBAAoB,EAAC,sCAAmC;AAChG,OAAO,gBAAgB,uCAAoC;AAC3D,OAAO,EAAC,qBAAqB,EAAC,uCAAoC;AAClE,OAAO,EAAmB,OAAO,EAAE,WAAW,EAAE,cAAc,EAAC,2BAAwB;AAIvF,OAAO,EAAC,UAAU,EAAqB,kCAA+B;AAyBtE,6CAA6C;AAC7C,MAAM,MAAM,iBAAiB,CAAC,KAAK,GAAG,OAAO,IAAI,kBAAkB,CAAC,KAAK,CAAC,GACxE,qBAAqB,CAAC,KAAK,CAAC,CAAC;AAE/B,qCAAqC;AACrC,KAAK,kBAAkB,CAAC,KAAK,IAAI;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;IAEnC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,WAAW,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAExC;;;OAGG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC;IAChD,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC,CAAC;AAEH,gIAAgI;AAChI,MAAM,CAAC,OAAO,OAAO,SAAS,CAAC,KAAK,GAAG,GAAG,EAAE,WAAW,SAAS,EAAE,GAAG,EAAE,CAAE,SAAQ,gBAAgB,CAC/F,KAAK,EACL,WAAW,GAAG,QAAQ,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAClD;IACC,MAAM,CAAC,SAAS,SAAkB;IAClC,MAAM,CAAC,YAAY,2CAAgB;IAEnC,KAAK,EAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GACtC,UAAU,GAAG;QAEX,qBAAqB,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;QACzD,WAAW,CAAC,EAAE;YACZ,KAAK,EAAE,WAAW,EAAE,CAAC;YACrB,QAAQ,EAAE,cAAc,EAAE,CAAC;SAC5B,CAAC;QAEF,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;QAC/B,kBAAkB,EAAE,QAAQ,CAAC;KAC9B,CAAC;IAEJ,iBAAiB,IAAI,MAAM;IAM3B,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,aAAa;IA8C/D,eAAe;IAef,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAmC1C,OAAO,CAAC,iBAAiB;IAsDhB,IAAI,CAAC,IAAI,KAAA;IAQlB,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,YAAY;IAwBpB,iBAAiB,CAAC,EAAE,EAAE,MAAM;IA2B5B,YAAY,IAAI,UAAU,GAAG,IAAI;IAsDjC,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,uBAAuB;CAWtE"}
|
|
@@ -1,241 +1,281 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
import { LineLayer, SolidPolygonLayer } from '@deck.gl/layers';
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { COORDINATE_SYSTEM, project32, Viewport, _deepEqual } from '@deck.gl/core';
|
|
5
|
+
import { PathLayer, SolidPolygonLayer } from '@deck.gl/layers';
|
|
6
|
+
import { WebGLAggregator, CPUAggregator } from "../common/aggregator/index.js";
|
|
7
|
+
import AggregationLayer from "../common/aggregation-layer.js";
|
|
21
8
|
import { generateContours } from "./contour-utils.js";
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import GridAggregationLayer from "../grid-aggregation-layer.js";
|
|
9
|
+
import { getAggregatorValueReader } from "./value-reader.js";
|
|
10
|
+
import { getBinIdRange } from "../common/utils/bounds-utils.js";
|
|
11
|
+
import { Matrix4 } from '@math.gl/core';
|
|
12
|
+
import { binOptionsUniforms } from "./bin-options-uniforms.js";
|
|
27
13
|
const DEFAULT_COLOR = [255, 255, 255, 255];
|
|
28
14
|
const DEFAULT_STROKE_WIDTH = 1;
|
|
29
|
-
const DEFAULT_THRESHOLD = 1;
|
|
30
15
|
const defaultProps = {
|
|
31
16
|
// grid aggregation
|
|
32
|
-
cellSize: { type: 'number', min: 1,
|
|
17
|
+
cellSize: { type: 'number', min: 1, value: 1000 },
|
|
18
|
+
gridOrigin: { type: 'array', compare: true, value: [0, 0] },
|
|
33
19
|
getPosition: { type: 'accessor', value: (x) => x.position },
|
|
34
20
|
getWeight: { type: 'accessor', value: 1 },
|
|
35
|
-
gpuAggregation:
|
|
21
|
+
gpuAggregation: true,
|
|
36
22
|
aggregation: 'SUM',
|
|
37
23
|
// contour lines
|
|
38
24
|
contours: {
|
|
39
25
|
type: 'object',
|
|
40
|
-
value: [{ threshold:
|
|
26
|
+
value: [{ threshold: 1 }],
|
|
41
27
|
optional: true,
|
|
42
28
|
compare: 3
|
|
43
29
|
},
|
|
44
30
|
zOffset: 0.005
|
|
45
31
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
props
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
props: ['aggregation'],
|
|
53
|
-
accessors: ['getWeight']
|
|
32
|
+
/** Aggregate data into a grid-based heatmap. The color and height of a cell are determined based on the objects it contains. */
|
|
33
|
+
class GridLayer extends AggregationLayer {
|
|
34
|
+
getAggregatorType() {
|
|
35
|
+
return this.props.gpuAggregation && WebGLAggregator.isSupported(this.context.device)
|
|
36
|
+
? 'gpu'
|
|
37
|
+
: 'cpu';
|
|
54
38
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
39
|
+
createAggregator(type) {
|
|
40
|
+
if (type === 'cpu') {
|
|
41
|
+
return new CPUAggregator({
|
|
42
|
+
dimensions: 2,
|
|
43
|
+
getBin: {
|
|
44
|
+
sources: ['positions'],
|
|
45
|
+
getValue: ({ positions }, index, opts) => {
|
|
46
|
+
const viewport = this.state.aggregatorViewport;
|
|
47
|
+
// project to common space
|
|
48
|
+
const p = viewport.projectPosition(positions);
|
|
49
|
+
const { cellSizeCommon, cellOriginCommon } = opts;
|
|
50
|
+
return [
|
|
51
|
+
Math.floor((p[0] - cellOriginCommon[0]) / cellSizeCommon[0]),
|
|
52
|
+
Math.floor((p[1] - cellOriginCommon[1]) / cellSizeCommon[1])
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
getValue: [{ sources: ['counts'], getValue: ({ counts }) => counts }],
|
|
57
|
+
onUpdate: this._onAggregationUpdate.bind(this)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return new WebGLAggregator(this.context.device, {
|
|
61
|
+
dimensions: 2,
|
|
62
|
+
channelCount: 1,
|
|
63
|
+
bufferLayout: this.getAttributeManager().getBufferLayouts({ isInstanced: false }),
|
|
64
|
+
...super.getShaders({
|
|
65
|
+
modules: [project32, binOptionsUniforms],
|
|
66
|
+
vs: /* glsl */ `
|
|
67
|
+
in vec3 positions;
|
|
68
|
+
in vec3 positions64Low;
|
|
69
|
+
in float counts;
|
|
70
|
+
|
|
71
|
+
void getBin(out ivec2 binId) {
|
|
72
|
+
vec3 positionCommon = project_position(positions, positions64Low);
|
|
73
|
+
vec2 gridCoords = floor(positionCommon.xy / binOptions.cellSizeCommon);
|
|
74
|
+
binId = ivec2(gridCoords);
|
|
75
|
+
}
|
|
76
|
+
void getValue(out float value) {
|
|
77
|
+
value = counts;
|
|
78
|
+
}
|
|
79
|
+
`
|
|
80
|
+
}),
|
|
81
|
+
onUpdate: this._onAggregationUpdate.bind(this)
|
|
71
82
|
});
|
|
83
|
+
}
|
|
84
|
+
initializeState() {
|
|
85
|
+
super.initializeState();
|
|
72
86
|
const attributeManager = this.getAttributeManager();
|
|
73
87
|
attributeManager.add({
|
|
74
|
-
|
|
88
|
+
positions: {
|
|
75
89
|
size: 3,
|
|
76
90
|
accessor: 'getPosition',
|
|
77
91
|
type: 'float64',
|
|
78
92
|
fp64: this.use64bitPositions()
|
|
79
93
|
},
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
counts: { size: 1, accessor: 'getWeight' }
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
updateState(params) {
|
|
98
|
+
const aggregatorChanged = super.updateState(params);
|
|
99
|
+
const { props, oldProps, changeFlags } = params;
|
|
100
|
+
const { aggregator } = this.state;
|
|
101
|
+
if (aggregatorChanged ||
|
|
102
|
+
changeFlags.dataChanged ||
|
|
103
|
+
props.cellSize !== oldProps.cellSize ||
|
|
104
|
+
!_deepEqual(props.gridOrigin, oldProps.gridOrigin, 1) ||
|
|
105
|
+
props.aggregation !== oldProps.aggregation) {
|
|
106
|
+
this._updateBinOptions();
|
|
107
|
+
const { cellSizeCommon, cellOriginCommon, binIdRange } = this.state;
|
|
108
|
+
aggregator.setProps({
|
|
109
|
+
// @ts-expect-error only used by GPUAggregator
|
|
110
|
+
binIdRange,
|
|
111
|
+
pointCount: this.getNumInstances(),
|
|
112
|
+
operations: [props.aggregation],
|
|
113
|
+
binOptions: {
|
|
114
|
+
cellSizeCommon,
|
|
115
|
+
cellOriginCommon
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
if (!_deepEqual(oldProps.contours, props.contours, 2)) {
|
|
120
|
+
// Recalculate contours
|
|
121
|
+
this.setState({ contourData: null });
|
|
122
|
+
}
|
|
123
|
+
return aggregatorChanged;
|
|
124
|
+
}
|
|
125
|
+
_updateBinOptions() {
|
|
126
|
+
const bounds = this.getBounds();
|
|
127
|
+
const cellSizeCommon = [1, 1];
|
|
128
|
+
let cellOriginCommon = [0, 0];
|
|
129
|
+
let binIdRange = [
|
|
130
|
+
[0, 1],
|
|
131
|
+
[0, 1]
|
|
132
|
+
];
|
|
133
|
+
let viewport = this.context.viewport;
|
|
134
|
+
if (bounds && Number.isFinite(bounds[0][0])) {
|
|
135
|
+
let centroid = [(bounds[0][0] + bounds[1][0]) / 2, (bounds[0][1] + bounds[1][1]) / 2];
|
|
136
|
+
const { cellSize, gridOrigin } = this.props;
|
|
137
|
+
const { unitsPerMeter } = viewport.getDistanceScales(centroid);
|
|
138
|
+
cellSizeCommon[0] = unitsPerMeter[0] * cellSize;
|
|
139
|
+
cellSizeCommon[1] = unitsPerMeter[1] * cellSize;
|
|
140
|
+
// Offset common space to center at the origin of the grid cell where the data center is in
|
|
141
|
+
// This improves precision without affecting the cell positions
|
|
142
|
+
const centroidCommon = viewport.projectFlat(centroid);
|
|
143
|
+
cellOriginCommon = [
|
|
144
|
+
Math.floor((centroidCommon[0] - gridOrigin[0]) / cellSizeCommon[0]) * cellSizeCommon[0] +
|
|
145
|
+
gridOrigin[0],
|
|
146
|
+
Math.floor((centroidCommon[1] - gridOrigin[1]) / cellSizeCommon[1]) * cellSizeCommon[1] +
|
|
147
|
+
gridOrigin[1]
|
|
148
|
+
];
|
|
149
|
+
centroid = viewport.unprojectFlat(cellOriginCommon);
|
|
150
|
+
const ViewportType = viewport.constructor;
|
|
151
|
+
// We construct a viewport for the GPU aggregator's project module
|
|
152
|
+
// This viewport is determined by data
|
|
153
|
+
// removes arbitrary precision variance that depends on initial view state
|
|
154
|
+
viewport = viewport.isGeospatial
|
|
155
|
+
? new ViewportType({ longitude: centroid[0], latitude: centroid[1], zoom: 12 })
|
|
156
|
+
: new Viewport({ position: [centroid[0], centroid[1], 0], zoom: 12 });
|
|
157
|
+
// Round to the nearest 32-bit float to match CPU and GPU results
|
|
158
|
+
cellOriginCommon = [Math.fround(viewport.center[0]), Math.fround(viewport.center[1])];
|
|
159
|
+
binIdRange = getBinIdRange({
|
|
160
|
+
dataBounds: bounds,
|
|
161
|
+
getBinId: (p) => {
|
|
162
|
+
const positionCommon = viewport.projectFlat(p);
|
|
163
|
+
return [
|
|
164
|
+
Math.floor((positionCommon[0] - cellOriginCommon[0]) / cellSizeCommon[0]),
|
|
165
|
+
Math.floor((positionCommon[1] - cellOriginCommon[1]) / cellSizeCommon[1])
|
|
166
|
+
];
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
this.setState({ cellSizeCommon, cellOriginCommon, binIdRange, aggregatorViewport: viewport });
|
|
171
|
+
}
|
|
172
|
+
draw(opts) {
|
|
173
|
+
// Replaces render time viewport with our own
|
|
174
|
+
if (opts.shaderModuleProps.project) {
|
|
175
|
+
opts.shaderModuleProps.project.viewport = this.state.aggregatorViewport;
|
|
176
|
+
}
|
|
177
|
+
super.draw(opts);
|
|
178
|
+
}
|
|
179
|
+
_onAggregationUpdate() {
|
|
180
|
+
const { aggregator, binIdRange } = this.state;
|
|
181
|
+
this.setState({
|
|
182
|
+
aggregatedValueReader: getAggregatorValueReader({ aggregator, binIdRange, channel: 0 }),
|
|
183
|
+
contourData: null
|
|
82
184
|
});
|
|
83
185
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const { aggregationDirty } = this.state;
|
|
89
|
-
if (oldProps.contours !== props.contours || oldProps.zOffset !== props.zOffset) {
|
|
90
|
-
contoursChanged = true;
|
|
91
|
-
this._updateThresholdData(opts.props);
|
|
186
|
+
_getContours() {
|
|
187
|
+
const { aggregatedValueReader } = this.state;
|
|
188
|
+
if (!aggregatedValueReader) {
|
|
189
|
+
return null;
|
|
92
190
|
}
|
|
93
|
-
if (this.
|
|
94
|
-
this.
|
|
191
|
+
if (!this.state.contourData) {
|
|
192
|
+
const { binIdRange } = this.state;
|
|
193
|
+
const { contours } = this.props;
|
|
194
|
+
const contourData = generateContours({
|
|
195
|
+
contours,
|
|
196
|
+
getValue: aggregatedValueReader,
|
|
197
|
+
xRange: binIdRange[0],
|
|
198
|
+
yRange: binIdRange[1]
|
|
199
|
+
});
|
|
200
|
+
this.state.contourData = contourData;
|
|
201
|
+
}
|
|
202
|
+
return this.state.contourData;
|
|
203
|
+
}
|
|
204
|
+
onAttributeChange(id) {
|
|
205
|
+
const { aggregator } = this.state;
|
|
206
|
+
switch (id) {
|
|
207
|
+
case 'positions':
|
|
208
|
+
aggregator.setNeedsUpdate();
|
|
209
|
+
this._updateBinOptions();
|
|
210
|
+
const { cellSizeCommon, cellOriginCommon, binIdRange } = this.state;
|
|
211
|
+
aggregator.setProps({
|
|
212
|
+
// @ts-expect-error only used by GPUAggregator
|
|
213
|
+
binIdRange,
|
|
214
|
+
binOptions: {
|
|
215
|
+
cellSizeCommon,
|
|
216
|
+
cellOriginCommon
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
break;
|
|
220
|
+
case 'counts':
|
|
221
|
+
aggregator.setNeedsUpdate(0);
|
|
222
|
+
break;
|
|
223
|
+
default:
|
|
224
|
+
// This should not happen
|
|
95
225
|
}
|
|
96
226
|
}
|
|
97
227
|
renderLayers() {
|
|
98
|
-
const
|
|
99
|
-
|
|
228
|
+
const contourData = this._getContours();
|
|
229
|
+
if (!contourData) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
const { lines, polygons } = contourData;
|
|
233
|
+
const { zOffset } = this.props;
|
|
234
|
+
const { cellOriginCommon, cellSizeCommon } = this.state;
|
|
235
|
+
const LinesSubLayerClass = this.getSubLayerClass('lines', PathLayer);
|
|
100
236
|
const BandsSubLayerClass = this.getSubLayerClass('bands', SolidPolygonLayer);
|
|
237
|
+
const modelMatrix = new Matrix4()
|
|
238
|
+
.translate([cellOriginCommon[0], cellOriginCommon[1], 0])
|
|
239
|
+
.scale([cellSizeCommon[0], cellSizeCommon[1], zOffset]);
|
|
101
240
|
// Contour lines layer
|
|
102
|
-
const lineLayer =
|
|
103
|
-
|
|
241
|
+
const lineLayer = lines &&
|
|
242
|
+
lines.length > 0 &&
|
|
104
243
|
new LinesSubLayerClass(this.getSubLayerProps({
|
|
105
244
|
id: 'lines'
|
|
106
245
|
}), {
|
|
107
|
-
data:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
246
|
+
data: lines,
|
|
247
|
+
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
248
|
+
modelMatrix,
|
|
249
|
+
getPath: d => d.vertices,
|
|
250
|
+
getColor: d => d.contour.color ?? DEFAULT_COLOR,
|
|
251
|
+
getWidth: d => d.contour.strokeWidth ?? DEFAULT_STROKE_WIDTH,
|
|
252
|
+
widthUnits: 'pixels'
|
|
112
253
|
});
|
|
113
254
|
// Contour bands layer
|
|
114
|
-
const bandsLayer =
|
|
115
|
-
|
|
255
|
+
const bandsLayer = polygons &&
|
|
256
|
+
polygons.length > 0 &&
|
|
116
257
|
new BandsSubLayerClass(this.getSubLayerProps({
|
|
117
258
|
id: 'bands'
|
|
118
259
|
}), {
|
|
119
|
-
data:
|
|
260
|
+
data: polygons,
|
|
261
|
+
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
262
|
+
modelMatrix,
|
|
120
263
|
getPolygon: d => d.vertices,
|
|
121
|
-
getFillColor: d => d.contour.color
|
|
264
|
+
getFillColor: d => d.contour.color ?? DEFAULT_COLOR
|
|
122
265
|
});
|
|
123
266
|
return [lineLayer, bandsLayer];
|
|
124
267
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const cellSizeChanged = oldProps.cellSize !== cellSize;
|
|
132
|
-
let gpuAggregation = props.gpuAggregation;
|
|
133
|
-
if (this.state.gpuAggregation !== props.gpuAggregation) {
|
|
134
|
-
if (gpuAggregation && !GPUGridAggregator.isSupported(this.context.device)) {
|
|
135
|
-
log.warn('GPU Grid Aggregation not supported, falling back to CPU')();
|
|
136
|
-
gpuAggregation = false;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
const gpuAggregationChanged = gpuAggregation !== this.state.gpuAggregation;
|
|
140
|
-
this.setState({
|
|
141
|
-
gpuAggregation
|
|
142
|
-
});
|
|
143
|
-
const { dimensions } = this.state;
|
|
144
|
-
const positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
|
|
145
|
-
const { data, weights } = dimensions;
|
|
146
|
-
let { boundingBox } = this.state;
|
|
147
|
-
if (positionsChanged) {
|
|
148
|
-
boundingBox = getBoundingBox(this.getAttributes(), this.getNumInstances());
|
|
149
|
-
this.setState({ boundingBox });
|
|
150
|
-
}
|
|
151
|
-
if (positionsChanged || cellSizeChanged) {
|
|
152
|
-
const { gridOffset, translation, width, height, numCol, numRow } = getGridParams(boundingBox, cellSize, viewport, coordinateSystem);
|
|
153
|
-
this.allocateResources(numRow, numCol);
|
|
154
|
-
this.setState({
|
|
155
|
-
gridOffset,
|
|
156
|
-
boundingBox,
|
|
157
|
-
translation,
|
|
158
|
-
posOffset: translation.slice(), // Used for CPU aggregation, to offset points
|
|
159
|
-
gridOrigin: [-1 * translation[0], -1 * translation[1]],
|
|
160
|
-
width,
|
|
161
|
-
height,
|
|
162
|
-
numCol,
|
|
163
|
-
numRow
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
const aggregationDataDirty = positionsChanged ||
|
|
167
|
-
gpuAggregationChanged ||
|
|
168
|
-
this.isAggregationDirty(opts, {
|
|
169
|
-
dimension: data,
|
|
170
|
-
compareAll: gpuAggregation // check for all (including extentions props) when using gpu aggregation
|
|
171
|
-
});
|
|
172
|
-
const aggregationWeightsDirty = this.isAggregationDirty(opts, {
|
|
173
|
-
dimension: weights
|
|
174
|
-
});
|
|
175
|
-
if (aggregationWeightsDirty) {
|
|
176
|
-
this._updateAccessors(opts);
|
|
177
|
-
}
|
|
178
|
-
if (aggregationDataDirty || aggregationWeightsDirty) {
|
|
179
|
-
this._resetResults();
|
|
180
|
-
}
|
|
181
|
-
this.setState({
|
|
182
|
-
aggregationDataDirty,
|
|
183
|
-
aggregationWeightsDirty
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
/* eslint-enable max-statements, complexity */
|
|
187
|
-
// Private (Aggregation)
|
|
188
|
-
_updateAccessors(opts) {
|
|
189
|
-
const { getWeight, aggregation, data } = opts.props;
|
|
190
|
-
const { count } = this.state.weights;
|
|
191
|
-
if (count) {
|
|
192
|
-
count.getWeight = getWeight;
|
|
193
|
-
count.operation = AGGREGATION_OPERATION[aggregation];
|
|
194
|
-
}
|
|
195
|
-
this.setState({ getValue: getValueFunc(aggregation, getWeight, { data }) });
|
|
196
|
-
}
|
|
197
|
-
_resetResults() {
|
|
198
|
-
const { count } = this.state.weights;
|
|
199
|
-
if (count) {
|
|
200
|
-
count.aggregationData = null;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
// Private (Contours)
|
|
204
|
-
_generateContours() {
|
|
205
|
-
const { numCol, numRow, gridOrigin, gridOffset, thresholdData } = this.state;
|
|
206
|
-
const { count } = this.state.weights;
|
|
207
|
-
let { aggregationData } = count;
|
|
208
|
-
if (!aggregationData) {
|
|
209
|
-
// @ts-ignore
|
|
210
|
-
aggregationData = count.aggregationBuffer.readSyncWebGL();
|
|
211
|
-
count.aggregationData = aggregationData;
|
|
212
|
-
}
|
|
213
|
-
const { cellWeights } = GPUGridAggregator.getCellData({ countsData: aggregationData });
|
|
214
|
-
const contourData = generateContours({
|
|
215
|
-
thresholdData,
|
|
216
|
-
cellWeights,
|
|
217
|
-
gridSize: [numCol, numRow],
|
|
218
|
-
gridOrigin,
|
|
219
|
-
cellSize: [gridOffset.xOffset, gridOffset.yOffset]
|
|
220
|
-
});
|
|
221
|
-
// contourData contains both iso-lines and iso-bands if requested.
|
|
222
|
-
this.setState({ contourData });
|
|
223
|
-
}
|
|
224
|
-
_updateThresholdData(props) {
|
|
225
|
-
const { contours, zOffset } = props;
|
|
226
|
-
const count = contours.length;
|
|
227
|
-
const thresholdData = new Array(count);
|
|
228
|
-
for (let i = 0; i < count; i++) {
|
|
229
|
-
const contour = contours[i];
|
|
230
|
-
thresholdData[i] = {
|
|
231
|
-
contour,
|
|
232
|
-
zIndex: contour.zIndex || i,
|
|
233
|
-
zOffset
|
|
268
|
+
getPickingInfo(params) {
|
|
269
|
+
const info = params.info;
|
|
270
|
+
const { object } = info;
|
|
271
|
+
if (object) {
|
|
272
|
+
info.object = {
|
|
273
|
+
contour: object.contour
|
|
234
274
|
};
|
|
235
275
|
}
|
|
236
|
-
|
|
276
|
+
return info;
|
|
237
277
|
}
|
|
238
278
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
export default
|
|
279
|
+
GridLayer.layerName = 'ContourLayer';
|
|
280
|
+
GridLayer.defaultProps = defaultProps;
|
|
281
|
+
export default GridLayer;
|