osgEarth 2.1.1
Public Member Functions | Public Attributes

osgEarth::FillNoDataOperator Struct Reference

Inheritance diagram for osgEarth::FillNoDataOperator:
Collaboration diagram for osgEarth::FillNoDataOperator:

List of all members.

Public Member Functions

 FillNoDataOperator ()
virtual void operator() (osg::HeightField *heightField)
osgTerrain::ValidDataOperator * getValidDataOperator ()
void setValidDataOperator (osgTerrain::ValidDataOperator *validDataOperator)
float getDefaultValue ()
void setDefaultValue (float defaultValue)

Public Attributes

osg::ref_ptr
< osgTerrain::ValidDataOperator > 
_validDataOperator
float _defaultValue

Detailed Description

Visitor that replaces "invalid" data values with a default value.

Definition at line 163 of file HeightFieldUtils.


Constructor & Destructor Documentation

FillNoDataOperator::FillNoDataOperator ( )

Definition at line 419 of file HeightFieldUtils.cpp.

                                      :
_defaultValue(0.0f)
{
}

Member Function Documentation

float osgEarth::FillNoDataOperator::getDefaultValue ( ) [inline]

Definition at line 172 of file HeightFieldUtils.

{ return _defaultValue; }
osgTerrain::ValidDataOperator* osgEarth::FillNoDataOperator::getValidDataOperator ( ) [inline]

Definition at line 169 of file HeightFieldUtils.

{ return _validDataOperator.get(); }
void FillNoDataOperator::operator() ( osg::HeightField *  heightField) [virtual]

Definition at line 425 of file HeightFieldUtils.cpp.

{
    if (heightField && _validDataOperator.valid())
    {
        for( unsigned int row=0; row < heightField->getNumRows(); row++ )
        {
            for( unsigned int col=0; col < heightField->getNumColumns(); col++ )
            {
                float val = heightField->getHeight(col, row);

                if (!(*_validDataOperator)(val))
                {
                    if ( col > 0 )
                        val = heightField->getHeight(col-1,row);
                    else if ( col <= heightField->getNumColumns()-1 )
                        val = heightField->getHeight(col+1,row);

                    if (!(*_validDataOperator)(val))
                    {
                        if ( row > 0 )
                            val = heightField->getHeight(col, row-1);
                        else if ( row < heightField->getNumRows()-1 )
                            val = heightField->getHeight(col, row+1);
                    }

                    if (!(*_validDataOperator)(val))
                    {
                        val = _defaultValue;
                    }

                    heightField->setHeight( col, row, val );
                }
            }
        }
    }
}
void osgEarth::FillNoDataOperator::setDefaultValue ( float  defaultValue) [inline]

Definition at line 173 of file HeightFieldUtils.

{ _defaultValue = defaultValue; }
void osgEarth::FillNoDataOperator::setValidDataOperator ( osgTerrain::ValidDataOperator *  validDataOperator) [inline]

Definition at line 170 of file HeightFieldUtils.

{ _validDataOperator = validDataOperator; }

Member Data Documentation

Definition at line 177 of file HeightFieldUtils.

osg::ref_ptr<osgTerrain::ValidDataOperator> osgEarth::FillNoDataOperator::_validDataOperator

Definition at line 175 of file HeightFieldUtils.


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