查看: 2941|回复: 0

osgEarth 获取鼠标点经纬度信息

[复制链接]

该用户从未签到

发表于 2015-2-16 15:28:37 | 显示全部楼层 |阅读模式
bool CLabelControlEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)
{
        osgViewer::Viewer *viewer = dynamic_cast<osgViewer::Viewer*> (&aa);
        if(viewer)
        {
                if(ea.getEventType() == ea.MOVE || ea.getEventType() == ea.DRAG)
                {
                        osgUtil:ineSegmentIntersector::Intersections inters1;
                        osg::Vec3d m_TempPoint1;
                        osg::Vec3d lla;
                        osgEarth::GeoPoint ConvertPoint;
                        osgEarth::SpatialReference* m_pGeoSRS = 0;
                                               
                        if(viewer->computeIntersections(ea.getX(),ea.getY(),inters1))
                        {
                                osgUtil::LineSegmentIntersector::Intersections::iterator iter1 = inters1.begin();
                                m_TempPoint1.set(iter1->getWorldIntersectPoint().x(),iter1->getWorldIntersectPoint().y(),iter1->getWorldIntersectPoint().z());
                                m_pGeoSRS->getGeographicSRS();
                                ConvertPoint.fromWorld(m_pGeoSRS,m_TempPoint1);
                            
                         }
                }
        }
        return false;
}

获取鼠标点的经纬度和高程信息,程序如上,编译通过但是运行出错,求大神帮忙看一看。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表