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 
128  void SetNumber( const wxString& aNumber ) { m_number = aNumber; }
129  const wxString& GetNumber() const { return m_number; }
130 
134  bool CanHaveNumber() const;
135 
139  void SetPinFunction( const wxString& aName ) { m_pinFunction = aName; }
140  const wxString& GetPinFunction() const { return m_pinFunction; }
141 
145  void SetPinType( const wxString& aType ) { m_pinType = aType; }
146  const wxString& GetPinType() const { return m_pinType; }
147 
152  bool SameLogicalPadAs( const PAD* other ) const
153  {
154  // hide tricks behind sensible API
155  return GetParent() == other->GetParent() && m_number == other->m_number;
156  }
157 
161  void SetShape( PAD_SHAPE aShape )
162  {
163  m_padShape = aShape;
164  SetDirty();
165  }
166 
170  PAD_SHAPE GetShape() const { return m_padShape; }
171 
172  void SetPosition( const wxPoint& aPos ) override
173  {
174  m_pos = aPos;
175  SetDirty();
176  }
177 
178  wxPoint GetPosition() const override { return m_pos; }
179 
184 
189  {
191  }
192 
199  {
200  m_customShapeClearanceArea = aOption;
201  }
202 
210  {
212  SetDirty();
213  }
214 
218  bool IsOnCopperLayer() const override
219  {
220  return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
221  }
222 
223  void SetY( int y ) { m_pos.y = y; SetDirty(); }
224  void SetX( int x ) { m_pos.x = x; SetDirty(); }
225 
226  void SetPos0( const wxPoint& aPos ) { m_pos0 = aPos; }
227  const wxPoint& GetPos0() const { return m_pos0; }
228 
229  void SetY0( int y ) { m_pos0.y = y; }
230  void SetX0( int x ) { m_pos0.x = x; }
231 
232  void SetSize( const wxSize& aSize ) { m_size = aSize; SetDirty(); }
233  const wxSize& GetSize() const { return m_size; }
234  void SetSizeX( const int aX ) { m_size.x = aX; SetDirty(); }
235  const int GetSizeX() const { return m_size.x; }
236  void SetSizeY( const int aY ) { m_size.y = aY; SetDirty(); }
237  const int GetSizeY() const { return m_size.y; }
238 
239  void SetDelta( const wxSize& aSize ) { m_deltaSize = aSize; SetDirty(); }
240  const wxSize& GetDelta() const { return m_deltaSize; }
241 
242  void SetDrillSize( const wxSize& aSize ) { m_drill = aSize; SetDirty(); }
243  const wxSize& GetDrillSize() const { return m_drill; }
244  void SetDrillSizeX( const int aX ) { m_drill.x = aX; SetDirty(); }
245  const int GetDrillSizeX() const { return m_drill.x; }
246  void SetDrillSizeY( const int aY ) { m_drill.y = aY; SetDirty(); }
247  const int GetDrillSizeY() const { return m_drill.y; }
248 
249  void SetOffset( const wxPoint& aOffset ) { m_offset = aOffset; SetDirty(); }
250  const wxPoint& GetOffset() const { return m_offset; }
251 
252  wxPoint GetCenter() const override { return GetPosition(); }
253 
265  void AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness, bool aFilled );
266  void AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness, bool aFilled );
267  void AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness );
268  void AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness, bool aFilled );
269  void AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThickness,
270  bool aFilled );
271  void AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aArcAngle,
272  int aThickness );
273  void AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aCtrl1,
274  const wxPoint& aCtrl2, int aThickness );
275 
276 
277  bool GetBestAnchorPosition( VECTOR2I& aPos );
278 
290  void MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon,
291  ERROR_LOC aErrorLoc = ERROR_INSIDE ) const;
292 
296  void DeletePrimitivesList();
297 
301  const std::vector<std::shared_ptr<PCB_SHAPE>>& GetPrimitives() const
302  {
303  return m_editPrimitives;
304  }
305 
306  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
307 
312  void FlipPrimitives( bool aFlipLeftRight );
313 
318  void ReplacePrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
319 
324  void AppendPrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
325 
329  void AddPrimitive( PCB_SHAPE* aPrimitive );
330 
338  void SetOrientation( double aAngle );
339 
343  void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation*10.0 ); }
344 
349  double GetOrientation() const { return m_orient; }
350  double GetOrientationDegrees() const { return m_orient/10.0; }
351  double GetOrientationRadians() const { return m_orient*M_PI/1800; }
352 
353  void SetDrillShape( PAD_DRILL_SHAPE_T aShape ) { m_drillShape = aShape; m_shapesDirty = true; }
355 
356  bool IsDirty() const
357  {
358  return m_shapesDirty || m_polyDirty;
359  }
360 
361  void SetDirty()
362  {
363  m_shapesDirty = true;
364  m_polyDirty = true;
365  }
366 
367  void SetLayerSet( LSET aLayers ) override { m_layerMask = aLayers; }
368  LSET GetLayerSet() const override { return m_layerMask; }
369 
370  void SetAttribute( PAD_ATTRIB aAttribute );
371  PAD_ATTRIB GetAttribute() const { return m_attribute; }
372 
373  void SetProperty( PAD_PROP aProperty );
374  PAD_PROP GetProperty() const { return m_property; }
375 
376  // We don't currently have an attribute for APERTURE, and adding one will change the file
377  // format, so for now just infer a copper-less pad to be an APERTURE pad.
378  bool IsAperturePad() const
379  {
380  return ( m_layerMask & LSET::AllCuMask() ).none();
381  }
382 
383  void SetPadToDieLength( int aLength ) { m_lengthPadToDie = aLength; }
384  int GetPadToDieLength() const { return m_lengthPadToDie; }
385 
387  void SetLocalSolderMaskMargin( int aMargin ) { m_localSolderMaskMargin = aMargin; }
388 
389  int GetLocalClearance( wxString* aSource ) const override;
390  int GetLocalClearance() const { return m_localClearance; }
391  void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; }
392 
394  void SetLocalSolderPasteMargin( int aMargin ) { m_localSolderPasteMargin = aMargin; }
395 
398 
409  PCB_LAYER_ID aLayer, int aClearanceValue,
410  int aMaxError, ERROR_LOC aErrorLoc,
411  bool ignoreLineWidth = false ) const override;
412 
422  bool TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aInflateValue,
423  int aError, ERROR_LOC aErrorLoc ) const;
424 
425  // @copydoc BOARD_ITEM::GetEffectiveShape
426  virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
427 
428  const std::shared_ptr<SHAPE_POLY_SET>& GetEffectivePolygon() const;
429 
433  const SHAPE_SEGMENT* GetEffectiveHoleShape() const;
434 
440  int GetBoundingRadius() const;
441 
448  int GetLocalClearanceOverrides( wxString* aSource ) const override;
449 
460  int GetSolderMaskMargin() const;
461 
473  wxSize GetSolderPasteMargin() const;
474 
477 
484  ZONE_CONNECTION GetEffectiveZoneConnection( wxString* aSource = nullptr ) const;
485 
490  void SetThermalSpokeWidth( int aWidth ) { m_thermalWidth = aWidth; }
491  int GetThermalSpokeWidth() const { return m_thermalWidth; }
492 
496  int GetEffectiveThermalSpokeWidth( wxString* aSource = nullptr ) const;
497 
498  void SetThermalGap( int aGap ) { m_thermalGap = aGap; }
499  int GetThermalGap() const { return m_thermalGap; }
500 
504  int GetEffectiveThermalGap( wxString* aSource = nullptr ) const;
505 
511  void SetRoundRectCornerRadius( double aRadius );
512  int GetRoundRectCornerRadius() const;
513 
514  wxPoint ShapePos() const;
515 
522  void SetRoundRectRadiusRatio( double aRadiusScale );
524 
531  void SetChamferRectRatio( double aChamferScale );
532  double GetChamferRectRatio() const { return m_chamferScale; }
533 
541  void SetChamferPositions( int aPositions ) { m_chamferPositions = aPositions; }
542  int GetChamferPositions() const { return m_chamferPositions; }
543 
547  int GetSubRatsnest() const { return m_subRatsnest; }
548  void SetSubRatsnest( int aSubRatsnest ) { m_subRatsnest = aSubRatsnest; }
549 
556  void SetRemoveUnconnected( bool aSet ) { m_removeUnconnectedLayer = aSet; }
558 
562  void SetKeepTopBottom( bool aSet ) { m_keepTopBottomLayer = aSet; }
563  bool GetKeepTopBottom() const { return m_keepTopBottomLayer; }
564 
565  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
566 
567  bool IsOnLayer( PCB_LAYER_ID aLayer ) const override
568  {
569  return m_layerMask[aLayer];
570  }
571 
578  bool FlashLayer( int aLayer ) const;
579 
587  bool FlashLayer( LSET aLayers ) const;
588 
589  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
590  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
591 
592  wxString GetClass() const override
593  {
594  return wxT( "PAD" );
595  }
596 
600  const EDA_RECT GetBoundingBox() const override;
601 
603  void SetDrawCoord();
604 
605  //todo: Remove SetLocalCoord along with m_pos
607  void SetLocalCoord();
608 
615  static int Compare( const PAD* padref, const PAD* padcmp );
616 
617  void Move( const wxPoint& aMoveVector ) override
618  {
619  m_pos += aMoveVector;
620  SetLocalCoord();
621  SetDirty();
622  }
623 
624  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
625 
626  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
627 
628  BITMAPS GetMenuImage() const override;
629 
633  wxString ShowPadShape() const;
634 
638  wxString ShowPadAttr() const;
639 
640  EDA_ITEM* Clone() const override;
641 
647  PAD* ClonePad() const
648  {
649  return (PAD*) Clone();
650  }
651 
656  void BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const;
657  void BuildEffectivePolygon() const;
658 
659  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
660 
661  double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
662 
663  virtual const BOX2I ViewBBox() const override;
664 
665  virtual void SwapData( BOARD_ITEM* aImage ) override;
666 
667 #if defined(DEBUG)
668  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
669 #endif
670 
671 
672 private:
673  void addPadPrimitivesToPolygon( SHAPE_POLY_SET* aMergedPolygon, int aError,
674  ERROR_LOC aErrorLoc ) const;
675 
676 private:
677  wxString m_number; // Pad name (pin number in schematic)
678  wxString m_pinFunction; // Pin name in schematic
679  wxString m_pinType; // Pin electrical type in schematic
680 
681  wxPoint m_pos; // Pad Position on board
682 
683  PAD_SHAPE m_padShape; // Shape: PAD_SHAPE::CIRCLE, PAD_SHAPE::RECT,
684  // PAD_SHAPE::OVAL, PAD_SHAPE::TRAPEZOID,
685  // PAD_SHAPE::ROUNDRECT, PAD_SHAPE_POLYGON
686  /*
687  * Editing definitions of primitives for custom pad shapes. In local coordinates relative
688  * to m_Pos (NOT shapePos) at orient 0.
689  */
690  std::vector<std::shared_ptr<PCB_SHAPE>> m_editPrimitives;
691 
692  // Must be set to true to force rebuild shapes to draw (after geometry change for instance)
693  mutable bool m_shapesDirty;
694  mutable std::mutex m_shapesBuildingLock;
696  mutable std::shared_ptr<SHAPE_COMPOUND> m_effectiveShape;
697  mutable std::shared_ptr<SHAPE_SEGMENT> m_effectiveHoleShape;
698 
699  mutable bool m_polyDirty;
700  mutable std::mutex m_polyBuildingLock;
701  mutable std::shared_ptr<SHAPE_POLY_SET> m_effectivePolygon;
703 
704  /*
705  * How to build the custom shape in zone, to create the clearance area:
706  * CUST_PAD_SHAPE_IN_ZONE_OUTLINE = use pad shape
707  * CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL = use the convex hull of the pad shape
708  */
710 
711  int m_subRatsnest; // Variable used to handle subnet (block) number in
712  // ratsnest computations
713 
714  wxSize m_drill; // Drill diameter (x == y) or slot dimensions (x != y)
715  wxSize m_size; // X and Y size (relative to orient 0)
716 
717  PAD_DRILL_SHAPE_T m_drillShape; // PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG
718 
719  double m_roundedCornerScale; // Scaling factor of min(width, height) to corner
720  // radius, default 0.25
721  double m_chamferScale; // Scaling factor of min(width, height) to chamfer
722  // size, default 0.25
723  int m_chamferPositions; // The positions of the chamfers (at orient 0)
724 
725  PAD_SHAPE m_anchorPadShape; // For custom shaped pads: shape of pad anchor,
726  // PAD_SHAPE::RECT, PAD_SHAPE::CIRCLE
727 
728  /*
729  * Most of the time the hole is the center of the shape (m_Offset = 0). But some designers
730  * use oblong/rect pads with a hole moved to one of the oblong/rect pad shape ends.
731  * In all cases the hole is at the pad position. This offset is from the hole to the center
732  * of the pad shape (ie: the copper area around the hole).
733  * ShapePos() returns the board shape position according to the offset and the pad rotation.
734  */
735  wxPoint m_offset;
736 
737  LSET m_layerMask; // Bitwise layer: 1 = copper layer, 15 = cmp,
738  // 2..14 = internal layers, 16..31 = technical layers
739 
740  wxSize m_deltaSize; // Delta for PAD_SHAPE::TRAPEZOID; half the delta squeezes
741  // one end and half expands the other. It is only valid
742  // to have a single axis be non-0.
743 
744  wxPoint m_pos0; // Initial Pad position (i.e. pad position relative to the
745  // footprint anchor, orientation 0)
746 
747  PAD_ATTRIB m_attribute; // PAD_ATTRIB_NORMAL, PAD_ATTRIB::SMD, PAD_ATTRIB::CONN,
748  // PAD_ATTRIB::NPTH
749  PAD_PROP m_property; // Property in fab files (BGA, FIDUCIAL, TESTPOINT, etc.)
750 
751  double m_orient; // in 1/10 degrees
752 
753  int m_lengthPadToDie; // Length net from pad to die, inside the package
754 
757 
760 
761  /*
762  * Pad clearances, margins, etc. exist in a hierarchy. If a given level is specified then
763  * the remaining levels are NOT consulted.
764  *
765  * LEVEL 1: (highest priority) local overrides (pad, footprint, etc.)
766  * LEVEL 2: Rules
767  * LEVEL 3: Accumulated local settings, netclass settings, & board design settings
768  *
769  * These are the LEVEL 1 settings for a pad.
770  */
772  int m_localSolderMaskMargin; // Local solder mask margin
773  int m_localSolderPasteMargin; // Local solder paste margin absolute value
774  double m_localSolderPasteMarginRatio; // Local solder mask margin ratio of pad size
775  // The final margin is the sum of these 2 values
776 
777  ZONE_CONNECTION m_zoneConnection; // No connection, thermal relief, etc.
778  int m_thermalWidth; // Thermal spoke width.
780 };
781 
782 #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:1156
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:252
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:41
int GetLocalSolderMaskMargin() const
Definition: pad.h:386
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:664
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
void SetOffset(const wxPoint &aOffset)
Definition: pad.h:249
const int GetSizeY() const
Definition: pad.h:237
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:390
bool m_shapesDirty
Definition: pad.h:693
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition: pad.cpp:182
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: pad.h:397
int m_chamferPositions
Definition: pad.h:723
void SetKeepTopBottom(bool aSet)
Set whether we keep the top and bottom connections even if they are not connected.
Definition: pad.h:562
void SetAttribute(PAD_ATTRIB aAttribute)
Definition: pad.cpp:578
const int GetDrillSizeX() const
Definition: pad.h:245
std::mutex m_shapesBuildingLock
Definition: pad.h:694
std::mutex m_polyBuildingLock
Definition: pad.h:700
int GetLocalSolderPasteMargin() const
Definition: pad.h:393
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:236
double GetRoundRectRadiusRatio() const
Definition: pad.h:523
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:1168
void addPadPrimitivesToPolygon(SHAPE_POLY_SET *aMergedPolygon, int aError, ERROR_LOC aErrorLoc) const
void DeletePrimitivesList()
Clear the basic shapes list.
void SetLocalClearance(int aClearance)
Definition: pad.h:391
wxSize m_deltaSize
Definition: pad.h:740
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
int m_subRatsnest
Definition: pad.h:711
int m_effectiveBoundingRadius
Definition: pad.h:702
void SetThermalSpokeWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition: pad.h:490
void SetDrillSizeY(const int aY)
Definition: pad.h:246
PAD_PROP GetProperty() const
Definition: pad.h:374
wxSize m_drill
Definition: pad.h:714
int GetLocalClearanceOverrides(wxString *aSource) const override
Return any local clearance overrides set in the "classic" (ie: pre-rule) system.
Definition: pad.cpp:688
static int Compare(const PAD *padref, const PAD *padcmp)
Compare two pads and return 0 if they are equal.
Definition: pad.cpp:1023
double m_roundedCornerScale
Definition: pad.h:719
LSET m_layerMask
Definition: pad.h:737
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:969
void SetOrientationDegrees(double aOrientation)
Set orientation in degrees.
Definition: pad.h:343
bool IsLocked() const override
Definition: pad.cpp:159
void SetSubRatsnest(int aSubRatsnest)
Definition: pad.h:548
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pad.h:567
void SetSizeX(const int aX)
Definition: pad.h:234
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:306
wxString AsString() const
Definition: kiid.cpp:218
PAD_SHAPE m_anchorPadShape
Definition: pad.h:725
PAD * ClonePad() const
Same as Clone, but returns a PAD item.
Definition: pad.h:647
class PAD, a pad in a footprint
Definition: typeinfo.h:89
void SetPinType(const wxString &aType)
Set the pad electrical type.
Definition: pad.h:145
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:681
void AddPrimitiveSegment(const wxPoint &aStart, const wxPoint &aEnd, int aThickness)
void SetSize(const wxSize &aSize)
Definition: pad.h:232
int GetEffectiveThermalGap(wxString *aSource=nullptr) const
Return the effective thermal gap having resolved any inheritance.
Definition: pad.cpp:846
wxString m_pinType
Definition: pad.h:679
void SetDelta(const wxSize &aSize)
Definition: pad.h:239
wxPoint m_pos0
Definition: pad.h:744
The base class for create windows for drawing purpose.
bool IsAperturePad() const
Definition: pad.h:378
wxString GetClass() const override
Return the class name.
Definition: pad.h:592
std::shared_ptr< SHAPE_COMPOUND > m_effectiveShape
Definition: pad.h:696
int GetThermalGap() const
Definition: pad.h:499
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:1092
bool GetKeepTopBottom() const
Definition: pad.h:563
double m_localSolderPasteMarginRatio
Definition: pad.h:774
PAD_SHAPE m_padShape
Definition: pad.h:683
bool IsFlipped() const
Definition: pad.cpp:203
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:773
EDA_RECT m_effectiveBoundingBox
Definition: pad.h:695
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:772
void SetPadToDieLength(int aLength)
Definition: pad.h:383
void SetProperty(PAD_PROP aProperty)
Definition: pad.cpp:589
void ImportSettingsFrom(const PAD &aMasterPad)
Import the pad settings from aMasterPad.
Definition: pad.cpp:1360
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: pad.h:697
int GetEffectiveThermalSpokeWidth(wxString *aSource=nullptr) const
Return the effective thermal spoke width having resolved any inheritance.
Definition: pad.cpp:827
bool m_keepTopBottomLayer
Definition: pad.h:759
ZONE_CONNECTION GetZoneConnection() const
Definition: pad.h:476
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pad.cpp:1245
void SetLocalSolderMaskMargin(int aMargin)
Definition: pad.h:387
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:771
const wxPoint & GetOffset() const
Definition: pad.h:250
std::shared_ptr< SHAPE_POLY_SET > m_effectivePolygon
Definition: pad.h:701
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:865
void SetDrillSizeX(const int aX)
Definition: pad.h:244
const wxSize & GetDrillSize() const
Definition: pad.h:243
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
Definition: pad.cpp:1444
wxPoint ShapePos() const
Definition: pad.cpp:673
like PAD_PTH, but not plated
double m_chamferScale
Definition: pad.h:721
bool FlashLayer(int aLayer) const
Check to see whether the pad should be flashed on the specific layer.
Definition: pad.cpp:223
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:504
double GetOrientationRadians() const
Definition: pad.h:351
int m_thermalGap
Definition: pad.h:779
int GetThermalSpokeWidth() const
Definition: pad.h:491
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:349
void SetPos0(const wxPoint &aPos)
Definition: pad.h:226
void SetLocalCoord()
< Set relative coordinates.
Definition: pad.cpp:563
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pad.cpp:606
void SetThermalGap(int aGap)
Definition: pad.h:498
Represent a set of closed polygons.
int m_thermalWidth
Definition: pad.h:778
void SetDrillSize(const wxSize &aSize)
Definition: pad.h:242
const wxSize & GetSize() const
Definition: pad.h:233
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:806
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pad.cpp:1331
void SetRemoveUnconnected(bool aSet)
Set the unconnected removal property.
Definition: pad.h:556
static LSET PTHMask()
layer set for a through hole pad
Definition: pad.cpp:168
const EDA_RECT GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
Definition: pad.cpp:536
const wxString & GetNumber() const
Definition: pad.h:129
double m_orient
Definition: pad.h:751
const wxString & GetPinType() const
Definition: pad.h:146
PAD_SHAPE GetShape() const
Definition: pad.h:170
void SetX0(int x)
Definition: pad.h:230
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:297
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:368
An abstract shape on 2D plane.
Definition: shape.h:116
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: pad.h:475
void SetDrawCoord()
Definition: pad.cpp:545
ZONE_CONNECTION m_zoneConnection
Definition: pad.h:777
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition: pad.h:139
void BuildEffectivePolygon() const
Definition: pad.cpp:497
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:218
void SetRoundRectRadiusRatio(double aRadiusScale)
Has meaning only for rounded rectangle pads.
Definition: pad.cpp:272
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:353
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:324
double GetLocalSolderPasteMarginRatio() const
Definition: pad.h:396
void SetRoundRectCornerRadius(double aRadius)
Has meaning only for rounded rectangle pads.
Definition: pad.cpp:263
const KIID m_Uuid
Definition: eda_item.h:475
int GetRoundRectCornerRadius() const
Definition: pad.cpp:257
const wxSize & GetDelta() const
Definition: pad.h:240
wxSize m_size
Definition: pad.h:715
int GetSolderMaskMargin() const
Definition: pad.cpp:711
FOOTPRINT * GetParent() const
Definition: pad.cpp:1354
void SetChamferPositions(int aPositions)
Has meaning only for chamfered rectangular pads.
Definition: pad.h:541
EDA_UNITS
Definition: eda_units.h:38
PAD_DRILL_SHAPE_T m_drillShape
Definition: pad.h:717
wxPoint m_offset
Definition: pad.h:735
const wxPoint & GetPos0() const
Definition: pad.h:227
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:236
int GetBoundingRadius() const
Return the radius of a minimum sized circle which fully encloses this pad.
Definition: pad.cpp:315
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:196
void SetLayerSet(LSET aLayers) override
Definition: pad.h:367
bool m_removeUnconnectedLayer
< If true, the pad copper is removed for layers that are not connected.
Definition: pad.h:756
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: pad.h:188
double GetChamferRectRatio() const
Definition: pad.h:532
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:690
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:756
int GetSubRatsnest() const
Definition: pad.h:547
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:178
void SetLocalSolderPasteMargin(int aMargin)
Definition: pad.h:394
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:354
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:247
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
PAD_ATTRIB GetAttribute() const
Definition: pad.h:371
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
Definition: pad.h:128
double GetOrientationDegrees() const
Definition: pad.h:350
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:172
void SetDirty()
Definition: pad.h:361
void SetY(int y)
Definition: pad.h:223
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pad.cpp:1162
Handle the component boundary box.
Definition: eda_rect.h:42
const int GetSizeX() const
Definition: pad.h:235
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:288
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
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:1121
void MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Merge all basic shapes to a SHAPE_POLY_SET.
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:152
wxString m_pinFunction
Definition: pad.h:678
void SetShape(PAD_SHAPE aShape)
Set the new shape of this pad.
Definition: pad.h:161
int GetChamferPositions() const
Definition: pad.h:542
wxString GetParentAsString() const
Definition: pad.h:107
int m_lengthPadToDie
Definition: pad.h:753
PAD_ATTRIB m_attribute
Definition: pad.h:747
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:1108
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition: pad.cpp:189
bool IsDirty() const
Definition: pad.h:356
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: pad.h:709
wxString m_number
Definition: pad.h:677
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
Definition: pad.h:57
void SetChamferRectRatio(double aChamferScale)
Has meaning only for chamfered rectangular pads.
Definition: pad.cpp:280
void Move(const wxPoint &aMoveVector) override
Move this object.
Definition: pad.h:617
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: pad.cpp:175
int GetPadToDieLength() const
Definition: pad.h:384
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:140
bool m_polyDirty
Definition: pad.h:699
bool GetRemoveUnconnected() const
Definition: pad.h:557
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:301
PAD_SHAPE GetAnchorPadShape() const
Definition: pad.h:183
void SetY0(int y)
Definition: pad.h:229
void SetOrientation(double aAngle)
Set the rotation angle of the pad.
Definition: pad.cpp:597
PAD_PROP m_property
Definition: pad.h:749
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:209
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
Definition: pad.cpp:1080
void SetX(int x)
Definition: pad.h:224
bool CanHaveNumber() const
Indicates whether or not the pad can have a number.
Definition: pad.cpp:145