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
 

More...
 
void Remove (BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
 

More...
 
void ClearAllNets ()
 Function ClearAllNets Clear (i.e. More...
 
void CalculateBoundingBox ()
 Function CalculateBoundingBox calculates the bounding box in board coordinates. More...
 
EDA_RECT GetFootprintRect () const
 Function GetFootprintRect() Build and returns the boundary box of the footprint excluding any text. More...
 
EDA_RECT GetBoundingBoxBase () const
 Returns the last calculated bounding box of the footprint (does not recalculate it). More...
 
EDA_RECT GetFpPadsLocalBbox () const
 Returns the bounding box containing pads when the footprint is on the front side, orientation 0, position 0,0. More...
 
SHAPE_POLY_SET GetBoundingHull () const
 Returns a bounding polygon for the shapes and pads in the footprint This operation is slower but more accurate than calculating a bounding box. More...
 
const EDA_RECT GetBoundingBox () const override
 Return the orthogonal bounding box of this object for display purposes. More...
 
const EDA_RECT GetBoundingBox (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)
 Function MoveAnchorPosition Move the reference point of the footprint It looks like a move footprint: the footprints elements (pads, outlines, edges . More...
 
bool IsFlipped () const
 function IsFlipped More...
 
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
 Function SetLocked sets 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
 function TransformPadsShapesWithClearanceToPolygon generate pads shapes on layer aLayer as polygons and adds these polygons to aCornerBuffer Useful to generate a polygonal representation of a footprint in 3D view and plot functions, when a full polygonal approach is needed 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
 function TransformFPShapesWithClearanceToPolygon generate shapes of graphic items (outlines) on layer aLayer as polygons and adds these polygons to aCornerBuffer Useful to generate a polygonal representation of a footprint in 3D view and plot functions, when a full polygonal approach is needed More...
 
void TransformFPTextWithClearanceToPolygonSet (SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc) const
 TransformFPTextWithClearanceToPolygonSet 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
 

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
 Tests 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
 Function GetReference. More...
 
void SetReference (const wxString &aReference)
 Function SetReference. More...
 
void IncrementReference (int aDelta)
 Function IncrementReference Bumps the current reference by aDelta. More...
 
const wxString GetValue () const
 Function GetValue. More...
 
void SetValue (const wxString &aValue)
 Function SetValue. More...
 
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)
 
PADFindPadByName (const wxString &aPadName) const
 Function FindPadByName returns a PAD* with a matching name. More...
 
PADGetPad (const wxPoint &aPosition, LSET aLayerMask=LSET::AllLayersMask())
 Function GetPad get a pad at aPosition on aLayerMask in the footprint. More...
 
PADGetTopLeftPad ()
 
PADGetFirstPad () const
 Gets the first pad in the list or NULL if none. More...
 
unsigned GetPadCount (INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
 GetPadCount returns the number of pads. More...
 
unsigned GetUniquePadCount (INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
 GetUniquePadCount returns the number of unique pads. More...
 
wxString GetNextPadName (const wxString &aLastPadName) const
 Function GetNextPadName returns 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 a of this BOARD_ITEM. More...
 
BOARD_ITEMDuplicateItem (const BOARD_ITEM *aItem, bool aAddToFootprint=false)
 Function DuplicateItem Duplicate a given item within the footprint, optionally adding it to the board. More...
 
void Add3DModel (FP_3DMODEL *a3DModel)
 Function Add3DModel adds 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...
 
BITMAP_DEF 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
 Function RunOnChildren. More...
 
void GetAllDrawingLayers (int aLayers[], int &aCount, bool aIncludePads=true) const
 Returns 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)
 Function SetInitialComments takes ownership of caller's heap allocated aInitialComments block. More...
 
double CoverageRatio (const GENERAL_COLLECTOR &aCollector) const
 Function CoverageRatio Calculates the ratio of total area of the footprint pads and graphical items to the area of the footprint. More...
 
const wxArrayString * GetInitialComments () const
 Return the initial comments block or NULL if none, without transfer of ownership. More...
 
SHAPE_POLY_SETGetPolyCourtyardFront ()
 Used in DRC to test the courtyard area (a complex polygon) More...
 
SHAPE_POLY_SETGetPolyCourtyardBack ()
 
void BuildPolyCourtyards (OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
 Builds 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, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag) 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)
 
static bool IsLibNameValid (const wxString &aName)
 static function IsLibNameValid 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)
 static function StringLibNameInvalidChars 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)
 
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_boundingBox
 
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 108 of file footprint.h.

Constructor & Destructor Documentation

◆ FOOTPRINT() [1/3]

FOOTPRINT::FOOTPRINT ( BOARD parent)

Definition at line 46 of file footprint.cpp.

46  :
49 {
50  m_attributes = 0;
51  m_layer = F_Cu;
52  m_orient = 0;
54  m_arflag = 0;
56  m_link = 0;
57  m_lastEditTime = 0;
58  m_localClearance = 0;
62  m_zoneConnection = ZONE_CONNECTION::INHERITED; // Use zone setting by default
63  m_thermalWidth = 0; // Use zone setting by default
64  m_thermalGap = 0; // Use zone setting by default
65 
66  // These are special and mandatory text fields
68  m_value = new FP_TEXT( this, FP_TEXT::TEXT_is_VALUE );
69 
70  m_3D_Drawings.clear();
71 }
int m_localSolderPasteMargin
Definition: footprint.h:725
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:720
double m_localSolderPasteMarginRatio
Definition: footprint.h:726
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:295
double m_orient
Definition: footprint.h:711
timestamp_t m_lastEditTime
Definition: footprint.h:731
FP_TEXT * m_reference
Definition: footprint.h:713
int m_rot90Cost
Definition: footprint.h:734
FP_TEXT * m_value
Definition: footprint.h:714
int m_arflag
Definition: footprint.h:732
KIID m_link
Definition: footprint.h:733
int m_localSolderMaskMargin
Definition: footprint.h:724
int m_fpStatus
Definition: footprint.h:717
int m_thermalGap
Definition: footprint.h:722
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
int m_thermalWidth
Definition: footprint.h:721
int m_localClearance
Definition: footprint.h:723
int m_rot180Cost
Definition: footprint.h:735
PCB_LAYER_ID m_layer
Definition: board_item.h:363
wxArrayString * m_initial_comments
Definition: footprint.h:739
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:737
int m_attributes
Definition: footprint.h:716

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

74  :
75  BOARD_ITEM_CONTAINER( aFootprint )
76 {
77  m_pos = aFootprint.m_pos;
78  m_fpid = aFootprint.m_fpid;
79  m_attributes = aFootprint.m_attributes;
80  m_fpStatus = aFootprint.m_fpStatus;
81  m_orient = aFootprint.m_orient;
82  m_boundingBox = aFootprint.m_boundingBox;
83  m_rot90Cost = aFootprint.m_rot90Cost;
84  m_rot180Cost = aFootprint.m_rot180Cost;
85  m_lastEditTime = aFootprint.m_lastEditTime;
86  m_link = aFootprint.m_link;
87  m_path = aFootprint.m_path;
88 
94  m_thermalWidth = aFootprint.m_thermalWidth;
95  m_thermalGap = aFootprint.m_thermalGap;
96 
97  std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
98 
99  // Copy reference and value.
100  m_reference = new FP_TEXT( *aFootprint.m_reference );
101  m_reference->SetParent( this );
102  ptrMap[ aFootprint.m_reference ] = m_reference;
103 
104  m_value = new FP_TEXT( *aFootprint.m_value );
105  m_value->SetParent( this );
106  ptrMap[ aFootprint.m_value ] = m_value;
107 
108  // Copy pads
109  for( PAD* pad : aFootprint.Pads() )
110  {
111  PAD* newPad = static_cast<PAD*>( pad->Clone() );
112  ptrMap[ pad ] = newPad;
113  Add( newPad );
114  }
115 
116  // Copy zones
117  for( FP_ZONE* zone : aFootprint.Zones() )
118  {
119  FP_ZONE* newZone = static_cast<FP_ZONE*>( zone->Clone() );
120  ptrMap[ zone ] = newZone;
121  Add( newZone );
122 
123  // Ensure the net info is OK and especially uses the net info list
124  // living in the current board
125  // Needed when copying a fp from fp editor that has its own board
126  // Must be NETINFO_LIST::ORPHANED_ITEM for a keepout that has no net.
127  newZone->SetNetCode( -1 );
128  }
129 
130  // Copy drawings
131  for( BOARD_ITEM* item : aFootprint.GraphicalItems() )
132  {
133  BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() );
134  ptrMap[ item ] = newItem;
135  Add( newItem );
136  }
137 
138  // Copy groups
139  for( PCB_GROUP* group : aFootprint.Groups() )
140  {
141  PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() );
142  ptrMap[ group ] = newGroup;
143  Add( newGroup );
144  }
145 
146  // Rebuild groups
147  for( PCB_GROUP* group : aFootprint.Groups() )
148  {
149  PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( ptrMap[ group ] );
150 
151  newGroup->GetItems().clear();
152 
153  for( BOARD_ITEM* member : group->GetItems() )
154  newGroup->AddItem( ptrMap[ member ] );
155  }
156 
157  // Copy auxiliary data: 3D_Drawings info
158  m_3D_Drawings = aFootprint.m_3D_Drawings;
159 
160  m_doc = aFootprint.m_doc;
161  m_keywords = aFootprint.m_keywords;
162  m_properties = aFootprint.m_properties;
163 
164  m_arflag = 0;
165 
167  new wxArrayString( *aFootprint.m_initial_comments ) : nullptr;
168 }
int m_localSolderPasteMargin
Definition: footprint.h:725
bool AddItem(BOARD_ITEM *aItem)
Adds item to group.
Definition: pcb_group.cpp:38
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:720
double m_localSolderPasteMarginRatio
Definition: footprint.h:726
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
Definition: pcb_group.h:50
double m_orient
Definition: footprint.h:711
timestamp_t m_lastEditTime
Definition: footprint.h:731
bool SetNetCode(int aNetCode, bool aNoAssert)
Sets net using a net code.
FP_TEXT * m_reference
Definition: footprint.h:713
std::unordered_set< BOARD_ITEM * > & GetItems()
Definition: pcb_group.h:68
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:164
int m_rot90Cost
Definition: footprint.h:734
PADS & Pads()
Definition: footprint.h:182
FP_TEXT * m_value
Definition: footprint.h:714
int m_arflag
Definition: footprint.h:732
KIID m_link
Definition: footprint.h:733
int m_localSolderMaskMargin
Definition: footprint.h:724
FP_ZONES & Zones()
Definition: footprint.h:188
int m_fpStatus
Definition: footprint.h:717
int m_thermalGap
Definition: footprint.h:722
DRAWINGS & GraphicalItems()
Definition: footprint.h:185
wxPoint m_pos
Definition: footprint.h:712
KIID_PATH m_path
Definition: footprint.h:730
FP_GROUPS & Groups()
Definition: footprint.h:191
int m_thermalWidth
Definition: footprint.h:721
wxString m_keywords
Definition: footprint.h:729
int m_localClearance
Definition: footprint.h:723
int m_rot180Cost
Definition: footprint.h:735
LIB_ID m_fpid
Definition: footprint.h:715
std::map< wxString, wxString > m_properties
Definition: footprint.h:738
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Definition: footprint.cpp:445
wxArrayString * m_initial_comments
Definition: footprint.h:739
Definition: pad.h:60
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
wxString m_doc
Definition: footprint.h:728
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:737
FP_ZONE is a specialization of ZONE for use in footprints.
Definition: zone.h:965
EDA_RECT m_boundingBox
Definition: footprint.h:718
int m_attributes
Definition: footprint.h:716

References Add(), PCB_GROUP::AddItem(), PCB_GROUP::GetItems(), GraphicalItems(), Groups(), m_3D_Drawings, m_arflag, m_attributes, m_boundingBox, m_doc, m_fpid, m_fpStatus, 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_thermalGap, m_thermalWidth, m_value, m_zoneConnection, Pads(), BOARD_CONNECTED_ITEM::SetNetCode(), EDA_ITEM::SetParent(), and Zones().

◆ FOOTPRINT() [3/3]

FOOTPRINT::FOOTPRINT ( FOOTPRINT &&  aFootprint)

Definition at line 171 of file footprint.cpp.

171  :
172  BOARD_ITEM_CONTAINER( aFootprint )
173 {
174  *this = std::move( aFootprint );
175 }
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)

◆ ~FOOTPRINT()

FOOTPRINT::~FOOTPRINT ( )

Definition at line 178 of file footprint.cpp.

179 {
180  // Clean up the owned elements
181  delete m_reference;
182  delete m_value;
183  delete m_initial_comments;
184 
185  for( PAD* p : m_pads )
186  delete p;
187 
188  m_pads.clear();
189 
190  for( FP_ZONE* zone : m_fp_zones )
191  delete zone;
192 
193  m_fp_zones.clear();
194 
195  for( PCB_GROUP* group : m_fp_groups )
196  delete group;
197 
198  m_fp_groups.clear();
199 
200  for( BOARD_ITEM* d : m_drawings )
201  delete d;
202 
203  m_drawings.clear();
204 }
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
Definition: pcb_group.h:50
FP_TEXT * m_reference
Definition: footprint.h:713
FP_TEXT * m_value
Definition: footprint.h:714
FP_ZONES m_fp_zones
Definition: footprint.h:708
DRAWINGS m_drawings
Definition: footprint.h:706
wxArrayString * m_initial_comments
Definition: footprint.h:739
Definition: pad.h:60
FP_GROUPS m_fp_groups
Definition: footprint.h:709
FP_ZONE is a specialization of ZONE for use in footprints.
Definition: zone.h:965
PADS m_pads
Definition: footprint.h:707

References 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

Implements BOARD_ITEM_CONTAINER.

Definition at line 445 of file footprint.cpp.

446 {
447  switch( aBoardItem->Type() )
448  {
449  case PCB_FP_TEXT_T:
450  // Only user text can be added this way.
451  assert( static_cast<FP_TEXT*>( aBoardItem )->GetType() == FP_TEXT::TEXT_is_DIVERS );
453 
454  case PCB_FP_SHAPE_T:
455  if( aMode == ADD_MODE::APPEND )
456  m_drawings.push_back( aBoardItem );
457  else
458  m_drawings.push_front( aBoardItem );
459  break;
460 
461  case PCB_PAD_T:
462  if( aMode == ADD_MODE::APPEND )
463  m_pads.push_back( static_cast<PAD*>( aBoardItem ) );
464  else
465  m_pads.push_front( static_cast<PAD*>( aBoardItem ) );
466  break;
467 
468  case PCB_FP_ZONE_T:
469  if( aMode == ADD_MODE::APPEND )
470  m_fp_zones.push_back( static_cast<FP_ZONE*>( aBoardItem ) );
471  else
472  m_fp_zones.insert( m_fp_zones.begin(), static_cast<FP_ZONE*>( aBoardItem ) );
473  break;
474 
475  case PCB_GROUP_T:
476  if( aMode == ADD_MODE::APPEND )
477  m_fp_groups.push_back( static_cast<PCB_GROUP*>( aBoardItem ) );
478  else
479  m_fp_groups.insert( m_fp_groups.begin(), static_cast<PCB_GROUP*>( aBoardItem ) );
480  break;
481 
482  default:
483  {
484  wxString msg;
485  msg.Printf( wxT( "FOOTPRINT::Add() needs work: BOARD_ITEM type (%d) not handled" ),
486  aBoardItem->Type() );
487  wxFAIL_MSG( msg );
488 
489  return;
490  }
491  }
492 
493  aBoardItem->ClearEditFlags();
494  aBoardItem->SetParent( this );
495 }
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:708
class ZONE, managed by a footprint
Definition: typeinfo.h:94
DRAWINGS m_drawings
Definition: footprint.h:706
FP_GROUPS m_fp_groups
Definition: footprint.h:709
PADS m_pads
Definition: footprint.h:707

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::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_FP_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow().

◆ Add3DModel()

void FOOTPRINT::Add3DModel ( FP_3DMODEL a3DModel)

Function Add3DModel adds 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 985 of file footprint.cpp.

986 {
987  if( nullptr == a3DModel )
988  return;
989 
990  if( !a3DModel->m_Filename.empty() )
991  m_3D_Drawings.push_back( *a3DModel );
992 }
wxString m_Filename
The 3D shape filename in 3D library.
Definition: footprint.h:98
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:737

References m_3D_Drawings, and FP_3DMODEL::m_Filename.

◆ BuildPolyCourtyards()

void FOOTPRINT::BuildPolyCourtyards ( OUTLINE_ERROR_HANDLER aErrorHandler = nullptr)

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

Remarks
sets 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 1794 of file footprint.cpp.

1795 {
1799 
1800  // Build the courtyard area from graphic items on the courtyard.
1801  // Only PCB_FP_SHAPE_T have meaning, graphic texts are ignored.
1802  // Collect items:
1803  std::vector<PCB_SHAPE*> list_front;
1804  std::vector<PCB_SHAPE*> list_back;
1805 
1806  for( BOARD_ITEM* item : GraphicalItems() )
1807  {
1808  if( item->GetLayer() == B_CrtYd && item->Type() == PCB_FP_SHAPE_T )
1809  list_back.push_back( static_cast<PCB_SHAPE*>( item ) );
1810 
1811  if( item->GetLayer() == F_CrtYd && item->Type() == PCB_FP_SHAPE_T )
1812  list_front.push_back( static_cast<PCB_SHAPE*>( item ) );
1813  }
1814 
1815  if( !list_front.size() && !list_back.size() )
1816  return;
1817 
1818  int errorMax = Millimeter2iu( 0.02 ); // max error for polygonization
1819  int chainingEpsilon = Millimeter2iu( 0.02 ); // max dist from one endPt to next startPt
1820 
1821  if( ConvertOutlineToPolygon( list_front, m_poly_courtyard_front, errorMax, chainingEpsilon,
1822  aErrorHandler ) )
1823  {
1825  }
1826  else
1827  {
1829  }
1830 
1831  if( ConvertOutlineToPolygon( list_back, m_poly_courtyard_back, errorMax, chainingEpsilon,
1832  aErrorHandler ) )
1833  {
1835  }
1836  else
1837  {
1839  }
1840 }
SHAPE_POLY_SET m_poly_courtyard_back
Definition: footprint.h:743
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 SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:201
#define MALFORMED_B_COURTYARD
Definition: eda_item.h:123
SHAPE_POLY_SET m_poly_courtyard_front
Definition: footprint.h:742
DRAWINGS & GraphicalItems()
Definition: footprint.h:185
#define MALFORMED_COURTYARDS
Definition: eda_item.h:124
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:122
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:202
void CacheTriangulation(bool aPartition=true)
static constexpr int Millimeter2iu(double mm)

References B_CrtYd, SHAPE_POLY_SET::CacheTriangulation(), EDA_ITEM::ClearFlags(), ConvertOutlineToPolygon(), F_CrtYd, GraphicalItems(), 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(), FABMASTER::loadFootprints(), BOARD_INSPECTION_TOOL::reportClearance(), and DIALOG_FOOTPRINT_CHECKER::runChecks().

◆ CalculateBoundingBox()

◆ ClassOf()

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

Definition at line 123 of file footprint.h.

124  {
125  return aItem && aItem->Type() == PCB_FOOTPRINT_T;
126  }
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161

References PCB_FOOTPRINT_T, and EDA_ITEM::Type().

◆ ClearAllNets()

void FOOTPRINT::ClearAllNets ( )

Function 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 436 of file footprint.cpp.

437 {
438  // Force the ORPHANED dummy net info for all pads.
439  // ORPHANED dummy net does not depend on a board
440  for( PAD* pad : m_pads )
441  pad->SetNetCode( NETINFO_LIST::ORPHANED );
442 }
static const int ORPHANED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:386
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:707

References m_pads, and NETINFO_LIST::ORPHANED.

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 202 of file eda_item.h.

202 { m_flags &= ~aMask; }
STATUS_FLAGS m_flags
Definition: eda_item.h:529

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(), DRAWING_TOOL::PlaceText(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_PIN_TOOL::RepeatPin(), 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 214 of file eda_item.h.

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

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

1099 {
1100  return new FOOTPRINT( *this );
1101 }
FOOTPRINT(BOARD *parent)
Definition: footprint.cpp:46

References FOOTPRINT().

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

◆ CoverageRatio()

double FOOTPRINT::CoverageRatio ( const GENERAL_COLLECTOR aCollector) const

Function CoverageRatio Calculates 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 1694 of file footprint.cpp.

1695 {
1696  int textMargin = KiROUND( 5 * aCollector.GetGuide()->OnePixelInIU() );
1697 
1698  SHAPE_POLY_SET footprintRegion( GetBoundingHull() );
1699  SHAPE_POLY_SET coveredRegion;
1700 
1701  TransformPadsWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
1702  ERROR_OUTSIDE );
1703 
1704  TransformFPShapesWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, textMargin,
1705  ARC_LOW_DEF, ERROR_OUTSIDE,
1706  true, /* include text */
1707  false /* include shapes */ );
1708 
1709  for( int i = 0; i < aCollector.GetCount(); ++i )
1710  {
1711  const BOARD_ITEM* item = aCollector[i];
1712 
1713  switch( item->Type() )
1714  {
1715  case PCB_FP_TEXT_T:
1716  case PCB_FP_SHAPE_T:
1717  if( item->GetParent() != this )
1718  {
1719  item->TransformShapeWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, 0,
1720  ARC_LOW_DEF, ERROR_OUTSIDE );
1721  }
1722  break;
1723 
1724  case PCB_TEXT_T:
1725  case PCB_SHAPE_T:
1726  case PCB_TRACE_T:
1727  case PCB_ARC_T:
1728  case PCB_VIA_T:
1729  item->TransformShapeWithClearanceToPolygon( coveredRegion, UNDEFINED_LAYER, 0,
1730  ARC_LOW_DEF, ERROR_OUTSIDE );
1731  break;
1732 
1733  case PCB_FOOTPRINT_T:
1734  if( item != this )
1735  {
1736  const FOOTPRINT* footprint = static_cast<const FOOTPRINT*>( item );
1737  coveredRegion.AddOutline( footprint->GetBoundingHull().Outline( 0 ) );
1738  }
1739  break;
1740 
1741  default:
1742  break;
1743  }
1744  }
1745 
1746  SHAPE_POLY_SET uncoveredRegion;
1747 
1748  try
1749  {
1750  uncoveredRegion.BooleanSubtract( footprintRegion, coveredRegion,
1752  uncoveredRegion.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1753  uncoveredRegion.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1754  }
1755  catch( ClipperLib::clipperException& )
1756  {
1757  // better to be conservative (this will result in the disambiguate dialog)
1758  return 1.0;
1759  }
1760 
1761  double footprintRegionArea = polygonArea( footprintRegion );
1762  double uncoveredRegionArea = polygonArea( uncoveredRegion );
1763  double coveredArea = footprintRegionArea - uncoveredRegionArea;
1764  double ratio = ( coveredArea / footprintRegionArea );
1765 
1766  return std::min( ratio, 1.0 );
1767 }
SHAPE_POLY_SET GetBoundingHull() const
Returns a bounding polygon for the shapes and pads in the footprint This operation is slower but more...
Definition: footprint.cpp:680
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:338
SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
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
function TransformPadsShapesWithClearanceToPolygon generate pads shapes on layer aLayer as polygons a...
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set 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
function TransformFPShapesWithClearanceToPolygon generate shapes of graphic items (outlines) on layer...
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)
Performs boolean polyset difference 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:161
static double polygonArea(SHAPE_POLY_SET &aPolySet)
Definition: footprint.cpp:1629

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 a of this BOARD_ITEM.

Reimplemented from BOARD_ITEM.

Definition at line 1500 of file footprint.cpp.

1501 {
1502  FOOTPRINT* dupe = (FOOTPRINT*) Clone();
1503  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
1504 
1505  dupe->RunOnChildren( [&]( BOARD_ITEM* child )
1506  {
1507  const_cast<KIID&>( child->m_Uuid ) = KIID();
1508  });
1509 
1510  return static_cast<BOARD_ITEM*>( dupe );
1511 }
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:523
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Function RunOnChildren.
Definition: footprint.cpp:1104
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1098

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

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), GPCB_PLUGIN::FootprintLoad(), LEGACY_PLUGIN::FootprintLoad(), EAGLE_PLUGIN::FootprintLoad(), PCB_IO::FootprintLoad(), CADSTAR_PCB_ARCHIVE_LOADER::loadComponents(), and FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard().

◆ DuplicateItem()

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

Function DuplicateItem 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 1514 of file footprint.cpp.

1515 {
1516  BOARD_ITEM* new_item = NULL;
1517  FP_ZONE* new_zone = NULL;
1518 
1519  switch( aItem->Type() )
1520  {
1521  case PCB_PAD_T:
1522  {
1523  PAD* new_pad = new PAD( *static_cast<const PAD*>( aItem ) );
1524  const_cast<KIID&>( new_pad->m_Uuid ) = KIID();
1525 
1526  if( aAddToFootprint )
1527  m_pads.push_back( new_pad );
1528 
1529  new_item = new_pad;
1530  break;
1531  }
1532 
1533  case PCB_FP_ZONE_T:
1534  {
1535  new_zone = new FP_ZONE( *static_cast<const FP_ZONE*>( aItem ) );
1536  const_cast<KIID&>( new_zone->m_Uuid ) = KIID();
1537 
1538  if( aAddToFootprint )
1539  m_fp_zones.push_back( new_zone );
1540 
1541  new_item = new_zone;
1542  break;
1543  }
1544 
1545  case PCB_FP_TEXT_T:
1546  {
1547  FP_TEXT* new_text = new FP_TEXT( *static_cast<const FP_TEXT*>( aItem ) );
1548  const_cast<KIID&>( new_text->m_Uuid ) = KIID();
1549 
1550  if( new_text->GetType() == FP_TEXT::TEXT_is_REFERENCE )
1551  {
1552  new_text->SetText( wxT( "${REFERENCE}" ) );
1553  new_text->SetType( FP_TEXT::TEXT_is_DIVERS );
1554  }
1555  else if( new_text->GetType() == FP_TEXT::TEXT_is_VALUE )
1556  {
1557  new_text->SetText( wxT( "${VALUE}" ) );
1558  new_text->SetType( FP_TEXT::TEXT_is_DIVERS );
1559  }
1560 
1561  if( aAddToFootprint )
1562  Add( new_text );
1563 
1564  new_item = new_text;
1565 
1566  break;
1567  }
1568 
1569  case PCB_FP_SHAPE_T:
1570  {
1571  FP_SHAPE* new_shape = new FP_SHAPE( *static_cast<const FP_SHAPE*>( aItem ) );
1572  const_cast<KIID&>( new_shape->m_Uuid ) = KIID();
1573 
1574  if( aAddToFootprint )
1575  Add( new_shape );
1576 
1577  new_item = new_shape;
1578  break;
1579  }
1580 
1581  case PCB_GROUP_T:
1582  new_item = static_cast<const PCB_GROUP*>( aItem )->DeepDuplicate();
1583  break;
1584 
1585  case PCB_FOOTPRINT_T:
1586  // Ignore the footprint itself
1587  break;
1588 
1589  default:
1590  // Un-handled item for duplication
1591  wxFAIL_MSG( "Duplication not supported for items of class " + aItem->GetClass() );
1592  break;
1593  }
1594 
1595  return new_item;
1596 }
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:138
Definition: kiid.h:44
FP_ZONES m_fp_zones
Definition: footprint.h:708
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:121
#define NULL
TEXT_TYPE GetType() const
Definition: fp_text.h:139
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
const KIID m_Uuid
Definition: eda_item.h:523
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
Definition: footprint.cpp:445
Definition: pad.h:60
FP_ZONE is a specialization of ZONE for use in footprints.
Definition: zone.h:965
PADS m_pads
Definition: footprint.h:707
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161

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

Function FindPadByName returns a PAD* with a matching name.

Note that names may not be unique, depending on how the foot print was created.

Parameters
aPadNamethe pad name to find
Returns
PAD* - The first matching name is returned, or NULL if not found.

Definition at line 886 of file footprint.cpp.

887 {
888  for( PAD* pad : m_pads )
889  {
890  if( pad->GetName() == aPadName )
891  return pad;
892  }
893 
894  return NULL;
895 }
#define NULL
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:707

References m_pads, and NULL.

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

1298 {
1299  // Move footprint to its final position:
1300  wxPoint finalPos = m_pos;
1301 
1302  // Now Flip the footprint.
1303  // Flipping a footprint is a specific transform: it is not mirrored like a text.
1304  // We have to change the side, and ensure the footprint rotation is modified according to the
1305  // transform, because this parameter is used in pick and place files, and when updating the
1306  // footprint from library.
1307  // When flipped around the X axis (Y coordinates changed) orientation is negated
1308  // When flipped around the Y axis (X coordinates changed) orientation is 180 - old orient.
1309  // Because it is specfic to a footprint, we flip around the X axis, and after rotate 180 deg
1310 
1311  MIRROR( finalPos.y, aCentre.y );
1312 
1313  SetPosition( finalPos );
1314 
1315  // Flip layer
1316  SetLayer( FlipLayer( GetLayer() ) );
1317 
1318  // Reverse mirror orientation.
1319  m_orient = -m_orient;
1320 
1322 
1323  // Mirror pads to other side of board.
1324  for( PAD* pad : m_pads )
1325  pad->Flip( m_pos, false );
1326 
1327  // Mirror zones to other side of board.
1328  for( ZONE* zone : m_fp_zones )
1329  zone->Flip( m_pos, aFlipLeftRight );
1330 
1331  // Mirror reference and value.
1332  m_reference->Flip( m_pos, false );
1333  m_value->Flip( m_pos, false );
1334 
1335  // Reverse mirror footprint graphics and texts.
1336  for( BOARD_ITEM* item : m_drawings )
1337  {
1338  switch( item->Type() )
1339  {
1340  case PCB_FP_SHAPE_T:
1341  static_cast<FP_SHAPE*>( item )->Flip( m_pos, false );
1342  break;
1343 
1344  case PCB_FP_TEXT_T:
1345  static_cast<FP_TEXT*>( item )->Flip( m_pos, false );
1346  break;
1347 
1348  default:
1349  wxMessageBox( wxT( "FOOTPRINT::Flip() error: Unknown Draw Type" ) );
1350  break;
1351  }
1352  }
1353 
1354  // Now rotate 180 deg if required
1355  if( aFlipLeftRight )
1356  Rotate( aCentre, 1800.0 );
1357 
1359 }
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
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:711
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:713
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:371
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:714
FP_ZONES m_fp_zones
Definition: footprint.h:708
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip entity during footprint flip.
Definition: fp_text.cpp:142
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
wxPoint m_pos
Definition: footprint.h:712
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
Definition: footprint.cpp:1275
DRAWINGS m_drawings
Definition: footprint.h:706
Definition: pad.h:60
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1362
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:707
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
Definition: footprint.cpp:568

References CalculateBoundingBox(), FP_TEXT::Flip(), FlipLayer(), BOARD_ITEM::GetLayer(), m_drawings, m_fp_zones, m_orient, m_pads, m_pos, m_reference, m_value, MIRROR(), NORMALIZE_ANGLE_180(), 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::PlaceModule(), 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 84 of file inspectable.h.

85  {
87  TYPE_ID thisType = TYPE_HASH( *this );
88  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
89  return object ? aProperty->getter( object ) : wxAny();
90  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:64
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:56
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:41
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
virtual wxAny getter(void *aObject) const =0
Provides class metadata.
Definition: property_mgr.h:61
virtual size_t OwnerHash() const =0
Returns 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 93 of file inspectable.h.

94  {
96  TYPE_ID thisType = TYPE_HASH( *this );
97  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
98  return object ? aProperty->get<T>( object ) : T();
99  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:64
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:56
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:41
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
Provides class metadata.
Definition: property_mgr.h:61
T get(void *aObject)
Definition: property.h:265
virtual size_t OwnerHash() const =0
Returns 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 102 of file inspectable.h.

103  {
105  TYPE_ID thisType = TYPE_HASH( *this );
106  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
107  boost::optional<T> ret;
108 
109  if( prop )
110  {
111  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
112 
113  if( object )
114  ret = prop->get<T>( object );
115  }
116 
117  return ret;
118  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:64
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:56
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:41
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Returns a property for a specific type.
Provides class metadata.
Definition: property_mgr.h:61
T get(void *aObject)
Definition: property.h:265
virtual size_t OwnerHash() const =0
Returns 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

Returns 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 1130 of file footprint.cpp.

1131 {
1132  std::unordered_set<int> layers;
1133 
1134  for( BOARD_ITEM* item : m_drawings )
1135  layers.insert( static_cast<int>( item->GetLayer() ) );
1136 
1137  if( aIncludePads )
1138  {
1139  for( PAD* pad : m_pads )
1140  {
1141  int pad_layers[KIGFX::VIEW::VIEW_MAX_LAYERS], pad_layers_count;
1142  pad->ViewGetLayers( pad_layers, pad_layers_count );
1143 
1144  for( int i = 0; i < pad_layers_count; i++ )
1145  layers.insert( pad_layers[i] );
1146  }
1147  }
1148 
1149  aCount = layers.size();
1150  int i = 0;
1151 
1152  for( int layer : layers )
1153  aLayers[i++] = layer;
1154 }
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:696
DRAWINGS m_drawings
Definition: footprint.h:706
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:707

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

◆ GetArea()

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

Definition at line 574 of file footprint.cpp.

575 {
576  double w = std::abs( static_cast<double>( m_boundingBox.GetWidth() ) ) + aPadding;
577  double h = std::abs( static_cast<double>( m_boundingBox.GetHeight() ) ) + aPadding;
578  return w * h;
579 }
int GetWidth() const
Definition: eda_rect.h:114
int GetHeight() const
Definition: eda_rect.h:115
EDA_RECT m_boundingBox
Definition: footprint.h:718

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

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:189
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161

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_TEXT::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), ZONE::Flip(), BOARD_ITEM::GetBoard(), GetBoundingBox(), 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(), getShape(), FP_TEXT::GetShownText(), PAD::GetSolderMaskMargin(), PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), TRACK::GetWidthConstraints(), insideArea(), insideCourtyard(), isDiffPair(), BOARD_ITEM::layerMaskDescribe(), VIA::layerMaskDescribe(), CONVERT_TOOL::makePolysFromCircles(), PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD::ResolveDRCExclusions(), BOARD_CONNECTED_ITEM::SetNetCode(), ZONE::TransformSmoothedOutlineToPolygon(), ZONE::TransformSolidAreasShapesToPolygon(), TRACK::ViewBBox(), ViewBBox(), 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 );
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_EDIT_FRAME::ExecuteRemoteCommand(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), and HitTest().

◆ GetBoundingBox() [2/2]

const EDA_RECT FOOTPRINT::GetBoundingBox ( bool  aIncludeInvisibleText) const

Definition at line 637 of file footprint.cpp.

638 {
639  EDA_RECT area = GetFootprintRect();
640 
641  // Add in items not collected by GetFootprintRect():
642  for( BOARD_ITEM* item : m_drawings )
643  {
644  if( item->Type() != PCB_FP_SHAPE_T )
645  area.Merge( item->GetBoundingBox() );
646  }
647 
648  // This can be further optimized when aIncludeInvisibleText is true, but currently
649  // leaving this as is until it's determined there is a noticeable speed hit.
650  bool valueLayerIsVisible = true;
651  bool refLayerIsVisible = true;
652  BOARD* board = GetBoard();
653 
654  if( board )
655  {
656  // The first "&&" conditional handles the user turning layers off as well as layers
657  // not being present in the current PCB stackup. Values, references, and all
658  // footprint text can also be turned off via the GAL meta-layers, so the 2nd and
659  // 3rd "&&" conditionals handle that.
660  valueLayerIsVisible = board->IsLayerVisible( m_value->GetLayer() )
662  && board->IsElementVisible( LAYER_MOD_TEXT_FR );
663 
664  refLayerIsVisible = board->IsLayerVisible( m_reference->GetLayer() )
666  && board->IsElementVisible( LAYER_MOD_TEXT_FR );
667  }
668 
669 
670  if(( m_value->IsVisible() && valueLayerIsVisible ) || aIncludeInvisibleText )
671  area.Merge( m_value->GetBoundingBox() );
672 
673  if(( m_reference->IsVisible() && refLayerIsVisible ) || aIncludeInvisibleText )
674  area.Merge( m_reference->GetBoundingBox() );
675 
676  return area;
677 }
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
show footprints values (when texts are visibles)
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
FP_TEXT * m_reference
Definition: footprint.h:713
FP_TEXT * m_value
Definition: footprint.h:714
EDA_RECT GetFootprintRect() const
Function GetFootprintRect() Build and returns the boundary box of the footprint excluding any text.
Definition: footprint.cpp:582
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
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
Return the orthogonal bounding box of this object for display purposes.
Definition: fp_text.cpp:235
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:189
Handle the component boundary box.
Definition: eda_rect.h:42
DRAWINGS m_drawings
Definition: footprint.h:706
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173
show footprints references (when texts are visibles)

References BOARD_ITEM::GetBoard(), FP_TEXT::GetBoundingBox(), GetFootprintRect(), BOARD_ITEM::GetLayer(), BOARD::IsElementVisible(), BOARD::IsLayerVisible(), EDA_TEXT::IsVisible(), LAYER_MOD_REFERENCES, LAYER_MOD_TEXT_FR, LAYER_MOD_VALUES, m_drawings, m_reference, m_value, EDA_RECT::Merge(), and PCB_FP_SHAPE_T.

◆ GetBoundingBoxBase()

EDA_RECT FOOTPRINT::GetBoundingBoxBase ( ) const
inline

Returns the last calculated bounding box of the footprint (does not recalculate it).

(call CalculateBoundingBox() to recalculate it)

Returns
EDA_RECT - The rectangle containing the footprint

Definition at line 161 of file footprint.h.

161 { return m_boundingBox; }
EDA_RECT m_boundingBox
Definition: footprint.h:718

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

◆ GetBoundingHull()

SHAPE_POLY_SET FOOTPRINT::GetBoundingHull ( ) const

Returns 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 680 of file footprint.cpp.

681 {
682  SHAPE_POLY_SET rawPolys;
683 
684  for( BOARD_ITEM* item : m_drawings )
685  {
686  if( item->Type() == PCB_FP_SHAPE_T )
687  {
688  item->TransformShapeWithClearanceToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
689  ERROR_OUTSIDE );
690  }
691 
692  // We intentionally exclude footprint text from the bounding hull.
693  }
694 
695  for( PAD* pad : m_pads )
696  {
697  pad->TransformShapeWithClearanceToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
698  ERROR_OUTSIDE );
699  }
700 
701  for( FP_ZONE* zone : m_fp_zones )
702  {
703  for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
704  {
705  SHAPE_POLY_SET layerPoly = zone->GetFilledPolysList( layer );
706 
707  for( int ii = 0; ii < layerPoly.OutlineCount(); ii++ )
708  {
709  const SHAPE_LINE_CHAIN& poly = layerPoly.COutline( ii );
710  rawPolys.AddOutline( poly );
711  }
712  }
713  }
714 
715  // If there are some graphic items, build the actual hull.
716  // However if no items, create a minimal polygon (can happen if a footprint
717  // is created with no item: it contains only 2 texts.
718  if( rawPolys.OutlineCount() == 0 )
719  {
720  // generate a small dummy rectangular outline around the anchor
721  const int halfsize = Millimeter2iu( 0.02 );
722 
723  rawPolys.NewOutline();
724  // add a square:
725  rawPolys.Append( GetPosition().x - halfsize, GetPosition().y - halfsize );
726  rawPolys.Append( GetPosition().x + halfsize, GetPosition().y - halfsize );
727  rawPolys.Append( GetPosition().x + halfsize, GetPosition().y + halfsize );
728  rawPolys.Append( GetPosition().x - halfsize, GetPosition().y + halfsize );
729  }
730 
731  std::vector<wxPoint> convex_hull;
732  BuildConvexHull( convex_hull, rawPolys );
733 
734  SHAPE_POLY_SET hullPoly;
735  hullPoly.NewOutline();
736 
737  for( const wxPoint& pt : convex_hull )
738  hullPoly.Append( pt );
739 
740  return hullPoly;
741 }
int OutlineCount() const
Returns the number of outlines in the set
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:708
SHAPE_POLY_SET.
int NewOutline()
Creates a new empty polygon in the set and returns its index
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
wxPoint GetPosition() const override
Definition: footprint.h:200
DRAWINGS m_drawings
Definition: footprint.h:706
Definition: pad.h:60
static constexpr int Millimeter2iu(double mm)
FP_ZONE is a specialization of ZONE for use in footprints.
Definition: zone.h:965
PADS m_pads
Definition: footprint.h:707
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
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, GetPosition(), m_drawings, m_fp_zones, m_pads, Millimeter2iu(), SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), PCB_FP_SHAPE_T, and UNDEFINED_LAYER.

Referenced by CoverageRatio(), 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:89
const wxPoint GetCenter() const
Definition: eda_rect.h:109

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

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

◆ GetClass()

wxString FOOTPRINT::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 586 of file footprint.h.

587  {
588  return wxT( "FOOTPRINT" );
589  }

Referenced by Visit().

◆ GetContextualTextVars()

void FOOTPRINT::GetContextualTextVars ( wxArrayString *  aVars) const

Return the list of system text vars for this footprint.

Definition at line 401 of file footprint.cpp.

402 {
403  aVars->push_back( wxT( "REFERENCE" ) );
404  aVars->push_back( wxT( "VALUE" ) );
405  aVars->push_back( wxT( "LAYER" ) );
406 }

◆ GetCoverageArea()

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

Definition at line 1646 of file footprint.cpp.

1647 {
1648  int textMargin = KiROUND( 5 * aCollector.GetGuide()->OnePixelInIU() );
1649  SHAPE_POLY_SET poly;
1650 
1651  if( aItem->Type() == PCB_MARKER_T )
1652  {
1653  const PCB_MARKER* marker = static_cast<const PCB_MARKER*>( aItem );
1654  SHAPE_LINE_CHAIN markerShape;
1655 
1656  marker->ShapeToPolygon( markerShape );
1657  return markerShape.Area();
1658  }
1659  else if( aItem->Type() == PCB_GROUP_T )
1660  {
1661  double combinedArea = 0.0;
1662 
1663  for( BOARD_ITEM* member : static_cast<const PCB_GROUP*>( aItem )->GetItems() )
1664  combinedArea += GetCoverageArea( member, aCollector );
1665 
1666  return combinedArea;
1667  }
1668 
1669  if( aItem->Type() == PCB_FOOTPRINT_T )
1670  {
1671  const FOOTPRINT* footprint = static_cast<const FOOTPRINT*>( aItem );
1672 
1673  poly = footprint->GetBoundingHull();
1674  }
1675  else if( aItem->Type() == PCB_FP_TEXT_T )
1676  {
1677  const FP_TEXT* text = static_cast<const FP_TEXT*>( aItem );
1678 
1680  ARC_LOW_DEF, ERROR_OUTSIDE );
1681  }
1682  else
1683  {
1685  ARC_LOW_DEF, ERROR_OUTSIDE );
1686  }
1687 
1688  poly.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1689  poly.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1690  return polygonArea( poly );
1691 }
static double GetCoverageArea(const BOARD_ITEM *aItem, const GENERAL_COLLECTOR &aCollector)
Definition: footprint.cpp:1646
void TransformTextShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc) const
Function TransformTextShapeWithClearanceToPolygon Convert the text to a polygonSet describing the act...
SHAPE_POLY_SET GetBoundingHull() const
Returns a bounding polygon for the shapes and pads in the footprint This operation is slower but more...
Definition: footprint.cpp:680
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
const COLLECTORS_GUIDE * GetGuide() const
Definition: collectors.h:338
SHAPE_POLY_SET.
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
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
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161
static double polygonArea(SHAPE_POLY_SET &aPolySet)
Definition: footprint.cpp:1629

References SHAPE_LINE_CHAIN::Area(), ERROR_OUTSIDE, GetBoundingHull(), GENERAL_COLLECTOR::GetGuide(), KiROUND(), COLLECTORS_GUIDE::OnePixelInIU(), PCB_FOOTPRINT_T, PCB_FP_TEXT_T, PCB_GROUP_T, PCB_MARKER_T, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, polygonArea(), MARKER_BASE::ShapeToPolygon(), BOARD_ITEM::TransformShapeWithClearanceToPolygon(), FP_TEXT::TransformTextShapeWithClearanceToPolygon(), EDA_ITEM::Type(), and UNDEFINED_LAYER.

Referenced by PCB_SELECTION_TOOL::GuessSelectionCandidates().

◆ GetDescription()

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 206 of file eda_item.h.

207  {
208  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
210 
211  return m_flags & mask;
212  }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:107
#define STRUCT_DELETED
flag indication structures to be erased
Definition: eda_item.h:115
#define IS_MOVED
Item being moved.
Definition: eda_item.h:105
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:108
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: eda_item.h:119
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:110
STATUS_FLAGS m_flags
Definition: eda_item.h:529
#define IS_NEW
New item, just created.
Definition: eda_item.h:106

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

Referenced by SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), 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 1770 of file footprint.cpp.

1771 {
1772  std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
1773 
1774  // There are several possible interpretations here:
1775  // 1) the bounding box (without or without invisible items)
1776  // 2) just the pads and "edges" (ie: non-text graphic items)
1777  // 3) the courtyard
1778 
1779  // We'll go with (2) for now....
1780 
1781  for( PAD* pad : Pads() )
1782  shape->AddShape( pad->GetEffectiveShape( aLayer )->Clone() );
1783 
1784  for( BOARD_ITEM* item : GraphicalItems() )
1785  {
1786  if( item->Type() == PCB_FP_SHAPE_T )
1787  shape->AddShape( item->GetEffectiveShape( aLayer )->Clone() );
1788  }
1789 
1790  return shape;
1791 }
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:182
DRAWINGS & GraphicalItems()
Definition: footprint.h:185
Definition: pad.h:60

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

◆ GetFirstPad()

PAD* FOOTPRINT::GetFirstPad ( ) const
inline

Gets the first pad in the list or NULL if none.

Returns
first pad or null pointer

Definition at line 517 of file footprint.h.

518  {
519  return m_pads.empty() ? nullptr : m_pads.front();
520  }
PADS m_pads
Definition: footprint.h:707

Referenced by GetTopLeftPad().

◆ GetFlag()

int FOOTPRINT::GetFlag ( ) const
inline

Definition at line 254 of file footprint.h.

254 { return m_arflag; }
int m_arflag
Definition: footprint.h:732

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 307 of file eda_item.h.

307 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:300

References EDA_ITEM::GetPosition().

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

◆ GetFootprintRect()

EDA_RECT FOOTPRINT::GetFootprintRect ( ) const

Function GetFootprintRect() Build and returns the boundary box of the footprint excluding any text.

Returns
EDA_RECT - The rectangle containing the footprint.

Definition at line 582 of file footprint.cpp.

583 {
584  EDA_RECT area;
585 
586  area.SetOrigin( m_pos );
587  area.SetEnd( m_pos );
588  area.Inflate( Millimeter2iu( 0.25 ) ); // Give a min size to the area
589 
590  for( BOARD_ITEM* item : m_drawings )
591  {
592  if( item->Type() == PCB_FP_SHAPE_T )
593  area.Merge( item->GetBoundingBox() );
594  }
595 
596  for( PAD* pad : m_pads )
597  area.Merge( pad->GetBoundingBox() );
598 
599  for( FP_ZONE* zone : m_fp_zones )
600  area.Merge( zone->GetBoundingBox() );
601 
602  // Groups do not contribute to the rect, only their members
603 
604  return area;
605 }
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
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:126
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
FP_ZONES m_fp_zones
Definition: footprint.h:708
void SetEnd(int x, int y)
Definition: eda_rect.h:187
wxPoint m_pos
Definition: footprint.h:712
Handle the component boundary box.
Definition: eda_rect.h:42
DRAWINGS m_drawings
Definition: footprint.h:706
Definition: pad.h:60
static constexpr int Millimeter2iu(double mm)
FP_ZONE is a specialization of ZONE for use in footprints.
Definition: zone.h:965
PADS m_pads
Definition: footprint.h:707
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::Inflate(), m_drawings, m_fp_zones, m_pads, m_pos, EDA_RECT::Merge(), Millimeter2iu(), PCB_FP_SHAPE_T, EDA_RECT::SetEnd(), and EDA_RECT::SetOrigin().

Referenced by CalculateBoundingBox(), GetBoundingBox(), GetBoundingBoxes(), FOOTPRINT_EDIT_FRAME::GetDocumentExtents(), AR_AUTOPLACER::getOptimalFPPlacement(), PCB_SELECTION_TOOL::hitTestDistance(), moveFootprintsInArea(), SpreadFootprints(), AR_AUTOPLACER::testFootprintOnBoard(), and ViewBBox().

◆ GetFPID()

const LIB_ID& FOOTPRINT::GetFPID ( ) const
inline

Definition at line 208 of file footprint.h.

208 { return m_fpid; }
LIB_ID m_fpid
Definition: footprint.h:715

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(), 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_FP_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_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

Returns 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 fp outline when the coutyard is missing or broken

Returns
EDA_RECT - 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:301
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Handle the component boundary box.
Definition: eda_rect.h:42
Definition: pad.h:60

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

◆ GetInitialComments()

const wxArrayString* FOOTPRINT::GetInitialComments ( ) const
inline

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

Definition at line 671 of file footprint.h.

671 { return m_initial_comments; }
wxArrayString * m_initial_comments
Definition: footprint.h:739

Referenced by PCB_IO::format().

◆ GetKeywords()

◆ GetLastEditTime()

timestamp_t FOOTPRINT::GetLastEditTime ( ) const
inline

Definition at line 348 of file footprint.h.

348 { return m_lastEditTime; }
timestamp_t m_lastEditTime
Definition: footprint.h:731

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(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::ExchangeFootprint(), export_vrml_drawsegment(), export_vrml_footprint(), export_vrml_fp_shape(), export_vrml_fp_text(), export_vrml_pcbtext(), export_vrml_tracks(), extractDiffPairCoupledItems(), EDIT_TOOL::FilletTracks(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), FP_SHAPE::Flip(), TRACK::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(), TEXT_MOD_GRID_TABLE::GetValueAsLong(), TRACK::GetWidthConstraints(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), idf_export_footprint(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), PAD::IsFlipped(), PNS_KICAD_IFACE::IsItemVisible(), BOARD_ITEM::IsOnCopperLayer(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), 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::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(), TEXT_MOD_GRID_TABLE::SetValueAsLong(), GLOBAL_EDIT_TOOL::swapBoardItem(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), PNS_KICAD_IFACE_BASE::syncTrack(), AR_AUTOPLACER::testFootprintOnBoard(), 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:189
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:657

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(), TEXT_MOD_GRID_TABLE::GetValue(), and ResolveTextVar().

◆ GetLayerSet()

virtual LSET BOARD_ITEM::GetLayerSet ( ) const
inlinevirtualinherited

◆ GetLink()

◆ GetLocalClearance() [1/2]

◆ GetLocalClearance() [2/2]

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

Definition at line 226 of file footprint.h.

227  {
228  if( aSource )
229  *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
230 
231  return m_localClearance;
232  }
const wxString GetReference() const
Function GetReference.
Definition: footprint.h:442
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:723
#define _(s)
Definition: 3d_actions.cpp:33

References _, and Format().

◆ GetLocalSolderMaskMargin()

int FOOTPRINT::GetLocalSolderMaskMargin ( ) const
inline

◆ GetLocalSolderPasteMargin()

◆ GetLocalSolderPasteMarginRatio()

double FOOTPRINT::GetLocalSolderPasteMarginRatio ( ) const
inline

◆ GetMenuImage()

BITMAP_DEF 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 1092 of file footprint.cpp.

1093 {
1094  return module_xpm;
1095 }
const BITMAP_OPAQUE module_xpm[1]
Definition: module.cpp:29

References module_xpm.

◆ GetMsgPanelInfo()

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

Reimplemented from EDA_ITEM.

Definition at line 744 of file footprint.cpp.

745 {
746  wxString msg, msg2;
747 
748  aList.emplace_back( m_reference->GetShownText(), m_value->GetShownText() );
749 
750  if( aFrame->IsType( FRAME_FOOTPRINT_VIEWER )
752  || aFrame->IsType( FRAME_FOOTPRINT_EDITOR ) )
753  {
754  wxDateTime date( static_cast<time_t>( m_lastEditTime ) );
755 
756  // Date format: see http://www.cplusplus.com/reference/ctime/strftime
757  if( m_lastEditTime && date.IsValid() )
758  msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year
759  else
760  msg = _( "Unknown" );
761 
762  aList.emplace_back( _( "Last Change" ), msg );
763  }
764  else if( aFrame->IsType( FRAME_PCB_EDITOR ) )
765  {
766  aList.emplace_back( _( "Board Side" ), IsFlipped() ? _( "Back (Flipped)" ) : _( "Front" ) );
767  }
768 
769  auto addToken = []( wxString* aStr, const wxString& aAttr )
770  {
771  if( !aStr->IsEmpty() )
772  *aStr += wxT( ", " );
773 
774  *aStr += aAttr;
775  };
776 
777  wxString status;
778  wxString attrs;
779 
780  if( IsLocked() )
781  addToken( &status, _( "locked" ) );
782 
783  if( m_fpStatus & FP_is_PLACED )
784  addToken( &status, _( "autoplaced" ) );
785 
787  addToken( &attrs, _( "not in schematic" ) );
788 
790  addToken( &attrs, _( "exclude from pos files" ) );
791 
793  addToken( &attrs, _( "exclude from BOM" ) );
794 
795  aList.emplace_back( _( "Status: " ) + status, _( "Attributes:" ) + wxS( " " ) + attrs );
796 
797  aList.emplace_back( _( "Rotation" ), wxString::Format( "%.4g", GetOrientationDegrees() ) );
798 
799  msg.Printf( _( "Footprint: %s" ), m_fpid.Format().c_str() );
800  msg2.Printf( _( "3D-Shape: %s" ), m_3D_Drawings.empty() ? _( "<none>" )
801  : m_3D_Drawings.front().m_Filename );
802  aList.emplace_back( msg, msg2 );
803 
804  msg.Printf( _( "Doc: %s" ), m_doc );
805  msg2.Printf( _( "Keywords: %s" ), m_keywords );
806  aList.emplace_back( msg, msg2 );
807 }
bool IsLocked() const override
Definition: footprint.h:298
timestamp_t m_lastEditTime
Definition: footprint.h:731
FP_TEXT * m_reference
Definition: footprint.h:713
const char * c_str() const
Definition: utf8.h:102
FP_TEXT * m_value
Definition: footprint.h:714
int m_fpStatus
Definition: footprint.h:717
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
function IsFlipped
Definition: footprint.h:282
double GetOrientationDegrees() const
Definition: footprint.h:205
wxString m_keywords
Definition: footprint.h:729
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
LIB_ID m_fpid
Definition: footprint.h:715
#define FP_is_PLACED
In autoplace: footprint automatically placed.
Definition: footprint.h:293
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: fp_text.cpp:408
wxString m_doc
Definition: footprint.h:728
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:737
int m_attributes
Definition: footprint.h:716

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

Function GetNextPadName returns 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 1599 of file footprint.cpp.

1600 {
1601  std::set<wxString> usedNames;
1602 
1603  // Create a set of used pad numbers
1604  for( PAD* pad : m_pads )
1605  usedNames.insert( pad->GetName() );
1606 
1607  wxString prefix = UTIL::GetReferencePrefix( aLastPadName );
1608  int num = GetTrailingInt( aLastPadName );
1609 
1610  while( usedNames.count( wxString::Format( "%s%d", prefix, num ) ) )
1611  num++;
1612 
1613  return wxString::Format( "%s%d", prefix, num );
1614 }
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:716
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:707

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

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

Function GetPad 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 898 of file footprint.cpp.

899 {
900  for( PAD* pad : m_pads )
901  {
902  // ... and on the correct layer.
903  if( !( pad->GetLayerSet() & aLayerMask ).any() )
904  continue;
905 
906  if( pad->HitTest( aPosition ) )
907  return pad;
908  }
909 
910  return NULL;
911 }
#define NULL
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:707

References m_pads, and NULL.

◆ GetPadCount()

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

GetPadCount returns 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 933 of file footprint.cpp.

934 {
935  if( aIncludeNPTH )
936  return m_pads.size();
937 
938  unsigned cnt = 0;
939 
940  for( PAD* pad : m_pads )
941  {
942  if( pad->GetAttribute() == PAD_ATTRIB_NPTH )
943  continue;
944 
945  cnt++;
946  }
947 
948  return cnt;
949 }
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:707

References m_pads, 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:527
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(), 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(), 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(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), 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(), PCB_GROUP::TopLevelGroup(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_MARKER::ViewGetLayers(), FP_ZONE::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and PCB_GROUP::WithinScope().

◆ GetParentGroup()

◆ GetPath()

◆ GetPlacementCost180()

int FOOTPRINT::GetPlacementCost180 ( ) const
inline

◆ GetPlacementCost90()

int FOOTPRINT::GetPlacementCost90 ( ) const
inline

◆ GetPolyCourtyardBack()

SHAPE_POLY_SET& FOOTPRINT::GetPolyCourtyardBack ( )
inline

◆ GetPolyCourtyardFront()

SHAPE_POLY_SET& FOOTPRINT::GetPolyCourtyardFront ( )
inline

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

Returns
the courtyard polygon

Definition at line 676 of file footprint.h.

676 { return m_poly_courtyard_front; }
SHAPE_POLY_SET m_poly_courtyard_front
Definition: footprint.h:742

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

◆ GetPosition()

wxPoint FOOTPRINT::GetPosition ( ) const
inlineoverridevirtual

Reimplemented from EDA_ITEM.

Definition at line 200 of file footprint.h.

200 { return m_pos; }
wxPoint m_pos
Definition: footprint.h:712

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCAD2KICAD::PCB_PAD::AddToFootprint(), PCB_GRID_HELPER::computeAnchors(), ConvertOutlineToPolygon(), MICROWAVE_TOOL::createBaseFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::ExchangeFootprint(), export_vrml_footprint(), export_vrml_fp_shape(), 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(), LEGACY_PLUGIN::loadPAD(), PCB_SHAPE::MakeEffectiveShapes(), moveFootprintsInArea(), EAGLE_PLUGIN::orientFootprintAndText(), EAGLE_PLUGIN::packageHole(), EAGLE_PLUGIN::packageText(), PAD::PAD(), ALTIUM_PCB::ParseComponentsBodies6Data(), BOARD_EDITOR_CONTROL::PlaceModule(), 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 489 of file footprint.h.

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

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

◆ GetReference()

const wxString FOOTPRINT::GetReference ( void  ) const
inline

Function GetReference.

Returns
const wxString& - the reference designator text.

Definition at line 442 of file footprint.h.

443  {
444  return m_reference->GetText();
445  }
FP_TEXT * m_reference
Definition: footprint.h:713
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(), FROM_TO_CACHE::cacheFromToPaths(), CollisionMatchesExpected(), DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange(), GERBER_WRITER::createDrillFile(), PCB_BASE_FRAME::CreateNewFootprint(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), 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 1081 of file footprint.cpp.

1082 {
1083  wxString reference = GetReference();
1084 
1085  if( reference.IsEmpty() )
1086  reference = _( "<no reference designator>" );
1087 
1088  return wxString::Format( _( "Footprint %s" ), reference );
1089 }
const wxString GetReference() const
Function GetReference.
Definition: footprint.h:442
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 185 of file eda_item.h.

186  {
187  return m_status & type;
188  }
STATUS_FLAGS m_status
Definition: eda_item.h:526

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 198 of file eda_item.h.

198 { return m_status; }
STATUS_FLAGS m_status
Definition: eda_item.h:526

References EDA_ITEM::m_status.

◆ GetThermalGap()

int FOOTPRINT::GetThermalGap ( ) const
inline

Definition at line 247 of file footprint.h.

247 { return m_thermalGap; }
int m_thermalGap
Definition: footprint.h:722

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

◆ GetThermalWidth()

int FOOTPRINT::GetThermalWidth ( ) const
inline

Definition at line 244 of file footprint.h.

244 { return m_thermalWidth; }
int m_thermalWidth
Definition: footprint.h:721

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

◆ GetTopLeftPad()

PAD * FOOTPRINT::GetTopLeftPad ( )

Definition at line 914 of file footprint.cpp.

915 {
916  PAD* topLeftPad = GetFirstPad();
917 
918  for( PAD* p : m_pads )
919  {
920  wxPoint pnt = p->GetPosition(); // GetPosition() returns the center of the pad
921 
922  if( ( pnt.x < topLeftPad->GetPosition().x ) ||
923  ( topLeftPad->GetPosition().x == pnt.x && pnt.y < topLeftPad->GetPosition().y ) )
924  {
925  topLeftPad = p;
926  }
927  }
928 
929  return topLeftPad;
930 }
PAD * GetFirstPad() const
Gets the first pad in the list or NULL if none.
Definition: footprint.h:517
wxPoint GetPosition() const override
Definition: pad.h:176
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:707

References GetFirstPad(), PAD::GetPosition(), and m_pads.

◆ GetUniquePadCount()

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

GetUniquePadCount returns the number of unique 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.

GetUniquePadCount calculate the count of not blank pad names

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

953 {
954  std::set<wxString> usedNames;
955 
956  // Create a set of used pad numbers
957  for( PAD* pad : m_pads )
958  {
959  // Skip pads not on copper layers (used to build complex
960  // solder paste shapes for instance)
961  if( ( pad->GetLayerSet() & LSET::AllCuMask() ).none() )
962  continue;
963 
964  // Skip pads with no name, because they are usually "mechanical"
965  // pads, not "electrical" pads
966  if( pad->GetName().IsEmpty() )
967  continue;
968 
969  if( !aIncludeNPTH )
970  {
971  // skip NPTH
972  if( pad->GetAttribute() == PAD_ATTRIB_NPTH )
973  {
974  continue;
975  }
976  }
977 
978  usedNames.insert( pad->GetName() );
979  }
980 
981  return usedNames.size();
982 }
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:707

References LSET::AllCuMask(), m_pads, 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 186 of file footprint.h.

186 { return m_drawings; }
DRAWINGS m_drawings
Definition: footprint.h:706

◆ Groups() [1/2]

FP_GROUPS& FOOTPRINT::Groups ( )
inline

◆ Groups() [2/2]

const FP_GROUPS& FOOTPRINT::Groups ( ) const
inline

Definition at line 192 of file footprint.h.

192 { return m_fp_groups; }
FP_GROUPS m_fp_groups
Definition: footprint.h:709

◆ HasFlag()

◆ HasThroughHolePads()

bool FOOTPRINT::HasThroughHolePads ( ) const

Definition at line 1851 of file footprint.cpp.

1852 {
1853  for( PAD* pad : Pads() )
1854  {
1855  if( pad->GetAttribute() != PAD_ATTRIB_SMD )
1856  return true;
1857  }
1858 
1859  return false;
1860 }
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:81
PADS & Pads()
Definition: footprint.h:182
Definition: pad.h:60

References 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 833 of file footprint.cpp.

834 {
835  EDA_RECT rect = m_boundingBox;//.GetBoundingBoxRotated( GetPosition(), m_Orient );
836  return rect.Inflate( aAccuracy ).Contains( aPosition );
837 }
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
Handle the component boundary box.
Definition: eda_rect.h:42
EDA_RECT m_boundingBox
Definition: footprint.h:718
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(), EDA_RECT::Inflate(), and m_boundingBox.

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

847 {
848  EDA_RECT arect = aRect;
849  arect.Inflate( aAccuracy );
850 
851  if( aContained )
852  return arect.Contains( m_boundingBox );
853  else
854  {
855  // If the rect does not intersect the bounding box, skip any tests
856  if( !aRect.Intersects( GetBoundingBox() ) )
857  return false;
858 
859  // Determine if any elements in the FOOTPRINT intersect the rect
860  for( PAD* pad : m_pads )
861  {
862  if( pad->HitTest( arect, false, 0 ) )
863  return true;
864  }
865 
866  for( FP_ZONE* zone : m_fp_zones )
867  {
868  if( zone->HitTest( arect, false, 0 ) )
869  return true;
870  }
871 
872  for( BOARD_ITEM* item : m_drawings )
873  {
874  if( item->HitTest( arect, false, 0 ) )
875  return true;
876  }
877 
878  // Groups are not hit-tested; only their members
879 
880  // No items were hit
881  return false;
882  }
883 }
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:708
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:706
Definition: pad.h:60
FP_ZONE is a specialization of ZONE for use in footprints.
Definition: zone.h:965
PADS m_pads
Definition: footprint.h:707
EDA_RECT m_boundingBox
Definition: footprint.h:718
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_boundingBox, m_drawings, m_fp_zones, and m_pads.

◆ HitTestAccurate()

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

Tests 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 840 of file footprint.cpp.

841 {
842  return GetBoundingHull().Collide( aPosition, aAccuracy );
843 }
SHAPE_POLY_SET GetBoundingHull() const
Returns a bounding polygon for the shapes and pads in the footprint This operation is slower but more...
Definition: footprint.cpp:680
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Function Collide()

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

Referenced by GENERAL_COLLECTOR::Inspect().

◆ IncrementFlag()

void FOOTPRINT::IncrementFlag ( )
inline

Definition at line 253 of file footprint.h.

253 { m_arflag += 1; }
int m_arflag
Definition: footprint.h:732

◆ IncrementReference()

void FOOTPRINT::IncrementReference ( int  aDelta)

Function IncrementReference Bumps the current reference by aDelta.

Definition at line 1617 of file footprint.cpp.

1618 {
1619  const wxString& refdes = GetReference();
1620 
1621  SetReference( wxString::Format( wxT( "%s%i" ),
1622  UTIL::GetReferencePrefix( refdes ),
1623  GetTrailingInt( refdes ) + aDelta ) );
1624 }
void SetReference(const wxString &aReference)
Function SetReference.
Definition: footprint.h:452
const wxString GetReference() const
Function GetReference.
Definition: footprint.h:442
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:716

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

◆ IsBrightened()

◆ IsConnected()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 169 of file eda_item.h.

169 { return m_flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:108
STATUS_FLAGS m_flags
Definition: eda_item.h:529

References IS_DRAGGED, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES(), and KIGFX::SCH_PAINTER::setDeviceColors().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 172 of file eda_item.h.

172 { return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered
Definition: eda_item.h:136
STATUS_FLAGS m_flags
Definition: eda_item.h:529

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsFlipped()

bool FOOTPRINT::IsFlipped ( ) const
inline

function IsFlipped

Returns
true if the footprint is flipped, i.e. on the back side of the board

Definition at line 282 of file footprint.h.

282 { 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, and GetLayer().

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

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 254 of file eda_item.h.

254 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:528

References EDA_ITEM::m_forceVisible.

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

◆ IsLibNameValid()

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

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

)

Parameters
aName= the name in library to validate
Returns
true if the given name is valid

Definition at line 1242 of file footprint.cpp.

1243 {
1244  const wxChar * invalids = StringLibNameInvalidChars( false );
1245 
1246  if( aName.find_first_of( invalids ) != std::string::npos )
1247  return false;
1248 
1249  return true;
1250 }
static const wxChar * StringLibNameInvalidChars(bool aUserReadable)
static function StringLibNameInvalidChars Test for validity of the name in a library of the footprint...
Definition: footprint.cpp:1253

References StringLibNameInvalidChars().

Referenced by DIALOG_FOOTPRINT_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 298 of file footprint.h.

299  {
300  return ( m_fpStatus & FP_is_LOCKED ) != 0;
301  }
int m_fpStatus
Definition: footprint.h:717
#define FP_is_LOCKED
footprint LOCKED: no autoplace allowed
Definition: footprint.h:292

References FP_is_LOCKED.

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 166 of file eda_item.h.

166 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
Definition: eda_item.h:102
STATUS_FLAGS m_flags
Definition: eda_item.h:529

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNetTie()

bool FOOTPRINT::IsNetTie ( ) const
inline

Definition at line 257 of file footprint.h.

257 { return GetKeywords().StartsWith( wxT( "net tie" ) ); }
const wxString & GetKeywords() const
Definition: footprint.h:214

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::EvalRulesForItems(), 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 810 of file footprint.cpp.

811 {
812  // If we have any pads, fall back on normal checking
813  if( !m_pads.empty() )
814  return m_layer == aLayer;
815 
816  // No pads? Check if this entire footprint exists on the given layer
817  for( FP_ZONE* zone : m_fp_zones )
818  {
819  if( !zone->IsOnLayer( aLayer ) )
820  return false;
821  }
822 
823  for( BOARD_ITEM* item : m_drawings )
824  {
825  if( !item->IsOnLayer( aLayer ) )
826  return false;
827  }
828 
829  return true;
830 }
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:708
PCB_LAYER_ID m_layer
Definition: board_item.h:363
DRAWINGS m_drawings
Definition: footprint.h:706
FP_ZONE is a specialization of ZONE for use in footprints.
Definition: zone.h:965
PADS m_pads
Definition: footprint.h:707

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

◆ IsPlaced()

bool FOOTPRINT::IsPlaced ( ) const
inline

Definition at line 316 of file footprint.h.

316 { return m_fpStatus & FP_is_PLACED; }
int m_fpStatus
Definition: footprint.h:717
#define FP_is_PLACED
In autoplace: footprint automatically placed.
Definition: footprint.h:293

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_SHEET, SCH_LABEL, SCH_TEXT, SCH_SHEET_PIN, and SCH_FIELD.

Definition at line 451 of file eda_item.h.

451 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 173 of file eda_item.h.

173 { return m_flags & IS_RESIZED; }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:107
STATUS_FLAGS m_flags
Definition: eda_item.h:529

References IS_RESIZED, and EDA_ITEM::m_flags.

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

◆ IsSelected()

◆ 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:161

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, SCH_LINE, FP_TEXT, FP_SHAPE, and PCB_TEXT.

Definition at line 231 of file eda_item.h.

232  {
233  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
234  return true;
235 
236  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
237  {
238  if( m_structType == *p )
239  return true;
240  }
241 
242  return false;
243  }
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:536

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), PCB_TEXT::IsType(), FP_SHAPE::IsType(), FP_TEXT::IsType(), SCH_LINE::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 170 of file eda_item.h.

170 { return m_flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:110
STATUS_FLAGS m_flags
Definition: eda_item.h:529

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

347  {
348  for( auto it : aList )
349  {
350  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
352  return SEARCH_RESULT::QUIT;
353  }
354 
356  }
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:107

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 362 of file eda_item.h.

364  {
365  for( auto it : aList )
366  {
367  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
369  return SEARCH_RESULT::QUIT;
370  }
371 
373  }
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:107

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:189
#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 334 of file footprint.h.

334 { return m_fpStatus & FP_PADS_are_LOCKED; }
#define FP_PADS_are_LOCKED
Definition: footprint.h:295
int m_fpStatus
Definition: footprint.h:717

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_SHEET_PIN, SCH_FIELD, ZONE, SCH_PIN, SCH_MARKER, PCB_MARKER, FP_TEXT, and PCB_TEXT.

Definition at line 413 of file eda_item.h.

414  {
415  return false;
416  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), PCB_TEXT::Matches(), FP_TEXT::Matches(), PCB_MARKER::Matches(), SCH_MARKER::Matches(), SCH_PIN::Matches(), ZONE::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::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 132 of file eda_item.cpp.

133 {
134  wxString text = aText;
135  wxString searchText = aSearchData.GetFindString();
136 
137  // Don't match if searching for replaceable item and the item doesn't support text replace.
138  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
139  return false;
140 
141  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
142  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
143 
144  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
145  {
146  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
147  return text.Matches( searchText );
148 
149  return text.MakeUpper().Matches( searchText.MakeUpper() );
150  }
151 
152  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
153  return aText.Find( searchText ) != wxNOT_FOUND;
154 
155  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
156 }
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:451

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

◆ Models() [1/2]

◆ Models() [2/2]

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

Definition at line 197 of file footprint.h.

197 { return m_3D_Drawings; }
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:737

◆ 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 1268 of file footprint.cpp.

1269 {
1270  wxPoint newpos = m_pos + aMoveVector;
1271  SetPosition( newpos );
1272 }
wxPoint m_pos
Definition: footprint.h:712
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1362

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)

Function MoveAnchorPosition 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 1405 of file footprint.cpp.

1406 {
1407  /* Move the reference point of the footprint
1408  * the footprints elements (pads, outlines, edges .. ) are moved
1409  * but:
1410  * - the footprint position is not modified.
1411  * - the relative (local) coordinates of these items are modified
1412  * - Draw coordinates are updated
1413  */
1414 
1415 
1416  // Update (move) the relative coordinates relative to the new anchor point.
1417  wxPoint moveVector = aMoveVector;
1418  RotatePoint( &moveVector, -GetOrientation() );
1419 
1420  // Update of the reference and value.
1421  m_reference->SetPos0( m_reference->GetPos0() + moveVector );
1423  m_value->SetPos0( m_value->GetPos0() + moveVector );
1424  m_value->SetDrawCoord();
1425 
1426  // Update the pad local coordinates.
1427  for( PAD* pad : m_pads )
1428  {
1429  pad->SetPos0( pad->GetPos0() + moveVector );
1430  pad->SetDrawCoord();
1431  }
1432 
1433  // Update the draw element coordinates.
1434  for( BOARD_ITEM* item : GraphicalItems() )
1435  {
1436  switch( item->Type() )
1437  {
1438  case PCB_FP_SHAPE_T:
1439  {
1440  FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
1441  shape->Move( moveVector );
1442  }
1443  break;
1444 
1445  case PCB_FP_TEXT_T:
1446  {
1447  FP_TEXT* text = static_cast<FP_TEXT*>( item );
1448  text->SetPos0( text->GetPos0() + moveVector );
1449  text->SetDrawCoord();
1450  }
1451  break;
1452 
1453  default:
1454  break;
1455  }
1456  }
1457 
1459 }
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
double GetOrientation() const
Definition: footprint.h:204
void SetDrawCoord()
Set absolute coordinates.
Definition: fp_text.cpp:198
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
FP_TEXT * m_reference
Definition: footprint.h:713
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
FP_TEXT * m_value
Definition: footprint.h:714
DRAWINGS & GraphicalItems()
Definition: footprint.h:185
void SetPos0(const wxPoint &aPos)
Definition: fp_text.h:165
const wxPoint & GetPos0() const
Definition: fp_text.h:166
void Move(const wxPoint &aMoveVector) override
Move an edge of the footprint.
Definition: fp_shape.cpp:284
Definition: pad.h:60
PADS m_pads
Definition: footprint.h:707
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
Definition: footprint.cpp:568

References CalculateBoundingBox(), GetOrientation(), FP_TEXT::GetPos0(), GraphicalItems(), m_pads, m_reference, m_value, FP_SHAPE::Move(), PCB_FP_SHAPE_T, PCB_FP_TEXT_T, RotatePoint(), FP_TEXT::SetDrawCoord(), and FP_TEXT::SetPos0().

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

◆ NeedsPlaced()

bool FOOTPRINT::NeedsPlaced ( ) const
inline

Definition at line 325 of file footprint.h.

325 { return m_fpStatus & FP_to_PLACE; }
int m_fpStatus
Definition: footprint.h:717
#define FP_to_PLACE
In autoplace: footprint waiting for autoplace.
Definition: footprint.h:294

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 185 of file eda_item.cpp.

186 {
187  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
188  GetClass() ) );
189 
190  return false;
191 }
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 302 of file footprint.cpp.

303 {
304  BOARD_ITEM::operator=( aOther );
305 
306  m_pos = aOther.m_pos;
307  m_fpid = aOther.m_fpid;
308  m_attributes = aOther.m_attributes;
309  m_fpStatus = aOther.m_fpStatus;
310  m_orient = aOther.m_orient;
311  m_boundingBox = aOther.m_boundingBox;
312  m_rot90Cost = aOther.m_rot90Cost;
313  m_rot180Cost = aOther.m_rot180Cost;
315  m_link = aOther.m_link;
316  m_path = aOther.m_path;
317 
324  m_thermalGap = aOther.m_thermalGap;
325 
326  // Copy reference and value
327  *m_reference = *aOther.m_reference;
328  m_reference->SetParent( this );
329  *m_value = *aOther.m_value;
330  m_value->SetParent( this );
331 
332  std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
333 
334  // Copy pads
335  m_pads.clear();
336 
337  for( PAD* pad : aOther.Pads() )
338  {
339  PAD* newPad = new PAD( *pad );
340  ptrMap[ pad ] = newPad;
341  Add( newPad );
342  }
343 
344  // Copy zones
345  m_fp_zones.clear();
346 
347  for( FP_ZONE* zone : aOther.Zones() )
348  {
349  FP_ZONE* newZone = static_cast<FP_ZONE*>( zone->Clone() );
350  ptrMap[ zone ] = newZone;
351  Add( newZone );
352 
353  // Ensure the net info is OK and especially uses the net info list
354  // living in the current board
355  // Needed when copying a fp from fp editor that has its own board
356  // Must be NETINFO_LIST::ORPHANED_ITEM for a keepout that has no net.
357  newZone->SetNetCode( -1 );
358  }
359 
360  // Copy drawings
361  m_drawings.clear();
362 
363  for( BOARD_ITEM* item : aOther.GraphicalItems() )
364  {
365  BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() );
366  ptrMap[ item ] = newItem;
367  Add( newItem );
368  }
369 
370  // Copy groups
371  m_fp_groups.clear();
372 
373  for( PCB_GROUP* group : aOther.Groups() )
374  {
375  PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() );
376  const_cast<std::unordered_set<BOARD_ITEM*>*>( &newGroup->GetItems() )->clear();
377 
378  for( BOARD_ITEM* member : group->GetItems() )
379  newGroup->AddItem( ptrMap[ member ] );
380 
381  Add( newGroup );
382  }
383 
384  // Copy auxiliary data: 3D_Drawings info
385  m_3D_Drawings.clear();
386  m_3D_Drawings = aOther.m_3D_Drawings;
387  m_doc = aOther.m_doc;
388  m_keywords = aOther.m_keywords;
389  m_properties = aOther.m_properties;
390 
391  // Ensure auxiliary data is up to date
393 
395  new wxArrayString( *aOther.m_initial_comments ) : nullptr;
396 
397  return *this;
398 }
int m_localSolderPasteMargin
Definition: footprint.h:725
bool AddItem(BOARD_ITEM *aItem)
Adds item to group.
Definition: pcb_group.cpp:38
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:720
double m_localSolderPasteMarginRatio
Definition: footprint.h:726
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
Definition: pcb_group.h:50
double m_orient
Definition: footprint.h:711
timestamp_t m_lastEditTime
Definition: footprint.h:731
bool SetNetCode(int aNetCode, bool aNoAssert)
Sets net using a net code.
FP_TEXT * m_reference
Definition: footprint.h:713
std::unordered_set< BOARD_ITEM * > & GetItems()
Definition: pcb_group.h:68
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:164
int m_rot90Cost
Definition: footprint.h:734
PADS & Pads()
Definition: footprint.h:182
FP_TEXT * m_value
Definition: footprint.h:714
KIID m_link
Definition: footprint.h:733
int m_localSolderMaskMargin
Definition: footprint.h:724
FP_ZONES & Zones()
Definition: footprint.h:188
int m_fpStatus
Definition: footprint.h:717
FP_ZONES m_fp_zones
Definition: footprint.h:708
int m_thermalGap
Definition: footprint.h:722
DRAWINGS & GraphicalItems()
Definition: footprint.h:185
wxPoint m_pos
Definition: footprint.h:712
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
Definition: eda_item.cpp:193
KIID_PATH m_path
Definition: footprint.h:730
FP_GROUPS & Groups()
Definition: footprint.h:191
int m_thermalWidth
Definition: footprint.h:721
wxString m_keywords
Definition: footprint.h:729
int m_localClearance
Definition: footprint.h:723
int m_rot180Cost
Definition: footprint.h:735
LIB_ID m_fpid
Definition: footprint.h:715
DRAWINGS m_drawings
Definition: footprint.h:706
std::map< wxString, wxString > m_properties
Definition: footprint.h:738
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Definition: footprint.cpp:445
wxArrayString * m_initial_comments
Definition: footprint.h:739
Definition: pad.h:60
FP_GROUPS m_fp_groups
Definition: footprint.h:709
wxString m_doc
Definition: footprint.h:728
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:737
FP_ZONE is a specialization of ZONE for use in footprints.
Definition: zone.h:965
PADS m_pads
Definition: footprint.h:707
EDA_RECT m_boundingBox
Definition: footprint.h:718
int m_attributes
Definition: footprint.h:716
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
Definition: footprint.cpp:568

References Add(), PCB_GROUP::AddItem(), CalculateBoundingBox(), PCB_GROUP::GetItems(), GraphicalItems(), Groups(), m_3D_Drawings, m_attributes, m_boundingBox, m_doc, m_drawings, m_fp_groups, m_fp_zones, m_fpid, m_fpStatus, 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_thermalGap, m_thermalWidth, m_value, m_zoneConnection, EDA_ITEM::operator=(), PAD, Pads(), BOARD_CONNECTED_ITEM::SetNetCode(), EDA_ITEM::SetParent(), and Zones().

◆ operator=() [2/2]

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

Definition at line 207 of file footprint.cpp.

208 {
209  BOARD_ITEM::operator=( aOther );
210 
211  m_pos = aOther.m_pos;
212  m_fpid = aOther.m_fpid;
213  m_attributes = aOther.m_attributes;
214  m_fpStatus = aOther.m_fpStatus;
215  m_orient = aOther.m_orient;
216  m_boundingBox = aOther.m_boundingBox;
217  m_rot90Cost = aOther.m_rot90Cost;
218  m_rot180Cost = aOther.m_rot180Cost;
220  m_link = aOther.m_link;
221  m_path = aOther.m_path;
222 
229  m_thermalGap = aOther.m_thermalGap;
230 
231  // Move reference and value
232  m_reference = aOther.m_reference;
233  m_reference->SetParent( this );
234  m_value = aOther.m_value;
235  m_value->SetParent( this );
236 
237 
238  // Move the pads
239  m_pads.clear();
240 
241  for( PAD* pad : aOther.Pads() )
242  Add( pad );
243 
244  aOther.Pads().clear();
245 
246  // Move the zones
247  m_fp_zones.clear();
248 
249  for( FP_ZONE* item : aOther.Zones() )
250  {
251  Add( item );
252 
253  // Ensure the net info is OK and especially uses the net info list
254  // living in the current board
255  // Needed when copying a fp from fp editor that has its own board
256  // Must be NETINFO_LIST::ORPHANED_ITEM for a keepout that has no net.
257  item->SetNetCode( -1 );
258  }
259 
260  aOther.Zones().clear();
261 
262  // Move the drawings
263  m_drawings.clear();
264 
265  for( BOARD_ITEM* item : aOther.GraphicalItems() )
266  Add( item );
267 
268  aOther.GraphicalItems().clear();
269 
270  // Move the groups
271  m_fp_groups.clear();
272 
273  for( PCB_GROUP* group : aOther.Groups() )
274  Add( group );
275 
276  aOther.Groups().clear();
277 
278  // Copy auxiliary data: 3D_Drawings info
279  m_3D_Drawings.clear();
280  m_3D_Drawings = aOther.m_3D_Drawings;
281  m_doc = aOther.m_doc;
282  m_keywords = aOther.m_keywords;
283  m_properties = aOther.m_properties;
284 
285  // Ensure auxiliary data is up to date
287 
289 
290  // Clear the other item's containers since this is a move
291  aOther.Pads().clear();
292  aOther.Zones().clear();
293  aOther.GraphicalItems().clear();
294  aOther.m_value = nullptr;
295  aOther.m_reference = nullptr;
296  aOther.m_initial_comments = nullptr;
297 
298  return *this;
299 }
int m_localSolderPasteMargin
Definition: footprint.h:725
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:720
double m_localSolderPasteMarginRatio
Definition: footprint.h:726
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
Definition: pcb_group.h:50
double m_orient
Definition: footprint.h:711
timestamp_t m_lastEditTime
Definition: footprint.h:731
FP_TEXT * m_reference
Definition: footprint.h:713
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:164
int m_rot90Cost
Definition: footprint.h:734
PADS & Pads()
Definition: footprint.h:182
FP_TEXT * m_value
Definition: footprint.h:714
KIID m_link
Definition: footprint.h:733
int m_localSolderMaskMargin
Definition: footprint.h:724
FP_ZONES & Zones()
Definition: footprint.h:188
int m_fpStatus
Definition: footprint.h:717
FP_ZONES m_fp_zones
Definition: footprint.h:708
int m_thermalGap
Definition: footprint.h:722
DRAWINGS & GraphicalItems()
Definition: footprint.h:185
wxPoint m_pos
Definition: footprint.h:712
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
Definition: eda_item.cpp:193
KIID_PATH m_path
Definition: footprint.h:730
FP_GROUPS & Groups()
Definition: footprint.h:191
int m_thermalWidth
Definition: footprint.h:721
wxString m_keywords
Definition: footprint.h:729
int m_localClearance
Definition: footprint.h:723
int m_rot180Cost
Definition: footprint.h:735
LIB_ID m_fpid
Definition: footprint.h:715
DRAWINGS m_drawings
Definition: footprint.h:706
std::map< wxString, wxString > m_properties
Definition: footprint.h:738
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Definition: footprint.cpp:445
wxArrayString * m_initial_comments
Definition: footprint.h:739
Definition: pad.h:60
FP_GROUPS m_fp_groups
Definition: footprint.h:709
wxString m_doc
Definition: footprint.h:728
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:737
FP_ZONE is a specialization of ZONE for use in footprints.
Definition: zone.h:965
PADS m_pads
Definition: footprint.h:707
EDA_RECT m_boundingBox
Definition: footprint.h:718
int m_attributes
Definition: footprint.h:716
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
Definition: footprint.cpp:568

References Add(), CalculateBoundingBox(), m_3D_Drawings, m_attributes, m_boundingBox, m_doc, m_drawings, m_fp_groups, m_fp_zones, m_fpid, m_fpStatus, 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_thermalGap, m_thermalWidth, m_value, m_zoneConnection, EDA_ITEM::operator=(), and EDA_ITEM::SetParent().

◆ Pads() [1/2]

PADS& FOOTPRINT::Pads ( )
inline

Definition at line 182 of file footprint.h.

182 { return m_pads; }
PADS m_pads
Definition: footprint.h:707

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewComponent(), BOARD_ADAPTER::addPadsWithClearance(), allPadsLocked(), ARRAY_PAD_NAME_PROVIDER::ARRAY_PAD_NAME_PROVIDER(), AR_AUTOPLACER::buildFpAreas(), PCB_GRID_HELPER::computeAnchors(), AR_AUTOPLACER::computePlacementRatsnestCost(), MICROWAVE_TOOL::createFootprint(), MICROWAVE_TOOL::createPolygonShape(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::ExchangeFootprint(), export_vrml_footprint(), PLACEFILE_GERBER_WRITER::findPads1(), FOOTPRINT(), PCB_IO::format(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), FOOTPRINT_EDIT_FRAME::GetDocumentExtents(), GetEffectiveShape(), AR_AUTOPLACER::getOptimalFPPlacement(), CONNECTIVITY_DATA::GetRatsnestForComponent(), CONNECTIVITY_DATA::GetRatsnestForItems(), hash_fp_item(), hashFootprint(), HasThroughHolePads(), idf_export_footprint(), ROUTER_TOOL::InlineDrag(), isCopperOutside(), CADSTAR_PCB_ARCHIVE_LOADER::loadComponents(), EAGLE_PLUGIN::loadElements(), CADSTAR_PCB_ARCHIVE_LOADER::loadNets(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), operator=(), pasteFootprintItemsToFootprintEditor(), BOARD_EDITOR_CONTROL::PlaceModule(), BOARD_EDITOR_CONTROL::RepairBoard(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectAllItemsOnSheet(), DRC_TEST_PROVIDER_LVS::testFootprints(), DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), and BOARD_NETLIST_UPDATER::updateComponentPadConnections().

◆ Pads() [2/2]

const PADS& FOOTPRINT::Pads ( ) const
inline

Definition at line 183 of file footprint.h.

183 { return m_pads; }
PADS m_pads
Definition: footprint.h:707

◆ Reference() [1/2]

◆ Reference() [2/2]

FP_TEXT& FOOTPRINT::Reference ( ) const
inline

Definition at line 487 of file footprint.h.

487 { return *m_reference; }
FP_TEXT * m_reference
Definition: footprint.h:713

◆ Remove()

void FOOTPRINT::Remove ( BOARD_ITEM aItem,
REMOVE_MODE  aMode = REMOVE_MODE::NORMAL 
)
overridevirtual

Implements BOARD_ITEM_CONTAINER.

Definition at line 498 of file footprint.cpp.

499 {
500  switch( aBoardItem->Type() )
501  {
502  case PCB_FP_TEXT_T:
503  // Only user text can be removed this way.
504  wxCHECK_RET(
505  static_cast<FP_TEXT*>( aBoardItem )->GetType() == FP_TEXT::TEXT_is_DIVERS,
506  "Please report this bug: Invalid remove operation on required text" );
508 
509  case PCB_FP_SHAPE_T:
510  for( auto it = m_drawings.begin(); it != m_drawings.end(); ++it )
511  {
512  if( *it == aBoardItem )
513  {
514  m_drawings.erase( it );
515  break;
516  }
517  }
518 
519  break;
520 
521  case PCB_PAD_T:
522  for( auto it = m_pads.begin(); it != m_pads.end(); ++it )
523  {
524  if( *it == static_cast<PAD*>( aBoardItem ) )
525  {
526  m_pads.erase( it );
527  break;
528  }
529  }
530 
531  break;
532 
533  case PCB_FP_ZONE_T:
534  for( auto it = m_fp_zones.begin(); it != m_fp_zones.end(); ++it )
535  {
536  if( *it == static_cast<FP_ZONE*>( aBoardItem ) )
537  {
538  m_fp_zones.erase( it );
539  break;
540  }
541  }
542 
543  break;
544 
545  case PCB_GROUP_T:
546  for( auto it = m_fp_groups.begin(); it != m_fp_groups.end(); ++it )
547  {
548  if( *it == static_cast<PCB_GROUP*>( aBoardItem ) )
549  {
550  m_fp_groups.erase( it );
551  break;
552  }
553  }
554 
555  break;
556 
557  default:
558  {
559  wxString msg;
560  msg.Printf( wxT( "FOOTPRINT::Remove() needs work: BOARD_ITEM type (%d) not handled" ),
561  aBoardItem->Type() );
562  wxFAIL_MSG( msg );
563  }
564  }
565 }
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:708
class ZONE, managed by a footprint
Definition: typeinfo.h:94
DRAWINGS m_drawings
Definition: footprint.h:706
FP_GROUPS m_fp_groups
Definition: footprint.h:709
PADS m_pads
Definition: footprint.h:707

References 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, FP_TEXT::TEXT_is_DIVERS, and EDA_ITEM::Type().

Referenced by BOARD_COMMIT::Push(), EDIT_TOOL::Remove(), and GROUP_TOOL::Ungroup().

◆ Replace() [1/2]

bool EDA_ITEM::Replace ( const wxFindReplaceData &  aSearchData,
wxString &  aText 
)
staticinherited

Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aTextA reference to a wxString object containing the text to be replaced.
Returns
True if aText was modified, otherwise false.

Definition at line 159 of file eda_item.cpp.

160 {
161  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
162 
163  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
164  aSearchData.GetFindString() :
165  aSearchData.GetFindString().Upper() );
166 
167  if( result == wxNOT_FOUND )
168  return false;
169 
170  wxString prefix = aText.Left( result );
171  wxString suffix;
172 
173  if( aSearchData.GetFindString().length() + result < aText.length() )
174  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
175 
176  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
177  aText, prefix, aSearchData.GetReplaceString(), suffix );
178 
179  aText = prefix + aSearchData.GetReplaceString() + suffix;
180 
181  return true;
182 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.

References traceFindReplace.

Referenced by SCH_FIELD::Replace(), EDA_TEXT::Replace(), and SCH_EDITOR_CONTROL::ReplaceAndFindNext().

◆ Replace() [2/2]

virtual bool EDA_ITEM::Replace ( const wxFindReplaceData &  aSearchData,
void *  aAuxData = nullptr 
)
inlinevirtualinherited

Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

This function must be overridden for items that support text replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item text was modified, otherwise false.

Reimplemented in SCH_TEXT, SCH_SHEET_PIN, SCH_FIELD, and SCH_PIN.

Definition at line 440 of file eda_item.h.

441  {
442  return false;
443  }

◆ ResolveTextVar()

bool FOOTPRINT::ResolveTextVar ( wxString *  token,
int  aDepth = 0 
) const

Resolve any references to system tokens supported by the component.

Parameters
aDeptha counter to limit recursion and circular references.

Definition at line 409 of file footprint.cpp.

410 {
411  if( token->IsSameAs( wxT( "REFERENCE" ) ) )
412  {
413  *token = m_reference->GetShownText( aDepth + 1 );
414  return true;
415  }
416  else if( token->IsSameAs( wxT( "VALUE" ) ) )
417  {
418  *token = m_value->GetShownText( aDepth + 1 );
419  return true;
420  }
421  else if( token->IsSameAs( wxT( "LAYER" ) ) )
422  {
423  *token = GetLayerName();
424  return true;
425  }
426  else if( m_properties.count( *token ) )
427  {
428  *token = m_properties.at( *token );
429  return true;
430  }
431 
432  return false;
433 }
FP_TEXT * m_reference
Definition: footprint.h:713
FP_TEXT * m_value
Definition: footprint.h:714
std::map< wxString, wxString > m_properties
Definition: footprint.h:738
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: fp_text.cpp:408
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Definition: board_item.cpp:60

References BOARD_ITEM::GetLayerName(), FP_TEXT::GetShownText(), m_properties, m_reference, and m_value.

Referenced by PCB_TEXT::GetShownText(), and FP_TEXT::GetShownText().

◆ Rotate() [1/2]

void FOOTPRINT::Rotate ( const wxPoint &  aRotCentre,
double  aAngle 
)
overridevirtual

Rotate this object.

Parameters
aRotCentrethe rotation point.
aAnglethe rotation angle in 0.1 degree.

Reimplemented from BOARD_ITEM.

Definition at line 1275 of file footprint.cpp.

1276 {
1277  double orientation = GetOrientation();
1278  double newOrientation = orientation + aAngle;
1279  wxPoint newpos = m_pos;
1280  RotatePoint( &newpos, aRotCentre, aAngle );
1281  SetPosition( newpos );
1282  SetOrientation( newOrientation );
1283 
1284  m_reference->KeepUpright( orientation, newOrientation );
1285  m_value->KeepUpright( orientation, newOrientation );
1286 
1287  for( BOARD_ITEM* item : m_drawings )
1288  {
1289  if( item->Type() == PCB_FP_TEXT_T )
1290  static_cast<FP_TEXT*>( item )->KeepUpright( orientation, newOrientation );
1291  }
1292 
1294 }
void KeepUpright(double aOldOrientation, double aNewOrientation)
Called when rotating the parent footprint.
Definition: fp_text.cpp:101
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
double GetOrientation() const
Definition: footprint.h:204
FP_TEXT * m_reference
Definition: footprint.h:713
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
FP_TEXT * m_value
Definition: footprint.h:714
void SetOrientation(double aNewAngle)
Definition: footprint.cpp:1462
wxPoint m_pos
Definition: footprint.h:712
DRAWINGS m_drawings
Definition: footprint.h:706
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1362
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
Definition: footprint.cpp:568

References CalculateBoundingBox(), GetOrientation(), FP_TEXT::KeepUpright(), m_drawings, m_pos, m_reference, m_value, PCB_FP_TEXT_T, RotatePoint(), SetOrientation(), and SetPosition().

Referenced by Flip(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow().

◆ Rotate() [2/2]

void BOARD_ITEM::Rotate ( const VECTOR2I aRotCentre,
double  aAngle 
)
inlineinherited

Definition at line 299 of file board_item.h.

300  {
301  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
302  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotate this object.
Definition: board_item.h:294

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

◆ RunOnChildren()

void FOOTPRINT::RunOnChildren ( const std::function< void(BOARD_ITEM *)> &  aFunction) const

Function RunOnChildren.

Invokes a function on all BOARD_ITEMs that belong to the footprint (pads, drawings, texts). Note that this function should not add or remove items to the footprint

Parameters
aFunctionis the function to be invoked.

Definition at line 1104 of file footprint.cpp.

1105