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_CARTESIAN_HPP
11 #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_HPP
12 
13 
14 #include <boost/geometry/strategies/area/cartesian.hpp>
15 #include <boost/geometry/strategies/envelope/cartesian.hpp>
16 #include <boost/geometry/strategies/expand/cartesian.hpp>
17 
18 
19 namespace boost { namespace geometry
20 {
21 
22 
23 namespace strategies
24 {
25 
26 
27 template <typename CalculationType = void>
28 struct cartesian : strategies::detail::cartesian_base
29 {
30     // area
31 
32     template <typename Geometry>
areaboost::geometry::strategies::cartesian33     static auto area(Geometry const&)
34     {
35         return strategy::area::cartesian<CalculationType>();
36     }
37 
38     // envelope
39 
40     template <typename Geometry, typename Box>
envelopeboost::geometry::strategies::cartesian41     static auto envelope(Geometry const&, Box const&,
42                          typename util::enable_if_point_t<Geometry> * = nullptr)
43     {
44         return strategy::envelope::cartesian_point();
45     }
46 
47     template <typename Geometry, typename Box>
envelopeboost::geometry::strategies::cartesian48     static auto envelope(Geometry const&, Box const&,
49                          typename util::enable_if_multi_point_t<Geometry> * = nullptr)
50     {
51         return strategy::envelope::cartesian_multipoint();
52     }
53 
54     template <typename Geometry, typename Box>
envelopeboost::geometry::strategies::cartesian55     static auto envelope(Geometry const&, Box const&,
56                          typename util::enable_if_box_t<Geometry> * = nullptr)
57     {
58         return strategy::envelope::cartesian_box();
59     }
60 
61     template <typename Geometry, typename Box>
envelopeboost::geometry::strategies::cartesian62     static auto envelope(Geometry const&, Box const&,
63                          typename util::enable_if_segment_t<Geometry> * = nullptr)
64     {
65         return strategy::envelope::cartesian_segment<CalculationType>();
66     }
67 
68     template <typename Geometry, typename Box>
envelopeboost::geometry::strategies::cartesian69     static auto envelope(Geometry const&, Box const&,
70                          typename util::enable_if_polysegmental_t<Geometry> * = nullptr)
71     {
72         return strategy::envelope::cartesian<CalculationType>();
73     }
74 
75     // expand
76 
77     template <typename Box, typename Geometry>
expandboost::geometry::strategies::cartesian78     static auto expand(Box const&, Geometry const&,
79                        typename util::enable_if_point_t<Geometry> * = nullptr)
80     {
81         return strategy::expand::cartesian_point();
82     }
83 
84     template <typename Box, typename Geometry>
expandboost::geometry::strategies::cartesian85     static auto expand(Box const&, Geometry const&,
86                        typename util::enable_if_box_t<Geometry> * = nullptr)
87     {
88         return strategy::expand::cartesian_box();
89     }
90 
91     template <typename Box, typename Geometry>
expandboost::geometry::strategies::cartesian92     static auto expand(Box const&, Geometry const&,
93                        typename util::enable_if_segment_t<Geometry> * = nullptr)
94     {
95         return strategy::expand::cartesian_segment();
96     }
97 };
98 
99 
100 } // namespace strategies
101 
102 
103 }} // namespace boost::geometry
104 
105 
106 #endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_HPP
107