2012-01-14 19:50:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
|
|
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.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
|
|
|
|
*/
|
|
|
|
|
2011-09-17 15:31:21 +00:00
|
|
|
/**
|
|
|
|
* @file class_pad.h
|
|
|
|
* @brief Pad object description
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
#ifndef PAD_H_
|
|
|
|
#define PAD_H_
|
2011-08-01 15:29:27 +00:00
|
|
|
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board_item.h>
|
|
|
|
#include <class_board_connected_item.h>
|
|
|
|
#include <pad_shapes.h>
|
|
|
|
#include <PolyLine.h>
|
2012-02-19 04:02:19 +00:00
|
|
|
#include <param_config.h> // PARAM_CFG_ARRAY
|
2012-02-24 23:23:46 +00:00
|
|
|
#include "zones.h"
|
2011-09-17 15:31:21 +00:00
|
|
|
|
2013-01-12 17:32:24 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
class LINE_READER;
|
2011-09-17 15:31:21 +00:00
|
|
|
class EDA_3D_CANVAS;
|
2011-09-23 13:57:12 +00:00
|
|
|
class EDA_DRAW_PANEL;
|
|
|
|
class MODULE;
|
2011-11-30 11:45:49 +00:00
|
|
|
class TRACK;
|
2013-01-12 17:32:24 +00:00
|
|
|
class MSG_PANEL_INFO;
|
2011-09-17 15:31:21 +00:00
|
|
|
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Default layers used for pads, according to the pad type.
|
2009-09-23 06:02:37 +00:00
|
|
|
* this is default values only, they can be changed for a given pad
|
|
|
|
*/
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2009-09-23 06:02:37 +00:00
|
|
|
// PAD_STANDARD:
|
2011-08-01 15:29:27 +00:00
|
|
|
#define PAD_STANDARD_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_FRONT | \
|
|
|
|
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT
|
2009-09-23 06:02:37 +00:00
|
|
|
|
|
|
|
// PAD_CONN:
|
2009-12-21 18:51:37 +00:00
|
|
|
#define PAD_CONN_DEFAULT_LAYERS LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT
|
2009-09-23 06:02:37 +00:00
|
|
|
|
|
|
|
// PAD_SMD:
|
2009-12-21 18:51:37 +00:00
|
|
|
#define PAD_SMD_DEFAULT_LAYERS LAYER_FRONT | SOLDERMASK_LAYER_FRONT
|
2009-09-23 06:02:37 +00:00
|
|
|
|
|
|
|
//PAD_HOLE_NOT_PLATED:
|
2011-08-19 13:08:24 +00:00
|
|
|
#define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_FRONT | \
|
2009-12-21 18:51:37 +00:00
|
|
|
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT
|
2009-09-23 06:02:37 +00:00
|
|
|
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2011-07-14 15:42:44 +00:00
|
|
|
// Helper class to store parameters used to draw a pad
|
2010-09-11 16:33:43 +00:00
|
|
|
class PAD_DRAWINFO
|
|
|
|
{
|
|
|
|
public:
|
2011-09-17 15:31:21 +00:00
|
|
|
EDA_DRAW_PANEL* m_DrawPanel; // the EDA_DRAW_PANEL used to draw a PAD ; can be null
|
2012-09-01 13:38:27 +00:00
|
|
|
GR_DRAWMODE m_DrawMode; // the draw mode
|
2012-09-02 12:06:47 +00:00
|
|
|
EDA_COLOR_T m_Color; // color used to draw the pad shape , from pad layers and
|
2011-09-17 15:31:21 +00:00
|
|
|
// visible layers
|
2012-09-02 12:06:47 +00:00
|
|
|
EDA_COLOR_T m_HoleColor; // color used to draw the pad hole
|
|
|
|
EDA_COLOR_T m_NPHoleColor; // color used to draw a pad Not Plated hole
|
2011-09-17 15:31:21 +00:00
|
|
|
int m_PadClearance; // clearance value, used to draw the pad area outlines
|
|
|
|
wxSize m_Mask_margin; // margin, used to draw solder paste when only one layer is shown
|
|
|
|
bool m_Display_padnum; // true to show pad number
|
|
|
|
bool m_Display_netname; // true to show net name
|
|
|
|
bool m_ShowPadFilled; // true to show pad as solid area, false to show pas in
|
|
|
|
// sketch mode
|
|
|
|
bool m_ShowNCMark; // true to show pad not connected mark
|
|
|
|
bool m_ShowNotPlatedHole; // true when the pad hole in not plated, to draw a specific
|
|
|
|
// pad shape
|
|
|
|
bool m_IsPrinting; // true to print, false to display on screen.
|
|
|
|
wxPoint m_Offset; // general draw offset
|
|
|
|
|
|
|
|
PAD_DRAWINFO();
|
2010-09-11 16:33:43 +00:00
|
|
|
};
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-18 18:13:55 +00:00
|
|
|
class D_PAD : public BOARD_CONNECTED_ITEM
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-12-16 17:03:25 +00:00
|
|
|
public:
|
2012-02-19 04:02:19 +00:00
|
|
|
static int m_PadSketchModePenSize; ///< Pen size used to draw pads in sketch mode
|
|
|
|
///< (mode used to print pads on silkscreen layer)
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
public:
|
2007-08-06 20:26:59 +00:00
|
|
|
D_PAD( MODULE* parent );
|
2012-01-14 19:50:32 +00:00
|
|
|
|
|
|
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
2012-05-24 15:00:59 +00:00
|
|
|
// D_PAD( const D_PAD& o );
|
2012-01-14 19:50:32 +00:00
|
|
|
|
2009-03-23 19:54:15 +00:00
|
|
|
void Copy( D_PAD* source );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
D_PAD* Next() const { return (D_PAD*) Pnext; }
|
|
|
|
|
|
|
|
MODULE* GetParent() const { return (MODULE*) m_Parent; }
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-16 17:03:25 +00:00
|
|
|
void SetPadName( const wxString& name ); // Change pad name
|
|
|
|
const wxString GetPadName() const;
|
|
|
|
|
|
|
|
bool PadNameEqual( const D_PAD* other ) const
|
|
|
|
{
|
|
|
|
return m_NumPadName == other->m_NumPadName; // hide tricks behind sensible API
|
|
|
|
}
|
|
|
|
|
2008-12-14 19:45:05 +00:00
|
|
|
/**
|
2011-12-12 08:37:05 +00:00
|
|
|
* Function SetNetname
|
|
|
|
* @param aNetname: the new netname
|
2008-12-14 19:45:05 +00:00
|
|
|
*/
|
2011-12-12 08:37:05 +00:00
|
|
|
void SetNetname( const wxString& aNetname );
|
2009-03-23 19:54:15 +00:00
|
|
|
|
2008-12-14 19:45:05 +00:00
|
|
|
/**
|
2011-12-12 08:37:05 +00:00
|
|
|
* Function GetNetname
|
|
|
|
* @return const wxString& - the full netname
|
2008-12-14 19:45:05 +00:00
|
|
|
*/
|
2011-12-12 08:37:05 +00:00
|
|
|
const wxString& GetNetname() const { return m_Netname; }
|
2008-12-14 19:45:05 +00:00
|
|
|
|
|
|
|
/**
|
2011-12-12 08:37:05 +00:00
|
|
|
* Function GetShortNetname
|
|
|
|
* @return const wxString& - the short netname
|
2008-12-14 19:45:05 +00:00
|
|
|
*/
|
2011-12-12 08:37:05 +00:00
|
|
|
const wxString& GetShortNetname() const { return m_ShortNetname; }
|
2008-12-14 19:45:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetShape
|
|
|
|
* @return the shape of this pad.
|
|
|
|
*/
|
2012-02-19 04:02:19 +00:00
|
|
|
PAD_SHAPE_T GetShape() const { return m_PadShape; }
|
|
|
|
void SetShape( PAD_SHAPE_T aShape ) { m_PadShape = aShape; m_boundingRadius = -1; }
|
2008-12-14 19:45:05 +00:00
|
|
|
|
2012-02-20 04:33:54 +00:00
|
|
|
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } // was overload
|
|
|
|
const wxPoint& GetPosition() const { return m_Pos; } // was overload
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
void SetY( int y ) { m_Pos.y = y; }
|
|
|
|
void SetX( int x ) { m_Pos.x = x; }
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2011-12-01 06:04:23 +00:00
|
|
|
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; }
|
2011-12-12 08:37:05 +00:00
|
|
|
const wxPoint& GetPos0() const { return m_Pos0; }
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
void SetY0( int y ) { m_Pos0.y = y; }
|
|
|
|
void SetX0( int x ) { m_Pos0.x = x; }
|
|
|
|
|
|
|
|
void SetSize( const wxSize& aSize ) { m_Size = aSize; m_boundingRadius = -1; }
|
2011-12-12 08:37:05 +00:00
|
|
|
const wxSize& GetSize() const { return m_Size; }
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
void SetDelta( const wxSize& aSize ) { m_DeltaSize = aSize; m_boundingRadius = -1; }
|
2011-12-12 08:37:05 +00:00
|
|
|
const wxSize& GetDelta() const { return m_DeltaSize; }
|
|
|
|
|
2011-12-01 06:04:23 +00:00
|
|
|
void SetDrillSize( const wxSize& aSize ) { m_Drill = aSize; }
|
2011-12-12 08:37:05 +00:00
|
|
|
const wxSize& GetDrillSize() const { return m_Drill; }
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
void SetOffset( const wxPoint& aOffset ) { m_Offset = aOffset; }
|
|
|
|
const wxPoint& GetOffset() const { return m_Offset; }
|
|
|
|
|
|
|
|
void Flip( int aTranslationY );
|
2011-12-02 21:56:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetOrientation
|
|
|
|
* sets the rotation angle of the pad.
|
2012-02-19 04:02:19 +00:00
|
|
|
* @param aAngle is tenths of degrees, but will soon be degrees. If it is
|
|
|
|
* outside of 0 - 3600, then it will be normalized before being saved.
|
2011-12-02 21:56:47 +00:00
|
|
|
*/
|
2012-02-19 04:02:19 +00:00
|
|
|
void SetOrientation( double aAngle );
|
2011-12-02 21:56:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetOrientation
|
2012-04-01 20:51:56 +00:00
|
|
|
* returns the rotation angle of the pad in tenths of degrees, but soon degrees.
|
2011-12-02 21:56:47 +00:00
|
|
|
*/
|
|
|
|
double GetOrientation() const { return m_Orient; }
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
void SetDrillShape( PAD_SHAPE_T aDrillShape ) { m_DrillShape = aDrillShape; }
|
|
|
|
PAD_SHAPE_T GetDrillShape() const { return m_DrillShape; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2011-12-01 06:04:23 +00:00
|
|
|
void SetLayerMask( int aLayerMask ) { m_layerMask = aLayerMask; }
|
2011-12-12 08:37:05 +00:00
|
|
|
int GetLayerMask() const { return m_layerMask; }
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
void SetAttribute( PAD_ATTR_T aAttribute ) { m_Attribute = aAttribute; }
|
|
|
|
PAD_ATTR_T GetAttribute() const { return m_Attribute; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2012-12-12 11:57:17 +00:00
|
|
|
void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; }
|
|
|
|
int GetPadToDieLength() const { return m_LengthPadToDie; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
|
2011-12-12 08:37:05 +00:00
|
|
|
void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
int GetLocalClearance() const { return m_LocalClearance; }
|
|
|
|
void SetLocalClearance( int aClearance ) { m_LocalClearance = aClearance; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
int GetLocalSolderPasteMargin() const { return m_LocalSolderPasteMargin; }
|
2011-12-12 08:37:05 +00:00
|
|
|
void SetLocalSolderPasteMargin( int aMargin ) { m_LocalSolderPasteMargin = aMargin; }
|
|
|
|
|
|
|
|
double GetLocalSolderPasteMarginRatio() const { return m_LocalSolderPasteMarginRatio; }
|
|
|
|
void SetLocalSolderPasteMarginRatio( double aRatio ) { m_LocalSolderPasteMarginRatio = aRatio; }
|
2011-12-01 06:04:23 +00:00
|
|
|
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function TransformShapeWithClearanceToPolygon
|
2009-11-14 19:47:52 +00:00
|
|
|
* Convert the pad shape to a closed polygon
|
|
|
|
* Used in filling zones calculations
|
|
|
|
* Circles and arcs are approximated by segments
|
|
|
|
* @param aCornerBuffer = a buffer to store the polygon
|
|
|
|
* @param aClearanceValue = the clearance around the pad
|
|
|
|
* @param aCircleToSegmentsCount = the number of segments to approximate a circle
|
|
|
|
* @param aCorrectionFactor = the correction to apply to circles radius to keep
|
2011-07-14 15:42:44 +00:00
|
|
|
* clearance when the circle is approximated by segment bigger or equal
|
2009-11-14 19:47:52 +00:00
|
|
|
* to the real clearance value (usually near from 1.0)
|
|
|
|
*/
|
2009-11-16 08:13:40 +00:00
|
|
|
void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
2011-08-01 15:29:27 +00:00
|
|
|
int aClearanceValue,
|
|
|
|
int aCircleToSegmentsCount,
|
|
|
|
double aCorrectionFactor );
|
2009-03-23 19:54:15 +00:00
|
|
|
|
2009-11-05 20:59:42 +00:00
|
|
|
/**
|
|
|
|
* Function GetClearance
|
2010-04-08 11:33:43 +00:00
|
|
|
* returns the clearance in internal units. If \a aItem is not NULL then the
|
|
|
|
* returned clearance is the greater of this object's clearance and
|
|
|
|
* aItem's clearance. If \a aItem is NULL, then this objects clearance
|
2009-11-05 20:59:42 +00:00
|
|
|
* is returned.
|
|
|
|
* @param aItem is another BOARD_CONNECTED_ITEM or NULL
|
2010-04-08 11:33:43 +00:00
|
|
|
* @return int - the clearance in internal units.
|
2009-11-05 20:59:42 +00:00
|
|
|
*/
|
2012-03-26 23:47:08 +00:00
|
|
|
int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;
|
2009-11-05 20:59:42 +00:00
|
|
|
|
|
|
|
// Mask margins handling:
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetSolderMaskMargin
|
2009-11-04 19:08:08 +00:00
|
|
|
* @return the margin for the solder mask layer
|
|
|
|
* usually > 0 (mask shape bigger than pad
|
|
|
|
* value is
|
|
|
|
* 1 - the local value
|
|
|
|
* 2 - if null, the parent footprint value
|
|
|
|
* 1 - if null, the global value
|
|
|
|
*/
|
2011-09-17 15:31:21 +00:00
|
|
|
int GetSolderMaskMargin();
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetSolderPasteMargin
|
2009-11-04 19:08:08 +00:00
|
|
|
* @return the margin for the solder mask layer
|
|
|
|
* usually < 0 (mask shape smaller than pad
|
2009-11-12 15:43:38 +00:00
|
|
|
* because the margin can be dependent on the pad size, the margin has a x and a y value
|
2009-11-04 19:08:08 +00:00
|
|
|
* value is
|
|
|
|
* 1 - the local value
|
|
|
|
* 2 - if null, the parent footprint value
|
|
|
|
* 1 - if null, the global value
|
|
|
|
*/
|
2011-09-17 15:31:21 +00:00
|
|
|
wxSize GetSolderPasteMargin();
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2012-02-24 23:23:46 +00:00
|
|
|
void SetZoneConnection( ZoneConnection aType ) { m_ZoneConnection = aType; }
|
|
|
|
ZoneConnection GetZoneConnection() const;
|
|
|
|
|
2012-03-08 20:44:03 +00:00
|
|
|
void SetThermalWidth( int aWidth ) { m_ThermalWidth = aWidth; }
|
|
|
|
int GetThermalWidth() const;
|
|
|
|
|
|
|
|
void SetThermalGap( int aGap ) { m_ThermalGap = aGap; }
|
|
|
|
int GetThermalGap() const;
|
|
|
|
|
2007-08-06 20:26:59 +00:00
|
|
|
/* drawing functions */
|
2011-09-17 15:31:21 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
2012-09-01 13:38:27 +00:00
|
|
|
GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset );
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2011-09-17 15:31:21 +00:00
|
|
|
void Draw3D( EDA_3D_CANVAS* glcanvas );
|
2007-08-06 20:26:59 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function DrawShape
|
2010-09-11 16:33:43 +00:00
|
|
|
* basic function to draw a pad.
|
2011-10-17 20:01:27 +00:00
|
|
|
* <p>
|
|
|
|
* This function is used by Draw after calculation of parameters (color, ) final
|
|
|
|
* orientation transforms are set. It can also be called to draw a pad on any panel
|
|
|
|
* even if this panel is not a EDA_DRAW_PANEL for instance on a wxPanel inside the
|
|
|
|
* pad editor.
|
|
|
|
* </p>
|
2010-09-11 16:33:43 +00:00
|
|
|
*/
|
2011-09-17 15:31:21 +00:00
|
|
|
void DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function BuildPadPolygon
|
2010-09-20 16:21:47 +00:00
|
|
|
* Has meaning only for polygonal pads (trapezoid and rectangular)
|
2010-09-11 16:33:43 +00:00
|
|
|
* Build the Corner list of the polygonal shape,
|
|
|
|
* depending on shape, extra size (clearance ...) and orientation
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aCoord = a buffer to fill (4 corners).
|
2011-08-01 15:29:27 +00:00
|
|
|
* @param aInflateValue = wxSize: the clearance or margin value. value > 0:
|
|
|
|
* inflate, < 0 deflate
|
2010-09-11 16:33:43 +00:00
|
|
|
* @param aRotation = full rotation of the polygon
|
|
|
|
*/
|
2011-09-17 15:31:21 +00:00
|
|
|
void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotation ) const;
|
2010-09-20 16:21:47 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function BuildSegmentFromOvalShape
|
2010-09-20 16:21:47 +00:00
|
|
|
* Has meaning only for OVAL (and ROUND) pads
|
|
|
|
* Build an equivalent segment having the same shape as the OVAL shape,
|
|
|
|
* Useful in draw function and in DRC and HitTest functions,
|
|
|
|
* because segments are already well handled by track tests
|
2011-08-01 15:29:27 +00:00
|
|
|
* @param aSegStart = the starting point of the equivalent segment relative to the shape
|
|
|
|
* position.
|
2010-09-20 16:21:47 +00:00
|
|
|
* @param aSegEnd = the ending point of the equivalent segment, relative to the shape position
|
|
|
|
* @param aRotation = full rotation of the segment
|
|
|
|
* @return the width of the segment
|
|
|
|
*/
|
2011-08-01 15:29:27 +00:00
|
|
|
int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation ) const;
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2011-07-14 15:42:44 +00:00
|
|
|
void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingRadius
|
|
|
|
* returns the radius of a minimum sized circle which fully encloses this pad.
|
|
|
|
*/
|
|
|
|
int GetBoundingRadius()
|
|
|
|
{
|
|
|
|
// Any member function which would affect this calculation should set
|
|
|
|
// m_boundingRadius to -1 to re-trigger the calculation from here.
|
|
|
|
// Currently that is only m_Size, m_DeltaSize, and m_PadShape accessors.
|
|
|
|
if( m_boundingRadius == -1 )
|
|
|
|
{
|
|
|
|
m_boundingRadius = boundingRadius();
|
|
|
|
}
|
2012-03-15 14:31:16 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
return m_boundingRadius;
|
|
|
|
}
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2012-03-15 14:31:16 +00:00
|
|
|
const wxPoint ReturnShapePos() const;
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2007-10-13 06:18:44 +00:00
|
|
|
/**
|
2012-02-19 04:02:19 +00:00
|
|
|
* Function GetSubRatsnest
|
2007-10-13 06:18:44 +00:00
|
|
|
* @return int - the netcode
|
|
|
|
*/
|
2008-11-18 18:13:55 +00:00
|
|
|
int GetSubRatsnest() const { return m_SubRatsnest; }
|
|
|
|
void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; }
|
2008-01-28 18:44:14 +00:00
|
|
|
|
|
|
|
|
2013-01-12 17:32:24 +00:00
|
|
|
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2009-03-23 19:54:15 +00:00
|
|
|
bool IsOnLayer( int aLayer ) const;
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
bool HitTest( const wxPoint& aPosition );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
wxString GetClass() const
|
2007-08-07 06:21:19 +00:00
|
|
|
{
|
|
|
|
return wxT( "PAD" );
|
|
|
|
}
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2011-09-17 15:31:21 +00:00
|
|
|
EDA_RECT GetBoundingBox() const;
|
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
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
void Move( const wxPoint& aMoveVector )
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
2011-11-24 17:32:51 +00:00
|
|
|
m_Pos += aMoveVector;
|
2009-08-01 19:26:05 +00:00
|
|
|
}
|
2007-08-07 06:21:19 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
wxString GetSelectMenuText() const;
|
2011-07-14 15:42:44 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
BITMAP_DEF GetMenuImage() const { return pad_xpm; }
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2011-07-14 19:41:20 +00:00
|
|
|
/**
|
|
|
|
* Function ShowPadShape
|
|
|
|
* @return the name of the shape
|
|
|
|
*/
|
|
|
|
wxString ShowPadShape() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ShowPadAttr
|
|
|
|
* @return the name of the pad type (attribute) : STD, SMD ...
|
|
|
|
*/
|
|
|
|
wxString ShowPadAttr() const;
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
/**
|
|
|
|
* Function AppendConfigs
|
|
|
|
* appends to @a aResult the configuration setting accessors which will later
|
|
|
|
* allow reading or writing of configuration file information directly into
|
|
|
|
* this object.
|
|
|
|
*/
|
|
|
|
void AppendConfigs( PARAM_CFG_ARRAY* aResult );
|
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
EDA_ITEM* Clone() const;
|
2012-03-17 14:39:27 +00:00
|
|
|
|
2009-03-23 19:54:15 +00:00
|
|
|
#if defined(DEBUG)
|
2011-12-14 17:25:42 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os ) const; // overload
|
2007-08-07 06:21:19 +00:00
|
|
|
#endif
|
2012-01-14 19:50:32 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2012-01-14 19:50:32 +00:00
|
|
|
private:
|
2012-02-19 04:02:19 +00:00
|
|
|
/**
|
|
|
|
* Function boundingRadius
|
|
|
|
* returns a calculated radius of a bounding circle for this pad.
|
|
|
|
*/
|
|
|
|
int boundingRadius() const;
|
|
|
|
|
|
|
|
int m_boundingRadius; ///< radius of the circle containing the pad shape
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
/// Pad name (4 char) or a long identifier (used in pad name
|
|
|
|
/// comparisons because this is faster than string comparison)
|
|
|
|
union
|
|
|
|
{
|
|
|
|
#define PADNAMEZ 4
|
|
|
|
char m_Padname[PADNAMEZ]; // zero padded at end to full size
|
|
|
|
wxUint32 m_NumPadName; // same number of bytes as m_Padname[]
|
|
|
|
};
|
|
|
|
|
|
|
|
wxPoint m_Pos; ///< pad Position on board
|
|
|
|
|
|
|
|
PAD_SHAPE_T m_PadShape; ///< Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID
|
|
|
|
|
|
|
|
|
|
|
|
int m_SubRatsnest; ///< variable used in rats nest computations
|
|
|
|
///< handle subnet (block) number in ratsnest connection
|
|
|
|
|
|
|
|
wxSize m_Drill; ///< Drill diam (drill shape = PAD_CIRCLE) or drill size
|
|
|
|
///< (shape = OVAL) for drill shape = PAD_CIRCLE, drill
|
|
|
|
///< diam = m_Drill.x
|
|
|
|
|
|
|
|
wxSize m_Size; ///< X and Y size ( relative to orient 0)
|
|
|
|
|
|
|
|
PAD_SHAPE_T m_DrillShape; ///< Shape PAD_CIRCLE, PAD_OVAL
|
|
|
|
|
|
|
|
/**
|
|
|
|
* m_Offset is useful only for oblong pads (it can be used for other
|
|
|
|
* shapes, but without any interest).
|
2012-03-17 02:11:44 +00:00
|
|
|
* This is the offset between the pad hole and the pad shape (you must
|
2012-02-19 04:02:19 +00:00
|
|
|
* understand here pad shape = copper area around the hole)
|
|
|
|
* Most of cases, the hole is the center 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.
|
|
|
|
*/
|
|
|
|
wxPoint m_Offset;
|
|
|
|
|
|
|
|
int m_layerMask; ///< Bitwise layer :1= copper layer, 15= cmp,
|
|
|
|
///< 2..14 = internal layers
|
|
|
|
///< 16 .. 31 = technical layers
|
|
|
|
|
|
|
|
wxSize m_DeltaSize; ///< delta on rectangular shapes
|
|
|
|
|
|
|
|
wxPoint m_Pos0; ///< Initial Pad position (i.e. pad position relative to the
|
|
|
|
///< module anchor, orientation 0)
|
|
|
|
|
|
|
|
PAD_ATTR_T m_Attribute; ///< NORMAL, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
|
|
|
|
double m_Orient; ///< in 1/10 degrees
|
|
|
|
|
2012-12-12 11:57:17 +00:00
|
|
|
int m_LengthPadToDie; ///< Length net from pad to die, inside the package
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
/// Local clearance. When null, the module default value is used.
|
|
|
|
/// when the module default value is null, the netclass value is used
|
|
|
|
/// Usually the local clearance is null
|
|
|
|
int m_LocalClearance;
|
|
|
|
|
|
|
|
// Local mask margins: when 0, the parent footprint design values are used
|
|
|
|
|
|
|
|
int m_LocalSolderMaskMargin; ///< Local solder mask margin
|
|
|
|
int m_LocalSolderPasteMargin; ///< Local solder paste margin absolute value
|
|
|
|
|
|
|
|
double m_LocalSolderPasteMarginRatio; ///< Local solder mask margin ratio value of pad size
|
|
|
|
///< The final margin is the sum of these 2 values
|
2012-02-24 23:23:46 +00:00
|
|
|
ZoneConnection m_ZoneConnection;
|
2012-05-24 15:00:59 +00:00
|
|
|
int m_ThermalWidth;
|
|
|
|
int m_ThermalGap;
|
2012-02-19 04:02:19 +00:00
|
|
|
};
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
#endif // PAD_H_
|