KiCad PCB EDA Suite
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
5  * Copyright (C) 2014 Dick Hollenbeck,
6  * Copyright (C) 2015 Wayne Stambaugh <>
7  * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  *
22  * or you may search the website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
27 #ifndef __SYMBOL_H__
28 #define __SYMBOL_H__
30 #include <eda_item.h>
31 #include <core/typeinfo.h>
33 #include <lib_id.h>
34 #include <widgets/msgpanel.h>
36 #include <memory>
37 #include <string>
38 #include <unordered_map>
39 #include <vector>
40 #include <wx/arrstr.h>
41 #include <wx/chartype.h>
42 #include <wx/fdrepdlg.h>
43 #include <wx/gdicmn.h>
44 #include <wx/string.h>
46 #include <sch_field.h>
47 #include <sch_item.h>
48 #include <sch_pin.h>
49 #include <sch_sheet_path.h> // SYMBOL_INSTANCE_REFERENCE
50 #include <symbol_lib_table.h>
51 #include <transform.h>
53 struct PICKED_SYMBOL;
54 class SCH_SCREEN;
55 class LIB_ITEM;
56 class LIB_PIN;
57 class LIB_SYMBOL;
59 class SYMBOL_LIB;
60 class SYMBOL_LIBS;
61 class EE_COLLECTOR;
62 class SCH_SCREEN;
67 typedef std::vector<SCH_FIELD> SCH_FIELDS;
69 typedef std::weak_ptr<LIB_SYMBOL> PART_REF;
72 extern std::string toUTFTildaText( const wxString& txt );
78 class SCH_SYMBOL : public SCH_ITEM
79 {
80 public:
81  SCH_SYMBOL( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = NULL );
94  SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
95  int unit = 0, int convert = 0, const wxPoint& pos = wxPoint( 0, 0 ) );
97  SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
98  const wxPoint& pos = wxPoint( 0, 0 ) );
109  SCH_SYMBOL( const SCH_SYMBOL& aSymbol );
113  static inline bool ClassOf( const EDA_ITEM* aItem )
114  {
115  return aItem && SCH_SYMBOL_T == aItem->Type();
116  }
118  wxString GetClass() const override
119  {
120  return wxT( "SCH_SYMBOL" );
121  }
123  const std::vector<SYMBOL_INSTANCE_REFERENCE>& GetInstanceReferences()
124  {
125  return m_instanceReferences;
126  }
128  void ViewGetLayers( int aLayers[], int& aCount ) const override;
143  bool IsMovableFromAnchorPoint() const override { return true; }
145  void SetLibId( const LIB_ID& aName );
147  const LIB_ID& GetLibId() const { return m_lib_id; }
160  void SetSchSymbolLibraryName( const wxString& aName ) { m_schLibSymbolName = aName; }
161  wxString GetSchSymbolLibraryName() const;
162  bool UseLibIdLookup() const { return m_schLibSymbolName.IsEmpty(); }
164  std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() { return m_part; }
165  const std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() const { return m_part; }
183  void SetLibSymbol( LIB_SYMBOL* aLibSymbol );
188  wxString GetDescription() const;
193  wxString GetDatasheet() const;
195  int GetUnit() const { return m_unit; }
200  void UpdatePins();
211  void SetUnit( int aUnit );
221  void UpdateUnit( int aUnit );
223  int GetConvert() const { return m_convert; }
225  void SetConvert( int aConvert );
227  wxString GetPrefix() const { return m_prefix; }
229  void SetPrefix( const wxString& aPrefix ) { m_prefix = aPrefix; }
232  const TRANSFORM& GetTransform() const { return m_transform; }
234  void SetTransform( const TRANSFORM& aTransform );
241  int GetUnitCount() const;
249  void SetOrientation( int aOrientation );
266  int GetOrientation();
271  void GetContextualTextVars( wxArrayString* aVars ) const;
278  bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
280  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
290  void ClearAnnotation( const SCH_SHEET_PATH* aSheetPath );
303  bool AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPath );
314  bool ReplaceInstanceSheetPath( const KIID_PATH& aOldSheetPath, const KIID_PATH& aNewSheetPath );
316  const EDA_RECT GetBoundingBox() const override;
318  const EDA_RECT GetBoundingBox( bool aIncludeInvisibleText ) const;
326  //-----<Fields>-----------------------------------------------------------
336  SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldType );
337  const SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldNdx ) const;
346  SCH_FIELD* GetFieldById( int aFieldId );
353  wxString GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const;
361  void GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly );
366  std::vector<SCH_FIELD>& GetFields() { return m_fields; }
367  const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
376  SCH_FIELD* AddField( const SCH_FIELD& aField );
383  void RemoveField( const wxString& aFieldName );
393  SCH_FIELD* FindField( const wxString& aFieldName, bool aIncludeDefaultFields = true );
400  void SetFields( const SCH_FIELDS& aFields )
401  {
402  m_fields = aFields; // vector copying, length is changed possibly
403  }
415  void UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, bool aUpdateRef,
416  bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields );
421  int GetFieldCount() const { return (int)m_fields.size(); }
432  void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
434  void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
437  //-----</Fields>----------------------------------------------------------
446  SCH_PIN* GetPin( const wxString& number ) const;
453  void GetLibPins( std::vector<LIB_PIN*>& aPinsList ) const;
455  SCH_PIN* GetPin( LIB_PIN* aLibPin );
465  std::vector<SCH_PIN*> GetPins( const SCH_SHEET_PATH* aSheet = nullptr ) const;
467  std::vector<std::unique_ptr<SCH_PIN>>& GetRawPins() { return m_pins; }
476  void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
478  void SwapData( SCH_ITEM* aItem ) override;
488  static bool IsReferenceStringValid( const wxString& aReferenceString );
495  const wxString GetRef( const SCH_SHEET_PATH* aSheet, bool aIncludeUnit = false ) const;
503  void SetRef( const SCH_SHEET_PATH* aSheet, const wxString& aReference );
511  bool IsAnnotated( const SCH_SHEET_PATH* aSheet );
524  void AddHierarchicalReference( const KIID_PATH& aPath,
525  const wxString& aRef,
526  int aUnit,
527  const wxString& aValue = wxEmptyString,
528  const wxString& aFootprint = wxEmptyString );
531  int GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const;
534  void SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSelection );
537  void SetUnitSelection( int aUnitSelection );
540  const wxString GetValue( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
541  void SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValue );
544  void SetValue( const wxString& aValue )
545  {
546  SetValue( nullptr, aValue );
547  }
550  const wxString GetFootprint( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
551  void SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& aFootprint );
554  void SetFootprint( const wxString& aFootprint )
555  {
556  SetFootprint( nullptr, aFootprint );
557  }
559  // Geometric transforms (used in block operations):
561  void Move( const wxPoint& aMoveVector ) override
562  {
563  if( aMoveVector == wxPoint( 0, 0 ) )
564  return;
566  m_pos += aMoveVector;
568  for( SCH_FIELD& field : m_fields )
569  field.Move( aMoveVector );
571  SetModified();
572  }
574  void MirrorHorizontally( int aCenter ) override;
575  void MirrorVertically( int aCenter ) override;
576  void Rotate( const wxPoint& aCenter ) override;
578  bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
580  void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;
592  bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
593  const SCH_SHEET_PATH* aPath = nullptr ) override;
595  wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
597  bool IsConnectable() const override { return true; }
599  bool CanConnect( const SCH_ITEM* aItem ) const override
600  {
601  return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
602  ( aItem->Type() == SCH_NO_CONNECT_T ) ||
603  ( aItem->Type() == SCH_JUNCTION_T ) ||
604  ( aItem->Type() == SCH_SYMBOL_T ) ||
605  ( aItem->Type() == SCH_LABEL_T ) ||
606  ( aItem->Type() == SCH_HIER_LABEL_T ) ||
607  ( aItem->Type() == SCH_GLOBAL_LABEL_T );
608  }
613  bool IsInNetlist() const;
615  std::vector<wxPoint> GetConnectionPoints() const override;
617  SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
626  LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT );
628  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
630  BITMAPS GetMenuImage() const override;
632  bool operator <( const SCH_ITEM& aItem ) const override;
634  bool operator==( const SCH_SYMBOL& aSymbol) const;
635  bool operator!=( const SCH_SYMBOL& aSymbol) const;
637  SCH_SYMBOL& operator=( const SCH_ITEM& aItem );
639  bool IsReplaceable() const override { return true; }
641  wxPoint GetPosition() const override { return m_pos; }
642  void SetPosition( const wxPoint& aPosition ) override { Move( aPosition - m_pos ); }
644  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
645  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
647  void Plot( PLOTTER* aPlotter ) const override;
649  EDA_ITEM* Clone() const override;
651 #if defined(DEBUG)
652  void Show( int nestLevel, std::ostream& os ) const override;
653 #endif
655  void ClearBrightenedPins();
657  bool HasBrightenedPins();
659  bool GetIncludeInBom() const { return m_inBom; }
660  void SetIncludeInBom( bool aIncludeInBom ) { m_inBom = aIncludeInBom; }
662  bool GetIncludeOnBoard() const { return m_onBoard; }
663  void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_onBoard = aIncludeOnBoard; }
665  bool IsPointClickableAnchor( const wxPoint& aPos ) const override;
667 private:
668  bool doIsConnected( const wxPoint& aPosition ) const override;
670  void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
672  wxPoint m_pos;
674  int m_unit;
675  int m_convert;
676  wxString m_prefix;
695  std::unique_ptr< LIB_SYMBOL > m_part; // a flattened copy of the LIB_SYMBOL from
696  // the PROJECT's libraries.
697  std::vector<std::unique_ptr<SCH_PIN>> m_pins; // a SCH_PIN for every LIB_PIN (all units)
698  std::unordered_map<LIB_PIN*, unsigned> m_pinMap; // library pin pointer to SCH_PIN's index
701  bool m_inBom;
702  bool m_onBoard;
704  // Defines the hierarchical path and reference of the symbol. This allows support
705  // for multiple references to a single sub-sheet.
706  std::vector<SYMBOL_INSTANCE_REFERENCE> m_instanceReferences;
707 };
709 #endif /* __SYMBOL_H__ */
bool m_isInNetlist
True if the symbol should appear in the netlist.
Definition: sch_symbol.h:700
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:747
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_symbol.h:599
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a symbol.
Definition: sch_symbol.cpp:369
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instanceReferences), if this entry does not alrea...
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:49
void SetModified()
Definition: eda_item.cpp:65
wxString m_prefix
C, R, U, Q etc - the first character(s) which typically indicate what the symbol is.
Definition: sch_symbol.h:678
bool operator!=(const SCH_SYMBOL &aSymbol) const
bool ReplaceInstanceSheetPath(const KIID_PATH &aOldSheetPath, const KIID_PATH &aNewSheetPath)
Replace aOldSheetPath with aNewSheetPath in the instance list.
bool IsConnectable() const override
Definition: sch_symbol.h:597
void SetPosition(const wxPoint &aPosition) override
Definition: sch_symbol.h:642
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Return a mandatory field in this symbol.
Definition: sch_symbol.cpp:665
void SetUnit(int aUnit)
Change the unit number to aUnit.
Definition: sch_symbol.cpp:321
Object used to load, save, search, and otherwise manipulate symbol library files.
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_symbol.h:113
int GetUnitCount() const
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:360
std::vector< std::unique_ptr< SCH_PIN > > m_pins
Definition: sch_symbol.h:697
std::weak_ptr< LIB_SYMBOL > PART_REF
Definition: sch_symbol.h:69
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath)
Clear exiting symbol annotation.
bool IsPointClickableAnchor(const wxPoint &aPos) const override
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
Definition: sch_symbol.cpp:584
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.
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
Definition: sch_symbol.cpp:932
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: sch_symbol.h:639
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.
bool GetIncludeInBom() const
Definition: sch_symbol.h:659
void SetFields(const SCH_FIELDS &aFields)
Set multiple schematic fields.
Definition: sch_symbol.h:400
Definition: ee_collectors.h:42
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:219
SCH_FIELDS m_fields
Variable length list of fields.
Definition: sch_symbol.h:693
bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Schematic editor (Eeschema) main window.
void SetFootprint(const wxString &aFootprint)
Set the value for all instances (the default GUI behavior).
Definition: sch_symbol.h:554
std::vector< SCH_FIELD > SCH_FIELDS
A container for several SCH_FIELD items.
Definition: sch_symbol.h:63
void SetLibId(const LIB_ID &aName)
Definition: sch_symbol.cpp:228
wxPoint GetPinPhysicalPosition(const LIB_PIN *Pin) const
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:431
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
The base class for create windows for drawing purpose.
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_symbol.cpp:881
Define a library symbol object.
Definition: lib_symbol.h:96
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Definition: sch_symbol.cpp:635
wxString GetDatasheet() const
Return the documentation text for the given part alias.
Definition: sch_symbol.cpp:265
TRANSFORM & GetTransform()
Definition: sch_symbol.h:231
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
Definition: sch_symbol.cpp:247
std::vector< wxPoint > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
void Init(const wxPoint &pos=wxPoint(0, 0))
Definition: sch_symbol.cpp:184
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
Definition: sch_symbol.cpp:537
bool doIsConnected(const wxPoint &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
int m_unit
The unit for multiple part per package symbols.
Definition: sch_symbol.h:674
Definition: eda_item.h:94
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
void SetPrefix(const wxString &aPrefix)
Definition: sch_symbol.h:229
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:164
void UpdateUnit(int aUnit)
Change the unit number to aUnit without setting any internal flags.
Definition: sch_symbol.cpp:331
const std::vector< SYMBOL_INSTANCE_REFERENCE > & GetInstanceReferences()
Definition: sch_symbol.h:123
void Plot(PLOTTER *aPlotter) const override
Plot the schematic item to aPlotter.
void GetLibPins(std::vector< LIB_PIN * > &aPinsList) const
Populate a vector with all the pins from the library object.
Definition: sch_symbol.cpp:842
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_symbol.cpp:213
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
Definition: sch_symbol.cpp:918
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
void SetIncludeInBom(bool aIncludeInBom)
Definition: sch_symbol.h:660
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool IsInNetlist() const
int m_convert
The alternate body style for symbols that have more than one body style defined.
Definition: sch_symbol.h:675
wxString m_schLibSymbolName
The name used to look up a symbol in the symbol library embedded in a schematic.
Definition: sch_symbol.h:690
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
Definition: sch_symbol.cpp:711
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
const std::vector< SCH_FIELD > & GetFields() const
Definition: sch_symbol.h:367
#define NULL
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
const std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef() const
Definition: sch_symbol.h:165
wxString GetSchSymbolLibraryName() const
Definition: sch_symbol.cpp:238
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Automatically orient all the fields in the symbol.
int GetFieldCount() const
Return the number of fields in this symbol.
Definition: sch_symbol.h:421
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.h:143
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
Definition: sch_symbol.cpp:521
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
Definition: sch_symbol.cpp:274
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
wxPoint m_pos
Definition: sch_symbol.h:672
const TRANSFORM & GetTransform() const
Definition: sch_symbol.h:232
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
Definition: sch_symbol.h:160
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
std::unique_ptr< LIB_SYMBOL > m_part
Definition: sch_symbol.h:695
const wxString GetValue(const SCH_SHEET_PATH *sheet, bool aResolve) const
Return the instance-specific value for the given sheet path.
Definition: sch_symbol.cpp:563
bool m_onBoard
True to include in netlist when updating board.
Definition: sch_symbol.h:702
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
Definition: sch_symbol.cpp:733
wxString GetClass() const override
Return the class name.
Definition: sch_symbol.h:118
wxString GetFieldText(const wxString &aFieldName, SCH_EDIT_FRAME *aFrame) const
Search for a field named aFieldName and returns text associated with this field.
Definition: sch_symbol.cpp:689
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
Definition: sch_symbol.h:467
A collection of SYMBOL_LIB objects.
void SetConvert(int aConvert)
Definition: sch_symbol.cpp:337
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:507
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:272
Definition: eda_units.h:38
SCH_SYMBOL(const wxPoint &pos=wxPoint(0, 0), SCH_ITEM *aParent=NULL)
Definition: sch_symbol.cpp:96
bool HasBrightenedPins()
LIB_ID m_lib_id
Name and library the symbol was loaded from, i.e. 74xx:74LS00.
Definition: sch_symbol.h:673
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
void ClearBrightenedPins()
Base plotter engine class.
Definition: plotter.h:121
void SetIncludeOnBoard(bool aIncludeOnBoard)
Definition: sch_symbol.h:663
bool m_inBom
True to include in bill of materials export.
Definition: sch_symbol.h:701
std::unordered_map< LIB_PIN *, unsigned > m_pinMap
Definition: sch_symbol.h:698
Board layer functions and definitions.
Schematic symbol object.
Definition: sch_symbol.h:78
SCH_SYMBOL & operator=(const SCH_ITEM &aItem)
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
void Move(const wxPoint &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_symbol.h:561
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:44
bool operator<(const SCH_ITEM &aItem) const override
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
Definition: sch_symbol.cpp:830
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:471
void Rotate(const wxPoint &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Handle the component boundary box.
Definition: eda_rect.h:42
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_symbol.h:692
wxString GetPrefix() const
Definition: sch_symbol.h:227
wxPoint GetPosition() const override
Definition: sch_symbol.h:641
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
bool GetIncludeOnBoard() const
Definition: sch_symbol.h:662
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
Definition: sch_symbol.cpp:820
bool operator==(const SCH_SYMBOL &aSymbol) const
int GetOrientation()
Get the display symbol orientation.
wxString GetDescription() const
Return information about the aliased parts.
Definition: sch_symbol.cpp:256
const wxString GetFootprint(const SCH_SHEET_PATH *sheet, bool aResolve) const
Return the instance-specific footprint assignment for the given sheet path.
Definition: sch_symbol.cpp:614
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit, const wxString &aValue=wxEmptyString, const wxString &aFootprint=wxEmptyString)
Add a full hierarchical reference to this symbol.
Definition: sch_symbol.cpp:390
std::vector< SYMBOL_INSTANCE_REFERENCE > m_instanceReferences
Definition: sch_symbol.h:706
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
int GetUnit() const
Definition: sch_symbol.h:195
std::vector< SCH_FIELD > & GetFields()
Return a vector of fields from the symbol.
Definition: sch_symbol.h:366
LIB_ITEM * GetDrawItem(const wxPoint &aPosition, KICAD_T aType=TYPE_NOT_INIT)
Return the symbol library item at aPosition that is part of this symbol.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
Definition: eda_item.h:41
Message panel definition file.
static bool IsReferenceStringValid(const wxString &aReferenceString)
Test for an acceptable reference string.
Definition: sch_symbol.cpp:465
SCH_FIELD * GetFieldById(int aFieldId)
Return a field in this symbol.
Definition: sch_symbol.cpp:677
int GetConvert() const
Definition: sch_symbol.h:223
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
Definition: sch_symbol.cpp:720
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
Definition: sch_symbol.cpp:856
bool UseLibIdLookup() const
Definition: sch_symbol.h:162
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
void SetValue(const wxString &aValue)
Set the value for all instances (the default GUI behavior).
Definition: sch_symbol.h:544
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:147
void SetTransform(const TRANSFORM &aTransform)
Definition: sch_symbol.cpp:350