]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/geometries/register/segment.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / geometries / register / segment.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
9
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
13
14
15 #ifndef BOOST_GEOMETRY_GEOMETRIES_REGISTER_SEGMENT_HPP
16 #define BOOST_GEOMETRY_GEOMETRIES_REGISTER_SEGMENT_HPP
17
18
19 #ifndef DOXYGEN_NO_SPECIALIZATIONS
20
21
22 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS(Segment, Point, Index0, Index1) \
23 template <size_t D> \
24 struct indexed_access<Segment, min_corner, D> \
25 { \
26 typedef typename coordinate_type<Point>::type ct; \
27 static inline ct get(Segment const& b) \
28 { return geometry::get<D>(b. Index0); } \
29 static inline void set(Segment& b, ct const& value) \
30 { geometry::set<D>(b. Index0, value); } \
31 }; \
32 template <size_t D> \
33 struct indexed_access<Segment, max_corner, D> \
34 { \
35 typedef typename coordinate_type<Point>::type ct; \
36 static inline ct get(Segment const& b) \
37 { return geometry::get<D>(b. Index1); } \
38 static inline void set(Segment& b, ct const& value) \
39 { geometry::set<D>(b. Index1, value); } \
40 };
41
42
43 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_TEMPLATIZED(Segment, Index0, Index1) \
44 template <typename P, size_t D> \
45 struct indexed_access<Segment<P>, min_corner, D> \
46 { \
47 typedef typename coordinate_type<P>::type ct; \
48 static inline ct get(Segment<P> const& b) \
49 { return geometry::get<D>(b. Index0); } \
50 static inline void set(Segment<P>& b, ct const& value) \
51 { geometry::set<D>(b. Index0, value); } \
52 }; \
53 template <typename P, size_t D> \
54 struct indexed_access<Segment<P>, max_corner, D> \
55 { \
56 typedef typename coordinate_type<P>::type ct; \
57 static inline ct get(Segment<P> const& b) \
58 { return geometry::get<D>(b. Index1); } \
59 static inline void set(Segment<P>& b, ct const& value) \
60 { geometry::set<D>(b. Index1, value); } \
61 };
62
63
64 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_4VALUES(Segment, Point, Left, Bottom, Right, Top) \
65 template <> struct indexed_access<Segment, min_corner, 0> \
66 { \
67 typedef coordinate_type<Point>::type ct; \
68 static inline ct get(Segment const& b) { return b. Left; } \
69 static inline void set(Segment& b, ct const& value) { b. Left = value; } \
70 }; \
71 template <> struct indexed_access<Segment, min_corner, 1> \
72 { \
73 typedef coordinate_type<Point>::type ct; \
74 static inline ct get(Segment const& b) { return b. Bottom; } \
75 static inline void set(Segment& b, ct const& value) { b. Bottom = value; } \
76 }; \
77 template <> struct indexed_access<Segment, max_corner, 0> \
78 { \
79 typedef coordinate_type<Point>::type ct; \
80 static inline ct get(Segment const& b) { return b. Right; } \
81 static inline void set(Segment& b, ct const& value) { b. Right = value; } \
82 }; \
83 template <> struct indexed_access<Segment, max_corner, 1> \
84 { \
85 typedef coordinate_type<Point>::type ct; \
86 static inline ct get(Segment const& b) { return b. Top; } \
87 static inline void set(Segment& b, ct const& value) { b. Top = value; } \
88 };
89
90
91
92
93 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \
94 template<> struct tag<Segment > { typedef segment_tag type; }; \
95 template<> struct point_type<Segment > { typedef PointType type; };
96
97 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS_TEMPLATIZED(Segment) \
98 template<typename P> struct tag<Segment<P> > { typedef segment_tag type; }; \
99 template<typename P> struct point_type<Segment<P> > { typedef P type; };
100
101 #endif // DOXYGEN_NO_SPECIALIZATIONS
102
103
104
105 #define BOOST_GEOMETRY_REGISTER_SEGMENT(Segment, PointType, Index0, Index1) \
106 namespace boost { namespace geometry { namespace traits { \
107 BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \
108 BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS(Segment, PointType, Index0, Index1) \
109 }}}
110
111
112 #define BOOST_GEOMETRY_REGISTER_SEGMENT_TEMPLATIZED(Segment, Index0, Index1) \
113 namespace boost { namespace geometry { namespace traits { \
114 BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS_TEMPLATIZED(Segment) \
115 BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_TEMPLATIZED(Segment, Index0, Index1) \
116 }}}
117
118 #define BOOST_GEOMETRY_REGISTER_SEGMENT_2D_4VALUES(Segment, PointType, Left, Bottom, Right, Top) \
119 namespace boost { namespace geometry { namespace traits { \
120 BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \
121 BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_4VALUES(Segment, PointType, Left, Bottom, Right, Top) \
122 }}}
123
124
125
126 // CONST versions are for segments probably not that common. Postponed.
127
128
129 #endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_SEGMENT_HPP