• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2017-2018 Oracle and/or its affiliates.
4 // Contributed and/or modified by Vissarion Fisikopoulos, on behalf of Oracle
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
6 
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10 
11 #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_ENVELOPE_SEGMENT_HPP
12 #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_ENVELOPE_SEGMENT_HPP
13 
14 #include <cstddef>
15 
16 #include <boost/geometry/core/coordinate_dimension.hpp>
17 #include <boost/geometry/core/tags.hpp>
18 
19 #include <boost/geometry/strategies/cartesian/envelope_point.hpp>
20 #include <boost/geometry/strategies/cartesian/expand_point.hpp>
21 #include <boost/geometry/strategies/envelope.hpp>
22 
23 namespace boost { namespace geometry { namespace strategy { namespace envelope
24 {
25 
26 #ifndef DOXYGEN_NO_DETAIL
27 namespace detail
28 {
29 
30 template <std::size_t Dimension, std::size_t DimensionCount>
31 struct envelope_one_segment
32 {
33     template<typename Point, typename Box>
applyboost::geometry::strategy::envelope::detail::envelope_one_segment34     static inline void apply(Point const& p1,
35                              Point const& p2,
36                              Box& mbr)
37     {
38         geometry::detail::envelope::envelope_one_point
39             <
40                 Dimension, DimensionCount
41             >::apply(p1, mbr);
42 
43         strategy::expand::detail::point_loop
44             <
45                 Dimension, DimensionCount
46             >::apply(mbr, p2);
47     }
48 };
49 
50 } // namespace detail
51 #endif // DOXYGEN_NO_DETAIL
52 
53 
54 template
55 <
56     typename CalculationType = void
57 >
58 class cartesian_segment
59 {
60 public:
61     template <typename Point, typename Box>
apply(Point const & point1,Point const & point2,Box & box)62     static inline void apply(Point const& point1, Point const& point2, Box& box)
63     {
64         strategy::envelope::detail::envelope_one_segment
65             <
66                 0,
67                 dimension<Point>::value
68             >::apply(point1, point2, box);
69     }
70 
71 };
72 
73 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
74 
75 namespace services
76 {
77 
78 template <typename CalculationType>
79 struct default_strategy<segment_tag, cartesian_tag, CalculationType>
80 {
81     typedef strategy::envelope::cartesian_segment<CalculationType> type;
82 };
83 
84 }
85 
86 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
87 
88 
89 }} // namespace strategy::envelope
90 
91 }} //namepsace boost::geometry
92 
93 #endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_ENVELOPE_SEGMENT_HPP
94