mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-18 14:12:09 +00:00
@@ -1,6 +1,11 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2014.
|
||||
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -12,6 +17,7 @@
|
||||
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
@@ -28,6 +34,7 @@
|
||||
#include <boost/geometry/views/closeable_view.hpp>
|
||||
#include <boost/geometry/views/reversible_view.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/append_no_duplicates.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
@@ -39,7 +46,7 @@ namespace detail { namespace copy_segments
|
||||
{
|
||||
|
||||
|
||||
template<bool Reverse>
|
||||
template <bool Reverse>
|
||||
struct copy_segments_ring
|
||||
{
|
||||
template
|
||||
@@ -102,9 +109,32 @@ struct copy_segments_ring
|
||||
}
|
||||
};
|
||||
|
||||
template<bool Reverse>
|
||||
struct copy_segments_linestring
|
||||
template <bool Reverse, bool RemoveSpikes = true>
|
||||
class copy_segments_linestring
|
||||
{
|
||||
private:
|
||||
// remove spikes
|
||||
template <typename RangeOut, typename Point, typename RobustPolicy>
|
||||
static inline void append_to_output(RangeOut& current_output,
|
||||
Point const& point,
|
||||
RobustPolicy const& robust_policy,
|
||||
boost::true_type const&)
|
||||
{
|
||||
detail::overlay::append_no_dups_or_spikes(current_output, point,
|
||||
robust_policy);
|
||||
}
|
||||
|
||||
// keep spikes
|
||||
template <typename RangeOut, typename Point, typename RobustPolicy>
|
||||
static inline void append_to_output(RangeOut& current_output,
|
||||
Point const& point,
|
||||
RobustPolicy const&,
|
||||
boost::false_type const&)
|
||||
{
|
||||
detail::overlay::append_no_duplicates(current_output, point);
|
||||
}
|
||||
|
||||
public:
|
||||
template
|
||||
<
|
||||
typename LineString,
|
||||
@@ -133,13 +163,13 @@ struct copy_segments_linestring
|
||||
|
||||
for (size_type i = 0; i < count; ++i, ++it)
|
||||
{
|
||||
detail::overlay::append_no_dups_or_spikes(current_output, *it,
|
||||
robust_policy);
|
||||
append_to_output(current_output, *it, robust_policy,
|
||||
boost::integral_constant<bool, RemoveSpikes>());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<bool Reverse>
|
||||
template <bool Reverse>
|
||||
struct copy_segments_polygon
|
||||
{
|
||||
template
|
||||
@@ -168,7 +198,7 @@ struct copy_segments_polygon
|
||||
};
|
||||
|
||||
|
||||
template<bool Reverse>
|
||||
template <bool Reverse>
|
||||
struct copy_segments_box
|
||||
{
|
||||
template
|
||||
@@ -224,24 +254,24 @@ struct copy_segments : not_implemented<Tag>
|
||||
{};
|
||||
|
||||
|
||||
template<bool Reverse>
|
||||
template <bool Reverse>
|
||||
struct copy_segments<ring_tag, Reverse>
|
||||
: detail::copy_segments::copy_segments_ring<Reverse>
|
||||
{};
|
||||
|
||||
|
||||
template<bool Reverse>
|
||||
template <bool Reverse>
|
||||
struct copy_segments<linestring_tag, Reverse>
|
||||
: detail::copy_segments::copy_segments_linestring<Reverse>
|
||||
{};
|
||||
|
||||
template<bool Reverse>
|
||||
template <bool Reverse>
|
||||
struct copy_segments<polygon_tag, Reverse>
|
||||
: detail::copy_segments::copy_segments_polygon<Reverse>
|
||||
{};
|
||||
|
||||
|
||||
template<bool Reverse>
|
||||
template <bool Reverse>
|
||||
struct copy_segments<box_tag, Reverse>
|
||||
: detail::copy_segments::copy_segments_box<Reverse>
|
||||
{};
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
// This file was modified by Oracle on 2014.
|
||||
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
// 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)
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_FOLLOW_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_FOLLOW_HPP
|
||||
|
||||
@@ -140,7 +140,7 @@ static inline bool was_entered(Turn const& turn, Operation const& op, bool first
|
||||
|
||||
|
||||
// Template specialization structure to call the right actions for the right type
|
||||
template<overlay_type OverlayType>
|
||||
template <overlay_type OverlayType, bool RemoveSpikes = true>
|
||||
struct action_selector
|
||||
{
|
||||
// If you get here the overlay type is not intersection or difference
|
||||
@@ -148,8 +148,8 @@ struct action_selector
|
||||
};
|
||||
|
||||
// Specialization for intersection, containing the implementation
|
||||
template<>
|
||||
struct action_selector<overlay_intersection>
|
||||
template <bool RemoveSpikes>
|
||||
struct action_selector<overlay_intersection, RemoveSpikes>
|
||||
{
|
||||
template
|
||||
<
|
||||
@@ -193,7 +193,10 @@ struct action_selector<overlay_intersection>
|
||||
{
|
||||
// On leave, copy all segments from starting point, append the intersection point
|
||||
// and add the output piece
|
||||
geometry::copy_segments<false>(linestring, segment_id, index, robust_policy, current_piece);
|
||||
detail::copy_segments::copy_segments_linestring
|
||||
<
|
||||
false, RemoveSpikes
|
||||
>::apply(linestring, segment_id, index, robust_policy, current_piece);
|
||||
detail::overlay::append_no_duplicates(current_piece, point);
|
||||
if (::boost::size(current_piece) > 1)
|
||||
{
|
||||
@@ -248,10 +251,10 @@ struct action_selector<overlay_intersection>
|
||||
};
|
||||
|
||||
// Specialization for difference, which reverses these actions
|
||||
template<>
|
||||
struct action_selector<overlay_difference>
|
||||
template <bool RemoveSpikes>
|
||||
struct action_selector<overlay_difference, RemoveSpikes>
|
||||
{
|
||||
typedef action_selector<overlay_intersection> normal_action;
|
||||
typedef action_selector<overlay_intersection, RemoveSpikes> normal_action;
|
||||
|
||||
template
|
||||
<
|
||||
@@ -343,12 +346,13 @@ template
|
||||
typename LineStringOut,
|
||||
typename LineString,
|
||||
typename Polygon,
|
||||
overlay_type OverlayType
|
||||
overlay_type OverlayType,
|
||||
bool RemoveSpikes = true
|
||||
>
|
||||
class follow
|
||||
{
|
||||
|
||||
template<typename Turn>
|
||||
template <typename Turn>
|
||||
struct sort_on_segment
|
||||
{
|
||||
// In case of turn point at the same location, we want to have continue/blocked LAST
|
||||
@@ -409,7 +413,10 @@ public :
|
||||
Geometry const& geometry,
|
||||
RobustPolicy const& robust_policy)
|
||||
{
|
||||
return following::action_selector<OverlayType>::included(point, geometry, robust_policy);
|
||||
return following::action_selector
|
||||
<
|
||||
OverlayType, RemoveSpikes
|
||||
>::included(point, geometry, robust_policy);
|
||||
}
|
||||
|
||||
template
|
||||
@@ -431,7 +438,7 @@ public :
|
||||
typename turn_type::container_type
|
||||
>::type turn_operation_iterator_type;
|
||||
|
||||
typedef following::action_selector<OverlayType> action;
|
||||
typedef following::action_selector<OverlayType, RemoveSpikes> action;
|
||||
|
||||
// Sort intersection points on segments-along-linestring, and distance
|
||||
// (like in enrich is done for poly/poly)
|
||||
@@ -484,10 +491,12 @@ public :
|
||||
|
||||
if (action::is_entered(entered))
|
||||
{
|
||||
geometry::copy_segments<false>(linestring, current_segment_id,
|
||||
boost::size(linestring) - 1,
|
||||
robust_policy,
|
||||
current_piece);
|
||||
detail::copy_segments::copy_segments_linestring
|
||||
<
|
||||
false, RemoveSpikes
|
||||
>::apply(linestring, current_segment_id,
|
||||
boost::size(linestring) - 1, robust_policy,
|
||||
current_piece);
|
||||
}
|
||||
|
||||
// Output the last one, if applicable
|
||||
|
||||
@@ -173,7 +173,8 @@ template
|
||||
class follow_linestring_linear_linestring
|
||||
{
|
||||
protected:
|
||||
typedef following::action_selector<OverlayType> action;
|
||||
// allow spikes (false indicates: do not remove spikes)
|
||||
typedef following::action_selector<OverlayType, false> action;
|
||||
|
||||
template
|
||||
<
|
||||
@@ -268,11 +269,12 @@ protected:
|
||||
// We don't rescale linear/linear
|
||||
detail::no_rescale_policy robust_policy;
|
||||
|
||||
geometry::copy_segments<false>(linestring,
|
||||
current_segment_id,
|
||||
boost::size(linestring) - 1,
|
||||
robust_policy,
|
||||
current_piece);
|
||||
detail::copy_segments::copy_segments_linestring
|
||||
<
|
||||
false, false // do not reverse; do not remove spikes
|
||||
>::apply(linestring, current_segment_id,
|
||||
boost::size(linestring) - 1, robust_policy,
|
||||
current_piece);
|
||||
}
|
||||
|
||||
// Output the last one, if applicable
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
// This file was modified by Oracle on 2014.
|
||||
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
// 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)
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_INTERSECTION_INSERT_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_INTERSECTION_INSERT_HPP
|
||||
|
||||
|
||||
@@ -125,7 +125,12 @@ template
|
||||
overlay_type OverlayType,
|
||||
bool EnableFilterContinueTurns = false,
|
||||
bool EnableRemoveDuplicateTurns = false,
|
||||
bool EnableDegenerateTurns = true
|
||||
bool EnableDegenerateTurns = true,
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
bool EnableFollowIsolatedPoints = false
|
||||
#else
|
||||
bool EnableFollowIsolatedPoints = true
|
||||
#endif
|
||||
>
|
||||
class linear_linear_linestring
|
||||
{
|
||||
@@ -147,7 +152,6 @@ protected:
|
||||
static inline void apply(Info& , Point1 const& , Point2 const& ,
|
||||
IntersectionInfo const& , DirInfo const& )
|
||||
{
|
||||
//calculate_distance_policy::apply(info, p1, p2, ii, di);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -201,7 +205,7 @@ protected:
|
||||
|
||||
// sort by seg_id, distance, and operation
|
||||
std::sort(boost::begin(turns), boost::end(turns),
|
||||
detail::turns::less_seg_dist_other_op<>());
|
||||
detail::turns::less_seg_fraction_other_op<>());
|
||||
|
||||
// remove duplicate turns
|
||||
turns::remove_duplicate_turns
|
||||
@@ -256,7 +260,9 @@ public:
|
||||
|
||||
return sort_and_follow_turns
|
||||
<
|
||||
OverlayType, OverlayType == overlay_intersection
|
||||
OverlayType,
|
||||
EnableFollowIsolatedPoints
|
||||
&& OverlayType == overlay_intersection
|
||||
>(turns, linear1, linear2, oit);
|
||||
}
|
||||
};
|
||||
@@ -271,13 +277,14 @@ template
|
||||
typename LinestringOut,
|
||||
bool EnableFilterContinueTurns,
|
||||
bool EnableRemoveDuplicateTurns,
|
||||
bool EnableDegenerateTurns
|
||||
bool EnableDegenerateTurns,
|
||||
bool EnableFollowIsolatedPoints
|
||||
>
|
||||
struct linear_linear_linestring
|
||||
<
|
||||
Linear1, Linear2, LinestringOut, overlay_union,
|
||||
EnableFilterContinueTurns, EnableRemoveDuplicateTurns,
|
||||
EnableDegenerateTurns
|
||||
EnableDegenerateTurns, EnableFollowIsolatedPoints
|
||||
>
|
||||
{
|
||||
template
|
||||
@@ -302,7 +309,7 @@ struct linear_linear_linestring
|
||||
<
|
||||
Linear2, Linear1, LinestringOut, overlay_difference,
|
||||
EnableFilterContinueTurns, EnableRemoveDuplicateTurns,
|
||||
EnableDegenerateTurns
|
||||
EnableDegenerateTurns, EnableFollowIsolatedPoints
|
||||
>::apply(linear2, linear1, robust_policy, oit, strategy);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,14 +27,14 @@ namespace detail { namespace turns
|
||||
// TURNS SORTING AND SEARCHING
|
||||
|
||||
// sort turns by G1 - source_index == 0 by:
|
||||
// seg_id -> distance -> other_id -> operation
|
||||
// seg_id -> fraction -> other_id -> operation
|
||||
template
|
||||
<
|
||||
typename IdLess = std::less<int>,
|
||||
int N = 0, int U = 1, int I = 2, int B = 3, int C = 4, int O = 0,
|
||||
std::size_t OpId = 0
|
||||
>
|
||||
struct less_seg_dist_other_op
|
||||
struct less_seg_fraction_other_op
|
||||
{
|
||||
BOOST_STATIC_ASSERT(OpId < 2);
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
// This file was modified by Oracle on 2014.
|
||||
// Modifications copyright (c) 2014 Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
// 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)
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_UNION_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_UNION_HPP
|
||||
|
||||
|
||||
@@ -401,6 +401,21 @@ BOOST_AUTO_TEST_CASE( test_difference_linestring_linestring )
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(5 0,10 0))"),
|
||||
"lldf23"
|
||||
);
|
||||
|
||||
// the following two tests have been discussed with by Adam
|
||||
tester::apply
|
||||
(from_wkt<L>("LINESTRING(1 0,1 1,2 1)"),
|
||||
from_wkt<L>("LINESTRING(2 1,1 1,1 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING()"),
|
||||
"lldf24"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<L>("LINESTRING(1 0,1 1,2 1)"),
|
||||
from_wkt<L>("LINESTRING(1 2,1 1,1 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 1,2 1))"),
|
||||
"lldf25"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -616,6 +631,13 @@ BOOST_AUTO_TEST_CASE( test_difference_linestring_multilinestring )
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10))"),
|
||||
"lmldf19"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<L>("LINESTRING(0 0,10 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((-1 0,0 0),(10 0,12 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
"lmldf20"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -907,6 +929,34 @@ BOOST_AUTO_TEST_CASE( test_difference_multilinestring_multilinestring )
|
||||
"mlmldf18a"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((-1 0,0 0),(10 0,12 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
"mlmldf19"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_NO_DEGENERATE
|
||||
BOOST_AUTO_TEST_CASE( test_difference_ml_ml_degenerate )
|
||||
{
|
||||
#ifdef GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** MULTILINESTRING / MULTILINESTRING DIFFERENCE"
|
||||
<< " (DEGENERATE) ***"
|
||||
<< std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef multi_linestring_type ML;
|
||||
|
||||
typedef test_difference_of_geometries<ML, ML, ML> tester;
|
||||
|
||||
// the following test cases concern linestrings with duplicate
|
||||
// points and possibly linestrings with zero length.
|
||||
|
||||
@@ -975,3 +1025,207 @@ BOOST_AUTO_TEST_CASE( test_difference_multilinestring_multilinestring )
|
||||
"mlmldf23"
|
||||
);
|
||||
}
|
||||
#endif // BOOST_GEOMETRY_TEST_NO_DEGENERATE
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_difference_ml_ml_spikes )
|
||||
{
|
||||
#ifdef GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** MULTILINESTRING / MULTILINESTRING DIFFERENCE"
|
||||
<< " (WITH SPIKES) ***"
|
||||
<< std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef multi_linestring_type ML;
|
||||
|
||||
typedef test_difference_of_geometries<ML, ML, ML> tester;
|
||||
|
||||
// the following test cases concern linestrings with spikes
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,9 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
|
||||
"mlmldf-spikes-01"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((9 0,1 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
|
||||
"mlmldf-spikes-02"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,9 0,2 0,8 0,3 0,7 0,4 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
|
||||
"mlmldf-spikes-03"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,3 0,2 0,4 0,3 0,5 0,4 0,6 0,\
|
||||
5 0,7 0,6 0,8 0,7 0,9 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
|
||||
"mlmldf-spikes-04"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(7 0,8 0,7 0),\
|
||||
(9 1,9 0,9 2))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(6 0,7 0),(8 0,10 0))"),
|
||||
"mlmldf-spikes-05"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(7 0,8 0,7 0),\
|
||||
(9 0,9 2,9 1))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(6 0,7 0),(8 0,10 0))"),
|
||||
"mlmldf-spikes-05a"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(9 0,6 0,8 0),\
|
||||
(11 0,8 0,12 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0))"),
|
||||
"mlmldf-spikes-06"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((-1 0,0 0,-2 0),(11 0,10 0,12 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
"mlmldf-spikes-07"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((-1 -1,0 0,-2 -2),(11 1,10 0,12 2))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
"mlmldf-spikes-07a"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(11 0,10 0,12 0),\
|
||||
(7 5,7 0,8 0,6.5 0,8.5 0,8.5 5))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(6 0,6.5 0),(8.5 0,10 0))"),
|
||||
"mlmldf-spikes-08"
|
||||
);
|
||||
|
||||
// now the first geometry has a spike
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,7 0,4 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,8 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(8 0,10 0))"),
|
||||
"mlmldf-spikes-09"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,7 0,4 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,7 0,4 0,9 0))"),
|
||||
"mlmldf-spikes-09a"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,7 0,4 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,5 0),(9 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,7 0,5 0),(5 0,9 0))"),
|
||||
"mlmldf-spikes-09b"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,7 0,4 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,5 0),(6 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,6 0),(6 0,5 0),(5 0,6 0))"),
|
||||
"mlmldf-spikes-09c"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,8 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(8 0,10 0,8 0))"),
|
||||
"mlmldf-spikes-10"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,8 0,4 0),(2 0,9 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0,9 0))"),
|
||||
"mlmldf-spikes-11"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((11 1,10 0,12 2))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
"mlmldf-spikes-12"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((11 -1,10 0,12 -2))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
"mlmldf-spikes-12a"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((11 0,10 0,12 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
"mlmldf-spikes-13"
|
||||
);
|
||||
|
||||
// the following three tests have been discussed with Adam
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((1 0,1 1,2 1))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 2,1 1,1 2))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,1 1,2 1))"),
|
||||
"mlmldf-spikes-14"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,1 0,0 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((2 0,1 0,2 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0,0 0))"),
|
||||
"mlmldf-spikes-15"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((1 0,1 1,2 1))"),
|
||||
from_wkt<ML>("MULTILINESTRING((2 0,1 1,2 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,1 1,2 1))"),
|
||||
"mlmldf-spikes-16"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((1 0,1 1,2 1))"),
|
||||
from_wkt<ML>("MULTILINESTRING((2 1,1 1,2 1))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,1 1))"),
|
||||
"mlmldf-spikes-17"
|
||||
);
|
||||
|
||||
// test cases sent by Adam on the mailing list (equal slikes)
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,1 1,0 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,0 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING()"),
|
||||
"mlmldf-spikes-18"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,1 1,0 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 1,0 0,1 1))"),
|
||||
from_wkt<ML>("MULTILINESTRING()"),
|
||||
"mlmldf-spikes-19"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -461,6 +461,21 @@ BOOST_AUTO_TEST_CASE( test_intersection_linestring_linestring )
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,4 0),(4 0,5 0))"),
|
||||
"lli23"
|
||||
);
|
||||
|
||||
// the following two tests have been discussed with by Adam
|
||||
tester::apply
|
||||
(from_wkt<L>("LINESTRING(1 0,1 1,2 1)"),
|
||||
from_wkt<L>("LINESTRING(2 1,1 1,1 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,1 1,2 1))"),
|
||||
"lli24"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<L>("LINESTRING(1 0,1 1,2 1)"),
|
||||
from_wkt<L>("LINESTRING(1 2,1 1,1 0)"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,1 1))"),
|
||||
"lli25"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -667,6 +682,28 @@ BOOST_AUTO_TEST_CASE( test_intersection_linestring_multilinestring )
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,18 0,19 0))"),
|
||||
"lmli18a"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_NO_DEGENERATE
|
||||
BOOST_AUTO_TEST_CASE( test_intersection_l_ml_degenerate )
|
||||
{
|
||||
#ifdef GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** LINESTRING / MULTILINESTRING INTERSECTION"
|
||||
<< " (DEGENERATE) ***"
|
||||
<< std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef linestring_type L;
|
||||
typedef multi_linestring_type ML;
|
||||
|
||||
typedef test_intersection_of_geometries<L, ML, ML> tester;
|
||||
|
||||
// the following test cases concern linestrings with duplicate
|
||||
// points and possibly linestrings with zero length.
|
||||
@@ -678,8 +715,12 @@ BOOST_AUTO_TEST_CASE( test_intersection_linestring_multilinestring )
|
||||
(1 1,1 1,2 2,2 2),(1 10,1 10,1 0,1 0,1 -10),\
|
||||
(2 0,2 0),(3 0,3 0,3 0),(0 0,0 0,0 10,0 10),\
|
||||
(4 0,4 10,4 10))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,18 0,19 0,20 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((0 0),(1 0),(2 0),(3 0),(4 0),\
|
||||
(5 0,18 0,19 0,20 0))"),
|
||||
#endif
|
||||
"lmli20a"
|
||||
);
|
||||
|
||||
@@ -690,8 +731,12 @@ BOOST_AUTO_TEST_CASE( test_intersection_linestring_multilinestring )
|
||||
(1 1,1 1,2 2,2 2),(1 10,1 10,1 0,1 0,1 -10),\
|
||||
(2 0,2 0),(3 0,3 0,3 0),(0 0,0 0,0 10,0 10),\
|
||||
(4 0,4 0,4 10,4 10))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,18 0,19 0,20 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((0 0),(1 0),(2 0),(3 0),(4 0),\
|
||||
(5 0,18 0,19 0,20 0))"),
|
||||
#endif
|
||||
"lmli20b"
|
||||
);
|
||||
|
||||
@@ -702,8 +747,12 @@ BOOST_AUTO_TEST_CASE( test_intersection_linestring_multilinestring )
|
||||
(1 1,1 1,2 2,2 2),(1 10,1 10,1 0,1 0,1 -10),\
|
||||
(2 0,2 0),(3 0,3 0,3 0),(0 0,0 0,0 10,0 10),\
|
||||
(30 0,30 0,30 0))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,18 0,19 0,20 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((0 0),(1 0),(2 0),(3 0),\
|
||||
(5 0,18 0,19 0,20 0),(30 0))"),
|
||||
#endif
|
||||
"lmli20c"
|
||||
);
|
||||
|
||||
@@ -714,12 +763,16 @@ BOOST_AUTO_TEST_CASE( test_intersection_linestring_multilinestring )
|
||||
(1 1,1 1,2 2,2 2),(1 10,1 10,1 0,1 0,1 -10),\
|
||||
(2 0,2 0),(3 0,3 0,3 0),(0 0,0 0,0 10,0 10),\
|
||||
(30 0,30 0,31 0))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,18 0,19 0,20 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((0 0),(1 0),(2 0),(3 0),\
|
||||
(5 0,18 0,19 0,20 0),(30 0))"),
|
||||
#endif
|
||||
"lmli20d"
|
||||
);
|
||||
}
|
||||
|
||||
#endif // BOOST_GEOMETRY_TEST_NO_DEGENERATE
|
||||
|
||||
|
||||
|
||||
@@ -738,7 +791,7 @@ BOOST_AUTO_TEST_CASE( test_intersection_multilinestring_linestring )
|
||||
|
||||
typedef test_intersection_of_geometries<ML, L, ML> tester;
|
||||
|
||||
// the inertsection code automatically reverses the order of the
|
||||
// the intersection code automatically reverses the order of the
|
||||
// geometries according to the geometry IDs.
|
||||
// all calls below are actually reversed, and internally the
|
||||
// intersection of the linestring with the multi-linestring is
|
||||
@@ -1071,8 +1124,28 @@ BOOST_AUTO_TEST_CASE( test_intersection_multilinestring_multilinestring )
|
||||
#endif
|
||||
"mlmli18a"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_NO_DEGENERATE
|
||||
BOOST_AUTO_TEST_CASE( test_intersection_ml_ml_degenerate )
|
||||
{
|
||||
#ifdef GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** MULTILINESTRING / MULTILINESTRING INTERSECTION"
|
||||
<< " (DEGENERATE) ***"
|
||||
<< std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef multi_linestring_type ML;
|
||||
|
||||
typedef test_intersection_of_geometries<ML, ML, ML> tester;
|
||||
|
||||
// the following test cases concern linestrings with duplicate
|
||||
// points and possibly linestrings with zero length.
|
||||
|
||||
@@ -1084,10 +1157,15 @@ BOOST_AUTO_TEST_CASE( test_intersection_multilinestring_multilinestring )
|
||||
(1 1,2 2),(1 10,1 10,1 0,1 0,1 -10),\
|
||||
(2 0,2 0),(3 0,3 0,3 0),(0 0,0 10),\
|
||||
(4 0,4 10),(5 5,5 5))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,18 0,19 0,20 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,20 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((5 5),(0 0),(1 0),(2 0),(3 0),\
|
||||
(4 0),(5 0,18 0,19 0,20 0),(2 0),(4 10))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,20 0),(1 0),(2 0),(2 0),(3 0),\
|
||||
(0 0),(4 0),(4 10),(5 5))"),
|
||||
#endif
|
||||
"mlmli20a"
|
||||
);
|
||||
|
||||
@@ -1099,10 +1177,15 @@ BOOST_AUTO_TEST_CASE( test_intersection_multilinestring_multilinestring )
|
||||
(1 1,1 1,2 2,2 2),(1 10,1 10,1 0,1 0,1 -10),\
|
||||
(2 0,2 0),(3 0,3 0,3 0,3 0),(0 0,0 0,0 10,0 10),\
|
||||
(4 0,4 10,4 10),(5 5,5 5))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,18 0,19 0,20 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,20 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((5 5),(0 0),(1 0),(2 0),(3 0),(4 0),\
|
||||
(5 0,18 0,19 0,20 0),(2 0),(4 10))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,20 0),(1 0),(2 0),(2 0),\
|
||||
(3 0),(0 0),(4 0),(4 10),(5 5))"),
|
||||
#endif
|
||||
"mlmli20aa"
|
||||
);
|
||||
|
||||
@@ -1114,10 +1197,15 @@ BOOST_AUTO_TEST_CASE( test_intersection_multilinestring_multilinestring )
|
||||
(1 1,1 1,2 2,2 2),(1 10,1 10,1 0,1 0,1 -10),\
|
||||
(2 0,2 0),(3 0,3 0,3 0),(0 0,0 0,0 10,0 10),\
|
||||
(4 0,4 0,4 10,4 10),(0 5,15 5))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,18 0,19 0,20 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,20 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((5 5),(0 0),(1 0),(2 0),(3 0),(4 0),\
|
||||
(5 0,18 0,19 0,20 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,20 0),(1 0),(2 0),(3 0),\
|
||||
(0 0),(4 0),(5 5))"),
|
||||
#endif
|
||||
"mlmli20b"
|
||||
);
|
||||
|
||||
@@ -1129,10 +1217,15 @@ BOOST_AUTO_TEST_CASE( test_intersection_multilinestring_multilinestring )
|
||||
(1 1,1 1,2 2,2 2),(1 10,1 10,1 0,1 0,1 -10),\
|
||||
(2 0,2 0),(3 0,3 0,3 0),(0 0,0 0,0 10,0 10),\
|
||||
(30 0,30 0,30 0))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,18 0,19 0,20 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,20 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((0 0),(1 0),(2 0),(3 0),\
|
||||
(5 0,18 0,19 0,20 0),(30 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,20 0),(1 0),(2 0),(3 0),\
|
||||
(0 0),(30 0))"),
|
||||
#endif
|
||||
"mlmli20c"
|
||||
);
|
||||
|
||||
@@ -1144,10 +1237,15 @@ BOOST_AUTO_TEST_CASE( test_intersection_multilinestring_multilinestring )
|
||||
(1 1,1 1,2 2,2 2),(1 10,1 10,1 0,1 0,1 -10),\
|
||||
(2 0,2 0),(3 0,3 0,3 0),(0 0,0 0,0 10,0 10),\
|
||||
(30 0,30 0,31 0))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,18 0,19 0,20 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,20 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((0 0),(1 0),(2 0),(3 0),\
|
||||
(5 0,18 0,19 0,20 0),(30 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,20 0),(1 0),(2 0),(3 0),\
|
||||
(0 0),(30 0))"),
|
||||
#endif
|
||||
"mlmli20d"
|
||||
);
|
||||
|
||||
@@ -1158,10 +1256,284 @@ BOOST_AUTO_TEST_CASE( test_intersection_multilinestring_multilinestring )
|
||||
(1 10,1 10,1 0,1 0,1 -10),\
|
||||
(2 0,2 0),(3 0,3 0,3 0),(0 0,0 0,0 10,0 10),\
|
||||
(30 0,30 0,31 0,31 0))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,18 0,19 0,30 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,20 0,30 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((0 0),(1 0),(2 0),(3 0),\
|
||||
(5 0,18 0,19 0,30 0),(30 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((5 0,20 0,30 0),(1 0),(2 0),(3 0),\
|
||||
(0 0),(30 0))"),
|
||||
#endif
|
||||
"mlmli20e"
|
||||
);
|
||||
}
|
||||
#endif // BOOST_GEOMETRY_TEST_NO_DEGENERATE
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_intersection_ml_ml_spikes )
|
||||
{
|
||||
#ifdef GEOMETRY_TEST_DEBUG
|
||||
std::cout << std::endl << std::endl << std::endl;
|
||||
std::cout << "*** MULTILINESTRING / MULTILINESTRING INTERSECTION"
|
||||
<< " (WITH SPIKES) ***"
|
||||
<< std::endl;
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
typedef multi_linestring_type ML;
|
||||
|
||||
typedef test_intersection_of_geometries<ML, ML, ML> tester;
|
||||
|
||||
// the following test cases concern linestrings with spikes
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,9 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,9 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,9 0,5 0))"),
|
||||
"mlmli-spikes-01"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((9 0,1 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,9 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((9 0,1 0,5 0))"),
|
||||
"mlmli-spikes-02"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,9 0,2 0,8 0,3 0,7 0,4 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,9 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,9 0,2 0,8 0,3 0,7 0,4 0,5 0))"),
|
||||
"mlmli-spikes-03"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,3 0,2 0,4 0,3 0,5 0,4 0,6 0,\
|
||||
5 0,7 0,6 0,8 0,7 0,9 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,9 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,3 0,2 0,4 0,3 0,5 0,4 0,6 0,\
|
||||
5 0,7 0,6 0,8 0,7 0,9 0))"),
|
||||
"mlmli-spikes-04"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(7 0,8 0,7 0),\
|
||||
(9 1,9 0,9 2))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0),(7 0,8 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(7 0,8 0,7 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0),(7 0,8 0),(9 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(7 0,8 0,7 0),(9 0))"),
|
||||
#endif
|
||||
"mlmli-spikes-05"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(7 0,8 0,7 0),\
|
||||
(9 0,9 2,9 1))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0),(7 0,8 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(7 0,8 0,7 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0),(7 0,8 0),(9 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(7 0,8 0,7 0),(9 0))"),
|
||||
#endif
|
||||
"mlmli-spikes-05a"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(9 0,6 0,8 0),\
|
||||
(11 0,8 0,12 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0),(6 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(9 0,6 0,8 0),\
|
||||
(10 0,8 0,10 0))"),
|
||||
"mlmli-spikes-06"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((-1 0,0 0,-2 0),(11 0,10 0,12 0))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING()"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((0 0),(10 0))"),
|
||||
#endif
|
||||
"mlmli-spikes-07"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((-1 -1,0 0,-2 -2),(11 1,10 0,12 2))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING()"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((0 0),(10 0))"),
|
||||
#endif
|
||||
"mlmli-spikes-07a"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(11 0,10 0,12 0),\
|
||||
(7 5,7 0,8 0,6.5 0,8.5 0,8.5 5))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0),(6.5 0,8.5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(7 0,8 0,6.5 0,8.5 0))"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0),(6.5 0,8.5 0),(10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,6 0,5 0),(7 0,8 0,6.5 0,8.5 0),(10 0))"),
|
||||
#endif
|
||||
"mlmli-spikes-08"
|
||||
);
|
||||
|
||||
// now the first geometry has a spike
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,7 0,4 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,8 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,7 0,4 0,8 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,8 0))"),
|
||||
"mlmli-spikes-09"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,7 0,4 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
|
||||
"mlmli-spikes-09a"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,7 0,4 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,5 0),(9 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,5 0),(5 0,4 0,5 0),(9 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,5 0),(9 0,10 0))"),
|
||||
"mlmli-spikes-09b"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,7 0,4 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,5 0),(6 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,5 0),(6 0,7 0,6 0),(5 0,4 0,5 0),\
|
||||
(6 0,10 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,5 0),(6 0,10 0))"),
|
||||
"mlmli-spikes-09c"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,8 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,8 0),(8 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,8 0))"),
|
||||
"mlmli-spikes-10"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,8 0,4 0),(2 0,9 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,9 0),(9 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 0,8 0,4 0),(2 0,9 0,5 0))"),
|
||||
"mlmli-spikes-11"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((11 1,10 0,12 2))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING()"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((10 0))"),
|
||||
#endif
|
||||
"mlmli-spikes-12"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((11 -1,10 0,12 -2))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING()"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((10 0))"),
|
||||
#endif
|
||||
"mlmli-spikes-12a"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,10 0,5 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((11 0,10 0,12 0))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING()"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((10 0))"),
|
||||
#endif
|
||||
"mlmli-spikes-13"
|
||||
);
|
||||
|
||||
// the following three tests have been discussed with Adam
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((1 0,1 1,2 1))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 2,1 1,1 2))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING()"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((1 1))"),
|
||||
#endif
|
||||
"mlmli-spikes-14"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,1 0,0 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((2 0,1 0,2 0))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING()"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((1 0))"),
|
||||
#endif
|
||||
"mlmli-spikes-15"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((1 0,1 1,2 1))"),
|
||||
from_wkt<ML>("MULTILINESTRING((2 0,1 1,2 0))"),
|
||||
#ifdef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
|
||||
from_wkt<ML>("MULTILINESTRING()"),
|
||||
#else
|
||||
from_wkt<ML>("MULTILINESTRING((1 1))"),
|
||||
#endif
|
||||
"mlmli-spikes-16"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((1 0,1 1,2 1))"),
|
||||
from_wkt<ML>("MULTILINESTRING((2 1,1 1,2 1))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 1,2 1))"),
|
||||
from_wkt<ML>("MULTILINESTRING((2 1,1 1,2 1))"),
|
||||
"mlmli-spikes-17"
|
||||
);
|
||||
|
||||
// test cases sent by Adam on the mailing list (equal slikes)
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,1 1,0 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,0 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,0 0))"),
|
||||
"mlmli-spikes-18"
|
||||
);
|
||||
|
||||
tester::apply
|
||||
(from_wkt<ML>("MULTILINESTRING((0 0,1 1,0 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 1,0 0,1 1))"),
|
||||
from_wkt<ML>("MULTILINESTRING((0 0,1 1,0 0))"),
|
||||
from_wkt<ML>("MULTILINESTRING((1 1,0 0,1 1))"),
|
||||
"mlmli-spikes-19"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -122,16 +122,16 @@ public:
|
||||
filter_continue_turns::apply(rturns_wo_cont);
|
||||
|
||||
std::sort(boost::begin(turns_all), boost::end(turns_all),
|
||||
bg_turns::less_seg_dist_other_op<>());
|
||||
bg_turns::less_seg_fraction_other_op<>());
|
||||
|
||||
std::sort(boost::begin(turns_wo_cont), boost::end(turns_wo_cont),
|
||||
bg_turns::less_seg_dist_other_op<>());
|
||||
bg_turns::less_seg_fraction_other_op<>());
|
||||
|
||||
std::sort(boost::begin(rturns_all), boost::end(rturns_all),
|
||||
bg_turns::less_seg_dist_other_op<std::greater<int> >());
|
||||
bg_turns::less_seg_fraction_other_op<std::greater<int> >());
|
||||
|
||||
std::sort(boost::begin(rturns_wo_cont), boost::end(rturns_wo_cont),
|
||||
bg_turns::less_seg_dist_other_op<std::greater<int> >());
|
||||
bg_turns::less_seg_fraction_other_op<std::greater<int> >());
|
||||
|
||||
remove_duplicate_turns::apply(turns_all);
|
||||
remove_duplicate_turns::apply(turns_wo_cont);
|
||||
|
||||
Reference in New Issue
Block a user