Browse Source

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.
6.0.7
Roberto Fernandez Bautista 5 years ago
committed by Jeff Young
parent
commit
a9eb83201e
  1. 2
      pcbnew/tools/pcb_point_editor.cpp
  2. 6
      pcbnew/tools/zone_filler_tool.cpp
  3. 1
      pcbnew/zone.cpp
  4. 12
      pcbnew/zone.h

2
pcbnew/tools/pcb_point_editor.cpp

@ -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 )

6
pcbnew/tools/zone_filler_tool.cpp

@ -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" ) );

1
pcbnew/zone.cpp

@ -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();
}

12
pcbnew/zone.h

@ -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;

Loading…
Cancel
Save