KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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, see <https://www.gnu.org/licenses/>.
22 */
23
24#pragma once
25
26#include <eda_item.h>
27#include <core/typeinfo.h>
28#include <layer_ids.h>
29#include <lib_id.h>
30
31#include <map>
32#include <memory>
33#include <optional>
34#include <string>
35#include <unordered_map>
36#include <vector>
37#include <wx/arrstr.h>
38#include <wx/chartype.h>
39#include <wx/string.h>
40
41#include <symbol.h>
42#include <sch_field.h>
43#include <sch_pin.h>
44#include <sch_sheet_path.h> // SCH_SYMBOL_INSTANCE
45#include <transform.h>
46
47struct PICKED_SYMBOL;
48class KIID_PATH;
49class SCH_SCREEN;
50class LIB_SYMBOL;
51class MSG_PANEL_ITEM;
54class SCH_SCREEN;
55class SCH_COMMIT;
56class SCH_SHAPE;
58
59
61{
62class SchematicSymbolInstance;
63}
64
65
66typedef std::weak_ptr<LIB_SYMBOL> PART_REF;
67
68
69extern std::string toUTFTildaText( const wxString& txt );
70
71
75class SCH_SYMBOL : public SYMBOL
76{
77public:
78 SCH_SYMBOL();
79
91 SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
92 int aUnit, int aBodyStyle = 0, const VECTOR2I& aPosition = VECTOR2I( 0, 0 ),
93 EDA_ITEM* aParent = nullptr );
94
95 SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
96 const VECTOR2I& aPosition = VECTOR2I( 0, 0 ), EDA_ITEM* aParent = nullptr );
97
107 SCH_SYMBOL( const SCH_SYMBOL& aSymbol );
108
109 ~SCH_SYMBOL();
110
111 static inline bool ClassOf( const EDA_ITEM* aItem )
112 {
113 return aItem && SCH_SYMBOL_T == aItem->Type();
114 }
115
116 wxString GetClass() const override
117 {
118 return wxT( "SCH_SYMBOL" );
119 }
120
134 bool IsMissingLibSymbol() const;
135
136 const std::vector<SCH_SYMBOL_INSTANCE>& GetInstances() const
137 {
138 return m_instances;
139 }
140
141 bool GetInstance( SCH_SYMBOL_INSTANCE& aInstance,
142 const KIID_PATH& aSheetPath, bool aTestFromEnd = false ) const;
143
144 void RemoveInstance( const SCH_SHEET_PATH& aInstancePath );
145
146 void RemoveInstance( const KIID_PATH& aInstancePath );
147
162 bool IsMovableFromAnchorPoint() const override;
163
164 void SetLibId( const LIB_ID& aName );
165
166 const LIB_ID& GetLibId() const override { return m_lib_id; }
167
168 wxString GetSymbolIDAsString() const { return m_lib_id.Format(); }
169
181 void SetSchSymbolLibraryName( const wxString& aName ) { m_schLibSymbolName = aName; }
182 wxString GetSchSymbolLibraryName() const;
183 bool UseLibIdLookup() const { return m_schLibSymbolName.IsEmpty(); }
184
185 std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() { return m_part; }
186 const std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() const { return m_part; }
187
189
206 void SetLibSymbol( LIB_SYMBOL* aLibSymbol );
207
211 wxString GetDescription() const override;
212 wxString GetShownDescription( RESOLUTION_CONTEXT aContext, int aDepth = 0 ) const override;
213
217 wxString GetKeyWords() const override;
218 wxString GetShownKeyWords( RESOLUTION_CONTEXT aContext, int aDepth = 0 ) const override;
219
223 wxString GetDatasheet() const;
224
228 void UpdatePins();
229
235 wxString GetUnitDisplayName( int aUnit, bool aLabel ) const override;
236
237 wxString GetBodyStyleDescription( int aBodyStyle, bool aLabel ) const override;
238
239 void SetBodyStyle( int aBodyStyle ) override;
240
241 wxString GetPrefix() const { return m_prefix; }
242 void SetPrefix( const wxString& aPrefix ) { m_prefix = aPrefix; }
243
247 void UpdatePrefix();
248
249 wxString SubReference( int aUnit, bool aAddSeparator = true ) const;
250
256 int GetUnitCount() const override;
257
258 bool IsMultiUnit() const override { return GetUnitCount() > 1; }
259
265 int GetBodyStyleCount() const override;
266
267 bool IsMultiBodyStyle() const override { return GetBodyStyleCount() > 1; }
268
269 bool HasDeMorganBodyStyles() const override;
270
277 void SetOrientation( int aOrientation );
278
294 int GetOrientation() const override;
295
300 {
301 int mirroring = GetOrientation();
302
304
305 SetOrientation( aAngle | mirroring );
306 }
307
324
325 void SetMirrorX( bool aMirror )
326 {
328
329 if( aMirror )
331 else
333
335 }
336
337 bool GetMirrorX() const
338 {
340 }
341
342 void SetMirrorY( bool aMirror )
343 {
345
346 if( aMirror )
348 else
350
352 }
353
354 bool GetMirrorY() const
355 {
357 }
358
362 void GetContextualTextVars( wxArrayString* aVars ) const;
363
371 bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth = 0 ) const;
372
381 bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token,
382 const wxString& aVariantName, int aDepth = 0 ) const;
383
384 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
385
396 void ClearAnnotation( const SCH_SHEET_PATH* aSheetPath, bool aResetPrefix );
397
409 bool AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPath );
410
418 bool SetInstanceProjectName( const KIID_PATH& aSheetPath, const wxString& aProjectName );
419
420
421 const BOX2I GetBoundingBox() const override;
422
426 BOX2I GetBodyBoundingBox() const override;
427
431 BOX2I GetBodyAndPinsBoundingBox() const override;
432
433
434 //-----<Fields>-----------------------------------------------------------
435
440 SCH_FIELD* GetField( FIELD_T aFieldType );
441 const SCH_FIELD* GetField( FIELD_T aFieldNdx ) const;
442
450 SCH_FIELD* GetField( const wxString& aFieldName );
451 const SCH_FIELD* GetField( const wxString& aFieldName ) const;
452
459 void GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly ) const override;
460
464 std::vector<SCH_FIELD>& GetFields() { return m_fields; }
465 const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
466
467 std::vector<PROPERTY_BASE*> GetDynamicProperties() const override;
468 std::vector<PROPERTY_BASE*> GetDynamicProperties( const SCH_SHEET_PATH* aPath ) const;
469
477 SCH_FIELD* AddField( const SCH_FIELD& aField );
478
484 void RemoveField( const wxString& aFieldName );
485
486 void RemoveField( SCH_FIELD* aField )
487 {
488 if( aField )
489 RemoveField( aField->GetName() );
490 }
491
499 SCH_FIELD* FindFieldCaseInsensitive( const wxString& aFieldName );
500 const SCH_FIELD* FindFieldCaseInsensitive( const wxString& aFieldName ) const;
501
506 const wxString GetRef( const SCH_SHEET_PATH* aSheet,
507 bool aIncludeUnit = false ) const override;
508
513 wxString GetUnitRef( const SCH_SHEET_PATH* aSheet, int aUnit ) const;
514
520 static uint64_t RefGeneration();
521
523 static void BumpRefGeneration();
524
529 wxString GetBaseRef( const SCH_SHEET_PATH* aSheet, bool aIncludeUnit = false ) const;
530
534 wxString GetCurrentSheetRef() const;
535
539 const wxString GetValue( const SCH_SHEET_PATH* aPath, RESOLUTION_CONTEXT aContext,
540 const wxString& aVariantName = wxEmptyString ) const override;
541
542 void SetValueFieldText( const wxString& aValue, const SCH_SHEET_PATH* aInstance = nullptr,
543 const wxString& aVariantName = wxEmptyString );
544
545 const wxString GetFootprintFieldText( const SCH_SHEET_PATH* aPath, RESOLUTION_CONTEXT aContext,
546 const wxString& aVariantName = wxEmptyString ) const;
547 void SetFootprintFieldText( const wxString& aFootprint );
548
549 /*
550 * Field access for property manager
551 */
552 wxString GetRefProp() const;
553
554 void SetRefProp( const wxString& aRef );
555
556 wxString GetValueProp() const;
557
558 void SetValueProp( const wxString& aValue ); // Implemented in sch_symbol.cpp for tracing
559
560 int GetUnitProp() const;
561
562 void SetFieldText( SCH_FIELD* aField, const wxString& aFieldName, const wxString& aFieldText,
563 const SCH_SHEET_PATH* aPath, const wxString& aVariantName );
564
565 void SetFieldText( const wxString& aFieldName, const wxString& aFieldText, const SCH_SHEET_PATH* aPath = nullptr,
566 const wxString& aVariantName = wxEmptyString );
567
568 wxString GetFieldText( const SCH_FIELD* aField, const wxString& aFieldName, const SCH_SHEET_PATH* aPath,
569 const wxString& aVariantName ) const;
570
571 wxString GetFieldText( const wxString& aFieldName, const SCH_SHEET_PATH* aPath = nullptr,
572 const wxString& aVariantName = wxEmptyString ) const;
573
574 void SetUnitProp( int aUnit );
575
576 wxString GetBodyStyleProp() const override
577 {
578 return GetBodyStyleDescription( GetBodyStyle(), false );
579 }
580
581 void SetBodyStyleProp( const wxString& aBodyStyle ) override
582 {
583 for( int bodyStyle = 1; bodyStyle <= GetBodyStyleCount(); bodyStyle++ )
584 {
585 if( GetBodyStyleDescription( bodyStyle, false ) == aBodyStyle )
586 {
587 SetBodyStyle( bodyStyle );
588 return;
589 }
590 }
591 }
592
603 void UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, bool aUpdateRef,
604 bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields );
605
616 void SyncOtherUnits( const SCH_SHEET_PATH& aSourceSheet, SCH_COMMIT& aCommit,
617 PROPERTY_BASE* aProperty,
618 const wxString& aVariantName = wxEmptyString );
619
623 int GetNextFieldOrdinal() const;
624
632 void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) override;
633
634 void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) override;
635
636 void ClearCaches() override;
637
638 //-----</Fields>----------------------------------------------------------
639
640
647 SCH_PIN* GetPin( const wxString& number ) const;
648
656 SCH_PIN* GetPinByEffectivePadNumber( const wxString& aPadNumber, const SCH_SHEET_PATH* aSheet,
657 const wxString& aVariantName = wxEmptyString ) const;
658
668 std::vector<SCH_PIN*> GetPinsByNumber( const wxString& aNumber ) const;
669
674 std::vector<SCH_PIN*> GetLibPins() const;
675
680 std::vector<SCH_PIN*> GetAllLibPins() const;
681
685 size_t GetFullPinCount() const;
686
690 SCH_PIN* GetPin( SCH_PIN* aLibPin ) const;
691
699 const SCH_PIN* GetPin( const VECTOR2I& aPosition ) const;
700
709 std::vector<const SCH_PIN*> GetPins( const SCH_SHEET_PATH* aSheet ) const;
710 std::vector<SCH_PIN*> GetPins( const SCH_SHEET_PATH* aSheet );
711
712 std::vector<SCH_PIN*> GetGraphicalPins( int aUnit, int aBodyStyle ) const override;
713
714
715 std::vector<std::unique_ptr<SCH_PIN>>& GetRawPins() { return m_pins; }
716 const std::vector<std::unique_ptr<SCH_PIN>>& GetRawPins() const { return m_pins; }
717
724 void SetRef( const SCH_SHEET_PATH* aSheet, const wxString& aReference );
725
735 wxString BaseRefFromUser( const SCH_SHEET_PATH& aSheet, const wxString& aText, wxString& aBase,
736 const SCHEMATIC* aSchematic = nullptr ) const;
737
742 void SetUserRef( const SCH_SHEET_PATH& aSheet, const wxString& aBase );
743
745 void SetRefLacksSuffix( const KIID_PATH& aPath, bool aLacksSuffix = true );
746
753 bool IsAnnotated( const SCH_SHEET_PATH* aSheet ) const;
754
763 void AddHierarchicalReference( const KIID_PATH& aPath,
764 const wxString& aRef,
765 int aUnit );
766
767 void AddHierarchicalReference( const SCH_SYMBOL_INSTANCE& aInstance );
768
770 int GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const;
771
773 void SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSelection );
774
776 void SetUnitSelection( int aUnitSelection );
777
778 virtual void SetDNP( bool aEnable, const SCH_SHEET_PATH* aInstance = nullptr,
779 const wxString& aVariantName = wxEmptyString ) override;
780 virtual bool GetDNP( const SCH_SHEET_PATH* aInstance = nullptr,
781 const wxString& aVariantName = wxEmptyString ) const override;
782
783 bool GetDNPProp() const;
784
785 void SetDNPProp( bool aEnable );
786
793 void SetPinMapOverride( const PIN_MAP_INSTANCE_OVERRIDE& aOverride, const SCH_SHEET_PATH* aInstance = nullptr,
794 const wxString& aVariantName = wxEmptyString );
795
803 const wxString& aVariantName = wxEmptyString ) const;
804
809
810 void SetExcludedFromBOM( bool aEnable, const SCH_SHEET_PATH* aInstance = nullptr,
811 const wxString& aVariantName = wxEmptyString ) override;
812 bool GetExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
813 const wxString& aVariantName = wxEmptyString ) const override;
814
815 bool GetExcludedFromBOMProp() const;
816
817 void SetExcludedFromBOMProp( bool aEnable );
818
819 void SetExcludedFromSim( bool aEnable, const SCH_SHEET_PATH* aInstance = nullptr,
820 const wxString& aVariantName = wxEmptyString ) override;
821 bool GetExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
822 const wxString& aVariantName = wxEmptyString ) const override;
823
824 bool GetExcludedFromSimProp() const;
825
826 void SetExcludedFromSimProp( bool aEnable );
827
828 void SetExcludedFromBoard( bool aEnable, const SCH_SHEET_PATH* aInstance = nullptr,
829 const wxString& aVariantName = wxEmptyString ) override;
830 bool GetExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
831 const wxString& aVariantName = wxEmptyString ) const override;
832
833 bool GetExcludedFromBoardProp() const;
834
835 void SetExcludedFromBoardProp( bool aEnable );
836
837 void SetExcludedFromPosFiles( bool aEnable, const SCH_SHEET_PATH* aInstance = nullptr,
838 const wxString& aVariantName = wxEmptyString ) override;
839 bool GetExcludedFromPosFiles( const SCH_SHEET_PATH* aInstance = nullptr,
840 const wxString& aVariantName = wxEmptyString ) const override;
841
842 bool GetExcludedFromPosFilesProp() const;
843
844 void SetExcludedFromPosFilesProp( bool aEnable );
845
851
852 void Move( const VECTOR2I& aMoveVector ) override
853 {
854 if( aMoveVector == VECTOR2I( 0, 0 ) )
855 return;
856
857 m_pos += aMoveVector;
858
859 for( SCH_FIELD& field : m_fields )
860 field.Move( aMoveVector );
861 }
862
863 void MirrorHorizontally( int aCenter ) override;
864 void MirrorVertically( int aCenter ) override;
865 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
866
867 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
868
869 void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;
870
883 bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
884 std::vector<DANGLING_END_ITEM>& aItemListByPos,
885 const SCH_SHEET_PATH* aPath = nullptr ) override;
886
887 VECTOR2I GetPinPhysicalPosition( const SCH_PIN* Pin ) const;
888
889 bool IsConnectable() const override { return true; }
890
891 bool HasConnectivityChanges( const SCH_ITEM* aItem,
892 const SCH_SHEET_PATH* aInstance = nullptr ) const override;
893
894 bool CanConnect( const SCH_ITEM* aItem ) const override
895 {
896 return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
897 ( aItem->Type() == SCH_NO_CONNECT_T ) ||
898 ( aItem->Type() == SCH_JUNCTION_T ) ||
899 ( aItem->Type() == SCH_SYMBOL_T ) ||
900 ( aItem->Type() == SCH_DIRECTIVE_LABEL_T ) ||
901 ( aItem->Type() == SCH_LABEL_T ) ||
902 ( aItem->Type() == SCH_HIER_LABEL_T ) ||
903 ( aItem->Type() == SCH_GLOBAL_LABEL_T );
904 }
905
909 bool DoNetList() const;
910
917
920 {
921 if( m_passthroughMode != aMode )
922 {
923 m_passthroughMode = aMode;
925 }
926 }
927
928 const wxString& GetNetChainName() const { return m_signalName; }
929 void SetNetChainName( wxString aName ) noexcept { m_signalName.swap( aName ); }
930
931 std::vector<VECTOR2I> GetConnectionPoints() const override;
932
933 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
934 const std::vector<KICAD_T>& aScanTypes ) override;
935
943 SCH_ITEM* GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType = TYPE_NOT_INIT );
944
945 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
946
947 BITMAPS GetMenuImage() const override;
948
949 bool operator <( const SCH_ITEM& aItem ) const override;
950
951 bool operator==( const SCH_SYMBOL& aSymbol) const;
952 bool operator!=( const SCH_SYMBOL& aSymbol) const;
953
954 SCH_SYMBOL& operator=( const SCH_SYMBOL& aItem );
955
956 bool IsReplaceable() const override { return true; }
957
958 VECTOR2I GetPosition() const override { return m_pos; }
959 void SetPosition( const VECTOR2I& aPosition ) override { Move( aPosition - m_pos ); }
960
961 int GetX() const { return GetPosition().x; };
962 void SetX( int aX ) { SetPosition( VECTOR2I( aX, GetY() ) ); }
963
964 int GetY() const { return GetPosition().y; }
965 void SetY( int aY ) { SetPosition( VECTOR2I( GetX(), aY ) ); }
966
967 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
968 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
969 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
970
971 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
972 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
973
982 void PlotPins( PLOTTER* aPlotter, bool aDnp ) const;
983
989 void PlotLocalPowerIconShape( PLOTTER* aPlotter ) const;
990
997 void PlotDNP( PLOTTER* aPlotter ) const;
998
1008 static void BuildLocalPowerIconShape( std::vector<SCH_SHAPE>& aShapeList, const VECTOR2D& aPos,
1009 double aSize, double aLineWidth, bool aHorizontal );
1010
1011 EDA_ITEM* Clone() const override;
1012
1013 void Serialize( google::protobuf::Any& aContainer ) const override;
1014 bool Deserialize( const google::protobuf::Any& aContainer ) override;
1015
1016 void Serialize( kiapi::schematic::types::SchematicSymbolInstance& aSymbol ) const;
1017 bool Deserialize( const kiapi::schematic::types::SchematicSymbolInstance& aSymbol );
1018
1019#if defined(DEBUG)
1020 void Show( int nestLevel, std::ostream& os ) const override;
1021#endif
1022
1023 void ClearBrightenedPins();
1024
1025 bool HasBrightenedPins();
1026
1027 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override;
1028
1034 bool IsSymbolLikePowerGlobalLabel() const;
1035 bool IsSymbolLikePowerLocalLabel() const;
1036
1037 bool IsGlobalPower() const override;
1038 bool IsLocalPower() const override;
1039 bool IsPower() const override;
1040 bool IsNormal() const override;
1041
1042 void SetLocalPowerProp( bool aLocal );
1043
1044 bool GetShowPinNames() const override;
1045 void SetShowPinNames( bool aShow ) override;
1046
1047 bool GetShowPinNumbers() const override;
1048 void SetShowPinNumbers( bool aShow ) override;
1049
1050 double Similarity( const SCH_ITEM& aOther ) const override;
1051
1053 std::unordered_set<wxString> GetComponentClassNames( const SCH_SHEET_PATH* aPath,
1054 const wxString& aVariantName ) const;
1055
1056 void DeleteVariant( const KIID_PATH& aPath, const wxString& aVariantName );
1057
1058 // Remove a variant's override of one field
1059 void ClearVariantField( const KIID_PATH& aPath, const wxString& aVariantName,
1060 const wxString& aFieldName );
1061
1062 void RenameVariant( const KIID_PATH& aPath, const wxString& aOldName, const wxString& aNewName );
1063
1064 void CopyVariant( const KIID_PATH& aPath, const wxString& aSourceVariant,
1065 const wxString& aNewVariant );
1066
1067 std::optional<SCH_SYMBOL_VARIANT> GetVariant( const SCH_SHEET_PATH& aInstance, const wxString& aVariantName ) const;
1068 void AddVariant( const SCH_SHEET_PATH& aInstance, const SCH_SYMBOL_VARIANT& aVariant );
1069
1075 void SetVariantSymbolOverride( const SCH_SHEET_PATH& aPath, const wxString& aVariantName,
1076 const LIB_ID& aLibId );
1077
1083 bool ClearVariantSymbolOverride( const SCH_SHEET_PATH& aPath, const wxString& aVariantName );
1084
1088 std::vector<LIB_ID> GetVariantSymbolOverrides() const;
1089
1095 std::unique_ptr<LIB_SYMBOL> LoadAlternateFromLibrary( const LIB_ID& aLibId ) const;
1096
1108 LIB_SYMBOL* GetVariantLibSymbol( const wxString& aVariantName,
1109 const SCH_SHEET_PATH& aPath ) const;
1110
1120 const LIB_SYMBOL* GetEffectiveLibSymbol( const SCH_SHEET_PATH* aPath = nullptr ) const;
1121
1133 std::vector<SCH_PIN*> MapLibPins( const std::vector<SCH_PIN*>& aLibPins, bool aByNumber ) const;
1134
1135 void DeleteVariant( const SCH_SHEET_PATH& aInstance, const wxString& aVariantName )
1136 {
1137 DeleteVariant( aInstance.Path(), aVariantName );
1138 }
1139
1140 void RenameVariant( const SCH_SHEET_PATH& aInstance, const wxString& aOldName, const wxString& aNewName )
1141 {
1142 RenameVariant( aInstance.Path(), aOldName, aNewName );
1143 }
1144
1145 void CopyVariant( const SCH_SHEET_PATH& aInstance, const wxString& aSourceVariant,
1146 const wxString& aNewVariant )
1147 {
1148 CopyVariant( aInstance.Path(), aSourceVariant, aNewVariant );
1149 }
1150
1151 bool operator==( const SCH_ITEM& aOther ) const override;
1152
1153protected:
1154 void swapData( SCH_ITEM* aItem ) override;
1155
1157 {
1158 bool operator()( const SCH_PIN* aFirst, const SCH_PIN* aSecond ) const
1159 {
1160 return *aFirst < *aSecond;
1161 }
1162 };
1163
1164private:
1165 // Copy construction must relink pins without invalidating the live source screen.
1166 void updatePins();
1167
1168 BOX2I doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
1169
1170 bool doIsConnected( const VECTOR2I& aPosition ) const override;
1171
1172 void Init( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
1173
1174 void setVariantAttribute( bool aEnable, const SCH_SHEET_PATH* aInstance, const wxString& aVariantName,
1175 bool SCH_SYMBOL::*aBase, bool SCH_SYMBOL_VARIANT::*aOverride );
1176
1177 SCH_SYMBOL_INSTANCE* getInstance( const KIID_PATH& aPath );
1178 const SCH_SYMBOL_INSTANCE* getInstance( const KIID_PATH& aPath ) const;
1179
1180 SCH_SYMBOL_INSTANCE* getInstance( const SCH_SHEET_PATH& aPath ) { return getInstance( aPath.Path() ); }
1181 const SCH_SYMBOL_INSTANCE* getInstance( const SCH_SHEET_PATH& aPath ) const { return getInstance( aPath.Path() ); }
1182
1185 const wxString& aVariantName ) const;
1186
1188
1192 wxString refFor( const SCH_SHEET_PATH* aSheet, bool aIncludeUnit, bool aCompose,
1193 std::optional<int> aUnit = std::nullopt ) const;
1194
1195private:
1198 wxString m_prefix;
1202
1211
1212 std::vector<SCH_FIELD> m_fields;
1213
1216 mutable std::map<wxString, std::unique_ptr<SCH_SYMBOL_FIELD_PROPERTY>> m_fieldPropsStorageCache;
1217
1220 mutable std::map<wxString, std::unique_ptr<PROPERTY_BASE>> m_pinMapPropsStorageCache;
1221
1222 std::unique_ptr<LIB_SYMBOL> m_part;
1225
1227
1229
1230 std::vector<std::unique_ptr<SCH_PIN>> m_pins;
1231 std::unordered_map<SCH_PIN*, SCH_PIN*> m_pinMap;
1232
1236
1242 std::vector<SCH_SYMBOL_INSTANCE> m_instances;
1243
1248 std::unordered_map<KIID_PATH, size_t> m_instancePathIndex;
1249
1250 mutable std::map<wxString, std::unique_ptr<LIB_SYMBOL>> m_variantSymbolCache;
1251
1253 static std::unordered_map<TRANSFORM, int> s_transformToOrientationCache;
1254};
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:917
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:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:84
A collection of LIB_SYMBOL objects.
Object used to load, save, search, and otherwise manipulate symbol library files.
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
Define a library symbol object.
Definition lib_symbol.h:114
EDA_MSG_PANEL items for displaying messages.
Definition msgpanel.h:50
Base plotter engine class.
Definition plotter.h:138
Holds all the data relating to one schematic.
Definition schematic.h:155
Commit for the schematic and symbol editors.
Definition sch_commit.h:54
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:170
int GetBodyStyle() const
Definition sch_item.h:253
friend class LIB_SYMBOL
Definition sch_item.h:822
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition sch_item.h:353
void SetConnectivityDirty(bool aDirty=true)
Set the dirty flag.
Definition sch_item.cpp:314
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:65
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.
Variant information for a schematic symbol.
Schematic symbol object.
Definition sch_symbol.h:76
wxString GetUnitDisplayName(int aUnit, bool aLabel) const override
Return the display name for a given unit aUnit.
SCH_SYMBOL & operator=(const SCH_SYMBOL &aItem)
wxString refFor(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit, bool aCompose, std::optional< int > aUnit=std::nullopt) const
int GetUnitProp() const
size_t GetFullPinCount() const
std::vector< SCH_SYMBOL_INSTANCE > m_instances
Define the hierarchical path and reference of the symbol.
void UpdatePrefix()
Set the prefix based on the current reference designator.
wxString m_prefix
C, R, U, Q etc - the first character(s) which typically indicate what the symbol is.
wxString GetDescription() const override
std::unordered_map< SCH_PIN *, SCH_PIN * > m_pinMap
Library pin pointer : SCH_PIN indices.
void SetMirrorX(bool aMirror)
Definition sch_symbol.h:325
bool IsSymbolLikePowerGlobalLabel() const
VECTOR2I m_pos
PASSTHROUGH_MODE GetPassthroughMode() const
Definition sch_symbol.h:918
EMBEDDED_FILES * GetEmbeddedFiles() override
SCH_SYMBOLs don't currently support embedded files, but their LIB_SYMBOL counterparts do.
wxString GetSymbolIDAsString() const
Definition sch_symbol.h:168
std::map< wxString, std::unique_ptr< PROPERTY_BASE > > m_pinMapPropsStorageCache
Same for effective pin-map entries.
LIB_ID m_lib_id
Name and library the symbol was loaded from, i.e. 74xx:74LS00.
void ClearPinMapOverrides()
Clear the base pin-to-pad map override and every variant's override.
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
bool GetShowPinNumbers() const override
wxString GetDatasheet() const
Return the documentation text for the given part alias.
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void SetLibId(const LIB_ID &aName)
bool HasBrightenedPins()
std::vector< SCH_FIELD > & GetFields()
Return a reference to the vector holding the symbol's fields.
Definition sch_symbol.h:464
BOX2I GetBodyAndPinsBoundingBox() const override
Return a bounding box for the symbol body and pins but not the fields.
wxString GetBodyStyleProp() const override
Definition sch_symbol.h:576
void SetRefProp(const wxString &aRef)
void SetFieldText(SCH_FIELD *aField, const wxString &aFieldName, const wxString &aFieldText, const SCH_SHEET_PATH *aPath, const wxString &aVariantName)
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...
virtual void SetDNP(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
SCH_ITEM * GetDrawItem(const VECTOR2I &aPosition, KICAD_T aType=TYPE_NOT_INIT)
Return the symbol library item at aPosition that is part of this 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.
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
Definition sch_symbol.h:715
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstances() const
Definition sch_symbol.h:136
void SetPosition(const VECTOR2I &aPosition) override
Definition sch_symbol.h:959
void PlotDNP(PLOTTER *aPlotter) const
Plot the red 'X' over the symbol.
bool operator!=(const SCH_SYMBOL &aSymbol) const
void SetShowPinNumbers(bool aShow) override
Set or clear the pin number visibility flag.
wxString m_signalName
bool IsConnectable() const override
Definition sch_symbol.h:889
bool ClearVariantSymbolOverride(const SCH_SHEET_PATH &aPath, const wxString &aVariantName)
Remove the alternate-symbol override for a given variant and sheet instance.
SYMBOL_ORIENTATION_PROP GetOrientationProp() const
Definition sch_symbol.h:308
std::map< wxString, std::unique_ptr< LIB_SYMBOL > > m_variantSymbolCache
int GetY() const
Definition sch_symbol.h:964
SCH_SYMBOL_INSTANCE * getInstance(const KIID_PATH &aPath)
wxString SubReference(int aUnit, bool aAddSeparator=true) const
bool m_doNetlist
True if the symbol should appear in netlist.
wxString GetClass() const override
Return the class name.
Definition sch_symbol.h:116
void setVariantAttribute(bool aEnable, const SCH_SHEET_PATH *aInstance, const wxString &aVariantName, bool SCH_SYMBOL::*aBase, bool SCH_SYMBOL_VARIANT::*aOverride)
void RemoveInstance(const SCH_SHEET_PATH &aInstancePath)
void CopyVariant(const SCH_SHEET_PATH &aInstance, const wxString &aSourceVariant, const wxString &aNewVariant)
bool IsAnnotated(const SCH_SHEET_PATH *aSheet) const
Check if the symbol has a valid annotation (reference) for the given sheet path.
void SetMirrorY(bool aMirror)
Definition sch_symbol.h:342
wxString GetCurrentSheetRef() const
void SetBodyStyleProp(const wxString &aBodyStyle) override
Definition sch_symbol.h:581
void SetVariantSymbolOverride(const SCH_SHEET_PATH &aPath, const wxString &aVariantName, const LIB_ID &aLibId)
Set the alternate-symbol override for a given variant and sheet instance.
bool UseLibIdLookup() const
Definition sch_symbol.h:183
wxString BaseRefFromUser(const SCH_SHEET_PATH &aSheet, const wxString &aText, wxString &aBase, const SCHEMATIC *aSchematic=nullptr) const
Convert a reference typed on aSheet to the base reference.
int GetX() const
Definition sch_symbol.h:961
bool IsMultiBodyStyle() const override
Definition sch_symbol.h:267
bool GetExcludedFromPosFilesProp() const
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
Automatically orient all the fields in the symbol.
std::vector< LIB_ID > GetVariantSymbolOverrides() const
void SetExcludedFromSim(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear the exclude from simulation flag.
void SetExcludedFromSimProp(bool aEnable)
void SetBodyStyle(int aBodyStyle) override
void SetShowPinNames(bool aShow) override
Set or clear the pin name visibility flag.
wxString GetKeyWords() const override
const std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins() const
Definition sch_symbol.h:716
bool SetInstanceProjectName(const KIID_PATH &aSheetPath, const wxString &aProjectName)
Set the owning project of the instance stored for aSheetPath.
wxString GetSchSymbolLibraryName() const
void ClearCaches() override
const wxString & GetNetChainName() const
Definition sch_symbol.h:928
static bool ClassOf(const EDA_ITEM *aItem)
Definition sch_symbol.h:111
void DeleteVariant(const SCH_SHEET_PATH &aInstance, const wxString &aVariantName)
const wxString GetFootprintFieldText(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString) const
PASSTHROUGH_MODE m_passthroughMode
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition sch_symbol.h:852
std::optional< SCH_SYMBOL_VARIANT > GetVariant(const SCH_SHEET_PATH &aInstance, const wxString &aVariantName) const
PIN_MAP_INSTANCE_OVERRIDE GetPinMapOverride(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
bool GetExcludedFromBoardProp() const
void ClearBrightenedPins()
void SetY(int aY)
Definition sch_symbol.h:965
std::vector< SCH_PIN * > MapLibPins(const std::vector< SCH_PIN * > &aLibPins, bool aByNumber) const
Map pins of an effective library symbol to this symbol's instance pins.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
bool GetExcludedFromSimProp() const
wxString GetBaseRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
bool DoNetList() const
bool IsGlobalPower() const override
bool GetMirrorX() const
Definition sch_symbol.h:337
wxString GetRefProp() const
void SetPinMapOverride(const PIN_MAP_INSTANCE_OVERRIDE &aOverride, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Set the per-instance pin-to-pad map override (issue #2282).
wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const override
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instances), if this entry does not already exist.
wxString GetShownKeyWords(RESOLUTION_CONTEXT aContext, int aDepth=0) const override
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
void SetLocalPowerProp(bool aLocal)
void SetExcludedFromBOMProp(bool aEnable)
void ClearVariantField(const KIID_PATH &aPath, const wxString &aVariantName, const wxString &aFieldName)
static std::unordered_map< TRANSFORM, int > s_transformToOrientationCache
void SetRefLacksSuffix(const KIID_PATH &aPath, bool aLacksSuffix=true)
Flag the reference loaded for aPath as saved without its sheet suffix.
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
SCH_FIELD * FindFieldCaseInsensitive(const wxString &aFieldName)
Search for a SCH_FIELD with aFieldName.
const std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef() const
Definition sch_symbol.h:186
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.
wxString m_schLibSymbolName
The name used to look up a symbol in the symbol library embedded in a schematic.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the base reference for the given sheet path for this symbol.
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
SCH_PIN * GetPinByEffectivePadNumber(const wxString &aPadNumber, const SCH_SHEET_PATH *aSheet, const wxString &aVariantName=wxEmptyString) const
Find the pin whose effective footprint pad number (issue #2282) is aPadNumber on aSheet,...
void RenameVariant(const KIID_PATH &aPath, const wxString &aOldName, const wxString &aNewName)
bool IsMultiUnit() const override
Definition sch_symbol.h:258
void SetOrientationProp(SYMBOL_ORIENTATION_PROP aAngle)
Orientation/mirroring access for property manager.
Definition sch_symbol.h:299
bool GetShowPinNames() const override
bool HasDeMorganBodyStyles() const override
std::vector< SCH_FIELD > m_fields
Variable length list of fields.
wxString GetUnitRef(const SCH_SHEET_PATH *aSheet, int aUnit) const
std::vector< SCH_PIN * > GetAllLibPins() const
int GetBodyStyleCount() const override
Return the number of body styles of the symbol.
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
std::unique_ptr< LIB_SYMBOL > LoadAlternateFromLibrary(const LIB_ID &aLibId) const
Load a flattened copy of an alternate symbol from the project's symbol libraries.
bool GetDNPProp() const
void PlotPins(PLOTTER *aPlotter, bool aDnp) const
Plot just the symbol pins.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void SetFootprintFieldText(const wxString &aFootprint)
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.
wxString GetShownDescription(RESOLUTION_CONTEXT aContext, int aDepth=0) const override
std::unordered_map< KIID_PATH, size_t > m_instancePathIndex
Index from an instance's sheet path to its position in m_instances for O(1) lookups.
bool IsMissingLibSymbol() const
Check to see if the library symbol is set to the dummy library symbol.
VECTOR2I GetPosition() const override
Definition sch_symbol.h:958
PIN_MAP_INSTANCE_OVERRIDE resolveDelegatedPinMapOverride(const SCH_SHEET_PATH &aSheet, const wxString &aVariantName) const
Return unit 1's pin-map override for a unit that delegates to it (issue #2282).
std::unique_ptr< LIB_SYMBOL > m_part
A flattened copy of the LIB_SYMBOL from the PROJECT object's libraries.
int GetNextFieldOrdinal() const
Return the next ordinal for a user field for this symbol.
void SetExcludedFromPosFiles(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
void rebuildInstancePathIndex()
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
const std::vector< SCH_FIELD > & GetFields() const
Definition sch_symbol.h:465
std::unordered_set< wxString > GetComponentClassNames(const SCH_SHEET_PATH *aPath, const wxString &aVariantName) const
Return the component classes this symbol belongs in.
SCH_SYMBOL_INSTANCE * getInstance(const SCH_SHEET_PATH &aPath)
bool CanConnect(const SCH_ITEM *aItem) const override
Definition sch_symbol.h:894
void SyncOtherUnits(const SCH_SHEET_PATH &aSourceSheet, SCH_COMMIT &aCommit, PROPERTY_BASE *aProperty, const wxString &aVariantName=wxEmptyString)
Keep fields other than the reference, include/exclude flags, and alternate pin assignments in sync in...
void Init(const VECTOR2I &pos=VECTOR2I(0, 0))
void SetExcludedFromPosFilesProp(bool aEnable)
void updatePins()
const LIB_SYMBOL * GetEffectiveLibSymbol(const SCH_SHEET_PATH *aPath=nullptr) const
Return the library symbol to use for rendering and bounding box calculations.
void SetNetChainName(wxString aName) noexcept
Definition sch_symbol.h:929
const LIB_ID & GetLibId() const override
Definition sch_symbol.h:166
bool operator<(const SCH_ITEM &aItem) const override
static void BuildLocalPowerIconShape(std::vector< SCH_SHAPE > &aShapeList, const VECTOR2D &aPos, double aSize, double aLineWidth, bool aHorizontal)
Build the local power pin indicator icon shape, at coordinate aPos.
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
LIB_SYMBOL * GetVariantLibSymbol(const wxString &aVariantName, const SCH_SHEET_PATH &aPath) const
Resolve the alternate library symbol for a given variant.
void SetValueProp(const wxString &aValue)
void SetUnitProp(int aUnit)
void SetUserRef(const SCH_SHEET_PATH &aSheet, const wxString &aBase)
Set a base reference chosen by the user on aSheet.
void RenameVariant(const SCH_SHEET_PATH &aInstance, const wxString &aOldName, const wxString &aNewName)
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
Definition sch_symbol.h:181
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void SetValueFieldText(const wxString &aValue, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
std::vector< SCH_PIN * > GetLibPins() const
Populate a vector with all the pins from the library object that match the current unit and bodyStyle...
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos, const SCH_SHEET_PATH *aPath=nullptr) override
Test if the symbol's dangling state has changed for all pins.
std::vector< SCH_PIN * > GetGraphicalPins(int aUnit, int aBodyStyle) const override
bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
bool GetInstance(SCH_SYMBOL_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
void AddVariant(const SCH_SHEET_PATH &aInstance, const SCH_SYMBOL_VARIANT &aVariant)
BOX2I doGetBoundingBox(bool aIncludePins, bool aIncludeFields) const
bool GetMirrorY() const
Definition sch_symbol.h:354
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
void SetDNPProp(bool aEnable)
static uint64_t RefGeneration()
Count of changes to any symbol's references, units, library links or placement.
bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
std::vector< SCH_PIN * > GetPinsByNumber(const wxString &aNumber) const
Find all symbol pins with the given number.
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
std::vector< PROPERTY_BASE * > GetDynamicProperties() const override
Return dynamically-computed properties specific to this object instance (e.g.
void RemoveField(SCH_FIELD *aField)
Definition sch_symbol.h:486
void SetPassthroughMode(PASSTHROUGH_MODE aMode)
Definition sch_symbol.h:919
void SetX(int aX)
Definition sch_symbol.h:962
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
const wxString GetValue(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString) const override
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
static void BumpRefGeneration()
Mark every cache built from references as stale.
const SCH_SYMBOL_INSTANCE * getInstance(const SCH_SHEET_PATH &aPath) const
PIN_MAP_INSTANCE_OVERRIDE m_pinMapOverride
Base (no-variant) pin-to-pad map override applied when no variant override exists for the sheet path ...
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
wxString GetValueProp() const
bool IsLocalPower() const override
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
int GetUnitCount() const override
Return the number of units per package of the symbol.
void SetPrefix(const wxString &aPrefix)
Definition sch_symbol.h:242
int GetOrientation() const override
Get the display symbol orientation.
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
bool IsSymbolLikePowerLocalLabel() const
bool GetExcludedFromBOMProp() const
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
void SetExcludedFromBoardProp(bool aEnable)
void SetExcludedFromBOM(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear the exclude from schematic bill of materials flag.
void PlotLocalPowerIconShape(PLOTTER *aPlotter) const
Plot the local power pin indicator icon shape.
bool IsNormal() const override
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition sch_symbol.h:185
std::vector< std::unique_ptr< SCH_PIN > > m_pins
A copy of SCH_PIN objects from the library symbol.
void DeleteVariant(const KIID_PATH &aPath, const wxString &aVariantName)
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition sch_symbol.h:956
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
VECTOR2I GetPinPhysicalPosition(const SCH_PIN *Pin) const
BOX2I GetBodyBoundingBox() const override
Return a bounding box for the symbol body but not the pins or fields.
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flag.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
wxString GetFieldText(const SCH_FIELD *aField, const wxString &aFieldName, const SCH_SHEET_PATH *aPath, const wxString &aVariantName) const
wxString GetPrefix() const
Definition sch_symbol.h:241
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
bool IsMovableFromAnchorPoint() const override
Return true for items which are moved with the anchor point at mouse cursor and false for items moved...
bool IsPower() const override
void SetExcludedFromBoard(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
void CopyVariant(const KIID_PATH &aPath, const wxString &aSourceVariant, const wxString &aNewVariant)
bool HasEffectiveAssociatedFootprint() const
std::map< wxString, std::unique_ptr< SCH_SYMBOL_FIELD_PROPERTY > > m_fieldPropsStorageCache
Per-object cache of dynamic property descriptors for custom fields, keyed by descriptor name and popu...
bool operator==(const SCH_SYMBOL &aSymbol) const
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
SYMBOL(KICAD_T idType)
Definition symbol.h:62
RESOLUTION_CONTEXT
Definition common.h:91
RECURSE_MODE
Definition eda_item.h:50
INSPECT_RESULT
Definition eda_item.h:44
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition eda_item.h:91
@ LAYER_WIRE
Definition layer_ids.h:483
AUTOPLACE_ALGO
Definition sch_item.h:73
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 ...
std::weak_ptr< LIB_SYMBOL > PART_REF
Definition sch_symbol.h:66
Per-instance override of the active pin map and a sparse delta on top.
Definition pin_map.h:200
bool operator()(const SCH_PIN *aFirst, const SCH_PIN *aSecond) const
A simple container for schematic symbol instance information.
SYMBOL_ORIENTATION_PROP
Definition symbol.h:48
@ SYMBOL_ANGLE_180
Definition symbol.h:51
@ SYMBOL_ANGLE_0
Definition symbol.h:49
@ SYMBOL_ANGLE_90
Definition symbol.h:50
@ SYMBOL_ANGLE_270
Definition symbol.h:52
SYMBOL_ORIENTATION_T
enum used in RotationMiroir()
Definition symbol.h:32
@ SYM_ORIENT_270
Definition symbol.h:39
@ SYM_MIRROR_Y
Definition symbol.h:41
@ SYM_ORIENT_180
Definition symbol.h:38
@ SYM_MIRROR_X
Definition symbol.h:40
@ SYM_NORMAL
Definition symbol.h:33
@ SYM_ORIENT_90
Definition symbol.h:37
@ SYM_ORIENT_0
Definition symbol.h:36
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
static EDA_ORIENTATION orientation(double d)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:70
@ SCH_LINE_T
Definition typeinfo.h:159
@ SCH_NO_CONNECT_T
Definition typeinfo.h:156
@ TYPE_NOT_INIT
Definition typeinfo.h:73
@ SCH_SYMBOL_T
Definition typeinfo.h:168
@ SCH_DIRECTIVE_LABEL_T
Definition typeinfo.h:167
@ SCH_LABEL_T
Definition typeinfo.h:163
@ SCH_HIER_LABEL_T
Definition typeinfo.h:165
@ SCH_GLOBAL_LABEL_T
Definition typeinfo.h:164
@ SCH_JUNCTION_T
Definition typeinfo.h:155
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708
VECTOR2< double > VECTOR2D
Definition vector2d.h:707