1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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.
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
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)
14 #ifndef BOOST_GEOMETRY_VIEWS_DETAIL_RANGE_TYPE_HPP
15 #define BOOST_GEOMETRY_VIEWS_DETAIL_RANGE_TYPE_HPP
18 #include <boost/mpl/assert.hpp>
19 #include <boost/range/value_type.hpp>
21 #include <boost/geometry/core/ring_type.hpp>
22 #include <boost/geometry/core/tag.hpp>
23 #include <boost/geometry/core/tags.hpp>
25 #include <boost/geometry/views/box_view.hpp>
27 namespace boost { namespace geometry
31 #ifndef DOXYGEN_NO_DISPATCH
36 template <typename Geometry,
37 typename Tag = typename tag<Geometry>::type>
42 false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
48 template <typename Geometry>
49 struct range_type<Geometry, ring_tag>
51 typedef Geometry type;
55 template <typename Geometry>
56 struct range_type<Geometry, linestring_tag>
58 typedef Geometry type;
62 template <typename Geometry>
63 struct range_type<Geometry, polygon_tag>
65 typedef typename ring_type<Geometry>::type type;
69 template <typename Geometry>
70 struct range_type<Geometry, box_tag>
72 typedef box_view<Geometry> type;
76 // multi-point acts itself as a range
77 template <typename Geometry>
78 struct range_type<Geometry, multi_point_tag>
80 typedef Geometry type;
84 template <typename Geometry>
85 struct range_type<Geometry, multi_linestring_tag>
87 typedef typename boost::range_value<Geometry>::type type;
91 template <typename Geometry>
92 struct range_type<Geometry, multi_polygon_tag>
94 // Call its single-version
95 typedef typename dispatch::range_type
97 typename boost::range_value<Geometry>::type
102 } // namespace dispatch
103 #endif // DOXYGEN_NO_DISPATCH
105 // Will probably be replaced by the more generic "view_as", therefore in detail
111 \brief Meta-function defining a type which is a boost-range.
113 - For linestrings and rings, it defines the type itself.
114 - For polygons it defines the ring type.
115 - For multi-points, it defines the type itself
116 - For multi-polygons and multi-linestrings, it defines the single-version
117 (so in the end the linestring and ring-type-of-multi-polygon)
120 template <typename Geometry>
123 typedef typename dispatch::range_type
131 }} // namespace boost::geometry
134 #endif // BOOST_GEOMETRY_VIEWS_DETAIL_RANGE_TYPE_HPP