point_order.hpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. // Boost.Geometry
  2. // Copyright (c) 2019, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  4. // Licensed under the Boost Software License version 1.0.
  5. // http://www.boost.org/users/license.html
  6. #ifndef BOOST_GEOMETRY_STRATEGIES_SPHERICAL_POINT_ORDER_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_POINT_ORDER_HPP
  8. #include <boost/type_traits/is_same.hpp>
  9. #include <boost/geometry/core/tags.hpp>
  10. #include <boost/geometry/formulas/spherical.hpp>
  11. #include <boost/geometry/strategies/spherical/area.hpp>
  12. #include <boost/geometry/strategies/spherical/point_in_point.hpp>
  13. #include <boost/geometry/strategies/point_order.hpp>
  14. #include <boost/geometry/util/math.hpp>
  15. #include <boost/geometry/util/select_calculation_type.hpp>
  16. namespace boost { namespace geometry
  17. {
  18. namespace strategy { namespace point_order
  19. {
  20. //template <typename CalculationType = void>
  21. //struct spherical
  22. //{
  23. // typedef azimuth_tag version_tag;
  24. //
  25. // template <typename Geometry>
  26. // struct result_type
  27. // {
  28. // typedef typename geometry::select_calculation_type_alt
  29. // <
  30. // CalculationType, Geometry
  31. // >::type type;
  32. // };
  33. //
  34. // template <typename Point>
  35. // inline bool apply(Point const& p1, Point const& p2,
  36. // typename result_type<Point>::type & azi,
  37. // typename result_type<Point>::type & razi) const
  38. // {
  39. // typedef typename result_type<Point>::type calc_t;
  40. //
  41. // if (equals_point_point(p1, p2))
  42. // {
  43. // return false;
  44. // }
  45. //
  46. // calc_t lon1 = geometry::get_as_radian<0>(p1);
  47. // calc_t lat1 = geometry::get_as_radian<1>(p1);
  48. // calc_t lon2 = geometry::get_as_radian<0>(p2);
  49. // calc_t lat2 = geometry::get_as_radian<1>(p2);
  50. //
  51. // convert_latitudes<Point>(lat1, lat2);
  52. //
  53. // formula::result_spherical<calc_t>
  54. // res = formula::spherical_azimuth<calc_t, true>(lon1, lat1, lon2, lat2);
  55. //
  56. // azi = res.azimuth;
  57. // razi = res.reverse_azimuth;
  58. //
  59. // return true;
  60. // }
  61. //
  62. // template <typename Point>
  63. // inline typename result_type<Point>::type
  64. // apply(Point const& /*p0*/, Point const& /*p1*/, Point const& /*p2*/,
  65. // typename result_type<Point>::type const& azi1,
  66. // typename result_type<Point>::type const& azi2) const
  67. // {
  68. // // TODO: support poles
  69. // return math::longitude_distance_signed<radian>(azi1, azi2);
  70. // }
  71. //
  72. //private:
  73. // template <typename Point>
  74. // static bool equals_point_point(Point const& p0, Point const& p1)
  75. // {
  76. // return strategy::within::spherical_point_point::apply(p0, p1);
  77. // }
  78. //
  79. // template <typename Point, typename CalcT>
  80. // static void convert_latitudes(CalcT & lat1, CalcT & lat2)
  81. // {
  82. // static const bool is_polar = boost::is_same
  83. // <
  84. // typename geometry::cs_tag<Point>::type,
  85. // spherical_polar_tag
  86. // >::value;
  87. //
  88. // if (BOOST_GEOMETRY_CONDITION(is_polar))
  89. // {
  90. // CalcT pi_half = math::half_pi<CalcT>();
  91. // lat1 = pi_half - lat1;
  92. // lat2 = pi_half - lat2;
  93. // }
  94. // }
  95. //};
  96. template <typename CalculationType = void>
  97. struct spherical
  98. : strategy::area::spherical<double, CalculationType>
  99. {
  100. typedef area_tag version_tag;
  101. };
  102. namespace services
  103. {
  104. template <>
  105. struct default_strategy<spherical_equatorial_tag>
  106. {
  107. typedef spherical<> type;
  108. };
  109. /*template <>
  110. struct default_strategy<spherical_polar_tag>
  111. {
  112. typedef spherical<> type;
  113. };*/
  114. } // namespace services
  115. }} // namespace strategy::point_order
  116. }} // namespace boost::geometry
  117. #endif // BOOST_GEOMETRY_STRATEGIES_SPHERICAL_POINT_ORDER_HPP