diff --git a/BGL/include/CGAL/boost/graph/IO/GOCAD.h b/BGL/include/CGAL/boost/graph/IO/GOCAD.h index d50bd8f0604..40052a2b4d4 100644 --- a/BGL/include/CGAL/boost/graph/IO/GOCAD.h +++ b/BGL/include/CGAL/boost/graph/IO/GOCAD.h @@ -231,6 +231,12 @@ bool read_GOCAD(const std::string& fname, Graph& g) { return read_GOCAD(fname, g /// \cgalParamExtra{If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` /// must be available in `Graph`.} /// \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{`6`} +/// \cgalParamNEnd /// \cgalNamedParamsEnd /// template ::%vertex_descriptor` - * as key type and `std::size_t` as value type} - * \cgalParamDefault{no vertex indices in the output} - * \cgalParamNEnd + * \cgalParamNBegin{vertex_index_map} + * \cgalParamDescription{a property map associating to each vertex of `graph` a unique index between `0` and `num_vertices(graph) - 1`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `std::size_t` as value type} + * \cgalParamDefault{no vertex indices in the output} + * \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{`6`} + * \cgalParamNEnd * \cgalNamedParamsEnd * * \pre `g` contains only triangular faces @@ -422,6 +428,12 @@ bool write_VTP(std::ostream& os, using parameters::get_parameter; using parameters::choose_parameter; + if(!os.good()) + return false; + + const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); + os << std::setprecision(precision); + os << "\n" << "::%vertex_descriptor` - * as key type and `std::size_t` as value type} - * \cgalParamDefault{no vertex indices in the output} - * \cgalParamNEnd + * \cgalParamNBegin{vertex_index_map} + * \cgalParamDescription{a property map associating to each vertex of `graph` a unique index between `0` and `num_vertices(graph) - 1`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `std::size_t` as value type} + * \cgalParamDefault{no vertex indices in the output} + * \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{`6`} + * \cgalParamNEnd * \cgalNamedParamsEnd * * \pre `g` contains only triangular faces diff --git a/BGL/include/CGAL/boost/graph/IO/WRL.h b/BGL/include/CGAL/boost/graph/IO/WRL.h index 53a47d102d3..ba8329f23dc 100644 --- a/BGL/include/CGAL/boost/graph/IO/WRL.h +++ b/BGL/include/CGAL/boost/graph/IO/WRL.h @@ -49,6 +49,12 @@ namespace CGAL { \cgalParamExtra{If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` must be available in `Graph`.} \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{`6`} + \cgalParamNEnd \cgalNamedParamsEnd \returns `true` if writing was successful. diff --git a/BGL/include/CGAL/boost/graph/IO/polygon_mesh_io.h b/BGL/include/CGAL/boost/graph/IO/polygon_mesh_io.h index 40b785b4155..50de6ae713d 100644 --- a/BGL/include/CGAL/boost/graph/IO/polygon_mesh_io.h +++ b/BGL/include/CGAL/boost/graph/IO/polygon_mesh_io.h @@ -11,7 +11,10 @@ #define CGAL_BOOST_GRAPH_POLYGON_MESH_IO_H #include -#include +#include + +#include +#include namespace CGAL { @@ -181,6 +184,12 @@ bool read_polygon_mesh(const char* fname, Graph& g) * \cgalParamExtra{If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` * must be available in `Graph`.} * \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{`6`} + * \cgalParamNEnd * \cgalNamedParamsEnd * * Other named parameters may be used according to the file extension, see \ref PkgBGLIOFct for an exhaustive list. diff --git a/BGL/test/BGL/test_3mf_to_sm.cpp b/BGL/test/BGL/test_3mf_to_sm.cpp index 8acf6d169a2..df8f8a779e1 100644 --- a/BGL/test/BGL/test_3mf_to_sm.cpp +++ b/BGL/test/BGL/test_3mf_to_sm.cpp @@ -31,16 +31,17 @@ typedef std::vector ColorRange; int main(int argc, char** argv) { #ifdef CGAL_LINKED_WITH_3MF - const char* file_name=(argc == 2) ? argv[1] : "data/test.3mf"; + const char* filname = (argc == 2) ? argv[1] : "data/test.3mf"; std::vector all_points; std::vector all_polygons; std::vector all_colors; std::vector names; std::vector meshes; + //testing reading functions. - int nb_meshes = - CGAL::read_3mf(file_name, meshes); + int nb_meshes = CGAL::read_3mf(filename, meshes); + if(nb_meshes <0) return 1; for(int i = 0; i< nb_meshes; ++i)