From 57b5883d5930fb082500579a0dee619bb0046f1f Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 15 Jan 2016 10:33:28 +0100 Subject: [PATCH] avoid duplicate loop --- .../PMP/Isotropic_remeshing_plugin.cpp | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp index 30e7af40669..e2b3f30db13 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp @@ -247,6 +247,7 @@ public Q_SLOTS: unsigned int nb_iter = 1; bool protect = false; + std::vector selection; BOOST_FOREACH(int index, scene->selectionIndices()) { Scene_polyhedron_item* poly_item = @@ -258,8 +259,12 @@ public Q_SLOTS: << " is not a Polyhedron, remeshing skipped\n"; continue; } - else if (target_length == 0.) + else { + selection.push_back(poly_item); + + if (target_length == 0.)//parameters have not been set yet + { QDialog dialog(mw); Ui::Isotropic_remeshing_dialog ui = remeshing_dialog(&dialog, poly_item); ui.objectName->setText(QString::number(scene->selectionIndices().size()) @@ -275,12 +280,12 @@ public Q_SLOTS: target_length = ui.edgeLength_dspinbox->value(); nb_iter = ui.nbIterations_spinbox->value(); protect = ui.protect_checkbox->isChecked(); - - break; + } } } - if(target_length == 0.) - { + + if(target_length == 0.)//parameters have not been set + { // i.e. no item is a polyhedron std::cout << "Remeshing aborted" << std::endl; return; } @@ -289,18 +294,6 @@ public Q_SLOTS: QApplication::setOverrideCursor(Qt::WaitCursor); int total_time = 0; - std::vector selection; - Q_FOREACH(int sel_i, scene->selectionIndices()) - { - Scene_polyhedron_item* poly_item = - qobject_cast(scene->item(sel_i)); - if (poly_item == NULL) - std::cout << "Item " << scene->item(sel_i)->name().data() - << " is not a Polyhedron, remeshing skipped\n"; - else - selection.push_back(poly_item); - } - #ifdef CGAL_LINKED_WITH_TBB QTime time; time.start();