2007-10-26 06:08:19 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* 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"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
2009-08-01 19:26:05 +00:00
|
|
|
#include "trigo.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2007-10-26 06:08:19 +00:00
|
|
|
#include "pcbnew.h"
|
2009-08-01 19:26:05 +00:00
|
|
|
#include "class_marker_pcb.h"
|
2007-10-26 06:08:19 +00:00
|
|
|
|
2009-07-07 17:50:02 +00:00
|
|
|
#define SCALING_FACTOR 30 // Adjust the actual size of markers, when using default shape
|
2007-10-26 06:08:19 +00:00
|
|
|
|
|
|
|
/*******************/
|
2009-08-01 19:26:05 +00:00
|
|
|
/* Classe MARKER_PCB */
|
2007-10-26 06:08:19 +00:00
|
|
|
/*******************/
|
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
MARKER_PCB::MARKER_PCB( BOARD_ITEM* aParent ) :
|
|
|
|
BOARD_ITEM( aParent, TYPE_MARKER_PCB ),
|
2009-07-06 18:02:26 +00:00
|
|
|
MARKER_BASE( )
|
2007-12-01 03:42:52 +00:00
|
|
|
{
|
2009-07-07 17:50:02 +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()
|
2009-07-06 18:02:26 +00:00
|
|
|
MARKER_BASE( aErrorCode, aMarkerPos, aText, aPos, bText, bPos )
|
2007-12-01 03:42:52 +00:00
|
|
|
|
2009-07-06 18:02:26 +00:00
|
|
|
{
|
2009-07-07 17:50:02 +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-01-12 20:31:56 +00:00
|
|
|
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()
|
2009-07-06 18:02:26 +00:00
|
|
|
MARKER_BASE( aErrorCode, aMarkerPos, aText, aPos )
|
2008-01-12 20:31:56 +00:00
|
|
|
{
|
2009-07-07 17:50:02 +00:00
|
|
|
m_Color = WHITE;
|
|
|
|
m_ScalingFactor = SCALING_FACTOR;
|
2008-01-12 20:31:56 +00:00
|
|
|
}
|
|
|
|
|
2007-10-26 06:08:19 +00:00
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
/* destructor */
|
|
|
|
MARKER_PCB::~MARKER_PCB()
|
2007-10-26 06:08:19 +00:00
|
|
|
{
|
2008-01-12 20:31:56 +00:00
|
|
|
}
|
|
|
|
|
2007-10-26 06:08:19 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
void MARKER_PCB::DisplayInfo( EDA_DRAW_FRAME* frame )
|
2007-10-26 06:08:19 +00:00
|
|
|
{
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->ClearMsgPanel();
|
2007-10-26 06:08:19 +00:00
|
|
|
|
2007-12-01 05:37:44 +00:00
|
|
|
const DRC_ITEM& rpt = m_drc;
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->AppendMsgPanel( _( "Type" ), _("Marker"), DARKCYAN );
|
2007-10-26 06:08:19 +00:00
|
|
|
|
2007-12-01 05:37:44 +00:00
|
|
|
wxString errorTxt;
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2008-01-10 20:53:41 +00:00
|
|
|
errorTxt << _("ErrType") << wxT("(") << rpt.GetErrorCode() << wxT(")- ") << rpt.GetErrorText() << wxT(":");
|
2008-02-23 04:53:44 +00:00
|
|
|
|
2009-10-16 17:18:23 +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();
|
|
|
|
|
2009-10-16 17:18:23 +00:00
|
|
|
frame->AppendMsgPanel( txtA, txtB, DARKBROWN );
|
2007-10-26 06:08:19 +00:00
|
|
|
}
|
2009-07-13 15:25:41 +00:00
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|