Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80229 - trunk/boost/geometry/algorithms
From: bruno.lalande_at_[hidden]
Date: 2012-08-25 18:42:38


Author: bruno.lalande
Date: 2012-08-25 18:42:38 EDT (Sat, 25 Aug 2012)
New Revision: 80229
URL: http://svn.boost.org/trac/boost/changeset/80229

Log:
Made dispatch::union able to reverse itself.
Text files modified:
   trunk/boost/geometry/algorithms/union.hpp | 79 ++++++++++++++++++---------------------
   1 files changed, 36 insertions(+), 43 deletions(-)

Modified: trunk/boost/geometry/algorithms/union.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/union.hpp (original)
+++ trunk/boost/geometry/algorithms/union.hpp 2012-08-25 18:42:38 EDT (Sat, 25 Aug 2012)
@@ -10,8 +10,6 @@
 #define BOOST_GEOMETRY_ALGORITHMS_UNION_HPP
 
 
-#include <boost/mpl/if.hpp>
-
 #include <boost/range/metafunctions.hpp>
 
 #include <boost/geometry/core/is_areal.hpp>
@@ -30,7 +28,6 @@
 
 template
 <
- // real types
     typename Geometry1, typename Geometry2,
     typename OutputIterator,
     typename GeometryOut,
@@ -43,7 +40,8 @@
     bool ArealOut = geometry::is_areal<GeometryOut>::value,
     bool Reverse1 = detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
     bool Reverse2 = detail::overlay::do_reverse<geometry::point_order<Geometry2>::value>::value,
- bool ReverseOut = detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value
+ bool ReverseOut = detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
+ bool Reverse = geometry::reverse_dispatch<Geometry1, Geometry2>::type::value
>
 struct union_insert
 {
@@ -55,6 +53,8 @@
 };
 
 
+// If reversal is needed, perform it first
+
 template
 <
     typename Geometry1, typename Geometry2,
@@ -71,29 +71,9 @@
         Strategy,
         TagIn1, TagIn2, TagOut,
         true, true, true,
- Reverse1, Reverse2, ReverseOut
- > : detail::overlay::overlay
- <Geometry1, Geometry2, Reverse1, Reverse2, ReverseOut, OutputIterator, GeometryOut, overlay_union, Strategy>
-{};
-
-
-
-template
-<
- typename Geometry1, typename Geometry2,
- typename OutputIterator, typename GeometryOut,
- typename Strategy,
- typename TagIn1 = typename tag<Geometry1>::type,
- typename TagIn2 = typename tag<Geometry2>::type,
- typename TagOut = typename tag<GeometryOut>::type,
- bool Areal1 = geometry::is_areal<Geometry1>::value,
- bool Areal2 = geometry::is_areal<Geometry2>::value,
- bool ArealOut = geometry::is_areal<GeometryOut>::value,
- bool Reverse1 = detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
- bool Reverse2 = detail::overlay::do_reverse<geometry::point_order<Geometry2>::value>::value,
- bool ReverseOut = detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value
->
-struct union_insert_reversed
+ Reverse1, Reverse2, ReverseOut,
+ true
+ >: union_insert<Geometry2, Geometry1, OutputIterator, GeometryOut, Strategy>
 {
     static inline OutputIterator apply(Geometry1 const& g1,
             Geometry2 const& g2, OutputIterator out,
@@ -109,6 +89,29 @@
 };
 
 
+template
+<
+ typename Geometry1, typename Geometry2,
+ typename OutputIterator,
+ typename GeometryOut,
+ typename Strategy,
+ typename TagIn1, typename TagIn2, typename TagOut,
+ bool Reverse1, bool Reverse2, bool ReverseOut
+>
+struct union_insert
+ <
+ Geometry1, Geometry2,
+ OutputIterator, GeometryOut,
+ Strategy,
+ TagIn1, TagIn2, TagOut,
+ true, true, true,
+ Reverse1, Reverse2, ReverseOut,
+ false
+ > : detail::overlay::overlay
+ <Geometry1, Geometry2, Reverse1, Reverse2, ReverseOut, OutputIterator, GeometryOut, overlay_union, Strategy>
+{};
+
+
 } // namespace dispatch
 #endif // DOXYGEN_NO_DISPATCH
 
@@ -128,22 +131,12 @@
             OutputIterator out,
             Strategy const& strategy)
 {
- return boost::mpl::if_c
- <
- geometry::reverse_dispatch<Geometry1, Geometry2>::type::value,
- dispatch::union_insert_reversed
- <
- Geometry1, Geometry2,
- OutputIterator, GeometryOut,
- Strategy
- >,
- dispatch::union_insert
- <
- Geometry1, Geometry2,
- OutputIterator, GeometryOut,
- Strategy
- >
- >::type::apply(geometry1, geometry2, out, strategy);
+ return dispatch::union_insert
+ <
+ Geometry1, Geometry2,
+ OutputIterator, GeometryOut,
+ Strategy
+ >::apply(geometry1, geometry2, out, strategy);
 }
 
 /*!


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