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

osgEarth::GeoLocator Class Reference

Inheritance diagram for osgEarth::GeoLocator:
Collaboration diagram for osgEarth::GeoLocator:

List of all members.

Public Member Functions

 GeoLocator ()
 GeoLocator (const GeoExtent &dataExtent)
 GeoLocator (const osgTerrain::Locator &prototype, const GeoExtent &dataExtent)
 GeoLocator (const osgTerrain::Locator &prototype, const GeoExtent &dataExtent, const GeoExtent &displayExtent)
void setDataExtent (const GeoExtent &extent)
const GeoExtentgetDataExtent () const
virtual GeoLocatorcloneAndCrop (const osgTerrain::Locator &prototype, const GeoExtent &displayExtent) const
virtual GeoLocatorgetGeographicFromGeocentric () const
virtual bool isEquivalentTo (const GeoLocator &rhs) const
virtual bool convertModelToLocal (const osg::Vec3d &world, osg::Vec3d &local) const

Static Public Member Functions

static GeoLocatorcreateForKey (const class TileKey &key, const class MapInfo &mapInfo)
static GeoLocatorcreateForExtent (const GeoExtent &extent, const class MapInfo &mapInfo)

Protected Member Functions

void cropLocal (osg::Vec3d &local) const

Protected Attributes

bool _inverseCalculated

Private Attributes

GeoExtent _dataExtent
double _x0
double _y0
double _x1
double _y1

Detailed Description

Locator that stores the extent of its source data (which might be different than the extent of the locator's transform). This locator can also automatically crop out a section of the source image.

Definition at line 34 of file Locators.


Constructor & Destructor Documentation

GeoLocator::GeoLocator ( )

Definition at line 27 of file Locators.cpp.

                       :
_inverseCalculated(false),
_x0(0.0), _x1(1.0),
_y0(0.0), _y1(1.0)
{
    this->setThreadSafeRefUnref(true);
}

Here is the caller graph for this function:

GeoLocator::GeoLocator ( const GeoExtent dataExtent)

Definition at line 35 of file Locators.cpp.

                                                    :
_inverseCalculated(false),
_dataExtent( dataExtent ),
_x0(0.0), _x1(1.0),
_y0(0.0), _y1(1.0)
{
    this->setThreadSafeRefUnref(true);
}
GeoLocator::GeoLocator ( const osgTerrain::Locator &  prototype,
const GeoExtent dataExtent 
)

Definition at line 44 of file Locators.cpp.

                                                                                        :
osgTerrain::Locator( prototype ),
_inverseCalculated(false),
_dataExtent( dataExtent ),
_x0(0.0), _x1(1.0),
_y0(0.0), _y1(1.0)
{
    //nop
}
GeoLocator::GeoLocator ( const osgTerrain::Locator &  prototype,
const GeoExtent dataExtent,
const GeoExtent displayExtent 
)

Construct a locator that crops to a display extent.

Definition at line 54 of file Locators.cpp.

                                                                                                                        :
osgTerrain::Locator( prototype ),
_dataExtent( dataExtent ),
_inverseCalculated(false)
{
    // assume they are the same SRS
    _x0 = osg::clampBetween( (displayExtent.xMin()-dataExtent.xMin())/dataExtent.width(), 0.0, 1.0 );
    _x1 = osg::clampBetween( (displayExtent.xMax()-dataExtent.xMin())/dataExtent.width(), 0.0, 1.0 );
    _y0 = osg::clampBetween( (displayExtent.yMin()-dataExtent.yMin())/dataExtent.height(), 0.0, 1.0 );
    _y1 = osg::clampBetween( (displayExtent.yMax()-dataExtent.yMin())/dataExtent.height(), 0.0, 1.0 );
}

Here is the call graph for this function:


Member Function Documentation

GeoLocator * GeoLocator::cloneAndCrop ( const osgTerrain::Locator &  prototype,
const GeoExtent displayExtent 
) const [virtual]

Clones the current locator, applying a new display (i.e. crop) extent.

Definition at line 110 of file Locators.cpp.

{
    return new GeoLocator( prototype, _dataExtent, displayExtent );
}

Here is the call graph for this function:

bool GeoLocator::convertModelToLocal ( const osg::Vec3d &  world,
osg::Vec3d &  local 
) const [virtual]

Reimplemented in osgEarth::CubeFaceLocator, osgEarth::MercatorLocator, seamless::EulerFaceLocator, and seamless::QscFaceLocator.

Definition at line 117 of file Locators.cpp.

{
    // required becasue of an OSG bug
    if ( !_inverseCalculated )
    {
        const_cast<GeoLocator*>(this)->_inverse.invert( _transform );
        const_cast<GeoLocator*>(this)->_inverseCalculated = true;
    }

    bool ok = Locator::convertModelToLocal( world, local );

    //cropLocal( local );

    return ok;
}
GeoLocator * GeoLocator::createForExtent ( const GeoExtent extent,
const class MapInfo mapInfo 
) [static]

Definition at line 83 of file Locators.cpp.

{
    double xmin, ymin, xmax, ymax;
    extent.getBounds( xmin, ymin, xmax, ymax );

    // A locator will place the tile on the globe:
    GeoLocator* locator = extent.getSRS()->createLocator(
        extent.xMin(), extent.yMin(), extent.xMax(), extent.yMax(),
        map.isPlateCarre() );

    if ( map.isGeocentric() )
        locator->setCoordinateSystemType( osgTerrain::Locator::GEOCENTRIC );

    return locator;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GeoLocator * GeoLocator::createForKey ( const class TileKey key,
const class MapInfo mapInfo 
) [static]

Definition at line 76 of file Locators.cpp.

{    
    const GeoExtent& ex = key.getExtent();
    return createForExtent( ex, map );    
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GeoLocator::cropLocal ( osg::Vec3d &  local) const [protected]

Definition at line 134 of file Locators.cpp.

{
    // crop if necessary:
    local.x() = osg::clampBetween( _x0 + local.x()*(_x1 - _x0), 0.0, 1.0 );
    local.y() = osg::clampBetween( _y0 + local.y()*(_y1 - _y0), 0.0, 1.0 );
}
const GeoExtent & GeoLocator::getDataExtent ( ) const

Definition at line 105 of file Locators.cpp.

                                {
    return _dataExtent;
}

Here is the caller graph for this function:

GeoLocator * GeoLocator::getGeographicFromGeocentric ( ) const [virtual]

Definition at line 142 of file Locators.cpp.

{
    if (getCoordinateSystemType() == osgTerrain::Locator::GEOCENTRIC)
    {
        double xmin, ymin, xmax, ymax;
        getDataExtent().getBounds( xmin, ymin,  xmax, ymax );
        GeoLocator* geographic = new GeoLocator( getDataExtent() );
        geographic->setCoordinateSystemType( Locator::GEOGRAPHIC );
        geographic->setTransformAsExtents( xmin, ymin, xmax, ymax);
        return geographic;
    }
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool GeoLocator::isEquivalentTo ( const GeoLocator rhs) const [virtual]

Definition at line 67 of file Locators.cpp.

{
    return
        _transform == rhs._transform &&
        _coordinateSystemType == rhs._coordinateSystemType &&
        _cs == rhs._cs;
}

Here is the caller graph for this function:

void GeoLocator::setDataExtent ( const GeoExtent extent)

Definition at line 100 of file Locators.cpp.

                                                  {
    _dataExtent = value;
}

Member Data Documentation

Definition at line 68 of file Locators.

Definition at line 65 of file Locators.

double osgEarth::GeoLocator::_x0 [private]

Definition at line 69 of file Locators.

double osgEarth::GeoLocator::_x1 [private]

Definition at line 69 of file Locators.

double osgEarth::GeoLocator::_y0 [private]

Definition at line 69 of file Locators.

double osgEarth::GeoLocator::_y1 [private]

Definition at line 69 of file Locators.


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