diff --git a/BGL/include/CGAL/boost/graph/copy_face_graph.h b/BGL/include/CGAL/boost/graph/copy_face_graph.h index 5a7e1712a4a..353bea959e5 100644 --- a/BGL/include/CGAL/boost/graph/copy_face_graph.h +++ b/BGL/include/CGAL/boost/graph/copy_face_graph.h @@ -188,8 +188,8 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, get(boost::halfedge_index, sm)); copy_face_graph_impl(sm, tm, - Corefinement::bind_maps(get(boost::halfedge_index, sm), - make_property_map(hedges)), + bind_property_maps(get(boost::halfedge_index, sm), + make_property_map(hedges)), v2v, h2h, f2f, sm_vpm, tm_vpm); } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h index 2612ce4e520..fde6bd1557c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h @@ -171,7 +171,7 @@ bool does_bound_a_volume(const TriangleMesh& tm, const NamedParameters& np) // set the connected component id of each face std::size_t nb_cc = connected_components(tm, - Corefinement::bind_maps(fid_map,make_property_map(face_cc)), + bind_property_maps(fid_map,make_property_map(face_cc)), parameters::face_index_map(fid_map)); if (nb_cc == 1) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index e93685bab09..2589666151d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -497,7 +497,7 @@ public: Border_edge_map is_marked_1(intersection_edges1, tm1); std::size_t nb_patches_tm1 = PMP::connected_components(tm1, - bind_maps(fids1,make_property_map(&tm1_patch_ids[0])), + bind_property_maps(fids1,make_property_map(&tm1_patch_ids[0])), params::edge_is_constrained_map( is_marked_1) .face_index_map(fids1)); @@ -511,7 +511,7 @@ public: Border_edge_map is_marked_2(intersection_edges2, tm2); std::size_t nb_patches_tm2 = PMP::connected_components(tm2, - bind_maps(fids2,make_property_map(&tm2_patch_ids[0])), + bind_property_maps(fids2,make_property_map(&tm2_patch_ids[0])), params::edge_is_constrained_map( is_marked_2) .face_index_map(fids2)); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h index ed748c0c06e..662be7c9672 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h @@ -383,41 +383,6 @@ triangulate_a_face( } } - -template -struct Map_binder{ - typedef typename boost::property_traits::key_type key_type; - typedef typename boost::property_traits::value_type value_type; - typedef typename boost::property_traits::reference reference; - typedef boost::read_write_property_map_tag category; - - KeyMap key_map; - ValueMap value_map; - - Map_binder(const KeyMap& key_map, const ValueMap& value_map) - : key_map(key_map) - , value_map(value_map) - {} - - friend - reference get(const Map_binder& map, key_type k) - { - return get(map.value_map, get(map.key_map,k)); - } - friend - void put(const Map_binder& map, key_type k, const value_type& v) - { - put(map.value_map, get(map.key_map,k), v); - } -}; - -template -Map_binder -bind_maps(const KeyMap& src, const ValueMap& tgt) -{ - return Map_binder(src, tgt); -} - template class Border_edge_map { typedef std::size_t Node_id; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/clip.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/clip.h index 80922c497e7..4f3d7277954 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/clip.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/clip.h @@ -75,7 +75,7 @@ clip_open_impl( TriangleMesh& tm, std::vector face_cc(num_faces(tm), std::size_t(-1)); std::size_t nb_cc = connected_components(tm, - Corefinement::bind_maps(fid_map, make_property_map(face_cc)), + bind_property_maps(fid_map, make_property_map(face_cc)), parameters::face_index_map(fid_map). edge_is_constrained_map(ecm)); @@ -118,7 +118,7 @@ clip_open_impl( TriangleMesh& tm, //now remove the cc remove_connected_components(tm, ccs_to_remove, - Corefinement::bind_maps(fid_map, make_property_map(face_cc)), + bind_property_maps(fid_map, make_property_map(face_cc)), np_tm); return true; diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 071a86581ba..6691edc100b 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -72,6 +72,42 @@ class OR_property_map { }; +// A property map that uses the result of a property map as key. +template +struct Property_map_binder{ + typedef typename boost::property_traits::key_type key_type; + typedef typename boost::property_traits::value_type value_type; + typedef typename boost::property_traits::reference reference; + typedef boost::read_write_property_map_tag category; + + KeyMap key_map; + ValueMap value_map; + + Property_map_binder(const KeyMap& key_map, const ValueMap& value_map) + : key_map(key_map) + , value_map(value_map) + {} + + friend + reference get(const Property_map_binder& map, key_type k) + { + return get(map.value_map, get(map.key_map,k)); + } + friend + void put(const Property_map_binder& map, key_type k, const value_type& v) + { + put(map.value_map, get(map.key_map,k), v); + } +}; + +template +Property_map_binder +bind_property_maps(const KeyMap& src, const ValueMap& tgt) +{ + return Property_map_binder(src, tgt); +} + + /// Property map that accesses a value from an iterator /// /// \cgalModels `ReadablePropertyMap`