diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt index f81b552b293..729bdeefd51 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt @@ -16,10 +16,6 @@ qt5_wrap_ui( mesh_simplificationUI_FILES Mesh_simplification_dialog.ui) polyhedron_demo_plugin(mesh_simplification_plugin Mesh_simplification_plugin ${mesh_simplificationUI_FILES}) target_link_libraries(mesh_simplification_plugin scene_polyhedron_item scene_polyhedron_selection_item) -polyhedron_demo_plugin(mesh_simplification_sm_plugin Mesh_simplification_plugin ${mesh_simplificationUI_FILES}) -target_link_libraries(mesh_simplification_sm_plugin scene_surface_mesh_item scene_surface_mesh_selection_item) -target_compile_definitions(mesh_simplification_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) - qt5_wrap_ui( remeshingUI_FILES Remeshing_dialog.ui) polyhedron_demo_plugin(remeshing_plugin Remeshing_plugin Remeshing_plugin_cgal_code.cpp Mesher_base.cpp ${remeshingUI_FILES}) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp index ce34590f0ad..a1bac43805c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp @@ -1,13 +1,8 @@ #include -#ifdef USE_SURFACE_MESH -#include "Scene_surface_mesh_item.h" -#else #include "Scene_polyhedron_item.h" -#include "Polyhedron_type.h" -#endif - #include "Scene_polyhedron_selection_item.h" +#include "Polyhedron_type.h" #include #include @@ -15,6 +10,7 @@ #include #include +#include #include #include #include @@ -23,18 +19,10 @@ #include "ui_Mesh_simplification_dialog.h" -#ifdef USE_SURFACE_MESH -typedef Scene_surface_mesh_item Scene_face_graph_item; -#else -typedef Scene_polyhedron_item Scene_face_graph_item; -#endif - -typedef Scene_face_graph_item::FaceGraph Face_graph; - class Custom_stop_predicate { bool m_and; - CGAL::Surface_mesh_simplification::Count_stop_predicate m_count_stop; + CGAL::Surface_mesh_simplification::Count_stop_predicate m_count_stop; CGAL::Surface_mesh_simplification::Edge_length_stop_predicate m_length_stop; public: @@ -92,7 +80,7 @@ public: } bool applicable(QAction*) const { - return qobject_cast(scene->item(scene->mainSelectionIndex())) + return qobject_cast(scene->item(scene->mainSelectionIndex())) || qobject_cast(scene->item(scene->mainSelectionIndex())); } public Q_SLOTS: @@ -108,15 +96,15 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); - Scene_face_graph_item* poly_item = - qobject_cast(scene->item(index)); + Scene_polyhedron_item* poly_item = + qobject_cast(scene->item(index)); Scene_polyhedron_selection_item* selection_item = qobject_cast(scene->item(index)); if (poly_item || selection_item) { - Face_graph& pmesh = (poly_item != NULL) + Polyhedron& pmesh = (poly_item != NULL) ? *poly_item->polyhedron() : *selection_item->polyhedron(); @@ -137,8 +125,8 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered() + (bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) + (bbox.zmax()-bbox.zmin())*(bbox.zmax()-bbox.zmin())); - ui.m_nb_edges->setValue ((int)(num_halfedges(pmesh) / 4)); - ui.m_nb_edges->setMaximum ((int)(num_halfedges(pmesh))); + ui.m_nb_edges->setValue ((int)(pmesh.size_of_halfedges () / 4)); + ui.m_nb_edges->setMaximum ((int)(pmesh.size_of_halfedges ())); ui.m_edge_length->setValue (diago_length * 0.05); // check user cancellation @@ -165,7 +153,7 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered() { CGAL::Surface_mesh_simplification::Constrained_placement , + , Scene_polyhedron_selection_item::Is_constrained_map > placement (selection_item->constrained_edges_pmap()); @@ -183,7 +171,7 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered() } std::cout << "ok (" << time.elapsed() << " ms, " - << num_edges(pmesh) << " edges)" << std::endl; + << pmesh.size_of_halfedges() / 2 << " edges)" << std::endl; // update scene if (poly_item != NULL)