annotate DEPENDENCIES/generic/include/boost/geometry/core/closure.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 // Boost.Geometry (aka GGL, Generic Geometry Library)
Chris@16 2
Chris@16 3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
Chris@16 4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
Chris@16 5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Chris@16 6
Chris@101 7 // This file was modified by Oracle on 2014.
Chris@101 8 // Modifications copyright (c) 2014 Oracle and/or its affiliates.
Chris@101 9
Chris@101 10 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
Chris@101 11
Chris@16 12 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
Chris@16 13 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
Chris@16 14
Chris@16 15 // Use, modification and distribution is subject to the Boost Software License,
Chris@16 16 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 17 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 18
Chris@16 19 #ifndef BOOST_GEOMETRY_CORE_CLOSURE_HPP
Chris@16 20 #define BOOST_GEOMETRY_CORE_CLOSURE_HPP
Chris@16 21
Chris@16 22 #include <boost/mpl/assert.hpp>
Chris@101 23 #include <boost/mpl/size_t.hpp>
Chris@101 24 #include <boost/range/value_type.hpp>
Chris@16 25 #include <boost/type_traits/remove_const.hpp>
Chris@16 26
Chris@16 27 #include <boost/geometry/core/ring_type.hpp>
Chris@16 28 #include <boost/geometry/core/tag.hpp>
Chris@16 29 #include <boost/geometry/core/tags.hpp>
Chris@16 30
Chris@16 31 namespace boost { namespace geometry
Chris@16 32 {
Chris@16 33
Chris@16 34
Chris@16 35 /*!
Chris@16 36 \brief Enumerates options for defining if polygons are open or closed
Chris@16 37 \ingroup enum
Chris@16 38 \details The enumeration closure_selector describes options for if a polygon is
Chris@101 39 open or closed. In a closed polygon the very first point (per ring) should
Chris@16 40 be equal to the very last point.
Chris@101 41 The specific closing property of a polygon type is defined by the closure
Chris@101 42 metafunction. The closure metafunction defines a value, which is one of the
Chris@16 43 values enumerated in the closure_selector
Chris@16 44
Chris@16 45 \qbk{
Chris@16 46 [heading See also]
Chris@16 47 [link geometry.reference.core.closure The closure metafunction]
Chris@16 48 }
Chris@16 49 */
Chris@16 50 enum closure_selector
Chris@16 51 {
Chris@101 52 /// Rings are open: first point and last point are different, algorithms
Chris@16 53 /// close them explicitly on the fly
Chris@16 54 open = 0,
Chris@16 55 /// Rings are closed: first point and last point must be the same
Chris@16 56 closed = 1,
Chris@101 57 /// (Not yet implemented): algorithms first figure out if ring must be
Chris@16 58 /// closed on the fly
Chris@16 59 closure_undertermined = -1
Chris@16 60 };
Chris@16 61
Chris@16 62 namespace traits
Chris@16 63 {
Chris@16 64
Chris@16 65 /*!
Chris@16 66 \brief Traits class indicating if points within a
Chris@16 67 ring or (multi)polygon are closed (last point == first point),
Chris@16 68 open or not known.
Chris@16 69 \ingroup traits
Chris@16 70 \par Geometries:
Chris@16 71 - ring
Chris@16 72 \tparam G geometry
Chris@16 73 */
Chris@16 74 template <typename G>
Chris@16 75 struct closure
Chris@16 76 {
Chris@16 77 static const closure_selector value = closed;
Chris@16 78 };
Chris@16 79
Chris@16 80
Chris@16 81 } // namespace traits
Chris@16 82
Chris@16 83
Chris@16 84 #ifndef DOXYGEN_NO_DETAIL
Chris@16 85 namespace core_detail { namespace closure
Chris@16 86 {
Chris@16 87
Chris@16 88 struct closed
Chris@16 89 {
Chris@16 90 static const closure_selector value = geometry::closed;
Chris@16 91 };
Chris@16 92
Chris@16 93
Chris@16 94 /// Metafunction to define the minimum size of a ring:
Chris@16 95 /// 3 for open rings, 4 for closed rings
Chris@16 96 template <closure_selector Closure>
Chris@16 97 struct minimum_ring_size {};
Chris@16 98
Chris@16 99 template <>
Chris@101 100 struct minimum_ring_size<geometry::closed> : boost::mpl::size_t<4> {};
Chris@16 101
Chris@16 102 template <>
Chris@101 103 struct minimum_ring_size<geometry::open> : boost::mpl::size_t<3> {};
Chris@16 104
Chris@16 105
Chris@16 106 }} // namespace detail::point_order
Chris@16 107 #endif // DOXYGEN_NO_DETAIL
Chris@16 108
Chris@16 109
Chris@16 110
Chris@16 111 #ifndef DOXYGEN_NO_DISPATCH
Chris@16 112 namespace core_dispatch
Chris@16 113 {
Chris@16 114
Chris@16 115 template <typename Tag, typename Geometry>
Chris@16 116 struct closure
Chris@16 117 {
Chris@16 118 BOOST_MPL_ASSERT_MSG
Chris@16 119 (
Chris@16 120 false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
Chris@16 121 , (types<Geometry>)
Chris@16 122 );
Chris@16 123 };
Chris@16 124
Chris@16 125 template <typename Box>
Chris@16 126 struct closure<point_tag, Box> : public core_detail::closure::closed {};
Chris@16 127
Chris@16 128 template <typename Box>
Chris@16 129 struct closure<box_tag, Box> : public core_detail::closure::closed {};
Chris@16 130
Chris@16 131 template <typename Box>
Chris@16 132 struct closure<segment_tag, Box> : public core_detail::closure::closed {};
Chris@16 133
Chris@16 134 template <typename LineString>
Chris@101 135 struct closure<linestring_tag, LineString>
Chris@16 136 : public core_detail::closure::closed {};
Chris@16 137
Chris@16 138
Chris@16 139 template <typename Ring>
Chris@16 140 struct closure<ring_tag, Ring>
Chris@16 141 {
Chris@101 142 static const closure_selector value
Chris@16 143 = geometry::traits::closure<Ring>::value;
Chris@16 144 };
Chris@16 145
Chris@101 146 // Specialization for Polygon: the closure is the closure of its rings
Chris@16 147 template <typename Polygon>
Chris@16 148 struct closure<polygon_tag, Polygon>
Chris@16 149 {
Chris@16 150 static const closure_selector value = core_dispatch::closure
Chris@16 151 <
Chris@16 152 ring_tag,
Chris@16 153 typename ring_type<polygon_tag, Polygon>::type
Chris@16 154 >::value ;
Chris@16 155 };
Chris@16 156
Chris@101 157 template <typename MultiPoint>
Chris@101 158 struct closure<multi_point_tag, MultiPoint>
Chris@101 159 : public core_detail::closure::closed {};
Chris@101 160
Chris@101 161 template <typename MultiLinestring>
Chris@101 162 struct closure<multi_linestring_tag, MultiLinestring>
Chris@101 163 : public core_detail::closure::closed {};
Chris@101 164
Chris@101 165 // Specialization for MultiPolygon: the closure is the closure of Polygon's rings
Chris@101 166 template <typename MultiPolygon>
Chris@101 167 struct closure<multi_polygon_tag, MultiPolygon>
Chris@101 168 {
Chris@101 169 static const closure_selector value = core_dispatch::closure
Chris@101 170 <
Chris@101 171 polygon_tag,
Chris@101 172 typename boost::range_value<MultiPolygon>::type
Chris@101 173 >::value ;
Chris@101 174 };
Chris@16 175
Chris@16 176 } // namespace core_dispatch
Chris@16 177 #endif // DOXYGEN_NO_DISPATCH
Chris@16 178
Chris@16 179
Chris@16 180 /*!
Chris@101 181 \brief \brief_meta{value, closure (clockwise\, counterclockwise),
Chris@16 182 \meta_geometry_type}
Chris@16 183 \tparam Geometry \tparam_geometry
Chris@16 184 \ingroup core
Chris@16 185
Chris@16 186 \qbk{[include reference/core/closure.qbk]}
Chris@16 187 */
Chris@16 188 template <typename Geometry>
Chris@16 189 struct closure
Chris@16 190 {
Chris@16 191 static const closure_selector value = core_dispatch::closure
Chris@16 192 <
Chris@16 193 typename tag<Geometry>::type,
Chris@101 194 typename util::bare_type<Geometry>::type
Chris@16 195 >::value;
Chris@16 196 };
Chris@16 197
Chris@16 198
Chris@16 199 }} // namespace boost::geometry
Chris@16 200
Chris@16 201
Chris@16 202 #endif // BOOST_GEOMETRY_CORE_CLOSURE_HPP