diff --git a/BGL/include/CGAL/boost/graph/Seam_mesh.h b/BGL/include/CGAL/boost/graph/Seam_mesh.h index 04352724a0b..ddc3d1971ba 100644 --- a/BGL/include/CGAL/boost/graph/Seam_mesh.h +++ b/BGL/include/CGAL/boost/graph/Seam_mesh.h @@ -444,6 +444,7 @@ public: { public: halfedge_descriptor hd; + const Self* mesh_; #ifdef CGAL_SEAM_MESH_INSERT_OPERATOR friend @@ -453,9 +454,24 @@ public: return os; } #endif - edge_descriptor(const halfedge_descriptor& hd) - : hd(hd) - { } + + edge_descriptor() + : mesh_(NULL) + {} + + edge_descriptor(const halfedge_descriptor& hd, const Self* m) + : hd(hd), mesh_(m) + {} + + friend bool operator==(edge_descriptor e1, edge_descriptor e2) + { + return (e1.hd == e2.hd) || (e1.hd == e2.mesh_->opposite(e2.hd)); + } + + friend bool operator!=(edge_descriptor e1, edge_descriptor e2) + { + return ! (e1 == e2); + } }; #ifndef DOXYGEN_RUNNING @@ -534,9 +550,9 @@ public: // on the opposite virtual border if(seam) - return edge_descriptor(mesh_->opposite(halfedge_descriptor(*hd, true))); + return edge_descriptor(mesh_->opposite(halfedge_descriptor(*hd, true)), mesh_); else - return edge_descriptor(halfedge_descriptor(*hd, false)); + return edge_descriptor(halfedge_descriptor(*hd, false), mesh_); } }; #endif @@ -758,7 +774,7 @@ public: /// Returns the edge that contains halfedge `h` as one of its two halfedges. edge_descriptor edge(halfedge_descriptor h) const { - return h; + return edge_descriptor(h,this); } /// Returns the halfedge corresponding to the edge `e`. @@ -827,7 +843,7 @@ public: std::pair edge(vertex_descriptor u, vertex_descriptor v) const { std::pair he = halfedge(u, v); - return std::make_pair(he.first, he.second); + return std::make_pair(edge_descriptor(he.first, this), he.second); } /// Returns a halfedge of face `f`. diff --git a/BGL/include/CGAL/boost/graph/graph_traits_Seam_mesh.h b/BGL/include/CGAL/boost/graph/graph_traits_Seam_mesh.h index 18a543f72f2..168cfda2d9b 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_Seam_mesh.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_Seam_mesh.h @@ -107,8 +107,8 @@ public: typedef typename SM::face_iterator face_iterator; typedef typename SM::faces_size_type faces_size_type; - //typedef CGAL::In_edge_iterator in_edge_iterator; - //typedef CGAL::Out_edge_iterator out_edge_iterator; + typedef CGAL::In_edge_iterator in_edge_iterator; + typedef CGAL::Out_edge_iterator out_edge_iterator; // nulls static vertex_descriptor null_vertex() { return vertex_descriptor(); } @@ -209,7 +209,7 @@ edges(const CGAL::Seam_mesh& sm) return sm.edges(); } -#if 0 +#if 1 template Iterator_range >::in_edge_iterator> in_edges(typename boost::graph_traits >::vertex_descriptor v, @@ -279,7 +279,7 @@ typename boost::graph_traits >::halfedge_descripto halfedge(typename boost::graph_traits >::edge_descriptor e, const CGAL::Seam_mesh& sm) { - return sm.edge(e); + return sm.halfedge(e); } template diff --git a/BGL/test/BGL/CMakeLists.txt b/BGL/test/BGL/CMakeLists.txt index 4e2bed4842c..9ce23d3de53 100644 --- a/BGL/test/BGL/CMakeLists.txt +++ b/BGL/test/BGL/CMakeLists.txt @@ -73,6 +73,8 @@ create_single_source_cgal_program( "graph_concept_Triangulation_2.cpp" ) create_single_source_cgal_program( "graph_concept_Surface_mesh.cpp" ) +create_single_source_cgal_program( "graph_concept_Seam_mesh_Surface_mesh.cpp" ) + create_single_source_cgal_program( "graph_concept_Gwdwg_Surface_mesh.cpp" ) create_single_source_cgal_program( "test_clear.cpp" ) diff --git a/BGL/test/BGL/graph_concept_Seam_mesh_Surface_mesh.cpp b/BGL/test/BGL/graph_concept_Seam_mesh_Surface_mesh.cpp new file mode 100644 index 00000000000..75857fc76ae --- /dev/null +++ b/BGL/test/BGL/graph_concept_Seam_mesh_Surface_mesh.cpp @@ -0,0 +1,49 @@ +#include +#include +#include +#include + +#include +#include + +typedef CGAL::Simple_cartesian K; +typedef CGAL::Surface_mesh Mesh; +typedef boost::graph_traits::vertex_descriptor SM_vertex_descriptor; +typedef boost::graph_traits::halfedge_descriptor SM_halfedge_descriptor; +typedef boost::graph_traits::edge_descriptor SM_edge_descriptor; +typedef boost::graph_traits::face_descriptor SM_face_descriptor; + +typedef Mesh::Property_map Seam_edge_pmap; +typedef Mesh::Property_map Seam_vertex_pmap; +typedef CGAL::Seam_mesh Seam_mesh; + +typedef boost::graph_traits< Seam_mesh > Traits; +typedef Traits::edge_descriptor edge_descriptor; +typedef Traits::halfedge_descriptor halfedge_descriptor; +typedef Traits::vertex_descriptor vertex_descriptor; +typedef Traits::face_descriptor face_descriptor; + +void concept_check_surface_mesh() +{ + boost::function_requires< boost::GraphConcept >(); + boost::function_requires< boost::VertexListGraphConcept >(); + boost::function_requires< boost::EdgeListGraphConcept >(); + boost::function_requires< boost::IncidenceGraphConcept >(); + boost::function_requires< boost::AdjacencyMatrixConcept >(); + boost::function_requires< boost::BidirectionalGraphConcept >(); + boost::function_requires< CGAL::HalfedgeGraphConcept >(); + boost::function_requires< CGAL::HalfedgeListGraphConcept >(); + boost::function_requires< CGAL::FaceGraphConcept >(); + boost::function_requires< CGAL::FaceListGraphConcept >(); + + + // null + boost::graph_traits::null_vertex(); + boost::graph_traits::null_face(); +} + +int main() +{ + concept_check_surface_mesh(); + return 0; +}