mirror of
https://github.com/boostorg/geometry.git
synced 2026-01-31 08:12:13 +00:00
[traverse] replace switch_source by inspecting region ids locally
This commit is contained in:
@@ -236,7 +236,23 @@ struct traversal
|
||||
segment_identifier const& current,
|
||||
segment_identifier const& previous) const
|
||||
{
|
||||
return turn.switch_source
|
||||
turn_operation_type const& op0 = turn.operations[0];
|
||||
turn_operation_type const& op1 = turn.operations[1];
|
||||
|
||||
bool const switch_source = op0.enriched.region_id != -1
|
||||
&& op0.enriched.region_id == op1.enriched.region_id;
|
||||
|
||||
#if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR)
|
||||
if (switch_source)
|
||||
{
|
||||
std::cout << "Switch source at " << &turn << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "DON'T SWITCH SOURCES at " << &turn << std::endl;
|
||||
}
|
||||
#endif
|
||||
return switch_source
|
||||
? current.*Member != previous.*Member
|
||||
: current.*Member == previous.*Member;
|
||||
}
|
||||
@@ -247,16 +263,6 @@ struct traversal
|
||||
{
|
||||
// For uu/ii, only switch sources if indicated
|
||||
|
||||
#if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR)
|
||||
if (turn.switch_source)
|
||||
{
|
||||
std::cout << "Switch source at " << turn_index << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "DON'T SWITCH SOURCES at " << turn_index << std::endl;
|
||||
}
|
||||
#endif
|
||||
if (OverlayType == overlay_buffer
|
||||
|| OverlayType == overlay_dissolve_union)
|
||||
{
|
||||
|
||||
@@ -611,29 +611,6 @@ struct traversal_switch_detector
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through all uu/ii turns (non-clustered)
|
||||
for (std::size_t turn_index = 0; turn_index < m_turns.size(); ++turn_index)
|
||||
{
|
||||
turn_type& turn = m_turns[turn_index];
|
||||
|
||||
if (turn.discarded
|
||||
|| turn.blocked()
|
||||
|| turn.is_clustered()
|
||||
|| ! (turn.both(operation_union) || turn.both(operation_intersection)))
|
||||
{
|
||||
// Skip discarded, blocked, non-uu/ii and clustered turns
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
signed_size_type const region0 = get_region_id(turn.operations[0]);
|
||||
signed_size_type const region1 = get_region_id(turn.operations[1]);
|
||||
|
||||
// Switch sources for same region
|
||||
turn.switch_source = region0 == region1;
|
||||
}
|
||||
|
||||
|
||||
#if defined(BOOST_GEOMETRY_DEBUG_TRAVERSAL_SWITCH_DETECTOR)
|
||||
std::cout << "SWITCH END ITERATION" << std::endl;
|
||||
|
||||
|
||||
@@ -94,7 +94,6 @@ struct turn_info
|
||||
bool discarded;
|
||||
|
||||
bool has_colocated_both; // Colocated with a uu turn (for union) or ii (other)
|
||||
bool switch_source; // For u/u turns which can either switch or not
|
||||
|
||||
Container operations;
|
||||
|
||||
@@ -104,7 +103,6 @@ struct turn_info
|
||||
, cluster_id(-1)
|
||||
, discarded(false)
|
||||
, has_colocated_both(false)
|
||||
, switch_source(false)
|
||||
{}
|
||||
|
||||
inline bool both(operation_type type) const
|
||||
|
||||
@@ -127,7 +127,6 @@ struct dissolve_ring_or_polygon
|
||||
turn.discarded = false;
|
||||
turn.cluster_id = -1;
|
||||
turn.has_colocated_both = false;
|
||||
turn.switch_source = false;
|
||||
turn.touch_only = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user