垂直俯仰角
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 ); }