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 <unordered_map>
24#include <unordered_set>
25#include <map>
26#include <set>
27
28#include <eda_item.h>
29#include <properties/property.h>
30#include <sch_sheet_path.h>
31#include <netclass.h>
32#include <stroke_params.h>
33#include <layer_ids.h>
34#include <sch_render_settings.h>
35#include <plotters/plotter.h>
36
38class SCH_CONNECTION;
39class SCH_SHEET_PATH;
40class SCHEMATIC;
41class SCH_COMMIT;
42class SYMBOL;
43class LINE_READER;
44class SCH_EDIT_FRAME;
45class SCH_RULE_AREA;
46struct SCH_PLOT_OPTS;
47
48namespace KIFONT
49{
50class METRICS;
51}
52
53
54enum BODY_STYLE : int
55{
56 BASE = 1,
58};
59
60
61#define MINIMUM_SELECTION_DISTANCE 2 // Minimum selection distance in mils
62
63
65{
66 AUTOPLACE_NONE, // No autoplacement
67 AUTOPLACE_AUTO, // A minimalist placement algorithm.
68 AUTOPLACE_MANUAL // A more involved routine that can be annoying if done from the get go.
69 // Initiated by a hotkey or menu item.
70};
71
72
86
87
93{
94public:
95 DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition )
96 {
97 m_item = aItem;
98 m_type = aType;
99 m_pos = aPosition;
100 m_parent = aItem;
101 }
102
103 DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition,
104 const EDA_ITEM* aParent )
105 {
106 m_item = aItem;
107 m_type = aType;
108 m_pos = aPosition;
109 m_parent = aParent;
110 }
111
112 bool operator==( const DANGLING_END_ITEM& aB ) const
113 {
114 return GetItem() == aB.GetItem()
115 && GetPosition() == aB.GetPosition()
116 && GetType() == aB.GetType()
117 && GetParent() == aB.GetParent();
118 }
119
120 bool operator<( const DANGLING_END_ITEM& rhs ) const
121 {
122 return( m_pos.x < rhs.m_pos.x || ( m_pos.x == rhs.m_pos.x && m_pos.y < rhs.m_pos.y )
123 || ( m_pos == rhs.m_pos && m_item < rhs.m_item ) );
124 }
125
126 VECTOR2I GetPosition() const { return m_pos; }
127 EDA_ITEM* GetItem() const { return m_item; }
128 const EDA_ITEM* GetParent() const { return m_parent; }
129 DANGLING_END_T GetType() const { return m_type; }
130
131private:
136};
137
138
140{
141public:
142 static std::vector<DANGLING_END_ITEM>::iterator
143 get_lower_pos( std::vector<DANGLING_END_ITEM>& aItemListByPos, const VECTOR2I& aPos );
144
145 static std::vector<DANGLING_END_ITEM>::iterator
146 get_lower_type( std::vector<DANGLING_END_ITEM>& aItemListByType, const DANGLING_END_T& aType );
147
149 static void sort_dangling_end_items( std::vector<DANGLING_END_ITEM>& aItemListByType,
150 std::vector<DANGLING_END_ITEM>& aItemListByPos );
151};
152
153
161class SCH_ITEM : public EDA_ITEM
162{
163public:
164 SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType, int aUnit = 0, int aBodyStyle = 0 );
165
166 SCH_ITEM( const SCH_ITEM& aItem );
167
168 SCH_ITEM& operator=( const SCH_ITEM& aPin );
169
170 virtual ~SCH_ITEM();
171
172 wxString GetClass() const override
173 {
174 return wxT( "SCH_ITEM" );
175 }
176
177 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
178 {
179 if( EDA_ITEM::IsType( aScanTypes ) )
180 return true;
181
182 for( KICAD_T scanType : aScanTypes )
183 {
184 if( scanType == SCH_ITEM_LOCATE_WIRE_T && m_layer == LAYER_WIRE )
185 return true;
186
187 if ( scanType == SCH_ITEM_LOCATE_BUS_T && m_layer == LAYER_BUS )
188 return true;
189
190 if ( scanType == SCH_ITEM_LOCATE_GRAPHIC_LINE_T
191 && Type() == SCH_LINE_T && m_layer == LAYER_NOTES )
192 {
193 return true;
194 }
195 }
196
197 return false;
198 }
199
200 bool IsGroupableType() const;
201
212 void SwapItemData( SCH_ITEM* aImage );
213
217 void SwapFlags( SCH_ITEM* aItem );
218
230 SCH_ITEM* Duplicate( bool addToParentGroup, SCH_COMMIT* aCommit = nullptr, bool doClone = false ) const;
231
232 virtual void SetUnit( int aUnit ) { m_unit = aUnit; }
233 int GetUnit() const { return m_unit; }
234
235 virtual void SetUnitString( const wxString& aUnit );
236 virtual wxString GetUnitString() const;
237
238 virtual wxString GetUnitDisplayName( int aUnit, bool aLabel ) const;
239 virtual wxString GetBodyStyleDescription( int aBodyStyle, bool aLabel ) const;
240
241 virtual void SetBodyStyle( int aBodyStyle ) { m_bodyStyle = aBodyStyle; }
242 int GetBodyStyle() const { return m_bodyStyle; }
243
244 virtual void SetBodyStyleProp( const wxString& aBodyStyle );
245 virtual wxString GetBodyStyleProp() const;
246
247 void SetPrivate( bool aPrivate ) { m_private = aPrivate; }
248 bool IsPrivate() const { return m_private; }
249
250 bool IsLocked() const override;
251 void SetLocked( bool aLocked ) override { m_isLocked = aLocked; }
252
253 virtual void SetExcludedFromSim( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
254 const wxString& aVariantName = wxEmptyString ) { }
255 virtual bool GetExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
256 const wxString& aVariantName = wxEmptyString ) const { return false; }
257 bool ResolveExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
258 const wxString& aVariantName = wxEmptyString ) const;
259
260 virtual void SetExcludedFromBOM( bool aExcludeFromBOM, const SCH_SHEET_PATH* aInstance = nullptr,
261 const wxString& aVariantName = wxEmptyString ) { }
262 virtual bool GetExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
263 const wxString& aVariantName = wxEmptyString ) const { return false; }
264 bool ResolveExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
265 const wxString& aVariantName = wxEmptyString ) const;
266
267 virtual void SetExcludedFromBoard( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
268 const wxString& aVariantName = wxEmptyString ) { }
269 virtual bool GetExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
270 const wxString& aVariantName = wxEmptyString ) const { return false; }
271 bool ResolveExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
272 const wxString& aVariantName = wxEmptyString ) const;
273
274 virtual void SetExcludedFromPosFiles( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
275 const wxString& aVariantName = wxEmptyString ) { }
276 virtual bool GetExcludedFromPosFiles( const SCH_SHEET_PATH* aInstance = nullptr,
277 const wxString& aVariantName = wxEmptyString ) const { return false; }
278 bool ResolveExcludedFromPosFiles( const SCH_SHEET_PATH* aInstance = nullptr,
279 const wxString& aVariantName = wxEmptyString ) const;
280
281 virtual void SetDNP( bool aDNP, const SCH_SHEET_PATH* aInstance = nullptr,
282 const wxString& aVariantName = wxEmptyString ) { }
283 virtual bool GetDNP( const SCH_SHEET_PATH* aInstance = nullptr,
284 const wxString& aVariantName = wxEmptyString ) const { return false; }
285 bool ResolveDNP( const SCH_SHEET_PATH* aInstance = nullptr,
286 const wxString& aVariantName = wxEmptyString ) const;
287
288 wxString ResolveText( const wxString& aText, const SCH_SHEET_PATH* aPath, int aDepth = 0 ) const;
289
299 virtual bool IsMovableFromAnchorPoint() const { return true; }
300
302 void SetStoredPos( const VECTOR2I& aPos ) { m_storedPos = aPos; }
303
316 SCHEMATIC* Schematic() const;
317
318 const SYMBOL* GetParentSymbol() const;
320
325 virtual bool HasHypertext() const { return false; }
326
331 virtual bool HasHoveredHypertext() const { return HasHypertext() && IsRollover(); }
332
333 virtual void DoHypertextAction( EDA_DRAW_FRAME* aFrame, const VECTOR2I& aMousePos ) const { }
334
338 SCH_LAYER_ID GetLayer() const { return m_layer; }
339 void SetLayer( SCH_LAYER_ID aLayer ) { m_layer = aLayer; }
340
344 std::vector<int> ViewGetLayers() const override;
345
346 int GetMaxError() const;
347
351 virtual int GetPenWidth() const { return 0; }
352
353 int GetEffectivePenWidth( const SCH_RENDER_SETTINGS* aSettings ) const;
354
355 const wxString& GetDefaultFont( const RENDER_SETTINGS* aSettings ) const;
356
357 const KIFONT::METRICS& GetFontMetrics() const;
358
359 bool RenderAsBitmap( double aWorldScale ) const override;
360
367 virtual double Similarity( const SCH_ITEM& aItem ) const
368 {
369 wxCHECK_MSG( false, 0.0, wxT( "Similarity not implemented in " ) + GetClass() );
370 }
371
377 double SimilarityBase( const SCH_ITEM& aItem ) const
378 {
379 double similarity = 1.0;
380
381 if( m_unit != aItem.m_unit )
382 similarity *= 0.9;
383
384 if( m_bodyStyle != aItem.m_bodyStyle )
385 similarity *= 0.9;
386
387 if( m_private != aItem.m_private )
388 similarity *= 0.9;
389
390 return similarity;
391 }
392
396 virtual void Move( const VECTOR2I& aMoveVector )
397 {
398 wxCHECK_MSG( false, /*void*/, wxT( "Move not implemented in " ) + GetClass() );
399 }
400
404 virtual void MirrorHorizontally( int aCenter )
405 {
406 wxCHECK_MSG( false, /*void*/, wxT( "MirrorHorizontally not implemented in " ) + GetClass() );
407 }
408
412 virtual void MirrorVertically( int aCenter )
413 {
414 wxCHECK_MSG( false, /*void*/, wxT( "MirrorVertically not implemented in " ) + GetClass() );
415 }
416
420 virtual void Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
421 {
422 wxCHECK_MSG( false, /*void*/, wxT( "Rotate not implemented in " ) + GetClass() );
423 }
424
434 virtual void BeginEdit( const VECTOR2I& aPosition ) {}
435
446 virtual bool ContinueEdit( const VECTOR2I& aPosition ) { return false; }
447
453 virtual void EndEdit( bool aClosed = false ) {}
454
464 virtual void CalcEdit( const VECTOR2I& aPosition ) {}
465
476 virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {}
477
496 virtual bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
497 std::vector<DANGLING_END_ITEM>& aItemListByPos,
498 const SCH_SHEET_PATH* aSheet = nullptr )
499 {
500 return false;
501 }
502
515 virtual bool IsEndPoint( const VECTOR2I& aPt ) const { return false; }
516
517 virtual bool IsDangling() const { return false; }
518
519 virtual bool CanConnect( const SCH_ITEM* aItem ) const { return m_layer == aItem->GetLayer(); }
520
524 virtual bool IsConnectable() const { return false; }
525
530 virtual bool IsPointClickableAnchor( const VECTOR2I& aPos ) const { return false; }
531
539 virtual std::vector<VECTOR2I> GetConnectionPoints() const { return {}; }
540
547 bool IsConnected( const VECTOR2I& aPoint ) const;
548
554 SCH_CONNECTION* Connection( const SCH_SHEET_PATH* aSheet = nullptr ) const;
555
559 const std::vector<SCH_ITEM*>& ConnectedItems( const SCH_SHEET_PATH& aPath );
560
564 void AddConnectionTo( const SCH_SHEET_PATH& aPath, SCH_ITEM* aItem );
565
569 void ClearConnectedItems( const SCH_SHEET_PATH& aPath );
570
577
579
583 virtual bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const { return true; }
584
586
587 void SetConnectivityDirty( bool aDirty = true ) { m_connectivity_dirty = aDirty; }
588
604 virtual bool HasConnectivityChanges( const SCH_ITEM* aItem,
605 const SCH_SHEET_PATH* aInstance = nullptr ) const
606 {
607 return false;
608 }
609
611 void SetConnectionGraph( CONNECTION_GRAPH* aGraph );
612
613 virtual bool HasCachedDriverName() const { return false; }
614 virtual const wxString& GetCachedDriverName() const;
615
616 virtual void SetLastResolvedState( const SCH_ITEM* aItem ) { }
617
618 std::shared_ptr<NETCLASS> GetEffectiveNetClass( const SCH_SHEET_PATH* aSheet = nullptr ) const;
619
625
626 virtual void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) { }
627
628 virtual void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) { }
629
630 virtual void ClearCaches();
631
639 virtual bool HasLineStroke() const { return false; }
640
641 virtual STROKE_PARAMS GetStroke() const { wxCHECK( false, STROKE_PARAMS() ); }
642
643 virtual void SetStroke( const STROKE_PARAMS& aStroke ) { wxCHECK( false, /* void */ ); }
644
645 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
646
657 virtual void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
658 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed)
659 {
660 wxCHECK_MSG( false, /*void*/, wxT( "Plot not implemented in " ) + GetClass() );
661 }
662
667
671 void AddRuleAreaToCache( SCH_RULE_AREA* aRuleArea ) { m_rule_areas_cache.insert( aRuleArea ); }
672
676 void RemoveRuleAreaFromCache( SCH_RULE_AREA* aRuleArea ) { m_rule_areas_cache.erase( aRuleArea ); }
677
681 const std::unordered_set<SCH_RULE_AREA*>& GetRuleAreaCache() const
682 {
683 return m_rule_areas_cache;
684 }
685
686 const std::vector<wxString>* GetEmbeddedFonts() override;
687
702 enum COMPARE_FLAGS : int
703 {
704 UNIT = 0x01,
705 EQUALITY = 0x02,
706 ERC = 0x04,
708 };
709
710 virtual bool operator==( const SCH_ITEM& aOther ) const;
711
712 virtual bool operator<( const SCH_ITEM& aItem ) const;
713
714protected:
722 virtual void swapData( SCH_ITEM* aItem );
723
725 {
726 return static_cast<SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
727 }
728
730 {
731 bool operator()( const SCH_ITEM* aFirst, const SCH_ITEM* aSecond ) const;
732 };
733
754 virtual int compare( const SCH_ITEM& aOther, int aCompareFlags = 0 ) const;
755
756private:
757 friend class CONNECTION_GRAPH;
758
772 virtual bool doIsConnected( const VECTOR2I& aPosition ) const { return false; }
773
774protected:
776 int m_unit; // set to 0 if common to all units
777 int m_bodyStyle; // set to 0 if common to all body styles
778 bool m_private; // only shown in Symbol Editor
779 AUTOPLACE_ALGO m_fieldsAutoplaced; // indicates status of field autoplacement
780 VECTOR2I m_storedPos; // temp variable used in some move commands to store
781 // an initial position of the item or mouse cursor
782
784 std::map<SCH_SHEET_PATH, std::vector<SCH_ITEM*>, SHEET_PATH_CMP> m_connected_items;
785
787 std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> m_connection_map;
788
790
792 std::unordered_set<SCH_RULE_AREA*> m_rule_areas_cache;
793
795
796private:
797 friend class LIB_SYMBOL;
798};
799
801
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:970
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Definition sch_item.cpp:959
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:980
const EDA_ITEM * m_parent
A pointer to the parent object (in the case of pins).
Definition sch_item.h:135
bool operator==(const DANGLING_END_ITEM &aB) const
Definition sch_item.h:112
DANGLING_END_T m_type
The type of connection of m_item.
Definition sch_item.h:134
DANGLING_END_ITEM(DANGLING_END_T aType, EDA_ITEM *aItem, const VECTOR2I &aPosition)
Definition sch_item.h:95
DANGLING_END_T GetType() const
Definition sch_item.h:129
bool operator<(const DANGLING_END_ITEM &rhs) const
Definition sch_item.h:120
DANGLING_END_ITEM(DANGLING_END_T aType, EDA_ITEM *aItem, const VECTOR2I &aPosition, const EDA_ITEM *aParent)
Definition sch_item.h:103
VECTOR2I m_pos
The position of the connection point.
Definition sch_item.h:133
const EDA_ITEM * GetParent() const
Definition sch_item.h:128
EDA_ITEM * GetItem() const
Definition sch_item.h:127
EDA_ITEM * m_item
A pointer to the connectable object.
Definition sch_item.h:132
VECTOR2I GetPosition() const
Definition sch_item.h:126
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:96
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:108
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition eda_item.h:202
bool IsRollover() const
Definition eda_item.h:136
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:37
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:62
Base plotter engine class.
Definition plotter.h:133
RENDER_SETTINGS * RenderSettings()
Definition plotter.h:164
Holds all the data relating to one schematic.
Definition schematic.h:90
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:162
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.
Definition sch_item.cpp:825
void SetStoredPos(const VECTOR2I &aPos)
Definition sch_item.h:302
friend class CONNECTION_GRAPH
Definition sch_item.h:757
virtual void SetExcludedFromBOM(bool aExcludeFromBOM, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:260
VECTOR2I m_storedPos
Definition sch_item.h:780
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool doClone=false) const
Routine to create a new copy of given item.
Definition sch_item.cpp:160
virtual void SetBodyStyle(int aBodyStyle)
Definition sch_item.h:241
virtual bool CanConnect(const SCH_ITEM *aItem) const
Definition sch_item.h:519
virtual bool IsEndPoint(const VECTOR2I &aPt) const
Test if aPt is an end point of this schematic object.
Definition sch_item.h:515
virtual bool IsConnectable() const
Definition sch_item.h:524
void SetLocked(bool aLocked) override
Definition sch_item.h:251
void RemoveRuleAreaFromCache(SCH_RULE_AREA *aRuleArea)
Remove a specific rule area from the item's cache.
Definition sch_item.h:676
virtual void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo)
Definition sch_item.h:626
virtual bool HasHoveredHypertext() const
Indicates that a hypertext link is currently active.
Definition sch_item.h:331
int m_unit
Definition sch_item.h:776
bool ResolveExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:346
virtual int GetPenWidth() const
Definition sch_item.h:351
SCH_ITEM & operator=(const SCH_ITEM &aPin)
Definition sch_item.cpp:78
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:784
void ClearConnectedItems(const SCH_SHEET_PATH &aPath)
Clear all connections to this item.
Definition sch_item.cpp:549
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
Definition sch_item.h:772
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
Definition sch_item.h:628
int m_bodyStyle
Definition sch_item.h:777
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:476
const std::vector< wxString > * GetEmbeddedFonts() override
Definition sch_item.cpp:841
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition sch_item.h:724
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:496
virtual ~SCH_ITEM()
Definition sch_item.cpp:92
const SYMBOL * GetParentSymbol() const
Definition sch_item.cpp:274
virtual wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const
Definition sch_item.cpp:202
void SetPrivate(bool aPrivate)
Definition sch_item.h:247
virtual void swapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
Definition sch_item.cpp:626
virtual const wxString & GetCachedDriverName() const
Definition sch_item.cpp:619
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:268
virtual void SetLastResolvedState(const SCH_ITEM *aItem)
Definition sch_item.h:616
int GetBodyStyle() const
Definition sch_item.h:242
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:367
virtual bool IsDangling() const
Definition sch_item.h:517
virtual bool IsPointClickableAnchor(const VECTOR2I &aPos) const
Definition sch_item.h:530
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:471
virtual bool ContinueEdit(const VECTOR2I &aPosition)
Continue an edit in progress at aPosition.
Definition sch_item.h:446
virtual void MirrorHorizontally(int aCenter)
Mirror item horizontally about aCenter.
Definition sch_item.h:404
virtual void DoHypertextAction(EDA_DRAW_FRAME *aFrame, const VECTOR2I &aMousePos) const
Definition sch_item.h:333
const std::unordered_set< SCH_RULE_AREA * > & GetRuleAreaCache() const
Get the cache of rule areas enclosing this item.
Definition sch_item.h:681
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
Definition sch_item.cpp:580
virtual wxString GetUnitDisplayName(int aUnit, bool aLabel) const
Definition sch_item.cpp:191
bool IsLocked() const override
Definition sch_item.cpp:148
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
Definition sch_item.cpp:564
friend class LIB_SYMBOL
Definition sch_item.h:797
virtual void Move(const VECTOR2I &aMoveVector)
Move the item by aMoveVector to a new position.
Definition sch_item.h:396
COMPARE_FLAGS
The list of flags used by the compare function.
Definition sch_item.h:703
@ SKIP_TST_POS
Definition sch_item.h:707
virtual bool HasHypertext() const
Indicates that the item has at least one hypertext action.
Definition sch_item.h:325
virtual bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:276
int GetUnit() const
Definition sch_item.h:233
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition sch_item.cpp:523
virtual void CalcEdit(const VECTOR2I &aPosition)
Calculate the attributes of an item at aPosition when it is being edited.
Definition sch_item.h:464
virtual bool operator==(const SCH_ITEM &aOther) const
Definition sch_item.cpp:696
bool m_connectivity_dirty
Definition sch_item.h:789
virtual void SetDNP(bool aDNP, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:281
bool IsPrivate() const
Definition sch_item.h:248
virtual void ClearCaches()
Definition sch_item.cpp:676
void SetLayer(SCH_LAYER_ID aLayer)
Definition sch_item.h:339
void AddRuleAreaToCache(SCH_RULE_AREA *aRuleArea)
Add a rule area to the item's cache.
Definition sch_item.h:671
const std::vector< SCH_ITEM * > & ConnectedItems(const SCH_SHEET_PATH &aPath)
Retrieve the set of items connected to this item on the given sheet.
Definition sch_item.cpp:558
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition sch_item.h:338
void ClearRuleAreasCache()
Reset the cache of rule areas (called prior to schematic connectivity computation)
Definition sch_item.h:666
virtual void SetStroke(const STROKE_PARAMS &aStroke)
Definition sch_item.h:643
int GetMaxError() const
Definition sch_item.cpp:759
virtual bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:269
virtual void SetBodyStyleProp(const wxString &aBodyStyle)
Definition sch_item.cpp:240
void SetConnectivityDirty(bool aDirty=true)
Definition sch_item.h:587
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:720
virtual wxString GetBodyStyleProp() const
Definition sch_item.cpp:262
void SetFieldsAutoplaced(AUTOPLACE_ALGO aAlgo)
Definition sch_item.h:624
bool RenderAsBitmap(double aWorldScale) const override
Definition sch_item.cpp:813
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:657
virtual void Rotate(const VECTOR2I &aCenter, bool aRotateCCW)
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition sch_item.h:420
const wxString & GetDefaultFont(const RENDER_SETTINGS *aSettings) const
Definition sch_item.cpp:768
bool IsConnectivityDirty() const
Definition sch_item.h:585
void SetConnectionGraph(CONNECTION_GRAPH *aGraph)
Update the connection graph for all connections in this item.
Definition sch_item.cpp:511
virtual void SetUnit(int aUnit)
Definition sch_item.h:232
AUTOPLACE_ALGO m_fieldsAutoplaced
Definition sch_item.h:779
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:792
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition sch_item.cpp:655
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
Definition sch_item.cpp:478
virtual void SetUnitString(const wxString &aUnit)
Definition sch_item.cpp:213
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:52
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
Definition sch_item.h:787
virtual bool HasCachedDriverName() const
Definition sch_item.h:613
virtual bool operator<(const SCH_ITEM &aItem) const
Definition sch_item.cpp:705
bool ResolveExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:314
bool m_private
Definition sch_item.h:778
SCH_CONNECTION * GetOrInitConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Definition sch_item.cpp:604
virtual bool IsMovableFromAnchorPoint() const
Check if object is movable from the anchor point.
Definition sch_item.h:299
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:604
AUTOPLACE_ALGO GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
Definition sch_item.h:623
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:487
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
Definition sch_item.cpp:377
virtual void SetExcludedFromPosFiles(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:274
wxString GetClass() const override
Return the class name.
Definition sch_item.h:172
VECTOR2I & GetStoredPos()
Definition sch_item.h:301
bool ResolveExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:330
virtual void EndEdit(bool aClosed=false)
End an object editing action.
Definition sch_item.h:453
const KIFONT::METRICS & GetFontMetrics() const
Definition sch_item.cpp:781
bool ResolveDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:362
virtual wxString GetUnitString() const
Definition sch_item.cpp:235
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
Definition sch_item.cpp:790
virtual STROKE_PARAMS GetStroke() const
Definition sch_item.h:641
virtual void BeginEdit(const VECTOR2I &aPosition)
Begin drawing a symbol library draw item at aPosition.
Definition sch_item.h:434
bool IsGroupableType() const
Definition sch_item.cpp:113
void SwapItemData(SCH_ITEM *aImage)
Swap data between aItem and aImage.
Definition sch_item.cpp:632
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:298
SCH_LAYER_ID m_layer
Definition sch_item.h:775
virtual bool HasLineStroke() const
Check if this schematic item has line stoke properties.
Definition sch_item.h:639
virtual bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const
Return true if this item should propagate connection info to aItem.
Definition sch_item.h:583
bool m_isLocked
Definition sch_item.h:794
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition sch_item.h:539
virtual void SetExcludedFromBoard(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:267
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:377
virtual bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:255
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:283
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition sch_item.h:177
virtual void MirrorVertically(int aCenter)
Mirror item vertically about aCenter.
Definition sch_item.h:412
virtual void SetExcludedFromSim(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:253
virtual bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:262
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:59
RECURSE_MODE
Definition eda_item.h:48
SCH_LAYER_ID
Eeschema drawing layers.
Definition layer_ids.h:447
@ LAYER_WIRE
Definition layer_ids.h:450
@ LAYER_NOTES
Definition layer_ids.h:465
@ LAYER_BUS
Definition layer_ids.h:451
#define DECLARE_ENUM_TO_WXANY(type)
Definition property.h:789
AUTOPLACE_ALGO
Definition sch_item.h:65
@ AUTOPLACE_MANUAL
Definition sch_item.h:68
@ AUTOPLACE_NONE
Definition sch_item.h:66
@ AUTOPLACE_AUTO
Definition sch_item.h:67
DANGLING_END_T
Definition sch_item.h:74
@ NO_CONNECT_END
Definition sch_item.h:84
@ SHEET_LABEL_END
Definition sch_item.h:83
@ LABEL_END
Definition sch_item.h:80
@ JUNCTION_END
Definition sch_item.h:78
@ BUS_END
Definition sch_item.h:77
@ PIN_END
Definition sch_item.h:79
@ BUS_ENTRY_END
Definition sch_item.h:81
@ WIRE_END
Definition sch_item.h:76
@ WIRE_ENTRY_END
Definition sch_item.h:82
@ DANGLING_END_UNKNOWN
Definition sch_item.h:75
BODY_STYLE
Definition sch_item.h:55
@ BASE
Definition sch_item.h:56
@ DEMORGAN
Definition sch_item.h:57
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:714
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:71
@ SCH_LINE_T
Definition typeinfo.h:160
@ SCH_ITEM_LOCATE_WIRE_T
Definition typeinfo.h:183
@ SCH_ITEM_LOCATE_BUS_T
Definition typeinfo.h:184
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
Definition typeinfo.h:185
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683