osgEarth 2.1.1
Public Member Functions | Private Member Functions | Private Attributes

osgEarth::Symbology::ConstGeometryIterator Class Reference

Collaboration diagram for osgEarth::Symbology::ConstGeometryIterator:

List of all members.

Public Member Functions

 ConstGeometryIterator (const Geometry *geom, bool traversePolygonHoles=true)
bool hasMore () const
const Geometrynext ()

Private Member Functions

void fetchNext ()

Private Attributes

const Geometry_next
std::stack< const Geometry * > _stack
bool _traverseMulti
bool _traversePolyHoles

Detailed Description

Definition at line 353 of file Geometry.


Constructor & Destructor Documentation

ConstGeometryIterator::ConstGeometryIterator ( const Geometry geom,
bool  traversePolygonHoles = true 
)

New iterator.

traversePolyHoles: set to TRUE to return Polygons AND Polygon hole geometries; set to FALSE to only return Polygon (outer ring).

traverseMultiGeometry: set to TRUE to return MG children, but never an MG itself; set to FALSE to return MGs and NOT their children.

Definition at line 721 of file Geometry.cpp.

                                                                               :
_next( 0L ),
_traverseMulti( true ),
_traversePolyHoles( holes )
{
    if ( geom )
    {
        _stack.push( geom );
        fetchNext();
    }
}

Here is the call graph for this function:


Member Function Documentation

void ConstGeometryIterator::fetchNext ( ) [private]

Definition at line 748 of file Geometry.cpp.

{
    _next = 0L;
    if ( _stack.size() == 0 )
        return;

    const Geometry* current = _stack.top();
    _stack.pop();

    if ( current->getType() == Geometry::TYPE_MULTI && _traverseMulti )
    {
        const MultiGeometry* m = static_cast<const MultiGeometry*>(current);
        for( GeometryCollection::const_iterator i = m->getComponents().begin(); i != m->getComponents().end(); ++i )
            _stack.push( i->get() );
        fetchNext();
    }
    else if ( current->getType() == Geometry::TYPE_POLYGON && _traversePolyHoles )
    {
        const Polygon* p = static_cast<const Polygon*>(current);
        for( RingCollection::const_iterator i = p->getHoles().begin(); i != p->getHoles().end(); ++i )
            _stack.push( i->get() );
        _next = current;
    }
    else
    {
        _next = current;
    }    
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool ConstGeometryIterator::hasMore ( ) const

Definition at line 734 of file Geometry.cpp.

{
    return _next != 0L;
}

Here is the caller graph for this function:

const Geometry * ConstGeometryIterator::next ( )

Definition at line 740 of file Geometry.cpp.

{
    const Geometry* n = _next;
    fetchNext();
    return n;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 373 of file Geometry.

Definition at line 374 of file Geometry.

Definition at line 375 of file Geometry.

Definition at line 376 of file Geometry.


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