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 (C) 2004-2024 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, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef SCH_ITEM_H
26#define SCH_ITEM_H
27
28#include <unordered_map>
29#include <unordered_set>
30#include <map>
31#include <set>
32
33#include <eda_item.h>
34#include <sch_sheet_path.h>
35#include <netclass.h>
36#include <stroke_params.h>
37#include <layer_ids.h>
38#include <sch_render_settings.h>
39#include <plotters/plotter.h>
40
42class SCH_CONNECTION;
43class SCH_SHEET_PATH;
44class SCHEMATIC;
45class SYMBOL;
46class LINE_READER;
47class SCH_EDIT_FRAME;
48class SCH_RULE_AREA;
49struct SCH_PLOT_OPTS;
50
51namespace KIFONT
52{
53class METRICS;
54}
55
56
57enum BODY_STYLE : int
58{
59 BASE = 1,
60 DEMORGAN = 2
61};
62
63
64#define MINIMUM_SELECTION_DISTANCE 2 // Minimum selection distance in mils
65
66
68{
72};
73
74
76{
87};
88
89
95{
96public:
97 DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition )
98 {
99 m_item = aItem;
100 m_type = aType;
101 m_pos = aPosition;
102 m_parent = aItem;
103 }
104
105 DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition,
106 const EDA_ITEM* aParent )
107 {
108 m_item = aItem;
109 m_type = aType;
110 m_pos = aPosition;
111 m_parent = aParent;
112 }
113
114 bool operator==( const DANGLING_END_ITEM& aB ) const
115 {
116 return GetItem() == aB.GetItem()
117 && GetPosition() == aB.GetPosition()
118 && GetType() == aB.GetType()
119 && GetParent() == aB.GetParent();
120 }
121
122 bool operator!=( const DANGLING_END_ITEM& aB ) const
123 {
124 return GetItem() != aB.GetItem()
125 || GetPosition() != aB.GetPosition()
126 || GetType() != aB.GetType()
127 || GetParent() != aB.GetParent();;
128 }
129
130 bool operator<( const DANGLING_END_ITEM& rhs ) const
131 {
132 return( m_pos.x < rhs.m_pos.x || ( m_pos.x == rhs.m_pos.x && m_pos.y < rhs.m_pos.y )
133 || ( m_pos == rhs.m_pos && m_item < rhs.m_item ) );
134 }
135
136 VECTOR2I GetPosition() const { return m_pos; }
137 EDA_ITEM* GetItem() const { return m_item; }
138 const EDA_ITEM* GetParent() const { return m_parent; }
139 DANGLING_END_T GetType() const { return m_type; }
140
141private:
146};
147
148
150{
151public:
152 static std::vector<DANGLING_END_ITEM>::iterator
153 get_lower_pos( std::vector<DANGLING_END_ITEM>& aItemListByPos, const VECTOR2I& aPos );
154
155 static std::vector<DANGLING_END_ITEM>::iterator
156 get_lower_type( std::vector<DANGLING_END_ITEM>& aItemListByType, const DANGLING_END_T& aType );
157
159 static void sort_dangling_end_items( std::vector<DANGLING_END_ITEM>& aItemListByType,
160 std::vector<DANGLING_END_ITEM>& aItemListByPos );
161};
162
163typedef std::vector<SCH_ITEM*> SCH_ITEM_VEC;
164
165
173class SCH_ITEM : public EDA_ITEM
174{
175public:
176 SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType, int aUnit = 0, int aBodyStyle = 0 );
177
178 SCH_ITEM( const SCH_ITEM& aItem );
179
180 SCH_ITEM& operator=( const SCH_ITEM& aPin );
181
182 virtual ~SCH_ITEM();
183
184 wxString GetClass() const override
185 {
186 return wxT( "SCH_ITEM" );
187 }
188
189 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
190 {
191 if( EDA_ITEM::IsType( aScanTypes ) )
192 return true;
193
194 for( KICAD_T scanType : aScanTypes )
195 {
196 if( scanType == SCH_ITEM_LOCATE_WIRE_T && m_layer == LAYER_WIRE )
197 return true;
198
199 if ( scanType == SCH_ITEM_LOCATE_BUS_T && m_layer == LAYER_BUS )
200 return true;
201
202 if ( scanType == SCH_ITEM_LOCATE_GRAPHIC_LINE_T
203 && Type() == SCH_LINE_T && m_layer == LAYER_NOTES )
204 {
205 return true;
206 }
207 }
208
209 return false;
210 }
211
217 virtual void SwapData( SCH_ITEM* aItem );
218
222 void SwapFlags( SCH_ITEM* aItem );
223
231 SCH_ITEM* Duplicate( bool doClone = false ) const;
232
233 static wxString GetUnitDescription( int aUnit );
234 static wxString GetBodyStyleDescription( int aBodyStyle );
235
236 virtual void SetUnit( int aUnit ) { m_unit = aUnit; }
237 int GetUnit() const { return m_unit; }
238
239 virtual void SetBodyStyle( int aBodyStyle ) { m_bodyStyle = aBodyStyle; }
240 int GetBodyStyle() const { return m_bodyStyle; }
241
242 void SetPrivate( bool aPrivate ) { m_private = aPrivate; }
243 bool IsPrivate() const { return m_private; }
244
245 virtual void SetExcludedFromSim( bool aExclude ) { }
246 virtual bool GetExcludedFromSim() const { return false; }
247
254 virtual bool IsMovableFromAnchorPoint() const { return true; }
255
257 void SetStoredPos( const VECTOR2I& aPos ) { m_storedPos = aPos; }
258
271 SCHEMATIC* Schematic() const;
272
273 const SYMBOL* GetParentSymbol() const;
275
276 virtual bool IsLocked() const { return false; }
277 virtual void SetLocked( bool aLocked ) {}
278
282 virtual bool IsHypertext() const { return false; }
283
284 virtual void DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const { }
285
289 SCH_LAYER_ID GetLayer() const { return m_layer; }
290 void SetLayer( SCH_LAYER_ID aLayer ) { m_layer = aLayer; }
291
295 void ViewGetLayers( int aLayers[], int& aCount ) const override;
296
300 virtual int GetPenWidth() const { return 0; }
301
302 int GetEffectivePenWidth( const SCH_RENDER_SETTINGS* aSettings ) const;
303
304 const wxString& GetDefaultFont() const;
305
306 const KIFONT::METRICS& GetFontMetrics() const;
307
308 bool RenderAsBitmap( double aWorldScale ) const override;
309
314 virtual double Similarity( const SCH_ITEM& aItem ) const
315 {
316 wxCHECK_MSG( false, 0.0, wxT( "Similarity not implemented in " ) + GetClass() );
317 }
318
324 double SimilarityBase( const SCH_ITEM& aItem ) const
325 {
326 double similarity = 1.0;
327
328 if( m_unit != aItem.m_unit )
329 similarity *= 0.9;
330
331 if( m_bodyStyle != aItem.m_bodyStyle )
332 similarity *= 0.9;
333
334 if( m_private != aItem.m_private )
335 similarity *= 0.9;
336
337 return similarity;
338 }
339
343 virtual void Move( const VECTOR2I& aMoveVector )
344 {
345 wxCHECK_MSG( false, /*void*/, wxT( "Move not implemented in " ) + GetClass() );
346 }
347
351 virtual void MirrorHorizontally( int aCenter )
352 {
353 wxCHECK_MSG( false, /*void*/, wxT( "MirrorHorizontally not implemented in " ) + GetClass() );
354 }
355
359 virtual void MirrorVertically( int aCenter )
360 {
361 wxCHECK_MSG( false, /*void*/, wxT( "MirrorVertically not implemented in " ) + GetClass() );
362 }
363
367 virtual void Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
368 {
369 wxCHECK_MSG( false, /*void*/, wxT( "Rotate not implemented in " ) + GetClass() );
370 }
371
381 virtual void BeginEdit( const VECTOR2I& aPosition ) {}
382
393 virtual bool ContinueEdit( const VECTOR2I& aPosition ) { return false; }
394
400 virtual void EndEdit( bool aClosed = false ) {}
401
411 virtual void CalcEdit( const VECTOR2I& aPosition ) {}
412
423 virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {}
424
443 virtual bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
444 std::vector<DANGLING_END_ITEM>& aItemListByPos,
445 const SCH_SHEET_PATH* aSheet = nullptr )
446 {
447 return false;
448 }
449
450 virtual bool IsDangling() const { return false; }
451
452 virtual bool CanConnect( const SCH_ITEM* aItem ) const { return m_layer == aItem->GetLayer(); }
453
457 virtual bool IsConnectable() const { return false; }
458
463 virtual bool IsPointClickableAnchor( const VECTOR2I& aPos ) const { return false; }
464
472 virtual std::vector<VECTOR2I> GetConnectionPoints() const { return {}; }
473
480 bool IsConnected( const VECTOR2I& aPoint ) const;
481
487 SCH_CONNECTION* Connection( const SCH_SHEET_PATH* aSheet = nullptr ) const;
488
492 const SCH_ITEM_VEC& ConnectedItems( const SCH_SHEET_PATH& aPath );
493
497 void AddConnectionTo( const SCH_SHEET_PATH& aPath, SCH_ITEM* aItem );
498
502 void ClearConnectedItems( const SCH_SHEET_PATH& aPath );
503
510
512
516 virtual bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const { return true; }
517
519
520 void SetConnectivityDirty( bool aDirty = true ) { m_connectivity_dirty = aDirty; }
521
537 virtual bool HasConnectivityChanges( const SCH_ITEM* aItem,
538 const SCH_SHEET_PATH* aInstance = nullptr ) const
539 {
540 return false;
541 }
542
544 void SetConnectionGraph( CONNECTION_GRAPH* aGraph );
545
546 virtual bool HasCachedDriverName() const { return false; }
547 virtual const wxString& GetCachedDriverName() const;
548
549 virtual void SetLastResolvedState( const SCH_ITEM* aItem ) { }
550
551 std::shared_ptr<NETCLASS> GetEffectiveNetClass( const SCH_SHEET_PATH* aSheet = nullptr ) const;
552
557
560
569 {
570 if( GetFieldsAutoplaced() )
572 }
573
574 virtual void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) { }
575
576 virtual void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) { }
577
578 virtual void ClearCaches();
579
587 virtual bool HasLineStroke() const { return false; }
588
589 virtual STROKE_PARAMS GetStroke() const { wxCHECK( false, STROKE_PARAMS() ); }
590
591 virtual void SetStroke( const STROKE_PARAMS& aStroke ) { wxCHECK( false, /* void */ ); }
592
602 virtual void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
603 const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
604 {
605 wxCHECK_MSG( false, /*void*/, wxT( "Print not implemented in " ) + GetClass() );
606 }
607
611 virtual void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
612 const VECTOR2I& aOffset, bool aDimmed )
613 {
614 wxCHECK_MSG( false, /*void*/, wxT( "PrintBackground not implemented in " ) + GetClass() );
615 }
616
627 virtual void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
628 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed)
629 {
630 wxCHECK_MSG( false, /*void*/, wxT( "Plot not implemented in " ) + GetClass() );
631 }
632
637
641 void AddRuleAreaToCache( SCH_RULE_AREA* aRuleArea ) { m_rule_areas_cache.insert( aRuleArea ); }
642
646 const std::unordered_set<SCH_RULE_AREA*>& GetRuleAreaCache() const
647 {
648 return m_rule_areas_cache;
649 }
650
665 enum COMPARE_FLAGS : int
666 {
667 UNIT = 0x01,
668 EQUALITY = 0x02,
669 ERC = 0x04,
670 SKIP_TST_POS = 0x08
671 };
672
673 virtual bool operator==( const SCH_ITEM& aOther ) const;
674
675 virtual bool operator<( const SCH_ITEM& aItem ) const;
676
677protected:
679 {
680 return static_cast<SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
681 }
682
684 {
685 bool operator()( const SCH_ITEM* aFirst, const SCH_ITEM* aSecond ) const;
686 };
687
688 void getSymbolEditorMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList );
689
710 virtual int compare( const SCH_ITEM& aOther, int aCompareFlags = 0 ) const;
711
712private:
713 friend class CONNECTION_GRAPH;
714
728 virtual bool doIsConnected( const VECTOR2I& aPosition ) const { return false; }
729
730protected:
732 int m_unit; // set to 0 if common to all units
733 int m_bodyStyle; // set to 0 if common to all body styles
734 bool m_private; // only shown in Symbol Editor
735 FIELDS_AUTOPLACED m_fieldsAutoplaced; // indicates status of field autoplacement
736 VECTOR2I m_storedPos; // temp variable used in some move commands to store
737 // an initial position of the item or mouse cursor
738
740 std::map<SCH_SHEET_PATH, SCH_ITEM_VEC, SHEET_PATH_CMP> m_connected_items;
741
743 std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> m_connection_map;
744
746
748 std::unordered_set<SCH_RULE_AREA*> m_rule_areas_cache;
749
750private:
751 friend class LIB_SYMBOL;
752};
753
754#ifndef SWIG
756#endif
757
758#endif /* SCH_ITEM_H */
Calculate the connectivity of a schematic and generates netlists.
static std::vector< DANGLING_END_ITEM >::iterator get_lower_type(std::vector< DANGLING_END_ITEM > &aItemListByType, const DANGLING_END_T &aType)
Definition: sch_item.cpp:594
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Definition: sch_item.cpp:583
static void sort_dangling_end_items(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos)
Both contain the same information.
Definition: sch_item.cpp:604
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:95
const EDA_ITEM * m_parent
The type of connection of m_item.
Definition: sch_item.h:145
bool operator==(const DANGLING_END_ITEM &aB) const
Definition: sch_item.h:114
DANGLING_END_T m_type
The position of the connection point.
Definition: sch_item.h:144
bool operator!=(const DANGLING_END_ITEM &aB) const
Definition: sch_item.h:122
DANGLING_END_ITEM(DANGLING_END_T aType, EDA_ITEM *aItem, const VECTOR2I &aPosition)
Definition: sch_item.h:97
DANGLING_END_T GetType() const
Definition: sch_item.h:139
bool operator<(const DANGLING_END_ITEM &rhs) const
Definition: sch_item.h:130
DANGLING_END_ITEM(DANGLING_END_T aType, EDA_ITEM *aItem, const VECTOR2I &aPosition, const EDA_ITEM *aParent)
Definition: sch_item.h:105
VECTOR2I m_pos
A pointer to the connectable object.
Definition: sch_item.h:143
const EDA_ITEM * GetParent() const
Definition: sch_item.h:138
EDA_ITEM * GetItem() const
Definition: sch_item.h:137
EDA_ITEM * m_item
Definition: sch_item.h:142
VECTOR2I GetPosition() const
Definition: sch_item.h:136
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:88
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:175
Define a library symbol object.
Definition: lib_symbol.h:77
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:93
Base plotter engine class.
Definition: plotter.h:104
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:135
Holds all the data relating to one schematic.
Definition: schematic.h:75
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:174
virtual bool GetExcludedFromSim() const
Definition: sch_item.h:246
virtual void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aForceNoFill, bool aDimmed)
Print an item.
Definition: sch_item.h:602
void SetStoredPos(const VECTOR2I &aPos)
Definition: sch_item.h:257
virtual void PrintBackground(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed)
Print just the background fills.
Definition: sch_item.h:611
VECTOR2I m_storedPos
Definition: sch_item.h:736
virtual void SetBodyStyle(int aBodyStyle)
Definition: sch_item.h:239
virtual bool CanConnect(const SCH_ITEM *aItem) const
Definition: sch_item.h:452
virtual bool IsConnectable() const
Definition: sch_item.h:457
int m_unit
Definition: sch_item.h:732
virtual bool IsLocked() const
Definition: sch_item.h:276
virtual int GetPenWidth() const
Definition: sch_item.h:300
const SCH_ITEM_VEC & ConnectedItems(const SCH_SHEET_PATH &aPath)
Retrieve the set of items connected to this item on the given sheet.
Definition: sch_item.cpp:269
SCH_ITEM & operator=(const SCH_ITEM &aPin)
Definition: sch_item.cpp:100
void ClearConnectedItems(const SCH_SHEET_PATH &aPath)
Clear all connections to this item.
Definition: sch_item.cpp:260
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_item.h:728
int m_bodyStyle
Definition: sch_item.h:733
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:423
const wxString & GetDefaultFont() const
Definition: sch_item.cpp:447
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition: sch_item.h:678
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:443
virtual ~SCH_ITEM()
Definition: sch_item.cpp:113
const SYMBOL * GetParentSymbol() const
Definition: sch_item.cpp:155
void SetPrivate(bool aPrivate)
Definition: sch_item.h:242
virtual const wxString & GetCachedDriverName() const
Definition: sch_item.cpp:330
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:139
virtual void SetLastResolvedState(const SCH_ITEM *aItem)
Definition: sch_item.h:549
int GetBodyStyle() const
Definition: sch_item.h:240
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:314
virtual bool IsDangling() const
Definition: sch_item.h:450
virtual bool IsPointClickableAnchor(const VECTOR2I &aPos) const
Definition: sch_item.h:463
virtual bool ContinueEdit(const VECTOR2I &aPosition)
Continue an edit in progress at aPosition.
Definition: sch_item.h:393
virtual void MirrorHorizontally(int aCenter)
Mirror item horizontally about aCenter.
Definition: sch_item.h:351
static wxString GetUnitDescription(int aUnit)
Definition: sch_item.cpp:51
const std::unordered_set< SCH_RULE_AREA * > & GetRuleAreaCache() const
Gets the cache of rule areas enclosing this item.
Definition: sch_item.h:646
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
Definition: sch_item.cpp:291
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
Definition: sch_item.cpp:275
virtual void SetLocked(bool aLocked)
Definition: sch_item.h:277
virtual void Move(const VECTOR2I &aMoveVector)
Move the item by aMoveVector to a new position.
Definition: sch_item.h:343
COMPARE_FLAGS
The list of flags used by the compare function.
Definition: sch_item.h:666
@ SKIP_TST_POS
Definition: sch_item.h:670
@ EQUALITY
Definition: sch_item.h:668
int GetUnit() const
Definition: sch_item.h:237
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition: sch_item.cpp:239
virtual void CalcEdit(const VECTOR2I &aPosition)
Calculate the attributes of an item at aPosition when it is being edited.
Definition: sch_item.h:411
virtual bool operator==(const SCH_ITEM &aOther) const
Definition: sch_item.cpp:384
bool m_connectivity_dirty
Definition: sch_item.h:745
void ClearFieldsAutoplaced()
Definition: sch_item.h:559
bool IsPrivate() const
Definition: sch_item.h:243
virtual void ClearCaches()
Definition: sch_item.cpp:364
void SetLayer(SCH_LAYER_ID aLayer)
Definition: sch_item.h:290
void AddRuleAreaToCache(SCH_RULE_AREA *aRuleArea)
Adds a rule area to the item's cache.
Definition: sch_item.h:641
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:289
void ClearRuleAreasCache()
Reset the cache of rule areas (called prior to schematic connectivity recomputation)
Definition: sch_item.h:636
FIELDS_AUTOPLACED GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
Definition: sch_item.h:556
virtual void SetStroke(const STROKE_PARAMS &aStroke)
Definition: sch_item.h:591
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
Definition: sch_item.h:576
virtual void SwapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
Definition: sch_item.cpp:337
void SetConnectivityDirty(bool aDirty=true)
Definition: sch_item.h:520
virtual int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
Definition: sch_item.cpp:408
void SetFieldsAutoplaced()
Definition: sch_item.h:558
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:735
bool RenderAsBitmap(double aWorldScale) const override
Definition: sch_item.cpp:478
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:627
virtual void Rotate(const VECTOR2I &aCenter, bool aRotateCCW)
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_item.h:367
bool IsConnectivityDirty() const
Definition: sch_item.h:518
virtual void SetExcludedFromSim(bool aExclude)
Definition: sch_item.h:245
static wxString GetBodyStyleDescription(int aBodyStyle)
Definition: sch_item.cpp:60
void SetConnectionGraph(CONNECTION_GRAPH *aGraph)
Updates the connection graph for all connections in this item.
Definition: sch_item.cpp:227
virtual void SetUnit(int aUnit)
Definition: sch_item.h:236
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:748
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Definition: sch_item.h:574
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition: sch_item.cpp:343
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
Definition: sch_item.cpp:201
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_item.cpp:191
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
Definition: sch_item.h:743
virtual bool HasCachedDriverName() const
Definition: sch_item.h:546
virtual bool operator<(const SCH_ITEM &aItem) const
Definition: sch_item.cpp:393
bool m_private
Definition: sch_item.h:734
virtual bool IsHypertext() const
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_item.h:282
SCH_CONNECTION * GetOrInitConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Definition: sch_item.cpp:315
virtual bool IsMovableFromAnchorPoint() const
Definition: sch_item.h:254
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:537
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:210
virtual void DoHypertextAction(EDA_DRAW_FRAME *aFrame) const
Definition: sch_item.h:284
wxString GetClass() const override
Return the class name.
Definition: sch_item.h:184
VECTOR2I & GetStoredPos()
Definition: sch_item.h:256
virtual void EndEdit(bool aClosed=false)
End an object editing action.
Definition: sch_item.h:400
const KIFONT::METRICS & GetFontMetrics() const
Definition: sch_item.cpp:455
std::map< SCH_SHEET_PATH, SCH_ITEM_VEC, SHEET_PATH_CMP > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
Definition: sch_item.h:740
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
Definition: sch_item.cpp:464
virtual STROKE_PARAMS GetStroke() const
Definition: sch_item.h:589
virtual void BeginEdit(const VECTOR2I &aPosition)
Begin drawing a symbol library draw item at aPosition.
Definition: sch_item.h:381
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
Definition: sch_item.h:568
SCH_LAYER_ID m_layer
Definition: sch_item.h:731
virtual bool HasLineStroke() const
Check if this schematic item has line stoke properties.
Definition: sch_item.h:587
virtual bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const
Return true if this item should propagate connection info to aItem.
Definition: sch_item.h:516
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:472
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:324
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:120
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: sch_item.h:189
virtual void MirrorVertically(int aCenter)
Mirror item vertically about aCenter.
Definition: sch_item.h:359
void getSymbolEditorMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Definition: sch_item.cpp:490
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.
Definition: stroke_params.h:81
A base class for LIB_SYMBOL and SCH_SYMBOL.
Definition: symbol.h:34
SCH_LAYER_ID
Eeschema drawing layers.
Definition: layer_ids.h:353
@ LAYER_WIRE
Definition: layer_ids.h:356
@ LAYER_NOTES
Definition: layer_ids.h:371
@ LAYER_BUS
Definition: layer_ids.h:357
#define DECLARE_ENUM_TO_WXANY(type)
Definition: property.h:729
DANGLING_END_T
Definition: sch_item.h:76
@ NO_CONNECT_END
Definition: sch_item.h:86
@ SHEET_LABEL_END
Definition: sch_item.h:85
@ LABEL_END
Definition: sch_item.h:82
@ JUNCTION_END
Definition: sch_item.h:80
@ BUS_END
Definition: sch_item.h:79
@ PIN_END
Definition: sch_item.h:81
@ BUS_ENTRY_END
Definition: sch_item.h:83
@ WIRE_END
Definition: sch_item.h:78
@ WIRE_ENTRY_END
Definition: sch_item.h:84
@ DANGLING_END_UNKNOWN
Definition: sch_item.h:77
std::vector< SCH_ITEM * > SCH_ITEM_VEC
Definition: sch_item.h:163
FIELDS_AUTOPLACED
Definition: sch_item.h:68
@ FIELDS_AUTOPLACED_NO
Definition: sch_item.h:69
@ FIELDS_AUTOPLACED_AUTO
Definition: sch_item.h:70
@ FIELDS_AUTOPLACED_MANUAL
Definition: sch_item.h:71
BODY_STYLE
Definition: sch_item.h:58
@ BASE
Definition: sch_item.h:59
@ DEMORGAN
Definition: sch_item.h:60
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
bool operator()(const SCH_ITEM *aFirst, const SCH_ITEM *aSecond) const
Definition: sch_item.cpp:402
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_LINE_T
Definition: typeinfo.h:163
@ SCH_ITEM_LOCATE_WIRE_T
Definition: typeinfo.h:185
@ SCH_ITEM_LOCATE_BUS_T
Definition: typeinfo.h:186
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
Definition: typeinfo.h:187