KiCad PCB EDA Suite
PAD Class Reference

#include <pad.h>

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

Public Member Functions

 PAD (FOOTPRINT *parent)
 
 PAD (const PAD &aPad)
 
PADoperator= (const PAD &aOther)
 
bool IsType (const KICAD_T aScanTypes[]) const override
 Check whether the item is one of the listed types. More...
 
FOOTPRINTGetParent () const
 
wxString GetParentAsString () const
 
bool IsLocked () const override
 
void ImportSettingsFrom (const PAD &aMasterPad)
 Import the pad settings from aMasterPad. More...
 
bool IsFlipped () const
 
void SetNumber (const wxString &aNumber)
 Set the pad number (note that it can be alphanumeric, such as the array reference "AA12"). More...
 
const wxString & GetNumber () const
 
bool CanHaveNumber () const
 Indicates whether or not the pad can have a number. More...
 
void SetPinFunction (const wxString &aName)
 Set the pad function (pin name in schematic) More...
 
const wxString & GetPinFunction () const
 
void SetPinType (const wxString &aType)
 Set the pad electrical type. More...
 
const wxString & GetPinType () const
 
bool SameLogicalPadAs (const PAD *other) const
 Before we had custom pad shapes it was common to have multiple overlapping pads to represent a more complex shape. More...
 
void SetShape (PAD_SHAPE aShape)
 Set the new shape of this pad. More...
 
PAD_SHAPE GetShape () const
 
void SetPosition (const wxPoint &aPos) override
 
wxPoint GetPosition () const override
 
PAD_SHAPE GetAnchorPadShape () const
 
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 aShape)
 Set the shape of the anchor pad for custom shaped pads. More...
 
bool IsOnCopperLayer () const override
 
void SetY (int y)
 
void SetX (int x)
 
void SetPos0 (const wxPoint &aPos)
 
const wxPoint & GetPos0 () const
 
void SetY0 (int y)
 
void SetX0 (int x)
 
void SetSize (const wxSize &aSize)
 
const wxSize & GetSize () const
 
void SetSizeX (const int aX)
 
const int GetSizeX () const
 
void SetSizeY (const int aY)
 
const int GetSizeY () const
 
void SetDelta (const wxSize &aSize)
 
const wxSize & GetDelta () const
 
void SetDrillSize (const wxSize &aSize)
 
const wxSize & GetDrillSize () const
 
void SetDrillSizeX (const int aX)
 
const int GetDrillSizeX () const
 
void SetDrillSizeY (const int aY)
 
const int GetDrillSizeY () const
 
void SetOffset (const wxPoint &aOffset)
 
const wxPoint & GetOffset () const
 
wxPoint GetCenter () const override
 This defaults to the center of the bounding box if not overridden. More...
 
void AddPrimitivePoly (const SHAPE_POLY_SET &aPoly, int aThickness, bool aFilled)
 Has meaning only for custom shape pads. More...
 
void AddPrimitivePoly (const std::vector< wxPoint > &aPoly, int aThickness, bool aFilled)
 
void AddPrimitiveSegment (const wxPoint &aStart, const wxPoint &aEnd, int aThickness)
 
void AddPrimitiveCircle (const wxPoint &aCenter, int aRadius, int aThickness, bool aFilled)
 
void AddPrimitiveRect (const wxPoint &aStart, const wxPoint &aEnd, int aThickness, bool aFilled)
 
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, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
 Merge all basic shapes to a SHAPE_POLY_SET. More...
 
void DeletePrimitivesList ()
 Clear the basic shapes list. More...
 
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives () const
 Accessor to the basic shape list for custom-shaped pads. More...
 
void Flip (const wxPoint &aCentre, bool aFlipLeftRight) override
 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< PCB_SHAPE >> &aPrimitivesList)
 Clear the current custom shape primitives list and import a new list. More...
 
void AppendPrimitives (const std::vector< std::shared_ptr< PCB_SHAPE >> &aPrimitivesList)
 Import a custom shape primitive list (composed of basic shapes) and add items to the current list. More...
 
void AddPrimitive (PCB_SHAPE *aPrimitive)
 Add item to the custom shape primitives list. More...
 
void SetOrientation (double aAngle)
 Set the rotation angle of the pad. More...
 
void SetOrientationDegrees (double aOrientation)
 Set orientation in degrees. More...
 
double GetOrientation () const
 Return 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
 Return a std::bitset of all layers on which the item physically resides. More...
 
void SetAttribute (PAD_ATTRIB aAttribute)
 
PAD_ATTRIB GetAttribute () const
 
void SetProperty (PAD_PROP aProperty)
 
PAD_PROP 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
 Return 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, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
 Convert the pad shape to a closed polygon. More...
 
bool TransformHoleWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, int aError, ERROR_LOC aErrorLoc) const
 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, FLASHING aFlash=FLASHING::DEFAULT) const override
 Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon () const
 
const SHAPE_SEGMENTGetEffectiveHoleShape () const
 Return a SHAPE object representing the pad's hole. More...
 
int GetBoundingRadius () const
 Return the radius of a minimum sized circle which fully encloses this pad. More...
 
int GetLocalClearanceOverrides (wxString *aSource) const override
 Return any local clearance overrides set in the "classic" (ie: pre-rule) system. More...
 
int GetSolderMaskMargin () const
 
wxSize GetSolderPasteMargin () const
 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. 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 footprint). 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)
 Has meaning only for rounded rectangle pads. More...
 
int GetRoundRectCornerRadius () const
 
wxPoint ShapePos () const
 
void SetRoundRectRadiusRatio (double aRadiusScale)
 Has meaning only for rounded rectangle pads. More...
 
double GetRoundRectRadiusRatio () const
 
void SetChamferRectRatio (double aChamferScale)
 Has meaning only for chamfered rectangular pads. More...
 
double GetChamferRectRatio () const
 
void SetChamferPositions (int aPositions)
 Has meaning only for chamfered rectangular pads. More...
 
int GetChamferPositions () const
 
int GetSubRatsnest () const
 
void SetSubRatsnest (int aSubRatsnest)
 
void SetRemoveUnconnected (bool aSet)
 Set the unconnected removal property. More...
 
bool GetRemoveUnconnected () const
 
void SetKeepTopBottom (bool aSet)
 Set 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
 Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
bool IsOnLayer (PCB_LAYER_ID aLayer) const override
 Test to see if this object is on the given layer. More...
 
bool FlashLayer (int aLayer) const
 Check to see whether the pad should be flashed on the specific layer. More...
 
bool FlashLayer (LSET aLayers) const
 Check to see if the pad should be flashed to any of the layers in the set. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Test if aPosition is inside or on the boundary of this item. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Test if aRect intersects this item. More...
 
wxString GetClass () const override
 Return the class name. More...
 
const EDA_RECT GetBoundingBox () const override
 The bounding box is cached, so this will be efficient most of the time. More...
 
void SetDrawCoord ()
 
void SetLocalCoord ()
 < Set relative coordinates. More...
 
void Move (const wxPoint &aMoveVector) override
 Move this object. More...
 
void Rotate (const wxPoint &aRotCentre, double aAngle) override
 Rotate this object. More...
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
wxString ShowPadShape () const
 
wxString ShowPadAttr () const
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
PADClonePad () const
 Same as Clone, but returns a PAD item. More...
 
void BuildEffectiveShapes (PCB_LAYER_ID aLayer) const
 Rebuild the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit. More...
 
void BuildEffectivePolygon () const
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
double ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Return the level of detail (LOD) of the item. More...
 
virtual const BOX2I ViewBBox () const override
 Return 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
 Returns information if the object is derived from BOARD_CONNECTED_ITEM. More...
 
NETINFO_ITEMGetNet () const
 Return #NET_INFO object for a given item. More...
 
void SetNet (NETINFO_ITEM *aNetInfo)
 Set a NET_INFO object for the item. More...
 
int GetNetCode () const
 
bool SetNetCode (int aNetCode, bool aNoAssert)
 Set net using a net code. More...
 
void SetNetCode (int aNetCode)
 
wxString GetNetname () const
 
wxString GetNetnameMsg () const
 
wxString GetShortNetname () const
 
virtual int GetOwnClearance (PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
 Return an item's "own" clearance in internal units. More...
 
virtual NETCLASSGetNetClass () const
 Return the NETCLASS for this item. More...
 
virtual NETCLASSGetEffectiveNetclass () const
 Return the NETCLASS for this item, or the default netclass if none is defined. More...
 
virtual wxString GetNetClassName () const
 Returns the netclass of the zone. More...
 
void SetLocalRatsnestVisible (bool aVisible)
 
bool GetLocalRatsnestVisible () const
 
void SetParentGroup (PCB_GROUP *aGroup)
 
PCB_GROUPGetParentGroup () const
 
int GetX () const
 
int GetY () const
 
BOARD_ITEM_CONTAINERGetParentFootprint () const
 
virtual PCB_LAYER_ID GetLayer () const
 Return the primary layer this item is on. More...
 
virtual void SetLayer (PCB_LAYER_ID aLayer)
 Set the layer this item is on. More...
 
virtual BOARD_ITEMDuplicate () const
 Create a copy of this BOARD_ITEM. More...
 
bool IsTrack () const
 Test to see if this object is a track or via (or microvia). More...
 
virtual void SetLocked (bool aLocked)
 Modify the 'lock' status for of the item. More...
 
void DeleteStructure ()
 Delete 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 const BOARDGetBoard () const
 Return the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
virtual BOARDGetBoard ()
 
wxString GetLayerName () const
 Return the name of the PCB layer on which the item resides. More...
 
KICAD_T Type () const
 Returns the type of object. 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 IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
void SetForceVisible (bool aEnable)
 Set and clear 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
 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[])
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const wxFindReplaceData &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. 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
 Draw 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 PTHMask ()
 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 PAD *aPadRef, const PAD *aPadCmp)
 Compare two pads and return 0 if they are equal. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const wxFindReplaceData &aSearchData, wxString &aText)
 Perform 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)
 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
 Return a string (to be shown to the user) describing a layer mask. More...
 
bool Matches (const wxString &aText, const wxFindReplaceData &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 

Protected Attributes

NETINFO_ITEMm_netinfo
 Store all information about the net that item belongs to. More...
 
PCB_LAYER_ID m_layer
 
PCB_GROUPm_group
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 

Private Member Functions

void addPadPrimitivesToPolygon (SHAPE_POLY_SET *aMergedPolygon, int aError, ERROR_LOC aErrorLoc) const
 

Private Attributes

wxString m_number
 
wxString m_pinFunction
 
wxString m_pinType
 
wxPoint m_pos
 
PAD_SHAPE m_padShape
 
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
 
bool m_shapesDirty
 
std::mutex m_shapesBuildingLock
 
EDA_RECT m_effectiveBoundingBox
 
std::shared_ptr< SHAPE_COMPOUNDm_effectiveShape
 
std::shared_ptr< SHAPE_SEGMENTm_effectiveHoleShape
 
bool m_polyDirty
 
std::mutex m_polyBuildingLock
 
std::shared_ptr< SHAPE_POLY_SETm_effectivePolygon
 
int m_effectiveBoundingRadius
 
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 m_anchorPadShape
 
wxPoint m_offset
 
LSET m_layerMask
 
wxSize m_deltaSize
 
wxPoint m_pos0
 
PAD_ATTRIB m_attribute
 
PAD_PROP m_property
 
double m_orient
 
int m_lengthPadToDie
 
bool m_removeUnconnectedLayer
 < If true, the pad copper is removed for layers that are not connected. More...
 
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 57 of file pad.h.

Constructor & Destructor Documentation

◆ PAD() [1/2]

PAD::PAD ( FOOTPRINT parent)

Definition at line 60 of file pad.cpp.

60  :
62 {
63  m_size.x = m_size.y = Mils2iu( 60 ); // Default pad size 60 mils.
64  m_drill.x = m_drill.y = Mils2iu( 30 ); // Default drill size 30 mils.
65  m_orient = 0; // Pad rotation in 1/10 degrees.
66  m_lengthPadToDie = 0;
67 
68  if( m_parent && m_parent->Type() == PCB_FOOTPRINT_T )
70 
71  SetShape( PAD_SHAPE::CIRCLE ); // Default pad shape is PAD_CIRCLE.
72  SetAnchorPadShape( PAD_SHAPE::CIRCLE ); // Default shape for custom shaped pads
73  // is PAD_CIRCLE.
74  SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); // Default pad drill shape is a circle.
75  m_attribute = PAD_ATTRIB::PTH; // Default pad type is plated through hole
76  SetProperty( PAD_PROP::NONE ); // no special fabrication property
77  m_localClearance = 0;
81 
82  // Parameters for round rect only:
83  m_roundedCornerScale = 0.25; // from IPC-7351C standard
84 
85  // Parameters for chamfered rect only:
86  m_chamferScale = 0.2; // Size of chamfer: ratio of smallest of X,Y size
87  m_chamferPositions = RECT_NO_CHAMFER; // No chamfered corner
88 
89  m_zoneConnection = ZONE_CONNECTION::INHERITED; // Use parent setting by default
90  m_thermalWidth = 0; // Use parent setting by default
91  m_thermalGap = 0; // Use parent setting by default
92 
94 
95  // Set layers mask to default for a standard thru hole pad.
96  m_layerMask = PTHMask();
97 
98  SetSubRatsnest( 0 ); // used in ratsnest calculations
99 
100  SetDirty();
102  m_removeUnconnectedLayer = false;
103  m_keepTopBottomLayer = true;
104 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:478
int m_chamferPositions
Definition: pad.h:724
int m_effectiveBoundingRadius
Definition: pad.h:703
wxSize m_drill
Definition: pad.h:715
double m_roundedCornerScale
Definition: pad.h:720
LSET m_layerMask
Definition: pad.h:738
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
void SetSubRatsnest(int aSubRatsnest)
Definition: pad.h:549
class PAD, a pad in a footprint
Definition: typeinfo.h:89
wxPoint m_pos
Definition: pad.h:682
double m_localSolderPasteMarginRatio
Definition: pad.h:775
int m_localSolderPasteMargin
Definition: pad.h:774
Plated through hole pad.
int m_localSolderMaskMargin
Definition: pad.h:773
void SetProperty(PAD_PROP aProperty)
Definition: pad.cpp:622
bool m_keepTopBottomLayer
Definition: pad.h:760
int m_localClearance
Definition: pad.h:772
double m_chamferScale
Definition: pad.h:722
int m_thermalGap
Definition: pad.h:780
int m_thermalWidth
Definition: pad.h:779
static LSET PTHMask()
layer set for a through hole pad
Definition: pad.cpp:159
double m_orient
Definition: pad.h:752
ZONE_CONNECTION m_zoneConnection
Definition: pad.h:778
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
Definition: pad.h:353
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
wxSize m_size
Definition: pad.h:716
FOOTPRINT * GetParent() const
Definition: pad.cpp:1439
bool m_removeUnconnectedLayer
< If true, the pad copper is removed for layers that are not connected.
Definition: pad.h:757
no special fabrication property
void SetDirty()
Definition: pad.h:361
wxPoint GetPosition() const override
Definition: footprint.h:187
void SetShape(PAD_SHAPE aShape)
Set the new shape of this pad.
Definition: pad.h:161
int m_lengthPadToDie
Definition: pad.h:754
PAD_ATTRIB m_attribute
Definition: pad.h:748
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: pad.h:710
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
void SetAnchorPadShape(PAD_SHAPE aShape)
Set the shape of the anchor pad for custom shaped pads.
Definition: pad.h:209

References CIRCLE, CUST_PAD_SHAPE_IN_ZONE_OUTLINE, GetParent(), FOOTPRINT::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_size, m_thermalGap, m_thermalWidth, m_zoneConnection, NONE, PAD_DRILL_SHAPE_CIRCLE, PCB_FOOTPRINT_T, PTH, PTHMask(), RECT_NO_CHAMFER, SetAnchorPadShape(), SetDirty(), SetDrillShape(), SetProperty(), SetShape(), SetSubRatsnest(), and EDA_ITEM::Type().

Referenced by Clone().

◆ PAD() [2/2]

PAD::PAD ( const PAD aPad)

Definition at line 107 of file pad.cpp.

107  :
108  BOARD_CONNECTED_ITEM( aOther.GetParent(), PCB_PAD_T )
109 {
110  PAD::operator=( aOther );
111 
112  const_cast<KIID&>( m_Uuid ) = aOther.m_Uuid;
113 }
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
class PAD, a pad in a footprint
Definition: typeinfo.h:89
PAD & operator=(const PAD &aOther)
Definition: pad.cpp:116
const KIID m_Uuid
Definition: eda_item.h:474

References EDA_ITEM::m_Uuid, and operator=().

Member Function Documentation

◆ addPadPrimitivesToPolygon()

void PAD::addPadPrimitivesToPolygon ( SHAPE_POLY_SET aMergedPolygon,
int  aError,
ERROR_LOC  aErrorLoc 
) const
private

Definition at line 191 of file pad_custom_shape_functions.cpp.

193 {
194  SHAPE_POLY_SET polyset;
195 
196  for( const std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
197  {
198  primitive->TransformShapeWithClearanceToPolygon( polyset, UNDEFINED_LAYER, 0, aError,
199  aErrorLoc );
200  }
201 
203 
204  // Merge all polygons with the initial pad anchor shape
205  if( polyset.OutlineCount() )
206  {
207  aMergedPolygon->BooleanAdd( polyset, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
208  aMergedPolygon->Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
209  }
210 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
Represent a set of closed polygons.
void Simplify(POLYGON_MODE aFastMode)
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691

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, SHAPE_POLY_SET::Simplify(), and UNDEFINED_LAYER.

Referenced by GetBestAnchorPosition(), and MergePrimitivesAsPolygon().

◆ AddPrimitive()

void PAD::AddPrimitive ( PCB_SHAPE aPrimitive)

Add item to the custom shape primitives list.

Definition at line 173 of file pad_custom_shape_functions.cpp.

174 {
175  aPrimitive->SetParent( this );
176  m_editPrimitives.emplace_back( aPrimitive );
177 
178  SetDirty();
179 }
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691
void SetDirty()
Definition: pad.h:361

References m_editPrimitives, SetDirty(), and EDA_ITEM::SetParent().

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

◆ AddPrimitiveArc()

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

Definition at line 92 of file pad_custom_shape_functions.cpp.

94 {
95  PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::ARC );
96  item->SetFilled( false );
97  item->SetCenter( aCenter );
98  item->SetStart( aStart );
99  item->SetArcAngleAndEnd( aArcAngle );
100  item->SetWidth( aThickness );
101  item->SetParent( this );
102  m_editPrimitives.emplace_back( item );
103  SetDirty();
104 }
void SetFilled(bool aFlag)
Definition: eda_shape.h:92
void SetArcAngleAndEnd(double aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
Definition: eda_shape.cpp:547
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
void SetStart(const wxPoint &aStart)
Definition: eda_shape.h:110
void SetWidth(int aWidth)
Definition: eda_shape.h:97
void SetCenter(const wxPoint &aCenter)
Definition: eda_shape.cpp:419
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691
void SetDirty()
Definition: pad.h:361

References ARC, m_editPrimitives, EDA_SHAPE::SetArcAngleAndEnd(), EDA_SHAPE::SetCenter(), SetDirty(), EDA_SHAPE::SetFilled(), EDA_ITEM::SetParent(), EDA_SHAPE::SetStart(), and EDA_SHAPE::SetWidth().

◆ AddPrimitiveCircle()

void PAD::AddPrimitiveCircle ( const wxPoint &  aCenter,
int  aRadius,
int  aThickness,
bool  aFilled 
)

Definition at line 123 of file pad_custom_shape_functions.cpp.

124 {
125  PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::CIRCLE );
126  item->SetFilled( aFilled );
127  item->SetStart( aCenter );
128  item->SetEnd( wxPoint( aCenter.x + aRadius, aCenter.y ) );
129  item->SetWidth( aThickness );
130  item->SetParent( this );
131  m_editPrimitives.emplace_back( item );
132  SetDirty();
133 }
void SetFilled(bool aFlag)
Definition: eda_shape.h:92
void SetEnd(const wxPoint &aEnd)
Definition: eda_shape.h:135
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
void SetStart(const wxPoint &aStart)
Definition: eda_shape.h:110
void SetWidth(int aWidth)
Definition: eda_shape.h:97
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691
void SetDirty()
Definition: pad.h:361

References CIRCLE, m_editPrimitives, SetDirty(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetFilled(), EDA_ITEM::SetParent(), EDA_SHAPE::SetStart(), and EDA_SHAPE::SetWidth().

◆ AddPrimitiveCurve()

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

Definition at line 107 of file pad_custom_shape_functions.cpp.

109 {
110  PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::BEZIER );
111  item->SetFilled( false );
112  item->SetStart( aStart );
113  item->SetEnd( aEnd );
114  item->SetBezierC1( aCtrl1 );
115  item->SetBezierC2( aCtrl2 );
116  item->SetWidth( aThickness );
117  item->SetParent( this );
118  m_editPrimitives.emplace_back( item );
119  SetDirty();
120 }
void SetFilled(bool aFlag)
Definition: eda_shape.h:92
void SetEnd(const wxPoint &aEnd)
Definition: eda_shape.h:135
void SetBezierC1(const wxPoint &aPt)
Definition: eda_shape.h:153
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
void SetStart(const wxPoint &aStart)
Definition: eda_shape.h:110
void SetWidth(int aWidth)
Definition: eda_shape.h:97
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691
void SetDirty()
Definition: pad.h:361
void SetBezierC2(const wxPoint &aPt)
Definition: eda_shape.h:156

References BEZIER, m_editPrimitives, EDA_SHAPE::SetBezierC1(), EDA_SHAPE::SetBezierC2(), SetDirty(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetFilled(), EDA_ITEM::SetParent(), EDA_SHAPE::SetStart(), and EDA_SHAPE::SetWidth().

◆ AddPrimitivePoly() [1/2]

void PAD::AddPrimitivePoly ( const SHAPE_POLY_SET aPoly,
int  aThickness,
bool  aFilled 
)

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 40 of file pad_custom_shape_functions.cpp.

41 {
42  // If aPoly has holes, convert it to a polygon with no holes.
43  SHAPE_POLY_SET poly_no_hole;
44  poly_no_hole.Append( aPoly );
45 
46  if( poly_no_hole.HasHoles() )
48 
49  // There should never be multiple shapes, but if there are, we split them into
50  // primitives so that we can edit them both.
51  for( int ii = 0; ii < poly_no_hole.OutlineCount(); ++ii )
52  {
53  SHAPE_POLY_SET poly_outline( poly_no_hole.COutline( ii ) );
54  PCB_SHAPE* item = new PCB_SHAPE();
55  item->SetShape( SHAPE_T::POLY );
56  item->SetFilled( aFilled );
57  item->SetPolyShape( poly_outline );
58  item->SetWidth( aThickness );
59  item->SetParent( this );
60  m_editPrimitives.emplace_back( item );
61  }
62 
63  SetDirty();
64 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
bool HasHoles() const
Return true if the polygon set has any holes that share a vertex.
Represent a set of closed polygons.
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
void SetDirty()
Definition: pad.h:361
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::COutline(), SHAPE_POLY_SET::Fracture(), SHAPE_POLY_SET::HasHoles(), m_editPrimitives, SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, POLY, and SetDirty().

Referenced by FABMASTER::loadFootprints().

◆ AddPrimitivePoly() [2/2]

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

Definition at line 67 of file pad_custom_shape_functions.cpp.

68 {
69  PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::POLY );
70  item->SetFilled( aFilled );
71  item->SetPolyPoints( aPoly );
72  item->SetWidth( aThickness );
73  item->SetParent( this );
74  m_editPrimitives.emplace_back( item );
75  SetDirty();
76 }
void SetFilled(bool aFlag)
Definition: eda_shape.h:92
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
void SetWidth(int aWidth)
Definition: eda_shape.h:97
void SetPolyPoints(const std::vector< wxPoint > &aPoints)
Definition: eda_shape.cpp:1085
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691
void SetDirty()
Definition: pad.h:361

References m_editPrimitives, POLY, SetDirty(), EDA_SHAPE::SetFilled(), EDA_ITEM::SetParent(), EDA_SHAPE::SetPolyPoints(), and EDA_SHAPE::SetWidth().

◆ AddPrimitiveRect()

void PAD::AddPrimitiveRect ( const wxPoint &  aStart,
const wxPoint &  aEnd,
int  aThickness,
bool  aFilled 
)

Definition at line 136 of file pad_custom_shape_functions.cpp.

138 {
139  PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T:: RECT );
140  item->SetFilled( aFilled );
141  item->SetStart( aStart );
142  item->SetEnd( aEnd );
143  item->SetWidth( aThickness );
144  item->SetParent( this );
145  m_editPrimitives.emplace_back( item );
146  SetDirty();
147 }
void SetFilled(bool aFlag)
Definition: eda_shape.h:92
void SetEnd(const wxPoint &aEnd)
Definition: eda_shape.h:135
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
void SetStart(const wxPoint &aStart)
Definition: eda_shape.h:110
void SetWidth(int aWidth)
Definition: eda_shape.h:97
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691
void SetDirty()
Definition: pad.h:361

References m_editPrimitives, RECT, SetDirty(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetFilled(), EDA_ITEM::SetParent(), EDA_SHAPE::SetStart(), and EDA_SHAPE::SetWidth().

◆ AddPrimitiveSegment()

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

Definition at line 79 of file pad_custom_shape_functions.cpp.

80 {
81  PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::SEGMENT );
82  item->SetFilled( false );
83  item->SetStart( aStart );
84  item->SetEnd( aEnd );
85  item->SetWidth( aThickness );
86  item->SetParent( this );
87  m_editPrimitives.emplace_back( item );
88  SetDirty();
89 }
void SetFilled(bool aFlag)
Definition: eda_shape.h:92
void SetEnd(const wxPoint &aEnd)
Definition: eda_shape.h:135
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
void SetStart(const wxPoint &aStart)
Definition: eda_shape.h:110
void SetWidth(int aWidth)
Definition: eda_shape.h:97
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691
void SetDirty()
Definition: pad.h:361

References m_editPrimitives, SEGMENT, SetDirty(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetFilled(), EDA_ITEM::SetParent(), EDA_SHAPE::SetStart(), and EDA_SHAPE::SetWidth().

◆ ApertureMask()

LSET PAD::ApertureMask ( )
static

layer set for an aperture pad

Definition at line 187 of file pad.cpp.

188 {
189  static LSET saved( 1, F_Paste );
190  return saved;
191 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516

References F_Paste.

Referenced by PAD_FIXTURE::MakeAperture(), and DIALOG_PAD_PROPERTIES::updatePadLayersList().

◆ AppendPrimitives()

void PAD::AppendPrimitives ( const std::vector< std::shared_ptr< PCB_SHAPE >> &  aPrimitivesList)

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

Copies the input, which is not altered.

Definition at line 163 of file pad_custom_shape_functions.cpp.

164 {
165  // Add duplicates of aPrimitivesList to the pad primitives list:
166  for( const std::shared_ptr<PCB_SHAPE>& prim : aPrimitivesList )
167  AddPrimitive( new PCB_SHAPE( *prim ) );
168 
169  SetDirty();
170 }
void SetDirty()
Definition: pad.h:361
void AddPrimitive(PCB_SHAPE *aPrimitive)
Add item to the custom shape primitives list.

References AddPrimitive(), and SetDirty().

Referenced by ReplacePrimitives().

◆ BuildEffectivePolygon()

void PAD::BuildEffectivePolygon ( ) const

Definition at line 530 of file pad.cpp.

531 {
532  std::lock_guard<std::mutex> RAII_lock( m_polyBuildingLock );
533 
534  // If we had to wait for the lock then we were probably waiting for someone else to
535  // finish rebuilding the shapes. So check to see if they're clean now.
536  if( !m_polyDirty )
537  return;
538 
539  const BOARD* board = GetBoard();
540  int maxError = board ? board->GetDesignSettings().m_MaxError : ARC_HIGH_DEF;
541 
542  // Polygon
543  m_effectivePolygon = std::make_shared<SHAPE_POLY_SET>();
545  ERROR_INSIDE );
546 
547  // Bounding radius
548  //
549  // PADSTACKS TODO: these will both need to cycle through all layers to get the largest
550  // values....
552 
553  for( int cnt = 0; cnt < m_effectivePolygon->OutlineCount(); ++cnt )
554  {
555  const SHAPE_LINE_CHAIN& poly = m_effectivePolygon->COutline( cnt );
556 
557  for( int ii = 0; ii < poly.PointCount(); ++ii )
558  {
559  int dist = KiROUND( ( poly.CPoint( ii ) - m_pos ).EuclideanNorm() );
561  }
562  }
563 
564  // All done
565  m_polyDirty = false;
566 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:146
std::mutex m_polyBuildingLock
Definition: pad.h:701
int m_effectiveBoundingRadius
Definition: pad.h:703
wxPoint m_pos
Definition: pad.h:682
int PointCount() const
Return the number of points (vertices) in this line chain.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
std::shared_ptr< SHAPE_POLY_SET > m_effectivePolygon
Definition: pad.h:702
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aMaxError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
Definition: pad.cpp:1554
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
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:73
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
bool m_polyDirty
Definition: pad.h:700

References SHAPE_LINE_CHAIN::CPoint(), ERROR_INSIDE, EuclideanNorm(), BOARD_ITEM::GetBoard(), BOARD::GetDesignSettings(), KiROUND(), m_effectiveBoundingRadius, m_effectivePolygon, BOARD_DESIGN_SETTINGS::m_MaxError, m_polyBuildingLock, m_polyDirty, m_pos, SHAPE_LINE_CHAIN::PointCount(), TransformShapeWithClearanceToPolygon(), and UNDEFINED_LAYER.

Referenced by GetBoundingRadius(), and GetEffectivePolygon().

◆ BuildEffectiveShapes()

void PAD::BuildEffectiveShapes ( PCB_LAYER_ID  aLayer) const

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

Definition at line 354 of file pad.cpp.

355 {
356  std::lock_guard<std::mutex> RAII_lock( m_shapesBuildingLock );
357 
358  // If we had to wait for the lock then we were probably waiting for someone else to
359  // finish rebuilding the shapes. So check to see if they're clean now.
360  if( !m_shapesDirty )
361  return;
362 
363  const BOARD* board = GetBoard();
364  int maxError = board ? board->GetDesignSettings().m_MaxError : ARC_HIGH_DEF;
365 
366  m_effectiveShape = std::make_shared<SHAPE_COMPOUND>();
367  m_effectiveHoleShape = nullptr;
368 
369  auto add = [this]( SHAPE* aShape )
370  {
371  m_effectiveShape->AddShape( aShape );
372  };
373 
374  wxPoint shapePos = ShapePos(); // Fetch only once; rotation involves trig
375  PAD_SHAPE effectiveShape = GetShape();
376 
377  if( GetShape() == PAD_SHAPE::CUSTOM )
378  effectiveShape = GetAnchorPadShape();
379 
380  switch( effectiveShape )
381  {
382  case PAD_SHAPE::CIRCLE:
383  add( new SHAPE_CIRCLE( shapePos, m_size.x / 2 ) );
384  break;
385 
386  case PAD_SHAPE::OVAL:
387  if( m_size.x == m_size.y ) // the oval pad is in fact a circle
388  {
389  add( new SHAPE_CIRCLE( shapePos, m_size.x / 2 ) );
390  }
391  else
392  {
393  wxSize half_size = m_size / 2;
394  int half_width = std::min( half_size.x, half_size.y );
395  wxPoint half_len( half_size.x - half_width, half_size.y - half_width );
396  RotatePoint( &half_len, m_orient );
397  add( new SHAPE_SEGMENT( shapePos - half_len, shapePos + half_len, half_width * 2 ) );
398  }
399 
400  break;
401 
402  case PAD_SHAPE::RECT:
405  {
406  int r = ( effectiveShape == PAD_SHAPE::ROUNDRECT ) ? GetRoundRectCornerRadius() : 0;
407  wxPoint half_size( m_size.x / 2, m_size.y / 2 );
408  wxSize trap_delta( 0, 0 );
409 
410  if( r )
411  {
412  half_size -= wxPoint( r, r );
413 
414  // Avoid degenerated shapes (0 length segments) that always create issues
415  // For roundrect pad very near a circle, use only a circle
416  const int min_len = Millimeter2iu( 0.0001);
417 
418  if( half_size.x < min_len && half_size.y < min_len )
419  {
420  add( new SHAPE_CIRCLE( shapePos, r ) );
421  break;
422  }
423  }
424  else if( effectiveShape == PAD_SHAPE::TRAPEZOID )
425  {
426  trap_delta = m_deltaSize / 2;
427  }
428 
429  SHAPE_LINE_CHAIN corners;
430 
431  corners.Append( -half_size.x - trap_delta.y, half_size.y + trap_delta.x );
432  corners.Append( half_size.x + trap_delta.y, half_size.y - trap_delta.x );
433  corners.Append( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
434  corners.Append( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
435 
436  corners.Rotate( -DECIDEG2RAD( m_orient ) );
437  corners.Move( shapePos );
438 
439  // GAL renders rectangles faster than 4-point polygons so it's worth checking if our
440  // body shape is a rectangle.
441  if( corners.PointCount() == 4
442  &&
443  ( ( corners.CPoint( 0 ).y == corners.CPoint( 1 ).y
444  && corners.CPoint( 1 ).x == corners.CPoint( 2 ).x
445  && corners.CPoint( 2 ).y == corners.CPoint( 3 ).y
446  && corners.CPoint( 3 ).x == corners.CPoint( 0 ).x )
447  ||
448  ( corners.CPoint( 0 ).x == corners.CPoint( 1 ).x
449  && corners.CPoint( 1 ).y == corners.CPoint( 2 ).y
450  && corners.CPoint( 2 ).x == corners.CPoint( 3 ).x
451  && corners.CPoint( 3 ).y == corners.CPoint( 0 ).y )
452  )
453  )
454  {
455  int width = std::abs( corners.CPoint( 2 ).x - corners.CPoint( 0 ).x );
456  int height = std::abs( corners.CPoint( 2 ).y - corners.CPoint( 0 ).y );
457  VECTOR2I pos( std::min( corners.CPoint( 2 ).x, corners.CPoint( 0 ).x ),
458  std::min( corners.CPoint( 2 ).y, corners.CPoint( 0 ).y ) );
459 
460  add( new SHAPE_RECT( pos, width, height ) );
461  }
462  else
463  {
464  add( new SHAPE_SIMPLE( corners ) );
465  }
466 
467  if( r )
468  {
469  add( new SHAPE_SEGMENT( corners.CPoint( 0 ), corners.CPoint( 1 ), r * 2 ) );
470  add( new SHAPE_SEGMENT( corners.CPoint( 1 ), corners.CPoint( 2 ), r * 2 ) );
471  add( new SHAPE_SEGMENT( corners.CPoint( 2 ), corners.CPoint( 3 ), r * 2 ) );
472  add( new SHAPE_SEGMENT( corners.CPoint( 3 ), corners.CPoint( 0 ), r * 2 ) );
473  }
474  }
475  break;
476 
478  {
479  SHAPE_POLY_SET outline;
480 
483  GetChamferPositions(), 0, maxError, ERROR_INSIDE );
484 
485  add( new SHAPE_SIMPLE( outline.COutline( 0 ) ) );
486  }
487  break;
488 
489  default:
490  wxFAIL_MSG( wxT( "PAD::buildEffectiveShapes: Unsupported pad shape: " )
491  + PAD_SHAPE_T_asString( effectiveShape ) );
492  break;
493  }
494 
495  if( GetShape() == PAD_SHAPE::CUSTOM )
496  {
497  for( const std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
498  {
499  for( SHAPE* shape : primitive->MakeEffectiveShapes() )
500  {
501  shape->Rotate( -DECIDEG2RAD( m_orient ) );
502  shape->Move( shapePos );
503  add( shape );
504  }
505  }
506  }
507 
508  BOX2I bbox = m_effectiveShape->BBox();
509  m_effectiveBoundingBox = EDA_RECT( (wxPoint) bbox.GetPosition(),
510  wxSize( bbox.GetWidth(), bbox.GetHeight() ) );
511 
512  // Hole shape
513  wxSize half_size = m_drill / 2;
514  int half_width = std::min( half_size.x, half_size.y );
515  wxPoint half_len( half_size.x - half_width, half_size.y - half_width );
516 
517  RotatePoint( &half_len, m_orient );
518 
519  m_effectiveHoleShape = std::make_shared<SHAPE_SEGMENT>( m_pos - half_len, m_pos + half_len,
520  half_width * 2 );
521  bbox = m_effectiveHoleShape->BBox();
523  wxSize( bbox.GetWidth(), bbox.GetHeight() ) ) );
524 
525  // All done
526  m_shapesDirty = false;
527 }
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
Definition: shape_simple.h:41
bool m_shapesDirty
Definition: pad.h:694
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:432
std::mutex m_shapesBuildingLock
Definition: pad.h:695
wxSize m_deltaSize
Definition: pad.h:741
wxSize m_drill
Definition: pad.h:715
void Move(const VECTOR2I &aVector) override
wxPoint m_pos
Definition: pad.h:682
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
int PointCount() const
Return the number of points (vertices) in this line chain.
std::shared_ptr< SHAPE_COMPOUND > m_effectiveShape
Definition: pad.h:697
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
EDA_RECT m_effectiveBoundingBox
Definition: pad.h:696
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aInflate, int aError, ERROR_LOC aErrorLoc)
Convert a rectangle with rounded corners and/or chamfered corners to a polygon.
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: pad.h:698
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape() DO NOT REORDER, legacy_plugin is dependent on ...
Definition: pad_shapes.h:33
wxPoint ShapePos() const
Definition: pad.cpp:706
Represent a set of closed polygons.
coord_type GetWidth() const
Definition: box2.h:180
const wxSize & GetSize() const
Definition: pad.h:233
double m_orient
Definition: pad.h:752
PAD_SHAPE GetShape() const
Definition: pad.h:170
An abstract shape on 2D plane.
Definition: shape.h:116
E_SERIE r
Definition: eserie.cpp:41
const Vec & GetPosition() const
Definition: box2.h:177
int GetRoundRectCornerRadius() const
Definition: pad.cpp:269
wxSize m_size
Definition: pad.h:716
void Rotate(double aAngle, const VECTOR2I &aCenter=VECTOR2I(0, 0)) override
Rotate all vertices by a given angle.
double GetChamferRectRatio() const
Definition: pad.h:533
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
Handle the component boundary box.
Definition: eda_rect.h:42
double DECIDEG2RAD(double deg)
Definition: trigo.h:233
static std::string PAD_SHAPE_T_asString(PAD_SHAPE a)
Definition: pad_shapes.h:47
coord_type GetHeight() const
Definition: box2.h:181
int GetChamferPositions() const
Definition: pad.h:543
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
static constexpr int Millimeter2iu(double mm)
PAD_SHAPE GetAnchorPadShape() const
Definition: pad.h:183

References SHAPE_LINE_CHAIN::Append(), CHAMFERED_RECT, CIRCLE, SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), CUSTOM, DECIDEG2RAD(), ERROR_INSIDE, GetAnchorPadShape(), BOARD_ITEM::GetBoard(), GetChamferPositions(), GetChamferRectRatio(), BOARD::GetDesignSettings(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetPosition(), GetRoundRectCornerRadius(), GetShape(), GetSize(), BOX2< Vec >::GetWidth(), m_deltaSize, m_drill, m_editPrimitives, m_effectiveBoundingBox, m_effectiveHoleShape, m_effectiveShape, BOARD_DESIGN_SETTINGS::m_MaxError, m_orient, m_pos, m_shapesBuildingLock, m_shapesDirty, m_size, EDA_RECT::Merge(), Millimeter2iu(), SHAPE_LINE_CHAIN::Move(), OVAL, PAD_SHAPE_T_asString(), SHAPE_LINE_CHAIN::PointCount(), r, RECT, SHAPE_LINE_CHAIN::Rotate(), RotatePoint(), ROUNDRECT, ShapePos(), TransformRoundChamferedRectToPolygon(), TRAPEZOID, VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ CanHaveNumber()

bool PAD::CanHaveNumber ( ) const

Indicates whether or not the pad can have a number.

(NPTH and SMD aperture pads can not.)

Definition at line 136 of file pad.cpp.

137 {
138  // Aperture pads don't get a number
139  if( IsAperturePad() )
140  return false;
141 
142  // NPTH pads don't get numbers
143  if( GetAttribute() == PAD_ATTRIB::NPTH )
144  return false;
145 
146  return true;
147 }
bool IsAperturePad() const
Definition: pad.h:378
like PAD_PTH, but not plated
PAD_ATTRIB GetAttribute() const
Definition: pad.h:371

References GetAttribute(), IsAperturePad(), and NPTH.

◆ ClassOf()

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

Definition at line 79 of file pad.h.

80  {
81  return aItem && PCB_PAD_T == aItem->Type();
82  }
class PAD, a pad in a footprint
Definition: typeinfo.h:89
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References PCB_PAD_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 153 of file eda_item.h.

153 { m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), FOOTPRINT::BuildPolyCourtyards(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SYMBOL_EDITOR_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), EE_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::narrowSelection(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 165 of file eda_item.h.

166  {
168  DO_NOT_DRAW );
169  }
#define DO_NOT_DRAW
Used to disable draw function.
#define STARTPOINT
When a line is selected, these flags indicate which.
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define CANDIDATE
flag indicating that the structure is connected
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:153
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define TEMP_SELECTED
flag indicating that the structure has already selected

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 143 of file view_item.h.

144  {
145  m_viewPrivData = nullptr;
146  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:151

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * PAD::Clone ( ) const
overridevirtual

Create 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 1240 of file pad.cpp.

1241 {
1242  return new PAD( *this );
1243 }
PAD(FOOTPRINT *parent)
Definition: pad.cpp:60

References PAD().

Referenced by ClonePad(), and GetEffectiveShape().

◆ ClonePad()

PAD* PAD::ClonePad ( ) const
inline

Same as Clone, but returns a PAD item.

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

Definition at line 648 of file pad.h.

649  {
650  return (PAD*) Clone();
651  }
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pad.cpp:1240
Definition: pad.h:57

References Clone().

◆ Compare()

int PAD::Compare ( const PAD aPadRef,
const PAD aPadCmp 
)
static

Compare two pads and return 0 if they are equal.

Returns
less than 0 if left less than right, 0 if equal, or greater than 0 if left greater than right.

Definition at line 1066 of file pad.cpp.

1067 {
1068  int diff;
1069 
1070  if( ( diff = static_cast<int>( aPadRef->GetShape() ) -
1071  static_cast<int>( aPadCmp->GetShape() ) ) != 0 )
1072  return diff;
1073 
1074  if( ( diff = static_cast<int>( aPadRef->m_attribute ) -
1075  static_cast<int>( aPadCmp->m_attribute ) ) != 0 )
1076  return diff;
1077 
1078  if( ( diff = aPadRef->m_drillShape - aPadCmp->m_drillShape ) != 0 )
1079  return diff;
1080 
1081  if( ( diff = aPadRef->m_drill.x - aPadCmp->m_drill.x ) != 0 )
1082  return diff;
1083 
1084  if( ( diff = aPadRef->m_drill.y - aPadCmp->m_drill.y ) != 0 )
1085  return diff;
1086 
1087  if( ( diff = aPadRef->m_size.x - aPadCmp->m_size.x ) != 0 )
1088  return diff;
1089 
1090  if( ( diff = aPadRef->m_size.y - aPadCmp->m_size.y ) != 0 )
1091  return diff;
1092 
1093  if( ( diff = aPadRef->m_offset.x - aPadCmp->m_offset.x ) != 0 )
1094  return diff;
1095 
1096  if( ( diff = aPadRef->m_offset.y - aPadCmp->m_offset.y ) != 0 )
1097  return diff;
1098 
1099  if( ( diff = aPadRef->m_deltaSize.x - aPadCmp->m_deltaSize.x ) != 0 )
1100  return diff;
1101 
1102  if( ( diff = aPadRef->m_deltaSize.y - aPadCmp->m_deltaSize.y ) != 0 )
1103  return diff;
1104 
1105  if( ( diff = aPadRef->m_roundedCornerScale - aPadCmp->m_roundedCornerScale ) != 0 )
1106  return diff;
1107 
1108  if( ( diff = aPadRef->m_chamferPositions - aPadCmp->m_chamferPositions ) != 0 )
1109  return diff;
1110 
1111  if( ( diff = aPadRef->m_chamferScale - aPadCmp->m_chamferScale ) != 0 )
1112  return diff;
1113 
1114  if( ( diff = static_cast<int>( aPadRef->m_editPrimitives.size() ) -
1115  static_cast<int>( aPadCmp->m_editPrimitives.size() ) ) != 0 )
1116  return diff;
1117 
1118  // @todo: Compare custom pad primitives for pads that have the same number of primitives
1119  // here. Currently there is no compare function for PCB_SHAPE objects.
1120 
1121  // Dick: specctra_export needs this
1122  // Lorenzo: gencad also needs it to implement padstacks!
1123 
1124 #if __cplusplus >= 201103L
1125  long long d = aPadRef->m_layerMask.to_ullong() - aPadCmp->m_layerMask.to_ullong();
1126 
1127  if( d < 0 )
1128  return -1;
1129  else if( d > 0 )
1130  return 1;
1131 
1132  return 0;
1133 #else
1134  // these strings are not typically constructed, since we don't get here often.
1135  std::string s1 = aPadRef->m_layerMask.to_string();
1136  std::string s2 = aPadCmp->m_layerMask.to_string();
1137  return s1.compare( s2 );
1138 #endif
1139 }
int m_chamferPositions
Definition: pad.h:724
wxSize m_deltaSize
Definition: pad.h:741
wxSize m_drill
Definition: pad.h:715
double m_roundedCornerScale
Definition: pad.h:720
LSET m_layerMask
Definition: pad.h:738
double m_chamferScale
Definition: pad.h:722
PAD_SHAPE GetShape() const
Definition: pad.h:170
wxSize m_size
Definition: pad.h:716
PAD_DRILL_SHAPE_T m_drillShape
Definition: pad.h:718
wxPoint m_offset
Definition: pad.h:736
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691
PAD_ATTRIB m_attribute
Definition: pad.h:748

References GetShape(), m_attribute, m_chamferPositions, m_chamferScale, m_deltaSize, m_drill, m_drillShape, m_editPrimitives, m_layerMask, m_offset, m_roundedCornerScale, and m_size.

Referenced by CreatePadsShapesSection().

◆ ConnSMDMask()

LSET PAD::ConnSMDMask ( )
static

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

Definition at line 173 of file pad.cpp.

174 {
175  static LSET saved( 2, F_Cu, F_Mask );
176  return saved;
177 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
Definition: layer_ids.h:71

References F_Cu, and F_Mask.

Referenced by DIALOG_PAD_PROPERTIES::updatePadLayersList().

◆ DeletePrimitivesList()

void PAD::DeletePrimitivesList ( )

Clear the basic shapes list.

Definition at line 183 of file pad_custom_shape_functions.cpp.

184 {
185  m_editPrimitives.clear();
186 
187  SetDirty();
188 }
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691
void SetDirty()
Definition: pad.h:361

References m_editPrimitives, and SetDirty().

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

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

Delete this object after removing from its parent if it has one.

Definition at line 128 of file board_item.cpp.

129 {
130  BOARD_ITEM_CONTAINER* parent = GetParent();
131 
132  if( parent )
133  parent->Remove( this );
134 
135  delete this;
136 }
virtual void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL)=0
Removes an item from the container.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:136

References BOARD_ITEM::GetParent(), and BOARD_ITEM_CONTAINER::Remove().

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

◆ Duplicate()

BOARD_ITEM * BOARD_ITEM::Duplicate ( ) const
virtualinherited

Create a copy of this BOARD_ITEM.

Reimplemented in FOOTPRINT.

Definition at line 144 of file board_item.cpp.

145 {
146  BOARD_ITEM* dupe = static_cast<BOARD_ITEM*>( Clone() );
147  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
148 
149  if( dupe->GetParentGroup() )
150  dupe->GetParentGroup()->AddItem( dupe );
151 
152  return static_cast<BOARD_ITEM*>( dupe );
153 }
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:60
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:39
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:83
Definition: kiid.h:44
const KIID m_Uuid
Definition: eda_item.h:474

References PCB_GROUP::AddItem(), EDA_ITEM::Clone(), BOARD_ITEM::GetParentGroup(), and EDA_ITEM::m_Uuid.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), BOOST_AUTO_TEST_CASE(), PCB_GROUP::DeepDuplicate(), KIGFX::PCB_PAINTER::draw(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), EDIT_TOOL::Duplicate(), FOOTPRINT::Duplicate(), and ARRAY_CREATOR::Invoke().

◆ FlashLayer() [1/2]

bool PAD::FlashLayer ( int  aLayer) const

Check to see whether the pad should be flashed on the specific layer.

Parameters
aLayerLayer to check for connectivity
Returns
true if connected by pad or track (or optionally zone)

Heat sink pads always get copper

Definition at line 214 of file pad.cpp.

215 {
216  std::vector<KICAD_T> types
218 
219  if( aLayer != UNDEFINED_LAYER && !IsOnLayer( static_cast<PCB_LAYER_ID>( aLayer ) ) )
220  return false;
221 
222  if( aLayer == UNDEFINED_LAYER )
223  return true;
224 
225  if( GetAttribute() == PAD_ATTRIB::NPTH && IsCopperLayer( aLayer ) )
226  {
228  {
229  if( GetOffset() == wxPoint( 0, 0 ) && GetDrillSize().x >= GetSize().x )
230  return false;
231  }
233  {
234  if( GetOffset() == wxPoint( 0, 0 )
235  && GetDrillSize().x >= GetSize().x && GetDrillSize().y >= GetSize().y )
236  {
237  return false;
238  }
239  }
240  }
241 
242  if( LSET::FrontBoardTechMask().test( aLayer ) )
243  aLayer = F_Cu;
244  else if( LSET::BackBoardTechMask().test( aLayer ) )
245  aLayer = B_Cu;
246 
247  if( GetAttribute() == PAD_ATTRIB::PTH && IsCopperLayer( aLayer ) )
248  {
251  return true;
252 
254  return true;
255 
256  // Plated through hole pads need copper on the top/bottom layers for proper soldering
257  // Unless the user has removed them in the pad dialog
258  if( m_keepTopBottomLayer && ( aLayer == F_Cu || aLayer == B_Cu ) )
259  return true;
260 
261  if( const BOARD* board = GetBoard() )
262  return board->GetConnectivity()->IsConnectedOnLayer( this, aLayer, types, true );
263  }
264 
265  return true;
266 }
static LSET FrontBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on front side.
Definition: lset.cpp:822
PAD_PROP GetProperty() const
Definition: pad.h:374
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pad.h:568
class PAD, a pad in a footprint
Definition: typeinfo.h:89
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
Plated through hole pad.
a pad used as heat sink, usually in SMD footprints
bool m_keepTopBottomLayer
Definition: pad.h:760
const wxPoint & GetOffset() const
Definition: pad.h:250
const wxSize & GetDrillSize() const
Definition: pad.h:243
like PAD_PTH, but not plated
const wxSize & GetSize() const
Definition: pad.h:233
PAD_SHAPE GetShape() const
Definition: pad.h:170
class ZONE, a copper pour area
Definition: typeinfo.h:105
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:808
bool m_removeUnconnectedLayer
< If true, the pad copper is removed for layers that are not connected.
Definition: pad.h:757
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:354
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
static LSET BackBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side.
Definition: lset.cpp:809
PAD_ATTRIB GetAttribute() const
Definition: pad.h:371
Definition: layer_ids.h:71
class ZONE, managed by a footprint
Definition: typeinfo.h:94
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96

References B_Cu, LSET::BackBoardTechMask(), CIRCLE, F_Cu, LSET::FrontBoardTechMask(), GetAttribute(), BOARD_ITEM::GetBoard(), GetDrillShape(), GetDrillSize(), GetOffset(), GetProperty(), GetShape(), GetSize(), HEATSINK, IsCopperLayer(), IsOnLayer(), m_keepTopBottomLayer, m_removeUnconnectedLayer, NPTH, OVAL, PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG, PCB_ARC_T, PCB_FP_ZONE_T, PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_T, PTH, and UNDEFINED_LAYER.

Referenced by KIGFX::PCB_PAINTER::draw(), FlashLayer(), GetEffectiveShape(), GetSelectMenuText(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), and ViewGetLOD().

◆ FlashLayer() [2/2]

bool PAD::FlashLayer ( LSET  aLayers) const

Check to see if the pad should be flashed to any of the layers in the set.

Parameters
aLayersset of layers to check the via against
Returns
true if connected by pad or track (or optionally zone) on any of the associated layers

Definition at line 202 of file pad.cpp.

203 {
204  for( PCB_LAYER_ID layer : aLayers.Seq() )
205  {
206  if( FlashLayer( layer ) )
207  return true;
208  }
209 
210  return false;
211 }
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
bool FlashLayer(int aLayer) const
Check to see whether the pad should be flashed on the specific layer.
Definition: pad.cpp:214
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65

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

◆ Flip() [1/2]

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

Definition at line 264 of file board_item.h.

265  {
266  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
267  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.cpp:208

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

◆ Flip() [2/2]

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

Flip this object, i.e.

change the board side for this object.

Parameters
aCentrethe rotation point.
aFlipLeftRightmirror across Y axis instead of X (the default).

Reimplemented from BOARD_ITEM.

Definition at line 639 of file pad.cpp.

640 {
641  if( aFlipLeftRight )
642  {
643  MIRROR( m_pos.x, aCentre.x );
644  MIRROR( m_pos0.x, 0 );
645  MIRROR( m_offset.x, 0 );
646  MIRROR( m_deltaSize.x, 0 );
647  }
648  else
649  {
650  MIRROR( m_pos.y, aCentre.y );
651  MIRROR( m_pos0.y, 0 );
652  MIRROR( m_offset.y, 0 );
653  MIRROR( m_deltaSize.y, 0 );
654  }
655 
657 
658  auto mirrorBitFlags = []( int& aBitfield, int a, int b )
659  {
660  bool temp = aBitfield & a;
661 
662  if( aBitfield & b )
663  aBitfield |= a;
664  else
665  aBitfield &= ~a;
666 
667  if( temp )
668  aBitfield |= b;
669  else
670  aBitfield &= ~b;
671  };
672 
673  if( aFlipLeftRight )
674  {
677  }
678  else
679  {
682  }
683 
684  // flip pads layers
685  // PADS items are currently on all copper layers, or
686  // currently, only on Front or Back layers.
687  // So the copper layers count is not taken in account
689 
690  // Flip the basic shapes, in custom pads
691  FlipPrimitives( aFlipLeftRight );
692 
693  SetDirty();
694 }
void FlipPrimitives(bool aFlipLeftRight)
Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pad...
Definition: pad.cpp:697
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint.
Definition: lset.cpp:576
int m_chamferPositions
Definition: pad.h:724
wxSize m_deltaSize
Definition: pad.h:741
LSET m_layerMask
Definition: pad.h:738
wxPoint m_pos
Definition: pad.h:682
wxPoint m_pos0
Definition: pad.h:745
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40
double GetOrientation() const
Return the rotation angle of the pad in a variety of units (the basic call returns tenths of degrees)...
Definition: pad.h:349
wxPoint m_offset
Definition: pad.h:736
void SetLayerSet(LSET aLayers) override
Definition: pad.h:367
void SetDirty()
Definition: pad.h:361
void SetOrientation(double aAngle)
Set the rotation angle of the pad.
Definition: pad.cpp:630

References FlipLayerMask(), FlipPrimitives(), GetOrientation(), m_chamferPositions, m_deltaSize, m_layerMask, m_offset, m_pos, m_pos0, MIRROR(), RECT_CHAMFER_BOTTOM_LEFT, RECT_CHAMFER_BOTTOM_RIGHT, RECT_CHAMFER_TOP_LEFT, RECT_CHAMFER_TOP_RIGHT, SetDirty(), SetLayerSet(), and SetOrientation().

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

◆ FlipPrimitives()

void 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 697 of file pad.cpp.

698 {
699  for( std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
700  primitive->Flip( wxPoint( 0, 0 ), aFlipLeftRight );
701 
702  SetDirty();
703 }
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691
void SetDirty()
Definition: pad.h:361

References m_editPrimitives, and SetDirty().

Referenced by Flip(), and mirrorPadX().

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

87  {
89  TYPE_ID thisType = TYPE_HASH( *this );
90  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
91  return object ? aProperty->getter( object ) : wxAny();
92  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual wxAny getter(void *aObject) const =0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

Referenced by BOOST_AUTO_TEST_CASE(), 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 95 of file inspectable.h.

96  {
98  TYPE_ID thisType = TYPE_HASH( *this );
99  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
100  return object ? aProperty->get<T>( object ) : T();
101  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return 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 104 of file inspectable.h.

105  {
107  TYPE_ID thisType = TYPE_HASH( *this );
108  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109  boost::optional<T> ret = T();
110 
111  if( prop )
112  {
113  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114 
115  if( object )
116  ret = prop->get<T>( object );
117  }
118 
119  return ret;
120  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return 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 PAD::GetAnchorPadShape ( ) const
inline

◆ GetAttribute()

◆ GetBestAnchorPosition()

bool PAD::GetBestAnchorPosition ( VECTOR2I aPos)

Definition at line 241 of file pad_custom_shape_functions.cpp.

242 {
243  SHAPE_POLY_SET poly;
244  addPadPrimitivesToPolygon( &poly, ARC_LOW_DEF, ERROR_INSIDE );
245 
246  if( poly.OutlineCount() > 1 )
247  return false;
248 
249  const int minSteps = 10;
250  const int maxSteps = 50;
251 
252  int stepsX, stepsY;
253 
254  auto bbox = poly.BBox();
255 
256  if( bbox.GetWidth() < bbox.GetHeight() )
257  {
258  stepsX = minSteps;
259  stepsY = minSteps * (double) bbox.GetHeight() / (double )(bbox.GetWidth() + 1);
260  }
261  else
262  {
263  stepsY = minSteps;
264  stepsX = minSteps * (double) bbox.GetWidth() / (double )(bbox.GetHeight() + 1);
265  }
266 
267  stepsX = std::max(minSteps, std::min( maxSteps, stepsX ) );
268  stepsY = std::max(minSteps, std::min( maxSteps, stepsY ) );
269 
270  VECTOR2I center = bbox.Centre();
271 
272  int64_t minDist = std::numeric_limits<int64_t>::max();
273  int64_t minDistEdge;
274 
276  {
277  minDistEdge = GetSize().x;
278  }
279  else
280  {
281  minDistEdge = std::max( GetSize().x, GetSize().y );
282  }
283 
284  OPT<VECTOR2I> bestAnchor( []()->OPT<VECTOR2I> { return NULLOPT; }() );
285 
286  for( int y = 0; y < stepsY ; y++ )
287  {
288  for( int x = 0; x < stepsX; x++ )
289  {
290  VECTOR2I p = bbox.GetPosition();
291  p.x += rescale( x, bbox.GetWidth(), (stepsX - 1) );
292  p.y += rescale( y, bbox.GetHeight(), (stepsY - 1) );
293 
294  if( poly.Contains(p) )
295  {
296 
297  int dist = (center - p).EuclideanNorm();
298  int distEdge = poly.COutline(0).Distance( p, true );
299 
300  if( distEdge >= minDistEdge )
301  {
302  if( dist < minDist )
303  {
304  bestAnchor = p;
305  minDist = dist;
306  }
307  }
308  }
309  }
310  }
311 
312  if( bestAnchor )
313  {
314  aPos = *bestAnchor;
315  return true;
316  }
317 
318  return false;
319 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:146
int OutlineCount() const
Return the number of vertices in a given outline/hole.
void addPadPrimitivesToPolygon(SHAPE_POLY_SET *aMergedPolygon, int aError, ERROR_LOC aErrorLoc) const
int Distance(const VECTOR2I &aP, bool aOutlineOnly=false) const
Compute the minimum distance between the line chain and a point aP.
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Return true if a given subpolygon contains the point aP.
const auto NULLOPT
Definition: optional.h:9
Represent a set of closed polygons.
const wxSize & GetSize() const
Definition: pad.h:233
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
T rescale(T aNumerator, T aValue, T aDenominator)
Scale a number (value) by rational (numerator/denominator).
Definition: util.h:98
coord_type GetHeight() const
Definition: box2.h:181
boost::optional< T > OPT
Definition: optional.h:7
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
PAD_SHAPE GetAnchorPadShape() const
Definition: pad.h:183

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

◆ GetBoard() [1/2]

const BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

Return the BOARD in which this BOARD_ITEM resides, or NULL if none.

Definition at line 36 of file board_item.cpp.

37 {
38  if( Type() == PCB_T )
39  return static_cast<const BOARD*>( this );
40 
41  BOARD_ITEM* parent = GetParent();
42 
43  if( parent )
44  return parent->GetBoard();
45 
46  return nullptr;
47 }
Definition: typeinfo.h:84
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:136
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

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

Referenced by ZONE_FILLER::addHoleKnockout(), BuildEffectivePolygon(), BuildEffectiveShapes(), ZONE::BuildSmoothedPoly(), calcIsInsideArea(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), PCB_LAYER_VALUE::EqualTo(), existsOnLayer(), exprFromTo(), PCB_VIA::FlashLayer(), FlashLayer(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), PCB_TRACK::Flip(), FP_SHAPE::Flip(), PCB_SHAPE::Flip(), FP_TEXT::Flip(), PCB_DIMENSION_BASE::Flip(), PCB_ARC::Flip(), PCB_VIA::Flip(), ZONE::Flip(), PCB_EXPR_CONTEXT::GetBoard(), BOARD_ITEM::GetBoard(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), GetEffectiveShape(), PCB_VIA::GetEffectiveShape(), ZONE::GetInteractingZones(), BOARD_ITEM::GetLayerName(), PCB_VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), BOARD_CONNECTED_ITEM::GetOwnClearance(), ZONE::GetSelectMenuText(), DRC_ENGINE::GetShape(), FP_TEXT::GetShownText(), GetSolderMaskMargin(), GetSolderPasteMargin(), BOARD::GetTrackLength(), inDiffPair(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), isInsideArea(), isInsideCourtyard(), BOARD_ITEM::IsLocked(), BOARD_ITEM::layerMaskDescribe(), PCB_VIA::layerMaskDescribe(), CONVERT_TOOL::makePolysFromCircles(), MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD::ResolveDRCExclusions(), BOARD_CONNECTED_ITEM::SetNetCode(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), ZONE::TransformSmoothedOutlineToPolygon(), ZONE::TransformSolidAreasShapesToPolygon(), PCB_TRACK::ViewBBox(), FOOTPRINT::ViewBBox(), PCB_VIA::ViewGetLOD(), and ViewGetLOD().

◆ GetBoard() [2/2]

BOARD * BOARD_ITEM::GetBoard ( )
virtualinherited

Definition at line 50 of file board_item.cpp.

51 {
52  if( Type() == PCB_T )
53  return static_cast<BOARD*>( this );
54 
55  BOARD_ITEM* parent = GetParent();
56 
57  if( parent )
58  return parent->GetBoard();
59 
60  return nullptr;
61 }
Definition: typeinfo.h:84
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:136
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

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

◆ GetBoundingBox()

const EDA_RECT PAD::GetBoundingBox ( ) const
overridevirtual

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

Set absolute coordinates.

Reimplemented from EDA_ITEM.

Definition at line 569 of file pad.cpp.

570 {
571  if( m_shapesDirty )
573 
574  return m_effectiveBoundingBox;
575 }
bool m_shapesDirty
Definition: pad.h:694
EDA_RECT m_effectiveBoundingBox
Definition: pad.h:696
void BuildEffectiveShapes(PCB_LAYER_ID aLayer) const
Rebuild the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit.
Definition: pad.cpp:354

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

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

◆ GetBoundingRadius()

int PAD::GetBoundingRadius ( ) const

Return 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 345 of file pad.cpp.

346 {
347  if( m_polyDirty )
349 
351 }
int m_effectiveBoundingRadius
Definition: pad.h:703
void BuildEffectivePolygon() const
Definition: pad.cpp:530
bool m_polyDirty
Definition: pad.h:700

References BuildEffectivePolygon(), m_effectiveBoundingRadius, and m_polyDirty.

Referenced by HitTest().

◆ GetCenter()

wxPoint PAD::GetCenter ( ) const
inlineoverridevirtual

This defaults to the center of the bounding box if not overridden.

Returns
center point of the item

Reimplemented from BOARD_ITEM.

Definition at line 252 of file pad.h.

252 { return GetPosition(); }
wxPoint GetPosition() const override
Definition: pad.h:178

References GetPosition().

◆ GetChamferPositions()

◆ GetChamferRectRatio()

◆ GetClass()

wxString PAD::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 593 of file pad.h.

594  {
595  return wxT( "PAD" );
596  }

◆ GetCustomShapeInZoneOpt()

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

Definition at line 188 of file pad.h.

189  {
191  }
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: pad.h:710

References m_customShapeClearanceArea.

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

◆ GetDelta()

◆ GetDrillShape()

◆ GetDrillSize()

◆ GetDrillSizeX()

const int PAD::GetDrillSizeX ( ) const
inline

Definition at line 245 of file pad.h.

245 { return m_drill.x; }
wxSize m_drill
Definition: pad.h:715

References m_drill.

Referenced by BOARD_INSPECTION_TOOL::InspectClearance(), PAD_DESC::PAD_DESC(), and ViewGetLOD().

◆ GetDrillSizeY()

const int PAD::GetDrillSizeY ( ) const
inline

Definition at line 247 of file pad.h.

247 { return m_drill.y; }
wxSize m_drill
Definition: pad.h:715

References m_drill.

Referenced by BOARD_INSPECTION_TOOL::InspectClearance(), PAD_DESC::PAD_DESC(), and ViewGetLOD().

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 157 of file eda_item.h.

158  {
159  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
161 
162  return m_flags & mask;
163  }
#define IS_NEW
New item, just created.
#define IS_RESIZING
Item being resized.
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_DRAGGING, IS_MOVING, IS_NEW, IS_PASTED, IS_RESIZING, IS_WIRE_IMAGE, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_SYMBOL::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_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_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), and DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveHoleShape()

const SHAPE_SEGMENT * PAD::GetEffectiveHoleShape ( ) const

Return a SHAPE object representing the pad's hole.

Definition at line 336 of file pad.cpp.

337 {
338  if( m_shapesDirty )
340 
341  return m_effectiveHoleShape.get();
342 }
bool m_shapesDirty
Definition: pad.h:694
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: pad.h:698
void BuildEffectiveShapes(PCB_LAYER_ID aLayer) const
Rebuild the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit.
Definition: pad.cpp:354

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

Referenced by BOARD_ADAPTER::createPadWithDrill(), KIGFX::PCB_PAINTER::draw(), GetEffectiveShape(), DRC_ENGINE::GetShape(), DIALOG_PAD_PROPERTIES::padValuesOK(), PNS_KICAD_IFACE_BASE::syncPad(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), and TransformHoleWithClearanceToPolygon().

◆ GetEffectiveNetclass()

NETCLASS * BOARD_CONNECTED_ITEM::GetEffectiveNetclass ( ) const
virtualinherited

Return 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 66 of file board_connected_item.cpp.

67 {
68  // NB: we must check the net first, as when it is 0 GetNetClass() will return the
69  // orphaned net netclass, not the default netclass.
70  if( !m_netinfo || m_netinfo->GetNetCode() == 0 )
72  else
73  return GetNetClass();
74 }
virtual NETCLASS * GetNetClass() const
Return the NETCLASS for this item.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
NETCLASS * GetDefault() const
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
int GetNetCode() const
Definition: netinfo.h:120

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

◆ GetEffectivePolygon()

const std::shared_ptr< SHAPE_POLY_SET > & PAD::GetEffectivePolygon ( ) const

Definition at line 300 of file pad.cpp.

301 {
302  if( m_polyDirty )
304 
305  return m_effectivePolygon;
306 }
std::shared_ptr< SHAPE_POLY_SET > m_effectivePolygon
Definition: pad.h:702
void BuildEffectivePolygon() const
Definition: pad.cpp:530
bool m_polyDirty
Definition: pad.h:700

References BuildEffectivePolygon(), m_effectivePolygon, and m_polyDirty.

Referenced by BOARD_ADAPTER::buildPadOutlineAsPolygon(), BOARD_ADAPTER::buildPadOutlineAsSegments(), HitTest(), and BRDITEMS_PLOTTER::PlotPad().

◆ GetEffectiveShape()

std::shared_ptr< SHAPE > PAD::GetEffectiveShape ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER,
FLASHING  aFlash = FLASHING::DEFAULT 
) const
overridevirtual

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 for use with routing, collision determination, etc).

Note
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 309 of file pad.cpp.

310 {
311  if( ( GetAttribute() == PAD_ATTRIB::PTH && aFlash == FLASHING::NEVER_FLASHED )
312  || ( aLayer != UNDEFINED_LAYER && !FlashLayer( aLayer ) ) )
313  {
314  if( GetAttribute() == PAD_ATTRIB::PTH )
315  {
317 
318  // Note: drill size represents finish size, which means the actual holes size is the
319  // plating thickness larger.
320  auto hole = static_cast<SHAPE_SEGMENT*>( GetEffectiveHoleShape()->Clone() );
321  hole->SetWidth( hole->GetWidth() + bds.GetHolePlatingThickness() );
322  return std::make_shared<SHAPE_SEGMENT>( *hole );
323  }
324 
325  return std::make_shared<SHAPE_NULL>();
326  }
327 
328 
329  if( m_shapesDirty )
330  BuildEffectiveShapes( aLayer );
331 
332  return m_effectiveShape;
333 }
bool m_shapesDirty
Definition: pad.h:694
int GetHolePlatingThickness() const
Pad & via drills are finish size.
const SHAPE_SEGMENT * GetEffectiveHoleShape() const
Return a SHAPE object representing the pad's hole.
Definition: pad.cpp:336
std::shared_ptr< SHAPE_COMPOUND > m_effectiveShape
Definition: pad.h:697
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
Plated through hole pad.
bool FlashLayer(int aLayer) const
Check to see whether the pad should be flashed on the specific layer.
Definition: pad.cpp:214
void BuildEffectiveShapes(PCB_LAYER_ID aLayer) const
Rebuild the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit.
Definition: pad.cpp:354
PAD_ATTRIB GetAttribute() const
Definition: pad.h:371
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pad.cpp:1240
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
Container for design settings for a BOARD object.

References BuildEffectiveShapes(), Clone(), FlashLayer(), GetAttribute(), BOARD_ITEM::GetBoard(), BOARD::GetDesignSettings(), GetEffectiveHoleShape(), BOARD_DESIGN_SETTINGS::GetHolePlatingThickness(), m_effectiveShape, m_shapesDirty, NEVER_FLASHED, PTH, and UNDEFINED_LAYER.

Referenced by BOARD_ADAPTER::createPadWithClearance(), KIGFX::PCB_PAINTER::draw(), and PNS_KICAD_IFACE_BASE::syncPad().

◆ GetEffectiveThermalGap()

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

Return the effective thermal gap having resolved any inheritance.

Definition at line 879 of file pad.cpp.

880 {
881  FOOTPRINT* parentFootprint = GetParent();
882 
883  if( m_thermalGap == 0 && parentFootprint )
884  {
885  if( aSource )
886  *aSource = _( "parent footprint" );
887 
888  return parentFootprint->GetThermalGap();
889  }
890 
891  if( aSource )
892  *aSource = _( "pad" );
893 
894  return m_thermalGap;
895 }
int m_thermalGap
Definition: pad.h:780
#define _(s)
FOOTPRINT * GetParent() const
Definition: pad.cpp:1439
int GetThermalGap() const
Definition: footprint.h:237

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

Referenced by ZONE::GetThermalReliefGap().

◆ GetEffectiveThermalSpokeWidth()

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

Return the effective thermal spoke width having resolved any inheritance.

Definition at line 860 of file pad.cpp.

861 {
862  FOOTPRINT* parentFootprint = GetParent();
863 
864  if( m_thermalWidth == 0 && parentFootprint )
865  {
866  if( aSource )
867  *aSource = _( "parent footprint" );
868 
869  return parentFootprint->GetThermalWidth();
870  }
871 
872  if( aSource )
873  *aSource = _( "pad" );
874 
875  return m_thermalWidth;
876 }
int m_thermalWidth
Definition: pad.h:779
#define _(s)
int GetThermalWidth() const
Definition: footprint.h:234
FOOTPRINT * GetParent() const
Definition: pad.cpp:1439

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

Referenced by ZONE::GetThermalReliefSpokeWidth().

◆ GetEffectiveZoneConnection()

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

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

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

Definition at line 839 of file pad.cpp.

840 {
841  FOOTPRINT* parentFootprint = GetParent();
842 
843  if( m_zoneConnection == ZONE_CONNECTION::INHERITED && parentFootprint )
844  {
845  if( aSource )
846  *aSource = _( "parent footprint" );
847 
848  return parentFootprint->GetZoneConnection();
849  }
850  else
851  {
852  if( aSource )
853  *aSource = _( "pad" );
854 
855  return m_zoneConnection;
856  }
857 }
#define _(s)
ZONE_CONNECTION m_zoneConnection
Definition: pad.h:778
FOOTPRINT * GetParent() const
Definition: pad.cpp:1439
ZONE_CONNECTION GetZoneConnection() const
Definition: footprint.h:231

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

Referenced by ZONE::GetPadConnection(), and ImportSettingsFrom().

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in BOARD, PCB_TRACK, and PCB_SHAPE.

Definition at line 258 of file eda_item.h.

258 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:251

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetKeepTopBottom()

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Return the primary layer this item is on.

Reimplemented in ZONE.

Definition at line 143 of file board_item.h.

143 { return m_layer; }
PCB_LAYER_ID m_layer
Definition: board_item.h:313

References BOARD_ITEM::m_layer.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::addFootprintShapesWithClearance(), GRAPHICS_CLEANER::areEquivalent(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), AR_AUTOPLACER::buildFpAreas(), TRACKS_CLEANER::cleanup(), CreateBoardSection(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewFootprint(), 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(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::ExchangeFootprint(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), extractDiffPairCoupledItems(), EDIT_TOOL::FilletTracks(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), PCB_TRACK::Flip(), FP_SHAPE::Flip(), PCB_SHAPE::Flip(), FP_TEXT::Flip(), PCB_DIMENSION_BASE::Flip(), FOOTPRINT::Flip(), PCB_ARC::Flip(), FOOTPRINT_DESC::FOOTPRINT_DESC(), PCB_PLUGIN::FootprintSave(), FootprintWriteShape(), PCB_PLUGIN::format(), PCB_PLUGIN::formatLayer(), FP_TEXT::FP_TEXT(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), FOOTPRINT::GetBoundingBox(), ZONE::GetLayer(), getMatchingTextItem(), PCB_TRACK::GetMsgPanelInfo(), PCB_VIA::GetMsgPanelInfo(), GetMsgPanelInfo(), AR_AUTOPLACER::getOptimalFPPlacement(), BOARD::GetPad(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), idf_export_footprint(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), BOARD_INSPECTION_TOOL::InspectDRCError(), isEdge(), IsFlipped(), FOOTPRINT::IsFlipped(), PNS_KICAD_IFACE::IsItemVisible(), BOARD_ITEM::IsOnCopperLayer(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), PCB_SHAPE::cmp_drawings::operator()(), PCB_TRACK::cmp_tracks::operator()(), BOARD_ITEM::ptr_cmp::operator()(), FOOTPRINT::cmp_drawings::operator()(), BOARD::cmp_items::operator()(), BOARD::cmp_drawings::operator()(), EAGLE_PLUGIN::packagePad(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintGraphicItems(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), BRDITEMS_PLOTTER::PlotPcbShape(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotPcbText(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), PAD_TOOL::recombinePad(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), CLIPBOARD_IO::SaveSelection(), CONVERT_TOOL::SegmentToArc(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectConnectedTracks(), GLOBAL_EDIT_TOOL::swapBoardItem(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), PNS_KICAD_IFACE_BASE::syncTrack(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), AR_AUTOPLACER::testFootprintOnBoard(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), BOARD_ADAPTER::transformFPShapesToPolygon(), FOOTPRINT::TransformFPShapesWithClearanceToPolygon(), PCB_TRACK::ViewGetLayers(), FP_TEXT::ViewGetLayers(), FP_TEXT::ViewGetLOD(), FP_ZONE::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

Return the name of the PCB layer on which the item resides.

Returns
the layer name associated with this item.

Definition at line 75 of file board_item.cpp.

76 {
77  const BOARD* board = GetBoard();
78 
79  if( board )
80  return board->GetLayerName( m_layer );
81 
82  // If no parent, return standard name
84 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
PCB_LAYER_ID m_layer
Definition: board_item.h:313
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:606

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

Referenced by PCB_TEXT::GetMsgPanelInfo(), PCB_TARGET::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_DIM_LEADER::GetMsgPanelInfo(), PCB_SHAPE::GetSelectMenuText(), PCB_TEXT::GetSelectMenuText(), FP_SHAPE::GetSelectMenuText(), PCB_TRACK::GetSelectMenuText(), PCB_DIMENSION_BASE::GetSelectMenuText(), PCB_TEXT::GetShownText(), and FOOTPRINT::ResolveTextVar().

◆ GetLayerSet()

◆ GetLocalClearance() [1/2]

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

Return 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
the clearance in internal units.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 735 of file pad.cpp.

736 {
737  if( aSource )
738  *aSource = _( "pad" );
739 
740  return m_localClearance;
741 }
int m_localClearance
Definition: pad.h:772
#define _(s)

References _, and m_localClearance.

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

◆ GetLocalClearance() [2/2]

int PAD::GetLocalClearance ( ) const
inline

Definition at line 390 of file pad.h.

390 { return m_localClearance; }
int m_localClearance
Definition: pad.h:772

References m_localClearance.

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

◆ GetLocalClearanceOverrides()

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

Return 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
the clearance in internal units.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 721 of file pad.cpp.

722 {
723  // A pad can have specific clearance that overrides its NETCLASS clearance value
724  if( GetLocalClearance() )
725  return GetLocalClearance( aSource );
726 
727  // A footprint can have a specific clearance value
728  if( GetParent() && GetParent()->GetLocalClearance() )
729  return GetParent()->GetLocalClearance( aSource );
730 
731  return 0;
732 }
int GetLocalClearance() const
Definition: pad.h:390
int GetLocalClearance() const
Definition: footprint.h:213
FOOTPRINT * GetParent() const
Definition: pad.cpp:1439

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

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLocalSolderMaskMargin()

int PAD::GetLocalSolderMaskMargin ( ) const
inline

◆ GetLocalSolderPasteMargin()

int PAD::GetLocalSolderPasteMargin ( ) const
inline

◆ GetLocalSolderPasteMarginRatio()

double PAD::GetLocalSolderPasteMarginRatio ( ) const
inline

◆ GetMenuImage()

BITMAPS PAD::GetMenuImage ( ) const
overridevirtual

Return 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 1234 of file pad.cpp.

1235 {
1236  return BITMAPS::pad;
1237 }

References pad.

◆ GetMsgPanelInfo()

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

Populate 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 898 of file pad.cpp.

899 {
900  EDA_UNITS units = aFrame->GetUserUnits();
901  wxString msg;
902  FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
903 
904  if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
905  {
906  if( parentFootprint )
907  aList.emplace_back( _( "Footprint" ), parentFootprint->GetReference() );
908  }
909 
910  aList.emplace_back( _( "Pad" ), m_number );
911 
912  if( !GetPinFunction().IsEmpty() )
913  aList.emplace_back( _( "Pin Name" ), GetPinFunction() );
914 
915  if( !GetPinType().IsEmpty() )
916  aList.emplace_back( _( "Pin Type" ), GetPinType() );
917 
918  if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
919  {
920  aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
921 
922  aList.emplace_back( _( "Net Class" ), UnescapeString( GetNetClass()->GetName() ) );
923 
924  if( IsLocked() )
925  aList.emplace_back( _( "Status" ), _( "Locked" ) );
926  }
927 
929  aList.emplace_back( _( "Layer" ), layerMaskDescribe() );
930 
931  // Show the pad shape, attribute and property
932  wxString props = ShowPadAttr();
933 
934  if( GetProperty() != PAD_PROP::NONE )
935  props += ',';
936 
937  switch( GetProperty() )
938  {
939  case PAD_PROP::NONE: break;
940  case PAD_PROP::BGA: props += _( "BGA" ); break;
941  case PAD_PROP::FIDUCIAL_GLBL: props += _( "Fiducial global" ); break;
942  case PAD_PROP::FIDUCIAL_LOCAL: props += _( "Fiducial local" ); break;
943  case PAD_PROP::TESTPOINT: props += _( "Test point" ); break;
944  case PAD_PROP::HEATSINK: props += _( "Heat sink" ); break;
945  case PAD_PROP::CASTELLATED: props += _( "Castellated" ); break;
946  }
947 
948  aList.emplace_back( ShowPadShape(), props );
949 
950  if( ( GetShape() == PAD_SHAPE::CIRCLE || GetShape() == PAD_SHAPE::OVAL ) &&
951  m_size.x == m_size.y )
952  {
953  aList.emplace_back( _( "Diameter" ), MessageTextFromValue( units, m_size.x ) );
954  }
955  else
956  {
957  aList.emplace_back( _( "Width" ), MessageTextFromValue( units, m_size.x ) );
958  aList.emplace_back( _( "Height" ), MessageTextFromValue( units, m_size.y ) );
959  }
960 
961  double fp_orient_degrees = parentFootprint ? parentFootprint->GetOrientationDegrees() : 0;
962  double pad_orient_degrees = GetOrientationDegrees() - fp_orient_degrees;
963  pad_orient_degrees = NormalizeAngleDegrees( pad_orient_degrees, -180.0, +180.0 );
964 
965  if( fp_orient_degrees != 0.0 )
966  msg.Printf( wxT( "%g(+ %g)" ), pad_orient_degrees, fp_orient_degrees );
967  else
968  msg.Printf( wxT( "%g" ), GetOrientationDegrees() );
969 
970  aList.emplace_back( _( "Rotation" ), msg );
971 
972  if( GetPadToDieLength() )
973  {
974  msg = MessageTextFromValue(units, GetPadToDieLength() );
975  aList.emplace_back( _( "Length in Package" ), msg );
976  }
977 
978  if( m_drill.x > 0 || m_drill.y > 0 )
979  {
981  {
982  aList.emplace_back( _( "Hole" ),
983  wxString::Format( wxT( "%s" ),
984  MessageTextFromValue( units, m_drill.x ) ) );
985  }
986  else
987  {
988  aList.emplace_back( _( "Hole X / Y" ),
989  wxString::Format( wxT( "%s / %s" ),
990  MessageTextFromValue( units, m_drill.x ),
991  MessageTextFromValue( units, m_drill.y ) ) );
992  }
993  }
994 
995  wxString source;
996  int clearance = GetOwnClearance( GetLayer(), &source );
997 
998  if( !source.IsEmpty() )
999  {
1000  aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
1001  MessageTextFromValue( units, clearance ) ),
1002  wxString::Format( _( "(from %s)" ),
1003  source ) );
1004  }
1005 #if 0
1006  // useful for debug only
1007  aList.emplace_back( wxT( "UUID" ), m_Uuid.AsString() );
1008 #endif
1009 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:478
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
PAD_PROP GetProperty() const
Definition: pad.h:374
wxSize m_drill
Definition: pad.h:715
virtual NETCLASS * GetNetClass() const
Return the NETCLASS for this item.
Like smd, does not appear on the solder paste layer (default)
Smd pad, appears on the solder paste layer (default)
bool IsLocked() const override
Definition: pad.cpp:150
wxString AsString() const
Definition: kiid.cpp:236
a test point pad
wxString ShowPadShape() const
Definition: pad.cpp:1154
a pad used as heat sink, usually in SMD footprints
virtual wxString layerMaskDescribe() const
Return a string (to be shown to the user) describing a layer mask.
Definition: board_item.cpp:87
Smd pad, used in BGA footprints.
const wxString & GetPinType() const
Definition: pad.h:146
PAD_SHAPE GetShape() const
Definition: pad.h:170
const wxString & GetReference() const
Definition: footprint.h:466
a fiducial (usually a smd) local to the parent footprint
#define _(s)
wxString UnescapeString(const wxString &aSource)
const KIID m_Uuid
Definition: eda_item.h:474
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
wxSize m_size
Definition: pad.h:716
EDA_UNITS
Definition: eda_units.h:38
double GetOrientationDegrees() const
Definition: footprint.h:192
a fiducial (usually a smd) for the full board
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:354
no special fabrication property
PAD_ATTRIB GetAttribute() const
Definition: pad.h:371
double GetOrientationDegrees() const
Definition: pad.h:350
double NormalizeAngleDegrees(double Angle, double aMin, double aMax)
Normalize angle to be aMin < angle <= aMax angle is in degrees.
Definition: trigo.h:327
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
a pad with a castellated through hole
wxString ShowPadAttr() const
Definition: pad.cpp:1170
#define PCB_EDIT_FRAME_NAME
wxString m_number
Definition: pad.h:678
int GetPadToDieLength() const
Definition: pad.h:384
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:143
const wxString & GetPinFunction() const
Definition: pad.h:140
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References _, KIID::AsString(), BGA, CASTELLATED, CIRCLE, CONN, FIDUCIAL_GLBL, FIDUCIAL_LOCAL, Format(), GetAttribute(), GetDrillShape(), BOARD_ITEM::GetLayer(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetname(), FOOTPRINT::GetOrientationDegrees(), GetOrientationDegrees(), BOARD_CONNECTED_ITEM::GetOwnClearance(), GetPadToDieLength(), GetPinFunction(), GetPinType(), GetProperty(), FOOTPRINT::GetReference(), GetShape(), EDA_BASE_FRAME::GetUserUnits(), HEATSINK, IsLocked(), BOARD_ITEM::layerMaskDescribe(), m_drill, m_number, EDA_ITEM::m_parent, m_size, EDA_ITEM::m_Uuid, MessageTextFromValue(), NONE, NormalizeAngleDegrees(), OVAL, PAD_DRILL_SHAPE_CIRCLE, PCB_EDIT_FRAME_NAME, ShowPadAttr(), ShowPadShape(), SMD, TESTPOINT, and UnescapeString().

◆ GetNet()

◆ GetNetClass()

NETCLASS * BOARD_CONNECTED_ITEM::GetNetClass ( ) const
virtualinherited

Return 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.

Reimplemented in ZONE.

Definition at line 108 of file board_connected_item.cpp.

109 {
110  if( m_netinfo && m_netinfo->GetNetClass() )
111  return m_netinfo->GetNetClass();
112  else
113  return GetBoard()->GetDesignSettings().GetDefault();
114 }
NETCLASS * GetNetClass()
Definition: netinfo.h:110
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
NETCLASS * GetDefault() const
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36

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

Referenced by PCB_VIA::GetDrillValue(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), BOARD_INSPECTION_TOOL::getItemDescription(), GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), ZONE::GetNetClass(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), and DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow().

◆ GetNetClassName()

wxString BOARD_CONNECTED_ITEM::GetNetClassName ( ) const
virtualinherited

Returns 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.

Reimplemented in ZONE.

Definition at line 117 of file board_connected_item.cpp.

118 {
119  if( m_netinfo )
120  return m_netinfo->GetNetClassName();
121  else
122  return wxEmptyString;
123 }
wxString GetNetClassName() const
Definition: netinfo.h:115
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.

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

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

◆ GetNetCode()

int BOARD_CONNECTED_ITEM::GetNetCode ( ) const
inherited
Returns
the net code.

Definition at line 100 of file board_connected_item.cpp.

101 {
102  return m_netinfo ? m_netinfo->GetNetCode() : -1;
103 }
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
int GetNetCode() const
Definition: netinfo.h:120

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

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), ZONE_FILLER::buildCopperItemClearances(), connectedItemFilter(), CreateRoutesSection(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::ExchangeFootprint(), ZONE_FILLER::Fill(), PNS::NODE::FindItemByParent(), PCB_PLUGIN::format(), DSN::SPECCTRA_DB::FromBOARD(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), CONNECTIVITY_DATA::GetConnectedItems(), ZONE::GetInteractingZones(), PCB_TRACK::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), CONNECTIVITY_DATA::GetRatsnestForPad(), hasThermalConnection(), BOARD_INSPECTION_TOOL::highlightNet(), DIALOG_PAD_PROPERTIES::initValues(), BOARD_INSPECTION_TOOL::InspectClearance(), CONNECTIVITY_DATA::IsConnectedOnLayer(), ZONE::IsIsland(), ZONE::IsSame(), ZONE_FILLER::knockoutThermalReliefs(), AR_AUTOPLACER::nearestPad(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), DIALOG_DRC::OnDRCItemSelected(), PCB_TRACK::cmp_tracks::operator()(), ZONE_SETTINGS::operator<<(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), process(), BOARD_EDITOR_CONTROL::RepairBoard(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), PCB_SELECTION_TOOL::selectNet(), ZONE_FILLER::subtractHigherPriorityZones(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones(), BOARD::TracksInNet(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ GetNetname()

◆ GetNetnameMsg()

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

Definition at line 132 of file board_connected_item.cpp.

133 {
134  if( !GetBoard() )
135  return wxT( "[** NO BOARD DEFINED **]" );
136 
137  wxString netname = GetNetname();
138 
139  if( !netname.length() )
140  return wxT( "[<no net>]" );
141  else if( GetNetCode() < 0 )
142  return wxT( "[" ) + UnescapeString( netname ) + wxT( "](" ) + _( "Not Found" ) + wxT( ")" );
143  else
144  return wxT( "[" ) + UnescapeString( netname ) + wxT( "]" );
145 }
#define _(s)
wxString UnescapeString(const wxString &aSource)
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36

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

Referenced by PCB_TRACK::GetSelectMenuText(), PCB_VIA::GetSelectMenuText(), GetSelectMenuText(), and ZONE::GetSelectMenuText().

◆ GetNumber()

◆ GetOffset()

◆ GetOrientation()

◆ GetOrientationDegrees()

double PAD::GetOrientationDegrees ( ) const
inline

Definition at line 350 of file pad.h.

350 { return m_orient/10.0; }
double m_orient
Definition: pad.h:752

References m_orient.

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

◆ GetOrientationRadians()

double PAD::GetOrientationRadians ( ) const
inline

Definition at line 351 of file pad.h.

351 { return m_orient*M_PI/1800; }
double m_orient
Definition: pad.h:752

References m_orient.

◆ GetOwnClearance()

int BOARD_CONNECTED_ITEM::GetOwnClearance ( PCB_LAYER_ID  aLayer,
wxString *  aSource = nullptr 
) const
virtualinherited

Return an item's "own" clearance in internal units.

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

Definition at line 77 of file board_connected_item.cpp.

78 {
79  DRC_CONSTRAINT constraint;
80 
81  if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
82  {
84 
85  constraint = bds.m_DRCEngine->EvalRules( CLEARANCE_CONSTRAINT, this, nullptr, aLayer );
86  }
87 
88  if( constraint.Value().HasMin() )
89  {
90  if( aSource )
91  *aSource = constraint.GetName();
92 
93  return constraint.Value().Min();
94  }
95 
96  return 0;
97 }
bool HasMin() const
Definition: minoptmax.h:37
MINOPTMAX< int > & Value()
Definition: drc_rule.h:123
T Min() const
Definition: minoptmax.h:33
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
wxString GetName() const
Definition: drc_rule.h:130
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
std::shared_ptr< DRC_ENGINE > m_DRCEngine
Container for design settings for a BOARD object.

References CLEARANCE_CONSTRAINT, 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 KIGFX::PCB_PAINTER::draw(), ZONE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), PCB_VIA::GetMsgPanelInfo(), GetMsgPanelInfo(), and ViewBBox().

◆ GetPadToDieLength()

◆ GetParent()

◆ GetParentAsString()

wxString PAD::GetParentAsString ( ) const
inline

Definition at line 107 of file pad.h.

107 { return m_parent->m_Uuid.AsString(); }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:478
wxString AsString() const
Definition: kiid.cpp:236
const KIID m_Uuid
Definition: eda_item.h:474

References KIID::AsString(), EDA_ITEM::m_parent, and EDA_ITEM::m_Uuid.

Referenced by PAD_DESC::PAD_DESC().

◆ GetParentFootprint()

BOARD_ITEM_CONTAINER * BOARD_ITEM::GetParentFootprint ( ) const
inherited

Definition at line 191 of file board_item.cpp.

192 {
193  BOARD_ITEM_CONTAINER* ancestor = GetParent();
194 
195  while( ancestor && ancestor->Type() == PCB_GROUP_T )
196  ancestor = ancestor->GetParent();
197 
198  return ( ancestor && ancestor->Type() == PCB_FOOTPRINT_T ) ? ancestor : nullptr;
199 }
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:136
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References BOARD_ITEM::GetParent(), PCB_FOOTPRINT_T, PCB_GROUP_T, and EDA_ITEM::Type().

Referenced by CN_CONNECTIVITY_ALGO::Add(), PNS::ITEM::collideSimple(), CONVERT_TOOL::CreatePolys(), and DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems().

◆ GetParentGroup()

◆ GetPinFunction()

const wxString& PAD::GetPinFunction ( ) const
inline

◆ GetPinType()

const wxString& PAD::GetPinType ( ) const
inline

Definition at line 146 of file pad.h.

146 { return m_pinType; }
wxString m_pinType
Definition: pad.h:680

References m_pinType.

Referenced by KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_PLUGIN::format(), GetMsgPanelInfo(), operator=(), and PAD_DESC::PAD_DESC().

◆ GetPos0()

const wxPoint& PAD::GetPos0 ( ) const
inline

Definition at line 227 of file pad.h.

227 { return m_pos0; }
wxPoint m_pos0
Definition: pad.h:745

References m_pos0.

Referenced by MICROWAVE_TOOL::createPolygonShape(), PCB_PLUGIN::format(), and operator=().

◆ GetPosition()

◆ GetPrimitives()

const std::vector<std::shared_ptr<PCB_SHAPE> >& PAD::GetPrimitives ( ) const
inline

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

Definition at line 301 of file pad.h.

302  {
303  return m_editPrimitives;
304  }
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:691

References m_editPrimitives.

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

◆ GetProperty()

◆ GetRemoveUnconnected()

bool PAD::GetRemoveUnconnected ( ) const
inline

Definition at line 558 of file pad.h.

558 { return m_removeUnconnectedLayer; }
bool m_removeUnconnectedLayer
< If true, the pad copper is removed for layers that are not connected.
Definition: pad.h:757

References m_removeUnconnectedLayer.

Referenced by PCB_PLUGIN::format(), DIALOG_PAD_PROPERTIES::initValues(), DIALOG_PAD_PROPERTIES::OnUpdateUI(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ GetRoundRectCornerRadius()

int PAD::GetRoundRectCornerRadius ( ) const

Definition at line 269 of file pad.cpp.

270 {
271  return KiROUND( std::min( m_size.x, m_size.y ) * m_roundedCornerScale );
272 }
double m_roundedCornerScale
Definition: pad.h:720
wxSize m_size
Definition: pad.h:716
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:73

References KiROUND(), m_roundedCornerScale, and m_size.

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

◆ GetRoundRectRadiusRatio()

◆ GetSelectMenuText()

wxString PAD::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

Return 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 1183 of file pad.cpp.

1184 {
1185  if( GetNumber().IsEmpty() )
1186  {
1188  {
1189  return wxString::Format( _( "Pad %s of %s on %s" ),
1190  GetNetnameMsg(),
1191  GetParent()->GetReference(),
1192  layerMaskDescribe() );
1193  }
1195  {
1196  return wxString::Format( _( "Through hole pad %s of %s" ),
1197  wxT( "(" ) + _( "NPTH, Mechanical" ) + wxT( ")" ),
1198  GetParent()->GetReference() );
1199  }
1200  else
1201  {
1202  return wxString::Format( _( "Through hole pad %s of %s" ),
1203  GetNetnameMsg(),
1204  GetParent()->GetReference() );
1205  }
1206  }
1207  else
1208  {
1210  {
1211  return wxString::Format( _( "Pad %s %s of %s on %s" ),
1212  GetNumber(),
1213  GetNetnameMsg(),
1214  GetParent()->GetReference(),
1215  layerMaskDescribe() );
1216  }
1218  {
1219  return wxString::Format( _( "Through hole pad %s of %s" ),
1220  wxT( "(" ) + _( "NPTH, Mechanical" ) + wxT( ")" ),
1221  GetParent()->GetReference() );
1222  }
1223  else
1224  {
1225  return wxString::Format( _( "Through hole pad %s %s of %s" ),
1226  GetNumber(),
1227  GetNetnameMsg(),
1228  GetParent()->GetReference() );
1229  }
1230  }
1231 }
Like smd, does not appear on the solder paste layer (default)
Smd pad, appears on the solder paste layer (default)
virtual wxString layerMaskDescribe() const
Return a string (to be shown to the user) describing a layer mask.
Definition: board_item.cpp:87
like PAD_PTH, but not plated
bool FlashLayer(int aLayer) const
Check to see whether the pad should be flashed on the specific layer.
Definition: pad.cpp:214
const wxString & GetNumber() const
Definition: pad.h:129
#define _(s)
wxString GetNetnameMsg() const
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
FOOTPRINT * GetParent() const
Definition: pad.cpp:1439
PAD_ATTRIB GetAttribute() const
Definition: pad.h:371

References _, CONN, FlashLayer(), Format(), GetAttribute(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), GetNumber(), GetParent(), BOARD_ITEM::layerMaskDescribe(), NPTH, SMD, and UNDEFINED_LAYER.

◆ GetShape()

◆ GetShortNetname()

wxString BOARD_CONNECTED_ITEM::GetShortNetname ( ) const
inherited
Returns
the short netname.

Definition at line 148 of file board_connected_item.cpp.

149 {
150  return m_netinfo->GetShortNetname();
151 }
const wxString & GetShortNetname() const
Definition: netinfo.h:131
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.

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

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

◆ GetSize()

◆ GetSizeX()

const int PAD::GetSizeX ( ) const
inline

Definition at line 235 of file pad.h.

235 { return m_size.x; }
wxSize m_size
Definition: pad.h:716

References m_size.

Referenced by PAD_DESC::PAD_DESC(), PAD_TOOL::recombinePad(), and ViewGetLOD().

◆ GetSizeY()

const int PAD::GetSizeY ( ) const
inline

Definition at line 237 of file pad.h.

237 { return m_size.y; }
wxSize m_size
Definition: pad.h:716

References m_size.

Referenced by PAD_DESC::PAD_DESC(), PAD_TOOL::recombinePad(), and ViewGetLOD().

◆ GetSolderMaskMargin()

int PAD::GetSolderMaskMargin ( ) const
Returns
the margin for the solder mask layer

Usually > 0 (mask shape bigger than pad). For pads not on copper layers, the value is the local value because there is no default shape to build. 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

Definition at line 744 of file pad.cpp.

745 {
746  // The pad inherits the margin only to calculate a default shape,
747  // therefore only if it is also a copper layer
748  // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
749  // defined by the pad settings only
750  bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
751 
752  if( !isOnCopperLayer )
753  return 0;
754 
755  int margin = m_localSolderMaskMargin;
756 
757  FOOTPRINT* parentFootprint = GetParent();
758 
759  if( parentFootprint )
760  {
761  if( margin == 0 )
762  {
763  if( parentFootprint->GetLocalSolderMaskMargin() )
764  margin = parentFootprint->GetLocalSolderMaskMargin();
765  }
766 
767  if( margin == 0 )
768  {
769  const BOARD* brd = GetBoard();
770 
771  if( brd )
772  margin = brd->GetDesignSettings().m_SolderMaskMargin;
773  }
774  }
775 
776  // ensure mask have a size always >= 0
777  if( margin < 0 )
778  {
779  int minsize = -std::min( m_size.x, m_size.y ) / 2;
780 
781  if( margin < minsize )
782  margin = minsize;
783  }
784 
785  return margin;
786 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
LSET m_layerMask
Definition: pad.h:738
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
int m_localSolderMaskMargin
Definition: pad.h:773
wxSize m_size
Definition: pad.h:716
FOOTPRINT * GetParent() const
Definition: pad.cpp:1439
int GetLocalSolderMaskMargin() const
Definition: footprint.h:210
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36

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

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

◆ GetSolderPasteMargin()

wxSize PAD::GetSolderPasteMargin ( ) const

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 not on copper layers, the value is the local value because there is no default shape to build. 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

Returns
the margin for the solder mask layer.

Definition at line 789 of file pad.cpp.

790 {
791  // The pad inherits the margin only to calculate a default shape,
792  // therefore only if it is also a copper layer.
793  // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
794  // defined by the pad settings only
795  bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
796 
797  if( !isOnCopperLayer )
798  return wxSize( 0, 0 );
799 
800  int margin = m_localSolderPasteMargin;
801  double mratio = m_localSolderPasteMarginRatio;
802 
803  FOOTPRINT* parentFootprint = GetParent();
804 
805  if( parentFootprint )
806  {
807  if( margin == 0 )
808  margin = parentFootprint->GetLocalSolderPasteMargin();
809 
810  auto brd = GetBoard();
811 
812  if( margin == 0 && brd )
813  margin = brd->GetDesignSettings().m_SolderPasteMargin;
814 
815  if( mratio == 0.0 )
816  mratio = parentFootprint->GetLocalSolderPasteMarginRatio();
817 
818  if( mratio == 0.0 && brd )
819  {
820  mratio = brd->GetDesignSettings().m_SolderPasteMarginRatio;
821  }
822  }
823 
824  wxSize pad_margin;
825  pad_margin.x = margin + KiROUND( m_size.x * mratio );
826  pad_margin.y = margin + KiROUND( m_size.y * mratio );
827 
828  // ensure mask have a size always >= 0
829  if( pad_margin.x < -m_size.x / 2 )
830  pad_margin.x = -m_size.x / 2;
831 
832  if( pad_margin.y < -m_size.y / 2 )
833  pad_margin.y = -m_size.y / 2;
834 
835  return pad_margin;
836 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
LSET m_layerMask
Definition: pad.h:738
double m_localSolderPasteMarginRatio
Definition: pad.h:775
int m_localSolderPasteMargin
Definition: pad.h:774
wxSize m_size
Definition: pad.h:716
FOOTPRINT * GetParent() const
Definition: pad.cpp:1439
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:73
double GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:227
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
int GetLocalSolderPasteMargin() const
Definition: footprint.h:224

References LSET::AllCuMask(), BOARD_ITEM::GetBoard(), FOOTPRINT::GetLocalSolderPasteMargin(), FOOTPRINT::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 ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 136 of file eda_item.h.

137  {
138  return m_status & type;
139  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:477

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 149 of file eda_item.h.

149 { return m_status; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:477

References EDA_ITEM::m_status.

◆ GetSubRatsnest()

int PAD::GetSubRatsnest ( ) const
inline
Returns
the netcode.

Definition at line 548 of file pad.h.

548 { return m_subRatsnest; }
int m_subRatsnest
Definition: pad.h:712

References m_subRatsnest.

Referenced by operator=().

◆ GetThermalGap()

int PAD::GetThermalGap ( ) const
inline

◆ GetThermalSpokeWidth()

int PAD::GetThermalSpokeWidth ( ) const
inline

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ GetZoneConnection()

ZONE_CONNECTION PAD::GetZoneConnection ( ) const
inline

Definition at line 477 of file pad.h.

477 { return m_zoneConnection; }
ZONE_CONNECTION m_zoneConnection
Definition: pad.h:778

References m_zoneConnection.

Referenced by PCB_PLUGIN::format(), DIALOG_PAD_PROPERTIES::initValues(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ HasFlag()

◆ HitTest() [1/2]

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

Test if aPosition is inside or on the boundary of this 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 1012 of file pad.cpp.

1013 {
1014  VECTOR2I delta = aPosition - GetPosition();
1015  int boundingRadius = GetBoundingRadius() + aAccuracy;
1016 
1017  if( delta.SquaredEuclideanNorm() > SEG::Square( boundingRadius ) )
1018  return false;
1019 
1020  return GetEffectivePolygon()->Contains( aPosition, -1, aAccuracy );
1021 }
static SEG::ecoord Square(int a)
Definition: seg.h:122
int GetBoundingRadius() const
Return the radius of a minimum sized circle which fully encloses this pad.
Definition: pad.cpp:345
wxPoint GetPosition() const override
Definition: pad.h:178
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon() const
Definition: pad.cpp:300
constexpr int delta

References delta, GetBoundingRadius(), GetEffectivePolygon(), GetPosition(), and SEG::Square().

◆ HitTest() [2/2]

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

Test if aRect intersects this 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 1024 of file pad.cpp.

1025 {
1026  EDA_RECT arect = aRect;
1027  arect.Normalize();
1028  arect.Inflate( aAccuracy );
1029 
1030  EDA_RECT bbox = GetBoundingBox();
1031 
1032  if( aContained )
1033  {
1034  return arect.Contains( bbox );
1035  }
1036  else
1037  {
1038  // Fast test: if aRect is outside the polygon bounding box,
1039  // rectangles cannot intersect
1040  if( !arect.Intersects( bbox ) )
1041  return false;
1042 
1043  const std::shared_ptr<SHAPE_POLY_SET>& poly = GetEffectivePolygon();
1044 
1045  int count = poly->TotalVertices();
1046 
1047  for( int ii = 0; ii < count; ii++ )
1048  {
1049  auto vertex = poly->CVertex( ii );
1050  auto vertexNext = poly->CVertex(( ii + 1 ) % count );
1051 
1052  // Test if the point is within aRect
1053  if( arect.Contains( ( wxPoint ) vertex ) )
1054  return true;
1055 
1056  // Test if this edge intersects aRect
1057  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
1058  return true;
1059  }
1060 
1061  return false;
1062  }
1063 }
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
const EDA_RECT GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
Definition: pad.cpp:569
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
Handle the component boundary box.
Definition: eda_rect.h:42
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon() const
Definition: pad.cpp:300
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References EDA_RECT::Contains(), GetBoundingBox(), GetEffectivePolygon(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), and EDA_RECT::Normalize().

◆ ImportSettingsFrom()

void PAD::ImportSettingsFrom ( const PAD aMasterPad)

Import the pad settings from aMasterPad.

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

Parameters
aMasterPadthe template pad.

Definition at line 1445 of file pad.cpp.

1446 {
1447  SetShape( aMasterPad.GetShape() );
1448  SetLayerSet( aMasterPad.GetLayerSet() );
1449  SetAttribute( aMasterPad.GetAttribute() );
1450  SetProperty( aMasterPad.GetProperty() );
1451 
1452  // I am not sure the m_LengthPadToDie must be imported, because this is
1453  // a parameter really specific to a given pad (JPC).
1454  // So this is currently non imported
1455 #if 0
1456  SetPadToDieLength( aMasterPad.GetPadToDieLength() );
1457 #endif
1458 
1459  // The pad orientation, for historical reasons is the
1460  // pad rotation + parent rotation.
1461  // So we have to manage this parent rotation
1462  double pad_rot = aMasterPad.GetOrientation();
1463 
1464  if( aMasterPad.GetParent() )
1465  pad_rot -= aMasterPad.GetParent()->GetOrientation();
1466 
1467  if( GetParent() )
1468  pad_rot += GetParent()->GetOrientation();
1469 
1470  SetOrientation( pad_rot );
1471 
1472  SetSize( aMasterPad.GetSize() );
1473  SetDelta( wxSize( 0, 0 ) );
1474  SetOffset( aMasterPad.GetOffset() );
1475  SetDrillSize( aMasterPad.GetDrillSize() );
1476  SetDrillShape( aMasterPad.GetDrillShape() );
1478  SetChamferRectRatio( aMasterPad.GetChamferRectRatio() );
1479  SetChamferPositions( aMasterPad.GetChamferPositions() );
1480 
1481  switch( aMasterPad.GetShape() )
1482  {
1483  case PAD_SHAPE::TRAPEZOID:
1484  SetDelta( aMasterPad.GetDelta() );
1485  break;
1486 
1487  case PAD_SHAPE::CIRCLE:
1488  // ensure size.y == size.x
1489  SetSize( wxSize( GetSize().x, GetSize().x ) );
1490  break;
1491 
1492  default:
1493  ;
1494  }
1495 
1496  switch( aMasterPad.GetAttribute() )
1497  {
1498  case PAD_ATTRIB::SMD:
1499  case PAD_ATTRIB::CONN:
1500  // These pads do not have hole (they are expected to be only on one
1501  // external copper layer)
1502  SetDrillSize( wxSize( 0, 0 ) );
1503  break;
1504 
1505  default:
1506  ;
1507  }
1508 
1509  // copy also local settings:
1510  SetLocalClearance( aMasterPad.GetLocalClearance() );
1514 
1517  SetThermalGap( aMasterPad.GetThermalGap() );
1518 
1520 
1521  // Add or remove custom pad shapes:
1522  ReplacePrimitives( aMasterPad.GetPrimitives() );
1523  SetAnchorPadShape( aMasterPad.GetAnchorPadShape() );
1524 
1525  SetDirty();
1526 }
int GetLocalSolderMaskMargin() const
Definition: pad.h:386
void SetOffset(const wxPoint &aOffset)
Definition: pad.h:249
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: pad.h:397
void SetAttribute(PAD_ATTRIB aAttribute)
Definition: pad.cpp:611
int GetLocalSolderPasteMargin() const
Definition: pad.h:393
double GetRoundRectRadiusRatio() const
Definition: pad.h:524
void SetLocalClearance(int aClearance)
Definition: pad.h:391
void SetThermalSpokeWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition: pad.h:491
PAD_PROP GetProperty() const
Definition: pad.h:374
Like smd, does not appear on the solder paste layer (default)
Smd pad, appears on the solder paste layer (default)
double GetOrientation() const
Definition: footprint.h:191
void ReplacePrimitives(const std::vector< std::shared_ptr< PCB_SHAPE >> &aPrimitivesList)
Clear the current custom shape primitives list and import a new list.
void SetSize(const wxSize &aSize)
Definition: pad.h:232
void SetDelta(const wxSize &aSize)
Definition: pad.h:239
int GetThermalGap() const
Definition: pad.h:500
void SetPadToDieLength(int aLength)
Definition: pad.h:383
void SetProperty(PAD_PROP aProperty)
Definition: pad.cpp:622
void SetLocalSolderMaskMargin(int aMargin)
Definition: pad.h:387
const wxPoint & GetOffset() const
Definition: pad.h:250
const wxSize & GetDrillSize() const
Definition: pad.h:243
int GetThermalSpokeWidth() const
Definition: pad.h:492
double GetOrientation() const
Return the rotation angle of the pad in a variety of units (the basic call returns tenths of degrees)...
Definition: pad.h:349
void SetThermalGap(int aGap)
Definition: pad.h:499
void SetDrillSize(const wxSize &aSize)
Definition: pad.h:242
const wxSize & GetSize() const
Definition: pad.h:233
ZONE_CONNECTION GetEffectiveZoneConnection(wxString *aSource=nullptr) const
Return the zone connection in effect (either locally overridden or overridden in the parent footprint...
Definition: pad.cpp:839
PAD_SHAPE GetShape() const
Definition: pad.h:170
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:368
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: pad.h:476
void SetCustomShapeInZoneOpt(CUST_PAD_SHAPE_IN_ZONE aOption)
Set the option for the custom pad shape to use as clearance area in copper zones.
Definition: pad.h:198
void SetRoundRectRadiusRatio(double aRadiusScale)
Has meaning only for rounded rectangle pads.
Definition: pad.cpp:284
int GetLocalClearance(wxString *aSource) const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
Definition: pad.cpp:735
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
Definition: pad.h:353
double GetLocalSolderPasteMarginRatio() const
Definition: pad.h:396
const wxSize & GetDelta() const
Definition: pad.h:240
FOOTPRINT * GetParent() const
Definition: pad.cpp:1439
void SetChamferPositions(int aPositions)
Has meaning only for chamfered rectangular pads.
Definition: pad.h:542
void SetLayerSet(LSET aLayers) override
Definition: pad.h:367
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: pad.h:188
double GetChamferRectRatio() const
Definition: pad.h:533
void SetLocalSolderPasteMargin(int aMargin)
Definition: pad.h:394
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:354
PAD_ATTRIB GetAttribute() const
Definition: pad.h:371
void SetDirty()
Definition: pad.h:361
void SetShape(PAD_SHAPE aShape)
Set the new shape of this pad.
Definition: pad.h:161
int GetChamferPositions() const
Definition: pad.h:543
void SetChamferRectRatio(double aChamferScale)
Has meaning only for chamfered rectangular pads.
Definition: pad.cpp:292
int GetPadToDieLength() const
Definition: pad.h:384
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives() const
Accessor to the basic shape list for custom-shaped pads.
Definition: pad.h:301
PAD_SHAPE GetAnchorPadShape() const
Definition: pad.h:183
void SetOrientation(double aAngle)
Set the rotation angle of the pad.
Definition: pad.cpp:630
void SetAnchorPadShape(PAD_SHAPE aShape)
Set the shape of the anchor pad for custom shaped pads.
Definition: pad.h:209

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

Referenced by operator=().

◆ IsAperturePad()

bool PAD::IsAperturePad ( ) const
inline

Definition at line 378 of file pad.h.

379  {
380  return ( m_layerMask & LSET::AllCuMask() ).none();
381  }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
LSET m_layerMask
Definition: pad.h:738

References LSET::AllCuMask(), and m_layerMask.

Referenced by CanHaveNumber(), doPushPadProperties(), and DIALOG_PAD_PROPERTIES::initValues().

◆ IsBrightened()

◆ IsConnected()

bool BOARD_CONNECTED_ITEM::IsConnected ( ) const
inlineoverridevirtualinherited

Returns information if the object is derived from BOARD_CONNECTED_ITEM.

Returns
True if the object is of BOARD_CONNECTED_ITEM type, false otherwise.

Reimplemented from BOARD_ITEM.

Reimplemented in ZONE.

Definition at line 67 of file board_connected_item.h.

68  {
69  return true;
70  }

◆ IsDirty()

bool PAD::IsDirty ( ) const
inline

Definition at line 356 of file pad.h.

357  {
358  return m_shapesDirty || m_polyDirty;
359  }
bool m_shapesDirty
Definition: pad.h:694
bool m_polyDirty
Definition: pad.h:700

References m_polyDirty, and m_shapesDirty.

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 120 of file eda_item.h.

120 { return m_flags & IS_DRAGGING; }
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 123 of file eda_item.h.

123 { return m_flags & ENTERED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define ENTERED
indicates a group has been entered

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsFlipped()

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

Definition at line 194 of file pad.cpp.

195 {
196  if( GetParent() && GetParent()->GetLayer() == B_Cu )
197  return true;
198  return false;
199 }
FOOTPRINT * GetParent() const
Definition: pad.cpp:1439
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:143

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 205 of file eda_item.h.

205 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:479

References EDA_ITEM::m_forceVisible.

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

◆ IsLocked()

bool PAD::IsLocked ( ) const
overridevirtual
Returns
true if the object is locked, else false.

Reimplemented from BOARD_ITEM.

Definition at line 150 of file pad.cpp.

151 {
152  if( GetParent() && GetParent()->IsLocked() )
153  return true;
154 
155  return BOARD_ITEM::IsLocked();
156 };
bool IsLocked() const override
Definition: pad.cpp:150
virtual bool IsLocked() const
Definition: board_item.cpp:64
FOOTPRINT * GetParent() const
Definition: pad.cpp:1439

References GetParent(), and BOARD_ITEM::IsLocked().

Referenced by PCB_PLUGIN::format(), GetMsgPanelInfo(), and DIALOG_PAD_PROPERTIES::initValues().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 117 of file eda_item.h.

117 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

bool PAD::IsOnCopperLayer ( ) const
inlineoverridevirtual
Returns
true if the pad is on any copper layer, false otherwise.

Reimplemented from BOARD_ITEM.

Definition at line 218 of file pad.h.

219  {
220  return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
221  }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:368

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

Referenced by PCB_EDIT_FRAME::ExchangeFootprint(), and DIALOG_PAD_PROPERTIES::padValuesOK().

◆ IsOnLayer()

bool PAD::IsOnLayer ( PCB_LAYER_ID  aLayer) const
inlineoverridevirtual

Test to see if this object is on the given layer.

Virtual so objects like PAD, which reside on multiple layers can do their own form of testing.

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

Reimplemented from BOARD_ITEM.

Definition at line 568 of file pad.h.

569  {
570  return m_layerMask[aLayer];
571  }
LSET m_layerMask
Definition: pad.h:738

References m_layerMask.

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

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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_SYMBOL, SCH_SHEET, SCH_LABEL, SCH_TEXT, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 402 of file eda_item.h.

402 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 124 of file eda_item.h.

124 { return m_flags & IS_RESIZING; }
#define IS_RESIZING
Item being resized.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 122 of file eda_item.h.

122 { return m_flags & SELECTED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define SELECTED

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_OPENGL::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

Test to see if this object is a track or via (or microvia).

Returns
true if a track or via, else false.

Definition at line 205 of file board_item.h.

206  {
207  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
208  }
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

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

◆ IsType()

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

Check 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 84 of file pad.h.

85  {
86  if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
87  return true;
88 
89  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
90  {
91  if( m_drill.x > 0 && m_drill.y > 0 )
92  {
93  if( *p == PCB_LOCATE_HOLE_T )
94  return true;
95  else if( *p == PCB_LOCATE_PTH_T && m_attribute != PAD_ATTRIB::NPTH )
96  return true;
97  else if( *p == PCB_LOCATE_NPTH_T && m_attribute == PAD_ATTRIB::NPTH )
98  return true;
99  }
100  }
101 
102  return false;
103  }
wxSize m_drill
Definition: pad.h:715
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
like PAD_PTH, but not plated
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:182
PAD_ATTRIB m_attribute
Definition: pad.h:748

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

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 121 of file eda_item.h.

121 { return m_flags & IS_WIRE_IMAGE; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

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

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

Definition at line 294 of file eda_item.h.

298  {
299  for( auto it : aList )
300  {
301  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
303  return SEARCH_RESULT::QUIT;
304  }
305 
307  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

Change first parameter to avoid the DList and use std::vector instead.

Definition at line 313 of file eda_item.h.

315  {
316  for( auto it : aList )
317  {
318  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
320  return SEARCH_RESULT::QUIT;
321  }
322 
324  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

◆ layerMaskDescribe()

wxString BOARD_ITEM::layerMaskDescribe ( ) const
protectedvirtualinherited

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

The BOARD is needed because layer names are customizable.

Reimplemented in PCB_VIA.

Definition at line 87 of file board_item.cpp.

88 {
89  const BOARD* board = GetBoard();
90  LSET layers = GetLayerSet();
91 
92  // Try to be smart and useful. Check all copper first.
93  if( layers[F_Cu] && layers[B_Cu] )
94  return _( "all copper layers" );
95 
96  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
97  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
98 
99  for( LSET testLayers : { copperLayers, techLayers, layers } )
100  {
101  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
102  {
103  if( testLayers[ bit ] )
104  {
105  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
106 
107  if( testLayers.count() > 1 )
108  layerInfo << wxS( " " ) + _( "and others" );
109 
110  return layerInfo;
111  }
112  }
113  }
114 
115  // No copper, no technicals: no layer
116  return _( "no layers" );
117 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:467
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:829
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
#define _(s)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
Definition: layer_ids.h:71
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:148

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 PCB_TRACK::GetMsgPanelInfo(), GetMsgPanelInfo(), and GetSelectMenuText().

◆ Matches() [1/2]

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

Compare 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_SYMBOL, SCH_SHEET, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, ZONE, SCH_PIN, PCB_MARKER, SCH_MARKER, FP_TEXT, and PCB_TEXT.

Definition at line 364 of file eda_item.h.

365  {
366  return false;
367  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), PCB_TEXT::Matches(), FP_TEXT::Matches(), SCH_MARKER::Matches(), PCB_MARKER::Matches(), SCH_PIN::Matches(), ZONE::Matches(), SCH_SHEET_PIN::Matches(), SCH_FIELD::Matches(), SCH_TEXT::Matches(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

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

Compare 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 118 of file eda_item.cpp.

119 {
120  wxString text = aText;
121  int flags = aSearchData.GetFlags();
122  wxString searchText = aSearchData.GetFindString();
123 
124  // Don't match if searching for replaceable item and the item doesn't support text replace.
125  if( ( flags & FR_SEARCH_REPLACE ) && !IsReplaceable() )
126  return false;
127 
128  if( !( flags & wxFR_MATCHCASE ) )
129  {
130  text.MakeUpper();
131  searchText.MakeUpper();
132  }
133 
134  if( flags & wxFR_WHOLEWORD )
135  {
136  int ii = 0;
137 
138  while( ii < (int) text.length() )
139  {
140  int next = text.find( searchText, ii );
141 
142  if( next == wxNOT_FOUND )
143  return false;
144 
145  ii = next;
146  next += searchText.length();
147 
148  bool startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
149  bool endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
150 
151  if( startOK && endOK )
152  return true;
153  else
154  ii++;
155  }
156 
157  return false;
158  }
159  else if( flags & FR_MATCH_WILDCARD )
160  {
161  return text.Matches( searchText );
162  }
163  else
164  {
165  return text.Find( searchText ) != wxNOT_FOUND;
166  }
167 }
CITER next(CITER it)
Definition: ptree.cpp:126
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:402

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

◆ MergePrimitivesAsPolygon()

void PAD::MergePrimitivesAsPolygon ( SHAPE_POLY_SET aMergedPolygon,
ERROR_LOC  aErrorLoc = ERROR_INSIDE 
) const

Merge all basic shapes to a SHAPE_POLY_SET.

Note
The results are relative to the pad position, orientation 0.
Parameters
aMergedPolygonwill store the final polygon
aErrorLocis used when a circle (or arc) is approximated by segments = ERROR_INSIDE to build a polygon inside the arc/circle (usual shape to raw/plot) = ERROR_OUIDE to build a polygon outside the arc/circle (for instance when building a clearance area)

Definition at line 212 of file pad_custom_shape_functions.cpp.

213 {
214  const BOARD* board = GetBoard();
215  int maxError = board ? board->GetDesignSettings().m_MaxError : ARC_HIGH_DEF;
216 
217  aMergedPolygon->RemoveAllContours();
218 
219  // Add the anchor pad shape in aMergedPolygon, others in aux_polyset:
220  // The anchor pad is always at 0,0
221  switch( GetAnchorPadShape() )
222  {
223  case PAD_SHAPE::RECT:
224  {
225  SHAPE_RECT rect( -GetSize().x / 2, -GetSize().y / 2, GetSize().x, GetSize().y );
226  aMergedPolygon->AddOutline( rect.Outline() );
227  }
228  break;
229 
230  default:
231  case PAD_SHAPE::CIRCLE:
232  TransformCircleToPolygon( *aMergedPolygon, wxPoint( 0, 0 ), GetSize().x / 2, maxError,
233  aErrorLoc );
234  break;
235  }
236 
237  addPadPrimitivesToPolygon( aMergedPolygon, maxError, aErrorLoc );
238 }
void addPadPrimitivesToPolygon(SHAPE_POLY_SET *aMergedPolygon, int aError, ERROR_LOC aErrorLoc) const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
const wxSize & GetSize() const
Definition: pad.h:233
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aCornerBuffer, const wxPoint &aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a circle to a polygon, using multiple straight lines.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
PAD_SHAPE GetAnchorPadShape() const
Definition: pad.h:183

References SHAPE_POLY_SET::AddOutline(), addPadPrimitivesToPolygon(), CIRCLE, GetAnchorPadShape(), BOARD_ITEM::GetBoard(), BOARD::GetDesignSettings(), GetSize(), BOARD_DESIGN_SETTINGS::m_MaxError, SHAPE_RECT::Outline(), RECT, SHAPE_POLY_SET::RemoveAllContours(), and TransformCircleToPolygon().

Referenced by FABMASTER::loadFootprints(), DSN::SPECCTRA_DB::makePADSTACK(), DIALOG_PAD_PROPERTIES::padValuesOK(), and TransformShapeWithClearanceToPolygon().

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 238 of file board_item.h.

239  {
240  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
241  }
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:233

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

◆ Move() [2/2]

void PAD::Move ( const wxPoint &  aMoveVector)
inlineoverridevirtual

Move this object.

Parameters
aMoveVectorthe move vector for this object.

Reimplemented from BOARD_ITEM.

Definition at line 618 of file pad.h.

619  {
620  m_pos += aMoveVector;
621  SetLocalCoord();
622  SetDirty();
623  }
wxPoint m_pos
Definition: pad.h:682
void SetLocalCoord()
< Set relative coordinates.
Definition: pad.cpp:596
void SetDirty()
Definition: pad.h:361

References m_pos, SetDirty(), 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 234 of file