]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/strategies/geographic/envelope_segment.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / geometry / strategies / geographic / envelope_segment.hpp
CommitLineData
b32b8144
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2017 Oracle and/or its affiliates.
4// Contributed and/or modified by Vissarion Fisikopoulos, on behalf of Oracle
5// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
6
7// Use, modification and distribution is subject to the Boost Software License,
8// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10
11#ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_ENVELOPE_SEGMENT_HPP
12#define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_ENVELOPE_SEGMENT_HPP
13
14
15#include <boost/geometry/algorithms/detail/envelope/segment.hpp>
16#include <boost/geometry/algorithms/detail/normalize.hpp>
11fdf7f2
TL
17
18#include <boost/geometry/srs/spheroid.hpp>
19
b32b8144
FG
20#include <boost/geometry/strategies/envelope.hpp>
21#include <boost/geometry/strategies/geographic/azimuth.hpp>
22#include <boost/geometry/strategies/geographic/parameters.hpp>
23
24
25namespace boost { namespace geometry
26{
27
28namespace strategy { namespace envelope
29{
30
31template
32<
33 typename FormulaPolicy = strategy::andoyer,
34 typename Spheroid = geometry::srs::spheroid<double>,
35 typename CalculationType = void
36>
37class geographic_segment
38{
39public:
40 typedef Spheroid model_type;
41
42 inline geographic_segment()
43 : m_spheroid()
44 {}
45
46 explicit inline geographic_segment(Spheroid const& spheroid)
47 : m_spheroid(spheroid)
48 {}
49
50 template <typename Point1, typename Point2, typename Box>
51 inline void apply(Point1 const& point1, Point2 const& point2, Box& box) const
52 {
53 Point1 p1_normalized = detail::return_normalized<Point1>(point1);
54 Point2 p2_normalized = detail::return_normalized<Point2>(point2);
55
56 geometry::strategy::azimuth::geographic
57 <
58 FormulaPolicy,
59 Spheroid,
60 CalculationType
61 > azimuth_geographic(m_spheroid);
62
63 typedef typename coordinate_system<Point1>::type::units units_type;
64
65 detail::envelope::envelope_segment_impl
66 <
67 geographic_tag
68 >::template apply<units_type>(geometry::get<0>(p1_normalized),
69 geometry::get<1>(p1_normalized),
70 geometry::get<0>(p2_normalized),
71 geometry::get<1>(p2_normalized),
72 box,
73 azimuth_geographic);
74
75 }
76
77private:
78 Spheroid m_spheroid;
79};
80
81#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
82
83namespace services
84{
85
86template <typename CalculationType>
87struct default_strategy<geographic_tag, CalculationType>
88{
89 typedef strategy::envelope::geographic_segment
90 <
91 strategy::andoyer,
92 srs::spheroid<double>,
93 CalculationType
94 > type;
95};
96
97}
98
99#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
100
101
102}} // namespace strategy::envelope
103
104}} //namepsace boost::geometry
105
106#endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_ENVELOPE_SEGMENT_HPP