KiCad PCB EDA Suite
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 
25 #ifndef PAD_H
26 #define PAD_H
27 
28 #include <mutex>
29 #include <zones.h>
30 #include <board_connected_item.h>
31 #include <board_item.h>
32 #include <convert_to_biu.h>
35 #include <pad_shapes.h>
36 #include <pcbnew.h>
37 
38 class PCB_SHAPE;
39 class PARAM_CFG;
40 class SHAPE;
41 class SHAPE_SEGMENT;
42 
44 {
47 };
48 
49 class LINE_READER;
50 class EDA_3D_CANVAS;
51 class FOOTPRINT;
52 class FP_SHAPE;
53 class TRACK;
54 
55 namespace KIGFX
56 {
57  class VIEW;
58 }
59 
60 class PAD : public BOARD_CONNECTED_ITEM
61 {
62 public:
63  PAD( FOOTPRINT* parent );
64 
65  // Copy constructor & operator= are needed because the list of basic shapes
66  // must be duplicated in copy.
67  PAD( const PAD& aPad );
68  PAD& operator=( const PAD &aOther );
69 
70  /*
71  * Default layers used for pads, according to the pad type.
72  * this is default values only, they can be changed for a given pad
73  */
74  static LSET PTHMask();
75  static LSET SMDMask();
76  static LSET ConnSMDMask();
77  static LSET UnplatedHoleMask();
79  static LSET ApertureMask();
80 
81  static inline bool ClassOf( const EDA_ITEM* aItem )
82  {
83  return aItem && PCB_PAD_T == aItem->Type();
84  }
85 
86  bool IsType( const KICAD_T aScanTypes[] ) const override
87  {
88  if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
89  return true;
90 
91  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
92  {
93  if( m_drill.x > 0 && m_drill.y > 0 )
94  {
95  if( *p == PCB_LOCATE_HOLE_T )
96  return true;
97  else if( *p == PCB_LOCATE_PTH_T && m_attribute != PAD_ATTRIB_NPTH )
98  return true;
99  else if( *p == PCB_LOCATE_NPTH_T && m_attribute == PAD_ATTRIB_NPTH )
100  return true;
101  }
102  }
103 
104  return false;
105  }
106 
107  FOOTPRINT* GetParent() const;
108 
109  bool IsLocked() const override;
110 
117  void ImportSettingsFrom( const PAD& aMasterPad );
118 
123  bool IsFlipped() const;
124 
129  void SetName( const wxString& aName ) { m_name = aName; }
130  const wxString& GetName() const { return m_name; }
131 
135  void SetPinFunction( const wxString& aName ) { m_pinFunction = aName; }
136  const wxString& GetPinFunction() const { return m_pinFunction; }
137 
141  void SetPinType( const wxString& aType ) { m_pinType = aType; }
142  const wxString& GetPinType() const { return m_pinType; }
143 
150  bool SameLogicalPadAs( const PAD* other ) const
151  {
152  // hide tricks behind sensible API
153  return GetParent() == other->GetParent() && m_name == other->m_name;
154  }
155 
159  void SetShape( PAD_SHAPE_T aShape )
160  {
161  m_padShape = aShape;
162  SetDirty();
163  }
164 
168  PAD_SHAPE_T GetShape() const { return m_padShape; }
169 
170  void SetPosition( const wxPoint& aPos ) override
171  {
172  m_pos = aPos;
173  SetDirty();
174  }
175 
176  wxPoint GetPosition() const override { return m_pos; }
177 
183 
189  {
191  }
192 
199  {
200  m_customShapeClearanceArea = aOption;
201  }
202 
210  {
212  SetDirty();
213  }
214 
220  bool IsOnCopperLayer() const override
221  {
222  return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
223  }
224 
225  void SetY( int y ) { m_pos.y = y; SetDirty(); }
226  void SetX( int x ) { m_pos.x = x; SetDirty(); }
227 
228  void SetPos0( const wxPoint& aPos ) { m_pos0 = aPos; }
229  const wxPoint& GetPos0() const { return m_pos0; }
230 
231  void SetY0( int y ) { m_pos0.y = y; }
232  void SetX0( int x ) { m_pos0.x = x; }
233 
234  void SetSize( const wxSize& aSize ) { m_size = aSize; SetDirty(); }
235  const wxSize& GetSize() const { return m_size; }
236  void SetSizeX( const int aX ) { m_size.x = aX; SetDirty(); }
237  const int GetSizeX() const { return m_size.x; }
238  void SetSizeY( const int aY ) { m_size.y = aY; SetDirty(); }
239  const int GetSizeY() const { return m_size.y; }
240 
241  void SetDelta( const wxSize& aSize ) { m_deltaSize = aSize; SetDirty(); }
242  const wxSize& GetDelta() const { return m_deltaSize; }
243 
244  void SetDrillSize( const wxSize& aSize ) { m_drill = aSize; SetDirty(); }
245  const wxSize& GetDrillSize() const { return m_drill; }
246  void SetDrillSizeX( const int aX ) { m_drill.x = aX; SetDirty(); }
247  const int GetDrillSizeX() const { return m_drill.x; }
248  void SetDrillSizeY( const int aY ) { m_drill.y = aY; SetDirty(); }
249  const int GetDrillSizeY() const { return m_drill.y; }
250 
251  void SetOffset( const wxPoint& aOffset ) { m_offset = aOffset; SetDirty(); }
252  const wxPoint& GetOffset() const { return m_offset; }
253 
254  wxPoint GetCenter() const override { return GetPosition(); }
255 
267  void AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness, bool aFilled );
268  void AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness, bool aFilled );
269  void AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness );
270  void AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness, bool aFilled );
271  void AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThickness,
272  bool aFilled );
273  void AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aArcAngle,
274  int aThickness );
275  void AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aCtrl1,
276  const wxPoint& aCtrl2, int aThickness );
277 
278 
279  bool GetBestAnchorPosition( VECTOR2I& aPos );
280 
285  void MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID aLayer ) const;
286 
290  void DeletePrimitivesList();
291 
295  const std::vector<std::shared_ptr<PCB_SHAPE>>& GetPrimitives() const
296  {
297  return m_editPrimitives;
298  }
299 
300  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
301 
306  void FlipPrimitives( bool aFlipLeftRight );
307 
312  void ReplacePrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
313 
318  void AppendPrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
319 
323  void AddPrimitive( PCB_SHAPE* aPrimitive );
324 
331  void SetOrientation( double aAngle );
332 
336  void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation*10.0 ); }
337 
343  double GetOrientation() const { return m_orient; }
344  double GetOrientationDegrees() const { return m_orient/10.0; }
345  double GetOrientationRadians() const { return m_orient*M_PI/1800; }
346 
347  void SetDrillShape( PAD_DRILL_SHAPE_T aShape ) { m_drillShape = aShape; m_shapesDirty = true; }
349 
350  bool IsDirty() const
351  {
352  return m_shapesDirty || m_polyDirty;
353  }
354 
355  void SetDirty()
356  {
357  m_shapesDirty = true;
358  m_polyDirty = true;
359  }
360 
361  void SetLayerSet( LSET aLayers ) override { m_layerMask = aLayers; }
362  LSET GetLayerSet() const override { return m_layerMask; }
363 
364  void SetAttribute( PAD_ATTR_T aAttribute );
365  PAD_ATTR_T GetAttribute() const { return m_attribute; }
366 
367  void SetProperty( PAD_PROP_T aProperty );
368  PAD_PROP_T GetProperty() const { return m_property; }
369 
370  // We don't currently have an attribute for APERTURE, and adding one will change the file
371  // format, so for now just infer a copper-less pad to be an APERTURE pad.
372  bool IsAperturePad() const { return ( m_layerMask & LSET::AllCuMask() ).none(); }
373 
374  void SetPadToDieLength( int aLength ) { m_lengthPadToDie = aLength; }
375  int GetPadToDieLength() const { return m_lengthPadToDie; }
376 
378  void SetLocalSolderMaskMargin( int aMargin ) { m_localSolderMaskMargin = aMargin; }
379 
380  int GetLocalClearance( wxString* aSource ) const override;
381  int GetLocalClearance() const { return m_localClearance; }
382  void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; }
383 
385  void SetLocalSolderPasteMargin( int aMargin ) { m_localSolderPasteMargin = aMargin; }
386 
389 
400  PCB_LAYER_ID aLayer, int aClearanceValue,
401  int aMaxError, ERROR_LOC aErrorLoc,
402  bool ignoreLineWidth = false ) const override;
403 
413  bool TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aInflateValue,
414  int aError, ERROR_LOC aErrorLoc ) const;
415 
416  // @copydoc BOARD_ITEM::GetEffectiveShape
417  virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
418 
419  const std::shared_ptr<SHAPE_POLY_SET>& GetEffectivePolygon() const;
420 
425  const SHAPE_SEGMENT* GetEffectiveHoleShape() const;
426 
432  int GetBoundingRadius() const;
433 
440  int GetLocalClearanceOverrides( wxString* aSource ) const override;
441 
442  // Mask margins handling:
443 
455  int GetSolderMaskMargin() const;
456 
471  wxSize GetSolderPasteMargin() const;
472 
475 
481  ZONE_CONNECTION GetEffectiveZoneConnection( wxString* aSource = nullptr ) const;
482 
488  void SetThermalSpokeWidth( int aWidth ) { m_thermalWidth = aWidth; }
489  int GetThermalSpokeWidth() const { return m_thermalWidth; }
490 
494  int GetEffectiveThermalSpokeWidth( wxString* aSource = nullptr ) const;
495 
496  void SetThermalGap( int aGap ) { m_thermalGap = aGap; }
497  int GetThermalGap() const { return m_thermalGap; }
498 
502  int GetEffectiveThermalGap( wxString* aSource = nullptr ) const;
503 
509  void SetRoundRectCornerRadius( double aRadius );
510  int GetRoundRectCornerRadius() const;
511 
512  wxPoint ShapePos() const;
513 
519  void SetRoundRectRadiusRatio( double aRadiusScale );
521 
527  void SetChamferRectRatio( double aChamferScale );
528  double GetChamferRectRatio() const { return m_chamferScale; }
529 
535  void SetChamferPositions( int aPositions ) { m_chamferPositions = aPositions; }
536  int GetChamferPositions() const { return m_chamferPositions; }
537 
542  int GetSubRatsnest() const { return m_subRatsnest; }
543  void SetSubRatsnest( int aSubRatsnest ) { m_subRatsnest = aSubRatsnest; }
544 
550  void SetRemoveUnconnected( bool aSet ) { m_removeUnconnectedLayer = aSet; }
552 
556  void SetKeepTopBottom( bool aSet ) { m_keepTopBottomLayer = aSet; }
557  bool GetKeepTopBottom() const { return m_keepTopBottomLayer; }
558 
559  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
560 
561  bool IsOnLayer( PCB_LAYER_ID aLayer ) const override
562  {
563  return m_layerMask[aLayer];
564  }
565 
572  bool FlashLayer( int aLayer, bool aIncludeZones = false ) const;
573 
580  bool FlashLayer( LSET aLayers, bool aIncludeZones = false ) const;
581 
582  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
583  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
584 
585  wxString GetClass() const override
586  {
587  return wxT( "PAD" );
588  }
589 
594  const EDA_RECT GetBoundingBox() const override;
595 
597  void SetDrawCoord();
598 
599  //todo: Remove SetLocalCoord along with m_pos
601  void SetLocalCoord();
602 
608  static int Compare( const PAD* padref, const PAD* padcmp );
609 
610  void Move( const wxPoint& aMoveVector ) override
611  {
612  m_pos += aMoveVector;
613  SetLocalCoord();
614  SetDirty();
615  }
616 
617  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
618 
619  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
620 
621  BITMAP_DEF GetMenuImage() const override;
622 
627  wxString ShowPadShape() const;
628 
633  wxString ShowPadAttr() const;
634 
635  EDA_ITEM* Clone() const override;
636 
641  PAD* ClonePad() const
642  {
643  return (PAD*) Clone();
644  }
645 
650  void BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const;
651  void BuildEffectivePolygon() const;
652 
653  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
654 
655  double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
656 
657  virtual const BOX2I ViewBBox() const override;
658 
659  virtual void SwapData( BOARD_ITEM* aImage ) override;
660 
661 #if defined(DEBUG)
662  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
663 #endif
664 
665 
666 private:
667  void addPadPrimitivesToPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID aLayer,
668  int aError, ERROR_LOC aErrorLoc ) const;
669 
670 private:
671  wxString m_name; // Pad name (pin number in schematic)
672  wxString m_pinFunction; // Pin name in schematic
673  wxString m_pinType; // Pin electrical type in schematic
674 
675  wxPoint m_pos; // Pad Position on board
676 
677  PAD_SHAPE_T m_padShape; // Shape: PAD_SHAPE_CIRCLE, PAD_SHAPE_RECT,
678  // PAD_SHAPE_OVAL, PAD_SHAPE_TRAPEZOID,
679  // PAD_SHAPE_ROUNDRECT, PAD_SHAPE_POLYGON
680  /*
681  * Editing definitions of primitives for custom pad shapes. In local coordinates relative
682  * to m_Pos (NOT shapePos) at orient 0.
683  */
684  std::vector<std::shared_ptr<PCB_SHAPE>> m_editPrimitives;
685 
686  // Must be set to true to force rebuild shapes to draw (after geometry change for instance)
687  mutable bool m_shapesDirty;
688  mutable std::mutex m_shapesBuildingLock;
690  mutable std::shared_ptr<SHAPE_COMPOUND> m_effectiveShape;
691  mutable std::shared_ptr<SHAPE_SEGMENT> m_effectiveHoleShape;
692 
693  mutable bool m_polyDirty;
694  mutable std::mutex m_polyBuildingLock;
695  mutable std::shared_ptr<SHAPE_POLY_SET> m_effectivePolygon;
697 
698  /*
699  * How to build the custom shape in zone, to create the clearance area:
700  * CUST_PAD_SHAPE_IN_ZONE_OUTLINE = use pad shape
701  * CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL = use the convex hull of the pad shape
702  */
704 
705  int m_subRatsnest; // Variable used to handle subnet (block) number in
706  // ratsnest computations
707 
708  wxSize m_drill; // Drill diameter (x == y) or slot dimensions (x != y)
709  wxSize m_size; // X and Y size (relative to orient 0)
710 
711  PAD_DRILL_SHAPE_T m_drillShape; // PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG
712 
713  double m_roundedCornerScale; // Scaling factor of min(width, hieght) to corner
714  // radius, default 0.25
715  double m_chamferScale; // Scaling factor of min(width, height) to chamfer
716  // size, default 0.25
717  int m_chamferPositions; // The positions of the chamfers (at orient 0)
718 
719  PAD_SHAPE_T m_anchorPadShape; // For custom shaped pads: shape of pad anchor,
720  // PAD_SHAPE_RECT, PAD_SHAPE_CIRCLE
721 
722  /*
723  * Most of the time the hole is the center of the shape (m_Offset = 0). But some designers
724  * use oblong/rect pads with a hole moved to one of the oblong/rect pad shape ends.
725  * In all cases the hole is at the pad position. This offset is from the hole to the center
726  * of the pad shape (ie: the copper area around the hole).
727  * ShapePos() returns the board shape position according to the offset and the pad rotation.
728  */
729  wxPoint m_offset;
730 
731  LSET m_layerMask; // Bitwise layer: 1 = copper layer, 15 = cmp,
732  // 2..14 = internal layers, 16..31 = technical layers
733 
734  wxSize m_deltaSize; // Delta for PAD_SHAPE_TRAPEZOID; half the delta squeezes
735  // one end and half expands the other. It is only valid
736  // to have a single axis be non-0.
737 
738  wxPoint m_pos0; // Initial Pad position (i.e. pad position relative to the
739  // footprint anchor, orientation 0)
740 
741  PAD_ATTR_T m_attribute; // PAD_ATTRIB_NORMAL, PAD_ATTRIB_SMD, PAD_ATTRIB_CONN,
742  // PAD_ATTRIB_NPTH
743  PAD_PROP_T m_property; // Property in fab files (BGA, FIDUCIAL, TESTPOINT, etc.)
744 
745  double m_orient; // in 1/10 degrees
746 
747  int m_lengthPadToDie; // Length net from pad to die, inside the package
748 
749  bool m_removeUnconnectedLayer; // If true, the pad copper is removed for layers that are not connected
750  bool m_keepTopBottomLayer; // When removing unconnected pads, keep the top and bottom pads
751 
752  /*
753  * Pad clearances, margins, etc. exist in a hiearchy. If a given level is specified then
754  * the remaining levels are NOT consulted.
755  *
756  * LEVEL 1: (highest priority) local overrides (pad, footprint, etc.)
757  * LEVEL 2: Rules
758  * LEVEL 3: Accumulated local settings, netclass settings, & board design settings
759  *
760  * These are the LEVEL 1 settings for a pad.
761  */
763  int m_localSolderMaskMargin; // Local solder mask margin
764  int m_localSolderPasteMargin; // Local solder paste margin absolute value
765  double m_localSolderPasteMarginRatio; // Local solder mask margin ratio of pad size
766  // The final margin is the sum of these 2 values
767 
768  ZONE_CONNECTION m_zoneConnection; // No connection, thermal relief, etc.
769  int m_thermalWidth; // Thermal spoke width.
771 };
772 
773 #endif // PAD_H
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...
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
CUST_PAD_SHAPE_IN_ZONE
Definition: pad.h:43
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pad.h:254
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:41
int GetLocalSolderMaskMargin() const
Definition: pad.h:377
void FlipPrimitives(bool aFlipLeftRight)
Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pad...
Definition: pcbnew/pad.cpp:653
void SetOffset(const wxPoint &aOffset)
Definition: pad.h:251
const int GetSizeY() const
Definition: pad.h:239
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:80
int GetLocalClearance() const
Definition: pad.h:381
bool m_shapesDirty
Definition: pad.h:687
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition: pcbnew/pad.cpp:157
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: pad.h:388
int m_chamferPositions
Definition: pad.h:717
void SetKeepTopBottom(bool aSet)
Sets whether we keep the top and bottom connections even if they are not connected.
Definition: pad.h:556
const int GetDrillSizeX() const
Definition: pad.h:247
PNG memory record (file in memory).
Definition: bitmap_def.h:29
std::mutex m_shapesBuildingLock
Definition: pad.h:688
std::mutex m_polyBuildingLock
Definition: pad.h:694
int GetLocalSolderPasteMargin() const
Definition: pad.h:384
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
double GetRoundRectRadiusRatio() const
Definition: pad.h:520
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
PAD_ATTR_T
The set of pad shapes, used with PAD::{Set,Get}Attribute().
Definition: pad_shapes.h:78
void DeletePrimitivesList()
clear the basic shapes list
void SetLocalClearance(int aClearance)
Definition: pad.h:382
wxSize m_deltaSize
Definition: pad.h:734
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
int m_subRatsnest
Definition: pad.h:705
int m_effectiveBoundingRadius
Definition: pad.h:696
void SetThermalSpokeWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition: pad.h:488
void SetDrillSizeY(const int aY)
Definition: pad.h:248
wxSize m_drill
Definition: pad.h:708
int GetLocalClearanceOverrides(wxString *aSource) const override
Function GetLocalClearanceOverrides returns any local clearance overrides set in the "classic" (ie: p...
Definition: pcbnew/pad.cpp:678
static int Compare(const PAD *padref, const PAD *padcmp)
Function Compare compares two pads and return 0 if they are equal.
double m_roundedCornerScale
Definition: pad.h:713
LSET m_layerMask
Definition: pad.h:731
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
Definition: pcbnew/pad.cpp:953
void SetOrientationDegrees(double aOrientation)
Set orientation in degrees.
Definition: pad.h:336
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: pad.h:209
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12).
Definition: pad.h:129
bool IsLocked() const override
Definition: pcbnew/pad.cpp:134
void SetSubRatsnest(int aSubRatsnest)
Definition: pad.h:543
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pad.h:561
void SetSizeX(const int aX)
Definition: pad.h:236
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:48
void AddPrimitiveRect(const wxPoint &aStart, const wxPoint &aEnd, int aThickness, bool aFilled)
PAD_PROP_T m_property
Definition: pad.h:743
const SHAPE_SEGMENT * GetEffectiveHoleShape() const
Function GetEffectiveHoleShape Returns a SHAPE object representing the pad's hole.
Definition: pcbnew/pad.cpp:292
PAD * ClonePad() const
same as Clone, but returns a PAD item.
Definition: pad.h:641
class PAD, a pad in a footprint
Definition: typeinfo.h:89
PAD_SHAPE_T GetShape() const
Definition: pad.h:168
void SetPinType(const wxString &aType)
Set the pad electrical type.
Definition: pad.h:141
void ReplacePrimitives(const std::vector< std::shared_ptr< PCB_SHAPE >> &aPrimitivesList)
Clear the current custom shape primitives list and import a new list.
wxPoint m_pos
Definition: pad.h:675
PAD_ATTR_T m_attribute
Definition: pad.h:741
void AddPrimitiveSegment(const wxPoint &aStart, const wxPoint &aEnd, int aThickness)
void SetSize(const wxSize &aSize)
Definition: pad.h:234
int GetEffectiveThermalGap(wxString *aSource=nullptr) const
Return the effective thermal gap having resolved any inheritance.
Definition: pcbnew/pad.cpp:838
wxString m_pinType
Definition: pad.h:673
void SetDelta(const wxSize &aSize)
Definition: pad.h:241
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
wxPoint m_pos0
Definition: pad.h:738
The base class for create windows for drawing purpose.
bool IsAperturePad() const
Definition: pad.h:372
wxString GetClass() const override
Return the class name.
Definition: pad.h:585
std::shared_ptr< SHAPE_COMPOUND > m_effectiveShape
Definition: pad.h:690
int GetThermalGap() const
Definition: pad.h:497
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
PAD_DRILL_SHAPE_T
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
Definition: pad_shapes.h:66
wxString ShowPadShape() const
Function ShowPadShape.
bool GetKeepTopBottom() const
Definition: pad.h:557
double m_localSolderPasteMarginRatio
Definition: pad.h:765
bool IsFlipped() const
Definition: pcbnew/pad.cpp:178
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
PAD_SHAPE_T
The set of pad shapes, used with PAD::{Set,Get}Shape()
Definition: pad_shapes.h:32
int m_localSolderPasteMargin
Definition: pad.h:764
EDA_RECT m_effectiveBoundingBox
Definition: pad.h:689
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
int m_localSolderMaskMargin
Definition: pad.h:763
void SetPadToDieLength(int aLength)
Definition: pad.h:374
PAD_ATTR_T GetAttribute() const
Definition: pad.h:365
void ImportSettingsFrom(const PAD &aMasterPad)
Imports the pad settings from aMasterPad.
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: pad.h:691
int GetEffectiveThermalSpokeWidth(wxString *aSource=nullptr) const
Return the effective thermal spoke width having resolved any inheritance.
Definition: pcbnew/pad.cpp:819
bool m_keepTopBottomLayer
Definition: pad.h:750
ZONE_CONNECTION GetZoneConnection() const
Definition: pad.h:474
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
PAD_SHAPE_T m_padShape
Definition: pad.h:677
void SetLocalSolderMaskMargin(int aMargin)
Definition: pad.h:378
int m_localClearance
Definition: pad.h:762
const wxPoint & GetOffset() const
Definition: pad.h:252
std::shared_ptr< SHAPE_POLY_SET > m_effectivePolygon
Definition: pad.h:695
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: pcbnew/pad.cpp:857
void SetDrillSizeX(const int aX)
Definition: pad.h:246
const wxSize & GetDrillSize() const
Definition: pad.h:245
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
wxPoint ShapePos() const
Definition: pcbnew/pad.cpp:663
double m_chamferScale
Definition: pad.h:715
PCB_LAYER_ID
A quick note on layer IDs:
LSET is a set of PCB_LAYER_IDs.
BITMAP_DEF GetMenuImage() const override
Return a pointer to an image to be used in menus.
double GetOrientationRadians() const
Definition: pad.h:345
int m_thermalGap
Definition: pad.h:770
int GetThermalSpokeWidth() const
Definition: pad.h:489
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in a variety of units (the basic call r...
Definition: pad.h:343
void SetPos0(const wxPoint &aPos)
Definition: pad.h:228
void SetLocalCoord()
Set relative coordinates.
Definition: pcbnew/pad.cpp:551
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcbnew/pad.cpp:594
void SetThermalGap(int aGap)
Definition: pad.h:496
SHAPE_POLY_SET.
int m_thermalWidth
Definition: pad.h:769
void SetDrillSize(const wxSize &aSize)
Definition: pad.h:244
const wxSize & GetSize() const
Definition: pad.h:235
ZONE_CONNECTION GetEffectiveZoneConnection(wxString *aSource=nullptr) const
Return the zone connection in effect (either locally overridden or overridden in the parent footprint...
Definition: pcbnew/pad.cpp:798
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
const wxString & GetName() const
Definition: pad.h:130
void SetRemoveUnconnected(bool aSet)
Sets the unconnected removal property.
Definition: pad.h:550
static LSET PTHMask()
layer set for a through hole pad
Definition: pcbnew/pad.cpp:143
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox The bounding box is cached, so this will be efficient most of the time.
Definition: pcbnew/pad.cpp:524
double m_orient
Definition: pad.h:745
const wxString & GetPinType() const
Definition: pad.h:142
void SetX0(int x)
Definition: pad.h:232
PAD & operator=(const PAD &aOther)
Definition: pcbnew/pad.cpp:115
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: pcbnew/pad.cpp:283
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:231
PAD_PROP_T
Ghe set of pad properties used in Gerber files (Draw files, and P&P files) to define some properties ...
Definition: pad_shapes.h:94
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:362
SHAPE.
Definition: shape.h:123
bool FlashLayer(int aLayer, bool aIncludeZones=false) const
Checks to see whether the pad should be flashed on the specific layer.
Definition: pcbnew/pad.cpp:198
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: pad.h:473
void SetDrawCoord()
Set absolute coordinates.
Definition: pcbnew/pad.cpp:533
ZONE_CONNECTION m_zoneConnection
Definition: pad.h:768
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: pad.h:182
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition: pad.h:135
void BuildEffectivePolygon() const
Definition: pcbnew/pad.cpp:482
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: pad.h:198
bool IsOnCopperLayer() const override
Definition: pad.h:220
void SetShape(PAD_SHAPE_T aShape)
Set the new shape of this pad.
Definition: pad.h:159
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: pcbnew/pad.cpp:258
PAD_SHAPE_T m_anchorPadShape
Definition: pad.h:719
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
Definition: pad.h:347
PAD_PROP_T GetProperty() const
Definition: pad.h:368
void AddPrimitiveCurve(const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &aCtrl1, const wxPoint &aCtrl2, int aThickness)
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: pcbnew/pad.cpp:310
double GetLocalSolderPasteMarginRatio() const
Definition: pad.h:387
void SetRoundRectCornerRadius(double aRadius)
Function SetRoundRectCornerRadius has meaning only for rounded rect pads.
Definition: pcbnew/pad.cpp:249
int GetRoundRectCornerRadius() const
Definition: pcbnew/pad.cpp:243
const wxSize & GetDelta() const
Definition: pad.h:242
wxSize m_size
Definition: pad.h:709
int GetSolderMaskMargin() const
Function GetSolderMaskMargin.
Definition: pcbnew/pad.cpp:703
FOOTPRINT * GetParent() const
void SetChamferPositions(int aPositions)
has meaning only for chamfered rect pads set the position of the chamfers for orientation 0.
Definition: pad.h:535
EDA_UNITS
Definition: eda_units.h:38
PAD_DRILL_SHAPE_T m_drillShape
Definition: pad.h:711
wxPoint m_offset
Definition: pad.h:729
const wxPoint & GetPos0() const
Definition: pad.h:229
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.
void SetSizeY(const int aY)
Definition: pad.h:238
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: pcbnew/pad.cpp:301
bool IsType(const KICAD_T aScanTypes[]) const override
Check whether the item is one of the listed types.
Definition: pad.h:86
static LSET ApertureMask()
layer set for an aperture pad
Definition: pcbnew/pad.cpp:171
void SetLayerSet(LSET aLayers) override
Definition: pad.h:361
bool m_removeUnconnectedLayer
Definition: pad.h:749
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: pad.h:188
double GetChamferRectRatio() const
Definition: pad.h:528
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:684
wxSize GetSolderPasteMargin() const
Function GetSolderPasteMargin.
Definition: pcbnew/pad.cpp:748
int GetSubRatsnest() const
Function GetSubRatsnest.
Definition: pad.h:542
wxPoint GetPosition() const override
Definition: pad.h:176
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,...
void SetLocalSolderPasteMargin(int aMargin)
Definition: pad.h:385
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:348
A base class which establishes the interface functions ReadParam and SaveParam, which are implemented...
Definition: config_params.h:81
const int GetDrillSizeY() const
Definition: pad.h:249
double GetOrientationDegrees() const
Definition: pad.h:344
void AddPrimitivePoly(const SHAPE_POLY_SET &aPoly, int aThickness, bool aFilled)
Has meaning only for custom shape pads.
void SetPosition(const wxPoint &aPos) override
Definition: pad.h:170
void SetDirty()
Definition: pad.h:355
void SetY(int y)
Definition: pad.h:225
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Handle the component boundary box.
Definition: eda_rect.h:42
const int GetSizeX() const
Definition: pad.h:237
void AddPrimitive(PCB_SHAPE *aPrimitive)
Add item to the custom shape primitives list.
void AddPrimitiveArc(const wxPoint &aCenter, const wxPoint &aStart, int aArcAngle, int aThickness)
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon() const
Definition: pcbnew/pad.cpp:274
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:148
wxString m_name
Definition: pad.h:671
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
bool SameLogicalPadAs(const PAD *other) const
Before we had custom pad shapes it was common to have multiple overlapping pads to represent a more c...
Definition: pad.h:150
wxString m_pinFunction
Definition: pad.h:672
int GetChamferPositions() const
Definition: pad.h:536
int m_lengthPadToDie
Definition: pad.h:747
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.
wxString ShowPadAttr() const
Function ShowPadAttr.
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition: pcbnew/pad.cpp:164
bool IsDirty() const
Definition: pad.h:350
void SetProperty(PAD_PROP_T aProperty)
Definition: pcbnew/pad.cpp:577
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: pad.h:703
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
Definition: pad.h:60
void SetChamferRectRatio(double aChamferScale)
has meaning only for chamfered rect pads Set the ratio between the smaller X or Y size and chamfered ...
Definition: pcbnew/pad.cpp:266
void Move(const wxPoint &aMoveVector) override
Move this object.
Definition: pad.h:610
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: pcbnew/pad.cpp:150
int GetPadToDieLength() const
Definition: pad.h:375
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pad.h:81
PAD(FOOTPRINT *parent)
Definition: pcbnew/pad.cpp:49
const wxString & GetPinFunction() const
Definition: pad.h:136
bool m_polyDirty
Definition: pad.h:693
bool GetRemoveUnconnected() const
Definition: pad.h:551
bool GetBestAnchorPosition(VECTOR2I &aPos)
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives() const
Accessor to the basic shape list for custom-shaped pads.
Definition: pad.h:295
void SetY0(int y)
Definition: pad.h:231
Definition: track.h:83
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: pcbnew/pad.cpp:585
void AddPrimitiveCircle(const wxPoint &aCenter, int aRadius, int aThickness, bool aFilled)
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
void SetX(int x)
Definition: pad.h:226
void addPadPrimitivesToPolygon(SHAPE_POLY_SET *aMergedPolygon, PCB_LAYER_ID aLayer, int aError, ERROR_LOC aErrorLoc) const
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: pcbnew/pad.cpp:566