From a933bf3e2e9ae65175432f80423c6dd9e25c088a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 16 Apr 2024 18:22:33 +0200 Subject: [PATCH] fix warnings and compilation issues + build maps for no caching case --- .../AABB_tree/AABB_indexed_triangle_2_example.cpp | 2 +- .../AABB_tree/AABB_polyline_segment_2_example.cpp | 3 ++- .../CGAL/AABB_indexed_triangle_primitive_2.h | 2 +- .../CGAL/AABB_polyline_segment_primitive_2.h | 13 +++++++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/AABB_tree/examples/AABB_tree/AABB_indexed_triangle_2_example.cpp b/AABB_tree/examples/AABB_tree/AABB_indexed_triangle_2_example.cpp index 4d60dc884f4..c8979d6ae95 100644 --- a/AABB_tree/examples/AABB_tree/AABB_indexed_triangle_2_example.cpp +++ b/AABB_tree/examples/AABB_tree/AABB_indexed_triangle_2_example.cpp @@ -24,7 +24,7 @@ struct 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()); } diff --git a/AABB_tree/examples/AABB_tree/AABB_polyline_segment_2_example.cpp b/AABB_tree/examples/AABB_tree/AABB_polyline_segment_2_example.cpp index 52ac14b1153..fa2c2d35857 100644 --- a/AABB_tree/examples/AABB_tree/AABB_polyline_segment_2_example.cpp +++ b/AABB_tree/examples/AABB_tree/AABB_polyline_segment_2_example.cpp @@ -28,7 +28,7 @@ typedef CGAL::AABB_tree Tree_poly; typedef Tree_poly::Point_and_primitive_id Point_and_primitive_id_poly; template -void test(AABBTree& tree) { +void test(AABBTree tree) { tree.build(); tree.accelerate_distance_queries(); @@ -45,6 +45,7 @@ void test(AABBTree& tree) { std::cerr << "closest point is: " << closest << std::endl; PPId id = tree.closest_point_and_primitive(point_query); + std::cout << id.first << "\n"; } diff --git a/AABB_tree/include/CGAL/AABB_indexed_triangle_primitive_2.h b/AABB_tree/include/CGAL/AABB_indexed_triangle_primitive_2.h index 8c1a5848b5f..71d1c561db5 100644 --- a/AABB_tree/include/CGAL/AABB_indexed_triangle_primitive_2.h +++ b/AABB_tree/include/CGAL/AABB_indexed_triangle_primitive_2.h @@ -125,7 +125,7 @@ public: AABB_indexed_triangle_primitive_2(IndexIterator it, PointRange&) : Base(it) {} /// \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( internal::Triangle_2_from_index_range_iterator_property_map(range.begin(), pmap), internal::Point_from_indexed_triangle_2_iterator_property_map(range.begin(), pmap)); diff --git a/AABB_tree/include/CGAL/AABB_polyline_segment_primitive_2.h b/AABB_tree/include/CGAL/AABB_polyline_segment_primitive_2.h index 38a47e6b901..ec8e46e1468 100644 --- a/AABB_tree/include/CGAL/AABB_polyline_segment_primitive_2.h +++ b/AABB_tree/include/CGAL/AABB_polyline_segment_primitive_2.h @@ -87,7 +87,7 @@ namespace internal { * It also provides the functor `Construct_segment_2` that has an operator taking two `Point_2` * and returning a `Segment_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, * the datum is stored in the primitive, while in the latter it is * constructed on the fly to reduce the memory footprint. @@ -118,13 +118,18 @@ class AABB_polyline_segment_primitive_2 CacheDatum > #endif { + typedef internal::Segment_2_from_point_iterator_property_map Segment_map; + typedef internal::Point_from_iterator_property_map Point_primitive_map; typedef AABB_primitive< Iterator, - internal::Segment_2_from_point_iterator_property_map, - internal::Point_from_iterator_property_map, + Segment_map, + Point_primitive_map, Tag_true, CacheDatum > Base; + 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 static typename Base::Shared_data construct_shared_data(PointRange& range, PointMap pmap = PointMap()) {