Fix soup off writer + doc NPs

This commit is contained in:
Maxime Gimeno 2020-04-28 11:19:58 +02:00
parent c8c196fe9c
commit 83a929f7bb
4 changed files with 71 additions and 11 deletions

View File

@ -87,6 +87,14 @@ bool read_OFF_BGL(std::istream& in,
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`. \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 If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd `CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
\cgalParamBegin{vertex_normal_map} the property map with the normals associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{vertex_color_map} the property map with the colors associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{vertex_texture_map} the property map with the textures associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalNamedParamsEnd \cgalNamedParamsEnd
\pre The data must represent a 2-manifold \pre The data must represent a 2-manifold
@ -111,6 +119,14 @@ bool read_OFF(std::istream& in, FaceGraph& g, const CGAL_BGL_NP_CLASS& np)
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`. \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 If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd `CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
\cgalParamBegin{vertex_normal_map} the property map with the normals associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{vertex_color_map} the property map with the colors associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{vertex_texture_map} the property map with the textures associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalNamedParamsEnd \cgalNamedParamsEnd
\pre The data must represent a 2-manifold \pre The data must represent a 2-manifold
@ -172,9 +188,16 @@ bool write_OFF_BGL(std::ostream& os,
\cgalNamedParamsBegin \cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`. \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 If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph` `CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
\cgalParamEnd
\cgalNamedParamsEnd \cgalParamBegin{vertex_normal_map} the property map with the normals associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{vertex_color_map} the property map with the colors associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{vertex_texture_map} the property map with the textures associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalNamedParamsEnd
\sa Overloads of this function for specific models of the concept `FaceGraph`. \sa Overloads of this function for specific models of the concept `FaceGraph`.
@ -194,9 +217,16 @@ bool write_OFF(std::ostream& os, const FaceGraph& g, const CGAL_BGL_NP_CLASS& np
\cgalNamedParamsBegin \cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`. \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 If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph` `CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
\cgalParamEnd
\cgalNamedParamsEnd \cgalParamBegin{vertex_normal_map} the property map with the normals associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{vertex_color_map} the property map with the colors associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{vertex_texture_map} the property map with the textures associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalNamedParamsEnd
\sa Overloads of this function for specific models of the concept `FaceGraph`. \sa Overloads of this function for specific models of the concept `FaceGraph`.

View File

@ -54,6 +54,15 @@ void test_bgl_read_write(const char* filename)
CGAL::write_OFF(std::cout, sm); CGAL::write_OFF(std::cout, sm);
} }
void test_bgl_soup_off(const char* filename)
{
std::vector<Point> points;
std::vector<std::vector<std::size_t> > polygons;
std::ifstream in(filename);
CGAL::read_OFF(in,points, polygons);
CGAL::write_OFF(std::cout, points, polygons);
}
#ifdef CGAL_USE_VTK #ifdef CGAL_USE_VTK
template<typename Mesh> template<typename Mesh>
bool test_bgl_vtp(bool binary = false) bool test_bgl_vtp(bool binary = false)
@ -386,6 +395,7 @@ int main(int argc, char** argv)
test_bgl_read_write<Polyhedron>(filename); test_bgl_read_write<Polyhedron>(filename);
test_bgl_read_write<SM>(filename); test_bgl_read_write<SM>(filename);
test_bgl_read_write<LCC>(filename); test_bgl_read_write<LCC>(filename);
test_bgl_soup_off(filename);
#ifdef CGAL_USE_OPENMESH #ifdef CGAL_USE_OPENMESH
test_bgl_read_write<OMesh>(filename); test_bgl_read_write<OMesh>(filename);
#endif #endif

View File

@ -53,7 +53,7 @@ public:
m_writer.write_facet_header(); m_writer.write_facet_header();
for(std::size_t i=0, end=polygons.size(); i<end; ++i) for(std::size_t i=0, end=polygons.size(); i<end; ++i)
{ {
Polygon_3& polygon = polygons[i]; const Polygon_3& polygon = polygons[i];
const std::size_t size = polygon.size(); const std::size_t size = polygon.size();
m_writer.write_facet_begin(size); m_writer.write_facet_begin(size);

View File

@ -154,6 +154,16 @@ bool read_OFF(std::istream& is,
* *
* reads the content of `is` into `points` and `polygons`, in the OFF format. * reads the content of `is` into `points` and `polygons`, in the OFF format.
* *
* \cgalNamedParamsBegin
\cgalParamBegin{vertex_normal_map} the property map with the normals associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{vertex_color_map} the property map with the colors associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{vertex_texture_map} the property map with the textures associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalNamedParamsEnd
*
* \see \ref IOStreamOFF * \see \ref IOStreamOFF
*/ */
template <typename PointRange, typename PolygonRange, typename NamedParameters> template <typename PointRange, typename PolygonRange, typename NamedParameters>
@ -181,6 +191,16 @@ bool read_OFF(std::istream& is,
* *
* reads the content of the file `fname` into `points` and `polygons`, in the OFF format. * reads the content of the file `fname` into `points` and `polygons`, in the OFF format.
* *
* * \cgalNamedParamsBegin
\cgalParamBegin{vertex_normal_map} the property map with the normals associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{vertex_color_map} the property map with the colors associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{vertex_texture_map} the property map with the textures associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalNamedParamsEnd
*
* \see \ref IOStreamOFF * \see \ref IOStreamOFF
*/ */
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
@ -232,10 +252,10 @@ template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPL
bool write_OFF(std::ostream& os, bool write_OFF(std::ostream& os,
const PointRange& points, const PointRange& points,
const PolygonRange& polygons, const PolygonRange& polygons,
const CGAL_BGL_NP_CLASS& np) const CGAL_BGL_NP_CLASS& )
{ {
Generic_writer<std::ostream, File_writer_OFF> writer(os); Generic_writer<std::ostream, File_writer_OFF> writer(os);
return writer(points, polygons, np); return writer(points, polygons);
} }
template <typename PointRange, typename PolygonRange> template <typename PointRange, typename PolygonRange>