(
target: DataStore,
dims: DimensionIndex[],
cb: MapCb
)
| 809 | } |
| 810 | |
| 811 | private _updateDims( |
| 812 | target: DataStore, |
| 813 | dims: DimensionIndex[], |
| 814 | cb: MapCb |
| 815 | ) { |
| 816 | const targetChunks = target._chunks; |
| 817 | |
| 818 | const tmpRetValue = []; |
| 819 | const dimSize = dims.length; |
| 820 | const dataCount = target.count(); |
| 821 | const values = []; |
| 822 | const rawExtent = target._rawExtent; |
| 823 | |
| 824 | for (let i = 0; i < dims.length; i++) { |
| 825 | rawExtent[dims[i]] = initExtentForUnion(); |
| 826 | } |
| 827 | |
| 828 | for (let dataIndex = 0; dataIndex < dataCount; dataIndex++) { |
| 829 | const rawIndex = target.getRawIndex(dataIndex); |
| 830 | |
| 831 | for (let k = 0; k < dimSize; k++) { |
| 832 | values[k] = targetChunks[dims[k]][rawIndex]; |
| 833 | } |
| 834 | values[dimSize] = dataIndex; |
| 835 | |
| 836 | let retValue = cb && cb.apply(null, values); |
| 837 | if (retValue != null) { |
| 838 | // a number or string (in ordinal dimension)? |
| 839 | if (typeof retValue !== 'object') { |
| 840 | tmpRetValue[0] = retValue; |
| 841 | retValue = tmpRetValue; |
| 842 | } |
| 843 | |
| 844 | for (let i = 0; i < retValue.length; i++) { |
| 845 | const dim = dims[i]; |
| 846 | const val = retValue[i]; |
| 847 | const rawExtentOnDim = rawExtent[dim]; |
| 848 | |
| 849 | const dimStore = targetChunks[dim]; |
| 850 | if (dimStore) { |
| 851 | (dimStore as ParsedValue[])[rawIndex] = val; |
| 852 | } |
| 853 | |
| 854 | if (val < rawExtentOnDim[0]) { |
| 855 | rawExtentOnDim[0] = val as number; |
| 856 | } |
| 857 | if (val > rawExtentOnDim[1]) { |
| 858 | rawExtentOnDim[1] = val as number; |
| 859 | } |
| 860 | } |
| 861 | } |
| 862 | } |
| 863 | } |
| 864 | |
| 865 | /** |
| 866 | * Large data down sampling using largest-triangle-three-buckets |
no test coverage detected