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_SEGMENT_HPP Chris@16: #define BOOST_GEOMETRY_GEOMETRIES_REGISTER_SEGMENT_HPP Chris@16: Chris@16: Chris@16: #ifndef DOXYGEN_NO_SPECIALIZATIONS Chris@16: Chris@16: Chris@16: #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS(Segment, Point, Index0, Index1) \ Chris@16: template \ Chris@16: struct indexed_access \ Chris@16: { \ Chris@16: typedef typename coordinate_type::type ct; \ Chris@16: static inline ct get(Segment const& b) \ Chris@16: { return geometry::get(b. Index0); } \ Chris@16: static inline void set(Segment& b, ct const& value) \ Chris@16: { geometry::set(b. Index0, 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(Segment const& b) \ Chris@16: { return geometry::get(b. Index1); } \ Chris@16: static inline void set(Segment& b, ct const& value) \ Chris@16: { geometry::set(b. Index1, value); } \ Chris@16: }; Chris@16: Chris@16: Chris@16: #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_TEMPLATIZED(Segment, Index0, Index1) \ 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(Segment

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

& b, ct const& value) \ Chris@16: { geometry::set(b. Index0, 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(Segment

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

& b, ct const& value) \ Chris@16: { geometry::set(b. Index1, value); } \ Chris@16: }; Chris@16: Chris@16: Chris@16: #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_4VALUES(Segment, 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(Segment const& b) { return b. Left; } \ Chris@16: static inline void set(Segment& 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(Segment const& b) { return b. Bottom; } \ Chris@16: static inline void set(Segment& 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(Segment const& b) { return b. Right; } \ Chris@16: static inline void set(Segment& 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(Segment const& b) { return b. Top; } \ Chris@16: static inline void set(Segment& b, ct const& value) { b. Top = value; } \ Chris@16: }; Chris@16: Chris@16: Chris@16: Chris@16: Chris@16: #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \ Chris@16: template<> struct tag { typedef segment_tag type; }; \ Chris@16: template<> struct point_type { typedef PointType type; }; Chris@16: Chris@16: #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS_TEMPLATIZED(Segment) \ Chris@16: template struct tag > { typedef segment_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: #define BOOST_GEOMETRY_REGISTER_SEGMENT(Segment, PointType, Index0, Index1) \ Chris@16: namespace boost { namespace geometry { namespace traits { \ Chris@16: BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \ Chris@16: BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS(Segment, PointType, Index0, Index1) \ Chris@16: }}} Chris@16: Chris@16: Chris@16: #define BOOST_GEOMETRY_REGISTER_SEGMENT_TEMPLATIZED(Segment, Index0, Index1) \ Chris@16: namespace boost { namespace geometry { namespace traits { \ Chris@16: BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS_TEMPLATIZED(Segment) \ Chris@16: BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_TEMPLATIZED(Segment, Index0, Index1) \ Chris@16: }}} Chris@16: Chris@16: #define BOOST_GEOMETRY_REGISTER_SEGMENT_2D_4VALUES(Segment, PointType, Left, Bottom, Right, Top) \ Chris@16: namespace boost { namespace geometry { namespace traits { \ Chris@16: BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \ Chris@16: BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_4VALUES(Segment, PointType, Left, Bottom, Right, Top) \ Chris@16: }}} Chris@16: Chris@16: Chris@16: Chris@16: // CONST versions are for segments probably not that common. Postponed. Chris@16: Chris@16: Chris@16: #endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_SEGMENT_HPP