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, 2016.
9 // Modifications copyright (c) 2015-2016, Oracle and/or its affiliates.
11 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
12 // Contributed and/or modified by Menelaos Karavelas, 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_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP
19 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP
21 #include <boost/mpl/assert.hpp>
22 #include <boost/type_traits/is_same.hpp>
24 #include <boost/geometry/core/coordinate_dimension.hpp>
25 #include <boost/geometry/core/tags.hpp>
27 #include <boost/geometry/algorithms/detail/envelope/box.hpp>
28 #include <boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp>
29 #include <boost/geometry/algorithms/detail/envelope/segment.hpp>
31 #include <boost/geometry/algorithms/detail/expand/indexed.hpp>
33 #include <boost/geometry/algorithms/dispatch/expand.hpp>
36 namespace boost { namespace geometry
39 #ifndef DOXYGEN_NO_DETAIL
40 namespace detail { namespace expand
45 template <typename Box, typename Segment, typename Strategy>
46 static inline void apply(Box& box,
47 Segment const& segment,
48 Strategy const& strategy)
52 // compute the envelope of the segment
53 typename point_type<Segment>::type p[2];
54 detail::assign_point_from_index<0>(segment, p[0]);
55 detail::assign_point_from_index<1>(segment, p[1]);
56 detail::envelope::envelope_segment
58 dimension<Segment>::value
59 >::apply(p[0], p[1], mbrs[0], strategy);
62 detail::envelope::envelope_box_on_spheroid::apply(box, mbrs[1], strategy);
64 // compute the envelope of the two boxes
65 detail::envelope::envelope_range_of_boxes::apply(mbrs, box, strategy);
70 }} // namespace detail::expand
71 #endif // DOXYGEN_NO_DETAIL
73 #ifndef DOXYGEN_NO_DISPATCH
79 typename Box, typename Segment,
80 typename StrategyLess, typename StrategyGreater,
81 typename CSTagOut, typename CSTag
86 StrategyLess, StrategyGreater,
89 > : detail::expand::expand_indexed
91 0, dimension<Segment>::value, StrategyLess, StrategyGreater
94 BOOST_MPL_ASSERT_MSG((boost::is_same<CSTagOut, CSTag>::value),
95 COORDINATE_SYSTEMS_MUST_BE_THE_SAME,
96 (types<CSTagOut, CSTag>()));
101 typename Box, typename Segment,
102 typename StrategyLess, typename StrategyGreater
107 StrategyLess, StrategyGreater,
108 box_tag, segment_tag,
109 spherical_equatorial_tag, spherical_equatorial_tag
110 > : detail::expand::segment
115 typename Box, typename Segment,
116 typename StrategyLess, typename StrategyGreater
121 StrategyLess, StrategyGreater,
122 box_tag, segment_tag,
123 geographic_tag, geographic_tag
124 > : detail::expand::segment
127 } // namespace dispatch
128 #endif // DOXYGEN_NO_DISPATCH
130 }} // namespace boost::geometry
133 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP