parameters.hpp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. // Boost.Geometry
  2. // Copyright (c) 2017-2020, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  4. // Use, modification and distribution is subject to the Boost Software License,
  5. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_PARAMETERS_HPP
  8. #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_PARAMETERS_HPP
  9. #include <type_traits>
  10. #include <boost/geometry/core/static_assert.hpp>
  11. #include <boost/geometry/formulas/andoyer_inverse.hpp>
  12. #include <boost/geometry/formulas/thomas_direct.hpp>
  13. #include <boost/geometry/formulas/thomas_inverse.hpp>
  14. #include <boost/geometry/formulas/vincenty_direct.hpp>
  15. #include <boost/geometry/formulas/vincenty_inverse.hpp>
  16. #include <boost/geometry/formulas/karney_direct.hpp>
  17. #include <boost/geometry/formulas/karney_inverse.hpp>
  18. namespace boost { namespace geometry { namespace strategy
  19. {
  20. struct andoyer
  21. {
  22. template
  23. <
  24. typename CT,
  25. bool EnableCoordinates = true,
  26. bool EnableReverseAzimuth = false,
  27. bool EnableReducedLength = false,
  28. bool EnableGeodesicScale = false
  29. >
  30. struct direct
  31. : formula::thomas_direct
  32. <
  33. CT, false,
  34. EnableCoordinates, EnableReverseAzimuth,
  35. EnableReducedLength, EnableGeodesicScale
  36. >
  37. {};
  38. template
  39. <
  40. typename CT,
  41. bool EnableDistance,
  42. bool EnableAzimuth,
  43. bool EnableReverseAzimuth = false,
  44. bool EnableReducedLength = false,
  45. bool EnableGeodesicScale = false
  46. >
  47. struct inverse
  48. : formula::andoyer_inverse
  49. <
  50. CT, EnableDistance,
  51. EnableAzimuth, EnableReverseAzimuth,
  52. EnableReducedLength, EnableGeodesicScale
  53. >
  54. {};
  55. };
  56. struct thomas
  57. {
  58. template
  59. <
  60. typename CT,
  61. bool EnableCoordinates = true,
  62. bool EnableReverseAzimuth = false,
  63. bool EnableReducedLength = false,
  64. bool EnableGeodesicScale = false
  65. >
  66. struct direct
  67. : formula::thomas_direct
  68. <
  69. CT, true,
  70. EnableCoordinates, EnableReverseAzimuth,
  71. EnableReducedLength, EnableGeodesicScale
  72. >
  73. {};
  74. template
  75. <
  76. typename CT,
  77. bool EnableDistance,
  78. bool EnableAzimuth,
  79. bool EnableReverseAzimuth = false,
  80. bool EnableReducedLength = false,
  81. bool EnableGeodesicScale = false
  82. >
  83. struct inverse
  84. : formula::thomas_inverse
  85. <
  86. CT, EnableDistance,
  87. EnableAzimuth, EnableReverseAzimuth,
  88. EnableReducedLength, EnableGeodesicScale
  89. >
  90. {};
  91. };
  92. struct vincenty
  93. {
  94. template
  95. <
  96. typename CT,
  97. bool EnableCoordinates = true,
  98. bool EnableReverseAzimuth = false,
  99. bool EnableReducedLength = false,
  100. bool EnableGeodesicScale = false
  101. >
  102. struct direct
  103. : formula::vincenty_direct
  104. <
  105. CT, EnableCoordinates, EnableReverseAzimuth,
  106. EnableReducedLength, EnableGeodesicScale
  107. >
  108. {};
  109. template
  110. <
  111. typename CT,
  112. bool EnableDistance,
  113. bool EnableAzimuth,
  114. bool EnableReverseAzimuth = false,
  115. bool EnableReducedLength = false,
  116. bool EnableGeodesicScale = false
  117. >
  118. struct inverse
  119. : formula::vincenty_inverse
  120. <
  121. CT, EnableDistance,
  122. EnableAzimuth, EnableReverseAzimuth,
  123. EnableReducedLength, EnableGeodesicScale
  124. >
  125. {};
  126. };
  127. struct karney
  128. {
  129. template
  130. <
  131. typename CT,
  132. bool EnableCoordinates = true,
  133. bool EnableReverseAzimuth = false,
  134. bool EnableReducedLength = false,
  135. bool EnableGeodesicScale = false
  136. >
  137. struct direct
  138. : formula::karney_direct
  139. <
  140. CT, EnableCoordinates, EnableReverseAzimuth,
  141. EnableReducedLength, EnableGeodesicScale
  142. >
  143. {};
  144. template
  145. <
  146. typename CT,
  147. bool EnableDistance,
  148. bool EnableAzimuth,
  149. bool EnableReverseAzimuth = false,
  150. bool EnableReducedLength = false,
  151. bool EnableGeodesicScale = false
  152. >
  153. struct inverse
  154. : formula::karney_inverse
  155. <
  156. CT, EnableDistance,
  157. EnableAzimuth, EnableReverseAzimuth,
  158. EnableReducedLength, EnableGeodesicScale
  159. >
  160. {};
  161. };
  162. template <typename FormulaPolicy>
  163. struct default_order
  164. {
  165. BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
  166. "Not implemented for this type.",
  167. FormulaPolicy);
  168. };
  169. template<>
  170. struct default_order<andoyer>
  171. : std::integral_constant<unsigned int, 1>
  172. {};
  173. template<>
  174. struct default_order<thomas>
  175. : std::integral_constant<unsigned int, 2>
  176. {};
  177. template<>
  178. struct default_order<vincenty>
  179. : std::integral_constant<unsigned int, 4>
  180. {};
  181. template<>
  182. struct default_order<karney>
  183. : std::integral_constant<unsigned int, 8>
  184. {};
  185. }}} // namespace boost::geometry::strategy
  186. #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_PARAMETERS_HPP