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, 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_CARTESIAN_HPP
0011 #define BOOST_GEOMETRY_STRATEGIES_ENVELOPE_CARTESIAN_HPP
0012 
0013 
0014 #include <type_traits>
0015 
0016 #include <boost/geometry/strategy/cartesian/envelope.hpp> // Not used, for backward compatibility
0017 #include <boost/geometry/strategy/cartesian/envelope_box.hpp>
0018 #include <boost/geometry/strategy/cartesian/envelope_boxes.hpp>
0019 #include <boost/geometry/strategy/cartesian/envelope_multipoint.hpp>
0020 #include <boost/geometry/strategy/cartesian/envelope_point.hpp>
0021 #include <boost/geometry/strategy/cartesian/envelope_range.hpp>
0022 #include <boost/geometry/strategy/cartesian/envelope_segment.hpp>
0023 
0024 #include <boost/geometry/strategies/envelope/services.hpp>
0025 #include <boost/geometry/strategies/expand/cartesian.hpp>
0026 
0027 
0028 namespace boost { namespace geometry
0029 {
0030 
0031 namespace strategies { namespace envelope
0032 {
0033 
0034 template <typename CalculationType = void>
0035 struct cartesian
0036     : strategies::expand::cartesian<CalculationType>
0037 {
0038     template <typename Geometry, typename Box>
0039     static auto envelope(Geometry const&, Box const&,
0040                          util::enable_if_point_t<Geometry> * = nullptr)
0041     {
0042         return strategy::envelope::cartesian_point();
0043     }
0044 
0045     template <typename Geometry, typename Box>
0046     static auto envelope(Geometry const&, Box const&,
0047                          util::enable_if_multi_point_t<Geometry> * = nullptr)
0048     {
0049         return strategy::envelope::cartesian_multipoint();
0050     }
0051 
0052     template <typename Geometry, typename Box>
0053     static auto envelope(Geometry const&, Box const&,
0054                          util::enable_if_box_t<Geometry> * = nullptr)
0055     {
0056         return strategy::envelope::cartesian_box();
0057     }
0058 
0059     template <typename Geometry, typename Box>
0060     static auto envelope(Geometry const&, Box const&,
0061                          util::enable_if_segment_t<Geometry> * = nullptr)
0062     {
0063         return strategy::envelope::cartesian_segment<CalculationType>();
0064     }
0065 
0066     template <typename Geometry, typename Box>
0067     static auto envelope(Geometry const&, Box const&,
0068                          std::enable_if_t
0069                             <
0070                                 util::is_linestring<Geometry>::value
0071                              || util::is_ring<Geometry>::value
0072                              || util::is_polygon<Geometry>::value
0073                             > * = nullptr)
0074     {
0075         return strategy::envelope::cartesian_range();
0076     }
0077 
0078     template <typename Geometry, typename Box>
0079     static auto envelope(Geometry const&, Box const&,
0080                          std::enable_if_t
0081                             <
0082                                 util::is_multi_linestring<Geometry>::value
0083                              || util::is_multi_polygon<Geometry>::value
0084                              || util::is_geometry_collection<Geometry>::value
0085                             > * = nullptr)
0086     {
0087         return strategy::envelope::cartesian_boxes();
0088     }
0089 };
0090 
0091 
0092 namespace services
0093 {
0094 
0095 template <typename Geometry, typename Box>
0096 struct default_strategy<Geometry, Box, cartesian_tag>
0097 {
0098     using type = strategies::envelope::cartesian<>;
0099 };
0100 
0101 
0102 template <>
0103 struct strategy_converter<strategy::envelope::cartesian_point>
0104 {
0105     static auto get(strategy::envelope::cartesian_point const& )
0106     {
0107         return strategies::envelope::cartesian<>();
0108     }
0109 };
0110 
0111 template <>
0112 struct strategy_converter<strategy::envelope::cartesian_multipoint>
0113 {
0114     static auto get(strategy::envelope::cartesian_multipoint const&)
0115     {
0116         return strategies::envelope::cartesian<>();
0117     }
0118 };
0119 
0120 template <>
0121 struct strategy_converter<strategy::envelope::cartesian_box>
0122 {
0123     static auto get(strategy::envelope::cartesian_box const& )
0124     {
0125         return strategies::envelope::cartesian<>();
0126     }
0127 };
0128 
0129 template <typename CT>
0130 struct strategy_converter<strategy::envelope::cartesian_segment<CT> >
0131 {
0132     static auto get(strategy::envelope::cartesian_segment<CT> const&)
0133     {
0134         return strategies::envelope::cartesian<CT>();
0135     }
0136 };
0137 
0138 template <typename CT>
0139 struct strategy_converter<strategy::envelope::cartesian<CT> >
0140 {
0141     static auto get(strategy::envelope::cartesian<CT> const&)
0142     {
0143         return strategies::envelope::cartesian<CT>();
0144     }
0145 };
0146 
0147 
0148 } // namespace services
0149 
0150 }} // namespace strategies::envelope
0151 
0152 }} // namespace boost::geometry
0153 
0154 #endif // BOOST_GEOMETRY_STRATEGIES_ENVELOPE_CARTESIAN_HPP