From 86ca13a388767e036f63b88e0cb6f85aae8d974f Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 17 Jun 2019 14:11:32 +0200 Subject: [PATCH] change behavior when soup is not orientable in the demo. --- .../Polyhedron/Plugins/IO/3mf_io_plugin.cpp | 61 +++++++++---------- Stream_support/include/CGAL/IO/write_3mf.h | 8 +-- 2 files changed, 33 insertions(+), 36 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/3mf_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/3mf_io_plugin.cpp index b72e3cb1971..4b3c921dce5 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/3mf_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/3mf_io_plugin.cpp @@ -133,7 +133,7 @@ class Io_3mf_plugin: names.clear(); all_colors.clear(); int nb_meshes = - CGAL::read_soups_from_3mf(fileinfo.filePath().toUtf8().toStdString(), + CGAL::read_triangle_soups_from_3mf(fileinfo.filePath().toUtf8().toStdString(), all_points, all_polygons, all_colors, names); if(nb_meshes <0 ) { @@ -151,42 +151,39 @@ class Io_3mf_plugin: ok = PMP::orient_polygon_soup(points, triangles); if(!ok) { - std::cerr<<"Object is not orientable. Skipped."< fcolor = - mesh.add_property_map("f:color",first).first; - for(std::size_t pid = 0; pid < colors.size(); ++pid) - { - put(fcolor, face_descriptor(pid), colors[pid]);//should work bc mesh is just created and shouldn't have any destroyed face. Not so sure bc of orientation though. - } - } - Scene_surface_mesh_item* sm_item = new Scene_surface_mesh_item(mesh); - if(first == CGAL::Color(0,0,0,0)) - first = CGAL::Color(50,80,120,255); - sm_item->setColor(QColor(first.red(), first.green(), first.blue())); - sm_item->setProperty("already_colored", true); - sm_item->setName(names[i].data()); - sm_item->invalidateOpenGLBuffers(); - result << sm_item; - if(add_to_scene) - CGAL::Three::Three::scene()->addItem(sm_item); } + if(need_pmap) + { + SMesh::Property_map fcolor = + mesh.add_property_map("f:color",first).first; + for(std::size_t pid = 0; pid < colors.size(); ++pid) + { + put(fcolor, face_descriptor(pid), colors[pid]);//should work bc mesh is just created and shouldn't have any destroyed face. Not so sure bc of orientation though. + } + } + Scene_surface_mesh_item* sm_item = new Scene_surface_mesh_item(mesh); + if(first == CGAL::Color(0,0,0,0)) + first = CGAL::Color(50,80,120,255); + sm_item->setColor(QColor(first.red(), first.green(), first.blue())); + sm_item->setProperty("already_colored", true); + sm_item->setName(names[i].data()); + sm_item->invalidateOpenGLBuffers(); + result << sm_item; + if(add_to_scene) + CGAL::Three::Three::scene()->addItem(sm_item); } ok = true; return result; diff --git a/Stream_support/include/CGAL/IO/write_3mf.h b/Stream_support/include/CGAL/IO/write_3mf.h index de335110f3c..8f66e342767 100644 --- a/Stream_support/include/CGAL/IO/write_3mf.h +++ b/Stream_support/include/CGAL/IO/write_3mf.h @@ -18,15 +18,15 @@ // // Author(s) : Maxime Gimeno -#ifndef WRITE_3MF_H -#define WRITE_3MF_H +#ifndef CGAL_IO_WRITE_3MF_H +#define CGAL_IO_WRITE_3MF_H #include #include #include #include -#include "Model/COM/NMR_DLLInterfaces.h" +#include namespace CGAL{ namespace tmf_internal{ @@ -465,4 +465,4 @@ bool write_triangle_meshes_to_3mf(const std::string& file_name, return write_triangle_soups_to_3mf(file_name, all_points, all_polygons, names); } }//end CGAL -#endif // WRITE_3MF_H +#endif // CGAL_IO_WRITE_3MF_H