Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / geometry / strategies / geographic / envelope.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
6
7 // This file was modified by Oracle on 2015, 2016, 2018, 2019.
8 // Modifications copyright (c) 2015-2019, Oracle and/or its affiliates.
9
10 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
12 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
13
14 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
15 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
16
17 // Distributed under the Boost Software License, Version 1.0.
18 // (See accompanying file LICENSE_1_0.txt or copy at
19 // http://www.boost.org/LICENSE_1_0.txt)
20
21 #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_ENVELOPE_HPP
22 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_ENVELOPE_HPP
23
24 #include <boost/geometry/srs/spheroid.hpp>
25
26 #include <boost/geometry/strategies/geographic/envelope_segment.hpp>
27 #include <boost/geometry/strategies/geographic/expand_segment.hpp>
28 #include <boost/geometry/strategies/geographic/parameters.hpp>
29 #include <boost/geometry/strategies/spherical/envelope.hpp>
30
31 namespace boost { namespace geometry
32 {
33
34 namespace strategy { namespace envelope
35 {
36
37
38 template
39 <
40     typename FormulaPolicy = strategy::andoyer,
41     typename Spheroid = geometry::srs::spheroid<double>,
42     typename CalculationType = void
43 >
44 class geographic
45     : public spherical<CalculationType>
46 {
47 public:
48     typedef geographic_tag cs_tag;
49
50     typedef Spheroid model_type;
51
52     inline geographic()
53         : m_spheroid()
54     {}
55
56     explicit inline geographic(Spheroid const& spheroid)
57         : m_spheroid(spheroid)
58     {}
59
60     typedef geographic_segment
61         <
62             FormulaPolicy, Spheroid, CalculationType
63         > element_envelope_strategy_type;
64     inline element_envelope_strategy_type get_element_envelope_strategy() const
65     {
66         return element_envelope_strategy_type(m_spheroid);
67     }
68
69     typedef expand::geographic_segment
70         <
71             FormulaPolicy, Spheroid, CalculationType
72         > element_expand_strategy_type;
73     inline element_expand_strategy_type get_element_expand_strategy() const
74     {
75         return element_expand_strategy_type(m_spheroid);
76     }
77
78     template <typename Point1, typename Point2, typename Box>
79     inline void apply(Point1 const& point1, Point2 const& point2, Box& box) const
80     {
81         geographic_segment
82             <
83                 FormulaPolicy,
84                 Spheroid,
85                 CalculationType
86             >(m_spheroid).apply(point1, point2, box);
87     }
88
89 private:
90     Spheroid m_spheroid;
91 };
92
93 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
94
95 namespace services
96 {
97
98 template <typename Tag, typename CalculationType>
99 struct default_strategy<Tag, geographic_tag, CalculationType>
100 {
101     typedef strategy::envelope::geographic
102         <
103             strategy::andoyer,
104             geometry::srs::spheroid<double>,
105             CalculationType
106         > type;
107 };
108
109 }
110
111 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
112
113
114 }} // namespace strategy::envelope
115
116 }} //namepsace boost::geometry
117
118 #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_ENVELOPE_HPP