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);
if (!stream ||
!CGAL::read_xyz_points(stream,
!CGAL::read_XYZ(stream,
std::back_inserter(points),
CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map())))

View File

@ -53,7 +53,7 @@ int main (int argc, char** argv)
std::cerr << "Reading input" << std::endl;
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;
return EXIT_FAILURE;

View File

@ -72,7 +72,7 @@ int main (int argc, char** argv)
std::cerr << "Reading input" << std::endl;
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;
return EXIT_FAILURE;

View File

@ -16,7 +16,7 @@ int main (int argc, char** argv)
Point_set point_set;
// 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 "
<<(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;
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;
}

View File

@ -19,7 +19,7 @@ int main (int argc, char** argv)
Point_set point_set;
// 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;
return EXIT_FAILURE;
@ -39,7 +39,7 @@ int main (int argc, char** argv)
// Writing result in OFF format
std::ofstream out("normalized_normals.off");
out.precision(17);
if (!out || !CGAL::write_off_point_set (out, point_set))
if (!out || !CGAL::write_OFF (out, point_set))
{
return EXIT_FAILURE;
}

View File

@ -29,8 +29,12 @@
#include <CGAL/IO/PLY.h>
namespace CGAL {
namespace IO {
namespace internal {
namespace IO
{
namespace internal
{
template <typename Point,
typename Vector = typename Kernel_traits<Point>::Kernel::Vector_3>
@ -62,7 +66,7 @@ private:
boost::tie (m_map, boost::tuples::ignore) = ps.add_property_map(name, Type());
m_pmap = ps.push_property_map (m_map);
}
virtual void assign (PLY_element& element, typename Point_set::Index index)
{
Type t{};
@ -70,13 +74,13 @@ private:
put(m_pmap, index, t);
}
};
Point_set& m_point_set;
bool m_use_floats;
std::vector<Abstract_ply_property_to_point_set_property*> m_properties;
public:
Point_set_3_filler (Point_set& point_set)
: m_point_set (point_set), m_use_floats (false)
{ }
@ -90,10 +94,10 @@ public:
void instantiate_properties (PLY_element& element)
{
bool has_normal[3] = { false, false, false };
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();
if (name == "x" ||
@ -172,11 +176,11 @@ public:
if (has_normal[0] && has_normal[1] && has_normal[2])
m_point_set.add_normal_map();
}
void process_line (PLY_element& element)
{
m_point_set.insert();
if (m_use_floats)
process_line<float>(element);
else
@ -208,15 +212,16 @@ public:
}
};
} // namespace internal
} // namespace IO
}
}
/*!
\ingroup PkgPointSet3IO
*/
template <typename Point, typename Vector>
bool
read_xyz_point_set(
read_XYZ(
std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
@ -239,7 +244,7 @@ read_xyz_point_set(
if (!has_normals)
point_set.remove_normal_map();
return out;
}
@ -248,13 +253,13 @@ read_xyz_point_set(
*/
template <typename Point, typename Vector>
bool
read_off_point_set(
read_OFF(
std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
point_set.add_normal_map();
bool out = CGAL::read_off_points
bool out = CGAL::read_OFF
(stream,
point_set.index_back_inserter(),
CGAL::parameters::point_map(point_set.point_push_map()).
@ -279,12 +284,12 @@ read_off_point_set(
/// \cond SKIP_IN_MANUAL
template <typename Point, typename Vector>
bool
read_ply_point_set(
read_PLY(
std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
std::string dummy;
return read_ply_point_set (stream, point_set, dummy);
return read_PLY (stream, point_set, dummy);
}
/// \endcond
@ -308,7 +313,7 @@ read_ply_point_set(
*/
template <typename Point, typename Vector>
bool
read_ply_point_set(
read_PLY(
std::istream& stream, ///< input stream.
CGAL::Point_set_3<Point, Vector>& point_set, ///< point set
std::string& comments) ///< PLY comments.
@ -340,7 +345,7 @@ read_ply_point_set(
point_set.reserve (element.number_of_items());
filler.instantiate_properties (element);
}
for (std::size_t j = 0; j < element.number_of_items(); ++ j)
{
for (std::size_t k = 0; k < element.number_of_properties(); ++ k)
@ -358,7 +363,7 @@ read_ply_point_set(
return !stream.bad();
}
/*!
\ingroup PkgPointSet3IO
@ -374,7 +379,7 @@ read_ply_point_set(
*/
template <typename Point, typename Vector>
bool
write_ply_point_set(
write_PLY(
std::ostream& stream, ///< output stream.
const CGAL::Point_set_3<Point, Vector>& point_set, ///< point set.
const std::string& comments = std::string()) ///< PLY comments.
@ -393,7 +398,7 @@ write_ply_point_set(
typedef typename Point_set::template Property_map<boost::uint64_t> Uint64_map;
typedef typename Point_set::template Property_map<float> Float_map;
typedef typename Point_set::template Property_map<double> Double_map;
stream << "ply" << std::endl
<< ((get_mode(stream) == IO::BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl
<< "comment Generated by the CGAL library" << std::endl;
@ -408,12 +413,12 @@ write_ply_point_set(
stream << "comment " << line << std::endl;
}
}
stream << "element vertex " << point_set.number_of_points() << std::endl;
std::vector<std::string> prop = point_set.base().properties();
std::vector<IO::internal::Abstract_property_printer<Index>*> printers;
for (std::size_t i = 0; i < prop.size(); ++ i)
{
if (prop[i] == "index")
@ -453,7 +458,7 @@ write_ply_point_set(
printers.push_back (new IO::internal::Property_printer<Index,Vector_map>(point_set.normal_map()));
continue;
}
bool okay = false;
{
Int8_map pmap;
@ -556,8 +561,8 @@ write_ply_point_set(
}
}
}
stream << "end_header" << std::endl;
stream << "end_header" << std::endl;
for (typename Point_set::const_iterator it = point_set.begin(); it != point_set.end(); ++ it)
{
@ -592,13 +597,13 @@ namespace internal
}
}
/*!
\ingroup PkgPointSet3IO
*/
template <typename Point, typename Vector>
bool
read_las_point_set(
read_LAS(
std::istream& stream, ///< input stream.
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;
bool okay
= read_las_points_with_properties
= read_LAS_with_properties
(stream, point_set.index_back_inserter(),
make_las_point_reader (point_set.point_push_map()),
std::make_pair (point_set.push_property_map (intensity), LAS_property::Intensity()),
@ -675,7 +680,7 @@ read_las_point_set(
internal::check_if_property_is_used (point_set, G);
internal::check_if_property_is_used (point_set, B);
internal::check_if_property_is_used (point_set, I);
return okay;
}
@ -684,7 +689,7 @@ read_las_point_set(
*/
template <typename Point, typename Vector>
bool
write_las_point_set(
write_LAS(
std::ostream& stream, ///< output stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
@ -705,62 +710,62 @@ write_las_point_set(
bool remove_intensity;
boost::tie(intensity, remove_intensity)
= point_set.template add_property_map<unsigned short>("intensity", 0);
Uchar_map return_number;
bool remove_return_number;
boost::tie (return_number, remove_return_number)
= point_set.template add_property_map<unsigned char>("return_number", 0);
Uchar_map number_of_returns;
bool remove_number_of_returns;
boost::tie (number_of_returns, remove_number_of_returns)
= point_set.template add_property_map<unsigned char>("number_of_returns", 0);
Uchar_map scan_direction_flag;
bool remove_scan_direction_flag;
boost::tie (scan_direction_flag, remove_scan_direction_flag)
= point_set.template add_property_map<unsigned char>("scan_direction_flag", 0);
Uchar_map edge_of_flight_line;
bool remove_edge_of_flight_line;
boost::tie (edge_of_flight_line, remove_edge_of_flight_line)
= point_set.template add_property_map<unsigned char>("edge_of_flight_line", 0);
Uchar_map classification;
bool remove_classification;
boost::tie (classification, remove_classification)
= point_set.template add_property_map<unsigned char>("classification", 0);
Uchar_map synthetic_flag;
bool remove_synthetic_flag;
boost::tie (synthetic_flag, remove_synthetic_flag)
= point_set.template add_property_map<unsigned char>("synthetic_flag", 0);
Uchar_map keypoint_flag;
bool remove_keypoint_flag;
boost::tie (keypoint_flag, remove_keypoint_flag)
= point_set.template add_property_map<unsigned char>("keypoint_flag", 0);
Uchar_map withheld_flag;
bool remove_withheld_flag;
boost::tie (withheld_flag, remove_withheld_flag)
= point_set.template add_property_map<unsigned char>("withheld_flag", 0);
Float_map scan_angle;
bool remove_scan_angle;
boost::tie (scan_angle, remove_scan_angle)
= point_set.template add_property_map<float>("scan_angle", 0.);
Uchar_map user_data;
bool remove_user_data;
boost::tie (user_data, remove_user_data)
= point_set.template add_property_map<unsigned char>("user_data", 0);
Ushort_map point_source_ID;
bool remove_point_source_ID;
boost::tie (point_source_ID, remove_point_source_ID)
= point_set.template add_property_map<unsigned short>("point_source_ID", 0);
Uint_map deleted_flag;
bool remove_deleted_flag;
boost::tie (deleted_flag, remove_deleted_flag)
@ -808,9 +813,9 @@ write_las_point_set(
}
}
}
bool okay
= write_las_points_with_properties
= write_LAS
(stream, point_set,
make_las_point_writer (point_set.point_map()),
std::make_pair (intensity, LAS_property::Intensity()),
@ -850,28 +855,28 @@ write_las_point_set(
if (remove_G) point_set.remove_property_map (G);
if (remove_B) point_set.remove_property_map (B);
if (remove_I) point_set.remove_property_map (I);
return okay;
}
#endif // LAS
/*!
\ingroup PkgPointSet3IO
*/
template <typename Point, typename Vector>
bool
write_xyz_point_set(
write_XYZ(
std::ostream& stream, ///< output stream.
const CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
if (point_set.has_normal_map())
return CGAL::write_xyz_points
return CGAL::write_XYZ
(stream, point_set,
CGAL::parameters::point_map(point_set.point_map()).
normal_map(point_set.normal_map()));
return CGAL::write_xyz_points
return CGAL::write_XYZ
(stream, point_set,
CGAL::parameters::point_map(point_set.point_map()));
}
@ -881,24 +886,24 @@ write_xyz_point_set(
*/
template <typename Point, typename Vector>
bool
write_off_point_set(
write_OFF(
std::ostream& stream, ///< output stream.
const CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
if (point_set.has_normal_map())
return CGAL::write_off_points
return CGAL::write_OFF
(stream, point_set,
CGAL::parameters::point_map(point_set.point_map()).
normal_map(point_set.normal_map()));
return CGAL::write_off_points
return CGAL::write_OFF
(stream, point_set,
CGAL::parameters::point_map(point_set.point_map()));
}
/*!
\ingroup PkgPointSet3IO
\brief Reads the point set from an input stream that can be either:
@ -924,21 +929,21 @@ std::istream& operator>>(std::istream& is,
is.seekg(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)
CGAL::read_ply_point_set (is, ps);
CGAL::read_PLY (is, ps);
#ifdef CGAL_LINKED_WITH_LASLIB
else if (line.find("LASF") == 0)
CGAL::read_las_point_set (is, ps);
#endif // LAS
else
CGAL::read_xyz_point_set (is, ps);
CGAL::read_XYZ (is, ps);
return is;
}
/*!
\ingroup PkgPointSet3IO
\brief Inserts the point set in an output stream in ASCII PLY
@ -954,8 +959,148 @@ std::ostream& operator<<(std::ostream& 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

View File

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

View File

@ -28,7 +28,7 @@ int main(int argc, char*argv[])
std::vector<IndexedPointWithColorTuple> points;
std::ifstream stream(fname);
if (!stream ||
!CGAL::read_xyz_points(
!CGAL::read_XYZ(
stream, std::back_inserter(points),
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::ifstream stream(input_filename);
if (!stream ||
!CGAL::read_xyz_points(stream,
!CGAL::read_XYZ(stream,
std::back_inserter(points),
CGAL::parameters::point_map(CGAL::First_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);
out.precision(17);
if (!out ||
!CGAL::write_xyz_points(
!CGAL::write_XYZ(
out, points,
CGAL::parameters::point_map(CGAL::First_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);
if (!stream ||
!CGAL::read_xyz_points(stream,
!CGAL::read_XYZ(stream,
std::back_inserter(points),
CGAL::parameters::point_map(CGAL::First_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);
out.precision(17);
if (!out ||
!CGAL::write_xyz_points(
!CGAL::write_XYZ(
out, points,
CGAL::parameters::point_map(CGAL::First_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::ifstream stream("data/fandisk.off");
if (!stream ||
!CGAL::read_off_points(stream,
!CGAL::read_OFF(stream,
std::back_inserter(points),
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";
std::ifstream stream(fname);
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;
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";
std::ifstream stream(fname);
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;
return EXIT_FAILURE;
@ -42,7 +42,7 @@ int main(int argc, char*argv[])
std::ofstream f ("out.xyz");
f.precision(17);
CGAL::write_xyz_points (f, points);
CGAL::write_XYZ (f, points);
return EXIT_SUCCESS;
}

View File

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

View File

@ -27,7 +27,7 @@ int main(int argc, char*argv[])
std::list<PointVectorPair> points;
std::ifstream stream(fname);
if (!stream ||
!CGAL::read_xyz_points(stream,
!CGAL::read_XYZ(stream,
std::back_inserter(points),
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::ifstream stream(fname);
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;
return EXIT_FAILURE;
@ -36,8 +36,8 @@ int main(int argc, char*argv[])
std::ofstream out((argc>2)?argv[2]:"Three_lady_copy.xyz");
out.precision(17);
if (!out ||
!CGAL::write_xyz_points(
out, points))
!CGAL::write_XYZ(
out, points))
{
return EXIT_FAILURE;
}

View File

@ -22,7 +22,7 @@ int main(int argc, char*argv[])
std::ifstream in(fname, std::ios_base::binary);
if (!in ||
!CGAL::read_las_points_with_properties
!CGAL::read_LAS_with_properties
(in,
std::back_inserter (points),
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);
if (!in ||
!CGAL::read_ply_points_with_properties
!CGAL::read_PLY_with_properties
(in,
std::back_inserter (points),
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";
// 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
// point position and normal.
std::vector<Pwn> points;
std::ifstream in(fname);
if (!in ||
!CGAL::read_xyz_points(
!CGAL::read_XYZ(
in,std::back_inserter(points),
CGAL::parameters::point_map (CGAL::First_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");
out.precision(17);
if (!out ||
!CGAL::write_xyz_points(
!CGAL::write_XYZ(
out, points,
CGAL::parameters::point_map(CGAL::First_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::ifstream input(fname1);
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>()).
normal_map (Normal_map())))
{
@ -38,7 +38,7 @@ int main(int argc, const char** argv)
input.open(fname2);
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()).
normal_map (Normal_map())))
{
@ -71,7 +71,7 @@ int main(int argc, const char** argv)
std::ofstream out("pwns2_aligned.ply");
if (!out ||
!CGAL::write_ply_points(
!CGAL::write_PLY(
out, pwns2,
CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map())))

View File

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

View File

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

View File

@ -20,7 +20,7 @@ int main(int argc, char*argv[])
std::vector<Point> points;
std::ifstream stream(fname);
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>())))
{
std::cerr << "Error: cannot read file " << fname << std::endl;

View File

@ -31,7 +31,7 @@ int main (int argc, char** argv)
// read input
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;
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");
if (!stream ||
!CGAL::read_xyz_points(stream,
!CGAL::read_XYZ(stream,
std::back_inserter(points),
CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map())))
@ -67,8 +67,8 @@ int main (int argc, char** argv)
<< " structured point(s) generated." << std::endl;
std::ofstream out ("out.pwn");
CGAL::write_xyz_points (out, structured_pts,
CGAL::parameters::point_map(Point_map()).normal_map(Normal_map()));
CGAL::write_XYZ (out, structured_pts,
CGAL::parameters::point_map(Point_map()).normal_map(Normal_map()));
out.close();
return EXIT_SUCCESS;

View File

@ -23,7 +23,7 @@ int main(int argc, char** argv)
std::vector<Point> points;
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;
@ -43,7 +43,7 @@ int main(int argc, char** argv)
std::ofstream out(output_filename);
out.precision(17);
if (!out || !CGAL::write_xyz_points(
if (!out || !CGAL::write_XYZ(
out, output))
{
return EXIT_FAILURE;

View File

@ -54,7 +54,7 @@ int main(int, char**)
std::ofstream f("out.ply", std::ios::binary);
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,
CGAL::make_ply_point_writer (Point_map()),
std::make_tuple(Color_map(),

View File

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

View File

@ -67,7 +67,7 @@ template <typename OutputIteratorValueType,
#endif
>
bool
read_off_points(
read_OFF(
std::istream& stream,
OutputIterator output,
#ifdef DOXYGEN_RUNNING
@ -186,11 +186,11 @@ read_off_points(
template <typename OutputIteratorValueType,
typename OutputIterator>
bool
read_off_points(
read_OFF(
std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points.
{
return read_off_points<OutputIteratorValueType>
return read_OFF<OutputIteratorValueType>
(stream, output, CGAL::parameters::all_default());
}
@ -198,23 +198,23 @@ read_off_points(
template <typename OutputIterator,
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool
read_off_points(
read_OFF(
std::istream& stream, ///< input stream.
OutputIterator output,
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);
}
// variant with default NP and output iterator value type
template <typename OutputIterator>
bool
read_off_points(
read_OFF(
std::istream& stream, ///< input stream.
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());
}
@ -235,7 +235,7 @@ read_off_points_and_normals(
NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3.
const Kernel& /*kernel*/) ///< geometric traits.
{
return read_off_points<OutputIteratorValueType>
return read_OFF<OutputIteratorValueType>
(stream, output,
CGAL::parameters::point_map (point_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.
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,
CGAL::parameters::point_map (point_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.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return read_off_points<OutputIteratorValueType>
return read_OFF<OutputIteratorValueType>
(stream, output,
CGAL::parameters::point_map (point_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.
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,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
@ -315,7 +315,7 @@ read_off_points_and_normals(
OutputIterator output, ///< output iterator over points.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return read_off_points<OutputIteratorValueType>
return read_OFF<OutputIteratorValueType>
(stream, output,
CGAL::parameters::normal_map (normal_map));
}
@ -331,7 +331,7 @@ read_off_points_and_normals(
OutputIterator output, ///< output iterator over points.
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,
CGAL::parameters::normal_map (normal_map));
}
@ -411,6 +411,67 @@ read_off_points(
/// \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
#endif // CGAL_READ_OFF_POINTS_H

View File

@ -38,57 +38,57 @@
namespace CGAL {
#ifdef DOXYGEN_RUNNING // Document some parts from Stream_support here for convenience
/**
/**
\ingroup PkgPointSetProcessing3IOPly
Class used to identify a %PLY property as a type and a name.
\sa `read_ply_points_with_properties()`
\sa `read_PLY_with_properties()`
*/
template <typename T>
struct PLY_property
{
typedef T type;
const char* name;
PLY_property (const char* name) : name (name) { }
};
template <typename T>
struct PLY_property
{
typedef T type;
const char* name;
PLY_property (const char* name) : name (name) { }
};
/**
/**
\ingroup PkgPointSetProcessing3IOPly
Generates a %PLY property handler to read 3D points. Points are
constructed from the input using 3 %PLY properties of type `FT`
and named `x`, `y` and `z`. `FT` is `float` if the points use
`CGAL::Simple_cartesian<float>` and `double` otherwise.
\sa `read_ply_points_with_properties()`
\sa `read_PLY_with_properties()`
\tparam PointMap the property map used to store points.
*/
template <typename PointMap>
std::tuple<PointMap,
typename Kernel_traits<typename PointMap::value_type>::Kernel::Construct_point_3,
PLY_property<FT>, PLY_property<FT>, PLY_property<FT> >
make_ply_point_reader(PointMap point_map);
template <typename PointMap>
std::tuple<PointMap,
typename Kernel_traits<typename PointMap::value_type>::Kernel::Construct_point_3,
PLY_property<FT>, PLY_property<FT>, PLY_property<FT> >
make_ply_point_reader(PointMap point_map);
/**
/**
\ingroup PkgPointSetProcessing3IOPly
Generates a %PLY property handler to read 3D normal
vectors. Vectors are constructed from the input using 3 PLY
properties of type `FT` and named `nx`, `ny` and `nz`. `FT`
is `float` if the points use `CGAL::Simple_cartesian<float>` and
`double` otherwise.
\sa `read_ply_points_with_properties()`
\sa `read_PLY_with_properties()`
\tparam VectorMap the property map used to store vectors.
*/
template <typename VectorMap>
std::tuple<VectorMap,
typename Kernel_traits<typename VectorMap::value_type>::Kernel::Construct_vector_3,
PLY_property<FT>, PLY_property<FT>, PLY_property<FT> >
make_ply_normal_reader(VectorMap normal_map);
template <typename VectorMap>
std::tuple<VectorMap,
typename Kernel_traits<typename VectorMap::value_type>::Kernel::Construct_vector_3,
PLY_property<FT>, PLY_property<FT>, PLY_property<FT> >
make_ply_normal_reader(VectorMap normal_map);
#endif // DOXYGEN_RUNNING
/**
@ -128,26 +128,26 @@ namespace CGAL {
template <typename OutputIteratorValueType,
typename OutputIterator,
typename ... PropertyHandler>
bool read_ply_points_with_properties (std::istream& stream,
OutputIterator output,
PropertyHandler&& ... properties)
bool read_PLY_with_properties (std::istream& stream,
OutputIterator output,
PropertyHandler&& ... properties)
{
typedef typename value_type_traits<OutputIterator>::type OutputValueType;
if(!stream)
{
std::cerr << "Error: cannot open file" << std::endl;
return false;
}
{
std::cerr << "Error: cannot open file" << std::endl;
return false;
}
IO::internal::PLY_reader reader;
if (!(reader.init (stream)))
{
stream.setstate(std::ios::failbit);
return false;
}
for (std::size_t i = 0; i < reader.number_of_elements(); ++ i)
{
IO::internal::PLY_element& element = reader.element(i);
@ -178,17 +178,17 @@ bool read_ply_points_with_properties (std::istream& stream,
/// \cond SKIP_IN_MANUAL
template <typename OutputIterator,
typename ... PropertyHandler>
bool read_ply_points_with_properties (std::istream& stream,
OutputIterator output,
PropertyHandler&& ... properties)
bool read_PLY_with_properties (std::istream& stream,
OutputIterator output,
PropertyHandler&& ... properties)
{
typedef typename value_type_traits<OutputIterator>::type OutputValueType;
return read_ply_points_with_properties<OutputValueType>
(stream, output, std::forward<PropertyHandler>(properties)...);
return read_PLY_with_properties<OutputValueType>
(stream, output, std::forward<PropertyHandler>(properties)...);
}
/// \endcond
/**
\ingroup PkgPointSetProcessing3IOPly
Reads points (positions + normals, if available) from a .ply
@ -218,25 +218,25 @@ bool read_ply_points_with_properties (std::istream& stream,
*/
template < typename OutputIteratorValueType,
typename OutputIterator,
#ifdef DOXYGEN_RUNNING
#ifdef DOXYGEN_RUNNING
typename NamedParameters
#else
#else
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS
#endif
>
bool read_ply_points(std::istream& stream,
OutputIterator output,
#ifdef DOXYGEN_RUNNING
const NamedParameters& np)
#endif
>
bool read_PLY(std::istream& stream,
OutputIterator output,
#ifdef DOXYGEN_RUNNING
const NamedParameters& np)
#else
const CGAL_BGL_NP_CLASS& np)
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;
// basic geometric types
typedef typename CGAL::GetPointMap<PointRange, CGAL_BGL_NP_CLASS>::type PointMap;
typedef typename Point_set_processing_3::GetNormalMap<PointRange, CGAL_BGL_NP_CLASS>::type NormalMap;
@ -248,50 +248,50 @@ bool read_ply_points(std::istream& stream,
NormalMap normal_map = choose_parameter<NormalMap>(get_parameter(np, internal_np::normal_map));
if (has_normals)
return read_ply_points_with_properties (stream, output,
make_ply_point_reader (point_map),
make_ply_normal_reader (normal_map));
return read_PLY_with_properties (stream, output,
make_ply_point_reader (point_map),
make_ply_normal_reader (normal_map));
// else
return read_ply_points_with_properties (stream, output,
make_ply_point_reader (point_map));
return read_PLY_with_properties (stream, output,
make_ply_point_reader (point_map));
}
/// \cond SKIP_IN_MANUAL
/// \cond SKIP_IN_MANUAL
// variant with default NP
template <typename OutputIteratorValueType,
typename OutputIterator>
bool
read_ply_points(
std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points.
read_PLY(
std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points.
{
return read_ply_points<OutputIteratorValueType>
(stream, output, CGAL::parameters::all_default());
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>
bool
read_ply_points(
std::istream& stream, ///< input stream.
OutputIterator output,
const CGAL_BGL_NP_CLASS& np)
read_PLY(
std::istream& stream, ///< input stream.
OutputIterator output,
const CGAL_BGL_NP_CLASS& np)
{
return read_ply_points<typename value_type_traits<OutputIterator>::type>
(stream, output, 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>
bool
read_ply_points(
std::istream& stream, ///< input stream.
OutputIterator output)
read_PLY(
std::istream& stream, ///< input stream.
OutputIterator output)
{
return read_ply_points<typename value_type_traits<OutputIterator>::type>
(stream, output, CGAL::parameters::all_default());
return read_PLY<typename value_type_traits<OutputIterator>::type>
(stream, output, CGAL::parameters::all_default());
}
#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.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return read_ply_points<OutputIteratorValueType>
(stream, output,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
return read_PLY<OutputIteratorValueType>
(stream, output,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
}
// 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.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return read_ply_points<typename value_type_traits<OutputIterator>::type>
(stream, output,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
return read_PLY<typename value_type_traits<OutputIterator>::type>
(stream, output,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
}
// deprecated API
@ -337,9 +337,9 @@ bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return read_ply_points<OutputIteratorValueType>
(stream, output,
CGAL::parameters::normal_map (normal_map));
return read_PLY<OutputIteratorValueType>
(stream, output,
CGAL::parameters::normal_map (normal_map));
}
// deprecated API
@ -350,26 +350,26 @@ bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points.
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return read_ply_points<typename value_type_traits<OutputIterator>::type>
(stream, output,
CGAL::parameters::normal_map (normal_map));
return read_PLY<typename value_type_traits<OutputIterator>::type>
(stream, output,
CGAL::parameters::normal_map (normal_map));
}
// deprecated API
// deprecated API
template <typename OutputIteratorValueType,
typename OutputIterator,
typename PointMap
>
>
CGAL_DEPRECATED_MSG("you are using the deprecated V1 API of CGAL::read_ply_points(), please update your code")
bool
read_ply_points(
std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
return read_ply_points<OutputIteratorValueType>
(stream, output,
CGAL::parameters::point_map (point_map));
return read_PLY<OutputIteratorValueType>
(stream, output,
CGAL::parameters::point_map (point_map));
}
// deprecated API
@ -380,14 +380,106 @@ bool read_ply_points(std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points.
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
return read_ply_points<typename value_type_traits<OutputIterator>::type>
(stream, output,
CGAL::parameters::point_map (point_map));
return read_PLY<typename value_type_traits<OutputIterator>::type>
(stream, output,
CGAL::parameters::point_map (point_map));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \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
#undef TRY_TO_GENERATE_POINT_PROPERTY

View File

@ -66,7 +66,7 @@ template <typename OutputIteratorValueType,
#endif
>
bool
read_xyz_points(
read_XYZ(
std::istream& stream,
OutputIterator output,
#ifdef DOXYGEN_RUNNING
@ -178,11 +178,11 @@ read_xyz_points(
template <typename OutputIteratorValueType,
typename OutputIterator>
bool
read_xyz_points(
read_XYZ(
std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points.
{
return read_xyz_points<OutputIteratorValueType>
return read_XYZ<OutputIteratorValueType>
(stream, output, CGAL::parameters::all_default());
}
@ -190,23 +190,23 @@ read_xyz_points(
template <typename OutputIterator,
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool
read_xyz_points(
read_XYZ(
std::istream& stream, ///< input stream.
OutputIterator output,
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);
}
// variant with default NP and output iterator value type
template <typename OutputIterator>
bool
read_xyz_points(
read_XYZ(
std::istream& stream, ///< input stream.
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());
}
@ -227,7 +227,7 @@ read_xyz_points_and_normals(
NormalPMap normal_map, ///< property map: value_type of OutputIterator -> Vector_3.
const Kernel& /*kernel*/) ///< geometric traits.
{
return read_xyz_points<OutputIteratorValueType>
return read_XYZ<OutputIteratorValueType>
(stream, output,
CGAL::parameters::point_map (point_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.
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,
CGAL::parameters::point_map (point_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.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return read_xyz_points<OutputIteratorValueType>
return read_XYZ<OutputIteratorValueType>
(stream, output,
CGAL::parameters::point_map (point_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.
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,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
@ -307,7 +307,7 @@ read_xyz_points_and_normals(
OutputIterator output, ///< output iterator over points.
NormalPMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
return read_xyz_points<OutputIteratorValueType>
return read_XYZ<OutputIteratorValueType>
(stream, output,
CGAL::parameters::normal_map (normal_map));
}
@ -323,7 +323,7 @@ read_xyz_points_and_normals(
OutputIterator output, ///< output iterator over points.
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,
CGAL::parameters::normal_map (normal_map));
}
@ -342,7 +342,7 @@ read_xyz_points(
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
const Kernel& kernel) ///< geometric traits.
{
return read_xyz_points<OutputIteratorValueType>
return read_XYZ<OutputIteratorValueType>
(stream, output,
CGAL::parameters::point_map (point_map).
geom_traits (kernel));
@ -361,7 +361,7 @@ read_xyz_points(
PointPMap point_map, ///< property map: value_type of OutputIterator -> Point_3.
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,
CGAL::parameters::point_map (point_map).
geom_traits (kernel));
@ -379,7 +379,7 @@ read_xyz_points(
OutputIterator output, ///< output iterator over points.
PointPMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
return read_xyz_points<OutputIteratorValueType>
return read_XYZ<OutputIteratorValueType>
(stream, output,
CGAL::parameters::point_map (point_map));
}
@ -395,14 +395,81 @@ read_xyz_points(
OutputIterator output, ///< output iterator over points.
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,
CGAL::parameters::point_map (point_map));
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \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
#endif // CGAL_READ_XYZ_POINTS_H

View File

@ -63,7 +63,7 @@ namespace CGAL {
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.
*/
@ -169,7 +169,7 @@ namespace internal {
writing an `int` vairable as an `int` %LAS property). An exception
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.
\sa `make_las_point_writer()`
@ -186,13 +186,13 @@ namespace internal {
template <typename PointRange,
typename PointMap,
typename ... PropertyHandler>
bool write_las_points_with_properties (std::ostream& stream, ///< output stream.
const PointRange& points, ///< input point range.
std::tuple<PointMap,
LAS_property::X,
LAS_property::Y,
LAS_property::Z> point_property, ///< property handler for points
PropertyHandler&& ... properties) ///< parameter pack of property handlers
bool write_LAS_with_properties (std::ostream& stream, ///< output stream.
const PointRange& points, ///< input point range.
std::tuple<PointMap,
LAS_property::X,
LAS_property::Y,
LAS_property::Z> point_property, ///< property handler for points
PropertyHandler&& ... properties) ///< parameter pack of property handlers
{
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,
typename NamedParameters>
bool
write_las_points(
write_LAS(
std::ostream& stream,
const PointRange& points,
const NamedParameters& np)
@ -279,7 +279,7 @@ write_las_points(
typedef typename CGAL::GetPointMap<PointRange, NamedParameters>::type PointMap;
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
@ -290,7 +290,7 @@ write_las_points(
std::ostream& stream,
const PointRange& points)
{
return write_las_points
return write_LAS
(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.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_las_points
return write_LAS
(stream, points,
CGAL::parameters::point_map(point_map));
}
@ -322,13 +322,48 @@ write_las_points(
ForwardIterator beyond) ///< past-the-end input point.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_las_points
return write_LAS
(stream, points);
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \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
#endif // CGAL_WRITE_LAS_POINTS_H

View File

@ -20,6 +20,9 @@
#include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/Iterator_range.h>
#include <boost/utility/enable_if.hpp>
#include <iostream>
#include <iterator>
@ -57,10 +60,16 @@ template <typename PointRange,
typename NamedParameters
>
bool
write_off_points(
write_OFF(
std::ostream& stream,
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::get_parameter;
@ -103,11 +112,17 @@ write_off_points(
// variant with default NP
template <typename PointRange>
bool
write_off_points(
std::ostream& stream, ///< output stream.
const PointRange& points)
write_OFF(
std::ostream& stream, ///< output stream.
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));
}
@ -230,8 +245,36 @@ write_off_points(
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \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
#endif // CGAL_WRITE_OFF_POINTS_H

View File

@ -36,13 +36,13 @@ namespace CGAL {
#ifdef DOXYGEN_RUNNING // Document some parts from Stream_support here for convenience
/**
\ingroup PkgPointSetProcessing3IOPly
Generates a %PLY property handler to write 3D points. Points are
written as 3 %PLY properties of type `FT` and named `x`, `y` and
`z`. `FT` is `float` if the points use
`CGAL::Simple_cartesian<float>` and `double` otherwise.
\sa `write_ply_points_with_properties()`
\sa `write_PLY_with_properties()`
\tparam PointMap the property map used to store points.
*/
@ -52,13 +52,13 @@ namespace CGAL {
/**
\ingroup PkgPointSetProcessing3IOPly
Generates a %PLY property handler to write 3D normal
vectors. Vectors are written as 3 %PLY properties of type `FT`
and named `nx`, `ny` and `nz`. `FT` is `float` if the vectors use
`CGAL::Simple_cartesian<float>` and `double` otherwise.
\sa `write_ply_points_with_properties()`
\sa `write_PLY_with_properties()`
\tparam VectorMap the property map used to store vectors.
*/
@ -75,7 +75,7 @@ namespace internal {
} // namespace PLY
} // namespace internal
/// \endcond
@ -115,7 +115,7 @@ namespace internal {
template < typename PointRange,
typename ... PropertyHandler>
bool
write_ply_points_with_properties(
write_PLY_with_properties(
std::ostream& stream, ///< output stream.
const PointRange& points, ///< input point range.
PropertyHandler&& ... properties) ///< parameter pack of property handlers
@ -133,11 +133,11 @@ write_ply_points_with_properties(
<< ((get_mode(stream) == IO::BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl
<< "comment Generated by the CGAL library" << std::endl
<< "element vertex " << points.size() << std::endl;
IO::internal::output_property_header (stream, std::forward<PropertyHandler>(properties)...);
stream << "end_header" << std::endl;
// Write positions + normals
for(typename PointRange::const_iterator it = points.begin(); it != points.end(); it++)
@ -174,33 +174,42 @@ write_ply_points_with_properties(
\cgalRequiresCPP11
*/
template <typename PointRange,
typename NamedParameters>
#ifdef DOXYGEN_RUNNING
typename NamedParameters
#else
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS
#endif
>
bool
write_ply_points(
write_PLY(
std::ostream& stream,
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::get_parameter;
// basic geometric types
typedef typename CGAL::GetPointMap<PointRange, NamedParameters>::type PointMap;
typedef typename Point_set_processing_3::GetNormalMap<PointRange, NamedParameters>::type NormalMap;
typedef typename CGAL::GetPointMap<PointRange, CGAL_BGL_NP_CLASS>::type PointMap;
typedef typename Point_set_processing_3::GetNormalMap<PointRange, CGAL_BGL_NP_CLASS>::type 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));
NormalMap normal_map = choose_parameter<NormalMap>(get_parameter(np, internal_np::normal_map));
if (has_normals)
return write_ply_points_with_properties(
return write_PLY_with_properties(
stream, points,
make_ply_point_writer(point_map),
make_ply_normal_writer(normal_map));
// else
return write_ply_points_with_properties(
return write_PLY_with_properties(
stream, points,
make_ply_point_writer(point_map));
}
@ -209,11 +218,11 @@ write_ply_points(
// variant with default NP
template <typename PointRange>
bool
write_ply_points(
write_PLY(
std::ostream& stream,
const PointRange& points)
{
return write_ply_points
return write_PLY
(stream, points, CGAL::Point_set_processing_3::parameters::all_default(points));
}
@ -232,12 +241,12 @@ write_ply_points_and_normals(
VectorMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_ply_points
return write_PLY
(stream, points,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
}
// deprecated API
template <typename ForwardIterator,
typename VectorMap
@ -251,7 +260,7 @@ write_ply_points_and_normals(
VectorMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_ply_points
return write_PLY
(stream, points,
CGAL::parameters::normal_map (normal_map));
}
@ -268,7 +277,7 @@ write_ply_points(
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_ply_points
return write_PLY
(stream, points,
CGAL::parameters::point_map(point_map));
}
@ -283,12 +292,60 @@ write_ply_points(
ForwardIterator beyond) ///< past-the-end input point.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_ply_points
return write_PLY
(stream, points);
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \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

View File

@ -57,10 +57,10 @@ template <typename PointRange,
typename NamedParameters
>
bool
write_xyz_points(
std::ostream& stream,
const PointRange& points,
const NamedParameters& np)
write_XYZ(
std::ostream& stream,
const PointRange& points,
const NamedParameters& np)
{
using parameters::choose_parameter;
using parameters::get_parameter;
@ -99,12 +99,12 @@ write_xyz_points(
// variant with default NP
template <typename PointRange>
bool
write_xyz_points(
std::ostream& stream, ///< output stream.
const PointRange& points)
write_XYZ(
std::ostream& stream, ///< output stream.
const PointRange& points)
{
return write_xyz_points
(stream, points, CGAL::Point_set_processing_3::parameters::all_default(points));
return write_XYZ
(stream, points, CGAL::Point_set_processing_3::parameters::all_default(points));
}
#ifndef CGAL_NO_DEPRECATED_CODE
@ -125,11 +125,11 @@ write_xyz_points_and_normals(
const Kernel& /*kernel*/) ///< geometric traits.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_xyz_points
(stream, points,
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
geom_traits(Kernel()));
return write_XYZ
(stream, points,
CGAL::parameters::point_map (point_map).
normal_map (normal_map).
geom_traits(Kernel()));
}
// deprecated API
@ -147,10 +147,10 @@ write_xyz_points_and_normals(
NormalMap normal_map) ///< property map: value_type of OutputIterator -> Vector_3.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_xyz_points
(stream, points,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
return write_XYZ
(stream, points,
CGAL::parameters::point_map (point_map).
normal_map (normal_map));
}
// deprecated API
@ -166,9 +166,9 @@ write_xyz_points_and_normals(
NormalMap normal_map) ///< property map: value_type of ForwardIterator -> Vector_3.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_xyz_points
(stream, points,
CGAL::parameters::normal_map(normal_map));
return write_XYZ
(stream, points,
CGAL::parameters::normal_map(normal_map));
}
// deprecated API
@ -186,10 +186,10 @@ write_xyz_points(
const Kernel& kernel)
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_xyz_points
(stream, points,
CGAL::parameters::point_map(point_map).
geom_traits (kernel));
return write_XYZ
(stream, points,
CGAL::parameters::point_map(point_map).
geom_traits (kernel));
}
// deprecated API
template <typename ForwardIterator,
@ -204,9 +204,9 @@ write_xyz_points(
PointMap point_map) ///< property map: value_type of OutputIterator -> Point_3.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_xyz_points
(stream, points,
CGAL::parameters::point_map(point_map));
return write_XYZ
(stream, points,
CGAL::parameters::point_map(point_map));
}
// deprecated API
@ -220,13 +220,46 @@ write_xyz_points(
ForwardIterator beyond) ///< past-the-end input point.
{
CGAL::Iterator_range<ForwardIterator> points (first, beyond);
return write_xyz_points
(stream, points);
return write_XYZ
(stream, points);
}
#endif // CGAL_NO_DEPRECATED_CODE
/// \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
#endif // CGAL_WRITE_XYZ_POINTS_H

View File

@ -104,7 +104,7 @@ int main(int argc, char * argv[])
// If XYZ file format:
std::ifstream stream(input_filename.c_str());
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;
}

View File

@ -113,7 +113,7 @@ int main(int argc, char * argv[])
// If XYZ file format:
std::ifstream stream(input_filename.c_str());
if(stream &&
CGAL::read_xyz_points(stream,
CGAL::read_XYZ(stream,
std::back_inserter(points),
CGAL::parameters::point_map(CGAL::First_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());
success = stream &&
CGAL::read_xyz_points(stream,
CGAL::read_XYZ(stream,
std::back_inserter(points),
CGAL::parameters::normal_map
(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::vector<PointVectorPair> pv_pairs;
return CGAL::read_xyz_points(fs,
return CGAL::read_XYZ(fs,
back_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_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());
return CGAL::read_xyz_points(fs,
return CGAL::read_XYZ(fs,
back_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_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
dummy_counter::counter = 0;
std::ifstream input(file_name);
CGAL::read_xyz_points<dummy_counter>(
CGAL::read_XYZ<dummy_counter>(
input, back_inserter(indices),
CGAL::parameters::point_map (points).
normal_map (normals).
@ -88,7 +88,7 @@ bool test_no_deduction_points_and_normals_xyz(const char* file_name)
input.clear();
input.close();
input.open(file_name);
CGAL::read_xyz_points(
CGAL::read_XYZ(
input, back_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_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
dummy_counter::counter = 0;
std::ifstream input(file_name);
CGAL::read_off_points<dummy_counter>(
CGAL::read_OFF<dummy_counter>(
input, back_inserter(indices),
CGAL::parameters::point_map(points).
normal_map(normals).
@ -118,7 +118,7 @@ bool test_no_deduction_points_and_normals_off(const char* file_name)
input.clear();
input.close();
input.open(file_name);
CGAL::read_off_points(
CGAL::read_OFF(
input, back_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_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
dummy_counter::counter = 0;
std::ifstream input(file_name);
CGAL::read_xyz_points<dummy_counter>(
CGAL::read_XYZ<dummy_counter>(
input, back_inserter(indices),
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.close();
input.open(file_name);
CGAL::read_xyz_points(
CGAL::read_XYZ(
input, back_inserter(points_2),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()).
geom_traits(Kernel()));
@ -163,7 +163,7 @@ bool test_no_deduction_points_off(const char* file_name)
// read with custom output iterator type
dummy_counter::counter = 0;
std::ifstream input(file_name);
CGAL::read_off_points<dummy_counter>(
CGAL::read_OFF<dummy_counter>(
input, back_inserter(indices),
CGAL::parameters::point_map(points_1).
geom_traits(Kernel()));
@ -172,7 +172,7 @@ bool test_no_deduction_points_off(const char* file_name)
input.clear();
input.close();
input.open(file_name);
CGAL::read_off_points(
CGAL::read_OFF(
input, back_inserter(points_2),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()).
geom_traits(Kernel()));
@ -187,14 +187,14 @@ void compile_test() {
std::ifstream input;
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points(
CGAL::read_XYZ(
input,
std::front_inserter(points));
input.clear();
input.close();
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points(
CGAL::read_XYZ(
input,
std::front_inserter(points),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()));
@ -202,7 +202,7 @@ void compile_test() {
input.close();
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points(
CGAL::read_XYZ(
input,
std::front_inserter(points),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()).
@ -212,21 +212,21 @@ void compile_test() {
// this will span all OutputIteratorValueType versions
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points<Point_3>(
CGAL::read_XYZ<Point_3>(
input,
std::front_inserter(points));
input.clear();
input.close();
//-----------------------------------------------------------------------
input.open("data/read_test/simple.off");
CGAL::read_off_points(
CGAL::read_OFF(
input,
std::front_inserter(points));
input.clear();
input.close();
input.open("data/read_test/simple.off");
CGAL::read_off_points(
CGAL::read_OFF(
input,
std::front_inserter(points),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()));
@ -234,7 +234,7 @@ void compile_test() {
input.close();
input.open("data/read_test/simple.off");
CGAL::read_off_points(
CGAL::read_OFF(
input,
std::front_inserter(points),
CGAL::parameters::point_map(CGAL::Identity_property_map<Point_3>()).
@ -244,14 +244,14 @@ void compile_test() {
// this will span all OutputIteratorValueType versions
input.open("data/read_test/simple.off");
CGAL::read_off_points<Point_3>(
CGAL::read_OFF<Point_3>(
input,
std::front_inserter(points));
input.clear();
input.close();
//-----------------------------------------------------------------------
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points(
CGAL::read_XYZ(
input,
std::front_inserter(points),
CGAL::parameters::normal_map(boost::dummy_property_map()));
@ -259,7 +259,7 @@ void compile_test() {
input.close();
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points(
CGAL::read_XYZ(
input,
std::front_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
@ -268,7 +268,7 @@ void compile_test() {
input.close();
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points(
CGAL::read_XYZ(
input,
std::front_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
@ -278,7 +278,7 @@ void compile_test() {
input.close();
input.open("data/read_test/simple.xyz");
CGAL::read_xyz_points<Point_3>(
CGAL::read_XYZ<Point_3>(
input,
std::front_inserter(points),
CGAL::parameters::normal_map(boost::dummy_property_map()));
@ -286,7 +286,7 @@ void compile_test() {
input.close();
//-----------------------------------------------------------------------
input.open("data/read_test/simple.off");
CGAL::read_off_points(
CGAL::read_OFF(
input,
std::front_inserter(points),
CGAL::parameters::normal_map(boost::dummy_property_map()));
@ -294,7 +294,7 @@ void compile_test() {
input.close();
input.open("data/read_test/simple.off");
CGAL::read_off_points(
CGAL::read_OFF(
input,
std::front_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
@ -303,7 +303,7 @@ void compile_test() {
input.close();
input.open("data/read_test/simple.off");
CGAL::read_off_points(
CGAL::read_OFF(
input,
std::front_inserter(pv_pairs),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
@ -313,7 +313,7 @@ void compile_test() {
input.close();
input.open("data/read_test/simple.off");
CGAL::read_off_points<Point_3>(
CGAL::read_OFF<Point_3>(
input,
std::front_inserter(points),
CGAL::parameters::normal_map(boost::dummy_property_map()));

View File

@ -114,7 +114,7 @@ int main(int argc, char * argv[])
// If XYZ file format:
std::ifstream stream(input_filename.c_str());
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;
}

View File

@ -106,7 +106,7 @@ int main(int argc, char * argv[])
// If XYZ file format:
std::ifstream stream(input_filename.c_str());
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;
}

View File

@ -127,7 +127,7 @@ int main(int argc, char * argv[])
// If XYZ file format:
std::ifstream stream(input_filename.c_str());
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;
}

View File

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

View File

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

View File

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

View File

@ -35,109 +35,109 @@ typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
/*
* The following example shows how to control the model complexity by
* increasing the influence of the model complexity term.
* In this example, the intermediate results from plane extraction and
* In this example, the intermediate results from plane extraction and
* candidate generation are cached and reused.
*/
int main()
{
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 << "...";
CGAL::Timer t;
t.start();
std::cout << "Loading point cloud: " << input_file << "...";
CGAL::Timer t;
t.start();
if (!input_stream ||
!CGAL::read_ply_points_with_properties(
input_stream,
std::back_inserter(points),
CGAL::make_ply_point_reader(Point_map()),
CGAL::make_ply_normal_reader(Normal_map()),
std::make_pair(Plane_index_map(), CGAL::PLY_property<int>("segment_index"))))
{
std::cerr << "Error: cannot read file " << input_file << std::endl;
return EXIT_FAILURE;
}
else
std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl;
if (!input_stream ||
!CGAL::read_PLY_with_properties(
input_stream,
std::back_inserter(points),
CGAL::make_ply_point_reader(Point_map()),
CGAL::make_ply_normal_reader(Normal_map()),
std::make_pair(Plane_index_map(), CGAL::PLY_property<int>("segment_index"))))
{
std::cerr << "Error: cannot read file " << input_file << std::endl;
return EXIT_FAILURE;
}
else
std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl;
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
std::cout << "Generating candidate faces...";
t.reset();
std::cout << "Generating candidate faces...";
t.reset();
Polygonal_surface_reconstruction algo(
points,
Point_map(),
Normal_map(),
Plane_index_map()
);
Polygonal_surface_reconstruction algo(
points,
Point_map(),
Normal_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
// Model 1: more detail
Surface_mesh model;
// Reconstruction with complexity control
std::cout << "Reconstructing with complexity 0.05...";
t.reset();
if (!algo.reconstruct<MIP_Solver>(model, 0.8, 0.15, 0.05)) {
std::cerr << " Failed: " << algo.error_message() << std::endl;
return EXIT_FAILURE;
}
else {
// Model 1: more detail
Surface_mesh model;
std::cout << "Reconstructing with complexity 0.05...";
t.reset();
if (!algo.reconstruct<MIP_Solver>(model, 0.8, 0.15, 0.05)) {
std::cerr << " Failed: " << algo.error_message() << std::endl;
return EXIT_FAILURE;
}
else {
const std::string& output_file = "data/building_result-0.05.off";
std::ofstream output_stream(output_file.c_str());
if (output_stream && CGAL::write_off(output_stream, model))
std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl;
else {
std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl;
else {
std::cerr << " Failed saving file." << std::endl;
return EXIT_FAILURE;
}
}
}
// Model 2: a little less detail
std::cout << "Reconstructing with complexity 0.5...";
t.reset();
if (!algo.reconstruct<MIP_Solver>(model, 0.3, 0.2, 0.5)) {
std::cerr << " Failed: " << algo.error_message() << std::endl;
return EXIT_FAILURE;
}
else {
// Model 2: a little less detail
std::cout << "Reconstructing with complexity 0.5...";
t.reset();
if (!algo.reconstruct<MIP_Solver>(model, 0.3, 0.2, 0.5)) {
std::cerr << " Failed: " << algo.error_message() << std::endl;
return EXIT_FAILURE;
}
else {
const std::string& output_file = "data/building_result-0.5.off";
std::ofstream output_stream(output_file.c_str());
if (output_stream && CGAL::write_off(output_stream, model))
std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl;
else {
std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl;
else {
std::cerr << " Failed saving file." << std::endl;
return EXIT_FAILURE;
}
}
}
// Model 3: more less detail
std::cout << "Reconstructing with complexity 0.7...";
t.reset();
if (!algo.reconstruct<MIP_Solver>(model, 0.2, 0.1, 0.7)) {
std::cerr << " Failed: " << algo.error_message() << std::endl;
return EXIT_FAILURE;
}
else {
const std::string& output_file = "data/building_result-0.7.off";
std::ofstream output_stream(output_file.c_str());
if (output_stream && CGAL::write_off(output_stream, model))
std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl;
else {
std::cerr << " Failed saving file." << std::endl;
return EXIT_FAILURE;
}
}
return EXIT_SUCCESS;
// Model 3: more less detail
std::cout << "Reconstructing with complexity 0.7...";
t.reset();
if (!algo.reconstruct<MIP_Solver>(model, 0.2, 0.1, 0.7)) {
std::cerr << " Failed: " << algo.error_message() << std::endl;
return EXIT_FAILURE;
}
else {
const std::string& output_file = "data/building_result-0.7.off";
std::ofstream output_stream(output_file.c_str());
if (output_stream && CGAL::write_off(output_stream, model))
std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl;
else {
std::cerr << " Failed saving file." << std::endl;
return EXIT_FAILURE;
}
}
return EXIT_SUCCESS;
}

View File

@ -35,72 +35,72 @@ typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
/*
* The following example shows the reconstruction using user-provided
* planar segments stored in PLY format. In the PLY format, a property
* named "segment_index" stores the plane index for each point (-1 if
* the point is not assigned to a plane).
* named "segment_index" stores the plane index for each point (-1 if
* the point is not assigned to a plane).
*/
int main()
{
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 << "...";
CGAL::Timer t;
t.start();
std::cout << "Loading point cloud: " << input_file << "...";
CGAL::Timer t;
t.start();
if (!input_stream ||
!CGAL::read_ply_points_with_properties(
input_stream,
std::back_inserter(points),
CGAL::make_ply_point_reader(Point_map()),
CGAL::make_ply_normal_reader(Normal_map()),
std::make_pair(Plane_index_map(), CGAL::PLY_property<int>("segment_index"))))
{
std::cerr << "Error: cannot read file " << input_file << std::endl;
return EXIT_FAILURE;
}
else
std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl;
if (!input_stream ||
!CGAL::read_PLY_with_properties(
input_stream,
std::back_inserter(points),
CGAL::make_ply_point_reader(Point_map()),
CGAL::make_ply_normal_reader(Normal_map()),
std::make_pair(Plane_index_map(), CGAL::PLY_property<int>("segment_index"))))
{
std::cerr << "Error: cannot read file " << input_file << std::endl;
return EXIT_FAILURE;
}
else
std::cout << " Done. " << points.size() << " points. Time: " << t.time() << " sec." << std::endl;
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
std::cout << "Generating candidate faces...";
t.reset();
std::cout << "Generating candidate faces...";
t.reset();
Polygonal_surface_reconstruction algo(
points,
Point_map(),
Normal_map(),
Plane_index_map()
);
Polygonal_surface_reconstruction algo(
points,
Point_map(),
Normal_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...";
t.reset();
std::cout << "Reconstructing...";
t.reset();
if (!algo.reconstruct<MIP_Solver>(model)) {
std::cerr << " Failed: " << algo.error_message() << std::endl;
return EXIT_FAILURE;
}
if (!algo.reconstruct<MIP_Solver>(model)) {
std::cerr << " Failed: " << algo.error_message() << std::endl;
return EXIT_FAILURE;
}
// Saves the mesh model
// Saves the mesh model
const std::string& output_file("data/ball_result.off");
std::ofstream output_stream(output_file.c_str());
if (output_stream && CGAL::write_off(output_stream, model))
std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl;
else {
std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl;
else {
std::cerr << " Failed saving file." << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
return EXIT_SUCCESS;
}

View File

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

View File

@ -68,7 +68,7 @@ int main()
CGAL::Timer t;
t.start();
if (!input_stream ||
!CGAL::read_xyz_points(input_stream,
!CGAL::read_XYZ(input_stream,
std::back_inserter(points),
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;
t.start();
if (extension == ".pwn") {
if (!CGAL::read_xyz_points(
if (!CGAL::read_XYZ(
input_stream,
std::back_inserter(points),
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;
}
else if (extension == ".ply") {
if (!CGAL::read_ply_points_with_properties(
if (!CGAL::read_PLY_with_properties(
input_stream,
std::back_inserter(points),
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();
item->setName(fileinfo.completeBaseName());
if (scanner.size_of_vertices()==0) return item;
if(!item->read_off_point_set(in))
if(!item->read_OFF(in))
{
delete item;
return 0;

View File

@ -60,7 +60,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene)
// Read .xyz in a point set
Scene_points_with_normal_item* point_set_item = new Scene_points_with_normal_item;
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;
ok = false;
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();
bool ok = stream &&
CGAL::read_las_point_set (stream, *(d->m_points)) &&
CGAL::read_LAS (stream, *(d->m_points)) &&
!isEmpty();
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();
return stream &&
CGAL::write_las_point_set (stream, *(d->m_points));
CGAL::write_LAS (stream, *(d->m_points));
}
#endif // LAS
@ -593,7 +593,7 @@ bool Scene_points_with_normal_item::read_ply_point_set(std::istream& stream)
d->m_points->clear();
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();
d->point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize());
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();
bool ok = stream &&
CGAL::read_off_point_set(stream, *(d->m_points)) &&
CGAL::read_OFF(stream, *(d->m_points)) &&
!isEmpty();
d->point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize());
invalidateOpenGLBuffers();
@ -654,7 +654,7 @@ bool Scene_points_with_normal_item::write_off_point_set(std::ostream& stream) co
d->m_points->reset_indices();
return stream &&
CGAL::write_off_point_set (stream, *(d->m_points));
CGAL::write_OFF (stream, *(d->m_points));
}
// 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();
bool ok = stream &&
CGAL::read_xyz_point_set (stream, *(d->m_points)) &&
CGAL::read_XYZ (stream, *(d->m_points)) &&
!isEmpty();
d->point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize());
invalidateOpenGLBuffers();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -132,8 +132,8 @@ make_ply_normal_writer(VectorMap normal_map)
/// \endcond
namespace IO {
namespace IO {
namespace internal {
class PLY_read_number
@ -675,7 +675,7 @@ void process_properties(PLY_element& element, OutputValueType& new_element,
template <typename Integer, class PolygonRange, class ColorRange>
bool read_PLY_faces(std::istream& in,
IO::internal::PLY_element& element,
PLY_element& element,
PolygonRange& polygons,
ColorRange& fcolors,
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)
{
IO::internal::PLY_read_number* property = element.property(k);
PLY_read_number* property = element.property(k);
property->get(in);
if(in.fail())
@ -736,8 +736,8 @@ bool read_PLY_faces(std::istream& in,
return true;
}
} // namespace PLY
} // namespace internal
} // namespace IO
} // namespace CGAL
#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 can NOT omit comments (starting with '#') */
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
showError( QObject::tr("Error: cannot read file %1.").arg(filename) );
}