Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 08:43:06

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
0006 // Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland.
0007 
0008 // This file was modified by Oracle on 2020-2022.
0009 // Modifications copyright (c) 2020-2022, Oracle and/or its affiliates.
0010 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0011 
0012 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0013 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0014 
0015 // Use, modification and distribution is subject to the Boost Software License,
0016 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0017 // http://www.boost.org/LICENSE_1_0.txt)
0018 
0019 
0020 #ifndef BOOST_GEOMETRY_CORE_TOPOLOGICAL_DIMENSION_HPP
0021 #define BOOST_GEOMETRY_CORE_TOPOLOGICAL_DIMENSION_HPP
0022 
0023 
0024 #include <type_traits>
0025 
0026 #include <boost/geometry/core/tag.hpp>
0027 #include <boost/geometry/core/tags.hpp>
0028 
0029 
0030 namespace boost { namespace geometry
0031 {
0032 
0033 
0034 #ifndef DOXYGEN_NO_DISPATCH
0035 namespace core_dispatch
0036 {
0037 
0038 
0039 template <typename GeometryTag>
0040 struct top_dim {};
0041 
0042 
0043 template <>
0044 struct top_dim<point_tag>      : std::integral_constant<int, 0> {};
0045 
0046 
0047 template <>
0048 struct top_dim<linestring_tag> : std::integral_constant<int, 1> {};
0049 
0050 
0051 template <>
0052 struct top_dim<segment_tag>    : std::integral_constant<int, 1> {};
0053 
0054 
0055 // ring: topological dimension of two, but some people say: 1 !!
0056 // NOTE: This is not OGC LinearRing!
0057 template <>
0058 struct top_dim<ring_tag>       : std::integral_constant<int, 2> {};
0059 
0060 
0061 // TODO: This is wrong! Boxes may have various topological dimensions
0062 template <>
0063 struct top_dim<box_tag>        : std::integral_constant<int, 2> {};
0064 
0065 
0066 template <>
0067 struct top_dim<polygon_tag>    : std::integral_constant<int, 2> {};
0068 
0069 
0070 template <>
0071 struct top_dim<multi_point_tag> : std::integral_constant<int, 0> {};
0072 
0073 
0074 template <>
0075 struct top_dim<multi_linestring_tag> : std::integral_constant<int, 1> {};
0076 
0077 
0078 template <>
0079 struct top_dim<multi_polygon_tag> : std::integral_constant<int, 2> {};
0080 
0081 
0082 template <>
0083 struct top_dim<geometry_collection_tag> : std::integral_constant<int, -1> {};
0084 
0085 
0086 } // namespace core_dispatch
0087 #endif
0088 
0089 
0090 
0091 
0092 
0093 /*!
0094     \brief Meta-function returning the topological dimension of a geometry
0095     \details The topological dimension defines a point as 0-dimensional,
0096         a linestring as 1-dimensional,
0097         and a ring or polygon as 2-dimensional.
0098     \see http://www.math.okstate.edu/mathdept/dynamics/lecnotes/node36.html
0099     \ingroup core
0100 */
0101 template <typename Geometry>
0102 struct topological_dimension
0103     : core_dispatch::top_dim<tag_t<Geometry>> {};
0104 
0105 
0106 #ifndef BOOST_NO_CXX17_INLINE_VARIABLES
0107 template <typename Geometry>
0108 inline constexpr int topological_dimension_v = topological_dimension<Geometry>::value;
0109 #endif
0110 
0111 
0112 }} // namespace boost::geometry
0113 
0114 
0115 #endif // BOOST_GEOMETRY_CORE_TOPOLOGICAL_DIMENSION_HPP