mirror of
https://github.com/boostorg/geometry.git
synced 2026-01-31 20:22:09 +00:00
[traverse] use passed turn instead of turn index
This commit is contained in:
@@ -232,21 +232,20 @@ struct traversal
|
||||
}
|
||||
|
||||
template <signed_size_type segment_identifier::*Member>
|
||||
inline bool select_source_generic(bool switch_source,
|
||||
inline bool select_source_generic(turn_type const& turn,
|
||||
segment_identifier const& current,
|
||||
segment_identifier const& previous) const
|
||||
{
|
||||
return switch_source
|
||||
return turn.switch_source
|
||||
? current.*Member != previous.*Member
|
||||
: current.*Member == previous.*Member;
|
||||
}
|
||||
|
||||
inline bool select_source(signed_size_type turn_index,
|
||||
inline bool select_source(turn_type const& turn,
|
||||
segment_identifier const& candidate_seg_id,
|
||||
segment_identifier const& previous_seg_id) const
|
||||
{
|
||||
// For uu/ii, only switch sources if indicated
|
||||
turn_type const& turn = m_turns[turn_index];
|
||||
|
||||
#if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR)
|
||||
if (turn.switch_source)
|
||||
@@ -263,19 +262,19 @@ struct traversal
|
||||
{
|
||||
// Buffer does not use source_index (always 0).
|
||||
return select_source_generic<&segment_identifier::multi_index>(
|
||||
turn.switch_source, candidate_seg_id, previous_seg_id);
|
||||
turn, candidate_seg_id, previous_seg_id);
|
||||
}
|
||||
|
||||
if (is_self_turn<OverlayType>(turn))
|
||||
{
|
||||
// Also, if it is a self-turn, stay on same ring (multi/ring)
|
||||
return select_source_generic<&segment_identifier::multi_index>(
|
||||
turn.switch_source, candidate_seg_id, previous_seg_id);
|
||||
turn, candidate_seg_id, previous_seg_id);
|
||||
}
|
||||
|
||||
// Use source_index
|
||||
return select_source_generic<&segment_identifier::source_index>(
|
||||
turn.switch_source, candidate_seg_id, previous_seg_id);
|
||||
turn, candidate_seg_id, previous_seg_id);
|
||||
}
|
||||
|
||||
inline bool traverse_possible(signed_size_type turn_index) const
|
||||
@@ -342,7 +341,6 @@ struct traversal
|
||||
|
||||
inline
|
||||
bool select_noncc_operation(turn_type const& turn,
|
||||
signed_size_type turn_index,
|
||||
segment_identifier const& previous_seg_id,
|
||||
int& selected_op_index) const
|
||||
{
|
||||
@@ -355,7 +353,7 @@ struct traversal
|
||||
if (op.operation == target_operation
|
||||
&& ! op.visited.finished()
|
||||
&& ! op.visited.visited()
|
||||
&& (! result || select_source(turn_index, op.seg_id, previous_seg_id)))
|
||||
&& (! result || select_source(turn, op.seg_id, previous_seg_id)))
|
||||
{
|
||||
selected_op_index = i;
|
||||
debug_traverse(turn, op, "Candidate");
|
||||
@@ -368,7 +366,6 @@ struct traversal
|
||||
|
||||
inline
|
||||
bool select_operation(const turn_type& turn,
|
||||
signed_size_type turn_index,
|
||||
signed_size_type start_turn_index,
|
||||
segment_identifier const& previous_seg_id,
|
||||
int& selected_op_index) const
|
||||
@@ -382,7 +379,7 @@ struct traversal
|
||||
}
|
||||
else
|
||||
{
|
||||
result = select_noncc_operation(turn, turn_index,
|
||||
result = select_noncc_operation(turn,
|
||||
previous_seg_id, selected_op_index);
|
||||
}
|
||||
if (result)
|
||||
@@ -878,7 +875,7 @@ struct traversal
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! select_operation(current_turn, turn_index,
|
||||
if (! select_operation(current_turn,
|
||||
start_turn_index,
|
||||
previous_seg_id,
|
||||
op_index))
|
||||
|
||||
Reference in New Issue
Block a user