KiCad PCB EDA Suite
MODULE Class Reference

#include <class_module.h>

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

Public Member Functions

 MODULE (BOARD *parent)
 
 MODULE (const MODULE &aModule)
 
 ~MODULE ()
 
MODULEoperator= (const MODULE &aOther)
 
void Add (BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
 

More...
 
void Remove (BOARD_ITEM *aItem) 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() Returns the area of the module footprint excluding any text. 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 GetBoundingPoly () const
 Returns a bounding polygon for the shapes and pads in the module This operation is slower but more accurate than calculating a bounding box. More...
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox returns 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 MODULE_ZONE_CONTAINERS & Zones () const
 
const DRAWINGS & GraphicalItems () const
 
bool HasNonSMDPins () const
 
std::list< MODULE_3D_SETTINGS > & Models ()
 
const std::list< MODULE_3D_SETTINGS > & Models () const
 
void SetPosition (const wxPoint &aPos) override
 
wxPoint GetPosition () const override
 
void SetOrientation (double newangle)
 
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 (wxString *aSource=nullptr) const
 
void SetLocalClearance (int aClearance)
 
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
 Function Move move this object. More...
 
void Rotate (const wxPoint &aRotCentre, double aAngle) override
 Function Rotate Rotate this object. More...
 
void Flip (const wxPoint &aCentre, bool aFlipLeftRight) override
 Function Flip 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 IsLocked () const override
 Function IsLocked. More...
 
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 PadsLocked () const
 
void SetPadsLocked (bool aPadsLocked)
 
void SetLastEditTime (timestamp_t aTime)
 
void SetLastEditTime ()
 
timestamp_t GetLastEditTime () const
 
void TransformPadsShapesWithClearanceToPolygon (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, int aMaxError=ARC_HIGH_DEF, bool aSkipNPTHPadsWihNoCopper=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 TransformGraphicShapesWithClearanceToPolygonSet (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, int aError=ARC_HIGH_DEF, bool aIncludeText=true, bool aIncludeEdges=true) const
 function TransformGraphicShapesWithClearanceToPolygonSet 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 TransformGraphicTextWithClearanceToPolygonSet (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, int aError=ARC_HIGH_DEF) const
 TransformGraphicTextWithClearanceToPolygonSet 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
 Function HitTest tests 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 module. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
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...
 
TEXTE_MODULEValue ()
 read/write accessors: More...
 
TEXTE_MODULEReference ()
 
TEXTE_MODULEValue () const
 The const versions to keep the compiler happy. More...
 
TEXTE_MODULEReference () const
 
D_PADFindPadByName (const wxString &aPadName) const
 Function FindPadByName returns a D_PAD* with a matching name. More...
 
D_PADGetPad (const wxPoint &aPosition, LSET aLayerMask=LSET::AllLayersMask())
 Function GetPad get a pad at aPosition on aLayerMask in the footprint. More...
 
D_PADGetTopLeftPad ()
 
D_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 module. 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_ITEMDuplicateItem (const BOARD_ITEM *aItem, bool aAddToModule=false)
 Function DuplicateItem Duplicate a given item within the module, optionally adding it to the board. More...
 
void Add3DModel (MODULE_3D_SETTINGS *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
 Function Visit 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
 Function GetClass returns the class name. More...
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAP_DEF GetMenuImage () const override
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
EDA_ITEMClone () const override
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
void RunOnChildren (const std::function< void(BOARD_ITEM *)> &aFunction)
 Function RunOnChildren. More...
 
void GetAllDrawingLayers (int aLayers[], int &aCount, bool aIncludePads=true) const
 Returns a set of all layers that this module has drawings on similar to ViewGetLayers() More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
virtual unsigned int ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
void 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 ()
 
bool BuildPolyCourtyard ()
 Builds a complex polygon of the courtyard area from graphic items on the courtyard layer. 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...
 
int GetX () const
 
int GetY () const
 
virtual wxPoint GetCenter () const
 Function GetCenter() More...
 
void SetX (int aX)
 
void SetY (int aY)
 
virtual bool IsConnected () const
 Function IsConnected() 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
 Function GetLayer returns the primary layer this item is on. More...
 
virtual LSET GetLayerSet () const
 Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segment or VIA physically resides. More...
 
virtual void SetLayer (PCB_LAYER_ID aLayer)
 Function SetLayer sets the layer this item is on. More...
 
BOARD_ITEMDuplicate () const
 Function Duplicate creates a copy of a BOARD_ITEM. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID aLayer) const
 Function IsOnLayer tests to see if this object is on the given layer. More...
 
bool IsTrack () const
 Function IsTrack tests to see if this object is a track or via (or microvia). More...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after removing from its parent if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
virtual BOARDGetBoard () const
 Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
wxString GetLayerName () const
 Function GetLayerName returns the name of the PCB layer on which the item resides. More...
 
virtual void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aError=ARC_LOW_DEF, bool ignoreLineWidth=false) const
 Function TransformShapeWithClearanceToPolygon Convert the item shape to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments. More...
 
KICAD_T Type () const
 Function Type() 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 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)
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual const wxPoint GetFocusPosition () const
 Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
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 wxString ShowShape (STROKE_T aShape)
 Function ShowShape converts the enum STROKE_T integer value to a wxString. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
static bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

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

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

Static Protected Member Functions

static wxString LayerMaskDescribe (const BOARD *aBoard, LSET aMask)
 Helper function Return a string (to be shown to the user) describing a layer mask. More...
 

Protected Attributes

PCB_LAYER_ID m_Layer
 
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
 
MODULE_ZONE_CONTAINERS m_fp_zones
 
std::list< MODULE_3D_SETTINGSm_3D_Drawings
 
double m_Orient
 
wxPoint m_Pos
 
TEXTE_MODULEm_Reference
 
TEXTE_MODULEm_Value
 
LIB_ID m_fpid
 
int m_Attributs
 
int m_ModuleStatus
 
EDA_RECT m_BoundaryBox
 
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_KeyWord
 
KIID_PATH m_Path
 
timestamp_t m_LastEditTime
 
int m_arflag
 
KIID m_Link
 
int m_CntRot90
 
int m_CntRot180
 
wxArrayString * m_initial_comments
 leading s-expression comments in the module, lazily allocated only if needed for speed More...
 
SHAPE_POLY_SET m_poly_courtyard_front
 Used in DRC to test the courtyard area (a polygon which can be not basic Note also a footprint can have courtyards on both board sides. More...
 
SHAPE_POLY_SET m_poly_courtyard_back
 

Detailed Description

Definition at line 105 of file class_module.h.

Constructor & Destructor Documentation

◆ MODULE() [1/2]

MODULE::MODULE ( BOARD parent)

Definition at line 39 of file class_module.cpp.

39  :
42 {
44  m_Layer = F_Cu;
45  m_Orient = 0;
47  m_arflag = 0;
48  m_CntRot90 = m_CntRot180 = 0;
49  m_Link = 0;
50  m_LastEditTime = 0;
51  m_LocalClearance = 0;
55  m_ZoneConnection = ZONE_CONNECTION::INHERITED; // Use zone setting by default
56  m_ThermalWidth = 0; // Use zone setting by default
57  m_ThermalGap = 0; // Use zone setting by default
58 
59  // These are special and mandatory text fields
62 
63  m_3D_Drawings.clear();
64 }
int m_CntRot90
Definition: class_module.h:705
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
int m_ThermalWidth
Definition: class_module.h:692
double m_LocalSolderPasteMarginRatio
Definition: class_module.h:697
int m_LocalSolderPasteMargin
Definition: class_module.h:696
int m_ThermalGap
Definition: class_module.h:693
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed
Definition: class_module.h:708
#define MODULE_PADS_LOCKED
In autoplace: module waiting for autoplace.
Definition: class_module.h:294
timestamp_t m_LastEditTime
Definition: class_module.h:702
int m_LocalClearance
Definition: class_module.h:694
PCB_LAYER_ID m_Layer
double m_Orient
Definition: class_module.h:682
class MODULE, a footprint
Definition: typeinfo.h:89
ZONE_CONNECTION m_ZoneConnection
Definition: class_module.h:691
int m_LocalSolderMaskMargin
Definition: class_module.h:695
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Definition: class_module.h:680
int m_arflag
Definition: class_module.h:703
default
Definition: class_module.h:67
int m_CntRot180
Definition: class_module.h:706
int m_ModuleStatus
Definition: class_module.h:688
TEXTE_MODULE * m_Value
Definition: class_module.h:685
TEXTE_MODULE * m_Reference
Definition: class_module.h:684
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
KIID m_Link
Definition: class_module.h:704
int m_Attributs
Definition: class_module.h:687

References F_Cu, INHERITED, m_3D_Drawings, m_arflag, m_Attributs, m_CntRot180, m_CntRot90, m_LastEditTime, BOARD_ITEM::m_Layer, m_Link, m_LocalClearance, m_LocalSolderMaskMargin, m_LocalSolderPasteMargin, m_LocalSolderPasteMarginRatio, m_ModuleStatus, m_Orient, m_Reference, m_ThermalGap, m_ThermalWidth, m_Value, m_ZoneConnection, MOD_DEFAULT, MODULE_PADS_LOCKED, TEXTE_MODULE::TEXT_is_REFERENCE, and TEXTE_MODULE::TEXT_is_VALUE.

Referenced by Clone().

◆ MODULE() [2/2]

MODULE::MODULE ( const MODULE aModule)

Definition at line 67 of file class_module.cpp.

67  :
68  BOARD_ITEM_CONTAINER( aModule )
69 {
70  m_Pos = aModule.m_Pos;
71  m_fpid = aModule.m_fpid;
72  m_Attributs = aModule.m_Attributs;
74  m_Orient = aModule.m_Orient;
75  m_BoundaryBox = aModule.m_BoundaryBox;
76  m_CntRot90 = aModule.m_CntRot90;
77  m_CntRot180 = aModule.m_CntRot180;
79  m_Link = aModule.m_Link;
80  m_Path = aModule.m_Path;
81 
88  m_ThermalGap = aModule.m_ThermalGap;
89 
90  // Copy reference and value.
91  m_Reference = new TEXTE_MODULE( *aModule.m_Reference );
92  m_Reference->SetParent( this );
93  m_Value = new TEXTE_MODULE( *aModule.m_Value );
94  m_Value->SetParent( this );
95 
96  // Copy auxiliary data: Pads
97  for( D_PAD* pad : aModule.Pads() )
98  Add( new D_PAD( *pad ) );
99 
100  // Copy auxiliary data: Zones
101  for( MODULE_ZONE_CONTAINER* item : aModule.Zones() )
102  {
103  Add( static_cast<MODULE_ZONE_CONTAINER*>( item->Clone() ) );
104 
105  // Ensure the net info is OK and especially uses the net info list
106  // living in the current board
107  // Needed when copying a fp from fp editor that has its own board
108  // Must be NETINFO_LIST::ORPHANED_ITEM for a keepout that has no net.
109  item->SetNetCode( -1 );
110  }
111 
112  // Copy auxiliary data: Drawings
113  for( BOARD_ITEM* item : aModule.GraphicalItems() )
114  {
115  switch( item->Type() )
116  {
117  case PCB_MODULE_TEXT_T:
118  case PCB_MODULE_EDGE_T:
119  Add( static_cast<BOARD_ITEM*>( item->Clone() ) );
120  break;
121 
122  default:
123  wxLogMessage( wxT( "Class MODULE copy constructor internal error: unknown type" ) );
124  break;
125  }
126  }
127 
128  // Copy auxiliary data: 3D_Drawings info
129  m_3D_Drawings = aModule.m_3D_Drawings;
130 
131  m_Doc = aModule.m_Doc;
132  m_KeyWord = aModule.m_KeyWord;
133 
134  m_arflag = 0;
135 
136  // Ensure auxiliary data is up to date
138 
140  new wxArrayString( *aModule.m_initial_comments ) : nullptr;
141 }
LIB_ID m_fpid
Definition: class_module.h:686
int m_CntRot90
Definition: class_module.h:705
wxString m_KeyWord
Definition: class_module.h:700
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
int m_ThermalWidth
Definition: class_module.h:692
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
double m_LocalSolderPasteMarginRatio
Definition: class_module.h:697
int m_LocalSolderPasteMargin
Definition: class_module.h:696
int m_ThermalGap
Definition: class_module.h:693
PADS & Pads()
Definition: class_module.h:169
KIID_PATH m_Path
Definition: class_module.h:701
DRAWINGS & GraphicalItems()
Definition: class_module.h:179
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed
Definition: class_module.h:708
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
virtual void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:196
wxString m_Doc
Definition: class_module.h:699
timestamp_t m_LastEditTime
Definition: class_module.h:702
int m_LocalClearance
Definition: class_module.h:694
double m_Orient
Definition: class_module.h:682
EDA_RECT m_BoundaryBox
Definition: class_module.h:689
ZONE_CONNECTION m_ZoneConnection
Definition: class_module.h:691
int m_LocalSolderMaskMargin
Definition: class_module.h:695
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Definition: class_module.h:680
int m_arflag
Definition: class_module.h:703
const MODULE_ZONE_CONTAINERS & Zones() const
Definition: class_module.h:184
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
int m_CntRot180
Definition: class_module.h:706
int m_ModuleStatus
Definition: class_module.h:688
TEXTE_MODULE * m_Value
Definition: class_module.h:685
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:952
wxPoint m_Pos
Definition: class_module.h:683
TEXTE_MODULE * m_Reference
Definition: class_module.h:684
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
KIID m_Link
Definition: class_module.h:704
int m_Attributs
Definition: class_module.h:687

References Add(), CalculateBoundingBox(), GraphicalItems(), m_3D_Drawings, m_arflag, m_Attributs, m_BoundaryBox, m_CntRot180, m_CntRot90, m_Doc, m_fpid, m_initial_comments, m_KeyWord, m_LastEditTime, m_Link, m_LocalClearance, m_LocalSolderMaskMargin, m_LocalSolderPasteMargin, m_LocalSolderPasteMarginRatio, m_ModuleStatus, m_Orient, m_Path, m_Pos, m_Reference, m_ThermalGap, m_ThermalWidth, m_Value, m_ZoneConnection, Pads(), PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, EDA_ITEM::SetParent(), and Zones().

◆ ~MODULE()

MODULE::~MODULE ( )

Definition at line 144 of file class_module.cpp.

145 {
146  // Clean up the owned elements
147  delete m_Reference;
148  delete m_Value;
149  delete m_initial_comments;
150 
151  for( D_PAD* p : m_pads )
152  delete p;
153 
154  m_pads.clear();
155 
157  delete p;
158 
159  m_fp_zones.clear();
160 
161  for( BOARD_ITEM* d : m_drawings )
162  delete d;
163 
164  m_drawings.clear();
165 }
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PADS m_pads
Definition: class_module.h:678
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed
Definition: class_module.h:708
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:679
DRAWINGS m_drawings
Definition: class_module.h:677
TEXTE_MODULE * m_Value
Definition: class_module.h:685
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:952
TEXTE_MODULE * m_Reference
Definition: class_module.h:684

References m_drawings, m_fp_zones, m_initial_comments, m_pads, m_Reference, and m_Value.

Member Function Documentation

◆ Add()

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

Implements BOARD_ITEM_CONTAINER.

Definition at line 288 of file class_module.cpp.

289 {
290  switch( aBoardItem->Type() )
291  {
292  case PCB_MODULE_TEXT_T:
293  // Only user text can be added this way.
294  assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS );
296 
297  case PCB_MODULE_EDGE_T:
298  if( aMode == ADD_MODE::APPEND )
299  m_drawings.push_back( aBoardItem );
300  else
301  m_drawings.push_front( aBoardItem );
302  break;
303 
304  case PCB_PAD_T:
305  if( aMode == ADD_MODE::APPEND )
306  m_pads.push_back( static_cast<D_PAD*>( aBoardItem ) );
307  else
308  m_pads.push_front( static_cast<D_PAD*>( aBoardItem ) );
309  break;
310 
312  if( aMode == ADD_MODE::APPEND )
313  m_fp_zones.push_back( static_cast<MODULE_ZONE_CONTAINER*>( aBoardItem ) );
314  else
315  m_fp_zones.insert( m_fp_zones.begin(), static_cast<MODULE_ZONE_CONTAINER*>( aBoardItem ) );
316  break;
317 
318  default:
319  {
320  wxString msg;
321  msg.Printf( wxT( "MODULE::Add() needs work: BOARD_ITEM type (%d) not handled" ),
322  aBoardItem->Type() );
323  wxFAIL_MSG( msg );
324 
325  return;
326  }
327  }
328 
329  aBoardItem->ClearEditFlags();
330  aBoardItem->SetParent( this );
331 }
#define KI_FALLTHROUGH
PADS m_pads
Definition: class_module.h:678
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:679
DRAWINGS m_drawings
Definition: class_module.h:677
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95

References APPEND, EDA_ITEM::ClearEditFlags(), KI_FALLTHROUGH, m_drawings, m_fp_zones, m_pads, PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, PCB_MODULE_ZONE_AREA_T, PCB_PAD_T, EDA_ITEM::SetParent(), TEXTE_MODULE::TEXT_is_DIVERS, and EDA_ITEM::Type().

Referenced by PCAD2KICAD::PCB_LINE::AddToModule(), PCAD2KICAD::PCB_ARC::AddToModule(), PCAD2KICAD::PCB_PAD::AddToModule(), PCAD2KICAD::PCB_POLYGON::AddToModule(), MICROWAVE_TOOL::createBaseFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), MICROWAVE_TOOL::createPolygonShape(), KI_TEST::DrawArc(), KI_TEST::DrawSegment(), DuplicateItem(), PCB_EDIT_FRAME::Exchange_Module(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), ALTIUM_PCB::HelperCreateAndAddDrawsegment(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadMODULE_EDGE(), LEGACY_PLUGIN::loadPAD(), MODULE(), 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_BOARD_EDITOR::TransferDataFromWindow().

◆ Add3DModel()

void MODULE::Add3DModel ( MODULE_3D_SETTINGS a3DModel)

Function Add3DModel adds a3DModel definition to the end of the 3D model list.

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

Definition at line 752 of file class_module.cpp.

753 {
754  if( NULL == a3DModel )
755  return;
756 
757  if( !a3DModel->m_Filename.empty() )
758  m_3D_Drawings.push_back( *a3DModel );
759 
760  delete a3DModel;
761 }
#define NULL
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Definition: class_module.h:680
wxString m_Filename
The 3D shape filename in 3D library.
Definition: class_module.h:96

References m_3D_Drawings, MODULE_3D_SETTINGS::m_Filename, and NULL.

◆ BuildPolyCourtyard()

bool MODULE::BuildPolyCourtyard ( )

Builds a complex polygon of the courtyard area from graphic items on the courtyard layer.

Returns
true if OK, or no courtyard defined, false only if the polygon cannot be built due to a malformed courtyard shape

Definition at line 1450 of file class_module.cpp.

1451 {
1454  // Build the courtyard area from graphic items on the courtyard.
1455  // Only PCB_MODULE_EDGE_T have meaning, graphic texts are ignored.
1456  // Collect items:
1457  std::vector< DRAWSEGMENT* > list_front;
1458  std::vector< DRAWSEGMENT* > list_back;
1459 
1460  for( auto item : GraphicalItems() )
1461  {
1462  if( item->GetLayer() == B_CrtYd && item->Type() == PCB_MODULE_EDGE_T )
1463  list_back.push_back( static_cast< DRAWSEGMENT* > ( item ) );
1464 
1465  if( item->GetLayer() == F_CrtYd && item->Type() == PCB_MODULE_EDGE_T )
1466  list_front.push_back( static_cast< DRAWSEGMENT* > ( item ) );
1467  }
1468 
1469  // Note: if no item found on courtyard layers, return true.
1470  // false is returned only when the shape defined on courtyard layers
1471  // is not convertible to a polygon
1472  if( !list_front.size() && !list_back.size() )
1473  return true;
1474 
1475  wxString error_msg;
1476 
1477  #define ARC_ERROR_MAX 0.02 /* error max in mm to approximate a arc by segments */
1478  bool success = ConvertOutlineToPolygon( list_front, m_poly_courtyard_front,
1479  &error_msg,
1480  (unsigned) Millimeter2iu( ARC_ERROR_MAX ) );
1481 
1482  if( success )
1483  {
1484  success = ConvertOutlineToPolygon( list_back, m_poly_courtyard_back,
1485  &error_msg,
1486  (unsigned) Millimeter2iu( ARC_ERROR_MAX ) );
1487  }
1488 
1489  if( !error_msg.IsEmpty() )
1490  {
1491  wxLogMessage( wxString::Format( _( "Processing courtyard of \"%s\": %s" ),
1492  GetChars( GetFPID().Format() ),
1493  error_msg) );
1494  }
1495 
1496  return success;
1497 }
SHAPE_POLY_SET m_poly_courtyard_back
Definition: class_module.h:714
bool ConvertOutlineToPolygon(std::vector< DRAWSEGMENT * > &aSegList, SHAPE_POLY_SET &aPolygons, wxString *aErrorText, unsigned int aTolerance, wxPoint *aErrorLocation=nullptr)
Function ConvertOutlineToPolygon build a polygon (with holes) from a DRAWSEGMENT list,...
const LIB_ID & GetFPID() const
Definition: class_module.h:215
#define ARC_ERROR_MAX
DRAWINGS & GraphicalItems()
Definition: class_module.h:179
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
SHAPE_POLY_SET m_poly_courtyard_front
Used in DRC to test the courtyard area (a polygon which can be not basic Note also a footprint can ha...
Definition: class_module.h:713
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.

References _, ARC_ERROR_MAX, B_CrtYd, ConvertOutlineToPolygon(), F_CrtYd, Format(), GetChars(), GetFPID(), GraphicalItems(), m_poly_courtyard_back, m_poly_courtyard_front, PCB_MODULE_EDGE_T, and SHAPE_POLY_SET::RemoveAllContours().

Referenced by AR_AUTOPLACER::buildFpAreas().

◆ CalculateBoundingBox()

◆ ClassOf()

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

Definition at line 116 of file class_module.h.

117  {
118  return aItem && PCB_MODULE_T == aItem->Type();
119  }
class MODULE, a footprint
Definition: typeinfo.h:89
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References PCB_MODULE_T, and EDA_ITEM::Type().

◆ ClearAllNets()

void MODULE::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 279 of file class_module.cpp.

280 {
281  // Force the ORPHANED dummy net info for all pads.
282  // ORPHANED dummy net does not depend on a board
283  for( auto pad : m_pads )
284  pad->SetNetCode( NETINFO_LIST::ORPHANED );
285 }
PADS m_pads
Definition: class_module.h:678
static const int ORPHANED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:480

References m_pads, and NETINFO_LIST::ORPHANED.

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

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 233 of file base_struct.h.

233 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceModule(), LIB_PIN_TOOL::PlacePin(), DRAWING_TOOL::PlaceText(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::RollbackPartFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 245 of file base_struct.h.

246  {
248  DO_NOT_DRAW );
249  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:114
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:125
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:128
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:127
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:123
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:233
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:129
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:122

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 154 of file view_item.h.

155  {
157  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:162
#define NULL

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

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

◆ Clone()

EDA_ITEM * MODULE::Clone ( ) const
overridevirtual

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

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

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Definition at line 862 of file class_module.cpp.

863 {
864  return new MODULE( *this );
865 }
MODULE(BOARD *parent)

References MODULE().

Referenced by FOOTPRINT_EDIT_FRAME::AddModuleToBoard(), BOARD_NETLIST_UPDATER::updateComponentPadConnections(), and BOARD_NETLIST_UPDATER::updateComponentParameters().

◆ CoverageRatio()

double MODULE::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 1391 of file class_module.cpp.

1392 {
1393  double moduleArea = GetFootprintRect().GetArea();
1394  SHAPE_POLY_SET coveredRegion;
1395  addRect( coveredRegion, GetFootprintRect() );
1396 
1397  // build list of holes (covered areas not available for selection)
1398  SHAPE_POLY_SET holes;
1399 
1400  for( auto pad : m_pads )
1401  addRect( holes, pad->GetBoundingBox() );
1402 
1403  addRect( holes, m_Reference->GetBoundingBox() );
1404  addRect( holes, m_Value->GetBoundingBox() );
1405 
1406  for( int i = 0; i < aCollector.GetCount(); ++i )
1407  {
1408  BOARD_ITEM* item = aCollector[i];
1409 
1410  switch( item->Type() )
1411  {
1412  case PCB_TEXT_T:
1413  case PCB_MODULE_TEXT_T:
1414  case PCB_TRACE_T:
1415  case PCB_ARC_T:
1416  case PCB_VIA_T:
1417  addRect( holes, item->GetBoundingBox() );
1418  break;
1419  default:
1420  break;
1421  }
1422  }
1423 
1424  SHAPE_POLY_SET uncoveredRegion;
1425 
1426  try
1427  {
1428  uncoveredRegion.BooleanSubtract( coveredRegion, holes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1429  uncoveredRegion.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1430  uncoveredRegion.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1431  }
1432  catch( ClipperLib::clipperException& )
1433  {
1434  // better to be conservative (this will result in the disambiguate dialog)
1435  return 1.0;
1436  }
1437 
1438  double uncoveredRegionArea = polygonArea( uncoveredRegion );
1439  double coveredArea = moduleArea - uncoveredRegionArea;
1440  double ratio = ( coveredArea / moduleArea );
1441 
1442  return std::min( ratio, 1.0 );
1443 }
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
static double polygonArea(SHAPE_POLY_SET &aPolySet)
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
PADS m_pads
Definition: class_module.h:678
EDA_RECT GetFootprintRect() const
Function GetFootprintRect() Returns the area of the module footprint excluding any text.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:101
static void addRect(SHAPE_POLY_SET &aPolySet, wxRect aRect)
SHAPE_POLY_SET.
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
double GetArea() const
Function GetArea returns the area of the rectangle.
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
TEXTE_MODULE * m_Value
Definition: class_module.h:685
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
TEXTE_MODULE * m_Reference
Definition: class_module.h:684
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset difference For aFastMode meaning, see function booleanOp
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: base_struct.cpp:97
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References addRect(), SHAPE_POLY_SET::BooleanSubtract(), SHAPE_POLY_SET::Fracture(), EDA_RECT::GetArea(), TEXTE_MODULE::GetBoundingBox(), EDA_ITEM::GetBoundingBox(), COLLECTOR::GetCount(), GetFootprintRect(), m_pads, m_Reference, m_Value, PCB_ARC_T, PCB_MODULE_TEXT_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, polygonArea(), SHAPE_POLY_SET::Simplify(), and EDA_ITEM::Type().

◆ Delete()

virtual void BOARD_ITEM_CONTAINER::Delete ( BOARD_ITEM aItem)
inlinevirtualinherited

Removes an item from the container and deletes it.

Definition at line 66 of file board_item_container.h.

67  {
68  Remove( aItem );
69  delete aItem;
70  }
virtual void Remove(BOARD_ITEM *aItem)=0
Removes an item from the container.

References BOARD_ITEM_CONTAINER::Remove().

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

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 124 of file class_board_item.cpp.

125 {
126  auto parent = GetParent();
127 
128  if( parent )
129  parent->Remove( this );
130 
131  delete this;
132 }
BOARD_ITEM_CONTAINER * GetParent() const

References BOARD_ITEM::GetParent().

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

◆ Duplicate()

BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlineinherited

Function Duplicate creates a copy of a BOARD_ITEM.

Definition at line 193 of file class_board_item.h.

194  {
195  EDA_ITEM* dupe = Clone();
196  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
197 
198  return static_cast<BOARD_ITEM*>( dupe );
199  }
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: common.h:68
const KIID m_Uuid
Definition: base_struct.h:162
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

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

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), EDIT_TOOL::Duplicate(), GPCB_PLUGIN::FootprintLoad(), PCB_IO::FootprintLoad(), PCB_IO::FootprintSave(), ARRAY_CREATOR::Invoke(), and FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD().

◆ DuplicateItem()

BOARD_ITEM * MODULE::DuplicateItem ( const BOARD_ITEM aItem,
bool  aAddToModule = false 
)

Function DuplicateItem Duplicate a given item within the module, optionally adding it to the board.

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

Definition at line 1260 of file class_module.cpp.

1261 {
1262  BOARD_ITEM* new_item = NULL;
1263  MODULE_ZONE_CONTAINER* new_zone = NULL;
1264 
1265  switch( aItem->Type() )
1266  {
1267  case PCB_PAD_T:
1268  {
1269  D_PAD* new_pad = new D_PAD( *static_cast<const D_PAD*>( aItem ) );
1270 
1271  if( aAddToModule )
1272  m_pads.push_back( new_pad );
1273 
1274  new_item = new_pad;
1275  break;
1276  }
1277 
1279  {
1280  new_zone = new MODULE_ZONE_CONTAINER( *static_cast<const MODULE_ZONE_CONTAINER*>( aItem ) );
1281 
1282  if( aAddToModule )
1283  m_fp_zones.push_back( new_zone );
1284 
1285  new_item = new_zone;
1286  break;
1287  }
1288 
1289  case PCB_MODULE_TEXT_T:
1290  {
1291  TEXTE_MODULE* new_text = new TEXTE_MODULE( *static_cast<const TEXTE_MODULE*>( aItem ) );
1292 
1293  if( new_text->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
1294  {
1295  new_text->SetText( wxT( "${REFERENCE}" ) );
1297  }
1298  else if( new_text->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
1299  {
1300  new_text->SetText( wxT( "${VALUE}" ) );
1302  }
1303 
1304  if( aAddToModule )
1305  Add( new_text );
1306 
1307  new_item = new_text;
1308 
1309  break;
1310  }
1311 
1312  case PCB_MODULE_EDGE_T:
1313  {
1314  EDGE_MODULE* new_edge = new EDGE_MODULE( *static_cast<const EDGE_MODULE*>(aItem) );
1315 
1316  if( aAddToModule )
1317  Add( new_edge );
1318 
1319  new_item = new_edge;
1320  break;
1321  }
1322 
1323  case PCB_MODULE_T:
1324  // Ignore the module itself
1325  break;
1326 
1327  default:
1328  // Un-handled item for duplication
1329  wxFAIL_MSG( "Duplication not supported for items of class " + aItem->GetClass() );
1330  break;
1331  }
1332 
1333  return new_item;
1334 }
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PADS m_pads
Definition: class_module.h:678
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
class MODULE, a footprint
Definition: typeinfo.h:89
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:116
#define NULL
TEXT_TYPE GetType() const
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:679
void SetType(TEXT_TYPE aType)
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
virtual wxString GetClass() const =0
Function GetClass returns the class name.
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:952
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References Add(), EDA_ITEM::GetClass(), TEXTE_MODULE::GetType(), m_fp_zones, m_pads, NULL, PCB_MODULE_EDGE_T, PCB_MODULE_T, PCB_MODULE_TEXT_T, PCB_MODULE_ZONE_AREA_T, PCB_PAD_T, EDA_TEXT::SetText(), TEXTE_MODULE::SetType(), TEXTE_MODULE::TEXT_is_DIVERS, TEXTE_MODULE::TEXT_is_REFERENCE, TEXTE_MODULE::TEXT_is_VALUE, and EDA_ITEM::Type().

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

◆ FindPadByName()

D_PAD * MODULE::FindPadByName ( const wxString &  aPadName) const

Function FindPadByName returns a D_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
D_PAD* - The first matching name is returned, or NULL if not found.

Definition at line 653 of file class_module.cpp.

654 {
655  for( D_PAD* pad : m_pads )
656  {
657  if( pad->GetName() == aPadName )
658  return pad;
659  }
660 
661  return NULL;
662 }
PADS m_pads
Definition: class_module.h:678
#define NULL

References m_pads, and NULL.

Referenced by PCB_EDIT_FRAME::Exchange_Module(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), and BOARD_NETLIST_UPDATER::testConnectivity().

◆ Flip() [1/2]

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

Function Flip Flip this object, i.e.

change the board side for this object

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

Mirror the Y position (around the X axis)

Reimplemented from BOARD_ITEM.

Definition at line 1052 of file class_module.cpp.

1053 {
1054  // Move module to its final position:
1055  wxPoint finalPos = m_Pos;
1056 
1057  // Now Flip the footprint.
1058  // Flipping a footprint is a specific transform:
1059  // it is not mirrored like a text.
1060  // We have to change the side, and ensure the footprint rotation is
1061  // modified accordint to the transform, because this parameter is used
1062  // in pick and place files, and when updating the footprint from library.
1063  // When flipped around the X axis (Y coordinates changed) orientation is negated
1064  // When flipped around the Y axis (X coordinates changed) orientation is 180 - old orient.
1065  // Because it is specfic to a footprint, we flip around the X axis, and after rotate 180 deg
1066 
1067  MIRROR( finalPos.y, aCentre.y );
1068 
1069  SetPosition( finalPos );
1070 
1071  // Flip layer
1072  SetLayer( FlipLayer( GetLayer() ) );
1073 
1074  // Reverse mirror orientation.
1075  m_Orient = -m_Orient;
1076 
1078 
1079  // Mirror pads to other side of board.
1080  for( auto pad : m_pads )
1081  pad->Flip( m_Pos, false );
1082 
1083  // Mirror zones to other side of board.
1084  for( auto zone : m_fp_zones )
1085  zone->Flip( m_Pos, aFlipLeftRight );
1086 
1087  // Mirror reference and value.
1088  m_Reference->Flip( m_Pos, false );
1089  m_Value->Flip( m_Pos, false );
1090 
1091  // Reverse mirror module graphics and texts.
1092  for( auto item : m_drawings )
1093  {
1094  switch( item->Type() )
1095  {
1096  case PCB_MODULE_EDGE_T:
1097  static_cast<EDGE_MODULE*>( item )->Flip( m_Pos, false );
1098  break;
1099 
1100  case PCB_MODULE_TEXT_T:
1101  static_cast<TEXTE_MODULE*>( item )->Flip( m_Pos, false );
1102  break;
1103 
1104  default:
1105  wxMessageBox( wxT( "MODULE::Flip() error: Unknown Draw Type" ) );
1106  break;
1107  }
1108  }
1109 
1110  // Now rotate 180 deg if required
1111  if( aFlipLeftRight )
1112  Rotate( aCentre, 1800.0 );
1113 
1115 }
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:485
PADS m_pads
Definition: class_module.h:678
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:354
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
double m_Orient
Definition: class_module.h:682
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:175
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:679
void SetPosition(const wxPoint &aPos) override
DRAWINGS m_drawings
Definition: class_module.h:677
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip entity during module flip.
TEXTE_MODULE * m_Value
Definition: class_module.h:685
wxPoint m_Pos
Definition: class_module.h:683
TEXTE_MODULE * m_Reference
Definition: class_module.h:684
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

References CalculateBoundingBox(), TEXTE_MODULE::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_MODULE_EDGE_T, PCB_MODULE_TEXT_T, Rotate(), BOARD_ITEM::SetLayer(), SetPosition(), and wxPoint::y.

Referenced by PCB_BASE_FRAME::AddModuleToBoard(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), EAGLE_PLUGIN::orientModuleAndText(), PCB_EDITOR_CONTROL::PlaceModule(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

◆ Flip() [2/2]

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

Definition at line 309 of file class_board_item.h.

310  {
311  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
312  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Function Flip Flip this object, i.e.

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

◆ 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:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
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:58
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(), 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:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
Provides class metadata.
Definition: property_mgr.h:58
T get(void *aObject)
Definition: property.h:271
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:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Returns a property for a specific type.
Provides class metadata.
Definition: property_mgr.h:58
T get(void *aObject)
Definition: property.h:271
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 MODULE::GetAllDrawingLayers ( int  aLayers[],
int &  aCount,
bool  aIncludePads = true 
) const

Returns a set of all layers that this module 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 891 of file class_module.cpp.

892 {
893  std::unordered_set<int> layers;
894 
895  for( BOARD_ITEM* item : m_drawings )
896  layers.insert( static_cast<int>( item->GetLayer() ) );
897 
898  if( aIncludePads )
899  {
900  for( D_PAD* pad : m_pads )
901  {
902  int pad_layers[KIGFX::VIEW::VIEW_MAX_LAYERS], pad_layers_count;
903  pad->ViewGetLayers( pad_layers, pad_layers_count );
904 
905  for( int i = 0; i < pad_layers_count; i++ )
906  layers.insert( pad_layers[i] );
907  }
908  }
909 
910  aCount = layers.size();
911  int i = 0;
912 
913  for( int layer : layers )
914  aLayers[i++] = layer;
915 }
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PADS m_pads
Definition: class_module.h:678
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:701
DRAWINGS m_drawings
Definition: class_module.h:677

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

◆ GetArea()

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

Definition at line 398 of file class_module.cpp.

399 {
400  double w = std::abs( m_BoundaryBox.GetWidth() ) + aPadding;
401  double h = std::abs( m_BoundaryBox.GetHeight() ) + aPadding;
402  return w * h;
403 }
int GetWidth() const
Definition: eda_rect.h:119
EDA_RECT m_BoundaryBox
Definition: class_module.h:689
int GetHeight() const
Definition: eda_rect.h:120

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

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

◆ GetAttributes()

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 54 of file class_board_item.cpp.

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

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

Referenced by D_PAD::BuildEffectiveShapes(), ZONE_CONTAINER::BuildSmoothedPoly(), test::DRC_TEST_PROVIDER_CLEARANCE_BASE::checkClearanceSegmToPad(), TEXTE_PCB::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), BOARD_ITEM::GetBoard(), GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), BOARD_ITEM::GetLayerName(), VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), GetRule(), VIA::GetSelectMenuText(), D_PAD::GetSelectMenuText(), ZONE_CONTAINER::GetSelectMenuText(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), TRACK::GetWidthConstraints(), D_PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD_CONNECTED_ITEM::SetNet(), BOARD_CONNECTED_ITEM::SetNetCode(), ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(), ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(), ViewBBox(), and D_PAD::ViewGetLOD().

◆ GetBoundingBox() [1/2]

const EDA_RECT MODULE::GetBoundingBox ( ) const
overridevirtual

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

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

Reimplemented from EDA_ITEM.

Definition at line 452 of file class_module.cpp.

453 {
454  EDA_RECT area = GetFootprintRect();
455 
456  // Add in items not collected by GetFootprintRect():
457  for( BOARD_ITEM* item : m_drawings )
458  {
459  if( item->Type() != PCB_MODULE_EDGE_T )
460  area.Merge( item->GetBoundingBox() );
461  }
462 
463  area.Merge( m_Value->GetBoundingBox() );
464  area.Merge( m_Reference->GetBoundingBox() );
465 
466  return area;
467 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
EDA_RECT GetFootprintRect() const
Function GetFootprintRect() Returns the area of the module footprint excluding any text.
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
DRAWINGS m_drawings
Definition: class_module.h:677
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
TEXTE_MODULE * m_Value
Definition: class_module.h:685
TEXTE_MODULE * m_Reference
Definition: class_module.h:684

References TEXTE_MODULE::GetBoundingBox(), GetFootprintRect(), m_drawings, m_Reference, m_Value, EDA_RECT::Merge(), and PCB_MODULE_EDGE_T.

Referenced by AR_AUTOPLACER::buildFpAreas(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), and HitTest().

◆ GetBoundingBox() [2/2]

const EDA_RECT MODULE::GetBoundingBox ( bool  aIncludeInvisibleText) const

Definition at line 470 of file class_module.cpp.

471 {
472  EDA_RECT area = GetFootprintRect();
473 
474  // Add in items not collected by GetFootprintRect():
475  for( BOARD_ITEM* item : m_drawings )
476  {
477  if( item->Type() != PCB_MODULE_EDGE_T )
478  area.Merge( item->GetBoundingBox() );
479  }
480 
481  if( m_Value->IsVisible() || aIncludeInvisibleText )
482  area.Merge( m_Value->GetBoundingBox() );
483 
484  if( m_Reference->IsVisible() || aIncludeInvisibleText )
485  area.Merge( m_Reference->GetBoundingBox() );
486 
487  return area;
488 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
bool IsVisible() const
Definition: eda_text.h:185
EDA_RECT GetFootprintRect() const
Function GetFootprintRect() Returns the area of the module footprint excluding any text.
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
DRAWINGS m_drawings
Definition: class_module.h:677
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
TEXTE_MODULE * m_Value
Definition: class_module.h:685
TEXTE_MODULE * m_Reference
Definition: class_module.h:684

References TEXTE_MODULE::GetBoundingBox(), GetFootprintRect(), EDA_TEXT::IsVisible(), m_drawings, m_Reference, m_Value, EDA_RECT::Merge(), and PCB_MODULE_EDGE_T.

◆ GetBoundingPoly()

SHAPE_POLY_SET MODULE::GetBoundingPoly ( ) const

Returns a bounding polygon for the shapes and pads in the module This operation is slower but more accurate than calculating a bounding box.

This is a bit hacky right now for performance reasons.

We assume that most footprints will have features aligned to the axes in the zero-rotation state. Therefore, if the footprint is rotated, we temporarily rotate back to zero, get the bounding box (excluding reference and value text) and then rotate the resulting poly back to the correct orientation.

This is more accurate than using the AABB when most footprints are rotated off of the axes, but less accurate than computing some kind of bounding hull. We should consider doing that instead at some point in the future if we can use a performant algorithm and cache the result to avoid extra computing.

Definition at line 505 of file class_module.cpp.

506 {
507  SHAPE_POLY_SET poly;
508 
509  double orientation = GetOrientationRadians();
510 
511  MODULE temp = *this;
512  temp.SetOrientation( 0.0 );
513  BOX2I area = temp.GetFootprintRect();
514 
515  poly.NewOutline();
516 
517  VECTOR2I p = area.GetPosition();
518  poly.Append( p );
519  p.x = area.GetRight();
520  poly.Append( p );
521  p.y = area.GetBottom();
522  poly.Append( p );
523  p.x = area.GetX();
524  poly.Append( p );
525 
526  BOARD* board = GetBoard();
527  if( board )
528  {
529  int biggest_clearance = board->GetDesignSettings().GetBiggestClearanceValue();
530  poly.Inflate( biggest_clearance, 4 );
531  }
532 
533  poly.Inflate( Millimeter2iu( 0.01 ), 4 );
534  poly.Rotate( -orientation, m_Pos );
535 
536  return poly;
537 }
coord_type GetX() const
Definition: box2.h:189
int GetBiggestClearanceValue()
Function GetBiggestClearanceValue.
coord_type GetRight() const
Definition: box2.h:198
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
EDA_RECT GetFootprintRect() const
Function GetFootprintRect() Returns the area of the module footprint excluding any text.
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Function Rotate rotates all vertices by a given angle.
coord_type GetBottom() const
Definition: box2.h:199
void Inflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Performs outline inflation/deflation.
BOX2 handles a 2-D bounding box, built on top of an origin point and size vector, both of templated c...
Definition: box2.h:42
SHAPE_POLY_SET.
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
double GetOrientationRadians() const
Definition: class_module.h:213
int NewOutline()
Creates a new empty polygon in the set and returns its index
const Vec & GetPosition() const
Definition: box2.h:193
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
void SetOrientation(double newangle)
wxPoint m_Pos
Definition: class_module.h:683
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

References SHAPE_POLY_SET::Append(), BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue(), BOARD_ITEM::GetBoard(), BOX2< Vec >::GetBottom(), BOARD::GetDesignSettings(), GetFootprintRect(), GetOrientationRadians(), BOX2< Vec >::GetPosition(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), SHAPE_POLY_SET::Inflate(), m_Pos, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::Rotate(), SetOrientation(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by HitTestAccurate().

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

Function GetCenter()

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

Returns
centre point of the item

Reimplemented in DRAWSEGMENT.

Definition at line 120 of file class_board_item.h.

120 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: base_struct.h:337

References EDA_ITEM::GetPosition().

Referenced by BOARD_ADAPTER::createNewTrack(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), KIGFX::PCB_PAINTER::draw(), export_vrml_tracks(), PlotStandardLayer(), and TRACK::TransformShapeWithClearanceToPolygon().

◆ GetClass()

wxString MODULE::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 572 of file class_module.h.

573  {
574  return wxT( "MODULE" );
575  }

Referenced by Visit().

◆ GetContextualTextVars()

void MODULE::GetContextualTextVars ( wxArrayString *  aVars) const

Return the list of system text vars for this footprint.

Definition at line 249 of file class_module.cpp.

250 {
251  aVars->push_back( wxT( "REFERENCE" ) );
252  aVars->push_back( wxT( "VALUE" ) );
253  aVars->push_back( wxT( "LAYER" ) );
254 }

◆ GetDescription()

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 237 of file base_struct.h.

238  {
239  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
241 
242  return m_Flags & mask;
243  }
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:126
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: base_struct.h:130
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

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(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_COMPONENT::GetMsgPanelInfo(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_EDIT_PIN::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), and SCH_EDIT_FRAME::TrimWire().

◆ GetFirstPad()

D_PAD* MODULE::GetFirstPad ( ) const
inline

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

Returns
first pad or null pointer

Definition at line 505 of file class_module.h.

506  {
507  return m_pads.empty() ? nullptr : m_pads.front();
508  }
PADS m_pads
Definition: class_module.h:678

Referenced by GetTopLeftPad().

◆ GetFlag()

int MODULE::GetFlag ( ) const
inline

Definition at line 260 of file class_module.h.

260 { return m_arflag; }
int m_arflag
Definition: class_module.h:703

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

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in DRAWSEGMENT, and TRACK.

Definition at line 344 of file base_struct.h.

344 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: base_struct.h:337

References EDA_ITEM::GetPosition().

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

◆ GetFootprintRect()

EDA_RECT MODULE::GetFootprintRect ( ) const

Function GetFootprintRect() Returns the area of the module footprint excluding any text.

Returns
EDA_RECT - The rectangle containing the footprint.

Definition at line 406 of file class_module.cpp.

407 {
408  EDA_RECT area;
409 
410  area.SetOrigin( m_Pos );
411  area.SetEnd( m_Pos );
412  area.Inflate( Millimeter2iu( 0.25 ) ); // Give a min size to the area
413 
414  for( BOARD_ITEM* item : m_drawings )
415  {
416  if( item->Type() == PCB_MODULE_EDGE_T )
417  area.Merge( item->GetBoundingBox() );
418  }
419 
420  for( D_PAD* pad : m_pads )
421  area.Merge( pad->GetBoundingBox() );
422 
423  for( MODULE_ZONE_CONTAINER* zone : m_fp_zones )
424  area.Merge( zone->GetBoundingBox() );
425 
426  return area;
427 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
PADS m_pads
Definition: class_module.h:678
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
void SetEnd(int x, int y)
Definition: eda_rect.h:192
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:679
DRAWINGS m_drawings
Definition: class_module.h:677
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:952
wxPoint m_Pos
Definition: class_module.h:683
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

References EDA_RECT::Inflate(), m_drawings, m_fp_zones, m_pads, m_Pos, EDA_RECT::Merge(), PCB_MODULE_EDGE_T, EDA_RECT::SetEnd(), and EDA_RECT::SetOrigin().

Referenced by CalculateBoundingBox(), CoverageRatio(), GetBoundingBox(), GetBoundingPoly(), FOOTPRINT_EDIT_FRAME::GetDocumentExtents(), AR_AUTOPLACER::getOptimalModulePlacement(), moveFootprintsInArea(), SELECTION_TOOL::pickSmallestComponent(), SpreadFootprints(), AR_AUTOPLACER::testModuleOnBoard(), and ViewBBox().

◆ GetFPID()

const LIB_ID& MODULE::GetFPID ( ) const
inline

Definition at line 215 of file class_module.h.

215 { return m_fpid; }
LIB_ID m_fpid
Definition: class_module.h:686

Referenced by FOOTPRINT_EDIT_FRAME::AddModuleToBoard(), BASIC_FOOTPRINT_INFO::BASIC_FOOTPRINT_INFO(), BuildPolyCourtyard(), CreateDevicesSection(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), doPushPadProperties(), FOOTPRINT_EDIT_FRAME::editFootprintProperties(), PCB_EDIT_FRAME::Exchange_Module(), FOOTPRINT_EDIT_FRAME::Export_Module(), PCB_IO::FootprintSave(), FP_LIB_TABLE::FootprintSave(), PCB_IO::format(), PLACE_FILE_EXPORTER::GenPositionData(), FOOTPRINT_EDIT_FRAME::GetLoadedFPID(), PCB_EDIT_FRAME::InstallFootprintPropertiesDialog(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), PCB_EDIT_FRAME::LoadFootprints(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadMODULE_EDGE(), LEGACY_PLUGIN::loadPAD(), DSN::SPECCTRA_DB::makeIMAGE(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_EDITOR_TOOLS::PasteFootprint(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), DIALOG_EXCHANGE_FOOTPRINTS::processModule(), BOARD_NETLIST_UPDATER::replaceComponent(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), setLibNickname(), BOARD_NETLIST_UPDATER::testConnectivity(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), PCBNEW_CONTROL::UpdateMessagePanel(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetFpPadsLocalBbox()

EDA_RECT MODULE::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 430 of file class_module.cpp.

431 {
432  EDA_RECT area;
433 
434  // We want the bounding box of the footprint pads at rot 0, not flipped
435  // Create such a image:
436  MODULE dummy( *this );
437 
438  dummy.SetPosition( wxPoint( 0, 0 ) );
439  if( dummy.IsFlipped() )
440  dummy.Flip( wxPoint( 0, 0 ) , false );
441 
442  if( dummy.GetOrientation() )
443  dummy.SetOrientation( 0 );
444 
445  for( auto pad : dummy.Pads() )
446  area.Merge( pad->GetBoundingBox() );
447 
448  return area;
449 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

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

◆ GetInitialComments()

const wxArrayString* MODULE::GetInitialComments ( ) const
inline

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

Definition at line 655 of file class_module.h.

655 { return m_initial_comments; }
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed
Definition: class_module.h:708

Referenced by PCB_IO::format().

◆ GetKeywords()

◆ GetLastEditTime()

timestamp_t MODULE::GetLastEditTime ( ) const
inline

Definition at line 345 of file class_module.h.

345 { return m_LastEditTime; }
timestamp_t m_LastEditTime
Definition: class_module.h:702

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

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Function GetLayer returns the primary layer this item is on.

Reimplemented in ZONE_CONTAINER.

Definition at line 165 of file class_board_item.h.

165 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer(), DIMENSION::AdjustDimensionDetails(), GRAPHICS_CLEANER::areEquivalent(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), AR_AUTOPLACER::buildFpAreas(), TRACKS_CLEANER::cleanupSegments(), CreateBoardSection(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewModule(), CreateRoutesSection(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), DRC::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::Exchange_Module(), export_vrml_drawsegment(), export_vrml_edge_module(), export_vrml_module(), export_vrml_pcbtext(), export_vrml_text_module(), export_vrml_tracks(), PCB_TARGET::Flip(), TEXTE_PCB::Flip(), EDGE_MODULE::Flip(), TRACK::Flip(), TEXTE_MODULE::Flip(), DIMENSION::Flip(), Flip(), DRAWSEGMENT::Flip(), ARC::Flip(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::formatLayer(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), BOARD_CONNECTED_ITEM::GetClearance(), ZONE_CONTAINER::GetLayer(), test::DRC_TEST_PROVIDER_CLEARANCE_BASE::getLocation(), DRC::GetLocation(), getMatchingTextItem(), AR_AUTOPLACER::getOptimalModulePlacement(), BOARD::GetPad(), TEXT_MOD_GRID_TABLE::GetValueAsLong(), SELECTION_TOOL::GuessSelectionCandidates(), idf_export_module(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), D_PAD::IsFlipped(), BOARD_ITEM::IsOnCopperLayer(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), MODULE_DESC::MODULE_DESC(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), EAGLE_PLUGIN::packagePad(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotDrawSegment(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintGraphicItems(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotTextePcb(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), PAD_TOOL::recombinePad(), 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(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), DRC::testCopperDrawItem(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperTextAndGraphics(), DRC::testCopperTextAndGraphics(), DRC::testDisabledLayers(), AR_AUTOPLACER::testModuleOnBoard(), TEXTE_MODULE::TEXTE_MODULE(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), BOARD_ADAPTER::transformGraphicModuleEdgeToPolygonSet(), TransformGraphicShapesWithClearanceToPolygonSet(), TRACK::ViewGetLayers(), TEXTE_MODULE::ViewGetLayers(), TEXTE_MODULE::ViewGetLOD(), MODULE_ZONE_CONTAINER::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

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

Returns
wxString containing the layer name associated with this item.

Definition at line 68 of file class_board_item.cpp.

69 {
70  BOARD* board = GetBoard();
71 
72  if( board )
73  return board->GetLayerName( m_Layer );
74 
75  // If no parent, return standard name
77 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
PCB_LAYER_ID m_Layer
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:648

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

Referenced by PCB_IO::format(), PCB_IO::formatLayer(), TEXTE_PCB::GetMsgPanelInfo(), TEXTE_MODULE::GetMsgPanelInfo(), DRAWSEGMENT::GetMsgPanelInfo(), TEXTE_PCB::GetSelectMenuText(), EDGE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), TRACK::GetSelectMenuText(), DIMENSION::GetSelectMenuText(), DRAWSEGMENT::GetSelectMenuText(), GetSelectMenuText(), TEXTE_PCB::GetShownText(), TEXT_MOD_GRID_TABLE::GetValue(), ResolveTextVar(), and DRC::testDisabledLayers().

◆ GetLayerSet()

virtual LSET BOARD_ITEM::GetLayerSet ( ) const
inlinevirtualinherited

Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segment or VIA physically resides.

Returns
int - a layer mask, see layers_id_colors_visibility.h.

Reimplemented in VIA, D_PAD, and ZONE_CONTAINER.

Definition at line 173 of file class_board_item.h.

173 { return LSET( m_Layer ); }
PCB_LAYER_ID m_Layer
LSET is a set of PCB_LAYER_IDs.

References BOARD_ITEM::m_Layer.

Referenced by GRID_HELPER::BestSnapAnchor(), build_pad_testpoints(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), DRC::doTrackDrc(), DRAWING_TOOL::DrawVia(), GetRule(), and hash_board_item().

◆ GetLink()

◆ GetLocalClearance()

int MODULE::GetLocalClearance ( wxString *  aSource = nullptr) const
inline

Definition at line 230 of file class_module.h.

231  {
232  if( aSource )
233  *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
234 
235  return m_LocalClearance;
236  }
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:433
int m_LocalClearance
Definition: class_module.h:694
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33

References _, and Format().

Referenced by PCB_IO::format(), D_PAD::GetLocalClearanceOverrides(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow().

◆ GetLocalSolderMaskMargin()

int MODULE::GetLocalSolderMaskMargin ( ) const
inline

◆ GetLocalSolderPasteMargin()

◆ GetLocalSolderPasteMarginRatio()

double MODULE::GetLocalSolderPasteMarginRatio ( ) const
inline

◆ GetMenuImage()

BITMAP_DEF MODULE::GetMenuImage ( ) const
overridevirtual

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

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

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 856 of file class_module.cpp.

857 {
858  return module_xpm;
859 }
const BITMAP_OPAQUE module_xpm[1]
Definition: module.cpp:29

References module_xpm.

◆ GetMsgPanelInfo()

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

Reimplemented from EDA_ITEM.

Definition at line 540 of file class_module.cpp.

541 {
542  wxString msg, msg2;
543 
544  aList.emplace_back( m_Reference->GetShownText(), m_Value->GetShownText(), DARKCYAN );
545 
546  if( aFrame->IsType( FRAME_FOOTPRINT_VIEWER )
548  || aFrame->IsType( FRAME_FOOTPRINT_EDITOR ) )
549  {
550  wxDateTime date( static_cast<time_t>( m_LastEditTime ) );
551 
552  // Date format: see http://www.cplusplus.com/reference/ctime/strftime
553  if( m_LastEditTime && date.IsValid() )
554  msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year
555  else
556  msg = _( "Unknown" );
557 
558  aList.emplace_back( _( "Last Change" ), msg, BROWN );
559  }
560  else if( aFrame->IsType( FRAME_PCB_EDITOR ) )
561  {
562  aList.emplace_back( _( "Board Side" ), IsFlipped() ? _( "Back (Flipped)" )
563  : _( "Front" ), RED );
564  }
565 
566  msg = wxT( ". ." );
567 
568  if( IsLocked() )
569  msg[0] = 'L';
570 
572  msg[2] = 'P';
573 
574  aList.emplace_back( _( "Status" ), msg, MAGENTA );
575 
576  // Controls on right side of the dialog
577  switch( m_Attributs & 255 )
578  {
579  case 0: msg = _( "Normal" ); break;
580  case MOD_CMS: msg = _( "Insert" ); break;
581  case MOD_VIRTUAL: msg = _( "Virtual" ); break;
582  default: msg = wxT( "???" ); break;
583  }
584 
585  aList.emplace_back( _( "Attributes" ), msg, BROWN );
586 
587  msg.Printf( "%.2f", GetOrientationDegrees() );
588  aList.emplace_back( _( "Rotation" ), msg, BROWN );
589 
590  msg.Printf( _( "Footprint: %s" ),
591  GetChars( m_fpid.Format().c_str() ) );
592  msg2.Printf( _( "3D-Shape: %s" ),
593  m_3D_Drawings.empty() ? _( "none" ) : m_3D_Drawings.front().m_Filename );
594  aList.emplace_back( msg, msg2, BLUE );
595 
596  msg.Printf( _( "Doc: %s" ), m_Doc );
597  msg2.Printf( _( "Keywords: %s" ), m_KeyWord );
598  aList.emplace_back( msg, msg2, BLACK );
599 }
LIB_ID m_fpid
Definition: class_module.h:686
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:288
wxString m_KeyWord
Definition: class_module.h:700
Set for modules listed in the automatic insertion list (usually SMD footprints)
Definition: class_module.h:68
Definition: color4d.h:61
Definition: color4d.h:44
wxString m_Doc
Definition: class_module.h:699
timestamp_t m_LastEditTime
Definition: class_module.h:702
const char * c_str() const
Definition: utf8.h:107
#define MODULE_is_PLACED
In autoplace: module automatically placed.
Definition: class_module.h:292
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Definition: class_module.h:680
double GetOrientationDegrees() const
Definition: class_module.h:212
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:297
Definition: color4d.h:59
UTF8 Format() const
Definition: lib_id.cpp:237
Definition: color4d.h:56
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
int m_ModuleStatus
Definition: class_module.h:688
Virtual component: when created by copper shapes on board (Like edge card connectors,...
Definition: class_module.h:70
TEXTE_MODULE * m_Value
Definition: class_module.h:685
TEXTE_MODULE * m_Reference
Definition: class_module.h:684
int m_Attributs
Definition: class_module.h:687

References _, BLACK, BLUE, BROWN, UTF8::c_str(), DARKCYAN, LIB_ID::Format(), FRAME_FOOTPRINT_EDITOR, FRAME_FOOTPRINT_VIEWER, FRAME_FOOTPRINT_VIEWER_MODAL, FRAME_PCB_EDITOR, GetChars(), GetOrientationDegrees(), TEXTE_MODULE::GetShownText(), IsFlipped(), IsLocked(), EDA_BASE_FRAME::IsType(), m_3D_Drawings, m_Attributs, m_Doc, m_fpid, m_KeyWord, m_LastEditTime, m_ModuleStatus, m_Reference, m_Value, MAGENTA, MOD_CMS, MOD_VIRTUAL, MODULE_is_PLACED, and RED.

Referenced by DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel().

◆ GetNextPadName()

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

Function GetNextPadName returns the next available pad name in the module.

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 1337 of file class_module.cpp.

1338 {
1339  std::set<wxString> usedNames;
1340 
1341  // Create a set of used pad numbers
1342  for( D_PAD* pad : m_pads )
1343  usedNames.insert( pad->GetName() );
1344 
1345  wxString prefix = UTIL::GetReferencePrefix( aLastPadName );
1346  int num = GetTrailingInt( aLastPadName );
1347 
1348  while( usedNames.count( wxString::Format( "%s%d", prefix, num ) ) )
1349  num++;
1350 
1351  return wxString::Format( "%s%d", prefix, num );
1352 }
PADS m_pads
Definition: class_module.h:678
wxString GetReferencePrefix(const wxString &aRefDes)
Get the (non-numeric) prefix from a refdes - e.g.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
int GetTrailingInt(const wxString &aStr)
Gets the trailing int, if any, from a string.
Definition: string.cpp:684

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

Referenced by EDIT_TOOL::Duplicate().

◆ GetOrientation()

◆ GetOrientationDegrees()

double MODULE::GetOrientationDegrees ( ) const
inline

◆ GetOrientationRadians()

double MODULE::GetOrientationRadians ( ) const
inline

Definition at line 213 of file class_module.h.

213 { return m_Orient * M_PI / 1800; }
double m_Orient
Definition: class_module.h:682

Referenced by export_vrml_edge_module(), and GetBoundingPoly().

◆ GetPad()

D_PAD * MODULE::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 D_PAD object if found otherwise NULL.

Definition at line 665 of file class_module.cpp.

666 {
667  for( D_PAD* pad : m_pads )
668  {
669  // ... and on the correct layer.
670  if( !( pad->GetLayerSet() & aLayerMask ).any() )
671  continue;
672 
673  if( pad->HitTest( aPosition ) )
674  return pad;
675  }
676 
677  return NULL;
678 }
PADS m_pads
Definition: class_module.h:678
#define NULL

References m_pads, and NULL.

◆ GetPadCount()

unsigned MODULE::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 700 of file class_module.cpp.

701 {
702  if( aIncludeNPTH )
703  return m_pads.size();
704 
705  unsigned cnt = 0;
706 
707  for( D_PAD* pad : m_pads )
708  {
709  if( pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
710  continue;
711 
712  cnt++;
713  }
714 
715  return cnt;
716 }
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
PADS m_pads
Definition: class_module.h:678

References m_pads, and PAD_ATTRIB_HOLE_NOT_PLATED.

Referenced by BASIC_FOOTPRINT_INFO::BASIC_FOOTPRINT_INFO(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), FOOTPRINT_INFO_IMPL::load(), sortFootprintsByComplexity(), AR_AUTOPLACER::testModuleOnBoard(), and PCBNEW_CONTROL::UpdateMessagePanel().

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 159 of file class_board_item.h.

159 { return (BOARD_ITEM_CONTAINER*) m_Parent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
Abstract interface for BOARD_ITEMs capable of storing other items inside.

References EDA_ITEM::m_Parent.

Referenced by POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), 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(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), EditToolSelectionFilter(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), MARKER_PCB::GetColorLayer(), EDGE_MODULE::GetMsgPanelInfo(), EDGE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), TEXTE_PCB::GetShownText(), TEXTE_MODULE::GetShownText(), SELECTION_TOOL::GuessSelectionCandidates(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), SwapItemData(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), DRC::testCopperDrawItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), MARKER_PCB::ViewGetLayers(), MODULE_ZONE_CONTAINER::ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetPath()

◆ GetPlacementCost180()

int MODULE::GetPlacementCost180 ( ) const
inline

◆ GetPlacementCost90()

int MODULE::GetPlacementCost90 ( ) const
inline

◆ GetPolyCourtyardBack()

SHAPE_POLY_SET& MODULE::GetPolyCourtyardBack ( )
inline

Definition at line 661 of file class_module.h.

661 { return m_poly_courtyard_back; }
SHAPE_POLY_SET m_poly_courtyard_back
Definition: class_module.h:714

Referenced by AR_AUTOPLACER::buildFpAreas(), and DRC_COURTYARD_TESTER::RunDRC().

◆ GetPolyCourtyardFront()

SHAPE_POLY_SET& MODULE::GetPolyCourtyardFront ( )
inline

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

Returns
the courtyard polygon

Definition at line 660 of file class_module.h.

660 { return m_poly_courtyard_front; }
SHAPE_POLY_SET m_poly_courtyard_front
Used in DRC to test the courtyard area (a polygon which can be not basic Note also a footprint can ha...
Definition: class_module.h:713

Referenced by AR_AUTOPLACER::buildFpAreas(), and DRC_COURTYARD_TESTER::RunDRC().

◆ GetPosition()

wxPoint MODULE::GetPosition ( ) const
inlineoverridevirtual

Reimplemented from EDA_ITEM.

Definition at line 206 of file class_module.h.

206 { return m_Pos; }
wxPoint m_Pos
Definition: class_module.h:683

Referenced by PCB_BASE_FRAME::AddModuleToBoard(), PCAD2KICAD::PCB_PAD::AddToModule(), GRID_HELPER::computeAnchors(), ConvertOutlineToPolygon(), MICROWAVE_TOOL::createBaseFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), D_PAD::D_PAD(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::Exchange_Module(), export_vrml_edge_module(), export_vrml_module(), PCB_IO::FootprintSave(), PCB_IO::format(), DSN::SPECCTRA_DB::FromBOARD(), EDIT_TOOL::GetAndPlace(), DRAWSEGMENT::GetBoundingBox(), AR_AUTOPLACER::getOptimalModulePlacement(), DRAWSEGMENT::GetRectCorners(), hash_eda(), idf_export_module(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), LEGACY_PLUGIN::loadPAD(), moveFootprintsInArea(), EAGLE_PLUGIN::orientModuleAndText(), EAGLE_PLUGIN::packageHole(), EAGLE_PLUGIN::packageText(), ALTIUM_PCB::ParseComponentsBodies6Data(), PCB_EDITOR_CONTROL::PlaceModule(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), C3D_RENDER_OGL_LEGACY::render_3D_module(), CLIPBOARD_IO::SaveSelection(), DRAWING_TOOL::SetAnchor(), EDGE_MODULE::SetDrawCoord(), TEXTE_MODULE::SetDrawCoord(), D_PAD::SetDrawCoord(), EDGE_MODULE::SetLocalCoord(), TEXTE_MODULE::SetLocalCoord(), D_PAD::SetLocalCoord(), SetOrientation(), TEXTE_MODULE::TEXTE_MODULE(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), EAGLE_PLUGIN::transferPad(), and DRAWSEGMENT::TransformShapeWithClearanceToPolygon().

◆ GetReference()

const wxString MODULE::GetReference ( void  ) const
inline

Function GetReference.

Returns
const wxString& - the reference designator text.

Definition at line 433 of file class_module.h.

434  {
435  return m_Reference->GetText();
436  }
TEXTE_MODULE * m_Reference
Definition: class_module.h:684
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:126

Referenced by AR_AUTOPLACER::AutoplaceModules(), CollisionMatchesExpected(), DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange(), GERBER_WRITER::createDrillFile(), PCB_BASE_FRAME::CreateNewModule(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), BOARD::FindModuleByReference(), FormatProbeItem(), DSN::SPECCTRA_DB::FromBOARD(), PLACE_FILE_EXPORTER::GenReportData(), EDGE_MODULE::GetMsgPanelInfo(), TEXTE_MODULE::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), GetSelectMenuText(), getShapeName(), idf_export_module(), IncrementReference(), DIALOG_PAD_PROPERTIES::initValues(), GENERAL_COLLECTOR::Inspect(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), EAGLE_PLUGIN::loadElements(), MODULE_DESC::MODULE_DESC(), ALTIUM_PCB::ParsePads6Data(), pasteModuleItemsToModEdit(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotPad(), DIALOG_EXCHANGE_FOOTPRINTS::processModule(), BOARD_NETLIST_UPDATER::replaceComponent(), TestFootprints(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), BOARD_NETLIST_UPDATER::updateComponentPadConnections(), BOARD_NETLIST_UPDATER::updateComponentParameters(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetSelectMenuText()

wxString MODULE::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 845 of file class_module.cpp.

846 {
847  wxString reference = GetReference();
848 
849  if( reference.IsEmpty() )
850  reference = _( "<no reference designator>" );
851 
852  return wxString::Format( _( "Footprint %s on %s" ), reference, GetLayerName() );
853 }
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:433
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.

References _, Format(), BOARD_ITEM::GetLayerName(), and GetReference().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 216 of file base_struct.h.

217  {
218  return m_Status & type;
219  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by TRACK::GetMsgPanelInfoBase_Common(), and TRACK::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

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

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetThermalGap()

int MODULE::GetThermalGap ( ) const
inline

Definition at line 253 of file class_module.h.

253 { return m_ThermalGap; }
int m_ThermalGap
Definition: class_module.h:693

Referenced by PCB_IO::format(), D_PAD::GetThermalGap(), and MODULE_DESC::MODULE_DESC().

◆ GetThermalWidth()

int MODULE::GetThermalWidth ( ) const
inline

Definition at line 250 of file class_module.h.

250 { return m_ThermalWidth; }
int m_ThermalWidth
Definition: class_module.h:692

Referenced by PCB_IO::format(), D_PAD::GetThermalWidth(), and MODULE_DESC::MODULE_DESC().

◆ GetTopLeftPad()

D_PAD * MODULE::GetTopLeftPad ( )

Definition at line 681 of file class_module.cpp.

682 {
683  D_PAD* topLeftPad = GetFirstPad();
684 
685  for( D_PAD* p : m_pads )
686  {
687  wxPoint pnt = p->GetPosition(); // GetPosition() returns the center of the pad
688 
689  if( ( pnt.x < topLeftPad->GetPosition().x ) ||
690  ( topLeftPad->GetPosition().x == pnt.x && pnt.y < topLeftPad->GetPosition().y ) )
691  {
692  topLeftPad = p;
693  }
694  }
695 
696  return topLeftPad;
697 }
wxPoint GetPosition() const override
Definition: class_pad.h:162
PADS m_pads
Definition: class_module.h:678
D_PAD * GetFirstPad() const
Gets the first pad in the list or NULL if none.
Definition: class_module.h:505

References GetFirstPad(), D_PAD::GetPosition(), m_pads, wxPoint::x, and wxPoint::y.

◆ GetUniquePadCount()

unsigned MODULE::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 719 of file class_module.cpp.

720 {
721  std::set<wxString> usedNames;
722 
723  // Create a set of used pad numbers
724  for( D_PAD* pad : m_pads )
725  {
726  // Skip pads not on copper layers (used to build complex
727  // solder paste shapes for instance)
728  if( ( pad->GetLayerSet() & LSET::AllCuMask() ).none() )
729  continue;
730 
731  // Skip pads with no name, because they are usually "mechanical"
732  // pads, not "electrical" pads
733  if( pad->GetName().IsEmpty() )
734  continue;
735 
736  if( !aIncludeNPTH )
737  {
738  // skip NPTH
739  if( pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
740  {
741  continue;
742  }
743  }
744 
745  usedNames.insert( pad->GetName() );
746  }
747 
748  return usedNames.size();
749 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
PADS m_pads
Definition: class_module.h:678

References LSET::AllCuMask(), m_pads, and PAD_ATTRIB_HOLE_NOT_PLATED.

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 MODULE::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 75 of file board_item_container.h.

76  {
77  return m_zoneSettings;
78  }

References BOARD_ITEM_CONTAINER::m_zoneSettings.

Referenced by ZONE_CONTAINER::ZONE_CONTAINER().

◆ GraphicalItems() [1/2]

◆ GraphicalItems() [2/2]

const DRAWINGS& MODULE::GraphicalItems ( ) const
inline

Definition at line 189 of file class_module.h.

190  {
191  return m_drawings;
192  }
DRAWINGS m_drawings
Definition: class_module.h:677

◆ HasFlag()

◆ HasNonSMDPins()

bool MODULE::HasNonSMDPins ( ) const
Returns
true if the given module has any non smd pins, such as through hole and therefore cannot be placed automatically. Used in Pick and Place files writers

Definition at line 1508 of file class_module.cpp.

1509 {
1510  // returns true if the given module has at lesat one non smd pin, such as through hole
1511 
1512  for( auto pad : Pads() )
1513  {
1514  if( pad->GetAttribute() != PAD_ATTRIB_SMD )
1515  return true;
1516  }
1517 
1518  return false;
1519 }
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:81
PADS & Pads()
Definition: class_module.h:169

References PAD_ATTRIB_SMD, and Pads().

◆ HitTest() [1/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 602 of file class_module.cpp.

603 {
604  EDA_RECT rect = m_BoundaryBox;
605  return rect.Inflate( aAccuracy ).Contains( aPosition );
606 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
EDA_RECT m_BoundaryBox
Definition: class_module.h:689
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

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

Referenced by GENERAL_COLLECTOR::Inspect().

◆ HitTest() [2/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 615 of file class_module.cpp.

616 {
617  EDA_RECT arect = aRect;
618  arect.Inflate( aAccuracy );
619 
620  if( aContained )
621  return arect.Contains( m_BoundaryBox );
622  else
623  {
624  // If the rect does not intersect the bounding box, skip any tests
625  if( !aRect.Intersects( GetBoundingBox() ) )
626  return false;
627 
628  // Determine if any elements in the MODULE intersect the rect
629  for( D_PAD* pad : m_pads )
630  {
631  if( pad->HitTest( arect, false, 0 ) )
632  return true;
633  }
634 
635  for( MODULE_ZONE_CONTAINER* zone : m_fp_zones )
636  {
637  if( zone->HitTest( arect, false, 0 ) )
638  return true;
639  }
640 
641  for( BOARD_ITEM* item : m_drawings )
642  {
643  if( item->HitTest( arect, false, 0 ) )
644  return true;
645  }
646 
647  // No items were hit
648  return false;
649  }
650 }
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PADS m_pads
Definition: class_module.h:678
bool Contains(const wxPoint &aPoint) const
Function Contains.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
EDA_RECT m_BoundaryBox
Definition: class_module.h:689
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:679
DRAWINGS m_drawings
Definition: class_module.h:677
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:952
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

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

◆ HitTestAccurate()

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

Tests if a point is inside the bounding polygon of the module.

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 609 of file class_module.cpp.

610 {
611  return GetBoundingPoly().Collide( aPosition, aAccuracy );
612 }
SHAPE_POLY_SET GetBoundingPoly() const
Returns a bounding polygon for the shapes and pads in the module This operation is slower but more ac...
bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr) const override
Function Collide Checks whether the point aP is either inside or on the edge of the polygon set.

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

Referenced by GENERAL_COLLECTOR::Inspect().

◆ IncrementFlag()

void MODULE::IncrementFlag ( )
inline

Definition at line 259 of file class_module.h.

259 { m_arflag += 1; }
int m_arflag
Definition: class_module.h:703

◆ IncrementReference()

void MODULE::IncrementReference ( int  aDelta)

Function IncrementReference Bumps the current reference by aDelta.

Definition at line 1355 of file class_module.cpp.

1356 {
1357  const auto& refdes = GetReference();
1358  SetReference( wxString::Format( wxT( "%s%i" ), UTIL::GetReferencePrefix( refdes ),
1359  GetTrailingInt( refdes ) + aDelta ) );
1360 }
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:433
void SetReference(const wxString &aReference)
Function SetReference.
Definition: class_module.h:443
wxString GetReferencePrefix(const wxString &aRefDes)
Get the (non-numeric) prefix from a refdes - e.g.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
int GetTrailingInt(const wxString &aStr)
Gets the trailing int, if any, from a string.
Definition: string.cpp:684

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

◆ IsBrightened()

bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

◆ IsConnected()

virtual bool BOARD_ITEM::IsConnected ( ) const
inlinevirtualinherited

Function IsConnected() Returns information if the object is derived from BOARD_CONNECTED_ITEM.

Returns
True if the object is of BOARD_CONNECTED_ITEM type, false otherwise.

Reimplemented in BOARD_CONNECTED_ITEM.

Definition at line 141 of file class_board_item.h.

142  {
143  return false;
144  }

Referenced by GetRule(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), and CONNECTIVITY_DATA::MarkItemNetAsDirty().

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 201 of file base_struct.h.

201 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

◆ IsFlipped()

bool MODULE::IsFlipped ( ) const
inline

function IsFlipped

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

Definition at line 288 of file class_module.h.

288 { return GetLayer() == B_Cu; }
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

References B_Cu, and GetLayer().

Referenced by PCB_BASE_FRAME::AddModuleToBoard(), GetMsgPanelInfo(), DIALOG_PAD_PROPERTIES::initValues(), ALTIUM_PCB::ParseComponentsBodies6Data(), PCB_EDITOR_CONTROL::PlaceModule(), C3D_RENDER_OGL_LEGACY::render_3D_module(), and DIALOG_TEXT_PROPERTIES::TransferDataToWindow().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 286 of file base_struct.h.

286 { return m_forceVisible; }
bool m_forceVisible
Definition: base_struct.h:175

References EDA_ITEM::m_forceVisible.

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

◆ IsLibNameValid()

bool MODULE::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 999 of file class_module.cpp.

1000 {
1001  const wxChar * invalids = StringLibNameInvalidChars( false );
1002 
1003  if( aName.find_first_of( invalids ) != std::string::npos )
1004  return false;
1005 
1006  return true;
1007 }
static const wxChar * StringLibNameInvalidChars(bool aUserReadable)
static function StringLibNameInvalidChars Test for validity of the name in a library of the footprint...

References StringLibNameInvalidChars().

Referenced by DIALOG_FOOTPRINT_FP_EDITOR::checkFootprintName().

◆ IsLocked()

bool MODULE::IsLocked ( ) const
inlineoverridevirtual

Function IsLocked.

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

Reimplemented from BOARD_ITEM.

Definition at line 297 of file class_module.h.

298  {
299  return ( m_ModuleStatus & MODULE_is_LOCKED ) != 0;
300  }
#define MODULE_is_LOCKED
module LOCKED: no autoplace allowed
Definition: class_module.h:291
int m_ModuleStatus
Definition: class_module.h:688

References MODULE_is_LOCKED.

Referenced by EditToolSelectionFilter(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::format(), GetMsgPanelInfo(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 198 of file base_struct.h.

198 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:113
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNetTie()

bool MODULE::IsNetTie ( ) const
inline

Definition at line 263 of file class_module.h.

263 { return GetKeywords().StartsWith( wxT( "net tie" ) ); }
const wxString & GetKeywords() const
Definition: class_module.h:221

Referenced by DRC::testCopperTextAndGraphics().

◆ IsNew()

◆ IsOnCopperLayer()

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

Reimplemented in TRACK, D_PAD, and ZONE_CONTAINER.

Definition at line 149 of file class_board_item.h.

150  {
151  return IsCopperLayer( GetLayer() );
152  }
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

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

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

◆ IsOnLayer()

virtual bool BOARD_ITEM::IsOnLayer ( PCB_LAYER_ID  aLayer) const
inlinevirtualinherited

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

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

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

Reimplemented in D_PAD, VIA, ZONE_CONTAINER, MARKER_PCB, and MARKER_PCB.

Definition at line 218 of file class_board_item.h.

219  {
220  return m_Layer == aLayer;
221  }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by BOARD_ADAPTER::createLayers(), and GENERAL_COLLECTOR::Inspect().

◆ IsPlaced()

bool MODULE::IsPlaced ( ) const
inline

Definition at line 315 of file class_module.h.

315 { return m_ModuleStatus & MODULE_is_PLACED; }
#define MODULE_is_PLACED
In autoplace: module automatically placed.
Definition: class_module.h:292
int m_ModuleStatus
Definition: class_module.h:688

References MODULE_is_PLACED.

Referenced by PCB_IO::format().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Function IsReplaceable.

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

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

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

Definition at line 501 of file base_struct.h.

501 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 204 of file base_struct.h.

204 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118

References IS_RESIZED, and EDA_ITEM::m_Flags.

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

◆ IsSelected()

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

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

form of testing.

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

Definition at line 229 of file class_board_item.h.

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

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

◆ IsType()

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

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

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

Reimplemented in VIA, SCH_LABEL, DIMENSION, D_PAD, DRAWSEGMENT, TEXTE_MODULE, SCH_FIELD, SCH_LINE, EDGE_MODULE, and TEXTE_PCB.

Definition at line 262 of file base_struct.h.

263  {
264  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
265  return true;
266 
267  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
268  {
269  if( m_StructType == *p )
270  return true;
271  }
272 
273  return false;
274  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:170
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78

References EOT, EDA_ITEM::m_StructType, and SCH_LOCATE_ANY_T.

Referenced by GetRule(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), TEXTE_PCB::IsType(), EDGE_MODULE::IsType(), SCH_LINE::IsType(), SCH_FIELD::IsType(), TEXTE_MODULE::IsType(), DRAWSEGMENT::IsType(), D_PAD::IsType(), DIMENSION::IsType(), SCH_LABEL::IsType(), VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 202 of file base_struct.h.

202 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward() [1/2]

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

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

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

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

Definition at line 383 of file base_struct.h.

387  {
388  for( auto it : aList )
389  {
390  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
392  return SEARCH_RESULT::QUIT;
393  }
394 
396  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

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

◆ IterateForward() [2/2]

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

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

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

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

Definition at line 404 of file base_struct.h.

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

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

◆ LayerMaskDescribe()

wxString BOARD_ITEM::LayerMaskDescribe ( const BOARD aBoard,
LSET  aMask 
)
staticprotectedinherited

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

The BOARD is needed because layer names are (somewhat) customizable

Definition at line 80 of file class_board_item.cpp.

81 {
82  // Try to be smart and useful. Check all copper first.
83  if( aMask[F_Cu] && aMask[B_Cu] )
84  return _( "All copper layers" );
85 
86  // Check for copper.
87  auto layer = aBoard->GetEnabledLayers().AllCuMask() & aMask;
88 
89  for( int i = 0; i < 3; i++ )
90  {
91  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
92  {
93  if( layer[ bit ] )
94  {
95  wxString layerInfo = aBoard->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
96 
97  if( aMask.count() > 1 )
98  layerInfo << _( " and others" );
99 
100  return layerInfo;
101  }
102  }
103 
104  // No copper; first, check for technicals and then for all layers.
105  if( i < 1 ) // first, check for technicals
106  layer = aBoard->GetEnabledLayers().AllTechMask() & aMask;
107  else // then check for all other layers
108  layer = aMask;
109  }
110 
111  // No copper, no technicals: no layer
112  return _( "no layers" );
113 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:782
#define _(s)
Definition: 3d_actions.cpp:33

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

Referenced by D_PAD::GetMsgPanelInfo(), and D_PAD::GetSelectMenuText().

◆ Matches() [1/2]

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

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

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

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

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

Definition at line 457 of file base_struct.h.

458  {
459  return false;
460  }

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

◆ Matches() [2/2]

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

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 145 of file base_struct.cpp.

146 {
147  wxString text = aText;
148  wxString searchText = aSearchData.GetFindString();
149 
150  // Don't match if searching for replaceable item and the item doesn't support text replace.
151  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
152  return false;
153 
154  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
155  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
156 
157  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
158  {
159  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
160  return text.Matches( searchText );
161 
162  return text.MakeUpper().Matches( searchText.MakeUpper() );
163  }
164 
165  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
166  return aText.Find( searchText ) != wxNOT_FOUND;
167 
168  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
169 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:501

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

◆ Models() [1/2]

◆ Models() [2/2]

const std::list<MODULE_3D_SETTINGS>& MODULE::Models ( ) const
inline

Definition at line 202 of file class_module.h.

202 { return m_3D_Drawings; }
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Definition: class_module.h:680

◆ Move() [1/2]

void MODULE::Move ( const wxPoint aMoveVector)
overridevirtual

Function Move move this object.

Parameters
aMoveVector- the move vector for this object.

Reimplemented from BOARD_ITEM.

Definition at line 1025 of file class_module.cpp.

1026 {
1027  wxPoint newpos = m_Pos + aMoveVector;
1028  SetPosition( newpos );
1029 }
void SetPosition(const wxPoint &aPos) override
wxPoint m_Pos
Definition: class_module.h:683

References m_Pos, and SetPosition().

Referenced by moveFootprintsInArea().

◆ Move() [2/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 277 of file class_board_item.h.

278  {
279  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
280  }
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.

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

◆ MoveAnchorPosition()

void MODULE::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 1163 of file class_module.cpp.

1164 {
1165  /* Move the reference point of the footprint
1166  * the footprints elements (pads, outlines, edges .. ) are moved
1167  * but:
1168  * - the footprint position is not modified.
1169  * - the relative (local) coordinates of these items are modified
1170  * - Draw coordinates are updated
1171  */
1172 
1173 
1174  // Update (move) the relative coordinates relative to the new anchor point.
1175  wxPoint moveVector = aMoveVector;
1176  RotatePoint( &moveVector, -GetOrientation() );
1177 
1178  // Update of the reference and value.
1179  m_Reference->SetPos0( m_Reference->GetPos0() + moveVector );
1181  m_Value->SetPos0( m_Value->GetPos0() + moveVector );
1182  m_Value->SetDrawCoord();
1183 
1184  // Update the pad local coordinates.
1185  for( auto pad : m_pads )
1186  {
1187  pad->SetPos0( pad->GetPos0() + moveVector );
1188  pad->SetDrawCoord();
1189  }
1190 
1191  // Update the draw element coordinates.
1192  for( auto item : GraphicalItems() )
1193  {
1194  switch( item->Type() )
1195  {
1196  case PCB_MODULE_EDGE_T:
1197  {
1198  EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
1199  edge->Move( moveVector );
1200  }
1201  break;
1202 
1203  case PCB_MODULE_TEXT_T:
1204  {
1205  TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
1206  text->SetPos0( text->GetPos0() + moveVector );
1207  text->SetDrawCoord();
1208  }
1209  break;
1210 
1211  default:
1212  break;
1213  }
1214  }
1215 
1217 }
double GetOrientation() const
Definition: class_module.h:211
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
PADS m_pads
Definition: class_module.h:678
DRAWINGS & GraphicalItems()
Definition: class_module.h:179
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
void SetPos0(const wxPoint &aPos)
const wxPoint & GetPos0() const
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
void Move(const wxPoint &aMoveVector) override
Move an edge of the footprint.
void SetDrawCoord()
Set absolute coordinates.
TEXTE_MODULE * m_Value
Definition: class_module.h:685
TEXTE_MODULE * m_Reference
Definition: class_module.h:684

References CalculateBoundingBox(), GetOrientation(), TEXTE_MODULE::GetPos0(), GraphicalItems(), m_pads, m_Reference, m_Value, EDGE_MODULE::Move(), PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, RotatePoint(), TEXTE_MODULE::SetDrawCoord(), and TEXTE_MODULE::SetPos0().

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

◆ NeedsPlaced()

bool MODULE::NeedsPlaced ( ) const
inline

Definition at line 324 of file class_module.h.

324 { return m_ModuleStatus & MODULE_to_PLACE; }
#define MODULE_to_PLACE
In autoplace: module waiting for autoplace.
Definition: class_module.h:293
int m_ModuleStatus
Definition: class_module.h:688

References MODULE_to_PLACE.

Referenced by AR_AUTOPLACER::pickModule().

◆ 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 199 of file base_struct.cpp.

200 {
201  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
202  GetChars( GetClass() ) ) );
203 
204  return false;
205 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153
virtual wxString GetClass() const =0
Function GetClass returns the class name.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205

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

◆ operator=()

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

Definition at line 168 of file class_module.cpp.

169 {
170  BOARD_ITEM::operator=( aOther );
171 
172  m_Pos = aOther.m_Pos;
173  m_fpid = aOther.m_fpid;
174  m_Attributs = aOther.m_Attributs;
176  m_Orient = aOther.m_Orient;
177  m_BoundaryBox = aOther.m_BoundaryBox;
178  m_CntRot90 = aOther.m_CntRot90;
179  m_CntRot180 = aOther.m_CntRot180;
181  m_Link = aOther.m_Link;
182  m_Path = aOther.m_Path;
183 
190  m_ThermalGap = aOther.m_ThermalGap;
191 
192  // Copy reference and value
193  *m_Reference = *aOther.m_Reference;
194  m_Reference->SetParent( this );
195  *m_Value = *aOther.m_Value;
196  m_Value->SetParent( this );
197 
198  // Copy auxiliary data: Pads
199  m_pads.clear();
200 
201  for( D_PAD* pad : aOther.Pads() )
202  Add( new D_PAD( *pad ) );
203 
204  // Copy auxiliary data: Zones
205  m_fp_zones.clear();
206 
207  for( MODULE_ZONE_CONTAINER* item : aOther.Zones() )
208  {
209  Add( static_cast<MODULE_ZONE_CONTAINER*>( item->Clone() ) );
210 
211  // Ensure the net info is OK and especially uses the net info list
212  // living in the current board
213  // Needed when copying a fp from fp editor that has its own board
214  // Must be NETINFO_LIST::ORPHANED_ITEM for a keepout that has no net.
215  item->SetNetCode( -1 );
216  }
217 
218  // Copy auxiliary data: Drawings
219  m_drawings.clear();
220 
221  for( BOARD_ITEM* item : aOther.GraphicalItems() )
222  {
223  switch( item->Type() )
224  {
225  case PCB_MODULE_TEXT_T:
226  case PCB_MODULE_EDGE_T:
227  Add( static_cast<BOARD_ITEM*>( item->Clone() ) );
228  break;
229 
230  default:
231  wxLogMessage( wxT( "MODULE::operator=() internal error: unknown type" ) );
232  break;
233  }
234  }
235 
236  // Copy auxiliary data: 3D_Drawings info
237  m_3D_Drawings.clear();
238  m_3D_Drawings = aOther.m_3D_Drawings;
239  m_Doc = aOther.m_Doc;
240  m_KeyWord = aOther.m_KeyWord;
241 
242  // Ensure auxiliary data is up to date
244 
245  return *this;
246 }
LIB_ID m_fpid
Definition: class_module.h:686
int m_CntRot90
Definition: class_module.h:705
wxString m_KeyWord
Definition: class_module.h:700
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
int m_ThermalWidth
Definition: class_module.h:692
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
double m_LocalSolderPasteMarginRatio
Definition: class_module.h:697
int m_LocalSolderPasteMargin
Definition: class_module.h:696
int m_ThermalGap
Definition: class_module.h:693
PADS & Pads()
Definition: class_module.h:169
KIID_PATH m_Path
Definition: class_module.h:701
PADS m_pads
Definition: class_module.h:678
DRAWINGS & GraphicalItems()
Definition: class_module.h:179
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
virtual void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:196
wxString m_Doc
Definition: class_module.h:699
timestamp_t m_LastEditTime
Definition: class_module.h:702
int m_LocalClearance
Definition: class_module.h:694
double m_Orient
Definition: class_module.h:682
EDA_RECT m_BoundaryBox
Definition: class_module.h:689
ZONE_CONNECTION m_ZoneConnection
Definition: class_module.h:691
int m_LocalSolderMaskMargin
Definition: class_module.h:695
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Definition: class_module.h:680
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:679
DRAWINGS m_drawings
Definition: class_module.h:677
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
const MODULE_ZONE_CONTAINERS & Zones() const
Definition: class_module.h:184
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
int m_CntRot180
Definition: class_module.h:706
int m_ModuleStatus
Definition: class_module.h:688
TEXTE_MODULE * m_Value
Definition: class_module.h:685
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:952
wxPoint m_Pos
Definition: class_module.h:683
TEXTE_MODULE * m_Reference
Definition: class_module.h:684
KIID m_Link
Definition: class_module.h:704
int m_Attributs
Definition: class_module.h:687

References Add(), CalculateBoundingBox(), GraphicalItems(), m_3D_Drawings, m_Attributs, m_BoundaryBox, m_CntRot180, m_CntRot90, m_Doc, m_drawings, m_fp_zones, m_fpid, m_KeyWord, m_LastEditTime, m_Link, m_LocalClearance, m_LocalSolderMaskMargin, m_LocalSolderPasteMargin, m_LocalSolderPasteMarginRatio, m_ModuleStatus, m_Orient, m_pads, m_Path, m_Pos, m_Reference, m_ThermalGap, m_ThermalWidth, m_Value, m_ZoneConnection, EDA_ITEM::operator=(), Pads(), PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, EDA_ITEM::SetParent(), and Zones().

◆ Pads() [1/2]

◆ Pads() [2/2]

const PADS& MODULE::Pads ( ) const
inline

Definition at line 174 of file class_module.h.

175  {
176  return m_pads;
177  }
PADS m_pads
Definition: class_module.h:678

◆ PadsLocked()

bool MODULE::PadsLocked ( ) const
inline

Definition at line 333 of file class_module.h.

#define MODULE_PADS_LOCKED
In autoplace: module waiting for autoplace.
Definition: class_module.h:294
int m_ModuleStatus
Definition: class_module.h:688

References MODULE_PADS_LOCKED.

Referenced by EditToolSelectionFilter(), EDIT_POINTS_FACTORY::Make(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), and POINT_EDITOR::updatePoints().

◆ Reference() [1/2]

◆ Reference() [2/2]

TEXTE_MODULE& MODULE::Reference ( ) const
inline

Definition at line 478 of file class_module.h.

478 { return *m_Reference; }
TEXTE_MODULE * m_Reference
Definition: class_module.h:684

◆ Remove()

void MODULE::Remove ( BOARD_ITEM aItem)
overridevirtual

Implements BOARD_ITEM_CONTAINER.

Definition at line 334 of file class_module.cpp.

335 {
336  switch( aBoardItem->Type() )
337  {
338  case PCB_MODULE_TEXT_T:
339  // Only user text can be removed this way.
340  wxCHECK_RET(
341  static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS,
342  "Please report this bug: Invalid remove operation on required text" );
344 
345  case PCB_MODULE_EDGE_T:
346  for( auto it = m_drawings.begin(); it != m_drawings.end(); ++it )
347  {
348  if( *it == aBoardItem )
349  {
350  m_drawings.erase( it );
351  break;
352  }
353  }
354 
355  break;
356 
357  case PCB_PAD_T:
358  for( auto it = m_pads.begin(); it != m_pads.end(); ++it )
359  {
360  if( *it == static_cast<D_PAD*>( aBoardItem ) )
361  {
362  m_pads.erase( it );
363  break;
364  }
365  }
366 
367  break;
368 
370  for( auto it = m_fp_zones.begin(); it != m_fp_zones.end(); ++it )
371  {
372  if( *it == static_cast<MODULE_ZONE_CONTAINER*>( aBoardItem ) )
373  {
374  m_fp_zones.erase( it );
375  break;
376  }
377  }
378 
379  break;
380 
381  default:
382  {
383  wxString msg;
384  msg.Printf( wxT( "MODULE::Remove() needs work: BOARD_ITEM type (%d) not handled" ),
385  aBoardItem->Type() );
386  wxFAIL_MSG( msg );
387  }
388  }
389 }
#define KI_FALLTHROUGH
PADS m_pads
Definition: class_module.h:678
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:679
DRAWINGS m_drawings
Definition: class_module.h:677
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95

References KI_FALLTHROUGH, m_drawings, m_fp_zones, m_pads, PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, PCB_MODULE_ZONE_AREA_T, PCB_PAD_T, TEXTE_MODULE::TEXT_is_DIVERS, and EDA_ITEM::Type().

◆ Replace() [1/2]

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

Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

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 172 of file base_struct.cpp.

173 {
174  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
175 
176  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
177  aSearchData.GetFindString() :
178  aSearchData.GetFindString().Upper() );
179 
180  if( result == wxNOT_FOUND )
181  return false;
182 
183  wxString prefix = aText.Left( result );
184  wxString suffix;
185 
186  if( aSearchData.GetFindString().length() + result < aText.length() )
187  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
188 
189  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
190  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
191  GetChars( suffix ) );
192 
193  aText = prefix + aSearchData.GetReplaceString() + suffix;
194 
195  return true;
196 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153

References GetChars(), and traceFindReplace.

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

◆ Replace() [2/2]

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

Function Replace performs 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, and SCH_FIELD.

Definition at line 489 of file base_struct.h.

489 { return false; }

◆ ResolveTextVar()

bool MODULE::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 257 of file class_module.cpp.

258 {
259  if( token->IsSameAs( wxT( "REFERENCE" ) ) )
260  {
261  *token = m_Reference->GetShownText( aDepth + 1 );
262  return true;
263  }
264  else if( token->IsSameAs( wxT( "VALUE" ) ) )
265  {
266  *token = m_Value->GetShownText( aDepth + 1 );
267  return true;
268  }
269  else if( token->IsSameAs( wxT( "LAYER" ) ) )
270  {
271  *token = GetLayerName();
272  return true;
273  }
274 
275  return false;
276 }
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
TEXTE_MODULE * m_Value
Definition: class_module.h:685
TEXTE_MODULE * m_Reference
Definition: class_module.h:684
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.

References BOARD_ITEM::GetLayerName(), TEXTE_MODULE::GetShownText(), m_Reference, and m_Value.

Referenced by TEXTE_PCB::GetShownText(), and TEXTE_MODULE::GetShownText().

◆ Rotate() [1/2]

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

Function Rotate Rotate this object.

Parameters
aRotCentre- the rotation point.
aAngle- the rotation angle in 0.1 degree.

Reimplemented from BOARD_ITEM.

Definition at line 1032 of file class_module.cpp.

1033 {
1034  double orientation = GetOrientation();
1035  double newOrientation = orientation + aAngle;
1036  wxPoint newpos = m_Pos;
1037  RotatePoint( &newpos, aRotCentre, aAngle );
1038  SetPosition( newpos );
1039  SetOrientation( newOrientation );
1040 
1041  m_Reference->KeepUpright( orientation, newOrientation );
1042  m_Value->KeepUpright( orientation, newOrientation );
1043 
1044  for( BOARD_ITEM* item : m_drawings )
1045  {
1046  if( item->Type() == PCB_MODULE_TEXT_T )
1047  static_cast<TEXTE_MODULE*>( item )->KeepUpright( orientation, newOrientation );
1048  }
1049 }
double GetOrientation() const
Definition: class_module.h:211
void KeepUpright(double aOldOrientation, double aNewOrientation)
Called when rotating the parent footprint.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
void SetPosition(const wxPoint &aPos) override
DRAWINGS m_drawings
Definition: class_module.h:677
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
void SetOrientation(double newangle)
TEXTE_MODULE * m_Value
Definition: class_module.h:685
wxPoint m_Pos
Definition: class_module.h:683
TEXTE_MODULE * m_Reference
Definition: class_module.h:684

References GetOrientation(), TEXTE_MODULE::KeepUpright(), m_drawings, m_Pos, m_Reference, m_Value, PCB_MODULE_TEXT_T, RotatePoint(), SetOrientation(), and SetPosition().

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

◆ Rotate() [2/2]

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

Definition at line 293 of file class_board_item.h.

294  {
295  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
296  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.

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

◆ RunOnChildren()

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

Function RunOnChildren.

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

Parameters
aFunctionis the function to be invoked.

Definition at line 868 of file class_module.cpp.

869 {
870  try
871  {
872  for( D_PAD* pad : m_pads )
873  aFunction( static_cast<BOARD_ITEM*>( pad ) );
874 
875  for( MODULE_ZONE_CONTAINER* zone : m_fp_zones )
876  aFunction( static_cast<MODULE_ZONE_CONTAINER*>( zone ) );
877 
878  for( BOARD_ITEM* drawing : m_drawings )
879  aFunction( static_cast<BOARD_ITEM*>( drawing ) );
880 
881  aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
882  aFunction( static_cast<BOARD_ITEM*>( m_Value ) );
883  }
884  catch( std::bad_function_call& )
885  {
886  DisplayError( NULL, wxT( "Error running MODULE::RunOnChildren" ) );
887  }
888 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PADS m_pads
Definition: class_module.h:678
#define NULL
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:679
DRAWINGS m_drawings
Definition: class_module.h:677
TEXTE_MODULE * m_Value
Definition: class_module.h:685
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:952
TEXTE_MODULE * m_Reference
Definition: class_module.h:684

References DisplayError(), m_drawings, m_fp_zones, m_pads, m_Reference, m_Value, and NULL.

Referenced by PCB_BASE_FRAME::CreateNewModule(), PCB_TOOL_BASE::doInteractiveItemPlacement(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), DRC::testDisabledLayers(), and PCBNEW_SELECTION::updateDrawList().

◆ Set() [1/3]

bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
wxAny &  aValue 
)
inlineinherited

Definition at line 40 of file inspectable.h.

41  {
43  TYPE_ID thisType = TYPE_HASH( *this );
44  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
45 
46  if( object )
47  aProperty->setter( object, aValue );
48 
49  return object != nullptr;
50  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
virtual void setter(void *aObject, wxAny &aValue)=0
Provides class metadata.
Definition: property_mgr.h:58
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

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

◆ Set() [2/3]

template<typename T >
bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
aValue 
)
inlineinherited

Definition at line 53 of file inspectable.h.

54  {
56  TYPE_ID thisType = TYPE_HASH( *this );
57  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
58 
59  if( object )
60  aProperty->set<T>( object, aValue );
61 
62  return object != nullptr;
63  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
Provides class metadata.
Definition: property_mgr.h:58
void set(void *aObject, T aValue)
Definition: property.h:264
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

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

◆ Set() [3/3]

template<typename T >
bool INSPECTABLE::Set ( const wxString &  aProperty,
aValue 
)
inlineinherited

Definition at line 66 of file inspectable.h.

67  {
69  TYPE_ID thisType = TYPE_HASH( *this );
70  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71  void* object = nullptr;
72 
73  if( prop )
74  {
75  object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76 
77  if( object )
78  prop->set<T>( object, aValue );
79  }
80 
81  return object != nullptr;
82  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Returns a property for a specific type.
Provides class metadata.
Definition: property_mgr.h:58
void set(void *aObject, T aValue)
Definition: property.h:264
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

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

◆ SetAttributes()

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

◆ SetDescription()

void MODULE::SetDescription ( const wxString &  aDoc)
inline

Definition at line 219 of file class_module.h.

219 { m_Doc = aDoc; }
wxString m_Doc
Definition: class_module.h:699

Referenced by LEGACY_PLUGIN::loadMODULE(), and DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow().

◆ SetFlag()

void MODULE::SetFlag ( int  aFlag)
inline

Definition at line 258 of file class_module.h.

258 { m_arflag = aFlag; }
int m_arflag
Definition: class_module.h:703

Referenced by AR_AUTOPLACER::pickModule().

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 232 of file base_struct.h.

232 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References EDA_ITEM::m_Flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddModuleToBoard(), PCBNEW_CONTROL::AppendBoard(), SCH_EDIT_TOOL::ChangeTextType(), GRAPHICS_CLEANER::cleanupSegments(), TRACKS_CLEANER::cleanupSegments(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), LIB_PIN_TOOL::CreatePin(), SCH_EDIT_FRAME::CreateSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), KIGFX::SCH_PAINTER::draw(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::DrawRectangle(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_EDIT_TOOL::Duplicate(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_MOVE_TOOL::getConnectedDragItems(), EDIT_POINTS_FACTORY::Make(), TRACKS_CLEANER::mergeCollinearSegments(), LIB_MOVE_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), WS_DATA_ITEM::SyncDrawItems(), WS_DATA_ITEM_TEXT::SyncDrawItems(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible.

Parameters
aEnableTrue forces the item to be drawn. False uses the item's visibility setting to determine if the item is to be drawn.

Definition at line 284 of file base_struct.h.

284 { m_forceVisible = aEnable; }
bool m_forceVisible
Definition: base_struct.h:175

References EDA_ITEM::m_forceVisible.

◆ SetFPID()

◆ SetInitialComments()

void MODULE::SetInitialComments ( wxArrayString *  aInitialComments)
inline

Function SetInitialComments takes ownership of caller's heap allocated aInitialComments block.

The comments are single line strings already containing the s-expression comments with optional leading whitespace and then a '#' character followed by optional single line text (text with no line endings, not even one). This block of single line comments will be output upfront of any generated s-expression text in the PCBIO::Format() function.

Note that a block of single line comments constitutes a multiline block of single line comments. That is, the block is made of consecutive single line comments.

Parameters
aInitialCommentsis a heap allocated wxArrayString or NULL, which the caller gives up ownership of over to this MODULE.

Definition at line 640 of file class_module.h.

641  {
642  delete m_initial_comments;
643  m_initial_comments = aInitialComments;
644  }
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed
Definition: class_module.h:708

◆ SetIsPlaced()

void MODULE::SetIsPlaced ( bool  isPlaced)
inline

Definition at line 316 of file class_module.h.

317  {
318  if( isPlaced )
320  else
322  }
#define MODULE_is_PLACED
In autoplace: module automatically placed.
Definition: class_module.h:292
int m_ModuleStatus
Definition: class_module.h:688

References MODULE_is_PLACED.

Referenced by AR_AUTOPLACER::AutoplaceModules(), and LEGACY_PLUGIN::loadMODULE().

◆ SetKeywords()

void MODULE::SetKeywords ( const wxString &  aKeywords)
inline

Definition at line 222 of file class_module.h.

222 { m_KeyWord = aKeywords; }
wxString m_KeyWord
Definition: class_module.h:700

Referenced by LEGACY_PLUGIN::loadMODULE(), and DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow().

◆ SetLastEditTime() [1/2]

◆ SetLastEditTime() [2/2]

void MODULE::SetLastEditTime ( )
inline

Definition at line 344 of file class_module.h.

344 { m_LastEditTime = time( NULL ); }
timestamp_t m_LastEditTime
Definition: class_module.h:702
#define NULL

References NULL.

◆ SetLayer()

virtual void BOARD_ITEM::SetLayer ( PCB_LAYER_ID  aLayer)
inlinevirtualinherited

Function SetLayer sets the layer this item is on.

Parameters
aLayerThe layer number. is virtual because some items (in fact: class DIMENSION) have a slightly different initialization

Reimplemented in ZONE_CONTAINER, and DIMENSION.

Definition at line 182 of file class_board_item.h.

183  {
184  // trap any invalid layers, then go find the caller and fix it.
185  // wxASSERT( unsigned( aLayer ) < unsigned( NB_PCB_LAYERS ) );
186  m_Layer = aLayer;
187  }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by PNS_KICAD_IFACE::AddItem(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToModule(), PCAD2KICAD::PCB_ARC::AddToModule(), PCAD2KICAD::PCB_POLYGON::AddToModule(), DIMENSION::AdjustDimensionDetails(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), ZONE_FILLER::buildCopperItemClearances(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewModule(), MICROWAVE_TOOL::createPolygonShape(), DRC::doTrackDrc(), DRAWING_TOOL::drawArc(), PAD_TOOL::explodePad(), PCB_TARGET::Flip(), TEXTE_PCB::Flip(), EDGE_MODULE::Flip(), TRACK::Flip(), TEXTE_MODULE::Flip(), Flip(), DRAWSEGMENT::Flip(), ARC::Flip(), ALTIUM_PCB::HelperCreateBoardOutline(), ALTIUM_PCB::HelperParseDimensions6Center(), ALTIUM_PCB::HelperParseDimensions6Datum(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParsePad6NonCopper(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), main(), DSN::SPECCTRA_DB::makeTRACK(), GRAPHICS_CLEANER::mergeRects(), MODULE_DESC::MODULE_DESC(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageSMD(), EAGLE_PLUGIN::packageText(), EAGLE_PLUGIN::packageWire(), ALTIUM_PCB::ParseArcs6Data(), ALTIUM_PCB::ParseComponents6Data(), ALTIUM_PCB::ParseFills6Data(), GPCB_FPL_CACHE::parseMODULE(), ALTIUM_PCB::ParsePads6Data(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), ALTIUM_PCB::ParseTexts6Data(), ALTIUM_PCB::ParseTracks6Data(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotPcbTarget(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), DIALOG_PAD_PROPERTIES::redraw(), DIMENSION::SetLayer(), TEXT_MOD_GRID_TABLE::SetValueAsLong(), GLOBAL_EDIT_TOOL::swapBoardItem(), DRC::testPadClearances(), TEXTE_MODULE::TEXTE_MODULE(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow().

◆ SetLink()

◆ SetLocalClearance()

void MODULE::SetLocalClearance ( int  aClearance)
inline

◆ SetLocalSolderMaskMargin()

void MODULE::SetLocalSolderMaskMargin ( int  aMargin)
inline

◆ SetLocalSolderPasteMargin()

void MODULE::SetLocalSolderPasteMargin ( int  aMargin)
inline

◆ SetLocalSolderPasteMarginRatio()

void MODULE::SetLocalSolderPasteMarginRatio ( double  aRatio)
inline

◆ SetLocked()

void MODULE::SetLocked ( bool  isLocked)
inlineoverridevirtual

Function SetLocked sets the MODULE_is_LOCKED bit in the m_ModuleStatus.

Parameters
isLockedWhen true means turn on locked status, else unlock

Reimplemented from BOARD_ITEM.

Definition at line 307 of file class_module.h.

308  {
309  if( isLocked )
311  else
313  }
#define MODULE_is_LOCKED
module LOCKED: no autoplace allowed
Definition: class_module.h:291
int m_ModuleStatus
Definition: class_module.h:688

References MODULE_is_LOCKED.

Referenced by PCB_EDIT_FRAME::Exchange_Module(), LEGACY_PLUGIN::loadMODULE(), PCB_EDIT_FRAME::LockModule(), ALTIUM_PCB::ParseComponents6Data(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

◆ SetModified()

◆ SetNeedsPlaced()

void MODULE::SetNeedsPlaced ( bool  needsPlaced)
inline

Definition at line 325 of file class_module.h.

326  {
327  if( needsPlaced )
329  else
331  }
#define MODULE_to_PLACE
In autoplace: module waiting for autoplace.
Definition: class_module.h:293
int m_ModuleStatus
Definition: class_module.h:688

References MODULE_to_PLACE.

Referenced by AR_AUTOPLACER::AutoplaceModules().

◆ SetOrientation()

void MODULE::SetOrientation ( double  newangle)

Definition at line 1220 of file class_module.cpp.

1221 {
1222  double angleChange = newangle - m_Orient; // change in rotation
1223 
1224  NORMALIZE_ANGLE_180( newangle );
1225 
1226  m_Orient = newangle;
1227 
1228  for( auto pad : m_pads )
1229  {
1230  pad->SetOrientation( pad->GetOrientation() + angleChange );
1231  pad->SetDrawCoord();
1232  }
1233 
1234  for( auto zone : m_fp_zones )
1235  {
1236  zone->Rotate( GetPosition(), angleChange );
1237  }
1238 
1239  // Update of the reference and value.
1241  m_Value->SetDrawCoord();
1242 
1243  // Displace contours and text of the footprint.
1244  for( auto item : m_drawings )
1245  {
1246  if( item->Type() == PCB_MODULE_EDGE_T )
1247  {
1248  static_cast<EDGE_MODULE*>( item )->SetDrawCoord();
1249  }
1250  else if( item->Type() == PCB_MODULE_TEXT_T )
1251  {
1252  static_cast<TEXTE_MODULE*>( item )->SetDrawCoord();
1253  }
1254  }
1255 
1257 }
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
PADS m_pads
Definition: class_module.h:678
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:354
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
double m_Orient
Definition: class_module.h:682
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:679
DRAWINGS m_drawings
Definition: class_module.h:677
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
void SetDrawCoord()
Set absolute coordinates.
TEXTE_MODULE * m_Value
Definition: class_module.h:685
TEXTE_MODULE * m_Reference
Definition: class_module.h:684
wxPoint GetPosition() const override
Definition: class_module.h:206

References CalculateBoundingBox(), GetPosition(), m_drawings, m_fp_zones, m_Orient, m_pads, m_Reference, m_Value, NORMALIZE_ANGLE_180(), PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, and TEXTE_MODULE::SetDrawCoord().

Referenced by PCB_BASE_FRAME::AddModuleToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), GetBoundingPoly(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), LEGACY_PLUGIN::loadMODULE(), EAGLE_PLUGIN::orientModuleAndText(), PCB_EDITOR_CONTROL::PlaceModule(), Rotate(), and AR_AUTOPLACER::rotateModule().

◆ SetOrientationDegrees()

void MODULE::SetOrientationDegrees ( double  aOrientation)
inline

Definition at line 210 of file class_module.h.

210 { SetOrientation( aOrientation * 10.0 ); }
void SetOrientation(double newangle)

Referenced by MODULE_DESC::MODULE_DESC(), and ALTIUM_PCB::ParseComponents6Data().

◆ SetPadsLocked()

void MODULE::SetPadsLocked ( bool  aPadsLocked)
inline

Definition at line 335 of file class_module.h.

336  {
337  if( aPadsLocked )
339  else
341  }
#define MODULE_PADS_LOCKED
In autoplace: module waiting for autoplace.
Definition: class_module.h:294
int m_ModuleStatus
Definition: class_module.h:688

References MODULE_PADS_LOCKED.

Referenced by FOOTPRINT_EDIT_FRAME::AddModuleToBoard(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Definition at line 196 of file base_struct.h.

196 { m_Parent = aParent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174

References EDA_ITEM::m_Parent.

Referenced by Add(), BOARD::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewComponent(), SCH_SHEET::AddPin(), LIB_CONTROL::AddSymbolToSchematic(), SCH_SCREEN::Append(), LIB_FIELD::Copy(), LIB_EDIT_FRAME::CreateNewPart(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), SCH_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), LIB_PART::Flatten(), PCB_IO::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::GetModule(), LIB_PART::LIB_PART(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), LIB_EDIT_FRAME::LoadOneSymbol(), MODULE(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), operator=(), LIB_PART::operator=(), PCB_PARSER::parseMODULE_unchecked(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::ParseSymbol(), LIB_EDIT_TOOL::Paste(), PCBNEW_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), pasteModuleItemsToModEdit(), SCH_DRAWING_TOOLS::PlaceComponent(), PCB_EDITOR_CONTROL::PlaceModule(), BACK_ANNOTATE::processNetNameChange(), BOARD_COMMIT::Push(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SaveCopyOfZones(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_PART::SetFields(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), SwapItemData(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary().

◆ SetPath()

void MODULE::SetPath ( const KIID_PATH aPath)
inline

◆ SetPlacementCost180()

void MODULE::SetPlacementCost180 ( int  aCost)
inline

◆ SetPlacementCost90()