]>
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 | #ifndef BOOST_GEOMETRY_VIEWS_DETAIL_RANGE_TYPE_HPP | |
15 | #define BOOST_GEOMETRY_VIEWS_DETAIL_RANGE_TYPE_HPP | |
16 | ||
17 | ||
7c673cae FG |
18 | #include <boost/range/value_type.hpp> |
19 | ||
20 | #include <boost/geometry/core/ring_type.hpp> | |
20effc67 | 21 | #include <boost/geometry/core/static_assert.hpp> |
7c673cae FG |
22 | #include <boost/geometry/core/tag.hpp> |
23 | #include <boost/geometry/core/tags.hpp> | |
24 | ||
25 | #include <boost/geometry/views/box_view.hpp> | |
26 | ||
27 | namespace boost { namespace geometry | |
28 | { | |
29 | ||
30 | ||
31 | #ifndef DOXYGEN_NO_DISPATCH | |
32 | namespace dispatch | |
33 | { | |
34 | ||
35 | ||
36 | template <typename Geometry, | |
37 | typename Tag = typename tag<Geometry>::type> | |
38 | struct range_type | |
39 | { | |
20effc67 TL |
40 | BOOST_GEOMETRY_STATIC_ASSERT_FALSE( |
41 | "Not or not yet implemented for this Geometry type.", | |
42 | Geometry, Tag); | |
7c673cae FG |
43 | }; |
44 | ||
45 | ||
46 | template <typename Geometry> | |
47 | struct range_type<Geometry, ring_tag> | |
48 | { | |
49 | typedef Geometry type; | |
50 | }; | |
51 | ||
52 | ||
53 | template <typename Geometry> | |
54 | struct range_type<Geometry, linestring_tag> | |
55 | { | |
56 | typedef Geometry type; | |
57 | }; | |
58 | ||
59 | ||
60 | template <typename Geometry> | |
61 | struct range_type<Geometry, polygon_tag> | |
62 | { | |
63 | typedef typename ring_type<Geometry>::type type; | |
64 | }; | |
65 | ||
66 | ||
67 | template <typename Geometry> | |
68 | struct range_type<Geometry, box_tag> | |
69 | { | |
70 | typedef box_view<Geometry> type; | |
71 | }; | |
72 | ||
73 | ||
74 | // multi-point acts itself as a range | |
75 | template <typename Geometry> | |
76 | struct range_type<Geometry, multi_point_tag> | |
77 | { | |
78 | typedef Geometry type; | |
79 | }; | |
80 | ||
81 | ||
82 | template <typename Geometry> | |
83 | struct range_type<Geometry, multi_linestring_tag> | |
84 | { | |
85 | typedef typename boost::range_value<Geometry>::type type; | |
86 | }; | |
87 | ||
88 | ||
89 | template <typename Geometry> | |
90 | struct range_type<Geometry, multi_polygon_tag> | |
91 | { | |
92 | // Call its single-version | |
93 | typedef typename dispatch::range_type | |
94 | < | |
95 | typename boost::range_value<Geometry>::type | |
96 | >::type type; | |
97 | }; | |
98 | ||
99 | ||
100 | } // namespace dispatch | |
101 | #endif // DOXYGEN_NO_DISPATCH | |
102 | ||
103 | // Will probably be replaced by the more generic "view_as", therefore in detail | |
104 | namespace detail | |
105 | { | |
106 | ||
107 | ||
108 | /*! | |
109 | \brief Meta-function defining a type which is a boost-range. | |
110 | \details | |
111 | - For linestrings and rings, it defines the type itself. | |
112 | - For polygons it defines the ring type. | |
113 | - For multi-points, it defines the type itself | |
114 | - For multi-polygons and multi-linestrings, it defines the single-version | |
115 | (so in the end the linestring and ring-type-of-multi-polygon) | |
116 | \ingroup iterators | |
117 | */ | |
118 | template <typename Geometry> | |
119 | struct range_type | |
120 | { | |
121 | typedef typename dispatch::range_type | |
122 | < | |
123 | Geometry | |
124 | >::type type; | |
125 | }; | |
126 | ||
127 | } | |
128 | ||
129 | }} // namespace boost::geometry | |
130 | ||
131 | ||
132 | #endif // BOOST_GEOMETRY_VIEWS_DETAIL_RANGE_TYPE_HPP |