From a46d62b83ed20498e16bff28811079f5e7ab0649 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 15 Jan 2021 15:09:12 +0100 Subject: [PATCH 01/20] WIP testing deprecated IO functions --- BGL/include/CGAL/boost/graph/IO/OFF.h | 4 +-- BGL/test/BGL/CMakeLists.txt | 4 +++ BGL/test/BGL/test_deprecated_io.cpp | 49 +++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 BGL/test/BGL/test_deprecated_io.cpp diff --git a/BGL/include/CGAL/boost/graph/IO/OFF.h b/BGL/include/CGAL/boost/graph/IO/OFF.h index 0c95c7ea570..507bc04467d 100644 --- a/BGL/include/CGAL/boost/graph/IO/OFF.h +++ b/BGL/include/CGAL/boost/graph/IO/OFF.h @@ -284,9 +284,9 @@ bool read_OFF(const std::string& fname, Graph& g, \deprecated This function is deprecated since \cgal 5.2, `CGAL::read_OFF()` should be used instead. */ template -CGAL_DEPRECATED bool read_off(std::ostream& os, Graph& g, const CGAL_BGL_NP_CLASS& np) +CGAL_DEPRECATED bool read_off(std::istream& is, Graph& g, const CGAL_BGL_NP_CLASS& np) { - return read_OFF(os, g, np); + return read_OFF(is, g, np); } /*! diff --git a/BGL/test/BGL/CMakeLists.txt b/BGL/test/BGL/CMakeLists.txt index d6ec47e9cae..3009a3ae873 100644 --- a/BGL/test/BGL/CMakeLists.txt +++ b/BGL/test/BGL/CMakeLists.txt @@ -98,6 +98,8 @@ create_single_source_cgal_program( create_single_source_cgal_program( "graph_traits_inheritance.cpp" ) +create_single_source_cgal_program("test_deprecated_io.cpp") + if(OpenMesh_FOUND) target_link_libraries(test_clear PRIVATE ${OPENMESH_LIBRARIES}) target_compile_definitions(test_clear PRIVATE -DCGAL_USE_OPENMESH) @@ -129,6 +131,8 @@ if (VTK_FOUND) if(VTK_LIBRARIES) target_link_libraries(test_bgl_read_write PRIVATE ${VTK_LIBRARIES}) target_compile_definitions(test_bgl_read_write PRIVATE -DCGAL_USE_VTK) + target_link_libraries(test_deprecated_io PRIVATE ${VTK_LIBRARIES}) + target_compile_definitions(test_deprecated_io PRIVATE -DCGAL_USE_VTK) else() message(STATUS "Tests that use VTK will not be compiled.") endif() diff --git a/BGL/test/BGL/test_deprecated_io.cpp b/BGL/test/BGL/test_deprecated_io.cpp new file mode 100644 index 00000000000..d195299f1f1 --- /dev/null +++ b/BGL/test/BGL/test_deprecated_io.cpp @@ -0,0 +1,49 @@ +#include + +#include +#include +#include + +#include +#include +typedef CGAL::Simple_cartesian Kernel; +typedef Kernel::Point_3 Point_3; +typedef CGAL::Surface_mesh SM; + +int main() +{ + // OFF + SM sm_in, sm_out; + Point_3 p0(0,0,0), p1(1,0,0), p2(0,1,0); + CGAL::make_triangle(p0, p1, p2, sm_out); + bool ok = CGAL::write_off("tmp.off", sm_out, CGAL::parameters::all_default()); + assert(ok); + ok = CGAL::read_off("tmp.off", sm_in, CGAL::parameters::all_default()); + assert(ok); + assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); + sm_in.clear(); + + std::ofstream os("tmp.off"); + ok = CGAL::write_off(os, sm_out, CGAL::parameters::all_default()); + assert(ok); + os.close(); + std::ifstream is("tmp.off"); + ok = CGAL::read_off(is, sm_in, CGAL::parameters::all_default()); + assert(ok); + assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); + is.close(); + sm_in.clear(); + + //vtk + os.open("tmp.vtp"); + ok = CGAL::write_vtp(os, sm_out, CGAL::parameters::all_default()); + assert(ok); + os.close(); + + ok = CGAL::read_VTP("tmp.vtp", sm_in, CGAL::parameters::all_default()); + assert(ok); + assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); + sm_in.clear(); + + return EXIT_SUCCESS; +} From 49f68654d6ef5b233e762fadb26579d071a07074 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 18 Jan 2021 11:48:04 +0100 Subject: [PATCH 02/20] WIP --- BGL/test/BGL/test_deprecated_io.cpp | 11 ++- Point_set_3/test/Point_set_3/CMakeLists.txt | 15 ++++ .../Point_set_3/test_deprecated_io_ps.cpp | 82 +++++++++++++++++++ .../Point_set_processing_3/CMakeLists.txt | 2 + .../test_deprecated_io_point_set.cpp | 50 +++++++++++ .../include/CGAL/IO/VRML/File_writer_VRML_2.h | 5 +- 6 files changed, 162 insertions(+), 3 deletions(-) create mode 100644 Point_set_3/test/Point_set_3/test_deprecated_io_ps.cpp create mode 100644 Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp diff --git a/BGL/test/BGL/test_deprecated_io.cpp b/BGL/test/BGL/test_deprecated_io.cpp index d195299f1f1..b2d48d4c8ca 100644 --- a/BGL/test/BGL/test_deprecated_io.cpp +++ b/BGL/test/BGL/test_deprecated_io.cpp @@ -1,11 +1,15 @@ #include - +#include +#include #include #include #include #include #include +#include + + typedef CGAL::Simple_cartesian Kernel; typedef Kernel::Point_3 Point_3; typedef CGAL::Surface_mesh SM; @@ -45,5 +49,10 @@ int main() assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); sm_in.clear(); + //wrl + os.open("tmp.wrl"); + ok = CGAL::write_wrl(os, sm_out, CGAL::parameters::all_default()); + assert(ok); + os.close(); return EXIT_SUCCESS; } diff --git a/Point_set_3/test/Point_set_3/CMakeLists.txt b/Point_set_3/test/Point_set_3/CMakeLists.txt index 3fb6595dcea..d6b434e3b60 100644 --- a/Point_set_3/test/Point_set_3/CMakeLists.txt +++ b/Point_set_3/test/Point_set_3/CMakeLists.txt @@ -28,3 +28,18 @@ endif() create_single_source_cgal_program("point_set_test.cpp") create_single_source_cgal_program("point_set_test_join.cpp") +create_single_source_cgal_program("test_deprecated_io_ps.cpp") + +#Use LAS +#disable if MSVC 2017 +if(NOT MSVC_VERSION OR (MSVC_VERSION GREATER_EQUAL 1919 AND MSVC_VERSION LESS 1910)) + find_package(LASLIB) + include(CGAL_LASLIB_support) + if (TARGET CGAL::LASLIB_support) + target_link_libraries(test_deprecated_io_ps PUBLIC CGAL::LASLIB_support) + else() + message(STATUS "NOTICE : the LAS reader test requires LASlib and will not be compiled.") + endif() +else() + message(STATUS "NOTICE : the LAS reader does not work with Visual Studio 2017.") +endif() diff --git a/Point_set_3/test/Point_set_3/test_deprecated_io_ps.cpp b/Point_set_3/test/Point_set_3/test_deprecated_io_ps.cpp new file mode 100644 index 00000000000..6d3a124c357 --- /dev/null +++ b/Point_set_3/test/Point_set_3/test_deprecated_io_ps.cpp @@ -0,0 +1,82 @@ +#include + +#include + +#include +#include +#include +#include + +#include +#include + + +typedef CGAL::Simple_cartesian Kernel; +typedef Kernel::Point_3 Point_3; +typedef Kernel::Vector_3 Vector_3; + +int main() +{ + CGAL::Point_set_3 ps, ps2; + std::ifstream is("data/oni.pwn"); + std::ofstream os; + + if(!CGAL::read_xyz_point_set(is, ps)) + { + std::cerr<<"Error while reading input."< + +#include + +#include +#include +#include + +// Just to try and create ambiguities +#include +#include + +#include + +#include +#include +#include +#include + +typedef CGAL::Simple_cartesian Kernel; +typedef Kernel::Point_3 Point_3; +typedef Kernel::Vector_3 Vector_3; +typedef std::array Color; +typedef std::pair PointWithColor; +typedef CGAL::Nth_of_tuple_property_map<1, PointWithColor> Color_map; + + +int main() +{ + +std::vector points(3); +points[0] = std::make_pair(Point_3(1,0,0), Color(255,0,0,255)); +points[1] = std::make_pair(Point_3(0,1,0), Color(0,255,0,255)); +points[2] = std::make_pair(Point_3(0,0,1), Color(0,0,255,255)); + + +std::ofstream os; +std::ifstream is; +#ifdef CGAL_LINKED_WITH_LASLIB +os.open("tmp.las", std::ios::binary); +bool ok = CGAL::write_las_points_with_properties(os, points, std::make_tuple( + ), + ); +is.open("data/read_test/pig_points.las", std::ios::binary); + + +assert(ok); +#endif + +} diff --git a/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h b/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h index 48e58fa64ec..86f501a35df 100644 --- a/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h +++ b/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h @@ -28,6 +28,7 @@ namespace CGAL { class File_writer_VRML_2 { + VRML_2_ostream m_os; std::size_t m_facets; @@ -36,7 +37,7 @@ public: std::ostream& out() const { return m_os.os(); } - void write_header(VRML_2_ostream& o, + void write_header(std::ostream& o, std::size_t vertices, std::size_t halfedges, std::size_t facets, @@ -44,7 +45,7 @@ public: const bool /*normals*/ = false, const bool /*textures*/ = false) { - m_os = o; + m_os = VRML_2_ostream(o); m_facets = facets; out() << " #-- Begin of Polygon Mesh\n"; From 0d2e685244c7ec546729dbd5c0ab6c77f9b9122d Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 19 Jan 2021 15:10:57 +0100 Subject: [PATCH 03/20] LAS and PLY with properties --- .../test_deprecated_io_point_set.cpp | 103 ++++++++++++++++-- 1 file changed, 94 insertions(+), 9 deletions(-) diff --git a/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp b/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp index fdba209e918..84fc487c2ce 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp @@ -1,4 +1,4 @@ -//#include +#include #include @@ -24,27 +24,112 @@ typedef std::array Color; typedef std::pair PointWithColor; typedef CGAL::Nth_of_tuple_property_map<1, PointWithColor> Color_map; +struct GetRedMap{ + typedef PointWithColor key_type; + typedef unsigned short value_type; + typedef const value_type& reference; + typedef boost::lvalue_property_map_tag category; +}; +unsigned short get(const GetRedMap&, const PointWithColor& p) +{ + return p.second[0]; +} + +struct GetGreenMap{ + typedef PointWithColor key_type; + typedef unsigned short value_type; + typedef const value_type& reference; + typedef boost::lvalue_property_map_tag category; +}; +unsigned short get(const GetGreenMap&, const PointWithColor& p) +{ + return p.second[1]; +} + +struct GetBlueMap{ + typedef PointWithColor key_type; + typedef unsigned short value_type; + typedef const value_type& reference; + typedef boost::lvalue_property_map_tag category; +}; +unsigned short get(const GetBlueMap&, const PointWithColor& p) +{ + return p.second[3]; +} + +struct GetAlphaMap{ + typedef PointWithColor key_type; + typedef unsigned short value_type; + typedef const value_type& reference; + typedef boost::lvalue_property_map_tag category; +}; +unsigned short get(const GetAlphaMap&, const PointWithColor& p) +{ + return p.second[4]; +} int main() { std::vector points(3); -points[0] = std::make_pair(Point_3(1,0,0), Color(255,0,0,255)); -points[1] = std::make_pair(Point_3(0,1,0), Color(0,255,0,255)); -points[2] = std::make_pair(Point_3(0,0,1), Color(0,0,255,255)); +points[0] = std::make_pair(Point_3(1,0,0), Color{255,0,0,255}); +points[1] = std::make_pair(Point_3(0,1,0), Color{0,255,0,255}); +points[2] = std::make_pair(Point_3(0,0,1), Color{0,0,255,255}); std::ofstream os; std::ifstream is; +bool ok; #ifdef CGAL_LINKED_WITH_LASLIB os.open("tmp.las", std::ios::binary); -bool ok = CGAL::write_las_points_with_properties(os, points, std::make_tuple( - ), +ok = CGAL::write_las_points_with_properties(os, points, + CGAL::make_las_point_writer(CGAL::First_of_pair_property_map()), + std::make_pair(GetRedMap(),CGAL::LAS_property::R()), + std::make_pair(GetGreenMap(), CGAL::LAS_property::G()), + std::make_pair(GetBlueMap(), CGAL::LAS_property::B()), + std::make_pair(GetAlphaMap(), CGAL::LAS_property::I()) ); -is.open("data/read_test/pig_points.las", std::ios::binary); - - +os.close(); assert(ok); +points.clear(); +is.open("tmp.las", std::ios::binary); +ok = CGAL::read_las_points_with_properties(is, std::back_inserter (points), + CGAL::make_las_point_reader(CGAL::First_of_pair_property_map()), + std::make_tuple(CGAL::Second_of_pair_property_map(), + CGAL::Construct_array(), + CGAL::LAS_property::R(), + CGAL::LAS_property::G(), + CGAL::LAS_property::B(), + CGAL::LAS_property::I())); +is.close(); +assert(ok); +assert(points.size() == 3); +assert(points[1].second[1] == 255); #endif +os.open("tmp.ply"); +ok = CGAL::write_ply_points_with_properties(os, points, + CGAL::make_ply_point_writer (CGAL::First_of_pair_property_map()), + std::make_pair(GetRedMap(),CGAL::PLY_property("red")), + std::make_pair(GetGreenMap(), CGAL::PLY_property("green")), + std::make_pair(GetBlueMap(), CGAL::PLY_property("blue")), + std::make_pair(GetAlphaMap(), CGAL::PLY_property("alpha")) + ); +os.close(); +assert(ok); + +is.open("tmp.ply"); +points.clear(); +ok = CGAL::read_ply_points_with_properties(is, std::back_inserter (points), + CGAL::make_ply_point_reader(CGAL::First_of_pair_property_map()), + std::make_tuple(CGAL::Second_of_pair_property_map(), + CGAL::Construct_array(), + CGAL::PLY_property("red"), + CGAL::PLY_property("green"), + CGAL::PLY_property("blue"), + CGAL::PLY_property("alpha"))); +assert(ok); +assert(points.size() == 3); +assert(points[1].second[1] == 255); + } From 54db0c04d1aebfc00284c3be832ac4c368393e27 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 20 Jan 2021 09:51:56 +0100 Subject: [PATCH 04/20] FInish --- .../test_deprecated_io_point_set.cpp | 60 +++++++++++++++- .../include/CGAL/Surface_mesh/IO/PLY.h | 4 +- Surface_mesh/test/Surface_mesh/CMakeLists.txt | 13 ++++ .../Surface_mesh/test_deprecated_io_sm.cpp | 70 +++++++++++++++++++ 4 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 Surface_mesh/test/Surface_mesh/test_deprecated_io_sm.cpp diff --git a/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp b/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp index 84fc487c2ce..cc55bce3918 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp @@ -80,6 +80,7 @@ points[2] = std::make_pair(Point_3(0,0,1), Color{0,0,255,255}); std::ofstream os; std::ifstream is; bool ok; +//LAS #ifdef CGAL_LINKED_WITH_LASLIB os.open("tmp.las", std::ios::binary); ok = CGAL::write_las_points_with_properties(os, points, @@ -105,8 +106,24 @@ is.close(); assert(ok); assert(points.size() == 3); assert(points[1].second[1] == 255); -#endif +std::vector ps; +ps.push_back(Point_3(1,0,0)); +ps.push_back(Point_3(0,1,0)); +ps.push_back(Point_3(0,0,1)); + +os.open("tmp.las", std::ios_base::binary); +CGAL::write_las_points(os, ps, CGAL::parameters::all_default()); +os.close(); +assert(ok); +ps.clear(); +is.open("tmp.las", std::ios::binary); +ok = CGAL::read_las_points(is, std::back_inserter (ps),CGAL::parameters::all_default()); +is.close(); +assert(ok); +assert(ps.size() == 3); +#endif +//PLY os.open("tmp.ply"); ok = CGAL::write_ply_points_with_properties(os, points, CGAL::make_ply_point_writer (CGAL::First_of_pair_property_map()), @@ -128,8 +145,49 @@ ok = CGAL::read_ply_points_with_properties(is, std::back_inserter (points), CGAL::PLY_property("green"), CGAL::PLY_property("blue"), CGAL::PLY_property("alpha"))); +is.close(); assert(ok); assert(points.size() == 3); assert(points[1].second[1] == 255); +os.open("tmp.ply"); +ok = CGAL::write_ply_points(os, ps, CGAL::parameters::all_default()); +os.close(); +assert(ok); + +is.open("tmp.ply"); +ps.clear(); +ok = CGAL::read_ply_points(is, std::back_inserter (ps), + CGAL::parameters::all_default()); +is.close(); +assert(ok); +assert(ps.size() == 3); + +//OFF +os.open("tmp.off"); +ok = CGAL::write_off_points(os, ps, CGAL::parameters::all_default()); +os.close(); +assert(ok); + +is.open("tmp.off"); +ps.clear(); +ok = CGAL::read_off_points(is, std::back_inserter (ps), + CGAL::parameters::all_default()); +is.close(); +assert(ok); +assert(ps.size() == 3); + +//XYZ +os.open("tmp.xyz"); +ok = CGAL::write_xyz_points(os, ps, CGAL::parameters::all_default()); +os.close(); +assert(ok); + +is.open("tmp.xyz"); +ps.clear(); +ok = CGAL::read_xyz_points(is, std::back_inserter (ps), + CGAL::parameters::all_default()); +is.close(); +assert(ok); +assert(ps.size() == 3); } diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h index 3e82506fe8a..dea71e4478e 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h @@ -1136,9 +1136,9 @@ bool write_PLY(std::ostream& os, const Surface_mesh

& sm) */ template -CGAL_DEPRECATED bool write_ply(std::istream& is, Surface_mesh

& sm, std::string& comments) +CGAL_DEPRECATED bool write_ply(std::ostream& os, Surface_mesh

& sm, std::string& comments) { - return write_PLY(is, sm, comments); + return write_PLY(os, sm, comments); } #endif // CGAL_NO_DEPRECATED_CODE diff --git a/Surface_mesh/test/Surface_mesh/CMakeLists.txt b/Surface_mesh/test/Surface_mesh/CMakeLists.txt index 81a2d0ae980..6527c9bb721 100644 --- a/Surface_mesh/test/Surface_mesh/CMakeLists.txt +++ b/Surface_mesh/test/Surface_mesh/CMakeLists.txt @@ -14,3 +14,16 @@ file( foreach(cppfile ${cppfiles}) create_single_source_cgal_program("${cppfile}") endforeach() + +find_path(3MF_INCLUDE_DIR + NAMES Model/COM/NMR_DLLInterfaces.h + DOC "Path to lib3MF headers" + ) +find_library(3MF_LIBRARIES NAMES 3MF DOC "Path to the lib3MF library") +if(3MF_LIBRARIES AND 3MF_INCLUDE_DIR AND EXISTS "${3MF_INCLUDE_DIR}/Model/COM/NMR_DLLInterfaces.h") + include_directories(${3MF_INCLUDE_DIR}) + target_link_libraries(test_deprecated_io_sm PRIVATE ${3MF_LIBRARIES}) + target_compile_definitions(test_deprecated_io_sm PRIVATE -DCGAL_LINKED_WITH_3MF) +else() + message(STATUS "NOTICE : read_3mf requires the lib3MF library, and will not be tested.") +endif() diff --git a/Surface_mesh/test/Surface_mesh/test_deprecated_io_sm.cpp b/Surface_mesh/test/Surface_mesh/test_deprecated_io_sm.cpp new file mode 100644 index 00000000000..8607ccba9d7 --- /dev/null +++ b/Surface_mesh/test/Surface_mesh/test_deprecated_io_sm.cpp @@ -0,0 +1,70 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +typedef CGAL::Simple_cartesian Kernel; +typedef Kernel::Point_3 Point_3; +typedef CGAL::Surface_mesh SM; + +int main() +{ + // OFF + SM sm_in, sm_out; + Point_3 p0(0,0,0), p1(1,0,0), p2(0,1,0); + CGAL::make_triangle(p0, p1, p2, sm_out); + bool ok = CGAL::write_off(sm_out, "tmp.off"); + assert(ok); + ok = CGAL::read_off(sm_in, "tmp.off"); + assert(ok); + assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); + sm_in.clear(); + + std::ofstream os("tmp.off"); + ok = CGAL::write_off(os, sm_out); + assert(ok); + os.close(); + std::ifstream is("tmp.off"); + ok = CGAL::read_off(is, sm_in); + assert(ok); + assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); + is.close(); + sm_in.clear(); + + //PLY + os.open("tmp.ply"); + std::string comments; + ok = CGAL::write_ply(os, sm_out, comments); + assert(ok); + os.close(); + is.open("tmp.ply"); + ok = CGAL::read_ply(is, sm_in, comments); + assert(ok); + assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); + is.close(); + sm_in.clear(); + +#ifdef CGAL_LINKED_WITH_3MF + // 3mf + std::vector output_3mf; + ok = CGAL::read_3mf("test.3mf", output_3mf); + assert(ok); + assert(output_3mf.size() == 2); + sm_in.clear(); +#endif + + //others + ok = CGAL::write_mesh(sm_out, "tmp.off"); + assert(ok); + ok = CGAL::read_mesh(sm_in, "tmp.ply"); + assert(ok); + assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); + sm_in.clear(); + return EXIT_SUCCESS; +} From 78a13fbd03e3495b4f13c9e54e95c5e0f9b31332 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 20 Jan 2021 09:53:35 +0100 Subject: [PATCH 05/20] add missing test file --- Surface_mesh/test/Surface_mesh/test.3mf | Bin 0 -> 2183 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Surface_mesh/test/Surface_mesh/test.3mf diff --git a/Surface_mesh/test/Surface_mesh/test.3mf b/Surface_mesh/test/Surface_mesh/test.3mf new file mode 100644 index 0000000000000000000000000000000000000000..8e8d5e004f271af203da698010b667da1bff1e62 GIT binary patch literal 2183 zcmZ`*2{_bi7yplC3?rtDt!#CtEM=WAUCi8&aqS{YmQjo)1~nsF)~HEZ#FVu{G=#3n zE+mq529vSI5G6|==Azt|YwLTS>ihoB^S;0Hf8TS?^S-}xo^xI+Q*It*001EC0{{y9 z%`SY~{$KzcKpLtdJqQ6Fct4fR83e!peu+(0po(V;vm83kJwm};|n$ZyM)YcE4l<(CcXK4+hSn=%`+fSA`W_nV)rFqN*2Rk@6y&c)LEAdk7 zaYY}?WBsHrzGE(`b}spI6YX~0*B4duS=KR8iQH5~WVNU4 zxT8I2>Upg}b>YEvt|uxFaSdPBkoeHKHOd>$r{|hd!{fylM+)|-xT{`m%Ee9kYd%V9 z%IIBAd3MFXJ>>#Cfw9!IW-NIbN&T9-yhqrBZ8$NlK0B7uIA}}j2bjygTp=3n_klkY zym7FYk2(wsArbane!`b@x4nri3lf3-(1K|6%`*1zsR7W4$dF^heR++!y=ZI1%9`K) z-^$`SzC?^K2U8R*k4HZlb)m5T*{Q`(|BP3Xo8@Xyu^bTq&x)x*^!4Kp!qcF(hg#(z zR|JWU&!ouu&tHfL_OKzEnp7)s$346*yR_wBI^K(##KeQV4(OSajufE#oH$rkN z(&HDIIsnA$x*EJZ)x7fX3Wrzo-f2u{uw^|;w>4P)bpR`a|0F>PQ$3YznIh~QQI;%hsXqDD{FK?j ziqrn0gpksq5j6G5`MV-=;0(1-`q4yQ)m^)dq~UZhmU0CtG7Yr>6f|l@Mf{NEI z%wva~0`(T&=V-pmc$78dydj^_ewQ)KQ(nssV>9u-bnSkf^12PV5=2Dr_*}E&mh0PH z;h*X>+a3qmjH07W7#&SCrBJq!&?-%hZ7mg|n=sOSjo7aod%Uh{|FVLUZ|&-?@|sUjeI^cggcw3ge3Krpd&bxb=M z1y*cFTj#22A#<(>Wnh;3^5iHy4<6l8`P)i)CbdI$vY@T7{|4~qf^z;zA;WR&0uOND z@1kg6DWB8hGoiksgy{b7F%2U!gsga{CeI3ToHOHf$qC%S6Iv z3END?YAC&>C*vOmH&UCuB)Shq*l>@RD6B|CN?Lhkh@L33w2U%CzGvsm+LUB979!hK z>Uw?noo|-n=D7AgB z=ylwn;nzkf@k^uJHUWP2{A23BtqQozWxVGJme|G+3oPKuxL)0XGiJB64>&#ZB xVDO>s<8N`Y^~1fr_8kScqb|w!U%O3d|JLgQ*x0r*<=ynk4R8Y+`Wx&4z`vc Date: Tue, 26 Jan 2021 09:35:13 +0100 Subject: [PATCH 06/20] Fixes --- BGL/test/BGL/test_deprecated_io.cpp | 4 ++-- Point_set_3/test/Point_set_3/test_deprecated_io_ps.cpp | 4 ++-- .../test_deprecated_io_point_set.cpp | 9 ++++----- Polyhedron/include/CGAL/IO/Polyhedron_VRML_2_ostream.h | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/BGL/test/BGL/test_deprecated_io.cpp b/BGL/test/BGL/test_deprecated_io.cpp index b2d48d4c8ca..e66247ffc1b 100644 --- a/BGL/test/BGL/test_deprecated_io.cpp +++ b/BGL/test/BGL/test_deprecated_io.cpp @@ -37,7 +37,7 @@ int main() assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); is.close(); sm_in.clear(); - +#ifdef CGAL_USE_VTK //vtk os.open("tmp.vtp"); ok = CGAL::write_vtp(os, sm_out, CGAL::parameters::all_default()); @@ -48,7 +48,7 @@ int main() assert(ok); assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); sm_in.clear(); - +#endif //wrl os.open("tmp.wrl"); ok = CGAL::write_wrl(os, sm_out, CGAL::parameters::all_default()); diff --git a/Point_set_3/test/Point_set_3/test_deprecated_io_ps.cpp b/Point_set_3/test/Point_set_3/test_deprecated_io_ps.cpp index 6d3a124c357..8876da2d1aa 100644 --- a/Point_set_3/test/Point_set_3/test_deprecated_io_ps.cpp +++ b/Point_set_3/test/Point_set_3/test_deprecated_io_ps.cpp @@ -27,11 +27,11 @@ int main() return EXIT_FAILURE; } is.close(); - + bool ok = false; #ifdef CGAL_LINKED_WITH_LASLIB //LAS os.open("tmp.las", std::ios::binary); - bool ok = CGAL::write_las_point_set(os, ps); + ok = CGAL::write_las_point_set(os, ps); os.close(); assert (ok); diff --git a/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp b/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp index cc55bce3918..1327b5854ce 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp @@ -80,6 +80,10 @@ points[2] = std::make_pair(Point_3(0,0,1), Color{0,0,255,255}); std::ofstream os; std::ifstream is; bool ok; +std::vector ps; +ps.push_back(Point_3(1,0,0)); +ps.push_back(Point_3(0,1,0)); +ps.push_back(Point_3(0,0,1)); //LAS #ifdef CGAL_LINKED_WITH_LASLIB os.open("tmp.las", std::ios::binary); @@ -107,11 +111,6 @@ assert(ok); assert(points.size() == 3); assert(points[1].second[1] == 255); -std::vector ps; -ps.push_back(Point_3(1,0,0)); -ps.push_back(Point_3(0,1,0)); -ps.push_back(Point_3(0,0,1)); - os.open("tmp.las", std::ios_base::binary); CGAL::write_las_points(os, ps, CGAL::parameters::all_default()); os.close(); diff --git a/Polyhedron/include/CGAL/IO/Polyhedron_VRML_2_ostream.h b/Polyhedron/include/CGAL/IO/Polyhedron_VRML_2_ostream.h index 618dc6c2959..5659c0c800f 100644 --- a/Polyhedron/include/CGAL/IO/Polyhedron_VRML_2_ostream.h +++ b/Polyhedron/include/CGAL/IO/Polyhedron_VRML_2_ostream.h @@ -28,9 +28,9 @@ template & P) { - IO::internal::Generic_facegraph_printer, - File_writer_VRML_2> printer(out); + File_writer_VRML_2> printer(out.os()); printer(P); return out; From 7cf6a3bed05dcc88176b05743abc34276e77da79 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 26 Jan 2021 10:05:13 +0100 Subject: [PATCH 07/20] Fix VRML_2 logic --- BGL/include/CGAL/boost/graph/IO/WRL.h | 7 ++++--- Polyhedron/include/CGAL/IO/Polyhedron_VRML_2_ostream.h | 4 ++-- Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h | 6 +++--- Stream_support/include/CGAL/IO/polygon_soup_io.h | 3 --- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/IO/WRL.h b/BGL/include/CGAL/boost/graph/IO/WRL.h index c9d2f69b6b5..8f63b2e82ae 100644 --- a/BGL/include/CGAL/boost/graph/IO/WRL.h +++ b/BGL/include/CGAL/boost/graph/IO/WRL.h @@ -70,7 +70,8 @@ bool write_WRL(std::ostream& os, const Graph& g, const CGAL_BGL_NP_CLASS& np) { - IO::internal::Generic_facegraph_printer printer(os); + CGAL::VRML_2_ostream vos(os); + IO::internal::Generic_facegraph_printer printer(vos); return printer(g, np); } @@ -108,8 +109,8 @@ bool write_WRL(std::ostream& os, template bool write_WRL(const std::string& fname, const Graph& g, const CGAL_BGL_NP_CLASS& np) { - std::ifstream is(fname); - return write_WRL(is, g, np); + std::ofstream os(fname); + return write_WRL(os, g, np); } template diff --git a/Polyhedron/include/CGAL/IO/Polyhedron_VRML_2_ostream.h b/Polyhedron/include/CGAL/IO/Polyhedron_VRML_2_ostream.h index 5659c0c800f..618dc6c2959 100644 --- a/Polyhedron/include/CGAL/IO/Polyhedron_VRML_2_ostream.h +++ b/Polyhedron/include/CGAL/IO/Polyhedron_VRML_2_ostream.h @@ -28,9 +28,9 @@ template & P) { - IO::internal::Generic_facegraph_printer, - File_writer_VRML_2> printer(out.os()); + File_writer_VRML_2> printer(out); printer(P); return out; diff --git a/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h b/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h index 86f501a35df..6bc7249d1f5 100644 --- a/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h +++ b/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h @@ -37,15 +37,15 @@ public: std::ostream& out() const { return m_os.os(); } - void write_header(std::ostream& o, + void write_header(VRML_2_ostream& o, std::size_t vertices, std::size_t halfedges, std::size_t facets, const bool /*colors*/ = false, const bool /*normals*/ = false, - const bool /*textures*/ = false) + const bool /*te xtures*/ = false) { - m_os = VRML_2_ostream(o); + m_os = o; m_facets = facets; out() << " #-- Begin of Polygon Mesh\n"; diff --git a/Stream_support/include/CGAL/IO/polygon_soup_io.h b/Stream_support/include/CGAL/IO/polygon_soup_io.h index c5814f34be1..718e95f317a 100644 --- a/Stream_support/include/CGAL/IO/polygon_soup_io.h +++ b/Stream_support/include/CGAL/IO/polygon_soup_io.h @@ -18,12 +18,9 @@ #include #include #include -// #include #include #include -// #include #include -// #include #include #include From 19a10eddfce84f93bf2db3d1c171a449abb9c667 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 26 Jan 2021 10:40:06 +0100 Subject: [PATCH 08/20] add missing overloads --- BGL/include/CGAL/boost/graph/IO/OFF.h | 23 +++++++++++++++++++++++ BGL/include/CGAL/boost/graph/IO/VTK.h | 6 ++++++ BGL/include/CGAL/boost/graph/IO/WRL.h | 6 ++++++ BGL/test/BGL/test_deprecated_io.cpp | 14 +++++++------- 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/IO/OFF.h b/BGL/include/CGAL/boost/graph/IO/OFF.h index 507bc04467d..a3bee6c7d13 100644 --- a/BGL/include/CGAL/boost/graph/IO/OFF.h +++ b/BGL/include/CGAL/boost/graph/IO/OFF.h @@ -300,6 +300,19 @@ CGAL_DEPRECATED bool read_off(const char* fname, Graph& g, const CGAL_BGL_NP_CLA return read_OFF(fname, g, np); } + +template +CGAL_DEPRECATED bool read_off(std::istream& is, Graph& g) +{ + return read_off(is, g, parameters::all_default()); +} + +template +CGAL_DEPRECATED bool read_off(const char* fname, Graph& g) +{ + return read_off(fname, g, parameters::all_default()); +} + #endif // CGAL_NO_DEPRECATED_CODE //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -510,6 +523,11 @@ CGAL_DEPRECATED bool write_off(std::ostream& os, const Graph& g, const CGAL_BGL_ return write_OFF(os, g, np); } +template +CGAL_DEPRECATED bool write_off(std::ostream& os, const Graph& g) +{ + return write_off(os, g, CGAL::parameters::all_default()); +} /*! \ingroup PkgBGLIOFctDeprecated @@ -521,6 +539,11 @@ CGAL_DEPRECATED bool write_off(const char* fname, const Graph& g, const CGAL_BGL return write_OFF(fname, g, np); } +template +CGAL_DEPRECATED bool write_off(const char* fname, const Graph& g) +{ + return write_off(fname, g, parameters::all_default()); +} #endif // CGAL_NO_DEPRECATED_CODE } // namespace CGAL diff --git a/BGL/include/CGAL/boost/graph/IO/VTK.h b/BGL/include/CGAL/boost/graph/IO/VTK.h index 1ba37f19d6c..4715e954ea3 100644 --- a/BGL/include/CGAL/boost/graph/IO/VTK.h +++ b/BGL/include/CGAL/boost/graph/IO/VTK.h @@ -564,6 +564,12 @@ CGAL_DEPRECATED bool write_vtp(std::ostream& os, const Graph& g, const CGAL_BGL_ return write_VTP(os, g, np); } +template +CGAL_DEPRECATED bool write_vtp(std::ostream& os, const Graph& g) +{ + return write_vtp(os, g, parameters::all_default()); +} + #endif // CGAL_NO_DEPRECATED_CODE } // namespace CGAL diff --git a/BGL/include/CGAL/boost/graph/IO/WRL.h b/BGL/include/CGAL/boost/graph/IO/WRL.h index 8f63b2e82ae..40b5af310c9 100644 --- a/BGL/include/CGAL/boost/graph/IO/WRL.h +++ b/BGL/include/CGAL/boost/graph/IO/WRL.h @@ -131,6 +131,12 @@ CGAL_DEPRECATED bool write_wrl(std::ostream& os, const Graph& g, const CGAL_BGL_ return write_WRL(os, g, np); } +template +CGAL_DEPRECATED bool write_wrl(std::ostream& os, const Graph& g) +{ + return write_wrl(os, g, parameters::all_default()); +} + #endif // CGAL_NO_DEPRECATED_CODE } // namespace CGAL diff --git a/BGL/test/BGL/test_deprecated_io.cpp b/BGL/test/BGL/test_deprecated_io.cpp index e66247ffc1b..5bd037191cc 100644 --- a/BGL/test/BGL/test_deprecated_io.cpp +++ b/BGL/test/BGL/test_deprecated_io.cpp @@ -20,19 +20,19 @@ int main() SM sm_in, sm_out; Point_3 p0(0,0,0), p1(1,0,0), p2(0,1,0); CGAL::make_triangle(p0, p1, p2, sm_out); - bool ok = CGAL::write_off("tmp.off", sm_out, CGAL::parameters::all_default()); + bool ok = CGAL::write_off("tmp.off", sm_out); assert(ok); - ok = CGAL::read_off("tmp.off", sm_in, CGAL::parameters::all_default()); + ok = CGAL::read_off("tmp.off", sm_in); assert(ok); assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); sm_in.clear(); std::ofstream os("tmp.off"); - ok = CGAL::write_off(os, sm_out, CGAL::parameters::all_default()); + ok = CGAL::write_off(os, sm_out); assert(ok); os.close(); std::ifstream is("tmp.off"); - ok = CGAL::read_off(is, sm_in, CGAL::parameters::all_default()); + ok = CGAL::read_off(is, sm_in); assert(ok); assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); is.close(); @@ -40,18 +40,18 @@ int main() #ifdef CGAL_USE_VTK //vtk os.open("tmp.vtp"); - ok = CGAL::write_vtp(os, sm_out, CGAL::parameters::all_default()); + ok = CGAL::write_vtp(os, sm_out); assert(ok); os.close(); - ok = CGAL::read_VTP("tmp.vtp", sm_in, CGAL::parameters::all_default()); + ok = CGAL::read_VTP("tmp.vtp", sm_in); assert(ok); assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1); sm_in.clear(); #endif //wrl os.open("tmp.wrl"); - ok = CGAL::write_wrl(os, sm_out, CGAL::parameters::all_default()); + ok = CGAL::write_wrl(os, sm_out); assert(ok); os.close(); return EXIT_SUCCESS; From 41c823c08344c764c723976985e4ed97488477eb Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 27 Jan 2021 15:36:23 +0100 Subject: [PATCH 09/20] replace default value of stream precision --- BGL/include/CGAL/boost/graph/IO/GOCAD.h | 17 +++++++++++++---- .../boost/graph/IO/Generic_facegraph_printer.h | 9 +++++++-- BGL/include/CGAL/boost/graph/IO/OBJ.h | 10 +++++++++- BGL/include/CGAL/boost/graph/IO/OFF.h | 5 ++++- BGL/include/CGAL/boost/graph/IO/PLY.h | 13 ++++++++++--- BGL/include/CGAL/boost/graph/IO/STL.h | 13 ++++++++++--- BGL/include/CGAL/boost/graph/IO/VTK.h | 16 ++++++++++++---- BGL/include/CGAL/boost/graph/IO/WRL.h | 5 ++++- Point_set_3/include/CGAL/Point_set_3/IO/OFF.h | 2 +- Point_set_3/include/CGAL/Point_set_3/IO/PLY.h | 13 ++++++++++--- Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h | 5 ++++- .../include/CGAL/IO/write_off_points.h | 12 +++++++++--- .../include/CGAL/IO/write_ply_points.h | 13 ++++++++++--- .../include/CGAL/IO/write_xyz_points.h | 14 +++++++++++--- Stream_support/include/CGAL/IO/GOCAD.h | 13 ++++++++++--- Stream_support/include/CGAL/IO/Generic_writer.h | 8 ++++++-- Stream_support/include/CGAL/IO/OBJ.h | 6 +++++- Stream_support/include/CGAL/IO/OFF.h | 6 +++++- Stream_support/include/CGAL/IO/PLY.h | 13 ++++++++++--- Stream_support/include/CGAL/IO/STL.h | 13 ++++++++++--- Stream_support/include/CGAL/IO/VTK.h | 13 ++++++++++--- Surface_mesh/include/CGAL/Surface_mesh/IO/OFF.h | 2 +- Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h | 10 +++++++--- 23 files changed, 178 insertions(+), 53 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/IO/GOCAD.h b/BGL/include/CGAL/boost/graph/IO/GOCAD.h index 25cdf0ce780..9b58a78b75e 100644 --- a/BGL/include/CGAL/boost/graph/IO/GOCAD.h +++ b/BGL/include/CGAL/boost/graph/IO/GOCAD.h @@ -271,7 +271,7 @@ bool read_GOCAD(const std::string& fname, Graph& g, /// \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`} +/// \cgalParamDefault{`the precision of the given stream`} /// \cgalParamNEnd /// \cgalNamedParamsEnd /// @@ -303,8 +303,12 @@ bool write_GOCAD(std::ostream& os, if(!os.good()) return false; - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); + os.precision(precision); + } os << "GOCAD TSurf 1\n" "HEADER {\n" @@ -380,7 +384,7 @@ bool write_GOCAD(std::ostream& os, const char* name, const Graph& g, /// \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`} +/// \cgalParamDefault{`the precision of the given stream`} /// \cgalParamNEnd /// \cgalNamedParamsEnd /// @@ -454,6 +458,11 @@ bool write_GOCAD(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); + if(parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + os.precision(6); + + return write_GOCAD(os, fname.c_str(), g, np); } diff --git a/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_printer.h b/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_printer.h index 4ab13c13192..08b6c69c84b 100644 --- a/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_printer.h +++ b/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_printer.h @@ -117,8 +117,13 @@ public: if(!m_os.good()) return false; - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - m_os.precision(precision); + if(!CGAL::parameters::is_default_parameter( + get_parameter(np, internal_np::stream_precision))) + { + const int precision = choose_parameter( + get_parameter(np, internal_np::stream_precision), 6); + m_os.precision(precision); + } VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, g)); diff --git a/BGL/include/CGAL/boost/graph/IO/OBJ.h b/BGL/include/CGAL/boost/graph/IO/OBJ.h index 8e1c9b5ea89..cc44fb1ef32 100644 --- a/BGL/include/CGAL/boost/graph/IO/OBJ.h +++ b/BGL/include/CGAL/boost/graph/IO/OBJ.h @@ -231,7 +231,7 @@ bool read_OBJ(const std::string& fname, Graph& g, \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`} + \cgalParamDefault{`the precision of the given stream`} \cgalParamNEnd \cgalNamedParamsEnd @@ -285,6 +285,11 @@ bool write_OBJ(std::ostream& os, const 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 \returns `true` if writing was successful, `false` otherwise. @@ -303,6 +308,9 @@ bool write_OBJ(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); + if(parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + os.precision(6); return write_OBJ(os, g, np); } diff --git a/BGL/include/CGAL/boost/graph/IO/OFF.h b/BGL/include/CGAL/boost/graph/IO/OFF.h index a3bee6c7d13..3219385eced 100644 --- a/BGL/include/CGAL/boost/graph/IO/OFF.h +++ b/BGL/include/CGAL/boost/graph/IO/OFF.h @@ -387,7 +387,7 @@ bool write_OFF_BGL(std::ostream& os, \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`} + \cgalParamDefault{`the precision of the given stream`} \cgalParamNEnd \cgalNamedParamsEnd @@ -496,6 +496,9 @@ bool write_OFF(const std::string& fname, std::cerr<<"Could not create file."; return false; } + if(parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + os.precision(6); return write_OFF(os, g, np); } diff --git a/BGL/include/CGAL/boost/graph/IO/PLY.h b/BGL/include/CGAL/boost/graph/IO/PLY.h index ff65a977f7b..1eb6e6781b8 100644 --- a/BGL/include/CGAL/boost/graph/IO/PLY.h +++ b/BGL/include/CGAL/boost/graph/IO/PLY.h @@ -311,7 +311,7 @@ bool read_PLY(const std::string& fname, Graph& g, \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`} + \cgalParamDefault{`the precision of the given stream`} \cgalParamExtra{This parameter is only meaningful while using ASCII encoding.} \cgalParamNEnd \cgalNamedParamsEnd @@ -361,8 +361,12 @@ bool write_PLY(std::ostream& os, if(!os.good()) return false; - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); + os.precision(precision); + } // Write header os << "ply" << std::endl @@ -550,6 +554,9 @@ bool write_PLY(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); + if(parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + os.precision(6); return write_PLY(os, g, comments, np); } } diff --git a/BGL/include/CGAL/boost/graph/IO/STL.h b/BGL/include/CGAL/boost/graph/IO/STL.h index de10a9a95a5..96e786c82ff 100644 --- a/BGL/include/CGAL/boost/graph/IO/STL.h +++ b/BGL/include/CGAL/boost/graph/IO/STL.h @@ -231,7 +231,7 @@ bool read_STL(const std::string& fname, Graph& g) { return read_STL(fname, g, pa \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`} + \cgalParamDefault{`the precision of the given stream`} \cgalParamExtra{This parameter is only meaningful while using ASCII encoding.} \cgalParamNEnd \cgalNamedParamsEnd @@ -262,8 +262,12 @@ bool write_STL(std::ostream& os, if(!os.good()) return false; - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); + os.precision(precision); + } if(get_mode(os) == IO::BINARY) { @@ -372,6 +376,9 @@ bool write_STL(const std::string& fname, const Graph& g, const CGAL_BGL_NP_CLASS { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); + if(parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + os.precision(6); return write_STL(os, g, np); } } diff --git a/BGL/include/CGAL/boost/graph/IO/VTK.h b/BGL/include/CGAL/boost/graph/IO/VTK.h index 4715e954ea3..496a82a1737 100644 --- a/BGL/include/CGAL/boost/graph/IO/VTK.h +++ b/BGL/include/CGAL/boost/graph/IO/VTK.h @@ -420,7 +420,7 @@ void write_polys_points(std::ostream& os, * \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`} + * \cgalParamDefault{`the precision of the given stream`} * \cgalParamNEnd * \cgalNamedParamsEnd * @@ -439,8 +439,12 @@ bool write_VTP(std::ostream& os, if(!os.good()) return false; - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); + os.precision(precision); + } os << "\n" << " bool write_WRL(const std::string& fname, const Graph& g, const CGAL_BGL_NP_CLASS& np) { std::ofstream os(fname); + if(parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + os.precision(6); return write_WRL(os, g, np); } diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/OFF.h b/Point_set_3/include/CGAL/Point_set_3/IO/OFF.h index 5425fbfa4b9..fbeda69c4fc 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/OFF.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/OFF.h @@ -134,7 +134,7 @@ CGAL_DEPRECATED bool read_off_point_set(std::istream& is, ///< input stream. \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`} + \cgalParamDefault{`the precision of the given stream`} \cgalParamNEnd \cgalNamedParamsEnd diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h b/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h index 1e60eac251f..50dd0f026c4 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h @@ -456,7 +456,7 @@ CGAL_DEPRECATED bool read_ply_point_set(std::istream& is, ///< input stream. \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`} + \cgalParamDefault{`the precision of the given stream`} \cgalParamExtra{This parameter is only meaningful while using ASCII encoding.} \cgalParamNEnd \cgalNamedParamsEnd @@ -493,8 +493,12 @@ bool write_PLY(std::ostream& os, return false; } - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); + os.precision(precision); + } os << "ply" << std::endl << ((get_mode(os) == IO::BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl @@ -756,6 +760,9 @@ bool write_PLY(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); + if(parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + os.precision(6); return write_PLY(os, point_set, comments, np); } } diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h b/Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h index 4f5ba04a550..24648b4cf98 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h @@ -132,7 +132,7 @@ CGAL_DEPRECATED bool read_xyz_point_set(std::istream& is, CGAL::Point_set_3& point_set, const CGAL_BGL_NP_CLASS& np) { std::ofstream os(fname); + if(parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + os.precision(6); return write_XYZ(os, point_set, np); } diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index c35a500f705..e843e770de0 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -66,8 +66,12 @@ bool write_OFF_PSP(std::ostream& os, return false; } - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); + os.precision(precision); + } // Write header os << "NOFF" << std::endl; @@ -125,7 +129,7 @@ bool write_OFF_PSP(std::ostream& os, \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`} + \cgalParamDefault{`the precision of the given stream`} \cgalParamNEnd \cgalNamedParamsEnd @@ -208,6 +212,8 @@ bool write_OFF(const std::string& filename, ) { std::ofstream os(filename); + if(parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) return write_OFF(os, points, np); } diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index f4264d4e322..b28cc04f1a3 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -175,7 +175,7 @@ template writer(os); return writer(points, polygons, np); } diff --git a/Stream_support/include/CGAL/IO/PLY.h b/Stream_support/include/CGAL/IO/PLY.h index dc6518096ca..1c444a60ca5 100644 --- a/Stream_support/include/CGAL/IO/PLY.h +++ b/Stream_support/include/CGAL/IO/PLY.h @@ -444,7 +444,7 @@ bool read_PLY(const std::string& fname, PointRange& points, PolygonRange& polygo * \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`} + * \cgalParamDefault{`the precision of the given stream`} * \cgalParamExtra{This parameter is only meaningful while using ASCII encoding.} * \cgalParamNEnd * \cgalNamedParamsEnd @@ -467,8 +467,12 @@ bool write_PLY(std::ostream& out, if(!out.good()) return false; - const int precision = parameters::choose_parameter(parameters::get_parameter(np, internal_np::stream_precision), 6); - out.precision(precision); + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); + out.precision(precision); + } // Write header out << "ply" << std::endl @@ -563,6 +567,9 @@ bool write_PLY(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); + if(parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + os.precision(6); return write_PLY(os, points, polygons, np); } } diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index 6865fd03464..738d87a2eb0 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -284,7 +284,7 @@ bool read_STL(const std::string& fname, PointRange& points, TriangleRange& facet * \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`} + * \cgalParamDefault{`the precision of the given stream`} * \cgalParamExtra{This parameter is only meaningful while using ASCII encoding.} * \cgalParamNEnd * \cgalNamedParamsEnd @@ -317,8 +317,12 @@ bool write_STL(std::ostream& os, if(!os.good()) return false; - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); + os.precision(precision); + } if(get_mode(os) == IO::BINARY) { @@ -433,6 +437,9 @@ bool write_STL(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); + if(parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + os.precision(6); return write_STL(os, points, facets, np); } } diff --git a/Stream_support/include/CGAL/IO/VTK.h b/Stream_support/include/CGAL/IO/VTK.h index 0723baceadd..f5041748cab 100644 --- a/Stream_support/include/CGAL/IO/VTK.h +++ b/Stream_support/include/CGAL/IO/VTK.h @@ -373,7 +373,7 @@ void write_soup_polys_points(std::ostream& os, * \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`} + * \cgalParamDefault{`the precision of the given stream`} * \cgalParamNEnd * \cgalNamedParamsEnd * @@ -393,8 +393,12 @@ bool write_VTP(std::ostream& os, if(!os.good()) return false; - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); + os.precision(precision); + } os << "\n" << "& sm, std::string /// \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`} +/// \cgalParamDefault{`the precision of the given stream`} /// \cgalParamExtra{This parameter is only meaningful while using ASCII encoding.} /// \cgalParamNEnd /// \cgalNamedParamsEnd @@ -921,8 +921,12 @@ bool write_PLY(std::ostream& os, if(!os.good()) return false; - const int precision = parameters::choose_parameter(parameters::get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = parameters::choose_parameter(parameters::get_parameter(np, internal_np::stream_precision), 6); + os.precision(precision); + } os << "ply" << std::endl << ((get_mode(os) == IO::BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl From 2d59464b2b7e7f8df06256b0fb89cae571012272 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 27 Jan 2021 15:49:42 +0100 Subject: [PATCH 10/20] remove os.precision(6) as it is the default. --- BGL/include/CGAL/boost/graph/IO/GOCAD.h | 3 --- BGL/include/CGAL/boost/graph/IO/OBJ.h | 3 --- BGL/include/CGAL/boost/graph/IO/OFF.h | 4 +--- BGL/include/CGAL/boost/graph/IO/PLY.h | 4 +--- BGL/include/CGAL/boost/graph/IO/STL.h | 4 +--- BGL/include/CGAL/boost/graph/IO/VTK.h | 7 ++----- BGL/include/CGAL/boost/graph/IO/WRL.h | 3 --- Point_set_3/include/CGAL/Point_set_3/IO/PLY.h | 3 --- Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h | 3 --- Point_set_processing_3/include/CGAL/IO/write_ply_points.h | 3 --- Point_set_processing_3/include/CGAL/IO/write_xyz_points.h | 3 --- Stream_support/include/CGAL/IO/GOCAD.h | 3 --- Stream_support/include/CGAL/IO/OBJ.h | 3 --- Stream_support/include/CGAL/IO/OFF.h | 3 --- Stream_support/include/CGAL/IO/PLY.h | 3 --- Stream_support/include/CGAL/IO/STL.h | 3 --- Stream_support/include/CGAL/IO/VTK.h | 3 --- 17 files changed, 5 insertions(+), 53 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/IO/GOCAD.h b/BGL/include/CGAL/boost/graph/IO/GOCAD.h index 9b58a78b75e..0c0692b5b6f 100644 --- a/BGL/include/CGAL/boost/graph/IO/GOCAD.h +++ b/BGL/include/CGAL/boost/graph/IO/GOCAD.h @@ -458,9 +458,6 @@ bool write_GOCAD(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); return write_GOCAD(os, fname.c_str(), g, np); diff --git a/BGL/include/CGAL/boost/graph/IO/OBJ.h b/BGL/include/CGAL/boost/graph/IO/OBJ.h index cc44fb1ef32..7ab9cbd29d4 100644 --- a/BGL/include/CGAL/boost/graph/IO/OBJ.h +++ b/BGL/include/CGAL/boost/graph/IO/OBJ.h @@ -308,9 +308,6 @@ bool write_OBJ(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); return write_OBJ(os, g, np); } diff --git a/BGL/include/CGAL/boost/graph/IO/OFF.h b/BGL/include/CGAL/boost/graph/IO/OFF.h index 3219385eced..6ea0f68a6b9 100644 --- a/BGL/include/CGAL/boost/graph/IO/OFF.h +++ b/BGL/include/CGAL/boost/graph/IO/OFF.h @@ -496,9 +496,7 @@ bool write_OFF(const std::string& fname, std::cerr<<"Could not create file."; return false; } - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); + return write_OFF(os, g, np); } diff --git a/BGL/include/CGAL/boost/graph/IO/PLY.h b/BGL/include/CGAL/boost/graph/IO/PLY.h index 1eb6e6781b8..667fed4672a 100644 --- a/BGL/include/CGAL/boost/graph/IO/PLY.h +++ b/BGL/include/CGAL/boost/graph/IO/PLY.h @@ -554,9 +554,7 @@ bool write_PLY(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); + return write_PLY(os, g, comments, np); } } diff --git a/BGL/include/CGAL/boost/graph/IO/STL.h b/BGL/include/CGAL/boost/graph/IO/STL.h index 96e786c82ff..4ab8df78ab0 100644 --- a/BGL/include/CGAL/boost/graph/IO/STL.h +++ b/BGL/include/CGAL/boost/graph/IO/STL.h @@ -376,9 +376,7 @@ bool write_STL(const std::string& fname, const Graph& g, const CGAL_BGL_NP_CLASS { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); + return write_STL(os, g, np); } } diff --git a/BGL/include/CGAL/boost/graph/IO/VTK.h b/BGL/include/CGAL/boost/graph/IO/VTK.h index 496a82a1737..ab3ed3c02cb 100644 --- a/BGL/include/CGAL/boost/graph/IO/VTK.h +++ b/BGL/include/CGAL/boost/graph/IO/VTK.h @@ -541,12 +541,9 @@ bool write_VTP(const std::string& fname, const Graph& g, const CGAL_BGL_NP_CLASS os.open(fname, std::ios::binary); CGAL::set_mode(os, CGAL::IO::BINARY); } - else{ - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); + else os.open(fname); - } + return write_VTP(os, g, np); } diff --git a/BGL/include/CGAL/boost/graph/IO/WRL.h b/BGL/include/CGAL/boost/graph/IO/WRL.h index 595e45bb3bf..2506f1ab8e8 100644 --- a/BGL/include/CGAL/boost/graph/IO/WRL.h +++ b/BGL/include/CGAL/boost/graph/IO/WRL.h @@ -110,9 +110,6 @@ template bool write_WRL(const std::string& fname, const Graph& g, const CGAL_BGL_NP_CLASS& np) { std::ofstream os(fname); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); return write_WRL(os, g, np); } diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h b/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h index 50dd0f026c4..0d5e13db927 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h @@ -760,9 +760,6 @@ bool write_PLY(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); return write_PLY(os, point_set, comments, np); } } diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h b/Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h index 24648b4cf98..fee680c1e50 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h @@ -190,9 +190,6 @@ template & point_set, const CGAL_BGL_NP_CLASS& np) { std::ofstream os(fname); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); return write_XYZ(os, point_set, np); } diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index b28cc04f1a3..e4c573ec0af 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -308,9 +308,6 @@ bool write_PLY(const std::string& filename, { std::ofstream os(filename); CGAL::set_mode(os, CGAL::IO::ASCII); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); return write_PLY(os, points, np); } } diff --git a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h index 9634455b192..b726dd5bac1 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h @@ -206,9 +206,6 @@ bool write_XYZ(const std::string& filename, ) { std::ofstream os(filename); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); return write_XYZ(os, points, np); } diff --git a/Stream_support/include/CGAL/IO/GOCAD.h b/Stream_support/include/CGAL/IO/GOCAD.h index 6070f471081..09e90e26949 100644 --- a/Stream_support/include/CGAL/IO/GOCAD.h +++ b/Stream_support/include/CGAL/IO/GOCAD.h @@ -434,9 +434,6 @@ bool write_GOCAD(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); return IO::internal::write_GOCAD(os, fname.c_str(), points, polygons, np); } diff --git a/Stream_support/include/CGAL/IO/OBJ.h b/Stream_support/include/CGAL/IO/OBJ.h index 794e6b8e077..8e472d0657a 100644 --- a/Stream_support/include/CGAL/IO/OBJ.h +++ b/Stream_support/include/CGAL/IO/OBJ.h @@ -393,9 +393,6 @@ bool write_OBJ(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); return write_OBJ(os, points, polygons, np); } diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index fad93a7f7ba..654a933b562 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -367,9 +367,6 @@ bool write_OFF(const std::string& fname, ) { std::ofstream os(fname); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); Generic_writer writer(os); return writer(points, polygons, np); diff --git a/Stream_support/include/CGAL/IO/PLY.h b/Stream_support/include/CGAL/IO/PLY.h index 1c444a60ca5..e3fb7d356e8 100644 --- a/Stream_support/include/CGAL/IO/PLY.h +++ b/Stream_support/include/CGAL/IO/PLY.h @@ -567,9 +567,6 @@ bool write_PLY(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); return write_PLY(os, points, polygons, np); } } diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index 738d87a2eb0..4e5c082b24e 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -437,9 +437,6 @@ bool write_STL(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); return write_STL(os, points, facets, np); } } diff --git a/Stream_support/include/CGAL/IO/VTK.h b/Stream_support/include/CGAL/IO/VTK.h index f5041748cab..304078d2939 100644 --- a/Stream_support/include/CGAL/IO/VTK.h +++ b/Stream_support/include/CGAL/IO/VTK.h @@ -499,9 +499,6 @@ bool write_VTP(const std::string& fname, { std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - os.precision(6); return write_VTP(os, points, polygons, np); } } From 7bf9c14f721f476694abfa9d3fc3cfc48581894c Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 28 Jan 2021 10:01:52 +0100 Subject: [PATCH 11/20] Factorization --- BGL/include/CGAL/boost/graph/IO/GOCAD.h | 9 ++------- .../CGAL/boost/graph/IO/Generic_facegraph_printer.h | 8 +------- BGL/include/CGAL/boost/graph/IO/PLY.h | 7 +------ BGL/include/CGAL/boost/graph/IO/STL.h | 7 +------ BGL/include/CGAL/boost/graph/IO/VTK.h | 7 +------ BGL/include/CGAL/boost/graph/named_params_helper.h | 12 ++++++++++++ Point_set_3/include/CGAL/Point_set_3/IO/PLY.h | 7 +------ .../include/CGAL/IO/write_off_points.h | 7 +------ .../include/CGAL/IO/write_ply_points.h | 7 +------ .../include/CGAL/IO/write_xyz_points.h | 7 +------ Stream_support/include/CGAL/IO/GOCAD.h | 7 +------ Stream_support/include/CGAL/IO/Generic_writer.h | 7 +------ Stream_support/include/CGAL/IO/PLY.h | 8 ++------ Stream_support/include/CGAL/IO/STL.h | 7 +------ Stream_support/include/CGAL/IO/VTK.h | 9 +++------ Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h | 7 +------ 16 files changed, 31 insertions(+), 92 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/IO/GOCAD.h b/BGL/include/CGAL/boost/graph/IO/GOCAD.h index 0c0692b5b6f..ac5ea9957c0 100644 --- a/BGL/include/CGAL/boost/graph/IO/GOCAD.h +++ b/BGL/include/CGAL/boost/graph/IO/GOCAD.h @@ -18,7 +18,7 @@ #include #include #include - +#include #include #include @@ -303,12 +303,7 @@ bool write_GOCAD(std::ostream& os, if(!os.good()) return false; - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); - } + set_default_stream_precision(os, np); os << "GOCAD TSurf 1\n" "HEADER {\n" diff --git a/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_printer.h b/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_printer.h index 08b6c69c84b..53709564546 100644 --- a/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_printer.h +++ b/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_printer.h @@ -117,13 +117,7 @@ public: if(!m_os.good()) return false; - if(!CGAL::parameters::is_default_parameter( - get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter( - get_parameter(np, internal_np::stream_precision), 6); - m_os.precision(precision); - } + set_default_stream_precision(m_os, np); VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, g)); diff --git a/BGL/include/CGAL/boost/graph/IO/PLY.h b/BGL/include/CGAL/boost/graph/IO/PLY.h index 667fed4672a..6ad32267952 100644 --- a/BGL/include/CGAL/boost/graph/IO/PLY.h +++ b/BGL/include/CGAL/boost/graph/IO/PLY.h @@ -361,12 +361,7 @@ bool write_PLY(std::ostream& os, if(!os.good()) return false; - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); - } + set_default_stream_precision(os, np); // Write header os << "ply" << std::endl diff --git a/BGL/include/CGAL/boost/graph/IO/STL.h b/BGL/include/CGAL/boost/graph/IO/STL.h index 4ab8df78ab0..11005c1dfb4 100644 --- a/BGL/include/CGAL/boost/graph/IO/STL.h +++ b/BGL/include/CGAL/boost/graph/IO/STL.h @@ -262,12 +262,7 @@ bool write_STL(std::ostream& os, if(!os.good()) return false; - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); - } + set_default_stream_precision(os, np); if(get_mode(os) == IO::BINARY) { diff --git a/BGL/include/CGAL/boost/graph/IO/VTK.h b/BGL/include/CGAL/boost/graph/IO/VTK.h index ab3ed3c02cb..a62f3e1cb91 100644 --- a/BGL/include/CGAL/boost/graph/IO/VTK.h +++ b/BGL/include/CGAL/boost/graph/IO/VTK.h @@ -439,12 +439,7 @@ bool write_VTP(std::ostream& os, if(!os.good()) return false; - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); - } + set_default_stream_precision(os, np); os << "\n" << "::fa Alpha_expansion_boost_adjacency_list_tag >::type type; }; + + template + void set_default_stream_precision(std::ostream& os, const NP& np) + { + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::stream_precision)); + os.precision(precision); + } + } } //namespace CGAL diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h b/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h index 0d5e13db927..ae2d6ad7fb7 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h @@ -493,12 +493,7 @@ bool write_PLY(std::ostream& os, return false; } - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); - } + set_default_stream_precision(os, np); os << "ply" << std::endl << ((get_mode(os) == IO::BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index e843e770de0..0f075981d0b 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -66,12 +66,7 @@ bool write_OFF_PSP(std::ostream& os, return false; } - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); - } + set_default_stream_precision(os, np); // Write header os << "NOFF" << std::endl; diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index e4c573ec0af..84e5442e810 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -212,12 +212,7 @@ bool write_PLY(std::ostream& os, return false; } - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); - } + set_default_stream_precision(os, np); if (has_normals) return write_PLY_with_properties(os, points, diff --git a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h index b726dd5bac1..2a4ef60d17b 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h @@ -67,12 +67,7 @@ bool write_XYZ_PSP(std::ostream& os, return false; } - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); - } + set_default_stream_precision(os, np); // Write positions + normals for(typename PointRange::const_iterator it = points.begin(); it != points.end(); it++) diff --git a/Stream_support/include/CGAL/IO/GOCAD.h b/Stream_support/include/CGAL/IO/GOCAD.h index 09e90e26949..2be6af7a0ad 100644 --- a/Stream_support/include/CGAL/IO/GOCAD.h +++ b/Stream_support/include/CGAL/IO/GOCAD.h @@ -299,12 +299,7 @@ bool write_GOCAD(std::ostream& os, set_ascii_mode(os); // GOCAD is ASCII only - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); - } + set_default_stream_precision(os, np); os << "GOCAD TSurf 1\n" "HEADER {\n" diff --git a/Stream_support/include/CGAL/IO/Generic_writer.h b/Stream_support/include/CGAL/IO/Generic_writer.h index 6b31a609014..c9700536edd 100644 --- a/Stream_support/include/CGAL/IO/Generic_writer.h +++ b/Stream_support/include/CGAL/IO/Generic_writer.h @@ -49,12 +49,7 @@ public: if(!m_os.good()) return false; - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - m_os.precision(precision); - } + set_default_stream_precision(m_os, np); m_writer.write_header(m_os, points.size(), 0, polygons.size()); for(std::size_t i=0, end=points.size(); i #include +#include #include #include @@ -467,12 +468,7 @@ bool write_PLY(std::ostream& out, if(!out.good()) return false; - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - out.precision(precision); - } + set_default_stream_precision(out, np); // Write header out << "ply" << std::endl diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index 4e5c082b24e..437d7f410bb 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -317,12 +317,7 @@ bool write_STL(std::ostream& os, if(!os.good()) return false; - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); - } + set_default_stream_precision(os, np); if(get_mode(os) == IO::BINARY) { diff --git a/Stream_support/include/CGAL/IO/VTK.h b/Stream_support/include/CGAL/IO/VTK.h index 304078d2939..76c13581d4e 100644 --- a/Stream_support/include/CGAL/IO/VTK.h +++ b/Stream_support/include/CGAL/IO/VTK.h @@ -19,6 +19,8 @@ #include #include +#include + #ifdef CGAL_USE_VTK #include @@ -393,12 +395,7 @@ bool write_VTP(std::ostream& os, if(!os.good()) return false; - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = choose_parameter(get_parameter(np, internal_np::stream_precision), 6); - os.precision(precision); - } + set_default_stream_precision(os, np); os << "\n" << " Date: Fri, 29 Jan 2021 09:28:51 +0100 Subject: [PATCH 12/20] Add missing overloads for set_default_stream_precision() --- Stream_support/include/CGAL/IO/OI/Inventor_ostream.h | 12 ++++++++++++ Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Stream_support/include/CGAL/IO/OI/Inventor_ostream.h b/Stream_support/include/CGAL/IO/OI/Inventor_ostream.h index 42d2cd78182..20f4f5d25c0 100644 --- a/Stream_support/include/CGAL/IO/OI/Inventor_ostream.h +++ b/Stream_support/include/CGAL/IO/OI/Inventor_ostream.h @@ -89,6 +89,18 @@ private: } }; +template +void set_default_stream_precision(Inventor_ostream_base& os, const NP& np) +{ + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::stream_precision)); + os.os().precision(precision); + } +} + } // namespace CGAL #endif // CGAL_IO_INVENTOR_OSTREAM_H diff --git a/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h b/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h index 1de37df3967..cb8ef7ecc47 100644 --- a/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h +++ b/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h @@ -104,6 +104,17 @@ inline VRML_2_ostream& operator<<(VRML_2_ostream& os, return os; } +template +void set_default_stream_precision(VRML_2_ostream& os, const NP& np) +{ + if(!parameters::is_default_parameter( + parameters::get_parameter(np, internal_np::stream_precision))) + { + const int precision = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::stream_precision)); + os.os().precision(precision); + } +} } // namespace CGAL #endif // CGAL_IO_VRML_2_OSTREAM_H @@ -315,4 +326,5 @@ operator<<(VRML_2_ostream& os, } //namespace CGAL #endif // CGAL_IO_VRML_VRML_2_SEGMENT_3 + #endif // CGAL_SPHERE_3_H From 91f8b4a09fe0bacd661c3621739fc6facca0a56e Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 29 Jan 2021 09:43:53 +0100 Subject: [PATCH 13/20] fix write_off_points() --- Point_set_processing_3/include/CGAL/IO/write_off_points.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index 0f075981d0b..0300012f350 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -207,8 +207,7 @@ bool write_OFF(const std::string& filename, ) { std::ofstream os(filename); - if(parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) + set_default_stream_precision(os, np); return write_OFF(os, points, np); } From 99d8d94631d4bf5981e0b500b91065118c276327 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 2 Feb 2021 09:36:38 +0100 Subject: [PATCH 14/20] add missing header --- Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h b/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h index cb8ef7ecc47..402bfb98220 100644 --- a/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h +++ b/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h @@ -21,6 +21,7 @@ #include #include +#include namespace CGAL { From 7f537a19cb2f3b05d6cdf7696e0b2ac1b22e3442 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 3 Feb 2021 08:59:54 +0100 Subject: [PATCH 15/20] add missing headers --- Stream_support/include/CGAL/IO/OBJ.h | 1 + Stream_support/include/CGAL/IO/OI/Inventor_ostream.h | 1 + 2 files changed, 2 insertions(+) diff --git a/Stream_support/include/CGAL/IO/OBJ.h b/Stream_support/include/CGAL/IO/OBJ.h index 8e472d0657a..701233fb3ac 100644 --- a/Stream_support/include/CGAL/IO/OBJ.h +++ b/Stream_support/include/CGAL/IO/OBJ.h @@ -23,6 +23,7 @@ #include #include +#include #include #include diff --git a/Stream_support/include/CGAL/IO/OI/Inventor_ostream.h b/Stream_support/include/CGAL/IO/OI/Inventor_ostream.h index 20f4f5d25c0..4d0d1e41e65 100644 --- a/Stream_support/include/CGAL/IO/OI/Inventor_ostream.h +++ b/Stream_support/include/CGAL/IO/OI/Inventor_ostream.h @@ -21,6 +21,7 @@ #include #include +#include // OpenInventor and VRML 1.0 are quite similar formats, so // output operators could be shared if they use the following From df50c4cd0a46ca06269c34f61b4944d301a872a9 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 3 Feb 2021 14:30:21 +0100 Subject: [PATCH 16/20] replace WARNING: with NOTE: to avoid confusing the testsuite --- Stream_support/include/CGAL/IO/OBJ.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Stream_support/include/CGAL/IO/OBJ.h b/Stream_support/include/CGAL/IO/OBJ.h index 701233fb3ac..b51c725e7c1 100644 --- a/Stream_support/include/CGAL/IO/OBJ.h +++ b/Stream_support/include/CGAL/IO/OBJ.h @@ -159,9 +159,9 @@ bool read_OBJ(std::istream& is, } if(norm_found && verbose) - std::cout<<"WARNING: normals were found in this file, but were discarded."< Date: Wed, 3 Feb 2021 15:40:58 +0100 Subject: [PATCH 17/20] Fix test psp --- .../Point_set_processing_3/test_deprecated_io_point_set.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp b/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp index 1327b5854ce..6c1be92bcc1 100644 --- a/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp +++ b/Point_set_processing_3/test/Point_set_processing_3/test_deprecated_io_point_set.cpp @@ -54,7 +54,7 @@ struct GetBlueMap{ }; unsigned short get(const GetBlueMap&, const PointWithColor& p) { - return p.second[3]; + return p.second[2]; } struct GetAlphaMap{ @@ -65,7 +65,7 @@ struct GetAlphaMap{ }; unsigned short get(const GetAlphaMap&, const PointWithColor& p) { - return p.second[4]; + return p.second[3]; } int main() From 2dac31f36f00394436c26651262e34a22b2cb1fd Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 5 Feb 2021 14:14:11 +0100 Subject: [PATCH 18/20] Clean-up and fix doc --- BGL/include/CGAL/boost/graph/IO/GOCAD.h | 5 ++--- .../CGAL/boost/graph/IO/Generic_facegraph_printer.h | 2 +- BGL/include/CGAL/boost/graph/IO/OBJ.h | 2 +- BGL/include/CGAL/boost/graph/IO/OFF.h | 3 +-- BGL/include/CGAL/boost/graph/IO/PLY.h | 4 ++-- BGL/include/CGAL/boost/graph/IO/STL.h | 4 ++-- BGL/include/CGAL/boost/graph/IO/VTK.h | 4 ++-- BGL/include/CGAL/boost/graph/IO/WRL.h | 2 +- BGL/include/CGAL/boost/graph/named_params_helper.h | 12 +++++++----- .../infrastructure/cgal.geometryfactory.com/crontab | 2 +- Point_set_3/include/CGAL/Point_set_3/IO/OFF.h | 2 +- Point_set_3/include/CGAL/Point_set_3/IO/PLY.h | 4 ++-- Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h | 2 +- .../include/CGAL/IO/write_off_points.h | 6 +++--- .../include/CGAL/IO/write_ply_points.h | 4 ++-- .../include/CGAL/IO/write_xyz_points.h | 5 ++--- Stream_support/include/CGAL/IO/GOCAD.h | 4 ++-- Stream_support/include/CGAL/IO/Generic_writer.h | 2 +- Stream_support/include/CGAL/IO/OBJ.h | 2 +- Stream_support/include/CGAL/IO/OFF.h | 3 +-- Stream_support/include/CGAL/IO/OI/Inventor_ostream.h | 10 ++-------- Stream_support/include/CGAL/IO/PLY.h | 4 ++-- Stream_support/include/CGAL/IO/STL.h | 4 ++-- .../include/CGAL/IO/VRML/File_writer_VRML_2.h | 3 +-- Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h | 10 ++-------- Stream_support/include/CGAL/IO/VTK.h | 5 ++--- Surface_mesh/include/CGAL/Surface_mesh/IO/OFF.h | 2 +- Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h | 4 ++-- 28 files changed, 50 insertions(+), 66 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/IO/GOCAD.h b/BGL/include/CGAL/boost/graph/IO/GOCAD.h index ac5ea9957c0..111bdc0ccfe 100644 --- a/BGL/include/CGAL/boost/graph/IO/GOCAD.h +++ b/BGL/include/CGAL/boost/graph/IO/GOCAD.h @@ -271,7 +271,7 @@ bool read_GOCAD(const std::string& fname, Graph& g, /// \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 given stream`} +/// \cgalParamDefault{`the precision of the stream `os``} /// \cgalParamNEnd /// \cgalNamedParamsEnd /// @@ -379,7 +379,7 @@ bool write_GOCAD(std::ostream& os, const char* name, const Graph& g, /// \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 given stream`} +/// \cgalParamDefault{`the precision of the stream `os``} /// \cgalParamNEnd /// \cgalNamedParamsEnd /// @@ -454,7 +454,6 @@ bool write_GOCAD(const std::string& fname, std::ofstream os(fname); CGAL::set_mode(os, CGAL::IO::ASCII); - return write_GOCAD(os, fname.c_str(), g, np); } diff --git a/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_printer.h b/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_printer.h index 53709564546..5fb75be5363 100644 --- a/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_printer.h +++ b/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_printer.h @@ -117,7 +117,7 @@ public: if(!m_os.good()) return false; - set_default_stream_precision(m_os, np); + set_stream_precision_from_NP(m_os, np); VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, g)); diff --git a/BGL/include/CGAL/boost/graph/IO/OBJ.h b/BGL/include/CGAL/boost/graph/IO/OBJ.h index 7ab9cbd29d4..7d733c9f8b4 100644 --- a/BGL/include/CGAL/boost/graph/IO/OBJ.h +++ b/BGL/include/CGAL/boost/graph/IO/OBJ.h @@ -231,7 +231,7 @@ bool read_OBJ(const std::string& fname, Graph& g, \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 given stream`} + \cgalParamDefault{`the precision of the stream `os``} \cgalParamNEnd \cgalNamedParamsEnd diff --git a/BGL/include/CGAL/boost/graph/IO/OFF.h b/BGL/include/CGAL/boost/graph/IO/OFF.h index 6ea0f68a6b9..57685046e79 100644 --- a/BGL/include/CGAL/boost/graph/IO/OFF.h +++ b/BGL/include/CGAL/boost/graph/IO/OFF.h @@ -300,7 +300,6 @@ CGAL_DEPRECATED bool read_off(const char* fname, Graph& g, const CGAL_BGL_NP_CLA return read_OFF(fname, g, np); } - template CGAL_DEPRECATED bool read_off(std::istream& is, Graph& g) { @@ -387,7 +386,7 @@ bool write_OFF_BGL(std::ostream& os, \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 given stream`} + \cgalParamDefault{`the precision of the stream `os``} \cgalParamNEnd \cgalNamedParamsEnd diff --git a/BGL/include/CGAL/boost/graph/IO/PLY.h b/BGL/include/CGAL/boost/graph/IO/PLY.h index 6ad32267952..c571c07d629 100644 --- a/BGL/include/CGAL/boost/graph/IO/PLY.h +++ b/BGL/include/CGAL/boost/graph/IO/PLY.h @@ -311,7 +311,7 @@ bool read_PLY(const std::string& fname, Graph& g, \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 given stream`} + \cgalParamDefault{`the precision of the stream `os``} \cgalParamExtra{This parameter is only meaningful while using ASCII encoding.} \cgalParamNEnd \cgalNamedParamsEnd @@ -361,7 +361,7 @@ bool write_PLY(std::ostream& os, if(!os.good()) return false; - set_default_stream_precision(os, np); + set_stream_precision_from_NP(os, np); // Write header os << "ply" << std::endl diff --git a/BGL/include/CGAL/boost/graph/IO/STL.h b/BGL/include/CGAL/boost/graph/IO/STL.h index 11005c1dfb4..78bd1fcb588 100644 --- a/BGL/include/CGAL/boost/graph/IO/STL.h +++ b/BGL/include/CGAL/boost/graph/IO/STL.h @@ -231,7 +231,7 @@ bool read_STL(const std::string& fname, Graph& g) { return read_STL(fname, g, pa \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 given stream`} + \cgalParamDefault{`the precision of the stream `os``} \cgalParamExtra{This parameter is only meaningful while using ASCII encoding.} \cgalParamNEnd \cgalNamedParamsEnd @@ -262,7 +262,7 @@ bool write_STL(std::ostream& os, if(!os.good()) return false; - set_default_stream_precision(os, np); + set_stream_precision_from_NP(os, np); if(get_mode(os) == IO::BINARY) { diff --git a/BGL/include/CGAL/boost/graph/IO/VTK.h b/BGL/include/CGAL/boost/graph/IO/VTK.h index a62f3e1cb91..894b3598b09 100644 --- a/BGL/include/CGAL/boost/graph/IO/VTK.h +++ b/BGL/include/CGAL/boost/graph/IO/VTK.h @@ -420,7 +420,7 @@ void write_polys_points(std::ostream& os, * \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 given stream`} + * \cgalParamDefault{`the precision of the stream `os``} * \cgalParamNEnd * \cgalNamedParamsEnd * @@ -439,7 +439,7 @@ bool write_VTP(std::ostream& os, if(!os.good()) return false; - set_default_stream_precision(os, np); + set_stream_precision_from_NP(os, np); os << "\n" << "::fa }; template - void set_default_stream_precision(std::ostream& os, const NP& np) + void set_stream_precision_from_NP(std::ostream& os, const NP& np) { - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) + using parameters::get_parameter; + using parameters::choose_parameter; + + if(!is_default_parameter(get_parameter(np, internal_np::stream_precision))) { - const int precision = parameters::choose_parameter( - parameters::get_parameter(np, internal_np::stream_precision)); + const int precision = choose_parameter(get_parameter(np, + internal_np::stream_precision)); os.precision(precision); } } diff --git a/Maintenance/infrastructure/cgal.geometryfactory.com/crontab b/Maintenance/infrastructure/cgal.geometryfactory.com/crontab index 34829fff40e..c023da89fcf 100644 --- a/Maintenance/infrastructure/cgal.geometryfactory.com/crontab +++ b/Maintenance/infrastructure/cgal.geometryfactory.com/crontab @@ -67,7 +67,7 @@ LC_CTYPE=en_US.UTF-8 18 * * * * $HOME/bin/dump_crontab # Docker check every hour -#0 * * * * docker inspect --format='{{json .State.Health.Status}}' cgal-mediawiki-docker_wiki_1 | grep -q '"healthy"' || docker logs cgal-mediawiki-docker_wiki_1 +0 * * * * docker inspect --format='{{json .State.Health.Status}}' cgal-mediawiki-docker_wiki_1 | grep -q '"healthy"' || docker logs cgal-mediawiki-docker_wiki_1 # cgal->cgal2 with git-multimail */5 * * * * cd $HOME/Git/cgal-dev-pusher.git && $HOME/bin/git-fetch-and-push-to-multimail cgal-dev cgal-dev-receiver diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/OFF.h b/Point_set_3/include/CGAL/Point_set_3/IO/OFF.h index fbeda69c4fc..b8882c97fdc 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/OFF.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/OFF.h @@ -134,7 +134,7 @@ CGAL_DEPRECATED bool read_off_point_set(std::istream& is, ///< input stream. \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 given stream`} + \cgalParamDefault{`the precision of the stream `os``} \cgalParamNEnd \cgalNamedParamsEnd diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h b/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h index ae2d6ad7fb7..4646ffbd974 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/PLY.h @@ -456,7 +456,7 @@ CGAL_DEPRECATED bool read_ply_point_set(std::istream& is, ///< input stream. \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 given stream`} + \cgalParamDefault{`the precision of the stream `os``} \cgalParamExtra{This parameter is only meaningful while using ASCII encoding.} \cgalParamNEnd \cgalNamedParamsEnd @@ -493,7 +493,7 @@ bool write_PLY(std::ostream& os, return false; } - set_default_stream_precision(os, np); + set_stream_precision_from_NP(os, np); os << "ply" << std::endl << ((get_mode(os) == IO::BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h b/Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h index fee680c1e50..a7b243fc192 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/XYZ.h @@ -132,7 +132,7 @@ CGAL_DEPRECATED bool read_xyz_point_set(std::istream& is, CGAL::Point_set_3 writer(os); return writer(points, polygons, np); } diff --git a/Stream_support/include/CGAL/IO/OI/Inventor_ostream.h b/Stream_support/include/CGAL/IO/OI/Inventor_ostream.h index 4d0d1e41e65..45324fb7c7a 100644 --- a/Stream_support/include/CGAL/IO/OI/Inventor_ostream.h +++ b/Stream_support/include/CGAL/IO/OI/Inventor_ostream.h @@ -91,15 +91,9 @@ private: }; template -void set_default_stream_precision(Inventor_ostream_base& os, const NP& np) +void set_stream_precision_from_NP(Inventor_ostream_base& os, const NP& np) { - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = parameters::choose_parameter( - parameters::get_parameter(np, internal_np::stream_precision)); - os.os().precision(precision); - } + return set_stream_precision_from_NP(os.os(), np); } } // namespace CGAL diff --git a/Stream_support/include/CGAL/IO/PLY.h b/Stream_support/include/CGAL/IO/PLY.h index 0a9346159c2..bfcebbf8d7c 100644 --- a/Stream_support/include/CGAL/IO/PLY.h +++ b/Stream_support/include/CGAL/IO/PLY.h @@ -445,7 +445,7 @@ bool read_PLY(const std::string& fname, PointRange& points, PolygonRange& polygo * \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 given stream`} + * \cgalParamDefault{`the precision of the stream `os``} * \cgalParamExtra{This parameter is only meaningful while using ASCII encoding.} * \cgalParamNEnd * \cgalNamedParamsEnd @@ -468,7 +468,7 @@ bool write_PLY(std::ostream& out, if(!out.good()) return false; - set_default_stream_precision(out, np); + set_stream_precision_from_NP(out, np); // Write header out << "ply" << std::endl diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index 437d7f410bb..009e90b1ad4 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -284,7 +284,7 @@ bool read_STL(const std::string& fname, PointRange& points, TriangleRange& facet * \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 given stream`} + * \cgalParamDefault{`the precision of the stream `os``} * \cgalParamExtra{This parameter is only meaningful while using ASCII encoding.} * \cgalParamNEnd * \cgalNamedParamsEnd @@ -317,7 +317,7 @@ bool write_STL(std::ostream& os, if(!os.good()) return false; - set_default_stream_precision(os, np); + set_stream_precision_from_NP(os, np); if(get_mode(os) == IO::BINARY) { diff --git a/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h b/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h index 6bc7249d1f5..48e58fa64ec 100644 --- a/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h +++ b/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h @@ -28,7 +28,6 @@ namespace CGAL { class File_writer_VRML_2 { - VRML_2_ostream m_os; std::size_t m_facets; @@ -43,7 +42,7 @@ public: std::size_t facets, const bool /*colors*/ = false, const bool /*normals*/ = false, - const bool /*te xtures*/ = false) + const bool /*textures*/ = false) { m_os = o; m_facets = facets; diff --git a/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h b/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h index 402bfb98220..08e8fdd7e49 100644 --- a/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h +++ b/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h @@ -106,15 +106,9 @@ inline VRML_2_ostream& operator<<(VRML_2_ostream& os, } template -void set_default_stream_precision(VRML_2_ostream& os, const NP& np) +void set_stream_precision_from_NP(VRML_2_ostream& os, const NP& np) { - if(!parameters::is_default_parameter( - parameters::get_parameter(np, internal_np::stream_precision))) - { - const int precision = parameters::choose_parameter( - parameters::get_parameter(np, internal_np::stream_precision)); - os.os().precision(precision); - } + return set_stream_precision_from_NP(os.os(), np); } } // namespace CGAL diff --git a/Stream_support/include/CGAL/IO/VTK.h b/Stream_support/include/CGAL/IO/VTK.h index 76c13581d4e..d56dd2f0d11 100644 --- a/Stream_support/include/CGAL/IO/VTK.h +++ b/Stream_support/include/CGAL/IO/VTK.h @@ -21,7 +21,6 @@ #include #include - #ifdef CGAL_USE_VTK #include #include @@ -375,7 +374,7 @@ void write_soup_polys_points(std::ostream& os, * \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 given stream`} + * \cgalParamDefault{`the precision of the stream `os``} * \cgalParamNEnd * \cgalNamedParamsEnd * @@ -395,7 +394,7 @@ bool write_VTP(std::ostream& os, if(!os.good()) return false; - set_default_stream_precision(os, np); + set_stream_precision_from_NP(os, np); os << "\n" << "& sm, std::string /// \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 given stream`} +/// \cgalParamDefault{`the precision of the stream `os``} /// \cgalParamExtra{This parameter is only meaningful while using ASCII encoding.} /// \cgalParamNEnd /// \cgalNamedParamsEnd @@ -921,7 +921,7 @@ bool write_PLY(std::ostream& os, if(!os.good()) return false; - set_default_stream_precision(os, np); + set_stream_precision_from_NP(os, np); os << "ply" << std::endl << ((get_mode(os) == IO::BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl From cca6d7fa88dde89cb729cd23a2ecbb1c75969b2d Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 8 Feb 2021 09:06:57 +0100 Subject: [PATCH 19/20] add missing using --- BGL/include/CGAL/boost/graph/named_params_helper.h | 1 + 1 file changed, 1 insertion(+) diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 429b4be92e0..cc38868738d 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -566,6 +566,7 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa { using parameters::get_parameter; using parameters::choose_parameter; + using parameters::is_default_parameter; if(!is_default_parameter(get_parameter(np, internal_np::stream_precision))) { From e7197d89d23ace20d2a0412c0264f1f524ad8f49 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 8 Feb 2021 09:28:13 +0100 Subject: [PATCH 20/20] replace remaining wrong function call --- BGL/include/CGAL/boost/graph/IO/GOCAD.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BGL/include/CGAL/boost/graph/IO/GOCAD.h b/BGL/include/CGAL/boost/graph/IO/GOCAD.h index 111bdc0ccfe..966e4f4219d 100644 --- a/BGL/include/CGAL/boost/graph/IO/GOCAD.h +++ b/BGL/include/CGAL/boost/graph/IO/GOCAD.h @@ -303,7 +303,7 @@ bool write_GOCAD(std::ostream& os, if(!os.good()) return false; - set_default_stream_precision(os, np); + set_stream_precision_from_NP(os, np); os << "GOCAD TSurf 1\n" "HEADER {\n"