osgEarth 2.1.1
|
Public Member Functions | |
BufferFilter () | |
BufferFilter (const BufferFilter &rhs) | |
optional< double > & | distance () |
const optional< double > & | distance () const |
int | numQuadrantSegments () const |
int & | numQuadrantSegments () |
const Stroke::LineCapStyle & | capStyle () const |
Stroke::LineCapStyle & | capStyle () |
virtual FilterContext | push (FeatureList &input, FilterContext &context) |
Static Public Member Functions | |
static bool | isSupported () |
Protected Attributes | |
optional< double > | _distance |
int | _numQuadSegs |
Stroke::LineCapStyle | _capStyle |
The buffer geometry operation takes each input vector shape and applies morphological dilation or erosion to it. (see http://en.wikipedia.org/wiki/Morphological_image_processing)
The buffer distance determines which operation to use:
A positive distance dilates the shape (expands it). A negative distance erodes the shape (shrinks it).
Note: buffering always converts the input vector data into polygons.
Definition at line 46 of file BufferFilter.
BufferFilter::BufferFilter | ( | ) |
Definition at line 41 of file BufferFilter.cpp.
: _distance ( 1.0 ), _numQuadSegs( 0 ), _capStyle ( Stroke::LINECAP_DEFAULT ) { //NOP }
BufferFilter::BufferFilter | ( | const BufferFilter & | rhs | ) |
Definition at line 49 of file BufferFilter.cpp.
: _distance ( rhs._distance ), _numQuadSegs( rhs._numQuadSegs ), _capStyle ( rhs._capStyle ) { //NOP }
const Stroke::LineCapStyle& osgEarth::Features::BufferFilter::capStyle | ( | ) | const [inline] |
Definition at line 69 of file BufferFilter.
{ return _capStyle; }
Stroke::LineCapStyle& osgEarth::Features::BufferFilter::capStyle | ( | ) | [inline] |
Definition at line 70 of file BufferFilter.
{ return _capStyle; }
optional<double>& osgEarth::Features::BufferFilter::distance | ( | ) | [inline] |
Definition at line 60 of file BufferFilter.
{ return _distance; }
const optional<double>& osgEarth::Features::BufferFilter::distance | ( | ) | const [inline] |
Definition at line 61 of file BufferFilter.
{ return _distance; }
bool BufferFilter::isSupported | ( | ) | [static] |
Definition at line 26 of file BufferFilter.cpp.
{ #ifdef OSGEARTH_HAVE_GEOS static bool s_isSupported = true; #else static bool s_isSupported = false; #endif return s_isSupported; }
int osgEarth::Features::BufferFilter::numQuadrantSegments | ( | ) | const [inline] |
Definition at line 65 of file BufferFilter.
{ return _numQuadSegs; }
int& osgEarth::Features::BufferFilter::numQuadrantSegments | ( | ) | [inline] |
Definition at line 66 of file BufferFilter.
{ return _numQuadSegs; }
FilterContext BufferFilter::push | ( | FeatureList & | input, |
FilterContext & | context | ||
) | [virtual] |
Implements osgEarth::Features::FeatureFilter.
Definition at line 58 of file BufferFilter.cpp.
{ if ( !isSupported() ) { OE_WARN << "BufferFilter support not enabled - please compile osgEarth with GEOS" << std::endl; return context; } //OE_NOTICE << "Buffer: input = " << input.size() << " features" << std::endl; for( FeatureList::iterator i = input.begin(); i != input.end(); ++i ) { Feature* input = i->get(); if ( !input || !input->getGeometry() ) continue; osg::ref_ptr<Symbology::Geometry> output; Symbology::BufferParameters params; params._capStyle = _capStyle == Stroke::LINECAP_ROUND ? Symbology::BufferParameters::CAP_ROUND : _capStyle == Stroke::LINECAP_SQUARE ? Symbology::BufferParameters::CAP_SQUARE : _capStyle == Stroke::LINECAP_BUTT ? Symbology::BufferParameters::CAP_FLAT : Symbology::BufferParameters::CAP_SQUARE; params._cornerSegs = _numQuadSegs; if ( input->getGeometry()->buffer( _distance.value(), output, params ) ) { input->setGeometry( output.get() ); } } return context; }
Definition at line 78 of file BufferFilter.
optional<double> osgEarth::Features::BufferFilter::_distance [protected] |
Definition at line 76 of file BufferFilter.
int osgEarth::Features::BufferFilter::_numQuadSegs [protected] |
Definition at line 77 of file BufferFilter.