Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2020-2022, 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_ENVELOPE_SPHERICAL_HPP
0011 #define BOOST_GEOMETRY_STRATEGIES_ENVELOPE_SPHERICAL_HPP
0012 
0013 
0014 #include <type_traits>
0015 
0016 #include <boost/geometry/strategy/spherical/envelope_box.hpp>
0017 #include <boost/geometry/strategy/spherical/envelope_boxes.hpp>
0018 #include <boost/geometry/strategy/spherical/envelope_multipoint.hpp>
0019 #include <boost/geometry/strategy/spherical/envelope_point.hpp>
0020 #include <boost/geometry/strategy/spherical/envelope_range.hpp>
0021 #include <boost/geometry/strategy/spherical/envelope_segment.hpp>
0022 
0023 #include <boost/geometry/strategies/envelope/services.hpp>
0024 #include <boost/geometry/strategies/expand/spherical.hpp>
0025 
0026 
0027 namespace boost { namespace geometry
0028 {
0029 
0030 namespace strategies { namespace envelope
0031 {
0032 
0033 #ifndef DOXYGEN_NO_DETAIL
0034 namespace detail
0035 {
0036 
0037 template <typename RadiusTypeOrSphere, typename CalculationType>
0038 struct spherical
0039     : strategies::expand::detail::spherical<RadiusTypeOrSphere, CalculationType>
0040 {
0041     spherical() = default;
0042 
0043     template <typename RadiusOrSphere>
0044     explicit spherical(RadiusOrSphere const& radius_or_sphere)
0045         : strategies::expand::detail::spherical<RadiusTypeOrSphere, CalculationType>(radius_or_sphere)
0046     {}
0047 
0048     template <typename Geometry, typename Box>
0049     static auto envelope(Geometry const&, Box const&,
0050                          util::enable_if_point_t<Geometry> * = nullptr)
0051     {
0052         return strategy::envelope::spherical_point();
0053     }
0054 
0055     template <typename Geometry, typename Box>
0056     static auto envelope(Geometry const&, Box const&,
0057                          util::enable_if_multi_point_t<Geometry> * = nullptr)
0058     {
0059         return strategy::envelope::spherical_multipoint();
0060     }
0061 
0062     template <typename Geometry, typename Box>
0063     static auto envelope(Geometry const&, Box const&,
0064                          util::enable_if_box_t<Geometry> * = nullptr)
0065     {
0066         return strategy::envelope::spherical_box();
0067     }
0068 
0069     template <typename Geometry, typename Box>
0070     static auto envelope(Geometry const&, Box const&,
0071                          util::enable_if_segment_t<Geometry> * = nullptr)
0072     {
0073         return strategy::envelope::spherical_segment<CalculationType>();
0074     }
0075 
0076     template <typename Geometry, typename Box>
0077     static auto envelope(Geometry const&, Box const&,
0078                          util::enable_if_linestring_t<Geometry> * = nullptr)
0079     {
0080         return strategy::envelope::spherical_linestring<CalculationType>();
0081     }
0082 
0083     template <typename Geometry, typename Box>
0084     static auto envelope(Geometry const&, Box const&,
0085                          std::enable_if_t
0086                             <
0087                                 util::is_ring<Geometry>::value
0088                              || util::is_polygon<Geometry>::value
0089                             > * = nullptr)
0090     {
0091         return strategy::envelope::spherical_ring<CalculationType>();
0092     }
0093 
0094     template <typename Geometry, typename Box>
0095     static auto envelope(Geometry const&, Box const&,
0096                          std::enable_if_t
0097                             <
0098                                 util::is_multi_linestring<Geometry>::value
0099                              || util::is_multi_polygon<Geometry>::value
0100                              || util::is_geometry_collection<Geometry>::value
0101                             > * = nullptr)
0102     {
0103         return strategy::envelope::spherical_boxes();
0104     }
0105 };
0106 
0107 
0108 } // namespace detail
0109 #endif // DOXYGEN_NO_DETAIL
0110 
0111 
0112 template <typename CalculationType = void>
0113 class spherical
0114     : public strategies::envelope::detail::spherical<void, CalculationType>
0115 {};
0116 
0117 
0118 namespace services
0119 {
0120 
0121 template <typename Geometry, typename Box>
0122 struct default_strategy<Geometry, Box, spherical_tag>
0123 {
0124     using type = strategies::envelope::spherical<>;
0125 };
0126 
0127 template <typename Geometry, typename Box>
0128 struct default_strategy<Geometry, Box, spherical_equatorial_tag>
0129 {
0130     using type = strategies::envelope::spherical<>;
0131 };
0132 
0133 template <typename Geometry, typename Box>
0134 struct default_strategy<Geometry, Box, spherical_polar_tag>
0135 {
0136     using type = strategies::envelope::spherical<>;
0137 };
0138 
0139 
0140 template <>
0141 struct strategy_converter<strategy::envelope::spherical_point>
0142 {
0143     static auto get(strategy::envelope::spherical_point const& )
0144     {
0145         return strategies::envelope::spherical<>();
0146     }
0147 };
0148 
0149 template <>
0150 struct strategy_converter<strategy::envelope::spherical_multipoint>
0151 {
0152     static auto get(strategy::envelope::spherical_multipoint const&)
0153     {
0154         return strategies::envelope::spherical<>();
0155     }
0156 };
0157 
0158 template <>
0159 struct strategy_converter<strategy::envelope::spherical_box>
0160 {
0161     static auto get(strategy::envelope::spherical_box const& )
0162     {
0163         return strategies::envelope::spherical<>();
0164     }
0165 };
0166 
0167 template <typename CT>
0168 struct strategy_converter<strategy::envelope::spherical_segment<CT> >
0169 {
0170     static auto get(strategy::envelope::spherical_segment<CT> const&)
0171     {
0172         return strategies::envelope::spherical<CT>();
0173     }
0174 };
0175 
0176 template <typename CT>
0177 struct strategy_converter<strategy::envelope::spherical<CT> >
0178 {
0179     static auto get(strategy::envelope::spherical<CT> const&)
0180     {
0181         return strategies::envelope::spherical<CT>();
0182     }
0183 };
0184 
0185 
0186 } // namespace services
0187 
0188 }} // namespace strategies::envelope
0189 
0190 }} // namespace boost::geometry
0191 
0192 #endif // BOOST_GEOMETRY_STRATEGIES_ENVELOPE_SPHERICAL_HPP