• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 
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)
8 
9 #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POLYGON_HPP
10 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POLYGON_HPP
11 
12 // Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
13 // boost::polygon::polygon_with_holes_data -> boost::geometry::polygon
14 
15 #include <boost/polygon/polygon.hpp>
16 
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>
21 
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>
25 
26 
27 namespace boost { namespace geometry
28 {
29 
30 
31 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
32 namespace traits
33 {
34 
35 template <typename CoordinateType>
36 struct tag<boost::polygon::polygon_with_holes_data<CoordinateType> >
37 {
38     typedef polygon_tag type;
39 };
40 
41 template <typename CoordinateType>
42 struct ring_const_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
43 {
44     typedef adapt::bp::ring_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> const> type;
45 };
46 
47 template <typename CoordinateType>
48 struct ring_mutable_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
49 {
50     typedef adapt::bp::ring_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> > type;
51 };
52 
53 template <typename CoordinateType>
54 struct interior_const_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
55 {
56     typedef adapt::bp::holes_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> const> type;
57 };
58 
59 template <typename CoordinateType>
60 struct interior_mutable_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
61 {
62     typedef adapt::bp::holes_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> > type;
63 };
64 
65 
66 template <typename CoordinateType>
67 struct exterior_ring<boost::polygon::polygon_with_holes_data<CoordinateType> >
68 {
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;
72 
getboost::geometry::traits::exterior_ring73     static inline proxy get(polygon_type& p)
74     {
75         return proxy(p);
76     }
77 
getboost::geometry::traits::exterior_ring78     static inline const_proxy get(polygon_type const& p)
79     {
80         return const_proxy(p);
81     }
82 };
83 
84 template <typename CoordinateType>
85 struct interior_rings<boost::polygon::polygon_with_holes_data<CoordinateType> >
86 {
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;
90 
getboost::geometry::traits::interior_rings91     static inline proxy get(polygon_type& p)
92     {
93         return proxy(p);
94     }
95 
getboost::geometry::traits::interior_rings96     static inline const_proxy get(polygon_type const& p)
97     {
98         return const_proxy(p);
99     }
100 };
101 
102 
103 
104 } // namespace traits
105 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
106 
107 }} // namespace boost::geometry
108 
109 
110 #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POLYGON_HPP
111 
112