rename property map and deprecated old name

This commit is contained in:
Sébastien Loriot 2023-01-18 13:45:37 +01:00
parent f4c6299adc
commit cd76994056
17 changed files with 187 additions and 45 deletions

View File

@ -143,18 +143,18 @@ struct AABB_covered_triangle_tree_traits
// Primitive ID --> box vector pos --> Bounding Box
using BPMB = internal::Vector_property_map<CGAL::Bbox_3>;
using BPM = CGAL::Property_map_binder<IDPM, BPMB>;
using BPM = CGAL::Compose_property_map<IDPM, BPMB>;
// Primitive ID --> point vector pos --> Reference Point
using RPPMB = internal::Vector_property_map<Point>;
using RPPM = CGAL::Property_map_binder<IDPM, RPPMB>;
using RPPM = CGAL::Compose_property_map<IDPM, RPPMB>;
// Primitive ID --> Datum pos vector pos --> Datum pos --> Datum
// The vector of data has size nf, but the vector of datum pos has size tree.size()
using DPPMB = internal::Vector_property_map<std::size_t>; // pos --> Datum pos
using DPPM = CGAL::Property_map_binder<IDPM, DPPMB>; // PID --> Datum pos
using DPPM = CGAL::Compose_property_map<IDPM, DPPMB>; // PID --> Datum pos
using DPMB = internal::Vector_property_map<Triangle_3>; // Datum pos --> Datum
using DPM = CGAL::Property_map_binder<DPPM, DPMB>; // PID --> Datum
using DPM = CGAL::Compose_property_map<DPPM, DPMB>; // PID --> Datum
using Primitive = CGAL::AABB_primitive<ID, DPM, RPPM,
CGAL::Tag_true /*external pmaps*/,

View File

@ -175,18 +175,18 @@ struct AABB_tree_splitter_traits
// Primitive ID --> box vector pos --> Bounding Box
using BPMB = internal::Vector_property_map<CGAL::Bbox_3>;
using BPM = CGAL::Property_map_binder<IDPM, BPMB>;
using BPM = CGAL::Compose_property_map<IDPM, BPMB>;
// Primitive ID --> point vector pos --> Reference Point
using RPPMB = internal::Vector_property_map<Point>;
using RPPM = CGAL::Property_map_binder<IDPM, RPPMB>;
using RPPM = CGAL::Compose_property_map<IDPM, RPPMB>;
// Primitive ID --> Datum pos vector pos --> Datum pos --> Datum
// The vector of data has size nf, but the vector of datum pos has size tree.size()
using DPPMB = internal::Vector_property_map<std::size_t>; // pos --> Datum pos
using DPPM = CGAL::Property_map_binder<IDPM, DPPMB>; // PID --> Datum pos
using DPPM = CGAL::Compose_property_map<IDPM, DPPMB>; // PID --> Datum pos
using DPMB = internal::Vector_property_map<Triangle_3>; // Datum pos --> Datum
using DPM = CGAL::Property_map_binder<DPPM, DPMB>; // PID --> Datum
using DPM = CGAL::Compose_property_map<DPPM, DPMB>; // PID --> Datum
using Primitive = CGAL::AABB_primitive<ID, DPM, RPPM,
CGAL::Tag_true /*external pmaps*/,

View File

@ -588,31 +588,31 @@ struct Face_filtered_graph
return selected_halfedges.count();
}
Property_map_binder<FIM, typename Pointer_property_map<typename boost::property_traits<FIM>::value_type>::type>
Compose_property_map<FIM, typename Pointer_property_map<typename boost::property_traits<FIM>::value_type>::type>
get_face_index_map() const
{
is_imap_in_use.set(0);
initialize_face_indices();
return bind_property_maps(fimap, make_property_map(face_indices));
return compose_property_maps(fimap, make_property_map(face_indices));
}
Property_map_binder<VIM, typename Pointer_property_map<typename boost::property_traits<VIM>::value_type>::type>
Compose_property_map<VIM, typename Pointer_property_map<typename boost::property_traits<VIM>::value_type>::type>
get_vertex_index_map() const
{
is_imap_in_use.set(1);
initialize_vertex_indices();
return bind_property_maps(vimap, make_property_map(vertex_indices) );
return compose_property_maps(vimap, make_property_map(vertex_indices) );
}
Property_map_binder<HIM, typename Pointer_property_map<typename boost::property_traits<HIM>::value_type >::type>
Compose_property_map<HIM, typename Pointer_property_map<typename boost::property_traits<HIM>::value_type >::type>
get_halfedge_index_map() const
{
is_imap_in_use.set(2);
initialize_halfedge_indices();
return bind_property_maps(himap, make_property_map(halfedge_indices) );
return compose_property_maps(himap, make_property_map(halfedge_indices) );
}
/// returns `true` if around any vertex of a selected face there is at most a single umbrella
@ -1322,7 +1322,7 @@ struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost
typedef CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap> FFG;
typedef typename FFG::FIM FIM;
typedef typename CGAL::Property_map_binder<FIM,
typedef typename CGAL::Compose_property_map<FIM,
typename CGAL::Pointer_property_map<
typename boost::property_traits<FIM>::value_type>::type> type;
typedef type const_type;
@ -1334,7 +1334,7 @@ struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost
typedef CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap> FFG;
typedef typename FFG::VIM VIM;
typedef typename CGAL::Property_map_binder<VIM,
typedef typename CGAL::Compose_property_map<VIM,
typename CGAL::Pointer_property_map<
typename boost::property_traits<VIM>::value_type>::type> type;
typedef type const_type;
@ -1346,7 +1346,7 @@ struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost
typedef CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap> FFG;
typedef typename FFG::HIM HIM;
typedef typename CGAL::Property_map_binder<HIM,
typedef typename CGAL::Compose_property_map<HIM,
typename CGAL::Pointer_property_map<
typename boost::property_traits<HIM>::value_type>::type> type;
typedef type const_type;

View File

@ -707,7 +707,7 @@ public:
Border_edge_map<TriangleMesh> is_marked_1(intersection_edges1, tm1);
std::size_t nb_patches_tm1 =
connected_components(tm1,
bind_property_maps(fids1,make_property_map(&tm1_patch_ids[0])),
compose_property_maps(fids1,make_property_map(&tm1_patch_ids[0])),
parameters::edge_is_constrained_map(is_marked_1)
.face_index_map(fids1));
@ -720,7 +720,7 @@ public:
Border_edge_map<TriangleMesh> is_marked_2(intersection_edges2, tm2);
std::size_t nb_patches_tm2 =
connected_components(tm2,
bind_property_maps(fids2,make_property_map(&tm2_patch_ids[0])),
compose_property_maps(fids2,make_property_map(&tm2_patch_ids[0])),
parameters::edge_is_constrained_map(is_marked_2)
.face_index_map(fids2));

View File

@ -148,7 +148,7 @@ public:
std::size_t nb_patches_tm1 =
connected_components(tm1,
bind_property_maps(fids1,make_property_map(&tm1_patch_ids[0])),
compose_property_maps(fids1,make_property_map(&tm1_patch_ids[0])),
parameters::edge_is_constrained_map(ecm1)
.face_index_map(fids1));
@ -228,7 +228,7 @@ public:
}
}
keep_connected_components(tm1, cc_to_keep, bind_property_maps(fids1,make_property_map(&tm1_patch_ids[0])));
keep_connected_components(tm1, cc_to_keep, compose_property_maps(fids1,make_property_map(&tm1_patch_ids[0])));
}
};

View File

@ -349,7 +349,7 @@ public:
is_intersection(intersection_edges);
std::size_t nb_patches =
connected_components(tm,
bind_property_maps(fids,make_property_map(patch_ids)),
compose_property_maps(fids,make_property_map(patch_ids)),
parameters::edge_is_constrained_map(is_intersection)
.face_index_map(fids));

View File

@ -306,7 +306,7 @@ struct Side_of_helper
typedef CGAL::Pointer_property_map<CGAL::Bbox_3>::type Id_to_box;
Id_to_box id_to_box = CGAL::make_property_map(face_bboxes);
typedef Property_map_binder<FaceIdMap, Id_to_box> BPM;
typedef Compose_property_map<FaceIdMap, Id_to_box> BPM;
BPM bpm(fid, id_to_box);
Compute_bbox<BPM> compute_bbox(bpm);

View File

@ -434,7 +434,7 @@ void orient(TriangleMesh& tm,
// set the connected component id of each face
std::size_t nb_cc = connected_components(tm,
bind_property_maps(fid_map,make_property_map(face_cc)),
compose_property_maps(fid_map,make_property_map(face_cc)),
parameters::face_index_map(fid_map));
// extract a vertex with max z coordinate for each connected component
@ -844,7 +844,7 @@ volume_connected_components(const TriangleMesh& tm,
// set the connected component id of each face
const std::size_t nb_cc = connected_components(tm,
bind_property_maps(fid_map,make_property_map(face_cc)),
compose_property_maps(fid_map,make_property_map(face_cc)),
parameters::face_index_map(fid_map));
// contains for each CC the CC that are in its bounded side
@ -1376,7 +1376,7 @@ void orient_to_bound_a_volume(TriangleMesh& tm,
parameters::vertex_point_map(vpm)
.geom_traits(gt)
.nesting_levels(boost::ref(nesting_levels))
.face_connected_component_map(bind_property_maps(fid_map,make_property_map(face_cc)))
.face_connected_component_map(compose_property_maps(fid_map,make_property_map(face_cc)))
.i_used_for_volume_orientation(true)
.do_orientation_tests(true)
.is_cc_outward_oriented(boost::ref(is_cc_outward_oriented))

View File

@ -575,7 +575,7 @@ public:
std::size_t nb_cc =
Polygon_mesh_processing::connected_components(
tm, bind_property_maps(fid_map, make_property_map(cc_ids)),
tm, compose_property_maps(fid_map, make_property_map(cc_ids)),
parameters::face_index_map(fid_map));
if (nb_cc != 1)
{

View File

@ -43,7 +43,7 @@ bool test_orientation(const TriangleMesh& tm, bool is_positive, const NamedParam
// set the connected component id of each face
std::size_t nb_cc = PMP::connected_components(tm,
CGAL::bind_property_maps(fid_map,CGAL::make_property_map(face_cc)),
CGAL::compose_property_maps(fid_map,CGAL::make_property_map(face_cc)),
CGAL::parameters::face_index_map(fid_map));
// extract a vertex with max z coordinate for each connected component

View File

@ -101,9 +101,149 @@ make_OR_property_map(const PM1& pm1, const PM2& pm2)
return OR_property_map<PM1, PM2>(pm1, pm2);
}
// A property map that uses the result of a property map as key.
#ifdef DOXYGEN_RUNNING
/// \ingroup PkgPropertyMapRef
/// Property map that composes two property maps,
/// that is `get(compose_property_map, k)` returns `get(value_map, get(key_map, k))`.
template <class KeyMap, class ValueMap>
struct Property_map_binder
struct Compose_property_map
{
///< Use the key type of `KeyMap` as keytype
typedef typename boost::property_traits<KeyMap>::key_type key_type;
///< Use the value type of `ValueMap` as value type
typedef typename boost::property_traits<ValueMap>::value_type value_type;
///< Use the reference type of `ValueMap` as reference
typedef typename boost::property_traits<ValueMap>::reference reference;
typedef typename boost::property_traits<ValueMap>::category category;
};
#else
/// \ingroup PkgPropertyMapRef
/// Property map that composes two property maps,
/// that is `get(compose_property_map, k)` returns `get(value_map, get(key_map, k))`.
template <class KeyMap, class ValueMap, class Category = typename boost::property_traits<ValueMap>::category>
struct Compose_property_map;
template <class KeyMap, class ValueMap>
struct Compose_property_map<KeyMap, ValueMap, boost::readable_property_map_tag>
{
typedef typename boost::property_traits<KeyMap>::key_type key_type;
typedef typename boost::property_traits<ValueMap>::value_type value_type;
typedef typename boost::property_traits<ValueMap>::reference reference;
typedef typename boost::property_traits<ValueMap>::category category;
KeyMap key_map;
ValueMap value_map;
Compose_property_map(KeyMap key_map = KeyMap(),
ValueMap value_map = ValueMap())
: key_map(key_map), value_map(value_map)
{}
friend
reference get(Compose_property_map map, const key_type& k)
{
return get(map.value_map, get(map.key_map,k));
}
};
template <class KeyMap, class ValueMap>
struct Compose_property_map<KeyMap, ValueMap, boost::writable_property_map_tag>
{
typedef typename boost::property_traits<KeyMap>::key_type key_type;
typedef typename boost::property_traits<ValueMap>::value_type value_type;
typedef typename boost::property_traits<ValueMap>::reference reference;
typedef typename boost::property_traits<ValueMap>::category category;
KeyMap key_map;
ValueMap value_map;
Compose_property_map(KeyMap key_map = KeyMap(),
ValueMap value_map = ValueMap())
: key_map(key_map), value_map(value_map)
{}
friend
void put(Compose_property_map map, const key_type& k, const value_type& v)
{
put(map.value_map, get(map.key_map,k), v);
}
};
template <class KeyMap, class ValueMap>
struct Compose_property_map<KeyMap, ValueMap, boost::read_write_property_map_tag>
{
typedef typename boost::property_traits<KeyMap>::key_type key_type;
typedef typename boost::property_traits<ValueMap>::value_type value_type;
typedef typename boost::property_traits<ValueMap>::reference reference;
typedef typename boost::property_traits<ValueMap>::category category;
KeyMap key_map;
ValueMap value_map;
Compose_property_map(KeyMap key_map = KeyMap(),
ValueMap value_map = ValueMap())
: key_map(key_map), value_map(value_map)
{}
friend
reference get(Compose_property_map map, const key_type& k)
{
return get(map.value_map, get(map.key_map,k));
}
friend
void put(const Compose_property_map& map, const key_type& k, const value_type& v)
{
put(map.value_map, get(map.key_map,k), v);
}
};
template <class KeyMap, class ValueMap>
struct Compose_property_map<KeyMap, ValueMap, boost::lvalue_property_map_tag>
{
typedef typename boost::property_traits<KeyMap>::key_type key_type;
typedef typename boost::property_traits<ValueMap>::value_type value_type;
typedef typename boost::property_traits<ValueMap>::reference reference;
typedef typename boost::property_traits<ValueMap>::category category;
KeyMap key_map;
ValueMap value_map;
Compose_property_map(KeyMap key_map = KeyMap(),
ValueMap value_map = ValueMap())
: key_map(key_map), value_map(value_map)
{}
friend
reference get(Compose_property_map map, const key_type& k)
{
return get(map.value_map, get(map.key_map,k));
}
friend
void put(Compose_property_map map, key_type k, const value_type& v)
{
put(map.value_map, get(map.key_map,k), v);
}
decltype(auto)
operator[](const key_type& k) const
{
return value_map[get(key_map, k)];
}
};
template <class KeyMap, class ValueMap>
Compose_property_map<KeyMap, ValueMap>
compose_property_maps(const KeyMap& src, const ValueMap& tgt)
{
return Compose_property_map<KeyMap, ValueMap>(src, tgt);
}
#ifndef CGAL_NO_DEPRECATED_CODE
template <class KeyMap, class ValueMap>
struct CGAL_DEPRECATED Property_map_binder
{
typedef typename boost::property_traits<KeyMap>::key_type key_type;
typedef typename boost::property_traits<ValueMap>::value_type value_type;
@ -137,12 +277,14 @@ struct Property_map_binder
};
template <class KeyMap, class ValueMap>
CGAL_DEPRECATED
Property_map_binder<KeyMap, ValueMap>
bind_property_maps(const KeyMap& src, const ValueMap& tgt)
{
return Property_map_binder<KeyMap, ValueMap>(src, tgt);
}
#endif
#endif
/// Property map that accesses a value from an iterator
///

View File

@ -15,9 +15,9 @@ using Vector_2 = typename Kernel::Vector_2;
using Point_with_normal = std::pair<Point_2, Vector_2>;
using Point_set_2 = std::vector<Point_with_normal>;
using Point_map = CGAL::Property_map_binder<CGAL::Pointer_property_map<Point_with_normal>::type,
using Point_map = CGAL::Compose_property_map<CGAL::Pointer_property_map<Point_with_normal>::type,
CGAL::First_of_pair_property_map<Point_with_normal> >;
using Normal_map = CGAL::Property_map_binder<CGAL::Pointer_property_map<Point_with_normal>::type,
using Normal_map = CGAL::Compose_property_map<CGAL::Pointer_property_map<Point_with_normal>::type,
CGAL::Second_of_pair_property_map<Point_with_normal> >;
using Neighbor_query = CGAL::Shape_detection::Point_set::Sphere_neighbor_query<Kernel, std::size_t, Point_map>;

View File

@ -24,9 +24,9 @@ using Vector_2 = typename Kernel::Vector_2;
using Point_with_normal = std::pair<Point_2, Vector_2>;
using Input_range = std::vector<Point_with_normal>;
using Deref_map = CGAL::Dereference_property_map<const Point_with_normal, Input_range::const_iterator>;
using Point_map = CGAL::Property_map_binder<Deref_map,
using Point_map = CGAL::Compose_property_map<Deref_map,
CGAL::First_of_pair_property_map<Point_with_normal>>;
using Normal_map = CGAL::Property_map_binder<Deref_map,
using Normal_map = CGAL::Compose_property_map<Deref_map,
CGAL::Second_of_pair_property_map<Point_with_normal>>;
using Neighbor_query = SD::Point_set::Sphere_neighbor_query<Kernel, Input_range::const_iterator, Point_map>;
using Region_type = SD::Point_set::Least_squares_line_fit_region<Kernel, Input_range::const_iterator, Point_map, Normal_map>;

View File

@ -31,9 +31,9 @@ bool test_region_growing_on_point_set_2(int argc, char *argv[]) {
using Input_range = std::vector<Point_with_normal>;
using Item = typename Input_range::const_iterator;
using Deref_map = CGAL::Dereference_property_map<const Point_with_normal, Item>;
using Point_map = CGAL::Property_map_binder<Deref_map,
using Point_map = CGAL::Compose_property_map<Deref_map,
CGAL::First_of_pair_property_map<Point_with_normal>>;
using Normal_map = CGAL::Property_map_binder<Deref_map,
using Normal_map = CGAL::Compose_property_map<Deref_map,
CGAL::Second_of_pair_property_map<Point_with_normal>>;
using Neighbor_query = SD::Point_set::Sphere_neighbor_query<Kernel, Item, Point_map>;

View File

@ -28,9 +28,9 @@ using Input_range = std::vector<Point_with_normal>;
using Item = Input_range::const_iterator;
using Deref_map = CGAL::Dereference_property_map<const Point_with_normal, Item>;
using Point_map = CGAL::Property_map_binder<Deref_map,
using Point_map = CGAL::Compose_property_map<Deref_map,
CGAL::First_of_pair_property_map<Point_with_normal>>;
using Normal_map = CGAL::Property_map_binder<Deref_map,
using Normal_map = CGAL::Compose_property_map<Deref_map,
CGAL::Second_of_pair_property_map<Point_with_normal>>;
using Neighbor_query = SD::Point_set::Sphere_neighbor_query<Kernel, Item, Point_map>;

View File

@ -49,9 +49,9 @@ bool test_lines_points_with_normals() {
std::vector< std::pair< typename Kernel::Line_2, std::vector<Item> > > regions;
using Deref_map = CGAL::Dereference_property_map<const Point_with_normal, typename Input_range::const_iterator>;
using Point_map = CGAL::Property_map_binder<Deref_map,
using Point_map = CGAL::Compose_property_map<Deref_map,
CGAL::First_of_pair_property_map<Point_with_normal> >;
using Normal_map = CGAL::Property_map_binder<Deref_map,
using Normal_map = CGAL::Compose_property_map<Deref_map,
CGAL::Second_of_pair_property_map<Point_with_normal> >;
using Neighbor_query = CGAL::Shape_detection::Point_set::K_neighbor_query<Kernel, Item, Point_map>;
@ -305,9 +305,9 @@ bool test_planes_points_with_normals() {
std::vector< std::pair< typename Kernel::Plane_3, std::vector<Item> > > regions;
using Deref_map = CGAL::Dereference_property_map<const Point_with_normal, typename Input_range::const_iterator>;
using Point_map = CGAL::Property_map_binder<Deref_map,
using Point_map = CGAL::Compose_property_map<Deref_map,
CGAL::First_of_pair_property_map<Point_with_normal> >;
using Normal_map = CGAL::Property_map_binder<Deref_map,
using Normal_map = CGAL::Compose_property_map<Deref_map,
CGAL::Second_of_pair_property_map<Point_with_normal> >;
using Neighbor_query = CGAL::Shape_detection::Point_set::K_neighbor_query<Kernel, Item, Point_map>;

View File

@ -34,8 +34,8 @@ using Item = Point_set::const_iterator;
using Deref_map = CGAL::Dereference_property_map<const Pwn, Item>;
using Point_map = CGAL::First_of_pair_property_map<Pwn>;
using Normal_map = CGAL::Second_of_pair_property_map<Pwn>;
using RG_Point_map = CGAL::Property_map_binder<Deref_map, Point_map>;
using RG_Normal_map = CGAL::Property_map_binder<Deref_map, Normal_map>;
using RG_Point_map = CGAL::Compose_property_map<Deref_map, Point_map>;
using RG_Normal_map = CGAL::Compose_property_map<Deref_map, Normal_map>;
using RG_query = SD::Point_set::Sphere_neighbor_query<Kernel, Item, RG_Point_map>;
using RG_region = SD::Point_set::Least_squares_plane_fit_region<Kernel, Item, RG_Point_map, RG_Normal_map>;