osgEarth 2.1.1
|
Public Member Functions | |
ConstGeometryIterator (const Geometry *geom, bool traversePolygonHoles=true) | |
bool | hasMore () const |
const Geometry * | next () |
Private Member Functions | |
void | fetchNext () |
Private Attributes | |
const Geometry * | _next |
std::stack< const Geometry * > | _stack |
bool | _traverseMulti |
bool | _traversePolyHoles |
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(); } }
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; } }
bool ConstGeometryIterator::hasMore | ( | ) | const |
Definition at line 734 of file Geometry.cpp.
{ return _next != 0L; }
const Geometry * ConstGeometryIterator::next | ( | ) |
Definition at line 740 of file Geometry.cpp.
const Geometry* osgEarth::Symbology::ConstGeometryIterator::_next [private] |
std::stack<const Geometry*> osgEarth::Symbology::ConstGeometryIterator::_stack [private] |
bool osgEarth::Symbology::ConstGeometryIterator::_traverseMulti [private] |