KiCad PCB EDA Suite
sch_symbol.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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2014 Dick Hollenbeck, [email protected]
6 * Copyright (C) 2015 Wayne Stambaugh <[email protected]>
7 * Copyright (C) 2022 CERN
8 * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, you may find one here:
22 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23 * or you may search the http://www.gnu.org website for the version 2 license,
24 * or you may write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26 */
27
28#ifndef __SYMBOL_H__
29#define __SYMBOL_H__
30
31#include <eda_item.h>
32#include <core/typeinfo.h>
33#include <layer_ids.h>
34#include <lib_id.h>
35#include <widgets/msgpanel.h>
36
37#include <memory>
38#include <string>
39#include <unordered_map>
40#include <vector>
41#include <wx/arrstr.h>
42#include <wx/chartype.h>
43#include <wx/fdrepdlg.h>
44#include <wx/gdicmn.h>
45#include <wx/string.h>
46
47#include <sch_field.h>
48#include <sch_item.h>
49#include <sch_pin.h>
50#include <sch_sheet_path.h> // SCH_SYMBOL_INSTANCE
51#include <symbol_lib_table.h>
52#include <transform.h>
53
54struct PICKED_SYMBOL;
55class KIID_PATH;
56class SCH_SCREEN;
57class LIB_ITEM;
58class LIB_PIN;
59class LIB_SYMBOL;
60class NETLIST_OBJECT_LIST;
61class SYMBOL_LIB;
62class SYMBOL_LIBS;
63class EE_COLLECTOR;
64class SCH_SCREEN;
66
67
69typedef std::vector<SCH_FIELD> SCH_FIELDS;
70
71typedef std::weak_ptr<LIB_SYMBOL> PART_REF;
72
73
74extern std::string toUTFTildaText( const wxString& txt );
75
76
80class SCH_SYMBOL : public SCH_ITEM
81{
82public:
83 SCH_SYMBOL();
84
95 SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
96 int aUnit, int aConvert = 0, const VECTOR2I& aPosition = VECTOR2I( 0, 0 ),
97 EDA_ITEM* aParent = nullptr );
98
99 SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
100 const VECTOR2I& aPosition = VECTOR2I( 0, 0 ), EDA_ITEM* aParent = nullptr );
101
111 SCH_SYMBOL( const SCH_SYMBOL& aSymbol );
112
114
115 static inline bool ClassOf( const EDA_ITEM* aItem )
116 {
117 return aItem && SCH_SYMBOL_T == aItem->Type();
118 }
119
120 wxString GetClass() const override
121 {
122 return wxT( "SCH_SYMBOL" );
123 }
124
138 bool IsMissingLibSymbol() const;
139
140 const std::vector<SCH_SYMBOL_INSTANCE>& GetInstanceReferences()
141 {
143 }
144
145 bool GetInstance( SCH_SYMBOL_INSTANCE& aInstance,
146 const KIID_PATH& aSheetPath, bool aTestFromEnd = false ) const;
147
148 void RemoveInstance( const SCH_SHEET_PATH& aInstancePath );
149
151
152 void SortInstances( bool ( *aSortFunction )( const SCH_SYMBOL_INSTANCE& aLhs,
153 const SCH_SYMBOL_INSTANCE& aRhs ) );
154
155 void ViewGetLayers( int aLayers[], int& aCount ) const override;
156
171 bool IsMovableFromAnchorPoint() const override;
172
173 void SetLibId( const LIB_ID& aName );
174
175 const LIB_ID& GetLibId() const { return m_lib_id; }
176
188 void SetSchSymbolLibraryName( const wxString& aName ) { m_schLibSymbolName = aName; }
189 wxString GetSchSymbolLibraryName() const;
190 bool UseLibIdLookup() const { return m_schLibSymbolName.IsEmpty(); }
191
192 std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() { return m_part; }
193 const std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() const { return m_part; }
194
211 void SetLibSymbol( LIB_SYMBOL* aLibSymbol );
212
216 wxString GetDescription() const;
217
221 wxString GetKeyWords() const;
222
226 wxString GetDatasheet() const;
227
228 int GetUnit() const { return m_unit; }
229
233 void UpdatePins();
234
244 void SetUnit( int aUnit );
245
251 bool HasUnitDisplayName( int aUnit );
252
258 wxString GetUnitDisplayName( int aUnit );
259
268 void UpdateUnit( int aUnit );
269
270 int GetConvert() const { return m_convert; }
271
272 void SetConvert( int aConvert );
273
274 wxString GetPrefix() const { return m_prefix; }
275
276 void SetPrefix( const wxString& aPrefix ) { m_prefix = aPrefix; }
277
281 void UpdatePrefix();
282
284 const TRANSFORM& GetTransform() const { return m_transform; }
285
286 void SetTransform( const TRANSFORM& aTransform );
287
293 int GetUnitCount() const;
294
301 void SetOrientation( int aOrientation );
302
318 int GetOrientation() const;
319
323 void GetContextualTextVars( wxArrayString* aVars ) const;
324
330 bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
331
332 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
333
344 void ClearAnnotation( const SCH_SHEET_PATH* aSheetPath, bool aResetPrefix );
345
357 bool AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPath );
358
368 bool ReplaceInstanceSheetPath( const KIID_PATH& aOldSheetPath, const KIID_PATH& aNewSheetPath );
369
370 const BOX2I GetBoundingBox() const override;
371
376
381
382
383 //-----<Fields>-----------------------------------------------------------
384
393 SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldType );
394 const SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldNdx ) const;
395
403 SCH_FIELD* GetFieldById( int aFieldId );
404
410 wxString GetFieldText( const wxString& aFieldName ) const;
411
418 void GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly );
419
423 std::vector<SCH_FIELD>& GetFields() { return m_fields; }
424 const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
425
433 SCH_FIELD* AddField( const SCH_FIELD& aField );
434
440 void RemoveField( const wxString& aFieldName );
441
442 void RemoveField( SCH_FIELD* aField ) { RemoveField( aField->GetName() ); }
443
452 SCH_FIELD* FindField( const wxString& aFieldName, bool aIncludeDefaultFields = true );
453
459 void SetFields( std::vector<SCH_FIELD>& aFields )
460 {
461 m_fields = aFields; // vector copying, length is changed possibly
462 }
463
464 const wxString GetValueFieldText( bool aResolve ) const;
465 void SetValueFieldText( const wxString& aValue );
466
467 const wxString GetFootprintFieldText( bool aResolve ) const;
468 void SetFootprintFieldText( const wxString& aFootprint );
469
480 void UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, bool aUpdateRef,
481 bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields );
482
486 int GetFieldCount() const { return (int)m_fields.size(); }
487
497 void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
498
499 void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
500
501
502 //-----</Fields>----------------------------------------------------------
503
504
511 SCH_PIN* GetPin( const wxString& number ) const;
512
518 void GetLibPins( std::vector<LIB_PIN*>& aPinsList ) const;
519
524 std::vector<LIB_PIN*> GetAllLibPins() const;
525
529 size_t GetFullPinCount() { return GetAllLibPins().size(); }
530
534 SCH_PIN* GetPin( LIB_PIN* aLibPin ) const;
535
544 std::vector<SCH_PIN*> GetPins( const SCH_SHEET_PATH* aSheet = nullptr ) const;
545
546
547 std::vector<std::unique_ptr<SCH_PIN>>& GetRawPins() { return m_pins; }
548
556 void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
557
565 void PrintBackground( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
566
567 void SwapData( SCH_ITEM* aItem ) override;
568
577 static bool IsReferenceStringValid( const wxString& aReferenceString );
578
584 const wxString GetRef( const SCH_SHEET_PATH* aSheet, bool aIncludeUnit = false ) const;
585
592 void SetRef( const SCH_SHEET_PATH* aSheet, const wxString& aReference );
593
600 bool IsAnnotated( const SCH_SHEET_PATH* aSheet );
601
613 void AddHierarchicalReference( const KIID_PATH& aPath,
614 const wxString& aRef,
615 int aUnit );
616
617 void AddHierarchicalReference( const SCH_SYMBOL_INSTANCE& aInstance );
618
620 int GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const;
621
623 void SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSelection );
624
626 void SetUnitSelection( int aUnitSelection );
627
628 // Geometric transforms (used in block operations):
629
630 void Move( const VECTOR2I& aMoveVector ) override
631 {
632 if( aMoveVector == VECTOR2I( 0, 0 ) )
633 return;
634
635 m_pos += aMoveVector;
636
637 for( SCH_FIELD& field : m_fields )
638 field.Move( aMoveVector );
639
640 SetModified();
641 }
642
643 void MirrorHorizontally( int aCenter ) override;
644 void MirrorVertically( int aCenter ) override;
645 void Rotate( const VECTOR2I& aCenter ) override;
646
647 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
648
649 void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;
650
661 bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
662 const SCH_SHEET_PATH* aPath = nullptr ) override;
663
664 VECTOR2I GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
665
666 bool IsConnectable() const override { return true; }
667
668 bool CanConnect( const SCH_ITEM* aItem ) const override
669 {
670 return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
671 ( aItem->Type() == SCH_NO_CONNECT_T ) ||
672 ( aItem->Type() == SCH_JUNCTION_T ) ||
673 ( aItem->Type() == SCH_SYMBOL_T ) ||
674 ( aItem->Type() == SCH_DIRECTIVE_LABEL_T ) ||
675 ( aItem->Type() == SCH_LABEL_T ) ||
676 ( aItem->Type() == SCH_HIER_LABEL_T ) ||
677 ( aItem->Type() == SCH_GLOBAL_LABEL_T );
678 }
679
683 bool IsInNetlist() const;
684
685 std::vector<VECTOR2I> GetConnectionPoints() const override;
686
687 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
688 const std::vector<KICAD_T>& aScanTypes ) override;
689
697 LIB_ITEM* GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType = TYPE_NOT_INIT );
698
699 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
700
701 BITMAPS GetMenuImage() const override;
702
703 bool operator <( const SCH_ITEM& aItem ) const override;
704
705 bool operator==( const SCH_SYMBOL& aSymbol) const;
706 bool operator!=( const SCH_SYMBOL& aSymbol) const;
707
708 SCH_SYMBOL& operator=( const SCH_ITEM& aItem );
709
710 bool IsReplaceable() const override { return true; }
711
712 VECTOR2I GetPosition() const override { return m_pos; }
713 void SetPosition( const VECTOR2I& aPosition ) override { Move( aPosition - m_pos ); }
714
715 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
716 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
717
718 void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
719
727 void PlotPins( PLOTTER* aPlotter ) const;
728
735 void PlotDNP( PLOTTER* aPlotter ) const;
736
737 EDA_ITEM* Clone() const override;
738
739#if defined(DEBUG)
740 void Show( int nestLevel, std::ostream& os ) const override;
741#endif
742
743 void ClearBrightenedPins();
744
745 bool HasBrightenedPins();
746
747 bool GetIncludeInBom() const { return m_inBom; }
748 void SetIncludeInBom( bool aIncludeInBom ) { m_inBom = aIncludeInBom; }
749
750 bool GetIncludeOnBoard() const { return m_onBoard; }
751 void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_onBoard = aIncludeOnBoard; }
752
753 bool GetDNP() const { return m_DNP; }
754 void SetDNP( bool aDNP ) { m_DNP = aDNP; }
755
756 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override;
757
758private:
759 BOX2I doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
760
761 bool doIsConnected( const VECTOR2I& aPosition ) const override;
762
763 void Init( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
764
767 int m_unit;
771 wxString m_prefix;
775
784
786 std::vector<SCH_FIELD> m_fields;
787
788 std::unique_ptr< LIB_SYMBOL > m_part;
790 std::vector<std::unique_ptr<SCH_PIN>> m_pins;
791 std::unordered_map<LIB_PIN*, unsigned> m_pinMap;
792
794 bool m_inBom;
796 bool m_DNP;
797
798 // Defines the hierarchical path and reference of the symbol. This allows support
799 // for multiple references to a single sub-sheet.
800 std::vector<SCH_SYMBOL_INSTANCE> m_instanceReferences;
801
803 static std::unordered_map<TRANSFORM, int> s_transformToOrientationCache;
804};
805
806#endif /* __SYMBOL_H__ */
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
void SetModified()
Definition: eda_item.cpp:64
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
Define a library symbol object.
Definition: lib_symbol.h:99
Base plotter engine class.
Definition: plotter.h:110
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Definition: sch_field.cpp:804
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:246
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Schematic symbol object.
Definition: sch_symbol.h:81
const TRANSFORM & GetTransform() const
Definition: sch_symbol.h:284
void UpdatePrefix()
Set the prefix based on the current reference designator.
Definition: sch_symbol.cpp:766
wxString m_prefix
C, R, U, Q etc - the first character(s) which typically indicate what the symbol is.
Definition: sch_symbol.h:771
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
void GetLibPins(std::vector< LIB_PIN * > &aPinsList) const
Populate a vector with all the pins from the library object.
void SetFields(std::vector< SCH_FIELD > &aFields)
Set multiple schematic fields.
Definition: sch_symbol.h:459
int GetUnitCount() const
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:427
VECTOR2I m_pos
Definition: sch_symbol.h:765
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
LIB_ID m_lib_id
Name and library the symbol was loaded from, i.e. 74xx:74LS00.
Definition: sch_symbol.h:766
void SetConvert(int aConvert)
Definition: sch_symbol.cpp:404
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
wxString GetDatasheet() const
Return the documentation text for the given part alias.
Definition: sch_symbol.cpp:330
void SetLibId(const LIB_ID &aName)
Definition: sch_symbol.cpp:284
bool ReplaceInstanceSheetPath(const KIID_PATH &aOldSheetPath, const KIID_PATH &aNewSheetPath)
Replace aOldSheetPath with aNewSheetPath in the instance list.
bool HasBrightenedPins()
std::vector< SCH_FIELD > & GetFields()
Return a vector of fields from the symbol.
Definition: sch_symbol.h:423
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print a symbol.
Definition: sch_symbol.cpp:464
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Automatically orient all the fields in the symbol.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
size_t GetFullPinCount()
Definition: sch_symbol.h:529
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
Definition: sch_symbol.h:547
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_symbol.h:713
void PlotDNP(PLOTTER *aPlotter) const
Plot the red 'X' over the symbol.
bool operator!=(const SCH_SYMBOL &aSymbol) const
LIB_ITEM * GetDrawItem(const VECTOR2I &aPosition, KICAD_T aType=TYPE_NOT_INIT)
Return the symbol library item at aPosition that is part of this symbol.
int GetUnit() const
Definition: sch_symbol.h:228
bool IsConnectable() const override
Definition: sch_symbol.h:666
int GetFieldCount() const
Return the number of fields in this symbol.
Definition: sch_symbol.h:486
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstanceReferences()
Definition: sch_symbol.h:140
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
Definition: sch_symbol.cpp:938
void SetDNP(bool aDNP)
Definition: sch_symbol.h:754
void UpdateUnit(int aUnit)
Change the unit number to aUnit without setting any internal flags.
Definition: sch_symbol.cpp:398
void SetIncludeOnBoard(bool aIncludeOnBoard)
Definition: sch_symbol.h:751
wxString GetClass() const override
Return the class name.
Definition: sch_symbol.h:120
void RemoveInstance(const SCH_SHEET_PATH &aInstancePath)
Definition: sch_symbol.cpp:543
static bool IsReferenceStringValid(const wxString &aReferenceString)
Test for an acceptable reference string.
Definition: sch_symbol.cpp:710
void PlotPins(PLOTTER *aPlotter) const
Plot just the symbol pins.
bool UseLibIdLookup() const
Definition: sch_symbol.h:190
void SetValueFieldText(const wxString &aValue)
Definition: sch_symbol.cpp:844
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
Definition: sch_symbol.cpp:925
int m_convert
The alternate body style for symbols that have more than one body style defined.
Definition: sch_symbol.h:768
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
wxString GetSchSymbolLibraryName() const
Definition: sch_symbol.cpp:294
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:674
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_symbol.h:115
bool IsInNetlist() const
bool GetIncludeOnBoard() const
Definition: sch_symbol.h:750
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_symbol.h:630
std::unordered_map< LIB_PIN *, unsigned > m_pinMap
library pin pointer : SCH_PIN's index
Definition: sch_symbol.h:791
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
bool GetIncludeInBom() const
Definition: sch_symbol.h:747
void ClearBrightenedPins()
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_symbol.cpp:233
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instanceReferences), if this entry does not alrea...
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
Definition: sch_symbol.cpp:865
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
static std::unordered_map< TRANSFORM, int > s_transformToOrientationCache
Definition: sch_symbol.h:803
VECTOR2I GetPinPhysicalPosition(const LIB_PIN *Pin) const
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
Definition: sch_symbol.cpp:339
int GetConvert() const
Definition: sch_symbol.h:270
std::vector< SCH_SYMBOL_INSTANCE > m_instanceReferences
Definition: sch_symbol.h:800
const std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef() const
Definition: sch_symbol.h:193
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
void UpdateFields(const SCH_SHEET_PATH *aPath, bool aUpdateStyle, bool aUpdateRef, bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields)
Restore fields to the original library values.
Definition: sch_symbol.cpp:952
wxString m_schLibSymbolName
The name used to look up a symbol in the symbol library embedded in a schematic.
Definition: sch_symbol.h:783
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
Definition: sch_symbol.cpp:716
const wxString GetFootprintFieldText(bool aResolve) const
Definition: sch_symbol.cpp:850
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
void PrintBackground(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print only the background parts of a symbol (if any)
Definition: sch_symbol.cpp:452
wxString GetDescription() const
Definition: sch_symbol.cpp:312
std::vector< SCH_FIELD > m_fields
Variable length list of fields.
Definition: sch_symbol.h:786
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
bool m_onBoard
True to include in netlist when updating board.
Definition: sch_symbol.h:795
int m_unit
The unit for multiple part per package symbols.
Definition: sch_symbol.h:767
void SetFootprintFieldText(const wxString &aFootprint)
Definition: sch_symbol.cpp:859
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit)
Add a full hierarchical reference to this symbol.
Definition: sch_symbol.cpp:572
bool IsMissingLibSymbol() const
Check to see if the library symbol is set to the dummy library symbol.
Definition: sch_symbol.cpp:239
VECTOR2I GetPosition() const override
Definition: sch_symbol.h:712
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void SetTransform(const TRANSFORM &aTransform)
Definition: sch_symbol.cpp:417
const std::vector< SCH_FIELD > & GetFields() const
Definition: sch_symbol.h:424
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_symbol.h:668
void Init(const VECTOR2I &pos=VECTOR2I(0, 0))
Definition: sch_symbol.cpp:203
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_symbol.cpp:248
bool operator<(const SCH_ITEM &aItem) const override
bool m_DNP
True if symbol is set to 'Do Not Populate'.
Definition: sch_symbol.h:796
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
wxString GetKeyWords() const
Definition: sch_symbol.cpp:321
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
Definition: sch_symbol.h:188
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
SCH_FIELD * GetFieldById(int aFieldId)
Return a field in this symbol.
Definition: sch_symbol.cpp:877
const wxString GetValueFieldText(bool aResolve) const
Definition: sch_symbol.cpp:835
bool GetInstance(SCH_SYMBOL_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
Definition: sch_symbol.cpp:519
TRANSFORM & GetTransform()
Definition: sch_symbol.h:283
bool HasUnitDisplayName(int aUnit)
Return true if the given unit aUnit has a display name set.
Definition: sch_symbol.cpp:444
BOX2I doGetBoundingBox(bool aIncludePins, bool aIncludeFields) const
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
Definition: sch_symbol.cpp:916
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr) override
Test if the symbol's dangling state has changed for all pins.
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
int GetOrientation() const
Get the display symbol orientation.
bool IsAnnotated(const SCH_SHEET_PATH *aSheet)
Check if the symbol has a valid annotation (reference) for the given sheet path.
Definition: sch_symbol.cpp:752
void RemoveField(SCH_FIELD *aField)
Definition: sch_symbol.h:442
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool m_isInNetlist
True if the symbol should appear in the netlist.
Definition: sch_symbol.h:793
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
Definition: sch_symbol.cpp:793
void SetUnit(int aUnit)
Change the unit number to aUnit.
Definition: sch_symbol.cpp:388
void RemoveAllInstances()
Definition: sch_symbol.h:150
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:175
wxString GetUnitDisplayName(int aUnit)
Return the display name for a given unit aUnit.
Definition: sch_symbol.cpp:436
BOX2I GetBodyAndPinsBoundingBox() const
Return a bounding box for the symbol body and pins but not the fields.
TRANSFORM m_transform
The rotation/mirror transformation.
Definition: sch_symbol.h:785
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
SCH_SYMBOL & operator=(const SCH_ITEM &aItem)
std::vector< LIB_PIN * > GetAllLibPins() const
void SetPrefix(const wxString &aPrefix)
Definition: sch_symbol.h:276
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
Definition: sch_symbol.cpp:809
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:192
std::vector< std::unique_ptr< SCH_PIN > > m_pins
a SCH_PIN for every LIB_PIN (all units)
Definition: sch_symbol.h:790
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: sch_symbol.h:710
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
Definition: sch_symbol.cpp:303
BOX2I GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the pins or fields.
void SortInstances(bool(*aSortFunction)(const SCH_SYMBOL_INSTANCE &aLhs, const SCH_SYMBOL_INSTANCE &aRhs))
Definition: sch_symbol.cpp:565
wxString GetFieldText(const wxString &aFieldName) const
Search for a field named aFieldName and returns text associated with this field.
Definition: sch_symbol.cpp:889
wxString GetPrefix() const
Definition: sch_symbol.h:274
bool IsMovableFromAnchorPoint() const override
Return true for items which are moved with the anchor point at mouse cursor and false for items moved...
Definition: sch_symbol.cpp:263
void SetIncludeInBom(bool aIncludeInBom)
Definition: sch_symbol.h:748
bool m_inBom
True to include in bill of materials export.
Definition: sch_symbol.h:794
std::unique_ptr< LIB_SYMBOL > m_part
a flattened copy of the LIB_SYMBOL from the PROJECT's libraries.
Definition: sch_symbol.h:788
bool operator==(const SCH_SYMBOL &aSymbol) const
bool GetDNP() const
Definition: sch_symbol.h:753
A collection of SYMBOL_LIB objects.
Object used to load, save, search, and otherwise manipulate symbol library files.
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:47
INSPECT_RESULT
Definition: eda_item.h:42
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:78
@ LAYER_WIRE
Definition: layer_ids.h:344
Message panel definition file.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::string toUTFTildaText(const wxString &txt)
Convert a wxString to UTF8 and replace any control characters with a ~, where a control character is ...
Definition: sch_symbol.cpp:54
std::weak_ptr< LIB_SYMBOL > PART_REF
Definition: sch_symbol.h:71
std::vector< SCH_FIELD > SCH_FIELDS
A container for several SCH_FIELD items.
Definition: sch_symbol.h:69
A simple container for schematic symbol instance information.
MANDATORY_FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_LINE_T
Definition: typeinfo.h:146
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:143
@ TYPE_NOT_INIT
Definition: typeinfo.h:81
@ SCH_SYMBOL_T
Definition: typeinfo.h:156
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:154
@ SCH_LABEL_T
Definition: typeinfo.h:151
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:153
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:152
@ SCH_JUNCTION_T
Definition: typeinfo.h:142
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590