From d207889c95f83b06759463f3e7bfd96d2b3d5d0d Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 9 May 2019 09:34:32 +0200 Subject: [PATCH 1/6] is >> p is wrong if p is a homogeneous point. Instead read three doubles. Note that we do not support 4OFF yet which means a fourth homogenization variable --- Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index 00f85d8c119..a7ef6c681f4 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -2210,7 +2210,7 @@ private: //------------------------------------------------------- private data } sm.reserve(sm.num_vertices()+n, sm.num_faces()+2*f, sm.num_edges()+e); std::vector vertexmap(n); - P p; + Vector_3 v; typename Mesh::template Property_map vcolor; typename Mesh::template Property_map vnormal; @@ -2225,10 +2225,11 @@ private: //------------------------------------------------------- private data for(int i=0; i < n; i++){ is >> sm_skip_comments; - is >> p; + double x, y, z; + is >> iformat(x) >> iformat(y) >> iformat(z); Vertex_index vi = sm.add_vertex(); - put(vpm, vi, p); + put(vpm, vi, P(x, y, z)); vertexmap[i] = vi; From e2498591da00202f6e4ca58b655f66143debad36 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 9 May 2019 15:06:29 +0200 Subject: [PATCH 2/6] We write x y z even if it is a homgenous point --- Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index a7ef6c681f4..1e49d913e9b 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -2110,8 +2110,9 @@ private: //------------------------------------------------------- private data reindex.resize(sm.num_vertices()); int n = 0; BOOST_FOREACH(Vertex_index v, sm.vertices()){ - - os << get(vpm, v); + + P p = get(vpm, v); + os << p.x() << " " << p.y() << " " << p.z(); if(has_vcolors) { CGAL::Color color = vcolors[v]; From cd22917e3df31bd4cb8da1287320482016f6d133 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 29 May 2019 11:18:13 +0200 Subject: [PATCH 3/6] Remove the need for Boost libraries at the top level CMakeLists.txt The 3D demo does not directly requires Boost libraries. Then are pulled as a `PUBLIC` dependency of `CGAL::CGAL`. Only two plugins really need Boost libraries: - Classification needs Boost iostreams and serialization, - Mesh_3 `io_image_plugin` needs Boost filesystem for multi-files 3D images. --- Polyhedron/demo/Polyhedron/CMakeLists.txt | 5 +---- .../demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt | 10 ++++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 9cb7bebab08..fdd2436a975 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -125,9 +125,6 @@ endif() if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND ) - set(Boost_USE_MULTITHREADED ON) - find_package(Boost COMPONENTS thread system filesystem) - qt5_wrap_ui( MainWindowUI_files MainWindow.ui) qt5_wrap_ui( statisticsUI_FILES Statistics_on_item_dialog.ui) qt5_wrap_ui( FileLoaderDialogUI_files FileLoaderDialog.ui ) @@ -226,7 +223,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND ) macro(add_item item_name) add_library(${item_name} SHARED ${ARGN}) target_link_libraries(${item_name} - PUBLIC demo_framework ${CGAL_LIBRARIES} ${Boost_LIBRARIES} + PUBLIC demo_framework ${CGAL_LIBRARIES} Qt5::OpenGL Qt5::Gui Qt5::Script Qt5::Widgets) cgal_add_compilation_test(${item_name}) endmacro(add_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt index 4c9711c5cfe..1e8a542bbee 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt @@ -29,11 +29,17 @@ if (VTK_FOUND) else() message(STATUS "NOTICE : the DICOM files (.dcm) need VTK libraries to be open and will not be able to.") endif() + +find_package(Boost REQUIRED OPTIONAL_COMPONENTS filesystem) if(Boost_FILESYSTEM_FOUND) qt5_wrap_ui( imgUI_FILES Image_res_dialog.ui raw_image.ui) polyhedron_demo_plugin(io_image_plugin Io_image_plugin Volume_plane_intersection.cpp Raw_image_dialog.cpp ${imgUI_FILES} ${VOLUME_MOC_OUTFILES}) - target_link_libraries(io_image_plugin PUBLIC scene_image_item ${VTK_LIBS} ) - target_link_libraries(io_image_plugin PUBLIC CGAL::CGAL_ImageIO) + target_link_libraries(io_image_plugin PUBLIC scene_image_item ${VTK_LIBS} CGAL::CGAL_ImageIO) + if(TARGET Boost::filesystem) + target_link_libraries(io_image_plugin PUBLIC Boost::filesystem) + else() + target_link_libraries(io_image_plugin PUBLIC ${Boost_LIBRARIES}) + endif() else() message( STATUS "NOTICE : the Io_image_plugin needs boost-filesystem to work and will not be compiled") endif() From cdb72b9f3466c91f55076d84093b92bae9e793d1 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 29 May 2019 11:42:35 +0200 Subject: [PATCH 4/6] Avoid a segfault in `load_plugin` Before that patch `accepted_keywords` was a dangling reference to an object that was destroyed at the end of the constructor of the class `Polyhedron_demo`. Now, that `QStringList` is copied, but it is a short list of short strings. --- Polyhedron/demo/Polyhedron/MainWindow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index 0689df3183e..73f605ecfdf 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -454,7 +454,7 @@ private: bool bbox_need_update; QMap >plugin_metadata_map; QMap ignored_map; - const QStringList& accepted_keywords; + QStringList accepted_keywords; private: QMap action_menu_map; From ecaa13876199dbc13e4000e8e5e47e2a043f11d8 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 29 May 2019 11:44:08 +0200 Subject: [PATCH 5/6] Do not block load_plugin from loading plugins Since the adoption of the "keywords" feature, the 'Load plugin' menu was not able to load a plugin with other keywords. That defeats the purpose of that feature. --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 358d6a1ac93..36244401da4 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -362,6 +362,7 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren connect(&operationSearchBar, &QLineEdit::textChanged, this, &MainWindow::filterOperations); loadPlugins(); + accepted_keywords.clear(); // Setup the submenu of the View menu that can toggle the dockwidgets Q_FOREACH(QDockWidget* widget, findChildren()) { From 44cfe8d2ebe7c9c5d036418d046bdd31be335e3a Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 3 Jun 2019 10:44:01 +0200 Subject: [PATCH 6/6] Do not use `REQUIRED OPTIONAL_COMPONENTS` with FindBoost The CMake module `FindBoost.cmake` only supports `OPTIONAL_COMPONENTS` since CMake-3.11. Previously they were treated like required components. --- Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt index 1e8a542bbee..28268312bab 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt @@ -30,7 +30,7 @@ else() message(STATUS "NOTICE : the DICOM files (.dcm) need VTK libraries to be open and will not be able to.") endif() -find_package(Boost REQUIRED OPTIONAL_COMPONENTS filesystem) +find_package(Boost QUIET OPTIONAL_COMPONENTS filesystem) if(Boost_FILESYSTEM_FOUND) qt5_wrap_ui( imgUI_FILES Image_res_dialog.ui raw_image.ui) polyhedron_demo_plugin(io_image_plugin Io_image_plugin Volume_plane_intersection.cpp Raw_image_dialog.cpp ${imgUI_FILES} ${VOLUME_MOC_OUTFILES})