diff options
Diffstat (limited to 'boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp')
-rw-r--r-- | boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp | 57 |
1 files changed, 18 insertions, 39 deletions
diff --git a/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp b/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp index 104bd6b8e7..e0dfee19a8 100644 --- a/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp +++ b/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp @@ -64,9 +64,7 @@ struct traversal_ring_creator , m_clusters(clusters) , m_robust_policy(robust_policy) , m_visitor(visitor) - , m_has_uu(false) { - } template <typename Ring> @@ -123,7 +121,8 @@ struct traversal_ring_creator } bool is_touching = false; - if (! m_trav.select_turn(start_turn_index, turn_index, op_index, + if (! m_trav.select_turn(start_turn_index, start_op_index, + turn_index, op_index, is_touching, previous_op_index, previous_turn_index, previous_seg_id, is_start)) @@ -189,6 +188,18 @@ struct traversal_ring_creator return traverse_error_none; } + if (start_turn.cluster_id >= 0) + { + turn_type const& turn = m_turns[current_turn_index]; + if (turn.cluster_id == start_turn.cluster_id) + { + turn_operation_type& op = m_turns[start_turn_index].operations[current_op_index]; + op.visited.set_finished(); + m_visitor.visit_traverse(m_turns, m_turns[current_turn_index], start_op, "Early finish (cluster)"); + return traverse_error_none; + } + } + std::size_t const max_iterations = 2 + 2 * m_turns.size(); for (std::size_t i = 0; i <= max_iterations; i++) { @@ -276,49 +287,21 @@ struct traversal_ring_creator template <typename Rings> void iterate(Rings& rings, std::size_t& finalized_ring_size, - typename Backtrack::state_type& state, - int pass) + typename Backtrack::state_type& state) { - if (pass == 1) - { - if (target_operation == operation_intersection) - { - // Second pass currently only used for uu - return; - } - if (! m_has_uu) - { - // There is no uu found in first pass - return; - } - } - - // Iterate through all unvisited points for (std::size_t turn_index = 0; turn_index < m_turns.size(); ++turn_index) { - turn_type const& start_turn = m_turns[turn_index]; + turn_type const& turn = m_turns[turn_index]; - if (start_turn.discarded || start_turn.blocked()) + if (turn.discarded || turn.blocked()) { // Skip discarded and blocked turns continue; } - if (target_operation == operation_union) - { - if (start_turn.both(operation_union)) - { - // Start with a uu-turn only in the second pass - m_has_uu = true; - if (pass == 0) - { - continue; - } - } - } for (int op_index = 0; op_index < 2; op_index++) { - traverse_with_operation(start_turn, turn_index, op_index, + traverse_with_operation(turn, turn_index, op_index, rings, finalized_ring_size, state); } } @@ -333,10 +316,6 @@ private: Clusters const& m_clusters; RobustPolicy const& m_robust_policy; Visitor& m_visitor; - - // Next member is only used for operation union - bool m_has_uu; - }; }} // namespace detail::overlay |