osgEarth 2.1.1
|
Public Member Functions | |
ScaleFilter () | |
ScaleFilter (double scale) | |
double | scale () const |
double & | scale () |
virtual FilterContext | push (FeatureList &input, FilterContext &cx) |
Protected Attributes | |
double | _scale |
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.
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.
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; }
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; }
double osgEarth::Features::ScaleFilter::_scale [protected] |
Definition at line 48 of file ScaleFilter.