openModeller  Version 1.5.0
Raster Class Referenceabstract

A common interface to rasters. More...

#include <Raster.hh>

Inheritance diagram for Raster:
Inheritance graph
Collaboration diagram for Raster:
Collaboration graph

Public Member Functions

virtual ~Raster ()
 
virtual void createRaster (const std::string &source, int categ=0)=0
 
virtual void createRaster (const std::string &source, const MapFormat &format)=0
 
Headerheader ()
 
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
 
virtual int get (Coord px, Coord py, Scalar *val)=0
 
virtual int put (Coord px, Coord py, Scalar val)=0
 
virtual int put (Coord px, Coord py)=0
 
virtual int getMinMax (Scalar *min, Scalar *max)=0
 
bool hasMinMax ()
 
void setMinMax (Scalar min, Scalar max)
 
virtual void finish ()
 
virtual int deleteRaster ()=0
 
virtual bool hasCustomGeotransform ()
 
virtual int getExtentInStandardCs (Coord *xmin, Coord *ymin, Coord *xmax, Coord *ymax)
 

Protected Member Functions

 Raster ()
 

Protected Attributes

Scalar f_scalefactor
 
std::string f_file
 
Header f_hdr
 

Detailed Description

A common interface to rasters.

Definition at line 44 of file Raster.hh.

Constructor & Destructor Documentation

Raster::~Raster ( )
virtual

Definition at line 55 of file Raster.cpp.

Raster::Raster ( )
inlineprotected

Definition at line 194 of file Raster.hh.

Member Function Documentation

Coord Raster::celX ( ) const
inline

Returns the longitudinal cell dimension.

Definition at line 99 of file Raster.hh.

Coord Raster::celY ( ) const
inline

Returns the latitudinal cell dimension.

Definition at line 102 of file Raster.hh.

virtual void Raster::createRaster ( const std::string &  source,
int  categ = 0 
)
pure virtual

Method to create a raster representation (needed by RasterFactory).

Parameters
sourceA string pointing to a raster source (file name, URL, etc.)
categIndicates if the raster is categorical or not

Implemented in RemoteRaster, WcsProxyRaster, TerralibRaster, and GdalRaster.

Referenced by RasterFactory::create().

virtual void Raster::createRaster ( const std::string &  source,
const MapFormat format 
)
pure virtual

Method to create a raster representation (needed by RasterFactory).

Parameters
sourceA string pointing to a raster source (file name, URL, etc.)
formatMap format

Implemented in RemoteRaster, WcsProxyRaster, TerralibRaster, and GdalRaster.

virtual int Raster::deleteRaster ( )
pure virtual

Method to delete a raster.

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

Implemented in GdalRaster, TerralibRaster, RemoteRaster, and WcsProxyRaster.

Referenced by Map::deleteRaster().

int Raster::dimX ( ) const
inline

Returns the longitudinal map dimension.

Definition at line 93 of file Raster.hh.

Referenced by Map::getRowColumn().

int Raster::dimY ( ) const
inline

Returns the latitudinal map dimension.

Definition at line 96 of file Raster.hh.

Referenced by Map::getRowColumn().

virtual void Raster::finish ( )
inlinevirtual

Event that must be called to indicate when the projection is finished.

Reimplemented in GdalRaster, RemoteRaster, and WcsProxyRaster.

Definition at line 154 of file Raster.hh.

Referenced by Map::finish().

virtual int Raster::get ( Coord  px,
Coord  py,
Scalar val 
)
pure virtual

Fills '*val' with the map value at (x,y).

Parameters
pxLongitude
pyLatitude
valValue
Returns
zero if (x,y) is out of range.

Implemented in GdalRaster, and TerralibRaster.

Referenced by Map::get().

virtual int Raster::getExtentInStandardCs ( Coord xmin,
Coord ymin,
Coord xmax,
Coord ymax 
)
inlinevirtual

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 in GdalRaster.

Definition at line 180 of file Raster.hh.

Referenced by Map::getExtent().

virtual int Raster::getMinMax ( Scalar min,
Scalar max 
)
pure 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

Implemented in GdalRaster, and TerralibRaster.

virtual bool Raster::hasCustomGeotransform ( )
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.

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

Reimplemented in GdalRaster.

Definition at line 165 of file Raster.hh.

Referenced by Map::getExtent().

bool Raster::hasMinMax ( )
inline

Tells if the min and max have already been computed

Definition at line 143 of file Raster.hh.

Header& Raster::header ( )
inline

Returns the header.

Definition at line 75 of file Raster.hh.

Referenced by RequestFile::_setProjection(), Map::Map(), and MapFormat::MapFormat().

int Raster::isCategorical ( ) const
inline

Returns not zero if this map is categorical.

Definition at line 78 of file Raster.hh.

Scalar Raster::noVal ( ) const
inline

Returns the "noval" value.

Definition at line 105 of file Raster.hh.

int Raster::numBand ( ) const
inline

Returns the number of bands.

Definition at line 108 of file Raster.hh.

virtual int Raster::put ( Coord  px,
Coord  py,
Scalar  val 
)
pure virtual

Put 'val' at the (x,y) coordinate. Supports only single band output files.

Parameters
pxLongitude
pyLatitude
valValue
Returns
0 if (x,y) is out of range or the map is read only.

Implemented in GdalRaster, RemoteRaster, TerralibRaster, and WcsProxyRaster.

Referenced by Map::put().

virtual int Raster::put ( Coord  px,
Coord  py 
)
pure virtual

Put 'no data val' at the (x,y) coordinate. Supports only single band files.

Parameters
pxLongitude
pyLatitude
Returns
0 if (x,y) is out of range or the map is read only.

Implemented in GdalRaster, RemoteRaster, TerralibRaster, and WcsProxyRaster.

void Raster::setMinMax ( Scalar  min,
Scalar  max 
)

Support external specification of min/max.

Parameters
minMinimum value
maxMaximum value

Definition at line 61 of file Raster.cpp.

References f_hdr, min(), Header::minmax, Header::vmax, and Header::vmin.

Here is the call graph for this function:

Coord Raster::xMax ( ) const
inline

Returns the highest longitude.

Definition at line 87 of file Raster.hh.

Referenced by Map::getExtent(), and Map::getRowColumn().

Coord Raster::xMin ( ) const
inline

Returns the lowest longitude.

Definition at line 81 of file Raster.hh.

Referenced by Map::getExtent(), and Map::getRowColumn().

Coord Raster::yMax ( ) const
inline

Returns the highest latitude.

Definition at line 90 of file Raster.hh.

Referenced by Map::getExtent(), and Map::getRowColumn().

Coord Raster::yMin ( ) const
inline

Returns the lowest latitude.

Definition at line 84 of file Raster.hh.

Referenced by Map::getExtent(), and Map::getRowColumn().

Member Data Documentation

std::string Raster::f_file
protected
Scalar Raster::f_scalefactor
protected

Definition at line 184 of file Raster.hh.

Referenced by TerralibRaster::createRaster(), TerralibRaster::put(), and GdalRaster::put().


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