openModeller
Version 1.5.0
|
#include <GdalRaster.hh>
Public Member Functions | |
GdalRaster () | |
void | createRaster (const std::string &file, int categ=0) |
void | createRaster (const std::string &file, const MapFormat &format) |
~GdalRaster () | |
int | iget (int x, int y, Scalar *val) |
int | iput (int x, int y, Scalar val) |
int | get (Coord x, Coord y, Scalar *val) |
int | put (Coord x, Coord y, Scalar val) |
int | put (Coord x, Coord y) |
int | getMinMax (Scalar *min, Scalar *max) |
int | calcMinMax (int band=0) |
void | finish () |
int | deleteRaster () |
bool | hasCustomGeotransform () |
int | getExtentInStandardCs (Coord *xmin, Coord *ymin, Coord *xmax, Coord *ymax) |
Public Member Functions inherited from Raster | |
virtual | ~Raster () |
Header & | header () |
int | isCategorical () const |
Coord | xMin () const |
Coord | yMin () const |
Coord | xMax () const |
Coord | yMax () const |
int | dimX () const |
int | dimY () const |
Coord | celX () const |
Coord | celY () const |
Scalar | noVal () const |
int | numBand () const |
bool | hasMinMax () |
void | setMinMax (Scalar min, Scalar max) |
Private Member Functions | |
void | open (char mode) |
void | create (int format) |
void | initBuffer () |
void | read (Scalar *buf, int first_row, int num_rows) |
void | write (Scalar *buf, int first_row, int num_rows) |
void | loadRow (int row, bool writeOperation=false) |
void | saveRow () |
GdalRaster (const GdalRaster &) | |
GdalRaster & | operator= (const GdalRaster &) |
Static Private Member Functions | |
static void | initGdal () |
Private Attributes | |
GDALDataset * | f_ds |
Scalar * | f_data |
int | f_size |
int | f_format |
int | f_currentRow |
int | f_changed |
GDALDataset * | f_warped_ds |
Additional Inherited Members | |
Protected Member Functions inherited from Raster | |
Raster () | |
Protected Attributes inherited from Raster | |
Scalar | f_scalefactor |
std::string | f_file |
Header | f_hdr |
Manages raster files with GDAL (Geospatial Data Abstraction Library - http://www.remotesensing.org/gdal/index.html)
Definition at line 51 of file GdalRaster.hh.
|
inline |
Definition at line 56 of file GdalRaster.hh.
GdalRaster::~GdalRaster | ( | ) |
Destructor
Definition at line 281 of file GdalRaster.cpp.
References f_data, f_ds, Raster::f_file, and saveRow().
|
private |
int GdalRaster::calcMinMax | ( | int | band = 0 | ) |
Find the minimum and maximum values in 'band'.
Definition at line 765 of file GdalRaster.cpp.
References Raster::f_hdr, iget(), min(), Header::minmax, Header::nband, Header::vmax, Header::vmin, Header::xdim, and Header::ydim.
Referenced by getMinMax().
|
private |
Create a new raster file based on 'hdr'.
Definition at line 442 of file GdalRaster.cpp.
References MapFormat::ByteASC, MapFormat::ByteHFA, GDAL_Format::dataType, Log::error(), f_ds, Raster::f_file, f_format, Raster::f_hdr, MapFormat::FloatingASC, MapFormat::FloatingHFA, GDAL_Format::GDalDriverName, MapFormat::GreyTiff100, Header::gt, initBuffer(), Log::instance(), Header::nband, Header::noval, Header::proj, Log::warn(), Header::xdim, and Header::ydim.
|
virtual |
Open an existing file – read only. If 'categ' != 0 this is a categorical map (ie it can't be interpolated). Othewise this is a continuos map.
Implements Raster.
Reimplemented in RemoteRaster, and WcsProxyRaster.
|
virtual |
Create a new file for projections.
file | is the name of the output file |
format | is the output format specification. |
Implements Raster.
Reimplemented in RemoteRaster, and WcsProxyRaster.
|
virtual |
Method to delete a raster.
Implements Raster.
Reimplemented in RemoteRaster, and WcsProxyRaster.
Definition at line 931 of file GdalRaster.cpp.
References f_ds, and Raster::f_file.
|
virtual |
Event that must be called to indicate when the projection is finished.
Reimplemented from Raster.
Reimplemented in RemoteRaster, and WcsProxyRaster.
Definition at line 873 of file GdalRaster.cpp.
References MapFormat::ByteASC, Log::error(), f_ds, Raster::f_file, f_format, MapFormat::FloatingASC, Log::instance(), saveRow(), and Log::warn().
Fills '*val' with the map value at (x,y). Returns zero if (x,y) is out of range.
Implements Raster.
Definition at line 683 of file GdalRaster.cpp.
References Header::convertLonLat2XY(), Raster::f_hdr, iget(), Header::nband, Header::noval, Header::xdim, and Header::ydim.
|
virtual |
Calculates the raster extent in openModeller's standard coordinate system. IMPORTANT: Call this only if hasCustomGeotransform returns true. When interacting with Map objects, use Map.getExtent instead, which encapsulates a call to this method when necessary. For some projections, such as lambert azimuth equal area, getting the raster extent through manual coordinate conversion, as was usually done in the Map.getExtent, can be problematic. This method provides a way for raster implementations to better perform the task of calculating the extent.
xmin | Pointer to minimum X value |
ymin | Pointer to minimum Y value |
xmax | Pointer to maximum X value |
ymax | Pointer to maximum Y value |
Reimplemented from Raster.
Definition at line 950 of file GdalRaster.cpp.
References f_warped_ds.
Finds the minimum and maximum values in the first band.
min | Pointer to minimum value |
max | Pointer to maximum value |
Implements Raster.
Definition at line 748 of file GdalRaster.cpp.
References calcMinMax(), Raster::f_hdr, Header::vmax, and Header::vmin.
|
inlinevirtual |
Indicates if the raster has a better way to carry out conversions from its own coordinate system to the standard system used by openModeller.
Reimplemented from Raster.
Definition at line 133 of file GdalRaster.hh.
int GdalRaster::iget | ( | int | x, |
int | y, | ||
Scalar * | val | ||
) |
Definition at line 661 of file GdalRaster.cpp.
References f_data, Raster::f_hdr, f_size, loadRow(), Header::nband, and Header::noval.
Referenced by calcMinMax(), and get().
|
private |
Definition at line 611 of file GdalRaster.cpp.
References f_changed, f_currentRow, f_data, Raster::f_hdr, f_size, Header::nband, and Header::xdim.
|
staticprivate |
Definition at line 630 of file GdalRaster.cpp.
int GdalRaster::iput | ( | int | x, |
int | y, | ||
Scalar | val | ||
) |
|
private |
Definition at line 825 of file GdalRaster.cpp.
References f_changed, f_currentRow, f_data, Raster::f_hdr, f_size, Header::noval, read(), and saveRow().
Referenced by iget(), and iput().
|
private |
Open a raster file.
Definition at line 360 of file GdalRaster.cpp.
References Header::calculateCell(), GeoTransform::compareCoordSystemStrings(), Log::error(), f_ds, Raster::f_file, Raster::f_hdr, f_warped_ds, GeoTransform::getDefaultCS(), Header::grid, Header::gt, Header::hasProj(), initBuffer(), Log::instance(), Header::minmax, Header::nband, Header::noval, Header::setProj(), Header::vmax, Header::vmin, Log::warn(), Header::xdim, Header::xmax, Header::xmin, Header::ydim, Header::ymax, and Header::ymin.
|
private |
Put '*val' at the (x,y) coordinate. Returns 0 if (x,y) is out of range or the map is read only. supports only single band output files.
Implements Raster.
Reimplemented in RemoteRaster, and WcsProxyRaster.
Definition at line 710 of file GdalRaster.cpp.
References Header::convertLonLat2XY(), Raster::f_hdr, Raster::f_scalefactor, Log::instance(), iput(), Log::warn(), Header::xdim, and Header::ydim.
Put 'no data val' at the (x,y) coordinate. Returns 0 if (x,y) is out of range or the map is read only. supports only single band output files.
Implements Raster.
Reimplemented in RemoteRaster, and WcsProxyRaster.
Definition at line 728 of file GdalRaster.cpp.
References Header::convertLonLat2XY(), Raster::f_hdr, Log::instance(), iput(), Header::noval, Log::warn(), Header::xdim, and Header::ydim.
|
private |
Read 'num_rows' rows starting from 'first_row' to the memory pointed to by 'buf'. Each element read is transformed in a 'Scalar'.
Definition at line 304 of file GdalRaster.cpp.
References f_ds, Raster::f_hdr, f_size, f_type, Header::nband, and Header::noval.
Referenced by loadRow().
|
private |
Definition at line 858 of file GdalRaster.cpp.
References f_changed, f_currentRow, f_data, and write().
Referenced by finish(), loadRow(), and ~GdalRaster().
|
private |
Write 'num_rows' rows starting from 'first_row' to the memory pointed to by 'buf'.
Definition at line 334 of file GdalRaster.cpp.
References Log::error(), f_ds, Raster::f_file, Raster::f_hdr, f_size, f_type, Log::instance(), and Header::nband.
Referenced by saveRow().
|
private |
Definition at line 187 of file GdalRaster.hh.
Referenced by initBuffer(), iput(), loadRow(), and saveRow().
|
private |
Definition at line 186 of file GdalRaster.hh.
Referenced by initBuffer(), loadRow(), and saveRow().
|
private |
Definition at line 181 of file GdalRaster.hh.
Referenced by iget(), initBuffer(), iput(), loadRow(), saveRow(), and ~GdalRaster().
|
private |
Definition at line 179 of file GdalRaster.hh.
Referenced by create(), deleteRaster(), finish(), open(), read(), write(), and ~GdalRaster().
|
private |
Definition at line 184 of file GdalRaster.hh.
|
private |
Definition at line 182 of file GdalRaster.hh.
Referenced by iget(), initBuffer(), loadRow(), read(), and write().
|
private |
Definition at line 195 of file GdalRaster.hh.
Referenced by getExtentInStandardCs(), and open().