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

osgEarth::Features::FeatureModelSource Class Reference

Inheritance diagram for osgEarth::Features::FeatureModelSource:
Collaboration diagram for osgEarth::Features::FeatureModelSource:

List of all members.

Public Member Functions

 FeatureModelSource (const FeatureModelSourceOptions &options=FeatureModelSourceOptions())
virtual void initialize (const std::string &referenceURI, const osgEarth::Map *map)
virtual osg::Node * createNode (ProgressCallback *progress)
virtual FeatureNodeFactorycreateFeatureNodeFactory ()=0
void setFeatureSource (FeatureSource *source)
FeatureSourcegetFeatureSource ()
virtual const
FeatureModelSourceOptions
getFeatureModelOptions () const
const osgEarth::MapgetMap () const
virtual osg::Referenced * createBuildData ()
virtual osg::Object * cloneType () const
virtual osg::Object * clone (const osg::CopyOp &) const
virtual bool isSameKindAs (const osg::Object *obj) const
virtual const char * className () const
virtual const char * libraryName () const

Protected Member Functions

virtual ~FeatureModelSource ()

Protected Attributes

osg::ref_ptr< FeatureSource_features
osg::ref_ptr< const Map_map
const FeatureModelSourceOptions _options
osg::ref_ptr< FeatureNodeFactory_factory

Detailed Description

A ModelSource that renders Feature data from a FeatureSource.

Definition at line 165 of file FeatureModelSource.


Constructor & Destructor Documentation

FeatureModelSource::FeatureModelSource ( const FeatureModelSourceOptions options = FeatureModelSourceOptions())

Constructs a new feature model source with the provided options.

Definition at line 109 of file FeatureModelSource.cpp.

                                                                                 :
ModelSource( options ),
_options( options )
{
    // the data source from which to pull features:
    if ( _options.featureSource().valid() )
    {
        _features = _options.featureSource().get();
    }
    else if ( _options.featureOptions().isSet() )
    {
        _features = FeatureSourceFactory::create( _options.featureOptions().value() );
        if ( !_features.valid() )
        {
            OE_WARN << "FeatureModelSource - no valid feature source provided" << std::endl;
        }
    }
}

Here is the call graph for this function:

virtual osgEarth::Features::FeatureModelSource::~FeatureModelSource ( ) [inline, protected, virtual]

DTOR is protected to prevent this object from being allocated on the stack

Definition at line 211 of file FeatureModelSource.

{ }

Member Function Documentation

virtual const char* osgEarth::Features::FeatureModelSource::className ( ) const [inline, virtual]

Reimplemented from osgEarth::ModelSource.

Definition at line 205 of file FeatureModelSource.

{ return "FeatureModelSource"; }
virtual osg::Object* osgEarth::Features::FeatureModelSource::clone ( const osg::CopyOp &  ) const [inline, virtual]

Reimplemented from osgEarth::ModelSource.

Definition at line 203 of file FeatureModelSource.

{ return 0; } // clone() not appropriate
virtual osg::Object* osgEarth::Features::FeatureModelSource::cloneType ( ) const [inline, virtual]

Reimplemented from osgEarth::ModelSource.

Definition at line 202 of file FeatureModelSource.

{ return 0; } // cloneType() not appropriate
virtual osg::Referenced* osgEarth::Features::FeatureModelSource::createBuildData ( ) [inline, virtual]

Creates an implementation-specific data object to be passed to buildNodeForStyle

Definition at line 197 of file FeatureModelSource.

{ return NULL; }     
virtual FeatureNodeFactory* osgEarth::Features::FeatureModelSource::createFeatureNodeFactory ( ) [pure virtual]
osg::Node * FeatureModelSource::createNode ( ProgressCallback progress) [virtual]

Subclass implements this method to create the mode node.

Implements osgEarth::ModelSource.

Definition at line 159 of file FeatureModelSource.cpp.

{
    if ( !_factory.valid() )
        _factory = createFeatureNodeFactory();

    if ( !_factory.valid() )
        return 0L;

    if ( !_features.valid() || !_features->getFeatureProfile() )
    {
        OE_WARN << LC << "Invalid feature source" << std::endl;
        return 0L;
    }

    Session* session = new Session( _map.get(), _options.styles().get() );

    FeatureModelGraph* graph = new FeatureModelGraph( 
        _features.get(), 
        _options, 
        _factory.get(),
        session );

    return graph;
}

Here is the call graph for this function:

virtual const FeatureModelSourceOptions& osgEarth::Features::FeatureModelSource::getFeatureModelOptions ( ) const [inline, virtual]
FeatureSource* osgEarth::Features::FeatureModelSource::getFeatureSource ( ) [inline]

The underlying feature source.

Definition at line 190 of file FeatureModelSource.

{ return _features.get(); }
const osgEarth::Map* osgEarth::Features::FeatureModelSource::getMap ( ) const [inline]

Definition at line 194 of file FeatureModelSource.

{ return _map.get(); }
void FeatureModelSource::initialize ( const std::string &  referenceURI,
const osgEarth::Map map 
) [virtual]

Initialize the NodeSource.

Reimplemented from osgEarth::ModelSource.

Reimplemented in anonymous_namespace{FeatureGeomModelSource.cpp}::FeatureGeomModelSource, anonymous_namespace{FeatureLabelModelSource.cpp}::FeatureLabelModelSource, and anonymous_namespace{FeatureStencilModelSource.cpp}::FeatureStencilModelSource.

Definition at line 142 of file FeatureModelSource.cpp.

{
    ModelSource::initialize( referenceURI, map );

    if ( _features.valid() )
    {
        _features->initialize( referenceURI );
    }
    else
    {
        OE_WARN << LC << "No FeatureSource; nothing will be rendered (" << getName() << ")" << std::endl;
    }

    _map = map;
}
virtual bool osgEarth::Features::FeatureModelSource::isSameKindAs ( const osg::Object *  obj) const [inline, virtual]

Reimplemented from osgEarth::ModelSource.

Definition at line 204 of file FeatureModelSource.

{ return dynamic_cast<const FeatureModelSource*>(obj)!=NULL; }
virtual const char* osgEarth::Features::FeatureModelSource::libraryName ( ) const [inline, virtual]

Reimplemented from osgEarth::ModelSource.

Definition at line 206 of file FeatureModelSource.

{ return "osgEarthFeatures"; }
void FeatureModelSource::setFeatureSource ( FeatureSource source)

Sets a feature source.

Definition at line 129 of file FeatureModelSource.cpp.

{
    if ( !_features.valid() )
    {
        _features = source;
    }
    else
    {
        OE_WARN << LC << "Illegal: cannot set a feature source after one is already set" << std::endl;
    }
}

Member Data Documentation

Definition at line 216 of file FeatureModelSource.

Definition at line 213 of file FeatureModelSource.

osg::ref_ptr<const Map> osgEarth::Features::FeatureModelSource::_map [protected]

Definition at line 214 of file FeatureModelSource.


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