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-2020.
8 // Modifications copyright (c) 2015-2020, 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>
29 #include <boost/geometry/strategies/detail.hpp>
31 namespace boost { namespace geometry
34 #ifndef DOXYGEN_NO_DETAIL
35 namespace detail { namespace envelope
42 bool IsUmbrella = strategies::detail::is_umbrella_strategy<Strategy>::value
44 struct envelope_segment_call_strategy
46 template <typename Point, typename Segment, typename Box>
47 static inline void apply(Point const& p1, Point const& p2,
48 Segment const& segment, Box& mbr,
49 Strategy const& strategy)
51 strategy.envelope(segment, mbr).apply(p1, p2, mbr);
55 template <typename Strategy>
56 struct envelope_segment_call_strategy<Strategy, false>
58 template <typename Point, typename Segment, typename Box>
59 static inline void apply(Point const& p1, Point const& p2,
60 Segment const&, Box& mbr,
61 Strategy const& strategy)
63 strategy.apply(p1, p2, mbr);
67 struct envelope_segment
69 template <typename Segment, typename Box, typename Strategy>
70 static inline void apply(Segment const& segment, Box& mbr,
71 Strategy const& strategy)
73 typename point_type<Segment>::type p[2];
74 detail::assign_point_from_index<0>(segment, p[0]);
75 detail::assign_point_from_index<1>(segment, p[1]);
77 // TEMP - expand calls this and Umbrella strategies are not yet supported there
78 envelope_segment_call_strategy<Strategy>::apply(p[0], p[1], segment, mbr, strategy);
82 }} // namespace detail::envelope
83 #endif // DOXYGEN_NO_DETAIL
86 #ifndef DOXYGEN_NO_DISPATCH
91 template <typename Segment>
92 struct envelope<Segment, segment_tag>
94 template <typename Box, typename Strategy>
95 static inline void apply(Segment const& segment,
97 Strategy const& strategy)
99 detail::envelope::envelope_segment
101 dimension<Segment>::value
102 >*/::apply(segment, mbr, strategy);
106 } // namespace dispatch
107 #endif // DOXYGEN_NO_DISPATCH
109 }} // namespace boost::geometry
111 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP