KiCad PCB EDA Suite
FOOTPRINT Class Reference

#include <footprint.h>

Inheritance diagram for FOOTPRINT:
BOARD_ITEM_CONTAINER BOARD_ITEM EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Classes

struct  cmp_drawings
 
struct  cmp_pads
 

Public Member Functions

 FOOTPRINT (BOARD *parent)
 
 FOOTPRINT (const FOOTPRINT &aFootprint)
 
 FOOTPRINT (FOOTPRINT &&aFootprint)
 
 ~FOOTPRINT ()
 
FOOTPRINToperator= (const FOOTPRINT &aOther)
 
FOOTPRINToperator= (FOOTPRINT &&aOther)
 
void Add (BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
 Removes an item from the container. More...
 
void Remove (BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
 Removes an item from the container. More...
 
void ClearAllNets ()
 Clear (i.e. More...
 
EDA_RECT GetFpPadsLocalBbox () const
 Return the bounding box containing pads when the footprint is on the front side, orientation 0, position 0,0. More...
 
SHAPE_POLY_SET GetBoundingHull () const
 Return a bounding polygon for the shapes and pads in the footprint. More...
 
const EDA_RECT GetBoundingBox () const override
 Return the orthogonal bounding box of this object for display purposes. More...
 
const EDA_RECT GetBoundingBox (bool aIncludeText, bool aIncludeInvisibleText) const
 
PADS & Pads ()
 
const PADS & Pads () const
 
DRAWINGS & GraphicalItems ()
 
const DRAWINGS & GraphicalItems () const
 
FP_ZONES & Zones ()
 
const FP_ZONES & Zones () const
 
FP_GROUPS & Groups ()
 
const FP_GROUPS & Groups () const
 
bool HasThroughHolePads () const
 
std::list< FP_3DMODEL > & Models ()
 
const std::list< FP_3DMODEL > & Models () const
 
void SetPosition (const wxPoint &aPos) override
 
wxPoint GetPosition () const override
 
void SetOrientation (double aNewAngle)
 
void SetOrientationDegrees (double aOrientation)
 
double GetOrientation () const
 
double GetOrientationDegrees () const
 
double GetOrientationRadians () const
 
const LIB_IDGetFPID () const
 
void SetFPID (const LIB_ID &aFPID)
 
const wxString & GetDescription () const
 
void SetDescription (const wxString &aDoc)
 
const wxString & GetKeywords () const
 
void SetKeywords (const wxString &aKeywords)
 
const KIID_PATHGetPath () const
 
void SetPath (const KIID_PATH &aPath)
 
int GetLocalSolderMaskMargin () const
 
void SetLocalSolderMaskMargin (int aMargin)
 
int GetLocalClearance () const
 
void SetLocalClearance (int aClearance)
 
int GetLocalClearance (wxString *aSource) const
 
int GetLocalSolderPasteMargin () const
 
void SetLocalSolderPasteMargin (int aMargin)
 
double GetLocalSolderPasteMarginRatio () const
 
void SetLocalSolderPasteMarginRatio (double aRatio)
 
void SetZoneConnection (ZONE_CONNECTION aType)
 
ZONE_CONNECTION GetZoneConnection () const
 
void SetThermalWidth (int aWidth)
 
int GetThermalWidth () const
 
void SetThermalGap (int aGap)
 
int GetThermalGap () const
 
int GetAttributes () const
 
void SetAttributes (int aAttributes)
 
void SetFlag (int aFlag)
 
void IncrementFlag ()
 
int GetFlag () const
 
bool IsNetTie () const
 
void Move (const wxPoint &aMoveVector) override
 Move this object. More...
 
void Rotate (const wxPoint &aRotCentre, double aAngle) override
 Rotate this object. More...
 
void Flip (const wxPoint &aCentre, bool aFlipLeftRight) override
 Flip this object, i.e. More...
 
void MoveAnchorPosition (const wxPoint &aMoveVector)
 Move the reference point of the footprint. More...
 
bool IsFlipped () const
 
bool IsOnLayer (PCB_LAYER_ID aLayer) const override
 A special IsOnLayer for footprints: return true if the footprint contains only items on the given layer, even if that layer is not one of the valid footprint layers F_Cu and B_Cu. More...
 
bool IsLocked () const override
 
void SetLocked (bool isLocked) override
 Set the #MODULE_is_LOCKED bit in the m_ModuleStatus. More...
 
bool IsPlaced () const
 
void SetIsPlaced (bool isPlaced)
 
bool NeedsPlaced () const
 
void SetNeedsPlaced (bool needsPlaced)
 
bool LegacyPadsLocked () const
 
void SetLastEditTime (timestamp_t aTime)
 
void SetLastEditTime ()
 
timestamp_t GetLastEditTime () const
 
void TransformPadsWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool aSkipNPTHPadsWihNoCopper=false, bool aSkipPlatedPads=false, bool aSkipNonPlatedPads=false) const
 Generate pads shapes on layer aLayer as polygons and adds these polygons to aCornerBuffer. More...
 
void TransformFPShapesWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIncludeText=true, bool aIncludeShapes=true) const
 Generate shapes of graphic items (outlines) on layer aLayer as polygons and adds these polygons to aCornerBuffer. More...
 
void TransformFPTextWithClearanceToPolygonSet (SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc) const
 This function is the same as TransformGraphicShapesWithClearanceToPolygonSet but only generate text. More...
 
void GetContextualTextVars (wxArrayString *aVars) const
 Return the list of system text vars for this footprint. More...
 
bool ResolveTextVar (wxString *token, int aDepth=0) const
 Resolve any references to system tokens supported by the component. More...
 
void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
 Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Test if aPosition is contained within or on the bounding box of an item. More...
 
bool HitTestAccurate (const wxPoint &aPosition, int aAccuracy=0) const
 Test if a point is inside the bounding polygon of the footprint. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Test if aRect intersects or is contained within the bounding box of an item. More...
 
const wxString & GetReference () const
 
void SetReference (const wxString &aReference)
 
void IncrementReference (int aDelta)
 Bump the current reference by aDelta. More...
 
const wxString & GetValue () const
 
void SetValue (const wxString &aValue)
 
FP_TEXTValue ()
 read/write accessors: More...
 
FP_TEXTReference ()
 
FP_TEXTValue () const
 The const versions to keep the compiler happy. More...
 
FP_TEXTReference () const
 
const std::map< wxString, wxString > & GetProperties () const
 
void SetProperties (const std::map< wxString, wxString > &aProps)
 
const wxString & GetProperty (const wxString &aKey)
 
bool HasProperty (const wxString &aKey)
 
void SetProperty (const wxString &aKey, const wxString &aVal)
 
PADFindPadByName (const wxString &aPadName) const
 Return a PAD with a matching name. More...
 
PADGetPad (const wxPoint &aPosition, LSET aLayerMask=LSET::AllLayersMask())
 Get a pad at aPosition on aLayerMask in the footprint. More...
 
PADGetTopLeftPad ()
 
unsigned GetPadCount (INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
 Return the number of pads. More...
 
unsigned GetUniquePadCount (INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
 Return the number of unique non-blank pads. More...
 
wxString GetNextPadName (const wxString &aLastPadName) const
 Return the next available pad name in the footprint. More...
 
double GetArea (int aPadding=0) const
 
KIID GetLink () const
 
void SetLink (const KIID &aLink)
 
int GetPlacementCost180 () const
 
void SetPlacementCost180 (int aCost)
 
int GetPlacementCost90 () const
 
void SetPlacementCost90 (int aCost)
 
BOARD_ITEMDuplicate () const override
 Create a copy of this BOARD_ITEM. More...
 
BOARD_ITEMDuplicateItem (const BOARD_ITEM *aItem, bool aAddToFootprint=false)
 Duplicate a given item within the footprint, optionally adding it to the board. More...
 
void Add3DModel (FP_3DMODEL *a3DModel)
 Add a3DModel definition to the end of the 3D model list. More...
 
SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
wxString GetClass () const override
 Return the class name. More...
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
void RunOnChildren (const std::function< void(BOARD_ITEM *)> &aFunction) const
 Invoke a function on all BOARD_ITEMs that belong to the footprint (pads, drawings, texts). More...
 
void GetAllDrawingLayers (int aLayers[], int &aCount, bool aIncludePads=true) const
 Return a set of all layers that this footprint has drawings on similar to ViewGetLayers(). More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
double ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Return the level of detail (LOD) of the item. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
void SetInitialComments (wxArrayString *aInitialComments)
 Take ownership of caller's heap allocated aInitialComments block. More...
 
double CoverageRatio (const GENERAL_COLLECTOR &aCollector) const
 Calculate the ratio of total area of the footprint pads and graphical items to the area of the footprint. More...
 
const wxArrayString * GetInitialComments () const
 
const SHAPE_POLY_SETGetPolyCourtyardFront () const
 Used in DRC to test the courtyard area (a complex polygon). More...
 
const SHAPE_POLY_SETGetPolyCourtyardBack () const
 
void BuildPolyCourtyards (OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
 Build complex polygons of the courtyard areas from graphic items on the courtyard layers. More...
 
virtual std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
 Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
virtual void SwapData (BOARD_ITEM *aImage) override
 Swap data between aItem and aImage. More...
 
virtual void Delete (BOARD_ITEM *aItem)
 Removes an item from the container and deletes it. More...
 
virtual const ZONE_SETTINGSGetZoneSettings () const
 Fetch the zone settings for this container. More...
 
virtual void SetZoneSettings (const ZONE_SETTINGS &aSettings)
 Set the zone settings for this container. More...
 
void SetParentGroup (PCB_GROUP *aGroup)
 
PCB_GROUPGetParentGroup () const
 
int GetX () const
 
int GetY () const
 
virtual wxPoint GetCenter () const
 This defaults to the center of the bounding box if not overridden. More...
 
void SetX (int aX)
 
void SetY (int aY)
 
virtual bool IsConnected () const
 Returns information if the object is derived from BOARD_CONNECTED_ITEM. More...
 
virtual bool IsOnCopperLayer () const
 
BOARD_ITEM_CONTAINERGetParent () const
 
virtual PCB_LAYER_ID GetLayer () const
 Return the primary layer this item is on. More...
 
virtual LSET GetLayerSet () const
 Return a std::bitset of all layers on which the item physically resides. More...
 
virtual void SetLayerSet (LSET aLayers)
 
virtual void SetLayer (PCB_LAYER_ID aLayer)
 Set the layer this item is on. More...
 
bool IsTrack () const
 Test to see if this object is a track or via (or microvia). More...
 
void DeleteStructure ()
 Delete this object after removing from its parent if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
virtual BOARDGetBoard () const
 Return the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
wxString GetLayerName () const
 Return the name of the PCB layer on which the item resides. More...
 
virtual void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
 Convert the item shape to a closed polygon. More...
 
KICAD_T Type () const
 Returns the type of object. More...
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, bool state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag) const
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Check whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual const wxPoint GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const wxFindReplaceData &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. 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
 Draw the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 Adds an item to the container. More...
 
static bool IsLibNameValid (const wxString &aName)
 Test for validity of a name of a footprint to be used in a footprint library ( no spaces, dir separators ... More...
 
static const wxChar * StringLibNameInvalidChars (bool aUserReadable)
 Test for validity of the name in a library of the footprint ( no spaces, dir separators ... More...
 
static double GetCoverageArea (const BOARD_ITEM *aItem, const GENERAL_COLLECTOR &aCollector)
 Return the initial comments block or NULL if none, without transfer of ownership. More...
 
static wxString ShowShape (PCB_SHAPE_TYPE_T aShape)
 Convert the enum PCB_SHAPE_TYPE_T integer value to a wxString. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const wxFindReplaceData &aSearchData, wxString &aText)
 Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

const KIID m_Uuid
 

Static Public Attributes

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

Protected Member Functions

virtual wxString layerMaskDescribe () const
 Return a string (to be shown to the user) describing a layer mask. More...
 
bool Matches (const wxString &aText, const wxFindReplaceData &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 

Protected Attributes

PCB_LAYER_ID m_layer
 
PCB_GROUPm_group
 
STATUS_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
STATUS_FLAGS m_flags
 

Private Attributes

DRAWINGS m_drawings
 
PADS m_pads
 
FP_ZONES m_fp_zones
 
FP_GROUPS m_fp_groups
 
double m_orient
 
wxPoint m_pos
 
FP_TEXTm_reference
 
FP_TEXTm_value
 
LIB_ID m_fpid
 
int m_attributes
 
int m_fpStatus
 
EDA_RECT m_cachedBoundingBox
 
int m_boundingBoxCacheTimeStamp
 
EDA_RECT m_cachedVisibleBBox
 
int m_visibleBBoxCacheTimeStamp
 
EDA_RECT m_cachedTextExcludedBBox
 
int m_textExcludedBBoxCacheTimeStamp
 
SHAPE_POLY_SET m_cachedHull
 
int m_hullCacheTimeStamp
 
ZONE_CONNECTION m_zoneConnection
 
int m_thermalWidth
 
int m_thermalGap
 
int m_localClearance
 
int m_localSolderMaskMargin
 
int m_localSolderPasteMargin
 
double m_localSolderPasteMarginRatio
 
wxString m_doc
 
wxString m_keywords
 
KIID_PATH m_path
 
timestamp_t m_lastEditTime
 
int m_arflag
 
KIID m_link
 
int m_rot90Cost
 
int m_rot180Cost
 
std::list< FP_3DMODELm_3D_Drawings
 
std::map< wxString, wxString > m_properties
 
wxArrayString * m_initial_comments
 
SHAPE_POLY_SET m_poly_courtyard_front
 
SHAPE_POLY_SET m_poly_courtyard_back
 

Detailed Description

Definition at line 107 of file footprint.h.

Constructor & Destructor Documentation

◆ FOOTPRINT() [1/3]

FOOTPRINT::FOOTPRINT ( BOARD parent)

Definition at line 47 of file footprint.cpp.

47  :
54 {
55  m_attributes = 0;
56  m_layer = F_Cu;
57  m_orient = 0;
59  m_arflag = 0;
61  m_link = 0;
62  m_lastEditTime = 0;
63  m_localClearance = 0;
67  m_zoneConnection = ZONE_CONNECTION::INHERITED; // Use zone setting by default
68  m_thermalWidth = 0; // Use zone setting by default
69  m_thermalGap = 0; // Use zone setting by default
70 
71  // These are special and mandatory text fields
73  m_value = new FP_TEXT( this, FP_TEXT::TEXT_is_VALUE );
74 
75  m_3D_Drawings.clear();
76 }
int m_localSolderPasteMargin
Definition: footprint.h:719
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:714
double m_localSolderPasteMarginRatio
Definition: footprint.h:720
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
#define FP_PADS_are_LOCKED
Definition: footprint.h:279
double m_orient
Definition: footprint.h:687
timestamp_t m_lastEditTime
Definition: footprint.h:725
FP_TEXT * m_reference
Definition: footprint.h:689
int m_visibleBBoxCacheTimeStamp
Definition: footprint.h:708
int m_rot90Cost
Definition: footprint.h:728
FP_TEXT * m_value
Definition: footprint.h:690
int m_arflag
Definition: footprint.h:726
KIID m_link
Definition: footprint.h:727
int m_localSolderMaskMargin
Definition: footprint.h:718
int m_fpStatus
Definition: footprint.h:693
int m_thermalGap
Definition: footprint.h:716
int m_boundingBoxCacheTimeStamp
Definition: footprint.h:706
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
int m_thermalWidth
Definition: footprint.h:715
int m_localClearance
Definition: footprint.h:717
int m_rot180Cost
Definition: footprint.h:729
int m_textExcludedBBoxCacheTimeStamp
Definition: footprint.h:710
PCB_LAYER_ID m_layer
Definition: board_item.h:363
wxArrayString * m_initial_comments
Definition: footprint.h:733
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:731
int m_hullCacheTimeStamp
Definition: footprint.h:712
int m_attributes
Definition: footprint.h:692

References F_Cu, FP_PADS_are_LOCKED, INHERITED, m_3D_Drawings, m_arflag, m_attributes, m_fpStatus, m_lastEditTime, BOARD_ITEM::m_layer, m_link, m_localClearance, m_localSolderMaskMargin, m_localSolderPasteMargin, m_localSolderPasteMarginRatio, m_orient, m_reference, m_rot180Cost, m_rot90Cost, m_thermalGap, m_thermalWidth, m_value, m_zoneConnection, FP_TEXT::TEXT_is_REFERENCE, and FP_TEXT::TEXT_is_VALUE.

Referenced by Clone().

◆ FOOTPRINT() [2/3]

FOOTPRINT::FOOTPRINT ( const FOOTPRINT aFootprint)

Definition at line 79 of file footprint.cpp.

79  :
80  BOARD_ITEM_CONTAINER( aFootprint )
81 {
82  m_pos = aFootprint.m_pos;
83  m_fpid = aFootprint.m_fpid;
84  m_attributes = aFootprint.m_attributes;
85  m_fpStatus = aFootprint.m_fpStatus;
86  m_orient = aFootprint.m_orient;
87  m_rot90Cost = aFootprint.m_rot90Cost;
88  m_rot180Cost = aFootprint.m_rot180Cost;
89  m_lastEditTime = aFootprint.m_lastEditTime;
90  m_link = aFootprint.m_link;
91  m_path = aFootprint.m_path;
92 
99  m_cachedHull = aFootprint.m_cachedHull;
101 
102  m_localClearance = aFootprint.m_localClearance;
106  m_zoneConnection = aFootprint.m_zoneConnection;
107  m_thermalWidth = aFootprint.m_thermalWidth;
108  m_thermalGap = aFootprint.m_thermalGap;
109 
110  std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
111 
112  // Copy reference and value.
113  m_reference = new FP_TEXT( *aFootprint.m_reference );
114  m_reference->SetParent( this );
115  ptrMap[ aFootprint.m_reference ] = m_reference;
116 
117  m_value = new FP_TEXT( *aFootprint.m_value );
118  m_value->SetParent( this );
119  ptrMap[ aFootprint.m_value ] = m_value;
120 
121  // Copy pads
122  for( PAD* pad : aFootprint.Pads() )
123  {
124  PAD* newPad = static_cast<PAD*>( pad->Clone() );
125  ptrMap[ pad ] = newPad;
126  Add( newPad, ADD_MODE::APPEND ); // Append to ensure indexes are identical
127  }
128 
129  // Copy zones
130  for( FP_ZONE* zone : aFootprint.Zones() )
131  {
132  FP_ZONE* newZone = static_cast<FP_ZONE*>( zone->Clone() );
133  ptrMap[ zone ] = newZone;
134  Add( newZone, ADD_MODE::APPEND ); // Append to ensure indexes are identical
135 
136  // Ensure the net info is OK and especially uses the net info list
137  // living in the current board
138  // Needed when copying a fp from fp editor that has its own board
139  // Must be NETINFO_LIST::ORPHANED_ITEM for a keepout that has no net.
140  newZone->SetNetCode( -1 );
141  }
142 
143  // Copy drawings
144  for( BOARD_ITEM* item : aFootprint.GraphicalItems() )
145  {
146  BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() );
147  ptrMap[ item ] = newItem;
148  Add( newItem, ADD_MODE::APPEND ); // Append to ensure indexes are identical
149  }
150 
151  // Copy groups
152  for( PCB_GROUP* group : aFootprint.Groups() )
153  {
154  PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() );
155  ptrMap[ group ] = newGroup;
156  Add( newGroup, ADD_MODE::APPEND ); // Append to ensure indexes are identical
157  }
158 
159  // Rebuild groups
160  for( PCB_GROUP* group : aFootprint.Groups() )
161  {
162  PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( ptrMap[ group ] );
163 
164  newGroup->GetItems().clear();
165 
166  for( BOARD_ITEM* member : group->GetItems() )
167  newGroup->AddItem( ptrMap[ member ] );
168  }
169 
170  // Copy auxiliary data: 3D_Drawings info
171  m_3D_Drawings = aFootprint.m_3D_Drawings;
172 
173  m_doc = aFootprint.m_doc;
174  m_keywords = aFootprint.m_keywords;
175  m_properties = aFootprint.m_properties;
176 
177  m_arflag = 0;
178 
180  new wxArrayString( *aFootprint.m_initial_comments ) : nullptr;
181 }
int m_localSolderPasteMargin
Definition: footprint.h:719
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:38
EDA_RECT m_cachedVisibleBBox
Definition: footprint.h:707
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:714
double m_localSolderPasteMarginRatio
Definition: footprint.h:720
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
double m_orient
Definition: footprint.h:687
timestamp_t m_lastEditTime
Definition: footprint.h:725
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
FP_TEXT * m_reference
Definition: footprint.h:689
int m_visibleBBoxCacheTimeStamp
Definition: footprint.h:708
std::unordered_set< BOARD_ITEM * > & GetItems()
Definition: pcb_group.h:68
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:166
int m_rot90Cost
Definition: footprint.h:728
PADS & Pads()
Definition: footprint.h:164
FP_TEXT * m_value
Definition: footprint.h:690
int m_arflag
Definition: footprint.h:726
KIID m_link
Definition: footprint.h:727
int m_localSolderMaskMargin
Definition: footprint.h:718
EDA_RECT m_cachedBoundingBox
Definition: footprint.h:705
FP_ZONES & Zones()
Definition: footprint.h:170
int m_fpStatus
Definition: footprint.h:693
SHAPE_POLY_SET m_cachedHull
Definition: footprint.h:711
int m_thermalGap
Definition: footprint.h:716
DRAWINGS & GraphicalItems()
Definition: footprint.h:167
wxPoint m_pos
Definition: footprint.h:688
int m_boundingBoxCacheTimeStamp
Definition: footprint.h:706
KIID_PATH m_path
Definition: footprint.h:724
FP_GROUPS & Groups()
Definition: footprint.h:173
int m_thermalWidth
Definition: footprint.h:715
wxString m_keywords
Definition: footprint.h:723
int m_localClearance
Definition: footprint.h:717
int m_rot180Cost
Definition: footprint.h:729
int m_textExcludedBBoxCacheTimeStamp
Definition: footprint.h:710
LIB_ID m_fpid
Definition: footprint.h:691
EDA_RECT m_cachedTextExcludedBBox
Definition: footprint.h:709
std::map< wxString, wxString > m_properties
Definition: footprint.h:732
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the container.
Definition: footprint.cpp:468
wxArrayString * m_initial_comments
Definition: footprint.h:733
Definition: pad.h:60
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
wxString m_doc
Definition: footprint.h:722
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:731
A specialization of ZONE for use in footprints.
Definition: zone.h:943
int m_hullCacheTimeStamp
Definition: footprint.h:712
int m_attributes
Definition: footprint.h:692

References Add(), PCB_GROUP::AddItem(), APPEND, PCB_GROUP::GetItems(), GraphicalItems(), group, Groups(), m_3D_Drawings, m_arflag, m_attributes, m_boundingBoxCacheTimeStamp, m_cachedBoundingBox, m_cachedHull, m_cachedTextExcludedBBox, m_cachedVisibleBBox, m_doc, m_fpid, m_fpStatus, m_hullCacheTimeStamp, m_initial_comments, m_keywords, m_lastEditTime, m_link, m_localClearance, m_localSolderMaskMargin, m_localSolderPasteMargin, m_localSolderPasteMarginRatio, m_orient, m_path, m_pos, m_properties, m_reference, m_rot180Cost, m_rot90Cost, m_textExcludedBBoxCacheTimeStamp, m_thermalGap, m_thermalWidth, m_value, m_visibleBBoxCacheTimeStamp, m_zoneConnection, pad, Pads(), BOARD_CONNECTED_ITEM::SetNetCode(), EDA_ITEM::SetParent(), and Zones().

◆ FOOTPRINT() [3/3]

FOOTPRINT::FOOTPRINT ( FOOTPRINT &&  aFootprint)

Definition at line 184 of file footprint.cpp.

184  :
185  BOARD_ITEM_CONTAINER( aFootprint )
186 {
187  *this = std::move( aFootprint );
188 }
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)

◆ ~FOOTPRINT()

FOOTPRINT::~FOOTPRINT ( )

Definition at line 191 of file footprint.cpp.

192 {
193  // Clean up the owned elements
194  delete m_reference;
195  delete m_value;
196  delete m_initial_comments;
197 
198  for( PAD* p : m_pads )
199  delete p;
200 
201  m_pads.clear();
202 
203  for( FP_ZONE* zone : m_fp_zones )
204  delete zone;
205 
206  m_fp_zones.clear();
207 
208  for( PCB_GROUP* group : m_fp_groups )
209  delete group;
210 
211  m_fp_groups.clear();
212 
213  for( BOARD_ITEM* d : m_drawings )
214  delete d;
215 
216  m_drawings.clear();
217 }
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
FP_TEXT * m_reference
Definition: footprint.h:689
FP_TEXT * m_value
Definition: footprint.h:690
FP_ZONES m_fp_zones
Definition: footprint.h:684
DRAWINGS m_drawings
Definition: footprint.h:682
wxArrayString * m_initial_comments
Definition: footprint.h:733
Definition: pad.h:60
FP_GROUPS m_fp_groups
Definition: footprint.h:685
A specialization of ZONE for use in footprints.
Definition: zone.h:943
PADS m_pads
Definition: footprint.h:683

References group, m_drawings, m_fp_groups, m_fp_zones, m_initial_comments, m_pads, m_reference, and m_value.

Member Function Documentation

◆ Add()

void FOOTPRINT::Add ( BOARD_ITEM aItem,
ADD_MODE  aMode = ADD_MODE::INSERT 
)
overridevirtual

Removes an item from the container.

Implements BOARD_ITEM_CONTAINER.

Definition at line 468 of file footprint.cpp.

469 {
470  switch( aBoardItem->Type() )
471  {
472  case PCB_FP_TEXT_T:
473  // Only user text can be added this way.
474  assert( static_cast<FP_TEXT*>( aBoardItem )->GetType() == FP_TEXT::TEXT_is_DIVERS );
476 
477  case PCB_FP_SHAPE_T:
478  if( aMode == ADD_MODE::APPEND )
479  m_drawings.push_back( aBoardItem );
480  else
481  m_drawings.push_front( aBoardItem );
482  break;
483 
484  case PCB_PAD_T:
485  if( aMode == ADD_MODE::APPEND )
486  m_pads.push_back( static_cast<PAD*>( aBoardItem ) );
487  else
488  m_pads.push_front( static_cast<PAD*>( aBoardItem ) );
489  break;
490 
491  case PCB_FP_ZONE_T:
492  if( aMode == ADD_MODE::APPEND )
493  m_fp_zones.push_back( static_cast<FP_ZONE*>( aBoardItem ) );
494  else
495  m_fp_zones.insert( m_fp_zones.begin(), static_cast<FP_ZONE*>( aBoardItem ) );
496  break;
497 
498  case PCB_GROUP_T:
499  if( aMode == ADD_MODE::APPEND )
500  m_fp_groups.push_back( static_cast<PCB_GROUP*>( aBoardItem ) );
501  else
502  m_fp_groups.insert( m_fp_groups.begin(), static_cast<PCB_GROUP*>( aBoardItem ) );
503  break;
504 
505  default:
506  {
507  wxString msg;
508  msg.Printf( wxT( "FOOTPRINT::Add() needs work: BOARD_ITEM type (%d) not handled" ),
509  aBoardItem->Type() );
510  wxFAIL_MSG( msg );
511 
512  return;
513  }
514  }
515 
516  aBoardItem->ClearEditFlags();
517  aBoardItem->SetParent( this );
518 }
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
class PAD, a pad in a footprint
Definition: typeinfo.h:89
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
FP_ZONES m_fp_zones
Definition: footprint.h:684
class ZONE, managed by a footprint
Definition: typeinfo.h:94
DRAWINGS m_drawings
Definition: footprint.h:682
FP_GROUPS m_fp_groups
Definition: footprint.h:685
PADS m_pads
Definition: footprint.h:683

References APPEND, EDA_ITEM::ClearEditFlags(), KI_FALLTHROUGH, m_drawings, m_fp_groups, m_fp_zones, m_pads, PCB_FP_SHAPE_T, PCB_FP_TEXT_T, PCB_FP_ZONE_T, PCB_GROUP_T, PCB_PAD_T, EDA_ITEM::SetParent(), FP_TEXT::TEXT_is_DIVERS, and EDA_ITEM::Type().

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PCAD2KICAD::PCB_ARC::AddToFootprint(), PCAD2KICAD::PCB_LINE::AddToFootprint(), PCAD2KICAD::PCB_PAD::AddToFootprint(), PCAD2KICAD::PCB_POLYGON::AddToFootprint(), MICROWAVE_TOOL::createBaseFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), MICROWAVE_TOOL::createPolygonShape(), KI_TEST::DrawArc(), KI_TEST::DrawSegment(), DuplicateItem(), PCB_EDIT_FRAME::ExchangeFootprint(), FOOTPRINT(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), GROUP_TOOL::Group(), ALTIUM_PCB::HelperCreateAndAddDrawsegment(), LEGACY_PLUGIN::loadFOOTPRINT(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadFP_SHAPE(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryAreas(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryPads(), LEGACY_PLUGIN::loadPAD(), operator=(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packageHole(), EAGLE_PLUGIN::packagePad(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageSMD(), EAGLE_PLUGIN::packageText(), EAGLE_PLUGIN::packageWire(), ALTIUM_PCB::ParsePads6Data(), ALTIUM_PCB::ParseTexts6Data(), CLIPBOARD_IO::SaveSelection(), FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow().

◆ Add3DModel()

void FOOTPRINT::Add3DModel ( FP_3DMODEL a3DModel)

Add a3DModel definition to the end of the 3D model list.

Parameters
a3DModelA pointer to a FP_3DMODEL to add to the list.

Definition at line 1056 of file footprint.cpp.

1057 {
1058  if( nullptr == a3DModel )
1059  return;
1060 
1061  if( !a3DModel->m_Filename.empty() )
1062  m_3D_Drawings.push_back( *a3DModel );
1063 }
wxString m_Filename
The 3D shape filename in 3D library.
Definition: footprint.h:97
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:731

References m_3D_Drawings, and FP_3DMODEL::m_Filename.

◆ BuildPolyCourtyards()

void FOOTPRINT::BuildPolyCourtyards ( OUTLINE_ERROR_HANDLER aErrorHandler = nullptr)

Build complex polygons of the courtyard areas from graphic items on the courtyard layers.

Note
Set the MALFORMED_F_COURTYARD and MALFORMED_B_COURTYARD status flags if the given courtyard layer does not contain a (single) closed shape.

Definition at line 1929 of file footprint.cpp.

1930 {
1934 
1935  // Build the courtyard area from graphic items on the courtyard.
1936  // Only PCB_FP_SHAPE_T have meaning, graphic texts are ignored.
1937  // Collect items:
1938  std::vector<PCB_SHAPE*> list_front;
1939  std::vector<PCB_SHAPE*> list_back;
1940 
1941  for( BOARD_ITEM* item : GraphicalItems() )
1942  {
1943  if( item->GetLayer() == B_CrtYd && item->Type() == PCB_FP_SHAPE_T )
1944  list_back.push_back( static_cast<PCB_SHAPE*>( item ) );
1945 
1946  if( item->GetLayer() == F_CrtYd && item->Type() == PCB_FP_SHAPE_T )
1947  list_front.push_back( static_cast<PCB_SHAPE*>( item ) );
1948  }
1949 
1950  if( !list_front.size() && !list_back.size() )
1951  return;
1952 
1953  int errorMax = Millimeter2iu( 0.02 ); // max error for polygonization
1954  int chainingEpsilon = Millimeter2iu( 0.02 ); // max dist from one endPt to next startPt
1955 
1956  if( ConvertOutlineToPolygon( list_front, m_poly_courtyard_front, errorMax, chainingEpsilon,
1957  aErrorHandler ) )
1958  {
1959  // Touching courtyards, or courtyards -at- the clearance distance are legal.
1961 
1963  }
1964  else
1965  {
1967  }
1968 
1969  if( ConvertOutlineToPolygon( list_back, m_poly_courtyard_back, errorMax, chainingEpsilon,
1970  aErrorHandler ) )
1971  {
1972  // Touching courtyards, or courtyards -at- the clearance distance are legal.
1974 
1976  }
1977  else
1978  {
1980  }
1981 }
SHAPE_POLY_SET m_poly_courtyard_back
Definition: footprint.h:737
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
void Inflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Perform outline inflation/deflation.
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:203
#define MALFORMED_B_COURTYARD
Definition: eda_item.h:125
SHAPE_POLY_SET m_poly_courtyard_front
Definition: footprint.h:736
DRAWINGS & GraphicalItems()
Definition: footprint.h:167
#define MALFORMED_COURTYARDS
Definition: eda_item.h:126
Acute angles are chamfered.
bool ConvertOutlineToPolygon(std::vector< PCB_SHAPE * > &aSegList, SHAPE_POLY_SET &aPolygons, int aErrorMax, int aChainingEpsilon, OUTLINE_ERROR_HANDLER *aErrorHandler)
Function ConvertOutlineToPolygon Build a polygon (with holes) from a PCB_SHAPE list,...
#define MALFORMED_F_COURTYARD
Definition: eda_item.h:124
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:204
void CacheTriangulation(bool aPartition=true)
static constexpr int Millimeter2iu(double mm)

References B_CrtYd, SHAPE_POLY_SET::CacheTriangulation(), SHAPE_POLY_SET::CHAMFER_ACUTE_CORNERS, EDA_ITEM::ClearFlags(), ConvertOutlineToPolygon(), F_CrtYd, GraphicalItems(), SHAPE_POLY_SET::Inflate(), m_poly_courtyard_back, m_poly_courtyard_front, MALFORMED_B_COURTYARD, MALFORMED_COURTYARDS, MALFORMED_F_COURTYARD, Millimeter2iu(), PCB_FP_SHAPE_T, SHAPE_POLY_SET::RemoveAllContours(), and EDA_ITEM::SetFlags().

Referenced by AR_AUTOPLACER::buildFpAreas(), BOARD_INSPECTION_TOOL::InspectConstraints(), BOARD_INSPECTION_TOOL::reportClearance(), and DIALOG_FOOTPRINT_CHECKER::runChecks().

◆ ClassOf()

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

Adds an item to the container.

Parameters
aModedecides whether the item is added in the beginning or at the end of the list.

Definition at line 122 of file footprint.h.

References PCB_FOOTPRINT_T, and EDA_ITEM::Type().

◆ ClearAllNets()

void FOOTPRINT::ClearAllNets ( )

Clear (i.e.

force the ORPHANED dummy net info) the net info which depends on a given board for all pads of the footprint.

This is needed when a footprint is copied between the fp editor and the board editor for instance, because net info become fully broken

Definition at line 459 of file footprint.cpp.

460 {
461  // Force the ORPHANED dummy net info for all pads.
462  // ORPHANED dummy net does not depend on a board
463  for( PAD* pad : m_pads )
464  pad->SetNetCode( NETINFO_LIST::ORPHANED );
465 }
static const int ORPHANED
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
Definition: netinfo.h:369
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:683

References m_pads, NETINFO_LIST::ORPHANED, and pad.

Referenced by PCB_BASE_FRAME::loadFootprint(), and FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 204 of file eda_item.h.

204 { m_flags &= ~aMask; }
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), BuildPolyCourtyards(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SYMBOL_EDITOR_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), EE_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::narrowSelection(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 216 of file eda_item.h.

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

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 148 of file view_item.h.

149  {
150  m_viewPrivData = nullptr;
151  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:156

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * FOOTPRINT::Clone ( ) const
overridevirtual

Create 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 1169 of file footprint.cpp.

1170 {
1171  return new FOOTPRINT( *this );
1172 }
FOOTPRINT(BOARD *parent)
Definition: footprint.cpp:47

References FOOTPRINT().

Referenced by FOOTPRINT_EDIT_FRAME::AddFootprintToBoard(), Duplicate(), PCB_IO::FootprintLoad(), PCB_IO::FootprintSave(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), BOARD_NETLIST_UPDATER::updateComponentPadConnections(), and BOARD_NETLIST_UPDATER::updateFootprintParameters().

◆ CoverageRatio()

double FOOTPRINT::CoverageRatio ( const GENERAL_COLLECTOR aCollector) const

Calculate the ratio of total area of the footprint pads and graphical items to the area of the footprint.

Used by selection tool heuristics.

Returns
the ratio.

Definition at line 1829 of file footprint.cpp.

1830 {
1831  int textMargin = KiROUND( 5 * aCollector.GetGuide()->OnePixelInIU() );
1832 
1833  SHAPE_POLY_SET footprintRegion( GetBoundingHull() );
1834  SHAPE_POLY_SET coveredRegion;
1835 
1836  TransformPadsWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
1837  ERROR_OUTSIDE );
1838 
1839  TransformFPShapesWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, textMargin,
1840  ARC_LOW_DEF, ERROR_OUTSIDE,
1841  true, /* include text */
1842  false /* include shapes */ );
1843 
1844  for( int i = 0; i < aCollector.GetCount(); ++i )
1845  {
1846  const BOARD_ITEM* item = aCollector[i];
1847 
1848  switch( item->Type() )
1849  {
1850  case PCB_FP_TEXT_T:
1851  case PCB_FP_SHAPE_T:
1852  if( item->GetParent() != this )
1853  {
1854  item->TransformShapeWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, 0,
1855  ARC_LOW_DEF, ERROR_OUTSIDE );
1856  }
1857  break;
1858 
1859  case PCB_TEXT_T:
1860  case PCB_SHAPE_T:
1861  case PCB_TRACE_T:
1862  case PCB_ARC_T:
1863  case PCB_VIA_T:
1864  item->TransformShapeWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, 0,
1865  ARC_LOW_DEF, ERROR_OUTSIDE );
1866  break;
1867 
1868  case PCB_FOOTPRINT_T:
1869  if( item != this )
1870  {
1871  const FOOTPRINT* footprint = static_cast<const FOOTPRINT*>( item );
1872  coveredRegion.AddOutline( footprint->GetBoundingHull().Outline( 0 ) );
1873  }
1874  break;
1875 
1876  default:
1877  break;
1878  }
1879  }
1880 
1881  SHAPE_POLY_SET uncoveredRegion;
1882 
1883  try
1884  {
1885  uncoveredRegion.BooleanSubtract( footprintRegion, coveredRegion,
1887  uncoveredRegion.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1888  uncoveredRegion.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1889  }
1890  catch( ClipperLib::clipperException& )
1891  {
1892  // better to be conservative (this will result in the disambiguate dialog)
1893  return 1.0;
1894  }
1895 
1896  double footprintRegionArea = polygonArea( footprintRegion );
1897  double uncoveredRegionArea = polygonArea( uncoveredRegion );
1898  double coveredArea = footprintRegionArea - uncoveredRegionArea;
1899  double ratio = ( coveredArea / footprintRegionArea );
1900 
1901  return std::min( ratio, 1.0 );
1902 }
SHAPE_POLY_SET GetBoundingHull() const
Return a bounding polygon for the shapes and pads in the footprint.
Definition: footprint.cpp:739
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
virtual double OnePixelInIU() const =0
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
const COLLECTORS_GUIDE * GetGuide() const
Definition: collectors.h:343
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
void Simplify(POLYGON_MODE aFastMode)
void TransformPadsWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool aSkipNPTHPadsWihNoCopper=false, bool aSkipPlatedPads=false, bool aSkipNonPlatedPads=false) const
Generate pads shapes on layer aLayer as polygons and adds these polygons to aCornerBuffer.
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
void TransformFPShapesWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIncludeText=true, bool aIncludeShapes=true) const
Generate shapes of graphic items (outlines) on layer aLayer as polygons and adds these polygons to aC...
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
virtual void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
Convert the item shape to a closed polygon.
Definition: board_item.cpp:129
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
static double polygonArea(SHAPE_POLY_SET &aPolySet)
Definition: footprint.cpp:1730

References SHAPE_POLY_SET::AddOutline(), SHAPE_POLY_SET::BooleanSubtract(), ERROR_OUTSIDE, SHAPE_POLY_SET::Fracture(), GetBoundingHull(), COLLECTOR::GetCount(), GENERAL_COLLECTOR::GetGuide(), BOARD_ITEM::GetParent(), KiROUND(), COLLECTORS_GUIDE::OnePixelInIU(), SHAPE_POLY_SET::Outline(), PCB_ARC_T, PCB_FOOTPRINT_T, PCB_FP_SHAPE_T, PCB_FP_TEXT_T, PCB_SHAPE_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, polygonArea(), SHAPE_POLY_SET::Simplify(), TransformFPShapesWithClearanceToPolygon(), TransformPadsWithClearanceToPolygon(), BOARD_ITEM::TransformShapeWithClearanceToPolygon(), EDA_ITEM::Type(), and UNDEFINED_LAYER.

Referenced by PCB_SELECTION_TOOL::GuessSelectionCandidates().

◆ Delete()

virtual void BOARD_ITEM_CONTAINER::Delete ( BOARD_ITEM aItem)
inlinevirtualinherited

Removes an item from the container and deletes it.

Definition at line 74 of file board_item_container.h.

75  {
76  Remove( aItem );
77  delete aItem;
78  }
virtual void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL)=0
Removes an item from the container.

References BOARD_ITEM_CONTAINER::Remove().

Referenced by BOARD_DRC_ITEMS_PROVIDER::DeleteItem(), and BOARD_COMMIT::Push().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

Delete this object after removing from its parent if it has one.

Definition at line 113 of file board_item.cpp.

114 {
115  BOARD_ITEM_CONTAINER* parent = GetParent();
116 
117  if( parent )
118  parent->Remove( this );
119 
120  delete this;
121 }
virtual void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL)=0
Removes an item from the container.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168

References BOARD_ITEM::GetParent(), and BOARD_ITEM_CONTAINER::Remove().

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

◆ Duplicate()

BOARD_ITEM * FOOTPRINT::Duplicate ( ) const
overridevirtual

Create a copy of this BOARD_ITEM.

Reimplemented from BOARD_ITEM.

Definition at line 1601 of file footprint.cpp.

1602 {
1603  FOOTPRINT* dupe = (FOOTPRINT*) Clone();
1604  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
1605 
1606  dupe->RunOnChildren( [&]( BOARD_ITEM* child )
1607  {
1608  const_cast<KIID&>( child->m_Uuid ) = KIID();
1609  });
1610 
1611  return static_cast<BOARD_ITEM*>( dupe );
1612 }
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
Definition: kiid.h:44
const KIID m_Uuid
Definition: eda_item.h:525
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all BOARD_ITEMs that belong to the footprint (pads, drawings,...
Definition: footprint.cpp:1175
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1169

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

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), FOOTPRINT_PREVIEW_PANEL::DisplayFootprint(), GPCB_PLUGIN::FootprintLoad(), PCB_IO::FootprintLoad(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), and CADSTAR_PCB_ARCHIVE_LOADER::loadComponents().

◆ DuplicateItem()

BOARD_ITEM * FOOTPRINT::DuplicateItem ( const BOARD_ITEM aItem,
bool  aAddToFootprint = false 
)

Duplicate a given item within the footprint, optionally adding it to the board.

Returns
the new item, or NULL if the item could not be duplicated.

Definition at line 1615 of file footprint.cpp.

1616 {
1617  BOARD_ITEM* new_item = NULL;
1618  FP_ZONE* new_zone = NULL;
1619 
1620  switch( aItem->Type() )
1621  {
1622  case PCB_PAD_T:
1623  {
1624  PAD* new_pad = new PAD( *static_cast<const PAD*>( aItem ) );
1625  const_cast<KIID&>( new_pad->m_Uuid ) = KIID();
1626 
1627  if( aAddToFootprint )
1628  m_pads.push_back( new_pad );
1629 
1630  new_item = new_pad;
1631  break;
1632  }
1633 
1634  case PCB_FP_ZONE_T:
1635  {
1636  new_zone = new FP_ZONE( *static_cast<const FP_ZONE*>( aItem ) );
1637  const_cast<KIID&>( new_zone->m_Uuid ) = KIID();
1638 
1639  if( aAddToFootprint )
1640  m_fp_zones.push_back( new_zone );
1641 
1642  new_item = new_zone;
1643  break;
1644  }
1645 
1646  case PCB_FP_TEXT_T:
1647  {
1648  FP_TEXT* new_text = new FP_TEXT( *static_cast<const FP_TEXT*>( aItem ) );
1649  const_cast<KIID&>( new_text->m_Uuid ) = KIID();
1650 
1651  if( new_text->GetType() == FP_TEXT::TEXT_is_REFERENCE )
1652  {
1653  new_text->SetText( wxT( "${REFERENCE}" ) );
1654  new_text->SetType( FP_TEXT::TEXT_is_DIVERS );
1655  }
1656  else if( new_text->GetType() == FP_TEXT::TEXT_is_VALUE )
1657  {
1658  new_text->SetText( wxT( "${VALUE}" ) );
1659  new_text->SetType( FP_TEXT::TEXT_is_DIVERS );
1660  }
1661 
1662  if( aAddToFootprint )
1663  Add( new_text );
1664 
1665  new_item = new_text;
1666 
1667  break;
1668  }
1669 
1670  case PCB_FP_SHAPE_T:
1671  {
1672  FP_SHAPE* new_shape = new FP_SHAPE( *static_cast<const FP_SHAPE*>( aItem ) );
1673  const_cast<KIID&>( new_shape->m_Uuid ) = KIID();
1674 
1675  if( aAddToFootprint )
1676  Add( new_shape );
1677 
1678  new_item = new_shape;
1679  break;
1680  }
1681 
1682  case PCB_GROUP_T:
1683  new_item = static_cast<const PCB_GROUP*>( aItem )->DeepDuplicate();
1684  break;
1685 
1686  case PCB_FOOTPRINT_T:
1687  // Ignore the footprint itself
1688  break;
1689 
1690  default:
1691  // Un-handled item for duplication
1692  wxFAIL_MSG( "Duplication not supported for items of class " + aItem->GetClass() );
1693  break;
1694  }
1695 
1696  return new_item;
1697 }
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
class PAD, a pad in a footprint
Definition: typeinfo.h:89
void SetType(TEXT_TYPE aType)
Definition: fp_text.h:140
Definition: kiid.h:44
FP_ZONES m_fp_zones
Definition: footprint.h:684
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:121
#define NULL
TEXT_TYPE GetType() const
Definition: fp_text.h:141
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
const KIID m_Uuid
Definition: eda_item.h:525
virtual wxString GetClass() const =0
Return the class name.
class ZONE, managed by a footprint
Definition: typeinfo.h:94
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the container.
Definition: footprint.cpp:468
Definition: pad.h:60
A specialization of ZONE for use in footprints.
Definition: zone.h:943
PADS m_pads
Definition: footprint.h:683
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References Add(), EDA_ITEM::GetClass(), FP_TEXT::GetType(), m_fp_zones, m_pads, EDA_ITEM::m_Uuid, NULL, PAD, PCB_FOOTPRINT_T, PCB_FP_SHAPE_T, PCB_FP_TEXT_T, PCB_FP_ZONE_T, PCB_GROUP_T, PCB_PAD_T, EDA_TEXT::SetText(), FP_TEXT::SetType(), FP_TEXT::TEXT_is_DIVERS, FP_TEXT::TEXT_is_REFERENCE, FP_TEXT::TEXT_is_VALUE, and EDA_ITEM::Type().

Referenced by EDIT_TOOL::Duplicate(), and ARRAY_CREATOR::Invoke().

◆ FindPadByName()

PAD * FOOTPRINT::FindPadByName ( const wxString &  aPadName) const

Return a PAD with a matching name.

Note
Names may not be unique depending on how the footprint was created.
Parameters
aPadNamethe pad name to find.
Returns
the first matching named PAD is returned or NULL if not found.

Definition at line 957 of file footprint.cpp.

958 {
959  for( PAD* pad : m_pads )
960  {
961  if( pad->GetName() == aPadName )
962  return pad;
963  }
964 
965  return NULL;
966 }
#define NULL
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:683

References m_pads, NULL, and pad.

Referenced by PCB_EDIT_FRAME::ExchangeFootprint(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), BOARD_NETLIST_UPDATER::testConnectivity(), and DRC_TEST_PROVIDER_LVS::testFootprints().

◆ Flip() [1/2]

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

Flip this object, i.e.

change the board side for this object.

Parameters
aCentrethe rotation point.
aFlipLeftRightmirror across Y axis instead of X (the default).

Mirror the Y position (around the X axis)

Reimplemented from BOARD_ITEM.

Definition at line 1367 of file footprint.cpp.

1368 {
1369  // Move footprint to its final position:
1370  wxPoint finalPos = m_pos;
1371 
1372  // Now Flip the footprint.
1373  // Flipping a footprint is a specific transform: it is not mirrored like a text.
1374  // We have to change the side, and ensure the footprint rotation is modified according to the
1375  // transform, because this parameter is used in pick and place files, and when updating the
1376  // footprint from library.
1377  // When flipped around the X axis (Y coordinates changed) orientation is negated
1378  // When flipped around the Y axis (X coordinates changed) orientation is 180 - old orient.
1379  // Because it is specfic to a footprint, we flip around the X axis, and after rotate 180 deg
1380 
1381  MIRROR( finalPos.y, aCentre.y );
1382 
1383  SetPosition( finalPos );
1384 
1385  // Flip layer
1386  SetLayer( FlipLayer( GetLayer() ) );
1387 
1388  // Reverse mirror orientation.
1389  m_orient = -m_orient;
1390 
1392 
1393  // Mirror pads to other side of board.
1394  for( PAD* pad : m_pads )
1395  pad->Flip( m_pos, false );
1396 
1397  // Mirror zones to other side of board.
1398  for( ZONE* zone : m_fp_zones )
1399  zone->Flip( m_pos, false );
1400 
1401  // Mirror reference and value.
1402  m_reference->Flip( m_pos, false );
1403  m_value->Flip( m_pos, false );
1404 
1405  // Reverse mirror footprint graphics and texts.
1406  for( BOARD_ITEM* item : m_drawings )
1407  {
1408  switch( item->Type() )
1409  {
1410  case PCB_FP_SHAPE_T:
1411  static_cast<FP_SHAPE*>( item )->Flip( m_pos, false );
1412  break;
1413 
1414  case PCB_FP_TEXT_T:
1415  static_cast<FP_TEXT*>( item )->Flip( m_pos, false );
1416  break;
1417 
1418  default:
1419  wxMessageBox( wxT( "FOOTPRINT::Flip() error: Unknown Draw Type" ) );
1420  break;
1421  }
1422  }
1423 
1424  // Now rotate 180 deg if required
1425  if( aFlipLeftRight )
1426  Rotate( aCentre, 1800.0 );
1427 
1431 
1432  m_cachedHull.Mirror( aFlipLeftRight, !aFlipLeftRight, m_pos );
1433 
1435 }
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
SHAPE_POLY_SET m_poly_courtyard_back
Definition: footprint.h:737
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:194
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
double m_orient
Definition: footprint.h:687
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: lset.cpp:521
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
FP_TEXT * m_reference
Definition: footprint.h:689
int m_visibleBBoxCacheTimeStamp
Definition: footprint.h:708
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:385
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirror the line points about y or x (or both)
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40
FP_TEXT * m_value
Definition: footprint.h:690
FP_ZONES m_fp_zones
Definition: footprint.h:684
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip entity during footprint flip.
Definition: fp_text.cpp:134
SHAPE_POLY_SET m_poly_courtyard_front
Definition: footprint.h:736
SHAPE_POLY_SET m_cachedHull
Definition: footprint.h:711
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
wxPoint m_pos
Definition: footprint.h:688
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
Definition: footprint.cpp:1342
int m_boundingBoxCacheTimeStamp
Definition: footprint.h:706
int m_textExcludedBBoxCacheTimeStamp
Definition: footprint.h:710
DRAWINGS m_drawings
Definition: footprint.h:682
Definition: pad.h:60
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1438
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173
PADS m_pads
Definition: footprint.h:683

References FP_TEXT::Flip(), FlipLayer(), BOARD_ITEM::GetLayer(), m_boundingBoxCacheTimeStamp, m_cachedHull, m_drawings, m_fp_zones, m_orient, m_pads, m_poly_courtyard_back, m_poly_courtyard_front, m_pos, m_reference, m_textExcludedBBoxCacheTimeStamp, m_value, m_visibleBBoxCacheTimeStamp, MIRROR(), SHAPE_POLY_SET::Mirror(), NORMALIZE_ANGLE_180(), pad, PCB_FP_SHAPE_T, PCB_FP_TEXT_T, Rotate(), BOARD_ITEM::SetLayer(), and SetPosition().

Referenced by PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_IO::FootprintSave(), CADSTAR_PCB_ARCHIVE_LOADER::loadComponents(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FABMASTER::loadFootprints(), EAGLE_PLUGIN::orientFootprintAndText(), BOARD_EDITOR_CONTROL::PlaceFootprint(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow().

◆ Flip() [2/2]

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

Definition at line 315 of file board_item.h.

316  {
317  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
318  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.h:310

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

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

87  {
89  TYPE_ID thisType = TYPE_HASH( *this );
90  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
91  return object ? aProperty->getter( object ) : wxAny();
92  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual wxAny getter(void *aObject) const =0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

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

◆ Get() [2/3]

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

Definition at line 95 of file inspectable.h.

96  {
98  TYPE_ID thisType = TYPE_HASH( *this );
99  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
100  return object ? aProperty->get<T>( object ) : T();
101  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Get() [3/3]

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

Definition at line 104 of file inspectable.h.

105  {
107  TYPE_ID thisType = TYPE_HASH( *this );
108  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109  boost::optional<T> ret;
110 
111  if( prop )
112  {
113  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114 
115  if( object )
116  ret = prop->get<T>( object );
117  }
118 
119  return ret;
120  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ GetAllDrawingLayers()

void FOOTPRINT::GetAllDrawingLayers ( int  aLayers[],
int &  aCount,
bool  aIncludePads = true 
) const

Return a set of all layers that this footprint has drawings on similar to ViewGetLayers().

Parameters
aLayersis an array to store layer ids.
aCountis the number of layers stored in the array.
aIncludePadscontrols whether to also include pad layers.

Definition at line 1201 of file footprint.cpp.

1202 {
1203  std::unordered_set<int> layers;
1204 
1205  for( BOARD_ITEM* item : m_drawings )
1206  layers.insert( static_cast<int>( item->GetLayer() ) );
1207 
1208  if( aIncludePads )
1209  {
1210  for( PAD* pad : m_pads )
1211  {
1212  int pad_layers[KIGFX::VIEW::VIEW_MAX_LAYERS], pad_layers_count;
1213  pad->ViewGetLayers( pad_layers, pad_layers_count );
1214 
1215  for( int i = 0; i < pad_layers_count; i++ )
1216  layers.insert( pad_layers[i] );
1217  }
1218  }
1219 
1220  aCount = layers.size();
1221  int i = 0;
1222 
1223  for( int layer : layers )
1224  aLayers[i++] = layer;
1225 }
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:700
DRAWINGS m_drawings
Definition: footprint.h:682
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:683

References m_drawings, m_pads, pad, and KIGFX::VIEW::VIEW_MAX_LAYERS.

◆ GetArea()

double FOOTPRINT::GetArea ( int  aPadding = 0) const

Definition at line 598 of file footprint.cpp.

599 {
600  EDA_RECT bbox = GetBoundingBox( false, false );
601 
602  double w = std::abs( static_cast<double>( bbox.GetWidth() ) ) + aPadding;
603  double h = std::abs( static_cast<double>( bbox.GetHeight() ) ) + aPadding;
604  return w * h;
605 }
int GetWidth() const
Definition: eda_rect.h:114
int GetHeight() const
Definition: eda_rect.h:115
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:631
Handle the component boundary box.
Definition: eda_rect.h:42

References GetBoundingBox(), EDA_RECT::GetHeight(), and EDA_RECT::GetWidth().

Referenced by sortFootprintsByComplexity(), sortFootprintsByRatsnestSize(), and SpreadFootprints().

◆ GetAttributes()

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

Return the BOARD in which this BOARD_ITEM resides, or NULL if none.

Definition at line 46 of file board_item.cpp.

47 {
48  if( Type() == PCB_T )
49  return (BOARD*) this;
50 
51  BOARD_ITEM* parent = GetParent();
52 
53  if( parent )
54  return parent->GetBoard();
55 
56  return NULL;
57 }
Definition: typeinfo.h:84
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
#define NULL
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

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

Referenced by PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), ZONE::BuildSmoothedPoly(), KIGFX::PCB_PAINTER::draw(), exprFromTo(), VIA::FlashLayer(), PAD::FlashLayer(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), TRACK::Flip(), FP_SHAPE::Flip(), FP_TEXT::Flip(), DIMENSION_BASE::Flip(), ARC::Flip(), PCB_SHAPE::Flip(), VIA::Flip(), ZONE::Flip(), BOARD_ITEM::GetBoard(), GetBoundingBox(), GetBoundingHull(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), ZONE::GetInteractingZones(), BOARD_ITEM::GetLayerName(), VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), BOARD_CONNECTED_ITEM::GetOwnClearance(), ZONE::GetSelectMenuText(), DRC_ENGINE::GetShape(), FP_TEXT::GetShownText(), PAD::GetSolderMaskMargin(), PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), TRACK::GetWidthConstraints(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), BOARD_ITEM::layerMaskDescribe(), VIA::layerMaskDescribe(), CONVERT_TOOL::makePolysFromCircles(), PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD::ResolveDRCExclusions(), BOARD_CONNECTED_ITEM::SetNetCode(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), ZONE::TransformSmoothedOutlineToPolygon(), ZONE::TransformSolidAreasShapesToPolygon(), TRACK::ViewBBox(), ViewBBox(), VIA::ViewGetLOD(), and PAD::ViewGetLOD().

◆ GetBoundingBox() [1/2]

const EDA_RECT FOOTPRINT::GetBoundingBox ( ) const
overridevirtual

Return 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 631 of file footprint.cpp.

632 {
633  return GetBoundingBox( true, true );
634 }
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:631

Referenced by AR_AUTOPLACER::buildFpAreas(), PCB_GRID_HELPER::computeAnchors(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), GetArea(), GetBoundingBoxes(), FOOTPRINT_EDIT_FRAME::GetDocumentExtents(), AR_AUTOPLACER::getOptimalFPPlacement(), HitTest(), PCB_SELECTION_TOOL::hitTestDistance(), insideFootprintCourtyard(), moveFootprintsInArea(), SpreadFootprints(), AR_AUTOPLACER::testFootprintOnBoard(), and ViewBBox().

◆ GetBoundingBox() [2/2]

const EDA_RECT FOOTPRINT::GetBoundingBox ( bool  aIncludeText,
bool  aIncludeInvisibleText 
) const

Definition at line 637 of file footprint.cpp.

638 {
639  BOARD* board = GetBoard();
640 
641  if( board )
642  {
643  if( aIncludeText && aIncludeInvisibleText )
644  {
645  if( m_boundingBoxCacheTimeStamp >= board->GetTimeStamp() )
646  return m_cachedBoundingBox;
647  }
648  else if( aIncludeText )
649  {
650  if( m_visibleBBoxCacheTimeStamp >= board->GetTimeStamp() )
651  return m_cachedVisibleBBox;
652  }
653  else
654  {
657  }
658  }
659 
660  EDA_RECT area;
661 
662  area.SetOrigin( m_pos );
663  area.SetEnd( m_pos );
664  area.Inflate( Millimeter2iu( 0.25 ) ); // Give a min size to the area
665 
666  for( BOARD_ITEM* item : m_drawings )
667  {
668  if( item->Type() == PCB_FP_SHAPE_T )
669  area.Merge( item->GetBoundingBox() );
670  }
671 
672  for( PAD* pad : m_pads )
673  area.Merge( pad->GetBoundingBox() );
674 
675  for( FP_ZONE* zone : m_fp_zones )
676  area.Merge( zone->GetBoundingBox() );
677 
678  // Groups do not contribute to the rect, only their members
679 
680  if( aIncludeText )
681  {
682  for( BOARD_ITEM* item : m_drawings )
683  {
684  if( item->Type() == PCB_FP_TEXT_T )
685  area.Merge( item->GetBoundingBox() );
686  }
687 
688  // This can be further optimized when aIncludeInvisibleText is true, but currently
689  // leaving this as is until it's determined there is a noticeable speed hit.
690  bool valueLayerIsVisible = true;
691  bool refLayerIsVisible = true;
692 
693  if( board )
694  {
695  // The first "&&" conditional handles the user turning layers off as well as layers
696  // not being present in the current PCB stackup. Values, references, and all
697  // footprint text can also be turned off via the GAL meta-layers, so the 2nd and
698  // 3rd "&&" conditionals handle that.
699  valueLayerIsVisible = board->IsLayerVisible( m_value->GetLayer() )
701  && board->IsElementVisible( LAYER_MOD_TEXT_FR );
702 
703  refLayerIsVisible = board->IsLayerVisible( m_reference->GetLayer() )
705  && board->IsElementVisible( LAYER_MOD_TEXT_FR );
706  }
707 
708 
709  if( ( m_value->IsVisible() && valueLayerIsVisible ) || aIncludeInvisibleText )
710  area.Merge( m_value->GetBoundingBox() );
711 
712  if( ( m_reference->IsVisible() && refLayerIsVisible ) || aIncludeInvisibleText )
713  area.Merge( m_reference->GetBoundingBox() );
714  }
715 
716  if( board )
717  {
718  if( aIncludeText && aIncludeInvisibleText )
719  {
721  m_cachedBoundingBox = area;
722  }
723  else if( aIncludeText )
724  {
726  m_cachedVisibleBBox = area;
727  }
728  else
729  {
732  }
733  }
734 
735  return area;
736 }
EDA_RECT m_cachedVisibleBBox
Definition: footprint.h:707
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:431
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
bool IsVisible() const
Definition: eda_text.h:193
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:126
show footprints values (when texts are visibles)
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
FP_TEXT * m_reference
Definition: footprint.h:689
int m_visibleBBoxCacheTimeStamp
Definition: footprint.h:708
FP_TEXT * m_value
Definition: footprint.h:690
EDA_RECT m_cachedBoundingBox
Definition: footprint.h:705
FP_ZONES m_fp_zones
Definition: footprint.h:684
void SetEnd(int x, int y)
Definition: eda_rect.h:187
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
wxPoint m_pos
Definition: footprint.h:688
int m_boundingBoxCacheTimeStamp
Definition: footprint.h:706
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:507
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition: board.cpp:453
const EDA_RECT GetBoundingBox() const override
Set absolute coordinates.
Definition: fp_text.cpp:224
int m_textExcludedBBoxCacheTimeStamp
Definition: footprint.h:710
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
int GetTimeStamp()
Definition: board.h:286
Handle the component boundary box.
Definition: eda_rect.h:42
EDA_RECT m_cachedTextExcludedBBox
Definition: footprint.h:709
DRAWINGS m_drawings
Definition: footprint.h:682
Definition: pad.h:60
static constexpr int Millimeter2iu(double mm)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173
A specialization of ZONE for use in footprints.
Definition: zone.h:943
PADS m_pads
Definition: footprint.h:683
show footprints references (when texts are visibles)
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363

References BOARD_ITEM::GetBoard(), FP_TEXT::GetBoundingBox(), BOARD_ITEM::GetLayer(), BOARD::GetTimeStamp(), EDA_RECT::Inflate(), BOARD::IsElementVisible(), BOARD::IsLayerVisible(), EDA_TEXT::IsVisible(), LAYER_MOD_REFERENCES, LAYER_MOD_TEXT_FR, LAYER_MOD_VALUES, m_boundingBoxCacheTimeStamp, m_cachedBoundingBox, m_cachedTextExcludedBBox, m_cachedVisibleBBox, m_drawings, m_fp_zones, m_pads, m_pos, m_reference, m_textExcludedBBoxCacheTimeStamp, m_value, m_visibleBBoxCacheTimeStamp, EDA_RECT::Merge(), Millimeter2iu(), pad, PCB_FP_SHAPE_T, PCB_FP_TEXT_T, EDA_RECT::SetEnd(), and EDA_RECT::SetOrigin().

◆ GetBoundingHull()

SHAPE_POLY_SET FOOTPRINT::GetBoundingHull ( ) const

Return a bounding polygon for the shapes and pads in the footprint.

This operation is slower but more accurate than calculating a bounding box.

Definition at line 739 of file footprint.cpp.

740 {
741  BOARD* board = GetBoard();
742 
743  if( board )
744  {
745  if( m_hullCacheTimeStamp >= board->GetTimeStamp() )
746  return m_cachedHull;
747  }
748 
749  SHAPE_POLY_SET rawPolys;
750  SHAPE_POLY_SET hull;
751 
752  for( BOARD_ITEM* item : m_drawings )
753  {
754  if( item->Type() == PCB_FP_SHAPE_T )
755  {
756  item->TransformShapeWithClearanceToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
757  ERROR_OUTSIDE );
758  }
759 
760  // We intentionally exclude footprint text from the bounding hull.
761  }
762 
763  for( PAD* pad : m_pads )
764  {
765  pad->TransformShapeWithClearanceToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
766  ERROR_OUTSIDE );
767  }
768 
769  for( FP_ZONE* zone : m_fp_zones )
770  {
771  for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
772  {
773  SHAPE_POLY_SET layerPoly = zone->GetFilledPolysList( layer );
774 
775  for( int ii = 0; ii < layerPoly.OutlineCount(); ii++ )
776  {
777  const SHAPE_LINE_CHAIN& poly = layerPoly.COutline( ii );
778  rawPolys.AddOutline( poly );
779  }
780  }
781  }
782 
783  // If there are some graphic items, build the actual hull.
784  // However if no items, create a minimal polygon (can happen if a footprint
785  // is created with no item: it contains only 2 texts.
786  if( rawPolys.OutlineCount() == 0 )
787  {
788  // generate a small dummy rectangular outline around the anchor
789  const int halfsize = Millimeter2iu( 0.02 );
790 
791  rawPolys.NewOutline();
792  // add a square:
793  rawPolys.Append( GetPosition().x - halfsize, GetPosition().y - halfsize );
794  rawPolys.Append( GetPosition().x + halfsize, GetPosition().y - halfsize );
795  rawPolys.Append( GetPosition().x + halfsize, GetPosition().y + halfsize );
796  rawPolys.Append( GetPosition().x - halfsize, GetPosition().y + halfsize );
797  }
798 
799  std::vector<wxPoint> convex_hull;
800  BuildConvexHull( convex_hull, rawPolys );
801 
804 
805  for( const wxPoint& pt : convex_hull )
806  m_cachedHull.Append( pt );
807 
808  if( board )
810 
811  return m_cachedHull;
812 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
PCB_LAYER_ID
A quick note on layer IDs:
FP_ZONES m_fp_zones
Definition: footprint.h:684
Represent a set of closed polygons.
SHAPE_POLY_SET m_cachedHull
Definition: footprint.h:711
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
int NewOutline()
Creates a new hole in a given outline.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
SHAPE_LINE_CHAIN.
int GetTimeStamp()
Definition: board.h:286
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
wxPoint GetPosition() const override
Definition: footprint.h:182
DRAWINGS m_drawings
Definition: footprint.h:682
Definition: pad.h:60
static constexpr int Millimeter2iu(double mm)
A specialization of ZONE for use in footprints.
Definition: zone.h:943
PADS m_pads
Definition: footprint.h:683
int m_hullCacheTimeStamp
Definition: footprint.h:712
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
void BuildConvexHull(std::vector< wxPoint > &aResult, const std::vector< wxPoint > &aPoly)
Calculate the convex hull of a list of points in counter-clockwise order.
Definition: convex_hull.cpp:87

References SHAPE_POLY_SET::AddOutline(), SHAPE_POLY_SET::Append(), BuildConvexHull(), SHAPE_POLY_SET::COutline(), ERROR_OUTSIDE, BOARD_ITEM::GetBoard(), GetPosition(), BOARD::GetTimeStamp(), m_cachedHull, m_drawings, m_fp_zones, m_hullCacheTimeStamp, m_pads, Millimeter2iu(), SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), pad, PCB_FP_SHAPE_T, SHAPE_POLY_SET::RemoveAllContours(), and UNDEFINED_LAYER.

Referenced by CoverageRatio(), KIGFX::PCB_PAINTER::draw(), GetCoverageArea(), HitTestAccurate(), and PCB_SELECTION_TOOL::hitTestDistance().

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

This defaults to the center of the bounding box if not overridden.

Returns
center point of the item

Reimplemented in ARC, PAD, PCB_SHAPE, and PCB_MARKER.

Definition at line 114 of file board_item.h.

115  {
116  return GetBoundingBox().GetCenter();
117  }
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:73
const wxPoint GetCenter() const
Definition: eda_rect.h:109

References EDA_ITEM::GetBoundingBox(), and EDA_RECT::GetCenter().

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

◆ GetClass()

wxString FOOTPRINT::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 558 of file footprint.h.

559  {
560  return wxT( "FOOTPRINT" );
561  }

Referenced by Visit().

◆ GetContextualTextVars()

void FOOTPRINT::GetContextualTextVars ( wxArrayString *  aVars) const

Return the list of system text vars for this footprint.

Definition at line 424 of file footprint.cpp.

425 {
426  aVars->push_back( wxT( "REFERENCE" ) );
427  aVars->push_back( wxT( "VALUE" ) );
428  aVars->push_back( wxT( "LAYER" ) );
429 }

◆ GetCoverageArea()

double FOOTPRINT::GetCoverageArea ( const BOARD_ITEM aItem,
const GENERAL_COLLECTOR aCollector 
)
static

Return the initial comments block or NULL if none, without transfer of ownership.

Definition at line 1747 of file footprint.cpp.

1748 {
1749  int textMargin = KiROUND( 5 * aCollector.GetGuide()->OnePixelInIU() );
1750  SHAPE_POLY_SET poly;
1751 
1752  if( aItem->Type() == PCB_MARKER_T )
1753  {
1754  const PCB_MARKER* marker = static_cast<const PCB_MARKER*>( aItem );
1755  SHAPE_LINE_CHAIN markerShape;
1756 
1757  marker->ShapeToPolygon( markerShape );
1758  return markerShape.Area();
1759  }
1760  else if( aItem->Type() == PCB_GROUP_T )
1761  {
1762  double combinedArea = 0.0;
1763 
1764  for( BOARD_ITEM* member : static_cast<const PCB_GROUP*>( aItem )->GetItems() )
1765  combinedArea += GetCoverageArea( member, aCollector );
1766 
1767  return combinedArea;
1768  }
1769  if( aItem->Type() == PCB_FOOTPRINT_T )
1770  {
1771  const FOOTPRINT* footprint = static_cast<const FOOTPRINT*>( aItem );
1772 
1773  poly = footprint->GetBoundingHull();
1774  }
1775  else if( aItem->Type() == PCB_FP_TEXT_T )
1776  {
1777  const FP_TEXT* text = static_cast<const FP_TEXT*>( aItem );
1778 
1779  text->TransformTextShapeWithClearanceToPolygon( poly, UNDEFINED_LAYER, textMargin,
1780  ARC_LOW_DEF, ERROR_OUTSIDE );
1781  }
1782  else if( aItem->Type() == PCB_SHAPE_T )
1783  {
1784  // Approximate "linear" shapes with just their width squared, as we don't want to consider
1785  // a linear shape as being much bigger than another for purposes of selection filtering
1786  // just because it happens to be really long.
1787 
1788  const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( aItem );
1789 
1790  switch( shape->GetShape() )
1791  {
1792  case S_SEGMENT:
1793  case S_ARC:
1794  case S_CURVE:
1795  return shape->GetWidth() * shape->GetWidth();
1796 
1797  case S_RECT:
1798  case S_CIRCLE:
1799  case S_POLYGON:
1800  {
1801  if( !shape->IsFilled() )
1802  return shape->GetWidth() * shape->GetWidth();
1803 
1805  }
1806 
1807  default:
1809  ARC_LOW_DEF, ERROR_OUTSIDE );
1810  }
1811  }
1812  else if( aItem->Type() == PCB_TRACE_T || aItem->Type() == PCB_ARC_T )
1813  {
1814  double width = static_cast<const TRACK*>( aItem )->GetWidth();
1815  return width * width;
1816  }
1817  else
1818  {
1820  ARC_LOW_DEF, ERROR_OUTSIDE );
1821  }
1822 
1823  poly.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1824  poly.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1825  return polygonArea( poly );
1826 }
static double GetCoverageArea(const BOARD_ITEM *aItem, const GENERAL_COLLECTOR &aCollector)
Return the initial comments block or NULL if none, without transfer of ownership.
Definition: footprint.cpp:1747
bool IsFilled() const
Definition: pcb_shape.h:96
SHAPE_POLY_SET GetBoundingHull() const
Return a bounding polygon for the shapes and pads in the footprint.
Definition: footprint.cpp:739
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
virtual double OnePixelInIU() const =0
int GetWidth() const
Definition: pcb_shape.h:118
polygon (not yet used for tracks, but could be in microwave apps)
Definition: board_item.h:54
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
usual segment : line with rounded ends
Definition: board_item.h:50
Arcs (with rounded ends)
Definition: board_item.h:52
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
segment with non rounded ends
Definition: board_item.h:51
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
const COLLECTORS_GUIDE * GetGuide() const
Definition: collectors.h:343
Represent a set of closed polygons.
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
void ShapeToPolygon(SHAPE_LINE_CHAIN &aPolygon, int aScale=-1) const
Return the shape polygon in internal units in a SHAPE_LINE_CHAIN the coordinates are relatives to the...
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:98
SHAPE_LINE_CHAIN.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
ring
Definition: board_item.h:53
virtual void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
Convert the item shape to a closed polygon.
Definition: board_item.cpp:129
PCB_SHAPE_TYPE_T GetShape() const
Definition: pcb_shape.h:130
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
Bezier Curve.
Definition: board_item.h:55
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
static double polygonArea(SHAPE_POLY_SET &aPolySet)
Definition: footprint.cpp:1730

References SHAPE_LINE_CHAIN::Area(), ERROR_OUTSIDE, GetBoundingHull(), GENERAL_COLLECTOR::GetGuide(), PCB_SHAPE::GetShape(), PCB_SHAPE::GetWidth(), PCB_SHAPE::IsFilled(), KI_FALLTHROUGH, KiROUND(), COLLECTORS_GUIDE::OnePixelInIU(), PCB_ARC_T, PCB_FOOTPRINT_T, PCB_FP_TEXT_T, PCB_GROUP_T, PCB_MARKER_T, PCB_SHAPE_T, PCB_TRACE_T, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, polygonArea(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, MARKER_BASE::ShapeToPolygon(), text, BOARD_ITEM::TransformShapeWithClearanceToPolygon(), EDA_ITEM::Type(), and UNDEFINED_LAYER.

Referenced by PCB_SELECTION_TOOL::GuessSelectionCandidates().

◆ GetDescription()

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 208 of file eda_item.h.

209  {
210  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
212 
213  return m_flags & mask;
214  }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:108
#define STRUCT_DELETED
flag indication structures to be erased
Definition: eda_item.h:116
#define IS_MOVED
Item being moved.
Definition: eda_item.h:106
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:109
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: eda_item.h:120
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:111
STATUS_FLAGS m_flags
Definition: eda_item.h:531
#define IS_NEW
New item, just created.
Definition: eda_item.h:107

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

Referenced by EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_COMPONENT::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveShape()

std::shared_ptr< SHAPE > FOOTPRINT::GetEffectiveShape ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER) const
overridevirtual

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

This routine returns a COMPOUND shape (set of simple shapes which make up the pad for use with routing, collision determination, etc).

Note
This list can contain a SHAPE_SIMPLE (a simple single-outline non-intersecting polygon), but should never contain a SHAPE_POLY_SET (a complex polygon consisting of multiple outlines and/or holes).
Parameters
aLayerin case of items spanning multiple layers, only the shapes belonging to aLayer will be returned. Pass UNDEFINED_LAYER to return shapes for all layers.

Reimplemented from BOARD_ITEM.

Definition at line 1905 of file footprint.cpp.

1906 {
1907  std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
1908 
1909  // There are several possible interpretations here:
1910  // 1) the bounding box (without or without invisible items)
1911  // 2) just the pads and "edges" (ie: non-text graphic items)
1912  // 3) the courtyard
1913 
1914  // We'll go with (2) for now....
1915 
1916  for( PAD* pad : Pads() )
1917  shape->AddShape( pad->GetEffectiveShape( aLayer )->Clone() );
1918 
1919  for( BOARD_ITEM* item : GraphicalItems() )
1920  {
1921  if( item->Type() == PCB_FP_SHAPE_T )
1922  shape->AddShape( item->GetEffectiveShape( aLayer )->Clone() );
1923  }
1924 
1925  return shape;
1926 }
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
PADS & Pads()
Definition: footprint.h:164
DRAWINGS & GraphicalItems()
Definition: footprint.h:167
Definition: pad.h:60

References GraphicalItems(), pad, Pads(), and PCB_FP_SHAPE_T.

◆ GetFlag()

int FOOTPRINT::GetFlag ( ) const
inline

Definition at line 236 of file footprint.h.

236 { return m_arflag; }
int m_arflag
Definition: footprint.h:726

Referenced by DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::pickFootprint(), and sortFootprintsByRatsnestSize().

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in BOARD, PCB_SHAPE, and TRACK.

Definition at line 309 of file eda_item.h.

309 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:302

References EDA_ITEM::GetPosition().

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

◆ GetFPID()

const LIB_ID& FOOTPRINT::GetFPID ( ) const
inline

Definition at line 190 of file footprint.h.

190 { return m_fpid; }
LIB_ID m_fpid
Definition: footprint.h:691

Referenced by FOOTPRINT_EDIT_FRAME::AddFootprintToBoard(), BASIC_FOOTPRINT_INFO::BASIC_FOOTPRINT_INFO(), FOOTPRINT_EDIT_FRAME::canCloseWindow(), FOOTPRINT_EDIT_FRAME::ClearModify(), CreateDevicesSection(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), doPushPadProperties(), FOOTPRINT_EDIT_FRAME::editFootprintProperties(), PCB_EDIT_FRAME::ExchangeFootprint(), FOOTPRINT_EDIT_FRAME::ExportFootprint(), BOARD_EDITOR_CONTROL::ExportNetlist(), PCB_IO::FootprintSave(), FP_LIB_TABLE::FootprintSave(), PCB_IO::format(), PLACE_FILE_EXPORTER::GenPositionData(), FOOTPRINT_EDIT_FRAME::GetLoadedFPID(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), LEGACY_PLUGIN::loadFOOTPRINT(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), PCB_EDIT_FRAME::LoadFootprints(), LEGACY_PLUGIN::loadFP_SHAPE(), LEGACY_PLUGIN::loadPAD(), DSN::SPECCTRA_DB::makeIMAGE(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), DIALOG_EXCHANGE_FOOTPRINTS::processFootprint(), BOARD_NETLIST_UPDATER::replaceComponent(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), setLibNickname(), PCB_EDIT_FRAME::ShowFootprintPropertiesDialog(), BOARD_NETLIST_UPDATER::testConnectivity(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), PCB_CONTROL::UpdateMessagePanel(), FOOTPRINT_EDIT_FRAME::UpdateTitle(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetFpPadsLocalBbox()

EDA_RECT FOOTPRINT::GetFpPadsLocalBbox ( ) const

Return the bounding box containing pads when the footprint is on the front side, orientation 0, position 0,0.

Mainly used in Gerber place file to draw a footprint outline when the courtyard is missing or broken.

Returns
The rectangle containing the pads for the normalized footprint.

Definition at line 608 of file footprint.cpp.

609 {
610  EDA_RECT area;
611 
612  // We want the bounding box of the footprint pads at rot 0, not flipped
613  // Create such a image:
614  FOOTPRINT dummy( *this );
615 
616  dummy.SetPosition( wxPoint( 0, 0 ) );
617 
618  if( dummy.IsFlipped() )
619  dummy.Flip( wxPoint( 0, 0 ) , false );
620 
621  if( dummy.GetOrientation() )
622  dummy.SetOrientation( 0 );
623 
624  for( PAD* pad : dummy.Pads() )
625  area.Merge( pad->GetBoundingBox() );
626 
627  return area;
628 }
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:431
virtual void SetPosition(const wxPoint &aPos)
Definition: eda_item.h:303
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
Handle the component boundary box.
Definition: eda_rect.h:42
Definition: pad.h:60

References dummy(), EDA_RECT::Merge(), pad, and EDA_ITEM::SetPosition().

◆ GetInitialComments()

const wxArrayString* FOOTPRINT::GetInitialComments ( ) const
inline

Definition at line 644 of file footprint.h.

644 { return m_initial_comments; }
wxArrayString * m_initial_comments
Definition: footprint.h:733

Referenced by PCB_IO::format().

◆ GetKeywords()

◆ GetLastEditTime()

timestamp_t FOOTPRINT::GetLastEditTime ( ) const
inline

Definition at line 332 of file footprint.h.

332 { return m_lastEditTime; }
timestamp_t m_lastEditTime
Definition: footprint.h:725

Referenced by PCB_IO::format(), and PCB_CONTROL::UpdateMessagePanel().

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Return the primary layer this item is on.

Reimplemented in ZONE.

Definition at line 173 of file board_item.h.

173 { return m_layer; }
PCB_LAYER_ID m_layer
Definition: board_item.h:363

References BOARD_ITEM::m_layer.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::addFootprintShapesWithClearance(), GRAPHICS_CLEANER::areEquivalent(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), AR_AUTOPLACER::buildFpAreas(), TRACKS_CLEANER::cleanup(), CreateBoardSection(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewFootprint(), CreateRoutesSection(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::ExchangeFootprint(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), extractDiffPairCoupledItems(), EDIT_TOOL::FilletTracks(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), TRACK::Flip(), FP_SHAPE::Flip(), FP_TEXT::Flip(), DIMENSION_BASE::Flip(), Flip(), ARC::Flip(), PCB_SHAPE::Flip(), FOOTPRINT_DESC::FOOTPRINT_DESC(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::format(), PCB_IO::formatLayer(), FP_TEXT::FP_TEXT(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), GetBoundingBox(), ZONE::GetLayer(), getMatchingTextItem(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), AR_AUTOPLACER::getOptimalFPPlacement(), BOARD::GetPad(), TRACK::GetWidthConstraints(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), idf_export_footprint(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), isEdge(), PAD::IsFlipped(), PNS_KICAD_IFACE::IsItemVisible(), BOARD_ITEM::IsOnCopperLayer(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), TRACK::cmp_tracks::operator()(), BOARD_ITEM::ptr_cmp::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), EAGLE_PLUGIN::packagePad(), BRDITEMS_PLOTTER::PlotBoardGraphicItems(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintGraphicItems(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), BRDITEMS_PLOTTER::PlotPcbShape(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotPcbText(), CONVERT_TOOL::PolyToLines(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), PAD_TOOL::recombinePad(), CLIPBOARD_IO::SaveSelection(), CONVERT_TOOL::SegmentToArc(), PCB_SELECTION_TOOL::Selectable(), GLOBAL_EDIT_TOOL::swapBoardItem(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), PNS_KICAD_IFACE_BASE::syncTrack(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), AR_AUTOPLACER::testFootprintOnBoard(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), BOARD_ADAPTER::transformFPShapesToPolygon(), TransformFPShapesWithClearanceToPolygon(), TRACK::ViewGetLayers(), FP_TEXT::ViewGetLayers(), FP_TEXT::ViewGetLOD(), FP_ZONE::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

Return the name of the PCB layer on which the item resides.

Returns
the layer name associated with this item.

Definition at line 60 of file board_item.cpp.

61 {
62  BOARD* board = GetBoard();
63 
64  if( board )
65  return board->GetLayerName( m_layer );
66 
67  // If no parent, return standard name
69 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:342
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
PCB_LAYER_ID m_layer
Definition: board_item.h:363
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:676

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

Referenced by PCB_TEXT::GetMsgPanelInfo(), PCB_TARGET::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), DIMENSION_BASE::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), LEADER::GetMsgPanelInfo(), PCB_TEXT::GetSelectMenuText(), FP_SHAPE::GetSelectMenuText(), TRACK::GetSelectMenuText(), DIMENSION_BASE::GetSelectMenuText(), PCB_SHAPE::GetSelectMenuText(), PCB_TEXT::GetShownText(), and ResolveTextVar().

◆ GetLayerSet()

◆ GetLink()

◆ GetLocalClearance() [1/2]

◆ GetLocalClearance() [2/2]

int FOOTPRINT::GetLocalClearance ( wxString *  aSource) const
inline

Definition at line 208 of file footprint.h.

209  {
210  if( aSource )
211  *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
212 
213  return m_localClearance;
214  }
const wxString & GetReference() const
Definition: footprint.h:426
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
int m_localClearance
Definition: footprint.h:717
#define _(s)
Definition: 3d_actions.cpp:33

References _, and Format().

◆ GetLocalSolderMaskMargin()

int FOOTPRINT::GetLocalSolderMaskMargin ( ) const
inline

◆ GetLocalSolderPasteMargin()

◆ GetLocalSolderPasteMarginRatio()

double FOOTPRINT::GetLocalSolderPasteMarginRatio ( ) const
inline

◆ GetMenuImage()

BITMAPS FOOTPRINT::GetMenuImage ( ) const
overridevirtual

Return 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 1163 of file footprint.cpp.

1164 {
1165  return BITMAPS::module;
1166 }

References module.

◆ GetMsgPanelInfo()

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

Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 815 of file footprint.cpp.

816 {
817  wxString msg, msg2;
818 
819  aList.emplace_back( m_reference->GetShownText(), m_value->GetShownText() );
820 
821  if( aFrame->IsType( FRAME_FOOTPRINT_VIEWER )
823  || aFrame->IsType( FRAME_FOOTPRINT_EDITOR ) )
824  {
825  wxDateTime date( static_cast<time_t>( m_lastEditTime ) );
826 
827  // Date format: see http://www.cplusplus.com/reference/ctime/strftime
828  if( m_lastEditTime && date.IsValid() )
829  msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year
830  else
831  msg = _( "Unknown" );
832 
833  aList.emplace_back( _( "Last Change" ), msg );
834  }
835  else if( aFrame->IsType( FRAME_PCB_EDITOR ) )
836  {
837  aList.emplace_back( _( "Board Side" ), IsFlipped() ? _( "Back (Flipped)" ) : _( "Front" ) );
838  }
839 
840  auto addToken = []( wxString* aStr, const wxString& aAttr )
841  {
842  if( !aStr->IsEmpty() )
843  *aStr += wxT( ", " );
844 
845  *aStr += aAttr;
846  };
847 
848  wxString status;
849  wxString attrs;
850 
851  if( IsLocked() )
852  addToken( &status, _( "locked" ) );
853 
854  if( m_fpStatus & FP_is_PLACED )
855  addToken( &status, _( "autoplaced" ) );
856 
858  addToken( &attrs, _( "not in schematic" ) );
859 
861  addToken( &attrs, _( "exclude from pos files" ) );
862 
864  addToken( &attrs, _( "exclude from BOM" ) );
865 
866  aList.emplace_back( _( "Status: " ) + status, _( "Attributes:" ) + wxS( " " ) + attrs );
867 
868  aList.emplace_back( _( "Rotation" ), wxString::Format( "%.4g", GetOrientationDegrees() ) );
869 
870  msg.Printf( _( "Footprint: %s" ), m_fpid.Format().c_str() );
871  msg2.Printf( _( "3D-Shape: %s" ), m_3D_Drawings.empty() ? _( "<none>" )
872  : m_3D_Drawings.front().m_Filename );
873  aList.emplace_back( msg, msg2 );
874 
875  msg.Printf( _( "Doc: %s" ), m_doc );
876  msg2.Printf( _( "Keywords: %s" ), m_keywords );
877  aList.emplace_back( msg, msg2 );
878 }
bool IsLocked() const override
Definition: footprint.h:282
timestamp_t m_lastEditTime
Definition: footprint.h:725
FP_TEXT * m_reference
Definition: footprint.h:689
const char * c_str() const
Definition: utf8.h:102
FP_TEXT * m_value
Definition: footprint.h:690
int m_fpStatus
Definition: footprint.h:693
UTF8 Format() const
Definition: lib_id.cpp:233
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
bool IsFlipped() const
Definition: footprint.h:266
double GetOrientationDegrees() const
Definition: footprint.h:187
wxString m_keywords
Definition: footprint.h:723
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
LIB_ID m_fpid
Definition: footprint.h:691
#define FP_is_PLACED
In autoplace: footprint automatically placed.
Definition: footprint.h:277
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: fp_text.cpp:398
wxString m_doc
Definition: footprint.h:722
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:731
int m_attributes
Definition: footprint.h:692

References _, UTF8::c_str(), LIB_ID::Format(), Format(), FP_BOARD_ONLY, FP_EXCLUDE_FROM_BOM, FP_EXCLUDE_FROM_POS_FILES, FP_is_PLACED, FRAME_FOOTPRINT_EDITOR, FRAME_FOOTPRINT_VIEWER, FRAME_FOOTPRINT_VIEWER_MODAL, FRAME_PCB_EDITOR, GetOrientationDegrees(), FP_TEXT::GetShownText(), IsFlipped(), IsLocked(), EDA_BASE_FRAME::IsType(), m_3D_Drawings, m_attributes, m_doc, m_fpid, m_fpStatus, m_keywords, m_lastEditTime, m_reference, and m_value.

Referenced by DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel().

◆ GetNextPadName()

wxString FOOTPRINT::GetNextPadName ( const wxString &  aLastPadName) const

Return the next available pad name in the footprint.

Parameters
aFillSequenceGapstrue if the numbering should "fill in" gaps in the sequence, else return the highest value + 1
Returns
the next available pad name

Definition at line 1700 of file footprint.cpp.

1701 {
1702  std::set<wxString> usedNames;
1703 
1704  // Create a set of used pad numbers
1705  for( PAD* pad : m_pads )
1706  usedNames.insert( pad->GetName() );
1707 
1708  wxString prefix = UTIL::GetReferencePrefix( aLastPadName );
1709  int num = GetTrailingInt( aLastPadName );
1710 
1711  while( usedNames.count( wxString::Format( "%s%d", prefix, num ) ) )
1712  num++;
1713 
1714  return wxString::Format( "%s%d", prefix, num );
1715 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
wxString GetReferencePrefix(const wxString &aRefDes)
Get the (non-numeric) prefix from a refdes - e.g.
int GetTrailingInt(const wxString &aStr)
Gets the trailing int, if any, from a string.
Definition: string.cpp:736
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:683

References Format(), UTIL::GetReferencePrefix(), GetTrailingInt(), m_pads, and pad.

Referenced by EDIT_TOOL::Duplicate().

◆ GetOrientation()

◆ GetOrientationDegrees()

double FOOTPRINT::GetOrientationDegrees ( ) const
inline

◆ GetOrientationRadians()

double FOOTPRINT::GetOrientationRadians ( ) const
inline

◆ GetPad()

PAD * FOOTPRINT::GetPad ( const wxPoint &  aPosition,
LSET  aLayerMask = LSET::AllLayersMask() 
)

Get a pad at aPosition on aLayerMask in the footprint.

Parameters
aPositionA wxPoint object containing the position to hit test.
aLayerMaskA layer or layers to mask the hit test.
Returns
A pointer to a PAD object if found otherwise NULL.

Definition at line 969 of file footprint.cpp.

970 {
971  for( PAD* pad : m_pads )
972  {
973  // ... and on the correct layer.
974  if( !( pad->GetLayerSet() & aLayerMask ).any() )
975  continue;
976 
977  if( pad->HitTest( aPosition ) )
978  return pad;
979  }
980 
981  return NULL;
982 }
#define NULL
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:683

References m_pads, NULL, and pad.

◆ GetPadCount()

unsigned FOOTPRINT::GetPadCount ( INCLUDE_NPTH_T  aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH)) const

Return the number of pads.

Parameters
aIncludeNPTHincludes non-plated through holes when true. Does not include non-plated through holes when false.
Returns
the number of pads according to aIncludeNPTH.

Definition at line 1004 of file footprint.cpp.

1005 {
1006  if( aIncludeNPTH )
1007  return m_pads.size();
1008 
1009  unsigned cnt = 0;
1010 
1011  for( PAD* pad : m_pads )
1012  {
1013  if( pad->GetAttribute() == PAD_ATTRIB_NPTH )
1014  continue;
1015 
1016  cnt++;
1017  }
1018 
1019  return cnt;
1020 }
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:683

References m_pads, pad, and PAD_ATTRIB_NPTH.

Referenced by BASIC_FOOTPRINT_INFO::BASIC_FOOTPRINT_INFO(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), FOOTPRINT_INFO_IMPL::load(), sortFootprintsByComplexity(), AR_AUTOPLACER::testFootprintOnBoard(), and PCB_CONTROL::UpdateMessagePanel().

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 168 of file board_item.h.

168 { return (BOARD_ITEM_CONTAINER*) m_parent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:529
Abstract interface for BOARD_ITEMs capable of storing other items inside.

References EDA_ITEM::m_parent.

Referenced by PCB_POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), PNS_KICAD_IFACE::Commit(), EDIT_TOOL::copyToClipboard(), CoverageRatio(), EDIT_TOOL::CreateArray(), BOARD_ITEM::DeleteStructure(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::FilterCollectorForGroups(), EDIT_TOOL::Flip(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), PCB_MARKER::GetColorLayer(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), FP_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), FP_TEXT::GetShownText(), getTopLevelGroup(), insideArea(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), DRC_ENGINE::IsNetTie(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), memberOf(), EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), POSITION_RELATIVE_TOOL::PositionRelative(), BOARD_COMMIT::Push(), EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_MARKER::ViewGetLayers(), FP_ZONE::ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetParentGroup()

◆ GetPath()

◆ GetPlacementCost180()

int FOOTPRINT::GetPlacementCost180 ( ) const
inline

◆ GetPlacementCost90()

int FOOTPRINT::GetPlacementCost90 ( ) const
inline

◆ GetPolyCourtyardBack()

const SHAPE_POLY_SET& FOOTPRINT::GetPolyCourtyardBack ( ) const
inline

◆ GetPolyCourtyardFront()

const SHAPE_POLY_SET& FOOTPRINT::GetPolyCourtyardFront ( ) const
inline

Used in DRC to test the courtyard area (a complex polygon).

Returns
the courtyard polygon.

Definition at line 651 of file footprint.h.

651 { return m_poly_courtyard_front; }
SHAPE_POLY_SET m_poly_courtyard_front
Definition: footprint.h:736

Referenced by AR_AUTOPLACER::buildFpAreas(), DRC_ENGINE::EvalRules(), insideArea(), insideFootprintCourtyard(), and DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances().

◆ GetPosition()

wxPoint FOOTPRINT::GetPosition ( ) const
inlineoverridevirtual

Reimplemented from EDA_ITEM.

Definition at line 182 of file footprint.h.

182 { return m_pos; }
wxPoint m_pos
Definition: footprint.h:688

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCAD2KICAD::PCB_PAD::AddToFootprint(), PNS_KICAD_IFACE::Commit(), PCB_GRID_HELPER::computeAnchors(), ConvertOutlineToPolygon(), MICROWAVE_TOOL::createBaseFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::ExchangeFootprint(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), PCB_IO::FootprintSave(), PCB_IO::format(), FP_TEXT::FP_TEXT(), DSN::SPECCTRA_DB::FromBOARD(), PCB_SHAPE::GetBoundingBox(), GetBoundingHull(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad(), AR_AUTOPLACER::getOptimalFPPlacement(), PCB_SHAPE::GetRectCorners(), hash_fp_item(), ALTIUM_PCB::HelperDrawsegmentSetLocalCoord(), idf_export_footprint(), ROUTER_TOOL::InlineDrag(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FABMASTER::loadFootprints(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers(), LEGACY_PLUGIN::loadPAD(), PCB_SHAPE::MakeEffectiveShapes(), DSN::SPECCTRA_DB::makeIMAGE(), moveFootprintsInArea(), EAGLE_PLUGIN::orientFootprintAndText(), EAGLE_PLUGIN::packageHole(), EAGLE_PLUGIN::packageText(), PAD::PAD(), ALTIUM_PCB::ParseComponentsBodies6Data(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), RENDER_3D_LEGACY::renderFootprint(), CLIPBOARD_IO::SaveSelection(), DRAWING_TOOL::SetAnchor(), FP_SHAPE::SetDrawCoord(), FP_TEXT::SetDrawCoord(), PAD::SetDrawCoord(), FP_SHAPE::SetLocalCoord(), FP_TEXT::SetLocalCoord(), PAD::SetLocalCoord(), SetOrientation(), DRC_TEST_PROVIDER_LVS::testFootprints(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), EAGLE_PLUGIN::transferPad(), and PCB_SHAPE::TransformShapeWithClearanceToPolygon().

◆ GetProperties()

const std::map<wxString, wxString>& FOOTPRINT::GetProperties ( ) const
inline

Definition at line 469 of file footprint.h.

469 { return m_properties; }
std::map< wxString, wxString > m_properties
Definition: footprint.h:732

Referenced by PCB_EDIT_FRAME::ExchangeFootprint(), PCB_IO::format(), and BOARD_NETLIST_UPDATER::updateFootprintParameters().

◆ GetProperty()

const wxString& FOOTPRINT::GetProperty ( const wxString &  aKey)
inline

Definition at line 471 of file footprint.h.

471 { return m_properties[ aKey ]; }
std::map< wxString, wxString > m_properties
Definition: footprint.h:732

◆ GetReference()

const wxString& FOOTPRINT::GetReference ( void  ) const
inline
Returns
reference designator text.

Definition at line 426 of file footprint.h.

427  {
428  return m_reference->GetText();
429  }
FP_TEXT * m_reference
Definition: footprint.h:689
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133

Referenced by FOOTPRINT_EDIT_FRAME::AddFootprintToBoard(), AR_AUTOPLACER::AutoplaceFootprints(), CollisionMatchesExpected(), DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange(), PCB_BASE_FRAME::CreateNewFootprint(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), BOARD_EDITOR_CONTROL::ExportNetlist(), FOOTPRINT_DESC::FOOTPRINT_DESC(), FormatProbeItem(), DSN::SPECCTRA_DB::FromBOARD(), PLACE_FILE_EXPORTER::GenReportData(), FP_SHAPE::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), DIALOG_BOARD_REANNOTATE::GetNewRefDes(), GetSelectMenuText(), getShapeName(), IncrementReference(), GENERAL_COLLECTOR::Inspect(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), EAGLE_PLUGIN::loadElements(), CADSTAR_PCB_ARCHIVE_LOADER::loadNets(), EDA_3D_CANVAS::OnMouseMove(), ALTIUM_PCB::ParsePads6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPad(), DIALOG_EXCHANGE_FOOTPRINTS::processFootprint(), BOARD_NETLIST_UPDATER::replaceComponent(), CLIPBOARD_IO::SaveSelection(), DRC_TEST_PROVIDER_LVS::testFootprints(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), BOARD_NETLIST_UPDATER::updateComponentPadConnections(), BOARD_NETLIST_UPDATER::updateFootprintParameters(), FOOTPRINT_EDIT_FRAME::UpdateTitle(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetSelectMenuText()

wxString FOOTPRINT::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

Return 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 1152 of file footprint.cpp.

1153 {
1154  wxString reference = GetReference();
1155 
1156  if( reference.IsEmpty() )
1157  reference = _( "<no reference designator>" );
1158 
1159  return wxString::Format( _( "Footprint %s" ), reference );
1160 }
const wxString & GetReference() const
Definition: footprint.h:426
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#define _(s)
Definition: 3d_actions.cpp:33

References _, Format(), and GetReference().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 187 of file eda_item.h.

188  {
189  return m_status & type;
190  }
STATUS_FLAGS m_status
Definition: eda_item.h:528

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 200 of file eda_item.h.

200 { return m_status; }
STATUS_FLAGS m_status
Definition: eda_item.h:528

References EDA_ITEM::m_status.

◆ GetThermalGap()

int FOOTPRINT::GetThermalGap ( ) const
inline

Definition at line 229 of file footprint.h.

229 { return m_thermalGap; }
int m_thermalGap
Definition: footprint.h:716

Referenced by FOOTPRINT_DESC::FOOTPRINT_DESC(), PCB_IO::format(), and PAD::GetEffectiveThermalGap().

◆ GetThermalWidth()

int FOOTPRINT::GetThermalWidth ( ) const
inline

Definition at line 226 of file footprint.h.

226 { return m_thermalWidth; }
int m_thermalWidth
Definition: footprint.h:715

Referenced by FOOTPRINT_DESC::FOOTPRINT_DESC(), PCB_IO::format(), and PAD::GetEffectiveThermalSpokeWidth().

◆ GetTopLeftPad()

PAD * FOOTPRINT::GetTopLeftPad ( )

Definition at line 985 of file footprint.cpp.

986 {
987  PAD* topLeftPad = m_pads.front();
988 
989  for( PAD* p : m_pads )
990  {
991  wxPoint pnt = p->GetPosition(); // GetPosition() returns the center of the pad
992 
993  if( ( pnt.x < topLeftPad->GetPosition().x ) ||
994  ( topLeftPad->GetPosition().x == pnt.x && pnt.y < topLeftPad->GetPosition().y ) )
995  {
996  topLeftPad = p;
997  }
998  }
999 
1000  return topLeftPad;
1001 }
wxPoint GetPosition() const override
Definition: pad.h:177
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:683

References PAD::GetPosition(), and m_pads.

◆ GetUniquePadCount()

unsigned FOOTPRINT::GetUniquePadCount ( INCLUDE_NPTH_T  aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH)) const

Return the number of unique non-blank pads.

A complex pad can be built with many pads having the same pad name to create a complex shape or fragmented solder paste areas.

Parameters
aIncludeNPTHincludes non-plated through holes when true. Does not include non-plated through holes when false.
Returns
the number of unique pads according to aIncludeNPTH.

Definition at line 1023 of file footprint.cpp.

1024 {
1025  std::set<wxString> usedNames;
1026 
1027  // Create a set of used pad numbers
1028  for( PAD* pad : m_pads )
1029  {
1030  // Skip pads not on copper layers (used to build complex
1031  // solder paste shapes for instance)
1032  if( ( pad->GetLayerSet() & LSET::AllCuMask() ).none() )
1033  continue;
1034 
1035  // Skip pads with no name, because they are usually "mechanical"
1036  // pads, not "electrical" pads
1037  if( pad->GetName().IsEmpty() )
1038  continue;
1039 
1040  if( !aIncludeNPTH )
1041  {
1042  // skip NPTH
1043  if( pad->GetAttribute() == PAD_ATTRIB_NPTH )
1044  {
1045  continue;
1046  }
1047  }
1048 
1049  usedNames.insert( pad->GetName() );
1050  }
1051 
1052  return usedNames.size();
1053 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:683

References LSET::AllCuMask(), m_pads, pad, and PAD_ATTRIB_NPTH.

Referenced by BASIC_FOOTPRINT_INFO::BASIC_FOOTPRINT_INFO(), and FOOTPRINT_INFO_IMPL::load().

◆ GetValue()

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ GetZoneConnection()

ZONE_CONNECTION FOOTPRINT::GetZoneConnection ( ) const
inline

◆ GetZoneSettings()

virtual const ZONE_SETTINGS& BOARD_ITEM_CONTAINER::GetZoneSettings ( ) const
inlinevirtualinherited

Fetch the zone settings for this container.

Reimplemented in BOARD.

Definition at line 83 of file board_item_container.h.

84  {
85  return m_zoneSettings;
86  }

References BOARD_ITEM_CONTAINER::m_zoneSettings.

Referenced by ZONE::ZONE().

◆ GraphicalItems() [1/2]

◆ GraphicalItems() [2/2]

const DRAWINGS& FOOTPRINT::GraphicalItems ( ) const
inline

Definition at line 168 of file footprint.h.

168 { return m_drawings; }
DRAWINGS m_drawings
Definition: footprint.h:682

◆ Groups() [1/2]

FP_GROUPS& FOOTPRINT::Groups ( )
inline

◆ Groups() [2/2]

const FP_GROUPS& FOOTPRINT::Groups ( ) const
inline

Definition at line 174 of file footprint.h.

174 { return m_fp_groups; }
FP_GROUPS m_fp_groups
Definition: footprint.h:685

◆ HasFlag()

◆ HasProperty()

bool FOOTPRINT::HasProperty ( const wxString &  aKey)
inline

Definition at line 472 of file footprint.h.

473  {
474  return m_properties.find( aKey ) != m_properties.end();
475  }
std::map< wxString, wxString > m_properties
Definition: footprint.h:732

◆ HasThroughHolePads()

bool FOOTPRINT::HasThroughHolePads ( ) const

Definition at line 1992 of file footprint.cpp.

1993 {
1994  for( PAD* pad : Pads() )
1995  {
1996  if( pad->GetAttribute() != PAD_ATTRIB_SMD )
1997  return true;
1998  }
1999 
2000  return false;
2001 }
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:81
PADS & Pads()
Definition: footprint.h:164
Definition: pad.h:60

References pad, PAD_ATTRIB_SMD, and Pads().

◆ HitTest() [1/2]

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

Test if aPosition is contained within or on the bounding box of an item.

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

Reimplemented from EDA_ITEM.

Definition at line 904 of file footprint.cpp.

905 {
906  EDA_RECT rect = GetBoundingBox( false, false );
907  return rect.Inflate( aAccuracy ).Contains( aPosition );
908 }
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:631
Handle the component boundary box.
Definition: eda_rect.h:42
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363

References EDA_RECT::Contains(), GetBoundingBox(), and EDA_RECT::Inflate().

Referenced by GENERAL_COLLECTOR::Inspect().

◆ HitTest() [2/2]

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

Test if aRect intersects or is contained within the bounding box of an item.

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

Reimplemented from EDA_ITEM.

Definition at line 917 of file footprint.cpp.

918 {
919  EDA_RECT arect = aRect;
920  arect.Inflate( aAccuracy );
921 
922  if( aContained )
923  return arect.Contains( GetBoundingBox( false, false ) );
924  else
925  {
926  // If the rect does not intersect the bounding box, skip any tests
927  if( !aRect.Intersects( GetBoundingBox( false, false ) ) )
928  return false;
929 
930  // Determine if any elements in the FOOTPRINT intersect the rect
931  for( PAD* pad : m_pads )
932  {
933  if( pad->HitTest( arect, false, 0 ) )
934  return true;
935  }
936 
937  for( FP_ZONE* zone : m_fp_zones )
938  {
939  if( zone->HitTest( arect, false, 0 ) )
940  return true;
941  }
942 
943  for( BOARD_ITEM* item : m_drawings )
944  {
945  if( item->Type() != PCB_FP_TEXT_T && item->HitTest( arect, false, 0 ) )
946  return true;
947  }
948 
949  // Groups are not hit-tested; only their members
950 
951  // No items were hit
952  return false;
953  }
954 }
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
FP_ZONES m_fp_zones
Definition: footprint.h:684
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:631
Handle the component boundary box.
Definition: eda_rect.h:42
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
DRAWINGS m_drawings
Definition: footprint.h:682
Definition: pad.h:60
A specialization of ZONE for use in footprints.
Definition: zone.h:943
PADS m_pads
Definition: footprint.h:683
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363

References EDA_RECT::Contains(), GetBoundingBox(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), m_drawings, m_fp_zones, m_pads, pad, and PCB_FP_TEXT_T.

◆ HitTestAccurate()

bool FOOTPRINT::HitTestAccurate ( const wxPoint &  aPosition,
int  aAccuracy = 0 
) const

Test if a point is inside the bounding polygon of the footprint.

The other hit test methods are just checking the bounding box, which can be quite inaccurate for rotated or oddly-shaped footprints.

Parameters
aPositionis the point to test
Returns
true if aPosition is inside the bounding polygon

Definition at line 911 of file footprint.cpp.

912 {
913  return GetBoundingHull().Collide( aPosition, aAccuracy );
914 }
SHAPE_POLY_SET GetBoundingHull() const
Return a bounding polygon for the shapes and pads in the footprint.
Definition: footprint.cpp:739
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...

References SHAPE_POLY_SET::Collide(), and GetBoundingHull().

Referenced by GENERAL_COLLECTOR::Inspect().

◆ IncrementFlag()

void FOOTPRINT::IncrementFlag ( )
inline

Definition at line 235 of file footprint.h.

235 { m_arflag += 1; }
int m_arflag
Definition: footprint.h:726

◆ IncrementReference()

void FOOTPRINT::IncrementReference ( int  aDelta)

Bump the current reference by aDelta.

Definition at line 1718 of file footprint.cpp.

1719 {
1720  const wxString& refdes = GetReference();
1721 
1722  SetReference( wxString::Format( wxT( "%s%i" ),
1723  UTIL::GetReferencePrefix( refdes ),
1724  GetTrailingInt( refdes ) + aDelta ) );
1725 }
void SetReference(const wxString &aReference)
Definition: footprint.h:435
const wxString & GetReference() const
Definition: footprint.h:426
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
wxString GetReferencePrefix(const wxString &aRefDes)
Get the (non-numeric) prefix from a refdes - e.g.
int GetTrailingInt(const wxString &aStr)
Gets the trailing int, if any, from a string.
Definition: string.cpp:736

References Format(), GetReference(), UTIL::GetReferencePrefix(), GetTrailingInt(), and SetReference().

◆ IsBrightened()

◆ IsConnected()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 171 of file eda_item.h.

171 { return m_flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:109
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_DRAGGED, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 174 of file eda_item.h.

174 { return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered
Definition: eda_item.h:138
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsFlipped()

bool FOOTPRINT::IsFlipped ( ) const
inline
Returns
true if the footprint is flipped, i.e. on the back side of the board

Definition at line 266 of file footprint.h.

266 { return GetLayer() == B_Cu; }
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173

References B_Cu.

Referenced by PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), GetMsgPanelInfo(), DIALOG_PAD_PROPERTIES::initValues(), insideFootprintCourtyard(), ALTIUM_PCB::ParseComponentsBodies6Data(), BOARD_EDITOR_CONTROL::PlaceFootprint(), RENDER_3D_LEGACY::renderFootprint(), and DIALOG_TEXT_PROPERTIES::TransferDataToWindow().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 256 of file eda_item.h.

256 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:530

References EDA_ITEM::m_forceVisible.

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

◆ IsLibNameValid()

bool FOOTPRINT::IsLibNameValid ( const wxString &  aName)
static

Test for validity of a name of a footprint to be used in a footprint library ( no spaces, dir separators ...

).

Parameters
aNameis the name in library to validate.
Returns
true if the given name is valid

Definition at line 1309 of file footprint.cpp.

1310 {
1311  const wxChar * invalids = StringLibNameInvalidChars( false );
1312 
1313  if( aName.find_first_of( invalids ) != std::string::npos )
1314  return false;
1315 
1316  return true;
1317 }
static const wxChar * StringLibNameInvalidChars(bool aUserReadable)
Test for validity of the name in a library of the footprint ( no spaces, dir separators ....
Definition: footprint.cpp:1320

References StringLibNameInvalidChars().

Referenced by DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::checkFootprintName().

◆ IsLocked()

bool FOOTPRINT::IsLocked ( ) const
inlineoverridevirtual
Returns
true if the object is locked, else false.

Reimplemented from BOARD_ITEM.

Definition at line 282 of file footprint.h.

283  {
284  return ( m_fpStatus & FP_is_LOCKED ) != 0;
285  }
int m_fpStatus
Definition: footprint.h:693
#define FP_is_LOCKED
footprint LOCKED: no autoplace allowed
Definition: footprint.h:276

References FP_is_LOCKED.

Referenced by PCB_EDIT_FRAME::ExchangeFootprint(), PCB_IO::format(), GetMsgPanelInfo(), itemIsIncludedByFilter(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 168 of file eda_item.h.

168 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
Definition: eda_item.h:103
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNetTie()

bool FOOTPRINT::IsNetTie ( ) const
inline

Definition at line 239 of file footprint.h.

240  {
241  return GetKeywords().StartsWith( wxT( "net tie" ) );
242  }
const wxString & GetKeywords() const
Definition: footprint.h:196

Referenced by DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem().

◆ IsNew()

◆ IsOnCopperLayer()

virtual bool BOARD_ITEM::IsOnCopperLayer ( ) const
inlinevirtualinherited
Returns
true if the object is on any copper layer, false otherwise.

Reimplemented in TRACK, PAD, and ZONE.

Definition at line 144 of file board_item.h.

145  {
146  return IsCopperLayer( GetLayer() );
147  }
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173

References BOARD_ITEM::GetLayer(), and IsCopperLayer().

Referenced by CN_CONNECTIVITY_ALGO::Add(), DRC_ENGINE::EvalRules(), and BOARD_CONNECTED_ITEM::SetNetCode().

◆ IsOnLayer()

bool FOOTPRINT::IsOnLayer ( PCB_LAYER_ID  aLayer) const
overridevirtual

A special IsOnLayer for footprints: return true if the footprint contains only items on the given layer, even if that layer is not one of the valid footprint layers F_Cu and B_Cu.

This allows selection of "graphic" footprints that contain only silkscreen, for example.

Reimplemented from BOARD_ITEM.

Definition at line 881 of file footprint.cpp.

882 {
883  // If we have any pads, fall back on normal checking
884  if( !m_pads.empty() )
885  return m_layer == aLayer;
886 
887  // No pads? Check if this entire footprint exists on the given layer
888  for( FP_ZONE* zone : m_fp_zones )
889  {
890  if( !zone->IsOnLayer( aLayer ) )
891  return false;
892  }
893 
894  for( BOARD_ITEM* item : m_drawings )
895  {
896  if( !item->IsOnLayer( aLayer ) )
897  return false;
898  }
899 
900  return true;
901 }
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
FP_ZONES m_fp_zones
Definition: footprint.h:684
PCB_LAYER_ID m_layer
Definition: board_item.h:363
DRAWINGS m_drawings
Definition: footprint.h:682
A specialization of ZONE for use in footprints.
Definition: zone.h:943
PADS m_pads
Definition: footprint.h:683

References m_drawings, m_fp_zones, BOARD_ITEM::m_layer, and m_pads.

◆ IsPlaced()

bool FOOTPRINT::IsPlaced ( ) const
inline

Definition at line 300 of file footprint.h.

300 { return m_fpStatus & FP_is_PLACED; }
int m_fpStatus
Definition: footprint.h:693
#define FP_is_PLACED
In autoplace: footprint automatically placed.
Definition: footprint.h:277

References FP_is_PLACED.

Referenced by PCB_IO::format().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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

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

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

Definition at line 453 of file eda_item.h.

453 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 175 of file eda_item.h.

175 { return m_flags & IS_RESIZED; }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:108
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_RESIZED, and EDA_ITEM::m_flags.

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 173 of file eda_item.h.

173 { return m_flags & SELECTED; }
#define SELECTED
Definition: eda_item.h:114
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_LEGACY::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), and GERBVIEW_SELECTION_TOOL::unselect().

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

Test to see if this object is a track or via (or microvia).

Returns
true if a track or via, else false.

Definition at line 241 of file board_item.h.

242  {
243  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
244  }
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

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

◆ IsType()

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

Check whether the item is one of the listed types.

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

Reimplemented in VIA, SCH_LABEL, DIMENSION_BASE, PAD, PCB_SHAPE, SCH_FIELD, FP_TEXT, SCH_LINE, FP_SHAPE, and PCB_TEXT.

Definition at line 233 of file eda_item.h.

234  {
235  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
236  return true;
237 
238  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
239  {
240  if( m_structType == *p )
241  return true;
242  }
243 
244  return false;
245  }
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:538

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by ROUTER_TOOL::CanInlineDrag(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), PCB_TEXT::IsType(), FP_SHAPE::IsType(), SCH_LINE::IsType(), FP_TEXT::IsType(), SCH_FIELD::IsType(), PCB_SHAPE::IsType(), PAD::IsType(), DIMENSION_BASE::IsType(), SCH_LABEL::IsType(), VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), SCH_BASE_FRAME::UpdateItem(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 172 of file eda_item.h.

172 { return m_flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:111
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

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

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

Definition at line 345 of file eda_item.h.

349  {
350  for( auto it : aList )
351  {
352  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
354  return SEARCH_RESULT::QUIT;
355  }
356 
358  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

Change first parameter to avoid the DList and use std::vector instead.

Definition at line 364 of file eda_item.h.

366  {
367  for( auto it : aList )
368  {
369  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
371  return SEARCH_RESULT::QUIT;
372  }
373 
375  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

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

◆ layerMaskDescribe()

wxString BOARD_ITEM::layerMaskDescribe ( ) const
protectedvirtualinherited

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

The BOARD is needed because layer names are customizable.

Reimplemented in VIA.

Definition at line 72 of file board_item.cpp.

73 {
74  BOARD* board = GetBoard();
75  LSET layers = GetLayerSet();
76 
77  // Try to be smart and useful. Check all copper first.
78  if( layers[F_Cu] && layers[B_Cu] )
79  return _( "all copper layers" );
80 
81  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
82  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
83 
84  for( LSET testLayers : { copperLayers, techLayers, layers } )
85  {
86  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
87  {
88  if( testLayers[ bit ] )
89  {
90  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
91 
92  if( testLayers.count() > 1 )
93  layerInfo << wxS( " " ) + _( "and others" );
94 
95  return layerInfo;
96  }
97  }
98  }
99 
100  // No copper, no technicals: no layer
101  return _( "no layers" );
102 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:342
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings Returns a bit-mask of all t...
Definition: board.cpp:447
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:820
LSET is a set of PCB_LAYER_IDs.
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
#define _(s)
Definition: 3d_actions.cpp:33
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:178

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

Referenced by TRACK::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), and PAD::GetSelectMenuText().

◆ LegacyPadsLocked()

bool FOOTPRINT::LegacyPadsLocked ( ) const
inline

Definition at line 318 of file footprint.h.

318 { return m_fpStatus & FP_PADS_are_LOCKED; }
#define FP_PADS_are_LOCKED
Definition: footprint.h:279
int m_fpStatus
Definition: footprint.h:693

References FP_PADS_are_LOCKED.

◆ Matches() [1/2]

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

Compare the item against the search criteria in aSearchData.

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

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

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, ZONE, SCH_PIN, SCH_MARKER, PCB_MARKER, FP_TEXT, and PCB_TEXT.

Definition at line 415 of file eda_item.h.

416  {
417  return false;
418  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), PCB_TEXT::Matches(), FP_TEXT::Matches(), PCB_MARKER::Matches(), SCH_MARKER::Matches(), SCH_PIN::Matches(), ZONE::Matches(), SCH_SHEET_PIN::Matches(), SCH_FIELD::Matches(), SCH_TEXT::Matches(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

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

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 116 of file eda_item.cpp.

117 {
118  wxString text = aText;
119  wxString searchText = aSearchData.GetFindString();
120 
121  // Don't match if searching for replaceable item and the item doesn't support text replace.
122  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
123  return false;
124 
125  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
126  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
127 
128  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
129  {
130  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
131  return text.Matches( searchText );
132 
133  return text.MakeUpper().Matches( searchText.MakeUpper() );
134  }
135 
136  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
137  return aText.Find( searchText ) != wxNOT_FOUND;
138 
139  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
140 }
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:453

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

◆ Models() [1/2]

◆ Models() [2/2]

const std::list<FP_3DMODEL>& FOOTPRINT::Models ( ) const
inline

Definition at line 179 of file footprint.h.

179 { return m_3D_Drawings; }
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:731

◆ Move() [1/2]

void FOOTPRINT::Move ( const wxPoint &  aMoveVector)
overridevirtual

Move this object.

Parameters
aMoveVectorthe move vector for this object.

Reimplemented from BOARD_ITEM.

Definition at line 1335 of file footprint.cpp.

1336 {
1337  wxPoint newpos = m_pos + aMoveVector;
1338  SetPosition( newpos );
1339 }
wxPoint m_pos
Definition: footprint.h:688
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1438

References m_pos, and SetPosition().

Referenced by moveFootprintsInArea().

◆ Move() [2/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 283 of file board_item.h.

284  {
285  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
286  }
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277

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

◆ MoveAnchorPosition()

void FOOTPRINT::MoveAnchorPosition ( const wxPoint &  aMoveVector)

Move the reference point of the footprint.

It looks like a move footprint: the footprints elements (pads, outlines, edges .. ) are moved However:

  • the footprint position is not modified.
  • the relative (local) coordinates of these items are modified (a move footprint does not change these local coordinates, but changes the footprint position)

Definition at line 1484 of file footprint.cpp.

1485 {
1486  /* Move the reference point of the footprint
1487  * the footprints elements (pads, outlines, edges .. ) are moved
1488  * but:
1489  * - the footprint position is not modified.
1490  * - the relative (local) coordinates of these items are modified
1491  * - Draw coordinates are updated
1492  */
1493 
1494 
1495  // Update (move) the relative coordinates relative to the new anchor point.
1496  wxPoint moveVector = aMoveVector;
1497  RotatePoint( &moveVector, -GetOrientation() );
1498 
1499  // Update of the reference and value.
1500  m_reference->SetPos0( m_reference->GetPos0() + moveVector );
1502  m_value->SetPos0( m_value->GetPos0() + moveVector );
1503  m_value->SetDrawCoord();
1504 
1505  // Update the pad local coordinates.
1506  for( PAD* pad : m_pads )
1507  {
1508  pad->SetPos0( pad->GetPos0() + moveVector );
1509  pad->SetDrawCoord();
1510  }
1511 
1512  // Update the draw element coordinates.
1513  for( BOARD_ITEM* item : GraphicalItems() )
1514  {
1515  switch( item->Type() )
1516  {
1517  case PCB_FP_SHAPE_T:
1518  {
1519  FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
1520  shape->Move( moveVector );
1521  }
1522  break;
1523 
1524  case PCB_FP_TEXT_T:
1525  {
1526  FP_TEXT* text = static_cast<FP_TEXT*>( item );
1527  text->SetPos0( text->GetPos0() + moveVector );
1528  text->SetDrawCoord();
1529  }
1530  break;
1531 
1532  default:
1533  break;
1534  }
1535  }
1536 
1537  // Update the keepout zones
1538  for( ZONE* zone : Zones() )
1539  {
1540  zone->Move( moveVector );
1541  }
1542 
1543  // Update the 3D models
1544  for( FP_3DMODEL& model : Models() )
1545  {
1546  model.m_Offset.x += Iu2Millimeter( moveVector.x );
1547  model.m_Offset.y -= Iu2Millimeter( moveVector.y );
1548  }
1549 
1550  m_cachedBoundingBox.Move( moveVector );
1551  m_cachedVisibleBBox.Move( moveVector );
1552  m_cachedTextExcludedBBox.Move( moveVector );
1553  m_cachedHull.Move( moveVector );
1554 }
EDA_RECT m_cachedVisibleBBox
Definition: footprint.h:707
void Move(const wxPoint &aMoveVector)
Move the rectangle by the aMoveVector.
Definition: eda_rect.cpp:51
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
std::list< FP_3DMODEL > & Models()
Definition: footprint.h:178
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
double GetOrientation() const
Definition: footprint.h:186
void SetDrawCoord()
Set relative coordinates.
Definition: fp_text.cpp:187
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
FP_TEXT * m_reference
Definition: footprint.h:689
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
FP_TEXT * m_value
Definition: footprint.h:690
EDA_RECT m_cachedBoundingBox
Definition: footprint.h:705
FP_ZONES & Zones()
Definition: footprint.h:170
void Move(const VECTOR2I &aVector) override
SHAPE_POLY_SET m_cachedHull
Definition: footprint.h:711
DRAWINGS & GraphicalItems()
Definition: footprint.h:167
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
void SetPos0(const wxPoint &aPos)
Definition: fp_text.h:165
const wxPoint & GetPos0() const
Definition: fp_text.h:166
EDA_RECT m_cachedTextExcludedBBox
Definition: footprint.h:709
void Move(const wxPoint &aMoveVector) override
Move an edge of the footprint.
Definition: fp_shape.cpp:289
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:683

References GetOrientation(), FP_TEXT::GetPos0(), GraphicalItems(), m_cachedBoundingBox, m_cachedHull, m_cachedTextExcludedBBox, m_cachedVisibleBBox, m_pads, m_reference, m_value, Models(), EDA_RECT::Move(), FP_SHAPE::Move(), SHAPE_POLY_SET::Move(), pad, PCB_FP_SHAPE_T, PCB_FP_TEXT_T, RotatePoint(), FP_TEXT::SetDrawCoord(), FP_TEXT::SetPos0(), text, and Zones().

Referenced by CLIPBOARD_IO::SaveSelection(), and DRAWING_TOOL::SetAnchor().

◆ NeedsPlaced()

bool FOOTPRINT::NeedsPlaced ( ) const
inline

Definition at line 309 of file footprint.h.

309 { return m_fpStatus & FP_to_PLACE; }
int m_fpStatus
Definition: footprint.h:693
#define FP_to_PLACE
In autoplace: footprint waiting for autoplace.
Definition: footprint.h:278

References FP_to_PLACE.

Referenced by AR_AUTOPLACER::pickFootprint().

◆ operator<()

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

Test if another item is less than this object.

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

Definition at line 169 of file eda_item.cpp.

170 {
171  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
172  GetClass() ) );
173 
174  return false;
175 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
virtual wxString GetClass() const =0
Return the class name.

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

◆ operator=() [1/2]

FOOTPRINT & FOOTPRINT::operator= ( const FOOTPRINT aOther)

Definition at line 320 of file footprint.cpp.

321 {
322  BOARD_ITEM::operator=( aOther );
323 
324  m_pos = aOther.m_pos;
325  m_fpid = aOther.m_fpid;
326  m_attributes = aOther.m_attributes;
327  m_fpStatus = aOther.m_fpStatus;
328  m_orient = aOther.m_orient;
329  m_rot90Cost = aOther.m_rot90Cost;
330  m_rot180Cost = aOther.m_rot180Cost;
332  m_link = aOther.m_link;
333  m_path = aOther.m_path;
334 
341  m_cachedHull = aOther.m_cachedHull;
343 
350  m_thermalGap = aOther.m_thermalGap;
351 
352  // Copy reference and value
353  *m_reference = *aOther.m_reference;
354  m_reference->SetParent( this );
355  *m_value = *aOther.m_value;
356  m_value->SetParent( this );
357 
358  std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
359 
360  // Copy pads
361  m_pads.clear();
362 
363  for( PAD* pad : aOther.Pads() )
364  {
365  PAD* newPad = new PAD( *pad );
366  ptrMap[ pad ] = newPad;
367  Add( newPad );
368  }
369 
370  // Copy zones
371  m_fp_zones.clear();
372 
373  for( FP_ZONE* zone : aOther.Zones() )
374  {
375  FP_ZONE* newZone = static_cast<FP_ZONE*>( zone->Clone() );
376  ptrMap[ zone ] = newZone;
377  Add( newZone );
378 
379  // Ensure the net info is OK and especially uses the net info list
380  // living in the current board
381  // Needed when copying a fp from fp editor that has its own board
382  // Must be NETINFO_LIST::ORPHANED_ITEM for a keepout that has no net.
383  newZone->SetNetCode( -1 );
384  }
385 
386  // Copy drawings
387  m_drawings.clear();
388 
389  for( BOARD_ITEM* item : aOther.GraphicalItems() )
390  {
391  BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() );
392  ptrMap[ item ] = newItem;
393  Add( newItem );
394  }
395 
396  // Copy groups
397  m_fp_groups.clear();
398 
399  for( PCB_GROUP* group : aOther.Groups() )
400  {
401  PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() );
402  newGroup->GetItems().clear();
403 
404  for( BOARD_ITEM* member : group->GetItems() )
405  newGroup->AddItem( ptrMap[ member ] );
406 
407  Add( newGroup );
408  }
409 
410  // Copy auxiliary data: 3D_Drawings info
411  m_3D_Drawings.clear();
412  m_3D_Drawings = aOther.m_3D_Drawings;
413  m_doc = aOther.m_doc;
414  m_keywords = aOther.m_keywords;
415  m_properties = aOther.m_properties;
416 
418  new wxArrayString( *aOther.m_initial_comments ) : nullptr;
419 
420  return *this;
421 }
int m_localSolderPasteMargin
Definition: footprint.h:719
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:38
EDA_RECT m_cachedVisibleBBox
Definition: footprint.h:707
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:714
double m_localSolderPasteMarginRatio
Definition: footprint.h:720
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
double m_orient
Definition: footprint.h:687
timestamp_t m_lastEditTime
Definition: footprint.h:725
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
FP_TEXT * m_reference
Definition: footprint.h:689
int m_visibleBBoxCacheTimeStamp
Definition: footprint.h:708
std::unordered_set< BOARD_ITEM * > & GetItems()
Definition: pcb_group.h:68
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:166
int m_rot90Cost
Definition: footprint.h:728
PADS & Pads()
Definition: footprint.h:164
FP_TEXT * m_value
Definition: footprint.h:690
KIID m_link
Definition: footprint.h:727
int m_localSolderMaskMargin
Definition: footprint.h:718
EDA_RECT m_cachedBoundingBox
Definition: footprint.h:705
FP_ZONES & Zones()
Definition: footprint.h:170
int m_fpStatus
Definition: footprint.h:693
FP_ZONES m_fp_zones
Definition: footprint.h:684
SHAPE_POLY_SET m_cachedHull
Definition: footprint.h:711
int m_thermalGap
Definition: footprint.h:716
DRAWINGS & GraphicalItems()
Definition: footprint.h:167
wxPoint m_pos
Definition: footprint.h:688
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
Definition: eda_item.cpp:177
int m_boundingBoxCacheTimeStamp
Definition: footprint.h:706
KIID_PATH m_path
Definition: footprint.h:724
FP_GROUPS & Groups()
Definition: footprint.h:173
int m_thermalWidth
Definition: footprint.h:715
wxString m_keywords
Definition: footprint.h:723
int m_localClearance
Definition: footprint.h:717
int m_rot180Cost
Definition: footprint.h:729
int m_textExcludedBBoxCacheTimeStamp
Definition: footprint.h:710
LIB_ID m_fpid
Definition: footprint.h:691
EDA_RECT m_cachedTextExcludedBBox
Definition: footprint.h:709
DRAWINGS m_drawings
Definition: footprint.h:682
std::map< wxString, wxString > m_properties
Definition: footprint.h:732
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the container.
Definition: footprint.cpp:468
wxArrayString * m_initial_comments
Definition: footprint.h:733
Definition: pad.h:60
FP_GROUPS m_fp_groups
Definition: footprint.h:685
wxString m_doc
Definition: footprint.h:722
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:731
A specialization of ZONE for use in footprints.
Definition: zone.h:943
PADS m_pads
Definition: footprint.h:683
int m_hullCacheTimeStamp
Definition: footprint.h:712
int m_attributes
Definition: footprint.h:692

References Add(), PCB_GROUP::AddItem(), PCB_GROUP::GetItems(), GraphicalItems(), group, Groups(), m_3D_Drawings, m_attributes, m_boundingBoxCacheTimeStamp, m_cachedBoundingBox, m_cachedHull, m_cachedTextExcludedBBox, m_cachedVisibleBBox, m_doc, m_drawings, m_fp_groups, m_fp_zones, m_fpid, m_fpStatus, m_hullCacheTimeStamp, m_initial_comments, m_keywords, m_lastEditTime, m_link, m_localClearance, m_localSolderMaskMargin, m_localSolderPasteMargin, m_localSolderPasteMarginRatio, m_orient, m_pads, m_path, m_pos, m_properties, m_reference, m_rot180Cost, m_rot90Cost, m_textExcludedBBoxCacheTimeStamp, m_thermalGap, m_thermalWidth, m_value, m_visibleBBoxCacheTimeStamp, m_zoneConnection, EDA_ITEM::operator=(), PAD, pad, Pads(), BOARD_CONNECTED_ITEM::SetNetCode(), EDA_ITEM::SetParent(), and Zones().

◆ operator=() [2/2]

FOOTPRINT & FOOTPRINT::operator= ( FOOTPRINT &&  aOther)

Definition at line 220 of file footprint.cpp.

221 {
222  BOARD_ITEM::operator=( aOther );
223 
224  m_pos = aOther.m_pos;
225  m_fpid = aOther.m_fpid;
226  m_attributes = aOther.m_attributes;
227  m_fpStatus = aOther.m_fpStatus;
228  m_orient = aOther.m_orient;
229  m_rot90Cost = aOther.m_rot90Cost;
230  m_rot180Cost = aOther.m_rot180Cost;
232  m_link = aOther.m_link;
233  m_path = aOther.m_path;
234 
241  m_cachedHull = aOther.m_cachedHull;
243 
250  m_thermalGap = aOther.m_thermalGap;
251 
252  // Move reference and value
253  m_reference = aOther.m_reference;
254  m_reference->SetParent( this );
255  m_value = aOther.m_value;
256  m_value->SetParent( this );
257 
258 
259  // Move the pads
260  m_pads.clear();
261 
262  for( PAD* pad : aOther.Pads() )
263  Add( pad );
264 
265  aOther.Pads().clear();
266 
267  // Move the zones
268  m_fp_zones.clear();
269 
270  for( FP_ZONE* item : aOther.Zones() )
271  {
272  Add( item );
273 
274  // Ensure the net info is OK and especially uses the net info list
275  // living in the current board
276  // Needed when copying a fp from fp editor that has its own board
277  // Must be NETINFO_LIST::ORPHANED_ITEM for a keepout that has no net.
278  item->SetNetCode( -1 );
279  }
280 
281  aOther.Zones().clear();
282 
283  // Move the drawings
284  m_drawings.clear();
285 
286  for( BOARD_ITEM* item : aOther.GraphicalItems() )
287  Add( item );
288 
289  aOther.GraphicalItems().clear();
290 
291  // Move the groups
292  m_fp_groups.clear();
293 
294  for( PCB_GROUP* group : aOther.Groups() )
295  Add( group );
296 
297  aOther.Groups().clear();
298 
299  // Copy auxiliary data: 3D_Drawings info
300  m_3D_Drawings.clear();
301  m_3D_Drawings = aOther.m_3D_Drawings;
302  m_doc = aOther.m_doc;
303  m_keywords = aOther.m_keywords;
304  m_properties = aOther.m_properties;
305 
307 
308  // Clear the other item's containers since this is a move
309  aOther.Pads().clear();
310  aOther.Zones().clear();
311  aOther.GraphicalItems().clear();
312  aOther.m_value = nullptr;
313  aOther.m_reference = nullptr;
314  aOther.m_initial_comments = nullptr;
315 
316  return *this;
317 }
int m_localSolderPasteMargin
Definition: footprint.h:719
EDA_RECT m_cachedVisibleBBox
Definition: footprint.h:707
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:714
double m_localSolderPasteMarginRatio
Definition: footprint.h:720
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
double m_orient
Definition: footprint.h:687
timestamp_t m_lastEditTime
Definition: footprint.h:725
FP_TEXT * m_reference
Definition: footprint.h:689
int m_visibleBBoxCacheTimeStamp
Definition: footprint.h:708
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:166
int m_rot90Cost
Definition: footprint.h:728
PADS & Pads()
Definition: footprint.h:164
FP_TEXT * m_value
Definition: footprint.h:690
KIID m_link
Definition: footprint.h:727
int m_localSolderMaskMargin
Definition: footprint.h:718
EDA_RECT m_cachedBoundingBox
Definition: footprint.h:705
FP_ZONES & Zones()
Definition: footprint.h:170
int m_fpStatus
Definition: footprint.h:693
FP_ZONES m_fp_zones
Definition: footprint.h:684
SHAPE_POLY_SET m_cachedHull
Definition: footprint.h:711
int m_thermalGap
Definition: footprint.h:716
DRAWINGS & GraphicalItems()
Definition: footprint.h:167
wxPoint m_pos
Definition: footprint.h:688
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
Definition: eda_item.cpp:177
int m_boundingBoxCacheTimeStamp
Definition: footprint.h:706
KIID_PATH m_path
Definition: footprint.h:724
FP_GROUPS & Groups()
Definition: footprint.h:173
int m_thermalWidth
Definition: footprint.h:715
wxString m_keywords
Definition: footprint.h:723
int m_localClearance
Definition: footprint.h:717
int m_rot180Cost
Definition: footprint.h:729
int m_textExcludedBBoxCacheTimeStamp
Definition: footprint.h:710
LIB_ID m_fpid
Definition: footprint.h:691
EDA_RECT m_cachedTextExcludedBBox
Definition: footprint.h:709
DRAWINGS m_drawings
Definition: footprint.h:682
std::map< wxString, wxString > m_properties
Definition: footprint.h:732
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the