rename IO functions in point_set packages

This commit is contained in:
Maxime Gimeno 2020-03-30 17:06:48 +02:00
parent 8a535e5e55
commit 69a2a23cc6
67 changed files with 1395 additions and 759 deletions

View File

@ -115,7 +115,7 @@ int main (int argc, char* argv[])
std::ifstream stream(fname); std::ifstream stream(fname);
if (!stream || if (!stream ||
!CGAL::read_xyz_points(stream, !CGAL::read_XYZ(stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map()))) normal_map(Normal_map())))

View File

@ -53,7 +53,7 @@ int main (int argc, char** argv)
std::cerr << "Reading input" << std::endl; std::cerr << "Reading input" << std::endl;
if (!in if (!in
|| !(CGAL::read_ply_points (in, std::back_inserter (pts)))) || !(CGAL::read_PLY (in, std::back_inserter (pts))))
{ {
std::cerr << "Error: cannot read " << filename << std::endl; std::cerr << "Error: cannot read " << filename << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -72,7 +72,7 @@ int main (int argc, char** argv)
std::cerr << "Reading input" << std::endl; std::cerr << "Reading input" << std::endl;
if (!in if (!in
|| !(CGAL::read_ply_points (in, std::back_inserter (pts)))) || !(CGAL::read_PLY_points (in, std::back_inserter (pts))))
{ {
std::cerr << "Error: cannot read " << filename << std::endl; std::cerr << "Error: cannot read " << filename << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -16,7 +16,7 @@ int main (int argc, char** argv)
Point_set point_set; Point_set point_set;
// Reading input in XYZ format // Reading input in XYZ format
if (!f || !CGAL::read_xyz_point_set (f, point_set)) if (!f || !CGAL::read_XYZ (f, point_set))
{ {
std::cerr<<"Can't read input file " std::cerr<<"Can't read input file "
<<(argc > 1 ? argv[1] : "data/oni.xyz")<< std::endl; <<(argc > 1 ? argv[1] : "data/oni.xyz")<< std::endl;

View File

@ -19,7 +19,7 @@ int main (int argc, char** argv)
Point_set point_set; Point_set point_set;
if (!f || !CGAL::read_ply_point_set (f, point_set)) // same as `f >> point_set` if (!f || !CGAL::read_PLY (f, point_set)) // same as `f >> point_set`
{ {
std::cerr << "Can't read input file " << std::endl; std::cerr << "Can't read input file " << std::endl;
} }

View File

@ -19,7 +19,7 @@ int main (int argc, char** argv)
Point_set point_set; Point_set point_set;
// Reading input in XYZ format // Reading input in XYZ format
if (!f || !CGAL::read_xyz_point_set (f, point_set)) if (!f || !CGAL::read_XYZ (f, point_set))
{ {
std::cerr << "Can't read input file " << std::endl; std::cerr << "Can't read input file " << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
@ -39,7 +39,7 @@ int main (int argc, char** argv)
// Writing result in OFF format // Writing result in OFF format
std::ofstream out("normalized_normals.off"); std::ofstream out("normalized_normals.off");
out.precision(17); out.precision(17);
if (!out || !CGAL::write_off_point_set (out, point_set)) if (!out || !CGAL::write_OFF (out, point_set))
{ {
return EXIT_FAILURE; return EXIT_FAILURE;
} }

View File

@ -29,8 +29,12 @@
#include <CGAL/IO/PLY.h> #include <CGAL/IO/PLY.h>
namespace CGAL { namespace CGAL {
namespace IO {
namespace internal { namespace IO
{
namespace internal
{
template <typename Point, template <typename Point,
typename Vector = typename Kernel_traits<Point>::Kernel::Vector_3> typename Vector = typename Kernel_traits<Point>::Kernel::Vector_3>
@ -93,7 +97,7 @@ public:
for (std::size_t j = 0; j < element.number_of_properties(); ++ j) for (std::size_t j = 0; j < element.number_of_properties(); ++ j)
{ {
PLY_read_number* property = element.property(j); IO::internal::PLY_read_number* property = element.property(j);
const std::string& name = property->name(); const std::string& name = property->name();
if (name == "x" || if (name == "x" ||
@ -208,15 +212,16 @@ public:
} }
}; };
} // namespace internal }
} // namespace IO
}
/*! /*!
\ingroup PkgPointSet3IO \ingroup PkgPointSet3IO
*/ */
template <typename Point, typename Vector> template <typename Point, typename Vector>
bool bool
read_xyz_point_set( read_XYZ(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{ {
@ -248,13 +253,13 @@ read_xyz_point_set(
*/ */
template <typename Point, typename Vector> template <typename Point, typename Vector>
bool bool
read_off_point_set( read_OFF(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{ {
point_set.add_normal_map(); point_set.add_normal_map();
bool out = CGAL::read_off_points bool out = CGAL::read_OFF
(stream, (stream,
point_set.index_back_inserter(), point_set.index_back_inserter(),
CGAL::parameters::point_map(point_set.point_push_map()). CGAL::parameters::point_map(point_set.point_push_map()).
@ -279,12 +284,12 @@ read_off_point_set(
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
template <typename Point, typename Vector> template <typename Point, typename Vector>
bool bool
read_ply_point_set( read_PLY(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{ {
std::string dummy; std::string dummy;
return read_ply_point_set (stream, point_set, dummy); return read_PLY (stream, point_set, dummy);
} }
/// \endcond /// \endcond
@ -308,7 +313,7 @@ read_ply_point_set(
*/ */
template <typename Point, typename Vector> template <typename Point, typename Vector>
bool bool
read_ply_point_set( read_PLY(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set, ///< point set CGAL::Point_set_3<Point, Vector>& point_set, ///< point set
std::string& comments) ///< PLY comments. std::string& comments) ///< PLY comments.
@ -374,7 +379,7 @@ read_ply_point_set(
*/ */
template <typename Point, typename Vector> template <typename Point, typename Vector>
bool bool
write_ply_point_set( write_PLY(
std::ostream& stream, ///< output stream. std::ostream& stream, ///< output stream.
const CGAL::Point_set_3<Point, Vector>& point_set, ///< point set. const CGAL::Point_set_3<Point, Vector>& point_set, ///< point set.
const std::string& comments = std::string()) ///< PLY comments. const std::string& comments = std::string()) ///< PLY comments.
@ -598,7 +603,7 @@ namespace internal
*/ */
template <typename Point, typename Vector> template <typename Point, typename Vector>
bool bool
read_las_point_set( read_LAS(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{ {
@ -635,7 +640,7 @@ read_las_point_set(
Ushort_map I = point_set.template add_property_map<unsigned short>("I", 0).first; Ushort_map I = point_set.template add_property_map<unsigned short>("I", 0).first;
bool okay bool okay
= read_las_points_with_properties = read_LAS_with_properties
(stream, point_set.index_back_inserter(), (stream, point_set.index_back_inserter(),
make_las_point_reader (point_set.point_push_map()), make_las_point_reader (point_set.point_push_map()),
std::make_pair (point_set.push_property_map (intensity), LAS_property::Intensity()), std::make_pair (point_set.push_property_map (intensity), LAS_property::Intensity()),
@ -684,7 +689,7 @@ read_las_point_set(
*/ */
template <typename Point, typename Vector> template <typename Point, typename Vector>
bool bool
write_las_point_set( write_LAS(
std::ostream& stream, ///< output stream. std::ostream& stream, ///< output stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{ {
@ -810,7 +815,7 @@ write_las_point_set(
} }
bool okay bool okay
= write_las_points_with_properties = write_LAS
(stream, point_set, (stream, point_set,
make_las_point_writer (point_set.point_map()), make_las_point_writer (point_set.point_map()),
std::make_pair (intensity, LAS_property::Intensity()), std::make_pair (intensity, LAS_property::Intensity()),
@ -861,17 +866,17 @@ write_las_point_set(
*/ */
template <typename Point, typename Vector> template <typename Point, typename Vector>
bool bool
write_xyz_point_set( write_XYZ(
std::ostream& stream, ///< output stream. std::ostream& stream, ///< output stream.
const CGAL::Point_set_3<Point, Vector>& point_set) ///< point set const CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{ {
if (point_set.has_normal_map()) if (point_set.has_normal_map())
return CGAL::write_xyz_points return CGAL::write_XYZ
(stream, point_set, (stream, point_set,
CGAL::parameters::point_map(point_set.point_map()). CGAL::parameters::point_map(point_set.point_map()).
normal_map(point_set.normal_map())); normal_map(point_set.normal_map()));
return CGAL::write_xyz_points return CGAL::write_XYZ
(stream, point_set, (stream, point_set,
CGAL::parameters::point_map(point_set.point_map())); CGAL::parameters::point_map(point_set.point_map()));
} }
@ -881,17 +886,17 @@ write_xyz_point_set(
*/ */
template <typename Point, typename Vector> template <typename Point, typename Vector>
bool bool
write_off_point_set( write_OFF(
std::ostream& stream, ///< output stream. std::ostream& stream, ///< output stream.
const CGAL::Point_set_3<Point, Vector>& point_set) ///< point set const CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{ {
if (point_set.has_normal_map()) if (point_set.has_normal_map())
return CGAL::write_off_points return CGAL::write_OFF
(stream, point_set, (stream, point_set,
CGAL::parameters::point_map(point_set.point_map()). CGAL::parameters::point_map(point_set.point_map()).
normal_map(point_set.normal_map())); normal_map(point_set.normal_map()));
return CGAL::write_off_points return CGAL::write_OFF
(stream, point_set, (stream, point_set,
CGAL::parameters::point_map(point_set.point_map())); CGAL::parameters::point_map(point_set.point_map()));
} }
@ -924,15 +929,15 @@ std::istream& operator>>(std::istream& is,
is.seekg(0); is.seekg(0);
if (line.find("OFF") == 0 || line.find("NOFF") == 0) if (line.find("OFF") == 0 || line.find("NOFF") == 0)
CGAL::read_off_point_set (is, ps); CGAL::read_OFF (is, ps);
else if (line.find("ply") == 0) else if (line.find("ply") == 0)
CGAL::read_ply_point_set (is, ps); CGAL::read_PLY (is, ps);
#ifdef CGAL_LINKED_WITH_LASLIB #ifdef CGAL_LINKED_WITH_LASLIB
else if (line.find("LASF") == 0) else if (line.find("LASF") == 0)
CGAL::read_las_point_set (is, ps); CGAL::read_las_point_set (is, ps);
#endif // LAS #endif // LAS
else else
CGAL::read_xyz_point_set (is, ps); CGAL::read_XYZ (is, ps);
return is; return is;
} }
@ -954,7 +959,147 @@ std::ostream& operator<<(std::ostream& os,
return os; return os;
} }
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgPointSet3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::read_OFF()` should be used instead.
*/
template <typename Point, typename Vector>
CGAL_DEPRECATED bool
read_off_point_set(
std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
return read_OFF(stream, point_set);
}
/*!
\ingroup PkgPointSet3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::read_XYZ()` should be used instead.
*/
template <typename Point, typename Vector>
CGAL_DEPRECATED bool
read_xyz_point_set(
std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
return read_XYZ(stream, point_set);
}
/*!
\ingroup PkgPointSet3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::read_PLY()` should be used instead.
Reads a point set with properties from an input stream in Ascii or
Binary PLY format.
- the operator reads the vertex `point` property;
- if three PLY properties `nx`, `ny` and `nz` with type `float`
or `double` are found, the normal map is added;
- if any other PLY property is found, a "[name]" property map is
added, where `[name]` is the name of the PLY property.
The `comments` parameter can be omitted. If provided, it will be
used to store the potential comments found in the PLY
header. Each line starting by "comment " in the header is
appended to the `comments` string (without the "comment " word).
*/
template <typename Point, typename Vector>
CGAL_DEPRECATED bool
read_ply_point_set(
std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set, ///< point set
std::string& comments) ///< PLY comments.
{
return read_PLY(stream, point_set, comments);
}
/// \cond SKIP_IN_MANUAL
template <typename Point, typename Vector>
CGAL_DEPRECATED bool
read_ply_point_set(
std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
std::string dummy;
return read_PLY(stream, point_set, dummy);
}
/// \endcond
#if defined(CGAL_LINKED_WITH_LASLIB) || defined(DOXYGEN_RUNNING)
/*!
\ingroup PkgPointSet3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::read_LAS()` should be used instead.
*/
template <typename Point, typename Vector>
CGAL_DEPRECATED bool
read_las_point_set(
std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
return read_LAS(stream, point_set);
}
/*!
\ingroup PkgPointSet3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::write_OFF()` should be used instead.
*/
template <typename Point, typename Vector>
CGAL_DEPRECATED bool
write_las_point_set(
std::ostream& stream, ///< output stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
return write_LAS(stram, point_set);
}
#endif
/*!
\ingroup PkgPointSet3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::write_OFF()` should be used instead.
*/
template <typename Point, typename Vector>
CGAL_DEPRECATED bool
write_off_point_set(
std::ostream& stream, ///< output stream.
const CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
return write_OFF(stream, point_set);
}
/*!
\ingroup PkgPointSet3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::write_XYZ()` should be used instead.
*/
template <typename Point, typename Vector>
CGAL_DEPRECATED bool
write_xyz_point_set(
std::ostream& stream,
const CGAL::Point_set_3<Point, Vector>& point_set)
{
return write_XYZ(stream, point_set);
}
/*!
\ingroup PkgPointSet3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::write_PLY()` should be used instead.
*/
template <typename Point, typename Vector>
CGAL_DEPRECATED bool
write_ply_point_set(
std::ostream& stream,
const CGAL::Point_set_3<Point, Vector>& point_set,
const std::string& comments = std::string())
{
return write_PLY(stream, point_set, comments);
}
#endif //CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL

View File

@ -37,7 +37,7 @@ int main (int, char**)
test (point_set.has_normal_map(), "point set should have normals."); test (point_set.has_normal_map(), "point set should have normals.");
std::ifstream f ("data/oni.pwn"); std::ifstream f ("data/oni.pwn");
CGAL::read_xyz_point_set(f, point_set); CGAL::read_XYZ(f, point_set);
f.close (); f.close ();

View File

@ -28,7 +28,7 @@ int main(int argc, char*argv[])
std::vector<IndexedPointWithColorTuple> points; std::vector<IndexedPointWithColorTuple> points;
std::ifstream stream(fname); std::ifstream stream(fname);
if (!stream || if (!stream ||
!CGAL::read_xyz_points( !CGAL::read_XYZ(
stream, std::back_inserter(points), stream, std::back_inserter(points),
CGAL::parameters::point_map(CGAL::Nth_of_tuple_property_map<1,IndexedPointWithColorTuple>()))) CGAL::parameters::point_map(CGAL::Nth_of_tuple_property_map<1,IndexedPointWithColorTuple>())))
{ {

View File

@ -28,7 +28,7 @@ int main(int argc, char*argv[])
std::vector<PointVectorPair> points; std::vector<PointVectorPair> points;
std::ifstream stream(input_filename); std::ifstream stream(input_filename);
if (!stream || if (!stream ||
!CGAL::read_xyz_points(stream, !CGAL::read_XYZ(stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>()))) normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>())))
@ -59,7 +59,7 @@ int main(int argc, char*argv[])
std::ofstream out(output_filename); std::ofstream out(output_filename);
out.precision(17); out.precision(17);
if (!out || if (!out ||
!CGAL::write_xyz_points( !CGAL::write_XYZ(
out, points, out, points,
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>()))) normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>())))

View File

@ -28,7 +28,7 @@ int main(int argc, char* argv[])
std::ifstream stream(input_filename); std::ifstream stream(input_filename);
if (!stream || if (!stream ||
!CGAL::read_xyz_points(stream, !CGAL::read_XYZ(stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>()))) normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>())))
@ -58,7 +58,7 @@ int main(int argc, char* argv[])
std::ofstream out(output_filename); std::ofstream out(output_filename);
out.precision(17); out.precision(17);
if (!out || if (!out ||
!CGAL::write_xyz_points( !CGAL::write_XYZ(
out, points, out, points,
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>()))) normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>())))

View File

@ -24,7 +24,7 @@ int main (int , char**) {
std::list<PointVectorPair> points; std::list<PointVectorPair> points;
std::ifstream stream("data/fandisk.off"); std::ifstream stream("data/fandisk.off");
if (!stream || if (!stream ||
!CGAL::read_off_points(stream, !CGAL::read_OFF(stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()))) CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>())))
{ {

View File

@ -16,7 +16,7 @@ int main(int argc, char*argv[])
const char* fname = (argc>1)?argv[1]:"data/oni.xyz"; const char* fname = (argc>1)?argv[1]:"data/oni.xyz";
std::ifstream stream(fname); std::ifstream stream(fname);
if (!stream || if (!stream ||
!CGAL::read_xyz_points(stream, std::back_inserter(points))) !CGAL::read_XYZ(stream, std::back_inserter(points)))
{ {
std::cerr << "Error: cannot read file " << fname << std::endl; std::cerr << "Error: cannot read file " << fname << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -19,7 +19,7 @@ int main(int argc, char*argv[])
const char* fname = (argc>1)?argv[1]:"data/oni.xyz"; const char* fname = (argc>1)?argv[1]:"data/oni.xyz";
std::ifstream stream(fname); std::ifstream stream(fname);
if (!stream || if (!stream ||
!CGAL::read_xyz_points(stream, std::back_inserter(points))) !CGAL::read_XYZ(stream, std::back_inserter(points)))
{ {
std::cerr << "Error: cannot read file " << fname << std::endl; std::cerr << "Error: cannot read file " << fname << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
@ -42,7 +42,7 @@ int main(int argc, char*argv[])
std::ofstream f ("out.xyz"); std::ofstream f ("out.xyz");
f.precision(17); f.precision(17);
CGAL::write_xyz_points (f, points); CGAL::write_XYZ (f, points);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -254,7 +254,7 @@ int main(int argc, char * argv[])
{ {
std::ifstream stream(input_filename.c_str()); std::ifstream stream(input_filename.c_str());
success = stream && success = stream &&
CGAL::read_off_points(stream, CGAL::read_OFF(stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>())); CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()));
} }
@ -264,7 +264,7 @@ int main(int argc, char * argv[])
{ {
std::ifstream stream(input_filename.c_str()); std::ifstream stream(input_filename.c_str());
success = stream && success = stream &&
CGAL::read_xyz_points(stream, CGAL::read_XYZ(stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>())); CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()));
} }
@ -321,10 +321,10 @@ int main(int argc, char * argv[])
std::ofstream stream(output_filename.c_str()); std::ofstream stream(output_filename.c_str());
stream.precision(17); stream.precision(17);
if (!stream || if (!stream ||
!CGAL::write_xyz_points(stream, !CGAL::write_XYZ(stream,
points, points,
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>()))) normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>())))
{ {
std::cerr << "Error: cannot write file " << output_filename << std::endl; std::cerr << "Error: cannot write file " << output_filename << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -27,7 +27,7 @@ int main(int argc, char*argv[])
std::list<PointVectorPair> points; std::list<PointVectorPair> points;
std::ifstream stream(fname); std::ifstream stream(fname);
if (!stream || if (!stream ||
!CGAL::read_xyz_points(stream, !CGAL::read_XYZ(stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()))) CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>())))
{ {

View File

@ -18,7 +18,7 @@ int main(int argc, char*argv[])
std::vector<Point> points; std::vector<Point> points;
std::ifstream stream(fname); std::ifstream stream(fname);
if (!stream || if (!stream ||
!CGAL::read_xyz_points(stream, std::back_inserter(points))) !CGAL::read_XYZ(stream, std::back_inserter(points)))
{ {
std::cerr << "Error: cannot read file " << fname << std::endl; std::cerr << "Error: cannot read file " << fname << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
@ -36,8 +36,8 @@ int main(int argc, char*argv[])
std::ofstream out((argc>2)?argv[2]:"Three_lady_copy.xyz"); std::ofstream out((argc>2)?argv[2]:"Three_lady_copy.xyz");
out.precision(17); out.precision(17);
if (!out || if (!out ||
!CGAL::write_xyz_points( !CGAL::write_XYZ(
out, points)) out, points))
{ {
return EXIT_FAILURE; return EXIT_FAILURE;
} }

View File

@ -22,7 +22,7 @@ int main(int argc, char*argv[])
std::ifstream in(fname, std::ios_base::binary); std::ifstream in(fname, std::ios_base::binary);
if (!in || if (!in ||
!CGAL::read_las_points_with_properties !CGAL::read_LAS_with_properties
(in, (in,
std::back_inserter (points), std::back_inserter (points),
CGAL::make_las_point_reader (CGAL::First_of_pair_property_map<PointWithColor>()), CGAL::make_las_point_reader (CGAL::First_of_pair_property_map<PointWithColor>()),

View File

@ -29,7 +29,7 @@ int main(int argc, char*argv[])
std::ifstream in(fname); std::ifstream in(fname);
if (!in || if (!in ||
!CGAL::read_ply_points_with_properties !CGAL::read_PLY_with_properties
(in, (in,
std::back_inserter (points), std::back_inserter (points),
CGAL::make_ply_point_reader (Point_map()), CGAL::make_ply_point_reader (Point_map()),

View File

@ -20,13 +20,13 @@ int main(int argc, char*argv[])
{ {
const char* fname = (argc>1)?argv[1]:"data/oni.xyz"; const char* fname = (argc>1)?argv[1]:"data/oni.xyz";
// Reads a .xyz point set file in points[]. // Reads a .xyz point set file in points[].
// Note: read_xyz_points() requires an output iterator // Note: read_XYZ() requires an output iterator
// over points and as well as property maps to access each // over points and as well as property maps to access each
// point position and normal. // point position and normal.
std::vector<Pwn> points; std::vector<Pwn> points;
std::ifstream in(fname); std::ifstream in(fname);
if (!in || if (!in ||
!CGAL::read_xyz_points( !CGAL::read_XYZ(
in,std::back_inserter(points), in,std::back_inserter(points),
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()). CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
normal_map (CGAL::Second_of_pair_property_map<Pwn>()))) normal_map (CGAL::Second_of_pair_property_map<Pwn>())))
@ -41,7 +41,7 @@ int main(int argc, char*argv[])
std::ofstream out("oni_copy.xyz"); std::ofstream out("oni_copy.xyz");
out.precision(17); out.precision(17);
if (!out || if (!out ||
!CGAL::write_xyz_points( !CGAL::write_XYZ(
out, points, out, points,
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<Pwn>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<Pwn>()).
normal_map(CGAL::Second_of_pair_property_map<Pwn>()))) normal_map(CGAL::Second_of_pair_property_map<Pwn>())))

View File

@ -27,7 +27,7 @@ int main(int argc, const char** argv)
std::vector<Pwn> pwns1, pwns2; std::vector<Pwn> pwns1, pwns2;
std::ifstream input(fname1); std::ifstream input(fname1);
if (!input || if (!input ||
!CGAL::read_ply_points(input, std::back_inserter(pwns1), !CGAL::read_PLY_points(input, std::back_inserter(pwns1),
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()). CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
normal_map (Normal_map()))) normal_map (Normal_map())))
{ {
@ -38,7 +38,7 @@ int main(int argc, const char** argv)
input.open(fname2); input.open(fname2);
if (!input || if (!input ||
!CGAL::read_ply_points(input, std::back_inserter(pwns2), !CGAL::read_PLY_points(input, std::back_inserter(pwns2),
CGAL::parameters::point_map (Point_map()). CGAL::parameters::point_map (Point_map()).
normal_map (Normal_map()))) normal_map (Normal_map())))
{ {
@ -71,7 +71,7 @@ int main(int argc, const char** argv)
std::ofstream out("pwns2_aligned.ply"); std::ofstream out("pwns2_aligned.ply");
if (!out || if (!out ||
!CGAL::write_ply_points( !CGAL::write_PLY(
out, pwns2, out, pwns2,
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map()))) normal_map(Normal_map())))

View File

@ -30,7 +30,7 @@ int main(int argc, const char** argv)
std::vector<Pwn> pwns1, pwns2; std::vector<Pwn> pwns1, pwns2;
std::ifstream input(fname1); std::ifstream input(fname1);
if (!input || if (!input ||
!CGAL::read_ply_points(input, std::back_inserter(pwns1), !CGAL::read_PLY_points(input, std::back_inserter(pwns1),
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()). CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
normal_map (Normal_map()))) normal_map (Normal_map())))
{ {
@ -41,7 +41,7 @@ int main(int argc, const char** argv)
input.open(fname2); input.open(fname2);
if (!input || if (!input ||
!CGAL::read_ply_points(input, std::back_inserter(pwns2), !CGAL::read_PLY_points(input, std::back_inserter(pwns2),
CGAL::parameters::point_map (Point_map()). CGAL::parameters::point_map (Point_map()).
normal_map (Normal_map()))) normal_map (Normal_map())))
{ {
@ -73,7 +73,7 @@ int main(int argc, const char** argv)
std::ofstream out("pwns2_aligned.ply"); std::ofstream out("pwns2_aligned.ply");
if (!out || if (!out ||
!CGAL::write_ply_points( !CGAL::write_PLY(
out, pwns2, out, pwns2,
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map()))) normal_map(Normal_map())))

View File

@ -30,7 +30,7 @@ int main(int argc, const char** argv)
std::vector<Pwn> pwns1, pwns2; std::vector<Pwn> pwns1, pwns2;
std::ifstream input(fname1); std::ifstream input(fname1);
if (!input || if (!input ||
!CGAL::read_ply_points(input, std::back_inserter(pwns1), !CGAL::read_PLY(input, std::back_inserter(pwns1),
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()). CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
normal_map (Normal_map()))) normal_map (Normal_map())))
{ {
@ -41,7 +41,7 @@ int main(int argc, const char** argv)
input.open(fname2); input.open(fname2);
if (!input || if (!input ||
!CGAL::read_ply_points(input, std::back_inserter(pwns2), !CGAL::read_PLY(input, std::back_inserter(pwns2),
CGAL::parameters::point_map (Point_map()). CGAL::parameters::point_map (Point_map()).
normal_map (Normal_map()))) normal_map (Normal_map())))
{ {
@ -143,7 +143,7 @@ int main(int argc, const char** argv)
std::ofstream out("pwns2_aligned.ply"); std::ofstream out("pwns2_aligned.ply");
if (!out || if (!out ||
!CGAL::write_ply_points( !CGAL::write_PLY(
out, pwns2, out, pwns2,
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map()))) normal_map(Normal_map())))

View File

@ -20,7 +20,7 @@ int main(int argc, char*argv[])
std::vector<Point> points; std::vector<Point> points;
std::ifstream stream(fname); std::ifstream stream(fname);
if (!stream || if (!stream ||
!CGAL::read_xyz_points(stream, std::back_inserter(points), !CGAL::read_XYZ(stream, std::back_inserter(points),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point>()))) CGAL::parameters::point_map(CGAL::Identity_property_map<Point>())))
{ {
std::cerr << "Error: cannot read file " << fname << std::endl; std::cerr << "Error: cannot read file " << fname << std::endl;

View File

@ -31,7 +31,7 @@ int main (int argc, char** argv)
// read input // read input
if (!(stream if (!(stream
&& CGAL::read_xyz_points(stream, std::back_inserter(points)))) && CGAL::read_XYZ(stream, std::back_inserter(points))))
{ {
std::cerr << "Error: can't read input file" << std::endl; std::cerr << "Error: can't read input file" << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -33,7 +33,7 @@ int main (int argc, char** argv)
std::ifstream stream(argc>1 ? argv[1] : "data/cube.pwn"); std::ifstream stream(argc>1 ? argv[1] : "data/cube.pwn");
if (!stream || if (!stream ||
!CGAL::read_xyz_points(stream, !CGAL::read_XYZ(stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map()))) normal_map(Normal_map())))
@ -67,8 +67,8 @@ int main (int argc, char** argv)
<< " structured point(s) generated." << std::endl; << " structured point(s) generated." << std::endl;
std::ofstream out ("out.pwn"); std::ofstream out ("out.pwn");
CGAL::write_xyz_points (out, structured_pts, CGAL::write_XYZ (out, structured_pts,
CGAL::parameters::point_map(Point_map()).normal_map(Normal_map())); CGAL::parameters::point_map(Point_map()).normal_map(Normal_map()));
out.close(); out.close();
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@ -23,7 +23,7 @@ int main(int argc, char** argv)
std::vector<Point> points; std::vector<Point> points;
std::ifstream stream(input_filename); std::ifstream stream(input_filename);
if (!stream || !CGAL::read_xyz_points(stream, std::back_inserter(points))) if (!stream || !CGAL::read_XYZ(stream, std::back_inserter(points)))
{ {
std::cerr << "Error: cannot read file " << input_filename << std::endl; std::cerr << "Error: cannot read file " << input_filename << std::endl;
@ -43,7 +43,7 @@ int main(int argc, char** argv)
std::ofstream out(output_filename); std::ofstream out(output_filename);
out.precision(17); out.precision(17);
if (!out || !CGAL::write_xyz_points( if (!out || !CGAL::write_XYZ(
out, output)) out, output))
{ {
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -54,7 +54,7 @@ int main(int, char**)
std::ofstream f("out.ply", std::ios::binary); std::ofstream f("out.ply", std::ios::binary);
CGAL::set_binary_mode(f); // The PLY file will be written in the binary format CGAL::set_binary_mode(f); // The PLY file will be written in the binary format
CGAL::write_ply_points_with_properties CGAL::write_PLY_with_properties
(f, points, (f, points,
CGAL::make_ply_point_writer (Point_map()), CGAL::make_ply_point_writer (Point_map()),
std::make_tuple(Color_map(), std::make_tuple(Color_map(),

View File

@ -59,255 +59,255 @@
namespace CGAL { namespace CGAL {
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
namespace LAS_property namespace LAS_property
{ {
namespace Id namespace Id
{ {
enum Id enum Id
{ {
X, X,
Y, Y,
Z, Z,
Intensity, Intensity,
Return_number, Return_number,
Number_of_returns, Number_of_returns,
Scan_direction_flag, Scan_direction_flag,
Edge_of_flight_line, Edge_of_flight_line,
Classification, Classification,
Synthetic_flag, Synthetic_flag,
Keypoint_flag, Keypoint_flag,
Withheld_flag, Withheld_flag,
Scan_angle, Scan_angle,
User_data, User_data,
Point_source_ID, Point_source_ID,
Deleted_flag, Deleted_flag,
GPS_time, GPS_time,
R, R,
G, G,
B, B,
I I
}; };
} }
template <typename T, Id::Id id> template <typename T, Id::Id id>
struct Base struct Base
{ {
typedef T type; typedef T type;
}; };
typedef Base<double, Id::X> X; typedef Base<double, Id::X> X;
typedef Base<double, Id::Y> Y; typedef Base<double, Id::Y> Y;
typedef Base<double, Id::Z> Z; typedef Base<double, Id::Z> Z;
typedef Base<unsigned short, Id::Intensity> Intensity; typedef Base<unsigned short, Id::Intensity> Intensity;
typedef Base<unsigned char, Id::Return_number> Return_number; typedef Base<unsigned char, Id::Return_number> Return_number;
typedef Base<unsigned char, Id::Number_of_returns> Number_of_returns; typedef Base<unsigned char, Id::Number_of_returns> Number_of_returns;
typedef Base<unsigned char, Id::Scan_direction_flag> Scan_direction_flag; typedef Base<unsigned char, Id::Scan_direction_flag> Scan_direction_flag;
typedef Base<unsigned char, Id::Edge_of_flight_line> Edge_of_flight_line; typedef Base<unsigned char, Id::Edge_of_flight_line> Edge_of_flight_line;
typedef Base<unsigned char, Id::Classification> Classification; typedef Base<unsigned char, Id::Classification> Classification;
typedef Base<unsigned char, Id::Synthetic_flag> Synthetic_flag; typedef Base<unsigned char, Id::Synthetic_flag> Synthetic_flag;
typedef Base<unsigned char, Id::Keypoint_flag> Keypoint_flag; typedef Base<unsigned char, Id::Keypoint_flag> Keypoint_flag;
typedef Base<unsigned char, Id::Withheld_flag> Withheld_flag; typedef Base<unsigned char, Id::Withheld_flag> Withheld_flag;
typedef Base<float, Id::Scan_angle> Scan_angle; typedef Base<float, Id::Scan_angle> Scan_angle;
typedef Base<unsigned char, Id::User_data> User_data; typedef Base<unsigned char, Id::User_data> User_data;
typedef Base<unsigned short, Id::Point_source_ID> Point_source_ID; typedef Base<unsigned short, Id::Point_source_ID> Point_source_ID;
typedef Base<unsigned int, Id::Deleted_flag> Deleted_flag; typedef Base<unsigned int, Id::Deleted_flag> Deleted_flag;
typedef Base<double, Id::GPS_time> GPS_time; typedef Base<double, Id::GPS_time> GPS_time;
typedef Base<unsigned short, Id::R> R; typedef Base<unsigned short, Id::R> R;
typedef Base<unsigned short, Id::G> G; typedef Base<unsigned short, Id::G> G;
typedef Base<unsigned short, Id::B> B; typedef Base<unsigned short, Id::B> B;
typedef Base<unsigned short, Id::I> I; typedef Base<unsigned short, Id::I> I;
} }
/// \endcond /// \endcond
/** /**
\ingroup PkgPointSetProcessing3IOLas \ingroup PkgPointSetProcessing3IOLas
Generates a %LAS property handler to read 3D points. Points are Generates a %LAS property handler to read 3D points. Points are
constructed from the input the using 3 %LAS properties constructed from the input the using 3 %LAS properties
`LAS_property::X`, `LAS_property::Y` and `LAS_property::Z`. `LAS_property::X`, `LAS_property::Y` and `LAS_property::Z`.
\sa `read_las_points_with_properties()` \sa `read_LAS_with_properties()`
\tparam PointMap the property map used to store points. \tparam PointMap the property map used to store points.
*/ */
template <typename PointMap> template <typename PointMap>
std::tuple<PointMap, std::tuple<PointMap,
typename Kernel_traits<typename PointMap::value_type>::Kernel::Construct_point_3, typename Kernel_traits<typename PointMap::value_type>::Kernel::Construct_point_3,
LAS_property::X, LAS_property::Y, LAS_property::Z > LAS_property::X, LAS_property::Y, LAS_property::Z >
make_las_point_reader(PointMap point_map) make_las_point_reader(PointMap point_map)
{ {
return std::make_tuple (point_map, typename Kernel_traits<typename PointMap::value_type>::Kernel::Construct_point_3(), return std::make_tuple (point_map, typename Kernel_traits<typename PointMap::value_type>::Kernel::Construct_point_3(),
LAS_property::X(), LAS_property::Y(), LAS_property::Z()); LAS_property::X(), LAS_property::Y(), LAS_property::Z());
} }
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
namespace internal { namespace internal {
namespace LAS { namespace LAS {
inline void get_value(const LASpoint& r, double& v, LAS_property::X&) inline void get_value(const LASpoint& r, double& v, LAS_property::X&)
{ v = r.get_x(); } { v = r.get_x(); }
inline void get_value(const LASpoint& r, double& v, LAS_property::Y&) inline void get_value(const LASpoint& r, double& v, LAS_property::Y&)
{ v = r.get_y(); } { v = r.get_y(); }
inline void get_value(const LASpoint& r, double& v, LAS_property::Z&) inline void get_value(const LASpoint& r, double& v, LAS_property::Z&)
{ v = r.get_z(); } { v = r.get_z(); }
inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::Intensity&) inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::Intensity&)
{ v = r.get_intensity(); } { v = r.get_intensity(); }
inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Return_number&) inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Return_number&)
{ v = r.get_return_number(); } { v = r.get_return_number(); }
inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Number_of_returns&) inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Number_of_returns&)
{ v = r.get_number_of_returns(); } { v = r.get_number_of_returns(); }
inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Scan_direction_flag&) inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Scan_direction_flag&)
{ v = r.get_scan_direction_flag(); } { v = r.get_scan_direction_flag(); }
inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Edge_of_flight_line&) inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Edge_of_flight_line&)
{ v = r.get_edge_of_flight_line(); } { v = r.get_edge_of_flight_line(); }
inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Classification&) inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Classification&)
{ v = r.get_classification(); } { v = r.get_classification(); }
inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Synthetic_flag&) inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Synthetic_flag&)
{ v = r.get_synthetic_flag(); } { v = r.get_synthetic_flag(); }
inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Keypoint_flag&) inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Keypoint_flag&)
{ v = r.get_keypoint_flag(); } { v = r.get_keypoint_flag(); }
inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Withheld_flag&) inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::Withheld_flag&)
{ v = r.get_withheld_flag(); } { v = r.get_withheld_flag(); }
inline void get_value(const LASpoint& r, float& v, LAS_property::Scan_angle&) inline void get_value(const LASpoint& r, float& v, LAS_property::Scan_angle&)
{ v = r.get_scan_angle(); } { v = r.get_scan_angle(); }
inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::User_data&) inline void get_value(const LASpoint& r, unsigned char& v, LAS_property::User_data&)
{ v = r.get_user_data(); } { v = r.get_user_data(); }
inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::Point_source_ID&) inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::Point_source_ID&)
{ v = r.get_point_source_ID(); } { v = r.get_point_source_ID(); }
inline void get_value(const LASpoint& r, unsigned int& v, LAS_property::Deleted_flag&) inline void get_value(const LASpoint& r, unsigned int& v, LAS_property::Deleted_flag&)
{ v = r.get_deleted_flag(); } { v = r.get_deleted_flag(); }
inline void get_value(const LASpoint& r, double& v, LAS_property::GPS_time&) inline void get_value(const LASpoint& r, double& v, LAS_property::GPS_time&)
{ v = r.get_gps_time(); } { v = r.get_gps_time(); }
inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::R&) inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::R&)
{ v = r.get_R(); } { v = r.get_R(); }
inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::G&) inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::G&)
{ v = r.get_G(); } { v = r.get_G(); }
inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::B&) inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::B&)
{ v = r.get_B(); } { v = r.get_B(); }
inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::I&) inline void get_value(const LASpoint& r, unsigned short& v, LAS_property::I&)
{ v = r.get_I(); } { v = r.get_I(); }
template <std::size_t N> template <std::size_t N>
struct Filler struct Filler
{
template <class Value_tuple, class LAS_property_tuple>
static void fill(const LASpoint& r, Value_tuple& values, LAS_property_tuple wrappers)
{ {
template <class Value_tuple, class LAS_property_tuple> get_value(r, std::get<N>(values), std::get<N+2>(wrappers));
static void fill(const LASpoint& r, Value_tuple& values, LAS_property_tuple wrappers) Filler<N-1>::fill(r, values, wrappers);
{
get_value(r, std::get<N>(values), std::get<N+2>(wrappers));
Filler<N-1>::fill(r, values, wrappers);
}
};
template<int ...>
struct seq { };
template<int N, int ...S>
struct gens : gens<N-1, N-1, S...> { };
template<int ...S>
struct gens<0, S...> {
typedef seq<S...> type;
};
template<class ValueType, class Functor, class Tuple, int ...S>
ValueType call_functor(Functor f, Tuple t, seq<S...>) {
return f(std::get<S>(t) ...);
} }
};
template <class ValueType, class Functor, typename ... T> template<int ...>
ValueType call_functor(Functor f, std::tuple<T...>& t) struct seq { };
template<int N, int ...S>
struct gens : gens<N-1, N-1, S...> { };
template<int ...S>
struct gens<0, S...> {
typedef seq<S...> type;
};
template<class ValueType, class Functor, class Tuple, int ...S>
ValueType call_functor(Functor f, Tuple t, seq<S...>) {
return f(std::get<S>(t) ...);
}
template <class ValueType, class Functor, typename ... T>
ValueType call_functor(Functor f, std::tuple<T...>& t)
{
return call_functor<ValueType>(f, t, typename gens<sizeof...(T)>::type());
}
template<>
struct Filler<0>
{
template <class Value_tuple, class LAS_property_tuple>
static void fill(const LASpoint& r, Value_tuple& values, LAS_property_tuple wrappers)
{ {
return call_functor<ValueType>(f, t, typename gens<sizeof...(T)>::type()); get_value(r, std::get<0>(values), std::get<2>(wrappers));
} }
};
template<> template <typename OutputValueType, typename PropertyMap, typename T, LAS_property::Id::Id id>
struct Filler<0> void process_properties (const LASpoint& reader, OutputValueType& new_element,
{ std::pair<PropertyMap, LAS_property::Base<T,id> >&& current);
template <class Value_tuple, class LAS_property_tuple>
static void fill(const LASpoint& r, Value_tuple& values, LAS_property_tuple wrappers)
{
get_value(r, std::get<0>(values), std::get<2>(wrappers));
}
};
template <typename OutputValueType, typename PropertyMap, typename T, LAS_property::Id::Id id> template <typename OutputValueType, typename PropertyMap, typename T, LAS_property::Id::Id id,
void process_properties (const LASpoint& reader, OutputValueType& new_element, typename NextPropertyBinder, typename ... PropertyMapBinders>
std::pair<PropertyMap, LAS_property::Base<T,id> >&& current); void process_properties (const LASpoint& reader, OutputValueType& new_element,
std::pair<PropertyMap, LAS_property::Base<T,id> >&& current,
NextPropertyBinder&& next,
PropertyMapBinders&& ... properties);
template <typename OutputValueType, typename PropertyMap, typename T, LAS_property::Id::Id id, template <typename OutputValueType,
typename NextPropertyBinder, typename ... PropertyMapBinders> typename PropertyMap,
void process_properties (const LASpoint& reader, OutputValueType& new_element, typename Constructor,
std::pair<PropertyMap, LAS_property::Base<T,id> >&& current, typename ... T,
NextPropertyBinder&& next, LAS_property::Id::Id ... id>
PropertyMapBinders&& ... properties); void process_properties (const LASpoint& reader, OutputValueType& new_element,
std::tuple<PropertyMap, Constructor, LAS_property::Base<T,id>...>&& current)
{
typedef typename PropertyMap::value_type PmapValueType;
std::tuple<T...> values;
Filler<sizeof...(T)-1>::fill(reader, values, current);
PmapValueType new_value = call_functor<PmapValueType>(std::get<1>(current), values);
put (std::get<0>(current), new_element, new_value);
}
template <typename OutputValueType, template <typename OutputValueType,
typename PropertyMap, typename PropertyMap,
typename Constructor, typename Constructor,
typename ... T, typename ... T,
LAS_property::Id::Id ... id> LAS_property::Id::Id ... id,
void process_properties (const LASpoint& reader, OutputValueType& new_element, typename NextPropertyBinder,
std::tuple<PropertyMap, Constructor, LAS_property::Base<T,id>...>&& current) typename ... PropertyMapBinders>
{ void process_properties (const LASpoint& reader, OutputValueType& new_element,
typedef typename PropertyMap::value_type PmapValueType; std::tuple<PropertyMap, Constructor, LAS_property::Base<T,id>...>&& current,
std::tuple<T...> values; NextPropertyBinder&& next,
Filler<sizeof...(T)-1>::fill(reader, values, current); PropertyMapBinders&& ... properties)
PmapValueType new_value = call_functor<PmapValueType>(std::get<1>(current), values); {
put (std::get<0>(current), new_element, new_value); typedef typename PropertyMap::value_type PmapValueType;
} std::tuple<T...> values;
Filler<sizeof...(T)-1>::fill(reader, values, current);
PmapValueType new_value = call_functor<PmapValueType>(std::get<1>(current), values);
put (std::get<0>(current), new_element, new_value);
template <typename OutputValueType, process_properties (reader, new_element, std::forward<NextPropertyBinder>(next),
typename PropertyMap, std::forward<PropertyMapBinders>(properties)...);
typename Constructor, }
typename ... T,
LAS_property::Id::Id ... id,
typename NextPropertyBinder,
typename ... PropertyMapBinders>
void process_properties (const LASpoint& reader, OutputValueType& new_element,
std::tuple<PropertyMap, Constructor, LAS_property::Base<T,id>...>&& current,
NextPropertyBinder&& next,
PropertyMapBinders&& ... properties)
{
typedef typename PropertyMap::value_type PmapValueType;
std::tuple<T...> values;
Filler<sizeof...(T)-1>::fill(reader, values, current);
PmapValueType new_value = call_functor<PmapValueType>(std::get<1>(current), values);
put (std::get<0>(current), new_element, new_value);
process_properties (reader, new_element, std::forward<NextPropertyBinder>(next),
std::forward<PropertyMapBinders>(properties)...);
}
template <typename OutputValueType, typename PropertyMap, typename T, LAS_property::Id::Id id> template <typename OutputValueType, typename PropertyMap, typename T, LAS_property::Id::Id id>
void process_properties (const LASpoint& reader, OutputValueType& new_element, void process_properties (const LASpoint& reader, OutputValueType& new_element,
std::pair<PropertyMap, LAS_property::Base<T,id> >&& current) std::pair<PropertyMap, LAS_property::Base<T,id> >&& current)
{ {
T new_value = T(); T new_value = T();
get_value (reader, new_value, current.second); get_value (reader, new_value, current.second);
put (current.first, new_element, new_value); put (current.first, new_element, new_value);
} }
template <typename OutputValueType, typename PropertyMap, typename T, LAS_property::Id::Id id, template <typename OutputValueType, typename PropertyMap, typename T, LAS_property::Id::Id id,
typename NextPropertyBinder, typename ... PropertyMapBinders> typename NextPropertyBinder, typename ... PropertyMapBinders>
void process_properties (const LASpoint& reader, OutputValueType& new_element, void process_properties (const LASpoint& reader, OutputValueType& new_element,
std::pair<PropertyMap, LAS_property::Base<T,id> >&& current, std::pair<PropertyMap, LAS_property::Base<T,id> >&& current,
NextPropertyBinder&& next, NextPropertyBinder&& next,
PropertyMapBinders&& ... properties) PropertyMapBinders&& ... properties)
{ {
T new_value = T(); T new_value = T();
get_value (reader, new_value, current.second); get_value (reader, new_value, current.second);
put (current.first, new_element, new_value); put (current.first, new_element, new_value);
process_properties (reader, new_element, std::forward<NextPropertyBinder>(next), process_properties (reader, new_element, std::forward<NextPropertyBinder>(next),
std::forward<PropertyMapBinders>(properties)...); std::forward<PropertyMapBinders>(properties)...);
} }
} // namespace LAS } // namespace LAS
} // namespace internal } // namespace internal
@ -376,9 +376,9 @@ namespace internal {
template <typename OutputIteratorValueType, template <typename OutputIteratorValueType,
typename OutputIterator, typename OutputIterator,
typename ... PropertyHandler> typename ... PropertyHandler>
bool read_las_points_with_properties (std::istream& stream, bool read_LAS_with_properties (std::istream& stream,
OutputIterator output, OutputIterator output,
PropertyHandler&& ... properties) PropertyHandler&& ... properties)
{ {
typedef OutputIteratorValueType Enriched_point; typedef OutputIteratorValueType Enriched_point;
@ -386,14 +386,14 @@ bool read_las_points_with_properties (std::istream& stream,
lasreader.open(stream); lasreader.open(stream);
while (lasreader.read_point()) while (lasreader.read_point())
{ {
const LASpoint& laspoint = lasreader.point; const LASpoint& laspoint = lasreader.point;
Enriched_point new_point; Enriched_point new_point;
internal::LAS::process_properties (laspoint, new_point, std::forward<PropertyHandler>(properties)...); internal::LAS::process_properties (laspoint, new_point, std::forward<PropertyHandler>(properties)...);
*(output ++) = new_point; *(output ++) = new_point;
} }
lasreader.close(); lasreader.close();
@ -405,14 +405,14 @@ bool read_las_points_with_properties (std::istream& stream,
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
template <typename OutputIterator, template <typename OutputIterator,
typename ... PropertyHandler> typename ... PropertyHandler>
bool read_las_points_with_properties (std::istream& stream, bool read_LAS_with_properties (std::istream& stream,
OutputIterator output, OutputIterator output,
PropertyHandler&& ... properties) PropertyHandler&& ... properties)
{ {
typedef typename value_type_traits<OutputIterator>::type OutputValueType; typedef typename value_type_traits<OutputIterator>::type OutputValueType;
return read_las_points_with_properties<OutputValueType> return read_LAS_with_properties<OutputValueType>
(stream, output, std::forward<PropertyHandler>(properties)...); (stream, output, std::forward<PropertyHandler>(properties)...);
} }
/// \endcond /// \endcond
@ -442,18 +442,18 @@ bool read_las_points_with_properties (std::istream& stream,
*/ */
template < typename OutputIteratorValueType, template < typename OutputIteratorValueType,
typename OutputIterator, typename OutputIterator,
#ifdef DOXYGEN_RUNNING #ifdef DOXYGEN_RUNNING
typename NamedParameters typename NamedParameters
#else #else
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS typename CGAL_BGL_NP_TEMPLATE_PARAMETERS
#endif #endif
> >
bool read_las_points(std::istream& stream, bool read_LAS(std::istream& stream,
OutputIterator output, OutputIterator output,
#ifdef DOXYGEN_RUNNING #ifdef DOXYGEN_RUNNING
const NamedParameters& np) const NamedParameters& np)
#else #else
const CGAL_BGL_NP_CLASS& np) const CGAL_BGL_NP_CLASS& np)
#endif #endif
{ {
using parameters::choose_parameter; using parameters::choose_parameter;
@ -464,8 +464,8 @@ bool read_las_points(std::istream& stream,
typedef typename CGAL::GetPointMap<PointRange, CGAL_BGL_NP_CLASS>::type PointMap; typedef typename CGAL::GetPointMap<PointRange, CGAL_BGL_NP_CLASS>::type PointMap;
PointMap point_map = choose_parameter<PointMap>(get_parameter(np, internal_np::point_map)); PointMap point_map = choose_parameter<PointMap>(get_parameter(np, internal_np::point_map));
return read_las_points_with_properties (stream, output, return read_LAS_with_properties (stream, output,
make_las_point_reader (point_map)); make_las_point_reader (point_map));
} }
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
@ -473,36 +473,36 @@ bool read_las_points(std::istream& stream,
template <typename OutputIteratorValueType, template <typename OutputIteratorValueType,
typename OutputIterator> typename OutputIterator>
bool bool
read_las_points( read_LAS(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points. OutputIterator output) ///< output iterator over points.
{ {
return read_las_points<OutputIteratorValueType> return read_LAS<OutputIteratorValueType>
(stream, output, CGAL::parameters::all_default()); (stream, output, CGAL::parameters::all_default());
} }
// variant with default output iterator value type // variant with default output iterator value type
template <typename OutputIterator, template <typename OutputIterator,
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool bool
read_las_points( read_LAS(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output, OutputIterator output,
const CGAL_BGL_NP_CLASS& np) const CGAL_BGL_NP_CLASS& np)
{ {
return read_las_points<typename value_type_traits<OutputIterator>::type> return read_LAS<typename value_type_traits<OutputIterator>::type>
(stream, output, np); (stream, output, np);
} }
// variant with default NP and output iterator value type // variant with default NP and output iterator value type
template <typename OutputIterator> template <typename OutputIterator>
bool bool
read_las_points( read_LAS(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output) OutputIterator output)
{ {
return read_las_points<typename value_type_traits<OutputIterator>::type> return read_LAS<typename value_type_traits<OutputIterator>::type>
(stream, output, CGAL::parameters::all_default()); (stream, output, CGAL::parameters::all_default());
} }
#ifndef CGAL_NO_DEPRECATED_CODE #ifndef CGAL_NO_DEPRECATED_CODE
@ -516,8 +516,8 @@ bool read_las_points(std::istream& stream, ///< input stream.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3. PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{ {
return read_las_points<OutputIteratorValueType> return read_las_points<OutputIteratorValueType>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map)); CGAL::parameters::point_map (point_map));
} }
// deprecated API // deprecated API
@ -529,13 +529,116 @@ bool read_las_points(std::istream& stream, ///< input stream.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3. PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{ {
return read_las_points<typename value_type_traits<OutputIterator>::type> return read_las_points<typename value_type_traits<OutputIterator>::type>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map)); CGAL::parameters::point_map (point_map));
} }
#endif // CGAL_NO_DEPRECATED_CODE #endif //CGAL_NO_DEPRECATED_CODE
/// \endcond /// \endcond
#ifndef CGAL_NO_DEPRECATED_CODE
/**
\ingroup PkgPointSetProcessing3IOLas
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::read_LAS_with_properties()` should be used instead.
*/
template <typename OutputIteratorValueType,
typename OutputIterator,
typename ... PropertyHandler>
CGAL_DEPRECATED bool read_las_points_with_properties (std::istream& stream,
OutputIterator output,
PropertyHandler&& ... properties)
{
return read_LAS(stream, output, std::forward<PropertyHandler>(properties)...);
}
/// \cond SKIP_IN_MANUAL
template <typename OutputIterator,
typename ... PropertyHandler>
CGAL_DEPRECATED bool read_las_points_with_properties (std::istream& stream,
OutputIterator output,
PropertyHandler&& ... properties)
{
typedef typename value_type_traits<OutputIterator>::type OutputValueType;
return read_LAS<OutputValueType>
(stream, output, std::forward<PropertyHandler>(properties)...);
}
/// \endcond
/**
\ingroup PkgPointSetProcessing3IOLas
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::read_LAS()` should be used instead.
*/
template < typename OutputIteratorValueType,
typename OutputIterator,
#ifdef DOXYGEN_RUNNING
typename NamedParameters
#else
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS
#endif
>
CGAL_DEPRECATED bool read_las_points(std::istream& stream,
OutputIterator output,
#ifdef DOXYGEN_RUNNING
const NamedParameters& np)
#else
const CGAL_BGL_NP_CLASS& np)
#endif
{
using parameters::choose_parameter;
using parameters::get_parameter;
typedef Point_set_processing_3::Fake_point_range<OutputIteratorValueType> PointRange;
typedef typename CGAL::GetPointMap<PointRange, CGAL_BGL_NP_CLASS>::type PointMap;
PointMap point_map = choose_parameter<PointMap>(get_parameter(np, internal_np::point_map));
return read_LAS (stream, output,
make_las_point_reader (point_map));
}
/// \cond SKIP_IN_MANUAL
// variant with default NP
template <typename OutputIteratorValueType,
typename OutputIterator>
CGAL_DEPRECATED bool
read_las_points(
std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points.
{
return read_LAS<OutputIteratorValueType>
(stream, output, CGAL::parameters::all_default());
}
// variant with default output iterator value type
template <typename OutputIterator,
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool
read_las_points(
std::istream& stream, ///< input stream.
OutputIterator output,
const CGAL_BGL_NP_CLASS& np)
{
return read_LAS<typename value_type_traits<OutputIterator>::type>
(stream, output, np);
}
// variant with default NP and output iterator value type
template <typename OutputIterator>
CGAL_DEPRECATED bool
read_las_points(
std::istream& stream, ///< input stream.
OutputIterator output)
{
return read_LAS<typename value_type_traits<OutputIterator>::type>
(stream, output, CGAL::parameters::all_default());
}
#endif // CGAL_NO_DEPRECATED_CODE
} //namespace CGAL } //namespace CGAL
#endif // CGAL_READ_LAS_POINTS_H #endif // CGAL_READ_LAS_POINTS_H

View File

@ -67,7 +67,7 @@ template <typename OutputIteratorValueType,
#endif #endif
> >
bool bool
read_off_points( read_OFF(
std::istream& stream, std::istream& stream,
OutputIterator output, OutputIterator output,
#ifdef DOXYGEN_RUNNING #ifdef DOXYGEN_RUNNING
@ -186,11 +186,11 @@ read_off_points(
template <typename OutputIteratorValueType, template <typename OutputIteratorValueType,
typename OutputIterator> typename OutputIterator>
bool bool
read_off_points( read_OFF(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points. OutputIterator output) ///< output iterator over points.
{ {
return read_off_points<OutputIteratorValueType> return read_OFF<OutputIteratorValueType>
(stream, output, CGAL::parameters::all_default()); (stream, output, CGAL::parameters::all_default());
} }
@ -198,23 +198,23 @@ read_off_points(
template <typename OutputIterator, template <typename OutputIterator,
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool bool
read_off_points( read_OFF(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output, OutputIterator output,
const CGAL_BGL_NP_CLASS& np) const CGAL_BGL_NP_CLASS& np)
{ {
return read_off_points<typename value_type_traits<OutputIterator>::type> return read_OFF<typename value_type_traits<OutputIterator>::type>
(stream, output, np); (stream, output, np);
} }
// variant with default NP and output iterator value type // variant with default NP and output iterator value type
template <typename OutputIterator> template <typename OutputIterator>
bool bool
read_off_points( read_OFF(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output) OutputIterator output)
{ {
return read_off_points<typename value_type_traits<OutputIterator>::type> return read_OFF<typename value_type_traits<OutputIterator>::type>
(stream, output, CGAL::parameters::all_default()); (stream, output, CGAL::parameters::all_default());
} }
@ -235,7 +235,7 @@ read_off_points_and_normals(
NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3. NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3.
const Kernel& /*kernel*/) ///< geometric traits. const Kernel& /*kernel*/) ///< geometric traits.
{ {
return read_off_points<OutputIteratorValueType> return read_OFF<OutputIteratorValueType>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map). normal_map (normal_map).
@ -257,7 +257,7 @@ read_off_points_and_normals(
NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3. NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3.
const Kernel& kernel) ///< geometric traits. const Kernel& kernel) ///< geometric traits.
{ {
return read_off_points<typename value_type_traits<OutputIterator>::type> return read_OFF<typename value_type_traits<OutputIterator>::type>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map). normal_map (normal_map).
@ -278,7 +278,7 @@ read_off_points_and_normals(
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3. PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
return read_off_points<OutputIteratorValueType> return read_OFF<OutputIteratorValueType>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map)); normal_map (normal_map));
@ -297,7 +297,7 @@ read_off_points_and_normals(
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3. PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
return read_off_points<typename value_type_traits<OutputIterator>::type> return read_OFF<typename value_type_traits<OutputIterator>::type>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map)); normal_map (normal_map));
@ -315,7 +315,7 @@ read_off_points_and_normals(
OutputIterator output, ///< output iterator over points. OutputIterator output, ///< output iterator over points.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
return read_off_points<OutputIteratorValueType> return read_OFF<OutputIteratorValueType>
(stream, output, (stream, output,
CGAL::parameters::normal_map (normal_map)); CGAL::parameters::normal_map (normal_map));
} }
@ -331,7 +331,7 @@ read_off_points_and_normals(
OutputIterator output, ///< output iterator over points. OutputIterator output, ///< output iterator over points.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
return read_off_points<typename value_type_traits<OutputIterator>::type> return read_OFF<typename value_type_traits<OutputIterator>::type>
(stream, output, (stream, output,
CGAL::parameters::normal_map (normal_map)); CGAL::parameters::normal_map (normal_map));
} }
@ -411,6 +411,67 @@ read_off_points(
/// \endcond /// \endcond
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
/**
\ingroup PkgPointSetProcessing3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::read_OFF()` should be used instead.
*/
template <typename OutputIteratorValueType,
typename OutputIterator,
#ifdef DOXYGEN_RUNNING
typename NamedParameters
#else
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS
#endif
>
CGAL_DEPRECATED bool
read_off_points(
std::istream& stream,
OutputIterator output,
#ifdef DOXYGEN_RUNNING
const NamedParameters& np)
#else
const CGAL_BGL_NP_CLASS& np)
#endif
{
return read_OFF(stream, output, np);
}
template <typename OutputIteratorValueType,
typename OutputIterator>
CGAL_DEPRECATED bool
read_off_points(
std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points.
{
return read_OFF(stream, output);
}
// variant with default output iterator value type
template <typename OutputIterator,
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool
read_off_points(
std::istream& stream, ///< input stream.
OutputIterator output,
const CGAL_BGL_NP_CLASS& np)
{
return read_OFF(stream, output, np);
}
// variant with default NP and output iterator value type
template <typename OutputIterator>
CGAL_DEPRECATED bool
read_off_points(
std::istream& stream, ///< input stream.
OutputIterator output)
{
return read_OFF(stream, output, CGAL::parameters::all_default());
}
#endif //CGAL_NO_DEPRECATED_CODE
} //namespace CGAL } //namespace CGAL
#endif // CGAL_READ_OFF_POINTS_H #endif // CGAL_READ_OFF_POINTS_H

View File

@ -38,22 +38,22 @@
namespace CGAL { namespace CGAL {
#ifdef DOXYGEN_RUNNING // Document some parts from Stream_support here for convenience #ifdef DOXYGEN_RUNNING // Document some parts from Stream_support here for convenience
/** /**
\ingroup PkgPointSetProcessing3IOPly \ingroup PkgPointSetProcessing3IOPly
Class used to identify a %PLY property as a type and a name. Class used to identify a %PLY property as a type and a name.
\sa `read_ply_points_with_properties()` \sa `read_PLY_with_properties()`
*/ */
template <typename T> template <typename T>
struct PLY_property struct PLY_property
{ {
typedef T type; typedef T type;
const char* name; const char* name;
PLY_property (const char* name) : name (name) { } PLY_property (const char* name) : name (name) { }
}; };
/** /**
\ingroup PkgPointSetProcessing3IOPly \ingroup PkgPointSetProcessing3IOPly
Generates a %PLY property handler to read 3D points. Points are Generates a %PLY property handler to read 3D points. Points are
@ -61,17 +61,17 @@ namespace CGAL {
and named `x`, `y` and `z`. `FT` is `float` if the points use and named `x`, `y` and `z`. `FT` is `float` if the points use
`CGAL::Simple_cartesian<float>` and `double` otherwise. `CGAL::Simple_cartesian<float>` and `double` otherwise.
\sa `read_ply_points_with_properties()` \sa `read_PLY_with_properties()`
\tparam PointMap the property map used to store points. \tparam PointMap the property map used to store points.
*/ */
template <typename PointMap> template <typename PointMap>
std::tuple<PointMap, std::tuple<PointMap,
typename Kernel_traits<typename PointMap::value_type>::Kernel::Construct_point_3, typename Kernel_traits<typename PointMap::value_type>::Kernel::Construct_point_3,
PLY_property<FT>, PLY_property<FT>, PLY_property<FT> > PLY_property<FT>, PLY_property<FT>, PLY_property<FT> >
make_ply_point_reader(PointMap point_map); make_ply_point_reader(PointMap point_map);
/** /**
\ingroup PkgPointSetProcessing3IOPly \ingroup PkgPointSetProcessing3IOPly
Generates a %PLY property handler to read 3D normal Generates a %PLY property handler to read 3D normal
@ -80,15 +80,15 @@ namespace CGAL {
is `float` if the points use `CGAL::Simple_cartesian<float>` and is `float` if the points use `CGAL::Simple_cartesian<float>` and
`double` otherwise. `double` otherwise.
\sa `read_ply_points_with_properties()` \sa `read_PLY_with_properties()`
\tparam VectorMap the property map used to store vectors. \tparam VectorMap the property map used to store vectors.
*/ */
template <typename VectorMap> template <typename VectorMap>
std::tuple<VectorMap, std::tuple<VectorMap,
typename Kernel_traits<typename VectorMap::value_type>::Kernel::Construct_vector_3, typename Kernel_traits<typename VectorMap::value_type>::Kernel::Construct_vector_3,
PLY_property<FT>, PLY_property<FT>, PLY_property<FT> > PLY_property<FT>, PLY_property<FT>, PLY_property<FT> >
make_ply_normal_reader(VectorMap normal_map); make_ply_normal_reader(VectorMap normal_map);
#endif // DOXYGEN_RUNNING #endif // DOXYGEN_RUNNING
/** /**
@ -128,17 +128,17 @@ namespace CGAL {
template <typename OutputIteratorValueType, template <typename OutputIteratorValueType,
typename OutputIterator, typename OutputIterator,
typename ... PropertyHandler> typename ... PropertyHandler>
bool read_ply_points_with_properties (std::istream& stream, bool read_PLY_with_properties (std::istream& stream,
OutputIterator output, OutputIterator output,
PropertyHandler&& ... properties) PropertyHandler&& ... properties)
{ {
typedef typename value_type_traits<OutputIterator>::type OutputValueType; typedef typename value_type_traits<OutputIterator>::type OutputValueType;
if(!stream) if(!stream)
{ {
std::cerr << "Error: cannot open file" << std::endl; std::cerr << "Error: cannot open file" << std::endl;
return false; return false;
} }
IO::internal::PLY_reader reader; IO::internal::PLY_reader reader;
@ -178,14 +178,14 @@ bool read_ply_points_with_properties (std::istream& stream,
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
template <typename OutputIterator, template <typename OutputIterator,
typename ... PropertyHandler> typename ... PropertyHandler>
bool read_ply_points_with_properties (std::istream& stream, bool read_PLY_with_properties (std::istream& stream,
OutputIterator output, OutputIterator output,
PropertyHandler&& ... properties) PropertyHandler&& ... properties)
{ {
typedef typename value_type_traits<OutputIterator>::type OutputValueType; typedef typename value_type_traits<OutputIterator>::type OutputValueType;
return read_ply_points_with_properties<OutputValueType> return read_PLY_with_properties<OutputValueType>
(stream, output, std::forward<PropertyHandler>(properties)...); (stream, output, std::forward<PropertyHandler>(properties)...);
} }
/// \endcond /// \endcond
@ -218,18 +218,18 @@ bool read_ply_points_with_properties (std::istream& stream,
*/ */
template < typename OutputIteratorValueType, template < typename OutputIteratorValueType,
typename OutputIterator, typename OutputIterator,
#ifdef DOXYGEN_RUNNING #ifdef DOXYGEN_RUNNING
typename NamedParameters typename NamedParameters
#else #else
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS typename CGAL_BGL_NP_TEMPLATE_PARAMETERS
#endif #endif
> >
bool read_ply_points(std::istream& stream, bool read_PLY(std::istream& stream,
OutputIterator output, OutputIterator output,
#ifdef DOXYGEN_RUNNING #ifdef DOXYGEN_RUNNING
const NamedParameters& np) const NamedParameters& np)
#else #else
const CGAL_BGL_NP_CLASS& np) const CGAL_BGL_NP_CLASS& np)
#endif #endif
{ {
using parameters::choose_parameter; using parameters::choose_parameter;
@ -248,12 +248,12 @@ bool read_ply_points(std::istream& stream,
NormalMap normal_map = choose_parameter<NormalMap>(get_parameter(np, internal_np::normal_map)); NormalMap normal_map = choose_parameter<NormalMap>(get_parameter(np, internal_np::normal_map));
if (has_normals) if (has_normals)
return read_ply_points_with_properties (stream, output, return read_PLY_with_properties (stream, output,
make_ply_point_reader (point_map), make_ply_point_reader (point_map),
make_ply_normal_reader (normal_map)); make_ply_normal_reader (normal_map));
// else // else
return read_ply_points_with_properties (stream, output, return read_PLY_with_properties (stream, output,
make_ply_point_reader (point_map)); make_ply_point_reader (point_map));
} }
@ -262,36 +262,36 @@ bool read_ply_points(std::istream& stream,
template <typename OutputIteratorValueType, template <typename OutputIteratorValueType,
typename OutputIterator> typename OutputIterator>
bool bool
read_ply_points( read_PLY(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points. OutputIterator output) ///< output iterator over points.
{ {
return read_ply_points<OutputIteratorValueType> return read_PLY<OutputIteratorValueType>
(stream, output, CGAL::parameters::all_default()); (stream, output, CGAL::parameters::all_default());
} }
// variant with default output iterator value type // variant with default output iterator value type
template <typename OutputIterator, template <typename OutputIterator,
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool bool
read_ply_points( read_PLY(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output, OutputIterator output,
const CGAL_BGL_NP_CLASS& np) const CGAL_BGL_NP_CLASS& np)
{ {
return read_ply_points<typename value_type_traits<OutputIterator>::type> return read_PLY<typename value_type_traits<OutputIterator>::type>
(stream, output, np); (stream, output, np);
} }
// variant with default NP and output iterator value type // variant with default NP and output iterator value type
template <typename OutputIterator> template <typename OutputIterator>
bool bool
read_ply_points( read_PLY(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output) OutputIterator output)
{ {
return read_ply_points<typename value_type_traits<OutputIterator>::type> return read_PLY<typename value_type_traits<OutputIterator>::type>
(stream, output, CGAL::parameters::all_default()); (stream, output, CGAL::parameters::all_default());
} }
#ifndef CGAL_NO_DEPRECATED_CODE #ifndef CGAL_NO_DEPRECATED_CODE
@ -306,10 +306,10 @@ bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
PointMap point_map, ///< property map: value_type of OutputIterator -> Point_3. PointMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
return read_ply_points<OutputIteratorValueType> return read_PLY<OutputIteratorValueType>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map)); normal_map (normal_map));
} }
// deprecated API // deprecated API
@ -322,10 +322,10 @@ bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
PointMap point_map, ///< property map: value_type of OutputIterator -> Point_3. PointMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
return read_ply_points<typename value_type_traits<OutputIterator>::type> return read_PLY<typename value_type_traits<OutputIterator>::type>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map)); normal_map (normal_map));
} }
// deprecated API // deprecated API
@ -337,9 +337,9 @@ bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points. OutputIterator output, ///< output iterator over points.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
return read_ply_points<OutputIteratorValueType> return read_PLY<OutputIteratorValueType>
(stream, output, (stream, output,
CGAL::parameters::normal_map (normal_map)); CGAL::parameters::normal_map (normal_map));
} }
// deprecated API // deprecated API
@ -350,26 +350,26 @@ bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points. OutputIterator output, ///< output iterator over points.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
return read_ply_points<typename value_type_traits<OutputIterator>::type> return read_PLY<typename value_type_traits<OutputIterator>::type>
(stream, output, (stream, output,
CGAL::parameters::normal_map (normal_map)); CGAL::parameters::normal_map (normal_map));
} }
// deprecated API // deprecated API
template <typename OutputIteratorValueType, template <typename OutputIteratorValueType,
typename OutputIterator, typename OutputIterator,
typename PointMap typename PointMap
> >
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_ply_points(), please update your code") CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_ply_points(), please update your code")
bool bool
read_ply_points( read_ply_points(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points. OutputIterator output, ///< output iterator over points.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3. PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{ {
return read_ply_points<OutputIteratorValueType> return read_PLY<OutputIteratorValueType>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map)); CGAL::parameters::point_map (point_map));
} }
// deprecated API // deprecated API
@ -380,14 +380,106 @@ bool read_ply_points(std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points. OutputIterator output, ///< output iterator over points.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3. PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{ {
return read_ply_points<typename value_type_traits<OutputIterator>::type> return read_PLY<typename value_type_traits<OutputIterator>::type>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map)); CGAL::parameters::point_map (point_map));
} }
#endif // CGAL_NO_DEPRECATED_CODE #endif // CGAL_NO_DEPRECATED_CODE
/// \endcond /// \endcond
#ifndef CGAL_NO_DEPRECATED_CODE
/**
\ingroup PkgPointSetProcessingIOPly
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::read_PLY_with_properties()` should be used instead.
*/
template <typename OutputIteratorValueType,
typename OutputIterator,
typename ... PropertyHandler>
CGAL_DEPRECATED bool
read_ply_points_with_properties (std::istream& stream,
OutputIterator output,
PropertyHandler&& ... properties)
{
return read_PLY(stream, output, std::forward<PropertyHandler>(properties)...);
}
/**
\ingroup PkgPointSetProcessingIOPly
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::read_PLY()` should be used instead.
*/
template < typename OutputIteratorValueType,
typename OutputIterator,
#ifdef DOXYGEN_RUNNING
typename NamedParameters
#else
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS
#endif
>
CGAL_DEPRECATED bool
read_ply_points(std::istream& stream,
OutputIterator output,
#ifdef DOXYGEN_RUNNING
const NamedParameters& np)
#else
const CGAL_BGL_NP_CLASS& np)
#endif
{
return read_PLY(stream, output, np);
}
/// \cond SKIP_IN_MANUAL
template <typename OutputIterator,
typename ... PropertyHandler>
CGAL_DEPRECATED bool
read_ply_points_with_properties (std::istream& stream,
OutputIterator output,
PropertyHandler&& ... properties)
{
typedef typename value_type_traits<OutputIterator>::type OutputValueType;
return read_PLY<OutputValueType>
(stream, output, std::forward<PropertyHandler>(properties)...);
}
template <typename OutputIteratorValueType,
typename OutputIterator>
CGAL_DEPRECATED bool
read_ply_points(
std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points.
{
return read_PLY<OutputIteratorValueType>
(stream, output, CGAL::parameters::all_default());
}
// variant with default output iterator value type
template <typename OutputIterator,
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool
read_ply_points(
std::istream& stream, ///< input stream.
OutputIterator output,
const CGAL_BGL_NP_CLASS& np)
{
return read_PLY<typename value_type_traits<OutputIterator>::type>
(stream, output, np);
}
// variant with default NP and output iterator value type
template <typename OutputIterator>
CGAL_DEPRECATED bool
read_ply_points(
std::istream& stream, ///< input stream.
OutputIterator output)
{
return read_PLY<typename value_type_traits<OutputIterator>::type>
(stream, output, CGAL::parameters::all_default());
}
/// \endcond
#endif // CGAL_NO_DEPRECATED_CODE
} //namespace CGAL } //namespace CGAL
#undef TRY_TO_GENERATE_POINT_PROPERTY #undef TRY_TO_GENERATE_POINT_PROPERTY

View File

@ -66,7 +66,7 @@ template <typename OutputIteratorValueType,
#endif #endif
> >
bool bool
read_xyz_points( read_XYZ(
std::istream& stream, std::istream& stream,
OutputIterator output, OutputIterator output,
#ifdef DOXYGEN_RUNNING #ifdef DOXYGEN_RUNNING
@ -178,11 +178,11 @@ read_xyz_points(
template <typename OutputIteratorValueType, template <typename OutputIteratorValueType,
typename OutputIterator> typename OutputIterator>
bool bool
read_xyz_points( read_XYZ(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points. OutputIterator output) ///< output iterator over points.
{ {
return read_xyz_points<OutputIteratorValueType> return read_XYZ<OutputIteratorValueType>
(stream, output, CGAL::parameters::all_default()); (stream, output, CGAL::parameters::all_default());
} }
@ -190,23 +190,23 @@ read_xyz_points(
template <typename OutputIterator, template <typename OutputIterator,
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool bool
read_xyz_points( read_XYZ(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output, OutputIterator output,
const CGAL_BGL_NP_CLASS& np) const CGAL_BGL_NP_CLASS& np)
{ {
return read_xyz_points<typename value_type_traits<OutputIterator>::type> return read_XYZ<typename value_type_traits<OutputIterator>::type>
(stream, output, np); (stream, output, np);
} }
// variant with default NP and output iterator value type // variant with default NP and output iterator value type
template <typename OutputIterator> template <typename OutputIterator>
bool bool
read_xyz_points( read_XYZ(
std::istream& stream, ///< input stream. std::istream& stream, ///< input stream.
OutputIterator output) OutputIterator output)
{ {
return read_xyz_points<typename value_type_traits<OutputIterator>::type> return read_XYZ<typename value_type_traits<OutputIterator>::type>
(stream, output, CGAL::parameters::all_default()); (stream, output, CGAL::parameters::all_default());
} }
@ -227,7 +227,7 @@ read_xyz_points_and_normals(
NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3. NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3.
const Kernel& /*kernel*/) ///< geometric traits. const Kernel& /*kernel*/) ///< geometric traits.
{ {
return read_xyz_points<OutputIteratorValueType> return read_XYZ<OutputIteratorValueType>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map). normal_map (normal_map).
@ -249,7 +249,7 @@ read_xyz_points_and_normals(
NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3. NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3.
const Kernel& kernel) ///< geometric traits. const Kernel& kernel) ///< geometric traits.
{ {
return read_xyz_points<typename value_type_traits<OutputIterator>::type> return read_XYZ<typename value_type_traits<OutputIterator>::type>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map). normal_map (normal_map).
@ -270,7 +270,7 @@ read_xyz_points_and_normals(
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3. PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
return read_xyz_points<OutputIteratorValueType> return read_XYZ<OutputIteratorValueType>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map)); normal_map (normal_map));
@ -289,7 +289,7 @@ read_xyz_points_and_normals(
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3. PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
return read_xyz_points<typename value_type_traits<OutputIterator>::type> return read_XYZ<typename value_type_traits<OutputIterator>::type>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map)); normal_map (normal_map));
@ -307,7 +307,7 @@ read_xyz_points_and_normals(
OutputIterator output, ///< output iterator over points. OutputIterator output, ///< output iterator over points.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
return read_xyz_points<OutputIteratorValueType> return read_XYZ<OutputIteratorValueType>
(stream, output, (stream, output,
CGAL::parameters::normal_map (normal_map)); CGAL::parameters::normal_map (normal_map));
} }
@ -323,7 +323,7 @@ read_xyz_points_and_normals(
OutputIterator output, ///< output iterator over points. OutputIterator output, ///< output iterator over points.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
return read_xyz_points<typename value_type_traits<OutputIterator>::type> return read_XYZ<typename value_type_traits<OutputIterator>::type>
(stream, output, (stream, output,
CGAL::parameters::normal_map (normal_map)); CGAL::parameters::normal_map (normal_map));
} }
@ -342,7 +342,7 @@ read_xyz_points(
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3. PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
const Kernel& kernel) ///< geometric traits. const Kernel& kernel) ///< geometric traits.
{ {
return read_xyz_points<OutputIteratorValueType> return read_XYZ<OutputIteratorValueType>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
geom_traits (kernel)); geom_traits (kernel));
@ -361,7 +361,7 @@ read_xyz_points(
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3. PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
const Kernel& kernel) ///< geometric traits. const Kernel& kernel) ///< geometric traits.
{ {
return read_xyz_points<typename value_type_traits<OutputIterator>::type> return read_XYZ<typename value_type_traits<OutputIterator>::type>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
geom_traits (kernel)); geom_traits (kernel));
@ -379,7 +379,7 @@ read_xyz_points(
OutputIterator output, ///< output iterator over points. OutputIterator output, ///< output iterator over points.
PointPMap point_map) ///< property map: value_type of OutputIterator -> Point_3. PointPMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{ {
return read_xyz_points<OutputIteratorValueType> return read_XYZ<OutputIteratorValueType>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map)); CGAL::parameters::point_map (point_map));
} }
@ -395,14 +395,81 @@ read_xyz_points(
OutputIterator output, ///< output iterator over points. OutputIterator output, ///< output iterator over points.
PointPMap point_map) ///< property map: value_type of OutputIterator -> Point_3. PointPMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{ {
return read_xyz_points<typename value_type_traits<OutputIterator>::type> return read_XYZ<typename value_type_traits<OutputIterator>::type>
(stream, output, (stream, output,
CGAL::parameters::point_map (point_map)); CGAL::parameters::point_map (point_map));
} }
#endif // CGAL_NO_DEPRECATED_CODE #endif // CGAL_NO_DEPRECATED_CODE
/// \endcond /// \endcond
//////////////////////////////////
///
//////////////////////////////////
///
///
/**
\ingroup PkgPointSetProcessing3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::read_XYZ()` should be used instead.
\return true on success.
*/
template <typename OutputIteratorValueType,
typename OutputIterator,
#ifdef DOXYGEN_RUNNING
typename NamedParameters
#else
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS
#endif
>
CGAL_DEPRECATED bool
read_xyz_points(
std::istream& stream,
OutputIterator output,
#ifdef DOXYGEN_RUNNING
const NamedParameters& np)
#else
const CGAL_BGL_NP_CLASS& np)
#endif
{
return read_XYZ(stream, output, np);
}
#ifndef CGAL_NO_DEPRECATED_CODE
/// \cond SKIP_IN_MANUAL
template <typename OutputIteratorValueType,
typename OutputIterator>
CGAL_DEPRECATED bool
read_xyz_points(
std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points.
{
return read_XYZ<OutputIteratorValueType>
(stream, output, CGAL::parameters::all_default());
}
template <typename OutputIterator,
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool
read_xyz_points(
std::istream& stream, ///< input stream.
OutputIterator output,
const CGAL_BGL_NP_CLASS& np)
{
return read_XYZ<typename value_type_traits<OutputIterator>::type>
(stream, output, np);
}
template <typename OutputIterator>
CGAL_DEPRECATED bool
read_xyz_points(
std::istream& stream, ///< input stream.
OutputIterator output)
{
return read_XYZ<typename value_type_traits<OutputIterator>::type>
(stream, output, CGAL::parameters::all_default());
}
#endif //CGAL_NO_DEPRECATED_CODE
} //namespace CGAL } //namespace CGAL
#endif // CGAL_READ_XYZ_POINTS_H #endif // CGAL_READ_XYZ_POINTS_H

View File

@ -63,7 +63,7 @@ namespace CGAL {
Generates a %LAS property handler to write 3D points. Generates a %LAS property handler to write 3D points.
\sa `write_las_points_with_properties()` \sa `write_LAS()`
\tparam PointMap the property map used to store points. \tparam PointMap the property map used to store points.
*/ */
@ -169,7 +169,7 @@ namespace internal {
writing an `int` vairable as an `int` %LAS property). An exception writing an `int` vairable as an `int` %LAS property). An exception
is used for points that are written using a `std::tuple` object. is used for points that are written using a `std::tuple` object.
See documentation of `read_las_points_with_properties()` for the See documentation of `read_LAS_with_properties()` for the
list of available `LAS_property::Tag` classes. list of available `LAS_property::Tag` classes.
\sa `make_las_point_writer()` \sa `make_las_point_writer()`
@ -186,13 +186,13 @@ namespace internal {
template <typename PointRange, template <typename PointRange,
typename PointMap, typename PointMap,
typename ... PropertyHandler> typename ... PropertyHandler>
bool write_las_points_with_properties (std::ostream& stream, ///< output stream. bool write_LAS_with_properties (std::ostream& stream, ///< output stream.
const PointRange& points, ///< input point range. const PointRange& points, ///< input point range.
std::tuple<PointMap, std::tuple<PointMap,
LAS_property::X, LAS_property::X,
LAS_property::Y, LAS_property::Y,
LAS_property::Z> point_property, ///< property handler for points LAS_property::Z> point_property, ///< property handler for points
PropertyHandler&& ... properties) ///< parameter pack of property handlers PropertyHandler&& ... properties) ///< parameter pack of property handlers
{ {
CGAL_point_set_processing_precondition(points.begin() != points.end()); CGAL_point_set_processing_precondition(points.begin() != points.end());
@ -268,7 +268,7 @@ bool write_las_points_with_properties (std::ostream& stream, ///< output stream
template < typename PointRange, template < typename PointRange,
typename NamedParameters> typename NamedParameters>
bool bool
write_las_points( write_LAS(
std::ostream& stream, std::ostream& stream,
const PointRange& points, const PointRange& points,
const NamedParameters& np) const NamedParameters& np)
@ -279,7 +279,7 @@ write_las_points(
typedef typename CGAL::GetPointMap<PointRange, NamedParameters>::type PointMap; typedef typename CGAL::GetPointMap<PointRange, NamedParameters>::type PointMap;
PointMap point_map = choose_parameter<PointMap>(get_parameter(np, internal_np::point_map)); PointMap point_map = choose_parameter<PointMap>(get_parameter(np, internal_np::point_map));
return write_las_points_with_properties (stream, points, make_las_point_writer(point_map)); return write_LAS_with_properties (stream, points, make_las_point_writer(point_map));
} }
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
@ -290,7 +290,7 @@ write_las_points(
std::ostream& stream, std::ostream& stream,
const PointRange& points) const PointRange& points)
{ {
return write_las_points return write_LAS
(stream, points, CGAL::Point_set_processing_3::parameters::all_default(points)); (stream, points, CGAL::Point_set_processing_3::parameters::all_default(points));
} }
@ -307,7 +307,7 @@ write_las_points(
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3. PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{ {
CGAL::Iterator_range<ForwardIterator> points (first, beyond); CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_las_points return write_LAS
(stream, points, (stream, points,
CGAL::parameters::point_map(point_map)); CGAL::parameters::point_map(point_map));
} }
@ -322,13 +322,48 @@ write_las_points(
ForwardIterator beyond) ///< past-the-end input point. ForwardIterator beyond) ///< past-the-end input point.
{ {
CGAL::Iterator_range<ForwardIterator> points (first, beyond); CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_las_points return write_LAS
(stream, points); (stream, points);
} }
#endif // CGAL_NO_DEPRECATED_CODE #endif // CGAL_NO_DEPRECATED_CODE
/// \endcond /// \endcond
#ifndef CGAL_NO_DEPRECATED_CODE
/**
\ingroup PkgPointSetProcessing3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::write_LAS_with_properties()` should be used instead.
*/
template <typename PointRange,
typename PointMap,
typename ... PropertyHandler>
CGAL_DEPRECATED bool
write_las_points_with_properties (std::ostream& stream,
const PointRange& points,
std::tuple<PointMap,
LAS_property::X,
LAS_property::Y,
LAS_property::Z> point_property,
PropertyHandler&& ... properties)
{
return write_LAS_with_properties(stream, points, point_property, std::forward<PropertyHandler>(properties)...);
}
/**
\ingroup PkgPointSetProcessing3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::write_LAS()` should be used instead.
*/
template < typename PointRange,
typename NamedParameters>
bool
write_las_points(
std::ostream& stream,
const PointRange& points,
const NamedParameters& np)
{
return write_LAS(stream, points, np);
}
#endif //CGAL_NO_DEPRECATED_CODE
} //namespace CGAL } //namespace CGAL
#endif // CGAL_WRITE_LAS_POINTS_H #endif // CGAL_WRITE_LAS_POINTS_H

View File

@ -20,6 +20,9 @@
#include <CGAL/boost/graph/named_params_helper.h> #include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/Iterator_range.h> #include <CGAL/Iterator_range.h>
#include <boost/utility/enable_if.hpp>
#include <iostream> #include <iostream>
#include <iterator> #include <iterator>
@ -57,10 +60,16 @@ template <typename PointRange,
typename NamedParameters typename NamedParameters
> >
bool bool
write_off_points( write_OFF(
std::ostream& stream, std::ostream& stream,
const PointRange& points, const PointRange& points,
const NamedParameters& np) const NamedParameters& np
#ifndef DOXYGEN_RUNNING
,typename boost::enable_if<
typename boost::has_range_const_iterator<PointRange>::type
>::type* =0
#endif
)
{ {
using parameters::choose_parameter; using parameters::choose_parameter;
using parameters::get_parameter; using parameters::get_parameter;
@ -103,11 +112,17 @@ write_off_points(
// variant with default NP // variant with default NP
template <typename PointRange> template <typename PointRange>
bool bool
write_off_points( write_OFF(
std::ostream& stream, ///< output stream. std::ostream& stream, ///< output stream.
const PointRange& points) const PointRange& points
#ifndef DOXYGEN_RUNNING
,typename boost::enable_if<
typename boost::has_range_const_iterator<PointRange>::type
>::type* =0
#endif
)
{ {
return write_off_points return write_OFF
(stream, points, CGAL::Point_set_processing_3::parameters::all_default(points)); (stream, points, CGAL::Point_set_processing_3::parameters::all_default(points));
} }
@ -230,8 +245,36 @@ write_off_points(
} }
#endif // CGAL_NO_DEPRECATED_CODE #endif // CGAL_NO_DEPRECATED_CODE
/// \endcond /// \endcond
#ifndef CGAL_NO_DEPRECATED_CODE
/**
\ingroup PkgPointSetProcessing3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::write_OFF()` should be used instead.
*/
template <typename PointRange,
typename NamedParameters
>
CGAL_DEPRECATED bool
write_off_points(
std::ostream& stream,
const PointRange& points,
const NamedParameters& np)
{
return write_OFF(stream, points, np);
}
/// \cond SKIP_IN_MANUAL
// variant with default NP
template <typename PointRange>
CGAL_DEPRECATED bool
write_off_points(
std::ostream& stream, ///< output stream.
const PointRange& points)
{
return write_OFF
(stream, points, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#endif // CGAL_NO_DEPRECATED_CODE
} //namespace CGAL } //namespace CGAL
#endif // CGAL_WRITE_OFF_POINTS_H #endif // CGAL_WRITE_OFF_POINTS_H

View File

@ -42,7 +42,7 @@ namespace CGAL {
`z`. `FT` is `float` if the points use `z`. `FT` is `float` if the points use
`CGAL::Simple_cartesian<float>` and `double` otherwise. `CGAL::Simple_cartesian<float>` and `double` otherwise.
\sa `write_ply_points_with_properties()` \sa `write_PLY_with_properties()`
\tparam PointMap the property map used to store points. \tparam PointMap the property map used to store points.
*/ */
@ -58,7 +58,7 @@ namespace CGAL {
and named `nx`, `ny` and `nz`. `FT` is `float` if the vectors use and named `nx`, `ny` and `nz`. `FT` is `float` if the vectors use
`CGAL::Simple_cartesian<float>` and `double` otherwise. `CGAL::Simple_cartesian<float>` and `double` otherwise.
\sa `write_ply_points_with_properties()` \sa `write_PLY_with_properties()`
\tparam VectorMap the property map used to store vectors. \tparam VectorMap the property map used to store vectors.
*/ */
@ -115,7 +115,7 @@ namespace internal {
template < typename PointRange, template < typename PointRange,
typename ... PropertyHandler> typename ... PropertyHandler>
bool bool
write_ply_points_with_properties( write_PLY_with_properties(
std::ostream& stream, ///< output stream. std::ostream& stream, ///< output stream.
const PointRange& points, ///< input point range. const PointRange& points, ///< input point range.
PropertyHandler&& ... properties) ///< parameter pack of property handlers PropertyHandler&& ... properties) ///< parameter pack of property handlers
@ -174,33 +174,42 @@ write_ply_points_with_properties(
\cgalRequiresCPP11 \cgalRequiresCPP11
*/ */
template <typename PointRange, template <typename PointRange,
typename NamedParameters> #ifdef DOXYGEN_RUNNING
typename NamedParameters
#else
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS
#endif
>
bool bool
write_ply_points( write_PLY(
std::ostream& stream, std::ostream& stream,
const PointRange& points, const PointRange& points,
const NamedParameters& np) #ifdef DOXYGEN_RUNNING
const NamedParameters& np)
#else
const CGAL_BGL_NP_CLASS& np)
#endif
{ {
using parameters::choose_parameter; using parameters::choose_parameter;
using parameters::get_parameter; using parameters::get_parameter;
// basic geometric types // basic geometric types
typedef typename CGAL::GetPointMap<PointRange, NamedParameters>::type PointMap; typedef typename CGAL::GetPointMap<PointRange, CGAL_BGL_NP_CLASS>::type PointMap;
typedef typename Point_set_processing_3::GetNormalMap<PointRange, NamedParameters>::type NormalMap; typedef typename Point_set_processing_3::GetNormalMap<PointRange, CGAL_BGL_NP_CLASS>::type NormalMap;
bool has_normals = !(boost::is_same<NormalMap, bool has_normals = !(boost::is_same<NormalMap,
typename Point_set_processing_3::GetNormalMap<PointRange, NamedParameters>::NoMap>::value); typename Point_set_processing_3::GetNormalMap<PointRange, CGAL_BGL_NP_CLASS>::NoMap>::value);
PointMap point_map = choose_parameter<PointMap>(get_parameter(np, internal_np::point_map)); PointMap point_map = choose_parameter<PointMap>(get_parameter(np, internal_np::point_map));
NormalMap normal_map = choose_parameter<NormalMap>(get_parameter(np, internal_np::normal_map)); NormalMap normal_map = choose_parameter<NormalMap>(get_parameter(np, internal_np::normal_map));
if (has_normals) if (has_normals)
return write_ply_points_with_properties( return write_PLY_with_properties(
stream, points, stream, points,
make_ply_point_writer(point_map), make_ply_point_writer(point_map),
make_ply_normal_writer(normal_map)); make_ply_normal_writer(normal_map));
// else // else
return write_ply_points_with_properties( return write_PLY_with_properties(
stream, points, stream, points,
make_ply_point_writer(point_map)); make_ply_point_writer(point_map));
} }
@ -209,11 +218,11 @@ write_ply_points(
// variant with default NP // variant with default NP
template <typename PointRange> template <typename PointRange>
bool bool
write_ply_points( write_PLY(
std::ostream& stream, std::ostream& stream,
const PointRange& points) const PointRange& points)
{ {
return write_ply_points return write_PLY
(stream, points, CGAL::Point_set_processing_3::parameters::all_default(points)); (stream, points, CGAL::Point_set_processing_3::parameters::all_default(points));
} }
@ -232,7 +241,7 @@ write_ply_points_and_normals(
VectorMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. VectorMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
CGAL::Iterator_range<ForwardIterator> points (first, beyond); CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_ply_points return write_PLY
(stream, points, (stream, points,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map)); normal_map (normal_map));
@ -251,7 +260,7 @@ write_ply_points_and_normals(
VectorMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. VectorMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
CGAL::Iterator_range<ForwardIterator> points (first, beyond); CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_ply_points return write_PLY
(stream, points, (stream, points,
CGAL::parameters::normal_map (normal_map)); CGAL::parameters::normal_map (normal_map));
} }
@ -268,7 +277,7 @@ write_ply_points(
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3. PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{ {
CGAL::Iterator_range<ForwardIterator> points (first, beyond); CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_ply_points return write_PLY
(stream, points, (stream, points,
CGAL::parameters::point_map(point_map)); CGAL::parameters::point_map(point_map));
} }
@ -283,12 +292,60 @@ write_ply_points(
ForwardIterator beyond) ///< past-the-end input point. ForwardIterator beyond) ///< past-the-end input point.
{ {
CGAL::Iterator_range<ForwardIterator> points (first, beyond); CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_ply_points return write_PLY
(stream, points); (stream, points);
} }
#endif // CGAL_NO_DEPRECATED_CODE #endif // CGAL_NO_DEPRECATED_CODE
/// \endcond /// \endcond
#ifndef CGAL_NO_DEPRECATED_CODE
/**
\ingroup PkgPointSetProcessing3IOPly
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::write_PLY_with_properties()` should be used instead.
*/
template < typename PointRange,
typename ... PropertyHandler>
CGAL_DEPRECATED bool
write_ply_points_with_properties(
std::ostream& stream, ///< output stream.
const PointRange& points, ///< input point range.
PropertyHandler&& ... properties) ///< parameter pack of property handlers
{
return write_PLY_with_properties(stream, points,
std::forward<PropertyHandler>(properties)...);
}
/**
\ingroup PkgPointSetProcessing3IOPly
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::write_PLY()` should be used instead.
*/
template <typename PointRange,
typename NamedParameters>
CGAL_DEPRECATED bool
write_ply_points(
std::ostream& stream,
const PointRange& points,
const NamedParameters& np)
{
return write_PLY(stream, points, np);
}
/// \cond SKIP_IN_MANUAL
template <typename PointRange>
CGAL_DEPRECATED bool
write_ply_points(
std::ostream& stream,
const PointRange& points)
{
return write_PLY
(stream, points, CGAL::Point_set_processing_3::parameters::all_default(points));
}
/// \endcond
#endif //CGAL_NO_DEPRECATED_CODE
} //namespace CGAL } //namespace CGAL

View File

@ -57,10 +57,10 @@ template <typename PointRange,
typename NamedParameters typename NamedParameters
> >
bool bool
write_xyz_points( write_XYZ(
std::ostream& stream, std::ostream& stream,
const PointRange& points, const PointRange& points,
const NamedParameters& np) const NamedParameters& np)
{ {
using parameters::choose_parameter; using parameters::choose_parameter;
using parameters::get_parameter; using parameters::get_parameter;
@ -99,12 +99,12 @@ write_xyz_points(
// variant with default NP // variant with default NP
template <typename PointRange> template <typename PointRange>
bool bool
write_xyz_points( write_XYZ(
std::ostream& stream, ///< output stream. std::ostream& stream, ///< output stream.
const PointRange& points) const PointRange& points)
{ {
return write_xyz_points return write_XYZ
(stream, points, CGAL::Point_set_processing_3::parameters::all_default(points)); (stream, points, CGAL::Point_set_processing_3::parameters::all_default(points));
} }
#ifndef CGAL_NO_DEPRECATED_CODE #ifndef CGAL_NO_DEPRECATED_CODE
@ -125,11 +125,11 @@ write_xyz_points_and_normals(
const Kernel& /*kernel*/) ///< geometric traits. const Kernel& /*kernel*/) ///< geometric traits.
{ {
CGAL::Iterator_range<ForwardIterator> points (first, beyond); CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_xyz_points return write_XYZ
(stream, points, (stream, points,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map). normal_map (normal_map).
geom_traits(Kernel())); geom_traits(Kernel()));
} }
// deprecated API // deprecated API
@ -147,10 +147,10 @@ write_xyz_points_and_normals(
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3. NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{ {
CGAL::Iterator_range<ForwardIterator> points (first, beyond); CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_xyz_points return write_XYZ
(stream, points, (stream, points,
CGAL::parameters::point_map (point_map). CGAL::parameters::point_map (point_map).
normal_map (normal_map)); normal_map (normal_map));
} }
// deprecated API // deprecated API
@ -166,9 +166,9 @@ write_xyz_points_and_normals(
NormalMap normal_map) ///< property map: value_type of ForwardIterator -> Vector_3. NormalMap normal_map) ///< property map: value_type of ForwardIterator -> Vector_3.
{ {
CGAL::Iterator_range<ForwardIterator> points (first, beyond); CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_xyz_points return write_XYZ
(stream, points, (stream, points,
CGAL::parameters::normal_map(normal_map)); CGAL::parameters::normal_map(normal_map));
} }
// deprecated API // deprecated API
@ -186,10 +186,10 @@ write_xyz_points(
const Kernel& kernel) const Kernel& kernel)
{ {
CGAL::Iterator_range<ForwardIterator> points (first, beyond); CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_xyz_points return write_XYZ
(stream, points, (stream, points,
CGAL::parameters::point_map(point_map). CGAL::parameters::point_map(point_map).
geom_traits (kernel)); geom_traits (kernel));
} }
// deprecated API // deprecated API
template <typename ForwardIterator, template <typename ForwardIterator,
@ -204,9 +204,9 @@ write_xyz_points(
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3. PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{ {
CGAL::Iterator_range<ForwardIterator> points (first, beyond); CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_xyz_points return write_XYZ
(stream, points, (stream, points,
CGAL::parameters::point_map(point_map)); CGAL::parameters::point_map(point_map));
} }
// deprecated API // deprecated API
@ -220,13 +220,46 @@ write_xyz_points(
ForwardIterator beyond) ///< past-the-end input point. ForwardIterator beyond) ///< past-the-end input point.
{ {
CGAL::Iterator_range<ForwardIterator> points (first, beyond); CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_xyz_points return write_XYZ
(stream, points); (stream, points);
} }
#endif // CGAL_NO_DEPRECATED_CODE #endif // CGAL_NO_DEPRECATED_CODE
/// \endcond /// \endcond
#ifndef CGAL_NO_DEPRECATED_CODE
/**
\ingroup PkgPointSetProcessing3IO
@todo update version
\deprecated This function is deprecated since \cgal 5.1, `CGAL::write_XYZ()` should be used instead.
*/
template <typename PointRange,
typename NamedParameters
>
CGAL_DEPRECATED bool
write_xyz_points(
std::ostream& stream,
const PointRange& points,
const NamedParameters& np)
{
return write_XYZ(stream, points, np);
}
/// \cond SKIP_IN_MANUAL
template <typename PointRange>
CGAL_DEPRECATED bool
write_xyz_points(
std::ostream& stream, ///< output stream.
const PointRange& points)
{
return write_XYZ
(stream, points, CGAL::Point_set_processing_3::parameters::all_default(points));
}
/// \endcond
#endif //CGAL_NO_DEPRECATED_CODE
} //namespace CGAL } //namespace CGAL
#endif // CGAL_WRITE_XYZ_POINTS_H #endif // CGAL_WRITE_XYZ_POINTS_H

View File

@ -104,7 +104,7 @@ int main(int argc, char * argv[])
// If XYZ file format: // If XYZ file format:
std::ifstream stream(input_filename.c_str()); std::ifstream stream(input_filename.c_str());
if(stream && if(stream &&
CGAL::read_xyz_points(stream, std::back_inserter(points))) CGAL::read_XYZ(stream, std::back_inserter(points)))
{ {
std::cerr << "ok (" << points.size() << " points)" << std::endl; std::cerr << "ok (" << points.size() << " points)" << std::endl;
} }

View File

@ -113,7 +113,7 @@ int main(int argc, char * argv[])
// If XYZ file format: // If XYZ file format:
std::ifstream stream(input_filename.c_str()); std::ifstream stream(input_filename.c_str());
if(stream && if(stream &&
CGAL::read_xyz_points(stream, CGAL::read_XYZ(stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>()))) normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>())))

View File

@ -323,7 +323,7 @@ int main(int argc, char * argv[])
{ {
std::ifstream stream(input_filename.c_str()); std::ifstream stream(input_filename.c_str());
success = stream && success = stream &&
CGAL::read_xyz_points(stream, CGAL::read_XYZ(stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::normal_map CGAL::parameters::normal_map
(CGAL::make_normal_of_point_with_normal_map(PointList::value_type())) (CGAL::make_normal_of_point_with_normal_map(PointList::value_type()))

View File

@ -21,7 +21,7 @@ bool read(std::string s)
{ {
std::ifstream fs(s.c_str()); std::ifstream fs(s.c_str());
std::vector<PointVectorPair> pv_pairs; std::vector<PointVectorPair> pv_pairs;
return CGAL::read_xyz_points(fs, return CGAL::read_XYZ(fs,
back_inserter(pv_pairs), back_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>())); normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>()));
@ -34,7 +34,7 @@ bool read(std::string s,
{ {
std::ifstream fs(s.c_str()); std::ifstream fs(s.c_str());
return CGAL::read_xyz_points(fs, return CGAL::read_XYZ(fs,
back_inserter(pv_pairs), back_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>())); normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>()));

View File

@ -78,7 +78,7 @@ bool test_no_deduction_points_and_normals_xyz(const char* file_name)
// read with custom output iterator type // read with custom output iterator type
dummy_counter::counter = 0; dummy_counter::counter = 0;
std::ifstream input(file_name); std::ifstream input(file_name);
CGAL::read_xyz_points<dummy_counter>( CGAL::read_XYZ<dummy_counter>(
input, back_inserter(indices), input, back_inserter(indices),
CGAL::parameters::point_map (points). CGAL::parameters::point_map (points).
normal_map (normals). normal_map (normals).
@ -88,7 +88,7 @@ bool test_no_deduction_points_and_normals_xyz(const char* file_name)
input.clear(); input.clear();
input.close(); input.close();
input.open(file_name); input.open(file_name);
CGAL::read_xyz_points( CGAL::read_XYZ(
input, back_inserter(pv_pairs), input, back_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>()). normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>()).
@ -108,7 +108,7 @@ bool test_no_deduction_points_and_normals_off(const char* file_name)
// read with custom output iterator type // read with custom output iterator type
dummy_counter::counter = 0; dummy_counter::counter = 0;
std::ifstream input(file_name); std::ifstream input(file_name);
CGAL::read_off_points<dummy_counter>( CGAL::read_OFF<dummy_counter>(
input, back_inserter(indices), input, back_inserter(indices),
CGAL::parameters::point_map(points). CGAL::parameters::point_map(points).
normal_map(normals). normal_map(normals).
@ -118,7 +118,7 @@ bool test_no_deduction_points_and_normals_off(const char* file_name)
input.clear(); input.clear();
input.close(); input.close();
input.open(file_name); input.open(file_name);
CGAL::read_off_points( CGAL::read_OFF(
input, back_inserter(pv_pairs), input, back_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>()). normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>()).
@ -137,7 +137,7 @@ bool test_no_deduction_points_xyz(const char* file_name)
// read with custom output iterator type // read with custom output iterator type
dummy_counter::counter = 0; dummy_counter::counter = 0;
std::ifstream input(file_name); std::ifstream input(file_name);
CGAL::read_xyz_points<dummy_counter>( CGAL::read_XYZ<dummy_counter>(
input, back_inserter(indices), input, back_inserter(indices),
CGAL::parameters::point_map(points_1).geom_traits(Kernel())); CGAL::parameters::point_map(points_1).geom_traits(Kernel()));
@ -145,7 +145,7 @@ bool test_no_deduction_points_xyz(const char* file_name)
input.clear(); input.clear();
input.close(); input.close();
input.open(file_name); input.open(file_name);
CGAL::read_xyz_points( CGAL::read_XYZ(
input, back_inserter(points_2), input, back_inserter(points_2),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()). CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()).
geom_traits(Kernel())); geom_traits(Kernel()));
@ -163,7 +163,7 @@ bool test_no_deduction_points_off(const char* file_name)
// read with custom output iterator type // read with custom output iterator type
dummy_counter::counter = 0; dummy_counter::counter = 0;
std::ifstream input(file_name); std::ifstream input(file_name);
CGAL::read_off_points<dummy_counter>( CGAL::read_OFF<dummy_counter>(
input, back_inserter(indices), input, back_inserter(indices),
CGAL::parameters::point_map(points_1). CGAL::parameters::point_map(points_1).
geom_traits(Kernel())); geom_traits(Kernel()));
@ -172,7 +172,7 @@ bool test_no_deduction_points_off(const char* file_name)
input.clear(); input.clear();
input.close(); input.close();
input.open(file_name); input.open(file_name);
CGAL::read_off_points( CGAL::read_OFF(
input, back_inserter(points_2), input, back_inserter(points_2),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()). CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()).
geom_traits(Kernel())); geom_traits(Kernel()));
@ -187,14 +187,14 @@ void compile_test() {
std::ifstream input; std::ifstream input;
input.open("data/read_test/simple.xyz"); input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points( CGAL::read_XYZ(
input, input,
std::front_inserter(points)); std::front_inserter(points));
input.clear(); input.clear();
input.close(); input.close();
input.open("data/read_test/simple.xyz"); input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points( CGAL::read_XYZ(
input, input,
std::front_inserter(points), std::front_inserter(points),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>())); CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()));
@ -202,7 +202,7 @@ void compile_test() {
input.close(); input.close();
input.open("data/read_test/simple.xyz"); input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points( CGAL::read_XYZ(
input, input,
std::front_inserter(points), std::front_inserter(points),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()). CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()).
@ -212,21 +212,21 @@ void compile_test() {
// this will span all OutputIteratorValueType versions // this will span all OutputIteratorValueType versions
input.open("data/read_test/simple.xyz"); input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points<Point_3>( CGAL::read_XYZ<Point_3>(
input, input,
std::front_inserter(points)); std::front_inserter(points));
input.clear(); input.clear();
input.close(); input.close();
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
input.open("data/read_test/simple.off"); input.open("data/read_test/simple.off");
CGAL::read_off_points( CGAL::read_OFF(
input, input,
std::front_inserter(points)); std::front_inserter(points));
input.clear(); input.clear();
input.close(); input.close();
input.open("data/read_test/simple.off"); input.open("data/read_test/simple.off");
CGAL::read_off_points( CGAL::read_OFF(
input, input,
std::front_inserter(points), std::front_inserter(points),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>())); CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()));
@ -234,7 +234,7 @@ void compile_test() {
input.close(); input.close();
input.open("data/read_test/simple.off"); input.open("data/read_test/simple.off");
CGAL::read_off_points( CGAL::read_OFF(
input, input,
std::front_inserter(points), std::front_inserter(points),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()). CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()).
@ -244,14 +244,14 @@ void compile_test() {
// this will span all OutputIteratorValueType versions // this will span all OutputIteratorValueType versions
input.open("data/read_test/simple.off"); input.open("data/read_test/simple.off");
CGAL::read_off_points<Point_3>( CGAL::read_OFF<Point_3>(
input, input,
std::front_inserter(points)); std::front_inserter(points));
input.clear(); input.clear();
input.close(); input.close();
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
input.open("data/read_test/simple.xyz"); input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points( CGAL::read_XYZ(
input, input,
std::front_inserter(points), std::front_inserter(points),
CGAL::parameters::normal_map(boost::dummy_property_map())); CGAL::parameters::normal_map(boost::dummy_property_map()));
@ -259,7 +259,7 @@ void compile_test() {
input.close(); input.close();
input.open("data/read_test/simple.xyz"); input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points( CGAL::read_XYZ(
input, input,
std::front_inserter(pv_pairs), std::front_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
@ -268,7 +268,7 @@ void compile_test() {
input.close(); input.close();
input.open("data/read_test/simple.xyz"); input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points( CGAL::read_XYZ(
input, input,
std::front_inserter(pv_pairs), std::front_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
@ -278,7 +278,7 @@ void compile_test() {
input.close(); input.close();
input.open("data/read_test/simple.xyz"); input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points<Point_3>( CGAL::read_XYZ<Point_3>(
input, input,
std::front_inserter(points), std::front_inserter(points),
CGAL::parameters::normal_map(boost::dummy_property_map())); CGAL::parameters::normal_map(boost::dummy_property_map()));
@ -286,7 +286,7 @@ void compile_test() {
input.close(); input.close();
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
input.open("data/read_test/simple.off"); input.open("data/read_test/simple.off");
CGAL::read_off_points( CGAL::read_OFF(
input, input,
std::front_inserter(points), std::front_inserter(points),
CGAL::parameters::normal_map(boost::dummy_property_map())); CGAL::parameters::normal_map(boost::dummy_property_map()));
@ -294,7 +294,7 @@ void compile_test() {
input.close(); input.close();
input.open("data/read_test/simple.off"); input.open("data/read_test/simple.off");
CGAL::read_off_points( CGAL::read_OFF(
input, input,
std::front_inserter(pv_pairs), std::front_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
@ -303,7 +303,7 @@ void compile_test() {
input.close(); input.close();
input.open("data/read_test/simple.off"); input.open("data/read_test/simple.off");
CGAL::read_off_points( CGAL::read_OFF(
input, input,
std::front_inserter(pv_pairs), std::front_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
@ -313,7 +313,7 @@ void compile_test() {
input.close(); input.close();
input.open("data/read_test/simple.off"); input.open("data/read_test/simple.off");
CGAL::read_off_points<Point_3>( CGAL::read_OFF<Point_3>(
input, input,
std::front_inserter(points), std::front_inserter(points),
CGAL::parameters::normal_map(boost::dummy_property_map())); CGAL::parameters::normal_map(boost::dummy_property_map()));

View File

@ -114,7 +114,7 @@ int main(int argc, char * argv[])
// If XYZ file format: // If XYZ file format:
std::ifstream stream(input_filename.c_str()); std::ifstream stream(input_filename.c_str());
if(stream && if(stream &&
CGAL::read_xyz_points(stream, std::back_inserter(points))) CGAL::read_XYZ(stream, std::back_inserter(points)))
{ {
std::cerr << "ok (" << points.size() << " points)" << std::endl; std::cerr << "ok (" << points.size() << " points)" << std::endl;
} }

View File

@ -106,7 +106,7 @@ int main(int argc, char * argv[])
// If XYZ file format: // If XYZ file format:
std::ifstream stream(input_filename.c_str()); std::ifstream stream(input_filename.c_str());
if(stream && if(stream &&
CGAL::read_xyz_points(stream, std::back_inserter(points))) CGAL::read_XYZ(stream, std::back_inserter(points)))
{ {
std::cerr << "ok (" << points.size() << " points)" << std::endl; std::cerr << "ok (" << points.size() << " points)" << std::endl;
} }

View File

@ -127,7 +127,7 @@ int main(int argc, char * argv[])
// If XYZ file format: // If XYZ file format:
std::ifstream stream(input_filename.c_str()); std::ifstream stream(input_filename.c_str());
if(stream && if(stream &&
CGAL::read_xyz_points(stream, std::back_inserter(points))) CGAL::read_XYZ(stream, std::back_inserter(points)))
{ {
std::cerr << "ok (" << points.size() << " points)" << std::endl; std::cerr << "ok (" << points.size() << " points)" << std::endl;
} }

View File

@ -189,7 +189,7 @@ int main(int argc, char * argv[])
// + property maps to access each point's position and normal. // + property maps to access each point's position and normal.
std::ifstream stream(input_filename.c_str()); std::ifstream stream(input_filename.c_str());
if (!stream || if (!stream ||
!CGAL::read_xyz_points( !CGAL::read_XYZ(
stream, stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map CGAL::parameters::point_map

View File

@ -45,7 +45,7 @@ int main(void)
PointList points; PointList points;
std::ifstream stream("data/kitten.xyz"); std::ifstream stream("data/kitten.xyz");
if (!stream || if (!stream ||
!CGAL::read_xyz_points( !CGAL::read_XYZ(
stream, stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map (Point_map()). CGAL::parameters::point_map (Point_map()).

View File

@ -18,7 +18,7 @@ int main(void)
std::vector<Pwn> points; std::vector<Pwn> points;
std::ifstream stream("data/kitten.xyz"); std::ifstream stream("data/kitten.xyz");
if (!stream || if (!stream ||
!CGAL::read_xyz_points( !CGAL::read_XYZ(
stream, stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<Pwn>()). CGAL::parameters::point_map(CGAL::First_of_pair_property_map<Pwn>()).

View File

@ -140,7 +140,7 @@ int main(int argc, char * argv[])
// The position property map can be omitted here as we use iterators over Point_3 elements. // The position property map can be omitted here as we use iterators over Point_3 elements.
std::ifstream stream(input_filename.c_str()); std::ifstream stream(input_filename.c_str());
if (!stream || if (!stream ||
!CGAL::read_xyz_points( !CGAL::read_XYZ(
stream, stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::normal_map CGAL::parameters::normal_map

View File

@ -42,102 +42,102 @@ typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
int main() int main()
{ {
const std::string& input_file("data/building.ply"); const std::string& input_file("data/building.ply");
std::ifstream input_stream(input_file.c_str()); std::ifstream input_stream(input_file.c_str());
std::vector<PNI> points; // store points std::vector<PNI> points; // store points
std::cout << "Loading point cloud: " << input_file << "..."; std::cout << "Loading point cloud: " << input_file << "...";
CGAL::Timer t; CGAL::Timer t;
t.start(); t.start();
if (!input_stream || if (!input_stream ||
!CGAL::read_ply_points_with_properties( !CGAL::read_PLY_with_properties(
input_stream, input_stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::make_ply_point_reader(Point_map()), CGAL::make_ply_point_reader(Point_map()),
CGAL::make_ply_normal_reader(Normal_map()), CGAL::make_ply_normal_reader(Normal_map()),
std::make_pair(Plane_index_map(), CGAL::PLY_property<int>("segment_index")))) std::make_pair(Plane_index_map(), CGAL::PLY_property<int>("segment_index"))))
{ {
std::cerr << "Error: cannot read file " << input_file << std::endl; std::cerr << "Error: cannot read file " << input_file << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
else else
std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl; std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
std::cout << "Generating candidate faces..."; std::cout << "Generating candidate faces...";
t.reset(); t.reset();
Polygonal_surface_reconstruction algo( Polygonal_surface_reconstruction algo(
points, points,
Point_map(), Point_map(),
Normal_map(), Normal_map(),
Plane_index_map() Plane_index_map()
); );
std::cout << " Done. Time: " << t.time() << " sec." << std::endl; std::cout << " Done. Time: " << t.time() << " sec." << std::endl;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Reconstruction with complexity control // Reconstruction with complexity control
// Model 1: more detail // Model 1: more detail
Surface_mesh model; Surface_mesh model;
std::cout << "Reconstructing with complexity 0.05..."; std::cout << "Reconstructing with complexity 0.05...";
t.reset(); t.reset();
if (!algo.reconstruct<MIP_Solver>(model, 0.8, 0.15, 0.05)) { if (!algo.reconstruct<MIP_Solver>(model, 0.8, 0.15, 0.05)) {
std::cerr << " Failed: " << algo.error_message() << std::endl; std::cerr << " Failed: " << algo.error_message() << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
else { else {
const std::string& output_file = "data/building_result-0.05.off"; const std::string& output_file = "data/building_result-0.05.off";
std::ofstream output_stream(output_file.c_str()); std::ofstream output_stream(output_file.c_str());
if (output_stream && CGAL::write_off(output_stream, model)) if (output_stream && CGAL::write_off(output_stream, model))
std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl;
else { else {
std::cerr << " Failed saving file." << std::endl; std::cerr << " Failed saving file." << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} }
// Model 2: a little less detail // Model 2: a little less detail
std::cout << "Reconstructing with complexity 0.5..."; std::cout << "Reconstructing with complexity 0.5...";
t.reset(); t.reset();
if (!algo.reconstruct<MIP_Solver>(model, 0.3, 0.2, 0.5)) { if (!algo.reconstruct<MIP_Solver>(model, 0.3, 0.2, 0.5)) {
std::cerr << " Failed: " << algo.error_message() << std::endl; std::cerr << " Failed: " << algo.error_message() << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
else { else {
const std::string& output_file = "data/building_result-0.5.off"; const std::string& output_file = "data/building_result-0.5.off";
std::ofstream output_stream(output_file.c_str()); std::ofstream output_stream(output_file.c_str());
if (output_stream && CGAL::write_off(output_stream, model)) if (output_stream && CGAL::write_off(output_stream, model))
std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl;
else { else {
std::cerr << " Failed saving file." << std::endl; std::cerr << " Failed saving file." << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} }
// Model 3: more less detail // Model 3: more less detail
std::cout << "Reconstructing with complexity 0.7..."; std::cout << "Reconstructing with complexity 0.7...";
t.reset(); t.reset();
if (!algo.reconstruct<MIP_Solver>(model, 0.2, 0.1, 0.7)) { if (!algo.reconstruct<MIP_Solver>(model, 0.2, 0.1, 0.7)) {
std::cerr << " Failed: " << algo.error_message() << std::endl; std::cerr << " Failed: " << algo.error_message() << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
else { else {
const std::string& output_file = "data/building_result-0.7.off"; const std::string& output_file = "data/building_result-0.7.off";
std::ofstream output_stream(output_file.c_str()); std::ofstream output_stream(output_file.c_str());
if (output_stream && CGAL::write_off(output_stream, model)) if (output_stream && CGAL::write_off(output_stream, model))
std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl;
else { else {
std::cerr << " Failed saving file." << std::endl; std::cerr << " Failed saving file." << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -42,65 +42,65 @@ typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
int main() int main()
{ {
const std::string& input_file("data/ball.ply"); const std::string& input_file("data/ball.ply");
std::ifstream input_stream(input_file.c_str()); std::ifstream input_stream(input_file.c_str());
std::vector<PNI> points; // store points std::vector<PNI> points; // store points
std::cout << "Loading point cloud: " << input_file << "..."; std::cout << "Loading point cloud: " << input_file << "...";
CGAL::Timer t; CGAL::Timer t;
t.start(); t.start();
if (!input_stream || if (!input_stream ||
!CGAL::read_ply_points_with_properties( !CGAL::read_PLY_with_properties(
input_stream, input_stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::make_ply_point_reader(Point_map()), CGAL::make_ply_point_reader(Point_map()),
CGAL::make_ply_normal_reader(Normal_map()), CGAL::make_ply_normal_reader(Normal_map()),
std::make_pair(Plane_index_map(), CGAL::PLY_property<int>("segment_index")))) std::make_pair(Plane_index_map(), CGAL::PLY_property<int>("segment_index"))))
{ {
std::cerr << "Error: cannot read file " << input_file << std::endl; std::cerr << "Error: cannot read file " << input_file << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
else else
std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl; std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
std::cout << "Generating candidate faces..."; std::cout << "Generating candidate faces...";
t.reset(); t.reset();
Polygonal_surface_reconstruction algo( Polygonal_surface_reconstruction algo(
points, points,
Point_map(), Point_map(),
Normal_map(), Normal_map(),
Plane_index_map() Plane_index_map()
); );
std::cout << " Done. Time: " << t.time() << " sec." << std::endl; std::cout << " Done. Time: " << t.time() << " sec." << std::endl;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Surface_mesh model; Surface_mesh model;
std::cout << "Reconstructing..."; std::cout << "Reconstructing...";
t.reset(); t.reset();
if (!algo.reconstruct<MIP_Solver>(model)) { if (!algo.reconstruct<MIP_Solver>(model)) {
std::cerr << " Failed: " << algo.error_message() << std::endl; std::cerr << " Failed: " << algo.error_message() << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
// Saves the mesh model // Saves the mesh model
const std::string& output_file("data/ball_result.off"); const std::string& output_file("data/ball_result.off");
std::ofstream output_stream(output_file.c_str()); std::ofstream output_stream(output_file.c_str());
if (output_stream && CGAL::write_off(output_stream, model)) if (output_stream && CGAL::write_off(output_stream, model))
std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl;
else { else {
std::cerr << " Failed saving file." << std::endl; std::cerr << " Failed saving file." << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -101,7 +101,7 @@ int main()
CGAL::Timer t; CGAL::Timer t;
t.start(); t.start();
if (!input_stream || if (!input_stream ||
!CGAL::read_xyz_points(input_stream, !CGAL::read_XYZ(input_stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()).normal_map(Normal_map()))) { CGAL::parameters::point_map(Point_map()).normal_map(Normal_map()))) {

View File

@ -68,7 +68,7 @@ int main()
CGAL::Timer t; CGAL::Timer t;
t.start(); t.start();
if (!input_stream || if (!input_stream ||
!CGAL::read_xyz_points(input_stream, !CGAL::read_XYZ(input_stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()).normal_map(Normal_map()))) CGAL::parameters::point_map(Point_map()).normal_map(Normal_map())))
{ {

View File

@ -85,7 +85,7 @@ int reconstruct(const std::string& input_file, bool force_extract_planes)
CGAL::Timer t; CGAL::Timer t;
t.start(); t.start();
if (extension == ".pwn") { if (extension == ".pwn") {
if (!CGAL::read_xyz_points( if (!CGAL::read_XYZ(
input_stream, input_stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()).normal_map(Normal_map()))) CGAL::parameters::point_map(Point_map()).normal_map(Normal_map())))
@ -97,7 +97,7 @@ int reconstruct(const std::string& input_file, bool force_extract_planes)
std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl; std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl;
} }
else if (extension == ".ply") { else if (extension == ".ply") {
if (!CGAL::read_ply_points_with_properties( if (!CGAL::read_PLY_with_properties(
input_stream, input_stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::make_ply_point_reader(Point_map()), CGAL::make_ply_point_reader(Point_map()),

View File

@ -123,7 +123,7 @@ Polyhedron_demo_off_plugin::load_off(QFileInfo fileinfo) {
Scene_points_with_normal_item* item = new Scene_points_with_normal_item(); Scene_points_with_normal_item* item = new Scene_points_with_normal_item();
item->setName(fileinfo.completeBaseName()); item->setName(fileinfo.completeBaseName());
if (scanner.size_of_vertices()==0) return item; if (scanner.size_of_vertices()==0) return item;
if(!item->read_off_point_set(in)) if(!item->read_OFF(in))
{ {
delete item; delete item;
return 0; return 0;

View File

@ -60,7 +60,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene)
// Read .xyz in a point set // Read .xyz in a point set
Scene_points_with_normal_item* point_set_item = new Scene_points_with_normal_item; Scene_points_with_normal_item* point_set_item = new Scene_points_with_normal_item;
point_set_item->setName(fileinfo.completeBaseName()); point_set_item->setName(fileinfo.completeBaseName());
if(!point_set_item->read_xyz_point_set(in)) { if(!point_set_item->read_XYZ(in)) {
delete point_set_item; delete point_set_item;
ok = false; ok = false;
return QList<Scene_item*>(); return QList<Scene_item*>();

View File

@ -553,7 +553,7 @@ bool Scene_points_with_normal_item::read_las_point_set(std::istream& stream)
d->m_points->clear(); d->m_points->clear();
bool ok = stream && bool ok = stream &&
CGAL::read_las_point_set (stream, *(d->m_points)) && CGAL::read_LAS (stream, *(d->m_points)) &&
!isEmpty(); !isEmpty();
std::cerr << d->m_points->info(); std::cerr << d->m_points->info();
@ -580,7 +580,7 @@ bool Scene_points_with_normal_item::write_las_point_set(std::ostream& stream) co
d->m_points->reset_indices(); d->m_points->reset_indices();
return stream && return stream &&
CGAL::write_las_point_set (stream, *(d->m_points)); CGAL::write_LAS (stream, *(d->m_points));
} }
#endif // LAS #endif // LAS
@ -593,7 +593,7 @@ bool Scene_points_with_normal_item::read_ply_point_set(std::istream& stream)
d->m_points->clear(); d->m_points->clear();
bool ok = stream && bool ok = stream &&
CGAL::read_ply_point_set (stream, *(d->m_points), d->m_comments) && CGAL::read_PLY (stream, *(d->m_points), d->m_comments) &&
!isEmpty(); !isEmpty();
d->point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize()); d->point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize());
std::cerr << d->m_points->info(); std::cerr << d->m_points->info();
@ -639,7 +639,7 @@ bool Scene_points_with_normal_item::read_off_point_set(std::istream& stream)
d->m_points->clear(); d->m_points->clear();
bool ok = stream && bool ok = stream &&
CGAL::read_off_point_set(stream, *(d->m_points)) && CGAL::read_OFF(stream, *(d->m_points)) &&
!isEmpty(); !isEmpty();
d->point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize()); d->point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize());
invalidateOpenGLBuffers(); invalidateOpenGLBuffers();
@ -654,7 +654,7 @@ bool Scene_points_with_normal_item::write_off_point_set(std::ostream& stream) co
d->m_points->reset_indices(); d->m_points->reset_indices();
return stream && return stream &&
CGAL::write_off_point_set (stream, *(d->m_points)); CGAL::write_OFF (stream, *(d->m_points));
} }
// Loads point set from .XYZ file // Loads point set from .XYZ file
@ -665,7 +665,7 @@ bool Scene_points_with_normal_item::read_xyz_point_set(std::istream& stream)
d->m_points->clear(); d->m_points->clear();
bool ok = stream && bool ok = stream &&
CGAL::read_xyz_point_set (stream, *(d->m_points)) && CGAL::read_XYZ (stream, *(d->m_points)) &&
!isEmpty(); !isEmpty();
d->point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize()); d->point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize());
invalidateOpenGLBuffers(); invalidateOpenGLBuffers();

View File

@ -32,7 +32,7 @@ int main(int argc, char** argv) {
std::ifstream stream(argc > 1 ? argv[1] : "data/cube.pwn"); std::ifstream stream(argc > 1 ? argv[1] : "data/cube.pwn");
if (!stream || if (!stream ||
!CGAL::read_xyz_points( !CGAL::read_XYZ(
stream, stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).

View File

@ -37,7 +37,7 @@ int main (int argc, char** argv) {
std::ifstream stream(filename); std::ifstream stream(filename);
if (!stream || if (!stream ||
!CGAL::read_xyz_points( !CGAL::read_XYZ(
stream, stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).

View File

@ -64,7 +64,7 @@ int main (int argc, char** argv) {
std::ifstream stream(filename); std::ifstream stream(filename);
if (!stream || if (!stream ||
!CGAL::read_xyz_points( !CGAL::read_XYZ(
stream, stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).

View File

@ -30,7 +30,7 @@ int main(int argc, char** argv) {
std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn"); std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn");
if (!stream || if (!stream ||
!CGAL::read_xyz_points( !CGAL::read_XYZ(
stream, stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).

View File

@ -34,7 +34,7 @@ int main(int argc, char** argv) {
std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn"); std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn");
if (!stream || if (!stream ||
!CGAL::read_xyz_points( !CGAL::read_XYZ(
stream, stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).

View File

@ -31,7 +31,7 @@ int main(int argc, char** argv) {
std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn"); std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn");
if (!stream || if (!stream ||
!CGAL::read_xyz_points( !CGAL::read_XYZ(
stream, stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).

View File

@ -162,7 +162,7 @@ int main(int argc, char *argv[]) {
std::ofstream out(fullpath); std::ofstream out(fullpath);
CGAL::set_ascii_mode(out); CGAL::set_ascii_mode(out);
CGAL::write_ply_points_with_properties( CGAL::write_PLY_with_properties(
out, pwc, out, pwc,
CGAL::make_ply_point_writer(PLY_Point_map()), CGAL::make_ply_point_writer(PLY_Point_map()),
std::make_tuple( std::make_tuple(

View File

@ -43,7 +43,7 @@ int run(const char* filename) {
std::ifstream stream(filename); std::ifstream stream(filename);
if (!stream || if (!stream ||
!CGAL::read_xyz_points(stream, !CGAL::read_XYZ(stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map()))) { normal_map(Normal_map()))) {

View File

@ -36,7 +36,7 @@ bool test_scene(int argc, char** argv) {
std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn"); std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn");
if (!stream || if (!stream ||
!CGAL::read_xyz_points(stream, !CGAL::read_XYZ(stream,
std::back_inserter(points), std::back_inserter(points),
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map()))) normal_map(Normal_map())))

View File

@ -132,8 +132,8 @@ make_ply_normal_writer(VectorMap normal_map)
/// \endcond /// \endcond
namespace IO {
namespace IO {
namespace internal { namespace internal {
class PLY_read_number class PLY_read_number
@ -675,7 +675,7 @@ void process_properties(PLY_element& element, OutputValueType& new_element,
template <typename Integer, class PolygonRange, class ColorRange> template <typename Integer, class PolygonRange, class ColorRange>
bool read_PLY_faces(std::istream& in, bool read_PLY_faces(std::istream& in,
IO::internal::PLY_element& element, PLY_element& element,
PolygonRange& polygons, PolygonRange& polygons,
ColorRange& fcolors, ColorRange& fcolors,
const char* vertex_indices_tag) const char* vertex_indices_tag)
@ -698,7 +698,7 @@ bool read_PLY_faces(std::istream& in,
{ {
for(std::size_t k = 0; k < element.number_of_properties(); ++ k) for(std::size_t k = 0; k < element.number_of_properties(); ++ k)
{ {
IO::internal::PLY_read_number* property = element.property(k); PLY_read_number* property = element.property(k);
property->get(in); property->get(in);
if(in.fail()) if(in.fail())
@ -736,8 +736,8 @@ bool read_PLY_faces(std::istream& in,
return true; return true;
} }
} // namespace PLY
} // namespace internal } // namespace internal
} // namespace IO
} // namespace CGAL } // namespace CGAL
#endif // CGAL_IO_PLY_PLY_READER_H #endif // CGAL_IO_PLY_PLY_READER_H

View File

@ -151,7 +151,7 @@ void Scene::loadPointsXYZ(const char* filename)
/* Note: this function reads in points only (normals are ignored) */ /* Note: this function reads in points only (normals are ignored) */
/* Note: this function can NOT omit comments (starting with '#') */ /* Note: this function can NOT omit comments (starting with '#') */
list<Point_3> pts; list<Point_3> pts;
if( !CGAL::read_xyz_points( fin, // input ifstream if( !CGAL::read_XYZ( fin, // input ifstream
back_inserter(pts) ) ) { // output iterator over points back_inserter(pts) ) ) { // output iterator over points
showError( QObject::tr("Error: cannot read file %1.").arg(filename) ); showError( QObject::tr("Error: cannot read file %1.").arg(filename) );
} }