summaryrefslogtreecommitdiff
path: root/boost/geometry/algorithms/detail/is_simple/linear.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/algorithms/detail/is_simple/linear.hpp')
-rw-r--r--boost/geometry/algorithms/detail/is_simple/linear.hpp48
1 files changed, 37 insertions, 11 deletions
diff --git a/boost/geometry/algorithms/detail/is_simple/linear.hpp b/boost/geometry/algorithms/detail/is_simple/linear.hpp
index 52b9d9d1c8..5acf56c5b1 100644
--- a/boost/geometry/algorithms/detail/is_simple/linear.hpp
+++ b/boost/geometry/algorithms/detail/is_simple/linear.hpp
@@ -219,12 +219,12 @@ inline bool has_self_intersections(Linear const& linear, Strategy const& strateg
detail::self_get_turn_points::get_turns
<
- turn_policy
+ false, turn_policy
>::apply(linear,
strategy,
detail::no_rescale_policy(),
turns,
- interrupt_policy);
+ interrupt_policy, 0);
detail::is_valid::debug_print_turns(turns.begin(), turns.end());
debug_print_boundary_points(linear);
@@ -236,7 +236,9 @@ inline bool has_self_intersections(Linear const& linear, Strategy const& strateg
template <typename Linestring, bool CheckSelfIntersections = true>
struct is_simple_linestring
{
- static inline bool apply(Linestring const& linestring)
+ template <typename Strategy>
+ static inline bool apply(Linestring const& linestring,
+ Strategy const& strategy)
{
simplicity_failure_policy policy;
return ! boost::empty(linestring)
@@ -247,7 +249,7 @@ struct is_simple_linestring
&& ! detail::is_valid::has_spikes
<
Linestring, closed
- >::apply(linestring, policy);
+ >::apply(linestring, policy, strategy.get_side_strategy());
}
};
@@ -258,7 +260,10 @@ struct is_simple_linestring<Linestring, true>
static inline bool apply(Linestring const& linestring,
Strategy const& strategy)
{
- return is_simple_linestring<Linestring, false>::apply(linestring)
+ return is_simple_linestring
+ <
+ Linestring, false
+ >::apply(linestring, strategy)
&& ! has_self_intersections(linestring, strategy);
}
};
@@ -267,23 +272,44 @@ struct is_simple_linestring<Linestring, true>
template <typename MultiLinestring>
struct is_simple_multilinestring
{
+private:
+ template <typename Strategy>
+ struct per_linestring
+ {
+ per_linestring(Strategy const& strategy)
+ : m_strategy(strategy)
+ {}
+
+ template <typename Linestring>
+ inline bool apply(Linestring const& linestring) const
+ {
+ return detail::is_simple::is_simple_linestring
+ <
+ Linestring,
+ false // do not compute self-intersections
+ >::apply(linestring, m_strategy);
+ }
+
+ Strategy const& m_strategy;
+ };
+
+public:
template <typename Strategy>
static inline bool apply(MultiLinestring const& multilinestring,
Strategy const& strategy)
{
+ typedef per_linestring<Strategy> per_ls;
+
// check each of the linestrings for simplicity
// but do not compute self-intersections yet; these will be
// computed for the entire multilinestring
if ( ! detail::check_iterator_range
<
- is_simple_linestring
- <
- typename boost::range_value<MultiLinestring>::type,
- false // do not compute self-intersections
- >,
+ per_ls, // do not compute self-intersections
true // allow empty multilinestring
>::apply(boost::begin(multilinestring),
- boost::end(multilinestring))
+ boost::end(multilinestring),
+ per_ls(strategy))
)
{
return false;