2014-10-22 15:51:34 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
|
|
* Copyright (C) 1992-2014 KiCad Developers, see CHANGELOG.TXT for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2009-07-06 18:02:26 +00:00
|
|
|
|
|
|
|
#ifndef _CLASS_MARKER_BASE_H
|
|
|
|
#define _CLASS_MARKER_BASE_H
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_drc_item.h>
|
2012-09-01 13:38:27 +00:00
|
|
|
#include <gr_basic.h>
|
2009-07-06 18:02:26 +00:00
|
|
|
|
2015-07-29 12:18:53 +00:00
|
|
|
|
2015-07-29 18:06:45 +00:00
|
|
|
/* Marker are mainly used to show a DRC or ERC error or warning
|
2015-07-29 12:18:53 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-07-06 18:02:26 +00:00
|
|
|
class MARKER_BASE
|
|
|
|
{
|
|
|
|
public:
|
2015-07-29 12:18:53 +00:00
|
|
|
enum TYPEMARKER { // Marker type: can be used to identify the purpose of the marker
|
|
|
|
MARKER_UNSPEC,
|
|
|
|
MARKER_ERC,
|
|
|
|
MARKER_PCB,
|
|
|
|
MARKER_SIMUL
|
|
|
|
};
|
2015-07-29 18:06:45 +00:00
|
|
|
enum MARKER_SEVERITY { // Severity of the marker: this is the level of error
|
|
|
|
MARKER_SEVERITY_UNSPEC,
|
|
|
|
MARKER_SEVERITY_INFO,
|
|
|
|
MARKER_SEVERITY_WARNING,
|
|
|
|
MARKER_SEVERITY_ERROR
|
|
|
|
};
|
2015-07-29 12:18:53 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
wxPoint m_Pos; ///< position of the marker
|
2015-07-29 12:18:53 +00:00
|
|
|
|
2009-07-06 18:02:26 +00:00
|
|
|
protected:
|
2015-07-29 12:18:53 +00:00
|
|
|
TYPEMARKER m_MarkerType; ///< The type of marker (useful to filter markers)
|
2015-07-29 18:06:45 +00:00
|
|
|
MARKER_SEVERITY m_ErrorLevel; ///< Specify the severity of the error
|
2017-02-20 16:57:41 +00:00
|
|
|
COLOR4D m_Color; ///< color
|
2011-03-29 19:33:07 +00:00
|
|
|
EDA_RECT m_ShapeBoundingBox; ///< Bounding box of the graphic symbol, relative
|
2010-12-21 15:13:09 +00:00
|
|
|
///< to the position of the shape, used for Hit
|
|
|
|
///< Tests
|
|
|
|
int m_ScalingFactor; ///< Scaling factor for m_Size and m_Corners (can
|
|
|
|
///< set the physical size
|
2009-07-09 17:02:15 +00:00
|
|
|
DRC_ITEM m_drc;
|
2009-07-06 18:02:26 +00:00
|
|
|
|
2009-07-09 17:02:15 +00:00
|
|
|
void init();
|
2009-07-06 18:02:26 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2009-07-09 17:02:15 +00:00
|
|
|
MARKER_BASE();
|
2009-07-06 18:02:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
* @param aErrorCode The categorizing identifier for an error
|
|
|
|
* @param aMarkerPos The position of the MARKER on the BOARD
|
|
|
|
* @param aText Text describing the first of two objects
|
|
|
|
* @param aPos The position of the first of two objects
|
|
|
|
* @param bText Text describing the second of the two conflicting objects
|
|
|
|
* @param bPos The position of the second of two objects
|
|
|
|
*/
|
|
|
|
MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
|
2009-07-09 17:02:15 +00:00
|
|
|
const wxString& aText, const wxPoint& aPos,
|
|
|
|
const wxString& bText, const wxPoint& bPos );
|
|
|
|
|
|
|
|
/**
|
2009-07-06 18:02:26 +00:00
|
|
|
* Constructor
|
|
|
|
* @param aErrorCode The categorizing identifier for an error
|
|
|
|
* @param aMarkerPos The position of the MARKER on the BOARD
|
|
|
|
* @param aText Text describing the object
|
|
|
|
* @param aPos The position of the object
|
|
|
|
*/
|
|
|
|
MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
|
2009-07-09 17:02:15 +00:00
|
|
|
const wxString& aText, const wxPoint& aPos );
|
2009-07-06 18:02:26 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
/**
|
|
|
|
* Contructor
|
|
|
|
* makes a copy of \a aMarker but does not copy the DRC_ITEM.
|
|
|
|
*
|
|
|
|
* @param aMarker The marker to copy.
|
|
|
|
*/
|
|
|
|
MARKER_BASE( const MARKER_BASE& aMarker );
|
2009-07-06 18:02:26 +00:00
|
|
|
|
|
|
|
~MARKER_BASE();
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function DrawMarker
|
2010-12-21 15:13:09 +00:00
|
|
|
* draws the shape is the polygon defined in m_Corners (array of wxPoints).
|
2009-07-06 18:02:26 +00:00
|
|
|
*/
|
2012-09-01 13:38:27 +00:00
|
|
|
void DrawMarker( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
|
|
|
|
const wxPoint& aOffset );
|
2009-07-06 18:02:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetPos
|
|
|
|
* returns the position of this MARKER, const.
|
|
|
|
*/
|
|
|
|
const wxPoint& GetPos() const
|
|
|
|
{
|
|
|
|
return m_Pos;
|
|
|
|
}
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetColor
|
2009-07-07 17:50:02 +00:00
|
|
|
* Set the color of this marker
|
|
|
|
*/
|
2017-02-20 16:57:41 +00:00
|
|
|
void SetColor( COLOR4D aColor )
|
2009-07-07 17:50:02 +00:00
|
|
|
{
|
|
|
|
m_Color = aColor;
|
|
|
|
}
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2015-07-29 12:18:53 +00:00
|
|
|
* accessors to set/get error levels (warning, error, fatal error..)
|
2009-07-06 18:02:26 +00:00
|
|
|
*/
|
2015-07-29 18:06:45 +00:00
|
|
|
void SetErrorLevel( MARKER_SEVERITY aErrorLevel )
|
2009-07-06 18:02:26 +00:00
|
|
|
{
|
2015-07-29 12:18:53 +00:00
|
|
|
m_ErrorLevel = aErrorLevel;
|
2009-07-06 18:02:26 +00:00
|
|
|
}
|
|
|
|
|
2015-07-29 18:06:45 +00:00
|
|
|
MARKER_SEVERITY GetErrorLevel() const
|
2009-07-06 18:02:26 +00:00
|
|
|
{
|
2015-07-29 12:18:53 +00:00
|
|
|
return m_ErrorLevel;
|
2009-07-06 18:02:26 +00:00
|
|
|
}
|
|
|
|
|
2015-07-29 12:18:53 +00:00
|
|
|
/** accessors to set/get marker type (DRC, ERC, or other)
|
2009-07-06 18:02:26 +00:00
|
|
|
*/
|
2015-07-29 12:18:53 +00:00
|
|
|
void SetMarkerType( enum TYPEMARKER aMarkerType )
|
2009-07-06 18:02:26 +00:00
|
|
|
{
|
2015-07-29 12:18:53 +00:00
|
|
|
m_MarkerType = aMarkerType;
|
2009-07-06 18:02:26 +00:00
|
|
|
}
|
|
|
|
|
2015-07-29 12:18:53 +00:00
|
|
|
enum TYPEMARKER GetMarkerType() const
|
2009-07-06 18:02:26 +00:00
|
|
|
{
|
2015-07-29 12:18:53 +00:00
|
|
|
return m_MarkerType;
|
2009-07-06 18:02:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetData
|
|
|
|
* fills in all the reportable data associated with a MARKER.
|
|
|
|
* @param aErrorCode The categorizing identifier for an error
|
|
|
|
* @param aMarkerPos The position of the MARKER on the BOARD
|
|
|
|
* @param aText Text describing the first of two objects
|
|
|
|
* @param aPos The position of the first of two objects
|
|
|
|
* @param bText Text describing the second of the two conflicting objects
|
|
|
|
* @param bPos The position of the second of two objects
|
|
|
|
*/
|
|
|
|
void SetData( int aErrorCode, const wxPoint& aMarkerPos,
|
2009-07-09 17:02:15 +00:00
|
|
|
const wxString& aText, const wxPoint& aPos,
|
|
|
|
const wxString& bText, const wxPoint& bPos );
|
2009-07-06 18:02:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetData
|
|
|
|
* fills in all the reportable data associated with a MARKER.
|
|
|
|
* @param aErrorCode The categorizing identifier for an error
|
|
|
|
* @param aMarkerPos The position of the MARKER on the BOARD
|
|
|
|
* @param aText Text describing the object
|
|
|
|
* @param aPos The position of the object
|
|
|
|
*/
|
|
|
|
void SetData( int aErrorCode, const wxPoint& aMarkerPos,
|
2009-07-09 17:02:15 +00:00
|
|
|
const wxString& aText, const wxPoint& aPos );
|
2009-07-06 18:02:26 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
/**
|
|
|
|
* Function SetAuxiliaryData
|
2009-07-08 15:42:45 +00:00
|
|
|
* initialize data for the second (auxiliary) item
|
2010-12-21 15:13:09 +00:00
|
|
|
* @param aAuxiliaryText = the second text (main text) concerning the second schematic or
|
|
|
|
* board item
|
2009-07-08 15:42:45 +00:00
|
|
|
* @param aAuxiliaryPos = position the second item
|
|
|
|
*/
|
|
|
|
void SetAuxiliaryData( const wxString& aAuxiliaryText, const wxPoint& aAuxiliaryPos )
|
|
|
|
{
|
|
|
|
m_drc.SetAuxiliaryData( aAuxiliaryText, aAuxiliaryPos );
|
|
|
|
}
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
void SetShowNoCoordinate()
|
|
|
|
{
|
|
|
|
m_drc.SetShowNoCoordinate();
|
|
|
|
}
|
2009-07-09 17:02:15 +00:00
|
|
|
|
2009-07-06 18:02:26 +00:00
|
|
|
/**
|
|
|
|
* Function GetReporter
|
|
|
|
* returns the DRC_ITEM held within this MARKER so that its
|
|
|
|
* interface may be used.
|
|
|
|
* @return const& DRC_ITEM
|
|
|
|
*/
|
|
|
|
const DRC_ITEM& GetReporter() const
|
|
|
|
{
|
|
|
|
return m_drc;
|
|
|
|
}
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-11-12 16:59:16 +00:00
|
|
|
* Function DisplayMarkerInfo
|
2010-12-21 15:13:09 +00:00
|
|
|
* displays the full info of this marker, in a HTML window.
|
2009-07-13 15:25:41 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void DisplayMarkerInfo( EDA_DRAW_FRAME* aFrame );
|
2009-07-13 15:25:41 +00:00
|
|
|
|
2009-07-06 18:02:26 +00:00
|
|
|
/**
|
|
|
|
* Function HitTestMarker
|
|
|
|
* tests if the given wxPoint is within the bounds of this object.
|
|
|
|
* @param ref_pos A wxPoint to test
|
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
*/
|
2010-12-13 15:59:00 +00:00
|
|
|
bool HitTestMarker( const wxPoint& ref_pos ) const;
|
2009-07-09 17:02:15 +00:00
|
|
|
|
2009-07-08 15:42:45 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingBoxMarker
|
|
|
|
* returns the orthogonal, bounding box of this object for display purposes.
|
|
|
|
* This box should be an enclosing perimeter for visible components of this
|
|
|
|
* object, and the units should be in the pcb or schematic coordinate system.
|
|
|
|
* It is OK to overestimate the size by a few counts.
|
|
|
|
*/
|
2011-03-29 19:33:07 +00:00
|
|
|
EDA_RECT GetBoundingBoxMarker() const;
|
2009-07-06 18:02:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _CLASS_MARKER_BASE_H
|