osgEarth 2.1.1
|
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 |
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.
Constructs a new marker resource.
Definition at line 91 of file MarkerResource.cpp.
: Resource( conf ) { mergeConfig( conf ); }
osg::Node * MarkerResource::createNode | ( | ) | const |
Creates a new Node representing the marker.
Definition at line 115 of file MarkerResource.cpp.
{ return createNodeFromURI( _markerURI.value() ); }
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; }
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; }
void MarkerResource::mergeConfig | ( | const Config & | conf | ) |
Reimplemented from osgEarth::Symbology::Resource.
Definition at line 98 of file MarkerResource.cpp.
{ conf.getIfSet( "url", _markerURI ); }
Definition at line 52 of file MarkerResource.
{ return _markerURI; }
Source location of the actual data to load.
Definition at line 51 of file MarkerResource.
{ return _markerURI; }
optional<URI> osgEarth::Symbology::MarkerResource::_markerURI [protected] |
Definition at line 60 of file MarkerResource.