• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
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 
7 // This file was modified by Oracle on 2015-2018.
8 // Modifications copyright (c) 2015-2018, Oracle and/or its affiliates.
9 
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
13 
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)
17 
18 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP
19 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP
20 
21 #include <cstddef>
22 
23 #include <boost/geometry/core/tags.hpp>
24 
25 #include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
26 #include <boost/geometry/algorithms/dispatch/envelope.hpp>
27 
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>
32 
33 namespace boost { namespace geometry
34 {
35 
36 #ifndef DOXYGEN_NO_DETAIL
37 namespace detail { namespace envelope
38 {
39 
40 template <std::size_t DimensionCount>
41 struct envelope_segment
42 {
43     template <typename Point, typename Box, typename Strategy>
applyboost::geometry::detail::envelope::envelope_segment44     static inline void apply(Point const& p1,
45                              Point const& p2,
46                              Box& mbr,
47                              Strategy const& strategy)
48     {
49         strategy.apply(p1, p2, mbr);
50     }
51 
52     template <typename Segment, typename Box, typename Strategy>
applyboost::geometry::detail::envelope::envelope_segment53     static inline void apply(Segment const& segment, Box& mbr,
54                              Strategy const& strategy)
55     {
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);
60     }
61 };
62 
63 }} // namespace detail::envelope
64 #endif // DOXYGEN_NO_DETAIL
65 
66 
67 #ifndef DOXYGEN_NO_DISPATCH
68 namespace dispatch
69 {
70 
71 
72 template <typename Segment>
73 struct envelope<Segment, segment_tag>
74 {
75     template <typename Box, typename Strategy>
applyboost::geometry::dispatch::envelope76     static inline void apply(Segment const& segment,
77                              Box& mbr,
78                              Strategy const& strategy)
79     {
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
84             <
85                dimension<Segment>::value
86             >::apply(p[0], p[1], mbr, strategy);
87     }
88 };
89 
90 } // namespace dispatch
91 #endif // DOXYGEN_NO_DISPATCH
92 
93 }} // namespace boost::geometry
94 
95 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_SEGMENT_HPP
96