KiCad PCB EDA Suite
ee_collectors.h File Reference
#include <class_libentry.h>
#include <collector.h>
#include <dialogs/dialog_schematic_find.h>
#include <sch_item.h>

Go to the source code of this file.

Classes

class  EE_COLLECTOR
 EE_COLLECTOR. More...
 

Functions

void CollectOtherUnits (SCH_SHEET_PATH &aSheet, SCH_COMPONENT *aUnit, std::vector< SCH_COMPONENT * > *otherUnits)
 

Function Documentation

◆ CollectOtherUnits()

void CollectOtherUnits ( SCH_SHEET_PATH aSheet,
SCH_COMPONENT aUnit,
std::vector< SCH_COMPONENT * > *  otherUnits 
)

Definition at line 187 of file ee_collectors.cpp.

189 {
190  // Obviously, one can collect other units only if aUnit is annotated.
191  if( aUnit->GetUnitCount() > 1 && aUnit->IsAnnotated( &aSheet ) )
192  {
193  const LIB_ID thisLibId = aUnit->GetLibId();
194  const wxString thisRef = aUnit->GetRef( &aSheet );
195  int thisUnit = aUnit->GetUnit();
196 
197  SCH_REFERENCE_LIST components;
198  aSheet.GetComponents( components );
199 
200  for( unsigned i = 0; i < components.GetCount(); i++ )
201  {
202  SCH_REFERENCE component = components[i];
203 
204  if( component.GetRef() == thisRef && component.GetUnit() != thisUnit )
205  otherUnits->push_back( component.GetComp() );
206  }
207  }
208 }
void GetComponents(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the sheet.
SCH_COMPONENT * GetComp() const
int GetUnitCount() const
Return the number of units per package of the symbol.
int GetUnit() const
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierarchy,...
wxString GetRef() const
int GetUnit() const
bool IsAnnotated(const SCH_SHEET_PATH *aSheet)
Checks if the component has a valid annotation (reference) for the given sheet path.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false)
Return the reference for the given sheet path.
unsigned GetCount() const
Function GetCount.
const LIB_ID & GetLibId() const
SCH_REFERENCE is used as a helper to define a component's reference designator in a schematic.

References SCH_REFERENCE::GetComp(), SCH_SHEET_PATH::GetComponents(), SCH_REFERENCE_LIST::GetCount(), SCH_COMPONENT::GetLibId(), SCH_REFERENCE::GetRef(), SCH_COMPONENT::GetRef(), SCH_REFERENCE::GetUnit(), SCH_COMPONENT::GetUnit(), SCH_COMPONENT::GetUnitCount(), and SCH_COMPONENT::IsAnnotated().

Referenced by DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_SCH_EDIT_ONE_FIELD::UpdateField().