osgEarth 2.1.1
|
Public Member Functions | |
optional< std::string > & | name () |
const optional< std::string > & | name () const |
FeatureFilterList & | filters () |
const FeatureFilterList & | filters () const |
optional< bool > & | openWrite () |
const optional< bool > & | openWrite () const |
optional< ProfileOptions > & | profile () |
const optional< ProfileOptions > & | profile () const |
FeatureSourceOptions (const ConfigOptions &options=ConfigOptions()) | |
virtual Config | getConfig () const |
Protected Member Functions | |
virtual void | mergeConfig (const Config &conf) |
Private Member Functions | |
void | fromConfig (const Config &conf) |
Private Attributes | |
FeatureFilterList | _filters |
optional< std::string > | _name |
optional< bool > | _openWrite |
optional< ProfileOptions > | _profile |
Configuration options for creating a FeatureSource.
Definition at line 44 of file FeatureSource.
FeatureSourceOptions::FeatureSourceOptions | ( | const ConfigOptions & | options = ConfigOptions() | ) |
Definition at line 33 of file FeatureSource.cpp.
: DriverConfigOptions( options ) { fromConfig( _conf ); }
FeatureFilterList& osgEarth::Features::FeatureSourceOptions::filters | ( | ) | [inline] |
List of filteres to apply to features read from this source
Definition at line 53 of file FeatureSource.
{ return _filters; }
const FeatureFilterList& osgEarth::Features::FeatureSourceOptions::filters | ( | ) | const [inline] |
Definition at line 54 of file FeatureSource.
{ return _filters; }
void FeatureSourceOptions::fromConfig | ( | const Config & | conf | ) | [private] |
Reimplemented from osgEarth::DriverConfigOptions.
Reimplemented in osgEarth::Drivers::OGRFeatureOptions, and osgEarth::Drivers::WFSFeatureOptions.
Definition at line 40 of file FeatureSource.cpp.
{ unsigned numResamples = 0; conf.getIfSet ( "open_write", _openWrite ); conf.getIfSet ( "name", _name ); conf.getObjIfSet( "profile", _profile ); const ConfigSet& children = conf.children(); for( ConfigSet::const_iterator i = children.begin(); i != children.end(); ++i ) { const Config& child = *i; if ( child.key() == "buffer" && !child.empty() ) { BufferFilter* buffer = new BufferFilter(); child.getIfSet( "distance", buffer->distance() ); _filters.push_back( buffer ); if ( numResamples > 0 ) { OE_WARN << LC << "Warning: Resampling should be applied before buffering, as buffering" << " will remove colinear segments created by the buffer operation." << std::endl; } OE_DEBUG << LC << "Added buffer filter" << std::endl; } else if ( child.key() == "resample" && !child.empty() ) { ResampleFilter* resample = new ResampleFilter(); child.getIfSet( "min_length", resample->minLength() ); child.getIfSet( "max_length", resample->maxLength() ); _filters.push_back( resample ); numResamples++; OE_DEBUG << LC << "Added resample filter" << std::endl; } else if ( child.key() == "convert" && !child.empty() ) { ConvertTypeFilter* convert = new ConvertTypeFilter(); optional<Geometry::Type> type = Geometry::TYPE_POINTSET; child.getIfSet( "type", "point", type, Geometry::TYPE_POINTSET ); child.getIfSet( "type", "line", type, Geometry::TYPE_LINESTRING ); child.getIfSet( "type", "polygon", type, Geometry::TYPE_POLYGON ); convert->toType() = *type; _filters.push_back( convert ); OE_DEBUG << LC << "Added convert filter" << std::endl; } } }
Config FeatureSourceOptions::getConfig | ( | ) | const [virtual] |
Gets or sets the name of the object
Reimplemented from osgEarth::DriverConfigOptions.
Reimplemented in osgEarth::Drivers::OGRFeatureOptions, and osgEarth::Drivers::WFSFeatureOptions.
Definition at line 97 of file FeatureSource.cpp.
{ Config conf = DriverConfigOptions::getConfig(); conf.updateIfSet ( "open_write", _openWrite ); conf.updateIfSet ( "name", _name ); conf.updateObjIfSet( "profile", _profile ); //TODO: make each of these filters Configurable. for( FeatureFilterList::const_iterator i = _filters.begin(); i != _filters.end(); ++i ) { BufferFilter* buffer = dynamic_cast<BufferFilter*>( i->get() ); if ( buffer ) { Config bufferConf( "buffer" ); bufferConf.addIfSet( "distance", buffer->distance() ); conf.update( bufferConf ); } ResampleFilter* resample = dynamic_cast<ResampleFilter*>( i->get() ); if ( resample ) { Config resampleConf( "resample" ); resampleConf.addIfSet( "min_length", resample->minLength() ); resampleConf.addIfSet( "max_length", resample->maxLength() ); conf.update( resampleConf ); } ConvertTypeFilter* convert = dynamic_cast<ConvertTypeFilter*>( i->get() ); if ( convert ) { Config convertConf( "convert" ); optional<Geometry::Type> type( convert->toType(), convert->toType() ); // weird optional ctor :) convertConf.addIfSet( "type", "point", type, Geometry::TYPE_POINTSET ); convertConf.addIfSet( "type", "line", type, Geometry::TYPE_LINESTRING ); convertConf.addIfSet( "type", "polygon", type, Geometry::TYPE_POLYGON ); conf.update( convertConf ); } } return conf; }
virtual void osgEarth::Features::FeatureSourceOptions::mergeConfig | ( | const Config & | conf | ) | [inline, protected, virtual] |
Reimplemented from osgEarth::DriverConfigOptions.
Reimplemented in osgEarth::Drivers::OGRFeatureOptions, and osgEarth::Drivers::WFSFeatureOptions.
Definition at line 70 of file FeatureSource.
{ DriverConfigOptions::mergeConfig( conf ); fromConfig( conf ); }
const optional<std::string>& osgEarth::Features::FeatureSourceOptions::name | ( | ) | const [inline] |
Definition at line 50 of file FeatureSource.
{ return _name; }
optional<std::string>& osgEarth::Features::FeatureSourceOptions::name | ( | ) | [inline] |
optional<bool>& osgEarth::Features::FeatureSourceOptions::openWrite | ( | ) | [inline] |
Opens the feature data for writing, if supported
Definition at line 57 of file FeatureSource.
{ return _openWrite; }
const optional<bool>& osgEarth::Features::FeatureSourceOptions::openWrite | ( | ) | const [inline] |
Definition at line 58 of file FeatureSource.
{ return _openWrite; }
const optional<ProfileOptions>& osgEarth::Features::FeatureSourceOptions::profile | ( | ) | const [inline] |
Definition at line 62 of file FeatureSource.
{ return _profile; }
optional<ProfileOptions>& osgEarth::Features::FeatureSourceOptions::profile | ( | ) | [inline] |
Explicitly overrides profile information contained in the actual data source.
Definition at line 61 of file FeatureSource.
{ return _profile; }
Definition at line 78 of file FeatureSource.
optional<std::string> osgEarth::Features::FeatureSourceOptions::_name [private] |
Reimplemented from osgEarth::DriverConfigOptions.
Definition at line 79 of file FeatureSource.
optional< bool > osgEarth::Features::FeatureSourceOptions::_openWrite [private] |
Definition at line 80 of file FeatureSource.
Definition at line 81 of file FeatureSource.