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 <string>
34#include <unordered_map>
35#include <vector>
36#include <wx/arrstr.h>
37#include <wx/chartype.h>
38#include <wx/string.h>
39
40#include <symbol.h>
41#include <sch_field.h>
42#include <sch_pin.h>
43#include <sch_sheet_path.h> // SCH_SYMBOL_INSTANCE
44#include <transform.h>
45
46struct PICKED_SYMBOL;
47class KIID_PATH;
48class SCH_SCREEN;
49class LIB_SYMBOL;
50class MSG_PANEL_ITEM;
53class SCH_SCREEN;
54class SCH_COMMIT;
55class SCH_SHAPE;
57
58
60{
61class SchematicSymbolInstance;
62}
63
64
65typedef std::weak_ptr<LIB_SYMBOL> PART_REF;
66
67
68extern std::string toUTFTildaText( const wxString& txt );
69
70
74class SCH_SYMBOL : public SYMBOL
75{
76public:
77 SCH_SYMBOL();
78
90 SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
91 int aUnit, int aBodyStyle = 0, const VECTOR2I& aPosition = VECTOR2I( 0, 0 ),
92 EDA_ITEM* aParent = nullptr );
93
94 SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
95 const VECTOR2I& aPosition = VECTOR2I( 0, 0 ), EDA_ITEM* aParent = nullptr );
96
106 SCH_SYMBOL( const SCH_SYMBOL& aSymbol );
107
108 ~SCH_SYMBOL();
109
110 static inline bool ClassOf( const EDA_ITEM* aItem )
111 {
112 return aItem && SCH_SYMBOL_T == aItem->Type();
113 }
114
115 wxString GetClass() const override
116 {
117 return wxT( "SCH_SYMBOL" );
118 }
119
133 bool IsMissingLibSymbol() const;
134
135 const std::vector<SCH_SYMBOL_INSTANCE>& GetInstances() const
136 {
137 return m_instances;
138 }
139
140 bool GetInstance( SCH_SYMBOL_INSTANCE& aInstance,
141 const KIID_PATH& aSheetPath, bool aTestFromEnd = false ) const;
142
143 void RemoveInstance( const SCH_SHEET_PATH& aInstancePath );
144
145 void RemoveInstance( const KIID_PATH& aInstancePath );
146
161 bool IsMovableFromAnchorPoint() const override;
162
163 void SetLibId( const LIB_ID& aName );
164
165 const LIB_ID& GetLibId() const override { return m_lib_id; }
166
167 wxString GetSymbolIDAsString() const { return m_lib_id.Format(); }
168
180 void SetSchSymbolLibraryName( const wxString& aName ) { m_schLibSymbolName = aName; }
181 wxString GetSchSymbolLibraryName() const;
182 bool UseLibIdLookup() const { return m_schLibSymbolName.IsEmpty(); }
183
184 std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() { return m_part; }
185 const std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() const { return m_part; }
186
188
205 void SetLibSymbol( LIB_SYMBOL* aLibSymbol );
206
210 wxString GetDescription() const override;
211 wxString GetShownDescription( RESOLUTION_CONTEXT aContext, int aDepth = 0 ) const override;
212
216 wxString GetKeyWords() const override;
217 wxString GetShownKeyWords( RESOLUTION_CONTEXT aContext, int aDepth = 0 ) const override;
218
222 wxString GetDatasheet() const;
223
227 void UpdatePins();
228
234 wxString GetUnitDisplayName( int aUnit, bool aLabel ) const override;
235
236 wxString GetBodyStyleDescription( int aBodyStyle, bool aLabel ) const override;
237
238 void SetBodyStyle( int aBodyStyle ) override;
239
240 wxString GetPrefix() const { return m_prefix; }
241 void SetPrefix( const wxString& aPrefix ) { m_prefix = aPrefix; }
242
246 void UpdatePrefix();
247
248 wxString SubReference( int aUnit, bool aAddSeparator = true ) const;
249
255 int GetUnitCount() const override;
256
257 bool IsMultiUnit() const override { return GetUnitCount() > 1; }
258
264 int GetBodyStyleCount() const override;
265
266 bool IsMultiBodyStyle() const override { return GetBodyStyleCount() > 1; }
267
268 bool HasDeMorganBodyStyles() const override;
269
276 void SetOrientation( int aOrientation );
277
293 int GetOrientation() const override;
294
299 {
300 int mirroring = GetOrientation();
301
303
304 SetOrientation( aAngle | mirroring );
305 }
306
323
324 void SetMirrorX( bool aMirror )
325 {
326 int orientation = GetOrientation();
327
328 if( aMirror )
330 else
332
333 SetOrientation( orientation );
334 }
335
336 bool GetMirrorX() const
337 {
339 }
340
341 void SetMirrorY( bool aMirror )
342 {
343 int orientation = GetOrientation();
344
345 if( aMirror )
347 else
349
350 SetOrientation( orientation );
351 }
352
353 bool GetMirrorY() const
354 {
356 }
357
361 void GetContextualTextVars( wxArrayString* aVars ) const;
362
370 bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth = 0 ) const;
371
380 bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token,
381 const wxString& aVariantName, int aDepth = 0 ) const;
382
383 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
384
395 void ClearAnnotation( const SCH_SHEET_PATH* aSheetPath, bool aResetPrefix );
396
408 bool AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPath );
409
417 bool SetInstanceProjectName( const KIID_PATH& aSheetPath, const wxString& aProjectName );
418
419
420 const BOX2I GetBoundingBox() const override;
421
425 BOX2I GetBodyBoundingBox() const override;
426
430 BOX2I GetBodyAndPinsBoundingBox() const override;
431
432
433 //-----<Fields>-----------------------------------------------------------
434
439 SCH_FIELD* GetField( FIELD_T aFieldType );
440 const SCH_FIELD* GetField( FIELD_T aFieldNdx ) const;
441
449 SCH_FIELD* GetField( const wxString& aFieldName );
450 const SCH_FIELD* GetField( const wxString& aFieldName ) const;
451
458 void GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly ) const override;
459
463 std::vector<SCH_FIELD>& GetFields() { return m_fields; }
464 const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
465
466 std::vector<PROPERTY_BASE*> GetDynamicProperties() const override;
467 std::vector<PROPERTY_BASE*> GetDynamicProperties( const SCH_SHEET_PATH* aPath ) const;
468
476 SCH_FIELD* AddField( const SCH_FIELD& aField );
477
483 void RemoveField( const wxString& aFieldName );
484
485 void RemoveField( SCH_FIELD* aField )
486 {
487 if( aField )
488 RemoveField( aField->GetName() );
489 }
490
498 SCH_FIELD* FindFieldCaseInsensitive( const wxString& aFieldName );
499 const SCH_FIELD* FindFieldCaseInsensitive( const wxString& aFieldName ) const;
500
504 const wxString GetRef( const SCH_SHEET_PATH* aSheet,
505 bool aIncludeUnit = false ) const override;
506
510 const wxString GetValue( const SCH_SHEET_PATH* aPath, RESOLUTION_CONTEXT aContext,
511 const wxString& aVariantName = wxEmptyString ) const override;
512
513 void SetValueFieldText( const wxString& aValue, const SCH_SHEET_PATH* aInstance = nullptr,
514 const wxString& aVariantName = wxEmptyString );
515
516 const wxString GetFootprintFieldText( const SCH_SHEET_PATH* aPath, RESOLUTION_CONTEXT aContext,
517 const wxString& aVariantName = wxEmptyString ) const;
518 void SetFootprintFieldText( const wxString& aFootprint );
519
520 /*
521 * Field access for property manager
522 */
523 wxString GetRefProp() const;
524
525 void SetRefProp( const wxString& aRef );
526
527 wxString GetValueProp() const;
528
529 void SetValueProp( const wxString& aValue ); // Implemented in sch_symbol.cpp for tracing
530
531 int GetUnitProp() const;
532
533 void SetFieldText( SCH_FIELD* aField, const wxString& aFieldName, const wxString& aFieldText,
534 const SCH_SHEET_PATH* aPath, const wxString& aVariantName );
535
536 void SetFieldText( const wxString& aFieldName, const wxString& aFieldText, const SCH_SHEET_PATH* aPath = nullptr,
537 const wxString& aVariantName = wxEmptyString );
538
539 wxString GetFieldText( const SCH_FIELD* aField, const wxString& aFieldName, const SCH_SHEET_PATH* aPath,
540 const wxString& aVariantName ) const;
541
542 wxString GetFieldText( const wxString& aFieldName, const SCH_SHEET_PATH* aPath = nullptr,
543 const wxString& aVariantName = wxEmptyString ) const;
544
545 void SetUnitProp( int aUnit );
546
547 wxString GetBodyStyleProp() const override
548 {
549 return GetBodyStyleDescription( GetBodyStyle(), false );
550 }
551
552 void SetBodyStyleProp( const wxString& aBodyStyle ) override
553 {
554 for( int bodyStyle = 1; bodyStyle <= GetBodyStyleCount(); bodyStyle++ )
555 {
556 if( GetBodyStyleDescription( bodyStyle, false ) == aBodyStyle )
557 {
558 SetBodyStyle( bodyStyle );
559 return;
560 }
561 }
562 }
563
574 void UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, bool aUpdateRef,
575 bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields );
576
587 void SyncOtherUnits( const SCH_SHEET_PATH& aSourceSheet, SCH_COMMIT& aCommit,
588 PROPERTY_BASE* aProperty,
589 const wxString& aVariantName = wxEmptyString );
590
594 int GetNextFieldOrdinal() const;
595
603 void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) override;
604
605 void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) override;
606
607 void ClearCaches() override;
608
609 //-----</Fields>----------------------------------------------------------
610
611
618 SCH_PIN* GetPin( const wxString& number ) const;
619
627 SCH_PIN* GetPinByEffectivePadNumber( const wxString& aPadNumber, const SCH_SHEET_PATH* aSheet,
628 const wxString& aVariantName = wxEmptyString ) const;
629
639 std::vector<SCH_PIN*> GetPinsByNumber( const wxString& aNumber ) const;
640
645 std::vector<SCH_PIN*> GetLibPins() const;
646
651 std::vector<SCH_PIN*> GetAllLibPins() const;
652
656 size_t GetFullPinCount() const;
657
661 SCH_PIN* GetPin( SCH_PIN* aLibPin ) const;
662
670 const SCH_PIN* GetPin( const VECTOR2I& aPosition ) const;
671
680 std::vector<const SCH_PIN*> GetPins( const SCH_SHEET_PATH* aSheet ) const;
681 std::vector<SCH_PIN*> GetPins( const SCH_SHEET_PATH* aSheet );
682
683 std::vector<SCH_PIN*> GetGraphicalPins( int aUnit, int aBodyStyle ) const override;
684
685
686 std::vector<std::unique_ptr<SCH_PIN>>& GetRawPins() { return m_pins; }
687 const std::vector<std::unique_ptr<SCH_PIN>>& GetRawPins() const { return m_pins; }
688
695 void SetRef( const SCH_SHEET_PATH* aSheet, const wxString& aReference );
696
703 bool IsAnnotated( const SCH_SHEET_PATH* aSheet ) const;
704
713 void AddHierarchicalReference( const KIID_PATH& aPath,
714 const wxString& aRef,
715 int aUnit );
716
717 void AddHierarchicalReference( const SCH_SYMBOL_INSTANCE& aInstance );
718
720 int GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const;
721
723 void SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSelection );
724
726 void SetUnitSelection( int aUnitSelection );
727
728 virtual void SetDNP( bool aEnable, const SCH_SHEET_PATH* aInstance = nullptr,
729 const wxString& aVariantName = wxEmptyString ) override;
730 virtual bool GetDNP( const SCH_SHEET_PATH* aInstance = nullptr,
731 const wxString& aVariantName = wxEmptyString ) const override;
732
733 bool GetDNPProp() const;
734
735 void SetDNPProp( bool aEnable );
736
743 void SetPinMapOverride( const PIN_MAP_INSTANCE_OVERRIDE& aOverride, const SCH_SHEET_PATH* aInstance = nullptr,
744 const wxString& aVariantName = wxEmptyString );
745
753 const wxString& aVariantName = wxEmptyString ) const;
754
759
760 void SetExcludedFromBOM( bool aEnable, const SCH_SHEET_PATH* aInstance = nullptr,
761 const wxString& aVariantName = wxEmptyString ) override;
762 bool GetExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
763 const wxString& aVariantName = wxEmptyString ) const override;
764
765 bool GetExcludedFromBOMProp() const;
766
767 void SetExcludedFromBOMProp( bool aEnable );
768
769 void SetExcludedFromSim( bool aEnable, const SCH_SHEET_PATH* aInstance = nullptr,
770 const wxString& aVariantName = wxEmptyString ) override;
771 bool GetExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
772 const wxString& aVariantName = wxEmptyString ) const override;
773
774 bool GetExcludedFromSimProp() const;
775
776 void SetExcludedFromSimProp( bool aEnable );
777
778 void SetExcludedFromBoard( bool aEnable, const SCH_SHEET_PATH* aInstance = nullptr,
779 const wxString& aVariantName = wxEmptyString ) override;
780 bool GetExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
781 const wxString& aVariantName = wxEmptyString ) const override;
782
783 bool GetExcludedFromBoardProp() const;
784
785 void SetExcludedFromBoardProp( bool aEnable );
786
787 void SetExcludedFromPosFiles( bool aEnable, const SCH_SHEET_PATH* aInstance = nullptr,
788 const wxString& aVariantName = wxEmptyString ) override;
789 bool GetExcludedFromPosFiles( const SCH_SHEET_PATH* aInstance = nullptr,
790 const wxString& aVariantName = wxEmptyString ) const override;
791
792 bool GetExcludedFromPosFilesProp() const;
793
794 void SetExcludedFromPosFilesProp( bool aEnable );
795
801
802 void Move( const VECTOR2I& aMoveVector ) override
803 {
804 if( aMoveVector == VECTOR2I( 0, 0 ) )
805 return;
806
807 m_pos += aMoveVector;
808
809 for( SCH_FIELD& field : m_fields )
810 field.Move( aMoveVector );
811 }
812
813 void MirrorHorizontally( int aCenter ) override;
814 void MirrorVertically( int aCenter ) override;
815 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
816
817 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
818
819 void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;
820
833 bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
834 std::vector<DANGLING_END_ITEM>& aItemListByPos,
835 const SCH_SHEET_PATH* aPath = nullptr ) override;
836
837 VECTOR2I GetPinPhysicalPosition( const SCH_PIN* Pin ) const;
838
839 bool IsConnectable() const override { return true; }
840
841 bool HasConnectivityChanges( const SCH_ITEM* aItem,
842 const SCH_SHEET_PATH* aInstance = nullptr ) const override;
843
844 bool CanConnect( const SCH_ITEM* aItem ) const override
845 {
846 return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
847 ( aItem->Type() == SCH_NO_CONNECT_T ) ||
848 ( aItem->Type() == SCH_JUNCTION_T ) ||
849 ( aItem->Type() == SCH_SYMBOL_T ) ||
850 ( aItem->Type() == SCH_DIRECTIVE_LABEL_T ) ||
851 ( aItem->Type() == SCH_LABEL_T ) ||
852 ( aItem->Type() == SCH_HIER_LABEL_T ) ||
853 ( aItem->Type() == SCH_GLOBAL_LABEL_T );
854 }
855
859 bool DoNetList() const;
860
867
870 {
871 if( m_passthroughMode != aMode )
872 {
873 m_passthroughMode = aMode;
875 }
876 }
877
878 const wxString& GetNetChainName() const { return m_signalName; }
879 void SetNetChainName( wxString aName ) noexcept { m_signalName.swap( aName ); }
880
881 std::vector<VECTOR2I> GetConnectionPoints() const override;
882
883 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
884 const std::vector<KICAD_T>& aScanTypes ) override;
885
893 SCH_ITEM* GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType = TYPE_NOT_INIT );
894
895 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
896
897 BITMAPS GetMenuImage() const override;
898
899 bool operator <( const SCH_ITEM& aItem ) const override;
900
901 bool operator==( const SCH_SYMBOL& aSymbol) const;
902 bool operator!=( const SCH_SYMBOL& aSymbol) const;
903
904 SCH_SYMBOL& operator=( const SCH_SYMBOL& aItem );
905
906 bool IsReplaceable() const override { return true; }
907
908 VECTOR2I GetPosition() const override { return m_pos; }
909 void SetPosition( const VECTOR2I& aPosition ) override { Move( aPosition - m_pos ); }
910
911 int GetX() const { return GetPosition().x; };
912 void SetX( int aX ) { SetPosition( VECTOR2I( aX, GetY() ) ); }
913
914 int GetY() const { return GetPosition().y; }
915 void SetY( int aY ) { SetPosition( VECTOR2I( GetX(), aY ) ); }
916
917 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
918 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
919 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
920
921 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
922 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
923
932 void PlotPins( PLOTTER* aPlotter, bool aDnp ) const;
933
939 void PlotLocalPowerIconShape( PLOTTER* aPlotter ) const;
940
947 void PlotDNP( PLOTTER* aPlotter ) const;
948
958 static void BuildLocalPowerIconShape( std::vector<SCH_SHAPE>& aShapeList, const VECTOR2D& aPos,
959 double aSize, double aLineWidth, bool aHorizontal );
960
961 EDA_ITEM* Clone() const override;
962
963 void Serialize( google::protobuf::Any& aContainer ) const override;
964 bool Deserialize( const google::protobuf::Any& aContainer ) override;
965
966 void Serialize( kiapi::schematic::types::SchematicSymbolInstance& aSymbol ) const;
967 bool Deserialize( const kiapi::schematic::types::SchematicSymbolInstance& aSymbol );
968
969#if defined(DEBUG)
970 void Show( int nestLevel, std::ostream& os ) const override;
971#endif
972
973 void ClearBrightenedPins();
974
975 bool HasBrightenedPins();
976
977 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override;
978
984 bool IsSymbolLikePowerGlobalLabel() const;
985 bool IsSymbolLikePowerLocalLabel() const;
986
987 bool IsGlobalPower() const override;
988 bool IsLocalPower() const override;
989 bool IsPower() const override;
990 bool IsNormal() const override;
991
992 void SetLocalPowerProp( bool aLocal );
993
994 bool GetShowPinNames() const override;
995 void SetShowPinNames( bool aShow ) override;
996
997 bool GetShowPinNumbers() const override;
998 void SetShowPinNumbers( bool aShow ) override;
999
1000 double Similarity( const SCH_ITEM& aOther ) const override;
1001
1003 std::unordered_set<wxString> GetComponentClassNames( const SCH_SHEET_PATH* aPath,
1004 const wxString& aVariantName ) const;
1005
1006 void DeleteVariant( const KIID_PATH& aPath, const wxString& aVariantName );
1007
1008 // Remove a variant's override of one field
1009 void ClearVariantField( const KIID_PATH& aPath, const wxString& aVariantName,
1010 const wxString& aFieldName );
1011
1012 void RenameVariant( const KIID_PATH& aPath, const wxString& aOldName, const wxString& aNewName );
1013
1014 void CopyVariant( const KIID_PATH& aPath, const wxString& aSourceVariant,
1015 const wxString& aNewVariant );
1016
1017 std::optional<SCH_SYMBOL_VARIANT> GetVariant( const SCH_SHEET_PATH& aInstance, const wxString& aVariantName ) const;
1018 void AddVariant( const SCH_SHEET_PATH& aInstance, const SCH_SYMBOL_VARIANT& aVariant );
1019
1025 void SetVariantSymbolOverride( const SCH_SHEET_PATH& aPath, const wxString& aVariantName,
1026 const LIB_ID& aLibId );
1027
1033 bool ClearVariantSymbolOverride( const SCH_SHEET_PATH& aPath, const wxString& aVariantName );
1034
1038 std::vector<LIB_ID> GetVariantSymbolOverrides() const;
1039
1045 std::unique_ptr<LIB_SYMBOL> LoadAlternateFromLibrary( const LIB_ID& aLibId ) const;
1046
1058 LIB_SYMBOL* GetVariantLibSymbol( const wxString& aVariantName,
1059 const SCH_SHEET_PATH& aPath ) const;
1060
1070 const LIB_SYMBOL* GetEffectiveLibSymbol( const SCH_SHEET_PATH* aPath = nullptr ) const;
1071
1083 std::vector<SCH_PIN*> MapLibPins( const std::vector<SCH_PIN*>& aLibPins, bool aByNumber ) const;
1084
1085 void DeleteVariant( const SCH_SHEET_PATH& aInstance, const wxString& aVariantName )
1086 {
1087 DeleteVariant( aInstance.Path(), aVariantName );
1088 }
1089
1090 void RenameVariant( const SCH_SHEET_PATH& aInstance, const wxString& aOldName, const wxString& aNewName )
1091 {
1092 RenameVariant( aInstance.Path(), aOldName, aNewName );
1093 }
1094
1095 void CopyVariant( const SCH_SHEET_PATH& aInstance, const wxString& aSourceVariant,
1096 const wxString& aNewVariant )
1097 {
1098 CopyVariant( aInstance.Path(), aSourceVariant, aNewVariant );
1099 }
1100
1101 bool operator==( const SCH_ITEM& aOther ) const override;
1102
1103protected:
1104 void swapData( SCH_ITEM* aItem ) override;
1105
1107 {
1108 bool operator()( const SCH_PIN* aFirst, const SCH_PIN* aSecond ) const
1109 {
1110 return *aFirst < *aSecond;
1111 }
1112 };
1113
1114private:
1115 // Copy construction must relink pins without invalidating the live source screen.
1116 void updatePins();
1117
1118 BOX2I doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
1119
1120 bool doIsConnected( const VECTOR2I& aPosition ) const override;
1121
1122 void Init( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
1123
1124 void setVariantAttribute( bool aEnable, const SCH_SHEET_PATH* aInstance, const wxString& aVariantName,
1125 bool SCH_SYMBOL::*aBase, bool SCH_SYMBOL_VARIANT::*aOverride );
1126
1127 SCH_SYMBOL_INSTANCE* getInstance( const KIID_PATH& aPath );
1128 const SCH_SYMBOL_INSTANCE* getInstance( const KIID_PATH& aPath ) const;
1129
1130 SCH_SYMBOL_INSTANCE* getInstance( const SCH_SHEET_PATH& aPath ) { return getInstance( aPath.Path() ); }
1131 const SCH_SYMBOL_INSTANCE* getInstance( const SCH_SHEET_PATH& aPath ) const { return getInstance( aPath.Path() ); }
1132
1135 const wxString& aVariantName ) const;
1136
1138
1139private:
1142 wxString m_prefix;
1146
1155
1156 std::vector<SCH_FIELD> m_fields;
1157
1160 mutable std::map<wxString, std::unique_ptr<SCH_SYMBOL_FIELD_PROPERTY>> m_fieldPropsStorageCache;
1161
1164 mutable std::map<wxString, std::unique_ptr<PROPERTY_BASE>> m_pinMapPropsStorageCache;
1165
1166 std::unique_ptr<LIB_SYMBOL> m_part;
1169
1171
1173
1174 std::vector<std::unique_ptr<SCH_PIN>> m_pins;
1175 std::unordered_map<SCH_PIN*, SCH_PIN*> m_pinMap;
1176
1180
1186 std::vector<SCH_SYMBOL_INSTANCE> m_instances;
1187
1192 std::unordered_map<KIID_PATH, size_t> m_instancePathIndex;
1193
1194 mutable std::map<wxString, std::unique_ptr<LIB_SYMBOL>> m_variantSymbolCache;
1195
1197 static std::unordered_map<TRANSFORM, int> s_transformToOrientationCache;
1198};
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:914
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
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:75
wxString GetUnitDisplayName(int aUnit, bool aLabel) const override
Return the display name for a given unit aUnit.
SCH_SYMBOL & operator=(const SCH_SYMBOL &aItem)
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:324
bool IsSymbolLikePowerGlobalLabel() const
VECTOR2I m_pos
PASSTHROUGH_MODE GetPassthroughMode() const
Definition sch_symbol.h:868
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:167
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:463
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:547
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:686
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstances() const
Definition sch_symbol.h:135
void SetPosition(const VECTOR2I &aPosition) override
Definition sch_symbol.h:909
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:839
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:307
std::map< wxString, std::unique_ptr< LIB_SYMBOL > > m_variantSymbolCache
int GetY() const
Definition sch_symbol.h:914
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:115
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:341
void SetBodyStyleProp(const wxString &aBodyStyle) override
Definition sch_symbol.h:552
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:182
int GetX() const
Definition sch_symbol.h:911
bool IsMultiBodyStyle() const override
Definition sch_symbol.h:266
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:687
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:878
static bool ClassOf(const EDA_ITEM *aItem)
Definition sch_symbol.h:110
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:802
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:915
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
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:336
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 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:185
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 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:257
void SetOrientationProp(SYMBOL_ORIENTATION_PROP aAngle)
Orientation/mirroring access for property manager.
Definition sch_symbol.h:298
bool GetShowPinNames() const override
bool HasDeMorganBodyStyles() const override
std::vector< SCH_FIELD > m_fields
Variable length list of fields.
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:908
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:464
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:844
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:879
const LIB_ID & GetLibId() const override
Definition sch_symbol.h:165
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 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:180
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:353
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
void SetDNPProp(bool aEnable)
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:485
void SetPassthroughMode(PASSTHROUGH_MODE aMode)
Definition sch_symbol.h:869
void SetX(int aX)
Definition sch_symbol.h:912
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.
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:241
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:184
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:906
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:240
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:480
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:65
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...
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