diff options
Diffstat (limited to 'boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp')
-rw-r--r-- | boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp b/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp index c794a64267..a0635acab1 100644 --- a/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp +++ b/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp @@ -5,6 +5,10 @@ // Copyright (c) 2008 Federico J. Fernandez. // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // +// This file was modified by Oracle on 2019. +// Modifications copyright (c) 2019 Oracle and/or its affiliates. +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle +// // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -15,6 +19,7 @@ #include <boost/core/ignore_unused.hpp> #include <boost/type_traits/is_unsigned.hpp> +#include <boost/geometry/index/detail/algorithms/bounds.hpp> #include <boost/geometry/index/detail/algorithms/content.hpp> #include <boost/geometry/index/detail/bounded_view.hpp> @@ -90,7 +95,11 @@ struct find_greatest_normalized_separation typedef typename geometry::point_type<indexable_type>::type point_type; typedef geometry::model::box<point_type> bounds_type; - typedef index::detail::bounded_view<indexable_type, bounds_type> bounded_view_type; + typedef index::detail::bounded_view + < + indexable_type, bounds_type, + typename index::detail::strategy_type<Parameters>::type + > bounded_view_type; static inline void apply(Elements const& elements, Parameters const& parameters, @@ -103,8 +112,12 @@ struct find_greatest_normalized_separation BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == elements_count, "unexpected number of elements"); BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "unexpected number of elements"); + typename index::detail::strategy_type<Parameters>::type const& + strategy = index::detail::get_strategy(parameters); + // find the lowest low, highest high - bounded_view_type bounded_indexable_0(rtree::element_indexable(elements[0], translator)); + bounded_view_type bounded_indexable_0(rtree::element_indexable(elements[0], translator), + strategy); coordinate_type lowest_low = geometry::get<min_corner, DimensionIndex>(bounded_indexable_0); coordinate_type highest_high = geometry::get<max_corner, DimensionIndex>(bounded_indexable_0); @@ -113,7 +126,8 @@ struct find_greatest_normalized_separation size_t lowest_high_index = 0; for ( size_t i = 1 ; i < elements_count ; ++i ) { - bounded_view_type bounded_indexable(rtree::element_indexable(elements[i], translator)); + bounded_view_type bounded_indexable(rtree::element_indexable(elements[i], translator), + strategy); coordinate_type min_coord = geometry::get<min_corner, DimensionIndex>(bounded_indexable); coordinate_type max_coord = geometry::get<max_corner, DimensionIndex>(bounded_indexable); @@ -132,11 +146,13 @@ struct find_greatest_normalized_separation // find the highest low size_t highest_low_index = lowest_high_index == 0 ? 1 : 0; - bounded_view_type bounded_indexable_hl(rtree::element_indexable(elements[highest_low_index], translator)); + bounded_view_type bounded_indexable_hl(rtree::element_indexable(elements[highest_low_index], translator), + strategy); coordinate_type highest_low = geometry::get<min_corner, DimensionIndex>(bounded_indexable_hl); for ( size_t i = highest_low_index ; i < elements_count ; ++i ) { - bounded_view_type bounded_indexable(rtree::element_indexable(elements[i], translator)); + bounded_view_type bounded_indexable(rtree::element_indexable(elements[i], translator), + strategy); coordinate_type min_coord = geometry::get<min_corner, DimensionIndex>(bounded_indexable); if ( highest_low < min_coord && i != lowest_high_index ) @@ -329,6 +345,9 @@ struct redistribute_elements<Value, Options, Translator, Box, Allocators, linear typedef typename rtree::element_indexable_type<element_type, Translator>::type indexable_type; typedef typename index::detail::default_content_result<Box>::type content_type; + typename index::detail::strategy_type<parameters_type>::type const& + strategy = index::detail::get_strategy(parameters); + elements_type & elements1 = rtree::elements(n); elements_type & elements2 = rtree::elements(second_node); const size_t elements1_count = parameters.get_max_elements() + 1; @@ -357,8 +376,10 @@ struct redistribute_elements<Value, Options, Translator, Box, Allocators, linear elements2.push_back(elements_copy[seed2]); // MAY THROW, STRONG (alloc, copy) // calculate boxes - detail::bounds(rtree::element_indexable(elements_copy[seed1], translator), box1); - detail::bounds(rtree::element_indexable(elements_copy[seed2], translator), box2); + detail::bounds(rtree::element_indexable(elements_copy[seed1], translator), + box1, strategy); + detail::bounds(rtree::element_indexable(elements_copy[seed2], translator), + box2, strategy); // initialize areas content_type content1 = index::detail::content(box1); @@ -380,13 +401,13 @@ struct redistribute_elements<Value, Options, Translator, Box, Allocators, linear if ( elements1.size() + remaining <= parameters.get_min_elements() ) { elements1.push_back(elem); // MAY THROW, STRONG (copy) - geometry::expand(box1, indexable); + index::detail::expand(box1, indexable, strategy); content1 = index::detail::content(box1); } else if ( elements2.size() + remaining <= parameters.get_min_elements() ) { elements2.push_back(elem); // MAY THROW, STRONG (alloc, copy) - geometry::expand(box2, indexable); + index::detail::expand(box2, indexable, strategy); content2 = index::detail::content(box2); } // choose better node and insert element @@ -395,8 +416,8 @@ struct redistribute_elements<Value, Options, Translator, Box, Allocators, linear // calculate enlarged boxes and areas Box enlarged_box1(box1); Box enlarged_box2(box2); - geometry::expand(enlarged_box1, indexable); - geometry::expand(enlarged_box2, indexable); + index::detail::expand(enlarged_box1, indexable, strategy); + index::detail::expand(enlarged_box2, indexable, strategy); content_type enlarged_content1 = index::detail::content(enlarged_box1); content_type enlarged_content2 = index::detail::content(enlarged_box2); |