GDAL
|
Class to have reasonably fast random pixel access to a raster band, when accessing multiple pixels that are close to each other. More...
#include <gdalcachedpixelaccessor.h>
Public Member Functions | |
GDALCachedPixelAccessor (GDALRasterBand *poBand) | |
Constructor. More... | |
~GDALCachedPixelAccessor () | |
Destructor. More... | |
void | SetBand (GDALRasterBand *poBand) |
Assign the raster band if not known at construction time. | |
Type | Get (int nX, int nY, bool *pbSuccess=nullptr) |
Get the value of a pixel. More... | |
bool | Set (int nX, int nY, Type val) |
Set the value of a pixel. More... | |
bool | FlushCache () |
Flush content of modified tiles and drop caches. More... | |
void | ResetModifiedFlag () |
Reset the modified flag for cached tiles. | |
Class to have reasonably fast random pixel access to a raster band, when accessing multiple pixels that are close to each other.
This gives faster access than using GDALRasterBand::RasterIO() with a 1x1 window.
|
explicit |
Constructor.
The template accepts the following parameters:
poBand | Raster band. |
GDALCachedPixelAccessor< Type, TILE_SIZE, CACHED_TILE_COUNT >::~GDALCachedPixelAccessor |
Destructor.
Will call FlushCache()
bool GDALCachedPixelAccessor< Type, TILE_SIZE, CACHED_TILE_COUNT >::FlushCache |
Flush content of modified tiles and drop caches.
|
inline |
Get the value of a pixel.
No bound checking of nX, nY is done.
nX | X coordinate (between 0 and GetXSize()-1) | |
nY | Y coordinate (between 0 and GetYSize()-1) | |
[out] | pbSuccess | Optional pointer to a success flag |
|
inline |
Set the value of a pixel.
The actual modification of the underlying raster is deferred until the tile is implicit flushed while loading a new tile, or an explicit call to FlushCache().
The destructor of GDALCachedPixelAccessor will take care of calling FlushCache(), if the user hasn't done it explicitly.
No bound checking of nX, nY is done.
nX | X coordinate (between 0 and GetXSize()-1) |
nY | Y coordinate (between 0 and GetYSize()-1) |
val | pixel value |