]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
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 | // Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France. | |
7 | ||
8 | // This file was modified by Oracle on 2015-2020. | |
9 | // Modifications copyright (c) 2015-2020, Oracle and/or its affiliates. | |
10 | ||
11 | // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle | |
12 | // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle | |
13 | // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle | |
14 | ||
15 | // Distributed under the Boost Software License, Version 1.0. | |
16 | // (See accompanying file LICENSE_1_0.txt or copy at | |
17 | // http://www.boost.org/LICENSE_1_0.txt) | |
18 | ||
19 | #ifndef BOOST_GEOMETRY_STRATEGY_SPHERICAL_EXPAND_SEGMENT_HPP | |
20 | #define BOOST_GEOMETRY_STRATEGY_SPHERICAL_EXPAND_SEGMENT_HPP | |
21 | ||
22 | #include <cstddef> | |
23 | #include <functional> | |
24 | ||
25 | #include <boost/geometry/core/access.hpp> | |
26 | #include <boost/geometry/core/tags.hpp> | |
27 | ||
28 | #include <boost/geometry/util/select_coordinate_type.hpp> | |
29 | ||
30 | #include <boost/geometry/algorithms/detail/envelope/box.hpp> | |
31 | #include <boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp> | |
32 | #include <boost/geometry/algorithms/detail/envelope/segment.hpp> | |
33 | ||
34 | #include <boost/geometry/strategy/expand.hpp> | |
35 | #include <boost/geometry/strategy/spherical/envelope_box.hpp> | |
36 | #include <boost/geometry/strategy/spherical/envelope_segment.hpp> | |
37 | ||
38 | ||
39 | namespace boost { namespace geometry | |
40 | { | |
41 | ||
42 | namespace strategy { namespace expand | |
43 | { | |
44 | ||
45 | #ifndef DOXYGEN_NO_DETAIL | |
46 | namespace detail | |
47 | { | |
48 | ||
49 | struct segment_on_spheroid | |
50 | { | |
51 | template <typename Box, typename Segment, typename Strategy> | |
52 | static inline void apply(Box& box, Segment const& segment, Strategy const& strategy) | |
53 | { | |
54 | Box mbrs[2]; | |
55 | ||
56 | // compute the envelope of the segment | |
57 | geometry::detail::envelope::envelope_segment::apply(segment, mbrs[0], strategy); | |
58 | ||
59 | // normalize the box | |
60 | strategy::envelope::spherical_box::apply(box, mbrs[1]); | |
61 | ||
62 | // compute the envelope of the two boxes | |
63 | geometry::detail::envelope::envelope_range_of_boxes::apply(mbrs, box); | |
64 | } | |
65 | }; | |
66 | ||
67 | } // namespace detail | |
68 | #endif // DOXYGEN_NO_DETAIL | |
69 | ||
70 | ||
71 | template | |
72 | < | |
73 | typename CalculationType = void | |
74 | > | |
75 | class spherical_segment | |
76 | { | |
77 | public: | |
78 | template <typename Box, typename Segment> | |
79 | static inline void apply(Box& box, Segment const& segment) | |
80 | { | |
81 | detail::segment_on_spheroid::apply(box, segment, | |
82 | strategy::envelope::spherical_segment<CalculationType>()); | |
83 | } | |
84 | }; | |
85 | ||
86 | ||
87 | #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS | |
88 | ||
89 | namespace services | |
90 | { | |
91 | ||
92 | template <typename CalculationType> | |
93 | struct default_strategy<segment_tag, spherical_equatorial_tag, CalculationType> | |
94 | { | |
95 | typedef spherical_segment<CalculationType> type; | |
96 | }; | |
97 | ||
98 | template <typename CalculationType> | |
99 | struct default_strategy<segment_tag, spherical_polar_tag, CalculationType> | |
100 | { | |
101 | typedef spherical_segment<CalculationType> type; | |
102 | }; | |
103 | ||
104 | } // namespace services | |
105 | ||
106 | #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS | |
107 | ||
108 | ||
109 | }} // namespace strategy::expand | |
110 | ||
111 | }} // namespace boost::geometry | |
112 | ||
113 | #endif // BOOST_GEOMETRY_STRATEGY_SPHERICAL_EXPAND_SEGMENT_HPP |