Chris@102
|
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
|
Chris@102
|
2
|
Chris@102
|
3 // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
|
Chris@102
|
4
|
Chris@102
|
5 // This file was modified by Oracle on 2014.
|
Chris@102
|
6 // Modifications copyright (c) 2014, Oracle and/or its affiliates.
|
Chris@102
|
7
|
Chris@102
|
8 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@102
|
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@102
|
10 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
11
|
Chris@102
|
12 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
Chris@102
|
13
|
Chris@102
|
14 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP
|
Chris@102
|
15 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP
|
Chris@102
|
16
|
Chris@102
|
17 namespace boost { namespace geometry
|
Chris@102
|
18 {
|
Chris@102
|
19
|
Chris@102
|
20 #ifndef DOXYGEN_NO_DISPATCH
|
Chris@102
|
21 namespace detail_dispatch { namespace relate {
|
Chris@102
|
22
|
Chris@102
|
23 // TODO: Integrate it with geometry::less?
|
Chris@102
|
24
|
Chris@102
|
25 template <typename Point1,
|
Chris@102
|
26 typename Point2,
|
Chris@102
|
27 std::size_t I = 0,
|
Chris@102
|
28 std::size_t D = geometry::dimension<Point1>::value>
|
Chris@102
|
29 struct less
|
Chris@102
|
30 {
|
Chris@102
|
31 static inline bool apply(Point1 const& left, Point2 const& right)
|
Chris@102
|
32 {
|
Chris@102
|
33 typename geometry::coordinate_type<Point1>::type
|
Chris@102
|
34 cleft = geometry::get<I>(left);
|
Chris@102
|
35 typename geometry::coordinate_type<Point2>::type
|
Chris@102
|
36 cright = geometry::get<I>(right);
|
Chris@102
|
37
|
Chris@102
|
38 if ( geometry::math::equals(cleft, cright) )
|
Chris@102
|
39 {
|
Chris@102
|
40 return less<Point1, Point2, I + 1, D>::apply(left, right);
|
Chris@102
|
41 }
|
Chris@102
|
42 else
|
Chris@102
|
43 {
|
Chris@102
|
44 return cleft < cright;
|
Chris@102
|
45 }
|
Chris@102
|
46 }
|
Chris@102
|
47 };
|
Chris@102
|
48
|
Chris@102
|
49 template <typename Point1, typename Point2, std::size_t D>
|
Chris@102
|
50 struct less<Point1, Point2, D, D>
|
Chris@102
|
51 {
|
Chris@102
|
52 static inline bool apply(Point1 const&, Point2 const&)
|
Chris@102
|
53 {
|
Chris@102
|
54 return false;
|
Chris@102
|
55 }
|
Chris@102
|
56 };
|
Chris@102
|
57
|
Chris@102
|
58 }} // namespace detail_dispatch::relate
|
Chris@102
|
59
|
Chris@102
|
60 #endif
|
Chris@102
|
61
|
Chris@102
|
62 #ifndef DOXYGEN_NO_DETAIL
|
Chris@102
|
63 namespace detail { namespace relate {
|
Chris@102
|
64
|
Chris@102
|
65 struct less
|
Chris@102
|
66 {
|
Chris@102
|
67 template <typename Point1, typename Point2>
|
Chris@102
|
68 inline bool operator()(Point1 const& point1, Point2 const& point2) const
|
Chris@102
|
69 {
|
Chris@102
|
70 return detail_dispatch::relate::less<Point1, Point2>::apply(point1, point2);
|
Chris@102
|
71 }
|
Chris@102
|
72 };
|
Chris@102
|
73
|
Chris@102
|
74 }} // namespace detail::relate
|
Chris@102
|
75 #endif // DOXYGEN_NO_DETAIL
|
Chris@102
|
76
|
Chris@102
|
77 }} // namespace boost::geometry
|
Chris@102
|
78
|
Chris@102
|
79 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP
|