osgEarth 2.1.1
|
Static Public Member Functions | |
static FeatureSource * | create (const FeatureSourceOptions &options) |
Factory class that will instantiate a FeatureSource corresponding to a driver name.
Definition at line 232 of file FeatureSource.
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; }