diff --git a/BGL/include/CGAL/boost/graph/IO/OM.h b/BGL/include/CGAL/boost/graph/IO/OM.h index 9d393022a030..9c582267ae19 100644 --- a/BGL/include/CGAL/boost/graph/IO/OM.h +++ b/BGL/include/CGAL/boost/graph/IO/OM.h @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -34,7 +35,7 @@ namespace internal { template bool read_OM(const std::string& fname, Graph& g, VPM vpm, VFeaturePM vfpm, EFeaturePM efpm) { - typedef OpenMesh::PolyMesh_ArrayKernelT<> OMesh; + typedef OpenMesh::PolyMesh_ArrayKernelT OMesh; typedef typename boost::graph_traits::vertex_descriptor om_vertex_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::halfedge_descriptor om_halfedge_descriptor; @@ -73,9 +74,10 @@ bool read_OM(const std::string& fname, Graph& g, VPM vpm, VFeaturePM vfpm, EFeat } template -bool write_OM(std::string fname, const Graph& g, VPM vpm, VFeaturePM vfpm, EFeaturePM efpm) +bool write_OM(std::string fname, const Graph& g, VPM vpm, VFeaturePM vfpm, EFeaturePM efpm, + const std::streamsize precision) { - typedef OpenMesh::PolyMesh_ArrayKernelT<> OMesh; + typedef OpenMesh::PolyMesh_ArrayKernelT OMesh; typedef typename boost::graph_traits::vertex_descriptor om_vertex_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::halfedge_descriptor om_halfedge_descriptor; @@ -108,7 +110,7 @@ bool write_OM(std::string fname, const Graph& g, VPM vpm, VFeaturePM vfpm, EFeat omesh.status(omv).set_feature(isfeature); } - return OpenMesh::IO::write_mesh(omesh, fname, OpenMesh::IO::Options::Status); + return OpenMesh::IO::write_mesh(omesh, fname, OpenMesh::IO::Options::Status, precision); } } // end of internal namespace @@ -208,6 +210,11 @@ bool read_OM(const std::string& fname, \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` as key type and `bool` as value type.} \cgalParamNEnd + \cgalParamNBegin{stream_precision} + \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream} + \cgalParamType{int} + \cgalParamDefault{the precision of the stream `os`} + \cgalParamNEnd \cgalNamedParamsEnd \returns `true` if writing was successful, `false` otherwise. @@ -228,7 +235,9 @@ bool write_OM(const std::string& fname, CGAL::Constant_property_map(false)); auto vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(vertex_point, g)); - return internal::write_OM(fname, g, vpm, vfpm, efpm); + std::streamsize precision = choose_parameter(get_parameter(np, internal_np::stream_precision), + 18); + return internal::write_OM(fname, g, vpm, vfpm, efpm, precision); } diff --git a/Lab/demo/Lab/Plugins/IO/OM_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/OM_io_plugin.cpp index 286fdd5bc01d..ab81338bf068 100644 --- a/Lab/demo/Lab/Plugins/IO/OM_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/OM_io_plugin.cpp @@ -180,12 +180,14 @@ save(QFileInfo fileinfo, QList& items) res = CGAL::IO::write_OM((const char*)fileinfo.filePath().toUtf8() , *sm_item->face_graph() , CGAL::parameters::vertex_is_constrained_map(selection_item->constrained_vertices_pmap()) - .edge_is_constrained_map(selection_item->constrained_edges_pmap())); + .edge_is_constrained_map(selection_item->constrained_edges_pmap()) + .stream_precision(17)); } else { res = CGAL::IO::write_OM((const char*)fileinfo.filePath().toUtf8() - , *sm_item->face_graph()); + , *sm_item->face_graph() + , CGAL::parameters::stream_precision(17)); } if (res)