Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::EdgeIterator Class Reference
[Geometry Iterators]

Geometry Iterator for faces (tris and quads). See Geometry Iterators for a description. More...

#include <OSGEdgeIterator.h>

Inheritance diagram for osg::EdgeIterator:

osg::PrimitiveIterator List of all members.

Public Member Functions

Constructors
EdgeIterator (void)
 EdgeIterator (const EdgeIterator &source)
 EdgeIterator (const GeometryPtr &geo)
 EdgeIterator (const NodePtr &geo)
Destructors
*virtual ~EdgeIterator (void)
Access
*Int32 getIndex (void) const
UInt32 getLength (void) const
Int32 getPositionIndex (Int32 which) const
Pnt3f getPosition (Int32 which) const
Int32 getNormalIndex (Int32 which) const
Vec3f getNormal (Int32 which) const
Int32 getColorIndex (Int32 which) const
Color3f getColor (Int32 which) const
Int32 getSecondaryColorIndex (Int32 which) const
Color3f getSecondaryColor (Int32 which) const
Int32 getTexCoordsIndex (Int32 which) const
Vec2f getTexCoords (Int32 which) const
Int32 getTexCoordsIndex1 (Int32 which) const
Vec2f getTexCoords1 (Int32 which) const
Int32 getTexCoordsIndex2 (Int32 which) const
Vec2f getTexCoords2 (Int32 which) const
Int32 getTexCoordsIndex3 (Int32 which) const
Vec2f getTexCoords3 (Int32 which) const
Int32 getIndexIndex (Int32 which) const
Operators
*void seek (Int32 index)
void operator++ (void)
EdgeIteratoroperator= (const EdgeIterator &source)
bool operator< (const EdgeIterator &other) const
bool operator== (const EdgeIterator &other) const
bool operator!= (const EdgeIterator &other) const
Field Set
*void setToBegin (void)
void setToEnd (void)

Static Public Member Functions

Class Get
*static const char * getClassname (void)

Protected Types

typedef PrimitiveIterator Inherited

Private Member Functions

void startPrim (void)

Private Attributes

Int32 _edgeIndex
UInt32 _actPrimIndex
Int32 _edgePntIndex [2]

Static Private Attributes

static char cvsid [] = "@(#)$Id: OSGEdgeIterator.cpp,v 1.1 2005/01/14 11:24:21 a-m-z Exp $"

Detailed Description

The EdgeIterator iterates through the geometry one edge at a time. See Edge Iterator for a description.

See also:
PrimitiveIterator EdgeIterator

Definition at line 60 of file OSGEdgeIterator.h.


Member Typedef Documentation

typedef PrimitiveIterator osg::EdgeIterator::Inherited [protected]
 

Definition at line 144 of file OSGEdgeIterator.h.


Constructor & Destructor Documentation

EdgeIterator::EdgeIterator void   ) 
 

Definition at line 109 of file OSGEdgeIterator.cpp.

00109                                :  PrimitiveIterator(),
00110     _edgeIndex(0), _actPrimIndex(), _edgePntIndex()
00111 {
00112 }

EdgeIterator::EdgeIterator const EdgeIterator source  ) 
 

Definition at line 114 of file OSGEdgeIterator.cpp.

References _edgePntIndex.

00114                                                      :
00115     PrimitiveIterator(source),
00116     _edgeIndex(source._edgeIndex),
00117     _actPrimIndex(source._actPrimIndex),
00118     _edgePntIndex()
00119 {
00120     _edgePntIndex[0] = source._edgePntIndex[0];
00121     _edgePntIndex[1] = source._edgePntIndex[1];
00122 }

EdgeIterator::EdgeIterator const GeometryPtr geo  ) 
 

This constructor creates an iterator for the given geometry. It is useful to create an iterator to be used to seek() to a specific indexed edge. Otherwise, use Geometry::beginEdges() resp. Geometry::endEdges() to create an iterator.

Definition at line 140 of file OSGEdgeIterator.cpp.

References osg::PrimitiveIterator::setGeo().

00140                                                  : PrimitiveIterator(),
00141     _edgeIndex(0), _actPrimIndex(), _edgePntIndex()
00142 {
00143     setGeo(geo);
00144 }

EdgeIterator::EdgeIterator const NodePtr geo  ) 
 

This constructor creates an iterator for the given node. It is useful to create an iterator to be used to seek() to a specific indexed edge. Otherwise, use Geometry::beginEdges() resp. Geometry::endEdges() to create an iterator.

Definition at line 129 of file OSGEdgeIterator.cpp.

References osg::PrimitiveIterator::setGeo().

00129                                              : PrimitiveIterator(),
00130     _edgeIndex(0), _actPrimIndex(), _edgePntIndex()
00131 {
00132     setGeo(geo);
00133 }

EdgeIterator::~EdgeIterator void   )  [virtual]
 

Definition at line 147 of file OSGEdgeIterator.cpp.

00148 {
00149 }


Member Function Documentation

* static const char* osg::EdgeIterator::getClassname void   )  [inline, static]
 

Reimplemented from osg::PrimitiveIterator.

Definition at line 69 of file OSGEdgeIterator.h.

00069 { return "EdgeIterator"; }

Int32 osg::EdgeIterator::getIndex void   )  const [inline]
 

Return the index of the current primitive. The index runs from 0 to the number of faces in the geometry. Its main use is as an input to seek().

Reimplemented from osg::PrimitiveIterator.

Definition at line 51 of file OSGEdgeIterator.inl.

References _edgeIndex.

Referenced by seek().

00052 {
00053     return _edgeIndex;
00054 }

UInt32 osg::EdgeIterator::getLength void   )  const [inline]
 

Return the length of the current face. 3 or 4, depending on the current primitive.

Reimplemented from osg::PrimitiveIterator.

Definition at line 62 of file OSGEdgeIterator.inl.

References osg::PrimitiveIterator::getLength(), and osg::PrimitiveIterator::getType().

00063 {
00064     if ( getType() == GL_LINES )
00065         return 2;
00066     else
00067         return Inherited::getLength();
00068 }

Int32 osg::EdgeIterator::getPositionIndex Int32  which  )  const [inline]
 

Return the position index (i.e. the number of the entry in the positions property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

Reimplemented from osg::PrimitiveIterator.

Definition at line 101 of file OSGEdgeIterator.inl.

References _edgePntIndex, osg::PrimitiveIterator::getPositionIndex(), and osg::PrimitiveIterator::getType().

Referenced by getPosition().

00102 {
00103     if ( getType() == GL_LINES )
00104         return Inherited::getPositionIndex(_edgePntIndex[which]);
00105     else
00106         return Inherited::getPositionIndex(which);
00107 }

Pnt3f osg::EdgeIterator::getPosition Int32  which  )  const [inline]
 

Return the position of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

Reimplemented from osg::PrimitiveIterator.

Definition at line 110 of file OSGEdgeIterator.inl.

References osg::PrimitiveIterator::getGeometry(), and getPositionIndex().

00111 { 
00112     Int32 ind = getPositionIndex(which);
00113 
00114     return getGeometry()->getPositions()->getValue(ind);
00115 }

Int32 osg::EdgeIterator::getNormalIndex Int32  which  )  const [inline]
 

Return the normal index (i.e. the number of the entry in the normal property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no normals, -1 is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 118 of file OSGEdgeIterator.inl.

References _edgePntIndex, osg::PrimitiveIterator::getNormalIndex(), and osg::PrimitiveIterator::getType().

Referenced by getNormal().

00119 {
00120     if ( getType() == GL_LINES )
00121         return Inherited::getNormalIndex(_edgePntIndex[which]);
00122     else
00123         return Inherited::getNormalIndex(which);
00124 }

Vec3f osg::EdgeIterator::getNormal Int32  which  )  const [inline]
 

Return the normal of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no normals, Vec3f::Null is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 127 of file OSGEdgeIterator.inl.

References osg::PrimitiveIterator::getGeometry(), and getNormalIndex().

00128 { 
00129     Int32 ind = getNormalIndex(which);
00130 
00131     return getGeometry()->getNormals()->getValue(ind);
00132 }

Int32 osg::EdgeIterator::getColorIndex Int32  which  )  const [inline]
 

Return the color index (i.e. the number of the entry in the color property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no colors, -1 is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 135 of file OSGEdgeIterator.inl.

References _edgePntIndex, osg::PrimitiveIterator::getColorIndex(), and osg::PrimitiveIterator::getType().

Referenced by getColor().

00136 {
00137     if ( getType() == GL_LINES )
00138         return Inherited::getColorIndex(_edgePntIndex[which]);
00139     else
00140         return Inherited::getColorIndex(which);
00141 }

Color3f osg::EdgeIterator::getColor Int32  which  )  const [inline]
 

Return the color of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no colors, Color3f::Null is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 144 of file OSGEdgeIterator.inl.

References getColorIndex(), and osg::PrimitiveIterator::getGeometry().

00145 { 
00146     Int32 ind = getColorIndex(which);
00147 
00148     return getGeometry()->getColors()->getValue(ind);
00149 }

Int32 osg::EdgeIterator::getSecondaryColorIndex Int32  which  )  const [inline]
 

Return the secondary color index (i.e. the number of the entry in the secondary color property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no secondary colors, -1 is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 152 of file OSGEdgeIterator.inl.

References _edgePntIndex, osg::PrimitiveIterator::getSecondaryColorIndex(), and osg::PrimitiveIterator::getType().

Referenced by getSecondaryColor().

00153 {
00154     if ( getType() == GL_LINES )
00155         return Inherited::getSecondaryColorIndex(_edgePntIndex[which]);
00156     else
00157         return Inherited::getSecondaryColorIndex(which);
00158 }

Color3f osg::EdgeIterator::getSecondaryColor Int32  which  )  const [inline]
 

Return the secondary color of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no secondary colors, Color3f::Null is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 161 of file OSGEdgeIterator.inl.

References osg::PrimitiveIterator::getGeometry(), and getSecondaryColorIndex().

00162 { 
00163     Int32 ind = getSecondaryColorIndex(which);
00164 
00165     return getGeometry()->getSecondaryColors()->getValue(ind);
00166 }

Int32 osg::EdgeIterator::getTexCoordsIndex Int32  which  )  const [inline]
 

Return the texture coordinates index (i.e. the number of the entry in the texture coordinates property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no texture coordinates, -1 is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 169 of file OSGEdgeIterator.inl.

References _edgePntIndex, osg::PrimitiveIterator::getTexCoordsIndex(), and osg::PrimitiveIterator::getType().

Referenced by getTexCoords().

00170 {
00171     if ( getType() == GL_LINES )
00172         return Inherited::getTexCoordsIndex(_edgePntIndex[which]);
00173     else
00174         return Inherited::getTexCoordsIndex(which);
00175 }

Vec2f osg::EdgeIterator::getTexCoords Int32  which  )  const [inline]
 

Return the texture coordinates of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no texture coordinates, Vec2f::Null is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 178 of file OSGEdgeIterator.inl.

References osg::PrimitiveIterator::getGeometry(), and getTexCoordsIndex().

00179 { 
00180     Int32 ind = getTexCoordsIndex(which);
00181 
00182     return getGeometry()->getTexCoords()->getValue(ind);
00183 }

Int32 osg::EdgeIterator::getTexCoordsIndex1 Int32  which  )  const [inline]
 

Return the second texture coordinates index (i.e. the number of the entry in the textureCoordinates1 property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no second texture coordinates, -1 is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 187 of file OSGEdgeIterator.inl.

References _edgePntIndex, osg::PrimitiveIterator::getTexCoordsIndex1(), and osg::PrimitiveIterator::getType().

Referenced by getTexCoords1().

00188 {
00189     if ( getType() == GL_LINES )
00190         return Inherited::getTexCoordsIndex1(_edgePntIndex[which]);
00191     else
00192         return Inherited::getTexCoordsIndex1(which);
00193 }

Vec2f osg::EdgeIterator::getTexCoords1 Int32  which  )  const [inline]
 

Return the second texture coordinates of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no second texture coordinates, Vec2f::Null is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 196 of file OSGEdgeIterator.inl.

References osg::PrimitiveIterator::getGeometry(), and getTexCoordsIndex1().

00197 { 
00198     Int32 ind = getTexCoordsIndex1(which);
00199 
00200     return getGeometry()->getTexCoords1()->getValue(ind);
00201 }

Int32 osg::EdgeIterator::getTexCoordsIndex2 Int32  which  )  const [inline]
 

Return the third texture coordinates index (i.e. the number of the entry in the textureCoordinates2 property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no third texture coordinates, -1 is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 204 of file OSGEdgeIterator.inl.

References _edgePntIndex, osg::PrimitiveIterator::getTexCoordsIndex2(), and osg::PrimitiveIterator::getType().

Referenced by getTexCoords2().

00205 {
00206     if ( getType() == GL_LINES )
00207         return Inherited::getTexCoordsIndex2(_edgePntIndex[which]);
00208     else
00209         return Inherited::getTexCoordsIndex2(which);
00210 }

Vec2f osg::EdgeIterator::getTexCoords2 Int32  which  )  const [inline]
 

Return the third texture coordinates of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no third texture coordinates, Vec2f::Null is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 213 of file OSGEdgeIterator.inl.

References osg::PrimitiveIterator::getGeometry(), and getTexCoordsIndex2().

00214 { 
00215     Int32 ind = getTexCoordsIndex2(which);
00216 
00217     return getGeometry()->getTexCoords2()->getValue(ind);
00218 }

Int32 osg::EdgeIterator::getTexCoordsIndex3 Int32  which  )  const [inline]
 

Return the fourth texture coordinates index (i.e. the number of the entry in the textureCoordinates3 property which is used) of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no fourth texture coordinates, -1 is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 221 of file OSGEdgeIterator.inl.

References _edgePntIndex, osg::PrimitiveIterator::getTexCoordsIndex3(), and osg::PrimitiveIterator::getType().

Referenced by getTexCoords3().

00222 {
00223     if ( getType() == GL_LINES )
00224         return Inherited::getTexCoordsIndex3(_edgePntIndex[which]);
00225     else
00226         return Inherited::getTexCoordsIndex3(which);
00227 }

Vec2f osg::EdgeIterator::getTexCoords3 Int32  which  )  const [inline]
 

Return the fourth texture coordinates of a point in the current primitive. which is the point to access. Must be between 0 and getLength().

If the geometry has no fourth texture coordinates, Vec2f::Null is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 230 of file OSGEdgeIterator.inl.

References osg::PrimitiveIterator::getGeometry(), and getTexCoordsIndex3().

00231 { 
00232     Int32 ind = getTexCoordsIndex3(which);
00233 
00234     return getGeometry()->getTexCoords3()->getValue(ind);
00235 }

Int32 osg::EdgeIterator::getIndexIndex Int32  which  )  const [inline]
 

Return the index index of a point in the current primitive. The index index is the number of the index used for this point in the index property. which is the point to access. Must be between 0 and getLength().

For multi-indexed geometry it is the index of the beginning of the index block used. See Indexing for details on indexing.

If the geometry has no indices, -1 is returned.

Reimplemented from osg::PrimitiveIterator.

Definition at line 238 of file OSGEdgeIterator.inl.

References _edgePntIndex, osg::PrimitiveIterator::getIndexIndex(), and osg::PrimitiveIterator::getType().

00239 {
00240     if ( getType() == GL_LINES )
00241         return Inherited::getIndexIndex(_edgePntIndex[which]);
00242     else
00243         return Inherited::getIndexIndex(which);
00244 }

void EdgeIterator::seek Int32  index  ) 
 

Seek the iterator to a specific edge indicated by its index.

This is primarily used in conjunction with osg::EdgeIterator::getIndex to record a position in the iteration and later return to it.

Reimplemented from osg::PrimitiveIterator.

Definition at line 261 of file OSGEdgeIterator.cpp.

References getIndex(), and setToBegin().

00262 {
00263     setToBegin();
00264     
00265     while(getIndex() != index)
00266         ++(*this);
00267 }

void EdgeIterator::operator++ void   ) 
 

The increment operator steps the iterator to the next edge. If it is already beyond the last edge it does not change.

Dev: This is the central function of the whole iterator. It changes _edgePntIndex to contain the data for the next edge, depending on the type of the currently active primitive and steps to the next primitive if the current one is exhausted. The only tricky part is the left/right swap for triangle strips, the rest is pretty simple.

Reimplemented from osg::PrimitiveIterator.

Definition at line 162 of file OSGEdgeIterator.cpp.

References _actPrimIndex, _edgeIndex, _edgePntIndex, osg::PrimitiveIterator::getLength(), osg::PrimitiveIterator::getType(), osg::PrimitiveIterator::isAtEnd(), startPrim(), and SWARNING.

00163 {
00164     // already at end?
00165     if(isAtEnd())
00166         return;
00167     
00168     ++_edgeIndex;
00169 
00170     // at end of primitive?
00171     if(_actPrimIndex >= PrimitiveIterator::getLength() ||
00172        getType() == GL_LINE_STRIP ||
00173        getType() == GL_LINE_LOOP    )  // TODO: add GL_POLYLINE here ?!?!
00174     {
00175         ++(static_cast<PrimitiveIterator&>(*this));
00176         
00177         startPrim();
00178         
00179         return;
00180     }
00181 
00182     switch(getType())
00183     {
00184     case GL_LINES:          _edgePntIndex[0] = _actPrimIndex++;
00185                             _edgePntIndex[1] = _actPrimIndex++;
00186                             break;
00187 #if 0 // probably to be implemented
00188                             
00189     case GL_POLYGON:        TODO
00190                             break;  
00191     case GL_TRIANGLES:      TODO
00192                             break;
00193     case GL_QUAD_STRIP:     TODO
00194                             break;
00195     case GL_TRIANGLE_STRIP: TODO
00196                             break;
00197     case GL_TRIANGLE_FAN:   TODO
00198                             break;
00199     case GL_QUADS:          TODO
00200                             break;
00201 #endif // probably to be implemented
00202     default:                SWARNING << "EdgeIterator::++: encountered " 
00203                                       << "unknown primitive type " 
00204                                       << getType()
00205                                       << ", ignoring!" << std::endl;
00206                             startPrim();
00207                             break;
00208     }           
00209 }

EdgeIterator & EdgeIterator::operator= const EdgeIterator source  ) 
 

Seek the iterator to a specific edge indicated by its index.

This is primarily used in conjunction with osg::EdgeIterator::getIndex to record a position in the iteration and later return to it.

Definition at line 292 of file OSGEdgeIterator.cpp.

References _actPrimIndex, _edgeIndex, and _edgePntIndex.

00293 {
00294     if(this == &source)
00295         return *this;
00296     
00297     *static_cast<Inherited *>(this) = source;
00298 
00299     this->_edgeIndex            = source._edgeIndex;
00300     this->_actPrimIndex         = source._actPrimIndex;
00301     this->_edgePntIndex[0]      = source._edgePntIndex[0];
00302     this->_edgePntIndex[1]      = source._edgePntIndex[1];
00303 
00304     return *this;
00305 }

bool EdgeIterator::operator< const EdgeIterator other  )  const
 

Seek the iterator to a specific edge indicated by its index.

This is primarily used in conjunction with osg::EdgeIterator::getIndex to record a position in the iteration and later return to it.

Definition at line 309 of file OSGEdgeIterator.cpp.

References _actPrimIndex.

00310 {
00311     return 
00312           (*static_cast<const Inherited *>(this) <  other) ||
00313         ( (*static_cast<const Inherited *>(this) == other)             &&
00314           _actPrimIndex                          <  other._actPrimIndex);
00315 }

bool EdgeIterator::operator== const EdgeIterator other  )  const
 

Seek the iterator to a specific edge indicated by its index.

This is primarily used in conjunction with osg::EdgeIterator::getIndex to record a position in the iteration and later return to it.

Definition at line 317 of file OSGEdgeIterator.cpp.

References _actPrimIndex, and osg::PrimitiveIterator::isAtEnd().

00318 {
00319     if(isAtEnd() && other.isAtEnd())
00320         return true;
00321 
00322     if(isAtEnd() || other.isAtEnd())
00323         return false;
00324 
00325     return 
00326         (*static_cast<const Inherited *>(this) == other              ) &&
00327         _actPrimIndex                          == other._actPrimIndex;
00328 }

bool EdgeIterator::operator!= const EdgeIterator other  )  const
 

Seek the iterator to a specific edge indicated by its index.

This is primarily used in conjunction with osg::EdgeIterator::getIndex to record a position in the iteration and later return to it.

Definition at line 330 of file OSGEdgeIterator.cpp.

00331 {
00332     return !(*this == other);
00333 }

void EdgeIterator::setToBegin void   ) 
 

Set the iterator to the beginning of the geometry. Is primarily used by osg::Geometry::beginEdges, but can also be used to quickly recycle an iterator.

Reimplemented from osg::PrimitiveIterator.

Definition at line 273 of file OSGEdgeIterator.cpp.

References _edgeIndex, osg::PrimitiveIterator::setToBegin(), and startPrim().

Referenced by osg::Geometry::beginEdges(), and seek().

00274 {
00275     PrimitiveIterator::setToBegin();
00276     _edgeIndex = 0;
00277     startPrim();
00278 }

void EdgeIterator::setToEnd void   ) 
 

Set the iterator to the end of the geometry. Is primarily used by osg::Geometry::endEdges, but can also be used to quickly recycle an iterator.

Reimplemented from osg::PrimitiveIterator.

Definition at line 284 of file OSGEdgeIterator.cpp.

References _actPrimIndex, and osg::PrimitiveIterator::setToEnd().

Referenced by osg::Geometry::endEdges().

00285 {
00286     PrimitiveIterator::setToEnd();
00287     _actPrimIndex = 0;
00288 }

void EdgeIterator::startPrim void   )  [private]
 

Helper function to reset all state to the beginning of a new primitive. Also skips non-polygonal primitives(lines, points) and primtiives with less than 3 points.

Definition at line 216 of file OSGEdgeIterator.cpp.

References _actPrimIndex, _edgePntIndex, osg::PrimitiveIterator::getLength(), osg::PrimitiveIterator::getType(), osg::PrimitiveIterator::isAtEnd(), and SWARNING.

Referenced by operator++(), and setToBegin().

00217 {
00218     // already at end?
00219     if(isAtEnd())
00220         return;
00221 
00222     _edgePntIndex[0] = 0;
00223     _edgePntIndex[1] = 1;
00224     _actPrimIndex = 2;
00225     
00226     // loop until you find a useful primitive or run out
00227     while(! isAtEnd())
00228     {
00229         switch(getType())
00230         {           
00231         case GL_LINES:                              
00232         case GL_LINE_STRIP: 
00233         case GL_LINE_LOOP:      if(PrimitiveIterator::getLength() >= 2)
00234                                    return;
00235                                 break; 
00236         case GL_POINTS:         // non-line types: (currently) ignored
00237         case GL_TRIANGLES: 
00238         case GL_TRIANGLE_STRIP:
00239         case GL_TRIANGLE_FAN:   
00240         case GL_POLYGON:        
00241         case GL_QUADS:
00242         case GL_QUAD_STRIP:
00243                                 break;
00244         default:            SWARNING << "EdgeIterator::startPrim: encountered " 
00245                                      << "unknown primitive type " 
00246                                      << getType()
00247                                      << ", ignoring!" << std::endl;
00248                             break;
00249         }   
00250         
00251         ++(static_cast<PrimitiveIterator&>(*this));   
00252     }       
00253 }

void PrimitiveIterator::setGeo const GeometryPtr geo  )  [inherited]
 

Switch the iterator to a new geometry. Automatically sets it to the beginning.

Definition at line 299 of file OSGPrimitiveIterator.cpp.

References osg::PrimitiveIterator::_geo, osg::PrimitiveIterator::_indices, osg::PrimitiveIterator::_lengths, osg::PrimitiveIterator::_types, osg::NullFC, OSG_ASSERT, and osg::PrimitiveIterator::setToBegin().

Referenced by EdgeIterator(), osg::FaceIterator::FaceIterator(), osg::LineIterator::LineIterator(), osg::PrimitiveIterator::PrimitiveIterator(), osg::PrimitiveIterator::setGeo(), and osg::TriangleIterator::TriangleIterator().

00300 {
00301     OSG_ASSERT(geo != NullFC);
00302 
00303     _geo     = geo;
00304     _types   = geo->getTypes();
00305     _lengths = geo->getLengths();
00306     _indices = geo->getIndices();
00307     
00308     setToBegin();
00309 }

void PrimitiveIterator::setGeo const NodePtr geo  )  [inherited]
 

Switch the iterator to a new geometry. Automatically sets it to the beginning.

Definition at line 315 of file OSGPrimitiveIterator.cpp.

References osg::AttachmentContainerPtr::dcast(), FWARNING, osg::NodePtr::getCore(), osg::NullFC, and osg::PrimitiveIterator::setGeo().

00316 {
00317     GeometryPtr gc = GeometryPtr::dcast(geo->getCore());
00318     
00319     if(gc == NullFC)
00320     {
00321         FWARNING(("PrimitiveIterator::setGeo: called for NodePtr which "
00322                   "is not a Geometry!\n"));
00323     }
00324     else
00325     {
00326         setGeo(gc);
00327     }
00328 }

bool osg::PrimitiveIterator::isAtEnd void   )  const [inline, inherited]
 

Check if the iterator has already reached the end of the geometry.

Definition at line 55 of file OSGPrimitiveIterator.inl.

References osg::PrimitiveIterator::_ended.

Referenced by osg::TriangleIterator::operator++(), osg::PrimitiveIterator::operator++(), osg::LineIterator::operator++(), osg::FaceIterator::operator++(), operator++(), osg::TriangleIterator::operator==(), osg::LineIterator::operator==(), osg::FaceIterator::operator==(), operator==(), osg::SplitGraphOp::splitNode(), osg::TriangleIterator::startPrim(), osg::LineIterator::startPrim(), osg::FaceIterator::startPrim(), and startPrim().

00056 {
00057     return _ended;
00058 }

UInt32 osg::PrimitiveIterator::getType void   )  const [inline, inherited]
 

Return the type of the current primitive.

Definition at line 81 of file OSGPrimitiveIterator.inl.

References osg::PrimitiveIterator::_actPrimType.

Referenced by osg::calcFaceNormals(), osg::calcFaceNormalsGeo(), osg::createConvexPrimitives(), getColorIndex(), getIndexIndex(), getLength(), getNormalIndex(), getPositionIndex(), getSecondaryColorIndex(), getTexCoordsIndex(), getTexCoordsIndex1(), getTexCoordsIndex2(), getTexCoordsIndex3(), osg::TriangleIterator::operator++(), osg::LineIterator::operator++(), osg::FaceIterator::operator++(), operator++(), osg::SplitGraphOp::splitNode(), osg::TriangleIterator::startPrim(), osg::LineIterator::startPrim(), osg::FaceIterator::startPrim(), startPrim(), osg::VRMLWriteAction::writeGeoEnter(), and osg::VRMLWriteAction::writeLineIndex().

00082 {
00083     return _actPrimType;
00084 }

GeometryPtr osg::PrimitiveIterator::getGeometry void   )  const [inline, inherited]
 

Return the geometry the iterator is currently attached to.

Definition at line 485 of file OSGPrimitiveIterator.inl.

References osg::PrimitiveIterator::_geo.

Referenced by osg::TriangleIterator::getColor(), osg::LineIterator::getColor(), osg::FaceIterator::getColor(), getColor(), osg::TriangleIterator::getNormal(), osg::LineIterator::getNormal(), osg::FaceIterator::getNormal(), getNormal(), osg::TriangleIterator::getPosition(), osg::LineIterator::getPosition(), osg::FaceIterator::getPosition(), getPosition(), osg::TriangleIterator::getSecondaryColor(), osg::LineIterator::getSecondaryColor(), osg::FaceIterator::getSecondaryColor(), getSecondaryColor(), osg::TriangleIterator::getTexCoords(), osg::LineIterator::getTexCoords(), osg::FaceIterator::getTexCoords(), getTexCoords(), osg::TriangleIterator::getTexCoords1(), osg::LineIterator::getTexCoords1(), osg::FaceIterator::getTexCoords1(), getTexCoords1(), osg::TriangleIterator::getTexCoords2(), osg::LineIterator::getTexCoords2(), osg::FaceIterator::getTexCoords2(), getTexCoords2(), osg::TriangleIterator::getTexCoords3(), osg::LineIterator::getTexCoords3(), osg::FaceIterator::getTexCoords3(), and getTexCoords3().

00486 {
00487     return _geo;
00488 }

bool PrimitiveIterator::operator<