osgEarth 2.1.1
Public Member Functions | Static Public Member Functions | Protected Attributes

osgEarth::Features::BufferFilter Class Reference

Inheritance diagram for osgEarth::Features::BufferFilter:
Collaboration diagram for osgEarth::Features::BufferFilter:

List of all members.

Public Member Functions

 BufferFilter ()
 BufferFilter (const BufferFilter &rhs)
optional< double > & distance ()
const optional< double > & distance () const
int numQuadrantSegments () const
int & numQuadrantSegments ()
const Stroke::LineCapStylecapStyle () const
Stroke::LineCapStylecapStyle ()
virtual FilterContext push (FeatureList &input, FilterContext &context)

Static Public Member Functions

static bool isSupported ()

Protected Attributes

optional< double > _distance
int _numQuadSegs
Stroke::LineCapStyle _capStyle

Detailed Description

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.


Constructor & Destructor Documentation

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
}

Member Function Documentation

const Stroke::LineCapStyle& osgEarth::Features::BufferFilter::capStyle ( ) const [inline]

Definition at line 69 of file BufferFilter.

{ return _capStyle; }

Here is the caller graph for this function:

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; }

Here is the caller graph for this function:

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;
}

Here is the caller graph for this function:

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;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 78 of file BufferFilter.

Definition at line 76 of file BufferFilter.

Definition at line 77 of file BufferFilter.


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