osgEarth 2.1.1
Public Member Functions | Protected Attributes

osgEarth::Features::ScaleFilter Class Reference

Inheritance diagram for osgEarth::Features::ScaleFilter:
Collaboration diagram for osgEarth::Features::ScaleFilter:

List of all members.

Public Member Functions

 ScaleFilter ()
 ScaleFilter (double scale)
double scale () const
double & scale ()
virtual FilterContext push (FeatureList &input, FilterContext &cx)

Protected Attributes

double _scale

Detailed Description

The scale filter is kind of a poor-man's buffer. It simply scales and re-centers the feature geometry within its envelope.

Definition at line 35 of file ScaleFilter.


Constructor & Destructor Documentation

ScaleFilter::ScaleFilter ( )

Definition at line 26 of file ScaleFilter.cpp.

                         :
_scale( 0.0 )
{
    //NOP
}
ScaleFilter::ScaleFilter ( double  scale)

Definition at line 32 of file ScaleFilter.cpp.

                                       :
_scale( scale )
{
    //NOP
}

Member Function Documentation

FilterContext ScaleFilter::push ( FeatureList input,
FilterContext cx 
) [virtual]

Implements osgEarth::Features::FeatureFilter.

Definition at line 39 of file ScaleFilter.cpp.

{
    for( FeatureList::iterator i = input.begin(); i != input.end(); ++i )
    {
        Feature* input = i->get();
        if ( input && input->getGeometry() )
        {
            Bounds envelope = input->getGeometry()->getBounds();

            // now scale and shift everything
            GeometryIterator scale_iter( input->getGeometry() );
            while( scale_iter.hasMore() )
            {
                Geometry* geom = scale_iter.next();
                for( osg::Vec3dArray::iterator v = geom->begin(); v != geom->end(); v++ )
                {
                    double xr = (v->x() - envelope.xMin()) / envelope.width();
                    v->x() += (xr - 0.5) * _scale;

                    double yr = (v->y() - envelope.yMin()) / envelope.height();
                    v->y() += (yr - 0.5) * _scale;
                }
            }
        }
    }

    return cx;
}

Here is the call graph for this function:

double osgEarth::Features::ScaleFilter::scale ( ) const [inline]

Definition at line 41 of file ScaleFilter.

{ return _scale; }
double& osgEarth::Features::ScaleFilter::scale ( ) [inline]

Definition at line 42 of file ScaleFilter.

{ return _scale; }

Member Data Documentation

Definition at line 48 of file ScaleFilter.


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