From 34be8fbad5bad66c6dffaed7672a1a3610eb10f7 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 27 Jun 2012 13:45:10 +0000 Subject: [PATCH] removed doubled algorithm index::overlap(). [SVN r79137] --- .../extensions/index/algorithms/overlap.hpp | 35 ------------------- .../index/rtree/rstar/choose_next_node.hpp | 27 +++++++------- test/algorithms/intersection_content.cpp | 3 -- test/algorithms/test_intersection_content.hpp | 4 --- 4 files changed, 13 insertions(+), 56 deletions(-) delete mode 100644 include/boost/geometry/extensions/index/algorithms/overlap.hpp diff --git a/include/boost/geometry/extensions/index/algorithms/overlap.hpp b/include/boost/geometry/extensions/index/algorithms/overlap.hpp deleted file mode 100644 index ce0e0a260..000000000 --- a/include/boost/geometry/extensions/index/algorithms/overlap.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Boost.SpatialIndex - n-dimensional area/volume of boxes intersecion/overlap -// -// Copyright 2011 Adam Wulkiewicz. -// 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) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP -#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP - -#include -#include - -namespace boost { namespace geometry { namespace index { - -template -struct default_overlap_result -{ - typedef typename default_area_result::type type; -}; - -template -typename default_overlap_result::type overlap(Box const& b1, Box const& b2) -{ - Box inters; - geometry::assign_zero(inters); - geometry::intersection(b1, b2, inters); - return index::content(inters); -} - -}}} // namespace boost::geometry::index - -#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_OVERLAP_HPP diff --git a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp index caf86f030..1c781ea82 100644 --- a/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp +++ b/include/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include @@ -40,7 +40,6 @@ class choose_next_node::type content_type; - typedef typename index::default_overlap_result::type overlap_type; public: template @@ -70,7 +69,7 @@ private: // choose index with smallest overlap change value, or content change or smallest content size_t choosen_index = 0; - overlap_type smallest_overlap_diff = std::numeric_limits::max(); + content_type smallest_overlap_diff = std::numeric_limits::max(); content_type smallest_content_diff = std::numeric_limits::max(); content_type smallest_content = std::numeric_limits::max(); @@ -87,8 +86,8 @@ private: content_type content = index::content(ch_i.first); content_type content_diff = index::content(box_exp) - content; - overlap_type overlap = 0; - overlap_type overlap_exp = 0; + content_type overlap = 0; + content_type overlap_exp = 0; // calculate overlap for ( size_t j = 0 ; j < children_count ; ++j ) @@ -97,12 +96,12 @@ private: { child_type const& ch_j = children[j]; - overlap += index::overlap(ch_i.first, ch_j.first); - overlap_exp += index::overlap(box_exp, ch_j.first); + overlap += index::intersection_content(ch_i.first, ch_j.first); + overlap_exp += index::intersection_content(box_exp, ch_j.first); } } - overlap_type overlap_diff = overlap_exp - overlap; + content_type overlap_diff = overlap_exp - overlap; // update result if ( overlap_diff < smallest_overlap_diff || @@ -148,7 +147,7 @@ private: // for overlap_cost_threshold child nodes find the one with smallest overlap value size_t choosen_index = 0; - overlap_type smallest_overlap_diff = std::numeric_limits::max(); + content_type smallest_overlap_diff = std::numeric_limits::max(); // for each node for (size_t i = 0 ; i < parameters_type::overlap_cost_threshold ; ++i ) @@ -162,8 +161,8 @@ private: // calculate expanded box of child node ch_i geometry::expand(box_exp, indexable); - overlap_type overlap = 0; - overlap_type overlap_exp = 0; + content_type overlap = 0; + content_type overlap_exp = 0; // calculate overlap for ( size_t j = 0 ; j < children_count ; ++j ) @@ -172,12 +171,12 @@ private: { child_type const& ch_j = children[j]; - overlap += index::overlap(ch_i.first, ch_j.first); - overlap_exp += index::overlap(box_exp, ch_j.first); + overlap += index::intersection_content(ch_i.first, ch_j.first); + overlap_exp += index::intersection_content(box_exp, ch_j.first); } } - overlap_type overlap_diff = overlap_exp - overlap; + content_type overlap_diff = overlap_exp - overlap; // update result if ( overlap_diff < smallest_overlap_diff ) diff --git a/test/algorithms/intersection_content.cpp b/test/algorithms/intersection_content.cpp index 07f427c12..864276d2b 100644 --- a/test/algorithms/intersection_content.cpp +++ b/test/algorithms/intersection_content.cpp @@ -40,9 +40,6 @@ void test_large_integers() double double_value = bgi::intersection_content(double_box1, double_box2); BOOST_CHECK_CLOSE(int_value, double_value, 0.0001); - - // temp - BOOST_CHECK_CLOSE(bgi::overlap(int_box1, int_box2), bgi::overlap(double_box1, double_box2), 0.0001); } int test_main(int, char* []) diff --git a/test/algorithms/test_intersection_content.hpp b/test/algorithms/test_intersection_content.hpp index 415acfa61..c07ff6ee8 100644 --- a/test/algorithms/test_intersection_content.hpp +++ b/test/algorithms/test_intersection_content.hpp @@ -14,7 +14,6 @@ #include #include -#include template void test_intersection_content(Geometry const& geometry1, Geometry const& geometry2, @@ -34,9 +33,6 @@ void test_intersection_content(Geometry const& geometry1, Geometry const& geomet #endif BOOST_CHECK_CLOSE(value, expected_value, 0.0001); - - // temp - BOOST_CHECK_CLOSE(bgi::overlap(geometry1, geometry2), expected_value, 0.0001); } template