From 49f68654d6ef5b233e762fadb26579d071a07074 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 18 Jan 2021 11:48:04 +0100 Subject: [PATCH] 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";