diff --git a/Lab/demo/Lab/Plugins/IO/CMakeLists.txt b/Lab/demo/Lab/Plugins/IO/CMakeLists.txt index 8729366809f..2b1b56be430 100644 --- a/Lab/demo/Lab/Plugins/IO/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/IO/CMakeLists.txt @@ -47,7 +47,7 @@ find_package(OpenMesh) if(OpenMesh_FOUND) include(UseOpenMesh) cgal_lab_plugin(om_plugin OM_io_plugin KEYWORDS Viewer PMP) - target_link_libraries(om_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item) + target_link_libraries(om_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item scene_selection_item) target_link_libraries(om_plugin PRIVATE ${OPENMESH_LIBRARIES}) else() message(STATUS "NOTICE: the OM IO plugin needs OpenMesh libraries and will not be compiled.") diff --git a/Lab/demo/Lab/Plugins/IO/OM_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/OM_io_plugin.cpp index 6ca5110a96b..20cda20b526 100644 --- a/Lab/demo/Lab/Plugins/IO/OM_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/OM_io_plugin.cpp @@ -6,10 +6,10 @@ #include #include +#include "Scene_polyhedron_selection_item.h" #include #include -#include #include #include @@ -90,7 +90,8 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){ // Try building a surface_mesh SMesh* SM = new SMesh(); if (CGAL::IO::read_OM((const char*)fileinfo.filePath().toUtf8(), *SM, sm_selected_pmap, sm_feature_pmap)) - {/* + { + /* std::cout << "vertex selection values:\n"; for(auto v : vertices(*SM)){ std::cout << std::boolalpha << get(sm_selected_pmap, v) << std::endl; @@ -108,11 +109,22 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){ } else{ Scene_surface_mesh_item* item = new Scene_surface_mesh_item(SM); + + Scene_polyhedron_selection_item* selection_item = new Scene_polyhedron_selection_item(item, CGAL::Three::Three::mainWindow()); + bool selected = false; + for(auto e : edges(*SM)){ + if(get(sm_feature_pmap, e)){ + selection_item->selected_edges.insert(e); + selected = true; + } + } item->setName(fileinfo.completeBaseName()); ok = true; - if(add_to_scene) + if(add_to_scene){ CGAL::Three::Three::scene()->addItem(item); - return QList()<addItem(selection_item); + } + return QList()< #include @@ -59,4 +70,4 @@ bool read_OM(std::string fname, SM& sm, VSelectionPM vspm, EFeaturePM efpm) } // namespace IO } // namespace CGAL - +#endif // CGAL_IO_OM \ No newline at end of file