From 9cedac02534b6f4b44d3abcacae24de7fd187894 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 10 Jan 2025 23:58:04 +0100 Subject: [PATCH 1/5] fix: type conversion warning in geo distance_cross_track --- .../strategies/geographic/distance_cross_track.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/boost/geometry/strategies/geographic/distance_cross_track.hpp b/include/boost/geometry/strategies/geographic/distance_cross_track.hpp index db5e46b9c..2338b1ec1 100644 --- a/include/boost/geometry/strategies/geographic/distance_cross_track.hpp +++ b/include/boost/geometry/strategies/geographic/distance_cross_track.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2023-2025 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2016-2022, Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle @@ -697,10 +697,13 @@ protected: point p2 = point(lon2, lat2); point p3 = point(lon3, lat3); - geometry::strategy::distance::cross_track cross_track(earth_radius); + using haversine_t = geometry::strategy::distance::haversine; + using cross_track_t = geometry::strategy::distance::cross_track; + + cross_track_t cross_track(earth_radius); CT s34_sph = cross_track.apply(p3, p1, p2); - geometry::strategy::distance::haversine str(earth_radius); + haversine_t str(earth_radius); CT s13_sph = str.apply(p1, p3); //CT s14 = acos( cos(s13/earth_radius) / cos(s34/earth_radius) ) * earth_radius; From 225c4f2346aa163a0ce12179ab0b1f225906f6e1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 10 Jan 2025 23:58:51 +0100 Subject: [PATCH 2/5] fix: compilation error for geometries using different point types in sph distance_cross_track_box_box --- .../spherical/distance_cross_track_box_box.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp b/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp index f021cf99e..5c161c69f 100644 --- a/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp +++ b/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp @@ -1,5 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2016-2020 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fisikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -45,11 +47,11 @@ class cross_track_box_box_generic { public : - template - ReturnType static inline diagonal_case(Point topA, - Point topB, - Point bottomA, - Point bottomB, + template + ReturnType static inline diagonal_case(Point1 topA, + Point2 topB, + Point1 bottomA, + Point2 bottomB, bool north_shortest, bool non_overlap, PPStrategy pp_strategy, From 3bedb43f1d456a743c9495ad501e324e1c1b8256 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 10 Jan 2025 23:59:40 +0100 Subject: [PATCH 3/5] fix: add closest_ponts and centroid getters to higher level umbrella strategies --- .../boost/geometry/strategies/cartesian.hpp | 7 ++- .../strategies/centroid/cartesian.hpp | 18 ++++++- .../strategies/centroid/geographic.hpp | 47 +++++++++++++------ .../strategies/centroid/spherical.hpp | 29 ++++++++---- .../boost/geometry/strategies/geographic.hpp | 9 +++- .../geometry/strategies/index/cartesian.hpp | 5 +- .../geometry/strategies/index/geographic.hpp | 4 ++ .../geometry/strategies/index/spherical.hpp | 4 ++ .../boost/geometry/strategies/spherical.hpp | 9 +++- 9 files changed, 101 insertions(+), 31 deletions(-) diff --git a/include/boost/geometry/strategies/cartesian.hpp b/include/boost/geometry/strategies/cartesian.hpp index 83c89f00c..8ec83563b 100644 --- a/include/boost/geometry/strategies/cartesian.hpp +++ b/include/boost/geometry/strategies/cartesian.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -14,6 +16,8 @@ #include #include #include +#include +#include #include #include #include @@ -36,7 +40,8 @@ namespace strategies template class cartesian // derived from the umbrella strategy defining the most strategies - : public strategies::index::cartesian + : public strategies::closest_points::cartesian + , public strategies::centroid::detail::cartesian { public: diff --git a/include/boost/geometry/strategies/centroid/cartesian.hpp b/include/boost/geometry/strategies/centroid/cartesian.hpp index 14b45155a..bb52a2ba1 100644 --- a/include/boost/geometry/strategies/centroid/cartesian.hpp +++ b/include/boost/geometry/strategies/centroid/cartesian.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -27,9 +29,12 @@ namespace boost { namespace geometry namespace strategies { namespace centroid { +#ifndef DOXYGEN_NO_DETAIL +namespace detail +{ + template struct cartesian - : public strategies::detail::cartesian_base { template static auto centroid(Geometry const&, @@ -77,6 +82,17 @@ struct cartesian }; +} // namespace detail +#endif // DOXYGEN_NO_DETAIL + + +template +struct cartesian + : public strategies::detail::cartesian_base + , public strategies::centroid::detail::cartesian +{}; + + namespace services { diff --git a/include/boost/geometry/strategies/centroid/geographic.hpp b/include/boost/geometry/strategies/centroid/geographic.hpp index 26619e9e2..fa72ac1ee 100644 --- a/include/boost/geometry/strategies/centroid/geographic.hpp +++ b/include/boost/geometry/strategies/centroid/geographic.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -22,24 +24,13 @@ namespace boost { namespace geometry namespace strategies { namespace centroid { -template -< - typename FormulaPolicy = strategy::andoyer, - typename Spheroid = srs::spheroid, - typename CalculationType = void -> -class geographic - : public strategies::detail::geographic_base +#ifndef DOXYGEN_NO_DETAIL +namespace detail { - using base_t = strategies::detail::geographic_base; +class geographic +{ public: - geographic() = default; - - explicit geographic(Spheroid const& spheroid) - : base_t(spheroid) - {} - // TODO: Box and Segment should have proper strategies. template static auto centroid(Geometry const&, Point const&, @@ -53,6 +44,32 @@ public: } }; + +} // namespace detail +#endif // DOXYGEN_NO_DETAIL + + +template +< + typename FormulaPolicy = strategy::andoyer, + typename Spheroid = srs::spheroid, + typename CalculationType = void +> +class geographic + : public strategies::detail::geographic_base + , public strategies::centroid::detail::geographic +{ + using base_t = strategies::detail::geographic_base; + +public: + geographic() = default; + + explicit geographic(Spheroid const& spheroid) + : base_t(spheroid) + {} +}; + + namespace services { diff --git a/include/boost/geometry/strategies/centroid/spherical.hpp b/include/boost/geometry/strategies/centroid/spherical.hpp index 4d7634dc1..2fdb03cda 100644 --- a/include/boost/geometry/strategies/centroid/spherical.hpp +++ b/include/boost/geometry/strategies/centroid/spherical.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -22,18 +24,13 @@ namespace boost { namespace geometry namespace strategies { namespace centroid { -template -< - typename CalculationType = void -> -class spherical - : public strategies::detail::spherical_base +#ifndef DOXYGEN_NO_DETAIL +namespace detail { - using base_t = strategies::detail::spherical_base; +class spherical +{ public: - spherical() = default; - // TODO: Box and Segment should have proper strategies. template static auto centroid(Geometry const&, Point const&, @@ -48,6 +45,20 @@ public: }; +} // namespace detail +#endif // DOXYGEN_NO_DETAIL + + +template +class spherical + : public strategies::detail::spherical_base + , public strategies::centroid::detail::spherical +{ +public: + spherical() = default; +}; + + namespace services { diff --git a/include/boost/geometry/strategies/geographic.hpp b/include/boost/geometry/strategies/geographic.hpp index 435ba29b2..f0af5b97f 100644 --- a/include/boost/geometry/strategies/geographic.hpp +++ b/include/boost/geometry/strategies/geographic.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -14,6 +16,8 @@ #include #include #include +#include +#include #include #include #include @@ -41,9 +45,10 @@ template > class geographic // derived from the umbrella strategy defining the most strategies - : public index::geographic + : public strategies::closest_points::geographic + , public strategies::centroid::detail::geographic { - using base_t = index::geographic; + using base_t = strategies::closest_points::geographic; public: geographic() = default; diff --git a/include/boost/geometry/strategies/index/cartesian.hpp b/include/boost/geometry/strategies/index/cartesian.hpp index 8cbf7ac5a..01e92888e 100644 --- a/include/boost/geometry/strategies/index/cartesian.hpp +++ b/include/boost/geometry/strategies/index/cartesian.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -11,17 +13,18 @@ #define BOOST_GEOMETRY_STRATEGIES_INDEX_CARTESIAN_HPP +#include #include #include - namespace boost { namespace geometry { namespace strategies { namespace index { template class cartesian : public distance::cartesian + , public strategies::centroid::detail::cartesian {}; diff --git a/include/boost/geometry/strategies/index/geographic.hpp b/include/boost/geometry/strategies/index/geographic.hpp index 609d2c82f..2a2fc16be 100644 --- a/include/boost/geometry/strategies/index/geographic.hpp +++ b/include/boost/geometry/strategies/index/geographic.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -11,6 +13,7 @@ #define BOOST_GEOMETRY_STRATEGIES_INDEX_GEOGRAPHIC_HPP +#include #include #include @@ -26,6 +29,7 @@ template > class geographic : public distance::geographic + , public strategies::centroid::detail::geographic { typedef distance::geographic base_t; diff --git a/include/boost/geometry/strategies/index/spherical.hpp b/include/boost/geometry/strategies/index/spherical.hpp index c3502207b..26ae00c7a 100644 --- a/include/boost/geometry/strategies/index/spherical.hpp +++ b/include/boost/geometry/strategies/index/spherical.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -11,6 +13,7 @@ #define BOOST_GEOMETRY_STRATEGIES_INDEX_SPHERICAL_HPP +#include #include #include @@ -28,6 +31,7 @@ namespace detail template class spherical : public strategies::distance::detail::spherical + , public strategies::centroid::detail::spherical { using base_t = strategies::distance::detail::spherical; diff --git a/include/boost/geometry/strategies/spherical.hpp b/include/boost/geometry/strategies/spherical.hpp index 0fed07e5b..b8f34c725 100644 --- a/include/boost/geometry/strategies/spherical.hpp +++ b/include/boost/geometry/strategies/spherical.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -14,6 +16,8 @@ #include #include #include +#include +#include #include #include #include @@ -40,9 +44,10 @@ template > class spherical // derived from the umbrella strategy defining the most strategies - : public strategies::index::detail::spherical + : public strategies::closest_points::spherical + , public strategies::centroid::detail::spherical { - using base_t = strategies::index::detail::spherical; + using base_t = strategies::closest_points::spherical; public: spherical() = default; From 8cbbb605c79d759fb61fbbe8c868867b278e24be Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 11 Jan 2025 16:05:22 +0100 Subject: [PATCH 4/5] fix: Add const and references in distance cross track strategies --- .../geographic/distance_cross_track.hpp | 60 +++++++++---------- .../distance_cross_track_box_box.hpp | 20 +++---- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/include/boost/geometry/strategies/geographic/distance_cross_track.hpp b/include/boost/geometry/strategies/geographic/distance_cross_track.hpp index 2338b1ec1..1a4548a8d 100644 --- a/include/boost/geometry/strategies/geographic/distance_cross_track.hpp +++ b/include/boost/geometry/strategies/geographic/distance_cross_track.hpp @@ -273,7 +273,7 @@ private: pl_lat = res14.lat2; } - CT new_distance = inverse_distance_type::apply(lon3, lat3, res14.lon2, res14.lat2, + CT const new_distance = inverse_distance_type::apply(lon3, lat3, res14.lon2, res14.lat2, spheroid).distance; dist_improve = new_distance != result.distance; @@ -346,8 +346,8 @@ private: // g4 is the angle between segment (p1,p2) and segment (p3,p4) // that meet on p4 (GEO) - CT a4 = inverse_dist_azimuth_type::apply(res14.lon2, res14.lat2, - lon2, lat2, spheroid).azimuth; + CT const a4 = inverse_dist_azimuth_type::apply(res14.lon2, res14.lat2, + lon2, lat2, spheroid).azimuth; res34 = inverse_distance_azimuth_quantities_type::apply(res14.lon2, res14.lat2, lon3, lat3, spheroid); g4 = res34.azimuth - a4; @@ -527,8 +527,8 @@ protected: CT lat1 = la1; CT lon2 = lo2; CT lat2 = la2; - CT lon3 = lo3; - CT lat3 = la3; + CT const lon3 = lo3; + CT const lat3 = la3; if (lon1 > lon2) { @@ -549,14 +549,14 @@ protected: //segment on equator //Note: antipodal points on equator does not define segment on equator //but pass by the pole - CT diff = geometry::math::longitude_distance_signed(lon1, lon2); + CT const diff = geometry::math::longitude_distance_signed(lon1, lon2); using meridian_inverse = typename formula::meridian_inverse; - bool meridian_not_crossing_pole = + bool const meridian_not_crossing_pole = meridian_inverse::meridian_not_crossing_pole(lat1, lat2, diff); - bool meridian_crossing_pole = + bool const meridian_crossing_pole = meridian_inverse::meridian_crossing_pole(diff); if (math::equals(lat1, c0) && math::equals(lat2, c0) @@ -596,18 +596,18 @@ protected: #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK std::cout << "Meridian segment crossing pole" << std::endl; #endif - CT sign_non_zero = lat3 >= c0 ? 1 : -1; + CT const sign_non_zero = lat3 >= c0 ? 1 : -1; - auto res13 = apply(lon1, lat1, lon1, half_pi * sign_non_zero, lon3, lat3, spheroid); + auto const res13 = apply(lon1, lat1, lon1, half_pi * sign_non_zero, lon3, lat3, spheroid); - auto res23 = apply(lon2, lat2, lon2, half_pi * sign_non_zero, lon3, lat3, spheroid); + auto const res23 = apply(lon2, lat2, lon2, half_pi * sign_non_zero, lon3, lat3, spheroid); return (res13.distance) < (res23.distance) ? res13 : res23; } - auto res12 = inverse_dist_azimuth_reverse_type::apply(lon1, lat1, lon2, lat2, spheroid); + auto const res12 = inverse_dist_azimuth_reverse_type::apply(lon1, lat1, lon2, lat2, spheroid); - auto res13 = inverse_dist_azimuth_type::apply(lon1, lat1, lon3, lat3, spheroid); + auto const res13 = inverse_dist_azimuth_type::apply(lon1, lat1, lon3, lat3, spheroid); if (geometry::math::equals(res12.distance, c0)) { @@ -616,14 +616,14 @@ protected: std::cout << "distance between points=" << res13.distance << std::endl; #endif - auto res = meridian_inverse::apply(lon1, lat1, lon3, lat3, spheroid); + auto const res = meridian_inverse::apply(lon1, lat1, lon3, lat3, spheroid); return non_iterative_case(lon3, lat3, lon1, lat2, res.meridian ? res.distance : res13.distance); } // Compute a12 (GEO) - CT a312 = res13.azimuth - res12.azimuth; + CT const a312 = res13.azimuth - res12.azimuth; // TODO: meridian case optimization if (geometry::math::equals(a312, c0) && meridian_not_crossing_pole) @@ -640,7 +640,7 @@ protected: } } - CT projection1 = cos( a312 ) * res13.distance / res12.distance; + CT const projection1 = cos( a312 ) * res13.distance / res12.distance; #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK std::cout << "a1=" << res12.azimuth * math::r2d() << std::endl; @@ -661,10 +661,10 @@ protected: return non_iterative_case(lon3, lat3, lon1, lat1, spheroid); } - auto res23 = inverse_dist_azimuth_type::apply(lon2, lat2, lon3, lat3, spheroid); + auto const res23 = inverse_dist_azimuth_type::apply(lon2, lat2, lon3, lat3, spheroid); - CT a321 = res23.azimuth - res12.reverse_azimuth + pi; - CT projection2 = cos( a321 ) * res23.distance / res12.distance; + CT const a321 = res23.azimuth - res12.reverse_azimuth + pi; + CT const projection2 = cos( a321 ) * res23.distance / res12.distance; #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK std::cout << "a21=" << res12.reverse_azimuth * math::r2d() @@ -693,28 +693,28 @@ protected: geometry::cs::spherical_equatorial >; - point p1 = point(lon1, lat1); - point p2 = point(lon2, lat2); - point p3 = point(lon3, lat3); + point const p1(lon1, lat1); + point const p2(lon2, lat2); + point const p3(lon3, lat3); using haversine_t = geometry::strategy::distance::haversine; using cross_track_t = geometry::strategy::distance::cross_track; - cross_track_t cross_track(earth_radius); - CT s34_sph = cross_track.apply(p3, p1, p2); + cross_track_t const cross_track(earth_radius); + CT const s34_sph = cross_track.apply(p3, p1, p2); - haversine_t str(earth_radius); - CT s13_sph = str.apply(p1, p3); + haversine_t const str(earth_radius); + CT const s13_sph = str.apply(p1, p3); //CT s14 = acos( cos(s13/earth_radius) / cos(s34/earth_radius) ) * earth_radius; - CT cos_frac = cos(s13_sph / earth_radius) / cos(s34_sph / earth_radius); - CT s14_sph = cos_frac >= 1 ? CT(0) + CT const cos_frac = cos(s13_sph / earth_radius) / cos(s34_sph / earth_radius); + CT const s14_sph = cos_frac >= 1 ? CT(0) : cos_frac <= -1 ? pi * earth_radius : acos(cos_frac) * earth_radius; CT const a12_sph = geometry::formula::spherical_azimuth<>(lon1, lat1, lon2, lat2); - auto res = geometry::formula::spherical_direct(lon1, lat1, + auto const res = geometry::formula::spherical_direct(lon1, lat1, s14_sph, a12_sph, srs::sphere(earth_radius)); // this is what postgis (version 2.5) returns @@ -737,7 +737,7 @@ protected: } else { - CT s14_start = geometry::strategy::distance::geographic + CT const s14_start = geometry::strategy::distance::geographic < FormulaPolicy, Spheroid, diff --git a/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp b/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp index 5c161c69f..7e62094a4 100644 --- a/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp +++ b/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp @@ -48,14 +48,14 @@ class cross_track_box_box_generic public : template - ReturnType static inline diagonal_case(Point1 topA, - Point2 topB, - Point1 bottomA, - Point2 bottomB, + static inline ReturnType diagonal_case(Point1 const& topA, + Point2 const& topB, + Point1 const& bottomA, + Point2 const& bottomB, bool north_shortest, bool non_overlap, - PPStrategy pp_strategy, - PSStrategy ps_strategy) + PPStrategy const& pp_strategy, + PSStrategy const& ps_strategy) { if (north_shortest && non_overlap) { @@ -80,10 +80,10 @@ public : typename PPStrategy, typename PSStrategy > - ReturnType static inline apply (Box1 const& box1, - Box2 const& box2, - PPStrategy pp_strategy, - PSStrategy ps_strategy) + static inline ReturnType apply(Box1 const& box1, + Box2 const& box2, + PPStrategy const& pp_strategy, + PSStrategy const& ps_strategy) { // this method assumes that the coordinates of the point and From c661868894009c253f00a91aa6a23eb628dad353 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 11 Jan 2025 23:33:22 +0100 Subject: [PATCH 5/5] fix: services in geo distance_cross_track_box_box --- .../distance_cross_track_box_box.hpp | 54 +++++++------------ 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp b/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp index fed9a670a..4c9b2a2ee 100644 --- a/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp +++ b/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp @@ -1,5 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2017-2021, Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle @@ -133,67 +135,52 @@ private : namespace services { -template -struct tag > +template +struct tag > { typedef strategy_tag_distance_box_box type; }; -template -struct return_type, Box1, Box2> +template +struct return_type, Box1, Box2> : geographic_cross_track_box_box < - Strategy, Spheroid, CalculationType + FormulaPolicy, Spheroid, CalculationType >::template return_type {}; -template -struct return_type, Box1, Box2> - : geographic_cross_track_box_box - < - Strategy, Spheroid - >::template return_type -{}; -template -struct return_type, Box1, Box2> - : geographic_cross_track_box_box - < - Strategy - >::template return_type -{}; - -template -struct comparable_type > +template +struct comparable_type > { typedef geographic_cross_track_box_box < - typename comparable_type::type, Spheroid, CalculationType + FormulaPolicy, Spheroid, CalculationType > type; }; -template -struct get_comparable > +template +struct get_comparable > { public: - static inline geographic_cross_track_box_box - apply(geographic_cross_track_box_box const& str) + static inline geographic_cross_track_box_box + apply(geographic_cross_track_box_box const& str) { return str; } }; -template +template struct result_from_distance < - geographic_cross_track_box_box, Box1, Box2 + geographic_cross_track_box_box, Box1, Box2 > { private: - typedef geographic_cross_track_box_box this_strategy; + typedef geographic_cross_track_box_box this_strategy; typedef typename this_strategy::template return_type < @@ -205,12 +192,7 @@ public: static inline return_type apply(this_strategy const& strategy, T const& distance) { - result_from_distance - < - Strategy, - point_type_t, - point_type_t - >::apply(strategy, distance); + return static_cast(distance); } };