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-2021 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 <convert_to_biu.h>
34 #include <pad_shapes.h>
35 
36 class PCB_SHAPE;
37 class PARAM_CFG;
38 class SHAPE;
39 class SHAPE_SEGMENT;
40 
42 {
45 };
46 
47 class LINE_READER;
48 class EDA_3D_CANVAS;
49 class FOOTPRINT;
50 class FP_SHAPE;
51 
52 namespace KIGFX
53 {
54  class VIEW;
55 }
56 
57 class PAD : public BOARD_CONNECTED_ITEM
58 {
59 public:
60  PAD( FOOTPRINT* parent );
61 
62  // Copy constructor & operator= are needed because the list of basic shapes
63  // must be duplicated in copy.
64  PAD( const PAD& aPad );
65  PAD& operator=( const PAD &aOther );
66 
67  /*
68  * Default layers used for pads, according to the pad type.
69  *
70  * This is default values only, they can be changed for a given pad.
71  */
72  static LSET PTHMask();
73  static LSET SMDMask();
74  static LSET ConnSMDMask();
75  static LSET UnplatedHoleMask();
77  static LSET ApertureMask();
78 
79  static inline bool ClassOf( const EDA_ITEM* aItem )
80  {
81  return aItem && PCB_PAD_T == aItem->Type();
82  }
83 
84  bool IsType( const KICAD_T aScanTypes[] ) const override
85  {
86  if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
87  return true;
88 
89  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
90  {
91  if( m_drill.x > 0 && m_drill.y > 0 )
92  {
93  if( *p == PCB_LOCATE_HOLE_T )
94  return true;
95  else if( *p == PCB_LOCATE_PTH_T && m_attribute != PAD_ATTRIB::NPTH )
96  return true;
97  else if( *p == PCB_LOCATE_NPTH_T && m_attribute == PAD_ATTRIB::NPTH )
98  return true;
99  }
100  }
101 
102  return false;
103  }
104 
105  FOOTPRINT* GetParent() const;
106 
107  wxString GetParentAsString() const { return m_parent->m_Uuid.AsString(); }
108 
109  bool IsLocked() const override;
110 
118  void ImportSettingsFrom( const PAD& aMasterPad );
119 
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 
148  bool SameLogicalPadAs( const PAD* other ) const
149  {
150  // hide tricks behind sensible API
151  return GetParent() == other->GetParent() && m_name == other->m_name;
152  }
153 
157  void SetShape( PAD_SHAPE aShape )
158  {
159  m_padShape = aShape;
160  SetDirty();
161  }
162 
166  PAD_SHAPE GetShape() const { return m_padShape; }
167 
168  void SetPosition( const wxPoint& aPos ) override
169  {
170  m_pos = aPos;
171  SetDirty();
172  }
173 
174  wxPoint GetPosition() const override { return m_pos; }
175 
180 
185  {
187  }
188 
195  {
196  m_customShapeClearanceArea = aOption;
197  }
198 
206  {
208  SetDirty();
209  }
210 
214  bool IsOnCopperLayer() const override
215  {
216  return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
217  }
218 
219  void SetY( int y ) { m_pos.y = y; SetDirty(); }
220  void SetX( int x ) { m_pos.x = x; SetDirty(); }
221 
222  void SetPos0( const wxPoint& aPos ) { m_pos0 = aPos; }
223  const wxPoint& GetPos0() const { return m_pos0; }
224 
225  void SetY0( int y ) { m_pos0.y = y; }
226  void SetX0( int x ) { m_pos0.x = x; }
227 
228  void SetSize( const wxSize& aSize ) { m_size = aSize; SetDirty(); }
229  const wxSize& GetSize() const { return m_size; }
230  void SetSizeX( const int aX ) { m_size.x = aX; SetDirty(); }
231  const int GetSizeX() const { return m_size.x; }
232  void SetSizeY( const int aY ) { m_size.y = aY; SetDirty(); }
233  const int GetSizeY() const { return m_size.y; }
234 
235  void SetDelta( const wxSize& aSize ) { m_deltaSize = aSize; SetDirty(); }
236  const wxSize& GetDelta() const { return m_deltaSize; }
237 
238  void SetDrillSize( const wxSize& aSize ) { m_drill = aSize; SetDirty(); }
239  const wxSize& GetDrillSize() const { return m_drill; }
240  void SetDrillSizeX( const int aX ) { m_drill.x = aX; SetDirty(); }
241  const int GetDrillSizeX() const { return m_drill.x; }
242  void SetDrillSizeY( const int aY ) { m_drill.y = aY; SetDirty(); }
243  const int GetDrillSizeY() const { return m_drill.y; }
244 
245  void SetOffset( const wxPoint& aOffset ) { m_offset = aOffset; SetDirty(); }
246  const wxPoint& GetOffset() const { return m_offset; }
247 
248  wxPoint GetCenter() const override { return GetPosition(); }
249 
261  void AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness, bool aFilled );
262  void AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness, bool aFilled );
263  void AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness );
264  void AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness, bool aFilled );
265  void AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThickness,
266  bool aFilled );
267  void AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aArcAngle,
268  int aThickness );
269  void AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aCtrl1,
270  const wxPoint& aCtrl2, int aThickness );
271 
272 
273  bool GetBestAnchorPosition( VECTOR2I& aPos );
274 
287  void MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID aLayer,
288  ERROR_LOC aErrorLoc = ERROR_INSIDE ) const;
289 
293  void DeletePrimitivesList();
294 
298  const std::vector<std::shared_ptr<PCB_SHAPE>>& GetPrimitives() const
299  {
300  return m_editPrimitives;
301  }
302 
303  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
304 
309  void FlipPrimitives( bool aFlipLeftRight );
310 
315  void ReplacePrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
316 
321  void AppendPrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
322 
326  void AddPrimitive( PCB_SHAPE* aPrimitive );
327 
335  void SetOrientation( double aAngle );
336 
340  void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation*10.0 ); }
341 
346  double GetOrientation() const { return m_orient; }
347  double GetOrientationDegrees() const { return m_orient/10.0; }
348  double GetOrientationRadians() const { return m_orient*M_PI/1800; }
349 
350  void SetDrillShape( PAD_DRILL_SHAPE_T aShape ) { m_drillShape = aShape; m_shapesDirty = true; }
352 
353  bool IsDirty() const
354  {
355  return m_shapesDirty || m_polyDirty;
356  }
357 
358  void SetDirty()
359  {
360  m_shapesDirty = true;
361  m_polyDirty = true;
362  }
363 
364  void SetLayerSet( LSET aLayers ) override { m_layerMask = aLayers; }
365  LSET GetLayerSet() const override { return m_layerMask; }
366 
367  void SetAttribute( PAD_ATTRIB aAttribute );
368  PAD_ATTRIB GetAttribute() const { return m_attribute; }
369 
370  void SetProperty( PAD_PROP aProperty );
371  PAD_PROP GetProperty() const { return m_property; }
372 
373  // We don't currently have an attribute for APERTURE, and adding one will change the file
374  // format, so for now just infer a copper-less pad to be an APERTURE pad.
375  bool IsAperturePad() const
376  {
377  return ( m_layerMask & LSET::AllCuMask() ).none();
378  }
379 
380  void SetPadToDieLength( int aLength ) { m_lengthPadToDie = aLength; }
381  int GetPadToDieLength() const { return m_lengthPadToDie; }
382 
384  void SetLocalSolderMaskMargin( int aMargin ) { m_localSolderMaskMargin = aMargin; }
385 
386  int GetLocalClearance( wxString* aSource ) const override;
387  int GetLocalClearance() const { return m_localClearance; }
388  void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; }
389 
391  void SetLocalSolderPasteMargin( int aMargin ) { m_localSolderPasteMargin = aMargin; }
392 
395 
406  PCB_LAYER_ID aLayer, int aClearanceValue,
407  int aMaxError, ERROR_LOC aErrorLoc,
408  bool ignoreLineWidth = false ) const override;
409 
419  bool TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aInflateValue,
420  int aError, ERROR_LOC aErrorLoc ) const;
421 
422  // @copydoc BOARD_ITEM::GetEffectiveShape
423  virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
424 
425  const std::shared_ptr<SHAPE_POLY_SET>& GetEffectivePolygon() const;
426 
430  const SHAPE_SEGMENT* GetEffectiveHoleShape() const;
431 
437  int GetBoundingRadius() const;
438 
445  int GetLocalClearanceOverrides( wxString* aSource ) const override;
446 
457  int GetSolderMaskMargin() const;
458 
470  wxSize GetSolderPasteMargin() const;
471 
474 
481  ZONE_CONNECTION GetEffectiveZoneConnection( wxString* aSource = nullptr ) const;
482 
487  void SetThermalSpokeWidth( int aWidth ) { m_thermalWidth = aWidth; }
488  int GetThermalSpokeWidth() const { return m_thermalWidth; }
489 
493  int GetEffectiveThermalSpokeWidth( wxString* aSource = nullptr ) const;
494 
495  void SetThermalGap( int aGap ) { m_thermalGap = aGap; }
496  int GetThermalGap() const { return m_thermalGap; }
497 
501  int GetEffectiveThermalGap( wxString* aSource = nullptr ) const;
502 
508  void SetRoundRectCornerRadius( double aRadius );
509  int GetRoundRectCornerRadius() const;
510 
511  wxPoint ShapePos() const;
512 
519  void SetRoundRectRadiusRatio( double aRadiusScale );
521 
528  void SetChamferRectRatio( double aChamferScale );
529  double GetChamferRectRatio() const { return m_chamferScale; }
530 
538  void SetChamferPositions( int aPositions ) { m_chamferPositions = aPositions; }
539  int GetChamferPositions() const { return m_chamferPositions; }
540 
544  int GetSubRatsnest() const { return m_subRatsnest; }
545  void SetSubRatsnest( int aSubRatsnest ) { m_subRatsnest = aSubRatsnest; }
546 
553  void SetRemoveUnconnected( bool aSet ) { m_removeUnconnectedLayer = aSet; }
555 
559  void SetKeepTopBottom( bool aSet ) { m_keepTopBottomLayer = aSet; }
560  bool GetKeepTopBottom() const { return m_keepTopBottomLayer; }
561 
562  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
563 
564  bool IsOnLayer( PCB_LAYER_ID aLayer ) const override
565  {
566  return m_layerMask[aLayer];
567  }
568 
575  bool FlashLayer( int aLayer ) const;
576 
584  bool FlashLayer( LSET aLayers ) const;
585 
586  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
587  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
588 
589  wxString GetClass() const override
590  {
591  return wxT( "PAD" );
592  }
593 
597  const EDA_RECT GetBoundingBox() const override;
598 
600  void SetDrawCoord();
601 
602  //todo: Remove SetLocalCoord along with m_pos
604  void SetLocalCoord();
605 
612  static int Compare( const PAD* padref, const PAD* padcmp );
613 
614  void Move( const wxPoint& aMoveVector ) override
615  {
616  m_pos += aMoveVector;
617  SetLocalCoord();
618  SetDirty();
619  }
620 
621  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
622 
623  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
624 
625  BITMAPS GetMenuImage() const override;
626 
630  wxString ShowPadShape() const;
631 
635  wxString ShowPadAttr() const;
636 
637  EDA_ITEM* Clone() const override;
638 
644  PAD* ClonePad() const
645  {
646  return (PAD*) Clone();
647  }
648 
653  void BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const;
654  void BuildEffectivePolygon() const;
655 
656  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
657 
658  double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
659 
660  virtual const BOX2I ViewBBox() const override;
661 
662  virtual void SwapData( BOARD_ITEM* aImage ) override;
663 
664 #if defined(DEBUG)
665  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
666 #endif
667 
668 
669 private:
670  void addPadPrimitivesToPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID aLayer,
671  int aError, ERROR_LOC aErrorLoc ) const;
672 
673 private:
674  wxString m_name; // Pad name (pin number in schematic)
675  wxString m_pinFunction; // Pin name in schematic
676  wxString m_pinType; // Pin electrical type in schematic
677 
678  wxPoint m_pos; // Pad Position on board
679 
680  PAD_SHAPE m_padShape; // Shape: PAD_SHAPE::CIRCLE, PAD_SHAPE::RECT,
681  // PAD_SHAPE::OVAL, PAD_SHAPE::TRAPEZOID,
682  // PAD_SHAPE::ROUNDRECT, PAD_SHAPE_POLYGON
683  /*
684  * Editing definitions of primitives for custom pad shapes. In local coordinates relative
685  * to m_Pos (NOT shapePos) at orient 0.
686  */
687  std::vector<std::shared_ptr<PCB_SHAPE>> m_editPrimitives;
688 
689  // Must be set to true to force rebuild shapes to draw (after geometry change for instance)
690  mutable bool m_shapesDirty;
691  mutable std::mutex m_shapesBuildingLock;
693  mutable std::shared_ptr<SHAPE_COMPOUND> m_effectiveShape;
694  mutable std::shared_ptr<SHAPE_SEGMENT> m_effectiveHoleShape;
695 
696  mutable bool m_polyDirty;
697  mutable std::mutex m_polyBuildingLock;
698  mutable std::shared_ptr<SHAPE_POLY_SET> m_effectivePolygon;
700 
701  /*
702  * How to build the custom shape in zone, to create the clearance area:
703  * CUST_PAD_SHAPE_IN_ZONE_OUTLINE = use pad shape
704  * CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL = use the convex hull of the pad shape
705  */
707 
708  int m_subRatsnest; // Variable used to handle subnet (block) number in
709  // ratsnest computations
710 
711  wxSize m_drill; // Drill diameter (x == y) or slot dimensions (x != y)
712  wxSize m_size; // X and Y size (relative to orient 0)
713 
714  PAD_DRILL_SHAPE_T m_drillShape; // PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG
715 
716  double m_roundedCornerScale; // Scaling factor of min(width, height) to corner
717  // radius, default 0.25
718  double m_chamferScale; // Scaling factor of min(width, height) to chamfer
719  // size, default 0.25
720  int m_chamferPositions; // The positions of the chamfers (at orient 0)
721 
722  PAD_SHAPE m_anchorPadShape; // For custom shaped pads: shape of pad anchor,
723  // PAD_SHAPE::RECT, PAD_SHAPE::CIRCLE
724 
725  /*
726  * Most of the time the hole is the center of the shape (m_Offset = 0). But some designers
727  * use oblong/rect pads with a hole moved to one of the oblong/rect pad shape ends.
728  * In all cases the hole is at the pad position. This offset is from the hole to the center
729  * of the pad shape (ie: the copper area around the hole).
730  * ShapePos() returns the board shape position according to the offset and the pad rotation.
731  */
732  wxPoint m_offset;
733 
734  LSET m_layerMask; // Bitwise layer: 1 = copper layer, 15 = cmp,
735  // 2..14 = internal layers, 16..31 = technical layers
736 
737  wxSize m_deltaSize; // Delta for PAD_SHAPE::TRAPEZOID; half the delta squeezes
738  // one end and half expands the other. It is only valid
739  // to have a single axis be non-0.
740 
741  wxPoint m_pos0; // Initial Pad position (i.e. pad position relative to the
742  // footprint anchor, orientation 0)
743 
744  PAD_ATTRIB m_attribute; // PAD_ATTRIB_NORMAL, PAD_ATTRIB::SMD, PAD_ATTRIB::CONN,
745  // PAD_ATTRIB::NPTH
746  PAD_PROP m_property; // Property in fab files (BGA, FIDUCIAL, TESTPOINT, etc.)
747 
748  double m_orient; // in 1/10 degrees
749 
750  int m_lengthPadToDie; // Length net from pad to die, inside the package
751 
754 
757 
758  /*
759  * Pad clearances, margins, etc. exist in a hierarchy. If a given level is specified then
760  * the remaining levels are NOT consulted.
761  *
762  * LEVEL 1: (highest priority) local overrides (pad, footprint, etc.)
763  * LEVEL 2: Rules
764  * LEVEL 3: Accumulated local settings, netclass settings, & board design settings
765  *
766  * These are the LEVEL 1 settings for a pad.
767  */
769  int m_localSolderMaskMargin; // Local solder mask margin
770  int m_localSolderPasteMargin; // Local solder paste margin absolute value
771  double m_localSolderPasteMarginRatio; // Local solder mask margin ratio of pad size
772  // The final margin is the sum of these 2 values
773 
774  ZONE_CONNECTION m_zoneConnection; // No connection, thermal relief, etc.
775  int m_thermalWidth; // Thermal spoke width.
777 };
778 
779 #endif // PAD_H
bool TransformHoleWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, int aError, ERROR_LOC aErrorLoc) const
Build the corner list of the polygonal drill shape in the board coordinate system.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pad.cpp:1142
CUST_PAD_SHAPE_IN_ZONE
Definition: pad.h:41
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pad.h:248
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:41
int GetLocalSolderMaskMargin() const
Definition: pad.h:383
void FlipPrimitives(bool aFlipLeftRight)
Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pad...
Definition: pad.cpp:650
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
void SetOffset(const wxPoint &aOffset)
Definition: pad.h:245
const int GetSizeY() const
Definition: pad.h:233
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:387
bool m_shapesDirty
Definition: pad.h:690
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition: pad.cpp:168
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: pad.h:394
int m_chamferPositions
Definition: pad.h:720
void SetKeepTopBottom(bool aSet)
Set whether we keep the top and bottom connections even if they are not connected.
Definition: pad.h:559
void SetAttribute(PAD_ATTRIB aAttribute)
Definition: pad.cpp:564
const int GetDrillSizeX() const
Definition: pad.h:241
std::mutex m_shapesBuildingLock
Definition: pad.h:691
std::mutex m_polyBuildingLock
Definition: pad.h:697
int GetLocalSolderPasteMargin() const
Definition: pad.h:390
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:191
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.
Definition: pad.cpp:1154
void DeletePrimitivesList()
Clear the basic shapes list.
void SetLocalClearance(int aClearance)
Definition: pad.h:388
wxSize m_deltaSize
Definition: pad.h:737
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
int m_subRatsnest
Definition: pad.h:708
int m_effectiveBoundingRadius
Definition: pad.h:699
void SetThermalSpokeWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition: pad.h:487
void SetDrillSizeY(const int aY)
Definition: pad.h:242
PAD_PROP GetProperty() const
Definition: pad.h:371
wxSize m_drill
Definition: pad.h:711
int GetLocalClearanceOverrides(wxString *aSource) const override
Return any local clearance overrides set in the "classic" (ie: pre-rule) system.
Definition: pad.cpp:674
static int Compare(const PAD *padref, const PAD *padcmp)
Compare two pads and return 0 if they are equal.
Definition: pad.cpp:1009
double m_roundedCornerScale
Definition: pad.h:716
LSET m_layerMask
Definition: pad.h:734
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: pad.cpp:955
void SetOrientationDegrees(double aOrientation)
Set orientation in degrees.
Definition: pad.h:340
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: pad.cpp:145
void SetSubRatsnest(int aSubRatsnest)
Definition: pad.h:545
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pad.h:564
void SetSizeX(const int aX)
Definition: pad.h:230
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)
const SHAPE_SEGMENT * GetEffectiveHoleShape() const
Return a SHAPE object representing the pad's hole.
Definition: pad.cpp:292
wxString AsString() const
Definition: kiid.cpp:218
PAD_SHAPE m_anchorPadShape
Definition: pad.h:722
PAD * ClonePad() const
Same as Clone, but returns a PAD item.
Definition: pad.h:644
class PAD, a pad in a footprint
Definition: typeinfo.h:89
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:678
void AddPrimitiveSegment(const wxPoint &aStart, const wxPoint &aEnd, int aThickness)
void SetSize(const wxSize &aSize)
Definition: pad.h:228
int GetEffectiveThermalGap(wxString *aSource=nullptr) const
Return the effective thermal gap having resolved any inheritance.
Definition: pad.cpp:832
wxString m_pinType
Definition: pad.h:676
void SetDelta(const wxSize &aSize)
Definition: pad.h:235
wxPoint m_pos0
Definition: pad.h:741
The base class for create windows for drawing purpose.
bool IsAperturePad() const
Definition: pad.h:375
wxString GetClass() const override
Return the class name.
Definition: pad.h:589
std::shared_ptr< SHAPE_COMPOUND > m_effectiveShape
Definition: pad.h:693
int GetThermalGap() const
Definition: pad.h:496
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
PAD_DRILL_SHAPE_T
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
Definition: pad_shapes.h:67
wxString ShowPadShape() const
Definition: pad.cpp:1078
bool GetKeepTopBottom() const
Definition: pad.h:560
double m_localSolderPasteMarginRatio
Definition: pad.h:771
PAD_SHAPE m_padShape
Definition: pad.h:680
bool IsFlipped() const
Definition: pad.cpp:189
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
int m_localSolderPasteMargin
Definition: pad.h:770
EDA_RECT m_effectiveBoundingBox
Definition: pad.h:692
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:769
void SetPadToDieLength(int aLength)
Definition: pad.h:380
void SetProperty(PAD_PROP aProperty)
Definition: pad.cpp:575
void ImportSettingsFrom(const PAD &aMasterPad)
Import the pad settings from aMasterPad.
Definition: pad.cpp:1346
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: pad.h:694
int GetEffectiveThermalSpokeWidth(wxString *aSource=nullptr) const
Return the effective thermal spoke width having resolved any inheritance.
Definition: pad.cpp:813
bool m_keepTopBottomLayer
Definition: pad.h:756
ZONE_CONNECTION GetZoneConnection() const
Definition: pad.h:473
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pad.cpp:1231
void SetLocalSolderMaskMargin(int aMargin)
Definition: pad.h:384
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape() DO NOT REORDER, legacy_plugin is dependent on ...
Definition: pad_shapes.h:33
int m_localClearance
Definition: pad.h:768
const wxPoint & GetOffset() const
Definition: pad.h:246
std::shared_ptr< SHAPE_POLY_SET > m_effectivePolygon
Definition: pad.h:698
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: pad.cpp:851
void SetDrillSizeX(const int aX)
Definition: pad.h:240
const wxSize & GetDrillSize() const
Definition: pad.h:239
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
Definition: pad.cpp:1430
wxPoint ShapePos() const
Definition: pad.cpp:659
like PAD_PTH, but not plated
double m_chamferScale
Definition: pad.h:718
PCB_LAYER_ID
A quick note on layer IDs:
bool FlashLayer(int aLayer) const
Check to see whether the pad should be flashed on the specific layer.
Definition: pad.cpp:209
LSET is a set of PCB_LAYER_IDs.
double GetOrientationRadians() const
Definition: pad.h:348
int m_thermalGap
Definition: pad.h:776
int GetThermalSpokeWidth() const
Definition: pad.h:488
double GetOrientation() const
Return the rotation angle of the pad in a variety of units (the basic call returns tenths of degrees)...
Definition: pad.h:346
void SetPos0(const wxPoint &aPos)
Definition: pad.h:222
void SetLocalCoord()
< Set relative coordinates.
Definition: pad.cpp:549
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pad.cpp:592
void SetThermalGap(int aGap)
Definition: pad.h:495
Represent a set of closed polygons.
int m_thermalWidth
Definition: pad.h:775
void SetDrillSize(const wxSize &aSize)
Definition: pad.h:238
const wxSize & GetSize() const
Definition: pad.h:229
ZONE_CONNECTION GetEffectiveZoneConnection(wxString *aSource=nullptr) const
Return the zone connection in effect (either locally overridden or overridden in the parent footprint...
Definition: pad.cpp:792
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pad.cpp:1317
const wxString & GetName() const
Definition: pad.h:130
void SetRemoveUnconnected(bool aSet)
Set the unconnected removal property.
Definition: pad.h:553
static LSET PTHMask()
layer set for a through hole pad
Definition: pad.cpp:154
const EDA_RECT GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
Definition: pad.cpp:522
double m_orient
Definition: pad.h:748
const wxString & GetPinType() const
Definition: pad.h:142
PAD_SHAPE GetShape() const
Definition: pad.h:166
void SetX0(int x)
Definition: pad.h:226
PAD & operator=(const PAD &aOther)
Definition: pad.cpp:126
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: 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:183
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:365
An abstract shape on 2D plane.
Definition: shape.h:116
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: pad.h:472
void SetDrawCoord()
Definition: pad.cpp:531
ZONE_CONNECTION m_zoneConnection
Definition: pad.h:774
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition: pad.h:135
void BuildEffectivePolygon() const
Definition: pad.cpp:483
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:194
bool IsOnCopperLayer() const override
Definition: pad.h:214
void MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon, PCB_LAYER_ID aLayer, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Merge all basic shapes to a SHAPE_POLY_SET.
void SetRoundRectRadiusRatio(double aRadiusScale)
Has meaning only for rounded rectangle pads.
Definition: pad.cpp:258
PAD_ATTRIB
The set of pad shapes, used with PAD::{Set,Get}Attribute().
Definition: pad_shapes.h:79
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
Definition: pad.h:350
void AddPrimitiveCurve(const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &aCtrl1, const wxPoint &aCtrl2, int aThickness)
void BuildEffectiveShapes(PCB_LAYER_ID aLayer) const
Rebuild the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit.
Definition: pad.cpp:310
double GetLocalSolderPasteMarginRatio() const
Definition: pad.h:393
void SetRoundRectCornerRadius(double aRadius)
Has meaning only for rounded rectangle pads.
Definition: pad.cpp:249
const KIID m_Uuid
Definition: eda_item.h:475
int GetRoundRectCornerRadius() const
Definition: pad.cpp:243
const wxSize & GetDelta() const
Definition: pad.h:236
wxSize m_size
Definition: pad.h:712
int GetSolderMaskMargin() const
Definition: pad.cpp:697
FOOTPRINT * GetParent() const
Definition: pad.cpp:1340
void SetChamferPositions(int aPositions)
Has meaning only for chamfered rectangular pads.
Definition: pad.h:538
EDA_UNITS
Definition: eda_units.h:38
PAD_DRILL_SHAPE_T m_drillShape
Definition: pad.h:714
wxPoint m_offset
Definition: pad.h:732
const wxPoint & GetPos0() const
Definition: pad.h:223
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aMaxError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
void SetSizeY(const int aY)
Definition: pad.h:232
int GetBoundingRadius() const
Return the radius of a minimum sized circle which fully encloses this pad.
Definition: pad.cpp:301
bool IsType(const KICAD_T aScanTypes[]) const override
Check whether the item is one of the listed types.
Definition: pad.h:84
static LSET ApertureMask()
layer set for an aperture pad
Definition: pad.cpp:182
void SetLayerSet(LSET aLayers) override
Definition: pad.h:364
bool m_removeUnconnectedLayer
< If true, the pad copper is removed for layers that are not connected.
Definition: pad.h:753
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: pad.h:184
double GetChamferRectRatio() const
Definition: pad.h:529
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:687
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
wxSize GetSolderPasteMargin() const
Usually < 0 (mask shape smaller than pad)because the margin can be dependent on the pad size,...
Definition: pad.cpp:742
int GetSubRatsnest() const
Definition: pad.h:544
PAD_PROP
Ghe set of pad properties used in Gerber files (Draw files, and P&P files) to define some properties ...
Definition: pad_shapes.h:95
wxPoint GetPosition() const override
Definition: pad.h:174
void SetLocalSolderPasteMargin(int aMargin)
Definition: pad.h:391
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:351
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:243
PAD_ATTRIB GetAttribute() const
Definition: pad.h:368
double GetOrientationDegrees() const
Definition: pad.h:347
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:168
void SetDirty()
Definition: pad.h:358
void SetY(int y)
Definition: pad.h:219
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pad.cpp:1148
Handle the component boundary box.
Definition: eda_rect.h:42
const int GetSizeX() const
Definition: pad.h:231
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: pad.cpp:274
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
wxString m_name
Definition: pad.h:674
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: pad.cpp:1107
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:148
wxString m_pinFunction
Definition: pad.h:675
void SetShape(PAD_SHAPE aShape)
Set the new shape of this pad.
Definition: pad.h:157
int GetChamferPositions() const
Definition: pad.h:539
wxString GetParentAsString() const
Definition: pad.h:107
int m_lengthPadToDie
Definition: pad.h:750
PAD_ATTRIB m_attribute
Definition: pad.h:744
void AppendPrimitives(const std::vector< std::shared_ptr< PCB_SHAPE >> &aPrimitivesList)
Import a custom shape primitive list (composed of basic shapes) and add items to the current list.
wxString ShowPadAttr() const
Definition: pad.cpp:1094
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition: pad.cpp:175
bool IsDirty() const
Definition: pad.h:353
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: pad.h:706
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:57
void SetChamferRectRatio(double aChamferScale)
Has meaning only for chamfered rectangular pads.
Definition: pad.cpp:266
void Move(const wxPoint &aMoveVector) override
Move this object.
Definition: pad.h:614
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: pad.cpp:161
int GetPadToDieLength() const
Definition: pad.h:381
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pad.h:79
PAD(FOOTPRINT *parent)
Definition: pad.cpp:58
const wxString & GetPinFunction() const
Definition: pad.h:136
bool m_polyDirty
Definition: pad.h:696
bool GetRemoveUnconnected() const
Definition: pad.h:554
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:298
PAD_SHAPE GetAnchorPadShape() const
Definition: pad.h:179
void SetY0(int y)
Definition: pad.h:225
void SetOrientation(double aAngle)
Set the rotation angle of the pad.
Definition: pad.cpp:583
PAD_PROP m_property
Definition: pad.h:746
void AddPrimitiveCircle(const wxPoint &aCenter, int aRadius, int aThickness, bool aFilled)
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
void SetAnchorPadShape(PAD_SHAPE aShape)
Set the shape of the anchor pad for custom shaped pads.
Definition: pad.h:205
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
Definition: pad.cpp:1066
void SetX(int x)
Definition: pad.h:220
void addPadPrimitivesToPolygon(SHAPE_POLY_SET *aMergedPolygon, PCB_LAYER_ID aLayer, int aError, ERROR_LOC aErrorLoc) const