Chris@16
|
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
|
Chris@16
|
2
|
Chris@16
|
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
Chris@16
|
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
Chris@16
|
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
Chris@16
|
6
|
Chris@16
|
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
Chris@16
|
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
Chris@16
|
9
|
Chris@16
|
10 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
12 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
13
|
Chris@16
|
14 #ifndef BOOST_GEOMETRY_GEOMETRIES_REGISTER_POINT_HPP
|
Chris@16
|
15 #define BOOST_GEOMETRY_GEOMETRIES_REGISTER_POINT_HPP
|
Chris@16
|
16
|
Chris@16
|
17
|
Chris@16
|
18 #include <cstddef>
|
Chris@16
|
19
|
Chris@16
|
20 #ifndef DOXYGEN_NO_SPECIALIZATIONS
|
Chris@16
|
21
|
Chris@16
|
22 // Starting point, specialize basic traits necessary to register a point
|
Chris@16
|
23 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, Dim, CoordinateType, CoordinateSystem) \
|
Chris@16
|
24 template<> struct tag<Point> { typedef point_tag type; }; \
|
Chris@16
|
25 template<> struct dimension<Point> : boost::mpl::int_<Dim> {}; \
|
Chris@16
|
26 template<> struct coordinate_type<Point> { typedef CoordinateType type; }; \
|
Chris@16
|
27 template<> struct coordinate_system<Point> { typedef CoordinateSystem type; };
|
Chris@16
|
28
|
Chris@16
|
29 // Specialize access class per dimension
|
Chris@16
|
30 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, Dim, CoordinateType, Get, Set) \
|
Chris@16
|
31 template<> struct access<Point, Dim> \
|
Chris@16
|
32 { \
|
Chris@16
|
33 static inline CoordinateType get(Point const& p) { return p. Get; } \
|
Chris@16
|
34 static inline void set(Point& p, CoordinateType const& value) { p. Set = value; } \
|
Chris@16
|
35 };
|
Chris@16
|
36
|
Chris@16
|
37 // Const version
|
Chris@16
|
38 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_CONST(Point, Dim, CoordinateType, Get) \
|
Chris@16
|
39 template<> struct access<Point, Dim> \
|
Chris@16
|
40 { \
|
Chris@16
|
41 static inline CoordinateType get(Point const& p) { return p. Get; } \
|
Chris@16
|
42 };
|
Chris@16
|
43
|
Chris@16
|
44
|
Chris@16
|
45 // Getter/setter version
|
Chris@16
|
46 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_GET_SET(Point, Dim, CoordinateType, Get, Set) \
|
Chris@16
|
47 template<> struct access<Point, Dim> \
|
Chris@16
|
48 { \
|
Chris@16
|
49 static inline CoordinateType get(Point const& p) \
|
Chris@16
|
50 { return p. Get (); } \
|
Chris@16
|
51 static inline void set(Point& p, CoordinateType const& value) \
|
Chris@16
|
52 { p. Set ( value ); } \
|
Chris@16
|
53 };
|
Chris@16
|
54
|
Chris@16
|
55 #endif // DOXYGEN_NO_SPECIALIZATIONS
|
Chris@16
|
56
|
Chris@16
|
57
|
Chris@16
|
58 /*!
|
Chris@16
|
59 \brief \brief_macro{2D point type}
|
Chris@16
|
60 \ingroup register
|
Chris@16
|
61 \details \details_macro{BOOST_GEOMETRY_REGISTER_POINT_2D, two-dimensional point type}
|
Chris@16
|
62 \param Point \param_macro_type{Point}
|
Chris@16
|
63 \param CoordinateType \param_macro_coortype{point}
|
Chris@16
|
64 \param CoordinateSystem \param_macro_coorsystem
|
Chris@16
|
65 \param Field0 \param_macro_member{\macro_x}
|
Chris@16
|
66 \param Field1 \param_macro_member{\macro_y}
|
Chris@16
|
67
|
Chris@16
|
68 \qbk{[include reference/geometries/register/point.qbk]}
|
Chris@16
|
69 */
|
Chris@16
|
70 #define BOOST_GEOMETRY_REGISTER_POINT_2D(Point, CoordinateType, CoordinateSystem, Field0, Field1) \
|
Chris@16
|
71 namespace boost { namespace geometry { namespace traits { \
|
Chris@16
|
72 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, 2, CoordinateType, CoordinateSystem) \
|
Chris@16
|
73 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, 0, CoordinateType, Field0, Field0) \
|
Chris@16
|
74 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, 1, CoordinateType, Field1, Field1) \
|
Chris@16
|
75 }}}
|
Chris@16
|
76
|
Chris@16
|
77 /*!
|
Chris@16
|
78 \brief \brief_macro{3D point type}
|
Chris@16
|
79 \ingroup register
|
Chris@16
|
80 \details \details_macro{BOOST_GEOMETRY_REGISTER_POINT_3D, three-dimensional point type}
|
Chris@16
|
81 \param Point \param_macro_type{Point}
|
Chris@16
|
82 \param CoordinateType \param_macro_coortype{point}
|
Chris@16
|
83 \param CoordinateSystem \param_macro_coorsystem
|
Chris@16
|
84 \param Field0 \param_macro_member{\macro_x}
|
Chris@16
|
85 \param Field1 \param_macro_member{\macro_y}
|
Chris@16
|
86 \param Field2 \param_macro_member{\macro_z}
|
Chris@16
|
87 */
|
Chris@16
|
88 #define BOOST_GEOMETRY_REGISTER_POINT_3D(Point, CoordinateType, CoordinateSystem, Field0, Field1, Field2) \
|
Chris@16
|
89 namespace boost { namespace geometry { namespace traits { \
|
Chris@16
|
90 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, 3, CoordinateType, CoordinateSystem) \
|
Chris@16
|
91 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, 0, CoordinateType, Field0, Field0) \
|
Chris@16
|
92 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, 1, CoordinateType, Field1, Field1) \
|
Chris@16
|
93 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, 2, CoordinateType, Field2, Field2) \
|
Chris@16
|
94 }}}
|
Chris@16
|
95
|
Chris@16
|
96 /*!
|
Chris@16
|
97 \brief \brief_macro{2D point type} \brief_macro_const
|
Chris@16
|
98 \ingroup register
|
Chris@16
|
99 \details \details_macro{BOOST_GEOMETRY_REGISTER_POINT_2D_CONST, two-dimensional point type}. \details_macro_const
|
Chris@16
|
100 \param Point \param_macro_type{Point}
|
Chris@16
|
101 \param CoordinateType \param_macro_coortype{point}
|
Chris@16
|
102 \param CoordinateSystem \param_macro_coorsystem
|
Chris@16
|
103 \param Field0 \param_macro_member{\macro_x}
|
Chris@16
|
104 \param Field1 \param_macro_member{\macro_y}
|
Chris@16
|
105 */
|
Chris@16
|
106 #define BOOST_GEOMETRY_REGISTER_POINT_2D_CONST(Point, CoordinateType, CoordinateSystem, Field0, Field1) \
|
Chris@16
|
107 namespace boost { namespace geometry { namespace traits { \
|
Chris@16
|
108 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, 2, CoordinateType, CoordinateSystem) \
|
Chris@16
|
109 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_CONST(Point, 0, CoordinateType, Field0) \
|
Chris@16
|
110 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_CONST(Point, 1, CoordinateType, Field1) \
|
Chris@16
|
111 }}}
|
Chris@16
|
112
|
Chris@16
|
113 /*!
|
Chris@16
|
114 \brief \brief_macro{3D point type} \brief_macro_const
|
Chris@16
|
115 \ingroup register
|
Chris@16
|
116 \details \details_macro{BOOST_GEOMETRY_REGISTER_POINT_3D_CONST, three-dimensional point type}. \details_macro_const
|
Chris@16
|
117 \param Point \param_macro_type{Point}
|
Chris@16
|
118 \param CoordinateType \param_macro_coortype{point}
|
Chris@16
|
119 \param CoordinateSystem \param_macro_coorsystem
|
Chris@16
|
120 \param Field0 \param_macro_member{\macro_x}
|
Chris@16
|
121 \param Field1 \param_macro_member{\macro_y}
|
Chris@16
|
122 \param Field2 \param_macro_member{\macro_z}
|
Chris@16
|
123 */
|
Chris@16
|
124 #define BOOST_GEOMETRY_REGISTER_POINT_3D_CONST(Point, CoordinateType, CoordinateSystem, Field0, Field1, Field2) \
|
Chris@16
|
125 namespace boost { namespace geometry { namespace traits { \
|
Chris@16
|
126 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, 3, CoordinateType, CoordinateSystem) \
|
Chris@16
|
127 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_CONST(Point, 0, CoordinateType, Field0) \
|
Chris@16
|
128 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_CONST(Point, 1, CoordinateType, Field1) \
|
Chris@16
|
129 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_CONST(Point, 2, CoordinateType, Field2) \
|
Chris@16
|
130 }}}
|
Chris@16
|
131
|
Chris@16
|
132 /*!
|
Chris@16
|
133 \brief \brief_macro{2D point type} \brief_macro_getset
|
Chris@16
|
134 \ingroup register
|
Chris@16
|
135 \details \details_macro{BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET, two-dimensional point type}. \details_macro_getset
|
Chris@16
|
136 \param Point \param_macro_type{Point}
|
Chris@16
|
137 \param CoordinateType \param_macro_coortype{point}
|
Chris@16
|
138 \param CoordinateSystem \param_macro_coorsystem
|
Chris@16
|
139 \param Get0 \param_macro_getset{get, \macro_x}
|
Chris@16
|
140 \param Get1 \param_macro_getset{get, \macro_y}
|
Chris@16
|
141 \param Set0 \param_macro_getset{set, \macro_x}
|
Chris@16
|
142 \param Set1 \param_macro_getset{set, \macro_y}
|
Chris@16
|
143 */
|
Chris@16
|
144 #define BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET(Point, CoordinateType, CoordinateSystem, Get0, Get1, Set0, Set1) \
|
Chris@16
|
145 namespace boost { namespace geometry { namespace traits { \
|
Chris@16
|
146 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, 2, CoordinateType, CoordinateSystem) \
|
Chris@16
|
147 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_GET_SET(Point, 0, CoordinateType, Get0, Set0) \
|
Chris@16
|
148 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_GET_SET(Point, 1, CoordinateType, Get1, Set1) \
|
Chris@16
|
149 }}}
|
Chris@16
|
150
|
Chris@16
|
151 /*!
|
Chris@16
|
152 \brief \brief_macro{3D point type} \brief_macro_getset
|
Chris@16
|
153 \ingroup register
|
Chris@16
|
154 \details \details_macro{BOOST_GEOMETRY_REGISTER_POINT_3D_GET_SET, three-dimensional point type}. \details_macro_getset
|
Chris@16
|
155 \param Point \param_macro_type{Point}
|
Chris@16
|
156 \param CoordinateType \param_macro_coortype{point}
|
Chris@16
|
157 \param CoordinateSystem \param_macro_coorsystem
|
Chris@16
|
158 \param Get0 \param_macro_getset{get, \macro_x}
|
Chris@16
|
159 \param Get1 \param_macro_getset{get, \macro_y}
|
Chris@16
|
160 \param Get2 \param_macro_getset{get, \macro_z}
|
Chris@16
|
161 \param Set0 \param_macro_getset{set, \macro_x}
|
Chris@16
|
162 \param Set1 \param_macro_getset{set, \macro_y}
|
Chris@16
|
163 \param Set2 \param_macro_getset{set, \macro_z}
|
Chris@16
|
164 */
|
Chris@16
|
165 #define BOOST_GEOMETRY_REGISTER_POINT_3D_GET_SET(Point, CoordinateType, CoordinateSystem, Get0, Get1, Get2, Set0, Set1, Set2) \
|
Chris@16
|
166 namespace boost { namespace geometry { namespace traits { \
|
Chris@16
|
167 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, 3, CoordinateType, CoordinateSystem) \
|
Chris@16
|
168 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_GET_SET(Point, 0, CoordinateType, Get0, Set0) \
|
Chris@16
|
169 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_GET_SET(Point, 1, CoordinateType, Get1, Set1) \
|
Chris@16
|
170 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_GET_SET(Point, 2, CoordinateType, Get2, Set2) \
|
Chris@16
|
171 }}}
|
Chris@16
|
172
|
Chris@16
|
173 #endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_POINT_HPP
|