]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/core/topological_dimension.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / core / topological_dimension.hpp
CommitLineData
7c673cae
FG
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
26namespace boost { namespace geometry
27{
28
29
30#ifndef DOXYGEN_NO_DISPATCH
31namespace core_dispatch
32{
33
34
35template <typename GeometryTag>
36struct top_dim {};
37
38
39template <>
40struct top_dim<point_tag> : boost::mpl::int_<0> {};
41
42
43template <>
44struct top_dim<linestring_tag> : boost::mpl::int_<1> {};
45
46
47template <>
48struct 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!
53template <>
54struct top_dim<ring_tag> : boost::mpl::int_<2> {};
55
56
57// TODO: This is wrong! Boxes may have various topological dimensions
58template <>
59struct top_dim<box_tag> : boost::mpl::int_<2> {};
60
61
62template <>
63struct top_dim<polygon_tag> : boost::mpl::int_<2> {};
64
65
66template <>
67struct top_dim<multi_point_tag> : boost::mpl::int_<0> {};
68
69
70template <>
71struct top_dim<multi_linestring_tag> : boost::mpl::int_<1> {};
72
73
74template <>
75struct 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*/
93template <typename Geometry>
94struct 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