本文整理汇总了C++中osgga::GUIActionAdapter类的典型用法代码示例。如果您正苦于以下问题:C++ GUIActionAdapter类的具体用法?C++ GUIActionAdapter怎么用?C++ GUIActionAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GUIActionAdapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
/*!
*
* \param ea
* Adapter udalosti.
*
* Metoda spomali pohyb na zaklade zdroja prijatej udalosti.
*
*/
bool Vwr::CameraManipulator::handleKeyUp( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter & us)
{
switch( ea.getKey() )
{
case osgGA::GUIEventAdapter::KEY_Space:
{
flushMouseEventStack();
_thrown = false;
_distance = 1.0f;
home(ea,us);
us.requestRedraw();
us.requestContinuousUpdate(false);
stop();
break;
}
case osgGA::GUIEventAdapter::KEY_Up:
case osgGA::GUIEventAdapter::KEY_Down:
decelerateForwardRate = true;
break;
case osgGA::GUIEventAdapter::KEY_Right:
case osgGA::GUIEventAdapter::KEY_Left:
decelerateSideRate = true;
break;
case osgGA::GUIEventAdapter::KEY_Page_Up:
case osgGA::GUIEventAdapter::KEY_Page_Down:
decelerateVerticalRate = true;
break;
}
return true;
}
开发者ID:Cecko,项目名称:3dsoftviz,代码行数:42,代码来源:CameraManipulator.cpp
示例2: 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;
}
开发者ID:hjanetzek,项目名称:SFCGAL,代码行数:26,代码来源:GISManipulator.cpp
示例3: 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;
}
开发者ID:Karamaz0V1,项目名称:osgearth,代码行数:26,代码来源:RTTPicker.cpp
示例4: 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;
}
}
开发者ID:Supporting,项目名称:ifcplusplus,代码行数:34,代码来源:OrbitCameraManipulator.cpp
示例5: home
void UFOManipulator::home(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us)
{
home(ea.getTime());
us.requestRedraw();
us.requestContinuousUpdate(false);
}
开发者ID:aalex,项目名称:osg,代码行数:7,代码来源:UFOManipulator.cpp
示例6: 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;
}
}
开发者ID:arneboe,项目名称:gui-osgviz-osgviz,代码行数:34,代码来源:TerrainZoomManipulator.cpp
示例7: 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;
}
开发者ID:airwzz999,项目名称:osgearth-for-android,代码行数:56,代码来源:Draggers.cpp
示例8: 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;
}
开发者ID:Supporting,项目名称:ifcplusplus,代码行数:55,代码来源:OrbitCameraManipulator.cpp
示例9: switch
bool WeaponHUD::WeaponSwitchHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) {
switch (ea.getEventType()) {
case osgGA::GUIEventAdapter::SCROLL:
{
/*
* catches multiple activations of the weapon switching
* per frame because linux triggers keys twice
*/
if (_frameNumber == aa.asView()->getFrameStamp()->getFrameNumber()) {
return false;
}
_frameNumber = aa.asView()->getFrameStamp()->getFrameNumber();
//Debug message
OSG_ALWAYS << "SCROLL: " << aa.asView()->getFrameStamp()->getFrameNumber() << std::endl;
osgGA::GUIEventAdapter::ScrollingMotion sm = ea.getScrollingMotion();
switch (sm) {
/*
* switches backwards through weapon list when
* the mouse wheel is scrolled down
*/
case osgGA::GUIEventAdapter::SCROLL_DOWN:
//Debug message
OSG_ALWAYS << "SCROLL DOWN" << std::endl;
_switch->setValue(_curWeapon, false);
_curWeapon--;
/*
* if the first weapon is selected and another
* scroll backwards is triggered, the last weapon
* gets selected
*/
if (_curWeapon < 0)
_curWeapon = _switch->getNumChildren() - 1;
_curWeapon = _curWeapon % _switch->getNumChildren();
_switch->setValue(_curWeapon, true);
return true;
/*
* switches forward through weapon list when
* the mouse wheel is scrolled up
*/
case osgGA::GUIEventAdapter::SCROLL_UP:
//Debug message
OSG_ALWAYS << "SCROLL UP" << std::endl;
_switch->setValue(_curWeapon, false);
_curWeapon++;
_curWeapon = _curWeapon % _switch->getNumChildren();
_switch->setValue(_curWeapon, true);
return true;
default:
return false;
}
}
default:
return false;
}
}
开发者ID:goost,项目名称:BrainTrain,代码行数:55,代码来源:WeaponHUD.cpp
示例10: handle
bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
if (ea.getEventType() == osgGA::GUIEventAdapter::MOVE &&
aa.asView()->getFrameStamp()->getFrameNumber() % 10 == 0)
{
osgViewer::View* view = static_cast<osgViewer::View*>(aa.asView());
update( ea.getX(), ea.getY(), view );
}
return false;
}
开发者ID:Vantica,项目名称:osgearth,代码行数:11,代码来源:osgearth_elevation.cpp
示例11: 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;
}
开发者ID:Supporting,项目名称:ifcplusplus,代码行数:15,代码来源:OrbitCameraManipulator.cpp
示例12: handle
bool Start::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{
m_control->clearDrawing();
if ((ea.getEventType() == ea.PUSH) && (ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON))
{
m_control->clearDrawing();
osgUtil::LineSegmentIntersector::Intersections results;
osgViewer::View* view = static_cast<osgViewer::View*>(aa.asView());
if (view->computeIntersections(ea.getX(), ea.getY(), results, 0x01))
{
// find the first hit under the mouse:
osgUtil::LineSegmentIntersector::Intersection first = *(results.begin());
osg::Vec3d point = first.getWorldIntersectPoint();
// transform it to map coordinates:
osg::Vec3d newPoint;
m_control->getMapNode()->getMap()->worldPointToMapPoint(point, newPoint);
m_control->setFirstPoint(newPoint);
m_control->currentState() = new FirstSelected(m_control);
return (true);
}
}
return (false);
}
开发者ID:spencerg,项目名称:osgearth,代码行数:26,代码来源:AreaSelectControl.cpp
示例13: 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;
}
开发者ID:Thoronador,项目名称:openmw,代码行数:32,代码来源:stats.cpp
示例14: handle
bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
if (ea.getEventType() == ea.PUSH && ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON)
{
osg::Vec3d world;
if ( _mapNode->getTerrain()->getWorldCoordsUnderMouse( aa.asView(), ea.getX(), ea.getY(), world ))
{
GeoPoint mapPoint;
_mapNode->getMap()->worldPointToMapPoint( world, mapPoint );
if (!_startValid)
{
_startValid = true;
_start = mapPoint.vec3d();
if (_featureNode.valid())
{
_root->removeChild( _featureNode.get() );
_featureNode = 0;
}
}
else
{
_end = mapPoint.vec3d();
compute();
_startValid = false;
}
}
}
return false;
}
开发者ID:airwzz999,项目名称:osgearth-for-android,代码行数:30,代码来源:osgearth_terrainprofile.cpp
示例15: addPoint
bool
AddPointHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
osgViewer::View* view = static_cast<osgViewer::View*>(aa.asView());
if ( ea.getEventType() == osgGA::GUIEventAdapter::PUSH )
{
if (ea.getButton() == _mouseButton)
{
_mouseDown = true;
_firstMove = true;
return addPoint( ea.getX(), ea.getY(), view );
}
}
else if (ea.getEventType() == osgGA::GUIEventAdapter::RELEASE)
{
if (ea.getButton() == _mouseButton)
{
_mouseDown = false;
}
}
else if (ea.getEventType() == osgGA::GUIEventAdapter::MOVE || ea.getEventType() == osgGA::GUIEventAdapter::DRAG)
{
if (_mouseDown)
{
if (!_firstMove)
{
return addPoint( ea.getX(), ea.getY(), view );
}
_firstMove = false;
}
return true;
}
return false;
}
开发者ID:Brucezhou1979,项目名称:osgearth,代码行数:35,代码来源:FeatureEditing.cpp
示例16: MouseMove
void InputEventHandler::MouseMove(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{
int x0 = ea.getXmin();
int y0 = ea.getYmin();
int x1 = ea.getXmax();
int y1 = ea.getYmax();
int centerX = (x0 + x1) / 2;
int centerY = (y0 + y1) / 2;
if (!m_cursorOn) {
if (!((ea.getX() == centerX) && (ea.getY() == centerY))) {
m_mouseX0 = centerX;
m_mouseY0 = centerY;
m_mouseX1 = ea.getX();
m_mouseY1 = ea.getY();
aa.requestWarpPointer (centerX, centerY);
}
} else {
if (m_mouseMoveCount > (m_frameCount - 64)) {
// track mouse inside frame window
m_mouseX0 = m_mouseX1;
m_mouseY0 = m_mouseY1;
m_mouseX1 = ea.getX();
m_mouseY1 = ea.getY();
}
}
m_mouseMoveCount = m_frameCount;
}
开发者ID:MCA4213,项目名称:osgnewton,代码行数:29,代码来源:InputEventHandler.cpp
示例17: 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;
}
开发者ID:Supporting,项目名称:ifcplusplus,代码行数:18,代码来源:OrbitCameraManipulator.cpp
示例18: handle
bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
if (ea.getEventType() == osgGA::GUIEventAdapter::PUSH && ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON)
{
osgViewer::View* view = static_cast<osgViewer::View*>(aa.asView());
update( ea.getX(), ea.getY(), view );
}
return false;
}
开发者ID:philipdumont,项目名称:osgearth,代码行数:10,代码来源:osgearth_createtile.cpp
示例19: sqrt
void
AutoClipPlaneHandler::frame( osgGA::GUIActionAdapter& aa )
{
osg::Camera* cam = aa.asView()->getCamera();
if ( _rp < 0 )
{
osg::ref_ptr<MapNode> tempNode = osgEarth::findTopMostNodeOfType<MapNode>( cam );
if ( tempNode.valid() && tempNode->getMap()->getProfile() )
{
_geocentric = tempNode->getMap()->isGeocentric();
if ( _geocentric )
_rp = tempNode->getMap()->getProfile()->getSRS()->getEllipsoid()->getRadiusPolar();
else
OE_INFO << "[AutoClipPlaneHandler] disabled for non-geocentric map" << std::endl;
//_mapNode = tempNode.get();
}
}
if ( _rp > 0 && _geocentric ) // _mapNode.valid() && _geocentric )
{
cam->setComputeNearFarMode( osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR );
osg::Vec3d eye, center, up;
cam->getViewMatrixAsLookAt( eye, center, up );
double d = eye.length();
if ( d < _rp )
d = _rp;
if ( d > _rp )
{
double fovy, ar, znear, zfar, finalZfar;
cam->getProjectionMatrixAsPerspective( fovy, ar, znear, finalZfar );
// far clip at the horizon:
zfar = sqrt( d*d - _rp*_rp );
if (_autoFarPlaneClipping)
{
finalZfar = zfar;
}
double nfr = _nfrAtRadius + _nfrAtDoubleRadius * ((d-_rp)/d);
znear = osg::clampAbove( zfar * nfr, 1.0 );
cam->setProjectionMatrixAsPerspective( fovy, ar, znear, finalZfar );
//OE_NOTICE << fixed
// << "near=" << znear << ", far=" << zfar << std::endl;
}
}
}
开发者ID:dgraves,项目名称:osgearth,代码行数:55,代码来源:AutoClipPlaneHandler.cpp
示例20: iv
bool
MouseCoordsTool::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
if (ea.getEventType() == ea.MOVE || ea.getEventType() == ea.DRAG)
{
osg::Vec3d world;
if ( _mapNode->getTerrain()->getWorldCoordsUnderMouse(aa.asView(), ea.getX(), ea.getY(), world) )
{
GeoPoint map;
map.fromWorld( _mapNode->getMapSRS(), world );
for( Callbacks::iterator i = _callbacks.begin(); i != _callbacks.end(); ++i )
i->get()->set( map, aa.asView(), _mapNode );
}
else
{
for( Callbacks::iterator i = _callbacks.begin(); i != _callbacks.end(); ++i )
i->get()->reset( aa.asView(), _mapNode );
}
#if 1 // testing AGL, Dist to Point
osg::Vec3d eye, center, up;
aa.asView()->getCamera()->getViewMatrixAsLookAt(eye, center, up);
DPLineSegmentIntersector* lsi = new DPLineSegmentIntersector(eye, osg::Vec3d(0,0,0));
osgUtil::IntersectionVisitor iv(lsi);
lsi->setIntersectionLimit(lsi->LIMIT_NEAREST);
//iv.setUserData( new Map() );
_mapNode->accept(iv);
if ( !lsi->getIntersections().empty() )
{
double agl = (eye - lsi->getFirstIntersection().getWorldIntersectPoint()).length();
double dtp = (eye - world).length();
//OE_NOTICE << "AGL = " << agl << "m; DPT = " << dtp << "m" << std::endl;
Registry::instance()->startActivity("AGL", Stringify() << agl << " m");
Registry::instance()->startActivity("Range", Stringify() << dtp << " m");
}
#endif
}
return false;
}
开发者ID:ldelgass,项目名称:osgearth,代码行数:42,代码来源:MouseCoordsTool.cpp
注:本文中的osgga::GUIActionAdapter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论