osgEarth 2.1.1
|
Public Member Functions | |
QscFaceLocator (unsigned int face) | |
bool | convertLocalToModel (const osg::Vec3d &local, osg::Vec3d &world) const |
bool | convertModelToLocal (const osg::Vec3d &world, osg::Vec3d &local) const |
Private Attributes | |
unsigned int | _face |
osgTerrain locator for positioning data on the terrain using a cube-face coordinate system.
seamless::QscFaceLocator::QscFaceLocator | ( | unsigned int | face | ) | [inline] |
bool seamless::QscFaceLocator::convertLocalToModel | ( | const osg::Vec3d & | local, |
osg::Vec3d & | world | ||
) | const |
Definition at line 503 of file Euler.cpp.
{ #if ((OPENSCENEGRAPH_MAJOR_VERSION <= 2) && (OPENSCENEGRAPH_MINOR_VERSION < 8)) // OSG 2.7 bug workaround: bug fix in Locator submitted by GW const_cast<EulerFaceLocator*>(this)->_inverse.invert( _transform ); #endif if ( _coordinateSystemType == GEOCENTRIC ) { //Convert the NDC coordinate into face space osg::Vec3d faceCoord = local * _transform; double lat_deg, lon_deg; faceCoordsToLatLon(faceCoord.x(), faceCoord.y(), _face, lat_deg, lon_deg); //OE_NOTICE << "LatLon=" << latLon << std::endl; // convert to geocentric: _ellipsoidModel->convertLatLongHeightToXYZ( DegreesToRadians(lat_deg), DegreesToRadians(lon_deg), local.z(), world.x(), world.y(), world.z()); return true; } return true; }
bool seamless::QscFaceLocator::convertModelToLocal | ( | const osg::Vec3d & | world, |
osg::Vec3d & | local | ||
) | const [virtual] |
Reimplemented from osgEarth::GeoLocator.
Definition at line 532 of file Euler.cpp.
{ #if ((OPENSCENEGRAPH_MAJOR_VERSION <= 2) && (OPENSCENEGRAPH_MINOR_VERSION < 8)) // OSG 2.7 bug workaround: bug fix in Locator submitted by GW const_cast<EulerFaceLocator*>(this)->_inverse.invert( _transform ); #endif switch(_coordinateSystemType) { case(GEOCENTRIC): { double longitude, latitude, height; _ellipsoidModel->convertXYZToLatLongHeight (world.x(), world.y(), world.z(), latitude, longitude, height ); int face=-1; double x, y; double lat_deg = RadiansToDegrees(latitude); double lon_deg = RadiansToDegrees(longitude); bool success = latLonToFaceCoords(lat_deg, lon_deg, x, y, face, _face); if (!success) { OE_NOTICE << LC << "Couldn't convert to face coords\n"; } if (face != static_cast<int>(_face)) { OE_NOTICE << LC << "Face should be " << _face << " but is " << face << ", lat = " << lat_deg << ", lon = " << lon_deg << "\n"; } local = Vec3d(x, y, height) * _inverse; return true; } case(GEOGRAPHIC): case(PROJECTED): // Neither of these is supported for this locator.. { local = world * _inverse; return true; } } return false; }
unsigned int seamless::QscFaceLocator::_face [private] |