diff --git a/BGL/include/CGAL/boost/graph/graph_traits_OpenMesh.h b/BGL/include/CGAL/boost/graph/graph_traits_OpenMesh.h index 0783b2f8ee3..a3eeb6c33d2 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_OpenMesh.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_OpenMesh.h @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -81,7 +82,8 @@ private: struct SM_graph_traversal_category : public virtual boost::bidirectional_graph_tag, public virtual boost::vertex_list_graph_tag, - public virtual boost::edge_list_graph_tag + public virtual boost::edge_list_graph_tag, + public virtual boost::adjacency_graph_tag {}; public: @@ -124,10 +126,12 @@ public: typedef CGAL::Out_edge_iterator out_edge_iterator; + typedef typename boost::adjacency_iterator_generator::type adjacency_iterator; + // nulls static vertex_descriptor null_vertex() { return vertex_descriptor(); } static face_descriptor null_face() { return face_descriptor(); } - static halfedge_descriptor null_halfedge() { return halfedge_descriptor(); } + static halfedge_descriptor null_halfedge() { return halfedge_descriptor(); } }; template @@ -264,6 +268,19 @@ out_edges(typename boost::graph_traits::vertex_descriptor v, } +template +CGAL::Iterator_range::adjacency_iterator> +adjacnt_vertices(typename boost::graph_traits::vertex_descriptor v, + const OPEN_MESH_CLASS& sm) +{ + typedef typename boost::graph_traits::out_edge_iterator OutEdgeIter; + typedef typename boost::graph_traits::adjacency_iterator Iter; + return CGAL::make_range(Iter(OutEdgeIter(halfedge(v,sm),sm), &sm), Iter(OutEdgeIter(halfedge(v,sm),sm,1), &sm)); +} + + + + template std::pair::edge_descriptor, bool> diff --git a/BGL/test/BGL/graph_concept_OpenMesh.cpp b/BGL/test/BGL/graph_concept_OpenMesh.cpp index b9c8309b77e..2abc8a6bfa3 100644 --- a/BGL/test/BGL/graph_concept_OpenMesh.cpp +++ b/BGL/test/BGL/graph_concept_OpenMesh.cpp @@ -18,6 +18,7 @@ typedef Traits::face_descriptor face_descriptor; template void concept_check_polyhedron() { boost::function_requires< boost::GraphConcept >(); + boost::function_requires< boost::AdjacencyGraphConcept >(); // Those have to be disabled due to OpenMesh's broken iterators. // boost::function_requires< boost::VertexListGraphConcept >();