osgEarth 2.1.1
Functions

/home/cube/sources/osgearth/src/applications/osgearth_earthfile/osgearth_earthfile.cpp File Reference

#include <osg/ArgumentParser>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgEarth/EarthFile>
#include <iostream>
Include dependency graph for osgearth_earthfile.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

This is a TEST APP to test EARTH FILE WRITING.

Definition at line 33 of file osgearth_earthfile.cpp.

{
    if ( argc != 3 ) {
        OE_NOTICE << "Usage: osgearth_earthfile <inputfile> <outputfile>" << std::endl;
        return -1;
    }

    std::string infile( argv[1] );
    std::string outfile( argv[2] );

    // read in the earth file:
    EarthFile earthReader;
    if ( earthReader.readXML( infile ) )
    {
        osg::ref_ptr<Map> map = earthReader.getMap();
        MapNodeOptions mapOptions = earthReader.getMapNodeOptions();

        // now write it back out
        EarthFile earthWriter;
        earthWriter.setMap( map.get() );
        earthWriter.setMapNodeOptions( mapOptions );

        if ( !earthWriter.writeXML( outfile ) ) {
            OE_NOTICE 
                << "ERROR: unable to write earth file to " << outfile << std::endl;
            return -1;
        }
    }
    else
    {
        OE_NOTICE
            << "ERROR: unable to read earth file from " << infile << std::endl;
        return -1;
    }

    return 0;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines