fix BUG parsing the kicad_pcb (layers ..) declaration section. First non-cu was being dropped.
This commit is contained in:
parent
c6af2a7974
commit
4d9f87bf0b
|
@ -89,11 +89,18 @@ enum LAYER_T
|
||||||
*/
|
*/
|
||||||
struct LAYER
|
struct LAYER
|
||||||
{
|
{
|
||||||
LAYER() :
|
LAYER()
|
||||||
m_type( LT_SIGNAL ),
|
{
|
||||||
m_visible( true ),
|
clear();
|
||||||
m_number( 0 )
|
}
|
||||||
{}
|
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
m_type = LT_SIGNAL;
|
||||||
|
m_visible = true;
|
||||||
|
m_number = 0;
|
||||||
|
m_name.clear();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LAYER( const wxString& aName = wxEmptyString,
|
LAYER( const wxString& aName = wxEmptyString,
|
||||||
|
|
|
@ -703,6 +703,8 @@ void PCB_PARSER::parseLayer( LAYER* aLayer ) throw( IO_ERROR, PARSE_ERROR )
|
||||||
std::string type;
|
std::string type;
|
||||||
bool isVisible = true;
|
bool isVisible = true;
|
||||||
|
|
||||||
|
aLayer->clear();
|
||||||
|
|
||||||
if( CurTok() != T_LEFT )
|
if( CurTok() != T_LEFT )
|
||||||
Expecting( T_LEFT );
|
Expecting( T_LEFT );
|
||||||
|
|
||||||
|
@ -744,13 +746,12 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
|
||||||
LSET visibleLayers;
|
LSET visibleLayers;
|
||||||
LSET enabledLayers;
|
LSET enabledLayers;
|
||||||
int copperLayerCount = 0;
|
int copperLayerCount = 0;
|
||||||
|
LAYER layer;
|
||||||
|
|
||||||
std::vector<LAYER> cu;
|
std::vector<LAYER> cu;
|
||||||
|
|
||||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||||
{
|
{
|
||||||
LAYER layer;
|
|
||||||
|
|
||||||
parseLayer( &layer );
|
parseLayer( &layer );
|
||||||
|
|
||||||
if( layer.m_type == LT_UNDEFINED ) // it's a non-copper layer
|
if( layer.m_type == LT_UNDEFINED ) // it's a non-copper layer
|
||||||
|
@ -794,15 +795,9 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
|
||||||
copperLayerCount = cu.size();
|
copperLayerCount = cu.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( token != T_RIGHT )
|
// process non-copper layers
|
||||||
|
while( token != T_RIGHT )
|
||||||
{
|
{
|
||||||
// read any non-copper layers
|
|
||||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
|
||||||
{
|
|
||||||
LAYER layer;
|
|
||||||
|
|
||||||
parseLayer( &layer );
|
|
||||||
|
|
||||||
LAYER_ID_MAP::const_iterator it = m_layerIndices.find( UTF8( layer.m_name ) );
|
LAYER_ID_MAP::const_iterator it = m_layerIndices.find( UTF8( layer.m_name ) );
|
||||||
|
|
||||||
if( it == m_layerIndices.end() )
|
if( it == m_layerIndices.end() )
|
||||||
|
@ -825,10 +820,16 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
|
||||||
if( layer.m_visible )
|
if( layer.m_visible )
|
||||||
visibleLayers.set( layer.m_number );
|
visibleLayers.set( layer.m_number );
|
||||||
|
|
||||||
//DBG( printf( "aux m_visible:%s\n", layer.m_visible ? "true" : "false" );)
|
// DBG( printf( "aux m_visible:%s\n", layer.m_visible ? "true" : "false" );)
|
||||||
|
|
||||||
m_board->SetLayer( LAYER_ID( layer.m_number ), layer );
|
m_board->SetLayer( it->second, layer );
|
||||||
}
|
|
||||||
|
token = NextTok();
|
||||||
|
|
||||||
|
if( token != T_LEFT )
|
||||||
|
break;
|
||||||
|
|
||||||
|
parseLayer( &layer );
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need at least 2 copper layers and there must be an even number of them.
|
// We need at least 2 copper layers and there must be an even number of them.
|
||||||
|
|
Loading…
Reference in New Issue