osgEarth 2.1.1
|
Public Member Functions | |
FeatureMaskSource (const MaskSourceOptions &options) | |
const MaskSourceOptions & | getOptions () const |
void | initialize (const std::string &referenceURI, const osgEarth::Map *map) |
osg::Vec3dArray * | createBoundary (const SpatialReference *srs, ProgressCallback *progress) |
Private Attributes | |
bool | _failed |
const FeatureMaskOptions | _options |
osg::ref_ptr< FeatureSource > | _features |
Definition at line 40 of file FeatureMaskSource.cpp.
FeatureMaskSource::FeatureMaskSource | ( | const MaskSourceOptions & | options | ) | [inline] |
Definition at line 43 of file FeatureMaskSource.cpp.
: MaskSource( options ), _options( options ), _failed( false ) { // 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; } } }
osg::Vec3dArray* FeatureMaskSource::createBoundary | ( | const SpatialReference * | srs, |
ProgressCallback * | progress | ||
) | [inline, virtual] |
Subclass implements this method to create the boundary geometry.
Implements osgEarth::MaskSource.
Definition at line 78 of file FeatureMaskSource.cpp.
{ if ( _failed ) return 0L; if ( _features.valid() ) { if ( _features->getFeatureProfile() ) { osg::ref_ptr<FeatureCursor> cursor = _features->createFeatureCursor(); if ( cursor ) { if ( cursor->hasMore() ) { Feature* f = cursor->nextFeature(); if ( f && f->getGeometry() ) { // Init a filter to tranform feature in desired SRS if (!srs->isEquivalentTo(_features->getFeatureProfile()->getSRS())) { FilterContext cx; cx.profile() = new FeatureProfile(_features->getFeatureProfile()->getExtent()); //cx.isGeocentric() = _features->getFeatureProfile()->getSRS()->isGeographic(); TransformFilter xform( srs ); FeatureList featureList; featureList.push_back(f); cx = xform.push(featureList, cx); } return f->getGeometry()->toVec3dArray(); } } } } else { OE_WARN << LC << "Failed to create boundary; feature source has no SRS" << std::endl; _failed = true; } } else { OE_WARN << LC << "Unable to create boundary; invalid feature source" << std::endl; _failed = true; } return 0L; }
const MaskSourceOptions& FeatureMaskSource::getOptions | ( | ) | const [inline] |
Reimplemented from osgEarth::MaskSource.
Definition at line 61 of file FeatureMaskSource.cpp.
{ return _options; }
void FeatureMaskSource::initialize | ( | const std::string & | referenceURI, |
const osgEarth::Map * | map | ||
) | [inline, virtual] |
Reimplemented from osgEarth::MaskSource.
Definition at line 64 of file FeatureMaskSource.cpp.
{ MaskSource::initialize( referenceURI, map ); if ( _features.valid() ) { _features->initialize( referenceURI ); } else { OE_WARN << LC << "No FeatureSource; nothing will be rendered (" << getName() << ")" << std::endl; } }
bool FeatureMaskSource::_failed [private] |
Definition at line 127 of file FeatureMaskSource.cpp.
osg::ref_ptr<FeatureSource> FeatureMaskSource::_features [private] |
Definition at line 129 of file FeatureMaskSource.cpp.
const FeatureMaskOptions FeatureMaskSource::_options [private] |
Reimplemented from osgEarth::MaskSource.
Definition at line 128 of file FeatureMaskSource.cpp.