]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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/mpl/if.hpp> | |
21 | #include <boost/type_traits/is_const.hpp> | |
22 | #include <boost/type_traits/remove_const.hpp> | |
23 | #include <boost/type_traits/remove_reference.hpp> | |
24 | ||
25 | #include <boost/geometry/core/tag.hpp> | |
26 | #include <boost/geometry/core/tags.hpp> | |
27 | ||
28 | namespace boost { namespace geometry | |
29 | { | |
30 | ||
31 | namespace traits | |
32 | { | |
33 | ||
34 | /*! | |
35 | \brief Traits class indicating interior container type of a polygon | |
36 | \details defines inner container type, so the container containing | |
37 | the interior rings | |
38 | \ingroup traits | |
39 | \par Geometries: | |
40 | - polygon | |
41 | \par Specializations should provide: | |
42 | - typedef X type ( e.g. std::vector<myring<P>> ) | |
43 | \tparam Geometry geometry | |
44 | */ | |
45 | template <typename Geometry> | |
46 | struct interior_const_type | |
47 | { | |
48 | BOOST_MPL_ASSERT_MSG | |
49 | ( | |
50 | false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE | |
51 | , (types<Geometry>) | |
52 | ); | |
53 | }; | |
54 | ||
55 | template <typename Geometry> | |
56 | struct interior_mutable_type | |
57 | { | |
58 | BOOST_MPL_ASSERT_MSG | |
59 | ( | |
60 | false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE | |
61 | , (types<Geometry>) | |
62 | ); | |
63 | }; | |
64 | ||
65 | ||
66 | } // namespace traits | |
67 | ||
68 | ||
69 | ||
70 | ||
71 | #ifndef DOXYGEN_NO_DISPATCH | |
72 | namespace core_dispatch | |
73 | { | |
74 | ||
75 | ||
76 | template <typename GeometryTag, typename Geometry> | |
77 | struct interior_return_type | |
78 | { | |
79 | BOOST_MPL_ASSERT_MSG | |
80 | ( | |
81 | false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE | |
82 | , (types<Geometry>) | |
83 | ); | |
84 | }; | |
85 | ||
86 | ||
87 | template <typename Polygon> | |
88 | struct interior_return_type<polygon_tag, Polygon> | |
89 | { | |
90 | typedef typename boost::remove_const<Polygon>::type nc_polygon_type; | |
91 | ||
92 | typedef typename boost::mpl::if_ | |
93 | < | |
94 | boost::is_const<Polygon>, | |
95 | typename traits::interior_const_type<nc_polygon_type>::type, | |
96 | typename traits::interior_mutable_type<nc_polygon_type>::type | |
97 | >::type type; | |
98 | }; | |
99 | ||
100 | ||
101 | ||
102 | ||
103 | template <typename GeometryTag, typename Geometry> | |
104 | struct interior_type | |
105 | { | |
106 | BOOST_MPL_ASSERT_MSG | |
107 | ( | |
108 | false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE | |
109 | , (types<Geometry>) | |
110 | ); | |
111 | }; | |
112 | ||
113 | ||
114 | template <typename Polygon> | |
115 | struct interior_type<polygon_tag, Polygon> | |
116 | { | |
117 | typedef typename boost::remove_reference | |
118 | < | |
119 | typename interior_return_type<polygon_tag, Polygon>::type | |
120 | >::type type; | |
121 | }; | |
122 | ||
123 | ||
124 | } // namespace core_dispatch | |
125 | #endif | |
126 | ||
127 | ||
128 | /*! | |
129 | \brief \brief_meta{type, interior_type (container type | |
130 | of inner rings), \meta_geometry_type} | |
131 | \details Interior rings should be organized as a container | |
132 | (std::vector, std::deque, boost::array) with | |
133 | Boost.Range support. This metafunction defines the type | |
134 | of the container. | |
135 | \tparam Geometry A type fullfilling the Polygon or MultiPolygon concept. | |
136 | \ingroup core | |
137 | ||
138 | \qbk{[include reference/core/interior_type.qbk]} | |
139 | */ | |
140 | template <typename Geometry> | |
141 | struct interior_type | |
142 | { | |
143 | typedef typename core_dispatch::interior_type | |
144 | < | |
145 | typename tag<Geometry>::type, | |
146 | Geometry | |
147 | >::type type; | |
148 | }; | |
149 | ||
150 | template <typename Geometry> | |
151 | struct interior_return_type | |
152 | { | |
153 | typedef typename core_dispatch::interior_return_type | |
154 | < | |
155 | typename tag<Geometry>::type, | |
156 | Geometry | |
157 | >::type type; | |
158 | }; | |
159 | ||
160 | ||
161 | }} // namespace boost::geometry | |
162 | ||
163 | ||
164 | #endif // BOOST_GEOMETRY_CORE_INTERIOR_TYPE_HPP |