OGS
|
Class Raster is used for managing raster data.
A raster consists of the meta data like number of columns and rows, the lower left point, the size of a raster pixel and a value for invalid data pixels. Additional the object needs the raster data itself. The raster data will be copied from the constructor. The destructor will release the memory.
#include <Raster.h>
Public Member Functions | |
template<typename InputIterator > | |
Raster (RasterHeader header, InputIterator begin, InputIterator end) | |
Constructor for an object of class Raster. The raster data have to be handed over via input iterators. Deploying iterators has the advantage that the use of the class is independent from the input container. | |
Raster (Raster const &)=default | |
Raster (Raster &&)=default | |
Raster & | operator= (Raster const &)=default |
Raster & | operator= (Raster &&)=default |
~Raster ()=default | |
RasterHeader const & | getHeader () const |
Returns the complete header information. | |
void | refineRaster (std::size_t scaling) |
std::vector< double >::const_iterator | begin () const |
std::vector< double >::const_iterator | end () const |
double const * | data () const |
double const & | operator() (std::size_t const row, std::size_t const col) const |
double & | operator() (std::size_t const row, std::size_t const col) |
double | getValueAtPoint (const MathLib::Point3d &pnt) const |
double | interpolateValueAtPoint (const MathLib::Point3d &pnt) const |
bool | isPntOnRaster (MathLib::Point3d const &pnt) const |
bool | operator== (Raster const &) const =default |
Private Member Functions | |
void | setCellSize (double cell_size) |
void | setNoDataVal (double no_data_val) |
Private Attributes | |
GeoLib::RasterHeader | _header |
std::vector< double > | _raster_data |
|
inline |
Constructor for an object of class Raster. The raster data have to be handed over via input iterators. Deploying iterators has the advantage that the use of the class is independent from the input container.
header | meta-information about the raster (height, width, etc.) |
begin | input iterator pointing to the first element of the data |
end | input iterator pointing to the last element of the data, end have to be reachable from begin |
Definition at line 62 of file Raster.h.
References _header, _raster_data, begin(), end(), GeoLib::RasterHeader::n_cols, and GeoLib::RasterHeader::n_rows.
|
default |
|
default |
|
default |
|
inline |
Constant iterator that is pointing to the first raster pixel value.
Definition at line 96 of file Raster.h.
References _raster_data.
Referenced by Raster(), and LayeredMeshGenerator::calcEpsilon().
|
inline |
Definition at line 111 of file Raster.h.
References _raster_data.
Referenced by MeshToolsLib::RasterToMesh::convert(), and FileIO::AsciiRasterInterface::writeRasterAsASC().
|
inline |
Iterator to the element following the last pixel element of the raster
Definition at line 106 of file Raster.h.
References _raster_data.
Referenced by Raster(), and LayeredMeshGenerator::calcEpsilon().
|
inline |
Returns the complete header information.
Definition at line 85 of file Raster.h.
References _header.
Referenced by MeshToolsLib::RasterToMesh::convert(), DirectConditionGenerator::directToSurfaceNodes(), LayeredMeshGenerator::getNewLayerNode(), MeshToolsLib::MeshLayerMapper::layerMapping(), MeshToolsLib::RasterDataToMesh::projectToElements(), MeshToolsLib::RasterDataToMesh::projectToNodes(), and FileIO::AsciiRasterInterface::writeRasterAsASC().
double GeoLib::Raster::getValueAtPoint | ( | const MathLib::Point3d & | pnt | ) | const |
Returns the raster value at the position of the given point.
Definition at line 56 of file Raster.cpp.
References _header, _raster_data, GeoLib::RasterHeader::cell_size, GeoLib::RasterHeader::n_cols, GeoLib::RasterHeader::n_rows, GeoLib::RasterHeader::no_data, and GeoLib::RasterHeader::origin.
Referenced by DirectConditionGenerator::directToSurfaceNodes(), and MeshToolsLib::MeshLayerMapper::layerMapping().
double GeoLib::Raster::interpolateValueAtPoint | ( | const MathLib::Point3d & | pnt | ) | const |
Interpolates the elevation of the given point based on the 8-neighbourhood of the raster cell it is located on
Definition at line 85 of file Raster.cpp.
References _header, _raster_data, GeoLib::RasterHeader::cell_size, GeoLib::RasterHeader::n_cols, GeoLib::RasterHeader::n_rows, GeoLib::RasterHeader::no_data, and GeoLib::RasterHeader::origin.
Referenced by VtkImageDataToSurfacePointsFilter::createPointSurface(), LayeredMeshGenerator::getNewLayerNode(), and MeshToolsLib::MeshLayerMapper::layerMapping().
bool GeoLib::Raster::isPntOnRaster | ( | MathLib::Point3d const & | pnt | ) | const |
Checks if the given point is located within the (x,y)-extension of the raster.
Definition at line 151 of file Raster.cpp.
References _header, GeoLib::RasterHeader::cell_size, GeoLib::RasterHeader::n_cols, GeoLib::RasterHeader::n_rows, and GeoLib::RasterHeader::origin.
Referenced by MeshToolsLib::MeshLayerMapper::layerMapping().
|
inline |
|
inline |
Access the pixel specified by row, col.
Definition at line 116 of file Raster.h.
References _header, _raster_data, GeoLib::RasterHeader::n_cols, GeoLib::RasterHeader::n_rows, and OGS_FATAL.
|
default |
void GeoLib::Raster::refineRaster | ( | std::size_t | scaling | ) |
Refine the raster using scaling as a refinement parameter.
Definition at line 25 of file Raster.cpp.
References _header, _raster_data, GeoLib::RasterHeader::cell_size, GeoLib::RasterHeader::n_cols, and GeoLib::RasterHeader::n_rows.
|
private |
|
private |
|
private |
Definition at line 150 of file Raster.h.
Referenced by Raster(), getHeader(), getValueAtPoint(), interpolateValueAtPoint(), isPntOnRaster(), operator()(), and refineRaster().
|
private |
Definition at line 151 of file Raster.h.
Referenced by Raster(), begin(), data(), end(), getValueAtPoint(), interpolateValueAtPoint(), operator()(), and refineRaster().