From 03487c4ce51bd784c7213558c9dba8b6a6d45c7f Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 11 May 2020 14:12:14 +0200 Subject: [PATCH] WIP Point_set --- .../include/CGAL/Point_set_3/point_set_io.h | 42 ++++- .../include/CGAL/IO/read_las_points.h | 146 +++++++++++++++++- .../include/CGAL/IO/read_off_points.h | 136 +++++++++++++--- .../include/CGAL/IO/read_ply_points.h | 111 ++++++++++++- .../include/CGAL/IO/read_points.h | 115 ++++++++++++++ .../include/CGAL/IO/read_xyz_points.h | 133 ++++++++++++++-- .../data/read_test/pig_points.las | Bin 0 -> 16139 bytes .../test/Point_set_processing_3/read_test.cpp | 20 ++- Stream_support/include/CGAL/IO/PLY.h | 16 +- 9 files changed, 665 insertions(+), 54 deletions(-) create mode 100644 Point_set_processing_3/include/CGAL/IO/read_points.h create mode 100644 Point_set_processing_3/test/Point_set_processing_3/data/read_test/pig_points.las diff --git a/Point_set_3/include/CGAL/Point_set_3/point_set_io.h b/Point_set_3/include/CGAL/Point_set_3/point_set_io.h index 0d3379fc0e6..3363b62402c 100644 --- a/Point_set_3/include/CGAL/Point_set_3/point_set_io.h +++ b/Point_set_3/include/CGAL/Point_set_3/point_set_io.h @@ -17,31 +17,61 @@ namespace CGAL { + template + typename Vector, + typename NamedParameters> bool read_point_set(const std::string& fname, - CGAL::Point_set_3& ps) + CGAL::Point_set_3& ps, + const NamedParameters& np) { if (fname.find(".xyz") != std::string::npos) { - return read_XYZ(fname, ps); + return read_XYZ(fname, ps, np); } if (fname.find(".off") != std::string::npos) { - return read_OFF(fname, ps); + return read_OFF(fname, ps, np); } if (fname.find(".ply") != std::string::npos) { - return read_PLY(fname, ps); + return read_PLY(fname, ps, np); } #ifdef CGAL_LINKED_WITH_LASLIB if (fname.find(".las") != std::string::npos) { - return read_LAS(fname, ps); + return read_LAS(fname, ps, np); } #endif return false; } +template +bool read_point_set(const std::string& fname, + CGAL::Point_set_3& ps) +{ + return read_point_set(fname, ps, parameters::all_default()); +} + +template +bool read_point_set(const char* fname, + CGAL::Point_set_3& ps, + const NamedParameters& np) +{ + return read_point_set(std::string(fname), + ps, + np); +} + +template +bool read_point_set(const char* fname, + CGAL::Point_set_3& ps) +{ + return read_point_set(fname, ps, parameters::all_default()); +} template diff --git a/Point_set_processing_3/include/CGAL/IO/read_las_points.h b/Point_set_processing_3/include/CGAL/IO/read_las_points.h index 767f1ead43a..30b1d640192 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_las_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_las_points.h @@ -470,7 +470,24 @@ bool read_LAS(std::istream& stream, } /// \cond SKIP_IN_MANUAL -// variant with default NP +template < typename OutputIterator, + #ifdef DOXYGEN_RUNNING + typename NamedParameters + #else + typename CGAL_BGL_NP_TEMPLATE_PARAMETERS + #endif + > +bool read_LAS(std::istream& stream, + OutputIterator output, + #ifdef DOXYGEN_RUNNING + const NamedParameters& np) +#else + const CGAL_BGL_NP_CLASS& np) +#endif +{ + return read_LAS_with_properties(stream, output, np); +} +// variants with default NP template bool @@ -482,7 +499,23 @@ read_LAS( (stream, output, CGAL::parameters::all_default()); } -// variant with default output iterator value type +template < typename OutputIteratorValueType, + typename OutputIterator> +bool read_LAS(const std::string& fname, + OutputIterator output) +{ + return read_LAS(fname, output, parameters::all_default()); +} + +template < typename OutputIteratorValueType, + typename OutputIterator> +bool read_LAS(const char* fname, + OutputIterator output) +{ + return read_LAS(fname, output, parameters::all_default()); +} + +// variants with default output iterator value type template bool @@ -495,20 +528,119 @@ read_LAS( (stream, output, np); } -// variant with default NP and output iterator value type +template +bool read_LAS(const char* fname, + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) +{ + std::ifstream is(fname); + return read_LAS::type>(is, output, np); +} + +template +bool read_LAS(const std::string& fname, + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) +{ + return read_LAS::type>(fname.c_str(), output, np); +} + +// variants with default NP and output iterator value type template bool read_LAS( std::istream& stream, ///< input stream. - OutputIterator output, - typename boost::enable_if< - typename CGAL::is_iterator - >::type* =0) + OutputIterator output) { return read_LAS::type> (stream, output, CGAL::parameters::all_default()); } +template < typename OutputIterator> +bool read_LAS(const std::string& fname, + OutputIterator output) +{ + return read_LAS::type>(fname, output, parameters::all_default()); +} + +template +bool read_LAS(const char* fname, + OutputIterator output) +{ + return read_LAS::type>(fname, output, parameters::all_default()); +} + + +/** + \ingroup PkgPointSetProcessing3IOLas + Reads points (position only) from a .las or .laz file. + Potential additional properties are ignored. + + \tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`. + It is default to `value_type_traits::%type` and can be omitted when the default is fine. + \tparam OutputIterator iterator over output points. + + \param stream input stream. + \param output output iterator over points. + + \param np optional sequence of \ref psp_namedparameters "Named Parameters" among the ones listed below. + + \cgalNamedParamsBegin + \cgalParamBegin{point_map} a model of `WritablePropertyMap` with value type `geom_traits::Point_3`. + If this parameter is omitted, `CGAL::Identity_property_map` is used.\cgalParamEnd + \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd + \cgalNamedParamsEnd + + \return true on success. + + \cgalRequiresCPP11 +*/ +template < typename OutputIteratorValueType, + typename OutputIterator, + #ifdef DOXYGEN_RUNNING + typename NamedParameters + #else + typename CGAL_BGL_NP_TEMPLATE_PARAMETERS + #endif + > +bool read_LAS(const char* fname, + OutputIterator output, + #ifdef DOXYGEN_RUNNING + const NamedParameters& np) +#else + const CGAL_BGL_NP_CLASS& np) +#endif +{ + std::ifstream is(fname); + return read_LAS(is, output, np); +} + +template < typename OutputIteratorValueType, + typename OutputIterator> +bool read_LAS(const char* fname, + OutputIterator output) +{ + return read_LAS(fname, output, parameters::all_default()); +} + +template < typename OutputIteratorValueType, + typename OutputIterator, + typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> +bool read_LAS(const std::string& fname, + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) +{ + return read_LAS(fname.c_str(), output, np); +} + +template < typename OutputIteratorValueType, + typename OutputIterator> +bool read_LAS(const std::string& fname, + OutputIterator output) +{ + return read_LAS(fname, output, parameters::all_default()); +} + #ifndef CGAL_NO_DEPRECATED_CODE // deprecated API template < typename OutputIteratorValueType, diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index 7f94bd0c25a..317faf6c726 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -185,47 +185,147 @@ read_OFF( return true; } + +/** + \ingroup PkgPointSetProcessing3IO + Reads points (positions + normals, if available) from a .off ASCII file. + The function expects for each point a line with the x y z position, + optionally followed by the nx ny nz normal. + Faces are ignored. + + \tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`. + It is default to `value_type_traits::%type` and can be omitted when the default is fine. + \tparam OutputIterator iterator over output points. + + \param stream input stream. + \param output output iterator over points. + \param np optional sequence of \ref psp_namedparameters "Named Parameters" among the ones listed below. + + \cgalNamedParamsBegin + \cgalParamBegin{point_map} a model of `WritablePropertyMap` with value type `geom_traits::Point_3`. + If this parameter is omitted, `CGAL::Identity_property_map` is used.\cgalParamEnd + \cgalParamBegin{normal_map} a model of `ReadWritePropertyMap` with value type + `geom_traits::Vector_3`. If this parameter is omitted, normals in the input stream are + ignored.\cgalParamEnd + \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd + \cgalNamedParamsEnd + + \return true on success. +*/ +template < typename OutputIteratorValueType, + typename OutputIterator, + #ifdef DOXYGEN_RUNNING + typename NamedParameters + #else + typename CGAL_BGL_NP_TEMPLATE_PARAMETERS + #endif + > +bool read_OFF(const char* fname, + OutputIterator output, + #ifdef DOXYGEN_RUNNING + const NamedParameters& np) +#else + const CGAL_BGL_NP_CLASS& np) +#endif +{ + std::ifstream is(fname); + return read_OFF(is, output, np); +} + +template < typename OutputIteratorValueType, + typename OutputIterator, + typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> +bool read_OFF(const std::string& fname, + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) +{ + return read_OFF(fname.c_str(), output, np); +} + + + /// \cond SKIP_IN_MANUAL -// variant with default NP +// variants with default NP template bool read_OFF( - std::istream& stream, ///< input stream. - OutputIterator output) ///< output iterator over points. + std::istream& stream, ///< input stream. + OutputIterator output) ///< output iterator over points. { return read_OFF - (stream, output, CGAL::parameters::all_default()); + (stream, output, CGAL::parameters::all_default()); } -// variant with default output iterator value type +template < typename OutputIteratorValueType, + typename OutputIterator> +bool read_OFF(const std::string& fname, + OutputIterator output) +{ + return read_OFF(fname, output, parameters::all_default()); +} + +template < typename OutputIteratorValueType, + typename OutputIterator> +bool read_OFF(const char* fname, + OutputIterator output) +{ + return read_OFF(fname, output, parameters::all_default()); +} + +// variants with default output iterator value type template bool read_OFF( - std::istream& stream, ///< input stream. - OutputIterator output, - const CGAL_BGL_NP_CLASS& np, - typename boost::enable_if< - CGAL::is_iterator - >::type* =0) + std::istream& stream, ///< input stream. + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) { return read_OFF::type> - (stream, output, np); + (stream, output, np); } -// variant with default NP and output iterator value type +template +bool read_OFF(const char* fname, + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) +{ + std::ifstream is(fname); + return read_OFF::type>(is, output, np); +} + +template +bool read_OFF(const std::string& fname, + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) +{ + return read_OFF::type>(fname.c_str(), output, np); +} + +// variants with default NP and output iterator value type template bool read_OFF( std::istream& stream, ///< input stream. - OutputIterator output, - typename std::enable_if< - CGAL::is_iterator::value - >::type* =0) + OutputIterator output) { return read_OFF::type> - (stream, output, CGAL::parameters::all_default()); + (stream, output, CGAL::parameters::all_default()); +} + +template < typename OutputIterator> +bool read_OFF(const std::string& fname, + OutputIterator output) +{ + return read_OFF::type>(fname, output, parameters::all_default()); +} + +template +bool read_OFF(const char* fname, + OutputIterator output) +{ + return read_OFF::type>(fname, output, parameters::all_default()); } #ifndef CGAL_NO_DEPRECATED_CODE 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 index 9e2af3ff171..bae313af0cc 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h @@ -140,7 +140,7 @@ bool read_PLY_with_properties (std::istream& stream, return false; } - IO::internal::PLY_reader reader; + IO::internal::PLY_reader reader(true); if (!(reader.init (stream))) { @@ -256,9 +256,65 @@ bool read_PLY(std::istream& stream, make_ply_point_reader (point_map)); } +/** + \ingroup PkgPointSetProcessing3IOPly + Reads points (positions + normals, if available) from a .ply + file (ASCII or binary). + Potential additional point properties and faces are ignored. + + \tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`. + It is default to `value_type_traits::%type` and can be omitted when the default is fine. + \tparam OutputIterator iterator over output points. + + \param stream input stream. + \param output output iterator over points. + \param np optional sequence of \ref psp_namedparameters "Named Parameters" among the ones listed below. + + \cgalNamedParamsBegin + \cgalParamBegin{point_map} a model of `WritablePropertyMap` with value type `geom_traits::Point_3`. + If this parameter is omitted, `CGAL::Identity_property_map` is used.\cgalParamEnd + \cgalParamBegin{normal_map} a model of `ReadWritePropertyMap` with value type + `geom_traits::Vector_3`. If this parameter is omitted, normals in the input stream are + ignored.\cgalParamEnd + \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd + \cgalNamedParamsEnd + + \return true on success. + + \cgalRequiresCPP11 +*/ +template < typename OutputIteratorValueType, + typename OutputIterator, + #ifdef DOXYGEN_RUNNING + typename NamedParameters + #else + typename CGAL_BGL_NP_TEMPLATE_PARAMETERS + #endif + > +bool read_PLY(const char* fname, + OutputIterator output, + #ifdef DOXYGEN_RUNNING + const NamedParameters& np) +#else + const CGAL_BGL_NP_CLASS& np) +#endif +{ + std::ifstream is(fname); + return read_PLY(is, output, np); +} + +template < typename OutputIteratorValueType, + typename OutputIterator, + typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> +bool read_PLY(const std::string& fname, + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) +{ + return read_PLY(fname.c_str(), output, np); +} /// \cond SKIP_IN_MANUAL -// variant with default NP +// variants with default NP template bool @@ -270,7 +326,23 @@ read_PLY( (stream, output, CGAL::parameters::all_default()); } -// variant with default output iterator value type +template < typename OutputIteratorValueType, + typename OutputIterator> +bool read_PLY(const std::string& fname, + OutputIterator output) +{ + return read_PLY(fname, output, parameters::all_default()); +} + +template < typename OutputIteratorValueType, + typename OutputIterator> +bool read_PLY(const char* fname, + OutputIterator output) +{ + return read_PLY(fname, output, parameters::all_default()); +} + +// variants with default output iterator value type template bool @@ -283,7 +355,24 @@ read_PLY( (stream, output, np); } -// variant with default NP and output iterator value type +template +bool read_PLY(const char* fname, + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) +{ + std::ifstream is(fname); + return read_PLY::type>(is, output, np); +} + +template +bool read_PLY(const std::string& fname, + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) +{ + return read_PLY::type>(fname.c_str(), output, np); +} + +// variants with default NP and output iterator value type template bool read_PLY( @@ -294,6 +383,20 @@ read_PLY( (stream, output, CGAL::parameters::all_default()); } +template < typename OutputIterator> +bool read_PLY(const std::string& fname, + OutputIterator output) +{ + return read_PLY::type>(fname, output, parameters::all_default()); +} + +template +bool read_PLY(const char* fname, + OutputIterator output) +{ + return read_PLY::type>(fname, output, parameters::all_default()); +} + #ifndef CGAL_NO_DEPRECATED_CODE // deprecated API template < typename OutputIteratorValueType, diff --git a/Point_set_processing_3/include/CGAL/IO/read_points.h b/Point_set_processing_3/include/CGAL/IO/read_points.h new file mode 100644 index 00000000000..a13c1d1c65b --- /dev/null +++ b/Point_set_processing_3/include/CGAL/IO/read_points.h @@ -0,0 +1,115 @@ +// Copyright (c) 2020 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) : Maxime Gimeno +#ifndef CGAL_READ_POINTS_H +#define CGAL_READ_POINTS_H + +#ifdef CGAL_LINKED_WITH_LASLIB +#include +#endif +#include +#include +#include + +namespace CGAL { + +template +bool read_points(const std::string& fname, + OutputIterator output, + const NamedParameters& np) +{ + if (fname.find(".xyz") != std::string::npos) { + return read_XYZ(fname, output, np); + } + + if (fname.find(".off") != std::string::npos) { + return read_OFF(fname, output, np); + } + + if (fname.find(".ply") != std::string::npos) { + return read_PLY(fname, output, np); + } + +#ifdef CGAL_LINKED_WITH_LASLIB + if (fname.find(".las") != std::string::npos) { + return read_LASfname, output, np); + } +#endif + return false; +} + +//variant with default OutputIteratorType +template +bool read_points(const std::string& fname, + OutputIterator output, + const NamedParameters& np) +{ + return read_points::type>(fname, output, np); +} + +//variant with default np +template +bool read_points(const std::string& fname, + OutputIterator output) +{ + return read_points(fname, output, parameters::all_default()); +} + +//variant with all default +template +bool read_points(const std::string& fname, + OutputIterator output) +{ + return read_points::type>(fname, output, parameters::all_default()); +} + + +//variants with char* + +template +bool read_points(const char* fname, + OutputIterator output, + const NamedParameters& np) +{ + return read_points(std::string(fname), output, np); +} + +template +bool read_points(const char* fname, + OutputIterator output, + const NamedParameters& np) +{ + return read_points::type>(fname, output, np); +} + +template +bool read_points(const char* fname, + OutputIterator output) +{ + return read_points(fname, output, parameters::all_default()); +} + +template +bool read_points(const char* fname, + OutputIterator output) +{ + return read_points::type>(fname, output, parameters::all_default()); +} +}//end CGAL + +#endif // CGAL_READ_POINTS_H diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index ed627dc1c02..86088d934ee 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -174,44 +174,145 @@ read_XYZ( return true; } +/** + \ingroup PkgPointSetProcessing3IO + Reads points (positions + normals, if available) from a .xyz ASCII file. + The function expects for each point a line with the x y z position, + optionally followed by the nx ny nz normal. + The first line may contain the number of points in the file. + Empty lines and comments starting by # character are allowed. + + \tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`. + It is default to `value_type_traits::%type` and can be omitted when the default is fine. + \tparam OutputIterator iterator over output points. + + \param stream input stream. + \param output output iterator over points. + \param np optional sequence of \ref psp_namedparameters "Named Parameters" among the ones listed below. + + \cgalNamedParamsBegin + \cgalParamBegin{point_map} a model of `WritablePropertyMap` with value type `geom_traits::Point_3`. + If this parameter is omitted, `CGAL::Identity_property_map` is used.\cgalParamEnd + \cgalParamBegin{normal_map} a model of `ReadWritePropertyMap` with value type + `geom_traits::Vector_3`. If this parameter is omitted, normals in the input stream are + ignored.\cgalParamEnd + \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd + \cgalNamedParamsEnd + + \return true on success. +*/ +template < typename OutputIteratorValueType, + typename OutputIterator, + #ifdef DOXYGEN_RUNNING + typename NamedParameters + #else + typename CGAL_BGL_NP_TEMPLATE_PARAMETERS + #endif + > +bool read_XYZ(const char* fname, + OutputIterator output, + #ifdef DOXYGEN_RUNNING + const NamedParameters& np) +#else + const CGAL_BGL_NP_CLASS& np) +#endif +{ + std::ifstream is(fname); + return read_XYZ(is, output, np); +} + /// \cond SKIP_IN_MANUAL -// variant with default NP +template < typename OutputIteratorValueType, + typename OutputIterator, + typename CGAL_BGL_NP_TEMPLATE_PARAMETERS + > +bool read_XYZ(const std::string& fname, + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) +{ + return read_XYZ(fname.c_str(), output, np); +} +// variants with default NP template bool read_XYZ( - std::istream& stream, ///< input stream. - OutputIterator output) ///< output iterator over points. + std::istream& stream, ///< input stream. + OutputIterator output) ///< output iterator over points. { return read_XYZ - (stream, output, CGAL::parameters::all_default()); + (stream, output, CGAL::parameters::all_default()); } -// variant with default output iterator value type +template < typename OutputIteratorValueType, + typename OutputIterator> +bool read_XYZ(const std::string& fname, + OutputIterator output) +{ + return read_XYZ(fname, output, parameters::all_default()); +} + +template < typename OutputIteratorValueType, + typename OutputIterator> +bool read_XYZ(const char* fname, + OutputIterator output) +{ + return read_XYZ(fname, output, parameters::all_default()); +} + +// variants with default output iterator value type template bool read_XYZ( - std::istream& stream, ///< input stream. - OutputIterator output, - const CGAL_BGL_NP_CLASS& np) + std::istream& stream, ///< input stream. + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) { return read_XYZ::type> - (stream, output, np); + (stream, output, np); } -// variant with default NP and output iterator value type +template +bool read_XYZ(const char* fname, + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) +{ + std::ifstream is(fname); + return read_XYZ::type>(is, output, np); +} + +template +bool read_XYZ(const std::string& fname, + OutputIterator output, + const CGAL_BGL_NP_CLASS& np) +{ + return read_XYZ::type>(fname.c_str(), output, np); +} + +// variants with default NP and output iterator value type template bool read_XYZ( - std::istream& stream, ///< input stream. - OutputIterator output, - typename boost::enable_if< - CGAL::is_iterator - >::type* =0) + std::istream& stream, ///< input stream. + OutputIterator output) { return read_XYZ::type> - (stream, output, CGAL::parameters::all_default()); + (stream, output, CGAL::parameters::all_default()); +} + +template < typename OutputIterator> +bool read_XYZ(const std::string& fname, + OutputIterator output) +{ + return read_XYZ::type>(fname, output, parameters::all_default()); +} + +template +bool read_XYZ(const char* fname, + OutputIterator output) +{ + return read_XYZ::type>(fname, output, parameters::all_default()); } #ifndef CGAL_NO_DEPRECATED_CODE diff --git a/Point_set_processing_3/test/Point_set_processing_3/data/read_test/pig_points.las b/Point_set_processing_3/test/Point_set_processing_3/data/read_test/pig_points.las new file mode 100644 index 0000000000000000000000000000000000000000..07904d3c5c1720e51235a3e84dc505de2c0259ba GIT binary patch literal 16139 zcmaJ|dpy(szn}YM7c-1)c4OGE3!BZIF1ko=Mdi{(ltQH|sYK|TqDV!#B!xt-Ns3ZZ ziY{(lL`jGerQFl`b}oON&+E5;_OLx4@AvEad|f`{G;hTs6v9hNI(Un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QeRts#Eq9#y{s zWJ9{}HmRr~P`ur+9GGv%&gZBdn!PAKp)Uk($uqXaU#{&Y+b^dB`SRl3L+zHsyU_}f zH2_;S5xp>nY;i=P?*gEMO?V@vRUe)tTcnr*)R*np1T1Uq9xBxb`rm}~il@Bp&H*iw zKh)Fh*|u9{j4)|%M&%EXb00U&8qlY9Sgu|a19anl4Z5nz=Q)P{Jx74~)`Pr{zqq?d zpnJ9s=yI;V9ndA``V#ZC`hZ*L4gK8x`xc=;)m|_{W?ZQ=1LP~14cxZ_I>650`L}my znSu491W^yb{C;gw%1M>EVl^M=saHvi3eB4Q)vO?=0$B_cO715k+bddmz{eBtzT{Oo zrDzXT}G<^c+b+_ zwU!Mq?xVO7Bi)y&w9`NOfC|+7YX*~$*C~|aIs$&N-L~6ECs0cF>SP&E=M2lE=mY-yzX=M7_Dm57kzqp)NY?C&u2ZtFPr({KB ztEaD0S2|U0u9Xq12 #include #include +#include #include -#include +#include +#include #include #include @@ -62,6 +64,15 @@ bool read_ply (std::string s, normal_map(CGAL::Second_of_pair_property_map())); } +bool read_ps(std::string s) +{ + std::vector pv_pairs; + return CGAL::read_points(s, + std::back_inserter(pv_pairs), + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()). + normal_map(CGAL::Second_of_pair_property_map())); +} + int main() { std::cerr << "### There should be three errors following this line...\n"; @@ -110,5 +121,12 @@ int main() assert(pv_pairs[1] == std::make_pair(Point_3(3,3,3), Vector_3(4,4,4))); assert(pv_pairs[2] == std::make_pair(Point_3(5,5,5), Vector_3(6,6,6))); + assert(read_ps("data/read_test/ok_1.xyz")); + assert(read_ps("data/read_test/ok_1.off")); + assert(read_ps("data/read_test/simple.ply")); + #ifdef CGAL_LINKED_WITH_LASLIB + assert(read_ps("data/read_test/pig_points.las")); +#endif + return 0; } diff --git a/Stream_support/include/CGAL/IO/PLY.h b/Stream_support/include/CGAL/IO/PLY.h index 68c3315c0ba..69ad33210b7 100644 --- a/Stream_support/include/CGAL/IO/PLY.h +++ b/Stream_support/include/CGAL/IO/PLY.h @@ -381,7 +381,13 @@ bool read_PLY(const char* fname, template bool read_PLY(const char* fname, PointRange& points, - PolygonRange& polygons) + PolygonRange& polygons + #ifndef DOXYGEN_RUNNING + ,typename std::enable_if< + CGAL::is_iterator::value + >::type* =0 + #endif + ) { return read_PLY(fname, points, polygons, parameters::all_default()); } @@ -399,7 +405,13 @@ bool read_PLY(const std::string& fname, template bool read_PLY(const std::string fname, PointRange& points, - PolygonRange& polygons) + PolygonRange& polygons + #ifndef DOXYGEN_RUNNING + ,typename std::enable_if< + CGAL::is_iterator::value + >::type* =0 + #endif + ) { return read_PLY(fname, points, polygons, parameters::all_default()); }