Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 
0005 // Use, modification and distribution is subject to the Boost Software License,
0006 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_BOX_HPP
0010 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_BOX_HPP
0011 
0012 // Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
0013 // boost::polygon::rectangle_data -> boost::geometry::box
0014 
0015 
0016 #include <boost/polygon/polygon.hpp>
0017 
0018 #include <boost/geometry/core/access.hpp>
0019 #include <boost/geometry/core/cs.hpp>
0020 #include <boost/geometry/core/coordinate_dimension.hpp>
0021 #include <boost/geometry/core/coordinate_type.hpp>
0022 #include <boost/geometry/core/tags.hpp>
0023 
0024 
0025 namespace boost { namespace geometry
0026 {
0027 
0028 
0029 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0030 namespace traits
0031 {
0032 
0033 
0034 template <typename CoordinateType>
0035 struct tag<boost::polygon::rectangle_data<CoordinateType> >
0036 {
0037     typedef box_tag type;
0038 };
0039 
0040 
0041 template <typename CoordinateType>
0042 struct point_type<boost::polygon::rectangle_data<CoordinateType> >
0043 {
0044     // Not sure what to do here. Boost.Polygon's rectangle does NOT define its
0045     // point_type (but uses it...)
0046     typedef boost::polygon::point_data<CoordinateType> type;
0047 };
0048 
0049 
0050 template <typename CoordinateType>
0051 struct indexed_access
0052 <
0053     boost::polygon::rectangle_data<CoordinateType>,
0054     min_corner, 0
0055 >
0056 {
0057     typedef boost::polygon::rectangle_data<CoordinateType> box_type;
0058 
0059     static inline CoordinateType get(box_type const& b)
0060     {
0061         return boost::polygon::xl(b);
0062     }
0063 
0064     static inline void set(box_type& b, CoordinateType const& value)
0065     {
0066         boost::polygon::xl(b, value);
0067     }
0068 };
0069 
0070 
0071 template <typename CoordinateType>
0072 struct indexed_access
0073 <
0074     boost::polygon::rectangle_data<CoordinateType>,
0075     min_corner, 1
0076 >
0077 {
0078     typedef boost::polygon::rectangle_data<CoordinateType> box_type;
0079 
0080     static inline CoordinateType get(box_type const& b)
0081     {
0082         return boost::polygon::yl(b);
0083     }
0084 
0085     static inline void set(box_type& b, CoordinateType const& value)
0086     {
0087         boost::polygon::yl(b, value);
0088     }
0089 };
0090 
0091 
0092 template <typename CoordinateType>
0093 struct indexed_access
0094 <
0095     boost::polygon::rectangle_data<CoordinateType>,
0096     max_corner, 0
0097 >
0098 {
0099     typedef boost::polygon::rectangle_data<CoordinateType> box_type;
0100 
0101     static inline CoordinateType get(box_type const& b)
0102     {
0103         return boost::polygon::xh(b);
0104     }
0105 
0106     static inline void set(box_type& b, CoordinateType const& value)
0107     {
0108         boost::polygon::xh(b, value);
0109     }
0110 };
0111 
0112 
0113 template <typename CoordinateType>
0114 struct indexed_access
0115 <
0116     boost::polygon::rectangle_data<CoordinateType>,
0117     max_corner, 1
0118 >
0119 {
0120     typedef boost::polygon::rectangle_data<CoordinateType> box_type;
0121 
0122     static inline CoordinateType get(box_type const& b)
0123     {
0124         return boost::polygon::yh(b);
0125     }
0126 
0127     static inline void set(box_type& b, CoordinateType const& value)
0128     {
0129         boost::polygon::yh(b, value);
0130     }
0131 };
0132 
0133 
0134 } // namespace traits
0135 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0136 
0137 
0138 }} // namespace boost::geometry
0139 
0140 
0141 #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_BOX_HPP