Completed changes to osgManipulator to make it more flexible w.r.t viewer usage, and

ported osgmanipulator example across of osgViewer
This commit is contained in:
Robert Osfield
2007-02-26 13:01:17 +00:00
parent 42689e83ef
commit 7f8f4e331a
15 changed files with 270 additions and 202 deletions

View File

@@ -301,6 +301,23 @@ void DriveManipulator::init(const GUIEventAdapter& ea,GUIActionAdapter& us)
bool DriveManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us)
{
switch(ea.getEventType())
{
case(GUIEventAdapter::FRAME):
addMouseEvent(ea);
if (calcMovement()) us.requestRedraw();
return false;
case(GUIEventAdapter::RESIZE):
init(ea,us);
us.requestRedraw();
return true;
default:
break;
}
if (ea.getHandled()) return false;
switch(ea.getEventType())
{
case(GUIEventAdapter::PUSH):
@@ -399,22 +416,6 @@ bool DriveManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us)
return false;
}
_pitchDownKeyPressed = false;
case(GUIEventAdapter::FRAME):
{
addMouseEvent(ea);
if (calcMovement()) us.requestRedraw();
return false;
}
case(GUIEventAdapter::RESIZE):
{
init(ea,us);
us.requestRedraw();
return true;
}
default:
return false;
}

View File

@@ -91,6 +91,23 @@ void FlightManipulator::init(const GUIEventAdapter& ea,GUIActionAdapter& us)
bool FlightManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us)
{
switch(ea.getEventType())
{
case(GUIEventAdapter::FRAME):
addMouseEvent(ea);
if (calcMovement()) us.requestRedraw();
return false;
case(GUIEventAdapter::RESIZE):
init(ea,us);
us.requestRedraw();
return true;
default:
break;
}
if (ea.getHandled()) return false;
switch(ea.getEventType())
{
case(GUIEventAdapter::PUSH):
@@ -152,15 +169,6 @@ bool FlightManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us)
}
return false;
}
case(GUIEventAdapter::FRAME):
addMouseEvent(ea);
if (calcMovement()) us.requestRedraw();
return false;
case(GUIEventAdapter::RESIZE):
init(ea,us);
us.requestRedraw();
return true;
default:
return false;

View File

@@ -74,6 +74,20 @@ void TrackballManipulator::getUsage(osg::ApplicationUsage& usage) const
bool TrackballManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us)
{
switch(ea.getEventType())
{
case(GUIEventAdapter::FRAME):
if (_thrown)
{
if (calcMovement()) us.requestRedraw();
}
return false;
default:
break;
}
if (ea.getHandled()) return false;
switch(ea.getEventType())
{
case(GUIEventAdapter::PUSH):
@@ -155,6 +169,7 @@ bool TrackballManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us
default:
return false;
}
return false;
}

View File

@@ -189,6 +189,16 @@ void UFOManipulator::home(double)
bool UFOManipulator::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter &aa)
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::FRAME):
_frame(ea,aa);
return false;
default:
break;
}
if (ea.getHandled()) return false;
switch(ea.getEventType())
{