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_CORE_POINT_TYPE_HPP
15 #define BOOST_GEOMETRY_CORE_POINT_TYPE_HPP
18 #include <boost/mpl/assert.hpp>
19 #include <boost/range/value_type.hpp>
20 #include <boost/type_traits/remove_const.hpp>
22 #include <boost/geometry/core/ring_type.hpp>
23 #include <boost/geometry/core/tag.hpp>
24 #include <boost/geometry/core/tags.hpp>
25 #include <boost/geometry/util/bare_type.hpp>
27 namespace boost { namespace geometry
34 \brief Traits class indicating the type of contained points
37 - all geometries except point
38 \par Specializations should provide:
39 - typedef P type (where P should fulfil the Point concept)
40 \tparam Geometry geometry
42 template <typename Geometry>
47 false, NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE, (types<Geometry>)
55 #ifndef DOXYGEN_NO_DISPATCH
56 namespace core_dispatch
59 template <typename Tag, typename Geometry>
62 // Default: call traits to get point type
63 typedef typename boost::remove_const
65 typename traits::point_type<Geometry>::type
70 // Specialization for point: the point itself
71 template <typename Point>
72 struct point_type<point_tag, Point>
78 // Specializations for linestring/ring, via boost::range
79 template <typename Linestring>
80 struct point_type<linestring_tag, Linestring>
82 typedef typename boost::range_value<Linestring>::type type;
86 template <typename Ring>
87 struct point_type<ring_tag, Ring>
89 typedef typename boost::range_value<Ring>::type type;
93 // Specialization for polygon: the point-type is the point-type of its rings
94 template <typename Polygon>
95 struct point_type<polygon_tag, Polygon>
97 typedef typename point_type
100 typename ring_type<polygon_tag, Polygon>::type
105 template <typename MultiPoint>
106 struct point_type<multi_point_tag, MultiPoint>
108 typedef typename boost::range_value
115 template <typename MultiLinestring>
116 struct point_type<multi_linestring_tag, MultiLinestring>
118 typedef typename point_type
121 typename boost::range_value<MultiLinestring>::type
126 template <typename MultiPolygon>
127 struct point_type<multi_polygon_tag, MultiPolygon>
129 typedef typename point_type
132 typename boost::range_value<MultiPolygon>::type
137 } // namespace core_dispatch
138 #endif // DOXYGEN_NO_DISPATCH
142 \brief \brief_meta{type, point_type, \meta_geometry_type}
143 \tparam Geometry \tparam_geometry
146 \qbk{[include reference/core/point_type.qbk]}
148 template <typename Geometry>
151 typedef typename core_dispatch::point_type
153 typename tag<Geometry>::type,
154 typename boost::geometry::util::bare_type<Geometry>::type
159 }} // namespace boost::geometry
162 #endif // BOOST_GEOMETRY_CORE_POINT_TYPE_HPP