4 #include "Kernel_global.h"
20 double& at(quint32 index) {
22 if ( index < _blockSize){
31 char *blockAsMemory();
33 void fill(
const std::vector<double>& values);
36 bool isLoaded()
const {
return _inMemory; }
37 inline bool unload() ;
47 _data.resize(blockSize());
48 std::fill(_data.begin(), _data.end(), _undef);
50 }
catch(
const std::bad_alloc& ){
51 throw ErrorObject( TR(
"Couldnt allocate memory for raster")) ;
58 std::vector<double> _data;
65 static quint64 _blockid;
66 QString _tempName = sUNDEF;
67 QScopedPointer<QTemporaryFile> _swapFile;
71 class KERNELSHARED_EXPORT
Grid
75 friend class GridInterpolator;
83 double& value(quint32 block,
int offset );
84 double value(
const Pixel& pix) ;
85 void setValue(quint32 block,
int offset,
double v );
87 quint32 blocks()
const;
88 quint32 blocksPerBand()
const;
90 void setBlockData(quint32 block,
const std::vector<double>& data,
bool creation);
91 char *blockAsMemory(quint32 block,
bool creation);
92 void setSize(
const Size<>& sz);
94 quint32 blockSize(quint32 index)
const;
97 Grid * clone(quint32 index1=iUNDEF, quint32 index2=iUNDEF) ;
100 double bilinear(
const Pixeld &pix)
const;
101 double bicubic(
const Pixeld &pix)
const;
102 int numberOfBlocks();
103 inline bool update(quint32 block,
bool creation=
false);
106 std::vector< GridBlockInternal *> _blocks;
107 QList<quint32> _cache;
108 quint32 _inMemoryIndex;
111 quint32 _blocksPerBand;
112 std::vector<quint32> _blockSizes;
115 std::vector<std::vector<quint32>> _offsets;
116 std::vector<quint32> _blockOffsets;
117 bool _allInMemory =
false;