osgEarth 2.1.1
|
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 |
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.
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; }
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; }
MapNode* KMLReader::_mapNode [private] |
const KMLOptions* KMLReader::_options [private] |