diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp index d532a18db96..41e8e73acd4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp @@ -91,11 +91,13 @@ Polyhedron_demo_ply_plugin::load(QFileInfo fileinfo) { { // First try mesh SMesh *surface_mesh = new SMesh(); - - if (CGAL::read_ply (in, *surface_mesh)) + std::string comments; + + if (CGAL::read_ply (in, *surface_mesh, comments)) { Scene_surface_mesh_item* sm_item = new Scene_surface_mesh_item(surface_mesh); sm_item->setName(fileinfo.completeBaseName()); + sm_item->comments() = comments; QApplication::restoreOverrideCursor(); return sm_item; } @@ -185,7 +187,7 @@ bool Polyhedron_demo_ply_plugin::save(const CGAL::Three::Scene_item* item, QFile Scene_surface_mesh_item* sm_item = const_cast(qobject_cast(item)); if (sm_item) - return CGAL::write_ply (out, *(sm_item->polyhedron())); + return CGAL::write_ply (out, *(sm_item->polyhedron()), sm_item->comments()); return false; } diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp index 3043d169ddd..4f2fee6645c 100644 --- a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp @@ -209,6 +209,8 @@ struct Scene_surface_mesh_item_priv{ mutable QList text_ids; mutable std::vector targeted_id; + std::string comments; + mutable bool has_fpatch_id; mutable bool has_feature_edges; mutable bool floated; @@ -1048,6 +1050,9 @@ Scene_surface_mesh_item::~Scene_surface_mesh_item() SMesh* Scene_surface_mesh_item::polyhedron() { return d->smesh_; } const SMesh* Scene_surface_mesh_item::polyhedron() const { return d->smesh_; } +std::string& Scene_surface_mesh_item::comments() { return d->comments; } +const std::string& Scene_surface_mesh_item::comments() const { return d->comments; } + void Scene_surface_mesh_item::compute_bbox()const { SMesh::Property_map pprop = d->smesh_->points(); diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.h b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.h index 6f2bc777a61..375b57b1380 100644 --- a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.h @@ -89,6 +89,10 @@ public: Face_graph* face_graph() { return polyhedron(); } const Face_graph* face_graph() const { return polyhedron(); } + // Gets PLY comments (empty if mesh not originated from PLY input) + std::string& comments(); + const std::string& comments() const; + void invalidate_aabb_tree(); void invalidateOpenGLBuffers()Q_DECL_OVERRIDE; void invalidate(Gl_data_names name);