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: case PCB_ZONE_T:
{ {
ZONE* zone = static_cast<ZONE*>( item ); ZONE* zone = static_cast<ZONE*>( item );
zone->ClearFilledPolysList(); zone->UnFill();
SHAPE_POLY_SET& outline = *zone->Outline(); SHAPE_POLY_SET& outline = *zone->Outline();
for( int i = 0; i < outline.TotalVertices(); ++i ) 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 ); commit.Modify( zone );
zone->SetIsFilled( false ); zone->UnFill();
zone->ClearFilledPolysList();
} }
commit.Push( _( "Unfill Zone" ) ); commit.Push( _( "Unfill Zone" ) );
@ -223,8 +222,7 @@ int ZONE_FILLER_TOOL::ZoneUnfillAll( const TOOL_EVENT& aEvent )
{ {
commit.Modify( zone ); commit.Modify( zone );
zone->SetIsFilled( false ); zone->UnFill();
zone->ClearFilledPolysList();
} }
commit.Push( _( "Unfill All Zones" ) ); 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 ) for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
{ {
change |= !pair.second.IsEmpty(); change |= !pair.second.IsEmpty();
m_insulatedIslands[pair.first].clear();
pair.second.RemoveAllContours(); pair.second.RemoveAllContours();
} }

View File

@ -621,18 +621,6 @@ public:
*/ */
bool IsSame( const ZONE &aZoneToCompare ); 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 bool HasFilledPolysForLayer( PCB_LAYER_ID aLayer ) const
{ {
return m_FilledPolysList.count( aLayer ) > 0; return m_FilledPolysList.count( aLayer ) > 0;