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_SPHERICAL_HPP
0011 #define BOOST_GEOMETRY_STRATEGIES_AREA_SPHERICAL_HPP
0012 
0013 
0014 #include <boost/geometry/strategy/spherical/area.hpp>
0015 #include <boost/geometry/strategy/spherical/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 RadiusTypeOrSphere = double,
0030     typename CalculationType = void
0031 >
0032 class spherical
0033     : public strategies::detail::spherical_base<RadiusTypeOrSphere>
0034 {
0035     using base_t = strategies::detail::spherical_base<RadiusTypeOrSphere>;
0036 
0037 public:
0038     spherical()
0039         : base_t()
0040     {}
0041 
0042     template <typename RadiusOrSphere>
0043     explicit spherical(RadiusOrSphere const& radius_or_sphere)
0044         : base_t(radius_or_sphere)
0045     {}
0046 
0047     template <typename Geometry>
0048     auto area(Geometry const&,
0049               std::enable_if_t<! util::is_box<Geometry>::value> * = nullptr) const
0050     {
0051         return strategy::area::spherical
0052             <
0053                 typename base_t::radius_type, CalculationType
0054             >(base_t::m_radius);
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::spherical_box
0062             <
0063                 typename base_t::radius_type, CalculationType
0064             >(base_t::m_radius);
0065     }
0066 };
0067 
0068 
0069 namespace services
0070 {
0071 
0072 template <typename Geometry>
0073 struct default_strategy<Geometry, spherical_tag>
0074 {
0075     using type = strategies::area::spherical<>;
0076 };
0077 
0078 template <typename Geometry>
0079 struct default_strategy<Geometry, spherical_equatorial_tag>
0080 {
0081     using type = strategies::area::spherical<>;
0082 };
0083 
0084 template <typename Geometry>
0085 struct default_strategy<Geometry, spherical_polar_tag>
0086 {
0087     using type = strategies::area::spherical<>;
0088 };
0089 
0090 
0091 template <typename R, typename CT>
0092 struct strategy_converter<strategy::area::spherical<R, CT> >
0093 {
0094     static auto get(strategy::area::spherical<R, CT> const& strategy)
0095     {
0096         return strategies::area::spherical<R, CT>(strategy.model());
0097     }
0098 };
0099 
0100 
0101 } // namespace services
0102 
0103 }} // namespace strategies::area
0104 
0105 }} // namespace boost::geometry
0106 
0107 #endif // BOOST_GEOMETRY_STRATEGIES_AREA_SPHERICAL_HPP