Merge branch 'develop'

This commit is contained in:
Vissarion Fisikopoulos 2025-03-18 15:37:44 +02:00
commit 2ef239ce3b
29 changed files with 377 additions and 131 deletions

View File

@ -21,6 +21,7 @@
#include <cstddef>
#include <vector>
#include <boost/core/ignore_unused.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/value_type.hpp>
@ -66,6 +67,8 @@ inline void display(MetaTurn const& meta_turn, const char* reason = "")
//<< " -> " << op_index
<< " " << reason
<< std::endl;
#else
boost::ignore_unused(meta_turn, reason);
#endif
}

View File

@ -189,8 +189,7 @@ private:
public:
template <typename T>
static inline return_type apply(this_strategy const& strategy,
T const& distance)
static inline return_type apply(this_strategy const& , T const& distance)
{
return static_cast<return_type>(distance);
}

View File

@ -1,7 +1,8 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2015-2020, Oracle and/or its affiliates.
// Copyright (c) 2015-2025, 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
@ -123,7 +124,7 @@ struct assign_loop<1, DimensionCount>
template <typename PointIn, typename PointOut, bool IsEquatorial = true>
struct normalize_point
{
static inline void apply(PointIn const& point_in, PointOut& point_out)
static inline void apply(PointIn const& point_in, PointOut& point_out, bool exact = true)
{
using in_coordinate_type = coordinate_type_t<PointIn>;
@ -135,7 +136,7 @@ struct normalize_point
typename geometry::detail::cs_angular_units<PointIn>::type,
IsEquatorial,
in_coordinate_type
>(longitude, latitude);
>(longitude, latitude, exact);
assign_loop
<
@ -221,13 +222,13 @@ struct cartesian_box
struct spherical_point
{
template <typename PointIn, typename PointOut>
static inline void apply(PointIn const& point_in, PointOut& point_out)
static inline void apply(PointIn const& point_in, PointOut& point_out, bool exact = true)
{
detail::normalize_point
<
PointIn, PointOut,
(! std::is_same<cs_tag_t<PointIn>, spherical_polar_tag>::value)
>::apply(point_in, point_out);
>::apply(point_in, point_out, exact);
}
};

View File

@ -5,11 +5,12 @@
// 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-2025.
// Modifications copyright (c) 2013-2025, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -67,13 +68,14 @@ private:
{
static inline bool apply(Point1 const& point1, Point2 const& point2)
{
typedef typename helper_geometry<Point1>::type helper_point_type1;
typedef typename helper_geometry<Point2>::type helper_point_type2;
using helper_point_type1 = typename helper_geometry<Point1>::type;
using helper_point_type2 = typename helper_geometry<Point2>::type;
helper_point_type1 point1_normalized;
strategy::normalize::spherical_point::apply(point1, point1_normalized);
bool const exact_normalized = false;
strategy::normalize::spherical_point::apply(point1, point1_normalized, exact_normalized);
helper_point_type2 point2_normalized;
strategy::normalize::spherical_point::apply(point2, point2_normalized);
strategy::normalize::spherical_point::apply(point2, point2_normalized, exact_normalized);
return point_point_generic
<
@ -87,11 +89,11 @@ private:
{
static inline bool apply(Point1 const& point1, Point2 const& point2)
{
typedef typename geometry::select_most_precise
using calculation_type = typename geometry::select_most_precise
<
typename fp_coordinate_type<Point1>::type,
typename fp_coordinate_type<Point2>::type
>::type calculation_type;
>::type;
typename helper_geometry
<
@ -149,7 +151,7 @@ namespace services
template <typename PointLike1, typename PointLike2, typename Tag1, typename Tag2>
struct default_strategy<PointLike1, PointLike2, Tag1, Tag2, pointlike_tag, pointlike_tag, spherical_tag, spherical_tag>
{
typedef strategy::within::spherical_point_point type;
using type = strategy::within::spherical_point_point;
};
} // namespace services
@ -166,7 +168,7 @@ namespace strategy { namespace covered_by { namespace services
template <typename PointLike1, typename PointLike2, typename Tag1, typename Tag2>
struct default_strategy<PointLike1, PointLike2, Tag1, Tag2, pointlike_tag, pointlike_tag, spherical_tag, spherical_tag>
{
typedef strategy::within::spherical_point_point type;
using type = strategy::within::spherical_point_point;
};
}}} // namespace strategy::covered_by::services

View File

@ -33,6 +33,7 @@
#include <boost/geometry/strategies/compare.hpp>
#include <boost/geometry/strategies/side.hpp>
#include <boost/geometry/util/promote_integral.hpp>
#include <boost/geometry/util/select_calculation_type.hpp>
#include <boost/geometry/util/select_most_precise.hpp>
@ -205,23 +206,29 @@ public :
template <typename P1, typename P2, typename P>
static inline int apply(P1 const& p1, P2 const& p2, P const& p)
{
using coor_t = typename select_calculation_type_alt<CalculationType, P1, P2, P>::type;
// Promote float->double, small int->int
using promoted_t = typename select_most_precise<coor_t, double>::type;
bool const are_all_integral_coordinates =
constexpr bool are_all_integral_coordinates =
std::is_integral<coordinate_type_t<P1>>::value
&& std::is_integral<coordinate_type_t<P2>>::value
&& std::is_integral<coordinate_type_t<P>>::value;
// Promote float to double
// For integer: short -> int -> long
// For larger integers: long, long long, std::int64_t all stay as they are (on a Mac)
using coor_t = typename select_calculation_type_alt<CalculationType, P1, P2, P>::type;
using promoted_t = std::conditional_t
<
are_all_integral_coordinates,
typename promote_integral<coor_t>::type,
typename select_most_precise<coor_t, double>::type
>;
eps_policy< math::detail::equals_factor_policy<promoted_t> > epsp;
promoted_t s = compute_side_value
promoted_t const s = compute_side_value
<
coor_t, promoted_t, are_all_integral_coordinates
>::apply(p1, p2, p, epsp);
promoted_t const zero = promoted_t();
static promoted_t const zero = promoted_t();
return math::detail::equals_by_policy(s, zero, epsp.policy) ? 0
: s > zero ? 1
: -1;

View File

@ -2,8 +2,9 @@
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2015-2022, Oracle and/or its affiliates.
// Copyright (c) 2015-2025, 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
// Contributed and/or modified by Adeel Ahmad, as part of Google Summer of Code 2018 program
@ -151,11 +152,7 @@ struct constants_on_spheroid<CoordinateType, degree, false>
template <typename Units, typename CoordinateType>
inline CoordinateType latitude_convert_ep(CoordinateType const& lat)
{
typedef math::detail::constants_on_spheroid
<
CoordinateType,
Units
> constants;
using constants = math::detail::constants_on_spheroid<CoordinateType, Units>;
return constants::quarter_period() - lat;
}
@ -164,31 +161,21 @@ inline CoordinateType latitude_convert_ep(CoordinateType const& lat)
template <typename Units, bool IsEquatorial, typename T>
static bool is_latitude_pole(T const& lat)
{
typedef math::detail::constants_on_spheroid
<
T,
Units
> constants;
using constants = math::detail::constants_on_spheroid<T, Units>;
return math::equals(math::abs(IsEquatorial
? lat
: math::latitude_convert_ep<Units>(lat)),
constants::quarter_period());
}
template <typename Units, typename T>
static bool is_longitude_antimeridian(T const& lon)
{
typedef math::detail::constants_on_spheroid
<
T,
Units
> constants;
using constants = math::detail::constants_on_spheroid<T, Units>;
return math::equals(math::abs(lon), constants::half_period());
}
@ -218,7 +205,7 @@ struct latitude_convert_if_polar<Units, false>
template <typename Units, typename CoordinateType, bool IsEquatorial = true>
class normalize_spheroidal_coordinates
{
typedef constants_on_spheroid<CoordinateType, Units> constants;
using constants = constants_on_spheroid<CoordinateType, Units>;
protected:
static inline CoordinateType normalize_up(CoordinateType const& value)
@ -236,17 +223,22 @@ protected:
}
public:
static inline void apply(CoordinateType& longitude)
static inline void apply(CoordinateType& longitude, bool exact = true)
{
// normalize longitude
if (math::equals(math::abs(longitude), constants::half_period()))
CoordinateType const epsilon = std::numeric_limits<float>::epsilon();
static constexpr bool is_integer = std::numeric_limits<CoordinateType>::is_integer;
if (exact || is_integer ? math::equals(math::abs(longitude), constants::half_period())
: math::abs(math::abs(longitude) - constants::half_period()) <= epsilon)
{
longitude = constants::half_period();
}
else if (longitude > constants::half_period())
{
longitude = normalize_up(longitude);
if (math::equals(longitude, -constants::half_period()))
if (exact || is_integer ? math::equals(longitude, -constants::half_period())
: math::abs(longitude + constants::half_period()) <= epsilon)
{
longitude = constants::half_period();
}
@ -259,7 +251,8 @@ public:
static inline void apply(CoordinateType& longitude,
CoordinateType& latitude,
bool normalize_poles = true)
bool normalize_poles = true,
bool exact = true)
{
latitude_convert_if_polar<Units, IsEquatorial>::apply(latitude);
@ -288,7 +281,7 @@ public:
#endif // BOOST_GEOMETRY_NORMALIZE_LATITUDE
// normalize longitude
apply(longitude);
apply(longitude, exact);
// finally normalize poles
if (normalize_poles)
@ -317,7 +310,7 @@ public:
template <typename Units, typename CoordinateType>
inline void normalize_angle_loop(CoordinateType& angle)
{
typedef constants_on_spheroid<CoordinateType, Units> constants;
using constants = constants_on_spheroid<CoordinateType, Units>;
CoordinateType const pi = constants::half_period();
CoordinateType const two_pi = constants::period();
while (angle > pi)
@ -329,7 +322,7 @@ inline void normalize_angle_loop(CoordinateType& angle)
template <typename Units, typename CoordinateType>
inline void normalize_angle_cond(CoordinateType& angle)
{
typedef constants_on_spheroid<CoordinateType, Units> constants;
using constants = constants_on_spheroid<CoordinateType, Units>;
CoordinateType const pi = constants::half_period();
CoordinateType const two_pi = constants::period();
if (angle > pi)
@ -353,22 +346,24 @@ inline void normalize_angle_cond(CoordinateType& angle)
*/
template <typename Units, typename CoordinateType>
inline void normalize_spheroidal_coordinates(CoordinateType& longitude,
CoordinateType& latitude)
CoordinateType& latitude,
bool exact = true)
{
detail::normalize_spheroidal_coordinates
<
Units, CoordinateType
>::apply(longitude, latitude);
>::apply(longitude, latitude, true, exact);
}
template <typename Units, bool IsEquatorial, typename CoordinateType>
inline void normalize_spheroidal_coordinates(CoordinateType& longitude,
CoordinateType& latitude)
CoordinateType& latitude,
bool exact = true)
{
detail::normalize_spheroidal_coordinates
<
Units, CoordinateType, IsEquatorial
>::apply(longitude, latitude);
>::apply(longitude, latitude, true, exact);
}
/*!
@ -381,12 +376,12 @@ inline void normalize_spheroidal_coordinates(CoordinateType& longitude,
\ingroup utility
*/
template <typename Units, typename CoordinateType>
inline void normalize_longitude(CoordinateType& longitude)
inline void normalize_longitude(CoordinateType& longitude, bool exact = true)
{
detail::normalize_spheroidal_coordinates
<
Units, CoordinateType
>::apply(longitude);
>::apply(longitude, exact);
}
/*!
@ -400,7 +395,7 @@ inline void normalize_longitude(CoordinateType& longitude)
template <typename Units, typename CoordinateType>
inline void normalize_azimuth(CoordinateType& angle)
{
normalize_longitude<Units, CoordinateType>(angle);
math::normalize_longitude<Units, CoordinateType>(angle, true);
}
/*!
@ -435,7 +430,7 @@ inline CoordinateType longitude_distance_signed(CoordinateType const& longitude1
CoordinateType const& longitude2)
{
CoordinateType diff = longitude2 - longitude1;
math::normalize_longitude<Units, CoordinateType>(diff);
math::normalize_longitude<Units, CoordinateType>(diff, true);
return diff;
}
@ -453,10 +448,7 @@ template <typename Units, typename CoordinateType>
inline CoordinateType longitude_distance_unsigned(CoordinateType const& longitude1,
CoordinateType const& longitude2)
{
typedef math::detail::constants_on_spheroid
<
CoordinateType, Units
> constants;
using constants = math::detail::constants_on_spheroid<CoordinateType, Units>;
CoordinateType const c0 = 0;
CoordinateType diff = longitude_distance_signed<Units>(longitude1, longitude2);

View File

@ -11,11 +11,11 @@
#ifndef BOOST_GEOMETRY_UTIL_PROMOTE_INTEGRAL_HPP
#define BOOST_GEOMETRY_UTIL_PROMOTE_INTEGRAL_HPP
// For now deactivate the use of multiprecision integers
// TODO: activate it later
// Uncommenting this macro will use Boost.Multiprecision's cpp_int<> as a last resort
// TODO (#1380): change this to BOOST_GEOMETRY_PROMOTE_INTEGER_TO_BOOST_MULTI_PRECISION
// to be able to let users actively choose to use Boost.Multiprecision, but not enable it by default
#define BOOST_GEOMETRY_NO_MULTIPRECISION_INTEGER
#include <climits>
#include <cstddef>
#include <type_traits>

View File

@ -101,16 +101,16 @@ struct coordinate_cast<rational<T> >
template <typename T1, typename T2>
struct select_most_precise<boost::rational<T1>, boost::rational<T2> >
{
typedef typename boost::rational
using type = typename boost::rational
<
typename select_most_precise<T1, T2>::type
> type;
> ;
};
template <typename T>
struct select_most_precise<boost::rational<T>, double>
{
typedef typename boost::rational<T> type;
using type = typename boost::rational<T>;
};
namespace util

View File

@ -14,8 +14,11 @@ foreach(item IN ITEMS
rtree_move_pack
rtree_non_cartesian
rtree_values
rtree_with_strategies
#compile-fail rtree_values_invalid
)
boost_geometry_add_unit_test("index" ${item})
endforeach()
add_subdirectory(exceptions)
add_subdirectory(generated)
add_subdirectory(strategies)

View File

@ -9,6 +9,7 @@
build-project exceptions ;
build-project interprocess ;
build-project generated ;
build-project strategies ;
test-suite boost-geometry-index-rtree
:
@ -19,6 +20,5 @@ test-suite boost-geometry-index-rtree
[ run rtree_move_pack.cpp ]
[ run rtree_non_cartesian.cpp ]
[ run rtree_values.cpp ]
[ compile rtree_with_strategies.cpp ]
[ compile-fail rtree_values_invalid.cpp ]
;

View File

@ -0,0 +1,15 @@
# Boost.Geometry
# Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
# Copyright (c) 2024, Oracle and/or its affiliates.
# Contributed and/or modified by Vissarion Fysikopoulos, 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)
foreach(item IN ITEMS
rtree_exceptions_lin
rtree_exceptions_qua
rtree_exceptions_rst
)
boost_geometry_add_unit_test("index" ${item})
endforeach()

View File

@ -0,0 +1,7 @@
# Boost.Geometry
# Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
# 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)
add_subdirectory(b2d)

View File

@ -0,0 +1,19 @@
# Boost.Geometry
# Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
# 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)
foreach(item IN ITEMS
rtree_lin_add_b2d
rtree_lin_mod_b2d
rtree_lin_que_b2d
rtree_qua_add_b2d
rtree_qua_mod_b2d
rtree_qua_que_b2d
rtree_rst_add_b2d
rtree_rst_mod_b2d
rtree_rst_que_b2d
)
boost_geometry_add_unit_test("index" ${item})
endforeach()

View File

@ -0,0 +1,19 @@
# Boost.Geometry
# Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
# 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)
foreach(item IN ITEMS
rtree_with_strategies_b_l
rtree_with_strategies_b_q
rtree_with_strategies_b_r
rtree_with_strategies_p_l
rtree_with_strategies_p_q
rtree_with_strategies_p_r
rtree_with_strategies_s_l
rtree_with_strategies_s_q
rtree_with_strategies_s_r
)
boost_geometry_add_unit_test("index" ${item})
endforeach()

View File

@ -0,0 +1,20 @@
# Boost.Geometry Index
#
# Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
#
# 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)
test-suite boost-geometry-index-rtree-strategies
:
[ compile rtree_with_strategies_b_l.cpp ]
[ compile rtree_with_strategies_b_q.cpp ]
[ compile rtree_with_strategies_b_r.cpp ]
[ compile rtree_with_strategies_p_l.cpp ]
[ compile rtree_with_strategies_p_q.cpp ]
[ compile rtree_with_strategies_p_r.cpp ]
[ compile rtree_with_strategies_s_l.cpp ]
[ compile rtree_with_strategies_s_q.cpp ]
[ compile rtree_with_strategies_s_r.cpp ]
;

View File

@ -7,6 +7,9 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_INDEX_TEST_RTREE_STRATEGIES_HPP
#define BOOST_GEOMETRY_INDEX_TEST_RTREE_STRATEGIES_HPP
#include <vector>
#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_PREDICATES
@ -132,7 +135,7 @@ void test_strategies()
}
template <typename Value, typename Params>
void test_params()
void test_rtree()
{
test_strategies<Value, Params, bg::strategies::index::cartesian<>>();
test_strategies<Value, Params, bg::strategies::cartesian<>>();
@ -142,19 +145,4 @@ void test_params()
test_strategies<Value, Params, bg::strategies::geographic<>>();
}
template <typename Value>
void test_value()
{
test_params<Value, bgi::linear<4>>();
test_params<Value, bgi::quadratic<4>>();
test_params<Value, bgi::rstar<4>>();
}
int test_main(int, char* [])
{
test_value<point>();
test_value<box>();
test_value<segment>();
return 0;
}
#endif // BOOST_GEOMETRY_INDEX_TEST_RTREE_STRATEGIES_HPP

View File

@ -0,0 +1,17 @@
// Boost.Geometry Index
// Unit Test
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
// 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)
#include "rtree_with_strategies.hpp"
int test_main(int, char* [])
{
test_rtree<box, bgi::linear<4>>();
return 0;
}

View File

@ -0,0 +1,17 @@
// Boost.Geometry Index
// Unit Test
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
// 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)
#include "rtree_with_strategies.hpp"
int test_main(int, char* [])
{
test_rtree<box, bgi::quadratic<4>>();
return 0;
}

View File

@ -0,0 +1,17 @@
// Boost.Geometry Index
// Unit Test
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
// 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)
#include "rtree_with_strategies.hpp"
int test_main(int, char* [])
{
test_rtree<box, bgi::rstar<4>>();
return 0;
}

View File

@ -0,0 +1,17 @@
// Boost.Geometry Index
// Unit Test
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
// 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)
#include "rtree_with_strategies.hpp"
int test_main(int, char* [])
{
test_rtree<point, bgi::linear<4>>();
return 0;
}

View File

@ -0,0 +1,17 @@
// Boost.Geometry Index
// Unit Test
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
// 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)
#include "rtree_with_strategies.hpp"
int test_main(int, char* [])
{
test_rtree<point, bgi::quadratic<4>>();
return 0;
}

View File

@ -0,0 +1,17 @@
// Boost.Geometry Index
// Unit Test
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
// 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)
#include "rtree_with_strategies.hpp"
int test_main(int, char* [])
{
test_rtree<point, bgi::rstar<4>>();
return 0;
}

View File

@ -0,0 +1,17 @@
// Boost.Geometry Index
// Unit Test
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
// 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)
#include "rtree_with_strategies.hpp"
int test_main(int, char* [])
{
test_rtree<segment, bgi::linear<4>>();
return 0;
}

View File

@ -0,0 +1,17 @@
// Boost.Geometry Index
// Unit Test
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
// 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)
#include "rtree_with_strategies.hpp"
int test_main(int, char* [])
{
test_rtree<segment, bgi::quadratic<4>>();
return 0;
}

View File

@ -0,0 +1,17 @@
// Boost.Geometry Index
// Unit Test
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
// 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)
#include "rtree_with_strategies.hpp"
int test_main(int, char* [])
{
test_rtree<segment, bgi::rstar<4>>();
return 0;
}

View File

@ -1,7 +1,8 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit test
// Copyright (c) 2015, Oracle and/or its affiliates.
// Copyright (c) 2015-2025, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
@ -129,7 +130,7 @@ struct test_point_point_with_height
template <typename P>
void test_segment_segment(std::string const& header)
{
typedef bgm::segment<P> seg;
using seg = bgm::segment<P>;
std::string const str = header + "-";
@ -158,7 +159,7 @@ void test_segment_segment(std::string const& header)
BOOST_AUTO_TEST_CASE( equals_point_point_se )
{
typedef bg::cs::spherical_equatorial<bg::degree> cs_type;
using cs_type = bg::cs::spherical_equatorial<bg::degree>;
test_point_point<bgm::point<int, 2, cs_type> >::apply("se");
test_point_point<bgm::point<double, 2, cs_type> >::apply("se");
@ -176,9 +177,36 @@ BOOST_AUTO_TEST_CASE( equals_point_point_se )
>::apply("se");
}
template <typename T>
std::string to_string_with_precision(const T value, const int precision = 15)
{
std::ostringstream out;
out << std::fixed << std::setprecision(precision) << value;
return out.str();
}
void test_pp_rad(double half_pi)
{
using cs_radian = bg::cs::spherical_equatorial<bg::radian>;
using P = bgm::point<double, 2, cs_radian>;
test_geometry<P, P>("ser_pp_half_pi",
"POINT(" + to_string_with_precision(-half_pi) + " 0)",
"POINT(" + to_string_with_precision(half_pi) + " 0)", true);
}
BOOST_AUTO_TEST_CASE( equals_point_point_radian )
{
test_pp_rad(bg::math::d2r<float>() * 180);
// half pi value with less accuracy
test_pp_rad(-3.14159265358979);
// convert from degrees to radians with constant from epsg 4326 (WGS84)
test_pp_rad(0.017453292519943278 * 180);
}
BOOST_AUTO_TEST_CASE( equals_point_point_with_height_se )
{
typedef bg::cs::spherical_equatorial<bg::degree> cs_type;
using cs_type = bg::cs::spherical_equatorial<bg::degree>;
test_point_point<bgm::point<int, 3, cs_type> >::apply("seh");
test_point_point<bgm::point<double, 3, cs_type> >::apply("seh");
@ -198,7 +226,7 @@ BOOST_AUTO_TEST_CASE( equals_point_point_with_height_se )
BOOST_AUTO_TEST_CASE( equals_point_point_geo )
{
typedef bg::cs::geographic<bg::degree> cs_type;
using cs_type = bg::cs::geographic<bg::degree>;
test_point_point<bgm::point<int, 2, cs_type> >::apply("geo");
test_point_point<bgm::point<double, 2, cs_type> >::apply("geo");
@ -218,7 +246,7 @@ BOOST_AUTO_TEST_CASE( equals_point_point_geo )
BOOST_AUTO_TEST_CASE( equals_segment_segment_se )
{
typedef bg::cs::spherical_equatorial<bg::degree> cs_type;
using cs_type = bg::cs::spherical_equatorial<bg::degree>;
test_segment_segment<bgm::point<int, 2, cs_type> >("se");
test_segment_segment<bgm::point<double, 2, cs_type> >("se");
@ -227,7 +255,7 @@ BOOST_AUTO_TEST_CASE( equals_segment_segment_se )
BOOST_AUTO_TEST_CASE( equals_segment_segment_geo )
{
typedef bg::cs::geographic<bg::degree> cs_type;
using cs_type = bg::cs::geographic<bg::degree>;
test_segment_segment<bgm::point<int, 2, cs_type> >("geo");
test_segment_segment<bgm::point<double, 2, cs_type> >("geo");

View File

@ -24,7 +24,7 @@ void test_radian()
boost::geometry::strategies::relate::geographic<> wgs84(sph_wgs84);
test_geometry<ls, mls>(
"LINESTRING(0 0, -3.14159265358979 0)",
"LINESTRING(0 0,-3.14159265358979 0)",
"MULTILINESTRING((-2.1467549799530232 -0.12217304763960295,"
"-2.5481807079117185 -0.90757121103705041,"
"-2.6529004630313784 0.85521133347722067,"

View File

@ -1,10 +1,11 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014-2015, Oracle and/or its affiliates.
// Copyright (c) 2014-2025, Oracle and/or its affiliates.
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
#include <iostream>
@ -26,11 +27,12 @@
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/algorithms/difference.hpp>
typedef bg::model::point<double,2,bg::cs::cartesian> point_type;
typedef bg::model::segment<point_type> segment_type;
typedef bg::model::linestring<point_type> linestring_type;
typedef bg::model::multi_linestring<linestring_type> multi_linestring_type;
using point_type = bg::model::point<double,2,bg::cs::cartesian>;
using segment_type = bg::model::segment<point_type>;
using linestring_type = bg::model::linestring<point_type>;
using multi_linestring_type = bg::model::multi_linestring<linestring_type>;
using L = linestring_type;
using ML = multi_linestring_type;
//===========================================================================
@ -46,10 +48,7 @@ BOOST_AUTO_TEST_CASE( test_difference_linestring_linestring )
std::cout << std::endl;
#endif
typedef linestring_type L;
typedef multi_linestring_type ML;
typedef test_difference_of_geometries<L, L, ML> tester;
using tester = test_difference_of_geometries<L, L, ML>;
tester::apply
(from_wkt<L>("LINESTRING(0 0,1 1,2 1,3 2)"),
@ -565,10 +564,7 @@ BOOST_AUTO_TEST_CASE( test_difference_linestring_multilinestring )
std::cout << std::endl;
#endif
typedef linestring_type L;
typedef multi_linestring_type ML;
typedef test_difference_of_geometries<L, ML, ML> tester;
using tester = test_difference_of_geometries<L, ML, ML>;
// disjoint linestrings
tester::apply
@ -789,10 +785,7 @@ BOOST_AUTO_TEST_CASE( test_difference_multilinestring_linestring )
std::cout << std::endl;
#endif
typedef linestring_type L;
typedef multi_linestring_type ML;
typedef test_difference_of_geometries<ML, L, ML> tester;
using tester = test_difference_of_geometries<ML, L, ML>;
// disjoint linestrings
tester::apply
@ -874,9 +867,7 @@ BOOST_AUTO_TEST_CASE( test_difference_multilinestring_multilinestring )
std::cout << std::endl;
#endif
typedef multi_linestring_type ML;
typedef test_difference_of_geometries<ML, ML, ML> tester;
using tester = test_difference_of_geometries<ML, ML, ML>;
// disjoint linestrings
tester::apply
@ -1160,15 +1151,13 @@ BOOST_AUTO_TEST_CASE( test_difference_ml_ml_degenerate )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl << std::endl << std::endl;
std::cout << "*** MULTILINESTRING / MULTILINESTRING DIFFERENCE"
std::cout << "*** MULTILINESTRING / MULTILINESTRING DIFFERENCE"
<< " (DEGENERATE) ***"
<< std::endl;
std::cout << std::endl;
#endif
typedef multi_linestring_type ML;
typedef test_difference_of_geometries<ML, ML, ML> tester;
using tester = test_difference_of_geometries<ML, ML, ML>;
// the following test cases concern linestrings with duplicate
// points and possibly linestrings with zero length.
@ -1247,15 +1236,13 @@ BOOST_AUTO_TEST_CASE( test_difference_ml_ml_spikes )
{
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl << std::endl << std::endl;
std::cout << "*** MULTILINESTRING / MULTILINESTRING DIFFERENCE"
std::cout << "*** MULTILINESTRING / MULTILINESTRING DIFFERENCE"
<< " (WITH SPIKES) ***"
<< std::endl;
std::cout << std::endl;
#endif
typedef multi_linestring_type ML;
typedef test_difference_of_geometries<ML, ML, ML> tester;
using tester = test_difference_of_geometries<ML, ML, ML>;
// the following test cases concern linestrings with spikes
@ -1445,14 +1432,14 @@ BOOST_AUTO_TEST_CASE( test_difference_ml_ml_spikes )
BOOST_AUTO_TEST_CASE( test_difference_ls_mls_geo_rad )
{
typedef bg::model::point<double, 2, bg::cs::geographic<bg::radian> > pt;
typedef bg::model::linestring<pt> ls;
typedef bg::model::multi_linestring<ls> mls;
using pt = bg::model::point<double, 2, bg::cs::geographic<bg::radian>>;
using ls = bg::model::linestring<pt>;
using mls = bg::model::multi_linestring<ls>;
bg::srs::spheroid<double> sph_wgs84(6378137.0, 6356752.3142451793);
boost::geometry::strategy::intersection::geographic_segments<> wgs84(sph_wgs84);
ls g1 = from_wkt<ls>("LINESTRING(0 0, -3.14159265358979 0)");
ls g1 = from_wkt<ls>("LINESTRING(0 0,-3.14159265358979 0)");
mls g2 = from_wkt<mls>("MULTILINESTRING((-2.1467549799530232 -0.12217304763960295,"
"-2.5481807079117185 -0.90757121103705041,"
"-2.6529004630313784 0.85521133347722067,"

View File

@ -5,6 +5,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2025.
// Modifications copyright (c) 2025 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, 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.
@ -46,7 +50,6 @@ template <typename T>
void test_bounds()
{
using coordinate_t = boost::rational<T>;
using point_t = bg::model::point<coordinate_t, 2, bg::cs::cartesian>;
auto const lowest = bg::util::bounds<coordinate_t>::lowest();
auto const highest = bg::util::bounds<coordinate_t>::highest();