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-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_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP
19 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP
23 #include <boost/geometry/core/tags.hpp>
25 #include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
26 #include <boost/geometry/algorithms/dispatch/envelope.hpp>
28 // For backward compatibility
29 #include <boost/geometry/strategies/cartesian/envelope_segment.hpp>
30 #include <boost/geometry/strategies/spherical/envelope_segment.hpp>
31 #include <boost/geometry/strategies/geographic/envelope_segment.hpp>
33 namespace boost { namespace geometry
36 #ifndef DOXYGEN_NO_DETAIL
37 namespace detail { namespace envelope
40 template <std::size_t DimensionCount>
41 struct envelope_segment
43 template <typename Point, typename Box, typename Strategy>
44 static inline void apply(Point const& p1,
47 Strategy const& strategy)
49 strategy.apply(p1, p2, mbr);
52 template <typename Segment, typename Box, typename Strategy>
53 static inline void apply(Segment const& segment, Box& mbr,
54 Strategy const& strategy)
56 typename point_type<Segment>::type p[2];
57 detail::assign_point_from_index<0>(segment, p[0]);
58 detail::assign_point_from_index<1>(segment, p[1]);
59 apply(p[0], p[1], mbr, strategy);
63 }} // namespace detail::envelope
64 #endif // DOXYGEN_NO_DETAIL
67 #ifndef DOXYGEN_NO_DISPATCH
72 template <typename Segment>
73 struct envelope<Segment, segment_tag>
75 template <typename Box, typename Strategy>
76 static inline void apply(Segment const& segment,
78 Strategy const& strategy)
80 typename point_type<Segment>::type p[2];
81 detail::assign_point_from_index<0>(segment, p[0]);
82 detail::assign_point_from_index<1>(segment, p[1]);
83 detail::envelope::envelope_segment
85 dimension<Segment>::value
86 >::apply(p[0], p[1], mbr, strategy);
90 } // namespace dispatch
91 #endif // DOXYGEN_NO_DISPATCH
93 }} // namespace boost::geometry
95 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP