osgearth设置视点

From

韶华百世

的新浪博客

注意,在earthManip->setViewpoint()之前,要先v->setCameraManipulator(earthManip);

在使用osgEarth中的EarthManipulator,通过setViewpoint设置视点:
1.osg::ref_ptr<osgEarth::Util::EarthManipulator> manip = new osgEarth::Util::EarthManipulator;
2.manip->setViewpoint( osgEarth::Util::Viewpoint( 108.0f, 34.0f, 10000.0f, 0.0f, -45.0f, 1e7 ) );

osg::ref_ptr<osgEarth::Util::EarthManipulator> earthManip = new osgEarth::Util::EarthManipulator;

            v->setCameraManipulator(earthManip);//必须在setViewpoint之前

osgEarth::Viewpoint vp( "", 107.85, 32.35, 0.0, -2.50, -90.0, 1.5e7 );

earthManip->setViewpoint( vp, 0 );

 

* Constructs a new viewpoint.
*
* @param name
* Name of this viewpoint.
*
* @param focal_point 焦点
* The location at which the camera points. Express this is either
* cartesian coordinates (for a "flat-earth" model) or in lat/long
* degrees for a round-earth model.
*
* @param heading_deg  水平方位角
* Heading (in clockwise degrees) of the camera relative to the
* tangent plane of the focal point.
*
* @param pitch_deg 垂直俯仰角
* Pitch (in degrees) of the camera relative to the tangent plane
* of the focal point.
*
* @param range 焦距
* Straight-line distance from the camera to the focal point.
*
* @param srs (optional)
* Spatial reference defining the focal point.

原文地址:https://www.cnblogs.com/coolbear/p/3029073.html