]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/core/topological_dimension.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / core / topological_dimension.hpp
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
15 #ifndef BOOST_GEOMETRY_CORE_TOPOLOGICAL_DIMENSION_HPP
16 #define BOOST_GEOMETRY_CORE_TOPOLOGICAL_DIMENSION_HPP
17
18
19 #include <boost/mpl/int.hpp>
20
21
22 #include <boost/geometry/core/tag.hpp>
23 #include <boost/geometry/core/tags.hpp>
24
25
26 namespace boost { namespace geometry
27 {
28
29
30 #ifndef DOXYGEN_NO_DISPATCH
31 namespace core_dispatch
32 {
33
34
35 template <typename GeometryTag>
36 struct top_dim {};
37
38
39 template <>
40 struct top_dim<point_tag> : boost::mpl::int_<0> {};
41
42
43 template <>
44 struct top_dim<linestring_tag> : boost::mpl::int_<1> {};
45
46
47 template <>
48 struct top_dim<segment_tag> : boost::mpl::int_<1> {};
49
50
51 // ring: topological dimension of two, but some people say: 1 !!
52 // NOTE: This is not OGC LinearRing!
53 template <>
54 struct top_dim<ring_tag> : boost::mpl::int_<2> {};
55
56
57 // TODO: This is wrong! Boxes may have various topological dimensions
58 template <>
59 struct top_dim<box_tag> : boost::mpl::int_<2> {};
60
61
62 template <>
63 struct top_dim<polygon_tag> : boost::mpl::int_<2> {};
64
65
66 template <>
67 struct top_dim<multi_point_tag> : boost::mpl::int_<0> {};
68
69
70 template <>
71 struct top_dim<multi_linestring_tag> : boost::mpl::int_<1> {};
72
73
74 template <>
75 struct top_dim<multi_polygon_tag> : boost::mpl::int_<2> {};
76
77
78 } // namespace core_dispatch
79 #endif
80
81
82
83
84
85 /*!
86 \brief Meta-function returning the topological dimension of a geometry
87 \details The topological dimension defines a point as 0-dimensional,
88 a linestring as 1-dimensional,
89 and a ring or polygon as 2-dimensional.
90 \see http://www.math.okstate.edu/mathdept/dynamics/lecnotes/node36.html
91 \ingroup core
92 */
93 template <typename Geometry>
94 struct topological_dimension
95 : core_dispatch::top_dim<typename tag<Geometry>::type> {};
96
97
98 }} // namespace boost::geometry
99
100
101 #endif // BOOST_GEOMETRY_CORE_TOPOLOGICAL_DIMENSION_HPP