Trim zone fills to board outline.

Fixes: lp:1820306
* https://bugs.launchpad.net/kicad/+bug/1820306

(cherry picked from commit 52e3a1d7c4)
This commit is contained in:
Jeff Young 2019-04-08 13:10:08 +01:00
parent 4147da312b
commit 7ceff4cf5d
1 changed files with 7 additions and 2 deletions

View File

@ -190,7 +190,7 @@ bool ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
connectivity->SetProgressReporter( m_progressReporter ); connectivity->SetProgressReporter( m_progressReporter );
connectivity->FindIsolatedCopperIslands( toFill ); connectivity->FindIsolatedCopperIslands( toFill );
// Now remove insulated copper islands // Now remove insulated copper islands and islands outside the board edge
bool outOfDate = false; bool outOfDate = false;
for( auto& zone : toFill ) for( auto& zone : toFill )
@ -198,7 +198,7 @@ bool ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
std::sort( zone.m_islands.begin(), zone.m_islands.end(), std::greater<int>() ); std::sort( zone.m_islands.begin(), zone.m_islands.end(), std::greater<int>() );
SHAPE_POLY_SET poly = zone.m_zone->GetFilledPolysList(); SHAPE_POLY_SET poly = zone.m_zone->GetFilledPolysList();
// only zones with net code > 0 can have islands to remove by definition // only zones with net code > 0 can have insulated islands by definition
if( zone.m_zone->GetNetCode() > 0 ) if( zone.m_zone->GetNetCode() > 0 )
{ {
for( auto idx : zone.m_islands ) for( auto idx : zone.m_islands )
@ -207,6 +207,11 @@ bool ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
} }
} }
SHAPE_POLY_SET boardOutline;
if( m_board->GetBoardPolygonOutlines( boardOutline ) )
poly.BooleanIntersection( boardOutline, SHAPE_POLY_SET::PM_FAST );
zone.m_zone->SetFilledPolysList( poly ); zone.m_zone->SetFilledPolysList( poly );
if( aCheck && zone.m_zone->GetHashValue() != poly.GetHash() ) if( aCheck && zone.m_zone->GetHashValue() != poly.GetHash() )