mirror of https://github.com/CGAL/cgal
WIP. Remove read_pm for streams.
This commit is contained in:
parent
7c8dcbfd47
commit
bc360bcfd3
|
|
@ -153,16 +153,15 @@ template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_GOCAD(const char* fname, FaceGraph& g, const CGAL_BGL_NP_CLASS& np, bool verbose = true)
|
bool read_GOCAD(const char* fname, FaceGraph& g, const CGAL_BGL_NP_CLASS& np, bool verbose = true)
|
||||||
{
|
{
|
||||||
std::ifstream in(fname);
|
std::ifstream in(fname);
|
||||||
std::string unused_name;
|
std::pair<std::string, std::string> dummy;
|
||||||
std::string unused_color;
|
|
||||||
|
|
||||||
return read_GOCAD(in, unused_name, unused_color, g, np, verbose);
|
return read_GOCAD(in, dummy, g, np, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_GOCAD(const std::string& fname, FaceGraph& g, CGAL_BGL_NP_CLASS np)
|
bool read_GOCAD(const std::string& fname, FaceGraph& g, CGAL_BGL_NP_CLASS np, bool verbose = true)
|
||||||
{
|
{
|
||||||
return read_GOCAD(fname.c_str(), g, np);
|
return read_GOCAD(fname.c_str(), g, np, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FaceGraph>
|
template <typename FaceGraph>
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_PLY(const std::string& fname, FaceGraph& g, const CGAL_BGL_NP_CLASS& np,
|
bool read_PLY(const std::string& fname, FaceGraph& g, const CGAL_BGL_NP_CLASS& np,
|
||||||
bool verbose = true)
|
bool verbose = true)
|
||||||
{
|
{
|
||||||
return IO::internal::read_PLY_BGL(fname.c_str(), g, np, verbose);
|
return IO::internal::read_PLY(fname.c_str(), g, np, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,8 @@ bool read_polygon_mesh(const std::string& fname,
|
||||||
return read_VTP(fname, g, np);
|
return read_VTP(fname, g, np);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::istream is(fname.c_str());
|
std::ifstream is(fname.c_str());
|
||||||
return read_polygon_mesh(is, g, np, false);
|
return read_polygon_mesh(is, g, np);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class FaceGraph>
|
template <class FaceGraph>
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,10 @@ void fill_soup(PointRange& points, PolygonRange& polygons)
|
||||||
template<typename Mesh>
|
template<typename Mesh>
|
||||||
void test_bgl_OFF(const char* filename)
|
void test_bgl_OFF(const char* filename)
|
||||||
{
|
{
|
||||||
Mesh sm;
|
Mesh sm, sm2;
|
||||||
std::ifstream in(filename);
|
std::ifstream in(filename);
|
||||||
CGAL::read_polygon_mesh(in,sm);
|
CGAL::read_polygon_mesh(in,sm);
|
||||||
|
CGAL::read_polygon_mesh(filename, sm2);
|
||||||
|
|
||||||
CGAL::write_OFF(std::cout, sm);
|
CGAL::write_OFF(std::cout, sm);
|
||||||
}
|
}
|
||||||
|
|
@ -104,6 +105,12 @@ void test_bgl_OFF_with_np()
|
||||||
.vertex_texture_map(vtm)
|
.vertex_texture_map(vtm)
|
||||||
.face_color_map(fcm));
|
.face_color_map(fcm));
|
||||||
CGAL_assertion(ok);
|
CGAL_assertion(ok);
|
||||||
|
fg.clear();
|
||||||
|
ok = CGAL::read_polygon_mesh("data/full.off", fg, CGAL::parameters::vertex_normal_map(vnm)
|
||||||
|
.vertex_color_map(vcm)
|
||||||
|
.vertex_texture_map(vtm)
|
||||||
|
.face_color_map(fcm));
|
||||||
|
CGAL_assertion(ok);
|
||||||
|
|
||||||
ok = CGAL::write_OFF(std::cout, fg, CGAL::parameters::vertex_normal_map(vnm)
|
ok = CGAL::write_OFF(std::cout, fg, CGAL::parameters::vertex_normal_map(vnm)
|
||||||
.vertex_color_map(vcm)
|
.vertex_color_map(vcm)
|
||||||
|
|
@ -134,6 +141,11 @@ bool test_bgl_OBJ()
|
||||||
CGAL::read_polygon_mesh(in, fg);
|
CGAL::read_polygon_mesh(in, fg);
|
||||||
CGAL_assertion(num_vertices(fg) == 4);
|
CGAL_assertion(num_vertices(fg) == 4);
|
||||||
CGAL_assertion(num_faces(fg) == 4);
|
CGAL_assertion(num_faces(fg) == 4);
|
||||||
|
fg.clear();
|
||||||
|
CGAL::read_polygon_mesh("data/sphere.obj", fg);
|
||||||
|
CGAL_assertion(num_vertices(fg) == 162);
|
||||||
|
CGAL_assertion(num_faces(fg) == 320);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -203,7 +215,7 @@ bool test_bgl_vtp(bool binary = false)
|
||||||
}
|
}
|
||||||
os.close();
|
os.close();
|
||||||
Mesh fg2;
|
Mesh fg2;
|
||||||
if(!CGAL::read_VTP("tetrahedron.vtp", fg2))
|
if(!CGAL::read_polygon_mesh("tetrahedron.vtp", fg2))
|
||||||
{
|
{
|
||||||
std::cerr<<"vtp reading failed."<<std::endl;
|
std::cerr<<"vtp reading failed."<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -239,7 +251,7 @@ bool test_bgl_vtp<Polyhedron>(bool binary)
|
||||||
}
|
}
|
||||||
os.close();
|
os.close();
|
||||||
Polyhedron fg2;
|
Polyhedron fg2;
|
||||||
if(!CGAL::read_VTP("tetrahedron.vtp", fg2))
|
if(!CGAL::read_polygon_mesh("tetrahedron.vtp", fg2))
|
||||||
{
|
{
|
||||||
std::cerr<<"vtp reading failed."<<std::endl;
|
std::cerr<<"vtp reading failed."<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@ namespace CGAL {
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Read
|
/// Read
|
||||||
template <typename PointRange, typename PolygonRange, typename NamedParameters>
|
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_GOCAD(std::istream& input,
|
bool read_GOCAD(std::istream& input,
|
||||||
std::pair<std::string, std::string>& name_and_color,
|
std::pair<std::string, std::string>& name_and_color,
|
||||||
PointRange& points,
|
PointRange& points,
|
||||||
PolygonRange& polygons,
|
PolygonRange& polygons,
|
||||||
const NamedParameters&,
|
const CGAL_BGL_NP_CLASS&,
|
||||||
bool verbose = true)
|
bool verbose = true)
|
||||||
{
|
{
|
||||||
CGAL_USE(verbose);
|
CGAL_USE(verbose);
|
||||||
|
|
@ -105,33 +105,33 @@ bool read_GOCAD(std::istream& input,
|
||||||
return !input.fail();
|
return !input.fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename PointRange, typename PolygonRange, typename NamedParameters>
|
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_GOCAD(std::istream& is,
|
bool read_GOCAD(std::istream& is,
|
||||||
PointRange& points,
|
PointRange& points,
|
||||||
PolygonRange& polygons,
|
PolygonRange& polygons,
|
||||||
const NamedParameters&np)
|
const CGAL_BGL_NP_CLASS&np)
|
||||||
{
|
{
|
||||||
std::pair<std::string, std::string> dummy;
|
std::pair<std::string, std::string> dummy;
|
||||||
return read_GOCAD(is, dummy, points, polygons, np);
|
return read_GOCAD(is, dummy, points, polygons, np);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename PointRange, typename PolygonRange, typename NamedParameters>
|
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_GOCAD(const char* fname,
|
bool read_GOCAD(const char* fname,
|
||||||
PointRange& points,
|
PointRange& points,
|
||||||
PolygonRange& polygons,
|
PolygonRange& polygons,
|
||||||
const NamedParameters& np)
|
const CGAL_BGL_NP_CLASS& np)
|
||||||
{
|
{
|
||||||
std::ifstream in(fname);
|
std::ifstream in(fname);
|
||||||
std::pair<std::string, std::string> dummy;
|
std::pair<std::string, std::string> dummy;
|
||||||
return read_GOCAD(in, dummy, points, polygons, np);
|
return read_GOCAD(in, dummy, points, polygons, np);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename PointRange, typename PolygonRange, typename NamedParameters>
|
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_GOCAD(const std::string& fname,
|
bool read_GOCAD(const std::string& fname,
|
||||||
PointRange& points,
|
PointRange& points,
|
||||||
PolygonRange& polygons,
|
PolygonRange& polygons,
|
||||||
const NamedParameters& np)
|
const CGAL_BGL_NP_CLASS& np)
|
||||||
{
|
{
|
||||||
return read_GOCAD(fname.c_str(), points, polygons, np);
|
return read_GOCAD(fname.c_str(), points, polygons, np);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue