osgEarth 2.1.1
|
#include <osg/Notify>
#include <osgGA/StateSetManipulator>
#include <osgGA/GUIEventHandler>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgEarth/MapNode>
#include <osgEarthUtil/EarthManipulator>
#include <osgEarthUtil/AutoClipPlaneHandler>
#include <osgEarthDrivers/kml/KML>
Go to the source code of this file.
Functions | |
int | usage (const std::string &msg) |
int | main (int argc, char **argv) |
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 42 of file osgearth_kml.cpp.
{ osg::ArgumentParser arguments(&argc,argv); osgViewer::Viewer viewer(arguments); osg::Group* root = new osg::Group(); // load the .earth file from the command line. MapNode* mapNode = MapNode::load( arguments ); if (!mapNode) return usage( "Unable to load earth model." ); root->addChild( mapNode ); for( int a = 1; a < argc; ++a ) { std::string kmlFile( argv[a] ); if ( endsWith( kmlFile, ".kml" ) ) { osg::ref_ptr<osgDB::Options> options = new osgDB::Options(); options->setPluginData( "osgEarth::MapNode", mapNode ); osg::Node* kml = osgDB::readNodeFile( kmlFile, options.get() ); if ( kml ) root->addChild( kml ); } } viewer.setCameraManipulator( new EarthManipulator() ); viewer.setSceneData( root ); viewer.getDatabasePager()->setDoPreCompile( true ); // add some stock OSG handlers: viewer.addEventHandler(new osgViewer::StatsHandler()); viewer.addEventHandler(new osgViewer::WindowSizeHandler()); viewer.addEventHandler(new osgViewer::ThreadingHandler()); viewer.addEventHandler(new osgViewer::LODScaleHandler()); viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet())); viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage())); return viewer.run(); }
int usage | ( | const std::string & | msg | ) |
Definition at line 33 of file osgearth_kml.cpp.