mirror of https://github.com/CGAL/cgal
Document how to recover/write PLY comments
This commit is contained in:
parent
a1bee88b4d
commit
a352fe8a0d
|
|
@ -295,19 +295,32 @@ read_off_point_set(
|
|||
|
||||
|
||||
#if (!defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE) && !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES)) || defined(DOXYGEN_RUNNING)
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
template <typename Point, typename Vector>
|
||||
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_point_set (stream, point_set, dummy);
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
/*!
|
||||
\ingroup PkgPointSet3IO
|
||||
|
||||
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>
|
||||
bool
|
||||
read_ply_point_set(
|
||||
std::istream& stream, ///< input stream.
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
|
||||
#else
|
||||
CGAL::Point_set_3<Point, Vector>& point_set, ///< point set
|
||||
std::string* comments = NULL) ///< recover PLY comments
|
||||
#endif
|
||||
std::string& comments) ///< PLY comments.
|
||||
{
|
||||
if(!stream)
|
||||
{
|
||||
|
|
@ -324,8 +337,7 @@ read_ply_point_set(
|
|||
return false;
|
||||
}
|
||||
|
||||
if (comments != NULL)
|
||||
*comments = reader.comments();
|
||||
comments = reader.comments();
|
||||
|
||||
for (std::size_t i = 0; i < reader.number_of_elements(); ++ i)
|
||||
{
|
||||
|
|
@ -358,17 +370,17 @@ read_ply_point_set(
|
|||
|
||||
/*!
|
||||
\ingroup PkgPointSet3IO
|
||||
|
||||
If provided, the `comments` string is included line by line in
|
||||
the header of the PLY stream (each line will be precedeed by
|
||||
"comment ").
|
||||
*/
|
||||
template <typename Point, typename Vector>
|
||||
bool
|
||||
write_ply_point_set(
|
||||
std::ostream& stream, ///< output stream.
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
const CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
|
||||
#else
|
||||
const CGAL::Point_set_3<Point, Vector>& point_set, ///< point set
|
||||
std::string* comments = NULL) ///< write PLY comments
|
||||
#endif
|
||||
const CGAL::Point_set_3<Point, Vector>& point_set, ///< point set.
|
||||
const std::string& comments = std::string()) ///< PLY comments.
|
||||
{
|
||||
typedef CGAL::Point_set_3<Point, Vector> Point_set;
|
||||
typedef typename Point_set::Index Index;
|
||||
|
|
@ -389,9 +401,9 @@ write_ply_point_set(
|
|||
<< ((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;
|
||||
|
||||
if (comments != NULL)
|
||||
if (comments != std::string())
|
||||
{
|
||||
std::istringstream iss (*comments);
|
||||
std::istringstream iss (comments);
|
||||
std::string line;
|
||||
while (getline(iss, line))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -619,7 +619,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_point_set (stream, *(d->m_points), d->m_comments) &&
|
||||
!isEmpty();
|
||||
d->point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize());
|
||||
std::cerr << d->m_points->info();
|
||||
|
|
@ -653,7 +653,7 @@ bool Scene_points_with_normal_item::write_ply_point_set(std::ostream& stream, bo
|
|||
if (binary)
|
||||
CGAL::set_binary_mode (stream);
|
||||
|
||||
CGAL::write_ply_point_set (stream, *(d->m_points), &(d->m_comments));
|
||||
CGAL::write_ply_point_set (stream, *(d->m_points), d->m_comments);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2167,6 +2167,11 @@ private: //------------------------------------------------------- private data
|
|||
/// property with simple type: if they do, all edge properties with
|
||||
/// simple types are inserted in the stream. The halfedges follow
|
||||
/// the same behavior.
|
||||
///
|
||||
/// If provided, the `comments` string is included line by line in
|
||||
/// the header of the PLY stream (each line will be precedeed by
|
||||
/// "comment ").
|
||||
///
|
||||
/// \relates Surface_mesh
|
||||
template <typename P>
|
||||
bool write_ply(std::ostream& os, const Surface_mesh<P>& sm, const std::string& comments = std::string())
|
||||
|
|
@ -2521,7 +2526,6 @@ private: //------------------------------------------------------- private data
|
|||
}
|
||||
/// \endcond
|
||||
|
||||
/// \relates Surface_mesh
|
||||
/// Extracts the surface mesh from an input stream in Ascii or
|
||||
/// Binary PLY format and appends it to the surface mesh `sm`.
|
||||
///
|
||||
|
|
@ -2540,6 +2544,11 @@ private: //------------------------------------------------------- private data
|
|||
/// added, where `[s]` is `v` for vertex and `f` for face, and
|
||||
/// `[name]` is the name of 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).
|
||||
///
|
||||
/// \pre The data in the stream must represent a two-manifold. If this is not the case
|
||||
/// the `failbit` of `is` is set and the mesh cleared.
|
||||
/// \relates Surface_mesh
|
||||
|
|
|
|||
Loading…
Reference in New Issue