diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp index 457e2bd8e28..d463915e332 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp @@ -614,7 +614,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio if(method == PARAM_OTE && (sel_item == NULL || sel_item->selected_vertices.empty())) { - std::cerr << "No selection or no cones selected; Aborting." << std::endl; + std::cerr << "\nError: no cones/seam selected; Aborting parameterization." << std::endl; return; } @@ -918,48 +918,55 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio // @todo (need to remove the assertions such as cones.size() == 4 // and check where and when cones are used (passed by ID, for ex.?)) if(number_of_components != 1) { - std::cerr << "Orbifold Tutte Embedding can only handle one connected component at the moment" << std::endl; - return; + std::cerr << "Orbifold Tutte Embedding can only handle one connected component" << std::endl; + status = SMP::ERROR_NO_TOPOLOGICAL_BALL; + break; } typedef SMP::Orbifold_Tutte_parameterizer_3 Parameterizer; + // Get orbifold type QDialog dialog(mw); Ui::OTE_dialog ui; ui.setupUi(&dialog); connect(ui.buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept())); connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); - // Get values QApplication::restoreOverrideCursor(); int i = dialog.exec(); if (i == QDialog::Rejected) + { + std::cout << "Aborting parameterization" << std::endl; return; + } SMP::Orbifold_type orb = static_cast(ui.OrbComboBox->currentIndex()); - std::cout << "selected orbifold type: " << ui.OrbComboBox->currentText().toStdString() << std::endl; + std::cout << "Selected orbifold type: " << ui.OrbComboBox->currentText().toStdString() << std::endl; if((unordered_cones.size() != 3 && unordered_cones.size() != 4) || (unordered_cones.size() == 3 && orb == SMP::Parallelogram ) || (unordered_cones.size() == 4 && orb != SMP::Parallelogram)) { - std::cerr << "Incompatible orbifold type and number of cones" << std::endl; + std::cerr << "Error: incompatible orbifold type and number of cones" << std::endl; std::cerr << "Types I, II & III require 3 selected vertices" << std::endl; std::cerr << "Type IV requires 4 selected vertices" << std::endl; return; } - QApplication::setOverrideCursor(Qt::WaitCursor); - // Now, parameterize Parameterizer parameterizer(orb); - // mark cones in the seam mesh + // Mark cones in the seam mesh boost::unordered_map cmap; if(!SMP::locate_unordered_cones(sMesh, unordered_cones.begin(), unordered_cones.end(), cmap)) + { + std::cerr << "Error: invalid cone or seam selection" << std::endl; return; + } - // vimap and uvmap + QApplication::setOverrideCursor(Qt::WaitCursor); + + // Fill the index property map typedef boost::unordered_map Indices; Indices indices; CGAL::Polygon_mesh_processing::connected_component( @@ -970,7 +977,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio boost::associative_property_map vimap(indices); // Call to parameterizer - status = parameterizer.parameterize(sMesh, bhd, cmap, uv_pm, vimap); + status = parameterizer.parameterize(sMesh, bhd, cmap, uv_pm, vimap); break; } case PARAM_BTP: @@ -987,7 +994,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio if(status == SMP::OK) { std::cout << "success (in " << time.elapsed() << " ms)" << std::endl; } else { - std::cout << "failure: " << SMP::get_error_message(status) << std::endl; + std::cerr << "failure: " << SMP::get_error_message(status) << std::endl; return; } diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Error_code.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Error_code.h index e91ab8d13d1..92c68372a0a 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Error_code.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Error_code.h @@ -38,6 +38,7 @@ enum Error_code ERROR_EMPTY_MESH, ///< Input mesh is empty ERROR_NON_TRIANGULAR_MESH, ///< Input mesh is not triangular ERROR_NO_TOPOLOGICAL_DISC, ///< Input mesh is not a topological disc + ERROR_NO_TOPOLOGICAL_BALL, ///< Input mesh is not a topological ball ERROR_BORDER_TOO_SHORT, ///< This border parameterization requires a longer border ERROR_NON_CONVEX_BORDER, ///< This parameterization method requires a convex border ERROR_CANNOT_SOLVE_LINEAR_SYSTEM,///< Cannot solve linear system diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/orbifold_cone_helper.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/orbifold_cone_helper.h index 76de6c65e77..379ca9fb88c 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/orbifold_cone_helper.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/orbifold_cone_helper.h @@ -175,7 +175,7 @@ bool check_cone_validity(const SeamMesh& mesh, // check cone numbers if((number_of_cones_in_tm == 3 && cones.size() != 4) || (number_of_cones_in_tm == 4 && cones.size() != 6)) { - std::cerr << "Error: Problem in number of cones: " << std::endl; + std::cerr << "Invalid cone placement: " << std::endl; std::cerr << number_of_cones_in_tm << " cones in the base mesh" << std::endl; std::cerr << cones.size() << " cones in the seam mesh" << std::endl; return false;