KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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#pragma once
26
27#include <mutex>
28#include <array>
29#include <optional>
30
32#include <core/arraydim.h>
33#include <core/mirror.h>
34#include <geometry/eda_angle.h>
37#include <lset.h>
38#include <padstack.h>
39#include <zones.h>
40
41class PCB_SHAPE;
42class SHAPE;
43class SHAPE_SEGMENT;
44
45class LINE_READER;
46class EDA_3D_CANVAS;
47class FOOTPRINT;
48
49namespace KIGFX
50{
51 class VIEW;
52}
53
55{
56public:
57 PAD( FOOTPRINT* parent );
58
59 // Copy constructor & operator= are needed because the list of basic shapes
60 // must be duplicated in copy.
61 PAD( const PAD& aPad );
62 PAD& operator=( const PAD &aOther );
63
64 void CopyFrom( const BOARD_ITEM* aOther ) override;
65
66 void Serialize( google::protobuf::Any &aContainer ) const override;
67 bool Deserialize( const google::protobuf::Any &aContainer ) override;
68
69 /*
70 * Default layers used for pads, according to the pad type.
71 *
72 * This is default values only, they can be changed for a given pad.
73 */
74 static LSET PTHMask();
75 static LSET SMDMask();
76 static LSET ConnSMDMask();
78 static LSET UnplatedHoleMask();
79 static LSET ApertureMask();
80
81 static inline bool ClassOf( const EDA_ITEM* aItem )
82 {
83 return aItem && PCB_PAD_T == aItem->Type();
84 }
85
86 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
87 {
88 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
89 return true;
90
91 for( KICAD_T scanType : aScanTypes )
92 {
93 if( HasHole() )
94 {
95 if( scanType == PCB_LOCATE_HOLE_T )
96 return true;
97 else if( scanType == PCB_LOCATE_PTH_T && m_attribute != PAD_ATTRIB::NPTH )
98 return true;
99 else if( scanType == PCB_LOCATE_NPTH_T && m_attribute == PAD_ATTRIB::NPTH )
100 return true;
101 }
102 }
103
104 return false;
105 }
106
107 bool HasHole() const override
108 {
109 return GetDrillSizeX() > 0 && GetDrillSizeY() > 0;
110 }
111
112 bool HasDrilledHole() const override
113 {
114 return HasHole() && GetDrillSizeX() == GetDrillSizeY();
115 }
116
117 bool IsLocked() const override;
118
126 void ImportSettingsFrom( const PAD& aMasterPad );
127
131 bool IsFlipped() const;
132
136 void SetNumber( const wxString& aNumber ) { m_number = aNumber; }
137 const wxString& GetNumber() const { return m_number; }
138
142 bool CanHaveNumber() const;
143
147 void SetPinFunction( const wxString& aName ) { m_pinFunction = aName; }
148 const wxString& GetPinFunction() const { return m_pinFunction; }
149
153 void SetPinType( const wxString& aType ) { m_pinType = aType; }
154 const wxString& GetPinType() const { return m_pinType; }
155
160 bool SameLogicalPadAs( const PAD* aOther ) const
161 {
162 // hide tricks behind sensible API
163 return GetParentFootprint() == aOther->GetParentFootprint()
164 && !m_number.IsEmpty() && m_number == aOther->m_number;
165 }
166
170 bool SharesNetTieGroup( const PAD* aOther ) const;
171
176 bool IsNoConnectPad() const;
177
182 bool IsFreePad() const;
183
187 void SetShape( PCB_LAYER_ID aLayer, PAD_SHAPE aShape )
188 {
189 m_padStack.SetShape( aShape, aLayer );
190 SetDirty();
191 }
192
196 PAD_SHAPE GetShape( PCB_LAYER_ID aLayer ) const { return m_padStack.Shape( aLayer ); }
197
198 // Used for the properties panel, which does not support padstacks at the moment
199 void SetFrontShape( PAD_SHAPE aShape );
200
201 PAD_SHAPE GetFrontShape() const { return m_padStack.Shape( F_Cu ); }
202
203 void SetPosition( const VECTOR2I& aPos ) override
204 {
205 m_pos = aPos;
206 SetDirty();
207 }
208
209 VECTOR2I GetPosition() const override { return m_pos; }
210
215 {
216 return m_padStack.AnchorShape( aLayer );
217 }
218
223 {
224 return m_padStack.CustomShapeInZoneMode();
225 }
226
233 {
234 m_padStack.SetCustomShapeInZoneMode( aOption );
235 }
236
244 {
245 m_padStack.SetAnchorShape( aShape == PAD_SHAPE::RECTANGLE ? PAD_SHAPE::RECTANGLE
247 aLayer );
248 SetDirty();
249 }
250
254 bool IsOnCopperLayer() const override;
255
256 void SetY( int y ) { m_pos.y = y; SetDirty(); }
257 void SetX( int x ) { m_pos.x = x; SetDirty(); }
258
259 void SetSize( PCB_LAYER_ID aLayer, const VECTOR2I& aSize )
260 {
261 m_padStack.SetSize( aSize, aLayer );
262 SetDirty();
263 }
264 const VECTOR2I& GetSize( PCB_LAYER_ID aLayer ) const { return m_padStack.Size( aLayer ); }
265
266 // These accessors are for the properties panel, which does not have the ability to deal with
267 // custom padstacks where the properties can vary by layer. The properties should be disabled
268 // in the GUI when the padstack mode is set to anything other than NORMAL, but so that the code
269 // compiles, these are set up to work with the front layer (in other words, assume the mode is
270 // NORMAL, where F_Cu stores the whole padstack data)
271 void SetSizeX( const int aX )
272 {
273 if( aX > 0 )
274 {
276 SetDirty();
277 }
278 }
279
280 int GetSizeX() const { return m_padStack.Size( PADSTACK::ALL_LAYERS ).x; }
281
282 void SetSizeY( const int aY )
283 {
284 if( aY > 0 )
285 {
287 SetDirty();
288 }
289 }
290
291 int GetSizeY() const { return m_padStack.Size( PADSTACK::ALL_LAYERS ).y; }
292
293 void SetDelta( PCB_LAYER_ID aLayer, const VECTOR2I& aSize )
294 {
295 m_padStack.TrapezoidDeltaSize( aLayer ) = aSize;
296 SetDirty();
297 }
298
299 const VECTOR2I& GetDelta( PCB_LAYER_ID aLayer ) const
300 {
301 return m_padStack.TrapezoidDeltaSize( aLayer );
302 }
303
304 void SetPrimaryDrillSize( const VECTOR2I& aSize );
305 const VECTOR2I& GetPrimaryDrillSize() const { return m_padStack.Drill().size; }
306 void SetPrimaryDrillSizeX( int aX );
307 int GetPrimaryDrillSizeX() const { return m_padStack.Drill().size.x; }
308 void SetPrimaryDrillSizeY( int aY );
309 int GetPrimaryDrillSizeY() const { return m_padStack.Drill().size.y; }
310
311 void SetDrillSize( const VECTOR2I& aSize ) { SetPrimaryDrillSize( aSize ); }
312 const VECTOR2I& GetDrillSize() const { return GetPrimaryDrillSize(); }
313 void SetDrillSizeX( int aX );
314 int GetDrillSizeX() const { return GetPrimaryDrillSizeX(); }
315 void SetDrillSizeY( int aY );
316 int GetDrillSizeY() const { return GetPrimaryDrillSizeY(); }
317
318 void SetOffset( PCB_LAYER_ID aLayer, const VECTOR2I& aOffset )
319 {
320 m_padStack.Offset( aLayer ) = aOffset;
321 SetDirty();
322 }
323
324 const VECTOR2I& GetOffset( PCB_LAYER_ID aLayer ) const { return m_padStack.Offset( aLayer ); }
325
326 VECTOR2I GetCenter() const override { return GetPosition(); }
327
328 const PADSTACK& Padstack() const { return m_padStack; }
330 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
331
343 void AddPrimitivePoly( PCB_LAYER_ID aLayer, const SHAPE_POLY_SET& aPoly, int aThickness,
344 bool aFilled );
345 void AddPrimitivePoly( PCB_LAYER_ID aLayer, const std::vector<VECTOR2I>& aPoly, int aThickness,
346 bool aFilled );
347
360 void MergePrimitivesAsPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET* aMergedPolygon,
361 ERROR_LOC aErrorLoc = ERROR_INSIDE ) const;
362
368
372 const std::vector<std::shared_ptr<PCB_SHAPE>>& GetPrimitives( PCB_LAYER_ID aLayer ) const
373 {
374 return m_padStack.Primitives( aLayer );
375 }
376
377 void Flip( const VECTOR2I& VECTOR2I, FLIP_DIRECTION aFlipDirection ) override;
378
383 void FlipPrimitives( FLIP_DIRECTION aFlipDirection );
384
389 void ReplacePrimitives( PCB_LAYER_ID aLayer,
390 const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
391
396 void AppendPrimitives( PCB_LAYER_ID aLayer,
397 const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
398
402 void AddPrimitive( PCB_LAYER_ID aLayer, PCB_SHAPE* aPrimitive );
403
409 void SetOrientation( const EDA_ANGLE& aAngle );
410 void SetFPRelativeOrientation( const EDA_ANGLE& aAngle );
411
415 EDA_ANGLE GetOrientation() const { return m_padStack.GetOrientation(); }
417
418 // For property system
419 void SetOrientationDegrees( double aOrientation )
420 {
421 SetOrientation( EDA_ANGLE( aOrientation, DEGREES_T ) );
422 }
424 {
425 return m_padStack.GetOrientation().AsDegrees();
426 }
427
429 PAD_DRILL_SHAPE GetPrimaryDrillShape() const { return m_padStack.Drill().shape; }
430
433
435 PCB_LAYER_ID GetPrimaryDrillStartLayer() const { return m_padStack.Drill().start; }
437 PCB_LAYER_ID GetPrimaryDrillEndLayer() const { return m_padStack.Drill().end; }
438
439 void SetFrontPostMachining( const std::optional<PAD_DRILL_POST_MACHINING_MODE>& aMode ) { m_padStack.FrontPostMachining().mode = aMode; }
440 std::optional<PAD_DRILL_POST_MACHINING_MODE> GetFrontPostMachining() const { return m_padStack.FrontPostMachining().mode; }
441
443 {
444 m_padStack.FrontPostMachining().mode = aMode;
445 }
446
451
452 void SetFrontPostMachiningSize( int aSize ) { m_padStack.FrontPostMachining().size = aSize; }
453 int GetFrontPostMachiningSize() const { return m_padStack.FrontPostMachining().size; }
454 void SetFrontPostMachiningDepth( int aDepth ) { m_padStack.FrontPostMachining().depth = aDepth; }
455 int GetFrontPostMachiningDepth() const { return m_padStack.FrontPostMachining().depth; }
456 void SetFrontPostMachiningAngle( int aAngle ) { m_padStack.FrontPostMachining().angle = aAngle; }
457 int GetFrontPostMachiningAngle() const { return m_padStack.FrontPostMachining().angle; }
458
459 void SetBackPostMachining( const std::optional<PAD_DRILL_POST_MACHINING_MODE>& aMode ) { m_padStack.BackPostMachining().mode = aMode; }
460 std::optional<PAD_DRILL_POST_MACHINING_MODE> GetBackPostMachining() const { return m_padStack.BackPostMachining().mode; }
461
463 {
464 m_padStack.BackPostMachining().mode = aMode;
465 }
466
471
472 void SetBackPostMachiningSize( int aSize ) { m_padStack.BackPostMachining().size = aSize; }
473 int GetBackPostMachiningSize() const { return m_padStack.BackPostMachining().size; }
474 void SetBackPostMachiningDepth( int aDepth ) { m_padStack.BackPostMachining().depth = aDepth; }
475 int GetBackPostMachiningDepth() const { return m_padStack.BackPostMachining().depth; }
476 void SetBackPostMachiningAngle( int aAngle ) { m_padStack.BackPostMachining().angle = aAngle; }
477 int GetBackPostMachiningAngle() const { return m_padStack.BackPostMachining().angle; }
478
488 bool IsBackdrilledOrPostMachined( PCB_LAYER_ID aLayer ) const;
489
496 int GetPostMachiningKnockout( PCB_LAYER_ID aLayer ) const;
497
498 void SetPrimaryDrillFilled( const std::optional<bool>& aFilled );
499 void SetPrimaryDrillFilledFlag( bool aFilled );
500 std::optional<bool> GetPrimaryDrillFilled() const { return m_padStack.Drill().is_filled; }
501 bool GetPrimaryDrillFilledFlag() const { return m_padStack.Drill().is_filled.value_or( false ); }
502
503 void SetPrimaryDrillCapped( const std::optional<bool>& aCapped );
504 void SetPrimaryDrillCappedFlag( bool aCapped );
505 std::optional<bool> GetPrimaryDrillCapped() const { return m_padStack.Drill().is_capped; }
506 bool GetPrimaryDrillCappedFlag() const { return m_padStack.Drill().is_capped.value_or( false ); }
507
508 void SetSecondaryDrillSize( const VECTOR2I& aSize );
509 const VECTOR2I& GetSecondaryDrillSize() const { return m_padStack.SecondaryDrill().size; }
511
512 void SetSecondaryDrillSizeX( int aX );
513 int GetSecondaryDrillSizeX() const { return m_padStack.SecondaryDrill().size.x; }
514 void SetSecondaryDrillSizeY( int aY );
515 int GetSecondaryDrillSizeY() const { return m_padStack.SecondaryDrill().size.y; }
516
518 PAD_DRILL_SHAPE GetSecondaryDrillShape() const { return m_padStack.SecondaryDrill().shape; }
519
521 PCB_LAYER_ID GetSecondaryDrillStartLayer() const { return m_padStack.SecondaryDrill().start; }
523 PCB_LAYER_ID GetSecondaryDrillEndLayer() const { return m_padStack.SecondaryDrill().end; }
524
525 void SetTertiaryDrillSize( const VECTOR2I& aSize );
526 const VECTOR2I& GetTertiaryDrillSize() const { return m_padStack.TertiaryDrill().size; }
528
529 void SetTertiaryDrillSizeX( int aX );
530 int GetTertiaryDrillSizeX() const { return m_padStack.TertiaryDrill().size.x; }
531 void SetTertiaryDrillSizeY( int aY );
532 int GetTertiaryDrillSizeY() const { return m_padStack.TertiaryDrill().size.y; }
533
535 PAD_DRILL_SHAPE GetTertiaryDrillShape() const { return m_padStack.TertiaryDrill().shape; }
536
538 PCB_LAYER_ID GetTertiaryDrillStartLayer() const { return m_padStack.TertiaryDrill().start; }
540 PCB_LAYER_ID GetTertiaryDrillEndLayer() const { return m_padStack.TertiaryDrill().end; }
541
542 bool IsDirty() const
543 {
545 }
546
547 void SetDirty()
548 {
549 m_shapesDirty = true;
552 }
553
554 void SetLayerSet( const LSET& aLayers ) override { m_padStack.SetLayerSet( aLayers ); SetDirty(); }
555 LSET GetLayerSet() const override { return m_padStack.LayerSet(); }
556
557 void SetAttribute( PAD_ATTRIB aAttribute );
559
560 void SetProperty( PAD_PROP aProperty );
561 PAD_PROP GetProperty() const { return m_property; }
562
563 // We don't currently have an attribute for APERTURE, and adding one will change the file
564 // format, so for now just infer a copper-less pad to be an APERTURE pad.
565 bool IsAperturePad() const
566 {
567 return ( m_padStack.LayerSet() & LSET::AllCuMask() ).none();
568 }
569
570 void SetPadToDieLength( int aLength ) { m_lengthPadToDie = aLength; }
571 int GetPadToDieLength() const { return m_lengthPadToDie; }
572
573 void SetPadToDieDelay( int aDelay ) { m_delayPadToDie = aDelay; }
574 int GetPadToDieDelay() const { return m_delayPadToDie; }
575
576 std::optional<int> GetLocalClearance() const override { return m_padStack.Clearance(); }
577 void SetLocalClearance( std::optional<int> aClearance ) { m_padStack.Clearance() = aClearance; }
578
579 std::optional<int> GetLocalSolderMaskMargin() const { return m_padStack.SolderMaskMargin(); }
580 void SetLocalSolderMaskMargin( std::optional<int> aMargin )
581 {
582 m_padStack.SolderMaskMargin( F_Mask ) = aMargin;
583 m_padStack.SolderMaskMargin( B_Mask ) = aMargin;
584 }
585
586 std::optional<int> GetLocalSolderPasteMargin() const { return m_padStack.SolderPasteMargin(); }
587 void SetLocalSolderPasteMargin( std::optional<int> aMargin )
588 {
589 m_padStack.SolderPasteMargin( F_Paste ) = aMargin;
590 m_padStack.SolderPasteMargin( B_Paste ) = aMargin;
591 }
592
593 std::optional<double> GetLocalSolderPasteMarginRatio() const
594 {
595 return m_padStack.SolderPasteMarginRatio();
596 }
597 void SetLocalSolderPasteMarginRatio( std::optional<double> aRatio )
598 {
599 m_padStack.SolderPasteMarginRatio( F_Paste ) = aRatio;
600 m_padStack.SolderPasteMarginRatio( B_Paste ) = aRatio;
601 }
602
603 void SetLocalZoneConnection( ZONE_CONNECTION aType ) { m_padStack.ZoneConnection() = aType; }
605 {
606 return m_padStack.ZoneConnection().value_or( ZONE_CONNECTION::INHERITED );
607 }
608
616 int GetOwnClearance( PCB_LAYER_ID aLayer, wxString* aSource = nullptr ) const override;
617
627 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
628 int aMaxError, ERROR_LOC aErrorLoc = ERROR_INSIDE,
629 bool ignoreLineWidth = false ) const override;
630
640 bool TransformHoleToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
641 ERROR_LOC aErrorLoc = ERROR_INSIDE ) const;
642
657 virtual std::shared_ptr<SHAPE>
659 FLASHING flashPTHPads = FLASHING::DEFAULT ) const override;
660
661 const std::shared_ptr<SHAPE_POLY_SET>& GetEffectivePolygon( PCB_LAYER_ID aLayer,
662 ERROR_LOC aErrorLoc = ERROR_INSIDE ) const;
663
667 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
668
674 int GetBoundingRadius() const;
675
682 std::optional<int> GetLocalClearance( wxString* aSource ) const override;
683
690 std::optional<int> GetClearanceOverrides( wxString* aSource ) const override;
691
702 int GetSolderMaskExpansion( PCB_LAYER_ID aLayer ) const;
703
716
717 ZONE_CONNECTION GetZoneConnectionOverrides( wxString* aSource = nullptr ) const;
718
723 void SetLocalThermalSpokeWidthOverride( std::optional<int> aWidth )
724 {
725 m_padStack.ThermalSpokeWidth() = aWidth;
726 }
727 std::optional<int> GetLocalThermalSpokeWidthOverride() const
728 {
729 return m_padStack.ThermalSpokeWidth();
730 }
731
732 int GetLocalSpokeWidthOverride( wxString* aSource = nullptr ) const;
733
739 void SetThermalSpokeAngle( const EDA_ANGLE& aAngle )
740 {
741 m_padStack.SetThermalSpokeAngle( aAngle );
742 }
744 {
745 return m_padStack.ThermalSpokeAngle();
746 }
747
748 // For property system
749 void SetThermalSpokeAngleDegrees( double aAngle )
750 {
751 m_padStack.SetThermalSpokeAngle( EDA_ANGLE( aAngle, DEGREES_T ) );
752 }
754 {
755 return m_padStack.ThermalSpokeAngle().AsDegrees();
756 }
757
758 void SetThermalGap( int aGap ) { m_padStack.ThermalGap() = aGap; }
759 int GetThermalGap() const { return m_padStack.ThermalGap().value_or( 0 ); }
760
761 int GetLocalThermalGapOverride( wxString* aSource ) const;
762
763 std::optional<int> GetLocalThermalGapOverride() const
764 {
765 return m_padStack.ThermalGap();
766 }
767 void SetLocalThermalGapOverride( const std::optional<int>& aOverride )
768 {
769 m_padStack.ThermalGap() = aOverride;
770 }
771
777 void SetRoundRectCornerRadius( PCB_LAYER_ID aLayer, double aRadius );
778 int GetRoundRectCornerRadius( PCB_LAYER_ID aLayer ) const;
779
780 VECTOR2I ShapePos( PCB_LAYER_ID aLayer ) const;
781
788 void SetRoundRectRadiusRatio( PCB_LAYER_ID aLayer, double aRadiusScale );
790 {
791 return m_padStack.RoundRectRadiusRatio( aLayer );
792 }
793
794 // For properties panel, which only supports normal padstacks
795 void SetFrontRoundRectRadiusRatio( double aRadiusScale );
797 {
798 return m_padStack.RoundRectRadiusRatio( F_Cu );
799 }
800
801 // For properties panel, which only supports normal padstacks
802 void SetFrontRoundRectRadiusSize( int aRadius );
803 int GetFrontRoundRectRadiusSize() const;
804
811 void SetChamferRectRatio( PCB_LAYER_ID aLayer, double aChamferScale );
812 double GetChamferRectRatio( PCB_LAYER_ID aLayer ) const
813 {
814 return m_padStack.ChamferRatio( aLayer );
815 }
816
824 void SetChamferPositions( PCB_LAYER_ID aLayer, int aPositions )
825 {
826 m_padStack.SetChamferPositions( aPositions, aLayer );
827 }
828
830 {
831 return m_padStack.ChamferPositions( aLayer );
832 }
833
837 int GetSubRatsnest() const { return m_subRatsnest; }
838 void SetSubRatsnest( int aSubRatsnest ) { m_subRatsnest = aSubRatsnest; }
839
845 void SetRemoveUnconnected( bool aSet )
846 {
847 m_padStack.SetUnconnectedLayerMode( aSet ? UNCONNECTED_LAYER_MODE::REMOVE_ALL
849 }
850
852 {
853 return m_padStack.UnconnectedLayerMode() != UNCONNECTED_LAYER_MODE::KEEP_ALL;
854 }
855
860 void SetKeepTopBottom( bool aSet )
861 {
864 }
865
866 bool GetKeepTopBottom() const
867 {
869 }
870
872 {
873 m_padStack.SetUnconnectedLayerMode( aMode );
874 }
875
877 {
878 return m_padStack.UnconnectedLayerMode();
879 }
880
882 {
883 switch( m_padStack.UnconnectedLayerMode() )
884 {
886 return false;
887
889 return true;
890
893 return aLayer != m_padStack.Drill().start && aLayer != m_padStack.Drill().end;
894 }
895
896 return true;
897 }
898
899 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
900
901 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override
902 {
903 return m_padStack.LayerSet().test( aLayer );
904 }
905
914 bool FlashLayer( int aLayer, bool aOnlyCheckIfPermitted = false ) const;
915
916 bool CanFlashLayer( int aLayer )
917 {
918 return FlashLayer( aLayer, true );
919 }
920
921 PCB_LAYER_ID GetLayer() const override;
922
927
935 bool FlashLayer( const LSET& aLayers ) const;
936
937 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
938 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
939 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
940
944 bool HitTest( const VECTOR2I& aPosition, int aAccuracy, PCB_LAYER_ID aLayer ) const;
945
953 std::vector<PCB_SHAPE*> Recombine( bool aIsDryRun, int aMaxError );
954
955 wxString GetClass() const override
956 {
957 return wxT( "PAD" );
958 }
959
963 const BOX2I GetBoundingBox() const override;
964 const BOX2I GetBoundingBox( PCB_LAYER_ID aLayer ) const;
965
972 static int Compare( const PAD* aPadRef, const PAD* aPadCmp );
973
974 void Move( const VECTOR2I& aMoveVector ) override
975 {
976 m_pos += aMoveVector;
977 SetDirty();
978 }
979
980 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
981
982 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
983
984 BITMAPS GetMenuImage() const override;
985
989 static wxString ShowPadShape( PAD_SHAPE aShape );
990 wxString ShowPadShape( PCB_LAYER_ID aLayer ) const;
991
995 wxString ShowLegacyPadShape( PCB_LAYER_ID aLayer ) const;
996
1000 wxString ShowPadAttr() const;
1001
1002 EDA_ITEM* Clone() const override;
1003
1009 PAD* ClonePad() const
1010 {
1011 return (PAD*) Clone();
1012 }
1013
1018 void BuildEffectiveShapes() const;
1019 void BuildEffectivePolygon( ERROR_LOC aErrorLoc = ERROR_INSIDE ) const;
1020
1021 virtual std::vector<int> ViewGetLayers() const override;
1022
1023 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
1024
1025 virtual const BOX2I ViewBBox() const override;
1026
1028
1030
1031 void SetZoneLayerOverride( PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride );
1032
1033 void CheckPad( UNITS_PROVIDER* aUnitsProvider, bool aForPadProperties,
1034 const std::function<void( int aErrorCode, const wxString& aMsg )>& aErrorHandler ) const;
1035
1036 BACKDRILL_MODE GetBackdrillMode() const { return m_padStack.GetBackdrillMode(); }
1037 void SetBackdrillMode( BACKDRILL_MODE aMode ) { m_padStack.SetBackdrillMode( aMode ); }
1038
1039 std::optional<int> GetBottomBackdrillSize() const { return m_padStack.GetBackdrillSize( false ); }
1040 void SetBottomBackdrillSize( std::optional<int> aSize ) { m_padStack.SetBackdrillSize( false, aSize ); }
1041
1042 PCB_LAYER_ID GetBottomBackdrillLayer() const { return m_padStack.GetBackdrillEndLayer( false ); }
1043 void SetBottomBackdrillLayer( PCB_LAYER_ID aLayer ) { m_padStack.SetBackdrillEndLayer( false, aLayer ); }
1044
1045 std::optional<int> GetTopBackdrillSize() const { return m_padStack.GetBackdrillSize( true ); }
1046 void SetTopBackdrillSize( std::optional<int> aSize ) { m_padStack.SetBackdrillSize( true, aSize ); }
1047
1048 PCB_LAYER_ID GetTopBackdrillLayer() const { return m_padStack.GetBackdrillEndLayer( true ); }
1049 void SetTopBackdrillLayer( PCB_LAYER_ID aLayer ) { m_padStack.SetBackdrillEndLayer( true, aLayer ); }
1050
1051 double Similarity( const BOARD_ITEM& aOther ) const override;
1052
1053 bool operator==( const PAD& aOther ) const;
1054 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
1055
1056#if defined(DEBUG)
1057 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1058#endif
1059
1060protected:
1061 virtual void swapData( BOARD_ITEM* aImage ) override;
1062
1063private:
1064 const SHAPE_COMPOUND& buildEffectiveShape( PCB_LAYER_ID aLayer ) const;
1065
1066 void doCheckPad( PCB_LAYER_ID aLayer, UNITS_PROVIDER* aUnitsProvider, bool aForPadProperties,
1067 const std::function<void( int aErrorCode, const wxString& aMsg )>& aErrorHandler ) const;
1068
1069private:
1070 wxString m_number; // Pad name (pin number in schematic)
1071 wxString m_pinFunction; // Pin name in schematic
1072 wxString m_pinType; // Pin electrical type in schematic
1073
1074 VECTOR2I m_pos; // Pad Position on board
1075
1077
1078 // Must be set to true to force rebuild shapes to draw (after geometry change for instance)
1079 typedef std::map<PCB_LAYER_ID, std::shared_ptr<SHAPE_COMPOUND>> LAYER_SHAPE_MAP;
1080 mutable bool m_shapesDirty;
1081 mutable std::mutex m_shapesBuildingLock;
1084 mutable std::shared_ptr<SHAPE_SEGMENT> m_effectiveHoleShape;
1085
1086 typedef std::map<PCB_LAYER_ID, std::array<std::shared_ptr<SHAPE_POLY_SET>, 2>> LAYER_POLYGON_MAP;
1087 mutable bool m_polyDirty[2];
1088 mutable std::mutex m_polyBuildingLock;
1091 // Last zoom level used to draw the pad: the LAYER_PAD_HOLEWALLS layer shape
1092 // depend on the zoom level. So keep trace on the last used zoom level
1093 mutable double m_lastGalZoomLevel;
1094
1095 int m_subRatsnest; // Variable used to handle subnet (block) number in
1096 // ratsnest computations
1097
1099
1100 PAD_PROP m_property; // Property in fab files (BGA, FIDUCIAL, TESTPOINT, etc.)
1101
1102 int m_lengthPadToDie; // Length net from pad to die, inside the package
1103 int m_delayPadToDie; // Propagation delay from pad to die
1104
1105 mutable std::mutex m_zoneLayerOverridesMutex;
1106 std::map<PCB_LAYER_ID, ZONE_LAYER_OVERRIDE> m_zoneLayerOverrides;
1107};
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
@ ERROR_OUTSIDE
@ ERROR_INSIDE
BITMAPS
A list of all bitmap identifiers.
ZONE_LAYER_OVERRIDE
Conditionally flashed vias and pads that interact with zones of different priority can be very squirr...
Definition board_item.h:71
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:83
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:85
FOOTPRINT * GetParentFootprint() const
Implement a canvas based on a wxGLCanvas.
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:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition eda_item.h:192
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:39
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:66
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition richio.h:66
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition lset.cpp:582
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
Definition padstack.h:157
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
Definition padstack.h:177
Definition pad.h:55
void SetFrontPostMachiningSize(int aSize)
Definition pad.h:452
int GetBackPostMachiningSize() const
Definition pad.h:473
void SetAnchorPadShape(PCB_LAYER_ID aLayer, PAD_SHAPE aShape)
Set the shape of the anchor pad for custom shaped pads.
Definition pad.h:243
bool IsAperturePad() const
Definition pad.h:565
void SetAttribute(PAD_ATTRIB aAttribute)
Definition pad.cpp:1318
int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const override
Return the pad's "own" clearance in internal units.
Definition pad.cpp:1586
void CheckPad(UNITS_PROVIDER *aUnitsProvider, bool aForPadProperties, const std::function< void(int aErrorCode, const wxString &aMsg)> &aErrorHandler) const
Definition pad.cpp:2734
std::optional< bool > GetPrimaryDrillFilled() const
Definition pad.h:500
void SetBackPostMachining(const std::optional< PAD_DRILL_POST_MACHINING_MODE > &aMode)
Definition pad.h:459
PAD(FOOTPRINT *parent)
Definition pad.cpp:76
virtual void swapData(BOARD_ITEM *aImage) override
Definition pad.cpp:2456
PAD_PROP GetProperty() const
Definition pad.h:561
void SetFrontPostMachiningAngle(int aAngle)
Definition pad.h:456
bool GetRemoveUnconnected() const
Definition pad.h:851
void SetPrimaryDrillFilledFlag(bool aFilled)
Definition pad.cpp:734
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition pad.cpp:183
double GetFrontRoundRectRadiusRatio() const
Definition pad.h:796
void doCheckPad(PCB_LAYER_ID aLayer, UNITS_PROVIDER *aUnitsProvider, bool aForPadProperties, const std::function< void(int aErrorCode, const wxString &aMsg)> &aErrorHandler) const
Definition pad.cpp:2849
static wxString ShowPadShape(PAD_SHAPE aShape)
Definition pad.cpp:2055
std::optional< int > GetClearanceOverrides(wxString *aSource) const override
Return any clearance overrides set in the "classic" (ie: pre-rule) system.
Definition pad.cpp:1574
void SetPinType(const wxString &aType)
Set the pad electrical type.
Definition pad.h:153
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition pad.h:555
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives(PCB_LAYER_ID aLayer) const
Accessor to the basic shape list for custom-shaped pads.
Definition pad.h:372
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
Definition pad.cpp:269
int GetSizeX() const
Definition pad.h:280
void MergePrimitivesAsPolygon(PCB_LAYER_ID aLayer, SHAPE_POLY_SET *aMergedPolygon, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Merge all basic shapes to a SHAPE_POLY_SET.
Definition pad.cpp:3148
int GetRoundRectCornerRadius(PCB_LAYER_ID aLayer) const
Definition pad.cpp:861
bool FlashLayer(int aLayer, bool aOnlyCheckIfPermitted=false) const
Check to see whether the pad should be flashed on the specific layer.
Definition pad.cpp:410
void SetLocalThermalGapOverride(const std::optional< int > &aOverride)
Definition pad.h:767
void SetPrimaryDrillSize(const VECTOR2I &aSize)
Definition pad.cpp:493
bool IsDirty() const
Definition pad.h:542
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer, FLASHING flashPTHPads=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition pad.cpp:931
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:1777
const BOX2I GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
Definition pad.cpp:1302
void SetTertiaryDrillStartLayer(PCB_LAYER_ID aLayer)
Definition pad.cpp:847
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition pad.h:901
int GetDrillSizeY() const
Definition pad.h:316
std::map< PCB_LAYER_ID, std::shared_ptr< SHAPE_COMPOUND > > LAYER_SHAPE_MAP
Definition pad.h:1079
void AddPrimitivePoly(PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPoly, int aThickness, bool aFilled)
Has meaning only for custom shape pads.
Definition pad.cpp:3056
std::optional< double > GetLocalSolderPasteMarginRatio() const
Definition pad.h:593
void SetFrontPostMachiningDepth(int aDepth)
Definition pad.h:454
void SetFrontShape(PAD_SHAPE aShape)
Definition pad.cpp:1366
void SetTopBackdrillLayer(PCB_LAYER_ID aLayer)
Definition pad.h:1049
const wxString & GetPinType() const
Definition pad.h:154
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
Definition pad.cpp:279
void SetSecondaryDrillSize(const VECTOR2I &aSize)
Definition pad.cpp:755
void SetPrimaryDrillFilled(const std::optional< bool > &aFilled)
Definition pad.cpp:727
const VECTOR2I & GetDrillSize() const
Definition pad.h:312
PAD_ATTRIB GetAttribute() const
Definition pad.h:558
static LSET PTHMask()
layer set for a through hole pad
Definition pad.cpp:339
static int Compare(const PAD *aPadRef, const PAD *aPadCmp)
Compare two pads and return 0 if they are equal.
Definition pad.cpp:2035
void SetRemoveUnconnected(bool aSet)
Definition pad.h:845
const wxString & GetPinFunction() const
Definition pad.h:148
std::mutex m_shapesBuildingLock
Definition pad.h:1081
void SetThermalGap(int aGap)
Definition pad.h:758
bool CanHaveNumber() const
Indicates whether or not the pad can have a number.
Definition pad.cpp:286
void SetFrontPostMachining(const std::optional< PAD_DRILL_POST_MACHINING_MODE > &aMode)
Definition pad.h:439
void SetThermalSpokeAngle(const EDA_ANGLE &aAngle)
The orientation of the thermal spokes.
Definition pad.h:739
wxString m_pinType
Definition pad.h:1072
std::optional< int > GetBottomBackdrillSize() const
Definition pad.h:1039
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition pad.cpp:218
const wxString & GetNumber() const
Definition pad.h:137
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition pad.cpp:2288
const VECTOR2I & GetDelta(PCB_LAYER_ID aLayer) const
Definition pad.h:299
int GetSecondaryDrillSizeX() const
Definition pad.h:513
void SetSecondaryDrillSizeX(int aX)
Definition pad.cpp:762
void SetFrontRoundRectRadiusRatio(double aRadiusScale)
Definition pad.cpp:881
void SetPrimaryDrillSizeX(int aX)
Definition pad.cpp:500
void BuildEffectiveShapes() const
Rebuild the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit.
Definition pad.cpp:1051
void SetPrimaryDrillEndLayer(PCB_LAYER_ID aLayer)
Definition pad.cpp:549
PAD_SHAPE GetFrontShape() const
Definition pad.h:201
void SetFrontPostMachiningMode(PAD_DRILL_POST_MACHINING_MODE aMode)
Definition pad.h:442
static bool ClassOf(const EDA_ITEM *aItem)
Definition pad.h:81
void CopyFrom(const BOARD_ITEM *aOther) override
Definition pad.cpp:148
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
Definition pad.h:597
PAD & operator=(const PAD &aOther)
Definition pad.cpp:130
void SetLocalThermalSpokeWidthOverride(std::optional< int > aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition pad.h:723
void SetShape(PCB_LAYER_ID aLayer, PAD_SHAPE aShape)
Set the new shape of this pad.
Definition pad.h:187
void SetSecondaryDrillStartLayer(PCB_LAYER_ID aLayer)
Definition pad.cpp:794
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition pad.h:1084
bool IsLocked() const override
Definition pad.cpp:300
wxString ShowLegacyPadShape(PCB_LAYER_ID aLayer) const
An older version still used by place file writer and SWIG interface.
Definition pad.cpp:2077
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition pad.h:326
VECTOR2I GetPosition() const override
Definition pad.h:209
void SetProperty(PAD_PROP aProperty)
Definition pad.cpp:1385
void SetThermalSpokeAngleDegrees(double aAngle)
Definition pad.h:749
void SetPrimaryDrillSizeY(int aY)
Definition pad.cpp:517
EDA_ANGLE GetThermalSpokeAngle() const
Definition pad.h:743
std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > m_zoneLayerOverrides
Definition pad.h:1106
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition pad.h:881
PAD_ATTRIB m_attribute
Definition pad.h:1098
void Flip(const VECTOR2I &VECTOR2I, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition pad.cpp:1418
void SetBackPostMachiningSize(int aSize)
Definition pad.h:472
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition pad.h:974
std::vector< PCB_SHAPE * > Recombine(bool aIsDryRun, int aMaxError)
Recombines the pad with other graphical shapes in the footprint.
Definition pad.cpp:2588
PCB_LAYER_ID GetPrincipalLayer() const
Definition pad.cpp:388
void ClearTertiaryDrillSize()
Definition pad.cpp:833
void SetDirty()
Definition pad.h:547
PAD_DRILL_SHAPE GetTertiaryDrillShape() const
Definition pad.h:535
PCB_LAYER_ID GetTertiaryDrillEndLayer() const
Definition pad.h:540
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition pad.cpp:360
void SetDelta(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
Definition pad.h:293
void SetBottomBackdrillLayer(PCB_LAYER_ID aLayer)
Definition pad.h:1043
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition pad.cpp:2196
std::map< PCB_LAYER_ID, std::array< std::shared_ptr< SHAPE_POLY_SET >, 2 > > LAYER_POLYGON_MAP
Definition pad.h:1086
void SetTertiaryDrillShape(PAD_DRILL_SHAPE aShape)
Definition pad.cpp:840
double GetOrientationDegrees() const
Definition pad.h:423
bool SameLogicalPadAs(const PAD *aOther) const
Before we had custom pad shapes it was common to have multiple overlapping pads to represent a more c...
Definition pad.h:160
void SetBackdrillMode(BACKDRILL_MODE aMode)
Definition pad.h:1037
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition pad.cpp:2046
int GetBackPostMachiningAngle() const
Definition pad.h:477
PADSTACK m_padStack
Definition pad.h:1076
void SetPadToDieDelay(int aDelay)
Definition pad.h:573
void FlipPrimitives(FLIP_DIRECTION aFlipDirection)
Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pad...
Definition pad.cpp:1485
PCB_LAYER_ID GetTertiaryDrillStartLayer() const
Definition pad.h:538
LAYER_SHAPE_MAP m_effectiveShapes
Definition pad.h:1083
bool IsNoConnectPad() const
Definition pad.cpp:326
int GetDrillSizeX() const
Definition pad.h:314
PCB_LAYER_ID GetPrimaryDrillStartLayer() const
Definition pad.h:435
PAD_PROP m_property
Definition pad.h:1100
double GetRoundRectRadiusRatio(PCB_LAYER_ID aLayer) const
Definition pad.h:789
int GetFrontPostMachiningSize() const
Definition pad.h:453
void SetKeepTopBottom(bool aSet)
Definition pad.h:860
void SetTertiaryDrillSizeX(int aX)
Definition pad.cpp:815
void DeletePrimitivesList(PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
Clear the basic shapes list.
Definition pad.cpp:3129
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
Definition pad.h:871
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
Definition pad.h:196
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc=ERROR_INSIDE, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
Definition pad.cpp:2481
PADSTACK & Padstack()
Definition pad.h:329
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
Definition pad.h:136
BACKDRILL_MODE GetBackdrillMode() const
Definition pad.h:1036
void SetTertiaryDrillSize(const VECTOR2I &aSize)
Definition pad.cpp:808
int GetTertiaryDrillSizeY() const
Definition pad.h:532
void SetFrontRoundRectRadiusSize(int aRadius)
Definition pad.cpp:891
wxString ShowPadAttr() const
Definition pad.cpp:2093
wxString m_pinFunction
Definition pad.h:1071
void SetSecondaryDrillEndLayer(PCB_LAYER_ID aLayer)
Definition pad.cpp:801
void AddPrimitive(PCB_LAYER_ID aLayer, PCB_SHAPE *aPrimitive)
Add item to the custom shape primitives list.
Definition pad.cpp:3120
int GetFrontPostMachiningDepth() const
Definition pad.h:455
void SetDrillShape(PAD_DRILL_SHAPE aShape)
Definition pad.h:431
int m_effectiveBoundingRadius
Definition pad.h:1090
const VECTOR2I & GetPrimaryDrillSize() const
Definition pad.h:305
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition pad.h:580
void SetBackPostMachiningMode(PAD_DRILL_POST_MACHINING_MODE aMode)
Definition pad.h:462
void SetOffset(PCB_LAYER_ID aLayer, const VECTOR2I &aOffset)
Definition pad.h:318
void SetCustomShapeInZoneOpt(CUSTOM_SHAPE_ZONE_MODE aOption)
Set the option for the custom pad shape to use as clearance area in copper zones.
Definition pad.h:232
bool GetKeepTopBottom() const
Definition pad.h:866
void SetLocalZoneConnection(ZONE_CONNECTION aType)
Definition pad.h:603
void SetChamferRectRatio(PCB_LAYER_ID aLayer, double aChamferScale)
Has meaning only for chamfered rectangular pads.
Definition pad.cpp:911
void SetPrimaryDrillCappedFlag(bool aCapped)
Definition pad.cpp:748
bool GetPrimaryDrillFilledFlag() const
Definition pad.h:501
int GetSolderMaskExpansion(PCB_LAYER_ID aLayer) const
Definition pad.cpp:1612
int GetPadToDieDelay() const
Definition pad.h:574
std::optional< int > GetLocalClearance() const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
Definition pad.h:576
void ImportSettingsFrom(const PAD &aMasterPad)
Import the pad settings from aMasterPad.
Definition pad.cpp:2384
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition pad.cpp:3032
bool IsOnCopperLayer() const override
Definition pad.cpp:1518
void SetTertiaryDrillEndLayer(PCB_LAYER_ID aLayer)
Definition pad.cpp:854
void SetPadstack(const PADSTACK &aPadstack)
Definition pad.h:330
void SetPosition(const VECTOR2I &aPos) override
Definition pad.h:203
const SHAPE_COMPOUND & buildEffectiveShape(PCB_LAYER_ID aLayer) const
Definition pad.cpp:1097
void SetPrimaryDrillShape(PAD_DRILL_SHAPE aShape)
Definition pad.cpp:530
const PADSTACK & Padstack() const
Definition pad.h:328
const VECTOR2I & GetOffset(PCB_LAYER_ID aLayer) const
Definition pad.h:324
VECTOR2I m_pos
Definition pad.h:1074
double m_lastGalZoomLevel
Definition pad.h:1093
PAD_DRILL_SHAPE GetSecondaryDrillShape() const
Definition pad.h:518
void BuildEffectivePolygon(ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Definition pad.cpp:1250
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition pad.cpp:353
void SetDrillSize(const VECTOR2I &aSize)
Definition pad.h:311
PAD_DRILL_POST_MACHINING_MODE GetBackPostMachiningMode() const
Definition pad.h:467
bool IsFreePad() const
Definition pad.cpp:332
int GetFrontPostMachiningAngle() const
Definition pad.h:457
PAD_DRILL_POST_MACHINING_MODE GetFrontPostMachiningMode() const
Definition pad.h:447
wxString GetClass() const override
Return the class name.
Definition pad.h:955
std::optional< PAD_DRILL_POST_MACHINING_MODE > GetFrontPostMachining() const
Definition pad.h:440
const VECTOR2I & GetSecondaryDrillSize() const
Definition pad.h:509
bool CanFlashLayer(int aLayer)
Definition pad.h:916
int m_subRatsnest
Definition pad.h:1095
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
Definition pad.h:415
void SetSize(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
Definition pad.h:259
int m_delayPadToDie
Definition pad.h:1103
PAD_DRILL_SHAPE GetDrillShape() const
Definition pad.h:432
void SetSecondaryDrillShape(PAD_DRILL_SHAPE aShape)
Definition pad.cpp:787
void ReplacePrimitives(PCB_LAYER_ID aLayer, const std::vector< std::shared_ptr< PCB_SHAPE > > &aPrimitivesList)
Clear the current custom shape primitives list and import a new list.
Definition pad.cpp:3097
int GetChamferPositions(PCB_LAYER_ID aLayer) const
Definition pad.h:829
void SetY(int y)
Definition pad.h:256
static LSET ApertureMask()
layer set for an aperture pad
Definition pad.cpp:367
std::optional< PAD_DRILL_POST_MACHINING_MODE > GetBackPostMachining() const
Definition pad.h:460
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition pad.cpp:2350
UNCONNECTED_LAYER_MODE GetUnconnectedLayerMode() const
Definition pad.h:876
bool m_shapesDirty
Definition pad.h:1080
std::mutex m_polyBuildingLock
Definition pad.h:1088
void SetRoundRectCornerRadius(PCB_LAYER_ID aLayer, double aRadius)
Has meaning only for rounded rectangle pads.
Definition pad.cpp:867
void SetDrillSizeY(int aY)
Definition pad.cpp:524
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition pad.cpp:346
std::optional< int > GetLocalSolderPasteMargin() const
Definition pad.h:586
int GetFrontRoundRectRadiusSize() const
Definition pad.cpp:901
int GetTertiaryDrillSizeX() const
Definition pad.h:530
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(PCB_LAYER_ID aLayer, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Definition pad.cpp:919
void SetX(int x)
Definition pad.h:257
void SetChamferPositions(PCB_LAYER_ID aLayer, int aPositions)
Has meaning only for chamfered rectangular pads.
Definition pad.h:824
int GetBackPostMachiningDepth() const
Definition pad.h:475
std::optional< int > GetLocalSolderMaskMargin() const
Definition pad.h:579
void SetDrillSizeX(int aX)
Definition pad.cpp:511
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
Definition pad.h:587
int GetSizeY() const
Definition pad.h:291
std::optional< int > GetLocalThermalGapOverride() const
Definition pad.h:763
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition pad.cpp:382
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition pad.cpp:2106
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition pad.h:147
EDA_ANGLE GetFPRelativeOrientation() const
Definition pad.cpp:1409
double GetChamferRectRatio(PCB_LAYER_ID aLayer) const
Definition pad.h:812
bool m_polyDirty[2]
Definition pad.h:1087
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:1928
void SetFPRelativeOrientation(const EDA_ANGLE &aAngle)
Definition pad.cpp:1400
int GetPostMachiningKnockout(PCB_LAYER_ID aLayer) const
Get the knockout diameter for a layer affected by post-machining.
Definition pad.cpp:633
int GetBoundingRadius() const
Return the radius of a minimum sized circle which fully encloses this pad.
Definition pad.cpp:1042
std::optional< int > GetTopBackdrillSize() const
Definition pad.h:1045
void ClearZoneLayerOverrides()
Definition pad.cpp:260
void SetOrientation(const EDA_ANGLE &aAngle)
Set the rotation angle of the pad.
Definition pad.cpp:1393
int GetPrimaryDrillSizeY() const
Definition pad.h:309
std::mutex m_zoneLayerOverridesMutex
Definition pad.h:1105
std::optional< int > GetLocalThermalSpokeWidthOverride() const
Definition pad.h:727
PAD_DRILL_SHAPE GetPrimaryDrillShape() const
Definition pad.h:429
bool IsBackdrilledOrPostMachined(PCB_LAYER_ID aLayer) const
Check if a layer is affected by backdrilling or post-machining operations.
Definition pad.cpp:556
VECTOR2I GetSolderPasteMargin(PCB_LAYER_ID aLayer) const
Usually < 0 (mask shape smaller than pad)because the margin can be dependent on the pad size,...
Definition pad.cpp:1667
void SetTopBackdrillSize(std::optional< int > aSize)
Definition pad.h:1046
std::optional< bool > GetPrimaryDrillCapped() const
Definition pad.h:505
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition pad.cpp:2190
void AppendPrimitives(PCB_LAYER_ID aLayer, 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.
Definition pad.cpp:3110
int GetPrimaryDrillSizeX() const
Definition pad.h:307
wxString m_number
Definition pad.h:1070
void SetPrimaryDrillStartLayer(PCB_LAYER_ID aLayer)
Definition pad.cpp:542
void SetBackPostMachiningDepth(int aDepth)
Definition pad.h:474
bool HasDrilledHole() const override
Definition pad.h:112
void SetPrimaryDrillCapped(const std::optional< bool > &aCapped)
Definition pad.cpp:741
LAYER_POLYGON_MAP m_effectivePolygons
Definition pad.h:1089
PCB_LAYER_ID GetPrimaryDrillEndLayer() const
Definition pad.h:437
PCB_LAYER_ID GetBottomBackdrillLayer() const
Definition pad.h:1042
void SetLocalClearance(std::optional< int > aClearance)
Definition pad.h:577
PCB_LAYER_ID GetSecondaryDrillStartLayer() const
Definition pad.h:521
int GetSubRatsnest() const
Definition pad.h:837
void SetSizeX(const int aX)
Definition pad.h:271
const VECTOR2I & GetTertiaryDrillSize() const
Definition pad.h:526
ZONE_CONNECTION GetLocalZoneConnection() const
Definition pad.h:604
void SetTertiaryDrillSizeY(int aY)
Definition pad.cpp:826
int m_lengthPadToDie
Definition pad.h:1102
bool HasHole() const override
Definition pad.h:107
double GetThermalSpokeAngleDegrees() const
Definition pad.h:753
PAD * ClonePad() const
Same as Clone, but returns a PAD item.
Definition pad.h:1009
CUSTOM_SHAPE_ZONE_MODE GetCustomShapeInZoneOpt() const
Definition pad.h:222
int GetThermalGap() const
Definition pad.h:759
VECTOR2I ShapePos(PCB_LAYER_ID aLayer) const
Definition pad.cpp:1503
int GetSecondaryDrillSizeY() const
Definition pad.h:515
void SetSecondaryDrillSizeY(int aY)
Definition pad.cpp:773
PCB_LAYER_ID GetTopBackdrillLayer() const
Definition pad.h:1048
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Return a SHAPE_SEGMENT object representing the pad's hole.
Definition pad.cpp:1033
void SetOrientationDegrees(double aOrientation)
Definition pad.h:419
ZONE_CONNECTION GetZoneConnectionOverrides(wxString *aSource=nullptr) const
Definition pad.cpp:1739
void SetLayerSet(const LSET &aLayers) override
Definition pad.h:554
bool SharesNetTieGroup(const PAD *aOther) const
Definition pad.cpp:309
PAD_SHAPE GetAnchorPadShape(PCB_LAYER_ID aLayer) const
Definition pad.h:214
void SetBottomBackdrillSize(std::optional< int > aSize)
Definition pad.h:1040
void SetRoundRectRadiusRatio(PCB_LAYER_ID aLayer, double aRadiusScale)
Has meaning only for rounded rectangle pads.
Definition pad.cpp:873
void ClearSecondaryDrillSize()
Definition pad.cpp:780
bool GetPrimaryDrillCappedFlag() const
Definition pad.h:506
PCB_LAYER_ID GetSecondaryDrillEndLayer() const
Definition pad.h:523
void SetSubRatsnest(int aSubRatsnest)
Definition pad.h:838
int GetLocalSpokeWidthOverride(wxString *aSource=nullptr) const
Definition pad.cpp:1759
bool TransformHoleToPolygon(SHAPE_POLY_SET &aBuffer, int aClearance, int aError, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Build the corner list of the polygonal drill shape in the board coordinate system.
Definition pad.cpp:2464
void SetPadToDieLength(int aLength)
Definition pad.h:570
bool IsFlipped() const
Definition pad.cpp:374
bool operator==(const PAD &aOther) const
Definition pad.cpp:3017
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition pad.h:86
void SetSizeY(const int aY)
Definition pad.h:282
int GetPadToDieLength() const
Definition pad.h:571
void SetBackPostMachiningAngle(int aAngle)
Definition pad.h:476
BOX2I m_effectiveBoundingBox
Definition pad.h:1082
const VECTOR2I & GetSize(PCB_LAYER_ID aLayer) const
Definition pad.h:264
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition pad.cpp:2212
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
An abstract shape on 2D plane.
Definition shape.h:126
@ DEGREES_T
Definition eda_angle.h:31
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition layer_ids.h:184
@ DEFAULT
Flashing follows connectivity.
Definition layer_ids.h:185
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:60
@ F_Paste
Definition layer_ids.h:104
@ B_Mask
Definition layer_ids.h:98
@ F_Mask
Definition layer_ids.h:97
@ B_Paste
Definition layer_ids.h:105
@ UNDEFINED_LAYER
Definition layer_ids.h:61
@ F_Cu
Definition layer_ids.h:64
FLIP_DIRECTION
Definition mirror.h:27
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:33
PAD_DRILL_POST_MACHINING_MODE
Definition padstack.h:76
PAD_DRILL_SHAPE
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
Definition padstack.h:69
CUSTOM_SHAPE_ZONE_MODE
Definition padstack.h:137
PAD_ATTRIB
The set of pad shapes, used with PAD::{Set,Get}Attribute().
Definition padstack.h:97
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition padstack.h:103
@ PTH
Plated through hole pad.
Definition padstack.h:98
BACKDRILL_MODE
Definition padstack.h:84
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
Definition padstack.h:52
@ RECTANGLE
Definition padstack.h:54
PAD_PROP
The set of pad properties used in Gerber files (Draw files, and P&P files) to define some properties ...
Definition padstack.h:114
UNCONNECTED_LAYER_MODE
Definition padstack.h:128
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:133
@ PCB_LOCATE_PTH_T
Definition typeinfo.h:132
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition typeinfo.h:87
@ PCB_LOCATE_HOLE_T
Definition typeinfo.h:131
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition zones.h:47