26#ifndef _SCH_REFERENCE_LIST_H_ 
   27#define _SCH_REFERENCE_LIST_H_ 
  174        if( refNum.IsEmpty() )
 
  177        if( aIncludeUnit && 
GetSymbol()->GetUnitCount() > 1 )
 
 
  203        return m_rootSymbol->GetLibId().GetLibItemName().compare(
 
 
 
  335        for( 
unsigned ii = 0; ii < 
GetCount(); ii++ )
 
 
  347        for( 
unsigned ii = 0; ii < 
GetCount(); ii++ )
 
 
  362        for( 
unsigned ii = 0; ii < 
GetCount(); ii++ )
 
 
  384                              bool                         aStartAtCurrent,
 
  419                            bool                                    aStartAtCurrent );
 
  442    void Annotate( 
bool aUseSheetNum, 
int aSheetIntervalId, 
int aStartNumber,
 
  445                   bool aStartAtCurrent = 
false );
 
  543    int FindRef( 
const wxString& aPath ) 
const;
 
  561    void GetRefsInUse( 
int aIndex, std::vector<int>& aIdList, 
int aMinRefId ) 
const;
 
  580                                  const std::vector<int>& aRequiredUnits ) 
const;
 
  585    void Show( 
const char* aPrefix = 
"" );
 
  593    static wxString 
Shorthand( std::vector<SCH_REFERENCE> aList, 
const wxString& refDelimiter,
 
  594                               const wxString& refRangeDelimiter );
 
  608    typedef std::vector<SCH_REFERENCE>::iterator       
iterator;
 
 
const UTF8 & GetLibItemName() const
 
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.
 
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 & 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)
 
bool Contains(const SCH_REFERENCE &aItem) const
Return true if aItem exists in this list.
 
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)
Annotate the references by the provided options.
 
void Annotate(bool aUseSheetNum, int aSheetIntervalId, int aStartNumber, const SCH_MULTI_UNIT_REFERENCE_MAP &aLockedUnitMap, const SCH_REFERENCE_LIST &aAdditionalRefs, bool aStartAtCurrent=false)
Set the reference designators in the list that have not been annotated.
 
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)
 
static bool sortByTimeStamp(const SCH_REFERENCE &item1, const SCH_REFERENCE &item2)
 
int FindRef(const wxString &aPath) const
Search the list for a symbol with a given reference.
 
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)
 
friend class BACK_ANNOTATION
 
int FindFirstUnusedReference(const SCH_REFERENCE &aRef, int aMinValue, const std::vector< int > &aRequiredUnits) const
Return the first unused reference number from the properties given in aRef, ensuring all of the units...
 
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< int > GetUnitsMatchingRef(const SCH_REFERENCE &aRef) const
Return all the unit numbers for a given reference, comparing library reference, value,...
 
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 ...
 
const SCH_REFERENCE & GetItem(size_t aIdx) const
 
static wxString Shorthand(std::vector< SCH_REFERENCE > aList, const wxString &refDelimiter, const wxString &refRangeDelimiter)
Return a shorthand string representing all the references in the list.
 
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.
 
const SCH_SHEET_PATH & GetSheetPath() const
 
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 m_footprint
The footprint assigned.
 
wxString formatRefStr(int aNumber) const
 
int CompareLibName(const SCH_REFERENCE &item) const
 
void SetValue(const wxString &aValue)
 
int CompareRef(const SCH_REFERENCE &item) const
 
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 operator<(const SCH_REFERENCE &aRef) const
Compare by full path to make std::set work.
 
void Split()
Attempt to split the reference designator into a name (U) and number (1).
 
bool IsSplitNeeded()
Determine if this reference needs to be split or if it likely already has been.
 
SCH_SYMBOL * GetSymbol() const
 
void SetFootprint(const wxString &aFP)
 
wxString m_ref
Symbol reference prefix, without number (for IC1, this is IC) )
 
int m_sheetNum
The sheet number for the reference.
 
void SetRefStr(const std::string &aReference)
 
int m_numRef
The numeric part of the reference designator.
 
LIB_SYMBOL * GetLibPart() const
 
wxString GetFullRef(bool aIncludeUnit=true) const
Return reference name with unit altogether.
 
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.
 
KIID m_symbolUuid
UUID of the symbol.
 
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.
 
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
 
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.
 
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.
 
VECTOR2< int32_t > VECTOR2I