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
267 {
268 return m_padStack.HasExplicitDefinitionForLayer( aLayer );
269 }
270
271 // These accessors are for the properties panel, which does not have the ability to deal with
272 // custom padstacks where the properties can vary by layer. The properties should be disabled
273 // in the GUI when the padstack mode is set to anything other than NORMAL, but so that the code
274 // compiles, these are set up to work with the front layer (in other words, assume the mode is
275 // NORMAL, where F_Cu stores the whole padstack data)
276 void SetSizeX( const int aX )
277 {
278 if( aX > 0 )
279 {
281 SetDirty();
282 }
283 }
284
285 int GetSizeX() const { return m_padStack.Size( PADSTACK::ALL_LAYERS ).x; }
286
287 void SetSizeY( const int aY )
288 {
289 if( aY > 0 )
290 {
292 SetDirty();
293 }
294 }
295
296 int GetSizeY() const { return m_padStack.Size( PADSTACK::ALL_LAYERS ).y; }
297
298 void SetDelta( PCB_LAYER_ID aLayer, const VECTOR2I& aSize )
299 {
300 m_padStack.TrapezoidDeltaSize( aLayer ) = aSize;
301 SetDirty();
302 }
303
304 const VECTOR2I& GetDelta( PCB_LAYER_ID aLayer ) const
305 {
306 return m_padStack.TrapezoidDeltaSize( aLayer );
307 }
308
309 void SetPrimaryDrillSize( const VECTOR2I& aSize );
310 const VECTOR2I& GetPrimaryDrillSize() const { return m_padStack.Drill().size; }
311 void SetPrimaryDrillSizeX( int aX );
312 int GetPrimaryDrillSizeX() const { return m_padStack.Drill().size.x; }
313 void SetPrimaryDrillSizeY( int aY );
314 int GetPrimaryDrillSizeY() const { return m_padStack.Drill().size.y; }
315
316 void SetDrillSize( const VECTOR2I& aSize ) { SetPrimaryDrillSize( aSize ); }
317 const VECTOR2I& GetDrillSize() const { return GetPrimaryDrillSize(); }
318 void SetDrillSizeX( int aX );
319 int GetDrillSizeX() const { return GetPrimaryDrillSizeX(); }
320 void SetDrillSizeY( int aY );
321 int GetDrillSizeY() const { return GetPrimaryDrillSizeY(); }
322
323 void SetOffset( PCB_LAYER_ID aLayer, const VECTOR2I& aOffset )
324 {
325 m_padStack.Offset( aLayer ) = aOffset;
326 SetDirty();
327 }
328
329 const VECTOR2I& GetOffset( PCB_LAYER_ID aLayer ) const { return m_padStack.Offset( aLayer ); }
330
331 VECTOR2I GetCenter() const override { return GetPosition(); }
332
333 const PADSTACK& Padstack() const { return m_padStack; }
335 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
336
348 void AddPrimitivePoly( PCB_LAYER_ID aLayer, const SHAPE_POLY_SET& aPoly, int aThickness,
349 bool aFilled );
350 void AddPrimitivePoly( PCB_LAYER_ID aLayer, const std::vector<VECTOR2I>& aPoly, int aThickness,
351 bool aFilled );
352
365 void MergePrimitivesAsPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET* aMergedPolygon,
366 ERROR_LOC aErrorLoc = ERROR_INSIDE ) const;
367
373
377 const std::vector<std::shared_ptr<PCB_SHAPE>>& GetPrimitives( PCB_LAYER_ID aLayer ) const
378 {
379 return m_padStack.Primitives( aLayer );
380 }
381
382 void Flip( const VECTOR2I& VECTOR2I, FLIP_DIRECTION aFlipDirection ) override;
383
388 void FlipPrimitives( FLIP_DIRECTION aFlipDirection );
389
394 void ReplacePrimitives( PCB_LAYER_ID aLayer,
395 const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
396
401 void AppendPrimitives( PCB_LAYER_ID aLayer,
402 const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
403
407 void AddPrimitive( PCB_LAYER_ID aLayer, PCB_SHAPE* aPrimitive );
408
414 void SetOrientation( const EDA_ANGLE& aAngle );
415 void SetFPRelativeOrientation( const EDA_ANGLE& aAngle );
416
420 EDA_ANGLE GetOrientation() const { return m_padStack.GetOrientation(); }
422
423 // For property system
424 void SetOrientationDegrees( double aOrientation )
425 {
426 SetOrientation( EDA_ANGLE( aOrientation, DEGREES_T ) );
427 }
429 {
430 return m_padStack.GetOrientation().AsDegrees();
431 }
432
434 PAD_DRILL_SHAPE GetPrimaryDrillShape() const { return m_padStack.Drill().shape; }
435
438
440 PCB_LAYER_ID GetPrimaryDrillStartLayer() const { return m_padStack.Drill().start; }
442 PCB_LAYER_ID GetPrimaryDrillEndLayer() const { return m_padStack.Drill().end; }
443
444 void SetFrontPostMachining( const std::optional<PAD_DRILL_POST_MACHINING_MODE>& aMode ) { m_padStack.FrontPostMachining().mode = aMode; }
445 std::optional<PAD_DRILL_POST_MACHINING_MODE> GetFrontPostMachining() const { return m_padStack.FrontPostMachining().mode; }
446
448 {
449 m_padStack.FrontPostMachining().mode = aMode;
450 }
451
456
457 void SetFrontPostMachiningSize( int aSize ) { m_padStack.FrontPostMachining().size = aSize; }
458 int GetFrontPostMachiningSize() const { return m_padStack.FrontPostMachining().size; }
459 void SetFrontPostMachiningDepth( int aDepth ) { m_padStack.FrontPostMachining().depth = aDepth; }
460 int GetFrontPostMachiningDepth() const { return m_padStack.FrontPostMachining().depth; }
461 void SetFrontPostMachiningAngle( int aAngle ) { m_padStack.FrontPostMachining().angle = aAngle; }
462 int GetFrontPostMachiningAngle() const { return m_padStack.FrontPostMachining().angle; }
463
464 void SetBackPostMachining( const std::optional<PAD_DRILL_POST_MACHINING_MODE>& aMode ) { m_padStack.BackPostMachining().mode = aMode; }
465 std::optional<PAD_DRILL_POST_MACHINING_MODE> GetBackPostMachining() const { return m_padStack.BackPostMachining().mode; }
466
468 {
469 m_padStack.BackPostMachining().mode = aMode;
470 }
471
476
477 void SetBackPostMachiningSize( int aSize ) { m_padStack.BackPostMachining().size = aSize; }
478 int GetBackPostMachiningSize() const { return m_padStack.BackPostMachining().size; }
479 void SetBackPostMachiningDepth( int aDepth ) { m_padStack.BackPostMachining().depth = aDepth; }
480 int GetBackPostMachiningDepth() const { return m_padStack.BackPostMachining().depth; }
481 void SetBackPostMachiningAngle( int aAngle ) { m_padStack.BackPostMachining().angle = aAngle; }
482 int GetBackPostMachiningAngle() const { return m_padStack.BackPostMachining().angle; }
483
493 bool IsBackdrilledOrPostMachined( PCB_LAYER_ID aLayer ) const;
494
501 int GetPostMachiningKnockout( PCB_LAYER_ID aLayer ) const;
502
503 void SetPrimaryDrillFilled( const std::optional<bool>& aFilled );
504 void SetPrimaryDrillFilledFlag( bool aFilled );
505 std::optional<bool> GetPrimaryDrillFilled() const { return m_padStack.Drill().is_filled; }
506 bool GetPrimaryDrillFilledFlag() const { return m_padStack.Drill().is_filled.value_or( false ); }
507
508 void SetPrimaryDrillCapped( const std::optional<bool>& aCapped );
509 void SetPrimaryDrillCappedFlag( bool aCapped );
510 std::optional<bool> GetPrimaryDrillCapped() const { return m_padStack.Drill().is_capped; }
511 bool GetPrimaryDrillCappedFlag() const { return m_padStack.Drill().is_capped.value_or( false ); }
512
513 void SetSecondaryDrillSize( const VECTOR2I& aSize );
514 const VECTOR2I& GetSecondaryDrillSize() const { return m_padStack.SecondaryDrill().size; }
516
517 void SetSecondaryDrillSizeX( int aX );
518 int GetSecondaryDrillSizeX() const { return m_padStack.SecondaryDrill().size.x; }
519 void SetSecondaryDrillSizeY( int aY );
520 int GetSecondaryDrillSizeY() const { return m_padStack.SecondaryDrill().size.y; }
521
523 PAD_DRILL_SHAPE GetSecondaryDrillShape() const { return m_padStack.SecondaryDrill().shape; }
524
526 PCB_LAYER_ID GetSecondaryDrillStartLayer() const { return m_padStack.SecondaryDrill().start; }
528 PCB_LAYER_ID GetSecondaryDrillEndLayer() const { return m_padStack.SecondaryDrill().end; }
529
530 void SetTertiaryDrillSize( const VECTOR2I& aSize );
531 const VECTOR2I& GetTertiaryDrillSize() const { return m_padStack.TertiaryDrill().size; }
533
534 void SetTertiaryDrillSizeX( int aX );
535 int GetTertiaryDrillSizeX() const { return m_padStack.TertiaryDrill().size.x; }
536 void SetTertiaryDrillSizeY( int aY );
537 int GetTertiaryDrillSizeY() const { return m_padStack.TertiaryDrill().size.y; }
538
540 PAD_DRILL_SHAPE GetTertiaryDrillShape() const { return m_padStack.TertiaryDrill().shape; }
541
543 PCB_LAYER_ID GetTertiaryDrillStartLayer() const { return m_padStack.TertiaryDrill().start; }
545 PCB_LAYER_ID GetTertiaryDrillEndLayer() const { return m_padStack.TertiaryDrill().end; }
546
547 bool IsDirty() const
548 {
550 }
551
552 void SetDirty()
553 {
554 m_shapesDirty = true;
557 }
558
559 void SetLayerSet( const LSET& aLayers ) override;
560 LSET GetLayerSet() const override { return m_padStack.LayerSet(); }
561
562 void SetAttribute( PAD_ATTRIB aAttribute );
564
565 void SetProperty( PAD_PROP aProperty );
566 PAD_PROP GetProperty() const { return m_property; }
567
568 // We don't currently have an attribute for APERTURE, and adding one will change the file
569 // format, so for now just infer a copper-less pad to be an APERTURE pad.
570 bool IsAperturePad() const
571 {
572 return ( m_padStack.LayerSet() & LSET::AllCuMask() ).none();
573 }
574
575 void SetPadToDieLength( int aLength ) { m_lengthPadToDie = aLength; }
576 int GetPadToDieLength() const { return m_lengthPadToDie; }
577
578 void SetPadToDieDelay( int aDelay ) { m_delayPadToDie = aDelay; }
579 int GetPadToDieDelay() const { return m_delayPadToDie; }
580
581 std::optional<int> GetLocalClearance() const override { return m_padStack.Clearance(); }
582 void SetLocalClearance( std::optional<int> aClearance ) { m_padStack.Clearance() = aClearance; }
583
584 std::optional<int> GetLocalSolderMaskMargin() const { return m_padStack.SolderMaskMargin(); }
585 void SetLocalSolderMaskMargin( std::optional<int> aMargin )
586 {
587 m_padStack.SolderMaskMargin( F_Mask ) = aMargin;
588 m_padStack.SolderMaskMargin( B_Mask ) = aMargin;
589 }
590
591 std::optional<int> GetLocalSolderPasteMargin() const { return m_padStack.SolderPasteMargin(); }
592 void SetLocalSolderPasteMargin( std::optional<int> aMargin )
593 {
594 m_padStack.SolderPasteMargin( F_Paste ) = aMargin;
595 m_padStack.SolderPasteMargin( B_Paste ) = aMargin;
596 }
597
598 std::optional<double> GetLocalSolderPasteMarginRatio() const
599 {
600 return m_padStack.SolderPasteMarginRatio();
601 }
602 void SetLocalSolderPasteMarginRatio( std::optional<double> aRatio )
603 {
604 m_padStack.SolderPasteMarginRatio( F_Paste ) = aRatio;
605 m_padStack.SolderPasteMarginRatio( B_Paste ) = aRatio;
606 }
607
608 void SetLocalZoneConnection( ZONE_CONNECTION aType ) { m_padStack.ZoneConnection() = aType; }
610 {
611 return m_padStack.ZoneConnection().value_or( ZONE_CONNECTION::INHERITED );
612 }
613
621 int GetOwnClearance( PCB_LAYER_ID aLayer, wxString* aSource = nullptr ) const override;
622
632 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
633 int aMaxError, ERROR_LOC aErrorLoc = ERROR_INSIDE,
634 bool ignoreLineWidth = false ) const override;
635
645 bool TransformHoleToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
646 ERROR_LOC aErrorLoc = ERROR_INSIDE ) const;
647
662 virtual std::shared_ptr<SHAPE>
664 FLASHING flashPTHPads = FLASHING::DEFAULT ) const override;
665
666 const std::shared_ptr<SHAPE_POLY_SET>& GetEffectivePolygon( PCB_LAYER_ID aLayer,
667 ERROR_LOC aErrorLoc = ERROR_INSIDE ) const;
668
672 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
673
679 int GetBoundingRadius() const;
680
687 std::optional<int> GetLocalClearance( wxString* aSource ) const override;
688
695 std::optional<int> GetClearanceOverrides( wxString* aSource ) const override;
696
707 int GetSolderMaskExpansion( PCB_LAYER_ID aLayer ) const;
708
721
722 ZONE_CONNECTION GetZoneConnectionOverrides( wxString* aSource = nullptr ) const;
723
728 void SetLocalThermalSpokeWidthOverride( std::optional<int> aWidth )
729 {
730 m_padStack.ThermalSpokeWidth() = aWidth;
731 }
732 std::optional<int> GetLocalThermalSpokeWidthOverride() const
733 {
734 return m_padStack.ThermalSpokeWidth();
735 }
736
737 int GetLocalSpokeWidthOverride( wxString* aSource = nullptr ) const;
738
744 void SetThermalSpokeAngle( const EDA_ANGLE& aAngle )
745 {
746 m_padStack.SetThermalSpokeAngle( aAngle );
747 }
749 {
750 return m_padStack.ThermalSpokeAngle();
751 }
752
753 // For property system
754 void SetThermalSpokeAngleDegrees( double aAngle )
755 {
756 m_padStack.SetThermalSpokeAngle( EDA_ANGLE( aAngle, DEGREES_T ) );
757 }
759 {
760 return m_padStack.ThermalSpokeAngle().AsDegrees();
761 }
762
763 void SetThermalGap( int aGap ) { m_padStack.ThermalGap() = aGap; }
764 int GetThermalGap() const { return m_padStack.ThermalGap().value_or( 0 ); }
765
766 int GetLocalThermalGapOverride( wxString* aSource ) const;
767
768 std::optional<int> GetLocalThermalGapOverride() const
769 {
770 return m_padStack.ThermalGap();
771 }
772 void SetLocalThermalGapOverride( const std::optional<int>& aOverride )
773 {
774 m_padStack.ThermalGap() = aOverride;
775 }
776
782 void SetRoundRectCornerRadius( PCB_LAYER_ID aLayer, double aRadius );
783 int GetRoundRectCornerRadius( PCB_LAYER_ID aLayer ) const;
784
785 VECTOR2I ShapePos( PCB_LAYER_ID aLayer ) const;
786
793 void SetRoundRectRadiusRatio( PCB_LAYER_ID aLayer, double aRadiusScale );
795 {
796 return m_padStack.RoundRectRadiusRatio( aLayer );
797 }
798
799 // For properties panel, which only supports normal padstacks
800 void SetFrontRoundRectRadiusRatio( double aRadiusScale );
802 {
803 return m_padStack.RoundRectRadiusRatio( F_Cu );
804 }
805
806 // For properties panel, which only supports normal padstacks
807 void SetFrontRoundRectRadiusSize( int aRadius );
808 int GetFrontRoundRectRadiusSize() const;
809
816 void SetChamferRectRatio( PCB_LAYER_ID aLayer, double aChamferScale );
817 double GetChamferRectRatio( PCB_LAYER_ID aLayer ) const
818 {
819 return m_padStack.ChamferRatio( aLayer );
820 }
821
829 void SetChamferPositions( PCB_LAYER_ID aLayer, int aPositions )
830 {
831 m_padStack.SetChamferPositions( aPositions, aLayer );
832 }
833
835 {
836 return m_padStack.ChamferPositions( aLayer );
837 }
838
842 int GetSubRatsnest() const { return m_subRatsnest; }
843 void SetSubRatsnest( int aSubRatsnest ) { m_subRatsnest = aSubRatsnest; }
844
850 void SetRemoveUnconnected( bool aSet )
851 {
852 m_padStack.SetUnconnectedLayerMode( aSet ? UNCONNECTED_LAYER_MODE::REMOVE_ALL
854 }
855
857 {
858 return m_padStack.UnconnectedLayerMode() != UNCONNECTED_LAYER_MODE::KEEP_ALL;
859 }
860
865 void SetKeepTopBottom( bool aSet )
866 {
869 }
870
871 bool GetKeepTopBottom() const
872 {
874 }
875
877 {
878 m_padStack.SetUnconnectedLayerMode( aMode );
879 }
880
882 {
883 return m_padStack.UnconnectedLayerMode();
884 }
885
887 {
888 switch( m_padStack.UnconnectedLayerMode() )
889 {
891 return false;
892
894 return true;
895
898 return aLayer != m_padStack.Drill().start && aLayer != m_padStack.Drill().end;
899 }
900
901 return true;
902 }
903
904 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
905
906 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override
907 {
908 return m_padStack.LayerSet().test( aLayer );
909 }
910
919 bool FlashLayer( int aLayer, bool aOnlyCheckIfPermitted = false ) const;
920
921 bool CanFlashLayer( int aLayer )
922 {
923 return FlashLayer( aLayer, true );
924 }
925
926 PCB_LAYER_ID GetLayer() const override;
927
932
940 bool FlashLayer( const LSET& aLayers ) const;
941
942 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
943 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
944 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
945
949 bool HitTest( const VECTOR2I& aPosition, int aAccuracy, PCB_LAYER_ID aLayer ) const;
950
958 std::vector<PCB_SHAPE*> Recombine( bool aIsDryRun, int aMaxError );
959
960 wxString GetClass() const override
961 {
962 return wxT( "PAD" );
963 }
964
968 const BOX2I GetBoundingBox() const override;
969 const BOX2I GetBoundingBox( PCB_LAYER_ID aLayer ) const;
970
977 static int Compare( const PAD* aPadRef, const PAD* aPadCmp );
978
979 void Move( const VECTOR2I& aMoveVector ) override
980 {
981 m_pos += aMoveVector;
982 SetDirty();
983 }
984
985 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
986
987 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
988
989 BITMAPS GetMenuImage() const override;
990
994 static wxString ShowPadShape( PAD_SHAPE aShape );
995 wxString ShowPadShape( PCB_LAYER_ID aLayer ) const;
996
1000 wxString ShowLegacyPadShape( PCB_LAYER_ID aLayer ) const;
1001
1005 wxString ShowPadAttr() const;
1006
1007 EDA_ITEM* Clone() const override;
1008
1014 PAD* ClonePad() const
1015 {
1016 return (PAD*) Clone();
1017 }
1018
1023 void BuildEffectiveShapes() const;
1024 void BuildEffectivePolygon( ERROR_LOC aErrorLoc = ERROR_INSIDE ) const;
1025
1026 virtual std::vector<int> ViewGetLayers() const override;
1027
1028 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
1029
1030 virtual const BOX2I ViewBBox() const override;
1031
1033
1035
1036 void SetZoneLayerOverride( PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride );
1037
1038 void CheckPad( UNITS_PROVIDER* aUnitsProvider, bool aForPadProperties,
1039 const std::function<void( int aErrorCode, const wxString& aMsg )>& aErrorHandler ) const;
1040
1041 BACKDRILL_MODE GetBackdrillMode() const { return m_padStack.GetBackdrillMode(); }
1042 void SetBackdrillMode( BACKDRILL_MODE aMode ) { m_padStack.SetBackdrillMode( aMode ); }
1043
1044 std::optional<int> GetBottomBackdrillSize() const { return m_padStack.GetBackdrillSize( false ); }
1045 void SetBottomBackdrillSize( std::optional<int> aSize ) { m_padStack.SetBackdrillSize( false, aSize ); }
1046
1047 PCB_LAYER_ID GetBottomBackdrillLayer() const { return m_padStack.GetBackdrillEndLayer( false ); }
1048 void SetBottomBackdrillLayer( PCB_LAYER_ID aLayer ) { m_padStack.SetBackdrillEndLayer( false, aLayer ); }
1049
1050 std::optional<int> GetTopBackdrillSize() const { return m_padStack.GetBackdrillSize( true ); }
1051 void SetTopBackdrillSize( std::optional<int> aSize ) { m_padStack.SetBackdrillSize( true, aSize ); }
1052
1053 PCB_LAYER_ID GetTopBackdrillLayer() const { return m_padStack.GetBackdrillEndLayer( true ); }
1054 void SetTopBackdrillLayer( PCB_LAYER_ID aLayer ) { m_padStack.SetBackdrillEndLayer( true, aLayer ); }
1055
1056 double Similarity( const BOARD_ITEM& aOther ) const override;
1057
1058 bool operator==( const PAD& aOther ) const;
1059 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
1060
1061#if defined(DEBUG)
1062 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1063#endif
1064
1065protected:
1066 virtual void swapData( BOARD_ITEM* aImage ) override;
1067
1068private:
1069 const SHAPE_COMPOUND& buildEffectiveShape( PCB_LAYER_ID aLayer ) const;
1070
1071 void doCheckPad( PCB_LAYER_ID aLayer, UNITS_PROVIDER* aUnitsProvider, bool aForPadProperties,
1072 const std::function<void( int aErrorCode, const wxString& aMsg )>& aErrorHandler ) const;
1073
1074private:
1075 wxString m_number; // Pad name (pin number in schematic)
1076 wxString m_pinFunction; // Pin name in schematic
1077 wxString m_pinType; // Pin electrical type in schematic
1078
1079 VECTOR2I m_pos; // Pad Position on board
1080
1082
1083 // Must be set to true to force rebuild shapes to draw (after geometry change for instance)
1084 typedef std::map<PCB_LAYER_ID, std::shared_ptr<SHAPE_COMPOUND>> LAYER_SHAPE_MAP;
1085 mutable bool m_shapesDirty;
1086 mutable std::mutex m_shapesBuildingLock;
1089 mutable std::shared_ptr<SHAPE_SEGMENT> m_effectiveHoleShape;
1090
1091 typedef std::map<PCB_LAYER_ID, std::array<std::shared_ptr<SHAPE_POLY_SET>, 2>> LAYER_POLYGON_MAP;
1092 mutable bool m_polyDirty[2];
1093 mutable std::mutex m_polyBuildingLock;
1096 // Last zoom level used to draw the pad: the LAYER_PAD_HOLEWALLS layer shape
1097 // depend on the zoom level. So keep trace on the last used zoom level
1098 mutable double m_lastGalZoomLevel;
1099
1100 int m_subRatsnest; // Variable used to handle subnet (block) number in
1101 // ratsnest computations
1102
1104
1105 PAD_PROP m_property; // Property in fab files (BGA, FIDUCIAL, TESTPOINT, etc.)
1106
1107 int m_lengthPadToDie; // Length net from pad to die, inside the package
1108 int m_delayPadToDie; // Propagation delay from pad to die
1109
1110 mutable std::mutex m_zoneLayerOverridesMutex;
1111 std::map<PCB_LAYER_ID, ZONE_LAYER_OVERRIDE> m_zoneLayerOverrides;
1112};
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:198
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:457
int GetBackPostMachiningSize() const
Definition pad.h:478
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:570
void SetAttribute(PAD_ATTRIB aAttribute)
Definition pad.cpp:1316
int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const override
Return the pad's "own" clearance in internal units.
Definition pad.cpp:1599
void CheckPad(UNITS_PROVIDER *aUnitsProvider, bool aForPadProperties, const std::function< void(int aErrorCode, const wxString &aMsg)> &aErrorHandler) const
Definition pad.cpp:2728
std::optional< bool > GetPrimaryDrillFilled() const
Definition pad.h:505
void SetBackPostMachining(const std::optional< PAD_DRILL_POST_MACHINING_MODE > &aMode)
Definition pad.h:464
PAD(FOOTPRINT *parent)
Definition pad.cpp:76
virtual void swapData(BOARD_ITEM *aImage) override
Definition pad.cpp:2450
PAD_PROP GetProperty() const
Definition pad.h:566
void SetFrontPostMachiningAngle(int aAngle)
Definition pad.h:461
bool GetRemoveUnconnected() const
Definition pad.h:856
void SetPrimaryDrillFilledFlag(bool aFilled)
Definition pad.cpp:732
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition pad.cpp:181
double GetFrontRoundRectRadiusRatio() const
Definition pad.h:801
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:2843
static wxString ShowPadShape(PAD_SHAPE aShape)
Definition pad.cpp:2049
std::optional< int > GetClearanceOverrides(wxString *aSource) const override
Return any clearance overrides set in the "classic" (ie: pre-rule) system.
Definition pad.cpp:1576
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:560
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:377
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
Definition pad.cpp:267
int GetSizeX() const
Definition pad.h:285
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:3142
int GetRoundRectCornerRadius(PCB_LAYER_ID aLayer) const
Definition pad.cpp:859
bool FlashLayer(int aLayer, bool aOnlyCheckIfPermitted=false) const
Check to see whether the pad should be flashed on the specific layer.
Definition pad.cpp:408
void SetLocalThermalGapOverride(const std::optional< int > &aOverride)
Definition pad.h:772
void SetPrimaryDrillSize(const VECTOR2I &aSize)
Definition pad.cpp:491
bool IsDirty() const
Definition pad.h:547
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:929
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:1771
const BOX2I GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
Definition pad.cpp:1300
void SetTertiaryDrillStartLayer(PCB_LAYER_ID aLayer)
Definition pad.cpp:845
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition pad.h:906
int GetDrillSizeY() const
Definition pad.h:321
std::map< PCB_LAYER_ID, std::shared_ptr< SHAPE_COMPOUND > > LAYER_SHAPE_MAP
Definition pad.h:1084
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:3050
std::optional< double > GetLocalSolderPasteMarginRatio() const
Definition pad.h:598
void SetFrontPostMachiningDepth(int aDepth)
Definition pad.h:459
void SetFrontShape(PAD_SHAPE aShape)
Definition pad.cpp:1368
void SetTopBackdrillLayer(PCB_LAYER_ID aLayer)
Definition pad.h:1054
const wxString & GetPinType() const
Definition pad.h:154
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
Definition pad.cpp:277
void SetSecondaryDrillSize(const VECTOR2I &aSize)
Definition pad.cpp:753
void SetPrimaryDrillFilled(const std::optional< bool > &aFilled)
Definition pad.cpp:725
const VECTOR2I & GetDrillSize() const
Definition pad.h:317
PAD_ATTRIB GetAttribute() const
Definition pad.h:563
static LSET PTHMask()
layer set for a through hole pad
Definition pad.cpp:337
static int Compare(const PAD *aPadRef, const PAD *aPadCmp)
Compare two pads and return 0 if they are equal.
Definition pad.cpp:2029
void SetRemoveUnconnected(bool aSet)
Definition pad.h:850
const wxString & GetPinFunction() const
Definition pad.h:148
std::mutex m_shapesBuildingLock
Definition pad.h:1086
void SetThermalGap(int aGap)
Definition pad.h:763
bool CanHaveNumber() const
Indicates whether or not the pad can have a number.
Definition pad.cpp:284
void SetFrontPostMachining(const std::optional< PAD_DRILL_POST_MACHINING_MODE > &aMode)
Definition pad.h:444
void SetThermalSpokeAngle(const EDA_ANGLE &aAngle)
The orientation of the thermal spokes.
Definition pad.h:744
wxString m_pinType
Definition pad.h:1077
std::optional< int > GetBottomBackdrillSize() const
Definition pad.h:1044
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition pad.cpp:216
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:2282
const VECTOR2I & GetDelta(PCB_LAYER_ID aLayer) const
Definition pad.h:304
int GetSecondaryDrillSizeX() const
Definition pad.h:518
void SetSecondaryDrillSizeX(int aX)
Definition pad.cpp:760
void SetFrontRoundRectRadiusRatio(double aRadiusScale)
Definition pad.cpp:879
void SetPrimaryDrillSizeX(int aX)
Definition pad.cpp:498
void BuildEffectiveShapes() const
Rebuild the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit.
Definition pad.cpp:1049
void SetPrimaryDrillEndLayer(PCB_LAYER_ID aLayer)
Definition pad.cpp:547
PAD_SHAPE GetFrontShape() const
Definition pad.h:201
void SetFrontPostMachiningMode(PAD_DRILL_POST_MACHINING_MODE aMode)
Definition pad.h:447
static bool ClassOf(const EDA_ITEM *aItem)
Definition pad.h:81
void CopyFrom(const BOARD_ITEM *aOther) override
Definition pad.cpp:146
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
Definition pad.h:602
PAD & operator=(const PAD &aOther)
Definition pad.cpp:128
void SetLocalThermalSpokeWidthOverride(std::optional< int > aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition pad.h:728
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:792
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition pad.h:1089
bool IsLocked() const override
Definition pad.cpp:298
wxString ShowLegacyPadShape(PCB_LAYER_ID aLayer) const
An older version still used by place file writer and SWIG interface.
Definition pad.cpp:2071
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition pad.h:331
VECTOR2I GetPosition() const override
Definition pad.h:209
void SetProperty(PAD_PROP aProperty)
Definition pad.cpp:1387
void SetThermalSpokeAngleDegrees(double aAngle)
Definition pad.h:754
void SetPrimaryDrillSizeY(int aY)
Definition pad.cpp:515
EDA_ANGLE GetThermalSpokeAngle() const
Definition pad.h:748
std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > m_zoneLayerOverrides
Definition pad.h:1111
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition pad.h:886
PAD_ATTRIB m_attribute
Definition pad.h:1103
void Flip(const VECTOR2I &VECTOR2I, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition pad.cpp:1420
void SetBackPostMachiningSize(int aSize)
Definition pad.h:477
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition pad.h:979
std::vector< PCB_SHAPE * > Recombine(bool aIsDryRun, int aMaxError)
Recombines the pad with other graphical shapes in the footprint.
Definition pad.cpp:2582
PCB_LAYER_ID GetPrincipalLayer() const
Definition pad.cpp:386
void ClearTertiaryDrillSize()
Definition pad.cpp:831
void SetDirty()
Definition pad.h:552
PAD_DRILL_SHAPE GetTertiaryDrillShape() const
Definition pad.h:540
PCB_LAYER_ID GetTertiaryDrillEndLayer() const
Definition pad.h:545
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition pad.cpp:358
void SetDelta(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
Definition pad.h:298
void SetBottomBackdrillLayer(PCB_LAYER_ID aLayer)
Definition pad.h:1048
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition pad.cpp:2190
std::map< PCB_LAYER_ID, std::array< std::shared_ptr< SHAPE_POLY_SET >, 2 > > LAYER_POLYGON_MAP
Definition pad.h:1091
void SetTertiaryDrillShape(PAD_DRILL_SHAPE aShape)
Definition pad.cpp:838
double GetOrientationDegrees() const
Definition pad.h:428
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:1042
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition pad.cpp:2040
int GetBackPostMachiningAngle() const
Definition pad.h:482
PADSTACK m_padStack
Definition pad.h:1081
void SetPadToDieDelay(int aDelay)
Definition pad.h:578
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:1487
PCB_LAYER_ID GetTertiaryDrillStartLayer() const
Definition pad.h:543
LAYER_SHAPE_MAP m_effectiveShapes
Definition pad.h:1088
bool IsNoConnectPad() const
Definition pad.cpp:324
int GetDrillSizeX() const
Definition pad.h:319
PCB_LAYER_ID GetPrimaryDrillStartLayer() const
Definition pad.h:440
PAD_PROP m_property
Definition pad.h:1105
double GetRoundRectRadiusRatio(PCB_LAYER_ID aLayer) const
Definition pad.h:794
int GetFrontPostMachiningSize() const
Definition pad.h:458
void SetKeepTopBottom(bool aSet)
Definition pad.h:865
void SetTertiaryDrillSizeX(int aX)
Definition pad.cpp:813
void DeletePrimitivesList(PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
Clear the basic shapes list.
Definition pad.cpp:3123
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
Definition pad.h:876
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:2475
PADSTACK & Padstack()
Definition pad.h:334
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:1041
void SetTertiaryDrillSize(const VECTOR2I &aSize)
Definition pad.cpp:806
int GetTertiaryDrillSizeY() const
Definition pad.h:537
void SetFrontRoundRectRadiusSize(int aRadius)
Definition pad.cpp:889
wxString ShowPadAttr() const
Definition pad.cpp:2087
wxString m_pinFunction
Definition pad.h:1076
void SetSecondaryDrillEndLayer(PCB_LAYER_ID aLayer)
Definition pad.cpp:799
void AddPrimitive(PCB_LAYER_ID aLayer, PCB_SHAPE *aPrimitive)
Add item to the custom shape primitives list.
Definition pad.cpp:3114
int GetFrontPostMachiningDepth() const
Definition pad.h:460
void SetDrillShape(PAD_DRILL_SHAPE aShape)
Definition pad.h:436
int m_effectiveBoundingRadius
Definition pad.h:1095
const VECTOR2I & GetPrimaryDrillSize() const
Definition pad.h:310
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition pad.h:585
void SetBackPostMachiningMode(PAD_DRILL_POST_MACHINING_MODE aMode)
Definition pad.h:467
void SetOffset(PCB_LAYER_ID aLayer, const VECTOR2I &aOffset)
Definition pad.h:323
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:871
void SetLocalZoneConnection(ZONE_CONNECTION aType)
Definition pad.h:608
void SetChamferRectRatio(PCB_LAYER_ID aLayer, double aChamferScale)
Has meaning only for chamfered rectangular pads.
Definition pad.cpp:909
void SetPrimaryDrillCappedFlag(bool aCapped)
Definition pad.cpp:746
bool GetPrimaryDrillFilledFlag() const
Definition pad.h:506
int GetSolderMaskExpansion(PCB_LAYER_ID aLayer) const
Definition pad.cpp:1606
int GetPadToDieDelay() const
Definition pad.h:579
std::optional< int > GetLocalClearance() const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
Definition pad.h:581
void ImportSettingsFrom(const PAD &aMasterPad)
Import the pad settings from aMasterPad.
Definition pad.cpp:2378
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:3026
bool IsOnCopperLayer() const override
Definition pad.cpp:1520
void SetTertiaryDrillEndLayer(PCB_LAYER_ID aLayer)
Definition pad.cpp:852
void SetPadstack(const PADSTACK &aPadstack)
Definition pad.h:335
void SetPosition(const VECTOR2I &aPos) override
Definition pad.h:203
const SHAPE_COMPOUND & buildEffectiveShape(PCB_LAYER_ID aLayer) const
Definition pad.cpp:1095
void SetPrimaryDrillShape(PAD_DRILL_SHAPE aShape)
Definition pad.cpp:528
const PADSTACK & Padstack() const
Definition pad.h:333
const VECTOR2I & GetOffset(PCB_LAYER_ID aLayer) const
Definition pad.h:329
VECTOR2I m_pos
Definition pad.h:1079
double m_lastGalZoomLevel
Definition pad.h:1098
PAD_DRILL_SHAPE GetSecondaryDrillShape() const
Definition pad.h:523
void BuildEffectivePolygon(ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Definition pad.cpp:1248
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition pad.cpp:351
void SetDrillSize(const VECTOR2I &aSize)
Definition pad.h:316
PAD_DRILL_POST_MACHINING_MODE GetBackPostMachiningMode() const
Definition pad.h:472
bool IsFreePad() const
Definition pad.cpp:330
int GetFrontPostMachiningAngle() const
Definition pad.h:462
PAD_DRILL_POST_MACHINING_MODE GetFrontPostMachiningMode() const
Definition pad.h:452
wxString GetClass() const override
Return the class name.
Definition pad.h:960
std::optional< PAD_DRILL_POST_MACHINING_MODE > GetFrontPostMachining() const
Definition pad.h:445
const VECTOR2I & GetSecondaryDrillSize() const
Definition pad.h:514
bool CanFlashLayer(int aLayer)
Definition pad.h:921
int m_subRatsnest
Definition pad.h:1100
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
Definition pad.h:420
void SetSize(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
Definition pad.h:259
int m_delayPadToDie
Definition pad.h:1108
PAD_DRILL_SHAPE GetDrillShape() const
Definition pad.h:437
void SetSecondaryDrillShape(PAD_DRILL_SHAPE aShape)
Definition pad.cpp:785
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:3091
int GetChamferPositions(PCB_LAYER_ID aLayer) const
Definition pad.h:834
void SetY(int y)
Definition pad.h:256
static LSET ApertureMask()
layer set for an aperture pad
Definition pad.cpp:365
std::optional< PAD_DRILL_POST_MACHINING_MODE > GetBackPostMachining() const
Definition pad.h:465
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition pad.cpp:2344
UNCONNECTED_LAYER_MODE GetUnconnectedLayerMode() const
Definition pad.h:881
bool m_shapesDirty
Definition pad.h:1085
std::mutex m_polyBuildingLock
Definition pad.h:1093
void SetRoundRectCornerRadius(PCB_LAYER_ID aLayer, double aRadius)
Has meaning only for rounded rectangle pads.
Definition pad.cpp:865
void SetDrillSizeY(int aY)
Definition pad.cpp:522
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition pad.cpp:344
std::optional< int > GetLocalSolderPasteMargin() const
Definition pad.h:591
int GetFrontRoundRectRadiusSize() const
Definition pad.cpp:899
int GetTertiaryDrillSizeX() const
Definition pad.h:535
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(PCB_LAYER_ID aLayer, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Definition pad.cpp:917
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:829
int GetBackPostMachiningDepth() const
Definition pad.h:480
std::optional< int > GetLocalSolderMaskMargin() const
Definition pad.h:584
void SetDrillSizeX(int aX)
Definition pad.cpp:509
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
Definition pad.h:592
int GetSizeY() const
Definition pad.h:296
std::optional< int > GetLocalThermalGapOverride() const
Definition pad.h:768
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition pad.cpp:380
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition pad.cpp:2100
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition pad.h:147
EDA_ANGLE GetFPRelativeOrientation() const
Definition pad.cpp:1411
double GetChamferRectRatio(PCB_LAYER_ID aLayer) const
Definition pad.h:817
bool m_polyDirty[2]
Definition pad.h:1092
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:1922
void SetFPRelativeOrientation(const EDA_ANGLE &aAngle)
Definition pad.cpp:1402
int GetPostMachiningKnockout(PCB_LAYER_ID aLayer) const
Get the knockout diameter for a layer affected by post-machining.
Definition pad.cpp:631
int GetBoundingRadius() const
Return the radius of a minimum sized circle which fully encloses this pad.
Definition pad.cpp:1040
std::optional< int > GetTopBackdrillSize() const
Definition pad.h:1050
void ClearZoneLayerOverrides()
Definition pad.cpp:258
void SetOrientation(const EDA_ANGLE &aAngle)
Set the rotation angle of the pad.
Definition pad.cpp:1395
int GetPrimaryDrillSizeY() const
Definition pad.h:314
std::mutex m_zoneLayerOverridesMutex
Definition pad.h:1110
std::optional< int > GetLocalThermalSpokeWidthOverride() const
Definition pad.h:732
PAD_DRILL_SHAPE GetPrimaryDrillShape() const
Definition pad.h:434
bool IsBackdrilledOrPostMachined(PCB_LAYER_ID aLayer) const
Check if a layer is affected by backdrilling or post-machining operations.
Definition pad.cpp:554
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:1661
void SetTopBackdrillSize(std::optional< int > aSize)
Definition pad.h:1051
std::optional< bool > GetPrimaryDrillCapped() const
Definition pad.h:510
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition pad.cpp:2184
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:3104
int GetPrimaryDrillSizeX() const
Definition pad.h:312
wxString m_number
Definition pad.h:1075
void SetPrimaryDrillStartLayer(PCB_LAYER_ID aLayer)
Definition pad.cpp:540
void SetBackPostMachiningDepth(int aDepth)
Definition pad.h:479
bool HasDrilledHole() const override
Definition pad.h:112
void SetPrimaryDrillCapped(const std::optional< bool > &aCapped)
Definition pad.cpp:739
LAYER_POLYGON_MAP m_effectivePolygons
Definition pad.h:1094
PCB_LAYER_ID GetPrimaryDrillEndLayer() const
Definition pad.h:442
PCB_LAYER_ID GetBottomBackdrillLayer() const
Definition pad.h:1047
bool HasExplicitDefinitionForLayer(PCB_LAYER_ID aLayer) const
Definition pad.h:266
void SetLocalClearance(std::optional< int > aClearance)
Definition pad.h:582
PCB_LAYER_ID GetSecondaryDrillStartLayer() const
Definition pad.h:526
int GetSubRatsnest() const
Definition pad.h:842
void SetSizeX(const int aX)
Definition pad.h:276
const VECTOR2I & GetTertiaryDrillSize() const
Definition pad.h:531
ZONE_CONNECTION GetLocalZoneConnection() const
Definition pad.h:609
void SetTertiaryDrillSizeY(int aY)
Definition pad.cpp:824
int m_lengthPadToDie
Definition pad.h:1107
bool HasHole() const override
Definition pad.h:107
double GetThermalSpokeAngleDegrees() const
Definition pad.h:758
PAD * ClonePad() const
Same as Clone, but returns a PAD item.
Definition pad.h:1014
CUSTOM_SHAPE_ZONE_MODE GetCustomShapeInZoneOpt() const
Definition pad.h:222
int GetThermalGap() const
Definition pad.h:764
VECTOR2I ShapePos(PCB_LAYER_ID aLayer) const
Definition pad.cpp:1505
int GetSecondaryDrillSizeY() const
Definition pad.h:520
void SetSecondaryDrillSizeY(int aY)
Definition pad.cpp:771
PCB_LAYER_ID GetTopBackdrillLayer() const
Definition pad.h:1053
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Return a SHAPE_SEGMENT object representing the pad's hole.
Definition pad.cpp:1031
void SetOrientationDegrees(double aOrientation)
Definition pad.h:424
ZONE_CONNECTION GetZoneConnectionOverrides(wxString *aSource=nullptr) const
Definition pad.cpp:1733
void SetLayerSet(const LSET &aLayers) override
Definition pad.cpp:1588
bool SharesNetTieGroup(const PAD *aOther) const
Definition pad.cpp:307
PAD_SHAPE GetAnchorPadShape(PCB_LAYER_ID aLayer) const
Definition pad.h:214
void SetBottomBackdrillSize(std::optional< int > aSize)
Definition pad.h:1045
void SetRoundRectRadiusRatio(PCB_LAYER_ID aLayer, double aRadiusScale)
Has meaning only for rounded rectangle pads.
Definition pad.cpp:871
void ClearSecondaryDrillSize()
Definition pad.cpp:778
bool GetPrimaryDrillCappedFlag() const
Definition pad.h:511
PCB_LAYER_ID GetSecondaryDrillEndLayer() const
Definition pad.h:528
void SetSubRatsnest(int aSubRatsnest)
Definition pad.h:843
int GetLocalSpokeWidthOverride(wxString *aSource=nullptr) const
Definition pad.cpp:1753
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:2458
void SetPadToDieLength(int aLength)
Definition pad.h:575
bool IsFlipped() const
Definition pad.cpp:372
bool operator==(const PAD &aOther) const
Definition pad.cpp:3011
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:287
int GetPadToDieLength() const
Definition pad.h:576
void SetBackPostMachiningAngle(int aAngle)
Definition pad.h:481
BOX2I m_effectiveBoundingBox
Definition pad.h:1087
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:2206
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