Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67303 - in sandbox/geometry/boost/geometry: algorithms algorithms/detail/overlay algorithms/detail/sections core multi/algorithms multi/algorithms/detail/overlay multi/algorithms/detail/sections multi/core views
From: barend.gehrels_at_[hidden]
Date: 2010-12-18 11:53:05


Author: barendgehrels
Date: 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
New Revision: 67303
URL: http://svn.boost.org/trac/boost/changeset/67303

Log:
Incorporated reversible_view in sectionalize, get_turns, copy_segments
Included Reverse boolean parameter in get_turns, traverse, overlay
Removed closeable_view from get_full_section (was confusing and not necessary)
Algorithms difference and sym_difference now use reverse iteration instead of reversing the whole geometry beforehand
Asserted some other metafunctions with BOOST_MPL_ASSERT_MSG
Text files modified:
   sandbox/geometry/boost/geometry/algorithms/detail/overlay/assemble.hpp | 5
   sandbox/geometry/boost/geometry/algorithms/detail/overlay/copy_segments.hpp | 43 +++++++---
   sandbox/geometry/boost/geometry/algorithms/detail/overlay/dissolver.hpp | 1
   sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp | 8 +-
   sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_turns.hpp | 57 ++++++++++----
   sandbox/geometry/boost/geometry/algorithms/detail/overlay/overlay.hpp | 42 +++++++++-
   sandbox/geometry/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp | 3
   sandbox/geometry/boost/geometry/algorithms/detail/overlay/traverse.hpp | 12 ++-
   sandbox/geometry/boost/geometry/algorithms/detail/sections/get_full_section.hpp | 47 +++--------
   sandbox/geometry/boost/geometry/algorithms/detail/sections/sectionalize.hpp | 42 +++++++---
   sandbox/geometry/boost/geometry/algorithms/difference.hpp | 24 ++++-
   sandbox/geometry/boost/geometry/algorithms/disjoint.hpp | 1
   sandbox/geometry/boost/geometry/algorithms/dissolve.hpp | 4
   sandbox/geometry/boost/geometry/algorithms/intersection.hpp | 160 +++++++++++++++++++++------------------
   sandbox/geometry/boost/geometry/algorithms/sym_difference.hpp | 34 ++++++--
   sandbox/geometry/boost/geometry/algorithms/union.hpp | 122 ++++++++++++++---------------
   sandbox/geometry/boost/geometry/core/geometry_id.hpp | 10 ++
   sandbox/geometry/boost/geometry/core/ring_type.hpp | 7 +
   sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp | 3
   sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp | 3
   sandbox/geometry/boost/geometry/multi/algorithms/detail/sections/get_full_section.hpp | 12 --
   sandbox/geometry/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp | 12 ++
   sandbox/geometry/boost/geometry/multi/algorithms/intersection.hpp | 18 +++-
   sandbox/geometry/boost/geometry/multi/core/ring_type.hpp | 9 ++
   sandbox/geometry/boost/geometry/views/enveloped_view.hpp | 6 +
   sandbox/geometry/boost/geometry/views/section_view.hpp | 3
   26 files changed, 416 insertions(+), 272 deletions(-)

Modified: sandbox/geometry/boost/geometry/algorithms/detail/overlay/assemble.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/overlay/assemble.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/assemble.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -9,7 +9,6 @@
 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ASSEMBLE_HPP
 
 
-#include <deque>
 #include <map>
 #include <vector>
 
@@ -571,7 +570,7 @@
         // Add all produced rings using source index 2
         {
             ring_identifier id(2, 0, -1);
- for (typename std::vector<ring_type>::const_iterator
+ for (typename boost::range_iterator<Rings const>::type
                     it = boost::begin(rings);
                     it != boost::end(rings);
                     ++it, ++id.multi_index)
@@ -629,7 +628,7 @@
                     ring_properties_container_type,
                     Geometry1,
                     Geometry2,
- std::vector<ring_type>,
+ Rings,
                     model::box<point_type>
>::apply(ring_properties_container,
                         geometry1, geometry2, rings, direction, dissolve, total);

Modified: sandbox/geometry/boost/geometry/algorithms/detail/overlay/copy_segments.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/overlay/copy_segments.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/copy_segments.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -22,12 +22,11 @@
 #include <boost/geometry/core/ring_type.hpp>
 #include <boost/geometry/core/exterior_ring.hpp>
 #include <boost/geometry/core/interior_rings.hpp>
-
 #include <boost/geometry/geometries/concepts/check.hpp>
-
 #include <boost/geometry/iterators/ever_circling_iterator.hpp>
-
 #include <boost/geometry/iterators/range_type.hpp>
+#include <boost/geometry/util/closeable_view.hpp>
+#include <boost/geometry/util/reversible_view.hpp>
 
 
 namespace boost { namespace geometry
@@ -39,23 +38,30 @@
 {
 
 
-template <typename Ring, typename SegmentIdentifier, typename RangeOut>
+template <typename Ring, bool Reverse, typename SegmentIdentifier, typename RangeOut>
 struct copy_segments_ring
 {
     typedef typename closeable_view
         <
             Ring const,
             closure<Ring>::value
- >::type view_type;
+ >::type cview_type;
+
+ typedef typename reversible_view
+ <
+ cview_type const,
+ Reverse ? iterate_reverse : iterate_forward
+ >::type rview_type;
+
+ typedef typename boost::range_iterator<rview_type const>::type iterator;
+ typedef geometry::ever_circling_iterator<iterator> ec_iterator;
 
     static inline void apply(Ring const& ring,
             SegmentIdentifier const& seg_id, int to_index,
             RangeOut& current_output)
     {
- view_type view(ring);
- typedef typename boost::range_iterator<view_type const>::type iterator;
-
- typedef geometry::ever_circling_iterator<iterator> ec_iterator;
+ cview_type cview(ring);
+ rview_type view(cview);
 
         // The problem: sometimes we want to from "3" to "2"
         // -> end = "3" -> end == begin
@@ -92,7 +98,7 @@
 };
 
 
-template <typename Polygon, typename SegmentIdentifier, typename RangeOut>
+template <typename Polygon, bool Reverse, typename SegmentIdentifier, typename RangeOut>
 struct copy_segments_polygon
 {
     static inline void apply(Polygon const& polygon,
@@ -103,6 +109,7 @@
         copy_segments_ring
             <
                 typename geometry::ring_type<Polygon>::type,
+ Reverse,
                 SegmentIdentifier,
                 RangeOut
>::apply
@@ -178,6 +185,7 @@
 <
     typename Tag,
     typename GeometryIn,
+ bool Reverse,
     typename SegmentIdentifier,
     typename RangeOut,
     order_selector Order
@@ -195,14 +203,15 @@
 template
 <
     typename Ring,
+ bool Reverse,
     typename SegmentIdentifier,
     typename RangeOut,
     order_selector Order
>
-struct copy_segments<ring_tag, Ring, SegmentIdentifier, RangeOut, Order>
+struct copy_segments<ring_tag, Ring, Reverse, SegmentIdentifier, RangeOut, Order>
     : detail::copy_segments::copy_segments_ring
         <
- Ring, SegmentIdentifier, RangeOut
+ Ring, Reverse, SegmentIdentifier, RangeOut
>
 {};
 
@@ -210,14 +219,15 @@
 template
 <
     typename Polygon,
+ bool Reverse,
     typename SegmentIdentifier,
     typename RangeOut,
     order_selector Order
>
-struct copy_segments<polygon_tag, Polygon, SegmentIdentifier, RangeOut, Order>
+struct copy_segments<polygon_tag, Polygon, Reverse, SegmentIdentifier, RangeOut, Order>
     : detail::copy_segments::copy_segments_polygon
         <
- Polygon, SegmentIdentifier, RangeOut
+ Polygon, Reverse, SegmentIdentifier, RangeOut
>
 {};
 
@@ -225,11 +235,12 @@
 template
 <
     typename Box,
+ bool Reverse,
     typename SegmentIdentifier,
     typename RangeOut,
     order_selector Order
>
-struct copy_segments<box_tag, Box, SegmentIdentifier, RangeOut, Order>
+struct copy_segments<box_tag, Box, Reverse, SegmentIdentifier, RangeOut, Order>
     : detail::copy_segments::copy_segments_box
         <
             Box, SegmentIdentifier, RangeOut, Order
@@ -250,6 +261,7 @@
 template
 <
     order_selector Order,
+ bool Reverse,
     typename Geometry,
     typename SegmentIdentifier,
     typename RangeOut
@@ -264,6 +276,7 @@
         <
             typename tag<Geometry>::type,
             Geometry,
+ Reverse,
             SegmentIdentifier,
             RangeOut,
             Order

Modified: sandbox/geometry/boost/geometry/algorithms/detail/overlay/dissolver.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/overlay/dissolver.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/dissolver.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -128,6 +128,7 @@
         detail::disjoint::disjoint_interrupt_policy policy;
         geometry::get_turns
             <
+ false, false,
                 overlay::assign_null_policy
>(a, b, turns, policy);
 

Modified: sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -111,8 +111,8 @@
             <
                 typename tag<Geometry1>::type,
                 typename tag<Geometry2>::type,
- Geometry1,
- Geometry2,
+ Geometry1, Geometry2,
+ false, false,
                 Turns, TurnPolicy,
                 //segment_intersection_strategy_type,
                 detail::get_turns::no_interrupt_policy
@@ -121,8 +121,8 @@
             <
                 typename tag<Geometry1>::type,
                 typename tag<Geometry2>::type,
- Geometry1,
- Geometry2,
+ Geometry1, Geometry2,
+ false, false,
                 Turns, TurnPolicy,
                 //segment_intersection_strategy_type,
                 detail::get_turns::no_interrupt_policy

Modified: sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_turns.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_turns.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/get_turns.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -30,6 +30,8 @@
 #include <boost/geometry/geometries/concepts/check.hpp>
 
 #include <boost/geometry/util/math.hpp>
+#include <boost/geometry/util/closeable_view.hpp>
+#include <boost/geometry/util/reversible_view.hpp>
 
 #include <boost/geometry/geometries/box.hpp>
 
@@ -83,6 +85,7 @@
 template
 <
     typename Geometry1, typename Geometry2,
+ bool Reverse1, bool Reverse2,
     typename Section1, typename Section2,
     typename Turns,
     typename TurnPolicy,
@@ -94,11 +97,22 @@
         <
             typename range_type<Geometry1>::type const,
             closure<Geometry1>::value
- >::type view_type1;
+ >::type cview_type1;
     typedef typename closeable_view
         <
             typename range_type<Geometry2>::type const,
             closure<Geometry2>::value
+ >::type cview_type2;
+
+ typedef typename reversible_view
+ <
+ cview_type1 const,
+ Reverse1 ? iterate_reverse : iterate_forward
+ >::type view_type1;
+ typedef typename reversible_view
+ <
+ cview_type2 const,
+ Reverse2 ? iterate_reverse : iterate_forward
>::type view_type2;
 
     typedef typename boost::range_iterator
@@ -121,8 +135,10 @@
             Turns& turns,
             InterruptPolicy& interrupt_policy)
     {
- view_type1 view1 = get_full_section<view_type1>(geometry1, sec1);
- view_type2 view2 = get_full_section<view_type2>(geometry2, sec2);
+ cview_type1 cview1(range_by_section(geometry1, sec1));
+ cview_type2 cview2(range_by_section(geometry2, sec2));
+ view_type1 view1(cview1);
+ view_type2 view2(cview2);
 
         range1_iterator begin_range_1 = boost::begin(view1);
         range1_iterator end_range_1 = boost::end(view1);
@@ -309,8 +325,8 @@
 
 template
 <
- typename Geometry1,
- typename Geometry2,
+ typename Geometry1, typename Geometry2,
+ bool Reverse1, bool Reverse2,
     typename Turns,
     typename TurnPolicy,
     typename InterruptPolicy
@@ -376,6 +392,7 @@
                                 <
                                     Geometry1,
                                     Geometry2,
+ Reverse1, Reverse2,
                                     typename boost::range_value<Sections1>::type,
                                     typename boost::range_value<Sections2>::type,
                                     Turns,
@@ -485,8 +502,8 @@
         sections1_type sec1;
         sections2_type sec2;
 
- geometry::sectionalize(geometry1, sec1);
- geometry::sectionalize(geometry2, sec2);
+ geometry::sectionalize<Reverse1>(geometry1, sec1);
+ geometry::sectionalize<Reverse2>(geometry2, sec2);
 
         // Divide and conquer
         model::box<point_type> box;
@@ -724,6 +741,7 @@
 <
     typename GeometryTag1, typename GeometryTag2,
     typename Geometry1, typename Geometry2,
+ bool Reverse1, bool Reverse2,
     typename Turns,
     typename TurnPolicy,
     typename InterruptPolicy
@@ -731,8 +749,8 @@
 struct get_turns
     : detail::get_turns::get_turns_generic
         <
- Geometry1,
- Geometry2,
+ Geometry1, Geometry2,
+ Reverse1, Reverse2,
             Turns,
             TurnPolicy,
             InterruptPolicy
@@ -742,8 +760,8 @@
 
 template
 <
- typename Polygon,
- typename Box,
+ typename Polygon, typename Box,
+ bool ReversePolygon, bool ReverseBox,
     typename Turns,
     typename TurnPolicy,
     typename InterruptPolicy
@@ -752,6 +770,7 @@
     <
         polygon_tag, box_tag,
         Polygon, Box,
+ ReversePolygon, ReverseBox,
         Turns,
         TurnPolicy,
         InterruptPolicy
@@ -765,8 +784,8 @@
 
 template
 <
- typename Ring,
- typename Box,
+ typename Ring, typename Box,
+ bool ReverseRing, bool ReverseBox,
     typename Turns,
     typename TurnPolicy,
     typename InterruptPolicy
@@ -775,6 +794,7 @@
     <
         ring_tag, box_tag,
         Ring, Box,
+ ReverseRing, ReverseBox,
         Turns,
         TurnPolicy,
         InterruptPolicy
@@ -791,6 +811,7 @@
 <
     typename GeometryTag1, typename GeometryTag2,
     typename Geometry1, typename Geometry2,
+ bool Reverse1, bool Reverse2,
     typename Turns,
     typename TurnPolicy,
     typename InterruptPolicy
@@ -806,6 +827,7 @@
             <
                 GeometryTag2, GeometryTag1,
                 Geometry2, Geometry1,
+ Reverse2, Reverse1,
                 Turns, TurnPolicy,
                 InterruptPolicy
>::apply(source_id2, g2, source_id1, g1, turns, interrupt_policy);
@@ -832,6 +854,7 @@
  */
 template
 <
+ bool Reverse1, bool Reverse2,
     typename AssignPolicy,
     typename Geometry1,
     typename Geometry2,
@@ -868,8 +891,8 @@
             <
                 typename tag<Geometry1>::type,
                 typename tag<Geometry2>::type,
- Geometry1,
- Geometry2,
+ Geometry1, Geometry2,
+ Reverse1, Reverse2,
                 Turns, TurnPolicy,
                 InterruptPolicy
>,
@@ -877,8 +900,8 @@
             <
                 typename tag<Geometry1>::type,
                 typename tag<Geometry2>::type,
- Geometry1,
- Geometry2,
+ Geometry1, Geometry2,
+ Reverse1, Reverse2,
                 Turns, TurnPolicy,
                 InterruptPolicy
>

Modified: sandbox/geometry/boost/geometry/algorithms/detail/overlay/overlay.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/overlay/overlay.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/overlay.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -11,7 +11,6 @@
 
 #include <deque>
 #include <map>
-#include <vector>
 
 #include <boost/range.hpp>
 #include <boost/mpl/assert.hpp>
@@ -29,6 +28,7 @@
 
 
 #include <boost/geometry/algorithms/num_points.hpp>
+#include <boost/geometry/algorithms/reverse.hpp>
 
 #include <boost/geometry/iterators/range_type.hpp>
 
@@ -51,6 +51,7 @@
 template
 <
     typename Geometry1, typename Geometry2,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator, typename GeometryOut,
     int Direction, order_selector Order,
     typename Strategy
@@ -76,6 +77,7 @@
         // for ring, it is the ring itself. That is what is
         // for multi-polygon, it is also the type of the ring.
         typedef typename geometry::range_type<GeometryOut>::type ring_type;
+ typedef std::deque<ring_type> ring_container_type;
 
         // If one input is empty, output the other one for a union.
         // For an intersection, the intersection is empty.
@@ -85,7 +87,7 @@
             if (Direction == 1)
             {
                 std::map<ring_identifier, int> map;
- std::vector<ring_type> rings;
+ ring_container_type rings;
                 return assemble<GeometryOut>(rings, map,
                                 geometry1, geometry2, Direction, false, false, out);
             }
@@ -100,6 +102,7 @@
         detail::get_turns::no_interrupt_policy policy;
         boost::geometry::get_turns
             <
+ Reverse1, Reverse2,
                 detail::overlay::calculate_distance_policy
>(geometry1, geometry2, turn_points, policy);
 
@@ -122,14 +125,27 @@
 #ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
 std::cout << "traverse" << std::endl;
 #endif
- std::vector<ring_type> rings;
- geometry::traverse<Order>(geometry1, geometry2,
+ ring_container_type rings;
+ geometry::traverse<Order, Reverse1, Reverse2>(geometry1, geometry2,
                 Direction == -1
                     ? boost::geometry::detail::overlay::operation_intersection
                     : boost::geometry::detail::overlay::operation_union
                     ,
                 turn_points, rings);
 
+ // TEMP condition, reversal should be done in traverse by calling "push_front"
+ if (Reverse1 && Reverse2)
+ {
+ for (typename boost::range_iterator<ring_container_type>::type
+ it = boost::begin(rings);
+ it != boost::end(rings);
+ ++it)
+ {
+ geometry::reverse(*it);
+ }
+ }
+
+
         std::map<ring_identifier, int> map;
         map_turns(map, turn_points);
         return assemble<GeometryOut>(rings, map,
@@ -138,6 +154,24 @@
 };
 
 
+// Metafunction helper for intersection and union
+template <order_selector Selector, bool Reverse>
+struct do_reverse {};
+
+template <>
+struct do_reverse<clockwise, false> : boost::false_type {};
+
+template <>
+struct do_reverse<clockwise, true> : boost::true_type {};
+
+template <>
+struct do_reverse<counterclockwise, false> : boost::true_type {};
+
+template <>
+struct do_reverse<counterclockwise, true> : boost::false_type {};
+
+
+
 }} // namespace detail::overlay
 #endif // DOXYGEN_NO_DETAIL
 

Modified: sandbox/geometry/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -50,7 +50,7 @@
> sections_type;
 
         sections_type sec;
- geometry::sectionalize(geometry, sec);
+ geometry::sectionalize<false>(geometry, sec);
 
         for (typename boost::range_iterator<sections_type const>::type
                     it1 = sec.begin();
@@ -71,6 +71,7 @@
                     if (! geometry::detail::get_turns::get_turns_in_sections
                         <
                             Geometry, Geometry,
+ false, false,
                             typename boost::range_value<sections_type>::type,
                             typename boost::range_value<sections_type>::type,
                             Turns, TurnPolicy,

Modified: sandbox/geometry/boost/geometry/algorithms/detail/overlay/traverse.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/overlay/traverse.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/overlay/traverse.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -105,6 +105,7 @@
 template
 <
     order_selector Order,
+ bool Reverse1, bool Reverse2,
     typename GeometryOut,
     typename G1,
     typename G2,
@@ -131,13 +132,13 @@
 
         if (info.seg_id.source_index == 0)
         {
- geometry::copy_segments<Order>(g1, info.seg_id,
+ geometry::copy_segments<Order, Reverse1>(g1, info.seg_id,
                     info.enriched.travels_to_vertex_index,
                     current_output);
         }
         else
         {
- geometry::copy_segments<Order>(g2, info.seg_id,
+ geometry::copy_segments<Order, Reverse2>(g2, info.seg_id,
                     info.enriched.travels_to_vertex_index,
                     current_output);
         }
@@ -303,6 +304,7 @@
 template
 <
     order_selector Order,
+ bool Reverse1, bool Reverse2,
     typename Geometry1,
     typename Geometry2,
     typename Turns,
@@ -353,7 +355,8 @@
                         turn_operation_iterator_type current_iit = iit;
                         segment_identifier current_seg_id;
 
- if (! detail::overlay::assign_next_ip<Order>(geometry1, geometry2,
+ if (! detail::overlay::assign_next_ip<Order, Reverse1, Reverse2>(
+ geometry1, geometry2,
                                     turns,
                                     current, current_output,
                                     *iit, current_seg_id))
@@ -413,7 +416,8 @@
                                     // will continue with the next one.
 
                                     // Below three reasons to stop.
- detail::overlay::assign_next_ip<Order>(geometry1, geometry2,
+ detail::overlay::assign_next_ip<Order, Reverse1, Reverse2>(
+ geometry1, geometry2,
                                         turns, current, current_output,
                                         *current_iit, current_seg_id);
 

Modified: sandbox/geometry/boost/geometry/algorithms/detail/sections/get_full_section.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/sections/get_full_section.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/sections/get_full_section.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -17,7 +17,6 @@
 #include <boost/geometry/core/closure.hpp>
 #include <boost/geometry/core/exterior_ring.hpp>
 #include <boost/geometry/core/interior_rings.hpp>
-#include <boost/geometry/util/closeable_view.hpp>
 
 
 
@@ -29,20 +28,12 @@
 {
 
 
-
-
 template <typename Range, typename Section>
 struct full_section_range
 {
- typedef typename closeable_view
- <
- Range const,
- closure<Range>::value
- >::type view_type;
-
- static inline view_type apply(Range const& range, Section const& section)
+ static inline Range const& apply(Range const& range, Section const& section)
     {
- return view_type(range);
+ return range;
     }
 };
 
@@ -51,20 +42,12 @@
 struct full_section_polygon
 {
     typedef typename geometry::ring_type<Polygon>::type ring_type;
- typedef typename closeable_view
- <
- ring_type const,
- closure<ring_type>::value
- >::type view_type;
 
- static inline view_type apply(Polygon const& polygon, Section const& section)
+ static inline typename ring_return_type<Polygon const>::type apply(Polygon const& polygon, Section const& section)
     {
-
- ring_type const& ring = section.ring_index < 0
+ return section.ring_index < 0
             ? geometry::exterior_ring(polygon)
             : geometry::interior_rings(polygon)[section.ring_index];
-
- return view_type(ring);
     }
 };
 
@@ -84,7 +67,7 @@
     typename Geometry,
     typename Section
>
-struct get_full_section
+struct range_by_section
 {
     BOOST_MPL_ASSERT_MSG
         (
@@ -95,19 +78,19 @@
 
 
 template <typename LineString, typename Section>
-struct get_full_section<linestring_tag, LineString, Section>
+struct range_by_section<linestring_tag, LineString, Section>
     : detail::section::full_section_range<LineString, Section>
 {};
 
 
 template <typename Ring, typename Section>
-struct get_full_section<ring_tag, Ring, Section>
+struct range_by_section<ring_tag, Ring, Section>
     : detail::section::full_section_range<Ring, Section>
 {};
 
 
 template <typename Polygon, typename Section>
-struct get_full_section<polygon_tag, Polygon, Section>
+struct range_by_section<polygon_tag, Polygon, Section>
     : detail::section::full_section_polygon<Polygon, Section>
 {};
 
@@ -117,23 +100,21 @@
 
 
 /*!
- \brief Get a closeable view indicated by the specified section
+ \brief Get full ring (exterior, one of interiors, one from multi)
+ indicated by the specified section
     \ingroup sectionalize
     \tparam Geometry type
     \tparam Section type of section to get from
     \param geometry geometry to take section of
     \param section structure with section
- \param begin begin-iterator (const iterator over points of section)
- \param end end-iterator (const iterator over points of section)
- \todo Create non-const version as well
-
  */
-template <typename Range, typename Geometry, typename Section>
-inline Range get_full_section(Geometry const& geometry, Section const& section)
+template <typename Geometry, typename Section>
+inline typename ring_return_type<Geometry const>::type
+ range_by_section(Geometry const& geometry, Section const& section)
 {
     concept::check<Geometry const>();
 
- return dispatch::get_full_section
+ return dispatch::range_by_section
         <
             typename tag<Geometry>::type,
             Geometry,

Modified: sandbox/geometry/boost/geometry/algorithms/detail/sections/sectionalize.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/detail/sections/sectionalize.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/detail/sections/sectionalize.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -27,6 +27,7 @@
 #include <boost/geometry/geometries/concepts/check.hpp>
 #include <boost/geometry/util/math.hpp>
 #include <boost/geometry/util/closeable_view.hpp>
+#include <boost/geometry/util/reversible_view.hpp>
 #include <boost/geometry/geometries/segment.hpp>
 
 
@@ -345,7 +346,7 @@
 
 template
 <
- typename Range, closure_selector Closure,
+ typename Range, closure_selector Closure, bool Reverse,
     typename Point,
     typename Sections,
     std::size_t DimensionCount,
@@ -353,14 +354,20 @@
>
 struct sectionalize_range
 {
- typedef typename closeable_view<Range const, Closure>::type view_type;
+ typedef typename closeable_view<Range const, Closure>::type cview_type;
+ typedef typename reversible_view
+ <
+ cview_type const,
+ Reverse ? iterate_reverse : iterate_forward
+ >::type view_type;
 
     static inline void apply(Range const& range, Sections& sections,
                 int ring_index = -1, int multi_index = -1)
     {
         typedef model::referring_segment<Point const> segment_type;
 
- view_type view(range);
+ cview_type cview(range);
+ view_type view(cview);
 
         std::size_t const n = boost::size(view);
         if (n == 0)
@@ -399,6 +406,7 @@
 template
 <
     typename Polygon,
+ bool Reverse,
     typename Sections,
     std::size_t DimensionCount,
     std::size_t MaxCount
@@ -412,7 +420,7 @@
         typedef typename ring_type<Polygon>::type ring_type;
         typedef sectionalize_range
             <
- ring_type, closure<Polygon>::value,
+ ring_type, closure<Polygon>::value, Reverse,
                 point_type, Sections, DimensionCount, MaxCount
> sectionalizer_type;
 
@@ -463,7 +471,7 @@
 
         sectionalize_range
             <
- std::vector<point_type>, closed,
+ std::vector<point_type>, closed, false,
                 point_type,
                 Sections,
                 DimensionCount,
@@ -498,6 +506,7 @@
 <
     typename Tag,
     typename Geometry,
+ bool Reverse,
     typename Sections,
     std::size_t DimensionCount,
     std::size_t MaxCount
@@ -514,11 +523,12 @@
 template
 <
     typename Box,
+ bool Reverse,
     typename Sections,
     std::size_t DimensionCount,
     std::size_t MaxCount
>
-struct sectionalize<box_tag, Box, Sections, DimensionCount, MaxCount>
+struct sectionalize<box_tag, Box, Reverse, Sections, DimensionCount, MaxCount>
     : detail::sectionalize::sectionalize_box
         <
             Box,
@@ -530,8 +540,8 @@
 
 template
 <
- typename LineString, typename
- Sections,
+ typename LineString,
+ typename Sections,
     std::size_t DimensionCount,
     std::size_t MaxCount
>
@@ -539,13 +549,14 @@
     <
         linestring_tag,
         LineString,
+ false,
         Sections,
         DimensionCount,
         MaxCount
>
     : detail::sectionalize::sectionalize_range
         <
- LineString, closed,
+ LineString, closed, false,
             typename point_type<LineString>::type,
             Sections,
             DimensionCount,
@@ -556,14 +567,15 @@
 template
 <
     typename Ring,
+ bool Reverse,
     typename Sections,
     std::size_t DimensionCount,
     std::size_t MaxCount
>
-struct sectionalize<ring_tag, Ring, Sections, DimensionCount, MaxCount>
+struct sectionalize<ring_tag, Ring, Reverse, Sections, DimensionCount, MaxCount>
     : detail::sectionalize::sectionalize_range
         <
- Ring, geometry::closure<Ring>::value,
+ Ring, geometry::closure<Ring>::value, Reverse,
             typename point_type<Ring>::type,
             Sections,
             DimensionCount,
@@ -574,14 +586,15 @@
 template
 <
     typename Polygon,
+ bool Reverse,
     typename Sections,
     std::size_t DimensionCount,
     std::size_t MaxCount
>
-struct sectionalize<polygon_tag, Polygon, Sections, DimensionCount, MaxCount>
+struct sectionalize<polygon_tag, Polygon, Reverse, Sections, DimensionCount, MaxCount>
     : detail::sectionalize::sectionalize_polygon
         <
- Polygon, Sections, DimensionCount, MaxCount
+ Polygon, Reverse, Sections, DimensionCount, MaxCount
>
 {};
 
@@ -598,7 +611,7 @@
     \param sections structure with sections
 
  */
-template<typename Geometry, typename Sections>
+template<bool Reverse, typename Geometry, typename Sections>
 inline void sectionalize(Geometry const& geometry, Sections& sections)
 {
     concept::check<Geometry const>();
@@ -609,6 +622,7 @@
         <
             typename tag<Geometry>::type,
             Geometry,
+ Reverse,
             Sections,
             Sections::value,
             max_segments_per_section

Modified: sandbox/geometry/boost/geometry/algorithms/difference.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/difference.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/difference.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -10,10 +10,7 @@
 
 #include <algorithm>
 
-
 #include <boost/geometry/algorithms/intersection.hpp>
-#include <boost/geometry/algorithms/reverse.hpp>
-
 
 namespace boost { namespace geometry
 {
@@ -37,14 +34,27 @@
     typename Collection
>
 inline void difference(Geometry1 const& geometry1,
- Geometry2 geometry2, Collection& output_collection)
+ Geometry2 const& geometry2, Collection& output_collection)
 {
     concept::check<Geometry1 const>();
- concept::check<Geometry2>();
+ concept::check<Geometry2 const>();
 
- reverse(geometry2);
+ typedef typename boost::range_value<Collection>::type geometry_out;
+ concept::check<geometry_out>();
 
- intersection(geometry1, geometry2, output_collection);
+ typedef strategy_intersection
+ <
+ typename cs_tag<geometry_out>::type,
+ Geometry1,
+ Geometry2,
+ typename geometry::point_type<geometry_out>::type
+ > strategy;
+
+
+ detail::intersection::inserter<geometry_out, false, true>(
+ geometry1, geometry2,
+ std::back_inserter(output_collection),
+ strategy());
 }
 
 

Modified: sandbox/geometry/boost/geometry/algorithms/disjoint.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/disjoint.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/disjoint.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -54,6 +54,7 @@
         disjoint_interrupt_policy policy;
         geometry::get_turns
             <
+ false, false,
                 overlay::assign_null_policy
>(geometry1, geometry2, turns, policy);
         if (policy.has_intersections)

Modified: sandbox/geometry/boost/geometry/algorithms/dissolve.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/dissolve.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/dissolve.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -83,7 +83,7 @@
 
 
             // Traverse the polygons twice in two different directions
- traverse<point_order<Geometry>::value>(geometry, geometry,
+ traverse<point_order<Geometry>::value, false, false>(geometry, geometry,
                             detail::overlay::operation_union,
                             turns, rings);
 
@@ -95,7 +95,7 @@
                         side_strategy_type());
 
 
- traverse<point_order<Geometry>::value>(geometry, geometry,
+ traverse<point_order<Geometry>::value, false, false>(geometry, geometry,
                             detail::overlay::operation_intersection,
                             turns, rings);
 

Modified: sandbox/geometry/boost/geometry/algorithms/intersection.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/intersection.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/intersection.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -116,11 +116,11 @@
     // tag dispatching:
     typename TagIn1, typename TagIn2, typename TagOut,
     // orientation
- order_selector Order1, order_selector Order2, order_selector OrderOut,
     // metafunction finetuning helpers:
     bool Areal1, bool Areal2, bool ArealOut,
     // real types
     typename Geometry1, typename Geometry2,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator,
     typename GeometryOut,
     typename Strategy
@@ -139,6 +139,7 @@
 <
     typename TagIn1, typename TagIn2, typename TagOut,
     typename Geometry1, typename Geometry2,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator,
     typename GeometryOut,
     typename Strategy
@@ -146,44 +147,22 @@
 struct intersection_inserter
     <
         TagIn1, TagIn2, TagOut,
- clockwise, clockwise, clockwise,
         true, true, true,
         Geometry1, Geometry2,
+ Reverse1, Reverse2,
         OutputIterator, GeometryOut,
         Strategy
> : detail::overlay::overlay
- <Geometry1, Geometry2, OutputIterator, GeometryOut, -1, clockwise, Strategy>
+ <Geometry1, Geometry2, Reverse1, Reverse2, OutputIterator, GeometryOut, -1, clockwise, Strategy>
 {};
 
 
-// All counter clockwise:
-template
-<
- typename TagIn1, typename TagIn2, typename TagOut,
- typename Geometry1, typename Geometry2,
- typename OutputIterator,
- typename GeometryOut,
- typename Strategy
->
-struct intersection_inserter
- <
- TagIn1, TagIn2, TagOut,
- counterclockwise, counterclockwise, counterclockwise,
- true, true, true,
- Geometry1, Geometry2,
- OutputIterator, GeometryOut,
- Strategy
- > : detail::overlay::overlay
- <Geometry1, Geometry2, OutputIterator, GeometryOut, -1, counterclockwise, Strategy>
-{};
-
-
-// Boxes are never counter clockwise.
-// Any counter areal type with box:
+// Any areal type with box:
 template
 <
     typename TagIn, typename TagOut,
     typename Geometry, typename Box,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator,
     typename GeometryOut,
     typename Strategy
@@ -191,28 +170,29 @@
 struct intersection_inserter
     <
         TagIn, box_tag, TagOut,
- counterclockwise, clockwise, counterclockwise,
         true, true, true,
         Geometry, Box,
+ Reverse1, Reverse2,
         OutputIterator, GeometryOut,
         Strategy
> : detail::overlay::overlay
- <Geometry, Box, OutputIterator, GeometryOut, -1, counterclockwise, Strategy>
+ <Geometry, Box, Reverse1, Reverse2, OutputIterator, GeometryOut, -1, clockwise, Strategy>
 {};
 
 
 template
 <
     typename Segment1, typename Segment2,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator, typename GeometryOut,
     typename Strategy
>
 struct intersection_inserter
     <
         segment_tag, segment_tag, point_tag,
- clockwise, clockwise, clockwise,
         false, false, false,
         Segment1, Segment2,
+ Reverse1, Reverse2,
         OutputIterator, GeometryOut,
         Strategy
> : detail::intersection::intersection_segment_segment_point
@@ -227,15 +207,16 @@
 template
 <
     typename Linestring1, typename Linestring2,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator, typename GeometryOut,
- typename Strategy, order_selector Order
+ typename Strategy
>
 struct intersection_inserter
     <
         linestring_tag, linestring_tag, point_tag,
- Order, Order, Order,
         false, false, false,
         Linestring1, Linestring2,
+ Reverse1, Reverse2,
         OutputIterator, GeometryOut,
         Strategy
> : detail::intersection::intersection_linestring_linestring_point
@@ -250,15 +231,16 @@
 template
 <
     typename Linestring, typename Box,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator, typename GeometryOut,
- typename Strategy, order_selector Order
+ typename Strategy
>
 struct intersection_inserter
     <
         linestring_tag, box_tag, linestring_tag,
- Order, Order, Order,
         false, true, false,
         Linestring, Box,
+ Reverse1, Reverse2,
         OutputIterator, GeometryOut,
         Strategy
>
@@ -276,15 +258,16 @@
 template
 <
     typename Segment, typename Box,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator, typename GeometryOut,
- typename Strategy, order_selector Order
+ typename Strategy
>
 struct intersection_inserter
     <
         segment_tag, box_tag, linestring_tag,
- Order, Order, Order,
         false, true, false,
         Segment, Box,
+ Reverse1, Reverse2,
         OutputIterator, GeometryOut,
         Strategy
>
@@ -306,9 +289,9 @@
 template
 <
     typename GeometryTag1, typename GeometryTag2, typename GeometryTag3,
- order_selector Order1, order_selector Order2, order_selector OrderOut,
     bool Areal1, bool Areal2, bool ArealOut,
     typename Geometry1, typename Geometry2,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator, typename GeometryOut,
     typename Strategy
>
@@ -321,9 +304,9 @@
         return intersection_inserter
             <
                 GeometryTag2, GeometryTag1, GeometryTag3,
- Order2, Order1, OrderOut,
                 Areal2, Areal1, ArealOut,
                 Geometry2, Geometry1,
+ Reverse1, Reverse2,
                 OutputIterator, GeometryOut,
                 Strategy
>::apply(g2, g1, out, strategy);
@@ -335,6 +318,69 @@
 } // namespace dispatch
 #endif // DOXYGEN_NO_DISPATCH
 
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail { namespace intersection
+{
+
+
+template
+<
+ typename GeometryOut,
+ bool Reverse1, bool Reverse2,
+ typename Geometry1, typename Geometry2,
+ typename OutputIterator,
+ typename Strategy
+>
+inline OutputIterator inserter(Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ OutputIterator out,
+ Strategy const& strategy)
+{
+ return boost::mpl::if_c
+ <
+ geometry::reverse_dispatch<Geometry1, Geometry2>::type::value,
+ geometry::dispatch::intersection_inserter_reversed
+ <
+ typename geometry::tag<Geometry1>::type,
+ typename geometry::tag<Geometry2>::type,
+ typename geometry::tag<GeometryOut>::type,
+ ////point_order<Geometry1>::value,
+ ////point_order<Geometry2>::value,
+ ////point_order<GeometryOut>::value,
+ geometry::is_areal<Geometry1>::value,
+ geometry::is_areal<Geometry2>::value,
+ geometry::is_areal<GeometryOut>::value,
+ Geometry1, Geometry2,
+ overlay::do_reverse<point_order<Geometry1>::value, Reverse1>::value,
+ overlay::do_reverse<point_order<Geometry2>::value, Reverse2>::value,
+ OutputIterator, GeometryOut,
+ Strategy
+ >,
+ geometry::dispatch::intersection_inserter
+ <
+ typename geometry::tag<Geometry1>::type,
+ typename geometry::tag<Geometry2>::type,
+ typename geometry::tag<GeometryOut>::type,
+ ////point_order<Geometry1>::value,
+ ///point_order<Geometry2>::value,
+ ///point_order<GeometryOut>::value,
+ geometry::is_areal<Geometry1>::value,
+ geometry::is_areal<Geometry2>::value,
+ geometry::is_areal<GeometryOut>::value,
+ Geometry1, Geometry2,
+ overlay::do_reverse<point_order<Geometry1>::value, Reverse1>::value,
+ overlay::do_reverse<point_order<Geometry2>::value, Reverse2>::value,
+ OutputIterator, GeometryOut,
+ Strategy
+ >
+ >::type::apply(geometry1, geometry2, out, strategy);
+}
+
+
+}} // namespace detail::intersection
+#endif // DOXYGEN_NO_DETAIL
+
 /*!
 \brief \brief_calc2{intersection} \brief_strategy
 \ingroup intersection
@@ -372,42 +418,8 @@
     concept::check<Geometry1 const>();
     concept::check<Geometry2 const>();
 
- return boost::mpl::if_c
- <
- reverse_dispatch<Geometry1, Geometry2>::type::value,
- dispatch::intersection_inserter_reversed
- <
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
- typename tag<GeometryOut>::type,
- point_order<Geometry1>::value,
- point_order<Geometry2>::value,
- point_order<GeometryOut>::value,
- is_areal<Geometry1>::value,
- is_areal<Geometry2>::value,
- is_areal<GeometryOut>::value,
- Geometry1,
- Geometry2,
- OutputIterator, GeometryOut,
- Strategy
- >,
- dispatch::intersection_inserter
- <
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
- typename tag<GeometryOut>::type,
- point_order<Geometry1>::value,
- point_order<Geometry2>::value,
- point_order<GeometryOut>::value,
- is_areal<Geometry1>::value,
- is_areal<Geometry2>::value,
- is_areal<GeometryOut>::value,
- Geometry1,
- Geometry2,
- OutputIterator, GeometryOut,
- Strategy
- >
- >::type::apply(geometry1, geometry2, out, strategy);
+ return detail::intersection::inserter<GeometryOut, false, false>(
+ geometry1, geometry2, out, strategy);
 }
 
 

Modified: sandbox/geometry/boost/geometry/algorithms/sym_difference.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/sym_difference.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/sym_difference.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -12,7 +12,6 @@
 
 
 #include <boost/geometry/algorithms/intersection.hpp>
-#include <boost/geometry/algorithms/reverse.hpp>
 
 
 namespace boost { namespace geometry
@@ -36,17 +35,32 @@
     typename Geometry2,
     typename Collection
>
-inline void sym_difference(Geometry1 geometry1,
- Geometry2 geometry2, Collection& output_collection)
+inline void sym_difference(Geometry1 const& geometry1,
+ Geometry2 const& geometry2, Collection& output_collection)
 {
- concept::check<Geometry1>();
- concept::check<Geometry2>();
+ concept::check<Geometry1 const>();
+ concept::check<Geometry2 const>();
 
- reverse(geometry2);
- intersection(geometry1, geometry2, output_collection);
- reverse(geometry2);
- reverse(geometry1);
- intersection(geometry1, geometry2, output_collection);
+ typedef typename boost::range_value<Collection>::type geometry_out;
+ concept::check<geometry_out>();
+
+ typedef strategy_intersection
+ <
+ typename cs_tag<geometry_out>::type,
+ Geometry1,
+ Geometry2,
+ typename geometry::point_type<geometry_out>::type
+ > strategy;
+
+
+ detail::intersection::inserter<geometry_out, false, true>(
+ geometry1, geometry2,
+ std::back_inserter(output_collection),
+ strategy());
+ detail::intersection::inserter<geometry_out, true, false>(
+ geometry1, geometry2,
+ std::back_inserter(output_collection),
+ strategy());
 }
 
 

Modified: sandbox/geometry/boost/geometry/algorithms/union.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/union.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/union.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -32,12 +32,11 @@
 <
     // tag dispatching:
     typename TagIn1, typename TagIn2, typename TagOut,
- // orientation
- order_selector Order1, order_selector Order2, order_selector OrderOut,
     // metafunction finetuning helpers:
     bool Areal1, bool Areal2, bool ArealOut,
     // real types
     typename Geometry1, typename Geometry2,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator,
     typename GeometryOut,
     typename Strategy
@@ -56,6 +55,7 @@
 <
     typename TagIn1, typename TagIn2, typename TagOut,
     typename Geometry1, typename Geometry2,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator,
     typename GeometryOut,
     typename Strategy
@@ -63,43 +63,23 @@
 struct union_inserter
     <
         TagIn1, TagIn2, TagOut,
- clockwise, clockwise, clockwise,
         true, true, true,
         Geometry1, Geometry2,
+ Reverse1, Reverse2,
         OutputIterator, GeometryOut,
         Strategy
> : detail::overlay::overlay
- <Geometry1, Geometry2, OutputIterator, GeometryOut, 1, clockwise, Strategy>
+ <Geometry1, Geometry2, Reverse1, Reverse2, OutputIterator, GeometryOut, 1, clockwise, Strategy>
 {};
 
 
-template
-<
- typename TagIn1, typename TagIn2, typename TagOut,
- typename Geometry1, typename Geometry2,
- typename OutputIterator,
- typename GeometryOut,
- typename Strategy
->
-struct union_inserter
- <
- TagIn1, TagIn2, TagOut,
- counterclockwise, counterclockwise, counterclockwise,
- true, true, true,
- Geometry1, Geometry2,
- OutputIterator, GeometryOut,
- Strategy
- > : detail::overlay::overlay
- <Geometry1, Geometry2, OutputIterator, GeometryOut, 1, counterclockwise, Strategy>
-{};
-
 
 template
 <
     typename GeometryTag1, typename GeometryTag2, typename GeometryTag3,
- order_selector Order1, order_selector Order2, order_selector OrderOut,
     bool Areal1, bool Areal2, bool ArealOut,
     typename Geometry1, typename Geometry2,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator, typename GeometryOut,
     typename Strategy
>
@@ -112,9 +92,9 @@
         return union_inserter
             <
                 GeometryTag2, GeometryTag1, GeometryTag3,
- Order2, Order1, OrderOut,
                 Areal2, Areal1, ArealOut,
                 Geometry2, Geometry1,
+ Reverse2, Reverse1,
                 OutputIterator, GeometryOut,
                 Strategy
>::apply(g2, g1, out, strategy);
@@ -125,53 +105,37 @@
 } // namespace dispatch
 #endif // DOXYGEN_NO_DISPATCH
 
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail { namespace union_
+{
 
-/*!
-\brief Combines two geometries which each other
-\ingroup union
-\tparam GeometryOut output geometry type, must be specified
-\tparam Geometry1 \tparam_geometry
-\tparam Geometry2 \tparam_geometry
-\tparam OutputIterator output iterator
-\tparam Strategy compound strategy for intersection
-\param geometry1 \param_geometry
-\param geometry2 \param_geometry
-\param out the output iterator, outputting polygons
-\param strategy the strategy
-\return the output iterator
-*/
 template
 <
     typename GeometryOut,
- typename Geometry1,
- typename Geometry2,
+ bool Reverse1, bool Reverse2,
+ typename Geometry1, typename Geometry2,
     typename OutputIterator,
     typename Strategy
>
-inline OutputIterator union_inserter(Geometry1 const& geometry1,
+inline OutputIterator inserter(Geometry1 const& geometry1,
             Geometry2 const& geometry2,
             OutputIterator out,
             Strategy const& strategy)
 {
- concept::check<Geometry1 const>();
- concept::check<Geometry2 const>();
-
     return boost::mpl::if_c
         <
- reverse_dispatch<Geometry1, Geometry2>::type::value,
+ geometry::reverse_dispatch<Geometry1, Geometry2>::type::value,
             dispatch::union_inserter_reversed
             <
                 typename tag<Geometry1>::type,
                 typename tag<Geometry2>::type,
                 typename tag<GeometryOut>::type,
- point_order<Geometry1>::value,
- point_order<Geometry2>::value,
- point_order<GeometryOut>::value,
- is_areal<Geometry1>::value,
- is_areal<Geometry2>::value,
- is_areal<GeometryOut>::value,
- Geometry1,
- Geometry2,
+ geometry::is_areal<Geometry1>::value,
+ geometry::is_areal<Geometry2>::value,
+ geometry::is_areal<GeometryOut>::value,
+ Geometry1, Geometry2,
+ overlay::do_reverse<point_order<Geometry1>::value, Reverse1>::value,
+ overlay::do_reverse<point_order<Geometry2>::value, Reverse2>::value,
                 OutputIterator, GeometryOut,
                 Strategy
>,
@@ -180,20 +144,52 @@
                 typename tag<Geometry1>::type,
                 typename tag<Geometry2>::type,
                 typename tag<GeometryOut>::type,
- point_order<Geometry1>::value,
- point_order<Geometry2>::value,
- point_order<GeometryOut>::value,
- is_areal<Geometry1>::value,
- is_areal<Geometry2>::value,
- is_areal<GeometryOut>::value,
- Geometry1,
- Geometry2,
+ geometry::is_areal<Geometry1>::value,
+ geometry::is_areal<Geometry2>::value,
+ geometry::is_areal<GeometryOut>::value,
+ Geometry1, Geometry2,
+ overlay::do_reverse<point_order<Geometry1>::value, Reverse1>::value,
+ overlay::do_reverse<point_order<Geometry2>::value, Reverse2>::value,
                 OutputIterator, GeometryOut,
                 Strategy
>
>::type::apply(geometry1, geometry2, out, strategy);
 }
 
+}} // namespace detail::intersection
+#endif // DOXYGEN_NO_DETAIL
+
+
+/*!
+\brief Combines two geometries which each other
+\ingroup union
+\tparam GeometryOut output geometry type, must be specified
+\tparam Geometry1 \tparam_geometry
+\tparam Geometry2 \tparam_geometry
+\tparam OutputIterator output iterator
+\tparam Strategy compound strategy for intersection
+\param geometry1 \param_geometry
+\param geometry2 \param_geometry
+\param out the output iterator, outputting polygons
+\param strategy the strategy
+\return the output iterator
+*/
+template
+<
+ typename GeometryOut,
+ typename Geometry1,
+ typename Geometry2,
+ typename OutputIterator,
+ typename Strategy
+>
+inline OutputIterator union_inserter(Geometry1 const& geometry1,
+ Geometry2 const& geometry2,
+ OutputIterator out,
+ Strategy const& strategy)
+{
+ return detail::union_::inserter<GeometryOut, false, false>(geometry1, geometry2, out, strategy);
+}
+
 /*!
 \brief Combines two geometries which each other
 \ingroup union

Modified: sandbox/geometry/boost/geometry/core/geometry_id.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/core/geometry_id.hpp (original)
+++ sandbox/geometry/boost/geometry/core/geometry_id.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -11,6 +11,7 @@
 #define BOOST_GEOMETRY_CORE_GEOMETRY_ID_HPP
 
 
+#include <boost/mpl/assert.hpp>
 #include <boost/mpl/int.hpp>
 #include <boost/type_traits.hpp>
 
@@ -28,7 +29,14 @@
 {
 
 template <typename GeometryTag>
-struct geometry_id {};
+struct geometry_id
+{
+ BOOST_MPL_ASSERT_MSG
+ (
+ false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
+ , (types<GeometryTag>)
+ );
+};
 
 
 template <>

Modified: sandbox/geometry/boost/geometry/core/ring_type.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/core/ring_type.hpp (original)
+++ sandbox/geometry/boost/geometry/core/ring_type.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -87,6 +87,13 @@
 {};
 
 
+template <typename LineString>
+struct ring_return_type<linestring_tag, LineString>
+{
+ typedef LineString type;
+};
+
+
 template <typename Ring>
 struct ring_return_type<ring_tag, Ring>
 {

Modified: sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp (original)
+++ sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -66,6 +66,7 @@
 template
 <
     typename MultiPolygon,
+ bool Reverse,
     typename SegmentIdentifier,
     typename RangeOut,
     order_selector Order
@@ -74,6 +75,7 @@
     <
         multi_polygon_tag,
         MultiPolygon,
+ Reverse,
         SegmentIdentifier,
         RangeOut,
         Order
@@ -86,6 +88,7 @@
             detail::copy_segments::copy_segments_polygon
                 <
                     typename boost::range_value<MultiPolygon>::type,
+ Reverse,
                     SegmentIdentifier,
                     RangeOut
>

Modified: sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp (original)
+++ sandbox/geometry/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -15,6 +15,7 @@
 #include <boost/geometry/multi/algorithms/distance.hpp>
 #include <boost/geometry/multi/iterators/range_type.hpp>
 
+#include <boost/geometry/multi/algorithms/detail/sections/get_full_section.hpp>
 #include <boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp>
 
 
@@ -76,6 +77,7 @@
 <
     typename MultiPolygon,
     typename Box,
+ bool ReverseMultiPolygon, bool ReverseBox,
     typename Turns,
     typename TurnPolicy,
     typename InterruptPolicy
@@ -84,6 +86,7 @@
     <
         multi_polygon_tag, box_tag,
         MultiPolygon, Box,
+ ReverseMultiPolygon, ReverseBox,
         Turns,
         TurnPolicy, InterruptPolicy
>

Modified: sandbox/geometry/boost/geometry/multi/algorithms/detail/sections/get_full_section.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/multi/algorithms/detail/sections/get_full_section.hpp (original)
+++ sandbox/geometry/boost/geometry/multi/algorithms/detail/sections/get_full_section.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -34,14 +34,8 @@
>
 struct full_section_multi
 {
- typedef typename geometry::ring_type<MultiGeometry>::type ring_type;
- typedef typename closeable_view
- <
- ring_type const, closure<MultiGeometry>::value
- >::type view_type;
-
- static inline view_type apply(MultiGeometry const& multi,
- Section const& section)
+ static inline typename ring_return_type<MultiGeometry const>::type apply(
+ MultiGeometry const& multi, Section const& section)
     {
         BOOST_ASSERT
             (
@@ -65,7 +59,7 @@
 
 
 template <typename MultiPolygon, typename Section>
-struct get_full_section<multi_polygon_tag, MultiPolygon, Section>
+struct range_by_section<multi_polygon_tag, MultiPolygon, Section>
     : detail::section::full_section_multi
         <
             MultiPolygon,

Modified: sandbox/geometry/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp (original)
+++ sandbox/geometry/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -53,8 +53,15 @@
 {
 
 
-template <typename MultiPolygon, typename Sections, std::size_t DimensionCount, std::size_t MaxCount>
-struct sectionalize<multi_polygon_tag, MultiPolygon, Sections, DimensionCount, MaxCount>
+template
+<
+ typename MultiPolygon,
+ bool Reverse,
+ typename Sections,
+ std::size_t DimensionCount,
+ std::size_t MaxCount
+>
+struct sectionalize<multi_polygon_tag, MultiPolygon, Reverse, Sections, DimensionCount, MaxCount>
     : detail::sectionalize::sectionalize_multi
         <
             MultiPolygon,
@@ -63,6 +70,7 @@
             detail::sectionalize::sectionalize_polygon
                 <
                     typename boost::range_value<MultiPolygon>::type,
+ Reverse,
                     Sections,
                     DimensionCount,
                     MaxCount

Modified: sandbox/geometry/boost/geometry/multi/algorithms/intersection.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/multi/algorithms/intersection.hpp (original)
+++ sandbox/geometry/boost/geometry/multi/algorithms/intersection.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -144,15 +144,17 @@
 template
 <
     typename MultiLinestring1, typename MultiLinestring2,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator, typename GeometryOut,
- typename Strategy, order_selector Order
+ typename Strategy//, order_selector Order
>
 struct intersection_inserter
     <
         multi_linestring_tag, multi_linestring_tag, point_tag,
- Order, Order, Order,
+ ////Order, Order, Order,
         false, false, false,
         MultiLinestring1, MultiLinestring2,
+ Reverse1, Reverse2,
         OutputIterator, GeometryOut,
         Strategy
> : detail::intersection::intersection_multi_linestring_multi_linestring_point
@@ -168,14 +170,16 @@
 <
     typename Linestring, typename MultiLinestring,
     typename OutputIterator, typename GeometryOut,
- typename Strategy, order_selector Order
+ bool Reverse1, bool Reverse2,
+ typename Strategy//, order_selector Order
>
 struct intersection_inserter
     <
         linestring_tag, multi_linestring_tag, point_tag,
- Order, Order, Order,
+ ////Order, Order, Order,
         false, false, false,
         Linestring, MultiLinestring,
+ Reverse1, Reverse2,
         OutputIterator, GeometryOut,
         Strategy
> : detail::intersection::intersection_linestring_multi_linestring_point
@@ -190,15 +194,17 @@
 template
 <
     typename MultiLinestring, typename Box,
+ bool Reverse1, bool Reverse2,
     typename OutputIterator, typename GeometryOut,
- typename Strategy, order_selector Order
+ typename Strategy//, order_selector Order
>
 struct intersection_inserter
     <
         multi_linestring_tag, box_tag, linestring_tag,
- Order, Order, Order,
+ ////Order, Order, Order,
         false, true, false,
         MultiLinestring, Box,
+ Reverse1, Reverse2,
         OutputIterator, GeometryOut,
         Strategy
> : detail::intersection::clip_multi_linestring

Modified: sandbox/geometry/boost/geometry/multi/core/ring_type.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/multi/core/ring_type.hpp (original)
+++ sandbox/geometry/boost/geometry/multi/core/ring_type.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -34,6 +34,15 @@
>::type type;
 };
 
+template <typename MultiPolygon>
+struct ring_return_type<multi_polygon_tag, MultiPolygon>
+{
+ typedef typename ring_return_type
+ <
+ polygon_tag,
+ typename boost::range_value<MultiPolygon>::type
+ >::type type;
+};
 
 
 

Modified: sandbox/geometry/boost/geometry/views/enveloped_view.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/views/enveloped_view.hpp (original)
+++ sandbox/geometry/boost/geometry/views/enveloped_view.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -9,11 +9,13 @@
 #define BOOST_GEOMETRY_VIEWS_ENVELOPED_VIEW_HPP
 
 
+// Note the addition of this whole file was committed to SVN by accident,
+// probably obsolete
+
 #include <boost/mpl/if.hpp>
 #include <boost/range.hpp>
 
 #include <boost/geometry/core/ring_type.hpp>
-#include <boost/geometry/algorithms/detail/sections/get_section.hpp>
 
 
 namespace boost { namespace geometry
@@ -94,7 +96,7 @@
         if (begin != end)
         {
             iterator it = begin;
- iterator prev = it++;
+ iterator prev = it++;
             for(; it != end && ! exceeding(dir, *prev, box); ++it, ++prev) {}
             if (it == end && prev != end && preceding(dir, *prev, box))
             {

Modified: sandbox/geometry/boost/geometry/views/section_view.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/views/section_view.hpp (original)
+++ sandbox/geometry/boost/geometry/views/section_view.hpp 2010-12-18 11:52:59 EST (Sat, 18 Dec 2010)
@@ -8,11 +8,12 @@
 #ifndef BOOST_GEOMETRY_VIEWS_SECTION_VIEW_HPP
 #define BOOST_GEOMETRY_VIEWS_SECTION_VIEW_HPP
 
+// Note the addition of this whole file was committed to SVN by accident,
+// probably obsolete
 
 #include <boost/range.hpp>
 
 #include <boost/geometry/core/ring_type.hpp>
-#include <boost/geometry/algorithms/detail/sections/get_section.hpp>
 #include <boost/geometry/util/add_const_if_c.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