clean up doc and API of new property maps

This commit is contained in:
Sébastien Loriot 2023-02-06 18:32:41 +01:00
parent e78a8ed293
commit dbccebf7df
8 changed files with 46 additions and 45 deletions

View File

@ -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<VIM, typename Pointer_property_map<typename boost::property_traits<VIM>::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<HIM, typename Pointer_property_map<typename boost::property_traits<HIM>::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

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,
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<TriangleMesh> 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));

View File

@ -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])));
}
};

View File

@ -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));

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,
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))

View File

@ -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)
{

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::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

View File

@ -102,10 +102,29 @@ make_OR_property_map(const PM1& pm1, const PM2& pm2)
return OR_property_map<PM1, PM2>(pm1, pm2);
}
/// Property map that accesses a value from an iterator
///
/// \cgalModels `ReadablePropertyMap`
///
/// \tparam InputIterator an input iterator
/// \endcond
template<class InputIterator>
struct Input_iterator_property_map{
typedef InputIterator key_type;
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
typedef typename std::iterator_traits<InputIterator>::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<InputIterator>, 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 <class KeyMap, class ValueMap>
struct Compose_property_map
{
@ -115,16 +134,17 @@ struct Compose_property_map
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;
///< Use the category of the `ValueMap`
typedef typename boost::property_traits<ValueMap>::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 <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>
{
@ -254,35 +274,16 @@ struct Compose_property_map<KeyMap, ValueMap, boost::lvalue_property_map_tag>
return value_map[get(key_map, k)];
}
};
#endif
/// \ingroup PkgPropertyMapRef
/// \relates Compose_property_map
/// returns `Compose_property_maps<KeyMap, ValueMap>(km,vm)`
template <class KeyMap, class ValueMap>
Compose_property_map<KeyMap, ValueMap>
make_compose_property_maps(const KeyMap& km, const ValueMap& vm)
make_compose_property_map(const KeyMap& km, const ValueMap& vm)
{
return Compose_property_map<KeyMap, ValueMap>(km, vm);
}
#endif
/// Property map that accesses a value from an iterator
///
/// \cgalModels `ReadablePropertyMap`
///
/// \tparam InputIterator an input iterator
/// \endcond
template<class InputIterator>
struct Input_iterator_property_map{
typedef InputIterator key_type;
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
typedef typename std::iterator_traits<InputIterator>::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<InputIterator>, 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<typename Container>
class Random_access_property_map
{
using Iterator = std::conditional_t<std::is_const<Container>::value,
typename Container::const_iterator,
typename Container::iterator>;
Container& m_container;
public:
using Iterator = std::conditional_t<std::is_const<Container>::value,
typename Container::const_iterator,
typename Container::iterator>;
typedef std::size_t key_type;
typedef typename std::iterator_traits<Iterator>::value_type value_type;
typedef typename std::iterator_traits<Iterator>::reference reference;
@ -767,6 +767,7 @@ public:
};
/// \ingroup PkgPropertyMapRef
/// \relates Random_access_property_map
/// returns `Random_access_property_map<Container>(container)`
template <class Container>
Random_access_property_map<Container>