|
KiCad PCB EDA Suite
|
#include <functional>#include <map>#include <optional>#include <set>#include <utility>#include <lib_symbol.h>#include <macros.h>#include <sch_sheet_path.h>#include <sch_symbol.h>#include <sch_text.h>#include <erc/erc_settings.h>Go to the source code of this file.
Classes | |
| class | SCH_REFERENCE |
| A helper to define a symbol's reference designator in a schematic. More... | |
| class | SCH_REFERENCE_LIST |
| Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used more than once and its reference designator is dependent on the sheet path for the same symbol. More... | |
Typedefs | |
| typedef std::function< void(ERCE_T aType, const wxString &aMsg, SCH_REFERENCE *aItemA, SCH_REFERENCE *aItemB)> | ANNOTATION_ERROR_HANDLER |
| Define a standard error handler for annotation errors. | |
Enumerations | |
| enum | ANNOTATE_SCOPE_T { ANNOTATE_ALL , ANNOTATE_CURRENT_SHEET , ANNOTATE_SELECTION } |
| Schematic annotation scope options. More... | |
| enum | ANNOTATE_ORDER_T { SORT_BY_X_POSITION , SORT_BY_Y_POSITION , UNSORTED } |
| Schematic annotation order options. More... | |
| enum | ANNOTATE_ALGO_T { INCREMENTAL_BY_REF , SHEET_NUMBER_X_100 , SHEET_NUMBER_X_1000 } |
| Schematic annotation type options. More... | |
Functions | |
| void | AnnotateNewSymbol (SCH_SYMBOL *aSymbol, const std::vector< SCH_SHEET_PATH > &aPaths, SCH_REFERENCE_LIST &aExistingRefs, const SCHEMATIC_SETTINGS &aSettings, SCH_SHEET_LIST *aHierarchy) |
| Annotate a newly placed symbol on each of aPaths in turn, avoiding aExistingRefs and adding the results to it. | |
| std::optional< std::pair< SCH_SHEET_PATH, SCH_SHEET_PATH > > | FindRefSuffixCollision (const SCH_REFERENCE_LIST &aRefs, const SCHEMATIC &aSchematic) |
| Find two instances of a reused sheet that aRefs reaches and that compose the same reference suffix. | |
| std::set< const SCH_SCREEN * > | AnnotateReferences (SCH_REFERENCE_LIST &aRefs, SCH_MULTI_UNIT_REFERENCE_MAP aLocked, const SCHEMATIC &aSchematic, ANNOTATE_SCOPE_T aScope, ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption, int aStartNumber, bool aResetAnnotation, const std::function< void(SCH_REFERENCE &)> &aBeforeAnnotate={}) |
| Annotate aRefs, the references in aScope, around every other symbol of aSchematic. | |
| typedef std::function<void( ERCE_T aType, const wxString& aMsg, SCH_REFERENCE* aItemA, SCH_REFERENCE* aItemB )> ANNOTATION_ERROR_HANDLER |
Define a standard error handler for annotation errors.
Definition at line 325 of file sch_reference_list.h.
| enum ANNOTATE_ALGO_T |
Schematic annotation type options.
Definition at line 60 of file sch_reference_list.h.
| enum ANNOTATE_ORDER_T |
Schematic annotation order options.
| Enumerator | |
|---|---|
| SORT_BY_X_POSITION | Annotate by X position from left to right. |
| SORT_BY_Y_POSITION | Annotate by Y position from top to bottom. |
| UNSORTED | Annotate by position of symbol in the schematic sheet object list. |
Definition at line 50 of file sch_reference_list.h.
| enum ANNOTATE_SCOPE_T |
Schematic annotation scope options.
| Enumerator | |
|---|---|
| ANNOTATE_ALL | Annotate the full schematic. |
| ANNOTATE_CURRENT_SHEET | Annotate the current sheet. |
| ANNOTATE_SELECTION | Annotate the selection. |
Definition at line 42 of file sch_reference_list.h.
| void AnnotateNewSymbol | ( | SCH_SYMBOL * | aSymbol, |
| const std::vector< SCH_SHEET_PATH > & | aPaths, | ||
| SCH_REFERENCE_LIST & | aExistingRefs, | ||
| const SCHEMATIC_SETTINGS & | aSettings, | ||
| SCH_SHEET_LIST * | aHierarchy ) |
Annotate a newly placed symbol on each of aPaths in turn, avoiding aExistingRefs and adding the results to it.
In suffix annotation mode the first path picks the base and the others share it.
Definition at line 1419 of file sch_reference_list.cpp.
References SCH_REFERENCE_LIST::AddItem(), SCH_REFERENCE_LIST::begin(), SCH_REFERENCE::CompareLibId(), SCH_REFERENCE::CompareValue(), end, SCH_SYMBOL::GetBaseRef(), SCH_REFERENCE_LIST::GetCount(), SCH_REFERENCE::GetUnit(), SCHEMATIC_SETTINGS::m_AnnotateMethod, SCHEMATIC_SETTINGS::m_AnnotateReusedSheetSuffixes, SCHEMATIC_SETTINGS::m_AnnotateSortOrder, SCHEMATIC_SETTINGS::m_AnnotateStartNum, SCHEMATIC_SETTINGS::m_refDesTracker, path, SCH_REFERENCE_LIST::ReannotateByOptions(), SCH_REFERENCE_LIST::SCH_REFERENCE_LIST(), SCH_SYMBOL::SetRef(), SCH_REFERENCE_LIST::SetRefDesTracker(), SCH_REFERENCE::SetUnit(), and SCH_REFERENCE_LIST::UpdateAnnotation().
Referenced by REF_SUFFIX_FIXTURE::AnnotatePlaced(), API_HANDLER_SCH::handlePlaceSymbolFromLibrary(), and SCH_DRAWING_TOOLS::PlaceSymbol().
| std::set< const SCH_SCREEN * > AnnotateReferences | ( | SCH_REFERENCE_LIST & | aRefs, |
| SCH_MULTI_UNIT_REFERENCE_MAP | aLocked, | ||
| const SCHEMATIC & | aSchematic, | ||
| ANNOTATE_SCOPE_T | aScope, | ||
| ANNOTATE_ORDER_T | aSortOption, | ||
| ANNOTATE_ALGO_T | aAlgoOption, | ||
| int | aStartNumber, | ||
| bool | aResetAnnotation, | ||
| const std::function< void(SCH_REFERENCE &)> & | aBeforeAnnotate = {} ) |
Annotate aRefs, the references in aScope, around every other symbol of aSchematic.
In suffix annotation mode each symbol of a reused sheet annotates on its first instance and every other instance takes that base. Check FindRefSuffixCollision() first, since instances that compose alike cannot share a base.
| aLocked | the multi-unit groups in scope that stay together, or none to regroup units. |
| aResetAnnotation | renumber every reference instead of only the unannotated ones. |
| aBeforeAnnotate | called with each reference before its symbol changes. |
Definition at line 1561 of file sch_reference_list.cpp.
References SCH_REFERENCE_LIST::AddItem(), ANNOTATE_ALL, SCH_REFERENCE_LIST::AnnotateByOptions(), SCH_REFERENCE_LIST::Contains(), SCHEMATIC::CopiesSelectDifferentUnits(), SCH_SHEET_LIST::GetSymbols(), SCHEMATIC::Hierarchy(), SCH_REFERENCE_LIST::LockedForRepresentatives(), SCHEMATIC_SETTINGS::m_AnnotateReusedSheetSuffixes, SCHEMATIC_SETTINGS::m_refDesTracker, SCH_REFERENCE_LIST::RemoveAnnotation(), removeUnitConflicts(), SCH_REFERENCE_LIST::RenumberBasesUsedBy(), SCH_REFERENCE_LIST::SetRefDesTracker(), SCHEMATIC::Settings(), SCH_SHEET_LIST::ShareReusedSheetRef(), SCH_REFERENCE_LIST::SplitReferences(), SCHEMATIC::SplitUnitSymbols(), SYMBOL_FILTER_NON_POWER, and SCH_REFERENCE_LIST::UseReusedSheetRepresentatives().
Referenced by REF_SUFFIX_FIXTURE::Annotate(), SCH_EDIT_FRAME::AnnotateSymbols(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| std::optional< std::pair< SCH_SHEET_PATH, SCH_SHEET_PATH > > FindRefSuffixCollision | ( | const SCH_REFERENCE_LIST & | aRefs, |
| const SCHEMATIC & | aSchematic ) |
Find two instances of a reused sheet that aRefs reaches and that compose the same reference suffix.
Suffix annotation mode gives every instance one base, so only their suffixes keep their references apart.
Definition at line 1522 of file sch_reference_list.cpp.
References SCHEMATIC_SETTINGS::m_AnnotateReusedSheetSuffixes, SCHEMATIC::RefSuffixCollisions(), and SCHEMATIC::Settings().
Referenced by REF_SUFFIX_FIXTURE::Annotate(), and SCH_EDIT_FRAME::AnnotateSymbols().