osgEarth 2.1.1
Public Member Functions

osgEarth::Util::GraticuleFactory Class Reference

List of all members.

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

Detailed Description

Definition at line 509 of file Graticule.cpp.


Member Function Documentation

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);
        }

Here is the caller graph for this function:

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;
            }
        }

Here is the call graph for this function:


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