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 // This file was modified by Oracle on 2020.
8 // Modifications copyright (c) 2020 Oracle and/or its affiliates.
9 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
11 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
12 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
14 // Use, modification and distribution is subject to the Boost Software License,
15 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
18 #ifndef BOOST_GEOMETRY_CORE_POINT_TYPE_HPP
19 #define BOOST_GEOMETRY_CORE_POINT_TYPE_HPP
22 #include <boost/range/value_type.hpp>
24 #include <boost/geometry/core/ring_type.hpp>
25 #include <boost/geometry/core/static_assert.hpp>
26 #include <boost/geometry/core/tag.hpp>
27 #include <boost/geometry/core/tags.hpp>
28 #include <boost/geometry/util/type_traits_std.hpp>
31 namespace boost { namespace geometry
38 \brief Traits class indicating the type of contained points
41 - all geometries except point
42 \par Specializations should provide:
43 - typedef P type (where P should fulfil the Point concept)
44 \tparam Geometry geometry
46 template <typename Geometry>
49 BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
50 "Not implemented for this Geometry type.",
58 #ifndef DOXYGEN_NO_DISPATCH
59 namespace core_dispatch
62 template <typename Tag, typename Geometry>
65 // Default: call traits to get point type
66 typedef typename std::remove_const
68 typename traits::point_type<Geometry>::type
73 // Specialization for point: the point itself
74 template <typename Point>
75 struct point_type<point_tag, Point>
81 // Specializations for linestring/ring, via boost::range
82 template <typename Linestring>
83 struct point_type<linestring_tag, Linestring>
85 typedef typename boost::range_value<Linestring>::type type;
89 template <typename Ring>
90 struct point_type<ring_tag, Ring>
92 typedef typename boost::range_value<Ring>::type type;
96 // Specialization for polygon: the point-type is the point-type of its rings
97 template <typename Polygon>
98 struct point_type<polygon_tag, Polygon>
100 typedef typename point_type
103 typename ring_type<polygon_tag, Polygon>::type
108 template <typename MultiPoint>
109 struct point_type<multi_point_tag, MultiPoint>
111 typedef typename boost::range_value
118 template <typename MultiLinestring>
119 struct point_type<multi_linestring_tag, MultiLinestring>
121 typedef typename point_type
124 typename boost::range_value<MultiLinestring>::type
129 template <typename MultiPolygon>
130 struct point_type<multi_polygon_tag, MultiPolygon>
132 typedef typename point_type
135 typename boost::range_value<MultiPolygon>::type
140 } // namespace core_dispatch
141 #endif // DOXYGEN_NO_DISPATCH
145 \brief \brief_meta{type, point_type, \meta_geometry_type}
146 \tparam Geometry \tparam_geometry
149 \qbk{[include reference/core/point_type.qbk]}
151 template <typename Geometry>
154 typedef typename core_dispatch::point_type
156 typename tag<Geometry>::type,
157 typename util::remove_cptrref<Geometry>::type
162 }} // namespace boost::geometry
165 #endif // BOOST_GEOMETRY_CORE_POINT_TYPE_HPP