Osg-OsgEarth设置视点(水平方位角、垂直俯仰角、焦距)(Qt5.14.2+osgEarht3.6.5+win10)


 垂直俯仰角

 

Osg焦距

 

 Osg水平方位角

 

相关资料:

https://blog.csdn.net/weixin_30604651/article/details/97294201

 

实例:

.h

    osg::ref_ptr<osgEarth::Util::EarthManipulator> m_pEarthManip;

.cpp

增加操作

    m_pEarthManip = new osgEarth::Util::EarthManipulator;
    m_pViewer->setCameraManipulator(m_pEarthManip);//必须在setViewpoint之前

修改位置

// 垂直俯仰角
void Widget::on_setplane(int value)
{
    qDebug() << "heading: " << m_pEarthManip->getViewpoint().heading()->getValue();
    qDebug() << "pitch: " << m_pEarthManip->getViewpoint().pitch()->getValue();
    qDebug() << "range: " << m_pEarthManip->getViewpoint().range()->getValue();

    osgEarth::Viewpoint vp( "", 107.85, 32.35, 0.0,
                            m_pEarthManip->getViewpoint().heading()->getValue() ,
                            value,
                            m_pEarthManip->getViewpoint().range()->getValue() );
    m_pEarthManip->setViewpoint( vp, 2 );
}
// 水平方位角
void Widget::on_setcourse(int value)
{
    osgEarth::Viewpoint vp( "", 107.85, 32.35, 0.0,
                            value ,
                            m_pEarthManip->getViewpoint().pitch()->getValue(),
                            m_pEarthManip->getViewpoint().range()->getValue() );
    m_pEarthManip->setViewpoint( vp, 2 );
}
// 焦距
void Widget::on_setrange(int value)
{
    osgEarth::Viewpoint vp( "", 107.85, 32.35, 0.0,
                            m_pEarthManip->getViewpoint().heading()->getValue() ,
                            m_pEarthManip->getViewpoint().pitch()->getValue(),
                            value );
    m_pEarthManip->setViewpoint( vp, 2 );
}

  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM