本文整理汇总了C++中osgga::GUIActionAdapter::requestRedraw方法的典型用法代码示例。如果您正苦于以下问题:C++ GUIActionAdapter::requestRedraw方法的具体用法?C++ GUIActionAdapter::requestRedraw怎么用?C++ GUIActionAdapter::requestRedraw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osgga::GUIActionAdapter
的用法示例。
在下文中一共展示了GUIActionAdapter::requestRedraw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool Vwr::CameraManipulator::handleRelease(const osgGA::GUIEventAdapter& ea,
osgGA::GUIActionAdapter& us) {
if (ea.getButtonMask() == 0) {
double timeSinceLastRecordEvent = _ga_t0.valid() ? (ea.getTime()
- _ga_t0->getTime()) : DBL_MAX;
if (timeSinceLastRecordEvent > 0.02)
flushMouseEventStack();
if (isMouseMoving()) {
if (calcMovement()) {
us.requestRedraw();
us.requestContinuousUpdate(true);
_thrown = _allowThrow;
}
} else {
flushMouseEventStack();
addMouseEvent(ea);
if (calcMovement())
us.requestRedraw();
us.requestContinuousUpdate(false);
_thrown = false;
}
} else {
flushMouseEventStack();
addMouseEvent(ea);
if (calcMovement())
us.requestRedraw();
us.requestContinuousUpdate(false);
_thrown = false;
}
return true;
}
示例2: if
bool
RTTPicker::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{
if ( ea.getEventType() == ea.FRAME )
{
osg::FrameStamp* fs = aa.asView() ? aa.asView()->getFrameStamp() : 0L;
if ( fs )
{
runPicks( fs->getFrameNumber() );
}
// if there are picks in the queue, need to continuing rendering:
if ( !_picks.empty() )
{
aa.requestRedraw();
}
}
else if ( _defaultCallback.valid() && _defaultCallback->accept(ea, aa) )
{
pick( aa.asView(), ea.getX(), ea.getY(), _defaultCallback.get() );
aa.requestRedraw();
}
return false;
}
示例3: handleMouseWheel
bool OrbitCameraManipulator::handleMouseWheel( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
osgGA::GUIEventAdapter::ScrollingMotion sm = ea.getScrollingMotion();
// TODO: increase scroll factor when eye is far away from model bounding sphere
double scroll_distance_factor = ( m_eye - m_rotate_center ).length()*0.1;
switch( sm )
{
// mouse scroll up event
case osgGA::GUIEventAdapter::SCROLL_UP:
{
// perform zoom
zoomCamera( m_wheel_zoom_factor*scroll_distance_factor );
aa.requestRedraw();
aa.requestContinuousUpdate( isAnimating() || _thrown );
return true;
}
// mouse scroll down event
case osgGA::GUIEventAdapter::SCROLL_DOWN:
{
// perform zoom
zoomCamera( -m_wheel_zoom_factor*scroll_distance_factor );
aa.requestRedraw();
aa.requestContinuousUpdate( isAnimating() || _thrown );
return true;
}
// unhandled mouse scrolling motion
default:
return false;
}
}
示例4: handleMouseWheel
bool TerrainZoomManipulator::handleMouseWheel( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us )
{
// no zooming by intersection is choosed
if (! (_flags & 0x08))
{
setCenterByMousePointer(ea, us);
}
switch( ea.getScrollingMotion() )
{
// mouse scroll up event
case osgGA::GUIEventAdapter::SCROLL_UP:
{
// perform zoom
zoomModel( _wheelZoomFactor, true );
us.requestRedraw();
us.requestContinuousUpdate( isAnimating() || _thrown );
return true;
}
// mouse scroll down event
case osgGA::GUIEventAdapter::SCROLL_DOWN:
zoomModel( -_wheelZoomFactor, true );
us.requestRedraw();
us.requestContinuousUpdate( false );
return true;
// unhandled mouse scrolling motion
default:
return false;
}
}
示例5: handle
bool Dragger::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{
if (ea.getHandled()) return false;
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
if (!view) return false;
if (ea.getEventType() == osgGA::GUIEventAdapter::PUSH)
{
Picker picker( view, this );
Picker::Hits hits;
if ( picker.pick( ea.getX(), ea.getY(), hits ) )
{
_dragging = true;
aa.requestRedraw();
return true;
}
}
else if (ea.getEventType() == osgGA::GUIEventAdapter::RELEASE)
{
_dragging = false;
aa.requestRedraw();
}
else if (ea.getEventType() == osgGA::GUIEventAdapter::DRAG)
{
if (_dragging)
{
osg::Vec3d world;
if ( _mapNode->getTerrain()->getWorldCoordsUnderMouse(view, ea.getX(), ea.getY(), world) )
{
GeoPoint mapPoint;
_mapNode->getMap()->worldPointToMapPoint(world, mapPoint);
setPosition( mapPoint );
aa.requestRedraw();
return true;
}
}
}
else if (ea.getEventType() == osgGA::GUIEventAdapter::MOVE)
{
Picker picker( view, this );
Picker::Hits hits;
if ( picker.pick( ea.getX(), ea.getY(), hits ) )
{
setHover( true );
}
else
{
setHover( false );
}
aa.requestRedraw();
}
return false;
}
示例6: handleMouseRelease
bool OrbitCameraManipulator::handleMouseRelease( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
if( !view ) return false;
if( ea.getButtonMask() == 0 )
{
double timeSinceLastRecordEvent = _ga_t0.valid() ? (ea.getTime() - _ga_t0->getTime()) : DBL_MAX;
if( timeSinceLastRecordEvent > 0.02 )
{
flushMouseEventStack();
}
if( isMouseMoving() )
{
if( performMovement( ea, aa ) && _allowThrow )
{
aa.requestRedraw();
aa.requestContinuousUpdate( true );
_thrown = true;
// TODO: fade out throw animation
}
return true;
}
}
if( !m_pointer_push_drag )
{
// select object
bool intersection_geometry_found = intersectSceneSelect( ea, view );
if( !intersection_geometry_found )
{
// click to background -> unselect all
if( m_system != nullptr )
{
m_system->clearSelection();
}
}
}
m_pointer_push_drag = false;
flushMouseEventStack();
addMouseEvent( ea );
if( performMovement( ea, aa ) )
{
aa.requestRedraw();
}
aa.requestContinuousUpdate( false );
_thrown = false;
return true;
}
示例7: home
void UFOManipulator::home(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us)
{
home(ea.getTime());
us.requestRedraw();
us.requestContinuousUpdate(false);
}
示例8:
bool Vwr::CameraManipulator::handlePush(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us)
{
if (ea.getButtonMask() == GUIEventAdapter::MIDDLE_MOUSE_BUTTON)
{
if (_distance != 0)
{
lastDistance = _distance;
osg::Vec3d eye, cameraCenter, up;
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>( &us );
viewer->getCamera()->getViewMatrixAsLookAt(eye, cameraCenter, up);
_center = eye;
_distance = 0;
}
else
{
_distance = lastDistance;
}
return true;
}
else
{
flushMouseEventStack();
addMouseEvent(ea);
if (calcMovement()) us.requestRedraw();
us.requestContinuousUpdate(false);
_thrown = false;
return true;
}
}
示例9: handle
bool StatsHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
{
if (ea.getHandled()) return false;
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getKey()== _key)
{
osgViewer::View* myview = dynamic_cast<osgViewer::View*>(&aa);
if (!myview) return false;
osgViewer::ViewerBase* viewer = myview->getViewerBase();
toggle(viewer);
aa.requestRedraw();
return true;
}
break;
}
case osgGA::GUIEventAdapter::RESIZE:
{
setWindowSize(ea.getWindowWidth(), ea.getWindowHeight());
break;
}
default:
break;
}
return false;
}
示例10: handleMouseWheel
bool GISManipulator::handleMouseWheel( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us )
{
osgGA::GUIEventAdapter::ScrollingMotion sm = ea.getScrollingMotion();
osg::Vec3d eye, center, up;
getTransformation( eye, center, up );
double altitude = eye[2];
if ( sm == osgGA::GUIEventAdapter::SCROLL_UP ) {
altitude /= 1.41;
}
else if ( sm == osgGA::GUIEventAdapter::SCROLL_DOWN ) {
altitude *= 1.41;
}
else {
return false;
}
eye[2] = altitude;
center[2] = eye[2] - 1.0;
setTransformation( eye, center, up );
us.requestRedraw();
us.requestContinuousUpdate( isAnimating() );
return true;
}
示例11: handle
bool CameraManipulator::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us)
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::FRAME):
{
return handleFrame(ea, us);
}
default:
break;
}
if (ea.getHandled()) return false;
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::PUSH):
{
return handlePush(ea, us);
}
case(osgGA::GUIEventAdapter::RELEASE):
{
return handleRelease(ea, us);
}
case(osgGA::GUIEventAdapter::DRAG):
case(osgGA::GUIEventAdapter::SCROLL):
{
return handleScroll(ea, us);
}
case(osgGA::GUIEventAdapter::MOVE):
{
return false;
}
case(osgGA::GUIEventAdapter::KEYDOWN):
{
return handleKeyDown(ea, us);
}
case(osgGA::GUIEventAdapter::KEYUP):
{
return handleKeyUp( ea, us );
}
case(osgGA::GUIEventAdapter::FRAME):
{
if (_thrown)
{
if (calcMovement()) us.requestRedraw();
}
return false;
}
default:
return false;
}
}
示例12: handleMousePush
bool ThirdPersonCameraManipulator::handleMousePush( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
/// At the moment, OSG doesn't have support for extra mouse buttons, but I plan to add that later, at which point you'll be able to zoom with the forwards and backwards buttons (if you have them)
switch(ea.getButton())
{
#ifdef SUPPORTS_EXTRA_MOUSE_BUTTONS
case osgGA::GUIEventAdapter::FORWARD_MOUSE_BUTTON :
zoom(_zoomFactor);
aa.requestRedraw();
return true;
case osgGA::GUIEventAdapter::BACKWARD_MOUSE_BUTTON :
zoom(-_zoomFactor);
aa.requestRedraw();
return true;
#endif
default:
return false;
}
return false;
}
示例13: handle
bool LODScaleHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
osg::Camera* camera = view ? view->getCamera() : 0;
if (!camera) return false;
if (ea.getHandled()) return false;
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYUP):
{
if (ea.getKey() == _keyEventIncreaseLODScale)
{
camera->setLODScale(camera->getLODScale()*1.1);
OSG_NOTICE<<"LODScale = "<<camera->getLODScale()<<std::endl;
aa.requestRedraw();
return true;
}
else if (ea.getKey() == _keyEventDecreaseLODScale)
{
camera->setLODScale(camera->getLODScale()/1.1);
OSG_NOTICE<<"LODScale = "<<camera->getLODScale()<<std::endl;
aa.requestRedraw();
return true;
}
break;
}
default:
break;
}
return false;
}
示例14: handleMouseDrag
bool OrbitCameraManipulator::handleMouseDrag( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
addMouseEvent( ea );
m_pointer_push_drag = true;
if( performMovement( ea, aa ) )
{
aa.requestRedraw();
}
aa.requestContinuousUpdate( false );
_thrown = false;
return true;
}
示例15: performAnimationMovement
bool OrbitCameraManipulator::performAnimationMovement( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
double f = (ea.getTime() - m_animation_data->_startTime) / m_animation_data->_animationTime;
if( f >= 1. )
{
f = 1.;
m_animation_data->_isAnimating = false;
if( !_thrown )
aa.requestContinuousUpdate( false );
}
applyAnimationStep( f, m_animation_data->_phase );
m_animation_data->_phase = f;
aa.requestRedraw();
return m_animation_data->_isAnimating;
}