|
osgEarth 2.1.1
|
Public Member Functions | |
| ImageOverlayDraggerCallback (ImageOverlay *overlay, const osg::EllipsoidModel *ellipsoid, ImageOverlay::ControlPoint controlPoint) | |
| osg::Vec2d | getLocation (const osg::Matrixd &matrix) |
| virtual bool | receive (const osgManipulator::MotionCommand &command) |
Public Attributes | |
| osg::ref_ptr< const osg::EllipsoidModel > | _ellipsoid |
| osg::ref_ptr< ImageOverlay > | _overlay |
| osg::Matrix | _startMotionMatrix |
| ImageOverlay::ControlPoint | _controlPoint |
| osg::Matrix | _localToWorld |
| osg::Matrix | _worldToLocal |
Definition at line 14 of file ImageOverlayEditor.cpp.
| ImageOverlayDraggerCallback::ImageOverlayDraggerCallback | ( | ImageOverlay * | overlay, |
| const osg::EllipsoidModel * | ellipsoid, | ||
| ImageOverlay::ControlPoint | controlPoint | ||
| ) | [inline] |
Definition at line 17 of file ImageOverlayEditor.cpp.
:
_overlay(overlay),
_ellipsoid(ellipsoid),
_controlPoint(controlPoint)
{}
| osg::Vec2d ImageOverlayDraggerCallback::getLocation | ( | const osg::Matrixd & | matrix | ) | [inline] |
Definition at line 23 of file ImageOverlayEditor.cpp.
{
osg::Vec3d trans = matrix.getTrans();
double lat, lon, height;
_ellipsoid->convertXYZToLatLongHeight(trans.x(), trans.y(), trans.z(), lat, lon, height);
return osg::Vec2d(osg::RadiansToDegrees(lon), osg::RadiansToDegrees(lat));
}
| virtual bool ImageOverlayDraggerCallback::receive | ( | const osgManipulator::MotionCommand & | command | ) | [inline, virtual] |
Definition at line 32 of file ImageOverlayEditor.cpp.
{
switch (command.getStage())
{
case osgManipulator::MotionCommand::START:
{
// Save the current matrix
osg::Vec2d startLocation = _overlay->getControlPoint(_controlPoint);
double x, y, z;
_ellipsoid->convertLatLongHeightToXYZ(osg::DegreesToRadians(startLocation.y()), osg::DegreesToRadians(startLocation.x()), 0, x, y, z);
_startMotionMatrix = osg::Matrixd::translate(x, y, z);
// Get the LocalToWorld and WorldToLocal matrix for this node.
osg::NodePath nodePathToRoot;
_localToWorld = osg::Matrixd::identity();
_worldToLocal = osg::Matrixd::identity();
return true;
}
case osgManipulator::MotionCommand::MOVE:
{
// Transform the command's motion matrix into local motion matrix.
osg::Matrix localMotionMatrix = _localToWorld * command.getWorldToLocal()
* command.getMotionMatrix()
* command.getLocalToWorld() * _worldToLocal;
osg::Matrixd newMatrix = localMotionMatrix * _startMotionMatrix;
osg::Vec2d location = getLocation( newMatrix );
_overlay->setControlPoint(_controlPoint, location.x(), location.y());
return true;
}
case osgManipulator::MotionCommand::FINISH:
{
return true;
}
case osgManipulator::MotionCommand::NONE:
default:
return false;
}
}
Definition at line 79 of file ImageOverlayEditor.cpp.
| osg::ref_ptr<const osg::EllipsoidModel> ImageOverlayDraggerCallback::_ellipsoid |
Definition at line 75 of file ImageOverlayEditor.cpp.
| osg::Matrix ImageOverlayDraggerCallback::_localToWorld |
Definition at line 81 of file ImageOverlayEditor.cpp.
| osg::ref_ptr<ImageOverlay> ImageOverlayDraggerCallback::_overlay |
Definition at line 76 of file ImageOverlayEditor.cpp.
| osg::Matrix ImageOverlayDraggerCallback::_startMotionMatrix |
Definition at line 78 of file ImageOverlayEditor.cpp.
| osg::Matrix ImageOverlayDraggerCallback::_worldToLocal |
Definition at line 82 of file ImageOverlayEditor.cpp.
1.7.3