KiCad PCB EDA Suite
D_PAD Class Reference

#include <class_pad.h>

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

Public Member Functions

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

Set absolute coordinates.

More...
 
void SetLocalCoord ()
 

Set relative coordinates.

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

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

Static Public Member Functions

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

Public Attributes

const KIID m_Uuid
 

Static Public Attributes

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

Protected Member Functions

bool Matches (const wxString &aText, wxFindReplaceData &aSearchData)
 Function Matches compares aText against search criteria in aSearchData. More...
 

Static Protected Member Functions

static wxString LayerMaskDescribe (const BOARD *aBoard, LSET aMask)
 Helper function Return a string (to be shown to the user) describing a layer mask. More...
 

Protected Attributes

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

Private Member Functions

int calcBoundingRadius () const
 Function calcBoundingRadius returns a calculated radius of a bounding circle for this pad. More...
 
void addPadPrimitivesToPolygon (SHAPE_POLY_SET *aMergedPolygon, int aError) const
 

Private Attributes

wxString m_name
 
wxString m_pinFunction
 
wxPoint m_Pos
 
PAD_SHAPE_T m_padShape
 
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
 
bool m_shapesDirty
 
int m_effectiveBoundingRadius
 
EDA_RECT m_effectiveBoundingBox
 
std::vector< std::shared_ptr< SHAPE > > m_effectiveShapes
 
std::shared_ptr< SHAPE_SEGMENTm_effectiveHoleShape
 
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
 
int m_SubRatsnest
 
wxSize m_Drill
 
wxSize m_Size
 
PAD_DRILL_SHAPE_T m_drillShape
 
double m_roundedCornerScale
 
double m_chamferScale
 
int m_chamferPositions
 
PAD_SHAPE_T m_anchorPadShape
 
wxPoint m_Offset
 
LSET m_layerMask
 
wxSize m_DeltaSize
 
wxPoint m_Pos0
 
PAD_ATTR_T m_Attribute
 
PAD_PROP_T m_Property
 
double m_Orient
 
int m_LengthPadToDie
 
int m_LocalClearance
 
int m_LocalSolderMaskMargin
 
int m_LocalSolderPasteMargin
 
double m_LocalSolderPasteMarginRatio
 
ZONE_CONNECTION m_ZoneConnection
 
int m_ThermalWidth
 
int m_ThermalGap
 

Detailed Description

Definition at line 63 of file class_pad.h.

Constructor & Destructor Documentation

◆ D_PAD()

D_PAD::D_PAD ( MODULE parent)

Definition at line 54 of file class_pad.cpp.

54  :
56 {
57  m_Size.x = m_Size.y = Mils2iu( 60 ); // Default pad size 60 mils.
58  m_Drill.x = m_Drill.y = Mils2iu( 30 ); // Default drill size 30 mils.
59  m_Orient = 0; // Pad rotation in 1/10 degrees.
60  m_LengthPadToDie = 0;
61 
62  if( m_Parent && m_Parent->Type() == PCB_MODULE_T )
63  {
65  }
66 
67  SetShape( PAD_SHAPE_CIRCLE ); // Default pad shape is PAD_CIRCLE.
68  SetAnchorPadShape( PAD_SHAPE_CIRCLE ); // Default shape for custom shaped pads
69  // is PAD_CIRCLE.
70  SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); // Default pad drill shape is a circle.
71  m_Attribute = PAD_ATTRIB_STANDARD; // Default pad type is NORMAL (thru hole)
72  SetProperty( PAD_PROP_NONE ); // no special fabrication property
73  m_LocalClearance = 0;
77  // Parameters for round rect only:
78  m_roundedCornerScale = 0.25; // from IPC-7351C standard
79  // Parameters for chamfered rect only:
80  m_chamferScale = 0.2; // Size of chamfer: ratio of smallest of X,Y size
81  m_chamferPositions = RECT_NO_CHAMFER; // No chamfered corner
82 
83  m_ZoneConnection = ZONE_CONNECTION::INHERITED; // Use parent setting by default
84  m_ThermalWidth = 0; // Use parent setting by default
85  m_ThermalGap = 0; // Use parent setting by default
86 
88 
89  // Set layers mask to default for a standard thru hole pad.
91 
92  SetSubRatsnest( 0 ); // used in ratsnest calculations
93 
94  m_shapesDirty = true;
96 }
int m_LocalClearance
Definition: class_pad.h:691
int m_ThermalGap
Definition: class_pad.h:699
int m_LocalSolderMaskMargin
Definition: class_pad.h:692
double m_roundedCornerScale
Definition: class_pad.h:645
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
static LSET StandardMask()
layer set for a through hole pad
Definition: class_pad.cpp:99
no special fabrication property
Definition: pad_shapes.h:97
int m_LocalSolderPasteMargin
Definition: class_pad.h:693
bool m_shapesDirty
Definition: class_pad.h:624
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
wxSize m_Size
Definition: class_pad.h:641
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
void SetSubRatsnest(int aSubRatsnest)
Definition: class_pad.h:498
ZONE_CONNECTION m_ZoneConnection
Definition: class_pad.h:697
class MODULE, a footprint
Definition: typeinfo.h:89
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:195
double m_chamferScale
Definition: class_pad.h:647
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: class_pad.h:635
int m_effectiveBoundingRadius
Definition: class_pad.h:625
int m_ThermalWidth
Definition: class_pad.h:698
int m_chamferPositions
Definition: class_pad.h:649
MODULE * GetParent() const
Definition: class_pad.h:108
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
Definition: class_pad.h:319
LSET m_layerMask
Definition: class_pad.h:663
int m_LengthPadToDie
Definition: class_pad.h:679
void SetShape(PAD_SHAPE_T aShape)
Set the new shape of this pad.
Definition: class_pad.h:145
PAD_ATTR_T m_Attribute
Definition: class_pad.h:673
wxSize m_Drill
Definition: class_pad.h:640
wxPoint GetPosition() const override
Definition: class_module.h:206
double m_Orient
Definition: class_pad.h:677
double m_LocalSolderPasteMarginRatio
Definition: class_pad.h:694
void SetProperty(PAD_PROP_T aProperty)
Definition: class_pad.cpp:422
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
wxPoint m_Pos
Definition: class_pad.h:613

References CUST_PAD_SHAPE_IN_ZONE_OUTLINE, GetParent(), MODULE::GetPosition(), INHERITED, m_Attribute, m_chamferPositions, m_chamferScale, m_customShapeClearanceArea, m_Drill, m_effectiveBoundingRadius, m_layerMask, m_LengthPadToDie, m_LocalClearance, m_LocalSolderMaskMargin, m_LocalSolderPasteMargin, m_LocalSolderPasteMarginRatio, m_Orient, EDA_ITEM::m_Parent, m_Pos, m_roundedCornerScale, m_shapesDirty, m_Size, m_ThermalGap, m_ThermalWidth, m_ZoneConnection, PAD_ATTRIB_STANDARD, PAD_DRILL_SHAPE_CIRCLE, PAD_PROP_NONE, PAD_SHAPE_CIRCLE, PCB_MODULE_T, RECT_NO_CHAMFER, SetAnchorPadShape(), SetDrillShape(), SetProperty(), SetShape(), SetSubRatsnest(), StandardMask(), and EDA_ITEM::Type().

Referenced by Clone().

Member Function Documentation

◆ addPadPrimitivesToPolygon()

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

Definition at line 176 of file pad_custom_shape_functions.cpp.

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

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

Referenced by GetBestAnchorPosition(), and MergePrimitivesAsPolygon().

◆ AddPrimitive()

void D_PAD::AddPrimitive ( DRAWSEGMENT aPrimitive)

Definition at line 160 of file pad_custom_shape_functions.cpp.

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

References m_editPrimitives, and m_shapesDirty.

Referenced by PAD_TOOL::recombinePad().

◆ AddPrimitiveArc()

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

Definition at line 85 of file pad_custom_shape_functions.cpp.

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

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

◆ AddPrimitiveCircle()

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

Definition at line 114 of file pad_custom_shape_functions.cpp.

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

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

◆ AddPrimitiveCurve()

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

Definition at line 99 of file pad_custom_shape_functions.cpp.

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

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

◆ AddPrimitivePoly() [1/2]

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

Has meaning only for custom shape pads.

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

Definition at line 47 of file pad_custom_shape_functions.cpp.

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

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

Referenced by MICROWAVE_TOOL::createFootprint().

◆ AddPrimitivePoly() [2/2]

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

Definition at line 63 of file pad_custom_shape_functions.cpp.

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

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

◆ AddPrimitiveRect()

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

Definition at line 126 of file pad_custom_shape_functions.cpp.

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

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

◆ AddPrimitives()

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

Add to the basic shape list.

Definition at line 151 of file pad_custom_shape_functions.cpp.

152 {
153  for( const std::shared_ptr<DRAWSEGMENT>& prim : aPrimitivesList )
154  m_editPrimitives.push_back( prim );
155 
156  m_shapesDirty = true;
157 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:622
bool m_shapesDirty
Definition: class_pad.h:624

References m_editPrimitives, and m_shapesDirty.

◆ AddPrimitiveSegment()

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

Definition at line 74 of file pad_custom_shape_functions.cpp.

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

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

◆ ApertureMask()

LSET D_PAD::ApertureMask ( )
static

layer set for an aperture pad

Definition at line 127 of file class_pad.cpp.

128 {
129  static LSET saved( 1, F_Paste );
130  return saved;
131 }
LSET is a set of PCB_LAYER_IDs.

References F_Paste.

Referenced by PAD_FIXTURE::MakeAperture().

◆ BuildEffectiveShapes()

void D_PAD::BuildEffectiveShapes ( ) const

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

Definition at line 221 of file class_pad.cpp.

222 {
223  m_effectiveShapes.clear();
224  m_effectiveHoleShape = nullptr;
225 
226  auto add = [this]( SHAPE* aShape )
227  {
228  m_effectiveShapes.emplace_back( aShape );
229  };
230 
231  wxPoint shapePos = ShapePos(); // Fetch only once; rotation involves trig
232  PAD_SHAPE_T effectiveShape = GetShape();
233 
234  if( GetShape() == PAD_SHAPE_CUSTOM )
235  effectiveShape = GetAnchorPadShape();
236 
237  switch( effectiveShape )
238  {
239  case PAD_SHAPE_CIRCLE:
240  add( new SHAPE_CIRCLE( shapePos, m_Size.x / 2 ) );
241  break;
242 
243  case PAD_SHAPE_OVAL:
244  {
245  wxSize half_size = m_Size / 2;
246  int half_width = std::min( half_size.x, half_size.y );
247  wxPoint half_len( half_size.x - half_width, half_size.y - half_width );
248 
249  RotatePoint( &half_len, m_Orient );
250 
251  add( new SHAPE_SEGMENT( shapePos - half_len, shapePos + half_len, half_width * 2 ) );
252  }
253  break;
254 
255  case PAD_SHAPE_RECT:
256  if( m_Orient == 0 || m_Orient == 1800 )
257  {
258  add( new SHAPE_RECT( shapePos - m_Size / 2, m_Size.x, m_Size.y ) );
259  break;
260  }
261  else if( m_Orient == 900 || m_Orient == -900 )
262  {
263  wxSize rot_size( m_Size.y, m_Size.x );
264  add( new SHAPE_RECT( shapePos - rot_size / 2, rot_size.x, rot_size.y ) );
265  break;
266  }
267 
268  // Not at a cartesian angle; fall through to general case
270 
271  case PAD_SHAPE_TRAPEZOID:
272  case PAD_SHAPE_ROUNDRECT:
273  {
274  int r = GetRoundRectCornerRadius();
275  wxPoint half_size( m_Size.x / 2, m_Size.y / 2 );
276  wxSize trap_delta( 0, 0 );
277 
278  if( effectiveShape == PAD_SHAPE_ROUNDRECT )
279  half_size -= wxPoint( r, r );
280  else if( effectiveShape == PAD_SHAPE_TRAPEZOID )
281  trap_delta = m_DeltaSize / 2;
282 
283  SHAPE_LINE_CHAIN corners;
284 
285  corners.Append( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
286  corners.Append( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
287  corners.Append( half_size.x + trap_delta.y, half_size.y - trap_delta.x );
288  corners.Append( -half_size.x - trap_delta.y, half_size.y + trap_delta.x );
289 
290  corners.Rotate( -DECIDEG2RAD( m_Orient ) );
291  corners.Move( shapePos );
292 
293  add( new SHAPE_SIMPLE( corners ) );
294 
295  if( effectiveShape == PAD_SHAPE_ROUNDRECT )
296  {
297  add( new SHAPE_SEGMENT( corners.CPoint( 0 ), corners.CPoint( 1 ), r * 2 ) );
298  add( new SHAPE_SEGMENT( corners.CPoint( 1 ), corners.CPoint( 2 ), r * 2 ) );
299  add( new SHAPE_SEGMENT( corners.CPoint( 2 ), corners.CPoint( 3 ), r * 2 ) );
300  add( new SHAPE_SEGMENT( corners.CPoint( 3 ), corners.CPoint( 0 ), r * 2 ) );
301  }
302  }
303  break;
304 
306  {
307  SHAPE_POLY_SET outline;
308  auto board = GetBoard();
309  int maxError = ARC_HIGH_DEF;
310 
311  if( board )
312  maxError = board->GetDesignSettings().m_MaxError;
313 
316  GetChamferPositions(), maxError );
317 
318  add( new SHAPE_SIMPLE( outline.COutline( 0 ) ) );
319  }
320  break;
321 
322  default:
323  wxFAIL_MSG( "D_PAD::buildEffectiveShapes: Unsupported pad shape: "
324  + PAD_SHAPE_T_asString( effectiveShape ) );
325  break;
326  }
327 
328  if( GetShape() == PAD_SHAPE_CUSTOM )
329  {
330  for( const std::shared_ptr<DRAWSEGMENT>& primitive : m_editPrimitives )
331  {
332  for( SHAPE* shape : primitive->MakeEffectiveShapes() )
333  {
334  shape->Rotate( -DECIDEG2RAD( m_Orient ) );
335  shape->Move( shapePos );
336  add( shape );
337  }
338  }
339  }
340 
341  // Bounding box and radius
342  //
344 
345  // reset the bbox to uninitialized state to prepare for merging
347 
348  for( const std::shared_ptr<SHAPE>& shape : m_effectiveShapes )
349  {
350  BOX2I r = shape->BBox();
352  wxSize( r.GetWidth(), r.GetHeight() ) ) );
353  }
354  // Hole shape
355  //
356  wxSize half_size = m_Drill / 2;
357  int half_width = std::min( half_size.x, half_size.y );
358  wxPoint half_len( half_size.x - half_width, half_size.y - half_width );
359 
360  RotatePoint( &half_len, m_Orient );
361 
362  m_effectiveHoleShape = std::make_shared<SHAPE_SEGMENT>( m_Pos - half_len, m_Pos + half_len,
363  half_width * 2 );
364 
365  // All done
366  //
367  m_shapesDirty = false;
368 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:622
SHAPE_SIMPLE.
Definition: shape_simple.h:42
#define KI_FALLTHROUGH
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
int calcBoundingRadius() const
Function calcBoundingRadius returns a calculated radius of a bounding circle for this pad.
Definition: class_pad.cpp:142
static std::string PAD_SHAPE_T_asString(PAD_SHAPE_T a)
Definition: pad_shapes.h:45
std::vector< std::shared_ptr< SHAPE > > m_effectiveShapes
Definition: class_pad.h:627
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:168
bool m_shapesDirty
Definition: class_pad.h:624
void Move(const VECTOR2I &aVector) override
wxSize m_Size
Definition: class_pad.h:641
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: class_pad.h:628
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
BOX2 handles a 2-D bounding box, built on top of an origin point and size vector, both of templated c...
Definition: box2.h:42
PAD_SHAPE_T
Enum PAD_SHAPE_T is the set of pad shapes, used with D_PAD::{Set,Get}Shape()
Definition: pad_shapes.h:33
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
int GetChamferPositions() const
Definition: class_pad.h:491
const VECTOR2I & CPoint(int aIndex) const
Function Point()
SHAPE_POLY_SET.
coord_type GetWidth() const
Definition: box2.h:196
double GetChamferRectRatio() const
Definition: class_pad.h:483
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int m_effectiveBoundingRadius
Definition: class_pad.h:625
SHAPE.
Definition: shape.h:74
wxSize m_DeltaSize
Definition: class_pad.h:666
void Rotate(double aAngle, const VECTOR2I &aCenter=VECTOR2I(0, 0)) override
Function Rotate rotates all vertices by a given angle.
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
wxPoint ShapePos() const
Definition: class_pad.cpp:491
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
double DECIDEG2RAD(double deg)
Definition: trigo.h:218
coord_type GetHeight() const
Definition: box2.h:197
int GetRoundRectCornerRadius() const
Definition: class_pad.cpp:163
EDA_RECT m_effectiveBoundingBox
Definition: class_pad.h:626
wxSize m_Drill
Definition: class_pad.h:640
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:154
double m_Orient
Definition: class_pad.h:677
const Vec & GetOrigin() const
Definition: box2.h:192
const wxSize & GetSize() const
Definition: class_pad.h:221
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aError)
convert a rectangle with rounded corners and/or chamfered corners to a polygon Convert rounded corner...
wxPoint m_Pos
Definition: class_pad.h:613

References SHAPE_LINE_CHAIN::Append(), calcBoundingRadius(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), DECIDEG2RAD(), GetAnchorPadShape(), BOARD_ITEM::GetBoard(), GetChamferPositions(), GetChamferRectRatio(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetOrigin(), GetRoundRectCornerRadius(), GetShape(), GetSize(), BOX2< Vec >::GetWidth(), KI_FALLTHROUGH, m_DeltaSize, m_Drill, m_editPrimitives, m_effectiveBoundingBox, m_effectiveBoundingRadius, m_effectiveHoleShape, m_effectiveShapes, m_Orient, m_Pos, m_shapesDirty, m_Size, EDA_RECT::Merge(), SHAPE_LINE_CHAIN::Move(), PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_T_asString(), PAD_SHAPE_TRAPEZOID, SHAPE_LINE_CHAIN::Rotate(), RotatePoint(), ShapePos(), TransformRoundChamferedRectToPolygon(), wxPoint::x, and wxPoint::y.

Referenced by GetBoundingBox(), GetBoundingRadius(), GetEffectiveHoleShape(), and GetEffectiveShapes().

◆ calcBoundingRadius()

int D_PAD::calcBoundingRadius ( ) const
private

Function calcBoundingRadius returns a calculated radius of a bounding circle for this pad.

Definition at line 142 of file class_pad.cpp.

143 {
144  int radius = 0;
145  SHAPE_POLY_SET polygons;
147 
148  for( int cnt = 0; cnt < polygons.OutlineCount(); ++cnt )
149  {
150  const SHAPE_LINE_CHAIN& poly = polygons.COutline( cnt );
151 
152  for( int ii = 0; ii < poly.PointCount(); ++ii )
153  {
154  int dist = KiROUND( ( poly.CPoint( ii ) - m_Pos ).EuclideanNorm() );
155  radius = std::max( radius, dist );
156  }
157  }
158 
159  return radius + 1;
160 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:128
int OutlineCount() const
Returns the number of outlines in the set
int PointCount() const
Function PointCount()
double dist(const double ax, const double ay, const double bx, const double by)
Definition: delauney.h:168
const VECTOR2I & CPoint(int aIndex) const
Function Point()
SHAPE_POLY_SET.
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aMaxError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon.
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
wxPoint m_Pos
Definition: class_pad.h:613

References SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), dist(), EuclideanNorm(), KiROUND(), m_Pos, SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::PointCount(), and TransformShapeWithClearanceToPolygon().

Referenced by BuildEffectiveShapes().

◆ ClassOf()

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

Definition at line 82 of file class_pad.h.

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

References PCB_PAD_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 233 of file base_struct.h.

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

References EDA_ITEM::m_Flags.

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

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 245 of file base_struct.h.

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

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 154 of file view_item.h.

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

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

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

◆ Clone()

EDA_ITEM * D_PAD::Clone ( ) const
overridevirtual

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

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

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Definition at line 995 of file class_pad.cpp.

996 {
997  return new D_PAD( *this );
998 }
D_PAD(MODULE *parent)
Definition: class_pad.cpp:54

References D_PAD().

Referenced by ClonePad().

◆ ClonePad()

D_PAD* D_PAD::ClonePad ( ) const
inline

same as Clone, but returns a D_PAD item.

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

Definition at line 569 of file class_pad.h.

570  {
571  return (D_PAD*) Clone();
572  }
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_pad.cpp:995

References Clone().

◆ Collide() [1/2]

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

Definition at line 850 of file class_pad.cpp.

851 {
852  int actual = INT_MAX;
853 
854  for( const std::shared_ptr<SHAPE>& shape : GetEffectiveShapes() )
855  {
856  int this_dist;
857 
858  if( shape->Collide( aSeg, aMinClearance, &this_dist ) )
859  actual = std::min( actual, this_dist );
860  }
861 
862  if( actual < INT_MAX )
863  {
864  if( aActual )
865  *aActual = std::max( 0, actual );
866 
867  return true;
868  }
869 
870  return false;
871 }
const std::vector< std::shared_ptr< SHAPE > > & GetEffectiveShapes() const
Function GetEffectiveShapes Some pad shapes can be complex (rounded/chamfered rectangle),...
Definition: class_pad.cpp:194

References GetEffectiveShapes().

Referenced by DRC::doPadToPadsDrc().

◆ Collide() [2/2]

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

Definition at line 816 of file class_pad.cpp.

817 {
818  int center2center = KiROUND( EuclideanNorm( aPad->ShapePos() - ShapePos() ) );
819 
820  // Quick test: Clearance is OK if the bounding circles are further away than aMinClearance
821  if( center2center - GetBoundingRadius() - aPad->GetBoundingRadius() >= aMinClearance )
822  return false;
823 
824  int actual = INT_MAX;
825 
826  for( const std::shared_ptr<SHAPE>& aShape : GetEffectiveShapes() )
827  {
828  for( const std::shared_ptr<SHAPE>& bShape : aPad->GetEffectiveShapes() )
829  {
830  int this_dist;
831 
832  if( aShape->Collide( bShape.get(), aMinClearance, &this_dist ) )
833  actual = std::min( actual, this_dist );
834  }
835  }
836 
837  if( actual < INT_MAX )
838  {
839  // returns the actual clearance (clearance < aMinClearance) for diags:
840  if( aActual )
841  *aActual = std::max( 0, actual );
842 
843  return true;
844  }
845 
846  return false;
847 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:128
const std::vector< std::shared_ptr< SHAPE > > & GetEffectiveShapes() const
Function GetEffectiveShapes Some pad shapes can be complex (rounded/chamfered rectangle),...
Definition: class_pad.cpp:194
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.cpp:212
wxPoint ShapePos() const
Definition: class_pad.cpp:491
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68

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

◆ Compare()

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

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

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

Definition at line 874 of file class_pad.cpp.

875 {
876  int diff;
877 
878  if( ( diff = padref->GetShape() - padcmp->GetShape() ) != 0 )
879  return diff;
880 
881  if( ( diff = padref->GetDrillShape() - padcmp->GetDrillShape() ) != 0)
882  return diff;
883 
884  if( ( diff = padref->m_Drill.x - padcmp->m_Drill.x ) != 0 )
885  return diff;
886 
887  if( ( diff = padref->m_Drill.y - padcmp->m_Drill.y ) != 0 )
888  return diff;
889 
890  if( ( diff = padref->m_Size.x - padcmp->m_Size.x ) != 0 )
891  return diff;
892 
893  if( ( diff = padref->m_Size.y - padcmp->m_Size.y ) != 0 )
894  return diff;
895 
896  if( ( diff = padref->m_Offset.x - padcmp->m_Offset.x ) != 0 )
897  return diff;
898 
899  if( ( diff = padref->m_Offset.y - padcmp->m_Offset.y ) != 0 )
900  return diff;
901 
902  if( ( diff = padref->m_DeltaSize.x - padcmp->m_DeltaSize.x ) != 0 )
903  return diff;
904 
905  if( ( diff = padref->m_DeltaSize.y - padcmp->m_DeltaSize.y ) != 0 )
906  return diff;
907 
908 // TODO: test custom shapes
909 
910  // Dick: specctra_export needs this
911  // Lorenzo: gencad also needs it to implement padstacks!
912 
913 #if __cplusplus >= 201103L
914  long long d = padref->m_layerMask.to_ullong() - padcmp->m_layerMask.to_ullong();
915  if( d < 0 )
916  return -1;
917  else if( d > 0 )
918  return 1;
919 
920  return 0;
921 #else
922  // these strings are not typically constructed, since we don't get here often.
923  std::string s1 = padref->m_layerMask.to_string();
924  std::string s2 = padcmp->m_layerMask.to_string();
925  return s1.compare( s2 );
926 #endif
927 }
wxSize m_Size
Definition: class_pad.h:641
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:320
wxSize m_DeltaSize
Definition: class_pad.h:666
LSET m_layerMask
Definition: class_pad.h:663
wxSize m_Drill
Definition: class_pad.h:640
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:154
wxPoint m_Offset
Definition: class_pad.h:661

References GetDrillShape(), GetShape(), m_DeltaSize, m_Drill, m_layerMask, m_Offset, m_Size, wxPoint::x, and wxPoint::y.

Referenced by CreatePadsShapesSection().

◆ ConnSMDMask()

LSET D_PAD::ConnSMDMask ( )
static

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

Definition at line 113 of file class_pad.cpp.

114 {
115  static LSET saved( 2, F_Cu, F_Mask );
116  return saved;
117 }
LSET is a set of PCB_LAYER_IDs.

References F_Cu, and F_Mask.

◆ DeletePrimitivesList()

void D_PAD::DeletePrimitivesList ( )

clear the basic shapes list

Definition at line 169 of file pad_custom_shape_functions.cpp.

170 {
171  m_editPrimitives.clear();
172  m_shapesDirty = true;
173 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:622
bool m_shapesDirty
Definition: class_pad.h:624

References m_editPrimitives, and m_shapesDirty.

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

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 124 of file class_board_item.cpp.

125 {
126  auto parent = GetParent();
127 
128  if( parent )
129  parent->Remove( this );
130 
131  delete this;
132 }
BOARD_ITEM_CONTAINER * GetParent() const

References BOARD_ITEM::GetParent().

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

◆ Duplicate()

BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlineinherited

Function Duplicate creates a copy of a BOARD_ITEM.

Definition at line 193 of file class_board_item.h.

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

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

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), EDIT_TOOL::Duplicate(), GPCB_PLUGIN::FootprintLoad(), PCB_IO::FootprintLoad(), PCB_IO::FootprintSave(), ARRAY_CREATOR::Invoke(), and FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD().

◆ Flip() [1/2]

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

Function Flip Flip this object, i.e.

change the board side for this object

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

Reimplemented from BOARD_ITEM.

Definition at line 439 of file class_pad.cpp.

440 {
441  if( aFlipLeftRight )
442  {
443  MIRROR( m_Pos.x, aCentre.x );
444  MIRROR( m_Pos0.x, 0 );
445  MIRROR( m_Offset.x, 0 );
446  MIRROR( m_DeltaSize.x, 0 );
447  }
448  else
449  {
450  MIRROR( m_Pos.y, aCentre.y );
451  MIRROR( m_Pos0.y, 0 );
452  MIRROR( m_Offset.y, 0 );
453  MIRROR( m_DeltaSize.y, 0 );
454  }
455 
457 
458  // flip pads layers
459  // PADS items are currently on all copper layers, or
460  // currently, only on Front or Back layers.
461  // So the copper layers count is not taken in account
463 
464  // Flip the basic shapes, in custom pads
465  FlipPrimitives();
466 
467  m_shapesDirty = true;
468 }
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask,...
Definition: lset.cpp:531
void FlipPrimitives()
Flip the basic shapes, in custom pads.
Definition: class_pad.cpp:472
bool m_shapesDirty
Definition: class_pad.h:624
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:175
wxSize m_DeltaSize
Definition: class_pad.h:666
LSET m_layerMask
Definition: class_pad.h:663
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:324
wxPoint m_Pos0
Definition: class_pad.h:670
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:315
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:430
wxPoint m_Offset
Definition: class_pad.h:661
wxPoint m_Pos
Definition: class_pad.h:613

References FlipLayerMask(), FlipPrimitives(), GetOrientation(), m_DeltaSize, m_layerMask, m_Offset, m_Pos, m_Pos0, m_shapesDirty, MIRROR(), SetLayerSet(), SetOrientation(), wxPoint::x, and wxPoint::y.

◆ Flip() [2/2]

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

Definition at line 309 of file class_board_item.h.

310  {
311  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
312  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Function Flip Flip this object, i.e.

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

◆ FlipPrimitives()

void D_PAD::FlipPrimitives ( )

Flip the basic shapes, in custom pads.

Definition at line 472 of file class_pad.cpp.

473 {
474  for( std::shared_ptr<DRAWSEGMENT>& primitive : m_editPrimitives )
475  primitive->Flip( wxPoint( 0, 0 ), false );
476 
477  m_shapesDirty = true;
478 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:622
bool m_shapesDirty
Definition: class_pad.h:624

References m_editPrimitives, and m_shapesDirty.

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

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 84 of file inspectable.h.

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

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

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

◆ Get() [2/3]

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

Definition at line 93 of file inspectable.h.

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

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

◆ Get() [3/3]

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

Definition at line 102 of file inspectable.h.

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

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

◆ GetAnchorPadShape()

PAD_SHAPE_T D_PAD::GetAnchorPadShape ( ) const
inline

Function GetAnchorPadShape.

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

Definition at line 168 of file class_pad.h.

168 { return m_anchorPadShape; }
PAD_SHAPE_T m_anchorPadShape
Definition: class_pad.h:651

References m_anchorPadShape.

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

◆ GetAttribute()

◆ GetBestAnchorPosition()

bool D_PAD::GetBestAnchorPosition ( VECTOR2I aPos)

Definition at line 224 of file pad_custom_shape_functions.cpp.

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

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

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 54 of file class_board_item.cpp.

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

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

Referenced by BuildEffectiveShapes(), ZONE_CONTAINER::BuildSmoothedPoly(), test::DRC_TEST_PROVIDER_CLEARANCE_BASE::checkClearanceSegmToPad(), TEXTE_PCB::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), BOARD_ITEM::GetLayerName(), VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), GetRule(), VIA::GetSelectMenuText(), GetSelectMenuText(), ZONE_CONTAINER::GetSelectMenuText(), GetSolderMaskMargin(), GetSolderPasteMargin(), BOARD::GetTrackLength(), TRACK::GetWidthConstraints(), MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD_CONNECTED_ITEM::SetNet(), BOARD_CONNECTED_ITEM::SetNetCode(), ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(), ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(), MODULE::ViewBBox(), and ViewGetLOD().

◆ GetBoundingBox()

const EDA_RECT D_PAD::GetBoundingBox ( ) const
overridevirtual

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

Reimplemented from EDA_ITEM.

Definition at line 371 of file class_pad.cpp.

372 {
373  if( m_shapesDirty )
375 
376  return m_effectiveBoundingBox;
377 }
bool m_shapesDirty
Definition: class_pad.h:624
void BuildEffectiveShapes() const
Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit...
Definition: class_pad.cpp:221
EDA_RECT m_effectiveBoundingBox
Definition: class_pad.h:626

References BuildEffectiveShapes(), m_effectiveBoundingBox, and m_shapesDirty.

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

◆ GetBoundingRadius()

int D_PAD::GetBoundingRadius ( ) const

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

The center is the pad position NOT THE SHAPE POS!

Definition at line 212 of file class_pad.cpp.

213 {
214  if( m_shapesDirty )
216 
218 }
bool m_shapesDirty
Definition: class_pad.h:624
void BuildEffectiveShapes() const
Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit...
Definition: class_pad.cpp:221
int m_effectiveBoundingRadius
Definition: class_pad.h:625

References BuildEffectiveShapes(), m_effectiveBoundingRadius, and m_shapesDirty.

Referenced by test::DRC_TEST_PROVIDER_CLEARANCE_BASE::checkClearancePadToPad(), Collide(), and HitTest().

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

Function GetCenter()

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

Returns
centre point of the item

Reimplemented in DRAWSEGMENT.

Definition at line 120 of file class_board_item.h.

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

References EDA_ITEM::GetPosition().

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

◆ GetChamferPositions()

◆ GetChamferRectRatio()

◆ GetClass()

wxString D_PAD::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 513 of file class_pad.h.

514  {
515  return wxT( "PAD" );
516  }

◆ GetClearance()

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

Function GetClearance returns the clearance in internal units.

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

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

Definition at line 95 of file board_connected_item.cpp.

96 {
97  BOARD* board = GetBoard();
98  int clearance = 0;
99  wxString source;
100  wxString* localSource = aSource ? &source : nullptr;
101  BOARD_CONNECTED_ITEM* second = dynamic_cast<BOARD_CONNECTED_ITEM*>( aItem );
102 
103  // No clearance if "this" is not (yet) linked to a board therefore no available netclass
104  if( !board )
105  return clearance;
106 
107  // LEVEL 1: local overrides (pad, footprint, etc.)
108  //
109  if( GetLocalClearanceOverrides() > clearance )
110  clearance = GetLocalClearanceOverrides( localSource );
111 
112  if( second && second->GetLocalClearanceOverrides() > clearance )
113  clearance = second->GetLocalClearanceOverrides( localSource );
114 
115  if( clearance )
116  {
117  if( aSource )
118  *aSource = *localSource;
119 
120  return clearance;
121  }
122 
123  // LEVEL 2: Rules
124  //
125  if( GetRuleClearance( aItem, &clearance, aSource ) )
126  return clearance;
127 
128  // LEVEL 3: Accumulated local settings, netclass settings, & board design settings
129  //
131  NETCLASS* netclass = GetEffectiveNetclass();
132  NETCLASS* secondNetclass = second ? second->GetEffectiveNetclass() : nullptr;
133 
134  if( bds.m_MinClearance > clearance )
135  {
136  if( aSource )
137  *aSource = _( "board minimum" );
138 
139  clearance = bds.m_MinClearance;
140  }
141 
142  if( netclass && netclass->GetClearance() > clearance )
143  clearance = netclass->GetClearance( aSource );
144 
145  if( secondNetclass && secondNetclass->GetClearance() > clearance )
146  clearance = secondNetclass->GetClearance( aSource );
147 
148  if( aItem && aItem->GetLayer() == Edge_Cuts && bds.m_CopperEdgeClearance > clearance )
149  {
150  if( aSource )
151  *aSource = _( "board edge" );
152 
153  clearance = bds.m_CopperEdgeClearance;
154  }
155 
156  if( GetLocalClearance() > clearance )
157  clearance = GetLocalClearance( aSource );
158 
159  if( second && second->GetLocalClearance() > clearance )
160  clearance = second->GetLocalClearance( aSource );
161 
162  return clearance;
163 }
virtual int GetLocalClearance(wxString *aSource=nullptr) const
Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
int GetClearance(wxString *aSource=nullptr) const
Definition: netclass.h:158
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
NETCLASS handles a collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:49
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual int GetLocalClearanceOverrides(wxString *aSource=nullptr) const
Function GetLocalClearanceOverrides returns any local clearance overrides set in the "classic" (ie: p...
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
#define _(s)
Definition: 3d_actions.cpp:33
NETCLASS * GetEffectiveNetclass() const
Function GetEffectiveNetclass returns the NETCLASS for this item, or the default netclass if none is ...
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
virtual bool GetRuleClearance(BOARD_ITEM *aItem, int *aClearance, wxString *aSource) const
Function GetRuleClearance returns any rule-based clearance.
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References _, Edge_Cuts, BOARD_ITEM::GetBoard(), NETCLASS::GetClearance(), BOARD::GetDesignSettings(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), BOARD_ITEM::GetLayer(), BOARD_CONNECTED_ITEM::GetLocalClearance(), BOARD_CONNECTED_ITEM::GetLocalClearanceOverrides(), BOARD_CONNECTED_ITEM::GetRuleClearance(), BOARD_DESIGN_SETTINGS::m_CopperEdgeClearance, and BOARD_DESIGN_SETTINGS::m_MinClearance.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), ZONE_FILLER::buildCopperItemClearances(), DRC::doPadToPadsDrc(), DRC::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), GetMsgPanelInfo(), DRC::testZones(), and TRACK::ViewBBox().

◆ GetCustomShapeInZoneOpt()

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

Definition at line 174 of file class_pad.h.

175  {
177  }
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
Definition: class_pad.h:635

References m_customShapeClearanceArea.

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

◆ GetDelta()

◆ GetDrillShape()

◆ GetDrillSize()

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 237 of file base_struct.h.

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

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

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

◆ GetEffectiveHoleShape()

const SHAPE_SEGMENT * D_PAD::GetEffectiveHoleShape ( ) const

Function GetEffectiveHoleShape Returns a list of SHAPE objects representing the pad's hole.

Definition at line 203 of file class_pad.cpp.

204 {
205  if( m_shapesDirty )
207 
208  return m_effectiveHoleShape.get();
209 }
bool m_shapesDirty
Definition: class_pad.h:624
void BuildEffectiveShapes() const
Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit...
Definition: class_pad.cpp:221
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
Definition: class_pad.h:628

References BuildEffectiveShapes(), m_effectiveHoleShape, and m_shapesDirty.

Referenced by BOARD_ADAPTER::createNewPadDrill(), DRC::doPadToPadsDrc(), KIGFX::PCB_PAINTER::draw(), and TransformHoleWithClearanceToPolygon().

◆ GetEffectiveNetclass()

NETCLASS * BOARD_CONNECTED_ITEM::GetEffectiveNetclass ( ) const
inherited

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

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

Definition at line 76 of file board_connected_item.cpp.

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

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

Referenced by BOARD_CONNECTED_ITEM::GetClearance().

◆ GetEffectiveShapes()

const std::vector< std::shared_ptr< SHAPE > > & D_PAD::GetEffectiveShapes ( ) const

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

This routine returns a list of simple shapes which make up the pad for use with routing, collision determiniation, etc.

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

Definition at line 194 of file class_pad.cpp.

195 {
196  if( m_shapesDirty )
198 
199  return m_effectiveShapes;
200 }
std::vector< std::shared_ptr< SHAPE > > m_effectiveShapes
Definition: class_pad.h:627
bool m_shapesDirty
Definition: class_pad.h:624
void BuildEffectiveShapes() const
Rebuilds the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit...
Definition: class_pad.cpp:221

References BuildEffectiveShapes(), m_effectiveShapes, and m_shapesDirty.

Referenced by test::DRC_TEST_PROVIDER_CLEARANCE_BASE::checkClearancePadToPad(), Collide(), BOARD_ADAPTER::createNewPadWithClearance(), KIGFX::PCB_PAINTER::draw(), and PNS_KICAD_IFACE_BASE::syncPad().

◆ GetEffectiveZoneConnection()

ZONE_CONNECTION D_PAD::GetEffectiveZoneConnection ( ) const

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

Definition at line 628 of file class_pad.cpp.

629 {
630  MODULE* module = GetParent();
631 
633  return module->GetZoneConnection();
634  else
635  return m_ZoneConnection;
636 }
ZONE_CONNECTION GetZoneConnection() const
Definition: class_module.h:247
ZONE_CONNECTION m_ZoneConnection
Definition: class_pad.h:697
MODULE * GetParent() const
Definition: class_pad.h:108

References GetParent(), MODULE::GetZoneConnection(), INHERITED, and m_ZoneConnection.

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

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

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

Reimplemented in DRAWSEGMENT, and TRACK.

Definition at line 344 of file base_struct.h.

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

References EDA_ITEM::GetPosition().

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

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Function GetLayer returns the primary layer this item is on.

Reimplemented in ZONE_CONTAINER.

Definition at line 165 of file class_board_item.h.

165 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

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

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

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

Returns
wxString containing the layer name associated with this item.

Definition at line 68 of file class_board_item.cpp.

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

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

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

◆ GetLayerSet()

◆ GetLocalClearance()

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

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

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

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

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 520 of file class_pad.cpp.

521 {
522  if( aSource )
523  *aSource = wxString::Format( _( "pad %s" ), GetName() );
524 
525  return m_LocalClearance;
526 }
int m_LocalClearance
Definition: class_pad.h:691
const wxString & GetName() const
Definition: class_pad.h:129
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33

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

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

◆ GetLocalClearanceOverrides()

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

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

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

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 506 of file class_pad.cpp.

507 {
508  // A pad can have specific clearance that overrides its NETCLASS clearance value
509  if( GetLocalClearance() )
510  return GetLocalClearance( aSource );
511 
512  // A footprint can have a specific clearance value
513  if( GetParent() && GetParent()->GetLocalClearance() )
514  return GetParent()->GetLocalClearance( aSource );
515 
516  return 0;
517 }
int GetLocalClearance(wxString *aSource=nullptr) const override
Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system.
Definition: class_pad.cpp:520
int GetLocalClearance(wxString *aSource=nullptr) const
Definition: class_module.h:230
MODULE * GetParent() const
Definition: class_pad.h:108

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

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLocalSolderMaskMargin()

◆ GetLocalSolderPasteMargin()

int D_PAD::GetLocalSolderPasteMargin ( ) const
inline

◆ GetLocalSolderPasteMarginRatio()

double D_PAD::GetLocalSolderPasteMarginRatio ( ) const
inline

◆ GetMenuImage()

BITMAP_DEF D_PAD::GetMenuImage ( ) const
overridevirtual

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

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

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 989 of file class_pad.cpp.

990 {
991  return pad_xpm;
992 }
const BITMAP_OPAQUE pad_xpm[1]
Definition: pad.cpp:41

References pad_xpm.

◆ GetMsgPanelInfo()

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

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

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 661 of file class_pad.cpp.

662 {
663  EDA_UNITS units = aFrame->GetUserUnits();
664  wxString msg, msg2;
665  BOARD* board = GetBoard();
667  MODULE* module = (MODULE*) m_Parent;
668 
669  if( module )
670  aList.emplace_back( _( "Footprint" ), module->GetReference(), DARKCYAN );
671 
672  aList.emplace_back( _( "Pad" ), m_name, BROWN );
673 
674  if( !GetPinFunction().IsEmpty() )
675  aList.emplace_back( _( "Pin Name" ), GetPinFunction(), BROWN );
676 
677  aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN );
678 
679  // Display the netclass name (a pad having a netcode = 0 (no net) use the
680  // default netclass for clearance):
681  if( m_netinfo->GetNet() <= 0 )
682  msg = bds.GetDefault()->GetName();
683  else
684  msg = GetNetClassName();
685 
686  aList.emplace_back( _( "NetClass" ), msg, CYAN );
687 
688  aList.emplace_back( _( "Layer" ), LayerMaskDescribe( board, m_layerMask ), DARKGREEN );
689 
690  // Show the pad shape, attribute and property
691  wxString props = ShowPadAttr();
692 
693  if( GetProperty() != PAD_PROP_NONE )
694  props += ',';
695 
696  switch( GetProperty() )
697  {
698  case PAD_PROP_NONE: break;
699  case PAD_PROP_BGA: props += _("BGA" ); break;
700  case PAD_PROP_FIDUCIAL_GLBL: props += _("Fiducial global" ); break;
701  case PAD_PROP_FIDUCIAL_LOCAL: props += _("Fiducial local" ); break;
702  case PAD_PROP_TESTPOINT: props += _("Test point" ); break;
703  case PAD_PROP_HEATSINK: props += _("Heat sink" ); break;
704  case PAD_PROP_CASTELLATED: props += _("Castellated" ); break;
705  }
706 
707  aList.emplace_back( ShowPadShape(), props, DARKGREEN );
708 
710  && m_Size.x == m_Size.y )
711  {
712  msg = MessageTextFromValue( units, m_Size.x, true );
713  aList.emplace_back( _( "Diameter" ), msg, RED );
714  }
715  else
716  {
717  msg = MessageTextFromValue( units, m_Size.x, true );
718  aList.emplace_back( _( "Width" ), msg, RED );
719 
720  msg = MessageTextFromValue( units, m_Size.y, true );
721  aList.emplace_back( _( "Height" ), msg, RED );
722  }
723 
724  double module_orient_degrees = module ? module->GetOrientationDegrees() : 0;
725  double pad_orient_degrees = GetOrientationDegrees() - module_orient_degrees;
726  pad_orient_degrees = NormalizeAngleDegrees( pad_orient_degrees, -180.0, +180.0 );
727 
728  if( module_orient_degrees != 0.0 )
729  msg.Printf( wxT( "%.2f(+ %.2f)" ), pad_orient_degrees, module_orient_degrees );
730  else
731  msg.Printf( wxT( "%.1f" ), GetOrientationDegrees() );
732 
733  aList.push_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, LIGHTBLUE ) );
734 
735  if( GetPadToDieLength() )
736  {
737  msg = MessageTextFromValue(units, GetPadToDieLength(), true );
738  aList.emplace_back( _( "Length in Package" ), msg, CYAN );
739  }
740 
741  msg = MessageTextFromValue( units, m_Drill.x, true );
742 
744  {
745  aList.emplace_back( _( "Drill" ), msg, RED );
746  }
747  else
748  {
749  msg = MessageTextFromValue( units, m_Drill.x, true )
750  + wxT( "/" )
751  + MessageTextFromValue( units, m_Drill.y, true );
752  aList.emplace_back( _( "Drill X / Y" ), msg, RED );
753  }
754 
755  wxString source;
756  int clearance = GetClearance( nullptr, &source );
757 
758  msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance, true ) );
759  msg2.Printf( _( "(from %s)" ), source );
760  aList.emplace_back( msg, msg2, BLACK );
761 }
EDA_UNITS
Definition: common.h:198
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
no special fabrication property
Definition: pad_shapes.h:97
const wxString & GetName() const
Definition: netclass.h:96
a fiducial (usually a smd) for the full board
Definition: pad_shapes.h:99
double GetOrientationDegrees() const
Definition: class_pad.h:316
wxSize m_Size
Definition: class_pad.h:641
int GetPadToDieLength() const
Definition: class_pad.h:338
Definition: color4d.h:61
Smd pad, used in BGA footprints.
Definition: pad_shapes.h:98
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
static wxString LayerMaskDescribe(const BOARD *aBoard, LSET aMask)
Helper function Return a string (to be shown to the user) describing a layer mask.
Definition: color4d.h:44
a pad used as heat sink, usually in SMD footprints
Definition: pad_shapes.h:102
const wxString & GetPinFunction() const
Definition: class_pad.h:135
wxString ShowPadAttr() const
Function ShowPadAttr.
Definition: class_pad.cpp:958
wxString GetNetClassName() const
Function GetNetClassName returns a pointer to the netclass of the zone.
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:433
a pad with a castellated through hole
Definition: pad_shapes.h:103
wxString m_name
Definition: class_pad.h:610
wxString ShowPadShape() const
Function ShowPadShape.
Definition: class_pad.cpp:942
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:320
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
double GetOrientationDegrees() const
Definition: class_module.h:212
Definition: color4d.h:58
PAD_PROP_T GetProperty() const
Definition: class_pad.h:331
const wxString & GetNetname() const
Function GetNetname.
Definition: color4d.h:59
virtual int GetClearance(BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const
Function GetClearance returns the clearance in internal units.
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124
LSET m_layerMask
Definition: class_pad.h:663
a fiducial (usually a smd) local to the parent footprint
Definition: pad_shapes.h:100
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
#define _(s)
Definition: 3d_actions.cpp:33
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131
NETCLASS * GetDefault() const
Function GetDefault.
double NormalizeAngleDegrees(double Angle, double aMin, double aMax)
Normalize angle to be aMin < angle <= aMax angle is in degrees.
Definition: trigo.h:292
wxSize m_Drill
Definition: class_pad.h:640
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:154
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
a test point pad
Definition: pad_shapes.h:101
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

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

◆ GetName()

◆ GetNet()

NETINFO_ITEM* BOARD_CONNECTED_ITEM::GetNet ( ) const
inlineinherited

Function GetNet Returns NET_INFO object for a given item.

Definition at line 81 of file board_connected_item.h.

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

References BOARD_CONNECTED_ITEM::m_netinfo.

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

◆ GetNetClass()

NETCLASS * BOARD_CONNECTED_ITEM::GetNetClass ( ) const
inherited

Function GetNetClassPtr returns the NETCLASS for this item.

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

Definition at line 186 of file board_connected_item.cpp.

187 {
188  NETCLASS* netclass = m_netinfo->GetNetClass();
189 
190  if( netclass )
191  return netclass;
192  else
193  return GetBoard()->GetDesignSettings().GetDefault();
194 }
NETCLASS * GetNetClass()
Function GetNetClass.
Definition: netinfo.h:128
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
NETCLASS handles a collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:49
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
NETCLASS * GetDefault() const
Function GetDefault.

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

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

◆ GetNetClassName()

wxString BOARD_CONNECTED_ITEM::GetNetClassName ( ) const
inherited

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

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

Returns
the Net Class name of this item

Definition at line 197 of file board_connected_item.cpp.

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

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

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

◆ GetNetCode()

int BOARD_CONNECTED_ITEM::GetNetCode ( ) const
inlineinherited

Function GetNetCode.

Returns
int - the net code.

Definition at line 100 of file board_connected_item.h.

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

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

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

◆ GetNetname()

const wxString& BOARD_CONNECTED_ITEM::GetNetname ( ) const
inlineinherited

Function GetNetname.

Returns
wxString - the full netname

Definition at line 125 of file board_connected_item.h.

126  {
127  return m_netinfo->GetNetname();
128  }
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:231
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

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

Referenced by KIGFX::PCB_PAINTER::draw(), PCB_IO::format(), DSN::SPECCTRA_DB::FromBOARD(), GetMsgPanelInfo(), BOARD_NETLIST_UPDATER::getNetname(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), CN_CLUSTER::OriginNetName(), BRDITEMS_PLOTTER::PlotFilledAreas(), BRDITEMS_PLOTTER::PlotPad(), PlotStandardLayer(), and BOARD_NETLIST_UPDATER::updateCopperZoneNets().

◆ GetNetnameMsg()

wxString BOARD_CONNECTED_ITEM::GetNetnameMsg ( ) const
inlineinherited

Function GetNetnameMsg.

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

Definition at line 135 of file board_connected_item.h.

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

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

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

◆ GetOffset()

◆ GetOrientation()

◆ GetOrientationDegrees()

double D_PAD::GetOrientationDegrees ( ) const
inline

Definition at line 316 of file class_pad.h.

316 { return m_Orient/10.0; }
double m_Orient
Definition: class_pad.h:677

References m_Orient.

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

◆ GetOrientationRadians()

double D_PAD::GetOrientationRadians ( ) const
inline

Definition at line 317 of file class_pad.h.

317 { return m_Orient*M_PI/1800; }
double m_Orient
Definition: class_pad.h:677

References m_Orient.

◆ GetPadToDieLength()

◆ GetParent()

◆ GetPinFunction()

const wxString& D_PAD::GetPinFunction ( ) const
inline

◆ GetPos0()

const wxPoint& D_PAD::GetPos0 ( ) const
inline

◆ GetPosition()

◆ GetPrimitives()

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

Accessor to the basic shape list.

Definition at line 270 of file class_pad.h.

271  {
272  return m_editPrimitives;
273  }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:622

References m_editPrimitives.

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

◆ GetProperty()

◆ GetRoundRectCornerRadius()

int D_PAD::GetRoundRectCornerRadius ( ) const

Definition at line 163 of file class_pad.cpp.

164 {
165  return KiROUND( std::min( m_Size.x, m_Size.y ) * m_roundedCornerScale );
166 }
double m_roundedCornerScale
Definition: class_pad.h:645
wxSize m_Size
Definition: class_pad.h:641
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68

References KiROUND(), m_roundedCornerScale, and m_Size.

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

◆ GetRoundRectRadiusRatio()

◆ GetRuleClearance()

bool BOARD_CONNECTED_ITEM::GetRuleClearance ( BOARD_ITEM aItem,
int *  aClearance,
wxString *  aSource 
) const
virtualinherited

Function GetRuleClearance returns any rule-based clearance.

Parameters
aClearance[out] the clearance value in internal units
aSource[out] reports the source as a user-readable string
Returns
true if a rule was fired

Definition at line 166 of file board_connected_item.cpp.

168 {
169  DRC_RULE* rule = GetRule( this, aItem, CLEARANCE_CONSTRAINT );
170 
171  if( rule )
172  {
173  if( aSource )
174  *aSource = wxString::Format( _( "'%s' rule" ), rule->m_Name );
175 
176  *aClearance = rule->m_Clearance.Min;
177  return true;
178  }
179 
180  return false;
181 }
wxString m_Name
MINOPTMAX m_Clearance
DRC_RULE * GetRule(const BOARD_ITEM *aItem, const BOARD_ITEM *bItem, int aConstraint)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define CLEARANCE_CONSTRAINT
#define _(s)
Definition: 3d_actions.cpp:33

References _, CLEARANCE_CONSTRAINT, Format(), GetRule(), DRC_RULE::m_Clearance, DRC_RULE::m_Name, and DRC_RULE::MINOPTMAX::Min.

Referenced by DRC::doTrackDrc(), and BOARD_CONNECTED_ITEM::GetClearance().

◆ GetSelectMenuText()

wxString D_PAD::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 971 of file class_pad.cpp.

972 {
973  if( GetName().IsEmpty() )
974  {
975  return wxString::Format( _( "Pad of %s on %s" ),
976  GetParent()->GetReference(),
978  }
979  else
980  {
981  return wxString::Format( _( "Pad %s of %s on %s" ),
982  GetName(),
983  GetParent()->GetReference(),
985  }
986 }
static wxString LayerMaskDescribe(const BOARD *aBoard, LSET aMask)
Helper function Return a string (to be shown to the user) describing a layer mask.
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
const wxString & GetName() const
Definition: class_pad.h:129
MODULE * GetParent() const
Definition: class_pad.h:108
LSET m_layerMask
Definition: class_pad.h:663
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33

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

◆ GetShape()

◆ GetShortNetname()

const wxString& BOARD_CONNECTED_ITEM::GetShortNetname ( ) const
inlineinherited

Function GetShortNetname.

Returns
wxString - the short netname

Definition at line 154 of file board_connected_item.h.

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

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

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

◆ GetSize()

◆ GetSolderMaskMargin()

int D_PAD::GetSolderMaskMargin ( ) const

Function GetSolderMaskMargin.

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

Definition at line 531 of file class_pad.cpp.

532 {
533  // The pad inherits the margin only to calculate a default shape,
534  // therefore only if it is also a copper layer
535  // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
536  // defined by the pad settings only
537  bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
538 
539  if( !isOnCopperLayer )
540  return 0;
541 
542  int margin = m_LocalSolderMaskMargin;
543 
544  MODULE* module = GetParent();
545 
546  if( module )
547  {
548  if( margin == 0 )
549  {
550  if( module->GetLocalSolderMaskMargin() )
551  margin = module->GetLocalSolderMaskMargin();
552  }
553 
554  if( margin == 0 )
555  {
556  BOARD* brd = GetBoard();
557 
558  if( brd )
559  margin = brd->GetDesignSettings().m_SolderMaskMargin;
560  }
561  }
562 
563  // ensure mask have a size always >= 0
564  if( margin < 0 )
565  {
566  int minsize = -std::min( m_Size.x, m_Size.y ) / 2;
567 
568  if( margin < minsize )
569  margin = minsize;
570  }
571 
572  return margin;
573 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
int m_LocalSolderMaskMargin
Definition: class_pad.h:692
int m_SolderMaskMargin
Solder mask margin.
wxSize m_Size
Definition: class_pad.h:641
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
int GetLocalSolderMaskMargin() const
Definition: class_module.h:227
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
MODULE * GetParent() const
Definition: class_pad.h:108
LSET m_layerMask
Definition: class_pad.h:663
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180

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

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

◆ GetSolderPasteMargin()

wxSize D_PAD::GetSolderPasteMargin ( ) const

Function GetSolderPasteMargin.

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

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

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

Definition at line 576 of file class_pad.cpp.

577 {
578  // The pad inherits the margin only to calculate a default shape,
579  // therefore only if it is also a copper layer.
580  // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
581  // defined by the pad settings only
582  bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
583 
584  if( !isOnCopperLayer )
585  return wxSize( 0, 0 );
586 
587  int margin = m_LocalSolderPasteMargin;
588  double mratio = m_LocalSolderPasteMarginRatio;
589 
590  MODULE* module = GetParent();
591 
592  if( module )
593  {
594  if( margin == 0 )
595  margin = module->GetLocalSolderPasteMargin();
596 
597  auto brd = GetBoard();
598 
599  if( margin == 0 && brd )
600  {
601  margin = brd->GetDesignSettings().m_SolderPasteMargin;
602  }
603 
604  if( mratio == 0.0 )
605  mratio = module->GetLocalSolderPasteMarginRatio();
606 
607  if( mratio == 0.0 && brd )
608  {
609  mratio = brd->GetDesignSettings().m_SolderPasteMarginRatio;
610  }
611  }
612 
613  wxSize pad_margin;
614  pad_margin.x = margin + KiROUND( m_Size.x * mratio );
615  pad_margin.y = margin + KiROUND( m_Size.y * mratio );
616 
617  // ensure mask have a size always >= 0
618  if( pad_margin.x < -m_Size.x / 2 )
619  pad_margin.x = -m_Size.x / 2;
620 
621  if( pad_margin.y < -m_Size.y / 2 )
622  pad_margin.y = -m_Size.y / 2;
623 
624  return pad_margin;
625 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
int m_LocalSolderPasteMargin
Definition: class_pad.h:693
wxSize m_Size
Definition: class_pad.h:641
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int GetLocalSolderPasteMargin() const
Definition: class_module.h:240
MODULE * GetParent() const
Definition: class_pad.h:108
LSET m_layerMask
Definition: class_pad.h:663
double GetLocalSolderPasteMarginRatio() const
Definition: class_module.h:243
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
double m_LocalSolderPasteMarginRatio
Definition: class_pad.h:694

References LSET::AllCuMask(), BOARD_ITEM::GetBoard(), MODULE::GetLocalSolderPasteMargin(), MODULE::GetLocalSolderPasteMarginRatio(), GetParent(), KiROUND(), m_layerMask, m_LocalSolderPasteMargin, m_LocalSolderPasteMarginRatio, and m_Size.

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

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 216 of file base_struct.h.

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

References EDA_ITEM::m_Status.

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

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

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

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetSubRatsnest()

int D_PAD::GetSubRatsnest ( ) const
inline

Function GetSubRatsnest.

Returns
int - the netcode

Definition at line 497 of file class_pad.h.

497 { return m_SubRatsnest; }
int m_SubRatsnest
Definition: class_pad.h:637

References m_SubRatsnest.

Referenced by CreatePadsShapesSection().

◆ GetThermalGap()

int D_PAD::GetThermalGap ( ) const

Definition at line 650 of file class_pad.cpp.

651 {
652  MODULE* module = GetParent();
653 
654  if( m_ThermalGap == 0 && module )
655  return module->GetThermalGap();
656  else
657  return m_ThermalGap;
658 }
int m_ThermalGap
Definition: class_pad.h:699
MODULE * GetParent() const
Definition: class_pad.h:108
int GetThermalGap() const
Definition: class_module.h:253

References GetParent(), MODULE::GetThermalGap(), and m_ThermalGap.

Referenced by PCB_IO::format(), ZONE_CONTAINER::GetThermalReliefGap(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::initValues(), PAD_DESC::PAD_DESC(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ GetThermalWidth()

int D_PAD::GetThermalWidth ( ) const

Definition at line 639 of file class_pad.cpp.

640 {
641  MODULE* module = GetParent();
642 
643  if( m_ThermalWidth == 0 && module )
644  return module->GetThermalWidth();
645  else
646  return m_ThermalWidth;
647 }
int m_ThermalWidth
Definition: class_pad.h:698
MODULE * GetParent() const
Definition: class_pad.h:108
int GetThermalWidth() const
Definition: class_module.h:250

References GetParent(), MODULE::GetThermalWidth(), and m_ThermalWidth.

Referenced by PCB_IO::format(), ZONE_CONTAINER::GetThermalReliefCopperBridge(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::initValues(), PAD_DESC::PAD_DESC(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ GetZoneConnection()

ZONE_CONNECTION D_PAD::GetZoneConnection ( ) const
inline

Definition at line 440 of file class_pad.h.

440 { return m_ZoneConnection; }
ZONE_CONNECTION m_ZoneConnection
Definition: class_pad.h:697

References m_ZoneConnection.

Referenced by DIALOG_PAD_PROPERTIES::initValues().

◆ HasFlag()

◆ HitTest() [1/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 764 of file class_pad.cpp.

765 {
766  VECTOR2I delta = aPosition - GetPosition();
767  int boundingRadius = GetBoundingRadius() + aAccuracy;
768 
769  if( delta.SquaredEuclideanNorm() > SEG::Square( boundingRadius ) )
770  return false;
771 
772  SHAPE_POLY_SET polySet;
773  TransformShapeWithClearanceToPolygon( polySet, aAccuracy );
774 
775  return polySet.Contains( aPosition );
776 }
wxPoint GetPosition() const override
Definition: class_pad.h:162
extended_type SquaredEuclideanNorm() const
Function Squared Euclidean Norm computes the squared euclidean norm of the vector,...
Definition: vector2d.h:306
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Returns true if a given subpolygon contains the point aP.
static SEG::ecoord Square(int a)
Definition: seg.h:116
SHAPE_POLY_SET.
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.cpp:212
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aMaxError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon.

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

◆ HitTest() [2/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 779 of file class_pad.cpp.

780 {
781  EDA_RECT arect = aRect;
782  arect.Normalize();
783  arect.Inflate( aAccuracy );
784 
785  EDA_RECT bbox = GetBoundingBox();
786 
787  if( !arect.Intersects( bbox ) )
788  return false;
789 
790  // This covers total containment for all test cases
791  if( arect.Contains( bbox ) )
792  return true;
793 
794  SHAPE_POLY_SET selRect;
795  selRect.NewOutline();
796  selRect.Append( arect.GetOrigin() );
797  selRect.Append( VECTOR2I( arect.GetRight(), arect.GetTop() ) );
798  selRect.Append( VECTOR2I( arect.GetRight(), arect.GetBottom() ) );
799  selRect.Append( VECTOR2I( arect.GetLeft(), arect.GetBottom() ) );
800 
801  SHAPE_POLY_SET padPoly;
802  TransformShapeWithClearanceToPolygon( padPoly, aAccuracy );
803 
804  selRect.BooleanIntersection( padPoly, SHAPE_POLY_SET::PM_FAST );
805 
806  double padArea = padPoly.Outline( 0 ).Area();
807  double intersection = selRect.Outline( 0 ).Area();
808 
809  if( intersection > ( padArea * 0.99 ) )
810  return true;
811  else
812  return !aContained && intersection > 0;
813 }
int GetTop() const
Definition: eda_rect.h:123
int GetLeft() const
Definition: eda_rect.h:122
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
bool Contains(const wxPoint &aPoint) const
Function Contains.
int GetBottom() const
Definition: eda_rect.h:124
SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
const wxPoint GetOrigin() const
Definition: eda_rect.h:114
int GetRight() const
Definition: eda_rect.h:121
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset intersection For aFastMode meaning, see function booleanOp
int NewOutline()
Creates a new empty polygon in the set and returns its index
void Normalize()
Function Normalize ensures that the height ant width are positive.
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aMaxError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon.
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox The bounding box is cached, so this will be efficient most of the time.
Definition: class_pad.cpp:371
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

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

◆ ImportSettingsFrom()

void D_PAD::ImportSettingsFrom ( const D_PAD aMasterPad)

Imports the pad settings from aMasterPad.

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

Parameters
aMasterPad= the template pad

Definition at line 1145 of file class_pad.cpp.

1146 {
1147  SetShape( aMasterPad.GetShape() );
1148  SetLayerSet( aMasterPad.GetLayerSet() );
1149  SetAttribute( aMasterPad.GetAttribute() );
1150  SetProperty( aMasterPad.GetProperty() );
1151 
1152  // The pad orientation, for historical reasons is the
1153  // pad rotation + parent rotation.
1154  // So we have to manage this parent rotation
1155  double pad_rot = aMasterPad.GetOrientation();
1156 
1157  if( aMasterPad.GetParent() )
1158  pad_rot -= aMasterPad.GetParent()->GetOrientation();
1159 
1160  if( GetParent() )
1161  pad_rot += GetParent()->GetOrientation();
1162 
1163  SetOrientation( pad_rot );
1164 
1165  SetSize( aMasterPad.GetSize() );
1166  SetDelta( wxSize( 0, 0 ) );
1167  SetOffset( aMasterPad.GetOffset() );
1168  SetDrillSize( aMasterPad.GetDrillSize() );
1169  SetDrillShape( aMasterPad.GetDrillShape() );
1171  SetChamferRectRatio( aMasterPad.GetChamferRectRatio() );
1172  SetChamferPositions( aMasterPad.GetChamferPositions() );
1173 
1174  switch( aMasterPad.GetShape() )
1175  {
1176  case PAD_SHAPE_TRAPEZOID:
1177  SetDelta( aMasterPad.GetDelta() );
1178  break;
1179 
1180  case PAD_SHAPE_CIRCLE:
1181  // ensure size.y == size.x
1182  SetSize( wxSize( GetSize().x, GetSize().x ) );
1183  break;
1184 
1185  default:
1186  ;
1187  }
1188 
1189  switch( aMasterPad.GetAttribute() )
1190  {
1191  case PAD_ATTRIB_SMD:
1192  case PAD_ATTRIB_CONN:
1193  // These pads do not have hole (they are expected to be only on one
1194  // external copper layer)
1195  SetDrillSize( wxSize( 0, 0 ) );
1196  break;
1197 
1198  default:
1199  ;
1200  }
1201 
1202  // copy also local settings:
1203  SetLocalClearance( aMasterPad.GetLocalClearance() );
1207 
1209  SetThermalWidth( aMasterPad.GetThermalWidth() );
1210  SetThermalGap( aMasterPad.GetThermalGap() );
1211 
1212  // Add or remove custom pad shapes:
1213  SetPrimitives( aMasterPad.GetPrimitives() );
1214  SetAnchorPadShape( aMasterPad.GetAnchorPadShape() );
1215 
1216  m_shapesDirty = true;
1217 }
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:340
double GetOrientation() const
Definition: class_module.h:211
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:168
int GetLocalClearance(wxString *aSource=nullptr) const override
Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system.
Definition: class_pad.cpp:520
bool m_shapesDirty
Definition: class_pad.h:624
void SetChamferPositions(int aPositions)
has meaning only for chamfered rect pads set the position of the chamfers for orientation 0.
Definition: class_pad.h:490
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:81
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:226
void SetRoundRectRadiusRatio(double aRadiusScale)
has meaning only for rounded rect pads Set the ratio between the smaller X or Y size and the rounded ...
Definition: class_pad.cpp:178
int GetThermalGap() const
Definition: class_pad.cpp:650
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:328
int GetChamferPositions() const
Definition: class_pad.h:491
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:195
const wxPoint & GetOffset() const
Definition: class_pad.h:230
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:320
double GetChamferRectRatio() const
Definition: class_pad.h:483
int GetThermalWidth() const
Definition: class_pad.cpp:639
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:325
void SetThermalWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition: class_pad.h:453
void SetSize(const wxSize &aSize)
Definition: class_pad.h:220
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: class_pad.h:439
PAD_PROP_T GetProperty() const
Definition: class_pad.h:331
const wxSize & GetDelta() const
Definition: class_pad.h:224
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:82
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:411
void SetLocalClearance(int aClearance)
Definition: class_pad.h:344
ZONE_CONNECTION GetEffectiveZoneConnection() const
Return the zone connection in effect (either locally overridden or overridden in the parent module).
Definition: class_pad.cpp:628
MODULE * GetParent() const
Definition: class_pad.h:108
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:350
void SetDrillShape(PAD_DRILL_SHAPE_T aShape)
Definition: class_pad.h:319
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:324
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:341
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:315
const wxSize & GetDrillSize() const
Definition: class_pad.h:227
void SetShape(PAD_SHAPE_T aShape)
Set the new shape of this pad.
Definition: class_pad.h:145
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:430
double GetRoundRectRadiusRatio() const
Definition: class_pad.h:475
void SetChamferRectRatio(double aChamferScale)
has meaning only for chamfered rect pads Set the ratio between the smaller X or Y size and chamfered ...
Definition: class_pad.cpp:186
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:347
void SetPrimitives(const std::vector< std::shared_ptr< DRAWSEGMENT >> &aPrimitivesList)
Import to the basic shape list.
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:154
const std::vector< std::shared_ptr< DRAWSEGMENT > > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:270
const wxSize & GetSize() const
Definition: class_pad.h:221
void SetProperty(PAD_PROP_T aProperty)
Definition: class_pad.cpp:422
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:346
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:229
void SetThermalGap(int aGap)
Definition: class_pad.h:456
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:349
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:223

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

Referenced by PAD_TOOL::copyPadSettings(), and PAD_TOOL::PlacePad().

◆ IsAperturePad()

bool D_PAD::IsAperturePad ( ) const
inline

Definition at line 335 of file class_pad.h.

335 { return ( m_layerMask & LSET::AllCuMask() ).none(); }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
LSET m_layerMask
Definition: class_pad.h:663

References LSET::AllCuMask(), and m_layerMask.

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

◆ IsBrightened()

bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

◆ IsConnected()

bool BOARD_CONNECTED_ITEM::IsConnected ( ) const
inlineoverridevirtualinherited

Reimplemented from BOARD_ITEM.

Definition at line 72 of file board_connected_item.h.

73  {
74  return true;
75  }

◆ IsDirty()

bool D_PAD::IsDirty ( ) const
inline

Definition at line 322 of file class_pad.h.

322 { return m_shapesDirty; }
bool m_shapesDirty
Definition: class_pad.h:624

References m_shapesDirty.

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 201 of file base_struct.h.

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

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

◆ IsFlipped()

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

Definition at line 134 of file class_pad.cpp.

135 {
136  if( GetParent() && GetParent()->GetLayer() == B_Cu )
137  return true;
138  return false;
139 }
MODULE * GetParent() const
Definition: class_pad.h:108
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

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

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

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 286 of file base_struct.h.

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

References EDA_ITEM::m_forceVisible.

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

◆ IsLocked()

virtual bool BOARD_ITEM::IsLocked ( ) const
inlinevirtualinherited

Function IsLocked.

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

Reimplemented in MODULE, and TRACK.

Definition at line 238 of file class_board_item.h.

239  {
240  // only MODULEs & TRACKs can be locked at this time.
241  return false;
242  }

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 198 of file base_struct.h.

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

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

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

Reimplemented from BOARD_ITEM.

Definition at line 206 of file class_pad.h.

207  {
208  return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
209  }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:325

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

Referenced by CN_LIST::Add().

◆ IsOnLayer()

bool D_PAD::IsOnLayer ( PCB_LAYER_ID  aLayer) const
inlineoverridevirtual

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

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

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

Reimplemented from BOARD_ITEM.

Definition at line 502 of file class_pad.h.

503  {
504  return m_layerMask[aLayer];
505  }
LSET m_layerMask
Definition: class_pad.h:663

References m_layerMask.

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

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Function IsReplaceable.

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

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

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

Definition at line 501 of file base_struct.h.

501 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 204 of file base_struct.h.

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

References IS_RESIZED, and EDA_ITEM::m_Flags.

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

◆ IsSelected()

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

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

form of testing.

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

Definition at line 229 of file class_board_item.h.

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

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

◆ IsType()

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 87 of file class_pad.h.

88  {
89  if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
90  return true;
91 
92  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
93  {
94  if( m_Drill.x > 0 && m_Drill.y > 0 )
95  {
96  if( *p == PCB_LOCATE_HOLE_T )
97  return true;
99  return true;
101  return true;
102  }
103  }
104 
105  return false;
106  }
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
virtual bool IsType(const KICAD_T aScanTypes[]) const
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:262
PAD_ATTR_T m_Attribute
Definition: class_pad.h:673
wxSize m_Drill
Definition: class_pad.h:640

References EOT, EDA_ITEM::IsType(), m_Attribute, m_Drill, PAD_ATTRIB_HOLE_NOT_PLATED, PCB_LOCATE_HOLE_T, PCB_LOCATE_NPTH_T, and PCB_LOCATE_PTH_T.

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 202 of file base_struct.h.

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

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward() [1/2]

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

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

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

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

Definition at line 383 of file base_struct.h.

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

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

Referenced by GERBER_FILE_IMAGE::Visit(), and BOARD::Visit().

◆ IterateForward() [2/2]

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

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

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

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

Definition at line 404 of file base_struct.h.

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

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

◆ LayerMaskDescribe()

wxString BOARD_ITEM::LayerMaskDescribe ( const BOARD aBoard,
LSET  aMask 
)
staticprotectedinherited

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

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

Definition at line 80 of file class_board_item.cpp.

81 {
82  // Try to be smart and useful. Check all copper first.
83  if( aMask[F_Cu] && aMask[B_Cu] )
84  return _( "All copper layers" );
85 
86  // Check for copper.
87  auto layer = aBoard->GetEnabledLayers().AllCuMask() & aMask;
88 
89  for( int i = 0; i < 3; i++ )
90  {
91  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
92  {
93  if( layer[ bit ] )
94  {
95  wxString layerInfo = aBoard->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
96 
97  if( aMask.count() > 1 )
98  layerInfo << _( " and others" );
99 
100  return layerInfo;
101  }
102  }
103 
104  // No copper; first, check for technicals and then for all layers.
105  if( i < 1 ) // first, check for technicals
106  layer = aBoard->GetEnabledLayers().AllTechMask() & aMask;
107  else // then check for all other layers
108  layer = aMask;
109  }
110 
111  // No copper, no technicals: no layer
112  return _( "no layers" );
113 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:782
#define _(s)
Definition: 3d_actions.cpp:33

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

Referenced by GetMsgPanelInfo(), and GetSelectMenuText().

◆ Matches() [1/2]

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

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

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

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

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

Definition at line 457 of file base_struct.h.

458  {
459  return false;
460  }

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

◆ Matches() [2/2]

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

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 145 of file base_struct.cpp.

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

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

◆ MergePrimitivesAsPolygon()

void D_PAD::MergePrimitivesAsPolygon ( SHAPE_POLY_SET aMergedPolygon) const

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

Definition at line 193 of file pad_custom_shape_functions.cpp.

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

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

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

◆ MirrorXPrimitives()

void D_PAD::MirrorXPrimitives ( int  aX)

Mirror the primitives about a coordinate.

Definition at line 481 of file class_pad.cpp.

482 {
483  for( std::shared_ptr<DRAWSEGMENT>& primitive : m_editPrimitives )
484  primitive->Flip( wxPoint( aX, 0 ), true );
485 
486  m_shapesDirty = true;
487 }
std::vector< std::shared_ptr< DRAWSEGMENT > > m_editPrimitives
Definition: class_pad.h:622
bool m_shapesDirty
Definition: class_pad.h:624

References m_editPrimitives, and m_shapesDirty.

Referenced by mirrorPadX().

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 277 of file class_board_item.h.

278  {
279  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
280  }
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.

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

◆ Move() [2/2]

void D_PAD::Move ( const wxPoint aMoveVector)
inlineoverridevirtual

Function Move move this object.

Parameters
aMoveVector- the move vector for this object.

Reimplemented from BOARD_ITEM.

Definition at line 538 of file class_pad.h.

539  {
540  m_Pos += aMoveVector;
541  SetLocalCoord();
542  m_shapesDirty = true;
543  }
bool m_shapesDirty
Definition: class_pad.h:624
void SetLocalCoord()
Set relative coordinates.
Definition: class_pad.cpp:396
wxPoint m_Pos
Definition: class_pad.h:613

References m_Pos, m_shapesDirty, and SetLocalCoord().

◆ operator<()

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

Test if another item is less than this object.

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

Definition at line 199 of file base_struct.cpp.

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

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

◆ PadNameEqual()

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

Definition at line 137 of file class_pad.h.

138  {
139  return m_name == other->m_name; // hide tricks behind sensible API
140  }
wxString m_name
Definition: class_pad.h:610

References m_name.

Referenced by test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc(), and DRC::doPadToPadsDrc().

◆ PadShouldBeNPTH()

bool D_PAD::PadShouldBeNPTH ( ) const

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

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

Definition at line 1001 of file class_pad.cpp.

1002 {
1003  return( m_Attribute == PAD_ATTRIB_STANDARD
1004  && m_Drill.x >= m_Size.x && m_Drill.y >= m_Size.y );
1005 }
wxSize m_Size
Definition: class_pad.h:641
PAD_ATTR_T m_Attribute
Definition: class_pad.h:673
wxSize m_Drill
Definition: class_pad.h:640

References m_Attribute, m_Drill, m_Size, and PAD_ATTRIB_STANDARD.

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

◆ Replace() [1/2]

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

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

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

Definition at line 172 of file base_struct.cpp.

173 {
174  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
175 
176  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
177  aSearchData.GetFindString() :
178  aSearchData.GetFindString().Upper() );
179 
180  if( result == wxNOT_FOUND )
181  return false;
182 
183  wxString prefix = aText.Left( result );
184  wxString suffix;
185 
186  if( aSearchData.GetFindString().length() + result < aText.length() )
187  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
188 
189  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
190  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
191  GetChars( suffix ) );
192 
193  aText = prefix + aSearchData.GetReplaceString() + suffix;
194 
195  return true;
196 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153

References GetChars(), and traceFindReplace.

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

◆ Replace() [2/2]

virtual bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
void *  aAuxData = NULL 
)
inlinevirtualinherited

Function Replace performs 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 SCH_TEXT, SCH_SHEET_PIN, and SCH_FIELD.

Definition at line 489 of file base_struct.h.

489 { return false; }

◆ Rotate() [1/2]

void BOARD_ITEM::Rotate ( const VECTOR2I aRotCentre,
double  aAngle 
)
inlineinherited

Definition at line 293 of file class_board_item.h.

294  {
295  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
296  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.

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

◆ Rotate() [2/2]

void D_PAD::Rotate ( const wxPoint aRotCentre,
double  aAngle 
)
overridevirtual

Function Rotate Rotate this object.

Parameters
aRotCentre- the rotation point.
aAngle- the rotation angle in 0.1 degree.

Reimplemented from BOARD_ITEM.

Definition at line 930 of file class_pad.cpp.

931 {
932  RotatePoint( &m_Pos, aRotCentre, aAngle );
933 
934  m_Orient = NormalizeAngle360Min( m_Orient + aAngle );
935 
936  SetLocalCoord();
937 
938  m_shapesDirty = true;
939 }
bool m_shapesDirty
Definition: class_pad.h:624
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
void SetLocalCoord()
Set relative coordinates.
Definition: class_pad.cpp:396
double m_Orient
Definition: class_pad.h:677
T NormalizeAngle360Min(T Angle)
Normalize angle to be > -360.0 and < 360.0 Angle equal to -360 or +360 are set to 0.
Definition: trigo.h:237
wxPoint m_Pos
Definition: class_pad.h:613

References m_Orient, m_Pos, m_shapesDirty, NormalizeAngle360Min(), RotatePoint(), and SetLocalCoord().

◆ Set() [1/3]

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

Definition at line 40 of file inspectable.h.

41  {
43  TYPE_ID thisType = TYPE_HASH( *this );
44  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
45 
46  if( object )
47  aProperty->setter( object, aValue );
48 
49  return object != nullptr;
50  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
virtual void setter(void *aObject, wxAny &aValue)=0
Provides class metadata.
Definition: property_mgr.h:58
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

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

◆ Set() [2/3]

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

Definition at line 53 of file inspectable.h.

54  {
56  TYPE_ID thisType = TYPE_HASH( *this );
57  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
58 
59  if( object )
60  aProperty->set<T>( object, aValue );
61 
62  return object != nullptr;
63  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
Provides class metadata.
Definition: property_mgr.h:58
void set(void *aObject, T aValue)
Definition: property.h:264
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

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

◆ Set() [3/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  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Returns a property for a specific type.
Provides class metadata.
Definition: property_mgr.h:58
void set(void *aObject, T aValue)
Definition: property.h:264
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

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

◆ SetAnchorPadShape()

void D_PAD::SetAnchorPadShape ( PAD_SHAPE_T  aShape)
inline

Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.

Parameters
theshape of the anchor pad shape( currently, only PAD_SHAPE_RECT or PAD_SHAPE_CIRCLE.

Definition at line 195 of file class_pad.h.

196  {
198  m_shapesDirty = true;
199  }
bool m_shapesDirty
Definition: class_pad.h:624
PAD_SHAPE_T m_anchorPadShape
Definition: class_pad.h:651

References m_anchorPadShape, m_shapesDirty, PAD_SHAPE_CIRCLE, and PAD_SHAPE_RECT.

Referenced by MICROWAVE_TOOL::createFootprint(), D_PAD(), ImportSettingsFrom(), PCB_PARSER::parseD_PAD_option(), PAD_TOOL::recombinePad(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::transferDataToPad().

◆ SetAttribute()

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

◆ SetChamferPositions()

void D_PAD::SetChamferPositions ( int  aPositions)
inline

has meaning only for chamfered rect pads set the position of the chamfers for orientation 0.

Parameters
aPositionsa bit-set of RECT_CHAMFER_POSITIONS

Definition at line 490 of file class_pad.h.

490 { m_chamferPositions = aPositions; }
int m_chamferPositions
Definition: class_pad.h:649

References m_chamferPositions.

Referenced by ImportSettingsFrom(), EAGLE_PLUGIN::packagePad(), ALTIUM_PCB::ParsePads6Data(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::transferDataToPad().

◆ SetChamferRectRatio()

void D_PAD::SetChamferRectRatio ( double  aChamferScale)

has meaning only for chamfered rect pads Set the ratio between the smaller X or Y size and chamfered corner size.

Cannot be < 0.5.

Definition at line 186 of file class_pad.cpp.

187 {
188  m_chamferScale = std::max( 0.0, std::min( aChamferScale, 0.5 ) );
189 
190  m_shapesDirty = true;
191 }
bool m_shapesDirty
Definition: class_pad.h:624
double m_chamferScale
Definition: class_pad.h:647

References m_chamferScale, and m_shapesDirty.

Referenced by ImportSettingsFrom(), EAGLE_PLUGIN::packagePad(), ALTIUM_PCB::ParsePads6Data(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::transferDataToPad().

◆ SetCustomShapeInZoneOpt()

void D_PAD::SetCustomShapeInZoneOpt