|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r75574 - in trunk/boost/geometry: algorithms/detail/overlay multi/algorithms
From: barend.gehrels_at_[hidden]
Date: 2011-11-20 09:53:37
Author: barendgehrels
Date: 2011-11-20 09:53:36 EST (Sun, 20 Nov 2011)
New Revision: 75574
URL: http://svn.boost.org/trac/boost/changeset/75574
Log:
Linestring/polygon overlay, phase 6 (ring, counter clockwise)
Text files modified:
trunk/boost/geometry/algorithms/detail/overlay/follow.hpp | 20 ++++-----------
trunk/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp | 35 ++++++++++++++++++++++++---
trunk/boost/geometry/multi/algorithms/intersection.hpp | 50 +++++++++++++++++++++++++++++++++------
3 files changed, 79 insertions(+), 26 deletions(-)
Modified: trunk/boost/geometry/algorithms/detail/overlay/follow.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/detail/overlay/follow.hpp (original)
+++ trunk/boost/geometry/algorithms/detail/overlay/follow.hpp 2011-11-20 09:53:36 EST (Sun, 20 Nov 2011)
@@ -66,15 +66,10 @@
{
// (Blocked means: blocked for polygon/polygon intersection, because
// they are reversed. But for polygon/line it is similar to continue)
- switch(op.operation)
- {
- case operation_intersection :
- case operation_continue :
- case operation_blocked :
- return true;
- }
-
- return false;
+ return op.operation == operation_intersection
+ || op.operation == operation_continue
+ || op.operation == operation_blocked
+ ;
}
template <typename Turn, typename Operation>
@@ -105,12 +100,9 @@
return false;
}
- switch(op.operation)
+ if (is_entering(turn, op))
{
- case operation_intersection :
- case operation_continue :
- case operation_blocked :
- return entered || (first && geometry::within(linestring[0], polygon));
+ return entered || (first && geometry::within(linestring[0], polygon));
}
return false;
Modified: trunk/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp (original)
+++ trunk/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp 2011-11-20 09:53:36 EST (Sun, 20 Nov 2011)
@@ -105,11 +105,11 @@
/*!
\brief Version of linestring with an areal feature (polygon or multipolygon)
-\ingroup intersection
*/
template
<
typename LineString, typename Areal,
+ bool ReverseAreal,
typename OutputIterator, typename LineStringOut,
typename Strategy
>
@@ -150,7 +150,7 @@
detail::get_turns::no_interrupt_policy policy;
geometry::get_turns
<
- false, false, detail::overlay::calculate_distance_policy
+ false, ReverseAreal, detail::overlay::calculate_distance_policy
>(linestring, areal, turns, policy);
if (turns.empty())
@@ -355,7 +355,7 @@
template
<
typename Linestring, typename Polygon,
- bool Reverse1, bool Reverse2, bool ReverseOut,
+ bool ReverseLinestring, bool ReversePolygon, bool ReverseOut,
typename OutputIterator, typename GeometryOut,
overlay_type OverlayType,
typename Strategy
@@ -365,13 +365,14 @@
linestring_tag, polygon_tag, linestring_tag,
false, true, false,
Linestring, Polygon,
- Reverse1, Reverse2, ReverseOut,
+ ReverseLinestring, ReversePolygon, ReverseOut,
OutputIterator, GeometryOut,
OverlayType,
Strategy
> : detail::intersection::intersection_of_linestring_with_areal
<
Linestring, Polygon,
+ ReversePolygon,
OutputIterator, GeometryOut,
Strategy
>
@@ -380,6 +381,32 @@
template
<
+ typename Linestring, typename Ring,
+ bool ReverseLinestring, bool ReverseRing, bool ReverseOut,
+ typename OutputIterator, typename GeometryOut,
+ overlay_type OverlayType,
+ typename Strategy
+>
+struct intersection_insert
+ <
+ linestring_tag, ring_tag, linestring_tag,
+ false, true, false,
+ Linestring, Ring,
+ ReverseLinestring, ReverseRing, ReverseOut,
+ OutputIterator, GeometryOut,
+ OverlayType,
+ Strategy
+ > : detail::intersection::intersection_of_linestring_with_areal
+ <
+ Linestring, Ring,
+ ReverseRing,
+ OutputIterator, GeometryOut,
+ Strategy
+ >
+{};
+
+template
+<
typename Segment, typename Box,
bool Reverse1, bool Reverse2, bool ReverseOut,
typename OutputIterator, typename GeometryOut,
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 09:53:36 EST (Sun, 20 Nov 2011)
@@ -114,6 +114,7 @@
template
<
typename MultiLinestring, typename Areal,
+ bool ReverseAreal,
typename OutputIterator, typename LineStringOut,
typename Strategy
>
@@ -133,7 +134,7 @@
out = intersection_of_linestring_with_areal
<
typename boost::range_value<MultiLinestring>::type,
- Areal,
+ Areal, ReverseAreal,
OutputIterator, LineStringOut, Strategy
>::apply(*it, areal, out, strategy);
}
@@ -147,6 +148,7 @@
template
<
typename Areal, typename MultiLinestring,
+ bool ReverseAreal,
typename OutputIterator, typename LineStringOut,
typename Strategy
>
@@ -158,7 +160,7 @@
{
return intersection_of_multi_linestring_with_areal
<
- MultiLinestring, Areal,
+ MultiLinestring, Areal, ReverseAreal,
OutputIterator, LineStringOut,
Strategy
>::apply(ml, areal, out, strategy);
@@ -283,7 +285,7 @@
template
<
typename Linestring, typename MultiPolygon,
- bool Reverse1, bool Reverse2, bool ReverseOut,
+ bool ReverseLinestring, bool ReverseMultiPolygon, bool ReverseOut,
typename OutputIterator, typename GeometryOut,
overlay_type OverlayType,
typename Strategy
@@ -293,13 +295,14 @@
linestring_tag, multi_polygon_tag, linestring_tag,
false, true, false,
Linestring, MultiPolygon,
- Reverse1, Reverse2, ReverseOut,
+ ReverseLinestring, ReverseMultiPolygon, ReverseOut,
OutputIterator, GeometryOut,
OverlayType,
Strategy
> : detail::intersection::intersection_of_linestring_with_areal
<
Linestring, MultiPolygon,
+ ReverseMultiPolygon,
OutputIterator, GeometryOut,
Strategy
>
@@ -311,7 +314,7 @@
template
<
typename Polygon, typename MultiLinestring,
- bool Reverse1, bool Reverse2, bool ReverseOut,
+ bool ReversePolygon, bool ReverseMultiLinestring, bool ReverseOut,
typename OutputIterator, typename GeometryOut,
overlay_type OverlayType,
typename Strategy
@@ -321,23 +324,53 @@
polygon_tag, multi_linestring_tag, linestring_tag,
true, false, false,
Polygon, MultiLinestring,
- Reverse1, Reverse2, ReverseOut,
+ ReversePolygon, ReverseMultiLinestring, ReverseOut,
OutputIterator, GeometryOut,
OverlayType,
Strategy
> : detail::intersection::intersection_of_areal_with_multi_linestring
<
Polygon, MultiLinestring,
+ ReversePolygon,
+ OutputIterator, GeometryOut,
+ Strategy
+ >
+{};
+
+
+template
+<
+ typename MultiLinestring, typename Ring,
+ bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut,
+ typename OutputIterator, typename GeometryOut,
+ overlay_type OverlayType,
+ typename Strategy
+>
+struct intersection_insert
+ <
+ multi_linestring_tag, ring_tag, linestring_tag,
+ false, true, false,
+ MultiLinestring, Ring,
+ ReverseMultiLinestring, ReverseRing, ReverseOut,
+ OutputIterator, GeometryOut,
+ OverlayType,
+ Strategy
+ > : detail::intersection::intersection_of_multi_linestring_with_areal
+ <
+ MultiLinestring, Ring,
+ ReverseRing,
OutputIterator, GeometryOut,
Strategy
>
{};
+
+
template
<
typename MultiLinestring, typename MultiPolygon,
- bool Reverse1, bool Reverse2, bool ReverseOut,
+ bool ReverseMultiLinestring, bool ReverseMultiPolygon, bool ReverseOut,
typename OutputIterator, typename GeometryOut,
overlay_type OverlayType,
typename Strategy
@@ -347,13 +380,14 @@
multi_linestring_tag, multi_polygon_tag, linestring_tag,
false, true, false,
MultiLinestring, MultiPolygon,
- Reverse1, Reverse2, ReverseOut,
+ ReverseMultiLinestring, ReverseMultiPolygon, ReverseOut,
OutputIterator, GeometryOut,
OverlayType,
Strategy
> : detail::intersection::intersection_of_multi_linestring_with_areal
<
MultiLinestring, MultiPolygon,
+ ReverseMultiPolygon,
OutputIterator, GeometryOut,
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