fix warnings and compilation issues + build maps for no caching case

This commit is contained in:
Sébastien Loriot 2024-04-16 18:22:33 +02:00
parent 7dd2d0be13
commit a933bf3e2e
4 changed files with 13 additions and 7 deletions

View File

@ -24,7 +24,7 @@ struct Projection_xy_point_map {
Projection_xy_point_map() {} Projection_xy_point_map() {}
inline friend value_type get(Self s, key_type p) inline friend value_type get(Self, key_type p)
{ {
return value_type(p.x(), p.y()); return value_type(p.x(), p.y());
} }

View File

@ -28,7 +28,7 @@ typedef CGAL::AABB_tree<Traits_poly> Tree_poly;
typedef Tree_poly::Point_and_primitive_id Point_and_primitive_id_poly; typedef Tree_poly::Point_and_primitive_id Point_and_primitive_id_poly;
template<class AABBTree, class PPId> template<class AABBTree, class PPId>
void test(AABBTree& tree) { void test(AABBTree tree) {
tree.build(); tree.build();
tree.accelerate_distance_queries(); tree.accelerate_distance_queries();
@ -45,6 +45,7 @@ void test(AABBTree& tree) {
std::cerr << "closest point is: " << closest << std::endl; std::cerr << "closest point is: " << closest << std::endl;
PPId id = tree.closest_point_and_primitive(point_query); PPId id = tree.closest_point_and_primitive(point_query);
std::cout << id.first << "\n";
} }

View File

@ -125,7 +125,7 @@ public:
AABB_indexed_triangle_primitive_2(IndexIterator it, PointRange&) : Base(it) {} AABB_indexed_triangle_primitive_2(IndexIterator it, PointRange&) : Base(it) {}
/// \internal /// \internal
static typename Base::Shared_data construct_shared_data(PointRange &range, PointMap &pmap = PointMap()) { static typename Base::Shared_data construct_shared_data(PointRange &range, PointMap pmap = PointMap()) {
return std::make_pair( return std::make_pair(
internal::Triangle_2_from_index_range_iterator_property_map<GeomTraits, IndexIterator, typename PointRange::iterator, PointMap>(range.begin(), pmap), internal::Triangle_2_from_index_range_iterator_property_map<GeomTraits, IndexIterator, typename PointRange::iterator, PointMap>(range.begin(), pmap),
internal::Point_from_indexed_triangle_2_iterator_property_map<GeomTraits, IndexIterator, typename PointRange::iterator, PointMap>(range.begin(), pmap)); internal::Point_from_indexed_triangle_2_iterator_property_map<GeomTraits, IndexIterator, typename PointRange::iterator, PointMap>(range.begin(), pmap));

View File

@ -87,7 +87,7 @@ namespace internal {
* It also provides the functor `Construct_segment_2` that has an operator taking two `Point_2` * It also provides the functor `Construct_segment_2` that has an operator taking two `Point_2`
* and returning a `Segment_2`. * and returning a `Segment_2`.
* \tparam Iterator is a model of `ForwardIterator` whose value type is convertible to `GeomTraits::Point_2` * \tparam Iterator is a model of `ForwardIterator` whose value type is convertible to `GeomTraits::Point_2`
* \tparam PointRange is a model of `ConstRange` whose iterator is a model of `ForwardIterator`. Its value type needs to be compatible to PointMap or `Point_2` in the default case. * \tparam PointRange is a model of `ConstRange` whose iterator is a model of `ForwardIterator`. Its value type needs to be the key type of `PointMap`.
* \tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case, * \tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case,
* the datum is stored in the primitive, while in the latter it is * the datum is stored in the primitive, while in the latter it is
* constructed on the fly to reduce the memory footprint. * constructed on the fly to reduce the memory footprint.
@ -118,13 +118,18 @@ class AABB_polyline_segment_primitive_2
CacheDatum > CacheDatum >
#endif #endif
{ {
typedef internal::Segment_2_from_point_iterator_property_map<GeomTraits, Iterator, PointMap> Segment_map;
typedef internal::Point_from_iterator_property_map<GeomTraits, Iterator, PointMap> Point_primitive_map;
typedef AABB_primitive< Iterator, typedef AABB_primitive< Iterator,
internal::Segment_2_from_point_iterator_property_map<GeomTraits, Iterator, PointMap>, Segment_map,
internal::Point_from_iterator_property_map<GeomTraits, Iterator, PointMap>, Point_primitive_map,
Tag_true, Tag_true,
CacheDatum > Base; CacheDatum > Base;
public: public:
AABB_polyline_segment_primitive_2(Iterator it, PointRange& poly) : Base(it) {} AABB_polyline_segment_primitive_2(Iterator it, PointRange& poly, PointMap pmap = PointMap())
: Base(it,Segment_map(poly.begin(), poly.end(), pmap), Point_primitive_map(pmap))
{}
/// \internal /// \internal
static typename Base::Shared_data construct_shared_data(PointRange& range, PointMap pmap = PointMap()) { static typename Base::Shared_data construct_shared_data(PointRange& range, PointMap pmap = PointMap()) {