@deck.gl/aggregation-layers 9.0.34 → 9.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/aggregation-layer.d.ts +30 -0
- package/dist/common/aggregation-layer.d.ts.map +1 -0
- package/dist/common/aggregation-layer.js +69 -0
- package/dist/common/aggregator/aggregator.d.ts +76 -0
- package/dist/common/aggregator/aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/aggregator.js +4 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts +27 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.js +66 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts +70 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js +139 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts +15 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.js +43 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts +21 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js +55 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts +18 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +20 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts +14 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +17 -0
- package/dist/common/aggregator/gpu-aggregator/utils.d.ts +6 -0
- package/dist/common/aggregator/gpu-aggregator/utils.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/utils.js +24 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts +24 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +215 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts +81 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js +201 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts +38 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +223 -0
- package/dist/common/aggregator/index.d.ts +6 -0
- package/dist/common/aggregator/index.d.ts.map +1 -0
- package/dist/common/aggregator/index.js +5 -0
- package/dist/common/types.d.ts +11 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/common/types.js +4 -0
- package/dist/common/utils/bounds-utils.d.ts +10 -0
- package/dist/common/utils/bounds-utils.d.ts.map +1 -0
- package/dist/common/utils/bounds-utils.js +20 -0
- package/dist/common/utils/color-utils.d.ts +10 -0
- package/dist/common/utils/color-utils.d.ts.map +1 -0
- package/dist/common/utils/color-utils.js +65 -0
- package/dist/common/utils/prop-utils.d.ts.map +1 -0
- package/dist/common/utils/prop-utils.js +12 -0
- package/dist/common/utils/scale-utils.d.ts +46 -0
- package/dist/common/utils/scale-utils.d.ts.map +1 -0
- package/dist/common/utils/scale-utils.js +180 -0
- package/dist/contour-layer/bin-options-uniforms.d.ts +13 -0
- package/dist/contour-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/contour-layer/bin-options-uniforms.js +17 -0
- package/dist/contour-layer/contour-layer.d.ts +42 -50
- package/dist/contour-layer/contour-layer.d.ts.map +1 -1
- package/dist/contour-layer/contour-layer.js +232 -192
- package/dist/contour-layer/contour-utils.d.ts +36 -15
- package/dist/contour-layer/contour-utils.d.ts.map +1 -1
- package/dist/contour-layer/contour-utils.js +24 -29
- package/dist/contour-layer/marching-squares-codes.d.ts.map +1 -1
- package/dist/contour-layer/marching-squares-codes.js +3 -0
- package/dist/contour-layer/marching-squares.d.ts +22 -6
- package/dist/contour-layer/marching-squares.d.ts.map +1 -1
- package/dist/contour-layer/marching-squares.js +71 -68
- package/dist/contour-layer/value-reader.d.ts +10 -0
- package/dist/contour-layer/value-reader.d.ts.map +1 -0
- package/dist/contour-layer/value-reader.js +46 -0
- package/dist/dist.dev.js +4842 -4081
- package/dist/grid-layer/bin-options-uniforms.d.ts +13 -0
- package/dist/grid-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/grid-layer/bin-options-uniforms.js +17 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts +3 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts.map +1 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.js +51 -0
- package/dist/grid-layer/grid-cell-layer.d.ts +32 -0
- package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -0
- package/dist/grid-layer/grid-cell-layer.js +93 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts +21 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts.map +1 -0
- package/dist/grid-layer/grid-layer-uniforms.js +23 -0
- package/dist/grid-layer/grid-layer.d.ts +175 -13
- package/dist/grid-layer/grid-layer.d.ts.map +1 -1
- package/dist/grid-layer/grid-layer.js +342 -46
- package/dist/{aggregation-layer.d.ts → heatmap-layer/aggregation-layer.d.ts} +1 -0
- package/dist/heatmap-layer/aggregation-layer.d.ts.map +1 -0
- package/dist/{aggregation-layer.js → heatmap-layer/aggregation-layer.js} +6 -21
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +30 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.js +32 -0
- package/dist/heatmap-layer/heatmap-layer-utils.d.ts +1 -1
- package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer-utils.js +3 -0
- package/dist/heatmap-layer/heatmap-layer.d.ts +6 -4
- package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer.js +43 -33
- package/dist/heatmap-layer/max-fs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/max-fs.glsl.js +3 -0
- package/dist/heatmap-layer/max-vs.glsl.d.ts +1 -1
- package/dist/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/max-vs.glsl.js +6 -4
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +5 -23
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +22 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.js +22 -0
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts +1 -1
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +10 -30
- package/dist/heatmap-layer/triangle-layer.d.ts +4 -10
- package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer.js +17 -30
- package/dist/heatmap-layer/weights-fs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/weights-fs.glsl.js +3 -0
- package/dist/heatmap-layer/weights-vs.glsl.d.ts +1 -1
- package/dist/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/weights-vs.glsl.js +6 -7
- package/dist/hexagon-layer/bin-options-uniforms.d.ts +14 -0
- package/dist/hexagon-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/hexagon-layer/bin-options-uniforms.js +17 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts +3 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js +55 -0
- package/dist/hexagon-layer/hexagon-cell-layer.d.ts +29 -0
- package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer.js +94 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +19 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.js +21 -0
- package/dist/hexagon-layer/hexagon-layer.d.ts +84 -54
- package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
- package/dist/hexagon-layer/hexagon-layer.js +307 -123
- package/dist/hexagon-layer/hexbin.d.ts +17 -0
- package/dist/hexagon-layer/hexbin.d.ts.map +1 -0
- package/dist/hexagon-layer/hexbin.js +69 -0
- package/dist/index.cjs +3025 -2946
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +7 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -27
- package/dist/screen-grid-layer/bin-options-uniforms.d.ts +11 -0
- package/dist/screen-grid-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/screen-grid-layer/bin-options-uniforms.js +15 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +11 -16
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-cell-layer.js +52 -134
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +4 -24
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +17 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +19 -0
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +21 -62
- package/dist/screen-grid-layer/screen-grid-layer.d.ts +33 -40
- package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer.js +157 -174
- package/dist.min.js +401 -382
- package/package.json +10 -9
- package/src/common/aggregation-layer.ts +107 -0
- package/src/common/aggregator/aggregator.ts +88 -0
- package/src/common/aggregator/cpu-aggregator/aggregate.ts +101 -0
- package/src/common/aggregator/cpu-aggregator/cpu-aggregator.ts +203 -0
- package/src/common/aggregator/cpu-aggregator/sort-bins.ts +63 -0
- package/src/common/aggregator/cpu-aggregator/vertex-accessor.ts +86 -0
- package/src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts +33 -0
- package/src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts +27 -0
- package/src/common/aggregator/gpu-aggregator/utils.ts +27 -0
- package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +247 -0
- package/src/common/aggregator/gpu-aggregator/webgl-aggregator.ts +274 -0
- package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +258 -0
- package/src/common/aggregator/index.ts +10 -0
- package/src/{types.ts → common/types.ts} +10 -4
- package/src/common/utils/bounds-utils.ts +34 -0
- package/src/common/utils/color-utils.ts +86 -0
- package/src/common/utils/prop-utils.ts +13 -0
- package/src/common/utils/scale-utils.ts +236 -0
- package/src/contour-layer/bin-options-uniforms.ts +26 -0
- package/src/contour-layer/contour-layer.ts +300 -265
- package/src/contour-layer/contour-utils.ts +68 -39
- package/src/contour-layer/marching-squares-codes.ts +4 -0
- package/src/contour-layer/marching-squares.ts +93 -82
- package/src/contour-layer/value-reader.ts +65 -0
- package/src/grid-layer/bin-options-uniforms.ts +26 -0
- package/src/grid-layer/grid-cell-layer-vertex.glsl.ts +68 -0
- package/src/grid-layer/grid-cell-layer.ts +141 -0
- package/src/grid-layer/grid-layer-uniforms.ts +37 -0
- package/src/grid-layer/grid-layer.ts +614 -73
- package/src/{aggregation-layer.ts → heatmap-layer/aggregation-layer.ts} +6 -21
- package/src/heatmap-layer/heatmap-layer-uniforms.ts +50 -0
- package/src/heatmap-layer/heatmap-layer-utils.ts +9 -1
- package/src/heatmap-layer/heatmap-layer.ts +59 -36
- package/src/heatmap-layer/max-fs.glsl.ts +4 -0
- package/src/heatmap-layer/max-vs.glsl.ts +7 -4
- package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +5 -23
- package/src/heatmap-layer/triangle-layer-uniforms.ts +37 -0
- package/src/heatmap-layer/triangle-layer-vertex.glsl.ts +10 -30
- package/src/heatmap-layer/triangle-layer.ts +26 -31
- package/src/heatmap-layer/weights-fs.glsl.ts +4 -0
- package/src/heatmap-layer/weights-vs.glsl.ts +7 -7
- package/src/hexagon-layer/bin-options-uniforms.ts +27 -0
- package/src/hexagon-layer/hexagon-cell-layer-vertex.glsl.ts +73 -0
- package/src/hexagon-layer/hexagon-cell-layer.ts +141 -0
- package/src/hexagon-layer/hexagon-layer-uniforms.ts +34 -0
- package/src/hexagon-layer/hexagon-layer.ts +454 -186
- package/src/hexagon-layer/hexbin.ts +79 -0
- package/src/index.ts +21 -34
- package/src/screen-grid-layer/bin-options-uniforms.ts +23 -0
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +71 -156
- package/src/screen-grid-layer/screen-grid-layer-fragment.glsl.ts +4 -24
- package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +31 -0
- package/src/screen-grid-layer/screen-grid-layer-vertex.glsl.ts +21 -64
- package/src/screen-grid-layer/screen-grid-layer.ts +194 -222
- package/dist/aggregation-layer.d.ts.map +0 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts +0 -158
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.js +0 -130
- package/dist/cpu-grid-layer/grid-aggregator.d.ts +0 -35
- package/dist/cpu-grid-layer/grid-aggregator.d.ts.map +0 -1
- package/dist/cpu-grid-layer/grid-aggregator.js +0 -141
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -3
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -30
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -3
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -112
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts +0 -48
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +0 -146
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +0 -99
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-layer.js +0 -289
- package/dist/grid-aggregation-layer.d.ts +0 -67
- package/dist/grid-aggregation-layer.d.ts.map +0 -1
- package/dist/grid-aggregation-layer.js +0 -173
- package/dist/hexagon-layer/hexagon-aggregator.d.ts +0 -27
- package/dist/hexagon-layer/hexagon-aggregator.d.ts.map +0 -1
- package/dist/hexagon-layer/hexagon-aggregator.js +0 -112
- package/dist/types.d.ts +0 -12
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/utils/aggregation-operation-utils.d.ts +0 -19
- package/dist/utils/aggregation-operation-utils.d.ts.map +0 -1
- package/dist/utils/aggregation-operation-utils.js +0 -94
- package/dist/utils/bin-sorter.d.ts +0 -52
- package/dist/utils/bin-sorter.d.ts.map +0 -1
- package/dist/utils/bin-sorter.js +0 -167
- package/dist/utils/color-utils.d.ts +0 -3
- package/dist/utils/color-utils.d.ts.map +0 -1
- package/dist/utils/color-utils.js +0 -53
- package/dist/utils/cpu-aggregator.d.ts +0 -169
- package/dist/utils/cpu-aggregator.d.ts.map +0 -1
- package/dist/utils/cpu-aggregator.js +0 -421
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -36
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -42
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -30
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -61
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -38
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -41
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -76
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -555
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -32
- package/dist/utils/grid-aggregation-utils.d.ts +0 -30
- package/dist/utils/grid-aggregation-utils.d.ts.map +0 -1
- package/dist/utils/grid-aggregation-utils.js +0 -114
- package/dist/utils/prop-utils.d.ts.map +0 -1
- package/dist/utils/prop-utils.js +0 -28
- package/dist/utils/resource-utils.d.ts +0 -14
- package/dist/utils/resource-utils.d.ts.map +0 -1
- package/dist/utils/resource-utils.js +0 -38
- package/dist/utils/scale-utils.d.ts +0 -15
- package/dist/utils/scale-utils.d.ts.map +0 -1
- package/dist/utils/scale-utils.js +0 -184
- package/src/cpu-grid-layer/cpu-grid-layer.ts +0 -329
- package/src/cpu-grid-layer/grid-aggregator.ts +0 -184
- package/src/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.ts +0 -35
- package/src/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.ts +0 -143
- package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +0 -201
- package/src/gpu-grid-layer/gpu-grid-layer.ts +0 -455
- package/src/grid-aggregation-layer.ts +0 -243
- package/src/hexagon-layer/hexagon-aggregator.ts +0 -127
- package/src/utils/aggregation-operation-utils.ts +0 -118
- package/src/utils/bin-sorter.ts +0 -218
- package/src/utils/color-utils.ts +0 -57
- package/src/utils/cpu-aggregator.ts +0 -503
- package/src/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.ts +0 -40
- package/src/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.ts +0 -54
- package/src/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.ts +0 -35
- package/src/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.ts +0 -79
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.ts +0 -46
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.ts +0 -0
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +0 -690
- package/src/utils/gpu-grid-aggregation/transform-mean-vs.glsl.ts +0 -38
- package/src/utils/grid-aggregation-utils.ts +0 -147
- package/src/utils/prop-utils.ts +0 -29
- package/src/utils/resource-utils.ts +0 -53
- package/src/utils/scale-utils.js +0 -219
- /package/dist/{utils → common/utils}/prop-utils.d.ts +0 -0
|
@@ -1,18 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { Color } from '@deck.gl/core';
|
|
2
|
+
export type Contour = {
|
|
3
|
+
/**
|
|
4
|
+
* Isolines: `threshold` value must be a single `Number`, Isolines are generated based on this threshold value.
|
|
5
|
+
*
|
|
6
|
+
* 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.
|
|
7
|
+
*/
|
|
8
|
+
threshold: number | number[];
|
|
9
|
+
/**
|
|
10
|
+
* RGBA color array to be used to render the contour.
|
|
11
|
+
* @default [255, 255, 255, 255]
|
|
12
|
+
*/
|
|
13
|
+
color?: Color;
|
|
14
|
+
/**
|
|
15
|
+
* Applicable for `Isoline`s only, width of the Isoline in pixels.
|
|
16
|
+
* @default 1
|
|
17
|
+
*/
|
|
18
|
+
strokeWidth?: number;
|
|
19
|
+
/** Defines z order of the contour. */
|
|
20
|
+
zIndex?: number;
|
|
21
|
+
};
|
|
22
|
+
export type ContourLine = {
|
|
23
|
+
vertices: number[][];
|
|
24
|
+
contour: Contour;
|
|
25
|
+
};
|
|
26
|
+
export type ContourPolygon = {
|
|
27
|
+
vertices: number[][];
|
|
28
|
+
contour: Contour;
|
|
29
|
+
};
|
|
30
|
+
export declare function generateContours({ contours, getValue, xRange, yRange }: {
|
|
31
|
+
contours: Contour[];
|
|
32
|
+
getValue: (x: number, y: number) => number;
|
|
33
|
+
xRange: [number, number];
|
|
34
|
+
yRange: [number, number];
|
|
7
35
|
}): {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
end: number[];
|
|
11
|
-
contour: any;
|
|
12
|
-
}[];
|
|
13
|
-
contourPolygons: {
|
|
14
|
-
vertices: number[][];
|
|
15
|
-
contour: any;
|
|
16
|
-
}[];
|
|
36
|
+
lines: ContourLine[];
|
|
37
|
+
polygons: ContourPolygon[];
|
|
17
38
|
};
|
|
18
39
|
//# sourceMappingURL=contour-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contour-utils.d.ts","sourceRoot":"","sources":["../../src/contour-layer/contour-utils.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"contour-utils.d.ts","sourceRoot":"","sources":["../../src/contour-layer/contour-utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAGzC,MAAM,MAAM,OAAO,GAAG;IACpB;;;;OAIG;IACH,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE7B;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAIF,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACP,EAAE;IACD,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1B;;;EAmDA"}
|
|
@@ -1,42 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { getCode, getLines, getPolygons } from "./marching-squares.js";
|
|
2
5
|
// Given all the cell weights, generates contours for each threshold.
|
|
3
6
|
/* eslint-disable max-depth */
|
|
4
|
-
export function generateContours({
|
|
5
|
-
const
|
|
7
|
+
export function generateContours({ contours, getValue, xRange, yRange }) {
|
|
8
|
+
const contourLines = [];
|
|
6
9
|
const contourPolygons = [];
|
|
7
|
-
const width = gridSize[0];
|
|
8
|
-
const height = gridSize[1];
|
|
9
10
|
let segmentIndex = 0;
|
|
10
11
|
let polygonIndex = 0;
|
|
11
|
-
for (
|
|
12
|
-
const
|
|
12
|
+
for (let i = 0; i < contours.length; i++) {
|
|
13
|
+
const contour = contours[i];
|
|
14
|
+
const z = contour.zIndex ?? i;
|
|
13
15
|
const { threshold } = contour;
|
|
14
|
-
for (let x = -1; x <
|
|
15
|
-
for (let y = -1; y <
|
|
16
|
+
for (let x = xRange[0] - 1; x < xRange[1]; x++) {
|
|
17
|
+
for (let y = yRange[0] - 1; y < yRange[1]; y++) {
|
|
16
18
|
// Get the MarchingSquares code based on neighbor cell weights.
|
|
17
19
|
const { code, meanCode } = getCode({
|
|
18
|
-
|
|
20
|
+
getValue,
|
|
19
21
|
threshold,
|
|
20
22
|
x,
|
|
21
23
|
y,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
xRange,
|
|
25
|
+
yRange
|
|
24
26
|
});
|
|
25
27
|
const opts = {
|
|
26
|
-
type: CONTOUR_TYPE.ISO_BANDS,
|
|
27
|
-
gridOrigin,
|
|
28
|
-
cellSize,
|
|
29
28
|
x,
|
|
30
29
|
y,
|
|
31
|
-
|
|
32
|
-
height,
|
|
30
|
+
z,
|
|
33
31
|
code,
|
|
34
|
-
meanCode
|
|
35
|
-
thresholdData: data
|
|
32
|
+
meanCode
|
|
36
33
|
};
|
|
37
34
|
if (Array.isArray(threshold)) {
|
|
38
|
-
|
|
39
|
-
const polygons =
|
|
35
|
+
// ISO bands
|
|
36
|
+
const polygons = getPolygons(opts);
|
|
40
37
|
for (const polygon of polygons) {
|
|
41
38
|
contourPolygons[polygonIndex++] = {
|
|
42
39
|
vertices: polygon,
|
|
@@ -45,13 +42,11 @@ export function generateContours({ thresholdData, cellWeights, gridSize, gridOri
|
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
44
|
else {
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
start: vertices[i],
|
|
54
|
-
end: vertices[i + 1],
|
|
45
|
+
// ISO lines
|
|
46
|
+
const path = getLines(opts);
|
|
47
|
+
if (path.length > 0) {
|
|
48
|
+
contourLines[segmentIndex++] = {
|
|
49
|
+
vertices: path,
|
|
55
50
|
contour
|
|
56
51
|
};
|
|
57
52
|
}
|
|
@@ -59,6 +54,6 @@ export function generateContours({ thresholdData, cellWeights, gridSize, gridOri
|
|
|
59
54
|
}
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
|
-
return {
|
|
57
|
+
return { lines: contourLines, polygons: contourPolygons };
|
|
63
58
|
}
|
|
64
59
|
/* eslint-enable max-depth */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marching-squares-codes.d.ts","sourceRoot":"","sources":["../../src/contour-layer/marching-squares-codes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"marching-squares-codes.d.ts","sourceRoot":"","sources":["../../src/contour-layer/marching-squares-codes.ts"],"names":[],"mappings":"AA0JA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;CAyCpC,CAAC;AAMF,eAAO,MAAM,wBAAwB;;;;;;CAqKpC,CAAC"}
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export declare function getCode(opts: {
|
|
2
|
+
getValue: (x: number, y: number) => number;
|
|
3
|
+
threshold: number | number[];
|
|
4
|
+
x: number;
|
|
5
|
+
xRange: [number, number];
|
|
6
|
+
y: number;
|
|
7
|
+
yRange: [number, number];
|
|
8
|
+
}): {
|
|
6
9
|
code: number;
|
|
7
10
|
meanCode: number;
|
|
8
11
|
};
|
|
9
|
-
export declare function
|
|
12
|
+
export declare function getPolygons(opts: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
z: number;
|
|
16
|
+
code: number;
|
|
17
|
+
meanCode: number;
|
|
18
|
+
}): number[][][];
|
|
19
|
+
export declare function getLines(opts: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
z: number;
|
|
23
|
+
code: number;
|
|
24
|
+
meanCode: number;
|
|
25
|
+
}): number[][];
|
|
10
26
|
//# sourceMappingURL=marching-squares.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marching-squares.d.ts","sourceRoot":"","sources":["../../src/contour-layer/marching-squares.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"marching-squares.d.ts","sourceRoot":"","sources":["../../src/contour-layer/marching-squares.ts"],"names":[],"mappings":"AA6BA,wBAAgB,OAAO,CAAC,IAAI,EAAE;IAC5B,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1B,GAAG;IACF,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAuEA;AAKD,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAChC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,gBAgCA;AAID,wBAAgB,QAAQ,CAAC,IAAI,EAAE;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,cA0B/F"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
// All utility methods needed to implement Marching Squares algorithm
|
|
2
5
|
// Ref: https://en.wikipedia.org/wiki/Marching_squares
|
|
3
|
-
import { log } from '@deck.gl/core';
|
|
4
6
|
import { ISOLINES_CODE_OFFSET_MAP, ISOBANDS_CODE_OFFSET_MAP } from "./marching-squares-codes.js";
|
|
5
|
-
export const CONTOUR_TYPE = {
|
|
6
|
-
ISO_LINES: 1,
|
|
7
|
-
ISO_BANDS: 2
|
|
8
|
-
};
|
|
9
|
-
const DEFAULT_THRESHOLD_DATA = {
|
|
10
|
-
zIndex: 0,
|
|
11
|
-
zOffset: 0.005
|
|
12
|
-
};
|
|
13
7
|
// Utility methods
|
|
14
8
|
function getVertexCode(weight, threshold) {
|
|
15
9
|
// threshold must be a single value or a range (array of size 2)
|
|
10
|
+
if (Number.isNaN(weight)) {
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
16
13
|
// Iso-bands
|
|
17
14
|
if (Array.isArray(threshold)) {
|
|
18
15
|
if (weight < threshold[0]) {
|
|
@@ -30,52 +27,53 @@ export function getCode(opts) {
|
|
|
30
27
|
// Origin is on bottom-left , and X increase to right, Y to top
|
|
31
28
|
// When processing one cell, we process 4 cells, by extending row to top and on column to right
|
|
32
29
|
// to create a 2X2 cell grid
|
|
33
|
-
const {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
const isLeftBoundary = x < 0;
|
|
40
|
-
const isRightBoundary = x >= width - 1;
|
|
41
|
-
const isBottomBoundary = y < 0;
|
|
42
|
-
const isTopBoundary = y >= height - 1;
|
|
30
|
+
const { x, y, xRange, yRange, getValue, threshold } = opts;
|
|
31
|
+
const isLeftBoundary = x < xRange[0];
|
|
32
|
+
const isRightBoundary = x >= xRange[1] - 1;
|
|
33
|
+
const isBottomBoundary = y < yRange[0];
|
|
34
|
+
const isTopBoundary = y >= yRange[1] - 1;
|
|
43
35
|
const isBoundary = isLeftBoundary || isRightBoundary || isBottomBoundary || isTopBoundary;
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
let weights = 0;
|
|
37
|
+
let current;
|
|
38
|
+
let right;
|
|
39
|
+
let top;
|
|
40
|
+
let topRight;
|
|
46
41
|
// TOP
|
|
47
42
|
if (isLeftBoundary || isTopBoundary) {
|
|
48
|
-
|
|
43
|
+
top = 0;
|
|
49
44
|
}
|
|
50
45
|
else {
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
const w = getValue(x, y + 1);
|
|
47
|
+
top = getVertexCode(w, threshold);
|
|
48
|
+
weights += w;
|
|
53
49
|
}
|
|
54
50
|
// TOP-RIGHT
|
|
55
51
|
if (isRightBoundary || isTopBoundary) {
|
|
56
|
-
|
|
52
|
+
topRight = 0;
|
|
57
53
|
}
|
|
58
54
|
else {
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
const w = getValue(x + 1, y + 1);
|
|
56
|
+
topRight = getVertexCode(w, threshold);
|
|
57
|
+
weights += w;
|
|
61
58
|
}
|
|
62
59
|
// RIGHT
|
|
63
60
|
if (isRightBoundary || isBottomBoundary) {
|
|
64
|
-
|
|
61
|
+
right = 0;
|
|
65
62
|
}
|
|
66
63
|
else {
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
const w = getValue(x + 1, y);
|
|
65
|
+
right = getVertexCode(w, threshold);
|
|
66
|
+
weights += w;
|
|
69
67
|
}
|
|
70
68
|
// CURRENT
|
|
71
69
|
if (isLeftBoundary || isBottomBoundary) {
|
|
72
|
-
|
|
70
|
+
current = 0;
|
|
73
71
|
}
|
|
74
72
|
else {
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
const w = getValue(x, y);
|
|
74
|
+
current = getVertexCode(w, threshold);
|
|
75
|
+
weights += w;
|
|
77
76
|
}
|
|
78
|
-
const { top, topRight, right, current } = codes;
|
|
79
77
|
let code = -1;
|
|
80
78
|
if (Number.isFinite(threshold)) {
|
|
81
79
|
code = (top << 3) | (topRight << 2) | (right << 1) | current;
|
|
@@ -88,59 +86,64 @@ export function getCode(opts) {
|
|
|
88
86
|
// only occur when we are not processing a cell on boundary
|
|
89
87
|
// because when on a boundary either, bottom-row, top-row, left-column or right-column will have both 0 codes
|
|
90
88
|
if (!isBoundary) {
|
|
91
|
-
meanCode = getVertexCode(
|
|
89
|
+
meanCode = getVertexCode(weights / 4, threshold);
|
|
92
90
|
}
|
|
93
91
|
return { code, meanCode };
|
|
94
92
|
}
|
|
95
93
|
/* eslint-enable complexity, max-statements*/
|
|
96
94
|
// Returns intersection vertices for given cellindex
|
|
97
95
|
// [x, y] refers current marching cell, reference vertex is always top-right corner
|
|
98
|
-
export function
|
|
99
|
-
const {
|
|
100
|
-
|
|
101
|
-
let offsets = type === CONTOUR_TYPE.ISO_BANDS
|
|
102
|
-
? ISOBANDS_CODE_OFFSET_MAP[code]
|
|
103
|
-
: ISOLINES_CODE_OFFSET_MAP[code];
|
|
96
|
+
export function getPolygons(opts) {
|
|
97
|
+
const { x, y, z, code, meanCode } = opts;
|
|
98
|
+
let offsets = ISOBANDS_CODE_OFFSET_MAP[code];
|
|
104
99
|
// handle saddle cases
|
|
105
100
|
if (!Array.isArray(offsets)) {
|
|
106
101
|
offsets = offsets[meanCode];
|
|
107
102
|
}
|
|
108
103
|
// Reference vertex is at top-right move to top-right corner
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
const rY = (y + 1) * cellSize[1];
|
|
112
|
-
const refVertexX = gridOrigin[0] + rX;
|
|
113
|
-
const refVertexY = gridOrigin[1] + rY;
|
|
104
|
+
const rX = x + 1;
|
|
105
|
+
const rY = y + 1;
|
|
114
106
|
// offsets format
|
|
115
|
-
//
|
|
116
|
-
// ISO_BANDS: [[1A, 1B, 1C, ...], [2A, 2B, 2C, ...]],
|
|
107
|
+
// [[1A, 1B, 1C, ...], [2A, 2B, 2C, ...]],
|
|
117
108
|
// vertices format
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
// [
|
|
121
|
-
// [[x1A, y1A], [x1B, y1B], [x1C, y1C] ... ],
|
|
109
|
+
// [
|
|
110
|
+
// [[x1A, y1A], [x1B, y1B], [x1C, y1C] ... ],
|
|
122
111
|
// ...
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
polygon.push([vX, vY, vZ]);
|
|
132
|
-
});
|
|
133
|
-
polygons.push(polygon);
|
|
112
|
+
// ]
|
|
113
|
+
const polygons = [];
|
|
114
|
+
offsets.forEach(polygonOffsets => {
|
|
115
|
+
const polygon = [];
|
|
116
|
+
polygonOffsets.forEach(xyOffset => {
|
|
117
|
+
const vX = rX + xyOffset[0];
|
|
118
|
+
const vY = rY + xyOffset[1];
|
|
119
|
+
polygon.push([vX, vY, z]);
|
|
134
120
|
});
|
|
135
|
-
|
|
121
|
+
polygons.push(polygon);
|
|
122
|
+
});
|
|
123
|
+
return polygons;
|
|
124
|
+
}
|
|
125
|
+
// Returns intersection vertices for given cellindex
|
|
126
|
+
// [x, y] refers current marching cell, reference vertex is always top-right corner
|
|
127
|
+
export function getLines(opts) {
|
|
128
|
+
const { x, y, z, code, meanCode } = opts;
|
|
129
|
+
let offsets = ISOLINES_CODE_OFFSET_MAP[code];
|
|
130
|
+
// handle saddle cases
|
|
131
|
+
if (!Array.isArray(offsets)) {
|
|
132
|
+
offsets = offsets[meanCode];
|
|
136
133
|
}
|
|
137
|
-
//
|
|
134
|
+
// Reference vertex is at top-right move to top-right corner
|
|
135
|
+
const rX = x + 1;
|
|
136
|
+
const rY = y + 1;
|
|
137
|
+
// offsets format
|
|
138
|
+
// [[1A, 1B], [2A, 2B]],
|
|
139
|
+
// vertices format
|
|
140
|
+
// [[x1A, y1A], [x1B, y1B], [x2A, x2B], ...],
|
|
138
141
|
const lines = [];
|
|
139
142
|
offsets.forEach(xyOffsets => {
|
|
140
143
|
xyOffsets.forEach(offset => {
|
|
141
|
-
const vX =
|
|
142
|
-
const vY =
|
|
143
|
-
lines.push([vX, vY,
|
|
144
|
+
const vX = rX + offset[0];
|
|
145
|
+
const vY = rY + offset[1];
|
|
146
|
+
lines.push([vX, vY, z]);
|
|
144
147
|
});
|
|
145
148
|
});
|
|
146
149
|
return lines;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Aggregator } from "../common/aggregator/index.js";
|
|
2
|
+
type ValueReader = (x: number, y: number) => number;
|
|
3
|
+
/** Returns an accessor to the aggregated values from bin id */
|
|
4
|
+
export declare function getAggregatorValueReader(opts: {
|
|
5
|
+
aggregator: Aggregator;
|
|
6
|
+
binIdRange: [number, number][];
|
|
7
|
+
channel: 0 | 1 | 2;
|
|
8
|
+
}): ValueReader | null;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=value-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-reader.d.ts","sourceRoot":"","sources":["../../src/contour-layer/value-reader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAiC,sCAAmC;AAGtF,KAAK,WAAW,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAEpD,+DAA+D;AAC/D,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAC/B,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACpB,GAAG,WAAW,GAAG,IAAI,CAkBrB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { CPUAggregator, WebGLAggregator } from "../common/aggregator/index.js";
|
|
5
|
+
/** Returns an accessor to the aggregated values from bin id */
|
|
6
|
+
export function getAggregatorValueReader(opts) {
|
|
7
|
+
const { aggregator, binIdRange, channel } = opts;
|
|
8
|
+
if (aggregator instanceof WebGLAggregator) {
|
|
9
|
+
const buffer = aggregator.getResult(channel)?.buffer;
|
|
10
|
+
if (buffer) {
|
|
11
|
+
const values = new Float32Array(buffer.readSyncWebGL().buffer);
|
|
12
|
+
return getWebGLAggregatorValueReader(values, binIdRange);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
if (aggregator instanceof CPUAggregator) {
|
|
16
|
+
const values = aggregator.getResult(channel)?.value;
|
|
17
|
+
const ids = aggregator.getBins()?.value;
|
|
18
|
+
if (ids && values) {
|
|
19
|
+
return getCPUAggregatorValueReader(values, ids, aggregator.binCount);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function getWebGLAggregatorValueReader(values, binIdRange) {
|
|
25
|
+
const [[minX, maxX], [minY, maxY]] = binIdRange;
|
|
26
|
+
const width = maxX - minX;
|
|
27
|
+
const height = maxY - minY;
|
|
28
|
+
return (x, y) => {
|
|
29
|
+
x -= minX;
|
|
30
|
+
y -= minY;
|
|
31
|
+
if (x < 0 || x >= width || y < 0 || y >= height) {
|
|
32
|
+
return NaN;
|
|
33
|
+
}
|
|
34
|
+
return values[y * width + x];
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function getCPUAggregatorValueReader(values, ids, count) {
|
|
38
|
+
const idMap = {};
|
|
39
|
+
for (let i = 0; i < count; i++) {
|
|
40
|
+
const x = ids[i * 2];
|
|
41
|
+
const y = ids[i * 2 + 1];
|
|
42
|
+
idMap[x] = idMap[x] || {};
|
|
43
|
+
idMap[x][y] = values[i];
|
|
44
|
+
}
|
|
45
|
+
return (x, y) => idMap[x]?.[y] ?? NaN;
|
|
46
|
+
}
|