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.




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

Function Documentation

◆ CollectOtherUnits()

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

Definition at line 189 of file ee_collectors.cpp.

191 {
192  // Obviously, one can collect other units only if aUnit is annotated.
193  if( aUnit->GetUnitCount() > 1 && aUnit->IsAnnotated( &aSheet ) )
194  {
195  const LIB_ID thisLibId = aUnit->GetLibId();
196  const wxString thisRef = aUnit->GetRef( &aSheet );
197  int thisUnit = aUnit->GetUnit();
199  SCH_REFERENCE_LIST components;
200  aSheet.GetComponents( components );
202  for( unsigned i = 0; i < components.GetCount(); i++ )
203  {
204  SCH_REFERENCE component = components[i];
206  if( component.GetRef() == thisRef && component.GetUnit() != thisUnit )
207  otherUnits->push_back( component.GetComp() );
208  }
209  }
210 }
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().