Chris@16
|
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
|
Chris@16
|
2
|
Chris@16
|
3 // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
Chris@16
|
4
|
Chris@16
|
5 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8
|
Chris@16
|
9 #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POLYGON_HPP
|
Chris@16
|
10 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POLYGON_HPP
|
Chris@16
|
11
|
Chris@16
|
12 // Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
|
Chris@16
|
13 // boost::polygon::polygon_with_holes_data -> boost::geometry::polygon
|
Chris@16
|
14
|
Chris@16
|
15 #include <boost/polygon/polygon.hpp>
|
Chris@16
|
16
|
Chris@16
|
17 #include <boost/geometry/core/tags.hpp>
|
Chris@16
|
18 #include <boost/geometry/core/ring_type.hpp>
|
Chris@16
|
19 #include <boost/geometry/core/exterior_ring.hpp>
|
Chris@16
|
20 #include <boost/geometry/core/interior_rings.hpp>
|
Chris@16
|
21
|
Chris@16
|
22 #include <boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp>
|
Chris@16
|
23 #include <boost/geometry/geometries/adapted/boost_polygon/hole_iterator.hpp>
|
Chris@16
|
24 #include <boost/geometry/geometries/adapted/boost_polygon/holes_proxy.hpp>
|
Chris@16
|
25
|
Chris@16
|
26
|
Chris@16
|
27 namespace boost { namespace geometry
|
Chris@16
|
28 {
|
Chris@16
|
29
|
Chris@16
|
30
|
Chris@16
|
31 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
Chris@16
|
32 namespace traits
|
Chris@16
|
33 {
|
Chris@16
|
34
|
Chris@16
|
35 template <typename CoordinateType>
|
Chris@16
|
36 struct tag<boost::polygon::polygon_with_holes_data<CoordinateType> >
|
Chris@16
|
37 {
|
Chris@16
|
38 typedef polygon_tag type;
|
Chris@16
|
39 };
|
Chris@16
|
40
|
Chris@16
|
41 template <typename CoordinateType>
|
Chris@16
|
42 struct ring_const_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
|
Chris@16
|
43 {
|
Chris@16
|
44 typedef adapt::bp::ring_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> const> type;
|
Chris@16
|
45 };
|
Chris@16
|
46
|
Chris@16
|
47 template <typename CoordinateType>
|
Chris@16
|
48 struct ring_mutable_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
|
Chris@16
|
49 {
|
Chris@16
|
50 typedef adapt::bp::ring_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> > type;
|
Chris@16
|
51 };
|
Chris@16
|
52
|
Chris@16
|
53 template <typename CoordinateType>
|
Chris@16
|
54 struct interior_const_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
|
Chris@16
|
55 {
|
Chris@16
|
56 typedef adapt::bp::holes_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> const> type;
|
Chris@16
|
57 };
|
Chris@16
|
58
|
Chris@16
|
59 template <typename CoordinateType>
|
Chris@16
|
60 struct interior_mutable_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
|
Chris@16
|
61 {
|
Chris@16
|
62 typedef adapt::bp::holes_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> > type;
|
Chris@16
|
63 };
|
Chris@16
|
64
|
Chris@16
|
65
|
Chris@16
|
66 template <typename CoordinateType>
|
Chris@16
|
67 struct exterior_ring<boost::polygon::polygon_with_holes_data<CoordinateType> >
|
Chris@16
|
68 {
|
Chris@16
|
69 typedef boost::polygon::polygon_with_holes_data<CoordinateType> polygon_type;
|
Chris@16
|
70 typedef adapt::bp::ring_proxy<polygon_type> proxy;
|
Chris@16
|
71 typedef adapt::bp::ring_proxy<polygon_type const> const_proxy;
|
Chris@16
|
72
|
Chris@16
|
73 static inline proxy get(polygon_type& p)
|
Chris@16
|
74 {
|
Chris@16
|
75 return proxy(p);
|
Chris@16
|
76 }
|
Chris@16
|
77
|
Chris@16
|
78 static inline const_proxy get(polygon_type const& p)
|
Chris@16
|
79 {
|
Chris@16
|
80 return const_proxy(p);
|
Chris@16
|
81 }
|
Chris@16
|
82 };
|
Chris@16
|
83
|
Chris@16
|
84 template <typename CoordinateType>
|
Chris@16
|
85 struct interior_rings<boost::polygon::polygon_with_holes_data<CoordinateType> >
|
Chris@16
|
86 {
|
Chris@16
|
87 typedef boost::polygon::polygon_with_holes_data<CoordinateType> polygon_type;
|
Chris@16
|
88 typedef adapt::bp::holes_proxy<polygon_type> proxy;
|
Chris@16
|
89 typedef adapt::bp::holes_proxy<polygon_type const> const_proxy;
|
Chris@16
|
90
|
Chris@16
|
91 static inline proxy get(polygon_type& p)
|
Chris@16
|
92 {
|
Chris@16
|
93 return proxy(p);
|
Chris@16
|
94 }
|
Chris@16
|
95
|
Chris@16
|
96 static inline const_proxy get(polygon_type const& p)
|
Chris@16
|
97 {
|
Chris@16
|
98 return const_proxy(p);
|
Chris@16
|
99 }
|
Chris@16
|
100 };
|
Chris@16
|
101
|
Chris@16
|
102
|
Chris@16
|
103
|
Chris@16
|
104 } // namespace traits
|
Chris@16
|
105 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
|
Chris@16
|
106
|
Chris@16
|
107 }} // namespace boost::geometry
|
Chris@16
|
108
|
Chris@16
|
109
|
Chris@16
|
110 #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POLYGON_HPP
|
Chris@16
|
111
|