|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67181 - sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon
From: barend.gehrels_at_[hidden]
Date: 2010-12-12 05:45:47
Author: barendgehrels
Date: 2010-12-12 05:45:36 EST (Sun, 12 Dec 2010)
New Revision: 67181
URL: http://svn.boost.org/trac/boost/changeset/67181
Log:
Clean up / renaming / adding namespace / etc in bp adaption
Added:
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/hole_iterator.hpp
- copied, changed from r67178, /sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/iterator.hpp
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/holes_proxy.hpp
- copied, changed from r67178, /sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/interior_rings.hpp
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp
- copied, changed from r67178, /sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring_type.hpp
Removed:
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/interior_rings.hpp
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/iterator.hpp
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring_type.hpp
Text files modified:
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/box.hpp | 59 ++++++++++++++-----
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/hole_iterator.hpp | 51 ++++++++++-------
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/holes_proxy.hpp | 87 +++++++++++++++++------------
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/point.hpp | 28 +++++----
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/polygon.hpp | 40 +++++--------
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring.hpp | 46 +++++++--------
sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp | 115 ++++++++++++++++++++++-----------------
7 files changed, 242 insertions(+), 184 deletions(-)
Modified: sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/box.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/box.hpp (original)
+++ sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/box.hpp 2010-12-12 05:45:36 EST (Sun, 12 Dec 2010)
@@ -8,8 +8,9 @@
#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_BOX_HPP
#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_BOX_HPP
+// Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
+// boost::polygon::rectangle_data -> boost::geometry::box
-#include <cstddef>
#include <boost/polygon/polygon.hpp>
@@ -19,7 +20,6 @@
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/tags.hpp>
-#include <boost/polygon/polygon.hpp>
namespace boost { namespace geometry
{
@@ -30,13 +30,13 @@
{
-
template <typename CoordinateType>
struct tag<boost::polygon::rectangle_data<CoordinateType> >
{
typedef box_tag type;
};
+
template <typename CoordinateType>
struct point_type<boost::polygon::rectangle_data<CoordinateType> >
{
@@ -45,15 +45,22 @@
typedef boost::polygon::point_data<CoordinateType> type;
};
+
template <typename CoordinateType>
-struct indexed_access<boost::polygon::rectangle_data<CoordinateType>, min_corner, 0>
+struct indexed_access
+<
+ boost::polygon::rectangle_data<CoordinateType>,
+ min_corner, 0
+>
{
- static inline CoordinateType get(boost::polygon::rectangle_data<CoordinateType> const& b)
+ typedef boost::polygon::rectangle_data<CoordinateType> box_type;
+
+ static inline CoordinateType get(box_type const& b)
{
return boost::polygon::xl(b);
}
- static inline void set(boost::polygon::rectangle_data<CoordinateType>& b, CoordinateType const& value)
+ static inline void set(box_type& b, CoordinateType const& value)
{
boost::polygon::xl(b, value);
}
@@ -61,42 +68,62 @@
template <typename CoordinateType>
-struct indexed_access<boost::polygon::rectangle_data<CoordinateType>, min_corner, 1>
+struct indexed_access
+<
+ boost::polygon::rectangle_data<CoordinateType>,
+ min_corner, 1
+>
{
- static inline CoordinateType get(boost::polygon::rectangle_data<CoordinateType> const& b)
+ typedef boost::polygon::rectangle_data<CoordinateType> box_type;
+
+ static inline CoordinateType get(box_type const& b)
{
return boost::polygon::yl(b);
}
- static inline void set(boost::polygon::rectangle_data<CoordinateType>& b, CoordinateType const& value)
+ static inline void set(box_type& b, CoordinateType const& value)
{
boost::polygon::yl(b, value);
}
};
+
template <typename CoordinateType>
-struct indexed_access<boost::polygon::rectangle_data<CoordinateType>, max_corner, 0>
+struct indexed_access
+<
+ boost::polygon::rectangle_data<CoordinateType>,
+ max_corner, 0
+>
{
- static inline CoordinateType get(boost::polygon::rectangle_data<CoordinateType> const& b)
+ typedef boost::polygon::rectangle_data<CoordinateType> box_type;
+
+ static inline CoordinateType get(box_type const& b)
{
return boost::polygon::xh(b);
}
- static inline void set(boost::polygon::rectangle_data<CoordinateType>& b, CoordinateType const& value)
+ static inline void set(box_type& b, CoordinateType const& value)
{
boost::polygon::xh(b, value);
}
};
+
template <typename CoordinateType>
-struct indexed_access<boost::polygon::rectangle_data<CoordinateType>, max_corner, 1>
+struct indexed_access
+<
+ boost::polygon::rectangle_data<CoordinateType>,
+ max_corner, 1
+>
{
- static inline CoordinateType get(boost::polygon::rectangle_data<CoordinateType> const& b)
+ typedef boost::polygon::rectangle_data<CoordinateType> box_type;
+
+ static inline CoordinateType get(box_type const& b)
{
return boost::polygon::yh(b);
}
- static inline void set(boost::polygon::rectangle_data<CoordinateType>& b, CoordinateType const& value)
+ static inline void set(box_type& b, CoordinateType const& value)
{
boost::polygon::yh(b, value);
}
@@ -109,5 +136,5 @@
}} // namespace boost::geometry
-#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_BOX_HPP
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_BOX_HPP
Copied: sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/hole_iterator.hpp (from r67178, /sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/iterator.hpp)
==============================================================================
--- /sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/iterator.hpp (original)
+++ sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/hole_iterator.hpp 2010-12-12 05:45:36 EST (Sun, 12 Dec 2010)
@@ -5,63 +5,72 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_ITERATOR_HPP
-#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_ITERATOR_HPP
+#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_HOLE_ITERATOR_HPP
+#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_HOLE_ITERATOR_HPP
+
+// Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
+// boost::polygon::polygon_with_holes_data -> boost::geometry::polygon
+// hole_iterator -> returning ring_proxy's instead of normal polygon_data
+
+#include <boost/polygon/polygon.hpp>
#include <boost/iterator.hpp>
#include <boost/iterator/iterator_facade.hpp>
+namespace boost { namespace geometry
+{
+
+namespace adapt { namespace bp
+{
+
-// ring iterator -> iterating over holes, delivering bp_ring's instead of normal polygon_data
template <typename Polygon, typename Ring>
-class bp_iterator
- : public boost::iterator_facade
+class hole_iterator
+ : public ::boost::iterator_facade
<
- bp_iterator<Polygon, Ring>,
- Ring, // its value type
- boost::random_access_traversal_tag,
- Ring // its reference type
+ hole_iterator<Polygon, Ring>,
+ Ring, // value type
+ boost::forward_traversal_tag,
+ Ring // reference type
>
{
public :
typedef typename boost::polygon::polygon_with_holes_traits
<
Polygon
- >::iterator_holes_type it_type;
+ >::iterator_holes_type ith_type;
- explicit inline bp_iterator(it_type& it)
+ explicit inline hole_iterator(ith_type const it)
: m_base(it)
{
}
- explicit inline bp_iterator()
- {
- //throw std::string("Constructed by default!");
- }
-
+ typedef std::ptrdiff_t difference_type;
private:
friend class boost::iterator_core_access;
+ // Return a ring_proxy by value
inline Ring dereference() const
{
return Ring(*this->m_base);
}
-
inline void increment() { ++m_base; }
inline void decrement() { --m_base; }
inline void advance(difference_type n) { m_base += n; }
- inline bool equal(bp_iterator<Polygon, Ring> const& other) const
+ inline bool equal(hole_iterator<Polygon, Ring> const& other) const
{
return this->m_base == other.m_base;
}
- it_type m_base;
-
+ ith_type m_base;
};
-#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_ITERATOR_HPP
+
+}}}}
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_HOLE_ITERATOR_HPP
Copied: sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/holes_proxy.hpp (from r67178, /sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/interior_rings.hpp)
==============================================================================
--- /sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/interior_rings.hpp (original)
+++ sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/holes_proxy.hpp 2010-12-12 05:45:36 EST (Sun, 12 Dec 2010)
@@ -5,77 +5,92 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_INTERIORS_RINGS_HPP
-#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_INTERIORS_RINGS_HPP
+#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_HOLES_PROXY_HPP
+#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_HOLES_PROXY_HPP
+
+// Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
+// boost::polygon::polygon_with_holes_data -> boost::geometry::polygon
+// pair{begin_holes, begin_holes} -> interior_proxy
#include <boost/polygon/polygon.hpp>
-// bp_interiors -> proxy for interior_type, range-of-rings or range-of-ranges
+namespace boost { namespace geometry
+{
+
+namespace adapt { namespace bp
+{
+
+
template<typename Polygon>
-struct bp_interiors
+struct holes_proxy
{
typedef typename boost::polygon::polygon_traits<Polygon>::coordinate_type coordinate_type;
typedef boost::polygon::polygon_data<coordinate_type> Ring;
- typedef bp_iterator<Polygon, Ring> iterator_type;
+ typedef hole_iterator<Polygon, Ring> iterator_type;
- inline bp_interiors(Polygon const& p)
+ inline holes_proxy(Polygon const& p)
+ : first(iterator_type(boost::polygon::begin_holes(p)))
+ , second(iterator_type(boost::polygon::end_holes(p)))
{
- this->first = iterator_type(boost::polygon::begin_holes(p));
- this->second = iterator_type(boost::polygon::end_holes(p));
}
- //void resize(int n) {}
- //bp_ring<Polygon>& back() {}
-
iterator_type first, second;
};
-// 2. iterators, adapt Boost.Polygon to Boost.Range
-namespace boost
-{
- template<typename Polygon>
- struct range_iterator<bp_interiors<Polygon> >
- {
- typedef typename bp_interiors<Polygon>::iterator_type type;
- };
-
- template<typename Polygon>
- struct range_const_iterator<bp_interiors<Polygon> >
- {
- typedef typename bp_interiors<Polygon>::iterator_type type;
- };
-
-
-} // namespace 'boost'
-
-
-// 2b. free-standing function for Boost.Range ADP
+// Support holes_proxy for Boost.Range ADP
template<typename Polygon>
-inline typename bp_interiors<Polygon>::iterator_type range_begin(bp_interiors<Polygon>& ring)
+inline typename boost::geometry::adapt::bp::holes_proxy<Polygon>::iterator_type
+ range_begin(boost::geometry::adapt::bp::holes_proxy<Polygon>& ring)
{
return ring.first;
}
template<typename Polygon>
-inline typename bp_interiors<Polygon>::iterator_type range_begin(bp_interiors<Polygon> const& ring)
+inline typename boost::geometry::adapt::bp::holes_proxy<Polygon>::iterator_type
+ range_begin(boost::geometry::adapt::bp::holes_proxy<Polygon> const& ring)
{
return ring.first;
}
template<typename Polygon>
-inline typename bp_interiors<Polygon>::iterator_type range_end(bp_interiors<Polygon>& ring)
+inline typename boost::geometry::adapt::bp::holes_proxy<Polygon>::iterator_type
+ range_end(boost::geometry::adapt::bp::holes_proxy<Polygon>& ring)
{
return ring.second;
}
template<typename Polygon>
-inline typename bp_interiors<Polygon>::iterator_type range_end(bp_interiors<Polygon> const& ring)
+inline typename boost::geometry::adapt::bp::holes_proxy<Polygon>::iterator_type
+ range_end(boost::geometry::adapt::bp::holes_proxy<Polygon> const& ring)
{
return ring.second;
}
-#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_INTERIORS_RINGS_HPP
+}}}}
+
+
+// Specialize holes_proxy for Boost.Range
+namespace boost
+{
+ template<typename Polygon>
+ struct range_iterator<geometry::adapt::bp::holes_proxy<Polygon> >
+ {
+ typedef typename geometry::adapt::bp::holes_proxy<Polygon>::iterator_type type;
+ };
+
+ template<typename Polygon>
+ struct range_const_iterator<geometry::adapt::bp::holes_proxy<Polygon> >
+ {
+ typedef typename geometry::adapt::bp::holes_proxy<Polygon>::iterator_type type;
+ };
+
+
+} // namespace boost
+
+
+
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_HOLES_PROXY_HPP
Deleted: sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/interior_rings.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/interior_rings.hpp 2010-12-12 05:45:36 EST (Sun, 12 Dec 2010)
+++ (empty file)
@@ -1,81 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Copyright Barend Gehrels 2010, Geodan, Amsterdam, the Netherlands.
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_INTERIORS_RINGS_HPP
-#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_INTERIORS_RINGS_HPP
-
-#include <boost/polygon/polygon.hpp>
-
-
-// bp_interiors -> proxy for interior_type, range-of-rings or range-of-ranges
-template<typename Polygon>
-struct bp_interiors
-{
- typedef typename boost::polygon::polygon_traits<Polygon>::coordinate_type coordinate_type;
- typedef boost::polygon::polygon_data<coordinate_type> Ring;
- typedef bp_iterator<Polygon, Ring> iterator_type;
-
-
- inline bp_interiors(Polygon const& p)
- {
- this->first = iterator_type(boost::polygon::begin_holes(p));
- this->second = iterator_type(boost::polygon::end_holes(p));
- }
-
- //void resize(int n) {}
- //bp_ring<Polygon>& back() {}
-
- iterator_type first, second;
-};
-
-
-// 2. iterators, adapt Boost.Polygon to Boost.Range
-namespace boost
-{
- template<typename Polygon>
- struct range_iterator<bp_interiors<Polygon> >
- {
- typedef typename bp_interiors<Polygon>::iterator_type type;
- };
-
- template<typename Polygon>
- struct range_const_iterator<bp_interiors<Polygon> >
- {
- typedef typename bp_interiors<Polygon>::iterator_type type;
- };
-
-
-} // namespace 'boost'
-
-
-// 2b. free-standing function for Boost.Range ADP
-template<typename Polygon>
-inline typename bp_interiors<Polygon>::iterator_type range_begin(bp_interiors<Polygon>& ring)
-{
- return ring.first;
-}
-
-template<typename Polygon>
-inline typename bp_interiors<Polygon>::iterator_type range_begin(bp_interiors<Polygon> const& ring)
-{
- return ring.first;
-}
-
-template<typename Polygon>
-inline typename bp_interiors<Polygon>::iterator_type range_end(bp_interiors<Polygon>& ring)
-{
- return ring.second;
-}
-
-template<typename Polygon>
-inline typename bp_interiors<Polygon>::iterator_type range_end(bp_interiors<Polygon> const& ring)
-{
- return ring.second;
-}
-
-#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_INTERIORS_RINGS_HPP
-
Deleted: sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/iterator.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/iterator.hpp 2010-12-12 05:45:36 EST (Sun, 12 Dec 2010)
+++ (empty file)
@@ -1,67 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Copyright Barend Gehrels 2010, Geodan, Amsterdam, the Netherlands.
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_ITERATOR_HPP
-#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_ITERATOR_HPP
-
-#include <boost/iterator.hpp>
-#include <boost/iterator/iterator_facade.hpp>
-
-
-
-// ring iterator -> iterating over holes, delivering bp_ring's instead of normal polygon_data
-template <typename Polygon, typename Ring>
-class bp_iterator
- : public boost::iterator_facade
- <
- bp_iterator<Polygon, Ring>,
- Ring, // its value type
- boost::random_access_traversal_tag,
- Ring // its reference type
- >
-{
-public :
- typedef typename boost::polygon::polygon_with_holes_traits
- <
- Polygon
- >::iterator_holes_type it_type;
-
- explicit inline bp_iterator(it_type& it)
- : m_base(it)
- {
- }
-
- explicit inline bp_iterator()
- {
- //throw std::string("Constructed by default!");
- }
-
-
-private:
- friend class boost::iterator_core_access;
-
- inline Ring dereference() const
- {
- return Ring(*this->m_base);
- }
-
-
- inline void increment() { ++m_base; }
- inline void decrement() { --m_base; }
- inline void advance(difference_type n) { m_base += n; }
-
- inline bool equal(bp_iterator<Polygon, Ring> const& other) const
- {
- return this->m_base == other.m_base;
- }
-
- it_type m_base;
-
-};
-
-#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_ITERATOR_HPP
-
Modified: sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/point.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/point.hpp (original)
+++ sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/point.hpp 2010-12-12 05:45:36 EST (Sun, 12 Dec 2010)
@@ -8,8 +8,9 @@
#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POINT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POINT_HPP
+// Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
+// boost::polygon::point_data -> boost::geometry::point
-#include <cstddef>
#include <boost/polygon/polygon.hpp>
@@ -19,7 +20,6 @@
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/tags.hpp>
-#include <boost/polygon/polygon.hpp>
namespace boost { namespace geometry
{
@@ -30,8 +30,6 @@
{
-
-// Assign the point-tag, preventing arrays of points getting a point-tag
template <typename CoordinateType>
struct tag<boost::polygon::point_data<CoordinateType> >
{
@@ -45,6 +43,7 @@
typedef CoordinateType type;
};
+
template <typename CoordinateType>
struct coordinate_system<boost::polygon::point_data<CoordinateType> >
{
@@ -53,34 +52,39 @@
template <typename CoordinateType>
-struct dimension<boost::polygon::point_data<CoordinateType> >: boost::mpl::int_<2> {};
+struct dimension<boost::polygon::point_data<CoordinateType> >
+ : boost::mpl::int_<2>
+{};
template <typename CoordinateType>
struct access<boost::polygon::point_data<CoordinateType>, 0>
{
- static inline CoordinateType get(boost::polygon::point_data<CoordinateType> const& p)
+ typedef boost::polygon::point_data<CoordinateType> point_type;
+
+ static inline CoordinateType get(point_type const& p)
{
return p.x();
}
- static inline void set(boost::polygon::point_data<CoordinateType>& p,
- CoordinateType const& value)
+ static inline void set(point_type& p, CoordinateType const& value)
{
p.x(value);
}
};
+
template <typename CoordinateType>
struct access<boost::polygon::point_data<CoordinateType>, 1>
{
- static inline CoordinateType get(boost::polygon::point_data<CoordinateType> const& p)
+ typedef boost::polygon::point_data<CoordinateType> point_type;
+
+ static inline CoordinateType get(point_type const& p)
{
return p.y();
}
- static inline void set(boost::polygon::point_data<CoordinateType>& p,
- CoordinateType const& value)
+ static inline void set(point_type& p, CoordinateType const& value)
{
p.y(value);
}
@@ -93,5 +97,5 @@
}} // namespace boost::geometry
-#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POINT_HPP
+#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POINT_HPP
Modified: sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/polygon.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/polygon.hpp (original)
+++ sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/polygon.hpp 2010-12-12 05:45:36 EST (Sun, 12 Dec 2010)
@@ -11,22 +11,16 @@
// Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
// boost::polygon::polygon_with_holes_data -> boost::geometry::polygon
-
-#include <cstddef>
-
-
+#include <boost/polygon/polygon.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
-#include <boost/polygon/polygon.hpp>
-
-
-#include <boost/geometry/geometries/adapted/boost_polygon/ring_type.hpp>
-#include <boost/geometry/geometries/adapted/boost_polygon/iterator.hpp>
-#include <boost/geometry/geometries/adapted/boost_polygon/interior_rings.hpp>
+#include <boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp>
+#include <boost/geometry/geometries/adapted/boost_polygon/hole_iterator.hpp>
+#include <boost/geometry/geometries/adapted/boost_polygon/holes_proxy.hpp>
namespace boost { namespace geometry
@@ -48,16 +42,14 @@
template <typename CoordinateType>
struct ring_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
{
- typedef bp_ring<boost::polygon::polygon_data<CoordinateType> > type;
+ typedef adapt::bp::ring_proxy<boost::polygon::polygon_data<CoordinateType> > type;
};
template <typename CoordinateType>
struct interior_type<boost::polygon::polygon_with_holes_data<CoordinateType> >
{
- // TEMPORARY! This meta-function will be removed, because it is always used in
- // the concept of "range-iterator<interior_type>" so it should define the range-iterator
- typedef typename bp_interiors<boost::polygon::polygon_with_holes_data<CoordinateType> > type;
+ typedef adapt::bp::holes_proxy<boost::polygon::polygon_with_holes_data<CoordinateType> > type;
};
@@ -65,16 +57,16 @@
struct exterior_ring<boost::polygon::polygon_with_holes_data<CoordinateType> >
{
typedef boost::polygon::polygon_with_holes_data<CoordinateType> polygon_type;
- typedef bp_ring<boost::polygon::polygon_data<CoordinateType> > r_type;
+ typedef adapt::bp::ring_proxy<boost::polygon::polygon_data<CoordinateType> > proxy;
- static inline r_type get(polygon_type& p)
+ static inline proxy get(polygon_type& p)
{
- return r_type(p);
+ return proxy(boost::polygon::begin_points(p), boost::polygon::end_points(p));
}
- static inline r_type get(polygon_type const& p)
+ static inline proxy get(polygon_type const& p)
{
- return r_type(p);
+ return proxy(boost::polygon::begin_points(p), boost::polygon::end_points(p));
}
};
@@ -82,16 +74,16 @@
struct interior_rings<boost::polygon::polygon_with_holes_data<CoordinateType> >
{
typedef boost::polygon::polygon_with_holes_data<CoordinateType> polygon_type;
- typedef typename bp_interiors<polygon_type> itype;
+ typedef adapt::bp::holes_proxy<polygon_type> proxy;
- static inline itype get(polygon_type& p)
+ static inline proxy get(polygon_type& p)
{
- return bp_interiors<polygon_type>(p);
+ return proxy(p);
}
- static inline typename itype const get(polygon_type const& p)
+ static inline proxy get(polygon_type const& p)
{
- return bp_interiors<polygon_type>(p);
+ return proxy(p);
}
};
Modified: sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring.hpp (original)
+++ sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring.hpp 2010-12-12 05:45:36 EST (Sun, 12 Dec 2010)
@@ -12,7 +12,7 @@
// boost::polygon::polygon_data -> boost::geometry::ring
#include <cstddef>
-
+#include <boost/polygon/polygon.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/cs.hpp>
@@ -20,7 +20,6 @@
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/tags.hpp>
-#include <boost/polygon/polygon.hpp>
namespace boost { namespace geometry
{
@@ -30,6 +29,7 @@
namespace traits
{
+
template <typename CoordinateType>
struct tag<boost::polygon::polygon_data<CoordinateType> >
{
@@ -44,12 +44,7 @@
}} // namespace boost::geometry
-
-// ----------------------------------------------------------------------------
-// Boost.Polygon's polygon is not Boost.Range compatible
-// So support below
-// ----------------------------------------------------------------------------
-
+// Adapt Boost.Polygon's polygon_data to Boost.Range
namespace boost
{
template<typename CoordinateType>
@@ -77,53 +72,56 @@
typedef std::size_t type;
};
-} // namespace 'boost'
+} // namespace boost
+
+// Support Boost.Polygon's polygon_data for Boost.Range ADP
+namespace boost { namespace polygon
+{
-// Free-standing function for Boost.Range ADP
template<typename CoordinateType>
-inline typename boost::polygon::polygon_traits
+inline typename polygon_traits
<
- boost::polygon::polygon_data<CoordinateType>
- >::iterator_type range_begin(boost::polygon::polygon_data<CoordinateType>& polygon)
+ polygon_data<CoordinateType>
+ >::iterator_type range_begin(polygon_data<CoordinateType>& polygon)
{
return polygon.begin();
}
template<typename CoordinateType>
-inline typename boost::polygon::polygon_traits
+inline typename polygon_traits
<
- boost::polygon::polygon_data<CoordinateType>
- >::iterator_type range_begin(boost::polygon::polygon_data<CoordinateType> const& polygon)
+ polygon_data<CoordinateType>
+ >::iterator_type range_begin(polygon_data<CoordinateType> const& polygon)
{
return polygon.begin();
}
template<typename CoordinateType>
-inline typename boost::polygon::polygon_traits
+inline typename polygon_traits
<
- boost::polygon::polygon_data<CoordinateType>
- >::iterator_type range_end(boost::polygon::polygon_data<CoordinateType>& polygon)
+ polygon_data<CoordinateType>
+ >::iterator_type range_end(polygon_data<CoordinateType>& polygon)
{
return polygon.end();
}
template<typename CoordinateType>
-inline typename boost::polygon::polygon_traits
+inline typename polygon_traits
<
- boost::polygon::polygon_data<CoordinateType>
- >::iterator_type range_end(boost::polygon::polygon_data<CoordinateType> const& polygon)
+ polygon_data<CoordinateType>
+ >::iterator_type range_end(polygon_data<CoordinateType> const& polygon)
{
return polygon.end();
}
// RangeEx
template<typename CoordinateType>
-inline std::size_t range_size(boost::polygon::polygon_data<CoordinateType> const& polygon)
+inline std::size_t range_size(polygon_data<CoordinateType> const& polygon)
{
return polygon.size();
}
+}}
#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_RING_HPP
-
Copied: sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp (from r67178, /sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring_type.hpp)
==============================================================================
--- /sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring_type.hpp (original)
+++ sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp 2010-12-12 05:45:36 EST (Sun, 12 Dec 2010)
@@ -9,96 +9,109 @@
#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_RING_PROXY_HPP
// Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
+// boost::polygon::polygon_with_holes_data -> boost::geometry::polygon
+// pair{begin_points, end_points} -> ring_proxy
-#include <boost/range.hpp>
#include <boost/polygon/polygon.hpp>
+#include <boost/range.hpp>
-// bp_ring -> proxy for ring
-// Polygon should be a "polygon_data" here; NOT polygon_with_holes_data
-// TODO: there should probably be a namespace here. boost::geometry::bp ?
+namespace boost { namespace geometry
+{
-template<typename Polygon>
-struct bp_ring : public std::pair<typename Polygon::iterator_type, typename Polygon::iterator_type>
+namespace adapt { namespace bp
{
- typedef boost::polygon::polygon_traits<Polygon> traits;
- typedef typename traits::coordinate_type coordinate_type;
- typedef typename traits::iterator_type iterator_type;
- inline bp_ring(Polygon const& p)
+
+// Polygon should be a "polygon_data" here; NOT polygon_with_holes_data
+template<typename Polygon>
+struct ring_proxy
+{
+ typedef typename boost::polygon::polygon_traits
+ <
+ Polygon
+ >::iterator_type iterator_type;
+
+ inline ring_proxy(Polygon const& p)
+ : first(boost::polygon::begin_points(p))
+ , second(boost::polygon::end_points(p))
{
- this->first = boost::polygon::begin_points(p);
- this->second = boost::polygon::end_points(p);
}
- inline bp_ring(boost::polygon::polygon_with_holes_data<coordinate_type> const& p)
+ inline ring_proxy(iterator_type begin, iterator_type end)
+ : first(begin)
+ , second(end)
{
- this->first = boost::polygon::begin_points(p);
- this->second = boost::polygon::end_points(p);
}
+
+ iterator_type first, second;
};
-namespace boost { namespace geometry
+// Support geometry::adapt::bp::ring_proxy for Boost.Range ADP
+template<typename Polygon>
+inline typename boost::geometry::adapt::bp::ring_proxy<Polygon>::iterator_type
+ range_begin(boost::geometry::adapt::bp::ring_proxy<Polygon>& ring)
+{
+ return ring.first;
+}
+
+template<typename Polygon>
+inline typename boost::geometry::adapt::bp::ring_proxy<Polygon>::iterator_type
+ range_begin(boost::geometry::adapt::bp::ring_proxy<Polygon> const& ring)
+{
+ return ring.first;
+}
+
+template<typename Polygon>
+inline typename boost::geometry::adapt::bp::ring_proxy<Polygon>::iterator_type
+ range_end(boost::geometry::adapt::bp::ring_proxy<Polygon>& ring)
{
+ return ring.second;
+}
+
+template<typename Polygon>
+inline typename boost::geometry::adapt::bp::ring_proxy<Polygon>::iterator_type
+ range_end(boost::geometry::adapt::bp::ring_proxy<Polygon> const& ring)
+{
+ return ring.second;
+}
+
+
+}} // namespace adapt::bp
+
namespace traits
{
template <typename Polygon>
-struct tag<bp_ring<Polygon> >
+struct tag<adapt::bp::ring_proxy<Polygon> >
{
typedef ring_tag type;
};
-}
+} // namespace traits
-}}
+}} // namespace boost::geometry
-// 2. iterators, adapt Boost.Polygon to Boost.Range
+// Specialize ring_proxy for Boost.Range
namespace boost
{
template<typename Polygon>
- struct range_iterator<bp_ring<Polygon> >
+ struct range_iterator<geometry::adapt::bp::ring_proxy<Polygon> >
{
- typedef typename bp_ring<Polygon>::iterator_type type;
+ typedef typename geometry::adapt::bp::ring_proxy<Polygon>::iterator_type type;
};
template<typename Polygon>
- struct range_const_iterator<bp_ring<Polygon> >
+ struct range_const_iterator<geometry::adapt::bp::ring_proxy<Polygon> >
{
- typedef typename bp_ring<Polygon>::iterator_type type;
+ typedef typename geometry::adapt::bp::ring_proxy<Polygon>::iterator_type type;
};
-} // namespace 'boost'
-
-
-// 2b. free-standing function for Boost.Range ADP
-template<typename Polygon>
-inline typename bp_ring<Polygon>::iterator_type range_begin(bp_ring<Polygon>& ring)
-{
- return ring.first;
-}
-
-template<typename Polygon>
-inline typename bp_ring<Polygon>::iterator_type range_begin(bp_ring<Polygon> const& ring)
-{
- return ring.first;
-}
-
-template<typename Polygon>
-inline typename bp_ring<Polygon>::iterator_type range_end(bp_ring<Polygon>& ring)
-{
- return ring.second;
-}
-
-template<typename Polygon>
-inline typename bp_ring<Polygon>::iterator_type range_end(bp_ring<Polygon> const& ring)
-{
- return ring.second;
-}
+} // namespace boost
#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_RING_PROXY_HPP
Deleted: sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring_type.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/geometries/adapted/boost_polygon/ring_type.hpp 2010-12-12 05:45:36 EST (Sun, 12 Dec 2010)
+++ (empty file)
@@ -1,105 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Copyright Barend Gehrels 2010, Geodan, Amsterdam, the Netherlands.
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_RING_PROXY_HPP
-#define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_RING_PROXY_HPP
-
-// Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
-
-#include <boost/range.hpp>
-#include <boost/polygon/polygon.hpp>
-
-
-// bp_ring -> proxy for ring
-// Polygon should be a "polygon_data" here; NOT polygon_with_holes_data
-
-// TODO: there should probably be a namespace here. boost::geometry::bp ?
-
-template<typename Polygon>
-struct bp_ring : public std::pair<typename Polygon::iterator_type, typename Polygon::iterator_type>
-{
- typedef boost::polygon::polygon_traits<Polygon> traits;
- typedef typename traits::coordinate_type coordinate_type;
- typedef typename traits::iterator_type iterator_type;
-
- inline bp_ring(Polygon const& p)
- {
- this->first = boost::polygon::begin_points(p);
- this->second = boost::polygon::end_points(p);
- }
-
- inline bp_ring(boost::polygon::polygon_with_holes_data<coordinate_type> const& p)
- {
- this->first = boost::polygon::begin_points(p);
- this->second = boost::polygon::end_points(p);
- }
-};
-
-
-namespace boost { namespace geometry
-{
-
-namespace traits
-{
-
-template <typename Polygon>
-struct tag<bp_ring<Polygon> >
-{
- typedef ring_tag type;
-};
-
-}
-
-}}
-
-// 2. iterators, adapt Boost.Polygon to Boost.Range
-namespace boost
-{
- template<typename Polygon>
- struct range_iterator<bp_ring<Polygon> >
- {
- typedef typename bp_ring<Polygon>::iterator_type type;
- };
-
- template<typename Polygon>
- struct range_const_iterator<bp_ring<Polygon> >
- {
- typedef typename bp_ring<Polygon>::iterator_type type;
- };
-
-
-} // namespace 'boost'
-
-
-// 2b. free-standing function for Boost.Range ADP
-template<typename Polygon>
-inline typename bp_ring<Polygon>::iterator_type range_begin(bp_ring<Polygon>& ring)
-{
- return ring.first;
-}
-
-template<typename Polygon>
-inline typename bp_ring<Polygon>::iterator_type range_begin(bp_ring<Polygon> const& ring)
-{
- return ring.first;
-}
-
-template<typename Polygon>
-inline typename bp_ring<Polygon>::iterator_type range_end(bp_ring<Polygon>& ring)
-{
- return ring.second;
-}
-
-template<typename Polygon>
-inline typename bp_ring<Polygon>::iterator_type range_end(bp_ring<Polygon> const& ring)
-{
- return ring.second;
-}
-
-
-#endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_RING_PROXY_HPP
-
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk