Allow GetLayer() to be used with single-layer zones.
Also fixes a bug in GetFirstLayer() where we were checking m_layerSet.size() (which is always 60) rather than m_layerSet.count() (which is the number of set layers). Fixes https://gitlab.com/kicad/code/kicad/-/issues/15233
This commit is contained in:
parent
54759389de
commit
8bb895373a
|
@ -32,6 +32,9 @@ wxString LayerName( int aLayer )
|
||||||
switch( aLayer )
|
switch( aLayer )
|
||||||
{
|
{
|
||||||
// PCB_LAYER_ID
|
// PCB_LAYER_ID
|
||||||
|
case UNDEFINED_LAYER: return _( "undefined" );
|
||||||
|
|
||||||
|
// Copper
|
||||||
case F_Cu: return wxT( "F.Cu" );
|
case F_Cu: return wxT( "F.Cu" );
|
||||||
case In1_Cu: return wxT( "In1.Cu" );
|
case In1_Cu: return wxT( "In1.Cu" );
|
||||||
case In2_Cu: return wxT( "In2.Cu" );
|
case In2_Cu: return wxT( "In2.Cu" );
|
||||||
|
|
|
@ -247,13 +247,16 @@ VECTOR2I ZONE::GetPosition() const
|
||||||
|
|
||||||
PCB_LAYER_ID ZONE::GetLayer() const
|
PCB_LAYER_ID ZONE::GetLayer() const
|
||||||
{
|
{
|
||||||
return BOARD_ITEM::GetLayer();
|
if( m_layerSet.count() == 1 )
|
||||||
|
return m_layerSet.UIOrder()[0];
|
||||||
|
else
|
||||||
|
return UNDEFINED_LAYER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PCB_LAYER_ID ZONE::GetFirstLayer() const
|
PCB_LAYER_ID ZONE::GetFirstLayer() const
|
||||||
{
|
{
|
||||||
if( m_layerSet.size() )
|
if( m_layerSet.count() )
|
||||||
return m_layerSet.UIOrder()[0];
|
return m_layerSet.UIOrder()[0];
|
||||||
else
|
else
|
||||||
return UNDEFINED_LAYER;
|
return UNDEFINED_LAYER;
|
||||||
|
|
Loading…
Reference in New Issue