]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
1 | // Boost.Geometry |
2 | ||
1e59de90 | 3 | // Copyright (c) 2020-2021, Oracle and/or its affiliates. |
20effc67 TL |
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_GEOGRAPHIC_HPP | |
11 | #define BOOST_GEOMETRY_STRATEGIES_EXPAND_GEOGRAPHIC_HPP | |
12 | ||
13 | ||
14 | #include <type_traits> | |
15 | ||
16 | #include <boost/geometry/strategy/geographic/expand_segment.hpp> | |
17 | ||
18 | #include <boost/geometry/strategies/detail.hpp> | |
19 | #include <boost/geometry/strategies/expand/spherical.hpp> | |
20 | ||
21 | ||
22 | namespace boost { namespace geometry | |
23 | { | |
24 | ||
25 | namespace strategies { namespace expand | |
26 | { | |
27 | ||
28 | template | |
29 | < | |
30 | typename FormulaPolicy = strategy::andoyer, | |
31 | typename Spheroid = srs::spheroid<double>, | |
32 | typename CalculationType = void | |
33 | > | |
1e59de90 TL |
34 | class geographic |
35 | : public strategies::detail::geographic_base<Spheroid> | |
20effc67 TL |
36 | { |
37 | using base_t = strategies::detail::geographic_base<Spheroid>; | |
38 | ||
39 | public: | |
1e59de90 | 40 | geographic() = default; |
20effc67 TL |
41 | |
42 | explicit geographic(Spheroid const& spheroid) | |
43 | : base_t(spheroid) | |
44 | {} | |
45 | ||
46 | template <typename Box, typename Geometry> | |
47 | static auto expand(Box const&, Geometry const&, | |
48 | typename util::enable_if_point_t<Geometry> * = nullptr) | |
49 | { | |
50 | return strategy::expand::spherical_point(); | |
51 | } | |
52 | ||
53 | template <typename Box, typename Geometry> | |
54 | static auto expand(Box const&, Geometry const&, | |
55 | typename util::enable_if_box_t<Geometry> * = nullptr) | |
56 | { | |
57 | return strategy::expand::spherical_box(); | |
58 | } | |
59 | ||
60 | template <typename Box, typename Geometry> | |
61 | auto expand(Box const&, Geometry const&, | |
62 | typename util::enable_if_segment_t<Geometry> * = nullptr) const | |
63 | { | |
64 | return strategy::expand::geographic_segment | |
65 | < | |
66 | FormulaPolicy, Spheroid, CalculationType | |
67 | >(base_t::m_spheroid); | |
68 | } | |
69 | }; | |
70 | ||
71 | ||
72 | namespace services | |
73 | { | |
74 | ||
75 | template <typename Box, typename Geometry> | |
76 | struct default_strategy<Box, Geometry, geographic_tag> | |
77 | { | |
78 | using type = strategies::expand::geographic<>; | |
79 | }; | |
80 | ||
81 | ||
82 | template <typename FP, typename S, typename CT> | |
83 | struct strategy_converter<strategy::expand::geographic_segment<FP, S, CT> > | |
84 | { | |
85 | static auto get(strategy::expand::geographic_segment<FP, S, CT> const& s) | |
86 | { | |
87 | return strategies::expand::geographic<FP, S, CT>(s.model()); | |
88 | } | |
89 | }; | |
90 | ||
91 | ||
92 | } // namespace services | |
93 | ||
94 | }} // namespace strategies::envelope | |
95 | ||
96 | }} // namespace boost::geometry | |
97 | ||
98 | #endif // BOOST_GEOMETRY_STRATEGIES_EXPAND_GEOGRAPHIC_HPP |