@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,57 +1,46 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
|
|
21
|
-
import {LineLayer, SolidPolygonLayer} from '@deck.gl/layers';
|
|
22
|
-
import {generateContours} from './contour-utils';
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
23
5
|
import {
|
|
24
6
|
Accessor,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
COORDINATE_SYSTEM,
|
|
8
|
+
GetPickingInfoParams,
|
|
9
|
+
project32,
|
|
10
|
+
LayersList,
|
|
11
|
+
PickingInfo,
|
|
28
12
|
Position,
|
|
13
|
+
Viewport,
|
|
14
|
+
_deepEqual,
|
|
29
15
|
UpdateParameters,
|
|
30
|
-
DefaultProps
|
|
31
|
-
LayersList
|
|
16
|
+
DefaultProps
|
|
32
17
|
} from '@deck.gl/core';
|
|
33
|
-
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import {
|
|
37
|
-
import
|
|
18
|
+
import {PathLayer, SolidPolygonLayer} from '@deck.gl/layers';
|
|
19
|
+
import {WebGLAggregator, CPUAggregator, AggregationOperation} from '../common/aggregator/index';
|
|
20
|
+
import AggregationLayer from '../common/aggregation-layer';
|
|
21
|
+
import {AggregationLayerProps} from '../common/aggregation-layer';
|
|
22
|
+
import {generateContours, Contour, ContourLine, ContourPolygon} from './contour-utils';
|
|
23
|
+
import {getAggregatorValueReader} from './value-reader';
|
|
24
|
+
import {getBinIdRange} from '../common/utils/bounds-utils';
|
|
25
|
+
import {Matrix4} from '@math.gl/core';
|
|
26
|
+
import {BinOptions, binOptionsUniforms} from './bin-options-uniforms';
|
|
38
27
|
|
|
39
28
|
const DEFAULT_COLOR = [255, 255, 255, 255];
|
|
40
29
|
const DEFAULT_STROKE_WIDTH = 1;
|
|
41
|
-
const DEFAULT_THRESHOLD = 1;
|
|
42
30
|
|
|
43
31
|
const defaultProps: DefaultProps<ContourLayerProps> = {
|
|
44
32
|
// grid aggregation
|
|
45
|
-
cellSize: {type: 'number', min: 1,
|
|
33
|
+
cellSize: {type: 'number', min: 1, value: 1000},
|
|
34
|
+
gridOrigin: {type: 'array', compare: true, value: [0, 0]},
|
|
46
35
|
getPosition: {type: 'accessor', value: (x: any) => x.position},
|
|
47
36
|
getWeight: {type: 'accessor', value: 1},
|
|
48
|
-
gpuAggregation:
|
|
37
|
+
gpuAggregation: true,
|
|
49
38
|
aggregation: 'SUM',
|
|
50
39
|
|
|
51
40
|
// contour lines
|
|
52
41
|
contours: {
|
|
53
42
|
type: 'object',
|
|
54
|
-
value: [{threshold:
|
|
43
|
+
value: [{threshold: 1}],
|
|
55
44
|
optional: true,
|
|
56
45
|
compare: 3
|
|
57
46
|
},
|
|
@@ -59,33 +48,27 @@ const defaultProps: DefaultProps<ContourLayerProps> = {
|
|
|
59
48
|
zOffset: 0.005
|
|
60
49
|
};
|
|
61
50
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const DIMENSIONS = {
|
|
65
|
-
data: {
|
|
66
|
-
props: ['cellSize']
|
|
67
|
-
},
|
|
68
|
-
weights: {
|
|
69
|
-
props: ['aggregation'],
|
|
70
|
-
accessors: ['getWeight']
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/** All properties supported by ContourLayer. */
|
|
51
|
+
/** All properties supported by GridLayer. */
|
|
75
52
|
export type ContourLayerProps<DataT = unknown> = _ContourLayerProps<DataT> &
|
|
76
|
-
|
|
53
|
+
AggregationLayerProps<DataT>;
|
|
77
54
|
|
|
78
|
-
/** Properties added by
|
|
79
|
-
|
|
55
|
+
/** Properties added by GridLayer. */
|
|
56
|
+
type _ContourLayerProps<DataT> = {
|
|
80
57
|
/**
|
|
81
58
|
* Size of each cell in meters.
|
|
82
59
|
* @default 1000
|
|
83
60
|
*/
|
|
84
61
|
cellSize?: number;
|
|
85
62
|
|
|
63
|
+
/**
|
|
64
|
+
* The grid origin
|
|
65
|
+
* @default [0, 0]
|
|
66
|
+
*/
|
|
67
|
+
gridOrigin?: [number, number];
|
|
68
|
+
|
|
86
69
|
/**
|
|
87
70
|
* When set to true, aggregation is performed on GPU, provided other conditions are met.
|
|
88
|
-
* @default
|
|
71
|
+
* @default false
|
|
89
72
|
*/
|
|
90
73
|
gpuAggregation?: boolean;
|
|
91
74
|
|
|
@@ -93,35 +76,13 @@ export type _ContourLayerProps<DataT> = {
|
|
|
93
76
|
* Defines the type of aggregation operation, valid values are 'SUM', 'MEAN', 'MIN' and 'MAX'.
|
|
94
77
|
* @default 'SUM'
|
|
95
78
|
*/
|
|
96
|
-
aggregation?:
|
|
79
|
+
aggregation?: AggregationOperation;
|
|
97
80
|
|
|
98
81
|
/**
|
|
99
82
|
* Definition of contours to be drawn.
|
|
100
83
|
* @default [{threshold: 1}]
|
|
101
84
|
*/
|
|
102
|
-
contours
|
|
103
|
-
/**
|
|
104
|
-
* Isolines: `threshold` value must be a single `Number`, Isolines are generated based on this threshold value.
|
|
105
|
-
*
|
|
106
|
-
* 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.
|
|
107
|
-
*/
|
|
108
|
-
threshold: number | number[];
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* RGBA color array to be used to render the contour.
|
|
112
|
-
* @default [255, 255, 255, 255]
|
|
113
|
-
*/
|
|
114
|
-
color?: Color;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Applicable for `Isoline`s only, width of the Isoline in pixels.
|
|
118
|
-
* @default 1
|
|
119
|
-
*/
|
|
120
|
-
strokeWidth?: number;
|
|
121
|
-
|
|
122
|
-
/** Defines z order of the contour. */
|
|
123
|
-
zIndex?: number;
|
|
124
|
-
}[];
|
|
85
|
+
contours?: Contour[];
|
|
125
86
|
|
|
126
87
|
/**
|
|
127
88
|
* A very small z offset that is added for each vertex of a contour (Isoline or Isoband).
|
|
@@ -133,7 +94,7 @@ export type _ContourLayerProps<DataT> = {
|
|
|
133
94
|
* Method called to retrieve the position of each object.
|
|
134
95
|
* @default object => object.position
|
|
135
96
|
*/
|
|
136
|
-
getPosition?:
|
|
97
|
+
getPosition?: Accessor<DataT, Position>;
|
|
137
98
|
|
|
138
99
|
/**
|
|
139
100
|
* The weight of each object.
|
|
@@ -142,243 +103,317 @@ export type _ContourLayerProps<DataT> = {
|
|
|
142
103
|
getWeight?: Accessor<DataT, number>;
|
|
143
104
|
};
|
|
144
105
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
106
|
+
export type ContourLayerPickingInfo = PickingInfo<{
|
|
107
|
+
contour: Contour;
|
|
108
|
+
}>;
|
|
109
|
+
|
|
110
|
+
/** Aggregate data into a grid-based heatmap. The color and height of a cell are determined based on the objects it contains. */
|
|
111
|
+
export default class GridLayer<DataT = any, ExtraPropsT extends {} = {}> extends AggregationLayer<
|
|
112
|
+
DataT,
|
|
113
|
+
ExtraPropsT & Required<_ContourLayerProps<DataT>>
|
|
114
|
+
> {
|
|
150
115
|
static layerName = 'ContourLayer';
|
|
151
116
|
static defaultProps = defaultProps;
|
|
152
117
|
|
|
153
|
-
state!:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
118
|
+
state!: AggregationLayer<DataT>['state'] &
|
|
119
|
+
BinOptions & {
|
|
120
|
+
// Aggregator result
|
|
121
|
+
aggregatedValueReader?: (x: number, y: number) => number;
|
|
122
|
+
contourData?: {
|
|
123
|
+
lines: ContourLine[];
|
|
124
|
+
polygons: ContourPolygon[];
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
binIdRange: [number, number][];
|
|
128
|
+
aggregatorViewport: Viewport;
|
|
164
129
|
};
|
|
165
|
-
thresholdData: any;
|
|
166
|
-
};
|
|
167
130
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
131
|
+
getAggregatorType(): string {
|
|
132
|
+
return this.props.gpuAggregation && WebGLAggregator.isSupported(this.context.device)
|
|
133
|
+
? 'gpu'
|
|
134
|
+
: 'cpu';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
createAggregator(type: string): WebGLAggregator | CPUAggregator {
|
|
138
|
+
if (type === 'cpu') {
|
|
139
|
+
return new CPUAggregator({
|
|
140
|
+
dimensions: 2,
|
|
141
|
+
getBin: {
|
|
142
|
+
sources: ['positions'],
|
|
143
|
+
getValue: ({positions}: {positions: number[]}, index: number, opts: BinOptions) => {
|
|
144
|
+
const viewport = this.state.aggregatorViewport;
|
|
145
|
+
// project to common space
|
|
146
|
+
const p = viewport.projectPosition(positions);
|
|
147
|
+
const {cellSizeCommon, cellOriginCommon} = opts;
|
|
148
|
+
return [
|
|
149
|
+
Math.floor((p[0] - cellOriginCommon[0]) / cellSizeCommon[0]),
|
|
150
|
+
Math.floor((p[1] - cellOriginCommon[1]) / cellSizeCommon[1])
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
getValue: [{sources: ['counts'], getValue: ({counts}) => counts}],
|
|
155
|
+
onUpdate: this._onAggregationUpdate.bind(this)
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return new WebGLAggregator(this.context.device, {
|
|
159
|
+
dimensions: 2,
|
|
160
|
+
channelCount: 1,
|
|
161
|
+
bufferLayout: this.getAttributeManager()!.getBufferLayouts({isInstanced: false}),
|
|
162
|
+
...super.getShaders({
|
|
163
|
+
modules: [project32, binOptionsUniforms],
|
|
164
|
+
vs: /* glsl */ `
|
|
165
|
+
in vec3 positions;
|
|
166
|
+
in vec3 positions64Low;
|
|
167
|
+
in float counts;
|
|
168
|
+
|
|
169
|
+
void getBin(out ivec2 binId) {
|
|
170
|
+
vec3 positionCommon = project_position(positions, positions64Low);
|
|
171
|
+
vec2 gridCoords = floor(positionCommon.xy / binOptions.cellSizeCommon);
|
|
172
|
+
binId = ivec2(gridCoords);
|
|
173
|
+
}
|
|
174
|
+
void getValue(out float value) {
|
|
175
|
+
value = counts;
|
|
176
|
+
}
|
|
177
|
+
`
|
|
178
|
+
}),
|
|
179
|
+
onUpdate: this._onAggregationUpdate.bind(this)
|
|
181
180
|
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
initializeState() {
|
|
184
|
+
super.initializeState();
|
|
185
|
+
|
|
182
186
|
const attributeManager = this.getAttributeManager()!;
|
|
183
187
|
attributeManager.add({
|
|
184
|
-
|
|
188
|
+
positions: {
|
|
185
189
|
size: 3,
|
|
186
190
|
accessor: 'getPosition',
|
|
187
191
|
type: 'float64',
|
|
188
192
|
fp64: this.use64bitPositions()
|
|
189
193
|
},
|
|
190
|
-
|
|
191
|
-
|
|
194
|
+
counts: {size: 1, accessor: 'getWeight'}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
updateState(params: UpdateParameters<this>) {
|
|
199
|
+
const aggregatorChanged = super.updateState(params);
|
|
200
|
+
|
|
201
|
+
const {props, oldProps, changeFlags} = params;
|
|
202
|
+
const {aggregator} = this.state;
|
|
203
|
+
if (
|
|
204
|
+
aggregatorChanged ||
|
|
205
|
+
changeFlags.dataChanged ||
|
|
206
|
+
props.cellSize !== oldProps.cellSize ||
|
|
207
|
+
!_deepEqual(props.gridOrigin, oldProps.gridOrigin, 1) ||
|
|
208
|
+
props.aggregation !== oldProps.aggregation
|
|
209
|
+
) {
|
|
210
|
+
this._updateBinOptions();
|
|
211
|
+
const {cellSizeCommon, cellOriginCommon, binIdRange} = this.state;
|
|
212
|
+
|
|
213
|
+
aggregator.setProps({
|
|
214
|
+
// @ts-expect-error only used by GPUAggregator
|
|
215
|
+
binIdRange,
|
|
216
|
+
pointCount: this.getNumInstances(),
|
|
217
|
+
operations: [props.aggregation],
|
|
218
|
+
binOptions: {
|
|
219
|
+
cellSizeCommon,
|
|
220
|
+
cellOriginCommon
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (!_deepEqual(oldProps.contours, props.contours, 2)) {
|
|
226
|
+
// Recalculate contours
|
|
227
|
+
this.setState({contourData: null});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return aggregatorChanged;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
private _updateBinOptions() {
|
|
234
|
+
const bounds = this.getBounds();
|
|
235
|
+
const cellSizeCommon: [number, number] = [1, 1];
|
|
236
|
+
let cellOriginCommon: [number, number] = [0, 0];
|
|
237
|
+
let binIdRange: [number, number][] = [
|
|
238
|
+
[0, 1],
|
|
239
|
+
[0, 1]
|
|
240
|
+
];
|
|
241
|
+
let viewport = this.context.viewport;
|
|
242
|
+
|
|
243
|
+
if (bounds && Number.isFinite(bounds[0][0])) {
|
|
244
|
+
let centroid = [(bounds[0][0] + bounds[1][0]) / 2, (bounds[0][1] + bounds[1][1]) / 2];
|
|
245
|
+
const {cellSize, gridOrigin} = this.props;
|
|
246
|
+
const {unitsPerMeter} = viewport.getDistanceScales(centroid);
|
|
247
|
+
cellSizeCommon[0] = unitsPerMeter[0] * cellSize;
|
|
248
|
+
cellSizeCommon[1] = unitsPerMeter[1] * cellSize;
|
|
249
|
+
|
|
250
|
+
// Offset common space to center at the origin of the grid cell where the data center is in
|
|
251
|
+
// This improves precision without affecting the cell positions
|
|
252
|
+
const centroidCommon = viewport.projectFlat(centroid);
|
|
253
|
+
cellOriginCommon = [
|
|
254
|
+
Math.floor((centroidCommon[0] - gridOrigin[0]) / cellSizeCommon[0]) * cellSizeCommon[0] +
|
|
255
|
+
gridOrigin[0],
|
|
256
|
+
Math.floor((centroidCommon[1] - gridOrigin[1]) / cellSizeCommon[1]) * cellSizeCommon[1] +
|
|
257
|
+
gridOrigin[1]
|
|
258
|
+
];
|
|
259
|
+
centroid = viewport.unprojectFlat(cellOriginCommon);
|
|
260
|
+
|
|
261
|
+
const ViewportType = viewport.constructor as any;
|
|
262
|
+
// We construct a viewport for the GPU aggregator's project module
|
|
263
|
+
// This viewport is determined by data
|
|
264
|
+
// removes arbitrary precision variance that depends on initial view state
|
|
265
|
+
viewport = viewport.isGeospatial
|
|
266
|
+
? new ViewportType({longitude: centroid[0], latitude: centroid[1], zoom: 12})
|
|
267
|
+
: new Viewport({position: [centroid[0], centroid[1], 0], zoom: 12});
|
|
268
|
+
|
|
269
|
+
// Round to the nearest 32-bit float to match CPU and GPU results
|
|
270
|
+
cellOriginCommon = [Math.fround(viewport.center[0]), Math.fround(viewport.center[1])];
|
|
271
|
+
|
|
272
|
+
binIdRange = getBinIdRange({
|
|
273
|
+
dataBounds: bounds,
|
|
274
|
+
getBinId: (p: number[]) => {
|
|
275
|
+
const positionCommon = viewport.projectFlat(p);
|
|
276
|
+
return [
|
|
277
|
+
Math.floor((positionCommon[0] - cellOriginCommon[0]) / cellSizeCommon[0]),
|
|
278
|
+
Math.floor((positionCommon[1] - cellOriginCommon[1]) / cellSizeCommon[1])
|
|
279
|
+
];
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
this.setState({cellSizeCommon, cellOriginCommon, binIdRange, aggregatorViewport: viewport});
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
override draw(opts) {
|
|
288
|
+
// Replaces render time viewport with our own
|
|
289
|
+
if (opts.shaderModuleProps.project) {
|
|
290
|
+
opts.shaderModuleProps.project.viewport = this.state.aggregatorViewport;
|
|
291
|
+
}
|
|
292
|
+
super.draw(opts);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private _onAggregationUpdate() {
|
|
296
|
+
const {aggregator, binIdRange} = this.state;
|
|
297
|
+
this.setState({
|
|
298
|
+
aggregatedValueReader: getAggregatorValueReader({aggregator, binIdRange, channel: 0}),
|
|
299
|
+
contourData: null
|
|
192
300
|
});
|
|
193
301
|
}
|
|
194
302
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
const {
|
|
303
|
+
private _getContours(): {
|
|
304
|
+
lines: ContourLine[];
|
|
305
|
+
polygons: ContourPolygon[];
|
|
306
|
+
} | null {
|
|
307
|
+
const {aggregatedValueReader} = this.state;
|
|
308
|
+
if (!aggregatedValueReader) {
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
200
311
|
|
|
201
|
-
if (
|
|
202
|
-
|
|
203
|
-
this.
|
|
312
|
+
if (!this.state.contourData) {
|
|
313
|
+
const {binIdRange} = this.state;
|
|
314
|
+
const {contours} = this.props;
|
|
315
|
+
const contourData = generateContours({
|
|
316
|
+
contours,
|
|
317
|
+
getValue: aggregatedValueReader,
|
|
318
|
+
xRange: binIdRange[0],
|
|
319
|
+
yRange: binIdRange[1]
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
this.state.contourData = contourData;
|
|
204
323
|
}
|
|
324
|
+
return this.state.contourData;
|
|
325
|
+
}
|
|
205
326
|
|
|
206
|
-
|
|
207
|
-
|
|
327
|
+
onAttributeChange(id: string) {
|
|
328
|
+
const {aggregator} = this.state;
|
|
329
|
+
switch (id) {
|
|
330
|
+
case 'positions':
|
|
331
|
+
aggregator.setNeedsUpdate();
|
|
332
|
+
|
|
333
|
+
this._updateBinOptions();
|
|
334
|
+
const {cellSizeCommon, cellOriginCommon, binIdRange} = this.state;
|
|
335
|
+
aggregator.setProps({
|
|
336
|
+
// @ts-expect-error only used by GPUAggregator
|
|
337
|
+
binIdRange,
|
|
338
|
+
binOptions: {
|
|
339
|
+
cellSizeCommon,
|
|
340
|
+
cellOriginCommon
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
break;
|
|
344
|
+
|
|
345
|
+
case 'counts':
|
|
346
|
+
aggregator.setNeedsUpdate(0);
|
|
347
|
+
break;
|
|
348
|
+
|
|
349
|
+
default:
|
|
350
|
+
// This should not happen
|
|
208
351
|
}
|
|
209
352
|
}
|
|
210
353
|
|
|
211
|
-
renderLayers(): LayersList {
|
|
212
|
-
const
|
|
354
|
+
renderLayers(): LayersList | null {
|
|
355
|
+
const contourData = this._getContours();
|
|
356
|
+
if (!contourData) {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
const {lines, polygons} = contourData;
|
|
360
|
+
const {zOffset} = this.props;
|
|
361
|
+
const {cellOriginCommon, cellSizeCommon} = this.state;
|
|
213
362
|
|
|
214
|
-
const LinesSubLayerClass = this.getSubLayerClass('lines',
|
|
363
|
+
const LinesSubLayerClass = this.getSubLayerClass('lines', PathLayer);
|
|
215
364
|
const BandsSubLayerClass = this.getSubLayerClass('bands', SolidPolygonLayer);
|
|
365
|
+
const modelMatrix = new Matrix4()
|
|
366
|
+
.translate([cellOriginCommon[0], cellOriginCommon[1], 0])
|
|
367
|
+
.scale([cellSizeCommon[0], cellSizeCommon[1], zOffset]);
|
|
216
368
|
|
|
217
369
|
// Contour lines layer
|
|
218
370
|
const lineLayer =
|
|
219
|
-
|
|
220
|
-
|
|
371
|
+
lines &&
|
|
372
|
+
lines.length > 0 &&
|
|
221
373
|
new LinesSubLayerClass(
|
|
222
374
|
this.getSubLayerProps({
|
|
223
375
|
id: 'lines'
|
|
224
376
|
}),
|
|
225
377
|
{
|
|
226
|
-
data:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
378
|
+
data: lines,
|
|
379
|
+
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
380
|
+
modelMatrix,
|
|
381
|
+
getPath: d => d.vertices,
|
|
382
|
+
getColor: d => d.contour.color ?? DEFAULT_COLOR,
|
|
383
|
+
getWidth: d => d.contour.strokeWidth ?? DEFAULT_STROKE_WIDTH,
|
|
384
|
+
widthUnits: 'pixels'
|
|
231
385
|
}
|
|
232
386
|
);
|
|
233
387
|
|
|
234
388
|
// Contour bands layer
|
|
235
389
|
const bandsLayer =
|
|
236
|
-
|
|
237
|
-
|
|
390
|
+
polygons &&
|
|
391
|
+
polygons.length > 0 &&
|
|
238
392
|
new BandsSubLayerClass(
|
|
239
393
|
this.getSubLayerProps({
|
|
240
394
|
id: 'bands'
|
|
241
395
|
}),
|
|
242
396
|
{
|
|
243
|
-
data:
|
|
397
|
+
data: polygons,
|
|
398
|
+
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
399
|
+
modelMatrix,
|
|
244
400
|
getPolygon: d => d.vertices,
|
|
245
|
-
getFillColor: d => d.contour.color
|
|
401
|
+
getFillColor: d => d.contour.color ?? DEFAULT_COLOR
|
|
246
402
|
}
|
|
247
403
|
);
|
|
248
404
|
|
|
249
405
|
return [lineLayer, bandsLayer];
|
|
250
406
|
}
|
|
251
407
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const {viewport} = this.context;
|
|
259
|
-
const cellSizeChanged = oldProps.cellSize !== cellSize;
|
|
260
|
-
let gpuAggregation = props.gpuAggregation;
|
|
261
|
-
if (this.state.gpuAggregation !== props.gpuAggregation) {
|
|
262
|
-
if (gpuAggregation && !GPUGridAggregator.isSupported(this.context.device)) {
|
|
263
|
-
log.warn('GPU Grid Aggregation not supported, falling back to CPU')();
|
|
264
|
-
gpuAggregation = false;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
const gpuAggregationChanged = gpuAggregation !== this.state.gpuAggregation;
|
|
268
|
-
this.setState({
|
|
269
|
-
gpuAggregation
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
const {dimensions} = this.state;
|
|
273
|
-
const positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
|
|
274
|
-
const {data, weights} = dimensions;
|
|
275
|
-
|
|
276
|
-
let {boundingBox} = this.state;
|
|
277
|
-
if (positionsChanged) {
|
|
278
|
-
boundingBox = getBoundingBox(this.getAttributes(), this.getNumInstances());
|
|
279
|
-
this.setState({boundingBox});
|
|
280
|
-
}
|
|
281
|
-
if (positionsChanged || cellSizeChanged) {
|
|
282
|
-
const {gridOffset, translation, width, height, numCol, numRow} = getGridParams(
|
|
283
|
-
boundingBox,
|
|
284
|
-
cellSize,
|
|
285
|
-
viewport,
|
|
286
|
-
coordinateSystem
|
|
287
|
-
);
|
|
288
|
-
this.allocateResources(numRow, numCol);
|
|
289
|
-
this.setState({
|
|
290
|
-
gridOffset,
|
|
291
|
-
boundingBox,
|
|
292
|
-
translation,
|
|
293
|
-
posOffset: translation.slice(), // Used for CPU aggregation, to offset points
|
|
294
|
-
gridOrigin: [-1 * translation[0], -1 * translation[1]],
|
|
295
|
-
width,
|
|
296
|
-
height,
|
|
297
|
-
numCol,
|
|
298
|
-
numRow
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
const aggregationDataDirty =
|
|
303
|
-
positionsChanged ||
|
|
304
|
-
gpuAggregationChanged ||
|
|
305
|
-
this.isAggregationDirty(opts, {
|
|
306
|
-
dimension: data,
|
|
307
|
-
compareAll: gpuAggregation // check for all (including extentions props) when using gpu aggregation
|
|
308
|
-
});
|
|
309
|
-
const aggregationWeightsDirty = this.isAggregationDirty(opts, {
|
|
310
|
-
dimension: weights
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
if (aggregationWeightsDirty) {
|
|
314
|
-
this._updateAccessors(opts);
|
|
315
|
-
}
|
|
316
|
-
if (aggregationDataDirty || aggregationWeightsDirty) {
|
|
317
|
-
this._resetResults();
|
|
318
|
-
}
|
|
319
|
-
this.setState({
|
|
320
|
-
aggregationDataDirty,
|
|
321
|
-
aggregationWeightsDirty
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
/* eslint-enable max-statements, complexity */
|
|
325
|
-
|
|
326
|
-
// Private (Aggregation)
|
|
327
|
-
|
|
328
|
-
private _updateAccessors(opts: UpdateParameters<this>) {
|
|
329
|
-
const {getWeight, aggregation, data} = opts.props;
|
|
330
|
-
const {count} = this.state.weights;
|
|
331
|
-
if (count) {
|
|
332
|
-
count.getWeight = getWeight;
|
|
333
|
-
count.operation = AGGREGATION_OPERATION[aggregation];
|
|
334
|
-
}
|
|
335
|
-
this.setState({getValue: getValueFunc(aggregation, getWeight, {data})});
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
private _resetResults() {
|
|
339
|
-
const {count} = this.state.weights;
|
|
340
|
-
if (count) {
|
|
341
|
-
count.aggregationData = null;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
// Private (Contours)
|
|
346
|
-
|
|
347
|
-
private _generateContours() {
|
|
348
|
-
const {numCol, numRow, gridOrigin, gridOffset, thresholdData} = this.state;
|
|
349
|
-
const {count} = this.state.weights;
|
|
350
|
-
let {aggregationData} = count;
|
|
351
|
-
if (!aggregationData) {
|
|
352
|
-
// @ts-ignore
|
|
353
|
-
aggregationData = count.aggregationBuffer!.readSyncWebGL() as Float32Array;
|
|
354
|
-
count.aggregationData = aggregationData;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
const {cellWeights} = GPUGridAggregator.getCellData({countsData: aggregationData});
|
|
358
|
-
const contourData = generateContours({
|
|
359
|
-
thresholdData,
|
|
360
|
-
cellWeights,
|
|
361
|
-
gridSize: [numCol, numRow],
|
|
362
|
-
gridOrigin,
|
|
363
|
-
cellSize: [gridOffset.xOffset, gridOffset.yOffset]
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
// contourData contains both iso-lines and iso-bands if requested.
|
|
367
|
-
this.setState({contourData});
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
private _updateThresholdData(props) {
|
|
371
|
-
const {contours, zOffset} = props;
|
|
372
|
-
const count = contours.length;
|
|
373
|
-
const thresholdData = new Array(count);
|
|
374
|
-
for (let i = 0; i < count; i++) {
|
|
375
|
-
const contour = contours[i];
|
|
376
|
-
thresholdData[i] = {
|
|
377
|
-
contour,
|
|
378
|
-
zIndex: contour.zIndex || i,
|
|
379
|
-
zOffset
|
|
408
|
+
getPickingInfo(params: GetPickingInfoParams): ContourLayerPickingInfo {
|
|
409
|
+
const info: ContourLayerPickingInfo = params.info;
|
|
410
|
+
const {object} = info;
|
|
411
|
+
if (object) {
|
|
412
|
+
info.object = {
|
|
413
|
+
contour: (object as ContourLine | ContourPolygon).contour
|
|
380
414
|
};
|
|
381
415
|
}
|
|
382
|
-
|
|
416
|
+
|
|
417
|
+
return info;
|
|
383
418
|
}
|
|
384
419
|
}
|