]>
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 | ||
7 | // This file was modified by Oracle on 2015, 2016, 2017, 2018. | |
8 | // Modifications copyright (c) 2015-2018, 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 | // Distributed under the Boost Software License, Version 1.0. | |
15 | // (See accompanying file LICENSE_1_0.txt or copy at | |
16 | // http://www.boost.org/LICENSE_1_0.txt) | |
17 | ||
18 | #ifndef BOOST_GEOMETRY_STRATEGY_SPHERICAL_ENVELOPE_POINT_HPP | |
19 | #define BOOST_GEOMETRY_STRATEGY_SPHERICAL_ENVELOPE_POINT_HPP | |
20 | ||
21 | #include <cstddef> | |
22 | ||
23 | #include <boost/geometry/core/access.hpp> | |
24 | #include <boost/geometry/core/cs.hpp> | |
25 | #include <boost/geometry/core/coordinate_dimension.hpp> | |
26 | #include <boost/geometry/core/coordinate_system.hpp> | |
27 | #include <boost/geometry/core/tags.hpp> | |
28 | ||
29 | #include <boost/geometry/views/detail/indexed_point_view.hpp> | |
30 | ||
31 | #include <boost/geometry/algorithms/detail/convert_point_to_point.hpp> | |
32 | #include <boost/geometry/algorithms/detail/normalize.hpp> | |
33 | ||
34 | #include <boost/geometry/algorithms/detail/envelope/transform_units.hpp> | |
35 | ||
36 | #include <boost/geometry/strategy/cartesian/envelope_point.hpp> | |
37 | ||
38 | #include <boost/geometry/strategy/envelope.hpp> | |
39 | ||
40 | ||
41 | namespace boost { namespace geometry | |
42 | { | |
43 | ||
44 | namespace strategy { namespace envelope | |
45 | { | |
46 | ||
47 | struct spherical_point | |
48 | { | |
49 | template<typename Point, typename Box> | |
50 | static inline void apply(Point const& point, Box& mbr) | |
51 | { | |
52 | Point normalized_point; | |
53 | strategy::normalize::spherical_point::apply(point, normalized_point); | |
54 | ||
55 | typename point_type<Box>::type box_point; | |
56 | ||
57 | // transform units of input point to units of a box point | |
58 | geometry::detail::envelope::transform_units(normalized_point, box_point); | |
59 | ||
60 | geometry::set<min_corner, 0>(mbr, geometry::get<0>(box_point)); | |
61 | geometry::set<min_corner, 1>(mbr, geometry::get<1>(box_point)); | |
62 | ||
63 | geometry::set<max_corner, 0>(mbr, geometry::get<0>(box_point)); | |
64 | geometry::set<max_corner, 1>(mbr, geometry::get<1>(box_point)); | |
65 | ||
66 | typedef geometry::detail::envelope::envelope_one_point | |
67 | < | |
68 | 2, dimension<Point>::value | |
69 | > per_corner; | |
70 | per_corner::template apply<min_corner>(normalized_point, mbr); | |
71 | per_corner::template apply<max_corner>(normalized_point, mbr); | |
72 | } | |
73 | }; | |
74 | ||
75 | ||
76 | #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS | |
77 | ||
78 | namespace services | |
79 | { | |
80 | ||
81 | template <typename CalculationType> | |
82 | struct default_strategy<point_tag, spherical_equatorial_tag, CalculationType> | |
83 | { | |
84 | typedef strategy::envelope::spherical_point type; | |
85 | }; | |
86 | ||
87 | template <typename CalculationType> | |
88 | struct default_strategy<point_tag, spherical_polar_tag, CalculationType> | |
89 | { | |
90 | typedef strategy::envelope::spherical_point type; | |
91 | }; | |
92 | ||
93 | template <typename CalculationType> | |
94 | struct default_strategy<point_tag, geographic_tag, CalculationType> | |
95 | { | |
96 | typedef strategy::envelope::spherical_point type; | |
97 | }; | |
98 | ||
99 | ||
100 | } | |
101 | ||
102 | #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS | |
103 | ||
104 | ||
105 | }} // namespace strategy::envelope | |
106 | ||
107 | ||
108 | }} // namespace boost::geometry | |
109 | ||
110 | ||
111 | #endif // BOOST_GEOMETRY_STRATEGY_SPHERICAL_ENVELOPE_POINT_HPP |