diff --git a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h index 82dc656f775..e1e9f6f0a6f 100644 --- a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h +++ b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h @@ -594,7 +594,7 @@ struct Face_filtered_graph is_imap_in_use.set(0); initialize_face_indices(); - return make_compose_property_maps(fimap, make_property_map(face_indices)); + return make_compose_property_map(fimap, make_property_map(face_indices)); } Compose_property_map::value_type>::type> @@ -603,7 +603,7 @@ struct Face_filtered_graph is_imap_in_use.set(1); initialize_vertex_indices(); - return make_compose_property_maps(vimap, make_property_map(vertex_indices) ); + return make_compose_property_map(vimap, make_property_map(vertex_indices) ); } Compose_property_map::value_type >::type> @@ -612,7 +612,7 @@ struct Face_filtered_graph is_imap_in_use.set(2); initialize_halfedge_indices(); - return make_compose_property_maps(himap, make_property_map(halfedge_indices) ); + return make_compose_property_map(himap, make_property_map(halfedge_indices) ); } /// returns `true` if around any vertex of a selected face there is at most a single umbrella 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 e98897c800e..51eddafa71b 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 @@ -707,7 +707,7 @@ public: Border_edge_map is_marked_1(intersection_edges1, tm1); std::size_t nb_patches_tm1 = connected_components(tm1, - make_compose_property_maps(fids1,make_property_map(&tm1_patch_ids[0])), + make_compose_property_map(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 is_marked_2(intersection_edges2, tm2); std::size_t nb_patches_tm2 = connected_components(tm2, - make_compose_property_maps(fids2,make_property_map(&tm2_patch_ids[0])), + make_compose_property_map(fids2,make_property_map(&tm2_patch_ids[0])), parameters::edge_is_constrained_map(is_marked_2) .face_index_map(fids2)); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Generic_clip_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Generic_clip_output_builder.h index 7f39377094a..e4e658a49b5 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Generic_clip_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Generic_clip_output_builder.h @@ -148,7 +148,7 @@ public: std::size_t nb_patches_tm1 = connected_components(tm1, - make_compose_property_maps(fids1,make_property_map(&tm1_patch_ids[0])), + make_compose_property_map(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, make_compose_property_maps(fids1,make_property_map(&tm1_patch_ids[0]))); + keep_connected_components(tm1, cc_to_keep, make_compose_property_map(fids1,make_property_map(&tm1_patch_ids[0]))); } }; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Output_builder_for_autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Output_builder_for_autorefinement.h index d539f3c1170..b130a2d1612 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Output_builder_for_autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Output_builder_for_autorefinement.h @@ -349,7 +349,7 @@ public: is_intersection(intersection_edges); std::size_t nb_patches = connected_components(tm, - make_compose_property_maps(fids,make_property_map(patch_ids)), + make_compose_property_map(fids,make_property_map(patch_ids)), parameters::edge_is_constrained_map(is_intersection) .face_index_map(fids)); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h index 31de7f4f4de..39bc892457d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h @@ -434,7 +434,7 @@ void orient(TriangleMesh& tm, // set the connected component id of each face std::size_t nb_cc = connected_components(tm, - make_compose_property_maps(fid_map,make_property_map(face_cc)), + make_compose_property_map(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, - make_compose_property_maps(fid_map,make_property_map(face_cc)), + make_compose_property_map(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(make_compose_property_maps(fid_map,make_property_map(face_cc))) + .face_connected_component_map(make_compose_property_map(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)) diff --git a/Polygon_mesh_processing/include/CGAL/Rigid_triangle_mesh_collision_detection.h b/Polygon_mesh_processing/include/CGAL/Rigid_triangle_mesh_collision_detection.h index 5cfaad6d233..c1dc5258aca 100644 --- a/Polygon_mesh_processing/include/CGAL/Rigid_triangle_mesh_collision_detection.h +++ b/Polygon_mesh_processing/include/CGAL/Rigid_triangle_mesh_collision_detection.h @@ -575,7 +575,7 @@ public: std::size_t nb_cc = Polygon_mesh_processing::connected_components( - tm, make_compose_property_maps(fid_map, make_property_map(cc_ids)), + tm, make_compose_property_map(fid_map, make_property_map(cc_ids)), parameters::face_index_map(fid_map)); if (nb_cc != 1) { diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_orient_cc.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_orient_cc.cpp index ed84c5bc407..827e169310b 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_orient_cc.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_orient_cc.cpp @@ -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::make_compose_property_maps(fid_map,CGAL::make_property_map(face_cc)), + CGAL::make_compose_property_map(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 diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 447ee134c3a..270c0578f51 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -102,10 +102,29 @@ make_OR_property_map(const PM1& pm1, const PM2& pm2) return OR_property_map(pm1, pm2); } +/// Property map that accesses a value from an iterator +/// +/// \cgalModels `ReadablePropertyMap` +/// +/// \tparam InputIterator an input iterator +/// \endcond +template +struct Input_iterator_property_map{ + typedef InputIterator key_type; + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::reference reference; + typedef boost::readable_property_map_tag category; + + /// Free function to use a get the value from an iterator using Input_iterator_property_map. + inline friend + reference + get(Input_iterator_property_map, const InputIterator& it){ return *it; } +}; + #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))`. +/// that is a call on an instance `Compose_property_map compose_property_map(key_map, value_map)` of `get(compose_property_map, k)` returns `get(value_map, get(key_map, k))`. template struct Compose_property_map { @@ -115,16 +134,17 @@ struct Compose_property_map typedef typename boost::property_traits::value_type value_type; ///< Use the reference type of `ValueMap` as reference typedef typename boost::property_traits::reference reference; + ///< Use the category of the `ValueMap` typedef typename boost::property_traits::category category; + + /// Constructor + Compose_property_map(KeyMap key_map = KeyMap(), + ValueMap value_map = ValueMap()); }; #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 ::category> struct Compose_property_map; - template struct Compose_property_map { @@ -254,35 +274,16 @@ struct Compose_property_map return value_map[get(key_map, k)]; } }; - +#endif /// \ingroup PkgPropertyMapRef +/// \relates Compose_property_map /// returns `Compose_property_maps(km,vm)` template Compose_property_map -make_compose_property_maps(const KeyMap& km, const ValueMap& vm) +make_compose_property_map(const KeyMap& km, const ValueMap& vm) { return Compose_property_map(km, vm); } -#endif - -/// Property map that accesses a value from an iterator -/// -/// \cgalModels `ReadablePropertyMap` -/// -/// \tparam InputIterator an input iterator -/// \endcond -template -struct Input_iterator_property_map{ - typedef InputIterator key_type; - typedef typename std::iterator_traits::value_type value_type; - typedef typename std::iterator_traits::reference reference; - typedef boost::readable_property_map_tag category; - - /// Free function to use a get the value from an iterator using Input_iterator_property_map. - inline friend - reference - get(Input_iterator_property_map, const InputIterator& it){ return *it; } -}; /// \ingroup PkgPropertyMapRef /// Property map that converts a `T*` pointer (or in general an iterator @@ -727,17 +728,16 @@ make_cartesian_converter_property_map(Vpm vpm) /// \ingroup PkgPropertyMapRef /// A property map with `std::size_t` as key-type that can be used /// to access the i'th element in a container with random access. -/// \cgalModels `LvaluePropertyMap` +/// \cgalModels `LvaluePropertyMap`, constness being than of `Container`. template class Random_access_property_map { - using Iterator = std::conditional_t::value, - typename Container::const_iterator, - typename Container::iterator>; - Container& m_container; public: + using Iterator = std::conditional_t::value, + typename Container::const_iterator, + typename Container::iterator>; typedef std::size_t key_type; typedef typename std::iterator_traits::value_type value_type; typedef typename std::iterator_traits::reference reference; @@ -767,6 +767,7 @@ public: }; /// \ingroup PkgPropertyMapRef +/// \relates Random_access_property_map /// returns `Random_access_property_map(container)` template Random_access_property_map