inline bool apply(Range const& range) { // if already rejected (temp workaround?) if ( found_not_touch ) return true; typedef typename boost::range_iterator<Range const>::type iterator; for ( iterator it = boost::begin(range) ; it != boost::end(range) ; ++it ) { if ( it->has(overlay::operation_intersection) ) { found_not_touch = true; return true; } switch(it->method) { case overlay::method_crosses: found_not_touch = true; return true; case overlay::method_equal: // Segment spatially equal means: at the right side // the polygon internally overlaps. So return false. found_not_touch = true; return true; case overlay::method_touch: case overlay::method_touch_interior: case overlay::method_collinear: if ( ok_for_touch(*it) ) { found_touch = true; } else { found_not_touch = true; return true; } break; case overlay::method_none : case overlay::method_disjoint : case overlay::method_error : break; } } return false; }
inline bool has_only_turns(Turns const& turns) { bool has_touch = false; typedef typename boost::range_iterator<Turns const>::type iterator_type; for (iterator_type it = boost::begin(turns); it != boost::end(turns); ++it) { if (it->has(detail::overlay::operation_intersection)) { return false; } switch(it->method) { case detail::overlay::method_crosses: return false; case detail::overlay::method_equal: // Segment spatially equal means: at the right side // the polygon internally overlaps. So return false. return false; case detail::overlay::method_touch: case detail::overlay::method_touch_interior: case detail::overlay::method_collinear: if (ok_for_touch(*it)) { has_touch = true; } else { return false; } break; case detail::overlay::method_none : case detail::overlay::method_disjoint : case detail::overlay::method_error : break; } } return has_touch; }