KiCad PCB EDA Suite
annotate.cpp File Reference
#include <algorithm>
#include <confirm.h>
#include <reporter.h>
#include <sch_edit_frame.h>
#include <schematic.h>
#include <erc_settings.h>
#include <sch_reference_list.h>
#include <symbol_library.h>
#include <tools/ee_selection.h>
#include <tools/ee_selection_tool.h>
#include <tool/tool_manager.h>
#include <dialog_erc.h>

Go to the source code of this file.

Functions

std::unordered_set< SCH_SYMBOL * > getInferredSymbols (const EE_SELECTION &aSelection)
 

Function Documentation

◆ getInferredSymbols()

std::unordered_set< SCH_SYMBOL * > getInferredSymbols ( const EE_SELECTION aSelection)

Definition at line 163 of file annotate.cpp.

164{
165 std::unordered_set<SCH_SYMBOL*> symbols;
166
167 for( EDA_ITEM* item : aSelection )
168 {
169 switch( item->Type() )
170 {
171 case SCH_FIELD_T:
172 {
173 SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
174
175 if( field->GetId() == REFERENCE_FIELD && field->GetParent()->Type() == SCH_SYMBOL_T )
176 symbols.insert( static_cast<SCH_SYMBOL*>( field->GetParent() ) );
177
178 break;
179 }
180
181 case SCH_SYMBOL_T:
182 symbols.insert( static_cast<SCH_SYMBOL*>( item ) );
183 break;
184
185 default:
186 break;
187 }
188 }
189
190 return symbols;
191}
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
int GetId() const
Definition: sch_field.h:125
Schematic symbol object.
Definition: sch_symbol.h:81
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
@ SCH_SYMBOL_T
Definition: typeinfo.h:156
@ SCH_FIELD_T
Definition: typeinfo.h:155

References SCH_FIELD::GetId(), EDA_ITEM::GetParent(), REFERENCE_FIELD, SCH_FIELD_T, SCH_SYMBOL_T, and EDA_ITEM::Type().

Referenced by SCH_EDIT_FRAME::AnnotateSymbols(), and SCH_EDIT_FRAME::CheckAnnotate().