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, 2017.
9 // Modifications copyright (c) 2015-2017, 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
13 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
15 // Distributed under the Boost Software License, Version 1.0.
16 // (See accompanying file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
19 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP
20 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP
22 #include <boost/mpl/assert.hpp>
23 #include <boost/type_traits/is_same.hpp>
25 #include <boost/geometry/core/coordinate_dimension.hpp>
26 #include <boost/geometry/core/tags.hpp>
28 #include <boost/geometry/algorithms/detail/envelope/box.hpp>
29 #include <boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp>
30 #include <boost/geometry/algorithms/detail/envelope/segment.hpp>
32 #include <boost/geometry/algorithms/detail/expand/indexed.hpp>
34 #include <boost/geometry/algorithms/dispatch/expand.hpp>
37 namespace boost { namespace geometry
40 #ifndef DOXYGEN_NO_DETAIL
41 namespace detail { namespace expand
46 template <typename Box, typename Segment, typename Strategy>
47 static inline void apply(Box& box,
48 Segment const& segment,
49 Strategy const& strategy)
53 // compute the envelope of the segment
54 typename point_type<Segment>::type p[2];
55 detail::assign_point_from_index<0>(segment, p[0]);
56 detail::assign_point_from_index<1>(segment, p[1]);
57 detail::envelope::envelope_segment
59 dimension<Segment>::value
60 >::apply(p[0], p[1], mbrs[0], strategy);
63 detail::envelope::envelope_box_on_spheroid::apply(box, mbrs[1], strategy);
65 // compute the envelope of the two boxes
66 detail::envelope::envelope_range_of_boxes::apply(mbrs, box, strategy);
71 }} // namespace detail::expand
72 #endif // DOXYGEN_NO_DETAIL
74 #ifndef DOXYGEN_NO_DISPATCH
80 typename Box, typename Segment,
81 typename CSTagOut, typename CSTag
90 BOOST_MPL_ASSERT_MSG((false),
91 NOT_IMPLEMENTED_FOR_THESE_COORDINATE_SYSTEMS,
92 (types<CSTagOut, CSTag>()));
97 typename Box, typename Segment
102 box_tag, segment_tag,
103 cartesian_tag, cartesian_tag
104 > : detail::expand::expand_indexed
106 0, dimension<Segment>::value
110 template <typename Box, typename Segment>
114 box_tag, segment_tag,
115 spherical_polar_tag, spherical_polar_tag
116 > : detail::expand::segment
119 template <typename Box, typename Segment>
123 box_tag, segment_tag,
124 spherical_equatorial_tag, spherical_equatorial_tag
125 > : detail::expand::segment
128 template <typename Box, typename Segment>
132 box_tag, segment_tag,
133 geographic_tag, geographic_tag
134 > : detail::expand::segment
137 } // namespace dispatch
138 #endif // DOXYGEN_NO_DISPATCH
140 }} // namespace boost::geometry
143 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_SEGMENT_HPP