Merge pull request #2758 from maxGimeno/BGL-Document_graph_has_property-GF

BGL: Document graph_has_property
This commit is contained in:
Laurent Rineau 2018-02-19 14:26:33 +01:00
commit 9d227d0fba
14 changed files with 120 additions and 96 deletions

View File

@ -8,6 +8,8 @@ maintain faces described by halfedges, to provide access from a face to
an incident halfedge, and to provide access from a halfedge to its incident
face.
A partial specialization must be provided for `CGAL::graph_has_property`
for each internal property map available.
\cgalAssociatedTypesBegin
\cgalAssociatedTypeBegin{boost::graph_traits<FaceGraph>::%face_descriptor} A face descriptor corresponds to a unique face in an abstract graph instance.

View File

@ -15,6 +15,9 @@ in another cycle, namely the cycle of halfedges which are incident to
the same vertex. We refer to \ref PkgBGLIterators for a description of
iterators and circulators for these halfedge cycles.
A partial specialization must be provided for `CGAL::graph_has_property`
for each internal property map available.
\cgalAssociatedTypesBegin

View File

@ -1111,6 +1111,13 @@ put(PropertyTag ptag, const Face_filtered_graph<Graph, FIMap, VIMap, HIMap>& w,
put(ptag, w.graph(), k, v);
}
template<typename Graph,
typename FIMap,
typename VIMap,
typename HIMap,
typename PropertyTag>
struct graph_has_property<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, PropertyTag>
: graph_has_property<Graph, PropertyTag> {};
}//end namespace CGAL
namespace boost {
@ -1124,13 +1131,6 @@ struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>,Proper
typedef typename boost::property_map<Graph, PropertyTag >::const_type const_type;
};
template<typename Graph,
typename FIMap,
typename VIMap,
typename HIMap,
typename PropertyTag>
struct graph_has_property<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, PropertyTag>
: graph_has_property<Graph, PropertyTag> {};
//specializations for indices

View File

@ -828,6 +828,9 @@ std::size_t hash_value(CGAL::Gwdwg_descriptor<G,D> d)
return hash_value(d.descriptor);
}
template<typename Graph, typename PropertyTag>
struct graph_has_property<CGAL::Graph_with_descriptor_with_graph<Graph>, PropertyTag>
: graph_has_property<Graph, PropertyTag> {};
}//end namespace CGAL
namespace boost {
@ -837,9 +840,6 @@ namespace boost {
typedef CGAL::Graph_with_descriptor_with_graph_property_map<Graph, typename boost::property_map<Graph, PropertyTag >::const_type> const_type;
};
template<typename Graph, typename PropertyTag>
struct graph_has_property<CGAL::Graph_with_descriptor_with_graph<Graph>, PropertyTag>
: graph_has_property<Graph, PropertyTag> {};
}// namespace boost

View File

@ -269,7 +269,7 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm,
#endif
{
internal::copy_face_graph(sm, tm,
boost::graph_has_property<SourceMesh,boost::halfedge_index_t>(),
CGAL::graph_has_property<SourceMesh,boost::halfedge_index_t>(),
v2v, h2h, f2f,
sm_vpm, tm_vpm);
}

View File

@ -46,7 +46,7 @@ namespace CGAL {
class property_map_selector
{
public:
typedef typename boost::graph_has_property<PolygonMesh, PropertyTag>::type Has_internal_pmap;
typedef typename graph_has_property<PolygonMesh, PropertyTag>::type Has_internal_pmap;
typedef typename boost::mpl::if_c< Has_internal_pmap::value
, typename boost::property_map<PolygonMesh, PropertyTag>::type
, typename boost::cgal_no_property::type
@ -149,7 +149,7 @@ namespace CGAL {
typename NamedParametersVPM = NamedParametersGT >
class GetGeomTraits
{
typedef typename boost::graph_has_property<PolygonMesh, boost::vertex_point_t>::type
typedef typename CGAL::graph_has_property<PolygonMesh, boost::vertex_point_t>::type
Has_internal_pmap;
struct Fake_GT {};//to be used if there is no internal vertex_point_map in PolygonMesh

View File

@ -31,7 +31,29 @@
#include <CGAL/basic.h>
#include <string>
namespace CGAL{
/// \ingroup PkgBGLProperties
/// \brief graph_has_property is used to indicate if
/// a model of `HalfedgeGraph` or `FaceGraph`
/// has an internal property associated with the
/// given `PropertyTag`.
///
/// It inherits from `CGAL::Tag_true` if there is a
/// default internal property map for the
/// corresponding property tag and from
/// `CGAL::Tag_false` otherwise.
///
/// \tparam Graph a model of `HalfedgeGraph` or `FaceGraph`
/// \tparam PropertyTag the type of a property tag
/// referring to the property of interest.
///
template<typename Graph, typename PropertyTag>
struct graph_has_property
#ifndef DOXYGEN_RUNNING
: CGAL::Tag_false
#endif
{};
}
/// Boost Namespace
namespace boost {
@ -58,10 +80,6 @@ enum face_index_t { face_index };
enum face_external_index_t { face_external_index } ;
template<typename Graph, typename PropertyTag>
struct graph_has_property : CGAL::Tag_false {};
struct cgal_no_property
{
typedef bool type;

View File

@ -245,8 +245,6 @@ public:
private:
const OpenMesh* sm_;
};
} // CGAL
#endif // CGAL_BOOST_GRAPH_PROPERTIES_OPENMESH_H
@ -326,28 +324,30 @@ struct property_map<OPEN_MESH_CLASS, boost::vertex_point_t >
typedef CGAL::OM_point_pmap<Mesh, P> type;
typedef type const_type;
};
template<typename K>
struct graph_has_property<OPEN_MESH_CLASS, edge_weight_t>
: CGAL::Tag_true{};
template<typename K>
struct graph_has_property<OPEN_MESH_CLASS, vertex_index_t>
: CGAL::Tag_true{};
template<typename K>
struct graph_has_property<OPEN_MESH_CLASS, face_index_t>
: CGAL::Tag_true{};
template<typename K>
struct graph_has_property<OPEN_MESH_CLASS, edge_index_t>
: CGAL::Tag_true{};
template<typename K>
struct graph_has_property<OPEN_MESH_CLASS, halfedge_index_t>
: CGAL::Tag_true{};
template<typename K>
struct graph_has_property<OPEN_MESH_CLASS, vertex_point_t>
: CGAL::Tag_true{};
} // namespace boost
namespace CGAL{
template<typename K>
struct graph_has_property<OPEN_MESH_CLASS, boost::edge_weight_t>
: CGAL::Tag_true{};
template<typename K>
struct graph_has_property<OPEN_MESH_CLASS, boost::vertex_index_t>
: CGAL::Tag_true{};
template<typename K>
struct graph_has_property<OPEN_MESH_CLASS, boost::face_index_t>
: CGAL::Tag_true{};
template<typename K>
struct graph_has_property<OPEN_MESH_CLASS, boost::edge_index_t>
: CGAL::Tag_true{};
template<typename K>
struct graph_has_property<OPEN_MESH_CLASS, boost::halfedge_index_t>
: CGAL::Tag_true{};
template<typename K>
struct graph_has_property<OPEN_MESH_CLASS, boost::vertex_point_t>
: CGAL::Tag_true{};
} //end CGAL
namespace OpenMesh {

View File

@ -132,13 +132,12 @@ get(vertex_point_t, const Seam_mesh<TM, SEM, SVM>& sm)
return Seam_mesh_point_map<TM, SEM, SVM>(sm, get(vertex_point, sm.mesh()));
}
} // namespace CGAL
namespace boost
{
template<class TM, class SEM, class SVM>
struct graph_has_property<CGAL::Seam_mesh<TM, SEM, SVM>, CGAL::vertex_point_t>
: CGAL::Tag_true {};
} //boost
} // namespace CGAL
#endif // CGAL_PROPERTIES_SEAM_MESH_H

View File

@ -366,7 +366,23 @@ get(boost::edge_weight_t, CGAL_LCC_TYPE & cmap)
return typename boost::property_map<CGAL_LCC_TYPE, boost::edge_weight_t>::
type(cmap);
}
template<CGAL_LCC_ARGS>
struct graph_has_property<CGAL_LCC_TYPE, boost::vertex_point_t>: CGAL::Tag_true {};
template<CGAL_LCC_ARGS>
struct graph_has_property<CGAL_LCC_TYPE, boost::edge_weight_t>: CGAL::Tag_true {};
template<CGAL_LCC_ARGS>
struct graph_has_property<CGAL_LCC_TYPE, boost::edge_index_t>: CGAL::Tag_true {};
template<CGAL_LCC_ARGS>
struct graph_has_property<CGAL_LCC_TYPE, boost::face_index_t>: CGAL::Tag_true {};
template<CGAL_LCC_ARGS>
struct graph_has_property<CGAL_LCC_TYPE, boost::halfedge_index_t>: CGAL::Tag_true {};
template<CGAL_LCC_ARGS>
struct graph_has_property<CGAL_LCC_TYPE, boost::vertex_index_t>: CGAL::Tag_true {};
} // namespace CGAL
namespace boost {
@ -391,24 +407,6 @@ struct property_map<const CGAL_LCC_TYPE, Tag>
typedef typename map_gen::const_type const_type;
};
template<CGAL_LCC_ARGS>
struct graph_has_property<CGAL_LCC_TYPE, vertex_point_t>: CGAL::Tag_true {};
template<CGAL_LCC_ARGS>
struct graph_has_property<CGAL_LCC_TYPE, edge_weight_t>: CGAL::Tag_true {};
template<CGAL_LCC_ARGS>
struct graph_has_property<CGAL_LCC_TYPE, edge_index_t>: CGAL::Tag_true {};
template<CGAL_LCC_ARGS>
struct graph_has_property<CGAL_LCC_TYPE, face_index_t>: CGAL::Tag_true {};
template<CGAL_LCC_ARGS>
struct graph_has_property<CGAL_LCC_TYPE, halfedge_index_t>: CGAL::Tag_true {};
template<CGAL_LCC_ARGS>
struct graph_has_property<CGAL_LCC_TYPE, vertex_index_t>: CGAL::Tag_true {};
} // namespace boost
#undef CGAL_LCC_ARGS

View File

@ -135,7 +135,7 @@ struct IGT_generator<Gt,CGAL::Tag_false>
namespace internal { namespace Mesh_3 {
template <typename Polyhedron_type,
bool = boost::graph_has_property<Polyhedron_type,
bool = CGAL::graph_has_property<Polyhedron_type,
CGAL::face_index_t>::value>
class Get_face_index_pmap {
public:

View File

@ -474,25 +474,29 @@ struct vertex_property_type<const CGAL::Polyhedron_3<Gt,I,HDS,A> >
typedef CGAL::vertex_point_t type;
};
} // namespace boost
namespace CGAL{
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, vertex_point_t>
struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, boost::vertex_point_t>
: CGAL::Tag_true {};
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, edge_weight_t>
struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, boost::edge_weight_t>
: CGAL::Tag_true {};
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, edge_index_t>
struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, boost::edge_index_t>
: CGAL::Boolean_tag<
CGAL::internal::Has_member_id<
typename graph_traits<CGAL::Polyhedron_3<Gt, I, HDS, A> >::edge_descriptor
typename boost::graph_traits<CGAL::Polyhedron_3<Gt, I, HDS, A> >::edge_descriptor
>::value
>
{};
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, face_index_t>
struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, boost::face_index_t>
: CGAL::Boolean_tag<
CGAL::internal::Has_member_id<
typename CGAL::Polyhedron_3<Gt, I, HDS, A>::Facet
@ -501,7 +505,7 @@ struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, face_index_t>
{};
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, halfedge_index_t>
struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, boost::halfedge_index_t>
: CGAL::Boolean_tag<
CGAL::internal::Has_member_id<
typename CGAL::Polyhedron_3<Gt, I, HDS, A>::Halfedge
@ -510,17 +514,14 @@ struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, halfedge_index_t>
{};
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, vertex_index_t>
struct graph_has_property<CGAL::Polyhedron_3<Gt, I, HDS, A>, boost::vertex_index_t>
: CGAL::Boolean_tag<
CGAL::internal::Has_member_id<
typename CGAL::Polyhedron_3<Gt, I, HDS, A>::Vertex
>::value
>
{};
} // namespace boost
}// end CGAL
#undef CGAL_HDS_PARAM_
#endif // CGAL_BOOST_GRAPH_PROPERTIES_POLYHEDRON_3_H

View File

@ -29,12 +29,14 @@ namespace boost {
: public boost::property_map<My::Mesh::Base, T>
{};
}
namespace CGAL{
template <typename T>
struct graph_has_property<My::Mesh, T>
: public boost::graph_has_property<My::Mesh::Base, T>
: public CGAL::graph_has_property<My::Mesh::Base, T>
{};
};
}
int main()
{

View File

@ -284,28 +284,29 @@ put(CGAL::vertex_point_t p, const CGAL::Surface_mesh<Point>& g,
prop[x] = point;
}
template<typename Point>
struct graph_has_property<CGAL::Surface_mesh<Point>, boost::vertex_index_t>
: CGAL::Tag_true {};
template<typename Point>
struct graph_has_property<CGAL::Surface_mesh<Point>, boost::edge_index_t>
: CGAL::Tag_true {};
template<typename Point>
struct graph_has_property<CGAL::Surface_mesh<Point>, boost::halfedge_index_t>
: CGAL::Tag_true {};
template<typename Point>
struct graph_has_property<CGAL::Surface_mesh<Point>, boost::face_index_t>
: CGAL::Tag_true {};
template<typename Point>
struct graph_has_property<CGAL::Surface_mesh<Point>, CGAL::vertex_point_t>
: CGAL::Tag_true {};
template<typename Point>
struct graph_has_property<CGAL::Surface_mesh<Point>, boost::edge_weight_t>
: CGAL::Tag_true {};
} // CGAL
namespace boost
{
template<typename Point>
struct graph_has_property<CGAL::Surface_mesh<Point>, vertex_index_t>
: CGAL::Tag_true {};
template<typename Point>
struct graph_has_property<CGAL::Surface_mesh<Point>, edge_index_t>
: CGAL::Tag_true {};
template<typename Point>
struct graph_has_property<CGAL::Surface_mesh<Point>, halfedge_index_t>
: CGAL::Tag_true {};
template<typename Point>
struct graph_has_property<CGAL::Surface_mesh<Point>, face_index_t>
: CGAL::Tag_true {};
template<typename Point>
struct graph_has_property<CGAL::Surface_mesh<Point>, CGAL::vertex_point_t>
: CGAL::Tag_true {};
template<typename Point>
struct graph_has_property<CGAL::Surface_mesh<Point>, edge_weight_t>
: CGAL::Tag_true {};
template <typename Point, typename T>