osgEarth 2.1.1
Public Member Functions | Protected Member Functions | Protected Attributes

osgEarth::Symbology::MarkerResource Class Reference

Inheritance diagram for osgEarth::Symbology::MarkerResource:
Collaboration diagram for osgEarth::Symbology::MarkerResource:

List of all members.

Public Member Functions

 MarkerResource (const Config &conf=Config())
osg::Node * createNode () const
optional< URI > & uri ()
const optional< URI > & uri () const
virtual Config getConfig () const
void mergeConfig (const Config &conf)

Protected Member Functions

osg::Node * createNodeFromURI (const URI &uri) const

Protected Attributes

optional< URI_markerURI

Detailed Description

A resource that points to a "marker", which is a model representing an object in the scene. Markers are used typically fro point-model subsitution and to manage externally referenced (or dynamically created) scene graph nodes.

Definition at line 38 of file MarkerResource.


Constructor & Destructor Documentation

MarkerResource::MarkerResource ( const Config conf = Config())

Constructs a new marker resource.

Definition at line 91 of file MarkerResource.cpp.

                                                   :
Resource( conf )
{
    mergeConfig( conf );
}

Here is the call graph for this function:


Member Function Documentation

osg::Node * MarkerResource::createNode ( ) const

Creates a new Node representing the marker.

Definition at line 115 of file MarkerResource.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

osg::Node * MarkerResource::createNodeFromURI ( const URI uri) const [protected]

Definition at line 121 of file MarkerResource.cpp.

{
    osg::ref_ptr<osg::Object> obj = uri.readObject();
    if ( obj.valid() )
    {
        if ( dynamic_cast<osg::Image*>( obj.get() ) )
        {
            return buildImageModel( dynamic_cast<osg::Image*>( obj.get() ) );
        }
        else if ( dynamic_cast<osg::Node*>( obj.get() ) )
        {
            return dynamic_cast<osg::Node*>( obj.release() );
        }
    }

    else // failing that, fall back on the old encoding format..
    {
        StringVector tok;
        StringTokenizer( *uri, tok, "()" );
        if (tok.size() >= 2)
            return createNodeFromURI( URI(tok[1]) );
    }

    // fail
    return 0L;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Config MarkerResource::getConfig ( ) const [virtual]

Reimplemented from osgEarth::Symbology::Resource.

Definition at line 104 of file MarkerResource.cpp.

{
    Config conf = Resource::getConfig();
    conf.key() = "marker";

    conf.updateIfSet( "url", _markerURI );

    return conf;
}

Here is the call graph for this function:

void MarkerResource::mergeConfig ( const Config conf)

Reimplemented from osgEarth::Symbology::Resource.

Definition at line 98 of file MarkerResource.cpp.

{
    conf.getIfSet( "url", _markerURI );
}

Here is the call graph for this function:

Here is the caller graph for this function:

const optional<URI>& osgEarth::Symbology::MarkerResource::uri ( ) const [inline]

Definition at line 52 of file MarkerResource.

{ return _markerURI; }
optional<URI>& osgEarth::Symbology::MarkerResource::uri ( ) [inline]

Source location of the actual data to load.

Definition at line 51 of file MarkerResource.

{ return _markerURI; }

Member Data Documentation

Definition at line 60 of file MarkerResource.


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