Remove ZONE::ClearFilledPolysList() and fix ZONE::Unfill()

ClearFilledPolysList is redundant and Unfill() was missing the clearing
of m_insulatedIslands

This fixes potential latent bugs in zone unfilling.
This commit is contained in:
Roberto Fernandez Bautista 2021-03-19 19:32:44 +00:00 committed by Jeff Young
parent 50aafb9d2a
commit a9eb83201e
4 changed files with 4 additions and 17 deletions

View File

@ -1293,7 +1293,7 @@ void PCB_POINT_EDITOR::updateItem() const
case PCB_ZONE_T:
{
ZONE* zone = static_cast<ZONE*>( item );
zone->ClearFilledPolysList();
zone->UnFill();
SHAPE_POLY_SET& outline = *zone->Outline();
for( int i = 0; i < outline.TotalVertices(); ++i )

View File

@ -204,8 +204,7 @@ int ZONE_FILLER_TOOL::ZoneUnfill( const TOOL_EVENT& aEvent )
commit.Modify( zone );
zone->SetIsFilled( false );
zone->ClearFilledPolysList();
zone->UnFill();
}
commit.Push( _( "Unfill Zone" ) );
@ -223,8 +222,7 @@ int ZONE_FILLER_TOOL::ZoneUnfillAll( const TOOL_EVENT& aEvent )
{
commit.Modify( zone );
zone->SetIsFilled( false );
zone->ClearFilledPolysList();
zone->UnFill();
}
commit.Push( _( "Unfill All Zones" ) );

View File

@ -190,6 +190,7 @@ bool ZONE::UnFill()
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
{
change |= !pair.second.IsEmpty();
m_insulatedIslands[pair.first].clear();
pair.second.RemoveAllContours();
}

View File

@ -621,18 +621,6 @@ public:
*/
bool IsSame( const ZONE &aZoneToCompare );
/**
* Clear the list of filled polygons.
*/
void ClearFilledPolysList()
{
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
{
m_insulatedIslands[pair.first].clear();
pair.second.RemoveAllContours();
}
}
bool HasFilledPolysForLayer( PCB_LAYER_ID aLayer ) const
{
return m_FilledPolysList.count( aLayer ) > 0;