Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64505 - in sandbox/geometry: boost/geometry/algorithms boost/geometry/algorithms/detail/overlay boost/geometry/extensions/io/svg boost/geometry/geometries/concepts boost/geometry/iterators boost/geometry/ranges libs/geometry/test/algorithms libs/geometry/test/iterators libs/geometry/test/ranges
From: barend.gehrels_at_[hidden]
Date: 2010-07-31 14:41:36


Author: barendgehrels
Date: 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
New Revision: 64505
URL: http://svn.boost.org/trac/boost/changeset/64505

Log:
clip_linestring: renamed linestring to range (for support segments)
added distance checks
added mpl assertions
added intersection segment/box
renamed "segment_iterator" to "segment_returning_iterator" to be able to reuse that name later on

Added:
   sandbox/geometry/boost/geometry/iterators/segment_range_iterator.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/iterators/segment_returning_iterator.hpp
      - copied, changed from r64496, /sandbox/geometry/boost/geometry/iterators/segment_iterator.hpp
   sandbox/geometry/boost/geometry/ranges/
   sandbox/geometry/boost/geometry/ranges/box_range.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/ranges/segment_range.hpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/iterators/segment_range_iterator.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/iterators/segment_range_iterator.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/test/iterators/segment_returning_iterator.cpp
      - copied, changed from r64496, /sandbox/geometry/libs/geometry/test/iterators/segment_iterator.cpp
   sandbox/geometry/libs/geometry/test/iterators/segment_returning_iterator.vcproj
      - copied, changed from r64496, /sandbox/geometry/libs/geometry/test/iterators/segment_iterator.vcproj
   sandbox/geometry/libs/geometry/test/ranges/
   sandbox/geometry/libs/geometry/test/ranges/Jamfile.v2 (contents, props changed)
   sandbox/geometry/libs/geometry/test/ranges/ranges.sln (contents, props changed)
   sandbox/geometry/libs/geometry/test/ranges/segment_range.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/ranges/segment_range.vcproj (contents, props changed)
Removed:
   sandbox/geometry/boost/geometry/iterators/segment_iterator.hpp
   sandbox/geometry/libs/geometry/test/iterators/segment_iterator.cpp
   sandbox/geometry/libs/geometry/test/iterators/segment_iterator.vcproj
Text files modified:
   sandbox/geometry/boost/geometry/algorithms/centroid.hpp | 8 +++---
   sandbox/geometry/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp | 14 ++++++------
   sandbox/geometry/boost/geometry/algorithms/intersection.hpp | 36 +++++++++++++++++++++++++++++++---
   sandbox/geometry/boost/geometry/extensions/io/svg/svg_mapper.hpp | 41 +++++++++++++++++++++++++++++++++++++--
   sandbox/geometry/boost/geometry/extensions/io/svg/write_svg.hpp | 10 ++++++++
   sandbox/geometry/boost/geometry/geometries/concepts/linestring_concept.hpp | 4 ++
   sandbox/geometry/boost/geometry/iterators/segment_returning_iterator.hpp | 32 +++++++++++++++---------------
   sandbox/geometry/libs/geometry/test/algorithms/distance.cpp | 25 ++++++++++++++++++++---
   sandbox/geometry/libs/geometry/test/algorithms/intersection.cpp | 6 +++++
   sandbox/geometry/libs/geometry/test/iterators/Jamfile.v2 | 4 ++
   sandbox/geometry/libs/geometry/test/iterators/iterators.sln | 36 +++++++++++++++++++++++++++++++++++
   sandbox/geometry/libs/geometry/test/iterators/segment_returning_iterator.cpp | 10 ++++----
   sandbox/geometry/libs/geometry/test/iterators/segment_returning_iterator.vcproj | 10 ++++----
   13 files changed, 185 insertions(+), 51 deletions(-)

Modified: sandbox/geometry/boost/geometry/algorithms/centroid.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/centroid.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/centroid.hpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -24,7 +24,7 @@
 
 #include <boost/geometry/algorithms/distance.hpp>
 #include <boost/geometry/geometries/concepts/check.hpp>
-#include <boost/geometry/iterators/segment_iterator.hpp>
+#include <boost/geometry/iterators/segment_returning_iterator.hpp>
 #include <boost/geometry/strategies/centroid.hpp>
 #include <boost/geometry/strategies/concepts/centroid_concept.hpp>
 #include <boost/geometry/util/closeable_view.hpp>
@@ -247,7 +247,7 @@
 
         typedef typename point_type<Linestring>::type point_type;
         typedef typename boost::range_iterator<Linestring const>::type point_iterator_type;
- typedef segment_iterator<point_iterator_type, point_type> segment_iterator;
+ typedef segment_returning_iterator<point_iterator_type, point_type> segment_iterator;
 
         double length = double();
         std::pair<double, double> average_sum;
@@ -366,8 +366,8 @@
 struct centroid<ring_tag, Ring, Point, Strategy>
     : detail::centroid::centroid_ring
         <
- Ring,
- Point,
+ Ring,
+ Point,
             geometry::closure<Ring>::value,
             Strategy
>

Modified: sandbox/geometry/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -157,14 +157,14 @@
 <
     typename OutputLinestring,
     typename OutputIterator,
- typename Linestring,
+ typename Range,
     typename Box,
     typename Strategy
>
-OutputIterator clip_linestring_with_box(Box const& b, Linestring const& linestring,
+OutputIterator clip_range_with_box(Box const& b, Range const& range,
             OutputIterator out, Strategy const& strategy)
 {
- if (boost::begin(linestring) == boost::end(linestring))
+ if (boost::begin(range) == boost::end(range))
     {
         return out;
     }
@@ -173,11 +173,11 @@
 
     OutputLinestring line_out;
 
- typedef typename boost::range_iterator<Linestring const>::type iterator_type;
- iterator_type vertex = boost::begin(linestring);
+ typedef typename boost::range_iterator<Range const>::type iterator_type;
+ iterator_type vertex = boost::begin(range);
     for(iterator_type previous = vertex++;
- vertex != boost::end(linestring);
- previous = vertex++)
+ vertex != boost::end(range);
+ ++previous, ++vertex)
     {
         point_type p1, p2;
         copy_coordinates(*previous, p1);

Modified: sandbox/geometry/boost/geometry/algorithms/intersection.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/intersection.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/intersection.hpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -20,6 +20,7 @@
 #include <boost/geometry/geometries/concepts/check.hpp>
 #include <boost/geometry/algorithms/detail/overlay/clip_linestring.hpp>
 #include <boost/geometry/algorithms/detail/overlay/assemble.hpp>
+#include <boost/geometry/views/segment_range.hpp>
 
 
 
@@ -87,15 +88,15 @@
 
 template
 <
- typename Tag1, typename Tag2, typename Tag3,
- typename G1, typename G2,
+ typename TagIn1, typename TagIn2, typename TagOut,
+ typename Geometry1, typename Geometry2,
     typename OutputIterator,
     typename GeometryOut,
     typename Strategy
>
 struct intersection_inserter
     : detail::overlay::overlay
- <G1, G2, OutputIterator, GeometryOut, -1, Strategy>
+ <Geometry1, Geometry2, OutputIterator, GeometryOut, -1, Strategy>
 {};
 
 
@@ -162,11 +163,38 @@
     {
         typedef typename point_type<GeometryOut>::type point_type;
         strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
- return detail::intersection::clip_linestring_with_box
+ return detail::intersection::clip_range_with_box
             <GeometryOut>(box, linestring, out, lb_strategy);
     }
 };
 
+template
+<
+ typename Segment, typename Box,
+ typename OutputIterator, typename GeometryOut,
+ typename Strategy
+>
+struct intersection_inserter
+ <
+ segment_tag, box_tag, linestring_tag,
+ Segment, Box,
+ OutputIterator, GeometryOut,
+ Strategy
+ >
+{
+ static inline OutputIterator apply(Segment const& segment,
+ Box const& box, OutputIterator out, Strategy const& strategy)
+ {
+ typedef boost::geometry::segment_range<Segment> range_type;
+ range_type range(segment);
+
+ typedef typename point_type<GeometryOut>::type point_type;
+ strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
+ return detail::intersection::clip_range_with_box
+ <GeometryOut>(box, range, out, lb_strategy);
+ }
+};
+
 
 template
 <

Modified: sandbox/geometry/boost/geometry/extensions/io/svg/svg_mapper.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/extensions/io/svg/svg_mapper.hpp (original)
+++ sandbox/geometry/boost/geometry/extensions/io/svg/svg_mapper.hpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -12,10 +12,11 @@
 
 #include <vector>
 
-
+#include <boost/mpl/assert.hpp>
+#include <boost/noncopyable.hpp>
 #include <boost/scoped_ptr.hpp>
+#include <boost/type_traits/is_same.hpp>
 #include <boost/type_traits/remove_const.hpp>
-#include <boost/noncopyable.hpp>
 
 #include <boost/algorithm/string/split.hpp>
 #include <boost/algorithm/string/classification.hpp>
@@ -24,8 +25,8 @@
 #include <boost/geometry/algorithms/transform.hpp>
 #include <boost/geometry/algorithms/num_points.hpp>
 #include <boost/geometry/strategies/transform.hpp>
-
 #include <boost/geometry/strategies/transform/map_transformer.hpp>
+#include <boost/geometry/views/segment_range.hpp>
 
 #include <boost/geometry/geometries/box.hpp>
 #include <boost/geometry/geometries/linestring.hpp>
@@ -51,6 +52,11 @@
 template <typename GeometryTag, bool IsMulti, typename Geometry>
 struct svg_map
 {
+ BOOST_MPL_ASSERT_MSG
+ (
+ false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
+ , (Geometry)
+ );
 };
 
 
@@ -98,6 +104,23 @@
     }
 };
 
+template <typename Segment>
+struct svg_map<boost::geometry::segment_tag, false, Segment>
+{
+ template <typename TransformStrategy>
+ static inline void apply(std::ostream& stream,
+ std::string const& style, int size,
+ Segment const& segment, TransformStrategy const& strategy)
+ {
+ typedef boost::geometry::segment_range<Segment> range_type;
+ range_type range(segment);
+ svg_map_range
+ <
+ range_type,
+ boost::geometry::linestring<boost::geometry::point_xy<int> >
+ >::apply(stream, style, size, range, strategy);
+ }
+};
 
 
 template <typename Ring>
@@ -237,6 +260,18 @@
     void map(Geometry const& geometry, std::string const& style,
                 int size = -1)
     {
+ BOOST_MPL_ASSERT_MSG
+ (
+ ( boost::is_same
+ <
+ Point,
+ typename boost::geometry::point_type<Geometry>::type
+ >::value )
+ , POINT_TYPES_ARE_NOT_SAME_FOR_MAPPER_AND_MAP
+ , (types<Point, typename boost::geometry::point_type<Geometry>::type>)
+ );
+
+
         init_matrix();
         svg_map(m_stream, style, size, geometry, *m_matrix);
     }

Modified: sandbox/geometry/boost/geometry/extensions/io/svg/write_svg.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/extensions/io/svg/write_svg.hpp (original)
+++ sandbox/geometry/boost/geometry/extensions/io/svg/write_svg.hpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -13,6 +13,7 @@
 #include <string>
 
 #include <boost/config.hpp>
+#include <boost/mpl/assert.hpp>
 #include <boost/range.hpp>
 
 
@@ -192,7 +193,14 @@
 static inline void apply(std::basic_ostream<Char, Traits>& os, G const& geometry)
 */
 template <typename GeometryTag, typename Geometry>
-struct svg {};
+struct svg
+{
+ BOOST_MPL_ASSERT_MSG
+ (
+ false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
+ , (Geometry)
+ );
+};
 
 template <typename Point>
 struct svg<point_tag, Point> : detail::svg::svg_point<Point> {};

Modified: sandbox/geometry/boost/geometry/geometries/concepts/linestring_concept.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/geometries/concepts/linestring_concept.hpp (original)
+++ sandbox/geometry/boost/geometry/geometries/concepts/linestring_concept.hpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -102,7 +102,9 @@
     typedef typename point_type<Geometry>::type point_type;
 
     BOOST_CONCEPT_ASSERT( (concept::ConstPoint<point_type>) );
- BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
+ //BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
+ // Relaxed the concept.
+ BOOST_CONCEPT_ASSERT( (boost::ForwardRangeConcept<Geometry>) );
 
 
 public :

Deleted: sandbox/geometry/boost/geometry/iterators/segment_iterator.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/iterators/segment_iterator.hpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
+++ (empty file)
@@ -1,137 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands.
-// Copyright Bruno Lalande 2008, 2009
-// Copyright Mateusz Loskot 2009, mateusz_at_[hidden]
-// 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_ITERATORS_SEGMENT_ITERATOR_HPP
-#define BOOST_GEOMETRY_ITERATORS_SEGMENT_ITERATOR_HPP
-
-// TODO: This is very experimental version of input iterator
-// reading collection of points as segments - proof of concept.
-// --mloskot
-
-// TODO: Move to boost::iterator_adaptor
-
-#include <iterator>
-
-#include <boost/assert.hpp>
-#include <boost/iterator.hpp>
-#include <boost/iterator/iterator_adaptor.hpp>
-#include <boost/iterator/iterator_categories.hpp>
-
-#include <boost/geometry/algorithms/equals.hpp>
-#include <boost/geometry/geometries/segment.hpp>
-
-namespace boost { namespace geometry
-{
-
-template <typename Base, typename Point>
-struct segment_iterator
-{
- typedef Base base_type;
- typedef Point point_type;
- typedef typename geometry::segment<Point> segment_type;
-
- typedef std::input_iterator_tag iterator_category;
- typedef typename std::iterator_traits<Base>::difference_type difference_type;
- typedef segment_type value_type;
- typedef segment_type* pointer;
- typedef segment_type& reference;
-
- explicit segment_iterator(Base const& end)
- : m_segment(p1 , p2)
- , m_prev(end)
- , m_it(end)
- , m_end(end)
- {
- }
-
- segment_iterator(Base const& it, Base const& end)
- : m_segment(p1 , p2)
- , m_prev(it)
- , m_it(it)
- , m_end(end)
- {
- if (m_it != m_end)
- {
- BOOST_ASSERT(m_prev != m_end);
- ++m_it;
- }
- }
-
- reference operator*()
- {
- BOOST_ASSERT(m_it != m_end && m_prev != m_end);
-
- p1 = *m_prev;
- p2 = *m_it;
-
- return m_segment;
- }
-
- pointer operator->()
- {
- return &(operator*());
- }
-
- segment_iterator& operator++()
- {
- ++m_prev;
- ++m_it;
- return *this;
- }
-
- segment_iterator operator++(int)
- {
- segment_iterator it(*this);
- ++(*this);
- return it;
- }
-
- Base const& base() const { return m_it; }
-
-private:
-
- point_type p1;
- point_type p2;
- segment_type m_segment;
-
- Base m_prev;
- Base m_it;
- Base m_end;
-};
-
-template <typename Base, typename Point>
-bool operator==(segment_iterator<Base, Point> const& lhs,
- segment_iterator<Base, Point> const& rhs)
-{
- return (lhs.base() == rhs.base());
-}
-
-template <typename Base, typename Point>
-bool operator!=(segment_iterator<Base, Point> const& lhs,
- segment_iterator<Base, Point> const& rhs)
-{
- return (lhs.base() != rhs.base());
-}
-
-template <typename C>
-segment_iterator
-<
- typename C::iterator,
- typename C::value_type
->
-make_segment_iterator(C& c)
-{
- typedef typename C::iterator base_iterator;
- typedef typename C::value_type point_type;
- return segment_iterator<base_iterator, point_type>(c.begin(), c.end());
-}
-
-}} // namespace boost::geometry
-
-#endif // BOOST_GEOMETRY_ITERATORS_SEGMENT_ITERATOR_HPP

Added: sandbox/geometry/boost/geometry/iterators/segment_range_iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/iterators/segment_range_iterator.hpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -0,0 +1,111 @@
+// 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_SEGMENT_RANGE_ITERATOR_HPP
+#define BOOST_GEOMETRY_SEGMENT_RANGE_ITERATOR_HPP
+
+#include <boost/iterator.hpp>
+#include <boost/iterator/iterator_facade.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+
+#include <boost/geometry/core/point_type.hpp>
+#include <boost/geometry/algorithms/assign.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+/*!
+ \brief Iterator which adapts a segment (two points) as iterator
+ \tparam Segment segment type on which this iterator is based on
+ \note It is always const. We cannot dereference something non-const
+ (at least not without doing tricks as returning assignables)
+ \ingroup iterators
+*/
+template <typename Segment>
+struct segment_range_iterator
+ : public boost::iterator_facade
+ <
+ segment_range_iterator<Segment>,
+ typename point_type<Segment>::type const,
+ boost::bidirectional_traversal_tag
+ >
+{
+ // Default constructor is required to check concept of Range
+ // (used in checking linestring/ring concepts)
+ inline segment_range_iterator()
+ : m_index(-1)
+ , m_segment_address(NULL)
+ {
+ }
+
+
+ explicit inline segment_range_iterator(Segment const& segment)
+ : m_index(0)
+ , m_segment_address(&segment)
+ {
+ init(segment);
+ }
+
+ // Constructor to indicate the end of a segment
+ explicit inline segment_range_iterator(Segment const& segment, bool)
+ : m_index(2)
+ , m_segment_address(&segment)
+ {
+ init(segment);
+ }
+
+private:
+ friend class boost::iterator_core_access;
+ typedef typename point_type<Segment>::type point_type;
+
+ inline point_type const& dereference() const
+ {
+ if (m_index >= 0 && m_index <= 1)
+ {
+ return m_points[m_index];
+ }
+ // Should not occur. Probably throw here.
+ // TODO decide
+ return m_points[0];
+ }
+
+ inline bool equal(segment_range_iterator<Segment> const& other) const
+ {
+ return m_segment_address == this->m_segment_address
+ && other.m_index == this->m_index;
+ }
+
+ inline void increment()
+ {
+ m_index++;
+ }
+
+ inline void decrement()
+ {
+ m_index--;
+ }
+
+ inline void init(Segment const& segment)
+ {
+ assign_point_from_index<0>(segment, m_points[0]);
+ assign_point_from_index<1>(segment, m_points[1]);
+ }
+
+ // We HAVE TO copy the points, because a segment does not need
+ // to consist of two points,
+ // and we are expected to return a point here
+ point_type m_points[2];
+ int m_index;
+ Segment const* const m_segment_address;
+};
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_SEGMENT_RANGE_ITERATOR_HPP

Copied: sandbox/geometry/boost/geometry/iterators/segment_returning_iterator.hpp (from r64496, /sandbox/geometry/boost/geometry/iterators/segment_iterator.hpp)
==============================================================================
--- /sandbox/geometry/boost/geometry/iterators/segment_iterator.hpp (original)
+++ sandbox/geometry/boost/geometry/iterators/segment_returning_iterator.hpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -7,8 +7,8 @@
 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_GEOMETRY_ITERATORS_SEGMENT_ITERATOR_HPP
-#define BOOST_GEOMETRY_ITERATORS_SEGMENT_ITERATOR_HPP
+#ifndef BOOST_GEOMETRY_ITERATORS_SEGMENT_RETURNING_ITERATOR_HPP
+#define BOOST_GEOMETRY_ITERATORS_SEGMENT_RETURNING_ITERATOR_HPP
 
 // TODO: This is very experimental version of input iterator
 // reading collection of points as segments - proof of concept.
@@ -30,7 +30,7 @@
 {
 
 template <typename Base, typename Point>
-struct segment_iterator
+struct segment_returning_iterator
 {
     typedef Base base_type;
     typedef Point point_type;
@@ -42,7 +42,7 @@
     typedef segment_type* pointer;
     typedef segment_type& reference;
 
- explicit segment_iterator(Base const& end)
+ explicit segment_returning_iterator(Base const& end)
         : m_segment(p1 , p2)
         , m_prev(end)
         , m_it(end)
@@ -50,7 +50,7 @@
     {
     }
 
- segment_iterator(Base const& it, Base const& end)
+ segment_returning_iterator(Base const& it, Base const& end)
         : m_segment(p1 , p2)
         , m_prev(it)
         , m_it(it)
@@ -78,16 +78,16 @@
         return &(operator*());
     }
 
- segment_iterator& operator++()
+ segment_returning_iterator& operator++()
     {
         ++m_prev;
         ++m_it;
         return *this;
     }
 
- segment_iterator operator++(int)
+ segment_returning_iterator operator++(int)
     {
- segment_iterator it(*this);
+ segment_returning_iterator it(*this);
         ++(*this);
         return it;
     }
@@ -106,32 +106,32 @@
 };
 
 template <typename Base, typename Point>
-bool operator==(segment_iterator<Base, Point> const& lhs,
- segment_iterator<Base, Point> const& rhs)
+bool operator==(segment_returning_iterator<Base, Point> const& lhs,
+ segment_returning_iterator<Base, Point> const& rhs)
 {
     return (lhs.base() == rhs.base());
 }
 
 template <typename Base, typename Point>
-bool operator!=(segment_iterator<Base, Point> const& lhs,
- segment_iterator<Base, Point> const& rhs)
+bool operator!=(segment_returning_iterator<Base, Point> const& lhs,
+ segment_returning_iterator<Base, Point> const& rhs)
 {
     return (lhs.base() != rhs.base());
 }
 
 template <typename C>
-segment_iterator
+inline segment_returning_iterator
 <
     typename C::iterator,
     typename C::value_type
>
-make_segment_iterator(C& c)
+make_segment_returning_iterator(C& c)
 {
     typedef typename C::iterator base_iterator;
     typedef typename C::value_type point_type;
- return segment_iterator<base_iterator, point_type>(c.begin(), c.end());
+ return segment_returning_iterator<base_iterator, point_type>(c.begin(), c.end());
 }
 
 }} // namespace boost::geometry
 
-#endif // BOOST_GEOMETRY_ITERATORS_SEGMENT_ITERATOR_HPP
+#endif // BOOST_GEOMETRY_ITERATORS_SEGMENT_RETURNING_ITERATOR_HPP

Added: sandbox/geometry/boost/geometry/ranges/box_range.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/ranges/box_range.hpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -0,0 +1,61 @@
+// 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_RANGES_BOX_RANGE_HPP
+#define BOOST_GEOMETRY_RANGES_BOX_RANGE_HPP
+
+
+#include <boost/range.hpp>
+
+#include <boost/geometry/iterators/box_iterator.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+template <typename Box>
+class box_range
+{
+public :
+ typedef box_iterator<Box const> const_iterator;
+ typedef box_iterator<Box const> iterator; // must be defined
+
+ explicit box_range(Box const& box)
+ : m_begin(const_iterator(box))
+ , m_end(const_iterator(box, true))
+ {
+ }
+
+ const_iterator begin() const { return m_begin; }
+ const_iterator end() const { return m_end; }
+
+ // It may not be used non-const, so comment this:
+ //iterator begin() { return m_begin; }
+ //iterator end() { return m_end; }
+
+private :
+ const_iterator m_begin, m_end;
+};
+
+
+// All box ranges can be handled as linestrings
+namespace traits
+{
+ template<typename Box>
+ struct tag<box_range<Box> >
+ {
+ typedef ring_tag type;
+ };
+}
+
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_RANGES_BOX_RANGE_HPP

Added: sandbox/geometry/boost/geometry/ranges/segment_range.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/ranges/segment_range.hpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -0,0 +1,61 @@
+// 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_RANGES_SEGMENT_RANGE_HPP
+#define BOOST_GEOMETRY_RANGES_SEGMENT_RANGE_HPP
+
+
+#include <boost/range.hpp>
+
+#include <boost/geometry/iterators/segment_range_iterator.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+template <typename Segment>
+class segment_range
+{
+public :
+ typedef segment_range_iterator<Segment const> const_iterator;
+ typedef segment_range_iterator<Segment const> iterator; // must be defined
+
+ explicit segment_range(Segment const& segment)
+ : m_begin(const_iterator(segment))
+ , m_end(const_iterator(segment, true))
+ {
+ }
+
+ const_iterator begin() const { return m_begin; }
+ const_iterator end() const { return m_end; }
+
+ // It may not be used non-const, so comment this:
+ //iterator begin() { return m_begin; }
+ //iterator end() { return m_end; }
+
+private :
+ const_iterator m_begin, m_end;
+};
+
+
+// All segment ranges can be handled as linestrings
+namespace traits
+{
+ template<typename Segment>
+ struct tag<segment_range<Segment> >
+ {
+ typedef linestring_tag type;
+ };
+}
+
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_RANGES_SEGMENT_RANGE_HPP

Modified: sandbox/geometry/libs/geometry/test/algorithms/distance.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/distance.cpp (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/distance.cpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -179,17 +179,34 @@
     test_geometry<P, bg::linestring<P> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
     test_geometry<bg::linestring<P>, P>("LINESTRING(1 1,4 4)", "POINT(1 3)", sqrt(2.0));
 
-
+ // Rings
     test_geometry<P, bg::linear_ring<P> >("POINT(1 3)", "POLYGON((1 1,4 4,5 0,1 1))", sqrt(2.0));
     test_geometry<P, bg::linear_ring<P> >("POINT(3 1)", "POLYGON((1 1,4 4,5 0,1 1))", 0.0);
     // other way round
     test_geometry<bg::linear_ring<P>, P>("POLYGON((1 1,4 4,5 0,1 1))", "POINT(3 1)", 0.0);
-
     // open ring
     test_geometry<P, bg::linear_ring<P, std::vector, true, false> >("POINT(1 3)", "POLYGON((4 4,5 0,1 1))", sqrt(2.0));
 
- // This one COMPILES but should THROW - because boost::array is not variably sized
- //test_geometry<P, boost::array<P, 2> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
+ // Polygons
+ test_geometry<P, bg::polygon<P> >("POINT(1 3)", "POLYGON((1 1,4 4,5 0,1 1))", sqrt(2.0));
+ test_geometry<P, bg::polygon<P> >("POINT(3 1)", "POLYGON((1 1,4 4,5 0,1 1))", 0.0);
+ // other way round
+ test_geometry<bg::polygon<P>, P>("POLYGON((1 1,4 4,5 0,1 1))", "POINT(3 1)", 0.0);
+ // open polygon
+ test_geometry<P, bg::polygon<P, std::vector, std::vector, true, false> >("POINT(1 3)", "POLYGON((4 4,5 0,1 1))", sqrt(2.0));
+
+ // Polygons with holes
+ std::string donut = "POLYGON ((0 0,1 9,8 1,0 0),(1 1,4 1,1 4,1 1))";
+ test_geometry<P, bg::polygon<P> >("POINT(2 2)", donut, 0.5 * sqrt(2.0));
+ test_geometry<P, bg::polygon<P> >("POINT(3 3)", donut, 0.0);
+ // other way round
+ test_geometry<bg::polygon<P>, P>(donut, "POINT(2 2)", 0.5 * sqrt(2.0));
+ // open
+ test_geometry<P, bg::polygon<P, std::vector, std::vector, true, false> >("POINT(2 2)", "POLYGON ((0 0,1 9,8 1),(1 1,4 1,1 4))", 0.5 * sqrt(2.0));
+
+
+ // DOES NOT COMPILE - cannot do read_wkt (because boost::array is not variably sized)
+ // test_geometry<P, boost::array<P, 2> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
 
     test_geometry<P, test::wrapped_boost_array<P, 2> >("POINT(3 1)", "LINESTRING(1 1,4 4)", sqrt(2.0));
 }

Modified: sandbox/geometry/libs/geometry/test/algorithms/intersection.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/intersection.cpp (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/intersection.cpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -17,6 +17,7 @@
 
 #include <test_common/test_point.hpp>
 #include <test_common/with_pointer.hpp>
+#include <test_geometries/custom_segment.hpp>
 
 
 
@@ -26,6 +27,7 @@
     typedef boost::geometry::linestring<P> linestring;
     typedef boost::geometry::polygon<P> polygon;
     typedef boost::geometry::box<P> box;
+ typedef test::custom_segment_of<P> segment;
 
     std::string clip = "box(2 2,8 8)";
 
@@ -38,6 +40,10 @@
     test_one<linestring, linestring, box>("llb", "LINESTRING(0 0,10 10)", clip, 1, 2, sqrt(2.0 * 6.0 * 6.0));
     test_one<linestring, box, linestring>("lbl", clip, "LINESTRING(0 0,10 10)", 1, 2, sqrt(2.0 * 6.0 * 6.0));
 
+ // Box/segment
+ test_one<linestring, segment, box>("lsb", "LINESTRING(0 0,10 10)", clip, 1, 2, sqrt(2.0 * 6.0 * 6.0));
+ test_one<linestring, box, segment>("lbs", clip, "LINESTRING(0 0,10 10)", 1, 2, sqrt(2.0 * 6.0 * 6.0));
+
     // Completely inside
     test_one<linestring, linestring, box>("llbi", "LINESTRING(3 3,7 7)", clip, 1, 2, sqrt(2.0 * 4.0 * 4.0));
 

Modified: sandbox/geometry/libs/geometry/test/iterators/Jamfile.v2
==============================================================================
--- sandbox/geometry/libs/geometry/test/iterators/Jamfile.v2 (original)
+++ sandbox/geometry/libs/geometry/test/iterators/Jamfile.v2 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -8,8 +8,10 @@
 
 test-suite ggl-iterators
     :
+ [ run box_iterator.cpp ]
     [ run circular_iterator.cpp ]
     [ run closing_iterator.cpp ]
     [ run ever_circling_iterator.cpp ]
- [ run segment_iterator.cpp ]
+ [ run segment_returning_iterator.cpp ]
+ [ run segment_range_iterator.cpp ]
     ;

Modified: sandbox/geometry/libs/geometry/test/iterators/iterators.sln
==============================================================================
--- sandbox/geometry/libs/geometry/test/iterators/iterators.sln (original)
+++ sandbox/geometry/libs/geometry/test/iterators/iterators.sln 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -2,6 +2,18 @@
 # Visual C++ Express 2005
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ever_circling_closeable_reversible_iterator", "ever_circling_closeable_reversible_iterator.vcproj", "{8EC8E503-BCB9-4A58-AC33-D61B3B0C2EAF}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ever_circling_iterator", "ever_circling_iterator.vcproj", "{73F8C969-FA1E-4D9D-81F9-35B1206F0C14}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "circular_iterator", "circular_iterator.vcproj", "{46571A34-B68D-4854-90C0-56D29EE63FFE}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "closing_iterator", "closing_iterator.vcproj", "{04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "segment_range_iterator", "segment_range_iterator.vcproj", "{887E64C9-6786-44E2-AE09-B02B855486DE}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "box_iterator", "box_iterator.vcproj", "{CD4B14B2-ED74-4111-B8BF-093FA3930A5C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "segment_returning_iterator", "segment_returning_iterator.vcproj", "{A38B1CA8-5194-4FAD-B85E-55697BEECCB7}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -12,6 +24,30 @@
                 {8EC8E503-BCB9-4A58-AC33-D61B3B0C2EAF}.Debug|Win32.Build.0 = Debug|Win32
                 {8EC8E503-BCB9-4A58-AC33-D61B3B0C2EAF}.Release|Win32.ActiveCfg = Release|Win32
                 {8EC8E503-BCB9-4A58-AC33-D61B3B0C2EAF}.Release|Win32.Build.0 = Release|Win32
+ {73F8C969-FA1E-4D9D-81F9-35B1206F0C14}.Debug|Win32.ActiveCfg = Debug|Win32
+ {73F8C969-FA1E-4D9D-81F9-35B1206F0C14}.Debug|Win32.Build.0 = Debug|Win32
+ {73F8C969-FA1E-4D9D-81F9-35B1206F0C14}.Release|Win32.ActiveCfg = Release|Win32
+ {73F8C969-FA1E-4D9D-81F9-35B1206F0C14}.Release|Win32.Build.0 = Release|Win32
+ {46571A34-B68D-4854-90C0-56D29EE63FFE}.Debug|Win32.ActiveCfg = Debug|Win32
+ {46571A34-B68D-4854-90C0-56D29EE63FFE}.Debug|Win32.Build.0 = Debug|Win32
+ {46571A34-B68D-4854-90C0-56D29EE63FFE}.Release|Win32.ActiveCfg = Release|Win32
+ {46571A34-B68D-4854-90C0-56D29EE63FFE}.Release|Win32.Build.0 = Release|Win32
+ {04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}.Debug|Win32.ActiveCfg = Debug|Win32
+ {04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}.Debug|Win32.Build.0 = Debug|Win32
+ {04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}.Release|Win32.ActiveCfg = Release|Win32
+ {04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}.Release|Win32.Build.0 = Release|Win32
+ {887E64C9-6786-44E2-AE09-B02B855486DE}.Debug|Win32.ActiveCfg = Debug|Win32
+ {887E64C9-6786-44E2-AE09-B02B855486DE}.Debug|Win32.Build.0 = Debug|Win32
+ {887E64C9-6786-44E2-AE09-B02B855486DE}.Release|Win32.ActiveCfg = Release|Win32
+ {887E64C9-6786-44E2-AE09-B02B855486DE}.Release|Win32.Build.0 = Release|Win32
+ {CD4B14B2-ED74-4111-B8BF-093FA3930A5C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CD4B14B2-ED74-4111-B8BF-093FA3930A5C}.Debug|Win32.Build.0 = Debug|Win32
+ {CD4B14B2-ED74-4111-B8BF-093FA3930A5C}.Release|Win32.ActiveCfg = Release|Win32
+ {CD4B14B2-ED74-4111-B8BF-093FA3930A5C}.Release|Win32.Build.0 = Release|Win32
+ {A38B1CA8-5194-4FAD-B85E-55697BEECCB7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A38B1CA8-5194-4FAD-B85E-55697BEECCB7}.Debug|Win32.Build.0 = Debug|Win32
+ {A38B1CA8-5194-4FAD-B85E-55697BEECCB7}.Release|Win32.ActiveCfg = Release|Win32
+ {A38B1CA8-5194-4FAD-B85E-55697BEECCB7}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Deleted: sandbox/geometry/libs/geometry/test/iterators/segment_iterator.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/iterators/segment_iterator.cpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
+++ (empty file)
@@ -1,77 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
-// Copyright Bruno Lalande 2008, 2009
-// Copyright Mateusz Loskot 2009, mateusz_at_[hidden]
-// 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)
-
-#include <algorithm>
-#include <list>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include <geometry_test_common.hpp>
-
-#include <boost/geometry/core/coordinate_type.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
-#include <boost/geometry/geometries/point.hpp>
-#include <boost/geometry/geometries/segment.hpp>
-#include <boost/geometry/iterators/segment_iterator.hpp>
-#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
-
-template <typename C>
-void test_linestring(std::string const& wkt, std::string const& expected)
-{
- typedef C point_list;
- typedef typename C::value_type point;
- typedef typename C::iterator base_iterator;
- typedef boost::geometry::segment_iterator<base_iterator, point> segment_iterator;
- typedef typename segment_iterator::value_type segment;
- typedef boost::geometry::linestring<point> linestring;
-
- linestring g;
- boost::geometry::read_wkt(wkt, g);
-
- point_list v;
- std::copy(g.begin(), g.end(), std::back_insert_iterator<point_list>(v));
- BOOST_CHECK_EQUAL(g.size(), v.size());
-
- segment_iterator it(v.begin(), v.end());
- segment_iterator end(v.end());
-
- std::ostringstream oss;
- while (it != end)
- {
- segment const& s = *it;
- oss << boost::geometry::get<0>(s.first) << boost::geometry::get<1>(s.first)
- << boost::geometry::get<0>(s.second) << boost::geometry::get<1>(s.second);
- ++it;
- }
- BOOST_CHECK_EQUAL(oss.str(), expected);
-}
-
-int test_main(int, char* [])
-{
- // Test std::vector
- typedef std::vector<boost::geometry::point_2d> points_v;
- test_linestring<points_v>("linestring empty", "");
- test_linestring<points_v>("linestring ()", "");
- test_linestring<points_v>("linestring (1 1)", "");
- test_linestring<points_v>("linestring (1 1, 2 2, 3 3)", "11222233");
- test_linestring<points_v>("linestring (1 1, 2 2, 3 3, 4 4)", "112222333344");
- test_linestring<points_v>("linestring (1 1, 2 2, 3 3, 4 4, 5 5, 6 6)", "11222233334444555566");
-
- // Test std::list
- typedef std::list<boost::geometry::point_2d> points_l;
- test_linestring<points_l>("linestring empty", "");
- test_linestring<points_l>("linestring ()", "");
- test_linestring<points_l>("linestring (1 1)", "");
- test_linestring<points_l>("linestring (1 1, 2 2, 3 3)", "11222233");
- test_linestring<points_l>("linestring (1 1, 2 2, 3 3, 4 4)", "112222333344");
- test_linestring<points_l>("linestring (1 1, 2 2, 3 3, 4 4, 5 5, 6 6)", "11222233334444555566");
-
- return 0;
-}

Deleted: sandbox/geometry/libs/geometry/test/iterators/segment_iterator.vcproj
==============================================================================
--- sandbox/geometry/libs/geometry/test/iterators/segment_iterator.vcproj 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
+++ (empty file)
@@ -1,176 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="segment_iterator"
- ProjectGUID="{A38B1CA8-5194-4FAD-B85E-55697BEECCB7}"
- RootNamespace="segment_iterator"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\segment_iterator"
- ConfigurationType="1"
- InheritedPropertySheets="..\boost.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../..;.."
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- ExceptionHandling="2"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- DebugInformationFormat="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\segment_iterator"
- ConfigurationType="1"
- InheritedPropertySheets="..\boost.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../..;.."
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- ExceptionHandling="2"
- UsePrecompiledHeader="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- EmbedManifest="false"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath=".\segment_iterator.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>

Added: sandbox/geometry/libs/geometry/test/iterators/segment_range_iterator.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/iterators/segment_range_iterator.cpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -0,0 +1,52 @@
+// Boost.Geometry (aka GGL, Generic Segment 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)
+
+#include <algorithm>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/geometries/cartesian2d.hpp>
+#include <boost/geometry/iterators/segment_range_iterator.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
+
+#include <test_geometries/custom_segment.hpp>
+
+
+template <typename Segment>
+void test_geometry(std::string const& wkt, std::string const& expected)
+{
+ Segment segment;
+ boost::geometry::read_wkt(wkt, segment);
+
+ std::ostringstream out;
+ boost::geometry::segment_range_iterator<Segment> it(segment), end(segment, true);
+ for ( ; it != end; ++it)
+ {
+ out << " " << boost::geometry::get<0>(*it) << boost::geometry::get<1>(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<test::custom_segment>("linestring(1 1,2 2)", " 11 22");
+ test_geometry<test::custom_segment>("linestring(4 4,3 3)", " 44 33");
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<boost::geometry::point_2d>();
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/test/iterators/segment_range_iterator.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/iterators/segment_range_iterator.vcproj 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="segment_range_iterator"
+ ProjectGUID="{887E64C9-6786-44E2-AE09-B02B855486DE}"
+ RootNamespace="segment_range_iterator"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\segment_range_iterator"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\segment_range_iterator"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\segment_range_iterator.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Copied: sandbox/geometry/libs/geometry/test/iterators/segment_returning_iterator.cpp (from r64496, /sandbox/geometry/libs/geometry/test/iterators/segment_iterator.cpp)
==============================================================================
--- /sandbox/geometry/libs/geometry/test/iterators/segment_iterator.cpp (original)
+++ sandbox/geometry/libs/geometry/test/iterators/segment_returning_iterator.cpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -19,7 +19,7 @@
 #include <boost/geometry/geometries/cartesian2d.hpp>
 #include <boost/geometry/geometries/point.hpp>
 #include <boost/geometry/geometries/segment.hpp>
-#include <boost/geometry/iterators/segment_iterator.hpp>
+#include <boost/geometry/iterators/segment_returning_iterator.hpp>
 #include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
 
 template <typename C>
@@ -28,8 +28,8 @@
     typedef C point_list;
     typedef typename C::value_type point;
     typedef typename C::iterator base_iterator;
- typedef boost::geometry::segment_iterator<base_iterator, point> segment_iterator;
- typedef typename segment_iterator::value_type segment;
+ typedef boost::geometry::segment_returning_iterator<base_iterator, point> segment_returning_iterator;
+ typedef typename segment_returning_iterator::value_type segment;
     typedef boost::geometry::linestring<point> linestring;
 
     linestring g;
@@ -39,8 +39,8 @@
     std::copy(g.begin(), g.end(), std::back_insert_iterator<point_list>(v));
     BOOST_CHECK_EQUAL(g.size(), v.size());
 
- segment_iterator it(v.begin(), v.end());
- segment_iterator end(v.end());
+ segment_returning_iterator it(v.begin(), v.end());
+ segment_returning_iterator end(v.end());
 
     std::ostringstream oss;
     while (it != end)

Copied: sandbox/geometry/libs/geometry/test/iterators/segment_returning_iterator.vcproj (from r64496, /sandbox/geometry/libs/geometry/test/iterators/segment_iterator.vcproj)
==============================================================================
--- /sandbox/geometry/libs/geometry/test/iterators/segment_iterator.vcproj (original)
+++ sandbox/geometry/libs/geometry/test/iterators/segment_returning_iterator.vcproj 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -2,9 +2,9 @@
 <VisualStudioProject
         ProjectType="Visual C++"
         Version="8.00"
- Name="segment_iterator"
+ Name="segment_returning_iterator"
         ProjectGUID="{A38B1CA8-5194-4FAD-B85E-55697BEECCB7}"
- RootNamespace="segment_iterator"
+ RootNamespace="segment_returning_iterator"
         Keyword="Win32Proj"
>
         <Platforms>
@@ -18,7 +18,7 @@
                 <Configuration
                         Name="Debug|Win32"
                         OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\segment_iterator"
+ IntermediateDirectory="$(ConfigurationName)\segment_returning_iterator"
                         ConfigurationType="1"
                         InheritedPropertySheets="..\boost.vsprops"
                         CharacterSet="1"
@@ -92,7 +92,7 @@
                 <Configuration
                         Name="Release|Win32"
                         OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\segment_iterator"
+ IntermediateDirectory="$(ConfigurationName)\segment_returning_iterator"
                         ConfigurationType="1"
                         InheritedPropertySheets="..\boost.vsprops"
                         CharacterSet="1"
@@ -167,7 +167,7 @@
         </References>
         <Files>
                 <File
- RelativePath=".\segment_iterator.cpp"
+ RelativePath=".\segment_returning_iterator.cpp"
>
                 </File>
         </Files>

Added: sandbox/geometry/libs/geometry/test/ranges/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/ranges/Jamfile.v2 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -0,0 +1,13 @@
+# test/iterators/Jamfile.v2
+#
+# Copyright (c) 2010 Barend Gehrels
+#
+# 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)
+
+test-suite boost-geometry-ranges
+ :
+ [ run segment_range.cpp ]
+ [ run box_range.cpp ]
+ ;

Added: sandbox/geometry/libs/geometry/test/ranges/ranges.sln
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/ranges/ranges.sln 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -0,0 +1,25 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "segment_range", "segment_range.vcproj", "{B49AC3E2-3497-465B-88C2-BCADA4B4ADAF}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "box_range", "box_range.vcproj", "{34A1F53A-DA46-41E6-9E26-740D22D662DC}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B49AC3E2-3497-465B-88C2-BCADA4B4ADAF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B49AC3E2-3497-465B-88C2-BCADA4B4ADAF}.Debug|Win32.Build.0 = Debug|Win32
+ {B49AC3E2-3497-465B-88C2-BCADA4B4ADAF}.Release|Win32.ActiveCfg = Release|Win32
+ {B49AC3E2-3497-465B-88C2-BCADA4B4ADAF}.Release|Win32.Build.0 = Release|Win32
+ {34A1F53A-DA46-41E6-9E26-740D22D662DC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {34A1F53A-DA46-41E6-9E26-740D22D662DC}.Debug|Win32.Build.0 = Debug|Win32
+ {34A1F53A-DA46-41E6-9E26-740D22D662DC}.Release|Win32.ActiveCfg = Release|Win32
+ {34A1F53A-DA46-41E6-9E26-740D22D662DC}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal

Added: sandbox/geometry/libs/geometry/test/ranges/segment_range.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/ranges/segment_range.cpp 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -0,0 +1,70 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// 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)
+
+#include <algorithm>
+#include <iterator>
+#include <sstream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/geometries/cartesian2d.hpp>
+#include <boost/geometry/ranges/segment_range.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
+
+#include <test_geometries/custom_segment.hpp>
+
+
+template <typename Segment>
+void test_geometry(std::string const& wkt, std::string const& expected)
+{
+ namespace bg = boost::geometry;
+
+ Segment segment;
+ bg::read_wkt(wkt, segment);
+
+ typedef bg::segment_range<Segment> range_type;
+ range_type range(segment);
+
+ {
+ std::ostringstream out;
+ for (typename boost::range_iterator<range_type>::type it = boost::begin(range);
+ it != boost::end(range); ++it)
+ {
+ out << " " << boost::geometry::get<0>(*it) << boost::geometry::get<1>(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), expected);
+ }
+
+ {
+ // Check forward/backward behaviour
+ std::ostringstream out;
+ typename boost::range_iterator<range_type>::type it = boost::begin(range);
+ it++;
+ it--;
+ out << " " << boost::geometry::get<0>(*it) << boost::geometry::get<1>(*it);
+ typename boost::range_iterator<range_type>::type it2 = boost::end(range);
+ it2--;
+ out << " " << boost::geometry::get<0>(*it2) << boost::geometry::get<1>(*it2);
+ BOOST_CHECK_EQUAL(out.str(), expected);
+ }
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<test::custom_segment>("linestring(1 1,2 2)", " 11 22");
+ test_geometry<test::custom_segment>("linestring(4 4,3 3)", " 44 33");
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<boost::geometry::point_2d>();
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/test/ranges/segment_range.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/ranges/segment_range.vcproj 2010-07-31 14:41:31 EDT (Sat, 31 Jul 2010)
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="segment_range"
+ ProjectGUID="{B49AC3E2-3497-465B-88C2-BCADA4B4ADAF}"
+ RootNamespace="segment_range"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\segment_range"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\segment_range"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\segment_range.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>


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