Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75570 - trunk/boost/geometry/multi/algorithms
From: barend.gehrels_at_[hidden]
Date: 2011-11-20 08:03:07


Author: barendgehrels
Date: 2011-11-20 08:03:07 EST (Sun, 20 Nov 2011)
New Revision: 75570
URL: http://svn.boost.org/trac/boost/changeset/75570

Log:
Linestring/polygon overlay, phase 4 (multi_linestring/multi_polygon, and multi_linestring/polygon)
Text files modified:
   trunk/boost/geometry/multi/algorithms/intersection.hpp | 112 ++++++++++++++++++++++++++++++++++++++++
   1 files changed, 112 insertions(+), 0 deletions(-)

Modified: trunk/boost/geometry/multi/algorithms/intersection.hpp
==============================================================================
--- trunk/boost/geometry/multi/algorithms/intersection.hpp (original)
+++ trunk/boost/geometry/multi/algorithms/intersection.hpp 2011-11-20 08:03:07 EST (Sun, 20 Nov 2011)
@@ -109,6 +109,64 @@
 };
 
 
+// This loop is quite similar to the loop above, but beacuse the iterator
+// is second (above) or first (below) argument, it is not trivial to merge them.
+template
+<
+ typename MultiLinestring, typename Areal,
+ typename OutputIterator, typename LineStringOut,
+ typename Strategy
+>
+struct intersection_of_multi_linestring_with_areal
+{
+ static inline OutputIterator apply(MultiLinestring const& ml, Areal const& areal,
+ OutputIterator out,
+ Strategy const& strategy)
+ {
+ for (typename boost::range_iterator
+ <
+ MultiLinestring const
+ >::type it = boost::begin(ml);
+ it != boost::end(ml);
+ ++it)
+ {
+ out = intersection_of_linestring_with_areal
+ <
+ typename boost::range_value<MultiLinestring>::type,
+ Areal,
+ OutputIterator, LineStringOut, Strategy
+ >::apply(*it, areal, out, strategy);
+ }
+
+ return out;
+
+ }
+};
+
+// This one calls the one above with reversed arguments
+template
+<
+ typename Areal, typename MultiLinestring,
+ typename OutputIterator, typename LineStringOut,
+ typename Strategy
+>
+struct intersection_of_areal_with_multi_linestring
+{
+ static inline OutputIterator apply(Areal const& areal, MultiLinestring const& ml,
+ OutputIterator out,
+ Strategy const& strategy)
+ {
+ return intersection_of_multi_linestring_with_areal
+ <
+ MultiLinestring, Areal,
+ OutputIterator, LineStringOut,
+ Strategy
+ >::apply(ml, areal, out, strategy);
+ }
+};
+
+
+
 template
 <
     typename MultiLinestring, typename Box,
@@ -248,6 +306,60 @@
 {};
 
 
+// Derives from areal/mls because runtime arguments are in that order.
+// areal/mls reverses it itself to mls/areal
+template
+<
+ typename Polygon, typename MultiLinestring,
+ bool Reverse1, bool Reverse2, bool ReverseOut,
+ typename OutputIterator, typename GeometryOut,
+ overlay_type OverlayType,
+ typename Strategy
+>
+struct intersection_insert
+ <
+ polygon_tag, multi_linestring_tag, linestring_tag,
+ true, false, false,
+ Polygon, MultiLinestring,
+ Reverse1, Reverse2, ReverseOut,
+ OutputIterator, GeometryOut,
+ OverlayType,
+ Strategy
+ > : detail::intersection::intersection_of_areal_with_multi_linestring
+ <
+ Polygon, MultiLinestring,
+ OutputIterator, GeometryOut,
+ Strategy
+ >
+{};
+
+
+template
+<
+ typename MultiLinestring, typename MultiPolygon,
+ bool Reverse1, bool Reverse2, bool ReverseOut,
+ typename OutputIterator, typename GeometryOut,
+ overlay_type OverlayType,
+ typename Strategy
+>
+struct intersection_insert
+ <
+ multi_linestring_tag, multi_polygon_tag, linestring_tag,
+ false, true, false,
+ MultiLinestring, MultiPolygon,
+ Reverse1, Reverse2, ReverseOut,
+ OutputIterator, GeometryOut,
+ OverlayType,
+ Strategy
+ > : detail::intersection::intersection_of_multi_linestring_with_areal
+ <
+ MultiLinestring, MultiPolygon,
+ OutputIterator, GeometryOut,
+ Strategy
+ >
+{};
+
+
 } // namespace dispatch
 #endif
 


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