KiCad PCB EDA Suite
class_pad.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
30 #ifndef PAD_H_
31 #define PAD_H_
32 
33 #include "zones.h"
34 #include <board_connected_item.h>
35 #include <class_board_item.h>
36 #include <convert_to_biu.h>
39 #include <pad_shapes.h>
40 #include <pcbnew.h>
41 
42 class DRAWSEGMENT;
43 class PARAM_CFG;
44 class SHAPE;
45 class SHAPE_SEGMENT;
46 
48 {
51 };
52 
53 class LINE_READER;
54 class EDA_3D_CANVAS;
55 class MODULE;
56 class EDGE_MODULE;
57 class TRACK;
58 
59 namespace KIGFX
60 {
61  class VIEW;
62 }
63 
65 {
66 public:
67  D_PAD( MODULE* parent );
68 
69  // Copy constructor & operator= are needed because the list of basic shapes
70  // must be duplicated in copy.
71  D_PAD( const D_PAD& aPad );
72  D_PAD& operator=( const D_PAD &aOther );
73 
74  /*
75  * Default layers used for pads, according to the pad type.
76  * this is default values only, they can be changed for a given pad
77  */
78  static LSET StandardMask();
79  static LSET SMDMask();
80  static LSET ConnSMDMask();
81  static LSET UnplatedHoleMask();
83  static LSET ApertureMask();
84 
85  static inline bool ClassOf( const EDA_ITEM* aItem )
86  {
87  return aItem && PCB_PAD_T == aItem->Type();
88  }
89 
90  bool IsType( const KICAD_T aScanTypes[] ) const override
91  {
92  if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
93  return true;
94 
95  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
96  {
97  if( m_Drill.x > 0 && m_Drill.y > 0 )
98  {
99  if( *p == PCB_LOCATE_HOLE_T )
100  return true;
102  return true;
104  return true;
105  }
106  }
107 
108  return false;
109  }
110 
111  MODULE* GetParent() const { return (MODULE*) m_Parent; }
112 
119  void ImportSettingsFrom( const D_PAD& aMasterPad );
120 
125  bool IsFlipped() const;
126 
131  void SetName( const wxString& aName ) { m_name = aName; }
132  const wxString& GetName() const { return m_name; }
133 
137  void SetPinFunction( const wxString& aName ) { m_pinFunction = aName; }
138  const wxString& GetPinFunction() const { return m_pinFunction; }
139 
140  bool PadNameEqual( const D_PAD* other ) const
141  {
142  return m_name == other->m_name; // hide tricks behind sensible API
143  }
144 
148  void SetShape( PAD_SHAPE_T aShape )
149  {
150  m_padShape = aShape;
151  m_shapesDirty = true;
152  }
153 
157  PAD_SHAPE_T GetShape() const { return m_padShape; }
158 
159  void SetPosition( const wxPoint& aPos ) override
160  {
161  m_Pos = aPos;
162  m_shapesDirty = true;
163  }
164 
165  wxPoint GetPosition() const override { return m_Pos; }
166 
172 
178  {
180  }
181 
188  {
189  m_customShapeClearanceArea = aOption;
190  }
191 
199  {
201  m_shapesDirty = true;
202  }
203 
209  bool IsOnCopperLayer() const override
210  {
211  return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
212  }
213 
214  void SetY( int y ) { m_Pos.y = y; m_shapesDirty = true; }
215  void SetX( int x ) { m_Pos.x = x; m_shapesDirty = true; }
216 
217  void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; }
218  const wxPoint& GetPos0() const { return m_Pos0; }
219 
220  void SetY0( int y ) { m_Pos0.y = y; }
221  void SetX0( int x ) { m_Pos0.x = x; }
222 
223  void SetSize( const wxSize& aSize ) { m_Size = aSize; m_shapesDirty = true; }
224  const wxSize& GetSize() const { return m_Size; }
225 
226  void SetDelta( const wxSize& aSize ) { m_DeltaSize = aSize; m_shapesDirty = true; }
227  const wxSize& GetDelta() const { return m_DeltaSize; }
228 
229  void SetDrillSize( const wxSize& aSize ) { m_Drill = aSize; m_shapesDirty = true; }
230  const wxSize& GetDrillSize() const { return m_Drill; }
231 
232  void SetOffset( const wxPoint& aOffset ) { m_Offset = aOffset; m_shapesDirty = true; }
233  const wxPoint& GetOffset() const { return m_Offset; }
234 
246  void AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness );
247  void AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness );
248  void AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness );
249  void AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness );
250  void AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThickness );
251  void AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aArcAngle,
252  int aThickness );
253  void AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aCtrl1,
254  const wxPoint& aCtrl2, int aThickness );
255 
256 
257  bool GetBestAnchorPosition( VECTOR2I& aPos );
258 
263  void MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon ) const;
264 
268  void DeletePrimitivesList();
269 
273  const std::vector<std::shared_ptr<DRAWSEGMENT>>& GetPrimitives() const
274  {
275  return m_editPrimitives;
276  }
277 
278  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
279 
284  void FlipPrimitives( bool aFlipLeftRight );
285 
291  void ReplacePrimitives( const std::vector<std::shared_ptr<DRAWSEGMENT>>& aPrimitivesList );
292 
298  void AppendPrimitives( const std::vector<std::shared_ptr<DRAWSEGMENT>>& aPrimitivesList );
299 
306  void AddPrimitive( DRAWSEGMENT* aPrimitive );
307 
314  void SetOrientation( double aAngle );
315 
319  void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation*10.0 ); }
320 
325  double GetOrientation() const { return m_Orient; }
326  double GetOrientationDegrees() const { return m_Orient/10.0; }
327  double GetOrientationRadians() const { return m_Orient*M_PI/1800; }
328 
329  void SetDrillShape( PAD_DRILL_SHAPE_T aShape ) { m_drillShape = aShape; m_shapesDirty = true; }
331 
332  bool IsDirty() const { return m_shapesDirty; }
333 
334  void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
335  LSET GetLayerSet() const override { return m_layerMask; }
336 
337  void SetAttribute( PAD_ATTR_T aAttribute );
338  PAD_ATTR_T GetAttribute() const { return m_Attribute; }
339 
340  void SetProperty( PAD_PROP_T aProperty );
341  PAD_PROP_T GetProperty() const { return m_Property; }
342 
343  // We don't currently have an attribute for APERTURE, and adding one will change the file
344  // format, so for now just infer a copper-less pad to be an APERTURE pad.
345  bool IsAperturePad() const { return ( m_layerMask & LSET::AllCuMask() ).none(); }
346 
347  void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; }
348  int GetPadToDieLength() const { return m_LengthPadToDie; }
349 
351  void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
352 
353  int GetLocalClearance( wxString* aSource = nullptr ) const override;
354  void SetLocalClearance( int aClearance ) { m_LocalClearance = aClearance; }
355 
357  void SetLocalSolderPasteMargin( int aMargin ) { m_LocalSolderPasteMargin = aMargin; }
358 
361 
370  void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue,
371  int aMaxError = ARC_HIGH_DEF,
372  bool ignoreLineWidth = false ) const override;
373 
382  bool TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aInflateValue,
383  int aError = ARC_HIGH_DEF ) const;
384 
385  // @copydoc BOARD_ITEM::GetEffectiveShape
386  virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
387 
388  const std::vector<std::shared_ptr<SHAPE>>& GetEffectiveShapes() const;
389 
390  const std::shared_ptr<SHAPE_POLY_SET>& GetEffectivePolygon() const;
391 
396  const SHAPE_SEGMENT* GetEffectiveHoleShape() const;
397 
403  int GetBoundingRadius() const;
404 
411  int GetLocalClearanceOverrides( wxString* aSource = nullptr ) const override;
412 
413  // Mask margins handling:
414 
426  int GetSolderMaskMargin() const;
427 
442  wxSize GetSolderPasteMargin() const;
443 
446 
452 
458  void SetThermalWidth( int aWidth ) { m_ThermalWidth = aWidth; }
459  int GetThermalWidth() const;
460 
461  void SetThermalGap( int aGap ) { m_ThermalGap = aGap; }
462  int GetThermalGap() const;
463 
469  void SetRoundRectCornerRadius( double aRadius );
470  int GetRoundRectCornerRadius() const;
471 
472  wxPoint ShapePos() const;
473 
479  void SetRoundRectRadiusRatio( double aRadiusScale );
481 
487  void SetChamferRectRatio( double aChamferScale );
488  double GetChamferRectRatio() const { return m_chamferScale; }
489 
495  void SetChamferPositions( int aPositions ) { m_chamferPositions = aPositions; }
496  int GetChamferPositions() const { return m_chamferPositions; }
497 
502  int GetSubRatsnest() const { return m_SubRatsnest; }
503  void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; }
504 
505  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
506 
507  bool IsOnLayer( PCB_LAYER_ID aLayer ) const override
508  {
509  return m_layerMask[aLayer];
510  }
511 
512  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
513  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
514 
515  bool Collide( const SHAPE_SEGMENT* aSeg, int aMinClearance, int* aActual = nullptr );
516  bool Collide( const D_PAD* aPad, int aMinClearance, int* aActual = nullptr );
517 
518  wxString GetClass() const override
519  {
520  return wxT( "PAD" );
521  }
522 
527  const EDA_RECT GetBoundingBox() const override;
528 
530  void SetDrawCoord();
531 
532  //todo: Remove SetLocalCoord along with m_pos
534  void SetLocalCoord();
535 
541  static int Compare( const D_PAD* padref, const D_PAD* padcmp );
542 
543  void Move( const wxPoint& aMoveVector ) override
544  {
545  m_Pos += aMoveVector;
546  SetLocalCoord();
547  m_shapesDirty = true;
548  }
549 
550  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
551 
552  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
553 
554  BITMAP_DEF GetMenuImage() const override;
555 
560  wxString ShowPadShape() const;
561 
566  wxString ShowPadAttr() const;
567 
568  EDA_ITEM* Clone() const override;
569 
574  D_PAD* ClonePad() const
575  {
576  return (D_PAD*) Clone();
577  }
578 
584  bool PadShouldBeNPTH() const;
585 
590  void BuildEffectiveShapes() const;
591 
592  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
593 
594  virtual unsigned int ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
595 
596  virtual const BOX2I ViewBBox() const override;
597 
598  virtual void SwapData( BOARD_ITEM* aImage ) override;
599 
600 #if defined(DEBUG)
601  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
602 #endif
603 
604 
605 private:
606  void addPadPrimitivesToPolygon( SHAPE_POLY_SET* aMergedPolygon, int aError ) const;
607 
608 private:
609  wxString m_name; // Pad name (pin number in schematic)
610  wxString m_pinFunction; // Pin function in schematic
611 
612  wxPoint m_Pos; // Pad Position on board
613 
614  PAD_SHAPE_T m_padShape; // Shape: PAD_SHAPE_CIRCLE, PAD_SHAPE_RECT,
615  // PAD_SHAPE_OVAL, PAD_SHAPE_TRAPEZOID,
616  // PAD_SHAPE_ROUNDRECT, PAD_SHAPE_POLYGON
617  /*
618  * Editing definitions of primitives for custom pad shapes. In local coordinates relative
619  * to m_Pos (NOT shapePos) at orient 0.
620  */
621  std::vector<std::shared_ptr<DRAWSEGMENT>> m_editPrimitives;
622 
623  mutable bool m_shapesDirty;
626  mutable std::vector<std::shared_ptr<SHAPE>> m_effectiveShapes;
627  mutable std::shared_ptr<SHAPE_SEGMENT> m_effectiveHoleShape;
628  mutable std::shared_ptr<SHAPE_POLY_SET> m_effectivePolygon;
629 
630  /*
631  * How to build the custom shape in zone, to create the clearance area:
632  * CUST_PAD_SHAPE_IN_ZONE_OUTLINE = use pad shape
633  * CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL = use the convex hull of the pad shape
634  */
636 
637  int m_SubRatsnest; // Variable used to handle subnet (block) number in
638  // ratsnest computations
639 
640  wxSize m_Drill; // Drill diameter (x == y) or slot dimensions (x != y)
641  wxSize m_Size; // X and Y size (relative to orient 0)
642 
643  PAD_DRILL_SHAPE_T m_drillShape; // PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG
644 
645  double m_roundedCornerScale; // Scaling factor of min(width, hieght) to corner
646  // radius, default 0.25
647  double m_chamferScale; // Scaling factor of min(width, height) to chamfer
648  // size, default 0.25
649  int m_chamferPositions; // The positions of the chamfers (at orient 0)
650 
651  PAD_SHAPE_T m_anchorPadShape; // For custom shaped pads: shape of pad anchor,
652  // PAD_SHAPE_RECT, PAD_SHAPE_CIRCLE
653 
654  /*
655  * Most of the time the hole is the center of the shape (m_Offset = 0). But some designers
656  * use oblong/rect pads with a hole moved to one of the oblong/rect pad shape ends.
657  * In all cases the hole is at the pad position. This offset is from the hole to the center
658  * of the pad shape (ie: the copper area around the hole).
659  * ShapePos() returns the board shape position according to the offset and the pad rotation.
660  */
662 
663  LSET m_layerMask; // Bitwise layer: 1 = copper layer, 15 = cmp,
664  // 2..14 = internal layers, 16..31 = technical layers
665 
666  wxSize m_DeltaSize; // Delta for PAD_SHAPE_TRAPEZOID; half the delta squeezes
667  // one end and half expands the other. It is only valid
668  // to have a single axis be non-0.
669 
670  wxPoint m_Pos0; // Initial Pad position (i.e. pad position relative to the
671  // module anchor, orientation 0)
672 
673  PAD_ATTR_T m_Attribute; // PAD_ATTRIB_NORMAL, PAD_ATTRIB_SMD, PAD_ATTRIB_CONN,
674  // PAD_ATTRIB_HOLE_NOT_PLATED
675  PAD_PROP_T m_Property; // Property in fab files (BGA, FIDUCIAL, TESTPOINT, etc.)
676 
677  double m_Orient; // in 1/10 degrees
678 
679  int m_LengthPadToDie; // Length net from pad to die, inside the package
680 
681  /*
682  * Pad clearances, margins, etc. exist in a hiearchy. If a given level is specified then
683  * the remaining levels are NOT consulted.
684  *
685  * LEVEL 1: (highest priority) local overrides (pad, footprint, etc.)
686  * LEVEL 2: Rules
687  * LEVEL 3: Accumulated local settings, netclass settings, & board design settings
688  *
689  * These are the LEVEL 1 settings for a pad.
690  */
692  int m_LocalSolderMaskMargin; // Local solder mask margin
693  int m_LocalSolderPasteMargin; // Local solder paste margin absolute value
694  double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio of pad size
695  // The final margin is the sum of these 2 values
696 
697  ZONE_CONNECTION m_ZoneConnection; // No connection, thermal relief, etc.
698  int m_ThermalWidth; // Thermal spoke width.
700 };
701 
702 #endif // PAD_H_
int m_LocalClearance
Definition: class_pad.h:691
int m_ThermalGap
Definition: class_pad.h:699
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
EDA_UNITS
Definition: common.h:198
int m_LocalSolderMaskMargin
Definition: class_pad.h:692
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: class_pad.cpp:1021
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:41
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:621
double m_roundedCornerScale
Definition: class_pad.h:645
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:350
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_pad.cpp:1027
bool Collide(const SHAPE_SEGMENT *aSeg, int aMinClearance, int *aActual=nullptr)
Definition: class_pad.cpp:900
LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived to re...
Definition: richio.h:81
static bool ClassOf(const EDA_ITEM *aItem)
Definition: class_pad.h:85
void MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon) const
Merge all basic shapes to a SHAPE_POLY_SET Note: The corners coordinates are relative to the pad posi...
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
const wxPoint & GetPos0() const
Definition: class_pad.h:218
static LSET StandardMask()
layer set for a through hole pad
Definition: class_pad.cpp:133
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Definition: class_pad.cpp:836
PNG memory record (file in memory).
Definition: bitmap_def.h:29
wxString m_pinFunction
Definition: class_pad.h:610
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
Definition: class_pad.cpp:962
PAD_ATTR_T
Enum PAD_ATTR_T is the set of pad shapes, used with D_PAD::{Set,Get}Attribute() The double name is fo...
Definition: pad_shapes.h:78
void addPadPrimitivesToPolygon(SHAPE_POLY_SET *aMergedPolygon, int aError) const
int m_LocalSolderPasteMargin
Definition: class_pad.h:693
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition: class_pad.cpp:154
std::vector< std::shared_ptr< SHAPE > > m_effectiveShapes
Definition: class_pad.h:626
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:171
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: class_pad.cpp:140
wxPoint GetPosition() const override
Definition: class_pad.h:165
const SHAPE_SEGMENT * GetEffectiveHoleShape() const
Function GetEffectiveHoleShape Returns a list of SHAPE objects representing the pad's hole.
Definition: class_pad.cpp:239
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
int GetLocalClearance(wxString *aSource=nullptr) const override
Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system.
Definition: class_pad.cpp:592
void FlipPrimitives(bool aFlipLeftRight)
Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pad...
Definition: class_pad.cpp:553
bool GetBestAnchorPosition(VECTOR2I &aPos)
bool m_shapesDirty
Definition: class_pad.h:623
D_PAD(MODULE *parent)
Definition: class_pad.cpp:55
void AppendPrimitives(const std::vector< std::shared_ptr< DRAWSEGMENT >> &aPrimitivesList)
Import a basic shape (primitive) list and add items to the current list.
double GetOrientationDegrees() const
Definition: class_pad.h:326
void SetChamferPositions(int aPositions)
has meaning only for chamfered rect pads set the position of the chamfers for orientation 0.
Definition: class_pad.h:495
bool IsFlipped() const
Definition: class_pad.cpp:168
wxSize m_Size
Definition: class_pad.h:641
int GetPadToDieLength() const
Definition: class_pad.h:348
void BuildEffectiveShapes() const
Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit...
Definition: class_pad.cpp:257
bool PadNameEqual(const D_PAD *other) const
Definition: class_pad.h:140
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: class_pad.h:627
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:47
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:159
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
int m_SubRatsnest
Definition: class_pad.h:637
void SetSubRatsnest(int aSubRatsnest)
Definition: class_pad.h:503
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:229
wxString GetClass() const override
Function GetClass returns the class name.
Definition: class_pad.h:518
void SetRoundRectRadiusRatio(double aRadiusScale)
has meaning only for rounded rect pads Set the ratio between the smaller X or Y size and the rounded ...
Definition: class_pad.cpp:191
const wxString & GetPinFunction() const
Definition: class_pad.h:138
wxString ShowPadAttr() const
Function ShowPadAttr.
Definition: class_pad.cpp:990
The base class for create windows for drawing purpose.
PAD_PROP_T m_Property
Definition: class_pad.h:675
void SetY0(int y)
Definition: class_pad.h:220
int GetThermalGap() const
Definition: class_pad.cpp:722
const std::vector< std::shared_ptr< SHAPE > > & GetEffectiveShapes() const
Definition: class_pad.cpp:207
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
PAD_DRILL_SHAPE_T
Enum PAD_DRILL_SHAPE_T is the set of pad drill shapes, used with D_PAD::{Set,Get}DrillShape()
Definition: pad_shapes.h:66
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
PAD_SHAPE_T
Enum PAD_SHAPE_T is the set of pad shapes, used with D_PAD::{Set,Get}Shape()
Definition: pad_shapes.h:33
void SetLocalCoord()
Set relative coordinates.
Definition: class_pad.cpp:451
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:338
int GetChamferPositions() const
Definition: class_pad.h:496
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon() const
Definition: class_pad.cpp:216
void AddPrimitive(DRAWSEGMENT *aPrimitive)
Add items to the basic shape list.
ZONE_CONNECTION m_ZoneConnection
Definition: class_pad.h:697
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:198
int GetSolderMaskMargin() const
Function GetSolderMaskMargin.
Definition: class_pad.cpp:603
PCB_LAYER_ID
A quick note on layer IDs:
wxString m_name
Definition: class_pad.h:609
void AddPrimitiveRect(const wxPoint &aStart, const wxPoint &aEnd, int aThickness)
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers.
Definition: class_pad.cpp:1161
LSET is a set of PCB_LAYER_IDs.
int GetLocalClearanceOverrides(wxString *aSource=nullptr) const override
Function GetLocalClearanceOverrides returns any local clearance overrides set in the "classic" (ie: p...
Definition: class_pad.cpp:578
double m_chamferScale
Definition: class_pad.h:647
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12).
Definition: class_pad.h:131
SHAPE_POLY_SET.
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:217
wxString ShowPadShape() const
Function ShowPadShape.
Definition: class_pad.cpp:974
void AddPrimitiveCurve(const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &aCtrl1, const wxPoint &aCtrl2, int aThickness)
D_PAD & operator=(const D_PAD &aOther)
Definition: class_pad.cpp:116
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: class_pad.cpp:1003
bool IsOnCopperLayer() const override
Definition: class_pad.h:209
static int Compare(const D_PAD *padref, const D_PAD *padcmp)
Function Compare compares two pads and return 0 if they are equal.
Definition: class_pad.cpp:906
const wxPoint & GetOffset() const
Definition: class_pad.h:233
ZONE_CONNECTION GetZoneConnection() const
Definition: class_pad.h:445
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:330
double GetChamferRectRatio() const
Definition: class_pad.h:488
int GetThermalWidth() const
Definition: class_pad.cpp:711
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:335
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: class_pad.h:635
int m_effectiveBoundingRadius
Definition: class_pad.h:624
void SetThermalWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition: class_pad.h:458
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
Definition: class_pad.h:543
const wxString & GetName() const
Definition: class_pad.h:132
void SetSize(const wxSize &aSize)
Definition: class_pad.h:223
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.cpp:248
void SetOrientationDegrees(double aOrientation)
Set orientation in degrees.
Definition: class_pad.h:319
int m_ThermalWidth
Definition: class_pad.h:698
void SetRoundRectCornerRadius(double aRadius)
Function SetRoundRectCornerRadius has meaning only for rounded rect pads.
Definition: class_pad.cpp:182
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.
Definition: class_pad.cpp:1040
virtual bool IsType(const KICAD_T aScanTypes[]) const
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:262
PAD_PROP_T
Enum PAD_PROP_T is the set of pad properties used in Gerber files (Draw files, and P&P files) to defi...
Definition: pad_shapes.h:95
SHAPE.
Definition: shape.h:74
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: class_pad.h:444
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
Function GetEffectiveShape Some pad shapes can be complex (rounded/chamfered rectangle),...
Definition: class_pad.cpp:225
PAD_PROP_T GetProperty() const
Definition: class_pad.h:341
PAD_SHAPE_T m_anchorPadShape
Definition: class_pad.h:651
void SetPadToDieLength(int aLength)
Definition: class_pad.h:347
virtual unsigned int ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Function ViewGetLOD() Returns the level of detail (LOD) of the item.
Definition: class_pad.cpp:1114
const wxSize & GetDelta() const
Definition: class_pad.h:227
void SetDrawCoord()
Set absolute coordinates.
Definition: class_pad.cpp:435
wxSize m_DeltaSize
Definition: class_pad.h:666
PAD_DRILL_SHAPE_T m_drillShape
Definition: class_pad.h:643
bool IsDirty() const
Definition: class_pad.h:332
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:466
D_PAD * ClonePad() const
same as Clone, but returns a D_PAD item.
Definition: class_pad.h:574
CUST_PAD_SHAPE_IN_ZONE
Definition: class_pad.h:47
void SetLocalClearance(int aClearance)
Definition: class_pad.h:354
int m_chamferPositions
Definition: class_pad.h:649
double GetOrientationRadians() const
Definition: class_pad.h:327
ZONE_CONNECTION GetEffectiveZoneConnection() const
Return the zone connection in effect (either locally overridden or overridden in the parent module).
Definition: class_pad.cpp:700
void ReplacePrimitives(const std::vector< std::shared_ptr< DRAWSEGMENT >> &aPrimitivesList)
Clear the current primitive list and import a basic shape (primitive) list.
MODULE * GetParent() const
Definition: class_pad.h:111
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:360
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: class_pad.h:177
std::shared_ptr< SHAPE_POLY_SET > m_effectivePolygon
Definition: class_pad.h:628
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
Definition: class_pad.h:329
void AddPrimitiveArc(const wxPoint &aCenter, const wxPoint &aStart, int aArcAngle, int aThickness)
LSET m_layerMask
Definition: class_pad.h:663
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aMaxError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon.
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
Definition: class_pad.cpp:1261
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:334
void SetY(int y)
Definition: class_pad.h:214
wxSize GetSolderPasteMargin() const
Function GetSolderPasteMargin.
Definition: class_pad.cpp:648
wxPoint m_Pos0
Definition: class_pad.h:670
PARAM_CFG is a base class which establishes the interface functions ReadParam and SaveParam,...
Definition: config_params.h:81
void AddPrimitivePoly(const SHAPE_POLY_SET &aPoly, int aThickness)
Has meaning only for custom shape pads.
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:351
int m_LengthPadToDie
Definition: class_pad.h:679
bool IsType(const KICAD_T aScanTypes[]) const override
Function IsType Checks whether the item is one of the listed types.
Definition: class_pad.h:90
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:325
void ImportSettingsFrom(const D_PAD &aMasterPad)
Imports the pad settings from aMasterPad.
Definition: class_pad.cpp:1177
const wxSize & GetDrillSize() const
Definition: class_pad.h:230
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
Definition: class_pad.cpp:494
wxPoint ShapePos() const
Definition: class_pad.cpp:563
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool IsAperturePad() const
Definition: class_pad.h:345
int GetSubRatsnest() const
Function GetSubRatsnest.
Definition: class_pad.h:502
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
Definition: class_pad.cpp:733
void SetShape(PAD_SHAPE_T aShape)
Set the new shape of this pad.
Definition: class_pad.h:148
void AddPrimitiveCircle(const wxPoint &aCenter, int aRadius, int aThickness)
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition: class_pad.h:137
int GetRoundRectCornerRadius() const
Definition: class_pad.cpp:176
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:485
double GetRoundRectRadiusRatio() const
Definition: class_pad.h:480
PAD_ATTR_T m_Attribute
Definition: class_pad.h:673
void SetChamferRectRatio(double aChamferScale)
has meaning only for chamfered rect pads Set the ratio between the smaller X or Y size and chamfered ...
Definition: class_pad.cpp:199
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:357
EDA_RECT m_effectiveBoundingBox
Definition: class_pad.h:625
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition: class_pad.cpp:147
void SetCustomShapeInZoneOpt(CUST_PAD_SHAPE_IN_ZONE aOption)
Set the option for the custom pad shape to use as clearance area in copper zones.
Definition: class_pad.h:187
wxSize m_Drill
Definition: class_pad.h:640
void SetX0(int x)
Definition: class_pad.h:221
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:157
double m_Orient
Definition: class_pad.h:677
static LSET ApertureMask()
layer set for an aperture pad
Definition: class_pad.cpp:161
double m_LocalSolderPasteMarginRatio
Definition: class_pad.h:694
wxPoint m_Offset
Definition: class_pad.h:661
VIEW.
Definition: view.h:61
const std::vector< std::shared_ptr< DRAWSEGMENT > > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:273
const wxSize & GetSize() const
Definition: class_pad.h:224
void SetProperty(PAD_PROP_T aProperty)
Definition: class_pad.cpp:477
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Function IsOnLayer tests to see if this object is on the given layer.
Definition: class_pad.h:507
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:356
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:232
bool PadShouldBeNPTH() const
A pad whose hole is the same size as the pad is a NPTH.
Definition: class_pad.cpp:1033
void SetX(int x)
Definition: class_pad.h:215
void SetThermalGap(int aGap)
Definition: class_pad.h:461
void DeletePrimitivesList()
clear the basic shapes list
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox The bounding box is cached, so this will be efficient most of the time.
Definition: class_pad.cpp:426
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:359
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:226
void AddPrimitiveSegment(const wxPoint &aStart, const wxPoint &aEnd, int aThickness)
PAD_SHAPE_T m_padShape
Definition: class_pad.h:614
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
bool TransformHoleWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, int aError=ARC_HIGH_DEF) const
Function TransformHoleWithClearanceToPolygon Build the Corner list of the polygonal drill shape in th...
wxPoint m_Pos
Definition: class_pad.h:612