177 static const wxString
empty;
202 if( aIncludeUnit &&
GetSymbol()->GetUnitCount() > 1 )
276 bool GetSymbolDNP(
const wxString& aVariant = wxEmptyString )
const;
282 void SetSymbolDNP(
bool aEnable,
const wxString& aVariant = wxEmptyString );
398 for(
unsigned ii = 0; ii <
GetCount(); ii++ )
437 for(
unsigned ii = 0; ii <
GetCount(); ii++ )
452 for(
unsigned ii = 0; ii <
GetCount(); ii++ )
472 bool aStartAtCurrent,
528 void Annotate(
bool aUseSheetNum,
int aSheetIntervalId,
int aStartNumber,
530 bool aStartAtCurrent =
false,
const SCH_SHEET_LIST* aSharedSheets =
nullptr );
628 int FindRef(
const wxString& aRef )
const;
646 void GetRefsInUse(
int aIndex, std::vector<int>& aIdList,
int aMinRefId )
const;
667 const std::map<
const SCH_REFERENCE*, std::vector<SCH_REFERENCE>>& aDestinations = {},
673 void Show(
const char* aPrefix =
"" );
681 typedef std::vector<SCH_REFERENCE>::iterator
iterator;
752 int aStartNumber,
bool aResetAnnotation,
753 const std::function<
void(
SCH_REFERENCE& )>& aBeforeAnnotate = {} );
int compare(const LIB_ID &aLibId) const
Compare the contents of LIB_ID objects by performing a std::string comparison of the library nickname...
Define a library symbol object.
bool UnitsLocked() const
Check whether symbol units are interchangeable.
int GetUnitCount() const override
Class to efficiently track reference designators and provide next available designators.
These are loaded from Eeschema settings but then overwritten by the project settings.
Holds all the data relating to one schematic.
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
void SortByReferenceOnly()
Sort the list of references by reference.
SCH_REFERENCE * FindItem(const SCH_REFERENCE &aItem)
SCH_MULTI_UNIT_REFERENCE_MAP LockedForRepresentatives(const SCH_MULTI_UNIT_REFERENCE_MAP &aLocked) const
Move locked multi-unit groups onto the representatives in this list.
SCH_REFERENCE & GetItem(size_t aIdx)
void ReannotateByOptions(ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption, int aStartNumber, const SCH_REFERENCE_LIST &aAdditionalRefs, bool aStartAtCurrent, SCH_SHEET_LIST *aHierarchy)
Forces reannotation of the provided references.
static bool sortByRefAndValue(const SCH_REFERENCE &item1, const SCH_REFERENCE &item2)
static bool sortBySymbolPtr(const SCH_REFERENCE &item1, const SCH_REFERENCE &item2)
void RenumberBasesUsedBy(const SCH_REFERENCE_LIST &aOthers, const SCH_MULTI_UNIT_REFERENCE_MAP &aLocked, const SCH_SHEET_LIST &aSheets)
Mark unsplit references for renumbering where their kept base would collide once suffix mode copies i...
bool Contains(const SCH_REFERENCE &aItem) const
Return true if aItem exists in this list.
void SortByYCoordinate()
Sort the list of references by Y position.
void SetRefDesTracker(std::shared_ptr< REFDES_TRACKER > aTracker)
const SCH_REFERENCE & operator[](int aIndex) const
void SortByTimeStamp()
Sort the flat list by Time Stamp (sheet path + timestamp).
iterator erase(iterator position)
std::vector< int > GetPackageUnits(const SCH_REFERENCE &aRef) const
Return the units a locked package needs free when aRef is numbered, which are the units of every memb...
static bool sortByTimeStamp(const SCH_REFERENCE &item1, const SCH_REFERENCE &item2)
void SortBySymbolPtr()
Sort the list by the symbol pointer.
void SortByXCoordinate()
Sort the list of references by X position.
static bool sortByXPosition(const SCH_REFERENCE &item1, const SCH_REFERENCE &item2)
void AnnotateByOptions(enum ANNOTATE_ORDER_T aSortOption, enum ANNOTATE_ALGO_T aAlgoOption, int aStartNumber, const SCH_MULTI_UNIT_REFERENCE_MAP &aLockedUnitMap, const SCH_REFERENCE_LIST &aAdditionalRefs, bool aStartAtCurrent, const SCH_SHEET_LIST *aSharedSheets=nullptr)
Annotate the references by the provided options.
void UseReusedSheetRepresentatives(const SCH_SHEET_LIST &aSheets)
Replace the references of each reused sheet symbol with one reference on the first instance of its sh...
friend class BACK_ANNOTATION
void SplitReferences()
Attempt to split all reference designators into a name (U) and number (1).
std::shared_ptr< REFDES_TRACKER > m_refDesTracker
A list of previously used reference designators.
void SortByRefAndValue()
Sort the list of references by value.
friend class BACK_ANNOTATE
std::vector< SCH_REFERENCE > m_flatList
iterator erase(iterator first, iterator last)
static bool sortByReferenceOnly(const SCH_REFERENCE &item1, const SCH_REFERENCE &item2)
std::vector< SCH_REFERENCE >::iterator iterator
void GetRefsInUse(int aIndex, std::vector< int > &aIdList, int aMinRefId) const
Add all the reference designator numbers greater than aMinRefId to aIdList skipping the reference at ...
void Annotate(bool aUseSheetNum, int aSheetIntervalId, int aStartNumber, const SCH_MULTI_UNIT_REFERENCE_MAP &aLockedUnitMap, const SCH_REFERENCE_LIST &aAdditionalRefs, bool aStartAtCurrent=false, const SCH_SHEET_LIST *aSharedSheets=nullptr)
Set the reference designators in the list that have not been annotated.
int FindRef(const wxString &aRef) const
Search the list for a symbol with a given reference, as shown with its sheet suffix.
const SCH_REFERENCE & GetItem(size_t aIdx) const
int FindFirstUnusedReference(const SCH_REFERENCE &aRef, int aMinValue, const std::vector< int > &aRequiredUnits, const std::map< const SCH_REFERENCE *, std::vector< SCH_REFERENCE > > &aDestinations={}, const SCH_REFERENCE_LIST *aLocked=nullptr) const
Return the first unused reference number from the properties given in aRef, ensuring all of the units...
int FindRefByFullPath(const wxString &aFullPath) const
Search the list for a symbol with the given KIID path (as string).
std::vector< SCH_REFERENCE >::const_iterator const_iterator
std::shared_ptr< REFDES_TRACKER > GetRefDesTracker() const
void RemoveAnnotation()
Treat all symbols in this list as non-annotated.
const_iterator end() const
std::vector< SCH_SYMBOL_INSTANCE > GetSymbolInstances() const
void AddItem(const SCH_REFERENCE &aItem)
void RemoveItem(unsigned int aIndex)
Remove an item from the list of references.
void ReannotateDuplicates(const SCH_REFERENCE_LIST &aAdditionalReferences, ANNOTATE_ALGO_T aAlgoOption)
Convenience function for the Paste Unique functionality.
static bool sortByYPosition(const SCH_REFERENCE &item1, const SCH_REFERENCE &item2)
const_iterator begin() const
SCH_REFERENCE & operator[](int aIndex)
void UpdateAnnotation()
Update the symbol references for the schematic project (or the current sheet).
int CheckAnnotation(ANNOTATION_ERROR_HANDLER aErrorHandler)
Check for annotations errors.
A helper to define a symbol's reference designator in a schematic.
void SetSymbolExcludedFromBoard(bool aEnable)
const SCH_SHEET_PATH & GetSheetPath() const
void SetSymbolExcludedFromBOM(bool aEnable, const wxString &aVariant=wxEmptyString)
wxString GetComposedRef() const
Return the reference as shown on this sheet path, with its sheet suffix.
SCH_SYMBOL * m_rootSymbol
The symbol associated the reference object.
int m_unit
The unit number for symbol with multiple parts per package.
SCH_SHEET_PATH m_sheetPath
The sheet path for this reference.
wxString GetCanonicalRef(bool aIncludeUnit) const
Return reference name in canonical format, optionally with unit.
wxString m_footprint
The footprint assigned.
const wxString & GetRefSuffix() const
Return the sheet suffix this reference composes with, or empty while it is unannotated.
wxString formatRefStr(int aNumber) const
wxString GetFullRef() const
Return reference name with unit and sheet suffix altogether, as in U12A_M4.
void SetValue(const wxString &aValue)
int CompareRef(const SCH_REFERENCE &item) const
wxString m_refSuffix
The suffix the board reference composes with.
void SetRef(const wxString &aReference)
const wxString GetFootprint() const
friend class SCH_REFERENCE_LIST
const wxString GetFullPath() const
bool AlwaysAnnotate() const
Verify the reference should always be automatically annotated.
wxString m_numRefStr
The numeric part in original string form (may have leading zeroes).
SCH_SHEET_PATH & GetSheetPath()
bool m_isNew
True if not yet annotated.
bool GetSymbolExcludedFromBOM(const wxString &aVariant=wxEmptyString) const
bool operator<(const SCH_REFERENCE &aRef) const
Compare by full path to make std::set work.
bool GetSymbolDNP(const wxString &aVariant=wxEmptyString) const
void Split()
Attempt to split the reference designator into a name (U) and number (1).
SCH_SYMBOL * GetSymbol() const
bool GetSymbolExcludedFromPosFiles(const wxString &aVariant=wxEmptyString) const
void SetFootprint(const wxString &aFP)
wxString m_ref
Symbol reference prefix, without number (for IC1, this is IC) )
void SetSymbolExcludedFromSim(bool aEnable, const wxString &aVariant=wxEmptyString)
int m_sheetNum
The sheet number for the reference.
void SetRefStr(const std::string &aReference)
bool IsSplitNeeded() const
Determine if this reference needs to be split or if it likely already has been.
int m_numRef
The numeric part of the reference designator.
bool GetSymbolExcludedFromBoard() const
LIB_SYMBOL * GetLibPart() const
const wxString GetValue() const
void SetSheetNumber(int aSheetNumber)
const char * GetRefStr() const
bool IsSameInstance(const SCH_REFERENCE &other) const
Return whether this reference refers to the same symbol instance (symbol and sheet) as another.
int CompareLibId(const SCH_REFERENCE &item) const
KIID m_symbolUuid
UUID of the symbol.
bool GetSymbolExcludedFromSim(const wxString &aVariant=wxEmptyString) const
void SetSymbolExcludedFromPosFiles(bool aEnable, const wxString &aVariant=wxEmptyString)
wxString m_value
The symbol value.
VECTOR2I m_symbolPos
The physical position of the symbol in schematic used to annotate by X or Y position.
const wxString GetPath() const
wxString GetRefNumber() const
int CompareValue(const SCH_REFERENCE &item) const
void Annotate()
Update the annotation of the symbol according the current object state.
void SetSymbolDNP(bool aEnable, const wxString &aVariant=wxEmptyString)
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
wxString SubReference(int aUnit, bool aAddSeparator=true) const
const LIB_ID & GetLibId() const override
static bool empty(const wxTextEntryBase *aCtrl)
This file contains miscellaneous commonly used macros and functions.
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.
ANNOTATE_ORDER_T
Schematic annotation order options.
@ UNSORTED
Annotate by position of symbol in the schematic sheet object list.
@ SORT_BY_X_POSITION
Annotate by X position from left to right.
@ SORT_BY_Y_POSITION
Annotate by Y position from top to bottom.
ANNOTATE_SCOPE_T
Schematic annotation scope options.
@ ANNOTATE_SELECTION
Annotate the selection.
@ ANNOTATE_CURRENT_SHEET
Annotate the current sheet.
@ ANNOTATE_ALL
Annotate the full schematic.
ANNOTATE_ALGO_T
Schematic annotation type options.
@ SHEET_NUMBER_X_1000
Annotate using the first free reference number starting at the sheet number * 1000.
@ INCREMENTAL_BY_REF
Annotate incrementally using the first free reference number.
@ SHEET_NUMBER_X_100
Annotate using the first free reference number starting at the sheet number * 100.
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 resul...
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.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::map< wxString, SCH_REFERENCE_LIST > SCH_MULTI_UNIT_REFERENCE_MAP
Container to map reference designators for multi-unit parts.
int StrNumCmp(const wxString &aString1, const wxString &aString2, CMP_T aCaseSensitivity)
Compare two strings with alphanumerical content.
VECTOR2< int32_t > VECTOR2I