Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:28

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
0006 
0007 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0008 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0009 
0010 // Use, modification and distribution is subject to the Boost Software License,
0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0012 // http://www.boost.org/LICENSE_1_0.txt)
0013 
0014 
0015 #ifndef BOOST_GEOMETRY_GEOMETRIES_REGISTER_SEGMENT_HPP
0016 #define BOOST_GEOMETRY_GEOMETRIES_REGISTER_SEGMENT_HPP
0017 
0018 
0019 #ifndef DOXYGEN_NO_SPECIALIZATIONS
0020 
0021 
0022 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS(Segment, Point, Index0, Index1) \
0023 template <size_t D> \
0024 struct indexed_access<Segment, min_corner, D> \
0025 { \
0026     typedef typename coordinate_type<Point>::type ct; \
0027     static inline ct get(Segment const& b) \
0028     { return geometry::get<D>(b. Index0);  } \
0029     static inline void set(Segment& b, ct const& value) \
0030     { geometry::set<D>(b. Index0, value);  } \
0031 }; \
0032 template <size_t D> \
0033 struct indexed_access<Segment, max_corner, D> \
0034 { \
0035     typedef typename coordinate_type<Point>::type ct; \
0036     static inline ct get(Segment const& b) \
0037     { return geometry::get<D>(b. Index1);  } \
0038     static inline void set(Segment& b, ct const& value) \
0039     { geometry::set<D>(b. Index1, value);  } \
0040 };
0041 
0042 
0043 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_TEMPLATIZED(Segment, Index0, Index1) \
0044 template <typename P, size_t D> \
0045 struct indexed_access<Segment<P>, min_corner, D> \
0046 { \
0047     typedef typename coordinate_type<P>::type ct; \
0048     static inline ct get(Segment<P> const& b) \
0049     { return geometry::get<D>(b. Index0);  } \
0050     static inline void set(Segment<P>& b, ct const& value) \
0051     { geometry::set<D>(b. Index0, value);  } \
0052 }; \
0053 template <typename P, size_t D> \
0054 struct indexed_access<Segment<P>, max_corner, D> \
0055 { \
0056     typedef typename coordinate_type<P>::type ct; \
0057     static inline ct get(Segment<P> const& b) \
0058     { return geometry::get<D>(b. Index1);  } \
0059     static inline void set(Segment<P>& b, ct const& value) \
0060     { geometry::set<D>(b. Index1, value);  } \
0061 };
0062 
0063 
0064 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_4VALUES(Segment, Point, Left, Bottom, Right, Top) \
0065 template <> struct indexed_access<Segment, min_corner, 0> \
0066 { \
0067     typedef coordinate_type<Point>::type ct; \
0068     static inline ct get(Segment const& b) { return b. Left;  } \
0069     static inline void set(Segment& b, ct const& value) { b. Left = value; } \
0070 }; \
0071 template <> struct indexed_access<Segment, min_corner, 1> \
0072 { \
0073     typedef coordinate_type<Point>::type ct; \
0074     static inline ct get(Segment const& b) { return b. Bottom;  } \
0075     static inline void set(Segment& b, ct const& value) { b. Bottom = value; } \
0076 }; \
0077 template <> struct indexed_access<Segment, max_corner, 0> \
0078 { \
0079     typedef coordinate_type<Point>::type ct; \
0080     static inline ct get(Segment const& b) { return b. Right;  } \
0081     static inline void set(Segment& b, ct const& value) { b. Right = value; } \
0082 }; \
0083 template <> struct indexed_access<Segment, max_corner, 1> \
0084 { \
0085     typedef coordinate_type<Point>::type ct; \
0086     static inline ct get(Segment const& b) { return b. Top; } \
0087     static inline void set(Segment& b, ct const& value) { b. Top = value; } \
0088 };
0089 
0090 
0091 
0092 
0093 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \
0094     template<> struct tag<Segment > { typedef segment_tag type; }; \
0095     template<> struct point_type<Segment > { typedef PointType type; };
0096 
0097 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS_TEMPLATIZED(Segment) \
0098     template<typename P> struct tag<Segment<P> > { typedef segment_tag type; }; \
0099     template<typename P> struct point_type<Segment<P> > { typedef P type; };
0100 
0101 #endif // DOXYGEN_NO_SPECIALIZATIONS
0102 
0103 
0104 
0105 #define BOOST_GEOMETRY_REGISTER_SEGMENT(Segment, PointType, Index0, Index1) \
0106 namespace boost { namespace geometry { namespace traits {  \
0107     BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \
0108     BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS(Segment, PointType, Index0, Index1) \
0109 }}}
0110 
0111 
0112 #define BOOST_GEOMETRY_REGISTER_SEGMENT_TEMPLATIZED(Segment, Index0, Index1) \
0113 namespace boost { namespace geometry { namespace traits {  \
0114     BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS_TEMPLATIZED(Segment) \
0115     BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_TEMPLATIZED(Segment, Index0, Index1) \
0116 }}}
0117 
0118 #define BOOST_GEOMETRY_REGISTER_SEGMENT_2D_4VALUES(Segment, PointType, Left, Bottom, Right, Top) \
0119 namespace boost { namespace geometry { namespace traits {  \
0120     BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \
0121     BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_4VALUES(Segment, PointType, Left, Bottom, Right, Top) \
0122 }}}
0123 
0124 
0125 
0126 // CONST versions are for segments probably not that common. Postponed.
0127 
0128 
0129 #endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_SEGMENT_HPP