Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:24

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