KiCad PCB EDA Suite
D_PAD Class Reference

#include <class_pad.h>

Inheritance diagram for D_PAD:
BOARD_CONNECTED_ITEM BOARD_ITEM EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Member Functions

 D_PAD (MODULE *parent)
 
 D_PAD (const D_PAD &aPad)
 
D_PADoperator= (const D_PAD &aOther)
 
bool IsType (const KICAD_T aScanTypes[]) const override
 Function IsType Checks whether the item is one of the listed types. More...
 
MODULEGetParent () const
 
void ImportSettingsFrom (const D_PAD &aMasterPad)
 Imports the pad settings from aMasterPad. More...
 
bool IsFlipped () const
 
void SetName (const wxString &aName)
 Set the pad name (sometimes called pad number, although it can be an array reference like AA12). More...
 
const wxString & GetName () const
 
void SetPinFunction (const wxString &aName)
 Set the pad function (pin name in schematic) More...
 
const wxString & GetPinFunction () const
 
bool PadNameEqual (const D_PAD *other) const
 
void SetShape (PAD_SHAPE_T aShape)
 Set the new shape of this pad. More...
 
PAD_SHAPE_T GetShape () const
 
void SetPosition (const wxPoint &aPos) override
 
wxPoint GetPosition () const override
 
PAD_SHAPE_T GetAnchorPadShape () const
 Function GetAnchorPadShape. More...
 
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt () const
 
void SetCustomShapeInZoneOpt (CUST_PAD_SHAPE_IN_ZONE aOption)
 Set the option for the custom pad shape to use as clearance area in copper zones. More...
 
void SetAnchorPadShape (PAD_SHAPE_T aShape)
 Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads. More...
 
bool IsOnCopperLayer () const override
 
void SetY (int y)
 
void SetX (int x)
 
void SetPos0 (const wxPoint &aPos)
 
const wxPointGetPos0 () const
 
void SetY0 (int y)
 
void SetX0 (int x)
 
void SetSize (const wxSize &aSize)
 
const wxSize & GetSize () const
 
void SetDelta (const wxSize &aSize)
 
const wxSize & GetDelta () const
 
void SetDrillSize (const wxSize &aSize)
 
const wxSize & GetDrillSize () const
 
void SetOffset (const wxPoint &aOffset)
 
const wxPointGetOffset () const
 
void AddPrimitivePoly (const SHAPE_POLY_SET &aPoly, int aThickness)
 Has meaning only for custom shape pads. More...
 
void AddPrimitivePoly (const std::vector< wxPoint > &aPoly, int aThickness)
 
void AddPrimitiveSegment (const wxPoint &aStart, const wxPoint &aEnd, int aThickness)
 
void AddPrimitiveCircle (const wxPoint &aCenter, int aRadius, int aThickness)
 
void AddPrimitiveRect (const wxPoint &aStart, const wxPoint &aEnd, int aThickness)
 
void AddPrimitiveArc (const wxPoint &aCenter, const wxPoint &aStart, int aArcAngle, int aThickness)
 
void AddPrimitiveCurve (const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &aCtrl1, const wxPoint &aCtrl2, int aThickness)
 
bool GetBestAnchorPosition (VECTOR2I &aPos)
 
void MergePrimitivesAsPolygon (SHAPE_POLY_SET *aMergedPolygon, PCB_LAYER_ID aLayer) const
 Merge all basic shapes to a SHAPE_POLY_SET Note: The results are relative to the pad position, orientation 0. More...
 
void DeletePrimitivesList ()
 clear the basic shapes list More...
 
const std::vector< std::shared_ptr< DRAWSEGMENT > > & GetPrimitives () const
 Accessor to the basic shape list for custom-shaped pads. More...
 
void Flip (const wxPoint &aCentre, bool aFlipLeftRight) override
 Function Flip Flip this object, i.e. More...
 
void FlipPrimitives (bool aFlipLeftRight)
 Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pads. More...
 
void ReplacePrimitives (const std::vector< std::shared_ptr< DRAWSEGMENT >> &aPrimitivesList)
 Clear the current custom shape primitives list and import a new list. More...
 
void AppendPrimitives (const std::vector< std::shared_ptr< DRAWSEGMENT >> &aPrimitivesList)
 Import a custom shape primites list (composed of basic shapes) and add items to the current list. More...
 
void AddPrimitive (DRAWSEGMENT *aPrimitive)
 Add item to the custom shape primitives list. More...
 
void SetOrientation (double aAngle)
 Function SetOrientation sets the rotation angle of the pad. More...
 
void SetOrientationDegrees (double aOrientation)
 Set orientation in degrees. More...
 
double GetOrientation () const
 Function GetOrientation returns the rotation angle of the pad in a variety of units (the basic call returns tenths of degrees). More...
 
double GetOrientationDegrees () const
 
double GetOrientationRadians () const
 
void SetDrillShape (PAD_DRILL_SHAPE_T aShape)
 
PAD_DRILL_SHAPE_T GetDrillShape () const
 
bool IsDirty () const
 
void SetDirty ()
 
void SetLayerSet (LSET aLayers) override
 
LSET GetLayerSet () const override
 Function GetLayerSet returns a std::bitset of all layers on which the item physically resides. More...
 
void SetAttribute (PAD_ATTR_T aAttribute)
 
PAD_ATTR_T GetAttribute () const
 
void SetProperty (PAD_PROP_T aProperty)
 
PAD_PROP_T GetProperty () const
 
bool IsAperturePad () const
 
void SetPadToDieLength (int aLength)
 
int GetPadToDieLength () const
 
int GetLocalSolderMaskMargin () const
 
void SetLocalSolderMaskMargin (int aMargin)
 
int GetLocalClearance (wxString *aSource) const override
 Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system. More...
 
int GetLocalClearance () const
 
void SetLocalClearance (int aClearance)
 
int GetLocalSolderPasteMargin () const
 
void SetLocalSolderPasteMargin (int aMargin)
 
double GetLocalSolderPasteMarginRatio () const
 
void SetLocalSolderPasteMarginRatio (double aRatio)
 
void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aMaxError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
 Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon. More...
 
bool TransformHoleWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, int aError=ARC_HIGH_DEF) const
 Function TransformHoleWithClearanceToPolygon Build the Corner list of the polygonal drill shape in the board coordinate system. More...
 
virtual std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
 Function GetEffectiveShape Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon (PCB_LAYER_ID=UNDEFINED_LAYER) const
 
const SHAPE_SEGMENTGetEffectiveHoleShape () const
 Function GetEffectiveHoleShape Returns a SHAPE object representing the pad's hole. More...
 
int GetBoundingRadius () const
 Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad. More...
 
int GetLocalClearanceOverrides (wxString *aSource) const override
 Function GetLocalClearanceOverrides returns any local clearance overrides set in the "classic" (ie: pre-rule) system. More...
 
int GetSolderMaskMargin () const
 Function GetSolderMaskMargin. More...
 
wxSize GetSolderPasteMargin () const
 Function GetSolderPasteMargin. More...
 
void SetZoneConnection (ZONE_CONNECTION aType)
 
ZONE_CONNECTION GetZoneConnection () const
 
ZONE_CONNECTION GetEffectiveZoneConnection (wxString *aSource=nullptr) const
 Return the zone connection in effect (either locally overridden or overridden in the parent module). More...
 
void SetThermalSpokeWidth (int aWidth)
 Set the width of the thermal spokes connecting the pad to a zone. More...
 
int GetThermalSpokeWidth () const
 
int GetEffectiveThermalSpokeWidth (wxString *aSource=nullptr) const
 Return the effective thermal spoke width having resolved any inheritance. More...
 
void SetThermalGap (int aGap)
 
int GetThermalGap () const
 
int GetEffectiveThermalGap (wxString *aSource=nullptr) const
 Return the effective thermal gap having resolved any inheritance. More...
 
void SetRoundRectCornerRadius (double aRadius)
 Function SetRoundRectCornerRadius has meaning only for rounded rect pads. More...
 
int GetRoundRectCornerRadius () const
 
wxPoint ShapePos () const
 
void SetRoundRectRadiusRatio (double aRadiusScale)
 has meaning only for rounded rect pads Set the ratio between the smaller X or Y size and the rounded corner radius. More...
 
double GetRoundRectRadiusRatio () const
 
void SetChamferRectRatio (double aChamferScale)
 has meaning only for chamfered rect pads Set the ratio between the smaller X or Y size and chamfered corner size. More...
 
double GetChamferRectRatio () const
 
void SetChamferPositions (int aPositions)
 has meaning only for chamfered rect pads set the position of the chamfers for orientation 0. More...
 
int GetChamferPositions () const
 
int GetSubRatsnest () const
 Function GetSubRatsnest. More...
 
void SetSubRatsnest (int aSubRatsnest)
 
void SetRemoveUnconnected (bool aSet)
 Sets the unconnected removal property. More...
 
bool GetRemoveUnconnected () const
 
void SetKeepTopBottom (bool aSet)
 Sets whether we keep the top and bottom connections even if they are not connected. More...
 
bool GetKeepTopBottom () const
 
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 display purposes. More...
 
bool IsOnLayer (PCB_LAYER_ID aLayer) const override
 Function IsOnLayer tests to see if this object is on the given layer. More...
 
bool IsPadOnLayer (int aLayer) const
 
bool IsPadOnLayer (LSET aLayers) const
 
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. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
bool Collide (const SHAPE_SEGMENT *aSeg, int aMinClearance, int *aActual=nullptr)
 
bool Collide (const D_PAD *aPad, int aMinClearance, int *aActual=nullptr)
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox The bounding box is cached, so this will be efficient most of the time. More...
 
void SetDrawCoord ()
 

Set absolute coordinates.

More...
 
void SetLocalCoord ()
 

Set relative coordinates.

More...
 
void Move (const wxPoint &aMoveVector) override
 Function Move move this object. More...
 
void Rotate (const wxPoint &aRotCentre, double aAngle) override
 Function Rotate Rotate this object. More...
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAP_DEF GetMenuImage () const override
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
wxString ShowPadShape () const
 Function ShowPadShape. More...
 
wxString ShowPadAttr () const
 Function ShowPadAttr. More...
 
EDA_ITEMClone () const override
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
D_PADClonePad () const
 same as Clone, but returns a D_PAD item. More...
 
bool PadShouldBeNPTH () const
 A pad whose hole is the same size as the pad is a NPTH. More...
 
void BuildEffectiveShapes (PCB_LAYER_ID aLayer) const
 Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
double ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void SwapData (BOARD_ITEM *aImage) override
 Swap data between aItem and aImage. More...
 
bool IsConnected () const override
 

More...
 
NETINFO_ITEMGetNet () const
 Function GetNet Returns NET_INFO object for a given item. More...
 
void SetNet (NETINFO_ITEM *aNetInfo)
 Function SetNet Sets a NET_INFO object for the item. More...
 
int GetNetCode () const
 Function GetNetCode. More...
 
bool SetNetCode (int aNetCode, bool aNoAssert)
 Sets net using a net code. More...
 
void SetNetCode (int aNetCode)
 
wxString GetNetname () const
 Function GetNetname. More...
 
wxString GetNetnameMsg () const
 Function GetNetnameMsg. More...
 
wxString GetShortNetname () const
 Function GetShortNetname. More...
 
virtual int GetClearance (PCB_LAYER_ID aLayer, BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const
 Function GetClearance returns the clearance in internal units. More...
 
NETCLASSGetNetClass () const
 Function GetNetClassPtr returns the NETCLASS for this item. More...
 
NETCLASSGetEffectiveNetclass () const
 Function GetEffectiveNetclass returns the NETCLASS for this item, or the default netclass if none is defined. More...
 
wxString GetNetClassName () const
 Function GetNetClassName returns a pointer to the netclass of the zone. More...
 
void SetLocalRatsnestVisible (bool aVisible)
 
bool GetLocalRatsnestVisible () const
 
void SetGroup (const KIID &aGroup)
 Set the group that this item belongs to. More...
 
const KIIDGetGroup () const
 Get the group this item belongs to. More...
 
bool IsInGroup ()
 Test if this item is inside a group. More...
 
int GetX () const
 
int GetY () const
 
virtual wxPoint GetCenter () const
 Function GetCenter() More...
 
virtual PCB_LAYER_ID GetLayer () const
 Function GetLayer returns the primary layer this item is on. More...
 
virtual void SetLayer (PCB_LAYER_ID aLayer)
 Function SetLayer sets the layer this item is on. More...
 
virtual BOARD_ITEMDuplicate () const
 Function Duplicate creates a copy of a BOARD_ITEM. More...
 
bool IsTrack () const
 Function IsTrack tests to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 Function IsLocked. More...
 
virtual void SetLocked (bool aLocked)
 Function SetLocked modifies 'lock' status for of the item. More...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after removing from its parent if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
virtual BOARDGetBoard () const
 Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
wxString GetLayerName () const
 Function GetLayerName returns the name of the PCB layer on which the item resides. More...
 
KICAD_T Type () const
 Function Type() More...
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag)
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual const wxPoint GetFocusPosition () const
 Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 

Static Public Member Functions

static LSET StandardMask ()
 layer set for a through hole pad More...
 
static LSET SMDMask ()
 layer set for a SMD pad on Front layer More...
 
static LSET ConnSMDMask ()
 layer set for a SMD pad on Front layer used for edge board connectors More...
 
static LSET UnplatedHoleMask ()
 layer set for a mechanical unplated through hole pad More...
 
static LSET ApertureMask ()
 layer set for an aperture pad More...
 
static bool ClassOf (const EDA_ITEM *aItem)
 
static int Compare (const D_PAD *padref, const D_PAD *padcmp)
 Function Compare compares two pads and return 0 if they are equal. More...
 
static wxString ShowShape (STROKE_T aShape)
 Function ShowShape converts the enum STROKE_T integer value to a wxString. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
static bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

const KIID m_Uuid
 

Static Public Attributes

static wxPoint ZeroOffset
 A value of wxPoint(0,0) which can be passed to the Draw() functions. More...
 

Protected Member Functions

virtual wxString LayerMaskDescribe () const
 Helper function Return a string (to be shown to the user) describing a layer mask. More...
 
bool Matches (const wxString &aText, wxFindReplaceData &aSearchData)
 Function Matches compares aText against search criteria in aSearchData. More...
 

Protected Attributes

NETINFO_ITEMm_netinfo
 Stores all informations about the net that item belongs to. More...
 
PCB_LAYER_ID m_Layer
 
KIID m_groupUuid
 
STATUS_FLAGS m_Status
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
STATUS_FLAGS m_Flags
 

Private Member Functions

void addPadPrimitivesToPolygon (SHAPE_POLY_SET *aMergedPolygon, PCB_LAYER_ID aLayer, int aError) const
 

Private Attributes

wxString m_name
 
wxString m_pinFunction
 
wxPoint m_pos
 
PAD_SHAPE_T m_padShape
 
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
 
bool m_shapesDirty
 
int m_effectiveBoundingRadius
 
EDA_RECT m_effectiveBoundingBox
 
std::shared_ptr< SHAPE_COMPOUNDm_effectiveShape
 
std::shared_ptr< SHAPE_SEGMENTm_effectiveHoleShape
 
std::shared_ptr< SHAPE_POLY_SETm_effectivePolygon
 
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
 
int m_subRatsnest
 
wxSize m_drill
 
wxSize m_size
 
PAD_DRILL_SHAPE_T m_drillShape
 
double m_roundedCornerScale
 
double m_chamferScale
 
int m_chamferPositions
 
PAD_SHAPE_T m_anchorPadShape
 
wxPoint m_offset
 
LSET m_layerMask
 
wxSize m_deltaSize
 
wxPoint m_pos0
 
PAD_ATTR_T m_attribute
 
PAD_PROP_T m_property
 
double m_orient
 
int m_lengthPadToDie
 
bool m_removeUnconnectedLayer
 
bool m_keepTopBottomLayer
 
int m_localClearance
 
int m_localSolderMaskMargin
 
int m_localSolderPasteMargin
 
double m_localSolderPasteMarginRatio
 
ZONE_CONNECTION m_zoneConnection
 
int m_thermalWidth
 
int m_thermalGap
 

Detailed Description

Definition at line 64 of file class_pad.h.

Constructor & Destructor Documentation

◆ D_PAD() [1/2]

D_PAD::D_PAD ( MODULE parent)

Definition at line 56 of file class_pad.cpp.

56  :
58 {
59  m_size.x = m_size.y = Mils2iu( 60 ); // Default pad size 60 mils.
60  m_drill.x = m_drill.y = Mils2iu( 30 ); // Default drill size 30 mils.
61  m_orient = 0; // Pad rotation in 1/10 degrees.
62  m_lengthPadToDie = 0;
63 
64  if( m_Parent && m_Parent->Type() == PCB_MODULE_T )
65  {
67  }
68 
69  SetShape( PAD_SHAPE_CIRCLE ); // Default pad shape is PAD_CIRCLE.
70  SetAnchorPadShape( PAD_SHAPE_CIRCLE ); // Default shape for custom shaped pads
71  // is PAD_CIRCLE.
72  SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); // Default pad drill shape is a circle.
73  m_attribute = PAD_ATTRIB_STANDARD; // Default pad type is NORMAL (thru hole)
74  SetProperty( PAD_PROP_NONE ); // no special fabrication property
75  m_localClearance = 0;
79  // Parameters for round rect only:
80  m_roundedCornerScale = 0.25; // from IPC-7351C standard
81  // Parameters for chamfered rect only:
82  m_chamferScale = 0.2; // Size of chamfer: ratio of smallest of X,Y size
83  m_chamferPositions = RECT_NO_CHAMFER; // No chamfered corner
84 
85  m_zoneConnection = ZONE_CONNECTION::INHERITED; // Use parent setting by default
86  m_thermalWidth = 0; // Use parent setting by default
87  m_thermalGap = 0; // Use parent setting by default
88 
90 
91  // Set layers mask to default for a standard thru hole pad.
93 
94  SetSubRatsnest( 0 ); // used in ratsnest calculations
95 
96  m_shapesDirty = true;
99  m_keepTopBottomLayer = true;
100 }
double m_roundedCornerScale
Definition: class_pad.h:671
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
static LSET StandardMask()
layer set for a through hole pad
Definition: class_pad.cpp:141
no special fabrication property
Definition: pad_shapes.h:97
bool m_shapesDirty
Definition: class_pad.h:649
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
double m_orient
Definition: class_pad.h:703
wxSize m_size
Definition: class_pad.h:667
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
void SetSubRatsnest(int aSubRatsnest)
Definition: class_pad.h:510
int m_localSolderPasteMargin
Definition: class_pad.h:722
int m_localClearance
Definition: class_pad.h:720
int m_localSolderMaskMargin
Definition: class_pad.h:721
bool m_keepTopBottomLayer
Definition: class_pad.h:708
int m_thermalGap
Definition: class_pad.h:728
class MODULE, a footprint
Definition: typeinfo.h:89
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:198
double m_chamferScale
Definition: class_pad.h:673
PAD_ATTR_T m_attribute
Definition: class_pad.h:699
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: class_pad.h:661
int m_effectiveBoundingRadius
Definition: class_pad.h:650
double m_localSolderPasteMarginRatio
Definition: class_pad.h:723
int m_chamferPositions
Definition: class_pad.h:675
MODULE * GetParent() const
Definition: class_pad.h:111
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
Definition: class_pad.h:325
LSET m_layerMask
Definition: class_pad.h:689
ZONE_CONNECTION m_zoneConnection
Definition: class_pad.h:726
int m_thermalWidth
Definition: class_pad.h:727
wxSize m_drill
Definition: class_pad.h:666
void SetShape(PAD_SHAPE_T aShape)
Set the new shape of this pad.
Definition: class_pad.h:148
wxPoint GetPosition() const override
Definition: class_module.h:219
int m_lengthPadToDie
Definition: class_pad.h:705
wxPoint m_pos
Definition: class_pad.h:637
void SetProperty(PAD_PROP_T aProperty)
Definition: class_pad.cpp:511
bool m_removeUnconnectedLayer
Definition: class_pad.h:707
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References CUST_PAD_SHAPE_IN_ZONE_OUTLINE, GetParent(), MODULE::GetPosition(), INHERITED, m_attribute, m_chamferPositions, m_chamferScale, m_customShapeClearanceArea, m_drill, m_effectiveBoundingRadius, m_keepTopBottomLayer, m_layerMask, m_lengthPadToDie, m_localClearance, m_localSolderMaskMargin, m_localSolderPasteMargin, m_localSolderPasteMarginRatio, m_orient, EDA_ITEM::m_Parent, m_pos, m_removeUnconnectedLayer, m_roundedCornerScale, m_shapesDirty, m_size, m_thermalGap, m_thermalWidth, m_zoneConnection, PAD_ATTRIB_STANDARD, PAD_DRILL_SHAPE_CIRCLE, PAD_PROP_NONE, PAD_SHAPE_CIRCLE, PCB_MODULE_T, RECT_NO_CHAMFER, SetAnchorPadShape(), SetDrillShape(), SetProperty(), SetShape(), SetSubRatsnest(), StandardMask(), and EDA_ITEM::Type().

Referenced by Clone().

◆ D_PAD() [2/2]

D_PAD::D_PAD ( const D_PAD aPad)

Definition at line 103 of file class_pad.cpp.

103  :
104  BOARD_CONNECTED_ITEM( aOther.GetParent(), PCB_PAD_T )
105 {
107 
108  ImportSettingsFrom( aOther );
109  SetPadToDieLength( aOther.GetPadToDieLength() );
110  SetPosition( aOther.GetPosition() );
111  SetPos0( aOther.GetPos0() );
112  SetName( aOther.GetName() );
113  SetPinFunction( aOther.GetPinFunction() );
114  SetSubRatsnest( aOther.GetSubRatsnest() );
115  m_effectiveBoundingRadius = aOther.m_effectiveBoundingRadius;
116  m_removeUnconnectedLayer = aOther.m_removeUnconnectedLayer;
117  m_keepTopBottomLayer = aOther.m_keepTopBottomLayer;
118  const_cast<KIID&>( m_Uuid ) = aOther.m_Uuid;
119 }
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:159
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
void SetSubRatsnest(int aSubRatsnest)
Definition: class_pad.h:510
bool m_keepTopBottomLayer
Definition: class_pad.h:708
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:131
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:217
int m_effectiveBoundingRadius
Definition: class_pad.h:650
void SetPadToDieLength(int aLength)
Definition: class_pad.h:344
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
const KIID m_Uuid
Definition: base_struct.h:162
void ImportSettingsFrom(const D_PAD &aMasterPad)
Imports the pad settings from aMasterPad.
Definition: class_pad.cpp:1241
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition: class_pad.h:137
bool m_removeUnconnectedLayer
Definition: class_pad.h:707

References GetName(), GetPadToDieLength(), GetPinFunction(), GetPos0(), GetPosition(), GetSubRatsnest(), ImportSettingsFrom(), m_effectiveBoundingRadius, m_keepTopBottomLayer, m_removeUnconnectedLayer, EDA_ITEM::m_Uuid, EDA_ITEM::operator=(), SetName(), SetPadToDieLength(), SetPinFunction(), SetPos0(), SetPosition(), and SetSubRatsnest().

Member Function Documentation

◆ addPadPrimitivesToPolygon()

void D_PAD::addPadPrimitivesToPolygon ( SHAPE_POLY_SET aMergedPolygon,
PCB_LAYER_ID  aLayer,
int  aError 
) const
private

Definition at line 178 of file pad_custom_shape_functions.cpp.

180 {
181  SHAPE_POLY_SET polyset;
182 
183  for( const std::shared_ptr<DRAWSEGMENT>& primitive : m_editPrimitives )
184  primitive->TransformShapeWithClearanceToPolygon( polyset, aLayer, 0, aError );
185 
187 
188  // Merge all polygons with the initial pad anchor shape
189  if( polyset.OutlineCount() )
190  {
191  aMergedPolygon->BooleanAdd( polyset, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
192  aMergedPolygon->Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
193  }
194 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:646
int OutlineCount() const
Returns the number of outlines in the set
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset union For aFastMode meaning, see function booleanOp
SHAPE_POLY_SET.
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...

References SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::Fracture(), m_editPrimitives, SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::PM_FAST, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, and SHAPE_POLY_SET::Simplify().

Referenced by GetBestAnchorPosition(), and MergePrimitivesAsPolygon().

◆ AddPrimitive()

void D_PAD::AddPrimitive ( DRAWSEGMENT aPrimitive)

Add item to the custom shape primitives list.

Definition at line 161 of file pad_custom_shape_functions.cpp.

162 {
163  m_editPrimitives.emplace_back( aPrimitive );
164 
165  m_shapesDirty = true;
166 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:646
bool m_shapesDirty
Definition: class_pad.h:649

References m_editPrimitives, and m_shapesDirty.

Referenced by AppendPrimitives(), and PAD_TOOL::recombinePad().

◆ AddPrimitiveArc()

void D_PAD::AddPrimitiveArc ( const wxPoint aCenter,
const wxPoint aStart,
int  aArcAngle,
int  aThickness 
)

Definition at line 85 of file pad_custom_shape_functions.cpp.

87 {
88  DRAWSEGMENT* item = new DRAWSEGMENT();
89  item->SetShape( S_ARC );
90  item->SetCenter( aCenter );
91  item->SetArcStart( aStart );
92  item->SetAngle( aArcAngle );
93  item->SetWidth( aThickness );
94  m_editPrimitives.emplace_back( item );
95  m_shapesDirty = true;
96 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:646
void SetShape(STROKE_T aShape)
void SetArcStart(const wxPoint &aArcStartPoint)
Initialize the start arc point.
bool m_shapesDirty
Definition: class_pad.h:649
void SetCenter(const wxPoint &aCenterPoint)
For arcs and circles:
Arcs (with rounded ends)
virtual void SetAngle(double aAngle)
Function SetAngle sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
void SetWidth(int aWidth)

References m_editPrimitives, m_shapesDirty, S_ARC, DRAWSEGMENT::SetAngle(), DRAWSEGMENT::SetArcStart(), DRAWSEGMENT::SetCenter(), DRAWSEGMENT::SetShape(), and DRAWSEGMENT::SetWidth().

◆ AddPrimitiveCircle()

void D_PAD::AddPrimitiveCircle ( const wxPoint aCenter,
int  aRadius,
int  aThickness 
)

Definition at line 114 of file pad_custom_shape_functions.cpp.

115 {
116  DRAWSEGMENT* item = new DRAWSEGMENT();
117  item->SetShape( S_CIRCLE );
118  item->SetStart( aCenter );
119  item->SetEnd( wxPoint( aCenter.x + aRadius, aCenter.y ) );
120  item->SetWidth( aThickness );
121  m_editPrimitives.emplace_back( item );
122  m_shapesDirty = true;
123 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:646
void SetShape(STROKE_T aShape)
bool m_shapesDirty
Definition: class_pad.h:649
void SetStart(const wxPoint &aStart)
void SetEnd(const wxPoint &aEnd)
void SetWidth(int aWidth)

References m_editPrimitives, m_shapesDirty, S_CIRCLE, DRAWSEGMENT::SetEnd(), DRAWSEGMENT::SetShape(), DRAWSEGMENT::SetStart(), DRAWSEGMENT::SetWidth(), wxPoint::x, and wxPoint::y.

◆ AddPrimitiveCurve()

void D_PAD::AddPrimitiveCurve ( const wxPoint aStart,
const wxPoint aEnd,
const wxPoint aCtrl1,
const wxPoint aCtrl2,
int  aThickness 
)

Definition at line 99 of file pad_custom_shape_functions.cpp.

101 {
102  DRAWSEGMENT* item = new DRAWSEGMENT();
103  item->SetShape( S_CURVE );
104  item->SetStart( aStart );
105  item->SetEnd( aEnd );
106  item->SetBezControl1( aCtrl1 );
107  item->SetBezControl2( aCtrl2 );
108  item->SetWidth( aThickness );
109  m_editPrimitives.emplace_back( item );
110  m_shapesDirty = true;
111 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:646
void SetShape(STROKE_T aShape)
bool m_shapesDirty
Definition: class_pad.h:649
void SetBezControl2(const wxPoint &aPoint)
Bezier Curve.
void SetStart(const wxPoint &aStart)
void SetEnd(const wxPoint &aEnd)
void SetBezControl1(const wxPoint &aPoint)
void SetWidth(int aWidth)

References m_editPrimitives, m_shapesDirty, S_CURVE, DRAWSEGMENT::SetBezControl1(), DRAWSEGMENT::SetBezControl2(), DRAWSEGMENT::SetEnd(), DRAWSEGMENT::SetShape(), DRAWSEGMENT::SetStart(), and DRAWSEGMENT::SetWidth().

◆ AddPrimitivePoly() [1/2]

void D_PAD::AddPrimitivePoly ( const SHAPE_POLY_SET aPoly,
int  aThickness 
)

Has meaning only for custom shape pads.

add a free shape to the shape list. the shape can be a polygon (outline can have a thickness) a thick segment a filled circle (thickness == 0) or ring a filled rect (thickness == 0) or rectangular outline a arc a bezier curve

Definition at line 47 of file pad_custom_shape_functions.cpp.

48 {
49  std::vector<wxPoint> points;
50 
51  // If aPoly has holes, convert it to a polygon with no holes.
52  SHAPE_POLY_SET poly_no_hole;
53  poly_no_hole.Append( aPoly );
55 
56  for( auto iter = poly_no_hole.CIterate(); iter; iter++ )
57  points.emplace_back( iter->x, iter->y );
58 
59  AddPrimitivePoly( points, aThickness );
60 }
SHAPE_POLY_SET.
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
void AddPrimitivePoly(const SHAPE_POLY_SET &aPoly, int aThickness)
Has meaning only for custom shape pads.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::CIterate(), SHAPE_POLY_SET::Fracture(), and SHAPE_POLY_SET::PM_STRICTLY_SIMPLE.

Referenced by MICROWAVE_TOOL::createFootprint().

◆ AddPrimitivePoly() [2/2]

void D_PAD::AddPrimitivePoly ( const std::vector< wxPoint > &  aPoly,
int  aThickness 
)

Definition at line 63 of file pad_custom_shape_functions.cpp.

64 {
65  DRAWSEGMENT* item = new DRAWSEGMENT();
66  item->SetShape( S_POLYGON );
67  item->SetPolyPoints( aPoly );
68  item->SetWidth( aThickness );
69  m_editPrimitives.emplace_back( item );
70  m_shapesDirty = true;
71 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:646
void SetShape(STROKE_T aShape)
bool m_shapesDirty
Definition: class_pad.h:649
polygon (not yet used for tracks, but could be in microwave apps)
void SetPolyPoints(const std::vector< wxPoint > &aPoints)
void SetWidth(int aWidth)

References m_editPrimitives, m_shapesDirty, S_POLYGON, DRAWSEGMENT::SetPolyPoints(), DRAWSEGMENT::SetShape(), and DRAWSEGMENT::SetWidth().

◆ AddPrimitiveRect()

void D_PAD::AddPrimitiveRect ( const wxPoint aStart,
const wxPoint aEnd,
int  aThickness 
)

Definition at line 126 of file pad_custom_shape_functions.cpp.

127 {
128  DRAWSEGMENT* item = new DRAWSEGMENT();
129  item->SetShape( S_RECT );
130  item->SetStart( aStart );
131  item->SetEnd( aEnd );
132  item->SetWidth( aThickness );
133  m_editPrimitives.emplace_back( item );
134  m_shapesDirty = true;
135 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:646
void SetShape(STROKE_T aShape)
bool m_shapesDirty
Definition: class_pad.h:649
segment with non rounded ends
void SetStart(const wxPoint &aStart)
void SetEnd(const wxPoint &aEnd)
void SetWidth(int aWidth)

References m_editPrimitives, m_shapesDirty, S_RECT, DRAWSEGMENT::SetEnd(), DRAWSEGMENT::SetShape(), DRAWSEGMENT::SetStart(), and DRAWSEGMENT::SetWidth().

◆ AddPrimitiveSegment()

void D_PAD::AddPrimitiveSegment ( const wxPoint aStart,
const wxPoint aEnd,
int  aThickness 
)

Definition at line 74 of file pad_custom_shape_functions.cpp.

75 {
76  DRAWSEGMENT* item = new DRAWSEGMENT();
77  item->SetStart( aStart );
78  item->SetEnd( aEnd );
79  item->SetWidth( aThickness );
80  m_editPrimitives.emplace_back( item );
81  m_shapesDirty = true;
82 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:646
bool m_shapesDirty
Definition: class_pad.h:649
void SetStart(const wxPoint &aStart)
void SetEnd(const wxPoint &aEnd)
void SetWidth(int aWidth)

References m_editPrimitives, m_shapesDirty, DRAWSEGMENT::SetEnd(), DRAWSEGMENT::SetStart(), and DRAWSEGMENT::SetWidth().

◆ ApertureMask()

LSET D_PAD::ApertureMask ( )
static

layer set for an aperture pad

Definition at line 169 of file class_pad.cpp.

170 {
171  static LSET saved( 1, F_Paste );
172  return saved;
173 }
LSET is a set of PCB_LAYER_IDs.

References F_Paste.

Referenced by PAD_FIXTURE::MakeAperture().

◆ AppendPrimitives()

void D_PAD::AppendPrimitives ( const std::vector< std::shared_ptr< DRAWSEGMENT >> &  aPrimitivesList)

Import a custom shape primites list (composed of basic shapes) and add items to the current list.

Copies the input, which is not altered.

Definition at line 151 of file pad_custom_shape_functions.cpp.

152 {
153  // Add duplicates of aPrimitivesList to the pad primitives list:
154  for( const std::shared_ptr<DRAWSEGMENT>& prim : aPrimitivesList )
155  AddPrimitive( new DRAWSEGMENT( *prim ) );
156 
157  m_shapesDirty = true;
158 }
bool m_shapesDirty
Definition: class_pad.h:649
void AddPrimitive(DRAWSEGMENT *aPrimitive)
Add item to the custom shape primitives list.

References AddPrimitive(), and m_shapesDirty.

Referenced by ReplacePrimitives().

◆ BuildEffectiveShapes()

void D_PAD::BuildEffectiveShapes ( PCB_LAYER_ID  aLayer) const

Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit.

Definition at line 291 of file class_pad.cpp.

292 {
293  m_effectiveShape = std::make_shared<SHAPE_COMPOUND>();
294  m_effectiveHoleShape = nullptr;
295 
296  auto add = [this]( SHAPE* aShape )
297  {
298  m_effectiveShape->AddShape( aShape );
299  };
300 
301  wxPoint shapePos = ShapePos(); // Fetch only once; rotation involves trig
302  PAD_SHAPE_T effectiveShape = GetShape();
303 
304  if( GetShape() == PAD_SHAPE_CUSTOM )
305  effectiveShape = GetAnchorPadShape();
306 
307  switch( effectiveShape )
308  {
309  case PAD_SHAPE_CIRCLE:
310  add( new SHAPE_CIRCLE( shapePos, m_size.x / 2 ) );
311  break;
312 
313  case PAD_SHAPE_OVAL:
314  if( m_size.x == m_size.y ) // the oval pad is in fact a circle
315  add( new SHAPE_CIRCLE( shapePos, m_size.x / 2 ) );
316  else
317  {
318  wxSize half_size = m_size / 2;
319  int half_width = std::min( half_size.x, half_size.y );
320  wxPoint half_len( half_size.x - half_width, half_size.y - half_width );
321  RotatePoint( &half_len, m_orient );
322  add( new SHAPE_SEGMENT( shapePos - half_len, shapePos + half_len, half_width * 2 ) );
323  }
324  break;
325 
326  case PAD_SHAPE_RECT:
327  if( m_orient == 0 || m_orient == 1800 )
328  {
329  add( new SHAPE_RECT( shapePos - m_size / 2, m_size.x, m_size.y ) );
330  break;
331  }
332  else if( m_orient == 900 || m_orient == -900 )
333  {
334  wxSize rot_size( m_size.y, m_size.x );
335  add( new SHAPE_RECT( shapePos - rot_size / 2, rot_size.x, rot_size.y ) );
336  break;
337  }
338 
339  // Not at a cartesian angle; fall through to general case
341 
342  case PAD_SHAPE_TRAPEZOID:
343  case PAD_SHAPE_ROUNDRECT:
344  {
345  int r = GetRoundRectCornerRadius();
346  wxPoint half_size( m_size.x / 2, m_size.y / 2 );
347  wxSize trap_delta( 0, 0 );
348 
349  if( effectiveShape == PAD_SHAPE_ROUNDRECT )
350  half_size -= wxPoint( r, r );
351  else if( effectiveShape == PAD_SHAPE_TRAPEZOID )
352  trap_delta = m_deltaSize / 2;
353 
354  SHAPE_LINE_CHAIN corners;
355 
356  corners.Append( -half_size.x - trap_delta.y, half_size.y + trap_delta.x );
357  corners.Append( half_size.x + trap_delta.y, half_size.y - trap_delta.x );
358  corners.Append( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
359  corners.Append( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
360 
361  corners.Rotate( -DECIDEG2RAD( m_orient ) );
362  corners.Move( shapePos );
363 
364  add( new SHAPE_SIMPLE( corners ) );
365 
366  if( effectiveShape == PAD_SHAPE_ROUNDRECT )
367  {
368  add( new SHAPE_SEGMENT( corners.CPoint( 0 ), corners.CPoint( 1 ), r * 2 ) );
369  add( new SHAPE_SEGMENT( corners.CPoint( 1 ), corners.CPoint( 2 ), r * 2 ) );
370  add( new SHAPE_SEGMENT( corners.CPoint( 2 ), corners.CPoint( 3 ), r * 2 ) );
371  add( new SHAPE_SEGMENT( corners.CPoint( 3 ), corners.CPoint( 0 ), r * 2 ) );
372  }
373  }
374  break;
375 
377  {
378  SHAPE_POLY_SET outline;
379  auto board = GetBoard();
380  int maxError = ARC_HIGH_DEF;
381 
382  if( board )
383  maxError = board->GetDesignSettings().m_MaxError;
384 
387  GetChamferPositions(), maxError );
388 
389  add( new SHAPE_SIMPLE( outline.COutline( 0 ) ) );
390  }
391  break;
392 
393  default:
394  wxFAIL_MSG( "D_PAD::buildEffectiveShapes: Unsupported pad shape: "
395  + PAD_SHAPE_T_asString( effectiveShape ) );
396  break;
397  }
398 
399  if( GetShape() == PAD_SHAPE_CUSTOM )
400  {
401  for( const std::shared_ptr<DRAWSEGMENT>& primitive : m_editPrimitives )
402  {
403  for( SHAPE* shape : primitive->MakeEffectiveShapes() )
404  {
405  shape->Rotate( -DECIDEG2RAD( m_orient ) );
406  shape->Move( shapePos );
407  add( shape );
408  }
409  }
410  }
411 
412  // Polygon
413  //
414  m_effectivePolygon = std::make_shared<SHAPE_POLY_SET>();
416 
417  // Bounding box and radius
418  //
419  // PADSTACKS TODO: these will both need to cycle through all layers to get the largest
420  // values....
421  //
423 
424  for( int cnt = 0; cnt < m_effectivePolygon->OutlineCount(); ++cnt )
425  {
426  const SHAPE_LINE_CHAIN& poly = m_effectivePolygon->COutline( cnt );
427 
428  for( int ii = 0; ii < poly.PointCount(); ++ii )
429  {
430  int dist = KiROUND( ( poly.CPoint( ii ) - m_pos ).EuclideanNorm() );
432  }
433  }
434 
436 
437  BOX2I bbox = m_effectiveShape->BBox();
439  wxSize( bbox.GetWidth(), bbox.GetHeight() ) );
440 
441  // Hole shape
442  //
443  wxSize half_size = m_drill / 2;
444  int half_width = std::min( half_size.x, half_size.y );
445  wxPoint half_len( half_size.x - half_width, half_size.y - half_width );
446 
447  RotatePoint( &half_len, m_orient );
448 
449  m_effectiveHoleShape = std::make_shared<SHAPE_SEGMENT>( m_pos - half_len, m_pos + half_len,
450  half_width * 2 );
451 
452  // All done
453  //
454  m_shapesDirty = false;
455 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:133
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:646
SHAPE_SIMPLE.
Definition: shape_simple.h:43
static std::string PAD_SHAPE_T_asString(PAD_SHAPE_T a)
Definition: pad_shapes.h:45
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:171
bool m_shapesDirty
Definition: class_pad.h:649
void Move(const VECTOR2I &aVector) override
double m_orient
Definition: class_pad.h:703
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: class_pad.h:653
wxSize m_size
Definition: class_pad.h:667
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:88
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
int PointCount() const
Function PointCount()
PAD_SHAPE_T
Enum PAD_SHAPE_T is the set of pad shapes, used with D_PAD::{Set,Get}Shape()
Definition: pad_shapes.h:33
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
int GetChamferPositions() const
Definition: class_pad.h:503
const VECTOR2I & CPoint(int aIndex) const
Function Point()
SHAPE_POLY_SET.
coord_type GetWidth() const
Definition: box2.h:197
double GetChamferRectRatio() const
Definition: class_pad.h:495
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int m_effectiveBoundingRadius
Definition: class_pad.h:650
SHAPE.
Definition: shape.h:120
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aMaxError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon.
const Vec & GetPosition() const
Definition: box2.h:194
std::shared_ptr< SHAPE_POLY_SET > m_effectivePolygon
Definition: class_pad.h:654
void Rotate(double aAngle, const VECTOR2I &aCenter=VECTOR2I(0, 0)) override
Function Rotate rotates all vertices by a given angle.
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
wxSize m_drill
Definition: class_pad.h:666
wxPoint ShapePos() const
Definition: class_pad.cpp:597
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
double DECIDEG2RAD(double deg)
Definition: trigo.h:223
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
coord_type GetHeight() const
Definition: box2.h:198
std::shared_ptr< SHAPE_COMPOUND > m_effectiveShape
Definition: class_pad.h:652
int GetRoundRectCornerRadius() const
Definition: class_pad.cpp:224
EDA_RECT m_effectiveBoundingBox
Definition: class_pad.h:651
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:157
wxPoint m_pos
Definition: class_pad.h:637
const wxSize & GetSize() const
Definition: class_pad.h:224
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aError)
convert a rectangle with rounded corners and/or chamfered corners to a polygon Convert rounded corner...
wxSize m_deltaSize
Definition: class_pad.h:692

References SHAPE_LINE_CHAIN::Append(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), DECIDEG2RAD(), EuclideanNorm(), GetAnchorPadShape(), BOARD_ITEM::GetBoard(), GetChamferPositions(), GetChamferRectRatio(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetPosition(), GetRoundRectCornerRadius(), GetShape(), GetSize(), BOX2< Vec >::GetWidth(), KI_FALLTHROUGH, KiROUND(), m_deltaSize, m_drill, m_editPrimitives, m_effectiveBoundingBox, m_effectiveBoundingRadius, m_effectiveHoleShape, m_effectivePolygon, m_effectiveShape, m_orient, m_pos, m_shapesDirty, m_size, SHAPE_LINE_CHAIN::Move(), PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_T_asString(), PAD_SHAPE_TRAPEZOID, SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::Rotate(), RotatePoint(), ShapePos(), TransformRoundChamferedRectToPolygon(), TransformShapeWithClearanceToPolygon(), wxPoint::x, and wxPoint::y.

Referenced by GetBoundingBox(), GetBoundingRadius(), GetEffectiveHoleShape(), GetEffectivePolygon(), and GetEffectiveShape().

◆ ClassOf()

static bool D_PAD::ClassOf ( const EDA_ITEM aItem)
inlinestatic

Definition at line 85 of file class_pad.h.

86  {
87  return aItem && PCB_PAD_T == aItem->Type();
88  }
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References PCB_PAD_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

void EDA_ITEM::ClearFlags ( STATUS_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 233 of file base_struct.h.

233 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), LIB_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceModule(), LIB_PIN_TOOL::PlacePin(), DRAWING_TOOL::PlaceText(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::RollbackPartFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 245 of file base_struct.h.

246  {
248  DO_NOT_DRAW );
249  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:114
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:125
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:128
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:127
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:123
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:233
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:129
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:122

References CANDIDATE, EDA_ITEM::ClearFlags(), DO_NOT_DRAW, ENDPOINT, IS_LINKED, SKIP_STRUCT, STARTPOINT, and TEMP_SELECTED.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 154 of file view_item.h.

155  {
157  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:162
#define NULL

References KIGFX::VIEW_ITEM::m_viewPrivData, and NULL.

Referenced by KIGFX::VIEW::OnDestroy().

◆ Clone()

EDA_ITEM * D_PAD::Clone ( ) const
overridevirtual

Function Clone creates a duplicate of this item with linked list members set to NULL.

The default version will return NULL in release builds and likely crash the program. In debug builds, a warning message indicating the derived class has not implemented cloning. This really should be a pure virtual function. Due to the fact that there are so many objects derived from EDA_ITEM, the decision was made to return NULL until all the objects derived from EDA_ITEM implement cloning. Once that happens, this function should be made pure.

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Definition at line 1087 of file class_pad.cpp.

1088 {
1089  return new D_PAD( *this );
1090 }
D_PAD(MODULE *parent)
Definition: class_pad.cpp:56

References D_PAD().

Referenced by ClonePad().

◆ ClonePad()

D_PAD* D_PAD::ClonePad ( ) const
inline

same as Clone, but returns a D_PAD item.

Useful mainly for python scripts, because Clone returns an EDA_ITEM.

Definition at line 598 of file class_pad.h.

599  {
600  return (D_PAD*) Clone();
601  }
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_pad.cpp:1087

References Clone().

◆ Collide() [1/2]

bool D_PAD::Collide ( const SHAPE_SEGMENT aSeg,
int  aMinClearance,
int *  aActual = nullptr 
)

Definition at line 960 of file class_pad.cpp.

961 {
962  return aSeg->Collide( GetEffectiveShape().get(), aMinClearance, aActual );
963 }
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
Function GetEffectiveShape Some pad shapes can be complex (rounded/chamfered rectangle),...
Definition: class_pad.cpp:264
bool Collide(const SHAPE *aShape, int aClearance, VECTOR2I *aMTV) const override
Function Collide()
Definition: shape_segment.h:59

References SHAPE_SEGMENT::Collide(), and GetEffectiveShape().

◆ Collide() [2/2]

bool D_PAD::Collide ( const D_PAD aPad,
int  aMinClearance,
int *  aActual = nullptr 
)

Definition at line 947 of file class_pad.cpp.

948 {
949  int center2center = KiROUND( EuclideanNorm( aPad->ShapePos() - ShapePos() ) );
950 
951  // Quick test: Clearance is OK if the bounding circles are further away than aMinClearance
952  if( center2center - GetBoundingRadius() - aPad->GetBoundingRadius() >= aMinClearance )
953  return false;
954 
955 
956  return GetEffectiveShape()->Collide( aPad->GetEffectiveShape().get(), aMinClearance, aActual );
957 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:133
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.cpp:282
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
Function GetEffectiveShape Some pad shapes can be complex (rounded/chamfered rectangle),...
Definition: class_pad.cpp:264
wxPoint ShapePos() const
Definition: class_pad.cpp:597
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68

References EuclideanNorm(), GetBoundingRadius(), GetEffectiveShape(), KiROUND(), and ShapePos().

◆ Compare()

int D_PAD::Compare ( const D_PAD padref,
const D_PAD padcmp 
)
static

Function Compare compares two pads and return 0 if they are equal.

Returns
int - <0 if left less than right, 0 if equal, >0 if left greater than right.

Definition at line 966 of file class_pad.cpp.

967 {
968  int diff;
969 
970  if( ( diff = padref->GetShape() - padcmp->GetShape() ) != 0 )
971  return diff;
972 
973  if( ( diff = padref->GetDrillShape() - padcmp->GetDrillShape() ) != 0)
974  return diff;
975 
976  if( ( diff = padref->m_drill.x - padcmp->m_drill.x ) != 0 )
977  return diff;
978 
979  if( ( diff = padref->m_drill.y - padcmp->m_drill.y ) != 0 )
980  return diff;
981 
982  if( ( diff = padref->m_size.x - padcmp->m_size.x ) != 0 )
983  return diff;
984 
985  if( ( diff = padref->m_size.y - padcmp->m_size.y ) != 0 )
986  return diff;
987 
988  if( ( diff = padref->m_offset.x - padcmp->m_offset.x ) != 0 )
989  return diff;
990 
991  if( ( diff = padref->m_offset.y - padcmp->m_offset.y ) != 0 )
992  return diff;
993 
994  if( ( diff = padref->m_deltaSize.x - padcmp->m_deltaSize.x ) != 0 )
995  return diff;
996 
997  if( ( diff = padref->m_deltaSize.y - padcmp->m_deltaSize.y ) != 0 )
998  return diff;
999 
1000 // TODO: test custom shapes
1001 
1002  // Dick: specctra_export needs this
1003  // Lorenzo: gencad also needs it to implement padstacks!
1004 
1005 #if __cplusplus >= 201103L
1006  long long d = padref->m_layerMask.to_ullong() - padcmp->m_layerMask.to_ullong();
1007  if( d < 0 )
1008  return -1;
1009  else if( d > 0 )
1010  return 1;
1011 
1012  return 0;
1013 #else
1014  // these strings are not typically constructed, since we don't get here often.
1015  std::string s1 = padref->m_layerMask.to_string();
1016  std::string s2 = padcmp->m_layerMask.to_string();
1017  return s1.compare( s2 );
1018 #endif
1019 }
wxSize m_size
Definition: class_pad.h:667
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:326
wxPoint m_offset
Definition: class_pad.h:687
LSET m_layerMask
Definition: class_pad.h:689
wxSize m_drill
Definition: class_pad.h:666
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:157
wxSize m_deltaSize
Definition: class_pad.h:692

References GetDrillShape(), GetShape(), m_deltaSize, m_drill, m_layerMask, m_offset, m_size, wxPoint::x, and wxPoint::y.

Referenced by CreatePadsShapesSection().

◆ ConnSMDMask()

LSET D_PAD::ConnSMDMask ( )
static

layer set for a SMD pad on Front layer used for edge board connectors

Definition at line 155 of file class_pad.cpp.

156 {
157  static LSET saved( 2, F_Cu, F_Mask );
158  return saved;
159 }
LSET is a set of PCB_LAYER_IDs.

References F_Cu, and F_Mask.

◆ DeletePrimitivesList()

void D_PAD::DeletePrimitivesList ( )

clear the basic shapes list

Definition at line 170 of file pad_custom_shape_functions.cpp.

171 {
172  m_editPrimitives.clear();
173 
174  m_shapesDirty = true;
175 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:646
bool m_shapesDirty
Definition: class_pad.h:649

References m_editPrimitives, and m_shapesDirty.

Referenced by PAD_TOOL::explodePad(), ReplacePrimitives(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

Function DeleteStructure deletes this object after removing from its parent if it has one.

Definition at line 115 of file class_board_item.cpp.

116 {
117  auto parent = GetParent();
118 
119  if( parent )
120  parent->Remove( this );
121 
122  delete this;
123 }
BOARD_ITEM_CONTAINER * GetParent() const

References BOARD_ITEM::GetParent().

Referenced by BOARD::PadDelete(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

◆ Duplicate()

virtual BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlinevirtualinherited

Function Duplicate creates a copy of a BOARD_ITEM.

Reimplemented in MODULE.

Definition at line 233 of file class_board_item.h.

234  {
235  EDA_ITEM* dupe = Clone();
236  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
237 
238  return static_cast<BOARD_ITEM*>( dupe );
239  }
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: common.h:68
const KIID m_Uuid
Definition: base_struct.h:162
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

References EDA_ITEM::Clone(), and EDA_ITEM::m_Uuid.

Referenced by PCB_GROUP::DeepDuplicate(), EDIT_TOOL::Duplicate(), and ARRAY_CREATOR::Invoke().

◆ Flip() [1/2]

void D_PAD::Flip ( const wxPoint aCentre,
bool  aFlipLeftRight 
)
overridevirtual

Function Flip Flip this object, i.e.

change the board side for this object

Parameters
aCentre- the rotation point.
aFlipLeftRight- mirror across Y axis instead of X (the default)

Reimplemented from BOARD_ITEM.

Definition at line 528 of file class_pad.cpp.

529 {
530  if( aFlipLeftRight )
531  {
532  MIRROR( m_pos.x, aCentre.x );
533  MIRROR( m_pos0.x, 0 );
534  MIRROR( m_offset.x, 0 );
535  MIRROR( m_deltaSize.x, 0 );
536  }
537  else
538  {
539  MIRROR( m_pos.y, aCentre.y );
540  MIRROR( m_pos0.y, 0 );
541  MIRROR( m_offset.y, 0 );
542  MIRROR( m_deltaSize.y, 0 );
543  }
544 
546 
547  auto mirrorBitFlags = []( int& aBitfield, int a, int b )
548  {
549  bool temp = aBitfield & a;
550 
551  if( aBitfield & b )
552  aBitfield |= a;
553  else
554  aBitfield &= ~a;
555 
556  if( temp )
557  aBitfield |= b;
558  else
559  aBitfield &= ~b;
560  };
561 
562  if( aFlipLeftRight )
563  {
566  }
567  else
568  {
571  }
572 
573  // flip pads layers
574  // PADS items are currently on all copper layers, or
575  // currently, only on Front or Back layers.
576  // So the copper layers count is not taken in account
578 
579  // Flip the basic shapes, in custom pads
580  FlipPrimitives( aFlipLeftRight );
581 
582  m_shapesDirty = true;
583 }
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask,...
Definition: lset.cpp:536
wxPoint m_pos0
Definition: class_pad.h:696
void FlipPrimitives(bool aFlipLeftRight)
Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pad...
Definition: class_pad.cpp:587
bool m_shapesDirty
Definition: class_pad.h:649
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:175
wxPoint m_offset
Definition: class_pad.h:687
int m_chamferPositions
Definition: class_pad.h:675
LSET m_layerMask
Definition: class_pad.h:689
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in a variety of units (the basic call r...
Definition: class_pad.h:321
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:519
wxPoint m_pos
Definition: class_pad.h:637
void SetLayerSet(LSET aLayers) override
Definition: class_pad.h:331
wxSize m_deltaSize
Definition: class_pad.h:692

References FlipLayerMask(), FlipPrimitives(), GetOrientation(), m_chamferPositions, m_deltaSize, m_layerMask, m_offset, m_pos, m_pos0, m_shapesDirty, MIRROR(), RECT_CHAMFER_BOTTOM_LEFT, RECT_CHAMFER_BOTTOM_RIGHT, RECT_CHAMFER_TOP_LEFT, RECT_CHAMFER_TOP_RIGHT, SetLayerSet(), SetOrientation(), wxPoint::x, and wxPoint::y.

◆ Flip() [2/2]

void BOARD_ITEM::Flip ( const VECTOR2I aCentre,
bool  aFlipLeftRight 
)
inlineinherited

Definition at line 349 of file class_board_item.h.

350  {
351  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
352  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Function Flip Flip this object, i.e.

References BOARD_ITEM::Flip(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ FlipPrimitives()

void D_PAD::FlipPrimitives ( bool  aFlipLeftRight)

Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pads.

Definition at line 587 of file class_pad.cpp.

588 {
589  for( std::shared_ptr<DRAWSEGMENT>& primitive : m_editPrimitives )
590  primitive->Flip( wxPoint( 0, 0 ), aFlipLeftRight );
591 
592  m_shapesDirty = true;
593 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:646
bool m_shapesDirty
Definition: class_pad.h:649

References m_editPrimitives, and m_shapesDirty.

Referenced by Flip(), DIALOG_PAD_PROPERTIES::initValues(), mirrorPadX(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 84 of file inspectable.h.

85  {
87  TYPE_ID thisType = TYPE_HASH( *this );
88  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
89  return object ? aProperty->getter( object ) : wxAny();
90  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
virtual wxAny getter(void *aObject) const =0
Provides class metadata.
Definition: property_mgr.h:58
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

References PROPERTY_BASE::getter(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by CLASS_D_DESC::CLASS_D_DESC(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [2/3]

template<typename T >
T INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 93 of file inspectable.h.

94  {
96  TYPE_ID thisType = TYPE_HASH( *this );
97  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
98  return object ? aProperty->get<T>( object ) : T();
99  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
Provides class metadata.
Definition: property_mgr.h:58
T get(void *aObject)
Definition: property.h:273
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

References PROPERTY_BASE::get(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Get() [3/3]

template<typename T >
boost::optional<T> INSPECTABLE::Get ( const wxString &  aProperty)
inlineinherited

Definition at line 102 of file inspectable.h.

103  {
105  TYPE_ID thisType = TYPE_HASH( *this );
106  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
107  boost::optional<T> ret;
108 
109  if( prop )
110  {
111  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
112 
113  if( object )
114  ret = prop->get<T>( object );
115  }
116 
117  return ret;
118  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Returns a property for a specific type.
Provides class metadata.
Definition: property_mgr.h:58
T get(void *aObject)
Definition: property.h:273
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

References PROPERTY_BASE::get(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ GetAnchorPadShape()

PAD_SHAPE_T D_PAD::GetAnchorPadShape ( ) const
inline

Function GetAnchorPadShape.

Returns
the shape of the anchor pad shape, for custom shaped pads.

Definition at line 171 of file class_pad.h.

171 { return m_anchorPadShape; }
PAD_SHAPE_T m_anchorPadShape
Definition: class_pad.h:677

References m_anchorPadShape.

Referenced by BuildEffectiveShapes(), PAD_TOOL::explodePad(), PCB_IO::format(), GetBestAnchorPosition(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::initValues(), MergePrimitivesAsPolygon(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::transferDataToPad().

◆ GetAttribute()

◆ GetBestAnchorPosition()

bool D_PAD::GetBestAnchorPosition ( VECTOR2I aPos)

Definition at line 227 of file pad_custom_shape_functions.cpp.

228 {
229  SHAPE_POLY_SET poly;
230  addPadPrimitivesToPolygon( &poly, UNDEFINED_LAYER, ARC_LOW_DEF );
231 
232  if( poly.OutlineCount() > 1 )
233  return false;
234 
235  const int minSteps = 10;
236  const int maxSteps = 50;
237 
238  int stepsX, stepsY;
239 
240  auto bbox = poly.BBox();
241 
242  if( bbox.GetWidth() < bbox.GetHeight() )
243  {
244  stepsX = minSteps;
245  stepsY = minSteps * (double) bbox.GetHeight() / (double )(bbox.GetWidth() + 1);
246  }
247  else
248  {
249  stepsY = minSteps;
250  stepsX = minSteps * (double) bbox.GetWidth() / (double )(bbox.GetHeight() + 1);
251  }
252 
253  stepsX = std::max(minSteps, std::min( maxSteps, stepsX ) );
254  stepsY = std::max(minSteps, std::min( maxSteps, stepsY ) );
255 
256  VECTOR2I center = bbox.Centre();
257 
258  int64_t minDist = std::numeric_limits<int64_t>::max();
259  int64_t minDistEdge;
260 
262  {
263  minDistEdge = GetSize().x;
264  }
265  else
266  {
267  minDistEdge = std::max( GetSize().x, GetSize().y );
268  }
269 
270  OPT<VECTOR2I> bestAnchor( []()->OPT<VECTOR2I> { return NULLOPT; }() );
271 
272  for( int y = 0; y < stepsY ; y++ )
273  {
274  for( int x = 0; x < stepsX; x++ )
275  {
276  VECTOR2I p = bbox.GetPosition();
277  p.x += rescale( x, bbox.GetWidth(), (stepsX - 1) );
278  p.y += rescale( y, bbox.GetHeight(), (stepsY - 1) );
279 
280  if( poly.Contains(p) )
281  {
282 
283  int dist = (center - p).EuclideanNorm();
284  int distEdge = poly.COutline(0).Distance( p, true );
285 
286  if( distEdge >= minDistEdge )
287  {
288  if( dist < minDist )
289  {
290  bestAnchor = p;
291  minDist = dist;
292  }
293  }
294  }
295  }
296  }
297 
298  if( bestAnchor )
299  {
300  aPos = *bestAnchor;
301  return true;
302  }
303 
304  return false;
305 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:133
void addPadPrimitivesToPolygon(SHAPE_POLY_SET *aMergedPolygon, PCB_LAYER_ID aLayer, int aError) const
int OutlineCount() const
Returns the number of outlines in the set
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:171
int Distance(const VECTOR2I &aP, bool aOutlineOnly=false) const
Function Distance()
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Returns true if a given subpolygon contains the point aP.
const auto NULLOPT
Definition: optional.h:9
SHAPE_POLY_SET.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
T rescale(T aNumerator, T aValue, T aDenominator)
Function rescale()
Definition: util.h:95
coord_type GetHeight() const
Definition: box2.h:198
boost::optional< T > OPT
Definition: optional.h:7
const wxSize & GetSize() const
Definition: class_pad.h:224
const BOX2I BBox(int aClearance=0) const override
Function BBox()

References addPadPrimitivesToPolygon(), SHAPE_POLY_SET::BBox(), SHAPE_POLY_SET::Contains(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::Distance(), EuclideanNorm(), GetAnchorPadShape(), BOX2< Vec >::GetHeight(), GetSize(), NULLOPT, SHAPE_POLY_SET::OutlineCount(), PAD_SHAPE_CIRCLE, rescale(), UNDEFINED_LAYER, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.

Definition at line 48 of file class_board_item.cpp.

49 {
50  if( Type() == PCB_T )
51  return (BOARD*) this;
52 
53  BOARD_ITEM* parent = GetParent();
54 
55  if( parent )
56  return parent->GetBoard();
57 
58  return NULL;
59 }
Definition: typeinfo.h:85
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
#define NULL
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:178
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References BOARD_ITEM::GetBoard(), BOARD_ITEM::GetParent(), NULL, PCB_T, and EDA_ITEM::Type().

Referenced by BuildEffectiveShapes(), ZONE_CONTAINER::BuildSmoothedPoly(), TEXTE_PCB::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingBox(), MODULE::GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), ZONE_CONTAINER::GetInteractingZones(), BOARD_ITEM::GetLayerName(), VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), ZONE_CONTAINER::GetSelectMenuText(), TEXTE_MODULE::GetShownText(), GetSolderMaskMargin(), GetSolderPasteMargin(), BOARD::GetTrackLength(), TRACK::GetWidthConstraints(), insideArea(), insideCourtyard(), VIA::IsPadOnLayer(), IsPadOnLayer(), BOARD_ITEM::LayerMaskDescribe(), VIA::LayerMaskDescribe(), MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD_CONNECTED_ITEM::SetNetCode(), setupDummyPadForHole(), ZONE_CONTAINER::TransformSmoothedOutlineWithClearanceToPolygon(), ZONE_CONTAINER::TransformSolidAreasShapesToPolygon(), MODULE::ViewBBox(), and ViewGetLOD().

◆ GetBoundingBox()

const EDA_RECT D_PAD::GetBoundingBox ( ) const
overridevirtual

Function GetBoundingBox The bounding box is cached, so this will be efficient most of the time.

Reimplemented from EDA_ITEM.

Definition at line 458 of file class_pad.cpp.

459 {
460  if( m_shapesDirty )
462 
463  return m_effectiveBoundingBox;
464 }
bool m_shapesDirty
Definition: class_pad.h:649
void BuildEffectiveShapes(PCB_LAYER_ID aLayer) const
Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit...
Definition: class_pad.cpp:291
EDA_RECT m_effectiveBoundingBox
Definition: class_pad.h:651

References BuildEffectiveShapes(), m_effectiveBoundingBox, m_shapesDirty, and UNDEFINED_LAYER.

Referenced by AR_AUTOPLACER::addPad(), ZONE_FILLER::buildThermalSpokes(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc(), KIGFX::PCB_PAINTER::draw(), hasThermalConnection(), HitTest(), DSN::SPECCTRA_DB::makePADSTACK(), ViewBBox(), and ViewGetLOD().

◆ GetBoundingRadius()

int D_PAD::GetBoundingRadius ( ) const

Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad.

The center is the pad position NOT THE SHAPE POS!

Definition at line 282 of file class_pad.cpp.

283 {
284  if( m_shapesDirty )
286 
288 }
bool m_shapesDirty
Definition: class_pad.h:649
void BuildEffectiveShapes(PCB_LAYER_ID aLayer) const
Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit...
Definition: class_pad.cpp:291
int m_effectiveBoundingRadius
Definition: class_pad.h:650

References BuildEffectiveShapes(), m_effectiveBoundingRadius, m_shapesDirty, and UNDEFINED_LAYER.

Referenced by Collide(), HitTest(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances(), and DRC_TEST_PROVIDER_HOLE_CLEARANCE::testPads2Holes().

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

Function GetCenter()

This defaults to the same point as returned by GetPosition(), unless overridden

Returns
centre point of the item

Reimplemented in DRAWSEGMENT.

Definition at line 145 of file class_board_item.h.

145 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: base_struct.h:337

References EDA_ITEM::GetPosition().

Referenced by BOARD_ADAPTER::createNewTrack(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), KIGFX::PCB_PAINTER::draw(), export_vrml_tracks(), PlotStandardLayer(), and TRACK::TransformShapeWithClearanceToPolygon().

◆ GetChamferPositions()

◆ GetChamferRectRatio()

◆ GetClass()

wxString D_PAD::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 542 of file class_pad.h.

543  {
544  return wxT( "PAD" );
545  }

◆ GetClearance()

int BOARD_CONNECTED_ITEM::GetClearance ( PCB_LAYER_ID  aLayer,
BOARD_ITEM aItem = nullptr,
wxString *  aSource = nullptr 
) const
virtualinherited

Function GetClearance returns the clearance in internal units.

If aItem is not NULL then the returned clearance is the greater of this object's NETCLASS clearance and aItem's NETCLASS clearance. If aItem is NULL, then this objects clearance is returned.

Parameters
aLayerthe layer in question
aItemis an optional BOARD_ITEM
aSource[out] optionally reports the source as a user-readable string
Returns
int - the clearance in internal units.

Definition at line 84 of file board_connected_item.cpp.

86 {
87  DRC_CONSTRAINT constraint;
88 
89  if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
90  {
92 
93  constraint = bds.m_DRCEngine->EvalRulesForItems( DRC_CONSTRAINT_TYPE_CLEARANCE, this,
94  aItem, aLayer );
95  }
96 
97  if( constraint.Value().HasMin() )
98  {
99  if( aSource )
100  *aSource = constraint.GetName();
101 
102  return constraint.Value().Min();
103  }
104 
105  return 0;
106 }
bool HasMin() const
Definition: drc_rule.h:78
MINOPTMAX< int > & Value()
Definition: drc_rule.h:133
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:537
T Min() const
Definition: drc_rule.h:74
wxString GetName() const
Definition: drc_rule.h:138
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References DRC_CONSTRAINT_TYPE_CLEARANCE, BOARD_ITEM::GetBoard(), BOARD::GetDesignSettings(), DRC_CONSTRAINT::GetName(), MINOPTMAX< T >::HasMin(), BOARD_DESIGN_SETTINGS::m_DRCEngine, MINOPTMAX< T >::Min(), and DRC_CONSTRAINT::Value().

Referenced by ZONE_FILLER::buildCopperItemClearances(), KIGFX::PCB_PAINTER::draw(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), GetMsgPanelInfo(), and TRACK::ViewBBox().

◆ GetCustomShapeInZoneOpt()

CUST_PAD_SHAPE_IN_ZONE D_PAD::GetCustomShapeInZoneOpt ( ) const
inline
Returns
the option for the custom pad shape to use as clearance area in copper zones

Definition at line 177 of file class_pad.h.

178  {
180  }
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: class_pad.h:661

References m_customShapeClearanceArea.

Referenced by ZONE_FILLER::addKnockout(), PCB_IO::format(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::initValues(), setupDummyPadForHole(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ GetDelta()

◆ GetDrillShape()

◆ GetDrillSize()

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 237 of file base_struct.h.

238  {
239  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
241 
242  return m_Flags & mask;
243  }
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:126
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: base_struct.h:130
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References IS_DRAGGED, IS_MOVED, IS_NEW, IS_PASTED, IS_RESIZED, IS_WIRE_IMAGE, EDA_ITEM::m_Flags, and STRUCT_DELETED.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), LIB_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_COMPONENT::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), and SCH_EDIT_FRAME::TrimWire().

◆ GetEffectiveHoleShape()

const SHAPE_SEGMENT * D_PAD::GetEffectiveHoleShape ( ) const

Function GetEffectiveHoleShape Returns a SHAPE object representing the pad's hole.

Definition at line 273 of file class_pad.cpp.

274 {
275  if( m_shapesDirty )
277 
278  return m_effectiveHoleShape.get();
279 }
bool m_shapesDirty
Definition: class_pad.h:649
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: class_pad.h:653
void BuildEffectiveShapes(PCB_LAYER_ID aLayer) const
Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit...
Definition: class_pad.cpp:291

References BuildEffectiveShapes(), m_effectiveHoleShape, m_shapesDirty, and UNDEFINED_LAYER.

Referenced by BOARD_ADAPTER::createNewPadDrill(), DRC_TEST_PROVIDER_HOLE_CLEARANCE::doPadToPadHoleDrc(), KIGFX::PCB_PAINTER::draw(), PNS_KICAD_IFACE_BASE::syncPad(), and TransformHoleWithClearanceToPolygon().

◆ GetEffectiveNetclass()

NETCLASS * BOARD_CONNECTED_ITEM::GetEffectiveNetclass ( ) const
inherited

Function GetEffectiveNetclass returns the NETCLASS for this item, or the default netclass if none is defined.

Note: do NOT return a std::shared_ptr from this. It is used heavily in DRC, and the std::shared_ptr stuff shows up large in performance profiling.

Definition at line 65 of file board_connected_item.cpp.

66 {
67  // NB: we must check the net first, as when it is 0 GetNetClass() will return the
68  // orphaned net netclass, not the default netclass.
69  if( m_netinfo->GetNet() == 0 )
71  else
72  return GetNetClass();
73 }
NETCLASS * GetNetClass() const
Function GetNetClassPtr returns the NETCLASS for this item.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:537
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
NETCLASS * GetDefault() const
Function GetDefault.

References BOARD_ITEM::GetBoard(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), NETINFO_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetClass(), and BOARD_CONNECTED_ITEM::m_netinfo.

◆ GetEffectivePolygon()

const std::shared_ptr< SHAPE_POLY_SET > & D_PAD::GetEffectivePolygon ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER) const

Definition at line 255 of file class_pad.cpp.

256 {
257  if( m_shapesDirty )
258  BuildEffectiveShapes( aLayer );
259 
260  return m_effectivePolygon;
261 }
bool m_shapesDirty
Definition: class_pad.h:649
void BuildEffectiveShapes(PCB_LAYER_ID aLayer) const
Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit...
Definition: class_pad.cpp:291
std::shared_ptr< SHAPE_POLY_SET > m_effectivePolygon
Definition: class_pad.h:654

References BuildEffectiveShapes(), m_effectivePolygon, and m_shapesDirty.

Referenced by BOARD_ADAPTER::buildPadShapeThickOutlineAsPolygon(), BOARD_ADAPTER::buildPadShapeThickOutlineAsSegments(), CN_ITEM::GetAnchor(), HitTest(), BRDITEMS_PLOTTER::PlotPad(), and PNS_KICAD_IFACE_BASE::syncPad().

◆ GetEffectiveShape()

std::shared_ptr< SHAPE > D_PAD::GetEffectiveShape ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER) const
overridevirtual

Function GetEffectiveShape Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.

This routine returns a COMPOUND shape (set of simple shapes which make up the pad fod use with routing, collision determiniation, etc).

Note that this list can contain a SHAPE_SIMPLE (a simple single-outline non-intersecting polygon), but should never contain a SHAPE_POLY_SET (a complex polygon consisting of multiple outlines and/or holes).

Parameters
aLayerin case of items spanning multiple layers, only the shapes belonging to aLayer will be returned. Pass UNDEFINED_LAYER to return shapes for all layers.

Reimplemented from BOARD_ITEM.

Definition at line 264 of file class_pad.cpp.

265 {
266  if( m_shapesDirty )
267  BuildEffectiveShapes( aLayer );
268 
269  return m_effectiveShape;
270 }
bool m_shapesDirty
Definition: class_pad.h:649
void BuildEffectiveShapes(PCB_LAYER_ID aLayer) const
Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit...
Definition: class_pad.cpp:291
std::shared_ptr< SHAPE_COMPOUND > m_effectiveShape
Definition: class_pad.h:652

References BuildEffectiveShapes(), m_effectiveShape, and m_shapesDirty.

Referenced by Collide(), BOARD_ADAPTER::createNewPadWithClearance(), DRC_TEST_PROVIDER_HOLE_CLEARANCE::doPadToPadHoleDrc(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc(), KIGFX::PCB_PAINTER::draw(), and PNS_KICAD_IFACE_BASE::syncPad().

◆ GetEffectiveThermalGap()

int D_PAD::GetEffectiveThermalGap ( wxString *  aSource = nullptr) const

Return the effective thermal gap having resolved any inheritance.

Definition at line 774 of file class_pad.cpp.

775 {
776  MODULE* module = GetParent();
777 
778  if( m_thermalGap == 0 && module )
779  {
780  if( aSource )
781  *aSource = _( "parent footprint" );
782 
783  return module->GetThermalGap();
784  }
785 
786  if( aSource )
787  *aSource = _( "pad" );
788 
789  return m_thermalGap;
790 }
int m_thermalGap
Definition: class_pad.h:728
MODULE * GetParent() const
Definition: class_pad.h:111
#define _(s)
Definition: 3d_actions.cpp:33
int GetThermalGap() const
Definition: class_module.h:267

References _, GetParent(), MODULE::GetThermalGap(), and m_thermalGap.

Referenced by ZONE_CONTAINER::GetThermalReliefGap(), and setupDummyPadForHole().

◆ GetEffectiveThermalSpokeWidth()

int D_PAD::GetEffectiveThermalSpokeWidth ( wxString *  aSource = nullptr) const

Return the effective thermal spoke width having resolved any inheritance.

Definition at line 755 of file class_pad.cpp.

756 {
757  MODULE* module = GetParent();
758 
759  if( m_thermalWidth == 0 && module )
760  {
761  if( aSource )
762  *aSource = _( "parent footprint" );
763 
764  return module->GetThermalWidth();
765  }
766 
767  if( aSource )
768  *aSource = _( "pad" );
769 
770  return m_thermalWidth;
771 }
MODULE * GetParent() const
Definition: class_pad.h:111
int m_thermalWidth
Definition: class_pad.h:727
#define _(s)
Definition: 3d_actions.cpp:33
int GetThermalWidth() const
Definition: class_module.h:264

References _, GetParent(), MODULE::GetThermalWidth(), and m_thermalWidth.

Referenced by ZONE_CONTAINER::GetThermalReliefSpokeWidth(), and setupDummyPadForHole().

◆ GetEffectiveZoneConnection()

ZONE_CONNECTION D_PAD::GetEffectiveZoneConnection ( wxString *  aSource = nullptr) const

Return the zone connection in effect (either locally overridden or overridden in the parent module).

Optionally reports on the source of the property (pad, parent footprint or zone).

Definition at line 734 of file class_pad.cpp.

735 {
736  MODULE* module = GetParent();
737 
739  {
740  if( aSource )
741  *aSource = _( "parent footprint" );
742 
743  return module->GetZoneConnection();
744  }
745  else
746  {
747  if( aSource )
748  *aSource = _( "pad" );
749 
750  return m_zoneConnection;
751  }
752 }
ZONE_CONNECTION GetZoneConnection() const
Definition: class_module.h:261
MODULE * GetParent() const
Definition: class_pad.h:111
ZONE_CONNECTION m_zoneConnection
Definition: class_pad.h:726
#define _(s)
Definition: 3d_actions.cpp:33

References _, GetParent(), MODULE::GetZoneConnection(), INHERITED, and m_zoneConnection.

Referenced by PCB_IO::format(), ZONE_CONTAINER::GetPadConnection(), ImportSettingsFrom(), setupDummyPadForHole(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in DRAWSEGMENT, and TRACK.

Definition at line 345 of file base_struct.h.

345 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: base_struct.h:337

References EDA_ITEM::GetPosition().

Referenced by PCB_BASE_FRAME::FocusOnItem(), and SCH_EDIT_FRAME::FocusOnItem().

◆ GetGroup()

const KIID& BOARD_ITEM::GetGroup ( ) const
inlineinherited

Get the group this item belongs to.

Returns
the group this item is in

Definition at line 114 of file class_board_item.h.

114 { return m_groupUuid; }

References BOARD_ITEM::m_groupUuid.

◆ GetKeepTopBottom()

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Function GetLayer returns the primary layer this item is on.

Reimplemented in ZONE_CONTAINER.

Definition at line 203 of file class_board_item.h.

203 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer(), GRAPHICS_CLEANER::areEquivalent(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), AR_AUTOPLACER::buildFpAreas(), TRACKS_CLEANER::cleanupSegments(), CreateBoardSection(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewModule(), CreateRoutesSection(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::Exchange_Module(), export_vrml_drawsegment(), export_vrml_edge_module(), export_vrml_module(), export_vrml_pcbtext(), export_vrml_text_module(), export_vrml_tracks(), PCB_TARGET::Flip(), TEXTE_PCB::Flip(), TRACK::Flip(), EDGE_MODULE::Flip(), TEXTE_MODULE::Flip(), DIMENSION::Flip(), MODULE::Flip(), ARC::Flip(), DRAWSEGMENT::Flip(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::formatLayer(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), MODULE::GetBoundingBox(), ZONE_CONTAINER::GetLayer(), getMatchingTextItem(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), GetMsgPanelInfo(), AR_AUTOPLACER::getOptimalModulePlacement(), BOARD::GetPad(), TEXT_MOD_GRID_TABLE::GetValueAsLong(), TRACK::GetWidthConstraints(), SELECTION_TOOL::GuessSelectionCandidates(), idf_export_module(), GENERAL_COLLECTOR::Inspect(), IsFlipped(), BOARD_ITEM::IsOnCopperLayer(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), MODULE_DESC::MODULE_DESC(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), DIALOG_DRC::OnDRCItemSelected(), TRACK::cmp_tracks::operator()(), DRAWSEGMENT::cmp_drawings::operator()(), BOARD_ITEM::ptr_cmp::operator()(), MODULE::cmp_drawings::operator()(), EAGLE_PLUGIN::packagePad(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotDrawSegment(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintGraphicItems(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotTextePcb(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), PAD_TOOL::recombinePad(), CLIPBOARD_IO::SaveSelection(), CONVERT_TOOL::SegmentToArc(), SELECTION_TOOL::Selectable(), TEXT_MOD_GRID_TABLE::SetValueAsLong(), GLOBAL_EDIT_TOOL::swapBoardItem(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), PNS_KICAD_IFACE_BASE::syncTrack(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperTextAndGraphics(), AR_AUTOPLACER::testModuleOnBoard(), TEXTE_MODULE::TEXTE_MODULE(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), BOARD_ADAPTER::transformGraphicModuleEdgeToPolygonSet(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), TRACK::ViewBBox(), TRACK::ViewGetLayers(), TEXTE_MODULE::ViewGetLayers(), TEXTE_MODULE::ViewGetLOD(), MODULE_ZONE_CONTAINER::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

Function GetLayerName returns the name of the PCB layer on which the item resides.

Returns
wxString containing the layer name associated with this item.

Definition at line 62 of file class_board_item.cpp.

63 {
64  BOARD* board = GetBoard();
65 
66  if( board )
67  return board->GetLayerName( m_Layer );
68 
69  // If no parent, return standard name
71 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
PCB_LAYER_ID m_Layer
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:178
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:628

References BOARD_ITEM::GetBoard(), BOARD::GetLayerName(), BOARD::GetStandardLayerName(), and BOARD_ITEM::m_Layer.

Referenced by PCB_IO::format(), PCB_IO::formatLayer(), TEXTE_PCB::GetMsgPanelInfo(), TEXTE_MODULE::GetMsgPanelInfo(), DRAWSEGMENT::GetMsgPanelInfo(), TEXTE_PCB::GetSelectMenuText(), EDGE_MODULE::GetSelectMenuText(), TRACK::GetSelectMenuText(), DIMENSION::GetSelectMenuText(), DRAWSEGMENT::GetSelectMenuText(), TEXTE_PCB::GetShownText(), TEXT_MOD_GRID_TABLE::GetValue(), and MODULE::ResolveTextVar().

◆ GetLayerSet()

◆ GetLocalClearance() [1/2]

int D_PAD::GetLocalClearance ( wxString *  aSource) const
overridevirtual

Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system.

These are things like zone clearance which are NOT an override.

Parameters
aSource[out] optionally reports the source as a user-readable string
Returns
int - the clearance in internal units.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 626 of file class_pad.cpp.

627 {
628  if( aSource )
629  *aSource = wxString::Format( _( "pad %s" ), GetName() );
630 
631  return m_localClearance;
632 }
int m_localClearance
Definition: class_pad.h:720
const wxString & GetName() const
Definition: class_pad.h:132
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201
#define _(s)
Definition: 3d_actions.cpp:33

References _, Format(), GetName(), and m_localClearance.

Referenced by PCB_IO::format(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::initValues(), DIALOG_PAD_PROPERTIES::padValuesOK(), setupDummyPadForHole(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ GetLocalClearance() [2/2]

int D_PAD::GetLocalClearance ( ) const
inline

Definition at line 351 of file class_pad.h.

351 { return m_localClearance; }
int m_localClearance
Definition: class_pad.h:720

References m_localClearance.

Referenced by GetLocalClearanceOverrides(), and PAD_DESC::PAD_DESC().

◆ GetLocalClearanceOverrides()

int D_PAD::GetLocalClearanceOverrides ( wxString *  aSource) const
overridevirtual

Function GetLocalClearanceOverrides returns any local clearance overrides set in the "classic" (ie: pre-rule) system.

Parameters
aSource[out] optionally reports the source as a user-readable string
Returns
int - the clearance in internal units.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 612 of file class_pad.cpp.

613 {
614  // A pad can have specific clearance that overrides its NETCLASS clearance value
615  if( GetLocalClearance() )
616  return GetLocalClearance( aSource );
617 
618  // A footprint can have a specific clearance value
619  if( GetParent() && GetParent()->GetLocalClearance() )
620  return GetParent()->GetLocalClearance( aSource );
621 
622  return 0;
623 }
int GetLocalClearance() const
Definition: class_pad.h:351
int GetLocalClearance() const
Definition: class_module.h:243
MODULE * GetParent() const
Definition: class_pad.h:111

References MODULE::GetLocalClearance(), GetLocalClearance(), and GetParent().

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

Definition at line 223 of file board_connected_item.h.

224  {
225  return m_localRatsnestVisible;
226  }

References BOARD_CONNECTED_ITEM::m_localRatsnestVisible.

Referenced by PCB_EDIT_FRAME::Exchange_Module().

◆ GetLocalSolderMaskMargin()

◆ GetLocalSolderPasteMargin()

int D_PAD::GetLocalSolderPasteMargin ( ) const
inline

◆ GetLocalSolderPasteMarginRatio()

double D_PAD::GetLocalSolderPasteMarginRatio ( ) const
inline

◆ GetMenuImage()

BITMAP_DEF D_PAD::GetMenuImage ( ) const
overridevirtual

Function GetMenuImage returns a pointer to an image to be used in menus.

The default version returns the right arrow image. Override this function to provide object specific menu images.

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 1081 of file class_pad.cpp.

1082 {
1083  return pad_xpm;
1084 }
const BITMAP_OPAQUE pad_xpm[1]
Definition: pad.cpp:41

References pad_xpm.

◆ GetMsgPanelInfo()

void D_PAD::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 793 of file class_pad.cpp.

794 {
795  EDA_UNITS units = aFrame->GetUserUnits();
796  wxString msg, msg2;
797  BOARD* board = GetBoard();
799  MODULE* module = (MODULE*) m_Parent;
800 
801  if( module )
802  aList.emplace_back( _( "Footprint" ), module->GetReference(), DARKCYAN );
803 
804  aList.emplace_back( _( "Pad" ), m_name, BROWN );
805 
806  if( !GetPinFunction().IsEmpty() )
807  aList.emplace_back( _( "Pin Name" ), GetPinFunction(), BROWN );
808 
809  aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN );
810 
811  // Display the netclass name (a pad having a netcode = 0 (no net) use the
812  // default netclass for clearance):
813  if( m_netinfo->GetNet() <= 0 )
814  msg = bds.GetDefault()->GetName();
815  else
816  msg = GetNetClassName();
817 
818  aList.emplace_back( _( "NetClass" ), msg, CYAN );
819 
820  aList.emplace_back( _( "Layer" ), LayerMaskDescribe(), DARKGREEN );
821 
822  // Show the pad shape, attribute and property
823  wxString props = ShowPadAttr();
824 
825  if( GetProperty() != PAD_PROP_NONE )
826  props += ',';
827 
828  switch( GetProperty() )
829  {
830  case PAD_PROP_NONE: break;
831  case PAD_PROP_BGA: props += _("BGA" ); break;
832  case PAD_PROP_FIDUCIAL_GLBL: props += _("Fiducial global" ); break;
833  case PAD_PROP_FIDUCIAL_LOCAL: props += _("Fiducial local" ); break;
834  case PAD_PROP_TESTPOINT: props += _("Test point" ); break;
835  case PAD_PROP_HEATSINK: props += _("Heat sink" ); break;
836  case PAD_PROP_CASTELLATED: props += _("Castellated" ); break;
837  }
838 
839  aList.emplace_back( ShowPadShape(), props, DARKGREEN );
840 
842  && m_size.x == m_size.y )
843  {
844  msg = MessageTextFromValue( units, m_size.x, true );
845  aList.emplace_back( _( "Diameter" ), msg, RED );
846  }
847  else
848  {
849  msg = MessageTextFromValue( units, m_size.x, true );
850  aList.emplace_back( _( "Width" ), msg, RED );
851 
852  msg = MessageTextFromValue( units, m_size.y, true );
853  aList.emplace_back( _( "Height" ), msg, RED );
854  }
855 
856  double module_orient_degrees = module ? module->GetOrientationDegrees() : 0;
857  double pad_orient_degrees = GetOrientationDegrees() - module_orient_degrees;
858  pad_orient_degrees = NormalizeAngleDegrees( pad_orient_degrees, -180.0, +180.0 );
859 
860  if( module_orient_degrees != 0.0 )
861  msg.Printf( wxT( "%.2f(+ %.2f)" ), pad_orient_degrees, module_orient_degrees );
862  else
863  msg.Printf( wxT( "%.1f" ), GetOrientationDegrees() );
864 
865  aList.push_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, LIGHTBLUE ) );
866 
867  if( GetPadToDieLength() )
868  {
869  msg = MessageTextFromValue(units, GetPadToDieLength(), true );
870  aList.emplace_back( _( "Length in Package" ), msg, CYAN );
871  }
872 
873  msg = MessageTextFromValue( units, m_drill.x, true );
874 
876  {
877  aList.emplace_back( _( "Drill" ), msg, RED );
878  }
879  else
880  {
881  msg = MessageTextFromValue( units, m_drill.x, true )
882  + wxT( "/" )
883  + MessageTextFromValue( units, m_drill.y, true );
884  aList.emplace_back( _( "Drill X / Y" ), msg, RED );
885  }
886 
887  wxString source;
888  int clearance = GetClearance( GetLayer(), nullptr, &source );
889 
890  msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance, true ) );
891  msg2.Printf( _( "(from %s)" ), source );
892  aList.emplace_back( msg, msg2, BLACK );
893 }
EDA_UNITS
Definition: common.h:198
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
no special fabrication property
Definition: pad_shapes.h:97
const wxString & GetName() const
Definition: netclass.h:96
a fiducial (usually a smd) for the full board
Definition: pad_shapes.h:99
double GetOrientationDegrees() const
Definition: class_pad.h:322
int GetPadToDieLength() const
Definition: class_pad.h:345
Definition: color4d.h:61
virtual wxString LayerMaskDescribe() const
Helper function Return a string (to be shown to the user) describing a layer mask.
Smd pad, used in BGA footprints.
Definition: pad_shapes.h:98
wxString GetNetname() const
Function GetNetname.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:537
wxSize m_size
Definition: class_pad.h:667
Definition: color4d.h:44
a pad used as heat sink, usually in SMD footprints
Definition: pad_shapes.h:102
const wxString & GetPinFunction() const
Definition: class_pad.h:138
wxString ShowPadAttr() const
Function ShowPadAttr.
Definition: class_pad.cpp:1050
wxString GetNetClassName() const
Function GetNetClassName returns a pointer to the netclass of the zone.
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:451
a pad with a castellated through hole
Definition: pad_shapes.h:103
virtual int GetClearance(PCB_LAYER_ID aLayer, BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const
Function GetClearance returns the clearance in internal units.
wxString m_name
Definition: class_pad.h:634
wxString ShowPadShape() const
Function ShowPadShape.
Definition: class_pad.cpp:1034
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:326
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
double GetOrientationDegrees() const
Definition: class_module.h:225
Definition: color4d.h:58
PAD_PROP_T GetProperty() const
Definition: class_pad.h:338
Definition: color4d.h:59
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124
a fiducial (usually a smd) local to the parent footprint
Definition: pad_shapes.h:100
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:178
#define _(s)
Definition: 3d_actions.cpp:33
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:152
wxSize m_drill
Definition: class_pad.h:666
NETCLASS * GetDefault() const
Function GetDefault.
double NormalizeAngleDegrees(double Angle, double aMin, double aMax)
Normalize angle to be aMin < angle <= aMax angle is in degrees.
Definition: trigo.h:311
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:157
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
a test point pad
Definition: pad_shapes.h:101
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References _, BLACK, BROWN, CYAN, DARKCYAN, DARKGREEN, BOARD_ITEM::GetBoard(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), GetDrillShape(), BOARD_ITEM::GetLayer(), NETCLASS::GetName(), NETINFO_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetClassName(), BOARD_CONNECTED_ITEM::GetNetname(), MODULE::GetOrientationDegrees(), GetOrientationDegrees(), GetPadToDieLength(), GetPinFunction(), GetProperty(), MODULE::GetReference(), GetShape(), EDA_BASE_FRAME::GetUserUnits(), BOARD_ITEM::LayerMaskDescribe(), LIGHTBLUE, m_drill, m_name, BOARD_CONNECTED_ITEM::m_netinfo, EDA_ITEM::m_Parent, m_size, MessageTextFromValue(), NormalizeAngleDegrees(), PAD_DRILL_SHAPE_CIRCLE, PAD_PROP_BGA, PAD_PROP_CASTELLATED, PAD_PROP_FIDUCIAL_GLBL, PAD_PROP_FIDUCIAL_LOCAL, PAD_PROP_HEATSINK, PAD_PROP_NONE, PAD_PROP_TESTPOINT, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, RED, ShowPadAttr(), ShowPadShape(), and UnescapeString().

◆ GetName()

◆ GetNet()

NETINFO_ITEM* BOARD_CONNECTED_ITEM::GetNet ( ) const
inlineinherited

Function GetNet Returns NET_INFO object for a given item.

Definition at line 82 of file board_connected_item.h.

83  {
84  return m_netinfo;
85  }
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

References BOARD_CONNECTED_ITEM::m_netinfo.

Referenced by PNS_PCBNEW_RULE_RESOLVER::DpNetPair(), DRAWING_TOOL::DrawVia(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), and PCB_EDIT_FRAME::SetTrackSegmentWidth().

◆ GetNetClass()

NETCLASS * BOARD_CONNECTED_ITEM::GetNetClass ( ) const
inherited

Function GetNetClassPtr returns the NETCLASS for this item.

Note: do NOT return a std::shared_ptr from this. It is used heavily in DRC, and the std::shared_ptr stuff shows up large in performance profiling.

Definition at line 111 of file board_connected_item.cpp.

112 {
113  NETCLASS* netclass = m_netinfo->GetNetClass();
114 
115  if( netclass )
116  return netclass;
117  else
118  return GetBoard()->GetDesignSettings().GetDefault();
119 }
NETCLASS * GetNetClass()
Function GetNetClass.
Definition: netinfo.h:128
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:537
NETCLASS handles a collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:49
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
NETCLASS * GetDefault() const
Function GetDefault.

References BOARD_ITEM::GetBoard(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), NETINFO_ITEM::GetNetClass(), and BOARD_CONNECTED_ITEM::m_netinfo.

Referenced by VIA::GetDrillValue(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), ROUTER_TOOL::prepareInteractive(), and DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow().

◆ GetNetClassName()

wxString BOARD_CONNECTED_ITEM::GetNetClassName ( ) const
inherited

Function GetNetClassName returns a pointer to the netclass of the zone.

If the net is not found (can happen when a netlist is reread, and the net name does not exist, return the default net class (should not return a null pointer).

Returns
the Net Class name of this item

Definition at line 122 of file board_connected_item.cpp.

123 {
124  return m_netinfo->GetClassName();
125 }
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
wxString GetClassName() const
Function GetClassName returns the class name.
Definition: netinfo.h:137

References NETINFO_ITEM::GetClassName(), and BOARD_CONNECTED_ITEM::m_netinfo.

Referenced by BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), GetMsgPanelInfo(), main(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ GetNetCode()

int BOARD_CONNECTED_ITEM::GetNetCode ( ) const
inlineinherited

Function GetNetCode.

Returns
int - the net code.

Definition at line 100 of file board_connected_item.h.

101  {
102  return m_netinfo ? m_netinfo->GetNet() : -1;
103  }
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

References NETINFO_ITEM::GetNet(), and BOARD_CONNECTED_ITEM::m_netinfo.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), ZONE_FILLER::buildCopperItemClearances(), BOARD::CombineAllAreasInNet(), connectedItemFilter(), CreateRoutesSection(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::Exchange_Module(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), ZONE_FILLER::Fill(), PNS::NODE::FindItemByParent(), PCB_IO::format(), DSN::SPECCTRA_DB::FromBOARD(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), CONNECTIVITY_DATA::GetConnectedItems(), ZONE_CONTAINER::GetInteractingZones(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), hash_eda(), hasThermalConnection(), DIALOG_PAD_PROPERTIES::initValues(), PCB_INSPECTION_TOOL::InspectClearance(), ZONE_CONTAINER::IsIsland(), ZONE_CONTAINER::IsSame(), DSN::SPECCTRA_DB::makeIMAGE(), AR_AUTOPLACER::nearestPad(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), BOARD::NormalizeAreaPolygon(), BOARD::OnAreaPolygonModified(), TRACK::cmp_tracks::operator()(), ZONE_SETTINGS::operator<<(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), process(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), SELECTION_TOOL::selectNet(), setupDummyPadForHole(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), BOARD::TestAreaIntersections(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), BOARD::TracksInNet(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ GetNetname()

wxString BOARD_CONNECTED_ITEM::GetNetname ( ) const
inlineinherited

◆ GetNetnameMsg()

wxString BOARD_CONNECTED_ITEM::GetNetnameMsg ( ) const
inlineinherited

Function GetNetnameMsg.

Returns
wxString - the full netname or "<no net>" in square braces, followed by "(Not Found)" if the netcode is undefined.

Definition at line 135 of file board_connected_item.h.

136  {
137  if( !GetBoard() )
138  return wxT( "[** NO BOARD DEFINED **]" );
139 
140  wxString netname = GetNetname();
141 
142  if( !netname.length() )
143  return wxT( "[<no net>]" );
144  else if( GetNetCode() < 0 )
145  return wxT( "[" + UnescapeString( netname ) + "](" + _( "Not Found" ) + ")" );
146  else
147  return wxT( "[" + UnescapeString( netname ) + "]" );
148  }
int GetNetCode() const
Function GetNetCode.
wxString GetNetname() const
Function GetNetname.
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:152

References _, BOARD_ITEM::GetBoard(), BOARD_CONNECTED_ITEM::GetNetCode(), BOARD_CONNECTED_ITEM::GetNetname(), and UnescapeString().

Referenced by TRACK::GetSelectMenuText(), VIA::GetSelectMenuText(), and ZONE_CONTAINER::GetSelectMenuText().

◆ GetOffset()

◆ GetOrientation()

◆ GetOrientationDegrees()

double D_PAD::GetOrientationDegrees ( ) const
inline

Definition at line 322 of file class_pad.h.

322 { return m_orient/10.0; }
double m_orient
Definition: class_pad.h:703

References m_orient.

Referenced by GetMsgPanelInfo(), DSN::SPECCTRA_DB::makeIMAGE(), and PAD_DESC::PAD_DESC().

◆ GetOrientationRadians()

double D_PAD::GetOrientationRadians ( ) const
inline

Definition at line 323 of file class_pad.h.

323 { return m_orient*M_PI/1800; }
double m_orient
Definition: class_pad.h:703

References m_orient.

◆ GetPadToDieLength()

◆ GetParent()

◆ GetPinFunction()

const wxString& D_PAD::GetPinFunction ( ) const
inline

◆ GetPos0()

const wxPoint& D_PAD::GetPos0 ( ) const
inline

◆ GetPosition()

◆ GetPrimitives()

const std::vector<std::shared_ptr<DRAWSEGMENT> >& D_PAD::GetPrimitives ( ) const
inline

Accessor to the basic shape list for custom-shaped pads.

Definition at line 273 of file class_pad.h.

274  {
275  return m_editPrimitives;
276  }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:646

References m_editPrimitives.

Referenced by PAD_TOOL::explodePad(), PCB_IO::format(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::initValues(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ GetProperty()

◆ GetRemoveUnconnected()

◆ GetRoundRectCornerRadius()

int D_PAD::GetRoundRectCornerRadius ( ) const

Definition at line 224 of file class_pad.cpp.

225 {
226  return KiROUND( std::min( m_size.x, m_size.y ) * m_roundedCornerScale );
227 }
double m_roundedCornerScale
Definition: class_pad.h:671
wxSize m_size
Definition: class_pad.h:667
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68

References KiROUND(), m_roundedCornerScale, and m_size.

Referenced by BuildEffectiveShapes(), CreatePadsShapesSection(), export_vrml_padshape(), DSN::SPECCTRA_DB::makePADSTACK(), DIALOG_PAD_PROPERTIES::onCornerSizePercentChange(), BRDITEMS_PLOTTER::PlotPad(), TransformShapeWithClearanceToPolygon(), and DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues().

◆ GetRoundRectRadiusRatio()

◆ GetSelectMenuText()

wxString D_PAD::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position.

The default version of this function raises an assertion in the debug mode and returns a string to indicate that it was not overridden to provide the object specific text.

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 1063 of file class_pad.cpp.

1064 {
1065  if( GetName().IsEmpty() )
1066  {
1067  return wxString::Format( _( "Pad of %s on %s" ),
1068  GetParent()->GetReference(),
1069  LayerMaskDescribe() );
1070  }
1071  else
1072  {
1073  return wxString::Format( _( "Pad %s of %s on %s" ),
1074  GetName(),
1075  GetParent()->GetReference(),
1076  LayerMaskDescribe() );
1077  }
1078 }
virtual wxString LayerMaskDescribe() const
Helper function Return a string (to be shown to the user) describing a layer mask.
const wxString & GetName() const
Definition: class_pad.h:132
MODULE * GetParent() const
Definition: class_pad.h:111
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201
#define _(s)
Definition: 3d_actions.cpp:33

References _, Format(), GetName(), GetParent(), and BOARD_ITEM::LayerMaskDescribe().

◆ GetShape()

◆ GetShortNetname()

wxString BOARD_CONNECTED_ITEM::GetShortNetname ( ) const
inlineinherited

Function GetShortNetname.

Returns
wxString - the short netname

Definition at line 154 of file board_connected_item.h.

155  {
156  return m_netinfo->GetShortNetname();
157  }
const wxString & GetShortNetname() const
Function GetShortNetname.
Definition: netinfo.h:237
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

References NETINFO_ITEM::GetShortNetname(), and BOARD_CONNECTED_ITEM::m_netinfo.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ GetSize()

◆ GetSolderMaskMargin()

int D_PAD::GetSolderMaskMargin ( ) const

Function GetSolderMaskMargin.

Returns
the margin for the solder mask layer usually > 0 (mask shape bigger than pad) For pads also on copper layers, the value (used to build a default shape) is 1 - the local value 2 - if 0, the parent footprint value 3 - if 0, the global value For pads NOT on copper layers, the value is the local value because there is no default shape to build

Definition at line 637 of file class_pad.cpp.

638 {
639  // The pad inherits the margin only to calculate a default shape,
640  // therefore only if it is also a copper layer
641  // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
642  // defined by the pad settings only
643  bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
644 
645  if( !isOnCopperLayer )
646  return 0;
647 
648  int margin = m_localSolderMaskMargin;
649 
650  MODULE* module = GetParent();
651 
652  if( module )
653  {
654  if( margin == 0 )
655  {
656  if( module->GetLocalSolderMaskMargin() )
657  margin = module->GetLocalSolderMaskMargin();
658  }
659 
660  if( margin == 0 )
661  {
662  BOARD* brd = GetBoard();
663 
664  if( brd )
665  margin = brd->GetDesignSettings().m_SolderMaskMargin;
666  }
667  }
668 
669  // ensure mask have a size always >= 0
670  if( margin < 0 )
671  {
672  int minsize = -std::min( m_size.x, m_size.y ) / 2;
673 
674  if( margin < minsize )
675  margin = minsize;
676  }
677 
678  return margin;
679 }
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:719
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:537
wxSize m_size
Definition: class_pad.h:667
int GetLocalSolderMaskMargin() const
Definition: class_module.h:240
int m_localSolderMaskMargin
Definition: class_pad.h:721
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
MODULE * GetParent() const
Definition: class_pad.h:111
LSET m_layerMask
Definition: class_pad.h:689
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:178

References LSET::AllCuMask(), BOARD_ITEM::GetBoard(), BOARD::GetDesignSettings(), MODULE::GetLocalSolderMaskMargin(), GetParent(), m_layerMask, m_localSolderMaskMargin, m_size, and BOARD_DESIGN_SETTINGS::m_SolderMaskMargin.

Referenced by KIGFX::PCB_PAINTER::draw(), and ViewBBox().

◆ GetSolderPasteMargin()

wxSize D_PAD::GetSolderPasteMargin ( ) const

Function GetSolderPasteMargin.

Returns
the margin for the solder mask layer usually < 0 (mask shape smaller than pad) because the margin can be dependent on the pad size, the margin has a x and a y value

For pads also on copper layers, the value (used to build a default shape) is 1 - the local value 2 - if 0, the parent footprint value 3 - if 0, the global value

For pads NOT on copper layers, the value is the local value because there is no default shape to build

Definition at line 682 of file class_pad.cpp.

683 {
684  // The pad inherits the margin only to calculate a default shape,
685  // therefore only if it is also a copper layer.
686  // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
687  // defined by the pad settings only
688  bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
689 
690  if( !isOnCopperLayer )
691  return wxSize( 0, 0 );
692 
693  int margin = m_localSolderPasteMargin;
694  double mratio = m_localSolderPasteMarginRatio;
695 
696  MODULE* module = GetParent();
697 
698  if( module )
699  {
700  if( margin == 0 )
701  margin = module->GetLocalSolderPasteMargin();
702 
703  auto brd = GetBoard();
704 
705  if( margin == 0 && brd )
706  {
707  margin = brd->GetDesignSettings().m_SolderPasteMargin;
708  }
709 
710  if( mratio == 0.0 )
711  mratio = module->GetLocalSolderPasteMarginRatio();
712 
713  if( mratio == 0.0 && brd )
714  {
715  mratio = brd->GetDesignSettings().m_SolderPasteMarginRatio;
716  }
717  }
718 
719  wxSize pad_margin;
720  pad_margin.x = margin + KiROUND( m_size.x * mratio );
721  pad_margin.y = margin + KiROUND( m_size.y * mratio );
722 
723  // ensure mask have a size always >= 0
724  if( pad_margin.x < -m_size.x / 2 )
725  pad_margin.x = -m_size.x / 2;
726 
727  if( pad_margin.y < -m_size.y / 2 )
728  pad_margin.y = -m_size.y / 2;
729 
730  return pad_margin;
731 }
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:719
wxSize m_size
Definition: class_pad.h:667
int m_localSolderPasteMargin
Definition: class_pad.h:722
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
double m_localSolderPasteMarginRatio
Definition: class_pad.h:723
int GetLocalSolderPasteMargin() const
Definition: class_module.h:254
MODULE * GetParent() const
Definition: class_pad.h:111
LSET m_layerMask
Definition: class_pad.h:689
double GetLocalSolderPasteMarginRatio() const
Definition: class_module.h:257
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68

References LSET::AllCuMask(), BOARD_ITEM::GetBoard(), MODULE::GetLocalSolderPasteMargin(), MODULE::GetLocalSolderPasteMarginRatio(), GetParent(), KiROUND(), m_layerMask, m_localSolderPasteMargin, m_localSolderPasteMarginRatio, and m_size.

Referenced by KIGFX::PCB_PAINTER::draw(), and ViewBBox().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 216 of file base_struct.h.

217  {
218  return m_Status & type;
219  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by TRACK::GetMsgPanelInfoBase_Common(), and TRACK::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

229 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

◆ GetSubRatsnest()

int D_PAD::GetSubRatsnest ( ) const
inline

Function GetSubRatsnest.

Returns
int - the netcode

Definition at line 509 of file class_pad.h.

509 { return m_subRatsnest; }
int m_subRatsnest
Definition: class_pad.h:663

References m_subRatsnest.

Referenced by CreatePadsShapesSection(), D_PAD(), and operator=().

◆ GetThermalGap()

int D_PAD::GetThermalGap ( ) const
inline

◆ GetThermalSpokeWidth()

int D_PAD::GetThermalSpokeWidth ( ) const
inline

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ GetZoneConnection()

ZONE_CONNECTION D_PAD::GetZoneConnection ( ) const
inline

Definition at line 441 of file class_pad.h.

441 { return m_zoneConnection; }
ZONE_CONNECTION m_zoneConnection
Definition: class_pad.h:726

References m_zoneConnection.

Referenced by DIALOG_PAD_PROPERTIES::initValues().

◆ HasFlag()

◆ HitTest() [1/2]

bool D_PAD::HitTest ( const wxPoint aPosition,
int  aAccuracy = 0 
) const
overridevirtual

Function HitTest tests if aPosition is contained within or on the bounding box of an item.

Parameters
aPositionA reference to a wxPoint object containing the coordinates to test.
aAccuracyIncrease the item bounding box by this amount.
Returns
True if aPosition is within the item bounding box.

Reimplemented from EDA_ITEM.

Definition at line 896 of file class_pad.cpp.

897 {
898  VECTOR2I delta = aPosition - GetPosition();
899  int boundingRadius = GetBoundingRadius() + aAccuracy;
900 
901  if( delta.SquaredEuclideanNorm() > SEG::Square( boundingRadius ) )
902  return false;
903 
904  return GetEffectivePolygon()->Contains( aPosition, -1, aAccuracy );
905 }
wxPoint GetPosition() const override
Definition: class_pad.h:165
extended_type SquaredEuclideanNorm() const
Function Squared Euclidean Norm computes the squared euclidean norm of the vector,...
Definition: vector2d.h:306
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(PCB_LAYER_ID=UNDEFINED_LAYER) const
Definition: class_pad.cpp:255
static SEG::ecoord Square(int a)
Definition: seg.h:116
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.cpp:282

References GetBoundingRadius(), GetEffectivePolygon(), GetPosition(), SEG::Square(), and VECTOR2< T >::SquaredEuclideanNorm().

◆ HitTest() [2/2]

bool D_PAD::HitTest ( const EDA_RECT aRect,
bool  aContained,
int  aAccuracy = 0 
) const
overridevirtual

Function HitTest tests if aRect intersects or is contained within the bounding box of an item.

Parameters
aRectA reference to a EDA_RECT object containing the rectangle to test.
aContainedSet to true to test for containment instead of an intersection.
aAccuracyIncrease aRect by this amount.
Returns
True if aRect contains or intersects the item bounding box.

Reimplemented from EDA_ITEM.

Definition at line 908 of file class_pad.cpp.

909 {
910  auto getArea = []( const SHAPE_POLY_SET& aPoly ) -> double
911  {
912  return aPoly.OutlineCount() ? aPoly.COutline( 0 ).Area() : 0;
913  };
914 
915  EDA_RECT arect = aRect;
916  arect.Normalize();
917  arect.Inflate( aAccuracy );
918 
919  EDA_RECT bbox = GetBoundingBox();
920 
921  if( !arect.Intersects( bbox ) )
922  return false;
923 
924  // This covers total containment for all test cases
925  if( arect.Contains( bbox ) )
926  return true;
927 
928  SHAPE_POLY_SET selRect;
929  selRect.NewOutline();
930  selRect.Append( arect.GetOrigin() );
931  selRect.Append( VECTOR2I( arect.GetRight(), arect.GetTop() ) );
932  selRect.Append( VECTOR2I( arect.GetRight(), arect.GetBottom() ) );
933  selRect.Append( VECTOR2I( arect.GetLeft(), arect.GetBottom() ) );
934 
936 
937  double padArea = getArea( *GetEffectivePolygon() );
938  double intersection = getArea( selRect );
939 
940  if( intersection > ( padArea * 0.99 ) )
941  return true;
942  else
943  return !aContained && intersection > 0;
944 }
int GetTop() const
Definition: eda_rect.h:123
int GetLeft() const
Definition: eda_rect.h:122
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(PCB_LAYER_ID=UNDEFINED_LAYER) const
Definition: class_pad.cpp:255
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
bool Contains(const wxPoint &aPoint) const
Function Contains.
int GetBottom() const
Definition: eda_rect.h:124
SHAPE_POLY_SET.
const wxPoint GetOrigin() const
Definition: eda_rect.h:114
int GetRight() const
Definition: eda_rect.h:121
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset intersection For aFastMode meaning, see function booleanOp
int NewOutline()
Creates a new empty polygon in the set and returns its index
void Normalize()
Function Normalize ensures that the height ant width are positive.
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox The bounding box is cached, so this will be efficient most of the time.
Definition: class_pad.cpp:458
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::BooleanIntersection(), EDA_RECT::Contains(), EDA_RECT::GetBottom(), GetBoundingBox(), GetEffectivePolygon(), EDA_RECT::GetLeft(), EDA_RECT::GetOrigin(), EDA_RECT::GetRight(), EDA_RECT::GetTop(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), SHAPE_POLY_SET::NewOutline(), EDA_RECT::Normalize(), and SHAPE_POLY_SET::PM_FAST.

◆ ImportSettingsFrom()

void D_PAD::ImportSettingsFrom ( const D_PAD aMasterPad)

Imports the pad settings from aMasterPad.

The result is "this" has the same settinds (sizes, shapes ... ) as aMasterPad

Parameters
aMasterPad= the template pad

Definition at line 1241 of file class_pad.cpp.

1242 {
1243  SetShape( aMasterPad.GetShape() );
1244  SetLayerSet( aMasterPad.GetLayerSet() );
1245  SetAttribute( aMasterPad.GetAttribute() );
1246  SetProperty( aMasterPad.GetProperty() );
1247 
1248  // I am not sure the m_LengthPadToDie must be imported, because this is
1249  // a parameter really specific to a given pad (JPC).
1250  // So this is currently non imported
1251  #if 0
1252  SetPadToDieLength( aMasterPad.GetPadToDieLength() );
1253  #endif
1254 
1255  // The pad orientation, for historical reasons is the
1256  // pad rotation + parent rotation.
1257  // So we have to manage this parent rotation
1258  double pad_rot = aMasterPad.GetOrientation();
1259 
1260  if( aMasterPad.GetParent() )
1261  pad_rot -= aMasterPad.GetParent()->GetOrientation();
1262 
1263  if( GetParent() )
1264  pad_rot += GetParent()->GetOrientation();
1265 
1266  SetOrientation( pad_rot );
1267 
1268  SetSize( aMasterPad.GetSize() );
1269  SetDelta( wxSize( 0, 0 ) );
1270  SetOffset( aMasterPad.GetOffset() );
1271  SetDrillSize( aMasterPad.GetDrillSize() );
1272  SetDrillShape( aMasterPad.GetDrillShape() );
1274  SetChamferRectRatio( aMasterPad.GetChamferRectRatio() );
1275  SetChamferPositions( aMasterPad.GetChamferPositions() );
1276 
1277  switch( aMasterPad.GetShape() )
1278  {
1279  case PAD_SHAPE_TRAPEZOID:
1280  SetDelta( aMasterPad.GetDelta() );
1281  break;
1282 
1283  case PAD_SHAPE_CIRCLE:
1284  // ensure size.y == size.x
1285  SetSize( wxSize( GetSize().x, GetSize().x ) );
1286  break;
1287 
1288  default:
1289  ;
1290  }
1291 
1292  switch( aMasterPad.GetAttribute() )
1293  {
1294  case PAD_ATTRIB_SMD:
1295  case PAD_ATTRIB_CONN:
1296  // These pads do not have hole (they are expected to be only on one
1297  // external copper layer)
1298  SetDrillSize( wxSize( 0, 0 ) );
1299  break;
1300 
1301  default:
1302  ;
1303  }
1304 
1305  // copy also local settings:
1306  SetLocalClearance( aMasterPad.GetLocalClearance() );
1310 
1313  SetThermalGap( aMasterPad.GetThermalGap() );
1314 
1316 
1317  // Add or remove custom pad shapes:
1318  ReplacePrimitives( aMasterPad.GetPrimitives() );
1319  SetAnchorPadShape( aMasterPad.GetAnchorPadShape() );
1320 
1321  m_shapesDirty = true;
1322 }
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:347
double GetOrientation() const
Definition: class_module.h:224
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:171
bool m_shapesDirty
Definition: class_pad.h:649
void SetChamferPositions(int aPositions)
has meaning only for chamfered rect pads set the position of the chamfers for orientation 0.
Definition: class_pad.h:502
int GetPadToDieLength() const
Definition: class_pad.h:345
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:81
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:229
void SetRoundRectRadiusRatio(double aRadiusScale)
has meaning only for rounded rect pads Set the ratio between the smaller X or Y size and the rounded ...
Definition: class_pad.cpp:239
int GetThermalGap() const
Definition: class_pad.h:464
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:335
int GetChamferPositions() const
Definition: class_pad.h:503
void SetThermalSpokeWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition: class_pad.h:455
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:198
const wxPoint & GetOffset() const
Definition: class_pad.h:233
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:326
double GetChamferRectRatio() const
Definition: class_pad.h:495
LSET GetLayerSet() const override
Function GetLayerSet returns a std::bitset of all layers on which the item physically resides.
Definition: class_pad.h:332
int GetLocalClearance(wxString *aSource) const override
Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system.
Definition: class_pad.cpp:626
void SetSize(const wxSize &aSize)
Definition: class_pad.h:223
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: class_pad.h:440
PAD_PROP_T GetProperty() const
Definition: class_pad.h:338
void SetPadToDieLength(int aLength)
Definition: class_pad.h:344
const wxSize & GetDelta() const
Definition: class_pad.h:227
ZONE_CONNECTION GetEffectiveZoneConnection(wxString *aSource=nullptr) const
Return the zone connection in effect (either locally overridden or overridden in the parent module).
Definition: class_pad.cpp:734
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:82
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:500
void SetLocalClearance(int aClearance)
Definition: class_pad.h:352
void ReplacePrimitives(const std::vector< std::shared_ptr< DRAWSEGMENT >> &aPrimitivesList)
Clear the current custom shape primitives list and import a new list.
MODULE * GetParent() const
Definition: class_pad.h:111
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:358
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: class_pad.h:177
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
Definition: class_pad.h:325
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:348
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in a variety of units (the basic call r...
Definition: class_pad.h:321
const wxSize & GetDrillSize() const
Definition: class_pad.h:230
void SetShape(PAD_SHAPE_T aShape)
Set the new shape of this pad.
Definition: class_pad.h:148
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:519
double GetRoundRectRadiusRatio() const
Definition: class_pad.h:487
void SetChamferRectRatio(double aChamferScale)
has meaning only for chamfered rect pads Set the ratio between the smaller X or Y size and chamfered ...
Definition: class_pad.cpp:247
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:355
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:187
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:157
const std::vector< std::shared_ptr< DRAWSEGMENT > > & GetPrimitives() const
Accessor to the basic shape list for custom-shaped pads.
Definition: class_pad.h:273
const wxSize & GetSize() const
Definition: class_pad.h:224
void SetProperty(PAD_PROP_T aProperty)
Definition: class_pad.cpp:511
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:354
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:232
int GetThermalSpokeWidth() const
Definition: class_pad.h:456
void SetThermalGap(int aGap)
Definition: class_pad.h:463
void SetLayerSet(LSET aLayers) override
Definition: class_pad.h:331
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:357
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:226

References GetAnchorPadShape(), GetAttribute(), GetChamferPositions(), GetChamferRectRatio(), GetCustomShapeInZoneOpt(), GetDelta(), GetDrillShape(), GetDrillSize(), GetEffectiveZoneConnection(), GetLayerSet(), GetLocalClearance(), GetLocalSolderMaskMargin(), GetLocalSolderPasteMargin(), GetLocalSolderPasteMarginRatio(), GetOffset(), MODULE::GetOrientation(), GetOrientation(), GetPadToDieLength(), GetParent(), GetPrimitives(), GetProperty(), GetRoundRectRadiusRatio(), GetShape(), GetSize(), GetThermalGap(), GetThermalSpokeWidth(), m_shapesDirty, PAD_ATTRIB_CONN, PAD_ATTRIB_SMD, PAD_SHAPE_CIRCLE, PAD_SHAPE_TRAPEZOID, ReplacePrimitives(), SetAnchorPadShape(), SetAttribute(), SetChamferPositions(), SetChamferRectRatio(), SetCustomShapeInZoneOpt(), SetDelta(), SetDrillShape(), SetDrillSize(), SetLayerSet(), SetLocalClearance(), SetLocalSolderMaskMargin(), SetLocalSolderPasteMargin(), SetLocalSolderPasteMarginRatio(), SetOffset(), SetOrientation(), SetPadToDieLength(), SetProperty(), SetRoundRectRadiusRatio(), SetShape(), SetSize(), SetThermalGap(), SetThermalSpokeWidth(), and SetZoneConnection().

Referenced by PAD_TOOL::copyPadSettings(), D_PAD(), operator=(), and PAD_TOOL::PlacePad().

◆ IsAperturePad()

bool D_PAD::IsAperturePad ( ) const
inline

Definition at line 342 of file class_pad.h.

342 { return ( m_layerMask & LSET::AllCuMask() ).none(); }
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:719
LSET m_layerMask
Definition: class_pad.h:689

References LSET::AllCuMask(), and m_layerMask.

Referenced by doPushPadProperties(), DIALOG_PAD_PROPERTIES::initValues(), and PAD_NAMING::PadCanHaveName().

◆ IsBrightened()

◆ IsConnected()

bool BOARD_CONNECTED_ITEM::IsConnected ( ) const
inlineoverridevirtualinherited

Reimplemented from BOARD_ITEM.

Definition at line 73 of file board_connected_item.h.

74  {
75  return true;
76  }

◆ IsDirty()

bool D_PAD::IsDirty ( ) const
inline

Definition at line 328 of file class_pad.h.

328 { return m_shapesDirty; }
bool m_shapesDirty
Definition: class_pad.h:649

References m_shapesDirty.

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 201 of file base_struct.h.

201 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_DRAGGED, and EDA_ITEM::m_Flags.

Referenced by DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), and KIGFX::SCH_PAINTER::setDeviceColors().

◆ IsFlipped()

bool D_PAD::IsFlipped ( ) const
Returns
true if the pad has a footprint parent flipped (on the back/bottom layer)

Definition at line 176 of file class_pad.cpp.

177 {
178  if( GetParent() && GetParent()->GetLayer() == B_Cu )
179  return true;
180  return false;
181 }
MODULE * GetParent() const
Definition: class_pad.h:111
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

References B_Cu, BOARD_ITEM::GetLayer(), and GetParent().

Referenced by DIALOG_PAD_PROPERTIES::initValues(), and ViewGetLOD().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 286 of file base_struct.h.

286 { return m_forceVisible; }
bool m_forceVisible
Definition: base_struct.h:175

References EDA_ITEM::m_forceVisible.

Referenced by KIGFX::SCH_PAINTER::draw(), and SCH_FIELD::Print().

◆ IsInGroup()

bool BOARD_ITEM::IsInGroup ( )
inlineinherited

Test if this item is inside a group.

Returns
true if inside a group

Definition at line 121 of file class_board_item.h.

121 { return m_groupUuid != niluuid; }
KIID niluuid(0)

References BOARD_ITEM::m_groupUuid, and niluuid.

Referenced by PCB_GROUP::AddItem(), and PCB_GROUP::RemoveItem().

◆ IsLocked()

virtual bool BOARD_ITEM::IsLocked ( ) const
inlinevirtualinherited

Function IsLocked.

Returns
bool - true if the object is locked, else false

Reimplemented in MODULE, and TRACK.

Definition at line 278 of file class_board_item.h.

279  {
280  // only MODULEs & TRACKs can be locked at this time.
281  return false;
282  }

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), PCBNEW_CONTROL::DeleteItemCursor(), EditToolSelectionFilter(), GENERAL_COLLECTOR::Inspect(), SELECTION_TOOL::itemPassesFilter(), and PCB_EDITOR_CONTROL::modifyLockSelected().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 198 of file base_struct.h.

198 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:113
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

bool D_PAD::IsOnCopperLayer ( ) const
inlineoverridevirtual
Returns
true if the pad is on any copper layer, false otherwise. pads can be only on tech layers to build special pads. they are therefore not always on a copper layer

Reimplemented from BOARD_ITEM.

Definition at line 209 of file class_pad.h.

210  {
211  return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
212  }
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:719
LSET GetLayerSet() const override
Function GetLayerSet returns a std::bitset of all layers on which the item physically resides.
Definition: class_pad.h:332

References LSET::AllCuMask(), and GetLayerSet().

Referenced by CN_LIST::Add().

◆ IsOnLayer()

bool D_PAD::IsOnLayer ( PCB_LAYER_ID  aLayer) const
inlineoverridevirtual

Function IsOnLayer tests to see if this object is on the given layer.

Is virtual so objects like D_PAD, which reside on multiple layers can do their own form of testing.

Parameters
aLayerThe layer to test for.
Returns
bool - true if on given layer, else false.

Reimplemented from BOARD_ITEM.

Definition at line 528 of file class_pad.h.

529  {
530  return m_layerMask[aLayer];
531  }
LSET m_layerMask
Definition: class_pad.h:689

References m_layerMask.

Referenced by AR_AUTOPLACER::addPad(), PAD_TOOL::explodePad(), GENERAL_COLLECTOR::Inspect(), IsPadOnLayer(), DSN::SPECCTRA_DB::makePADSTACK(), PAD_TOOL::recombinePad(), and ViewGetLayers().

◆ IsPadOnLayer() [1/2]

bool D_PAD::IsPadOnLayer ( int  aLayer) const

We don't remove the copper from non-PTH pads

Heatsink pads always get copper

Plated through hole pads need copper on the top/bottom layers for proper soldering Unless the user has removed them in the pad dialog

Definition at line 196 of file class_pad.cpp.

197 {
198  BOARD* board = GetBoard();
199 
200  if( !board )
201  return false;
202 
205  return IsOnLayer( static_cast<PCB_LAYER_ID>( aLayer ) );
206 
208  if( GetProperty() == PAD_PROP_HEATSINK )
209  return IsOnLayer( static_cast<PCB_LAYER_ID>( aLayer ) );
210 
212  return IsOnLayer( static_cast<PCB_LAYER_ID>( aLayer ) );
213 
216  if( aLayer == F_Cu || aLayer == B_Cu )
217  return IsOnLayer( static_cast<PCB_LAYER_ID>( aLayer ) );
218 
219  return board->GetConnectivity()->IsConnectedOnLayer( this, static_cast<int>( aLayer ),
221 }
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
a pad used as heat sink, usually in SMD footprints
Definition: pad_shapes.h:102
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:335
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:345
PAD_PROP_T GetProperty() const
Definition: class_pad.h:338
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:178
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
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:528
bool m_removeUnconnectedLayer
Definition: class_pad.h:707

References B_Cu, F_Cu, GetAttribute(), BOARD_ITEM::GetBoard(), BOARD::GetConnectivity(), GetProperty(), IsOnLayer(), m_removeUnconnectedLayer, PAD_ATTRIB_STANDARD, PAD_PROP_HEATSINK, PCB_ARC_T, PCB_PAD_T, PCB_TRACE_T, and PCB_VIA_T.

Referenced by PNS_KICAD_IFACE::IsOnLayer(), IsPadOnLayer(), and ViewGetLOD().

◆ IsPadOnLayer() [2/2]

bool D_PAD::IsPadOnLayer ( LSET  aLayers) const

Definition at line 184 of file class_pad.cpp.

185 {
186  for( auto layer : aLayers.Seq() )
187  {
188  if( IsPadOnLayer( layer ) )
189  return true;
190  }
191 
192  return false;
193 }
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:380
bool IsPadOnLayer(int aLayer) const
Definition: class_pad.cpp:196

References IsPadOnLayer(), and LSET::Seq().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Function IsReplaceable.

Override this method in any derived object that supports test find and replace.

Returns
True if the item has replaceable text that can be modified using the find and replace dialog.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_LABEL, SCH_TEXT, SCH_SHEET_PIN, and SCH_FIELD.

Definition at line 502 of file base_struct.h.

502 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 204 of file base_struct.h.

204 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118

References IS_RESIZED, and EDA_ITEM::m_Flags.

Referenced by KIGFX::SCH_PAINTER::setDeviceColors().

◆ IsSelected()

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

Function IsTrack tests to see if this object is a track or via (or microvia).

form of testing.

Returns
bool - true if a track or via, else false.

Definition at line 269 of file class_board_item.h.

270  {
271  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
272  }
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References PCB_TRACE_T, PCB_VIA_T, and EDA_ITEM::Type().

◆ IsType()

bool D_PAD::IsType ( const KICAD_T  aScanTypes[]) const
inlineoverridevirtual

Function IsType Checks whether the item is one of the listed types.

Parameters
aScanTypesList of item types
Returns
true if the item type is contained in the list aScanTypes

Reimplemented from EDA_ITEM.

Definition at line 90 of file class_pad.h.

91  {
92  if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
93  return true;
94 
95  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
96  {
97  if( m_drill.x > 0 && m_drill.y > 0 )
98  {
99  if( *p == PCB_LOCATE_HOLE_T )
100  return true;
102  return true;
104  return true;
105  }
106  }
107 
108  return false;
109  }
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
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_ATTR_T m_attribute
Definition: class_pad.h:699
virtual bool IsType(const KICAD_T aScanTypes[]) const
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:262
wxSize m_drill
Definition: class_pad.h:666

References EOT, EDA_ITEM::IsType(), m_attribute, m_drill, PAD_ATTRIB_HOLE_NOT_PLATED, PCB_LOCATE_HOLE_T, PCB_LOCATE_NPTH_T, and PCB_LOCATE_PTH_T.

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 202 of file base_struct.h.

202 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward() [1/2]

template<class T >
static SEARCH_RESULT EDA_ITEM::IterateForward ( std::deque< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

This changes first parameter to avoid the DList and use the main queue instead

Definition at line 384 of file base_struct.h.

388  {
389  for( auto it : aList )
390  {
391  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
393  return SEARCH_RESULT::QUIT;
394  }
395 
397  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

References CONTINUE, QUIT, and EDA_ITEM::Visit().

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

template<class T >
static SEARCH_RESULT EDA_ITEM::IterateForward ( std::vector< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

This changes first parameter to avoid the DList and use std::vector instead

Definition at line 405 of file base_struct.h.

407  {
408  for( auto it : aList )
409  {
410  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
412  return SEARCH_RESULT::QUIT;
413  }
414 
416  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

References CONTINUE, QUIT, and EDA_ITEM::Visit().

◆ LayerMaskDescribe()

wxString BOARD_ITEM::LayerMaskDescribe ( ) const
protectedvirtualinherited

Helper function Return a string (to be shown to the user) describing a layer mask.

The BOARD is needed because layer names are (somewhat) customizable

Reimplemented in VIA.

Definition at line 74 of file class_board_item.cpp.

75 {
76  BOARD* board = GetBoard();
77  LSET layers = GetLayerSet();
78 
79  // Try to be smart and useful. Check all copper first.
80  if( layers[F_Cu] && layers[B_Cu] )
81  return _( "all copper layers" );
82 
83  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
84  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
85 
86  for( LSET testLayers : { copperLayers, techLayers, layers } )
87  {
88  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
89  {
90  if( testLayers[ bit ] )
91  {
92  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
93 
94  if( testLayers.count() > 1 )
95  layerInfo << _( " and others" );
96 
97  return layerInfo;
98  }
99  }
100  }
101 
102  // No copper, no technicals: no layer
103  return _( "no layers" );
104 }
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:719
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:789
LSET is a set of PCB_LAYER_IDs.
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:178
#define _(s)
Definition: 3d_actions.cpp:33
virtual LSET GetLayerSet() const
Function GetLayerSet returns a std::bitset of all layers on which the item physically resides.

References _, LSET::AllCuMask(), LSET::AllTechMask(), B_Cu, F_Cu, BOARD_ITEM::GetBoard(), BOARD::GetEnabledLayers(), BOARD::GetLayerName(), BOARD_ITEM::GetLayerSet(), PCB_LAYER_ID_COUNT, and PCBNEW_LAYER_ID_START.

Referenced by TRACK::GetMsgPanelInfo(), GetMsgPanelInfo(), and GetSelectMenuText().

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData 
)
inlinevirtualinherited

Function Matches compares the item against the search criteria in aSearchData.

The base class returns false since many of the objects derived from EDA_ITEM do not have any text to search.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_TEXT, SCH_SHEET_PIN, SCH_FIELD, SCH_PIN, TEXTE_MODULE, SCH_MARKER, MARKER_PCB, and TEXTE_PCB.

Definition at line 458 of file base_struct.h.

459  {
460  return false;
461  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), TEXTE_PCB::Matches(), MARKER_PCB::Matches(), SCH_MARKER::Matches(), TEXTE_MODULE::Matches(), SCH_PIN::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
wxFindReplaceData &  aSearchData 
)
protectedinherited

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

Parameters
aTextA reference to a wxString object containing the string to test.
aSearchDataThe criteria to search against.
Returns
True if aText matches the search criteria in aSearchData.

Definition at line 140 of file base_struct.cpp.

141 {
142  wxString text = aText;
143  wxString searchText = aSearchData.GetFindString();
144 
145  // Don't match if searching for replaceable item and the item doesn't support text replace.
146  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
147  return false;
148 
149  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
150  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
151 
152  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
153  {
154  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
155  return text.Matches( searchText );
156 
157  return text.MakeUpper().Matches( searchText.MakeUpper() );
158  }
159 
160  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
161  return aText.Find( searchText ) != wxNOT_FOUND;
162 
163  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
164 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:502

References FR_MATCH_WILDCARD, FR_SEARCH_REPLACE, and EDA_ITEM::IsReplaceable().

◆ MergePrimitivesAsPolygon()

void D_PAD::MergePrimitivesAsPolygon ( SHAPE_POLY_SET aMergedPolygon,
PCB_LAYER_ID  aLayer 
) const

Merge all basic shapes to a SHAPE_POLY_SET Note: The results are relative to the pad position, orientation 0.

Definition at line 196 of file pad_custom_shape_functions.cpp.

197 {
198  auto board = GetBoard();
199  int maxError = ARC_HIGH_DEF;
200 
201  if( board )
202  maxError = board->GetDesignSettings().m_MaxError;
203 
204  aMergedPolygon->RemoveAllContours();
205 
206  // Add the anchor pad shape in aMergedPolygon, others in aux_polyset:
207  // The anchor pad is always at 0,0
208  switch( GetAnchorPadShape() )
209  {
210  case PAD_SHAPE_RECT:
211  {
212  SHAPE_RECT rect( -GetSize().x / 2, -GetSize().y / 2, GetSize().x, GetSize().y );
213  aMergedPolygon->AddOutline( rect.Outline() );
214  }
215  break;
216 
217  default:
218  case PAD_SHAPE_CIRCLE:
219  TransformCircleToPolygon( *aMergedPolygon, wxPoint( 0, 0 ), GetSize().x / 2, maxError );
220  break;
221  }
222 
223  addPadPrimitivesToPolygon( aMergedPolygon, aLayer, maxError );
224 }
void addPadPrimitivesToPolygon(SHAPE_POLY_SET *aMergedPolygon, PCB_LAYER_ID aLayer, int aError) const
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:171
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
void TransformCircleToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCenter, int aRadius, int aError)
Function TransformCircleToPolygon convert a circle to a polygon, using multiple straight lines.
const wxSize & GetSize() const
Definition: class_pad.h:224

References SHAPE_POLY_SET::AddOutline(), addPadPrimitivesToPolygon(), GetAnchorPadShape(), BOARD_ITEM::GetBoard(), GetSize(), SHAPE_RECT::Outline(), PAD_SHAPE_CIRCLE, PAD_SHAPE_RECT, SHAPE_POLY_SET::RemoveAllContours(), and TransformCircleToPolygon().

Referenced by CreatePadsShapesSection(), export_vrml_padshape(), DSN::SPECCTRA_DB::makePADSTACK(), DIALOG_PAD_PROPERTIES::padValuesOK(), and TransformShapeWithClearanceToPolygon().

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 317 of file class_board_item.h.

318  {
319  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
320  }
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.

References BOARD_ITEM::Move(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ Move() [2/2]

void D_PAD::Move ( const wxPoint aMoveVector)
inlineoverridevirtual

Function Move move this object.

Parameters
aMoveVector- the move vector for this object.

Reimplemented from BOARD_ITEM.

Definition at line 567 of file class_pad.h.

568  {
569  m_pos += aMoveVector;
570  SetLocalCoord();
571  m_shapesDirty = true;
572  }
bool m_shapesDirty
Definition: class_pad.h:649
void SetLocalCoord()
Set relative coordinates.
Definition: class_pad.cpp:485
wxPoint m_pos
Definition: class_pad.h:637

References m_pos, m_shapesDirty, and SetLocalCoord().

◆ operator<()

bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

Parameters
aItem- Item to compare against.
Returns
- True if aItem is less than the item.

Definition at line 194 of file base_struct.cpp.

195 {
196  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
197  GetChars( GetClass() ) ) );
198 
199  return false;
200 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153
virtual wxString GetClass() const =0
Function GetClass returns the class name.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201

References Format(), GetChars(), and EDA_ITEM::GetClass().

◆ operator=()

D_PAD & D_PAD::operator= ( const D_PAD aOther)

Definition at line 122 of file class_pad.cpp.

123 {
125 
126  ImportSettingsFrom( aOther );
128  SetPosition( aOther.GetPosition() );
129  SetPos0( aOther.GetPos0() );
130  SetName( aOther.GetName() );
131  SetPinFunction( aOther.GetPinFunction() );
132  SetSubRatsnest( aOther.GetSubRatsnest() );
136 
137  return *this;
138 }
const wxPoint & GetPos0() const
Definition: class_pad.h:218
wxPoint GetPosition() const override
Definition: class_pad.h:165
int GetPadToDieLength() const
Definition: class_pad.h:345
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:159
void SetSubRatsnest(int aSubRatsnest)
Definition: class_pad.h:510
const wxString & GetPinFunction() const
Definition: class_pad.h:138
bool m_keepTopBottomLayer
Definition: class_pad.h:708
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:131
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:217
int m_effectiveBoundingRadius
Definition: class_pad.h:650
const wxString & GetName() const
Definition: class_pad.h:132
void SetPadToDieLength(int aLength)
Definition: class_pad.h:344
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
void ImportSettingsFrom(const D_PAD &aMasterPad)
Imports the pad settings from aMasterPad.
Definition: class_pad.cpp:1241
int GetSubRatsnest() const
Function GetSubRatsnest.
Definition: class_pad.h:509
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition: class_pad.h:137
bool m_removeUnconnectedLayer
Definition: class_pad.h:707

References GetName(), GetPadToDieLength(), GetPinFunction(), GetPos0(), GetPosition(), GetSubRatsnest(), ImportSettingsFrom(), m_effectiveBoundingRadius, m_keepTopBottomLayer, m_removeUnconnectedLayer, EDA_ITEM::operator=(), SetName(), SetPadToDieLength(), SetPinFunction(), SetPos0(), SetPosition(), and SetSubRatsnest().

◆ PadNameEqual()

bool D_PAD::PadNameEqual ( const D_PAD other) const
inline

Definition at line 140 of file class_pad.h.

141  {
142  return m_name == other->m_name; // hide tricks behind sensible API
143  }
wxString m_name
Definition: class_pad.h:634

References m_name.

Referenced by DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc().

◆ PadShouldBeNPTH()

bool D_PAD::PadShouldBeNPTH ( ) const

A pad whose hole is the same size as the pad is a NPTH.

However, if the user fails to mark this correctly then the pad will become invisible on the board. This check allows us to special-case this error-condition.

Definition at line 1093 of file class_pad.cpp.

1094 {
1095  return( m_attribute == PAD_ATTRIB_STANDARD
1096  && m_drill.x >= m_size.x && m_drill.y >= m_size.y );
1097 }
wxSize m_size
Definition: class_pad.h:667
PAD_ATTR_T m_attribute
Definition: class_pad.h:699
wxSize m_drill
Definition: class_pad.h:666

References m_attribute, m_drill, m_size, and PAD_ATTRIB_STANDARD.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ Replace() [1/2]

bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
wxString &  aText 
)
staticinherited

Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aTextA reference to a wxString object containing the text to be replaced.
Returns
True if aText was modified, otherwise false.

Definition at line 167 of file base_struct.cpp.

168 {
169  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
170 
171  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
172  aSearchData.GetFindString() :
173  aSearchData.GetFindString().Upper() );
174 
175  if( result == wxNOT_FOUND )
176  return false;
177 
178  wxString prefix = aText.Left( result );
179  wxString suffix;
180 
181  if( aSearchData.GetFindString().length() + result < aText.length() )
182  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
183 
184  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
185