| osgEarth 2.1.1 | 
 Inheritance diagram for osgEarth::VerticalSpatialReference:
 Inheritance diagram for osgEarth::VerticalSpatialReference: Collaboration diagram for osgEarth::VerticalSpatialReference:
 Collaboration diagram for osgEarth::VerticalSpatialReference:| Public Types | |
| typedef std::map< std::string, osg::ref_ptr< const Geoid > > | GeoidRegistry | 
| Public Member Functions | |
| bool | transform (const VerticalSpatialReference *toVSRS, double lat_deg, double lon_deg, double z, double &out_z) const | 
| bool | canTransform (const VerticalSpatialReference *toVSRS) const | 
| osg::HeightField * | createReferenceHeightField (const GeoExtent &extent, int cols, int rows) const | 
| const std::string & | getName () const | 
| const Units & | getUnits () const | 
| const std::string & | getInitString () const | 
| virtual bool | isEquivalentTo (const VerticalSpatialReference *rhs) const | 
| VerticalSpatialReference (const std::string &name, const std::string &initString, const Geoid *geoid) | |
| VerticalSpatialReference (const Units &units) | |
| Static Public Member Functions | |
| static VerticalSpatialReference * | create (const std::string &init) | 
| static void | registerGeoid (const Geoid *geoid) | 
| static bool | canTransform (const VerticalSpatialReference *from, const VerticalSpatialReference *toVSRS) | 
| Public Attributes | |
| std::string | _name | 
| std::string | _initString | 
| osg::ref_ptr< const Geoid > | _geoid | 
| Units | _units | 
| Static Public Attributes | |
| static GeoidRegistry * | _geoidRegistry = 0L | 
Reference information for vertical (height) information.
Definition at line 34 of file VerticalSpatialReference.
| typedef std::map<std::string, osg::ref_ptr<const Geoid> > osgEarth::VerticalSpatialReference::GeoidRegistry | 
Definition at line 103 of file VerticalSpatialReference.
| VerticalSpatialReference::VerticalSpatialReference | ( | const std::string & | name, | 
| const std::string & | initString, | ||
| const Geoid * | geoid | ||
| ) | 
Creates a geoid-based VSRS.
Definition at line 75 of file VerticalSpatialReference.cpp.
: _name( name ), _initString( initString ), _geoid( geoid ), _units( Units::METERS ) { if ( _geoid.valid() ) _units = _geoid->getUnits(); }
 Here is the caller graph for this function:
 Here is the caller graph for this function:| VerticalSpatialReference::VerticalSpatialReference | ( | const Units & | units | ) | 
Creates a simple ellipsoidal VSRS.
Definition at line 87 of file VerticalSpatialReference.cpp.
: _name( units.getName() ), _initString( units.getName() ), _units( units ) { //nop }
| bool VerticalSpatialReference::canTransform | ( | const VerticalSpatialReference * | toVSRS | ) | const | 
Returns true if transformation from this VSRS to the target VSRS is both possible and necessary.
Definition at line 96 of file VerticalSpatialReference.cpp.
{
    return toVSRS && !isEquivalentTo( toVSRS );
}
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| bool VerticalSpatialReference::canTransform | ( | const VerticalSpatialReference * | from, | 
| const VerticalSpatialReference * | toVSRS | ||
| ) |  [static] | 
Returns true if transformation from one VRS to another is possible and necessary
Definition at line 102 of file VerticalSpatialReference.cpp.
{
    return fromVSRS && fromVSRS->canTransform( toVSRS );
}
 Here is the call graph for this function:
 Here is the call graph for this function:| VerticalSpatialReference * VerticalSpatialReference::create | ( | const std::string & | init | ) |  [static] | 
Creates an V-SRS from an initialization string.
Definition at line 33 of file VerticalSpatialReference.cpp.
{
    static OpenThreads::Mutex s_mutex;
    OpenThreads::ScopedLock<OpenThreads::Mutex> exclusiveLock(s_mutex);
    if ( !_geoidRegistry )
    {
        // initialize the registry the first time through.
        registerGeoid( new EGM96Geoid() );
    }
    std::string s = toLower( initString );
    GeoidRegistry::const_iterator i = (*_geoidRegistry).find( s );
    if ( i != (*_geoidRegistry).end() )
    {
        const Geoid* geoid = i->second.get();
        return new VerticalSpatialReference( geoid->getName(), initString, geoid );
    }
    else if ( s == "meters" || s == "metres" || s == "meter" || s == "metre" )
        return new VerticalSpatialReference( Units::METERS );
    else if ( startsWith( s, "feet" ) || startsWith( s, "foot" ) )
        return new VerticalSpatialReference( Units::FEET );
    return 0L;
}
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| osg::HeightField * VerticalSpatialReference::createReferenceHeightField | ( | const GeoExtent & | extent, | 
| int | cols, | ||
| int | rows | ||
| ) | const | 
Creates a heightfield containing the "zero" refernce values relative to the ellipsoid. For a vanilla ellipsoidal VSRS, the HF will be all zeros. for an orthometric (geoid) VSRS, it will contain the raw geoid offsets.
Definition at line 151 of file VerticalSpatialReference.cpp.
{
    osg::HeightField* hf = new osg::HeightField();
    hf->allocate( numCols, numRows );
    hf->setOrigin( osg::Vec3d( ex.xMin(), ex.yMin(), 0.0 ) );
    hf->setXInterval( (ex.xMax() - ex.xMin())/(double)(numCols-1) );
    hf->setYInterval( (ex.yMax() - ex.yMin())/(double)(numRows-1) );
    if ( _geoid.valid() && _geoid->isValid() )
    {
        // need the lat/long extent for geoid queries:
        GeoExtent geodeticExtent = ex.getSRS()->isGeographic() ? ex : ex.transform( ex.getSRS()->getGeographicSRS() );
        double latMin = geodeticExtent.yMin();
        double lonMin = geodeticExtent.xMin();
        double lonInterval = geodeticExtent.width() / (double)(numCols-1);
        double latInterval = geodeticExtent.height() / (double)(numRows-1);
        for( int r=0; r<numRows; ++r )
        {            
            double lat = latMin + latInterval*(double)r;
            for( int c=0; c<numCols; ++c )
            {
                double lon = lonMin + lonInterval*(double)c;
                double offset = _geoid->getOffset( lat, lon );
                hf->setHeight( c, r, offset );
            }
        }
    }
    else
    {
        for(unsigned int i=0; i<hf->getHeightList().size(); i++ )
            hf->getHeightList()[i] = 0.0;
    }
    hf->setBorderWidth( 0 );
    return hf;    
}
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| const std::string& osgEarth::VerticalSpatialReference::getInitString | ( | ) | const  [inline] | 
Gets the string that was used to initialize this SRS
Definition at line 83 of file VerticalSpatialReference.
{ return _initString; }
 Here is the caller graph for this function:
 Here is the caller graph for this function:| const std::string& osgEarth::VerticalSpatialReference::getName | ( | ) | const  [inline] | 
Gets the readable name of this SRS.
Definition at line 77 of file VerticalSpatialReference.
{ return _name; }
| const Units& osgEarth::VerticalSpatialReference::getUnits | ( | ) | const  [inline] | 
Gets the linear units of height values
Definition at line 80 of file VerticalSpatialReference.
{ return _units; }
 Here is the caller graph for this function:
 Here is the caller graph for this function:| bool VerticalSpatialReference::isEquivalentTo | ( | const VerticalSpatialReference * | rhs | ) | const  [virtual] | 
Tests this SRS for equivalence with another.
Definition at line 190 of file VerticalSpatialReference.cpp.
{
    if ( this == rhs )
        return true;
    if ( _units != rhs->_units )
        return false;
    if ( _geoid.valid() != rhs->_geoid.valid() )
        return false;
    
    if ( _geoid.valid() && !_geoid->isEquivalentTo( *rhs->_geoid.get() ) )
        return false;
    //TODO - add comparisons as necessary
    return true;
}
 Here is the caller graph for this function:
 Here is the caller graph for this function:| void VerticalSpatialReference::registerGeoid | ( | const Geoid * | geoid | ) |  [static] | 
Adds a new geoid to the VSRS registry. You can thereafter create a VSRS based on this geoid with the VSRS::create() method, passing in the name of the geoid.
Definition at line 61 of file VerticalSpatialReference.cpp.
{
    if ( !_geoidRegistry )
        _geoidRegistry = new GeoidRegistry();
    if ( geoid )
        (*_geoidRegistry)[geoid->getName()] = geoid;
}
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| bool VerticalSpatialReference::transform | ( | const VerticalSpatialReference * | toVSRS, | 
| double | lat_deg, | ||
| double | lon_deg, | ||
| double | z, | ||
| double & | out_z | ||
| ) | const | 
Transform a height value (at the specified lat/long location) to another VSRS. The output height value will be in "to_srs" units.
Definition at line 109 of file VerticalSpatialReference.cpp.
{    
    if ( this->isEquivalentTo( toSRS ) )
    {
        out_z = in_z;
    }
    else
    {
        double workZ = in_z;
        // transform out of the source VSRS (this):
        if ( _geoid.valid() )
        {
            if ( !_geoid->isValid() )
                return false;
            float offset = _geoid->getOffset( lat_deg, lon_deg, INTERP_BILINEAR );
            workZ -= offset;
        }
        // convert the value to output units:
        Units::convert( getUnits(), toSRS->getUnits(), workZ, workZ );
        // transform into the target VSRS:
        if ( toSRS->_geoid.valid() )
        {
            if ( !toSRS->_geoid->isValid() )
                return false;
        
            float offset = toSRS->_geoid->getOffset( lat_deg, lon_deg, INTERP_BILINEAR );
            workZ += offset;
        }
        out_z = workZ;
    }
    return true;
}
 Here is the call graph for this function:
 Here is the call graph for this function:| osg::ref_ptr<const Geoid> osgEarth::VerticalSpatialReference::_geoid | 
Definition at line 100 of file VerticalSpatialReference.
Definition at line 104 of file VerticalSpatialReference.
| std::string osgEarth::VerticalSpatialReference::_initString | 
Definition at line 99 of file VerticalSpatialReference.
| std::string osgEarth::VerticalSpatialReference::_name | 
Definition at line 98 of file VerticalSpatialReference.
Definition at line 101 of file VerticalSpatialReference.
 1.7.3
 1.7.3