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.
6 // Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France.
8 // This file was modified by Oracle on 2015.
9 // Modifications copyright (c) 2015, Oracle and/or its affiliates.
11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
13 // Distributed under the Boost Software License, Version 1.0.
14 // (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP
18 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP
20 #include <boost/mpl/assert.hpp>
21 #include <boost/type_traits/is_same.hpp>
23 #include <boost/geometry/core/coordinate_dimension.hpp>
24 #include <boost/geometry/core/tags.hpp>
26 #include <boost/geometry/algorithms/detail/envelope/box.hpp>
27 #include <boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp>
28 #include <boost/geometry/algorithms/detail/envelope/segment.hpp>
30 #include <boost/geometry/algorithms/detail/expand/indexed.hpp>
32 #include <boost/geometry/algorithms/dispatch/expand.hpp>
35 namespace boost { namespace geometry
38 #ifndef DOXYGEN_NO_DETAIL
39 namespace detail { namespace expand
43 struct segment_on_sphere
45 template <typename Box, typename Segment>
46 static inline void apply(Box& box, Segment const& segment)
50 // compute the envelope of the segment
51 detail::envelope::envelope_segment_on_sphere
53 dimension<Segment>::value
54 >::apply(segment, mbrs[0]);
57 detail::envelope::envelope_box_on_spheroid::apply(box, mbrs[1]);
59 // compute the envelope of the two boxes
60 detail::envelope::envelope_range_of_boxes::apply(mbrs, box);
65 }} // namespace detail::expand
66 #endif // DOXYGEN_NO_DETAIL
68 #ifndef DOXYGEN_NO_DISPATCH
75 typename Box, typename Segment,
76 typename StrategyLess, typename StrategyGreater,
77 typename CSTagOut, typename CSTag
82 StrategyLess, StrategyGreater,
85 > : detail::expand::expand_indexed
87 0, dimension<Segment>::value, StrategyLess, StrategyGreater
90 BOOST_MPL_ASSERT_MSG((boost::is_same<CSTagOut, CSTag>::value),
91 COORDINATE_SYSTEMS_MUST_BE_THE_SAME,
92 (types<CSTagOut, CSTag>()));
97 typename Box, typename Segment,
98 typename StrategyLess, typename StrategyGreater
103 StrategyLess, StrategyGreater,
104 box_tag, segment_tag,
105 spherical_equatorial_tag, spherical_equatorial_tag
106 > : detail::expand::segment_on_sphere
110 } // namespace dispatch
111 #endif // DOXYGEN_NO_DISPATCH
113 }} // namespace boost::geometry
115 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP