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 53a1a22b2cf..165c589e139 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 diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index ff17f202bba..60bd2eaf452 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -332,6 +332,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/Stream_support/include/CGAL/IO/OFF/read_off_points.h b/Stream_support/include/CGAL/IO/OFF/read_off_points.h index 1fa73a51588..325e52f4413 100644 --- a/Stream_support/include/CGAL/IO/OFF/read_off_points.h +++ b/Stream_support/include/CGAL/IO/OFF/read_off_points.h @@ -24,10 +24,12 @@ #include #include #include +#include #include #include + #include #include #include @@ -38,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 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; @@ -197,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 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); diff --git a/Stream_support/include/CGAL/IO/OFF/write_off_points.h b/Stream_support/include/CGAL/IO/OFF/write_off_points.h index 7e2d7ddd8fc..4c8539c9aca 100644 --- a/Stream_support/include/CGAL/IO/OFF/write_off_points.h +++ b/Stream_support/include/CGAL/IO/OFF/write_off_points.h @@ -13,8 +13,8 @@ // // Author(s) : Pierre Alliez and Laurent Saboret -#ifndef CGAL_IO_PLY_WRITE_OFF_POINTS_H -#define CGAL_IO_PLY_WRITE_OFF_POINTS_H +#ifndef CGAL_IO_OFF_WRITE_OFF_POINTS_H +#define CGAL_IO_OFF_WRITE_OFF_POINTS_H #include #include @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -87,110 +88,24 @@ bool write_OFF_PSP(std::ostream& os, 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. -*/ +// // doxygen in ../OFF.h 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 + const CGAL_NP_CLASS& np, + std::enable_if_t::value>* #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 -*/ +// // doxygen in ../OFF.h 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 + const CGAL_NP_CLASS& np, std::enable_if_t::value>* ) { std::ofstream os(filename); @@ -202,4 +117,4 @@ bool write_OFF(const std::string& filename, } // namespace CGAL -#endif // CGAL_IO_PLY_WRITE_OFF_POINTS_H +#endif // CGAL_IO_OFF_WRITE_OFF_POINTS_H diff --git a/Stream_support/include/CGAL/IO/read_off_points.h b/Stream_support/include/CGAL/IO/read_off_points.h index 2f067034b69..24a3edc4716 100644 --- a/Stream_support/include/CGAL/IO/read_off_points.h +++ b/Stream_support/include/CGAL/IO/read_off_points.h @@ -8,5 +8,9 @@ // // Author(s) : Simon Giraudot -#include +#ifndef CGAL_IO_READ_OFF_POINTS_H +#define CGAL_IO_READ_OFF_POINTS_H +#include + +#endif // CGAL_IO_READ_OFF_POINTS_H