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 std::vector< KICAD_T > &aScanTypes) const override
 Check whether the item is one of the listed types. More...
 
bool HasHole () const override
 
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 *aOther) const
 Before we had custom pad shapes it was common to have multiple overlapping pads to represent a more complex shape. More...
 
bool SharesNetTieGroup (const PAD *aOther) const
 
bool IsNoConnectPad () const
 
bool IsFreePad () const
 
void SetShape (PAD_SHAPE aShape)
 Set the new shape of this pad. More...
 
PAD_SHAPE GetShape () const
 
void SetPosition (const VECTOR2I &aPos) override
 
VECTOR2I 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 VECTOR2I &aPos)
 
const VECTOR2IGetPos0 () const
 
void SetY0 (int y)
 
void SetX0 (int x)
 
void SetSize (const VECTOR2I &aSize)
 
const VECTOR2IGetSize () const
 
void SetSizeX (const int aX)
 
int GetSizeX () const
 
void SetSizeY (const int aY)
 
int GetSizeY () const
 
void SetDelta (const VECTOR2I &aSize)
 
const VECTOR2IGetDelta () const
 
void SetDrillSize (const VECTOR2I &aSize)
 
const VECTOR2IGetDrillSize () const
 
void SetDrillSizeX (const int aX)
 
int GetDrillSizeX () const
 
void SetDrillSizeY (const int aY)
 
int GetDrillSizeY () const
 
void SetOffset (const VECTOR2I &aOffset)
 
const VECTOR2IGetOffset () const
 
VECTOR2I 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< VECTOR2I > &aPoly, int aThickness, bool aFilled)
 
void AddPrimitiveSegment (const VECTOR2I &aStart, const VECTOR2I &aEnd, int aThickness)
 
void AddPrimitiveCircle (const VECTOR2I &aCenter, int aRadius, int aThickness, bool aFilled)
 
void AddPrimitiveRect (const VECTOR2I &aStart, const VECTOR2I &aEnd, int aThickness, bool aFilled)
 
void AddPrimitiveArc (const VECTOR2I &aCenter, const VECTOR2I &aStart, const EDA_ANGLE &aArcAngle, int aThickness)
 
void AddPrimitiveCurve (const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCtrl1, const VECTOR2I &aCtrl2, int aThickness)
 
void AddPrimitiveAnnotationBox (const VECTOR2I &aStart, const VECTOR2I &aEnd)
 Has meaning only for custom shape pads. More...
 
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 VECTOR2I &VECTOR2I, 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 (const EDA_ANGLE &aAngle)
 Set the rotation angle of the pad. More...
 
EDA_ANGLE GetOrientation () const
 Return the rotation angle of the pad. More...
 
void SetOrientationDegrees (double aOrientation)
 
double GetOrientationDegrees () 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)
 
int GetOwnClearance (PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const override
 Return an item's "own" clearance in internal units. More...
 
void TransformShapeToPolygon (SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
 Convert the pad shape to a closed polygon. More...
 
bool TransformHoleToPolygon (SHAPE_POLY_SET &aBuffer, int aClearance, 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 flashPTHPads=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
 
std::shared_ptr< SHAPE_SEGMENTGetEffectiveHoleShape () const override
 Return a SHAPE_SEGMENT 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 GetSolderMaskExpansion () const
 
VECTOR2I 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 GetLocalZoneConnectionOverride (wxString *aSource=nullptr) const
 
void SetThermalSpokeWidth (int aWidth)
 Set the width of the thermal spokes connecting the pad to a zone. More...
 
int GetThermalSpokeWidth () const
 
int GetLocalSpokeWidthOverride (wxString *aSource=nullptr) const
 
void SetThermalSpokeAngle (const EDA_ANGLE &aAngle)
 The orientation of the thermal spokes. More...
 
EDA_ANGLE GetThermalSpokeAngle () const
 
void SetThermalSpokeAngleDegrees (double aAngle)
 
double GetThermalSpokeAngleDegrees () const
 
void SetThermalGap (int aGap)
 
int GetThermalGap () const
 
int GetLocalThermalGapOverride (wxString *aSource=nullptr) const
 
void SetRoundRectCornerRadius (double aRadius)
 Has meaning only for rounded rectangle pads. More...
 
int GetRoundRectCornerRadius () const
 
VECTOR2I 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
 
bool ConditionallyFlashed (PCB_LAYER_ID aLayer) 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, bool aOnlyCheckIfPermitted=false) const
 Check to see whether the pad should be flashed on the specific layer. More...
 
bool CanFlashLayer (int aLayer)
 
PCB_LAYER_ID GetLayer () const override
 Return the primary layer this item is on. More...
 
PCB_LAYER_ID GetPrincipalLayer () const
 
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 VECTOR2I &aPosition, int aAccuracy=0) const override
 Test if aPosition is inside or on the boundary of this item. More...
 
bool HitTest (const BOX2I &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 BOX2I 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 VECTOR2I &aMoveVector) override
 Move this object. More...
 
void Rotate (const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
 Rotate this object. More...
 
wxString GetItemDescription (UNITS_PROVIDER *aUnitsProvider) const override
 Return a user-visible description string of this item. 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...
 
void ClearZoneConnectionCache ()
 
const ZONE_LAYER_CONNECTIONZoneConnectionCache (PCB_LAYER_ID aLayer) const
 
void SetZoneConnectionCache (PCB_LAYER_ID aLayer, ZONE_LAYER_CONNECTION aConnection)
 
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
 
wxString GetUnescapedShortNetname () const
 
virtual NETCLASSGetEffectiveNetClass () const
 Return the NETCLASS for this item. More...
 
wxString GetNetClassName () const
 Returns the name of the effective netclass. More...
 
void SetLocalRatsnestVisible (bool aVisible)
 
bool GetLocalRatsnestVisible () const
 
void SetParentGroup (PCB_GROUP *aGroup)
 
PCB_GROUPGetParentGroup () const
 
int GetX () const
 
int GetY () const
 
virtual bool IsTented () const
 
BOARD_ITEM_CONTAINERGetParentFootprint () const
 
virtual bool HasLineStroke () const
 Check if this item has line stoke properties. More...
 
virtual STROKE_PARAMS GetStroke () const
 
virtual void SetStroke (const STROKE_PARAMS &aStroke)
 
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...
 
void SwapItemData (BOARD_ITEM *aImage)
 Swap data between aItem and aImage. More...
 
virtual bool IsKnockout () const
 
virtual void SetIsKnockout (bool aKnockout)
 
virtual void SetLocked (bool aLocked)
 
void DeleteStructure ()
 Delete this object after removing from its parent if it has one. More...
 
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 IsSelected () const
 
bool IsEntered () const
 
bool IsBrightened () const
 
bool IsRollover () const
 
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 XorFlags (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 ()
 
virtual bool RenderAsBitmap (double aWorldScale) const
 
void SetIsShownAsBitmap (bool aBitmap)
 
bool IsShownAsBitmap () const
 
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 wxString GetFriendlyName () const
 
virtual const VECTOR2I GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual VECTOR2I GetSortPosition () const
 Return the coordinates that should be used for sorting this element visually compared to other elements. More...
 
virtual INSPECT_RESULT Visit (INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
wxString GetTypeDesc () const
 Return a translated description of the type for this EDA_ITEM for display in user facing messages. More...
 
virtual bool Matches (const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const EDA_SEARCH_DATA &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) const
 
template<typename T >
Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
std::optional< T > Get (const wxString &aProperty) const
 

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 INSPECT_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static INSPECT_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const EDA_SEARCH_DATA &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 VECTOR2I ZeroOffset
 A value of wxPoint(0,0) which can be passed to the Draw() functions. More...
 

Protected Member Functions

virtual void swapData (BOARD_ITEM *aImage) override
 
virtual wxString layerMaskDescribe () const
 Return a string (to be shown to the user) describing a layer mask. More...
 
bool Matches (const wxString &aText, const EDA_SEARCH_DATA &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
 
bool m_isKnockout
 
bool m_isLocked
 
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
 
VECTOR2I m_pos
 
PAD_SHAPE m_padShape
 
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
 
bool m_shapesDirty
 
std::mutex m_shapesBuildingLock
 
BOX2I 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
 
VECTOR2I m_drill
 
VECTOR2I m_size
 
PAD_DRILL_SHAPE_T m_drillShape
 
double m_roundedCornerScale
 
double m_chamferScale
 
int m_chamferPositions
 
PAD_SHAPE m_anchorPadShape
 
VECTOR2I m_offset
 
LSET m_layerMask
 
VECTOR2I m_deltaSize
 
VECTOR2I m_pos0
 
PAD_ATTRIB m_attribute
 
PAD_PROP m_property
 
EDA_ANGLE 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_thermalSpokeWidth
 
EDA_ANGLE m_thermalSpokeAngle
 
int m_thermalGap
 
std::mutex m_zoneLayerConnectionsMutex
 
ZONE_LAYER_CONNECTION m_zoneLayerConnections [B_Cu+1]
 
bool m_localRatsnestVisible
 
KICAD_T m_structType
 Run time identification, keep private so it can never be changed after a ctor sets it. More...
 
VIEW_ITEM_DATA * m_viewPrivData
 

Detailed Description

Definition at line 58 of file pad.h.

Constructor & Destructor Documentation

◆ PAD() [1/2]

PAD::PAD ( FOOTPRINT parent)

Definition at line 62 of file pad.cpp.

62 :
64{
65 m_size.x = m_size.y = EDA_UNIT_UTILS::Mils2IU( pcbIUScale, 60 ); // Default pad size 60 mils.
66 m_drill.x = m_drill.y = EDA_UNIT_UTILS::Mils2IU( pcbIUScale, 30 ); // Default drill size 30 mils.
69
72
73 SetShape( PAD_SHAPE::CIRCLE ); // Default pad shape is PAD_CIRCLE.
74 SetAnchorPadShape( PAD_SHAPE::CIRCLE ); // Default shape for custom shaped pads
75 // is PAD_CIRCLE.
76 SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); // Default pad drill shape is a circle.
77 m_attribute = PAD_ATTRIB::PTH; // Default pad type is plated through hole
78 SetProperty( PAD_PROP::NONE ); // no special fabrication property
83
84 // Parameters for round rect only:
85 m_roundedCornerScale = 0.25; // from IPC-7351C standard
86
87 // Parameters for chamfered rect only:
88 m_chamferScale = 0.2; // Size of chamfer: ratio of smallest of X,Y size
89 m_chamferPositions = RECT_NO_CHAMFER; // No chamfered corner
90
91 m_zoneConnection = ZONE_CONNECTION::INHERITED; // Use parent setting by default
92 m_thermalSpokeWidth = 0; // Use parent setting by default
93 m_thermalSpokeAngle = ANGLE_45; // Default for circular pads
94 m_thermalGap = 0; // Use parent setting by default
95
97
98 // Set layers mask to default for a standard thru hole pad.
100
101 SetSubRatsnest( 0 ); // used in ratsnest calculations
102
103 SetDirty();
107
108 for( size_t ii = 0; ii < arrayDim( m_zoneLayerConnections ); ++ii )
110}
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
@ ZLC_UNCONNECTED
Definition: board_item.h:48
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:496
VECTOR2I GetPosition() const override
Definition: footprint.h:188
int m_localClearance
Definition: pad.h:865
int m_localSolderMaskMargin
Definition: pad.h:866
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: pad.h:803
VECTOR2I m_size
Definition: pad.h:809
double m_localSolderPasteMarginRatio
Definition: pad.h:868
VECTOR2I m_drill
Definition: pad.h:808
int m_chamferPositions
Definition: pad.h:817
static LSET PTHMask()
layer set for a through hole pad
Definition: pad.cpp:196
double m_roundedCornerScale
Definition: pad.h:813
EDA_ANGLE m_orient
Definition: pad.h:845
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
Definition: pad.h:382
void SetProperty(PAD_PROP aProperty)
Definition: pad.cpp:701
PAD_ATTRIB m_attribute
Definition: pad.h:841
void SetDirty()
Definition: pad.h:390
ZONE_LAYER_CONNECTION m_zoneLayerConnections[B_Cu+1]
Definition: pad.h:878
int m_localSolderPasteMargin
Definition: pad.h:867
int m_effectiveBoundingRadius
Definition: pad.h:796
LSET m_layerMask
Definition: pad.h:831
int m_thermalGap
Definition: pad.h:875
FOOTPRINT * GetParent() const
Definition: pad.cpp:1486
ZONE_CONNECTION m_zoneConnection
Definition: pad.h:871
int m_thermalSpokeWidth
Definition: pad.h:872
VECTOR2I m_pos
Definition: pad.h:775
double m_chamferScale
Definition: pad.h:815
void SetShape(PAD_SHAPE aShape)
Set the new shape of this pad.
Definition: pad.h:185
void SetAnchorPadShape(PAD_SHAPE aShape)
Set the shape of the anchor pad for custom shaped pads.
Definition: pad.h:233
bool m_removeUnconnectedLayer
< If true, the pad copper is removed for layers that are not connected.
Definition: pad.h:850
bool m_keepTopBottomLayer
Definition: pad.h:853
int m_lengthPadToDie
Definition: pad.h:847
EDA_ANGLE m_thermalSpokeAngle
Definition: pad.h:873
void SetSubRatsnest(int aSubRatsnest)
Definition: pad.h:600
static constexpr EDA_ANGLE & ANGLE_45
Definition: eda_angle.h:413
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:412
constexpr int Mils2IU(const EDA_IU_SCALE &aIuScale, int mils)
Definition: eda_units.h:123
@ CUST_PAD_SHAPE_IN_ZONE_OUTLINE
Definition: pad.h:44
@ PTH
Plated through hole pad.
@ PAD_DRILL_SHAPE_CIRCLE
Definition: pad_shapes.h:70
@ NONE
no special fabrication property
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87

References ANGLE_0, ANGLE_45, arrayDim(), 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_thermalSpokeAngle, m_thermalSpokeWidth, m_zoneConnection, m_zoneLayerConnections, EDA_UNIT_UTILS::Mils2IU(), NONE, PAD_DRILL_SHAPE_CIRCLE, PCB_FOOTPRINT_T, pcbIUScale, PTH, PTHMask(), RECT_NO_CHAMFER, SetAnchorPadShape(), SetDirty(), SetDrillShape(), SetProperty(), SetShape(), SetSubRatsnest(), EDA_ITEM::Type(), VECTOR2< T >::x, VECTOR2< T >::y, and ZLC_UNCONNECTED.

Referenced by Clone().

◆ PAD() [2/2]

PAD::PAD ( const PAD aPad)

Definition at line 113 of file pad.cpp.

113 :
114 BOARD_CONNECTED_ITEM( aOther.GetParent(), PCB_PAD_T )
115{
116 PAD::operator=( aOther );
117
118 const_cast<KIID&>( m_Uuid ) = aOther.m_Uuid;
119}
const KIID m_Uuid
Definition: eda_item.h:492
Definition: kiid.h:48
PAD & operator=(const PAD &aOther)
Definition: pad.cpp:122

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

207{
208 SHAPE_POLY_SET polyset;
209
210 for( const std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
211 {
212 if( !primitive->IsAnnotationProxy() )
213 primitive->TransformShapeToPolygon( polyset, UNDEFINED_LAYER, 0, aError, aErrorLoc );
214 }
215
217
218 // Merge all polygons with the initial pad anchor shape
219 if( polyset.OutlineCount() )
220 {
221 aMergedPolygon->BooleanAdd( polyset, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
223 }
224}
std::vector< std::shared_ptr< PCB_SHAPE > > m_editPrimitives
Definition: pad.h:784
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.
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
void Simplify(POLYGON_MODE aFastMode)
int OutlineCount() const
Return the number of vertices in a given outline/hole.
@ UNDEFINED_LAYER
Definition: layer_ids.h:60

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

188{
189 aPrimitive->SetParent( this );
190 m_editPrimitives.emplace_back( aPrimitive );
191
192 SetDirty();
193}
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100

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

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

◆ AddPrimitiveAnnotationBox()

void PAD::AddPrimitiveAnnotationBox ( const VECTOR2I aStart,
const VECTOR2I aEnd 
)

Has meaning only for custom shape pads.

Allows one to specify the box in which to place the pad number and/or net name (if they are being displayed).

Definition at line 150 of file pad_custom_shape_functions.cpp.

151{
152 PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::RECT );
153 item->SetIsAnnotationProxy();
154 item->SetFilled( false );
155 item->SetStart( aStart );
156 item->SetEnd( aEnd );
158 item->SetParent( this );
159 m_editPrimitives.emplace_back( item );
160 SetDirty();
161}
void SetFilled(bool aFlag)
Definition: eda_shape.h:95
void SetStart(const VECTOR2I &aStart)
Definition: eda_shape.h:124
void SetEnd(const VECTOR2I &aEnd)
Definition: eda_shape.h:149
void SetIsAnnotationProxy(bool aIsProxy=true)
Definition: eda_shape.h:88
void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: pcb_shape.h:72
Simple container to manage line stroke parameters.
Definition: stroke_params.h:88

References m_editPrimitives, RECT, SetDirty(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetFilled(), EDA_SHAPE::SetIsAnnotationProxy(), EDA_ITEM::SetParent(), EDA_SHAPE::SetStart(), PCB_SHAPE::SetStroke(), and SOLID.

◆ AddPrimitiveArc()

void PAD::AddPrimitiveArc ( const VECTOR2I aCenter,
const VECTOR2I aStart,
const EDA_ANGLE 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->SetStroke( STROKE_PARAMS( aThickness, PLOT_DASH_TYPE::SOLID ) );
101 item->SetParent( this );
102 m_editPrimitives.emplace_back( item );
103 SetDirty();
104}
void SetCenter(const VECTOR2I &aCenter)
Definition: eda_shape.cpp:470
void SetArcAngleAndEnd(const EDA_ANGLE &aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
Definition: eda_shape.cpp:596

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

◆ AddPrimitiveCircle()

void PAD::AddPrimitiveCircle ( const VECTOR2I 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->SetStroke( STROKE_PARAMS( aThickness, PLOT_DASH_TYPE::SOLID ) );
130 item->SetParent( this );
131 m_editPrimitives.emplace_back( item );
132 SetDirty();
133}

References CIRCLE, m_editPrimitives, SetDirty(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetFilled(), EDA_ITEM::SetParent(), EDA_SHAPE::SetStart(), PCB_SHAPE::SetStroke(), SOLID, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ AddPrimitiveCurve()

void PAD::AddPrimitiveCurve ( const VECTOR2I aStart,
const VECTOR2I aEnd,
const VECTOR2I aCtrl1,
const VECTOR2I 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->SetStroke( STROKE_PARAMS( aThickness, PLOT_DASH_TYPE::SOLID ) );
117 item->SetParent( this );
118 m_editPrimitives.emplace_back( item );
119 SetDirty();
120}
void SetBezierC2(const VECTOR2I &aPt)
Definition: eda_shape.h:178
void SetBezierC1(const VECTOR2I &aPt)
Definition: eda_shape.h:175

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

◆ 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->SetStroke( STROKE_PARAMS( aThickness, PLOT_DASH_TYPE::SOLID ) );
59 item->SetParent( this );
60 m_editPrimitives.emplace_back( item );
61 }
62
63 SetDirty();
64}
void SetPolyShape(const SHAPE_POLY_SET &aShape)
Definition: eda_shape.h:255
void SetShape(SHAPE_T aShape)
Definition: eda_shape.h:112
bool HasHoles() const
Return true if the polygon set has any holes that share a vertex.
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...
const SHAPE_LINE_CHAIN & COutline(int aIndex) const

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, SetDirty(), EDA_SHAPE::SetFilled(), EDA_ITEM::SetParent(), EDA_SHAPE::SetPolyShape(), EDA_SHAPE::SetShape(), PCB_SHAPE::SetStroke(), and SOLID.

◆ AddPrimitivePoly() [2/2]

void PAD::AddPrimitivePoly ( const std::vector< VECTOR2I > &  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->SetStroke( STROKE_PARAMS( aThickness, PLOT_DASH_TYPE::SOLID ) );
73 item->SetParent( this );
74 m_editPrimitives.emplace_back( item );
75 SetDirty();
76}
void SetPolyPoints(const std::vector< VECTOR2I > &aPoints)
Definition: eda_shape.cpp:1121

References m_editPrimitives, POLY, SetDirty(), EDA_SHAPE::SetFilled(), EDA_ITEM::SetParent(), EDA_SHAPE::SetPolyPoints(), PCB_SHAPE::SetStroke(), and SOLID.

◆ AddPrimitiveRect()

void PAD::AddPrimitiveRect ( const VECTOR2I aStart,
const VECTOR2I 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->SetStroke( STROKE_PARAMS( aThickness, PLOT_DASH_TYPE::SOLID ) );
144 item->SetParent( this );
145 m_editPrimitives.emplace_back( item );
146 SetDirty();
147}

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

◆ AddPrimitiveSegment()

void PAD::AddPrimitiveSegment ( const VECTOR2I aStart,
const VECTOR2I 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->SetStroke( STROKE_PARAMS( aThickness, PLOT_DASH_TYPE::SOLID ) );
86 item->SetParent( this );
87 m_editPrimitives.emplace_back( item );
88 SetDirty();
89}

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

◆ ApertureMask()

LSET PAD::ApertureMask ( )
static

layer set for an aperture pad

Definition at line 224 of file pad.cpp.

225{
226 static LSET saved( 1, F_Paste );
227 return saved;
228}
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
@ F_Paste
Definition: layer_ids.h:101

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

178{
179 // Add duplicates of aPrimitivesList to the pad primitives list:
180 for( const std::shared_ptr<PCB_SHAPE>& prim : aPrimitivesList )
181 AddPrimitive( new PCB_SHAPE( *prim ) );
182
183 SetDirty();
184}
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 612 of file pad.cpp.

613{
614 std::lock_guard<std::mutex> RAII_lock( m_polyBuildingLock );
615
616 // If we had to wait for the lock then we were probably waiting for someone else to
617 // finish rebuilding the shapes. So check to see if they're clean now.
618 if( !m_polyDirty )
619 return;
620
621 const BOARD* board = GetBoard();
622 int maxError = board ? board->GetDesignSettings().m_MaxError : ARC_HIGH_DEF;
623
624 // Polygon
625 m_effectivePolygon = std::make_shared<SHAPE_POLY_SET>();
627
628 // Bounding radius
629 //
630 // PADSTACKS TODO: these will both need to cycle through all layers to get the largest
631 // values....
633
634 for( int cnt = 0; cnt < m_effectivePolygon->OutlineCount(); ++cnt )
635 {
636 const SHAPE_LINE_CHAIN& poly = m_effectivePolygon->COutline( cnt );
637
638 for( int ii = 0; ii < poly.PointCount(); ++ii )
639 {
640 int dist = KiROUND( ( poly.CPoint( ii ) - m_pos ).EuclideanNorm() );
642 }
643 }
644
645 // All done
646 m_polyDirty = false;
647}
constexpr int ARC_HIGH_DEF
Definition: base_units.h:121
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:43
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:682
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
Definition: pad.cpp:1601
std::mutex m_polyBuildingLock
Definition: pad.h:794
bool m_polyDirty
Definition: pad.h:793
std::shared_ptr< SHAPE_POLY_SET > m_effectivePolygon
Definition: pad.h:795
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
@ ERROR_INSIDE
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:85

References ARC_HIGH_DEF, SHAPE_LINE_CHAIN::CPoint(), ERROR_INSIDE, 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(), TransformShapeToPolygon(), 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 440 of file pad.cpp.

441{
442 std::lock_guard<std::mutex> RAII_lock( m_shapesBuildingLock );
443
444 // If we had to wait for the lock then we were probably waiting for someone else to
445 // finish rebuilding the shapes. So check to see if they're clean now.
446 if( !m_shapesDirty )
447 return;
448
449 const BOARD* board = GetBoard();
450 int maxError = board ? board->GetDesignSettings().m_MaxError : ARC_HIGH_DEF;
451
452 m_effectiveShape = std::make_shared<SHAPE_COMPOUND>();
453 m_effectiveHoleShape = nullptr;
454
455 auto add = [this]( SHAPE* aShape )
456 {
457 m_effectiveShape->AddShape( aShape );
458 };
459
460 VECTOR2I shapePos = ShapePos(); // Fetch only once; rotation involves trig
461 PAD_SHAPE effectiveShape = GetShape();
462
463 if( GetShape() == PAD_SHAPE::CUSTOM )
464 effectiveShape = GetAnchorPadShape();
465
466 switch( effectiveShape )
467 {
469 add( new SHAPE_CIRCLE( shapePos, m_size.x / 2 ) );
470 break;
471
472 case PAD_SHAPE::OVAL:
473 if( m_size.x == m_size.y ) // the oval pad is in fact a circle
474 {
475 add( new SHAPE_CIRCLE( shapePos, m_size.x / 2 ) );
476 }
477 else
478 {
479 VECTOR2I half_size = m_size / 2;
480 int half_width = std::min( half_size.x, half_size.y );
481 VECTOR2I half_len( half_size.x - half_width, half_size.y - half_width );
482 RotatePoint( half_len, m_orient );
483 add( new SHAPE_SEGMENT( shapePos - half_len, shapePos + half_len, half_width * 2 ) );
484 }
485
486 break;
487
488 case PAD_SHAPE::RECT:
491 {
492 int r = ( effectiveShape == PAD_SHAPE::ROUNDRECT ) ? GetRoundRectCornerRadius() : 0;
493 VECTOR2I half_size( m_size.x / 2, m_size.y / 2 );
494 VECTOR2I trap_delta( 0, 0 );
495
496 if( r )
497 {
498 half_size -= VECTOR2I( r, r );
499
500 // Avoid degenerated shapes (0 length segments) that always create issues
501 // For roundrect pad very near a circle, use only a circle
502 const int min_len = pcbIUScale.mmToIU( 0.0001);
503
504 if( half_size.x < min_len && half_size.y < min_len )
505 {
506 add( new SHAPE_CIRCLE( shapePos, r ) );
507 break;
508 }
509 }
510 else if( effectiveShape == PAD_SHAPE::TRAPEZOID )
511 {
512 trap_delta = m_deltaSize / 2;
513 }
514
515 SHAPE_LINE_CHAIN corners;
516
517 corners.Append( -half_size.x - trap_delta.y, half_size.y + trap_delta.x );
518 corners.Append( half_size.x + trap_delta.y, half_size.y - trap_delta.x );
519 corners.Append( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
520 corners.Append( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
521
522 corners.Rotate( m_orient );
523 corners.Move( shapePos );
524
525 // GAL renders rectangles faster than 4-point polygons so it's worth checking if our
526 // body shape is a rectangle.
527 if( corners.PointCount() == 4
528 &&
529 ( ( corners.CPoint( 0 ).y == corners.CPoint( 1 ).y
530 && corners.CPoint( 1 ).x == corners.CPoint( 2 ).x
531 && corners.CPoint( 2 ).y == corners.CPoint( 3 ).y
532 && corners.CPoint( 3 ).x == corners.CPoint( 0 ).x )
533 ||
534 ( corners.CPoint( 0 ).x == corners.CPoint( 1 ).x
535 && corners.CPoint( 1 ).y == corners.CPoint( 2 ).y
536 && corners.CPoint( 2 ).x == corners.CPoint( 3 ).x
537 && corners.CPoint( 3 ).y == corners.CPoint( 0 ).y )
538 )
539 )
540 {
541 int width = std::abs( corners.CPoint( 2 ).x - corners.CPoint( 0 ).x );
542 int height = std::abs( corners.CPoint( 2 ).y - corners.CPoint( 0 ).y );
543 VECTOR2I pos( std::min( corners.CPoint( 2 ).x, corners.CPoint( 0 ).x ),
544 std::min( corners.CPoint( 2 ).y, corners.CPoint( 0 ).y ) );
545
546 add( new SHAPE_RECT( pos, width, height ) );
547 }
548 else
549 {
550 add( new SHAPE_SIMPLE( corners ) );
551 }
552
553 if( r )
554 {
555 add( new SHAPE_SEGMENT( corners.CPoint( 0 ), corners.CPoint( 1 ), r * 2 ) );
556 add( new SHAPE_SEGMENT( corners.CPoint( 1 ), corners.CPoint( 2 ), r * 2 ) );
557 add( new SHAPE_SEGMENT( corners.CPoint( 2 ), corners.CPoint( 3 ), r * 2 ) );
558 add( new SHAPE_SEGMENT( corners.CPoint( 3 ), corners.CPoint( 0 ), r * 2 ) );
559 }
560 }
561 break;
562
564 {
565 SHAPE_POLY_SET outline;
566
569 GetChamferPositions(), 0, maxError, ERROR_INSIDE );
570
571 add( new SHAPE_SIMPLE( outline.COutline( 0 ) ) );
572 }
573 break;
574
575 default:
576 wxFAIL_MSG( wxT( "PAD::buildEffectiveShapes: Unsupported pad shape: " )
577 + PAD_SHAPE_T_asString( effectiveShape ) );
578 break;
579 }
580
581 if( GetShape() == PAD_SHAPE::CUSTOM )
582 {
583 for( const std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
584 {
585 for( SHAPE* shape : primitive->MakeEffectiveShapes() )
586 {
587 shape->Rotate( m_orient );
588 shape->Move( shapePos );
589 add( shape );
590 }
591 }
592 }
593
595
596 // Hole shape
597 VECTOR2I half_size = m_drill / 2;
598 int half_width = std::min( half_size.x, half_size.y );
599 VECTOR2I half_len( half_size.x - half_width, half_size.y - half_width );
600
601 RotatePoint( half_len, m_orient );
602
603 m_effectiveHoleShape = std::make_shared<SHAPE_SEGMENT>( m_pos - half_len, m_pos + half_len,
604 half_width * 2 );
606
607 // All done
608 m_shapesDirty = false;
609}
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:588
VECTOR2I m_deltaSize
Definition: pad.h:834
std::mutex m_shapesBuildingLock
Definition: pad.h:788
int GetRoundRectCornerRadius() const
Definition: pad.cpp:345
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: pad.h:791
VECTOR2I ShapePos() const
Definition: pad.cpp:785
PAD_SHAPE GetShape() const
Definition: pad.h:194
bool m_shapesDirty
Definition: pad.h:787
int GetChamferPositions() const
Definition: pad.h:594
const VECTOR2I & GetSize() const
Definition: pad.h:257
std::shared_ptr< SHAPE_COMPOUND > m_effectiveShape
Definition: pad.h:790
PAD_SHAPE GetAnchorPadShape() const
Definition: pad.h:207
double GetChamferRectRatio() const
Definition: pad.h:584
BOX2I m_effectiveBoundingBox
Definition: pad.h:789
void Move(const VECTOR2I &aVector) override
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
Definition: shape_simple.h:42
An abstract shape on 2D plane.
Definition: shape.h:123
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aPosition, const VECTOR2I &aSize, const EDA_ANGLE &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.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:401
static std::string PAD_SHAPE_T_asString(PAD_SHAPE a)
Definition: pad_shapes.h:48
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
Definition: pad_shapes.h:35
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

References std::abs(), SHAPE_LINE_CHAIN::Append(), ARC_HIGH_DEF, CHAMFERED_RECT, CIRCLE, SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), CUSTOM, ERROR_INSIDE, GetAnchorPadShape(), BOARD_ITEM::GetBoard(), GetChamferPositions(), GetChamferRectRatio(), BOARD::GetDesignSettings(), GetRoundRectCornerRadius(), GetShape(), GetSize(), 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, BOX2< Vec >::Merge(), EDA_IU_SCALE::mmToIU(), SHAPE_LINE_CHAIN::Move(), OVAL, PAD_SHAPE_T_asString(), pcbIUScale, SHAPE_LINE_CHAIN::PointCount(), RECT, SHAPE_LINE_CHAIN::Rotate(), RotatePoint(), ROUNDRECT, ShapePos(), TransformRoundChamferedRectToPolygon(), TRAPEZOID, VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ CanFlashLayer()

bool PAD::CanFlashLayer ( int  aLayer)
inline

Definition at line 645 of file pad.h.

646 {
647 return FlashLayer( aLayer, true );
648 }
bool FlashLayer(int aLayer, bool aOnlyCheckIfPermitted=false) const
Check to see whether the pad should be flashed on the specific layer.
Definition: pad.cpp:267

References FlashLayer().

◆ 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 142 of file pad.cpp.

143{
144 // Aperture pads don't get a number
145 if( IsAperturePad() )
146 return false;
147
148 // NPTH pads don't get numbers
150 return false;
151
152 return true;
153}
bool IsAperturePad() const
Definition: pad.h:407
PAD_ATTRIB GetAttribute() const
Definition: pad.h:400
@ NPTH
like PAD_PTH, but not plated

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

◆ ClassOf()

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

Definition at line 80 of file pad.h.

81 {
82 return aItem && PCB_PAD_T == aItem->Type();
83 }

References PCB_PAD_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 119 of file eda_item.h.

void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:141
#define BRIGHTENED
item is drawn with a bright contour

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by SCH_EDIT_FRAME::FocusOnItem(), PCB_BASE_FRAME::FocusOnItems(), EE_SELECTION_TOOL::unhighlight(), PL_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 141 of file eda_item.h.

141{ m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:498

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), SCH_EDIT_TOOL::BreakWire(), FOOTPRINT::BuildCourtyardCaches(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), 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(), PCB_TOOL_BASE::doInteractiveItemPlacement(), KIGFX::SCH_PAINTER::draw(), SCH_ITEM::Duplicate(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::Init(), EE_COLLECTOR::Inspect(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), DIALOG_SYMBOL_PROPERTIES::OnUnitChoice(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), DRC_TEST_PROVIDER_DISALLOW::Run(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetIsShownAsBitmap(), BOARD_COMMIT::Stage(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and EE_SELECTION_TOOL::unhighlight().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 153 of file eda_item.h.

154 {
156 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define CANDIDATE
flag indicating that the structure is connected

References CANDIDATE, EDA_ITEM::ClearFlags(), IS_LINKED, SELECTED_BY_DRAG, and SKIP_STRUCT.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles(), and 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().

◆ ClearZoneConnectionCache()

void PAD::ClearZoneConnectionCache ( )
inline

Definition at line 742 of file pad.h.

743 {
744 for( size_t ii = 0; ii < arrayDim( m_zoneLayerConnections ); ++ii )
746 }
@ ZLC_UNRESOLVED
Definition: board_item.h:46

References arrayDim(), m_zoneLayerConnections, and ZLC_UNRESOLVED.

◆ 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 1310 of file pad.cpp.

1311{
1312 return new PAD( *this );
1313}
PAD(FOOTPRINT *parent)
Definition: pad.cpp:62

References PAD().

Referenced by ClonePad().

◆ 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 724 of file pad.h.

725 {
726 return (PAD*) Clone();
727 }
Definition: pad.h:59
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pad.cpp:1310

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

1140{
1141 int diff;
1142
1143 if( ( diff = static_cast<int>( aPadRef->GetShape() ) -
1144 static_cast<int>( aPadCmp->GetShape() ) ) != 0 )
1145 return diff;
1146
1147 if( ( diff = static_cast<int>( aPadRef->m_attribute ) -
1148 static_cast<int>( aPadCmp->m_attribute ) ) != 0 )
1149 return diff;
1150
1151 if( ( diff = aPadRef->m_drillShape - aPadCmp->m_drillShape ) != 0 )
1152 return diff;
1153
1154 if( ( diff = aPadRef->m_drill.x - aPadCmp->m_drill.x ) != 0 )
1155 return diff;
1156
1157 if( ( diff = aPadRef->m_drill.y - aPadCmp->m_drill.y ) != 0 )
1158 return diff;
1159
1160 if( ( diff = aPadRef->m_size.x - aPadCmp->m_size.x ) != 0 )
1161 return diff;
1162
1163 if( ( diff = aPadRef->m_size.y - aPadCmp->m_size.y ) != 0 )
1164 return diff;
1165
1166 if( ( diff = aPadRef->m_offset.x - aPadCmp->m_offset.x ) != 0 )
1167 return diff;
1168
1169 if( ( diff = aPadRef->m_offset.y - aPadCmp->m_offset.y ) != 0 )
1170 return diff;
1171
1172 if( ( diff = aPadRef->m_deltaSize.x - aPadCmp->m_deltaSize.x ) != 0 )
1173 return diff;
1174
1175 if( ( diff = aPadRef->m_deltaSize.y - aPadCmp->m_deltaSize.y ) != 0 )
1176 return diff;
1177
1178 if( ( diff = aPadRef->m_roundedCornerScale - aPadCmp->m_roundedCornerScale ) != 0 )
1179 return diff;
1180
1181 if( ( diff = aPadRef->m_chamferPositions - aPadCmp->m_chamferPositions ) != 0 )
1182 return diff;
1183
1184 if( ( diff = aPadRef->m_chamferScale - aPadCmp->m_chamferScale ) != 0 )
1185 return diff;
1186
1187 if( ( diff = static_cast<int>( aPadRef->m_editPrimitives.size() ) -
1188 static_cast<int>( aPadCmp->m_editPrimitives.size() ) ) != 0 )
1189 return diff;
1190
1191 // @todo: Compare custom pad primitives for pads that have the same number of primitives
1192 // here. Currently there is no compare function for PCB_SHAPE objects.
1193
1194 // Dick: specctra_export needs this
1195 // Lorenzo: gencad also needs it to implement padstacks!
1196
1197#if __cplusplus >= 201103L
1198 long long d = aPadRef->m_layerMask.to_ullong() - aPadCmp->m_layerMask.to_ullong();
1199
1200 if( d < 0 )
1201 return -1;
1202 else if( d > 0 )
1203 return 1;
1204
1205 return 0;
1206#else
1207 // these strings are not typically constructed, since we don't get here often.
1208 std::string s1 = aPadRef->m_layerMask.to_string();
1209 std::string s2 = aPadCmp->m_layerMask.to_string();
1210 return s1.compare( s2 );
1211#endif
1212}
PAD_DRILL_SHAPE_T m_drillShape
Definition: pad.h:811
VECTOR2I m_offset
Definition: pad.h:829

References GetShape(), m_attribute, m_chamferPositions, m_chamferScale, m_deltaSize, m_drill, m_drillShape, m_editPrimitives, m_layerMask, m_offset, m_roundedCornerScale, m_size, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by CreatePadsShapesSection().

◆ ConditionallyFlashed()

bool PAD::ConditionallyFlashed ( PCB_LAYER_ID  aLayer) const
inline

Definition at line 617 of file pad.h.

618 {
620 return false;
621
622 if( m_keepTopBottomLayer && ( aLayer == F_Cu || aLayer == B_Cu ) )
623 return false;
624
625 return true;
626 }
@ B_Cu
Definition: layer_ids.h:95
@ F_Cu
Definition: layer_ids.h:64

References B_Cu, F_Cu, m_keepTopBottomLayer, and m_removeUnconnectedLayer.

◆ ConnSMDMask()

LSET PAD::ConnSMDMask ( )
static

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

Definition at line 210 of file pad.cpp.

211{
212 static LSET saved( 2, F_Cu, F_Mask );
213 return saved;
214}
@ F_Mask
Definition: layer_ids.h:107

References F_Cu, and F_Mask.

Referenced by DIALOG_PAD_PROPERTIES::updatePadLayersList().

◆ DeletePrimitivesList()

void PAD::DeletePrimitivesList ( )

Clear the basic shapes list.

Definition at line 197 of file pad_custom_shape_functions.cpp.

198{
199 m_editPrimitives.clear();
200
201 SetDirty();
202}

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 150 of file board_item.cpp.

151{
153
154 if( parent )
155 parent->Remove( this );
156
157 delete this;
158}
Abstract interface for BOARD_ITEMs capable of storing other items inside.
virtual void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL)=0
Removes an item from the container.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:163

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

Referenced by 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 184 of file board_item.cpp.

185{
186 BOARD_ITEM* dupe = static_cast<BOARD_ITEM*>( Clone() );
187 const_cast<KIID&>( dupe->m_Uuid ) = KIID();
188
189 if( dupe->GetParentGroup() )
190 dupe->GetParentGroup()->AddItem( dupe );
191
192 return static_cast<BOARD_ITEM*>( dupe );
193}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:72
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:82
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:80

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

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

◆ FlashLayer() [1/2]

bool PAD::FlashLayer ( int  aLayer,
bool  aOnlyCheckIfPermitted = false 
) const

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

Parameters
aLayerLayer to check for connectivity
aOnlyCheckIfPermittedindicates that the routine should just return whether or not a flashed connection is permitted on this layer (without checking for a connection)
Returns
true if connected by pad or track (or optionally zone)

Heat sink pads always get copper

Definition at line 267 of file pad.cpp.

268{
269 if( aLayer == UNDEFINED_LAYER )
270 return true;
271
272 if( !IsOnLayer( static_cast<PCB_LAYER_ID>( aLayer ) ) )
273 return false;
274
275 if( GetAttribute() == PAD_ATTRIB::NPTH && IsCopperLayer( aLayer ) )
276 {
278 {
279 if( GetOffset() == VECTOR2I( 0, 0 ) && GetDrillSize().x >= GetSize().x )
280 return false;
281 }
283 {
284 if( GetOffset() == VECTOR2I( 0, 0 )
285 && GetDrillSize().x >= GetSize().x && GetDrillSize().y >= GetSize().y )
286 {
287 return false;
288 }
289 }
290 }
291
292 if( LSET::FrontBoardTechMask().test( aLayer ) )
293 aLayer = F_Cu;
294 else if( LSET::BackBoardTechMask().test( aLayer ) )
295 aLayer = B_Cu;
296
297 if( GetAttribute() == PAD_ATTRIB::PTH && IsCopperLayer( aLayer ) )
298 {
301 return true;
302
304 return true;
305
306 // Plated through hole pads need copper on the top/bottom layers for proper soldering
307 // Unless the user has removed them in the pad dialog
308 if( m_keepTopBottomLayer && ( aLayer == F_Cu || aLayer == B_Cu ) )
309 return true;
310
311 if( const BOARD* board = GetBoard() )
312 {
313 // Must be static to keep from raising its ugly head in performance profiles
314 static std::initializer_list<KICAD_T> types = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T,
315 PCB_PAD_T };
316
317 // Only the highest priority zone that a via interacts with on any given layer gets
318 // to determine if it is connected or not. This keeps us from deciding it's not
319 // flashed when filling the first zone, and then later having another zone connect to
320 // it, causing it to become flashed, resulting in the first zone having insufficient
321 // clearance.
322 // See https://gitlab.com/kicad/code/kicad/-/issues/11299.
323 if( m_zoneLayerConnections[ aLayer ] == ZLC_CONNECTED )
324 {
325 return true;
326 }
327 else if( m_zoneLayerConnections[ aLayer ] == ZLC_UNCONNECTED )
328 {
329 return false;
330 }
331 else /* ZLC_UNRESOLVED */
332 {
333 if( aOnlyCheckIfPermitted )
334 return true;
335 else
336 return board->GetConnectivity()->IsConnectedOnLayer( this, aLayer, types );
337 }
338 }
339 }
340
341 return true;
342}
@ ZLC_CONNECTED
Definition: board_item.h:47
static LSET FrontBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on front side.
Definition: lset.cpp:834
static LSET BackBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side.
Definition: lset.cpp:821
PAD_PROP GetProperty() const
Definition: pad.h:403
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:383
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pad.h:630
const VECTOR2I & GetDrillSize() const
Definition: pad.h:267
const VECTOR2I & GetOffset() const
Definition: pad.h:274
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:825
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ PAD_DRILL_SHAPE_OBLONG
Definition: pad_shapes.h:71
@ HEATSINK
a pad used as heat sink, usually in SMD footprints
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101

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, m_zoneLayerConnections, NPTH, OVAL, PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG, PCB_ARC_T, PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, PTH, UNDEFINED_LAYER, ZLC_CONNECTED, and ZLC_UNCONNECTED.

Referenced by CanFlashLayer(), KIGFX::PCB_PAINTER::draw(), FlashLayer(), GetEffectiveShape(), 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 255 of file pad.cpp.

256{
257 for( PCB_LAYER_ID layer : aLayers.Seq() )
258 {
259 if( FlashLayer( layer ) )
260 return true;
261 }
262
263 return false;
264}
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

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

◆ Flip()

void PAD::Flip ( const VECTOR2I 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 718 of file pad.cpp.

719{
720 if( aFlipLeftRight )
721 {
722 MIRROR( m_pos.x, aCentre.x );
723 MIRROR( m_pos0.x, 0 );
724 MIRROR( m_offset.x, 0 );
725 MIRROR( m_deltaSize.x, 0 );
726 }
727 else
728 {
729 MIRROR( m_pos.y, aCentre.y );
730 MIRROR( m_pos0.y, 0 );
731 MIRROR( m_offset.y, 0 );
732 MIRROR( m_deltaSize.y, 0 );
733 }
734
736
737 auto mirrorBitFlags = []( int& aBitfield, int a, int b )
738 {
739 bool temp = aBitfield & a;
740
741 if( aBitfield & b )
742 aBitfield |= a;
743 else
744 aBitfield &= ~a;
745
746 if( temp )
747 aBitfield |= b;
748 else
749 aBitfield &= ~b;
750 };
751
752 if( aFlipLeftRight )
753 {
756 }
757 else
758 {
761 }
762
763 // flip pads layers
764 // PADS items are currently on all copper layers, or
765 // currently, only on Front or Back layers.
766 // So the copper layers count is not taken in account
768
769 // Flip the basic shapes, in custom pads
770 FlipPrimitives( aFlipLeftRight );
771
772 SetDirty();
773}
void SetLayerSet(LSET aLayers) override
Definition: pad.h:396
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:776
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
Definition: pad.h:370
void SetOrientation(const EDA_ANGLE &aAngle)
Set the rotation angle of the pad.
Definition: pad.cpp:709
VECTOR2I m_pos0
Definition: pad.h:838
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint.
Definition: lset.cpp:590
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40

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(), SetOrientation(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

777{
778 for( std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
779 primitive->Flip( VECTOR2I( 0, 0 ), aFlipLeftRight );
780
781 SetDirty();
782}

References m_editPrimitives, and SetDirty().

Referenced by Flip(), mirrorPadX(), and mirrorPadY().

◆ Get() [1/3]

template<typename T >
std::optional< T > INSPECTABLE::Get ( const wxString &  aProperty) const
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 std::optional<T> ret;
110
111 if( prop )
112 {
113 const void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114
115 if( object )
116 ret = prop->get<T>( object );
117 }
118
119 return ret;
120 }
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.
T get(const void *aObject) const
Definition: property.h:316
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:74
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:76
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
#define TYPE_HASH(x)
Definition: property.h:62
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:46

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

◆ Get() [2/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 84 of file inspectable.h.

85 {
87 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
88 return object ? aProperty->getter( object ) : wxAny();
89 }
virtual wxAny getter(const void *aObject) const =0

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(), EDA_SHAPE_DESC::EDA_SHAPE_DESC(), PROPERTIES_PANEL::getItemValue(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [3/3]

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

Definition at line 92 of file inspectable.h.

93 {
95 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
96
97 if( !object )
98 throw std::runtime_error( "Could not cast INSPECTABLE to the requested type" );
99
100 return aProperty->get<T>( object );
101 }

References PROPERTY_BASE::get(), 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 255 of file pad_custom_shape_functions.cpp.

256{
257 SHAPE_POLY_SET poly;
259
260 if( poly.OutlineCount() > 1 )
261 return false;
262
263 const int minSteps = 10;
264 const int maxSteps = 50;
265
266 int stepsX, stepsY;
267
268 auto bbox = poly.BBox();
269
270 if( bbox.GetWidth() < bbox.GetHeight() )
271 {
272 stepsX = minSteps;
273 stepsY = minSteps * (double) bbox.GetHeight() / (double )(bbox.GetWidth() + 1);
274 }
275 else
276 {
277 stepsY = minSteps;
278 stepsX = minSteps * (double) bbox.GetWidth() / (double )(bbox.GetHeight() + 1);
279 }
280
281 stepsX = std::max(minSteps, std::min( maxSteps, stepsX ) );
282 stepsY = std::max(minSteps, std::min( maxSteps, stepsY ) );
283
284 VECTOR2I center = bbox.Centre();
285
286 int64_t minDist = std::numeric_limits<int64_t>::max();
287 int64_t minDistEdge;
288
290 {
291 minDistEdge = GetSize().x;
292 }
293 else
294 {
295 minDistEdge = std::max( GetSize().x, GetSize().y );
296 }
297
298 std::optional<VECTOR2I> bestAnchor( []()->std::optional<VECTOR2I> { return std::nullopt; }() );
299
300 for( int y = 0; y < stepsY ; y++ )
301 {
302 for( int x = 0; x < stepsX; x++ )
303 {
304 VECTOR2I p = bbox.GetPosition();
305 p.x += rescale( x, bbox.GetWidth(), (stepsX - 1) );
306 p.y += rescale( y, bbox.GetHeight(), (stepsY - 1) );
307
308 if( poly.Contains(p) )
309 {
310
311 int dist = (center - p).EuclideanNorm();
312 int distEdge = poly.COutline(0).Distance( p, true );
313
314 if( distEdge >= minDistEdge )
315 {
316 if( dist < minDist )
317 {
318 bestAnchor = p;
319 minDist = dist;
320 }
321 }
322 }
323 }
324 }
325
326 if( bestAnchor )
327 {
328 aPos = *bestAnchor;
329 return true;
330 }
331
332 return false;
333}
constexpr int ARC_LOW_DEF
Definition: base_units.h:120
coord_type GetHeight() const
Definition: box2.h:188
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 BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
double EuclideanNorm(const VECTOR2I &vector)
Definition: trigo.h:129
T rescale(T aNumerator, T aValue, T aDenominator)
Scale a number (value) by rational (numerator/denominator).
Definition: util.h:118

References addPadPrimitivesToPolygon(), ARC_LOW_DEF, 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(), SHAPE_POLY_SET::OutlineCount(), rescale(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ GetBoard() [1/2]

BOARD * BOARD_ITEM::GetBoard ( )
virtualinherited

Definition at line 57 of file board_item.cpp.

58{
59 if( Type() == PCB_T )
60 return static_cast<BOARD*>( this );
61
62 BOARD_ITEM* parent = GetParent();
63
64 if( parent )
65 return parent->GetBoard();
66
67 return nullptr;
68}
@ PCB_T
Definition: typeinfo.h:82

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

◆ GetBoard() [2/2]

const BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 43 of file board_item.cpp.

44{
45 if( Type() == PCB_T )
46 return static_cast<const BOARD*>( this );
47
48 BOARD_ITEM* parent = GetParent();
49
50 if( parent )
51 return parent->GetBoard();
52
53 return nullptr;
54}

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

Referenced by BOARD_ADAPTER::addShape(), FOOTPRINT::BuildCourtyardCaches(), BuildEffectivePolygon(), BuildEffectiveShapes(), ZONE::BuildSmoothedPoly(), ZONE::CacheBoundingBox(), collidesWithArea(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), enclosedByAreaFunc(), existsOnLayerFunc(), PCB_VIA::FlashLayer(), FlashLayer(), FP_SHAPE::Flip(), FP_TEXT::Flip(), FP_TEXTBOX::Flip(), PCB_DIMENSION_BASE::Flip(), PCB_SHAPE::Flip(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), PCB_TEXTBOX::Flip(), PCB_TRACK::Flip(), PCB_ARC::Flip(), PCB_VIA::Flip(), ZONE::Flip(), PCB_PLUGIN::format(), fromToFunc(), BOARD_ITEM::GetBoard(), PCB_EXPR_CONTEXT::GetBoard(), NETINFO_ITEM::GetBoundingBox(), ZONE::GetBoundingBox(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), FOOTPRINT::GetCourtyard(), BOARD_CONNECTED_ITEM::GetEffectiveNetClass(), FP_TEXT::GetEffectiveShape(), PCB_TEXT::GetEffectiveShape(), getFieldFunc(), ZONE::GetInteractingZones(), ZONE::GetItemDescription(), BOARD_ITEM::GetLayerName(), PCB_VIA::GetMinAnnulus(), NETINFO_ITEM::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), BOARD_CONNECTED_ITEM::GetOwnClearance(), GetOwnClearance(), PCB_MARKER::GetSeverity(), GetSolderMaskExpansion(), PCB_VIA::GetSolderMaskExpansion(), GetSolderPasteMargin(), BOARD::GetTrackLength(), PCB_TRACK::GetWidthConstraint(), inDiffPairFunc(), ROUTER_TOOL::Init(), intersectsAreaFunc(), intersectsBackCourtyardFunc(), intersectsCourtyardFunc(), intersectsFrontCourtyardFunc(), BOARD_ITEM::IsLocked(), PCB_VIA::IsTented(), BOARD_ITEM::layerMaskDescribe(), PCB_VIA::layerMaskDescribe(), MergePrimitivesAsPolygon(), ZONE::Move(), DIALOG_TEXTBOX_PROPERTIES::onBorderChecked(), EAGLE_PLUGIN::packageWire(), padsNeedUpdate(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD::ResolveDRCExclusions(), FOOTPRINT::ResolveTextVar(), BOARD_CONNECTED_ITEM::SetNetCode(), TEARDROP_DIALOG::TEARDROP_DIALOG(), DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), ZONE::TransformSmoothedOutlineToPolygon(), BOARD::UpdateRatsnestExclusions(), FOOTPRINT::ViewBBox(), ViewBBox(), PCB_TRACK::ViewBBox(), ViewGetLOD(), PCB_BITMAP::ViewGetLOD(), PCB_VIA::ViewGetLOD(), FOOTPRINT::~FOOTPRINT(), and ZONE::~ZONE().

◆ GetBoundingBox()

const BOX2I 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 650 of file pad.cpp.

651{
652 if( m_shapesDirty )
654
656}
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:440

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

432{
433 if( m_polyDirty )
435
437}
void BuildEffectivePolygon() const
Definition: pad.cpp:612

References BuildEffectivePolygon(), m_effectiveBoundingRadius, and m_polyDirty.

Referenced by HitTest().

◆ GetCenter()

VECTOR2I 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 276 of file pad.h.

276{ return GetPosition(); }
VECTOR2I GetPosition() const override
Definition: pad.h:202

References GetPosition().

◆ GetChamferPositions()

◆ GetChamferRectRatio()

◆ GetClass()

wxString PAD::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 669 of file pad.h.

670 {
671 return wxT( "PAD" );
672 }

◆ 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 212 of file pad.h.

213 {
215 }

References m_customShapeClearanceArea.

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

◆ GetDelta()

◆ GetDrillShape()

◆ GetDrillSize()

◆ GetDrillSizeX()

int PAD::GetDrillSizeX ( ) const
inline

Definition at line 269 of file pad.h.

269{ return m_drill.x; }

References m_drill, and VECTOR2< T >::x.

Referenced by HasHole(), PAD_DESC::PAD_DESC(), and VIAPAD::VIAPAD().

◆ GetDrillSizeY()

int PAD::GetDrillSizeY ( ) const
inline

Definition at line 271 of file pad.h.

271{ return m_drill.y; }

References m_drill, and VECTOR2< T >::y.

Referenced by HasHole(), PAD_DESC::PAD_DESC(), and VIAPAD::VIAPAD().

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 145 of file eda_item.h.

146 {
147 constexpr int mask =
149
150 return m_flags & mask;
151 }
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_CHANGED
Item was edited, and modified.
#define IS_NEW
New item, just created.
#define IS_BROKEN
Is a segment just broken by BreakSegment.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_MOVING
Item being moved.

References IS_BROKEN, IS_CHANGED, IS_MOVING, IS_NEW, IS_PASTED, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), 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_FRAME::SelectUnit(), DIALOG_IMAGE_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveHoleShape()

◆ GetEffectiveNetClass()

NETCLASS * BOARD_CONNECTED_ITEM::GetEffectiveNetClass ( ) 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.

Definition at line 97 of file board_connected_item.cpp.

98{
100 return m_netinfo->GetNetClass();
101 else
102 return GetBoard()->GetDesignSettings().m_NetSettings->m_DefaultNetClass.get();
103}
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
std::shared_ptr< NET_SETTINGS > m_NetSettings
NETCLASS * GetNetClass()
Definition: netinfo.h:112

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

Referenced by PCB_VIA::GetDrillValue(), BOARD_INSPECTION_TOOL::getItemDescription(), GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClassName(), PCB_EXPR_NETCLASS_REF::GetValue(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ GetEffectivePolygon()

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

◆ GetEffectiveShape()

std::shared_ptr< SHAPE > PAD::GetEffectiveShape ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER,
FLASHING  flashPTHPads = 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
aLayeroptional parameter allowing a caller to specify a particular layer (default is to return the pad's "natural" shape).
aFlashoptional parameter allowing a caller to force the pad to be flashed (or not flashed) on the current layer (default is to honour the pad's setting and the current connections for the given layer).

Reimplemented from BOARD_ITEM.

Definition at line 385 of file pad.cpp.

386{
387 if( aLayer == Edge_Cuts )
388 {
390 return GetEffectiveHoleShape();
391 else
392 return std::make_shared<SHAPE_NULL>();
393 }
394
396 {
397 bool flash;
398
399 if( flashPTHPads == FLASHING::NEVER_FLASHED )
400 flash = false;
401 else if( flashPTHPads == FLASHING::ALWAYS_FLASHED )
402 flash = true;
403 else
404 flash = FlashLayer( aLayer );
405
406 if( !flash )
407 {
409 return GetEffectiveHoleShape();
410 else
411 return std::make_shared<SHAPE_NULL>();
412 }
413 }
414
415 if( m_shapesDirty )
416 BuildEffectiveShapes( aLayer );
417
418 return m_effectiveShape;
419}
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Return a SHAPE_SEGMENT object representing the pad's hole.
Definition: pad.cpp:422
@ ALWAYS_FLASHED
@ Edge_Cuts
Definition: layer_ids.h:113

References ALWAYS_FLASHED, BuildEffectiveShapes(), Edge_Cuts, FlashLayer(), GetAttribute(), GetEffectiveHoleShape(), m_effectiveShape, m_shapesDirty, NEVER_FLASHED, NPTH, and PTH.

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

◆ GetFlags()

◆ GetFocusPosition()

virtual const VECTOR2I EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

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

Reimplemented in BOARD, PCB_SHAPE, and PCB_TRACK.

Definition at line 256 of file eda_item.h.

256{ return GetPosition(); }
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetFriendlyName()

wxString EDA_ITEM::GetFriendlyName ( ) const
virtualinherited

Reimplemented in PCB_SHAPE, PCB_TRACK, and ZONE.

Definition at line 310 of file eda_item.cpp.

311{
312 return GetTypeDesc();
313}
wxString GetTypeDesc() const
Return a translated description of the type for this EDA_ITEM for display in user facing messages.
Definition: eda_item.cpp:301

References EDA_ITEM::GetTypeDesc().

Referenced by PROPERTIES_PANEL::rebuildProperties().

◆ GetItemDescription()

wxString PAD::GetItemDescription ( UNITS_PROVIDER aUnitsProvider) const
overridevirtual

Return a user-visible description string of this item.

This description is used in disambiguation menus, the message panel, ERC/DRC reports, etc.

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

1258{
1259 if( GetNumber().IsEmpty() )
1260 {
1262 {
1263 return wxString::Format( _( "Pad %s of %s on %s" ),
1264 GetNetnameMsg(),
1265 GetParent()->GetReference(),
1267 }
1268 else if( GetAttribute() == PAD_ATTRIB::NPTH )
1269 {
1270 return wxString::Format( _( "NPTH pad of %s" ), GetParent()->GetReference() );
1271 }
1272 else
1273 {
1274 return wxString::Format( _( "PTH pad %s of %s" ),
1275 GetNetnameMsg(),
1276 GetParent()->GetReference() );
1277 }
1278 }
1279 else
1280 {
1282 {
1283 return wxString::Format( _( "Pad %s %s of %s on %s" ),
1284 GetNumber(),
1285 GetNetnameMsg(),
1286 GetParent()->GetReference(),
1288 }
1289 else if( GetAttribute() == PAD_ATTRIB::NPTH )
1290 {
1291 return wxString::Format( _( "NPTH of %s" ), GetParent()->GetReference() );
1292 }
1293 else
1294 {
1295 return wxString::Format( _( "PTH pad %s %s of %s" ),
1296 GetNumber(),
1297 GetNetnameMsg(),
1298 GetParent()->GetReference() );
1299 }
1300 }
1301}
wxString GetNetnameMsg() const
virtual wxString layerMaskDescribe() const
Return a string (to be shown to the user) describing a layer mask.
Definition: board_item.cpp:106
const wxString & GetNumber() const
Definition: pad.h:135
#define _(s)
@ SMD
Smd pad, appears on the solder paste layer (default)
@ CONN
Like smd, does not appear on the solder paste layer (default)
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

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

◆ GetKeepTopBottom()

◆ GetLayer()

PCB_LAYER_ID PAD::GetLayer ( ) const
overridevirtual

Return the primary layer this item is on.

Reimplemented from BOARD_ITEM.

Definition at line 239 of file pad.cpp.

240{
241 return BOARD_ITEM::GetLayer();
242}
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:180

References BOARD_ITEM::GetLayer().

Referenced by DRC_TEST_PROVIDER_MISC::testDisabledLayers().

◆ 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 94 of file board_item.cpp.

95{
96 const BOARD* board = GetBoard();
97
98 if( board )
99 return board->GetLayerName( m_layer );
100
101 // If no parent, return standard name
103}
PCB_LAYER_ID m_layer
Definition: board_item.h:329
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:696
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:452

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

Referenced by FP_SHAPE::GetItemDescription(), PCB_DIMENSION_BASE::GetItemDescription(), PCB_SHAPE::GetItemDescription(), PCB_TEXT::GetItemDescription(), PCB_TEXTBOX::GetItemDescription(), PCB_TRACK::GetItemDescription(), FP_TEXT::GetMsgPanelInfo(), FP_TEXTBOX::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_DIM_LEADER::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), PCB_TARGET::GetMsgPanelInfo(), PCB_TEXT::GetMsgPanelInfo(), PCB_TEXTBOX::GetMsgPanelInfo(), FOOTPRINT_SEARCH_HANDLER::GetResultCell(), PCB_TEXT::GetShownText(), PCB_TEXTBOX::GetShownText(), and FOOTPRINT::ResolveTextVar().

◆ GetLayerSet()

◆ GetLocalClearance() [1/2]

int PAD::GetLocalClearance ( ) const
inline

Definition at line 419 of file pad.h.

419{ return m_localClearance; }

References m_localClearance.

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

◆ GetLocalClearance() [2/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 814 of file pad.cpp.

815{
816 if( aSource )
817 *aSource = _( "pad" );
818
819 return m_localClearance;
820}

References _, and m_localClearance.

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

◆ 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 800 of file pad.cpp.

801{
802 // A pad can have specific clearance that overrides its NETCLASS clearance value
803 if( GetLocalClearance() )
804 return GetLocalClearance( aSource );
805
806 // A footprint can have a specific clearance value
808 return GetParent()->GetLocalClearance( aSource );
809
810 return 0;
811}
int GetLocalClearance() const
Definition: footprint.h:230
int GetLocalClearance() const
Definition: pad.h:419

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

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLocalSolderMaskMargin()

◆ GetLocalSolderPasteMargin()

◆ GetLocalSolderPasteMarginRatio()

◆ GetLocalSpokeWidthOverride()

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

Definition at line 953 of file pad.cpp.

954{
955 if( m_thermalSpokeWidth > 0 && aSource )
956 *aSource = _( "pad" );
957
958 return m_thermalSpokeWidth;
959}

References _, and m_thermalSpokeWidth.

◆ GetLocalThermalGapOverride()

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

Definition at line 962 of file pad.cpp.

963{
964 if( m_thermalGap > 0 && aSource )
965 *aSource = _( "pad" );
966
967 return m_thermalGap;
968}

References _, and m_thermalGap.

Referenced by ZONE::GetThermalReliefGap().

◆ GetLocalZoneConnectionOverride()

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

Definition at line 944 of file pad.cpp.

945{
947 *aSource = _( "pad" );
948
949 return m_zoneConnection;
950}

References _, INHERITED, and m_zoneConnection.

◆ 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 1304 of file pad.cpp.

1305{
1306 return BITMAPS::pad;
1307}

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

972{
973 wxString msg;
974 FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
975
976 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
977 {
978 if( parentFootprint )
979 aList.emplace_back( _( "Footprint" ), parentFootprint->GetReference() );
980 }
981
982 aList.emplace_back( _( "Pad" ), m_number );
983
984 if( !GetPinFunction().IsEmpty() )
985 aList.emplace_back( _( "Pin Name" ), GetPinFunction() );
986
987 if( !GetPinType().IsEmpty() )
988 aList.emplace_back( _( "Pin Type" ), GetPinType() );
989
990 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
991 {
992 aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
993
994 aList.emplace_back( _( "Resolved Netclass" ),
995 UnescapeString( GetEffectiveNetClass()->GetName() ) );
996
997 if( IsLocked() )
998 aList.emplace_back( _( "Status" ), _( "Locked" ) );
999 }
1000
1002 aList.emplace_back( _( "Layer" ), layerMaskDescribe() );
1003
1004 // Show the pad shape, attribute and property
1005 wxString props = ShowPadAttr();
1006
1007 if( GetProperty() != PAD_PROP::NONE )
1008 props += ',';
1009
1010 switch( GetProperty() )
1011 {
1012 case PAD_PROP::NONE: break;
1013 case PAD_PROP::BGA: props += _( "BGA" ); break;
1014 case PAD_PROP::FIDUCIAL_GLBL: props += _( "Fiducial global" ); break;
1015 case PAD_PROP::FIDUCIAL_LOCAL: props += _( "Fiducial local" ); break;
1016 case PAD_PROP::TESTPOINT: props += _( "Test point" ); break;
1017 case PAD_PROP::HEATSINK: props += _( "Heat sink" ); break;
1018 case PAD_PROP::CASTELLATED: props += _( "Castellated" ); break;
1019 }
1020
1021 aList.emplace_back( ShowPadShape(), props );
1022
1024 && m_size.x == m_size.y )
1025 {
1026 aList.emplace_back( _( "Diameter" ), aFrame->MessageTextFromValue( m_size.x ) );
1027 }
1028 else
1029 {
1030 aList.emplace_back( _( "Width" ), aFrame->MessageTextFromValue( m_size.x ) );
1031 aList.emplace_back( _( "Height" ), aFrame->MessageTextFromValue( m_size.y ) );
1032 }
1033
1034 EDA_ANGLE fp_orient = parentFootprint ? parentFootprint->GetOrientation() : ANGLE_0;
1035 EDA_ANGLE pad_orient = GetOrientation() - fp_orient;
1036 pad_orient.Normalize180();
1037
1038 if( !fp_orient.IsZero() )
1039 msg.Printf( wxT( "%g(+ %g)" ), pad_orient.AsDegrees(), fp_orient.AsDegrees() );
1040 else
1041 msg.Printf( wxT( "%g" ), GetOrientation().AsDegrees() );
1042
1043 aList.emplace_back( _( "Rotation" ), msg );
1044
1045 if( GetPadToDieLength() )
1046 {
1047 aList.emplace_back( _( "Length in Package" ),
1049 }
1050
1051 if( m_drill.x > 0 || m_drill.y > 0 )
1052 {
1054 {
1055 aList.emplace_back( _( "Hole" ),
1056 wxString::Format( wxT( "%s" ),
1057 aFrame->MessageTextFromValue( m_drill.x ) ) );
1058 }
1059 else
1060 {
1061 aList.emplace_back( _( "Hole X / Y" ),
1062 wxString::Format( wxT( "%s / %s" ),
1063 aFrame->MessageTextFromValue( m_drill.x ),
1064 aFrame->MessageTextFromValue( m_drill.y ) ) );
1065 }
1066 }
1067
1068 wxString source;
1069 int clearance = GetOwnClearance( UNDEFINED_LAYER, &source );
1070
1071 if( !source.IsEmpty() )
1072 {
1073 aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
1074 aFrame->MessageTextFromValue( clearance ) ),
1075 wxString::Format( _( "(from %s)" ),
1076 source ) );
1077 }
1078#if 0
1079 // useful for debug only
1080 aList.emplace_back( wxT( "UUID" ), m_Uuid.AsString() );
1081#endif
1082}
virtual NETCLASS * GetEffectiveNetClass() const
Return the NETCLASS for this item.
double AsDegrees() const
Definition: eda_angle.h:149
bool IsZero() const
Definition: eda_angle.h:169
EDA_ANGLE Normalize180()
Definition: eda_angle.h:271
EDA_ANGLE GetOrientation() const
Definition: footprint.h:191
const wxString & GetReference() const
Definition: footprint.h:519
wxString AsString() const
Definition: kiid.cpp:257
int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const override
Return an item's "own" clearance in internal units.
Definition: pad.cpp:823
const wxString & GetPinType() const
Definition: pad.h:152
const wxString & GetPinFunction() const
Definition: pad.h:146
bool IsLocked() const override
Definition: pad.cpp:156
wxString ShowPadAttr() const
Definition: pad.cpp:1244
wxString ShowPadShape() const
Definition: pad.cpp:1228
wxString m_number
Definition: pad.h:771
int GetPadToDieLength() const
Definition: pad.h:413
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
#define PCB_EDIT_FRAME_NAME
@ FIDUCIAL_LOCAL
a fiducial (usually a smd) local to the parent footprint
@ FIDUCIAL_GLBL
a fiducial (usually a smd) for the full board
@ TESTPOINT
a test point pad
@ CASTELLATED
a pad with a castellated through hole
@ BGA
Smd pad, used in BGA footprints.
wxString UnescapeString(const wxString &aSource)

References _, ANGLE_0, EDA_ANGLE::AsDegrees(), KIID::AsString(), BGA, CASTELLATED, CIRCLE, CONN, FIDUCIAL_GLBL, FIDUCIAL_LOCAL, Format(), GetAttribute(), GetDrillShape(), BOARD_CONNECTED_ITEM::GetEffectiveNetClass(), BOARD_CONNECTED_ITEM::GetNetname(), FOOTPRINT::GetOrientation(), GetOrientation(), GetOwnClearance(), GetPadToDieLength(), GetPinFunction(), GetPinType(), GetProperty(), FOOTPRINT::GetReference(), GetShape(), HEATSINK, IsLocked(), EDA_ANGLE::IsZero(), BOARD_ITEM::layerMaskDescribe(), m_drill, m_number, EDA_ITEM::m_parent, m_size, EDA_ITEM::m_Uuid, UNITS_PROVIDER::MessageTextFromValue(), NONE, EDA_ANGLE::Normalize180(), OVAL, PAD_DRILL_SHAPE_CIRCLE, PCB_EDIT_FRAME_NAME, ShowPadAttr(), ShowPadShape(), SMD, TESTPOINT, UNDEFINED_LAYER, UnescapeString(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ GetNet()

◆ GetNetClassName()

wxString BOARD_CONNECTED_ITEM::GetNetClassName ( ) const
inherited

Returns the name of the effective netclass.

Primarily for the use of the property system.

Definition at line 106 of file board_connected_item.cpp.

107{
108 return GetEffectiveNetClass()->GetName();
109}
const wxString GetName() const
Definition: netclass.h:65

References BOARD_CONNECTED_ITEM::GetEffectiveNetClass(), and NETCLASS::GetName().

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

◆ GetNetCode()

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

Definition at line 89 of file board_connected_item.cpp.

90{
91 return m_netinfo ? m_netinfo->GetNetCode() : -1;
92}
int GetNetCode() const
Definition: netinfo.h:114

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(), KI_TEST::CheckFpZone(), connectedItemFilter(), CreateRoutesSection(), TEARDROP_MANAGER::createTeardrop(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::ExchangeFootprint(), PNS::NODE::FindItemByParent(), TEARDROP_MANAGER::findTouchingTrack(), PCB_PLUGIN::format(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), CONNECTIVITY_DATA::GetConnectedItems(), ZONE::GetInteractingZones(), PCB_TRACK::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), CONNECTIVITY_DATA::GetRatsnestForPad(), BOARD_INSPECTION_TOOL::highlightNet(), DIALOG_PAD_PROPERTIES::initValues(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectDRCError(), CONNECTIVITY_DATA::IsConnectedOnLayer(), ZONE::IsIsland(), ZONE::IsSame(), TEARDROP_MANAGER::isViaAndTrackInSameZone(), ZONE_FILLER::knockoutThermalReliefs(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), 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(), DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), ZONE::SameNet(), PCB_SELECTION_CONDITIONS::sameNetFunc(), PCB_SELECTION_TOOL::selectNet(), 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::testItemAgainstItems(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones(), BOARD::TracksInNet(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), PCB_CONTROL::UpdateMessagePanel(), VIAPAD::VIAPAD(), PCB_TRACK::ViewGetLOD(), 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 118 of file board_connected_item.cpp.

119{
120 if( !GetBoard() )
121 return wxT( "[** NO BOARD DEFINED **]" );
122
123 wxString netname = GetNetname();
124
125 if( !netname.length() )
126 return wxT( "[<no net>]" );
127 else if( GetNetCode() < 0 )
128 return wxT( "[" ) + UnescapeString( netname ) + wxT( "](" ) + _( "Not Found" ) + wxT( ")" );
129 else
130 return wxT( "[" ) + UnescapeString( netname ) + wxT( "]" );
131}

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

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

◆ GetNumber()

◆ GetOffset()

◆ GetOrientation()

◆ GetOrientationDegrees()

double PAD::GetOrientationDegrees ( ) const
inline

Definition at line 377 of file pad.h.

378 {
379 return m_orient.AsDegrees();
380 }

References EDA_ANGLE::AsDegrees(), and m_orient.

Referenced by PAD_DESC::PAD_DESC().

◆ GetOwnClearance()

int PAD::GetOwnClearance ( PCB_LAYER_ID  aLayer,
wxString *  aSource = nullptr 
) const
overridevirtual

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.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 823 of file pad.cpp.

824{
826
827 if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
828 {
830
832 c = bds.m_DRCEngine->EvalRules( HOLE_CLEARANCE_CONSTRAINT, this, nullptr, aLayer );
833 else
834 c = bds.m_DRCEngine->EvalRules( CLEARANCE_CONSTRAINT, this, nullptr, aLayer );
835 }
836
837 if( c.Value().HasMin() )
838 {
839 if( aSource )
840 *aSource = c.GetName();
841
842 return c.Value().Min();
843 }
844
845 return 0;
846}
Container for design settings for a BOARD object.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
wxString GetName() const
Definition: drc_rule.h:149
MINOPTMAX< int > & Value()
Definition: drc_rule.h:142
T Min() const
Definition: minoptmax.h:33
bool HasMin() const
Definition: minoptmax.h:37
@ CLEARANCE_CONSTRAINT
Definition: drc_rule.h:47
@ HOLE_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:48

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

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

◆ GetPadToDieLength()

◆ GetParent()

◆ GetParentAsString()

wxString PAD::GetParentAsString ( ) const

Definition at line 1704 of file pad.cpp.

1705{
1706 if( FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( m_parent ) )
1707 return fp->GetReference();
1708
1709 return m_parent->m_Uuid.AsString();
1710}

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

Referenced by PAD_DESC::PAD_DESC().

◆ GetParentFootprint()

◆ GetParentGroup()

◆ GetPinFunction()

const wxString & PAD::GetPinFunction ( ) const
inline

◆ GetPinType()

const wxString & PAD::GetPinType ( ) const
inline

Definition at line 152 of file pad.h.

152{ return m_pinType; }
wxString m_pinType
Definition: pad.h:773

References m_pinType.

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

◆ GetPos0()

const VECTOR2I & PAD::GetPos0 ( ) const
inline

◆ GetPosition()

◆ GetPrimitives()

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

◆ GetPrincipalLayer()

PCB_LAYER_ID PAD::GetPrincipalLayer ( ) const
Returns
the principal copper layer for SMD and CONN pads.

Definition at line 245 of file pad.cpp.

246{
248 return m_layer;
249 else
250 return GetLayerSet().Seq().front();
251
252}
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:397

References CONN, GetLayerSet(), m_attribute, BOARD_ITEM::m_layer, LSET::Seq(), and SMD.

Referenced by DRC_TEST_PROVIDER_FOOTPRINT_CHECKS::Run().

◆ GetProperty()

◆ GetRemoveUnconnected()

◆ GetRoundRectCornerRadius()

◆ GetRoundRectRadiusRatio()

◆ GetShape()

◆ GetShortNetname()

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

Definition at line 134 of file board_connected_item.cpp.

135{
136 return m_netinfo ? m_netinfo->GetShortNetname() : wxString();
137}
const wxString & GetShortNetname() const
Definition: netinfo.h:125

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

Referenced by IsFreePad(), and IsNoConnectPad().

◆ GetSize()

◆ GetSizeX()

int PAD::GetSizeX ( ) const
inline

Definition at line 259 of file pad.h.

259{ return m_size.x; }

References m_size, and VECTOR2< T >::x.

Referenced by PAD_DESC::PAD_DESC(), and PAD_TOOL::RecombinePad().

◆ GetSizeY()

int PAD::GetSizeY ( ) const
inline

Definition at line 261 of file pad.h.

261{ return m_size.y; }

References m_size, and VECTOR2< T >::y.

Referenced by PAD_DESC::PAD_DESC(), and PAD_TOOL::RecombinePad().

◆ GetSolderMaskExpansion()

int PAD::GetSolderMaskExpansion ( ) const
Returns
the expansion 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 849 of file pad.cpp.

850{
851 // The pad inherits the margin only to calculate a default shape,
852 // therefore only if it is also a copper layer
853 // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
854 // defined by the pad settings only
855 bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
856
857 if( !isOnCopperLayer )
858 return 0;
859
860 int margin = m_localSolderMaskMargin;
861
862 FOOTPRINT* parentFootprint = GetParent();
863
864 if( parentFootprint )
865 {
866 if( margin == 0 )
867 {
868 if( parentFootprint->GetLocalSolderMaskMargin() )
869 margin = parentFootprint->GetLocalSolderMaskMargin();
870 }
871
872 if( margin == 0 )
873 {
874 const BOARD* brd = GetBoard();
875
876 if( brd )
878 }
879 }
880
881 // ensure mask have a size always >= 0
882 if( margin < 0 )
883 {
884 int minsize = -std::min( m_size.x, m_size.y ) / 2;
885
886 if( margin < minsize )
887 margin = minsize;
888 }
889
890 return margin;
891}
int GetLocalSolderMaskMargin() const
Definition: footprint.h:227
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:773

References LSET::AllCuMask(), BOARD_ITEM::GetBoard(), BOARD::GetDesignSettings(), FOOTPRINT::GetLocalSolderMaskMargin(), GetParent(), m_layerMask, m_localSolderMaskMargin, m_size, BOARD_DESIGN_SETTINGS::m_SolderMaskExpansion, VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ GetSolderPasteMargin()

VECTOR2I 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 894 of file pad.cpp.

895{
896 // The pad inherits the margin only to calculate a default shape,
897 // therefore only if it is also a copper layer.
898 // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
899 // defined by the pad settings only
900 bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
901
902 if( !isOnCopperLayer )
903 return VECTOR2I( 0, 0 );
904
905 int margin = m_localSolderPasteMargin;
906 double mratio = m_localSolderPasteMarginRatio;
907
908 FOOTPRINT* parentFootprint = GetParent();
909
910 if( parentFootprint )
911 {
912 if( margin == 0 )
913 margin = parentFootprint->GetLocalSolderPasteMargin();
914
915 auto brd = GetBoard();
916
917 if( margin == 0 && brd )
918 margin = brd->GetDesignSettings().m_SolderPasteMargin;
919
920 if( mratio == 0.0 )
921 mratio = parentFootprint->GetLocalSolderPasteMarginRatio();
922
923 if( mratio == 0.0 && brd )
924 {
925 mratio = brd->GetDesignSettings().m_SolderPasteMarginRatio;
926 }
927 }
928
929 VECTOR2I pad_margin;
930 pad_margin.x = margin + KiROUND( m_size.x * mratio );
931 pad_margin.y = margin + KiROUND( m_size.y * mratio );
932
933 // ensure mask have a size always >= 0
934 if( pad_margin.x < -m_size.x / 2 )
935 pad_margin.x = -m_size.x / 2;
936
937 if( pad_margin.y < -m_size.y / 2 )
938 pad_margin.y = -m_size.y / 2;
939
940 return pad_margin;
941}
double GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:244
int GetLocalSolderPasteMargin() const
Definition: footprint.h:241

References LSET::AllCuMask(), BOARD_ITEM::GetBoard(), FOOTPRINT::GetLocalSolderPasteMargin(), FOOTPRINT::GetLocalSolderPasteMarginRatio(), GetParent(), KiROUND(), m_layerMask, m_localSolderPasteMargin, m_localSolderPasteMarginRatio, m_size, VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ GetSortPosition()

virtual VECTOR2I EDA_ITEM::GetSortPosition ( ) const
inlinevirtualinherited

Return the coordinates that should be used for sorting this element visually compared to other elements.

For instance, for lines the midpoint might be a better sorting point than either end.

Returns
X,Y coordinate of the sort point

Reimplemented in SCH_LINE.

Definition at line 265 of file eda_item.h.

265{ return GetPosition(); }

References EDA_ITEM::GetPosition().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 123 of file eda_item.h.

124 {
125 return m_status & type;
126 }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:495

References EDA_ITEM::m_status.

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 136 of file eda_item.h.

136{ return m_status; }

References EDA_ITEM::m_status.

◆ GetStroke()

STROKE_PARAMS BOARD_ITEM::GetStroke ( ) const
virtualinherited

Reimplemented in PCB_SHAPE.

Definition at line 82 of file board_item.cpp.

83{
84 wxCHECK( false, STROKE_PARAMS( pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ) ) );
85}
#define DEFAULT_LINE_WIDTH

References DEFAULT_LINE_WIDTH, EDA_IU_SCALE::mmToIU(), and pcbIUScale.

Referenced by CONVERT_TOOL::CreatePolys(), and PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog().

◆ GetSubRatsnest()

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

Definition at line 599 of file pad.h.

599{ return m_subRatsnest; }
int m_subRatsnest
Definition: pad.h:805

References m_subRatsnest.

Referenced by operator=().

◆ GetThermalGap()

int PAD::GetThermalGap ( ) const
inline

◆ GetThermalSpokeAngle()

EDA_ANGLE PAD::GetThermalSpokeAngle ( ) const
inline

◆ GetThermalSpokeAngleDegrees()

double PAD::GetThermalSpokeAngleDegrees ( ) const
inline

Definition at line 548 of file pad.h.

549 {
551 }

References EDA_ANGLE::AsDegrees(), and m_thermalSpokeAngle.

Referenced by PAD_DESC::PAD_DESC().

◆ GetThermalSpokeWidth()

int PAD::GetThermalSpokeWidth ( ) const
inline

◆ GetTypeDesc()

wxString EDA_ITEM::GetTypeDesc ( ) const
inherited

Return a translated description of the type for this EDA_ITEM for display in user facing messages.

Definition at line 301 of file eda_item.cpp.

302{
303 //@see EDA_ITEM_DESC for definition of ENUM_MAP<KICAD_T>
304 wxString typeDescr = ENUM_MAP<KICAD_T>::Instance().ToString( Type() );
305
306 return wxGetTranslation( typeDescr );
307}
static ENUM_MAP< T > & Instance()
Definition: property.h:573

References ENUM_MAP< T >::Instance(), and EDA_ITEM::Type().

Referenced by PCB_GROUP::AddItem(), EDIT_TOOL::doMoveSelection(), and EDA_ITEM::GetFriendlyName().

◆ GetUnescapedShortNetname()

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

Definition at line 140 of file board_connected_item.cpp.

141{
142 return m_netinfo ? m_netinfo->GetUnescapedShortNetname() : wxString();
143}
const wxString & GetUnescapedShortNetname() const
Definition: netinfo.h:130

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

Referenced by KIGFX::PCB_PAINTER::draw(), and PCB_TRACK::ViewGetLOD().

◆ GetX()

◆ GetY()

◆ GetZoneConnection()

◆ HasFlag()

◆ HasHole()

bool PAD::HasHole ( ) const
inlineoverridevirtual

Reimplemented from BOARD_ITEM.

Definition at line 106 of file pad.h.

107 {
108 return GetDrillSizeX() > 0 && GetDrillSizeY() > 0;
109 }
int GetDrillSizeY() const
Definition: pad.h:271
int GetDrillSizeX() const
Definition: pad.h:269

References GetDrillSizeX(), and GetDrillSizeY().

Referenced by BOARD_ADAPTER::createPadWithDrill(), IsType(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem().

◆ HasLineStroke()

virtual bool BOARD_ITEM::HasLineStroke ( ) const
inlinevirtualinherited

Check if this item has line stoke properties.

See also
STROKE_PARAMS

Reimplemented in PCB_SHAPE.

Definition at line 172 of file board_item.h.

172{ return false; }

◆ HitTest() [1/2]

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

Test if aRect intersects this item.

Parameters
aRectA reference to a BOX2I 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 1097 of file pad.cpp.

1098{
1099 BOX2I arect = aRect;
1100 arect.Normalize();
1101 arect.Inflate( aAccuracy );
1102
1103 BOX2I bbox = GetBoundingBox();
1104
1105 if( aContained )
1106 {
1107 return arect.Contains( bbox );
1108 }
1109 else
1110 {
1111 // Fast test: if aRect is outside the polygon bounding box,
1112 // rectangles cannot intersect
1113 if( !arect.Intersects( bbox ) )
1114 return false;
1115
1116 const std::shared_ptr<SHAPE_POLY_SET>& poly = GetEffectivePolygon();
1117
1118 int count = poly->TotalVertices();
1119
1120 for( int ii = 0; ii < count; ii++ )
1121 {
1122 VECTOR2I vertex = poly->CVertex( ii );
1123 VECTOR2I vertexNext = poly->CVertex( ( ii + 1 ) % count );
1124
1125 // Test if the point is within aRect
1126 if( arect.Contains( vertex ) )
1127 return true;
1128
1129 // Test if this edge intersects aRect
1130 if( arect.Intersects( vertex, vertexNext ) )
1131 return true;
1132 }
1133
1134 return false;
1135 }
1136}
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:119
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:269
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
const BOX2I GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
Definition: pad.cpp:650
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon() const
Definition: pad.cpp:376

References BOX2< Vec >::Contains(), GetBoundingBox(), GetEffectivePolygon(), BOX2< Vec >::Inflate(), BOX2< Vec >::Intersects(), and BOX2< Vec >::Normalize().

◆ HitTest() [2/2]

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

Test if aPosition is inside or on the boundary of this item.

Parameters
aPositionA reference to a VECTOR2I 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 1085 of file pad.cpp.

1086{
1087 VECTOR2I delta = aPosition - GetPosition();
1088 int boundingRadius = GetBoundingRadius() + aAccuracy;
1089
1090 if( delta.SquaredEuclideanNorm() > SEG::Square( boundingRadius ) )
1091 return false;
1092
1093 return GetEffectivePolygon()->Contains( aPosition, -1, aAccuracy );
1094}
int GetBoundingRadius() const
Return the radius of a minimum sized circle which fully encloses this pad.
Definition: pad.cpp:431
static SEG::ecoord Square(int a)
Definition: seg.h:123
constexpr int delta

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

◆ 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 1492 of file pad.cpp.

1493{
1494 SetShape( aMasterPad.GetShape() );
1495 SetLayerSet( aMasterPad.GetLayerSet() );
1496 SetAttribute( aMasterPad.GetAttribute() );
1497 SetProperty( aMasterPad.GetProperty() );
1498
1499 // I am not sure the m_LengthPadToDie should be imported, because this is a parameter
1500 // really specific to a given pad (JPC).
1501#if 0
1502 SetPadToDieLength( aMasterPad.GetPadToDieLength() );
1503#endif
1504
1505 // The pad orientation, for historical reasons is the pad rotation + parent rotation.
1506 EDA_ANGLE pad_rot = aMasterPad.GetOrientation();
1507
1508 if( aMasterPad.GetParent() )
1509 pad_rot -= aMasterPad.GetParent()->GetOrientation();
1510
1511 if( GetParent() )
1512 pad_rot += GetParent()->GetOrientation();
1513
1514 SetOrientation( pad_rot );
1515
1517 SetKeepTopBottom( aMasterPad.GetKeepTopBottom() );
1518
1519 SetSize( aMasterPad.GetSize() );
1520 SetDelta( VECTOR2I( 0, 0 ) );
1521 SetOffset( aMasterPad.GetOffset() );
1522 SetDrillSize( aMasterPad.GetDrillSize() );
1523 SetDrillShape( aMasterPad.GetDrillShape() );
1527
1528 switch( aMasterPad.GetShape() )
1529 {
1531 SetDelta( aMasterPad.GetDelta() );
1532 break;
1533
1534 case PAD_SHAPE::CIRCLE:
1535 // ensure size.y == size.x
1536 SetSize( VECTOR2I( GetSize().x, GetSize().x ) );
1537 break;
1538
1539 default:
1540 ;
1541 }
1542
1543 switch( aMasterPad.GetAttribute() )
1544 {
1545 case PAD_ATTRIB::SMD:
1546 case PAD_ATTRIB::CONN:
1547 // These pads do not have a hole (they are expected to be on one external copper layer)
1548 SetDrillSize( VECTOR2I( 0, 0 ) );
1549 break;
1550
1551 default:
1552 ;
1553 }
1554
1555 // copy also local settings:
1556 SetLocalClearance( aMasterPad.GetLocalClearance() );
1560
1561 SetZoneConnection( aMasterPad.GetZoneConnection() );
1564 SetThermalGap( aMasterPad.GetThermalGap() );
1565
1567
1568 // Add or remove custom pad shapes:
1569 ReplacePrimitives( aMasterPad.GetPrimitives() );
1570 SetAnchorPadShape( aMasterPad.GetAnchorPadShape() );
1571
1572 SetDirty();
1573}
int GetLocalClearance(wxString *aSource) const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
Definition: pad.cpp:814
void SetAttribute(PAD_ATTRIB aAttribute)
Definition: pad.cpp:690
bool GetRemoveUnconnected() const
Definition: pad.h:609
void SetLocalSolderPasteMargin(int aMargin)
Definition: pad.h:423
ZONE_CONNECTION GetZoneConnection() const
Definition: pad.h:522
void SetRemoveUnconnected(bool aSet)
Set the unconnected removal property.
Definition: pad.h:608
void SetThermalGap(int aGap)
Definition: pad.h:553
void SetThermalSpokeAngle(const EDA_ANGLE &aAngle)
The orientation of the thermal spokes.
Definition: pad.h:540
double GetLocalSolderPasteMarginRatio() const
Definition: pad.h:425
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives() const
Accessor to the basic shape list for custom-shaped pads.
Definition: pad.h:330
EDA_ANGLE GetThermalSpokeAngle() const
Definition: pad.h:541
void SetOffset(const VECTOR2I &aOffset)
Definition: pad.h:273
void SetChamferRectRatio(double aChamferScale)
Has meaning only for chamfered rectangular pads.
Definition: pad.cpp:368
void SetLocalClearance(int aClearance)
Definition: pad.h:420
void SetKeepTopBottom(bool aSet)
Set whether we keep the top and bottom connections even if they are not connected.
Definition: pad.h:614
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: pad.h:521
int GetLocalSolderMaskMargin() const
Definition: pad.h:415
bool GetKeepTopBottom() const
Definition: pad.h:615
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: pad.h:212
void SetDelta(const VECTOR2I &aSize)
Definition: pad.h:263
const VECTOR2I & GetDelta() const
Definition: pad.h:264
void SetDrillSize(const VECTOR2I &aSize)
Definition: pad.h:266
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: pad.h:426
int GetThermalSpokeWidth() const
Definition: pad.h:531
int GetLocalSolderPasteMargin() const
Definition: pad.h:422
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:222
void SetRoundRectRadiusRatio(double aRadiusScale)
Has meaning only for rounded rectangle pads.
Definition: pad.cpp:360
void ReplacePrimitives(const std::vector< std::shared_ptr< PCB_SHAPE > > &aPrimitivesList)
Clear the current custom shape primitives list and import a new list.
void SetLocalSolderMaskMargin(int aMargin)
Definition: pad.h:416
void SetThermalSpokeWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition: pad.h:530
void SetSize(const VECTOR2I &aSize)
Definition: pad.h:256
double GetRoundRectRadiusRatio() const
Definition: pad.h:575
int GetThermalGap() const
Definition: pad.h:554
void SetChamferPositions(int aPositions)
Has meaning only for chamfered rectangular pads.
Definition: pad.h:593
void SetPadToDieLength(int aLength)
Definition: pad.h:412

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

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

◆ IsAperturePad()

bool PAD::IsAperturePad ( ) const
inline

Definition at line 407 of file pad.h.

408 {
409 return ( m_layerMask & LSET::AllCuMask() ).none();
410 }

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

386 {
387 return m_shapesDirty || m_polyDirty;
388 }

References m_polyDirty, and m_shapesDirty.

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 107 of file eda_item.h.

107{ return m_flags & ENTERED; }
#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 231 of file pad.cpp.

232{
233 FOOTPRINT* parent = GetParent();
234
235 return ( parent && parent->GetLayer() == B_Cu );
236}
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:200

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

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

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 201 of file eda_item.h.

201{ return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:497

References EDA_ITEM::m_forceVisible.

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

◆ IsFreePad()

bool PAD::IsFreePad ( ) const
Returns
true if the pad is associated with a "free" pin (not-internally-connected) and has not yet been assigned another net (ie: by being routed to).

Definition at line 189 of file pad.cpp.

190{
191 return GetShortNetname().StartsWith( wxT( "unconnected-(" ) )
192 && m_pinType == wxT( "free" );
193}
wxString GetShortNetname() const

References BOARD_CONNECTED_ITEM::GetShortNetname(), and m_pinType.

Referenced by CN_CLUSTER::Add(), KIGFX::PCB_PAINTER::draw(), isMaskAperture(), and PNS_KICAD_IFACE_BASE::syncPad().

◆ IsKnockout()

◆ IsLocked()

bool PAD::IsLocked ( ) const
overridevirtual

Reimplemented from BOARD_ITEM.

Definition at line 156 of file pad.cpp.

157{
158 if( GetParent() && GetParent()->IsLocked() )
159 return true;
160
161 return BOARD_ITEM::IsLocked();
162};
virtual bool IsLocked() const
Definition: board_item.cpp:71

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

Referenced by PCB_PLUGIN::format(), GetMsgPanelInfo(), and IsLocked().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 102 of file eda_item.h.

102{ return m_flags & IS_CHANGED; }

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsNoConnectPad()

bool PAD::IsNoConnectPad ( ) const
Returns
true if the pad is associated with an "unconnected" pin (or a no-connect symbol) and has no net.

Definition at line 182 of file pad.cpp.

183{
184 return GetShortNetname().StartsWith( wxT( "unconnected-(" ) )
185 && ( m_pinType == wxT( "no_connect" ) || m_pinType.EndsWith( wxT( "+no_connect" ) ) );
186}

References BOARD_CONNECTED_ITEM::GetShortNetname(), and m_pinType.

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

◆ 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 242 of file pad.h.

243 {
244 return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
245 }

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

631 {
632 return m_layerMask[aLayer];
633 }

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

Definition at line 420 of file eda_item.h.

420{ return false; }

Referenced by EDA_ITEM::Matches().

◆ IsRollover()

bool EDA_ITEM::IsRollover ( ) const
inlineinherited

Definition at line 110 of file eda_item.h.

111 {
112 return ( m_flags & ( IS_ROLLOVER | IS_MOVING ) ) == IS_ROLLOVER;
113 }
#define IS_ROLLOVER
Rollover active. Used for hyperlink highlighting.

References IS_MOVING, IS_ROLLOVER, and EDA_ITEM::m_flags.

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

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 106 of file eda_item.h.

106{ return m_flags & 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_TOOL::ChangeTextType(), 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(), EDIT_TOOL::doMoveSelection(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_SCREEN::MarkConnections(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), KIGFX::SCH_PAINTER::nonCached(), SCH_MOVE_TOOL::orthoLineDrag(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), EE_SELECTION_TOOL::RebuildSelection(), PCB_SELECTION_TOOL::RebuildSelection(), RENDER_3D_OPENGL::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< T >::saveCopyInUndoList(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), HIERARCHY_PANE::UpdateHierarchySelection(), PCB_BASE_FRAME::UpdateUserUnits(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ IsShownAsBitmap()

bool EDA_ITEM::IsShownAsBitmap ( ) const
inlineinherited

Definition at line 173 of file eda_item.h.

173{ return m_flags & IS_SHOWN_AS_BITMAP; }
#define IS_SHOWN_AS_BITMAP

References IS_SHOWN_AS_BITMAP, and EDA_ITEM::m_flags.

◆ IsTented()

virtual bool BOARD_ITEM::IsTented ( ) const
inlinevirtualinherited

Reimplemented in PCB_VIA.

Definition at line 133 of file board_item.h.

134 {
135 return false;
136 }

Referenced by BOARD_INSPECTION_TOOL::InspectClearance(), and DRC_TEST_PROVIDER_SILK_CLEARANCE::Run().

◆ IsType()

bool PAD::IsType ( const std::vector< 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 85 of file pad.h.

86 {
87 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
88 return true;
89
90 for( KICAD_T scanType : aScanTypes )
91 {
92 if( HasHole() )
93 {
94 if( scanType == PCB_LOCATE_HOLE_T )
95 return true;
96 else if( scanType == PCB_LOCATE_PTH_T && m_attribute != PAD_ATTRIB::NPTH )
97 return true;
98 else if( scanType == PCB_LOCATE_NPTH_T && m_attribute == PAD_ATTRIB::NPTH )
99 return true;
100 }
101 }
102
103 return false;
104 }
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:181
bool HasHole() const override
Definition: pad.h:106
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ PCB_LOCATE_NPTH_T
Definition: typeinfo.h:127
@ PCB_LOCATE_PTH_T
Definition: typeinfo.h:126
@ PCB_LOCATE_HOLE_T
Definition: typeinfo.h:125

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

◆ IterateForward() [1/2]

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

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

Definition at line 302 of file eda_item.h.

304 {
305 for( const auto& it : aList )
306 {
307 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
308 testData,
309 scanTypes ) == INSPECT_RESULT::QUIT )
310 {
312 }
313 }
314
316 }
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

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

Definition at line 322 of file eda_item.h.

324 {
325 for( const auto& it : aList )
326 {
327 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
328 testData,
329 scanTypes ) == INSPECT_RESULT::QUIT )
330 {
332 }
333 }
334
336 }

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.

Reimplemented in PCB_VIA.

Definition at line 106 of file board_item.cpp.

107{
108 const BOARD* board = GetBoard();
109 LSET layers = GetLayerSet();
110
111 // Try to be smart and useful. Check all copper first.
112 if( layers[F_Cu] && layers[B_Cu] )
113 return _( "all copper layers" );
114
115 LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
116 LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
117
118 for( LSET testLayers : { copperLayers, techLayers, layers } )
119 {
120 for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
121 {
122 if( testLayers[ bit ] )
123 {
124 wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
125
126 if( testLayers.count() > 1 )
127 layerInfo << wxS( " " ) + _( "and others" );
128
129 return layerInfo;
130 }
131 }
132 }
133
134 // No copper, no technicals: no layer
135 return _( "no layers" );
136}
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:185
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:565
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:841
@ PCBNEW_LAYER_ID_START
Definition: layer_ids.h:63
@ PCB_LAYER_ID_COUNT
Definition: layer_ids.h:137

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

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( const EDA_SEARCH_DATA 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_MARKER, LIB_TEXTBOX, SCH_FIELD, SCH_LABEL_BASE, SCH_PIN, SCH_SHEET, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, SCH_TEXTBOX, FP_TEXT, FP_TEXTBOX, NETINFO_ITEM, PCB_MARKER, PCB_TEXT, PCB_TEXTBOX, and ZONE.

Definition at line 382 of file eda_item.h.

383 {
384 return false;
385 }

Referenced by SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_FIND_REPLACE_TOOL::HasMatch(), SCH_MARKER::Matches(), LIB_TEXTBOX::Matches(), SCH_FIELD::Matches(), SCH_LABEL_BASE::Matches(), SCH_PIN::Matches(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), SCH_TEXTBOX::Matches(), FP_TEXT::Matches(), FP_TEXTBOX::Matches(), NETINFO_ITEM::Matches(), PCB_MARKER::Matches(), PCB_TEXT::Matches(), PCB_TEXTBOX::Matches(), ZONE::Matches(), SCH_FIND_REPLACE_TOOL::ReplaceAndFindNext(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_FIND_REPLACE_TOOL::UpdateFind().

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
const EDA_SEARCH_DATA 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 117 of file eda_item.cpp.

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

References EDA_SEARCH_DATA::findString, EDA_ITEM::IsReplaceable(), EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::searchAndReplace, text, WHOLEWORD, and WILDCARD.

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

227{
228 const BOARD* board = GetBoard();
229 int maxError = board ? board->GetDesignSettings().m_MaxError : ARC_HIGH_DEF;
230
231 aMergedPolygon->RemoveAllContours();
232
233 // Add the anchor pad shape in aMergedPolygon, others in aux_polyset:
234 // The anchor pad is always at 0,0
235 switch( GetAnchorPadShape() )
236 {
237 case PAD_SHAPE::RECT:
238 {
239 SHAPE_RECT rect( -GetSize().x / 2, -GetSize().y / 2, GetSize().x, GetSize().y );
240 aMergedPolygon->AddOutline( rect.Outline() );
241 }
242 break;
243
244 default:
246 TransformCircleToPolygon( *aMergedPolygon, wxPoint( 0, 0 ), GetSize().x / 2, maxError,
247 aErrorLoc );
248 break;
249 }
250
251 addPadPrimitivesToPolygon( aMergedPolygon, maxError, aErrorLoc );
252}
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aBuffer, const VECTOR2I &aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a circle to a polygon, using multiple straight lines.

References SHAPE_POLY_SET::AddOutline(), addPadPrimitivesToPolygon(), ARC_HIGH_DEF, 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 DSN::SPECCTRA_DB::makePADSTACK(), DIALOG_PAD_PROPERTIES::padValuesOK(), and TransformShapeToPolygon().

◆ Move()

void PAD::Move ( const VECTOR2I aMoveVector)
inlineoverridevirtual

Move this object.

Parameters
aMoveVectorthe move vector for this object.

Reimplemented from BOARD_ITEM.

Definition at line 694 of file pad.h.

695 {
696 m_pos += aMoveVector;
698 SetDirty();
699 }
void SetLocalCoord()
< Set relative coordinates.
Definition: pad.cpp:675

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

232{
233 wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
234 GetClass() ) );
235
236 return false;
237}
virtual wxString GetClass() const =0
Return the class name.

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

◆ operator=()

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

Definition at line 122 of file pad.cpp.

123{
125
126 ImportSettingsFrom( aOther );
128 SetPosition( aOther.GetPosition() );
129 SetPos0( aOther.GetPos0() );
130 SetNumber( aOther.GetNumber() );
131 SetPinType( aOther.GetPinType() );
132 SetPinFunction( aOther.GetPinFunction() );
133 SetSubRatsnest( aOther.GetSubRatsnest() );
137
138 return *this;
139}
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
Definition: eda_item.cpp:240
void SetPinType(const wxString &aType)
Set the pad electrical type.
Definition: pad.h:151
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
Definition: pad.h:134
void ImportSettingsFrom(const PAD &aMasterPad)
Import the pad settings from aMasterPad.
Definition: pad.cpp:1492
void SetPosition(const VECTOR2I &aPos) override
Definition: pad.h:196
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
Definition: pad.h:145
void SetPos0(const VECTOR2I &aPos)
Definition: pad.h:250
int GetSubRatsnest() const
Definition: pad.h:599
const VECTOR2I & GetPos0() const
Definition: pad.h:251

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

Referenced by PAD().

◆ PTHMask()

LSET PAD::PTHMask ( )
static

layer set for a through hole pad

Definition at line 196 of file pad.cpp.

197{
198 static LSET saved = LSET::AllCuMask() | LSET( 2, F_Mask, B_Mask );
199 return saved;
200}
@ B_Mask
Definition: layer_ids.h:106

References LSET::AllCuMask(), B_Mask, and F_Mask.

Referenced by ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper(), FABMASTER::loadFootprints(), PAD(), PAD_TOOL::PlacePad(), and DIALOG_PAD_PROPERTIES::updatePadLayersList().

◆ RenderAsBitmap()

virtual bool EDA_ITEM::RenderAsBitmap ( double  aWorldScale) const
inlinevirtualinherited

Reimplemented in SCH_ITEM.

Definition at line 163 of file eda_item.h.

163{ return false; }

◆ Replace() [1/2]

virtual bool EDA_ITEM::Replace ( const EDA_SEARCH_DATA aSearchData,
void *  aAuxData = nullptr 
)
inlinevirtualinherited

Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

This function must be overridden for items that support text replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item text was modified, otherwise false.

Reimplemented in LIB_TEXTBOX, SCH_LABEL_BASE, SCH_PIN, SCH_TEXT, SCH_TEXTBOX, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 409 of file eda_item.h.

410 {
411 return false;
412 }

◆ Replace() [2/2]

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

Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

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

Definition at line 168 of file eda_item.cpp.

169{
170 wxString text = aText;
171 wxString searchText = aSearchData.findString;
172 wxString result;
173 bool replaced = false;
174
175 if( !aSearchData.matchCase )
176 {
177 text = text.Upper();
178 searchText = searchText.Upper();
179 }
180
181 int ii = 0;
182
183 while( ii < (int) text.length() )
184 {
185 int next = text.find( searchText, ii );
186
187 if( next == wxNOT_FOUND )
188 {
189 result += aText.Mid( ii, wxString::npos );
190 break;
191 }
192
193 if( next > ii )
194 result += aText.Mid( ii, next - ii );
195
196 ii = next;
197 next += searchText.length();
198
199 bool startOK;
200 bool endOK;
201
203 {
204 startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
205 endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
206 }
207 else
208 {
209 startOK = true;
210 endOK = true;
211 }
212
213 if( startOK && endOK )
214 {
215 result += aSearchData.replaceString;
216 replaced = true;
217 ii = next;
218 }
219 else
220 {
221 result += aText.GetChar( ii );
222 ii++;
223 }
224 }
225
226 aText = result;
227 return replaced;
228}
wxString replaceString

References EDA_SEARCH_DATA::findString, EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::replaceString, text, and WHOLEWORD.

Referenced by EDA_TEXT::Replace(), SCH_FIELD::Replace(), SCH_FIND_REPLACE_TOOL::ReplaceAll(), and SCH_FIND_REPLACE_TOOL::ReplaceAndFindNext().

◆ ReplacePrimitives()

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

Clear the current custom shape primitives list and import a new list.

Copies the input, which is not altered.

Definition at line 164 of file pad_custom_shape_functions.cpp.

165{
166 // clear old list
168
169 // Import to the given shape list
170 if( aPrimitivesList.size() )
171 AppendPrimitives( aPrimitivesList );
172
173 SetDirty();
174}
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.
void DeletePrimitivesList()
Clear the basic shapes list.

References AppendPrimitives(), DeletePrimitivesList(), and SetDirty().

Referenced by ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::transferDataToPad().

◆ Rotate()

void PAD::Rotate ( const VECTOR2I aRotCentre,
const EDA_ANGLE aAngle 
)
overridevirtual

Rotate this object.

Parameters
aRotCentrethe rotation center point.

Reimplemented from BOARD_ITEM.

Definition at line 1215 of file pad.cpp.

1216{
1217 RotatePoint( m_pos, aRotCentre, aAngle );
1218
1219 m_orient += aAngle;
1221
1222 SetLocalCoord();
1223
1224 SetDirty();
1225}
EDA_ANGLE Normalize()
Definition: eda_angle.h:249

References m_orient, m_pos, EDA_ANGLE::Normalize(), RotatePoint(), SetDirty(), and SetLocalCoord().

◆ SameLogicalPadAs()

bool PAD::SameLogicalPadAs ( const PAD aOther) const
inline

Before we had custom pad shapes it was common to have multiple overlapping pads to represent a more complex shape.

Definition at line 158 of file pad.h.

159 {
160 // hide tricks behind sensible API
161 return GetParentFootprint() == aOther->GetParentFootprint()
162 && !m_number.IsEmpty() && m_number == aOther->m_number;
163 }
BOARD_ITEM_CONTAINER * GetParentFootprint() const
Definition: board_item.cpp:239

References BOARD_ITEM::GetParentFootprint(), and m_number.

◆ Set() [1/3]

template<typename T >
bool INSPECTABLE::Set ( const wxString &  aProperty,
aValue 
)
inlineinherited

Definition at line 66 of file inspectable.h.

67 {
69 TYPE_ID thisType = TYPE_HASH( *this );
70 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71 void* object = nullptr;
72
73 if( prop )
74 {
75 object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76
77 if( object )
78 prop->set<T>( object, aValue );
79 }
80
81 return object != nullptr;
82 }
void set(void *aObject, T aValue)
Definition: property.h:289

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

◆ Set() [2/3]

template<typename T >
bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
aValue 
)
inlineinherited

Definition at line 54 of file inspectable.h.

55 {
57 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
58
59 if( object )
60 aProperty->set<T>( object, aValue );
61
62 return object != nullptr;
63 }

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

◆ Set() [3/3]

bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
wxAny &  aValue 
)
inlineinherited

Definition at line 42 of file inspectable.h.

43 {
45 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
46
47 if( object )
48 aProperty->setter( object, aValue );
49
50 return object != nullptr;
51 }
virtual void setter(void *aObject, wxAny &aValue)=0

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

Referenced by PCB_PROPERTIES_PANEL::valueChanged().

◆ SetAnchorPadShape()

void PAD::SetAnchorPadShape ( PAD_SHAPE  aShape)
inline

Set the shape of the anchor pad for custom shaped pads.

Parameters
aShapeis the shape of the anchor pad shape( currently, only PAD_SHAPE::RECT or PAD_SHAPE::CIRCLE.

Definition at line 233 of file pad.h.

234 {
236 SetDirty();
237 }

References CIRCLE, m_anchorPadShape, RECT, and SetDirty().

Referenced by ImportSettingsFrom(), PAD(), PCB_PARSER::parsePAD_option(), PAD_TOOL::RecombinePad(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::transferDataToPad().

◆ SetAttribute()

void PAD::SetAttribute ( PAD_ATTRIB  aAttribute)

Definition at line 690 of file pad.cpp.

691{
692 m_attribute = aAttribute;
693
694 if( aAttribute == PAD_ATTRIB::SMD )
695 m_drill = VECTOR2I( 0, 0 );
696
697 SetDirty();
698}

References m_attribute, m_drill, SetDirty(), and SMD.

Referenced by ImportSettingsFrom(), PAD_DESC::PAD_DESC(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::transferDataToPad().

◆ SetBrightened()

◆ SetChamferPositions()

void PAD::SetChamferPositions ( int  aPositions)
inline

Has meaning only for chamfered rectangular pads.

Set the position of the chamfers for orientation 0.

Parameters
aPositionsa bit-set of RECT_CHAMFER_POSITIONS.

Definition at line 593 of file pad.h.

593{ m_chamferPositions = aPositions; }

References m_chamferPositions.

Referenced by ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::transferDataToPad().

◆ SetChamferRectRatio()

void PAD::SetChamferRectRatio ( double  aChamferScale)

Has meaning only for chamfered rectangular pads.

Set the ratio between the smaller X or Y size and chamfered corner size. Cannot be < 0.5.

Definition at line 368 of file pad.cpp.

369{
370 m_chamferScale = std::max( 0.0, std::min( aChamferScale, 0.5 ) );
371
372 SetDirty();
373}

References m_chamferScale, and SetDirty().

Referenced by ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::OnPadShapeSelection(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::transferDataToPad().

◆ SetCustomShapeInZoneOpt()

void PAD::SetCustomShapeInZoneOpt ( CUST_PAD_SHAPE_IN_ZONE  aOption)
inline

Set the option for the custom pad shape to use as clearance area in copper zones.

Parameters
aOptionis the clearance area shape CUST_PAD_SHAPE_IN_ZONE option

Definition at line 222 of file pad.h.

223 {
225 }

References m_customShapeClearanceArea.

Referenced by ImportSettingsFrom(), PCB_PARSER::parsePAD_option(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::transferDataToPad().

◆ SetDelta()

void PAD::SetDelta ( const VECTOR2I aSize)
inline

◆ SetDirty()

◆ SetDrawCoord()

void PAD::SetDrawCoord ( )

Definition at line 659 of file pad.cpp.

660{
661 FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
662
663 m_pos = m_pos0;
664
665 if( parentFootprint == nullptr )
666 return;
667
668 RotatePoint( &m_pos.x, &m_pos.y, parentFootprint->GetOrientation() );
669 m_pos += parentFootprint->GetPosition();
670
671 SetDirty();
672}

References FOOTPRINT::GetOrientation(), FOOTPRINT::GetPosition(), EDA_ITEM::m_parent, m_pos, m_pos0, RotatePoint(), SetDirty(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ SetDrillShape()

void PAD::SetDrillShape ( PAD_DRILL_SHAPE_T  aShape)
inline

◆ SetDrillSize()

void PAD::SetDrillSize ( const VECTOR2I aSize)
inline

◆ SetDrillSizeX()

void PAD::SetDrillSizeX ( const int  aX)
inline

Definition at line 268 of file pad.h.

268{ m_drill.x = aX; SetDirty(); }

References m_drill, SetDirty(), and VECTOR2< T >::x.

Referenced by PAD_DESC::PAD_DESC().

◆ SetDrillSizeY()

void PAD::SetDrillSizeY (