Fixed another bug in the new consolidated iterator. Unit tests seem to be passing, now.

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@550 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Hans-Christian Ebke
2012-03-01 17:27:38 +00:00
parent 62ef24047a
commit d44c4bedf7
2 changed files with 8 additions and 8 deletions

View File

@@ -77,7 +77,7 @@ template <class Mesh> class ConstFaceIterT;
template <class Mesh> class FaceIterT; template <class Mesh> class FaceIterT;
template <class Mesh, class ValueHandle, class PrimitiveStatusFnOwner, bool (PrimitiveStatusFnOwner::*PrimitiveStatusFn)() const> template <class Mesh, class ValueHandle, class MemberOwner, bool (MemberOwner::*PrimitiveStatusMember)() const, uint (MemberOwner::*PrimitiveCountMember)() const>
class GenericIteratorT { class GenericIteratorT {
public: public:
//--- Typedefs --- //--- Typedefs ---
@@ -103,7 +103,7 @@ class GenericIteratorT {
if (_skip) enable_skipping(); if (_skip) enable_skipping();
// Set vertex handle invalid if the mesh contains no vertex // Set vertex handle invalid if the mesh contains no vertex
if(_mesh.n_vertices() == 0) hnd_ = value_handle(-1); if((mesh_->*PrimitiveCountMember)() == 0) hnd_ = value_handle(-1);
} }
/// Standard dereferencing operator. /// Standard dereferencing operator.
@@ -154,7 +154,7 @@ class GenericIteratorT {
/// Turn on skipping: automatically skip deleted/hidden elements /// Turn on skipping: automatically skip deleted/hidden elements
void enable_skipping() { void enable_skipping() {
if (mesh_ && (mesh_->*PrimitiveStatusFn)()) { if (mesh_ && (mesh_->*PrimitiveStatusMember)()) {
Attributes::StatusInfo status; Attributes::StatusInfo status;
status.set_deleted(true); status.set_deleted(true);
status.set_hidden(true); status.set_hidden(true);
@@ -173,7 +173,7 @@ class GenericIteratorT {
void skip_fwd() { void skip_fwd() {
assert(mesh_ && skip_bits_); assert(mesh_ && skip_bits_);
while ((hnd_.idx() < (signed) mesh_->n_vertices()) while ((hnd_.idx() < (signed) (mesh_->*PrimitiveCountMember)())
&& (mesh_->status(hnd_).bits() & skip_bits_)) && (mesh_->status(hnd_).bits() & skip_bits_))
hnd_.__increment(); hnd_.__increment();
} }

View File

@@ -76,10 +76,10 @@ public:
*/ */
//@{ //@{
/// Linear iterator /// Linear iterator
typedef Iterators::GenericIteratorT<This, This::VertexHandle, ArrayKernel, &This::has_vertex_status> VertexIter; typedef Iterators::GenericIteratorT<This, This::VertexHandle, ArrayKernel, &This::has_vertex_status, &This::n_vertices> VertexIter;
typedef Iterators::GenericIteratorT<This, This::HalfedgeHandle, ArrayKernel, &This::has_halfedge_status> HalfedgeIter; typedef Iterators::GenericIteratorT<This, This::HalfedgeHandle, ArrayKernel, &This::has_halfedge_status, &This::n_halfedges> HalfedgeIter;
typedef Iterators::GenericIteratorT<This, This::EdgeHandle, ArrayKernel, &This::has_edge_status> EdgeIter; typedef Iterators::GenericIteratorT<This, This::EdgeHandle, ArrayKernel, &This::has_edge_status, &This::n_edges> EdgeIter;
typedef Iterators::GenericIteratorT<This, This::FaceHandle, ArrayKernel, &This::has_face_status> FaceIter; typedef Iterators::GenericIteratorT<This, This::FaceHandle, ArrayKernel, &This::has_face_status, &This::n_faces> FaceIter;
typedef VertexIter ConstVertexIter; typedef VertexIter ConstVertexIter;
typedef HalfedgeIter ConstHalfedgeIter; typedef HalfedgeIter ConstHalfedgeIter;