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 PCB_SHAPE;
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 FP_SHAPE;
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 PTHMask();
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;
101  else if( *p == PCB_LOCATE_PTH_T && m_attribute != PAD_ATTRIB_NPTH )
102  return true;
103  else if( *p == PCB_LOCATE_NPTH_T && m_attribute == PAD_ATTRIB_NPTH )
104  return true;
105  }
106  }
107 
108  return false;
109  }
110 
111  MODULE* GetParent() const;
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 
146  bool SameLogicalPadAs( const D_PAD* other ) const
147  {
148  // hide tricks behind sensible API
149  return GetParent() == other->GetParent() && m_name == other->m_name;
150  }
151 
155  void SetShape( PAD_SHAPE_T aShape )
156  {
157  m_padShape = aShape;
158  m_shapesDirty = true;
159  }
160 
164  PAD_SHAPE_T GetShape() const { return m_padShape; }
165 
166  void SetPosition( const wxPoint& aPos ) override
167  {
168  m_pos = aPos;
169  m_shapesDirty = true;
170  }
171 
172  wxPoint GetPosition() const override { return m_pos; }
173 
179 
185  {
187  }
188 
195  {
196  m_customShapeClearanceArea = aOption;
197  }
198 
206  {
208  m_shapesDirty = true;
209  }
210 
216  bool IsOnCopperLayer() const override
217  {
218  return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
219  }
220 
221  void SetY( int y ) { m_pos.y = y; m_shapesDirty = true; }
222  void SetX( int x ) { m_pos.x = x; m_shapesDirty = true; }
223 
224  void SetPos0( const wxPoint& aPos ) { m_pos0 = aPos; }
225  const wxPoint& GetPos0() const { return m_pos0; }
226 
227  void SetY0( int y ) { m_pos0.y = y; }
228  void SetX0( int x ) { m_pos0.x = x; }
229 
230  void SetSize( const wxSize& aSize ) { m_size = aSize; m_shapesDirty = true; }
231  const wxSize& GetSize() const { return m_size; }
232  void SetSizeX( const int aX ) { m_size.x = aX; m_shapesDirty = true; }
233  const int GetSizeX() const { return m_size.x; }
234  void SetSizeY( const int aY ) { m_size.y = aY; m_shapesDirty = true; }
235  const int GetSizeY() const { return m_size.y; }
236 
237  void SetDelta( const wxSize& aSize ) { m_deltaSize = aSize; m_shapesDirty = true; }
238  const wxSize& GetDelta() const { return m_deltaSize; }
239 
240  void SetDrillSize( const wxSize& aSize ) { m_drill = aSize; m_shapesDirty = true; }
241  const wxSize& GetDrillSize() const { return m_drill; }
242  void SetDrillSizeX( const int aX ) { m_drill.x = aX; m_shapesDirty = true; }
243  const int GetDrillSizeX() const { return m_drill.x; }
244  void SetDrillSizeY( const int aY ) { m_drill.y = aY; m_shapesDirty = true; }
245  const int GetDrillSizeY() const { return m_drill.y; }
246 
247  void SetOffset( const wxPoint& aOffset ) { m_offset = aOffset; m_shapesDirty = true; }
248  const wxPoint& GetOffset() const { return m_offset; }
249 
250  wxPoint GetCenter() const override { return GetPosition(); }
251 
263  void AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness );
264  void AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness );
265  void AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness );
266  void AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness );
267  void AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThickness );
268  void AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aArcAngle,
269  int aThickness );
270  void AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aCtrl1,
271  const wxPoint& aCtrl2, int aThickness );
272 
273 
274  bool GetBestAnchorPosition( VECTOR2I& aPos );
275 
280  void MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID aLayer ) const;
281 
285  void DeletePrimitivesList();
286 
290  const std::vector<std::shared_ptr<PCB_SHAPE>>& GetPrimitives() const
291  {
292  return m_editPrimitives;
293  }
294 
295  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
296 
301  void FlipPrimitives( bool aFlipLeftRight );
302 
307  void ReplacePrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
308 
313  void AppendPrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
314 
318  void AddPrimitive( PCB_SHAPE* aPrimitive );
319 
326  void SetOrientation( double aAngle );
327 
331  void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation*10.0 ); }
332 
338  double GetOrientation() const { return m_orient; }
339  double GetOrientationDegrees() const { return m_orient/10.0; }
340  double GetOrientationRadians() const { return m_orient*M_PI/1800; }
341 
342  void SetDrillShape( PAD_DRILL_SHAPE_T aShape ) { m_drillShape = aShape; m_shapesDirty = true; }
344 
345  bool IsDirty() const { return m_shapesDirty; }
346  void SetDirty() { m_shapesDirty = true; }
347 
348  void SetLayerSet( LSET aLayers ) override { m_layerMask = aLayers; }
349  LSET GetLayerSet() const override { return m_layerMask; }
350 
351  void SetAttribute( PAD_ATTR_T aAttribute );
352  PAD_ATTR_T GetAttribute() const { return m_attribute; }
353 
354  void SetProperty( PAD_PROP_T aProperty );
355  PAD_PROP_T GetProperty() const { return m_property; }
356 
357  // We don't currently have an attribute for APERTURE, and adding one will change the file
358  // format, so for now just infer a copper-less pad to be an APERTURE pad.
359  bool IsAperturePad() const { return ( m_layerMask & LSET::AllCuMask() ).none(); }
360 
361  void SetPadToDieLength( int aLength ) { m_lengthPadToDie = aLength; }
362  int GetPadToDieLength() const { return m_lengthPadToDie; }
363 
365  void SetLocalSolderMaskMargin( int aMargin ) { m_localSolderMaskMargin = aMargin; }
366 
367  int GetLocalClearance( wxString* aSource ) const override;
368  int GetLocalClearance() const { return m_localClearance; }
369  void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; }
370 
372  void SetLocalSolderPasteMargin( int aMargin ) { m_localSolderPasteMargin = aMargin; }
373 
376 
387  PCB_LAYER_ID aLayer, int aClearanceValue,
388  int aMaxError, ERROR_LOC aErrorLoc,
389  bool ignoreLineWidth = false ) const override;
390 
400  bool TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aInflateValue,
401  int aError, ERROR_LOC aErrorLoc ) const;
402 
403  // @copydoc BOARD_ITEM::GetEffectiveShape
404  virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
405 
406  const std::shared_ptr<SHAPE_POLY_SET>& GetEffectivePolygon( PCB_LAYER_ID = UNDEFINED_LAYER ) const;
407 
412  const SHAPE_SEGMENT* GetEffectiveHoleShape() const;
413 
419  int GetBoundingRadius() const;
420 
427  int GetLocalClearanceOverrides( wxString* aSource ) const override;
428 
429  // Mask margins handling:
430 
442  int GetSolderMaskMargin() const;
443 
458  wxSize GetSolderPasteMargin() const;
459 
462 
468  ZONE_CONNECTION GetEffectiveZoneConnection( wxString* aSource = nullptr ) const;
469 
475  void SetThermalSpokeWidth( int aWidth ) { m_thermalWidth = aWidth; }
476  int GetThermalSpokeWidth() const { return m_thermalWidth; }
477 
481  int GetEffectiveThermalSpokeWidth( wxString* aSource = nullptr ) const;
482 
483  void SetThermalGap( int aGap ) { m_thermalGap = aGap; }
484  int GetThermalGap() const { return m_thermalGap; }
485 
489  int GetEffectiveThermalGap( wxString* aSource = nullptr ) const;
490 
496  void SetRoundRectCornerRadius( double aRadius );
497  int GetRoundRectCornerRadius() const;
498 
499  wxPoint ShapePos() const;
500 
506  void SetRoundRectRadiusRatio( double aRadiusScale );
508 
514  void SetChamferRectRatio( double aChamferScale );
515  double GetChamferRectRatio() const { return m_chamferScale; }
516 
522  void SetChamferPositions( int aPositions ) { m_chamferPositions = aPositions; }
523  int GetChamferPositions() const { return m_chamferPositions; }
524 
529  int GetSubRatsnest() const { return m_subRatsnest; }
530  void SetSubRatsnest( int aSubRatsnest ) { m_subRatsnest = aSubRatsnest; }
531 
537  void SetRemoveUnconnected( bool aSet ) { m_removeUnconnectedLayer = aSet; }
539 
543  void SetKeepTopBottom( bool aSet ) { m_keepTopBottomLayer = aSet; }
544  bool GetKeepTopBottom() const { return m_keepTopBottomLayer; }
545 
546  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
547 
548  bool IsOnLayer( PCB_LAYER_ID aLayer ) const override
549  {
550  return m_layerMask[aLayer];
551  }
552 
553  bool FlashLayer( int aLayer ) const;
554  bool FlashLayer( LSET aLayers ) const;
555 
556  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
557  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
558 
559  wxString GetClass() const override
560  {
561  return wxT( "PAD" );
562  }
563 
568  const EDA_RECT GetBoundingBox() const override;
569 
571  void SetDrawCoord();
572 
573  //todo: Remove SetLocalCoord along with m_pos
575  void SetLocalCoord();
576 
582  static int Compare( const D_PAD* padref, const D_PAD* padcmp );
583 
584  void Move( const wxPoint& aMoveVector ) override
585  {
586  m_pos += aMoveVector;
587  SetLocalCoord();
588  m_shapesDirty = true;
589  }
590 
591  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
592 
593  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
594 
595  BITMAP_DEF GetMenuImage() const override;
596 
601  wxString ShowPadShape() const;
602 
607  wxString ShowPadAttr() const;
608 
609  EDA_ITEM* Clone() const override;
610 
615  D_PAD* ClonePad() const
616  {
617  return (D_PAD*) Clone();
618  }
619 
625  bool PadShouldBeNPTH() const;
626 
631  void BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const;
632 
633  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
634 
635  double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
636 
637  virtual const BOX2I ViewBBox() const override;
638 
639  virtual void SwapData( BOARD_ITEM* aImage ) override;
640 
641 #if defined(DEBUG)
642  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
643 #endif
644 
645 
646 private:
647  void addPadPrimitivesToPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID aLayer,
648  int aError, ERROR_LOC aErrorLoc ) const;
649 
650 private:
651  wxString m_name; // Pad name (pin number in schematic)
652  wxString m_pinFunction; // Pin function in schematic
653 
654  wxPoint m_pos; // Pad Position on board
655 
656  PAD_SHAPE_T m_padShape; // Shape: PAD_SHAPE_CIRCLE, PAD_SHAPE_RECT,
657  // PAD_SHAPE_OVAL, PAD_SHAPE_TRAPEZOID,
658  // PAD_SHAPE_ROUNDRECT, PAD_SHAPE_POLYGON
659  /*
660  * Editing definitions of primitives for custom pad shapes. In local coordinates relative
661  * to m_Pos (NOT shapePos) at orient 0.
662  */
663  std::vector<std::shared_ptr<PCB_SHAPE>> m_editPrimitives;
664 
665  // Must be set to true to force rebuild shapes to draw (after geometry change for instance)
666  mutable bool m_shapesDirty;
669  mutable std::shared_ptr<SHAPE_COMPOUND> m_effectiveShape;
670  mutable std::shared_ptr<SHAPE_SEGMENT> m_effectiveHoleShape;
671  mutable std::shared_ptr<SHAPE_POLY_SET> m_effectivePolygon;
672 
673  /*
674  * How to build the custom shape in zone, to create the clearance area:
675  * CUST_PAD_SHAPE_IN_ZONE_OUTLINE = use pad shape
676  * CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL = use the convex hull of the pad shape
677  */
679 
680  int m_subRatsnest; // Variable used to handle subnet (block) number in
681  // ratsnest computations
682 
683  wxSize m_drill; // Drill diameter (x == y) or slot dimensions (x != y)
684  wxSize m_size; // X and Y size (relative to orient 0)
685 
686  PAD_DRILL_SHAPE_T m_drillShape; // PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG
687 
688  double m_roundedCornerScale; // Scaling factor of min(width, hieght) to corner
689  // radius, default 0.25
690  double m_chamferScale; // Scaling factor of min(width, height) to chamfer
691  // size, default 0.25
692  int m_chamferPositions; // The positions of the chamfers (at orient 0)
693 
694  PAD_SHAPE_T m_anchorPadShape; // For custom shaped pads: shape of pad anchor,
695  // PAD_SHAPE_RECT, PAD_SHAPE_CIRCLE
696 
697  /*
698  * Most of the time the hole is the center of the shape (m_Offset = 0). But some designers
699  * use oblong/rect pads with a hole moved to one of the oblong/rect pad shape ends.
700  * In all cases the hole is at the pad position. This offset is from the hole to the center
701  * of the pad shape (ie: the copper area around the hole).
702  * ShapePos() returns the board shape position according to the offset and the pad rotation.
703  */
705 
706  LSET m_layerMask; // Bitwise layer: 1 = copper layer, 15 = cmp,
707  // 2..14 = internal layers, 16..31 = technical layers
708 
709  wxSize m_deltaSize; // Delta for PAD_SHAPE_TRAPEZOID; half the delta squeezes
710  // one end and half expands the other. It is only valid
711  // to have a single axis be non-0.
712 
713  wxPoint m_pos0; // Initial Pad position (i.e. pad position relative to the
714  // module anchor, orientation 0)
715 
716  PAD_ATTR_T m_attribute; // PAD_ATTRIB_NORMAL, PAD_ATTRIB_SMD, PAD_ATTRIB_CONN,
717  // PAD_ATTRIB_NPTH
718  PAD_PROP_T m_property; // Property in fab files (BGA, FIDUCIAL, TESTPOINT, etc.)
719 
720  double m_orient; // in 1/10 degrees
721 
722  int m_lengthPadToDie; // Length net from pad to die, inside the package
723 
724  bool m_removeUnconnectedLayer; // If true, the pad copper is removed for layers that are not connected
725  bool m_keepTopBottomLayer; // When removing unconnected pads, keep the top and bottom pads
726 
727  /*
728  * Pad clearances, margins, etc. exist in a hiearchy. If a given level is specified then
729  * the remaining levels are NOT consulted.
730  *
731  * LEVEL 1: (highest priority) local overrides (pad, footprint, etc.)
732  * LEVEL 2: Rules
733  * LEVEL 3: Accumulated local settings, netclass settings, & board design settings
734  *
735  * These are the LEVEL 1 settings for a pad.
736  */
738  int m_localSolderMaskMargin; // Local solder mask margin
739  int m_localSolderPasteMargin; // Local solder paste margin absolute value
740  double m_localSolderPasteMarginRatio; // Local solder mask margin ratio of pad size
741  // The final margin is the sum of these 2 values
742 
743  ZONE_CONNECTION m_zoneConnection; // No connection, thermal relief, etc.
744  int m_thermalWidth; // Thermal spoke width.
746 };
747 
748 #endif // PAD_H_
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:749
EDA_UNITS
Definition: common.h:200
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: class_pad.cpp:1075
void MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon, PCB_LAYER_ID aLayer) const
Merge all basic shapes to a SHAPE_POLY_SET Note: The results are relative to the pad position,...
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:41
double m_roundedCornerScale
Definition: class_pad.h:688
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:364
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_pad.cpp:1081
LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived to re...
Definition: richio.h:82
static bool ClassOf(const EDA_ITEM *aItem)
Definition: class_pad.h:85
const wxPoint & GetPos0() const
Definition: class_pad.h:225
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:909
bool TransformHoleWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, int aError, ERROR_LOC aErrorLoc) const
Function TransformHoleWithClearanceToPolygon Build the Corner list of the polygonal drill shape in th...
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aMaxError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon.
PNG memory record (file in memory).
Definition: bitmap_def.h:29
wxString m_pinFunction
Definition: class_pad.h:652
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
Definition: class_pad.cpp:1016
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
bool FlashLayer(int aLayer) const
Definition: class_pad.cpp:194
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition: class_pad.cpp:160
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
wxPoint GetCenter() const override
Function GetCenter()
Definition: class_pad.h:250
const int GetSizeY() const
Definition: class_pad.h:235
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:178
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: class_pad.cpp:146
wxPoint GetPosition() const override
Definition: class_pad.h:172
const SHAPE_SEGMENT * GetEffectiveHoleShape() const
Function GetEffectiveHoleShape Returns a SHAPE object representing the pad's hole.
Definition: class_pad.cpp:271
PAD_PROP_T m_property
Definition: class_pad.h:718
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
wxPoint m_pos0
Definition: class_pad.h:713
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:600
bool GetBestAnchorPosition(VECTOR2I &aPos)
void SetRemoveUnconnected(bool aSet)
Sets the unconnected removal property.
Definition: class_pad.h:537
bool m_shapesDirty
Definition: class_pad.h:666
D_PAD(MODULE *parent)
Definition: class_pad.cpp:54
double GetOrientationDegrees() const
Definition: class_pad.h:339
void SetChamferPositions(int aPositions)
has meaning only for chamfered rect pads set the position of the chamfers for orientation 0.
Definition: class_pad.h:522
bool IsFlipped() const
Definition: class_pad.cpp:174
int GetPadToDieLength() const
Definition: class_pad.h:362
double m_orient
Definition: class_pad.h:720
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: class_pad.h:670
void SetDrillSizeY(const int aY)
Definition: class_pad.h:244
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:48
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:166
static LSET PTHMask()
layer set for a through hole pad
Definition: class_pad.cpp:139
wxSize m_size
Definition: class_pad.h:684
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
void SetSubRatsnest(int aSubRatsnest)
Definition: class_pad.h:530
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:240
int m_localSolderPasteMargin
Definition: class_pad.h:739
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(PCB_LAYER_ID=UNDEFINED_LAYER) const
Definition: class_pad.cpp:253
wxString GetClass() const override
Function GetClass returns the class name.
Definition: class_pad.h:559
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
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:237
const wxString & GetPinFunction() const
Definition: class_pad.h:138
void SetKeepTopBottom(bool aSet)
Sets whether we keep the top and bottom connections even if they are not connected.
Definition: class_pad.h:543
wxString ShowPadAttr() const
Function ShowPadAttr.
Definition: class_pad.cpp:1044
The base class for create windows for drawing purpose.
void SetY0(int y)
Definition: class_pad.h:227
int GetThermalGap() const
Definition: class_pad.h:484
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
int GetLocalClearance() const
Definition: class_pad.h:368
void AppendPrimitives(const std::vector< std::shared_ptr< PCB_SHAPE >> &aPrimitivesList)
Import a custom shape primites list (composed of basic shapes) and add items to the current list.
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
int m_localClearance
Definition: class_pad.h:737
void SetLocalCoord()
Set relative coordinates.
Definition: class_pad.cpp:498
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:352
int m_localSolderMaskMargin
Definition: class_pad.h:738
void SetSizeY(const int aY)
Definition: class_pad.h:234
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
int GetChamferPositions() const
Definition: class_pad.h:523
bool m_keepTopBottomLayer
Definition: class_pad.h:725
void SetSizeX(const int aX)
Definition: class_pad.h:232
int m_thermalGap
Definition: class_pad.h:745
void SetThermalSpokeWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition: class_pad.h:475
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:205
int GetSolderMaskMargin() const
Function GetSolderMaskMargin.
Definition: class_pad.cpp:650
PCB_LAYER_ID
A quick note on layer IDs:
wxString m_name
Definition: class_pad.h:651
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:1219
LSET is a set of PCB_LAYER_IDs.
double m_chamferScale
Definition: class_pad.h:690
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
void BuildEffectiveShapes(PCB_LAYER_ID aLayer) const
Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit...
Definition: class_pad.cpp:289
SHAPE_POLY_SET.
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:224
wxString ShowPadShape() const
Function ShowPadShape.
Definition: class_pad.cpp:1028
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:120
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:1057
bool IsOnCopperLayer() const override
Definition: class_pad.h:216
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Function ViewGetLOD() Returns the level of detail (LOD) of the item.
Definition: class_pad.cpp:1168
PAD_ATTR_T m_attribute
Definition: class_pad.h:716
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:960
bool GetRemoveUnconnected() const
Definition: class_pad.h:538
const wxPoint & GetOffset() const
Definition: class_pad.h:248
ZONE_CONNECTION GetZoneConnection() const
Definition: class_pad.h:461
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:343
double GetChamferRectRatio() const
Definition: class_pad.h:515
LSET GetLayerSet() const override
Function GetLayerSet returns a std::bitset of all layers on which the item physically resides.
Definition: class_pad.h:349
MODULE * GetParent() const
Definition: class_pad.cpp:1236
void ReplacePrimitives(const std::vector< std::shared_ptr< PCB_SHAPE >> &aPrimitivesList)
Clear the current custom shape primitives list and import a new list.
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: class_pad.h:678
int m_effectiveBoundingRadius
Definition: class_pad.h:667
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
Definition: class_pad.h:584
const wxString & GetName() const
Definition: class_pad.h:132
void SetSize(const wxSize &aSize)
Definition: class_pad.h:230
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.cpp:280
void SetOrientationDegrees(double aOrientation)
Set orientation in degrees.
Definition: class_pad.h:331
void SetRoundRectCornerRadius(double aRadius)
Function SetRoundRectCornerRadius has meaning only for rounded rect pads.
Definition: class_pad.cpp:228
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:1094
virtual bool IsType(const KICAD_T aScanTypes[]) const
Function IsType Checks whether the item is one of the listed types.
Definition: eda_item.h:250
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:122
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: class_pad.h:460
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:262
PAD_PROP_T GetProperty() const
Definition: class_pad.h:355
PAD_SHAPE_T m_anchorPadShape
Definition: class_pad.h:694
void SetPadToDieLength(int aLength)
Definition: class_pad.h:361
const int GetSizeX() const
Definition: class_pad.h:233
const wxSize & GetDelta() const
Definition: class_pad.h:238
void SetDrawCoord()
Set absolute coordinates.
Definition: class_pad.cpp:480
ZONE_CONNECTION GetEffectiveZoneConnection(wxString *aSource=nullptr) const
Return the zone connection in effect (either locally overridden or overridden in the parent module).
Definition: class_pad.cpp:747
double m_localSolderPasteMarginRatio
Definition: class_pad.h:740
PAD_DRILL_SHAPE_T m_drillShape
Definition: class_pad.h:686
bool IsDirty() const
Definition: class_pad.h:345
wxPoint m_offset
Definition: class_pad.h:704
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:513
int m_subRatsnest
Definition: class_pad.h:680
int GetLocalClearanceOverrides(wxString *aSource) const override
Function GetLocalClearanceOverrides returns any local clearance overrides set in the "classic" (ie: p...
Definition: class_pad.cpp:625
D_PAD * ClonePad() const
same as Clone, but returns a D_PAD item.
Definition: class_pad.h:615
CUST_PAD_SHAPE_IN_ZONE
Definition: class_pad.h:47
void SetLocalClearance(int aClearance)
Definition: class_pad.h:369
bool SameLogicalPadAs(const D_PAD *other) const
Before we had custom pad shapes it was common to have multiple overlapping pads to represent a more c...
Definition: class_pad.h:146
int m_chamferPositions
Definition: class_pad.h:692
double GetOrientationRadians() const
Definition: class_pad.h:340
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:375
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: class_pad.h:184
std::shared_ptr< SHAPE_POLY_SET > m_effectivePolygon
Definition: class_pad.h:671
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
Definition: class_pad.h:342
void AddPrimitiveArc(const wxPoint &aCenter, const wxPoint &aStart, int aArcAngle, int aThickness)
LSET m_layerMask
Definition: class_pad.h:706
ZONE_CONNECTION m_zoneConnection
Definition: class_pad.h:743
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives() const
Accessor to the basic shape list for custom-shaped pads.
Definition: class_pad.h:290
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
Definition: class_pad.cpp:1326
bool GetKeepTopBottom() const
Definition: class_pad.h:544
void addPadPrimitivesToPolygon(SHAPE_POLY_SET *aMergedPolygon, PCB_LAYER_ID aLayer, int aError, ERROR_LOC aErrorLoc) const
void SetY(int y)
Definition: class_pad.h:221
int m_thermalWidth
Definition: class_pad.h:744
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: class_pad.h:663
const int GetDrillSizeY() const
Definition: class_pad.h:245
wxSize GetSolderPasteMargin() const
Function GetSolderPasteMargin.
Definition: class_pad.cpp:695
const int GetDrillSizeX() const
Definition: class_pad.h:243
PARAM_CFG is a base class which establishes the interface functions ReadParam and SaveParam,...
Definition: config_params.h:85
void AddPrimitivePoly(const SHAPE_POLY_SET &aPoly, int aThickness)
Has meaning only for custom shape pads.
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:365
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 a variety of units (the basic call r...
Definition: class_pad.h:338
void ImportSettingsFrom(const D_PAD &aMasterPad)
Imports the pad settings from aMasterPad.
Definition: class_pad.cpp:1242
wxSize m_drill
Definition: class_pad.h:683
const wxSize & GetDrillSize() const
Definition: class_pad.h:241
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
Definition: class_pad.cpp:541
wxPoint ShapePos() const
Definition: class_pad.cpp:610
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool IsAperturePad() const
Definition: class_pad.h:359
int GetSubRatsnest() const
Function GetSubRatsnest.
Definition: class_pad.h:529
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: eda_item.h:147
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:806
void SetShape(PAD_SHAPE_T aShape)
Set the new shape of this pad.
Definition: class_pad.h:155
void AddPrimitiveCircle(const wxPoint &aCenter, int aRadius, int aThickness)
void SetDrillSizeX(const int aX)
Definition: class_pad.h:242
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition: class_pad.h:137
std::shared_ptr< SHAPE_COMPOUND > m_effectiveShape
Definition: class_pad.h:669
int GetRoundRectCornerRadius() const
Definition: class_pad.cpp:222
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:532
void SetDirty()
Definition: class_pad.h:346
double GetRoundRectRadiusRatio() const
Definition: class_pad.h:507
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:245
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:372
EDA_RECT m_effectiveBoundingBox
Definition: class_pad.h:668
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition: class_pad.cpp:153
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:194
void SetX0(int x)
Definition: class_pad.h:228
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:164
static LSET ApertureMask()
layer set for an aperture pad
Definition: class_pad.cpp:167
int m_lengthPadToDie
Definition: class_pad.h:722
void AddPrimitive(PCB_SHAPE *aPrimitive)
Add item to the custom shape primitives list.
VIEW.
Definition: view.h:63
wxPoint m_pos
Definition: class_pad.h:654
const wxSize & GetSize() const
Definition: class_pad.h:231
void SetProperty(PAD_PROP_T aProperty)
Definition: class_pad.cpp:524
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:548
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:371
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:247
int GetThermalSpokeWidth() const
Definition: class_pad.h:476
int GetEffectiveThermalGap(wxString *aSource=nullptr) const
Return the effective thermal gap having resolved any inheritance.
Definition: class_pad.cpp:787
bool PadShouldBeNPTH() const
A pad whose hole is the same size as the pad is a NPTH.
Definition: class_pad.cpp:1087
int GetEffectiveThermalSpokeWidth(wxString *aSource=nullptr) const
Return the effective thermal spoke width having resolved any inheritance.
Definition: class_pad.cpp:768
void SetX(int x)
Definition: class_pad.h:222
void SetThermalGap(int aGap)
Definition: class_pad.h:483
void SetLayerSet(LSET aLayers) override
Definition: class_pad.h:348
bool m_removeUnconnectedLayer
Definition: class_pad.h:724
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:471
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:374
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:237
wxSize m_deltaSize
Definition: class_pad.h:709
void AddPrimitiveSegment(const wxPoint &aStart, const wxPoint &aEnd, int aThickness)
PAD_SHAPE_T m_padShape
Definition: class_pad.h:656
KICAD_T Type() const
Function Type()
Definition: eda_item.h:181