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...
 
const wxString & GetName () 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...
 
void SetY (int y)
 
void SetX (int x)
 
void SetPos0 (const wxPoint &aPos)
 
const wxPoint & GetPos0 () const
 
void SetY0 (int y)
 
void SetX0 (int x)
 
void SetSize (const wxSize &aSize)
 
const wxSize & GetSize () const
 
void SetDelta (const wxSize &aSize)
 
const wxSize & GetDelta () const
 
void SetDrillSize (const wxSize &aSize)
 
const wxSize & GetDrillSize () const
 
void SetOffset (const wxPoint &aOffset)
 
const wxPoint & GetOffset () const
 
void AddPrimitive (const SHAPE_POLY_SET &aPoly, int aThickness)
 Has meaning only for free shape pads. More...
 
void AddPrimitive (const std::vector< wxPoint > &aPoly, int aThickness)
 add a polygonal basic shape More...
 
void AddPrimitive (wxPoint aStart, wxPoint aEnd, int aThickness)
 segment basic shape More...
 
void AddPrimitive (wxPoint aCenter, int aRadius, int aThickness)
 ring or circle basic shape More...
 
void AddPrimitive (wxPoint aCenter, wxPoint aStart, int aArcAngle, int aThickness)
 arc basic shape More...
 
void AddPrimitive (wxPoint aStart, wxPoint aEnd, wxPoint aCtrl1, wxPoint aCtrl2, int aThickness)
 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
 
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 (ZoneConnection aType)
 
ZoneConnection GetZoneConnection () 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_T 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_T 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 (PARAM_CFG_ARRAY *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_PADDuplicate () 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)
 Function SetNetCode 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...
 
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...
 
virtual void UnLink ()
 Function UnLink detaches this object from its owner. More...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after UnLink()ing it from its owner 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 SetTimeStamp (timestamp_t aNewTimeStamp)
 
timestamp_t GetTimeStamp () const
 
EDA_ITEMNext () const
 
EDA_ITEMBack () const
 
DHEADGetList () const
 
void SetNext (EDA_ITEM *aNext)
 
void SetBack (EDA_ITEM *aBack)
 
void SetParent (EDA_ITEM *aParent)
 
void SetList (DHEAD *aList)
 
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
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[])
 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...
 
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...
 
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...
 
static SEARCH_RESULT IterateForward (EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes. 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...
 
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...
 

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_ITEMPnext
 next in linked list More...
 
EDA_ITEMPback
 previous in linked list More...
 
DHEADm_List
 which DLIST I am on. More...
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
timestamp_t m_TimeStamp
 Time stamp used for logical links. 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
 
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...
 
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...
 
ZoneConnection 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 59 of file class_pad.cpp.

59  :
61 {
62  m_Size.x = m_Size.y = Mils2iu( 60 ); // Default pad size 60 mils.
63  m_Drill.x = m_Drill.y = Mils2iu( 30 ); // Default drill size 30 mils.
64  m_Orient = 0; // Pad rotation in 1/10 degrees.
65  m_LengthPadToDie = 0;
66 
67  if( m_Parent && m_Parent->Type() == PCB_MODULE_T )
68  {
70  }
71 
72  SetShape( PAD_SHAPE_CIRCLE ); // Default pad shape is PAD_CIRCLE.
73  SetAnchorPadShape( PAD_SHAPE_CIRCLE ); // Default shape for custom shaped pads
74  // is PAD_CIRCLE.
75  SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); // Default pad drill shape is a circle.
76  m_Attribute = PAD_ATTRIB_STANDARD; // Default pad type is NORMAL (thru hole)
77  m_LocalClearance = 0;
81  // Parameters for round rect only:
82  m_padRoundRectRadiusScale = 0.25; // from IPC-7351C standard
83  // Parameters for chamfered rect only:
84  m_padChamferRectScale = 0.2; // Size of chamfer: ratio of smallest of X,Y size
85  m_chamferPositions = RECT_NO_CHAMFER; // No chamfered corner
86 
87  m_ZoneConnection = PAD_ZONE_CONN_INHERITED; // Use parent setting by default
88  m_ThermalWidth = 0; // Use parent setting by default
89  m_ThermalGap = 0; // Use parent setting by default
90 
92 
93  // Set layers mask to default for a standard thru hole pad.
95 
96  SetSubRatsnest( 0 ); // used in ratsnest calculations
97 
98  m_boundingRadius = -1;
99 }
int m_LocalClearance
Local clearance.
Definition: class_pad.h:894
int m_ThermalGap
Definition: class_pad.h:907
int m_LocalSolderMaskMargin
Local mask margins: when 0, the parent footprint design values are used.
Definition: class_pad.h:898
double m_padRoundRectRadiusScale
scaling factor from smallest m_Size coord to corner radius, default 0.25
Definition: class_pad.h:851
int m_boundingRadius
radius of the circle containing the pad shape
Definition: class_pad.h:810
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:167
double m_padChamferRectScale
scaling factor from smallest m_Size coord to chamfer value, default 0.25
Definition: class_pad.h:853
static LSET StandardMask()
layer set for a through hole pad
Definition: class_pad.cpp:102
int m_LocalSolderPasteMargin
Local solder paste margin absolute value.
Definition: class_pad.h:899
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:847
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
void SetSubRatsnest(int aSubRatsnest)
Definition: class_pad.h:700
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:258
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:838
int m_ThermalWidth
Definition: class_pad.h:906
int m_chamferPositions
the positions of the chamfered position for a 0 orientation
Definition: class_pad.h:855
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:876
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:400
int m_LengthPadToDie
Length net from pad to die, inside the package.
Definition: class_pad.h:889
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:222
PAD_ATTR_T m_Attribute
PAD_ATTRIB_NORMAL, PAD_ATTRIB_SMD, PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED.
Definition: class_pad.h:885
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:843
double m_Orient
in 1/10 degrees
Definition: class_pad.h:887
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:901
const wxPoint GetPosition() const override
Definition: class_module.h:188
ZoneConnection m_ZoneConnection
how the connection to zone is made: no connection, thermal relief ...
Definition: class_pad.h:904
KICAD_T Type() const
Function Type()
Definition: base_struct.h:197
wxPoint m_Pos
pad Position on board
Definition: class_pad.h:815

References CUST_PAD_SHAPE_IN_ZONE_OUTLINE, GetParent(), MODULE::GetPosition(), 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_SHAPE_CIRCLE, PAD_ZONE_CONN_INHERITED, PCB_MODULE_T, RECT_NO_CHAMFER, SetAnchorPadShape(), SetDrillShape(), SetShape(), SetSubRatsnest(), StandardMask(), and EDA_ITEM::Type().

Referenced by Clone().

Member Function Documentation

◆ AddPrimitive() [1/6]

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

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.push_back( wxPoint( iter->x, iter->y ) );
145 
146  AddPrimitive( points, aThickness );
147 }
Class SHAPE_POLY_SET.
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
void AddPrimitive(const SHAPE_POLY_SET &aPoly, int aThickness)
Has meaning only for free shape pads.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

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

Referenced by PCB_EDIT_FRAME::Create_MuWaveComponent().

◆ AddPrimitive() [2/6]

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

add a polygonal basic shape

Definition at line 149 of file pad_custom_shape_functions.cpp.

150 {
151  PAD_CS_PRIMITIVE shape( S_POLYGON );
152  shape.m_Poly = aPoly;
153  shape.m_Thickness = aThickness;
154  m_basicShapes.push_back( shape );
155 
157 }
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:825
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.

◆ AddPrimitive() [3/6]

void D_PAD::AddPrimitive ( wxPoint  aStart,
wxPoint  aEnd,
int  aThickness 
)

segment basic shape

Definition at line 160 of file pad_custom_shape_functions.cpp.

161 {
162  PAD_CS_PRIMITIVE shape( S_SEGMENT );
163  shape.m_Start = aStart;
164  shape.m_End = aEnd;
165  shape.m_Thickness = aThickness;
166  m_basicShapes.push_back( shape );
167 
169 }
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:825
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.

◆ AddPrimitive() [4/6]

void D_PAD::AddPrimitive ( wxPoint  aCenter,
int  aRadius,
int  aThickness 
)

ring or circle basic shape

Definition at line 199 of file pad_custom_shape_functions.cpp.

200 {
201  PAD_CS_PRIMITIVE shape( S_CIRCLE );
202  shape.m_Start = aCenter;
203  shape.m_Radius = aRadius;
204  shape.m_Thickness = aThickness;
205  m_basicShapes.push_back( shape );
206 
208 }
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:825
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.

◆ AddPrimitive() [5/6]

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

arc basic shape

Definition at line 172 of file pad_custom_shape_functions.cpp.

173 {
174  PAD_CS_PRIMITIVE shape( S_ARC );
175  shape.m_Start = aCenter;
176  shape.m_End = aStart;
177  shape.m_ArcAngle = aArcAngle;
178  shape.m_Thickness = aThickness;
179  m_basicShapes.push_back( shape );
180 
182 }
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:825
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.

◆ AddPrimitive() [6/6]

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

curve basic shape

Definition at line 185 of file pad_custom_shape_functions.cpp.

186 {
187  PAD_CS_PRIMITIVE shape( S_CURVE );
188  shape.m_Start = aStart;
189  shape.m_End = aEnd;
190  shape.m_Ctrl1 = aCtrl1;
191  shape.m_Ctrl2 = aCtrl2;
192  shape.m_Thickness = aThickness;
193  m_basicShapes.push_back( shape );
194 
196 }
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:825
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.

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

225 {
226  for( const auto& prim : aPrimitivesList )
227  m_basicShapes.push_back( prim );
228 
229  return MergePrimitivesAsPolygon();
230 }
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:825
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().

◆ ApertureMask()

LSET D_PAD::ApertureMask ( )
static

layer set for an aperture pad

Definition at line 130 of file class_pad.cpp.

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

References F_Paste.

◆ AppendConfigs()

void D_PAD::AppendConfigs ( PARAM_CFG_ARRAY 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:847
Configuration parameter - Integer Class with unit conversion.
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:843

References m_Drill, and m_Size.

◆ Back()

EDA_ITEM* EDA_ITEM::Back ( ) const
inlineinherited

Definition at line 206 of file base_struct.h.

206 { return Pback; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:164

References EDA_ITEM::Pback.

Referenced by DHEAD::insert(), and DHEAD::remove().

◆ boundingRadius()

int D_PAD::boundingRadius ( ) const
private

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

Definition at line 144 of file class_pad.cpp.

145 {
146  int x, y;
147  int radius;
148 
149  switch( GetShape() )
150  {
151  case PAD_SHAPE_CIRCLE:
152  radius = m_Size.x / 2;
153  break;
154 
155  case PAD_SHAPE_OVAL:
156  radius = std::max( m_Size.x, m_Size.y ) / 2;
157  break;
158 
159  case PAD_SHAPE_RECT:
160  radius = 1 + KiROUND( EuclideanNorm( m_Size ) / 2 );
161  break;
162 
163  case PAD_SHAPE_TRAPEZOID:
164  x = m_Size.x + std::abs( m_DeltaSize.y ); // Remember: m_DeltaSize.y is the m_Size.x change
165  y = m_Size.y + std::abs( m_DeltaSize.x ); // Remember: m_DeltaSize.x is the m_Size.y change
166  radius = 1 + KiROUND( hypot( x, y ) / 2 );
167  break;
168 
169  case PAD_SHAPE_ROUNDRECT:
170  radius = GetRoundRectCornerRadius();
171  x = m_Size.x >> 1;
172  y = m_Size.y >> 1;
173  radius += 1 + KiROUND( EuclideanNorm( wxSize( x - radius, y - radius )));
174  break;
175 
177  radius = GetRoundRectCornerRadius();
178  x = m_Size.x >> 1;
179  y = m_Size.y >> 1;
180  radius += 1 + KiROUND( EuclideanNorm( wxSize( x - radius, y - radius )));
181  // TODO: modify radius if the chamfer is smaller than corner radius
182  break;
183 
184  case PAD_SHAPE_CUSTOM:
185  radius = 0;
186 
187  for( int cnt = 0; cnt < m_customShapeAsPolygon.OutlineCount(); ++cnt )
188  {
189  const SHAPE_LINE_CHAIN& poly = m_customShapeAsPolygon.COutline( cnt );
190  for( int ii = 0; ii < poly.PointCount(); ++ii )
191  {
192  int dist = KiROUND( poly.CPoint( ii ).EuclideanNorm() );
193  radius = std::max( radius, dist );
194  }
195  }
196 
197  radius += 1;
198  break;
199 
200  default:
201  radius = 0;
202  }
203 
204  return radius;
205 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:123
int OutlineCount() const
Returns the number of outlines in the set
static const int dist[10][10]
Definition: ar_matrix.cpp:320
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:847
int PointCount() const
Function PointCount()
#define abs(a)
Definition: auxiliary.h:84
const VECTOR2I & CPoint(int aIndex) const
Function CPoint()
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:830
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:880
#define max(a, b)
Definition: auxiliary.h:86
Class SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:535
T EuclideanNorm() const
Destructor.
Definition: vector2d.h:292
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221

References abs, SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), dist, EuclideanNorm(), VECTOR2< T >::EuclideanNorm(), GetRoundRectCornerRadius(), GetShape(), KiROUND(), m_customShapeAsPolygon, m_DeltaSize, m_Size, max, 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 241 of file pad_custom_shape_functions.cpp.

243 {
244  SHAPE_POLY_SET aux_polyset;
245 
246  for( unsigned cnt = 0; cnt < m_basicShapes.size(); ++cnt )
247  {
248  const PAD_CS_PRIMITIVE& bshape = m_basicShapes[cnt];
249 
250  switch( bshape.m_Shape )
251  {
252  case S_CURVE:
253  {
254  std::vector<wxPoint> ctrlPoints = { bshape.m_Start, bshape.m_Ctrl1, bshape.m_Ctrl2, bshape.m_End };
255  BEZIER_POLY converter( ctrlPoints );
256  std::vector< wxPoint> poly;
257  converter.GetPoly( poly, bshape.m_Thickness );
258 
259  for( unsigned ii = 1; ii < poly.size(); ii++ )
260  {
262  aux_polyset, poly[ii - 1], poly[ii], aError, bshape.m_Thickness );
263  }
264  break;
265  }
266 
267  case S_SEGMENT: // usual segment : line with rounded ends
268  {
270  aux_polyset, bshape.m_Start, bshape.m_End, aError, bshape.m_Thickness );
271  break;
272  }
273 
274  case S_ARC: // Arc with rounded ends
275  {
276  TransformArcToPolygon( aux_polyset, bshape.m_Start, bshape.m_End, bshape.m_ArcAngle,
277  aError, bshape.m_Thickness );
278  break;
279  }
280 
281  case S_CIRCLE: // ring or circle
282  {
283  if( bshape.m_Thickness ) // ring
285  aux_polyset, bshape.m_Start, bshape.m_Radius, aError, bshape.m_Thickness );
286  else // Filled circle
287  TransformCircleToPolygon( aux_polyset, bshape.m_Start, bshape.m_Radius, aError );
288  break;
289  }
290 
291  case S_POLYGON: // polygon
292  if( bshape.m_Poly.size() < 2 )
293  break; // Malformed polygon.
294  {
295  // Insert the polygon:
296  const std::vector< wxPoint>& poly = bshape.m_Poly;
297  aux_polyset.NewOutline();
298 
299  if( bshape.m_Thickness )
300  {
301  SHAPE_POLY_SET polyset;
302  polyset.NewOutline();
303 
304  for( unsigned ii = 0; ii < poly.size(); ii++ )
305  {
306  polyset.Append( poly[ii].x, poly[ii].y );
307  }
308 
309  int numSegs = std::max(
310  GetArcToSegmentCount( bshape.m_Thickness / 2, aError, 360.0 ), 6 );
311  polyset.Inflate( bshape.m_Thickness / 2, numSegs );
312 
313  aux_polyset.Append( polyset );
314  }
315  else
316  for( unsigned ii = 0; ii < poly.size(); ii++ )
317  aux_polyset.Append( poly[ii].x, poly[ii].y );
318  }
319  break;
320 
321  default:
322  break;
323  }
324  }
325 
326  aux_polyset.Simplify( SHAPE_POLY_SET::PM_FAST );
327 
328  // Merge all polygons with the initial pad anchor shape
329  if( aux_polyset.OutlineCount() )
330  {
331  aMergedPolygon->BooleanAdd( aux_polyset, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
332  aMergedPolygon->Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
333  }
334 
335  return aMergedPolygon->OutlineCount() <= 1;
336 }
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:825
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...
int OutlineCount() const
Returns the number of outlines in the set
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aBuffer, wxPoint aCenter, int aRadius, int aError)
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)
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)
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...
usual segment : line with rounded ends
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
void TransformRoundedEndsSegmentToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aError, int aWidth)
Function TransformRoundedEndsSegmentToPolygon convert a segment with rounded ends to a polygon Conver...
std::vector< wxPoint > m_Poly
Bezier Control point 2.
Definition: class_pad.h:102
Class 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
#define max(a, b)
Definition: auxiliary.h:86
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, max, 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 TransformRoundedEndsSegmentToPolygon().

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 742 of file board_items_to_polygon_shape_transform.cpp.

744 {
745  wxSize drillsize = GetDrillSize();
746 
747  if( !drillsize.x || !drillsize.y )
748  return false;
749 
750  if( drillsize.x == drillsize.y ) // usual round hole
751  {
752  int radius = ( drillsize.x / 2 ) + aInflateValue;
753  TransformCircleToPolygon( aCornerBuffer, GetPosition(), radius, aError );
754  }
755  else // Oblong hole
756  {
757  wxPoint start, end;
758  int width;
759 
760  GetOblongDrillGeometry( start, end, width );
761 
762  width += aInflateValue * 2;
763 
765  aCornerBuffer, GetPosition() + start, GetPosition() + end, aError, width );
766  }
767 
768  return true;
769 }
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aBuffer, wxPoint aCenter, int aRadius, int aError)
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:825
void TransformRoundedEndsSegmentToPolygon(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 wxSize & GetDrillSize() const
Definition: class_pad.h:280
const wxPoint GetPosition() const override
Definition: class_pad.h:225

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

◆ 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 618 of file pad_print_functions.cpp.

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

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

Referenced by CINFO3D_VISU::buildPadShapePolygon(), BuildPadShapePolygon(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), CINFO3D_VISU::createNewPadWithClearance(), CreatePadsShapesSection(), HitTest(), BRDITEMS_PLOTTER::PlotPad(), PrintShape(), PNS_KICAD_IFACE::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 693 of file board_items_to_polygon_shape_transform.cpp.

695 {
696  wxPoint corners[4];
697  wxPoint padShapePos = ShapePos(); /* Note: for pad having a shape offset,
698  * the pad position is NOT the shape position */
699  switch( GetShape() )
700  {
701  case PAD_SHAPE_CIRCLE:
702  case PAD_SHAPE_OVAL:
703  case PAD_SHAPE_ROUNDRECT:
705  {
706  // We are using TransformShapeWithClearanceToPolygon to build the shape.
707  // Currently, this method uses only the same inflate value for X and Y dirs.
708  // so because here this is not the case, we use a inflated dummy pad to build
709  // the polygonal shape
710  // TODO: remove this dummy pad when TransformShapeWithClearanceToPolygon will use
711  // a wxSize to inflate the pad size
712  D_PAD dummy( *this );
713  dummy.SetSize( GetSize() + aInflateValue + aInflateValue );
714  dummy.TransformShapeWithClearanceToPolygon( aCornerBuffer, 0 );
715  }
716  break;
717 
718  case PAD_SHAPE_TRAPEZOID:
719  case PAD_SHAPE_RECT:
720  aCornerBuffer.NewOutline();
721 
722  BuildPadPolygon( corners, aInflateValue, m_Orient );
723  for( int ii = 0; ii < 4; ii++ )
724  {
725  corners[ii] += padShapePos; // Shift origin to position
726  aCornerBuffer.Append( corners[ii].x, corners[ii].y );
727  }
728 
729  break;
730 
731  case PAD_SHAPE_CUSTOM:
732  // for a custom shape, that is in fact a polygon (with holes), we can use only a inflate value.
733  // so use ( aInflateValue.x + aInflateValue.y ) / 2 as polygon inflate value.
734  // (different values for aInflateValue.x and aInflateValue.y has no sense for a custom pad)
736  aCornerBuffer, ( aInflateValue.x + aInflateValue.y ) / 2 );
737  break;
738  }
739 }
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:221
double m_Orient
in 1/10 degrees
Definition: class_pad.h:887
const wxSize & GetSize() const
Definition: class_pad.h:274
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(), and PNS_KICAD_IFACE::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 584 of file pad_print_functions.cpp.

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

References m_Size, and RotatePoint().

Referenced by PrintShape(), and PNS_KICAD_IFACE::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:197

References PCB_PAD_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 232 of file base_struct.h.

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

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), and SELECTION_TOOL::unhighlight().

◆ ClearEditFlags()

void EDA_ITEM::ClearEditFlags ( )
inlineinherited

◆ ClearFlags()

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

Definition at line 253 of file base_struct.h.

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

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), 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(), EDIT_POINTS_FACTORY::Make(), 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_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 231 of file base_struct.h.

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

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 264 of file base_struct.h.

265  {
267  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:104
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:118
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:117
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:113
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:253
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:119
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:112

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  {
155  m_viewPrivData = NULL;
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

1295 {
1296  return new D_PAD( *this );
1297 }
D_PAD(MODULE *parent)
Definition: class_pad.cpp:59

References D_PAD().

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

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

1152 {
1153  int diff;
1154 
1155  if( ( diff = padref->GetShape() - padcmp->GetShape() ) != 0 )
1156  return diff;
1157 
1158  if( ( diff = padref->GetDrillShape() - padcmp->GetDrillShape() ) != 0)
1159  return diff;
1160 
1161  if( ( diff = padref->m_Drill.x - padcmp->m_Drill.x ) != 0 )
1162  return diff;
1163 
1164  if( ( diff = padref->m_Drill.y - padcmp->m_Drill.y ) != 0 )
1165  return diff;
1166 
1167  if( ( diff = padref->m_Size.x - padcmp->m_Size.x ) != 0 )
1168  return diff;
1169 
1170  if( ( diff = padref->m_Size.y - padcmp->m_Size.y ) != 0 )
1171  return diff;
1172 
1173  if( ( diff = padref->m_Offset.x - padcmp->m_Offset.x ) != 0 )
1174  return diff;
1175 
1176  if( ( diff = padref->m_Offset.y - padcmp->m_Offset.y ) != 0 )
1177  return diff;
1178 
1179  if( ( diff = padref->m_DeltaSize.x - padcmp->m_DeltaSize.x ) != 0 )
1180  return diff;
1181 
1182  if( ( diff = padref->m_DeltaSize.y - padcmp->m_DeltaSize.y ) != 0 )
1183  return diff;
1184 
1185 // TODO: test custom shapes
1186 
1187  // Dick: specctra_export needs this
1188  // Lorenzo: gencad also needs it to implement padstacks!
1189 
1190 #if __cplusplus >= 201103L
1191  long long d = padref->m_layerMask.to_ullong() - padcmp->m_layerMask.to_ullong();
1192  if( d < 0 )
1193  return -1;
1194  else if( d > 0 )
1195  return 1;
1196 
1197  return 0;
1198 #else
1199  // these strings are not typically constructed, since we don't get here often.
1200  std::string s1 = padref->m_layerMask.to_string();
1201  std::string s2 = padcmp->m_layerMask.to_string();
1202  return s1.compare( s2 );
1203 #endif
1204 }
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:847
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:402
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:880
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:876
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:843
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221
wxPoint m_Offset
m_Offset is useful only for oblong and rect pads (it can be used for other shapes,...
Definition: class_pad.h:874

References GetDrillShape(), GetShape(), m_DeltaSize, m_Drill, m_layerMask, m_Offset, and m_Size.

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

117 {
118  static LSET saved( 2, F_Cu, F_Mask );
119  return saved;
120 }
Class 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 383 of file pad_custom_shape_functions.cpp.

385 {
386  if( aMergedPolygon->OutlineCount() == 0 )
387  return;
388 
389  // Move, rotate, ... coordinates in aMergedPolygon according to the
390  // pad position and orientation
391  for( int cnt = 0; cnt < aMergedPolygon->OutlineCount(); ++cnt )
392  {
393  SHAPE_LINE_CHAIN& poly = aMergedPolygon->Outline( cnt );
394 
395  for( int ii = 0; ii < poly.PointCount(); ++ii )
396  {
397  wxPoint corner( poly.Point( ii ).x, poly.Point( ii ).y );
398  RotatePoint( &corner, aRotation );
399  corner += aPosition;
400 
401  poly.Point( ii ).x = corner.x;
402  poly.Point( ii ).y = corner.y;
403  }
404  }
405 }
int OutlineCount() const
Returns the number of outlines in the set
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
int PointCount() const
Function PointCount()
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
Class SHAPE_LINE_CHAIN.
VECTOR2I & Point(int aIndex)
Function Point()

References SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::Point(), SHAPE_LINE_CHAIN::PointCount(), RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ DeletePrimitivesList()

void D_PAD::DeletePrimitivesList ( )

clear the basic shapes list

Definition at line 234 of file pad_custom_shape_functions.cpp.

235 {
236  m_basicShapes.clear();
238 }
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:825
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:830
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 UnLink()ing it from its owner if it has one.

Definition at line 127 of file class_board_item.cpp.

128 {
129  auto parent = GetParent();
130 
131  if( parent )
132  parent->Remove( this );
133 
134  delete this;
135 }
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()

D_PAD* D_PAD::Duplicate ( ) const
inline

same as Clone, but returns a D_PAD item.

Useful mainly for pythons scripts, because Clone (virtual function) returns an EDA_ITEM.

Definition at line 773 of file class_pad.h.

774  {
775  return (D_PAD*) Clone();
776  }
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_pad.cpp:1294

References Clone().

◆ Flip() [1/2]

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

Definition at line 270 of file class_board_item.h.

271  {
272  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
273  }
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 437 of file class_pad.cpp.

438 {
439  if( aFlipLeftRight )
440  {
441  MIRROR( m_Pos.x, aCentre.x );
442  MIRROR( m_Pos0.x, 0 );
443  MIRROR( m_Offset.x, 0 );
444  MIRROR( m_DeltaSize.x, 0 );
445  }
446  else
447  {
448  MIRROR( m_Pos.y, aCentre.y );
449  MIRROR( m_Pos0.y, 0 );
450  MIRROR( m_Offset.y, 0 );
451  MIRROR( m_DeltaSize.y, 0 );
452  }
453 
455 
456  // flip pads layers
457  // PADS items are currently on all copper layers, or
458  // currently, only on Front or Back layers.
459  // So the copper layers count is not taken in account
461 
462  // Flip the basic shapes, in custom pads
463  FlipPrimitives();
464 
465  // m_boundingRadius = -1; the shape has not been changed
466 }
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask,...
Definition: lset.cpp:521
void FlipPrimitives()
Flip the basic shapes, in custom pads.
Definition: class_pad.cpp:470
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:123
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:880
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:876
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:415
wxPoint m_Pos0
Initial Pad position (i.e.
Definition: class_pad.h:882
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:396
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:430
wxPoint m_Offset
m_Offset is useful only for oblong and rect pads (it can be used for other shapes,...
Definition: class_pad.h:874
wxPoint m_Pos
pad Position on board
Definition: class_pad.h:815

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

◆ FlipPrimitives()

void D_PAD::FlipPrimitives ( )

Flip the basic shapes, in custom pads.

Definition at line 470 of file class_pad.cpp.

471 {
472  // Flip custom shapes
473  for( unsigned ii = 0; ii < m_basicShapes.size(); ++ii )
474  {
475  PAD_CS_PRIMITIVE& primitive = m_basicShapes[ii];
476 
477  MIRROR( primitive.m_Start.y, 0 );
478  MIRROR( primitive.m_End.y, 0 );
479  primitive.m_ArcAngle = -primitive.m_ArcAngle;
480 
481  switch( primitive.m_Shape )
482  {
483  case S_POLYGON: // polygon
484  for( unsigned jj = 0; jj < primitive.m_Poly.size(); jj++ )
485  MIRROR( primitive.m_Poly[jj].y, 0 );
486  break;
487 
488  default:
489  break;
490  }
491  }
492 
493  // Flip local coordinates in merged Polygon
494  for( int cnt = 0; cnt < m_customShapeAsPolygon.OutlineCount(); ++cnt )
495  {
497 
498  for( int ii = 0; ii < poly.PointCount(); ++ii )
499  MIRROR( poly.Point( ii ).y, 0 );
500  }
501 }
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:825
int OutlineCount() const
Returns the number of outlines in the set
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)
int PointCount() const
Function PointCount()
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
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
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:830
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
Class SHAPE_LINE_CHAIN.
VECTOR2I & Point(int aIndex)
Function Point()
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::Outline(), SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::Point(), SHAPE_LINE_CHAIN::PointCount(), S_POLYGON, and VECTOR2< T >::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 231 of file class_pad.h.

231 { 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:857

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

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

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(), max, min, NULLOPT, PAD_SHAPE_CIRCLE, numEval::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 64 of file class_board_item.cpp.

65 {
66  if( Type() == PCB_T )
67  return (BOARD*) this;
68 
69  BOARD_ITEM* parent = GetParent();
70 
71  if( parent )
72  return parent->GetBoard();
73 
74  return NULL;
75 }
Definition: typeinfo.h:85
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:197

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

Referenced by ZONE_CONTAINER::BuildSmoothedPoly(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), TEXTE_PCB::Flip(), TRACK::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 227 of file class_pad.cpp.

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

References abs, 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, max, EDA_RECT::Merge(), min, 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(), VECTOR2< T >::x, 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 611 of file class_pad.h.

612  {
613  // Any member function which would affect this calculation should set
614  // m_boundingRadius to -1 to re-trigger the calculation from here.
615  // Currently that is only m_Size, m_DeltaSize, and m_padShape accessors.
616  if( m_boundingRadius == -1 )
617  {
619  }
620 
621  return m_boundingRadius;
622  }
int m_boundingRadius
radius of the circle containing the pad shape
Definition: class_pad.h:810
int boundingRadius() const
Function boundingRadius returns a calculated radius of a bounding circle for this pad.
Definition: class_pad.cpp:144

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().

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

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

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

660  {
661  return m_padChamferRectScale;
662  }
double m_padChamferRectScale
scaling factor from smallest m_Size coord to chamfer value, default 0.25
Definition: class_pad.h:853

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

713  {
714  return wxT( "PAD" );
715  }

◆ 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:894
int GetLocalClearance() const
Definition: class_pad.h:431
int GetLocalClearance() const
Definition: class_module.h:212
MODULE * GetParent() const
Definition: class_pad.h:167
#define max(a, b)
Definition: auxiliary.h:86
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(), m_LocalClearance, and max.

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

348 { 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:830

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

238  {
240  }
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:838

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

257  {
261  return m_Flags & mask;
262  }
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:126
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:125
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:141
#define SELECTED
Definition: base_struct.h:114
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:130
#define DP_COUPLED
item is coupled with another item making a differential pair
Definition: base_struct.h:132
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:129
#define IS_DANGLING
indicates a pin is dangling
Definition: base_struct.h:136
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:174
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:113
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:112

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

Referenced by SCH_EDIT_TOOL::ChangeShape(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::DeleteJunction(), PCB_EDIT_FRAME::Edit_TrackSegm_Width(), SCH_EDIT_TOOL::editComponentFieldText(), SCH_EDITOR_CONTROL::EditWithLibEdit(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), BOARD::Print(), 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_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

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

123 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by CN_CONNECTIVITY_ALGO::Add(), 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(), 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(), 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::syncGraphicalItem(), PNS_KICAD_IFACE::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(), TEXTE_MODULE::ViewGetLayers(), TRACK::ViewGetLayers(), TEXTE_MODULE::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 78 of file class_board_item.cpp.

79 {
80  BOARD* board = GetBoard();
81 
82  if( board )
83  return board->GetLayerName( m_Layer );
84 
85  // If no parent, return standard name
87 }
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.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
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:659

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(), TEXTE_MODULE::GetSelectMenuText(), TRACK::GetSelectMenuText(), DIMENSION::GetSelectMenuText(), DRAWSEGMENT::GetSelectMenuText(), MODULE::GetSelectMenuText(), ZONE_CONTAINER::GetSelectMenuText(), and TEXT_MOD_GRID_TABLE::GetValue().

◆ GetLayerSet()

LSET D_PAD::GetLayerSet ( ) const
inlineoverridevirtual

◆ GetList()

DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited

Definition at line 208 of file base_struct.h.

208 { return m_List; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:165

References EDA_ITEM::m_List.

Referenced by DHEAD::insert(), DHEAD::remove(), BOARD_ITEM::UnLink(), and GERBER_DRAW_ITEM::UnLink().

◆ GetLocalClearance()

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

Definition at line 189 of file board_connected_item.h.

190  {
191  return m_localRatsnestVisible;
192  }

References BOARD_CONNECTED_ITEM::m_localRatsnestVisible.

◆ GetLocalSolderMaskMargin()

int D_PAD::GetLocalSolderMaskMargin ( ) const
inline

Definition at line 428 of file class_pad.h.

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

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

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

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 437 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:901

References m_LocalSolderPasteMarginRatio.

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

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

1289 {
1290  return pad_xpm;
1291 }

◆ GetMsgPanelInfo()

void D_PAD::GetMsgPanelInfo ( EDA_UNITS_T  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.push_back( MSG_PANEL_ITEM( _( "Footprint" ), module->GetReference(), DARKCYAN ) );
769  aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), m_name, BROWN ) );
770  }
771 
772  aList.push_back( MSG_PANEL_ITEM( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN ) );
773 
774  board = GetBoard();
775 
776  aList.push_back( MSG_PANEL_ITEM( _( "Layer" ),
777  LayerMaskDescribe( board, m_layerMask ), DARKGREEN ) );
778 
779  aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) );
780 
781  msg = MessageTextFromValue( aUnits, m_Size.x, true );
782  aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
783 
784  msg = MessageTextFromValue( aUnits, m_Size.y, true );
785  aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
786 
787  msg = MessageTextFromValue( aUnits, m_Drill.x, true );
788 
790  {
791  aList.push_back( MSG_PANEL_ITEM( _( "Drill" ), msg, RED ) );
792  }
793  else
794  {
795  msg = MessageTextFromValue( aUnits, m_Drill.x, true )
796  + wxT( "/" )
797  + MessageTextFromValue( aUnits, m_Drill.y, true );
798  aList.push_back( MSG_PANEL_ITEM( _( "Drill X / Y" ), msg, RED ) );
799  }
800 
801  double module_orient_degrees = module ? module->GetOrientationDegrees() : 0;
802 
803  if( module_orient_degrees != 0.0 )
804  msg.Printf( wxT( "%3.1f(+%3.1f)" ),
805  GetOrientationDegrees() - module_orient_degrees,
806  module_orient_degrees );
807  else
808  msg.Printf( wxT( "%3.1f" ), GetOrientationDegrees() );
809 
810  aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, LIGHTBLUE ) );
811 
812  msg = MessageTextFromValue( aUnits, m_Pos.x )
813  + wxT( ", " )
814  + MessageTextFromValue( aUnits, m_Pos.y );
815  aList.push_back( MSG_PANEL_ITEM( _( "Position" ), msg, LIGHTBLUE ) );
816 
817  if( GetPadToDieLength() )
818  {
819  msg = MessageTextFromValue( aUnits, GetPadToDieLength(), true );
820  aList.push_back( MSG_PANEL_ITEM( _( "Length in package" ), msg, CYAN ) );
821  }
822 }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:167
double GetOrientationDegrees() const
Definition: class_pad.h:397
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:847
int GetPadToDieLength() const
Definition: class_pad.h:426
wxString ShowPadAttr() const
Function ShowPadAttr.
Definition: class_pad.cpp:1248
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:407
wxString MessageTextFromValue(EDA_UNITS_T aUnits, int aValue, bool aUseMils)
Definition: base_units.cpp:125
wxString m_name
Definition: class_pad.h:812
wxString ShowPadShape() const
Function ShowPadShape.
Definition: class_pad.cpp:1217
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:402
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:194
Definition: colors.h:60
const wxString & GetNetname() const
Function GetNetname.
#define _(s)
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:876
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:123
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:843
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
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:1434
wxPoint m_Pos
pad Position on board
Definition: class_pad.h:815
Definition: colors.h:62

References _, BROWN, CYAN, DARKCYAN, DARKGREEN, BOARD_ITEM::GetBoard(), GetDrillShape(), BOARD_CONNECTED_ITEM::GetNetname(), MODULE::GetOrientationDegrees(), GetOrientationDegrees(), GetPadToDieLength(), MODULE::GetReference(), LayerMaskDescribe(), LIGHTBLUE, m_Drill, m_layerMask, m_name, EDA_ITEM::m_Parent, m_Pos, m_Size, MessageTextFromValue(), PAD_DRILL_SHAPE_CIRCLE, RED, ShowPadAttr(), ShowPadShape(), and UnescapeString().

◆ GetName()

◆ GetNet()

NETINFO_ITEM* BOARD_CONNECTED_ITEM::GetNet ( ) const
inlineinherited

Function GetNet Returns NET_INFO object for a given item.

Definition at line 85 of file board_connected_item.h.

86  {
87  return m_netinfo;
88  }
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 93 of file board_connected_item.cpp.

94 {
95  NETCLASSPTR netclass = m_netinfo->GetNetClass();
96 
97  if( netclass )
98  return netclass;
99  else
100  return GetBoard()->GetDesignSettings().GetDefault();
101 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:540
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 104 of file board_connected_item.cpp.

105 {
106  return m_netinfo->GetClassName();
107 }
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 104 of file board_connected_item.h.

105  {
106  return m_netinfo->GetNet();
107  }
int GetNet() const
Function GetNet.
Definition: netinfo.h:225
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(), TRACK::GetEndNetCode(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), TRACK::GetStartNetCode(), 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(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), BOARD::SetAreasNetCodesFromNetNames(), setupDummyPadForHole(), PNS_KICAD_IFACE::syncPad(), PNS_KICAD_IFACE::syncTrack(), PNS_KICAD_IFACE::syncVia(), BOARD::TestAreaIntersections(), DRC::testZones(), DRC::TestZoneToZoneOutline(), BOARD::TracksInNet(), NETINFO_MAPPING::Update(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), ZONE_CONTAINER::ZONE_CONTAINER(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ GetNetname()

const wxString& BOARD_CONNECTED_ITEM::GetNetname ( ) const
inlineinherited

Function GetNetname.

Returns
wxString - the full netname

Definition at line 123 of file board_connected_item.h.

124  {
125  return m_netinfo->GetNetname();
126  }
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:233
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 133 of file board_connected_item.h.

134  {
135  if( !GetBoard() )
136  return wxT( "[** NO BOARD DEFINED **]" );
137 
138  wxString netname = GetNetname();
139 
140  if( !netname.length() )
141  return wxT( "[<no net>]" );
142  else if( GetNetCode() < 0 )
143  return wxT( "[" + UnescapeString( netname ) + "](" + _( "Not Found" ) + ")" );
144  else
145  return wxT( "[" + UnescapeString( netname ) + "]" );
146  }
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)
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:123

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 98 of file class_board_item.cpp.

99 {
100  if( aSeq.empty() )
101  return 1;
102 
103  // By default go to the end of the sequence
104  int candidate = *aSeq.rbegin();
105 
106  // Filling in gaps in pad numbering
107  if( aFillSequenceGaps )
108  {
109  // start at the beginning
110  candidate = *aSeq.begin();
111 
112  for( auto it : aSeq )
113  {
114  if( it - candidate > 1 )
115  break;
116 
117  candidate = it;
118  }
119  }
120 
121  ++candidate;
122 
123  return candidate;
124 }

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

827 {
828  // calculates the start point, end point and width
829  // of an equivalent segment which have the same position and width as the hole
830  int delta_cx, delta_cy;
831 
832  wxSize halfsize = GetDrillSize();
833  halfsize.x /= 2;
834  halfsize.y /= 2;
835 
836  if( m_Drill.x > m_Drill.y ) // horizontal
837  {
838  delta_cx = halfsize.x - halfsize.y;
839  delta_cy = 0;
840  aWidth = m_Drill.y;
841  }
842  else // vertical
843  {
844  delta_cx = 0;
845  delta_cy = halfsize.y - halfsize.x;
846  aWidth = m_Drill.x;
847  }
848 
849  RotatePoint( &delta_cx, &delta_cy, m_Orient );
850 
851  aStartPoint.x = delta_cx;
852  aStartPoint.y = delta_cy;
853 
854  aEndPoint.x = - delta_cx;
855  aEndPoint.y = - delta_cy;
856 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
const wxSize & GetDrillSize() const
Definition: class_pad.h:280
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:843
double m_Orient
in 1/10 degrees
Definition: class_pad.h:887

References GetDrillSize(), m_Drill, m_Orient, and RotatePoint().

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

◆ GetOffset()

const wxPoint& D_PAD::GetOffset ( ) const
inline

Definition at line 283 of file class_pad.h.

283 { return m_Offset; }
wxPoint m_Offset
m_Offset is useful only for oblong and rect pads (it can be used for other shapes,...
Definition: class_pad.h:874

References m_Offset.

Referenced by CreatePadsShapesSection(), PCB_IO::format(), hash_eda(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::initValues(), DSN::SPECCTRA_DB::makePADSTACK(), mirrorPadX(), DIALOG_PAD_PROPERTIES::padValuesOK(), PNS_KICAD_IFACE::syncPad(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ GetOrientation()

◆ GetOrientationDegrees()

double D_PAD::GetOrientationDegrees ( ) const
inline

Definition at line 397 of file class_pad.h.

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

References m_Orient.

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

◆ GetOrientationRadians()

double D_PAD::GetOrientationRadians ( ) const
inline

Definition at line 398 of file class_pad.h.

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

References m_Orient.

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

◆ GetPadToDieLength()

int D_PAD::GetPadToDieLength ( ) const
inline

Definition at line 426 of file class_pad.h.

426 { return m_LengthPadToDie; }
int m_LengthPadToDie
Length net from pad to die, inside the package.
Definition: class_pad.h:889

References m_LengthPadToDie.

Referenced by DIALOG_SELECT_NET_FROM_LIST::buildNetsList(), PCB_IO::format(), GetMsgPanelInfo(), DIALOG_PAD_PROPERTIES::initValues(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ GetParent()

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

343 { 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:825

References m_basicShapes.

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

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

536  {
538  }
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:847
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:535

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

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

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

634  {
636  }
double m_padRoundRectRadiusScale
scaling factor from smallest m_Size coord to corner radius, default 0.25
Definition: class_pad.h:851

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

1271 {
1272  if( GetName().IsEmpty() )
1273  {
1274  return wxString::Format( _( "Pad of %s on %s" ),
1275  GetParent()->GetReference(),
1277  }
1278  else
1279  {
1280  return wxString::Format( _( "Pad %s of %s on %s" ),
1281  GetName(),
1282  GetParent()->GetReference(),
1284  }
1285 }
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:195
#define _(s)
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:876
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
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:1434

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

221 { 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:817

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(), 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::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 152 of file board_connected_item.h.

153  {
154  return m_netinfo->GetShortNetname();
155  }
const wxString & GetShortNetname() const
Function GetShortNetname.
Definition: netinfo.h:239
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:676
int m_LocalSolderMaskMargin
Local mask margins: when 0, the parent footprint design values are used.
Definition: class_pad.h:898
int m_SolderMaskMargin
Solder mask margin.
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:847
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:540
int GetLocalSolderMaskMargin() const
Definition: class_module.h:209
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:876
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
#define min(a, b)
Definition: auxiliary.h:85

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

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:676
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
int m_LocalSolderPasteMargin
Local solder paste margin absolute value.
Definition: class_pad.h:899
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:847
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:215
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:876
double GetLocalSolderPasteMarginRatio() const
Definition: class_module.h:218
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:901

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

237  {
238  return m_Status & type;
239  }
STATUS_FLAGS m_Status
Definition: base_struct.h:160

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

249 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:160

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

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

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:907
MODULE * GetParent() const
Definition: class_pad.h:167
int GetThermalGap() const
Definition: class_module.h:228

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:906
MODULE * GetParent() const
Definition: class_pad.h:167
int GetThermalWidth() const
Definition: class_module.h:225

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().

◆ GetTimeStamp()

◆ GetZoneConnection()

ZoneConnection D_PAD::GetZoneConnection ( ) const

Definition at line 725 of file class_pad.cpp.

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

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

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

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

860 {
861  int dx, dy;
862 
863  wxPoint shape_pos = ShapePos();
864 
865  wxPoint delta = aPosition - shape_pos;
866 
867  // first test: a test point must be inside a minimum sized bounding circle.
868  int radius = GetBoundingRadius();
869 
870  if( ( abs( delta.x ) > radius ) || ( abs( delta.y ) > radius ) )
871  return false;
872 
873  dx = m_Size.x >> 1; // dx also is the radius for rounded pads
874  dy = m_Size.y >> 1;
875 
876  switch( GetShape() )
877  {
878  case PAD_SHAPE_CIRCLE:
879  if( KiROUND( EuclideanNorm( delta ) ) <= dx )
880  return true;
881 
882  break;
883 
884  case PAD_SHAPE_TRAPEZOID:
885  {
886  wxPoint poly[4];
887  BuildPadPolygon( poly, wxSize(0,0), 0 );
888  RotatePoint( &delta, -m_Orient );
889 
890  return TestPointInsidePolygon( poly, 4, delta );
891  }
892 
893  case PAD_SHAPE_OVAL:
894  {
895  RotatePoint( &delta, -m_Orient );
896  // An oval pad has the same shape as a segment with rounded ends
897  // After rotation, the test point is relative to an horizontal pad
898  int dist;
899  wxPoint offset;
900  if( dy > dx ) // shape is a vertical oval
901  {
902  offset.y = dy - dx;
903  dist = dx;
904  }
905  else //if( dy <= dx ) shape is an horizontal oval
906  {
907  offset.x = dy - dx;
908  dist = dy;
909  }
910  return TestSegmentHit( delta, - offset, offset, dist );
911  }
912  break;
913 
914  case PAD_SHAPE_RECT:
915  RotatePoint( &delta, -m_Orient );
916 
917  if( (abs( delta.x ) <= dx ) && (abs( delta.y ) <= dy) )
918  return true;
919 
920  break;
921 
923  case PAD_SHAPE_ROUNDRECT:
924  {
925  // Check for hit in polygon
926  SHAPE_POLY_SET outline;
927  bool doChamfer = GetShape() == PAD_SHAPE_CHAMFERED_RECT;
928  auto board = GetBoard();
929  int maxError = ARC_HIGH_DEF;
930 
931  if( board )
932  maxError = board->GetDesignSettings().m_MaxError;
933 
934  TransformRoundChamferedRectToPolygon( outline, wxPoint(0,0), GetSize(), m_Orient,
936  doChamfer ? GetChamferRectRatio() : 0.0,
937  doChamfer ? GetChamferPositions() : 0,
938  maxError );
939 
940  const SHAPE_LINE_CHAIN &poly = outline.COutline( 0 );
941  return TestPointInsidePolygon( (const wxPoint*)&poly.CPoint(0), poly.PointCount(), delta );
942  }
943  break;
944 
945  case PAD_SHAPE_CUSTOM:
946  // Check for hit in polygon
947  RotatePoint( &delta, -m_Orient );
948 
950  {
952  return TestPointInsidePolygon( (const wxPoint*)&poly.CPoint(0), poly.PointCount(), delta );
953  }
954  break;
955  }
956 
957  return false;
958 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:123
int OutlineCount() const
Returns the number of outlines in the set
static const int dist[10][10]
Definition: ar_matrix.cpp:320
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aApproxErrorMax, int aMinSegPerCircleCount)
convert a rectangle with rounded corners and/or chamfered corners to a polygon Convert rounded corner...
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:847
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
int PointCount() const
Function PointCount()
#define abs(a)
Definition: auxiliary.h:84
int GetChamferPositions() const
has meaning only for chamfered rect pads
Definition: class_pad.h:682
const VECTOR2I & CPoint(int aIndex) const
Function CPoint()
Class SHAPE_POLY_SET.
double GetChamferRectRatio() const
has meaning only for chamfered rect pads
Definition: class_pad.h:659
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:611
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:830
void BuildPadPolygon(wxPoint aCoord[4], wxSize aInflateValue, double aRotation) const
Function BuildPadPolygon Has meaning only for polygonal pads (trapezoid and rectangular) Build the Co...
Class SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
wxPoint ShapePos() const
Definition: class_pad.cpp:570
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:535
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221
double m_Orient
in 1/10 degrees
Definition: class_pad.h:887
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Function TestSegmentHit test for hit on line segment i.e.
Definition: trigo.cpp:126
const wxSize & GetSize() const
Definition: class_pad.h:274

References abs, 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(), and TransformRoundChamferedRectToPolygon().

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

962 {
963  EDA_RECT arect = aRect;
964  arect.Normalize();
965  arect.Inflate( aAccuracy );
966 
967  wxPoint shapePos = ShapePos();
968 
969  EDA_RECT shapeRect;
970 
971  int r;
972 
973  EDA_RECT bb = GetBoundingBox();
974 
975  wxPoint endCenter;
976  int radius;
977 
978  if( !arect.Intersects( bb ) )
979  return false;
980 
981  // This covers total containment for all test cases
982  if( arect.Contains( bb ) )
983  return true;
984 
985  switch( GetShape() )
986  {
987  case PAD_SHAPE_CIRCLE:
988  return arect.IntersectsCircle( GetPosition(), GetBoundingRadius() );
989 
990  case PAD_SHAPE_RECT:
991  case PAD_SHAPE_CHAMFERED_RECT: // TODO use a finer shape analysis
992  shapeRect.SetOrigin( shapePos );
993  shapeRect.Inflate( m_Size.x / 2, m_Size.y / 2 );
994  return arect.Intersects( shapeRect, m_Orient );
995 
996  case PAD_SHAPE_OVAL:
997  // Circlular test if dimensions are equal
998  if( m_Size.x == m_Size.y )
999  return arect.IntersectsCircle( shapePos, GetBoundingRadius() );
1000 
1001  shapeRect.SetOrigin( shapePos );
1002 
1003  // Horizontal dimension is greater
1004  if( m_Size.x > m_Size.y )
1005  {
1006  radius = m_Size.y / 2;
1007 
1008  shapeRect.Inflate( m_Size.x / 2 - radius, radius );
1009 
1010  endCenter = wxPoint( m_Size.x / 2 - radius, 0 );
1011  RotatePoint( &endCenter, m_Orient );
1012 
1013  // Test circular ends
1014  if( arect.IntersectsCircle( shapePos + endCenter, radius ) ||
1015  arect.IntersectsCircle( shapePos - endCenter, radius ) )
1016  {
1017  return true;
1018  }
1019  }
1020  else
1021  {
1022  radius = m_Size.x / 2;
1023 
1024  shapeRect.Inflate( radius, m_Size.y / 2 - radius );
1025 
1026  endCenter = wxPoint( 0, m_Size.y / 2 - radius );
1027  RotatePoint( &endCenter, m_Orient );
1028 
1029  // Test circular ends
1030  if( arect.IntersectsCircle( shapePos + endCenter, radius ) ||
1031  arect.IntersectsCircle( shapePos - endCenter, radius ) )
1032  {
1033  return true;
1034  }
1035  }
1036 
1037  // Test rectangular portion between rounded ends
1038  if( arect.Intersects( shapeRect, m_Orient ) )
1039  {
1040  return true;
1041  }
1042 
1043  break;
1044 
1045  case PAD_SHAPE_TRAPEZOID:
1046  /* Trapezoid intersection tests:
1047  * A) Any points of rect inside trapezoid
1048  * B) Any points of trapezoid inside rect
1049  * C) Any sides of trapezoid cross rect
1050  */
1051  {
1052 
1053  wxPoint poly[4];
1054  BuildPadPolygon( poly, wxSize( 0, 0 ), 0 );
1055 
1056  wxPoint corners[4];
1057 
1058  corners[0] = wxPoint( arect.GetLeft(), arect.GetTop() );
1059  corners[1] = wxPoint( arect.GetRight(), arect.GetTop() );
1060  corners[2] = wxPoint( arect.GetRight(), arect.GetBottom() );
1061  corners[3] = wxPoint( arect.GetLeft(), arect.GetBottom() );
1062 
1063  for( int i=0; i<4; i++ )
1064  {
1065  RotatePoint( &poly[i], m_Orient );
1066  poly[i] += shapePos;
1067  }
1068 
1069  for( int ii=0; ii<4; ii++ )
1070  {
1071  if( TestPointInsidePolygon( poly, 4, corners[ii] ) )
1072  {
1073  return true;
1074  }
1075 
1076  if( arect.Contains( poly[ii] ) )
1077  {
1078  return true;
1079  }
1080 
1081  if( arect.Intersects( poly[ii], poly[(ii+1) % 4] ) )
1082  {
1083  return true;
1084  }
1085  }
1086 
1087  return false;
1088  }
1089 
1090  case PAD_SHAPE_ROUNDRECT:
1091  /* RoundRect intersection can be broken up into simple tests:
1092  * a) Test intersection of horizontal rect
1093  * b) Test intersection of vertical rect
1094  * c) Test intersection of each corner
1095  */
1097 
1098  /* Test A - intersection of horizontal rect */
1099  shapeRect.SetSize( 0, 0 );
1100  shapeRect.SetOrigin( shapePos );
1101  shapeRect.Inflate( m_Size.x / 2, m_Size.y / 2 - r );
1102 
1103  // Short-circuit test for zero width or height
1104  if( shapeRect.GetWidth() > 0 && shapeRect.GetHeight() > 0 &&
1105  arect.Intersects( shapeRect, m_Orient ) )
1106  {
1107  return true;
1108  }
1109 
1110  /* Test B - intersection of vertical rect */
1111  shapeRect.SetSize( 0, 0 );
1112  shapeRect.SetOrigin( shapePos );
1113  shapeRect.Inflate( m_Size.x / 2 - r, m_Size.y / 2 );
1114 
1115  // Short-circuit test for zero width or height
1116  if( shapeRect.GetWidth() > 0 && shapeRect.GetHeight() > 0 &&
1117  arect.Intersects( shapeRect, m_Orient ) )
1118  {
1119  return true;
1120  }
1121 
1122  /* Test C - intersection of each corner */
1123 
1124  endCenter = wxPoint( m_Size.x / 2 - r, m_Size.y / 2 - r );
1125  RotatePoint( &endCenter, m_Orient );
1126 
1127  if( arect.IntersectsCircle( shapePos + endCenter, r ) ||
1128  arect.IntersectsCircle( shapePos - endCenter, r ) )
1129  {
1130  return true;
1131  }
1132 
1133  endCenter = wxPoint( m_Size.x / 2 - r, -m_Size.y / 2 + r );
1134  RotatePoint( &endCenter, m_Orient );
1135 
1136  if( arect.IntersectsCircle( shapePos + endCenter, r ) ||
1137  arect.IntersectsCircle( shapePos - endCenter, r ) )
1138  {
1139  return true;
1140  }
1141 
1142  break;
1143 
1144  default:
1145  break;
1146  }
1147 
1148  return false;
1149 }
int GetTop() const
Definition: eda_rect.h:121
int GetLeft() const
Definition: eda_rect.h:120
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:847
int GetWidth() const
Definition: eda_rect.h:117
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:124
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
bool Contains(const wxPoint &aPoint) const
Function Contains.
int GetBottom() const
Definition: eda_rect.h:122
int GetRight() const
Definition: eda_rect.h:119
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.h:611
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:118
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:126
size_t i
Definition: json11.cpp:597
wxPoint ShapePos() const
Definition: class_pad.cpp:570
Class 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:535
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221
double m_Orient
in 1/10 degrees
Definition: class_pad.h:887
const wxPoint GetPosition() const override
Definition: class_pad.h:225
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: class_pad.cpp:227
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(), i, 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 1467 of file class_pad.cpp.

1468 {
1469  SetShape( aMasterPad.GetShape() );
1470  SetLayerSet( aMasterPad.GetLayerSet() );
1471  SetAttribute( aMasterPad.GetAttribute() );
1472 
1473  // The pad orientation, for historical reasons is the
1474  // pad rotation + parent rotation.
1475  // So we have to manage this parent rotation
1476  double pad_rot = aMasterPad.GetOrientation();
1477 
1478  if( aMasterPad.GetParent() )
1479  pad_rot -= aMasterPad.GetParent()->GetOrientation();
1480 
1481  if( GetParent() )
1482  pad_rot += GetParent()->GetOrientation();
1483 
1484  SetOrientation( pad_rot );
1485 
1486  SetSize( aMasterPad.GetSize() );
1487  SetDelta( wxSize( 0, 0 ) );
1488  SetOffset( aMasterPad.GetOffset() );
1489  SetDrillSize( aMasterPad.GetDrillSize() );
1490  SetDrillShape( aMasterPad.GetDrillShape() );
1492  SetChamferRectRatio( aMasterPad.GetChamferRectRatio() );
1493  SetChamferPositions( aMasterPad.GetChamferPositions() );
1494 
1495  switch( aMasterPad.GetShape() )
1496  {
1497  case PAD_SHAPE_TRAPEZOID:
1498  SetDelta( aMasterPad.GetDelta() );
1499  break;
1500 
1501  case PAD_SHAPE_CIRCLE:
1502  // ensure size.y == size.x
1503  SetSize( wxSize( GetSize().x, GetSize().x ) );
1504  break;
1505 
1506  default:
1507  ;
1508  }
1509 
1510  switch( aMasterPad.GetAttribute() )
1511  {
1512  case PAD_ATTRIB_SMD:
1513  case PAD_ATTRIB_CONN:
1514  // These pads do not have hole (they are expected to be only on one
1515  // external copper layer)
1516  SetDrillSize( wxSize( 0, 0 ) );
1517  break;
1518 
1519  default:
1520  ;
1521  }
1522 
1523  // copy also local settings:
1524  SetLocalClearance( aMasterPad.GetLocalClearance() );
1528 
1529  SetZoneConnection( aMasterPad.GetZoneConnection() );
1530  SetThermalWidth( aMasterPad.GetThermalWidth() );
1531  SetThermalGap( aMasterPad.GetThermalGap() );
1532 
1533  // Add or remove custom pad shapes:
1534  SetPrimitives( aMasterPad.GetPrimitives() );
1535  SetAnchorPadShape( aMasterPad.GetAnchorPadShape() );
1537 }
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:428
double GetOrientation() const
Definition: class_module.h:193
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:231
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:62
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:279
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:645
int GetThermalGap() const
Definition: class_pad.cpp:747
int GetLocalClearance() const
Definition: class_pad.h:431
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:419
int GetChamferPositions() const
has meaning only for chamfered rect pads
Definition: class_pad.h:682
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:258
const std::vector< PAD_CS_PRIMITIVE > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:343
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
void SetZoneConnection(ZoneConnection aType)
Definition: class_pad.h:497
const wxPoint & GetOffset() const
Definition: class_pad.h:283
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:402
double GetChamferRectRatio() const
has meaning only for chamfered rect pads
Definition: class_pad.h:659
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:416
void SetThermalWidth(int aWidth)
Definition: class_pad.h:500
void SetSize(const wxSize &aSize)
Definition: class_pad.h:273
const wxSize & GetDelta() const
Definition: class_pad.h:277
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:421
void SetLocalClearance(int aClearance)
Definition: class_pad.h:432
MODULE * GetParent() const
Definition: class_pad.h:167
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:438
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:415
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:400
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:429
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:396
const wxSize & GetDrillSize() const
Definition: class_pad.h:280
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:222
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:430
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:633
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:670
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:435
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:725
const wxSize & GetSize() const
Definition: class_pad.h:274
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:434
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:282
void SetThermalGap(int aGap)
Definition: class_pad.h:503
bool SetPrimitives(const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
Import to the basic shape list.
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:437
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:276
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:690

References GetAnchorPadShape(), GetAttribute(), GetChamferPositions(), GetChamferRectRatio(), GetDelta(), GetDrillShape(), GetDrillSize(), GetLayerSet(), GetLocalClearance(), GetLocalSolderMaskMargin(), GetLocalSolderPasteMargin(), GetLocalSolderPasteMarginRatio(), GetOffset(), MODULE::GetOrientation(), GetOrientation(), GetParent(), GetPrimitives(), 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(), 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:419
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::Duplicate(), and MODULE_EDITOR_TOOLS::PlacePad().

◆ IsAperturePad()

bool D_PAD::IsAperturePad ( ) const
inline

Definition at line 423 of file class_pad.h.

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

References LSET::AllCuMask(), and m_layerMask.

Referenced by MODULE::Duplicate(), 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 76 of file board_connected_item.h.

77  {
78  return true;
79  }

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 218 of file base_struct.h.

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

References IS_DRAGGED, and EDA_ITEM::m_Flags.

Referenced by DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), KIGFX::SCH_PAINTER::setColors(), 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 137 of file class_pad.cpp.

138 {
139  if( GetParent() && GetParent()->GetLayer() == B_Cu )
140  return true;
141  return false;
142 }
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 222 of file base_struct.h.

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

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

Referenced by KIGFX::PCB_RENDER_SETTINGS::GetColor(), and KIGFX::SCH_PAINTER::getRenderColor().

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

193  {
194  // only MODULEs & TRACKs can be locked at this time.
195  return false;
196  }

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 216 of file base_struct.h.

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

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

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

705  {
706  return m_layerMask[aLayer];
707  }
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:876

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_FIELD, SCH_SHEET_PIN, and SCH_TEXT.

Definition at line 523 of file base_struct.h.

523 { return false; }

Referenced by EDA_ITEM::Matches(), and EDA_ITEM::Replace().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

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

References IS_RESIZED, and EDA_ITEM::m_Flags.

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

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

184  {
185  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
186  }
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
KICAD_T Type() const
Function Type()
Definition: base_struct.h:197

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

◆ IsType()

virtual bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[])
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 280 of file base_struct.h.

281  {
282  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
283  return true;
284 
285  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
286  {
287  if( m_StructType == *p )
288  return true;
289  }
290 
291  return false;
292  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:159
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_SCREEN::GetItem(), 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(), PL_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 219 of file base_struct.h.

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

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward() [1/2]

static SEARCH_RESULT EDA_ITEM::IterateForward ( EDA_ITEM listStart,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes.

Parameters
listStartThe first in a list of EDA_ITEMs to iterate over.
inspectorIs an INSPECTOR to call on each object that is one of the requested scanTypes.
testDataIs an aid to testFunc, and should be sufficient to allow it to fully determine if an item meets the match criteria, but it may also be used to collect output.
scanTypesA KICAD_T array that is EOT terminated, and provides both the order and interest level of of the types of objects to be iterated over.
Returns
SEARCH_RESULT SEARCH_QUIT if the called INSPECTOR returned SEARCH_QUIT, else SCAN_CONTINUE;

Definition at line 404 of file base_struct.h.

409  {
410  for( EDA_ITEM* p = listStart; p; p = p->Pnext )
411  {
412  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
413  return SEARCH_QUIT;
414  }
415 
416  return SEARCH_CONTINUE;
417  }
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:150
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:163

References EDA_ITEM::Pnext, SEARCH_CONTINUE, and SEARCH_QUIT.

Referenced by EE_COLLECTOR::Collect(), EE_TYPE_COLLECTOR::Collect(), nextMatch(), EE_SELECTION_TOOL::RebuildSelection(), SCH_EDITOR_CONTROL::UpdateFind(), GERBER_FILE_IMAGE::Visit(), and BOARD::Visit().

◆ IterateForward() [2/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 425 of file base_struct.h.

429  {
430  for( auto it : aList )
431  {
432  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes ) == SEARCH_QUIT )
433  return SEARCH_QUIT;
434  }
435 
436  return SEARCH_CONTINUE;
437  }
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 SEARCH_CONTINUE, SEARCH_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_FIELD, SCH_SHEET_PIN, SCH_TEXT, LIB_PIN, SCH_PIN, and SCH_MARKER.

Definition at line 479 of file base_struct.h.

480  {
481  return false;
482  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), SCH_MARKER::Matches(), LIB_PIN::Matches(), SCH_TEXT::Matches(), SCH_SHEET_PIN::Matches(), SCH_FIELD::Matches(), SCH_SHEET::Matches(), nextMatch(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

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

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 160 of file base_struct.cpp.

161 {
162  wxString text = aText;
163  wxString searchText = aSearchData.GetFindString();
164 
165  // Don't match if searching for replaceable item and the item doesn't support text replace.
166  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
167  return false;
168 
169  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
170  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
171 
172  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
173  {
174  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
175  return text.Matches( searchText );
176 
177  return text.MakeUpper().Matches( searchText.MakeUpper() );
178  }
179 
180  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
181  return aText.Find( searchText ) != wxNOT_FOUND;
182 
183  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
184 }
Perform search using simple wild card matching (* & ?).
Perform a search for a item that has replaceable text.
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:523

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

◆ MergePrimitivesAsPolygon()

bool D_PAD::MergePrimitivesAsPolygon ( SHAPE_POLY_SET aMergedPolygon = NULL)

Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.

Returns
true if OK, false in there is more than one polygon in m_customShapeAsPolygon
Parameters
aMergedPolygon= the SHAPE_POLY_SET to fill. if NULL, m_customShapeAsPolygon is the target
aCircleToSegmentsCount= number of segment to approximate a circle (default = 32) Note: The corners coordinates are relative to the pad position, orientation 0,

Definition at line 342 of file pad_custom_shape_functions.cpp.

343 {
344  auto board = GetBoard();
345  int maxError = ARC_HIGH_DEF;
346 
347  if( board )
348  maxError = board->GetDesignSettings().m_MaxError;
349 
350  // if aMergedPolygon == NULL, use m_customShapeAsPolygon as target
351 
352  if( !aMergedPolygon )
353  aMergedPolygon = &m_customShapeAsPolygon;
354 
355  aMergedPolygon->RemoveAllContours();
356 
357  // Add the anchor pad shape in aMergedPolygon, others in aux_polyset:
358  // The anchor pad is always at 0,0
359  switch( GetAnchorPadShape() )
360  {
361  default:
362  case PAD_SHAPE_CIRCLE:
363  TransformCircleToPolygon( *aMergedPolygon, wxPoint( 0, 0 ), GetSize().x / 2, maxError );
364  break;
365 
366  case PAD_SHAPE_RECT:
367  {
368  SHAPE_RECT rect( -GetSize().x / 2, -GetSize().y / 2, GetSize().x, GetSize().y );
369  aMergedPolygon->AddOutline( rect.Outline() );
370 
371  break;
372  }
373  }
374 
375  if( !buildCustomPadPolygon( aMergedPolygon, maxError ) )
376  return false;
377 
378  m_boundingRadius = -1; // The current bouding radius is no more valid.
379 
380  return aMergedPolygon->OutlineCount() <= 1;
381 }
int m_boundingRadius
radius of the circle containing the pad shape
Definition: class_pad.h:810
int OutlineCount() const
Returns the number of outlines in the set
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aBuffer, wxPoint aCenter, int aRadius, int aError)
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:231
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
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:830
bool buildCustomPadPolygon(SHAPE_POLY_SET *aMergedPolygon, int aError)
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
const wxSize & GetSize() const
Definition: class_pad.h:274

References SHAPE_POLY_SET::AddOutline(), buildCustomPadPolygon(), GetAnchorPadShape(), BOARD_ITEM::GetBoard(), GetSize(), m_boundingRadius, m_customShapeAsPolygon, SHAPE_RECT::Outline(), SHAPE_POLY_SET::OutlineCount(), PAD_SHAPE_CIRCLE, PAD_SHAPE_RECT, SHAPE_POLY_SET::RemoveAllContours(), and TransformCircleToPolygon().

Referenced by AddPrimitive(), AddPrimitives(), export_vrml_padshape(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::padValuesOK(), BRDITEMS_PLOTTER::PlotPad(), and SetPrimitives().

◆ MirrorXPrimitives()

void D_PAD::MirrorXPrimitives ( int  aX)

Mirror the primitives about a coordinate.

Parameters
aXthe x coordinate about which to mirror

Definition at line 504 of file class_pad.cpp.

505 {
506  // Mirror custom shapes
507  for( unsigned ii = 0; ii < m_basicShapes.size(); ++ii )
508  {
509  PAD_CS_PRIMITIVE& primitive = m_basicShapes[ii];
510 
511  MIRROR( primitive.m_Start.x, aX );
512  MIRROR( primitive.m_End.x, aX );
513  primitive.m_ArcAngle = -primitive.m_ArcAngle;
514 
515  switch( primitive.m_Shape )
516  {
517  case S_POLYGON: // polygon
518  for( unsigned jj = 0; jj < primitive.m_Poly.size(); jj++ )
519  MIRROR( primitive.m_Poly[jj].x, 0 );
520  break;
521 
522  default:
523  break;
524  }
525  }
526 
527  // Mirror the local coordinates in merged Polygon
528  for( int cnt = 0; cnt < m_customShapeAsPolygon.OutlineCount(); ++cnt )
529  {
531 
532  for( int ii = 0; ii < poly.PointCount(); ++ii )
533  MIRROR( poly.Point( ii ).x, 0 );
534  }
535 }
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:825
int OutlineCount() const
Returns the number of outlines in the set
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)
int PointCount() const
Function PointCount()
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
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
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:830
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
Class SHAPE_LINE_CHAIN.
VECTOR2I & Point(int aIndex)
Function Point()
double m_ArcAngle
radius of a circle
Definition: class_pad.h:97

References PAD_CS_PRIMITIVE::m_ArcAngle, m_basicShapes, m_customShapeAsPolygon, PAD_CS_PRIMITI