1 // Boost.Geometry 2 3 // Copyright (c) 2020, Oracle and/or its affiliates. 4 5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle 6 7 // Licensed under the Boost Software License version 1.0. 8 // http://www.boost.org/users/license.html 9 10 #ifndef BOOST_GEOMETRY_STRATEGIES_EXPAND_GEOGRAPHIC_HPP 11 #define BOOST_GEOMETRY_STRATEGIES_EXPAND_GEOGRAPHIC_HPP 12 13 14 #include <type_traits> 15 16 #include <boost/geometry/strategy/geographic/expand_segment.hpp> 17 18 #include <boost/geometry/strategies/detail.hpp> 19 #include <boost/geometry/strategies/expand/spherical.hpp> 20 21 22 namespace boost { namespace geometry 23 { 24 25 namespace strategies { namespace expand 26 { 27 28 template 29 < 30 typename FormulaPolicy = strategy::andoyer, 31 typename Spheroid = srs::spheroid<double>, 32 typename CalculationType = void 33 > 34 class geographic : strategies::detail::geographic_base<Spheroid> 35 { 36 using base_t = strategies::detail::geographic_base<Spheroid>; 37 38 public: geographic()39 geographic() 40 : base_t() 41 {} 42 geographic(Spheroid const & spheroid)43 explicit geographic(Spheroid const& spheroid) 44 : base_t(spheroid) 45 {} 46 47 template <typename Box, typename Geometry> expand(Box const &,Geometry const &,typename util::enable_if_point_t<Geometry> * =nullptr)48 static auto expand(Box const&, Geometry const&, 49 typename util::enable_if_point_t<Geometry> * = nullptr) 50 { 51 return strategy::expand::spherical_point(); 52 } 53 54 template <typename Box, typename Geometry> expand(Box const &,Geometry const &,typename util::enable_if_box_t<Geometry> * =nullptr)55 static auto expand(Box const&, Geometry const&, 56 typename util::enable_if_box_t<Geometry> * = nullptr) 57 { 58 return strategy::expand::spherical_box(); 59 } 60 61 template <typename Box, typename Geometry> expand(Box const &,Geometry const &,typename util::enable_if_segment_t<Geometry> * =nullptr) const62 auto expand(Box const&, Geometry const&, 63 typename util::enable_if_segment_t<Geometry> * = nullptr) const 64 { 65 return strategy::expand::geographic_segment 66 < 67 FormulaPolicy, Spheroid, CalculationType 68 >(base_t::m_spheroid); 69 } 70 }; 71 72 73 namespace services 74 { 75 76 template <typename Box, typename Geometry> 77 struct default_strategy<Box, Geometry, geographic_tag> 78 { 79 using type = strategies::expand::geographic<>; 80 }; 81 82 83 template <typename FP, typename S, typename CT> 84 struct strategy_converter<strategy::expand::geographic_segment<FP, S, CT> > 85 { getboost::geometry::strategies::expand::services::strategy_converter86 static auto get(strategy::expand::geographic_segment<FP, S, CT> const& s) 87 { 88 return strategies::expand::geographic<FP, S, CT>(s.model()); 89 } 90 }; 91 92 93 } // namespace services 94 95 }} // namespace strategies::envelope 96 97 }} // namespace boost::geometry 98 99 #endif // BOOST_GEOMETRY_STRATEGIES_EXPAND_GEOGRAPHIC_HPP 100