]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
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_EXPAND_SPHERICAL_HPP | |
11 | #define BOOST_GEOMETRY_STRATEGIES_EXPAND_SPHERICAL_HPP | |
12 | ||
13 | ||
14 | #include <type_traits> | |
15 | ||
16 | #include <boost/geometry/strategy/spherical/expand_box.hpp> | |
17 | #include <boost/geometry/strategy/spherical/expand_point.hpp> | |
18 | #include <boost/geometry/strategy/spherical/expand_segment.hpp> | |
19 | ||
20 | #include <boost/geometry/strategies/detail.hpp> | |
21 | #include <boost/geometry/strategies/expand/services.hpp> | |
22 | ||
23 | ||
24 | namespace boost { namespace geometry | |
25 | { | |
26 | ||
27 | ||
28 | namespace strategies { namespace expand | |
29 | { | |
30 | ||
31 | template | |
32 | < | |
33 | typename CalculationType = void | |
34 | > | |
35 | class spherical : strategies::detail::spherical_base<void> | |
36 | { | |
37 | using base_t = strategies::detail::spherical_base<void>; | |
38 | ||
39 | public: | |
40 | template <typename Box, typename Geometry> | |
41 | static auto expand(Box const&, Geometry const&, | |
42 | typename util::enable_if_point_t<Geometry> * = nullptr) | |
43 | { | |
44 | return strategy::expand::spherical_point(); | |
45 | } | |
46 | ||
47 | template <typename Box, typename Geometry> | |
48 | static auto expand(Box const&, Geometry const&, | |
49 | typename util::enable_if_box_t<Geometry> * = nullptr) | |
50 | { | |
51 | return strategy::expand::spherical_box(); | |
52 | } | |
53 | ||
54 | template <typename Box, typename Geometry> | |
55 | static auto expand(Box const&, Geometry const&, | |
56 | typename util::enable_if_segment_t<Geometry> * = nullptr) | |
57 | { | |
58 | return strategy::expand::spherical_segment<CalculationType>(); | |
59 | } | |
60 | }; | |
61 | ||
62 | ||
63 | namespace services | |
64 | { | |
65 | ||
66 | template <typename Box, typename Geometry> | |
67 | struct default_strategy<Box, Geometry, spherical_tag> | |
68 | { | |
69 | using type = strategies::expand::spherical<>; | |
70 | }; | |
71 | ||
72 | template <typename Box, typename Geometry> | |
73 | struct default_strategy<Box, Geometry, spherical_equatorial_tag> | |
74 | { | |
75 | using type = strategies::expand::spherical<>; | |
76 | }; | |
77 | ||
78 | template <typename Box, typename Geometry> | |
79 | struct default_strategy<Box, Geometry, spherical_polar_tag> | |
80 | { | |
81 | using type = strategies::expand::spherical<>; | |
82 | }; | |
83 | ||
84 | ||
85 | template <> | |
86 | struct strategy_converter<strategy::expand::spherical_point> | |
87 | { | |
88 | static auto get(strategy::expand::spherical_point const& ) | |
89 | { | |
90 | return strategies::expand::spherical<>(); | |
91 | } | |
92 | }; | |
93 | ||
94 | template <> | |
95 | struct strategy_converter<strategy::expand::spherical_box> | |
96 | { | |
97 | static auto get(strategy::expand::spherical_box const& ) | |
98 | { | |
99 | return strategies::expand::spherical<>(); | |
100 | } | |
101 | }; | |
102 | ||
103 | template <typename CT> | |
104 | struct strategy_converter<strategy::expand::spherical_segment<CT> > | |
105 | { | |
106 | static auto get(strategy::expand::spherical_segment<CT> const&) | |
107 | { | |
108 | return strategies::expand::spherical<CT>(); | |
109 | } | |
110 | }; | |
111 | ||
112 | ||
113 | } // namespace services | |
114 | ||
115 | }} // namespace strategies::envelope | |
116 | ||
117 | }} // namespace boost::geometry | |
118 | ||
119 | #endif // BOOST_GEOMETRY_STRATEGIES_EXPAND_SPHERICAL_HPP |