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