• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

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

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了GUIEventAdapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: handle

 bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor*)
 {
     if (ea.getEventType() == ea.KEYDOWN && ea.getKey() == _c)
     {
         osg::Vec3d world;
         _mapNode->getTerrain()->getWorldCoordsUnderMouse(aa.asView(), ea.getX(), ea.getY(), world);
         GeoPoint coords;
         coords.fromWorld(s_activeMap->getSRS(), world);
         osg::ref_ptr<ElevationEnvelope> env = s_activeMap->getElevationPool()->createEnvelope(s_activeMap->getSRS(), 23u);
         float ep_elev = env->getElevation(coords.x(), coords.y());
         OE_NOTICE << "Elevations under mouse. EP=" << ep_elev << "\n";
     }
     return false;
 }
开发者ID:XenonofArcticus,项目名称:osgearth,代码行数:14,代码来源:osgearth_toc.cpp


示例2: handle

bool QueryCoordinatesHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
  if ( ea.getEventType() == osgGA::GUIEventAdapter::MOVE )
  {
    osgViewer::View* view = static_cast<osgViewer::View*>( aa.asView() );
    osg::Vec3d coords = getCoords( ea.getX(), ea.getY(), view, false );
    mGlobe->showCurrentCoordinates( coords.x(), coords.y() );
  }
  if ( ea.getEventType() == osgGA::GUIEventAdapter::PUSH
       && ea.getButtonMask() == osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON )
  {
    osgViewer::View* view = static_cast<osgViewer::View*>( aa.asView() );
    osg::Vec3d coords = getCoords( ea.getX(), ea.getY(), view, false );

    OE_NOTICE << "SelectedCoordinates set to:\nLon: " << coords.x() << " Lat: " << coords.y()
    << " Ele: " << coords.z() << std::endl;

    mGlobe->setSelectedCoordinates( coords );

    if ( ea.getModKeyMask() == osgGA::GUIEventAdapter::MODKEY_CTRL )
      //ctrl + rightclick pops up a QMessageBox
    {
      mGlobe->showSelectedCoordinates();
    }
  }

  return false;
}
开发者ID:FabrizioMu,项目名称:QGIS-1,代码行数:28,代码来源:globe_plugin.cpp


示例3: handle

bool KeyboardHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{
    if(ea.getEventType() == osgGA::GUIEventAdapter::KEYDOWN)
    {
        if(ea.getKey() == 'w')
        {
            std::cout << "W pressed" << std::endl;

            return false;
        }
    }

    return false;
}
开发者ID:TheZoq2,项目名称:Space,代码行数:14,代码来源:KeyboardHandler.cpp


示例4: handleEvent

bool MYGUIManager::handleEvent(const osgGA::GUIEventAdapter& ea, bool async) const {
	if (async || !_platform || !_initialized) {
		const_cast<MYGUIManager*>(this)->pushEvent(&ea);
		return false;
	}

	int x = ea.getX(), y = ea.getY(), key = ea.getKey();
	static int z = 0;
	if (ea.getMouseYOrientation() == osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS)
		y = ea.getWindowHeight() - y;

	x = int(floor(float(x) / _uiScale + 0.5f));
	y = int(floor(float(y) / _uiScale + 0.5f));

	switch (ea.getEventType())
	{
	case osgGA::GUIEventAdapter::PUSH:
		return MyGUI::InputManager::getInstance().injectMousePress(x, y, convertMouseButton(ea.getButton()));
		break;
	case osgGA::GUIEventAdapter::RELEASE:
		return MyGUI::InputManager::getInstance().injectMouseRelease(x, y, convertMouseButton(ea.getButton()));
		break;
	case osgGA::GUIEventAdapter::SCROLL:
		switch (ea.getScrollingMotion()) {
		case osgGA::GUIEventAdapter::SCROLL_UP:
			z++; break;
		case osgGA::GUIEventAdapter::SCROLL_DOWN:
			z--; break;
		}
		// fall through
	case osgGA::GUIEventAdapter::DRAG:
	case osgGA::GUIEventAdapter::MOVE:
		return MyGUI::InputManager::getInstance().injectMouseMove(x, y, z);
		break;
	case osgGA::GUIEventAdapter::KEYDOWN:
		if (key<127)
			return MyGUI::InputManager::getInstance().injectKeyPress(convertKeyCode(key), (char)key);
		else
			return MyGUI::InputManager::getInstance().injectKeyPress(convertKeyCode(key));
		break;
	case osgGA::GUIEventAdapter::KEYUP:
		return MyGUI::InputManager::getInstance().injectKeyRelease(convertKeyCode(key));
		break;
	case osgGA::GUIEventAdapter::RESIZE:
		_platform->getRenderManagerPtr()->setViewSize(
			int(floor(float(ea.getWindowWidth()) / _uiScale + 0.5f)),
			int(floor(float(ea.getWindowHeight()) / _uiScale + 0.5f)));
		break;
	default:
		break;
	}

	return false;
}
开发者ID:acmepjz,项目名称:turning-polyhedron-reloaded,代码行数:54,代码来源:MYGUIManager.cpp


示例5: handle

 bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
 {
   if ( ea.getEventType() == osgGA::GUIEventAdapter::MOVE )
   {
     osgViewer::View* view = static_cast<osgViewer::View*>( aa.asView() );
     osgUtil::LineSegmentIntersector::Intersections hits;
     if ( view->computeIntersections( ea.getX(), ea.getY(), hits ) )
     {
       osgEarth::GeoPoint isectPoint;
       isectPoint.fromWorld( mGlobe->mapNode()->getMapSRS()->getGeodeticSRS(), hits.begin()->getWorldIntersectPoint() );
       mGlobe->showCurrentCoordinates( isectPoint );
     }
   }
   return false;
 }
开发者ID:a11656358,项目名称:QGIS,代码行数:15,代码来源:globe_plugin.cpp


示例6: handle

    bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& /*aa*/)
    {
        if (!_gt) return false;

        switch(ea.getEventType())
        {
        case(osgGA::GUIEventAdapter::KEYDOWN):
            {
                if (ea.getKey() == 'g')
                {
                    osg::notify(osg::NOTICE)<<"Gaussian"<<std::endl;
                    _gt->setFilterMatrixAs(osgTerrain::GeometryTechnique::GAUSSIAN);
                    return true;
                }
                else if (ea.getKey() == 's')
                {
                    osg::notify(osg::NOTICE)<<"Smooth"<<std::endl;
                    _gt->setFilterMatrixAs(osgTerrain::GeometryTechnique::SMOOTH);
                    return true;
                }
                else if (ea.getKey() == 'S')
                {
                    osg::notify(osg::NOTICE)<<"Sharpen"<<std::endl;
                    _gt->setFilterMatrixAs(osgTerrain::GeometryTechnique::SHARPEN);
                    return true;
                }
                else if (ea.getKey() == '+')
                {
                    _gt->setFilterWidth(_gt->getFilterWidth()*1.1);
                    osg::notify(osg::NOTICE)<<"Filter width = "<<_gt->getFilterWidth()<<std::endl;
                    return true;
                }
                else if (ea.getKey() == '-')
                {
                    _gt->setFilterWidth(_gt->getFilterWidth()/1.1);
                    osg::notify(osg::NOTICE)<<"Filter width = "<<_gt->getFilterWidth()<<std::endl;
                    return true;
                }
                else if (ea.getKey() == '>')
                {
                    _gt->setFilterBias(_gt->getFilterBias()+0.1);
                    osg::notify(osg::NOTICE)<<"Filter bias = "<<_gt->getFilterBias()<<std::endl;
                    return true;
                }
                else if (ea.getKey() == '<')
                {
                    _gt->setFilterBias(_gt->getFilterBias()-0.1);
                    osg::notify(osg::NOTICE)<<"Filter bias = "<<_gt->getFilterBias()<<std::endl;
                    return true;
                }
                break;
            }
        default:
            break;
        }
        return false;

    }
开发者ID:AlexBobkov,项目名称:OpenSceneGraph,代码行数:58,代码来源:osgthreadedterrain.cpp


示例7: handle

bool KeyboardEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)
{
   switch(ea.getEventType())
   {
      case(osgGA::GUIEventAdapter::KEYDOWN):
      {
          switch(ea.getKey())
          {
             case '1':
                placeStreams(GRID_LAYOUT);
                return false;
                break;
             case '2':
                placeStreams(ROW_LAYOUT);
                return false;
                break;
             case '3':
                colorStreams(MEMORY_COLORING);
                return false;
                break;
             case '4':
                colorStreams(EXECUTION_FREQ_COLORING);
                return false;
                break;
             case 'h':
                hideByImage(HIDE);
                return false;
                break;
             case 'u':
                hideByImage(HIDE_ALL_ELSE);
                return false;
                break;
             case 'n':
                updateTimeline(1);
                return false;
                break;
             case 'p':
                updateTimeline(-1);
                return false;
                break;
             default:
                return false;
          }
      }
      default:
         return false;
   }
}
开发者ID:JaonLin,项目名称:pinvis,代码行数:48,代码来源:pinvis.cpp


示例8: 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


示例9: handle

bool WeaponHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
{
 /*   osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
    if (!view) return false;
    
    osgViewer::ViewerBase* viewer = view->getViewerBase();
*/

 //   if (ea.getHandled()) return false;
	

    switch(ea.getEventType())
    {
	case(osgGA::GUIEventAdapter::RELEASE):
	//case(osgGA::GUIEventAdapter::DOUBLECLICK):
        {
           //shoot
		//	if(ea.getButtonMask() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON)
			{
				//if(osgGA::GUIEventAdapter::RELEASE == ea.getEventType())
				GameManager::instance()->getWeaponManager()->Tire();
			}	
            break;
        }

    default:
        break;

    }
    return false;
}
开发者ID:whztt07,项目名称:urbanshooter,代码行数:31,代码来源:WeaponHandler.cpp


示例10: 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


示例11: handle

bool CScreenCapture::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{
	osgViewer::ViewerBase* viewer = dynamic_cast<osgViewer::View*>(&aa)->getViewerBase();
	if (!viewer) return false;

	switch (ea.getEventType())
	{
	case (osgGA::GUIEventAdapter::FRAME) :
	{
		// Booleans aren't the best way of doing this, but I want to do
		// the actual adding here because I don't want to require
		// startCapture() take a viewer as argument, which could not be
		// the right one.
		if (_startCapture)
		{
			// Start capturing with the currently set number of frames.
			// If set to -1 it will capture continuously, if set to >0
			// it will capture that number of frames.
			_startCapture = false;
			addCallbackToViewer(*viewer);
		}
		else if (_stopCapture)
		{
			_stopCapture = false;
			removeCallbackFromViewer(*viewer);
		}
		break;
	}

	default:
		break;
	}
	return false;
}
开发者ID:LeonardoTech,项目名称:OSGCapture,代码行数:34,代码来源:ScreenCapture.cpp


示例12: handle

        bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& )
        {
            if( ea.getEventType() != osgGA::GUIEventAdapter::KEYDOWN )
                return false;

            switch( ea.getKey() )
            {
                case 'x':
                    _gl2Scene->reloadShaderSource();
                    return true;
                case 'y':
                    _gl2Scene->toggleShaderEnable();
                    return true;
            }
            return false;
        }
开发者ID:151706061,项目名称:OpenSceneGraph,代码行数:16,代码来源:osgshaders.cpp


示例13: keyUp

bool OSGCameraManipulator::keyUp(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter &aa)	{
	int bRes = true;

	int nResKey = ea.getKey();
	if ((nResKey ==	osgGA::GUIEventAdapter::KEY_Control_L) ||
		(nResKey ==	osgGA::GUIEventAdapter::KEY_Control_R))	{
			m_bCtrl = false;
	}

	if ((nResKey ==	osgGA::GUIEventAdapter::KEY_Shift_L) ||
		(nResKey ==	osgGA::GUIEventAdapter::KEY_Shift_R))	{
		m_bShift = false;
		m_dbDefaultMoveSpeed = 1;
	}

	if ((nResKey == osgGA::GUIEventAdapter::KEY_Up) ||
		(nResKey == osgGA::GUIEventAdapter::KEY_Down))	{
		m_dbForwardFactor = 0.0;
		m_dbLateralRotationRate = 0.0;
		m_dbDefaultMoveSpeed = 1;
	}

	if ((nResKey == osgGA::GUIEventAdapter::KEY_Left) ||
		(nResKey == osgGA::GUIEventAdapter::KEY_Right))	{
		m_dbDirectionRotationRate = 0.0;
		m_dbPitchOffsetRate = 0.0;
		m_dbDefaultMoveSpeed = 1;
	}

	return(bRes);
}
开发者ID:octaviansoldea,项目名称:VRShop,代码行数:31,代码来源:OSGCameraManipulator.cpp


示例14: 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


示例15: pick_measure

void PickHandler::pick_measure(osgViewer::Viewer* viewer, const osgGA::GUIEventAdapter& ea)
{

  
  
  osgUtil::LineSegmentIntersector::Intersections intersections;
  if (viewer->computeIntersections(ea.getX(), ea.getY(), intersections)){
    
    // use the nearest intersection                 
    const osgUtil::LineSegmentIntersector::Intersection& intersection = *(intersections.begin());
  
    (*measure_vertices)[1].set( intersection.getWorldIntersectPoint());
    // cout <<   (*measure_vertices)[1] <<endl;
}

}
开发者ID:caomw,项目名称:benthicQT,代码行数:16,代码来源:ScreenTools.cpp


示例16: handleKeypress

void ViewerManipulator::handleKeypress(const osgGA::GUIEventAdapter& ea)
{
	if (ea.getKey()=='r')
	{
		sendEvent(user->s_name, "sfff", "setOrientation", 0.0, 0.0, 0.0, LO_ARGS_END);
	}
}
开发者ID:djiamnot,项目名称:spinframework,代码行数:7,代码来源:ViewerManipulator.cpp


示例17: 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


示例18: handle

bool PickHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)
{
    switch(ea.getEventType())
    { 

    case(osgGA::GUIEventAdapter::DOUBLECLICK):
    {
        if(measuring_tool_on){
            // if(ea.getButtonMask() ==GUIEventAdapter::MIDDLE_MOUSE_BUTTON){
            osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
            if (viewer) pick(viewer,ea);
            //      }
        }
        return false;
    }    
    case(osgGA::GUIEventAdapter::MOVE):
      {
	if(!measure_anchored)
	  return false;
      osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
	if (viewer ) pick_measure(viewer,ea);
	return false;
      }
 default:
      return false;
    }
}
开发者ID:caomw,项目名称:benthicQT,代码行数:27,代码来源:ScreenTools.cpp


示例19:

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;
	}
}
开发者ID:Cecko,项目名称:3dsoftviz,代码行数:33,代码来源:CameraManipulator.cpp


示例20: handle

bool MYGUIHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
	// This only works under single-threaded mode
	switch (ea.getEventType()) {
	case osgGA::GUIEventAdapter::PUSH:
	case osgGA::GUIEventAdapter::RELEASE:
	case osgGA::GUIEventAdapter::SCROLL:
	case osgGA::GUIEventAdapter::DRAG:
	case osgGA::GUIEventAdapter::MOVE:
	case osgGA::GUIEventAdapter::KEYDOWN:
	case osgGA::GUIEventAdapter::KEYUP:
	{
		// check if there are any model window
		bool hasModal = false;
		if (_manager->_initialized) {
			hasModal = MyGUI::InputManager::getInstance().isModalAny();
		}
		return _manager->handleEvent(ea) || hasModal;
	}
	case osgGA::GUIEventAdapter::RESIZE:
		_manager->handleEvent(ea, true);
		return false;
	default:
		return false;
	}
}
开发者ID:acmepjz,项目名称:turning-polyhedron-reloaded,代码行数:26,代码来源:MYGUIManager.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ osgviewer::Viewer类代码示例发布时间:2022-05-31
下一篇:
C++ osgga::GUIActionAdapter类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap