KiCad PCB EDA Suite
D_PAD Class Reference

#include <class_pad.h>

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

Public Member Functions

 D_PAD (MODULE *parent)
 
MODULEGetParent () const
 
void ImportSettingsFrom (const D_PAD &aMasterPad)
 Imports the pad settings from aMasterPad. More...
 
bool IsFlipped () const
 
void SetName (const wxString &aName)
 Set the pad name (sometimes called pad number, although it can be an array reference like AA12). More...
 
void SetPinFunction (const wxString &aName)
 Set the pad function (pin name in schematic) More...
 
const wxString & GetName () const
 
const wxString & GetPinFunction () const
 
bool IncrementPadName (bool aSkipUnconnectable, bool aFillSequenceGaps)
 Function IncrementPadName. More...
 
bool PadNameEqual (const D_PAD *other) const
 
PAD_SHAPE_T GetShape () const
 Function GetShape. More...
 
void SetShape (PAD_SHAPE_T aShape)
 
void SetPosition (const wxPoint &aPos) override
 
const wxPoint GetPosition () const override
 
PAD_SHAPE_T GetAnchorPadShape () const
 Function GetAnchorPadShape. More...
 
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt () const
 
void SetCustomShapeInZoneOpt (CUST_PAD_SHAPE_IN_ZONE aOption)
 Set the option for the custom pad shape to use as clearance area in copper zones. More...
 
void SetAnchorPadShape (PAD_SHAPE_T aShape)
 Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads. More...
 
bool IsOnCopperLayer () const override
 
void SetY (int y)
 
void SetX (int x)
 
void SetPos0 (const wxPoint &aPos)
 
const wxPointGetPos0 () const
 
void SetY0 (int y)
 
void SetX0 (int x)
 
void SetSize (const wxSize &aSize)
 
const wxSize & GetSize () const
 
void SetDelta (const wxSize &aSize)
 
const wxSize & GetDelta () const
 
void SetDrillSize (const wxSize &aSize)
 
const wxSize & GetDrillSize () const
 
void SetOffset (const wxPoint &aOffset)
 
const wxPointGetOffset () const
 
void 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
 
void SetProperty (PAD_PROP_T aProperty)
 
PAD_PROP_T GetProperty () const
 
bool IsAperturePad () const
 
void SetPadToDieLength (int aLength)
 
int GetPadToDieLength () const
 
int GetLocalSolderMaskMargin () const
 
void SetLocalSolderMaskMargin (int aMargin)
 
int GetLocalClearance () const
 
void SetLocalClearance (int aClearance)
 
int GetLocalSolderPasteMargin () const
 
void SetLocalSolderPasteMargin (int aMargin)
 
double GetLocalSolderPasteMarginRatio () const
 
void SetLocalSolderPasteMarginRatio (double aRatio)
 
void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aMaxError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
 Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments. More...
 
int GetClearance (BOARD_CONNECTED_ITEM *aItem=NULL) const override
 Function GetClearance returns the clearance in internal units. More...
 
int GetSolderMaskMargin () const
 Function GetSolderMaskMargin. More...
 
wxSize GetSolderPasteMargin () const
 Function GetSolderPasteMargin. More...
 
void SetZoneConnection (ZONE_CONNECTION aType)
 
ZONE_CONNECTION GetZoneConnection () const
 
ZONE_CONNECTION GetLocalZoneConnection () const
 
void SetThermalWidth (int aWidth)
 
int GetThermalWidth () const
 
void SetThermalGap (int aGap)
 
int GetThermalGap () const
 
void Print (PCB_BASE_FRAME *aFrame, wxDC *aDC, const wxPoint &aOffset=ZeroOffset) override
 Function Print BOARD_ITEMs have their own color information. More...
 
void PrintShape (wxDC *aDC, PAD_DRAWINFO &aDrawInfo)
 Function PrintShape basic function to print a pad. More...
 
void BuildPadPolygon (wxPoint aCoord[4], wxSize aInflateValue, double aRotation) const
 Function BuildPadPolygon Has meaning only for polygonal pads (trapezoid and rectangular) Build the Corner list of the polygonal shape, depending on shape, extra size (clearance ...) and orientation. More...
 
int GetRoundRectCornerRadius () const
 Function GetRoundRectCornerRadius Has meaning only for rounded rect pads. More...
 
int GetRoundRectCornerRadius (const wxSize &aSize) const
 Helper function GetRoundRectCornerRadius Has meaning only for rounded rect pads Returns the radius of the rounded corners of a rectangle size aSize, using others setting of the pad. More...
 
void SetRoundRectCornerRadius (double aRadius)
 Set the rounded rectangle radius ratio based on a given radius. More...
 
void BuildPadShapePolygon (SHAPE_POLY_SET &aCornerBuffer, wxSize aInflateValue, int aError=ARC_HIGH_DEF) const
 Function BuildPadShapePolygon Build the Corner list of the polygonal shape, depending on shape, extra size (clearance ...) pad and orientation This function is similar to TransformShapeWithClearanceToPolygon, but the difference is BuildPadShapePolygon creates a polygon shape exactly similar to pad shape, which a size inflated by aInflateValue and TransformShapeWithClearanceToPolygon creates a more complex shape (for instance a rectangular pad is converted in a rectangulr shape with ronded corners) More...
 
bool BuildPadDrillShapePolygon (SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, int aError=ARC_HIGH_DEF) const
 Function BuildPadDrillShapePolygon Build the Corner list of the polygonal drill shape, depending on shape pad hole and orientation. More...
 
int BuildSegmentFromOvalShape (wxPoint &aSegStart, wxPoint &aSegEnd, double aRotation, const wxSize &aMargin) const
 Function BuildSegmentFromOvalShape Has meaning only for OVAL (and ROUND) pads Build an equivalent segment having the same shape as the OVAL shape, Useful in draw function and in DRC and HitTest functions, because segments are already well handled by track tests. More...
 
int GetBoundingRadius () const
 Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad. More...
 
wxPoint ShapePos () const
 
double GetRoundRectRadiusRatio () const
 has meaning only for rounded rect pads More...
 
void SetRoundRectRadiusRatio (double aRadiusScale)
 has meaning only for rounded rect pads Set the scaling factor between the smaller Y or Y size and the radius of the rounded corners. More...
 
double GetChamferRectRatio () const
 has meaning only for chamfered rect pads More...
 
void SetChamferRectRatio (double aChamferScale)
 has meaning only for chamfered rect pads Set the ratio between the smaller Y or Y size and the radius of the rounded corners. More...
 
int GetChamferPositions () const
 has meaning only for chamfered rect pads More...
 
void SetChamferPositions (int aChamferPositions)
 has meaning only for chamfered rect pads set the position of the chamfer for a 0 orientation, one of RECT_CHAMFER_TOP_LEFT, RECT_CHAMFER_TOP_RIGHT, RECT_CHAMFER_BOTTOM_LEFT, RECT_CHAMFER_BOTTOM_RIGHT More...
 
int GetSubRatsnest () const
 Function GetSubRatsnest. More...
 
void SetSubRatsnest (int aSubRatsnest)
 
void GetMsgPanelInfo (EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
bool IsOnLayer (PCB_LAYER_ID aLayer) const override
 Function IsOnLayer tests to see if this object is on the given layer. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Function HitTest tests if aPosition is contained within or on the bounding box of an item. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes. More...
 
void SetDrawCoord ()
 

Set absolute coordinates.

More...
 
void SetLocalCoord ()
 

Set relative coordinates.

More...
 
void Move (const wxPoint &aMoveVector) override
 Function Move move this object. More...
 
void Rotate (const wxPoint &aRotCentre, double aAngle) override
 Function Rotate Rotate this object. More...
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAP_DEF GetMenuImage () const override
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
wxString ShowPadShape () const
 Function ShowPadShape. More...
 
wxString ShowPadAttr () const
 Function ShowPadAttr. More...
 
void AppendConfigs (std::vector< PARAM_CFG * > *aResult)
 Function AppendConfigs appends to aResult the configuration setting accessors which will later allow reading or writing of configuration file information directly into this object. More...
 
EDA_ITEMClone () const override
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
D_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)
 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...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after removing from its parent if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
virtual BOARDGetBoard () const
 Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
wxString GetLayerName () const
 Function GetLayerName returns the name of the PCB layer on which the item resides. More...
 
KICAD_T Type () const
 Function Type() More...
 
void SetTimeStamp (timestamp_t aNewTimeStamp)
 
timestamp_t GetTimeStamp () const
 
void SetParent (EDA_ITEM *aParent)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag)
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
virtual SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 

Static Public Member Functions

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

Static Public Attributes

static int m_PadSketchModePenSize = 0
 Pen size used to draw pads in sketch mode (mode used to print pads on silkscreen layer) More...
 
static wxPoint ZeroOffset
 A value of wxPoint(0,0) which can be passed to the Draw() functions. More...
 

Protected Member Functions

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

Static Protected Member Functions

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

Protected Attributes

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

Detailed Description

Definition at line 140 of file class_pad.h.

Constructor & Destructor Documentation

◆ D_PAD()

D_PAD::D_PAD ( MODULE parent)

Definition at line 60 of file class_pad.cpp.

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

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

Referenced by Clone().

Member Function Documentation

◆ 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.emplace_back( iter->x, iter->y );
145 
146  AddPrimitive( points, aThickness );
147 }
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:865
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:865
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:865
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:865
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:865
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:865
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 132 of file class_pad.cpp.

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

References F_Paste.

Referenced by PAD_FIXTURE::MakeAperture().

◆ AppendConfigs()

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

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

Definition at line 538 of file class_pad.cpp.

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

References m_Drill, m_Size, and NULL.

◆ boundingRadius()

int D_PAD::boundingRadius ( ) const
private

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

Definition at line 146 of file class_pad.cpp.

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

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

Referenced by GetBoundingRadius().

◆ buildCustomPadPolygon()

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

Definition at line 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:865
int OutlineCount() const
Returns the number of outlines in the set
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset union For aFastMode meaning, see function booleanOp
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:98
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
void TransformArcToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, wxPoint aStart, double aArcAngle, int aError, int aWidth)
Function TransformArcToPolygon Creates a polygon from an Arc Convert arcs to multiple straight segmen...
void Inflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Performs outline inflation/deflation.
wxPoint m_Ctrl1
is also the start point of the arc
Definition: class_pad.h:100
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:96
std::vector< wxPoint > m_Poly
Bezier Control point 2.
Definition: class_pad.h:102
SHAPE_POLY_SET.
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
Bezier Curve.
wxPoint m_End
is also the center of the circle and arc
Definition: class_pad.h:99
int NewOutline()
Creates a new empty polygon in the set and returns its index
STROKE_T m_Shape
Definition: class_pad.h:92
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
wxPoint m_Ctrl2
Bezier Control point 1.
Definition: class_pad.h:101
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:93
Bezier curves to polygon converter.
Definition: bezier_curves.h:35
void TransformCircleToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCenter, int aRadius, int aError)
Function TransformCircleToPolygon convert a circle to a polygon, using multiple straight lines.
void TransformSegmentToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aError, int aWidth)
Function TransformRoundedEndsSegmentToPolygon convert a segment with rounded ends to a polygon Conver...
void TransformRingToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, int aRadius, int aError, int aWidth)
Function TransformRingToPolygon Creates a polygon from a ring Convert arcs to multiple straight segme...
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)
double m_ArcAngle
radius of a circle
Definition: class_pad.h:97
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::Fracture(), GetArcToSegmentCount(), BEZIER_POLY::GetPoly(), SHAPE_POLY_SET::Inflate(), PAD_CS_PRIMITIVE::m_ArcAngle, m_basicShapes, PAD_CS_PRIMITIVE::m_Ctrl1, PAD_CS_PRIMITIVE::m_Ctrl2, PAD_CS_PRIMITIVE::m_End, PAD_CS_PRIMITIVE::m_Poly, PAD_CS_PRIMITIVE::m_Radius, PAD_CS_PRIMITIVE::m_Shape, PAD_CS_PRIMITIVE::m_Start, PAD_CS_PRIMITIVE::m_Thickness, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::PM_FAST, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_SEGMENT, SHAPE_POLY_SET::Simplify(), TransformArcToPolygon(), TransformCircleToPolygon(), TransformRingToPolygon(), and TransformSegmentToPolygon().

Referenced by GetBestAnchorPosition(), and MergePrimitivesAsPolygon().

◆ BuildPadDrillShapePolygon()

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

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

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

Definition at line 733 of file board_items_to_polygon_shape_transform.cpp.

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

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

◆ BuildPadPolygon()

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

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

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

Definition at line 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 }
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:887
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:920
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:61
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237

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

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

◆ BuildPadShapePolygon()

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

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

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

Definition at line 680 of file board_items_to_polygon_shape_transform.cpp.

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

References SHAPE_POLY_SET::Append(), BuildPadPolygon(), dummy(), GetShape(), GetSize(), m_Orient, SHAPE_POLY_SET::NewOutline(), PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, ShapePos(), and TransformShapeWithClearanceToPolygon().

Referenced by CINFO3D_VISU::buildPadShapeThickOutlineAsSegments(), CN_ITEM::GetAnchor(), and PNS_KICAD_IFACE::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:887
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208

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

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

References PCB_PAD_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 235 of file base_struct.h.

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

References BRIGHTENED, and EDA_ITEM::ClearFlags().

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

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 256 of file base_struct.h.

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

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_COMPONENT::ClearAllHighlightFlags(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearHighlighted(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), MWAVE::CreateMicrowaveInductor(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), KIGFX::SCH_VIEW::HighlightItem(), MODULE_EDITOR_TOOLS::ImportFootprint(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceModule(), LIB_PIN_TOOL::PlacePin(), DRAWING_TOOL::PlaceText(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::RollbackPartFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_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 234 of file base_struct.h.

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

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 268 of file base_struct.h.

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

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 153 of file view_item.h.

154  {
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161
#define NULL

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

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

◆ Clone()

EDA_ITEM * D_PAD::Clone ( ) const
overridevirtual

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

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

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Definition at line 1315 of file class_pad.cpp.

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

References D_PAD().

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

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

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

Referenced by CreatePadsShapesSection().

◆ ConnSMDMask()

LSET D_PAD::ConnSMDMask ( )
static

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

Definition at line 118 of file class_pad.cpp.

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

References F_Cu, and F_Mask.

◆ CustomShapeAsPolygonToBoardPosition()

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

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

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

Definition at line 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  aMergedPolygon->Rotate( -DECIDEG2RAD( aRotation ) );
392  aMergedPolygon->Move( VECTOR2I( aPosition ) );
393 }
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 })
Function Rotate rotates all vertices by a given angle.
int OutlineCount() const
Returns the number of outlines in the set
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void Move(const VECTOR2I &aVector) override
double DECIDEG2RAD(double deg)
Definition: trigo.h:214

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

Referenced by ZONE_FILLER::addKnockout(), CINFO3D_VISU::buildPadShapePolygon(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), CINFO3D_VISU::createNewPadWithClearance(), GetBoundingBox(), BRDITEMS_PLOTTER::PlotPad(), PrintShape(), PNS_KICAD_IFACE::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:865
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:870
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.

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

Referenced by DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 117 of file class_board_item.cpp.

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

References BOARD_ITEM::GetParent().

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

◆ Duplicate()

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

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

References Clone().

◆ Flip() [1/2]

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

Definition at line 269 of file class_board_item.h.

270  {
271  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
272  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Function Flip Flip this object, i.e.

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

◆ Flip() [2/2]

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

Function Flip Flip this object, i.e.

change the board side for this object

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

Reimplemented from BOARD_ITEM.

Definition at line 445 of file class_pad.cpp.

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

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

◆ FlipPrimitives()

void D_PAD::FlipPrimitives ( )

Flip the basic shapes, in custom pads.

Definition at line 478 of file class_pad.cpp.

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

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

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

◆ GetAnchorPadShape()

PAD_SHAPE_T D_PAD::GetAnchorPadShape ( ) const
inline

Function GetAnchorPadShape.

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

Definition at line 247 of file class_pad.h.

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

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

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

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

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 54 of file class_board_item.cpp.

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

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

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

◆ GetBoundingBox()

const EDA_RECT D_PAD::GetBoundingBox ( ) const
overridevirtual

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

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

Reimplemented from EDA_ITEM.

Definition at line 229 of file class_pad.cpp.

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

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

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

◆ GetBoundingRadius()

int D_PAD::GetBoundingRadius ( ) const
inline

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

The center is the pad position

Definition at line 649 of file class_pad.h.

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

References boundingRadius(), and m_boundingRadius.

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

◆ GetCenter()

virtual const wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

Function GetCenter()

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

Returns
centre point of the item

Reimplemented in DRAWSEGMENT.

Definition at line 98 of file class_board_item.h.

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

References BOARD_ITEM::GetPosition().

Referenced by ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), and ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically().

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

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

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

698  {
699  return m_padChamferRectScale;
700  }
double m_padChamferRectScale
scaling factor from smallest m_Size coord to chamfer value, default 0.25
Definition: class_pad.h:893

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

751  {
752  return wxT( "PAD" );
753  }

◆ 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:936
int GetLocalClearance() const
Definition: class_pad.h:460
int GetLocalClearance() const
Definition: class_module.h:234
MODULE * GetParent() const
Definition: class_pad.h:167
virtual int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const
Function GetClearance returns the clearance in internal units.

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

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

◆ GetCustomShapeAsPolygon()

const SHAPE_POLY_SET& D_PAD::GetCustomShapeAsPolygon ( ) const
inline

Accessor to the custom shape as one polygon.

Definition at line 374 of file class_pad.h.

374 { 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:870

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

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

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

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

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

Referenced by SCH_EDIT_TOOL::ChangeShape(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editComponentFieldText(), SCH_EDITOR_CONTROL::EditWithLibEdit(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_EDIT_PIN::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), and SCH_EDIT_FRAME::TrimWire().

◆ GetFlags()

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Function GetLayer returns the primary layer this item is on.

Reimplemented in ZONE_CONTAINER.

Definition at line 131 of file class_board_item.h.

131 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by CN_LIST::Add(), CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), DIMENSION::AdjustDimensionDetails(), AR_AUTOPLACER::buildFpAreas(), CreateBoardSection(), MWAVE::CreateMicrowaveInductor(), CreateRoutesSection(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DRC::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::Exchange_Module(), export_vrml_drawsegment(), export_vrml_edge_module(), export_vrml_module(), export_vrml_pcbtext(), export_vrml_text_module(), TEXTE_PCB::Flip(), PCB_TARGET::Flip(), EDGE_MODULE::Flip(), TRACK::Flip(), TEXTE_MODULE::Flip(), DIMENSION::Flip(), DRAWSEGMENT::Flip(), MODULE::Flip(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::formatLayer(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), ZONE_CONTAINER::GetLayer(), AR_AUTOPLACER::getOptimalModulePlacement(), BOARD::GetPad(), TEXT_MOD_GRID_TABLE::GetValueAsLong(), SELECTION_TOOL::GuessSelectionCandidates(), idf_export_module(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), IsFlipped(), BOARD_ITEM::IsOnCopperLayer(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), EAGLE_PLUGIN::packagePad(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::Plot_Edges_Modules(), BRDITEMS_PLOTTER::PlotAllTextsModule(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotDrawSegment(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotTextePcb(), TEXTE_MODULE::Print(), DRAWSEGMENT::Print(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), SELECTION_TOOL::Selectable(), TEXT_MOD_GRID_TABLE::SetValueAsLong(), ShowClearance(), GLOBAL_EDIT_TOOL::swapBoardItem(), PNS_KICAD_IFACE::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(), TRACK::ViewGetLayers(), TEXTE_MODULE::ViewGetLayers(), TEXTE_MODULE::ViewGetLOD(), MODULE_ZONE_CONTAINER::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

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

Returns
wxString containing the layer name associated with this item.

Definition at line 68 of file class_board_item.cpp.

69 {
70  BOARD* board = GetBoard();
71 
72  if( board )
73  return board->GetLayerName( m_Layer );
74 
75  // If no parent, return standard name
77 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
PCB_LAYER_ID m_Layer
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:160
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:646

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

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

◆ GetLayerSet()

◆ GetLocalClearance()

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLocalSolderMaskMargin()

int D_PAD::GetLocalSolderMaskMargin ( ) const
inline

Definition at line 457 of file class_pad.h.

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

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

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

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 466 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:943

References m_LocalSolderPasteMarginRatio.

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

◆ GetLocalZoneConnection()

ZONE_CONNECTION D_PAD::GetLocalZoneConnection ( ) const
inline

Definition at line 533 of file class_pad.h.

534  {
535  return m_ZoneConnection;
536  }
ZONE_CONNECTION m_ZoneConnection
how the connection to zone is made: no connection, thermal relief ...
Definition: class_pad.h:946

References m_ZoneConnection.

Referenced by DIALOG_PAD_PROPERTIES::initValues().

◆ GetMenuImage()

BITMAP_DEF D_PAD::GetMenuImage ( ) const
overridevirtual

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

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

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 1309 of file class_pad.cpp.

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

References pad_xpm.

◆ GetMsgPanelInfo()

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 758 of file class_pad.cpp.

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

References _, BROWN, CYAN, DARKCYAN, DARKGREEN, BOARD_ITEM::GetBoard(), GetDrillShape(), BOARD_CONNECTED_ITEM::GetNetname(), MODULE::GetOrientationDegrees(), GetOrientationDegrees(), GetPadToDieLength(), GetPinFunction(), GetProperty(), MODULE::GetReference(), LayerMaskDescribe(), LIGHTBLUE, m_Drill, m_layerMask, m_name, EDA_ITEM::m_Parent, m_Pos, m_Size, MessageTextFromValue(), PAD_DRILL_SHAPE_CIRCLE, PAD_PROP_BGA, PAD_PROP_CASTELLATED, PAD_PROP_FIDUCIAL_GLBL, PAD_PROP_FIDUCIAL_LOCAL, PAD_PROP_HEATSINK, PAD_PROP_NONE, PAD_PROP_TESTPOINT, RED, ShowPadAttr(), ShowPadShape(), UnescapeString(), wxPoint::x, and wxPoint::y.

◆ GetName()

◆ GetNet()

NETINFO_ITEM* BOARD_CONNECTED_ITEM::GetNet ( ) const
inlineinherited

Function GetNet Returns NET_INFO object for a given item.

Definition at line 80 of file board_connected_item.h.

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

References BOARD_CONNECTED_ITEM::m_netinfo.

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

◆ GetNetClass()

NETCLASSPTR BOARD_CONNECTED_ITEM::GetNetClass ( ) const
inherited

Function GetNetClass returns the NETCLASS for this item.

Definition at line 96 of file board_connected_item.cpp.

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

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

Referenced by DRC::doTrackDrc(), ZONE_CONTAINER::GetClearance(), VIA::GetDrillValue(), TRACK::GetMsgPanelInfo(), ROUTER_TOOL::prepareInteractive(), and DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow().

◆ GetNetClassName()

wxString BOARD_CONNECTED_ITEM::GetNetClassName ( ) const
inherited

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

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

Returns
the Net Class name of this item

Definition at line 107 of file board_connected_item.cpp.

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

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

Referenced by DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ GetNetCode()

int BOARD_CONNECTED_ITEM::GetNetCode ( ) const
inlineinherited

Function GetNetCode.

Returns
int - the net code.

Definition at line 99 of file board_connected_item.h.

100  {
101  return m_netinfo ? m_netinfo->GetNet() : -1;
102  }
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(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), hash_eda(), hasThermalConnection(), DIALOG_PAD_PROPERTIES::initValues(), ZONE_CONTAINER::IsSame(), DSN::SPECCTRA_DB::makeIMAGE(), AR_AUTOPLACER::nearestPad(), CONNECTIVITY_DATA::NearestUnconnectedTargets(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), BOARD::NormalizeAreaPolygon(), BOARD::OnAreaPolygonModified(), ZONE_SETTINGS::operator<<(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), VIA::Print(), PrintShape(), process(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), SELECTION_TOOL::selectNet(), BOARD::SetAreasNetCodesFromNetNames(), setupDummyPadForHole(), PNS_KICAD_IFACE::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(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ GetNetname()

const wxString& BOARD_CONNECTED_ITEM::GetNetname ( ) const
inlineinherited

Function GetNetname.

Returns
wxString - the full netname

Definition at line 119 of file board_connected_item.h.

120  {
121  return m_netinfo->GetNetname();
122  }
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 129 of file board_connected_item.h.

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

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

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

◆ getNextNumberInSequence()

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

Definition at line 88 of file class_board_item.cpp.

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

Referenced by MODULE::GetNextPadName().

◆ GetOblongDrillGeometry()

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

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

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

Definition at line 846 of file class_pad.cpp.

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

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

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

◆ GetOffset()

const wxPoint& D_PAD::GetOffset ( ) const
inline

Definition at line 309 of file class_pad.h.

309 { 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:914

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

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

References m_Orient.

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

◆ GetOrientationRadians()

double D_PAD::GetOrientationRadians ( ) const
inline

Definition at line 424 of file class_pad.h.

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

References m_Orient.

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

◆ GetPadToDieLength()

int D_PAD::GetPadToDieLength ( ) const
inline

◆ GetParent()

◆ GetPinFunction()

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

Definition at line 211 of file class_pad.h.

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

References m_pinFunction.

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

◆ GetPos0()

const wxPoint& D_PAD::GetPos0 ( ) const
inline

◆ GetPosition()

◆ GetPrimitives()

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

Accessor to the basic shape list.

Definition at line 369 of file class_pad.h.

369 { 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:865

References m_basicShapes.

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

◆ GetProperty()

PAD_PROP_T D_PAD::GetProperty ( ) const
inline

Definition at line 448 of file class_pad.h.

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

References m_Property.

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

◆ GetRoundRectCornerRadius() [1/2]

int D_PAD::GetRoundRectCornerRadius ( ) const
inline

Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.

Returns
The radius of the rounded corners for this pad.

Definition at line 573 of file class_pad.h.

574  {
576  }
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:887
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:573

References m_Size.

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

◆ GetRoundRectCornerRadius() [2/2]

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

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

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

Definition at line 210 of file class_pad.cpp.

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

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

672  {
674  }
double m_padRoundRectRadiusScale
scaling factor from smallest m_Size coord to corner radius, default 0.25
Definition: class_pad.h:891

References m_padRoundRectRadiusScale.

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

◆ GetSelectMenuText()

wxString D_PAD::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 1291 of file class_pad.cpp.

1292 {
1293  if( GetName().IsEmpty() )
1294  {
1295  return wxString::Format( _( "Pad of %s on %s" ),
1296  GetParent()->GetReference(),
1298  }
1299  else
1300  {
1301  return wxString::Format( _( "Pad %s of %s on %s" ),
1302  GetName(),
1303  GetParent()->GetReference(),
1305  }
1306 }
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
const wxString & GetName() const
Definition: class_pad.h:203
MODULE * GetParent() const
Definition: class_pad.h:167
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:916
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:31
static wxString LayerMaskDescribe(const BOARD *aBoard, LSET aMask)
Helper function Return a string (to be shown to the user) describing a layer mask.
Definition: class_pad.cpp:1455

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

◆ GetShape()

PAD_SHAPE_T D_PAD::GetShape ( ) const
inline

Function GetShape.

Returns
the shape of this pad.

Definition at line 237 of file class_pad.h.

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

References m_padShape.

Referenced by ZONE_FILLER::addKnockout(), boundingRadius(), BuildPadPolygon(), CINFO3D_VISU::buildPadShapePolygon(), BuildPadShapePolygon(), CINFO3D_VISU::buildPadShapeThickOutlineAsPolygon(), CINFO3D_VISU::buildPadShapeThickOutlineAsSegments(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), Compare(), CINFO3D_VISU::createNewPadWithClearance(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), CreatePadsShapesSection(), doPushPadProperties(), export_vrml_padshape(), PCB_IO::format(), CN_ITEM::GetAnchor(), GetBoundingBox(), hash_eda(), HitTest(), HYPERLYNX_PAD_STACK::HYPERLYNX_PAD_STACK(), ImportSettingsFrom(), DIALOG_PAD_PROPERTIES::initValues(), DSN::isRoundKeepout(), DSN::SPECCTRA_DB::makePADSTACK(), mirrorPadX(), DIALOG_PAD_PROPERTIES::onCornerRadiusChange(), DIALOG_PAD_PROPERTIES::onCornerSizePercentChange(), DIALOG_PAD_PROPERTIES::OnPaintShowPanel(), EAGLE_PLUGIN::packagePad(), DIALOG_PAD_PROPERTIES::padValuesOK(), GPCB_FPL_CACHE::parseMODULE(), AR_MATRIX::PlacePad(), BRDITEMS_PLOTTER::PlotPad(), PrintShape(), ShowPadShape(), PNS_KICAD_IFACE::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 148 of file board_connected_item.h.

149  {
150  return m_netinfo->GetShortNetname();
151  }
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:686
int m_LocalSolderMaskMargin
Local mask margins: when 0, the parent footprint design values are used.
Definition: class_pad.h:940
int m_SolderMaskMargin
Solder mask margin.
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:887
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:530
int GetLocalSolderMaskMargin() const
Definition: class_module.h:231
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
MODULE * GetParent() const
Definition: class_pad.h:167
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:916
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:160

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

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

◆ GetSolderPasteMargin()

wxSize D_PAD::GetSolderPasteMargin ( ) const

Function GetSolderPasteMargin.

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

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

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

Definition at line 673 of file class_pad.cpp.

674 {
675  // The pad inherits the margin only to calculate a default shape,
676  // therefore only if it is also a copper layer.
677  // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
678  // defined by the pad settings only
679  bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
680 
681  if( !isOnCopperLayer )
682  return wxSize( 0, 0 );
683 
684  int margin = m_LocalSolderPasteMargin;
685  double mratio = m_LocalSolderPasteMarginRatio;
686 
687  MODULE* module = GetParent();
688 
689  if( module )
690  {
691  if( margin == 0 )
692  margin = module->GetLocalSolderPasteMargin();
693 
694  auto brd = GetBoard();
695 
696  if( margin == 0 && brd )
697  {
698  margin = brd->GetDesignSettings().m_SolderPasteMargin;
699  }
700 
701  if( mratio == 0.0 )
702  mratio = module->GetLocalSolderPasteMarginRatio();
703 
704  if( mratio == 0.0 && brd )
705  {
706  mratio = brd->GetDesignSettings().m_SolderPasteMarginRatio;
707  }
708  }
709 
710  wxSize pad_margin;
711  pad_margin.x = margin + KiROUND( m_Size.x * mratio );
712  pad_margin.y = margin + KiROUND( m_Size.y * mratio );
713 
714  // ensure mask have a size always >= 0
715  if( pad_margin.x < -m_Size.x / 2 )
716  pad_margin.x = -m_Size.x / 2;
717 
718  if( pad_margin.y < -m_Size.y / 2 )
719  pad_margin.y = -m_Size.y / 2;
720 
721  return pad_margin;
722 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:686
int m_LocalSolderPasteMargin
Local solder paste margin absolute value.
Definition: class_pad.h:941
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:887
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int GetLocalSolderPasteMargin() const
Definition: class_module.h:237
MODULE * GetParent() const
Definition: class_pad.h:167
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:916
double GetLocalSolderPasteMarginRatio() const
Definition: class_module.h:240
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:61
double m_LocalSolderPasteMarginRatio
Local solder mask margin ratio value of pad size The final margin is the sum of these 2 values.
Definition: class_pad.h:943

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

240  {
241  return m_Status & type;
242  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

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

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

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetSubRatsnest()

int D_PAD::GetSubRatsnest ( ) const
inline

Function GetSubRatsnest.

Returns
int - the netcode

Definition at line 737 of file class_pad.h.

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

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

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

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

◆ GetThermalWidth()

int D_PAD::GetThermalWidth ( ) const

Definition at line 736 of file class_pad.cpp.

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

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

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

◆ GetTimeStamp()

◆ GetZoneConnection()

ZONE_CONNECTION D_PAD::GetZoneConnection ( ) const

Definition at line 725 of file class_pad.cpp.

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

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

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

◆ HasFlag()

◆ HitTest() [1/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 880 of file class_pad.cpp.

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

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

◆ HitTest() [2/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 982 of file class_pad.cpp.

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

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

◆ ImportSettingsFrom()

void D_PAD::ImportSettingsFrom ( const D_PAD aMasterPad)

Imports the pad settings from aMasterPad.

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

Parameters
aMasterPad= the template pad

Definition at line 1488 of file class_pad.cpp.

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

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

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

◆ IncrementPadName()

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

Function IncrementPadName.

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

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

Definition at line 585 of file class_pad.cpp.

586 {
587  bool skip = aSkipUnconnectable && ( GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED );
588 
589  if( !skip )
590  SetName( GetParent()->GetNextPadName( aFillSequenceGaps ) );
591 
592  return !skip;
593 }
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:445
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 452 of file class_pad.h.

452 { return ( m_layerMask & LSET::AllCuMask() ).none(); }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:686
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:916

References LSET::AllCuMask(), and m_layerMask.

Referenced by doPushPadProperties(), 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 71 of file board_connected_item.h.

72  {
73  return true;
74  }

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

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

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

◆ IsFlipped()

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

Definition at line 139 of file class_pad.cpp.

140 {
141  if( GetParent() && GetParent()->GetLayer() == B_Cu )
142  return true;
143  return false;
144 }
MODULE * GetParent() const
Definition: class_pad.h:167
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

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

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

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 225 of file base_struct.h.

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

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

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

◆ IsLocked()

virtual bool BOARD_ITEM::IsLocked ( ) const
inlinevirtualinherited

Function IsLocked.

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

Reimplemented in MODULE, and TRACK.

Definition at line 198 of file class_board_item.h.

199  {
200  // only MODULEs & TRACKs can be locked at this time.
201  return false;
202  }

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 219 of file base_struct.h.

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

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

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

Reimplemented from BOARD_ITEM.

Definition at line 285 of file class_pad.h.

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

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

Referenced by CN_LIST::Add().

◆ IsOnLayer()

bool D_PAD::IsOnLayer ( PCB_LAYER_ID  aLayer) const
inlineoverridevirtual

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

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

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

Reimplemented from BOARD_ITEM.

Definition at line 742 of file class_pad.h.

743  {
744  return m_layerMask[aLayer];
745  }
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:916

References m_layerMask.

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

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Function IsReplaceable.

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

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

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

Definition at line 515 of file base_struct.h.

515 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 224 of file base_struct.h.

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

References IS_RESIZED, and EDA_ITEM::m_Flags.

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

◆ IsSelected()

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

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

form of testing.

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

Definition at line 189 of file class_board_item.h.

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

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

◆ IsType()

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

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

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

Reimplemented in SCH_LABEL, SCH_FIELD, and SCH_LINE.

Definition at line 284 of file base_struct.h.

285  {
286  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
287  return true;
288 
289  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
290  {
291  if( m_StructType == *p )
292  return true;
293  }
294 
295  return false;
296  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:172
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78

References EOT, EDA_ITEM::m_StructType, and SCH_LOCATE_ANY_T.

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

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 222 of file base_struct.h.

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

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward() [1/2]

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

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

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

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

Definition at line 397 of file base_struct.h.

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

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

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

◆ IterateForward() [2/2]

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

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

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

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

Definition at line 418 of file base_struct.h.

420  {
421  for( auto it : aList )
422  {
423  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
425  return SEARCH_RESULT::QUIT;
426  }
427 
429  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

◆ Matches() [1/2]

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

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

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

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

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

Definition at line 471 of file base_struct.h.

472  {
473  return false;
474  }

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

◆ Matches() [2/2]

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

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 153 of file base_struct.cpp.

154 {
155  wxString text = aText;
156  wxString searchText = aSearchData.GetFindString();
157 
158  // Don't match if searching for replaceable item and the item doesn't support text replace.
159  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
160  return false;
161 
162  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
163  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
164 
165  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
166  {
167  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
168  return text.Matches( searchText );
169 
170  return text.MakeUpper().Matches( searchText.MakeUpper() );
171  }
172 
173  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
174  return aText.Find( searchText ) != wxNOT_FOUND;
175 
176  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
177 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:515

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

◆ MergePrimitivesAsPolygon()

bo