Fix some cases where PCB_FP_ZONE_T was left out.

Fixes https://gitlab.com/kicad/code/kicad/issues/7615
This commit is contained in:
Jeff Young 2021-03-08 12:57:33 +00:00
parent c1003e2ddd
commit 2bc10d58b5
5 changed files with 40 additions and 27 deletions

View File

@ -250,8 +250,11 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
} }
// Zones should pull from the copper layer // Zones should pull from the copper layer
if( item && item->Type() == PCB_ZONE_T && IsZoneLayer( aLayer ) ) if( item && ( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) )
aLayer = aLayer - LAYER_ZONE_START; {
if( IsZoneLayer( aLayer ) )
aLayer = aLayer - LAYER_ZONE_START;
}
// Hole walls should pull from the copper layer // Hole walls should pull from the copper layer
if( aLayer == LAYER_PAD_HOLEWALLS ) if( aLayer == LAYER_PAD_HOLEWALLS )

View File

@ -1790,19 +1790,23 @@ void PCB_POINT_EDITOR::setAltConstraint( bool aEnabled )
if( aEnabled ) if( aEnabled )
{ {
EDIT_LINE* line = dynamic_cast<EDIT_LINE*>( m_editedPoint ); EDIT_LINE* line = dynamic_cast<EDIT_LINE*>( m_editedPoint );
bool isPoly = false; bool isPoly;
if( m_editPoints->GetParent()->Type() == PCB_ZONE_T switch( m_editPoints->GetParent()->Type() )
|| m_editPoints->GetParent()->Type() == PCB_FP_ZONE_T )
{ {
case PCB_ZONE_T:
case PCB_FP_ZONE_T:
isPoly = true; isPoly = true;
} break;
else if( m_editPoints->GetParent()->Type() == PCB_SHAPE_T case PCB_SHAPE_T:
|| m_editPoints->GetParent()->Type() == PCB_FP_SHAPE_T ) case PCB_FP_SHAPE_T:
{ isPoly = static_cast<PCB_SHAPE*>( m_editPoints->GetParent() )->GetShape() == S_POLYGON;
PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( m_editPoints->GetParent() ); break;
isPoly = shape->GetShape() == S_POLYGON;
default:
isPoly = false;
break;
} }
if( line && isPoly ) if( line && isPoly )
@ -1929,26 +1933,32 @@ bool PCB_POINT_EDITOR::removeCornerCondition( const SELECTION& )
if( !m_editPoints || !m_editedPoint ) if( !m_editPoints || !m_editedPoint )
return false; return false;
EDA_ITEM* item = m_editPoints->GetParent(); EDA_ITEM* item = m_editPoints->GetParent();
SHAPE_POLY_SET* polyset = nullptr;
if( !item ) if( !item )
return false; return false;
if( !( item->Type() == PCB_ZONE_T switch( item->Type() )
|| item->Type() == PCB_FP_ZONE_T
|| ( ( item->Type() == PCB_FP_SHAPE_T || item->Type() == PCB_SHAPE_T )
&& static_cast<PCB_SHAPE*>( item )->GetShape() == S_POLYGON ) ) )
{ {
case PCB_ZONE_T:
case PCB_FP_ZONE_T:
polyset = static_cast<ZONE*>( item )->Outline();
break;
case PCB_SHAPE_T:
case PCB_FP_SHAPE_T:
if( static_cast<PCB_SHAPE*>( item )->GetShape() == S_POLYGON )
polyset = &static_cast<PCB_SHAPE*>( item )->GetPolyShape();
else
return false;
break;
default:
return false; return false;
} }
SHAPE_POLY_SET *polyset;
if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
polyset = static_cast<ZONE*>( item )->Outline();
else
polyset = &static_cast<PCB_SHAPE*>( item )->GetPolyShape();
auto vertex = findVertex( *polyset, *m_editedPoint ); auto vertex = findVertex( *polyset, *m_editedPoint );
if( !vertex.first ) if( !vertex.first )

View File

@ -378,7 +378,7 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
for( EDA_ITEM* item : aCollector ) for( EDA_ITEM* item : aCollector )
{ {
if( item->Type() == PCB_ZONE_T ) if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
{ {
ZONE* zone = static_cast<ZONE*>( item ); ZONE* zone = static_cast<ZONE*>( item );
@ -2419,7 +2419,7 @@ void PCB_SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector
BOARD_ITEM* item = aCollector[i]; BOARD_ITEM* item = aCollector[i];
double area; double area;
if( item->Type() == PCB_ZONE_T if( ( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
&& static_cast<ZONE*>( item )->HitTestForEdge( where, MAX_SLOP * pixel / 2 ) ) && static_cast<ZONE*>( item )->HitTestForEdge( where, MAX_SLOP * pixel / 2 ) )
{ {
// Zone borders are very specific, so make them "small" // Zone borders are very specific, so make them "small"

View File

@ -198,7 +198,7 @@ int ZONE_FILLER_TOOL::ZoneUnfill( const TOOL_EVENT& aEvent )
for( EDA_ITEM* item : selection() ) for( EDA_ITEM* item : selection() )
{ {
assert( item->Type() == PCB_ZONE_T ); assert( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T );
ZONE* zone = static_cast<ZONE*>( item ); ZONE* zone = static_cast<ZONE*>( item );

View File

@ -1095,7 +1095,7 @@ BITMAP_DEF ZONE::GetMenuImage() const
void ZONE::SwapData( BOARD_ITEM* aImage ) void ZONE::SwapData( BOARD_ITEM* aImage )
{ {
assert( aImage->Type() == PCB_ZONE_T ); assert( aImage->Type() == PCB_ZONE_T || aImage->Type() == PCB_FP_ZONE_T );
std::swap( *((ZONE*) this), *((ZONE*) aImage) ); std::swap( *((ZONE*) this), *((ZONE*) aImage) );
} }