add observer pattern to all decimaters

closes #2366

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1197 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Matthias Möller
2015-01-15 10:19:39 +00:00
parent 094a7f540f
commit b9fd3edef9
8 changed files with 266 additions and 27 deletions

View File

@@ -92,6 +92,11 @@ size_t MixedDecimaterT<Mesh>::decimate(const size_t _n_collapses, const float _m
size_t r_collapses = 0;
if (_mc_factor > 0.0)
r_collapses = McDecimaterT<Mesh>::decimate(n_collapses_mc);
// returns, if the previous steps were aborted by the observer
if (this->observer() && this->observer()->abort())
return r_collapses;
if (_mc_factor < 1.0)
r_collapses += DecimaterT<Mesh>::decimate(n_collapses_inc);
@@ -147,6 +152,10 @@ size_t MixedDecimaterT<Mesh>::decimate_to_faces(const size_t _n_vertices,const
//Update the mesh::n_vertices function, otherwise the next Decimater function will delete too much
this->mesh().garbage_collection();
// returns, if the previous steps were aborted by the observer
if (this->observer() && this->observer()->abort())
return r_collapses;
//reduce the rest of the mesh
if (_mc_factor < 1.0) {
r_collapses += DecimaterT<Mesh>::decimate_to_faces(_n_vertices,_n_faces);