Agroeye  1.0
RasterBand.h
Go to the documentation of this file.
1 #ifndef RASTERBAND_H
2 #define RASTERBAND_H
3 
4 #include <memory>
5 
6 #include <gdal_priv.h>
7 
8 #include "GeneralErrors.h"
9 #include "RasterErrors.h"
10 #include "RasterData.h"
11 #include "Callback.h"
12 
13 namespace agroeye {
14 namespace handlers {
15 
19 
20 class RasterBand {
21 public:
26  RasterBand(GDALRasterBand* rawBand, CallbackFunction callbackFunc);
27 
32  RasterBand(const RasterBand& other);
33 
38  RasterBand(RasterBand&& other);
39 
44  RasterBand& operator=(const RasterBand& other);
45 
51 
57  virtual ~RasterBand() {};
58 
67  RasterData read(size_t x, size_t y, size_t width, size_t height);
68  int getWidth() const;
69  int getHeight() const;
70  double getNoDataValue() const;
72 private:
73  void checkPosition(size_t x, size_t y) const;
74  void checkExtent(size_t x, size_t y, size_t width, size_t height) const;
75  void inOutRaster(RasterData& rasterData, GDALRWFlag inOutType);
76 
77  // DO NOT delete this pointer
78  // RasterBand is NOT owned by thist pointer
79  GDALRasterBand* ptrBand {nullptr};
80 
82 };
83 
84 } // namespace handlers
85 } // namespace agroeye
86 
87 #endif
Definition: RasterData.h:19
CallbackTypes
Type of callback that can be called function.
Definition: Callback.h:17
RasterBand(GDALRasterBand *rawBand, CallbackFunction callbackFunc)
Opens raster band. The opening of raster is only created by Raster.
Definition: RasterBand.cpp:6
Definition: ContainerMath.h:11
double getNoDataValue() const
Definition: RasterBand.cpp:114
RasterData read(size_t x, size_t y, size_t width, size_t height)
Reads the given extent of raster band.
Definition: RasterBand.cpp:45
RasterBand & operator=(const RasterBand &other)
Copy assignment operator.
Definition: RasterBand.cpp:20
std::function< void(double, ListCallbackTypes, std::string)> CallbackFunction
Definition: Callback.h:25
int getHeight() const
Definition: RasterBand.cpp:40
int getWidth() const
Definition: RasterBand.cpp:36
Definition: RasterBand.h:20
void silenceCallback(double progress, ListCallbackTypes listTypes, std::string message)
Silencing callback.
Definition: Callback.cpp:17
virtual ~RasterBand()
Does NOT free any resources.
Definition: RasterBand.h:57