1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 3 // Copyright (c) 2017 Oracle and/or its affiliates. 4 // Contributed and/or modified by Vissarion Fisikopoulos, on behalf of Oracle 5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle 6 7 // Use, modification and distribution is subject to the Boost Software License, 8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 9 // http://www.boost.org/LICENSE_1_0.txt) 10 11 #ifndef BOOST_GEOMETRY_STRATEGIES_SPHERICAL_ENVELOPE_SEGMENT_HPP 12 #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_ENVELOPE_SEGMENT_HPP 13 14 #include <boost/geometry/algorithms/detail/envelope/segment.hpp> 15 #include <boost/geometry/algorithms/detail/normalize.hpp> 16 #include <boost/geometry/strategies/envelope.hpp> 17 #include <boost/geometry/strategies/spherical/azimuth.hpp> 18 19 namespace boost { namespace geometry 20 { 21 22 namespace strategy { namespace envelope 23 { 24 25 template 26 < 27 typename CalculationType = void 28 > 29 class spherical_segment 30 { 31 public : 32 spherical_segment()33 inline spherical_segment() 34 {} 35 36 template <typename Point1, typename Point2, typename Box> 37 inline void apply(Point1 const & point1,Point2 const & point2,Box & box) const38 apply(Point1 const& point1, Point2 const& point2, Box& box) const 39 { 40 Point1 p1_normalized = detail::return_normalized<Point1>(point1); 41 Point2 p2_normalized = detail::return_normalized<Point2>(point2); 42 43 geometry::strategy::azimuth::spherical<CalculationType> azimuth_spherical; 44 45 typedef typename coordinate_system<Point1>::type::units units_type; 46 47 geometry::detail::envelope::envelope_segment_impl<spherical_equatorial_tag> 48 ::template apply<units_type>(geometry::get<0>(p1_normalized), 49 geometry::get<1>(p1_normalized), 50 geometry::get<0>(p2_normalized), 51 geometry::get<1>(p2_normalized), 52 box, 53 azimuth_spherical); 54 55 } 56 }; 57 58 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS 59 60 namespace services 61 { 62 63 template <typename CalculationType> 64 struct default_strategy<spherical_equatorial_tag, CalculationType> 65 { 66 typedef strategy::envelope::spherical_segment<CalculationType> type; 67 }; 68 69 70 template <typename CalculationType> 71 struct default_strategy<spherical_polar_tag, CalculationType> 72 { 73 typedef strategy::envelope::spherical_segment<CalculationType> type; 74 }; 75 76 } 77 78 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS 79 80 81 }} // namespace strategy::envelope 82 83 }} //namepsace boost::geometry 84 85 #endif // BOOST_GEOMETRY_STRATEGIES_SPHERICAL_ENVELOPE_SEGMENT_HPP 86 87