ZONE_CREATE_HELPER: fix zone cutout creation in zones with holes, reinit selection with the resulting zone

Fixes: lp:1784268
* https://bugs.launchpad.net/kicad/+bug/1784268
This commit is contained in:
Tomasz Wlostowski 2018-07-31 22:33:53 +02:00
parent 91e3d21d68
commit 099fcf1247
1 changed files with 10 additions and 1 deletions

View File

@ -117,7 +117,6 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINE
std::vector<ZONE_CONTAINER*> newZones; std::vector<ZONE_CONTAINER*> newZones;
SHAPE_POLY_SET originalOutline( *aZone.Outline() ); SHAPE_POLY_SET originalOutline( *aZone.Outline() );
originalOutline.BooleanSubtract( *aCutout.Outline(), SHAPE_POLY_SET::PM_FAST ); originalOutline.BooleanSubtract( *aCutout.Outline(), SHAPE_POLY_SET::PM_FAST );
for( int i = 0; i < originalOutline.OutlineCount(); i++ ) for( int i = 0; i < originalOutline.OutlineCount(); i++ )
@ -125,6 +124,11 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINE
auto newZoneOutline = new SHAPE_POLY_SET; auto newZoneOutline = new SHAPE_POLY_SET;
newZoneOutline->AddOutline( originalOutline.Outline( i ) ); newZoneOutline->AddOutline( originalOutline.Outline( i ) );
for (int j = 0; j < originalOutline.HoleCount(i) ; j++ )
{
newZoneOutline->AddHole( originalOutline.CHole(i, j), i );
}
auto newZone = new ZONE_CONTAINER( aZone ); auto newZone = new ZONE_CONTAINER( aZone );
newZone->SetOutline( newZoneOutline ); newZone->SetOutline( newZoneOutline );
newZone->SetLocalFlags( 1 ); newZone->SetLocalFlags( 1 );
@ -138,6 +142,11 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINE
ZONE_FILLER filler( board ); ZONE_FILLER filler( board );
filler.Fill( newZones ); filler.Fill( newZones );
auto toolMgr = m_tool.GetManager();
toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
toolMgr->RunAction( PCB_ACTIONS::selectItem, true, newZones[0] );
} }