osgEarth 2.1.1
|
Public Member Functions | |
LTPSpatialReference (void *handle, const osg::Vec3d &worldPointLLA) | |
virtual bool | isGeographic () const |
virtual bool | isProjected () const |
virtual bool | preTransform (double &x, double &y, double &z, void *context) const |
virtual bool | postTransform (double &x, double &y, double &z, void *context) const |
Protected Member Functions | |
void | _init () |
bool | _isEquivalentTo (const SpatialReference *srs) const |
Private Attributes | |
osg::Vec3d | _worldPointLLA |
osg::Matrixd | _local2world |
osg::Matrixd | _world2local |
Local Tangent Plane SRS. Please call SpatialReference::createLTP() to construct one of these.
Definition at line 34 of file LocalTangentPlane.
LTPSpatialReference::LTPSpatialReference | ( | void * | handle, |
const osg::Vec3d & | worldPointLLA | ||
) |
Definition at line 32 of file LocalTangentPlane.cpp.
: SpatialReference( handle, false ), _worldPointLLA ( worldPointLLA ) { //todo, set proper init string }
void LTPSpatialReference::_init | ( | ) | [protected, virtual] |
Reimplemented from osgEarth::SpatialReference.
Definition at line 40 of file LocalTangentPlane.cpp.
{ SpatialReference::_init(); _is_user_defined = true; _is_contiguous = true; _is_ltp = true; _is_geographic = false; _name = "ENU Local Tangent Plane"; // set up the LTP matrixes. getEllipsoid()->computeLocalToWorldTransformFromLatLongHeight( osg::DegreesToRadians(_worldPointLLA.y()), osg::DegreesToRadians(_worldPointLLA.x()), _worldPointLLA.z(), _local2world); _world2local.invert( _local2world ); }
bool LTPSpatialReference::_isEquivalentTo | ( | const SpatialReference * | srs | ) | const [protected, virtual] |
Reimplemented from osgEarth::SpatialReference.
Definition at line 86 of file LocalTangentPlane.cpp.
{ return srs->isLTP() && _worldPointLLA == static_cast<const LTPSpatialReference*>(srs)->_worldPointLLA ; // todo: check the reference ellipsoids }
virtual bool osgEarth::LTPSpatialReference::isGeographic | ( | ) | const [inline, virtual] |
True is this is a geographic SRS (i.e. unprojected lat/long)
Reimplemented from osgEarth::SpatialReference.
Definition at line 40 of file LocalTangentPlane.
{ return false; }
virtual bool osgEarth::LTPSpatialReference::isProjected | ( | ) | const [inline, virtual] |
True if this is a projected SRS (i.e. local coordinate system)
Reimplemented from osgEarth::SpatialReference.
Definition at line 41 of file LocalTangentPlane.
{ return true; }
bool LTPSpatialReference::postTransform | ( | double & | x, |
double & | y, | ||
double & | z, | ||
void * | context | ||
) | const [virtual] |
Reimplemented from osgEarth::SpatialReference.
Definition at line 74 of file LocalTangentPlane.cpp.
{ osg::Vec3d world; getEllipsoid()->convertLatLongHeightToXYZ( osg::DegreesToRadians(y), osg::DegreesToRadians(x), z, world.x(), world.y(), world.z() ); osg::Vec3d local = world * _world2local; x = local.x(), y = local.y(), z = local.z(); return true; }
bool LTPSpatialReference::preTransform | ( | double & | x, |
double & | y, | ||
double & | z, | ||
void * | context | ||
) | const [virtual] |
Reimplemented from osgEarth::SpatialReference.
Definition at line 62 of file LocalTangentPlane.cpp.
{ osg::Vec3d world = osg::Vec3d(x,y,z) * _local2world; double lat, lon, height; getEllipsoid()->convertXYZToLatLongHeight(world.x(), world.y(), world.z(), lat, lon, height); x = osg::RadiansToDegrees(lon); y = osg::RadiansToDegrees(lat); z = height; return true; }
osg::Matrixd osgEarth::LTPSpatialReference::_local2world [private] |
Definition at line 57 of file LocalTangentPlane.
osg::Matrixd osgEarth::LTPSpatialReference::_world2local [private] |
Definition at line 57 of file LocalTangentPlane.
osg::Vec3d osgEarth::LTPSpatialReference::_worldPointLLA [private] |
Definition at line 56 of file LocalTangentPlane.