add missing overloads in OFF

This commit is contained in:
Maxime Gimeno 2020-04-27 12:13:46 +02:00
parent c5e512db08
commit 3d4eb3a5be
2 changed files with 68 additions and 2 deletions

View File

@ -186,7 +186,22 @@ bool write_OFF(std::ostream& os, const FaceGraph& g, const CGAL_BGL_NP_CLASS& np
return IO::internal::write_OFF_BGL(os, g, np);
}
// document that too
/*!
\ingroup PkgBGLIOFct
writes the graph `g` in the file `fname`, in the OFF format.
\cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`.
If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph`
\cgalParamEnd
\cgalNamedParamsEnd
\sa Overloads of this function for specific models of the concept `FaceGraph`.
\see \ref IOStreamOFF
*/
template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool write_OFF(const char* fname, const FaceGraph& g, const CGAL_BGL_NP_CLASS& np)
{

View File

@ -176,6 +176,13 @@ bool read_OFF(std::istream& is,
CGAL::Emptyset_iterator()));
}
/*!
* \ingroup IOstreamFunctions
*
* reads the content of the file `fname` into `points` and `polygons`, in the OFF format.
*
* \see \ref IOStreamOFF
*/
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool read_OFF(const char* fname,
PointRange& points,
@ -185,7 +192,7 @@ bool read_OFF(const char* fname,
std::ifstream in(fname);
return read_OFF(in, points, polygons, np);
}
//todo doc this too
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool read_OFF(const std::string& fname, PointRange& points, PolygonRange& polygons, const CGAL_BGL_NP_CLASS& np)
{
@ -239,6 +246,50 @@ bool write_OFF(std::ostream& os,
return write_OFF(os, points, polygons, parameters::all_default());
}
/*!
* \ingroup IOstreamFunctions
*
* writes the content of `points` and `polygons` in the file `fname`, in the OFF format.
*
* \see \ref IOStreamOFF
*/
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool write_OFF(const char* fname,
const PointRange& points,
const PolygonRange& polygons,
const CGAL_BGL_NP_CLASS& np)
{
std::ofstream os(fname);
Generic_writer<std::ostream, File_writer_OFF> writer(os);
return writer(points, polygons, np);
}
template <typename PointRange, typename PolygonRange>
bool write_OFF(const char* fname,
const PointRange& points,
const PolygonRange& polygons)
{
return write_OFF(fname, points, polygons, parameters::all_default());
}
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool write_OFF(const std::string& fname,
const PointRange& points,
const PolygonRange& polygons,
const CGAL_BGL_NP_CLASS& np)
{
return write_OFF(fname.c_str(), points, polygons, np);
}
template <typename PointRange, typename PolygonRange>
bool write_OFF(const std::string& fname,
const PointRange& points,
const PolygonRange& polygons)
{
return write_OFF(fname, points, polygons, parameters::all_default());
}
} // namespace CGAL
#endif // CGAL_IO_OFF_H