1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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.
7 // This file was modified by Oracle on 2015, 2016, 2017, 2018.
8 // Modifications copyright (c) 2015-2018, Oracle and/or its affiliates.
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
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)
18 #ifndef BOOST_GEOMETRY_STRATEGY_SPHERICAL_ENVELOPE_POINT_HPP
19 #define BOOST_GEOMETRY_STRATEGY_SPHERICAL_ENVELOPE_POINT_HPP
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>
29 #include <boost/geometry/views/detail/indexed_point_view.hpp>
31 #include <boost/geometry/algorithms/detail/convert_point_to_point.hpp>
32 #include <boost/geometry/algorithms/detail/normalize.hpp>
34 #include <boost/geometry/algorithms/detail/envelope/transform_units.hpp>
36 #include <boost/geometry/strategy/cartesian/envelope_point.hpp>
38 #include <boost/geometry/strategy/envelope.hpp>
41 namespace boost { namespace geometry
44 namespace strategy { namespace envelope
47 struct spherical_point
49 template<typename Point, typename Box>
50 static inline void apply(Point const& point, Box& mbr)
52 Point normalized_point;
53 strategy::normalize::spherical_point::apply(point, normalized_point);
55 typename point_type<Box>::type box_point;
57 // transform units of input point to units of a box point
58 geometry::detail::envelope::transform_units(normalized_point, box_point);
60 geometry::set<min_corner, 0>(mbr, geometry::get<0>(box_point));
61 geometry::set<min_corner, 1>(mbr, geometry::get<1>(box_point));
63 geometry::set<max_corner, 0>(mbr, geometry::get<0>(box_point));
64 geometry::set<max_corner, 1>(mbr, geometry::get<1>(box_point));
66 typedef geometry::detail::envelope::envelope_one_point
68 2, dimension<Point>::value
70 per_corner::template apply<min_corner>(normalized_point, mbr);
71 per_corner::template apply<max_corner>(normalized_point, mbr);
76 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
81 template <typename CalculationType>
82 struct default_strategy<point_tag, spherical_equatorial_tag, CalculationType>
84 typedef strategy::envelope::spherical_point type;
87 template <typename CalculationType>
88 struct default_strategy<point_tag, spherical_polar_tag, CalculationType>
90 typedef strategy::envelope::spherical_point type;
93 template <typename CalculationType>
94 struct default_strategy<point_tag, geographic_tag, CalculationType>
96 typedef strategy::envelope::spherical_point type;
102 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
105 }} // namespace strategy::envelope
108 }} // namespace boost::geometry
111 #endif // BOOST_GEOMETRY_STRATEGY_SPHERICAL_ENVELOPE_POINT_HPP