DIALOG_GLOBAL_DELETION and teardrop.cpp: fix incorrect call to GetLayer() for ZONES

This commit is contained in:
jean-pierre charras 2022-03-11 11:02:45 +01:00
parent 263faf2870
commit 2bf56c2441
2 changed files with 11 additions and 7 deletions

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -143,11 +143,12 @@ void DIALOG_GLOBAL_DELETION::DoGlobalDeletions()
if( delete_all || m_delZones->GetValue() ) if( delete_all || m_delZones->GetValue() )
{ {
int area_index = 0; int area_index = 0;
auto item = board->GetArea( area_index ); ZONE* item = board->GetArea( area_index );
while( item ) while( item )
{ {
if( delete_all || layers_filter[item->GetLayer()] ) // The zone will be deleted if it is ar least on one selected layer.
if( delete_all || ( layers_filter & item->GetLayerSet() ).any() )
{ {
commit.Remove( item ); commit.Remove( item );
gen_rastnest = true; gen_rastnest = true;

View File

@ -208,6 +208,9 @@ int TEARDROP_MANAGER::SetTeardrops( BOARD_COMMIT* aCommitter, bool aFollowTracks
void TEARDROP_MANAGER::setTeardropPriorities() void TEARDROP_MANAGER::setTeardropPriorities()
{ {
// Note: a teardrop area is on only one layer, so using GetFirstLayer() is OK
// to know the zone layer of a teardrop
int priority_base = MAGIC_TEARDROP_ZONE_ID; int priority_base = MAGIC_TEARDROP_ZONE_ID;
// The sort function to sort by increasing copper layers. Group by layers. // The sort function to sort by increasing copper layers. Group by layers.
@ -216,10 +219,10 @@ void TEARDROP_MANAGER::setTeardropPriorities()
{ {
bool operator()(ZONE* a, ZONE* b) const bool operator()(ZONE* a, ZONE* b) const
{ {
if( a->GetLayer() == b->GetLayer() ) if( a->GetFirstLayer() == b->GetFirstLayer() )
return a->GetOutlineArea() > b->GetOutlineArea(); return a->GetOutlineArea() > b->GetOutlineArea();
return a->GetLayer() < b->GetLayer(); return a->GetFirstLayer() < b->GetFirstLayer();
} }
} compareLess; } compareLess;
@ -232,9 +235,9 @@ void TEARDROP_MANAGER::setTeardropPriorities()
for( ZONE* td: m_createdTdList ) for( ZONE* td: m_createdTdList )
{ {
if( td->GetLayer() != curr_layer ) if( td->GetFirstLayer() != curr_layer )
{ {
curr_layer = td->GetLayer(); curr_layer = td->GetFirstLayer();
priority_base = MAGIC_TEARDROP_ZONE_ID; priority_base = MAGIC_TEARDROP_ZONE_ID;
} }