Merge branch 'develop' into feature/gc3

This commit is contained in:
Adam Wulkiewicz 2021-08-23 00:59:27 +02:00
commit 4b72c60ecf
193 changed files with 2377 additions and 2278 deletions

View File

@ -19,6 +19,33 @@
[section:release_notes Release Notes]
[/=================]
[heading Boost 1.77]
[/=================]
[*Improvements]
* [@https://github.com/boostorg/geometry/pull/812 812] Umbrella strategies for distance and comparable_distance (undocumented for now).
* [@https://github.com/boostorg/geometry/pull/840 840] Umbrella strategies for various algorithms (undocumented for now).
* [@https://github.com/boostorg/geometry/pull/850 850] Introduced DynamicGeometry and GeometryCollection concepts and support in some algorithms (undocumented for now).
* [@https://github.com/boostorg/geometry/pull/855 855] Various improvements related to strategies. Default strategies are now included with algorithms.
[*Solved issues]
* [@https://github.com/boostorg/geometry/issues/865 865] Exception thrown in rtree serialization.
* [@https://github.com/boostorg/geometry/issues/439 439] Invalid box spherical area computation.
* [@https://github.com/boostorg/geometry/issues/838 838] Invalid result of union_().
* [@https://github.com/boostorg/geometry/issues/851 851] Invalid geographic disjoint segment/box result.
* [@https://github.com/boostorg/geometry/issues/861 861] Invalid result of intersection().
[*Bugfixes]
* [@https://github.com/boostorg/geometry/pull/832 832] Fixed box spherical and geographic area computation.
* [@https://github.com/boostorg/geometry/pull/853 853] Fixed geographic disjoint segment/box.
* [@https://github.com/boostorg/geometry/pull/866 866] Fixed serialization of rtree containing lesser number of elements in root node than minimum.
* [@https://github.com/boostorg/geometry/pull/886 886] Fixed knn rtree query bug causing it to be slow for big k.
* Various fixes in set operations and buffer.
[/=================]
[heading Boost 1.76]
[/=================]

View File

@ -32,7 +32,7 @@ int main()
// if the invalidity is only due to lack of closing points and/or wrongly oriented rings, then bg::correct can fix it
bool could_be_fixed = (failure == boost::geometry::failure_not_closed
|| boost::geometry::failure_wrong_orientation);
|| failure == boost::geometry::failure_wrong_orientation);
std::cout << "is valid? " << (valid ? "yes" : "no") << std::endl;
if (! valid)
{

View File

@ -23,6 +23,8 @@
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/azimuth/cartesian.hpp>
#include <boost/geometry/strategies/azimuth/geographic.hpp>

View File

@ -5,9 +5,8 @@
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2013-2020.
// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates.
// This file was modified by Oracle on 2013-2021.
// Modifications copyright (c) 2013-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@ -25,9 +24,7 @@
#include <boost/geometry/algorithms/dispatch/disjoint.hpp>
// For backward compatibility
#include <boost/geometry/strategies/cartesian/disjoint_box_box.hpp>
#include <boost/geometry/strategies/spherical/disjoint_box_box.hpp>
#include <boost/geometry/strategies/detail.hpp>
namespace boost { namespace geometry
{

View File

@ -5,9 +5,8 @@
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland
// This file was modified by Oracle on 2013-2020.
// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates.
// This file was modified by Oracle on 2013-2021.
// Modifications copyright (c) 2013-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@ -23,12 +22,13 @@
#include <cstddef>
#include <boost/geometry/algorithms/dispatch/disjoint.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/algorithms/dispatch/disjoint.hpp>
#include <boost/geometry/strategies/disjoint.hpp>
#include <boost/geometry/strategies/detail.hpp>
namespace boost { namespace geometry
{

View File

@ -26,8 +26,7 @@ struct is_self_turn_check
template <typename Turn>
static inline bool apply(Turn const& turn)
{
return turn.operations[0].seg_id.source_index
== turn.operations[1].seg_id.source_index;
return turn.is_self();
}
};

View File

@ -621,31 +621,32 @@ public :
return m_turns[rp.turn_index].operations[rp.operation_index];
}
inline sort_by_side::rank_type select_rank(sbs_type const& sbs,
bool skip_isolated) const
inline sort_by_side::rank_type select_rank(sbs_type const& sbs) const
{
static bool const is_intersection
= target_operation == operation_intersection;
// Take the first outgoing rank corresponding to incoming region,
// or take another region if it is not isolated
turn_operation_type const& incoming_op
= operation_from_rank(sbs.m_ranked_points.front());
auto const& in_op = operation_from_rank(sbs.m_ranked_points.front());
for (std::size_t i = 0; i < sbs.m_ranked_points.size(); i++)
{
typename sbs_type::rp const& rp = sbs.m_ranked_points[i];
auto const& rp = sbs.m_ranked_points[i];
if (rp.rank == 0 || rp.direction == sort_by_side::dir_from)
{
continue;
}
turn_operation_type const& op = operation_from_rank(rp);
auto const& out_op = operation_from_rank(rp);
if (op.operation != target_operation
&& op.operation != operation_continue)
if (out_op.operation != target_operation
&& out_op.operation != operation_continue)
{
continue;
}
if (op.enriched.region_id == incoming_op.enriched.region_id
|| (skip_isolated && ! op.enriched.isolated))
if (in_op.enriched.region_id == out_op.enriched.region_id
|| (is_intersection && ! out_op.enriched.isolated))
{
// Region corresponds to incoming region, or (for intersection)
// there is a non-isolated other region which should be taken
@ -660,7 +661,7 @@ public :
int& op_index, sbs_type const& sbs,
signed_size_type start_turn_index, int start_op_index) const
{
sort_by_side::rank_type const selected_rank = select_rank(sbs, false);
sort_by_side::rank_type const selected_rank = select_rank(sbs);
int current_priority = 0;
for (std::size_t i = 1; i < sbs.m_ranked_points.size(); i++)
@ -688,49 +689,59 @@ public :
inline bool analyze_cluster_intersection(signed_size_type& turn_index,
int& op_index, sbs_type const& sbs) const
{
sort_by_side::rank_type const selected_rank = select_rank(sbs, true);
// Select the rank based on regions and isolation
sort_by_side::rank_type const selected_rank = select_rank(sbs);
if (selected_rank > 0)
if (selected_rank <= 0)
{
typename turn_operation_type::comparable_distance_type
min_remaining_distance = 0;
return false;
}
std::size_t selected_index = sbs.m_ranked_points.size();
for (std::size_t i = 0; i < sbs.m_ranked_points.size(); i++)
// From these ranks, select the index: the first, or the one with
// the smallest remaining distance
typename turn_operation_type::comparable_distance_type
min_remaining_distance = 0;
std::size_t selected_index = sbs.m_ranked_points.size();
for (std::size_t i = 0; i < sbs.m_ranked_points.size(); i++)
{
auto const& ranked_point = sbs.m_ranked_points[i];
if (ranked_point.rank > selected_rank)
{
typename sbs_type::rp const& ranked_point = sbs.m_ranked_points[i];
if (ranked_point.rank == selected_rank)
{
turn_operation_type const& op = operation_from_rank(ranked_point);
if (op.visited.finalized())
{
// This direction is already traveled before, the same
// cannot be traveled again
continue;
}
// Take turn with the smallest remaining distance
if (selected_index == sbs.m_ranked_points.size()
|| op.remaining_distance < min_remaining_distance)
{
selected_index = i;
min_remaining_distance = op.remaining_distance;
}
}
break;
}
if (selected_index < sbs.m_ranked_points.size())
else if (ranked_point.rank == selected_rank)
{
typename sbs_type::rp const& ranked_point = sbs.m_ranked_points[selected_index];
turn_index = ranked_point.turn_index;
op_index = ranked_point.operation_index;
return true;
auto const& op = operation_from_rank(ranked_point);
if (op.visited.finalized())
{
// This direction is already traveled,
// it cannot be traveled again
continue;
}
if (selected_index == sbs.m_ranked_points.size()
|| op.remaining_distance < min_remaining_distance)
{
// It was unassigned or it is better
selected_index = i;
min_remaining_distance = op.remaining_distance;
}
}
}
return false;
if (selected_index == sbs.m_ranked_points.size())
{
// Should not happen, there must be points with the selected rank
return false;
}
auto const& ranked_point = sbs.m_ranked_points[selected_index];
turn_index = ranked_point.turn_index;
op_index = ranked_point.operation_index;
return true;
}
inline bool fill_sbs(sbs_type& sbs,
@ -819,6 +830,7 @@ public :
return result;
}
// Analyzes a non-clustered "ii" intersection, as if it is clustered.
inline bool analyze_ii_intersection(signed_size_type& turn_index, int& op_index,
turn_type const& current_turn,
segment_identifier const& previous_seg_id)

View File

@ -89,7 +89,6 @@ struct traversal_switch_detector
enum isolation_type
{
isolation_unknown = -1,
isolation_no = 0,
isolation_yes = 1,
isolation_multiple = 2
@ -121,7 +120,7 @@ struct traversal_switch_detector
struct region_properties
{
signed_size_type region_id = -1;
isolation_type isolated = isolation_unknown;
isolation_type isolated = isolation_no;
set_type unique_turn_ids;
connection_map connected_region_counts;
};
@ -374,7 +373,7 @@ struct traversal_switch_detector
{
region_properties& properties = key_val.second;
if (properties.isolated == isolation_unknown
if (properties.isolated == isolation_no
&& has_only_isolated_children(properties))
{
properties.isolated = isolation_yes;
@ -388,13 +387,36 @@ struct traversal_switch_detector
{
for (turn_type& turn : m_turns)
{
// For difference, for the input walked through in reverse,
// the meaning is reversed: what is isolated is actually not,
// and vice versa.
bool const reverseMeaningInTurn
= (Reverse1 || Reverse2)
&& ! turn.is_self()
&& ! turn.is_clustered()
&& uu_or_ii(turn)
&& turn.operations[0].enriched.region_id
!= turn.operations[1].enriched.region_id;
for (auto& op : turn.operations)
{
auto mit = m_connected_regions.find(op.enriched.region_id);
if (mit != m_connected_regions.end())
{
bool const reverseMeaningInOp
= reverseMeaningInTurn
&& ((op.seg_id.source_index == 0 && Reverse1)
|| (op.seg_id.source_index == 1 && Reverse2));
// It is assigned to isolated if it's property is "Yes",
// (one connected interior, or chained).
// "Multiple" doesn't count for isolation,
// neither for intersection, neither for difference.
region_properties const& prop = mit->second;
op.enriched.isolated = prop.isolated == isolation_yes;
op.enriched.isolated
= reverseMeaningInOp
? false
: prop.isolated == isolation_yes;
}
}
}
@ -478,8 +500,12 @@ struct traversal_switch_detector
// Discarded turns don't connect rings to the same region
// Also xx are not relevant
// (otherwise discarded colocated uu turn could make a connection)
return ! turn.discarded
&& ! turn.both(operation_blocked);
return ! turn.discarded && ! turn.both(operation_blocked);
}
inline bool uu_or_ii(turn_type const& turn) const
{
return turn.both(operation_union) || turn.both(operation_intersection);
}
inline bool connects_same_region(turn_type const& turn) const
@ -492,7 +518,7 @@ struct traversal_switch_detector
if (! turn.is_clustered())
{
// If it is a uu/ii-turn (non clustered), it is never same region
return ! (turn.both(operation_union) || turn.both(operation_intersection));
return ! uu_or_ii(turn);
}
if (BOOST_GEOMETRY_CONDITION(target_operation == operation_union))
@ -565,10 +591,83 @@ struct traversal_switch_detector
}
}
#if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR)
void debug_show_results()
{
auto isolation_to_string = [](isolation_type const& iso) -> std::string
{
switch(iso)
{
case isolation_no : return "no";
case isolation_yes : return "yes";
case isolation_multiple : return "multiple";
}
return "error";
};
auto set_to_string = [](auto const& s) -> std::string
{
std::ostringstream result;
for (auto item : s) { result << " " << item; }
return result.str();
};
for (auto const& kv : m_connected_regions)
{
auto const& prop = kv.second;
std::ostringstream sub;
sub << "[turns" << set_to_string(prop.unique_turn_ids)
<< "] regions";
for (auto const& kvs : prop.connected_region_counts)
{
sub << " { " << kvs.first
<< " : via [" << set_to_string(kvs.second.unique_turn_ids)
<< " ] }";
}
std::cout << "REGION " << prop.region_id
<< " " << isolation_to_string(prop.isolated)
<< " " << sub.str()
<< std::endl;
}
for (std::size_t turn_index = 0; turn_index < m_turns.size(); ++turn_index)
{
turn_type const& turn = m_turns[turn_index];
if (uu_or_ii(turn) && ! turn.is_clustered())
{
std::cout << (turn.both(operation_union) ? "UU" : "II")
<< " " << turn_index
<< " (" << geometry::get<0>(turn.point)
<< ", " << geometry::get<1>(turn.point) << ")"
<< " -> " << std::boolalpha
<< " [" << turn.operations[0].seg_id.source_index
<< "/" << turn.operations[1].seg_id.source_index << "] "
<< "(" << turn.operations[0].enriched.region_id
<< " " << turn.operations[0].enriched.isolated
<< ") / (" << turn.operations[1].enriched.region_id
<< " " << turn.operations[1].enriched.isolated << ")"
<< std::endl;
}
}
for (auto const& key_val : m_clusters)
{
cluster_info const& cinfo = key_val.second;
std::cout << "CL RESULT " << key_val.first
<< " -> " << cinfo.open_count << std::endl;
}
}
#endif
void iterate()
{
#if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR)
std::cout << "BEGIN SWITCH DETECTOR (region_ids and isolation)" << std::endl;
std::cout << "BEGIN SWITCH DETECTOR (region_ids and isolation)"
<< (Reverse1 ? " REVERSE_1" : "")
<< (Reverse2 ? " REVERSE_2" : "")
<< std::endl;
#endif
// Collect turns per ring
@ -608,33 +707,7 @@ struct traversal_switch_detector
#if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR)
std::cout << "END SWITCH DETECTOR" << std::endl;
for (std::size_t turn_index = 0; turn_index < m_turns.size(); ++turn_index)
{
turn_type const& turn = m_turns[turn_index];
if ((turn.both(operation_union) || turn.both(operation_intersection))
&& ! turn.is_clustered())
{
std::cout << (turn.both(operation_union) ? "UU" : "II")
<< " " << turn_index
<< " (" << geometry::get<0>(turn.point)
<< ", " << geometry::get<1>(turn.point) << ")"
<< " -> " << std::boolalpha
<< "(" << turn.operations[0].enriched.region_id
<< " " << turn.operations[0].enriched.isolated
<< ") / (" << turn.operations[1].enriched.region_id
<< " " << turn.operations[1].enriched.isolated << ")"
<< std::endl;
}
}
for (auto const& key_val : m_clusters)
{
cluster_info const& cinfo = key_val.second;
std::cout << "CL RESULT " << key_val.first
<< " -> " << cinfo.open_count << std::endl;
}
debug_show_results();
#endif
}

View File

@ -138,6 +138,11 @@ struct turn_info
{
return cluster_id > 0;
}
inline bool is_self() const
{
return operations[0].seg_id.source_index
== operations[1].seg_id.source_index;
}
private :
inline bool has12(operation_type type1, operation_type type2) const

View File

@ -2,9 +2,8 @@
// Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015, 2017, 2018.
// Modifications copyright (c) 2015-2018, Oracle and/or its affiliates.
// This file was modified by Oracle on 2015-2021.
// Modifications copyright (c) 2015-2021, 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,
@ -132,9 +131,11 @@ static inline bool preceding(int dir,
RobustPolicy const& robust_policy)
{
typename geometry::robust_point_type<Point, RobustPolicy>::type robust_point;
assert_coordinate_type_equal(robust_point, point_box);
geometry::recalculate(robust_point, point, robust_policy);
// After recalculate() to prevent warning: 'robust_point' may be used uninitialized
assert_coordinate_type_equal(robust_point, point_box);
return preceding_check<Dimension, Box>::apply(dir, robust_point,
point_box,
other_box);

View File

@ -217,7 +217,8 @@ struct visit_breadth_first<Geometry, geometry_collection_tag>
bool result = true;
traits::iter_visit<util::remove_cref_t<Geom>>::apply([&](auto && g)
{
result = visit_or_enqueue(function, std::forward<decltype(g)>(g), queue, it);
result = visit_breadth_first::visit_or_enqueue(
function, std::forward<decltype(g)>(g), queue, it);
}, it);
if (! result)
@ -235,7 +236,7 @@ struct visit_breadth_first<Geometry, geometry_collection_tag>
// so this call can be avoided.
traits::iter_visit<util::remove_cref_t<Geom>>::apply([&](auto && g)
{
set_iterators(std::forward<decltype(g)>(g), it, end);
visit_breadth_first::set_iterators(std::forward<decltype(g)>(g), it, end);
}, queue.front());
queue.pop_front();
}

View File

@ -161,10 +161,10 @@ struct call_intersection_insert
typename Strategy
>
static inline OutputIterator apply(Geometry1 const& geometry1,
Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
Geometry2 const& ,
RobustPolicy const& ,
OutputIterator out,
Strategy const& strategy)
Strategy const& )
{
base_t::access::get(out) = geometry::detail::convert_to_output
<

View File

@ -1,7 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2018-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -19,6 +18,8 @@
#include <boost/range/end.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/value_type.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/variant_fwd.hpp>
#include <boost/geometry/algorithms/detail/convert_point_to_point.hpp>
#include <boost/geometry/algorithms/detail/dummy_geometries.hpp>

View File

@ -1,6 +1,6 @@
// Boost.Geometry
// Copyright (c) 2019 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2019-2021 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2018-2020 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -23,10 +23,6 @@
#define BOOST_GEOMETRY_CXX11_TUPLE
#endif
// Defining this selects Kramer rule for segment-intersection
// That is default behaviour.
#define BOOST_GEOMETRY_USE_KRAMER_RULE
// Rescaling is turned on, unless NO_ROBUSTNESS is defined
// In future versions of Boost.Geometry, it will be turned off by default
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)

View File

@ -1,6 +1,6 @@
// Boost.Geometry
// Copyright (c) 2019 Oracle and/or its affiliates.
// Copyright (c) 2019-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -12,6 +12,9 @@
#ifndef BOOST_GEOMETRY_FORMULAS_INTERPOLATE_POINT_SPHERICAL_HPP
#define BOOST_GEOMETRY_FORMULAS_INTERPOLATE_POINT_SPHERICAL_HPP
#include <boost/geometry/formulas/spherical.hpp>
#include <boost/geometry/geometries/point.hpp>
namespace boost { namespace geometry { namespace formula
{

View File

@ -36,6 +36,7 @@
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/util/math.hpp>
#include <boost/geometry/util/precise_math.hpp>
#include <boost/geometry/util/series_expansion.hpp>
#include <boost/geometry/util/normalize_spheroidal_coordinates.hpp>
@ -51,16 +52,20 @@ namespace boost { namespace geometry { namespace math {
template<typename T>
inline T difference_angle(T const& x, T const& y, T& e)
{
T t, d = math::sum_error(std::remainder(-x, T(360)), std::remainder(y, T(360)), t);
auto res1 = boost::geometry::detail::precise_math::two_sum(
std::remainder(-x, T(360)), std::remainder(y, T(360)));
normalize_azimuth<degree, T>(d);
normalize_azimuth<degree, T>(res1[0]);
// Here y - x = d + t (mod 360), exactly, where d is in (-180,180] and
// abs(t) <= eps (eps = 2^-45 for doubles). The only case where the
// addition of t takes the result outside the range (-180,180] is d = 180
// and t > 0. The case, d = -180 + eps, t = -eps, can't happen, since
// sum_error would have returned the exact result in such a case (i.e., given t = 0).
return math::sum_error(d == 180 && t > 0 ? -180 : d, t, e);
auto res2 = boost::geometry::detail::precise_math::two_sum(
res1[0] == 180 && res1[1] > 0 ? -180 : res1[0], res1[1]);
e = res2[1];
return res2[0];
}
}}} // namespace boost::geometry::math

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019-2020.
// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -15,6 +15,11 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/detail/covered_by/interface.hpp>
#include <boost/geometry/algorithms/detail/envelope/interface.hpp>
#include <boost/geometry/algorithms/detail/expand/interface.hpp>
#include <boost/geometry/index/detail/bounded_view.hpp>
namespace boost { namespace geometry { namespace index { namespace detail

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,6 +15,9 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP
#include <boost/geometry/algorithms/detail/comparable_distance/interface.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/index/detail/algorithms/sum_for_indexable.hpp>
#include <boost/geometry/index/detail/algorithms/diff_abs.hpp>

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,6 +15,9 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP
#include <boost/geometry/algorithms/detail/comparable_distance/interface.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/index/detail/algorithms/diff_abs.hpp>
#include <boost/geometry/index/detail/algorithms/sum_for_indexable.hpp>

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,6 +15,9 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP
#include <boost/geometry/algorithms/detail/comparable_distance/interface.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/index/detail/algorithms/sum_for_indexable.hpp>
namespace boost { namespace geometry { namespace index { namespace detail {

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 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,
@ -15,7 +15,12 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/select_most_precise.hpp>
namespace boost { namespace geometry { namespace index { namespace detail {

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019-2020.
// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -20,6 +20,9 @@
#include <boost/geometry/index/detail/algorithms/content.hpp>
#include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/disjoint.hpp>
namespace boost { namespace geometry { namespace index { namespace detail {
// Util to distinguish between default and non-default index strategy

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 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,
@ -18,6 +18,7 @@
#include <cstddef>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/static_assert.hpp>
namespace boost { namespace geometry { namespace index { namespace detail {

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 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,
@ -15,7 +15,12 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_MARGIN_HPP
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/select_most_precise.hpp>
// WARNING! comparable_margin() will work only if the same Geometries are compared
// so it shouldn't be used in the case of Variants!

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2017 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 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,
@ -20,6 +20,7 @@
#include <boost/geometry/index/detail/algorithms/segment_intersection.hpp>
#include <boost/geometry/strategies/default_distance_result.hpp>
#include <boost/geometry/strategies/default_length_result.hpp>

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, Oracle and/or its affiliates.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021, 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,
@ -15,9 +15,14 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SEGMENT_INTERSECTION_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_SEGMENT_INTERSECTION_HPP
#include <limits>
#include <type_traits>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
namespace boost { namespace geometry { namespace index { namespace detail {

View File

@ -5,8 +5,8 @@
//
// Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019-2020.
// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -22,7 +22,7 @@
#include <boost/geometry/index/detail/algorithms/comparable_distance_far.hpp>
#include <boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp>
#include <boost/geometry/index/detail/algorithms/path_intersection.hpp>
#include <boost/geometry/index/detail/predicates.hpp>
#include <boost/geometry/index/detail/tags.hpp>
namespace boost { namespace geometry { namespace index { namespace detail {

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019-2020.
// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -20,9 +20,13 @@
//#include <utility>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/index/detail/tags.hpp>
#include <boost/geometry/strategies/default_strategy.hpp>
namespace boost { namespace geometry { namespace index { namespace detail {
namespace predicates {
@ -31,10 +35,10 @@ namespace predicates {
// predicates
// ------------------------------------------------------------------ //
template <typename Fun, bool IsFunction>
template <typename Fun, bool IsFunction = std::is_function<Fun>::value>
struct satisfies_impl
{
satisfies_impl() : fun(NULL) {}
satisfies_impl() : fun(nullptr) {}
satisfies_impl(Fun f) : fun(f) {}
Fun * fun;
};
@ -42,20 +46,19 @@ struct satisfies_impl
template <typename Fun>
struct satisfies_impl<Fun, false>
{
satisfies_impl() {}
satisfies_impl() = default;
satisfies_impl(Fun const& f) : fun(f) {}
Fun fun;
};
template <typename Fun, bool Negated>
struct satisfies
: satisfies_impl<Fun, ::boost::is_function<Fun>::value>
struct satisfies : satisfies_impl<Fun>
{
typedef satisfies_impl<Fun, ::boost::is_function<Fun>::value> base;
using base_t = satisfies_impl<Fun>;
satisfies() {}
satisfies(Fun const& f) : base(f) {}
satisfies(base const& b) : base(b) {}
satisfies() = default;
satisfies(Fun const& f) : base_t(f) {}
satisfies(base_t const& b) : base_t(b) {}
};
// ------------------------------------------------------------------ //
@ -91,12 +94,12 @@ struct nearest
nearest()
// : count(0)
{}
nearest(PointOrRelation const& por, unsigned k)
nearest(PointOrRelation const& por, std::size_t k)
: point_or_relation(por)
, count(k)
{}
PointOrRelation point_or_relation;
unsigned count;
std::size_t count;
};
template <typename SegmentOrLinestring>
@ -105,12 +108,12 @@ struct path
path()
// : count(0)
{}
path(SegmentOrLinestring const& g, unsigned k)
path(SegmentOrLinestring const& g, std::size_t k)
: geometry(g)
, count(k)
{}
SegmentOrLinestring geometry;
unsigned count;
std::size_t count;
};
} // namespace predicates
@ -520,31 +523,31 @@ struct predicate_check<predicates::path<Linestring>, bounds_tag>
template <typename T>
struct predicates_length
{
static const unsigned value = 1;
static const std::size_t value = 1;
};
template <typename ...Ts>
struct predicates_length<std::tuple<Ts...>>
{
static const unsigned value = std::tuple_size<std::tuple<Ts...>>::value;
static const std::size_t value = std::tuple_size<std::tuple<Ts...>>::value;
};
// ------------------------------------------------------------------ //
// predicates_element
// ------------------------------------------------------------------ //
template <unsigned I, typename T>
template <std::size_t I, typename T>
struct predicates_element
{
BOOST_GEOMETRY_STATIC_ASSERT((I < 1),
"Invalid I index.",
std::integral_constant<unsigned, I>);
std::integral_constant<std::size_t, I>);
typedef T type;
static type const& get(T const& p) { return p; }
};
template <unsigned I, typename ...Ts>
template <std::size_t I, typename ...Ts>
struct predicates_element<I, std::tuple<Ts...>>
{
typedef std::tuple<Ts...> predicate_type;
@ -557,7 +560,7 @@ struct predicates_element<I, std::tuple<Ts...>>
// predicates_check
// ------------------------------------------------------------------ //
template <typename TuplePredicates, typename Tag, unsigned First, unsigned Last>
template <typename TuplePredicates, typename Tag, std::size_t First, std::size_t Last>
struct predicates_check_tuple
{
template <typename Value, typename Indexable, typename Strategy>
@ -572,7 +575,7 @@ struct predicates_check_tuple
}
};
template <typename TuplePredicates, typename Tag, unsigned First>
template <typename TuplePredicates, typename Tag, std::size_t First>
struct predicates_check_tuple<TuplePredicates, Tag, First, First>
{
template <typename Value, typename Indexable, typename Strategy>
@ -582,13 +585,13 @@ struct predicates_check_tuple<TuplePredicates, Tag, First, First>
}
};
template <typename Predicate, typename Tag, unsigned First, unsigned Last>
template <typename Predicate, typename Tag, std::size_t First, std::size_t Last>
struct predicates_check_impl
{
static const bool check = First < 1 && Last <= 1 && First <= Last;
BOOST_GEOMETRY_STATIC_ASSERT((check),
"Invalid First or Last index.",
std::integer_sequence<unsigned, First, Last>);
std::integer_sequence<std::size_t, First, Last>);
template <typename Value, typename Indexable, typename Strategy>
static inline bool apply(Predicate const& p, Value const& v, Indexable const& i, Strategy const& s)
@ -597,16 +600,16 @@ struct predicates_check_impl
}
};
template <typename ...Ts, typename Tag, unsigned First, unsigned Last>
template <typename ...Ts, typename Tag, std::size_t First, std::size_t Last>
struct predicates_check_impl<std::tuple<Ts...>, Tag, First, Last>
{
typedef std::tuple<Ts...> predicates_type;
static const unsigned pred_len = std::tuple_size<predicates_type>::value;
static const std::size_t pred_len = std::tuple_size<predicates_type>::value;
static const bool check = First < pred_len && Last <= pred_len && First <= Last;
BOOST_GEOMETRY_STATIC_ASSERT((check),
"Invalid First or Last index.",
std::integer_sequence<unsigned, First, Last>);
std::integer_sequence<std::size_t, First, Last>);
template <typename Value, typename Indexable, typename Strategy>
static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i, Strategy const& s)
@ -619,7 +622,7 @@ struct predicates_check_impl<std::tuple<Ts...>, Tag, First, Last>
}
};
template <typename Tag, unsigned First, unsigned Last, typename Predicates, typename Value, typename Indexable, typename Strategy>
template <typename Tag, std::size_t First, std::size_t Last, typename Predicates, typename Value, typename Indexable, typename Strategy>
inline bool predicates_check(Predicates const& p, Value const& v, Indexable const& i, Strategy const& s)
{
return detail::predicates_check_impl<Predicates, Tag, First, Last>
@ -635,19 +638,19 @@ inline bool predicates_check(Predicates const& p, Value const& v, Indexable cons
template <typename P>
struct predicates_is_distance
{
static const unsigned value = 0;
static const std::size_t value = 0;
};
template <typename DistancePredicates>
struct predicates_is_distance< predicates::nearest<DistancePredicates> >
{
static const unsigned value = 1;
static const std::size_t value = 1;
};
template <typename Linestring>
struct predicates_is_distance< predicates::path<Linestring> >
{
static const unsigned value = 1;
static const std::size_t value = 1;
};
// predicates_count_nearest
@ -655,13 +658,13 @@ struct predicates_is_distance< predicates::path<Linestring> >
template <typename T>
struct predicates_count_distance
{
static const unsigned value = predicates_is_distance<T>::value;
static const std::size_t value = predicates_is_distance<T>::value;
};
template <typename Tuple, unsigned N>
template <typename Tuple, std::size_t N>
struct predicates_count_distance_tuple
{
static const unsigned value =
static const std::size_t value =
predicates_is_distance<typename std::tuple_element<N-1, Tuple>::type>::value
+ predicates_count_distance_tuple<Tuple, N-1>::value;
};
@ -669,14 +672,14 @@ struct predicates_count_distance_tuple
template <typename Tuple>
struct predicates_count_distance_tuple<Tuple, 1>
{
static const unsigned value =
static const std::size_t value =
predicates_is_distance<typename std::tuple_element<0, Tuple>::type>::value;
};
template <typename ...Ts>
struct predicates_count_distance<std::tuple<Ts...>>
{
static const unsigned value = predicates_count_distance_tuple<
static const std::size_t value = predicates_count_distance_tuple<
std::tuple<Ts...>,
std::tuple_size<std::tuple<Ts...>>::value
>::value;
@ -687,16 +690,16 @@ struct predicates_count_distance<std::tuple<Ts...>>
template <typename T>
struct predicates_find_distance
{
static const unsigned value = predicates_is_distance<T>::value ? 0 : 1;
static const std::size_t value = predicates_is_distance<T>::value ? 0 : 1;
};
template <typename Tuple, unsigned N>
template <typename Tuple, std::size_t N>
struct predicates_find_distance_tuple
{
static const bool is_found = predicates_find_distance_tuple<Tuple, N-1>::is_found
|| predicates_is_distance<typename std::tuple_element<N-1, Tuple>::type>::value;
static const unsigned value = predicates_find_distance_tuple<Tuple, N-1>::is_found ?
static const std::size_t value = predicates_find_distance_tuple<Tuple, N-1>::is_found ?
predicates_find_distance_tuple<Tuple, N-1>::value :
(predicates_is_distance<typename std::tuple_element<N-1, Tuple>::type>::value ?
N-1 : std::tuple_size<Tuple>::value);
@ -706,13 +709,13 @@ template <typename Tuple>
struct predicates_find_distance_tuple<Tuple, 1>
{
static const bool is_found = predicates_is_distance<typename std::tuple_element<0, Tuple>::type>::value;
static const unsigned value = is_found ? 0 : std::tuple_size<Tuple>::value;
static const std::size_t value = is_found ? 0 : std::tuple_size<Tuple>::value;
};
template <typename ...Ts>
struct predicates_find_distance<std::tuple<Ts...>>
{
static const unsigned value = predicates_find_distance_tuple<
static const std::size_t value = predicates_find_distance_tuple<
std::tuple<Ts...>,
std::tuple_size<std::tuple<Ts...>>::value
>::value;

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,13 +15,13 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ADAPTORS_HPP
#include <deque>
#include <boost/static_assert.hpp>
#include <vector>
#include <boost/geometry/index/adaptors/query.hpp>
namespace boost { namespace geometry { namespace index {
// Forward declaration
template <typename Value, typename Options, typename IndexableGetter, typename EqualTo, typename Allocator>
class rtree;

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,6 +15,10 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ITERATORS_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ITERATORS_HPP
#include <iterator>
#include <boost/geometry/index/detail/rtree/visitors/iterator.hpp>
namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace iterators {
template <typename Value, typename Allocators>

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,6 +15,6 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_KMEANS_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_KMEANS_HPP
#include <boost/geometry/index/rtree/kmeans/split.hpp>
#include <boost/geometry/index/detail/rtree/kmeans/split.hpp>
#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_KMEANS_HPP

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,13 +15,17 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP
#include <boost/geometry/index/rtree/node/node.hpp>
#include <boost/geometry/index/rtree/visitors/insert.hpp>
#include <boost/geometry/index/detail/rtree/node/concept.hpp>
#include <boost/geometry/index/detail/rtree/visitors/insert.hpp>
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree {
// TODO: This should be defined in options.hpp
// For now it's defined here to satisfy Boost header policy
struct split_kmeans_tag {};
namespace kmeans {
// some details
@ -56,25 +64,34 @@ namespace kmeans {
// 4. Pamietac o parametryzacji kontenera z nadmiarowymi elementami
// PS. Z R* reinsertami moze byc masakra
template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
class split<Value, Options, Translator, Box, Allocators, split_kmeans_tag>
template <typename MembersHolder>
class split<MembersHolder, split_kmeans_tag>
{
protected:
typedef typename rtree::node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type node;
typedef typename rtree::internal_node<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type internal_node;
typedef typename rtree::leaf<Value, typename Options::parameters_type, Box, Allocators, typename Options::node_tag>::type leaf;
typedef typename MembersHolder::parameters_type parameters_type;
typedef typename MembersHolder::box_type box_type;
typedef typename MembersHolder::translator_type translator_type;
typedef typename MembersHolder::allocators_type allocators_type;
typedef typename MembersHolder::size_type size_type;
typedef typename Options::parameters_type parameters_type;
typedef typename MembersHolder::node node;
typedef typename MembersHolder::internal_node internal_node;
typedef typename MembersHolder::leaf leaf;
public:
typedef index::detail::varray
<
typename rtree::elements_type<internal_node>::type::value_type,
1
> nodes_container_type;
template <typename Node>
static inline void apply(node* & root_node,
size_t & leafs_level,
static inline void apply(nodes_container_type & additional_nodes,
Node & n,
internal_node *parent_node,
size_t current_child_index,
Translator const& tr,
Allocators & allocators)
box_type & n_box,
parameters_type const& parameters,
translator_type const& translator,
allocators_type & allocators)
{
}

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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/geometry/algorithms/detail/expand_by_epsilon.hpp>
#include <boost/geometry/index/detail/varray.hpp>
#include <boost/geometry/index/detail/rtree/node/pairs.hpp>
#include <boost/geometry/index/detail/translator.hpp>
namespace boost { namespace geometry { namespace index {

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,6 +15,8 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_SCOPED_DEALLOCATOR_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_SCOPED_DEALLOCATOR_HPP
#include <boost/container/allocator_traits.hpp>
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree {

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,7 +15,15 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_DYNAMIC_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_DYNAMIC_HPP
#include <boost/container/allocator_traits.hpp>
#include <boost/container/vector.hpp>
#include <boost/core/pointer_traits.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/variant.hpp>
#include <boost/geometry/index/detail/rtree/options.hpp>
#include <boost/geometry/index/detail/rtree/node/concept.hpp>
#include <boost/geometry/index/detail/rtree/node/pairs.hpp>
namespace boost { namespace geometry { namespace index {

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,6 +15,9 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_STATIC_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_STATIC_HPP
#include <boost/geometry/index/detail/rtree/node/variant_dynamic.hpp>
#include <boost/geometry/index/detail/varray.hpp>
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree {

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,10 +15,24 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_DYNAMIC_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_DYNAMIC_HPP
#include <boost/container/allocator_traits.hpp>
#include <boost/container/vector.hpp>
#include <boost/core/pointer_traits.hpp>
#include <boost/geometry/index/detail/rtree/options.hpp>
#include <boost/geometry/index/detail/rtree/node/concept.hpp>
#include <boost/geometry/index/detail/rtree/node/pairs.hpp>
#include <boost/geometry/index/detail/rtree/node/weak_visitor.hpp>
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree {
// TODO: This should be defined in options.hpp
// For now it's defined here to satisfy Boost header policy
struct node_weak_dynamic_tag {};
struct node_weak_static_tag {};
template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
struct weak_internal_node
: public weak_node<Value, Parameters, Box, Allocators, Tag>
@ -87,7 +105,7 @@ struct visitor<Value, Parameters, Box, Allocators, node_weak_dynamic_tag, IsVisi
template <typename Allocator, typename Value, typename Parameters, typename Box, typename Tag>
struct internal_node_alloc
{
typedef typename internal_nod
typedef typename internal_node
<
Value, Parameters, Box,
allocators<Allocator, Value, Parameters, Box, Tag>,
@ -116,6 +134,22 @@ struct leaf_alloc
>::template rebind_alloc<node_type> type;
};
template <typename Allocator, typename Value, typename Parameters, typename Box, typename Tag>
struct node_alloc
{
typedef typename weak_node
<
Value, Parameters, Box,
allocators<Allocator, Value, Parameters, Box, Tag>,
Tag
>::type node_type;
typedef typename ::boost::container::allocator_traits
<
Allocator
>::template rebind_alloc<node_type> type;
};
template <typename Allocator, typename Value, typename Parameters, typename Box>
class allocators<Allocator, Value, Parameters, Box, node_weak_dynamic_tag>
: public internal_node_alloc<Allocator, Value, Parameters, Box, node_weak_dynamic_tag>::type

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,6 +15,9 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_STATIC_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_STATIC_HPP
#include <boost/geometry/index/detail/rtree/node/weak_dynamic.hpp>
#include <boost/geometry/index/detail/varray.hpp>
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree {

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,6 +15,8 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_VISITOR_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_VISITOR_HPP
#include <boost/geometry/index/detail/assert.hpp>
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree {

View File

@ -5,8 +5,8 @@
// Copyright (c) 2011-2017 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2020 Caian Benedicto, Campinas, Brazil.
//
// This file was modified by Oracle on 2019.
// Modifications copyright (c) 2019 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -18,12 +18,15 @@
#include <boost/core/ignore_unused.hpp>
#include <boost/geometry/algorithms/detail/expand_by_epsilon.hpp>
#include <boost/geometry/algorithms/expand.hpp>
#include <boost/geometry/index/detail/algorithms/content.hpp>
#include <boost/geometry/index/detail/algorithms/bounds.hpp>
#include <boost/geometry/index/detail/algorithms/nth_element.hpp>
#include <boost/geometry/index/detail/rtree/node/node_elements.hpp>
#include <boost/geometry/index/detail/rtree/node/subtree_destroyer.hpp>
#include <boost/geometry/algorithms/detail/expand_by_epsilon.hpp>
#include <boost/geometry/index/parameters.hpp>
namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree {

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019.
// Modifications copyright (c) 2019 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -17,6 +17,10 @@
#include <boost/scoped_ptr.hpp>
#include <boost/geometry/index/detail/rtree/node/node_elements.hpp>
#include <boost/geometry/index/detail/rtree/visitors/distance_query.hpp>
#include <boost/geometry/index/detail/rtree/visitors/spatial_query.hpp>
//#define BOOST_GEOMETRY_INDEX_DETAIL_QUERY_ITERATORS_USE_MOVE
namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace iterators {

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2019 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019.
// Modifications copyright (c) 2019 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -27,6 +27,8 @@
#include <boost/geometry/index/detail/algorithms/union_content.hpp>
#include <boost/geometry/index/detail/rtree/node/node.hpp>
#include <boost/geometry/index/detail/rtree/options.hpp>
#include <boost/geometry/index/detail/rtree/visitors/insert.hpp>
#include <boost/geometry/index/detail/rtree/visitors/is_leaf.hpp>
namespace boost { namespace geometry { namespace index {

View File

@ -19,7 +19,12 @@
#include <boost/core/ignore_unused.hpp>
#include <boost/geometry/algorithms/detail/comparable_distance/interface.hpp>
#include <boost/geometry/index/detail/algorithms/content.hpp>
#include <boost/geometry/index/detail/rtree/node/concept.hpp>
#include <boost/geometry/index/detail/rtree/node/node_elements.hpp>
#include <boost/geometry/index/detail/rtree/visitors/insert.hpp>
namespace boost { namespace geometry { namespace index {

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019-2020.
// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -15,7 +15,16 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_UTILITIES_GL_DRAW_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_UTILITIES_GL_DRAW_HPP
#include <limits>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/index/detail/rtree/node/node_elements.hpp>
namespace boost { namespace geometry { namespace index { namespace detail {

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019-2020.
// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -17,7 +17,11 @@
#include <iostream>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
namespace boost { namespace geometry { namespace index { namespace detail {

View File

@ -4,8 +4,8 @@
//
// 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.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -15,10 +15,38 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_DISTANCE_QUERY_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_DISTANCE_QUERY_HPP
#include <boost/geometry/index/detail/distance_predicates.hpp>
#include <boost/geometry/index/detail/predicates.hpp>
#include <boost/geometry/index/detail/rtree/node/node_elements.hpp>
#include <boost/geometry/index/detail/translator.hpp>
#include <boost/geometry/index/parameters.hpp>
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree { namespace visitors {
struct pair_first_less
{
template <typename First, typename Second>
inline bool operator()(std::pair<First, Second> const& p1,
std::pair<First, Second> const& p2) const
{
return p1.first < p2.first;
}
};
struct pair_first_greater
{
template <typename First, typename Second>
inline bool operator()(std::pair<First, Second> const& p1,
std::pair<First, Second> const& p2) const
{
return p1.first > p2.first;
}
};
template <typename Value, typename Translator, typename DistanceType, typename OutIt>
class distance_query_result
{
@ -40,16 +68,16 @@ public:
m_neighbors.push_back(std::make_pair(curr_comp_dist, val));
if ( m_neighbors.size() == m_count )
std::make_heap(m_neighbors.begin(), m_neighbors.end(), neighbors_less);
std::make_heap(m_neighbors.begin(), m_neighbors.end(), pair_first_less());
}
else
{
if ( curr_comp_dist < m_neighbors.front().first )
{
std::pop_heap(m_neighbors.begin(), m_neighbors.end(), neighbors_less);
std::pop_heap(m_neighbors.begin(), m_neighbors.end(), pair_first_less());
m_neighbors.back().first = curr_comp_dist;
m_neighbors.back().second = val;
std::push_heap(m_neighbors.begin(), m_neighbors.end(), neighbors_less);
std::push_heap(m_neighbors.begin(), m_neighbors.end(), pair_first_less());
}
}
}
@ -80,13 +108,6 @@ public:
}
private:
inline static bool neighbors_less(
std::pair<distance_type, Value> const& p1,
std::pair<distance_type, Value> const& p2)
{
return p1.first < p2.first;
}
size_t m_count;
OutIt m_out_it;
@ -97,7 +118,7 @@ template
<
typename MembersHolder,
typename Predicates,
unsigned DistancePredicateIndex,
std::size_t DistancePredicateIndex,
typename OutIter
>
class distance_query
@ -125,7 +146,7 @@ public:
typedef typename calculate_value_distance::result_type value_distance_type;
typedef typename calculate_node_distance::result_type node_distance_type;
static const unsigned predicates_len = index::detail::predicates_length<Predicates>::value;
static const std::size_t predicates_len = index::detail::predicates_length<Predicates>::value;
inline distance_query(parameters_type const& parameters, translator_type const& translator, Predicates const& pred, OutIter out_it)
: m_parameters(parameters), m_translator(translator)
@ -186,7 +207,7 @@ public:
return;
// sort array
std::sort(active_branch_list.begin(), active_branch_list.end(), abl_less);
std::sort(active_branch_list.begin(), active_branch_list.end(), pair_first_less());
// recursively visit nodes
for ( typename active_branch_list_type::const_iterator it = active_branch_list.begin();
@ -209,7 +230,7 @@ public:
// from the copying of the whole containers on resize of the ABLs container
//// make a heap
//std::make_heap(active_branch_list.begin(), active_branch_list.end(), abl_greater);
//std::make_heap(active_branch_list.begin(), active_branch_list.end(), pair_first_greater());
//// recursively visit nodes
//while ( !active_branch_list.empty() )
@ -223,7 +244,7 @@ public:
// rtree::apply_visitor(*this, *(active_branch_list.front().second));
// std::pop_heap(active_branch_list.begin(), active_branch_list.end(), abl_greater);
// std::pop_heap(active_branch_list.begin(), active_branch_list.end(), pair_first_greater());
// active_branch_list.pop_back();
//}
}
@ -262,20 +283,6 @@ public:
}
private:
static inline bool abl_less(
std::pair<node_distance_type, typename allocators_type::node_pointer> const& p1,
std::pair<node_distance_type, typename allocators_type::node_pointer> const& p2)
{
return p1.first < p2.first;
}
//static inline bool abl_greater(
// std::pair<node_distance_type, typename allocators_type::node_pointer> const& p1,
// std::pair<node_distance_type, typename allocators_type::node_pointer> const& p2)
//{
// return p1.first > p2.first;
//}
template <typename Distance>
static inline bool is_node_prunable(Distance const& greatest_dist, node_distance_type const& d)
{
@ -299,7 +306,7 @@ private:
template <
typename MembersHolder,
typename Predicates,
unsigned DistancePredicateIndex
std::size_t DistancePredicateIndex
>
class distance_query_incremental
: public MembersHolder::visitor_const
@ -330,38 +337,19 @@ public:
typedef typename allocators_type::const_reference const_reference;
typedef typename allocators_type::node_pointer node_pointer;
static const unsigned predicates_len = index::detail::predicates_length<Predicates>::value;
static const std::size_t predicates_len = index::detail::predicates_length<Predicates>::value;
typedef typename rtree::elements_type<internal_node>::type internal_elements;
typedef typename internal_elements::const_iterator internal_iterator;
typedef typename rtree::elements_type<leaf>::type leaf_elements;
typedef std::pair<node_distance_type, node_pointer> branch_data;
typedef typename index::detail::rtree::container_from_elements_type<
internal_elements, branch_data
>::type active_branch_list_type;
struct internal_stack_element
{
internal_stack_element() : current_branch(0) {}
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
// Required in c++03 for containers using Boost.Move
internal_stack_element & operator=(internal_stack_element const& o)
{
branches = o.branches;
current_branch = o.current_branch;
return *this;
}
#endif
active_branch_list_type branches;
typename active_branch_list_type::size_type current_branch;
};
typedef std::vector<internal_stack_element> internal_stack_type;
typedef std::vector<branch_data> internal_heap_type;
inline distance_query_incremental()
: m_translator(NULL)
// , m_pred()
, current_neighbor((std::numeric_limits<size_type>::max)())
// , next_closest_node_distance((std::numeric_limits<node_distance_type>::max)())
// , m_strategy_type()
{}
@ -369,7 +357,6 @@ public:
: m_translator(::boost::addressof(translator))
, m_pred(pred)
, current_neighbor((std::numeric_limits<size_type>::max)())
, next_closest_node_distance((std::numeric_limits<node_distance_type>::max)())
, m_strategy(index::detail::get_strategy(params))
{
BOOST_GEOMETRY_INDEX_ASSERT(0 < max_count(), "k must be greather than 0");
@ -392,7 +379,7 @@ public:
{
size_type new_neighbor = current_neighbor == (std::numeric_limits<size_type>::max)() ? 0 : current_neighbor + 1;
if ( internal_stack.empty() )
if ( internal_heap.empty() )
{
if ( new_neighbor < neighbors.size() )
current_neighbor = new_neighbor;
@ -407,41 +394,33 @@ public:
}
else
{
active_branch_list_type & branches = internal_stack.back().branches;
typename active_branch_list_type::size_type & current_branch = internal_stack.back().current_branch;
if ( branches.size() <= current_branch )
{
internal_stack.pop_back();
continue;
}
branch_data const& closest_branch = internal_heap.front();
node_distance_type const& closest_distance = closest_branch.first;
// if there are no nodes which can have closer values, set new value
if ( new_neighbor < neighbors.size() &&
// here must be < because otherwise neighbours may be sorted in different order
// if there is another value with equal distance
neighbors[new_neighbor].first < next_closest_node_distance )
// NOTE: In order to use <= current neighbor can't be sorted again
neighbors[new_neighbor].first <= closest_distance )
{
current_neighbor = new_neighbor;
return;
}
// if node is further than the furthest neighbour, following nodes also will be further
BOOST_GEOMETRY_INDEX_ASSERT(neighbors.size() <= max_count(), "unexpected neighbours count");
// if node is further than the furthest neighbor, following nodes will also be further
BOOST_GEOMETRY_INDEX_ASSERT(neighbors.size() <= max_count(), "unexpected neighbors count");
if ( max_count() <= neighbors.size() &&
is_node_prunable(neighbors.back().first, branches[current_branch].first) )
neighbors.back().first <= closest_distance )
{
// stop traversing current level
internal_stack.pop_back();
internal_heap.clear();
continue;
}
else
{
// new level - must increment current_branch before traversing of another level (mem reallocation)
++current_branch;
rtree::apply_visitor(*this, *(branches[current_branch - 1].second));
node_pointer ptr = closest_branch.second;
std::pop_heap(internal_heap.begin(), internal_heap.end(), pair_first_greater());
internal_heap.pop_back();
next_closest_node_distance = calc_closest_node_distance(internal_stack.begin(), internal_stack.end());
rtree::apply_visitor(*this, *ptr);
}
}
}
@ -470,9 +449,6 @@ public:
typedef typename rtree::elements_type<internal_node>::type elements_type;
elements_type const& elements = rtree::elements(n);
// add new element
internal_stack.resize(internal_stack.size()+1);
// fill active branch list array of nodes meeting predicates
for ( typename elements_type::const_iterator it = elements.begin() ; it != elements.end() ; ++it )
{
@ -494,21 +470,16 @@ public:
// if current node is further than found neighbors - don't analyze it
if ( max_count() <= neighbors.size() &&
is_node_prunable(neighbors.back().first, node_distance) )
neighbors.back().first <= node_distance )
{
continue;
}
// add current node's data into the list
internal_stack.back().branches.push_back( std::make_pair(node_distance, it->second) );
// add current node's data into the queue
internal_heap.push_back(std::make_pair(node_distance, it->second));
std::push_heap(internal_heap.begin(), internal_heap.end(), pair_first_greater());
}
}
if ( internal_stack.back().branches.empty() )
internal_stack.pop_back();
else
// sort array
std::sort(internal_stack.back().branches.begin(), internal_stack.back().branches.end(), abl_less);
}
// Put values into the list of neighbours if those values meets predicates
@ -547,50 +518,22 @@ public:
}
}
// TODO: sort is probably suboptimal.
// An alternative would be std::set, but it'd probably add constant cost.
// Ideally replace this with double-ended priority queue, e.g. min-max heap.
// NOTE: A condition in increment() relies on the fact that current neighbor doesn't
// participate in sorting anymore.
// sort array
std::sort(neighbors.begin(), neighbors.end(), neighbors_less);
size_type sort_first = current_neighbor == (std::numeric_limits<size_type>::max)() ? 0 : current_neighbor + 1;
std::sort(neighbors.begin() + sort_first, neighbors.end(), pair_first_less());
// remove furthest values
if ( max_count() < neighbors.size() )
neighbors.resize(max_count());
}
private:
static inline bool abl_less(std::pair<node_distance_type, node_pointer> const& p1,
std::pair<node_distance_type, node_pointer> const& p2)
{
return p1.first < p2.first;
}
static inline bool neighbors_less(std::pair<value_distance_type, const value_type *> const& p1,
std::pair<value_distance_type, const value_type *> const& p2)
{
return p1.first < p2.first;
}
node_distance_type
calc_closest_node_distance(typename internal_stack_type::const_iterator first,
typename internal_stack_type::const_iterator last)
{
node_distance_type result = (std::numeric_limits<node_distance_type>::max)();
for ( ; first != last ; ++first )
{
if ( first->branches.size() <= first->current_branch )
continue;
node_distance_type curr_dist = first->branches[first->current_branch].first;
if ( curr_dist < result )
result = curr_dist;
}
return result;
}
template <typename Distance>
static inline bool is_node_prunable(Distance const& greatest_dist, node_distance_type const& d)
{
return greatest_dist <= d;
}
inline unsigned max_count() const
inline std::size_t max_count() const
{
return nearest_predicate_access::get(m_pred).count;
}
@ -604,10 +547,9 @@ private:
Predicates m_pred;
internal_stack_type internal_stack;
internal_heap_type internal_heap;
std::vector< std::pair<value_distance_type, const value_type *> > neighbors;
size_type current_neighbor;
node_distance_type next_closest_node_distance;
strategy_type m_strategy;
};

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019-2020.
// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -21,12 +21,14 @@
#include <boost/geometry/algorithms/detail/expand_by_epsilon.hpp>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/index/detail/algorithms/bounds.hpp>
#include <boost/geometry/index/detail/algorithms/content.hpp>
#include <boost/geometry/index/detail/rtree/node/node_elements.hpp>
#include <boost/geometry/index/detail/rtree/node/subtree_destroyer.hpp>
#include <boost/geometry/index/detail/rtree/options.hpp>
#include <boost/geometry/util/condition.hpp>
namespace boost { namespace geometry { namespace index {

View File

@ -4,6 +4,10 @@
//
// Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -11,6 +15,9 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ITERATOR_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_ITERATOR_HPP
#include <boost/geometry/index/detail/rtree/node/concept.hpp>
#include <boost/geometry/index/detail/rtree/node/node_elements.hpp>
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree { namespace visitors {

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2017 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019.
// Modifications copyright (c) 2019 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -15,11 +15,13 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_REMOVE_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_REMOVE_HPP
#include <boost/geometry/algorithms/detail/covered_by/interface.hpp>
#include <boost/geometry/index/detail/rtree/node/node_elements.hpp>
#include <boost/geometry/index/detail/rtree/node/subtree_destroyer.hpp>
#include <boost/geometry/index/detail/rtree/visitors/destroy.hpp>
#include <boost/geometry/index/detail/rtree/visitors/is_leaf.hpp>
#include <boost/geometry/algorithms/detail/covered_by/interface.hpp>
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree { namespace visitors {

View File

@ -4,8 +4,8 @@
//
// 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.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -15,6 +15,10 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP
#include <boost/geometry/index/detail/rtree/node/node_elements.hpp>
#include <boost/geometry/index/detail/predicates.hpp>
#include <boost/geometry/index/parameters.hpp>
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree { namespace visitors {
@ -35,7 +39,7 @@ struct spatial_query
typedef typename allocators_type::size_type size_type;
static const unsigned predicates_len = index::detail::predicates_length<Predicates>::value;
static const std::size_t predicates_len = index::detail::predicates_length<Predicates>::value;
inline spatial_query(parameters_type const& par, translator_type const& t, Predicates const& p, OutIter out_it)
: tr(t), pred(p), out_iter(out_it), found_count(0), strategy(index::detail::get_strategy(par))
@ -119,7 +123,7 @@ public:
typedef typename rtree::elements_type<leaf>::type leaf_elements;
typedef typename rtree::elements_type<leaf>::type::const_iterator leaf_iterator;
static const unsigned predicates_len = index::detail::predicates_length<Predicates>::value;
static const std::size_t predicates_len = index::detail::predicates_length<Predicates>::value;
inline spatial_query_incremental()
: m_translator(NULL)

View File

@ -2,6 +2,10 @@
//
// Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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)
@ -9,11 +13,21 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_SERIALIZATION_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_SERIALIZATION_HPP
#include <boost/type_traits/alignment_of.hpp>
#include <boost/type_traits/aligned_storage.hpp>
//#include <boost/serialization/serialization.hpp>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/version.hpp>
//#include <boost/serialization/nvp.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/index/parameters.hpp>
#include <boost/geometry/index/detail/rtree/node/concept.hpp>
#include <boost/geometry/index/detail/rtree/node/subtree_destroyer.hpp>
// TODO
// how about using the unsigned type capable of storing Max in compile-time versions?
@ -26,7 +40,13 @@
// each geometry save without this info
// TODO - move to index/detail/serialization.hpp
namespace boost { namespace geometry { namespace index { namespace detail {
namespace boost { namespace geometry { namespace index {
// Forward declaration
template <typename Value, typename Options, typename IndexableGetter, typename EqualTo, typename Allocator>
class rtree;
namespace detail {
// TODO - use boost::move?
template<typename T>

View File

@ -2,8 +2,8 @@
//
// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019-2020.
// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -15,6 +15,8 @@
#include <type_traits>
#include <boost/geometry/strategies/default_strategy.hpp>
namespace boost { namespace geometry { namespace index {
namespace detail {

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2017 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019-2020.
// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -15,13 +15,13 @@
#ifndef BOOST_GEOMETRY_INDEX_PARAMETERS_HPP
#define BOOST_GEOMETRY_INDEX_PARAMETERS_HPP
#include <limits>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/index/detail/exception.hpp>
#include <boost/geometry/strategies/default_strategy.hpp>
namespace boost { namespace geometry { namespace index {

View File

@ -4,8 +4,8 @@
//
// Copyright (c) 2011-2018 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019-2020.
// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -338,7 +338,7 @@ Only one \c nearest() predicate may be used in a query.
*/
template <typename Geometry> inline
detail::predicates::nearest<Geometry>
nearest(Geometry const& geometry, unsigned k)
nearest(Geometry const& geometry, std::size_t k)
{
return detail::predicates::nearest<Geometry>(geometry, k);
}
@ -368,7 +368,7 @@ Only one distance predicate (\c nearest() or \c path()) may be used in a query.
*/
template <typename SegmentOrLinestring> inline
detail::predicates::path<SegmentOrLinestring>
path(SegmentOrLinestring const& linestring, unsigned k)
path(SegmentOrLinestring const& linestring, std::size_t k)
{
return detail::predicates::path<SegmentOrLinestring>(linestring, k);
}

View File

@ -6,8 +6,8 @@
// Copyright (c) 2011-2019 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2020 Caian Benedicto, Campinas, Brazil.
//
// This file was modified by Oracle on 2019-2020.
// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 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,
@ -1082,7 +1082,7 @@ public:
if ( !m_members.root )
return 0;
static const unsigned distance_predicates_count = detail::predicates_count_distance<Predicates>::value;
static const std::size_t distance_predicates_count = detail::predicates_count_distance<Predicates>::value;
static const bool is_distance_predicate = 0 < distance_predicates_count;
BOOST_GEOMETRY_STATIC_ASSERT((distance_predicates_count <= 1),
"Only one distance predicate can be passed.",
@ -1252,7 +1252,7 @@ private:
>
qbegin_(Predicates const& predicates) const
{
static const unsigned distance_predicates_count = detail::predicates_count_distance<Predicates>::value;
static const std::size_t distance_predicates_count = detail::predicates_count_distance<Predicates>::value;
BOOST_GEOMETRY_STATIC_ASSERT((distance_predicates_count <= 1),
"Only one distance predicate can be passed.",
Predicates);
@ -1319,7 +1319,7 @@ private:
>
qend_(Predicates const& predicates) const
{
static const unsigned distance_predicates_count = detail::predicates_count_distance<Predicates>::value;
static const std::size_t distance_predicates_count = detail::predicates_count_distance<Predicates>::value;
BOOST_GEOMETRY_STATIC_ASSERT((distance_predicates_count <= 1),
"Only one distance predicate can be passed.",
Predicates);
@ -1916,7 +1916,7 @@ private:
{
BOOST_GEOMETRY_INDEX_ASSERT(m_members.root, "The root must exist");
static const unsigned distance_predicate_index = detail::predicates_find_distance<Predicates>::value;
static const std::size_t distance_predicate_index = detail::predicates_find_distance<Predicates>::value;
detail::rtree::visitors::distance_query<
members_holder,
Predicates,

View File

@ -478,9 +478,10 @@ struct wkt<Geometry, geometry_collection_tag>
static inline void apply(OutputStream& os, Geometry const& geometry,
bool force_closure)
{
output_or_recursive_call(os, geometry, force_closure);
wkt::output_or_recursive_call(os, geometry, force_closure);
}
private:
template
<
typename OutputStream, typename Geom,
@ -501,7 +502,7 @@ struct wkt<Geometry, geometry_collection_tag>
traits::iter_visit<Geom>::apply([&](auto const& g)
{
output_or_recursive_call(os, g, force_closure);
wkt::output_or_recursive_call(os, g, force_closure);
}, it);
}

View File

@ -86,6 +86,10 @@ public:
, m_it2(other.m_it2)
{}
concatenate_iterator(concatenate_iterator const& other) = default;
concatenate_iterator& operator=(concatenate_iterator const& other) = default;
private:
friend class boost::iterator_core_access;

View File

@ -100,6 +100,8 @@ public:
m_inner_it(other.m_inner_it)
{}
flatten_iterator(flatten_iterator const& other) = default;
flatten_iterator& operator=(flatten_iterator const& other)
{
m_outer_it = other.m_outer_it;

View File

@ -2,8 +2,8 @@
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017-2020.
// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017-2021, 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,
@ -145,7 +145,7 @@ struct factory_key<srs::detail::proj4_parameters>
{
return par.id.name;
}
static const char* get(const char* name, srs::dpar::value_proj id)
static const char* get(const char* name, srs::dpar::value_proj )
{
return name;
}
@ -160,7 +160,7 @@ struct factory_key<srs::dpar::parameters<T> >
{
return par.id.id;
}
static srs::dpar::value_proj get(const char* name, srs::dpar::value_proj id)
static srs::dpar::value_proj get(const char* , srs::dpar::value_proj id)
{
return id;
}

View File

@ -2,8 +2,8 @@
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017, 2018, 2019.
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017-2021, 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,
@ -287,7 +287,7 @@ namespace projections
// Interrupted Goode Homolosine
template <typename Params, typename Parameters, typename T>
inline void setup_igh(Params const& params, Parameters& par, par_igh<T, Parameters>& proj_parm)
inline void setup_igh(Params const& , Parameters& par, par_igh<T, Parameters>& proj_parm)
{
static const T d0 = 0;
static const T d4044118 = igh::d4044118<T>();

View File

@ -14,6 +14,8 @@
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/strategies/distance.hpp>
namespace boost { namespace geometry
{

View File

@ -14,6 +14,8 @@
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/strategies/detail.hpp>
namespace boost { namespace geometry
{

View File

@ -2,8 +2,8 @@
// Copyright (c) 2018-2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 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,
@ -17,12 +17,12 @@
#include <boost/range/value_type.hpp>
#include <boost/geometry/srs/spheroid.hpp>
#include <boost/geometry/strategies/buffer.hpp>
#include <boost/geometry/strategies/geographic/parameters.hpp>
#include <boost/geometry/util/math.hpp>
#include <boost/geometry/util/select_calculation_type.hpp>
#include <boost/geometry/strategies/buffer.hpp>
namespace boost { namespace geometry
{

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015, 2016.
// Modifications copyright (c) 2015-2016 Oracle and/or its affiliates.
// This file was modified by Oracle on 2015-2021.
// Modifications copyright (c) 2015-2021 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,
@ -15,9 +15,9 @@
#include <cstddef>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/policies/robustness/segment_ratio.hpp>
namespace boost { namespace geometry
{

View File

@ -1,7 +1,6 @@
// Boost.Geometry
// Copyright (c) 2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
@ -13,6 +12,8 @@
#include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/strategies/distance/detail.hpp>
#include <boost/geometry/strategies/geographic/distance.hpp>
#include <boost/geometry/strategies/geographic/line_interpolate.hpp>

View File

@ -13,6 +13,7 @@
// TEMP - move to strategy
#include <boost/geometry/strategies/agnostic/point_in_box_by_side.hpp>
#include <boost/geometry/strategies/cartesian/box_in_box.hpp>
#include <boost/geometry/strategies/geographic/intersection.hpp>
#include <boost/geometry/strategies/geographic/point_in_poly_winding.hpp>
#include <boost/geometry/strategies/spherical/point_in_point.hpp>

View File

@ -12,6 +12,7 @@
#include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/strategies/distance/comparable.hpp>
#include <boost/geometry/strategies/distance/detail.hpp>
#include <boost/geometry/strategies/simplify/services.hpp>

View File

@ -5,6 +5,11 @@
// Contributed and/or modified by Tinko Bartels,
// as part of Google Summer of Code 2019 program.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// 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)
@ -49,10 +54,16 @@ public:
static inline PromotedType side_value(P1 const& p1, P2 const& p2,
P const& p)
{
typedef ::boost::geometry::detail::precise_math::vec2d<PromotedType> vec2d;
vec2d pa { get<0>(p1), get<1>(p1) };
vec2d pb { get<0>(p2), get<1>(p2) };
vec2d pc { get<0>(p), get<1>(p) };
using vec2d = ::boost::geometry::detail::precise_math::vec2d<PromotedType>;
vec2d pa;
pa.x = get<0>(p1);
pa.y = get<1>(p1);
vec2d pb;
pb.x = get<0>(p2);
pb.y = get<1>(p2);
vec2d pc;
pc.x = get<0>(p);
pc.y = get<1>(p);
return ::boost::geometry::detail::precise_math::orient2d
<PromotedType, Robustness>(pa, pb, pc);
}

View File

@ -4,12 +4,13 @@
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014-2020.
// Modifications copyright (c) 2014-2020, Oracle and/or its affiliates.
// This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adeel Ahmad, as part of Google Summer of Code 2018 program
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Adeel Ahmad, as part of Google Summer of Code 2018 program
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -847,24 +848,6 @@ inline T round_angle(T const& x) {
return x < 0 ? -y : y;
}
/*!
\brief The error-free sum of two numbers.
*/
template<typename T>
inline T sum_error(T const& u, T const& v, T& t)
{
volatile T s = u + v;
volatile T up = s - v;
volatile T vpp = s - up;
up -= u;
vpp -= v;
t = -(up + vpp);
return s;
}
/*!
\brief Evaluate the polynomial in x using Horner's method.
*/

View File

@ -62,13 +62,13 @@ struct sequence_element {};
template <std::size_t I, typename T, typename ...Ts>
struct sequence_element<I, type_sequence<T, Ts...>>
{
typedef typename sequence_element<I - 1, type_sequence<Ts...>>::type type;
using type = typename sequence_element<I - 1, type_sequence<Ts...>>::type;
};
template <typename T, typename ...Ts>
struct sequence_element<0, type_sequence<T, Ts...>>
{
typedef T type;
using type = T;
};
template <std::size_t I, typename T, T J, T ...Js>
@ -125,6 +125,7 @@ struct sequence_empty
{};
// Defines type member for the first type in sequence that satisfies UnaryPred.
template
<
typename Sequence,
@ -151,13 +152,13 @@ template <template <typename> class UnaryPred>
struct sequence_find_if<type_sequence<>, UnaryPred>
{
// TODO: This is technically incorrect because void can be stored in a type_sequence
typedef void type;
using type = void;
};
// sequence_merge<type_sequence<A, B>, type_sequence<C, D>>::type is
// type_sequence<A, B, C, D>
// sequence_<integer_sequence<A, B>, integer_sequence<C, D>>::type is
// sequence_merge<integer_sequence<A, B>, integer_sequence<C, D>>::type is
// integer_sequence<A, B, C, D>
template <typename ...Sequences>
struct sequence_merge;
@ -190,6 +191,7 @@ struct sequence_merge<S1, S2, Sequences...>
>::type;
};
// sequence_combine<type_sequence<A, B>, type_sequence<C, D>>::type is
// type_sequence<type_sequence<A, C>, type_sequence<A, D>,
// type_sequence<B, C>, type_sequence<B, D>>
@ -199,10 +201,10 @@ struct sequence_combine;
template <typename ...T1s, typename ...T2s>
struct sequence_combine<type_sequence<T1s...>, type_sequence<T2s...>>
{
template <typename U1, typename ...U2s>
using type_sequence_t = type_sequence<type_sequence<U1, U2s>...>;
template <typename T1>
using type_sequence_t = type_sequence<type_sequence<T1, T2s>...>;
using type = typename sequence_merge<type_sequence_t<T1s, T2s...>...>::type;
using type = typename sequence_merge<type_sequence_t<T1s>...>::type;
};
// sequence_combine<integer_sequence<T, 1, 2>, integer_sequence<T, 3, 4>>::type is
@ -211,10 +213,10 @@ struct sequence_combine<type_sequence<T1s...>, type_sequence<T2s...>>
template <typename T, T ...I1s, T ...I2s>
struct sequence_combine<std::integer_sequence<T, I1s...>, std::integer_sequence<T, I2s...>>
{
template <T J1, T ...J2s>
using type_sequence_t = type_sequence<std::integer_sequence<T, J1, J2s>...>;
template <T I1>
using type_sequence_t = type_sequence<std::integer_sequence<T, I1, I2s>...>;
using type = typename sequence_merge<type_sequence_t<I1s, I2s...>...>::type;
using type = typename sequence_merge<type_sequence_t<I1s>...>::type;
};
@ -283,6 +285,11 @@ struct sequence_min_element<type_sequence<Ts...>, LessPred>
};
// TODO: Since there are two kinds of parameter packs and sequences there probably should be two
// versions of sequence_find_if as well as parameter_pack_min_element and sequence_min_element.
// Currently these utilities support only types.
} // namespace util

View File

@ -3,8 +3,8 @@
// Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2019.
// Modifications copyright (c) 2019, Oracle and/or its affiliates.
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021, 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,
@ -1694,7 +1694,7 @@ void test_rtree_queries(Parameters const& parameters, Allocator const& allocator
{
typedef bgi::indexable<Value> I;
typedef bgi::equal_to<Value> E;
typedef typename Allocator::template rebind<Value>::other A;
typedef typename boost::container::allocator_traits<Allocator>::template rebind_alloc<Value> A;
typedef bgi::rtree<Value, Parameters, I, E, A> Tree;
typedef typename Tree::bounds_type B;
@ -1717,7 +1717,7 @@ void test_rtree_modifiers(Parameters const& parameters, Allocator const& allocat
{
typedef bgi::indexable<Value> I;
typedef bgi::equal_to<Value> E;
typedef typename Allocator::template rebind<Value>::other A;
typedef typename boost::container::allocator_traits<Allocator>::template rebind_alloc<Value> A;
typedef bgi::rtree<Value, Parameters, I, E, A> Tree;
typedef typename Tree::bounds_type B;
@ -1754,7 +1754,7 @@ void test_count_rtree_values(Parameters const& parameters, Allocator const& allo
typedef bgi::indexable<Value> I;
typedef bgi::equal_to<Value> E;
typedef typename Allocator::template rebind<Value>::other A;
typedef typename boost::container::allocator_traits<Allocator>::template rebind_alloc<Value> A;
typedef bgi::rtree<Value, Parameters, I, E, A> Tree;
typedef typename Tree::bounds_type B;
@ -1797,7 +1797,7 @@ void test_rtree_count(Parameters const& parameters, Allocator const& allocator)
typedef bgi::indexable<Value> I;
typedef bgi::equal_to<Value> E;
typedef typename Allocator::template rebind<Value>::other A;
typedef typename boost::container::allocator_traits<Allocator>::template rebind_alloc<Value> A;
typedef bgi::rtree<Value, Parameters, I, E, A> Tree;
typedef typename Tree::bounds_type B;
@ -1828,7 +1828,7 @@ void test_rtree_bounds(Parameters const& parameters, Allocator const& allocator)
{
typedef bgi::indexable<Value> I;
typedef bgi::equal_to<Value> E;
typedef typename Allocator::template rebind<Value>::other A;
typedef typename boost::container::allocator_traits<Allocator>::template rebind_alloc<Value> A;
typedef bgi::rtree<Value, Parameters, I, E, A> Tree;
typedef typename Tree::bounds_type B;
//typedef typename bg::traits::point_type<B>::type P;
@ -1886,7 +1886,7 @@ void test_rtree_range(Parameters const& parameters, Allocator const& allocator)
typedef bgi::indexable<Value> I;
typedef bgi::equal_to<Value> E;
typedef typename Allocator::template rebind<Value>::other A;
typedef typename boost::container::allocator_traits<Allocator>::template rebind_alloc<Value> A;
typedef bgi::rtree<Value, Parameters, I, E, A> Tree;
typedef typename Tree::bounds_type B;

View File

@ -4,8 +4,8 @@
# Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
# Copyright (c) 2009-2018 Mateusz Loskot, London, UK.
#
# This file was modified by Oracle on 2017, 2018, 2019.
# Modifications copyright (c) 2017-2019 Oracle and/or its affiliates.
# This file was modified by Oracle on 2017-2021.
# Modifications copyright (c) 2017-2021 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,
@ -24,7 +24,6 @@ project boost-geometry-test
<toolset>clang:<cxxflags>-Wno-unneeded-internal-declaration # supress warning by Boost.None
<toolset>intel:<define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
<host-os>windows,<toolset>intel:<cxxflags>/bigobj
<define>BOOST_NO_AUTO_PTR # disable the deprecated std::auto_ptr support in SmartPtr and Core
;
# Run minimal testset

View File

@ -73,13 +73,13 @@ void test_all()
("POLYGON((1 0,0 1,-1 0,0 -1,1 0))", 2);
typedef typename bg::coordinate_type<P>::type coord_type;
if (BOOST_GEOMETRY_CONDITION((boost::is_same<coord_type, double>::value)))
if (BOOST_GEOMETRY_CONDITION((std::is_same<coord_type, double>::value)))
{
test_geometry<bg::model::polygon<P, false, false> >
("POLYGON((100000001 100000000, 100000000 100000001, \
99999999 100000000, 100000000 99999999))", 2);
}
else if (BOOST_GEOMETRY_CONDITION((boost::is_same<coord_type, float>::value)))
else if (BOOST_GEOMETRY_CONDITION((std::is_same<coord_type, float>::value)))
{
test_geometry<bg::model::polygon<P, false, false> >
("POLYGON((100001 100000, 100000 100001, \

View File

@ -6,9 +6,8 @@
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2015, 2016, 2017.
// Modifications copyright (c) 2015-2017, Oracle and/or its affiliates.
// This file was modified by Oracle on 2015-2021.
// Modifications copyright (c) 2015-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -430,7 +429,7 @@ void test_spherical_geo()
/*if (polar)
{
// Create colatitudes (measured from pole)
BOOST_FOREACH(pt& p, aurha)
for (pt& p : aurha)
{
bg::set<1>(p, ct(90) - bg::get<1>(p));
}

View File

@ -3,8 +3,8 @@
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016.
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
// This file was modified by Oracle on 2016-2021.
// Modifications copyright (c) 2016-2021, 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,
@ -128,7 +128,7 @@ void test_all()
ut_settings const settings;
ut_settings const specific_settings
= BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, long double>::value))
= BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, long double>::value))
? ut_settings(0.02) : settings;
// Simplex (join-type is not relevant)
@ -258,7 +258,7 @@ void test_all()
test_one<linestring, polygon>("mysql_report_2015_04_01", mysql_report_2015_04_01, join_round(32), end_round(32), 632.234, d100);
}
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, float>::value)))
if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{
ut_settings settings;
settings.tolerance = 0.1;
@ -313,7 +313,7 @@ void test_all()
27862.733459829971,
5.9518403867035365);
if (BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, double>::value)))
if (BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, double>::value)))
{
test_one<linestring, polygon>("mysql_report_2015_09_08a", mysql_report_2015_09_08a, join_round32, end_round32, 0.0, 1.0);
test_one<linestring, polygon>("mysql_report_2015_09_08b", mysql_report_2015_09_08b, join_round32, end_round32, 0.0, 1099511627778.0);
@ -390,7 +390,7 @@ template <bool Clockwise, typename P>
void test_invalid()
{
typedef typename bg::coordinate_type<P>::type coor_type;
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, double>::value)))
if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, double>::value)))
{
return;
}

View File

@ -3,6 +3,10 @@
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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)
@ -425,7 +429,7 @@ void test_aimes()
typedef bg::model::polygon<P> polygon;
typedef typename bg::coordinate_type<P>::type coor_type;
if (BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, float>::value)))
if (BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{
std::cout << "This unit test can't be tested with float,"
<< " the coordinate values are too small." << std::endl;

View File

@ -3,8 +3,8 @@
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016.
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
// This file was modified by Oracle on 2016-2021.
// Modifications copyright (c) 2016-2021, 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,
@ -141,7 +141,7 @@ void test_all()
test_one<multi_linestring_type, polygon>("mikado4_small", mikado4, join_round32, end_flat, 1930.785, 10.0);
}
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, float>::value)))
if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{
// Coordinates in one linestring vary so much that
// length = geometry::math::sqrt(dx * dx + dy * dy); returns a value of inf for length

View File

@ -3,8 +3,8 @@
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016.
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
// This file was modified by Oracle on 2016-2021.
// Modifications copyright (c) 2016-2021, 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,
@ -657,7 +657,7 @@ void test_all()
join_round32, end_round32, 0.0, -10.0);
// Check cases with extreme coordinates on assertions
if (BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, double>::value)))
if (BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, double>::value)))
{
test_one<multi_polygon_type, polygon_type>("mysql_report_2015_07_05_1",
mysql_report_2015_07_05_1,

View File

@ -3,8 +3,8 @@
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016, 2019.
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
// This file was modified by Oracle on 2016-2021.
// Modifications copyright (c) 2016-2021, 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,
@ -535,7 +535,7 @@ void test_all()
test_one<polygon_type, polygon_type>("italy_part2_5", italy_part2,
join_round, end_flat, {12496082120, 12496082124}, 5 * 1000.0);
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, float>::value)))
if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{
ut_settings settings;
settings.set_test_validity(false);
@ -571,7 +571,7 @@ void test_all()
test_one<polygon_type, polygon_type>("ticket_10398_1_25", ticket_10398_1, join_miter, end_flat, 246.7329, -2.5);
}
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, float>::value)))
if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{
// Test issue 369 as reported (1.15e-3) and some variants
// Use high tolerance because output areas are very small
@ -590,7 +590,7 @@ void test_all()
test_one<polygon_type, polygon_type>("issue_369_1000", issue_369, jr, er, 7.881e-10, distance / 1000.0, specific);
}
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, float>::value)))
if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{
// Test issue 555 as reported (-0.000001) and some variants
bg::strategy::buffer::join_round jr(180);
@ -639,7 +639,7 @@ void test_all()
mysql_report_2015_02_17_3,
join_round32, end_round32, 64.0, -1.0);
if (BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, double>::value)))
if (BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, double>::value)))
{
// These extreme testcases, containing huge coordinate differences
// and huge buffer distances, are to verify assertions.

View File

@ -24,7 +24,6 @@
#include <fstream>
#include <iomanip>
#include <boost/foreach.hpp>
#include <geometry_test_common.hpp>
#include <expectation_limits.hpp>
@ -161,12 +160,12 @@ void test_buffer(std::string const& caseid,
typedef typename bg::tag<Geometry>::type tag;
// TODO use something different here:
std::string type = boost::is_same<tag, bg::polygon_tag>::value ? "poly"
: boost::is_same<tag, bg::linestring_tag>::value ? "line"
: boost::is_same<tag, bg::point_tag>::value ? "point"
: boost::is_same<tag, bg::multi_polygon_tag>::value ? "multipoly"
: boost::is_same<tag, bg::multi_linestring_tag>::value ? "multiline"
: boost::is_same<tag, bg::multi_point_tag>::value ? "multipoint"
std::string type = std::is_same<tag, bg::polygon_tag>::value ? "poly"
: std::is_same<tag, bg::linestring_tag>::value ? "line"
: std::is_same<tag, bg::point_tag>::value ? "point"
: std::is_same<tag, bg::multi_polygon_tag>::value ? "multipoly"
: std::is_same<tag, bg::multi_linestring_tag>::value ? "multiline"
: std::is_same<tag, bg::multi_point_tag>::value ? "multipoint"
: ""
;
@ -184,8 +183,8 @@ void test_buffer(std::string const& caseid,
std::string end_name = EndTestProperties<EndStrategy>::name();
if ( BOOST_GEOMETRY_CONDITION((
boost::is_same<tag, bg::point_tag>::value
|| boost::is_same<tag, bg::multi_point_tag>::value )) )
std::is_same<tag, bg::point_tag>::value
|| std::is_same<tag, bg::multi_point_tag>::value )) )
{
join_name.clear();
}

View File

@ -3,8 +3,8 @@
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021 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,
@ -28,8 +28,8 @@
# endif
#endif
#include <boost/foreach.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp>
#include <boost/geometry/algorithms/buffer.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
@ -116,8 +116,7 @@ private :
std::map<point_type, int, bg::less<point_type> > offsets;
for (typename boost::range_iterator<Turns const>::type it =
boost::begin(turns); it != boost::end(turns); ++it)
for (auto it = boost::begin(turns); it != boost::end(turns); ++it)
{
if (m_zoom && bg::disjoint(it->point, m_alternate_box))
{
@ -192,9 +191,7 @@ private :
typedef typename boost::range_value<OffsettedRings const>::type ring_type;
typedef typename bg::point_type<ring_type>::type point_type;
for(typename boost::range_iterator<Pieces const>::type it = boost::begin(pieces);
it != boost::end(pieces);
++it)
for (auto it = boost::begin(pieces); it != boost::end(pieces); ++it)
{
const piece_type& piece = *it;
bg::segment_identifier seg_id = piece.first_seg_id;
@ -274,8 +271,7 @@ private :
template <typename TraversedRings>
inline void map_traversed_rings(TraversedRings const& traversed_rings)
{
for(typename boost::range_iterator<TraversedRings const>::type it
= boost::begin(traversed_rings); it != boost::end(traversed_rings); ++it)
for (auto it = boost::begin(traversed_rings); it != boost::end(traversed_rings); ++it)
{
m_mapper.map(*it, "opacity:0.4;fill:none;stroke:rgb(0,255,0);stroke-width:2");
}
@ -284,8 +280,7 @@ private :
template <typename OffsettedRings>
inline void map_offsetted_rings(OffsettedRings const& offsetted_rings)
{
for(typename boost::range_iterator<OffsettedRings const>::type it
= boost::begin(offsetted_rings); it != boost::end(offsetted_rings); ++it)
for (auto it = boost::begin(offsetted_rings); it != boost::end(offsetted_rings); ++it)
{
if (it->discarded())
{
@ -349,14 +344,7 @@ public :
void map_input_output(Mapper& mapper, Geometry const& geometry,
GeometryBuffer const& buffered, bool negative)
{
bool const areal = boost::is_same
<
typename bg::tag_cast
<
typename bg::tag<Geometry>::type,
bg::areal_tag
>::type, bg::areal_tag
>::type::value;
bool const areal = bg::util::is_areal<Geometry>::value;
if (m_zoom)
{
@ -385,7 +373,7 @@ public :
bg::detail::overlay::assign_null_policy
>(geometry, strategy, rescale_policy, turns, policy);
BOOST_FOREACH(turn_info const& turn, turns)
for (turn_info const& turn : turns)
{
mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 3);
}

View File

@ -2,6 +2,11 @@
// Unit Test Helper
// Copyright (c) 2010-2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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)
@ -132,7 +137,7 @@ public :
return;
}
BOOST_FOREACH(pair_type const& p, points)
for (pair_type const& p : points)
{
mappers.push_back(new mapper_visitor<Point>(complete_caseid, p.second, p.first));
}

View File

@ -5,9 +5,8 @@
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014, 2015.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -91,7 +90,7 @@ void test_2d()
coord_type m = (std::numeric_limits<coord_type>::max)();
bg::append(ls, P(coord_type(m), coord_type(-m)));
bg::append(ls, P(coord_type(0.0001), coord_type(0.000)));
if (BOOST_GEOMETRY_CONDITION((boost::is_same<typename bg::coordinate_type<P>::type, double>::value)))
if (BOOST_GEOMETRY_CONDITION((std::is_same<typename bg::coordinate_type<P>::type, double>::value)))
{
// for doubles the INF is detected and the calculation stopped
// currently for Geometries for which the centroid can't be calculated

View File

@ -2,6 +2,10 @@
// Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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)
@ -9,26 +13,40 @@
#ifndef BOOST_GEOMETRY_TEST_CHECK_VALIDITY_HPP
#define BOOST_GEOMETRY_TEST_CHECK_VALIDITY_HPP
#include <boost/foreach.hpp>
#include <boost/geometry/algorithms/is_valid.hpp>
template<typename Geometry>
inline bool input_is_valid(std::string const& case_id, std::string const& subcase,
Geometry const& geometry)
{
std::string message;
bool const result = bg::is_valid(geometry, message);
if (! result)
{
std::cout << "WARNING: " << case_id << " Input [" << subcase
<< "] is not considered as valid ("
<< message << ") this can cause that output is invalid: "
<< case_id << std::endl;
}
return result;
}
template<typename Geometry, typename G1, typename G2>
inline bool is_output_valid(Geometry const& geometry,
std::string const& case_id,
G1 const& g1, G2 const& g2,
bool ignore_validity_on_invalid_input,
std::string& message)
{
bool const result = bg::is_valid(geometry, message);
if (! result)
bool result = bg::is_valid(geometry, message);
if (! result && ignore_validity_on_invalid_input)
{
// Check if input was valid. If not, do not report output validity
if (! bg::is_valid(g1) || ! bg::is_valid(g2))
if (! input_is_valid(case_id, "a", g1)
|| ! input_is_valid(case_id, "b", g2))
{
std::cout << "WARNING: Input is not considered as valid; "
<< "this can cause that output is invalid: " << case_id
<< std::endl;
return true;
// Because input is invalid, output validity is ignored
result = true;
}
}
return result;
@ -46,9 +64,11 @@ struct check_validity
bool apply(Geometry const& geometry,
std::string const& case_id,
G1 const& g1, G2 const& g2,
std::string& message)
std::string& message,
bool ignore_validity_on_invalid_input = true)
{
return is_output_valid(geometry, case_id, g1, g2, message);
return is_output_valid(geometry, case_id, g1, g2,
ignore_validity_on_invalid_input, message);
}
};
@ -61,12 +81,14 @@ struct check_validity<Geometry, void>
bool apply(Geometry const& geometry,
std::string const& case_id,
G1 const& g1, G2 const& g2,
std::string& message)
std::string& message,
bool ignore_validity_on_invalid_input = true)
{
typedef typename boost::range_value<Geometry>::type single_type;
BOOST_FOREACH(single_type const& element, geometry)
for (single_type const& element : geometry)
{
if (! is_output_valid(element, case_id, g1, g2, message))
if (! is_output_valid(element, case_id, g1, g2,
ignore_validity_on_invalid_input, message))
{
return false;
}

View File

@ -6,9 +6,8 @@
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014, 2017.
// Modifications copyright (c) 2014-2017, Oracle and/or its affiliates.
// This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -22,9 +21,6 @@
#include <sstream>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_same.hpp>
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/comparable_distance.hpp>
@ -188,19 +184,18 @@ struct test_variant_different_default_strategy
variant_type v1, v2;
BOOST_MPL_ASSERT((
boost::is_same
<
typename bg::comparable_distance_result
<
variant_type, variant_type, bg::default_strategy
>::type,
typename bg::comparable_distance_result
<
point_type, point_type, bg::default_strategy
>::type
>
));
using variant_cdistance_t = typename bg::comparable_distance_result
<
variant_type, variant_type, bg::default_strategy
>::type;
using cdistance_t = typename bg::comparable_distance_result
<
point_type, point_type, bg::default_strategy
>::type;
BOOST_GEOMETRY_STATIC_ASSERT(
(std::is_same<variant_cdistance_t, cdistance_t>::value),
"Unexpected result type",
variant_cdistance_t, cdistance_t);
// Default strategy
v1 = point;
@ -261,27 +256,23 @@ struct test_variant_same_default_strategy
variant_type v1, v2;
BOOST_MPL_ASSERT((
boost::is_same
<
typename bg::comparable_distance_result
<
variant_type, variant_type, bg::default_strategy
>::type,
ExpectedResultType
>
));
using variant_cdistance_t = typename bg::comparable_distance_result
<
variant_type, variant_type, bg::default_strategy
>::type;
BOOST_GEOMETRY_STATIC_ASSERT(
(std::is_same<variant_cdistance_t, ExpectedResultType>::value),
"Unexpected result type",
variant_cdistance_t, ExpectedResultType);
BOOST_MPL_ASSERT((
boost::is_same
<
typename bg::comparable_distance_result
<
point_type, point_type, bg::default_strategy
>::type,
ExpectedResultType
>
));
using cdistance_t = typename bg::comparable_distance_result
<
point_type, point_type, bg::default_strategy
>::type;
BOOST_GEOMETRY_STATIC_ASSERT(
(std::is_same<cdistance_t, ExpectedResultType>::value),
"Unexpected result type",
cdistance_t, ExpectedResultType);
// Default strategy
v1 = point;
@ -352,27 +343,23 @@ struct test_variant_with_strategy
strategy_type strategy;
BOOST_MPL_ASSERT((
boost::is_same
<
typename bg::comparable_distance_result
<
variant_type, variant_type, strategy_type
>::type,
ExpectedResultType
>
));
using variant_cdistance_t = typename bg::comparable_distance_result
<
variant_type, variant_type, strategy_type
>::type;
BOOST_GEOMETRY_STATIC_ASSERT(
(std::is_same<variant_cdistance_t, ExpectedResultType>::value),
"Unexpected result type",
variant_cdistance_t, ExpectedResultType);
BOOST_MPL_ASSERT((
boost::is_same
<
typename bg::comparable_distance_result
<
segment_type, linestring_type, strategy_type
>::type,
ExpectedResultType
>
));
using cdistance_t = typename bg::comparable_distance_result
<
segment_type, linestring_type, strategy_type
>::type;
BOOST_GEOMETRY_STATIC_ASSERT(
(std::is_same<cdistance_t, ExpectedResultType>::value),
"Unexpected result type",
cdistance_t, ExpectedResultType);
// Passed strategy
v1 = seg;
@ -422,7 +409,7 @@ struct test_variant_with_strategy
}
};
template <typename T, bool IsIntergral = boost::is_integral<T>::value>
template <typename T, bool IsIntergral = std::is_integral<T>::value>
struct check_result
{
template <typename ExpectedResult>
@ -459,23 +446,21 @@ struct test_variant_boxes
variant_type v1 = box1, v2 = box2;
typedef typename boost::mpl::if_c
typedef typename std::conditional
<
boost::is_float<T>::value,
std::is_floating_point<T>::value,
double,
typename bg::util::detail::default_integral::type
>::type expected_result_type;
BOOST_MPL_ASSERT((
boost::is_same
<
typename bg::comparable_distance_result
<
variant_type, variant_type, bg::default_strategy
>::type,
expected_result_type
>
));
using variant_cdistance_t = typename bg::comparable_distance_result
<
variant_type, variant_type, bg::default_strategy
>::type;
BOOST_GEOMETRY_STATIC_ASSERT(
(std::is_same<variant_cdistance_t, expected_result_type>::value),
"Unexpected result type",
variant_cdistance_t, expected_result_type);
// Default strategy
check_result<T>::apply(bg::comparable_distance(v1, v2),
@ -491,7 +476,7 @@ struct test_variant_boxes
int test_main(int, char* [])
{
test_double_result_from_integer<int>();
test_double_result_from_integer<boost::long_long_type>();
test_double_result_from_integer<long long>();
test_all<bg::model::d2::point_xy<float> >();
test_all<bg::model::d2::point_xy<double> >();

View File

@ -1,6 +1,6 @@
// Boost.Geometry
// Copyright (c) 2016 Oracle and/or its affiliates.
// Copyright (c) 2016-2021 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,
@ -82,12 +82,12 @@ void test_box_box()
template <typename P>
void test_point_polygon()
{
typename boost::mpl::if_
std::conditional_t
<
boost::is_same<typename bg::cs_tag<P>::type, bg::geographic_tag>,
std::is_same<typename bg::cs_tag<P>::type, bg::geographic_tag>::value,
bg::strategy::within::geographic_winding<P>,
bg::strategy::within::spherical_winding<P>
>::type s;
> s;
typedef bg::model::polygon<P> poly;

View File

@ -1,8 +1,7 @@
// Boost.Geometry
// Unit Test
// Copyright (c) 2019, Oracle and/or its affiliates.
// Copyright (c) 2019-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
@ -89,7 +88,7 @@ inline void test_one(std::string const& ring_wkt, bg::order_selector expected)
std::rotate(boost::begin(ring), boost::begin(ring) + 1, boost::end(ring));
// it seems that area method doesn't work for invalid "opened" polygons
//if (! boost::is_same<cs_tag, bg::geographic_tag>::value)
//if (! std::is_same<cs_tag, bg::geographic_tag>::value)
{
P p = bg::range::front(ring);
bg::range::push_back(ring, p);

View File

@ -3,8 +3,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018 Oracle and/or its affiliates.
// This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017-2021 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,
@ -15,19 +15,20 @@
#include <algorithms/test_overlay.hpp>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/intersects.hpp>
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#if defined(TEST_WITH_SVG)
# include <boost/geometry/io/svg/svg_mapper.hpp>
#endif
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/random/linear_congruential.hpp>
#include <boost/random/uniform_int.hpp>
@ -151,7 +152,7 @@ void test_boxes(std::string const& wkt_box_list, double expected_area, int expec
std::vector<sample> boxes;
int index = 1;
BOOST_FOREACH(std::string const& wkt, wkt_boxes)
for (std::string const& wkt : wkt_boxes)
{
boxes.push_back(sample(index++, wkt));
}
@ -229,10 +230,10 @@ void test_points(std::string const& wkt1, std::string const& wkt2, int expected_
bg::read_wkt(wkt2, mp2);
int id = 1;
BOOST_FOREACH(point_item& p, mp1)
for (point_item& p : mp1)
{ p.id = id++; }
id = 1;
BOOST_FOREACH(point_item& p, mp2)
for (point_item& p : mp2)
{ p.id = id++; }
point_visitor visitor;
@ -352,9 +353,9 @@ void test_many_points(int seed, int size, int count)
// Test equality in quadratic loop
int expected_count = 0;
BOOST_FOREACH(point_item const& item1, mp1)
for (point_item const& item1 : mp1)
{
BOOST_FOREACH(point_item const& item2, mp2)
for (point_item const& item2 : mp2)
{
if (bg::equals(item1, item2))
{
@ -395,11 +396,11 @@ void test_many_points(int seed, int size, int count)
BOOST_CHECK_EQUAL(visitor.count, expected_count);
#if defined(TEST_WITH_SVG)
BOOST_FOREACH(point_item const& item, mp1)
for (point_item const& item : mp1)
{
mapper.map(item, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 8);
}
BOOST_FOREACH(point_item const& item, mp2)
for (point_item const& item : mp2)
{
mapper.map(item, "fill:rgb(0,128,255);stroke:rgb(0,0,100);stroke-width:1", 4);
}
@ -447,9 +448,9 @@ void test_many_boxes(int seed, int size, int count)
// Test equality in quadratic loop
int expected_count = 0;
double expected_area = 0.0;
BOOST_FOREACH(box_item<box_type> const& item1, boxes)
for (box_item<box_type> const& item1 : boxes)
{
BOOST_FOREACH(box_item<box_type> const& item2, boxes)
for (box_item<box_type> const& item2 : boxes)
{
if (item1.id < item2.id)
{
@ -478,7 +479,7 @@ void test_many_boxes(int seed, int size, int count)
p.x = size + 1; p.y = size + 1; mapper.add(p);
}
BOOST_FOREACH(box_item<box_type> const& item, boxes)
for (box_item<box_type> const& item : boxes)
{
mapper.map(item.box, "opacity:0.6;fill:rgb(50,50,210);stroke:rgb(0,0,0);stroke-width:1");
}
@ -515,9 +516,9 @@ void test_two_collections(int seed1, int seed2, int size, int count)
// Get expectations in quadratic loop
int expected_count = 0;
double expected_area = 0.0;
BOOST_FOREACH(box_item<box_type> const& item1, boxes1)
for (box_item<box_type> const& item1 : boxes1)
{
BOOST_FOREACH(box_item<box_type> const& item2, boxes2)
for (box_item<box_type> const& item2 : boxes2)
{
if (bg::intersects(item1.box, item2.box))
{
@ -543,11 +544,11 @@ void test_two_collections(int seed1, int seed2, int size, int count)
p.x = size + 1; p.y = size + 1; mapper.add(p);
}
BOOST_FOREACH(box_item<box_type> const& item, boxes1)
for (box_item<box_type> const& item : boxes1)
{
mapper.map(item.box, "opacity:0.6;fill:rgb(50,50,210);stroke:rgb(0,0,0);stroke-width:1");
}
BOOST_FOREACH(box_item<box_type> const& item, boxes2)
for (box_item<box_type> const& item : boxes2)
{
mapper.map(item.box, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
}
@ -584,9 +585,9 @@ void test_heterogenuous_collections(int seed1, int seed2, int size, int count)
// Get expectations in quadratic loop
int expected_count = 0;
BOOST_FOREACH(point_item const& point, points)
for (point_item const& point : points)
{
BOOST_FOREACH(box_item<box_type> const& box_item, boxes)
for (box_item<box_type> const& box_item : boxes)
{
if (bg::within(point, box_item.box))
{
@ -609,11 +610,11 @@ void test_heterogenuous_collections(int seed1, int seed2, int size, int count)
p.x = size + 1; p.y = size + 1; mapper.add(p);
}
BOOST_FOREACH(point_item const& point, points)
for (point_item const& point : points)
{
mapper.map(point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 8);
}
BOOST_FOREACH(box_item<box_type> const& item, boxes)
for (box_item<box_type> const& item : boxes)
{
mapper.map(item.box, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
}

View File

@ -11,7 +11,7 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <iostream>
#include <string>
#define BOOST_GEOMETRY_UNIT_TEST_SECTIONALIZE
@ -58,7 +58,7 @@ void test_sectionalize(std::string const /*caseid*/, Geometry const& geometry, s
view_type const
>::type range_iterator;
BOOST_FOREACH(typename sections::value_type const& sec, s)
for (typename sections::value_type const& sec : s)
{
cview_type cview(bg::range_by_section(geometry, sec));
view_type view(cview);

View File

@ -5,8 +5,8 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, Oracle and/or its affiliates.
// This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -102,7 +102,7 @@ void test_sectionalize(std::string const& caseid, G const& g, std::size_t sectio
// Check if sections are consecutive and consistent
int previous_index = -1;
BOOST_FOREACH(typename sections::value_type const& sec, s)
for (typename sections::value_type const& sec : s)
{
if (sec.begin_index > 0)
{

View File

@ -1,8 +1,7 @@
// Boost.Geometry
// Unit Test
// Copyright (c) 2019 Oracle and/or its affiliates.
// Copyright (c) 2019-2021 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,
@ -34,14 +33,14 @@ template <typename TupleM, typename TupleS>
void test_range_values()
{
typedef typename bgd::tupled_range_values<TupleM>::type tuple_s;
BOOST_CHECK_EQUAL((boost::is_same<tuple_s, TupleS>::value), true);
BOOST_CHECK_EQUAL((std::is_same<tuple_s, TupleS>::value), true);
}
template <typename TupleM, typename TupleBI>
void test_back_inserters()
{
typedef typename bgd::tupled_back_inserters<TupleM>::type tuple_bi;
BOOST_CHECK_EQUAL((boost::is_same<tuple_bi, TupleBI>::value), true);
BOOST_CHECK_EQUAL((std::is_same<tuple_bi, TupleBI>::value), true);
TupleM tup;
bgd::tupled_back_inserters<TupleM>::apply(tup);

View File

@ -5,6 +5,9 @@
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -20,8 +23,6 @@
#include "test_distance.hpp"
#include <boost/array.hpp>
#include <boost/mpl/if.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
@ -81,7 +82,10 @@ void test_distance_point()
BOOST_CONCEPT_ASSERT( (bg::concepts::PointDistanceStrategy<taxicab_distance, P, P>) );
typedef typename services::return_type<taxicab_distance, P, P>::type cab_return_type;
BOOST_MPL_ASSERT((boost::is_same<cab_return_type, typename bg::coordinate_type<P>::type>));
BOOST_GEOMETRY_STATIC_ASSERT(
(std::is_same<cab_return_type, typename bg::coordinate_type<P>::type>::value),
"Unexpected result type",
cab_return_type, typename bg::coordinate_type<P>::type);
taxicab_distance tcd;
cab_return_type d = bg::distance(p1, p2, tcd);
@ -412,8 +416,8 @@ void test_large_integers()
bg::read_wkt(a, da);
bg::read_wkt(b, db);
BOOST_AUTO(idist, bg::distance(ia, ib));
BOOST_AUTO(ddist, bg::distance(da, db));
auto const idist = bg::distance(ia, ib);
auto const ddist = bg::distance(da, db);
BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1,
"within<a double> different from within<an int>");
@ -431,8 +435,8 @@ void test_large_integers()
bg::read_wkt(a, da);
bg::read_wkt(b, db);
BOOST_AUTO(idist, bg::distance(ia, ib));
BOOST_AUTO(ddist, bg::distance(da, db));
auto const idist = bg::distance(ia, ib);
auto const ddist = bg::distance(da, db);
BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1,
"within<a double> different from within<an int>");
@ -457,16 +461,14 @@ void test_variant()
variant_type v1, v2;
BOOST_MPL_ASSERT((
boost::is_same
<
typename bg::distance_result
<
variant_type, variant_type, bg::default_strategy
>::type,
double
>
));
using distance_t = typename bg::distance_result
<
variant_type, variant_type, bg::default_strategy
>::type;
BOOST_GEOMETRY_STATIC_ASSERT(
(std::is_same<distance_t, double>::value),
"Unexpected result type",
distance_t, double);
// Default strategy
v1 = point;

View File

@ -1,8 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2014-2020 Oracle and/or its affiliates.
// Copyright (c) 2014-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -15,8 +14,6 @@
#include <iterator>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/or.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/value_type.hpp>
@ -46,17 +43,13 @@ struct distance_from_bg
{
template <typename G>
struct use_distance_from_bg
{
typedef typename boost::mpl::or_
: util::bool_constant
<
boost::is_same<typename tag<G>::type, point_tag>,
typename boost::mpl::or_
<
boost::is_same<typename tag<G>::type, segment_tag>,
boost::is_same<typename tag<G>::type, box_tag>
>::type
>::type type;
};
std::is_same<typename tag<G>::type, point_tag>::value
|| std::is_same<typename tag<G>::type, segment_tag>::value
|| std::is_same<typename tag<G>::type, box_tag>::value
>
{};
template <typename Geometry1, typename Geometry2, typename Strategy>
static inline
@ -65,8 +58,12 @@ struct distance_from_bg
Geometry2 const& geometry2,
Strategy const& strategy)
{
BOOST_MPL_ASSERT((typename use_distance_from_bg<Geometry1>::type));
BOOST_MPL_ASSERT((typename use_distance_from_bg<Geometry2>::type));
BOOST_GEOMETRY_STATIC_ASSERT((use_distance_from_bg<Geometry1>::value),
"Unexpected kind of Geometry1",
Geometry1);
BOOST_GEOMETRY_STATIC_ASSERT((use_distance_from_bg<Geometry2>::value),
"Unexpected kind of Geometry2",
Geometry2);
return geometry::distance(geometry1, geometry2, strategy);
}

View File

@ -1,25 +1,24 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2017-2020 Oracle and/or its affiliates.
// Copyright (c) 2017-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifdef BOOST_GEOMETRY_TEST_DEBUG
#include <iostream>
#endif
#include <string>
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_linear_areal
#endif
#include <boost/type_traits/is_same.hpp>
#include <boost/test/included/unit_test.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include "test_distance_geo_common.hpp"
//#include "test_empty_geometry.hpp"

View File

@ -1,8 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2017-2020 Oracle and/or its affiliates.
// Copyright (c) 2017-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -13,11 +12,7 @@
#define BOOST_TEST_MODULE test_distance_geographic_areal_areal
#endif
#include <boost/type_traits/is_same.hpp>
#include <boost/test/included/unit_test.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include "test_distance_geo_common.hpp"
#include "test_empty_geometry.hpp"

View File

@ -1,25 +1,22 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2017-2020 Oracle and/or its affiliates.
// Copyright (c) 2017-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifdef BOOST_GEOMETRY_TEST_DEBUG
#include <iostream>
#endif
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_linear_areal
#endif
#include <boost/type_traits/is_same.hpp>
#include <boost/test/included/unit_test.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include "test_distance_geo_common.hpp"
#include "test_empty_geometry.hpp"

View File

@ -1,25 +1,22 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2018-2020 Oracle and/or its affiliates.
// Copyright (c) 2018-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifdef BOOST_GEOMETRY_TEST_DEBUG
#include <iostream>
#endif
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_linear_linear
#endif
#include <boost/type_traits/is_same.hpp>
#include <boost/test/included/unit_test.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include "test_distance_geo_common.hpp"
#include "test_empty_geometry.hpp"

View File

@ -1,25 +1,22 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2017-2020, Oracle and/or its affiliates.
// Copyright (c) 2017-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifdef BOOST_GEOMETRY_TEST_DEBUG
#include <iostream>
#endif
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_pointlike_areal
#endif
#include <boost/type_traits/is_same.hpp>
#include <boost/test/included/unit_test.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include "test_distance_geo_common.hpp"
#include "test_empty_geometry.hpp"

View File

@ -1,8 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2014-2017, Oracle and/or its affiliates.
// Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -16,28 +15,16 @@
#include <string>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/algorithms/comparable_distance.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/algorithms/comparable_distance.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <from_wkt.hpp>
@ -207,11 +194,11 @@ private:
Strategy, G1, G2
>::type distance_result_from_strategy;
static const bool same_regular = boost::is_same
static const bool same_regular = std::is_same
<
default_distance_result,
distance_result_from_strategy
>::type::value;
>::value;
BOOST_CHECK( same_regular );
@ -231,11 +218,11 @@ private:
G2
>::type comparable_distance_result_from_strategy;
static const bool same_comparable = boost::is_same
static const bool same_comparable = std::is_same
<
default_comparable_distance_result,
comparable_distance_result_from_strategy
>::type::value;
>::value;
BOOST_CHECK( same_comparable );

View File

@ -1,9 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2016-2017, Oracle and/or its affiliates.
// Copyright (c) 2016-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
@ -14,29 +14,18 @@
#include <iostream>
#include <string>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/util/condition.hpp>
#include <from_wkt.hpp>
#include <string_from_type.hpp>
@ -229,7 +218,7 @@ template <typename Tag> struct dispatch
};
// Specialization for segments
template <> struct dispatch<boost::geometry::segment_tag>
template <> struct dispatch<bg::segment_tag>
{
template <typename Segment>
static inline Segment swap(Segment const& s)
@ -259,7 +248,7 @@ template <> struct dispatch<boost::geometry::segment_tag>
};
// Specialization for boxes
template <> struct dispatch<boost::geometry::box_tag>
template <> struct dispatch<bg::box_tag>
{
template <typename T>
static inline T swap(T const& t)
@ -283,7 +272,7 @@ template <> struct dispatch<boost::geometry::box_tag>
// Specialization for points
template <> struct dispatch<boost::geometry::point_tag>
template <> struct dispatch<bg::point_tag>
{
template <typename T>
static inline T swap(T const& t)
@ -412,11 +401,11 @@ struct test_distance_of_geometries<Geometry1, Geometry2, 0, 0>
Strategy, Geometry1, Geometry2
>::type distance_result_from_strategy;
static const bool same_regular = boost::is_same
static const bool same_regular = std::is_same
<
default_distance_result,
distance_result_from_strategy
>::type::value;
>::value;
BOOST_CHECK(same_regular);
@ -482,12 +471,12 @@ struct test_distance_of_geometries<Geometry1, Geometry2, 0, 0>
{
Geometry1 g1 = dispatch
<
typename boost::geometry::tag<Geometry1>::type
typename bg::tag<Geometry1>::type
>::swap(geometry1);
Geometry2 g2 = dispatch
<
typename boost::geometry::tag<Geometry2>::type
typename bg::tag<Geometry2>::type
>::swap(geometry2);
// check distance with given strategy
@ -510,12 +499,12 @@ struct test_distance_of_geometries<Geometry1, Geometry2, 0, 0>
{
Geometry1 g1 = dispatch
<
typename boost::geometry::tag<Geometry1>::type
typename bg::tag<Geometry1>::type
>::mirror(geometry1);
Geometry2 g2 = dispatch
<
typename boost::geometry::tag<Geometry2>::type
typename bg::tag<Geometry2>::type
>::mirror(geometry2);
// check distance with given strategy

Some files were not shown because too many files have changed in this diff Show More