From 98a5f2f490129dfb11a5de5d43a4e1088b2871b8 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 12 Oct 2023 16:41:25 +0200 Subject: [PATCH 1/4] fix reading of vtp files --- Stream_support/include/CGAL/IO/polygon_soup_io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Stream_support/include/CGAL/IO/polygon_soup_io.h b/Stream_support/include/CGAL/IO/polygon_soup_io.h index 098d088680b..74229da797e 100644 --- a/Stream_support/include/CGAL/IO/polygon_soup_io.h +++ b/Stream_support/include/CGAL/IO/polygon_soup_io.h @@ -100,7 +100,7 @@ bool read_polygon_soup(const std::string& fname, else if(ext == "ts") return read_GOCAD(fname, points, polygons, np); #ifdef CGAL_USE_VTK - else if(ext == "ts") + else if(ext == "vtp") return read_VTP(fname, points, polygons, np); #endif From 4c2bbb812dd3b9436c4e5484a6af8912f829daba Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 12 Oct 2023 16:41:41 +0200 Subject: [PATCH 2/4] remove a fake dependency --- Polyhedron/demo/Polyhedron/TextRenderer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/TextRenderer.cpp b/Polyhedron/demo/Polyhedron/TextRenderer.cpp index 95dc1846371..a2a97ae45fb 100644 --- a/Polyhedron/demo/Polyhedron/TextRenderer.cpp +++ b/Polyhedron/demo/Polyhedron/TextRenderer.cpp @@ -1,7 +1,6 @@ #include #include #include -#include "Scene_polyhedron_selection_item.h" void TextRenderer::draw(CGAL::Three::Viewer_interface *viewer, const QVector3D& scaler) { QPainter *painter = viewer->getPainter(); From ff095fe31e02469aadf473eebf147861b36d8615 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 12 Oct 2023 16:50:08 +0200 Subject: [PATCH 3/4] fix loading of a polygon mesh from VTK - fix a memory leak - allow to read a polygon soup, in addition to surface meshes --- .../Polyhedron/Plugins/IO/VTK_io_plugin.cpp | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp index e35576fc98f..bf3f4bf54e9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp @@ -39,7 +39,8 @@ #include #include #include -#include +#include +#include #include #include @@ -352,10 +353,23 @@ public: if(is_polygon_mesh) { - FaceGraph* poly = new FaceGraph(); + auto poly = std::make_unique(); + Scene_item* poly_item = nullptr; if (CGAL::IO::internal::vtkPointSet_to_polygon_mesh(data, *poly, CGAL::parameters::default_values())) { - Scene_facegraph_item* poly_item = new Scene_facegraph_item(poly); + poly_item = new Scene_facegraph_item(poly.release()); + } else { + poly.reset(nullptr); + std::vector points; + std::vector > polygons; + if (CGAL::IO::internal::vtkPointSet_to_polygon_soup(data, points, polygons, CGAL::parameters::default_values())) + { + auto soup_item = new Scene_polygon_soup_item(); + soup_item->load(points, polygons); + poly_item = soup_item; + } + } + if(poly_item) { if(group) { poly_item->setName(QString("%1_faces").arg(fileinfo.baseName())); From 7dc4b624aaae6c0270deb67a5efbf993a65a97c5 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 30 Oct 2023 15:04:24 +0100 Subject: [PATCH 4/4] fix a link error about ~Scene_item_with_properties ``` Creating library C:/CGAL_ROOT/CGAL-6.0-Ic-93/cmake/platforms/MSVC-2022-Community-Release/test/Polyhedron_Demo/Release/scene_points_with_normal_item.lib and object C:/CGAL_ROOT/CGAL-6.0-Ic-93/cmake/platforms/MSVC-2022-Community-Release/test/Polyhedron_Demo/Release/scene_points_with_normal_item.exp 158>Scene_points_with_normal_item.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl CGAL::Three::Scene_item_with_properties::~Scene_item_with_properties(void)" (__imp_??1Scene_item_with_properties@Three@CGAL@@UEAA@XZ) referenced in function "int `public: __cdecl Scene_points_with_normal_item::Scene_points_with_normal_item(class dtor$1 const &)'::`1'::dtor$1" (?dtor$1@?0???0Scene_points_with_normal_item@@QEAA@AEBV0@@Z@4HA) [C:\CGAL_ROOT\CGAL-6.0-Ic-93\cmake\platforms\MSVC-2022-Community-Release\test\Polyhedron_Demo\scene_points_with_normal_item.vcxproj] 158>Scene_points_with_normal_item.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl CGAL::Three::Scene_item_with_properties::Scene_item_with_properties(void)" (__imp_??0Scene_item_with_properties@Three@CGAL@@QEAA@XZ) referenced in function "public: __cdecl Scene_points_with_normal_item::Scene_points_with_normal_item(class Scene_points_with_normal_item const &)" (??0Scene_points_with_normal_item@@QEAA@AEBV0@@Z) [C:\CGAL_ROOT\CGAL-6.0-Ic-93\cmake\platforms\MSVC-2022-Community-Release\test\Polyhedron_Demo\scene_points_with_normal_item.vcxproj] 158>C:\CGAL_ROOT\CGAL-6.0-Ic-93\cmake\platforms\MSVC-2022-Community-Release\test\Polyhedron_Demo\Release\scene_points_with_normal_item.dll : fatal error LNK1120: 2 unresolved externals [C:\CGAL_ROOT\CGAL-6.0-Ic-93\cmake\platforms\MSVC-2022-Community-Release\test\Polyhedron_Demo\scene_points_with_normal_item.vcxproj] ``` https://cgal.geometryfactory.com/CGAL/testsuite/CGAL-6.0-Ic-93/Polyhedron_Demo/TestReport_Christo_MSVC-2022-Community-Release.gz --- Polyhedron/demo/Polyhedron/CMakeLists.txt | 1 + .../demo/Polyhedron/Scene_item_with_properties.cpp | 14 ++++++++++++++ .../CGAL/Three/Scene_item_with_properties.h | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 Polyhedron/demo/Polyhedron/Scene_item_with_properties.cpp diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 325a670e809..0e1d3034dd1 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -179,6 +179,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) Viewer_interface_moc.cpp Scene_item_moc.cpp Scene_item.cpp + Scene_item_with_properties.cpp Triangle_container.cpp Edge_container.cpp Point_container.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_item_with_properties.cpp b/Polyhedron/demo/Polyhedron/Scene_item_with_properties.cpp new file mode 100644 index 00000000000..81c8b264758 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Scene_item_with_properties.cpp @@ -0,0 +1,14 @@ +// Copyright (c) 2023 GeometryFactory Sarl (France) +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Laurent Rineau + +#include + +CGAL::Three::Scene_item_with_properties::~Scene_item_with_properties() {} diff --git a/Three/include/CGAL/Three/Scene_item_with_properties.h b/Three/include/CGAL/Three/Scene_item_with_properties.h index e900fad06a5..35ca2d42755 100644 --- a/Three/include/CGAL/Three/Scene_item_with_properties.h +++ b/Three/include/CGAL/Three/Scene_item_with_properties.h @@ -13,7 +13,7 @@ #define SCENE_ITEM_WITH_PROPERTIES_H #include - +#include #ifdef demo_framework_EXPORTS # define DEMO_FRAMEWORK_EXPORT Q_DECL_EXPORT #else @@ -30,7 +30,7 @@ namespace Three { //! the position of its manipulated frame, ... class DEMO_FRAMEWORK_EXPORT Scene_item_with_properties { public: - virtual ~Scene_item_with_properties(){} + virtual ~Scene_item_with_properties(); //!\brief Copies properties from another Scene_item. //! //! Override this function to specify what must be copied.