diff --git a/BGL/include/CGAL/boost/graph/IO/GOCAD.h b/BGL/include/CGAL/boost/graph/IO/GOCAD.h index 314afa8aee6..406e147bea3 100644 --- a/BGL/include/CGAL/boost/graph/IO/GOCAD.h +++ b/BGL/include/CGAL/boost/graph/IO/GOCAD.h @@ -125,7 +125,8 @@ public: \ingroup PkgBGLIOFct reads the graph `g` from data in the TS format. - `name` and `color` will be filled according to the values contained in the file. + `name_and_color` is an optionnal argument, containing the + values specified in the file. \pre The data must represent a 2-manifold @@ -135,8 +136,7 @@ public: */ template bool read_GOCAD(std::istream& in, - std::string& name, - std::string& color, + std::pair& name_and_color, FaceGraph& g, const CGAL_BGL_NP_CLASS& np) { @@ -147,19 +147,28 @@ bool read_GOCAD(std::istream& in, if(!builder(g, np)) return false; - name = builder.name; - color = builder.color; + name_and_color.first = builder.name; + name_and_color.second = builder.color; return is_valid(g); // @fixme keep validity check? } +template +bool read_GOCAD(std::istream& in, + FaceGraph& g, + const CGAL_BGL_NP_CLASS& np) +{ + std::pair dummy; + return read_GOCAD(in, dummy,g, np); +} + template bool read_GOCAD(std::istream& in, - std::string& name, - std::string& color, + std::pair& name_and_color, FaceGraph& g) { - return read_GOCAD(in, name, color, g, parameters::all_default()); + + return read_GOCAD(in, name_and_color, g, parameters::all_default()); } /*! @@ -206,6 +215,13 @@ bool read_GOCAD(const std::string& fname, FaceGraph& g) { return read_GOCAD(fnam writes the graph `g` in the TS format into `os`. `fname` is the mandatory name that will be assigned to `g`in the file. + \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 + \see \ref IOStreamGocad */ template diff --git a/BGL/include/CGAL/boost/graph/IO/VTK.h b/BGL/include/CGAL/boost/graph/IO/VTK.h index d717a2fa413..eae715a658e 100644 --- a/BGL/include/CGAL/boost/graph/IO/VTK.h +++ b/BGL/include/CGAL/boost/graph/IO/VTK.h @@ -24,6 +24,7 @@ #include #include #include +#include namespace CGAL { @@ -50,7 +51,7 @@ bool vtkPointSet_to_polygon_mesh(vtkPointSet* poly_data, using parameters::choose_parameter; VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), - get_const_property_map(CGAL::vertex_point, g)); + get_property_map(CGAL::vertex_point, g)); vtkIdType nb_points = poly_data->GetNumberOfPoints(); vtkIdType nb_cells = poly_data->GetNumberOfCells(); @@ -122,7 +123,7 @@ bool read_VTP(const char* fname, FaceGraph& g, const NamedParameters& np) vtkSmartPointer obs = vtkSmartPointer::New(); - data = IO::internal::read_vtk_file(fname, obs)->GetOutput(); + data = vtkPolyData::SafeDownCast(IO::internal::read_vtk_file(fname, obs)->GetOutput()); return IO::internal::vtkPointSet_to_polygon_mesh(data, g, np); } @@ -178,8 +179,8 @@ void write_polys(std::ostream& os, typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; - typedef typename CGAL::GetInitializedVertexIndexMap::const_type Vimap; - Vimap V = CGAL::get_initialized_vertex_index_map(mesh, np); + typedef typename CGAL::GetInitializedVertexIndexMap::const_type Vimap; + Vimap V = CGAL::get_initialized_vertex_index_map(g, np); std::vector connectivity_table; std::vector offsets; @@ -211,8 +212,8 @@ void write_polys_tag(std::ostream& os, typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; - typedef typename CGAL::GetInitializedVertexIndexMap::const_type Vimap; - Vimap V = CGAL::get_initialized_vertex_index_map(mesh, np); + typedef typename CGAL::GetInitializedVertexIndexMap::const_type Vimap; + Vimap V = CGAL::get_initialized_vertex_index_map(g, np); std::string formatattribute = binary ? " format=\"appended\"" : " format=\"ascii\""; @@ -452,3 +453,4 @@ void write_VTP(std::ostream& os, const FaceGraph& g) #endif // CGAL_USE_VTK #endif // CGAL_BGL_IO_VTK_H + diff --git a/BGL/test/BGL/test_bgl_read_write.cpp b/BGL/test/BGL/test_bgl_read_write.cpp index 4a402adfb60..b42a4e0b6f4 100644 --- a/BGL/test/BGL/test_bgl_read_write.cpp +++ b/BGL/test/BGL/test_bgl_read_write.cpp @@ -134,13 +134,13 @@ bool test_gocad() } FaceGraph fg2; std::istringstream in( out.str()); - std::string name, color; - CGAL::read_GOCAD(in, name, color, fg2); - if(name != "tetrahedron"){ - std::cerr<<"reading error: tetrahedron != "< cnn; + CGAL::read_GOCAD(in, cnn, fg2); + if(cnn.first != "tetrahedron"){ + std::cerr<<"reading error: tetrahedron != "< bool read_OFF(const std::string& fname, PointRange& points, PolygonRange& polygons, const CGAL_BGL_NP_CLASS& np) { diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index be3bed95b28..6d086d0b833 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -120,6 +120,7 @@ bool read_STL(std::istream& is, } } +//todo doc this too template bool read_STL(const char* fname, PointRange& points,