Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2020-2021, Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0006 
0007 // Licensed under the Boost Software License version 1.0.
0008 // http://www.boost.org/users/license.html
0009 
0010 #ifndef BOOST_GEOMETRY_STRATEGIES_AREA_GEOGRAPHIC_HPP
0011 #define BOOST_GEOMETRY_STRATEGIES_AREA_GEOGRAPHIC_HPP
0012 
0013 
0014 #include <boost/geometry/strategy/geographic/area.hpp>
0015 #include <boost/geometry/strategy/geographic/area_box.hpp>
0016 
0017 #include <boost/geometry/strategies/area/services.hpp>
0018 #include <boost/geometry/strategies/detail.hpp>
0019 
0020 
0021 namespace boost { namespace geometry
0022 {
0023 
0024 namespace strategies { namespace area
0025 {
0026 
0027 template
0028 <
0029     typename FormulaPolicy = strategy::andoyer,
0030     typename Spheroid = srs::spheroid<double>,
0031     typename CalculationType = void
0032 >
0033 class geographic
0034     : public strategies::detail::geographic_base<Spheroid>
0035 {
0036     using base_t = strategies::detail::geographic_base<Spheroid>;
0037 
0038 public:
0039     geographic() = default;
0040 
0041     explicit geographic(Spheroid const& spheroid)
0042         : base_t(spheroid)
0043     {}
0044 
0045     template <typename Geometry>
0046     auto area(Geometry const&,
0047               std::enable_if_t<! util::is_box<Geometry>::value> * = nullptr) const
0048     {
0049         return strategy::area::geographic
0050             <
0051                 FormulaPolicy,
0052                 strategy::default_order<FormulaPolicy>::value,
0053                 Spheroid, CalculationType
0054             >(base_t::m_spheroid);
0055     }
0056 
0057     template <typename Geometry>
0058     auto area(Geometry const&,
0059               std::enable_if_t<util::is_box<Geometry>::value> * = nullptr) const
0060     {
0061         return strategy::area::geographic_box
0062             <
0063                 Spheroid, CalculationType
0064             >(base_t::m_spheroid);
0065     }
0066 };
0067 
0068 
0069 namespace services
0070 {
0071 
0072 template <typename Geometry>
0073 struct default_strategy<Geometry, geographic_tag>
0074 {
0075     using type = strategies::area::geographic<>;
0076 };
0077 
0078 
0079 template <typename FP, std::size_t SO, typename S, typename CT>
0080 struct strategy_converter<strategy::area::geographic<FP, SO, S, CT> >
0081 {
0082     struct altered_strategy
0083         : strategies::area::geographic<FP, S, CT>
0084     {
0085         explicit altered_strategy(S const& spheroid)
0086             : strategies::area::geographic<FP, S, CT>(spheroid)
0087         {}
0088 
0089         using strategies::area::geographic<FP, S, CT>::area;
0090 
0091         template <typename Geometry>
0092         auto area(Geometry const&,
0093                   std::enable_if_t<! util::is_box<Geometry>::value> * = nullptr) const
0094         {
0095             return strategy::area::geographic<FP, SO, S, CT>(this->m_spheroid);
0096         }
0097     };
0098 
0099     static auto get(strategy::area::geographic<FP, SO, S, CT> const& strategy)
0100     {
0101         return altered_strategy(strategy.model());
0102     }
0103 };
0104 
0105 } // namespace services
0106 
0107 }} // namespace strategies::area
0108 
0109 }} // namespace boost::geometry
0110 
0111 #endif // BOOST_GEOMETRY_STRATEGIES_AREA_GEOGRAPHIC_HPP