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

Public Member Functions

 D_PAD (MODULE *parent)
 
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...
 
void SetPinFunction (const wxString &aName)
 Set the pad function (pin name in schematic) More...
 
const wxString & GetName () const
 
const wxString & GetPinFunction () const
 
bool IncrementPadName (bool aSkipUnconnectable, bool aFillSequenceGaps)
 Function IncrementPadName. More...
 
bool PadNameEqual (const D_PAD *other) const
 
PAD_SHAPE_T GetShape () const
 Function GetShape. More...
 
void SetShape (PAD_SHAPE_T aShape)
 
void SetPosition (const wxPoint &aPos) override
 
const 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, bool aMergePrimitives=true)
 Has meaning only for free shape pads. More...
 
void AddPrimitivePoly (const std::vector< wxPoint > &aPoly, int aThickness, bool aMergePrimitives=true)
 add a polygonal basic shape More...
 
void AddPrimitiveSegment (wxPoint aStart, wxPoint aEnd, int aThickness, bool aMergePrimitives=true)
 segment basic shape More...
 
void AddPrimitiveCircle (wxPoint aCenter, int aRadius, int aThickness, bool aMergePrimitives=true)
 ring or circle basic shape More...
 
void AddPrimitiveArc (wxPoint aCenter, wxPoint aStart, int aArcAngle, int aThickness, bool aMergePrimitives=true)
 arc basic shape More...
 
void AddPrimitiveCurve (wxPoint aStart, wxPoint aEnd, wxPoint aCtrl1, wxPoint aCtrl2, int aThickness, bool aMergePrimitives=true)
 curve basic shape More...
 
bool GetBestAnchorPosition (VECTOR2I &aPos)
 
bool MergePrimitivesAsPolygon (SHAPE_POLY_SET *aMergedPolygon=NULL)
 Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon. More...
 
void DeletePrimitivesList ()
 clear the basic shapes list More...
 
void CustomShapeAsPolygonToBoardPosition (SHAPE_POLY_SET *aMergedPolygon, wxPoint aPosition, double aRotation) const
 When created, the corners coordinates are relative to the pad position, orientation 0, in m_customShapeAsPolygon CustomShapeAsPolygonToBoardPosition transform these coordinates to actual (board) coordinates. More...
 
const std::vector< PAD_CS_PRIMITIVE > & GetPrimitives () const
 Accessor to the basic shape list. More...
 
const SHAPE_POLY_SETGetCustomShapeAsPolygon () const
 Accessor to the custom shape as one polygon. 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...
 
bool SetPrimitives (const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
 Import to the basic shape list. More...
 
bool AddPrimitives (const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
 Add to the basic shape list. More...
 
void SetOrientation (double aAngle)
 Function SetOrientation sets the rotation angle of the pad. More...
 
void SetOrientationDegrees (double aOrientation)
 Set orientation in degrees. More...
 
double GetOrientation () const
 Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees. More...
 
double GetOrientationDegrees () const
 
double GetOrientationRadians () const
 
void SetDrillShape (PAD_DRILL_SHAPE_T aDrillShape)
 
PAD_DRILL_SHAPE_T GetDrillShape () const
 
void GetOblongDrillGeometry (wxPoint &aStartPoint, wxPoint &aEndPoint, int &aWidth) const
 Function GetOblongDrillGeometry calculates the start point, end point and width of an equivalent segment which have the same position and width as the hole Usefull to plot/draw oblong holes like segments with rounded ends used in draw and plot functions. More...
 
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 () const
 
void SetLocalClearance (int aClearance)
 
int GetLocalSolderPasteMargin () const
 
void SetLocalSolderPasteMargin (int aMargin)
 
double GetLocalSolderPasteMarginRatio () const
 
void SetLocalSolderPasteMarginRatio (double aRatio)
 
void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aMaxError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
 Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments. More...
 
int GetClearance (BOARD_CONNECTED_ITEM *aItem=NULL) const override
 Function GetClearance returns the clearance in internal units. More...
 
int GetSolderMaskMargin () const
 Function GetSolderMaskMargin. More...
 
wxSize GetSolderPasteMargin () const
 Function GetSolderPasteMargin. More...
 
void SetZoneConnection (ZONE_CONNECTION aType)
 
ZONE_CONNECTION GetZoneConnection () const
 
ZONE_CONNECTION GetLocalZoneConnection () const
 
void SetThermalWidth (int aWidth)
 
int GetThermalWidth () const
 
void SetThermalGap (int aGap)
 
int GetThermalGap () const
 
void Print (PCB_BASE_FRAME *aFrame, wxDC *aDC, const wxPoint &aOffset=ZeroOffset) override
 Function Print BOARD_ITEMs have their own color information. More...
 
void PrintShape (wxDC *aDC, PAD_DRAWINFO &aDrawInfo)
 Function PrintShape basic function to print a pad. More...
 
void BuildPadPolygon (wxPoint aCoord[4], wxSize aInflateValue, double aRotation) const
 Function BuildPadPolygon Has meaning only for polygonal pads (trapezoid and rectangular) Build the Corner list of the polygonal shape, depending on shape, extra size (clearance ...) and orientation. More...
 
int GetRoundRectCornerRadius () const
 Function GetRoundRectCornerRadius Has meaning only for rounded rect pads. More...
 
int GetRoundRectCornerRadius (const wxSize &aSize) const
 Helper function GetRoundRectCornerRadius Has meaning only for rounded rect pads Returns the radius of the rounded corners of a rectangle size aSize, using others setting of the pad. More...
 
void SetRoundRectCornerRadius (double aRadius)
 Set the rounded rectangle radius ratio based on a given radius. More...
 
void BuildPadShapePolygon (SHAPE_POLY_SET &aCornerBuffer, wxSize aInflateValue, int aError=ARC_HIGH_DEF) const
 Function BuildPadShapePolygon Build the Corner list of the polygonal shape, depending on shape, extra size (clearance ...) pad and orientation This function is similar to TransformShapeWithClearanceToPolygon, but the difference is BuildPadShapePolygon creates a polygon shape exactly similar to pad shape, which a size inflated by aInflateValue and TransformShapeWithClearanceToPolygon creates a more complex shape (for instance a rectangular pad is converted in a rectangulr shape with ronded corners) More...
 
bool BuildPadDrillShapePolygon (SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, int aError=ARC_HIGH_DEF) const
 Function BuildPadDrillShapePolygon Build the Corner list of the polygonal drill shape, depending on shape pad hole and orientation. More...
 
int BuildSegmentFromOvalShape (wxPoint &aSegStart, wxPoint &aSegEnd, double aRotation, const wxSize &aMargin) const
 Function BuildSegmentFromOvalShape Has meaning only for OVAL (and ROUND) pads Build an equivalent segment having the same shape as the OVAL shape, Useful in draw function and in DRC and HitTest functions, because segments are already well handled by track tests. More...
 
int GetBoundingRadius () const
 Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad. More...
 
wxPoint ShapePos () const
 
double GetRoundRectRadiusRatio () const
 has meaning only for rounded rect pads More...
 
void SetRoundRectRadiusRatio (double aRadiusScale)
 has meaning only for rounded rect pads Set the scaling factor between the smaller Y or Y size and the radius of the rounded corners. More...
 
double GetChamferRectRatio () const
 has meaning only for chamfered rect pads More...
 
void SetChamferRectRatio (double aChamferScale)
 has meaning only for chamfered rect pads Set the ratio between the smaller Y or Y size and the radius of the rounded corners. More...
 
int GetChamferPositions () const
 has meaning only for chamfered rect pads More...
 
void SetChamferPositions (int aChamferPositions)
 has meaning only for chamfered rect pads set the position of the chamfer for a 0 orientation, one of RECT_CHAMFER_TOP_LEFT, RECT_CHAMFER_TOP_RIGHT, RECT_CHAMFER_BOTTOM_LEFT, RECT_CHAMFER_BOTTOM_RIGHT More...
 
int GetSubRatsnest () const
 Function GetSubRatsnest. More...
 
void SetSubRatsnest (int aSubRatsnest)
 
void GetMsgPanelInfo (EDA_UNITS aUnits, 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...
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes. 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...
 
void AppendConfigs (std::vector< PARAM_CFG * > *aResult)
 Function AppendConfigs appends to aResult the configuration setting accessors which will later allow reading or writing of configuration file information directly into this object. 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...
 
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=false)
 Sets net using a net code. More...
 
const wxString & GetNetname () const
 Function GetNetname. More...
 
wxString GetNetnameMsg () const
 Function GetNetnameMsg. More...
 
const wxString & GetShortNetname () const
 Function GetShortNetname. More...
 
std::shared_ptr< NETCLASSGetNetClass () const
 Function GetNetClass returns the NETCLASS for this item. More...
 
wxString GetNetClassName () const
 Function GetNetClassName returns a pointer to the netclass of the zone. More...
 
void SetLocalRatsnestVisible (bool aVisible)
 
bool GetLocalRatsnestVisible () const
 
virtual const 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...
 
void SetParent (EDA_ITEM *aParent)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
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 ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Function IsType Checks whether the item is one of the listed types. More...
 
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...
 
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 ()
 

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 int m_PadSketchModePenSize = 0
 Pen size used to draw pads in sketch mode (mode used to print pads on silkscreen layer) More...
 
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 int getNextNumberInSequence (const std::set< int > &aSeq, bool aFillSequenceGaps)
 

Protected Attributes

NETINFO_ITEMm_netinfo
 Stores all informations about the net that item belongs to. More...
 
PCB_LAYER_ID m_Layer
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

Private Member Functions

int boundingRadius () const
 Function boundingRadius returns a calculated radius of a bounding circle for this pad. More...
 
bool buildCustomPadPolygon (SHAPE_POLY_SET *aMergedPolygon, int aError)
 

Private Attributes

int m_boundingRadius
 radius of the circle containing the pad shape More...
 
wxString m_name
 pad name (pin number in schematic) More...
 
wxString m_pinFunction
 pin function in schematic More...
 
wxPoint m_Pos
 pad Position on board More...
 
PAD_SHAPE_T m_padShape
 Shape: PAD_SHAPE_CIRCLE, PAD_SHAPE_RECT, PAD_SHAPE_OVAL, PAD_SHAPE_TRAPEZOID, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_POLYGON. More...
 
std::vector< PAD_CS_PRIMITIVEm_basicShapes
 for free shape pads: a list of basic shapes, in local coordinates, orient 0, coordinates relative to m_Pos They are expected to define only one copper area. More...
 
SHAPE_POLY_SET m_customShapeAsPolygon
 for free shape pads: the set of basic shapes, merged as one polygon, in local coordinates, orient 0, coordinates relative to m_Pos More...
 
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
 How to build the custom shape in zone, to create the clearance area: CUST_PAD_SHAPE_IN_ZONE_OUTLINE = use pad shape CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL = use the convex hull of the pad shape other values are currently reserved. More...
 
int m_SubRatsnest
 variable used in rats nest computations handle subnet (block) number in ratsnest connection More...
 
wxSize m_Drill
 Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE, drill diam = m_Drill.x. More...
 
wxSize m_Size
 X and Y size ( relative to orient 0) More...
 
PAD_DRILL_SHAPE_T m_drillShape
 PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG. More...
 
double m_padRoundRectRadiusScale
 scaling factor from smallest m_Size coord to corner radius, default 0.25 More...
 
double m_padChamferRectScale
 scaling factor from smallest m_Size coord to chamfer value, default 0.25 More...
 
int m_chamferPositions
 the positions of the chamfered position for a 0 orientation More...
 
PAD_SHAPE_T m_anchorPadShape
 for custom shaped pads: shape of pad anchor, PAD_SHAPE_RECT, PAD_SHAPE_CIRCLE More...
 
wxPoint m_Offset
 m_Offset is useful only for oblong and rect pads (it can be used for other shapes, but without any interest). More...
 
LSET m_layerMask
 Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 . More...
 
wxSize m_DeltaSize
 delta on rectangular shapes More...
 
wxPoint m_Pos0
 Initial Pad position (i.e. More...
 
PAD_ATTR_T m_Attribute
 PAD_ATTRIB_NORMAL, PAD_ATTRIB_SMD, PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED. More...
 
PAD_PROP_T m_Property
 property in fab files (BGA, FIDUCIAL, TEST POINT, CASTELLATED) More...
 
double m_Orient
 in 1/10 degrees More...
 
int m_LengthPadToDie
 Length net from pad to die, inside the package. More...
 
int m_LocalClearance
 Local clearance. More...
 
int m_LocalSolderMaskMargin
 Local mask margins: when 0, the parent footprint design values are used. More...
 
int m_LocalSolderPasteMargin
 Local solder paste margin absolute value. More...
 
double m_LocalSolderPasteMarginRatio
 Local solder mask margin ratio value of pad size The final margin is the sum of these 2 values. More...
 
ZONE_CONNECTION m_ZoneConnection
 how the connection to zone is made: no connection, thermal relief ... More...
 
int m_ThermalWidth
 
int m_ThermalGap
 

Detailed Description

Definition at line 140 of file class_pad.h.

Constructor & Destructor Documentation

◆ D_PAD()

D_PAD::D_PAD ( MODULE parent)

Definition at line 60 of file class_pad.cpp.

60  :
62 {
63  m_Size.x = m_Size.y = Mils2iu( 60 ); // Default pad size 60 mils.
64  m_Drill.x = m_Drill.y = Mils2iu( 30 ); // Default drill size 30 mils.
65  m_Orient = 0; // Pad rotation in 1/10 degrees.
66  m_LengthPadToDie = 0;
67 
68  if( m_Parent && m_Parent->Type() == PCB_MODULE_T )
69  {
71  }
72 
73  SetShape( PAD_SHAPE_CIRCLE ); // Default pad shape is PAD_CIRCLE.
74  SetAnchorPadShape( PAD_SHAPE_CIRCLE ); // Default shape for custom shaped pads
75  // is PAD_CIRCLE.
76  SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); // Default pad drill shape is a circle.
77  m_Attribute = PAD_ATTRIB_STANDARD; // Default pad type is NORMAL (thru hole)
78  SetProperty( PAD_PROP_NONE ); // no special fabrication property
79  m_LocalClearance = 0;
83  // Parameters for round rect only:
84  m_padRoundRectRadiusScale = 0.25; // from IPC-7351C standard
85  // Parameters for chamfered rect only:
86  m_padChamferRectScale = 0.2; // Size of chamfer: ratio of smallest of X,Y size
87  m_chamferPositions = RECT_NO_CHAMFER; // No chamfered corner
88 
89  m_ZoneConnection = ZONE_CONNECTION::INHERITED; // Use parent setting by default
90  m_ThermalWidth = 0; // Use parent setting by default
91  m_ThermalGap = 0; // Use parent setting by default
92 
94 
95  // Set layers mask to default for a standard thru hole pad.
97 
98  SetSubRatsnest( 0 ); // used in ratsnest calculations
99 
100  m_boundingRadius = -1;
101 }
int m_LocalClearance
Local clearance.
Definition: class_pad.h:939
int m_ThermalGap
Definition: class_pad.h:952
int m_LocalSolderMaskMargin
Local mask margins: when 0, the parent footprint design values are used.
Definition: class_pad.h:943
double m_padRoundRectRadiusScale
scaling factor from smallest m_Size coord to corner radius, default 0.25
Definition: class_pad.h:894
int m_boundingRadius
radius of the circle containing the pad shape
Definition: class_pad.h:851
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:183
double m_padChamferRectScale
scaling factor from smallest m_Size coord to chamfer value, default 0.25
Definition: class_pad.h:896
static LSET StandardMask()
layer set for a through hole pad
Definition: class_pad.cpp:104
no special fabrication property
Definition: pad_shapes.h:78
int m_LocalSolderPasteMargin
Local solder paste margin absolute value.
Definition: class_pad.h:944
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
void SetSubRatsnest(int aSubRatsnest)
Definition: class_pad.h:742
ZONE_CONNECTION m_ZoneConnection
how the connection to zone is made: no connection, thermal relief ...
Definition: class_pad.h:949
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:274
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
How to build the custom shape in zone, to create the clearance area: CUST_PAD_SHAPE_IN_ZONE_OUTLINE =...
Definition: class_pad.h:881
int m_ThermalWidth
Definition: class_pad.h:951
int m_chamferPositions
the positions of the chamfered position for a 0 orientation
Definition: class_pad.h:898
MODULE * GetParent() const
Definition: class_pad.h:167
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:919
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:430
int m_LengthPadToDie
Length net from pad to die, inside the package.
Definition: class_pad.h:934
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:238
PAD_ATTR_T m_Attribute
PAD_ATTRIB_NORMAL, PAD_ATTRIB_SMD, PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED.
Definition: class_pad.h:928
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:886
double m_Orient
in 1/10 degrees
Definition: class_pad.h:932
double m_LocalSolderPasteMarginRatio
Local solder mask margin ratio value of pad size The final margin is the sum of these 2 values.
Definition: class_pad.h:946
void SetProperty(PAD_PROP_T aProperty)
Definition: class_pad.cpp:432
const wxPoint GetPosition() const override
Definition: class_module.h:210
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
wxPoint m_Pos
pad Position on board
Definition: class_pad.h:858

References CUST_PAD_SHAPE_IN_ZONE_OUTLINE, GetParent(), MODULE::GetPosition(), INHERITED, m_Attribute, m_boundingRadius, m_chamferPositions, m_customShapeClearanceArea, m_Drill, m_layerMask, m_LengthPadToDie, m_LocalClearance, m_LocalSolderMaskMargin, m_LocalSolderPasteMargin, m_LocalSolderPasteMarginRatio, m_Orient, m_padChamferRectScale, m_padRoundRectRadiusScale, EDA_ITEM::m_Parent, m_Pos, 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

◆ AddPrimitiveArc()

void D_PAD::AddPrimitiveArc ( wxPoint  aCenter,
wxPoint  aStart,
int  aArcAngle,
int  aThickness,
bool  aMergePrimitives = true 
)

arc basic shape

Definition at line 176 of file pad_custom_shape_functions.cpp.

178 {
179  PAD_CS_PRIMITIVE shape( S_ARC );
180  shape.m_Start = aCenter;
181  shape.m_End = aStart;
182  shape.m_ArcAngle = aArcAngle;
183  shape.m_Thickness = aThickness;
184  m_basicShapes.push_back( shape );
185 
186  if( aMergePrimitives )
188 }
std::vector< PAD_CS_PRIMITIVE > m_basicShapes
for free shape pads: a list of basic shapes, in local coordinates, orient 0, coordinates relative to ...
Definition: class_pad.h:868
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89

References PAD_CS_PRIMITIVE::m_ArcAngle, m_basicShapes, PAD_CS_PRIMITIVE::m_End, PAD_CS_PRIMITIVE::m_Start, PAD_CS_PRIMITIVE::m_Thickness, MergePrimitivesAsPolygon(), and S_ARC.

◆ AddPrimitiveCircle()

void D_PAD::AddPrimitiveCircle ( wxPoint  aCenter,
int  aRadius,
int  aThickness,
bool  aMergePrimitives = true 
)

ring or circle basic shape

Definition at line 207 of file pad_custom_shape_functions.cpp.

209 {
210  PAD_CS_PRIMITIVE shape( S_CIRCLE );
211  shape.m_Start = aCenter;
212  shape.m_Radius = aRadius;
213  shape.m_Thickness = aThickness;
214  m_basicShapes.push_back( shape );
215 
216  if( aMergePrimitives )
218 }
std::vector< PAD_CS_PRIMITIVE > m_basicShapes
for free shape pads: a list of basic shapes, in local coordinates, orient 0, coordinates relative to ...
Definition: class_pad.h:868
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89

References m_basicShapes, PAD_CS_PRIMITIVE::m_Radius, PAD_CS_PRIMITIVE::m_Start, PAD_CS_PRIMITIVE::m_Thickness, MergePrimitivesAsPolygon(), and S_CIRCLE.

◆ AddPrimitiveCurve()

void D_PAD::AddPrimitiveCurve ( wxPoint  aStart,
wxPoint  aEnd,
wxPoint  aCtrl1,
wxPoint  aCtrl2,
int  aThickness,
bool  aMergePrimitives = true 
)

curve basic shape

Definition at line 191 of file pad_custom_shape_functions.cpp.

193 {
194  PAD_CS_PRIMITIVE shape( S_CURVE );
195  shape.m_Start = aStart;
196  shape.m_End = aEnd;
197  shape.m_Ctrl1 = aCtrl1;
198  shape.m_Ctrl2 = aCtrl2;
199  shape.m_Thickness = aThickness;
200  m_basicShapes.push_back( shape );
201 
202  if( aMergePrimitives )
204 }
std::vector< PAD_CS_PRIMITIVE > m_basicShapes
for free shape pads: a list of basic shapes, in local coordinates, orient 0, coordinates relative to ...
Definition: class_pad.h:868
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89
Bezier Curve.

References m_basicShapes, PAD_CS_PRIMITIVE::m_Ctrl1, PAD_CS_PRIMITIVE::m_Ctrl2, PAD_CS_PRIMITIVE::m_End, PAD_CS_PRIMITIVE::m_Start, PAD_CS_PRIMITIVE::m_Thickness, MergePrimitivesAsPolygon(), and S_CURVE.

◆ AddPrimitivePoly() [1/2]

void D_PAD::AddPrimitivePoly ( const SHAPE_POLY_SET aPoly,
int  aThickness,
bool  aMergePrimitives = true 
)

Has meaning only for free 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 or ring ( if thickness == 0, this is a filled circle, else a ring) a arc a curveadd a polygonal basic shape

Definition at line 134 of file pad_custom_shape_functions.cpp.

135 {
136  std::vector<wxPoint> points;
137 
138  // If aPoly has holes, convert it to a polygon with no holes.
139  SHAPE_POLY_SET poly_no_hole;
140  poly_no_hole.Append( aPoly );
142 
143  for( auto iter = poly_no_hole.CIterate(); iter; iter++ )
144  points.emplace_back( iter->x, iter->y );
145 
146  AddPrimitivePoly( points, aThickness, aMergePrimitives );
147 }
void AddPrimitivePoly(const SHAPE_POLY_SET &aPoly, int aThickness, bool aMergePrimitives=true)
Has meaning only for free shape pads.
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...
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 PCB_EDIT_FRAME::Create_MuWaveComponent().

◆ AddPrimitivePoly() [2/2]

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

add a polygonal basic shape

Definition at line 149 of file pad_custom_shape_functions.cpp.

151 {
152  PAD_CS_PRIMITIVE shape( S_POLYGON );
153  shape.m_Poly = aPoly;
154  shape.m_Thickness = aThickness;
155  m_basicShapes.push_back( shape );
156 
157  if( aMergePrimitives )
159 }
std::vector< PAD_CS_PRIMITIVE > m_basicShapes
for free shape pads: a list of basic shapes, in local coordinates, orient 0, coordinates relative to ...
Definition: class_pad.h:868
polygon (not yet used for tracks, but could be in microwave apps)
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89

References m_basicShapes, PAD_CS_PRIMITIVE::m_Poly, PAD_CS_PRIMITIVE::m_Thickness, MergePrimitivesAsPolygon(), and S_POLYGON.

◆ AddPrimitives()

bool D_PAD::AddPrimitives ( const std::vector< PAD_CS_PRIMITIVE > &  aPrimitivesList)

Add to the basic shape list.

Returns
true if OK, false if issues (more than one polygon to build the polygon shape list)

Definition at line 234 of file pad_custom_shape_functions.cpp.

235 {
236  for( const auto& prim : aPrimitivesList )
237  m_basicShapes.push_back( prim );
238 
239  return MergePrimitivesAsPolygon();
240 }
std::vector< PAD_CS_PRIMITIVE > m_basicShapes
for free shape pads: a list of basic shapes, in local coordinates, orient 0, coordinates relative to ...
Definition: class_pad.h:868
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.

References m_basicShapes, and MergePrimitivesAsPolygon().

◆ AddPrimitiveSegment()

void D_PAD::AddPrimitiveSegment ( wxPoint  aStart,
wxPoint  aEnd,
int  aThickness,
bool  aMergePrimitives = true 
)

segment basic shape

Definition at line 162 of file pad_custom_shape_functions.cpp.

164 {
165  PAD_CS_PRIMITIVE shape( S_SEGMENT );
166  shape.m_Start = aStart;
167  shape.m_End = aEnd;
168  shape.m_Thickness = aThickness;
169  m_basicShapes.push_back( shape );
170 
171  if( aMergePrimitives )
173 }
std::vector< PAD_CS_PRIMITIVE > m_basicShapes
for free shape pads: a list of basic shapes, in local coordinates, orient 0, coordinates relative to ...
Definition: class_pad.h:868
usual segment : line with rounded ends
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89

References m_basicShapes, PAD_CS_PRIMITIVE::m_End, PAD_CS_PRIMITIVE::m_Start, PAD_CS_PRIMITIVE::m_Thickness, MergePrimitivesAsPolygon(), and S_SEGMENT.

◆ ApertureMask()

LSET D_PAD::ApertureMask ( )
static

layer set for an aperture pad

Definition at line 132 of file class_pad.cpp.

133 {
134  static LSET saved = LSET( 1, F_Paste );
135  return saved;
136 }
LSET is a set of PCB_LAYER_IDs.

References F_Paste.

Referenced by PAD_FIXTURE::MakeAperture().

◆ AppendConfigs()

void D_PAD::AppendConfigs ( std::vector< PARAM_CFG * > *  aResult)

Function AppendConfigs appends to aResult the configuration setting accessors which will later allow reading or writing of configuration file information directly into this object.

Definition at line 538 of file class_pad.cpp.

539 {
540  // Parameters stored in config are only significant parameters
541  // for a template.
542  // So not all parameters are stored, just few.
543  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadDrill" ),
544  &m_Drill.x,
545  Millimeter2iu( 0.6 ),
546  Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ),
547  NULL, MM_PER_IU ) );
548 
549  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadDrillOvalY" ),
550  &m_Drill.y,
551  Millimeter2iu( 0.6 ),
552  Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ),
553  NULL, MM_PER_IU ) );
554 
555  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeH" ),
556  &m_Size.x,
557  Millimeter2iu( 1.4 ),
558  Millimeter2iu( 0.1 ), Millimeter2iu( 20.0 ),
559  NULL, MM_PER_IU ) );
560 
561  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeV" ),
562  &m_Size.y,
563  Millimeter2iu( 1.4 ),
564  Millimeter2iu( 0.1 ), Millimeter2iu( 20.0 ),
565  NULL, MM_PER_IU ) );
566 }
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
Configuration parameter - Integer Class with unit conversion.
#define NULL
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:886

References m_Drill, m_Size, and NULL.

◆ boundingRadius()

int D_PAD::boundingRadius ( ) const
private

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

Definition at line 146 of file class_pad.cpp.

147 {
148  int x, y;
149  int radius;
150 
151  switch( GetShape() )
152  {
153  case PAD_SHAPE_CIRCLE:
154  radius = m_Size.x / 2;
155  break;
156 
157  case PAD_SHAPE_OVAL:
158  radius = std::max( m_Size.x, m_Size.y ) / 2;
159  break;
160 
161  case PAD_SHAPE_RECT:
162  radius = 1 + KiROUND( EuclideanNorm( m_Size ) / 2 );
163  break;
164 
165  case PAD_SHAPE_TRAPEZOID:
166  x = m_Size.x + std::abs( m_DeltaSize.y ); // Remember: m_DeltaSize.y is the m_Size.x change
167  y = m_Size.y + std::abs( m_DeltaSize.x ); // Remember: m_DeltaSize.x is the m_Size.y change
168  radius = 1 + KiROUND( hypot( x, y ) / 2 );
169  break;
170 
171  case PAD_SHAPE_ROUNDRECT:
172  radius = GetRoundRectCornerRadius();
173  x = m_Size.x >> 1;
174  y = m_Size.y >> 1;
175  radius += 1 + KiROUND( EuclideanNorm( wxSize( x - radius, y - radius )));
176  break;
177 
179  radius = GetRoundRectCornerRadius();
180  x = m_Size.x >> 1;
181  y = m_Size.y >> 1;
182  radius += 1 + KiROUND( EuclideanNorm( wxSize( x - radius, y - radius )));
183  // TODO: modify radius if the chamfer is smaller than corner radius
184  break;
185 
186  case PAD_SHAPE_CUSTOM:
187  radius = 0;
188 
189  for( int cnt = 0; cnt < m_customShapeAsPolygon.OutlineCount(); ++cnt )
190  {
191  const SHAPE_LINE_CHAIN& poly = m_customShapeAsPolygon.COutline( cnt );
192  for( int ii = 0; ii < poly.PointCount(); ++ii )
193  {
194  int dist = KiROUND( poly.CPoint( ii ).EuclideanNorm() );
195  radius = std::max( radius, dist );
196  }
197  }
198 
199  radius += 1;
200  break;
201 
202  default:
203  radius = 0;
204  }
205 
206  return radius;
207 }
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
static const int dist[10][10]
Definition: ar_matrix.cpp:326
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
SHAPE_POLY_SET m_customShapeAsPolygon
for free shape pads: the set of basic shapes, merged as one polygon, in local coordinates,...
Definition: class_pad.h:873
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:923
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:61
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:577
T EuclideanNorm() const
Destructor.
Definition: vector2d.h:299
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237

References SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), dist, EuclideanNorm(), VECTOR2< T >::EuclideanNorm(), GetRoundRectCornerRadius(), GetShape(), KiROUND(), m_customShapeAsPolygon, m_DeltaSize, m_Size, SHAPE_POLY_SET::OutlineCount(), PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, and SHAPE_LINE_CHAIN::PointCount().

Referenced by GetBoundingRadius().

◆ buildCustomPadPolygon()

bool D_PAD::buildCustomPadPolygon ( SHAPE_POLY_SET aMergedPolygon,
int  aError 
)
private

Definition at line 251 of file pad_custom_shape_functions.cpp.

253 {
254  SHAPE_POLY_SET aux_polyset;
255 
256  for( unsigned cnt = 0; cnt < m_basicShapes.size(); ++cnt )
257  {
258  const PAD_CS_PRIMITIVE& bshape = m_basicShapes[cnt];
259 
260  switch( bshape.m_Shape )
261  {
262  case S_CURVE:
263  {
264  std::vector<wxPoint> ctrlPoints = { bshape.m_Start, bshape.m_Ctrl1, bshape.m_Ctrl2, bshape.m_End };
265  BEZIER_POLY converter( ctrlPoints );
266  std::vector< wxPoint> poly;
267  converter.GetPoly( poly, bshape.m_Thickness );
268 
269  for( unsigned ii = 1; ii < poly.size(); ii++ )
270  {
272  aux_polyset, poly[ ii - 1 ], poly[ ii ], aError, bshape.m_Thickness );
273  }
274  break;
275  }
276 
277  case S_SEGMENT: // usual segment : line with rounded ends
278  {
280  aux_polyset, bshape.m_Start, bshape.m_End, aError, bshape.m_Thickness );
281  break;
282  }
283 
284  case S_ARC: // Arc with rounded ends
285  {
286  TransformArcToPolygon( aux_polyset, bshape.m_Start, bshape.m_End, bshape.m_ArcAngle,
287  aError, bshape.m_Thickness );
288  break;
289  }
290 
291  case S_CIRCLE: // ring or circle
292  {
293  if( bshape.m_Thickness ) // ring
295  aux_polyset, bshape.m_Start, bshape.m_Radius, aError, bshape.m_Thickness );
296  else // Filled circle
297  TransformCircleToPolygon( aux_polyset, bshape.m_Start, bshape.m_Radius, aError );
298  break;
299  }
300 
301  case S_POLYGON: // polygon
302  if( bshape.m_Poly.size() < 2 )
303  break; // Malformed polygon.
304  {
305  // Insert the polygon:
306  const std::vector< wxPoint>& poly = bshape.m_Poly;
307  aux_polyset.NewOutline();
308 
309  if( bshape.m_Thickness )
310  {
311  SHAPE_POLY_SET polyset;
312  polyset.NewOutline();
313 
314  for( unsigned ii = 0; ii < poly.size(); ii++ )
315  {
316  polyset.Append( poly[ii].x, poly[ii].y );
317  }
318 
319  int numSegs = std::max(
320  GetArcToSegmentCount( bshape.m_Thickness / 2, aError, 360.0 ), 6 );
321  polyset.Inflate( bshape.m_Thickness / 2, numSegs );
322 
323  aux_polyset.Append( polyset );
324  }
325  else
326  for( unsigned ii = 0; ii < poly.size(); ii++ )
327  aux_polyset.Append( poly[ii].x, poly[ii].y );
328  }
329  break;
330 
331  default:
332  break;
333  }
334  }
335 
336  aux_polyset.Simplify( SHAPE_POLY_SET::PM_FAST );
337 
338  // Merge all polygons with the initial pad anchor shape
339  if( aux_polyset.OutlineCount() )
340  {
341  aMergedPolygon->BooleanAdd( aux_polyset, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
342  aMergedPolygon->Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
343  }
344 
345  return aMergedPolygon->OutlineCount() <= 1;
346 }
std::vector< PAD_CS_PRIMITIVE > m_basicShapes
for free shape pads: a list of basic shapes, in local coordinates, orient 0, coordinates relative to ...
Definition: class_pad.h:868
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
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:98
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
void TransformArcToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, wxPoint aStart, double aArcAngle, int aError, int aWidth)
Function TransformArcToPolygon Creates a polygon from an Arc Convert arcs to multiple straight segmen...
void Inflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Performs outline inflation/deflation.
wxPoint m_Ctrl1
is also the start point of the arc
Definition: class_pad.h:100
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:96
std::vector< wxPoint > m_Poly
Bezier Control point 2.
Definition: class_pad.h:102
SHAPE_POLY_SET.
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
Bezier Curve.
wxPoint m_End
is also the center of the circle and arc
Definition: class_pad.h:99
int NewOutline()
Creates a new empty polygon in the set and returns its index
STROKE_T m_Shape
Definition: class_pad.h:92
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
wxPoint m_Ctrl2
Bezier Control point 1.
Definition: class_pad.h:101
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:93
Bezier curves to polygon converter.
Definition: bezier_curves.h:35
void TransformCircleToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCenter, int aRadius, int aError)
Function TransformCircleToPolygon convert a circle to a polygon, using multiple straight lines.
void TransformSegmentToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aError, int aWidth)
Function TransformRoundedEndsSegmentToPolygon convert a segment with rounded ends to a polygon Conver...
void TransformRingToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, int aRadius, int aError, int aWidth)
Function TransformRingToPolygon Creates a polygon from a ring Convert arcs to multiple straight segme...
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)
double m_ArcAngle
radius of a circle
Definition: class_pad.h:97
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::BooleanAdd(), SHAPE_POLY_SET::Fracture(), GetArcToSegmentCount(), BEZIER_POLY::GetPoly(), SHAPE_POLY_SET::Inflate(), PAD_CS_PRIMITIVE::m_ArcAngle, m_basicShapes, PAD_CS_PRIMITIVE::m_Ctrl1, PAD_CS_PRIMITIVE::m_Ctrl2, PAD_CS_PRIMITIVE::m_End, PAD_CS_PRIMITIVE::m_Poly, PAD_CS_PRIMITIVE::m_Radius, PAD_CS_PRIMITIVE::m_Shape, PAD_CS_PRIMITIVE::m_Start, PAD_CS_PRIMITIVE::m_Thickness, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::PM_FAST, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_SEGMENT, SHAPE_POLY_SET::Simplify(), TransformArcToPolygon(), TransformCircleToPolygon(), TransformRingToPolygon(), and TransformSegmentToPolygon().

Referenced by GetBestAnchorPosition(), and MergePrimitivesAsPolygon().

◆ BuildPadDrillShapePolygon()

bool D_PAD::BuildPadDrillShapePolygon ( SHAPE_POLY_SET aCornerBuffer,
int  aInflateValue,
int  aError = ARC_HIGH_DEF 
) const

Function BuildPadDrillShapePolygon Build the Corner list of the polygonal drill shape, depending on shape pad hole and orientation.

Parameters
aCornerBuffer= a buffer to fill.
aInflateValue= the clearance or margin value. value > 0: inflate, < 0 deflate, = 0 : no change
aError= Maximum deviation of an arc from the polygon approximation
Returns
false if the pad has no hole, true otherwise

Definition at line 733 of file board_items_to_polygon_shape_transform.cpp.

735 {
736  wxSize drillsize = GetDrillSize();
737 
738  if( !drillsize.x || !drillsize.y )
739  return false;
740 
741  if( drillsize.x == drillsize.y ) // usual round hole
742  {
743  int radius = ( drillsize.x / 2 ) + aInflateValue;
744  TransformCircleToPolygon( aCornerBuffer, GetPosition(), radius, aError );
745  }
746  else // Oblong hole
747  {
748  wxPoint start, end;
749  int width;
750 
751  GetOblongDrillGeometry( start, end, width );
752 
753  start += GetPosition();
754  end += GetPosition();
755  width += aInflateValue * 2;
756 
757  TransformSegmentToPolygon( aCornerBuffer, start, end, aError, width );
758  }
759 
760  return true;
761 }
void GetOblongDrillGeometry(wxPoint &aStartPoint, wxPoint &aEndPoint, int &aWidth) const
Function GetOblongDrillGeometry calculates the start point, end point and width of an equivalent segm...
Definition: class_pad.cpp:846
const wxSize & GetDrillSize() const
Definition: class_pad.h:306
void TransformCircleToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCenter, int aRadius, int aError)
Function TransformCircleToPolygon convert a circle to a polygon, using multiple straight lines.
void TransformSegmentToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aError, int aWidth)
Function TransformRoundedEndsSegmentToPolygon convert a segment with rounded ends to a polygon Conver...
const wxPoint GetPosition() const override
Definition: class_pad.h:241

References GetDrillSize(), GetOblongDrillGeometry(), GetPosition(), TransformCircleToPolygon(), and TransformSegmentToPolygon().

◆ BuildPadPolygon()

void D_PAD::BuildPadPolygon ( wxPoint  aCoord[4],
wxSize  aInflateValue,
double  aRotation 
) const

Function BuildPadPolygon Has meaning only for polygonal pads (trapezoid and rectangular) Build the Corner list of the polygonal shape, depending on shape, extra size (clearance ...) and orientation.

Parameters
aCoord= a buffer to fill (4 corners).
aInflateValue= wxSize: the clearance or margin value. value > 0: inflate, < 0 deflate
aRotation= full rotation of the polygon

Definition at line 617 of file pad_print_functions.cpp.

619 {
620  wxSize delta;
621  wxSize halfsize;
622 
623  halfsize.x = m_Size.x >> 1;
624  halfsize.y = m_Size.y >> 1;
625 
626  switch( GetShape() )
627  {
628  case PAD_SHAPE_RECT:
629  // For rectangular shapes, inflate is easy
630  halfsize += aInflateValue;
631 
632  // Verify if do not deflate more than than size
633  // Only possible for inflate negative values.
634  if( halfsize.x < 0 )
635  halfsize.x = 0;
636 
637  if( halfsize.y < 0 )
638  halfsize.y = 0;
639  break;
640 
641  case PAD_SHAPE_TRAPEZOID:
642  // Trapezoidal pad: verify delta values
643  delta.x = ( m_DeltaSize.x >> 1 );
644  delta.y = ( m_DeltaSize.y >> 1 );
645 
646  // be sure delta values are not to large
647  if( (delta.x < 0) && (delta.x <= -halfsize.y) )
648  delta.x = -halfsize.y + 1;
649 
650  if( (delta.x > 0) && (delta.x >= halfsize.y) )
651  delta.x = halfsize.y - 1;
652 
653  if( (delta.y < 0) && (delta.y <= -halfsize.x) )
654  delta.y = -halfsize.x + 1;
655 
656  if( (delta.y > 0) && (delta.y >= halfsize.x) )
657  delta.y = halfsize.x - 1;
658  break;
659 
660  default: // is used only for rect and trap. pads
661  return;
662  }
663 
664  // Build the basic rectangular or trapezoid shape
665  // delta is null for rectangular shapes
666  aCoord[0].x = -halfsize.x - delta.y; // lower left
667  aCoord[0].y = +halfsize.y + delta.x;
668 
669  aCoord[1].x = -halfsize.x + delta.y; // upper left
670  aCoord[1].y = -halfsize.y - delta.x;
671 
672  aCoord[2].x = +halfsize.x - delta.y; // upper right
673  aCoord[2].y = -halfsize.y + delta.x;
674 
675  aCoord[3].x = +halfsize.x + delta.y; // lower right
676  aCoord[3].y = +halfsize.y - delta.x;
677 
678  // Offsetting the trapezoid shape id needed
679  // It is assumed delta.x or/and delta.y == 0
680  if( GetShape() == PAD_SHAPE_TRAPEZOID && (aInflateValue.x != 0 || aInflateValue.y != 0) )
681  {
682  double angle;
683  wxSize corr;
684 
685  if( delta.y ) // lower and upper segment is horizontal
686  {
687  // Calculate angle of left (or right) segment with vertical axis
688  angle = atan2( (double) m_DeltaSize.y, (double) m_Size.y );
689 
690  // left and right sides are moved by aInflateValue.x in their perpendicular direction
691  // We must calculate the corresponding displacement on the horizontal axis
692  // that is delta.x +- corr.x depending on the corner
693  corr.x = KiROUND( tan( angle ) * aInflateValue.x );
694  delta.x = KiROUND( aInflateValue.x / cos( angle ) );
695 
696  // Horizontal sides are moved up and down by aInflateValue.y
697  delta.y = aInflateValue.y;
698 
699  // corr.y = 0 by the constructor
700  }
701  else if( delta.x ) // left and right segment is vertical
702  {
703  // Calculate angle of lower (or upper) segment with horizontal axis
704  angle = atan2( (double) m_DeltaSize.x, (double) m_Size.x );
705 
706  // lower and upper sides are moved by aInflateValue.x in their perpendicular direction
707  // We must calculate the corresponding displacement on the vertical axis
708  // that is delta.y +- corr.y depending on the corner
709  corr.y = KiROUND( tan( angle ) * aInflateValue.y );
710  delta.y = KiROUND( aInflateValue.y / cos( angle ) );
711 
712  // Vertical sides are moved left and right by aInflateValue.x
713  delta.x = aInflateValue.x;
714 
715  // corr.x = 0 by the constructor
716  }
717  else // the trapezoid is a rectangle
718  {
719  delta = aInflateValue; // this pad is rectangular (delta null).
720  }
721 
722  aCoord[0].x += -delta.x - corr.x; // lower left
723  aCoord[0].y += delta.y + corr.y;
724 
725  aCoord[1].x += -delta.x + corr.x; // upper left
726  aCoord[1].y += -delta.y - corr.y;
727 
728  aCoord[2].x += delta.x - corr.x; // upper right
729  aCoord[2].y += -delta.y + corr.y;
730 
731  aCoord[3].x += delta.x + corr.x; // lower right
732  aCoord[3].y += delta.y - corr.y;
733 
734  /* test coordinates and clamp them if the offset correction is too large:
735  * Note: if a coordinate is bad, the other "symmetric" coordinate is bad
736  * So when a bad coordinate is found, the 2 symmetric coordinates
737  * are set to the minimun value (0)
738  */
739 
740  if( aCoord[0].x > 0 ) // lower left x coordinate must be <= 0
741  aCoord[0].x = aCoord[3].x = 0;
742 
743  if( aCoord[1].x > 0 ) // upper left x coordinate must be <= 0
744  aCoord[1].x = aCoord[2].x = 0;
745 
746  if( aCoord[0].y < 0 ) // lower left y coordinate must be >= 0
747  aCoord[0].y = aCoord[1].y = 0;
748 
749  if( aCoord[3].y < 0 ) // lower right y coordinate must be >= 0
750  aCoord[3].y = aCoord[2].y = 0;
751  }
752 
753  if( aRotation )
754  {
755  for( int ii = 0; ii < 4; ii++ )
756  RotatePoint( &aCoord[ii], aRotation );
757  }
758 }
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:923
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
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:61
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237

References PNS::angle(), GetShape(), KiROUND(), m_DeltaSize, m_Size, PAD_SHAPE_RECT, PAD_SHAPE_TRAPEZOID, RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by CINFO3D_VISU::buildPadShapePolygon(), BuildPadShapePolygon(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), CINFO3D_VISU::createNewPadWithClearance(), CreatePadsShapesSection(), HitTest(), BRDITEMS_PLOTTER::PlotPad(), PrintShape(), PNS_KICAD_IFACE_BASE::syncPad(), and TransformShapeWithClearanceToPolygon().

◆ BuildPadShapePolygon()

void D_PAD::BuildPadShapePolygon ( SHAPE_POLY_SET aCornerBuffer,
wxSize  aInflateValue,
int  aError = ARC_HIGH_DEF 
) const

Function BuildPadShapePolygon Build the Corner list of the polygonal shape, depending on shape, extra size (clearance ...) pad and orientation This function is similar to TransformShapeWithClearanceToPolygon, but the difference is BuildPadShapePolygon creates a polygon shape exactly similar to pad shape, which a size inflated by aInflateValue and TransformShapeWithClearanceToPolygon creates a more complex shape (for instance a rectangular pad is converted in a rectangulr shape with ronded corners)

Parameters
aCornerBuffer= a buffer to fill.
aInflateValue= the clearance or margin value. value > 0: inflate, < 0 deflate, = 0 : no change the clearance can have different values for x and y directions (relative to the pad)
aError= Maximum deviation of an arc from the polygon segment

Definition at line 680 of file board_items_to_polygon_shape_transform.cpp.

682 {
683  switch( GetShape() )
684  {
685  case PAD_SHAPE_CIRCLE:
686  case PAD_SHAPE_OVAL:
687  case PAD_SHAPE_ROUNDRECT:
689  {
690  // We are using TransformShapeWithClearanceToPolygon to build the shape.
691  // Currently, this method uses only the same inflate value for X and Y dirs.
692  // so because here this is not the case, we use a inflated dummy pad to build
693  // the polygonal shape
694  // TODO: remove this dummy pad when TransformShapeWithClearanceToPolygon will use
695  // a wxSize to inflate the pad size
696  D_PAD dummy( *this );
697  dummy.SetSize( GetSize() + aInflateValue + aInflateValue );
698  dummy.TransformShapeWithClearanceToPolygon( aCornerBuffer, 0 );
699  }
700  break;
701 
702  case PAD_SHAPE_TRAPEZOID:
703  case PAD_SHAPE_RECT:
704  {
705  wxPoint corners[4];
706  wxPoint padShapePos = ShapePos(); // Note: for pad having a shape offset,
707  // the pad position is NOT the shape position
708 
709  aCornerBuffer.NewOutline();
710  BuildPadPolygon( corners, aInflateValue, m_Orient );
711 
712  for( wxPoint& corner : corners )
713  {
714  corner += padShapePos; // Shift origin to position
715  aCornerBuffer.Append( corner.x, corner.y );
716  }
717  }
718  break;
719 
720  case PAD_SHAPE_CUSTOM:
721  {
722  // For a custom shape, that is in fact a polygon (with holes), we use only a single
723  // inflate value (different values for X and Y have no definition for a custom pad).
724  int inflate = ( aInflateValue.x + aInflateValue.y ) / 2;
725 
726  TransformShapeWithClearanceToPolygon( aCornerBuffer, inflate );
727  }
728  break;
729  }
730 }
int NewOutline()
Creates a new empty polygon in the set and returns its index
void BuildPadPolygon(wxPoint aCoord[4], wxSize aInflateValue, double aRotation) const
Function BuildPadPolygon Has meaning only for polygonal pads (trapezoid and rectangular) Build the Co...
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aMaxError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon Used in filli...
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
wxPoint ShapePos() const
Definition: class_pad.cpp:570
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237
double m_Orient
in 1/10 degrees
Definition: class_pad.h:932
const wxSize & GetSize() const
Definition: class_pad.h:300
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(), BuildPadPolygon(), dummy(), GetShape(), GetSize(), m_Orient, SHAPE_POLY_SET::NewOutline(), PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, ShapePos(), and TransformShapeWithClearanceToPolygon().

Referenced by CINFO3D_VISU::buildPadShapeThickOutlineAsSegments(), CN_ITEM::GetAnchor(), and PNS_KICAD_IFACE_BASE::syncPad().

◆ BuildSegmentFromOvalShape()

int D_PAD::BuildSegmentFromOvalShape ( wxPoint aSegStart,
wxPoint aSegEnd,
double  aRotation,
const wxSize &  aMargin 
) const

Function BuildSegmentFromOvalShape Has meaning only for OVAL (and ROUND) pads Build an equivalent segment having the same shape as the OVAL shape, Useful in draw function and in DRC and HitTest functions, because segments are already well handled by track tests.

Function BuildSegmentFromOvalShape Has meaning only for OVAL (and ROUND) pads.

Parameters
aSegStart= the starting point of the equivalent segment relative to the shape position.
aSegEnd= the ending point of the equivalent segment, relative to the shape position
aRotation= full rotation of the segment
aRotation= full rotation of the segment
aMargin= a margin around the shape (for instance mask margin)
Returns
the width of the segment

Build an equivalent segment having the same shape as the OVAL shape, aSegStart and aSegEnd are the ending points of the equivalent segment of the shape aRotation is the asked rotation of the segment (usually m_Orient)

Definition at line 583 of file pad_print_functions.cpp.

585 {
586  int width;
587 
588  if( m_Size.y < m_Size.x ) // Build an horizontal equiv segment
589  {
590  int delta = ( m_Size.x - m_Size.y ) / 2;
591  aSegStart.x = -delta - aMargin.x;
592  aSegStart.y = 0;
593  aSegEnd.x = delta + aMargin.x;
594  aSegEnd.y = 0;
595  width = m_Size.y + ( aMargin.y * 2 );
596  }
597  else // Vertical oval: build a vertical equiv segment
598  {
599  int delta = ( m_Size.y -m_Size.x ) / 2;
600  aSegStart.x = 0;
601  aSegStart.y = -delta - aMargin.y;
602  aSegEnd.x = 0;
603  aSegEnd.y = delta + aMargin.y;
604  width = m_Size.x + ( aMargin.x * 2 );
605  }
606 
607  if( aRotation )
608  {
609  RotatePoint( &aSegStart, aRotation);
610  RotatePoint( &aSegEnd, aRotation);
611  }
612 
613  return width;
614 }
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208

References m_Size, RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by PrintShape(), and PNS_KICAD_IFACE_BASE::syncPad().

◆ ClassOf()

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

Definition at line 162 of file class_pad.h.

163  {
164  return aItem && PCB_PAD_T == aItem->Type();
165  }
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212

References PCB_PAD_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 237 of file base_struct.h.

237 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PCB_BASE_FRAME::FocusOnItem(), SCH_BASE_FRAME::FocusOnItem(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearEditFlags()

void EDA_ITEM::ClearEditFlags ( )
inlineinherited

◆ ClearFlags()

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

Definition at line 258 of file base_struct.h.

258 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_COMPONENT::ClearAllHighlightFlags(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearHighlighted(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), MWAVE::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(), KIGFX::SCH_VIEW::HighlightItem(), MODULE_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().

◆ ClearHighlighted()

void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 236 of file base_struct.h.

236 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 270 of file base_struct.h.

271  {
273  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:117
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:131
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:130
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:132
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 153 of file view_item.h.

154  {
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161
#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 1315 of file class_pad.cpp.

1316 {
1317  return new D_PAD( *this );
1318 }
D_PAD(MODULE *parent)
Definition: class_pad.cpp:60

References D_PAD().

Referenced by ClonePad(), and MODULE_EDITOR_TOOLS::CreatePadFromShapes().

◆ 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 814 of file class_pad.h.

815  {
816  return (D_PAD*) Clone();
817  }
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_pad.cpp:1315

References Clone().

◆ 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 1172 of file class_pad.cpp.

1173 {
1174  int diff;
1175 
1176  if( ( diff = padref->GetShape() - padcmp->GetShape() ) != 0 )
1177  return diff;
1178 
1179  if( ( diff = padref->GetDrillShape() - padcmp->GetDrillShape() ) != 0)
1180  return diff;
1181 
1182  if( ( diff = padref->m_Drill.x - padcmp->m_Drill.x ) != 0 )
1183  return diff;
1184 
1185  if( ( diff = padref->m_Drill.y - padcmp->m_Drill.y ) != 0 )
1186  return diff;
1187 
1188  if( ( diff = padref->m_Size.x - padcmp->m_Size.x ) != 0 )
1189  return diff;
1190 
1191  if( ( diff = padref->m_Size.y - padcmp->m_Size.y ) != 0 )
1192  return diff;
1193 
1194  if( ( diff = padref->m_Offset.x - padcmp->m_Offset.x ) != 0 )
1195  return diff;
1196 
1197  if( ( diff = padref->m_Offset.y - padcmp->m_Offset.y ) != 0 )
1198  return diff;
1199 
1200  if( ( diff = padref->m_DeltaSize.x - padcmp->m_DeltaSize.x ) != 0 )
1201  return diff;
1202 
1203  if( ( diff = padref->m_DeltaSize.y - padcmp->m_DeltaSize.y ) != 0 )
1204  return diff;
1205 
1206 // TODO: test custom shapes
1207 
1208  // Dick: specctra_export needs this
1209  // Lorenzo: gencad also needs it to implement padstacks!
1210 
1211 #if __cplusplus >= 201103L
1212  long long d = padref->m_layerMask.to_ullong() - padcmp->m_layerMask.to_ullong();
1213  if( d < 0 )
1214  return -1;
1215  else if( d > 0 )
1216  return 1;
1217 
1218  return 0;
1219 #else
1220  // these strings are not typically constructed, since we don't get here often.
1221  std::string s1 = padref->m_layerMask.to_string();
1222  std::string s2 = padcmp->m_layerMask.to_string();
1223  return s1.compare( s2 );
1224 #endif
1225 }
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:432
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:923
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:919
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:886
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237
wxPoint m_Offset
m_Offset is useful only for oblong and rect pads (it can be used for other shapes,...
Definition: class_pad.h:917

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

119 {
120  static LSET saved( 2, F_Cu, F_Mask );
121  return saved;
122 }
LSET is a set of PCB_LAYER_IDs.

References F_Cu, and F_Mask.

◆ CustomShapeAsPolygonToBoardPosition()

void D_PAD::CustomShapeAsPolygonToBoardPosition ( SHAPE_POLY_SET aMergedPolygon,
wxPoint  aPosition,
double  aRotation 
) const

When created, the corners coordinates are relative to the pad position, orientation 0, in m_customShapeAsPolygon CustomShapeAsPolygonToBoardPosition transform these coordinates to actual (board) coordinates.

Parameters
aMergedPolygon= the corners coordinates, relative to aPosition and rotated by aRotation
aPosition= the position of the shape (usually the pad shape, but not always, when moving the pad)
aRotation= the rotation of the shape (usually the pad rotation, but not always, in DRC)

Definition at line 393 of file pad_custom_shape_functions.cpp.

395 {
396  if( aMergedPolygon->OutlineCount() == 0 )
397  return;
398 
399  // Move, rotate, ... coordinates in aMergedPolygon according to the
400  // pad position and orientation
401  aMergedPolygon->Rotate( -DECIDEG2RAD( aRotation ) );
402  aMergedPolygon->Move( VECTOR2I( aPosition ) );
403 }
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 })
Function Rotate rotates all vertices by a given angle.
int OutlineCount() const
Returns the number of outlines in the set
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void Move(const VECTOR2I &aVector) override
double DECIDEG2RAD(double deg)
Definition: trigo.h:218

References DECIDEG2RAD(), SHAPE_POLY_SET::Move(), SHAPE_POLY_SET::OutlineCount(), and SHAPE_POLY_SET::Rotate().

Referenced by ZONE_FILLER::addKnockout(), CINFO3D_VISU::buildPadShapePolygon(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), CINFO3D_VISU::createNewPadWithClearance(), GetBoundingBox(), BRDITEMS_PLOTTER::PlotPad(), PrintShape(), PNS_KICAD_IFACE_BASE::syncPad(), and TransformShapeWithClearanceToPolygon().

◆ DeletePrimitivesList()

void D_PAD::DeletePrimitivesList ( )

clear the basic shapes list

Definition at line 244 of file pad_custom_shape_functions.cpp.

245 {
246  m_basicShapes.clear();
248 }
std::vector< PAD_CS_PRIMITIVE > m_basicShapes
for free shape pads: a list of basic shapes, in local coordinates, orient 0, coordinates relative to ...
Definition: class_pad.h:868
SHAPE_POLY_SET m_customShapeAsPolygon
for free shape pads: the set of basic shapes, merged as one polygon, in local coordinates,...
Definition: class_pad.h:873
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.

References m_basicShapes, m_customShapeAsPolygon, and SHAPE_POLY_SET::RemoveAllContours().

Referenced by 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 117 of file class_board_item.cpp.

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

References BOARD_ITEM::GetParent().

Referenced by BOARD::PadDelete(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), 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 165 of file class_board_item.h.

166  {
167  EDA_ITEM* dupe = Clone();
168  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
169 
170  return static_cast<BOARD_ITEM*>( dupe );
171  }
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: common.h:65
const KIID m_Uuid
Definition: base_struct.h:169
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:166

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(), BOARD::InsertArea(), ARRAY_CREATOR::Invoke(), and FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD().

◆ Flip() [1/2]

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

Definition at line 281 of file class_board_item.h.

282  {
283  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
284  }
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.

◆ Flip() [2/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 445 of file class_pad.cpp.

446 {
447  if( aFlipLeftRight )
448  {
449  MIRROR( m_Pos.x, aCentre.x );
450  MIRROR( m_Pos0.x, 0 );
451  MIRROR( m_Offset.x, 0 );
452  MIRROR( m_DeltaSize.x, 0 );
453  }
454  else
455  {
456  MIRROR( m_Pos.y, aCentre.y );
457  MIRROR( m_Pos0.y, 0 );
458  MIRROR( m_Offset.y, 0 );
459  MIRROR( m_DeltaSize.y, 0 );
460  }
461 
463 
464  // flip pads layers
465  // PADS items are currently on all copper layers, or
466  // currently, only on Front or Back layers.
467  // So the copper layers count is not taken in account
469 
470  // Flip the basic shapes, in custom pads
471  FlipPrimitives();
472 
473  // m_boundingRadius = -1; the shape has not been changed
474 }
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:478
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:123
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:923
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:919
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:445
wxPoint m_Pos0
Initial Pad position (i.e.
Definition: class_pad.h:925
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:426
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:438
wxPoint m_Offset
m_Offset is useful only for oblong and rect pads (it can be used for other shapes,...
Definition: class_pad.h:917
wxPoint m_Pos
pad Position on board
Definition: class_pad.h:858

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

◆ FlipPrimitives()

void D_PAD::FlipPrimitives ( )

Flip the basic shapes, in custom pads.

Definition at line 478 of file class_pad.cpp.

479 {
480  // Flip custom shapes
481  for( unsigned ii = 0; ii < m_basicShapes.size(); ++ii )
482  {
483  PAD_CS_PRIMITIVE& primitive = m_basicShapes[ii];
484 
485  MIRROR( primitive.m_Start.y, 0 );
486  MIRROR( primitive.m_End.y, 0 );
487  primitive.m_ArcAngle = -primitive.m_ArcAngle;
488 
489  switch( primitive.m_Shape )
490  {
491  case S_POLYGON: // polygon
492  for( unsigned jj = 0; jj < primitive.m_Poly.size(); jj++ )
493  MIRROR( primitive.m_Poly[jj].y, 0 );
494  break;
495 
496  default:
497  break;
498  }
499  }
500 
501  // Flip local coordinates in merged Polygon
502  m_customShapeAsPolygon.Mirror( false, true );
503 }
std::vector< PAD_CS_PRIMITIVE > m_basicShapes
for free shape pads: a list of basic shapes, in local coordinates, orient 0, coordinates relative to ...
Definition: class_pad.h:868
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:98
polygon (not yet used for tracks, but could be in microwave apps)
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirrors the line points about y or x (or both)
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:123
std::vector< wxPoint > m_Poly
Bezier Control point 2.
Definition: class_pad.h:102
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89
SHAPE_POLY_SET m_customShapeAsPolygon
for free shape pads: the set of basic shapes, merged as one polygon, in local coordinates,...
Definition: class_pad.h:873
wxPoint m_End
is also the center of the circle and arc
Definition: class_pad.h:99
STROKE_T m_Shape
Definition: class_pad.h:92
double m_ArcAngle
radius of a circle
Definition: class_pad.h:97

References PAD_CS_PRIMITIVE::m_ArcAngle, m_basicShapes, m_customShapeAsPolygon, PAD_CS_PRIMITIVE::m_End, PAD_CS_PRIMITIVE::m_Poly, PAD_CS_PRIMITIVE::m_Shape, PAD_CS_PRIMITIVE::m_Start, MIRROR(), SHAPE_POLY_SET::Mirror(), S_POLYGON, and wxPoint::y.

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

◆ 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 247 of file class_pad.h.

247 { return m_anchorPadShape; }
PAD_SHAPE_T m_anchorPadShape
for custom shaped pads: shape of pad anchor, PAD_SHAPE_RECT, PAD_SHAPE_CIRCLE
Definition: class_pad.h:900

References m_anchorPadShape.

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

◆ GetAttribute()

◆ GetBestAnchorPosition()

bool D_PAD::GetBestAnchorPosition ( VECTOR2I aPos)

Definition at line 405 of file pad_custom_shape_functions.cpp.

406 {
407  SHAPE_POLY_SET poly;
408 
409  if( !buildCustomPadPolygon( &poly, ARC_LOW_DEF ) )
410  return false;
411 
412  const int minSteps = 10;
413  const int maxSteps = 50;
414 
415  int stepsX, stepsY;
416 
417  auto bbox = poly.BBox();
418 
419  if( bbox.GetWidth() < bbox.GetHeight() )
420  {
421  stepsX = minSteps;
422  stepsY = minSteps * (double) bbox.GetHeight() / (double )(bbox.GetWidth() + 1);
423  }
424  else
425  {
426  stepsY = minSteps;
427  stepsX = minSteps * (double) bbox.GetWidth() / (double )(bbox.GetHeight() + 1);
428  }
429 
430  stepsX = std::max(minSteps, std::min( maxSteps, stepsX ) );
431  stepsY = std::max(minSteps, std::min( maxSteps, stepsY ) );
432 
433  auto center = bbox.Centre();
434 
435  auto minDist = std::numeric_limits<int64_t>::max();
436  int64_t minDistEdge;
437 
439  {
440  minDistEdge = GetSize().x;
441  }
442  else
443  {
444  minDistEdge = std::max( GetSize().x, GetSize().y );
445  }
446 
447  OPT<VECTOR2I> bestAnchor( []()->OPT<VECTOR2I> { return NULLOPT; }() );
448 
449  for ( int y = 0; y < stepsY ; y++ )
450  {
451  for ( int x = 0; x < stepsX; x++ )
452  {
453  VECTOR2I p = bbox.GetPosition();
454  p.x += rescale( x, bbox.GetWidth(), (stepsX - 1) );
455  p.y += rescale( y, bbox.GetHeight(), (stepsY - 1) );
456 
457  if ( poly.Contains(p) )
458  {
459 
460  auto dist = (center - p).EuclideanNorm();
461  auto distEdge = poly.COutline(0).Distance( p, true );
462  if ( distEdge >= minDistEdge )
463  {
464  if ( dist < minDist )
465  {
466  bestAnchor = p;
467  minDist = dist;
468  }
469  }
470  }
471  }
472  }
473 
474  if ( bestAnchor )
475  {
476  aPos = *bestAnchor;
477  return true;
478  }
479 
480  return false;
481 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:128
static const int dist[10][10]
Definition: ar_matrix.cpp:326
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:247
int Distance(const VECTOR2I &aP, bool aOutlineOnly=false) const
Function Distance()
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Returns true if a given subpolygon contains the point aP.
const auto NULLOPT
Definition: optional.h:9
SHAPE_POLY_SET.
bool buildCustomPadPolygon(SHAPE_POLY_SET *aMergedPolygon, int aError)
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
T rescale(T aNumerator, T aValue, T aDenominator)
Function rescale()
Definition: util.h:84
coord_type GetHeight() const
Definition: box2.h:197
boost::optional< T > OPT
Definition: optional.h:7
const wxSize & GetSize() const
Definition: class_pad.h:300
const BOX2I BBox(int aClearance=0) const override
Function BBox()

References SHAPE_POLY_SET::BBox(), buildCustomPadPolygon(), SHAPE_POLY_SET::Contains(), SHAPE_POLY_SET::COutline(), dist, SHAPE_LINE_CHAIN::Distance(), EuclideanNorm(), GetAnchorPadShape(), BOX2< Vec >::GetHeight(), GetSize(), NULLOPT, 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:163
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212

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

Referenced by ZONE_CONTAINER::BuildSmoothedPoly(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), TEXTE_PCB::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_ITEM::GetLayerName(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase(), VIA::GetMsgPanelInfoBase(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), VIA::GetSelectMenuText(), GetSelectMenuText(), GetSolderMaskMargin(), GetSolderPasteMargin(), BOARD::GetTrackLength(), HitTest(), MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), TEXTE_PCB::Print(), PCB_TARGET::Print(), ZONE_CONTAINER::Print(), EDGE_MODULE::Print(), TRACK::Print(), TEXTE_MODULE::Print(), DIMENSION::Print(), DRAWSEGMENT::Print(), VIA::Print(), MODULE::Print(), Print(), ZONE_CONTAINER::PrintFilledArea(), BOARD_CONNECTED_ITEM::SetNet(), BOARD_CONNECTED_ITEM::SetNetCode(), ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(), ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(), MODULE::ViewBBox(), VIA::ViewGetLOD(), and ViewGetLOD().

◆ GetBoundingBox()

const EDA_RECT D_PAD::GetBoundingBox ( ) const
overridevirtual

Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.

This box should be an enclosing perimeter for visible components of this object, and the units should be in the pcb or schematic coordinate system. It is OK to overestimate the size by a few counts.

Reimplemented from EDA_ITEM.

Definition at line 229 of file class_pad.cpp.

230 {
231  EDA_RECT area;
232  wxPoint quadrant1, quadrant2, quadrant3, quadrant4;
233  int x, y, r, dx, dy;
234 
235  wxPoint center = ShapePos();
236  wxPoint endPoint;
237 
238  EDA_RECT endRect;
239 
240  switch( GetShape() )
241  {
242  case PAD_SHAPE_CIRCLE:
243  area.SetOrigin( center );
244  area.Inflate( m_Size.x / 2 );
245  break;
246 
247  case PAD_SHAPE_OVAL:
248  /* To get the BoundingBox of an oval pad:
249  * a) If the pad is ROUND, see method for PAD_SHAPE_CIRCLE above
250  * OTHERWISE:
251  * b) Construct EDA_RECT for portion between circular ends
252  * c) Rotate that EDA_RECT
253  * d) Add the circular ends to the EDA_RECT
254  */
255 
256  // Test if the shape is circular
257  if( m_Size.x == m_Size.y )
258  {
259  area.SetOrigin( center );
260  area.Inflate( m_Size.x / 2 );
261  break;
262  }
263 
264  if( m_Size.x > m_Size.y )
265  {
266  // Pad is horizontal
267  dx = ( m_Size.x - m_Size.y ) / 2;
268  dy = m_Size.y / 2;
269 
270  // Location of end-points
271  x = dx;
272  y = 0;
273  r = dy;
274  }
275  else
276  {
277  // Pad is vertical
278  dx = m_Size.x / 2;
279  dy = ( m_Size.y - m_Size.x ) / 2;
280 
281  x = 0;
282  y = dy;
283  r = dx;
284  }
285 
286  // Construct the center rectangle and rotate
287  area.SetOrigin( center );
288  area.Inflate( dx, dy );
289  area = area.GetBoundingBoxRotated( center, m_Orient );
290 
291  endPoint = wxPoint( x, y );
292  RotatePoint( &endPoint, m_Orient );
293 
294  // Add points at each quadrant of circular regions
295  endRect.SetOrigin( center + endPoint );
296  endRect.Inflate( r );
297 
298  area.Merge( endRect );
299 
300  endRect.SetSize( 0, 0 );
301  endRect.SetOrigin( center - endPoint );
302  endRect.Inflate( r );
303 
304  area.Merge( endRect );
305 
306  break;
307 
308  case PAD_SHAPE_RECT:
309  case PAD_SHAPE_ROUNDRECT:
311  // Use two opposite corners and track their rotation
312  // (use symmetry for other points)
313  quadrant1.x = m_Size.x/2;
314  quadrant1.y = m_Size.y/2;
315  quadrant2.x = -m_Size.x/2;
316  quadrant2.y = m_Size.y/2;
317 
318  RotatePoint( &quadrant1, m_Orient );
319  RotatePoint( &quadrant2, m_Orient );
320  dx = std::max( std::abs( quadrant1.x ) , std::abs( quadrant2.x ) );
321  dy = std::max( std::abs( quadrant1.y ) , std::abs( quadrant2.y ) );
322 
323  // Set the bbox
324  area.SetOrigin( ShapePos() );
325  area.Inflate( dx, dy );
326  break;
327 
328  case PAD_SHAPE_TRAPEZOID:
329  // Use the four corners and track their rotation
330  // (Trapezoids will not be symmetric)
331 
332  quadrant1.x = (m_Size.x + m_DeltaSize.y)/2;
333  quadrant1.y = (m_Size.y - m_DeltaSize.x)/2;
334 
335  quadrant2.x = -(m_Size.x + m_DeltaSize.y)/2;
336  quadrant2.y = (m_Size.y + m_DeltaSize.x)/2;
337 
338  quadrant3.x = -(m_Size.x - m_DeltaSize.y)/2;
339  quadrant3.y = -(m_Size.y + m_DeltaSize.x)/2;
340 
341  quadrant4.x = (m_Size.x - m_DeltaSize.y)/2;
342  quadrant4.y = -(m_Size.y - m_DeltaSize.x)/2;
343 
344  RotatePoint( &quadrant1, m_Orient );
345  RotatePoint( &quadrant2, m_Orient );
346  RotatePoint( &quadrant3, m_Orient );
347  RotatePoint( &quadrant4, m_Orient );
348 
349  x = std::min( quadrant1.x, std::min( quadrant2.x, std::min( quadrant3.x, quadrant4.x) ) );
350  y = std::min( quadrant1.y, std::min( quadrant2.y, std::min( quadrant3.y, quadrant4.y) ) );
351  dx = std::max( quadrant1.x, std::max( quadrant2.x, std::max( quadrant3.x, quadrant4.x) ) );
352  dy = std::max( quadrant1.y, std::max( quadrant2.y, std::max( quadrant3.y, quadrant4.y) ) );
353 
354  area.SetOrigin( ShapePos().x + x, ShapePos().y + y );
355  area.SetSize( dx-x, dy-y );
356  break;
357 
358  case PAD_SHAPE_CUSTOM:
359  {
361  // Move shape to actual position
363  quadrant1 = m_Pos;
364  quadrant2 = m_Pos;
365 
366  for( int cnt = 0; cnt < polySet.OutlineCount(); ++cnt )
367  {
368  const SHAPE_LINE_CHAIN& poly = polySet.COutline( cnt );
369 
370  for( int ii = 0; ii < poly.PointCount(); ++ii )
371  {
372  quadrant1.x = std::min( quadrant1.x, poly.CPoint( ii ).x );
373  quadrant1.y = std::min( quadrant1.y, poly.CPoint( ii ).y );
374  quadrant2.x = std::max( quadrant2.x, poly.CPoint( ii ).x );
375  quadrant2.y = std::max( quadrant2.y, poly.CPoint( ii ).y );
376  }
377  }
378 
379  area.SetOrigin( quadrant1 );
380  area.SetEnd( quadrant2 );
381  }
382  break;
383 
384  default:
385  break;
386  }
387 
388  return area;
389 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
SHAPE_POLY_SET.
void SetEnd(int x, int y)
Definition: eda_rect.h:192
const EDA_RECT GetBoundingBoxRotated(wxPoint aRotCenter, double aAngle)
Function GetBoundingBoxRotated.
SHAPE_POLY_SET m_customShapeAsPolygon
for free shape pads: the set of basic shapes, merged as one polygon, in local coordinates,...
Definition: class_pad.h:873
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:923
void SetSize(const wxSize &size)
Definition: eda_rect.h:144
SHAPE_LINE_CHAIN.
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:426
void CustomShapeAsPolygonToBoardPosition(SHAPE_POLY_SET *aMergedPolygon, wxPoint aPosition, double aRotation) const
When created, the corners coordinates are relative to the pad position, orientation 0,...
wxPoint ShapePos() const
Definition: class_pad.cpp:570
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237
double m_Orient
in 1/10 degrees
Definition: class_pad.h:932
const wxPoint GetPosition() const override
Definition: class_pad.h:241
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
wxPoint m_Pos
pad Position on board
Definition: class_pad.h:858

References SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), CustomShapeAsPolygonToBoardPosition(), EDA_RECT::GetBoundingBoxRotated(), GetOrientation(), GetPosition(), GetShape(), EDA_RECT::Inflate(), m_customShapeAsPolygon, m_DeltaSize, m_Orient, m_Pos, m_Size, EDA_RECT::Merge(), SHAPE_POLY_SET::OutlineCount(), PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, SHAPE_LINE_CHAIN::PointCount(), RotatePoint(), EDA_RECT::SetEnd(), EDA_RECT::SetOrigin(), EDA_RECT::SetSize(), ShapePos(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by AR_AUTOPLACER::addPad(), hasThermalConnection(), HitTest(), DSN::SPECCTRA_DB::makePADSTACK(), and ViewBBox().

◆ GetBoundingRadius()

int D_PAD::GetBoundingRadius ( ) const
inline

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

The center is the pad position

Definition at line 653 of file class_pad.h.

654  {
655  // Any member function which would affect this calculation should set
656  // m_boundingRadius to -1 to re-trigger the calculation from here.
657  // Currently that is only m_Size, m_DeltaSize, and m_padShape accessors.
658  if( m_boundingRadius == -1 )
659  {
661  }
662 
663  return m_boundingRadius;
664  }
int m_boundingRadius
radius of the circle containing the pad shape
Definition: class_pad.h:851
int boundingRadius() const
Function boundingRadius returns a calculated radius of a bounding circle for this pad.
Definition: class_pad.cpp:146

References boundingRadius(), and m_boundingRadius.

Referenced by DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), HitTest(), and DIALOG_PAD_PROPERTIES::OnPaintShowPanel().

◆ GetCenter()

virtual const 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 98 of file class_board_item.h.

98 { return GetPosition(); }
virtual const wxPoint GetPosition() const =0

References BOARD_ITEM::GetPosition().

Referenced by ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), KIGFX::PCB_PAINTER::draw(), and PNS_KICAD_IFACE_BASE::syncArc().

◆ GetChamferPositions()

int D_PAD::GetChamferPositions ( ) const
inline

has meaning only for chamfered rect pads

Returns
the position of the chamfer for a 0 orientation

Definition at line 724 of file class_pad.h.

724 { return m_chamferPositions; }
int m_chamferPositions
the positions of the chamfered position for a 0 orientation
Definition: class_pad.h:898

References m_chamferPositions.

Referenced by DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), CINFO3D_VISU::createNewPadWithClearance(), PCB_IO::format(), HitTest(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::initValues(), DSN::SPECCTRA_DB::makePADSTACK(), BRDITEMS_PLOTTER::PlotPad(), PrintShape(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and TransformShapeWithClearanceToPolygon().

◆ GetChamferRectRatio()

double D_PAD::GetChamferRectRatio ( ) const
inline

has meaning only for chamfered rect pads

Returns
the ratio between the smaller Y or Y size and the radius of the rounded corners. Cannot be > 0.5

Definition at line 701 of file class_pad.h.

702  {
703  return m_padChamferRectScale;
704  }
double m_padChamferRectScale
scaling factor from smallest m_Size coord to chamfer value, default 0.25
Definition: class_pad.h:896

References m_padChamferRectScale.

Referenced by DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), CINFO3D_VISU::createNewPadWithClearance(), PCB_IO::format(), HitTest(), ImportSettingsFrom(), DSN::SPECCTRA_DB::makePADSTACK(), BRDITEMS_PLOTTER::PlotPad(), PrintShape(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), TransformShapeWithClearanceToPolygon(), and DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues().

◆ GetClass()

wxString D_PAD::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 754 of file class_pad.h.

755  {
756  return wxT( "PAD" );
757  }

◆ GetClearance()

int D_PAD::GetClearance ( BOARD_CONNECTED_ITEM aItem = NULL) const
overridevirtual

Function GetClearance returns the clearance in internal units.

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

Parameters
aItemis another BOARD_CONNECTED_ITEM or NULL
Returns
int - the clearance in internal units.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 596 of file class_pad.cpp.

597 {
598  // A pad can have specific clearance parameters that
599  // overrides its NETCLASS clearance value
600  int clearance = m_LocalClearance;
601 
602  if( clearance == 0 )
603  {
604  // If local clearance is 0, use the parent footprint clearance value
605  if( GetParent() && GetParent()->GetLocalClearance() )
606  clearance = GetParent()->GetLocalClearance();
607  }
608 
609  if( clearance == 0 ) // If the parent footprint clearance value = 0, use NETCLASS value
610  return BOARD_CONNECTED_ITEM::GetClearance( aItem );
611 
612  // We have a specific clearance.
613  // if aItem, return the biggest clearance
614  if( aItem )
615  {
616  int hisClearance = aItem->GetClearance();
617  return std::max( hisClearance, clearance );
618  }
619 
620  // Return the specific clearance.
621  return clearance;
622 }
int m_LocalClearance
Local clearance.
Definition: class_pad.h:939
int GetLocalClearance() const
Definition: class_pad.h:464
int GetLocalClearance() const
Definition: class_module.h:234
MODULE * GetParent() const
Definition: class_pad.h:167
virtual int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const
Function GetClearance returns the clearance in internal units.

References BOARD_CONNECTED_ITEM::GetClearance(), MODULE::GetLocalClearance(), GetLocalClearance(), GetParent(), and m_LocalClearance.

Referenced by DRC::checkClearancePadToPad(), KIGFX::PCB_PAINTER::draw(), Print(), and DRC::testPad2Pad().

◆ GetCustomShapeAsPolygon()

const SHAPE_POLY_SET& D_PAD::GetCustomShapeAsPolygon ( ) const
inline

Accessor to the custom shape as one polygon.

Definition at line 378 of file class_pad.h.

378 { return m_customShapeAsPolygon; }
SHAPE_POLY_SET m_customShapeAsPolygon
for free shape pads: the set of basic shapes, merged as one polygon, in local coordinates,...
Definition: class_pad.h:873

References m_customShapeAsPolygon.

Referenced by ZONE_FILLER::addKnockout(), CINFO3D_VISU::buildPadShapePolygon(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), CINFO3D_VISU::createNewPadWithClearance(), CreatePadsShapesSection(), DSN::SPECCTRA_DB::makePADSTACK(), and PNS_KICAD_IFACE_BASE::syncPad().

◆ 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 253 of file class_pad.h.

254  {
256  }
CUST_PAD_SHAPE_IN_ZONE m_customShapeClearanceArea
How to build the custom shape in zone, to create the clearance area: CUST_PAD_SHAPE_IN_ZONE_OUTLINE =...
Definition: class_pad.h:881

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 262 of file base_struct.h.

263  {
267  return m_Flags & mask;
268  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:128
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:139
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:138
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:157
#define SELECTED
Definition: base_struct.h:127
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
#define DP_COUPLED
item is coupled with another item making a differential pair
Definition: base_struct.h:145
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
#define IS_DANGLING
indicates a pin is dangling
Definition: base_struct.h:149
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125

References BEGIN_ONPAD, BRIGHTENED, DP_COUPLED, EDA_ITEM_ALL_FLAGS, END_ONPAD, ENDPOINT, HIGHLIGHTED, IS_DANGLING, EDA_ITEM::m_Flags, SELECTED, STARTPOINT, and TEMP_SELECTED.

Referenced by SCH_EDIT_TOOL::ChangeShape(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SCH_EDITOR_CONTROL::EditWithLibEdit(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), 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().

◆ GetFlags()

◆ 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 131 of file class_board_item.h.

131 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by CN_LIST::Add(), CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), DIMENSION::AdjustDimensionDetails(), AR_AUTOPLACER::buildFpAreas(), CreateBoardSection(), MWAVE::CreateMicrowaveInductor(), CreateRoutesSection(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), 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(), TEXTE_PCB::Flip(), PCB_TARGET::Flip(), EDGE_MODULE::Flip(), TRACK::Flip(), TEXTE_MODULE::Flip(), DIMENSION::Flip(), DRAWSEGMENT::Flip(), MODULE::Flip(), ARC::Flip(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::formatLayer(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), ZONE_CONTAINER::GetLayer(), 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(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), EAGLE_PLUGIN::packagePad(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::Plot_Edges_Modules(), BRDITEMS_PLOTTER::PlotAllTextsModule(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotDrawSegment(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotTextePcb(), TEXTE_MODULE::Print(), DRAWSEGMENT::Print(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), SELECTION_TOOL::Selectable(), TEXT_MOD_GRID_TABLE::SetValueAsLong(), ShowClearance(), GLOBAL_EDIT_TOOL::swapBoardItem(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), PNS_KICAD_IFACE_BASE::syncTrack(), DRC::testCopperDrawItem(), DRC::testCopperTextAndGraphics(), DRC::testCopperTextItem(), DRC::testDisabledLayers(), AR_AUTOPLACER::testModuleOnBoard(), TEXTE_MODULE::TEXTE_MODULE(), AR_MATRIX::TraceSegmentPcb(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), 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 given by aLayer.
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:163
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:622

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

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

◆ GetLayerSet()

◆ GetLocalClearance()

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLocalSolderMaskMargin()

int D_PAD::GetLocalSolderMaskMargin ( ) const
inline

Definition at line 461 of file class_pad.h.

461 { return m_LocalSolderMaskMargin; }
int m_LocalSolderMaskMargin
Local mask margins: when 0, the parent footprint design values are used.
Definition: class_pad.h:943

References m_LocalSolderMaskMargin.

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

◆ GetLocalSolderPasteMargin()

int D_PAD::GetLocalSolderPasteMargin ( ) const
inline

Definition at line 467 of file class_pad.h.

467 { return m_LocalSolderPasteMargin; }
int m_LocalSolderPasteMargin
Local solder paste margin absolute value.
Definition: class_pad.h:944

References m_LocalSolderPasteMargin.

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

◆ GetLocalSolderPasteMarginRatio()

double D_PAD::GetLocalSolderPasteMarginRatio ( ) const
inline

Definition at line 470 of file class_pad.h.

double m_LocalSolderPasteMarginRatio
Local solder mask margin ratio value of pad size The final margin is the sum of these 2 values.
Definition: class_pad.h:946

References m_LocalSolderPasteMarginRatio.

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

◆ GetLocalZoneConnection()

ZONE_CONNECTION D_PAD::GetLocalZoneConnection ( ) const
inline

Definition at line 537 of file class_pad.h.

538  {
539  return m_ZoneConnection;
540  }
ZONE_CONNECTION m_ZoneConnection
how the connection to zone is made: no connection, thermal relief ...
Definition: class_pad.h:949

References m_ZoneConnection.

Referenced by DIALOG_PAD_PROPERTIES::initValues().

◆ 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 1309 of file class_pad.cpp.

1310 {
1311  return pad_xpm;
1312 }
const BITMAP_OPAQUE pad_xpm[1]
Definition: pad.cpp:41

References pad_xpm.

◆ GetMsgPanelInfo()

void D_PAD::GetMsgPanelInfo ( EDA_UNITS  aUnits,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

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

Note
This method replaces DisplayInfo() so that KiCad objects no longer have any knowledge of wxWidgets UI objects.
Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 758 of file class_pad.cpp.

759 {
760  MODULE* module;
761  wxString msg;
762  BOARD* board;
763 
764  module = (MODULE*) m_Parent;
765 
766  if( module )
767  {
768  aList.emplace_back( _( "Footprint" ), module->GetReference(), DARKCYAN );
769  }
770 
771  aList.emplace_back( _( "Pad" ), m_name, BROWN );
772 
773  if( !GetPinFunction().IsEmpty() )
774  aList.emplace_back( _( "Pin fct" ), GetPinFunction(), BROWN );
775 
776  aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN );
777 
778  board = GetBoard();
779 
780  aList.emplace_back( _( "Layer" ),
782 
783  // Show the pad shape, attribute and property
784  wxString props = ShowPadAttr();
785 
786  if( GetProperty() != PAD_PROP_NONE )
787  props += ',';
788 
789  switch( GetProperty() )
790  {
791  case PAD_PROP_NONE: break;
792  case PAD_PROP_BGA: props += _("BGA" ); break;
793  case PAD_PROP_FIDUCIAL_GLBL: props += _("Fiducial global" ); break;
794  case PAD_PROP_FIDUCIAL_LOCAL: props += _("Fiducial local" ); break;
795  case PAD_PROP_TESTPOINT: props += _("Test point" ); break;
796  case PAD_PROP_HEATSINK: props += _("Heat sink" ); break;
797  case PAD_PROP_CASTELLATED: props += _("Castellated" ); break;
798  }
799 
800  aList.emplace_back( ShowPadShape(), props, DARKGREEN );
801 
802  msg = MessageTextFromValue( aUnits, m_Size.x, true );
803  aList.emplace_back( _( "Width" ), msg, RED );
804 
805  msg = MessageTextFromValue( aUnits, m_Size.y, true );
806  aList.emplace_back( _( "Height" ), msg, RED );
807 
808  msg = MessageTextFromValue( aUnits, m_Drill.x, true );
809 
811  {
812  aList.emplace_back( _( "Drill" ), msg, RED );
813  }
814  else
815  {
816  msg = MessageTextFromValue( aUnits, m_Drill.x, true )
817  + wxT( "/" )
818  + MessageTextFromValue( aUnits, m_Drill.y, true );
819  aList.emplace_back( _( "Drill X / Y" ), msg, RED );
820  }
821 
822  double module_orient_degrees = module ? module->GetOrientationDegrees() : 0;
823 
824  if( module_orient_degrees != 0.0 )
825  msg.Printf( wxT( "%3.1f(+%3.1f)" ),
826  GetOrientationDegrees() - module_orient_degrees,
827  module_orient_degrees );
828  else
829  msg.Printf( wxT( "%3.1f" ), GetOrientationDegrees() );
830 
831  aList.emplace_back( _( "Angle" ), msg, LIGHTBLUE );
832 
833  msg = MessageTextFromValue( aUnits, m_Pos.x )
834  + wxT( ", " )
835  + MessageTextFromValue( aUnits, m_Pos.y );
836  aList.emplace_back( _( "Position" ), msg, LIGHTBLUE );
837 
838  if( GetPadToDieLength() )
839  {
840  msg = MessageTextFromValue( aUnits, GetPadToDieLength(), true );
841  aList.emplace_back( _( "Length in package" ), msg, CYAN );
842  }
843 }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:183
no special fabrication property
Definition: pad_shapes.h:78
a fiducial (usually a smd) for the full board
Definition: pad_shapes.h:80
double GetOrientationDegrees() const
Definition: class_pad.h:427
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
int GetPadToDieLength() const
Definition: class_pad.h:459
Smd pad, used in BGA footprints.
Definition: pad_shapes.h:79
a pad used as heat sink, usually in SMD footprints
Definition: pad_shapes.h:83
const wxString & GetPinFunction() const
Definition: class_pad.h:211
wxString ShowPadAttr() const
Function ShowPadAttr.
Definition: class_pad.cpp:1269
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:436
a pad with a castellated through hole
Definition: pad_shapes.h:84
wxString m_name
pad name (pin number in schematic)
Definition: class_pad.h:853
wxString ShowPadShape() const
Function ShowPadShape.
Definition: class_pad.cpp:1238
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:432
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: colors.h:59
double GetOrientationDegrees() const
Definition: class_module.h:216
Definition: colors.h:60
PAD_PROP_T GetProperty() const
Definition: class_pad.h:452
const wxString & GetNetname() const
Function GetNetname.
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:127
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:919
a fiducial (usually a smd) local to the parent footprint
Definition: pad_shapes.h:81
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:163
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:886
a test point pad
Definition: pad_shapes.h:82
static wxString LayerMaskDescribe(const BOARD *aBoard, LSET aMask)
Helper function Return a string (to be shown to the user) describing a layer mask.
Definition: class_pad.cpp:1455
wxPoint m_Pos
pad Position on board
Definition: class_pad.h:858
Definition: colors.h:62

References _, BROWN, CYAN, DARKCYAN, DARKGREEN, BOARD_ITEM::GetBoard(), GetDrillShape(), BOARD_CONNECTED_ITEM::GetNetname(), MODULE::GetOrientationDegrees(), GetOrientationDegrees(), GetPadToDieLength(), GetPinFunction(), GetProperty(), MODULE::GetReference(), LayerMaskDescribe(), LIGHTBLUE, m_Drill, m_layerMask, m_name, EDA_ITEM::m_Parent, m_Pos, m_Size, MessageTextFromValue(), 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, RED, ShowPadAttr(), ShowPadShape(), UnescapeString(), wxPoint::x, and wxPoint::y.

◆ 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(), VIA::GetMsgPanelInfoBase(), TRACK::GetMsgPanelInfoBase_Common(), VIA::Print(), BOARD::SetAreasNetCodesFromNetNames(), and PCB_EDIT_FRAME::SetTrackSegmentWidth().

◆ GetNetClass()

NETCLASSPTR BOARD_CONNECTED_ITEM::GetNetClass ( ) const
inherited

Function GetNetClass returns the NETCLASS for this item.

Definition at line 96 of file board_connected_item.cpp.

97 {
98  NETCLASSPTR netclass = m_netinfo->GetNetClass();
99 
100  if( netclass )
101  return netclass;
102  else
103  return GetBoard()->GetDesignSettings().GetDefault();
104 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:512
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
NETCLASSPTR GetDefault() const
Function GetDefault.
NETCLASSPTR GetNetClass()
Definition: netinfo.h:122
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

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

Referenced by DRC::doTrackDrc(), ZONE_CONTAINER::GetClearance(), VIA::GetDrillValue(), TRACK::GetMsgPanelInfo(), 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 107 of file board_connected_item.cpp.

108 {
109  return m_netinfo->GetClassName();
110 }
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:131

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

Referenced by 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:224
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

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

Referenced by ZONE_FILLER::buildCopperItemClearances(), BOARD::CombineAllAreasInNet(), connectedItemFilter(), CreateRoutesSection(), DRC::doPadToPadsDrc(), 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(), CONNECTIVITY_DATA::GetConnectedItems(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), hash_eda(), hasThermalConnection(), DIALOG_PAD_PROPERTIES::initValues(), ZONE_CONTAINER::IsSame(), DSN::SPECCTRA_DB::makeIMAGE(), AR_AUTOPLACER::nearestPad(), CONNECTIVITY_DATA::NearestUnconnectedTargets(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), BOARD::NormalizeAreaPolygon(), BOARD::OnAreaPolygonModified(), ZONE_SETTINGS::operator<<(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), VIA::Print(), PrintShape(), 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(), DRC::testZones(), DRC::TestZoneToZoneOutlines(), 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 120 of file board_connected_item.h.

121  {
122  return m_netinfo->GetNetname();
123  }
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:232
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 130 of file board_connected_item.h.

131  {
132  if( !GetBoard() )
133  return wxT( "[** NO BOARD DEFINED **]" );
134 
135  wxString netname = GetNetname();
136 
137  if( !netname.length() )
138  return wxT( "[<no net>]" );
139  else if( GetNetCode() < 0 )
140  return wxT( "[" + UnescapeString( netname ) + "](" + _( "Not Found" ) + ")" );
141  else
142  return wxT( "[" + UnescapeString( netname ) + "]" );
143  }
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().

◆ getNextNumberInSequence()

int BOARD_ITEM::getNextNumberInSequence ( const std::set< int > &  aSeq,
bool  aFillSequenceGaps 
)
staticprotectedinherited

Definition at line 88 of file class_board_item.cpp.

89 {
90  if( aSeq.empty() )
91  return 1;
92 
93  // By default go to the end of the sequence
94  int candidate = *aSeq.rbegin();
95 
96  // Filling in gaps in pad numbering
97  if( aFillSequenceGaps )
98  {
99  // start at the beginning
100  candidate = *aSeq.begin();
101 
102  for( auto it : aSeq )
103  {
104  if( it - candidate > 1 )
105  break;
106 
107  candidate = it;
108  }
109  }
110 
111  ++candidate;
112 
113  return candidate;
114 }

Referenced by MODULE::GetNextPadName().

◆ GetOblongDrillGeometry()

void D_PAD::GetOblongDrillGeometry ( wxPoint aStartPoint,
wxPoint aEndPoint,
int &  aWidth 
) const

Function GetOblongDrillGeometry calculates the start point, end point and width of an equivalent segment which have the same position and width as the hole Usefull to plot/draw oblong holes like segments with rounded ends used in draw and plot functions.

Parameters
aStartPoint= first point of the equivalent segment, relative to the pad position.
aEndPoint= second point of the equivalent segment, relative to the pad position.
aWidth= width equivalent segment.

Definition at line 846 of file class_pad.cpp.

848 {
849  // calculates the start point, end point and width
850  // of an equivalent segment which have the same position and width as the hole
851  int delta_cx, delta_cy;
852 
853  wxSize halfsize = GetDrillSize();
854  halfsize.x /= 2;
855  halfsize.y /= 2;
856 
857  if( m_Drill.x > m_Drill.y ) // horizontal
858  {
859  delta_cx = halfsize.x - halfsize.y;
860  delta_cy = 0;
861  aWidth = m_Drill.y;
862  }
863  else // vertical
864  {
865  delta_cx = 0;
866  delta_cy = halfsize.y - halfsize.x;
867  aWidth = m_Drill.x;
868  }
869 
870  RotatePoint( &delta_cx, &delta_cy, m_Orient );
871 
872  aStartPoint.x = delta_cx;
873  aStartPoint.y = delta_cy;
874 
875  aEndPoint.x = - delta_cx;
876  aEndPoint.y = - delta_cy;
877 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
const wxSize & GetDrillSize() const
Definition: class_pad.h:306
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:886
double m_Orient
in 1/10 degrees
Definition: class_pad.h:932

References GetDrillSize(), m_Drill, m_Orient, RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by BuildPadDrillShapePolygon(), CINFO3D_VISU::createNewPadDrill(), and PrintShape().

◆ GetOffset()

const wxPoint& D_PAD::GetOffset ( ) const
inline

◆ GetOrientation()

◆ GetOrientationDegrees()

double D_PAD::GetOrientationDegrees ( ) const
inline

Definition at line 427 of file class_pad.h.

427 { return m_Orient/10.0; }
double m_Orient
in 1/10 degrees
Definition: class_pad.h:932

References m_Orient.

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

◆ GetOrientationRadians()

double D_PAD::GetOrientationRadians ( ) const
inline

Definition at line 428 of file class_pad.h.

428 { return m_Orient*M_PI/1800; }
double m_Orient
in 1/10 degrees
Definition: class_pad.h:932

References m_Orient.

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

◆ GetPadToDieLength()

int D_PAD::GetPadToDieLength ( ) const
inline

◆ GetParent()

◆ GetPinFunction()

const wxString& D_PAD::GetPinFunction ( ) const
inline
Returns
the pad function (pin name in schematic)

Definition at line 211 of file class_pad.h.

212  {
213  return m_pinFunction;
214  }
wxString m_pinFunction
pin function in schematic
Definition: class_pad.h:855

References m_pinFunction.

Referenced by PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::format(), GetMsgPanelInfo(), BOARD_NETLIST_UPDATER::getPinFunction(), and BRDITEMS_PLOTTER::PlotPad().

◆ GetPos0()

const wxPoint& D_PAD::GetPos0 ( ) const
inline

◆ GetPosition()

◆ GetPrimitives()

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

Accessor to the basic shape list.

Definition at line 373 of file class_pad.h.

373 { return m_basicShapes; }
std::vector< PAD_CS_PRIMITIVE > m_basicShapes
for free shape pads: a list of basic shapes, in local coordinates, orient 0, coordinates relative to ...
Definition: class_pad.h:868

References m_basicShapes.

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

◆ GetProperty()

PAD_PROP_T D_PAD::GetProperty ( ) const
inline

Definition at line 452 of file class_pad.h.

452 { return m_Property; }
PAD_PROP_T m_Property
property in fab files (BGA, FIDUCIAL, TEST POINT, CASTELLATED)
Definition: class_pad.h:930

References m_Property.

Referenced by GERBER_WRITER::createDrillFile(), PCB_IO::format(), GetMsgPanelInfo(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::initValues(), DIALOG_PAD_PROPERTIES::padValuesOK(), and BRDITEMS_PLOTTER::PlotPad().

◆ GetRoundRectCornerRadius() [1/2]

int D_PAD::GetRoundRectCornerRadius ( ) const
inline

Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.

Returns
The radius of the rounded corners for this pad.

Definition at line 577 of file class_pad.h.

578  {
580  }
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:577

References m_Size.

Referenced by boundingRadius(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), CINFO3D_VISU::createNewPadWithClearance(), CreatePadsShapesSection(), export_vrml_padshape(), HitTest(), DSN::SPECCTRA_DB::makePADSTACK(), DIALOG_PAD_PROPERTIES::onCornerSizePercentChange(), BRDITEMS_PLOTTER::PlotPad(), PrintShape(), TransformShapeWithClearanceToPolygon(), and DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues().

◆ GetRoundRectCornerRadius() [2/2]

int D_PAD::GetRoundRectCornerRadius ( const wxSize &  aSize) const

Helper function GetRoundRectCornerRadius Has meaning only for rounded rect pads Returns the radius of the rounded corners of a rectangle size aSize, using others setting of the pad.

Parameters
aSize= size of the of the round rect. Usually the pad size but can be the size of the pad on solder mask or solder paste
Returns
The radius of the rounded corners for this pad size.

Definition at line 210 of file class_pad.cpp.

211 {
212  // radius of rounded corners, usually 25% of shorter pad edge for now
213  int r = aSize.x > aSize.y ? aSize.y : aSize.x;
214  r = int( r * m_padRoundRectRadiusScale );
215 
216  return r;
217 }
double m_padRoundRectRadiusScale
scaling factor from smallest m_Size coord to corner radius, default 0.25
Definition: class_pad.h:894

References m_padRoundRectRadiusScale.

◆ GetRoundRectRadiusRatio()

double D_PAD::GetRoundRectRadiusRatio ( ) const
inline

has meaning only for rounded rect pads

Returns
the scaling factor between the smaller Y or Y size and the radius of the rounded corners. Cannot be > 0.5 the normalized IPC-7351C value is 0.25

Definition at line 675 of file class_pad.h.

676  {
678  }
double m_padRoundRectRadiusScale
scaling factor from smallest m_Size coord to corner radius, default 0.25
Definition: class_pad.h:894

References m_padRoundRectRadiusScale.

Referenced by ZONE_FILLER::addKnockout(), PCB_IO::format(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::onCornerRadiusChange(), DIALOG_PAD_PROPERTIES::OnPadShapeSelection(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues().

◆ 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 1291 of file class_pad.cpp.

1292 {
1293  if( GetName().IsEmpty() )
1294  {
1295  return wxString::Format( _( "Pad of %s on %s" ),
1296  GetParent()->GetReference(),
1298  }
1299  else
1300  {
1301  return wxString::Format( _( "Pad %s of %s on %s" ),
1302  GetName(),
1303  GetParent()->GetReference(),
1305  }
1306 }
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:203
MODULE * GetParent() const
Definition: class_pad.h:167
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:919
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
static wxString LayerMaskDescribe(const BOARD *aBoard, LSET aMask)
Helper function Return a string (to be shown to the user) describing a layer mask.
Definition: class_pad.cpp:1455

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

◆ GetShape()

PAD_SHAPE_T D_PAD::GetShape ( ) const
inline

Function GetShape.

Returns
the shape of this pad.

Definition at line 237 of file class_pad.h.

237 { return m_padShape; }
PAD_SHAPE_T m_padShape
Shape: PAD_SHAPE_CIRCLE, PAD_SHAPE_RECT, PAD_SHAPE_OVAL, PAD_SHAPE_TRAPEZOID, PAD_SHAPE_ROUNDRECT,...
Definition: class_pad.h:860

References m_padShape.

Referenced by ZONE_FILLER::addKnockout(), boundingRadius(), BuildPadPolygon(), CINFO3D_VISU::buildPadShapePolygon(), BuildPadShapePolygon(), CINFO3D_VISU::buildPadShapeThickOutlineAsPolygon(), CINFO3D_VISU::buildPadShapeThickOutlineAsSegments(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), Compare(), CINFO3D_VISU::createNewPadWithClearance(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), CreatePadsShapesSection(), doPushPadProperties(), export_vrml_padshape(), PCB_IO::format(), CN_ITEM::GetAnchor(), GetBoundingBox(), hash_eda(), HitTest(), HYPERLYNX_PAD_STACK::HYPERLYNX_PAD_STACK(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::initValues(), DSN::isRoundKeepout(), DSN::SPECCTRA_DB::makePADSTACK(), mirrorPadX(), DIALOG_PAD_PROPERTIES::onCornerRadiusChange(), DIALOG_PAD_PROPERTIES::onCornerSizePercentChange(), DIALOG_PAD_PROPERTIES::OnPaintShowPanel(), EAGLE_PLUGIN::packagePad(), DIALOG_PAD_PROPERTIES::padValuesOK(), GPCB_FPL_CACHE::parseMODULE(), AR_MATRIX::PlacePad(), BRDITEMS_PLOTTER::PlotPad(), PrintShape(), ShowPadShape(), PNS_KICAD_IFACE_BASE::syncPad(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::transferDataToPad(), TransformShapeWithClearanceToPolygon(), and DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues().

◆ GetShortNetname()

const wxString& BOARD_CONNECTED_ITEM::GetShortNetname ( ) const
inlineinherited

Function GetShortNetname.

Returns
wxString - the short netname

Definition at line 149 of file board_connected_item.h.

150  {
151  return m_netinfo->GetShortNetname();
152  }
const wxString & GetShortNetname() const
Function GetShortNetname.
Definition: netinfo.h:238
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(), and PrintShape().

◆ 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 not default shape to build

Definition at line 627 of file class_pad.cpp.

628 {
629  // The pad inherits the margin only to calculate a default shape,
630  // therefore only if it is also a copper layer
631  // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
632  // defined by the pad settings only
633  bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
634 
635  if( !isOnCopperLayer )
636  return 0;
637 
638  int margin = m_LocalSolderMaskMargin;
639 
640  MODULE* module = GetParent();
641 
642  if( module )
643  {
644  if( margin == 0 )
645  {
646  if( module->GetLocalSolderMaskMargin() )
647  margin = module->GetLocalSolderMaskMargin();
648  }
649 
650  if( margin == 0 )
651  {
652  BOARD* brd = GetBoard();
653  if( brd )
654  {
655  margin = brd->GetDesignSettings().m_SolderMaskMargin;
656  }
657  }
658  }
659 
660  // ensure mask have a size always >= 0
661  if( margin < 0 )
662  {
663  int minsize = -std::min( m_Size.x, m_Size.y ) / 2;
664 
665  if( margin < minsize )
666  margin = minsize;
667  }
668 
669  return margin;
670 }
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:686
int m_LocalSolderMaskMargin
Local mask margins: when 0, the parent footprint design values are used.
Definition: class_pad.h:943
int m_SolderMaskMargin
Solder mask margin.
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:512
int GetLocalSolderMaskMargin() const
Definition: class_module.h:231
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:167
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:919
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:163

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(), Print(), 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 not default shape to build

Definition at line 673 of file class_pad.cpp.

674 {
675  // The pad inherits the margin only to calculate a default shape,
676  // therefore only if it is also a copper layer.
677  // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
678  // defined by the pad settings only
679  bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
680 
681  if( !isOnCopperLayer )
682  return wxSize( 0, 0 );
683 
684  int margin = m_LocalSolderPasteMargin;
685  double mratio = m_LocalSolderPasteMarginRatio;
686 
687  MODULE* module = GetParent();
688 
689  if( module )
690  {
691  if( margin == 0 )
692  margin = module->GetLocalSolderPasteMargin();
693 
694  auto brd = GetBoard();
695 
696  if( margin == 0 && brd )
697  {
698  margin = brd->GetDesignSettings().m_SolderPasteMargin;
699  }
700 
701  if( mratio == 0.0 )
702  mratio = module->GetLocalSolderPasteMarginRatio();
703 
704  if( mratio == 0.0 && brd )
705  {
706  mratio = brd->GetDesignSettings().m_SolderPasteMarginRatio;
707  }
708  }
709 
710  wxSize pad_margin;
711  pad_margin.x = margin + KiROUND( m_Size.x * mratio );
712  pad_margin.y = margin + KiROUND( m_Size.y * mratio );
713 
714  // ensure mask have a size always >= 0
715  if( pad_margin.x < -m_Size.x / 2 )
716  pad_margin.x = -m_Size.x / 2;
717 
718  if( pad_margin.y < -m_Size.y / 2 )
719  pad_margin.y = -m_Size.y / 2;
720 
721  return pad_margin;
722 }
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:686
int m_LocalSolderPasteMargin
Local solder paste margin absolute value.
Definition: class_pad.h:944
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
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:237
MODULE * GetParent() const
Definition: class_pad.h:167
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:919
double GetLocalSolderPasteMarginRatio() const
Definition: class_module.h:240
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:61
double m_LocalSolderPasteMarginRatio
Local solder mask margin ratio value of pad size The final margin is the sum of these 2 values.
Definition: class_pad.h:946

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(), Print(), and ViewBBox().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 241 of file base_struct.h.

242  {
243  return m_Status & type;
244  }
STATUS_FLAGS m_Status
Definition: base_struct.h:179

References EDA_ITEM::m_Status.

Referenced by SELECTION_TOOL::expandConnection(), TRACK::GetMsgPanelInfoBase_Common(), TRACK::IsLocked(), TRACK::Print(), and ZONE_CONTAINER::PrintFilledArea().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 254 of file base_struct.h.

254 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:179

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 741 of file class_pad.h.

741 { return m_SubRatsnest; }
int m_SubRatsnest
variable used in rats nest computations handle subnet (block) number in ratsnest connection
Definition: class_pad.h:883

References m_SubRatsnest.

Referenced by CreatePadsShapesSection().

◆ GetThermalGap()

int D_PAD::GetThermalGap ( ) const

Definition at line 747 of file class_pad.cpp.

748 {
749  MODULE* module = GetParent();
750 
751  if( m_ThermalGap == 0 && module )
752  return module->GetThermalGap();
753  else
754  return m_ThermalGap;
755 }
int m_ThermalGap
Definition: class_pad.h:952
MODULE * GetParent() const
Definition: class_pad.h:167
int GetThermalGap() const
Definition: class_module.h:257

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

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

◆ GetThermalWidth()

int D_PAD::GetThermalWidth ( ) const

Definition at line 736 of file class_pad.cpp.

737 {
738  MODULE* module = GetParent();
739 
740  if( m_ThermalWidth == 0 && module )
741  return module->GetThermalWidth();
742  else
743  return m_ThermalWidth;
744 }
int m_ThermalWidth
Definition: class_pad.h:951
MODULE * GetParent() const
Definition: class_pad.h:167
int GetThermalWidth() const
Definition: class_module.h:254

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

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

◆ GetZoneConnection()

ZONE_CONNECTION D_PAD::GetZoneConnection ( ) const

Definition at line 725 of file class_pad.cpp.

726 {
727  MODULE* module = GetParent();
728 
730  return module->GetZoneConnection();
731  else
732  return m_ZoneConnection;
733 }
ZONE_CONNECTION GetZoneConnection() const
Definition: class_module.h:248
ZONE_CONNECTION m_ZoneConnection
how the connection to zone is made: no connection, thermal relief ...
Definition: class_pad.h:949
MODULE * GetParent() const
Definition: class_pad.h:167

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

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

◆ 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 880 of file class_pad.cpp.

881 {
882  int dx, dy;
883 
884  wxPoint shape_pos = ShapePos();
885 
886  wxPoint delta = aPosition - shape_pos;
887 
888  // first test: a test point must be inside a minimum sized bounding circle.
889  int radius = GetBoundingRadius();
890 
891  if( ( abs( delta.x ) > radius ) || ( abs( delta.y ) > radius ) )
892  return false;
893 
894  dx = m_Size.x >> 1; // dx also is the radius for rounded pads
895  dy = m_Size.y >> 1;
896 
897  switch( GetShape() )
898  {
899  case PAD_SHAPE_CIRCLE:
900  if( KiROUND( EuclideanNorm( delta ) ) <= dx )
901  return true;
902 
903  break;
904 
905  case PAD_SHAPE_TRAPEZOID:
906  {
907  wxPoint poly[4];
908  BuildPadPolygon( poly, wxSize(0,0), 0 );
909  RotatePoint( &delta, -m_Orient );
910 
911  return TestPointInsidePolygon( poly, 4, delta );
912  }
913 
914  case PAD_SHAPE_OVAL:
915  {
916  RotatePoint( &delta, -m_Orient );
917  // An oval pad has the same shape as a segment with rounded ends
918  // After rotation, the test point is relative to an horizontal pad
919  int dist;
920  wxPoint offset;
921  if( dy > dx ) // shape is a vertical oval
922  {
923  offset.y = dy - dx;
924  dist = dx;
925  }
926  else //if( dy <= dx ) shape is an horizontal oval
927  {
928  offset.x = dy - dx;
929  dist = dy;
930  }
931  return TestSegmentHit( delta, - offset, offset, dist );
932  }
933  break;
934 
935  case PAD_SHAPE_RECT:
936  RotatePoint( &delta, -m_Orient );
937 
938  if( (abs( delta.x ) <= dx ) && (abs( delta.y ) <= dy) )
939  return true;
940 
941  break;
942 
944  case PAD_SHAPE_ROUNDRECT:
945  {
946  // Check for hit in polygon
947  SHAPE_POLY_SET outline;
948  bool doChamfer = GetShape() == PAD_SHAPE_CHAMFERED_RECT;
949  auto board = GetBoard();
950  int maxError = ARC_HIGH_DEF;
951 
952  if( board )
953  maxError = board->GetDesignSettings().m_MaxError;
954 
957  doChamfer ? GetChamferRectRatio() : 0.0,
958  doChamfer ? GetChamferPositions() : 0,
959  maxError );
960 
961  const SHAPE_LINE_CHAIN &poly = outline.COutline( 0 );
962  return TestPointInsidePolygon( (const wxPoint*)&poly.CPoint(0), poly.PointCount(), delta );
963  }
964  break;
965 
966  case PAD_SHAPE_CUSTOM:
967  // Check for hit in polygon
968  RotatePoint( &delta, -m_Orient );
969 
971  {
973  return TestPointInsidePolygon( (const wxPoint*)&poly.CPoint(0), poly.PointCount(), delta );
974  }
975  break;
976  }
977 
978  return false;
979 }
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
static const int dist[10][10]
Definition: ar_matrix.cpp:326
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
int PointCount() const
Function PointCount()
int GetChamferPositions() const
has meaning only for chamfered rect pads
Definition: class_pad.h:724
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Definition: trigo.cpp:129
const VECTOR2I & CPoint(int aIndex) const
Function Point()
SHAPE_POLY_SET.
double GetChamferRectRatio() const
has meaning only for chamfered rect pads
Definition: class_pad.h:701
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.h:653
bool TestPointInsidePolygon(const wxPoint *aPolysList, int aCount, const wxPoint &aRefPoint)
Function TestPointInsidePolygon (overlaid) same as previous, but mainly use wxPoint.
SHAPE_POLY_SET m_customShapeAsPolygon
for free shape pads: the set of basic shapes, merged as one polygon, in local coordinates,...
Definition: class_pad.h:873
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aApproxErrorMax, int aMinSegPerCircleCount=16)
convert a rectangle with rounded corners and/or chamfered corners to a polygon Convert rounded corner...
void BuildPadPolygon(wxPoint aCoord[4], wxSize aInflateValue, double aRotation) const
Function BuildPadPolygon Has meaning only for polygonal pads (trapezoid and rectangular) Build the Co...
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
wxPoint ShapePos() const
Definition: class_pad.cpp:570
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:61
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:577
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237
double m_Orient
in 1/10 degrees
Definition: class_pad.h:932
const wxSize & GetSize() const
Definition: class_pad.h:300

References BuildPadPolygon(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), dist, EuclideanNorm(), BOARD_ITEM::GetBoard(), GetBoundingRadius(), GetChamferPositions(), GetChamferRectRatio(), GetRoundRectCornerRadius(), GetShape(), GetSize(), KiROUND(), m_customShapeAsPolygon, m_Orient, m_Size, SHAPE_POLY_SET::OutlineCount(), PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, SHAPE_LINE_CHAIN::PointCount(), RotatePoint(), ShapePos(), TestPointInsidePolygon(), TestSegmentHit(), TransformRoundChamferedRectToPolygon(), wxPoint::x, and wxPoint::y.

◆ 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 982 of file class_pad.cpp.

983 {
984  EDA_RECT arect = aRect;
985  arect.Normalize();
986  arect.Inflate( aAccuracy );
987 
988  wxPoint shapePos = ShapePos();
989 
990  EDA_RECT shapeRect;
991 
992  int r;
993 
994  EDA_RECT bb = GetBoundingBox();
995 
996  wxPoint endCenter;
997  int radius;
998 
999  if( !arect.Intersects( bb ) )
1000  return false;
1001 
1002  // This covers total containment for all test cases
1003  if( arect.Contains( bb ) )
1004  return true;
1005 
1006  switch( GetShape() )
1007  {
1008  case PAD_SHAPE_CIRCLE:
1009  return arect.IntersectsCircle( GetPosition(), GetBoundingRadius() );
1010 
1011  case PAD_SHAPE_RECT:
1012  case PAD_SHAPE_CHAMFERED_RECT: // TODO use a finer shape analysis
1013  shapeRect.SetOrigin( shapePos );
1014  shapeRect.Inflate( m_Size.x / 2, m_Size.y / 2 );
1015  return arect.Intersects( shapeRect, m_Orient );
1016 
1017  case PAD_SHAPE_OVAL:
1018  // Circlular test if dimensions are equal
1019  if( m_Size.x == m_Size.y )
1020  return arect.IntersectsCircle( shapePos, GetBoundingRadius() );
1021 
1022  shapeRect.SetOrigin( shapePos );
1023 
1024  // Horizontal dimension is greater
1025  if( m_Size.x > m_Size.y )
1026  {
1027  radius = m_Size.y / 2;
1028 
1029  shapeRect.Inflate( m_Size.x / 2 - radius, radius );
1030 
1031  endCenter = wxPoint( m_Size.x / 2 - radius, 0 );
1032  RotatePoint( &endCenter, m_Orient );
1033 
1034  // Test circular ends
1035  if( arect.IntersectsCircle( shapePos + endCenter, radius ) ||
1036  arect.IntersectsCircle( shapePos - endCenter, radius ) )
1037  {
1038  return true;
1039  }
1040  }
1041  else
1042  {
1043  radius = m_Size.x / 2;
1044 
1045  shapeRect.Inflate( radius, m_Size.y / 2 - radius );
1046 
1047  endCenter = wxPoint( 0, m_Size.y / 2 - radius );
1048  RotatePoint( &endCenter, m_Orient );
1049 
1050  // Test circular ends
1051  if( arect.IntersectsCircle( shapePos + endCenter, radius ) ||
1052  arect.IntersectsCircle( shapePos - endCenter, radius ) )
1053  {
1054  return true;
1055  }
1056  }
1057 
1058  // Test rectangular portion between rounded ends
1059  if( arect.Intersects( shapeRect, m_Orient ) )
1060  {
1061  return true;
1062  }
1063 
1064  break;
1065 
1066  case PAD_SHAPE_TRAPEZOID:
1067  /* Trapezoid intersection tests:
1068  * A) Any points of rect inside trapezoid
1069  * B) Any points of trapezoid inside rect
1070  * C) Any sides of trapezoid cross rect
1071  */
1072  {
1073 
1074  wxPoint poly[4];
1075  BuildPadPolygon( poly, wxSize( 0, 0 ), 0 );
1076 
1077  wxPoint corners[4];
1078 
1079  corners[0] = wxPoint( arect.GetLeft(), arect.GetTop() );
1080  corners[1] = wxPoint( arect.GetRight(), arect.GetTop() );
1081  corners[2] = wxPoint( arect.GetRight(), arect.GetBottom() );
1082  corners[3] = wxPoint( arect.GetLeft(), arect.GetBottom() );
1083 
1084  for( int i=0; i<4; i++ )
1085  {
1086  RotatePoint( &poly[i], m_Orient );
1087  poly[i] += shapePos;
1088  }
1089 
1090  for( int ii=0; ii<4; ii++ )
1091  {
1092  if( TestPointInsidePolygon( poly, 4, corners[ii] ) )
1093  {
1094  return true;
1095  }
1096 
1097  if( arect.Contains( poly[ii] ) )
1098  {
1099  return true;
1100  }
1101 
1102  if( arect.Intersects( poly[ii], poly[(ii+1) % 4] ) )
1103  {
1104  return true;
1105  }
1106  }
1107 
1108  return false;
1109  }
1110 
1111  case PAD_SHAPE_ROUNDRECT:
1112  /* RoundRect intersection can be broken up into simple tests:
1113  * a) Test intersection of horizontal rect
1114  * b) Test intersection of vertical rect
1115  * c) Test intersection of each corner
1116  */
1118 
1119  /* Test A - intersection of horizontal rect */
1120  shapeRect.SetSize( 0, 0 );
1121  shapeRect.SetOrigin( shapePos );
1122  shapeRect.Inflate( m_Size.x / 2, m_Size.y / 2 - r );
1123 
1124  // Short-circuit test for zero width or height
1125  if( shapeRect.GetWidth() > 0 && shapeRect.GetHeight() > 0 &&
1126  arect.Intersects( shapeRect, m_Orient ) )
1127  {
1128  return true;
1129  }
1130 
1131  /* Test B - intersection of vertical rect */
1132  shapeRect.SetSize( 0, 0 );
1133  shapeRect.SetOrigin( shapePos );
1134  shapeRect.Inflate( m_Size.x / 2 - r, m_Size.y / 2 );
1135 
1136  // Short-circuit test for zero width or height
1137  if( shapeRect.GetWidth() > 0 && shapeRect.GetHeight() > 0 &&
1138  arect.Intersects( shapeRect, m_Orient ) )
1139  {
1140  return true;
1141  }
1142 
1143  /* Test C - intersection of each corner */
1144 
1145  endCenter = wxPoint( m_Size.x / 2 - r, m_Size.y / 2 - r );
1146  RotatePoint( &endCenter, m_Orient );
1147 
1148  if( arect.IntersectsCircle( shapePos + endCenter, r ) ||
1149  arect.IntersectsCircle( shapePos - endCenter, r ) )
1150  {
1151  return true;
1152  }
1153 
1154  endCenter = wxPoint( m_Size.x / 2 - r, -m_Size.y / 2 + r );
1155  RotatePoint( &endCenter, m_Orient );
1156 
1157  if( arect.IntersectsCircle( shapePos + endCenter, r ) ||
1158  arect.IntersectsCircle( shapePos - endCenter, r ) )
1159  {
1160  return true;
1161  }
1162 
1163  break;
1164 
1165  default:
1166  break;
1167  }
1168 
1169  return false;
1170 }
int GetTop() const
Definition: eda_rect.h:123
int GetLeft() const
Definition: eda_rect.h:122
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:890
int GetWidth() const
Definition: eda_rect.h:119
bool IntersectsCircle(const wxPoint &aCenter, const int aRadius) const
Function IntersectsCircle tests for a common area between a circle and this rectangle.
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
bool Contains(const wxPoint &aPoint) const
Function Contains.
int GetBottom() const
Definition: eda_rect.h:124
int GetRight() const
Definition: eda_rect.h:121
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.h:653
bool TestPointInsidePolygon(const wxPoint *aPolysList, int aCount, const wxPoint &aRefPoint)
Function TestPointInsidePolygon (overlaid) same as previous, but mainly use wxPoint.
int GetHeight() const
Definition: eda_rect.h:120
void BuildPadPolygon(wxPoint aCoord[4], wxSize aInflateValue, double aRotation) const
Function BuildPadPolygon Has meaning only for polygonal pads (trapezoid and rectangular) Build the Co...
void Normalize()
Function Normalize ensures that the height ant width are positive.
void SetSize(const wxSize &size)
Definition: eda_rect.h:144
wxPoint ShapePos() const
Definition: class_pad.cpp:570
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.
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:577
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237
double m_Orient
in 1/10 degrees
Definition: class_pad.h:932
const wxPoint GetPosition() const override
Definition: class_pad.h:241
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: class_pad.cpp:229
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

References BuildPadPolygon(), EDA_RECT::Contains(), EDA_RECT::GetBottom(), GetBoundingBox(), GetBoundingRadius(), EDA_RECT::GetHeight(), EDA_RECT::GetLeft(), GetPosition(), EDA_RECT::GetRight(), GetRoundRectCornerRadius(), GetShape(), EDA_RECT::GetTop(), EDA_RECT::GetWidth(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), EDA_RECT::IntersectsCircle(), m_Orient, m_Size, EDA_RECT::Normalize(), PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, RotatePoint(), EDA_RECT::SetOrigin(), EDA_RECT::SetSize(), ShapePos(), and TestPointInsidePolygon().

◆ 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 1488 of file class_pad.cpp.

1489 {
1490  SetShape( aMasterPad.GetShape() );
1491  SetLayerSet( aMasterPad.GetLayerSet() );
1492  SetAttribute( aMasterPad.GetAttribute() );
1493  SetProperty( aMasterPad.GetProperty() );
1494 
1495  // The pad orientation, for historical reasons is the
1496  // pad rotation + parent rotation.
1497  // So we have to manage this parent rotation
1498  double pad_rot = aMasterPad.GetOrientation();
1499 
1500  if( aMasterPad.GetParent() )
1501  pad_rot -= aMasterPad.GetParent()->GetOrientation();
1502 
1503  if( GetParent() )
1504  pad_rot += GetParent()->GetOrientation();
1505 
1506  SetOrientation( pad_rot );
1507 
1508  SetSize( aMasterPad.GetSize() );
1509  SetDelta( wxSize( 0, 0 ) );
1510  SetOffset( aMasterPad.GetOffset() );
1511  SetDrillSize( aMasterPad.GetDrillSize() );
1512  SetDrillShape( aMasterPad.GetDrillShape() );
1514  SetChamferRectRatio( aMasterPad.GetChamferRectRatio() );
1515  SetChamferPositions( aMasterPad.GetChamferPositions() );
1516 
1517  switch( aMasterPad.GetShape() )
1518  {
1519  case PAD_SHAPE_TRAPEZOID:
1520  SetDelta( aMasterPad.GetDelta() );
1521  break;
1522 
1523  case PAD_SHAPE_CIRCLE:
1524  // ensure size.y == size.x
1525  SetSize( wxSize( GetSize().x, GetSize().x ) );
1526  break;
1527 
1528  default:
1529  ;
1530  }
1531 
1532  switch( aMasterPad.GetAttribute() )
1533  {
1534  case PAD_ATTRIB_SMD:
1535  case PAD_ATTRIB_CONN:
1536  // These pads do not have hole (they are expected to be only on one
1537  // external copper layer)
1538  SetDrillSize( wxSize( 0, 0 ) );
1539  break;
1540 
1541  default:
1542  ;
1543  }
1544 
1545  // copy also local settings:
1546  SetLocalClearance( aMasterPad.GetLocalClearance() );
1550 
1551  SetZoneConnection( aMasterPad.GetZoneConnection() );
1552  SetThermalWidth( aMasterPad.GetThermalWidth() );
1553  SetThermalGap( aMasterPad.GetThermalGap() );
1554 
1555  // Add or remove custom pad shapes:
1556  SetPrimitives( aMasterPad.GetPrimitives() );
1557  SetAnchorPadShape( aMasterPad.GetAnchorPadShape() );
1559 }
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:461
double GetOrientation() const
Definition: class_module.h:215
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:247
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:62
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:305
void SetRoundRectRadiusRatio(double aRadiusScale)
has meaning only for rounded rect pads Set the scaling factor between the smaller Y or Y size and the...
Definition: class_pad.h:687
int GetThermalGap() const
Definition: class_pad.cpp:747
int GetLocalClearance() const
Definition: class_pad.h:464
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:449
int GetChamferPositions() const
has meaning only for chamfered rect pads
Definition: class_pad.h:724
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:274
const std::vector< PAD_CS_PRIMITIVE > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:373
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
const wxPoint & GetOffset() const
Definition: class_pad.h:309
ZONE_CONNECTION GetZoneConnection() const
Definition: class_pad.cpp:725
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:432
double GetChamferRectRatio() const
has meaning only for chamfered rect pads
Definition: class_pad.h:701
int GetThermalWidth() const
Definition: class_pad.cpp:736
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:446
void SetThermalWidth(int aWidth)
Definition: class_pad.h:542
void SetSize(const wxSize &aSize)
Definition: class_pad.h:299
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: class_pad.h:530
PAD_PROP_T GetProperty() const
Definition: class_pad.h:452
const wxSize & GetDelta() const
Definition: class_pad.h:303
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:63
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:423
void SetLocalClearance(int aClearance)
Definition: class_pad.h:465
MODULE * GetParent() const
Definition: class_pad.h:167
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:471
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:445
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:430
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:462
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:426
const wxSize & GetDrillSize() const
Definition: class_pad.h:306
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:238
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:438
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:675
void SetChamferRectRatio(double aChamferScale)
has meaning only for chamfered rect pads Set the ratio between the smaller Y or Y size and the radius...
Definition: class_pad.h:712
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:468
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237
const wxSize & GetSize() const
Definition: class_pad.h:300
void SetProperty(PAD_PROP_T aProperty)
Definition: class_pad.cpp:432
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:467
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:308
void SetThermalGap(int aGap)
Definition: class_pad.h:545
bool SetPrimitives(const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
Import to the basic shape list.
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:470
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:302
void SetChamferPositions(int aChamferPositions)
has meaning only for chamfered rect pads set the position of the chamfer for a 0 orientation,...
Definition: class_pad.h:732

References GetAnchorPadShape(), GetAttribute(), GetChamferPositions(), GetChamferRectRatio(), GetDelta(), GetDrillShape(), GetDrillSize(), GetLayerSet(), GetLocalClearance(), GetLocalSolderMaskMargin(), GetLocalSolderPasteMargin(), GetLocalSolderPasteMarginRatio(), GetOffset(), MODULE::GetOrientation(), GetOrientation(), GetParent(), GetPrimitives(), GetProperty(), GetRoundRectRadiusRatio(), GetShape(), GetSize(), GetThermalGap(), GetThermalWidth(), GetZoneConnection(), MergePrimitivesAsPolygon(), 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 MODULE_EDITOR_TOOLS::PlacePad().

◆ IncrementPadName()

bool D_PAD::IncrementPadName ( bool  aSkipUnconnectable,
bool  aFillSequenceGaps 
)

Function IncrementPadName.

Increments the pad name to the next available name in the module.

Parameters
aSkipUnconnectableskips any pads that are not connectable (for example NPTH)
aFillSequenceGapsif true, the next reference in a sequence like A1,A3,A4 will be A2. If false, it will be A5.
Returns
pad name incremented

Definition at line 585 of file class_pad.cpp.

586 {
587  bool skip = aSkipUnconnectable && ( GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED );
588 
589  if( !skip )
590  SetName( GetParent()->GetNextPadName( aFillSequenceGaps ) );
591 
592  return !skip;
593 }
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:449
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12).
Definition: class_pad.h:187
MODULE * GetParent() const
Definition: class_pad.h:167

References GetAttribute(), GetParent(), PAD_ATTRIB_HOLE_NOT_PLATED, and SetName().

Referenced by MODULE::DuplicateItem(), and MODULE_EDITOR_TOOLS::PlacePad().

◆ IsAperturePad()

bool D_PAD::IsAperturePad ( ) const
inline

Definition at line 456 of file class_pad.h.

456 { 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:686
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:919

References LSET::AllCuMask(), and m_layerMask.

Referenced by doPushPadProperties(), MODULE::DuplicateItem(), 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  }

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 223 of file base_struct.h.

223 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:122
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

◆ IsFlipped()

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

Definition at line 139 of file class_pad.cpp.

140 {
141  if( GetParent() && GetParent()->GetLayer() == B_Cu )
142  return true;
143  return false;
144 }
MODULE * GetParent() const
Definition: class_pad.h:167
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().

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 227 of file base_struct.h.

227 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

Referenced by SCH_COMPONENT::ClearAllHighlightFlags(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), and KIGFX::SCH_VIEW::HighlightItem().

◆ 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 210 of file class_board_item.h.

211  {
212  // only MODULEs & TRACKs can be locked at this time.
213  return false;
214  }

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

221 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:116
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

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 285 of file class_pad.h.

286  {
287  return ( GetLayerSet() & LSET::AllCuMask() ) != 0;
288  }
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:686
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:446

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 746 of file class_pad.h.

747  {
748  return m_layerMask[aLayer];
749  }
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:919

References m_layerMask.

Referenced by AR_AUTOPLACER::addPad(), GENERAL_COLLECTOR::Inspect(), DSN::SPECCTRA_DB::makePADSTACK(), Print(), 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 517 of file base_struct.h.

517 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 226 of file base_struct.h.

226 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:121

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 201 of file class_board_item.h.

202  {
203  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
204  }
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:212

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

◆ IsType()

virtual bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[]) const
inlinevirtualinherited

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 in SCH_LABEL, SCH_FIELD, and SCH_LINE.

Definition at line 286 of file base_struct.h.

287  {
288  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
289  return true;
290 
291  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
292  {
293  if( m_StructType == *p )
294  return true;
295  }
296 
297  return false;
298  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:178
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

References EOT, EDA_ITEM::m_StructType, and SCH_LOCATE_ANY_T.

Referenced by SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), SCH_LINE::IsType(), SCH_FIELD::IsType(), SCH_LABEL::IsType(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 224 of file base_struct.h.

224 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:124
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

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 399 of file base_struct.h.

403  {
404  for( auto it : aList )
405  {
406  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
408  return SEARCH_RESULT::QUIT;
409  }
410 
412  }
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 420 of file base_struct.h.

422  {
423  for( auto it : aList )
424  {
425  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
427  return SEARCH_RESULT::QUIT;
428  }
429 
431  }
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().

◆ 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, MARKER_PCB, LIB_PIN, SCH_PIN, SCH_MARKER, TEXTE_MODULE, and TEXTE_PCB.

Definition at line 473 of file base_struct.h.

474  {
475  return false;
476  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), TEXTE_PCB::Matches(), TEXTE_MODULE::Matches(), SCH_MARKER::Matches(), LIB_PIN::Matches(), MARKER_PCB::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 152 of file base_struct.cpp.

153 {
154  wxString text = aText;
155  wxString searchText = aSearchData.GetFindString();
156 
157  // Don't match if searching for replaceable item and the item doesn't support text replace.
158  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
159  return false;
160 
161  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
162  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
163 
164  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
165  {
166  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
167  return text.Matches( searchText );
168 
169  return text.MakeUpper().Matches( searchText.MakeUpper() );
170  }