mirror of https://github.com/CGAL/cgal
Merge pull request #7795 from lrineau/CGAL_Lab-fix_VTK_io_plugin-GF
CGAL Lab: fix reading of VTK files
This commit is contained in:
commit
e92d42f0dc
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@
|
|||
#include <CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h>
|
||||
#include <CGAL/SMDS_3/tet_soup_to_c3t3.h>
|
||||
#include <CGAL/IO/output_to_vtu.h>
|
||||
#include <CGAL/boost/graph/io.h>
|
||||
#include <CGAL/boost/graph/IO/VTK.h>
|
||||
#include <CGAL/IO/VTK.h>
|
||||
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkDataSetReader.h>
|
||||
|
|
@ -352,10 +353,23 @@ public:
|
|||
|
||||
if(is_polygon_mesh)
|
||||
{
|
||||
FaceGraph* poly = new FaceGraph();
|
||||
auto poly = std::make_unique<FaceGraph>();
|
||||
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<Point_3> points;
|
||||
std::vector<std::vector<std::size_t> > 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()));
|
||||
|
|
|
|||
|
|
@ -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.h>
|
||||
|
||||
CGAL::Three::Scene_item_with_properties::~Scene_item_with_properties() {}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
#include <CGAL/Three/TextRenderer.h>
|
||||
#include <CGAL/Three/Scene_item.h>
|
||||
#include <CGAL/Three/Scene_print_item_interface.h>
|
||||
#include "Scene_polyhedron_selection_item.h"
|
||||
void TextRenderer::draw(CGAL::Three::Viewer_interface *viewer, const QVector3D& scaler)
|
||||
{
|
||||
QPainter *painter = viewer->getPainter();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#define SCENE_ITEM_WITH_PROPERTIES_H
|
||||
|
||||
#include <CGAL/license/Three.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue