File indexing completed on 2025-09-16 08:35:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISTANCE_CROSS_TRACK_BOX_BOX_HPP
0015 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISTANCE_CROSS_TRACK_BOX_BOX_HPP
0016
0017 #include <boost/config.hpp>
0018 #include <boost/concept_check.hpp>
0019
0020 #include <boost/geometry/core/access.hpp>
0021 #include <boost/geometry/core/assert.hpp>
0022 #include <boost/geometry/core/point_type.hpp>
0023 #include <boost/geometry/core/radian_access.hpp>
0024 #include <boost/geometry/core/tags.hpp>
0025
0026 #include <boost/geometry/strategies/distance.hpp>
0027 #include <boost/geometry/strategies/concepts/distance_concept.hpp>
0028 #include <boost/geometry/strategies/geographic/distance.hpp>
0029 #include <boost/geometry/strategies/geographic/distance_cross_track.hpp>
0030 #include <boost/geometry/strategies/spherical/distance_cross_track.hpp>
0031 #include <boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp>
0032
0033 #include <boost/geometry/util/math.hpp>
0034 #include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
0035
0036
0037 namespace boost { namespace geometry
0038 {
0039
0040 namespace strategy { namespace distance
0041 {
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057 template
0058 <
0059 typename FormulaPolicy = strategy::andoyer,
0060 typename Spheroid = srs::spheroid<double>,
0061 typename CalculationType = void
0062 >
0063 class geographic_cross_track_box_box
0064 {
0065 public:
0066
0067
0068 struct distance_pp_strategy
0069 {
0070 typedef geographic<FormulaPolicy, Spheroid, CalculationType> type;
0071 };
0072
0073
0074 struct distance_ps_strategy
0075 {
0076 typedef geographic_cross_track
0077 <
0078 FormulaPolicy,
0079 Spheroid,
0080 CalculationType
0081 > type;
0082 };
0083
0084 template <typename Box1, typename Box2>
0085 struct return_type : services::return_type
0086 <
0087 typename distance_ps_strategy::type,
0088 point_type_t<Box1>,
0089 point_type_t<Box2>
0090 >
0091 {};
0092
0093
0094
0095 explicit geographic_cross_track_box_box(Spheroid const& spheroid = Spheroid())
0096 : m_spheroid(spheroid)
0097 {}
0098
0099 template <typename Box1, typename Box2>
0100 inline typename return_type<Box1, Box2>::type
0101 apply(Box1 const& box1, Box2 const& box2) const
0102 {
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116 typedef typename return_type<Box1, Box2>::type return_type;
0117 return details::cross_track_box_box_generic
0118 <return_type>::apply(box1, box2,
0119 typename distance_pp_strategy::type(m_spheroid),
0120 typename distance_ps_strategy::type(m_spheroid));
0121 }
0122
0123 Spheroid model() const
0124 {
0125 return m_spheroid;
0126 }
0127
0128 private :
0129 Spheroid m_spheroid;
0130 };
0131
0132
0133
0134 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0135 namespace services
0136 {
0137
0138 template <typename FormulaPolicy, typename Spheroid, typename CalculationType>
0139 struct tag<geographic_cross_track_box_box<FormulaPolicy, Spheroid, CalculationType> >
0140 {
0141 typedef strategy_tag_distance_box_box type;
0142 };
0143
0144
0145 template <typename FormulaPolicy, typename Spheroid, typename CalculationType, typename Box1, typename Box2>
0146 struct return_type<geographic_cross_track_box_box<FormulaPolicy, Spheroid, CalculationType>, Box1, Box2>
0147 : geographic_cross_track_box_box
0148 <
0149 FormulaPolicy, Spheroid, CalculationType
0150 >::template return_type<Box1, Box2>
0151 {};
0152
0153
0154 template <typename FormulaPolicy, typename Spheroid, typename CalculationType>
0155 struct comparable_type<geographic_cross_track_box_box<FormulaPolicy, Spheroid, CalculationType> >
0156 {
0157 typedef geographic_cross_track_box_box
0158 <
0159 FormulaPolicy, Spheroid, CalculationType
0160 > type;
0161 };
0162
0163
0164 template <typename FormulaPolicy, typename Spheroid, typename CalculationType>
0165 struct get_comparable<geographic_cross_track_box_box<FormulaPolicy, Spheroid, CalculationType> >
0166 {
0167 public:
0168 static inline geographic_cross_track_box_box<FormulaPolicy, Spheroid, CalculationType>
0169 apply(geographic_cross_track_box_box<FormulaPolicy, Spheroid, CalculationType> const& str)
0170 {
0171 return str;
0172 }
0173 };
0174
0175
0176 template <typename FormulaPolicy, typename Spheroid, typename CalculationType, typename Box1, typename Box2>
0177 struct result_from_distance
0178 <
0179 geographic_cross_track_box_box<FormulaPolicy, Spheroid, CalculationType>, Box1, Box2
0180 >
0181 {
0182 private:
0183 typedef geographic_cross_track_box_box<FormulaPolicy, Spheroid, CalculationType> this_strategy;
0184
0185 typedef typename this_strategy::template return_type
0186 <
0187 Box1, Box2
0188 >::type return_type;
0189
0190 public:
0191 template <typename T>
0192 static inline return_type apply(this_strategy const& , T const& distance)
0193 {
0194 return static_cast<return_type>(distance);
0195 }
0196 };
0197
0198 template <typename Box1, typename Box2>
0199 struct default_strategy
0200 <
0201 box_tag, box_tag, Box1, Box2,
0202 geographic_tag, geographic_tag
0203 >
0204 {
0205 typedef geographic_cross_track_box_box<> type;
0206 };
0207
0208
0209 }
0210 #endif
0211
0212
0213 }}
0214
0215
0216 }}
0217
0218
0219 #endif