File indexing completed on 2025-01-18 09:35:26
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_HOLE_ITERATOR_HPP
0010 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_HOLE_ITERATOR_HPP
0011
0012
0013
0014
0015
0016 #include <boost/polygon/polygon.hpp>
0017
0018 #include <boost/iterator/iterator_facade.hpp>
0019
0020
0021 namespace boost { namespace geometry
0022 {
0023
0024 namespace adapt { namespace bp
0025 {
0026
0027
0028 template <typename Polygon, typename RingProxy>
0029 class hole_iterator
0030 : public ::boost::iterator_facade
0031 <
0032 hole_iterator<Polygon, RingProxy>,
0033 RingProxy,
0034 boost::forward_traversal_tag,
0035 RingProxy
0036 >
0037 {
0038 public :
0039 typedef typename boost::polygon::polygon_with_holes_traits
0040 <
0041 Polygon
0042 >::iterator_holes_type ith_type;
0043
0044 explicit inline hole_iterator(Polygon& polygon, ith_type const it)
0045 : m_polygon(polygon)
0046 , m_base(it)
0047 {
0048 }
0049
0050 typedef std::ptrdiff_t difference_type;
0051
0052 private:
0053 friend class boost::iterator_core_access;
0054
0055 inline RingProxy dereference() const
0056 {
0057 return RingProxy(m_polygon, this->m_base);
0058 }
0059
0060 inline void increment() { ++m_base; }
0061 inline void decrement() { --m_base; }
0062 inline void advance(difference_type n)
0063 {
0064 for (int i = 0; i < n; i++)
0065 {
0066 ++m_base;
0067 }
0068 }
0069
0070 inline bool equal(hole_iterator<Polygon, RingProxy> const& other) const
0071 {
0072 return this->m_base == other.m_base;
0073 }
0074
0075 Polygon& m_polygon;
0076 ith_type m_base;
0077 };
0078
0079
0080 }}}}
0081
0082 #endif
0083