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-2022 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>
33#include <pad_shapes.h>
34#include <geometry/eda_angle.h>
35#include <core/arraydim.h>
36
37class PCB_SHAPE;
38class PARAM_CFG;
39class SHAPE;
40class SHAPE_SEGMENT;
41
43{
46};
47
48class LINE_READER;
49class EDA_3D_CANVAS;
50class FOOTPRINT;
51class FP_SHAPE;
52
53namespace KIGFX
54{
55 class VIEW;
56}
57
59{
60public:
61 PAD( FOOTPRINT* parent );
62
63 // Copy constructor & operator= are needed because the list of basic shapes
64 // must be duplicated in copy.
65 PAD( const PAD& aPad );
66 PAD& operator=( const PAD &aOther );
67
68 /*
69 * Default layers used for pads, according to the pad type.
70 *
71 * This is default values only, they can be changed for a given pad.
72 */
73 static LSET PTHMask();
74 static LSET SMDMask();
75 static LSET ConnSMDMask();
77 static LSET UnplatedHoleMask();
78 static LSET ApertureMask();
79
80 static inline bool ClassOf( const EDA_ITEM* aItem )
81 {
82 return aItem && PCB_PAD_T == aItem->Type();
83 }
84
85 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
86 {
87 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
88 return true;
89
90 for( KICAD_T scanType : aScanTypes )
91 {
92 if( HasHole() )
93 {
94 if( scanType == PCB_LOCATE_HOLE_T )
95 return true;
96 else if( scanType == PCB_LOCATE_PTH_T && m_attribute != PAD_ATTRIB::NPTH )
97 return true;
98 else if( scanType == PCB_LOCATE_NPTH_T && m_attribute == PAD_ATTRIB::NPTH )
99 return true;
100 }
101 }
102
103 return false;
104 }
105
106 bool HasHole() const override
107 {
108 return GetDrillSizeX() > 0 && GetDrillSizeY() > 0;
109 }
110
111 FOOTPRINT* GetParent() const;
112
113 wxString GetParentAsString() const;
114
115 bool IsLocked() const override;
116
124 void ImportSettingsFrom( const PAD& aMasterPad );
125
129 bool IsFlipped() const;
130
134 void SetNumber( const wxString& aNumber ) { m_number = aNumber; }
135 const wxString& GetNumber() const { return m_number; }
136
140 bool CanHaveNumber() const;
141
145 void SetPinFunction( const wxString& aName ) { m_pinFunction = aName; }
146 const wxString& GetPinFunction() const { return m_pinFunction; }
147
151 void SetPinType( const wxString& aType ) { m_pinType = aType; }
152 const wxString& GetPinType() const { return m_pinType; }
153
158 bool SameLogicalPadAs( const PAD* other ) const
159 {
160 // hide tricks behind sensible API
161 return GetParentFootprint() == other->GetParentFootprint()
162 && !m_number.IsEmpty() && m_number == other->m_number;
163 }
164
169 bool IsNoConnectPad() const;
170
175 bool IsFreePad() const;
176
180 void SetShape( PAD_SHAPE aShape )
181 {
182 m_padShape = aShape;
183 SetDirty();
184 }
185
189 PAD_SHAPE GetShape() const { return m_padShape; }
190
191 void SetPosition( const VECTOR2I& aPos ) override
192 {
193 m_pos = aPos;
194 SetDirty();
195 }
196
197 VECTOR2I GetPosition() const override { return m_pos; }
198
203
208 {
210 }
211
218 {
220 }
221
229 {
231 SetDirty();
232 }
233
237 bool IsOnCopperLayer() const override
238 {
239 return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
240 }
241
242 void SetY( int y ) { m_pos.y = y; SetDirty(); }
243 void SetX( int x ) { m_pos.x = x; SetDirty(); }
244
245 void SetPos0( const VECTOR2I& aPos ) { m_pos0 = aPos; }
246 const VECTOR2I& GetPos0() const { return m_pos0; }
247
248 void SetY0( int y ) { m_pos0.y = y; }
249 void SetX0( int x ) { m_pos0.x = x; }
250
251 void SetSize( const VECTOR2I& aSize ) { m_size = aSize; SetDirty(); }
252 const VECTOR2I& GetSize() const { return m_size; }
253 void SetSizeX( const int aX ) { m_size.x = aX; SetDirty(); }
254 int GetSizeX() const { return m_size.x; }
255 void SetSizeY( const int aY ) { m_size.y = aY; SetDirty(); }
256 int GetSizeY() const { return m_size.y; }
257
258 void SetDelta( const VECTOR2I& aSize ) { m_deltaSize = aSize; SetDirty(); }
259 const VECTOR2I& GetDelta() const { return m_deltaSize; }
260
261 void SetDrillSize( const VECTOR2I& aSize ) { m_drill = aSize; SetDirty(); }
262 const VECTOR2I& GetDrillSize() const { return m_drill; }
263 void SetDrillSizeX( const int aX ) { m_drill.x = aX; SetDirty(); }
264 int GetDrillSizeX() const { return m_drill.x; }
265 void SetDrillSizeY( const int aY ) { m_drill.y = aY; SetDirty(); }
266 int GetDrillSizeY() const { return m_drill.y; }
267
268 void SetOffset( const VECTOR2I& aOffset ) { m_offset = aOffset; SetDirty(); }
269 const VECTOR2I& GetOffset() const { return m_offset; }
270
271 VECTOR2I GetCenter() const override { return GetPosition(); }
272
284 void AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness, bool aFilled );
285 void AddPrimitivePoly( const std::vector<VECTOR2I>& aPoly, int aThickness, bool aFilled );
286 void AddPrimitiveSegment( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aThickness );
287 void AddPrimitiveCircle( const VECTOR2I& aCenter, int aRadius, int aThickness, bool aFilled );
288 void AddPrimitiveRect( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aThickness,
289 bool aFilled );
290 void AddPrimitiveArc( const VECTOR2I& aCenter, const VECTOR2I& aStart,
291 const EDA_ANGLE& aArcAngle, int aThickness );
292 void AddPrimitiveCurve( const VECTOR2I& aStart, const VECTOR2I& aEnd, const VECTOR2I& aCtrl1,
293 const VECTOR2I& aCtrl2, int aThickness );
294
299 void AddPrimitiveAnnotationBox( const VECTOR2I& aStart, const VECTOR2I& aEnd );
300
301 bool GetBestAnchorPosition( VECTOR2I& aPos );
302
314 void MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon,
315 ERROR_LOC aErrorLoc = ERROR_INSIDE ) const;
316
321
325 const std::vector<std::shared_ptr<PCB_SHAPE>>& GetPrimitives() const
326 {
327 return m_editPrimitives;
328 }
329
330 void Flip( const VECTOR2I& VECTOR2I, bool aFlipLeftRight ) override;
331
336 void FlipPrimitives( bool aFlipLeftRight );
337
342 void ReplacePrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
343
348 void AppendPrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
349
353 void AddPrimitive( PCB_SHAPE* aPrimitive );
354
360 void SetOrientation( const EDA_ANGLE& aAngle );
361
366
367 // For property system
368 void SetOrientationDegrees( double aOrientation )
369 {
370 SetOrientation( EDA_ANGLE( aOrientation, DEGREES_T ) );
371 }
373 {
374 return m_orient.AsDegrees();
375 }
376
377 void SetDrillShape( PAD_DRILL_SHAPE_T aShape ) { m_drillShape = aShape; m_shapesDirty = true; }
379
380 bool IsDirty() const
381 {
382 return m_shapesDirty || m_polyDirty;
383 }
384
385 void SetDirty()
386 {
387 m_shapesDirty = true;
388 m_polyDirty = true;
389 }
390
391 void SetLayerSet( LSET aLayers ) override { m_layerMask = aLayers; }
392 LSET GetLayerSet() const override { return m_layerMask; }
393
394 void SetAttribute( PAD_ATTRIB aAttribute );
396
397 void SetProperty( PAD_PROP aProperty );
398 PAD_PROP GetProperty() const { return m_property; }
399
400 // We don't currently have an attribute for APERTURE, and adding one will change the file
401 // format, so for now just infer a copper-less pad to be an APERTURE pad.
402 bool IsAperturePad() const
403 {
404 return ( m_layerMask & LSET::AllCuMask() ).none();
405 }
406
407 void SetPadToDieLength( int aLength ) { m_lengthPadToDie = aLength; }
408 int GetPadToDieLength() const { return m_lengthPadToDie; }
409
411 void SetLocalSolderMaskMargin( int aMargin ) { m_localSolderMaskMargin = aMargin; }
412
413 int GetLocalClearance( wxString* aSource ) const override;
414 int GetLocalClearance() const { return m_localClearance; }
415 void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; }
416
418 void SetLocalSolderPasteMargin( int aMargin ) { m_localSolderPasteMargin = aMargin; }
419
422
423 int GetOwnClearance( PCB_LAYER_ID aLayer, wxString* aSource = nullptr ) const override;
424
434 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
435 int aMaxError, ERROR_LOC aErrorLoc,
436 bool ignoreLineWidth = false ) const override;
437
447 bool TransformHoleToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
448 ERROR_LOC aErrorLoc ) const;
449
465 virtual std::shared_ptr<SHAPE>
467 FLASHING flashPTHPads = FLASHING::DEFAULT ) const override;
468
469 const std::shared_ptr<SHAPE_POLY_SET>& GetEffectivePolygon() const;
470
474 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
475
481 int GetBoundingRadius() const;
482
489 int GetLocalClearanceOverrides( wxString* aSource ) const override;
490
501 int GetSolderMaskExpansion() const;
502
515
518
519 ZONE_CONNECTION GetLocalZoneConnectionOverride( wxString* aSource = nullptr ) const;
520
525 void SetThermalSpokeWidth( int aWidth ) { m_thermalSpokeWidth = aWidth; }
527
528 int GetLocalSpokeWidthOverride( wxString* aSource = nullptr ) const;
529
535 void SetThermalSpokeAngle( const EDA_ANGLE& aAngle ) { m_thermalSpokeAngle = aAngle; }
537
538 // For property system
539 void SetThermalSpokeAngleDegrees( double aAngle )
540 {
542 }
544 {
546 }
547
548 void SetThermalGap( int aGap ) { m_thermalGap = aGap; }
549 int GetThermalGap() const { return m_thermalGap; }
550
551 int GetLocalThermalGapOverride( wxString* aSource = nullptr ) const;
552
558 void SetRoundRectCornerRadius( double aRadius );
559 int GetRoundRectCornerRadius() const;
560
561 VECTOR2I ShapePos() const;
562
569 void SetRoundRectRadiusRatio( double aRadiusScale );
571
578 void SetChamferRectRatio( double aChamferScale );
579 double GetChamferRectRatio() const { return m_chamferScale; }
580
588 void SetChamferPositions( int aPositions ) { m_chamferPositions = aPositions; }
590
594 int GetSubRatsnest() const { return m_subRatsnest; }
595 void SetSubRatsnest( int aSubRatsnest ) { m_subRatsnest = aSubRatsnest; }
596
603 void SetRemoveUnconnected( bool aSet ) { m_removeUnconnectedLayer = aSet; }
605
609 void SetKeepTopBottom( bool aSet ) { m_keepTopBottomLayer = aSet; }
610 bool GetKeepTopBottom() const { return m_keepTopBottomLayer; }
611
613 {
615 return false;
616
617 if( m_keepTopBottomLayer && ( aLayer == F_Cu || aLayer == B_Cu ) )
618 return false;
619
620 return true;
621 }
622
623 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
624
625 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override
626 {
627 return m_layerMask[aLayer];
628 }
629
636 bool FlashLayer( int aLayer ) const;
637
638 PCB_LAYER_ID GetLayer() const override;
639
644
652 bool FlashLayer( LSET aLayers ) const;
653
654 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
655 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
656
657 wxString GetClass() const override
658 {
659 return wxT( "PAD" );
660 }
661
665 const BOX2I GetBoundingBox() const override;
666
668 void SetDrawCoord();
669
670 //todo: Remove SetLocalCoord along with m_pos
672 void SetLocalCoord();
673
680 static int Compare( const PAD* aPadRef, const PAD* aPadCmp );
681
682 void Move( const VECTOR2I& aMoveVector ) override
683 {
684 m_pos += aMoveVector;
686 SetDirty();
687 }
688
689 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
690
691 wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
692
693 BITMAPS GetMenuImage() const override;
694
698 wxString ShowPadShape() const;
699
703 wxString ShowPadAttr() const;
704
705 EDA_ITEM* Clone() const override;
706
712 PAD* ClonePad() const
713 {
714 return (PAD*) Clone();
715 }
716
721 void BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const;
722 void BuildEffectivePolygon() const;
723
724 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
725
726 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
727
728 virtual const BOX2I ViewBBox() const override;
729
731 {
732 for( size_t ii = 0; ii < arrayDim( m_zoneLayerConnections ); ++ii )
734 }
735
737 {
738 return m_zoneLayerConnections[ aLayer ];
739 }
740
741#if defined(DEBUG)
742 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
743#endif
744
745protected:
746 virtual void swapData( BOARD_ITEM* aImage ) override;
747
748private:
749 void addPadPrimitivesToPolygon( SHAPE_POLY_SET* aMergedPolygon, int aError,
750 ERROR_LOC aErrorLoc ) const;
751
752private:
753 wxString m_number; // Pad name (pin number in schematic)
754 wxString m_pinFunction; // Pin name in schematic
755 wxString m_pinType; // Pin electrical type in schematic
756
757 VECTOR2I m_pos; // Pad Position on board
758
759 PAD_SHAPE m_padShape; // Shape: PAD_SHAPE::CIRCLE, PAD_SHAPE::RECT,
760 // PAD_SHAPE::OVAL, PAD_SHAPE::TRAPEZOID,
761 // PAD_SHAPE::ROUNDRECT, PAD_SHAPE_POLYGON
762 /*
763 * Editing definitions of primitives for custom pad shapes. In local coordinates relative
764 * to m_Pos (NOT shapePos) at orient 0.
765 */
766 std::vector<std::shared_ptr<PCB_SHAPE>> m_editPrimitives;
767
768 // Must be set to true to force rebuild shapes to draw (after geometry change for instance)
769 mutable bool m_shapesDirty;
770 mutable std::mutex m_shapesBuildingLock;
772 mutable std::shared_ptr<SHAPE_COMPOUND> m_effectiveShape;
773 mutable std::shared_ptr<SHAPE_SEGMENT> m_effectiveHoleShape;
774
775 mutable bool m_polyDirty;
776 mutable std::mutex m_polyBuildingLock;
777 mutable std::shared_ptr<SHAPE_POLY_SET> m_effectivePolygon;
779
780 /*
781 * How to build the custom shape in zone, to create the clearance area:
782 * CUST_PAD_SHAPE_IN_ZONE_OUTLINE = use pad shape
783 * CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL = use the convex hull of the pad shape
784 */
786
787 int m_subRatsnest; // Variable used to handle subnet (block) number in
788 // ratsnest computations
789
790 VECTOR2I m_drill; // Drill diameter (x == y) or slot dimensions (x != y)
791 VECTOR2I m_size; // X and Y size (relative to orient 0)
792
793 PAD_DRILL_SHAPE_T m_drillShape; // PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG
794
795 double m_roundedCornerScale; // Scaling factor of min(width, height) to corner
796 // radius, default 0.25
797 double m_chamferScale; // Scaling factor of min(width, height) to chamfer
798 // size, default 0.25
799 int m_chamferPositions; // The positions of the chamfers (at orient 0)
800
801 PAD_SHAPE m_anchorPadShape; // For custom shaped pads: shape of pad anchor,
802 // PAD_SHAPE::RECT, PAD_SHAPE::CIRCLE
803
804 /*
805 * Most of the time the hole is the center of the shape (m_Offset = 0). But some designers
806 * use oblong/rect pads with a hole moved to one of the oblong/rect pad shape ends.
807 * In all cases the hole is at the pad position. This offset is from the hole to the center
808 * of the pad shape (ie: the copper area around the hole).
809 * ShapePos() returns the board shape position according to the offset and the pad rotation.
810 */
812
813 LSET m_layerMask; // Bitwise layer: 1 = copper layer, 15 = cmp,
814 // 2..14 = internal layers, 16..31 = technical layers
815
816 VECTOR2I m_deltaSize; // Delta for PAD_SHAPE::TRAPEZOID; half the delta squeezes
817 // one end and half expands the other. It is only valid
818 // to have a single axis be non-0.
819
820 VECTOR2I m_pos0; // Initial Pad position (i.e. pad position relative to the
821 // footprint anchor, orientation 0)
822
823 PAD_ATTRIB m_attribute; // PAD_ATTRIB_NORMAL, PAD_ATTRIB::SMD, PAD_ATTRIB::CONN,
824 // PAD_ATTRIB::NPTH
825 PAD_PROP m_property; // Property in fab files (BGA, FIDUCIAL, TESTPOINT, etc.)
826
828
829 int m_lengthPadToDie; // Length net from pad to die, inside the package
830
833
836
837 /*
838 * Pad clearances, margins, etc. exist in a hierarchy. If a given level is specified then
839 * the remaining levels are NOT consulted.
840 *
841 * LEVEL 1: (highest priority) local overrides (pad, footprint, etc.)
842 * LEVEL 2: Rules
843 * LEVEL 3: Accumulated local settings, netclass settings, & board design settings
844 *
845 * These are the LEVEL 1 settings for a pad.
846 */
848 int m_localSolderMaskMargin; // Local solder mask margin
849 int m_localSolderPasteMargin; // Local solder paste margin absolute value
850 double m_localSolderPasteMarginRatio; // Local solder mask margin ratio of pad size
851 // The final margin is the sum of these 2 values
852
853 ZONE_CONNECTION m_zoneConnection; // No connection, thermal relief, etc.
854 int m_thermalSpokeWidth; // Thermal spoke width.
855 EDA_ANGLE m_thermalSpokeAngle; // Rotation of the spokes. 45° will produce an X,
856 // while 90° will produce a +.
858
860};
861
862#endif // PAD_H
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
ZONE_LAYER_CONNECTION
Definition: board_item.h:45
@ ZLC_UNRESOLVED
Definition: board_item.h:46
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58
BOARD_ITEM_CONTAINER * GetParentFootprint() const
Definition: board_item.cpp:239
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:49
double AsDegrees() const
Definition: eda_angle.h:149
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:183
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:81
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:773
Definition: pad.h:59
PAD_DRILL_SHAPE_T m_drillShape
Definition: pad.h:793
bool IsAperturePad() const
Definition: pad.h:402
void SetAttribute(PAD_ATTRIB aAttribute)
Definition: pad.cpp:662
int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const override
Return an item's "own" clearance in internal units.
Definition: pad.cpp:795
void SetLayerSet(LSET aLayers) override
Definition: pad.h:391
int m_localClearance
Definition: pad.h:847
PAD(FOOTPRINT *parent)
Definition: pad.cpp:62
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pad.cpp:1548
PAD_PROP GetProperty() const
Definition: pad.h:398
bool GetRemoveUnconnected() const
Definition: pad.h:604
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:378
void AddPrimitiveArc(const VECTOR2I &aCenter, const VECTOR2I &aStart, const EDA_ANGLE &aArcAngle, int aThickness)
void SetPinType(const wxString &aType)
Set the pad electrical type.
Definition: pad.h:151
int m_localSolderMaskMargin
Definition: pad.h:848
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:392
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: pad.h:785
int GetSizeX() const
Definition: pad.h:254
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.
VECTOR2I m_size
Definition: pad.h:791
bool IsDirty() const
Definition: pad.h:380
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:943
double m_localSolderPasteMarginRatio
Definition: pad.h:850
const BOX2I GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
Definition: pad.cpp:622
VECTOR2I m_drill
Definition: pad.h:790
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pad.h:625
int GetSolderMaskExpansion() const
Definition: pad.cpp:821
int m_chamferPositions
Definition: pad.h:799
VECTOR2I m_offset
Definition: pad.h:811
int GetDrillSizeY() const
Definition: pad.h:266
const wxString & GetPinType() const
Definition: pad.h:152
const VECTOR2I & GetDrillSize() const
Definition: pad.h:262
PAD_ATTRIB GetAttribute() const
Definition: pad.h:395
void SetLocalSolderPasteMargin(int aMargin)
Definition: pad.h:418
static LSET PTHMask()
layer set for a through hole pad
Definition: pad.cpp:179
static int Compare(const PAD *aPadRef, const PAD *aPadCmp)
Compare two pads and return 0 if they are equal.
Definition: pad.cpp:1111
VECTOR2I m_deltaSize
Definition: pad.h:816
ZONE_CONNECTION GetZoneConnection() const
Definition: pad.h:517
void SetRemoveUnconnected(bool aSet)
Set the unconnected removal property.
Definition: pad.h:603
const wxString & GetPinFunction() const
Definition: pad.h:146
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:412
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
Definition: pad.cpp:1573
std::mutex m_shapesBuildingLock
Definition: pad.h:770
void SetThermalGap(int aGap)
Definition: pad.h:548
bool CanHaveNumber() const
Indicates whether or not the pad can have a number.
Definition: pad.cpp:142
void AddPrimitiveAnnotationBox(const VECTOR2I &aStart, const VECTOR2I &aEnd)
Has meaning only for custom shape pads.
void SetX0(int x)
Definition: pad.h:249
void SetThermalSpokeAngle(const EDA_ANGLE &aAngle)
The orientation of the thermal spokes.
Definition: pad.h:535
wxString m_pinType
Definition: pad.h:755
double m_roundedCornerScale
Definition: pad.h:795
const wxString & GetNumber() const
Definition: pad.h:135
EDA_ANGLE m_orient
Definition: pad.h:827
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:748
void MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Merge all basic shapes to a SHAPE_POLY_SET.
double GetLocalSolderPasteMarginRatio() const
Definition: pad.h:420
int GetRoundRectCornerRadius() const
Definition: pad.cpp:317
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pad.h:80
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:766
PAD & operator=(const PAD &aOther)
Definition: pad.cpp:122
void DeletePrimitivesList()
Clear the basic shapes list.
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: pad.h:773
bool IsLocked() const override
Definition: pad.cpp:156
bool TransformHoleToPolygon(SHAPE_POLY_SET &aBuffer, int aClearance, int aError, ERROR_LOC aErrorLoc) const
Build the corner list of the polygonal drill shape in the board coordinate system.
Definition: pad.cpp:1556
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pad.h:271
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
Definition: pad.h:377
VECTOR2I GetPosition() const override
Definition: pad.h:197
void SetProperty(PAD_PROP aProperty)
Definition: pad.cpp:673
void SetThermalSpokeAngleDegrees(double aAngle)
Definition: pad.h:539
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives() const
Accessor to the basic shape list for custom-shaped pads.
Definition: pad.h:325
EDA_ANGLE GetThermalSpokeAngle() const
Definition: pad.h:536
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition: pad.h:612
void SetOffset(const VECTOR2I &aOffset)
Definition: pad.h:268
PAD_ATTRIB m_attribute
Definition: pad.h:823
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pad.h:682
PCB_LAYER_ID GetPrincipalLayer() const
Definition: pad.cpp:228
void SetY0(int y)
Definition: pad.h:248
void SetChamferRectRatio(double aChamferScale)
Has meaning only for chamfered rectangular pads.
Definition: pad.cpp:340
void SetDirty()
Definition: pad.h:385
const VECTOR2I & GetOffset() const
Definition: pad.h:269
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition: pad.cpp:200
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pad.cpp:1282
double GetOrientationDegrees() const
Definition: pad.h:372
void AddPrimitiveSegment(const VECTOR2I &aStart, const VECTOR2I &aEnd, int aThickness)
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pad.cpp:1187
void SetRoundRectCornerRadius(double aRadius)
Has meaning only for rounded rectangle pads.
Definition: pad.cpp:323
ZONE_LAYER_CONNECTION m_zoneLayerConnections[B_Cu+1]
Definition: pad.h:859
bool IsNoConnectPad() const
Definition: pad.cpp:165
int GetDrillSizeX() const
Definition: pad.h:264
void SetLocalClearance(int aClearance)
Definition: pad.h:415
PAD_PROP m_property
Definition: pad.h:825
void SetKeepTopBottom(bool aSet)
Set whether we keep the top and bottom connections even if they are not connected.
Definition: pad.h:609
VECTOR2I ShapePos() const
Definition: pad.cpp:757
int m_localSolderPasteMargin
Definition: pad.h:849
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
Definition: pad.h:134
int GetLocalThermalGapOverride(wxString *aSource=nullptr) const
Definition: pad.cpp:934
wxString ShowPadAttr() const
Definition: pad.cpp:1216
wxString m_pinFunction
Definition: pad.h:754
void AddPrimitiveCurve(const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCtrl1, const VECTOR2I &aCtrl2, int aThickness)
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: pad.h:516
wxString ShowPadShape() const
Definition: pad.cpp:1200
int m_effectiveBoundingRadius
Definition: pad.h:778
int GetLocalSolderMaskMargin() const
Definition: pad.h:410
LSET m_layerMask
Definition: pad.h:813
bool GetKeepTopBottom() const
Definition: pad.h:610
int m_thermalGap
Definition: pad.h:857
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:158
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: pad.h:207
void ImportSettingsFrom(const PAD &aMasterPad)
Import the pad settings from aMasterPad.
Definition: pad.cpp:1464
FOOTPRINT * GetParent() const
Definition: pad.cpp:1458
ZONE_CONNECTION m_zoneConnection
Definition: pad.h:853
void SetDelta(const VECTOR2I &aSize)
Definition: pad.h:258
void SetLocalCoord()
< Set relative coordinates.
Definition: pad.cpp:647
bool IsOnCopperLayer() const override
Definition: pad.h:237
void SetDrillSizeX(const int aX)
Definition: pad.h:263
void SetPosition(const VECTOR2I &aPos) override
Definition: pad.h:191
int m_thermalSpokeWidth
Definition: pad.h:854
VECTOR2I m_pos
Definition: pad.h:757
const VECTOR2I & GetDelta() const
Definition: pad.h:259
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition: pad.cpp:193
void SetDrillSize(const VECTOR2I &aSize)
Definition: pad.h:261
bool IsFreePad() const
Definition: pad.cpp:172
int GetLocalClearance() const
Definition: pad.h:414
wxString GetClass() const override
Return the class name.
Definition: pad.h:657
PAD_SHAPE GetShape() const
Definition: pad.h:189
int m_subRatsnest
Definition: pad.h:787
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
Definition: pad.h:365
ZONE_LAYER_CONNECTION & ZoneConnectionCache(PCB_LAYER_ID aLayer) const
Definition: pad.h:736
void Flip(const VECTOR2I &VECTOR2I, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pad.cpp:690
void SetY(int y)
Definition: pad.h:242
bool FlashLayer(int aLayer) const
Check to see whether the pad should be flashed on the specific layer.
Definition: pad.cpp:250
VECTOR2I GetSolderPasteMargin() const
Usually < 0 (mask shape smaller than pad)because the margin can be dependent on the pad size,...
Definition: pad.cpp:866
static LSET ApertureMask()
layer set for an aperture pad
Definition: pad.cpp:207
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pad.cpp:1434
bool m_shapesDirty
Definition: pad.h:769
std::mutex m_polyBuildingLock
Definition: pad.h:776
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: pad.cpp:186
bool GetBestAnchorPosition(VECTOR2I &aPos)
void SetX(int x)
Definition: pad.h:243
double m_chamferScale
Definition: pad.h:797
void ClearZoneConnectionCache()
Definition: pad.h:730
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon() const
Definition: pad.cpp:348
int GetLocalClearanceOverrides(wxString *aSource) const override
Return any local clearance overrides set in the "classic" (ie: pre-rule) system.
Definition: pad.cpp:772
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: pad.h:421
void SetShape(PAD_SHAPE aShape)
Set the new shape of this pad.
Definition: pad.h:180
int GetSizeY() const
Definition: pad.h:256
void AddPrimitiveCircle(const VECTOR2I &aCenter, int aRadius, int aThickness, bool aFilled)
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pad.cpp:222
wxString GetParentAsString() const
Definition: pad.cpp:1676
int GetThermalSpokeWidth() const
Definition: pad.h:526
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition: pad.h:145
int GetLocalSolderPasteMargin() const
Definition: pad.h:417
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: pad.cpp:1057
void BuildEffectivePolygon() const
Definition: pad.cpp:584
PAD_SHAPE m_padShape
Definition: pad.h:759
void SetPos0(const VECTOR2I &aPos)
Definition: pad.h:245
int GetBoundingRadius() const
Return the radius of a minimum sized circle which fully encloses this pad.
Definition: pad.cpp:403
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:217
void SetRoundRectRadiusRatio(double aRadiusScale)
Has meaning only for rounded rectangle pads.
Definition: pad.cpp:332
void SetAnchorPadShape(PAD_SHAPE aShape)
Set the shape of the anchor pad for custom shaped pads.
Definition: pad.h:228
void AddPrimitive(PCB_SHAPE *aPrimitive)
Add item to the custom shape primitives list.
void SetOrientation(const EDA_ANGLE &aAngle)
Set the rotation angle of the pad.
Definition: pad.cpp:681
void AddPrimitivePoly(const SHAPE_POLY_SET &aPoly, int aThickness, bool aFilled)
Has meaning only for custom shape pads.
void SetDrawCoord()
Definition: pad.cpp:631
ZONE_CONNECTION GetLocalZoneConnectionOverride(wxString *aSource=nullptr) const
Definition: pad.cpp:916
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pad.cpp:1276
int GetChamferPositions() const
Definition: pad.h:589
void AddPrimitiveRect(const VECTOR2I &aStart, const VECTOR2I &aEnd, int aThickness, bool aFilled)
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:1288
void ReplacePrimitives(const std::vector< std::shared_ptr< PCB_SHAPE > > &aPrimitivesList)
Clear the current custom shape primitives list and import a new list.
wxString m_number
Definition: pad.h:753
bool m_removeUnconnectedLayer
< If true, the pad copper is removed for layers that are not connected.
Definition: pad.h:832
void SetLocalSolderMaskMargin(int aMargin)
Definition: pad.h:411
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING flashPTHPads=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: pad.cpp:357
void addPadPrimitivesToPolygon(SHAPE_POLY_SET *aMergedPolygon, int aError, ERROR_LOC aErrorLoc) const
int GetSubRatsnest() const
Definition: pad.h:594
void SetSizeX(const int aX)
Definition: pad.h:253
bool m_keepTopBottomLayer
Definition: pad.h:835
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: pad.cpp:1229
int m_lengthPadToDie
Definition: pad.h:829
void SetThermalSpokeWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition: pad.h:525
bool HasHole() const override
Definition: pad.h:106
void SetSize(const VECTOR2I &aSize)
Definition: pad.h:251
void SetDrillSizeY(const int aY)
Definition: pad.h:265
double GetThermalSpokeAngleDegrees() const
Definition: pad.h:543
PAD * ClonePad() const
Same as Clone, but returns a PAD item.
Definition: pad.h:712
double GetRoundRectRadiusRatio() const
Definition: pad.h:570
int GetThermalGap() const
Definition: pad.h:549
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Return a SHAPE_SEGMENT object representing the pad's hole.
Definition: pad.cpp:394
void SetOrientationDegrees(double aOrientation)
Definition: pad.h:368
const VECTOR2I & GetPos0() const
Definition: pad.h:246
const VECTOR2I & GetSize() const
Definition: pad.h:252
VECTOR2I m_pos0
Definition: pad.h:820
PAD_SHAPE m_anchorPadShape
Definition: pad.h:801
EDA_ANGLE m_thermalSpokeAngle
Definition: pad.h:855
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pad.cpp:1365
bool m_polyDirty
Definition: pad.h:775
void SetSubRatsnest(int aSubRatsnest)
Definition: pad.h:595
std::shared_ptr< SHAPE_COMPOUND > m_effectiveShape
Definition: pad.h:772
void SetChamferPositions(int aPositions)
Has meaning only for chamfered rectangular pads.
Definition: pad.h:588
int GetLocalSpokeWidthOverride(wxString *aSource=nullptr) const
Definition: pad.cpp:925
PAD_SHAPE GetAnchorPadShape() const
Definition: pad.h:202
double GetChamferRectRatio() const
Definition: pad.h:579
void SetPadToDieLength(int aLength)
Definition: pad.h:407
bool IsFlipped() const
Definition: pad.cpp:214
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: pad.h:85
void SetSizeY(const int aY)
Definition: pad.h:255
int GetPadToDieLength() const
Definition: pad.h:408
BOX2I m_effectiveBoundingBox
Definition: pad.h:771
std::shared_ptr< SHAPE_POLY_SET > m_effectivePolygon
Definition: pad.h:777
A base class which establishes the interface functions ReadParam and SaveParam, which are implemented...
Definition: config_params.h:82
Represent a set of closed polygons.
An abstract shape on 2D plane.
Definition: shape.h:123
@ DEGREES_T
Definition: eda_angle.h:31
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
@ ERROR_INSIDE
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition: layer_ids.h:147
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ B_Cu
Definition: layer_ids.h:95
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
@ F_Cu
Definition: layer_ids.h:64
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:266
CUST_PAD_SHAPE_IN_ZONE
Definition: pad.h:43
@ CUST_PAD_SHAPE_IN_ZONE_OUTLINE
Definition: pad.h:44
@ CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL
Definition: pad.h:45
PAD_ATTRIB
The set of pad shapes, used with PAD::{Set,Get}Attribute().
Definition: pad_shapes.h:81
@ NPTH
like PAD_PTH, but not plated
PAD_DRILL_SHAPE_T
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
Definition: pad_shapes.h:69
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
Definition: pad_shapes.h:35
PAD_PROP
The set of pad properties used in Gerber files (Draw files, and P&P files) to define some properties ...
Definition: pad_shapes.h:97
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ PCB_LOCATE_NPTH_T
Definition: typeinfo.h:127
@ PCB_LOCATE_PTH_T
Definition: typeinfo.h:126
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ PCB_LOCATE_HOLE_T
Definition: typeinfo.h:125
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:50