osgEarth 2.1.1
Public Member Functions | Private Attributes

KMLReader Class Reference

Collaboration diagram for KMLReader:

List of all members.

Public Member Functions

 KMLReader (MapNode *mapNode, const KMLOptions *options)
osg::Node * read (std::istream &in, const URIContext &context)
osg::Node * read (const Config &conf)

Private Attributes

MapNode_mapNode
const KMLOptions_options

Detailed Description

Definition at line 32 of file KMLReader.


Constructor & Destructor Documentation

KMLReader::KMLReader ( MapNode mapNode,
const KMLOptions options 
)

Initialized a KML reader that will work with the provided map node

Definition at line 27 of file KMLReader.cpp.

                                                                  :
_mapNode( mapNode ),
_options( options )
{
    //nop
}

Member Function Documentation

osg::Node * KMLReader::read ( std::istream &  in,
const URIContext context 
)

Reads KML from a stream and returns a node

Definition at line 35 of file KMLReader.cpp.

{
    // read the KML from an XML stream:
    osg::ref_ptr<XmlDocument> xml = XmlDocument::load( in, context );
    if ( !xml.valid() )
        return 0L;

    // convert to a config:
    Config config = xml->getConfig();

    osg::Node* node = read( config );
    node->setName( context.referrer() );

    return node;
}

Here is the call graph for this function:

Here is the caller graph for this function:

osg::Node * KMLReader::read ( const Config conf)

Reads KML from a Config object

Definition at line 52 of file KMLReader.cpp.

{
    osg::Group* root = new osg::Group();
    root->ref();

    root->setName( conf.uriContext().referrer() );

    KMLContext cx;
    cx._mapNode = _mapNode;
    cx._sheet = new StyleSheet();
    cx._groupStack.push( root );
    cx._options = _options;

    const Config& kml = conf.child("kml");
    if ( !kml.empty() )
    {
        KML_Root kmlRoot;
        kmlRoot.scan( kml, cx );    // first pass
        kmlRoot.scan2( kml, cx );   // second pass
        kmlRoot.build( kml, cx );   // third pass.
    }

    return root;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 45 of file KMLReader.

const KMLOptions* KMLReader::_options [private]

Definition at line 46 of file KMLReader.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines