osgEarth 2.1.1
|
Public Member Functions | |
virtual const char * | className () |
virtual bool | acceptsExtension (const std::string &extension) const |
virtual ReadResult | readNode (const std::string &uri, const Options *options) const |
Definition at line 509 of file Graticule.cpp.
virtual bool osgEarth::Util::GraticuleFactory::acceptsExtension | ( | const std::string & | extension | ) | const [inline, virtual] |
Definition at line 518 of file Graticule.cpp.
{ return osgDB::equalCaseInsensitive(extension, GRATICLE_EXTENSION); }
virtual const char* osgEarth::Util::GraticuleFactory::className | ( | ) | [inline, virtual] |
Definition at line 512 of file Graticule.cpp.
{ supportsExtension( GRATICLE_EXTENSION, "osgEarth graticule" ); return "osgEarth graticule LOD loader"; }
virtual ReadResult osgEarth::Util::GraticuleFactory::readNode | ( | const std::string & | uri, |
const Options * | options | ||
) | const [inline, virtual] |
Definition at line 523 of file Graticule.cpp.
{ std::string ext = osgDB::getFileExtension( uri ); if ( !acceptsExtension( ext ) ) return ReadResult::FILE_NOT_HANDLED; // the graticule definition is formatted: LEVEL_ID.MARKER.EXTENSION std::string def = osgDB::getNameLessExtension( uri ); std::string marker = osgDB::getFileExtension( def ); def = osgDB::getNameLessExtension( def ); int levelNum, id; sscanf( def.c_str(), "%d_%d", &levelNum, &id ); // look up the graticule referenced in the location name: Graticule* graticule = 0L; { ScopedLock<Mutex> lock( s_graticuleMutex ); GraticuleRegistry::iterator i = s_graticuleRegistry.find(id); if ( i != s_graticuleRegistry.end() ) graticule = i->second.get(); } if ( marker == GRID_MARKER ) { osg::Node* result = graticule->createGridLevel( levelNum ); return result ? ReadResult( result ) : ReadResult::ERROR_IN_READING_FILE; } else if ( marker == TEXT_MARKER ) { osg::Node* result = graticule->createTextLevel( levelNum ); return result ? ReadResult( result ) : ReadResult::ERROR_IN_READING_FILE; } else { OE_NOTICE << "oh no! no markers" << std::endl; return ReadResult::FILE_NOT_HANDLED; } }