KiCad PCB EDA Suite
class_pad.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2020 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 
30 #ifndef PAD_H_
31 #define PAD_H_
32 
33 #include "zones.h"
34 #include <board_connected_item.h>
35 #include <class_board_item.h>
36 #include <convert_to_biu.h>
38 #include <pad_shapes.h>
39 #include <pcbnew.h>
40 
41 class DRAWSEGMENT;
42 class PARAM_CFG;
43 
45 {
48 };
49 
50 class LINE_READER;
51 class EDA_3D_CANVAS;
52 class MODULE;
53 class EDGE_MODULE;
54 class TRACK;
55 class MSG_PANEL_INFO;
56 
57 namespace KIGFX
58 {
59  class VIEW;
60 }
61 
66 {
67 public:
70  // if thickness is not = 0 S_CIRCLE shape is a ring
72  int m_Radius;
73  double m_ArcAngle;
78  std::vector<wxPoint> m_Poly;
79 
81  m_Shape( aShape ), m_Thickness( 0 ), m_Radius( 0 ), m_ArcAngle( 0 )
82  {
83  }
84 
85  // Accessors (helpers for arc and circle shapes)
86  wxPoint GetCenter() { return m_Start; }
87  wxPoint GetArcStart() { return m_End; }
88 
89  // Geometric transform
93  void Move( wxPoint aMoveVector );
94 
100  void Rotate( const wxPoint& aRotCentre, double aAngle );
101 
106  void ExportTo( DRAWSEGMENT* aTarget );
107 
112  void ExportTo( EDGE_MODULE* aTarget );
113 };
114 
115 
117 {
118 public:
120 
122 public:
123  D_PAD( MODULE* parent );
124 
125  // Do not create a copy constructor & operator=.
126  // The ones generated by the compiler are adequate.
127 
128  /* Default layers used for pads, according to the pad type.
129  * this is default values only, they can be changed for a given pad
130  */
131  static LSET StandardMask();
132  static LSET SMDMask();
133  static LSET ConnSMDMask();
134  static LSET UnplatedHoleMask();
136  static LSET ApertureMask();
137 
138  static inline bool ClassOf( const EDA_ITEM* aItem )
139  {
140  return aItem && PCB_PAD_T == aItem->Type();
141  }
142 
143  bool IsType( const KICAD_T aScanTypes[] ) const override
144  {
145  if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
146  return true;
147 
148  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
149  {
150  if( m_Drill.x > 0 && m_Drill.y > 0 )
151  {
152  if( *p == PCB_LOCATE_HOLE_T )
153  return true;
155  return true;
157  return true;
158  }
159  }
160 
161  return false;
162  }
163 
164  MODULE* GetParent() const { return (MODULE*) m_Parent; }
165 
172  void ImportSettingsFrom( const D_PAD& aMasterPad );
173 
178  bool IsFlipped() const;
179 
184  void SetName( const wxString& aName )
185  {
186  m_name = aName;
187  }
188 
192  void SetPinFunction( const wxString& aName )
193  {
194  m_pinFunction = aName;
195  }
196 
200  const wxString& GetName() const
201  {
202  return m_name;
203  }
204 
208  const wxString& GetPinFunction() const
209  {
210  return m_pinFunction;
211  }
212 
213  bool PadNameEqual( const D_PAD* other ) const
214  {
215  return m_name == other->m_name; // hide tricks behind sensible API
216  }
217 
222  PAD_SHAPE_T GetShape() const { return m_padShape; }
223  void SetShape( PAD_SHAPE_T aShape ) { m_padShape = aShape; m_boundingRadius = -1; }
224 
225  void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
226  const wxPoint GetPosition() const override { return m_Pos; }
227 
233 
239  {
241  }
242 
249  {
250  m_customShapeClearanceArea = aOption;
251  }
252 
260  {
262  m_boundingRadius = -1;
263  }
264 
270  bool IsOnCopperLayer() const override
271  {
272  return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
273  }
274 
275  void SetY( int y ) { m_Pos.y = y; }
276  void SetX( int x ) { m_Pos.x = x; }
277 
278  void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; }
279  const wxPoint& GetPos0() const { return m_Pos0; }
280 
281  void SetY0( int y ) { m_Pos0.y = y; }
282  void SetX0( int x ) { m_Pos0.x = x; }
283 
284  void SetSize( const wxSize& aSize ) { m_Size = aSize; m_boundingRadius = -1; }
285  const wxSize& GetSize() const { return m_Size; }
286 
287  void SetDelta( const wxSize& aSize ) { m_DeltaSize = aSize; m_boundingRadius = -1; }
288  const wxSize& GetDelta() const { return m_DeltaSize; }
289 
290  void SetDrillSize( const wxSize& aSize ) { m_Drill = aSize; }
291  const wxSize& GetDrillSize() const { return m_Drill; }
292 
293  void SetOffset( const wxPoint& aOffset ) { m_Offset = aOffset; }
294  const wxPoint& GetOffset() const { return m_Offset; }
295 
306  void AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness,
307  bool aMergePrimitives = true );
308  void AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness,
309  bool aMergePrimitives = true );
310  void AddPrimitiveSegment( wxPoint aStart, wxPoint aEnd, int aThickness,
311  bool aMergePrimitives = true );
312  void AddPrimitiveCircle( wxPoint aCenter, int aRadius, int aThickness,
313  bool aMergePrimitives = true );
314  void AddPrimitiveArc( wxPoint aCenter, wxPoint aStart, int aArcAngle, int aThickness,
315  bool aMergePrimitives = true );
316  void AddPrimitiveCurve( wxPoint aStart, wxPoint aEnd, wxPoint aCtrl1, wxPoint aCtrl2,
317  int aThickness, bool aMergePrimitives = true );
318 
319 
320  bool GetBestAnchorPosition( VECTOR2I& aPos );
321 
333  bool MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon = NULL );
334 
338  void DeletePrimitivesList();
339 
353  wxPoint aPosition, double aRotation ) const;
354 
358  const std::vector<PAD_CS_PRIMITIVE>& GetPrimitives() const { return m_basicShapes; }
359 
364 
365  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
366 
370  void FlipPrimitives();
371 
377  void MirrorXPrimitives( int aX );
378 
384  bool SetPrimitives( const std::vector<PAD_CS_PRIMITIVE>& aPrimitivesList );
385 
391  bool AddPrimitives( const std::vector<PAD_CS_PRIMITIVE>& aPrimitivesList );
392 
393 
400  void SetOrientation( double aAngle );
401 
405  void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation*10.0 ); }
406 
411  double GetOrientation() const { return m_Orient; }
412  double GetOrientationDegrees() const { return m_Orient/10.0; }
413  double GetOrientationRadians() const { return m_Orient*M_PI/1800; }
414 
415  void SetDrillShape( PAD_DRILL_SHAPE_T aDrillShape )
416  { m_drillShape = aDrillShape; }
418 
431  void GetOblongGeometry( const wxSize& aDrillOrPadSize,
432  wxPoint* aStartPoint, wxPoint* aEndPoint, int* aWidth ) const;
433 
434  void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
435  LSET GetLayerSet() const override { return m_layerMask; }
436 
437  void SetAttribute( PAD_ATTR_T aAttribute );
438  PAD_ATTR_T GetAttribute() const { return m_Attribute; }
439 
440  void SetProperty( PAD_PROP_T aProperty );
441  PAD_PROP_T GetProperty() const { return m_Property; }
442 
443  // We don't currently have an attribute for APERTURE, and adding one will change the file
444  // format, so for now just infer a copper-less pad to be an APERTURE pad.
445  bool IsAperturePad() const { return ( m_layerMask & LSET::AllCuMask() ).none(); }
446 
447  void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; }
448  int GetPadToDieLength() const { return m_LengthPadToDie; }
449 
451  void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
452 
453  int GetLocalClearance() const { return m_LocalClearance; }
454  void SetLocalClearance( int aClearance ) { m_LocalClearance = aClearance; }
455 
457  void SetLocalSolderPasteMargin( int aMargin ) { m_LocalSolderPasteMargin = aMargin; }
458 
461 
462 
474  void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue,
475  int aMaxError = ARC_HIGH_DEF, bool ignoreLineWidth = false ) const override;
476 
487  int GetClearance( BOARD_ITEM* aItem = nullptr, wxString* aSource = nullptr ) const override;
488 
489  // Mask margins handling:
490 
502  int GetSolderMaskMargin() const;
503 
518  wxSize GetSolderPasteMargin() const;
519 
521  {
522  m_ZoneConnection = aType;
523  }
524 
526 
528  {
529  return m_ZoneConnection;
530  }
531 
532  void SetThermalWidth( int aWidth ) { m_ThermalWidth = aWidth; }
533  int GetThermalWidth() const;
534 
535  void SetThermalGap( int aGap ) { m_ThermalGap = aGap; }
536  int GetThermalGap() const;
537 
548  void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, double aRotation ) const;
549 
556  {
558  }
559 
569  int GetRoundRectCornerRadius( const wxSize& aSize ) const;
570 
575  void SetRoundRectCornerRadius( double aRadius );
576 
594  SHAPE_POLY_SET& aCornerBuffer, wxSize aInflateValue, int aError = ARC_HIGH_DEF ) const;
595 
607  SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aError = ARC_HIGH_DEF ) const;
608 
623  int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd,
624  double aRotation, const wxSize& aMargin ) const;
625 
631  int GetBoundingRadius() const
632  {
633  // Any member function which would affect this calculation should set
634  // m_boundingRadius to -1 to re-trigger the calculation from here.
635  // Currently that is only m_Size, m_DeltaSize, and m_padShape accessors.
636  if( m_boundingRadius == -1 )
637  {
639  }
640 
641  return m_boundingRadius;
642  }
643 
644  wxPoint ShapePos() const;
645 
653  double GetRoundRectRadiusRatio() const
654  {
656  }
657 
665  void SetRoundRectRadiusRatio( double aRadiusScale )
666  {
667  if( aRadiusScale < 0.0 )
668  aRadiusScale = 0.0;
669 
670  m_padRoundRectRadiusScale = std::min( aRadiusScale, 0.5 );
671  }
672 
679  double GetChamferRectRatio() const
680  {
681  return m_padChamferRectScale;
682  }
683 
690  void SetChamferRectRatio( double aChamferScale )
691  {
692  if( aChamferScale < 0.0 )
693  aChamferScale = 0.0;
694 
695  m_padChamferRectScale = std::min( aChamferScale, 0.5 );
696  }
697 
702  int GetChamferPositions() const { return m_chamferPositions; }
703 
710  void SetChamferPositions( int aChamferPositions )
711  {
712  m_chamferPositions = aChamferPositions;
713  }
714 
719  int GetSubRatsnest() const { return m_SubRatsnest; }
720  void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; }
721 
722  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
723 
724  bool IsOnLayer( PCB_LAYER_ID aLayer ) const override
725  {
726  return m_layerMask[aLayer];
727  }
728 
729  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
730  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
731 
732  wxString GetClass() const override
733  {
734  return wxT( "PAD" );
735  }
736 
737  // Virtual function:
738  const EDA_RECT GetBoundingBox() const override;
739 
741  void SetDrawCoord();
742 
743  //todo: Remove SetLocalCoord along with m_pos
745  void SetLocalCoord();
746 
752  static int Compare( const D_PAD* padref, const D_PAD* padcmp );
753 
754  void Move( const wxPoint& aMoveVector ) override
755  {
756  m_Pos += aMoveVector;
757  SetLocalCoord();
758  }
759 
760  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
761 
762  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
763 
764  BITMAP_DEF GetMenuImage() const override;
765 
770  wxString ShowPadShape() const;
771 
776  wxString ShowPadAttr() const;
777 
784  void AppendConfigs( std::vector<PARAM_CFG*>* aResult );
785 
786  EDA_ITEM* Clone() const override;
787 
792  D_PAD* ClonePad() const
793  {
794  return (D_PAD*) Clone();
795  }
796 
802  bool PadShouldBeNPTH() const;
803 
804  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
805 
806  virtual unsigned int ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
807 
808  virtual const BOX2I ViewBBox() const override;
809 
810  virtual void SwapData( BOARD_ITEM* aImage ) override;
811 
812 #if defined(DEBUG)
813  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
814 #endif
815 
816 
817 private:
822  int boundingRadius() const;
823 
824  bool buildCustomPadPolygon( SHAPE_POLY_SET* aMergedPolygon, int aError );
825 
826 private: // Private variable members:
827 
828  // Actually computed and cached on demand by the accessor
829  mutable int m_boundingRadius;
830 
831  wxString m_name;
832 
833  wxString m_pinFunction;
834 
835  // TODO: Remove m_Pos from Pad or make private. View positions calculated from m_Pos0
837 
839 
846  std::vector<PAD_CS_PRIMITIVE> m_basicShapes;
847 
852 
860 
862 
864  wxSize m_Drill;
865 
868  wxSize m_Size;
869 
871 
873  double m_padChamferRectScale;
875  int m_chamferPositions;
877 
879 
896 
898 
901  wxSize m_DeltaSize;
902 
904 
909 
910  double m_Orient;
911 
913 
918 
920 
923 
928 
931 };
932 
933 #endif // PAD_H_
int m_LocalClearance
Local clearance.
Definition: class_pad.h:917
int m_ThermalGap
Definition: class_pad.h:930
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
EDA_UNITS
Definition: common.h:196
int m_LocalSolderMaskMargin
Local mask margins: when 0, the parent footprint design values are used.
Definition: class_pad.h:921
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: class_pad.cpp:1438
static int m_PadSketchModePenSize
Pen size used to draw pads in sketch mode (mode used to print pads on silkscreen layer)
Definition: class_pad.h:119
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:41
double m_padRoundRectRadiusScale
scaling factor from smallest m_Size coord to corner radius, default 0.25
Definition: class_pad.h:872
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:450
int m_boundingRadius
radius of the circle containing the pad shape
Definition: class_pad.h:829
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_pad.cpp:1444
LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived to re...
Definition: richio.h:81
static bool ClassOf(const EDA_ITEM *aItem)
Definition: class_pad.h:138
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:178
std::vector< PAD_CS_PRIMITIVE > m_basicShapes
for free shape pads: a list of basic shapes, in local coordinates, orient 0, coordinates relative to ...
Definition: class_pad.h:846
double m_padChamferRectScale
scaling factor from smallest m_Size coord to chamfer value, default 0.25
Definition: class_pad.h:874
const wxPoint & GetPos0() const
Definition: class_pad.h:279
static LSET StandardMask()
layer set for a through hole pad
Definition: class_pad.cpp:94
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Definition: class_pad.cpp:1041
void FlipPrimitives()
Flip the basic shapes, in custom pads.
Definition: class_pad.cpp:509
PNG memory record (file in memory).
Definition: bitmap_def.h:29
wxString m_pinFunction
pin function in schematic
Definition: class_pad.h:833
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:131
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
Definition: class_pad.cpp:1381
PAD_ATTR_T
Enum PAD_ATTR_T is the set of pad shapes, used with D_PAD::{Set,Get}Attribute() The double name is fo...
Definition: pad_shapes.h:59
int m_LocalSolderPasteMargin
Local solder paste margin absolute value.
Definition: class_pad.h:922
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition: class_pad.cpp:115
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void AddPrimitiveArc(wxPoint aCenter, wxPoint aStart, int aArcAngle, int aThickness, bool aMergePrimitives=true)
arc basic shape
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:232
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: class_pad.cpp:101
void AddPrimitiveCurve(wxPoint aStart, wxPoint aEnd, wxPoint aCtrl1, wxPoint aCtrl2, int aThickness, bool aMergePrimitives=true)
curve basic shape
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
bool GetBestAnchorPosition(VECTOR2I &aPos)
int BuildSegmentFromOvalShape(wxPoint &aSegStart, wxPoint &aSegEnd, double aRotation, const wxSize &aMargin) const
Function BuildSegmentFromOvalShape Has meaning only for OVAL (and ROUND) pads Build an equivalent seg...
Definition: class_pad.cpp:226
D_PAD(MODULE *parent)
Definition: class_pad.cpp:50
double GetOrientationDegrees() const
Definition: class_pad.h:412
bool AddPrimitives(const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
Add to the basic shape list.
void ExportTo(DRAWSEGMENT *aTarget)
Export the PAD_CS_PRIMITIVE parameters to a DRAWSEGMENT useful to draw a primitive shape.
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:74
bool BuildPadDrillShapePolygon(SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, int aError=ARC_HIGH_DEF) const
Function BuildPadDrillShapePolygon Build the Corner list of the polygonal drill shape,...
bool IsFlipped() const
Definition: class_pad.cpp:129
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:868
int GetPadToDieLength() const
Definition: class_pad.h:448
bool PadNameEqual(const D_PAD *other) const
Definition: class_pad.h:213
void BuildPadShapePolygon(SHAPE_POLY_SET &aCornerBuffer, wxSize aInflateValue, int aError=ARC_HIGH_DEF) const
Function BuildPadShapePolygon Build the Corner list of the polygonal shape, depending on shape,...
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:46
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:225
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
void Move(wxPoint aMoveVector)
returns the start point of an arc
int m_SubRatsnest
variable used in rats nest computations handle subnet (block) number in ratsnest connection
Definition: class_pad.h:861
void SetSubRatsnest(int aSubRatsnest)
Definition: class_pad.h:720
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:290
PAD_CS_PRIMITIVE(STROKE_T aShape)
Definition: class_pad.h:80
wxString GetClass() const override
Function GetClass returns the class name.
Definition: class_pad.h:732
void SetRoundRectRadiusRatio(double aRadiusScale)
has meaning only for rounded rect pads Set the scaling factor between the smaller Y or Y size and the...
Definition: class_pad.h:665
const wxString & GetPinFunction() const
Definition: class_pad.h:208
wxString ShowPadAttr() const
Function ShowPadAttr.
Definition: class_pad.cpp:1407
The base class for create windows for drawing purpose.
PAD_PROP_T m_Property
property in fab files (BGA, FIDUCIAL, TEST POINT, CASTELLATED)
Definition: class_pad.h:908
void SetY0(int y)
Definition: class_pad.h:281
int GetThermalGap() const
Definition: class_pad.cpp:761
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
PAD_DRILL_SHAPE_T
Enum PAD_DRILL_SHAPE_T is the set of pad drill shapes, used with D_PAD::{Set,Get}DrillShape()
Definition: pad_shapes.h:47
int GetLocalClearance() const
Definition: class_pad.h:453
wxPoint m_Ctrl1
is also the start point of the arc
Definition: class_pad.h:76
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
PAD_SHAPE_T
Enum PAD_SHAPE_T is the set of pad shapes, used with D_PAD::{Set,Get}Shape()
Definition: pad_shapes.h:31
void SetLocalCoord()
Set relative coordinates.
Definition: class_pad.cpp:439
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:438
void AddPrimitivePoly(const SHAPE_POLY_SET &aPoly, int aThickness, bool aMergePrimitives=true)
Has meaning only for free shape pads.
int GetChamferPositions() const
has meaning only for chamfered rect pads
Definition: class_pad.h:702
ZONE_CONNECTION GetLocalZoneConnection() const
Definition: class_pad.h:527
ZONE_CONNECTION m_ZoneConnection
how the connection to zone is made: no connection, thermal relief ...
Definition: class_pad.h:927
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:259
int GetSolderMaskMargin() const
Function GetSolderMaskMargin.
Definition: class_pad.cpp:642
PCB_LAYER_ID
A quick note on layer IDs:
wxString m_name
pad name (pin number in schematic)
Definition: class_pad.h:831
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers.
Definition: class_pad.cpp:1578
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:72
LSET is a set of PCB_LAYER_IDs.
const std::vector< PAD_CS_PRIMITIVE > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:358
std::vector< wxPoint > m_Poly
Bezier Control point 2.
Definition: class_pad.h:78
#define NULL
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12).
Definition: class_pad.h:184
SHAPE_POLY_SET.
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:278
wxString ShowPadShape() const
Function ShowPadShape.
Definition: class_pad.cpp:1391
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: class_pad.cpp:1420
bool IsOnCopperLayer() const override
Definition: class_pad.h:270
static int Compare(const D_PAD *padref, const D_PAD *padcmp)
Function Compare compares two pads and return 0 if they are equal.
Definition: class_pad.cpp:1325
const wxPoint & GetOffset() const
Definition: class_pad.h:294
ZONE_CONNECTION GetZoneConnection() const
Definition: class_pad.cpp:739
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:417
double GetChamferRectRatio() const
has meaning only for chamfered rect pads
Definition: class_pad.h:679
int GetThermalWidth() const
Definition: class_pad.cpp:750
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:65
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:435
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
How to build the custom shape in zone, to create the clearance area: CUST_PAD_SHAPE_IN_ZONE_OUTLINE =...
Definition: class_pad.h:859
void SetThermalWidth(int aWidth)
Definition: class_pad.h:532
void Move(const wxPoint &aMoveVector) override
Function Move move this object.
Definition: class_pad.h:754
const wxString & GetName() const
Definition: class_pad.h:200
void SetSize(const wxSize &aSize)
Definition: class_pad.h:284
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.h:631
STROKE_T
Enum STROKE_T is the set of shapes for segments (graphic segments and tracks) which are often in the ...
void SetOrientationDegrees(double aOrientation)
Set orientation in degrees.
Definition: class_pad.h:405
int m_ThermalWidth
Definition: class_pad.h:929
void SetRoundRectCornerRadius(double aRadius)
Set the rounded rectangle radius ratio based on a given radius.
Definition: class_pad.cpp:210
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.
Definition: class_pad.cpp:1457
virtual bool IsType(const KICAD_T aScanTypes[]) const
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:269
PAD_PROP_T
Enum PAD_PROP_T is the set of pad properties used in Gerber files (Draw files, and P&P files) to defi...
Definition: pad_shapes.h:76
SHAPE_POLY_SET m_customShapeAsPolygon
for free shape pads: the set of basic shapes, merged as one polygon, in local coordinates,...
Definition: class_pad.h:851
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: class_pad.h:520
PAD_PROP_T GetProperty() const
Definition: class_pad.h:441
PAD_SHAPE_T m_anchorPadShape
for custom shaped pads: shape of pad anchor, PAD_SHAPE_RECT, PAD_SHAPE_CIRCLE
Definition: class_pad.h:878
void SetPadToDieLength(int aLength)
Definition: class_pad.h:447
virtual unsigned int ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Function ViewGetLOD() Returns the level of detail (LOD) of the item.
Definition: class_pad.cpp:1531
const wxSize & GetDelta() const
Definition: class_pad.h:288
void SetDrawCoord()
Set absolute coordinates.
Definition: class_pad.cpp:423
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:901
wxPoint m_End
is also the center of the circle and arc
Definition: class_pad.h:75
PAD_DRILL_SHAPE_T m_drillShape
PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG.
Definition: class_pad.h:870
STROKE_T m_Shape
Definition: class_pad.h:68
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:454
D_PAD * ClonePad() const
same as Clone, but returns a D_PAD item.
Definition: class_pad.h:792
CUST_PAD_SHAPE_IN_ZONE
Definition: class_pad.h:44
wxPoint m_Ctrl2
Bezier Control point 1.
Definition: class_pad.h:77
void SetLocalClearance(int aClearance)
Definition: class_pad.h:454
int m_chamferPositions
the positions of the chamfered position for a 0 orientation
Definition: class_pad.h:876
bool buildCustomPadPolygon(SHAPE_POLY_SET *aMergedPolygon, int aError)
double GetOrientationRadians() const
Definition: class_pad.h:413
void AddPrimitiveCircle(wxPoint aCenter, int aRadius, int aThickness, bool aMergePrimitives=true)
ring or circle basic shape
MODULE * GetParent() const
Definition: class_pad.h:164
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:460
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: class_pad.h:238
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:69
void BuildPadPolygon(wxPoint aCoord[4], wxSize aInflateValue, double aRotation) const
Function BuildPadPolygon Has meaning only for polygonal pads (trapezoid and rectangular) Build the Co...
Definition: class_pad.cpp:772
wxPoint GetArcStart()
returns the center of a circle or arc
Definition: class_pad.h:87
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:897
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aMaxError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon Used in filli...
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
Definition: class_pad.cpp:1667
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:434
void SetY(int y)
Definition: class_pad.h:275
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:415
wxSize GetSolderPasteMargin() const
Function GetSolderPasteMargin.
Definition: class_pad.cpp:687
wxPoint m_Pos0
Initial Pad position (i.e.
Definition: class_pad.h:903
PARAM_CFG is a base class which establishes the interface functions ReadParam and SaveParam,...
Definition: config_params.h:99
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:451
int m_LengthPadToDie
Length net from pad to die, inside the package.
Definition: class_pad.h:912
bool IsType(const KICAD_T aScanTypes[]) const override
Function IsType Checks whether the item is one of the listed types.
Definition: class_pad.h:143
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:411
void CustomShapeAsPolygonToBoardPosition(SHAPE_POLY_SET *aMergedPolygon, wxPoint aPosition, double aRotation) const
When created, the corners coordinates are relative to the pad position, orientation 0,...
void ImportSettingsFrom(const D_PAD &aMasterPad)
Imports the pad settings from aMasterPad.
Definition: class_pad.cpp:1594
void AddPrimitiveSegment(wxPoint aStart, wxPoint aEnd, int aThickness, bool aMergePrimitives=true)
segment basic shape
const wxSize & GetDrillSize() const
Definition: class_pad.h:291
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
Definition: class_pad.cpp:476
wxPoint ShapePos() const
Definition: class_pad.cpp:601
wxPoint GetCenter()
Definition: class_pad.h:86
const SHAPE_POLY_SET & GetCustomShapeAsPolygon() const
Accessor to the custom shape as one polygon.
Definition: class_pad.h:363
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool IsAperturePad() const
Definition: class_pad.h:445
int GetSubRatsnest() const
Function GetSubRatsnest.
Definition: class_pad.h:719
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
Definition: class_pad.cpp:916
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:223
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition: class_pad.h:192
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:555
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:469
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:653
PAD_ATTR_T m_Attribute
PAD_ATTRIB_NORMAL, PAD_ATTRIB_SMD, PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED.
Definition: class_pad.h:906
void SetChamferRectRatio(double aChamferScale)
has meaning only for chamfered rect pads Set the ratio between the smaller Y or Y size and the radius...
Definition: class_pad.h:690
int boundingRadius() const
Function boundingRadius returns a calculated radius of a bounding circle for this pad.
Definition: class_pad.cpp:136
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:457
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition: class_pad.cpp:108
void SetCustomShapeInZoneOpt(CUST_PAD_SHAPE_IN_ZONE aOption)
Set the option for the custom pad shape to use as clearance area in copper zones.
Definition: class_pad.h:248
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:864
void SetX0(int x)
Definition: class_pad.h:282
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:222
double m_Orient
in 1/10 degrees
Definition: class_pad.h:910
static LSET ApertureMask()
layer set for an aperture pad
Definition: class_pad.cpp:122
double m_LocalSolderPasteMarginRatio
Local solder mask margin ratio value of pad size The final margin is the sum of these 2 values.
Definition: class_pad.h:924
wxPoint m_Offset
m_Offset is useful only for oblong and rect pads (it can be used for other shapes,...
Definition: class_pad.h:895
VIEW.
Definition: view.h:61
const wxSize & GetSize() const
Definition: class_pad.h:285
void SetProperty(PAD_PROP_T aProperty)
Definition: class_pad.cpp:463
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Function IsOnLayer tests to see if this object is on the given layer.
Definition: class_pad.h:724
const wxPoint GetPosition() const override
Definition: class_pad.h:226
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:456
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:293
int GetClearance(BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const override
Function GetClearance returns the clearance in internal units.
Definition: class_pad.cpp:616
bool PadShouldBeNPTH() const
A pad whose hole is the same size as the pad is a NPTH.
Definition: class_pad.cpp:1450
void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotates the primitive about a point.
void GetOblongGeometry(const wxSize &aDrillOrPadSize, wxPoint *aStartPoint, wxPoint *aEndPoint, int *aWidth) const
Function GetOblongGeometry calculates the start point, end point and width of an equivalent segment w...
Definition: class_pad.cpp:1008
void SetX(int x)
Definition: class_pad.h:276
void SetThermalGap(int aGap)
Definition: class_pad.h:535
void MirrorXPrimitives(int aX)
Mirror the primitives about a coordinate.
Definition: class_pad.cpp:537
bool SetPrimitives(const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
Import to the basic shape list.
void DeletePrimitivesList()
clear the basic shapes list
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: class_pad.cpp:260
double m_ArcAngle
radius of a circle
Definition: class_pad.h:73
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:459
void AppendConfigs(std::vector< PARAM_CFG * > *aResult)
Function AppendConfigs appends to aResult the configuration setting accessors which will later allow ...
Definition: class_pad.cpp:569
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:287
PAD_SHAPE_T m_padShape
Shape: PAD_SHAPE_CIRCLE, PAD_SHAPE_RECT, PAD_SHAPE_OVAL, PAD_SHAPE_TRAPEZOID, PAD_SHAPE_ROUNDRECT,...
Definition: class_pad.h:838
KICAD_T Type() const
Function Type()
Definition: base_struct.h:197
void SetChamferPositions(int aChamferPositions)
has meaning only for chamfered rect pads set the position of the chamfer for a 0 orientation,...
Definition: class_pad.h:710
wxPoint m_Pos
pad Position on board
Definition: class_pad.h:836