KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_item.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) 2004 Jean-Pierre Charras, [email protected]
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#pragma once
22
23#include <memory>
24#include <optional>
25#include <unordered_map>
26#include <unordered_set>
27#include <map>
28#include <set>
29
30#include <eda_item.h>
31#include <properties/property.h>
32#include <sch_sheet_path.h>
33#include <stroke_params.h>
34#include <layer_ids.h>
35
36class NETCLASS;
37class PLOTTER;
41class SCH_CONNECTION;
42class SCH_SHEET_PATH;
43class SCHEMATIC;
44class SCH_COMMIT;
45class SYMBOL;
46class LINE_READER;
47class SCH_EDIT_FRAME;
48class SCH_RULE_AREA;
49struct SCH_PLOT_OPTS;
50
51namespace KIGFX
52{
53class RENDER_SETTINGS;
54}
55
56namespace KIFONT
57{
58class METRICS;
59}
60
61
62enum BODY_STYLE : int
63{
64 BASE = 1,
66};
67
68
69#define MINIMUM_SELECTION_DISTANCE 2 // Minimum selection distance in mils
70
71
73{
74 AUTOPLACE_NONE, // No autoplacement
75 AUTOPLACE_AUTO, // A minimalist placement algorithm.
76 AUTOPLACE_MANUAL // A more involved routine that can be annoying if done from the get go.
77 // Initiated by a hotkey or menu item.
78};
79
80
94
95
101{
102public:
103 DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition )
104 {
105 m_item = aItem;
106 m_type = aType;
107 m_pos = aPosition;
108 m_parent = aItem;
109 }
110
111 DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition,
112 const EDA_ITEM* aParent )
113 {
114 m_item = aItem;
115 m_type = aType;
116 m_pos = aPosition;
117 m_parent = aParent;
118 }
119
120 bool operator==( const DANGLING_END_ITEM& aB ) const
121 {
122 return GetItem() == aB.GetItem()
123 && GetPosition() == aB.GetPosition()
124 && GetType() == aB.GetType()
125 && GetParent() == aB.GetParent();
126 }
127
128 bool operator<( const DANGLING_END_ITEM& rhs ) const
129 {
130 return( m_pos.x < rhs.m_pos.x || ( m_pos.x == rhs.m_pos.x && m_pos.y < rhs.m_pos.y )
131 || ( m_pos == rhs.m_pos && m_item < rhs.m_item ) );
132 }
133
134 VECTOR2I GetPosition() const { return m_pos; }
135 EDA_ITEM* GetItem() const { return m_item; }
136 const EDA_ITEM* GetParent() const { return m_parent; }
137 DANGLING_END_T GetType() const { return m_type; }
138
139private:
144};
145
146
148{
149public:
150 static std::vector<DANGLING_END_ITEM>::iterator
151 get_lower_pos( std::vector<DANGLING_END_ITEM>& aItemListByPos, const VECTOR2I& aPos );
152
153 static std::vector<DANGLING_END_ITEM>::iterator
154 get_lower_type( std::vector<DANGLING_END_ITEM>& aItemListByType, const DANGLING_END_T& aType );
155
156 // Both contain the same information
157 static void sort_dangling_end_items( std::vector<DANGLING_END_ITEM>& aItemListByType,
158 std::vector<DANGLING_END_ITEM>& aItemListByPos );
159};
160
161
169class SCH_ITEM : public EDA_ITEM
170{
171public:
172 SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType, int aUnit = 0, int aBodyStyle = 0 );
173
174 SCH_ITEM( const SCH_ITEM& aItem );
175
176 SCH_ITEM& operator=( const SCH_ITEM& aPin );
177
178 virtual ~SCH_ITEM();
179
180 wxString GetClass() const override
181 {
182 return wxT( "SCH_ITEM" );
183 }
184
185 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
186 {
187 if( EDA_ITEM::IsType( aScanTypes ) )
188 return true;
189
190 for( KICAD_T scanType : aScanTypes )
191 {
192 if( scanType == SCH_ITEM_LOCATE_WIRE_T && m_layer == LAYER_WIRE )
193 return true;
194
195 if ( scanType == SCH_ITEM_LOCATE_BUS_T && m_layer == LAYER_BUS )
196 return true;
197
198 if ( scanType == SCH_ITEM_LOCATE_GRAPHIC_LINE_T
199 && Type() == SCH_LINE_T && m_layer == LAYER_NOTES )
200 {
201 return true;
202 }
203 }
204
205 return false;
206 }
207
208 bool IsGroupableType() const;
209
220 void SwapItemData( SCH_ITEM* aImage );
221
225 void SwapFlags( SCH_ITEM* aItem );
226
239 SCH_ITEM* Duplicate( bool addToParentGroup, SCH_COMMIT* aCommit = nullptr, bool aDoClone = false ) const;
240
241 // Note: 0 represents "All Units", NOT the first unit
242 virtual void SetUnit( int aUnit ) { m_unit = aUnit; }
243 int GetUnit() const { return m_unit; }
244
245 virtual void SetUnitString( const wxString& aUnit );
246 virtual wxString GetUnitString() const;
247
248 virtual wxString GetUnitDisplayName( int aUnit, bool aLabel ) const;
249 virtual wxString GetBodyStyleDescription( int aBodyStyle, bool aLabel ) const;
250
251 // Note: 0 represents "All Body Styles, NOT the first body style
252 virtual void SetBodyStyle( int aBodyStyle ) { m_bodyStyle = aBodyStyle; }
253 int GetBodyStyle() const { return m_bodyStyle; }
254
255 virtual void SetBodyStyleProp( const wxString& aBodyStyle );
256 virtual wxString GetBodyStyleProp() const;
257
258 void SetPrivate( bool aPrivate ) { m_private = aPrivate; }
259 bool IsPrivate() const { return m_private; }
260
261 bool IsLocked() const override;
262 void SetLocked( bool aLocked ) override { m_isLocked = aLocked; }
263
264 virtual void SetExcludedFromSim( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
265 const wxString& aVariantName = wxEmptyString ) { }
266 virtual bool GetExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
267 const wxString& aVariantName = wxEmptyString ) const { return false; }
268 bool ResolveExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
269 const wxString& aVariantName = wxEmptyString ) const;
270
271 virtual void SetExcludedFromBOM( bool aExcludeFromBOM, const SCH_SHEET_PATH* aInstance = nullptr,
272 const wxString& aVariantName = wxEmptyString ) { }
273 virtual bool GetExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
274 const wxString& aVariantName = wxEmptyString ) const { return false; }
275 bool ResolveExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
276 const wxString& aVariantName = wxEmptyString ) const;
277
278 virtual void SetExcludedFromBoard( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
279 const wxString& aVariantName = wxEmptyString ) { }
280 virtual bool GetExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
281 const wxString& aVariantName = wxEmptyString ) const { return false; }
282 bool ResolveExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
283 const wxString& aVariantName = wxEmptyString ) const;
284
285 virtual void SetExcludedFromPosFiles( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
286 const wxString& aVariantName = wxEmptyString ) { }
287 virtual bool GetExcludedFromPosFiles( const SCH_SHEET_PATH* aInstance = nullptr,
288 const wxString& aVariantName = wxEmptyString ) const { return false; }
289 bool ResolveExcludedFromPosFiles( const SCH_SHEET_PATH* aInstance = nullptr,
290 const wxString& aVariantName = wxEmptyString ) const;
291
292 virtual void SetDNP( bool aDNP, const SCH_SHEET_PATH* aInstance = nullptr,
293 const wxString& aVariantName = wxEmptyString ) { }
294 virtual bool GetDNP( const SCH_SHEET_PATH* aInstance = nullptr,
295 const wxString& aVariantName = wxEmptyString ) const { return false; }
296 bool ResolveDNP( const SCH_SHEET_PATH* aInstance = nullptr,
297 const wxString& aVariantName = wxEmptyString ) const;
298
299 wxString ResolveText( const wxString& aText, const SCH_SHEET_PATH* aPath, int aDepth = 0 ) const;
300 wxString ResolveText( const wxString& aText, const SCH_SHEET_PATH* aPath, int aDepth,
301 const wxString& aVariantName ) const;
302
312 virtual bool IsMovableFromAnchorPoint() const { return true; }
313
315 void SetStoredPos( const VECTOR2I& aPos ) { m_storedPos = aPos; }
316
329 SCHEMATIC* Schematic() const;
330
332
333 const SYMBOL* GetParentSymbol() const;
335
340 virtual bool HasHypertext() const { return false; }
341
346 virtual bool HasHoveredHypertext() const { return HasHypertext() && IsRollover(); }
347
348 virtual void DoHypertextAction( EDA_DRAW_FRAME* aFrame, const VECTOR2I& aMousePos ) const { }
349
353 SCH_LAYER_ID GetLayer() const { return m_layer; }
354 void SetLayer( SCH_LAYER_ID aLayer ) { m_layer = aLayer; }
355
359 std::vector<int> ViewGetLayers() const override;
360
365 const BOX2I ViewBBox() const override;
366
367 int GetMaxError() const;
368
372 virtual int GetPenWidth() const { return 0; }
373
374 int GetEffectivePenWidth( const SCH_RENDER_SETTINGS* aSettings ) const;
375
376 const wxString& GetDefaultFont( const KIGFX::RENDER_SETTINGS* aSettings ) const;
377
378 const KIFONT::METRICS& GetFontMetrics() const;
379
380 bool RenderAsBitmap( double aWorldScale ) const override;
381
388 virtual double Similarity( const SCH_ITEM& aItem ) const
389 {
390 wxCHECK_MSG( false, 0.0, wxT( "Similarity not implemented in " ) + GetClass() );
391 }
392
398 double SimilarityBase( const SCH_ITEM& aItem ) const
399 {
400 double similarity = 1.0;
401
402 if( m_unit != aItem.m_unit )
403 similarity *= 0.9;
404
405 if( m_bodyStyle != aItem.m_bodyStyle )
406 similarity *= 0.9;
407
408 if( m_private != aItem.m_private )
409 similarity *= 0.9;
410
411 return similarity;
412 }
413
417 virtual void Move( const VECTOR2I& aMoveVector )
418 {
419 wxCHECK_MSG( false, /*void*/, wxT( "Move not implemented in " ) + GetClass() );
420 }
421
425 virtual void MirrorHorizontally( int aCenter )
426 {
427 wxCHECK_MSG( false, /*void*/, wxT( "MirrorHorizontally not implemented in " ) + GetClass() );
428 }
429
433 virtual void MirrorVertically( int aCenter )
434 {
435 wxCHECK_MSG( false, /*void*/, wxT( "MirrorVertically not implemented in " ) + GetClass() );
436 }
437
441 virtual void Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
442 {
443 wxCHECK_MSG( false, /*void*/, wxT( "Rotate not implemented in " ) + GetClass() );
444 }
445
455 virtual void BeginEdit( const VECTOR2I& aPosition ) {}
456
467 virtual bool ContinueEdit( const VECTOR2I& aPosition ) { return false; }
468
474 virtual void EndEdit( bool aClosed = false ) {}
475
485 virtual void CalcEdit( const VECTOR2I& aPosition ) {}
486
497 virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {}
498
517 virtual bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
518 std::vector<DANGLING_END_ITEM>& aItemListByPos,
519 const SCH_SHEET_PATH* aSheet = nullptr )
520 {
521 return false;
522 }
523
536 virtual bool IsEndPoint( const VECTOR2I& aPt ) const { return false; }
537
538 virtual bool IsDangling() const { return false; }
539
540 virtual bool CanConnect( const SCH_ITEM* aItem ) const { return m_layer == aItem->GetLayer(); }
541
545 virtual bool IsConnectable() const { return false; }
546
551 virtual bool IsPointClickableAnchor( const VECTOR2I& aPos ) const { return false; }
552
558 virtual std::vector<VECTOR2I> GetConnectionPoints() const { return {}; }
559
566 bool IsConnected( const VECTOR2I& aPoint ) const;
567
573 SCH_CONNECTION* Connection( const SCH_SHEET_PATH* aSheet = nullptr ) const;
574
579 std::optional<wxString> GetConnectionName( const SCH_SHEET_PATH* aSheet = nullptr,
580 bool aLocal = false, bool aIgnoreSheet = false ) const;
581
582 // Missing or stale published connections are not buses.
583 bool HasBusConnection( const SCH_SHEET_PATH* aSheet = nullptr ) const;
584
590 std::vector<wxString> GetBusMemberNames( const SCH_SHEET_PATH* aSheet = nullptr ) const;
591
598 bool MatchesNetName( const EDA_SEARCH_DATA& aSearchData, const SCH_SHEET_PATH* aSheet ) const;
599
603 const std::vector<SCH_ITEM*>& ConnectedItems( const SCH_SHEET_PATH& aPath ) const;
604
608 void AddConnectionTo( const SCH_SHEET_PATH& aPath, SCH_ITEM* aItem );
609
613 void ClearConnectedItems( const SCH_SHEET_PATH& aPath );
614
622
624
628 virtual bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const { return true; }
629
631
637 void SetConnectivityDirty( bool aDirty = true );
638
654 virtual bool HasConnectivityChanges( const SCH_ITEM* aItem,
655 const SCH_SHEET_PATH* aInstance = nullptr ) const
656 {
657 return false;
658 }
659
661 void SetConnectionGraph( CONNECTION_GRAPH* aGraph );
662
663 virtual bool HasCachedDriverName() const { return false; }
664 virtual const wxString& GetCachedDriverName() const;
665
666 virtual void SetLastResolvedState( const SCH_ITEM* aItem ) { }
667
668 std::shared_ptr<NETCLASS> GetEffectiveNetClass( const SCH_SHEET_PATH* aSheet = nullptr ) const;
669
675
676 virtual void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) { }
677
678 virtual void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) { }
679
680 virtual void ClearCaches();
681
689 virtual bool HasLineStroke() const { return false; }
690
691 virtual STROKE_PARAMS GetStroke() const { wxCHECK( false, STROKE_PARAMS() ); }
692
693 virtual void SetStroke( const STROKE_PARAMS& aStroke ) { wxCHECK( false, /* void */ ); }
694
695 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
696
709 virtual void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
710 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed)
711 {
712 wxCHECK_MSG( false, /*void*/, wxT( "Plot not implemented in " ) + GetClass() );
713 }
714
719
723 void AddRuleAreaToCache( SCH_RULE_AREA* aRuleArea ) { m_rule_areas_cache.insert( aRuleArea ); }
724
728 void RemoveRuleAreaFromCache( SCH_RULE_AREA* aRuleArea ) { m_rule_areas_cache.erase( aRuleArea ); }
729
733 const std::unordered_set<SCH_RULE_AREA*>& GetRuleAreaCache() const
734 {
735 return m_rule_areas_cache;
736 }
737
738 const std::vector<wxString>* GetEmbeddedFonts() override;
739
743 enum COMPARE_FLAGS : int
744 {
745 UNIT = 1 << 0,
746 POSITION = 1 << 1,
747 UUID = 1 << 2,
749 EXTRA_FIELDS = 1 << 4,
750 FIELD_TEXT = 1 << 5,
755 PIN_ALT_DEFS = 1 << 10,
758 DNP = 1 << 13,
761 IDENTITY = 1 << 17,
762 };
763
764 virtual bool operator==( const SCH_ITEM& aOther ) const;
765
766 virtual bool operator<( const SCH_ITEM& aItem ) const;
767
768protected:
776 virtual void swapData( SCH_ITEM* aItem );
777
784 void invalidateConnectivity( KICAD_T aChangedType = TYPE_NOT_INIT );
785
787
789 {
790 bool operator()( const SCH_ITEM* aFirst, const SCH_ITEM* aSecond ) const;
791 };
792
813 virtual int compare( const SCH_ITEM& aOther, int aCompareFlags = ~COMPARE_FLAGS::UNIT ) const;
814
815private:
816 friend class CONNECTION_GRAPH;
817 friend class LIB_SYMBOL;
818
820 void registerConnectivityOwner( const std::shared_ptr<CONNECTION_GRAPH_LIFETIME>& aOwner );
821
835 virtual bool doIsConnected( const VECTOR2I& aPosition ) const { return false; }
836
837protected:
839 int m_unit; // set to 0 if common to all units
840 int m_bodyStyle; // set to 0 if common to all body styles
841 bool m_private; // only shown in Symbol Editor
842 AUTOPLACE_ALGO m_fieldsAutoplaced; // indicates status of field autoplacement
843 VECTOR2I m_storedPos; // temp variable used in some move commands to store
844 // an initial position of the item or mouse cursor
845
847 std::map<SCH_SHEET_PATH, std::vector<SCH_ITEM*>, SHEET_PATH_CMP> m_connected_items;
848
850 std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> m_connection_map;
851
853
855 std::unordered_set<SCH_RULE_AREA*> m_rule_areas_cache;
856
858
859private:
861 std::vector<std::weak_ptr<CONNECTION_GRAPH_LIFETIME>> m_connectivityOwners;
862};
863
BOX2< VECTOR2I > BOX2I
Definition box2.h:914
Calculate the connectivity of a schematic and generate netlists.
static std::vector< DANGLING_END_ITEM >::iterator get_lower_type(std::vector< DANGLING_END_ITEM > &aItemListByType, const DANGLING_END_T &aType)
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
static void sort_dangling_end_items(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos)
const EDA_ITEM * m_parent
A pointer to the parent object (in the case of pins).
Definition sch_item.h:143
bool operator==(const DANGLING_END_ITEM &aB) const
Definition sch_item.h:120
DANGLING_END_T m_type
The type of connection of m_item.
Definition sch_item.h:142
DANGLING_END_ITEM(DANGLING_END_T aType, EDA_ITEM *aItem, const VECTOR2I &aPosition)
Definition sch_item.h:103
DANGLING_END_T GetType() const
Definition sch_item.h:137
bool operator<(const DANGLING_END_ITEM &rhs) const
Definition sch_item.h:128
DANGLING_END_ITEM(DANGLING_END_T aType, EDA_ITEM *aItem, const VECTOR2I &aPosition, const EDA_ITEM *aParent)
Definition sch_item.h:111
VECTOR2I m_pos
The position of the connection point.
Definition sch_item.h:141
const EDA_ITEM * GetParent() const
Definition sch_item.h:136
EDA_ITEM * GetItem() const
Definition sch_item.h:135
EDA_ITEM * m_item
A pointer to the connectable object.
Definition sch_item.h:140
VECTOR2I GetPosition() const
Definition sch_item.h:134
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
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition eda_item.h:214
bool IsRollover() const
Definition eda_item.h:142
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:84
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition richio.h:65
A collection of nets and the parameters used to route or test these nets.
Definition netclass.h:43
Base plotter engine class.
Definition plotter.h:136
Holds all the data relating to one schematic.
Definition schematic.h:149
Commit for the schematic and symbol editors.
Definition sch_commit.h:54
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:170
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool aDoClone=false) const
Routine to create a new copy of given item.
Definition sch_item.cpp:191
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.
void SetStoredPos(const VECTOR2I &aPos)
Definition sch_item.h:315
friend class CONNECTION_GRAPH
Definition sch_item.h:816
virtual void SetExcludedFromBOM(bool aExcludeFromBOM, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:271
VECTOR2I m_storedPos
Definition sch_item.h:843
virtual void SetBodyStyle(int aBodyStyle)
Definition sch_item.h:252
virtual bool CanConnect(const SCH_ITEM *aItem) const
Definition sch_item.h:540
virtual bool IsEndPoint(const VECTOR2I &aPt) const
Test if aPt is an end point of this schematic object.
Definition sch_item.h:536
virtual bool IsConnectable() const
Definition sch_item.h:545
void SetLocked(bool aLocked) override
Definition sch_item.h:262
bool MatchesNetName(const EDA_SEARCH_DATA &aSearchData, const SCH_SHEET_PATH *aSheet) const
Match aSearchData against the connection of this item on aSheet.
Definition sch_item.cpp:676
void RemoveRuleAreaFromCache(SCH_RULE_AREA *aRuleArea)
Remove a specific rule area from the item's cache.
Definition sch_item.h:728
virtual void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo)
Definition sch_item.h:676
virtual bool HasHoveredHypertext() const
Indicates that a hypertext link is currently active.
Definition sch_item.h:346
int m_unit
Definition sch_item.h:839
bool ResolveExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:428
virtual int GetPenWidth() const
Definition sch_item.h:372
SCH_ITEM & operator=(const SCH_ITEM &aPin)
Definition sch_item.cpp:91
std::map< SCH_SHEET_PATH, std::vector< SCH_ITEM * >, SHEET_PATH_CMP > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
Definition sch_item.h:847
const wxString & GetDefaultFont(const KIGFX::RENDER_SETTINGS *aSettings) const
Definition sch_item.cpp:999
void ClearConnectedItems(const SCH_SHEET_PATH &aPath)
Clear all connections to this item.
Definition sch_item.cpp:757
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
Definition sch_item.h:835
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
Definition sch_item.h:678
SCH_SCREEN * GetParentScreen() const
Definition sch_item.cpp:308
int m_bodyStyle
Definition sch_item.h:840
virtual void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList)
Add the schematic item end points to aItemList if the item has end points.
Definition sch_item.h:497
std::vector< std::weak_ptr< CONNECTION_GRAPH_LIFETIME > > m_connectivityOwners
An item may be indexed by multiple graphs, each with an independent lifetime.
Definition sch_item.h:861
void invalidateConnectivity(KICAD_T aChangedType=TYPE_NOT_INIT)
Bump the parent screen's connectivity revision when this item, or the item owning it as a child,...
Definition sch_item.cpp:323
const std::vector< wxString > * GetEmbeddedFonts() override
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition sch_item.cpp:46
virtual bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos, const SCH_SHEET_PATH *aSheet=nullptr)
Test the schematic item to aItemList to check if it's dangling state has changed.
Definition sch_item.h:517
virtual ~SCH_ITEM()
Definition sch_item.cpp:109
const SYMBOL * GetParentSymbol() const
Definition sch_item.cpp:350
virtual wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const
Definition sch_item.cpp:236
void SetPrivate(bool aPrivate)
Definition sch_item.h:258
virtual void swapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
Definition sch_item.cpp:834
virtual const wxString & GetCachedDriverName() const
Definition sch_item.cpp:827
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:302
virtual void SetLastResolvedState(const SCH_ITEM *aItem)
Definition sch_item.h:666
int GetBodyStyle() const
Definition sch_item.h:253
virtual double Similarity(const SCH_ITEM &aItem) const
Return a measure of how likely the other object is to represent the same object.
Definition sch_item.h:388
virtual bool IsDangling() const
Definition sch_item.h:538
virtual bool IsPointClickableAnchor(const VECTOR2I &aPos) const
Definition sch_item.h:551
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition sch_item.cpp:564
virtual bool ContinueEdit(const VECTOR2I &aPosition)
Continue an edit in progress at aPosition.
Definition sch_item.h:467
virtual void MirrorHorizontally(int aCenter)
Mirror item horizontally about aCenter.
Definition sch_item.h:425
virtual void DoHypertextAction(EDA_DRAW_FRAME *aFrame, const VECTOR2I &aMousePos) const
Definition sch_item.h:348
const std::unordered_set< SCH_RULE_AREA * > & GetRuleAreaCache() const
Get the cache of rule areas enclosing this item.
Definition sch_item.h:733
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
Definition sch_item.cpp:790
const std::vector< SCH_ITEM * > & ConnectedItems(const SCH_SHEET_PATH &aPath) const
Retrieve the set of items connected to this item on the given sheet.
Definition sch_item.cpp:766
virtual wxString GetUnitDisplayName(int aUnit, bool aLabel) const
Definition sch_item.cpp:225
bool IsLocked() const override
Definition sch_item.cpp:179
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
Definition sch_item.cpp:774
friend class LIB_SYMBOL
Definition sch_item.h:817
virtual void Move(const VECTOR2I &aMoveVector)
Move the item by aMoveVector to a new position.
Definition sch_item.h:417
COMPARE_FLAGS
The list of flags used by various compare functions.
Definition sch_item.h:744
@ MISSING_FIELDS
Definition sch_item.h:748
@ EXCLUDE_FROM_BOARD
Definition sch_item.h:757
@ FIELD_VISIBILITY
Definition sch_item.h:751
@ EXCLUDE_FROM_POS_FILES
Definition sch_item.h:760
@ EXTRA_FIELDS
Definition sch_item.h:749
@ FIELD_SIZE_AND_STYLE
Definition sch_item.h:752
@ EXCLUDE_FROM_BOM
Definition sch_item.h:759
@ FIELD_TEXT
Definition sch_item.h:750
@ PIN_ALT_DEFS
Definition sch_item.h:755
@ EXCLUDE_FROM_SIM
Definition sch_item.h:756
@ FIELD_POSITIONS
Definition sch_item.h:753
@ PIN_VISIBILITIES
Definition sch_item.h:754
virtual bool HasHypertext() const
Indicates that the item has at least one hypertext action.
Definition sch_item.h:340
virtual bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:287
std::vector< wxString > GetBusMemberNames(const SCH_SHEET_PATH *aSheet=nullptr) const
Names of the bus members of this item's connection, empty when it does not have a bus.
Definition sch_item.cpp:647
int GetUnit() const
Definition sch_item.h:243
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition sch_item.cpp:733
virtual void CalcEdit(const VECTOR2I &aPosition)
Calculate the attributes of an item at aPosition when it is being edited.
Definition sch_item.h:485
virtual bool operator==(const SCH_ITEM &aOther) const
Definition sch_item.cpp:911
bool m_connectivity_dirty
Definition sch_item.h:852
virtual void SetDNP(bool aDNP, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:292
bool IsPrivate() const
Definition sch_item.h:259
virtual void ClearCaches()
Definition sch_item.cpp:891
void SetLayer(SCH_LAYER_ID aLayer)
Definition sch_item.h:354
void AddRuleAreaToCache(SCH_RULE_AREA *aRuleArea)
Add a rule area to the item's cache.
Definition sch_item.h:723
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition sch_item.h:353
void ClearRuleAreasCache()
Reset the cache of rule areas (called prior to schematic connectivity computation)
Definition sch_item.h:718
virtual void SetStroke(const STROKE_PARAMS &aStroke)
Definition sch_item.h:693
int GetMaxError() const
Definition sch_item.cpp:990
virtual bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:280
virtual void SetBodyStyleProp(const wxString &aBodyStyle)
Definition sch_item.cpp:274
void SetConnectivityDirty(bool aDirty=true)
Set the dirty flag.
Definition sch_item.cpp:314
virtual wxString GetBodyStyleProp() const
Definition sch_item.cpp:296
void SetFieldsAutoplaced(AUTOPLACE_ALGO aAlgo)
Definition sch_item.h:674
bool RenderAsBitmap(double aWorldScale) const override
virtual void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed)
Plot the item to aPlotter.
Definition sch_item.h:709
virtual void Rotate(const VECTOR2I &aCenter, bool aRotateCCW)
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition sch_item.h:441
bool IsConnectivityDirty() const
Definition sch_item.h:630
std::optional< wxString > GetConnectionName(const SCH_SHEET_PATH *aSheet=nullptr, bool aLocal=false, bool aIgnoreSheet=false) const
Return the active connection name; absent for missing or stale published rows.
Definition sch_item.cpp:629
void SetConnectionGraph(CONNECTION_GRAPH *aGraph)
Update the connection graph for all connections in this item.
Definition sch_item.cpp:604
virtual void SetUnit(int aUnit)
Definition sch_item.h:242
AUTOPLACE_ALGO m_fieldsAutoplaced
Definition sch_item.h:842
std::unordered_set< SCH_RULE_AREA * > m_rule_areas_cache
Store pointers to rule areas which this item is contained within.
Definition sch_item.h:855
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition sch_item.cpp:870
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
Definition sch_item.cpp:571
virtual void SetUnitString(const wxString &aUnit)
Definition sch_item.cpp:247
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:65
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
Definition sch_item.h:850
virtual bool HasCachedDriverName() const
Definition sch_item.h:663
virtual bool operator<(const SCH_ITEM &aItem) const
Definition sch_item.cpp:920
bool ResolveExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:392
bool m_private
Definition sch_item.h:841
void registerConnectivityOwner(const std::shared_ptr< CONNECTION_GRAPH_LIFETIME > &aOwner)
Graph membership belongs to this item identity and must not propagate to clones.
Definition sch_item.cpp:126
SCH_CONNECTION * GetOrInitConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Definition sch_item.cpp:813
virtual bool IsMovableFromAnchorPoint() const
Check if object is movable from the anchor point.
Definition sch_item.h:312
virtual bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const
Check if aItem has connectivity changes against this object.
Definition sch_item.h:654
AUTOPLACE_ALGO GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
Definition sch_item.h:673
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition sch_item.cpp:580
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
Definition sch_item.cpp:464
virtual int compare(const SCH_ITEM &aOther, int aCompareFlags=~COMPARE_FLAGS::UNIT) const
Provide the draw object specific comparison called by the == and < operators.
Definition sch_item.cpp:935
virtual void SetExcludedFromPosFiles(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:285
wxString GetClass() const override
Return the class name.
Definition sch_item.h:180
VECTOR2I & GetStoredPos()
Definition sch_item.h:314
bool ResolveExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:410
virtual void EndEdit(bool aClosed=false)
End an object editing action.
Definition sch_item.h:474
const KIFONT::METRICS & GetFontMetrics() const
bool ResolveDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:446
virtual wxString GetUnitString() const
Definition sch_item.cpp:269
bool HasBusConnection(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition sch_item.cpp:720
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
virtual STROKE_PARAMS GetStroke() const
Definition sch_item.h:691
virtual void BeginEdit(const VECTOR2I &aPosition)
Begin drawing a symbol library draw item at aPosition.
Definition sch_item.h:455
bool IsGroupableType() const
Definition sch_item.cpp:144
void SwapItemData(SCH_ITEM *aImage)
Swap data between aItem and aImage.
Definition sch_item.cpp:840
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:374
SCH_LAYER_ID m_layer
Definition sch_item.h:838
virtual bool HasLineStroke() const
Check if this schematic item has line stoke properties.
Definition sch_item.h:689
virtual bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const
Return true if this item should propagate connection info to aItem.
Definition sch_item.h:628
bool m_isLocked
Definition sch_item.h:857
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition sch_item.h:558
virtual void SetExcludedFromBoard(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:278
double SimilarityBase(const SCH_ITEM &aItem) const
Calculate the boilerplate similarity for all LIB_ITEMs without preventing the use above of a pure vir...
Definition sch_item.h:398
virtual bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:266
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:294
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition sch_item.h:185
virtual void MirrorVertically(int aCenter)
Mirror item vertically about aCenter.
Definition sch_item.h:433
virtual void SetExcludedFromSim(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:264
const BOX2I ViewBBox() const override
The view bounds of text that shows a net name must match the drawing, so this reads connectivity insi...
Definition sch_item.cpp:557
virtual bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:273
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Simple container to manage line stroke parameters.
A base class for LIB_SYMBOL and SCH_SYMBOL.
Definition symbol.h:60
RECURSE_MODE
Definition eda_item.h:50
SCH_LAYER_ID
Eeschema drawing layers.
Definition layer_ids.h:471
@ LAYER_WIRE
Definition layer_ids.h:474
@ LAYER_NOTES
Definition layer_ids.h:489
@ LAYER_BUS
Definition layer_ids.h:475
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:30
#define DECLARE_ENUM_TO_WXANY(type)
Definition property.h:851
AUTOPLACE_ALGO
Definition sch_item.h:73
@ AUTOPLACE_MANUAL
Definition sch_item.h:76
@ AUTOPLACE_NONE
Definition sch_item.h:74
@ AUTOPLACE_AUTO
Definition sch_item.h:75
DANGLING_END_T
Definition sch_item.h:82
@ NO_CONNECT_END
Definition sch_item.h:92
@ SHEET_LABEL_END
Definition sch_item.h:91
@ LABEL_END
Definition sch_item.h:88
@ JUNCTION_END
Definition sch_item.h:86
@ BUS_END
Definition sch_item.h:85
@ PIN_END
Definition sch_item.h:87
@ BUS_ENTRY_END
Definition sch_item.h:89
@ WIRE_END
Definition sch_item.h:84
@ WIRE_ENTRY_END
Definition sch_item.h:90
@ DANGLING_END_UNKNOWN
Definition sch_item.h:83
BODY_STYLE
Definition sch_item.h:63
@ BASE
Definition sch_item.h:64
@ DEMORGAN
Definition sch_item.h:65
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
Lets indexed items detect graph destruction without traversing their schematic parents.
bool operator()(const SCH_ITEM *aFirst, const SCH_ITEM *aSecond) const
Definition sch_item.cpp:929
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
@ TYPE_NOT_INIT
Definition typeinfo.h:73
@ SCH_ITEM_LOCATE_WIRE_T
Definition typeinfo.h:182
@ SCH_ITEM_LOCATE_BUS_T
Definition typeinfo.h:183
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
Definition typeinfo.h:184
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708