mirror of https://github.com/CGAL/cgal
Uniformize whether std::string or const char* is used in the doc
This commit is contained in:
parent
6d6d959d4d
commit
26c930bc20
|
|
@ -75,6 +75,55 @@ bool read_polygon_mesh(std::istream& is,
|
|||
}
|
||||
*/
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <class Graph, typename NamedParameters>
|
||||
bool read_polygon_mesh(const std::string& fname,
|
||||
Graph& g,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
const bool verbose = parameters::choose_parameter(parameters::get_parameter(np, internal_np::verbose), false);
|
||||
|
||||
const std::string ext = IO::internal::get_file_extension(fname);
|
||||
if(ext == std::string())
|
||||
{
|
||||
if(verbose)
|
||||
std::cerr << "Error: cannot read from file without extension" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ext == "obj")
|
||||
return read_OBJ(fname, g, np);
|
||||
else if(ext == "off")
|
||||
return read_OFF(fname, g, np);
|
||||
else if(ext == "ply")
|
||||
return read_PLY(fname, g, np);
|
||||
else if(ext == "stl")
|
||||
return read_STL(fname, g, np);
|
||||
else if(ext == "ts")
|
||||
return read_GOCAD(fname, g, np);
|
||||
#ifdef CGAL_USE_VTK
|
||||
else if(ext == "vtp")
|
||||
return read_VTP(fname, g, np);
|
||||
#endif
|
||||
|
||||
if(verbose)
|
||||
{
|
||||
std::cerr << "Error: unknown input file extension: " << ext << "\n"
|
||||
<< "Please refer to the documentation for the list of supported file formats" << std::endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class Graph>
|
||||
bool read_polygon_mesh(const std::string& fname, Graph& g)
|
||||
{
|
||||
return read_polygon_mesh(fname, g, parameters::all_default());
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
||||
/*!
|
||||
* \ingroup PkgBGLIOFct
|
||||
*
|
||||
|
|
@ -130,59 +179,14 @@ bool read_polygon_mesh(std::istream& is,
|
|||
*
|
||||
* \sa \link PMP_IO_grp `CGAL::Polygon_mesh_processing::read_polygon_mesh()`\endlink if the data is not 2-manifold
|
||||
*/
|
||||
template <class Graph, typename NamedParameters>
|
||||
bool read_polygon_mesh(const std::string& fname,
|
||||
Graph& g,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
const bool verbose = parameters::choose_parameter(parameters::get_parameter(np, internal_np::verbose), false);
|
||||
|
||||
const std::string ext = IO::internal::get_file_extension(fname);
|
||||
if(ext == std::string())
|
||||
{
|
||||
if(verbose)
|
||||
std::cerr << "Error: cannot read from file without extension" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ext == "obj")
|
||||
return read_OBJ(fname, g, np);
|
||||
else if(ext == "off")
|
||||
return read_OFF(fname, g, np);
|
||||
else if(ext == "ply")
|
||||
return read_PLY(fname, g, np);
|
||||
else if(ext == "stl")
|
||||
return read_STL(fname, g, np);
|
||||
else if(ext == "ts")
|
||||
return read_GOCAD(fname, g, np);
|
||||
#ifdef CGAL_USE_VTK
|
||||
else if(ext == "vtp")
|
||||
return read_VTP(fname, g, np);
|
||||
#endif
|
||||
|
||||
if(verbose)
|
||||
{
|
||||
std::cerr << "Error: unknown input file extension: " << ext << "\n"
|
||||
<< "Please refer to the documentation for the list of supported file formats" << std::endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <class Graph>
|
||||
bool read_polygon_mesh(const std::string& fname, Graph& g)
|
||||
{
|
||||
return read_polygon_mesh(fname, g, parameters::all_default());
|
||||
}
|
||||
|
||||
template <class Graph, typename NamedParameters>
|
||||
bool read_polygon_mesh(const char* fname, Graph& g, const NamedParameters& np)
|
||||
{
|
||||
return read_polygon_mesh(std::string(fname), g, np);
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <class Graph>
|
||||
bool read_polygon_mesh(const char* fname, Graph& g)
|
||||
{
|
||||
|
|
@ -195,6 +199,55 @@ bool read_polygon_mesh(const char* fname, Graph& g)
|
|||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Write
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <class Graph, typename NamedParameters>
|
||||
bool write_polygon_mesh(const std::string& fname,
|
||||
Graph& g,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
const bool verbose = parameters::choose_parameter(parameters::get_parameter(np, internal_np::verbose), false);
|
||||
|
||||
const std::string ext = IO::internal::get_file_extension(fname);
|
||||
if(ext == std::string())
|
||||
{
|
||||
if(verbose)
|
||||
std::cerr << "Error: trying to output to file without extension" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ext == "obj")
|
||||
return write_OBJ(fname, g, np);
|
||||
else if(ext == "off")
|
||||
return write_OFF(fname, g, np);
|
||||
else if(ext == "ply")
|
||||
return write_PLY(fname, g, np);
|
||||
else if(ext == "stl")
|
||||
return write_STL(fname, g, np);
|
||||
else if(ext == "ts")
|
||||
return write_GOCAD(fname, g, np);
|
||||
#ifdef CGAL_USE_VTK
|
||||
else if(ext == "vtp")
|
||||
return write_VTP(fname, g, np);
|
||||
#endif
|
||||
|
||||
if(verbose)
|
||||
{
|
||||
std::cerr << "Error: unknown output file extension: " << ext << "\n"
|
||||
<< "Please refer to the documentation for the list of supported file formats" << std::endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class Graph>
|
||||
bool write_polygon_mesh(const std::string& fname, Graph& g)
|
||||
{
|
||||
return write_polygon_mesh(fname, g, parameters::all_default());
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
||||
/*!
|
||||
* \ingroup PkgBGLIOFct
|
||||
*
|
||||
|
|
@ -251,59 +304,14 @@ bool read_polygon_mesh(const char* fname, Graph& g)
|
|||
*
|
||||
* \return `true` if writing was successful, `false` otherwise.
|
||||
*/
|
||||
template <class Graph, typename NamedParameters>
|
||||
bool write_polygon_mesh(const std::string& fname,
|
||||
Graph& g,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
const bool verbose = parameters::choose_parameter(parameters::get_parameter(np, internal_np::verbose), false);
|
||||
|
||||
const std::string ext = IO::internal::get_file_extension(fname);
|
||||
if(ext == std::string())
|
||||
{
|
||||
if(verbose)
|
||||
std::cerr << "Error: trying to output to file without extension" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ext == "obj")
|
||||
return write_OBJ(fname, g, np);
|
||||
else if(ext == "off")
|
||||
return write_OFF(fname, g, np);
|
||||
else if(ext == "ply")
|
||||
return write_PLY(fname, g, np);
|
||||
else if(ext == "stl")
|
||||
return write_STL(fname, g, np);
|
||||
else if(ext == "ts")
|
||||
return write_GOCAD(fname, g, np);
|
||||
#ifdef CGAL_USE_VTK
|
||||
else if(ext == "vtp")
|
||||
return write_VTP(fname, g, np);
|
||||
#endif
|
||||
|
||||
if(verbose)
|
||||
{
|
||||
std::cerr << "Error: unknown output file extension: " << ext << "\n"
|
||||
<< "Please refer to the documentation for the list of supported file formats" << std::endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <class Graph>
|
||||
bool write_polygon_mesh(const std::string& fname, Graph& g)
|
||||
{
|
||||
return write_polygon_mesh(fname, g, parameters::all_default());
|
||||
}
|
||||
|
||||
template <class Graph, typename NamedParameters>
|
||||
bool write_polygon_mesh(const char* fname, Graph& g, const NamedParameters& np)
|
||||
{
|
||||
return write_polygon_mesh(std::string(fname), g, np);
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <class Graph>
|
||||
bool write_polygon_mesh(const char* fname, Graph& g)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -82,6 +82,31 @@ std::istream& operator>>(std::istream& is,
|
|||
return is;
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename Point,
|
||||
typename Vector>
|
||||
bool read_point_set(const std::string& fname,
|
||||
CGAL::Point_set_3<Point, Vector>& ps)
|
||||
{
|
||||
const std::string ext = IO::internal::get_file_extension(fname);
|
||||
|
||||
if(ext == "xyz")
|
||||
return read_XYZ(fname, ps);
|
||||
else if(ext == "off")
|
||||
return read_OFF(fname, ps);
|
||||
else if(ext =="ply")
|
||||
return read_PLY(fname, ps);
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
else if(ext == "las")
|
||||
return read_LAS(fname, ps);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
||||
/*!
|
||||
\ingroup PkgPointSet3IO
|
||||
|
||||
|
|
@ -100,42 +125,17 @@ std::istream& operator>>(std::istream& is,
|
|||
\tparam Point a `CGAL::Point_3`
|
||||
\tparam Vector a `CGAL::Vector_3`
|
||||
|
||||
\param filename the path to the input file
|
||||
\param fname the path to the input file
|
||||
\param ps the point set
|
||||
|
||||
\return `true` if the reading was successful, `false` otherwise.
|
||||
*/
|
||||
template <typename Point,
|
||||
typename Vector>
|
||||
bool read_point_set(const std::string& filename,
|
||||
CGAL::Point_set_3<Point, Vector>& ps)
|
||||
{
|
||||
const std::string ext = IO::internal::get_file_extension(filename);
|
||||
|
||||
if(ext == "xyz")
|
||||
return read_XYZ(filename, ps);
|
||||
else if(ext == "off")
|
||||
return read_OFF(filename, ps);
|
||||
else if(ext =="ply")
|
||||
return read_PLY(filename, ps);
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
else if(ext == "las")
|
||||
return read_LAS(filename, ps);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename Point, typename Vector>
|
||||
bool read_point_set(const char* filename, CGAL::Point_set_3<Point, Vector>& ps)
|
||||
bool read_point_set(const char* fname, CGAL::Point_set_3<Point, Vector>& ps)
|
||||
{
|
||||
return read_point_set(std::string(filename), ps);
|
||||
return read_point_set(std::string(fname), ps);
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Write
|
||||
|
|
@ -164,6 +164,31 @@ std::ostream& operator<<(std::ostream& os,
|
|||
return os;
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename Point, typename Vector, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool write_point_set(const std::string& fname,
|
||||
CGAL::Point_set_3<Point, Vector>& ps,
|
||||
const CGAL_BGL_NP_CLASS& np)
|
||||
{
|
||||
const std::string ext = IO::internal::get_file_extension(fname);
|
||||
|
||||
if(ext == "xyz")
|
||||
return write_XYZ(fname, ps, np);
|
||||
else if(ext == "off")
|
||||
return write_OFF(fname, ps, np);
|
||||
else if(ext == "ply")
|
||||
return write_PLY(fname, ps, np);
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
else if(ext == "las")
|
||||
return write_LAS(fname, ps, np);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
||||
/*!
|
||||
\ingroup PkgPointSet3IO
|
||||
|
||||
|
|
@ -181,7 +206,7 @@ std::ostream& operator<<(std::ostream& os,
|
|||
\tparam Vector a `CGAL::Vector_3`
|
||||
\tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
|
||||
|
||||
\param filename the path to the output file
|
||||
\param fname the path to the output file
|
||||
\param ps the point set
|
||||
\param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below
|
||||
|
||||
|
|
@ -196,46 +221,25 @@ std::ostream& operator<<(std::ostream& os,
|
|||
\return `true` if the writing was successful, `false` otherwise.
|
||||
*/
|
||||
template <typename Point, typename Vector, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool write_point_set(const std::string& filename,
|
||||
bool write_point_set(const char* fname,
|
||||
CGAL::Point_set_3<Point, Vector>& ps,
|
||||
const CGAL_BGL_NP_CLASS& np)
|
||||
{
|
||||
const std::string ext = IO::internal::get_file_extension(filename);
|
||||
|
||||
if(ext == "xyz")
|
||||
return write_XYZ(filename, ps, np);
|
||||
else if(ext == "off")
|
||||
return write_OFF(filename, ps, np);
|
||||
else if(ext == "ply")
|
||||
return write_PLY(filename, ps, np);
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
else if(ext == "las")
|
||||
return write_LAS(filename, ps, np);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
return write_point_set(std::string(fname), ps, np);
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename Point, typename Vector, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool write_point_set(const char* filename,
|
||||
CGAL::Point_set_3<Point, Vector>& ps,
|
||||
const CGAL_BGL_NP_CLASS& np)
|
||||
template <typename Point, typename Vector>
|
||||
bool write_point_set(const char* fname, CGAL::Point_set_3<Point, Vector>& ps)
|
||||
{
|
||||
return write_point_set(std::string(filename), ps, np);
|
||||
return write_point_set(fname, ps, parameters::all_default());
|
||||
}
|
||||
|
||||
template <typename Point, typename Vector>
|
||||
bool write_point_set(const char* filename, CGAL::Point_set_3<Point, Vector>& ps)
|
||||
bool write_point_set(const std::string& fname, CGAL::Point_set_3<Point, Vector>& ps)
|
||||
{
|
||||
return write_point_set(filename, ps, parameters::all_default());
|
||||
}
|
||||
|
||||
template <typename Point, typename Vector>
|
||||
bool write_point_set(const std::string& filename, CGAL::Point_set_3<Point, Vector>& ps)
|
||||
{
|
||||
return write_point_set(filename.c_str(), ps, parameters::all_default());
|
||||
return write_point_set(fname.c_str(), ps, parameters::all_default());
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
|
|
|||
|
|
@ -28,6 +28,53 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename OutputIteratorValueType,
|
||||
typename PointOutputIterator,
|
||||
typename NamedParameters>
|
||||
bool read_points(const std::string& fname,
|
||||
PointOutputIterator output,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
const std::string ext = IO::internal::get_file_extension(fname);
|
||||
|
||||
if(ext == "xyz")
|
||||
return read_XYZ<OutputIteratorValueType>(fname, output, np);
|
||||
else if(ext == "off")
|
||||
return read_OFF<OutputIteratorValueType>(fname, output, np);
|
||||
else if(ext == "ply")
|
||||
return read_PLY<OutputIteratorValueType>(fname, output, np);
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
else if(ext == "las")
|
||||
return read_LAS<OutputIteratorValueType>(fname, output, np);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// variant with default OutputIteratorType
|
||||
template <typename OutputIterator, typename NamedParameters>
|
||||
bool read_points(const std::string& fname, OutputIterator output, const NamedParameters& np)
|
||||
{
|
||||
return read_points<typename value_type_traits<OutputIterator>::type>(fname, output, np);
|
||||
}
|
||||
|
||||
template <typename OutputIteratorValueType, typename OutputIterator>
|
||||
bool read_points(const std::string& fname, OutputIterator output)
|
||||
{
|
||||
return read_points<OutputIteratorValueType>(fname, output, parameters::all_default());
|
||||
}
|
||||
|
||||
// variant with all default
|
||||
template<typename OutputIterator>
|
||||
bool read_points(const std::string& fname, OutputIterator output)
|
||||
{
|
||||
return read_points<typename value_type_traits<OutputIterator>::type>(fname, output, parameters::all_default());
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
||||
/**
|
||||
\ingroup PkgPointSetProcessing3IO
|
||||
|
||||
|
|
@ -72,60 +119,14 @@ namespace CGAL {
|
|||
|
||||
\returns `true` if reading was successful, `false` otherwise.
|
||||
*/
|
||||
template <typename OutputIteratorValueType,
|
||||
typename PointOutputIterator,
|
||||
typename NamedParameters>
|
||||
bool read_points(const std::string& fname,
|
||||
PointOutputIterator output,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
const std::string ext = IO::internal::get_file_extension(fname);
|
||||
|
||||
if(ext == "xyz")
|
||||
return read_XYZ<OutputIteratorValueType>(fname, output, np);
|
||||
else if(ext == "off")
|
||||
return read_OFF<OutputIteratorValueType>(fname, output, np);
|
||||
else if(ext == "ply")
|
||||
return read_PLY<OutputIteratorValueType>(fname, output, np);
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
else if(ext == "las")
|
||||
return read_LAS<OutputIteratorValueType>(fname, output, np);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
// variant with default OutputIteratorType
|
||||
template <typename OutputIterator, typename NamedParameters>
|
||||
bool read_points(const std::string& fname, OutputIterator output, const NamedParameters& np)
|
||||
{
|
||||
return read_points<typename value_type_traits<OutputIterator>::type>(fname, output, np);
|
||||
}
|
||||
|
||||
// variant with default np
|
||||
template <typename OutputIteratorValueType, typename OutputIterator>
|
||||
bool read_points(const std::string& fname, OutputIterator output)
|
||||
{
|
||||
return read_points<OutputIteratorValueType>(fname, output, parameters::all_default());
|
||||
}
|
||||
|
||||
// variant with all default
|
||||
template<typename OutputIterator>
|
||||
bool read_points(const std::string& fname, OutputIterator output)
|
||||
{
|
||||
return read_points<typename value_type_traits<OutputIterator>::type>(fname, output, parameters::all_default());
|
||||
}
|
||||
|
||||
// variants with char*
|
||||
|
||||
template <typename OutputIteratorValueType, typename OutputIterator, typename NamedParameters>
|
||||
bool read_points(const char* fname, OutputIterator output, const NamedParameters& np)
|
||||
{
|
||||
return read_points<OutputIteratorValueType>(std::string(fname), output, np);
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename OutputIterator, typename NamedParameters>
|
||||
bool read_points(const char* fname, OutputIterator output, const NamedParameters& np)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,6 +33,39 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename PointRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool write_points(const std::string& fname,
|
||||
const PointRange& points,
|
||||
const CGAL_BGL_NP_CLASS& np,
|
||||
typename boost::enable_if<IO::internal::is_Range<PointRange> >::type* = nullptr)
|
||||
{
|
||||
const std::string ext = IO::internal::get_file_extension(fname);
|
||||
|
||||
if(ext == "xyz")
|
||||
return write_XYZ(fname, points, np);
|
||||
else if(ext == "off")
|
||||
return write_OFF(fname, points, np);
|
||||
else if(ext == "ply")
|
||||
return write_PLY(fname, points, np);
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
else if(ext == "las")
|
||||
return write_LAS(fname, points, np);
|
||||
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename PointRange>
|
||||
bool write_points(const std::string& fname,const PointRange& points,
|
||||
typename boost::enable_if<IO::internal::is_Range<PointRange> >::type* = nullptr)
|
||||
{
|
||||
return write_points(fname, points, parameters::all_default());
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
||||
/**
|
||||
\ingroup PkgPointSetProcessing3IO
|
||||
|
||||
|
|
@ -83,45 +116,16 @@ namespace CGAL {
|
|||
\returns `true` if writing was successful, `false` otherwise.
|
||||
*/
|
||||
template <typename PointRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool write_points(const std::string& fname,
|
||||
const PointRange& points,
|
||||
const CGAL_BGL_NP_CLASS& np
|
||||
bool write_points(const char* fname, const PointRange& points, const CGAL_BGL_NP_CLASS& np
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
, typename boost::enable_if<IO::internal::is_Range<PointRange> >::type* = nullptr
|
||||
#endif
|
||||
)
|
||||
{
|
||||
const std::string ext = IO::internal::get_file_extension(fname);
|
||||
|
||||
if(ext == "xyz")
|
||||
return write_XYZ(fname, points, np);
|
||||
else if(ext == "off")
|
||||
return write_OFF(fname, points, np);
|
||||
else if(ext == "ply")
|
||||
return write_PLY(fname, points, np);
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
else if(ext == "las")
|
||||
return write_LAS(fname, points, np);
|
||||
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename PointRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool write_points(const char* fname, const PointRange& points, const CGAL_BGL_NP_CLASS& np,
|
||||
typename boost::enable_if<IO::internal::is_Range<PointRange> >::type* = nullptr)
|
||||
{
|
||||
return write_points(std::string(fname), points, np);
|
||||
}
|
||||
|
||||
template <typename PointRange>
|
||||
bool write_points(const std::string& fname,const PointRange& points,
|
||||
typename boost::enable_if<IO::internal::is_Range<PointRange> >::type* = nullptr)
|
||||
{
|
||||
return write_points(fname, points, parameters::all_default());
|
||||
}
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename PointRange>
|
||||
bool write_points(const char* fname,const PointRange& points,
|
||||
|
|
|
|||
|
|
@ -277,13 +277,6 @@ bool read_OBJ(const char* fname,
|
|||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool read_OBJ(const std::string& fname, PointRange& points, PolygonRange& polygons, const CGAL_BGL_NP_CLASS& np,
|
||||
typename boost::enable_if<IO::internal::is_Range<PolygonRange> >::type* = nullptr)
|
||||
{
|
||||
return read_OBJ(fname.c_str(), points, polygons, np);
|
||||
}
|
||||
|
||||
template <typename PointRange, typename PolygonRange>
|
||||
bool read_OBJ(const char* fname, PointRange& points, PolygonRange& polygons,
|
||||
typename boost::enable_if<IO::internal::is_Range<PolygonRange> >::type* = nullptr)
|
||||
|
|
@ -291,6 +284,13 @@ bool read_OBJ(const char* fname, PointRange& points, PolygonRange& polygons,
|
|||
return read_OBJ(fname, points, polygons, parameters::all_default());
|
||||
}
|
||||
|
||||
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool read_OBJ(const std::string& fname, PointRange& points, PolygonRange& polygons, const CGAL_BGL_NP_CLASS& np,
|
||||
typename boost::enable_if<IO::internal::is_Range<PolygonRange> >::type* = nullptr)
|
||||
{
|
||||
return read_OBJ(fname.c_str(), points, polygons, np);
|
||||
}
|
||||
|
||||
template <typename PointRange, typename PolygonRange>
|
||||
bool read_OBJ(const std::string& fname, PointRange& points, PolygonRange& polygons,
|
||||
typename boost::enable_if<IO::internal::is_Range<PolygonRange> >::type* = nullptr)
|
||||
|
|
|
|||
|
|
@ -33,44 +33,12 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
/*!
|
||||
* \ingroup IOstreamFunctions
|
||||
*
|
||||
* \brief reads a polygon soup from a file.
|
||||
*
|
||||
* Supported file formats are the following:
|
||||
* - \ref IOStreamOFF (`.off`)
|
||||
* - \ref IOStreamOBJ (`.obj`)
|
||||
* - \ref IOStreamSTL (`.stl`)
|
||||
* - \ref IOStreamPLY (`.ply`)
|
||||
* - \ref IOStreamGocad (`.ts`)
|
||||
* - \ref IOStreamVTK (`.vtp`)
|
||||
*
|
||||
* The format is detected from the filename extension.
|
||||
*
|
||||
* \tparam PolygonRange a model of the concept `RandomAccessContainer`
|
||||
* whose value_type is a model of the concept `RandomAccessContainer`
|
||||
* whose value_type is `std::size_t`.
|
||||
* \tparam PointRange a model of the concept `RandomAccessContainer`
|
||||
* whose value type is the point type
|
||||
* \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
|
||||
*
|
||||
* \param fname the name of the file.
|
||||
* \param polygons each element in the range describes a polygon
|
||||
* using the indices of the vertices.
|
||||
* \param points points of the soup of polygons
|
||||
* \param np optional \ref bgl_namedparameters "Named Parameters" described below
|
||||
*
|
||||
* \cgalNamedParamsBegin
|
||||
* \cgalParamNBegin{verbose}
|
||||
* \cgalParamDescription{indicates whether output warnings and error messages should be printed or not.}
|
||||
* \cgalParamType{Boolean}
|
||||
* \cgalParamDefault{`true`}
|
||||
* \cgalParamNEnd
|
||||
* \cgalNamedParamsEnd
|
||||
*
|
||||
* \return `true` if reading was successful, `false` otherwise.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Read
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool read_polygon_soup(const std::string& fname,
|
||||
PointRange& points,
|
||||
|
|
@ -111,12 +79,8 @@ bool read_polygon_soup(const std::string& fname,
|
|||
return false;
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename PointRange, typename PolygonRange>
|
||||
bool read_polygon_soup(const std::string& fname,
|
||||
PointRange& points,
|
||||
PolygonRange& polygons)
|
||||
bool read_polygon_soup(const std::string& fname, PointRange& points, PolygonRange& polygons)
|
||||
{
|
||||
return read_polygon_soup(fname, points, polygons, parameters::all_default());
|
||||
}
|
||||
|
|
@ -126,7 +90,7 @@ bool read_polygon_soup(const std::string& fname,
|
|||
/*!
|
||||
* \ingroup IOstreamFunctions
|
||||
*
|
||||
* \brief writes the content of `points` and `polygons` in a file.
|
||||
* \brief reads a polygon soup from a file.
|
||||
*
|
||||
* Supported file formats are the following:
|
||||
* - \ref IOStreamOFF (`.off`)
|
||||
|
|
@ -139,19 +103,48 @@ bool read_polygon_soup(const std::string& fname,
|
|||
* The format is detected from the filename extension.
|
||||
*
|
||||
* \tparam PolygonRange a model of the concept `RandomAccessContainer`
|
||||
* whose value_type is a model of the concept `RandomAccessContainer`
|
||||
* whose value_type is `std::size_t`.
|
||||
* \tparam PointRange a model of the concept `RandomAccessContainer`
|
||||
* whose value type is the point type
|
||||
* whose value_type is a model of the concept `RandomAccessContainer`
|
||||
* whose value_type is `std::size_t`.
|
||||
* \tparam PointRange a model of the concept `RandomAccessContainer` whose value type is the point type
|
||||
* \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
|
||||
*
|
||||
* \param fname the name of the file.
|
||||
* \param polygons each element in the range describes a polygon
|
||||
* using the indices of the vertices.
|
||||
* \param points points of the soup of polygons
|
||||
* \param verbose: if `true`, will output warnings and error messages.
|
||||
* \param polygons each element in the range describes a polygon using the indices of the vertices.
|
||||
* \param np optional \ref bgl_namedparameters "Named Parameters" described below
|
||||
*
|
||||
* \return `true` if writing was successful, `false` otherwise.
|
||||
* \cgalNamedParamsBegin
|
||||
* \cgalParamNBegin{verbose}
|
||||
* \cgalParamDescription{indicates whether output warnings and error messages should be printed or not.}
|
||||
* \cgalParamType{Boolean}
|
||||
* \cgalParamDefault{`true`}
|
||||
* \cgalParamNEnd
|
||||
* \cgalNamedParamsEnd
|
||||
*
|
||||
* \return `true` if reading was successful, `false` otherwise.
|
||||
*/
|
||||
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool read_polygon_soup(const char* fname, PointRange& points, PolygonRange& polygons, const CGAL_BGL_NP_CLASS& np)
|
||||
{
|
||||
return read_OBJ(std::string(fname), points, polygons, np);
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename PointRange, typename PolygonRange>
|
||||
bool read_polygon_soup(const char* fname, PointRange& points, PolygonRange& polygons)
|
||||
{
|
||||
return read_OBJ(fname, points, polygons, parameters::all_default());
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Write
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool write_polygon_soup(const std::string& fname,
|
||||
const PointRange& points,
|
||||
|
|
@ -197,12 +190,60 @@ bool write_polygon_soup(const std::string& fname,
|
|||
return false;
|
||||
}
|
||||
|
||||
template <typename PointRange, typename PolygonRange>
|
||||
bool write_polygon_soup(const std::string& fname, PointRange& points, PolygonRange& polygons)
|
||||
{
|
||||
return write_polygon_soup(fname, points, polygons, parameters::all_default());
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
||||
/*!
|
||||
* \ingroup IOstreamFunctions
|
||||
*
|
||||
* \brief writes the content of `points` and `polygons` in a file.
|
||||
*
|
||||
* Supported file formats are the following:
|
||||
* - \ref IOStreamOFF (`.off`)
|
||||
* - \ref IOStreamOBJ (`.obj`)
|
||||
* - \ref IOStreamSTL (`.stl`)
|
||||
* - \ref IOStreamPLY (`.ply`)
|
||||
* - \ref IOStreamGocad (`.ts`)
|
||||
* - \ref IOStreamVTK (`.vtp`)
|
||||
*
|
||||
* The format is detected from the filename extension.
|
||||
*
|
||||
* \tparam PolygonRange a model of the concept `RandomAccessContainer`
|
||||
* whose value_type is a model of the concept `RandomAccessContainer`
|
||||
* whose value_type is `std::size_t`.
|
||||
* \tparam PointRange a model of the concept `RandomAccessContainer` whose value type is the point type
|
||||
* \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
|
||||
*
|
||||
* \param fname the name of the file.
|
||||
* \param points points of the soup of polygons
|
||||
* \param polygons each element in the range describes a polygon using the indices of the vertices.
|
||||
* \param np optional \ref bgl_namedparameters "Named Parameters" described below
|
||||
*
|
||||
* \cgalNamedParamsBegin
|
||||
* \cgalParamNBegin{verbose}
|
||||
* \cgalParamDescription{indicates whether output warnings and error messages should be printed or not.}
|
||||
* \cgalParamType{Boolean}
|
||||
* \cgalParamDefault{`true`}
|
||||
* \cgalParamNEnd
|
||||
* \cgalNamedParamsEnd
|
||||
*
|
||||
* \return `true` if writing was successful, `false` otherwise.
|
||||
*/
|
||||
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool write_polygon_soup(const char* fname, PointRange& points, PolygonRange& polygons, const CGAL_BGL_NP_CLASS& np)
|
||||
{
|
||||
return write_polygon_soup(std::string(fname), points, polygons, np);
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
template <typename PointRange, typename PolygonRange>
|
||||
bool write_polygon_soup(const std::string& fname,
|
||||
PointRange& points,
|
||||
PolygonRange& polygons)
|
||||
bool write_polygon_soup(const char* fname, PointRange& points, PolygonRange& polygons)
|
||||
{
|
||||
return write_polygon_soup(fname, points, polygons, parameters::all_default());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue