From 9154ecd47bdf8ec729d292c104756908b42e02d1 Mon Sep 17 00:00:00 2001 From: Mike Kremer Date: Tue, 20 Jul 2010 13:43:40 +0000 Subject: [PATCH] Setting associated handles of iterator types invalid if reference mesh contains none of the respective entities. git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@333 fdac6126-5c0c-442c-9429-916003d36597 --- src/OpenMesh/Core/Mesh/IteratorsT.hh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/OpenMesh/Core/Mesh/IteratorsT.hh b/src/OpenMesh/Core/Mesh/IteratorsT.hh index b6d4dedf..7dc73c68 100644 --- a/src/OpenMesh/Core/Mesh/IteratorsT.hh +++ b/src/OpenMesh/Core/Mesh/IteratorsT.hh @@ -124,6 +124,9 @@ public: : mesh_(&_mesh), hnd_(_hnd), skip_bits_(0) { if (_skip) enable_skipping(); + + // Set vertex handle invalid if the mesh contains no vertex + if(_mesh.n_vertices() == 0) hnd_ = value_handle(-1); } @@ -290,6 +293,9 @@ public: : mesh_(&_mesh), hnd_(_hnd), skip_bits_(0) { if (_skip) enable_skipping(); + + // Set vertex handle invalid if the mesh contains no vertex + if(_mesh.n_vertices() == 0) hnd_ = value_handle(-1); } @@ -456,6 +462,9 @@ public: : mesh_(&_mesh), hnd_(_hnd), skip_bits_(0) { if (_skip) enable_skipping(); + + // Set halfedge handle invalid if the mesh contains no edge + if(_mesh.n_edges() == 0) hnd_ = value_handle(-1); } @@ -622,6 +631,9 @@ public: : mesh_(&_mesh), hnd_(_hnd), skip_bits_(0) { if (_skip) enable_skipping(); + + // Set halfedge handle invalid if the mesh contains no edge + if(_mesh.n_edges() == 0) hnd_ = value_handle(-1); } @@ -788,6 +800,9 @@ public: : mesh_(&_mesh), hnd_(_hnd), skip_bits_(0) { if (_skip) enable_skipping(); + + // Set halfedge handle invalid if the mesh contains no edge + if(_mesh.n_edges() == 0) hnd_ = value_handle(-1); } @@ -954,6 +969,9 @@ public: : mesh_(&_mesh), hnd_(_hnd), skip_bits_(0) { if (_skip) enable_skipping(); + + // Set halfedge handle invalid if the mesh contains no edge + if(_mesh.n_edges() == 0) hnd_ = value_handle(-1); } @@ -1120,6 +1138,9 @@ public: : mesh_(&_mesh), hnd_(_hnd), skip_bits_(0) { if (_skip) enable_skipping(); + + // Set face handle invalid if the mesh contains no faces + if(_mesh.n_faces() == 0) hnd_ = value_handle(-1); } @@ -1286,6 +1307,9 @@ public: : mesh_(&_mesh), hnd_(_hnd), skip_bits_(0) { if (_skip) enable_skipping(); + + // Set face handle invalid if the mesh contains no faces + if(_mesh.n_faces() == 0) hnd_ = value_handle(-1); }