kicad/pcbnew/class_board_item.cpp

65 lines
1.3 KiB
C++
Raw Normal View History

/**
* @file class_board_item.cpp
* @brief Class BOARD_ITEM definition and some basic functions.
*/
2007-09-25 19:39:00 +00:00
#include "fctsys.h"
#include "common.h"
#include "pcbnew.h"
#include "class_board.h"
wxString BOARD_ITEM::ShowShape( Track_Shapes aShape )
{
switch( aShape )
{
case S_SEGMENT: return _( "Line" );
case S_RECT: return _( "Rect" );
case S_ARC: return _( "Arc" );
case S_CIRCLE: return _( "Circle" );
2009-06-25 20:45:27 +00:00
case S_CURVE: return _( "Bezier Curve" );
case S_POLYGON: return _( "Polygon" );
default: return wxT( "??" );
}
}
void BOARD_ITEM::UnLink()
{
DLIST<BOARD_ITEM>* list = (DLIST<BOARD_ITEM>*) GetList();
wxASSERT( list );
if( list )
list->Remove( this );
}
2009-08-17 02:59:38 +00:00
BOARD* BOARD_ITEM::GetBoard() const
{
if( Type() == PCB_T )
return (BOARD*) this;
2009-08-17 02:59:38 +00:00
BOARD_ITEM* parent = GetParent();
if( parent )
return parent->GetBoard();
return NULL;
2009-08-17 02:59:38 +00:00
}
wxString BOARD_ITEM::GetLayerName() const
{
wxString layerName;
BOARD* board = GetBoard();
if( board != NULL )
return board->GetLayerName( m_Layer ).Trim();
wxFAIL_MSG( wxT( "No board found for board item type " ) + GetClass() );
layerName = _( "** undefined layer **" );
return layerName;
}