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, 2018, 2019.
8 // Modifications copyright (c) 2015-2019, 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 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
15 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
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)
21 #ifndef BOOST_GEOMETRY_STRATEGIES_SPHERICAL_ENVELOPE_HPP
22 #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_ENVELOPE_HPP
24 #include <boost/geometry/algorithms/detail/envelope/initialize.hpp>
25 #include <boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp>
27 #include <boost/geometry/iterators/segment_iterator.hpp>
29 #include <boost/geometry/strategies/spherical/envelope_box.hpp>
30 #include <boost/geometry/strategies/spherical/envelope_segment.hpp>
31 #include <boost/geometry/strategies/spherical/expand_box.hpp>
32 #include <boost/geometry/strategies/spherical/expand_segment.hpp>
34 namespace boost { namespace geometry
37 namespace strategy { namespace envelope
40 template <typename CalculationType = void>
44 typedef spherical_tag cs_tag;
46 typedef spherical_segment<CalculationType> element_envelope_strategy_type;
47 static inline element_envelope_strategy_type get_element_envelope_strategy()
49 return element_envelope_strategy_type();
52 typedef expand::spherical_segment<CalculationType> element_expand_strategy_type;
53 static inline element_expand_strategy_type get_element_expand_strategy()
55 return element_expand_strategy_type();
58 typedef strategy::expand::spherical_box box_expand_strategy_type;
59 static inline box_expand_strategy_type get_box_expand_strategy()
61 return box_expand_strategy_type();
64 // Linestring, Ring, Polygon
66 template <typename Range>
67 static inline geometry::segment_iterator<Range const> begin(Range const& range)
69 return geometry::segments_begin(range);
72 template <typename Range>
73 static inline geometry::segment_iterator<Range const> end(Range const& range)
75 return geometry::segments_end(range);
78 // MultiLinestring, MultiPolygon
80 template <typename Box>
83 void apply(Box const& single_box)
85 m_boxes.push_back(single_box);
88 void result(Box & box)
92 geometry::detail::envelope::envelope_range_of_boxes::apply(m_boxes, box);
96 geometry::detail::envelope::initialize<Box, 0, dimension<Box>::value>::apply(box);
101 std::vector<Box> m_boxes;
106 template <typename Point1, typename Point2, typename Box>
107 static inline void apply(Point1 const& point1, Point2 const& point2,
110 spherical_segment<CalculationType>::apply(point1, point2, box);
115 template <typename BoxIn, typename Box>
116 static inline void apply(BoxIn const& box_in, Box& box)
118 spherical_box::apply(box_in, box);
122 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
127 template <typename Tag, typename CalculationType>
128 struct default_strategy<Tag, spherical_equatorial_tag, CalculationType>
130 typedef strategy::envelope::spherical<CalculationType> type;
133 template <typename Tag, typename CalculationType>
134 struct default_strategy<Tag, spherical_polar_tag, CalculationType>
136 typedef strategy::envelope::spherical<CalculationType> type;
141 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
144 }} // namespace strategy::envelope
146 }} //namepsace boost::geometry
148 #endif // BOOST_GEOMETRY_STRATEGIES_SPHERICAL_ENVELOPE_HPP