Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / geometry / strategies / spherical / point_order.hpp
1 // Boost.Geometry
2
3 // Copyright (c) 2019, Oracle and/or its affiliates.
4
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
6
7 // Licensed under the Boost Software License version 1.0.
8 // http://www.boost.org/users/license.html
9
10 #ifndef BOOST_GEOMETRY_STRATEGIES_SPHERICAL_POINT_ORDER_HPP
11 #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_POINT_ORDER_HPP
12
13
14 #include <boost/type_traits/is_same.hpp>
15
16
17 #include <boost/geometry/core/tags.hpp>
18
19 #include <boost/geometry/formulas/spherical.hpp>
20
21 #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>
27
28
29 namespace boost { namespace geometry
30 {
31
32 namespace strategy { namespace point_order
33 {
34
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
112 template <typename CalculationType = void>
113 struct spherical
114     : strategy::area::spherical<double, CalculationType>
115 {
116     typedef area_tag version_tag;
117 };
118
119 namespace services
120 {
121
122 template <>
123 struct default_strategy<spherical_equatorial_tag>
124 {
125     typedef spherical<> type;
126 };
127
128 /*template <>
129 struct default_strategy<spherical_polar_tag>
130 {
131     typedef spherical<> type;
132 };*/
133
134 } // namespace services
135
136 }} // namespace strategy::point_order
137
138 }} // namespace boost::geometry
139
140 #endif // BOOST_GEOMETRY_STRATEGIES_SPHERICAL_POINT_ORDER_HPP