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

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
 
const 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 wxString & GetPath () const
 
void SetPath (const wxString &aPath)
 
int GetLocalSolderMaskMargin () const
 
void SetLocalSolderMaskMargin (int aMargin)
 
int GetLocalClearance () const
 
void SetLocalClearance (int aClearance)
 
int GetLocalSolderPasteMargin () const
 
void SetLocalSolderPasteMargin (int aMargin)
 
double GetLocalSolderPasteMarginRatio () const
 
void SetLocalSolderPasteMarginRatio (double aRatio)
 
void 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 Print (PCB_BASE_FRAME *aFrame, wxDC *aDC, const wxPoint &aOffset=ZeroOffset) override
 Function Print Prints the footprint to the aDC. More...
 
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) 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 GetMsgPanelInfo (EDA_UNITS aUnits, 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 (bool aFillSequenceGaps) const
 Function GetNextPadName returns the next available pad name in the module. More...
 
double GetArea (int aPadding=0) const
 
timestamp_t GetLink () const
 
void SetLink (timestamp_t aLink)
 
int GetPlacementCost180 () const
 
void SetPlacementCost180 (int aCost)
 
int GetPlacementCost90 () const
 
void SetPlacementCost90 (int aCost)
 
BOARD_ITEMDuplicate (const BOARD_ITEM *aItem, bool aIncrementPadNumbers, bool aAddToModule=false)
 Function Duplicate Duplicate a given item within the module, without adding 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 ()
 Used in DRC to build the courtyard area (a complex polygon) from graphic items put on the courtyard. 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...
 
const ZONE_SETTINGSGetZoneSettings () const
 Fetch the zone settings for this container. More...
 
void SetZoneSettings (const ZONE_SETTINGS &aSettings)
 Set the zone settings for this container. More...
 
virtual const wxPoint GetCenter () const
 Function GetCenter() More...
 
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...
 
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...
 
void SetTimeStamp (timestamp_t aNewTimeStamp)
 
timestamp_t GetTimeStamp () const
 
void SetParent (EDA_ITEM *aParent)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag)
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 

Static Public Member Functions

static 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...
 

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 int getNextNumberInSequence (const std::set< int > &aSeq, bool aFillSequenceGaps)
 

Protected Attributes

PCB_LAYER_ID m_Layer
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
timestamp_t m_TimeStamp
 Time stamp used for logical links. More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

Private 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
 
wxString m_Path
 
timestamp_t m_LastEditTime
 
int m_arflag
 
timestamp_t 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 109 of file class_module.h.

Constructor & Destructor Documentation

◆ MODULE() [1/2]

MODULE::MODULE ( BOARD parent)

Definition at line 49 of file class_module.cpp.

49  :
52 {
54  m_Layer = F_Cu;
55  m_Orient = 0;
57  m_arflag = 0;
58  m_CntRot90 = m_CntRot180 = 0;
59  m_Link = 0;
60  m_LastEditTime = 0;
61  m_LocalClearance = 0;
65  m_ZoneConnection = ZONE_CONNECTION::INHERITED; // Use zone setting by default
66  m_ThermalWidth = 0; // Use zone setting by default
67  m_ThermalGap = 0; // Use zone setting by default
68 
69  // These are special and mandatory text fields
72 
73  m_3D_Drawings.clear();
74 }
int m_CntRot90
Definition: class_module.h:713
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:700
double m_LocalSolderPasteMarginRatio
Definition: class_module.h:705
int m_LocalSolderPasteMargin
Definition: class_module.h:704
int m_ThermalGap
Definition: class_module.h:701
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed
Definition: class_module.h:716
#define MODULE_PADS_LOCKED
In autoplace: module waiting for autoplace.
Definition: class_module.h:298
timestamp_t m_LastEditTime
Definition: class_module.h:710
int m_LocalClearance
Definition: class_module.h:702
PCB_LAYER_ID m_Layer
double m_Orient
Definition: class_module.h:690
class MODULE, a footprint
Definition: typeinfo.h:89
ZONE_CONNECTION m_ZoneConnection
Definition: class_module.h:699
timestamp_t m_Link
Definition: class_module.h:712
int m_LocalSolderMaskMargin
Definition: class_module.h:703
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Definition: class_module.h:688
int m_arflag
Definition: class_module.h:711
default
Definition: class_module.h:73
int m_CntRot180
Definition: class_module.h:714
int m_ModuleStatus
Definition: class_module.h:696
TEXTE_MODULE * m_Value
Definition: class_module.h:693
TEXTE_MODULE * m_Reference
Definition: class_module.h:692
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
int m_Attributs
Definition: class_module.h:695

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

77  :
78  BOARD_ITEM_CONTAINER( aModule )
79 {
80  m_Pos = aModule.m_Pos;
81  m_fpid = aModule.m_fpid;
82  m_Attributs = aModule.m_Attributs;
84  m_Orient = aModule.m_Orient;
85  m_BoundaryBox = aModule.m_BoundaryBox;
86  m_CntRot90 = aModule.m_CntRot90;
87  m_CntRot180 = aModule.m_CntRot180;
89  m_Link = aModule.m_Link;
90  m_Path = aModule.m_Path; // is this correct behavior?
91 
98  m_ThermalGap = aModule.m_ThermalGap;
99 
100  // Copy reference and value.
101  m_Reference = new TEXTE_MODULE( *aModule.m_Reference );
102  m_Reference->SetParent( this );
103  m_Value = new TEXTE_MODULE( *aModule.m_Value );
104  m_Value->SetParent( this );
105 
106  // Copy auxiliary data: Pads
107  for( auto pad : aModule.Pads() )
108  {
109  Add( new D_PAD( *pad ) );
110  }
111 
112  // Copy auxiliary data: Zones
113  for( auto item : aModule.Zones() )
114  {
115  Add( static_cast<MODULE_ZONE_CONTAINER*>( item->Clone() ) );
116 
117  // Ensure the net info is OK and especially uses the net info list
118  // living in the current board
119  // Needed when copying a fp from fp editor that has its own board
120  // Must be NETINFO_LIST::ORPHANED_ITEM for a keepout that has no net.
121  item->SetNetCode( -1 );
122  }
123 
124  // Copy auxiliary data: Drawings
125  for( auto item : aModule.GraphicalItems() )
126  {
127  switch( item->Type() )
128  {
129  case PCB_MODULE_TEXT_T:
130  case PCB_MODULE_EDGE_T:
131  Add( static_cast<BOARD_ITEM*>( item->Clone() ) );
132  break;
133 
134  default:
135  wxLogMessage( wxT( "Class MODULE copy constructor internal error: unknown type" ) );
136  break;
137  }
138  }
139 
140  // Copy auxiliary data: 3D_Drawings info
141  m_3D_Drawings = aModule.m_3D_Drawings;
142 
143  m_Doc = aModule.m_Doc;
144  m_KeyWord = aModule.m_KeyWord;
145 
146  m_arflag = 0;
147 
148  // Ensure auxiliary data is up to date
150 
152  new wxArrayString( *aModule.m_initial_comments ) : 0;
153 }
LIB_ID m_fpid
Definition: class_module.h:694
int m_CntRot90
Definition: class_module.h:713
wxString m_KeyWord
Definition: class_module.h:708
wxString m_Path
Definition: class_module.h:709
int m_ThermalWidth
Definition: class_module.h:700
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
double m_LocalSolderPasteMarginRatio
Definition: class_module.h:705
int m_LocalSolderPasteMargin
Definition: class_module.h:704
int m_ThermalGap
Definition: class_module.h:701
PADS & Pads()
Definition: class_module.h:173
DRAWINGS & GraphicalItems()
Definition: class_module.h:183
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed
Definition: class_module.h:716
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
wxString m_Doc
Definition: class_module.h:707
timestamp_t m_LastEditTime
Definition: class_module.h:710
int m_LocalClearance
Definition: class_module.h:702
double m_Orient
Definition: class_module.h:690
EDA_RECT m_BoundaryBox
Definition: class_module.h:697
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
ZONE_CONNECTION m_ZoneConnection
Definition: class_module.h:699
timestamp_t m_Link
Definition: class_module.h:712
int m_LocalSolderMaskMargin
Definition: class_module.h:703
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Definition: class_module.h:688
int m_arflag
Definition: class_module.h:711
const MODULE_ZONE_CONTAINERS & Zones() const
Definition: class_module.h:188
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:714
int m_ModuleStatus
Definition: class_module.h:696
TEXTE_MODULE * m_Value
Definition: class_module.h:693
wxPoint m_Pos
Definition: class_module.h:691
TEXTE_MODULE * m_Reference
Definition: class_module.h:692
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
int m_Attributs
Definition: class_module.h:695

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

157 {
158  // Clean up the owned elements
159  delete m_Reference;
160  delete m_Value;
161  delete m_initial_comments;
162 
163  for( auto p : m_pads )
164  delete p;
165 
166  m_pads.clear();
167 
168  for( auto p : m_fp_zones )
169  delete p;
170 
171  m_fp_zones.clear();
172 
173  for( auto d : m_drawings )
174  delete d;
175 
176  m_drawings.clear();
177 }
PADS m_pads
Definition: class_module.h:686
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed
Definition: class_module.h:716
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:687
DRAWINGS m_drawings
Definition: class_module.h:685
TEXTE_MODULE * m_Value
Definition: class_module.h:693
TEXTE_MODULE * m_Reference
Definition: class_module.h:692

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

273 {
274  switch( aBoardItem->Type() )
275  {
276  case PCB_MODULE_TEXT_T:
277  // Only user text can be added this way.
278  assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS );
279 
280  // no break
281 
282  case PCB_MODULE_EDGE_T:
283  if( aMode == ADD_MODE::APPEND )
284  m_drawings.push_back( aBoardItem );
285  else
286  m_drawings.push_front( aBoardItem );
287  break;
288 
289  case PCB_PAD_T:
290  if( aMode == ADD_MODE::APPEND )
291  m_pads.push_back( static_cast<D_PAD*>( aBoardItem ) );
292  else
293  m_pads.push_front( static_cast<D_PAD*>( aBoardItem ) );
294  break;
295 
297  if( aMode == ADD_MODE::APPEND )
298  m_fp_zones.push_back( static_cast<MODULE_ZONE_CONTAINER*>( aBoardItem ) );
299  else
300  m_fp_zones.insert( m_fp_zones.begin(), static_cast<MODULE_ZONE_CONTAINER*>( aBoardItem ) );
301  break;
302 
303  default:
304  {
305  wxString msg;
306  msg.Printf( wxT( "MODULE::Add() needs work: BOARD_ITEM type (%d) not handled" ),
307  aBoardItem->Type() );
308  wxFAIL_MSG( msg );
309 
310  return;
311  }
312  }
313 
314  aBoardItem->ClearEditFlags();
315  aBoardItem->SetParent( this );
316 }
PADS m_pads
Definition: class_module.h:686
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:687
DRAWINGS m_drawings
Definition: class_module.h:685
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(), 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(), PCB_EDIT_FRAME::Create_MuWavePolygonShape(), MWAVE::CreateMicrowaveInductor(), PCB_EDIT_FRAME::CreateMuWaveBaseFootprint(), KI_TEST::DrawArc(), KI_TEST::DrawSegment(), Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), 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(), 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 790 of file class_module.cpp.

791 {
792  if( NULL == a3DModel )
793  return;
794 
795  if( !a3DModel->m_Filename.empty() )
796  m_3D_Drawings.push_back( *a3DModel );
797 
798  delete a3DModel;
799 }
#define NULL
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Definition: class_module.h:688
wxString m_Filename
The 3D shape filename in 3D library.
Definition: class_module.h:100

References m_3D_Drawings, MODULE_3D_SETTINGS::m_Filename, and NULL.

◆ BuildPolyCourtyard()

bool MODULE::BuildPolyCourtyard ( )

Used in DRC to build the courtyard area (a complex polygon) from graphic items put on the courtyard.

Returns
true if OK, or no courtyard defined, false only if the polygon cannot be built due to amalformed courtyard shape The polygon cannot be built if segments/arcs on courtyard layers cannot be grouped in a polygon.

Definition at line 1491 of file class_module.cpp.

1492 {
1495  // Build the courtyard area from graphic items on the courtyard.
1496  // Only PCB_MODULE_EDGE_T have meaning, graphic texts are ignored.
1497  // Collect items:
1498  std::vector< DRAWSEGMENT* > list_front;
1499  std::vector< DRAWSEGMENT* > list_back;
1500 
1501  for( auto item : GraphicalItems() )
1502  {
1503  if( item->GetLayer() == B_CrtYd && item->Type() == PCB_MODULE_EDGE_T )
1504  list_back.push_back( static_cast< DRAWSEGMENT* > ( item ) );
1505 
1506  if( item->GetLayer() == F_CrtYd && item->Type() == PCB_MODULE_EDGE_T )
1507  list_front.push_back( static_cast< DRAWSEGMENT* > ( item ) );
1508  }
1509 
1510  // Note: if no item found on courtyard layers, return true.
1511  // false is returned only when the shape defined on courtyard layers
1512  // is not convertible to a polygon
1513  if( !list_front.size() && !list_back.size() )
1514  return true;
1515 
1516  wxString error_msg;
1517 
1518  #define ARC_ERROR_MAX 0.02 /* error max in mm to approximate a arc by segments */
1519  bool success = ConvertOutlineToPolygon( list_front, m_poly_courtyard_front,
1520  &error_msg,
1521  (unsigned) Millimeter2iu( ARC_ERROR_MAX ) );
1522 
1523  if( success )
1524  {
1525  success = ConvertOutlineToPolygon( list_back, m_poly_courtyard_back,
1526  &error_msg,
1527  (unsigned) Millimeter2iu( ARC_ERROR_MAX ) );
1528  }
1529 
1530  if( !error_msg.IsEmpty() )
1531  {
1532  wxLogMessage( wxString::Format( _( "Processing courtyard of \"%s\": %s" ),
1533  GetChars( GetFPID().Format() ),
1534  error_msg) );
1535  }
1536 
1537  return success;
1538 }
SHAPE_POLY_SET m_poly_courtyard_back
Definition: class_module.h:722
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:219
#define ARC_ERROR_MAX
DRAWINGS & GraphicalItems()
Definition: class_module.h:183
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:721
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:101
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:31
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 120 of file class_module.h.

121  {
122  return aItem && PCB_MODULE_T == aItem->Type();
123  }
class MODULE, a footprint
Definition: typeinfo.h:89
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

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

264 {
265  // Force the ORPHANED dummy net info for all pads.
266  // ORPHANED dummy net does not depend on a board
267  for( auto pad : m_pads )
268  pad->SetNetCode( NETINFO_LIST::ORPHANED );
269 }
PADS m_pads
Definition: class_module.h:686
static const int ORPHANED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:467

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

Definition at line 235 of file base_struct.h.

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

References BRIGHTENED, and EDA_ITEM::ClearFlags().

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

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 256 of file base_struct.h.

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

References EDA_ITEM::m_Flags.

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

◆ ClearHighlighted()

void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 234 of file base_struct.h.

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

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 268 of file base_struct.h.

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

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 153 of file view_item.h.

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

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

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

◆ Clone()

EDA_ITEM * 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 899 of file class_module.cpp.

900 {
901  return new MODULE( *this );
902 }
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 1433 of file class_module.cpp.

1434 {
1435  double moduleArea = GetFootprintRect().GetArea();
1436  SHAPE_POLY_SET coveredRegion;
1437  addRect( coveredRegion, GetFootprintRect() );
1438 
1439  // build list of holes (covered areas not available for selection)
1440  SHAPE_POLY_SET holes;
1441 
1442  for( auto pad : m_pads )
1443  addRect( holes, pad->GetBoundingBox() );
1444 
1445  addRect( holes, m_Reference->GetBoundingBox() );
1446  addRect( holes, m_Value->GetBoundingBox() );
1447 
1448  for( int i = 0; i < aCollector.GetCount(); ++i )
1449  {
1450  BOARD_ITEM* item = aCollector[i];
1451 
1452  switch( item->Type() )
1453  {
1454  case PCB_TEXT_T:
1455  case PCB_MODULE_TEXT_T:
1456  case PCB_TRACE_T:
1457  case PCB_VIA_T:
1458  addRect( holes, item->GetBoundingBox() );
1459  break;
1460  default:
1461  break;
1462  }
1463  }
1464 
1465  SHAPE_POLY_SET uncoveredRegion;
1466 
1467  try
1468  {
1469  uncoveredRegion.BooleanSubtract( coveredRegion, holes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1470  uncoveredRegion.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1471  uncoveredRegion.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1472  }
1473  catch( ClipperLib::clipperException& )
1474  {
1475  // better to be conservative (this will result in the disambiguate dialog)
1476  return 1.0;
1477  }
1478 
1479  double uncoveredRegionArea = polygonArea( uncoveredRegion );
1480  double coveredArea = moduleArea - uncoveredRegionArea;
1481  double ratio = ( coveredArea / moduleArea );
1482 
1483  return std::min( ratio, 1.0 );
1484 }
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
PADS m_pads
Definition: class_module.h:686
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:116
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:693
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
TEXTE_MODULE * m_Reference
Definition: class_module.h:692
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.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

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_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 DRC_LIST_MARKERS::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 117 of file class_board_item.cpp.

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

References BOARD_ITEM::GetParent().

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

◆ Duplicate()

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

Function Duplicate Duplicate a given item within the module, without adding to the board.

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

Definition at line 1298 of file class_module.cpp.

1301 {
1302  BOARD_ITEM* new_item = NULL;
1303  D_PAD* new_pad = NULL;
1304  MODULE_ZONE_CONTAINER* new_zone = NULL;
1305 
1306  switch( aItem->Type() )
1307  {
1308  case PCB_PAD_T:
1309  {
1310  new_pad = new D_PAD( *static_cast<const D_PAD*>( aItem ) );
1311 
1312  if( aAddToModule )
1313  m_pads.push_back( new_pad );
1314 
1315  new_item = new_pad;
1316  break;
1317  }
1318 
1320  {
1321  new_zone = new MODULE_ZONE_CONTAINER( *static_cast<const MODULE_ZONE_CONTAINER*>( aItem ) );
1322 
1323  if( aAddToModule )
1324  m_fp_zones.push_back( new_zone );
1325 
1326  new_item = new_zone;
1327  break;
1328  }
1329 
1330  case PCB_MODULE_TEXT_T:
1331  {
1332  const TEXTE_MODULE* old_text = static_cast<const TEXTE_MODULE*>( aItem );
1333 
1334  // do not duplicate value or reference fields
1335  // (there can only be one of each)
1336  if( old_text->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
1337  {
1338  TEXTE_MODULE* new_text = new TEXTE_MODULE( *old_text );
1339 
1340  if( aAddToModule )
1341  Add( new_text );
1342 
1343  new_item = new_text;
1344  }
1345  break;
1346  }
1347 
1348  case PCB_MODULE_EDGE_T:
1349  {
1350  EDGE_MODULE* new_edge = new EDGE_MODULE(
1351  *static_cast<const EDGE_MODULE*>(aItem) );
1352 
1353  if( aAddToModule )
1354  Add( new_edge );
1355 
1356  new_item = new_edge;
1357  break;
1358  }
1359 
1360  case PCB_MODULE_T:
1361  // Ignore the module itself
1362  break;
1363 
1364  default:
1365  // Un-handled item for duplication
1366  wxASSERT_MSG( false, "Duplication not supported for items of class "
1367  + aItem->GetClass() );
1368  break;
1369  }
1370 
1371  if( aIncrementPadNumbers && new_pad && !new_pad->IsAperturePad() )
1372  {
1373  new_pad->IncrementPadName( true, true );
1374  }
1375 
1376  return new_item;
1377 }
bool IncrementPadName(bool aSkipUnconnectable, bool aFillSequenceGaps)
Function IncrementPadName.
Definition: class_pad.cpp:585
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:686
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
#define NULL
TEXT_TYPE GetType() const
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:687
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.
bool IsAperturePad() const
Definition: class_pad.h:452
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:828
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

References Add(), EDA_ITEM::GetClass(), TEXTE_MODULE::GetType(), D_PAD::IncrementPadName(), D_PAD::IsAperturePad(), 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, TEXTE_MODULE::TEXT_is_DIVERS, 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 690 of file class_module.cpp.

691 {
692  for( auto pad : m_pads )
693  {
694  if( pad->GetName() == aPadName )
695  return pad;
696  }
697 
698  return NULL;
699 }
PADS m_pads
Definition: class_module.h:686
#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 BOARD_ITEM::Flip ( const VECTOR2I aCentre,
bool  aFlipLeftRight 
)
inlineinherited

Definition at line 269 of file class_board_item.h.

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

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

◆ Flip() [2/2]

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

1092 {
1093  // Move module to its final position:
1094  wxPoint finalPos = m_Pos;
1095 
1096  // Now Flip the footprint.
1097  // Flipping a footprint is a specific transform:
1098  // it is not mirrored like a text.
1099  // We have to change the side, and ensure the footprint rotation is
1100  // modified accordint to the transform, because this parameter is used
1101  // in pick and place files, and when updating the footprint from library.
1102  // When flipped around the X axis (Y coordinates changed) orientation is negated
1103  // When flipped around the Y axis (X coordinates changed) orientation is 180 - old orient.
1104  // Because it is specfic to a footprint, we flip around the X axis, and after rotate 180 deg
1105 
1106  MIRROR( finalPos.y, aCentre.y );
1107 
1108  SetPosition( finalPos );
1109 
1110  // Flip layer
1111  SetLayer( FlipLayer( GetLayer() ) );
1112 
1113  // Reverse mirror orientation.
1114  m_Orient = -m_Orient;
1115 
1117 
1118  // Mirror pads to other side of board.
1119  for( auto pad : m_pads )
1120  pad->Flip( m_Pos, false );
1121 
1122  // Mirror zones to other side of board.
1123  for( auto zone : m_fp_zones )
1124  zone->Flip( m_Pos, aFlipLeftRight );
1125 
1126  // Mirror reference and value.
1127  m_Reference->Flip( m_Pos, false );
1128  m_Value->Flip( m_Pos, false );
1129 
1130  // Reverse mirror module graphics and texts.
1131  for( auto item : m_drawings )
1132  {
1133  switch( item->Type() )
1134  {
1135  case PCB_MODULE_EDGE_T:
1136  static_cast<EDGE_MODULE*>( item )->Flip( m_Pos, false );
1137  break;
1138 
1139  case PCB_MODULE_TEXT_T:
1140  static_cast<TEXTE_MODULE*>( item )->Flip( m_Pos, false );
1141  break;
1142 
1143  default:
1144  wxMessageBox( wxT( "MODULE::Flip() error: Unknown Draw Type" ) );
1145  break;
1146  }
1147  }
1148 
1149  // Now rotate 180 deg if required
1150  if( aFlipLeftRight )
1151  Rotate( aCentre, 1800.0 );
1152 
1154 }
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:686
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:346
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
double m_Orient
Definition: class_module.h:690
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:123
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:687
void SetPosition(const wxPoint &aPos) override
DRAWINGS m_drawings
Definition: class_module.h:685
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:693
wxPoint m_Pos
Definition: class_module.h:691
TEXTE_MODULE * m_Reference
Definition: class_module.h:692
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().

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

929 {
930  std::unordered_set<int> layers;
931 
932  for( auto item : m_drawings )
933  {
934  layers.insert( static_cast<int>( item->GetLayer() ) );
935  }
936 
937  if( aIncludePads )
938  {
939  for( auto pad : m_pads )
940  {
941  int pad_layers[KIGFX::VIEW::VIEW_MAX_LAYERS], pad_layers_count;
942  pad->ViewGetLayers( pad_layers, pad_layers_count );
943 
944  for( int i = 0; i < pad_layers_count; i++ )
945  layers.insert( pad_layers[i] );
946  }
947  }
948 
949  aCount = layers.size();
950  int i = 0;
951 
952  for( auto layer : layers )
953  aLayers[i++] = layer;
954 }
PADS m_pads
Definition: class_module.h:686
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:685

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

◆ GetArea()

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

Definition at line 417 of file class_module.cpp.

418 {
419  double w = std::abs( m_BoundaryBox.GetWidth() ) + aPadding;
420  double h = std::abs( m_BoundaryBox.GetHeight() ) + aPadding;
421  return w * h;
422 }
int GetWidth() const
Definition: eda_rect.h:119
EDA_RECT m_BoundaryBox
Definition: class_module.h:697
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:160
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

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

Referenced by ZONE_CONTAINER::BuildSmoothedPoly(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), TEXTE_PCB::Flip(), TRACK::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), BOARD_ITEM::GetBoard(), GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_ITEM::GetLayerName(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase(), VIA::GetMsgPanelInfoBase(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), VIA::GetSelectMenuText(), D_PAD::GetSelectMenuText(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), D_PAD::HitTest(), D_PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), TEXTE_PCB::Print(), PCB_TARGET::Print(), ZONE_CONTAINER::Print(), EDGE_MODULE::Print(), TRACK::Print(), TEXTE_MODULE::Print(), DIMENSION::Print(), DRAWSEGMENT::Print(), VIA::Print(), Print(), D_PAD::Print(), ZONE_CONTAINER::PrintFilledArea(), BOARD_CONNECTED_ITEM::SetNet(), BOARD_CONNECTED_ITEM::SetNetCode(), ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(), ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(), ViewBBox(), VIA::ViewGetLOD(), 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 471 of file class_module.cpp.

472 {
473  EDA_RECT area = GetFootprintRect();
474 
475  // Add in items not collected by GetFootprintRect():
476  for( auto item : m_drawings )
477  {
478  if( item->Type() != PCB_MODULE_EDGE_T )
479  area.Merge( item->GetBoundingBox() );
480  }
481 
482  area.Merge( m_Value->GetBoundingBox() );
483  area.Merge( m_Reference->GetBoundingBox() );
484 
485  return area;
486 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
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:685
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
TEXTE_MODULE * m_Value
Definition: class_module.h:693
TEXTE_MODULE * m_Reference
Definition: class_module.h:692

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

490 {
491  EDA_RECT area = GetFootprintRect();
492 
493  // Add in items not collected by GetFootprintRect():
494  for( auto item : m_drawings )
495  {
496  if( item->Type() != PCB_MODULE_EDGE_T )
497  area.Merge( item->GetBoundingBox() );
498  }
499 
500  if( m_Value->IsVisible() || aIncludeInvisibleText )
501  area.Merge( m_Value->GetBoundingBox() );
502 
503  if( m_Reference->IsVisible() || aIncludeInvisibleText )
504  area.Merge( m_Reference->GetBoundingBox() );
505 
506  return area;
507 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
bool IsVisible() const
Definition: eda_text.h:170
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:685
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
TEXTE_MODULE * m_Value
Definition: class_module.h:693
TEXTE_MODULE * m_Reference
Definition: class_module.h:692

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

525 {
526  SHAPE_POLY_SET poly;
527 
528  double orientation = GetOrientationRadians();
529 
530  MODULE temp = *this;
531  temp.SetOrientation( 0.0 );
532  BOX2I area = temp.GetFootprintRect();
533 
534  poly.NewOutline();
535 
536  VECTOR2I p = area.GetPosition();
537  poly.Append( p );
538  p.x = area.GetRight();
539  poly.Append( p );
540  p.y = area.GetBottom();
541  poly.Append( p );
542  p.x = area.GetX();
543  poly.Append( p );
544 
545  BOARD* board = GetBoard();
546  if( board )
547  {
548  int biggest_clearance = board->GetDesignSettings().GetBiggestClearanceValue();
549  poly.Inflate( biggest_clearance, 4 );
550  }
551 
552  poly.Inflate( Millimeter2iu( 0.01 ), 4 );
553  poly.Rotate( -orientation, m_Pos );
554 
555  return poly;
556 }
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 })
Function Rotate rotates all vertices by a given angle.
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:530
EDA_RECT GetFootprintRect() const
Function GetFootprintRect() Returns the area of the module footprint excluding any text.
coord_type GetBottom() const
Definition: box2.h:199
void Inflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Performs outline inflation/deflation.
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:217
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:160
void SetOrientation(double newangle)
wxPoint m_Pos
Definition: class_module.h:691
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 const wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

Function GetCenter()

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

Returns
centre point of the item

Reimplemented in DRAWSEGMENT.

Definition at line 98 of file class_board_item.h.

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

References BOARD_ITEM::GetPosition().

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

◆ GetClass()

wxString MODULE::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 577 of file class_module.h.

578  {
579  return wxT( "MODULE" );
580  }

Referenced by Visit().

◆ GetDescription()

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 260 of file base_struct.h.

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

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

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

◆ 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 508 of file class_module.h.

509  {
510  return m_pads.empty() ? nullptr : m_pads.front();
511  }
PADS m_pads
Definition: class_module.h:686

Referenced by GetTopLeftPad().

◆ GetFlag()

int MODULE::GetFlag ( ) const
inline

Definition at line 264 of file class_module.h.

264 { return m_arflag; }
int m_arflag
Definition: class_module.h:711

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

◆ GetFlags()

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

426 {
427  EDA_RECT area;
428 
429  area.SetOrigin( m_Pos );
430  area.SetEnd( m_Pos );
431  area.Inflate( Millimeter2iu( 0.25 ) ); // Give a min size to the area
432 
433  for( auto item : m_drawings )
434  {
435  if( item->Type() == PCB_MODULE_EDGE_T )
436  area.Merge( item->GetBoundingBox() );
437  }
438 
439  for( auto pad : m_pads )
440  area.Merge( pad->GetBoundingBox() );
441 
442  for( auto zone : m_fp_zones )
443  area.Merge( zone->GetBoundingBox() );
444 
445  return area;
446 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
PADS m_pads
Definition: class_module.h:686
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:687
DRAWINGS m_drawings
Definition: class_module.h:685
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxPoint m_Pos
Definition: class_module.h:691
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(), AR_AUTOPLACER::testModuleOnBoard(), and ViewBBox().

◆ GetFPID()

const LIB_ID& MODULE::GetFPID ( ) const
inline

Definition at line 219 of file class_module.h.

219 { return m_fpid; }
LIB_ID m_fpid
Definition: class_module.h:694

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(), MODULE_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 449 of file class_module.cpp.

450 {
451  EDA_RECT area;
452 
453  // We want the bounding box of the footprint pads at rot 0, not flipped
454  // Create such a image:
455  MODULE dummy( *this );
456 
457  dummy.SetPosition( wxPoint( 0, 0 ) );
458  if( dummy.IsFlipped() )
459  dummy.Flip( wxPoint( 0, 0 ) , false );
460 
461  if( dummy.GetOrientation() )
462  dummy.SetOrientation( 0 );
463 
464  for( auto pad : dummy.Pads() )
465  area.Merge( pad->GetBoundingBox() );
466 
467  return area;
468 }
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 661 of file class_module.h.

661 { 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:716

Referenced by PCB_IO::format().

◆ GetKeywords()

◆ GetLastEditTime()

timestamp_t MODULE::GetLastEditTime ( ) const
inline

Definition at line 349 of file class_module.h.

349 { return m_LastEditTime; }
timestamp_t m_LastEditTime
Definition: class_module.h:710

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

131 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

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

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

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

Returns
wxString containing the layer name associated with this item.

Definition at line 68 of file class_board_item.cpp.

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

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

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

◆ 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 D_PAD, VIA, and ZONE_CONTAINER.

Definition at line 139 of file class_board_item.h.

139 { 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(), DRC::doTrackDrc(), DRAWING_TOOL::DrawVia(), hash_board_item(), and POINT_EDITOR::OnSelectionChange().

◆ GetLink()

◆ GetLocalClearance()

int MODULE::GetLocalClearance ( ) const
inline

◆ GetLocalSolderMaskMargin()

int MODULE::GetLocalSolderMaskMargin ( ) const
inline

◆ GetLocalSolderPasteMargin()

int MODULE::GetLocalSolderPasteMargin ( ) const
inline

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

894 {
895  return module_xpm;
896 }
const BITMAP_OPAQUE module_xpm[1]
Definition: module.cpp:29

References module_xpm.

◆ GetMsgPanelInfo()

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

Reimplemented from EDA_ITEM.

Definition at line 559 of file class_module.cpp.

560 {
561  wxString msg;
562 
563  aList.emplace_back( MSG_PANEL_ITEM( m_Reference->GetShownText(), m_Value->GetShownText(), DARKCYAN ) );
564 
565  // Display last date the component was edited (useful in Module Editor).
566  wxDateTime date( static_cast<time_t>( m_LastEditTime ) );
567 
568  if( m_LastEditTime && date.IsValid() )
569  // Date format: see http://www.cplusplus.com/reference/ctime/strftime
570  msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year
571  else
572  msg = _( "Unknown" );
573 
574  aList.emplace_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) );
575 
576  // display schematic path
577  aList.emplace_back( MSG_PANEL_ITEM( _( "Netlist Path" ), m_Path, BROWN ) );
578 
579  // display the board side placement
580  aList.emplace_back( MSG_PANEL_ITEM( _( "Board Side" ),
581  IsFlipped()? _( "Back (Flipped)" ) : _( "Front" ), RED ) );
582 
583 
584  msg.Printf( wxT( "%zu" ), m_pads.size() );
585  aList.emplace_back( MSG_PANEL_ITEM( _( "Pads" ), msg, BLUE ) );
586 
587  msg = wxT( ".." );
588 
589  if( IsLocked() )
590  msg[0] = 'L';
591 
593  msg[1] = 'P';
594 
595  aList.emplace_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) );
596 
597  msg.Printf( wxT( "%.1f" ), GetOrientationDegrees() );
598  aList.emplace_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, BROWN ) );
599 
600  // Controls on right side of the dialog
601  switch( m_Attributs & 255 )
602  {
603  case 0:
604  msg = _( "Normal" );
605  break;
606 
607  case MOD_CMS:
608  msg = _( "Insert" );
609  break;
610 
611  case MOD_VIRTUAL:
612  msg = _( "Virtual" );
613  break;
614 
615  default:
616  msg = wxT( "???" );
617  break;
618  }
619 
620  aList.emplace_back( MSG_PANEL_ITEM( _( "Attributes" ), msg, BROWN ) );
621  aList.emplace_back( MSG_PANEL_ITEM( _( "Footprint" ), FROM_UTF8( m_fpid.Format().c_str() ), BLUE ) );
622 
623  if( m_3D_Drawings.empty() )
624  msg = _( "No 3D shape" );
625  else
626  msg = m_3D_Drawings.front().m_Filename;
627 
628  // Search the first active 3D shape in list
629 
630  aList.emplace_back( MSG_PANEL_ITEM( _( "3D-Shape" ), msg, RED ) );
631 
632  wxString doc, keyword;
633  doc.Printf( _( "Doc: %s" ), m_Doc );
634  keyword.Printf( _( "Key Words: %s" ), m_KeyWord );
635  aList.emplace_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) );
636 }
LIB_ID m_fpid
Definition: class_module.h:694
Definition: colors.h:57
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:62
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:292
wxString m_KeyWord
Definition: class_module.h:708
wxString m_Path
Definition: class_module.h:709
Definition: colors.h:61
Set for modules listed in the automatic insertion list (usually SMD footprints)
Definition: class_module.h:74
PADS m_pads
Definition: class_module.h:686
virtual wxString GetShownText() const override
Return the string actually shown after processing of the base text.
wxString m_Doc
Definition: class_module.h:707
timestamp_t m_LastEditTime
Definition: class_module.h:710
const char * c_str() const
Definition: utf8.h:107
#define MODULE_is_PLACED
In autoplace: module automatically placed.
Definition: class_module.h:296
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Definition: class_module.h:688
double GetOrientationDegrees() const
Definition: class_module.h:216
Definition: colors.h:60
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:301
UTF8 Format() const
Definition: lib_id.cpp:237
#define _(s)
Definition: 3d_actions.cpp:31
int m_ModuleStatus
Definition: class_module.h:696
Virtual component: when created by copper shapes on board (Like edge card connectors,...
Definition: class_module.h:76
TEXTE_MODULE * m_Value
Definition: class_module.h:693
TEXTE_MODULE * m_Reference
Definition: class_module.h:692
Definition: colors.h:45
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
int m_Attributs
Definition: class_module.h:695
Definition: colors.h:62

References _, BLACK, BLUE, BROWN, UTF8::c_str(), DARKCYAN, LIB_ID::Format(), FROM_UTF8(), GetOrientationDegrees(), TEXTE_MODULE::GetShownText(), IsFlipped(), IsLocked(), m_3D_Drawings, m_Attributs, m_Doc, m_fpid, m_KeyWord, m_LastEditTime, m_ModuleStatus, m_pads, m_Path, m_Reference, m_Value, MAGENTA, MOD_CMS, MOD_VIRTUAL, MODULE_is_PLACED, and RED.

Referenced by DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel().

◆ getNextNumberInSequence()

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

Definition at line 88 of file class_board_item.cpp.

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

Referenced by GetNextPadName().

◆ GetNextPadName()

wxString MODULE::GetNextPadName ( bool  aFillSequenceGaps) 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 1380 of file class_module.cpp.

1381 {
1382  std::set<int> usedNumbers;
1383 
1384  // Create a set of used pad numbers
1385  for( auto pad : m_pads )
1386  {
1387  int padNumber = GetTrailingInt( pad->GetName() );
1388  usedNumbers.insert( padNumber );
1389  }
1390 
1391  const int nextNum = getNextNumberInSequence( usedNumbers, aFillSequenceGaps );
1392 
1393  return wxString::Format( wxT( "%i" ), nextNum );
1394 }
PADS m_pads
Definition: class_module.h:686
static int getNextNumberInSequence(const std::set< int > &aSeq, bool aFillSequenceGaps)
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:650

References Format(), BOARD_ITEM::getNextNumberInSequence(), GetTrailingInt(), and m_pads.

◆ GetOrientation()

◆ GetOrientationDegrees()

double MODULE::GetOrientationDegrees ( ) const
inline

Definition at line 216 of file class_module.h.

216 { return m_Orient / 10.0; }
double m_Orient
Definition: class_module.h:690

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

◆ GetOrientationRadians()

double MODULE::GetOrientationRadians ( ) const
inline

Definition at line 217 of file class_module.h.

217 { return m_Orient * M_PI / 1800; }
double m_Orient
Definition: class_module.h:690

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

703 {
704  for( auto pad : m_pads )
705  {
706  // ... and on the correct layer.
707  if( !( pad->GetLayerSet() & aLayerMask ).any() )
708  continue;
709 
710  if( pad->HitTest( aPosition ) )
711  return pad;
712  }
713 
714  return NULL;
715 }
PADS m_pads
Definition: class_module.h:686
#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 738 of file class_module.cpp.

739 {
740  if( aIncludeNPTH )
741  return m_pads.size();
742 
743  unsigned cnt = 0;
744 
745  for( auto pad : m_pads )
746  {
747  if( pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
748  continue;
749 
750  cnt++;
751  }
752 
753  return cnt;
754 }
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
PADS m_pads
Definition: class_module.h:686

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

125 { return (BOARD_ITEM_CONTAINER*) m_Parent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:177
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(), EditToolSelectionFilter(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), EDGE_MODULE::GetMsgPanelInfo(), EDGE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetShownText(), SELECTION_TOOL::GuessSelectionCandidates(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::PlotTextModule(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), SwapItemData(), DRC::testCopperDrawItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), MODULE_ZONE_CONTAINER::ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetPath()

const wxString& MODULE::GetPath ( ) const
inline

◆ GetPlacementCost180()

int MODULE::GetPlacementCost180 ( ) const
inline

◆ GetPlacementCost90()

int MODULE::GetPlacementCost90 ( ) const
inline

◆ GetPolyCourtyardBack()

SHAPE_POLY_SET& MODULE::GetPolyCourtyardBack ( )
inline

Definition at line 667 of file class_module.h.

667 { return m_poly_courtyard_back; }
SHAPE_POLY_SET m_poly_courtyard_back
Definition: class_module.h:722

Referenced by AR_AUTOPLACER::buildFpAreas().

◆ 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 666 of file class_module.h.

666 { 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:721

Referenced by AR_AUTOPLACER::buildFpAreas().

◆ GetPosition()

const wxPoint MODULE::GetPosition ( ) const
inlineoverridevirtual

Implements BOARD_ITEM.

Definition at line 210 of file class_module.h.

210 { return m_Pos; }
wxPoint m_Pos
Definition: class_module.h:691

Referenced by PCB_BASE_FRAME::AddModuleToBoard(), PCAD2KICAD::PCB_PAD::AddToModule(), GRID_HELPER::computeAnchors(), ConvertOutlineToPolygon(), MWAVE::CreateMicrowaveInductor(), PCB_EDIT_FRAME::CreateMuWaveBaseFootprint(), 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(), 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(), PCB_EDITOR_CONTROL::PlaceModule(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), EDGE_MODULE::Print(), 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(), DRC::TestFootprints(), 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 436 of file class_module.h.

437  {
438  return m_Reference->GetText();
439  }
TEXTE_MODULE * m_Reference
Definition: class_module.h:692
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:123

Referenced by AR_AUTOPLACER::AutoplaceModules(), CollisionMatchesExpected(), DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange(), GERBER_WRITER::createDrillFile(), 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(), TEXTE_MODULE::GetShownText(), idf_export_module(), IncrementReference(), DIALOG_PAD_PROPERTIES::initValues(), GENERAL_COLLECTOR::Inspect(), InvalidMatchesExpected(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), EAGLE_PLUGIN::loadElements(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::PlotPad(), BRDITEMS_PLOTTER::PlotTextModule(), DIALOG_EXCHANGE_FOOTPRINTS::processModule(), BOARD_NETLIST_UPDATER::replaceComponent(), DRC::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 882 of file class_module.cpp.

883 {
884  wxString reference = GetReference();
885 
886  if( reference.IsEmpty() )
887  reference = _( "<no reference>" );
888 
889  return wxString::Format( _( "Footprint %s on %s" ), reference, GetLayerName() );
890 }
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:436
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:31
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 239 of file base_struct.h.

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

References EDA_ITEM::m_Status.

Referenced by SELECTION_TOOL::expandConnection(), TRACK::GetMsgPanelInfoBase_Common(), TRACK::IsLocked(), TRACK::Print(), and ZONE_CONTAINER::PrintFilledArea().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 252 of file base_struct.h.

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

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetThermalGap()

int MODULE::GetThermalGap ( ) const
inline

Definition at line 257 of file class_module.h.

257 { return m_ThermalGap; }
int m_ThermalGap
Definition: class_module.h:701

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

◆ GetThermalWidth()

int MODULE::GetThermalWidth ( ) const
inline

Definition at line 254 of file class_module.h.

254 { return m_ThermalWidth; }
int m_ThermalWidth
Definition: class_module.h:700

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

◆ GetTimeStamp()

◆ GetTopLeftPad()

D_PAD * MODULE::GetTopLeftPad ( )

Definition at line 718 of file class_module.cpp.

719 {
720  D_PAD* topLeftPad = GetFirstPad();
721 
722  for( auto p : m_pads )
723  {
724  wxPoint pnt = p->GetPosition(); // GetPosition() returns the center of the pad
725 
726  if( ( pnt.x < topLeftPad->GetPosition().x ) ||
727  ( ( topLeftPad->GetPosition().x == pnt.x ) &&
728  ( pnt.y < topLeftPad->GetPosition().y ) ) )
729  {
730  topLeftPad = p;
731  }
732  }
733 
734  return topLeftPad;
735 }
PADS m_pads
Definition: class_module.h:686
D_PAD * GetFirstPad() const
Gets the first pad in the list or NULL if none.
Definition: class_module.h:508
const wxPoint GetPosition() const override
Definition: class_pad.h:241

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

758 {
759  std::set<wxString> usedNames;
760 
761  // Create a set of used pad numbers
762  for( auto pad : m_pads )
763  {
764  // Skip pads not on copper layers (used to build complex
765  // solder paste shapes for instance)
766  if( ( pad->GetLayerSet() & LSET::AllCuMask() ).none() )
767  continue;
768 
769  // Skip pads with no name, because they are usually "mechanical"
770  // pads, not "electrical" pads
771  if( pad->GetName().IsEmpty() )
772  continue;
773 
774  if( !aIncludeNPTH )
775  {
776  // skip NPTH
777  if( pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
778  {
779  continue;
780  }
781  }
782 
783  usedNames.insert( pad->GetName() );
784  }
785 
786  return usedNames.size();
787 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:686
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
PADS m_pads
Definition: class_module.h:686

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

const wxString MODULE::GetValue ( ) const
inline

◆ GetZoneConnection()

ZONE_CONNECTION MODULE::GetZoneConnection ( ) const
inline

◆ GetZoneSettings()

const ZONE_SETTINGS& BOARD_ITEM_CONTAINER::GetZoneSettings ( ) const
inlineinherited

Fetch the zone settings for this container.

Definition at line 75 of file board_item_container.h.

76  {
77  return m_zoneSettings;
78  }

References BOARD_ITEM_CONTAINER::m_zoneSettings.

Referenced by PCB_IO::formatSetup(), PCB_BASE_FRAME::GetZoneSettings(), LEGACY_PLUGIN::loadSETUP(), and ZONE_CONTAINER::ZONE_CONTAINER().

◆ GraphicalItems() [1/2]

◆ GraphicalItems() [2/2]

const DRAWINGS& MODULE::GraphicalItems ( ) const
inline

Definition at line 193 of file class_module.h.

194  {
195  return m_drawings;
196  }
DRAWINGS m_drawings
Definition: class_module.h:685

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

1550 {
1551  // returns true if the given module has at lesat one non smd pin, such as through hole
1552 
1553  for( auto pad : Pads() )
1554  {
1555  if( pad->GetAttribute() != PAD_ATTRIB_SMD )
1556  return true;
1557  }
1558 
1559  return false;
1560 }
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:62
PADS & Pads()
Definition: class_module.h:173

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

640 {
641  EDA_RECT rect = m_BoundaryBox;
642  return rect.Inflate( aAccuracy ).Contains( aPosition );
643 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
EDA_RECT m_BoundaryBox
Definition: class_module.h:697
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.

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

653 {
654  EDA_RECT arect = aRect;
655  arect.Inflate( aAccuracy );
656 
657  if( aContained )
658  return arect.Contains( m_BoundaryBox );
659  else
660  {
661  // If the rect does not intersect the bounding box, skip any tests
662  if( !aRect.Intersects( GetBoundingBox() ) )
663  return false;
664 
665  // Determine if any elements in the MODULE intersect the rect
666  for( auto pad : m_pads )
667  {
668  if( pad->HitTest( arect, false, 0 ) )
669  return true;
670  }
671 
672  for( auto zone : m_fp_zones )
673  {
674  if( zone->HitTest( arect, false, 0 ) )
675  return true;
676  }
677 
678  for( auto item : m_drawings )
679  {
680  if( item->HitTest( arect, false, 0 ) )
681  return true;
682  }
683 
684  // No items were hit
685  return false;
686  }
687 }
PADS m_pads
Definition: class_module.h:686
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:697
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:687
DRAWINGS m_drawings
Definition: class_module.h:685
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
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 646 of file class_module.cpp.

647 {
648  return GetBoundingPoly().Collide( aPosition, aAccuracy );
649 }
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) const override
Function Collide Checks whether the point aP collides with the inside of the polygon set; if the poin...

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

Referenced by GENERAL_COLLECTOR::Inspect().

◆ IncrementFlag()

void MODULE::IncrementFlag ( )
inline

Definition at line 263 of file class_module.h.

263 { m_arflag += 1; }
int m_arflag
Definition: class_module.h:711

◆ IncrementReference()

void MODULE::IncrementReference ( int  aDelta)

Function IncrementReference Bumps the current reference by aDelta.

Definition at line 1397 of file class_module.cpp.

1398 {
1399  const auto& refdes = GetReference();
1400  SetReference( wxString::Format( wxT( "%s%i" ), UTIL::GetReferencePrefix( refdes ),
1401  GetTrailingInt( refdes ) + aDelta ) );
1402 }
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:436
void SetReference(const wxString &aReference)
Function SetReference.
Definition: class_module.h:446
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:650

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

108  {
109  return false;
110  }

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

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

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

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

◆ IsFlipped()

bool 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 292 of file class_module.h.

292 { 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(), PCB_EDITOR_CONTROL::PlaceModule(), C3D_RENDER_OGL_LEGACY::render_3D_module(), and DIALOG_TEXT_PROPERTIES::TransferDataToWindow().

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 225 of file base_struct.h.

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

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

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

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

1039 {
1040  const wxChar * invalids = StringLibNameInvalidChars( false );
1041 
1042  if( aName.find_first_of( invalids ) != std::string::npos )
1043  return false;
1044 
1045  return true;
1046 }
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 301 of file class_module.h.

302  {
303  return ( m_ModuleStatus & MODULE_is_LOCKED ) != 0;
304  }
#define MODULE_is_LOCKED
module LOCKED: no autoplace allowed
Definition: class_module.h:295
int m_ModuleStatus
Definition: class_module.h:696

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

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

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNetTie()

bool MODULE::IsNetTie ( ) const
inline

Definition at line 267 of file class_module.h.

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

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 D_PAD, TRACK, and ZONE_CONTAINER.

Definition at line 115 of file class_board_item.h.

116  {
117  return IsCopperLayer( GetLayer() );
118  }
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, and MARKER_PCB.

Definition at line 178 of file class_board_item.h.

179  {
180  return m_Layer == aLayer;
181  }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by CINFO3D_VISU::createLayers(), GENERAL_COLLECTOR::Inspect(), ZONE_CONTAINER::IsOnLayer(), and AR_MATRIX::TraceSegmentPcb().

◆ IsPlaced()

bool MODULE::IsPlaced ( ) const
inline

Definition at line 319 of file class_module.h.

319 { return m_ModuleStatus & MODULE_is_PLACED; }
#define MODULE_is_PLACED
In autoplace: module automatically placed.
Definition: class_module.h:296
int m_ModuleStatus
Definition: class_module.h:696

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_FIELD, and SCH_SHEET_PIN.

Definition at line 515 of file base_struct.h.

515 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 224 of file base_struct.h.

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

References IS_RESIZED, and EDA_ITEM::m_Flags.

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

◆ IsSelected()

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

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

form of testing.

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

Definition at line 189 of file class_board_item.h.

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

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

◆ IsType()

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

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

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

Reimplemented in SCH_LABEL, SCH_FIELD, and SCH_LINE.

Definition at line 284 of file base_struct.h.

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

References EOT, EDA_ITEM::m_StructType, and SCH_LOCATE_ANY_T.

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

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 222 of file base_struct.h.

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

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward() [1/2]

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

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

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

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

Definition at line 397 of file base_struct.h.

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

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

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

◆ IterateForward() [2/2]

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

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

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

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

Definition at line 418 of file base_struct.h.

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

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

◆ Matches() [1/2]

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

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

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

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

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

Definition at line 471 of file base_struct.h.

472  {
473  return false;
474  }

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

◆ Matches() [2/2]

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

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 153 of file base_struct.cpp.

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

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

◆ Models() [1/2]

◆ Models() [2/2]

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

Definition at line 206 of file class_module.h.

206 { return m_3D_Drawings; }
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Definition: class_module.h:688

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 237 of file class_board_item.h.

238  {
239  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
240  }
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.

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

◆ Move() [2/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 1064 of file class_module.cpp.

1065 {
1066  wxPoint newpos = m_Pos + aMoveVector;
1067  SetPosition( newpos );
1068 }
void SetPosition(const wxPoint &aPos) override
wxPoint m_Pos
Definition: class_module.h:691

References m_Pos, and SetPosition().

Referenced by moveFootprintsInArea().

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

1203 {
1204  /* Move the reference point of the footprint
1205  * the footprints elements (pads, outlines, edges .. ) are moved
1206  * but:
1207  * - the footprint position is not modified.
1208  * - the relative (local) coordinates of these items are modified
1209  * - Draw coordinates are updated
1210  */
1211 
1212 
1213  // Update (move) the relative coordinates relative to the new anchor point.
1214  wxPoint moveVector = aMoveVector;
1215  RotatePoint( &moveVector, -GetOrientation() );
1216 
1217  // Update of the reference and value.
1218  m_Reference->SetPos0( m_Reference->GetPos0() + moveVector );
1220  m_Value->SetPos0( m_Value->GetPos0() + moveVector );
1221  m_Value->SetDrawCoord();
1222 
1223  // Update the pad local coordinates.
1224  for( auto pad : m_pads )
1225  {
1226  pad->SetPos0( pad->GetPos0() + moveVector );
1227  pad->SetDrawCoord();
1228  }
1229 
1230  // Update the draw element coordinates.
1231  for( auto item : GraphicalItems() )
1232  {
1233  switch( item->Type() )
1234  {
1235  case PCB_MODULE_EDGE_T:
1236  {
1237  EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
1238  edge->Move( moveVector );
1239  }
1240  break;
1241 
1242  case PCB_MODULE_TEXT_T:
1243  {
1244  TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
1245  text->SetPos0( text->GetPos0() + moveVector );
1246  text->SetDrawCoord();
1247  }
1248  break;
1249 
1250  default:
1251  break;
1252  }
1253  }
1254 
1256 }
double GetOrientation() const
Definition: class_module.h:215
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
PADS m_pads
Definition: class_module.h:686
DRAWINGS & GraphicalItems()
Definition: class_module.h:183
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:693
TEXTE_MODULE * m_Reference
Definition: class_module.h:692

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 328 of file class_module.h.

328 { return m_ModuleStatus & MODULE_to_PLACE; }
#define MODULE_to_PLACE
In autoplace: module waiting for autoplace.
Definition: class_module.h:297
int m_ModuleStatus
Definition: class_module.h:696

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

208 {
209  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
210  GetChars( GetClass() ) ) );
211 
212  return false;
213 }
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:101
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 180 of file class_module.cpp.

181 {
182  BOARD_ITEM::operator=( aOther );
183 
184  m_Pos = aOther.m_Pos;
185  m_fpid = aOther.m_fpid;
186  m_Attributs = aOther.m_Attributs;
188  m_Orient = aOther.m_Orient;
189  m_BoundaryBox = aOther.m_BoundaryBox;
190  m_CntRot90 = aOther.m_CntRot90;
191  m_CntRot180 = aOther.m_CntRot180;
193  m_Link = aOther.m_Link;
194  m_Path = aOther.m_Path; //is this correct behavior?
195 
202  m_ThermalGap = aOther.m_ThermalGap;
203 
204  // Copy reference and value
205  *m_Reference = *aOther.m_Reference;
206  m_Reference->SetParent( this );
207  *m_Value = *aOther.m_Value;
208  m_Value->SetParent( this );
209 
210  // Copy auxiliary data: Pads
211  m_pads.clear();
212 
213  for( auto pad : aOther.Pads() )
214  {
215  Add( new D_PAD( *pad ) );
216  }
217 
218  // Copy auxiliary data: Zones
219  m_fp_zones.clear();
220 
221  for( auto item : aOther.Zones() )
222  {
223  Add( static_cast<MODULE_ZONE_CONTAINER*>( item->Clone() ) );
224 
225  // Ensure the net info is OK and especially uses the net info list
226  // living in the current board
227  // Needed when copying a fp from fp editor that has its own board
228  // Must be NETINFO_LIST::ORPHANED_ITEM for a keepout that has no net.
229  item->SetNetCode( -1 );
230  }
231 
232  // Copy auxiliary data: Drawings
233  m_drawings.clear();
234 
235  for( auto item : aOther.GraphicalItems() )
236  {
237  switch( item->Type() )
238  {
239  case PCB_MODULE_TEXT_T:
240  case PCB_MODULE_EDGE_T:
241  Add( static_cast<BOARD_ITEM*>( item->Clone() ) );
242  break;
243 
244  default:
245  wxLogMessage( wxT( "MODULE::operator=() internal error: unknown type" ) );
246  break;
247  }
248  }
249 
250  // Copy auxiliary data: 3D_Drawings info
251  m_3D_Drawings.clear();
252  m_3D_Drawings = aOther.m_3D_Drawings;
253  m_Doc = aOther.m_Doc;
254  m_KeyWord = aOther.m_KeyWord;
255 
256  // Ensure auxiliary data is up to date
258 
259  return *this;
260 }
LIB_ID m_fpid
Definition: class_module.h:694
int m_CntRot90
Definition: class_module.h:713
wxString m_KeyWord
Definition: class_module.h:708
wxString m_Path
Definition: class_module.h:709
int m_ThermalWidth
Definition: class_module.h:700
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
double m_LocalSolderPasteMarginRatio
Definition: class_module.h:705
int m_LocalSolderPasteMargin
Definition: class_module.h:704
int m_ThermalGap
Definition: class_module.h:701
PADS & Pads()
Definition: class_module.h:173
PADS m_pads
Definition: class_module.h:686
DRAWINGS & GraphicalItems()
Definition: class_module.h:183
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
wxString m_Doc
Definition: class_module.h:707
timestamp_t m_LastEditTime
Definition: class_module.h:710
int m_LocalClearance
Definition: class_module.h:702
double m_Orient
Definition: class_module.h:690
EDA_RECT m_BoundaryBox
Definition: class_module.h:697
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
ZONE_CONNECTION m_ZoneConnection
Definition: class_module.h:699
timestamp_t m_Link
Definition: class_module.h:712
int m_LocalSolderMaskMargin
Definition: class_module.h:703
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Definition: class_module.h:688
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:687
DRAWINGS m_drawings
Definition: class_module.h:685
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:188
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:714
int m_ModuleStatus
Definition: class_module.h:696
TEXTE_MODULE * m_Value
Definition: class_module.h:693
wxPoint m_Pos
Definition: class_module.h:691
TEXTE_MODULE * m_Reference
Definition: class_module.h:692
int m_Attributs
Definition: class_module.h:695

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 178 of file class_module.h.

179  {
180  return m_pads;
181  }
PADS m_pads
Definition: class_module.h:686

◆ PadsLocked()

bool MODULE::PadsLocked ( ) const
inline

Definition at line 337 of file class_module.h.

#define MODULE_PADS_LOCKED
In autoplace: module waiting for autoplace.
Definition: class_module.h:298
int m_ModuleStatus
Definition: class_module.h:696

References MODULE_PADS_LOCKED.

Referenced by EditToolSelectionFilter(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow().

◆ Print()

void MODULE::Print ( PCB_BASE_FRAME aFrame,
wxDC *  aDC,
const wxPoint aOffset = ZeroOffset 
)
overridevirtual

Function Print Prints the footprint to the aDC.

Parameters
aFrame= the current Frame
aDC= Current Device Context
aOffset= draw offset (usually wxPoint(0,0)

Implements BOARD_ITEM.

Definition at line 378 of file class_module.cpp.

379 {
380  for( auto pad : m_pads )
381  pad->Print( aFrame, aDC, aOffset );
382 
383  for( auto zone : m_fp_zones )
384  zone->Print( aFrame, aDC, aOffset );
385 
386  BOARD* brd = GetBoard();
387 
388  // Draw graphic items
390  m_Reference->Print( aFrame, aDC, aOffset );
391 
392  if( brd->IsElementVisible( LAYER_MOD_VALUES ) )
393  m_Value->Print( aFrame, aDC, aOffset );
394 
395  for( auto item : m_drawings )
396  {
397  switch( item->Type() )
398  {
399  case PCB_MODULE_TEXT_T:
400  case PCB_MODULE_EDGE_T:
401  item->Print( aFrame, aDC, aOffset );
402  break;
403 
404  default:
405  break;
406  }
407  }
408 }
show modules values (when texts are visibles)
PADS m_pads
Definition: class_module.h:686
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
void Print(PCB_BASE_FRAME *aFrame, wxDC *aDC, const wxPoint &aOffset=ZeroOffset) override
Function Print Print the text according to the footprint pos and orient.
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:687
DRAWINGS m_drawings
Definition: class_module.h:685
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:160
TEXTE_MODULE * m_Value
Definition: class_module.h:693
TEXTE_MODULE * m_Reference
Definition: class_module.h:692
show modules references (when texts are visibles)

References BOARD_ITEM::GetBoard(), BOARD::IsElementVisible(), LAYER_MOD_REFERENCES, LAYER_MOD_VALUES, m_drawings, m_fp_zones, m_pads, m_Reference, m_Value, PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, and TEXTE_MODULE::Print().

Referenced by BOARD::Print().

◆ Reference() [1/2]

◆ Reference() [2/2]

TEXTE_MODULE& MODULE::Reference ( ) const
inline

Definition at line 481 of file class_module.h.

481 { return *m_Reference; }
TEXTE_MODULE * m_Reference
Definition: class_module.h:692

◆ Remove()

void MODULE::Remove ( BOARD_ITEM aItem)
overridevirtual

Implements BOARD_ITEM_CONTAINER.

Definition at line 319 of file class_module.cpp.

320 {
321  switch( aBoardItem->Type() )
322  {
323  case PCB_MODULE_TEXT_T:
324  // Only user text can be removed this way.
325  wxCHECK_RET(
326  static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS,
327  "Please report this bug: Invalid remove operation on required text" );
328 
329  // no break
330 
331  case PCB_MODULE_EDGE_T:
332  for( auto it = m_drawings.begin(); it != m_drawings.end(); ++it )
333  {
334  if( *it == aBoardItem )
335  {
336  m_drawings.erase( it );
337  break;
338  }
339  }
340 
341  break;
342 
343  case PCB_PAD_T:
344  for( auto it = m_pads.begin(); it != m_pads.end(); ++it )
345  {
346  if( *it == static_cast<D_PAD*>( aBoardItem ) )
347  {
348  m_pads.erase( it );
349  break;
350  }
351  }
352 
353  break;
354 
356  for( auto it = m_fp_zones.begin(); it != m_fp_zones.end(); ++it )
357  {
358  if( *it == static_cast<MODULE_ZONE_CONTAINER*>( aBoardItem ) )
359  {
360  m_fp_zones.erase( it );
361  break;
362  }
363  }
364 
365  break;
366 
367  default:
368  {
369  wxString msg;
370  msg.Printf( wxT( "MODULE::Remove() needs work: BOARD_ITEM type (%d) not handled" ),
371  aBoardItem->Type() );
372  wxFAIL_MSG( msg );
373  }
374  }
375 }
PADS m_pads
Definition: class_module.h:686
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:687
DRAWINGS m_drawings
Definition: class_module.h:685
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95

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

181 {
182  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
183 
184  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
185  aSearchData.GetFindString() :
186  aSearchData.GetFindString().Upper() );
187 
188  if( result == wxNOT_FOUND )
189  return false;
190 
191  wxString prefix = aText.Left( result );
192  wxString suffix;
193 
194  if( aSearchData.GetFindString().length() + result < aText.length() )
195  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
196 
197  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
198  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
199  GetChars( suffix ) );
200 
201  aText = prefix + aSearchData.GetReplaceString() + suffix;
202 
203  return true;
204 }
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:101

References GetChars(), and traceFindReplace.

Referenced by SCH_FIELD::Replace(), EDA_TEXT::Replace(), SCH_SHEET::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_SHEET, SCH_TEXT, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 503 of file base_struct.h.

503 { return false; }

◆ Rotate() [1/2]

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

Definition at line 253 of file class_board_item.h.

254  {
255  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
256  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.

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

◆ Rotate() [2/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 1071 of file class_module.cpp.

1072 {
1073  double orientation = GetOrientation();
1074  double newOrientation = orientation + aAngle;
1075  wxPoint newpos = m_Pos;
1076  RotatePoint( &newpos, aRotCentre, aAngle );
1077  SetPosition( newpos );
1078  SetOrientation( newOrientation );
1079 
1080  m_Reference->KeepUpright( orientation, newOrientation );
1081  m_Value->KeepUpright( orientation, newOrientation );
1082 
1083  for( auto item : m_drawings )
1084  {
1085  if( item->Type() == PCB_MODULE_TEXT_T )
1086  static_cast<TEXTE_MODULE*>( item )->KeepUpright( orientation, newOrientation );
1087  }
1088 }
double GetOrientation() const
Definition: class_module.h:215
void KeepUpright(double aOldOrientation, double aNewOrientation)
Called when rotating the parent footprint.
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:685
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
void SetOrientation(double newangle)
TEXTE_MODULE * m_Value
Definition: class_module.h:693
wxPoint m_Pos
Definition: class_module.h:691
TEXTE_MODULE * m_Reference
Definition: class_module.h:692

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

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

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

906 {
907  try
908  {
909  for( auto pad : m_pads )
910  aFunction( static_cast<BOARD_ITEM*>( pad ) );
911 
912  for( auto zone : m_fp_zones )
913  aFunction( static_cast<MODULE_ZONE_CONTAINER*>( zone ) );
914 
915  for( auto drawing : m_drawings )
916  aFunction( static_cast<BOARD_ITEM*>( drawing ) );
917 
918  aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
919  aFunction( static_cast<BOARD_ITEM*>( m_Value ) );
920  }
921  catch( std::bad_function_call& )
922  {
923  DisplayError( NULL, wxT( "Error running MODULE::RunOnChildren" ) );
924  }
925 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:236
PADS m_pads
Definition: class_module.h:686
#define NULL
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:687
DRAWINGS m_drawings
Definition: class_module.h:685
TEXTE_MODULE * m_Value
Definition: class_module.h:693
TEXTE_MODULE * m_Reference
Definition: class_module.h:692

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

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

◆ SetAttributes()

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

Definition at line 231 of file base_struct.h.

231 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:255
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143

References BRIGHTENED, and EDA_ITEM::SetFlags().

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

◆ SetDescription()

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

Definition at line 223 of file class_module.h.

223 { m_Doc = aDoc; }
wxString m_Doc
Definition: class_module.h:707

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

◆ SetFlag()

void MODULE::SetFlag ( int  aFlag)
inline

Definition at line 262 of file class_module.h.

262 { m_arflag = aFlag; }
int m_arflag
Definition: class_module.h:711

Referenced by AR_AUTOPLACER::pickModule().

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 255 of file base_struct.h.

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

References EDA_ITEM::m_Flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddModuleToBoard(), PCBNEW_CONTROL::AppendBoard(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::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(), LIB_DRAWING_TOOLS::DrawShape(), SCH_EDIT_TOOL::Duplicate(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_VIEW::HighlightItem(), EDIT_POINTS_FACTORY::Make(), TRACKS_CLEANER::mergeCollinearSegments(), SCH_MOVE_TOOL::moveItem(), LIB_MOVE_TOOL::moveItem(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), 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::SetHighlighted(), 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_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::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 306 of file base_struct.h.

306 { m_forceVisible = aEnable; }
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:181

References EDA_ITEM::m_forceVisible.

◆ SetFPID()

◆ SetHighlighted()

void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 230 of file base_struct.h.

230 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:255
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

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

647  {
648  delete m_initial_comments;
649  m_initial_comments = aInitialComments;
650  }
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed
Definition: class_module.h:716

◆ SetIsPlaced()

void MODULE::SetIsPlaced ( bool  isPlaced)
inline

Definition at line 320 of file class_module.h.

321  {
322  if( isPlaced )
324  else
326  }
#define MODULE_is_PLACED
In autoplace: module automatically placed.
Definition: class_module.h:296
int m_ModuleStatus
Definition: class_module.h:696

References MODULE_is_PLACED.

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

◆ SetKeywords()

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

Definition at line 226 of file class_module.h.

226 { m_KeyWord = aKeywords; }
wxString m_KeyWord
Definition: class_module.h:708

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

◆ SetLastEditTime() [1/2]

◆ SetLastEditTime() [2/2]

void MODULE::SetLastEditTime ( )
inline

Definition at line 348 of file class_module.h.

348 { m_LastEditTime = time( NULL ); }
timestamp_t m_LastEditTime
Definition: class_module.h:710
#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 148 of file class_board_item.h.

149  {
150  // trap any invalid layers, then go find the caller and fix it.
151  // wxASSERT( unsigned( aLayer ) < unsigned( NB_PCB_LAYERS ) );
152  m_Layer = aLayer;
153  }
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(), PCB_EDIT_FRAME::Create_MuWavePolygonShape(), MWAVE::CreateMicrowaveInductor(), PCB_BASE_FRAME::CreateNewModule(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::drawSegment(), TEXTE_PCB::Flip(), PCB_TARGET::Flip(), EDGE_MODULE::Flip(), TRACK::Flip(), TEXTE_MODULE::Flip(), DRAWSEGMENT::Flip(), Flip(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), DSN::SPECCTRA_DB::makeTRACK(), 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(), GPCB_FPL_CACHE::parseMODULE(), 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(), TEXTE_MODULE::TEXTE_MODULE(), 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 311 of file class_module.h.

312  {
313  if( isLocked )
315  else
317  }
#define MODULE_is_LOCKED
module LOCKED: no autoplace allowed
Definition: class_module.h:295
int m_ModuleStatus
Definition: class_module.h:696

References MODULE_is_LOCKED.

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

◆ SetModified()

◆ SetNeedsPlaced()

void MODULE::SetNeedsPlaced ( bool  needsPlaced)
inline

Definition at line 329 of file class_module.h.

330  {
331  if( needsPlaced )
333  else
335  }
#define MODULE_to_PLACE
In autoplace: module waiting for autoplace.
Definition: class_module.h:297
int m_ModuleStatus
Definition: class_module.h:696

References MODULE_to_PLACE.

Referenced by AR_AUTOPLACER::AutoplaceModules().

◆ SetOrientation()

void MODULE::SetOrientation ( double  newangle)

Definition at line 1259 of file class_module.cpp.

1260 {
1261  double angleChange = newangle - m_Orient; // change in rotation
1262 
1263  NORMALIZE_ANGLE_180( newangle );
1264 
1265  m_Orient = newangle;
1266 
1267  for( auto pad : m_pads )
1268  {
1269  pad->SetOrientation( pad->GetOrientation() + angleChange );
1270  pad->SetDrawCoord();
1271  }
1272 
1273  for( auto zone : m_fp_zones )
1274  {
1275  zone->Rotate( GetPosition(), angleChange );
1276  }
1277 
1278  // Update of the reference and value.
1280  m_Value->SetDrawCoord();
1281 
1282  // Displace contours and text of the footprint.
1283  for( auto item : m_drawings )
1284  {
1285  if( item->Type() == PCB_MODULE_EDGE_T )
1286  {
1287  static_cast<EDGE_MODULE*>( item )->SetDrawCoord();
1288  }
1289  else if( item->Type() == PCB_MODULE_TEXT_T )
1290  {
1291  static_cast<TEXTE_MODULE*>( item )->SetDrawCoord();
1292  }
1293  }
1294 
1296 }
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
PADS m_pads
Definition: class_module.h:686
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:346
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
double m_Orient
Definition: class_module.h:690
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:687
DRAWINGS m_drawings
Definition: class_module.h:685
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
void SetDrawCoord()
Set absolute coordinates.
TEXTE_MODULE * m_Value
Definition: class_module.h:693
TEXTE_MODULE * m_Reference
Definition: class_module.h:692
const wxPoint GetPosition() const override
Definition: class_module.h:210

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_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 214 of file class_module.h.

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

◆ SetPadsLocked()

void MODULE::SetPadsLocked ( bool  aPadsLocked)
inline

Definition at line 339 of file class_module.h.

340  {
341  if( aPadsLocked )
343  else
345  }
#define MODULE_PADS_LOCKED
In autoplace: module waiting for autoplace.
Definition: class_module.h:298
int m_ModuleStatus
Definition: class_module.h:696

References MODULE_PADS_LOCKED.

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

◆ SetParent()

◆ SetPath()

void MODULE::SetPath ( const wxString &  aPath)
inline

◆ SetPlacementCost180()

void MODULE::SetPlacementCost180 ( int  aCost)
inline

◆ SetPlacementCost90()

void MODULE::SetPlacementCost90 ( int  aCost)
inline

◆ SetPosition()

void MODULE::SetPosition ( const wxPoint aPos)
overridevirtual

Implements BOARD_ITEM.

Definition at line 1157 of file class_module.cpp.

1158 {
1159  wxPoint delta = newpos - m_Pos;
1160 
1161  m_Pos += delta;
1162 
1163  m_Reference->EDA_TEXT::Offset( delta );
1164  m_Value->EDA_TEXT::Offset( delta );
1165 
1166  for( auto pad : m_pads )
1167  {
1168  pad->SetPosition( pad->GetPosition() + delta );
1169  }
1170 
1171  for( auto zone : m_fp_zones )
1172  zone->Move( delta );
1173 
1174  for( auto item : m_drawings )
1175  {
1176  switch( item->Type() )
1177  {
1178  case PCB_MODULE_EDGE_T:
1179  {
1180  EDGE_MODULE* pt_edgmod = (EDGE_MODULE*) item;
1181  pt_edgmod->SetDrawCoord();
1182  break;
1183  }
1184 
1185  case PCB_MODULE_TEXT_T:
1186  {
1187  TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
1188  text->EDA_TEXT::Offset( delta );
1189  break;
1190  }
1191 
1192  default:
1193  wxMessageBox( wxT( "Draw type undefined." ) );
1194  break;
1195  }
1196  }
1197 
1199 }
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
PADS m_pads
Definition: class_module.h:686
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
MODULE_ZONE_CONTAINERS m_fp_zones
Definition: class_module.h:687
virtual void SetPosition(const wxPoint &aPos) override
DRAWINGS m_drawings
Definition: class_module.h:685
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
TEXTE_MODULE * m_Value
Definition: class_module.h:693
wxPoint m_Pos
Definition: class_module.h:691
TEXTE_MODULE * m_Reference
Definition: class_module.h:692

References CalculateBoundingBox(), m_drawings, m_fp_zones, m_pads, m_Pos, m_Reference, m_Value, PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, EDGE_MODULE::SetDrawCoord(), and TEXTE_MODULE::SetPosition().

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_FRAME::AddModuleToBoard(), BOARD_NETLIST_UPDATER::addNewComponent(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), MWAVE::CreateMicrowaveInductor(), PCB_EDIT_FRAME::Exchange_Module(), Flip(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_EDIT_FRAME::Import_Module(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), EAGLE_PLUGIN::loadElements(), LEGACY_PLUGIN::loadMODULE(), Move(), EAGLE_PLUGIN::packageHole(), PCB_EDITOR_CONTROL::PlaceModule(), AR_AUTOPLACER::placeModule(), PCB_BASE_FRAME::PlaceModule(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), Rotate(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

◆ SetReference()

void MODULE::SetReference ( const wxString &  aReference)
inline

Function SetReference.

Parameters
aReferenceA reference to a wxString object containing the reference designator text.

Definition at line 446 of file class_module.h.

447  {
448  m_Reference->SetText( aReference );
449  }
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:111
TEXTE_MODULE * m_Reference
Definition: class_module.h:692

Referenced by PCB_BASE_FRAME::CreateNewModule(), IncrementReference(), EAGLE_PLUGIN::loadElements(), EAGLE_PLUGIN::loadPlain(), COMPONENT::SetModule(), and BOARD_NETLIST_UPDATER::updateComponentParameters().

◆ SetSelected()

void EDA_ITEM::SetSelected ( )
inlineinherited

◆ SetState()

void EDA_ITEM::SetState ( int  type,
int  state 
)
inlineinherited

Definition at line 244 of file base_struct.h.

245  {
246  if( state )
247  m_Status |= type; // state = ON or OFF
248  else
249  m_Status &= ~type;
250  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by LEGACY_PLUGIN::loadTrackList(), TRACKS_CLEANER::mergeCollinearSegments(), SELECTION_TOOL::selectConnectedTracks(), and TRACK::SetLocked().

◆ SetStatus()

void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited

Definition at line 253 of file base_struct.h.

253 { m_Status = aStatus; }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetThermalGap()

void MODULE::SetThermalGap ( int  aGap)
inline

Definition at line 256 of file class_module.h.

256 { m_ThermalGap = aGap; }
int m_ThermalGap
Definition: class_module.h:701

Referenced by LEGACY_PLUGIN::loadMODULE().

◆ SetThermalWidth()

void MODULE::SetThermalWidth ( int  aWidth)
inline

Definition at line 253 of file class_module.h.

253 { m_ThermalWidth = aWidth; }
int m_ThermalWidth
Definition: class_module.h:700

Referenced by LEGACY_PLUGIN::loadMODULE().

◆ SetTimeStamp()

void EDA_ITEM::SetTimeStamp ( timestamp_t  aNewTimeStamp)
inlineinherited

Definition at line 212 of file base_struct.h.

212 { m_TimeStamp = aNewTimeStamp; }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:178

References EDA_ITEM::m_TimeStamp.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_FRAME::AddModuleToBoard(), BOARD_NETLIST_UPDATER::addNewComponent(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), Diagnose(), SCH_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), DIALOG_FOOTPRINT_BOARD_EDITOR::EditFootprint(), EDIT_TOOL::EditFpInFpEditor(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), EDA_ITEM::initVars(), BOARD::InsertArea(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadPolygon(), SCH_EDIT_FRAME::LoadSheetFromFile(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), EDA_ITEM::operator=(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), PCB_PARSER::parseDIMENSION(), SCH_EDITOR_CONTROL::Paste(), PCB_EDITOR_CONTROL::PlaceModule(), SCH_EDIT_TOOL::RepeatDrawItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SHEET::SCH_SHEET(), SCH_COMPONENT::SetTimeStamp(), SimilarLabelsDiagnose(), SwapItemData(), TestDuplicateSheetNames(), DIALOG_ERC::TestErc(), and TestMultiunitFootprints().

◆ SetValue()

void MODULE::SetValue ( const wxString &  aValue)
inline

Function SetValue.

Parameters
aValueA reference to a wxString object containing the value text.

Definition at line 470 of file class_module.h.

471  {
472  m_Value->SetText( aValue );
473  }
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:111
TEXTE_MODULE * m_Value
Definition: class_module.h:693

Referenced by PCB_BASE_FRAME::CreateNewModule(), EAGLE_PLUGIN::loadElements(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), COMPONENT::SetModule(), and BOARD_NETLIST_UPDATER::updateComponentParameters().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 228 of file base_struct.h.

228 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:255
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:124

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ SetZoneConnection()

void MODULE::SetZoneConnection ( ZONE_CONNECTION  aType)
inline

◆ SetZoneSettings()

void BOARD_ITEM_CONTAINER::SetZoneSettings ( const ZONE_SETTINGS aSettings)
inlineinherited

Set the zone settings for this container.

Parameters
aSettingsnew Zone settings for this container

Definition at line 84 of file board_item_container.h.

85  {
86  m_zoneSettings = aSettings;
87  }

References BOARD_ITEM_CONTAINER::m_zoneSettings.

Referenced by LEGACY_PLUGIN::loadSETUP(), and PCB_BASE_FRAME::SetZoneSettings().

◆ ShowShape()

wxString BOARD_ITEM::ShowShape ( STROKE_T  aShape)
staticinherited

Function ShowShape converts the enum STROKE_T integer value to a wxString.

Definition at line 39 of file class_board_item.cpp.

40 {
41  switch( aShape )
42  {
43  case S_SEGMENT: return _( "Line" );
44  case S_RECT: return _( "Rect" );
45  case S_ARC: return _( "Arc" );
46  case S_CIRCLE: return _( "Circle" );
47  case S_CURVE: return _( "Bezier Curve" );
48  case S_POLYGON: return _( "Polygon" );
49  default: return wxT( "??" );
50  }
51 }
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
segment with non rounded ends
Arcs (with rounded ends)
Bezier Curve.
#define _(s)
Definition: 3d_actions.cpp:31

References _, S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, and S_SEGMENT.

Referenced by ConvertOutlineToPolygon(), DRAWSEGMENT::GetCenter(), EDGE_MODULE::GetSelectMenuText(), DRAWSEGMENT::GetSelectMenuText(), DSN::SPECCTRA_DB::makeIMAGE(), PAD_CS_PRIMITIVE::Rotate(), and DRAWSEGMENT::Rotate().

◆ Sort()

static bool EDA_ITEM::Sort ( const EDA_ITEM aLeft,
const EDA_ITEM aRight 
)
inlinestaticinherited

Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers.

Parameters
aLeftThe left hand item to compare.
aRightThe right hand item to compare.
Returns
True if aLeft is less than aRight.

Definition at line 534 of file base_struct.h.

534 { return *aLeft < *aRight; }

◆ StringLibNameInvalidChars()

const wxChar * MODULE::StringLibNameInvalidChars ( bool  aUserReadable)
static

static function StringLibNameInvalidChars Test for validity of the name in a library of the footprint ( no spaces, dir separators ...

)

Parameters
aUserReadable= false to get the list of invalid chars true to get a readable form (i.e ' ' = 'space' '\t'= 'tab')
Returns
a constant std::string giving the list of invalid chars in lib name

Definition at line 1049 of file class_module.cpp.

1050 {
1051  // This list of characters is also duplicated in validators.cpp and
1052  // lib_id.cpp
1053  // TODO: Unify forbidden character lists
1054  static const wxChar invalidChars[] = wxT("%$<>\t\n\r\"\\/:");
1055  static const wxChar invalidCharsReadable[] = wxT("% $ < > 'tab' 'return' 'line feed' \\ \" / :");
1056 
1057  if( aUserReadable )
1058  return invalidCharsReadable;
1059  else
1060  return invalidChars;
1061 }

Referenced by DIALOG_FOOTPRINT_FP_EDITOR::checkFootprintName(), IsLibNameValid(), and FOOTPRINT_EDIT_FRAME::SaveFootprintAs().

◆ SwapData()

void MODULE::SwapData ( BOARD_ITEM aImage)
overridevirtual

Swap data between aItem and aImage.

aItem and aImage should have the same type Used in undo redo command to swap values between an item and its copy Only values like layer, size .. which are modified by editing are swapped

Parameters
aImage= the item image which contains data to swap

Reimplemented from BOARD_ITEM.

Definition at line 1541 of file class_module.cpp.

1542 {
1543  assert( aImage->Type() == PCB_MODULE_T );
1544 
1545  std::swap( *((MODULE*) this), *((MODULE*) aImage) );
1546 }
class MODULE, a footprint
Definition: typeinfo.h:89
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

References PCB_MODULE_T, and EDA_ITEM::Type().

◆ TransformGraphicShapesWithClearanceToPolygonSet()

void MODULE::TransformGraphicShapesWithClearanceToPolygonSet ( PCB_LAYER_ID  aLayer,
SHAPE_POLY_SET aCornerBuffer,
int  aInflateValue,
int  aError = ARC_HIGH_DEF,
bool  aIncludeText = 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

Generate shapes of graphic items (outlines) as polygons added to a buffer.

Parameters
aLayer= the layer to consider, or UNDEFINED_LAYER to consider all
aCornerBuffer= the buffer to store polygons
aInflateValue= a value to inflate shapes aInflateValue = 0 to have the exact shape size
aError= Maximum error between true arc and polygon approx
aIncludeText= True to transform text shapes

@aCornerBuffer = the buffer to store polygons @aInflateValue = a value to inflate shapes @aError = the maximum error to allow when approximating curves with segments @aIncludeText = indicates footprint text items (reference, value, etc.) should be included in the outline

Definition at line 184 of file board_items_to_polygon_shape_transform.cpp.

188 {
189  std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
190 
191  for( auto item : GraphicalItems() )
192  {
193  switch( item->Type() )
194  {
195  case PCB_MODULE_TEXT_T:
196  {
197  TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
198 
199  if( ( aLayer != UNDEFINED_LAYER && text->GetLayer() == aLayer ) && text->IsVisible() )
200  texts.push_back( text );
201  }
202  break;
203 
204  case PCB_MODULE_EDGE_T:
205  {
206  EDGE_MODULE* outline = (EDGE_MODULE*) item;
207 
208  if( aLayer != UNDEFINED_LAYER && outline->GetLayer() != aLayer )
209  break;
210 
211  outline->TransformShapeWithClearanceToPolygon( aCornerBuffer, 0, aError );
212  }
213  break;
214 
215  default:
216  break;
217  }
218  }
219 
220  if( !aIncludeText )
221  return;
222 
223  // Convert texts sur modules
224  if( Reference().GetLayer() == aLayer && Reference().IsVisible() )
225  texts.push_back( &Reference() );
226 
227  if( Value().GetLayer() == aLayer && Value().IsVisible() )
228  texts.push_back( &Value() );
229 
230  prms.m_cornerBuffer = &aCornerBuffer;
231 
232  for(