openModeller  Version 1.4.0
GdalRaster Class Reference

#include <GdalRaster.hh>

Inheritance diagram for GdalRaster:
Collaboration diagram for GdalRaster:

List of all members.

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)

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 &)
GdalRasteroperator= (const GdalRaster &)

Static Private Member Functions

static void initGdal ()

Private Attributes

GDALDataset * f_ds
Scalarf_data
int f_size
int f_format
int f_currentRow
int f_changed
GDALDataset * f_warped_ds

Detailed Description

Manages raster files with GDAL (Geospatial Data Abstraction Library - http://www.remotesensing.org/gdal/index.html)

Definition at line 51 of file GdalRaster.hh.


Constructor & Destructor Documentation

GdalRaster::GdalRaster ( ) [inline]

Definition at line 56 of file GdalRaster.hh.

Destructor

Definition at line 281 of file GdalRaster.cpp.

References f_data, f_ds, Raster::f_file, and saveRow().

Here is the call graph for this function:

GdalRaster::GdalRaster ( const GdalRaster ) [private]

Member Function Documentation

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().

Here is the call graph for this function:

void GdalRaster::createRaster ( const std::string &  file,
int  categ = 0 
) [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.

void GdalRaster::createRaster ( const std::string &  file,
const MapFormat format 
) [virtual]

Create a new file for projections.

Parameters:
fileis the name of the output file
formatis the output format specification.

Implements Raster.

Reimplemented in RemoteRaster, and WcsProxyRaster.

int GdalRaster::deleteRaster ( ) [virtual]

Method to delete a raster.

Returns:
1 if the raster was successfully deleted, 0 otherwise.

Implements Raster.

Reimplemented in RemoteRaster, and WcsProxyRaster.

Definition at line 931 of file GdalRaster.cpp.

References f_ds, and Raster::f_file.

void GdalRaster::finish ( ) [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().

Here is the call graph for this function:

int GdalRaster::get ( Coord  x,
Coord  y,
Scalar val 
) [virtual]

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.

Here is the call graph for this function:

int GdalRaster::getExtentInStandardCs ( Coord xmin,
Coord ymin,
Coord xmax,
Coord ymax 
) [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.

Parameters:
xminPointer to minimum X value
yminPointer to minimum Y value
xmaxPointer to maximum X value
ymaxPointer to maximum Y value
Returns:
1 if conversion was successful, 0 otherwise.

Reimplemented from Raster.

Definition at line 950 of file GdalRaster.cpp.

References f_warped_ds.

int GdalRaster::getMinMax ( Scalar min,
Scalar max 
) [virtual]

Finds the minimum and maximum values in the first band.

Parameters:
minPointer to minimum value
maxPointer to maximum value
Returns:
1 if values are present, 0 otherwise

Implements Raster.

Definition at line 748 of file GdalRaster.cpp.

References calcMinMax(), Raster::f_hdr, Header::vmax, and Header::vmin.

Here is the call graph for this function:

bool GdalRaster::hasCustomGeotransform ( ) [inline, virtual]

Indicates if the raster has a better way to carry out conversions from its own coordinate system to the standard system used by openModeller.

Returns:
true if raster has its own geotransform to convert to standard cs, false otherwise.

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().

Here is the call graph for this function:

void GdalRaster::initBuffer ( ) [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.

Referenced by create(), and open().

void GdalRaster::initGdal ( ) [static, private]

Definition at line 630 of file GdalRaster.cpp.

int GdalRaster::iput ( int  x,
int  y,
Scalar  val 
)

Definition at line 644 of file GdalRaster.cpp.

References f_changed, f_data, and loadRow().

Referenced by put().

Here is the call graph for this function:

void GdalRaster::loadRow ( int  row,
bool  writeOperation = false 
) [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().

Here is the call graph for this function:

GdalRaster& GdalRaster::operator= ( const GdalRaster ) [private]
int GdalRaster::put ( Coord  x,
Coord  y,
Scalar  val 
) [virtual]

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.

Here is the call graph for this function:

int GdalRaster::put ( Coord  x,
Coord  y 
) [virtual]

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.

Here is the call graph for this function:

void GdalRaster::read ( Scalar buf,
int  first_row,
int  num_rows 
) [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().

void GdalRaster::saveRow ( ) [private]

Definition at line 858 of file GdalRaster.cpp.

References f_changed, f_currentRow, f_data, and write().

Referenced by finish(), loadRow(), and ~GdalRaster().

Here is the call graph for this function:

void GdalRaster::write ( Scalar buf,
int  first_row,
int  num_rows 
) [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().

Here is the call graph for this function:


Member Data Documentation

int GdalRaster::f_changed [private]

Definition at line 187 of file GdalRaster.hh.

Referenced by initBuffer(), iput(), loadRow(), and saveRow().

int GdalRaster::f_currentRow [private]

Definition at line 186 of file GdalRaster.hh.

Referenced by initBuffer(), loadRow(), and saveRow().

Definition at line 181 of file GdalRaster.hh.

Referenced by iget(), initBuffer(), iput(), loadRow(), saveRow(), and ~GdalRaster().

GDALDataset* GdalRaster::f_ds [private]

Definition at line 179 of file GdalRaster.hh.

Referenced by create(), deleteRaster(), finish(), open(), read(), write(), and ~GdalRaster().

int GdalRaster::f_format [private]

Definition at line 184 of file GdalRaster.hh.

Referenced by create(), and finish().

int GdalRaster::f_size [private]

Definition at line 182 of file GdalRaster.hh.

Referenced by iget(), initBuffer(), loadRow(), read(), and write().

GDALDataset* GdalRaster::f_warped_ds [private]

Definition at line 195 of file GdalRaster.hh.

Referenced by getExtentInStandardCs(), and open().


The documentation for this class was generated from the following files: