EAGLE: fix missing undefined layer check for rectangle zones.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16619
This commit is contained in:
Alex Shvartzkop 2024-01-17 01:18:17 +03:00
parent faeec25557
commit 27b560b439
1 changed files with 18 additions and 14 deletions

View File

@ -903,26 +903,30 @@ void PCB_IO_EAGLE::loadPlain( wxXmlNode* aGraphics )
ERECT r( gr ); ERECT r( gr );
PCB_LAYER_ID layer = kicad_layer( r.layer ); PCB_LAYER_ID layer = kicad_layer( r.layer );
ZONE* zone = new ZONE( m_board );
m_board->Add( zone, ADD_MODE::APPEND ); if( layer != UNDEFINED_LAYER )
{
ZONE* zone = new ZONE( m_board );
zone->SetLayer( layer ); m_board->Add( zone, ADD_MODE::APPEND );
zone->SetNetCode( NETINFO_LIST::UNCONNECTED );
ZONE_BORDER_DISPLAY_STYLE outline_hatch = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE; zone->SetLayer( layer );
zone->SetNetCode( NETINFO_LIST::UNCONNECTED );
const int outlineIdx = -1; // this is the id of the copper zone main outline ZONE_BORDER_DISPLAY_STYLE outline_hatch = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE;
zone->AppendCorner( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x2 ), kicad_y( r.y1 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x2 ), kicad_y( r.y2 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
if( r.rot ) const int outlineIdx = -1; // this is the id of the copper zone main outline
zone->Rotate( zone->GetPosition(), EDA_ANGLE( r.rot->degrees, DEGREES_T ) ); zone->AppendCorner( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x2 ), kicad_y( r.y1 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x2 ), kicad_y( r.y2 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
// this is not my fault: if( r.rot )
zone->SetBorderDisplayStyle( outline_hatch, ZONE::GetDefaultHatchPitch(), true ); zone->Rotate( zone->GetPosition(), EDA_ANGLE( r.rot->degrees, DEGREES_T ) );
// this is not my fault:
zone->SetBorderDisplayStyle( outline_hatch, ZONE::GetDefaultHatchPitch(), true );
}
m_xpath->pop(); m_xpath->pop();
} }