osgEarth 2.1.1
|
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 GeoExtent & | getDataExtent () const |
virtual GeoLocator * | cloneAndCrop (const osgTerrain::Locator &prototype, const GeoExtent &displayExtent) const |
virtual GeoLocator * | getGeographicFromGeocentric () const |
virtual bool | isEquivalentTo (const GeoLocator &rhs) const |
virtual bool | convertModelToLocal (const osg::Vec3d &world, osg::Vec3d &local) const |
Static Public Member Functions | |
static GeoLocator * | createForKey (const class TileKey &key, const class MapInfo &mapInfo) |
static GeoLocator * | createForExtent (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 |
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.
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); }
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 ); }
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 ); }
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; }
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 ); }
void GeoLocator::cropLocal | ( | osg::Vec3d & | local | ) | const [protected] |
const GeoExtent & GeoLocator::getDataExtent | ( | ) | const |
Definition at line 105 of file Locators.cpp.
{ return _dataExtent; }
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; }
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;
}
void GeoLocator::setDataExtent | ( | const GeoExtent & | extent | ) |
Definition at line 100 of file Locators.cpp.
{ _dataExtent = value; }
GeoExtent osgEarth::GeoLocator::_dataExtent [private] |
bool osgEarth::GeoLocator::_inverseCalculated [protected] |
double osgEarth::GeoLocator::_x0 [private] |
double osgEarth::GeoLocator::_x1 [private] |
double osgEarth::GeoLocator::_y0 [private] |
double osgEarth::GeoLocator::_y1 [private] |