osgEarth 2.1.1
Public Member Functions | Private Member Functions | Private Attributes

osgEarth::Geoid Class Reference

Inheritance diagram for osgEarth::Geoid:
Collaboration diagram for osgEarth::Geoid:

List of all members.

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

Detailed Description

A representation of the surface of the earth based on a grid of height values that are relative to a reference ellipsoid.

Definition at line 419 of file GeoData.


Constructor & Destructor Documentation

Geoid::Geoid ( )

Definition at line 1132 of file GeoData.cpp.

             :
_hf( GeoHeightField::INVALID ),
_units( Units::METERS ),
_valid( false )
{
    //nop
}

Member Function Documentation

const std::string& osgEarth::Geoid::getName ( ) const [inline]

Definition at line 426 of file GeoData.

{ return _name; }

Here is the caller graph for this function:

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;
}

Here is the call graph for this function:

const Units& osgEarth::Geoid::getUnits ( ) const [inline]

The linear units in which height values are expressed.

Definition at line 437 of file GeoData.

{ return _units; }
bool Geoid::isEquivalentTo ( const Geoid rhs) const

True if two geoids are mathmatically equivalent.

Definition at line 1202 of file GeoData.cpp.

{
    // weak..
    return
        _valid &&
        _name == rhs._name &&
        _hf.getExtent() == rhs._hf.getExtent() &&
        _units == rhs._units;
}

Here is the call graph for this function:

bool osgEarth::Geoid::isValid ( ) const [inline]

Whether this is a valid object to use

Definition at line 441 of file GeoData.

{ return _valid; }
void Geoid::setHeightField ( const GeoHeightField hf)

Sets the underlying heightfield data

Definition at line 1148 of file GeoData.cpp.

{
    _hf = hf;
    validate();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Geoid::setName ( const std::string &  value)

Gets the readable name of this geoid.

Definition at line 1141 of file GeoData.cpp.

{
    _name = name;
    validate();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Geoid::setUnits ( const Units value)

Definition at line 1155 of file GeoData.cpp.

{
    _units = units;
    validate();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 448 of file GeoData.

std::string osgEarth::Geoid::_name [private]

Definition at line 447 of file GeoData.

Definition at line 449 of file GeoData.

bool osgEarth::Geoid::_valid [private]

Definition at line 450 of file GeoData.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines