当前位置: 首页>>代码示例>>C++>>正文


C++ osgga::GUIActionAdapter类代码示例

本文整理汇总了C++中osgga::GUIActionAdapter的典型用法代码示例。如果您正苦于以下问题:C++ GUIActionAdapter类的具体用法?C++ GUIActionAdapter怎么用?C++ GUIActionAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GUIActionAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的osgga::GUIActionAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。