一、代码
#include <osgViewer/Viewer>
#include <osg/Math>
#include <osgDB/ReadFile>
#include <osg/NodeCallback>
#include <osg/MatrixTransform>
#include<osg/PositionAttitudeTransform>
//键盘事件
#include<osgViewer/ViewerEventHandlers>
//osgGA相关的库
#include<osgGA/StateSetManipulator>
#include<osgGA/TrackballManipulator>
#include<osgGA/DriveManipulator>
//osgEarth相关库
#include<osgEarthUtil/EarthManipulator>
#include<osgEarth/Map>
#include<osg/lineWidth>
osg::ref_ptr<osg::EllipsoidModel>em = new osg::EllipsoidModel;
osg::Node* createLine(osg::Vec3d start, osg::Vec3d end)
{
osg::Geode* line_gnode = new osg::Geode;
osg::ref_ptr<osg::Vec3Array>vectex = new osg::Vec3Array;
osg::ref_ptr<osg::Vec4Array>color = new osg::Vec4Array;
osg::ref_ptr<osg::Geometry>gemo = new osg::Geometry;
//上一个点
osg::Vec3d FirstPoint, SecondPoint;
//第一个点