KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_reference_list.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 1992-2011 jean-pierre Charras <[email protected]>
5 * Copyright (C) 2011 Wayne Stambaugh <[email protected]>
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include <functional>
25#include <map>
26#include <optional>
27#include <set>
28#include <utility>
29
30#include <lib_symbol.h>
31#include <macros.h>
32#include <sch_sheet_path.h>
33#include <sch_symbol.h>
34#include <sch_text.h>
35#include <erc/erc_settings.h>
36
37class REFDES_TRACKER;
38class SCHEMATIC;
40
48
57
58
68
69
78{
79public:
82 {
83 m_rootSymbol = nullptr;
84 m_unit = 0;
85 m_isNew = false;
86 m_numRef = 0;
87 m_flag = 0;
88 m_sheetNum = 0;
89 }
90
91 SCH_REFERENCE( SCH_SYMBOL* aSymbol, const SCH_SHEET_PATH& aSheetPath );
92
93 SCH_SYMBOL* GetSymbol() const { return m_rootSymbol; }
94
95 LIB_SYMBOL* GetLibPart() const { return m_rootSymbol->GetLibSymbolRef().get(); }
96
97 const SCH_SHEET_PATH& GetSheetPath() const { return m_sheetPath; }
98
100
101 int GetUnit() const { return m_unit; }
102 void SetUnit( int aUnit ) { m_unit = aUnit; }
103 bool IsMultiUnit() const { return GetLibPart()->GetUnitCount() > 1; }
104
105 const wxString GetValue() const { return m_value; }
106 void SetValue( const wxString& aValue ) { m_value = aValue; }
107
108 const wxString GetFootprint() const { return m_footprint; }
109 void SetFootprint( const wxString& aFP ) { m_footprint = aFP; }
110
111 void SetSheetNumber( int aSheetNumber ) { m_sheetNum = aSheetNumber; }
112
116 const wxString GetPath() const
117 {
118 return m_sheetPath.PathAsString();
119 }
120
124 const wxString GetFullPath() const
125 {
126 return m_sheetPath.PathAsString() + m_symbolUuid.AsString();
127 }
128
132 bool operator<( const SCH_REFERENCE& aRef ) const { return GetFullPath() < aRef.GetFullPath(); }
133
137 void Annotate();
138
145 bool AlwaysAnnotate() const;
146
154 void Split();
155
161 bool IsSplitNeeded() const;
162 bool IsSplit() const { return !IsSplitNeeded(); }
163
164 void SetRef( const wxString& aReference ) { m_ref = aReference; }
165 wxString GetRef() const { return m_ref; }
166
168 wxString GetComposedRef() const { return m_rootSymbol->GetRef( &m_sheetPath ); }
169
175 const wxString& GetRefSuffix() const
176 {
177 static const wxString empty;
178
179 return hasRef() ? m_refSuffix : empty;
180 }
181
182 void SetRefStr( const std::string& aReference ) { m_ref = aReference; }
183 const char* GetRefStr() const { return m_ref.c_str(); }
184
186 wxString GetFullRef() const;
187
190 wxString GetCanonicalRef( bool aIncludeUnit ) const
191 {
192 wxString ref = GetRef();
193
194 if( IsSplit() )
195 {
196 if( m_numRef >= 0 )
197 ref << m_numRef;
198 else
199 ref += m_numRefStr;
200 }
201
202 if( aIncludeUnit && GetSymbol()->GetUnitCount() > 1 )
203 ref += GetSymbol()->SubReference( GetUnit() );
204
205 return ref;
206 }
207
208 wxString GetRefNumber() const
209 {
210 if( m_numRef < 0 )
211 return wxT( "?" );
212 else
213 return m_numRefStr;
214 }
215
216 int CompareValue( const SCH_REFERENCE& item ) const
217 {
218 // Sort based on natural sort, but don't consider naturally-equivalent values
219 // to be equal. Run them through a second, non-natural compare.
220
221 // Values are compared with case sensitivity
222 int natural = StrNumCmp( m_value, item.m_value, CMP_T::CASE_SENSITIVE );
223
224 if( natural != 0 )
225 return natural;
226
227 return m_value.Cmp( item.m_value );
228 }
229
230 int CompareRef( const SCH_REFERENCE& item ) const
231 {
232 // Sort based on natural sort, but don't consider naturally-equivalent values
233 // to be equal. Run them through a second, non-natural compare.
234
235 // References are compared ignoring case
236 int natural = StrNumCmp( m_ref, item.m_ref, CMP_T::IGNORE_CASE );
237
238 if( natural != 0 )
239 return natural;
240
241 return m_ref.Cmp( item.m_ref );
242 }
243
244 int CompareLibId( const SCH_REFERENCE& item ) const
245 {
246 return GetSymbol()->GetLibId().compare( item.GetSymbol()->GetLibId() );
247 }
248
253 bool IsSameInstance( const SCH_REFERENCE& other ) const
254 {
255 // Only compare symbol and path.
256 // We may have changed the unit number or the designator but
257 // can still be referencing the same instance.
258 return GetSymbol() == other.GetSymbol()
259 && GetSheetPath().Path() == other.GetSheetPath().Path();
260 }
261
263 {
264 if( GetLibPart() )
265 return GetLibPart()->UnitsLocked();
266 else
267 return true; // Assume units locked when we don't have a library
268 }
269
270 void SetRefNum( int aNum )
271 {
272 m_numRef = aNum;
273 m_numRefStr = formatRefStr( aNum );
274 }
275
276 bool GetSymbolDNP( const wxString& aVariant = wxEmptyString ) const;
277 bool GetSymbolExcludedFromBOM( const wxString& aVariant = wxEmptyString ) const;
278 bool GetSymbolExcludedFromSim( const wxString& aVariant = wxEmptyString ) const;
279 bool GetSymbolExcludedFromBoard() const;
280 bool GetSymbolExcludedFromPosFiles( const wxString& aVariant = wxEmptyString ) const;
281
282 void SetSymbolDNP( bool aEnable, const wxString& aVariant = wxEmptyString );
283 void SetSymbolExcludedFromBOM( bool aEnable, const wxString& aVariant = wxEmptyString );
284 void SetSymbolExcludedFromSim( bool aEnable, const wxString& aVariant = wxEmptyString );
285 void SetSymbolExcludedFromBoard( bool aEnable );
286 void SetSymbolExcludedFromPosFiles( bool aEnable, const wxString& aVariant = wxEmptyString );
287
288private:
289 wxString formatRefStr( int aNumber ) const;
290
291 bool hasRef() const
292 {
293 // Split() drops the '?' of R1? and keeps R1, so the new flag is the only trace of it
294 return !m_isNew && ( IsSplit() ? m_numRef >= 0 : m_ref.IsEmpty() || m_ref.Last() != '?' );
295 }
296
297private:
298 friend class SCH_REFERENCE_LIST;
299
301 wxString m_ref; // it's private, use the accessors please
302 wxString m_refSuffix;
306 int m_unit;
308 wxString m_value;
309 wxString m_footprint;
311 bool m_isNew;
315 wxString m_numRefStr;
318};
319
320
324typedef std::function<void( ERCE_T aType, const wxString& aMsg, SCH_REFERENCE* aItemA,
326
327
336{
337public:
340
342 {
343 return m_flatList[ aIndex ];
344 }
345
346 const SCH_REFERENCE& operator[]( int aIndex ) const
347 {
348 return m_flatList[ aIndex ];
349 }
350
351 void Clear()
352 {
353 m_flatList.clear();
354 }
355
356 size_t GetCount() const { return m_flatList.size(); }
357
358 SCH_REFERENCE& GetItem( size_t aIdx ) { return m_flatList[aIdx]; }
359 const SCH_REFERENCE& GetItem( size_t aIdx ) const { return m_flatList[aIdx]; }
360
361 SCH_REFERENCE* FindItem( const SCH_REFERENCE& aItem );
362
363 void AddItem( const SCH_REFERENCE& aItem ) { m_flatList.push_back( aItem ); }
364
370 void RemoveItem( unsigned int aIndex );
371
378 bool Contains( const SCH_REFERENCE& aItem ) const;
379
380 /* Sort functions:
381 * Sort functions are used to sort symbols for annotation or BOM generation. Because
382 * sorting depends on what we want to do, there are many sort functions.
383 * Note:
384 * When creating BOM, symbols are fully annotated. References are something like U3,
385 * U5 or R4, R8. When annotating, some or all symbols are not annotated, i.e. ref is
386 * only U or R, with no number.
387 */
388
397 {
398 for( unsigned ii = 0; ii < GetCount(); ii++ )
399 m_flatList[ii].Split();
400 }
401
406 void UseReusedSheetRepresentatives( const SCH_SHEET_LIST& aSheets );
407
415
426 void RenumberBasesUsedBy( const SCH_REFERENCE_LIST& aOthers, const SCH_MULTI_UNIT_REFERENCE_MAP& aLocked,
427 const SCH_SHEET_LIST& aSheets );
428
436 {
437 for( unsigned ii = 0; ii < GetCount(); ii++ )
438 m_flatList[ii].m_isNew = true;
439 }
440
450 {
451 /* update the reference numbers */
452 for( unsigned ii = 0; ii < GetCount(); ii++ )
453 m_flatList[ii].Annotate();
454 }
455
468 void ReannotateByOptions( ANNOTATE_ORDER_T aSortOption,
469 ANNOTATE_ALGO_T aAlgoOption,
470 int aStartNumber,
471 const SCH_REFERENCE_LIST& aAdditionalRefs,
472 bool aStartAtCurrent,
473 SCH_SHEET_LIST* aHierarchy );
474
485 void ReannotateDuplicates( const SCH_REFERENCE_LIST& aAdditionalReferences, ANNOTATE_ALGO_T aAlgoOption );
486
501 void AnnotateByOptions( enum ANNOTATE_ORDER_T aSortOption, enum ANNOTATE_ALGO_T aAlgoOption, int aStartNumber,
502 const SCH_MULTI_UNIT_REFERENCE_MAP& aLockedUnitMap,
503 const SCH_REFERENCE_LIST& aAdditionalRefs, bool aStartAtCurrent,
504 const SCH_SHEET_LIST* aSharedSheets = nullptr );
505
528 void Annotate( bool aUseSheetNum, int aSheetIntervalId, int aStartNumber,
529 const SCH_MULTI_UNIT_REFERENCE_MAP& aLockedUnitMap, const SCH_REFERENCE_LIST& aAdditionalRefs,
530 bool aStartAtCurrent = false, const SCH_SHEET_LIST* aSharedSheets = nullptr );
531
544 int CheckAnnotation( ANNOTATION_ERROR_HANDLER aErrorHandler );
545
557 {
558 sort( m_flatList.begin(), m_flatList.end(), sortByXPosition );
559 }
560
572 {
573 sort( m_flatList.begin(), m_flatList.end(), sortByYPosition );
574 }
575
582 {
583 sort( m_flatList.begin(), m_flatList.end(), sortByTimeStamp );
584 }
585
598 {
599 sort( m_flatList.begin(), m_flatList.end(), sortByRefAndValue );
600 }
601
610 {
611 sort( m_flatList.begin(), m_flatList.end(), sortByReferenceOnly );
612 }
613
621 {
622 sort( m_flatList.begin(), m_flatList.end(), sortBySymbolPtr );
623 }
624
628 int FindRef( const wxString& aRef ) const;
629
636 int FindRefByFullPath( const wxString& aFullPath ) const;
637
646 void GetRefsInUse( int aIndex, std::vector<int>& aIdList, int aMinRefId ) const;
647
654 std::vector<int> GetPackageUnits( const SCH_REFERENCE& aRef ) const;
655
666 int FindFirstUnusedReference( const SCH_REFERENCE& aRef, int aMinValue, const std::vector<int>& aRequiredUnits,
667 const std::map<const SCH_REFERENCE*, std::vector<SCH_REFERENCE>>& aDestinations = {},
668 const SCH_REFERENCE_LIST* aLocked = nullptr ) const;
669
670 std::vector<SCH_SYMBOL_INSTANCE> GetSymbolInstances() const;
671
672#if defined(DEBUG)
673 void Show( const char* aPrefix = "" );
674#endif
675
676 std::shared_ptr<REFDES_TRACKER> GetRefDesTracker() const { return m_refDesTracker; }
677 void SetRefDesTracker( std::shared_ptr<REFDES_TRACKER> aTracker ) { m_refDesTracker = aTracker; }
678
679 friend class BACK_ANNOTATION;
680
681 typedef std::vector<SCH_REFERENCE>::iterator iterator;
682 typedef std::vector<SCH_REFERENCE>::const_iterator const_iterator;
683
684 iterator begin() { return m_flatList.begin(); }
685
686 iterator end() { return m_flatList.end(); }
687
688 const_iterator begin() const { return m_flatList.begin(); }
689
690 const_iterator end() const { return m_flatList.end(); }
691
692 iterator erase( iterator position ) { return m_flatList.erase( position ); }
693
694 iterator erase( iterator first, iterator last ) { return m_flatList.erase( first, last ); }
695
696private:
697 static bool sortByRefAndValue( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
698
699 static bool sortByXPosition( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
700
701 static bool sortByYPosition( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
702
703 static bool sortByTimeStamp( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
704
705 static bool sortByReferenceOnly( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
706
707 static bool sortBySymbolPtr( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
708
709 // Used for sorting static sortByTimeStamp function
710 friend class BACK_ANNOTATE;
711
712private:
713 std::vector<SCH_REFERENCE> m_flatList;
714 std::shared_ptr<REFDES_TRACKER> m_refDesTracker;
715};
716
717
722void AnnotateNewSymbol( SCH_SYMBOL* aSymbol, const std::vector<SCH_SHEET_PATH>& aPaths,
723 SCH_REFERENCE_LIST& aExistingRefs, const SCHEMATIC_SETTINGS& aSettings,
724 SCH_SHEET_LIST* aHierarchy );
725
726
734std::optional<std::pair<SCH_SHEET_PATH, SCH_SHEET_PATH>> FindRefSuffixCollision( const SCH_REFERENCE_LIST& aRefs,
735 const SCHEMATIC& aSchematic );
736
749std::set<const SCH_SCREEN*> AnnotateReferences( SCH_REFERENCE_LIST& aRefs, SCH_MULTI_UNIT_REFERENCE_MAP aLocked,
750 const SCHEMATIC& aSchematic, ANNOTATE_SCOPE_T aScope,
751 ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption,
752 int aStartNumber, bool aResetAnnotation,
753 const std::function<void( SCH_REFERENCE& )>& aBeforeAnnotate = {} );
Definition kiid.h:46
int compare(const LIB_ID &aLibId) const
Compare the contents of LIB_ID objects by performing a std::string comparison of the library nickname...
Definition lib_id.cpp:174
Define a library symbol object.
Definition lib_symbol.h:114
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.
Definition schematic.h:155
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...
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.
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.
void SetUnit(int aUnit)
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 SetRefNum(int aNum)
void SetSymbolExcludedFromSim(bool aEnable, const wxString &aVariant=wxEmptyString)
wxString GetRef() const
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)
bool IsMultiUnit() const
bool hasRef() const
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)
bool IsSplit() const
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.
Schematic symbol object.
Definition sch_symbol.h:76
wxString SubReference(int aUnit, bool aAddSeparator=true) const
const LIB_ID & GetLibId() const override
Definition sch_symbol.h:166
static bool empty(const wxTextEntryBase *aCtrl)
ERCE_T
ERC error codes.
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.
@ IGNORE_CASE
@ CASE_SENSITIVE
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708