KiCad PCB EDA Suite
SCH_COMPONENT Class Reference

Class SCH_COMPONENT describes a real schematic component. More...

#include <sch_component.h>

Inheritance diagram for SCH_COMPONENT:
SCH_ITEM EDA_ITEM KIGFX::VIEW_ITEM

Public Types

enum  AUTOPLACED { AUTOPLACED_NO = 0, AUTOPLACED_AUTO, AUTOPLACED_MANUAL }
 

Public Member Functions

 SCH_COMPONENT (const wxPoint &pos=wxPoint(0, 0), SCH_ITEM *aParent=NULL)
 
 SCH_COMPONENT (LIB_PART &aPart, LIB_ID aLibId, SCH_SHEET_PATH *aSheet, int unit=0, int convert=0, const wxPoint &pos=wxPoint(0, 0))
 Create schematic component from library component object. More...
 
 SCH_COMPONENT (LIB_PART &aPart, SCH_SHEET_PATH *aSheet, SCH_BASE_FRAME::COMPONENT_SELECTION &aSel, const wxPoint &pos=wxPoint(0, 0))
 
 SCH_COMPONENT (const SCH_COMPONENT &aComponent)
 Clones aComponent into a new schematic symbol object. More...
 
 ~SCH_COMPONENT ()
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
const wxArrayString & GetPathsAndReferences () const
 
void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
bool IsMovableFromAnchorPoint () override
 Return true for items which are moved with the anchor point at mouse cursor and false for items moved with no reference to anchor. More...
 
void SetLibId (const LIB_ID &aName, PART_LIBS *aLibs=NULL)
 
void SetLibId (const LIB_ID &aLibId, SYMBOL_LIB_TABLE *aSymLibTable, PART_LIB *aCacheLib)
 
const LIB_IDGetLibId () const
 
std::unique_ptr< LIB_PART > & GetPartRef ()
 
wxString GetDescription () const
 Return information about the aliased parts. More...
 
wxString GetDatasheet () const
 Return the documentation text for the given part alias. More...
 
bool Resolve (PART_LIBS *aLibs)
 Assigns the current LIB_PART from aLibs which this symbol is based on. More...
 
bool Resolve (SYMBOL_LIB_TABLE &aLibTable, PART_LIB *aCacheLib=NULL)
 
int GetUnit () const
 
void UpdatePins (SCH_SHEET_PATH *aSheet=nullptr)
 Updates the local cache of SCH_PIN_CONNECTION objects for each pin. More...
 
SCH_CONNECTIONGetConnectionForPin (LIB_PIN *aPin, const SCH_SHEET_PATH &aSheet)
 Retrieves the connection for a given pin of the component. More...
 
void SetUnit (int aUnit)
 Change the unit number to aUnit. More...
 
void UpdateUnit (int aUnit)
 Change the unit number to aUnit without setting any internal flags. More...
 
int GetConvert () const
 
void SetConvert (int aConvert)
 
wxString GetPrefix () const
 
void SetPrefix (const wxString &aPrefix)
 
TRANSFORMGetTransform () const
 
void SetTransform (const TRANSFORM &aTransform)
 
int GetUnitCount () const
 Return the number of units per package of the symbol. More...
 
void SetOrientation (int aOrientation)
 Compute the new transform matrix based on aOrientation for the symbol which is applied to the current transform. More...
 
int GetOrientation ()
 Get the display symbol orientation. More...
 
void GetMsgPanelInfo (EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
void ClearAnnotation (SCH_SHEET_PATH *aSheetPath)
 Clear exiting component annotation. More...
 
bool AddSheetPathReferenceEntryIfMissing (const wxString &aSheetPathName)
 Add aSheetPath in m_PathsAndReferences alternate references list, if this entry does not exist Do nothing if already exists. More...
 
void SetTimeStamp (timestamp_t aNewTimeStamp)
 Change the time stamp to aNewTimeStamp and updates the reference path. More...
 
bool ClearAllHighlightFlags ()
 Clear the HIGHLIGHTED flag of all items of the component (fields, pins ...) More...
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes. More...
 
EDA_RECT GetBodyBoundingBox () const
 Return a bounding box for the symbol body but not the fields. More...
 
SCH_FIELDGetField (int aFieldNdx) const
 Returns a field in this symbol. More...
 
wxString GetFieldText (const wxString &aFieldName, SCH_EDIT_FRAME *aFrame) const
 Search for a field named aFieldName and returns text associated with this field. More...
 
void GetFields (std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
 Populates a std::vector with SCH_FIELDs. More...
 
SCH_FIELDAddField (const SCH_FIELD &aField)
 Add a field to the symbol. More...
 
void RemoveField (const wxString &aFieldName)
 Removes a user field from the symbol. More...
 
SCH_FIELDFindField (const wxString &aFieldName, bool aIncludeDefaultFields=true)
 Search for a SCH_FIELD with aFieldName. More...
 
void SetFields (const SCH_FIELDS &aFields)
 Set multiple schematic fields. More...
 
void UpdateFields (bool aResetStyle, bool aResetRef=false)
 Restores fields to the original library values. More...
 
int GetFieldCount () const
 Return the number of fields in this symbol. More...
 
AUTOPLACED GetFieldsAutoplaced () const
 Return whether the fields have been automatically placed. More...
 
void ClearFieldsAutoplaced ()
 Set fields automatically placed flag false. More...
 
void AutoplaceFields (SCH_SCREEN *aScreen, bool aManual)
 Automatically orient all the fields in the component. More...
 
void AutoAutoplaceFields (SCH_SCREEN *aScreen)
 Autoplace fields only if correct to do so automatically. More...
 
LIB_PINGetPin (const wxString &number)
 Find a symbol pin by number. More...
 
void GetPins (std::vector< LIB_PIN * > &aPinsList)
 Populate a vector with all the pins from the library object. More...
 
SCH_PINSGetPins ()
 
void Print (wxDC *aDC, const wxPoint &aOffset) override
 Print a component. More...
 
void SwapData (SCH_ITEM *aItem) override
 Function SwapData swap the internal data structures aItem with the schematic item. More...
 
wxString GetPath (const SCH_SHEET_PATH *sheet) const
 
const wxString GetRef (const SCH_SHEET_PATH *aSheet)
 Return the reference for the given sheet path. More...
 
void SetRef (const SCH_SHEET_PATH *aSheet, const wxString &aReference)
 Set the reference for the given sheet path for this symbol. More...
 
bool IsAnnotated (const SCH_SHEET_PATH *aSheet)
 Checks if the component has a valid annotation (reference) for the given sheet path. More...
 
void AddHierarchicalReference (const wxString &aPath, const wxString &aRef, int aMulti)
 Add a full hierarchical reference to this symbol. More...
 
int GetUnitSelection (SCH_SHEET_PATH *aSheet)
 
void SetUnitSelection (SCH_SHEET_PATH *aSheet, int aUnitSelection)
 
void Move (const wxPoint &aMoveVector) override
 Function Move moves the item by aMoveVector to a new position. More...
 
void MirrorY (int aYaxis_position) override
 Function MirrorY mirrors item relative to the Y axis about aYaxis_position. More...
 
void MirrorX (int aXaxis_position) override
 Function MirrorX mirrors item relative to the X axis about aXaxis_position. More...
 
void Rotate (wxPoint aPosition) override
 Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction. More...
 
bool Matches (wxFindReplaceData &aSearchData, void *aAuxData) override
 Function Matches compares the item against the search criteria in aSearchData. More...
 
void GetEndPoints (std::vector< DANGLING_END_ITEM > &aItemList) override
 Function GetEndPoints adds the schematic item end points to aItemList if the item has end points. More...
 
bool UpdateDanglingState (std::vector< DANGLING_END_ITEM > &aItemList) override
 Test if the component's dangling state has changed for all pins. More...
 
wxPoint GetPinPhysicalPosition (const LIB_PIN *Pin) const
 
bool IsConnectable () const override
 Function IsConnectable returns true if the schematic item can connect to another schematic item. More...
 
bool CanConnect (const SCH_ITEM *aItem) const override
 
bool IsInNetlist () const
 
void GetConnectionPoints (std::vector< wxPoint > &aPoints) const override
 Function GetConnectionPoints add all the connection points for this item to aPoints. 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...
 
LIB_ITEMGetDrawItem (const wxPoint &aPosition, KICAD_T aType=TYPE_NOT_INIT)
 Return the component library item at aPosition that is part of this component. 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...
 
void GetNetListItem (NETLIST_OBJECT_LIST &aNetListItems, SCH_SHEET_PATH *aSheetPath) override
 Function GetNetListItem creates a new NETLIST_OBJECT for the schematic object and adds it to aNetListItems. More...
 
bool operator< (const SCH_ITEM &aItem) const override
 
bool operator== (const SCH_COMPONENT &aComponent) const
 
bool operator!= (const SCH_COMPONENT &aComponent) const
 
SCH_COMPONENToperator= (const SCH_ITEM &aItem)
 
bool IsReplaceable () const override
 Function IsReplaceable. More...
 
wxPoint GetPosition () const override
 Function GetPosition. More...
 
void SetPosition (const wxPoint &aPosition) override
 Function SetPosition set the schematic item position to aPosition. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Function HitTest tests if aPosition is contained within or on the bounding box of an item. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
void Plot (PLOTTER *aPlotter) override
 Function Plot plots the schematic item to aPlotter. More...
 
EDA_ITEMClone () const override
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
void ClearBrightenedPins ()
 
bool HasBrightenedPins ()
 
void BrightenPin (LIB_PIN *aPin)
 
void ClearHighlightedPins ()
 
bool HasHighlightedPins ()
 
void HighlightPin (LIB_PIN *aPin)
 
SCH_ITEMNext () const
 
SCH_ITEMBack () const
 
SCH_ITEMDuplicate (bool doClone=false)
 Routine to create a new copy of given item. More...
 
wxPoint & GetStoredPos ()
 
void SetStoredPos (wxPoint aPos)
 
virtual bool IsLocked () const
 Function IsLocked. More...
 
virtual void SetLocked (bool aLocked)
 Function SetLocked modifies 'lock' status for of the item. More...
 
SCH_LAYER_ID GetLayer () const
 Function GetLayer returns the layer this item is on. More...
 
void SetLayer (SCH_LAYER_ID aLayer)
 Function SetLayer sets the layer this item is on. More...
 
virtual int GetPenSize () const
 Function GetPenSize virtual pure. More...
 
virtual bool Load (LINE_READER &aLine, wxString &aErrorMsg)
 Function Load reads a schematic item from aLine in a .sch file. More...
 
virtual bool IsDangling () const
 
void ClearConnections ()
 Function ClearConnections clears all of the connection items from the list. More...
 
bool IsConnected (const wxPoint &aPoint) const
 Function IsConnected tests the item to see if it is connected to aPoint. More...
 
SCH_CONNECTIONConnection (const SCH_SHEET_PATH &aPath) const
 Retrieves the connection associated with this object in the given sheet. More...
 
std::unordered_set< SCH_ITEM * > & ConnectedItems ()
 Retrieves the set of items connected to this item (schematic only) More...
 
void AddConnectionTo (SCH_ITEM *aItem)
 Adds a connection link between this item and another. More...
 
SCH_CONNECTIONInitializeConnection (const SCH_SHEET_PATH &aPath)
 Creates a new connection object associated with this object. More...
 
virtual bool ConnectionPropagatesTo (const EDA_ITEM *aItem) const
 Returns true if this item should propagate connection info to aItem. More...
 
bool IsConnectivityDirty ()
 
void SetConnectivityDirty (bool aDirty=true)
 
virtual bool CanIncrementLabel () const
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
KICAD_T Type () const
 Function Type() More...
 
timestamp_t GetTimeStamp () const
 
EDA_ITEMGetParent () 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 HasFlag (STATUS_FLAGS aFlag)
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual 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 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 const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
virtual unsigned int ViewGetLOD (int aLayer, VIEW *aView) const
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
static void ResolveAll (const EE_COLLECTOR &aComponents, SYMBOL_LIB_TABLE &aLibTable, PART_LIB *aCacheLib=NULL)
 
static void UpdatePins (const EE_COLLECTOR &aComponents)
 Update the pin cache for all components in aComponents. More...
 
static bool IsReferenceStringValid (const wxString &aReferenceString)
 Tests for an acceptable reference string. 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...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
static bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Protected Member Functions

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

Protected Attributes

SCH_LAYER_ID m_Layer
 
EDA_ITEMS m_connections
 List of items connected to this item. More...
 
wxPoint m_storedPos
 a temporary variable used in some move commands

to store a initial pos (of the item or mouse cursor)

More...
 
std::unordered_set< SCH_ITEM * > m_connected_items
 Stores pointers to other items that are connected to this one (schematic only) More...
 
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
 Stores connectivity information, per sheet. More...
 
bool m_connectivity_dirty
 True if connectivity info might be out of date. More...
 
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 Member Functions

void Init (const wxPoint &pos=wxPoint(0, 0))
 
bool doIsConnected (const wxPoint &aPosition) const override
 Function doIsConnected provides the object specific test to see if it is connected to aPosition. More...
 

Private Attributes

wxPoint m_Pos
 Name and library where symbol was loaded from, i.e. "74xx:74LS00". More...
 
LIB_ID m_lib_id
 
int m_unit
 The unit for multiple part per package components. More...
 
int m_convert
 The alternate body style for components that have more than one body style defined. More...
 
wxString m_prefix
 C, R, U, Q etc - the first character which typically indicates what the component is. More...
 
TRANSFORM m_transform
 The rotation/mirror transformation matrix. More...
 
SCH_FIELDS m_Fields
 Variable length list of fields. More...
 
std::unique_ptr< LIB_PARTm_part
 
SCH_PINS m_pins
 the component's pins More...
 
SCH_PIN_MAP m_pinMap
 the component's pins mapped by LIB_PIN*. More...
 
AUTOPLACED m_fieldsAutoplaced
 indicates status of field autoplacement More...
 
bool m_isInNetlist
 True if the component should appear in the netlist. More...
 
wxArrayString m_PathsAndReferences
 Defines the hierarchical path and reference of the component. More...
 

Detailed Description

Class SCH_COMPONENT describes a real schematic component.

Definition at line 73 of file sch_component.h.

Member Enumeration Documentation

◆ AUTOPLACED

Enumerator
AUTOPLACED_NO 
AUTOPLACED_AUTO 
AUTOPLACED_MANUAL 

Definition at line 76 of file sch_component.h.

Constructor & Destructor Documentation

◆ SCH_COMPONENT() [1/4]

SCH_COMPONENT::SCH_COMPONENT ( const wxPoint &  pos = wxPoint( 0, 0 ),
SCH_ITEM aParent = NULL 
)

Definition at line 116 of file sch_component.cpp.

116  :
117  SCH_ITEM( aParent, SCH_COMPONENT_T )
118 {
119  Init( aPos );
121 }
void Init(const wxPoint &pos=wxPoint(0, 0))
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
Definition: sch_item.cpp:46

References AUTOPLACED_NO, Init(), and m_fieldsAutoplaced.

Referenced by Clone().

◆ SCH_COMPONENT() [2/4]

SCH_COMPONENT::SCH_COMPONENT ( LIB_PART aPart,
LIB_ID  aLibId,
SCH_SHEET_PATH aSheet,
int  unit = 0,
int  convert = 0,
const wxPoint &  pos = wxPoint( 0, 0 ) 
)

Create schematic component from library component object.

Parameters
aPart- library part to create schematic component from.
aLibId- libId of alias to create.
aSheet- Schematic sheet the component is place into.
unit- Part for components that have multiple parts per package.
convert- Use the alternate body style for the schematic component.
pos- Position to place new component.
setNewItemFlag- Set the component IS_NEW and IS_MOVED flags.

Definition at line 124 of file sch_component.cpp.

125  :
126  SCH_ITEM( NULL, SCH_COMPONENT_T )
127 {
128  Init( pos );
129 
130  m_unit = unit;
131  m_convert = convert;
132  m_lib_id = aLibId;
133  m_part.reset( new LIB_PART( aPart ) );
135 
137 
138  // Copy fields from the library component
139  UpdateFields( true, true );
140 
141  // Update the pin locations
142  UpdatePins();
143 
144  // Update the reference -- just the prefix for now.
145  if( sheet )
146  SetRef( sheet, aPart.GetReferenceField().GetText() + wxT( "?" ) );
147  else
148  m_prefix = aPart.GetReferenceField().GetText() + wxT( "?" );
149 }
void UpdateFields(bool aResetStyle, bool aResetRef=false)
Restores fields to the original library values.
static void UpdatePins(const EE_COLLECTOR &aComponents)
Update the pin cache for all components in aComponents.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Change the time stamp to aNewTimeStamp and updates the reference path.
timestamp_t GetNewTimeStamp()
Definition: common.cpp:217
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
Define a library symbol object.
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
void Init(const wxPoint &pos=wxPoint(0, 0))
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:86
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is.
Definition: sch_component.h:89
virtual const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:124
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
Definition: sch_item.cpp:46

References AUTOPLACED_NO, GetNewTimeStamp(), LIB_PART::GetReferenceField(), EDA_TEXT::GetText(), Init(), m_convert, m_fieldsAutoplaced, m_lib_id, m_part, m_prefix, m_unit, SetRef(), SetTimeStamp(), UpdateFields(), and UpdatePins().

◆ SCH_COMPONENT() [3/4]

SCH_COMPONENT::SCH_COMPONENT ( LIB_PART aPart,
SCH_SHEET_PATH aSheet,
SCH_BASE_FRAME::COMPONENT_SELECTION aSel,
const wxPoint &  pos = wxPoint( 0, 0 ) 
)

Definition at line 151 of file sch_component.cpp.

152  :
153  SCH_COMPONENT( aPart, aSel.LibId, aSheet, aSel.Unit, aSel.Convert, pos )
154 {
155  // Set any fields that were modified as part of the component selection
156  for( auto const& i : aSel.Fields )
157  {
158  auto field = this->GetField( i.first );
159 
160  if( field )
161  field->SetText( i.second );
162  }
163 }
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
SCH_COMPONENT(const wxPoint &pos=wxPoint(0, 0), SCH_ITEM *aParent=NULL)
std::vector< std::pair< int, wxString > > Fields
size_t i
Definition: json11.cpp:649

References SCH_BASE_FRAME::COMPONENT_SELECTION::Fields, GetField(), and i.

◆ SCH_COMPONENT() [4/4]

SCH_COMPONENT::SCH_COMPONENT ( const SCH_COMPONENT aComponent)

Clones aComponent into a new schematic symbol object.

All fields are copied as is except for the linked list management pointers which are set to NULL, and the SCH_FIELD's m_Parent pointers which are set to the new object.

Parameters
aComponentis the schematic symbol to clone.

Definition at line 166 of file sch_component.cpp.

166  :
167  SCH_ITEM( aComponent )
168 {
169  m_Parent = aComponent.m_Parent;
170  m_Pos = aComponent.m_Pos;
171  m_unit = aComponent.m_unit;
172  m_convert = aComponent.m_convert;
173  m_lib_id = aComponent.m_lib_id;
174 
175  if( aComponent.m_part )
176  m_part.reset( new LIB_PART( *aComponent.m_part.get() ) );
177 
178  SetTimeStamp( aComponent.m_TimeStamp );
179 
180  m_transform = aComponent.m_transform;
181  m_prefix = aComponent.m_prefix;
183  m_Fields = aComponent.m_Fields;
184 
185  // Re-parent the fields, which before this had aComponent as parent
186  for( SCH_FIELD& field : m_Fields )
187  field.SetParent( this );
188 
189  UpdatePins();
190 
192 }
static void UpdatePins(const EE_COLLECTOR &aComponents)
Update the pin cache for all components in aComponents.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Change the time stamp to aNewTimeStamp and updates the reference path.
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:180
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:181
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
Define a library symbol object.
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:86
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is.
Definition: sch_component.h:89
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
Definition: sch_item.cpp:46

References m_convert, m_Fields, m_fieldsAutoplaced, m_lib_id, EDA_ITEM::m_Parent, m_part, m_PathsAndReferences, m_Pos, m_prefix, EDA_ITEM::m_TimeStamp, m_transform, m_unit, SetTimeStamp(), and UpdatePins().

◆ ~SCH_COMPONENT()

SCH_COMPONENT::~SCH_COMPONENT ( )
inline

Definition at line 150 of file sch_component.h.

150 { }

Member Function Documentation

◆ AddConnectionTo()

void SCH_ITEM::AddConnectionTo ( SCH_ITEM aItem)
inherited

Adds a connection link between this item and another.

Definition at line 143 of file sch_item.cpp.

144 {
145  m_connected_items.insert( aItem );
146 }
std::unordered_set< SCH_ITEM * > m_connected_items
Stores pointers to other items that are connected to this one (schematic only)
Definition: sch_item.h:125

References SCH_ITEM::m_connected_items.

Referenced by SCH_TEXT::UpdateDanglingState().

◆ AddField()

SCH_FIELD * SCH_COMPONENT::AddField ( const SCH_FIELD aField)

Add a field to the symbol.

Parameters
aFieldis the field to add to this symbol.
Returns
the newly inserted field.

Definition at line 861 of file sch_component.cpp.

862 {
863  int newNdx = m_Fields.size();
864 
865  m_Fields.push_back( aField );
866  return &m_Fields[newNdx];
867 }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94

References m_Fields.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), Init(), and UpdateFields().

◆ AddHierarchicalReference()

void SCH_COMPONENT::AddHierarchicalReference ( const wxString &  aPath,
const wxString &  aRef,
int  aMulti 
)

Add a full hierarchical reference to this symbol.

Parameters
aPathis the hierarchical path (/&ltsheet timestamp&gt/&ltcomponent timestamp&gt like /05678E50/A23EF560)
aRefis the local reference like C45, R56
aMultiis the unit selection used for symbols with multiple units per package.

Definition at line 576 of file sch_component.cpp.

578 {
579  wxString h_path, h_ref;
580  wxStringTokenizer tokenizer;
581  wxString separators( wxT( " " ) );
582 
583  // Search for an existing path and remove it if found (should not occur)
584  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
585  {
586  tokenizer.SetString( m_PathsAndReferences[ii], separators );
587  h_path = tokenizer.GetNextToken();
588 
589  if( h_path.Cmp( aPath ) == 0 )
590  {
591  m_PathsAndReferences.RemoveAt( ii );
592  ii--;
593  }
594  }
595 
596  h_ref = aPath + wxT( " " ) + aRef;
597  h_ref << wxT( " " ) << aMulti;
598  m_PathsAndReferences.Add( h_ref );
599 }
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.

References m_PathsAndReferences.

Referenced by AddSheetPathReferenceEntryIfMissing(), SetRef(), and SetUnitSelection().

◆ AddSheetPathReferenceEntryIfMissing()

bool SCH_COMPONENT::AddSheetPathReferenceEntryIfMissing ( const wxString &  aSheetPathName)

Add aSheetPath in m_PathsAndReferences alternate references list, if this entry does not exist Do nothing if already exists.

In component lists shared by more than one sheet path, an entry for each sheet path must exist to manage references

Parameters
aSheetPathNameis the candidate sheet path name this sheet path is the sheet path of the sheet containing the component, not the full component sheet path
Returns
false if the alternate reference was existing, true if added.

Definition at line 1067 of file sch_component.cpp.

1068 {
1069  // a empty sheet path is illegal:
1070  wxCHECK( !aSheetPathName.IsEmpty(), false );
1071 
1072  wxString reference_path;
1073 
1074  // The full component reference path is aSheetPathName + the component time stamp itself
1075  // full_AR_path is the alternate reference path to search
1076  wxString full_AR_path = aSheetPathName
1077  + wxString::Format( "%8.8lX", (unsigned long) GetTimeStamp() );
1078 
1079  for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
1080  {
1081  // Break hierarchical reference in path, ref and multi selection:
1082  reference_path = m_PathsAndReferences[ii].BeforeFirst( ' ' );
1083 
1084  // if aSheetPath is found, nothing to do:
1085  if( reference_path.Cmp( full_AR_path ) == 0 )
1086  return false;
1087  }
1088 
1089  // This entry does not exist: add it, with a (temporary?) reference (last ref used for display)
1091  return true;
1092 }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
Field Reference of part, i.e. "IC21".
timestamp_t GetTimeStamp() const
Definition: base_struct.h:216
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
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 AddHierarchicalReference(const wxString &aPath, const wxString &aRef, int aMulti)
Add a full hierarchical reference to this symbol.

References AddHierarchicalReference(), Format(), GetText(), EDA_ITEM::GetTimeStamp(), m_Fields, m_PathsAndReferences, m_unit, and REFERENCE.

◆ AutoAutoplaceFields()

void SCH_COMPONENT::AutoAutoplaceFields ( SCH_SCREEN aScreen)
inline

Autoplace fields only if correct to do so automatically.

Fields that have been moved by hand are not automatically placed.

Parameters
aScreenis the SCH_SCREEN associated with the current instance of the component.

Definition at line 444 of file sch_component.h.

445  {
446  if( GetFieldsAutoplaced() )
448  }
AUTOPLACED GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Automatically orient all the fields in the component.

References AUTOPLACED_MANUAL, AutoplaceFields(), and GetFieldsAutoplaced().

Referenced by SCH_EDIT_TOOL::editComponentFieldText(), SCH_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Rotate(), and SCH_EDIT_FRAME::SelectUnit().

◆ AutoplaceFields()

void SCH_COMPONENT::AutoplaceFields ( SCH_SCREEN aScreen,
bool  aManual 
)

Automatically orient all the fields in the component.

Parameters
aScreenis the SCH_SCREEN associated with the current instance of the component. This can be NULL when aManual is false.
aManualshould be true if the autoplace was manually initiated (e.g. by a hotkey or a menu item). Some more 'intelligent' routines will be used that would be annoying if done automatically during moves.

Definition at line 686 of file autoplace_fields.cpp.

687 {
688  if( aManual )
689  wxASSERT_MSG( aScreen, "A SCH_SCREEN pointer must be given for manual autoplacement" );
690  AUTOPLACER autoplacer( this, aScreen );
691  autoplacer.DoAutoplace( aManual );
693 }
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement

References AUTOPLACED_AUTO, AUTOPLACED_MANUAL, AUTOPLACER::DoAutoplace(), and m_fieldsAutoplaced.

Referenced by LIB_CONTROL::AddSymbolToSchematic(), AutoAutoplaceFields(), SCH_EDIT_TOOL::AutoplaceFields(), and SCH_DRAWING_TOOLS::PlaceComponent().

◆ Back()

SCH_ITEM* SCH_ITEM::Back ( ) const
inlineinherited

Definition at line 154 of file sch_item.h.

154 { return static_cast<SCH_ITEM*>( Pback ); }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:177

References EDA_ITEM::Pback.

Referenced by SCH_SHEET_PATH::FindPreviousItem(), and SCH_SHEET_LIST::FindPreviousItem().

◆ BrightenPin()

void SCH_COMPONENT::BrightenPin ( LIB_PIN aPin)

Definition at line 1885 of file sch_component.cpp.

1886 {
1887  if( m_pinMap.count( aPin ) )
1888  m_pins[ m_pinMap.at( aPin ) ].SetBrightened();
1889 }
SCH_PINS m_pins
the component's pins
Definition: sch_component.h:99
SCH_PIN_MAP m_pinMap
the component's pins mapped by LIB_PIN*.

References m_pinMap, and m_pins.

Referenced by SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ CanConnect()

bool SCH_COMPONENT::CanConnect ( const SCH_ITEM aItem) const
inlineoverridevirtual

Reimplemented from SCH_ITEM.

Definition at line 577 of file sch_component.h.

578  {
579  return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
580  ( aItem->Type() == SCH_NO_CONNECT_T ) ||
581  ( aItem->Type() == SCH_JUNCTION_T ) ||
582  ( aItem->Type() == SCH_COMPONENT_T ) ;
583  }
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
Definition: sch_item.h:193
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References SCH_ITEM::GetLayer(), LAYER_WIRE, SCH_COMPONENT_T, SCH_JUNCTION_T, SCH_LINE_T, SCH_NO_CONNECT_T, and EDA_ITEM::Type().

◆ CanIncrementLabel()

virtual bool SCH_ITEM::CanIncrementLabel ( ) const
inlinevirtualinherited

Reimplemented in SCH_TEXT.

Definition at line 359 of file sch_item.h.

359 { return false; }

Referenced by SCH_EDIT_TOOL::RepeatDrawItem().

◆ ClassOf()

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

Definition at line 152 of file sch_component.h.

153  {
154  return aItem && SCH_COMPONENT_T == aItem->Type();
155  }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References SCH_COMPONENT_T, and EDA_ITEM::Type().

◆ ClearAllHighlightFlags()

bool SCH_COMPONENT::ClearAllHighlightFlags ( )

Clear the HIGHLIGHTED flag of all items of the component (fields, pins ...)

Definition at line 1918 of file sch_component.cpp.

1919 {
1920  bool retVal = false;
1921 
1922  if( IsHighlighted() )
1923  {
1925  retVal = true;
1926  }
1927 
1928  // Clear the HIGHLIGHTED flag of pins
1929  if( HasHighlightedPins() )
1930  {
1932  retVal = true;
1933  }
1934 
1935  // Clear the HIGHLIGHTED flag of other items, currently only fields
1936  for( SCH_FIELD& each_field : m_Fields )
1937  {
1938  if( each_field.IsHighlighted() )
1939  {
1940  each_field.ClearFlags( HIGHLIGHTED );
1941  retVal = true;
1942  }
1943  }
1944 
1945  return retVal;
1946 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94
bool HasHighlightedPins()
bool IsHighlighted() const
Definition: base_struct.h:235
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:266
void ClearHighlightedPins()

References EDA_ITEM::ClearFlags(), ClearHighlightedPins(), HasHighlightedPins(), HIGHLIGHTED, EDA_ITEM::IsHighlighted(), and m_Fields.

◆ ClearAnnotation()

void SCH_COMPONENT::ClearAnnotation ( SCH_SHEET_PATH aSheetPath)

Clear exiting component annotation.

For example, IC23 would be changed to IC? and unit number would be reset.

Parameters
aSheetPathis the hierarchical path of the symbol to clear or remove all annotations for this symbol if NULL.

Definition at line 1018 of file sch_component.cpp.

1019 {
1020  wxArrayString reference_fields;
1021  static const wxChar separators[] = wxT( " " );
1022 
1023  // Build a reference with no annotation,
1024  // i.e. a reference ended by only one '?'
1025  wxString defRef = m_prefix;
1026 
1027  if( !IsReferenceStringValid( defRef ) )
1028  { // This is a malformed reference: reinit this reference
1029  m_prefix = defRef = wxT("U"); // Set to default ref prefix
1030  }
1031 
1032  while( defRef.Last() == '?' )
1033  defRef.RemoveLast();
1034 
1035  defRef.Append( wxT( "?" ) );
1036 
1037  wxString path;
1038 
1039  if( aSheetPath )
1040  path = GetPath( aSheetPath );
1041 
1042  for( wxString& entry : m_PathsAndReferences )
1043  {
1044  // Break hierarchical reference in path, ref and multi selection:
1045  reference_fields = wxStringTokenize( entry, separators );
1046 
1047  // For all components: if aSheetPath is not NULL,
1048  // remove annotation only for the given path
1049  if( aSheetPath == NULL || reference_fields[0].Cmp( path ) == 0 )
1050  {
1051  wxString newHref = reference_fields[0];
1052  newHref << wxT( " " ) << defRef << wxT( " " ) << reference_fields[2];
1053  entry = newHref;
1054  }
1055  }
1056 
1057  // These 2 changes do not work in complex hierarchy.
1058  // When a clear annotation is made, the calling function must call a
1059  // UpdateAllScreenReferences for the active sheet.
1060  // But this call cannot made here.
1061  m_Fields[REFERENCE].SetText( defRef ); //for drawing.
1062 
1063  SetModified();
1064 }
void SetModified()
Definition: base_struct.cpp:98
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxString GetPath(const SCH_SHEET_PATH *sheet) const
Field Reference of part, i.e. "IC21".
static bool IsReferenceStringValid(const wxString &aReferenceString)
Tests for an acceptable reference string.
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is.
Definition: sch_component.h:89

References GetPath(), IsReferenceStringValid(), m_Fields, m_PathsAndReferences, m_prefix, REFERENCE, and EDA_ITEM::SetModified().

Referenced by SCH_SCREEN::ClearAnnotation(), SCH_EDIT_TOOL::Duplicate(), and SCH_EDITOR_CONTROL::Paste().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 245 of file base_struct.h.

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

References BRIGHTENED, and EDA_ITEM::ClearFlags().

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

◆ ClearBrightenedPins()

void SCH_COMPONENT::ClearBrightenedPins ( )

Definition at line 1878 of file sch_component.cpp.

1879 {
1880  for( SCH_PIN& pin : m_pins )
1881  pin.ClearBrightened();
1882 }
SCH_PINS m_pins
the component's pins
Definition: sch_component.h:99

References m_pins.

Referenced by SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearConnections()

void SCH_ITEM::ClearConnections ( )
inlineinherited

Function ClearConnections clears all of the connection items from the list.

The vector release method is used to prevent the item pointers from being deleted. Do not use the vector erase method on the connection list.

Definition at line 317 of file sch_item.h.

317 { m_connections.clear(); }
EDA_ITEMS m_connections
List of items connected to this item.
Definition: sch_item.h:120

References SCH_ITEM::m_connections.

◆ ClearEditFlags()

◆ ClearFieldsAutoplaced()

void SCH_COMPONENT::ClearFieldsAutoplaced ( )
inline

Set fields automatically placed flag false.

Definition at line 423 of file sch_component.h.

AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement

References AUTOPLACED_NO, and m_fieldsAutoplaced.

Referenced by SCH_EDIT_TOOL::Mirror(), SCH_MOVE_TOOL::moveItem(), and SCH_EDIT_TOOL::Rotate().

◆ ClearFlags()

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

Definition at line 266 of file base_struct.h.

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

References EDA_ITEM::m_Flags.

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

◆ ClearHighlighted()

void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 244 of file base_struct.h.

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

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearHighlightedPins()

void SCH_COMPONENT::ClearHighlightedPins ( )

Definition at line 1892 of file sch_component.cpp.

1893 {
1894  for( SCH_PIN& pin : m_pins )
1895  pin.ClearHighlighted();
1896 }
SCH_PINS m_pins
the component's pins
Definition: sch_component.h:99

References m_pins.

Referenced by ClearAllHighlightFlags().

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 278 of file base_struct.h.

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

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 153 of file view_item.h.

154  {
155  m_viewPrivData = NULL;
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * SCH_COMPONENT::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 225 of file sch_component.cpp.

226 {
227  return new SCH_COMPONENT( *this );
228 }
SCH_COMPONENT(const wxPoint &pos=wxPoint(0, 0), SCH_ITEM *aParent=NULL)

References SCH_COMPONENT().

Referenced by SCH_DRAWING_TOOLS::PlaceComponent().

◆ ConnectedItems()

std::unordered_set< SCH_ITEM * > & SCH_ITEM::ConnectedItems ( )
inherited

Retrieves the set of items connected to this item (schematic only)

Definition at line 137 of file sch_item.cpp.

138 {
139  return m_connected_items;
140 }
std::unordered_set< SCH_ITEM * > m_connected_items
Stores pointers to other items that are connected to this one (schematic only)
Definition: sch_item.h:125

References SCH_ITEM::m_connected_items.

Referenced by SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), and CONNECTION_GRAPH::buildConnectionGraph().

◆ Connection()

◆ ConnectionPropagatesTo()

virtual bool SCH_ITEM::ConnectionPropagatesTo ( const EDA_ITEM aItem) const
inlinevirtualinherited

Returns true if this item should propagate connection info to aItem.

Reimplemented in SCH_BUS_WIRE_ENTRY.

Definition at line 353 of file sch_item.h.

353 { return true; }

◆ doIsConnected()

bool SCH_COMPONENT::doIsConnected ( const wxPoint &  aPosition) const
overrideprivatevirtual

Function doIsConnected provides the object specific test to see if it is connected to aPosition.

Note
Override this function if the derived object can be connect to another object such as a wire, bus, or junction. Do not override this function for objects that cannot have connections. The default will always return false. This functions is call through the public function IsConnected() which performs tests common to all schematic items before calling the item specific connection testing.
Parameters
aPositionA reference to a wxPoint object containing the test position.
Returns
True if connection to aPosition exists.

Reimplemented from SCH_ITEM.

Definition at line 1827 of file sch_component.cpp.

1828 {
1829  wxPoint new_pos = m_transform.InverseTransform().TransformCoordinate( aPosition - m_Pos );
1830 
1831  for( const SCH_PIN& pin : m_pins )
1832  {
1833  if( pin.GetPosition() == new_pos )
1834  return true;
1835  }
1836 
1837  return false;
1838 }
SCH_PINS m_pins
the component's pins
Definition: sch_component.h:99
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
TRANSFORM InverseTransform() const
Calculate the Inverse mirror/rotation transform.
Definition: transform.cpp:58
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93

References TRANSFORM::InverseTransform(), m_pins, m_Pos, m_transform, and TRANSFORM::TransformCoordinate().

◆ Duplicate()

SCH_ITEM * SCH_ITEM::Duplicate ( bool  doClone = false)
inherited

Routine to create a new copy of given item.

The new object is not put in draw list (not linked).

Parameters
doClone(default = false) indicates unique values (such as timestamp and sheet name) should be duplicated. Use only for undo/redo operations.

Definition at line 75 of file sch_item.cpp.

76 {
77  SCH_ITEM* newItem = (SCH_ITEM*) Clone();
78 
79  if( doClone )
80  newItem->SetTimeStamp( GetTimeStamp() );
81 
82  newItem->ClearFlags( SELECTED | HIGHLIGHTED | BRIGHTENED );
83 
84  if( newItem->Type() == SCH_COMPONENT_T )
85  {
86  SCH_COMPONENT* component = (SCH_COMPONENT*) newItem;
87 
88  for( SCH_PIN& pin : component->GetPins() )
90 
91  std::vector<SCH_FIELD*> fields;
92  component->GetFields( fields, false );
93 
94  for( SCH_FIELD* field : fields )
95  field->ClearFlags( SELECTED | HIGHLIGHTED | BRIGHTENED );
96  }
97 
98  if( newItem->Type() == SCH_SHEET_T )
99  {
100  SCH_SHEET* sheet = (SCH_SHEET*) newItem;
101 
102  for( SCH_SHEET_PIN& pin : sheet->GetPins() )
104  }
105 
106  return newItem;
107 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:335
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populates a std::vector with SCH_FIELDs.
#define SELECTED
Definition: base_struct.h:127
timestamp_t GetTimeStamp() const
Definition: base_struct.h:216
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:75
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
void GetPins(std::vector< LIB_PIN * > &aPinsList)
Populate a vector with all the pins from the library object.
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:73
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:266
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Definition: sch_item.h:114
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:215

References BRIGHTENED, EDA_ITEM::ClearFlags(), EDA_ITEM::Clone(), GetFields(), SCH_SHEET::GetPins(), GetPins(), EDA_ITEM::GetTimeStamp(), HIGHLIGHTED, SCH_COMPONENT_T, SCH_SHEET_T, SELECTED, EDA_ITEM::SetTimeStamp(), and EDA_ITEM::Type().

Referenced by SCH_EDIT_TOOL::Duplicate(), SCH_DRAWING_TOOLS::PlaceComponent(), and SCH_EDIT_FRAME::SaveCopyInUndoList().

◆ FindField()

SCH_FIELD * SCH_COMPONENT::FindField ( const wxString &  aFieldName,
bool  aIncludeDefaultFields = true 
)

Search for a SCH_FIELD with aFieldName.

Parameters
aFieldNameis the name of the field to find.
aIncludeDefaultFieldssearches the library symbol default fields if true.
Returns
the field if found or NULL if the field was not found.

Definition at line 883 of file sch_component.cpp.

884 {
885  unsigned start = aIncludeDefaultFields ? 0 : MANDATORY_FIELDS;
886 
887  for( unsigned i = start; i < m_Fields.size(); ++i )
888  {
889  if( aFieldName == m_Fields[i].GetName( false ) )
890  return &m_Fields[i];
891  }
892 
893  return NULL;
894 }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
size_t i
Definition: json11.cpp:649

References i, m_Fields, and MANDATORY_FIELDS.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), NETLIST_EXPORTER_PSPICE::GetSpiceField(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), and UpdateFields().

◆ GetBodyBoundingBox()

EDA_RECT SCH_COMPONENT::GetBodyBoundingBox ( ) const

Return a bounding box for the symbol body but not the fields.

Definition at line 1291 of file sch_component.cpp.

1292 {
1293  EDA_RECT bBox;
1294 
1295  if( m_part )
1296  {
1297  bBox = m_part->GetBodyBoundingBox( m_unit, m_convert );
1298  }
1299  else
1300  {
1301  bBox = dummy()->GetBodyBoundingBox( m_unit, m_convert );
1302  }
1303 
1304  int x0 = bBox.GetX();
1305  int xm = bBox.GetRight();
1306 
1307  // We must reverse Y values, because matrix orientation
1308  // suppose Y axis normal for the library items coordinates,
1309  // m_transform reverse Y values, but bBox is already reversed!
1310  int y0 = -bBox.GetY();
1311  int ym = -bBox.GetBottom();
1312 
1313  // Compute the real Boundary box (rotated, mirrored ...)
1314  int x1 = m_transform.x1 * x0 + m_transform.y1 * y0;
1315  int y1 = m_transform.x2 * x0 + m_transform.y2 * y0;
1316  int x2 = m_transform.x1 * xm + m_transform.y1 * ym;
1317  int y2 = m_transform.x2 * xm + m_transform.y2 * ym;
1318 
1319  // H and W must be > 0:
1320  if( x2 < x1 )
1321  std::swap( x2, x1 );
1322 
1323  if( y2 < y1 )
1324  std::swap( y2, y1 );
1325 
1326  bBox.SetX( x1 );
1327  bBox.SetY( y1 );
1328  bBox.SetWidth( x2 - x1 );
1329  bBox.SetHeight( y2 - y1 );
1330 
1331  bBox.Offset( m_Pos );
1332  return bBox;
1333 }
void Offset(int dx, int dy)
Definition: eda_rect.h:157
int y2
Definition: transform.h:51
int GetX() const
Definition: eda_rect.h:111
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
int x2
Definition: transform.h:50
int x1
Definition: transform.h:48
int GetBottom() const
Definition: eda_rect.h:124
int y1
Definition: transform.h:49
void SetHeight(int val)
Definition: eda_rect.h:186
int GetRight() const
Definition: eda_rect.h:121
void SetX(int val)
Definition: eda_rect.h:168
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
void SetWidth(int val)
Definition: eda_rect.h:180
void SetY(int val)
Definition: eda_rect.h:174
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetY() const
Definition: eda_rect.h:112
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:86
const EDA_RECT GetBodyBoundingBox(int aUnit, int aConvert) const
Get the symbol bounding box excluding fields.
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93

References dummy(), LIB_PART::GetBodyBoundingBox(), EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), m_convert, m_part, m_Pos, m_transform, m_unit, EDA_RECT::Offset(), EDA_RECT::SetHeight(), EDA_RECT::SetWidth(), EDA_RECT::SetX(), EDA_RECT::SetY(), TRANSFORM::x1, TRANSFORM::x2, TRANSFORM::y1, and TRANSFORM::y2.

Referenced by AUTOPLACER::AUTOPLACER(), GetBoundingBox(), HitTest(), and operator<().

◆ GetBoundingBox()

const EDA_RECT SCH_COMPONENT::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 1336 of file sch_component.cpp.

1337 {
1338  EDA_RECT bbox = GetBodyBoundingBox();
1339 
1340  for( size_t i = 0; i < m_Fields.size(); i++ )
1341  bbox.Merge( m_Fields[i].GetBoundingBox() );
1342 
1343  return bbox;
1344 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
size_t i
Definition: json11.cpp:649
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

References GetBodyBoundingBox(), i, m_Fields, and EDA_RECT::Merge().

◆ GetClass()

wxString SCH_COMPONENT::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Reimplemented from SCH_ITEM.

Definition at line 157 of file sch_component.h.

158  {
159  return wxT( "SCH_COMPONENT" );
160  }

Referenced by operator=().

◆ GetConnectionForPin()

SCH_CONNECTION * SCH_COMPONENT::GetConnectionForPin ( LIB_PIN aPin,
const SCH_SHEET_PATH aSheet 
)

Retrieves the connection for a given pin of the component.

Definition at line 493 of file sch_component.cpp.

494 {
495  if( m_pinMap.count( aPin ) )
496  return m_pins[ m_pinMap.at( aPin ) ].Connection( aSheet );
497 
498  return nullptr;
499 }
SCH_PINS m_pins
the component's pins
Definition: sch_component.h:99
SCH_PIN_MAP m_pinMap
the component's pins mapped by LIB_PIN*.

References m_pinMap, and m_pins.

Referenced by LIB_PIN::GetMsgPanelInfo(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ GetConnectionPoints()

void SCH_COMPONENT::GetConnectionPoints ( std::vector< wxPoint > &  aPoints) const
overridevirtual

Function GetConnectionPoints add all the connection points for this item to aPoints.

Not all schematic items have connection points so the default method does nothing.

Parameters
aPointsList of connection points to add to.

Reimplemented from SCH_ITEM.

Definition at line 1577 of file sch_component.cpp.

1578 {
1579  for( const SCH_PIN& pin : m_pins )
1580  aPoints.push_back( m_transform.TransformCoordinate( pin.GetPosition() ) + m_Pos );
1581 }
SCH_PINS m_pins
the component's pins
Definition: sch_component.h:99
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93

References m_pins, m_Pos, m_transform, and TRANSFORM::TransformCoordinate().

◆ GetConvert()

◆ GetDatasheet()

wxString SCH_COMPONENT::GetDatasheet ( ) const

Return the documentation text for the given part alias.

Definition at line 304 of file sch_component.cpp.

305 {
306  if( m_part )
307  {
308  return m_part->GetDocFileName();
309  }
310 
311  return wxEmptyString;
312 }
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97

References m_part.

Referenced by UpdateFields().

◆ GetDescription()

wxString SCH_COMPONENT::GetDescription ( ) const

Return information about the aliased parts.

Definition at line 293 of file sch_component.cpp.

294 {
295  if( m_part )
296  {
297  return m_part->GetDescription();
298  }
299 
300  return wxEmptyString;
301 }
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97

References m_part.

Referenced by NETLIST_EXPORTER_GENERIC::makeComponents().

◆ GetDrawItem()

LIB_ITEM * SCH_COMPONENT::GetDrawItem ( const wxPoint &  aPosition,
KICAD_T  aType = TYPE_NOT_INIT 
)

Return the component library item at aPosition that is part of this component.

Parameters
aPositionis the schematic position of the component library object.
aTypeis the type of symbol library object to find or any if set to TYPE_NOT_INIT.
Returns
is the symbol library object if found otherwise NULL.

Definition at line 1584 of file sch_component.cpp.

1585 {
1586  UpdatePins();
1587 
1588  if( m_part )
1589  {
1590  // Calculate the position relative to the component.
1591  wxPoint libPosition = aPosition - m_Pos;
1592 
1593  return m_part->LocateDrawItem( m_unit, m_convert, aType, libPosition, m_transform );
1594  }
1595 
1596  return NULL;
1597 }
static void UpdatePins(const EE_COLLECTOR &aComponents)
Update the pin cache for all components in aComponents.
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:86
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93

References m_convert, m_part, m_Pos, m_transform, m_unit, and UpdatePins().

Referenced by SCH_SCREEN::GetPin().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 270 of file base_struct.h.

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

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

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

◆ GetEndPoints()

void SCH_COMPONENT::GetEndPoints ( std::vector< DANGLING_END_ITEM > &  aItemList)
overridevirtual

Function GetEndPoints adds the schematic item end points to aItemList if the item has end points.

The default version doesn't do anything since many of the schematic object cannot be tested for dangling ends. If you add a new schematic item that can have a dangling end ( no connect ), override this method to provide the correct end points.

Parameters
aItemList- List of DANGLING_END_ITEMS to add to.

Reimplemented from SCH_ITEM.

Definition at line 1497 of file sch_component.cpp.

1498 {
1499  if( m_part )
1500  {
1501  for( LIB_PIN* pin = m_part->GetNextPin(); pin; pin = m_part->GetNextPin( pin ) )
1502  {
1503  wxASSERT( pin->Type() == LIB_PIN_T );
1504 
1505  if( pin->GetUnit() && m_unit && ( m_unit != pin->GetUnit() ) )
1506  continue;
1507 
1508  if( pin->GetConvert() && m_convert && ( m_convert != pin->GetConvert() ) )
1509  continue;
1510 
1511  DANGLING_END_ITEM item( PIN_END, pin, GetPinPhysicalPosition( pin ), this );
1512  aItemList.push_back( item );
1513  }
1514  }
1515 }
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:86
Class DANGLING_END_ITEM is a helper class used to store the state of schematic items that can be conn...
Definition: sch_item.h:67
wxPoint GetPinPhysicalPosition(const LIB_PIN *Pin) const

References GetPinPhysicalPosition(), LIB_PIN_T, m_convert, m_part, m_unit, and PIN_END.

◆ GetField()

SCH_FIELD * SCH_COMPONENT::GetField ( int  aFieldNdx) const

Returns a field in this symbol.

Parameters
aFieldNdxis the index into the array of fields, not a field id.
Returns
is the field at aFieldNdx or NULL if the field does not exist.

Definition at line 824 of file sch_component.cpp.

825 {
826  const SCH_FIELD* field;
827 
828  if( (unsigned) aFieldNdx < m_Fields.size() )
829  field = &m_Fields[aFieldNdx];
830  else
831  field = NULL;
832 
833  wxASSERT( field );
834 
835  return const_cast<SCH_FIELD*>( field );
836 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94

References m_Fields.

Referenced by NETLIST_EXPORTER_GENERIC::addComponentFields(), SCH_EAGLE_PLUGIN::addImplicitConnections(), SIM_PLOT_FRAME::AddTuner(), SCH_EDIT_FRAME::AnnotateComponents(), SCH_EDITOR_CONTROL::BackAnnotateFootprints(), SCH_SHEET::ComponentCount(), SCH_EDIT_TOOL::EditField(), FormatProbeItem(), SCH_SCREEN::GetItem(), LIB_PIN::GetMsgPanelInfo(), GetMsgPanelInfo(), GetRef(), GetSelectMenuText(), NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal(), DIALOG_EDIT_COMPONENTS_LIBID::initDlg(), DIALOG_FIELDS_EDITOR_GLOBAL::LoadFieldNames(), SCH_EAGLE_PLUGIN::loadSchematic(), mapExistingAnnotation(), MirrorX(), MirrorY(), Move(), TUNER_SLIDER::onSave(), operator==(), Print(), SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile(), Rotate(), SCH_LEGACY_PLUGIN::saveComponent(), SCH_COMPONENT(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SCREEN::SetComponentFootprint(), SetRef(), EE_INSPECTION_TOOL::ShowDatasheet(), SCH_REFERENCE_LIST::sortByReferenceOnly(), SwapData(), TestMultiunitFootprints(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow(), TUNER_SLIDER::TUNER_SLIDER(), SCH_SHEET_PATH::UpdateAllScreenReferences(), UpdateFields(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary(), Visit(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_CADSTAR::WriteNetlist().

◆ GetFieldCount()

◆ GetFields()

void SCH_COMPONENT::GetFields ( std::vector< SCH_FIELD * > &  aVector,
bool  aVisibleOnly 
)

Populates a std::vector with SCH_FIELDs.

Parameters
aVectoris the vector to populate.
aVisibleOnlyis used to add only the fields that are visible and contain text.

Definition at line 851 of file sch_component.cpp.

852 {
853  for( SCH_FIELD& field : m_Fields )
854  {
855  if( !aVisibleOnly || ( field.IsVisible() && !field.IsVoid() ) )
856  aVector.push_back( &field );
857  }
858 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94

References m_Fields.

Referenced by AUTOPLACER::AUTOPLACER(), KIGFX::SCH_PAINTER::draw(), SCH_ITEM::Duplicate(), and DIALOG_UPDATE_FIELDS::updateFields().

◆ GetFieldsAutoplaced()

AUTOPLACED SCH_COMPONENT::GetFieldsAutoplaced ( ) const
inline

Return whether the fields have been automatically placed.

Definition at line 418 of file sch_component.h.

418 { return m_fieldsAutoplaced; }
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement

References m_fieldsAutoplaced.

Referenced by AutoAutoplaceFields().

◆ GetFieldText()

wxString SCH_COMPONENT::GetFieldText ( const wxString &  aFieldName,
SCH_EDIT_FRAME aFrame 
) const

Search for a field named aFieldName and returns text associated with this field.

Parameters
aFieldNameis the name of the field

Definition at line 839 of file sch_component.cpp.

840 {
841  for( const SCH_FIELD& field : m_Fields )
842  {
843  if( aFieldName == field.GetName() )
844  return field.GetText();
845  }
846 
847  return wxEmptyString;
848 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94

References m_Fields.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn().

◆ GetFlags()

◆ GetLayer()

◆ GetLibId()

◆ GetList()

DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

221 { return m_List; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:178

References EDA_ITEM::m_List.

Referenced by DHEAD::insert(), DHEAD::remove(), and GERBER_DRAW_ITEM::UnLink().

◆ GetMenuImage()

BITMAP_DEF SCH_COMPONENT::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 1427 of file sch_component.cpp.

1428 {
1429  return add_component_xpm;
1430 }

◆ GetMsgPanelInfo()

void SCH_COMPONENT::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 1347 of file sch_component.cpp.

1348 {
1349  wxString msg;
1350 
1351  // part and alias can differ if alias is not the root
1352  if( m_part )
1353  {
1354  if( m_part.get() != dummy() )
1355  {
1356  if( g_CurrentSheet )
1357  aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( g_CurrentSheet ),
1358  DARKCYAN ) );
1359 
1360  msg = m_part->IsPower() ? _( "Power symbol" ) : _( "Value" );
1361 
1362  aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->GetShownText(), DARKCYAN ) );
1363 
1364  // Display component reference in library and library
1365  aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetLibId().GetLibItemName(), BROWN ) );
1366 
1367  if( !m_part->IsRoot() )
1368  {
1369  msg = _( "Missing parent" );
1370 
1371  std::shared_ptr< LIB_PART > parent = m_part->GetParent().lock();
1372 
1373  if( parent )
1374  msg = parent->GetName();
1375 
1376  aList.push_back( MSG_PANEL_ITEM( _( "Alias of" ), msg, BROWN ) );
1377  }
1378 
1379  if( m_part->GetLib() && m_part->GetLib()->IsCache() )
1380  aList.push_back( MSG_PANEL_ITEM( _( "Library" ),
1381  m_part->GetLib()->GetLogicalName(), RED ) );
1382  else if( !m_lib_id.GetLibNickname().empty() )
1383  aList.push_back( MSG_PANEL_ITEM( _( "Library" ), m_lib_id.GetLibNickname(),
1384  BROWN ) );
1385  else
1386  aList.push_back( MSG_PANEL_ITEM( _( "Library" ), _( "Undefined!!!" ), RED ) );
1387 
1388  // Display the current associated footprint, if exists.
1389  if( !GetField( FOOTPRINT )->IsVoid() )
1390  msg = GetField( FOOTPRINT )->GetShownText();
1391  else
1392  msg = _( "<Unknown>" );
1393 
1394  aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), msg, DARKRED ) );
1395 
1396  // Display description of the component, and keywords found in lib
1397  aList.push_back( MSG_PANEL_ITEM( _( "Description" ), m_part->GetDescription(),
1398  DARKCYAN ) );
1399  aList.push_back( MSG_PANEL_ITEM( _( "Key words" ), m_part->GetKeyWords(), DARKCYAN ) );
1400  }
1401  }
1402  else
1403  {
1404  if( g_CurrentSheet )
1405  aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( g_CurrentSheet ),
1406  DARKCYAN ) );
1407 
1408  aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetField( VALUE )->GetShownText(),
1409  DARKCYAN ) );
1410  aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetLibId().GetLibItemName(), BROWN ) );
1411 
1412  wxString libNickname = GetLibId().GetLibNickname();
1413 
1414  if( libNickname.empty() )
1415  {
1416  aList.push_back( MSG_PANEL_ITEM( _( "Library" ), _( "No library defined!" ), RED ) );
1417  }
1418  else
1419  {
1420  msg.Printf( _( "Symbol not found in %s!" ), libNickname );
1421  aList.push_back( MSG_PANEL_ITEM( _( "Library" ), msg , RED ) );
1422  }
1423  }
1424 }
Field Name Module PCB, i.e. "16DIP300".
Definition: colors.h:54
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
#define VALUE
SCH_SHEET_PATH * g_CurrentSheet
With the new connectivity algorithm, many more places than before want to know what the current sheet...
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
Definition: colors.h:60
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
const wxString GetRef(const SCH_SHEET_PATH *aSheet)
Return the reference for the given sheet path.
#define _(s)
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:129
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
const LIB_ID & GetLibId() const
bool empty() const
Definition: utf8.h:108
Definition: colors.h:62

References _, BROWN, DARKCYAN, DARKRED, dummy(), UTF8::empty(), FOOTPRINT, g_CurrentSheet, GetField(), GetLibId(), LIB_ID::GetLibNickname(), GetRef(), EDA_TEXT::GetShownText(), m_lib_id, m_part, RED, and VALUE.

◆ GetNetListItem()

void SCH_COMPONENT::GetNetListItem ( NETLIST_OBJECT_LIST aNetListItems,
SCH_SHEET_PATH aSheetPath 
)
overridevirtual

Function GetNetListItem creates a new NETLIST_OBJECT for the schematic object and adds it to aNetListItems.

Not all schematic objects have net list items associated with them. This method only needs to be overridden for those schematic objects that have net list objects associated with them.

Reimplemented from SCH_ITEM.

Definition at line 1670 of file sch_component.cpp.

1672 {
1673  if( m_part )
1674  {
1675  for( LIB_PIN* pin = m_part->GetNextPin(); pin; pin = m_part->GetNextPin( pin ) )
1676  {
1677  wxASSERT( pin->Type() == LIB_PIN_T );
1678 
1679  if( pin->GetUnit() && ( pin->GetUnit() != GetUnitSelection( aSheetPath ) ) )
1680  continue;
1681 
1682  if( pin->GetConvert() && ( pin->GetConvert() != GetConvert() ) )
1683  continue;
1684 
1685  wxPoint pos = GetTransform().TransformCoordinate( pin->GetPosition() ) + m_Pos;
1686 
1687  NETLIST_OBJECT* item = new NETLIST_OBJECT();
1688  item->m_SheetPathInclude = *aSheetPath;
1689  item->m_Comp = (SCH_ITEM*) pin;
1690  item->m_SheetPath = *aSheetPath;
1691  item->m_Type = NET_PIN;
1692  item->m_Link = (SCH_ITEM*) this;
1693  item->m_ElectricalPinType = pin->GetType();
1694  item->m_PinNum = pin->GetNumber();
1695  item->m_Label = pin->GetName();
1696  item->m_Start = item->m_End = pos;
1697 
1698  aNetListItems.push_back( item );
1699 
1700  if( pin->IsPowerConnection() )
1701  {
1702  // There is an associated PIN_LABEL.
1703  item = new NETLIST_OBJECT();
1704  item->m_SheetPathInclude = *aSheetPath;
1705  item->m_Comp = NULL;
1706  item->m_SheetPath = *aSheetPath;
1707  item->m_Type = NET_PINLABEL;
1708  item->m_Label = pin->GetName();
1709  item->m_Start = pos;
1710  item->m_End = item->m_Start;
1711 
1712  aNetListItems.push_back( item );
1713  }
1714  }
1715  }
1716 }
SCH_SHEET_PATH m_SheetPathInclude
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
int GetUnitSelection(SCH_SHEET_PATH *aSheet)
SCH_SHEET_PATH m_SheetPath
ELECTRICAL_PINTYPE m_ElectricalPinType
NETLIST_ITEM_T m_Type
EDA_ITEM * m_Comp
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
TRANSFORM & GetTransform() const
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
int GetConvert() const
SCH_ITEM * m_Link
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Definition: sch_item.h:114

References GetConvert(), GetTransform(), GetUnitSelection(), LIB_PIN_T, NETLIST_OBJECT::m_Comp, NETLIST_OBJECT::m_ElectricalPinType, NETLIST_OBJECT::m_End, NETLIST_OBJECT::m_Label, NETLIST_OBJECT::m_Link, m_part, NETLIST_OBJECT::m_PinNum, m_Pos, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_SheetPathInclude, NETLIST_OBJECT::m_Start, NETLIST_OBJECT::m_Type, NET_PIN, NET_PINLABEL, and TRANSFORM::TransformCoordinate().

◆ GetOrientation()

int SCH_COMPONENT::GetOrientation ( )

Get the display symbol orientation.

Because there are different ways to have a given orientation/mirror, the orientation/mirror is not necessary what the user does. For example: a mirrorX then a mirrorY returns no mirror but a rotate. This function finds a rotation and a mirror value CMP_MIRROR_X because this is the first mirror option tested. This can differs from the orientation made by an user. A CMP_MIRROR_Y is returned as a CMP_MIRROR_X with an orientation 180 because they are equivalent.

See also
COMPONENT_ORIENTATION_T
Returns
the orientation and mirror of the symbol.

Definition at line 1222 of file sch_component.cpp.

1223 {
1224  int rotate_values[] =
1225  {
1226  CMP_ORIENT_0,
1227  CMP_ORIENT_90,
1233  CMP_MIRROR_Y,
1238  };
1239 
1240  // Try to find the current transform option:
1241  TRANSFORM transform = m_transform;
1242 
1243  for( int type_rotate : rotate_values )
1244  {
1245  SetOrientation( type_rotate );
1246 
1247  if( transform == m_transform )
1248  return type_rotate;
1249  }
1250 
1251  // Error: orientation not found in list (should not happen)
1252  wxMessageBox( wxT( "Component orientation matrix internal error" ) );
1253  m_transform = transform;
1254 
1255  return CMP_NORMAL;
1256 }
Class for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...

References CMP_MIRROR_X, CMP_MIRROR_Y, CMP_NORMAL, CMP_ORIENT_0, CMP_ORIENT_180, CMP_ORIENT_270, CMP_ORIENT_90, m_transform, and SetOrientation().

Referenced by KIGFX::SCH_PAINTER::draw(), AUTOPLACER::get_preferred_sides(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow().

◆ GetParent()

◆ GetPartRef()

◆ GetPath()

wxString SCH_COMPONENT::GetPath ( const SCH_SHEET_PATH sheet) const

Definition at line 602 of file sch_component.cpp.

603 {
604  wxCHECK_MSG( sheet != NULL, wxEmptyString,
605  wxT( "Cannot get component path with invalid sheet object." ) );
606 
607  wxString str;
608 
609  str.Printf( wxT( "%8.8lX" ), (long unsigned) m_TimeStamp );
610  return sheet->Path() + str;
611 }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:181
const string & str
Definition: json11.cpp:648
wxString Path() const
Function Path the path uses the time stamps which do not changes even when editing sheet parameters a...

References EDA_ITEM::m_TimeStamp, SCH_SHEET_PATH::Path(), and str.

Referenced by ClearAnnotation(), GetRef(), GetUnitSelection(), IsAnnotated(), SetRef(), SetUnitSelection(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().

◆ GetPathsAndReferences()

const wxArrayString& SCH_COMPONENT::GetPathsAndReferences ( ) const
inline

Definition at line 162 of file sch_component.h.

162 { return m_PathsAndReferences; }
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.

References m_PathsAndReferences.

Referenced by SCH_LEGACY_PLUGIN::saveComponent().

◆ GetPenSize()

virtual int SCH_ITEM::GetPenSize ( ) const
inlinevirtualinherited

Function GetPenSize virtual pure.

Returns
the size of the "pen" that be used to draw or plot this item

Reimplemented in SCH_SHEET, SCH_BUS_BUS_ENTRY, SCH_TEXT, SCH_FIELD, SCH_BUS_WIRE_ENTRY, SCH_LINE, SCH_SHEET_PIN, and SCH_NO_CONNECT.

Definition at line 212 of file sch_item.h.

212 { return 0; }

Referenced by SCH_JUNCTION::GetBoundingBox(), SCH_BUS_ENTRY_BASE::GetBoundingBox(), KIGFX::SCH_PAINTER::getLineWidth(), SCH_BUS_ENTRY_BASE::HitTest(), SCH_BUS_ENTRY_BASE::Plot(), SCH_BITMAP::Plot(), and SCH_BUS_ENTRY_BASE::Print().

◆ GetPin()

LIB_PIN * SCH_COMPONENT::GetPin ( const wxString &  number)

Find a symbol pin by number.

Parameters
numberis the number of the pin to find.
Returns
Pin object if found, otherwise NULL.

Definition at line 964 of file sch_component.cpp.

965 {
966  if( m_part )
967  {
968  return m_part->GetPin( number, m_unit, m_convert );
969  }
970 
971  return NULL;
972 }
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:86

References m_convert, m_part, and m_unit.

Referenced by SCH_EDITOR_CONTROL::FindComponentAndItem().

◆ GetPinPhysicalPosition()

wxPoint SCH_COMPONENT::GetPinPhysicalPosition ( const LIB_PIN Pin) const

Definition at line 1568 of file sch_component.cpp.

1569 {
1570  wxCHECK_MSG( Pin != NULL && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ),
1571  wxT( "Cannot get physical position of pin." ) );
1572 
1573  return m_transform.TransformCoordinate( Pin->GetPosition() ) + m_Pos;
1574 }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
wxPoint GetPosition() const override
Definition: lib_pin.h:427
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References LIB_PIN::GetPosition(), LIB_PIN_T, m_Pos, m_transform, TRANSFORM::TransformCoordinate(), and EDA_ITEM::Type().

Referenced by SCH_EAGLE_PLUGIN::addImplicitConnections(), SCH_EAGLE_PLUGIN::checkConnections(), GetEndPoints(), and SCH_SCREEN::GetPin().

◆ GetPins() [1/2]

void SCH_COMPONENT::GetPins ( std::vector< LIB_PIN * > &  aPinsList)

Populate a vector with all the pins from the library object.

Parameters
aPinsListis the list to populate with all of the pins.

Definition at line 975 of file sch_component.cpp.

976 {
977  if( m_part )
978  m_part->GetPins( aPinsList, m_unit, m_convert );
979 }
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:86

References m_convert, m_part, and m_unit.

Referenced by KIGFX::SCH_PAINTER::draw(), SCH_ITEM::Duplicate(), AUTOPLACER::pins_on_side(), CONNECTION_GRAPH::updateItemConnectivity(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ GetPins() [2/2]

SCH_PINS& SCH_COMPONENT::GetPins ( )
inline

Definition at line 470 of file sch_component.h.

470 { return m_pins; }
SCH_PINS m_pins
the component's pins
Definition: sch_component.h:99

References m_pins.

◆ GetPosition()

◆ GetPrefix()

wxString SCH_COMPONENT::GetPrefix ( ) const
inline

Definition at line 254 of file sch_component.h.

254 { return m_prefix; }
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is.
Definition: sch_component.h:89

References m_prefix.

Referenced by SCH_LEGACY_PLUGIN::saveComponent().

◆ GetRef()

const wxString SCH_COMPONENT::GetRef ( const SCH_SHEET_PATH aSheet)

Return the reference for the given sheet path.

Returns
the reference for the sheet.

Definition at line 614 of file sch_component.cpp.

615 {
616  wxString path = GetPath( sheet );
617  wxString h_path;
618  wxStringTokenizer tokenizer;
619  wxString separators( wxT( " " ) );
620 
621  for( const wxString& entry : m_PathsAndReferences )
622  {
623  tokenizer.SetString( entry, separators );
624  h_path = tokenizer.GetNextToken();
625 
626  if( h_path.Cmp( path ) == 0 )
627  return tokenizer.GetNextToken();
628  }
629 
630  // If it was not found in m_Paths array, then see if it is in m_Field[REFERENCE] -- if so,
631  // use this as a default for this path. This will happen if we load a version 1 schematic
632  // file. It will also mean that multiple instances of the same sheet by default all have
633  // the same component references, but perhaps this is best.
634  if( !GetField( REFERENCE )->GetText().IsEmpty() )
635  {
636  SetRef( sheet, GetField( REFERENCE )->GetText() );
637  return GetField( REFERENCE )->GetText();
638  }
639 
640  return m_prefix;
641 }
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxString GetPath(const SCH_SHEET_PATH *sheet) const
Field Reference of part, i.e. "IC21".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is.
Definition: sch_component.h:89
virtual const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:124

References GetField(), GetPath(), GetText(), EDA_TEXT::GetText(), m_PathsAndReferences, m_prefix, REFERENCE, and SetRef().

Referenced by NETLIST_EXPORTER_GENERIC::addComponentFields(), Diagnose(), CONNECTION_GRAPH::ercCheckNoConnects(), NETLIST_EXPORTER::findAllUnitsOfComponent(), SCH_EDITOR_CONTROL::FindComponentAndItem(), NETLIST_EXPORTER::findNextComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), SCH_SHEET_PATH::GetComponents(), SCH_PIN::GetDefaultNetName(), GetMsgPanelInfo(), SCH_SHEET_PATH::GetMultiUnitComponents(), NETLIST_OBJECT::GetShortNetName(), NETLIST_EXPORTER_GENERIC::makeComponents(), NETLIST_EXPORTER_GENERIC::makeListOfNets(), SCH_FIELD::Matches(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SCREEN::SetComponentFootprint(), TestMultiunitFootprints(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), SCH_SHEET_PATH::UpdateAllScreenReferences(), NETLIST_EXPORTER_CADSTAR::writeListOfNets(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_CADSTAR::WriteNetlist().

◆ GetSelectMenuText()

wxString SCH_COMPONENT::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 1600 of file sch_component.cpp.

1601 {
1602  return wxString::Format( _( "Symbol %s, %s" ),
1603  GetLibId().GetLibItemName().wx_str(),
1604  GetField( REFERENCE )->GetShownText() );
1605 }
Field Reference of part, i.e. "IC21".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
#define _(s)
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 LIB_ID & GetLibId() const

References _, Format(), GetField(), GetLibId(), and REFERENCE.

Referenced by Matches().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 249 of file base_struct.h.

250  {
251  return m_Status & type;
252  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

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

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 262 of file base_struct.h.

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

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetStoredPos()

wxPoint& SCH_ITEM::GetStoredPos ( )
inlineinherited

Definition at line 174 of file sch_item.h.

174 { return m_storedPos; }
wxPoint m_storedPos
a temporary variable used in some move commands to store a initial pos (of the item or mouse cursor)
Definition: sch_item.h:121

References SCH_ITEM::m_storedPos.

Referenced by SCH_MOVE_TOOL::moveItem().

◆ GetTimeStamp()

◆ GetTransform()

◆ GetUnit()

◆ GetUnitCount()

int SCH_COMPONENT::GetUnitCount ( void  ) const

Return the number of units per package of the symbol.

Returns
the number of units per package or zero if the library entry cannot be found.

Definition at line 538 of file sch_component.cpp.

539 {
540  if( m_part )
541  return m_part->GetUnitCount();
542 
543  return 0;
544 }
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97

References m_part.

Referenced by NETLIST_EXPORTER_GENERIC::addComponentFields(), SCH_EDIT_FRAME::AnnotateComponents(), SCH_FIELD::GetFullyQualifiedText(), SCH_FIELD::Matches(), SCH_DRAWING_TOOLS::PlaceComponent(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow().

◆ GetUnitSelection()

int SCH_COMPONENT::GetUnitSelection ( SCH_SHEET_PATH aSheet)

Definition at line 761 of file sch_component.cpp.

762 {
763  wxString path = GetPath( aSheet );
764  wxString h_path, h_multi;
765  wxStringTokenizer tokenizer;
766  wxString separators( wxT( " " ) );
767 
768  for( const wxString& entry : m_PathsAndReferences )
769  {
770  tokenizer.SetString( entry, separators );
771  h_path = tokenizer.GetNextToken();
772 
773  if( h_path.Cmp( path ) == 0 )
774  {
775  tokenizer.GetNextToken(); // Skip reference
776  h_multi = tokenizer.GetNextToken();
777  long imulti = 1;
778  h_multi.ToLong( &imulti );
779  return imulti;
780  }
781  }
782 
783  // If it was not found in m_Paths array, then use m_unit. This will happen if we load a
784  // version 1 schematic file.
785  return m_unit;
786 }
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxString GetPath(const SCH_SHEET_PATH *sheet) const
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85

References GetPath(), m_PathsAndReferences, and m_unit.

Referenced by NETLIST_EXPORTER::findAllUnitsOfComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), GetNetListItem(), SCH_REFERENCE::SCH_REFERENCE(), and SCH_SHEET_PATH::UpdateAllScreenReferences().

◆ HasBrightenedPins()

bool SCH_COMPONENT::HasBrightenedPins ( )

Definition at line 1866 of file sch_component.cpp.

1867 {
1868  for( const SCH_PIN& pin : m_pins )
1869  {
1870  if( pin.IsBrightened() )
1871  return true;
1872  }
1873 
1874  return false;
1875 }
SCH_PINS m_pins
the component's pins
Definition: sch_component.h:99

References m_pins.

Referenced by SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ HasFlag()

bool EDA_ITEM::HasFlag ( STATUS_FLAGS  aFlag)
inlineinherited

◆ HasHighlightedPins()

bool SCH_COMPONENT::HasHighlightedPins ( )

Definition at line 1899 of file sch_component.cpp.

1900 {
1901  for( const SCH_PIN& pin : m_pins )
1902  {
1903  if( pin.IsHighlighted() )
1904  return true;
1905  }
1906 
1907  return false;
1908 }
SCH_PINS m_pins
the component's pins
Definition: sch_component.h:99

References m_pins.

Referenced by ClearAllHighlightFlags().

◆ HighlightPin()

void SCH_COMPONENT::HighlightPin ( LIB_PIN aPin)

Definition at line 1911 of file sch_component.cpp.

1912 {
1913  if( m_pinMap.count( aPin ) )
1914  m_pins[ m_pinMap.at( aPin ) ].SetHighlighted();
1915 }
SCH_PINS m_pins
the component's pins
Definition: sch_component.h:99
SCH_PIN_MAP m_pinMap
the component's pins mapped by LIB_PIN*.

References m_pinMap, and m_pins.

◆ HitTest() [1/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 1799 of file sch_component.cpp.

1800 {
1801  EDA_RECT bBox = GetBodyBoundingBox();
1802  bBox.Inflate( aAccuracy );
1803 
1804  if( bBox.Contains( aPosition ) )
1805  return true;
1806 
1807  return false;
1808 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

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

◆ HitTest() [2/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 1811 of file sch_component.cpp.

1812 {
1814  return false;
1815 
1816  EDA_RECT rect = aRect;
1817 
1818  rect.Inflate( aAccuracy );
1819 
1820  if( aContained )
1821  return rect.Contains( GetBodyBoundingBox() );
1822 
1823  return rect.Intersects( GetBodyBoundingBox() );
1824 }
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:131
bool Contains(const wxPoint &aPoint) const
Function Contains.
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:129
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:187
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

References EDA_RECT::Contains(), GetBodyBoundingBox(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), EDA_ITEM::m_Flags, SKIP_STRUCT, and STRUCT_DELETED.

◆ Init()

void SCH_COMPONENT::Init ( const wxPoint &  pos = wxPoint( 0, 0 ))
private

Definition at line 195 of file sch_component.cpp.

196 {
197  m_Pos = pos;
198  m_unit = 1; // In multi unit chip - which unit to draw.
199  m_convert = LIB_ITEM::LIB_CONVERT::BASE; // De Morgan Handling
200 
201  // The rotation/mirror transformation matrix. pos normal
203 
204  // construct only the mandatory fields, which are the first 4 only.
205  for( int i = 0; i < MANDATORY_FIELDS; ++i )
206  {
207  SCH_FIELD field( pos, i, this, TEMPLATE_FIELDNAME::GetDefaultFieldName( i ) );
208 
209  if( i == REFERENCE )
210  field.SetLayer( LAYER_REFERENCEPART );
211  else if( i == VALUE )
212  field.SetLayer( LAYER_VALUEPART );
213 
214  // else keep LAYER_FIELDS from SCH_FIELD constructor
215 
216  // SCH_FIELD's implicitly created copy constructor is called in here
217  AddField( field );
218  }
219 
220  m_prefix = wxString( wxT( "U" ) );
221  m_isInNetlist = true;
222 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
static const wxString GetDefaultFieldName(int aFieldNdx)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
Field Reference of part, i.e. "IC21".
#define VALUE
Class for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
bool m_isInNetlist
True if the component should appear in the netlist.
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
size_t i
Definition: json11.cpp:649
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:86
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is.
Definition: sch_component.h:89
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93

References AddField(), TEMPLATE_FIELDNAME::GetDefaultFieldName(), i, LAYER_REFERENCEPART, LAYER_VALUEPART, m_convert, m_isInNetlist, m_Pos, m_prefix, m_transform, m_unit, MANDATORY_FIELDS, REFERENCE, SCH_ITEM::SetLayer(), and VALUE.

Referenced by SCH_COMPONENT().

◆ InitializeConnection()

SCH_CONNECTION * SCH_ITEM::InitializeConnection ( const SCH_SHEET_PATH aPath)
inherited

Creates a new connection object associated with this object.

Parameters
aPathis the sheet path to initialize

Definition at line 149 of file sch_item.cpp.

150 {
151  if( Connection( aSheet ) )
152  {
153  Connection( aSheet )->Reset();
154  Connection( aSheet )->SetSheet( aSheet );
155  return Connection( aSheet );
156  }
157 
158  auto connection = new SCH_CONNECTION( this );
159  connection->SetSheet( aSheet );
160  m_connection_map.insert( std::make_pair( aSheet, connection ) );
161  return connection;
162 }
void SetSheet(SCH_SHEET_PATH aSheet)
void Reset()
Clears connectivity information.
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Stores connectivity information, per sheet.
Definition: sch_item.h:128
SCH_CONNECTION * Connection(const SCH_SHEET_PATH &aPath) const
Retrieves the connection associated with this object in the given sheet.
Definition: sch_item.cpp:128
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).

References SCH_ITEM::Connection(), SCH_ITEM::m_connection_map, SCH_CONNECTION::Reset(), and SCH_CONNECTION::SetSheet().

Referenced by CONNECTION_GRAPH::buildConnectionGraph().

◆ IsAnnotated()

bool SCH_COMPONENT::IsAnnotated ( const SCH_SHEET_PATH aSheet)

Checks if the component has a valid annotation (reference) for the given sheet path.

Parameters
aSheetis the sheet path to test
Returns
true if the component exists on that sheet and has a valid reference

Definition at line 725 of file sch_component.cpp.

726 {
727  wxString path = GetPath( aSheet );
728  wxString h_path;
729  wxStringTokenizer tokenizer;
730  wxString separators( wxT( " " ) );
731 
732  for( const wxString& entry : m_PathsAndReferences )
733  {
734  tokenizer.SetString( entry, separators );
735  h_path = tokenizer.GetNextToken();
736 
737  if( h_path.Cmp( path ) == 0 )
738  {
739  wxString ref = tokenizer.GetNextToken();
740  return ref.Last() != '?';
741  }
742  }
743 
744  return false;
745 }
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxString GetPath(const SCH_SHEET_PATH *sheet) const

References GetPath(), and m_PathsAndReferences.

◆ IsBrightened()

bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

◆ IsConnectable()

bool SCH_COMPONENT::IsConnectable ( ) const
inlineoverridevirtual

Function IsConnectable returns true if the schematic item can connect to another schematic item.

Reimplemented from SCH_ITEM.

Definition at line 575 of file sch_component.h.

575 { return true; }

◆ IsConnected()

bool SCH_ITEM::IsConnected ( const wxPoint &  aPoint) const
inherited

Function IsConnected tests the item to see if it is connected to aPoint.

Parameters
aPointA reference to a wxPoint object containing the coordinates to test.
Returns
True if connection to aPoint exists.

Definition at line 119 of file sch_item.cpp.

120 {
121  if( ( m_Flags & STRUCT_DELETED ) || ( m_Flags & SKIP_STRUCT ) )
122  return false;
123 
124  return doIsConnected( aPosition );
125 }
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:131
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:129
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:187
virtual bool doIsConnected(const wxPoint &aPosition) const
Function doIsConnected provides the object specific test to see if it is connected to aPosition.
Definition: sch_item.h:413

References SCH_ITEM::doIsConnected(), EDA_ITEM::m_Flags, SKIP_STRUCT, and STRUCT_DELETED.

Referenced by SCH_SCREEN::CountConnectedItems(), and SCH_SCREEN::IsTerminalPoint().

◆ IsConnectivityDirty()

bool SCH_ITEM::IsConnectivityDirty ( )
inlineinherited

Definition at line 355 of file sch_item.h.

355 { return m_connectivity_dirty; }
bool m_connectivity_dirty
True if connectivity info might be out of date.
Definition: sch_item.h:131

References SCH_ITEM::m_connectivity_dirty.

◆ IsDangling()

virtual bool SCH_ITEM::IsDangling ( ) const
inlinevirtualinherited

Reimplemented in SCH_LINE, SCH_TEXT, SCH_BUS_ENTRY_BASE, and SCH_PIN.

Definition at line 290 of file sch_item.h.

290 { return false; }

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 231 of file base_struct.h.

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

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 235 of file base_struct.h.

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

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

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

◆ IsInNetlist()

bool SCH_COMPONENT::IsInNetlist ( ) const
Returns
true if the component is in netlist which means this is not a power component, or something like a component reference starting by #

Definition at line 1841 of file sch_component.cpp.

1842 {
1843  return m_isInNetlist;
1844 }
bool m_isInNetlist
True if the component should appear in the netlist.

References m_isInNetlist.

Referenced by AUTOPLACER::AUTOPLACER(), and NETLIST_OBJECT_LIST::findBestNetNameForEachNet().

◆ IsLocked()

virtual bool SCH_ITEM::IsLocked ( ) const
inlinevirtualinherited

Function IsLocked.

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

Definition at line 181 of file sch_item.h.

181 { return false; }

Referenced by SCH_EDIT_TOOL::DeleteItemCursor().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

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

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMovableFromAnchorPoint()

bool SCH_COMPONENT::IsMovableFromAnchorPoint ( )
inlineoverridevirtual

Return true for items which are moved with the anchor point at mouse cursor and false for items moved with no reference to anchor.

Usually return true for small items (labels, junctions) and false for items which can be large (hierarchical sheets, components).

Note: we used to try and be smart about this and return false for components in case they are big. However, this annoyed some users and we now have a preference which controls warping on move in general, so this was switched to true for components.

Returns
true for a component

Reimplemented from SCH_ITEM.

Definition at line 179 of file sch_component.h.

179 { return true; }

◆ IsMoving()

◆ IsNew()

◆ IsReferenceStringValid()

bool SCH_COMPONENT::IsReferenceStringValid ( const wxString &  aReferenceString)
static

Tests for an acceptable reference string.

An acceptable reference string must support unannotation i.e starts by letter

Parameters
aReferenceStringis the reference string to validate
Returns
true if reference string is valid.

Definition at line 644 of file sch_component.cpp.

645 {
646  wxString text = aReferenceString;
647  bool ok = true;
648 
649  // Try to unannotate this reference
650  while( !text.IsEmpty() && ( text.Last() == '?' || wxIsdigit( text.Last() ) ) )
651  text.RemoveLast();
652 
653  if( text.IsEmpty() )
654  ok = false;
655 
656  return ok;
657 }

Referenced by ClearAnnotation(), SetRef(), DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::Validate().

◆ IsReplaceable()

bool SCH_COMPONENT::IsReplaceable ( ) const
inlineoverridevirtual

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 from EDA_ITEM.

Definition at line 619 of file sch_component.h.

619 { return true; }

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 234 of file base_struct.h.

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

References IS_RESIZED, and EDA_ITEM::m_Flags.

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

◆ IsSelected()

◆ IsType()

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

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

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

Reimplemented in SCH_LABEL, SCH_FIELD, and SCH_LINE.

Definition at line 294 of file base_struct.h.

295  {
296  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
297  return true;
298 
299  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
300  {
301  if( m_StructType == *p )
302  return true;
303  }
304 
305  return false;
306  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:172
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78

References EOT, EDA_ITEM::m_StructType, and SCH_LOCATE_ANY_T.

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

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 232 of file base_struct.h.

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

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward() [1/3]

static SEARCH_RESULT EDA_ITEM::IterateForward ( EDA_ITEM listStart,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

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

423  {
424  for( EDA_ITEM* p = listStart; p; p = p->Pnext )
425  {
426  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
427  return SEARCH_QUIT;
428  }
429 
430  return SEARCH_CONTINUE;
431  }
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:176

References EDA_ITEM::Pnext, SEARCH_CONTINUE, and SEARCH_QUIT.

Referenced by EE_COLLECTOR::Collect(), EE_TYPE_COLLECTOR::Collect(), nextMatch(), EE_SELECTION_TOOL::RebuildSelection(), SCH_EDITOR_CONTROL::UpdateFind(), GERBER_FILE_IMAGE::Visit(), and BOARD::Visit().

◆ IterateForward() [2/3]

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

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

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

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

Definition at line 439 of file base_struct.h.

443  {
444  for( auto it : aList )
445  {
446  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes ) == SEARCH_QUIT )
447  return SEARCH_QUIT;
448  }
449 
450  return SEARCH_CONTINUE;
451  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

◆ IterateForward() [3/3]

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

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

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

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

Definition at line 459 of file base_struct.h.

461  {
462  for( auto it : aList )
463  {
464  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
465  == SEARCH_QUIT )
466  return SEARCH_QUIT;
467  }
468 
469  return SEARCH_CONTINUE;
470  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

◆ Load()

virtual bool SCH_ITEM::Load ( LINE_READER aLine,
wxString &  aErrorMsg 
)
inlinevirtualinherited

Function Load reads a schematic item from aLine in a .sch file.

Parameters
aLine- Essentially this is file to read the object from.
aErrorMsg- Description of the error if an error occurs while loading the object.
Returns
True if the object loaded successfully.

Definition at line 260 of file sch_item.h.

260 { return false; }

◆ Matches() [1/2]

bool SCH_COMPONENT::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData 
)
overridevirtual

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 1488 of file sch_component.cpp.

1489 {
1490  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) );
1491 
1492  // Components are searchable via the child field and pin item text.
1493  return false;
1494 }
wxString GetSelectMenuText(EDA_UNITS_T aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
const wxChar *const traceFindItem
Flag to enable find debug tracing.

References GetSelectMenuText(), MILLIMETRES, and traceFindItem.

◆ Matches() [2/2]

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

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 156 of file base_struct.cpp.

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

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

◆ MirrorX()

void SCH_COMPONENT::MirrorX ( int  aXaxis_position)
overridevirtual

Function MirrorX mirrors item relative to the X axis about aXaxis_position.

Parameters
aXaxis_positionThe X axis position to mirror around.

Implements SCH_ITEM.

Definition at line 1451 of file sch_component.cpp.

1452 {
1453  int dy = m_Pos.y;
1454 
1456  MIRROR( m_Pos.y, aXaxis_position );
1457  dy -= m_Pos.y; // dy,0 is the move vector for this transform
1458 
1459  for( int ii = 0; ii < GetFieldCount(); ii++ )
1460  {
1461  // Move the fields to the new position because the component itself has moved.
1462  wxPoint pos = GetField( ii )->GetTextPos();
1463  pos.y -= dy;
1464  GetField( ii )->SetTextPos( pos );
1465  }
1466 }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:231
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:123
int GetFieldCount() const
Return the number of fields in this symbol.
const wxPoint & GetTextPos() const
Definition: eda_text.h:232
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...

References CMP_MIRROR_X, GetField(), GetFieldCount(), EDA_TEXT::GetTextPos(), m_Pos, MIRROR(), SetOrientation(), and EDA_TEXT::SetTextPos().

◆ MirrorY()

void SCH_COMPONENT::MirrorY ( int  aYaxis_position)
overridevirtual

Function MirrorY mirrors item relative to the Y axis about aYaxis_position.

Parameters
aYaxis_positionThe Y axis position to mirror around.

Implements SCH_ITEM.

Definition at line 1433 of file sch_component.cpp.

1434 {
1435  int dx = m_Pos.x;
1436 
1438  MIRROR( m_Pos.x, aYaxis_position );
1439  dx -= m_Pos.x; // dx,0 is the move vector for this transform
1440 
1441  for( int ii = 0; ii < GetFieldCount(); ii++ )
1442  {
1443  // Move the fields to the new position because the component itself has moved.
1444  wxPoint pos = GetField( ii )->GetTextPos();
1445  pos.x -= dx;
1446  GetField( ii )->SetTextPos( pos );
1447  }
1448 }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:231
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:123
int GetFieldCount() const
Return the number of fields in this symbol.
const wxPoint & GetTextPos() const
Definition: eda_text.h:232
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...

References CMP_MIRROR_Y, GetField(), GetFieldCount(), EDA_TEXT::GetTextPos(), m_Pos, MIRROR(), SetOrientation(), and EDA_TEXT::SetTextPos().

◆ Move()

void SCH_COMPONENT::Move ( const wxPoint &  aMoveVector)
inlineoverridevirtual

Function Move moves the item by aMoveVector to a new position.

Parameters
aMoveVector= the displacement vector

Implements SCH_ITEM.

Definition at line 539 of file sch_component.h.

540  {
541  if( aMoveVector == wxPoint( 0, 0 ) )
542  return;
543 
544  m_Pos += aMoveVector;
545 
546  for( int ii = 0; ii < GetFieldCount(); ii++ )
547  GetField( ii )->Move( aMoveVector );
548 
549  SetModified();
550  }
void Move(const wxPoint &aMoveVector) override
Function Move moves the item by aMoveVector to a new position.
Definition: sch_field.h:153
void SetModified()
Definition: base_struct.cpp:98
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
int GetFieldCount() const
Return the number of fields in this symbol.

References GetField(), GetFieldCount(), m_Pos, SCH_FIELD::Move(), and EDA_ITEM::SetModified().

Referenced by SetPosition().

◆ Next()

SCH_ITEM* SCH_ITEM::Next ( ) const
inlineinherited

Definition at line 153 of file sch_item.h.

153 { return static_cast<SCH_ITEM*>( Pnext ); }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:176

References EDA_ITEM::Pnext.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SHEET_LIST::AnnotatePowerSymbols(), SCH_EDIT_FRAME::BreakSegments(), SCH_EDIT_FRAME::BreakSegmentsOnJunctions(), HIERARCHY_NAVIG_DLG::buildHierarchyTree(), NETLIST_OBJECT_LIST::BuildNetListInfo(), SCH_SCREENS::ChangeSymbolLibNickname(), SCH_SCREEN::CheckIfOnDrawList(), SCH_SCREEN::ClearAnnotation(), SCH_SCREEN::ClearDrawingState(), SCH_SCREEN::CountConnectedItems(), SCH_EDIT_FRAME::CreateArchiveLibrary(), SCH_SCREENS::DeleteAllMarkers(), SCH_EDIT_FRAME::DeleteJunction(), DIALOG_ERC::DisplayERC_MarkersList(), KIGFX::SCH_VIEW::DisplaySheet(), SCH_SCREEN::EnsureAlternateReferencesExist(), SCH_EDITOR_CONTROL::FindComponentAndItem(), SCH_SHEET_PATH::FindNextItem(), SCH_SHEET_LIST::FindNextItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_SHEET_PATH::FirstDrawList(), SCH_EDIT_FRAME::FixupJunctions(), SCH_LEGACY_PLUGIN::Format(), get_components(), AUTOPLACER::get_possible_colliders(), SCH_SHEET_PATH::GetComponents(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_SCREEN::GetHierarchicalItems(), SCH_SCREEN::GetItem(), SCH_SCREEN::GetLabel(), SCH_SCREENS::GetLibNicknames(), SCH_SCREEN::GetLine(), SCH_SCREENS::GetMarkerCount(), SCH_SHEET_PATH::GetMultiUnitComponents(), SCH_SCREEN::GetPin(), SCH_SCREEN::GetSheet(), getSheetBbox(), SCH_SCREEN::GetSheetLabel(), SCH_LINE_WIRE_BUS_TOOL::getSheetPin(), SCH_SCREEN::GetWireOrBus(), SCH_SCREENS::HasNoFullyDefinedLibIds(), SCH_EDIT_FRAME::ImportHierLabel(), DIALOG_EDIT_COMPONENTS_LIBID::initDlg(), SCH_SCREEN::IsJunctionNeeded(), SCH_EAGLE_PLUGIN::loadSheet(), SCH_MOVE_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), SCH_EAGLE_PLUGIN::moveLabels(), DIALOG_ERC::OnLeftClickMarkersList(), SCH_EDITOR_CONTROL::Paste(), SCH_SCREEN::Plot(), SCH_SCREEN::Print(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), SCH_SCREEN::ReplaceWires(), SCH_EDIT_FRAME::SchematicCleanUp(), EE_SELECTION_TOOL::SelectConnection(), SCH_SCREEN::SetComponentFootprint(), SCH_SCREEN::TestDanglingEnds(), TestDuplicateSheetNames(), DIALOG_ERC::TestErc(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), SCH_EDIT_FRAME::TrimWire(), and SCH_EDIT_TOOL::UpdateFields().

◆ operator!=()

bool SCH_COMPONENT::operator!= ( const SCH_COMPONENT aComponent) const

Definition at line 1756 of file sch_component.cpp.

1757 {
1758  return !( *this == aComponent );
1759 }

◆ operator<() [1/2]

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

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

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

◆ operator<() [2/2]

bool SCH_COMPONENT::operator< ( const SCH_ITEM aItem) const
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 1719 of file sch_component.cpp.

1720 {
1721  if( Type() != aItem.Type() )
1722  return Type() < aItem.Type();
1723 
1724  SCH_COMPONENT* component = (SCH_COMPONENT*) &aItem;
1725 
1726  EDA_RECT rect = GetBodyBoundingBox();
1727 
1728  if( rect.GetArea() != component->GetBodyBoundingBox().GetArea() )
1729  return rect.GetArea() < component->GetBodyBoundingBox().GetArea();
1730 
1731  if( m_Pos.x != component->m_Pos.x )
1732  return m_Pos.x < component->m_Pos.x;
1733 
1734  if( m_Pos.y != component->m_Pos.y )
1735  return m_Pos.y < component->m_Pos.y;
1736 
1737  return false;
1738 }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
double GetArea() const
Function GetArea returns the area of the rectangle.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:73
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References EDA_RECT::GetArea(), GetBodyBoundingBox(), m_Pos, and EDA_ITEM::Type().

◆ operator=()

SCH_COMPONENT & SCH_COMPONENT::operator= ( const SCH_ITEM aItem)

Definition at line 1762 of file sch_component.cpp.

1763 {
1764  wxCHECK_MSG( Type() == aItem.Type(), *this,
1765  wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
1766  GetClass() );
1767 
1768  if( &aItem != this )
1769  {
1770  SCH_ITEM::operator=( aItem );
1771 
1772  SCH_COMPONENT* c = (SCH_COMPONENT*) &aItem;
1773 
1774  m_lib_id = c->m_lib_id;
1775 
1776  LIB_PART* libSymbol = c->m_part ? new LIB_PART( *c->m_part.get() ) : nullptr;
1777 
1778  m_part.reset( libSymbol );
1779  m_Pos = c->m_Pos;
1780  m_unit = c->m_unit;
1781  m_convert = c->m_convert;
1782  m_transform = c->m_transform;
1783 
1785 
1786  m_Fields = c->m_Fields; // std::vector's assignment operator
1787 
1788  // Reparent fields after assignment to new component.
1789  for( SCH_FIELD& field : m_Fields )
1790  field.SetParent( this );
1791 
1792  UpdatePins();
1793  }
1794 
1795  return *this;
1796 }
static void UpdatePins(const EE_COLLECTOR &aComponents)
Update the pin cache for all components in aComponents.
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
Define a library symbol object.
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:73
virtual wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_item.h:140
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:86
wxString GetClass() const override
Function GetClass returns the class name.
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References SCH_ITEM::GetClass(), GetClass(), m_convert, m_Fields, m_lib_id, m_part, m_PathsAndReferences, m_Pos, m_transform, m_unit, EDA_ITEM::operator=(), EDA_ITEM::Type(), and UpdatePins().

◆ operator==()

bool SCH_COMPONENT::operator== ( const SCH_COMPONENT aComponent) const

Definition at line 1741 of file sch_component.cpp.

1742 {
1743  if( GetFieldCount() != aComponent.GetFieldCount() )
1744  return false;
1745 
1746  for( int i = VALUE; i < GetFieldCount(); i++ )
1747  {
1748  if( GetField( i )->GetText().Cmp( aComponent.GetField( i )->GetText() ) != 0 )
1749  return false;
1750  }
1751 
1752  return true;
1753 }
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
#define VALUE
int GetFieldCount() const
Return the number of fields in this symbol.
size_t i
Definition: json11.cpp:649
virtual const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:124

References GetField(), GetFieldCount(), EDA_TEXT::GetText(), i, and VALUE.

◆ Plot()

void SCH_COMPONENT::Plot ( PLOTTER aPlotter)
overridevirtual

Function Plot plots the schematic item to aPlotter.

Parameters
aPlotterA pointer to a PLOTTER object.

Reimplemented from SCH_ITEM.

Definition at line 1847 of file sch_component.cpp.

1848 {
1849  TRANSFORM temp;
1850 
1851  if( m_part )
1852  {
1853  temp = GetTransform();
1854  aPlotter->StartBlock( nullptr );
1855 
1856  m_part->Plot( aPlotter, GetUnit(), GetConvert(), m_Pos, temp );
1857 
1858  for( SCH_FIELD field : m_Fields )
1859  field.Plot( aPlotter );
1860 
1861  aPlotter->EndBlock( nullptr );
1862  }
1863 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
virtual void EndBlock(void *aData)
calling this function allows one to define the end of a group of drawing items for instance in SVG or...
Definition: plotter.h:478
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
Definition: plotter.h:469
int GetUnit() const
Class for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
TRANSFORM & GetTransform() const
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
int GetConvert() const

References PLOTTER::EndBlock(), GetConvert(), GetTransform(), GetUnit(), m_Fields, m_part, m_Pos, and PLOTTER::StartBlock().

◆ Print()

void SCH_COMPONENT::Print ( wxDC *  aDC,
const wxPoint &  aOffset 
)
overridevirtual

Print a component.

Parameters
aDCis the device context (can be null)
aOffsetis the drawing offset (usually wxPoint(0,0), but can be different when moving an object)

Implements SCH_ITEM.

Definition at line 547 of file sch_component.cpp.

548 {
549  auto opts = PART_DRAW_OPTIONS::Default();
550  opts.transform = m_transform;
551  opts.draw_visible_fields = false;
552  opts.draw_hidden_fields = false;
553 
554  if( m_part )
555  {
556  m_part->Print( aDC, m_Pos + aOffset, m_unit, m_convert, opts );
557  }
558  else // Use dummy() part if the actual cannot be found.
559  {
560  dummy()->Print( aDC, m_Pos + aOffset, 0, 0, opts );
561  }
562 
563  SCH_FIELD* field = GetField( REFERENCE );
564 
565  if( field->IsVisible() )
566  field->Print(aDC, aOffset );
567 
568  for( int ii = VALUE; ii < GetFieldCount(); ii++ )
569  {
570  field = GetField( ii );
571  field->Print( aDC, aOffset );
572  }
573 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
bool IsVisible() const
Definition: eda_text.h:170
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
Field Reference of part, i.e. "IC21".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
#define VALUE
void Print(wxDC *aDc, const wxPoint &aOffset, int aMulti, int aConvert, const PART_DRAW_OPTIONS &aOpts)
Print part.
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
static PART_DRAW_OPTIONS Default()
int GetFieldCount() const
Return the number of fields in this symbol.
void Print(wxDC *aDC, const wxPoint &aOffset) override
Function Print Print a schematic item.
Definition: sch_field.cpp:114
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:86
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93

References PART_DRAW_OPTIONS::Default(), dummy(), GetField(), GetFieldCount(), EDA_TEXT::IsVisible(), m_convert, m_part, m_Pos, m_transform, m_unit, SCH_FIELD::Print(), LIB_PART::Print(), REFERENCE, and VALUE.

◆ RemoveField()

void SCH_COMPONENT::RemoveField ( const wxString &  aFieldName)

Removes a user field from the symbol.

Parameters
aFieldNameis the user fieldName to remove. Attempts to remove a mandatory field or a non-existant field are silently ignored.

Definition at line 870 of file sch_component.cpp.

871 {
872  for( unsigned i = MANDATORY_FIELDS; i < m_Fields.size(); ++i )
873  {
874  if( aFieldName == m_Fields[i].GetName( false ) )
875  {
876  m_Fields.erase( m_Fields.begin() + i );
877  return;
878  }
879  }
880 }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
size_t i
Definition: json11.cpp:649

References i, m_Fields, and MANDATORY_FIELDS.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData().

◆ Replace() [1/2]

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

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

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

Definition at line 183 of file base_struct.cpp.

184 {
185  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
186 
187  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
188  aSearchData.GetFindString() :
189  aSearchData.GetFindString().Upper() );
190 
191  if( result == wxNOT_FOUND )
192  return false;
193 
194  wxString prefix = aText.Left( result );
195  wxString suffix;
196 
197  if( aSearchData.GetFindString().length() + result < aText.length() )
198  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
199 
200  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
201  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
202  GetChars( suffix ) );
203 
204  aText = prefix + aSearchData.GetReplaceString() + suffix;
205 
206  return true;
207 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:101

References GetChars(), and traceFindReplace.

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

◆ Replace() [2/2]

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

Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

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

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

Reimplemented in SCH_SHEET, SCH_FIELD, SCH_SHEET_PIN, and SCH_TEXT.

Definition at line 544 of file base_struct.h.

544 { return false; }

◆ Resolve() [1/2]

bool SCH_COMPONENT::Resolve ( PART_LIBS aLibs)

Assigns the current LIB_PART from aLibs which this symbol is based on.

Parameters
aLibsis the current set of LIB_PARTs to choose from.

Definition at line 315 of file sch_component.cpp.

316 {
317  // I've never been happy that the actual individual PART_LIB is left up to
318  // flimsy search path ordering. None-the-less find a part based on that design:
319  if( LIB_PART* part = aLibs->FindLibPart( m_lib_id ) )
320  {
321  m_part.reset( new LIB_PART( *part ) );
322  UpdatePins();
323  return true;
324  }
325 
326  return false;
327 }
static void UpdatePins(const EE_COLLECTOR &aComponents)
Update the pin cache for all components in aComponents.
Define a library symbol object.
LIB_PART * FindLibPart(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Search all libraries in the list for a part.
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97

References PART_LIBS::FindLibPart(), m_lib_id, m_part, and UpdatePins().

Referenced by LIB_CONTROL::AddSymbolToSchematic(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), and SetLibId().

◆ Resolve() [2/2]

bool SCH_COMPONENT::Resolve ( SYMBOL_LIB_TABLE aLibTable,
PART_LIB aCacheLib = NULL 
)

Definition at line 330 of file sch_component.cpp.

331 {
332  std::unique_ptr< LIB_PART > part;
333 
334  try
335  {
336  // We want a full symbol not just the top level child symbol.
337  PROPERTIES props;
338 
339  props[ SCH_LEGACY_PLUGIN::PropNoDocFile ] = "";
340 
341  // LIB_TABLE_BASE::LoadSymbol() throws an IO_ERROR if the the library nickname
342  // is not found in the table so check if the library still exists in the table
343  // before attempting to load the symbol.
344  if( m_lib_id.IsValid() && aLibTable.HasLibrary( m_lib_id.GetLibNickname() ) )
345  {
346  LIB_PART* tmp = aLibTable.LoadSymbol( m_lib_id );
347 
348  if( tmp )
349  part = tmp->Flatten();
350  }
351 
352  // Fall back to cache library. This is temporary until the new schematic file
353  // format is implemented.
354  if( !part && aCacheLib )
355  {
356  wxString libId = m_lib_id.Format().wx_str();
357  libId.Replace( ":", "_" );
358  wxLogTrace( traceSymbolResolver,
359  "Library symbol %s not found falling back to cache library.",
360  m_lib_id.Format().wx_str() );
361  LIB_PART* tmp = aCacheLib->FindPart( libId );
362 
363  if( tmp )
364  part.reset( new LIB_PART( *tmp ) );
365  }
366 
367  if( part )
368  {
369  m_part.reset( part.release() );
370  UpdatePins();
371  return true;
372  }
373  }
374  catch( const IO_ERROR& ioe )
375  {
376  wxLogTrace( traceSymbolResolver, "I/O error %s resolving library symbol %s", ioe.What(),
377  m_lib_id.Format().wx_str() );
378  }
379 
380  wxLogTrace( traceSymbolResolver, "Cannot resolve library symbol %s",
381  m_lib_id.Format().wx_str() );
382 
383  m_part.reset();
384  UpdatePins(); // This will clear the pin map and library symbol pin pointers.
385 
386  return false;
387 }
static void UpdatePins(const EE_COLLECTOR &aComponents)
Update the pin cache for all components in aComponents.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
const wxChar *const traceSymbolResolver
Flag to enable debug output of symbol library resolver results.
LIB_PART * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_PART having aName from the library given by aNickname.
bool IsValid() const
Definition: lib_id.h:171
Class PROPERTIES is a name/value tuple with unique names and optional values.
Definition: properties.h:34
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
Define a library symbol object.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
static const char * PropNoDocFile
The property used internally by the plugin to disable writing the library documentation (....
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
std::unique_ptr< LIB_PART > Flatten() const
Return a flattened symbol inheritance to the caller.
LIB_PART * FindPart(const wxString &aName) const
Find LIB_PART by aName.
UTF8 Format() const
Definition: lib_id.cpp:237
wxString wx_str() const
Definition: utf8.cpp:51
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76

References PART_LIB::FindPart(), LIB_PART::Flatten(), LIB_ID::Format(), LIB_ID::GetLibNickname(), LIB_TABLE::HasLibrary(), LIB_ID::IsValid(), SYMBOL_LIB_TABLE::LoadSymbol(), m_lib_id, m_part, SCH_LEGACY_PLUGIN::PropNoDocFile, traceSymbolResolver, UpdatePins(), IO_ERROR::What(), and UTF8::wx_str().

◆ ResolveAll()

void SCH_COMPONENT::ResolveAll ( const EE_COLLECTOR aComponents,
SYMBOL_LIB_TABLE aLibTable,
PART_LIB aCacheLib = NULL 
)
static

Definition at line 405 of file sch_component.cpp.

407 {
408  std::vector<SCH_COMPONENT*> cmp_list;
409 
410  for( int i = 0; i < aComponents.GetCount(); ++i )
411  {
412  SCH_COMPONENT* cmp = dynamic_cast<SCH_COMPONENT*>( aComponents[i] );
413 
414  wxCHECK2_MSG( cmp, continue, "Invalid SCH_COMPONENT pointer in list." );
415 
416  cmp_list.push_back( cmp );
417  }
418 
419  // sort it by lib part. Cmp will be grouped by same lib part.
420  std::sort( cmp_list.begin(), cmp_list.end(), sort_by_libid );
421 
422  LIB_ID curr_libid;
423 
424  for( unsigned ii = 0; ii < cmp_list.size (); ++ii )
425  {
426  SCH_COMPONENT* cmp = cmp_list[ii];
427  curr_libid = cmp->m_lib_id;
428  cmp->Resolve( aLibTable, aCacheLib );
429  cmp->UpdatePins();
430 
431  // Propagate the m_part pointer to other members using the same lib_id
432  for( unsigned jj = ii+1; jj < cmp_list.size (); ++jj )
433  {
434  SCH_COMPONENT* next_cmp = cmp_list[jj];
435 
436  if( curr_libid != next_cmp->m_lib_id )
437  break;
438 
439  if( cmp->m_part )
440  next_cmp->m_part.reset( new LIB_PART( *cmp->m_part.get() ) );
441 
442  next_cmp->UpdatePins();
443 
444  ii = jj;
445  }
446  }
447 }
static void UpdatePins(const EE_COLLECTOR &aComponents)
Update the pin cache for all components in aComponents.
static bool sort_by_libid(const SCH_COMPONENT *ref, SCH_COMPONENT *cmp)
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:113
Define a library symbol object.
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
size_t i
Definition: json11.cpp:649
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:73

References COLLECTOR::GetCount(), i, m_lib_id, m_part, sort_by_libid(), and UpdatePins().

Referenced by SCH_SCREEN::UpdateSymbolLinks().

◆ Rotate()

void SCH_COMPONENT::Rotate ( wxPoint  aPosition)
overridevirtual

Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction.

Parameters
aPositionA reference to a wxPoint object containing the coordinates to rotate around.

Implements SCH_ITEM.

Definition at line 1469 of file sch_component.cpp.

1470 {
1471  wxPoint prev = m_Pos;
1472 
1473  RotatePoint( &m_Pos, aPosition, 900 );
1474 
1476 
1477  for( int ii = 0; ii < GetFieldCount(); ii++ )
1478  {
1479  // Move the fields to the new position because the component itself has moved.
1480  wxPoint pos = GetField( ii )->GetTextPos();
1481  pos.x -= prev.x - m_Pos.x;
1482  pos.y -= prev.y - m_Pos.y;
1483  GetField( ii )->SetTextPos( pos );
1484  }
1485 }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:231
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:206
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
int GetFieldCount() const
Return the number of fields in this symbol.
const wxPoint & GetTextPos() const
Definition: eda_text.h:232
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...

References CMP_ROTATE_COUNTERCLOCKWISE, GetField(), GetFieldCount(), EDA_TEXT::GetTextPos(), m_Pos, RotatePoint(), SetOrientation(), and EDA_TEXT::SetTextPos().

◆ SetBack()

void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 224 of file base_struct.h.

224 { Pback = aBack; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:177

References EDA_ITEM::Pback.

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

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

Definition at line 241 of file base_struct.h.

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

References BRIGHTENED, and EDA_ITEM::SetFlags().

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

◆ SetConnectivityDirty()

void SCH_ITEM::SetConnectivityDirty ( bool  aDirty = true)
inlineinherited

Definition at line 357 of file sch_item.h.

357 { m_connectivity_dirty = aDirty; }
bool m_connectivity_dirty
True if connectivity info might be out of date.
Definition: sch_item.h:131

References SCH_ITEM::m_connectivity_dirty.

Referenced by SCH_EDIT_FRAME::SaveCopyInUndoList().

◆ SetConvert()

void SCH_COMPONENT::SetConvert ( int  aConvert)

Definition at line 518 of file sch_component.cpp.

519 {
520  if( m_convert != aConvert )
521  {
522  m_convert = aConvert;
523  SetModified();
524  }
525 }
void SetModified()
Definition: base_struct.cpp:98
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:86

References m_convert, and EDA_ITEM::SetModified().

Referenced by SCH_EDIT_FRAME::ConvertPart(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow().

◆ SetFields()

void SCH_COMPONENT::SetFields ( const SCH_FIELDS aFields)
inline

Set multiple schematic fields.

Parameters
aFieldsare the fields to set in this symbol.

Definition at line 398 of file sch_component.h.

399  {
400  m_Fields = aFields; // vector copying, length is changed possibly
401  }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94

References m_Fields.

Referenced by DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_UPDATE_FIELDS::updateFields(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary().

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 265 of file base_struct.h.

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

References EDA_ITEM::m_Flags.

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

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

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

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

Definition at line 316 of file base_struct.h.

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

References EDA_ITEM::m_forceVisible.

◆ SetHighlighted()

void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 240 of file base_struct.h.

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

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

◆ SetLayer()

void SCH_ITEM::SetLayer ( SCH_LAYER_ID  aLayer)
inlineinherited

Function SetLayer sets the layer this item is on.

Parameters
aLayerThe layer number.

Definition at line 200 of file sch_item.h.

200 { m_Layer = aLayer; }
SCH_LAYER_ID m_Layer
Definition: sch_item.h:119

References SCH_ITEM::m_Layer.

Referenced by Init(), SCH_FIELD::SCH_FIELD(), and SCH_NO_CONNECT::SCH_NO_CONNECT().

◆ SetLibId() [1/2]

void SCH_COMPONENT::SetLibId ( const LIB_ID aName,
PART_LIBS aLibs = NULL 
)

Definition at line 240 of file sch_component.cpp.

241 {
242  if( m_lib_id != aLibId )
243  {
244  m_lib_id = aLibId;
245  SetModified();
246 
247  if( aLibs )
248  {
249  Resolve( aLibs );
250  }
251  else
252  {
253  m_part.reset();
254  m_pins.clear();
255  m_pinMap.clear();
256  }
257  }
258 }
void SetModified()
Definition: base_struct.cpp:98
SCH_PINS m_pins
the component's pins
Definition: sch_component.h:99
bool Resolve(PART_LIBS *aLibs)
Assigns the current LIB_PART from aLibs which this symbol is based on.
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
SCH_PIN_MAP m_pinMap
the component's pins mapped by LIB_PIN*.

References m_lib_id, m_part, m_pinMap, m_pins, Resolve(), and EDA_ITEM::SetModified().

Referenced by SCH_SCREENS::ChangeSymbolLibNickname(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary().

◆ SetLibId() [2/2]

void SCH_COMPONENT::SetLibId ( const LIB_ID aLibId,
SYMBOL_LIB_TABLE aSymLibTable,
PART_LIB aCacheLib 
)

Definition at line 261 of file sch_component.cpp.

263 {
264  if( m_lib_id == aLibId )
265  return;
266 
267  m_lib_id = aLibId;
268  SetModified();
269 
270  std::unique_ptr< LIB_PART > symbol;
271 
272  if( aSymLibTable && aSymLibTable->HasLibrary( m_lib_id.GetLibNickname() ) )
273  {
274  LIB_PART* tmp = aSymLibTable->LoadSymbol( m_lib_id );
275 
276  if( tmp )
277  symbol = tmp->Flatten();
278  }
279 
280  if( !symbol && aCacheLib )
281  {
282  LIB_PART* tmp = aCacheLib->FindPart( m_lib_id.Format().wx_str() );
283 
284  if( tmp )
285  symbol.reset( new LIB_PART( *tmp ) );
286  }
287 
288  m_part.reset( symbol.release() );
289  UpdatePins();
290 }
static void UpdatePins(const EE_COLLECTOR &aComponents)
Update the pin cache for all components in aComponents.
void SetModified()
Definition: base_struct.cpp:98
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
LIB_PART * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_PART having aName from the library given by aNickname.
Define a library symbol object.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
std::unique_ptr< LIB_PART > Flatten() const
Return a flattened symbol inheritance to the caller.
LIB_PART * FindPart(const wxString &aName) const
Find LIB_PART by aName.
UTF8 Format() const
Definition: lib_id.cpp:237
wxString wx_str() const
Definition: utf8.cpp:51

References PART_LIB::FindPart(), LIB_PART::Flatten(), LIB_ID::Format(), LIB_ID::GetLibNickname(), LIB_TABLE::HasLibrary(), SYMBOL_LIB_TABLE::LoadSymbol(), m_lib_id, m_part, EDA_ITEM::SetModified(), UpdatePins(), and UTF8::wx_str().

◆ SetList()

void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 226 of file base_struct.h.

226 { m_List = aList; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:178

References EDA_ITEM::m_List.

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

◆ SetLocked()

virtual void SCH_ITEM::SetLocked ( bool  aLocked)
inlinevirtualinherited

Function SetLocked modifies 'lock' status for of the item.

Definition at line 187 of file sch_item.h.

187 {}

◆ SetModified()

void EDA_ITEM::SetModified ( )
inherited

◆ SetNext()

void EDA_ITEM::SetNext ( EDA_ITEM aNext)
inlineinherited

Definition at line 223 of file base_struct.h.

223 { Pnext = aNext; }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:176

References EDA_ITEM::Pnext.

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

◆ SetOrientation()

void SCH_COMPONENT::SetOrientation ( int  aOrientation)

Compute the new transform matrix based on aOrientation for the symbol which is applied to the current transform.

Parameters
aOrientationis the orientation to apply to the transform.

Definition at line 1095 of file sch_component.cpp.

1096 {
1097  TRANSFORM temp = TRANSFORM();
1098  bool transform = false;
1099 
1100  switch( aOrientation )
1101  {
1102  case CMP_ORIENT_0:
1103  case CMP_NORMAL: // default transform matrix
1104  m_transform.x1 = 1;
1105  m_transform.y2 = -1;
1106  m_transform.x2 = m_transform.y1 = 0;
1107  break;
1108 
1109  case CMP_ROTATE_COUNTERCLOCKWISE: // Rotate + (incremental rotation)
1110  temp.x1 = temp.y2 = 0;
1111  temp.y1 = 1;
1112  temp.x2 = -1;
1113  transform = true;
1114  break;
1115 
1116  case CMP_ROTATE_CLOCKWISE: // Rotate - (incremental rotation)
1117  temp.x1 = temp.y2 = 0;
1118  temp.y1 = -1;
1119  temp.x2 = 1;
1120  transform = true;
1121  break;
1122 
1123  case CMP_MIRROR_Y: // Mirror Y (incremental rotation)
1124  temp.x1 = -1;
1125  temp.y2 = 1;
1126  temp.y1 = temp.x2 = 0;
1127  transform = true;
1128  break;
1129 
1130  case CMP_MIRROR_X: // Mirror X (incremental rotation)
1131  temp.x1 = 1;
1132  temp.y2 = -1;
1133  temp.y1 = temp.x2 = 0;
1134  transform = true;
1135  break;
1136 
1137  case CMP_ORIENT_90:
1140  break;
1141 
1142  case CMP_ORIENT_180:
1146  break;
1147 
1148  case CMP_ORIENT_270:
1151  break;
1152 
1153  case ( CMP_ORIENT_0 + CMP_MIRROR_X ):
1156  break;
1157 
1158  case ( CMP_ORIENT_0 + CMP_MIRROR_Y ):
1161  break;
1162 
1163  case ( CMP_ORIENT_90 + CMP_MIRROR_X ):
1166  break;
1167 
1168  case ( CMP_ORIENT_90 + CMP_MIRROR_Y ):
1171  break;
1172 
1173  case ( CMP_ORIENT_180 + CMP_MIRROR_X ):
1176  break;
1177 
1178  case ( CMP_ORIENT_180 + CMP_MIRROR_Y ):
1181  break;
1182 
1183  case ( CMP_ORIENT_270 + CMP_MIRROR_X ):
1186  break;
1187 
1188  case ( CMP_ORIENT_270 + CMP_MIRROR_Y ):
1191  break;
1192 
1193  default:
1194  transform = false;
1195  wxMessageBox( wxT( "SetRotateMiroir() error: ill value" ) );
1196  break;
1197  }
1198 
1199  if( transform )
1200  {
1201  /* The new matrix transform is the old matrix transform modified by the
1202  * requested transformation, which is the temp transform (rot,
1203  * mirror ..) in order to have (in term of matrix transform):
1204  * transform coord = new_m_transform * coord
1205  * where transform coord is the coord modified by new_m_transform from
1206  * the initial value coord.
1207  * new_m_transform is computed (from old_m_transform and temp) to
1208  * have:
1209  * transform coord = old_m_transform * temp
1210  */
1211  TRANSFORM newTransform;
1212 
1213  newTransform.x1 = m_transform.x1 * temp.x1 + m_transform.x2 * temp.y1;
1214  newTransform.y1 = m_transform.y1 * temp.x1 + m_transform.y2 * temp.y1;
1215  newTransform.x2 = m_transform.x1 * temp.x2 + m_transform.x2 * temp.y2;
1216  newTransform.y2 = m_transform.y1 * temp.x2 + m_transform.y2 * temp.y2;
1217  m_transform = newTransform;
1218  }
1219 }
int y2
Definition: transform.h:51
int x2
Definition: transform.h:50
int x1
Definition: transform.h:48
int y1
Definition: transform.h:49
Class for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...

References CMP_MIRROR_X, CMP_MIRROR_Y, CMP_NORMAL, CMP_ORIENT_0, CMP_ORIENT_180, CMP_ORIENT_270, CMP_ORIENT_90, CMP_ROTATE_CLOCKWISE, CMP_ROTATE_COUNTERCLOCKWISE, m_transform, TRANSFORM::x1, TRANSFORM::x2, TRANSFORM::y1, and TRANSFORM::y2.

Referenced by GetOrientation(), SCH_EDIT_TOOL::Mirror(), MirrorX(), MirrorY(), SCH_EDIT_TOOL::Rotate(), Rotate(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow().

◆ SetParent()

◆ SetPosition()

void SCH_COMPONENT::SetPosition ( const wxPoint &  aPosition)
inlineoverridevirtual

Function SetPosition set the schematic item position to aPosition.

Parameters
aPositionA reference to a wxPoint object containing the new position.

Implements SCH_ITEM.

Definition at line 622 of file sch_component.h.

622 { Move( aPosition - m_Pos ); }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
void Move(const wxPoint &aMoveVector) override
Function Move moves the item by aMoveVector to a new position.

References m_Pos, and Move().

Referenced by SCH_DRAWING_TOOLS::PlaceComponent().

◆ SetPrefix()

void SCH_COMPONENT::SetPrefix ( const wxString &  aPrefix)
inline

Definition at line 256 of file sch_component.h.

256 { m_prefix = aPrefix; }
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is.
Definition: sch_component.h:89

References m_prefix.

◆ SetRef()

void SCH_COMPONENT::SetRef ( const SCH_SHEET_PATH aSheet,
const wxString &  aReference 
)

Set the reference for the given sheet path for this symbol.

Parameters
aSheetis the hierarchical path of the reference.
aReferenceis the new reference for the symbol.

Definition at line 660 of file sch_component.cpp.

661 {
662  wxString path = GetPath( sheet );
663 
664  bool notInArray = true;
665 
666  wxString h_path, h_ref;
667  wxStringTokenizer tokenizer;
668  wxString separators( wxT( " " ) );
669 
670  // check to see if it is already there before inserting it
671  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
672  {
673  tokenizer.SetString( m_PathsAndReferences[ii], separators );
674  h_path = tokenizer.GetNextToken();
675 
676  if( h_path.Cmp( path ) == 0 )
677  {
678  // just update the reference text, not the timestamp.
679  h_ref = h_path + wxT( " " ) + ref;
680  h_ref += wxT( " " );
681  tokenizer.GetNextToken(); // Skip old reference
682  h_ref += tokenizer.GetNextToken(); // Add part selection
683 
684  // Add the part selection
685  m_PathsAndReferences[ii] = h_ref;
686  notInArray = false;
687  }
688  }
689 
690  if( notInArray )
691  AddHierarchicalReference( path, ref, m_unit );
692 
693  SCH_FIELD* rf = GetField( REFERENCE );
694 
695  if( rf->GetText().IsEmpty()
696  || ( abs( rf->GetTextPos().x - m_Pos.x ) + abs( rf->GetTextPos().y - m_Pos.y ) > 10000 ) )
697  {
698  // move it to a reasonable position
699  rf->SetTextPos( m_Pos + wxPoint( 50, 50 ) );
700  }
701 
702  rf->SetText( ref ); // for drawing.
703 
704  // Reinit the m_prefix member if needed
705  wxString prefix = ref;
706 
707  if( IsReferenceStringValid( prefix ) )
708  {
709  while( prefix.Last() == '?' || wxIsdigit( prefix.Last() ) )
710  prefix.RemoveLast();
711  }
712  else
713  {
714  prefix = wxT( "U" ); // Set to default ref prefix
715  }
716 
717  if( m_prefix != prefix )
718  m_prefix = prefix;
719 
720  // Power components have references starting with # and are not included in netlists
721  m_isInNetlist = ! ref.StartsWith( wxT( "#" ) );
722 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:231
wxString GetPath(const SCH_SHEET_PATH *sheet) const
#define abs(a)
Definition: auxiliary.h:84
Field Reference of part, i.e. "IC21".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:126
bool m_isInNetlist
True if the component should appear in the netlist.
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
void AddHierarchicalReference(const wxString &aPath, const wxString &aRef, int aMulti)
Add a full hierarchical reference to this symbol.
const wxPoint & GetTextPos() const
Definition: eda_text.h:232
static bool IsReferenceStringValid(const wxString &aReferenceString)
Tests for an acceptable reference string.
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is.
Definition: sch_component.h:89
virtual const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:124

References abs, AddHierarchicalReference(), GetField(), GetPath(), EDA_TEXT::GetText(), EDA_TEXT::GetTextPos(), IsReferenceStringValid(), m_isInNetlist, m_PathsAndReferences, m_Pos, m_prefix, m_unit, REFERENCE, EDA_TEXT::SetText(), and EDA_TEXT::SetTextPos().

Referenced by SCH_REFERENCE::Annotate(), GetRef(), SCH_COMPONENT(), SCH_REFERENCE::SCH_REFERENCE(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_SCH_EDIT_ONE_FIELD::UpdateField().

◆ SetSelected()

void EDA_ITEM::SetSelected ( )
inlineinherited

◆ SetState()

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

Definition at line 254 of file base_struct.h.

255  {
256  if( state )
257  m_Status |= type; // state = ON or OFF
258  else
259  m_Status &= ~type;
260  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

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

◆ SetStatus()

void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited

Definition at line 263 of file base_struct.h.

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

References EDA_ITEM::m_Status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetStoredPos()

void SCH_ITEM::SetStoredPos ( wxPoint  aPos)
inlineinherited

Definition at line 175 of file sch_item.h.

175 { m_storedPos = aPos; }
wxPoint m_storedPos
a temporary variable used in some move commands to store a initial pos (of the item or mouse cursor)
Definition: sch_item.h:121

References SCH_ITEM::m_storedPos.

Referenced by SCH_MOVE_TOOL::Main(), and SCH_MOVE_TOOL::moveItem().

◆ SetTimeStamp()

void SCH_COMPONENT::SetTimeStamp ( timestamp_t  aNewTimeStamp)

Change the time stamp to aNewTimeStamp and updates the reference path.

See also
m_PathsAndReferences
Parameters
aNewTimeStamp= new time stamp

Definition at line 748 of file sch_component.cpp.

749 {
750  wxString string_timestamp, string_oldtimestamp;
751 
752  string_timestamp.Printf( wxT( "%08lX" ), (long unsigned) aNewTimeStamp );
753  string_oldtimestamp.Printf( wxT( "%08lX" ), (long unsigned) m_TimeStamp );
754  EDA_ITEM::SetTimeStamp( aNewTimeStamp );
755 
756  for( wxString& entry : m_PathsAndReferences )
757  entry.Replace( string_oldtimestamp.GetData(), string_timestamp.GetData() );
758 }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:181
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:215

References m_PathsAndReferences, EDA_ITEM::m_TimeStamp, and EDA_ITEM::SetTimeStamp().

Referenced by SCH_EDIT_TOOL::Duplicate(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), and SCH_COMPONENT().

◆ SetTransform()

void SCH_COMPONENT::SetTransform ( const TRANSFORM aTransform)

Definition at line 528 of file sch_component.cpp.

529 {
530  if( m_transform != aTransform )
531  {
532  m_transform = aTransform;
533  SetModified();
534  }
535 }
void SetModified()
Definition: base_struct.cpp:98
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93

References m_transform, and EDA_ITEM::SetModified().

◆ SetUnit()

void SCH_COMPONENT::SetUnit ( int  aUnit)

Change the unit number to aUnit.

This has meaning only for symbols made up of multiple units per package.

Note
This also set the modified flag bit
Parameters
aUnitis the new unit to select.

Definition at line 502 of file sch_component.cpp.

503 {
504  if( m_unit != aUnit )
505  {
506  m_unit = aUnit;
507  SetModified();
508  }
509 }
void SetModified()
Definition: base_struct.cpp:98
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85

References m_unit, and EDA_ITEM::SetModified().

Referenced by SCH_REFERENCE::Annotate(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_EDIT_FRAME::SelectUnit(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow().

◆ SetUnitSelection()

void SCH_COMPONENT::SetUnitSelection ( SCH_SHEET_PATH aSheet,
int  aUnitSelection 
)

Definition at line 789 of file sch_component.cpp.

790 {
791  wxString path = GetPath( aSheet );
792 
793  bool notInArray = true;
794 
795  wxString h_path, h_ref;
796  wxStringTokenizer tokenizer;
797  wxString separators( wxT( " " ) );
798 
799  //check to see if it is already there before inserting it
800  for( wxString& entry : m_PathsAndReferences )
801  {
802  tokenizer.SetString( entry, separators );
803  h_path = tokenizer.GetNextToken();
804 
805  if( h_path.Cmp( path ) == 0 )
806  {
807  //just update the unit selection.
808  h_ref = h_path + wxT( " " );
809  h_ref += tokenizer.GetNextToken(); // Add reference
810  h_ref += wxT( " " );
811  h_ref << aUnitSelection; // Add part selection
812 
813  // Ann the part selection
814  entry = h_ref;
815  notInArray = false;
816  }
817  }
818 
819  if( notInArray )
820  AddHierarchicalReference( path, m_prefix, aUnitSelection );
821 }
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxString GetPath(const SCH_SHEET_PATH *sheet) const
void AddHierarchicalReference(const wxString &aPath, const wxString &aRef, int aMulti)
Add a full hierarchical reference to this symbol.
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is.
Definition: sch_component.h:89

References AddHierarchicalReference(), GetPath(), m_PathsAndReferences, and m_prefix.

Referenced by SCH_REFERENCE::Annotate(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_EDIT_FRAME::SelectUnit(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 238 of file base_struct.h.

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

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ Sort()

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

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

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

Definition at line 575 of file base_struct.h.

575 { return *aLeft < *aRight; }

◆ SwapData()

void SCH_COMPONENT::SwapData ( SCH_ITEM aItem)
overridevirtual

Function SwapData swap the internal data structures aItem with the schematic item.

Obviously, aItem must have the same type than me

Parameters
aItemThe item to swap the data structures with.

Reimplemented from SCH_ITEM.

Definition at line 982 of file sch_component.cpp.

983 {
984  wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_COMPONENT_T),
985  wxT( "Cannot swap data with invalid component." ) );
986 
987  SCH_COMPONENT* component = (SCH_COMPONENT*) aItem;
988 
989  std::swap( m_lib_id, component->m_lib_id );
990 
991  LIB_PART* part = component->m_part.release();
992  component->m_part.reset( m_part.release() );
993  component->UpdatePins();
994  m_part.reset( part );
995  UpdatePins();
996 
997  std::swap( m_Pos, component->m_Pos );
998  std::swap( m_unit, component->m_unit );
999  std::swap( m_convert, component->m_convert );
1000 
1001  m_Fields.swap( component->m_Fields ); // std::vector's swap()
1002 
1003  for( int ii = 0; ii < component->GetFieldCount(); ++ii )
1004  component->GetField( ii )->SetParent( component );
1005 
1006  for( int ii = 0; ii < GetFieldCount(); ++ii )
1007  GetField( ii )->SetParent( this );
1008 
1009  TRANSFORM tmp = m_transform;
1010 
1011  m_transform = component->m_transform;
1012  component->m_transform = tmp;
1013 
1014  std::swap( m_PathsAndReferences, component->m_PathsAndReferences );
1015 }
static void UpdatePins(const EE_COLLECTOR &aComponents)
Update the pin cache for all components in aComponents.
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:94
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:80
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
Class for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:225
Define a library symbol object.
std::unique_ptr< LIB_PART > m_part
Definition: sch_component.h:97
int GetFieldCount() const
Return the number of fields in this symbol.
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:85
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:73
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:86
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:93
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References GetField(), GetFieldCount(), m_convert, m_Fields, m_lib_id, m_part, m_PathsAndReferences, m_Pos, m_transform, m_unit, SCH_COMPONENT_T, EDA_ITEM::SetParent(), EDA_ITEM::Type(), and UpdatePins().

◆ Type()

KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Function Type()

returns the type of object. This attribute should never be changed after a constructor sets it, so there is no public "setter" method.

Returns
KICAD_T - the type of object.

Definition at line 210 of file base_struct.h.

211  {
212  return m_StructType;
213  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:172

References EDA_ITEM::m_StructType.

Referenced by MODULE::Add(), CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), CN_CLUSTER::Add(), POINT_EDITOR::addCorner(), CONNECTION_SUBGRAPH::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), ZONE_FILLER::addKnockout(), SCH_SHEET::AddPin(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CN_ITEM::AnchorCount(), CONNECTION_GRAPH::buildConnectionGraph(), HIERARCHY_NAVIG_DLG::buildHierarchyTree(), SCH_SCREENS::buildScreenList(), SCH_SHEET_LIST::BuildSheetList(), calcArea(), calcMaxArea(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), POINT_EDITOR::canAddCorner(), SCH_JUNCTION::CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_LINE::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_LABEL::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SHEET::CanConnect(), CanConnect(), ROUTER_TOOL::CanInlineDrag(), SCH_SCREENS::ChangeSymbolLibNickname(), SCH_MARKER::ClassOf(), SCH_JUNCTION::ClassOf(), SCH_NO_CONNECT::ClassOf(), TEXTE_PCB::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), SCH_PIN::ClassOf(), EDGE_MODULE::ClassOf(), PCB_TARGET::ClassOf(), SCH_LINE::ClassOf(), SCH_FIELD::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), MARKER_PCB::ClassOf(), TRACK::ClassOf(), SCH_BITMAP::ClassOf(), ZONE_CONTAINER::ClassOf(), DIMENSION::ClassOf(), NETINFO_ITEM::ClassOf(), SCH_SHEET_PIN::ClassOf(), SCH_TEXT::ClassOf(), SCH_SCREEN::ClassOf(), MODULE::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), ClassOf(), D_PAD::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), BOARD::ClassOf(), SCH_LABEL::ClassOf(), SCH_SHEET::ClassOf(), SCH_GLOBALLABEL::ClassOf(), VIA::ClassOf(), SCH_HIERLABEL::ClassOf(), TRACKS_CLEANER::cleanupSegments(), SCH_SHEET::CleanupSheet(), EE_COLLECTOR::Collect(), LIB_RECTANGLE::compare(), LIB_CIRCLE::compare(), LIB_BEZIER::compare(), LIB_TEXT::compare(), LIB_POLYLINE::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), SCH_SHEET::ComponentCount(), GRID_HELPER::computeAnchors(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), SCH_EDIT_FRAME::ConvertTextType(), SCH_SCREEN::CountConnectedItems(), SCH_SHEET::CountSheets(), MODULE::CoverageRatio(), CINFO3D_VISU::createLayers(), SCH_EDIT_FRAME::CreateNewText(), CINFO3D_VISU::createNewTrack(), D_PAD::D_PAD(), SCH_SCREENS::DeleteAllMarkers(), SCH_SCREEN::DeleteItem(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_ERC::DisplayERC_MarkersList(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDIT_TOOL::DoDelete(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), DRC::doTrackDrc(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), CN_ITEM::Dump(), SCH_ITEM::Duplicate(), BOARD::Duplicate(), MODULE::Duplicate(), SCH_EDIT_TOOL::EditField(), LIB_EDIT_TOOL::editTextProperties(), EditToolSelectionFilter(), CONNECTION_GRAPH::ercCheckLabels(), SCH_EDITOR_CONTROL::FindComponentAndItem(), NETLIST_EXPORTER::findNextComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), SCH_SHEET_PATH::FindNextItem(), SCH_SHEET_LIST::FindNextItem(), SCH_SHEET_PATH::FindPreviousItem(), SCH_SHEET_LIST::FindPreviousItem(), EDIT_TOOL::FootprintFilter(), SCH_LEGACY_PLUGIN::Format(), PCB_IO::Format(), PCB_IO::format(),