diff --git a/Classification/examples/Classification/example_classification.cpp b/Classification/examples/Classification/example_classification.cpp index 2926a11fb854..b25e8c83bf55 100644 --- a/Classification/examples/Classification/example_classification.cpp +++ b/Classification/examples/Classification/example_classification.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include diff --git a/Frechet_distance/doc/Frechet_distance/Frechet_distance.txt b/Frechet_distance/doc/Frechet_distance/Frechet_distance.txt index 0220f74f354e..140593130a3a 100644 --- a/Frechet_distance/doc/Frechet_distance/Frechet_distance.txt +++ b/Frechet_distance/doc/Frechet_distance/Frechet_distance.txt @@ -123,11 +123,11 @@ In the example below, we can see a query where: -\subsection subsecFrechetDistanceImageCredits Image Credits +\section subsecFrechetDistanceImageCredits Image Credits The character image is a visualization of two data points from the Character Trajectories data set. -\subsection subsecFrechetDistanceImplementation Implementation History +\section subsecFrechetDistanceImplementation Implementation History An initial version using floating point arithmetic was developed by the authors while working at the Max-Planck Institute for Informatics in Saarbrücken, Germany. diff --git a/Kinetic_space_partition/package_info/Kinetic_space_partition/dependencies b/Kinetic_space_partition/package_info/Kinetic_space_partition/dependencies index 831b16749e83..7a6f506d3608 100644 --- a/Kinetic_space_partition/package_info/Kinetic_space_partition/dependencies +++ b/Kinetic_space_partition/package_info/Kinetic_space_partition/dependencies @@ -25,7 +25,6 @@ Modular_arithmetic Number_types Orthtree Point_set_3 -Point_set_processing_3 Polygon Polygon_mesh_processing Principal_component_analysis diff --git a/Kinetic_surface_reconstruction/package_info/Kinetic_surface_reconstruction/dependencies b/Kinetic_surface_reconstruction/package_info/Kinetic_surface_reconstruction/dependencies index a746754e7dcb..4848ee907f36 100644 --- a/Kinetic_surface_reconstruction/package_info/Kinetic_surface_reconstruction/dependencies +++ b/Kinetic_surface_reconstruction/package_info/Kinetic_surface_reconstruction/dependencies @@ -26,7 +26,6 @@ Modular_arithmetic Number_types Orthtree Point_set_3 -Point_set_processing_3 Polygon Polygon_mesh_processing Principal_component_analysis diff --git a/Point_set_3/doc/Point_set_3/Doxyfile.in b/Point_set_3/doc/Point_set_3/Doxyfile.in index 7b3039d16121..814f12c628d2 100644 --- a/Point_set_3/doc/Point_set_3/Doxyfile.in +++ b/Point_set_3/doc/Point_set_3/Doxyfile.in @@ -1,2 +1,7 @@ @INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS} PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 3D Point Set" + +EXTRACT_ALL = false +HIDE_UNDOC_MEMBERS = true +HIDE_UNDOC_CLASSES = true + diff --git a/Point_set_3/doc/Point_set_3/PackageDescription.txt b/Point_set_3/doc/Point_set_3/PackageDescription.txt index 8072d6cb02b4..84a20643ddc1 100644 --- a/Point_set_3/doc/Point_set_3/PackageDescription.txt +++ b/Point_set_3/doc/Point_set_3/PackageDescription.txt @@ -43,9 +43,6 @@ /// I/O Functions for the \ref IOStreamXYZ /// \ingroup PkgPointSet3IO -/// \defgroup PkgPointSet3IODeprecated Input/Output (Deprecated) -/// \ingroup PkgPointSet3IO -/// These I/O functions are deprecated and newer versions should be used. /*! \addtogroup PkgPointSet3Ref diff --git a/Point_set_3/include/CGAL/Point_set_3/IO/LAS.h b/Point_set_3/include/CGAL/Point_set_3/IO/LAS.h index aa2de169bf20..57c4975d891f 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO/LAS.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO/LAS.h @@ -13,10 +13,8 @@ #include -#ifdef CGAL_LINKED_WITH_LASLIB -#include -#include -#endif // LAS +#include +#include #include #include 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 e364ca3b9a71..5da17d39a296 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 @@ -16,8 +16,8 @@ #include #include #include -#include -#include +#include +#include #include #include 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 965d11ff9604..7d80a60b15a6 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 @@ -15,8 +15,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/Point_set_3/package_info/Point_set_3/dependencies b/Point_set_3/package_info/Point_set_3/dependencies index 5b0eb897d7ef..0096db674b9c 100644 --- a/Point_set_3/package_info/Point_set_3/dependencies +++ b/Point_set_3/package_info/Point_set_3/dependencies @@ -18,7 +18,6 @@ Kernel_d Modular_arithmetic Number_types Point_set_3 -Point_set_processing_3 Polygon Profiling_tools Property_map diff --git a/Point_set_3/test/Point_set_3/point_set_test_join.cpp b/Point_set_3/test/Point_set_3/point_set_test_join.cpp index bcd39c531bb6..d2f5c703376d 100644 --- a/Point_set_3/test/Point_set_3/point_set_test_join.cpp +++ b/Point_set_3/test/Point_set_3/point_set_test_join.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include diff --git a/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt b/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt index f351e426e8fe..f935e3717c5a 100644 --- a/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt +++ b/Point_set_processing_3/doc/Point_set_processing_3/PackageDescription.txt @@ -10,23 +10,6 @@ simplification, etc.). \defgroup PkgPointSetProcessing3IO I/O Functions \ingroup PkgPointSetProcessing3Ref -\defgroup PkgPointSetProcessing3IOOff I/O (OFF Formats) -\ingroup PkgPointSetProcessing3Ref - -\defgroup PkgPointSetProcessing3IOXyz I/O (XYZ Formats) -\ingroup PkgPointSetProcessing3Ref - -\defgroup PkgPointSetProcessing3IOPly I/O (PLY Format) -\ingroup PkgPointSetProcessing3Ref - -Read and write points (with or without additional properties) in PLY -format. - -\defgroup PkgPointSetProcessing3IOLas I/O (LAS Format) -\ingroup PkgPointSetProcessing3Ref - -Read and write points (with or without additional properties) in LAS -format. \addtogroup PkgPointSetProcessing3Ref \cgalPkgDescriptionBegin{Point Set Processing,PkgPointSetProcessing3} @@ -84,14 +67,14 @@ format. \cgalCRPSection{I/O (XYZ/OFF Formats)} -- \link PkgPointSetProcessing3IOOff OFF I/O Functions (`read_OFF()` and `write_OFF()`)\endlink -- \link PkgPointSetProcessing3IOXyz XYZ I/O Functions (`read_XYZ()` and `write_XYZ()`)\endlink +- \link PkgStreamSupportIoFuncsOFF OFF I/O Functions (`read_OFF()` and `write_OFF()`)\endlink +- \link PkgStreamSupportIoFuncsXYZ XYZ I/O Functions (`read_XYZ()` and `write_XYZ()`)\endlink \cgalCRPSection{I/O (PLY Format)} -- \link PkgPointSetProcessing3IOPly `CGAL::IO::read_PLY()` \endlink +- \link PkgStreamSupportIoFuncsPLY `CGAL::IO::read_PLY()` \endlink - `CGAL::IO::read_PLY_with_properties()` -- \link PkgPointSetProcessing3IOPly `CGAL::IO::write_PLY()` \endlink +- \link PkgStreamSupportIoFuncsPLY `CGAL::IO::write_PLY()` \endlink - `CGAL::IO::write_PLY_with_properties()` - `CGAL::IO::PLY_property` - `CGAL::IO::make_ply_point_reader()` diff --git a/Point_set_processing_3/examples/Point_set_processing_3/orient_scanlines_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/orient_scanlines_example.cpp index 642da49d8937..2be25070f651 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/orient_scanlines_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/orient_scanlines_example.cpp @@ -1,6 +1,7 @@ #include -#include -#include +#include +#include +#include #include #include diff --git a/Point_set_processing_3/examples/Point_set_processing_3/read_las_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/read_las_example.cpp index b15265bcb5f5..9f2f14325c17 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/read_las_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/read_las_example.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include diff --git a/Point_set_processing_3/examples/Point_set_processing_3/read_ply_points_with_colors_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/read_ply_points_with_colors_example.cpp index e96f07a547b7..ce135038ad5c 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/read_ply_points_with_colors_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/read_ply_points_with_colors_example.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include diff --git a/Point_set_processing_3/examples/Point_set_processing_3/read_write_xyz_point_set_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/read_write_xyz_point_set_example.cpp index 604235ffae9a..efed980dc9fb 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/read_write_xyz_point_set_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/read_write_xyz_point_set_example.cpp @@ -1,8 +1,7 @@ #include #include -#include -#include +#include #include // defines std::pair #include diff --git a/Point_set_processing_3/examples/Point_set_processing_3/write_las_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/write_las_example.cpp index 200d31cc7e48..993701a1db72 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/write_las_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/write_las_example.cpp @@ -1,8 +1,7 @@ #include #include -#include -#include +#include #include #include diff --git a/Point_set_processing_3/examples/Point_set_processing_3/write_ply_points_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/write_ply_points_example.cpp index 13e7af3c633b..69e5a8a2f977 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/write_ply_points_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/write_ply_points_example.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include diff --git a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h deleted file mode 100644 index 69775af74d00..000000000000 --- a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h +++ /dev/null @@ -1,367 +0,0 @@ -// Copyright (c) 2015 Geometry Factory -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// Author(s) : Simon Giraudot - -#ifndef CGAL_POINT_SET_PROCESSING_READ_PLY_POINTS_H -#define CGAL_POINT_SET_PROCESSING_READ_PLY_POINTS_H - -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -namespace CGAL { - -namespace IO { - -#ifdef DOXYGEN_RUNNING // Document some parts from Stream_support here for convenience -/** - \ingroup PkgPointSetProcessing3IOPly - - Class used to identify a %PLY property as a type and a name. - - \sa `read_PLY_with_properties()` -*/ -template -struct PLY_property -{ - typedef T type; - const char* name; - PLY_property(const char* name) : name(name) { } -}; - -/** - \ingroup PkgPointSetProcessing3IOPly - - Generates a %PLY property handler to read 3D points. Points are - constructed from the input using 3 %PLY properties of type `FT` - and named `x`, `y` and `z`. `FT` is `float` if the points use - `CGAL::Simple_cartesian` and `double` otherwise. - - \tparam PointMap the property map used to store points. - - \sa `read_PLY_with_properties()` - \sa \ref IOStreamPLY -*/ -template -std::tuple::Kernel::Construct_point_3, - PLY_property, PLY_property, PLY_property > -make_ply_point_reader(PointMap point_map); - -/** - \ingroup PkgPointSetProcessing3IOPly - - Generates a %PLY property handler to read 3D normal - vectors. Vectors are constructed from the input using 3 PLY - properties of type `FT` and named `nx`, `ny` and `nz`. `FT` - is `float` if the points use `CGAL::Simple_cartesian` and - `double` otherwise. - - \tparam VectorMap the property map used to store vectors. - - \sa `read_PLY_with_properties()` - \sa \ref IOStreamPLY -*/ -template -std::tuple::Kernel::Construct_vector_3, - PLY_property, PLY_property, PLY_property > -make_ply_normal_reader(VectorMap normal_map); - -#endif // DOXYGEN_RUNNING - -/** - \ingroup PkgPointSetProcessing3IOPly - - \brief reads user-selected points properties from a .ply stream (ASCII or binary). - - Potential additional point properties and faces are ignored. - - Properties are handled through a variadic list of property - handlers. A `PropertyHandler` can either be: - - - A `std::pair >` if the user wants - to read a %PLY property as a scalar value T (for example, storing - an `int` %PLY property into an `int` variable). - - - A `std::tuple...>` if the user wants to use one or several PLY - properties to construct a complex object (for example, storing 3 - `uchar` %PLY properties into a %Color object that can for example - be a `std::array`). In that case, the - second element of the tuple should be a functor that constructs - the value type of `PropertyMap` from N objects of types `T`. - - \attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`. - - \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. - It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. - It can be omitted when the default is fine. - \tparam PointOutputIterator iterator over output points. - \tparam PropertyHandler handlers to recover properties. - - \returns `true` if reading was successful, `false` otherwise. - - \sa \ref IOStreamPLY - \sa `make_ply_point_reader()` - \sa `make_ply_normal_reader()` -*/ -template -bool read_PLY_with_properties(std::istream& is, - PointOutputIterator output, - PropertyHandler&& ... properties) -{ - if(!is) - return false; - - internal::PLY_reader reader(true); - - if(!(reader.init(is))) - { - is.setstate(std::ios::failbit); - return false; - } - - for(std::size_t i = 0; i < reader.number_of_elements(); ++ i) - { - internal::PLY_element& element = reader.element(i); - - for(std::size_t j = 0; j < element.number_of_items(); ++ j) - { - for(std::size_t k = 0; k < element.number_of_properties(); ++ k) - { - internal::PLY_read_number* property = element.property(k); - property->get(is); - - if(is.fail()) - return false; - } - - if(element.name() == "vertex" || element.name() == "vertices") - { - OutputIteratorValueType new_element; - internal::process_properties(element, new_element, std::forward(properties)...); - *(output ++) = new_element; - } - } - } - - return true; -} - -/// \cond SKIP_IN_MANUAL - -template -bool read_PLY_with_properties(std::istream& is, - OutputIterator output, - PropertyHandler&& ... properties) -{ - typedef typename value_type_traits::type OutputValueType; - - return read_PLY_with_properties(is, output, std::forward(properties)...); -} - -/// \endcond - -/** - \ingroup PkgPointSetProcessing3IOPly - - \brief reads points (positions + normals, if available), using the \ref IOStreamPLY. - - Potential additional point properties and faces are ignored. - - \attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`. - - \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. - It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. - It can be omitted when the default is fine. - \tparam PointOutputIterator iterator over output points. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param is input stream. - \param output output iterator over points. - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{normal_map} - \cgalParamDescription{a property map associating normals to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Vector_3`} - \cgalParamDefault{If this parameter is omitted, normals in the input stream are ignored.} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if reading was successful, `false` otherwise. - - \sa `read_PLY_with_properties()` -*/ -template -bool read_PLY(std::istream& is, - PointOutputIterator output, - const CGAL_NP_CLASS& np = parameters::default_values() -#ifndef DOXYGEN_RUNNING - , std::enable_if_t::value>* = nullptr -#endif - ) -{ - using parameters::choose_parameter; - using parameters::get_parameter; - - typedef Point_set_processing_3::Fake_point_range PointRange; - - // basic geometric types - typedef Point_set_processing_3_np_helper NP_helper; - typedef typename NP_helper::Point_map PointMap; - typedef typename NP_helper::Normal_map NormalMap; - - PointMap point_map = NP_helper::get_point_map(np); - NormalMap normal_map = NP_helper::get_normal_map(np); - - return read_PLY_with_properties(is, output, - make_ply_point_reader(point_map), - make_ply_normal_reader(normal_map)); -} - -/** - \ingroup PkgPointSetProcessing3IOPly - - \brief reads points (positions + normals, if available), using the \ref IOStreamPLY. - - Potential additional point properties and faces are ignored. - - \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. - It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. - It can be omitted when the default is fine. - \tparam PointOutputIterator iterator over output points. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param fname input file name. - \param output output iterator over points. - \param np optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below. - - \cgalNamedParamsBegin - \cgalParamNBegin{use_binary_mode} - \cgalParamDescription{indicates whether data should be read in binary (`true`) or in \ascii (`false`)} - \cgalParamType{Boolean} - \cgalParamDefault{`true`} - \cgalParamNEnd - - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{normal_map} - \cgalParamDescription{a property map associating normals to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Vector_3`} - \cgalParamDefault{If this parameter is omitted, normals in the input stream are ignored.} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if reading was successful, `false` otherwise. - - \sa \ref IOStreamPLY - \sa `read_PLY_with_properties()` -*/ -template -bool read_PLY(const std::string& fname, - PointOutputIterator output, - const CGAL_NP_CLASS& np = parameters::default_values() -#ifndef DOXYGEN_RUNNING - , std::enable_if_t::value>* = nullptr -#endif - ) -{ - const bool binary = CGAL::parameters::choose_parameter(CGAL::parameters::get_parameter(np, internal_np::use_binary_mode), true); - if(binary) - { - std::ifstream is(fname, std::ios::binary); - CGAL::IO::set_mode(is, CGAL::IO::BINARY); - return read_PLY(is, output, np); - } - else - { - std::ifstream is(fname); - CGAL::IO::set_mode(is, CGAL::IO::ASCII); - return read_PLY(is, output, np); - } -} - -/// \cond SKIP_IN_MANUAL - -// variants with default output iterator value type -template -bool read_PLY(std::istream& is, OutputIterator output, const CGAL_NP_CLASS& np = parameters::default_values(), - std::enable_if_t::value>* = nullptr) -{ - return read_PLY::type>(is, output, np); -} - -template -bool read_PLY(const std::string& fname, OutputIterator output, const CGAL_NP_CLASS& np = parameters::default_values(), - std::enable_if_t::value>* = nullptr) -{ - return read_PLY::type>(fname, output, np); -} - -/// \endcond - -} // namespace IO - -} // namespace CGAL - -#undef TRY_TO_GENERATE_POINT_PROPERTY -#undef TRY_TO_GENERATE_SIZED_FACE_PROPERTY -#undef TRY_TO_GENERATE_FACE_PROPERTY - -#endif // CGAL_POINT_SET_PROCESSING_READ_PLY_POINTS_H 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 deleted file mode 100644 index 0ef9d0bbcc74..000000000000 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) 2007-09 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// Author(s) : Pierre Alliez and Laurent Saboret - -#ifndef CGAL_POINT_SET_PROCESSING_WRITE_OFF_POINTS_H -#define CGAL_POINT_SET_PROCESSING_WRITE_OFF_POINTS_H - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace CGAL { -namespace Point_set_processing_3 { -namespace internal { - -template -bool write_OFF_PSP(std::ostream& os, - const PointRange& points, - const CGAL_NP_CLASS& np = CGAL::parameters::default_values()) -{ - using CGAL::parameters::is_default_parameter; - - // basic geometric types - typedef Point_set_processing_3_np_helper NP_helper; - typedef typename NP_helper::Const_point_map PointMap; - typedef typename NP_helper::Normal_map NormalMap; - - const bool has_normals = NP_helper::has_normal_map(points, np); - - PointMap point_map = NP_helper::get_const_point_map(points, np); - NormalMap normal_map = NP_helper::get_normal_map(points, np); - - CGAL_precondition(points.begin() != points.end()); - - if(!os) - { - std::cerr << "Error: cannot open file" << std::endl; - return false; - } - - set_stream_precision_from_NP(os, np); - - // Write header - if (has_normals) - os << "NOFF" << std::endl; - else - os << "OFF" << std::endl; - os << points.size() << " 0 0" << std::endl; - - // Write positions + normals - for(typename PointRange::const_iterator it = points.begin(); it != points.end(); it++) - { - os << get(point_map, *it); - if (has_normals) - os << " " << get(normal_map, *it); - os << "\n"; - } - - os << std::flush; - - return !os.fail(); -} - -} // namespace internal -} // namespace Point_set_processing_3 - -namespace IO { - -/** - \ingroup PkgPointSetProcessing3IOOff - - \brief writes the range of `points` (positions + normals, if available), using the \ref IOStreamOFF. - - \tparam PointRange is a model of `ConstRange`. The value type of - its iterator is the key type of the named parameter `point_map`. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param os output stream - \param points input point range - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{normal_map} - \cgalParamDescription{a property map associating normals to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Vector_3`} - \cgalParamDefault{If this parameter is omitted, normals are not written in the output stream.} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - - \cgalParamNBegin{stream_precision} - \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream} - \cgalParamType{int} - \cgalParamDefault{the precision of the stream `os`} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if writing was successful, `false` otherwise. -*/ -template -bool write_OFF(std::ostream& os, - const PointRange& points, - const CGAL_NP_CLASS& np = parameters::default_values() -#ifndef DOXYGEN_RUNNING - , std::enable_if_t::value>* = nullptr -#endif - ) -{ - return Point_set_processing_3::internal::write_OFF_PSP(os, points, np); -} - -/** - \ingroup PkgPointSetProcessing3IOOff - - \brief writes the range of `points` (positions + normals, if available), using the \ref IOStreamOFF. - - \tparam PointRange is a model of `ConstRange`. The value type of - its iterator is the key type of the named parameter `point_map`. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param filename the path to the output file - \param points input point range - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{normal_map} - \cgalParamDescription{a property map associating normals to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Vector_3`} - \cgalParamDefault{If this parameter is omitted, normals are not written in the output file.} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \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. - - \sa \ref IOStreamOFF -*/ -template -bool write_OFF(const std::string& filename, - const PointRange& points, - const CGAL_NP_CLASS& np = parameters::default_values() -#ifndef DOXYGEN_RUNNING - , std::enable_if_t::value>* = nullptr -#endif - ) -{ - std::ofstream os(filename); - set_stream_precision_from_NP(os, np); - return write_OFF(os, points, np); -} - -} // IO namespace - -} // namespace CGAL - -#endif // CGAL_POINT_SET_PROCESSING_WRITE_OFF_POINTS_H 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 deleted file mode 100644 index bdc9c8077e00..000000000000 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright (c) 2015 Geometry Factory -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// Author(s) : Simon Giraudot - -#ifndef CGAL_POINT_SET_PROCESSING_WRITE_PLY_POINTS_H -#define CGAL_POINT_SET_PROCESSING_WRITE_PLY_POINTS_H - -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include - -namespace CGAL { - -namespace IO { - -#ifdef DOXYGEN_RUNNING // Document some parts from Stream_support here for convenience - /** - \ingroup PkgPointSetProcessing3IOPly - - Generates a %PLY property handler to write 3D points. Points are - written as 3 %PLY properties of type `FT` and named `x`, `y` and - `z`. `FT` is `float` if the points use - `CGAL::Simple_cartesian` and `double` otherwise. - - \tparam PointMap the property map used to store points. - - \sa `write_PLY_with_properties()` - \sa \ref IOStreamPLY - */ - template - std::tuple, PLY_property, PLY_property > - make_ply_point_writer(PointMap point_map); - - /** - \ingroup PkgPointSetProcessing3IOPly - - Generates a %PLY property handler to write 3D normal - vectors. Vectors are written as 3 %PLY properties of type `FT` - and named `nx`, `ny` and `nz`. `FT` is `float` if the vectors use - `CGAL::Simple_cartesian` and `double` otherwise. - - \tparam VectorMap the property map used to store vectors. - - \sa `write_PLY_with_properties()` - \sa \ref IOStreamPLY - */ - template - std::tuple, PLY_property, PLY_property > - make_ply_normal_writer(VectorMap normal_map); -#endif - -/** - \ingroup PkgPointSetProcessing3IOPly - - \brief writes the range of `points` with properties using \ref IOStreamPLY. - - Properties are handled through a variadic list of property - handlers. A `PropertyHandler` can either be: - - - A `std::pair >` if the user wants - to write a scalar value T as a %PLY property (for example, writing - an `int` variable as an `int` %PLY property). - - - A `std::tuple...>` if the - user wants to write a complex object as several %PLY - properties. In that case, a specialization of `Output_rep` must - be provided for `PropertyMap::value_type` that handles both ASCII - and binary output (see `CGAL::IO::get_mode()`). - - \attention To write to a binary file, the flag `std::ios::binary` must be set during the creation - of the `ofstream`, and the \link PkgStreamSupportEnumRef `IO::Mode` \endlink - of the stream must be set to `BINARY`. - - \tparam PointRange is a model of `ConstRange`. The value type of - its iterator is the key type of the `PropertyMap` objects provided - within the `PropertyHandler` parameter. - \tparam PropertyHandler handlers to recover properties. - - \returns `true` if writing was successful, `false` otherwise. - - \sa \ref IOStreamPLY - \sa `make_ply_point_writer()` - \sa `make_ply_normal_writer()` -*/ -template - bool write_PLY_with_properties(std::ostream& os, ///< output stream. - const PointRange& points, ///< input point range. - PropertyHandler&& ... properties) ///< parameter pack of property handlers -{ - CGAL_precondition(points.begin() != points.end()); - - if(!os) - { - std::cerr << "Error: cannot open file" << std::endl; - return false; - } - - // Write header - os << "ply" << std::endl - << ((get_mode(os) == BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl - << "comment Generated by the CGAL library" << std::endl - << "element vertex " << points.size() << std::endl; - - internal::output_property_header (os, std::forward(properties)...); - - os << "end_header" << std::endl; - - // Write positions + normals - for(typename PointRange::const_iterator it = points.begin(); it != points.end(); it++) - internal::output_properties (os, it, std::forward(properties)...); - - return !os.fail(); -} - -/** - \ingroup PkgPointSetProcessing3IOPly - - \brief writes the range of `points` (positions + normals, if available) using \ref IOStreamPLY. - - \attention To write to a binary file, the flag `std::ios::binary` must be set during the creation - of the `ofstream`, and the \link PkgStreamSupportEnumRef `IO::Mode` \endlink - of the stream must be set to `BINARY`. - - \tparam PointRange is a model of `ConstRange`. The value type of - its iterator is the key type of the named parameter `point_map`. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param os output stream - \param points input point range - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{normal_map} - \cgalParamDescription{a property map associating normals to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Vector_3`} - \cgalParamDefault{If this parameter is omitted, normals are not written in the output stream.} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - - \cgalParamNBegin{stream_precision} - \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream} - \cgalParamType{int} - \cgalParamDefault{the precision of the stream `os`} - \cgalParamExtra{This parameter is only meaningful while using \ascii encoding.} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if writing was successful, `false` otherwise. - - \sa `write_PLY_with_properties()` -*/ -template -bool write_PLY(std::ostream& os, - const PointRange& points, - const CGAL_NP_CLASS& np = parameters::default_values() -#ifndef DOXYGEN_RUNNING - , std::enable_if_t::value>* = nullptr -#endif - ) -{ - using parameters::choose_parameter; - using parameters::get_parameter; - - // basic geometric types - typedef Point_set_processing_3_np_helper NP_helper; - typedef typename NP_helper::Const_point_map PointMap; - typedef typename NP_helper::Normal_map NormalMap; - - const bool has_normals = NP_helper::has_normal_map(points, np); - - PointMap point_map = NP_helper::get_const_point_map(points, np); - NormalMap normal_map = NP_helper::get_normal_map(points, np); - - if(!os) - { - std::cerr << "Error: cannot open file" << std::endl; - return false; - } - - set_stream_precision_from_NP(os, np); - - if(has_normals) - return write_PLY_with_properties(os, points, - make_ply_point_writer(point_map), - make_ply_normal_writer(normal_map)); - - return write_PLY_with_properties(os, points, make_ply_point_writer(point_map)); -} - -/** - \ingroup PkgPointSetProcessing3IOPly - - \brief writes the range of `points` (positions + normals, if available) using \ref IOStreamPLY. - - \tparam PointRange is a model of `ConstRange`. The value type of - its iterator is the key type of the named parameter `point_map`. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param filename the path to the output file - \param points input point range - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{use_binary_mode} - \cgalParamDescription{indicates whether data should be written in binary (`true`) or in \ascii (`false`)} - \cgalParamType{Boolean} - \cgalParamDefault{`true`} - \cgalParamNEnd - - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{normal_map} - \cgalParamDescription{a property map associating normals to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Vector_3`} - \cgalParamDefault{If this parameter is omitted, normals are not written in the output file.} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \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`} - \cgalParamExtra{This parameter is only meaningful while using \ascii encoding.} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if writing was successful, `false` otherwise. - - \sa `write_PLY_with_properties()` -*/ -template -bool write_PLY(const std::string& filename, - const PointRange& points, - const CGAL_NP_CLASS& np = parameters::default_values() -#ifndef DOXYGEN_RUNNING - , std::enable_if_t::value>* = nullptr -#endif - ) -{ - const bool binary = CGAL::parameters::choose_parameter(CGAL::parameters::get_parameter(np, internal_np::use_binary_mode), true); - if(binary) - { - std::ofstream os(filename, std::ios::binary); - CGAL::IO::set_mode(os, CGAL::IO::BINARY); - return write_PLY(os, points, np); - } - else - { - std::ofstream os(filename); - CGAL::IO::set_mode(os, CGAL::IO::ASCII); - return write_PLY(os, points, np); - } -} - -} // namespace IO - -} // namespace CGAL - -#endif // CGAL_POINT_SET_PROCESSING_WRITE_PLY_POINTS_H 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 deleted file mode 100644 index da1c2a402ed2..000000000000 --- a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) 2007-09 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// Author(s) : Pierre Alliez and Laurent Saboret - -#ifndef CGAL_POINT_SET_PROCESSING_WRITE_XYZ_POINTS_H -#define CGAL_POINT_SET_PROCESSING_WRITE_XYZ_POINTS_H - -#include - -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -namespace CGAL { -namespace Point_set_processing_3 { -namespace internal { - -template -bool write_XYZ_PSP(std::ostream& os, - const PointRange& points, - const CGAL_NP_CLASS& np = CGAL::parameters::default_values()) -{ - using CGAL::parameters::choose_parameter; - using CGAL::parameters::get_parameter; - - // basic geometric types - typedef Point_set_processing_3_np_helper NP_helper; - typedef typename NP_helper::Const_point_map PointMap; - typedef typename NP_helper::Normal_map NormalMap; - - const bool has_normals = NP_helper::has_normal_map(points, np); - - PointMap point_map = NP_helper::get_const_point_map(points, np); - NormalMap normal_map = NP_helper::get_normal_map(points, np); - - CGAL_precondition(points.begin() != points.end()); - - if(!os) - { - std::cerr << "Error: cannot open file" << std::endl; - return false; - } - - set_stream_precision_from_NP(os, np); - - // Write positions + normals - for(typename PointRange::const_iterator it = points.begin(); it != points.end(); it++) - { - os << get(point_map, *it); - if(has_normals) - os << " " << get(normal_map, *it); - os << "\n"; - } - - os << std::flush; - - return !os.fail(); -} - -} // namespace internal -} // Point_set_processing_3 - -namespace IO { - -/** - \ingroup PkgPointSetProcessing3IOXyz - - \brief writes the range of `points` (positions + normals, if available), using the \ref IOStreamXYZ. - - \tparam PointRange is a model of `ConstRange`. The value type of - its iterator is the key type of the named parameter `point_map`. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param os output stream - \param points input point range - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{normal_map} - \cgalParamDescription{a property map associating normals to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Vector_3`} - \cgalParamDefault{If this parameter is omitted, normals are not written in the output stream.} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - - \cgalParamNBegin{stream_precision} - \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream} - \cgalParamType{int} - \cgalParamDefault{the precision of the stream `os`} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if writing was successful, `false` otherwise. -*/ -template -bool write_XYZ(std::ostream& os, - const PointRange& points, - const CGAL_NP_CLASS& np = parameters::default_values() -#ifndef DOXYGEN_RUNNING - , std::enable_if_t::value>* = nullptr -#endif - ) -{ - return Point_set_processing_3::internal::write_XYZ_PSP(os, points, np); -} - -/** - \ingroup PkgPointSetProcessing3IOXyz - - \brief writes the range of `points` (positions + normals, if available), using the \ref IOStreamXYZ. - - \tparam PointRange is a model of `ConstRange`. The value type of - its iterator is the key type of the named parameter `point_map`. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param filename path to the output file - \param points input point range - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{normal_map} - \cgalParamDescription{a property map associating normals to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Vector_3`} - \cgalParamDefault{If this parameter is omitted, normals are not written in the output file.} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \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. -*/ -template -bool write_XYZ(const std::string& filename, - const PointRange& points, - const CGAL_NP_CLASS& np = parameters::default_values() -#ifndef DOXYGEN_RUNNING - , std::enable_if_t::value>* = nullptr -#endif - ) -{ - std::ofstream os(filename); - return write_XYZ(os, points, np); -} - -} // namespace IO - -} // namespace CGAL - -#endif // CGAL_POINT_SET_PROCESSING_WRITE_XYZ_POINTS_H diff --git a/Shape_detection/test/Shape_detection/test_validity_sampled_data.cpp b/Shape_detection/test/Shape_detection/test_validity_sampled_data.cpp index 6381eda2f673..b5b9c8123233 100644 --- a/Shape_detection/test/Shape_detection/test_validity_sampled_data.cpp +++ b/Shape_detection/test/Shape_detection/test_validity_sampled_data.cpp @@ -5,8 +5,8 @@ #include -#include -#include +#include +#include #include diff --git a/Stream_support/doc/Stream_support/File_formats/Supported_file_formats.txt b/Stream_support/doc/Stream_support/File_formats/Supported_file_formats.txt index fa8d6fd52493..f1c39df47aa9 100644 --- a/Stream_support/doc/Stream_support/File_formats/Supported_file_formats.txt +++ b/Stream_support/doc/Stream_support/File_formats/Supported_file_formats.txt @@ -61,7 +61,7 @@ The following table lists some \cgal data structures that have I/O functions com Any point range - \link PkgPointSetProcessing3IOOff CGAL::IO::read_OFF(const std::string&, PointOutputIterator)\endlink + \link PkgStreamSupportIoFuncsOFF CGAL::IO::read_OFF(const std::string&, PointOutputIterator)\endlink Polygon Soup @@ -89,7 +89,7 @@ The following table lists some \cgal data structures that have I/O functions com Any point range - \link PkgPointSetProcessing3IOOff CGAL::IO::write_OFF(const std::string&, const PointRange&)\endlink + \link PkgStreamSupportIoFuncsOFF CGAL::IO::write_OFF(const std::string&, const PointRange&)\endlink Polygon Soup @@ -239,7 +239,7 @@ A precise specification of those formats is available Any point range - \link PkgPointSetProcessing3IOPly CGAL::IO::write_PLY(const std::string&, const PointRange&)\endlink + \link PkgStreamSupportIoFuncsPLY CGAL::IO::write_PLY(const std::string&, const PointRange&)\endlink Polygon Soup @@ -298,7 +298,7 @@ A precise specification of those formats is available Any point range - \link PkgPointSetProcessing3IOLas CGAL::IO::read_LAS(const std::string&, PointRange&)\endlink + \link PkgStreamSupportIoFuncsLAS CGAL::IO::read_LAS(const std::string&, PointRange&)\endlink Output @@ -308,7 +308,7 @@ A precise specification of those formats is available Any point range - \link PkgPointSetProcessing3IOLas CGAL::IO::write_LAS(const std::string&, const PointRange&)\endlink + \link PkgStreamSupportIoFuncsLAS CGAL::IO::write_LAS(const std::string&, const PointRange&)\endlink @@ -331,7 +331,7 @@ of its coordinates and other properties. Only coordinates and normals are curren Any point range - \link PkgPointSetProcessing3IOXyz CGAL::IO::read_XYZ(const std::string&, PointRange&)\endlink + \link PkgStreamSupportIoFuncsXYZ CGAL::IO::read_XYZ(const std::string&, PointRange&)\endlink Output @@ -341,7 +341,7 @@ of its coordinates and other properties. Only coordinates and normals are curren Any point range - \link PkgPointSetProcessing3IOXyz CGAL::IO::write_XYZ(const std::string&, const PointRange&)\endlink + \link PkgStreamSupportIoFuncsXYZ CGAL::IO::write_XYZ(const std::string&, const PointRange&)\endlink diff --git a/Stream_support/doc/Stream_support/IOstream.txt b/Stream_support/doc/Stream_support/IOstream.txt index 0c4ac7f891de..6492d51f217b 100644 --- a/Stream_support/doc/Stream_support/IOstream.txt +++ b/Stream_support/doc/Stream_support/IOstream.txt @@ -306,23 +306,23 @@ The following table shows which file formats can be read from and written for po \ref IOStreamOFF "OFF" - \link PkgPointSetProcessing3IOOff `CGAL::IO::read_OFF()` \endlink - \link PkgPointSetProcessing3IOOff `CGAL::IO::write_OFF()` \endlink + \link PkgStreamSupportIoFuncsOFF `CGAL::IO::read_OFF()` \endlink + \link PkgStreamSupportIoFuncsOFF `CGAL::IO::write_OFF()` \endlink \ref IOStreamXYZ "XYZ" - \link PkgPointSetProcessing3IOXyz `CGAL::IO::read_XYZ()` \endlink - \link PkgPointSetProcessing3IOXyz `CGAL::IO::write_XYZ()` \endlink + \link PkgStreamSupportIoFuncsXYZ `CGAL::IO::read_XYZ()` \endlink + \link PkgStreamSupportIoFuncsXYZ `CGAL::IO::write_XYZ()` \endlink \ref IOStreamPLY "PLY" - \link PkgPointSetProcessing3IOPly `CGAL::IO::read_PLY()` \endlink - \link PkgPointSetProcessing3IOPly `CGAL::IO::write_PLY()` \endlink + \link PkgStreamSupportIoFuncsPLY `CGAL::IO::read_PLY()` \endlink + \link PkgStreamSupportIoFuncsPLY `CGAL::IO::write_PLY()` \endlink \ref IOStreamLAS "LAS" - \link PkgPointSetProcessing3IOLas `CGAL::IO::read_LAS()` \endlink - \link PkgPointSetProcessing3IOLas `CGAL::IO::write_LAS()` \endlink + \link PkgStreamSupportIoFuncsLAS `CGAL::IO::read_LAS()` \endlink + \link PkgStreamSupportIoFuncsLAS `CGAL::IO::write_LAS()` \endlink diff --git a/Stream_support/doc/Stream_support/PackageDescription.txt b/Stream_support/doc/Stream_support/PackageDescription.txt index 2d97d36e3c1e..de2dfbc7439c 100644 --- a/Stream_support/doc/Stream_support/PackageDescription.txt +++ b/Stream_support/doc/Stream_support/PackageDescription.txt @@ -36,6 +36,14 @@ /// I/O Functions for the \ref IOStream3MF /// \ingroup IOstreamFunctions +/// \defgroup PkgStreamSupportIoFuncsLAS LAS I/O Functions +/// I/O Functions for the \ref IOStreamLAS +/// \ingroup IOstreamFunctions + +/// \defgroup PkgStreamSupportIoFuncsXYZ XYZ I/O Functions +/// I/O Functions for the \ref IOStreamXYZ +/// \ingroup IOstreamFunctions + /// \defgroup PkgStreamSupportEnumRef I/O Enums /// \ingroup PkgStreamSupportRef @@ -99,5 +107,7 @@ the printing mode. - \link PkgStreamSupportIoFuncsVTK I/O for VTK files \endlink - \link PkgStreamSupportIoFuncs3MF I/O for 3MF files \endlink - \link PkgStreamSupportIoFuncsWKT I/O for WKT files \endlink +- \link PkgStreamSupportIoFuncsLAS I/O for LAS files \endlink +- \link PkgStreamSupportIoFuncsXYZ I/O for XYZ files \endlink */ diff --git a/Stream_support/include/CGAL/IO/LAS.h b/Stream_support/include/CGAL/IO/LAS.h new file mode 100644 index 000000000000..6b8a547f5e35 --- /dev/null +++ b/Stream_support/include/CGAL/IO/LAS.h @@ -0,0 +1,357 @@ +// Copyright (c) 2017 GeometryFactory +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + +#ifndef CGAL_IO_LAS_H +#define CGAL_IO_LAS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace CGAL { + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Read + +namespace IO { + +/** + \ingroup PkgStreamSupportIoFuncsLAS + + generates a %LAS property handler to read 3D points. Points are + constructed from the input the using 3 %LAS properties + `LAS_property::X`, `LAS_property::Y` and `LAS_property::Z`. + + \tparam PointMap the property map used to store points. + + \sa `read_LAS_with_properties()` + \sa \ref IOStreamLAS +*/ +template +std::tuple::Kernel::Construct_point_3, + LAS_property::X, LAS_property::Y, LAS_property::Z > +make_las_point_reader(PointMap point_map); + + +/** + \ingroup PkgStreamSupportIoFuncsLAS + + \brief reads user-selected points properties from a .las or .laz stream. + Potential additional properties are ignored. + + Properties are handled through a variadic list of property + handlers. A `PropertyHandler` can either be: + + - A `std::pair` if the user wants to + read a %LAS property as a scalar value `LAS_property::Tag::type` (for + example, storing an `int` %LAS property into an `int` variable). + + - A `std::tuple` if the user wants to use one or several + %LAS properties to construct a complex object (for example, + storing 4 `unsigned short` %LAS properties into a %Color object + that can for example be a `std::array`). In that case, the second element of the tuple should be a + functor that constructs the value type of `PropertyMap` from N + objects of of type `LAS_property::Tag::type`. + + The %LAS standard defines a fixed set of properties accessible + through the following tag classes: + + - `LAS_property::X` with type `double` + - `LAS_property::Y` with type `double` + - `LAS_property::Z` with type `double` + - `LAS_property::Intensity` with type `unsigned short` + - `LAS_property::Return_number` with type `unsigned char` + - `LAS_property::Number_of_returns` with type `unsigned char` + - `LAS_property::Scan_direction_flag` with type `unsigned char` + - `LAS_property::Edge_of_flight_line` with type `unsigned char` + - `LAS_property::Classification` with type `unsigned char` + - `LAS_property::Synthetic_flag` with type `unsigned char` + - `LAS_property::Keypoint_flag` with type `unsigned char` + - `LAS_property::Withheld_flag` with type `unsigned char` + - `LAS_property::Scan_angle` with type `double` + - `LAS_property::User_data` with type `unsigned char` + - `LAS_property::Point_source_ID` with type `unsigned short` + - `LAS_property::Deleted_flag` with type `unsigned int` + - `LAS_property::GPS_time` with type `double` + - `LAS_property::R` with type `unsigned short` + - `LAS_property::G` with type `unsigned short` + - `LAS_property::B` with type `unsigned short` + - `LAS_property::I` with type `unsigned short` + + \attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`. + + \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. + It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. + It can be omitted if the default is fine. + \tparam PointOutputIterator iterator over output points. + \tparam PropertyHandler handlers to recover properties. + + \returns `true` if reading was successful, `false` otherwise. + + \sa `make_las_point_reader()` + + \sa \ref IOStreamLAS +*/ +template +bool read_LAS_with_properties(std::istream& is, + PointOutputIterator output, + PropertyHandler&& ... properties); + + + +/** + \ingroup PkgStreamSupportIoFuncsLAS + + \brief reads points (position only) using the \ref IOStreamLAS. + + Potential additional properties are ignored. + + \attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`. + + \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. + It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. + It can be omitted when the default is fine. + \tparam PointOutputIterator iterator over output points. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param is input stream + \param output output iterator over points + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if reading was successful, `false` otherwise. + + \sa `read_LAS_with_properties()` +*/ +template +bool read_LAS(std::istream& is, + PointOutputIterator output, + const CGAL_NP_CLASS& np = parameters::default_values()); + + + + +/** + \ingroup PkgStreamSupportIoFuncsLAS + + \brief reads points (position only) using the \ref IOStreamLAS. + + Potential additional properties are ignored. + + \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. + It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. + It can be omitted when the default is fine. + \tparam PointOutputIterator iterator over output points. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param filename name of the input file + \param output output iterator over points + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if reading was successful, `false` otherwise. + + \sa `read_LAS_with_properties()` +*/ +template +bool read_LAS(const std::string& filename, + PointOutputIterator output, + const CGAL_NP_CLASS& np = parameters::default_values()); + + +/** + \ingroup PkgStreamSupportIoFuncsLAS + + \brief generates a %LAS property handler to write 3D points. + + \tparam PointMap the property map used to store points. + + \sa `write_LAS()` + \sa \ref IOStreamLAS +*/ +template +std::tuple +make_las_point_writer(PointMap point_map); + +/** + \ingroup PkgStreamSupportIoFuncsLAS + + \brief writes the range of `points` with properties to a .las stream. + + Properties are handled through a variadic list of property + handlers. A `PropertyHandle` is a `std::pair` used to write a scalar value + `LAS_property::Tag::type` as a %LAS property (for example, + writing an `int` variable as an `int` %LAS property). An exception + is used for points that are written using a `std::tuple` object. + + See documentation of `read_LAS_with_properties()` for the + list of available `LAS_property::Tag` classes. + + \attention To write to a binary file, the flag `std::ios::binary` must be set during the creation of the `ofstream`. + + \tparam PointRange is a model of `ConstRange`. The value type of + its iterator is the key type of the named parameter `point_map`. + \tparam PointMap is a model of `ReadablePropertyMap` with a value_type = `CGAL::Point_3`. + \tparam PropertyHandler handlers to recover properties. + + \returns `true` if writing was successful, `false` otherwise. + + \sa `make_las_point_writer()` + \sa \ref IOStreamLAS +*/ +template +bool write_LAS_with_properties(std::ostream& os, ///< output stream. + const PointRange& points, ///< input point range. + std::tuple point_property, ///< property handler for points + PropertyHandler&& ... properties ///< parameter pack of property handlers + ); + +/** + \ingroup PkgStreamSupportIoFuncsLAS + + \brief writes the range of `points` (positions only), using the \ref IOStreamLAS. + + \attention To write to a binary file, the flag `std::ios::binary` must be set during the creation of the `ofstream`. + + \tparam PointRange is a model of `ConstRange`. The value type of + its iterator is the key type of the named parameter `point_map`. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param os output stream + \param points input point range + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if writing was successful, `false` otherwise. + + \sa \ref IOStreamLAS + \sa `write_LAS_with_properties()` +*/ +template +bool write_LAS(std::ostream& os, + const PointRange& points, + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = nullptr +#endif + ); + + +/** + \ingroup PkgStreamSupportIoFuncsLAS + + writes the range of `points` (positions only), using the \ref IOStreamLAS. + + \tparam PointRange is a model of `ConstRange`. The value type of + its iterator is the key type of the named parameter `point_map`. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param filename the path the output file + \param points input point range + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if writing was successful, `false` otherwise. + + \sa `write_LAS_with_properties()` +*/ +template +bool write_LAS(const std::string& filename, + const PointRange& points, + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = nullptr +#endif + ); + +} // namespace IO + +} // namespace CGAL + + +#include +#include + + +#endif // CGAL_IO_LAS_H diff --git a/Stream_support/include/CGAL/IO/LAS/Las_property.h b/Stream_support/include/CGAL/IO/LAS/Las_property.h new file mode 100644 index 000000000000..4ec6fb9b9c9d --- /dev/null +++ b/Stream_support/include/CGAL/IO/LAS/Las_property.h @@ -0,0 +1,94 @@ +// Copyright (c) 2017 GeometryFactory +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + +#ifndef CGAL_IO_LAS_LAS_PROPERTY_H +#define CGAL_IO_LAS_LAS_PROPERTY_H + +#include +#include + +namespace CGAL { + namespace IO { + +namespace LAS_property { +namespace Id { + +enum Id +{ + X, + Y, + Z, + Intensity, + Return_number, + Number_of_returns, + Scan_direction_flag, + Edge_of_flight_line, + Classification, + Synthetic_flag, + Keypoint_flag, + Withheld_flag, + Scan_angle, + User_data, + Point_source_ID, + Deleted_flag, + GPS_time, + R, + G, + B, + I +}; + +} // namespace Id + +template +struct Base +{ + typedef T type; +}; + +typedef Base X; +typedef Base Y; +typedef Base Z; +typedef Base Intensity; +typedef Base Return_number; +typedef Base Number_of_returns; +typedef Base Scan_direction_flag; +typedef Base Edge_of_flight_line; +typedef Base Classification; +typedef Base Synthetic_flag; +typedef Base Keypoint_flag; +typedef Base Withheld_flag; +typedef Base Scan_angle; +typedef Base User_data; +typedef Base Point_source_ID; +typedef Base Deleted_flag; +typedef Base GPS_time; +typedef Base R; +typedef Base G; +typedef Base B; +typedef Base I; +} // namespace LAS_property + +// documenation in ../LAS.h +template +std::tuple::Kernel::Construct_point_3, + LAS_property::X, LAS_property::Y, LAS_property::Z > +make_las_point_reader(PointMap point_map) +{ + return std::make_tuple (point_map, typename Kernel_traits::Kernel::Construct_point_3(), + LAS_property::X(), LAS_property::Y(), LAS_property::Z()); +} + + +} // namespace IO +} // namespace CGAL + +#endif diff --git a/Point_set_processing_3/include/CGAL/IO/read_las_points.h b/Stream_support/include/CGAL/IO/LAS/read_las_points.h similarity index 54% rename from Point_set_processing_3/include/CGAL/IO/read_las_points.h rename to Stream_support/include/CGAL/IO/LAS/read_las_points.h index 258a580160cb..38d6595c446e 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_las_points.h +++ b/Stream_support/include/CGAL/IO/LAS/read_las_points.h @@ -1,21 +1,22 @@ -// Copyright (c) 2017 Geometry Factory -// All rights reserved. +// Copyright (c) 2017 GeometryFactory // -// This file is part of CGAL (www.cgal.org). +// This file is part of CGAL (www.cgal.org); // // $URL$ // $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Simon Giraudot -#ifndef CGAL_POINT_SET_PROCESSING_READ_LAS_POINTS_H -#define CGAL_POINT_SET_PROCESSING_READ_LAS_POINTS_H +#ifndef CGAL_IO_LAS_READ_LAS_POINTS_H +#define CGAL_IO_LAS_READ_LAS_POINTS_H -#include +#ifdef CGAL_LINKED_WITH_LASLIB #include +#include +#include #include #include #include @@ -59,89 +60,6 @@ namespace CGAL { namespace IO { -/// \cond SKIP_IN_MANUAL -namespace LAS_property { -namespace Id { - -enum Id -{ - X, - Y, - Z, - Intensity, - Return_number, - Number_of_returns, - Scan_direction_flag, - Edge_of_flight_line, - Classification, - Synthetic_flag, - Keypoint_flag, - Withheld_flag, - Scan_angle, - User_data, - Point_source_ID, - Deleted_flag, - GPS_time, - R, - G, - B, - I -}; - -} // namespace Id - -template -struct Base -{ - typedef T type; -}; - -typedef Base X; -typedef Base Y; -typedef Base Z; -typedef Base Intensity; -typedef Base Return_number; -typedef Base Number_of_returns; -typedef Base Scan_direction_flag; -typedef Base Edge_of_flight_line; -typedef Base Classification; -typedef Base Synthetic_flag; -typedef Base Keypoint_flag; -typedef Base Withheld_flag; -typedef Base Scan_angle; -typedef Base User_data; -typedef Base Point_source_ID; -typedef Base Deleted_flag; -typedef Base GPS_time; -typedef Base R; -typedef Base G; -typedef Base B; -typedef Base I; -} -/// \endcond - -/** - \ingroup PkgPointSetProcessing3IOLas - - generates a %LAS property handler to read 3D points. Points are - constructed from the input the using 3 %LAS properties - `LAS_property::X`, `LAS_property::Y` and `LAS_property::Z`. - - \tparam PointMap the property map used to store points. - - \sa `read_LAS_with_properties()` - \sa \ref IOStreamLAS -*/ -template -std::tuple::Kernel::Construct_point_3, - LAS_property::X, LAS_property::Y, LAS_property::Z > -make_las_point_reader(PointMap point_map) -{ - return std::make_tuple (point_map, typename Kernel_traits::Kernel::Construct_point_3(), - LAS_property::X(), LAS_property::Y(), LAS_property::Z()); -} - /// \cond SKIP_IN_MANUAL namespace internal { @@ -309,69 +227,10 @@ void process_properties (const LASpoint& reader, OutputValueType& new_element, } // namespace LAS } // namespace internal + /// \endcond -/** - \ingroup PkgPointSetProcessing3IOLas - - \brief reads user-selected points properties from a .las or .laz stream. - Potential additional properties are ignored. - - Properties are handled through a variadic list of property - handlers. A `PropertyHandler` can either be: - - - A `std::pair` if the user wants to - read a %LAS property as a scalar value `LAS_property::Tag::type` (for - example, storing an `int` %LAS property into an `int` variable). - - - A `std::tuple` if the user wants to use one or several - %LAS properties to construct a complex object (for example, - storing 4 `unsigned short` %LAS properties into a %Color object - that can for example be a `std::array`). In that case, the second element of the tuple should be a - functor that constructs the value type of `PropertyMap` from N - objects of of type `LAS_property::Tag::type`. - - The %LAS standard defines a fixed set of properties accessible - through the following tag classes: - - - `LAS_property::X` with type `double` - - `LAS_property::Y` with type `double` - - `LAS_property::Z` with type `double` - - `LAS_property::Intensity` with type `unsigned short` - - `LAS_property::Return_number` with type `unsigned char` - - `LAS_property::Number_of_returns` with type `unsigned char` - - `LAS_property::Scan_direction_flag` with type `unsigned char` - - `LAS_property::Edge_of_flight_line` with type `unsigned char` - - `LAS_property::Classification` with type `unsigned char` - - `LAS_property::Synthetic_flag` with type `unsigned char` - - `LAS_property::Keypoint_flag` with type `unsigned char` - - `LAS_property::Withheld_flag` with type `unsigned char` - - `LAS_property::Scan_angle` with type `double` - - `LAS_property::User_data` with type `unsigned char` - - `LAS_property::Point_source_ID` with type `unsigned short` - - `LAS_property::Deleted_flag` with type `unsigned int` - - `LAS_property::GPS_time` with type `double` - - `LAS_property::R` with type `unsigned short` - - `LAS_property::G` with type `unsigned short` - - `LAS_property::B` with type `unsigned short` - - `LAS_property::I` with type `unsigned short` - - \attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`. - - \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. - It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. - It can be omitted if the default is fine. - \tparam PointOutputIterator iterator over output points. - \tparam PropertyHandler handlers to recover properties. - - \returns `true` if reading was successful, `false` otherwise. - - \sa `make_las_point_reader()` - - \sa \ref IOStreamLAS -*/ +// documenation in ../LAS.h template @@ -420,49 +279,13 @@ bool read_LAS_with_properties(std::istream& is, /// \endcond -/** - \ingroup PkgPointSetProcessing3IOLas - - \brief reads points (position only) using the \ref IOStreamLAS. - - Potential additional properties are ignored. - - \attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`. - - \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. - It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. - It can be omitted when the default is fine. - \tparam PointOutputIterator iterator over output points. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param is input stream - \param output output iterator over points - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if reading was successful, `false` otherwise. - - \sa `read_LAS_with_properties()` -*/ +// documenation in ../LAS.h template + typename CGAL_NP_TEMPLATE_PARAMETERS_NO_DEFAULT> bool read_LAS(std::istream& is, PointOutputIterator output, - const CGAL_NP_CLASS& np = parameters::default_values()) + const CGAL_NP_CLASS& np) { using parameters::choose_parameter; using parameters::get_parameter; @@ -486,47 +309,13 @@ bool read_LAS(std::istream& is, OutputIterator output, const CGAL_NP_CLASS& np = /// \endcond -/** - \ingroup PkgPointSetProcessing3IOLas - - \brief reads points (position only) using the \ref IOStreamLAS. - - Potential additional properties are ignored. - - \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. - It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. - It can be omitted when the default is fine. - \tparam PointOutputIterator iterator over output points. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param filename name of the input file - \param output output iterator over points - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if reading was successful, `false` otherwise. - - \sa `read_LAS_with_properties()` -*/ +// documentation in ../LAS.h template + typename CGAL_NP_TEMPLATE_PARAMETERS_NO_DEFAULT> bool read_LAS(const std::string& filename, PointOutputIterator output, - const CGAL_NP_CLASS& np = parameters::default_values()) + const CGAL_NP_CLASS& np) { std::ifstream is(filename, std::ios::binary); CGAL::IO::set_mode(is, CGAL::IO::BINARY); @@ -549,4 +338,5 @@ bool read_LAS(const std::string& fname, OutputIterator output, const CGAL_NP_CLA } // namespace CGAL -#endif // CGAL_POINT_SET_PROCESSING_READ_LAS_POINTS_H +#endif // CGAL_LINKED_WITH_LASLIB +#endif // CGAL_IO_LAS_READ_LAS_POINTS_H diff --git a/Point_set_processing_3/include/CGAL/IO/write_las_points.h b/Stream_support/include/CGAL/IO/LAS/write_las_points.h similarity index 65% rename from Point_set_processing_3/include/CGAL/IO/write_las_points.h rename to Stream_support/include/CGAL/IO/LAS/write_las_points.h index 1d9408a0b889..736e597900b8 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_las_points.h +++ b/Stream_support/include/CGAL/IO/LAS/write_las_points.h @@ -1,21 +1,21 @@ -// Copyright (c) 2017 Geometry Factory -// All rights reserved. +// Copyright (c) 2017 GeometryFactory // -// This file is part of CGAL (www.cgal.org). +// This file is part of CGAL (www.cgal.org); // // $URL$ // $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Simon Giraudot -#ifndef CGAL_POINT_SET_PROCESSING_WRITE_LAS_POINTS_H -#define CGAL_POINT_SET_PROCESSING_WRITE_LAS_POINTS_H +#ifndef CGAL_IO_LAS_WRITE_LAS_POINTS_H +#define CGAL_IO_LAS_WRITE_LAS_POINTS_H -#include +#ifdef CGAL_LINKED_WITH_LASLIB #include - +#include +#include #include #include #include @@ -62,16 +62,7 @@ namespace CGAL { namespace IO { -/** - \ingroup PkgPointSetProcessing3IOLas - - \brief generates a %LAS property handler to write 3D points. - - \tparam PointMap the property map used to store points. - - \sa `write_LAS()` - \sa \ref IOStreamLAS -*/ +// documented in ../LAS.h template std::tuple make_las_point_writer(PointMap point_map) @@ -192,33 +183,7 @@ namespace LAS { /// \endcond -/** - \ingroup PkgPointSetProcessing3IOLas - - \brief writes the range of `points` with properties to a .las stream. - - Properties are handled through a variadic list of property - handlers. A `PropertyHandle` is a `std::pair` used to write a scalar value - `LAS_property::Tag::type` as a %LAS property (for example, - writing an `int` variable as an `int` %LAS property). An exception - is used for points that are written using a `std::tuple` object. - - See documentation of `read_LAS_with_properties()` for the - list of available `LAS_property::Tag` classes. - - \attention To write to a binary file, the flag `std::ios::binary` must be set during the creation of the `ofstream`. - - \tparam PointRange is a model of `ConstRange`. The value type of - its iterator is the key type of the named parameter `point_map`. - \tparam PointMap is a model of `ReadablePropertyMap` with a value_type = `CGAL::Point_3`. - \tparam PropertyHandler handlers to recover properties. - - \returns `true` if writing was successful, `false` otherwise. - - \sa `make_las_point_writer()` - \sa \ref IOStreamLAS -*/ +// documented in ../LAS.h template @@ -280,47 +245,12 @@ bool write_LAS_with_properties(std::ostream& os, ///< output stream. return !os.fail(); } -/** - \ingroup PkgPointSetProcessing3IOLas - - \brief writes the range of `points` (positions only), using the \ref IOStreamLAS. - - \attention To write to a binary file, the flag `std::ios::binary` must be set during the creation of the `ofstream`. - - \tparam PointRange is a model of `ConstRange`. The value type of - its iterator is the key type of the named parameter `point_map`. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param os output stream - \param points input point range - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if writing was successful, `false` otherwise. - - \sa \ref IOStreamLAS - \sa `write_LAS_with_properties()` -*/ -template +// documented in ../LAS.h +template bool write_LAS(std::ostream& os, const PointRange& points, - const CGAL_NP_CLASS& np = parameters::default_values() -#ifndef DOXYGEN_RUNNING - , std::enable_if_t::value>* = nullptr -#endif + const CGAL_NP_CLASS& np, + std::enable_if_t::value>* ) { using parameters::choose_parameter; @@ -338,44 +268,12 @@ bool write_LAS(std::ostream& os, return write_LAS_with_properties(os, points, make_las_point_writer(point_map)); } -/** - \ingroup PkgPointSetProcessing3IOLas - - writes the range of `points` (positions only), using the \ref IOStreamLAS. - - \tparam PointRange is a model of `ConstRange`. The value type of - its iterator is the key type of the named parameter `point_map`. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param filename the path the output file - \param points input point range - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if writing was successful, `false` otherwise. - - \sa `write_LAS_with_properties()` -*/ -template +// documented in ../LAS.h +template bool write_LAS(const std::string& filename, const PointRange& points, - const CGAL_NP_CLASS& np = parameters::default_values() -#ifndef DOXYGEN_RUNNING - , std::enable_if_t::value>* = nullptr -#endif + const CGAL_NP_CLASS& np, + std::enable_if_t::value>* ) { std::ofstream os(filename, std::ios::binary); @@ -387,4 +285,5 @@ bool write_LAS(const std::string& filename, } // namespace CGAL -#endif // CGAL_POINT_SET_PROCESSING_WRITE_LAS_POINTS_H +#endif // CGAL_LINKED_WITH_LASLIB +#endif // CGAL_IO_LAS_WRITE_LAS_POINTS_H diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index d2b1b5c9934b..b3c77fee937d 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -344,6 +344,213 @@ bool write_OFF(const std::string& fname, return writer(points, polygons, np); } +/** + \ingroup PkgStreamSupportIoFuncsOFF + + \brief reads points (positions + normals, if available), using the \ref IOStreamOFF. + + \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. + It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. + It can be omitted when the default is fine. + \tparam PointOutputIterator iterator over output points. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param is input stream + \param output output iterator over points + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{normal_map} + \cgalParamDescription{a property map associating normals to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Vector_3`} + \cgalParamDefault{If this parameter is omitted, normals in the input stream are ignored.} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if reading was successful, `false` otherwise. + + \sa \ref IOStreamOFF +*/ +template +bool read_OFF(std::istream& is, + PointOutputIterator output, + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = nullptr +#endif + ); + + + +/** + \ingroup PkgStreamSupportIoFuncsOFF + + \brief reads points (positions + normals, if available), using the \ref IOStreamOFF. + + \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. + It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. + It can be omitted when the default is fine. + \tparam PointOutputIterator iterator over output points. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param fname input file name + \param output output iterator over points + \param np optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below. + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{normal_map} + \cgalParamDescription{a property map associating normals to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Vector_3`} + \cgalParamDefault{If this parameter is omitted, normals in the input stream are ignored.} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if reading was successful, `false` otherwise. + + \sa \ref IOStreamOFF +*/ +template +bool read_OFF(const std::string& fname, + PointOutputIterator output, + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = nullptr +#endif + ); + +/** + \ingroup PkgStreamSupportIoFuncsOFF + + \brief writes the range of `points` (positions + normals, if available), using the \ref IOStreamOFF. + + \tparam PointRange is a model of `ConstRange`. The value type of + its iterator is the key type of the named parameter `point_map`. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param os output stream + \param points input point range + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{normal_map} + \cgalParamDescription{a property map associating normals to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Vector_3`} + \cgalParamDefault{If this parameter is omitted, normals are not written in the output stream.} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + + \cgalParamNBegin{stream_precision} + \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream} + \cgalParamType{int} + \cgalParamDefault{the precision of the stream `os`} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if writing was successful, `false` otherwise. +*/ +template +bool write_OFF(std::ostream& os, + const PointRange& points, + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = nullptr +#endif + ); + + + +/** + \ingroup PkgStreamSupportIoFuncsOFF + + \brief writes the range of `points` (positions + normals, if available), using the \ref IOStreamOFF. + + \tparam PointRange is a model of `ConstRange`. The value type of + its iterator is the key type of the named parameter `point_map`. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param filename the path to the output file + \param points input point range + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{normal_map} + \cgalParamDescription{a property map associating normals to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Vector_3`} + \cgalParamDefault{If this parameter is omitted, normals are not written in the output file.} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \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. + + \sa \ref IOStreamOFF +*/ +template +bool write_OFF(const std::string& filename, + const PointRange& points, + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = nullptr +#endif + ); + } // namespace IO } // namespace CGAL diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Stream_support/include/CGAL/IO/OFF/read_off_points.h similarity index 53% rename from Point_set_processing_3/include/CGAL/IO/read_off_points.h rename to Stream_support/include/CGAL/IO/OFF/read_off_points.h index cd752f463c77..d9df6639d221 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Stream_support/include/CGAL/IO/OFF/read_off_points.h @@ -1,18 +1,21 @@ -// Copyright (c) 2007-09 INRIA Sophia-Antipolis (France). -// All rights reserved. +// Copyright (c) 1997 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // -// This file is part of CGAL (www.cgal.org). +// This file is part of CGAL (www.cgal.org); // // $URL$ // $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Pierre Alliez and Laurent Saboret -#ifndef CGAL_POINT_SET_PROCESSING_READ_OFF_POINTS_H -#define CGAL_POINT_SET_PROCESSING_READ_OFF_POINTS_H +#ifndef CGAL_IO_OFF_READ_OFF_POINTS_H +#define CGAL_IO_OFF_READ_OFF_POINTS_H -#include #include #include @@ -21,10 +24,12 @@ #include #include #include +#include #include #include + #include #include #include @@ -35,54 +40,14 @@ namespace CGAL { namespace IO { -/** - \ingroup PkgPointSetProcessing3IOOff - - \brief reads points (positions + normals, if available), using the \ref IOStreamOFF. - - \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. - It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. - It can be omitted when the default is fine. - \tparam PointOutputIterator iterator over output points. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param is input stream - \param output output iterator over points - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{normal_map} - \cgalParamDescription{a property map associating normals to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Vector_3`} - \cgalParamDefault{If this parameter is omitted, normals in the input stream are ignored.} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if reading was successful, `false` otherwise. - - \sa \ref IOStreamOFF -*/ +// doxygen in ../OFF.h template + typename CGAL_NP_TEMPLATE_PARAMETERS_NO_DEFAULT> bool read_OFF(std::istream& is, PointOutputIterator output, - const CGAL_NP_CLASS& np = parameters::default_values() -#ifndef DOXYGEN_RUNNING - , std::enable_if_t::value>* = nullptr -#endif + const CGAL_NP_CLASS& np, + std::enable_if_t::value>* ) { using parameters::choose_parameter; @@ -194,54 +159,14 @@ bool read_OFF(std::istream& is, return true; } -/** - \ingroup PkgPointSetProcessing3IOOff - - \brief reads points (positions + normals, if available), using the \ref IOStreamOFF. - - \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. - It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. - It can be omitted when the default is fine. - \tparam PointOutputIterator iterator over output points. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param fname input file name - \param output output iterator over points - \param np optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below. - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{normal_map} - \cgalParamDescription{a property map associating normals to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Vector_3`} - \cgalParamDefault{If this parameter is omitted, normals in the input stream are ignored.} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if reading was successful, `false` otherwise. - - \sa \ref IOStreamOFF -*/ +// doxygen in ../OFF.h template + typename CGAL_NP_TEMPLATE_PARAMETERS_NO_DEFAULT> bool read_OFF(const std::string& fname, PointOutputIterator output, - const CGAL_NP_CLASS& np = parameters::default_values() -#ifndef DOXYGEN_RUNNING - , std::enable_if_t::value>* = nullptr -#endif + const CGAL_NP_CLASS& np, + std::enable_if_t::value>* ) { std::ifstream is(fname); @@ -273,4 +198,4 @@ bool read_OFF(const std::string& fname, OutputIterator output, const CGAL_NP_CLA } // namespace CGAL -#endif // CGAL_POINT_SET_PROCESSING_READ_OFF_POINTS_H +#endif // CGAL_IO_OFF_READ_OFF_POINTS_H diff --git a/Stream_support/include/CGAL/IO/OFF/write_off_points.h b/Stream_support/include/CGAL/IO/OFF/write_off_points.h new file mode 100644 index 000000000000..11c41651f92e --- /dev/null +++ b/Stream_support/include/CGAL/IO/OFF/write_off_points.h @@ -0,0 +1,119 @@ +// Copyright (c) 1997 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Pierre Alliez and Laurent Saboret + +#ifndef CGAL_IO_OFF_WRITE_OFF_POINTS_H +#define CGAL_IO_OFF_WRITE_OFF_POINTS_H + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace CGAL { +namespace Point_set_processing_3 { +namespace internal { + +template +bool write_OFF_PSP(std::ostream& os, + const PointRange& points, + const CGAL_NP_CLASS& np = CGAL::parameters::default_values()) +{ + using CGAL::parameters::is_default_parameter; + + // basic geometric types + typedef Point_set_processing_3_np_helper NP_helper; + typedef typename NP_helper::Const_point_map PointMap; + typedef typename NP_helper::Normal_map NormalMap; + + const bool has_normals = NP_helper::has_normal_map(points, np); + + PointMap point_map = NP_helper::get_const_point_map(points, np); + NormalMap normal_map = NP_helper::get_normal_map(points, np); + + CGAL_precondition(points.begin() != points.end()); + + if(!os) + { + std::cerr << "Error: cannot open file" << std::endl; + return false; + } + + set_stream_precision_from_NP(os, np); + + // Write header + if (has_normals) + os << "NOFF" << std::endl; + else + os << "OFF" << std::endl; + os << points.size() << " 0 0" << std::endl; + + // Write positions + normals + for(typename PointRange::const_iterator it = points.begin(); it != points.end(); it++) + { + os << get(point_map, *it); + if (has_normals) + os << " " << get(normal_map, *it); + os << "\n"; + } + + os << std::flush; + + return !os.fail(); +} + +} // namespace internal +} // namespace Point_set_processing_3 + +namespace IO { + +// // doxygen in ../OFF.h +template +bool write_OFF(std::ostream& os, + const PointRange& points, + const CGAL_NP_CLASS& np, + std::enable_if_t::value>* + ) +{ + return Point_set_processing_3::internal::write_OFF_PSP(os, points, np); +} + +// // doxygen in ../OFF.h +template +bool write_OFF(const std::string& filename, + const PointRange& points, + const CGAL_NP_CLASS& np, std::enable_if_t::value>* + ) +{ + std::ofstream os(filename); + set_stream_precision_from_NP(os, np); + return write_OFF(os, points, np); +} + +} // IO namespace + +} // namespace CGAL + +#endif // CGAL_IO_OFF_WRITE_OFF_POINTS_H diff --git a/Stream_support/include/CGAL/IO/PLY.h b/Stream_support/include/CGAL/IO/PLY.h index 229094602691..d5991a0b339c 100644 --- a/Stream_support/include/CGAL/IO/PLY.h +++ b/Stream_support/include/CGAL/IO/PLY.h @@ -14,8 +14,8 @@ #include #include -#include +#include #include #include #include @@ -549,7 +549,7 @@ bool write_PLY(const std::string& fname, const CGAL_NP_CLASS& np = parameters::default_values() #ifndef DOXYGEN_RUNNING , std::enable_if_t::value>* = nullptr -#endif +#endif // DOXYGEN_RUNNING ) { const bool binary = CGAL::parameters::choose_parameter(CGAL::parameters::get_parameter(np, internal_np::use_binary_mode), true); @@ -567,8 +567,429 @@ bool write_PLY(const std::string& fname, } } + + + +#ifdef DOXYGEN_RUNNING +/** + \ingroup PkgStreamSupportIoFuncsPLY + + Class used to identify a %PLY property as a type and a name. + + \sa `read_PLY_with_properties()` +*/ +template +struct PLY_property +{ + typedef T type; + const char* name; + PLY_property(const char* name) : name(name) { } +}; + +/** + \ingroup PkgStreamSupportIoFuncsPLY + + Generates a %PLY property handler to read 3D points. Points are + constructed from the input using 3 %PLY properties of type `FT` + and named `x`, `y` and `z`. `FT` is `float` if the points use + `CGAL::Simple_cartesian` and `double` otherwise. + + \tparam PointMap the property map used to store points. + + \sa `read_PLY_with_properties()` + \sa \ref IOStreamPLY +*/ +template +std::tuple::Kernel::Construct_point_3, + PLY_property, PLY_property, PLY_property > +make_ply_point_reader(PointMap point_map); + +/** + \ingroup PkgStreamSupportIoFuncsPLY + + Generates a %PLY property handler to read 3D normal + vectors. Vectors are constructed from the input using 3 PLY + properties of type `FT` and named `nx`, `ny` and `nz`. `FT` + is `float` if the points use `CGAL::Simple_cartesian` and + `double` otherwise. + + \tparam VectorMap the property map used to store vectors. + + \sa `read_PLY_with_properties()` + \sa \ref IOStreamPLY +*/ +template +std::tuple::Kernel::Construct_vector_3, + PLY_property, PLY_property, PLY_property > +make_ply_normal_reader(VectorMap normal_map); + +#endif // DOXYGEN_RUNNING + +/** + \ingroup PkgStreamSupportIoFuncsPLY + + \brief reads user-selected points properties from a .ply stream (ASCII or binary). + + Potential additional point properties and faces are ignored. + + Properties are handled through a variadic list of property + handlers. A `PropertyHandler` can either be: + + - A `std::pair >` if the user wants + to read a %PLY property as a scalar value T (for example, storing + an `int` %PLY property into an `int` variable). + + - A `std::tuple...>` if the user wants to use one or several PLY + properties to construct a complex object (for example, storing 3 + `uchar` %PLY properties into a %Color object that can for example + be a `std::array`). In that case, the + second element of the tuple should be a functor that constructs + the value type of `PropertyMap` from N objects of types `T`. + + \attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`. + + \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. + It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. + It can be omitted when the default is fine. + \tparam PointOutputIterator iterator over output points. + \tparam PropertyHandler handlers to recover properties. + + \returns `true` if reading was successful, `false` otherwise. + + \sa \ref IOStreamPLY + \sa `make_ply_point_reader()` + \sa `make_ply_normal_reader()` +*/ +template +bool read_PLY_with_properties(std::istream& is, + PointOutputIterator output, + PropertyHandler&& ... properties); + + + + +/** + \ingroup PkgStreamSupportIoFuncsPLY + + \brief reads points (positions + normals, if available), using the \ref IOStreamPLY. + + Potential additional point properties and faces are ignored. + + \attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`. + + \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. + It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. + It can be omitted when the default is fine. + \tparam PointOutputIterator iterator over output points. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param is input stream. + \param output output iterator over points. + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{normal_map} + \cgalParamDescription{a property map associating normals to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Vector_3`} + \cgalParamDefault{If this parameter is omitted, normals in the input stream are ignored.} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if reading was successful, `false` otherwise. + + \sa `read_PLY_with_properties()` +*/ +template +bool read_PLY(std::istream& is, + PointOutputIterator output, + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = nullptr +#endif + ); + + +/** + \ingroup PkgStreamSupportIoFuncsPLY + + \brief reads points (positions + normals, if available), using the \ref IOStreamPLY. + + Potential additional point properties and faces are ignored. + + \tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`. + It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. + It can be omitted when the default is fine. + \tparam PointOutputIterator iterator over output points. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param fname input file name. + \param output output iterator over points. + \param np optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below. + + \cgalNamedParamsBegin + \cgalParamNBegin{use_binary_mode} + \cgalParamDescription{indicates whether data should be read in binary (`true`) or in \ascii (`false`)} + \cgalParamType{Boolean} + \cgalParamDefault{`true`} + \cgalParamNEnd + + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{normal_map} + \cgalParamDescription{a property map associating normals to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Vector_3`} + \cgalParamDefault{If this parameter is omitted, normals in the input stream are ignored.} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if reading was successful, `false` otherwise. + + \sa \ref IOStreamPLY + \sa `read_PLY_with_properties()` +*/ +template +bool read_PLY(const std::string& fname, + PointOutputIterator output, + const CGAL_NP_CLASS& np = parameters::default_values() + #ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = nullptr + #endif + ); + + + +#ifdef DOXYGEN_RUNNING // Document some parts from Stream_support here for convenience + /** + \ingroup PkgStreamSupportIoFuncsPLY + + Generates a %PLY property handler to write 3D points. Points are + written as 3 %PLY properties of type `FT` and named `x`, `y` and + `z`. `FT` is `float` if the points use + `CGAL::Simple_cartesian` and `double` otherwise. + + \tparam PointMap the property map used to store points. + + \sa `write_PLY_with_properties()` + \sa \ref IOStreamPLY + */ + template + std::tuple, PLY_property, PLY_property > + make_ply_point_writer(PointMap point_map); + + /** + \ingroup PkgStreamSupportIoFuncsPLY + + Generates a %PLY property handler to write 3D normal + vectors. Vectors are written as 3 %PLY properties of type `FT` + and named `nx`, `ny` and `nz`. `FT` is `float` if the vectors use + `CGAL::Simple_cartesian` and `double` otherwise. + + \tparam VectorMap the property map used to store vectors. + + \sa `write_PLY_with_properties()` + \sa \ref IOStreamPLY + */ + template + std::tuple, PLY_property, PLY_property > + make_ply_normal_writer(VectorMap normal_map); +#endif + + +/** + \ingroup PkgStreamSupportIoFuncsPLY + + \brief writes the range of `points` with properties using \ref IOStreamPLY. + + Properties are handled through a variadic list of property + handlers. A `PropertyHandler` can either be: + + - A `std::pair >` if the user wants + to write a scalar value T as a %PLY property (for example, writing + an `int` variable as an `int` %PLY property). + + - A `std::tuple...>` if the + user wants to write a complex object as several %PLY + properties. In that case, a specialization of `Output_rep` must + be provided for `PropertyMap::value_type` that handles both ASCII + and binary output (see `CGAL::IO::get_mode()`). + + \attention To write to a binary file, the flag `std::ios::binary` must be set during the creation + of the `ofstream`, and the \link PkgStreamSupportEnumRef `IO::Mode` \endlink + of the stream must be set to `BINARY`. + + \tparam PointRange is a model of `ConstRange`. The value type of + its iterator is the key type of the `PropertyMap` objects provided + within the `PropertyHandler` parameter. + \tparam PropertyHandler handlers to recover properties. + + \returns `true` if writing was successful, `false` otherwise. + + \sa \ref IOStreamPLY + \sa `make_ply_point_writer()` + \sa `make_ply_normal_writer()` +*/ +template + bool write_PLY_with_properties(std::ostream& os, ///< output stream. + const PointRange& points, ///< input point range. + PropertyHandler&& ... properties); ///< parameter pack of property handlers + + + +/** + \ingroup PkgStreamSupportIoFuncsPLY + + \brief writes the range of `points` (positions + normals, if available) using \ref IOStreamPLY. + + \attention To write to a binary file, the flag `std::ios::binary` must be set during the creation + of the `ofstream`, and the \link PkgStreamSupportEnumRef `IO::Mode` \endlink + of the stream must be set to `BINARY`. + + \tparam PointRange is a model of `ConstRange`. The value type of + its iterator is the key type of the named parameter `point_map`. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param os output stream + \param points input point range + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{normal_map} + \cgalParamDescription{a property map associating normals to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Vector_3`} + \cgalParamDefault{If this parameter is omitted, normals are not written in the output stream.} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + + \cgalParamNBegin{stream_precision} + \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream} + \cgalParamType{int} + \cgalParamDefault{the precision of the stream `os`} + \cgalParamExtra{This parameter is only meaningful while using \ascii encoding.} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if writing was successful, `false` otherwise. + + \sa `write_PLY_with_properties()` +*/ +template +bool write_PLY(std::ostream& os, + const PointRange& points, + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = nullptr +#endif + ); + + +/** + \ingroup PkgStreamSupportIoFuncsPLY + + \brief writes the range of `points` (positions + normals, if available) using \ref IOStreamPLY. + + \tparam PointRange is a model of `ConstRange`. The value type of + its iterator is the key type of the named parameter `point_map`. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param filename the path to the output file + \param points input point range + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{use_binary_mode} + \cgalParamDescription{indicates whether data should be written in binary (`true`) or in \ascii (`false`)} + \cgalParamType{Boolean} + \cgalParamDefault{`true`} + \cgalParamNEnd + + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{normal_map} + \cgalParamDescription{a property map associating normals to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Vector_3`} + \cgalParamDefault{If this parameter is omitted, normals are not written in the output file.} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \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`} + \cgalParamExtra{This parameter is only meaningful while using \ascii encoding.} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if writing was successful, `false` otherwise. + + \sa `write_PLY_with_properties()` +*/ +template +bool write_PLY(const std::string& filename, + const PointRange& points, + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = nullptr +#endif + ); + } // namespace IO } // namespace CGAL +#include +#include + + #endif // CGAL_IO_PLY_H diff --git a/Stream_support/include/CGAL/IO/PLY/PLY_reader.h b/Stream_support/include/CGAL/IO/PLY/PLY_reader.h index c35bc6d4141d..2e9962d086b1 100644 --- a/Stream_support/include/CGAL/IO/PLY/PLY_reader.h +++ b/Stream_support/include/CGAL/IO/PLY/PLY_reader.h @@ -11,6 +11,7 @@ #ifndef CGAL_IO_PLY_PLY_READER_H #define CGAL_IO_PLY_PLY_READER_H +#include #include #include #include diff --git a/Stream_support/include/CGAL/IO/PLY/read_ply_points.h b/Stream_support/include/CGAL/IO/PLY/read_ply_points.h new file mode 100644 index 000000000000..20b1dea688ba --- /dev/null +++ b/Stream_support/include/CGAL/IO/PLY/read_ply_points.h @@ -0,0 +1,181 @@ +// Copyright (c) 2017 GeometryFactory +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + +#ifndef CGAL_IO_PLY_READ_PLY_POINTS_H +#define CGAL_IO_PLY_READ_PLY_POINTS_H + + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +namespace CGAL { + +namespace IO { + +// documentation in ../PLY.h +template +bool read_PLY_with_properties(std::istream& is, + PointOutputIterator output, + PropertyHandler&& ... properties) +{ + if(!is) + return false; + + internal::PLY_reader reader(true); + + if(!(reader.init(is))) + { + is.setstate(std::ios::failbit); + return false; + } + + for(std::size_t i = 0; i < reader.number_of_elements(); ++ i) + { + internal::PLY_element& element = reader.element(i); + + for(std::size_t j = 0; j < element.number_of_items(); ++ j) + { + for(std::size_t k = 0; k < element.number_of_properties(); ++ k) + { + internal::PLY_read_number* property = element.property(k); + property->get(is); + + if(is.fail()) + return false; + } + + if(element.name() == "vertex" || element.name() == "vertices") + { + OutputIteratorValueType new_element; + internal::process_properties(element, new_element, std::forward(properties)...); + *(output ++) = new_element; + } + } + } + + return true; +} + +/// \cond SKIP_IN_MANUAL + +template +bool read_PLY_with_properties(std::istream& is, + OutputIterator output, + PropertyHandler&& ... properties) +{ + typedef typename value_type_traits::type OutputValueType; + + return read_PLY_with_properties(is, output, std::forward(properties)...); +} + +/// \endcond + + +// documented in ../PLY.h +template +bool read_PLY(std::istream& is, + PointOutputIterator output, + const CGAL_NP_CLASS& np , + std::enable_if_t::value>* + ) +{ + using parameters::choose_parameter; + using parameters::get_parameter; + + typedef Point_set_processing_3::Fake_point_range PointRange; + + // basic geometric types + typedef Point_set_processing_3_np_helper NP_helper; + typedef typename NP_helper::Point_map PointMap; + typedef typename NP_helper::Normal_map NormalMap; + + PointMap point_map = NP_helper::get_point_map(np); + NormalMap normal_map = NP_helper::get_normal_map(np); + + return read_PLY_with_properties(is, output, + make_ply_point_reader(point_map), + make_ply_normal_reader(normal_map)); +} + +// documentation in ../PLY.h +template +bool read_PLY(const std::string& fname, + PointOutputIterator output, + const CGAL_NP_CLASS& np, + std::enable_if_t::value>* + ) +{ + const bool binary = CGAL::parameters::choose_parameter(CGAL::parameters::get_parameter(np, internal_np::use_binary_mode), true); + if(binary) + { + std::ifstream is(fname, std::ios::binary); + CGAL::IO::set_mode(is, CGAL::IO::BINARY); + return read_PLY(is, output, np); + } + else + { + std::ifstream is(fname); + CGAL::IO::set_mode(is, CGAL::IO::ASCII); + return read_PLY(is, output, np); + } +} + +/// \cond SKIP_IN_MANUAL + +// variants with default output iterator value type +template +bool read_PLY(std::istream& is, OutputIterator output, const CGAL_NP_CLASS& np = parameters::default_values(), + std::enable_if_t::value>* = nullptr) +{ + return read_PLY::type>(is, output, np); +} + +template +bool read_PLY(const std::string& fname, OutputIterator output, const CGAL_NP_CLASS& np = parameters::default_values(), + std::enable_if_t::value>* = nullptr) +{ + return read_PLY::type>(fname, output, np); +} + +/// \endcond + +} // namespace IO + +} // namespace CGAL + +#undef TRY_TO_GENERATE_POINT_PROPERTY +#undef TRY_TO_GENERATE_SIZED_FACE_PROPERTY +#undef TRY_TO_GENERATE_FACE_PROPERTY + +#endif // CGAL_IO_PLY_READ_PLY_POINTS_H diff --git a/Stream_support/include/CGAL/IO/PLY/write_ply_points.h b/Stream_support/include/CGAL/IO/PLY/write_ply_points.h new file mode 100644 index 000000000000..7ab3f993c350 --- /dev/null +++ b/Stream_support/include/CGAL/IO/PLY/write_ply_points.h @@ -0,0 +1,137 @@ +// Copyright (c) 1997 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + +#ifndef CGAL_IO_PLY_WRITE_PLY_POINTS_H +#define CGAL_IO_PLY_WRITE_PLY_POINTS_H + +#include +#include + +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include + +namespace CGAL { + +namespace IO { + + // documented in ../PLY.h + template + bool write_PLY_with_properties(std::ostream& os, ///< output stream. + const PointRange& points, ///< input point range. + PropertyHandler&& ... properties) ///< parameter pack of property handlers +{ + CGAL_precondition(points.begin() != points.end()); + + if(!os) + { + std::cerr << "Error: cannot open file" << std::endl; + return false; + } + + // Write header + os << "ply" << std::endl + << ((get_mode(os) == BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl + << "comment Generated by the CGAL library" << std::endl + << "element vertex " << points.size() << std::endl; + + internal::output_property_header (os, std::forward(properties)...); + + os << "end_header" << std::endl; + + // Write positions + normals + for(typename PointRange::const_iterator it = points.begin(); it != points.end(); it++) + internal::output_properties (os, it, std::forward(properties)...); + + return !os.fail(); +} + +// documented in ../PLY.h +template +bool write_PLY(std::ostream& os, + const PointRange& points, + const CGAL_NP_CLASS& np + , std::enable_if_t::value>* + ) +{ + using parameters::choose_parameter; + using parameters::get_parameter; + + // basic geometric types + typedef Point_set_processing_3_np_helper NP_helper; + typedef typename NP_helper::Const_point_map PointMap; + typedef typename NP_helper::Normal_map NormalMap; + + const bool has_normals = NP_helper::has_normal_map(points, np); + + PointMap point_map = NP_helper::get_const_point_map(points, np); + NormalMap normal_map = NP_helper::get_normal_map(points, np); + + if(!os) + { + std::cerr << "Error: cannot open file" << std::endl; + return false; + } + + set_stream_precision_from_NP(os, np); + + if(has_normals) + return write_PLY_with_properties(os, points, + make_ply_point_writer(point_map), + make_ply_normal_writer(normal_map)); + + return write_PLY_with_properties(os, points, make_ply_point_writer(point_map)); +} + +// documented in ../PLY.h +template +bool write_PLY(const std::string& filename, + const PointRange& points, + const CGAL_NP_CLASS& np, + std::enable_if_t::value>* + ) +{ + const bool binary = CGAL::parameters::choose_parameter(CGAL::parameters::get_parameter(np, internal_np::use_binary_mode), true); + if(binary) + { + std::ofstream os(filename, std::ios::binary); + CGAL::IO::set_mode(os, CGAL::IO::BINARY); + return write_PLY(os, points, np); + } + else + { + std::ofstream os(filename); + CGAL::IO::set_mode(os, CGAL::IO::ASCII); + return write_PLY(os, points, np); + } +} + +} // namespace IO + +} // namespace CGAL + +#endif // CGAL_IO_PLY_WRITE_PLY_POINTS_H diff --git a/Stream_support/include/CGAL/IO/XYZ.h b/Stream_support/include/CGAL/IO/XYZ.h new file mode 100644 index 000000000000..a25685102068 --- /dev/null +++ b/Stream_support/include/CGAL/IO/XYZ.h @@ -0,0 +1,236 @@ +// Copyright (c) 2017 GeometryFactory +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + +#ifndef CGAL_IO_XYZ_H +#define CGAL_IO_XYZ_H + + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace CGAL { + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Read + +namespace IO { + +/** + \ingroup PkgStreamSupportIoFuncsXYZ + + \brief reads points (positions + normals, if available), using the \ref IOStreamXYZ. + + \tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`. + It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. + It can be omitted when the default is fine. + \tparam OutputIterator iterator over output points. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param is input stream. + \param output output iterator over points. + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{normal_map} + \cgalParamDescription{a property map associating normals to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Vector_3`} + \cgalParamDefault{If this parameter is omitted, normals in the input stream are ignored.} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if reading was successful, `false` otherwise. + + \sa \ref IOStreamXYZ +*/ +template +bool read_XYZ(std::istream& is, + OutputIterator output, + const CGAL_NP_CLASS& np = parameters::default_values()); + + + + +/** + \ingroup PkgStreamSupportIoFuncsXYZ + + \brief reads points (positions + normals, if available), using the \ref IOStreamXYZ. + + \tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`. + It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. + It can be omitted when the default is fine. + \tparam OutputIterator iterator over output points. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param fname input file name. + \param output output iterator over points. + \param np optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below. + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{normal_map} + \cgalParamDescription{a property map associating normals to the elements of the point range} + \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Vector_3`} + \cgalParamDefault{If this parameter is omitted, normals in the input stream are ignored.} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if reading was successful, `false` otherwise. + + \sa \ref IOStreamXYZ +*/ +template +bool read_XYZ(const std::string& fname, + OutputIterator output, + const CGAL_NP_CLASS& np = parameters::default_values()); + + +/** + \ingroup PkgStreamSupportIoFuncsXYZ + + \brief writes the range of `points` (positions + normals, if available), using the \ref IOStreamXYZ. + + \tparam PointRange is a model of `ConstRange`. The value type of + its iterator is the key type of the named parameter `point_map`. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param os output stream + \param points input point range + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{normal_map} + \cgalParamDescription{a property map associating normals to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Vector_3`} + \cgalParamDefault{If this parameter is omitted, normals are not written in the output stream.} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \cgalParamNEnd + + \cgalParamNBegin{stream_precision} + \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream} + \cgalParamType{int} + \cgalParamDefault{the precision of the stream `os`} + \cgalParamNEnd + \cgalNamedParamsEnd + + \returns `true` if writing was successful, `false` otherwise. +*/ +template +bool write_XYZ(std::ostream& os, + const PointRange& points, + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = nullptr +#endif + ); + + +/** + \ingroup PkgStreamSupportIoFuncsXYZ + + \brief writes the range of `points` (positions + normals, if available), using the \ref IOStreamXYZ. + + \tparam PointRange is a model of `ConstRange`. The value type of + its iterator is the key type of the named parameter `point_map`. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param filename path to the output file + \param points input point range + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map associating points to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Point_3`} + \cgalParamDefault{`CGAL::Identity_property_map`} + \cgalParamNEnd + + \cgalParamNBegin{normal_map} + \cgalParamDescription{a property map associating normals to the elements of the point range} + \cgalParamType{a model of `ReadablePropertyMap` with value type `geom_traits::Vector_3`} + \cgalParamDefault{If this parameter is omitted, normals are not written in the output file.} + \cgalParamNEnd + + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of a geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + \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. +*/ +template +bool write_XYZ(const std::string& filename, + const PointRange& points, + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , std::enable_if_t::value>* = nullptr +#endif + ); + +} // namespace IO +} // namespace CGAL + + +#include +#include + +#endif // CGAL_IO_XYZ_H diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Stream_support/include/CGAL/IO/XYZ/read_xyz_points.h similarity index 51% rename from Point_set_processing_3/include/CGAL/IO/read_xyz_points.h rename to Stream_support/include/CGAL/IO/XYZ/read_xyz_points.h index ddf772be51b9..cb97992be45a 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Stream_support/include/CGAL/IO/XYZ/read_xyz_points.h @@ -1,19 +1,22 @@ -// Copyright (c) 2007-09 INRIA Sophia-Antipolis (France). -// All rights reserved. +// Copyright (c) 1997 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // -// This file is part of CGAL (www.cgal.org). +// This file is part of CGAL (www.cgal.org); // // $URL$ // $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Pierre Alliez and Laurent Saboret -#ifndef CGAL_POINT_SET_PROCESSING_READ_XYZ_POINTS_H -#define CGAL_POINT_SET_PROCESSING_READ_XYZ_POINTS_H - -#include +#ifndef CGAL_IO_PLY_READ_XYZ_POINTS_H +#define CGAL_IO_PLY_READ_XYZ_POINTS_H +#include #include #include #include @@ -32,51 +35,13 @@ namespace CGAL { namespace IO { -/** - \ingroup PkgPointSetProcessing3IOXyz - - \brief reads points (positions + normals, if available), using the \ref IOStreamXYZ. - - \tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`. - It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. - It can be omitted when the default is fine. - \tparam OutputIterator iterator over output points. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param is input stream. - \param output output iterator over points. - \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{normal_map} - \cgalParamDescription{a property map associating normals to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Vector_3`} - \cgalParamDefault{If this parameter is omitted, normals in the input stream are ignored.} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if reading was successful, `false` otherwise. - - \sa \ref IOStreamXYZ -*/ +// doxygen in ../XYZ.h template + typename CGAL_NP_TEMPLATE_PARAMETERS_NO_DEFAULT> bool read_XYZ(std::istream& is, OutputIterator output, - const CGAL_NP_CLASS& np = parameters::default_values()) + const CGAL_NP_CLASS& np) { using parameters::choose_parameter; using parameters::get_parameter; @@ -178,51 +143,13 @@ bool read_XYZ(std::istream& is, return true; } -/** - \ingroup PkgPointSetProcessing3IOXyz - - \brief reads points (positions + normals, if available), using the \ref IOStreamXYZ. - - \tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`. - It must be a model of `DefaultConstructible` and defaults to `value_type_traits::%type`. - It can be omitted when the default is fine. - \tparam OutputIterator iterator over output points. - \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - - \param fname input file name. - \param output output iterator over points. - \param np optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below. - - \cgalNamedParamsBegin - \cgalParamNBegin{point_map} - \cgalParamDescription{a property map associating points to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Point_3`} - \cgalParamDefault{`CGAL::Identity_property_map`} - \cgalParamNEnd - - \cgalParamNBegin{normal_map} - \cgalParamDescription{a property map associating normals to the elements of the point range} - \cgalParamType{a model of `WritablePropertyMap` with value type `geom_traits::Vector_3`} - \cgalParamDefault{If this parameter is omitted, normals in the input stream are ignored.} - \cgalParamNEnd - - \cgalParamNBegin{geom_traits} - \cgalParamDescription{an instance of a geometric traits class} - \cgalParamType{a model of `Kernel`} - \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - \cgalParamNEnd - \cgalNamedParamsEnd - - \returns `true` if reading was successful, `false` otherwise. - - \sa \ref IOStreamXYZ -*/ +// documentation in ../XYZ.h template + typename CGAL_NP_TEMPLATE_PARAMETERS_NO_DEFAULT> bool read_XYZ(const std::string& fname, OutputIterator output, - const CGAL_NP_CLASS& np = parameters::default_values()) + const CGAL_NP_CLASS& np) { std::ifstream is(fname); return read_XYZ(is, output, np); @@ -253,4 +180,4 @@ bool read_XYZ(const std::string& fname, OutputIterator output, const CGAL_NP_CLA } // namespace CGAL -#endif // CGAL_POINT_SET_PROCESSING_READ_XYZ_POINTS_H +#endif // CGAL_IO_PLY_READ_XYZ_POINTS_H diff --git a/Stream_support/include/CGAL/IO/XYZ/write_xyz_points.h b/Stream_support/include/CGAL/IO/XYZ/write_xyz_points.h new file mode 100644 index 000000000000..cb04512053a9 --- /dev/null +++ b/Stream_support/include/CGAL/IO/XYZ/write_xyz_points.h @@ -0,0 +1,113 @@ +// Copyright (c) 1997 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Pierre Alliez and Laurent Saboret + +#ifndef CGAL_POINT_SET_PROCESSING_WRITE_XYZ_POINTS_H +#define CGAL_POINT_SET_PROCESSING_WRITE_XYZ_POINTS_H + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +namespace CGAL { +namespace Point_set_processing_3 { +namespace internal { + +template +bool write_XYZ_PSP(std::ostream& os, + const PointRange& points, + const CGAL_NP_CLASS& np = CGAL::parameters::default_values()) +{ + using CGAL::parameters::choose_parameter; + using CGAL::parameters::get_parameter; + + // basic geometric types + typedef Point_set_processing_3_np_helper NP_helper; + typedef typename NP_helper::Const_point_map PointMap; + typedef typename NP_helper::Normal_map NormalMap; + + const bool has_normals = NP_helper::has_normal_map(points, np); + + PointMap point_map = NP_helper::get_const_point_map(points, np); + NormalMap normal_map = NP_helper::get_normal_map(points, np); + + CGAL_precondition(points.begin() != points.end()); + + if(!os) + { + std::cerr << "Error: cannot open file" << std::endl; + return false; + } + + set_stream_precision_from_NP(os, np); + + // Write positions + normals + for(typename PointRange::const_iterator it = points.begin(); it != points.end(); it++) + { + os << get(point_map, *it); + if(has_normals) + os << " " << get(normal_map, *it); + os << "\n"; + } + + os << std::flush; + + return !os.fail(); +} + +} // namespace internal +} // Point_set_processing_3 + +namespace IO { + +// documented in ../XYZ.h +template +bool write_XYZ(std::ostream& os, + const PointRange& points, + const CGAL_NP_CLASS& np, + std::enable_if_t::value>* + ) +{ + return Point_set_processing_3::internal::write_XYZ_PSP(os, points, np); +} + +// documented in ../XYZ.h +template +bool write_XYZ(const std::string& filename, + const PointRange& points, + const CGAL_NP_CLASS& np, + std::enable_if_t::value>* + ) +{ + std::ofstream os(filename); + return write_XYZ(os, points, np); +} + +} // namespace IO + +} // namespace CGAL + +#endif // CGAL_POINT_SET_PROCESSING_WRITE_XYZ_POINTS_H diff --git a/Stream_support/include/CGAL/IO/read_las_points.h b/Stream_support/include/CGAL/IO/read_las_points.h new file mode 100644 index 000000000000..0043d7ea269f --- /dev/null +++ b/Stream_support/include/CGAL/IO/read_las_points.h @@ -0,0 +1,18 @@ +// Copyright (c) 2017 GeometryFactory +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + + +#ifndef CGAL_IO_READ_LAS_POINTS_H +#define CGAL_IO_READ_LAS_POINTS_H + +#include + +#endif // CGAL_IO_READ_LAS_POINTS_H + diff --git a/Stream_support/include/CGAL/IO/read_off_points.h b/Stream_support/include/CGAL/IO/read_off_points.h new file mode 100644 index 000000000000..24a3edc4716d --- /dev/null +++ b/Stream_support/include/CGAL/IO/read_off_points.h @@ -0,0 +1,16 @@ +// Copyright (c) 2017 GeometryFactory +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + +#ifndef CGAL_IO_READ_OFF_POINTS_H +#define CGAL_IO_READ_OFF_POINTS_H + +#include + +#endif // CGAL_IO_READ_OFF_POINTS_H diff --git a/Stream_support/include/CGAL/IO/read_ply_points.h b/Stream_support/include/CGAL/IO/read_ply_points.h new file mode 100644 index 000000000000..fb249658f1fa --- /dev/null +++ b/Stream_support/include/CGAL/IO/read_ply_points.h @@ -0,0 +1,16 @@ +// Copyright (c) 2017 GeometryFactory +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + +#ifndef CGAL_IO_READ_PLY_POINTS_H +#define CGAL_IO_READ_PLY_POINTS_H + +#include + +#endif // CGAL_IO_READ_PLY_POINTS_H diff --git a/Point_set_processing_3/include/CGAL/IO/read_points.h b/Stream_support/include/CGAL/IO/read_points.h similarity index 87% rename from Point_set_processing_3/include/CGAL/IO/read_points.h rename to Stream_support/include/CGAL/IO/read_points.h index b9ca990d21a8..32111e08f174 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_points.h +++ b/Stream_support/include/CGAL/IO/read_points.h @@ -1,26 +1,24 @@ -// Copyright (c) 2020 Geometry Factory -// All rights reserved. +// Copyright (c) 2020 Geometry Factory // -// This file is part of CGAL (www.cgal.org). +// This file is part of CGAL (www.cgal.org); // // $URL$ // $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Maxime Gimeno -#ifndef CGAL_POINT_SET_PROCESSING_READ_POINTS_H -#define CGAL_POINT_SET_PROCESSING_READ_POINTS_H +#ifndef CGAL_STREAM_SUPPORT_IO_READ_POINTS_H +#define CGAL_STREAM_SUPPORT_IO_READ_POINTS_H -#include #include -#include -#include -#include +#include +#include +#include #ifdef CGAL_LINKED_WITH_LASLIB -#include +#include #endif #include @@ -31,7 +29,7 @@ namespace CGAL { namespace IO { /** - \ingroup PkgPointSetProcessing3IO + \ingroup IOstreamFunctions \brief reads the point set from an input file. @@ -120,4 +118,4 @@ bool read_points(const std::string& fname, OutputIterator output, const NamedPar } } // namespace CGAL::IO -#endif // CGAL_POINT_SET_PROCESSING_READ_POINTS_H +#endif // CGAL_STREAM_SUPPORT_IO_READ_POINTS_H diff --git a/Stream_support/include/CGAL/IO/read_xyz_points.h b/Stream_support/include/CGAL/IO/read_xyz_points.h new file mode 100644 index 000000000000..200c738de91a --- /dev/null +++ b/Stream_support/include/CGAL/IO/read_xyz_points.h @@ -0,0 +1,18 @@ +// Copyright (c) 2017 GeometryFactory +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + + +#ifndef CGAL_IO_READ_XYZ_POINTS_H +#define CGAL_IO_READ_XYZ_POINTS_H + +#include + +#endif // CGAL_IO_READ_XYZ_POINTS_H + diff --git a/Stream_support/include/CGAL/IO/write_las_points.h b/Stream_support/include/CGAL/IO/write_las_points.h new file mode 100644 index 000000000000..aad6f7090b8a --- /dev/null +++ b/Stream_support/include/CGAL/IO/write_las_points.h @@ -0,0 +1,17 @@ +// Copyright (c) 2017 GeometryFactory +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + + +#ifndef CGAL_IO_WRITE_LAS_POINTS_H +#define CGAL_IO_WRITE_LAS_POINTS_H + +#include + +#endif // CGAL_IO_WRITE_LAS_POINTS_H diff --git a/Stream_support/include/CGAL/IO/write_off_points.h b/Stream_support/include/CGAL/IO/write_off_points.h new file mode 100644 index 000000000000..29be8d731b12 --- /dev/null +++ b/Stream_support/include/CGAL/IO/write_off_points.h @@ -0,0 +1,17 @@ +// Copyright (c) 2017 GeometryFactory +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + + +#ifndef CGAL_IO_WRITE_OFF_POINTS_H +#define CGAL_IO_WRITE_OFF_POINTS_H + +#include + +#endif // CGAL_IO_WRITE_OFF_POINTS_H diff --git a/Stream_support/include/CGAL/IO/write_ply_points.h b/Stream_support/include/CGAL/IO/write_ply_points.h new file mode 100644 index 000000000000..7815c1c91274 --- /dev/null +++ b/Stream_support/include/CGAL/IO/write_ply_points.h @@ -0,0 +1,12 @@ +// Copyright (c) 2017 GeometryFactory +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + + +#include diff --git a/Point_set_processing_3/include/CGAL/IO/write_points.h b/Stream_support/include/CGAL/IO/write_points.h similarity index 87% rename from Point_set_processing_3/include/CGAL/IO/write_points.h rename to Stream_support/include/CGAL/IO/write_points.h index 1cdec2844755..ffa1a1189e5d 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_points.h +++ b/Stream_support/include/CGAL/IO/write_points.h @@ -1,26 +1,23 @@ // Copyright (c) 2020 Geometry Factory -// All rights reserved. // -// This file is part of CGAL (www.cgal.org). +// This file is part of CGAL (www.cgal.org); // // $URL$ // $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Maxime Gimeno -#ifndef CGAL_POINT_SET_PROCESSING_WRITE_POINTS_H -#define CGAL_POINT_SET_PROCESSING_WRITE_POINTS_H - -#include +#ifndef CGAL_STREAM_SUPPORT_IO_WRITE_POINTS_H +#define CGAL_STREAM_SUPPORT_IO_WRITE_POINTS_H #include -#include -#include -#include +#include +#include +#include #ifdef CGAL_LINKED_WITH_LASLIB -#include +#include #endif #include @@ -31,7 +28,7 @@ namespace CGAL { namespace IO { /** - \ingroup PkgPointSetProcessing3IO + \ingroup IOstreamFunctions \brief writes the range of `points` with properties to a file. @@ -115,4 +112,4 @@ bool write_points(const std::string& fname, } } // namespace CGAL::IO -#endif // CGAL_POINT_SET_PROCESSING_WRITE_POINTS_H +#endif // CGAL_STREAM_SUPPORT_IO_WRITE_POINTS_H diff --git a/Stream_support/include/CGAL/IO/write_xyz_points.h b/Stream_support/include/CGAL/IO/write_xyz_points.h new file mode 100644 index 000000000000..9884f00f833f --- /dev/null +++ b/Stream_support/include/CGAL/IO/write_xyz_points.h @@ -0,0 +1,17 @@ +// Copyright (c) 2017 GeometryFactory +// +// This file is part of CGAL (www.cgal.org); +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Simon Giraudot + + +#ifndef CGAL_IO_WRITE_XYZ_POINTS_H +#define CGAL_IO_WRITE_XYZ_POINTS_H + +#include + +#endif // CGAL_IO_WRITE_XYZ_POINTS_H diff --git a/Stream_support/test/Stream_support/issue8155.cpp b/Stream_support/test/Stream_support/issue8155.cpp index 342cfe5979cf..de351406cc72 100644 --- a/Stream_support/test/Stream_support/issue8155.cpp +++ b/Stream_support/test/Stream_support/issue8155.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include diff --git a/Triangulation_3/examples/Triangulation_3/segment_simplex_traverser_3.cpp b/Triangulation_3/examples/Triangulation_3/segment_simplex_traverser_3.cpp index b8f12d340c02..f78c5dc6bb0b 100644 --- a/Triangulation_3/examples/Triangulation_3/segment_simplex_traverser_3.cpp +++ b/Triangulation_3/examples/Triangulation_3/segment_simplex_traverser_3.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #define CGAL_TRIANGULATION_3_VERBOSE_TRAVERSER_EXAMPLE diff --git a/Triangulation_3/test/Triangulation_3/test_simplex_iterator_3.cpp b/Triangulation_3/test/Triangulation_3/test_simplex_iterator_3.cpp index 8e18a5eeeb47..3bfbe9f3349f 100644 --- a/Triangulation_3/test/Triangulation_3/test_simplex_iterator_3.cpp +++ b/Triangulation_3/test/Triangulation_3/test_simplex_iterator_3.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include // Define the kernel.