From 40a3eeef891186f4f4304b91c461f414ccffe0f5 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 16 Jun 2020 16:40:16 +0200 Subject: [PATCH] WIP --- .../CGAL/boost/graph/graph_traits_OpenMesh.h | 24 +++---- BGL/test/BGL/test_bgl_read_write.cpp | 67 ++++++++++--------- 2 files changed, 49 insertions(+), 42 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/graph_traits_OpenMesh.h b/BGL/include/CGAL/boost/graph/graph_traits_OpenMesh.h index 69fbd7f30c8..19bf533ce22 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_OpenMesh.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_OpenMesh.h @@ -631,19 +631,19 @@ void clear(OPEN_MESH_CLASS& sm) CGAL_postcondition(num_faces(sm) == 0); } +//doesn't seem to work. Use BGL default IO functions instead. +//template +//bool read_OFF(std::istream& is, OPEN_MESH_CLASS& sm) +//{ +// OpenMesh::IO::Options ropt; +// return OpenMesh::IO::read_mesh(sm, is, ".OFF", ropt, false); +//} -template -bool read_OFF(std::istream& is, OPEN_MESH_CLASS& sm) -{ - OpenMesh::IO::Options ropt; - return OpenMesh::IO::read_mesh(sm, is, ".OFF", ropt, false); -} - -template -bool write_OFF(std::ostream& os, OPEN_MESH_CLASS& sm) -{ - return OpenMesh::IO::write_mesh(sm, os, ".OFF"); -} +//template +//bool write_OFF(std::ostream& os, OPEN_MESH_CLASS& sm) +//{ +// return OpenMesh::IO::write_mesh(sm, os, ".OFF"); +//} } #ifndef CGAL_NO_DEPRECATED_CODE diff --git a/BGL/test/BGL/test_bgl_read_write.cpp b/BGL/test/BGL/test_bgl_read_write.cpp index 7a7906eb402..5989fd303b8 100644 --- a/BGL/test/BGL/test_bgl_read_write.cpp +++ b/BGL/test/BGL/test_bgl_read_write.cpp @@ -24,15 +24,12 @@ typedef CGAL::Simple_cartesian Kernel; -typedef Kernel::Point_2 Point_2; -typedef Kernel::Point_3 Point; -typedef Kernel::Vector_3 Vector; typedef CGAL::Exact_predicates_inexact_constructions_kernel EPICK; typedef CGAL::Polyhedron_3 Polyhedron; -typedef CGAL::Surface_mesh SM; +typedef CGAL::Surface_mesh SM; typedef CGAL::Linear_cell_complex_traits<3, Kernel> MyTraits; typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper<2, 3, MyTraits>::type LCC; @@ -115,7 +112,7 @@ bool are_equal_meshes(const Mesh& fg1, const Mesh& fg2) return are_equal_meshes(fg1, get(CGAL::vertex_point, fg1), fg2, get(CGAL::vertex_point, fg2), vim1, vim2); } -template +template void test_bgl_OFF(const char* filename) { // read with OFF @@ -148,7 +145,10 @@ void test_bgl_OFF(const char* filename) assert(are_equal_meshes(fg, fg2)); } + // Test [STCN]OFF + typedef typename K::Point_2 Point_2; + typedef typename K::Vector_3 Vector; typedef typename boost::property_map >::type VertexNormalMap; typedef typename boost::property_map >::type VertexColorMap; typedef typename boost::property_map >::type VertexTextureMap; @@ -156,7 +156,7 @@ void test_bgl_OFF(const char* filename) // COFF { - clear(fg); + CGAL::clear(fg); VertexColorMap vcm = get(CGAL::dynamic_vertex_property_t(), fg); FaceColorMap fcm = get(CGAL::dynamic_face_property_t(), fg); @@ -212,7 +212,7 @@ void test_bgl_OFF(const char* filename) // NOFF { - clear(fg); + CGAL::clear(fg); VertexNormalMap vnm = get(CGAL::dynamic_vertex_property_t(), fg); ok = CGAL::read_OFF("data/mesh_with_normals.off", fg, CGAL::parameters::vertex_normal_map(vnm)); @@ -257,7 +257,7 @@ void test_bgl_OFF(const char* filename) // STCNOFF { - clear(fg); + CGAL::clear(fg); std::ifstream is("data/full.off"); VertexNormalMap vnm = get(CGAL::dynamic_vertex_property_t(), fg); @@ -366,7 +366,7 @@ void test_bgl_OFF(const char* filename) std::cerr<<"No more error text from here."< +template void test_bgl_OBJ(const std::string filename) { Mesh fg; @@ -399,9 +399,10 @@ void test_bgl_OBJ(const std::string filename) assert(are_equal_meshes(fg, fg2)); } // Test NPs + typedef typename K::Vector_3 Vector; typedef typename boost::property_map >::type VertexNormalMap; - clear(fg); + CGAL::clear(fg); ok = CGAL::read_OBJ("data/sphere.obj", fg); assert(ok); assert(num_vertices(fg) == 324 && num_faces(fg) == 640); @@ -479,7 +480,7 @@ void test_bgl_PLY(const std::string filename, typedef typename boost::property_map >::type VertexColorMap; typedef typename boost::property_map >::type FaceColorMap; - clear(fg); + CGAL::clear(fg); VertexColorMap vcm = get(CGAL::dynamic_vertex_property_t(), fg); FaceColorMap fcm = get(CGAL::dynamic_face_property_t(), fg); @@ -594,7 +595,7 @@ void test_bgl_STL(const std::string filename) ok = CGAL::write_STL("tmp.stl", fg); assert(ok); - clear(fg); + CGAL::clear(fg); std::map::vertex_descriptor, EPICK::Point_3> cpoints; Custom_VPM cvpm(cpoints); @@ -655,7 +656,7 @@ void test_bgl_GOCAD(const char* filename) is.seekg(0); fg.clear(); - clear(fg); + CGAL::clear(fg); std::pair name_and_color; ok = CGAL::read_GOCAD(is, name_and_color, fg); assert(ok); @@ -723,7 +724,7 @@ void test_bgl_GOCAD(const char* filename) } #ifdef CGAL_USE_VTK -template +template void test_bgl_VTP(const char* filename, // @fixme not finished const bool binary = false) { @@ -761,9 +762,10 @@ void test_bgl_VTP(const char* filename, // @fixme not finished } // Test NPs + typedef typename K::Vector_3 Vector; typedef typename boost::property_map >::type VertexNormalMap; - clear(fg); + CGAL::clear(fg); VertexNormalMap vnm = get(CGAL::dynamic_vertex_property_t(), fg); ok = CGAL::read_VTP("data/bones.vtp", fg, CGAL::parameters::vertex_normal_map(vnm)); @@ -839,20 +841,19 @@ int main(int argc, char** argv) // OFF const char* off_file = (argc > 1) ? argv[1] : "data/prim.off"; - test_bgl_OFF(off_file); - test_bgl_OFF(off_file); - test_bgl_OFF(off_file); + test_bgl_OFF(off_file); + test_bgl_OFF(off_file); + test_bgl_OFF(off_file); #ifdef CGAL_USE_OPENMESH - test_bgl_OFF(off_file); + test_bgl_OFF(off_file); #endif - // OBJ const char* obj_file = (argc > 2) ? argv[2] : "data/sphere.obj"; - test_bgl_OBJ(obj_file); - test_bgl_OBJ(obj_file); - test_bgl_OBJ(obj_file); + test_bgl_OBJ(obj_file); + test_bgl_OBJ(obj_file); + test_bgl_OBJ(obj_file); #ifdef CGAL_USE_OPENMESH - test_bgl_OBJ(obj_file); + test_bgl_OBJ(obj_file); #endif // PLY @@ -886,13 +887,19 @@ int main(int argc, char** argv) #ifdef CGAL_USE_VTK const char* vtp_file = (argc > 6) ? argv[6] : "data/bones.vtp"; - test_bgl_VTP(vtp_file, false); - test_bgl_VTP(vtp_file, false); - test_bgl_VTP(vtp_file, false); + test_bgl_VTP(vtp_file, false); + test_bgl_VTP(vtp_file, false); + test_bgl_VTP(vtp_file, false); - test_bgl_VTP(vtp_file, true); - test_bgl_VTP(vtp_file, true); - test_bgl_VTP(vtp_file, true); + test_bgl_VTP(vtp_file, true); + test_bgl_VTP(vtp_file, true); + test_bgl_VTP(vtp_file, true); + +#ifdef CGAL_USE_OPENMESH + test_bgl_VTP(vtp_file, false); + test_bgl_VTP(vtp_file, true); #endif +#endif + return EXIT_SUCCESS; }