KiCad PCB EDA Suite
eeschema/annotate.cpp File Reference
#include <algorithm>
#include <fctsys.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <reporter.h>
#include <sch_edit_frame.h>
#include <sch_reference_list.h>
#include <class_library.h>

Go to the source code of this file.

Functions

void mapExistingAnnotation (std::map< wxString, wxString > &aMap)
 

Function Documentation

◆ mapExistingAnnotation()

void mapExistingAnnotation ( std::map< wxString, wxString > &  aMap)

Definition at line 36 of file eeschema/annotate.cpp.

37 {
38  SCH_SHEET_LIST sheets( g_RootSheet );
39  SCH_REFERENCE_LIST references;
40 
41  sheets.GetComponents( references );
42 
43  for( size_t i = 0; i < references.GetCount(); i++ )
44  {
45  SCH_COMPONENT* comp = references[ i ].GetComp();
46  SCH_SHEET_PATH* curr_sheetpath = &references[ i ].GetSheetPath();
47  KIID_PATH curr_full_uuid = curr_sheetpath->Path();
48  curr_full_uuid.push_back( comp->m_Uuid );
49 
50  wxString ref = comp->GetRef( curr_sheetpath );
51 
52  if( comp->GetUnitCount() > 1 )
53  ref << LIB_PART::SubReference( comp->GetUnitSelection( curr_sheetpath ) );
54 
55  if( comp->IsAnnotated( curr_sheetpath ) )
56  aMap[ curr_full_uuid.AsString() ] = ref;
57  }
58 }
SCH_SHEET_LIST.
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
int GetUnitCount() const
Return the number of units per package of the symbol.
SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierarchy,...
bool IsAnnotated(const SCH_SHEET_PATH *aSheet)
Checks if the component has a valid annotation (reference) for the given sheet path.
SCH_SHEET_PATH.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false)
Return the reference for the given sheet path.
const KIID m_Uuid
Definition: base_struct.h:169
wxString AsString() const
Definition: common.h:123
static wxString SubReference(int aUnit, bool aAddSeparator=true)
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:99
SCH_SHEET * g_RootSheet
unsigned GetCount()
Function GetCount.
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const

References KIID_PATH::AsString(), g_RootSheet, SCH_SHEET_LIST::GetComponents(), SCH_REFERENCE_LIST::GetCount(), SCH_COMPONENT::GetRef(), SCH_COMPONENT::GetUnitCount(), SCH_COMPONENT::GetUnitSelection(), SCH_COMPONENT::IsAnnotated(), EDA_ITEM::m_Uuid, SCH_SHEET_PATH::Path(), and LIB_PART::SubReference().

Referenced by SCH_EDIT_FRAME::AnnotateComponents().