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)
 
D_PADNext () const
 
MODULEGetParent () const
 
void ImportSettingsFromMaster (const D_PAD &aMasterPad)
 Imports the pad settings from aMasterPad. More...
 
bool IsFlipped () const
 
void SetName (const wxString &aName)
 Set the pad name (sometimes called pad number, although it can be an array reference like AA12). More...
 
const wxString & GetName () const
 
bool IncrementPadName (bool aSkipUnconnectable, bool aFillSequenceGaps)
 Function IncrementPadName. More...
 
bool PadNameEqual (const D_PAD *other) const
 
PAD_SHAPE_T GetShape () const
 Function GetShape. More...
 
void SetShape (PAD_SHAPE_T aShape)
 
void SetPosition (const wxPoint &aPos) override
 
const wxPoint GetPosition () const override
 
PAD_SHAPE_T GetAnchorPadShape () const
 Function GetAnchorPadShape. More...
 
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt () const
 
void SetCustomShapeInZoneOpt (CUST_PAD_SHAPE_IN_ZONE aOption)
 Set the option for the custom pad shape to use as clearance area in copper zones. More...
 
void SetAnchorPadShape (PAD_SHAPE_T aShape)
 Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads. More...
 
void SetY (int y)
 
void SetX (int x)
 
void SetPos0 (const wxPoint &aPos)
 
const wxPoint & GetPos0 () const
 
void SetY0 (int y)
 
void SetX0 (int x)
 
void SetSize (const wxSize &aSize)
 
const wxSize & GetSize () const
 
void SetDelta (const wxSize &aSize)
 
const wxSize & GetDelta () const
 
void SetDrillSize (const wxSize &aSize)
 
const wxSize & GetDrillSize () const
 
void SetOffset (const wxPoint &aOffset)
 
const wxPoint & GetOffset () const
 
void AddPrimitive (const SHAPE_POLY_SET &aPoly, int aThickness)
 Has meaning only for free shape pads. More...
 
void AddPrimitive (const std::vector< wxPoint > &aPoly, int aThickness)
 add a polygonal basic shape More...
 
void AddPrimitive (wxPoint aStart, wxPoint aEnd, int aThickness)
 segment basic shape More...
 
void AddPrimitive (wxPoint aCenter, int aRadius, int aThickness)
 ring or circle basic shape More...
 
void AddPrimitive (wxPoint aCenter, wxPoint aStart, int aArcAngle, int aThickness)
 arc basic shape More...
 
void AddPrimitive (wxPoint aStart, wxPoint aEnd, wxPoint aCtrl1, wxPoint aCtrl2, int aThickness)
 curve basic shape More...
 
bool GetBestAnchorPosition (VECTOR2I &aPos)
 
bool MergePrimitivesAsPolygon (SHAPE_POLY_SET *aMergedPolygon=NULL, int aCircleToSegmentsCount=ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF)
 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) override
 Function Flip Flip this object, i.e. More...
 
void FlipPrimitives ()
 Flip the basic shapes, in custom pads. More...
 
void MirrorXPrimitives (int aX)
 Mirror the primitives about a coordinate. More...
 
bool SetPrimitives (const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
 Import to the basic shape list. More...
 
bool AddPrimitives (const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
 Add to the basic shape list. More...
 
void SetOrientation (double aAngle)
 Function SetOrientation sets the rotation angle of the pad. More...
 
void SetOrientationDegrees (double aOrientation)
 Set orientation in degrees. More...
 
double GetOrientation () const
 Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees. More...
 
double GetOrientationDegrees () const
 
double GetOrientationRadians () const
 
void SetDrillShape (PAD_DRILL_SHAPE_T aDrillShape)
 
PAD_DRILL_SHAPE_T GetDrillShape () const
 
void GetOblongDrillGeometry (wxPoint &aStartPoint, wxPoint &aEndPoint, int &aWidth) const
 Function GetOblongDrillGeometry calculates the start point, end point and width of an equivalent segment which have the same position and width as the hole Usefull to plot/draw oblong holes like segments with rounded ends used in draw and plot functions. More...
 
void SetLayerSet (LSET aLayerMask)
 
LSET GetLayerSet () const override
 Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segment or VIA physically resides. More...
 
void SetAttribute (PAD_ATTR_T aAttribute)
 
PAD_ATTR_T GetAttribute () const
 
bool IsAperturePad () const
 
void SetPadToDieLength (int aLength)
 
int GetPadToDieLength () const
 
int GetLocalSolderMaskMargin () const
 
void SetLocalSolderMaskMargin (int aMargin)
 
int GetLocalClearance () const
 
void SetLocalClearance (int aClearance)
 
int GetLocalSolderPasteMargin () const
 
void SetLocalSolderPasteMargin (int aMargin)
 
double GetLocalSolderPasteMarginRatio () const
 
void SetLocalSolderPasteMarginRatio (double aRatio)
 
void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount, double aCorrectionFactor, bool ignoreLineWidth=false) const override
 Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments. More...
 
int GetClearance (BOARD_CONNECTED_ITEM *aItem=NULL) const override
 Function GetClearance returns the clearance in internal units. More...
 
int GetSolderMaskMargin () const
 Function GetSolderMaskMargin. More...
 
wxSize GetSolderPasteMargin () const
 Function GetSolderPasteMargin. More...
 
void SetZoneConnection (ZoneConnection aType)
 
ZoneConnection GetZoneConnection () const
 
void SetThermalWidth (int aWidth)
 
int GetThermalWidth () const
 
void SetThermalGap (int aGap)
 
int GetThermalGap () const
 
void Draw (EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
 Function Draw BOARD_ITEMs have their own color information. More...
 
void DrawShape (EDA_RECT *aClipBox, wxDC *aDC, PAD_DRAWINFO &aDrawInfo)
 Function DrawShape basic function to draw 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 aSegmentsPerCircle, double aCorrectionFactor) 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 aSegmentsPerCircle) const
 Function BuildPadDrillShapePolygon Build the Corner list of the polygonal drill shape, depending on shape pad hole and orientation. More...
 
int BuildSegmentFromOvalShape (wxPoint &aSegStart, wxPoint &aSegEnd, double aRotation, const wxSize &aMargin) const
 Function BuildSegmentFromOvalShape Has meaning only for OVAL (and ROUND) pads Build an equivalent segment having the same shape as the OVAL shape, Useful in draw function and in DRC and HitTest functions, because segments are already well handled by track tests. More...
 
int GetBoundingRadius () const
 Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad. More...
 
wxPoint ShapePos () const
 
double GetRoundRectRadiusRatio () const
 has meaning only for rounded rect pads More...
 
void SetRoundRectRadiusRatio (double aRadiusScale)
 has meaning only for rounded rect pads Set the scaling factor between the smaller Y or Y size and the radius of the rounded corners. More...
 
double GetChamferRectRatio () const
 has meaning only for chamfered rect pads More...
 
void SetChamferRectRatio (double aChamferScale)
 has meaning only for chamfered rect pads Set the ratio between the smaller Y or Y size and the radius of the rounded corners. More...
 
int GetChamferPositions () const
 has meaning only for chamfered rect pads More...
 
void SetChamferPositions (int aChamferPositions)
 has meaning only for chamfered rect pads set the position of the chamfer for a 0 orientation, one of RECT_CHAMFER_TOP_LEFT, RECT_CHAMFER_TOP_RIGHT, RECT_CHAMFER_BOTTOM_LEFT, RECT_CHAMFER_BOTTOM_RIGHT More...
 
int GetSubRatsnest () const
 Function GetSubRatsnest. More...
 
void SetSubRatsnest (int aSubRatsnest)
 
void GetMsgPanelInfo (EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
bool IsOnLayer (PCB_LAYER_ID aLayer) const override
 Function IsOnLayer tests to see if this object is on the given layer. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Function HitTest tests if aPosition is contained within or on the bounding box of an item. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes. More...
 
void SetDrawCoord ()
 

Set absolute coordinates.

More...
 
void SetLocalCoord ()
 

Set relative coordinates.

More...
 
void Move (const wxPoint &aMoveVector) override
 Function Move move this object. More...
 
void Rotate (const wxPoint &aRotCentre, double aAngle) override
 Function Rotate Rotate this object. More...
 
wxString GetSelectMenuText (EDA_UNITS_T aUnits) const override
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAP_DEF GetMenuImage () const override
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
wxString ShowPadShape () const
 Function ShowPadShape. More...
 
wxString ShowPadAttr () const
 Function ShowPadAttr. More...
 
void AppendConfigs (PARAM_CFG_ARRAY *aResult)
 Function AppendConfigs appends to aResult the configuration setting accessors which will later allow reading or writing of configuration file information directly into this object. More...
 
EDA_ITEMClone () const override
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
D_PADDuplicate () const
 same as Clone, but returns a D_PAD item. More...
 
bool PadShouldBeNPTH () const
 A pad whose hole is the same size as the pad is a NPTH. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
virtual unsigned int ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
void CopyNetlistSettings (D_PAD *aPad, bool aCopyLocalSettings)
 Function CopyNetlistSettings copies the netlist settings to aPad, and the net name. More...
 
virtual void SwapData (BOARD_ITEM *aImage) override
 Swap data between aItem and aImage. More...
 
bool IsConnected () const override
 

More...
 
NETINFO_ITEMGetNet () const
 Function GetNet Returns NET_INFO object for a given item. More...
 
void SetNet (NETINFO_ITEM *aNetInfo)
 Function SetNet Sets a NET_INFO object for the item. More...
 
int GetNetCode () const
 Function GetNetCode. More...
 
bool SetNetCode (int aNetCode, bool aNoAssert=false)
 Function SetNetCode sets net using a net code. More...
 
const wxString & GetNetname () const
 Function GetNetname. More...
 
wxString GetNetnameMsg () const
 Function GetNetnameMsg. More...
 
const wxString & GetShortNetname () const
 Function GetShortNetname. More...
 
std::shared_ptr< NETCLASSGetNetClass () const
 Function GetNetClass returns the NETCLASS for this item. More...
 
wxString GetNetClassName () const
 Function GetNetClassName returns a pointer to the netclass of the zone. More...
 
void SetLocalRatsnestVisible (bool aVisible)
 
bool GetLocalRatsnestVisible () const
 
virtual const wxPoint GetCenter () const
 Function GetCenter() More...
 
BOARD_ITEMBack () const
 
virtual PCB_LAYER_ID GetLayer () const
 Function GetLayer returns the primary layer this item is on. More...
 
virtual void SetLayer (PCB_LAYER_ID aLayer)
 Function SetLayer sets the layer this item is on. More...
 
bool IsTrack () const
 Function IsTrack tests to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 Function IsLocked. More...
 
virtual void SetLocked (bool aLocked)
 Function SetLocked modifies 'lock' status for of the item. More...
 
virtual void UnLink ()
 Function UnLink detaches this object from its owner. More...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after UnLink()ing it from its owner if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
void Flip (const VECTOR2I &aCentre)
 
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
 
DHEADGetList () const
 
void SetNext (EDA_ITEM *aNext)
 
void SetBack (EDA_ITEM *aBack)
 
void SetParent (EDA_ITEM *aParent)
 
void SetList (DHEAD *aList)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[])
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
virtual SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 

Static Public Member Functions

static LSET StandardMask ()
 layer set for a through hole pad More...
 
static LSET SMDMask ()
 layer set for a SMD pad on Front layer More...
 
static LSET ConnSMDMask ()
 layer set for a SMD pad on Front layer used for edge board connectors More...
 
static LSET UnplatedHoleMask ()
 layer set for a mechanical unplated through hole pad More...
 
static LSET ApertureMask ()
 layer set for an aperture pad More...
 
static bool ClassOf (const EDA_ITEM *aItem)
 
static int Compare (const D_PAD *padref, const D_PAD *padcmp)
 Function Compare compares two pads and return 0 if they are equal. More...
 
static wxString ShowShape (STROKE_T aShape)
 Function ShowShape converts the enum STROKE_T integer value to a wxString. More...
 
static SEARCH_RESULT IterateForward (EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Static Public Attributes

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

Protected Member Functions

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

Static Protected Member Functions

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

Protected Attributes

NETINFO_ITEMm_netinfo
 Stores all informations about the net that item belongs to. More...
 
PCB_LAYER_ID m_Layer
 
EDA_ITEMPnext
 next in linked list More...
 
EDA_ITEMPback
 previous in linked list More...
 
DHEADm_List
 which DLIST I am on. More...
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
timestamp_t m_TimeStamp
 Time stamp used for logical links. More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 135 of file class_pad.h.

Constructor & Destructor Documentation

◆ D_PAD()

D_PAD::D_PAD ( MODULE parent)

Definition at line 58 of file class_pad.cpp.

58  :
60 {
61  m_Size.x = m_Size.y = Mils2iu( 60 ); // Default pad size 60 mils.
62  m_Drill.x = m_Drill.y = Mils2iu( 30 ); // Default drill size 30 mils.
63  m_Orient = 0; // Pad rotation in 1/10 degrees.
64  m_LengthPadToDie = 0;
65 
66  if( m_Parent && m_Parent->Type() == PCB_MODULE_T )
67  {
69  }
70 
71  SetShape( PAD_SHAPE_CIRCLE ); // Default pad shape is PAD_CIRCLE.
72  SetAnchorPadShape( PAD_SHAPE_CIRCLE ); // Default shape for custom shaped pads
73  // is PAD_CIRCLE.
74  SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); // Default pad drill shape is a circle.
75  m_Attribute = PAD_ATTRIB_STANDARD; // Default pad type is NORMAL (thru hole)
76  m_LocalClearance = 0;
80  // Parameters for round rect only:
81  m_padRoundRectRadiusScale = 0.25; // from IPC-7351C standard
82  // Parameters for chamfered rect only:
83  m_padChamferRectScale = 0.2; // Size of chamfer: ratio of smallest of X,Y size
84  m_chamferPositions = RECT_NO_CHAMFER; // No chamfered corner
85 
86  m_ZoneConnection = PAD_ZONE_CONN_INHERITED; // Use parent setting by default
87  m_ThermalWidth = 0; // Use parent setting by default
88  m_ThermalGap = 0; // Use parent setting by default
89 
91 
92  // Set layers mask to default for a standard thru hole pad.
94 
95  SetSubRatsnest( 0 ); // used in ratsnest calculations
96 
97  m_boundingRadius = -1;
98 }
int m_LocalClearance
Local clearance.
Definition: class_pad.h:925
int m_ThermalGap
Definition: class_pad.h:938
int m_LocalSolderMaskMargin
Local mask margins: when 0, the parent footprint design values are used.
Definition: class_pad.h:929
double m_padRoundRectRadiusScale
scaling factor from smallest m_Size coord to corner radius, default 0.25
Definition: class_pad.h:882
int m_boundingRadius
radius of the circle containing the pad shape
Definition: class_pad.h:841
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
double m_padChamferRectScale
scaling factor from smallest m_Size coord to chamfer value, default 0.25
Definition: class_pad.h:884
static LSET StandardMask()
layer set for a through hole pad
Definition: class_pad.cpp:101
int m_LocalSolderPasteMargin
Local solder paste margin absolute value.
Definition: class_pad.h:930
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:878
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
void SetSubRatsnest(int aSubRatsnest)
Definition: class_pad.h:713
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:255
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:869
int m_ThermalWidth
Definition: class_pad.h:937
int m_chamferPositions
the positions of the chamfered position for a 0 orientation
Definition: class_pad.h:886
MODULE * GetParent() const
Definition: class_pad.h:164
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:907
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:398
int m_LengthPadToDie
Length net from pad to die, inside the package.
Definition: class_pad.h:920
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:219
PAD_ATTR_T m_Attribute
PAD_ATTRIB_NORMAL, PAD_ATTRIB_SMD, PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED.
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:874
double m_Orient
in 1/10 degrees
Definition: class_pad.h:918
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:932
const wxPoint GetPosition() const override
Definition: class_module.h:183
ZoneConnection m_ZoneConnection
how the connection to zone is made: no connection, thermal relief ...
Definition: class_pad.h:935
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
wxPoint m_Pos
pad Position on board
Definition: class_pad.h:846

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

Referenced by Clone().

Member Function Documentation

◆ AddPrimitive() [1/6]

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

Has meaning only for free shape pads.

add a free shape to the shape list. the shape can be a polygon (outline can have a thickness) a thick segment a filled circle or ring ( if thickness == 0, this is a filled circle, else a ring) a arc a curveadd a polygonal basic shape

Definition at line 96 of file pad_custom_shape_functions.cpp.

97 {
98  std::vector<wxPoint> points;
99 
100  // If aPoly has holes, convert it to a polygon with no holes.
101  SHAPE_POLY_SET poly_no_hole;
102  poly_no_hole.Append( aPoly );
104 
105  for( auto iter = poly_no_hole.CIterate(); iter; iter++ )
106  points.push_back( wxPoint( iter->x, iter->y ) );
107 
108  AddPrimitive( points, aThickness );
109 }
Class SHAPE_POLY_SET.
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
void AddPrimitive(const SHAPE_POLY_SET &aPoly, int aThickness)
Has meaning only for free shape pads.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

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

Referenced by PCB_EDIT_FRAME::Create_MuWaveComponent().

◆ AddPrimitive() [2/6]

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

add a polygonal basic shape

Definition at line 111 of file pad_custom_shape_functions.cpp.

112 {
113  PAD_CS_PRIMITIVE shape( S_POLYGON );
114  shape.m_Poly = aPoly;
115  shape.m_Thickness = aThickness;
116  m_basicShapes.push_back( shape );
117 
119 }
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:856
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL, int aCircleToSegmentsCount=ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
polygon (not yet used for tracks, but could be in microwave apps)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:91

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

123 {
124  PAD_CS_PRIMITIVE shape( S_SEGMENT );
125  shape.m_Start = aStart;
126  shape.m_End = aEnd;
127  shape.m_Thickness = aThickness;
128  m_basicShapes.push_back( shape );
129 
131 }
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:856
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL, int aCircleToSegmentsCount=ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
usual segment : line 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:91

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

162 {
163  PAD_CS_PRIMITIVE shape( S_CIRCLE );
164  shape.m_Start = aCenter;
165  shape.m_Radius = aRadius;
166  shape.m_Thickness = aThickness;
167  m_basicShapes.push_back( shape );
168 
170 }
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:856
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL, int aCircleToSegmentsCount=ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF)
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:91

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

135 {
136  PAD_CS_PRIMITIVE shape( S_ARC );
137  shape.m_Start = aCenter;
138  shape.m_End = aStart;
139  shape.m_ArcAngle = aArcAngle;
140  shape.m_Thickness = aThickness;
141  m_basicShapes.push_back( shape );
142 
144 }
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:856
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL, int aCircleToSegmentsCount=ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF)
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:91

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

148 {
149  PAD_CS_PRIMITIVE shape( S_CURVE );
150  shape.m_Start = aStart;
151  shape.m_End = aEnd;
152  shape.m_Ctrl1 = aCtrl1;
153  shape.m_Ctrl2 = aCtrl2;
154  shape.m_Thickness = aThickness;
155  m_basicShapes.push_back( shape );
156 
158 }
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:856
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL, int aCircleToSegmentsCount=ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF)
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:91
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 186 of file pad_custom_shape_functions.cpp.

187 {
188  for( const auto& prim : aPrimitivesList )
189  m_basicShapes.push_back( prim );
190 
191  return MergePrimitivesAsPolygon();
192 }
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:856
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL, int aCircleToSegmentsCount=ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF)
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 129 of file class_pad.cpp.

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

References F_Paste.

◆ AppendConfigs()

void D_PAD::AppendConfigs ( PARAM_CFG_ARRAY aResult)

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

Definition at line 530 of file class_pad.cpp.

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

References m_Drill, and m_Size.

◆ Back()

BOARD_ITEM* BOARD_ITEM::Back ( ) const
inlineinherited

Definition at line 116 of file class_board_item.h.

116 { return static_cast<BOARD_ITEM*>( Pback ); }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:171

References EDA_ITEM::Pback.

Referenced by SwapItemData().

◆ boundingRadius()

int D_PAD::boundingRadius ( ) const
private

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

Definition at line 143 of file class_pad.cpp.

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

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

Referenced by GetBoundingRadius().

◆ buildCustomPadPolygon()

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

Definition at line 203 of file pad_custom_shape_functions.cpp.

206 {
207  SHAPE_POLY_SET aux_polyset;
208 
209  for( unsigned cnt = 0; cnt < m_basicShapes.size(); ++cnt )
210  {
211  const PAD_CS_PRIMITIVE& bshape = m_basicShapes[cnt];
212 
213  switch( bshape.m_Shape )
214  {
215  case S_CURVE:
216  {
217  std::vector<wxPoint> ctrlPoints = { bshape.m_Start, bshape.m_Ctrl1, bshape.m_Ctrl2, bshape.m_End };
218  BEZIER_POLY converter( ctrlPoints );
219  std::vector< wxPoint> poly;
220  converter.GetPoly( poly, bshape.m_Thickness );
221 
222  for( unsigned ii = 1; ii < poly.size(); ii++ )
223  {
225  poly[ii-1], poly[ii], aCircleToSegmentsCount, bshape.m_Thickness );
226  }
227  break;
228  }
229 
230  case S_SEGMENT: // usual segment : line with rounded ends
232  bshape.m_Start, bshape.m_End, aCircleToSegmentsCount, bshape.m_Thickness );
233  break;
234 
235  case S_ARC: // Arc with rounded ends
236  TransformArcToPolygon( aux_polyset,
237  bshape.m_Start, bshape.m_End, bshape.m_ArcAngle,
238  aCircleToSegmentsCount, bshape.m_Thickness );
239  break;
240 
241  case S_CIRCLE: // ring or circle
242  if( bshape.m_Thickness ) // ring
243  TransformRingToPolygon( aux_polyset,
244  bshape.m_Start, bshape.m_Radius,
245  aCircleToSegmentsCount, bshape.m_Thickness ) ;
246  else // Filled circle
247  TransformCircleToPolygon( aux_polyset,
248  bshape.m_Start, bshape.m_Radius,
249  aCircleToSegmentsCount ) ;
250  break;
251 
252  case S_POLYGON: // polygon
253  if( bshape.m_Poly.size() < 2 )
254  break; // Malformed polygon.
255 
256  {
257  // Insert the polygon:
258  const std::vector< wxPoint>& poly = bshape.m_Poly;
259  aux_polyset.NewOutline();
260 
261  if( bshape.m_Thickness )
262  {
263  SHAPE_POLY_SET polyset;
264  polyset.NewOutline();
265 
266  for( unsigned ii = 0; ii < poly.size(); ii++ )
267  {
268  polyset.Append( poly[ii].x, poly[ii].y );
269  }
270 
272 
273  aux_polyset.Append( polyset );
274  }
275 
276  else
277  for( unsigned ii = 0; ii < poly.size(); ii++ )
278  aux_polyset.Append( poly[ii].x, poly[ii].y );
279  }
280  break;
281 
282  default:
283  break;
284  }
285  }
286 
287  aux_polyset.Simplify( SHAPE_POLY_SET::PM_FAST );
288 
289  // Merge all polygons with the initial pad anchor shape
290  if( aux_polyset.OutlineCount() )
291  {
292  aMergedPolygon->BooleanAdd( aux_polyset, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
293  aMergedPolygon->Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
294  }
295 
296  return aMergedPolygon->OutlineCount() <= 1;
297 }
void TransformRoundedEndsSegmentToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aCircleToSegmentsCount, int aWidth)
Function TransformRoundedEndsSegmentToPolygon convert a segment with rounded ends to a polygon Conver...
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:856
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:100
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
wxPoint m_Ctrl1
is also the start point of the arc
Definition: class_pad.h:102
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:98
void Inflate(int aFactor, int aCircleSegmentsCount)
Performs outline inflation/deflation, using round corners.
std::vector< wxPoint > m_Poly
Bezier Control point 2.
Definition: class_pad.h:104
Class SHAPE_POLY_SET.
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:91
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aBuffer, wxPoint aCenter, int aRadius, int aCircleToSegmentsCount)
Function TransformCircleToPolygon convert a circle to a polygon, using multiple straight lines.
Bezier Curve.
wxPoint m_End
is also the center of the circle and arc
Definition: class_pad.h:101
int NewOutline()
Creates a new empty polygon in the set and returns its index
STROKE_T m_Shape
Definition: class_pad.h:94
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:103
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:95
void TransformRingToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, int aRadius, int aCircleToSegmentsCount, int aWidth)
Function TransformRingToPolygon Creates a polygon from a ring Convert arcs to multiple straight segme...
Bezier curves to polygon converter.
Definition: bezier_curves.h:35
void TransformArcToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, wxPoint aStart, double aArcAngle, int aCircleToSegmentsCount, int aWidth)
Function TransformArcToPolygon Creates a polygon from an Arc Convert arcs to multiple straight segmen...
#define ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF
Definition: pcbnew.h:42
double m_ArcAngle
radius of a circle
Definition: class_pad.h:99
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(), ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF, SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::Fracture(), 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 TransformRoundedEndsSegmentToPolygon().

Referenced by GetBestAnchorPosition(), and MergePrimitivesAsPolygon().

◆ BuildPadDrillShapePolygon()

bool D_PAD::BuildPadDrillShapePolygon ( SHAPE_POLY_SET aCornerBuffer,
int  aInflateValue,
int  aSegmentsPerCircle 
) 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
aSegmentsPerCircle= number of segments to approximate a circle (used for round and oblong shapes only(16 to 32 is a good value)
Returns
false if the pad has no hole, true otherwise

Definition at line 872 of file board_items_to_polygon_shape_transform.cpp.

874 {
875  wxSize drillsize = GetDrillSize();
876 
877  if( !drillsize.x || !drillsize.y )
878  return false;
879 
880  if( drillsize.x == drillsize.y ) // usual round hole
881  {
882  TransformCircleToPolygon( aCornerBuffer, GetPosition(),
883  (drillsize.x / 2) + aInflateValue, aSegmentsPerCircle );
884  }
885  else // Oblong hole
886  {
887  wxPoint start, end;
888  int width;
889 
890  GetOblongDrillGeometry( start, end, width );
891 
892  width += aInflateValue * 2;
893 
895  GetPosition() + start, GetPosition() + end, aSegmentsPerCircle, width );
896  }
897 
898  return true;
899 }
void TransformRoundedEndsSegmentToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aCircleToSegmentsCount, int aWidth)
Function TransformRoundedEndsSegmentToPolygon convert a segment with rounded ends to a polygon Conver...
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:837
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aBuffer, wxPoint aCenter, int aRadius, int aCircleToSegmentsCount)
Function TransformCircleToPolygon convert a circle to a polygon, using multiple straight lines.
const wxSize & GetDrillSize() const
Definition: class_pad.h:277
const wxPoint GetPosition() const override
Definition: class_pad.h:222

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

Referenced by CINFO3D_VISU::createLayers().

◆ 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 786 of file pad_draw_functions.cpp.

788 {
789  wxSize delta;
790  wxSize halfsize;
791 
792  halfsize.x = m_Size.x >> 1;
793  halfsize.y = m_Size.y >> 1;
794 
795  switch( GetShape() )
796  {
797  case PAD_SHAPE_RECT:
798  // For rectangular shapes, inflate is easy
799  halfsize += aInflateValue;
800 
801  // Verify if do not deflate more than than size
802  // Only possible for inflate negative values.
803  if( halfsize.x < 0 )
804  halfsize.x = 0;
805 
806  if( halfsize.y < 0 )
807  halfsize.y = 0;
808  break;
809 
810  case PAD_SHAPE_TRAPEZOID:
811  // Trapezoidal pad: verify delta values
812  delta.x = ( m_DeltaSize.x >> 1 );
813  delta.y = ( m_DeltaSize.y >> 1 );
814 
815  // be sure delta values are not to large
816  if( (delta.x < 0) && (delta.x <= -halfsize.y) )
817  delta.x = -halfsize.y + 1;
818 
819  if( (delta.x > 0) && (delta.x >= halfsize.y) )
820  delta.x = halfsize.y - 1;
821 
822  if( (delta.y < 0) && (delta.y <= -halfsize.x) )
823  delta.y = -halfsize.x + 1;
824 
825  if( (delta.y > 0) && (delta.y >= halfsize.x) )
826  delta.y = halfsize.x - 1;
827  break;
828 
829  default: // is used only for rect and trap. pads
830  return;
831  }
832 
833  // Build the basic rectangular or trapezoid shape
834  // delta is null for rectangular shapes
835  aCoord[0].x = -halfsize.x - delta.y; // lower left
836  aCoord[0].y = +halfsize.y + delta.x;
837 
838  aCoord[1].x = -halfsize.x + delta.y; // upper left
839  aCoord[1].y = -halfsize.y - delta.x;
840 
841  aCoord[2].x = +halfsize.x - delta.y; // upper right
842  aCoord[2].y = -halfsize.y + delta.x;
843 
844  aCoord[3].x = +halfsize.x + delta.y; // lower right
845  aCoord[3].y = +halfsize.y - delta.x;
846 
847  // Offsetting the trapezoid shape id needed
848  // It is assumed delta.x or/and delta.y == 0
849  if( GetShape() == PAD_SHAPE_TRAPEZOID && (aInflateValue.x != 0 || aInflateValue.y != 0) )
850  {
851  double angle;
852  wxSize corr;
853 
854  if( delta.y ) // lower and upper segment is horizontal
855  {
856  // Calculate angle of left (or right) segment with vertical axis
857  angle = atan2( (double) m_DeltaSize.y, (double) m_Size.y );
858 
859  // left and right sides are moved by aInflateValue.x in their perpendicular direction
860  // We must calculate the corresponding displacement on the horizontal axis
861  // that is delta.x +- corr.x depending on the corner
862  corr.x = KiROUND( tan( angle ) * aInflateValue.x );
863  delta.x = KiROUND( aInflateValue.x / cos( angle ) );
864 
865  // Horizontal sides are moved up and down by aInflateValue.y
866  delta.y = aInflateValue.y;
867 
868  // corr.y = 0 by the constructor
869  }
870  else if( delta.x ) // left and right segment is vertical
871  {
872  // Calculate angle of lower (or upper) segment with horizontal axis
873  angle = atan2( (double) m_DeltaSize.x, (double) m_Size.x );
874 
875  // lower and upper sides are moved by aInflateValue.x in their perpendicular direction
876  // We must calculate the corresponding displacement on the vertical axis
877  // that is delta.y +- corr.y depending on the corner
878  corr.y = KiROUND( tan( angle ) * aInflateValue.y );
879  delta.y = KiROUND( aInflateValue.y / cos( angle ) );
880 
881  // Vertical sides are moved left and right by aInflateValue.x
882  delta.x = aInflateValue.x;
883 
884  // corr.x = 0 by the constructor
885  }
886  else // the trapezoid is a rectangle
887  {
888  delta = aInflateValue; // this pad is rectangular (delta null).
889  }
890 
891  aCoord[0].x += -delta.x - corr.x; // lower left
892  aCoord[0].y += delta.y + corr.y;
893 
894  aCoord[1].x += -delta.x + corr.x; // upper left
895  aCoord[1].y += -delta.y - corr.y;
896 
897  aCoord[2].x += delta.x - corr.x; // upper right
898  aCoord[2].y += -delta.y + corr.y;
899 
900  aCoord[3].x += delta.x + corr.x; // lower right
901  aCoord[3].y += delta.y - corr.y;
902 
903  /* test coordinates and clamp them if the offset correction is too large:
904  * Note: if a coordinate is bad, the other "symmetric" coordinate is bad
905  * So when a bad coordinate is found, the 2 symmetric coordinates
906  * are set to the minimun value (0)
907  */
908 
909  if( aCoord[0].x > 0 ) // lower left x coordinate must be <= 0
910  aCoord[0].x = aCoord[3].x = 0;
911 
912  if( aCoord[1].x > 0 ) // upper left x coordinate must be <= 0
913  aCoord[1].x = aCoord[2].x = 0;
914 
915  if( aCoord[0].y < 0 ) // lower left y coordinate must be >= 0
916  aCoord[0].y = aCoord[1].y = 0;
917 
918  if( aCoord[3].y < 0 ) // lower right y coordinate must be >= 0
919  aCoord[3].y = aCoord[2].y = 0;
920  }
921 
922  if( aRotation )
923  {
924  for( int ii = 0; ii < 4; ii++ )
925  RotatePoint( &aCoord[ii], aRotation );
926  }
927 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:878
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
static const int delta[8][2]
Definition: solve.cpp:112
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:911
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:218

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

Referenced by CINFO3D_VISU::buildPadShapePolygon(), BuildPadShapePolygon(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), CINFO3D_VISU::createNewPad(), CINFO3D_VISU::createNewPadWithClearance(), CreatePadsShapesSection(), KIGFX::PCB_PAINTER::draw(), DrawShape(), HitTest(), BRDITEMS_PLOTTER::PlotPad(), PNS_KICAD_IFACE::syncPad(), and TransformShapeWithClearanceToPolygon().

◆ BuildPadShapePolygon()

void D_PAD::BuildPadShapePolygon ( SHAPE_POLY_SET aCornerBuffer,
wxSize  aInflateValue,
int  aSegmentsPerCircle,
double  aCorrectionFactor 
) 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)
aSegmentsPerCircle= number of segments to approximate a circle (used for round and oblong shapes only (16 to 32 is a good value)
aCorrectionFactor= the correction to apply to circles radius to keep the pad size/clearance when the arcs are approximated by segments

Definition at line 815 of file board_items_to_polygon_shape_transform.cpp.

818 {
819  wxPoint corners[4];
820  wxPoint padShapePos = ShapePos(); /* Note: for pad having a shape offset,
821  * the pad position is NOT the shape position */
822  switch( GetShape() )
823  {
824  case PAD_SHAPE_CIRCLE:
825  case PAD_SHAPE_OVAL:
826  case PAD_SHAPE_ROUNDRECT:
828  {
829  // We are using TransformShapeWithClearanceToPolygon to build the shape.
830  // Currently, this method uses only the same inflate value for X and Y dirs.
831  // so because here this is not the case, we use a inflated dummy pad to build
832  // the polygonal shape
833  // TODO: remove this dummy pad when TransformShapeWithClearanceToPolygon will use
834  // a wxSize to inflate the pad size
835  D_PAD dummy( *this );
836  dummy.SetSize( GetSize() + aInflateValue + aInflateValue );
837  dummy.TransformShapeWithClearanceToPolygon( aCornerBuffer, 0,
838  aSegmentsPerCircle, aCorrectionFactor );
839  }
840  break;
841 
842  case PAD_SHAPE_TRAPEZOID:
843  case PAD_SHAPE_RECT:
844  aCornerBuffer.NewOutline();
845 
846  BuildPadPolygon( corners, aInflateValue, m_Orient );
847  for( int ii = 0; ii < 4; ii++ )
848  {
849  corners[ii] += padShapePos; // Shift origin to position
850  aCornerBuffer.Append( corners[ii].x, corners[ii].y );
851  }
852 
853  break;
854 
855  case PAD_SHAPE_CUSTOM:
856  // for a custom shape, that is in fact a polygon (with holes), we can use only a inflate value.
857  // so use ( aInflateValue.x + aInflateValue.y ) / 2 as polygon inflate value.
858  // (different values for aInflateValue.x and aInflateValue.y has no sense for a custom pad)
860  ( aInflateValue.x + aInflateValue.y ) / 2,
861  aSegmentsPerCircle, aCorrectionFactor );
862  break;
863  }
864 }
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount, double aCorrectionFactor, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon Used in filli...
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...
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
wxPoint ShapePos() const
Definition: class_pad.cpp:562
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:218
double m_Orient
in 1/10 degrees
Definition: class_pad.h:918
const wxSize & GetSize() const
Definition: class_pad.h:271
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(), PNS_KICAD_IFACE::syncPad(), and MODULE::TransformPadsShapesWithClearanceToPolygon().

◆ 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 752 of file pad_draw_functions.cpp.

754 {
755  int width;
756 
757  if( m_Size.y < m_Size.x ) // Build an horizontal equiv segment
758  {
759  int delta = ( m_Size.x - m_Size.y ) / 2;
760  aSegStart.x = -delta - aMargin.x;
761  aSegStart.y = 0;
762  aSegEnd.x = delta + aMargin.x;
763  aSegEnd.y = 0;
764  width = m_Size.y + ( aMargin.y * 2 );
765  }
766  else // Vertical oval: build a vertical equiv segment
767  {
768  int delta = ( m_Size.y -m_Size.x ) / 2;
769  aSegStart.x = 0;
770  aSegStart.y = -delta - aMargin.y;
771  aSegEnd.x = 0;
772  aSegEnd.y = delta + aMargin.y;
773  width = m_Size.x + ( aMargin.x * 2 );
774  }
775 
776  if( aRotation )
777  {
778  RotatePoint( &aSegStart, aRotation);
779  RotatePoint( &aSegEnd, aRotation);
780  }
781 
782  return width;
783 }
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:878
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
static const int delta[8][2]
Definition: solve.cpp:112

References delta, m_Size, and RotatePoint().

Referenced by DrawShape(), and PNS_KICAD_IFACE::syncPad().

◆ ClassOf()

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

Definition at line 157 of file class_pad.h.

158  {
159  return aItem && PCB_PAD_T == aItem->Type();
160  }
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

References PCB_PAD_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 239 of file base_struct.h.

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

References BRIGHTENED, and EDA_ITEM::ClearFlags().

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

◆ ClearEditFlags()

void EDA_ITEM::ClearEditFlags ( )
inlineinherited

◆ ClearFlags()

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

Definition at line 260 of file base_struct.h.

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

References EDA_ITEM::m_Flags.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_Move_Pad(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortMoveAndEditTarget(), AbortMoveDimensionText(), AbortMoveTextModule(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_COMPONENT::ClearAllHighlightFlags(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearHighlighted(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), CopyMarkedItems(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), FOOTPRINT_EDIT_FRAME::End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Route(), PCB_EDIT_FRAME::End_Zone(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_MOVE_TOOL::getConnectedDragItems(), PCB_BASE_FRAME::Import_Pad_Settings(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), EDIT_POINTS_FACTORY::Make(), MarkItemsInBloc(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_EDIT_FRAME::PlaceDimensionText(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::PlacePad(), PCB_EDIT_FRAME::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::PlaceTexteModule(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), BOARD_COMMIT::Revert(), LIB_EDIT_FRAME::RollbackPartFromUndo(), PCB_BASE_FRAME::Rotate_Module(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ ClearHighlighted()

void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 238 of file base_struct.h.

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

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 271 of file base_struct.h.

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

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 153 of file view_item.h.

154  {
155  m_viewPrivData = NULL;
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * D_PAD::Clone ( ) const
overridevirtual

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

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

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Definition at line 1302 of file class_pad.cpp.

1303 {
1304  return new D_PAD( *this );
1305 }
D_PAD(MODULE *parent)
Definition: class_pad.cpp:58

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

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

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

Referenced by CreatePadsShapesSection(), and PadListSortByShape().

◆ ConnSMDMask()

LSET D_PAD::ConnSMDMask ( )
static

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

Definition at line 115 of file class_pad.cpp.

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

References F_Cu, and F_Mask.

◆ CopyNetlistSettings()

void D_PAD::CopyNetlistSettings ( D_PAD aPad,
bool  aCopyLocalSettings 
)

Function CopyNetlistSettings copies the netlist settings to aPad, and the net name.

Used to copy some pad parameters when replacing a footprint by an other footprint when reading a netlist, or in exchange footprint dialog

The netlist settings are all of the D_PAD settings not define by a D_PAD in a netlist. The copied settings are the net name and optionally include local clearance, etc. The pad physical geometry settings are not copied.

Parameters
aPadis the D_PAD to copy the settings to.
aCopyLocalSettings= false to copy only the net name true to also copy local prms

Definition at line 588 of file class_pad.cpp.

589 {
590  // Don't do anything foolish like trying to copy to yourself.
591  wxCHECK_RET( aPad != NULL && aPad != this, wxT( "Cannot copy to NULL or yourself." ) );
592 
593  aPad->SetNetCode( GetNetCode() );
594 
595  if( aCopyLocalSettings )
596  {
603  aPad->SetThermalGap( m_ThermalGap );
604  }
605 }
int m_LocalClearance
Local clearance.
Definition: class_pad.h:925
int m_ThermalGap
Definition: class_pad.h:938
int m_LocalSolderMaskMargin
Local mask margins: when 0, the parent footprint design values are used.
Definition: class_pad.h:929
int GetNetCode() const
Function GetNetCode.
int m_LocalSolderPasteMargin
Local solder paste margin absolute value.
Definition: class_pad.h:930
void SetZoneConnection(ZoneConnection aType)
Definition: class_pad.h:501
void SetThermalWidth(int aWidth)
Definition: class_pad.h:504
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
int m_ThermalWidth
Definition: class_pad.h:937
void SetLocalClearance(int aClearance)
Definition: class_pad.h:430
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:436
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:427
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:433
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:932
void SetThermalGap(int aGap)
Definition: class_pad.h:507
ZoneConnection m_ZoneConnection
how the connection to zone is made: no connection, thermal relief ...
Definition: class_pad.h:935

References BOARD_CONNECTED_ITEM::GetNetCode(), m_LocalClearance, m_LocalSolderMaskMargin, m_LocalSolderPasteMargin, m_LocalSolderPasteMarginRatio, m_ThermalGap, m_ThermalWidth, m_ZoneConnection, SetLocalClearance(), SetLocalSolderMaskMargin(), SetLocalSolderPasteMargin(), SetLocalSolderPasteMarginRatio(), BOARD_CONNECTED_ITEM::SetNetCode(), SetThermalGap(), SetThermalWidth(), and SetZoneConnection().

Referenced by MODULE::CopyNetlistSettings().

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

341 {
342  if( aMergedPolygon->OutlineCount() == 0 )
343  return;
344 
345  // Move, rotate, ... coordinates in aMergedPolygon according to the
346  // pad position and orientation
347  for( int cnt = 0; cnt < aMergedPolygon->OutlineCount(); ++cnt )
348  {
349  SHAPE_LINE_CHAIN& poly = aMergedPolygon->Outline( cnt );
350 
351  for( int ii = 0; ii < poly.PointCount(); ++ii )
352  {
353  wxPoint corner( poly.Point( ii ).x, poly.Point( ii ).y );
354  RotatePoint( &corner, aRotation );
355  corner += aPosition;
356 
357  poly.Point( ii ).x = corner.x;
358  poly.Point( ii ).y = corner.y;
359  }
360  }
361 }
int OutlineCount() const
Returns the number of outlines in the set
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
int PointCount() const
Function PointCount()
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
Class SHAPE_LINE_CHAIN.
VECTOR2I & Point(int aIndex)
Function Point()

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

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

◆ DeletePrimitivesList()

void D_PAD::DeletePrimitivesList ( )

clear the basic shapes list

Definition at line 196 of file pad_custom_shape_functions.cpp.

197 {
198  m_basicShapes.clear();
200 }
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:856
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:861
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()

◆ Draw()

void D_PAD::Draw ( EDA_DRAW_PANEL panel,
wxDC *  DC,
GR_DRAWMODE  aDrawMode,
const wxPoint &  offset = ZeroOffset 
)
overridevirtual

Function Draw BOARD_ITEMs have their own color information.

Implements BOARD_ITEM.

Definition at line 76 of file pad_draw_functions.cpp.

78 {
79  wxSize mask_margin; // margin (clearance) used for some non copper layers
80 
81 #ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
82  int showActualMaskSize = 0; /* Layer number if the actual pad size on mask layer can
83  * be displayed i.e. if only one layer is shown for this pad
84  * and this layer is a mask (solder mask or solder paste
85  */
86 #endif
87 
88  if( m_Flags & DO_NOT_DRAW )
89  return;
90 
91  PAD_DRAWINFO drawInfo;
92 
93  drawInfo.m_Offset = aOffset;
94 
95  /* We can show/hide pads from the layer manager.
96  * options are show/hide pads on front and/or back side of the board
97  * For through pads, we hide them only if both sides are hidden.
98  * smd pads on back are hidden for all layers (copper and technical layers)
99  * on back side of the board
100  * smd pads on front are hidden for all layers (copper and technical layers)
101  * on front side of the board
102  * ECO, edge and Draw layers and not considered
103  */
104 
105  BOARD* brd = GetBoard();
106 
107  auto frame = static_cast<PCB_EDIT_FRAME*> ( aPanel->GetParent() );
108  const auto& cds = frame->Settings().Colors();
109 
110  bool frontVisible = brd->IsElementVisible( LAYER_PAD_FR );
111  bool backVisible = brd->IsElementVisible( LAYER_PAD_BK );
112 
113  if( !frontVisible && !backVisible )
114  return;
115 
116  // If pad is only on front side (no layer on back side)
117  // and if hide front side pads is enabled, do not draw
118  if( !frontVisible && !( m_layerMask & LSET::BackMask() ).any() )
119  return;
120 
121  // If pad is only on back side (no layer on front side)
122  // and if hide back side pads is enabled, do not draw
123  if( !backVisible && !( m_layerMask & LSET::FrontMask() ).any() )
124  return;
125 
126 
127  wxCHECK_RET( frame != NULL, wxT( "Panel has no parent frame window." ) );
128 
129  auto displ_opts = (PCB_DISPLAY_OPTIONS*)( frame->GetDisplayOptions() );
130  PCB_SCREEN* screen = frame->GetScreen();
131 
132  if( displ_opts && displ_opts->m_DisplayPadFill == SKETCH )
133  drawInfo.m_ShowPadFilled = false;
134  else
135  drawInfo.m_ShowPadFilled = true;
136 
138 
139  if( m_layerMask[F_Cu] )
140  {
141  color = cds.GetItemColor( LAYER_PAD_FR );
142  }
143 
144  if( m_layerMask[B_Cu] )
145  {
146  color = color.LegacyMix( cds.GetItemColor( LAYER_PAD_BK ) );
147  }
148 
149  if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show)
150  {
151  // If the pad is on only one tech layer, use the layer color else use DARKGRAY
152  LSET mask_non_copper_layers = m_layerMask & ~LSET::AllCuMask();
153 
154 #ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
155  mask_non_copper_layers &= brd->GetVisibleLayers();
156 #endif
157  PCB_LAYER_ID pad_layer = mask_non_copper_layers.ExtractLayer();
158 
159  switch( (int) pad_layer )
160  {
161  case UNDEFINED_LAYER: // More than one layer
162  color = DARKGRAY;
163  break;
164 
165  case UNSELECTED_LAYER: // Shouldn't really happen...
166  break;
167 
168  default:
169  color = cds.GetLayerColor( pad_layer );
170 #ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
171  showActualMaskSize = pad_layer;
172 #endif
173  }
174  }
175 
176  // if SMD or connector pad and high contrast mode
177  if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) &&
179  displ_opts && displ_opts->m_ContrastModeDisplay )
180  {
181  // when routing tracks
182  if( frame->GetToolId() == ID_TRACK_BUTT )
183  {
184  PCB_LAYER_ID routeTop = screen->m_Route_Layer_TOP;
185  PCB_LAYER_ID routeBot = screen->m_Route_Layer_BOTTOM;
186 
187  // if routing between copper and component layers,
188  // or the current layer is one of said 2 external copper layers,
189  // then highlight only the current layer.
190  if( ( screen->m_Active_Layer == F_Cu || screen->m_Active_Layer == B_Cu ) ||
191  ( routeTop==F_Cu && routeBot==B_Cu ) ||
192  ( routeTop==B_Cu && routeBot==F_Cu )
193  )
194  {
195  if( !IsOnLayer( screen->m_Active_Layer ) )
197  }
198  // else routing between an internal signal layer and some other
199  // layer. Grey out all PAD_ATTRIB_SMD pads not on current or the single
200  // selected external layer.
201  else if( !IsOnLayer( screen->m_Active_Layer )
202  && !IsOnLayer( routeTop )
203  && !IsOnLayer( routeBot ) )
204  {
206  }
207  }
208  // when not edting tracks, show PAD_ATTRIB_SMD components not on active layer
209  // as greyed out
210  else
211  {
212  if( !IsOnLayer( screen->m_Active_Layer ) )
214  }
215  }
216 
217 #ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
218  if( showActualMaskSize )
219  {
220  switch( showActualMaskSize )
221  {
222  case B_Mask:
223  case F_Mask:
224  mask_margin.x = mask_margin.y = GetSolderMaskMargin();
225  break;
226 
227  case B_Paste:
228  case F_Paste:
229  mask_margin = GetSolderPasteMargin();
230  break;
231 
232  default:
233  // Another layer which has no margin to handle
234  break;
235  }
236  }
237 #endif
238 
239  // if Contrast mode is ON and a technical layer active, show pads on this
240  // layer so we can see pads on paste or solder layer and the size of the
241  // mask
242  if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) &&
243  displ_opts && displ_opts->m_ContrastModeDisplay && !IsCopperLayer( screen->m_Active_Layer ) )
244  {
245  if( IsOnLayer( screen->m_Active_Layer ) )
246  {
247  color = cds.GetLayerColor( screen->m_Active_Layer );
248 
249  // In high contrast mode, and if the active layer is the mask
250  // layer shows the pad size with the mask clearance
251  switch( screen->m_Active_Layer )
252  {
253  case B_Mask:
254  case F_Mask:
255  mask_margin.x = mask_margin.y = GetSolderMaskMargin();
256  break;
257 
258  case B_Paste:
259  case F_Paste:
260  mask_margin = GetSolderPasteMargin();
261  break;
262 
263  default:
264  break;
265  }
266  }
267  else
269  }
270  // If use asks for masks to be printed, then print them.
271  else if( screen->m_IsPrinting )
272  {
273  if( ( IsOnLayer( B_Paste ) && brd->IsLayerVisible( B_Paste ) ) ||
274  ( IsOnLayer( F_Paste ) && brd->IsLayerVisible( F_Paste ) ) )
275  {
276  mask_margin = GetSolderPasteMargin();
277  }
278 
279  if( ( IsOnLayer( B_Mask ) && brd->IsLayerVisible( B_Mask ) ) ||
280  ( IsOnLayer( F_Mask ) && brd->IsLayerVisible( F_Mask ) ) )
281  {
282  mask_margin.x = std::max( mask_margin.x, GetSolderMaskMargin() );
283  mask_margin.y = std::max( mask_margin.y, GetSolderMaskMargin() );
284  }
285  }
286 
287  if( ( aDraw_mode & GR_HIGHLIGHT ) && !( aDraw_mode & GR_AND ) )
288  color.SetToLegacyHighlightColor();
289 
290  bool DisplayIsol = displ_opts && displ_opts->m_DisplayPadIsol;
291 
292  if( !( m_layerMask & LSET::AllCuMask() ).any() )
293  DisplayIsol = false;
294 
297  {
298  drawInfo.m_ShowNotPlatedHole = true;
299  drawInfo.m_NPHoleColor = cds.GetItemColor( LAYER_NON_PLATEDHOLES );
300  }
301  // Don't let pads that *should* be NPTHs get lost
302  else if ( PadShouldBeNPTH() )
303  {
304  drawInfo.m_ShowNotPlatedHole = true;
305  drawInfo.m_NPHoleColor = cds.GetItemColor( LAYER_MOD_TEXT_INVISIBLE );
306  }
307 
308  drawInfo.m_DrawMode = aDraw_mode;
309  drawInfo.m_Color = color;
310  drawInfo.m_NoNetMarkColor = cds.GetItemColor( LAYER_NO_CONNECTS );
311  drawInfo.m_DrawPanel = aPanel;
312  drawInfo.m_Mask_margin = mask_margin;
314  drawInfo.m_IsPrinting = screen->m_IsPrinting;
315  color.a = 0.666;
316 
317  /* Get the pad clearance. This has a meaning only for Pcbnew.
318  * for CvPcb GetClearance() creates debug errors because
319  * there is no net classes so a call to GetClearance() is made only when
320  * needed (never needed in CvPcb)
321  */
322  drawInfo.m_PadClearance = DisplayIsol ? GetClearance() : 0;
323 
324  // Draw the pad number
325  if( displ_opts && !displ_opts->m_DisplayPadNum )
326  drawInfo.m_Display_padnum = false;
327 
328  if( displ_opts &&
329  (( displ_opts ->m_DisplayNetNamesMode == 0 ) || ( displ_opts->m_DisplayNetNamesMode == 2 )) )
330  drawInfo.m_Display_netname = false;
331 
332  // Display net names is restricted to pads that are on the active layer
333  // in high contrast mode display
334  if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) &&
335  !IsOnLayer( screen->m_Active_Layer ) && displ_opts && displ_opts->m_ContrastModeDisplay )
336  drawInfo.m_Display_netname = false;
337 
338  DrawShape( aPanel->GetClipBox(), aDC, drawInfo );
339 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:676
show a marker on pads with no nets
bool m_Display_padnum
Definition: class_pad.h:75
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
handle color for not plated holes (holes, not pads)
int color
Definition: DXF_plotter.cpp:62
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:62
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
COLOR4D m_NoNetMarkColor
Definition: class_pad.h:72
bool m_ShowNCMark
Definition: class_pad.h:79
PCB_LAYER_ID m_Active_Layer
Definition: pcb_screen.h:44
static LSET FrontMask()
Function FrontMask returns a mask holding all technical layers and the external CU layer on front sid...
Definition: lset.cpp:775
bool m_IsPrinting
Definition: class_pad.h:82
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:417
int GetSolderMaskMargin() const
Function GetSolderMaskMargin.
Definition: class_pad.cpp:639
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
PCB_LAYER_ID
A quick note on layer IDs:
Class LSET is a set of PCB_LAYER_IDs.
GR_DRAWMODE m_DrawMode
Definition: class_pad.h:67
EDA_DRAW_PANEL * m_DrawPanel
Definition: class_pad.h:66
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
PCB_LAYER_ID m_Route_Layer_BOTTOM
Definition: pcb_screen.h:46
bool m_ShowNotPlatedHole
Definition: class_pad.h:80
void DrawShape(EDA_RECT *aClipBox, wxDC *aDC, PAD_DRAWINFO &aDrawInfo)
Function DrawShape basic function to draw a pad.
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:63
int m_PadClearance
Definition: class_pad.h:73
bool m_IsPrinting
Definition: base_screen.h:220
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:907
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:453
wxPoint m_Offset
Definition: class_pad.h:83
smd pads, front layer
wxSize GetSolderPasteMargin() const
Function GetSolderPasteMargin.
Definition: class_pad.cpp:685
PCB_LAYER_ID ExtractLayer() const
Find the first set PCB_LAYER_ID.
Definition: lset.cpp:615
#define max(a, b)
Definition: auxiliary.h:86
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const override
Function GetClearance returns the clearance in internal units.
Definition: class_pad.cpp:608
static LSET BackMask()
Function BackMask returns a mask holding all technical layers and the external CU layer on back side.
Definition: lset.cpp:782
bool m_ShowPadFilled
Definition: class_pad.h:77
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
COLOR4D m_NPHoleColor
Definition: class_pad.h:71
COLOR4D m_Color
Definition: class_pad.h:68
Definition: colors.h:45
bool m_Display_netname
Definition: class_pad.h:76
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Function IsOnLayer tests to see if this object is on the given layer.
Definition: class_pad.h:717
wxSize m_Mask_margin
Definition: class_pad.h:74
bool PadShouldBeNPTH() const
A pad whose hole is the same size as the pad is a NPTH.
Definition: class_pad.cpp:1308
PCB_LAYER_ID m_Route_Layer_TOP
Definition: pcb_screen.h:45
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:126
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References LSET::AllCuMask(), B_Cu, B_Mask, B_Paste, LSET::BackMask(), BLACK, color, DARKDARKGRAY, DARKGRAY, DO_NOT_DRAW, DrawShape(), LSET::ExtractLayer(), F_Cu, F_Mask, F_Paste, LSET::FrontMask(), GetAttribute(), BOARD_ITEM::GetBoard(), GetClearance(), EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_PANEL::GetParent(), GetSolderMaskMargin(), GetSolderPasteMargin(), BOARD::GetVisibleLayers(), GR_ALLOW_HIGHCONTRAST, GR_AND, GR_HIGHLIGHT, ID_TRACK_BUTT, IsCopperLayer(), BOARD::IsElementVisible(), BOARD::IsLayerVisible(), IsOnLayer(), LAYER_MOD_TEXT_INVISIBLE, LAYER_NO_CONNECTS, LAYER_NON_PLATEDHOLES, LAYER_PAD_BK, LAYER_PAD_FR, PCB_SCREEN::m_Active_Layer, PAD_DRAWINFO::m_Color, PAD_DRAWINFO::m_Display_netname, PAD_DRAWINFO::m_Display_padnum, PAD_DRAWINFO::m_DrawMode, PAD_DRAWINFO::m_DrawPanel, EDA_ITEM::m_Flags, PAD_DRAWINFO::m_IsPrinting, BASE_SCREEN::m_IsPrinting, m_layerMask, PAD_DRAWINFO::m_Mask_margin, PAD_DRAWINFO::m_NoNetMarkColor, PAD_DRAWINFO::m_NPHoleColor, PAD_DRAWINFO::m_Offset, PAD_DRAWINFO::m_PadClearance, PCB_SCREEN::m_Route_Layer_BOTTOM, PCB_SCREEN::m_Route_Layer_TOP, PAD_DRAWINFO::m_ShowNCMark, PAD_DRAWINFO::m_ShowNotPlatedHole, PAD_DRAWINFO::m_ShowPadFilled, max, PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED, PAD_ATTRIB_SMD, PadShouldBeNPTH(), SKETCH, UNDEFINED_LAYER, and UNSELECTED_LAYER.

Referenced by Abort_Move_Pad(), DrawMovingBlockOutlines(), MODULE::DrawOutlinesWhenMoving(), PCB_BASE_FRAME::PlacePad(), Show_Pad_Move(), and PCB_BASE_FRAME::StartMovePad().

◆ DrawShape()

void D_PAD::DrawShape ( EDA_RECT aClipBox,
wxDC *  aDC,
PAD_DRAWINFO aDrawInfo 
)

Function DrawShape basic function to draw a pad.

This function is used by Draw after calculation of parameters (color, ) final orientation transforms are set. It can also be called to draw a pad on any panel even if this panel is not a EDA_DRAW_PANEL for instance on a wxPanel inside the pad editor.

Definition at line 342 of file pad_draw_functions.cpp.

343 {
344  #define SEGCOUNT 32 // number of segments to approximate a circle
345  wxPoint coord[12];
346  double angle = m_Orient;
347  int seg_width;
348 
349  GRSetDrawMode( aDC, aDrawInfo.m_DrawMode );
350 
351  // calculate pad shape position :
352  wxPoint shape_pos = ShapePos() - aDrawInfo.m_Offset;
353 
354  wxSize halfsize = m_Size;
355  halfsize.x >>= 1;
356  halfsize.y >>= 1;
357 
358  switch( GetShape() )
359  {
360  case PAD_SHAPE_CIRCLE:
361  if( aDrawInfo.m_ShowPadFilled )
362  GRFilledCircle( aClipBox, aDC, shape_pos.x, shape_pos.y,
363  halfsize.x + aDrawInfo.m_Mask_margin.x, 0,
364  aDrawInfo.m_Color, aDrawInfo.m_Color );
365  else
366  GRCircle( aClipBox, aDC, shape_pos.x, shape_pos.y,
367  halfsize.x + aDrawInfo.m_Mask_margin.x,
368  m_PadSketchModePenSize, aDrawInfo.m_Color );
369 
370  if( aDrawInfo.m_PadClearance )
371  {
372  GRCircle( aClipBox,
373  aDC, shape_pos.x, shape_pos.y,
374  halfsize.x + aDrawInfo.m_PadClearance,
375  0, aDrawInfo.m_Color );
376  }
377 
378  break;
379 
380  case PAD_SHAPE_OVAL:
381  {
382  wxPoint segStart, segEnd;
383  seg_width = BuildSegmentFromOvalShape(segStart, segEnd, angle,
384  aDrawInfo.m_Mask_margin);
385  segStart += shape_pos;
386  segEnd += shape_pos;
387 
388  if( aDrawInfo.m_ShowPadFilled )
389  {
390  GRFillCSegm( aClipBox, aDC, segStart.x, segStart.y, segEnd.x, segEnd.y,
391  seg_width, aDrawInfo.m_Color );
392  }
393  else
394  {
395  GRCSegm( aClipBox, aDC, segStart.x, segStart.y, segEnd.x, segEnd.y,
396  seg_width, m_PadSketchModePenSize, aDrawInfo.m_Color );
397  }
398 
399  // Draw the clearance line
400  if( aDrawInfo.m_PadClearance )
401  {
402  seg_width += 2 * aDrawInfo.m_PadClearance;
403  GRCSegm( aClipBox, aDC, segStart.x, segStart.y, segEnd.x, segEnd.y,
404  seg_width, aDrawInfo.m_Color );
405  }
406  }
407  break;
408 
409  case PAD_SHAPE_RECT:
410  case PAD_SHAPE_TRAPEZOID:
411  BuildPadPolygon( coord, aDrawInfo.m_Mask_margin, angle );
412 
413  for( int ii = 0; ii < 4; ii++ )
414  coord[ii] += shape_pos;
415 
416  GRClosedPoly( aClipBox, aDC, 4, coord, aDrawInfo.m_ShowPadFilled,
417  aDrawInfo.m_ShowPadFilled ? 0 : m_PadSketchModePenSize,
418  aDrawInfo.m_Color, aDrawInfo.m_Color );
419 
420  if( aDrawInfo.m_PadClearance )
421  {
422  SHAPE_POLY_SET outline;
424 
425  // Draw the polygon: Inflate creates only one convex polygon
426  if( outline.OutlineCount() > 0 )
427  {
428  SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
429 
430  if( poly.PointCount() > 0 )
431  {
432  GRClosedPoly( aClipBox, aDC, poly.PointCount(),
433  (wxPoint*)&poly.Point( 0 ), false, 0,
434  aDrawInfo.m_Color, aDrawInfo.m_Color );
435  }
436  }
437  }
438  break;
439 
441  case PAD_SHAPE_ROUNDRECT:
442  {
443  // Use solder[Paste/Mask]size or pad size to build pad shape to draw
444  wxSize size( GetSize() );
445  size += aDrawInfo.m_Mask_margin * 2;
446  int corner_radius = GetRoundRectCornerRadius( size );
447  bool doChamfer = GetShape() == PAD_SHAPE_CHAMFERED_RECT;
448 
449  SHAPE_POLY_SET outline;
450  TransformRoundChamferedRectToPolygon( outline, shape_pos, size, GetOrientation(),
451  corner_radius, GetChamferRectRatio(),
452  doChamfer ? GetChamferPositions() : 0,
453  SEGCOUNT );
454 
455  // Draw the polygon: Inflate creates only one convex polygon
456  bool filled = aDrawInfo.m_ShowPadFilled;
457 
458  SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
459 
460  GRClosedPoly( aClipBox, aDC, poly.PointCount(),
461  (wxPoint*)&poly.Point( 0 ), filled, 0,
462  aDrawInfo.m_Color, aDrawInfo.m_Color );
463 
464  if( aDrawInfo.m_PadClearance )
465  {
466  outline.RemoveAllContours();
467  size = GetSize();
468  size.x += aDrawInfo.m_PadClearance * 2;
469  size.y += aDrawInfo.m_PadClearance * 2;
470  corner_radius = GetRoundRectCornerRadius() + aDrawInfo.m_PadClearance;
471 
472  TransformRoundChamferedRectToPolygon( outline, shape_pos, size, GetOrientation(),
473  corner_radius, GetChamferRectRatio(),
474  doChamfer ? GetChamferPositions() : 0,
475  SEGCOUNT );
476 
477  // Draw the polygon: Inflate creates only one convex polygon
478  SHAPE_LINE_CHAIN& clearance_poly = outline.Outline( 0 );
479 
480  GRClosedPoly( aClipBox, aDC, clearance_poly.PointCount(),
481  (wxPoint*)&clearance_poly.Point( 0 ), false, 0,
482  aDrawInfo.m_Color, aDrawInfo.m_Color );
483  }
484  }
485  break;
486 
487  case PAD_SHAPE_CUSTOM:
488  {
489  // The full shape has 2 items
490  // 1- The anchor pad: a round or rect pad located at pad position
491  // 2- The custom complex shape
492  // Note: The anchor pad shape is containing by the custom complex shape polygon
493  // The anchor pad is shown to help user to see where is the anchor, only in sketch mode
494  // (In filled mode, it is merged with the basic shapes)
495  wxPoint pad_pos = GetPosition() - aDrawInfo.m_Offset;
496 
497  // In sketch mode only: Draw the anchor pad: a round or rect pad
498  if( !aDrawInfo.m_ShowPadFilled )
499  {
501  {
502  wxPoint poly[4];
503  poly[0] = wxPoint( - halfsize.x, - halfsize.y );
504  poly[1] = wxPoint( - halfsize.x, + halfsize.y );
505  poly[2] = wxPoint( + halfsize.x, + halfsize.y );
506  poly[3] = wxPoint( + halfsize.x, - halfsize.y );
507 
508  for( int ii = 0; ii < 4; ++ii )
509  {
510  RotatePoint( &poly[ii], m_Orient );
511  poly[ii] += pad_pos;
512  }
513 
514  GRClosedPoly( aClipBox, aDC, 4, poly, false, 0,
515  aDrawInfo.m_Color, aDrawInfo.m_Color );
516  }
517  else
518  {
519  GRCircle( aClipBox, aDC, pad_pos.x, pad_pos.y,
520  halfsize.x,
521  m_PadSketchModePenSize, aDrawInfo.m_Color );
522  }
523  }
524 
525  SHAPE_POLY_SET outline; // Will contain the corners in board coordinates
526  outline.Append( m_customShapeAsPolygon );
527  CustomShapeAsPolygonToBoardPosition( &outline, pad_pos, GetOrientation() );
528  SHAPE_LINE_CHAIN* poly;
529 
530  const int segmentToCircleCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
531 
532  if( aDrawInfo.m_Mask_margin.x )
533  outline.InflateWithLinkedHoles( aDrawInfo.m_Mask_margin.x,
534  segmentToCircleCount, SHAPE_POLY_SET::PM_FAST );
535 
536  // Draw the polygon: only one polygon is expected
537  // However we provide a multi polygon shape drawing
538  // ( can happen with CUSTOM pads and negative margins )
539  for( int jj = 0; jj < outline.OutlineCount(); ++jj )
540  {
541  poly = &outline.Outline( jj );
542 
543  GRClosedPoly( aClipBox, aDC, poly->PointCount(),
544  (wxPoint*)&poly->Point( 0 ), aDrawInfo.m_ShowPadFilled, 0,
545  aDrawInfo.m_Color, aDrawInfo.m_Color );
546  }
547 
548  if( aDrawInfo.m_PadClearance )
549  {
550  SHAPE_POLY_SET clearance_outline;
551  clearance_outline.Append( outline );
552 
553  clearance_outline.InflateWithLinkedHoles( aDrawInfo.m_PadClearance,
554  segmentToCircleCount, SHAPE_POLY_SET::PM_FAST );
555 
556  for( int jj = 0; jj < clearance_outline.OutlineCount(); ++jj )
557  {
558  poly = &clearance_outline.Outline( jj );
559 
560  if( poly->PointCount() > 0 )
561  {
562  GRClosedPoly( aClipBox, aDC, poly->PointCount(),
563  (wxPoint*)&poly->Point( 0 ), false, 0,
564  aDrawInfo.m_Color, aDrawInfo.m_Color );
565  }
566  }
567  }
568  break;
569  }
570  }
571 
572  // Draw the pad hole
573  wxPoint holepos = m_Pos - aDrawInfo.m_Offset;
574  int hole = m_Drill.x >> 1;
575 
576  bool drawhole = hole > 0;
577 
578  if( !aDrawInfo.m_ShowPadFilled && !aDrawInfo.m_ShowNotPlatedHole )
579  drawhole = false;
580 
581  if( drawhole )
582  {
583  bool blackpenstate = false;
584  COLOR4D fillcolor = aDrawInfo.m_ShowNotPlatedHole? aDrawInfo.m_NPHoleColor :
585  aDrawInfo.m_HoleColor;
586  COLOR4D hole_color = fillcolor;
587 
588  if( aDrawInfo.m_IsPrinting )
589  {
590  fillcolor = COLOR4D::WHITE;
591  blackpenstate = GetGRForceBlackPenState();
592  GRForceBlackPen( false );
593  }
594  else
595  {
596  GRSetDrawMode( aDC, ( aDrawInfo.m_DrawMode != GR_XOR ) ? GR_COPY : GR_XOR );
597  }
598 
599  if( blackpenstate )
600  hole_color = COLOR4D::BLACK;
601 
602  switch( GetDrillShape() )
603  {
605  if( aDC->LogicalToDeviceXRel( hole ) > 1 ) // hole is drawn if hole > 1pixel
606  GRFilledCircle( aClipBox, aDC, holepos.x, holepos.y, hole, 0,
607  hole_color, fillcolor );
608  break;
609 
611  {
612  wxPoint drl_start, drl_end;
613  GetOblongDrillGeometry( drl_start, drl_end, seg_width );
614  drl_start += holepos;
615  drl_end += holepos;
616  GRFilledSegment( aClipBox, aDC, drl_start, drl_end, seg_width, fillcolor );
617  GRCSegm( aClipBox, aDC, drl_start, drl_end, seg_width, hole_color );
618  }
619  break;
620 
621  default:
622  break;
623  }
624 
625  if( aDrawInfo.m_IsPrinting )
626  GRForceBlackPen( blackpenstate );
627  }
628 
629  GRSetDrawMode( aDC, aDrawInfo.m_DrawMode );
630 
631  // Draw "No connect" ( / or \ or cross X ) if necessary
632  if( GetNetCode() == 0 && aDrawInfo.m_ShowNCMark )
633  {
634  int dx0 = std::min( halfsize.x, halfsize.y );
635 
636  if( m_layerMask[F_Cu] ) /* Draw \ */
637  GRLine( aClipBox, aDC, holepos.x - dx0, holepos.y - dx0,
638  holepos.x + dx0, holepos.y + dx0, 0, aDrawInfo.m_NoNetMarkColor );
639 
640  if( m_layerMask[B_Cu] ) // Draw /
641  GRLine( aClipBox, aDC, holepos.x + dx0, holepos.y - dx0,
642  holepos.x - dx0, holepos.y + dx0, 0, aDrawInfo.m_NoNetMarkColor );
643  }
644 
645  if( !aDrawInfo.m_IsPrinting )
646  GRSetDrawMode( aDC, ( aDrawInfo.m_DrawMode != GR_XOR ) ? GR_COPY : GR_XOR );
647 
648  // Draw the pad number
649  if( !aDrawInfo.m_Display_padnum && !aDrawInfo.m_Display_netname )
650  return;
651 
652  wxPoint tpos0 = shape_pos; // Position of the centre of text
653  wxPoint tpos = tpos0;
654  wxSize AreaSize; // size of text area, normalized to AreaSize.y < AreaSize.x
655  wxString shortname;
656  int shortname_len = 0;
657 
658  if( aDrawInfo.m_Display_netname )
659  {
660  shortname = UnescapeString( GetShortNetname() );
661  shortname_len = shortname.Len();
662  }
663 
664  if( GetShape() == PAD_SHAPE_CIRCLE )
665  angle = 0;
666 
667  AreaSize = m_Size;
668 
669  if( m_Size.y > m_Size.x )
670  {
671  angle += 900;
672  AreaSize.x = m_Size.y;
673  AreaSize.y = m_Size.x;
674  }
675 
676  if( shortname_len > 0 ) // if there is a netname, provides room to display this netname
677  {
678  AreaSize.y /= 2; // Text used only the upper area of the
679  // pad. The lower area displays the net name
680  tpos.y -= AreaSize.y / 2;
681  }
682 
683  // Calculate the position of text, that is the middle point of the upper
684  // area of the pad
685  RotatePoint( &tpos, shape_pos, angle );
686 
687  // Draw text with an angle between -90 deg and + 90 deg
688  double t_angle = angle;
689  NORMALIZE_ANGLE_90( t_angle );
690 
691  /* Note: in next calculations, texte size is calculated for 3 or more
692  * chars. Of course, pads numbers and nets names can have less than 3
693  * chars. but after some tries, i found this is gives the best look
694  */
695  constexpr int MIN_CHAR_COUNT = 3;
696 
697  unsigned int tsize;
698  EDA_RECT* clipBox = aDrawInfo.m_DrawPanel ? aDrawInfo.m_DrawPanel->GetClipBox() : NULL;
699 
700  if( aDrawInfo.m_Display_padnum )
701  {
702  int numpad_len = std::max( (int) m_name.Length(), MIN_CHAR_COUNT );
703  tsize = std::min( (int) AreaSize.y, AreaSize.x / numpad_len );
704 
705  if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) // Not drawable when size too small.
706  {
707  // tsize reserve room for marges and segments thickness
708  tsize = ( tsize * 7 ) / 10;
709  DrawGraphicHaloText( clipBox, aDC, tpos,
710  aDrawInfo.m_Color, BLACK, WHITE,
711  m_name, t_angle,
712  wxSize( tsize , tsize ), GR_TEXT_HJUSTIFY_CENTER,
713  GR_TEXT_VJUSTIFY_CENTER, tsize / 7, false, false );
714 
715  }
716  }
717 
718  // display the short netname, if exists
719  if( shortname_len == 0 )
720  return;
721 
722  shortname_len = std::max( shortname_len, MIN_CHAR_COUNT );
723  tsize = std::min( AreaSize.y, AreaSize.x / shortname_len );
724 
725  if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) // Not drawable in size too small.
726  {
727  tpos = tpos0;
728 
729  if( aDrawInfo.m_Display_padnum )
730  tpos.y += AreaSize.y / 2;
731 
732  RotatePoint( &tpos, shape_pos, angle );
733 
734  // tsize reserve room for marges and segments thickness
735  tsize = ( tsize * 7 ) / 10;
736  DrawGraphicHaloText( clipBox, aDC, tpos,
737  aDrawInfo.m_Color, BLACK, WHITE,
738  shortname, t_angle, wxSize( tsize, tsize ),
740  tsize / 7, false, false );
741  }
742 }
static int m_PadSketchModePenSize
Pen size used to draw pads in sketch mode (mode used to print pads on silkscreen layer)
Definition: class_pad.h:138
int GetNetCode() const
Function GetNetCode.
int OutlineCount() const
Returns the number of outlines in the set
bool m_Display_padnum
Definition: class_pad.h:75
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:228
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 seg...
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:837
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:878
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:415
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aCircleToSegmentsCount)
convert a rectangle with rounded corners and/or chamfered corners to a polygon Convert rounded corner...
COLOR4D m_NoNetMarkColor
Definition: class_pad.h:72
virtual EDA_RECT * GetClipBox()
bool m_ShowNCMark
Definition: class_pad.h:79
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
void GRFilledCircle(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:778
int PointCount() const
Function PointCount()
void DrawGraphicHaloText(EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4D aColor1, COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Draw graphic text with a border, so that it can be read on different backgrounds.
void NORMALIZE_ANGLE_90(T &Angle)
Definition: trigo.h:329
void GRClosedPoly(EDA_RECT *ClipBox, wxDC *DC, int n, wxPoint Points[], bool Fill, COLOR4D Color, COLOR4D BgColor)
Function GRClosedPoly draws a closed polygon onto the drawing context aDC and optionally fills and/or...
Definition: gr_basic.cpp:711
bool m_IsPrinting
Definition: class_pad.h:82
#define MIN_TEXT_SIZE
int GetChamferPositions() const
has meaning only for chamfered rect pads
Definition: class_pad.h:695
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount, double aCorrectionFactor, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon Used in filli...
wxString m_name
Definition: class_pad.h:843
void GRForceBlackPen(bool flagforce)
Function GRForceBlackPen.
Definition: gr_basic.cpp:204
Class SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
void GRFillCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:518
GR_DRAWMODE m_DrawMode
Definition: class_pad.h:67
EDA_DRAW_PANEL * m_DrawPanel
Definition: class_pad.h:66
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:400
double GetChamferRectRatio() const
has meaning only for chamfered rect pads
Definition: class_pad.h:672
COLOR4D m_HoleColor
Definition: class_pad.h:70
bool m_ShowNotPlatedHole
Definition: class_pad.h:80
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:861
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:285
int m_PadClearance
Definition: class_pad.h:73
void BuildPadPolygon(wxPoint aCoord[4], wxSize aInflateValue, double aRotation) const
Function BuildPadPolygon Has meaning only for polygonal pads (trapezoid and rectangular) Build the Co...
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:907
wxPoint m_Offset
Definition: class_pad.h:83
#define max(a, b)
Definition: auxiliary.h:86
Class SHAPE_LINE_CHAIN.
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:394
void CustomShapeAsPolygonToBoardPosition(SHAPE_POLY_SET *aMergedPolygon, wxPoint aPosition, double aRotation) const
When created, the corners coordinates are relative to the pad position, orientation 0,...
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:123
void GRFilledSegment(EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor)
Definition: gr_basic.cpp:526
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:755
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
wxPoint ShapePos() const
Definition: class_pad.cpp:562
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
void InflateWithLinkedHoles(int aFactor, int aCircleSegmentsCount, POLYGON_MODE aFastMode)
Performs outline inflation/deflation, using round corners.
Definition: colors.h:49
bool m_ShowPadFilled
Definition: class_pad.h:77
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:543
COLOR4D m_NPHoleColor
Definition: class_pad.h:71
COLOR4D m_Color
Definition: class_pad.h:68
VECTOR2I & Point(int aIndex)
Function Point()
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:874
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:218
Definition: colors.h:45
double m_Orient
in 1/10 degrees
Definition: class_pad.h:918
bool m_Display_netname
Definition: class_pad.h:76
const wxSize & GetSize() const
Definition: class_pad.h:271
bool GetGRForceBlackPenState(void)
Function GetGRForceBlackPenState.
Definition: gr_basic.cpp:214
const wxPoint GetPosition() const override
Definition: class_pad.h:222
wxSize m_Mask_margin
Definition: class_pad.h:74
#define ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF
Definition: pcbnew.h:42
const wxString & GetShortNetname() const
Function GetShortNetname.
#define min(a, b)
Definition: auxiliary.h:85
#define SEGCOUNT
wxPoint m_Pos
pad Position on board
Definition: class_pad.h:846
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)
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References PNS::angle(), SHAPE_POLY_SET::Append(), ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF, B_Cu, BLACK, BuildPadPolygon(), BuildSegmentFromOvalShape(), CustomShapeAsPolygonToBoardPosition(), DrawGraphicHaloText(), F_Cu, GetAnchorPadShape(), GetChamferPositions(), GetChamferRectRatio(), EDA_DRAW_PANEL::GetClipBox(), GetDrillShape(), GetGRForceBlackPenState(), BOARD_CONNECTED_ITEM::GetNetCode(), GetOblongDrillGeometry(), GetOrientation(), GetPosition(), GetRoundRectCornerRadius(), GetShape(), BOARD_CONNECTED_ITEM::GetShortNetname(), GetSize(), GR_COPY, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_XOR, GRCircle(), GRClosedPoly(), GRCSegm(), GRFillCSegm(), GRFilledCircle(), GRFilledSegment(), GRForceBlackPen(), GRLine(), GRSetDrawMode(), SHAPE_POLY_SET::InflateWithLinkedHoles(), PAD_DRAWINFO::m_Color, m_customShapeAsPolygon, PAD_DRAWINFO::m_Display_netname, PAD_DRAWINFO::m_Display_padnum, PAD_DRAWINFO::m_DrawMode, PAD_DRAWINFO::m_DrawPanel, m_Drill, PAD_DRAWINFO::m_HoleColor, PAD_DRAWINFO::m_IsPrinting, m_layerMask, PAD_DRAWINFO::m_Mask_margin, m_name, PAD_DRAWINFO::m_NoNetMarkColor, PAD_DRAWINFO::m_NPHoleColor, PAD_DRAWINFO::m_Offset, m_Orient, PAD_DRAWINFO::m_PadClearance, m_PadSketchModePenSize, m_Pos, PAD_DRAWINFO::m_ShowNCMark, PAD_DRAWINFO::m_ShowNotPlatedHole, PAD_DRAWINFO::m_ShowPadFilled, m_Size, max, min, MIN_TEXT_SIZE, NORMALIZE_ANGLE_90(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG, PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, SHAPE_POLY_SET::PM_FAST, SHAPE_LINE_CHAIN::Point(), SHAPE_LINE_CHAIN::PointCount(), SHAPE_POLY_SET::RemoveAllContours(), RotatePoint(), SEGCOUNT, ShapePos(), TransformRoundChamferedRectToPolygon(), TransformShapeWithClearanceToPolygon(), UnescapeString(), and WHITE.

Referenced by Draw(), and DIALOG_PAD_PROPERTIES::OnPaintShowPanel().

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

787  {
788  return (D_PAD*) Clone();
789  }
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_pad.cpp:1302

References Clone().

◆ Flip() [1/2]

void BOARD_ITEM::Flip ( const VECTOR2I aCentre)
inlineinherited

Definition at line 270 of file class_board_item.h.

271  {
272  Flip( wxPoint( aCentre.x, aCentre.y ) );
273  }
virtual void Flip(const wxPoint &aCentre)
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)
overridevirtual

Function Flip Flip this object, i.e.

change the board side for this object

Parameters
aCentre- the rotation point.

Reimplemented from BOARD_ITEM.

Definition at line 436 of file class_pad.cpp.

437 {
438  int y = GetPosition().y;
439  MIRROR( y, aCentre.y ); // invert about x axis.
440  SetY( y );
441 
442  MIRROR( m_Pos0.y, 0 );
443  MIRROR( m_Offset.y, 0 );
444  MIRROR( m_DeltaSize.y, 0 );
445 
447 
448  // flip pads layers
449  // PADS items are currently on all copper layers, or
450  // currently, only on Front or Back layers.
451  // So the copper layers count is not taken in account
453 
454  // Flip the basic shapes, in custom pads
455  FlipPrimitives();
456 
457  // m_boundingRadius = -1; the shape has not been changed
458 }
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask,...
Definition: lset.cpp:521
void FlipPrimitives()
Flip the basic shapes, in custom pads.
Definition: class_pad.cpp:462
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:122
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:911
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:907
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:413
void SetY(int y)
Definition: class_pad.h:261
wxPoint m_Pos0
Initial Pad position (i.e.
Definition: class_pad.h:913
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:394
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:429
wxPoint m_Offset
m_Offset is useful only for oblong and rect pads (it can be used for other shapes,...
Definition: class_pad.h:905
const wxPoint GetPosition() const override
Definition: class_pad.h:222

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

◆ FlipPrimitives()

void D_PAD::FlipPrimitives ( )

Flip the basic shapes, in custom pads.

Definition at line 462 of file class_pad.cpp.

463 {
464  // Flip custom shapes
465  for( unsigned ii = 0; ii < m_basicShapes.size(); ++ii )
466  {
467  PAD_CS_PRIMITIVE& primitive = m_basicShapes[ii];
468 
469  MIRROR( primitive.m_Start.y, 0 );
470  MIRROR( primitive.m_End.y, 0 );
471  primitive.m_ArcAngle = -primitive.m_ArcAngle;
472 
473  switch( primitive.m_Shape )
474  {
475  case S_POLYGON: // polygon
476  for( unsigned jj = 0; jj < primitive.m_Poly.size(); jj++ )
477  MIRROR( primitive.m_Poly[jj].y, 0 );
478  break;
479 
480  default:
481  break;
482  }
483  }
484 
485  // Flip local coordinates in merged Polygon
486  for( int cnt = 0; cnt < m_customShapeAsPolygon.OutlineCount(); ++cnt )
487  {
489 
490  for( int ii = 0; ii < poly.PointCount(); ++ii )
491  MIRROR( poly.Point( ii ).y, 0 );
492  }
493 }
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:856
int OutlineCount() const
Returns the number of outlines in the set
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:100
polygon (not yet used for tracks, but could be in microwave apps)
int PointCount() const
Function PointCount()
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:122
std::vector< wxPoint > m_Poly
Bezier Control point 2.
Definition: class_pad.h:104
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:91
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:861
wxPoint m_End
is also the center of the circle and arc
Definition: class_pad.h:101
STROKE_T m_Shape
Definition: class_pad.h:94
Class SHAPE_LINE_CHAIN.
VECTOR2I & Point(int aIndex)
Function Point()
double m_ArcAngle
radius of a circle
Definition: class_pad.h:99

References PAD_CS_PRIMITIVE::m_ArcAngle, m_basicShapes, m_customShapeAsPolygon, PAD_CS_PRIMITIVE::m_End, PAD_CS_PRIMITIVE::m_Poly, PAD_CS_PRIMITIVE::m_Shape, PAD_CS_PRIMITIVE::m_Start, MIRROR(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::Point(), SHAPE_LINE_CHAIN::PointCount(), S_POLYGON, and VECTOR2< T >::y.

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

◆ GetAnchorPadShape()

PAD_SHAPE_T D_PAD::GetAnchorPadShape ( ) const
inline

Function GetAnchorPadShape.

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

Definition at line 228 of file class_pad.h.

228 { 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:888

References m_anchorPadShape.

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

◆ GetAttribute()

◆ GetBestAnchorPosition()

bool D_PAD::GetBestAnchorPosition ( VECTOR2I aPos)

Definition at line 363 of file pad_custom_shape_functions.cpp.

364 {
365  SHAPE_POLY_SET poly;
366 
368  return false;
369 
370  const int minSteps = 10;
371  const int maxSteps = 50;
372 
373  int stepsX, stepsY;
374 
375  auto bbox = poly.BBox();
376 
377  if( bbox.GetWidth() < bbox.GetHeight() )
378  {
379  stepsX = minSteps;
380  stepsY = minSteps * (double) bbox.GetHeight() / (double )(bbox.GetWidth() + 1);
381  }
382  else
383  {
384  stepsY = minSteps;
385  stepsX = minSteps * (double) bbox.GetWidth() / (double )(bbox.GetHeight() + 1);
386  }
387 
388  stepsX = std::max(minSteps, std::min( maxSteps, stepsX ) );
389  stepsY = std::max(minSteps, std::min( maxSteps, stepsY ) );
390 
391  auto center = bbox.Centre();
392 
393  auto minDist = std::numeric_limits<int64_t>::max();
394  int64_t minDistEdge;
395 
397  {
398  minDistEdge = GetSize().x;
399  }
400  else
401  {
402  minDistEdge = std::max( GetSize().x, GetSize().y );
403  }
404 
405  OPT<VECTOR2I> bestAnchor( []()->OPT<VECTOR2I> { return NULLOPT; }() );
406 
407  for ( int y = 0; y < stepsY ; y++ )
408  {
409  for ( int x = 0; x < stepsX; x++ )
410  {
411  VECTOR2I p = bbox.GetPosition();
412  p.x += rescale( x, bbox.GetWidth(), (stepsX - 1) );
413  p.y += rescale( y, bbox.GetHeight(), (stepsY - 1) );
414 
415  if ( poly.Contains(p) )
416  {
417 
418  auto dist = (center - p).EuclideanNorm();
419  auto distEdge = poly.COutline(0).Distance( p, true );
420  if ( distEdge >= minDistEdge )
421  {
422  if ( dist < minDist )
423  {
424  bestAnchor = p;
425  minDist = dist;
426  }
427  }
428  }
429  }
430  }
431 
432  if ( bestAnchor )
433  {
434  aPos = *bestAnchor;
435  return true;
436  }
437 
438  return false;
439 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:121
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, bool aIgnoreHoles=false) const
Returns true if a given subpolygon contains the point aP.
static const int dist[10][10]
Definition: ar_matrix.cpp:320
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:228
#define ARC_APPROX_SEGMENTS_COUNT_LOW_DEF
Definition: pcbnew.h:41
int Distance(const VECTOR2I &aP, bool aOutlineOnly=false) const
Function Distance()
const auto NULLOPT
Definition: optional.h:9
Class SHAPE_POLY_SET.
#define max(a, b)
Definition: auxiliary.h:86
T rescale(T aNumerator, T aValue, T aDenominator)
Function rescale()
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
coord_type GetHeight() const
Definition: box2.h:196
boost::optional< T > OPT
Definition: optional.h:7
bool buildCustomPadPolygon(SHAPE_POLY_SET *aMergedPolygon, int aCircleToSegmentsCount)
const wxSize & GetSize() const
Definition: class_pad.h:271
const BOX2I BBox(int aClearance=0) const override
Function BBox()
#define min(a, b)
Definition: auxiliary.h:85

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

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 64 of file class_board_item.cpp.

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

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

Referenced by DeleteMarkedItems(), TEXTE_PCB::Draw(), PCB_TARGET::Draw(), ZONE_CONTAINER::Draw(), EDGE_MODULE::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DIMENSION::Draw(), DRAWSEGMENT::Draw(), MODULE::Draw(), VIA::Draw(), Draw(), MODULE::DrawAncre(), ZONE_CONTAINER::DrawFilledArea(), TEXTE_PCB::Flip(), TRACK::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingPoly(), 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(), EAGLE_PLUGIN::packageWire(), PushTrack(), BOARD_CONNECTED_ITEM::SetNet(), BOARD_CONNECTED_ITEM::SetNetCode(), 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 226 of file class_pad.cpp.

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

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

Referenced by AR_AUTOPLACER::addPad(), CreateThermalReliefPadPolygon(), HitTest(), PCB_BASE_FRAME::Import_Pad_Settings(), DSN::SPECCTRA_DB::makePADSTACK(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), 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 624 of file class_pad.h.

625  {
626  // Any member function which would affect this calculation should set
627  // m_boundingRadius to -1 to re-trigger the calculation from here.
628  // Currently that is only m_Size, m_DeltaSize, and m_padShape accessors.
629  if( m_boundingRadius == -1 )
630  {
632  }
633 
634  return m_boundingRadius;
635  }
int m_boundingRadius
radius of the circle containing the pad shape
Definition: class_pad.h:841
int boundingRadius() const
Function boundingRadius returns a calculated radius of a bounding circle for this pad.
Definition: class_pad.cpp:143

References boundingRadius(), and m_boundingRadius.

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

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

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

References BOARD_ITEM::GetPosition().

Referenced by BOARD::chainMarkedSegments(), and LEGACY_ARRAY_CREATOR::getRotationCentre().

◆ GetChamferPositions()

int D_PAD::GetChamferPositions ( ) const
inline

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

673  {
674  return m_padChamferRectScale;
675  }
double m_padChamferRectScale
scaling factor from smallest m_Size coord to chamfer value, default 0.25
Definition: class_pad.h:884

References m_padChamferRectScale.

Referenced by DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), CINFO3D_VISU::createNewPadWithClearance(), KIGFX::PCB_PAINTER::draw(), DrawShape(), PCB_IO::format(), HitTest(), ImportSettingsFromMaster(), DSN::SPECCTRA_DB::makePADSTACK(), BRDITEMS_PLOTTER::PlotPad(), 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 725 of file class_pad.h.

726  {
727  return wxT( "PAD" );
728  }

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

609 {
610  // A pad can have specific clearance parameters that
611  // overrides its NETCLASS clearance value
612  int clearance = m_LocalClearance;
613 
614  if( clearance == 0 )
615  {
616  // If local clearance is 0, use the parent footprint clearance value
617  if( GetParent() && GetParent()->GetLocalClearance() )
618  clearance = GetParent()->GetLocalClearance();
619  }
620 
621  if( clearance == 0 ) // If the parent footprint clearance value = 0, use NETCLASS value
622  return BOARD_CONNECTED_ITEM::GetClearance( aItem );
623 
624  // We have a specific clearance.
625  // if aItem, return the biggest clearance
626  if( aItem )
627  {
628  int hisClearance = aItem->GetClearance();
629  return std::max( hisClearance, clearance );
630  }
631 
632  // Return the specific clearance.
633  return clearance;
634 }
int m_LocalClearance
Local clearance.
Definition: class_pad.h:925
int GetLocalClearance() const
Definition: class_pad.h:429
int GetLocalClearance() const
Definition: class_module.h:207
MODULE * GetParent() const
Definition: class_pad.h:164
#define max(a, b)
Definition: auxiliary.h:86
virtual int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const
Function GetClearance returns the clearance in internal units.

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

Referenced by ZONE_FILLER::buildZoneFeatureHoleList(), DRC::checkClearancePadToPad(), KIGFX::PCB_PAINTER::draw(), Draw(), and DRC::testPad2Pad().

◆ GetCustomShapeAsPolygon()

const SHAPE_POLY_SET& D_PAD::GetCustomShapeAsPolygon ( ) const
inline

Accessor to the custom shape as one polygon.

Definition at line 346 of file class_pad.h.

346 { 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:861

References m_customShapeAsPolygon.

Referenced by CINFO3D_VISU::buildPadShapePolygon(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), CINFO3D_VISU::createNewPadWithClearance(), CreatePadsShapesSection(), KIGFX::PCB_PAINTER::draw(), 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 234 of file class_pad.h.

235  {
237  }
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:869

References m_customShapeClearanceArea.

Referenced by 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 263 of file base_struct.h.

264  {
268  return m_Flags & mask;
269  }
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:133
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:132
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:148
#define SELECTED
Definition: base_struct.h:121
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137
#define DP_COUPLED
item is coupled with another item making a differential pair
Definition: base_struct.h:139
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:136
#define IS_DANGLING
indicates a pin is dangling
Definition: base_struct.h:143
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:120
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:119

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

Referenced by AbortMoveAndEditTarget(), SCH_EDIT_TOOL::ChangeShape(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::ConvertTextType(), PCB_EDIT_FRAME::createPopUpMenuForFootprints(), PCB_EDIT_FRAME::createPopUpMenuForFpPads(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), PCB_EDIT_FRAME::createPopUpMenuForTexts(), PCB_EDIT_FRAME::createPopupMenuForTracks(), PCB_EDIT_FRAME::createPopUpMenuForZones(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteJunction(), PCB_BASE_FRAME::DeleteTextModule(), BOARD::Draw(), PCB_EDIT_FRAME::Edit_TrackSegm_Width(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditImage(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_VIEW_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), EDA_DRAW_PANEL::OnMouseEvent(), FOOTPRINT_EDIT_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), PCB_BASE_FRAME::RotateTextModule(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

◆ GetFlags()

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Function GetLayer returns the primary layer this item is on.

Reimplemented in ZONE_CONTAINER.

Definition at line 123 of file class_board_item.h.

123 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by Abort_MoveOrCopyModule(), DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), CN_CONNECTIVITY_ALGO::Add(), CN_LIST::Add(), CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), DIMENSION::AdjustDimensionDetails(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), AR_AUTOPLACER::buildFpAreas(), PCB_EDIT_FRAME::Change_Side_Module(), checkConnectedTo(), MODULE::CopyNetlistSettings(), 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(), PCB_EDIT_FRAME::DoGenFootprintsPositionFile(), DRC::doTrackKeepoutDrc(), TEXTE_MODULE::Draw(), DRAWSEGMENT::Draw(), KIGFX::PCB_PAINTER::draw(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Width(), export_vrml_drawsegment(), export_vrml_edge_module(), export_vrml_module(), export_vrml_pcbtext(), export_vrml_text_module(), PCB_EDIT_FRAME::ExportToGenCAD(), TEXTE_PCB::Flip(), PCB_TARGET::Flip(), EDGE_MODULE::Flip(), TEXTE_MODULE::Flip(), TRACK::Flip(), DIMENSION::Flip(), MODULE::Flip(), DRAWSEGMENT::Flip(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::formatLayer(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), BOARD::GetFootprint(), ZONE_CONTAINER::GetLayer(), AR_AUTOPLACER::getOptimalModulePlacement(), BOARD::GetPad(), TEXT_MOD_GRID_TABLE::GetValueAsLong(), BOARD::GetVisibleTrack(), SELECTION_TOOL::guessSelectionCandidates(), idf_export_module(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), IsFlipped(), MODULE::IsFlipped(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), BOARD::MarkTrace(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), PCB_EDIT_FRAME::OnRightClick(), EAGLE_PLUGIN::packagePad(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), 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(), processBoardItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::ResetTextSize(), SELECTION_TOOL::selectable(), TEXT_MOD_GRID_TABLE::SetValueAsLong(), ShowClearance(), 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(), TraceSegmentPcb(), TrackListSortByNetcode(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), TEXTE_MODULE::ViewGetLayers(), TRACK::ViewGetLayers(), TEXTE_MODULE::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

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

Returns
wxString containing the layer name associated with this item.

Definition at line 78 of file class_board_item.cpp.

79 {
80  BOARD* board = GetBoard();
81 
82  if( board )
83  return board->GetLayerName( m_Layer );
84 
85  // If no parent, return standard name
87 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
PCB_LAYER_ID m_Layer
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
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:654

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

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

◆ GetLayerSet()

◆ GetList()

DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited

◆ GetLocalClearance()

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

Definition at line 189 of file board_connected_item.h.

190  {
191  return m_localRatsnestVisible;
192  }

References BOARD_CONNECTED_ITEM::m_localRatsnestVisible.

◆ GetLocalSolderMaskMargin()

int D_PAD::GetLocalSolderMaskMargin ( ) const
inline

Definition at line 426 of file class_pad.h.

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

References m_LocalSolderMaskMargin.

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

◆ GetLocalSolderPasteMargin()

int D_PAD::GetLocalSolderPasteMargin ( ) const
inline

Definition at line 432 of file class_pad.h.

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

References m_LocalSolderPasteMargin.

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

◆ GetLocalSolderPasteMarginRatio()

double D_PAD::GetLocalSolderPasteMarginRatio ( ) const
inline

Definition at line 435 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:932

References m_LocalSolderPasteMarginRatio.

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

◆ GetMenuImage()

BITMAP_DEF D_PAD::GetMenuImage ( ) const
overridevirtual

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

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

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 1296 of file class_pad.cpp.

1297 {
1298  return pad_xpm;
1299 }

◆ GetMsgPanelInfo()

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 770 of file class_pad.cpp.

771 {
772  MODULE* module;
773  wxString msg;
774  BOARD* board;
775 
776  module = (MODULE*) m_Parent;
777 
778  if( module )
779  {
780  aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), module->GetReference(), DARKCYAN ) );
781  aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), m_name, BROWN ) );
782  }
783 
784  aList.push_back( MSG_PANEL_ITEM( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN ) );
785 
786  board = GetBoard();
787 
788  aList.push_back( MSG_PANEL_ITEM( _( "Layer" ),
789  LayerMaskDescribe( board, m_layerMask ), DARKGREEN ) );
790 
791  aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) );
792 
793  msg = MessageTextFromValue( aUnits, m_Size.x, true );
794  aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
795 
796  msg = MessageTextFromValue( aUnits, m_Size.y, true );
797  aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
798 
799  msg = MessageTextFromValue( aUnits, m_Drill.x, true );
800 
802  {
803  aList.push_back( MSG_PANEL_ITEM( _( "Drill" ), msg, RED ) );
804  }
805  else
806  {
807  msg = MessageTextFromValue( aUnits, m_Drill.x, true )
808  + wxT( "/" )
809  + MessageTextFromValue( aUnits, m_Drill.y, true );
810  aList.push_back( MSG_PANEL_ITEM( _( "Drill X / Y" ), msg, RED ) );
811  }
812 
813  double module_orient_degrees = module ? module->GetOrientationDegrees() : 0;
814 
815  if( module_orient_degrees != 0.0 )
816  msg.Printf( wxT( "%3.1f(+%3.1f)" ),
817  GetOrientationDegrees() - module_orient_degrees,
818  module_orient_degrees );
819  else
820  msg.Printf( wxT( "%3.1f" ), GetOrientationDegrees() );
821 
822  aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, LIGHTBLUE ) );
823 
824  msg = MessageTextFromValue( aUnits, m_Pos.x )
825  + wxT( ", " )
826  + MessageTextFromValue( aUnits, m_Pos.y );
827  aList.push_back( MSG_PANEL_ITEM( _( "Position" ), msg, LIGHTBLUE ) );
828 
829  if( GetPadToDieLength() )
830  {
831  msg = MessageTextFromValue( aUnits, GetPadToDieLength(), true );
832  aList.push_back( MSG_PANEL_ITEM( _( "Length in package" ), msg, CYAN ) );
833  }
834 }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
double GetOrientationDegrees() const
Definition: class_pad.h:395
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:878
int GetPadToDieLength() const
Definition: class_pad.h:424
wxString ShowPadAttr() const
Function ShowPadAttr.
Definition: class_pad.cpp:1256
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:462
wxString MessageTextFromValue(EDA_UNITS_T aUnits, int aValue, bool aUseMils)
Definition: base_units.cpp:125
wxString m_name
Definition: class_pad.h:843
wxString ShowPadShape() const
Function ShowPadShape.
Definition: class_pad.cpp:1225
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:400
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:189
Definition: colors.h:60
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:907
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:123
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE,...
Definition: class_pad.h:874
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
static wxString LayerMaskDescribe(const BOARD *aBoard, LSET aMask)
Helper function Return a string (to be shown to the user) describing a layer mask.
Definition: class_pad.cpp:1430
wxPoint m_Pos
pad Position on board
Definition: class_pad.h:846
Definition: colors.h:62

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

◆ GetName()

◆ GetNet()

NETINFO_ITEM* BOARD_CONNECTED_ITEM::GetNet ( ) const
inlineinherited

◆ GetNetClass()

NETCLASSPTR BOARD_CONNECTED_ITEM::GetNetClass ( ) const
inherited

Function GetNetClass returns the NETCLASS for this item.

Definition at line 108 of file board_connected_item.cpp.

109 {
110  // It is important that this be implemented without any sequential searching.
111  // Simple array lookups should be fine, performance-wise.
112  BOARD* board = GetBoard();
113 
114  // DO NOT use wxASSERT, because GetNetClass is called inside an OnPaint event
115  // and a call to wxASSERT can crash the application.
116 
117  if( board == NULL ) // Should not occur
118  {
119  wxLogTrace( traceMask, "%s: NULL board,type %d", __func__, Type() );
120 
121  return NETCLASSPTR();
122  }
123 
124  NETCLASSPTR netclass;
125  NETINFO_ITEM* net = board->FindNet( GetNetCode() );
126 
127  if( net )
128  {
129  netclass = net->GetNetClass();
130 
131  //DBG( if(!netclass) printf( "%s: NULL netclass,type %d", __func__, Type() );)
132  }
133 
134  if( netclass )
135  return netclass;
136  else
137  return board->GetDesignSettings().GetDefault();
138 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
int GetNetCode() const
Function GetNetCode.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:534
const wxChar *const traceMask
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
NETCLASSPTR GetDefault() const
Function GetDefault.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
NETCLASSPTR GetNetClass()
Definition: netinfo.h:122
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

References BOARD::FindNet(), BOARD_ITEM::GetBoard(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), NETINFO_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetCode(), traceMask, and EDA_ITEM::Type().

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

142 {
143  wxString name;
144  NETCLASSPTR myclass = GetNetClass();
145 
146  if( myclass )
147  name = myclass->GetName();
148  else
150 
151  return name;
152 }
static const char Default[]
the name of the default NETCLASS
Definition: netclass.h:80
const char * name
Definition: DXF_plotter.cpp:61
std::shared_ptr< NETCLASS > GetNetClass() const
Function GetNetClass returns the NETCLASS for this item.

References NETCLASS::Default, BOARD_CONNECTED_ITEM::GetNetClass(), and name.

Referenced by PCB_EDIT_FRAME::createPopUpMenuForFpPads(), PCB_EDIT_FRAME::createPopupMenuForTracks(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ GetNetCode()

int BOARD_CONNECTED_ITEM::GetNetCode ( ) const
inlineinherited

Function GetNetCode.

Returns
int - the net code.

Definition at line 104 of file board_connected_item.h.

105  {
106  return m_netinfo->GetNet();
107  }
int GetNet() const
Function GetNet.
Definition: netinfo.h:227
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 PCB_EDIT_FRAME::Attribut_net(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), ZONE_FILLER::buildUnconnectedThermalStubsPolygonList(), ZONE_FILLER::buildZoneFeatureHoleList(), Collect_TrackSegmentsToDrag(), BOARD::CombineAllAreasInNet(), ZONE_FILLER::computeRawFilledAreas(), connectedItemFilter(), CopyNetlistSettings(), CreateRoutesSection(), CreateSignalsSection(), PCB_EDIT_FRAME::Delete_net(), PCB_EDIT_FRAME::Delete_Segment(), DRC::doEdgeZoneDrc(), DRC::doPadToPadsDrc(), DRC::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), VIA::Draw(), BOARD::DrawHighLight(), DrawShape(), TRACK::DrawShortNetname(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::duplicateZone(), PCB_EDIT_FRAME::End_Zone(), PCB_EDIT_FRAME::EraseRedundantTrack(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PNS::NODE::FindItemByParent(), PCB_IO::format(), DSN::SPECCTRA_DB::FromBOARD(), TRACK::GetBestInsertPoint(), CONNECTIVITY_DATA::GetConnectedItems(), TRACK::GetEndNetCode(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), TRACK::GetStartNetCode(), TRACK::GetTrack(), hash_eda(), DIALOG_PAD_PROPERTIES::initValues(), ZONE_CONTAINER::IsSame(), LocateIntrusion(), Magnetize(), 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(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_EDIT_FRAME::Process_Special_Functions(), PushTrack(), PCB_EDIT_FRAME::Remove_One_Track(), PCB_EDIT_FRAME::Remove_Zone_Corner(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), BOARD::SetAreasNetCodesFromNetNames(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PNS_KICAD_IFACE::syncPad(), PNS_KICAD_IFACE::syncTrack(), PNS_KICAD_IFACE::syncVia(), BOARD::TestAreaIntersections(), DRC::testZones(), DRC::TestZoneToZoneOutline(), TrackListSortByNetcode(), BOARD::TracksInNet(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), NETINFO_MAPPING::Update(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), ZONE_CONTAINER::ZONE_CONTAINER(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ GetNetname()

const wxString& BOARD_CONNECTED_ITEM::GetNetname ( ) const
inlineinherited

Function GetNetname.

Returns
wxString - the full netname

Definition at line 123 of file board_connected_item.h.

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

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

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

◆ GetNetnameMsg()

wxString BOARD_CONNECTED_ITEM::GetNetnameMsg ( ) const
inlineinherited

Function GetNetnameMsg.

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

Definition at line 133 of file board_connected_item.h.

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

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

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

◆ getNextNumberInSequence()

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

Definition at line 98 of file class_board_item.cpp.

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

Referenced by MODULE::GetNextPadName().

◆ GetOblongDrillGeometry()

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

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

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

Definition at line 837 of file class_pad.cpp.

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

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

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

◆ GetOffset()

◆ GetOrientation()

◆ GetOrientationDegrees()

double D_PAD::GetOrientationDegrees ( ) const
inline

Definition at line 395 of file class_pad.h.

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

References m_Orient.

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

◆ GetOrientationRadians()

double D_PAD::GetOrientationRadians ( ) const
inline

Definition at line 396 of file class_pad.h.

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

References m_Orient.

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

◆ GetPadToDieLength()

int D_PAD::GetPadToDieLength ( ) const
inline

◆ GetParent()

◆ GetPos0()

◆ GetPosition()

◆ GetPrimitives()

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

Accessor to the basic shape list.

Definition at line 341 of file class_pad.h.

341 { 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:856

References m_basicShapes.

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

◆ GetRoundRectCornerRadius() [1/2]

int D_PAD::GetRoundRectCornerRadius ( ) const
inline

Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.

Returns
The radius of the rounded corners for this pad.

Definition at line 543 of file class_pad.h.

544  {
546  }
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:878
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:543

References m_Size.

Referenced by boundingRadius(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), CINFO3D_VISU::createNewPadWithClearance(), CreatePadsShapesSection(), KIGFX::PCB_PAINTER::draw(), DrawShape(), export_vrml_padshape(), HitTest(), DSN::SPECCTRA_DB::makePADSTACK(), DIALOG_PAD_PROPERTIES::onCornerSizePercentChange(), BRDITEMS_PLOTTER::PlotPad(), 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 207 of file class_pad.cpp.

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

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

647  {
649  }
double m_padRoundRectRadiusScale
scaling factor from smallest m_Size coord to corner radius, default 0.25
Definition: class_pad.h:882

References m_padRoundRectRadiusScale.

Referenced by PCB_IO::format(), ImportSettingsFromMaster(), DIALOG_PAD_PROPERTIES::onCornerRadiusChange(), DIALOG_PAD_PROPERTIES::OnPadShapeSelection(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues().

◆ GetSelectMenuText()

wxString D_PAD::GetSelectMenuText ( EDA_UNITS_T  aUnits) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 1278 of file class_pad.cpp.

1279 {
1280  if( GetName().IsEmpty() )
1281  {
1282  return wxString::Format( _( "Pad of %s on %s" ),
1283  GetParent()->GetReference(),
1285  }
1286  else
1287  {
1288  return wxString::Format( _( "Pad %s of %s on %s" ),
1289  GetName(),
1290  GetParent()->GetReference(),
1292  }
1293 }
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:192
MODULE * GetParent() const
Definition: class_pad.h:164
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:907
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static wxString LayerMaskDescribe(const BOARD *aBoard, LSET aMask)
Helper function Return a string (to be shown to the user) describing a layer mask.
Definition: class_pad.cpp:1430

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

Referenced by PCB_EDIT_FRAME::createPopUpMenuForFpPads().

◆ GetShape()

PAD_SHAPE_T D_PAD::GetShape ( ) const
inline

Function GetShape.

Returns
the shape of this pad.

Definition at line 218 of file class_pad.h.

218 { 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:848

References m_padShape.

Referenced by CINFO3D_VISU::AddPadsShapesWithClearanceToContainer(), boundingRadius(), BuildPadPolygon(), CINFO3D_VISU::buildPadShapePolygon(), BuildPadShapePolygon(), CINFO3D_VISU::buildPadShapeThickOutlineAsPolygon(), CINFO3D_VISU::buildPadShapeThickOutlineAsSegments(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), Compare(), CINFO3D_VISU::createNewPad(), CINFO3D_VISU::createNewPadWithClearance(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), CreatePadsShapesSection(), CreateThermalReliefPadPolygon(), doPushPadProperties(), PCB_BASE_FRAME::DoPushPadProperties(), KIGFX::PCB_PAINTER::draw(), DrawShape(), export_vrml_padshape(), PCB_IO::format(), GetBoundingBox(), hash_eda(), HitTest(), HYPERLYNX_PAD_STACK::HYPERLYNX_PAD_STACK(), ImportSettingsFromMaster(), 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(), PlacePad(), AR_MATRIX::PlacePad(), BRDITEMS_PLOTTER::PlotPad(), ShowPadShape(), PNS_KICAD_IFACE::syncPad(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::transferDataToPad(), MODULE::TransformPadsShapesWithClearanceToPolygon(), CINFO3D_VISU::transformPadsShapesWithClearanceToPolygon(), TransformShapeWithClearanceToPolygon(), and DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues().

◆ GetShortNetname()

const wxString& BOARD_CONNECTED_ITEM::GetShortNetname ( ) const
inlineinherited

Function GetShortNetname.

Returns
wxString - the short netname

Definition at line 152 of file board_connected_item.h.

153  {
154  return m_netinfo->GetShortNetname();
155  }
const wxString & GetShortNetname() const
Function GetShortNetname.
Definition: netinfo.h:241
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 DrawShape().

◆ GetSize()

const wxSize& D_PAD::GetSize ( ) const
inline

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

640 {
641  // The pad inherits the margin only to calculate a default shape,
642  // therefore only if it is also a copper layer
643  // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
644  // defined by the pad settings only
645  bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
646 
647  if( !isOnCopperLayer )
648  return 0;
649 
650  int margin = m_LocalSolderMaskMargin;
651 
652  MODULE* module = GetParent();
653 
654  if( module )
655  {
656  if( margin == 0 )
657  {
658  if( module->GetLocalSolderMaskMargin() )
659  margin = module->GetLocalSolderMaskMargin();
660  }
661 
662  if( margin == 0 )
663  {
664  BOARD* brd = GetBoard();
665  if( brd )
666  {
667  margin = brd->GetDesignSettings().m_SolderMaskMargin;
668  }
669  }
670  }
671 
672  // ensure mask have a size always >= 0
673  if( margin < 0 )
674  {
675  int minsize = -std::min( m_Size.x, m_Size.y ) / 2;
676 
677  if( margin < minsize )
678  margin = minsize;
679  }
680 
681  return margin;
682 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:676
int m_LocalSolderMaskMargin
Local mask margins: when 0, the parent footprint design values are used.
Definition: class_pad.h:929
int m_SolderMaskMargin
Solder mask margin.
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:878
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:534
int GetLocalSolderMaskMargin() const
Definition: class_module.h:204
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:164
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:907
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
#define min(a, b)
Definition: auxiliary.h:85

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

Referenced by CINFO3D_VISU::AddPadsShapesWithClearanceToContainer(), KIGFX::PCB_PAINTER::draw(), Draw(), MODULE::TransformPadsShapesWithClearanceToPolygon(), CINFO3D_VISU::transformPadsShapesWithClearanceToPolygon(), 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 685 of file class_pad.cpp.

686 {
687  // The pad inherits the margin only to calculate a default shape,
688  // therefore only if it is also a copper layer.
689  // Pads defined only on mask layers (and perhaps on other tech layers) use the shape
690  // defined by the pad settings only
691  bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
692 
693  if( !isOnCopperLayer )
694  return wxSize( 0, 0 );
695 
696  int margin = m_LocalSolderPasteMargin;
697  double mratio = m_LocalSolderPasteMarginRatio;
698 
699  MODULE* module = GetParent();
700 
701  if( module )
702  {
703  if( margin == 0 )
704  margin = module->GetLocalSolderPasteMargin();
705 
706  auto brd = GetBoard();
707 
708  if( margin == 0 && brd )
709  {
710  margin = brd->GetDesignSettings().m_SolderPasteMargin;
711  }
712 
713  if( mratio == 0.0 )
714  mratio = module->GetLocalSolderPasteMarginRatio();
715 
716  if( mratio == 0.0 && brd )
717  {
718  mratio = brd->GetDesignSettings().m_SolderPasteMarginRatio;
719  }
720  }
721 
722  wxSize pad_margin;
723  pad_margin.x = margin + KiROUND( m_Size.x * mratio );
724  pad_margin.y = margin + KiROUND( m_Size.y * mratio );
725 
726  // ensure mask have a size always >= 0
727  if( pad_margin.x < -m_Size.x / 2 )
728  pad_margin.x = -m_Size.x / 2;
729 
730  if( pad_margin.y < -m_Size.y / 2 )
731  pad_margin.y = -m_Size.y / 2;
732 
733  return pad_margin;
734 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:676
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
int m_LocalSolderPasteMargin
Local solder paste margin absolute value.
Definition: class_pad.h:930
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:878
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:210
MODULE * GetParent() const
Definition: class_pad.h:164
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:907
double GetLocalSolderPasteMarginRatio() const
Definition: class_module.h:213
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:932

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

Referenced by CINFO3D_VISU::AddPadsShapesWithClearanceToContainer(), KIGFX::PCB_PAINTER::draw(), Draw(), MODULE::TransformPadsShapesWithClearanceToPolygon(), CINFO3D_VISU::transformPadsShapesWithClearanceToPolygon(), and ViewBBox().

◆ GetState()

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 256 of file base_struct.h.

256 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:167

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

712