Fix zone merge intersection algorithm.
Fixes https://gitlab.com/kicad/code/kicad/issues/11492
This commit is contained in:
parent
9fbf8e6f5d
commit
5f10c15a87
|
@ -1465,7 +1465,18 @@ int BOARD_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !board->TestZoneIntersection( curr_area, firstZone ) )
|
bool intersects = curr_area == firstZone;
|
||||||
|
|
||||||
|
for( ZONE* candidate : toMerge )
|
||||||
|
{
|
||||||
|
if( intersects )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( board->TestZoneIntersection( curr_area, candidate ) )
|
||||||
|
intersects = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !intersects )
|
||||||
{
|
{
|
||||||
wxLogMessage( _( "Some zones did not intersect and were not merged." ) );
|
wxLogMessage( _( "Some zones did not intersect and were not merged." ) );
|
||||||
continue;
|
continue;
|
||||||
|
@ -1476,12 +1487,15 @@ int BOARD_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||||
|
|
||||||
if( mergeZones( m_frame, commit, toMerge, merged ) )
|
if( !toMerge.empty() )
|
||||||
{
|
{
|
||||||
commit.Push( wxT( "Merge zones" ) );
|
if( mergeZones( m_frame, commit, toMerge, merged ) )
|
||||||
|
{
|
||||||
|
commit.Push( wxT( "Merge zones" ) );
|
||||||
|
|
||||||
for( EDA_ITEM* item : merged )
|
for( EDA_ITEM* item : merged )
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, item );
|
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, item );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue