Chris@16: // Boost.Geometry (aka GGL, Generic Geometry Library) Chris@16: Chris@16: // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. Chris@16: // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. Chris@16: // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. Chris@16: Chris@16: // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library Chris@16: // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. Chris@16: Chris@16: // Use, modification and distribution is subject to the Boost Software License, Chris@16: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: Chris@16: #ifndef BOOST_GEOMETRY_GEOMETRIES_REGISTER_BOX_HPP Chris@16: #define BOOST_GEOMETRY_GEOMETRIES_REGISTER_BOX_HPP Chris@16: Chris@16: Chris@16: #ifndef DOXYGEN_NO_SPECIALIZATIONS Chris@16: Chris@16: Chris@16: #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS(Box, Point, MinCorner, MaxCorner) \ Chris@16: template \ Chris@16: struct indexed_access \ Chris@16: { \ Chris@16: typedef typename coordinate_type::type ct; \ Chris@16: static inline ct get(Box const& b) \ Chris@16: { return geometry::get(b. MinCorner); } \ Chris@16: static inline void set(Box& b, ct const& value) \ Chris@16: { geometry::set(b. MinCorner, value); } \ Chris@16: }; \ Chris@16: template \ Chris@16: struct indexed_access \ Chris@16: { \ Chris@16: typedef typename coordinate_type::type ct; \ Chris@16: static inline ct get(Box const& b) \ Chris@16: { return geometry::get(b. MaxCorner); } \ Chris@16: static inline void set(Box& b, ct const& value) \ Chris@16: { geometry::set(b. MaxCorner, value); } \ Chris@16: }; Chris@16: Chris@16: Chris@16: #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_TEMPLATED(Box, MinCorner, MaxCorner) \ Chris@16: template \ Chris@16: struct indexed_access, min_corner, D> \ Chris@16: { \ Chris@16: typedef typename coordinate_type

::type ct; \ Chris@16: static inline ct get(Box

const& b) \ Chris@16: { return geometry::get(b. MinCorner); } \ Chris@16: static inline void set(Box

& b, ct const& value) \ Chris@16: { geometry::set(b. MinCorner, value); } \ Chris@16: }; \ Chris@16: template \ Chris@16: struct indexed_access, max_corner, D> \ Chris@16: { \ Chris@16: typedef typename coordinate_type

::type ct; \ Chris@16: static inline ct get(Box

const& b) \ Chris@16: { return geometry::get(b. MaxCorner); } \ Chris@16: static inline void set(Box

& b, ct const& value) \ Chris@16: { geometry::set(b. MaxCorner, value); } \ Chris@16: }; Chris@16: Chris@16: Chris@16: #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_4VALUES(Box, Point, Left, Bottom, Right, Top) \ Chris@16: template <> struct indexed_access \ Chris@16: { \ Chris@16: typedef coordinate_type::type ct; \ Chris@16: static inline ct get(Box const& b) { return b. Left; } \ Chris@16: static inline void set(Box& b, ct const& value) { b. Left = value; } \ Chris@16: }; \ Chris@16: template <> struct indexed_access \ Chris@16: { \ Chris@16: typedef coordinate_type::type ct; \ Chris@16: static inline ct get(Box const& b) { return b. Bottom; } \ Chris@16: static inline void set(Box& b, ct const& value) { b. Bottom = value; } \ Chris@16: }; \ Chris@16: template <> struct indexed_access \ Chris@16: { \ Chris@16: typedef coordinate_type::type ct; \ Chris@16: static inline ct get(Box const& b) { return b. Right; } \ Chris@16: static inline void set(Box& b, ct const& value) { b. Right = value; } \ Chris@16: }; \ Chris@16: template <> struct indexed_access \ Chris@16: { \ Chris@16: typedef coordinate_type::type ct; \ Chris@16: static inline ct get(Box const& b) { return b. Top; } \ Chris@16: static inline void set(Box& b, ct const& value) { b. Top = value; } \ Chris@16: }; Chris@16: Chris@16: Chris@16: Chris@16: Chris@16: #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS(Box, PointType) \ Chris@16: template<> struct tag { typedef box_tag type; }; \ Chris@16: template<> struct point_type { typedef PointType type; }; Chris@16: Chris@16: #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS_TEMPLATED(Box) \ Chris@16: template struct tag > { typedef box_tag type; }; \ Chris@16: template struct point_type > { typedef P type; }; Chris@16: Chris@16: #endif // DOXYGEN_NO_SPECIALIZATIONS Chris@16: Chris@16: Chris@16: Chris@16: /*! Chris@16: \brief \brief_macro{box} Chris@16: \ingroup register Chris@101: \details \details_macro{BOOST_GEOMETRY_REGISTER_BOX, box} The Chris@16: box may contain template parameters, which must be specified then. Chris@16: \param Box \param_macro_type{Box} Chris@16: \param Point Point type on which box is based. Might be two or three-dimensional Chris@16: \param MinCorner minimum corner (should be public member or method) Chris@16: \param MaxCorner maximum corner (should be public member or method) Chris@16: Chris@16: \qbk{ Chris@16: [heading Example] Chris@16: [register_box] Chris@16: [register_box_output] Chris@16: } Chris@16: */ Chris@16: #define BOOST_GEOMETRY_REGISTER_BOX(Box, Point, MinCorner, MaxCorner) \ Chris@16: namespace boost { namespace geometry { namespace traits { \ Chris@16: BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS(Box, Point) \ Chris@16: BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS(Box, Point, MinCorner, MaxCorner) \ Chris@16: }}} Chris@16: Chris@16: Chris@16: /*! Chris@16: \brief \brief_macro{box} Chris@16: \ingroup register Chris@101: \details \details_macro{BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED, box} Chris@16: \details_macro_templated{box, point} Chris@16: \param Box \param_macro_type{Box} Chris@16: \param MinCorner minimum corner (should be public member or method) Chris@16: \param MaxCorner maximum corner (should be public member or method) Chris@16: Chris@16: \qbk{ Chris@16: [heading Example] Chris@16: [register_box_templated] Chris@16: [register_box_templated_output] Chris@16: } Chris@16: */ Chris@16: #define BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED(Box, MinCorner, MaxCorner) \ Chris@16: namespace boost { namespace geometry { namespace traits { \ Chris@16: BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS_TEMPLATED(Box) \ Chris@16: BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_TEMPLATED(Box, MinCorner, MaxCorner) \ Chris@16: }}} Chris@16: Chris@16: /*! Chris@16: \brief \brief_macro{box} Chris@16: \ingroup register Chris@101: \details \details_macro{BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES, box} Chris@16: \param Box \param_macro_type{Box} Chris@16: \param Point Point type reported as point_type by box. Must be two dimensional. Chris@101: Note that these box tyeps do not contain points, but they must have a Chris@16: related point_type Chris@16: \param Left Left side (must be public member or method) Chris@16: \param Bottom Bottom side (must be public member or method) Chris@16: \param Right Right side (must be public member or method) Chris@16: \param Top Top side (must be public member or method) Chris@16: Chris@16: \qbk{ Chris@16: [heading Example] Chris@16: [register_box_2d_4values] Chris@16: [register_box_2d_4values_output] Chris@16: } Chris@16: */ Chris@16: #define BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES(Box, Point, Left, Bottom, Right, Top) \ Chris@16: namespace boost { namespace geometry { namespace traits { \ Chris@16: BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS(Box, Point) \ Chris@16: BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_4VALUES(Box, Point, Left, Bottom, Right, Top) \ Chris@16: }}} Chris@16: Chris@16: Chris@16: Chris@16: // CONST versions are for boxes probably not that common. Postponed. Chris@16: Chris@16: Chris@16: #endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_BOX_HPP