mirror of https://github.com/CGAL/cgal
start adding dynamic property maps with default
WIP: need updates in all models of face graph
This commit is contained in:
parent
3a54848e18
commit
a54e024a32
|
|
@ -139,13 +139,13 @@ get(PropertyTag p,CGAL_HDS_CLASS const& g, const Key& key)
|
|||
|
||||
|
||||
|
||||
#define DECLARE_HDS_DYNAMIC_PM(TAG, DESCRIPTOR) \
|
||||
#define DECLARE_HDS_DYNAMIC_PM(TAG, DESCRIPTOR) \
|
||||
template <typename CGAL_HDS_TMPLT, class T> \
|
||||
typename boost::property_map<CGAL_HDS_CLASS, TAG >::const_type \
|
||||
get(const TAG&, const CGAL_HDS_CLASS&) \
|
||||
{ \
|
||||
get(const TAG&, const CGAL_HDS_CLASS&, const T& dv = T()) \
|
||||
{ \
|
||||
typedef typename boost::graph_traits< CGAL_HDS_CLASS >::DESCRIPTOR descriptor; \
|
||||
return internal::Dynamic_property_map<descriptor,T>(); \
|
||||
return internal::Dynamic_property_map<descriptor,T>(dv); \
|
||||
}
|
||||
|
||||
DECLARE_HDS_DYNAMIC_PM(dynamic_vertex_property_t<T>, vertex_descriptor)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ struct Non_manifold_feature_map
|
|||
halfedge_descriptor hd = halfedge(ed, pm);
|
||||
|
||||
// an edge can be non-manifold only if both its vertices are non-manifold
|
||||
// THIS IS NOT TRUE!
|
||||
if ( get(v_nm_id, source(hd, pm))==std::size_t(-1) ||
|
||||
get(v_nm_id, target(hd, pm))==std::size_t(-1) ) continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -136,8 +136,8 @@ struct Dynamic_with_index
|
|||
: m_values()
|
||||
{}
|
||||
|
||||
Dynamic_with_index(std::size_t num_features)
|
||||
: m_values( new std::vector<value_type>(num_features) )
|
||||
Dynamic_with_index(std::size_t num_features, Value default_value = Value())
|
||||
: m_values( new std::vector<value_type>(num_features, default_value) )
|
||||
{}
|
||||
|
||||
friend reference get(const Dynamic_with_index& m, const key_type& k)
|
||||
|
|
@ -229,34 +229,34 @@ namespace CGAL {
|
|||
|
||||
template <typename T, typename G>
|
||||
typename boost::property_map<G, dynamic_vertex_property_t<T> >::const_type
|
||||
get(const CGAL::dynamic_vertex_property_t<T>&, const G&)
|
||||
get(const CGAL::dynamic_vertex_property_t<T>&, const G&, const T& default_value = T())
|
||||
{
|
||||
typedef typename boost::graph_traits<G>::vertex_descriptor vertex_descriptor;
|
||||
return internal::Dynamic_property_map<vertex_descriptor,T>();
|
||||
return internal::Dynamic_property_map<vertex_descriptor,T>(default_value);
|
||||
}
|
||||
|
||||
template <typename T, typename G>
|
||||
typename boost::property_map<G, dynamic_halfedge_property_t<T> >::const_type
|
||||
get(const CGAL::dynamic_halfedge_property_t<T>&, const G&)
|
||||
get(const CGAL::dynamic_halfedge_property_t<T>&, const G&, const T& default_value = T())
|
||||
{
|
||||
typedef typename boost::graph_traits<G>::halfedge_descriptor halfedge_descriptor;
|
||||
return internal::Dynamic_property_map<halfedge_descriptor,T>();
|
||||
return internal::Dynamic_property_map<halfedge_descriptor,T>(default_value);
|
||||
}
|
||||
|
||||
template <typename T, typename G>
|
||||
typename boost::property_map<G, dynamic_edge_property_t<T> >::const_type
|
||||
get(const CGAL::dynamic_edge_property_t<T>&, const G&)
|
||||
get(const CGAL::dynamic_edge_property_t<T>&, const G&, const T& default_value = T())
|
||||
{
|
||||
typedef typename boost::graph_traits<G>::edge_descriptor edge_descriptor;
|
||||
return internal::Dynamic_property_map<edge_descriptor,T>();
|
||||
return internal::Dynamic_property_map<edge_descriptor,T>(default_value);
|
||||
}
|
||||
|
||||
template <typename T, typename G>
|
||||
typename boost::property_map<G, dynamic_face_property_t<T> >::const_type
|
||||
get(const CGAL::dynamic_face_property_t<T>&, const G&)
|
||||
get(const CGAL::dynamic_face_property_t<T>&, const G&, const T& default_value = T())
|
||||
{
|
||||
typedef typename boost::graph_traits<G>::face_descriptor face_descriptor;
|
||||
return internal::Dynamic_property_map<face_descriptor,T>();
|
||||
return internal::Dynamic_property_map<face_descriptor,T>(default_value);
|
||||
}
|
||||
|
||||
template<typename G, typename Descriptor, typename T>
|
||||
|
|
|
|||
|
|
@ -353,67 +353,67 @@ namespace CGAL {
|
|||
// get functions for dynamic properties of mutable Surface_mesh
|
||||
template <typename Point, typename T>
|
||||
typename boost::property_map<CGAL::Surface_mesh<Point>, dynamic_vertex_property_t<T> >::type
|
||||
get(dynamic_vertex_property_t<T>, Surface_mesh<Point>& sm)
|
||||
get(dynamic_vertex_property_t<T>, Surface_mesh<Point>& sm, const T& default_value = T())
|
||||
{
|
||||
typedef typename boost::property_map<Surface_mesh<Point>, dynamic_vertex_property_t<T> >::SMPM SMPM;
|
||||
typedef typename boost::property_map<Surface_mesh<Point>, dynamic_vertex_property_t<T> >::type DPM;
|
||||
return DPM(sm, new SMPM(sm.template add_property_map<typename Surface_mesh<Point>::Vertex_index, T>(std::string()).first));
|
||||
return DPM(sm, new SMPM(sm.template add_property_map<typename Surface_mesh<Point>::Vertex_index, T>(std::string(), default_value).first));
|
||||
}
|
||||
|
||||
template <typename Point, typename T>
|
||||
typename boost::property_map<Surface_mesh<Point>, dynamic_face_property_t<T> >::type
|
||||
get(dynamic_face_property_t<T>, Surface_mesh<Point>& sm)
|
||||
get(dynamic_face_property_t<T>, Surface_mesh<Point>& sm, const T& default_value = T())
|
||||
{
|
||||
typedef typename boost::property_map<Surface_mesh<Point>, dynamic_face_property_t<T> >::SMPM SMPM;
|
||||
typedef typename boost::property_map<Surface_mesh<Point>, dynamic_face_property_t<T> >::type DPM;
|
||||
return DPM(sm, new SMPM(sm.template add_property_map<typename Surface_mesh<Point>::Face_index, T>(std::string()).first));
|
||||
return DPM(sm, new SMPM(sm.template add_property_map<typename Surface_mesh<Point>::Face_index, T>(std::string(), default_value).first));
|
||||
}
|
||||
|
||||
template <typename Point, typename T>
|
||||
typename boost::property_map<Surface_mesh<Point>, dynamic_edge_property_t<T> >::type
|
||||
get(dynamic_edge_property_t<T>, Surface_mesh<Point>& sm)
|
||||
get(dynamic_edge_property_t<T>, Surface_mesh<Point>& sm, const T& default_value = T())
|
||||
{
|
||||
typedef typename boost::property_map<Surface_mesh<Point>, dynamic_edge_property_t<T> >::SMPM SMPM;
|
||||
typedef typename boost::property_map<Surface_mesh<Point>, dynamic_edge_property_t<T> >::type DPM;
|
||||
return DPM(sm, new SMPM(sm.template add_property_map<typename Surface_mesh<Point>::Edge_index, T>(std::string()).first));
|
||||
return DPM(sm, new SMPM(sm.template add_property_map<typename Surface_mesh<Point>::Edge_index, T>(std::string(), default_value).first));
|
||||
}
|
||||
|
||||
template <typename Point, typename T>
|
||||
typename boost::property_map<Surface_mesh<Point>, dynamic_halfedge_property_t<T> >::type
|
||||
get(dynamic_halfedge_property_t<T>, Surface_mesh<Point>& sm)
|
||||
get(dynamic_halfedge_property_t<T>, Surface_mesh<Point>& sm, const T& default_value = T())
|
||||
{
|
||||
typedef typename boost::property_map<Surface_mesh<Point>, dynamic_halfedge_property_t<T> >::SMPM SMPM;
|
||||
typedef typename boost::property_map<Surface_mesh<Point>, dynamic_halfedge_property_t<T> >::type DPM;
|
||||
return DPM(sm, new SMPM(sm.template add_property_map<typename Surface_mesh<Point>::Halfedge_index, T>(std::string()).first));
|
||||
return DPM(sm, new SMPM(sm.template add_property_map<typename Surface_mesh<Point>::Halfedge_index, T>(std::string(), default_value).first));
|
||||
}
|
||||
|
||||
// get functions for dynamic properties of const Surface_mesh
|
||||
template <typename Point, typename T>
|
||||
typename boost::property_map<Surface_mesh<Point>, dynamic_vertex_property_t<T> >::const_type
|
||||
get(dynamic_vertex_property_t<T>, const Surface_mesh<Point>& sm)
|
||||
get(dynamic_vertex_property_t<T>, const Surface_mesh<Point>& sm, const T& default_value = T())
|
||||
{
|
||||
return CGAL::internal::Dynamic_with_index<typename Surface_mesh<Point>::Vertex_index, T>(num_vertices(sm));
|
||||
return CGAL::internal::Dynamic_with_index<typename Surface_mesh<Point>::Vertex_index, T>(num_vertices(sm), default_value);
|
||||
}
|
||||
|
||||
template <typename Point, typename T>
|
||||
typename boost::property_map<Surface_mesh<Point>, dynamic_face_property_t<T> >::const_type
|
||||
get(dynamic_face_property_t<T>, const Surface_mesh<Point>& sm)
|
||||
get(dynamic_face_property_t<T>, const Surface_mesh<Point>& sm, const T& default_value = T())
|
||||
{
|
||||
return CGAL::internal::Dynamic_with_index<typename Surface_mesh<Point>::Face_index, T>(num_faces(sm));
|
||||
return CGAL::internal::Dynamic_with_index<typename Surface_mesh<Point>::Face_index, T>(num_faces(sm), default_value);
|
||||
}
|
||||
|
||||
template <typename Point, typename T>
|
||||
typename boost::property_map<Surface_mesh<Point>, dynamic_halfedge_property_t<T> >::const_type
|
||||
get(dynamic_halfedge_property_t<T>, const Surface_mesh<Point>& sm)
|
||||
get(dynamic_halfedge_property_t<T>, const Surface_mesh<Point>& sm, const T& default_value = T())
|
||||
{
|
||||
return CGAL::internal::Dynamic_with_index<typename Surface_mesh<Point>::Halfedge_index, T>(num_halfedges(sm));
|
||||
return CGAL::internal::Dynamic_with_index<typename Surface_mesh<Point>::Halfedge_index, T>(num_halfedges(sm), default_value);
|
||||
}
|
||||
|
||||
template <typename Point, typename T>
|
||||
typename boost::property_map<Surface_mesh<Point>, dynamic_edge_property_t<T> >::const_type
|
||||
get(dynamic_edge_property_t<T>, const Surface_mesh<Point>& sm)
|
||||
get(dynamic_edge_property_t<T>, const Surface_mesh<Point>& sm, const T& default_value = T())
|
||||
{
|
||||
return CGAL::internal::Dynamic_with_index<typename Surface_mesh<Point>::Edge_index, T>(num_edges(sm));
|
||||
return CGAL::internal::Dynamic_with_index<typename Surface_mesh<Point>::Edge_index, T>(num_edges(sm), default_value);
|
||||
}
|
||||
|
||||
// implementation detail: required by Dynamic_property_map_deleter
|
||||
|
|
|
|||
Loading…
Reference in New Issue