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/range/value_type.hpp>
20 #include <boost/geometry/core/ring_type.hpp>
21 #include <boost/geometry/core/static_assert.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>
40 BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
41 "Not or not yet implemented for this Geometry type.",
46 template <typename Geometry>
47 struct range_type<Geometry, ring_tag>
49 typedef Geometry type;
53 template <typename Geometry>
54 struct range_type<Geometry, linestring_tag>
56 typedef Geometry type;
60 template <typename Geometry>
61 struct range_type<Geometry, polygon_tag>
63 typedef typename ring_type<Geometry>::type type;
67 template <typename Geometry>
68 struct range_type<Geometry, box_tag>
70 typedef box_view<Geometry> type;
74 // multi-point acts itself as a range
75 template <typename Geometry>
76 struct range_type<Geometry, multi_point_tag>
78 typedef Geometry type;
82 template <typename Geometry>
83 struct range_type<Geometry, multi_linestring_tag>
85 typedef typename boost::range_value<Geometry>::type type;
89 template <typename Geometry>
90 struct range_type<Geometry, multi_polygon_tag>
92 // Call its single-version
93 typedef typename dispatch::range_type
95 typename boost::range_value<Geometry>::type
100 } // namespace dispatch
101 #endif // DOXYGEN_NO_DISPATCH
103 // Will probably be replaced by the more generic "view_as", therefore in detail
109 \brief Meta-function defining a type which is a boost-range.
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)
118 template <typename Geometry>
121 typedef typename dispatch::range_type
129 }} // namespace boost::geometry
132 #endif // BOOST_GEOMETRY_VIEWS_DETAIL_RANGE_TYPE_HPP