1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POLYGON_HPP
10 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POLYGON_HPP
12 // Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
13 // boost::polygon::polygon_with_holes_data -> boost::geometry::polygon
15 #include <boost/polygon/polygon.hpp>
17 #include <boost/geometry/core/tags.hpp>
18 #include <boost/geometry/core/ring_type.hpp>
19 #include <boost/geometry/core/exterior_ring.hpp>
20 #include <boost/geometry/core/interior_rings.hpp>
22 #include <boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp>
23 #include <boost/geometry/geometries/adapted/boost_polygon/hole_iterator.hpp>
24 #include <boost/geometry/geometries/adapted/boost_polygon/holes_proxy.hpp>
27 namespace boost { namespace geometry
31 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
35 template <typename CoordinateType>
36 struct tag<boost::polygon::polygon_with_holes_data<CoordinateType> >
38 typedef polygon_tag type;
41 template <typename CoordinateType>
42 struct ring_const_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
44 typedef adapt::bp::ring_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> const> type;
47 template <typename CoordinateType>
48 struct ring_mutable_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
50 typedef adapt::bp::ring_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> > type;
53 template <typename CoordinateType>
54 struct interior_const_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
56 typedef adapt::bp::holes_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> const> type;
59 template <typename CoordinateType>
60 struct interior_mutable_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
62 typedef adapt::bp::holes_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> > type;
66 template <typename CoordinateType>
67 struct exterior_ring<boost::polygon::polygon_with_holes_data<CoordinateType> >
69 typedef boost::polygon::polygon_with_holes_data<CoordinateType> polygon_type;
70 typedef adapt::bp::ring_proxy<polygon_type> proxy;
71 typedef adapt::bp::ring_proxy<polygon_type const> const_proxy;
73 static inline proxy get(polygon_type& p)
78 static inline const_proxy get(polygon_type const& p)
80 return const_proxy(p);
84 template <typename CoordinateType>
85 struct interior_rings<boost::polygon::polygon_with_holes_data<CoordinateType> >
87 typedef boost::polygon::polygon_with_holes_data<CoordinateType> polygon_type;
88 typedef adapt::bp::holes_proxy<polygon_type> proxy;
89 typedef adapt::bp::holes_proxy<polygon_type const> const_proxy;
91 static inline proxy get(polygon_type& p)
96 static inline const_proxy get(polygon_type const& p)
98 return const_proxy(p);
104 } // namespace traits
105 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
107 }} // namespace boost::geometry
110 #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POLYGON_HPP