File indexing completed on 2025-01-18 09:35:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_GEOMETRY_GEOMETRIES_REGISTER_BOX_HPP
0016 #define BOOST_GEOMETRY_GEOMETRIES_REGISTER_BOX_HPP
0017
0018
0019 #ifndef DOXYGEN_NO_SPECIALIZATIONS
0020
0021
0022 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS(Box, Point, MinCorner, MaxCorner) \
0023 template <size_t D> \
0024 struct indexed_access<Box, min_corner, D> \
0025 { \
0026 typedef typename coordinate_type<Point>::type ct; \
0027 static inline ct get(Box const& b) \
0028 { return geometry::get<D>(b. MinCorner); } \
0029 static inline void set(Box& b, ct const& value) \
0030 { geometry::set<D>(b. MinCorner, value); } \
0031 }; \
0032 template <size_t D> \
0033 struct indexed_access<Box, max_corner, D> \
0034 { \
0035 typedef typename coordinate_type<Point>::type ct; \
0036 static inline ct get(Box const& b) \
0037 { return geometry::get<D>(b. MaxCorner); } \
0038 static inline void set(Box& b, ct const& value) \
0039 { geometry::set<D>(b. MaxCorner, value); } \
0040 };
0041
0042
0043 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_TEMPLATED(Box, MinCorner, MaxCorner) \
0044 template <typename P, size_t D> \
0045 struct indexed_access<Box<P>, min_corner, D> \
0046 { \
0047 typedef typename coordinate_type<P>::type ct; \
0048 static inline ct get(Box<P> const& b) \
0049 { return geometry::get<D>(b. MinCorner); } \
0050 static inline void set(Box<P>& b, ct const& value) \
0051 { geometry::set<D>(b. MinCorner, value); } \
0052 }; \
0053 template <typename P, size_t D> \
0054 struct indexed_access<Box<P>, max_corner, D> \
0055 { \
0056 typedef typename coordinate_type<P>::type ct; \
0057 static inline ct get(Box<P> const& b) \
0058 { return geometry::get<D>(b. MaxCorner); } \
0059 static inline void set(Box<P>& b, ct const& value) \
0060 { geometry::set<D>(b. MaxCorner, value); } \
0061 };
0062
0063
0064 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_4VALUES(Box, Point, Left, Bottom, Right, Top) \
0065 template <> struct indexed_access<Box, min_corner, 0> \
0066 { \
0067 typedef coordinate_type<Point>::type ct; \
0068 static inline ct get(Box const& b) { return b. Left; } \
0069 static inline void set(Box& b, ct const& value) { b. Left = value; } \
0070 }; \
0071 template <> struct indexed_access<Box, min_corner, 1> \
0072 { \
0073 typedef coordinate_type<Point>::type ct; \
0074 static inline ct get(Box const& b) { return b. Bottom; } \
0075 static inline void set(Box& b, ct const& value) { b. Bottom = value; } \
0076 }; \
0077 template <> struct indexed_access<Box, max_corner, 0> \
0078 { \
0079 typedef coordinate_type<Point>::type ct; \
0080 static inline ct get(Box const& b) { return b. Right; } \
0081 static inline void set(Box& b, ct const& value) { b. Right = value; } \
0082 }; \
0083 template <> struct indexed_access<Box, max_corner, 1> \
0084 { \
0085 typedef coordinate_type<Point>::type ct; \
0086 static inline ct get(Box const& b) { return b. Top; } \
0087 static inline void set(Box& b, ct const& value) { b. Top = value; } \
0088 };
0089
0090
0091
0092
0093 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS(Box, PointType) \
0094 template<> struct tag<Box > { typedef box_tag type; }; \
0095 template<> struct point_type<Box > { typedef PointType type; };
0096
0097 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS_TEMPLATED(Box) \
0098 template<typename P> struct tag<Box<P> > { typedef box_tag type; }; \
0099 template<typename P> struct point_type<Box<P> > { typedef P type; };
0100
0101 #endif
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121 #define BOOST_GEOMETRY_REGISTER_BOX(Box, Point, MinCorner, MaxCorner) \
0122 namespace boost { namespace geometry { namespace traits { \
0123 BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS(Box, Point) \
0124 BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS(Box, Point, MinCorner, MaxCorner) \
0125 }}}
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143 #define BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED(Box, MinCorner, MaxCorner) \
0144 namespace boost { namespace geometry { namespace traits { \
0145 BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS_TEMPLATED(Box) \
0146 BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_TEMPLATED(Box, MinCorner, MaxCorner) \
0147 }}}
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168 #define BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES(Box, Point, Left, Bottom, Right, Top) \
0169 namespace boost { namespace geometry { namespace traits { \
0170 BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS(Box, Point) \
0171 BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_4VALUES(Box, Point, Left, Bottom, Right, Top) \
0172 }}}
0173
0174
0175
0176
0177
0178
0179 #endif