Pcbnew: fix a serious issue in ZONE_FILLER.

This commit is contained in:
jean-pierre charras 2019-04-09 11:38:18 +02:00
parent 59e6d3bf22
commit 37ae0bf809
1 changed files with 13 additions and 4 deletions

View File

@ -188,25 +188,34 @@ bool ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones, bool aCheck )
// Now remove insulated copper islands and islands outside the board edge // Now remove insulated copper islands and islands outside the board edge
bool outOfDate = false; bool outOfDate = false;
SHAPE_POLY_SET boardOutline;
bool clip_to_brd_outlines = m_board->GetBoardPolygonOutlines( boardOutline );
for( auto& zone : toFill ) for( auto& zone : toFill )
{ {
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();
// Remove solid areas outside the board cutouts and the insulated islands
// only zones with net code > 0 can have insulated islands 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 )
{ {
// solid areas outside the board cutouts are also removed, because they are usually
// insulated islands
for( auto idx : zone.m_islands ) for( auto idx : zone.m_islands )
{ {
poly.DeletePolygon( idx ); poly.DeletePolygon( idx );
} }
} }
// zones with no net can have areas outside the board cutouts.
SHAPE_POLY_SET boardOutline; // Please, use only this clipping for no nets zones: this is a very time consumming
// calculation (x 5 in a test case if made for all zones),
if( m_board->GetBoardPolygonOutlines( boardOutline ) ) // mainly due to poly.Fracture
else if( clip_to_brd_outlines )
{
poly.BooleanIntersection( boardOutline, SHAPE_POLY_SET::PM_FAST ); poly.BooleanIntersection( boardOutline, SHAPE_POLY_SET::PM_FAST );
poly.Fracture( SHAPE_POLY_SET::PM_FAST );
}
zone.m_zone->SetFilledPolysList( poly ); zone.m_zone->SetFilledPolysList( poly );