osgEarth 2.1.1
|
Public Member Functions | |
Geoid () | |
void | setName (const std::string &value) |
const std::string & | getName () const |
void | setHeightField (const GeoHeightField &hf) |
float | getOffset (double lat_deg, double lon_deg, const ElevationInterpolation &interp=INTERP_BILINEAR) const |
const Units & | getUnits () const |
void | setUnits (const Units &value) |
bool | isValid () const |
bool | isEquivalentTo (const Geoid &rhs) const |
Private Member Functions | |
void | validate () |
Private Attributes | |
std::string | _name |
GeoHeightField | _hf |
Units | _units |
bool | _valid |
A representation of the surface of the earth based on a grid of height values that are relative to a reference ellipsoid.
Geoid::Geoid | ( | ) |
Definition at line 1132 of file GeoData.cpp.
: _hf( GeoHeightField::INVALID ), _units( Units::METERS ), _valid( false ) { //nop }
const std::string& osgEarth::Geoid::getName | ( | ) | const [inline] |
float Geoid::getOffset | ( | double | lat_deg, |
double | lon_deg, | ||
const ElevationInterpolation & | interp = INTERP_BILINEAR |
||
) | const |
Queries to geoid for the height offset at the specified coordinates.
Definition at line 1177 of file GeoData.cpp.
{ float result = 0.0f; if ( _valid ) { // first convert the query coordinates to the geoid heightfield range if neccesary. if ( lat_deg < _hf.getExtent().yMin() ) lat_deg = 90.0 - (-90.0-lat_deg); else if ( lat_deg > _hf.getExtent().yMax() ) lat_deg = -90 + (lat_deg-90.0); if ( lon_deg < _hf.getExtent().xMin() ) lon_deg += 360.0; else if ( lon_deg > _hf.getExtent().xMax() ) lon_deg -= 360.0; bool ok = _hf.getElevation( 0L, lon_deg, lat_deg, interp, 0L, result ); if ( !ok ) result = 0.0f; } return result; }
const Units& osgEarth::Geoid::getUnits | ( | ) | const [inline] |
bool Geoid::isEquivalentTo | ( | const Geoid & | rhs | ) | const |
bool osgEarth::Geoid::isValid | ( | ) | const [inline] |
void Geoid::setHeightField | ( | const GeoHeightField & | hf | ) |
Sets the underlying heightfield data
Definition at line 1148 of file GeoData.cpp.
void Geoid::setName | ( | const std::string & | value | ) |
Gets the readable name of this geoid.
Definition at line 1141 of file GeoData.cpp.
void Geoid::setUnits | ( | const Units & | value | ) |
Definition at line 1155 of file GeoData.cpp.
void Geoid::validate | ( | ) | [private] |
Definition at line 1162 of file GeoData.cpp.
{ _valid = false; if ( !_hf.valid() ) { //OE_WARN << LC << "ILLEGAL GEOID: no heightfield" << std::endl; } else if ( !_hf.getExtent().getSRS() || !_hf.getExtent().getSRS()->isGeographic() ) { OE_WARN << LC << "ILLEGAL GEOID: heightfield must be geodetic" << std::endl; } else { _valid = true; } }
GeoHeightField osgEarth::Geoid::_hf [private] |
std::string osgEarth::Geoid::_name [private] |
Units osgEarth::Geoid::_units [private] |
bool osgEarth::Geoid::_valid [private] |