Skip to content

Commit cc5e7d5

Browse files
committed
[strategies] Implement spherical point_order strategy based on azimuth.
Commented-out for now.
1 parent be7b5e7 commit cc5e7d5

File tree

1 file changed

+89
-3
lines changed

1 file changed

+89
-3
lines changed

include/boost/geometry/strategies/spherical/point_order.hpp

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,19 @@
1111
#define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_POINT_ORDER_HPP
1212

1313

14+
#include <boost/type_traits/is_same.hpp>
15+
16+
1417
#include <boost/geometry/core/tags.hpp>
1518

16-
#include <boost/geometry/strategies/point_order.hpp>
19+
#include <boost/geometry/formulas/spherical.hpp>
20+
1721
#include <boost/geometry/strategies/spherical/area.hpp>
22+
#include <boost/geometry/strategies/spherical/point_in_point.hpp>
23+
#include <boost/geometry/strategies/point_order.hpp>
24+
25+
#include <boost/geometry/util/math.hpp>
26+
#include <boost/geometry/util/select_calculation_type.hpp>
1827

1928

2029
namespace boost { namespace geometry
@@ -23,6 +32,83 @@ namespace boost { namespace geometry
2332
namespace strategy { namespace point_order
2433
{
2534

35+
//template <typename CalculationType = void>
36+
//struct spherical
37+
//{
38+
// typedef azimuth_tag version_tag;
39+
//
40+
// template <typename Geometry>
41+
// struct result_type
42+
// {
43+
// typedef typename geometry::select_calculation_type_alt
44+
// <
45+
// CalculationType, Geometry
46+
// >::type type;
47+
// };
48+
//
49+
// template <typename Point>
50+
// inline bool apply(Point const& p1, Point const& p2,
51+
// typename result_type<Point>::type & azi,
52+
// typename result_type<Point>::type & razi) const
53+
// {
54+
// typedef typename result_type<Point>::type calc_t;
55+
//
56+
// if (equals_point_point(p1, p2))
57+
// {
58+
// return false;
59+
// }
60+
//
61+
// calc_t lon1 = geometry::get_as_radian<0>(p1);
62+
// calc_t lat1 = geometry::get_as_radian<1>(p1);
63+
// calc_t lon2 = geometry::get_as_radian<0>(p2);
64+
// calc_t lat2 = geometry::get_as_radian<1>(p2);
65+
//
66+
// convert_latitudes<Point>(lat1, lat2);
67+
//
68+
// formula::result_spherical<calc_t>
69+
// res = formula::spherical_azimuth<calc_t, true>(lon1, lat1, lon2, lat2);
70+
//
71+
// azi = res.azimuth;
72+
// razi = res.reverse_azimuth;
73+
//
74+
// return true;
75+
// }
76+
//
77+
// template <typename Point>
78+
// inline typename result_type<Point>::type
79+
// apply(Point const& /*p0*/, Point const& /*p1*/, Point const& /*p2*/,
80+
// typename result_type<Point>::type const& azi1,
81+
// typename result_type<Point>::type const& azi2) const
82+
// {
83+
// // TODO: support poles
84+
// return math::longitude_distance_signed<radian>(azi1, azi2);
85+
// }
86+
//
87+
//private:
88+
// template <typename Point>
89+
// static bool equals_point_point(Point const& p0, Point const& p1)
90+
// {
91+
// return strategy::within::spherical_point_point::apply(p0, p1);
92+
// }
93+
//
94+
// template <typename Point, typename CalcT>
95+
// static void convert_latitudes(CalcT & lat1, CalcT & lat2)
96+
// {
97+
// static const bool is_polar = boost::is_same
98+
// <
99+
// typename geometry::cs_tag<Point>::type,
100+
// spherical_polar_tag
101+
// >::value;
102+
//
103+
// if (BOOST_GEOMETRY_CONDITION(is_polar))
104+
// {
105+
// CalcT pi_half = math::half_pi<CalcT>();
106+
// lat1 = pi_half - lat1;
107+
// lat2 = pi_half - lat2;
108+
// }
109+
// }
110+
//};
111+
26112
template <typename CalculationType = void>
27113
struct spherical
28114
: strategy::area::spherical<double, CalculationType>
@@ -39,11 +125,11 @@ struct default_strategy<spherical_equatorial_tag>
39125
typedef spherical<> type;
40126
};
41127

42-
template <>
128+
/*template <>
43129
struct default_strategy<spherical_polar_tag>
44130
{
45131
typedef spherical<> type;
46-
};
132+
};*/
47133

48134
} // namespace services
49135

0 commit comments

Comments
 (0)