diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 85c60468859..941a7470de1 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/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())); 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/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(); 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 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.