kicad/pcbnew/class_pad.h

245 lines
8.0 KiB
C
Raw Normal View History

/**********************************/
/* class_pad.h : Pads description */
/**********************************/
class Pcb3D_GLCanvas;
2008-01-05 17:30:56 +00:00
#include "pad_shapes.h"
2009-09-23 06:02:37 +00:00
/* Default layers used for pads, accordint to the pad type.
* this is default values only, they can be changed for a given pad
*/
// PAD_STANDARD:
#define PAD_STANDARD_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_CMP | SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP
// PAD_CONN:
#define PAD_CONN_DEFAULT_LAYERS CMP_LAYER | SOLDERPASTE_LAYER_CMP | SOLDERMASK_LAYER_CMP
// PAD_SMD:
#define PAD_SMD_DEFAULT_LAYERS CMP_LAYER | SOLDERMASK_LAYER_CMP
//PAD_HOLE_NOT_PLATED:
#define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS CUIVRE_LAYER | SILKSCREEN_LAYER_CMP | SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP
/* Definition type Structure d'un pad */
class D_PAD : public BOARD_CONNECTED_ITEM
{
2007-10-13 06:18:44 +00:00
private:
wxString m_Netname; // Full net name like /mysheet/mysubsheet/vout used by eeschema
wxString m_ShortNetname; // short net name, like vout from /mysheet/mysubsheet/vout
2008-01-28 18:44:14 +00:00
2007-12-01 03:42:52 +00:00
public:
2007-12-01 03:42:52 +00:00
wxPoint m_Pos; // pad Position on board
union
{
unsigned long m_NumPadName;
char m_Padname[4]; /* Pad name (4 char) or a long identifier
* (used in pad name comparisons because this is faster than string comparison)
*/
};
int m_Masque_Layer; // Bitwise layer :1= copper layer, 15= cmp,
// 2..14 = internal layers
// 16 .. 31 = technical layers
int m_PadShape; // Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID
int m_DrillShape; // Shape PAD_CIRCLE, PAD_OVAL
wxSize m_Drill; // Drill diam (drill shape = PAD_CIRCLE) or drill size(shape = OVAL)
2008-01-05 17:30:56 +00:00
// for drill shape = PAD_CIRCLE, drill diam = m_Drill.x
wxSize m_Offset; /* This parameter is usefull only for oblong pads (it can be used for other
2008-01-28 18:44:14 +00:00
* shapes, but without any interest).
* this is the offset between the pad hole and the pad shape (you must
* understand here pad shape = copper area around the hole)
* Most of cases, the hole is the centre of the shape (m_Offset = 0).
* But some board designers use oblong pads with a hole moved to one of the
* oblong pad shape ends.
* In all cases the pad position is the pad hole.
* The physical shape position (used to draw it for instance) is pad
* position (m_Pos) + m_Offset.
* D_PAD::ReturnShapePos() returns the physical shape position according to
* the offset and the pad rotation.*/
wxSize m_Size; // X and Y size ( relative to orient 0)
wxSize m_DeltaSize; // delta sur formes rectangle -> trapezes
wxPoint m_Pos0; // Initial Pad position (i.e. pas position relative to the module anchor, orientation 0
int m_Rayon; // rayon du cercle exinscrit du pad
2008-01-05 17:30:56 +00:00
int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN
int m_Orient; // in 1/10 degrees
private:
int m_SubRatsnest; // variable used in rats nest computations
// handle subnet (block) number in ratsnet connection
public:
D_PAD( MODULE* parent );
D_PAD( D_PAD* pad );
2007-09-01 12:00:30 +00:00
~D_PAD();
void Copy( D_PAD* source );
2007-09-01 12:00:30 +00:00
D_PAD* Next() { return (D_PAD*) Pnext; }
/**
* Function GetNetname
* @return const wxString * , a pointer to the full netname
*/
wxString GetNetname() const { return m_Netname; }
/**
* Function GetShortNetname
* @return const wxString * , a pointer to the short netname
*/
wxString GetShortNetname() const { return m_ShortNetname; }
/**
* Function SetNetname
* @param const wxString : the new netname
*/
void SetNetname( const wxString& aNetname );
/**
* Function GetShape
* @return the shape of this pad.
*/
int GetShape() { return m_PadShape & 0xFF; }
2007-12-01 03:42:52 +00:00
/**
* Function GetPosition
* returns the position of this object.
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{
return m_Pos;
}
2008-01-28 18:44:14 +00:00
2007-12-01 03:42:52 +00:00
void SetPosition( const wxPoint& aPos )
{
m_Pos = aPos;
}
2008-01-28 18:44:14 +00:00
/* Reading and writing data on files */
int ReadDescr( FILE* File, int* LineNum = NULL );
2008-01-28 18:44:14 +00:00
2007-10-30 21:30:58 +00:00
/**
* Function Save
2007-10-31 14:14:21 +00:00
* writes the data structures for this object out to a FILE in "*.brd" format.
2007-10-30 21:30:58 +00:00
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
2008-01-28 18:44:14 +00:00
*/
bool Save( FILE* aFile ) const;
2008-01-28 18:44:14 +00:00
2007-12-01 03:42:52 +00:00
/* drawing functions */
void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset );
2008-04-01 05:21:50 +00:00
void Draw3D( Pcb3D_GLCanvas* glcanvas );
// others
void SetPadName( const wxString& name ); // Change pad name
wxString ReturnStringPadName(); // Return pad name as string in a wxString
void ReturnStringPadName( wxString& text ); // Return pad name as string in a buffer
void ComputeRayon(); // compute m_Rayon, rayon du cercle exinscrit
const wxPoint ReturnShapePos(); // retourne la position
2008-01-28 18:44:14 +00:00
2007-10-13 06:18:44 +00:00
/**
* Function GetNet
* @return int - the netcode
*/
int GetSubRatsnest() const { return m_SubRatsnest; }
void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; }
2008-01-28 18:44:14 +00:00
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
2007-08-30 22:20:52 +00:00
* @param frame A WinEDA_DrawFrame in which to print status information.
2008-01-28 18:44:14 +00:00
*/
void DisplayInfo( WinEDA_DrawFrame* frame );
2008-01-28 18:44:14 +00:00
2007-08-30 22:20:52 +00:00
/**
* Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual so
* objects like D_PAD, which reside on multiple layers can do their own
* form of testing.
* @param aLayer The layer to test for.
* @return bool - true if on given layer, else false.
*/
bool IsOnLayer( int aLayer ) const;
2008-01-28 18:44:14 +00:00
2007-08-30 22:20:52 +00:00
2007-08-08 03:50:44 +00:00
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& refPos );
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{
return wxT( "PAD" );
}
2008-01-28 18:44:14 +00:00
2008-04-18 13:28:56 +00:00
/**
* Function GetBoundingBox
2008-10-19 18:18:45 +00:00
* returns the bounding box of this pad
* Mainly used to redraw the screen area occuped by the pad
2008-04-18 13:28:56 +00:00
*/
EDA_Rect GetBoundingBox();
2008-04-18 13:28:56 +00:00
2008-01-24 21:50:12 +00:00
/**
* Function Compare
* compares two pads and return 0 if they are equal.
* @return int - <0 if left less than right, 0 if equal, >0 if left greater than right.
*/
2008-01-28 18:44:14 +00:00
static int Compare( const D_PAD* padref, const D_PAD* padcmp );
2008-01-24 21:50:12 +00:00
2009-08-01 19:26:05 +00:00
/**
* Function Move
* move this object.
* @param const wxPoint& aMoveVector - the move vector for this object.
*/
virtual void Move(const wxPoint& aMoveVector)
{
m_Pos += aMoveVector;
}
#if defined(DEBUG)
2008-01-28 18:44:14 +00:00
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
virtual void Show( int nestLevel, std::ostream& os );
#endif
};
typedef class D_PAD* LISTE_PAD;