diff --git a/BGL/include/CGAL/boost/graph/io.h b/BGL/include/CGAL/boost/graph/io.h index bfd4f410586..2deabecc2e6 100644 --- a/BGL/include/CGAL/boost/graph/io.h +++ b/BGL/include/CGAL/boost/graph/io.h @@ -21,110 +21,4 @@ #include #include -namespace CGAL{ - -//not for now. -/* -template -bool read_polygon_mesh(std::istream& is, - FaceGraph& g, - const NamedParameters& np) -{ - bool ok = false; - ok = read_OFF(is, g, np, false); - if(ok) - return true; - g.clear(); - is.clear();//reset the error state - is.seekg (0, is.beg); - ok = read_OBJ(is, g, np, false); - if(ok) - return true; - g.clear(); - is.clear(); - is.seekg (0, is.beg); - ok = read_PLY(is, g, np, false); - if(ok) - return true; - g.clear(); - is.clear(); - is.seekg (0, is.beg); - ok = read_STL(is, g, np, false); - if(ok) - return true; - g.clear(); - is.clear(); - is.seekg (0, is.beg); - ok = read_GOCAD(is, g, np, false); - return ok; -} - -template -bool read_polygon_mesh(std::istream& is, - FaceGraph& g) -{ - return read_polygon_mesh(is, g, parameters::all_default()); -} -*/ -/*! - * - */ -template -bool read_polygon_mesh(const std::string& fname, - FaceGraph& g, - const NamedParameters& np) -{ - if (fname.find(".TS") != std::string::npos) { - return read_GOCAD(fname, g, np); - } - - if (fname.find(".obj") != std::string::npos) { - return read_OBJ(fname, g, np); - } - - if (fname.find(".off") != std::string::npos) { - return read_OFF(fname, g, np); - } - - if (fname.find(".ply") != std::string::npos) { - return read_PLY(fname, g, np); - } - - if (fname.find(".stl") != std::string::npos) { - return read_STL(fname, g, np); - } - - if (fname.find(".vtp") != std::string::npos) { - return read_VTP(fname, g, np); - } - - return false; -} - -template -bool read_polygon_mesh(const std::string& fname, - FaceGraph& g) -{ - return read_polygon_mesh(fname, g, parameters::all_default()); -} - - - -template -bool read_polygon_mesh(const char* fname, - FaceGraph& g, - const NamedParameters& np) -{ - return read_polygon_mesh(std::string(fname), g, np); -} - -template -bool read_polygon_mesh(const char* fname, - FaceGraph& g) -{ - return read_polygon_mesh(fname, g, parameters::all_default()); -} - - -}//end CGAL #endif // CGAL_BOOST_GRAPH_IO_H diff --git a/BGL/include/CGAL/boost/graph/polygon_mesh_io.h b/BGL/include/CGAL/boost/graph/polygon_mesh_io.h new file mode 100644 index 00000000000..d139934b82e --- /dev/null +++ b/BGL/include/CGAL/boost/graph/polygon_mesh_io.h @@ -0,0 +1,121 @@ +// Copyright (c) 2020 GeometryFactory (France). All rights reserved. +// +// This file is part of CGAL (www.cgal.org) +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Maxime Gimeno +#ifndef CGAL_BOOST_GRAPH_POLYGON_MESH_IO_H +#define CGAL_BOOST_GRAPH_POLYGON_MESH_IO_H + +#include +namespace CGAL{ + +//not for now. +/* +template +bool read_polygon_mesh(std::istream& is, + FaceGraph& g, + const NamedParameters& np) +{ + bool ok = false; + ok = read_OFF(is, g, np, false); + if(ok) + return true; + g.clear(); + is.clear();//reset the error state + is.seekg (0, is.beg); + ok = read_OBJ(is, g, np, false); + if(ok) + return true; + g.clear(); + is.clear(); + is.seekg (0, is.beg); + ok = read_PLY(is, g, np, false); + if(ok) + return true; + g.clear(); + is.clear(); + is.seekg (0, is.beg); + ok = read_STL(is, g, np, false); + if(ok) + return true; + g.clear(); + is.clear(); + is.seekg (0, is.beg); + ok = read_GOCAD(is, g, np, false); + return ok; +} + +template +bool read_polygon_mesh(std::istream& is, + FaceGraph& g) +{ + return read_polygon_mesh(is, g, parameters::all_default()); +} +*/ +/*! + * + */ +template +bool read_polygon_mesh(const std::string& fname, + FaceGraph& g, + const NamedParameters& np) +{ + if (fname.find(".TS") != std::string::npos) { + return read_GOCAD(fname, g, np); + } + + if (fname.find(".obj") != std::string::npos) { + return read_OBJ(fname, g, np); + } + + if (fname.find(".off") != std::string::npos) { + return read_OFF(fname, g, np); + } + + if (fname.find(".ply") != std::string::npos) { + return read_PLY(fname, g, np); + } + + if (fname.find(".stl") != std::string::npos) { + return read_STL(fname, g, np); + } + + if (fname.find(".vtp") != std::string::npos) { + return read_VTP(fname, g, np); + } + + return false; +} + +template +bool read_polygon_mesh(const std::string& fname, + FaceGraph& g) +{ + return read_polygon_mesh(fname, g, parameters::all_default()); +} + + + +template +bool read_polygon_mesh(const char* fname, + FaceGraph& g, + const NamedParameters& np) +{ + return read_polygon_mesh(std::string(fname), g, np); +} + +template +bool read_polygon_mesh(const char* fname, + FaceGraph& g) +{ + return read_polygon_mesh(fname, g, parameters::all_default()); +} + + +}//end CGAL + +#endif // CGAL_BOOST_GRAPH_POLYGON_MESH_IO_H diff --git a/BGL/test/BGL/test_bgl_read_write.cpp b/BGL/test/BGL/test_bgl_read_write.cpp index b4012fc8c88..bf3fc5a435b 100644 --- a/BGL/test/BGL/test_bgl_read_write.cpp +++ b/BGL/test/BGL/test_bgl_read_write.cpp @@ -18,7 +18,7 @@ #endif -#include +#include #include #include