Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:51

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2017-2020 Oracle and/or its affiliates.
0004 // Contributed and/or modified by Vissarion Fisikopoulos, on behalf of Oracle
0005 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0006 
0007 // Use, modification and distribution is subject to the Boost Software License,
0008 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 
0011 #ifndef BOOST_GEOMETRY_STRATEGY_GEOGRAPHIC_ENVELOPE_SEGMENT_HPP
0012 #define BOOST_GEOMETRY_STRATEGY_GEOGRAPHIC_ENVELOPE_SEGMENT_HPP
0013 
0014 
0015 #include <boost/geometry/srs/spheroid.hpp>
0016 
0017 #include <boost/geometry/strategy/cartesian/envelope_segment.hpp>
0018 #include <boost/geometry/strategy/envelope.hpp>
0019 #include <boost/geometry/strategies/geographic/azimuth.hpp>
0020 #include <boost/geometry/strategies/geographic/parameters.hpp>
0021 #include <boost/geometry/strategies/normalize.hpp>
0022 #include <boost/geometry/strategy/spherical/envelope_segment.hpp>
0023 #include <boost/geometry/strategy/spherical/expand_box.hpp>
0024 
0025 namespace boost { namespace geometry
0026 {
0027 
0028 namespace strategy { namespace envelope
0029 {
0030 
0031 template
0032 <
0033     typename FormulaPolicy = strategy::andoyer,
0034     typename Spheroid = geometry::srs::spheroid<double>,
0035     typename CalculationType = void
0036 >
0037 class geographic_segment
0038 {
0039 public:
0040     typedef Spheroid model_type;
0041 
0042     inline geographic_segment()
0043         : m_spheroid()
0044     {}
0045 
0046     explicit inline geographic_segment(Spheroid const& spheroid)
0047         : m_spheroid(spheroid)
0048     {}
0049 
0050     template <typename Point, typename Box>
0051     inline void apply(Point const& point1, Point const& point2, Box& box) const
0052     {
0053         Point p1_normalized, p2_normalized;
0054         strategy::normalize::spherical_point::apply(point1, p1_normalized);
0055         strategy::normalize::spherical_point::apply(point2, p2_normalized);
0056 
0057         geometry::strategy::azimuth::geographic
0058             <
0059                 FormulaPolicy,
0060                 Spheroid,
0061                 CalculationType
0062             > azimuth_geographic(m_spheroid);
0063 
0064         typedef typename geometry::detail::cs_angular_units
0065             <
0066                 Point
0067             >::type units_type;
0068 
0069         // first compute the envelope range for the first two coordinates
0070         strategy::envelope::detail::envelope_segment_impl
0071             <
0072                 geographic_tag
0073             >::template apply<units_type>(geometry::get<0>(p1_normalized),
0074                                           geometry::get<1>(p1_normalized),
0075                                           geometry::get<0>(p2_normalized),
0076                                           geometry::get<1>(p2_normalized),
0077                                           box,
0078                                           azimuth_geographic);
0079 
0080         // now compute the envelope range for coordinates of
0081         // dimension 2 and higher
0082         strategy::envelope::detail::envelope_one_segment
0083             <
0084                 2, dimension<Point>::value
0085             >::apply(point1, point2, box);
0086     }
0087 
0088     Spheroid model() const
0089     {
0090         return m_spheroid;
0091     }
0092 
0093 private:
0094     Spheroid m_spheroid;
0095 };
0096 
0097 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0098 
0099 namespace services
0100 {
0101 
0102 template <typename CalculationType>
0103 struct default_strategy<segment_tag, geographic_tag, CalculationType>
0104 {
0105     typedef strategy::envelope::geographic_segment
0106         <
0107             strategy::andoyer,
0108             srs::spheroid<double>,
0109             CalculationType
0110         > type;
0111 };
0112 
0113 }
0114 
0115 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0116 
0117 
0118 }} // namespace strategy::envelope
0119 
0120 }} //namepsace boost::geometry
0121 
0122 #endif // BOOST_GEOMETRY_STRATEGY_GEOGRAPHIC_ENVELOPE_SEGMENT_HPP