1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | |
3 | // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. |
4 | // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. |
5 | // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. |
6 | |
7 | // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library |
8 | // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. |
9 | |
10 | // Use, modification and distribution is subject to the Boost Software License, |
11 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
12 | // http://www.boost.org/LICENSE_1_0.txt) |
13 | |
14 | |
15 | #ifndef BOOST_GEOMETRY_CORE_INTERIOR_TYPE_HPP |
16 | #define BOOST_GEOMETRY_CORE_INTERIOR_TYPE_HPP |
17 | |
18 | |
19 | #include <boost/mpl/assert.hpp> |
20 | #include <boost/type_traits/remove_const.hpp> |
21 | |
22 | #include <boost/geometry/core/tag.hpp> |
23 | #include <boost/geometry/core/tags.hpp> |
24 | |
25 | namespace boost { namespace geometry |
26 | { |
27 | |
28 | namespace traits |
29 | { |
30 | |
31 | /*! |
32 | \brief Traits class indicating interior container type of a polygon |
33 | \details defines inner container type, so the container containing |
34 | the interior rings |
35 | \ingroup traits |
36 | \par Geometries: |
37 | - polygon |
38 | \par Specializations should provide: |
39 | - typedef X type ( e.g. std::vector<myring<P>> ) |
40 | \tparam Geometry geometry |
41 | */ |
42 | template <typename Geometry> |
43 | struct interior_const_type |
44 | { |
45 | BOOST_MPL_ASSERT_MSG |
46 | ( |
47 | false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE |
48 | , (types<Geometry>) |
49 | ); |
50 | }; |
51 | |
52 | template <typename Geometry> |
53 | struct interior_mutable_type |
54 | { |
55 | BOOST_MPL_ASSERT_MSG |
56 | ( |
57 | false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE |
58 | , (types<Geometry>) |
59 | ); |
60 | }; |
61 | |
62 | |
63 | } // namespace traits |
64 | |
65 | |
66 | |
67 | |
68 | #ifndef DOXYGEN_NO_DISPATCH |
69 | namespace core_dispatch |
70 | { |
71 | |
72 | |
73 | template <typename GeometryTag, typename Geometry> |
74 | struct interior_return_type |
75 | { |
76 | BOOST_MPL_ASSERT_MSG |
77 | ( |
78 | false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE |
79 | , (types<Geometry>) |
80 | ); |
81 | }; |
82 | |
83 | |
84 | template <typename Polygon> |
85 | struct interior_return_type<polygon_tag, Polygon> |
86 | { |
87 | typedef typename boost::remove_const<Polygon>::type nc_polygon_type; |
88 | |
89 | typedef typename boost::mpl::if_ |
90 | < |
91 | boost::is_const<Polygon>, |
92 | typename traits::interior_const_type<nc_polygon_type>::type, |
93 | typename traits::interior_mutable_type<nc_polygon_type>::type |
94 | >::type type; |
95 | }; |
96 | |
97 | |
98 | |
99 | |
100 | template <typename GeometryTag, typename Geometry> |
101 | struct interior_type |
102 | { |
103 | BOOST_MPL_ASSERT_MSG |
104 | ( |
105 | false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE |
106 | , (types<Geometry>) |
107 | ); |
108 | }; |
109 | |
110 | |
111 | template <typename Polygon> |
112 | struct interior_type<polygon_tag, Polygon> |
113 | { |
114 | typedef typename boost::remove_reference |
115 | < |
116 | typename interior_return_type<polygon_tag, Polygon>::type |
117 | >::type type; |
118 | }; |
119 | |
120 | |
121 | } // namespace core_dispatch |
122 | #endif |
123 | |
124 | |
125 | /*! |
126 | \brief \brief_meta{type, interior_type (container type |
127 | of inner rings), \meta_geometry_type} |
128 | \details Interior rings should be organized as a container |
129 | (std::vector, std::deque, boost::array) with |
130 | Boost.Range support. This metafunction defines the type |
131 | of the container. |
132 | \tparam Geometry A type fullfilling the Polygon or MultiPolygon concept. |
133 | \ingroup core |
134 | |
135 | \qbk{[include reference/core/interior_type.qbk]} |
136 | */ |
137 | template <typename Geometry> |
138 | struct interior_type |
139 | { |
140 | typedef typename core_dispatch::interior_type |
141 | < |
142 | typename tag<Geometry>::type, |
143 | Geometry |
144 | >::type type; |
145 | }; |
146 | |
147 | template <typename Geometry> |
148 | struct interior_return_type |
149 | { |
150 | typedef typename core_dispatch::interior_return_type |
151 | < |
152 | typename tag<Geometry>::type, |
153 | Geometry |
154 | >::type type; |
155 | }; |
156 | |
157 | |
158 | }} // namespace boost::geometry |
159 | |
160 | |
161 | #endif // BOOST_GEOMETRY_CORE_INTERIOR_TYPE_HPP |
162 | |