osgEarth 2.1.1
Static Public Member Functions

osgEarth::Features::FeatureSourceFactory Class Reference

List of all members.

Static Public Member Functions

static FeatureSourcecreate (const FeatureSourceOptions &options)

Detailed Description

Factory class that will instantiate a FeatureSource corresponding to a driver name.

Definition at line 232 of file FeatureSource.


Member Function Documentation

FeatureSource * FeatureSourceFactory::create ( const FeatureSourceOptions options) [static]

Definition at line 184 of file FeatureSource.cpp.

{
    FeatureSource* featureSource = 0L;

    if ( !options.getDriver().empty() )
    {
        std::string driverExt = std::string(".osgearth_feature_") + options.getDriver();

        osg::ref_ptr<osgDB::ReaderWriter::Options> rwopts = new osgDB::ReaderWriter::Options();
        rwopts->setPluginData( FEATURE_SOURCE_OPTIONS_TAG, (void*)&options );

        featureSource = dynamic_cast<FeatureSource*>( osgDB::readObjectFile( driverExt, rwopts.get() ) );
        if ( featureSource )
        {
            if ( options.name().isSet() )
                featureSource->setName( *options.name() );
            else
                featureSource->setName( options.getDriver() );
        }
        else
        {
            OE_WARN << LC << "FAILED to load feature driver \"" << options.getDriver() << "\"" << std::endl;
        }
    }
    else
    {
        OE_WARN << LC << "ILLEGAL null feature driver name" << std::endl;
    }

    return featureSource;
}

Here is the call graph for this function:

Here is the caller graph for this function:


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