osgEarth 2.1.1
Public Member Functions | Private Attributes

seamless::QscFaceLocator Class Reference

Inheritance diagram for seamless::QscFaceLocator:
Collaboration diagram for seamless::QscFaceLocator:

List of all members.

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

Detailed Description

osgTerrain locator for positioning data on the terrain using a cube-face coordinate system.

Definition at line 86 of file QSC.


Constructor & Destructor Documentation

seamless::QscFaceLocator::QscFaceLocator ( unsigned int  face) [inline]

Definition at line 89 of file QSC.

        : _face(face)
    {
    }

Member Function Documentation

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;
}

Here is the call graph for this function:

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;
}

Here is the call graph for this function:


Member Data Documentation

unsigned int seamless::QscFaceLocator::_face [private]

Definition at line 103 of file QSC.


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