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