annotate DEPENDENCIES/generic/include/boost/geometry/algorithms/clear.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@16 7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
Chris@16 8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
Chris@16 9
Chris@16 10 // Use, modification and distribution is subject to the Boost Software License,
Chris@16 11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 12 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 13
Chris@16 14 #ifndef BOOST_GEOMETRY_ALGORITHMS_CLEAR_HPP
Chris@16 15 #define BOOST_GEOMETRY_ALGORITHMS_CLEAR_HPP
Chris@16 16
Chris@16 17
Chris@101 18 #include <boost/type_traits/remove_const.hpp>
Chris@101 19
Chris@101 20 #include <boost/variant/apply_visitor.hpp>
Chris@101 21 #include <boost/variant/static_visitor.hpp>
Chris@101 22 #include <boost/variant/variant_fwd.hpp>
Chris@101 23
Chris@16 24 #include <boost/geometry/algorithms/not_implemented.hpp>
Chris@16 25 #include <boost/geometry/core/access.hpp>
Chris@16 26 #include <boost/geometry/core/exterior_ring.hpp>
Chris@16 27 #include <boost/geometry/core/interior_rings.hpp>
Chris@16 28 #include <boost/geometry/core/mutable_range.hpp>
Chris@16 29 #include <boost/geometry/core/tag_cast.hpp>
Chris@101 30 #include <boost/geometry/core/tags.hpp>
Chris@16 31 #include <boost/geometry/geometries/concepts/check.hpp>
Chris@16 32
Chris@16 33
Chris@16 34 namespace boost { namespace geometry
Chris@16 35 {
Chris@16 36
Chris@16 37 #ifndef DOXYGEN_NO_DETAIL
Chris@16 38 namespace detail { namespace clear
Chris@16 39 {
Chris@16 40
Chris@16 41 template <typename Geometry>
Chris@16 42 struct collection_clear
Chris@16 43 {
Chris@16 44 static inline void apply(Geometry& geometry)
Chris@16 45 {
Chris@16 46 traits::clear<Geometry>::apply(geometry);
Chris@16 47 }
Chris@16 48 };
Chris@16 49
Chris@16 50 template <typename Polygon>
Chris@16 51 struct polygon_clear
Chris@16 52 {
Chris@16 53 static inline void apply(Polygon& polygon)
Chris@16 54 {
Chris@16 55 traits::clear
Chris@16 56 <
Chris@16 57 typename boost::remove_reference
Chris@16 58 <
Chris@16 59 typename traits::interior_mutable_type<Polygon>::type
Chris@16 60 >::type
Chris@16 61 >::apply(interior_rings(polygon));
Chris@16 62 traits::clear
Chris@16 63 <
Chris@16 64 typename boost::remove_reference
Chris@16 65 <
Chris@16 66 typename traits::ring_mutable_type<Polygon>::type
Chris@16 67 >::type
Chris@16 68 >::apply(exterior_ring(polygon));
Chris@16 69 }
Chris@16 70 };
Chris@16 71
Chris@16 72 template <typename Geometry>
Chris@16 73 struct no_action
Chris@16 74 {
Chris@16 75 static inline void apply(Geometry& )
Chris@16 76 {
Chris@16 77 }
Chris@16 78 };
Chris@16 79
Chris@16 80
Chris@16 81 }} // namespace detail::clear
Chris@16 82 #endif // DOXYGEN_NO_DETAIL
Chris@16 83
Chris@16 84 #ifndef DOXYGEN_NO_DISPATCH
Chris@16 85 namespace dispatch
Chris@16 86 {
Chris@16 87
Chris@16 88 template
Chris@16 89 <
Chris@16 90 typename Geometry,
Chris@16 91 typename Tag = typename tag_cast<typename tag<Geometry>::type, multi_tag>::type
Chris@16 92 >
Chris@16 93 struct clear: not_implemented<Tag>
Chris@16 94 {};
Chris@16 95
Chris@16 96 // Point/box/segment do not have clear. So specialize to do nothing.
Chris@16 97 template <typename Geometry>
Chris@16 98 struct clear<Geometry, point_tag>
Chris@16 99 : detail::clear::no_action<Geometry>
Chris@16 100 {};
Chris@16 101
Chris@16 102 template <typename Geometry>
Chris@16 103 struct clear<Geometry, box_tag>
Chris@16 104 : detail::clear::no_action<Geometry>
Chris@16 105 {};
Chris@16 106
Chris@16 107 template <typename Geometry>
Chris@16 108 struct clear<Geometry, segment_tag>
Chris@16 109 : detail::clear::no_action<Geometry>
Chris@16 110 {};
Chris@16 111
Chris@16 112 template <typename Geometry>
Chris@16 113 struct clear<Geometry, linestring_tag>
Chris@16 114 : detail::clear::collection_clear<Geometry>
Chris@16 115 {};
Chris@16 116
Chris@16 117 template <typename Geometry>
Chris@16 118 struct clear<Geometry, ring_tag>
Chris@16 119 : detail::clear::collection_clear<Geometry>
Chris@16 120 {};
Chris@16 121
Chris@16 122
Chris@16 123 // Polygon can (indirectly) use std for clear
Chris@16 124 template <typename Polygon>
Chris@16 125 struct clear<Polygon, polygon_tag>
Chris@16 126 : detail::clear::polygon_clear<Polygon>
Chris@16 127 {};
Chris@16 128
Chris@16 129
Chris@16 130 template <typename Geometry>
Chris@101 131 struct clear<Geometry, multi_tag>
Chris@101 132 : detail::clear::collection_clear<Geometry>
Chris@101 133 {};
Chris@101 134
Chris@101 135
Chris@101 136 } // namespace dispatch
Chris@101 137 #endif // DOXYGEN_NO_DISPATCH
Chris@101 138
Chris@101 139
Chris@101 140 namespace resolve_variant {
Chris@101 141
Chris@101 142 template <typename Geometry>
Chris@101 143 struct clear
Chris@16 144 {
Chris@16 145 static inline void apply(Geometry& geometry)
Chris@16 146 {
Chris@101 147 dispatch::clear<Geometry>::apply(geometry);
Chris@16 148 }
Chris@16 149 };
Chris@16 150
Chris@16 151 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
Chris@101 152 struct clear<variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
Chris@16 153 {
Chris@16 154 struct visitor: static_visitor<void>
Chris@16 155 {
Chris@16 156 template <typename Geometry>
Chris@16 157 inline void operator()(Geometry& geometry) const
Chris@16 158 {
Chris@16 159 clear<Geometry>::apply(geometry);
Chris@16 160 }
Chris@16 161 };
Chris@16 162
Chris@16 163 static inline void apply(variant<BOOST_VARIANT_ENUM_PARAMS(T)>& geometry)
Chris@16 164 {
Chris@16 165 apply_visitor(visitor(), geometry);
Chris@16 166 }
Chris@16 167 };
Chris@16 168
Chris@101 169 } // namespace resolve_variant
Chris@16 170
Chris@16 171
Chris@16 172 /*!
Chris@16 173 \brief Clears a linestring, ring or polygon (exterior+interiors) or multi*
Chris@16 174 \details Generic function to clear a geometry. All points will be removed from the collection or collections
Chris@16 175 making up the geometry. In most cases this is equivalent to the .clear() method of a std::vector<...>. In
Chris@16 176 the case of a polygon, this clear functionality is automatically called for the exterior ring, and for the
Chris@16 177 interior ring collection. In the case of a point, boxes and segments, nothing will happen.
Chris@16 178 \ingroup clear
Chris@16 179 \tparam Geometry \tparam_geometry
Chris@16 180 \param geometry \param_geometry which will be cleared
Chris@16 181 \note points and boxes cannot be cleared, instead they can be set to zero by "assign_zero"
Chris@16 182
Chris@16 183 \qbk{[include reference/algorithms/clear.qbk]}
Chris@16 184 */
Chris@16 185 template <typename Geometry>
Chris@16 186 inline void clear(Geometry& geometry)
Chris@16 187 {
Chris@16 188 concept::check<Geometry>();
Chris@16 189
Chris@101 190 resolve_variant::clear<Geometry>::apply(geometry);
Chris@16 191 }
Chris@16 192
Chris@16 193
Chris@16 194 }} // namespace boost::geometry
Chris@16 195
Chris@16 196
Chris@16 197 #endif // BOOST_GEOMETRY_ALGORITHMS_CLEAR_HPP