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)
 
MODULENext () const
 
MODULEBack () const
 
void Add (BOARD_ITEM *aItem, ADD_MODE aMode=ADD_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...
 
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...
 
DLIST< D_PAD > & PadsList ()
 
const DLIST< D_PAD > & PadsList () const
 
DLIST< BOARD_ITEM > & GraphicalItemsList ()
 
const DLIST< BOARD_ITEM > & GraphicalItemsList () const
 
DLIST_ITERATOR_WRAPPER< D_PADPads ()
 
DLIST_ITERATOR_WRAPPER< BOARD_ITEMGraphicalItems ()
 
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 (ZoneConnection aType)
 
ZoneConnection 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) 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 Draw (EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
 Function Draw draws the footprint to the aDC. More...
 
void DrawOutlinesWhenMoving (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aMoveVector)
 Function DrawOutlinesWhenMoving draws in XOR mode the footprint when moving it to the aDC. More...
 
void TransformPadsShapesWithClearanceToPolygon (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, int aCircleToSegmentsCount, double aCorrectionFactor, 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 aCircleToSegmentsCount, double aCorrectionFactor, int aCircleToSegmentsCountForTexts=0, 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 aCircleToSegmentsCount, double aCorrectionFactor, int aCircleToSegmentsCountForTexts=0) const
 TransformGraphicTextWithClearanceToPolygonSet This function is the same as TransformGraphicShapesWithClearanceToPolygonSet but only generate text. More...
 
void DrawEdgesOnly (EDA_DRAW_PANEL *panel, wxDC *DC, const wxPoint &offset, GR_DRAWMODE draw_mode)
 Function DrawEdgesOnly Draws the footprint edges only to the current Device Context. More...
 
void DrawAncre (EDA_DRAW_PANEL *panel, wxDC *DC, const wxPoint &offset, int dim_ancre, GR_DRAWMODE draw_mode)
 Function DrawAncre Draw the anchor cross (vertical) Must be done after the pads, because drawing the hole will erase overwrite every thing already drawn. More...
 
void GetMsgPanelInfo (EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
 > More...
 
bool HitTest (const wxPoint &aPosition) const override
 Function HitTest tests if aPosition is contained within or on the bounding area of an item. More...
 
bool HitTestAccurate (const wxPoint &aPosition) const
 Tests if a point is inside the bounding polygon of the module. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained=true, int aAccuracy=0) const override
 Function HitTest tests if the aRect intersects or contains this object (depending on aContained). More...
 
const wxString & GetReference () const
 Function GetReference. More...
 
void SetReference (const wxString &aReference)
 Function SetReference. More...
 
wxString GetReferencePrefix () const
 Function GetReferencePrefix Gets the alphabetic prefix of the module reference - e.g. 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 ()
 
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_T aUnits) const override
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAP_DEF GetMenuImage () const override
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
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 CopyNetlistSettings (MODULE *aModule, bool aCopyLocalSettings)
 Function CopyNetlistSettings copies the netlist settings to aModule. 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 containter and deletes it. 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...
 
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...
 
virtual void UnLink ()
 Function UnLink detaches this object from its owner. More...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after UnLink()ing it from its owner if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
void Flip (const VECTOR2I &aCentre)
 
virtual BOARDGetBoard () const
 Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
wxString GetLayerName () const
 Function GetLayerName returns the name of the PCB layer on which the item resides. More...
 
virtual void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount, double aCorrectionFactor, 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
 
DHEADGetList () const
 
void SetNext (EDA_ITEM *aNext)
 
void SetBack (EDA_ITEM *aBack)
 
void SetParent (EDA_ITEM *aParent)
 
void SetList (DHEAD *aList)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool IsType (const KICAD_T aScanTypes[])
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 

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...
 
static std::string FormatInternalUnits (int aValue)
 Function FormatInternalUnits converts aValue from board internal units to a string appropriate for writing to file. More...
 
static std::string FormatInternalUnits (const wxPoint &aPoint)
 
static std::string FormatInternalUnits (const VECTOR2I &aPoint)
 
static std::string FormatInternalUnits (const wxSize &aSize)
 
static std::string FormatAngle (double aAngle)
 Function FormatAngle converts aAngle from board units to a string appropriate for writing to file. More...
 
static SEARCH_RESULT IterateForward (EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Static Public Attributes

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

Protected Attributes

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

Private Attributes

DLIST< D_PADm_Pads
 Linked list of pads. More...
 
DLIST< BOARD_ITEMm_Drawings
 Linked list of graphical items. More...
 
std::list< MODULE_3D_SETTINGSm_3D_Drawings
 Linked list of 3D models. More...
 
double m_Orient
 Orientation in tenths of a degree, 900=90.0 degrees. More...
 
wxPoint m_Pos
 Position of module on the board in internal units. More...
 
TEXTE_MODULEm_Reference
 Component reference designator value (U34, R18..) More...
 
TEXTE_MODULEm_Value
 Component value (74LS00, 22K..) More...
 
LIB_ID m_fpid
 The LIB_ID of the MODULE. More...
 
int m_Attributs
 Flag bits ( see Mod_Attribut ) More...
 
int m_ModuleStatus
 For autoplace: flags (LOCKED, AUTOPLACED) More...
 
EDA_RECT m_BoundaryBox
 Bounding box : coordinates on board, real orientation. More...
 
int m_ThermalWidth
 
int m_ThermalGap
 
wxString m_Doc
 File name and path for documentation file. More...
 
wxString m_KeyWord
 Search keywords to find module in library. More...
 
wxString m_Path
 
ZoneConnection m_ZoneConnection
 
timestamp_t m_LastEditTime
 
int m_arflag
 Use to trace ratsnest and auto routing. More...
 
timestamp_t m_Link
 Temporary logical link used during editing. More...
 
int m_CntRot90
 Horizontal automatic placement cost ( 0..10 ). More...
 
int m_CntRot180
 Vertical automatic placement cost ( 0..10 ). More...
 
int m_LocalClearance
 
int m_LocalSolderMaskMargin
 Solder mask margin. More...
 
int m_LocalSolderPasteMargin
 Solder paste margin absolute value. More...
 
double m_LocalSolderPasteMarginRatio
 Solder mask margin ratio value of pad size. More...
 
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 bot board sides. More...
 
SHAPE_POLY_SET m_poly_courtyard_back
 

Detailed Description

Definition at line 106 of file class_module.h.

Constructor & Destructor Documentation

MODULE::MODULE ( BOARD parent)

Definition at line 55 of file class_module.cpp.

References F_Cu, 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, PAD_ZONE_CONN_INHERITED, TEXTE_MODULE::TEXT_is_REFERENCE, and TEXTE_MODULE::TEXT_is_VALUE.

Referenced by Clone().

55  :
58 {
60  m_Layer = F_Cu;
61  m_Orient = 0;
63  m_arflag = 0;
64  m_CntRot90 = m_CntRot180 = 0;
65  m_Link = 0;
66  m_LastEditTime = 0;
67  m_LocalClearance = 0;
71  m_ZoneConnection = PAD_ZONE_CONN_INHERITED; // Use zone setting by default
72  m_ThermalWidth = 0; // Use zone setting by default
73  m_ThermalGap = 0; // Use zone setting by default
74 
75  // These are special and mandatory text fields
78 
79  m_3D_Drawings.clear();
80 }
int m_CntRot90
Horizontal automatic placement cost ( 0..10 ).
Definition: class_module.h:752
Class 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:743
double m_LocalSolderPasteMarginRatio
Solder mask margin ratio value of pad size.
Definition: class_module.h:761
int m_LocalSolderPasteMargin
Solder paste margin absolute value.
Definition: class_module.h:760
int m_ThermalGap
Definition: class_module.h:744
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed ...
Definition: class_module.h:764
#define MODULE_PADS_LOCKED
In autoplace: module waiting for autoplace.
Definition: class_module.h:264
timestamp_t m_LastEditTime
Definition: class_module.h:749
int m_LocalClearance
Definition: class_module.h:758
PCB_LAYER_ID m_Layer
double m_Orient
Orientation in tenths of a degree, 900=90.0 degrees.
Definition: class_module.h:733
class MODULE, a footprint
Definition: typeinfo.h:89
timestamp_t m_Link
Temporary logical link used during editing.
Definition: class_module.h:751
int m_LocalSolderMaskMargin
Solder mask margin.
Definition: class_module.h:759
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Linked list of 3D models.
Definition: class_module.h:732
int m_arflag
Use to trace ratsnest and auto routing.
Definition: class_module.h:750
default
Definition: class_module.h:75
int m_CntRot180
Vertical automatic placement cost ( 0..10 ).
Definition: class_module.h:753
int m_ModuleStatus
For autoplace: flags (LOCKED, AUTOPLACED)
Definition: class_module.h:739
TEXTE_MODULE * m_Value
Component value (74LS00, 22K..)
Definition: class_module.h:736
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
ZoneConnection m_ZoneConnection
Definition: class_module.h:748
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
int m_Attributs
Flag bits ( see Mod_Attribut )
Definition: class_module.h:738
MODULE::MODULE ( const MODULE aModule)

Definition at line 83 of file class_module.cpp.

References Add(), CalculateBoundingBox(), m_3D_Drawings, m_arflag, m_Attributs, m_BoundaryBox, m_CntRot180, m_CntRot90, m_Doc, m_Drawings, m_fpid, m_initial_comments, 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, BOARD_ITEM::Next(), D_PAD::Next(), PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, and EDA_ITEM::SetParent().

83  :
84  BOARD_ITEM_CONTAINER( aModule )
85 {
86  m_Pos = aModule.m_Pos;
87  m_fpid = aModule.m_fpid;
88  m_Attributs = aModule.m_Attributs;
90  m_Orient = aModule.m_Orient;
91  m_BoundaryBox = aModule.m_BoundaryBox;
92  m_CntRot90 = aModule.m_CntRot90;
93  m_CntRot180 = aModule.m_CntRot180;
95  m_Link = aModule.m_Link;
96  m_Path = aModule.m_Path; // is this correct behavior?
97 
103  m_ThermalWidth = aModule.m_ThermalWidth;
104  m_ThermalGap = aModule.m_ThermalGap;
105 
106  // Copy reference and value.
107  m_Reference = new TEXTE_MODULE( *aModule.m_Reference );
108  m_Reference->SetParent( this );
109  m_Value = new TEXTE_MODULE( *aModule.m_Value );
110  m_Value->SetParent( this );
111 
112  // Copy auxiliary data: Pads
113  for( D_PAD* pad = aModule.m_Pads; pad; pad = pad->Next() )
114  {
115  Add( new D_PAD( *pad ) );
116  }
117 
118  // Copy auxiliary data: Drawings
119  for( BOARD_ITEM* item = aModule.m_Drawings; item; item = item->Next() )
120  {
121  switch( item->Type() )
122  {
123  case PCB_MODULE_TEXT_T:
124  case PCB_MODULE_EDGE_T:
125  Add( static_cast<BOARD_ITEM*>( item->Clone() ) );
126  break;
127 
128  default:
129  wxLogMessage( wxT( "Class MODULE copy constructor internal error: unknown type" ) );
130  break;
131  }
132  }
133 
134  // Copy auxiliary data: 3D_Drawings info
135  m_3D_Drawings = aModule.m_3D_Drawings;
136 
137  m_Doc = aModule.m_Doc;
138  m_KeyWord = aModule.m_KeyWord;
139 
140  m_arflag = 0;
141 
142  // Ensure auxiliary data is up to date
144 
146  new wxArrayString( *aModule.m_initial_comments ) : 0;
147 }
LIB_ID m_fpid
The LIB_ID of the MODULE.
Definition: class_module.h:737
int m_CntRot90
Horizontal automatic placement cost ( 0..10 ).
Definition: class_module.h:752
wxString m_KeyWord
Search keywords to find module in library.
Definition: class_module.h:746
wxString m_Path
Definition: class_module.h:747
Class 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:743
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
double m_LocalSolderPasteMarginRatio
Solder mask margin ratio value of pad size.
Definition: class_module.h:761
int m_LocalSolderPasteMargin
Solder paste margin absolute value.
Definition: class_module.h:760
int m_ThermalGap
Definition: class_module.h:744
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed ...
Definition: class_module.h:764
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
wxString m_Doc
File name and path for documentation file.
Definition: class_module.h:745
timestamp_t m_LastEditTime
Definition: class_module.h:749
BOARD_ITEM * Next() const
int m_LocalClearance
Definition: class_module.h:758
double m_Orient
Orientation in tenths of a degree, 900=90.0 degrees.
Definition: class_module.h:733
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
>
EDA_RECT m_BoundaryBox
Bounding box : coordinates on board, real orientation.
Definition: class_module.h:740
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
D_PAD * Next() const
Definition: class_pad.h:160
timestamp_t m_Link
Temporary logical link used during editing.
Definition: class_module.h:751
int m_LocalSolderMaskMargin
Solder mask margin.
Definition: class_module.h:759
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Linked list of 3D models.
Definition: class_module.h:732
int m_arflag
Use to trace ratsnest and auto routing.
Definition: class_module.h:750
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
int m_CntRot180
Vertical automatic placement cost ( 0..10 ).
Definition: class_module.h:753
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
int m_ModuleStatus
For autoplace: flags (LOCKED, AUTOPLACED)
Definition: class_module.h:739
TEXTE_MODULE * m_Value
Component value (74LS00, 22K..)
Definition: class_module.h:736
wxPoint m_Pos
Position of module on the board in internal units.
Definition: class_module.h:734
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
ZoneConnection m_ZoneConnection
Definition: class_module.h:748
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
int m_Attributs
Flag bits ( see Mod_Attribut )
Definition: class_module.h:738
MODULE::~MODULE ( )

Definition at line 150 of file class_module.cpp.

References m_initial_comments, m_Reference, and m_Value.

151 {
152  delete m_Reference;
153  delete m_Value;
154  delete m_initial_comments;
155 }
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed ...
Definition: class_module.h:764
TEXTE_MODULE * m_Value
Component value (74LS00, 22K..)
Definition: class_module.h:736
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735

Member Function Documentation

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

>

Adds an item to the container.

Parameters
aItemis an item to be added.
aModedecides whether the item is added in the beginning or at the end of the list.

Implements BOARD_ITEM_CONTAINER.

Definition at line 252 of file class_module.cpp.

References ADD_APPEND, m_Drawings, m_Pads, PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, PCB_PAD_T, DLIST< T >::PushBack(), DLIST< T >::PushFront(), EDA_ITEM::SetParent(), TEXTE_MODULE::TEXT_is_DIVERS, and EDA_ITEM::Type().

Referenced by PCB_BASE_FRAME::GetFootprintFromBoardByReference(), InvokeDialogImportGfxModule(), InvokeDXFDialogModuleImport(), PCB_EDIT_FRAME::ListAndSelectModuleName(), MODULE(), operator=(), BOARD_COMMIT::Push(), CLIPBOARD_IO::SaveSelection(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), and DIALOG_NETLIST::verifyFootprints().

253 {
254  switch( aBoardItem->Type() )
255  {
256  case PCB_MODULE_TEXT_T:
257  // Only user texts can be added this way. Reference and value are not hold in the DLIST.
258  assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS );
259 
260  // no break
261 
262  case PCB_MODULE_EDGE_T:
263  if( aMode == ADD_APPEND )
264  m_Drawings.PushBack( aBoardItem );
265  else
266  m_Drawings.PushFront( aBoardItem );
267  break;
268 
269  case PCB_PAD_T:
270  if( aMode == ADD_APPEND )
271  m_Pads.PushBack( static_cast<D_PAD*>( aBoardItem ) );
272  else
273  m_Pads.PushFront( static_cast<D_PAD*>( aBoardItem ) );
274  break;
275 
276  default:
277  {
278  wxString msg;
279  msg.Printf( wxT( "MODULE::Add() needs work: BOARD_ITEM type (%d) not handled" ),
280  aBoardItem->Type() );
281  wxFAIL_MSG( msg );
282 
283  return;
284  }
285  }
286 
287  aBoardItem->SetParent( this );
288 
289  // Update relative coordinates, it can be done only after there is a parent object assigned
290  switch( aBoardItem->Type() )
291  {
292  case PCB_MODULE_TEXT_T:
293  static_cast<TEXTE_MODULE*>( aBoardItem )->SetLocalCoord();
294  break;
295 
296  case PCB_MODULE_EDGE_T:
297  static_cast<EDGE_MODULE*>( aBoardItem )->SetLocalCoord();
298  break;
299 
300  case PCB_PAD_T:
301  static_cast<D_PAD*>( aBoardItem )->SetLocalCoord();
302  break;
303 
304  default:
305  // Huh? It should have been filtered out by the previous switch
306  assert(false);
307  break;
308  }
309 }
void PushFront(T *aNewElement)
Function PushFront puts aNewElement at front of list sequence.
Definition: dlist.h:240
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
void PushBack(T *aNewElement)
Function PushBack puts aNewElement at the end of the list sequence.
Definition: dlist.h:250
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
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 799 of file class_module.cpp.

References m_3D_Drawings, and MODULE_3D_SETTINGS::m_Filename.

800 {
801  if( NULL == a3DModel )
802  return;
803 
804  if( !a3DModel->m_Filename.empty() )
805  m_3D_Drawings.push_back( *a3DModel );
806 
807  delete a3DModel;
808 }
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Linked list of 3D models.
Definition: class_module.h:732
wxString m_Filename
The 3D shape filename in 3D library.
Definition: class_module.h:102
MODULE* MODULE::Back ( ) const
inline

Definition at line 123 of file class_module.h.

References ADD_INSERT.

Referenced by DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules().

123 { return static_cast<MODULE*>( Pback ); }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:168
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 1450 of file class_module.cpp.

References B_CrtYd, ConvertOutlineToPolygon(), F_CrtYd, Format(), GetChars(), GetFPID(), GraphicalItemsList(), m_poly_courtyard_back, m_poly_courtyard_front, BOARD_ITEM::Next(), PCB_MODULE_EDGE_T, and SHAPE_POLY_SET::RemoveAllContours().

Referenced by AR_AUTOPLACER::buildFpAreas().

1451 {
1454  // Build the courtyard area from graphic items on the courtyard.
1455  // Only PCB_MODULE_EDGE_T have meaning, graphic texts are ignored.
1456  // Collect items:
1457  std::vector< DRAWSEGMENT* > list_front;
1458  std::vector< DRAWSEGMENT* > list_back;
1459 
1460  for( BOARD_ITEM* item = GraphicalItemsList(); item; item = item->Next() )
1461  {
1462  if( item->GetLayer() == B_CrtYd && item->Type() == PCB_MODULE_EDGE_T )
1463  list_back.push_back( static_cast< DRAWSEGMENT* > ( item ) );
1464 
1465  if( item->GetLayer() == F_CrtYd && item->Type() == PCB_MODULE_EDGE_T )
1466  list_front.push_back( static_cast< DRAWSEGMENT* > ( item ) );
1467  }
1468 
1469  // Note: if no item found on courtyard layers, return true.
1470  // false is returned only when the shape defined on courtyard layers
1471  // is not convertible to a polygon
1472  if( !list_front.size() && !list_back.size() )
1473  return true;
1474 
1475  wxString error_msg;
1476 
1477  bool success = ConvertOutlineToPolygon( list_front, m_poly_courtyard_front,
1478  &error_msg, (unsigned) Millimeter2iu( 0.05 ) );
1479 
1480  if( success )
1481  {
1482  success = ConvertOutlineToPolygon( list_back, m_poly_courtyard_back,
1483  &error_msg, (unsigned) Millimeter2iu( 0.05 ) );
1484  }
1485 
1486  if( !error_msg.IsEmpty() )
1487  {
1488  wxLogMessage( wxString::Format( _( "Processing courtyard of \"%s\": %s" ),
1489  GetChars( GetFPID().Format() ),
1490  error_msg) );
1491  }
1492 
1493  return success;
1494 }
SHAPE_POLY_SET m_poly_courtyard_back
Definition: class_module.h:770
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
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, which is expected to be a outline, therefore a closed main outline with perhaps closed inner outlines.
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
BOARD_ITEM * Next() const
const LIB_ID & GetFPID() const
Definition: class_module.h:192
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:769
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:92
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
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:165
void MODULE::CalculateBoundingBox ( )

Function CalculateBoundingBox calculates the bounding box in board coordinates.

Definition at line 463 of file class_module.cpp.

References GetFootprintRect(), and m_BoundaryBox.

Referenced by Abort_Move_ModuleOutline(), PCB_BASE_FRAME::AddPad(), PCAD2KICAD::PCB_MODULE::AddToBoard(), AR_AUTOPLACER::AutoplaceModules(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), CopyNetlistSettings(), PCB_EDIT_FRAME::Create_MuWaveComponent(), PCB_EDIT_FRAME::Create_MuWavePolygonShape(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), PCB_BASE_FRAME::DeletePad(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Width(), FOOTPRINT_EDIT_FRAME::End_Edge_Module(), Flip(), AR_AUTOPLACER::getOptimalModulePlacement(), LEGACY_PLUGIN::loadMODULE(), MODULE(), MoveAnchorPosition(), operator=(), AR_AUTOPLACER::pickModule(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_BASE_FRAME::PlacePad(), SetOrientation(), SetPosition(), ShowCurrentOutlineWhileMoving(), ShowNewEdgeModule(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and FOOTPRINT_EDIT_FRAME::Transform().

464 {
466 }
EDA_RECT m_BoundaryBox
Bounding box : coordinates on board, real orientation.
Definition: class_module.h:740
EDA_RECT GetFootprintRect() const
Function GetFootprintRect() Returns the area of the module footprint excluding any text...
static bool MODULE::ClassOf ( const EDA_ITEM aItem)
inlinestatic

Definition at line 117 of file class_module.h.

References PCB_MODULE_T, and EDA_ITEM::Type().

118  {
119  return PCB_MODULE_T == aItem->Type();
120  }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
class MODULE, a footprint
Definition: typeinfo.h:89
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 227 of file class_module.cpp.

References D_PAD::Next(), NETINFO_LIST::ORPHANED, and PadsList().

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

228 {
229  // Force the ORPHANED dummy net info for all pads.
230  // ORPHANED dummy net does not depend on a board
231  for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
232  pad->SetNetCode( NETINFO_LIST::ORPHANED );
233 }
D_PAD * Next() const
Definition: class_pad.h:160
static const int ORPHANED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:473
DLIST< D_PAD > & PadsList()
Definition: class_module.h:162
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 236 of file base_struct.h.

References BRIGHTENED, EDA_ITEM::ClearFlags(), and EDA_ITEM::SetModified().

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

236 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
void EDA_ITEM::ClearFlags ( STATUS_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 257 of file base_struct.h.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_Move_Pad(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortMoveAndEditTarget(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), AbortPinMove(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_EDIT_FRAME::addCurrentItemToScreen(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), LIB_EDIT_FRAME::BlockCopySelectedItems(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearHighlighted(), DRAG_LIST::ClearList(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), FOOTPRINT_EDIT_FRAME::End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Route(), PCB_EDIT_FRAME::End_Zone(), EraseDragList(), PCB_EDIT_FRAME::Exchange_Module(), ExitSheet(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), MarkItemsInBloc(), MirrorX(), MirrorY(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnOrient(), LIB_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), SCH_FIELD::Place(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_EDIT_FRAME::PlaceDimensionText(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::PlacePad(), PCB_EDIT_FRAME::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::PlaceTexteModule(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), BOARD_COMMIT::Revert(), PCB_BASE_FRAME::Rotate_Module(), RotateListOfItems(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SetRepeatItem(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

257 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 235 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

235 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:137
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
void EDA_ITEM::ClearSelected ( )
inlineinherited

Definition at line 234 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and SELECTED.

Referenced by POINT_EDITOR::addCorner(), EDIT_TOOL::Duplicate(), GAL_ARRAY_CREATOR::prePushAction(), SELECTION_TOOL::unhighlight(), and GERBVIEW_SELECTION_TOOL::unselectVisually().

234 { ClearFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:121
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
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 903 of file class_module.cpp.

References MODULE().

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

904 {
905  return new MODULE( *this );
906 }
MODULE(BOARD *parent)
void MODULE::CopyNetlistSettings ( MODULE aModule,
bool  aCopyLocalSettings 
)

Function CopyNetlistSettings copies the netlist settings to aModule.

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

The netlist settings are all of the MODULE settings not define by a MODULE in a netlist. These setting include placement prms (position, orientation, side) and optionally local prms( clearances, zone connection type, etc). The reference designator, value, path, and physical geometry settings are not copied.

Parameters
aModuleis the MODULE to copy the settings to.
aCopyLocalSettings= false to copy only module placement true to also copy local prms

Definition at line 341 of file class_module.cpp.

References CalculateBoundingBox(), D_PAD::CopyNetlistSettings(), FindPadByName(), Flip(), BOARD_ITEM::GetLayer(), GetLocalClearance(), GetLocalSolderMaskMargin(), GetLocalSolderPasteMargin(), GetLocalSolderPasteMarginRatio(), GetOrientation(), GetPosition(), GetThermalGap(), GetThermalWidth(), GetZoneConnection(), IsLocked(), D_PAD::Next(), PadsList(), Rotate(), SetLocalClearance(), SetLocalSolderMaskMargin(), SetLocalSolderPasteMargin(), SetLocalSolderPasteMarginRatio(), SetLocked(), SetPosition(), SetThermalGap(), SetThermalWidth(), and SetZoneConnection().

Referenced by PCB_EDIT_FRAME::Exchange_Module().

342 {
343  // Don't do anything foolish like trying to copy to yourself.
344  wxCHECK_RET( aModule != NULL && aModule != this, wxT( "Cannot copy to NULL or yourself." ) );
345 
346  // Not sure what to do with the value field. Use netlist for now.
347  aModule->SetPosition( GetPosition() );
348 
349  if( aModule->GetLayer() != GetLayer() )
350  aModule->Flip( aModule->GetPosition() );
351 
352  if( aModule->GetOrientation() != GetOrientation() )
353  aModule->Rotate( aModule->GetPosition(), GetOrientation() );
354 
355  aModule->SetLocked( IsLocked() );
356 
357  if( aCopyLocalSettings )
358  {
360  aModule->SetLocalClearance( GetLocalClearance() );
363  aModule->SetZoneConnection( GetZoneConnection() );
364  aModule->SetThermalWidth( GetThermalWidth() );
365  aModule->SetThermalGap( GetThermalGap() );
366  }
367 
368  for( D_PAD* pad = aModule->PadsList(); pad; pad = pad->Next() )
369  {
370  // Fix me: if aCopyLocalSettings == true, for "multiple" pads
371  // (set of pads having the same name/number) this is broken
372  // because we copy settings from the first pad found.
373  // When old and new footprints have very few differences, a better
374  // algo can be used.
375  D_PAD* oldPad = FindPadByName( pad->GetName() );
376 
377  if( oldPad )
378  oldPad->CopyNetlistSettings( pad, aCopyLocalSettings );
379  }
380 
381  // Not sure about copying description, keywords, 3D models or any other
382  // local user changes to footprint. Stick with the new footprint settings
383  // called out in the footprint loaded in the netlist.
384  aModule->CalculateBoundingBox();
385 }
void SetThermalGap(int aGap)
Definition: class_module.h:222
int GetThermalGap() const
Definition: class_module.h:223
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
void SetLocalClearance(int aClearance)
Definition: class_module.h:208
int GetLocalClearance() const
Definition: class_module.h:207
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
D_PAD * FindPadByName(const wxString &aPadName) const
Function FindPadByName returns a D_PAD* with a matching name.
void SetZoneConnection(ZoneConnection aType)
Definition: class_module.h:216
ZoneConnection GetZoneConnection() const
Definition: class_module.h:217
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_module.h:214
double GetLocalSolderPasteMarginRatio() const
Definition: class_module.h:213
double GetOrientation() const
Definition: class_module.h:188
D_PAD * Next() const
Definition: class_pad.h:160
void SetThermalWidth(int aWidth)
Definition: class_module.h:219
void SetPosition(const wxPoint &aPos) override
int GetLocalSolderMaskMargin() const
Definition: class_module.h:204
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:267
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_module.h:205
int GetLocalSolderPasteMargin() const
Definition: class_module.h:210
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_module.h:211
void SetLocked(bool isLocked) override
Function SetLocked sets the MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: class_module.h:277
DLIST< D_PAD > & PadsList()
Definition: class_module.h:162
const wxPoint GetPosition() const override
Definition: class_module.h:183
void CopyNetlistSettings(D_PAD *aPad, bool aCopyLocalSettings)
Function CopyNetlistSettings copies the netlist settings to aPad, and the net name.
Definition: class_pad.cpp:542
int GetThermalWidth() const
Definition: class_module.h:220
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 1401 of file class_module.cpp.

References addRect(), SHAPE_POLY_SET::BooleanSubtract(), ConvertOutlineToPolygon(), SHAPE_POLY_SET::Fracture(), EDA_RECT::GetArea(), TEXTE_MODULE::GetBoundingBox(), EDA_ITEM::GetBoundingBox(), COLLECTOR::GetCount(), GetFootprintRect(), i, m_Pads, m_Reference, m_Value, min, D_PAD::Next(), 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().

1402 {
1403  double moduleArea = GetFootprintRect().GetArea();
1404  SHAPE_POLY_SET coveredRegion;
1405  addRect( coveredRegion, GetFootprintRect() );
1406 
1407  // build list of holes (covered areas not available for selection)
1408  SHAPE_POLY_SET holes;
1409 
1410  for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
1411  addRect( holes, pad->GetBoundingBox() );
1412 
1413  addRect( holes, m_Reference->GetBoundingBox() );
1414  addRect( holes, m_Value->GetBoundingBox() );
1415 
1416  for( int i = 0; i < aCollector.GetCount(); ++i )
1417  {
1418  BOARD_ITEM* item = aCollector[i];
1419 
1420  switch( item->Type() )
1421  {
1422  case PCB_TEXT_T:
1423  case PCB_MODULE_TEXT_T:
1424  case PCB_TRACE_T:
1425  case PCB_VIA_T:
1426  addRect( holes, item->GetBoundingBox() );
1427  break;
1428  default:
1429  break;
1430  }
1431  }
1432 
1433  SHAPE_POLY_SET uncoveredRegion;
1434  uncoveredRegion.BooleanSubtract( coveredRegion, holes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1435  uncoveredRegion.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1436  uncoveredRegion.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1437 
1438  double uncoveredRegionArea = polygonArea( uncoveredRegion );
1439  double coveredArea = moduleArea - uncoveredRegionArea;
1440  double ratio = ( coveredArea / moduleArea );
1441 
1442  return std::min( ratio, 1.0 );
1443 }
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:114
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
static double polygonArea(SHAPE_POLY_SET &aPolySet)
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
static void addRect(SHAPE_POLY_SET &aPolySet, wxRect aRect)
double GetArea() const
Function GetArea returns the area of the rectangle.
Class SHAPE_POLY_SET.
EDA_RECT GetFootprintRect() const
Function GetFootprintRect() Returns the area of the module footprint excluding any text...
D_PAD * Next() const
Definition: class_pad.h:160
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...
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
size_t i
Definition: json11.cpp:597
TEXTE_MODULE * m_Value
Component value (74LS00, 22K..)
Definition: class_module.h:736
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset difference For aFastMode meaning, see function booleanOp ...
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
#define min(a, b)
Definition: auxiliary.h:85
virtual void BOARD_ITEM_CONTAINER::Delete ( BOARD_ITEM aItem)
inlinevirtualinherited

Removes an item from the containter and deletes it.

Parameters
aItemis an item to be deleted.

Definition at line 68 of file board_item_container.h.

References BOARD_ITEM_CONTAINER::Remove().

Referenced by DRC_LIST_MARKERS::DeleteItem(), BOARD_COMMIT::Push(), PCB_EDIT_FRAME::Remove_Zone_Corner(), BOARD::RemoveArea(), PCB_EDIT_FRAME::RemoveStruct(), and BOARD::~BOARD().

69  {
70  Remove( aItem );
71  delete aItem;
72  }
virtual void Remove(BOARD_ITEM *aItem)=0
Removes an item from the container.
void MODULE::Draw ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
GR_DRAWMODE  aDrawMode,
const wxPoint &  aOffset = ZeroOffset 
)
overridevirtual

Function Draw draws the footprint to the aDC.

Parameters
aPanel= draw panel, Used to know the clip box
aDC= Current Device Context
aDrawMode= GR_OR, GR_XOR..
aOffset= draw offset (usually wxPoint(0,0)

Implements BOARD_ITEM.

Definition at line 388 of file class_module.cpp.

References BROWN, DIM_ANCRE_MODULE, DO_NOT_DRAW, TEXTE_MODULE::Draw(), DrawAncre(), BOARD_ITEM::GetBoard(), EDA_DRAW_PANEL::GetClipBox(), GRRect(), BOARD::IsElementVisible(), EDA_ITEM::IsMoving(), LAYER_MOD_REFERENCES, LAYER_MOD_VALUES, m_BoundaryBox, m_Drawings, EDA_ITEM::m_Flags, m_Pads, m_Reference, m_Value, BOARD_ITEM::Next(), D_PAD::Next(), PCB_MODULE_EDGE_T, and PCB_MODULE_TEXT_T.

Referenced by Abort_MoveOrCopyModule(), PCB_EDIT_FRAME::Begin_Self(), PCB_EDIT_FRAME::Change_Side_Module(), PCB_EDIT_FRAME::Edit_Gap(), PCB_EDIT_FRAME::OnLeftClick(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::Rotate_Module(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

390 {
391  if( (m_Flags & DO_NOT_DRAW) || (IsMoving()) )
392  return;
393 
394  for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
395  {
396  if( pad->IsMoving() )
397  continue;
398 
399  pad->Draw( aPanel, aDC, aDrawMode, aOffset );
400  }
401 
402  BOARD* brd = GetBoard();
403 
404  // Draws footprint anchor
405  DrawAncre( aPanel, aDC, aOffset, DIM_ANCRE_MODULE, aDrawMode );
406 
407  // Draw graphic items
409  {
410  if( !(m_Reference->IsMoving()) )
411  m_Reference->Draw( aPanel, aDC, aDrawMode, aOffset );
412  }
413 
414  if( brd->IsElementVisible( LAYER_MOD_VALUES ) )
415  {
416  if( !(m_Value->IsMoving()) )
417  m_Value->Draw( aPanel, aDC, aDrawMode, aOffset );
418  }
419 
420  for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
421  {
422  if( item->IsMoving() )
423  continue;
424 
425  switch( item->Type() )
426  {
427  case PCB_MODULE_TEXT_T:
428  case PCB_MODULE_EDGE_T:
429  item->Draw( aPanel, aDC, aDrawMode, aOffset );
430  break;
431 
432  default:
433  break;
434  }
435  }
436 
437  // Enable these line to draw m_BoundaryBox (debug tests purposes only)
438 #if 0
439  GRRect( aPanel->GetClipBox(), aDC, m_BoundaryBox, 0, BROWN );
440 #endif
441 
442 }
bool IsMoving() const
Definition: base_struct.h:221
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
show modules values (when texts are visibles)
virtual EDA_RECT * GetClipBox()
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
void DrawAncre(EDA_DRAW_PANEL *panel, wxDC *DC, const wxPoint &offset, int dim_ancre, GR_DRAWMODE draw_mode)
Function DrawAncre Draw the anchor cross (vertical) Must be done after the pads, because drawing the ...
#define DIM_ANCRE_MODULE
Definition: pcbnew.h:63
BOARD_ITEM * Next() const
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1003
EDA_RECT m_BoundaryBox
Bounding box : coordinates on board, real orientation.
Definition: class_module.h:740
D_PAD * Next() const
Definition: class_pad.h:160
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw Draw the text according to the footprint pos and orient.
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:171
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
TEXTE_MODULE * m_Value
Component value (74LS00, 22K..)
Definition: class_module.h:736
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
show modules references (when texts are visibles)
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:126
Definition: colors.h:62
void MODULE::DrawAncre ( EDA_DRAW_PANEL panel,
wxDC *  DC,
const wxPoint &  offset,
int  dim_ancre,
GR_DRAWMODE  draw_mode 
)

Function DrawAncre Draw the anchor cross (vertical) Must be done after the pads, because drawing the hole will erase overwrite every thing already drawn.

Definition at line 236 of file class_module.cpp.

References BOARD_ITEM::GetBoard(), EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_PANEL::GetParent(), GRDrawAnchor(), GRSetDrawMode(), LAYER_ANCHOR, and m_Pos.

Referenced by Draw().

238 {
239  auto frame = (PCB_EDIT_FRAME*) panel->GetParent();
240 
241  GRSetDrawMode( DC, draw_mode );
242 
243  if( GetBoard()->IsElementVisible( LAYER_ANCHOR ) )
244  {
245  GRDrawAnchor( panel->GetClipBox(), DC, m_Pos.x, m_Pos.y,
246  dim_ancre,
247  frame->Settings().Colors().GetItemColor( LAYER_ANCHOR ) );
248  }
249 }
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
anchor of items having an anchor point (texts, footprints)
void GRDrawAnchor(EDA_RECT *aClipBox, wxDC *aDC, int x, int y, int aSize, COLOR4D aColor)
Definition: gr_basic.cpp:1193
virtual EDA_RECT * GetClipBox()
virtual EDA_DRAW_FRAME * GetParent() const =0
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
wxPoint m_Pos
Position of module on the board in internal units.
Definition: class_module.h:734
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
void MODULE::DrawEdgesOnly ( EDA_DRAW_PANEL panel,
wxDC *  DC,
const wxPoint &  offset,
GR_DRAWMODE  draw_mode 
)

Function DrawEdgesOnly Draws the footprint edges only to the current Device Context.

Parameters
panel= The active Draw Panel (used to know the clip box)
DC= current Device Context
offset= draw offset (usually wxPoint(0,0)
draw_mode= GR_OR, GR_XOR, GR_AND

Definition at line 445 of file class_module.cpp.

References m_Drawings, BOARD_ITEM::Next(), and PCB_MODULE_EDGE_T.

447 {
448  for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
449  {
450  switch( item->Type() )
451  {
452  case PCB_MODULE_EDGE_T:
453  item->Draw( panel, DC, draw_mode, offset );
454  break;
455 
456  default:
457  break;
458  }
459  }
460 }
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
BOARD_ITEM * Next() const
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
void MODULE::DrawOutlinesWhenMoving ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint &  aMoveVector 
)

Function DrawOutlinesWhenMoving draws in XOR mode the footprint when moving it to the aDC.

To speed up the drawing, only a simplified shape is drawn

Parameters
aPanel= draw panel, Used to know the clip box
aDC= Current Device Context
aMoveVector= the offset between the curr position and the draw position.

Definition at line 226 of file ratsnest.cpp.

References PCB_BASE_FRAME::build_ratsnest_module(), D_PAD::Draw(), EDA_DRAW_PANEL::GetDisplayOptions(), EDA_DRAW_PANEL::GetParent(), GR_XOR, D_PAD::Next(), and PCB_BASE_FRAME::TraceModuleRatsNest().

Referenced by Abort_MoveOrCopyModule(), PCB_EDIT_FRAME::Change_Side_Module(), MoveFootprint(), and PCB_BASE_FRAME::Rotate_Module().

228 {
229  int pad_fill_tmp;
230  D_PAD* pt_pad;
231 
232  DrawEdgesOnly( panel, DC, aMoveVector, GR_XOR );
233  auto displ_opts = (PCB_DISPLAY_OPTIONS*) ( panel->GetDisplayOptions() );
234 
235  // Show pads in sketch mode to speedu up drawings
236  pad_fill_tmp = displ_opts->m_DisplayPadFill;
237  displ_opts->m_DisplayPadFill = true;
238 
239  pt_pad = PadsList();
240 
241  for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
242  pt_pad->Draw( panel, DC, GR_XOR, aMoveVector );
243 
244  displ_opts->m_DisplayPadFill = pad_fill_tmp;
245 
246  if( displ_opts->m_Show_Module_Ratsnest )
247  {
248  PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
249  frame->build_ratsnest_module( this, aMoveVector );
250  frame->TraceModuleRatsNest( DC );
251  }
252 }
void TraceModuleRatsNest(wxDC *aDC)
Function TraceModuleRatsNest display the rats nest of a moving footprint, computed by build_ratsnest_...
Definition: ratsnest.cpp:139
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
void build_ratsnest_module(MODULE *aModule, wxPoint aMoveVector)
Function build_ratsnest_module Build a ratsnest relative to one footprint.
Definition: ratsnest.cpp:193
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
D_PAD * Next() const
Definition: class_pad.h:160
void DrawEdgesOnly(EDA_DRAW_PANEL *panel, wxDC *DC, const wxPoint &offset, GR_DRAWMODE draw_mode)
Function DrawEdgesOnly Draws the footprint edges only to the current Device Context.
DLIST< D_PAD > & PadsList()
Definition: class_module.h:162
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
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 1256 of file class_module.cpp.

References EDA_ITEM::GetClass(), TEXTE_MODULE::GetType(), GraphicalItemsList(), D_PAD::IncrementPadName(), D_PAD::IsAperturePad(), PadsList(), PCB_MODULE_EDGE_T, PCB_MODULE_T, PCB_MODULE_TEXT_T, PCB_PAD_T, DLIST< T >::PushBack(), TEXTE_MODULE::TEXT_is_DIVERS, and EDA_ITEM::Type().

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

1259 {
1260  BOARD_ITEM* new_item = NULL;
1261  D_PAD* new_pad = NULL;
1262 
1263  switch( aItem->Type() )
1264  {
1265  case PCB_PAD_T:
1266  {
1267  new_pad = new D_PAD( *static_cast<const D_PAD*>( aItem ) );
1268 
1269  if( aAddToModule )
1270  PadsList().PushBack( new_pad );
1271 
1272  new_item = new_pad;
1273  break;
1274  }
1275 
1276  case PCB_MODULE_TEXT_T:
1277  {
1278  const TEXTE_MODULE* old_text = static_cast<const TEXTE_MODULE*>( aItem );
1279 
1280  // do not duplicate value or reference fields
1281  // (there can only be one of each)
1282  if( old_text->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
1283  {
1284  TEXTE_MODULE* new_text = new TEXTE_MODULE( *old_text );
1285 
1286  if( aAddToModule )
1287  GraphicalItemsList().PushBack( new_text );
1288 
1289  new_item = new_text;
1290  }
1291  break;
1292  }
1293 
1294  case PCB_MODULE_EDGE_T:
1295  {
1296  EDGE_MODULE* new_edge = new EDGE_MODULE(
1297  *static_cast<const EDGE_MODULE*>(aItem) );
1298 
1299  if( aAddToModule )
1300  GraphicalItemsList().PushBack( new_edge );
1301 
1302  new_item = new_edge;
1303  break;
1304  }
1305 
1306  case PCB_MODULE_T:
1307  // Ignore the module itself
1308  break;
1309 
1310  default:
1311  // Un-handled item for duplication
1312  wxASSERT_MSG( false, "Duplication not supported for items of class "
1313  + aItem->GetClass() );
1314  break;
1315  }
1316 
1317  if( aIncrementPadNumbers && new_pad && !new_pad->IsAperturePad() )
1318  {
1319  new_pad->IncrementPadName( true, true );
1320  }
1321 
1322  return new_item;
1323 }
bool IncrementPadName(bool aSkipUnconnectable, bool aFillSequenceGaps)
Function IncrementPadName.
Definition: class_pad.cpp:531
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
bool IsAperturePad() const
Definition: class_pad.h:409
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
TEXT_TYPE GetType() const
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
void PushBack(T *aNewElement)
Function PushBack puts aNewElement at the end of the list sequence.
Definition: dlist.h:250
class MODULE, a footprint
Definition: typeinfo.h:89
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
virtual wxString GetClass() const =0
Function GetClass returns the class name.
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:165
DLIST< D_PAD > & PadsList()
Definition: class_module.h:162
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 699 of file class_module.cpp.

References m_Pads, and D_PAD::Next().

Referenced by CopyNetlistSettings(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), BOARD::ReplaceNetlist(), and BOARD_NETLIST_UPDATER::testConnectivity().

700 {
701  for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
702  {
703  if( pad->GetName().CmpNoCase( aPadName ) == 0 ) // why case insensitive?
704  return pad;
705  }
706 
707  return NULL;
708 }
D_PAD * Next() const
Definition: class_pad.h:160
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
void MODULE::Flip ( const wxPoint &  aCentre)
overridevirtual

Function Flip Flip this object, i.e.

change the board side for this object

Parameters
aCentre- the rotation point.

Mirror the Y position

Reimplemented from BOARD_ITEM.

Definition at line 1078 of file class_module.cpp.

References CalculateBoundingBox(), TEXTE_MODULE::Flip(), FlipLayer(), BOARD_ITEM::GetLayer(), m_Drawings, m_Orient, m_Pads, m_Pos, m_Reference, m_Value, MIRROR(), BOARD_ITEM::Next(), D_PAD::Next(), NORMALIZE_ANGLE_POS(), PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, BOARD_ITEM::SetLayer(), and SetPosition().

Referenced by PCB_BASE_FRAME::AddModuleToBoard(), PCB_EDIT_FRAME::Change_Side_Module(), CopyNetlistSettings(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_IO::FootprintSave(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), EAGLE_PLUGIN::orientModuleAndText(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

1079 {
1080  // Move module to its final position:
1081  wxPoint finalPos = m_Pos;
1082  MIRROR( finalPos.y, aCentre.y );
1083  SetPosition( finalPos );
1084 
1085  // Flip layer
1086  SetLayer( FlipLayer( GetLayer() ) );
1087 
1088  // Reverse mirror orientation.
1089  m_Orient = -m_Orient;
1091 
1092  // Mirror pads to other side of board about the x axis, i.e. vertically.
1093  for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
1094  pad->Flip( m_Pos );
1095 
1096  // Mirror reference and value.
1097  m_Reference->Flip( m_Pos );
1098  m_Value->Flip( m_Pos );
1099 
1100  // Reverse mirror module graphics and texts.
1101  for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
1102  {
1103  switch( item->Type() )
1104  {
1105  case PCB_MODULE_EDGE_T:
1106  ( (EDGE_MODULE*) item )->Flip( m_Pos );
1107  break;
1108 
1109  case PCB_MODULE_TEXT_T:
1110  static_cast<TEXTE_MODULE*>( item )->Flip( m_Pos );
1111  break;
1112 
1113  default:
1114  wxMessageBox( wxT( "MODULE::Flip() error: Unknown Draw Type" ) );
1115  break;
1116  }
1117  }
1118 
1120 }
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:475
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:241
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
BOARD_ITEM * Next() const
double m_Orient
Orientation in tenths of a degree, 900=90.0 degrees.
Definition: class_module.h:733
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:111
D_PAD * Next() const
Definition: class_pad.h:160
void Flip(const wxPoint &aCentre) override
Flip entity during module flip.
void SetPosition(const wxPoint &aPos) override
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
TEXTE_MODULE * m_Value
Component value (74LS00, 22K..)
Definition: class_module.h:736
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
wxPoint m_Pos
Position of module on the board in internal units.
Definition: class_module.h:734
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
void BOARD_ITEM::Flip ( const VECTOR2I aCentre)
inlineinherited

Definition at line 271 of file class_board_item.h.

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

272  {
273  Flip( wxPoint( aCentre.x, aCentre.y ) );
274  }
virtual void Flip(const wxPoint &aCentre)
Function Flip Flip this object, i.e.
std::string BOARD_ITEM::FormatAngle ( double  aAngle)
staticinherited

Function FormatAngle converts aAngle from board units to a string appropriate for writing to file.

Note
Internal angles for board items can be either degrees or tenths of degree on how KiCad is built.
Parameters
aAngleA angle value to convert.
Returns
A std::string object containing the converted angle.

Definition at line 171 of file class_board_item.cpp.

Referenced by BOARD_ITEM::HitTest().

172 {
173  char temp[50];
174 
175  int len = snprintf( temp, sizeof(temp), "%.10g", aAngle / 10.0 );
176 
177  return std::string( temp, len );
178 }
std::string BOARD_ITEM::FormatInternalUnits ( int  aValue)
staticinherited

Function FormatInternalUnits converts aValue from board internal units to a string appropriate for writing to file.

Note
Internal units for board items can be either deci-mils or nanometers depending on how KiCad is build.
Parameters
aValueA coordinate value to convert.
Returns
A std::string object containing the converted value.

Definition at line 90 of file class_board_item.cpp.

Referenced by checkConnectedTo(), BOARD_ITEM::FormatInternalUnits(), BOARD_ITEM::HitTest(), and BOARD::TracksInNetBetweenPoints().

91 {
92 #if 1
93 
94  char buf[50];
95  int len;
96  double mm = aValue / IU_PER_MM;
97 
98  if( mm != 0.0 && fabs( mm ) <= 0.0001 )
99  {
100  len = sprintf( buf, "%.10f", mm );
101 
102  while( --len > 0 && buf[len] == '0' )
103  buf[len] = '\0';
104 
105  if( buf[len] == '.' )
106  buf[len] = '\0';
107  else
108  ++len;
109  }
110  else
111  {
112  len = sprintf( buf, "%.10g", mm );
113  }
114 
115  return std::string( buf, len );
116 
117 #else
118 
119  // Assume aValue is in nanometers, and that we want the result in millimeters,
120  // and that int is 32 bits wide. Then perform an alternative algorithm.
121  // Can be used to verify that the above algorithm is correctly generating text.
122  // Convert aValue into an integer string, then insert a decimal point manually.
123  // Results are the same as above general purpose algorithm.
124 
125  wxASSERT( sizeof(int) == 4 );
126 
127  if( aValue == 0 )
128  return std::string( 1, '0' );
129  else
130  {
131  char buf[50];
132  int len = sprintf( buf, aValue > 0 ? "%06d" : "%07d", aValue ); // optionally pad w/leading zeros
133 
134  std::string ret( buf, len );
135 
136  std::string::iterator it = ret.end() - 1; // last byte
137 
138  // insert '.' at 6 positions from end, dividing by 10e6 (a million), nm => mm
139  std::string::iterator decpoint = ret.end() - 6;
140 
141  // truncate trailing zeros, up to decimal point position
142  for( ; *it=='0' && it >= decpoint; --it )
143  ret.erase( it ); // does not invalidate iterators it or decpoint
144 
145  if( it >= decpoint )
146  {
147  ret.insert( decpoint, '.' );
148 
149  // decpoint is invalidated here, after insert()
150 
151 #if 1 // want a leading zero when decimal point is in first position?
152  if( ret[0] == '.' )
153  {
154  // insert leading zero ahead of decimal point.
155  ret.insert( ret.begin(), '0' );
156  }
157  else if( ret[0]=='-' && ret[1]=='.' )
158  {
159  ret.insert( ret.begin() + 1, '0' );
160  }
161 #endif
162  }
163 
164  return ret;
165  }
166 
167 #endif
168 }
std::string BOARD_ITEM::FormatInternalUnits ( const wxPoint &  aPoint)
staticinherited

Definition at line 181 of file class_board_item.cpp.

References BOARD_ITEM::FormatInternalUnits().

182 {
183  return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
184 }
static std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from board internal units to a string appropriate for wr...
std::string BOARD_ITEM::FormatInternalUnits ( const VECTOR2I aPoint)
staticinherited

Definition at line 187 of file class_board_item.cpp.

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

188 {
189  return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
190 }
static std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from board internal units to a string appropriate for wr...
std::string BOARD_ITEM::FormatInternalUnits ( const wxSize &  aSize)
staticinherited

Definition at line 193 of file class_board_item.cpp.

References BOARD_ITEM::FormatInternalUnits().

194 {
195  return FormatInternalUnits( aSize.GetWidth() ) + " " + FormatInternalUnits( aSize.GetHeight() );
196 }
static std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from board internal units to a string appropriate for wr...
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 929 of file class_module.cpp.

References i, m_Drawings, m_Pads, BOARD_ITEM::Next(), D_PAD::Next(), and KIGFX::VIEW::VIEW_MAX_LAYERS.

930 {
931  std::unordered_set<int> layers;
932 
933  for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
934  {
935  layers.insert( static_cast<int>( item->GetLayer() ) );
936  }
937 
938  if( aIncludePads )
939  {
940  for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
941  {
942  int pad_layers[KIGFX::VIEW::VIEW_MAX_LAYERS], pad_layers_count;
943  pad->ViewGetLayers( pad_layers, pad_layers_count );
944 
945  for( int i = 0; i < pad_layers_count; i++ )
946  layers.insert( pad_layers[i] );
947  }
948  }
949 
950  aCount = layers.size();
951  int i = 0;
952 
953  for( auto layer : layers )
954  aLayers[i++] = layer;
955 }
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:699
BOARD_ITEM * Next() const
D_PAD * Next() const
Definition: class_pad.h:160
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
size_t i
Definition: json11.cpp:597
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
double MODULE::GetArea ( int  aPadding = 0) const

Definition at line 469 of file class_module.cpp.

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

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

470 {
471  double w = std::abs( m_BoundaryBox.GetWidth() ) + aPadding;
472  double h = std::abs( m_BoundaryBox.GetHeight() ) + aPadding;
473  return w * h;
474 }
int GetHeight() const
Definition: eda_rect.h:118
#define abs(a)
Definition: auxiliary.h:84
EDA_RECT m_BoundaryBox
Bounding box : coordinates on board, real orientation.
Definition: class_module.h:740
int GetWidth() const
Definition: eda_rect.h:117
BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 64 of file class_board_item.cpp.

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

Referenced by DIALOG_GEN_FOOTPRINT_POSITION::CreateFiles(), DeleteMarkedItems(), TEXTE_PCB::Draw(), PCB_TARGET::Draw(), EDGE_MODULE::Draw(), ZONE_CONTAINER::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DIMENSION::Draw(), DRAWSEGMENT::Draw(), Draw(), SEGZONE::Draw(), VIA::Draw(), DrawAncre(), ZONE_CONTAINER::DrawFilledArea(), TEXTE_PCB::Flip(), TRACK::Flip(), BOARD_ITEM::Flip(), ZONE_CONTAINER::Flip(), VIA::Flip(), BOARD_ITEM::GetBoard(), GAL_ARRAY_CREATOR::getBoard(), LEGACY_ARRAY_CREATOR::getBoard(), GetBoundingPoly(), BOARD_ITEM::GetLayerName(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase(), SEGZONE::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(), PushTrack(), BOARD_CONNECTED_ITEM::SetNet(), BOARD_CONNECTED_ITEM::SetNetCode(), ViewBBox(), VIA::ViewGetLOD(), and D_PAD::ViewGetLOD().

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

References TEXTE_MODULE::GetBoundingBox(), DLIST< T >::GetFirst(), GetFootprintRect(), m_Drawings, m_Reference, m_Value, EDA_RECT::Merge(), BOARD_ITEM::Next(), and PCB_MODULE_EDGE_T.

Referenced by PCB_BASE_FRAME::AddPad(), AllAreModulesAndReturnSmallestIfSo(), PCB_EDIT_FRAME::AppendBoardFile(), AR_AUTOPLACER::buildFpAreas(), PCB_EDIT_FRAME::Change_Side_Module(), PCB_BASE_FRAME::DeletePad(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), HitTest(), PCB_BASE_FRAME::Rotate_Module(), and PCB_EDIT_FRAME::StartMoveModule().

499 {
500  EDA_RECT area = GetFootprintRect();
501 
502  // Add in items not collected by GetFootprintRect():
503  for( const BOARD_ITEM* item = m_Drawings.GetFirst(); item; item = item->Next() )
504  {
505  if( item->Type() != PCB_MODULE_EDGE_T )
506  area.Merge( item->GetBoundingBox() );
507  }
508 
509  area.Merge( m_Value->GetBoundingBox() );
510  area.Merge( m_Reference->GetBoundingBox() );
511 
512  return area;
513 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect...
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
BOARD_ITEM * Next() const
EDA_RECT GetFootprintRect() const
Function GetFootprintRect() Returns the area of the module footprint excluding any text...
T * GetFirst() const
Function GetFirst returns the first T* in the list without removing it, or NULL if the list is empty...
Definition: dlist.h:163
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
TEXTE_MODULE * m_Value
Component value (74LS00, 22K..)
Definition: class_module.h:736
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
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 530 of file class_module.cpp.

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

531 {
532  SHAPE_POLY_SET poly;
533 
534  double orientation = GetOrientationRadians();
535 
536  MODULE temp = *this;
537  temp.SetOrientation( 0.0 );
538  BOX2I area = temp.GetFootprintRect();
539 
540  poly.NewOutline();
541 
542  VECTOR2I p = area.GetPosition();
543  poly.Append( p );
544  p.x = area.GetRight();
545  poly.Append( p );
546  p.y = area.GetBottom();
547  poly.Append( p );
548  p.x = area.GetX();
549  poly.Append( p );
550 
551  BOARD* board = GetBoard();
552  if( board )
553  {
554  int biggest_clearance = board->GetDesignSettings().GetBiggestClearanceValue();
555  poly.Inflate( biggest_clearance, 4 );
556  }
557 
558  poly.Inflate( Millimeter2iu( 0.01 ), 4 );
559  poly.Rotate( -orientation, m_Pos );
560 
561  return poly;
562 }
int GetBiggestClearanceValue()
Function GetBiggestClearanceValue.
coord_type GetRight() const
Definition: box2.h:197
Class BOX2 handles a 2-D bounding box, built on top of an origin point and size vector, both of templated class Vec.
Definition: box2.h:41
void Inflate(int aFactor, int aCircleSegmentsCount)
Performs outline inflation/deflation, using round corners.
Class SHAPE_POLY_SET.
EDA_RECT GetFootprintRect() const
Function GetFootprintRect() Returns the area of the module footprint excluding any text...
const Vec & GetPosition() const
Definition: box2.h:192
coord_type GetBottom() const
Definition: box2.h:198
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:539
int NewOutline()
Creates a new empty polygon in the set and returns its index
double GetOrientationRadians() const
Definition: class_module.h:190
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:171
void SetOrientation(double newangle)
wxPoint m_Pos
Position of module on the board in internal units.
Definition: class_module.h:734
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
coord_type GetX() const
Definition: box2.h:188
void Rotate(double aAngle, const VECTOR2I &aCenter)
Function Rotate rotates all vertices by a given angle.
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) ...
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 97 of file class_board_item.h.

References BOARD_ITEM::GetPosition(), and BOARD_ITEM::SetPosition().

Referenced by BOARD::chainMarkedSegments(), and DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::TransformItem().

97 { return GetPosition(); }
virtual const wxPoint GetPosition() const =0
wxString MODULE::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 604 of file class_module.h.

References PNS::Clone().

Referenced by Visit().

605  {
606  return wxT( "MODULE" );
607  }
const wxString& MODULE::GetDescription ( ) const
inline

Definition at line 195 of file class_module.h.

Referenced by PCB_IO::format(), FOOTPRINT_INFO_GENERATOR::GenerateHtml(), FOOTPRINT_INFO_IMPL::load(), and DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow().

195 { return m_Doc; }
wxString m_Doc
File name and path for documentation file.
Definition: class_module.h:745
int MODULE::GetFlag ( ) const
inline

Definition at line 230 of file class_module.h.

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

230 { return m_arflag; }
int m_arflag
Use to trace ratsnest and auto routing.
Definition: class_module.h:750
STATUS_FLAGS EDA_ITEM::GetFlags ( ) const
inlineinherited

Definition at line 258 of file base_struct.h.

References EDA_ITEM::m_Flags.

Referenced by AbortMoveAndEditTarget(), SCH_SCREEN::addConnectedItemsToBlock(), AddMenusForBitmap(), AddMenusForBusEntry(), AddMenusForComponent(), AddMenusForComponentField(), AddMenusForEditComponent(), AddMenusForGLabel(), AddMenusForHierchicalSheet(), AddMenusForHLabel(), AddMenusForLabel(), AddMenusForSheetPin(), AddMenusForText(), SCH_EDIT_FRAME::BeginSegment(), SCH_EDIT_FRAME::ChangeTextOrient(), Collect_TrackSegmentsToDrag(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), LIB_EDIT_FRAME::copySelectedItems(), LIB_EDIT_FRAME::CreatePin(), PCB_EDIT_FRAME::createPopUpMenuForFootprints(), PCB_EDIT_FRAME::createPopUpMenuForFpPads(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), PCB_EDIT_FRAME::createPopUpMenuForTexts(), PCB_EDIT_FRAME::createPopupMenuForTracks(), PCB_EDIT_FRAME::createPopUpMenuForZones(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteItem(), SCH_EDIT_FRAME::DeleteItemsInList(), SCH_EDIT_FRAME::DeleteJunction(), PCB_BASE_FRAME::DeleteTextModule(), BOARD::Draw(), PCB_EDIT_FRAME::Edit_TrackSegm_Width(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditImage(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_VIEW_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_SCREEN::GetConnection(), InitialiseDragParameters(), EDA_DRAW_FRAME::isBusy(), Magnetize(), SCH_EDIT_FRAME::MirrorImage(), SCH_EDIT_FRAME::MirrorSheet(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), EDA_DRAW_PANEL::OnMouseEvent(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_EDIT_FRAME::OrientComponent(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), LIB_EDIT_FRAME::Process_Special_Functions(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_EDIT_FRAME::RotateField(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), SCH_EDIT_FRAME::RotateImage(), PCB_BASE_FRAME::RotateTextModule(), LIB_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_SCREEN::SelectBlockItems(), SCH_EDIT_FRAME::SetBusEntryShape(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

258 { return m_Flags; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
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 477 of file class_module.cpp.

References DLIST< T >::GetFirst(), EDA_RECT::Inflate(), m_Drawings, m_Pads, m_Pos, EDA_RECT::Merge(), BOARD_ITEM::Next(), D_PAD::Next(), PCB_MODULE_EDGE_T, EDA_RECT::SetEnd(), and EDA_RECT::SetOrigin().

Referenced by CalculateBoundingBox(), CoverageRatio(), GetBoundingBox(), GetBoundingPoly(), BOARD::GetFootprint(), AR_AUTOPLACER::getOptimalModulePlacement(), moveFootprintsInArea(), SELECTION_TOOL::pickSmallestComponent(), AR_AUTOPLACER::testModuleOnBoard(), and ViewBBox().

478 {
479  EDA_RECT area;
480 
481  area.SetOrigin( m_Pos );
482  area.SetEnd( m_Pos );
483  area.Inflate( Millimeter2iu( 0.25 ) ); // Give a min size to the area
484 
485  for( const BOARD_ITEM* item = m_Drawings.GetFirst(); item; item = item->Next() )
486  {
487  if( item->Type() == PCB_MODULE_EDGE_T )
488  area.Merge( item->GetBoundingBox() );
489  }
490 
491  for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
492  area.Merge( pad->GetBoundingBox() );
493 
494  return area;
495 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect...
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:124
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
BOARD_ITEM * Next() const
void SetEnd(int x, int y)
Definition: eda_rect.h:134
T * GetFirst() const
Function GetFirst returns the first T* in the list without removing it, or NULL if the list is empty...
Definition: dlist.h:163
D_PAD * Next() const
Definition: class_pad.h:160
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxPoint m_Pos
Position of module on the board in internal units.
Definition: class_module.h:734
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
const LIB_ID& MODULE::GetFPID ( ) const
inline

Definition at line 192 of file class_module.h.

Referenced by FOOTPRINT_EDIT_FRAME::AddModuleToBoard(), BuildPolyCourtyard(), CreateDevicesSection(), CreateShapesSection(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), PCB_EDIT_FRAME::DoGenFootprintsPositionFile(), doPushPadProperties(), PCB_BASE_FRAME::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(), FOOTPRINT_EDIT_FRAME::GetLoadedFPID(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), 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::Process_Special_Functions(), DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules(), DIALOG_EXCHANGE_FOOTPRINTS::processModule(), PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), BOARD_NETLIST_UPDATER::replaceComponent(), BOARD::ReplaceNetlist(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::saveFootprintInLibrary(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), setLibNickname(), BOARD_NETLIST_UPDATER::testConnectivity(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

192 { return m_fpid; }
LIB_ID m_fpid
The LIB_ID of the MODULE.
Definition: class_module.h:737
const wxArrayString* MODULE::GetInitialComments ( ) const
inline

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

Definition at line 706 of file class_module.h.

Referenced by PCB_IO::format().

706 { 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:764
const wxString& MODULE::GetKeywords ( ) const
inline

Definition at line 198 of file class_module.h.

Referenced by PCB_IO::format(), FOOTPRINT_INFO_GENERATOR::GenerateHtml(), FOOTPRINT_INFO_IMPL::load(), and DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow().

198 { return m_KeyWord; }
wxString m_KeyWord
Search keywords to find module in library.
Definition: class_module.h:746
timestamp_t MODULE::GetLastEditTime ( ) const
inline

Definition at line 315 of file class_module.h.

Referenced by PCB_IO::format().

315 { return m_LastEditTime; }
timestamp_t m_LastEditTime
Definition: class_module.h:749
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 124 of file class_board_item.h.

References BOARD_ITEM::m_Layer.

Referenced by Abort_MoveOrCopyModule(), DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), CN_CONNECTIVITY_ALGO::Add(), CN_LIST::Add(), CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), DIMENSION::AdjustDimensionDetails(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), AR_AUTOPLACER::buildFpAreas(), PCB_EDIT_FRAME::Change_Side_Module(), checkConnectedTo(), CopyNetlistSettings(), CreateBoardSection(), MWAVE::CreateMicrowaveInductor(), CreateRoutesSection(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), PCB_EDIT_FRAME::DoGenFootprintsPositionFile(), DRC::doTrackKeepoutDrc(), TEXTE_MODULE::Draw(), DRAWSEGMENT::Draw(), KIGFX::PCB_PAINTER::draw(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Width(), export_vrml_drawsegment(), export_vrml_edge_module(), export_vrml_module(), export_vrml_pcbtext(), export_vrml_text_module(), PCB_EDIT_FRAME::ExportToGenCAD(), TEXTE_PCB::Flip(), PCB_TARGET::Flip(), EDGE_MODULE::Flip(), TEXTE_MODULE::Flip(), TRACK::Flip(), DIMENSION::Flip(), Flip(), DRAWSEGMENT::Flip(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::formatLayer(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), BOARD::GetFootprint(), ZONE_CONTAINER::GetLayer(), AR_AUTOPLACER::getOptimalModulePlacement(), BOARD::GetPad(), TEXT_MOD_GRID_TABLE::GetValueAsLong(), BOARD::GetVisibleTrack(), SELECTION_TOOL::guessSelectionCandidates(), idf_export_module(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), D_PAD::IsFlipped(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), BOARD::MarkTrace(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), PCB_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::Plot_Edges_Modules(), BRDITEMS_PLOTTER::PlotAllTextsModule(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotDrawSegment(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotTextePcb(), processBoardItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::ResetTextSize(), SELECTION_TOOL::selectable(), TEXT_MOD_GRID_TABLE::SetValueAsLong(), ShowClearance(), PNS_KICAD_IFACE::syncGraphicalItem(), PNS_KICAD_IFACE::syncTrack(), DRC::testCopperDrawItem(), DRC::testCopperTextAndGraphics(), DRC::testCopperTextItem(), DRC::testDisabledLayers(), AR_AUTOPLACER::testModuleOnBoard(), TEXTE_MODULE::TEXTE_MODULE(), AR_MATRIX::TraceSegmentPcb(), TraceSegmentPcb(), TrackListSortByNetcode(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet(), TransformGraphicShapesWithClearanceToPolygonSet(), TransformGraphicTextWithClearanceToPolygonSet(), TEXTE_MODULE::ViewGetLayers(), TRACK::ViewGetLayers(), TEXTE_MODULE::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

124 { return m_Layer; }
PCB_LAYER_ID m_Layer
wxString BOARD_ITEM::GetLayerName ( ) const
inherited

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

Returns
wxString containing the layer name associated with this item.

Definition at line 78 of file class_board_item.cpp.

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

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

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

Referenced by GRID_HELPER::BestSnapAnchor(), build_pad_testpoints(), BOARD::chainMarkedSegments(), VIA::ClassOf(), Collect_TrackSegmentsToDrag(), DRC::doTrackDrc(), DRC::doTrackKeepoutDrc(), PCB_EDIT_FRAME::EraseRedundantTrack(), find_vias_and_tracks_at(), TRACK::GetEndSegments(), TRACK::GetTrack(), hash_board_item(), BOARD::MarkTrace(), POINT_EDITOR::OnSelectionChange(), and PCB_EDIT_FRAME::StartMoveOneNodeOrSegment().

132 { return LSET( m_Layer ); }
PCB_LAYER_ID m_Layer
Class LSET is a set of PCB_LAYER_IDs.
timestamp_t MODULE::GetLink ( ) const
inline
DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited
int MODULE::GetLocalSolderMaskMargin ( ) const
inline
int MODULE::GetLocalSolderPasteMargin ( ) const
inline
double MODULE::GetLocalSolderPasteMarginRatio ( ) const
inline
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 897 of file class_module.cpp.

898 {
899  return module_xpm;
900 }
void MODULE::GetMsgPanelInfo ( EDA_UNITS_T  aUnits,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

>

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

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

Reimplemented from EDA_ITEM.

Definition at line 565 of file class_module.cpp.

References BLACK, BLUE, BROWN, UTF8::c_str(), DARKCYAN, LIB_ID::Format(), FROM_UTF8(), GetChars(), 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, EDA_ITEM::Next(), and RED.

Referenced by DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel().

566 {
567  int nbpad;
568  wxString msg;
569 
570  aList.push_back( MSG_PANEL_ITEM( m_Reference->GetShownText(), m_Value->GetShownText(), DARKCYAN ) );
571 
572  // Display last date the component was edited (useful in Module Editor).
573  wxDateTime date( static_cast<time_t>( m_LastEditTime ) );
574 
575  if( m_LastEditTime && date.IsValid() )
576  // Date format: see http://www.cplusplus.com/reference/ctime/strftime
577  msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year
578  else
579  msg = _( "Unknown" );
580 
581  aList.push_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) );
582 
583  // display schematic path
584  aList.push_back( MSG_PANEL_ITEM( _( "Netlist Path" ), m_Path, BROWN ) );
585 
586  // display the board side placement
587  aList.push_back( MSG_PANEL_ITEM( _( "Board Side" ),
588  IsFlipped()? _( "Back (Flipped)" ) : _( "Front" ), RED ) );
589 
590  EDA_ITEM* PtStruct = m_Pads;
591  nbpad = 0;
592 
593  while( PtStruct )
594  {
595  nbpad++;
596  PtStruct = PtStruct->Next();
597  }
598 
599  msg.Printf( wxT( "%d" ), nbpad );
600  aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), msg, BLUE ) );
601 
602  msg = wxT( ".." );
603 
604  if( IsLocked() )
605  msg[0] = 'L';
606 
608  msg[1] = 'P';
609 
610  aList.push_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) );
611 
612  msg.Printf( wxT( "%.1f" ), GetOrientationDegrees() );
613  aList.push_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, BROWN ) );
614 
615  // Controls on right side of the dialog
616  switch( m_Attributs & 255 )
617  {
618  case 0:
619  msg = _( "Normal" );
620  break;
621 
622  case MOD_CMS:
623  msg = _( "Insert" );
624  break;
625 
626  case MOD_VIRTUAL:
627  msg = _( "Virtual" );
628  break;
629 
630  default:
631  msg = wxT( "???" );
632  break;
633  }
634 
635  aList.push_back( MSG_PANEL_ITEM( _( "Attributes" ), msg, BROWN ) );
636  aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), FROM_UTF8( m_fpid.Format().c_str() ), BLUE ) );
637 
638  if( m_3D_Drawings.empty() )
639  msg = _( "No 3D shape" );
640  else
641  msg = m_3D_Drawings.front().m_Filename;
642 
643  // Search the first active 3D shape in list
644 
645  aList.push_back( MSG_PANEL_ITEM( _( "3D-Shape" ), msg, RED ) );
646 
647  wxString doc, keyword;
648  doc.Printf( _( "Doc: %s" ), GetChars( m_Doc ) );
649  keyword.Printf( _( "Key Words: %s" ), GetChars( m_KeyWord ) );
650  aList.push_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) );
651 }
LIB_ID m_fpid
The LIB_ID of the MODULE.
Definition: class_module.h:737
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:53
wxString m_KeyWord
Search keywords to find module in library.
Definition: class_module.h:746
wxString m_Path
Definition: class_module.h:747
Definition: colors.h:61
Set for modules listed in the automatic insertion list (usually SMD footprints)
Definition: class_module.h:76
EDA_ITEM * Next() const
Definition: base_struct.h:209
virtual wxString GetShownText() const override
Returns the string actually shown after processing of the base text.
wxString m_Doc
File name and path for documentation file.
Definition: class_module.h:745
timestamp_t m_LastEditTime
Definition: class_module.h:749
#define MODULE_is_PLACED
In autoplace: module automatically placed.
Definition: class_module.h:262
double GetOrientationDegrees() const
Definition: class_module.h:189
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:258
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Linked list of 3D models.
Definition: class_module.h:732
Definition: colors.h:60
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:267
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:92
int m_ModuleStatus
For autoplace: flags (LOCKED, AUTOPLACED)
Definition: class_module.h:739
Virtual component: when created by copper shapes on board (Like edge card connectors, mounting hole...)
Definition: class_module.h:78
const char * c_str() const
Definition: utf8.h:107
TEXTE_MODULE * m_Value
Component value (74LS00, 22K..)
Definition: class_module.h:736
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
UTF8 Format() const
Definition: lib_id.cpp:237
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
Definition: colors.h:45
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
int m_Attributs
Flag bits ( see Mod_Attribut )
Definition: class_module.h:738
Definition: colors.h:62
int BOARD_ITEM::getNextNumberInSequence ( const std::set< int > &  aSeq,
bool  aFillSequenceGaps 
)
staticprotectedinherited

Definition at line 230 of file class_board_item.cpp.

Referenced by GetNextPadName().

231 {
232  if( aSeq.empty() )
233  return 1;
234 
235  // By default go to the end of the sequence
236  int candidate = *aSeq.rbegin();
237 
238  // Filling in gaps in pad numbering
239  if( aFillSequenceGaps )
240  {
241  // start at the beginning
242  candidate = *aSeq.begin();
243 
244  for( auto it : aSeq )
245  {
246  if( it - candidate > 1 )
247  break;
248 
249  candidate = it;
250  }
251  }
252 
253  ++candidate;
254 
255  return candidate;
256 }
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 1326 of file class_module.cpp.

References Format(), BOARD_ITEM::getNextNumberInSequence(), BOARD_ITEM::getTrailingInt(), D_PAD::Next(), and PadsList().

1327 {
1328  std::set<int> usedNumbers;
1329 
1330  // Create a set of used pad numbers
1331  for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
1332  {
1333  int padNumber = getTrailingInt( pad->GetName() );
1334  usedNumbers.insert( padNumber );
1335  }
1336 
1337  const int nextNum = getNextNumberInSequence( usedNumbers, aFillSequenceGaps );
1338 
1339  return wxString::Format( wxT( "%i" ), nextNum );
1340 }
static int getNextNumberInSequence(const std::set< int > &aSeq, bool aFillSequenceGaps)
D_PAD * Next() const
Definition: class_pad.h:160
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static int getTrailingInt(const wxString &aStr)
DLIST< D_PAD > & PadsList()
Definition: class_module.h:162
double MODULE::GetOrientation ( ) const
inline

Definition at line 188 of file class_module.h.

Referenced by Abort_MoveOrCopyModule(), PCB_BASE_FRAME::AddPad(), PCAD2KICAD::PCB_PAD::AddToModule(), AR_AUTOPLACER::AutoplaceModules(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), ConvertOutlineToPolygon(), CopyNetlistSettings(), CreateShapesSection(), doPushPadProperties(), PCB_BASE_FRAME::DoPushPadProperties(), EDGE_MODULE::Draw(), PCB_EDIT_FRAME::Edit_Gap(), export_vrml_module(), PCB_IO::format(), DRAWSEGMENT::GetBoundingBox(), TEXTE_MODULE::GetDrawRotation(), hash_eda(), idf_export_module(), D_PAD::ImportSettingsFromMaster(), DIALOG_PAD_PROPERTIES::initValues(), LEGACY_PLUGIN::loadPAD(), MoveAnchorPosition(), EAGLE_PLUGIN::orientModuleText(), PCB_BASE_FRAME::PlacePad(), PCB_BASE_FRAME::PlaceTexteModule(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), C3D_RENDER_OGL_LEGACY::render_3D_module(), Rotate(), PCB_BASE_FRAME::Rotate_Module(), AR_AUTOPLACER::rotateModule(), DRAG_SEGM_PICKER::SetAuxParameters(), EDGE_MODULE::SetDrawCoord(), TEXTE_MODULE::SetDrawCoord(), D_PAD::SetDrawCoord(), EDGE_MODULE::SetLocalCoord(), TEXTE_MODULE::SetLocalCoord(), D_PAD::SetLocalCoord(), DRAG_SEGM_PICKER::SetTrackEndsCoordinates(), ShowNewEdgeModule(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), EAGLE_PLUGIN::transferPad(), and DRAWSEGMENT::TransformShapeWithClearanceToPolygon().

188 { return m_Orient; }
double m_Orient
Orientation in tenths of a degree, 900=90.0 degrees.
Definition: class_module.h:733
double MODULE::GetOrientationDegrees ( ) const
inline

Definition at line 189 of file class_module.h.

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

189 { return m_Orient / 10.0; }
double m_Orient
Orientation in tenths of a degree, 900=90.0 degrees.
Definition: class_module.h:733
double MODULE::GetOrientationRadians ( ) const
inline

Definition at line 190 of file class_module.h.

Referenced by export_vrml_edge_module(), and GetBoundingPoly().

190 { return m_Orient * M_PI / 1800; }
double m_Orient
Orientation in tenths of a degree, 900=90.0 degrees.
Definition: class_module.h:733
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 711 of file class_module.cpp.

References m_Pads, and D_PAD::Next().

712 {
713  for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
714  {
715  // ... and on the correct layer.
716  if( !( pad->GetLayerSet() & aLayerMask ).any() )
717  continue;
718 
719  if( pad->HitTest( aPosition ) )
720  return pad;
721  }
722 
723  return NULL;
724 }
D_PAD * Next() const
Definition: class_pad.h:160
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
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 747 of file class_module.cpp.

References DHEAD::GetCount(), m_Pads, D_PAD::Next(), and PAD_ATTRIB_HOLE_NOT_PLATED.

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

748 {
749  if( aIncludeNPTH )
750  return m_Pads.GetCount();
751 
752  unsigned cnt = 0;
753 
754  for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
755  {
756  if( pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
757  continue;
758 
759  cnt++;
760  }
761 
762  return cnt;
763 }
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
D_PAD * Next() const
Definition: class_pad.h:160
unsigned GetCount() const
Function GetCount returns the number of elements in the list.
Definition: dlist.h:126
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 118 of file class_board_item.h.

References EDA_ITEM::m_Parent.

Referenced by Abort_Move_ModuleOutline(), AbortMoveTextModule(), POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CmpHoleSorting(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), BOARD_ITEM::DeleteStructure(), PCB_BASE_FRAME::DeleteTextModule(), 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(), TEXTE_MODULE::DrawUmbilical(), PCB_EDIT_FRAME::duplicateItems(), 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(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), PCB_EDIT_FRAME::moveExact(), FOOTPRINT_EDIT_FRAME::OnRightClick(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_BASE_FRAME::PlaceTexteModule(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::PlotTextModule(), PCB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PAD_TOOL::pushPadSettings(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), PCB_BASE_FRAME::ResetTextSize(), PCB_BASE_FRAME::RotateTextModule(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SELECTION_TOOL::select(), ShowCurrentOutlineWhileMoving(), ShowNewEdgeModule(), PCB_BASE_FRAME::StartMoveTexteModule(), SwapItemData(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

118 { return (BOARD_ITEM_CONTAINER*) m_Parent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:171
Abstract interface for BOARD_ITEMs capable of storing other items inside.
const wxString& MODULE::GetPath ( ) const
inline
int MODULE::GetPlacementCost180 ( ) const
inline

Definition at line 579 of file class_module.h.

Referenced by AR_AUTOPLACER::AutoplaceModules(), PCB_IO::format(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow().

579 { return m_CntRot180; }
int m_CntRot180
Vertical automatic placement cost ( 0..10 ).
Definition: class_module.h:753
int MODULE::GetPlacementCost90 ( ) const
inline

Definition at line 582 of file class_module.h.

Referenced by AR_AUTOPLACER::AutoplaceModules(), PCB_IO::format(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow().

582 { return m_CntRot90; }
int m_CntRot90
Horizontal automatic placement cost ( 0..10 ).
Definition: class_module.h:752
SHAPE_POLY_SET& MODULE::GetPolyCourtyardBack ( )
inline

Definition at line 712 of file class_module.h.

Referenced by AR_AUTOPLACER::buildFpAreas().

712 { return m_poly_courtyard_back; }
SHAPE_POLY_SET m_poly_courtyard_back
Definition: class_module.h:770
SHAPE_POLY_SET& MODULE::GetPolyCourtyardFront ( )
inline

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

Returns
the courtyard polygon

Definition at line 711 of file class_module.h.

Referenced by AR_AUTOPLACER::buildFpAreas().

711 { 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:769
const wxPoint MODULE::GetPosition ( ) const
inlineoverridevirtual

Implements BOARD_ITEM.

Definition at line 183 of file class_module.h.

Referenced by PCB_BASE_FRAME::AddModuleToBoard(), PCB_BASE_FRAME::AddPad(), PCAD2KICAD::PCB_PAD::AddToModule(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Change_Side_Module(), GRID_HELPER::computeAnchors(), ConvertOutlineToPolygon(), CopyNetlistSettings(), MWAVE::CreateMicrowaveInductor(), PCB_EDIT_FRAME::CreateMuWaveBaseFootprint(), D_PAD::D_PAD(), EDGE_MODULE::Draw(), KIGFX::PCB_PAINTER::draw(), TEXTE_MODULE::DrawUmbilical(), PCB_EDIT_FRAME::Edit_Gap(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), export_vrml_edge_module(), export_vrml_module(), PCB_EDIT_FRAME::ExportToGenCAD(), SELECTION_TOOL::findMove(), PCB_IO::FootprintSave(), PCB_IO::format(), DSN::SPECCTRA_DB::FromBOARD(), DRAWSEGMENT::GetBoundingBox(), AR_AUTOPLACER::getOptimalModulePlacement(), hash_eda(), idf_export_module(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), LEGACY_PLUGIN::loadPAD(), MoveFootprint(), moveFootprintsInArea(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), DIALOG_NETLIST::OnTestFootprintsClick(), EAGLE_PLUGIN::orientModuleAndText(), EAGLE_PLUGIN::packageHole(), EAGLE_PLUGIN::packageText(), PCB_BASE_FRAME::PlaceTexteModule(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), PCB_EDIT_FRAME::Process_Special_Functions(), 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(), ShowNewEdgeModule(), TEXTE_MODULE::TEXTE_MODULE(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), EAGLE_PLUGIN::transferPad(), FOOTPRINT_EDIT_FRAME::Transform(), and DRAWSEGMENT::TransformShapeWithClearanceToPolygon().

183 { return m_Pos; }
wxPoint m_Pos
Position of module on the board in internal units.
Definition: class_module.h:734
const wxString& MODULE::GetReference ( ) const
inline

Function GetReference.

Returns
const wxString& - the reference designator text.

Definition at line 462 of file class_module.h.

Referenced by AR_AUTOPLACER::AutoplaceModules(), DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange(), GERBER_WRITER::createDrillFile(), CreateShapesSection(), CreateSignalsSection(), PCB_BASE_FRAME::DeletePad(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), PCB_EDIT_FRAME::DoGenFootprintsPositionFile(), PCB_EDIT_FRAME::Edit_Gap(), BOARD::FindModuleByReference(), FormatProbeItem(), DSN::SPECCTRA_DB::FromBOARD(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), EDGE_MODULE::GetMsgPanelInfo(), TEXTE_MODULE::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), GetReferencePrefix(), GetSelectMenuText(), getShapeName(), TEXTE_MODULE::GetShownText(), idf_export_module(), IncrementReference(), DIALOG_PAD_PROPERTIES::initValues(), GENERAL_COLLECTOR::Inspect(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), PCB_EDIT_FRAME::ListAndSelectModuleName(), EAGLE_PLUGIN::loadElements(), PCB_EDIT_FRAME::LockModule(), DIALOG_NETLIST::OnTestFootprintsClick(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::PlotPad(), BRDITEMS_PLOTTER::PlotTextModule(), PCB_EDIT_FRAME::Process_Special_Functions(), DIALOG_EXCHANGE_FOOTPRINTS::processModule(), PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), BOARD_NETLIST_UPDATER::replaceComponent(), FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), BOARD_NETLIST_UPDATER::updateComponentPadConnections(), BOARD::updateComponentPadConnections(), BOARD_NETLIST_UPDATER::updateComponentParameters(), DIALOG_NETLIST::verifyFootprints(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

463  {
464  return m_Reference->GetText();
465  }
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
wxString MODULE::GetReferencePrefix ( ) const

Function GetReferencePrefix Gets the alphabetic prefix of the module reference - e.g.

R1 -> R IC34 -> IC

Returns
the reference prefix (may be empty)

Definition at line 1343 of file class_module.cpp.

References GetReference().

Referenced by IncrementReference().

1344 {
1345  wxString prefix = GetReference();
1346 
1347  int strIndex = prefix.length() - 1;
1348  while( strIndex >= 0 )
1349  {
1350  const wxUniChar chr = prefix.GetChar( strIndex );
1351 
1352  // numeric suffix
1353  if( chr >= '0' && chr <= '9' )
1354  break;
1355 
1356  strIndex--;
1357  }
1358 
1359  prefix = prefix.Mid( 0, strIndex );
1360 
1361  return prefix;
1362 }
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:462
wxString MODULE::GetSelectMenuText ( EDA_UNITS_T  aUnits) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 886 of file class_module.cpp.

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

Referenced by PCB_EDIT_FRAME::createPopUpMenuForFootprints().

887 {
888  wxString reference = GetReference();
889 
890  if( reference.IsEmpty() )
891  reference = _( "<no reference>" );
892 
893  return wxString::Format( _( "Footprint %s on %s" ), reference, GetLayerName() );
894 }
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.
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
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:462
STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 253 of file base_struct.h.

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format(), and GERBER_DRAW_ITEM::HitTest().

253 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:164
int MODULE::GetThermalGap ( ) const
inline

Definition at line 223 of file class_module.h.

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

223 { return m_ThermalGap; }
int m_ThermalGap
Definition: class_module.h:744
int MODULE::GetThermalWidth ( ) const
inline

Definition at line 220 of file class_module.h.

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

220 { return m_ThermalWidth; }
int m_ThermalWidth
Definition: class_module.h:743
timestamp_t EDA_ITEM::GetTimeStamp ( ) const
inlineinherited

Definition at line 207 of file base_struct.h.

References EDA_ITEM::m_TimeStamp.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), SCH_COMPONENT::AddSheetPathReferenceEntryIfMissing(), SCH_EDIT_FRAME::AnnotateComponents(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), PCB_EDIT_FRAME::Delete_OldZone_Fill(), PCB_EDIT_FRAME::Delete_Zone_Contour(), DuplicateStruct(), DIALOG_FOOTPRINT_BOARD_EDITOR::EditFootprint(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::format(), FormatProbeItem(), NETLIST_OBJECT::GetShortNetName(), FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), NETLIST_EXPORTER_GENERIC::makeComponents(), mapExistingAnnotation(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), SCH_SHEET_PATH::Path(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_LEGACY_PLUGIN::saveComponent(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_REFERENCE::SCH_REFERENCE(), ZONE_FILLER_TOOL::SegzoneDeleteFill(), SortByTimeStamp(), SwapItemData(), DIALOG_SCH_SHEET_PROPS::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS().

207 { return m_TimeStamp; }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:172
D_PAD * MODULE::GetTopLeftPad ( )

Definition at line 727 of file class_module.cpp.

References D_PAD::GetPosition(), m_Pads, and D_PAD::Next().

728 {
729  D_PAD* topLeftPad = m_Pads;
730 
731  for( D_PAD* p = m_Pads->Next(); p; p = p->Next() )
732  {
733  wxPoint pnt = p->GetPosition(); // GetPosition() returns the center of the pad
734 
735  if( ( pnt.x < topLeftPad->GetPosition().x ) ||
736  ( ( topLeftPad->GetPosition().x == pnt.x ) &&
737  ( pnt.y < topLeftPad->GetPosition().y ) ) )
738  {
739  topLeftPad = p;
740  }
741  }
742 
743  return topLeftPad;
744 }
D_PAD * Next() const
Definition: class_pad.h:160
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
const wxPoint GetPosition() const override
Definition: class_pad.h:220
int BOARD_ITEM::getTrailingInt ( const wxString &  aStr)
staticprotectedinherited

Definition at line 207 of file class_board_item.cpp.

Referenced by GetNextPadName(), and IncrementReference().

208 {
209  int number = 0;
210  int base = 1;
211 
212  // Trim and extract the trailing numeric part
213  int index = aStr.Len() - 1;
214  while( index >= 0 )
215  {
216  const char chr = aStr.GetChar( index );
217 
218  if( chr < '0' || chr > '9' )
219  break;
220 
221  number += ( chr - '0' ) * base;
222  base *= 10;
223  index--;
224  }
225 
226  return number;
227 }
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 766 of file class_module.cpp.

References LSET::AllCuMask(), D_PAD::Next(), PAD_ATTRIB_HOLE_NOT_PLATED, and PadsList().

Referenced by FOOTPRINT_INFO_IMPL::load().

767 {
768  std::set<wxString> usedNames;
769 
770  // Create a set of used pad numbers
771  for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
772  {
773  // Skip pads not on copper layers (used to build complex
774  // solder paste shapes for instance)
775  if( ( pad->GetLayerSet() & LSET::AllCuMask() ).none() )
776  continue;
777 
778  // Skip pads with no name, because they are usually "mechanical"
779  // pads, not "electrical" pads
780  if( pad->GetName().IsEmpty() )
781  continue;
782 
783  if( !aIncludeNPTH )
784  {
785  // skip NPTH
786  if( pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
787  {
788  continue;
789  }
790  }
791 
792  usedNames.insert( pad->GetName() );
793  }
794 
795  return usedNames.size();
796 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:676
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
D_PAD * Next() const
Definition: class_pad.h:160
DLIST< D_PAD > & PadsList()
Definition: class_module.h:162
ZoneConnection MODULE::GetZoneConnection ( ) const
inline
DLIST_ITERATOR_WRAPPER<BOARD_ITEM> MODULE::GraphicalItems ( )
inline

Definition at line 173 of file class_module.h.

Referenced by PCBNEW_CONTROL::ModuleEdgeOutlines(), PCBNEW_CONTROL::ModuleTextOutlines(), and SELECTION_TOOL::selectable().

174  {
176  }
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
DLIST<BOARD_ITEM>& MODULE::GraphicalItemsList ( )
inline

Definition at line 165 of file class_module.h.

Referenced by CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), PCAD2KICAD::PCB_LINE::AddToModule(), PCAD2KICAD::PCB_ARC::AddToModule(), PCAD2KICAD::PCB_POLYGON::AddToModule(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), BuildPolyCourtyard(), ClearMarkItems(), CopyMarkedItems(), PCB_EDIT_FRAME::Create_MuWavePolygonShape(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), DeleteMarkedItems(), DrawMovingBlockOutlines(), Duplicate(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Width(), PCB_EDIT_FRAME::Exchange_Module(), export_vrml_module(), FootprintWriteShape(), PCB_IO::format(), getMatchingTextItem(), hash_eda(), hashModule(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadMODULE_EDGE(), MarkItemsInBloc(), MirrorMarkedItems(), MoveAnchorPosition(), MoveMarkedItems(), MoveMarkedItemsExactly(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), EAGLE_PLUGIN::packageWire(), BRDITEMS_PLOTTER::PlotAllTextsModule(), RotateMarkedItems(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), and CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet().

165 { return m_Drawings; }
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
const DLIST<BOARD_ITEM>& MODULE::GraphicalItemsList ( ) const
inline

Definition at line 166 of file class_module.h.

166 { return m_Drawings; }
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
bool MODULE::HitTest ( const wxPoint &  aPosition) const
overridevirtual

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

Parameters
aPositionA reference to a wxPoint object containing the coordinates to test.
Returns
True if aPosition is within or on the item bounding area.

Reimplemented from BOARD_ITEM.

Definition at line 654 of file class_module.cpp.

References EDA_RECT::Contains(), and m_BoundaryBox.

Referenced by BOARD::GetFootprint().

655 {
656  return m_BoundaryBox.Contains( aPosition );
657 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
EDA_RECT m_BoundaryBox
Bounding box : coordinates on board, real orientation.
Definition: class_module.h:740
bool MODULE::HitTest ( const EDA_RECT aRect,
bool  aContained = true,
int  aAccuracy = 0 
) const
overridevirtual

Function HitTest tests if the aRect intersects or contains this object (depending on aContained).

Parameters
aRectA reference to an EDA_RECT object containg the area to test.
aContainedTest if aRect contains this object completly.
aAccuracyIncrease the item bounding box by this amount.
Returns
bool - True if aRect contains this object completly or if aRect intersects the object and aContained is False, otherwise false.

Reimplemented from BOARD_ITEM.

Definition at line 667 of file class_module.cpp.

References EDA_RECT::Contains(), GetBoundingBox(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), m_BoundaryBox, m_Drawings, m_Pads, BOARD_ITEM::Next(), and D_PAD::Next().

668 {
669  EDA_RECT arect = aRect;
670  arect.Inflate( aAccuracy );
671 
672  if( aContained )
673  return arect.Contains( m_BoundaryBox );
674  else
675  {
676  // If the rect does not intersect the bounding box, skip any tests
677  if( !aRect.Intersects( GetBoundingBox() ) )
678  return false;
679 
680  // Determine if any elements in the MODULE intersect the rect
681  for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
682  {
683  if( pad->HitTest( arect, false, 0 ) )
684  return true;
685  }
686 
687  for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
688  {
689  if( item->HitTest( arect, false, 0 ) )
690  return true;
691  }
692 
693  // No items were hit
694  return false;
695  }
696 }
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
bool Contains(const wxPoint &aPoint) const
Function Contains.
BOARD_ITEM * Next() const
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
EDA_RECT m_BoundaryBox
Bounding box : coordinates on board, real orientation.
Definition: class_module.h:740
D_PAD * Next() const
Definition: class_pad.h:160
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
bool MODULE::HitTestAccurate ( const wxPoint &  aPosition) 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 660 of file class_module.cpp.

References GetBoundingPoly().

Referenced by GENERAL_COLLECTOR::Inspect().

661 {
662  auto shape = GetBoundingPoly();
663  return shape.Contains( aPosition, -1, true );
664 }
SHAPE_POLY_SET GetBoundingPoly() const
Returns a bounding polygon for the shapes and pads in the module This operation is slower but more ac...
void MODULE::IncrementFlag ( )
inline

Definition at line 229 of file class_module.h.

229 { m_arflag += 1; }
int m_arflag
Use to trace ratsnest and auto routing.
Definition: class_module.h:750
void MODULE::IncrementReference ( int  aDelta)

Function IncrementReference Bumps the current reference by aDelta.

Definition at line 1365 of file class_module.cpp.

References Format(), GetReference(), GetReferencePrefix(), BOARD_ITEM::getTrailingInt(), and SetReference().

1366 {
1367  SetReference( wxString::Format( wxT( "%s%i" ),
1369  getTrailingInt( GetReference() ) + aDelta ) );
1370 }
wxString GetReferencePrefix() const
Function GetReferencePrefix Gets the alphabetic prefix of the module reference - e.g.
void SetReference(const wxString &aReference)
Function SetReference.
Definition: class_module.h:472
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
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:462
static int getTrailingInt(const wxString &aStr)
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 227 of file base_struct.h.

References BRIGHTENED.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), KIGFX::GERBVIEW_PAINTER::draw(), and KIGFX::PCB_RENDER_SETTINGS::GetColor().

227 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
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 106 of file class_board_item.h.

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

107  {
108  return false;
109  }
bool EDA_ITEM::IsDragging ( ) const
inlineinherited
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 258 of file class_module.h.

References B_Cu, and GetLayer().

Referenced by PCB_BASE_FRAME::AddModuleToBoard(), GetMsgPanelInfo(), DIALOG_PAD_PROPERTIES::initValues(), C3D_RENDER_OGL_LEGACY::render_3D_module(), DRAG_SEGM_PICKER::SetAuxParameters(), DRAG_SEGM_PICKER::SetTrackEndsCoordinates(), and DIALOG_TEXT_PROPERTIES::TransferDataToWindow().

258 { return GetLayer() == B_Cu; }
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 226 of file base_struct.h.

References HIGHLIGHTED.

226 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:137
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
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 1039 of file class_module.cpp.

References StringLibNameInvalidChars().

Referenced by DIALOG_FOOTPRINT_FP_EDITOR::checkFootprintName().

1040 {
1041  const wxChar * invalids = StringLibNameInvalidChars( false );
1042 
1043  if( aName.find_first_of( invalids ) != std::string::npos )
1044  return false;
1045 
1046  return true;
1047 }
static const wxChar * StringLibNameInvalidChars(bool aUserReadable)
static function StringLibNameInvalidChars Test for validity of the name in a library of the footprint...
bool MODULE::IsLocked ( ) const
inlineoverridevirtual

Function IsLocked.

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

Reimplemented from BOARD_ITEM.

Definition at line 267 of file class_module.h.

References MODULE_is_LOCKED.

Referenced by CopyNetlistSettings(), PCB_EDIT_FRAME::createPopUpMenuForFootprints(), EditToolSelectionFilter(), PCB_IO::format(), BOARD::GetFootprint(), GetMsgPanelInfo(), itemIsIncludedByFilter(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::Process_Special_Functions(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow().

268  {
269  return ( m_ModuleStatus & MODULE_is_LOCKED ) != 0;
270  }
#define MODULE_is_LOCKED
module LOCKED: no autoplace allowed
Definition: class_module.h:261
int m_ModuleStatus
For autoplace: flags (LOCKED, AUTOPLACED)
Definition: class_module.h:739
bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 220 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

220 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:110
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
bool MODULE::IsNetTie ( ) const
inline

Definition at line 233 of file class_module.h.

References Flip().

233 { return GetKeywords().StartsWith( wxT( "net tie" ) ); }
const wxString & GetKeywords() const
Definition: class_module.h:198
bool EDA_ITEM::IsNew ( ) const
inlineinherited

Definition at line 219 of file base_struct.h.

References IS_NEW.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_MoveOrCopyModule(), Abort_Zone_Create_Outline(), AbortBuildDimension(), AbortMoveAndEditTarget(), abortMoveItem(), AbortPinMove(), AbortSymbolTraceOn(), SCH_EDIT_FRAME::addCurrentItemToScreen(), SCH_EDIT_FRAME::addJunctionMenuEntries(), AddMenusForBus(), AddMenusForWire(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteCurrentSegment(), LIB_ARC::drawEditGraphics(), LIB_ARC::drawGraphic(), LIB_PIN::EnableEditMode(), LIB_EDIT_FRAME::EndDrawGraphicItem(), SCH_EDIT_FRAME::EndSegment(), ExitSheet(), LIB_PART::LIB_PART(), EDIT_TOOL::MoveExact(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_BASE_FRAME::PlaceModule(), LIB_EDIT_FRAME::PlacePin(), PCB_EDIT_FRAME::PlaceTarget(), SCH_EDIT_FRAME::PrepareMoveItem(), SCH_EDIT_FRAME::ReSizeSheet(), ShowClearance(), PCB_EDIT_FRAME::StartMoveTextePcb(), PCB_EDIT_FRAME::SwitchLayer(), DIALOG_SCH_EDIT_SHEET_PIN::TransferDataFromWindow(), and DIALOG_LABEL_EDITOR::TransferDataFromWindow().

219 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
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 174 of file class_board_item.h.

Referenced by VIA::ClassOf(), CINFO3D_VISU::createLayers(), TEXTE_PCB::Draw(), EDGE_MODULE::Draw(), TEXTE_MODULE::Draw(), DRAWSEGMENT::Draw(), GENERAL_COLLECTOR::Inspect(), ZONE_CONTAINER::IsOnLayer(), AR_MATRIX::TraceSegmentPcb(), and TraceSegmentPcb().

175  {
176  return m_Layer == aLayer;
177  }
PCB_LAYER_ID m_Layer
bool MODULE::IsPlaced ( ) const
inline

Definition at line 285 of file class_module.h.

References MODULE_is_PLACED.

Referenced by PCB_IO::format().

285 { return m_ModuleStatus & MODULE_is_PLACED; }
#define MODULE_is_PLACED
In autoplace: module automatically placed.
Definition: class_module.h:262
int m_ModuleStatus
For autoplace: flags (LOCKED, AUTOPLACED)
Definition: class_module.h:739
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_FIELD, SCH_SHEET_PIN, and SCH_TEXT.

Definition at line 464 of file base_struct.h.

References EDA_ITEM::operator<().

Referenced by EDA_ITEM::Matches(), and EDA_ITEM::Replace().

464 { return false; }
bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 225 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

225 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:115
bool EDA_ITEM::IsSelected ( ) const
inlineinherited
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 185 of file class_board_item.h.

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

Referenced by PCB_EDIT_FRAME::OnHotKey(), and PCB_EDIT_FRAME::OnHotkeyDeleteItem().

186  {
187  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
188  }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[])
inlineinherited

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

Definition at line 266 of file base_struct.h.

References EOT.

267  {
268  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
269  {
270  if( m_StructType == *p )
271  return true;
272  }
273 
274  return false;
275  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it...
Definition: base_struct.h:163
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
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 223 of file base_struct.h.

References IS_WIRE_IMAGE.

Referenced by SCH_FIELD::Draw().

223 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:118
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
SEARCH_RESULT EDA_ITEM::IterateForward ( EDA_ITEM listStart,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
staticinherited

Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes.

Parameters
listStartThe first in a list of EDA_ITEMs to iterate over.
inspectorIs an INSPECTOR to call on each object that is one of the requested scanTypes.
testDataIs an aid to testFunc, and should be sufficient to allow it to fully determine if an item meets the match criteria, but it may also be used to collect output.
scanTypesA KICAD_T array that is EOT terminated, and provides both the order and interest level of of the types of objects to be iterated over.
Returns
SEARCH_RESULT SEARCH_QUIT if the called INSPECTOR returned SEARCH_QUIT, else SCAN_CONTINUE;

Definition at line 130 of file base_struct.cpp.

References EDA_ITEM::Pnext, SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Visit().

Referenced by SCH_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::Collect(), SCH_TYPE_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::GetItem(), EDA_ITEM::HitTest(), GERBER_FILE_IMAGE::Visit(), Visit(), and BOARD::Visit().

134 {
135  EDA_ITEM* p = listStart;
136 
137  for( ; p; p = p->Pnext )
138  {
139  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
140  return SEARCH_QUIT;
141  }
142 
143  return SEARCH_CONTINUE;
144 }
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...
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:167
virtual bool EDA_ITEM::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData,
wxPoint *  aFindLocation 
)
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.
aFindLocationA pointer to a wxPoint object to store the location of matched item. The pointer can be NULL if it is not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_SHEET_PIN, SCH_FIELD, SCH_TEXT, LIB_PIN, and SCH_MARKER.

Definition at line 420 of file base_struct.h.

References EDA_ITEM::Replace().

Referenced by SCH_FIND_COLLECTOR::Inspect(), SCH_MARKER::Matches(), LIB_PIN::Matches(), SCH_TEXT::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::Matches(), SCH_SHEET::Matches(), and EDA_ITEM::Sort().

421  {
422  return false;
423  }
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 182 of file base_struct.cpp.

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

183 {
184  wxString text = aText;
185  wxString searchText = aSearchData.GetFindString();
186 
187  // Don't match if searching for replaceable item and the item doesn't support text replace.
188  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
189  return false;
190 
191  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
192  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
193 
194  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
195  {
196  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
197  return text.Matches( searchText );
198 
199  return text.MakeUpper().Matches( searchText.MakeUpper() );
200  }
201 
202  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
203  return aText.Find( searchText ) != wxNOT_FOUND;
204 
205  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
206 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:464
Perform search using simple wild card matching (* & ?).
Perform a search for a item that has replaceable text.
const std::list<MODULE_3D_SETTINGS>& MODULE::Models ( ) const
inline

Definition at line 179 of file class_module.h.

References PCAD2KICAD::SetPosition().

179 { return m_3D_Drawings; }
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Linked list of 3D models.
Definition: class_module.h:732
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 1062 of file class_module.cpp.

References m_Pos, and SetPosition().

Referenced by PCB_BASE_FRAME::build_ratsnest_module(), moveFootprintsInArea(), and CLIPBOARD_IO::SaveSelection().

1063 {
1064  wxPoint newpos = m_Pos + aMoveVector;
1065  SetPosition( newpos );
1066 }
void SetPosition(const wxPoint &aPos) override
wxPoint m_Pos
Position of module on the board in internal units.
Definition: class_module.h:734
void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 240 of file class_board_item.h.

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

241  {
242  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
243  }
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
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 1165 of file class_module.cpp.

References CalculateBoundingBox(), GetOrientation(), TEXTE_MODULE::GetPos0(), GraphicalItemsList(), m_Reference, m_Value, EDGE_MODULE::Move(), BOARD_ITEM::Next(), D_PAD::Next(), PadsList(), PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, RotatePoint(), TEXTE_MODULE::SetDrawCoord(), and TEXTE_MODULE::SetPos0().

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

1166 {
1167  /* Move the reference point of the footprint
1168  * the footprints elements (pads, outlines, edges .. ) are moved
1169  * but:
1170  * - the footprint position is not modified.
1171  * - the relative (local) coordinates of these items are modified
1172  * - Draw coordinates are updated
1173  */
1174 
1175 
1176  // Update (move) the relative coordinates relative to the new anchor point.
1177  wxPoint moveVector = aMoveVector;
1178  RotatePoint( &moveVector, -GetOrientation() );
1179 
1180  // Update of the reference and value.
1181  m_Reference->SetPos0( m_Reference->GetPos0() + moveVector );
1183  m_Value->SetPos0( m_Value->GetPos0() + moveVector );
1184  m_Value->SetDrawCoord();
1185 
1186  // Update the pad local coordinates.
1187  for( D_PAD* pad = PadsList(); pad; pad = pad->Next() )
1188  {
1189  pad->SetPos0( pad->GetPos0() + moveVector );
1190  pad->SetDrawCoord();
1191  }
1192 
1193  // Update the draw element coordinates.
1194  for( EDA_ITEM* item = GraphicalItemsList(); item; item = item->Next() )
1195  {
1196  switch( item->Type() )
1197  {
1198  case PCB_MODULE_EDGE_T:
1199  {
1200  EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
1201  edge->Move( moveVector );
1202  }
1203  break;
1204 
1205  case PCB_MODULE_TEXT_T:
1206  {
1207  TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
1208  text->SetPos0( text->GetPos0() + moveVector );
1209  text->SetDrawCoord();
1210  }
1211  break;
1212 
1213  default:
1214  break;
1215  }
1216  }
1217 
1219 }
const wxPoint & GetPos0() const
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
BOARD_ITEM * Next() const
double GetOrientation() const
Definition: class_module.h:188
D_PAD * Next() const
Definition: class_pad.h:160
void SetPos0(const wxPoint &aPos)
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
Component value (74LS00, 22K..)
Definition: class_module.h:736
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:165
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
DLIST< D_PAD > & PadsList()
Definition: class_module.h:162
bool MODULE::NeedsPlaced ( ) const
inline

Definition at line 294 of file class_module.h.

References MODULE_to_PLACE.

Referenced by AR_AUTOPLACER::pickModule().

294 { return m_ModuleStatus & MODULE_to_PLACE; }
#define MODULE_to_PLACE
In autoplace: module waiting for autoplace.
Definition: class_module.h:263
int m_ModuleStatus
For autoplace: flags (LOCKED, AUTOPLACED)
Definition: class_module.h:739
MODULE* MODULE::Next ( ) const
inline

Definition at line 122 of file class_module.h.

Referenced by C3D_RENDER_RAYTRACING::add_3D_vias_and_pads_to_container(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Block_SelectItems(), build_pad_testpoints(), GENDRILL_WRITER_BASE::buildHolesList(), ZONE_FILLER::buildZoneFeatureHoleList(), BOARD::ComputeBoundingBox(), BOARD::ConvertBrdLayerToPolygonalContours(), CreateComponentsSection(), CINFO3D_VISU::createLayers(), CreateShapesSection(), CreateSignalsSection(), BOARD_NETLIST_UPDATER::deleteUnusedComponents(), PYTHON_ACTION_PLUGINS::deregister_action(), PCB_DRAW_PANEL_GAL::DisplayBoard(), DRC::doFootprintOverlappingDrc(), PCB_EDIT_FRAME::DoGenFootprintsPositionFile(), doPushPadProperties(), PCB_BASE_FRAME::DoPushPadProperties(), BOARD::Draw(), BOARD::DrawHighLight(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::ExportVRML_File(), BOARD::FindModule(), DSN::SPECCTRA_DB::FlipMODULEs(), PCB_IO::format(), C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads(), BOARD::GetFootprint(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), BOARD::GetLockPoint(), BOARD::GetPad(), DIALOG_GENDRILL::InitDisplayParams(), PCB_EDIT_FRAME::ListAndSelectModuleName(), C3D_RENDER_OGL_LEGACY::load_3D_models(), C3D_RENDER_RAYTRACING::load_3D_models(), PCB_EDIT_FRAME::LockModule(), DIALOG_FIND::onButtonFindItemClick(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_BASE_FRAME::OnTogglePadDrawMode(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), BRDITEMS_PLOTTER::Plot_Edges_Modules(), BRDITEMS_PLOTTER::PlotDrillMarks(), PlotLayerOutlines(), PlotSilkScreen(), PlotSolderMaskLayer(), PlotStandardLayer(), PCB_EDIT_FRAME::ReadPcbNetlist(), PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), RecreateCmpFile(), C3D_RENDER_OGL_LEGACY::render_3D_models(), BOARD::ReplaceNetlist(), DSN::SPECCTRA_DB::RevertMODULEs(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SELECTION_TOOL::selectAllItemsOnSheet(), FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard(), NETINFO_MAPPING::Update(), BOARD_NETLIST_UPDATER::UpdateNetlist(), and DIALOG_NETLIST::verifyFootprints().

122 { return static_cast<MODULE*>( Pnext ); }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:167
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 239 of file base_struct.cpp.

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

Referenced by EDA_ITEM::IsReplaceable(), and LIB_ALIAS::operator==().

240 {
241  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
242  GetChars( GetClass() ) ) );
243 
244  return false;
245 }
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:92
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
MODULE & MODULE::operator= ( const MODULE aOther)

Definition at line 158 of file class_module.cpp.

References Add(), CalculateBoundingBox(), DHEAD::DeleteAll(), m_3D_Drawings, m_Attributs, m_BoundaryBox, m_CntRot180, m_CntRot90, m_Doc, m_Drawings, 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, BOARD_ITEM::Next(), D_PAD::Next(), EDA_ITEM::operator=(), PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, and EDA_ITEM::SetParent().

159 {
160  BOARD_ITEM::operator=( aOther );
161 
162  m_Pos = aOther.m_Pos;
163  m_fpid = aOther.m_fpid;
164  m_Attributs = aOther.m_Attributs;
166  m_Orient = aOther.m_Orient;
167  m_BoundaryBox = aOther.m_BoundaryBox;
168  m_CntRot90 = aOther.m_CntRot90;
169  m_CntRot180 = aOther.m_CntRot180;
171  m_Link = aOther.m_Link;
172  m_Path = aOther.m_Path; //is this correct behavior?
173 
180  m_ThermalGap = aOther.m_ThermalGap;
181 
182  // Copy reference and value
183  *m_Reference = *aOther.m_Reference;
184  m_Reference->SetParent( this );
185  *m_Value = *aOther.m_Value;
186  m_Value->SetParent( this );
187 
188  // Copy auxiliary data: Pads
189  m_Pads.DeleteAll();
190 
191  for( D_PAD* pad = aOther.m_Pads; pad; pad = pad->Next() )
192  {
193  Add( new D_PAD( *pad ) );
194  }
195 
196  // Copy auxiliary data: Drawings
198 
199  for( BOARD_ITEM* item = aOther.m_Drawings; item; item = item->Next() )
200  {
201  switch( item->Type() )
202  {
203  case PCB_MODULE_TEXT_T:
204  case PCB_MODULE_EDGE_T:
205  Add( static_cast<BOARD_ITEM*>( item->Clone() ) );
206  break;
207 
208  default:
209  wxLogMessage( wxT( "MODULE::operator=() internal error: unknown type" ) );
210  break;
211  }
212  }
213 
214  // Copy auxiliary data: 3D_Drawings info
215  m_3D_Drawings.clear();
216  m_3D_Drawings = aOther.m_3D_Drawings;
217  m_Doc = aOther.m_Doc;
218  m_KeyWord = aOther.m_KeyWord;
219 
220  // Ensure auxiliary data is up to date
222 
223  return *this;
224 }
LIB_ID m_fpid
The LIB_ID of the MODULE.
Definition: class_module.h:737
int m_CntRot90
Horizontal automatic placement cost ( 0..10 ).
Definition: class_module.h:752
wxString m_KeyWord
Search keywords to find module in library.
Definition: class_module.h:746
wxString m_Path
Definition: class_module.h:747
Class 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:743
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
double m_LocalSolderPasteMarginRatio
Solder mask margin ratio value of pad size.
Definition: class_module.h:761
int m_LocalSolderPasteMargin
Solder paste margin absolute value.
Definition: class_module.h:760
int m_ThermalGap
Definition: class_module.h:744
void DeleteAll()
Function DeleteAll deletes all items on the list and leaves the list empty.
Definition: dlist.cpp:44
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
wxString m_Doc
File name and path for documentation file.
Definition: class_module.h:745
timestamp_t m_LastEditTime
Definition: class_module.h:749
BOARD_ITEM * Next() const
int m_LocalClearance
Definition: class_module.h:758
double m_Orient
Orientation in tenths of a degree, 900=90.0 degrees.
Definition: class_module.h:733
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
>
EDA_RECT m_BoundaryBox
Bounding box : coordinates on board, real orientation.
Definition: class_module.h:740
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
D_PAD * Next() const
Definition: class_pad.h:160
timestamp_t m_Link
Temporary logical link used during editing.
Definition: class_module.h:751
int m_LocalSolderMaskMargin
Solder mask margin.
Definition: class_module.h:759
std::list< MODULE_3D_SETTINGS > m_3D_Drawings
Linked list of 3D models.
Definition: class_module.h:732
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
int m_CntRot180
Vertical automatic placement cost ( 0..10 ).
Definition: class_module.h:753
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
int m_ModuleStatus
For autoplace: flags (LOCKED, AUTOPLACED)
Definition: class_module.h:739
TEXTE_MODULE * m_Value
Component value (74LS00, 22K..)
Definition: class_module.h:736
wxPoint m_Pos
Position of module on the board in internal units.
Definition: class_module.h:734
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
ZoneConnection m_ZoneConnection
Definition: class_module.h:748
int m_Attributs
Flag bits ( see Mod_Attribut )
Definition: class_module.h:738
const DLIST<D_PAD>& MODULE::PadsList ( ) const
inline

Definition at line 163 of file class_module.h.

163 { return m_Pads; }
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
bool MODULE::PadsLocked ( ) const
inline

Definition at line 303 of file class_module.h.

References MODULE_PADS_LOCKED.

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

#define MODULE_PADS_LOCKED
In autoplace: module waiting for autoplace.
Definition: class_module.h:264
int m_ModuleStatus
For autoplace: flags (LOCKED, AUTOPLACED)
Definition: class_module.h:739
TEXTE_MODULE& MODULE::Reference ( ) const
inline

Definition at line 516 of file class_module.h.

References LSET::AllLayersMask(), GetNextPadName(), and INCLUDE_NPTH.

516 { return *m_Reference; }
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
void MODULE::Remove ( BOARD_ITEM aItem)
overridevirtual

>

Removes an item from the container.

Parameters
aItemis an item to be removed.

Implements BOARD_ITEM_CONTAINER.

Definition at line 312 of file class_module.cpp.

References m_Drawings, m_Pads, PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, PCB_PAD_T, DLIST< T >::Remove(), TEXTE_MODULE::TEXT_is_DIVERS, and EDA_ITEM::Type().

313 {
314  switch( aBoardItem->Type() )
315  {
316  case PCB_MODULE_TEXT_T:
317  // Only user texts can be removed this way. Reference and value are not hold in the DLIST.
318  assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS );
319 
320  // no break
321 
322  case PCB_MODULE_EDGE_T:
323  m_Drawings.Remove( aBoardItem );
324  break;
325 
326  case PCB_PAD_T:
327  m_Pads.Remove( static_cast<D_PAD*>( aBoardItem ) );
328  break;
329 
330  default:
331  {
332  wxString msg;
333  msg.Printf( wxT( "MODULE::Remove() needs work: BOARD_ITEM type (%d) not handled" ),
334  aBoardItem->Type() );
335  wxFAIL_MSG( msg );
336  }
337  }
338 }
T * Remove(T *aElement)
Function Remove removes aElement from the list, but does not delete it.
Definition: dlist.h:211
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
wxString &  aText 
)
inherited

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

References GetChars(), EDA_ITEM::GetClass(), EDA_ITEM::IsReplaceable(), and traceFindReplace.

Referenced by EDA_ITEM::Matches(), SCH_TEXT::Replace(), SCH_FIELD::Replace(), SCH_SHEET_PIN::Replace(), SCH_SHEET::Replace(), and SCH_FIND_COLLECTOR::ReplaceItem().

210 {
211  wxCHECK_MSG( IsReplaceable(), false,
212  wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) );
213 
214  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
215 
216  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
217  aSearchData.GetFindString() :
218  aSearchData.GetFindString().Upper() );
219 
220  if( result == wxNOT_FOUND )
221  return false;
222 
223  wxString prefix = aText.Left( result );
224  wxString suffix;
225 
226  if( aSearchData.GetFindString().length() + result < aText.length() )
227  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
228 
229  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
230  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
231  GetChars( suffix ) );
232 
233  aText = prefix + aSearchData.GetReplaceString() + suffix;
234 
235  return true;
236 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:464
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:92
virtual wxString GetClass() const =0
Function GetClass returns the class name.
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_SHEET_PIN, SCH_FIELD, and SCH_TEXT.

Definition at line 452 of file base_struct.h.

452 { return false; }
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 1069 of file class_module.cpp.

References GetOrientation(), m_Pos, RotatePoint(), SetOrientation(), and SetPosition().

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

1070 {
1071  wxPoint newpos = m_Pos;
1072  RotatePoint( &newpos, aRotCentre, aAngle );
1073  SetPosition( newpos );
1074  SetOrientation( GetOrientation() + aAngle );
1075 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
double GetOrientation() const
Definition: class_module.h:188
void SetPosition(const wxPoint &aPos) override
void SetOrientation(double newangle)
wxPoint m_Pos
Position of module on the board in internal units.
Definition: class_module.h:734
void BOARD_ITEM::Rotate ( const VECTOR2I aRotCentre,
double  aAngle 
)
inlineinherited

Definition at line 256 of file class_board_item.h.

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

257  {
258  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
259  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.
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).

Parameters
aFunctionis the function to be invoked.

Definition at line 909 of file class_module.cpp.

References DisplayError(), m_Drawings, m_Pads, m_Reference, m_Value, BOARD_ITEM::Next(), and D_PAD::Next().

Referenced by PCB_TOOL::doInteractiveItemPlacement(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD_COMMIT::Revert(), and SELECTION::updateDrawList().

910 {
911  try
912  {
913  for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
914  aFunction( static_cast<BOARD_ITEM*>( pad ) );
915 
916  for( BOARD_ITEM* drawing = m_Drawings; drawing; drawing = drawing->Next() )
917  aFunction( drawing );
918 
919  aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
920  aFunction( static_cast<BOARD_ITEM*>( m_Value ) );
921  }
922  catch( std::bad_function_call& )
923  {
924  DisplayError( NULL, wxT( "Error running MODULE::RunOnChildren" ) );
925  }
926 }
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
BOARD_ITEM * Next() const
D_PAD * Next() const
Definition: class_pad.h:160
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
TEXTE_MODULE * m_Value
Component value (74LS00, 22K..)
Definition: class_module.h:736
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 215 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), SCH_EDIT_FRAME::PutDataInPreviousState(), DHEAD::remove(), and SwapItemData().

215 { Pback = aBack; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:168
void EDA_ITEM::SetBrightened ( )
inlineinherited

Definition at line 232 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

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

232 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
void MODULE::SetDescription ( const wxString &  aDoc)
inline

Definition at line 196 of file class_module.h.

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

196 { m_Doc = aDoc; }
wxString m_Doc
File name and path for documentation file.
Definition: class_module.h:745
void MODULE::SetFlag ( int  aFlag)
inline

Definition at line 228 of file class_module.h.

Referenced by PCB_EDIT_FRAME::ExportToGenCAD(), and AR_AUTOPLACER::pickModule().

228 { m_arflag = aFlag; }
int m_arflag
Use to trace ratsnest and auto routing.
Definition: class_module.h:750
void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 256 of file base_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), PCB_BASE_FRAME::AddModuleToBoard(), AddSegmentToDragList(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PCB_EDIT_FRAME::BeginMoveTarget(), SCH_EDIT_FRAME::BeginSegment(), LIB_EDIT_FRAME::BlockCopySelectedItems(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), LIB_EDIT_FRAME::copySelectedItems(), SCH_EDIT_FRAME::CreateBusBusEntry(), SCH_EDIT_FRAME::CreateBusWireEntry(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), LIB_EDIT_FRAME::CreatePin(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), SCH_EDIT_FRAME::DeleteItem(), DrawMovingBlockOutlines(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_SCREEN::GetConnection(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockPlace(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_EDIT_FRAME::ImportSheetPin(), InvokeDialogImportGfxBoard(), InvokeDialogImportGfxModule(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), SCH_EDIT_FRAME::Load_Component(), SCH_SCREEN::MarkConnections(), MarkItemsInBloc(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnSelectUnit(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), PCB_EDIT_FRAME::Other_Layer_Route(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_EDIT_FRAME::ReSizeSheet(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), LIB_EDIT_FRAME::SaveCopyInUndoList(), SCH_SCREEN::SelectBlockItems(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), BLOCK_SELECTOR::SetFlags(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PCB_BASE_FRAME::StartMovePad(), LIB_EDIT_FRAME::StartMovePin(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and UndrawAndMarkSegmentsToDrag().

256 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
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 285 of file base_struct.h.

Referenced by SCH_EDIT_FRAME::OnFindSchematicItem(), and SCH_EDIT_FRAME::updateFindReplaceView().

285 { m_forceVisible = aEnable; }
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:175
void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 231 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

231 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:137
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 691 of file class_module.h.

692  {
693  delete m_initial_comments;
694  m_initial_comments = aInitialComments;
695  }
wxArrayString * m_initial_comments
leading s-expression comments in the module, lazily allocated only if needed for speed ...
Definition: class_module.h:764
void MODULE::SetIsPlaced ( bool  isPlaced)
inline

Definition at line 286 of file class_module.h.

References MODULE_is_PLACED.

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

287  {
288  if( isPlaced )
290  else
292  }
#define MODULE_is_PLACED
In autoplace: module automatically placed.
Definition: class_module.h:262
int m_ModuleStatus
For autoplace: flags (LOCKED, AUTOPLACED)
Definition: class_module.h:739
void MODULE::SetKeywords ( const wxString &  aKeywords)
inline

Definition at line 199 of file class_module.h.

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

199 { m_KeyWord = aKeywords; }
wxString m_KeyWord
Search keywords to find module in library.
Definition: class_module.h:746
void MODULE::SetLastEditTime ( )
inline

Definition at line 314 of file class_module.h.

314 { m_LastEditTime = time( NULL ); }
timestamp_t m_LastEditTime
Definition: class_module.h:749
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 141 of file class_board_item.h.

References BOARD_ITEM::Draw(), and BOARD_ITEM::SwapData().

Referenced by DXF2BRD_CONVERTER::addArc(), DXF2BRD_CONVERTER::addCircle(), PNS_KICAD_IFACE::AddItem(), DXF2BRD_CONVERTER::addLine(), DXF2BRD_CONVERTER::addMText(), DXF2BRD_CONVERTER::addText(), 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::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Create_MuWavePolygonShape(), MWAVE::CreateMicrowaveInductor(), PCB_BASE_FRAME::CreateNewModule(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::drawSegment(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), TEXTE_PCB::Flip(), PCB_TARGET::Flip(), EDGE_MODULE::Flip(), TEXTE_MODULE::Flip(), TRACK::Flip(), Flip(), DRAWSEGMENT::Flip(), DXF2BRD_CONVERTER::insertArc(), DXF2BRD_CONVERTER::insertLine(), DXF2BRD_CONVERTER::insertSpline(), 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(), PCB_EDIT_FRAME::Other_Layer_Route(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageSMD(), EAGLE_PLUGIN::packageText(), EAGLE_PLUGIN::packageWire(), GPCB_FPL_CACHE::parseMODULE(), DRAWING_TOOL::PlaceText(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotPcbTarget(), processBoardItem(), 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(), ShowNewTrackWhenMovingCursor(), TEXTE_MODULE::TEXTE_MODULE(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow().

142  {
143  // trap any invalid layers, then go find the caller and fix it.
144  // wxASSERT( unsigned( aLayer ) < unsigned( NB_PCB_LAYERS ) );
145  m_Layer = aLayer;
146  }
PCB_LAYER_ID m_Layer
void MODULE::SetLink ( timestamp_t  aLink)
inline
void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 217 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), DHEAD::remove(), and SwapItemData().

217 { m_List = aList; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:169
void MODULE::SetLocalClearance ( int  aClearance)
inline
void MODULE::SetLocalSolderMaskMargin ( int  aMargin)
inline
void MODULE::SetLocalSolderPasteMargin ( int  aMargin)
inline
void MODULE::SetLocalSolderPasteMarginRatio ( double  aRatio)
inline
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 277 of file class_module.h.

References MODULE_is_LOCKED.

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

278  {
279  if( isLocked )
281  else
283  }
#define MODULE_is_LOCKED
module LOCKED: no autoplace allowed
Definition: class_module.h:261
int m_ModuleStatus
For autoplace: flags (LOCKED, AUTOPLACED)
Definition: class_module.h:739
void EDA_ITEM::SetModified ( )
inherited
void MODULE::SetNeedsPlaced ( bool  needsPlaced)
inline

Definition at line 295 of file class_module.h.

References MODULE_to_PLACE.

Referenced by AR_AUTOPLACER::AutoplaceModules().

296  {
297  if( needsPlaced )
299  else
301  }
#define MODULE_to_PLACE
In autoplace: module waiting for autoplace.
Definition: class_module.h:263
int m_ModuleStatus
For autoplace: flags (LOCKED, AUTOPLACED)
Definition: class_module.h:739
void EDA_ITEM::SetNext ( EDA_ITEM aNext)
inlineinherited

Definition at line 214 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), SCH_EDIT_FRAME::PutDataInPreviousState(), DHEAD::remove(), and SwapItemData().

214 { Pnext = aNext; }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:167
void MODULE::SetOrientation ( double  newangle)

Definition at line 1222 of file class_module.cpp.

References CalculateBoundingBox(), m_Drawings, m_Orient, m_Pads, m_Reference, m_Value, BOARD_ITEM::Next(), D_PAD::Next(), NORMALIZE_ANGLE_POS(), 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(), LEGACY_PLUGIN::loadMODULE(), EAGLE_PLUGIN::orientModuleAndText(), Rotate(), PCB_BASE_FRAME::Rotate_Module(), and AR_AUTOPLACER::rotateModule().

1223 {
1224  double angleChange = newangle - m_Orient; // change in rotation
1225 
1226  NORMALIZE_ANGLE_POS( newangle );
1227 
1228  m_Orient = newangle;
1229 
1230  for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
1231  {
1232  pad->SetOrientation( pad->GetOrientation() + angleChange );
1233  pad->SetDrawCoord();
1234  }
1235 
1236  // Update of the reference and value.
1238  m_Value->SetDrawCoord();
1239 
1240  // Displace contours and text of the footprint.
1241  for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
1242  {
1243  if( item->Type() == PCB_MODULE_EDGE_T )
1244  {
1245  static_cast<EDGE_MODULE*>( item )->SetDrawCoord();
1246  }
1247  else if( item->Type() == PCB_MODULE_TEXT_T )
1248  {
1249  static_cast<TEXTE_MODULE*>( item )->SetDrawCoord();
1250  }
1251  }
1252 
1254 }
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:241
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
BOARD_ITEM * Next() const
double m_Orient
Orientation in tenths of a degree, 900=90.0 degrees.
Definition: class_module.h:733
D_PAD * Next() const
Definition: class_pad.h:160
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
DLIST< BOARD_ITEM > m_Drawings
Linked list of graphical items.
Definition: class_module.h:731
void SetDrawCoord()
Set absolute coordinates.
TEXTE_MODULE * m_Value
Component value (74LS00, 22K..)
Definition: class_module.h:736
TEXTE_MODULE * m_Reference
Component reference designator value (U34, R18..)
Definition: class_module.h:735
DLIST< D_PAD > m_Pads
Linked list of pads.
Definition: class_module.h:730
void MODULE::SetOrientationDegrees ( double  aOrientation)
inline

Definition at line 187 of file class_module.h.

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