kicad/pcbnew/class_marker_pcb.cpp

105 lines
2.8 KiB
C++
Raw Normal View History

/*****************************************************************************/
/* Functions to handle markers used to show somthing (usually a drc problem) */
/*****************************************************************************/
/* file class_marker.cpp */
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
2009-08-01 19:26:05 +00:00
#include "trigo.h"
#include "pcbnew.h"
2009-08-01 19:26:05 +00:00
#include "class_marker_pcb.h"
#define SCALING_FACTOR 30 // Adjust the actual size of markers, when using default shape
/*******************/
2009-08-01 19:26:05 +00:00
/* Classe MARKER_PCB */
/*******************/
2009-08-01 19:26:05 +00:00
MARKER_PCB::MARKER_PCB( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, TYPE_MARKER_PCB ),
MARKER_BASE( )
2007-12-01 03:42:52 +00:00
{
m_Color = WHITE;
m_ScalingFactor = SCALING_FACTOR;
2007-12-01 03:42:52 +00:00
}
2009-08-01 19:26:05 +00:00
MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
2008-02-23 04:53:44 +00:00
const wxString& aText, const wxPoint& aPos,
2007-12-01 03:42:52 +00:00
const wxString& bText, const wxPoint& bPos ) :
2009-08-01 19:26:05 +00:00
BOARD_ITEM( NULL, TYPE_MARKER_PCB ), // parent set during BOARD::Add()
MARKER_BASE( aErrorCode, aMarkerPos, aText, aPos, bText, bPos )
2007-12-01 03:42:52 +00:00
{
m_Color = WHITE;
m_ScalingFactor = SCALING_FACTOR;
2007-12-01 03:42:52 +00:00
}
2009-08-01 19:26:05 +00:00
MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos ) :
2009-08-01 19:26:05 +00:00
BOARD_ITEM( NULL, TYPE_MARKER_PCB ), // parent set during BOARD::Add()
MARKER_BASE( aErrorCode, aMarkerPos, aText, aPos )
{
m_Color = WHITE;
m_ScalingFactor = SCALING_FACTOR;
}
2009-08-01 19:26:05 +00:00
/* destructor */
MARKER_PCB::~MARKER_PCB()
{
}
void MARKER_PCB::DisplayInfo( EDA_DRAW_FRAME* frame )
{
frame->ClearMsgPanel();
2007-12-01 05:37:44 +00:00
const DRC_ITEM& rpt = m_drc;
2008-02-23 04:53:44 +00:00
frame->AppendMsgPanel( _( "Type" ), _("Marker"), DARKCYAN );
2007-12-01 05:37:44 +00:00
wxString errorTxt;
2008-02-23 04:53:44 +00:00
errorTxt << _("ErrType") << wxT("(") << rpt.GetErrorCode() << wxT(")- ") << rpt.GetErrorText() << wxT(":");
2008-02-23 04:53:44 +00:00
frame->AppendMsgPanel( errorTxt, wxEmptyString, RED );
2007-12-01 05:37:44 +00:00
wxString txtA;
txtA << DRC_ITEM::ShowCoord( rpt.GetPointA() ) << wxT(": ") << rpt.GetTextA();
2008-02-23 04:53:44 +00:00
2007-12-01 05:37:44 +00:00
wxString txtB;
2008-02-23 04:53:44 +00:00
if ( rpt.HasSecondItem() )
txtB << DRC_ITEM::ShowCoord( rpt.GetPointB() ) << wxT(": ") << rpt.GetTextB();
frame->AppendMsgPanel( txtA, txtB, DARKBROWN );
}
2009-08-01 19:26:05 +00:00
/**
* Function Rotate
* Rotate this object.
2010-12-29 17:47:32 +00:00
* @param aRotCentre - the rotation point.
2009-08-01 19:26:05 +00:00
* @param aAngle - the rotation angle in 0.1 degree.
*/
void MARKER_PCB::Rotate(const wxPoint& aRotCentre, int aAngle)
{
RotatePoint( &m_Pos, aRotCentre, aAngle );
}
/**
* Function Flip
* Flip this object, i.e. change the board side for this object
* this function has not reeally sense for a marker.
* It moves just the marker to keep its position on board, when the board is flipped
2010-12-29 17:47:32 +00:00
* @param aCentre - the rotation point.
2009-08-01 19:26:05 +00:00
*/
void MARKER_PCB::Flip(const wxPoint& aCentre )
{
m_Pos.y = aCentre.y - (m_Pos.y - aCentre.y);
}