mirror of https://github.com/CGAL/cgal
Fix PLY plugin
This commit is contained in:
parent
207a432dfd
commit
fe18f20d05
|
|
@ -1,5 +1,6 @@
|
|||
#include "Scene_polygon_soup_item.h"
|
||||
#include "Scene_surface_mesh_item.h"
|
||||
#include "Scene_textured_surface_mesh_item.h"
|
||||
#include "Scene_points_with_normal_item.h"
|
||||
|
||||
#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
|
||||
|
|
@ -147,7 +148,8 @@ bool Polyhedron_demo_ply_plugin::canSave(const CGAL::Three::Scene_item* item)
|
|||
// This plugin supports point sets and any type of surface
|
||||
return (qobject_cast<const Scene_points_with_normal_item*>(item)
|
||||
|| qobject_cast<const Scene_polygon_soup_item*>(item)
|
||||
|| qobject_cast<const Scene_surface_mesh_item*>(item));
|
||||
|| qobject_cast<const Scene_surface_mesh_item*>(item)
|
||||
|| qobject_cast<const Scene_textured_surface_mesh_item*>(item));
|
||||
}
|
||||
|
||||
bool Polyhedron_demo_ply_plugin::save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo)
|
||||
|
|
@ -168,7 +170,10 @@ bool Polyhedron_demo_ply_plugin::save(const CGAL::Three::Scene_item* item, QFile
|
|||
return false;
|
||||
|
||||
std::ofstream out(fileinfo.filePath().toUtf8().data(), std::ios::binary);
|
||||
out.precision (std::numeric_limits<double>::digits10 + 2);
|
||||
if (choice == tr("Binary"))
|
||||
CGAL::set_binary_mode(out);
|
||||
else
|
||||
out.precision (std::numeric_limits<double>::digits10 + 2);
|
||||
|
||||
// This plugin supports point sets
|
||||
const Scene_points_with_normal_item* point_set_item =
|
||||
|
|
@ -183,11 +188,16 @@ bool Polyhedron_demo_ply_plugin::save(const CGAL::Three::Scene_item* item, QFile
|
|||
return CGAL::write_PLY (out, soup_item->points(), soup_item->polygons());
|
||||
|
||||
// This plugin supports surface meshes
|
||||
Scene_surface_mesh_item* sm_item =
|
||||
const_cast<Scene_surface_mesh_item*>(qobject_cast<const Scene_surface_mesh_item*>(item));
|
||||
const Scene_surface_mesh_item* sm_item =
|
||||
qobject_cast<const Scene_surface_mesh_item*>(item);
|
||||
if (sm_item)
|
||||
return CGAL::write_ply (out, *(sm_item->polyhedron()), sm_item->comments());
|
||||
|
||||
|
||||
// This plugin supports textured surface meshes
|
||||
const Scene_textured_surface_mesh_item* stm_item =
|
||||
qobject_cast<const Scene_textured_surface_mesh_item*>(item);
|
||||
if (stm_item)
|
||||
return CGAL::write_ply (out, *(stm_item->textured_face_graph()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue