Skip to content

Commit d096cc8

Browse files
committed
[traverse] use passed turn instead of turn index
1 parent 8f6cf26 commit d096cc8

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

include/boost/geometry/algorithms/detail/overlay/traversal.hpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -232,21 +232,20 @@ struct traversal
232232
}
233233

234234
template <signed_size_type segment_identifier::*Member>
235-
inline bool select_source_generic(bool switch_source,
235+
inline bool select_source_generic(turn_type const& turn,
236236
segment_identifier const& current,
237237
segment_identifier const& previous) const
238238
{
239-
return switch_source
239+
return turn.switch_source
240240
? current.*Member != previous.*Member
241241
: current.*Member == previous.*Member;
242242
}
243243

244-
inline bool select_source(signed_size_type turn_index,
244+
inline bool select_source(turn_type const& turn,
245245
segment_identifier const& candidate_seg_id,
246246
segment_identifier const& previous_seg_id) const
247247
{
248248
// For uu/ii, only switch sources if indicated
249-
turn_type const& turn = m_turns[turn_index];
250249

251250
#if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR)
252251
if (turn.switch_source)
@@ -263,19 +262,19 @@ struct traversal
263262
{
264263
// Buffer does not use source_index (always 0).
265264
return select_source_generic<&segment_identifier::multi_index>(
266-
turn.switch_source, candidate_seg_id, previous_seg_id);
265+
turn, candidate_seg_id, previous_seg_id);
267266
}
268267

269268
if (is_self_turn<OverlayType>(turn))
270269
{
271270
// Also, if it is a self-turn, stay on same ring (multi/ring)
272271
return select_source_generic<&segment_identifier::multi_index>(
273-
turn.switch_source, candidate_seg_id, previous_seg_id);
272+
turn, candidate_seg_id, previous_seg_id);
274273
}
275274

276275
// Use source_index
277276
return select_source_generic<&segment_identifier::source_index>(
278-
turn.switch_source, candidate_seg_id, previous_seg_id);
277+
turn, candidate_seg_id, previous_seg_id);
279278
}
280279

281280
inline bool traverse_possible(signed_size_type turn_index) const
@@ -342,7 +341,6 @@ struct traversal
342341

343342
inline
344343
bool select_noncc_operation(turn_type const& turn,
345-
signed_size_type turn_index,
346344
segment_identifier const& previous_seg_id,
347345
int& selected_op_index) const
348346
{
@@ -355,7 +353,7 @@ struct traversal
355353
if (op.operation == target_operation
356354
&& ! op.visited.finished()
357355
&& ! op.visited.visited()
358-
&& (! result || select_source(turn_index, op.seg_id, previous_seg_id)))
356+
&& (! result || select_source(turn, op.seg_id, previous_seg_id)))
359357
{
360358
selected_op_index = i;
361359
debug_traverse(turn, op, "Candidate");
@@ -368,7 +366,6 @@ struct traversal
368366

369367
inline
370368
bool select_operation(const turn_type& turn,
371-
signed_size_type turn_index,
372369
signed_size_type start_turn_index,
373370
segment_identifier const& previous_seg_id,
374371
int& selected_op_index) const
@@ -382,7 +379,7 @@ struct traversal
382379
}
383380
else
384381
{
385-
result = select_noncc_operation(turn, turn_index,
382+
result = select_noncc_operation(turn,
386383
previous_seg_id, selected_op_index);
387384
}
388385
if (result)
@@ -878,7 +875,7 @@ struct traversal
878875
return false;
879876
}
880877

881-
if (! select_operation(current_turn, turn_index,
878+
if (! select_operation(current_turn,
882879
start_turn_index,
883880
previous_seg_id,
884881
op_index))

0 commit comments

Comments
 (0)