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:
parent
91e3d21d68
commit
099fcf1247
|
@ -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] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue