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, 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#pragma once
26
27#include <unordered_map>
28#include <unordered_set>
29#include <map>
30#include <set>
31
32#include <eda_item.h>
33#include <properties/property.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 SCH_COMMIT;
46class SYMBOL;
47class LINE_READER;
48class SCH_EDIT_FRAME;
49class SCH_RULE_AREA;
50struct SCH_PLOT_OPTS;
51
52namespace KIFONT
53{
54class METRICS;
55}
56
57
58enum BODY_STYLE : int
59{
60 BASE = 1,
62};
63
64
65#define MINIMUM_SELECTION_DISTANCE 2 // Minimum selection distance in mils
66
67
69{
70 AUTOPLACE_NONE, // No autoplacement
71 AUTOPLACE_AUTO, // A minimalist placement algorithm.
72 AUTOPLACE_MANUAL // A more involved routine that can be annoying if done from the get go.
73 // Initiated by a hotkey or menu item.
74};
75
76
90
91
97{
98public:
99 DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition )
100 {
101 m_item = aItem;
102 m_type = aType;
103 m_pos = aPosition;
104 m_parent = aItem;
105 }
106
107 DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition,
108 const EDA_ITEM* aParent )
109 {
110 m_item = aItem;
111 m_type = aType;
112 m_pos = aPosition;
113 m_parent = aParent;
114 }
115
116 bool operator==( const DANGLING_END_ITEM& aB ) const
117 {
118 return GetItem() == aB.GetItem()
119 && GetPosition() == aB.GetPosition()
120 && GetType() == aB.GetType()
121 && GetParent() == aB.GetParent();
122 }
123
124 bool operator<( const DANGLING_END_ITEM& rhs ) const
125 {
126 return( m_pos.x < rhs.m_pos.x || ( m_pos.x == rhs.m_pos.x && m_pos.y < rhs.m_pos.y )
127 || ( m_pos == rhs.m_pos && m_item < rhs.m_item ) );
128 }
129
130 VECTOR2I GetPosition() const { return m_pos; }
131 EDA_ITEM* GetItem() const { return m_item; }
132 const EDA_ITEM* GetParent() const { return m_parent; }
133 DANGLING_END_T GetType() const { return m_type; }
134
135private:
140};
141
142
144{
145public:
146 static std::vector<DANGLING_END_ITEM>::iterator
147 get_lower_pos( std::vector<DANGLING_END_ITEM>& aItemListByPos, const VECTOR2I& aPos );
148
149 static std::vector<DANGLING_END_ITEM>::iterator
150 get_lower_type( std::vector<DANGLING_END_ITEM>& aItemListByType, const DANGLING_END_T& aType );
151
153 static void sort_dangling_end_items( std::vector<DANGLING_END_ITEM>& aItemListByType,
154 std::vector<DANGLING_END_ITEM>& aItemListByPos );
155};
156
157typedef std::vector<SCH_ITEM*> SCH_ITEM_VEC;
158
159
167class SCH_ITEM : public EDA_ITEM
168{
169public:
170 SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType, int aUnit = 0, int aBodyStyle = 0 );
171
172 SCH_ITEM( const SCH_ITEM& aItem );
173
174 SCH_ITEM& operator=( const SCH_ITEM& aPin );
175
176 virtual ~SCH_ITEM();
177
178 wxString GetClass() const override
179 {
180 return wxT( "SCH_ITEM" );
181 }
182
183 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
184 {
185 if( EDA_ITEM::IsType( aScanTypes ) )
186 return true;
187
188 for( KICAD_T scanType : aScanTypes )
189 {
190 if( scanType == SCH_ITEM_LOCATE_WIRE_T && m_layer == LAYER_WIRE )
191 return true;
192
193 if ( scanType == SCH_ITEM_LOCATE_BUS_T && m_layer == LAYER_BUS )
194 return true;
195
196 if ( scanType == SCH_ITEM_LOCATE_GRAPHIC_LINE_T
197 && Type() == SCH_LINE_T && m_layer == LAYER_NOTES )
198 {
199 return true;
200 }
201 }
202
203 return false;
204 }
205
206 bool IsGroupableType() const;
207
218 void SwapItemData( SCH_ITEM* aImage );
219
223 void SwapFlags( SCH_ITEM* aItem );
224
236 SCH_ITEM* Duplicate( bool addToParentGroup, SCH_COMMIT* aCommit = nullptr, bool doClone = false ) const;
237
238 virtual void SetUnit( int aUnit ) { m_unit = aUnit; }
239 int GetUnit() const { return m_unit; }
240
241 virtual void SetUnitString( const wxString& aUnit );
242 virtual wxString GetUnitString() const;
243
244 virtual wxString GetUnitDisplayName( int aUnit, bool aLabel ) const;
245 virtual wxString GetBodyStyleDescription( int aBodyStyle, bool aLabel ) const;
246
247 virtual void SetBodyStyle( int aBodyStyle ) { m_bodyStyle = aBodyStyle; }
248 int GetBodyStyle() const { return m_bodyStyle; }
249
250 virtual void SetBodyStyleProp( const wxString& aBodyStyle );
251 virtual wxString GetBodyStyleProp() const;
252
253 void SetPrivate( bool aPrivate ) { m_private = aPrivate; }
254 bool IsPrivate() const { return m_private; }
255
256 virtual void SetExcludedFromSim( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
257 const wxString& aVariantName = wxEmptyString ) { }
258 virtual bool GetExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
259 const wxString& aVariantName = wxEmptyString ) const { return false; }
260 bool ResolveExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
261 const wxString& aVariantName = wxEmptyString ) const;
262
263 virtual void SetExcludedFromBOM( bool aExcludeFromBOM, const SCH_SHEET_PATH* aInstance = nullptr,
264 const wxString& aVariantName = wxEmptyString ) { }
265 virtual bool GetExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
266 const wxString& aVariantName = wxEmptyString ) const { return false; }
267 bool ResolveExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
268 const wxString& aVariantName = wxEmptyString ) const;
269
270 virtual void SetExcludedFromBoard( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
271 const wxString& aVariantName = wxEmptyString ) { }
272 virtual bool GetExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
273 const wxString& aVariantName = wxEmptyString ) const { return false; }
274 bool ResolveExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
275 const wxString& aVariantName = wxEmptyString ) const;
276
277 virtual void SetExcludedFromPosFiles( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
278 const wxString& aVariantName = wxEmptyString ) { }
279 virtual bool GetExcludedFromPosFiles( const SCH_SHEET_PATH* aInstance = nullptr,
280 const wxString& aVariantName = wxEmptyString ) const { return false; }
281 bool ResolveExcludedFromPosFiles( const SCH_SHEET_PATH* aInstance = nullptr,
282 const wxString& aVariantName = wxEmptyString ) const;
283
284 virtual void SetDNP( bool aDNP, const SCH_SHEET_PATH* aInstance = nullptr,
285 const wxString& aVariantName = wxEmptyString ) { }
286 virtual bool GetDNP( const SCH_SHEET_PATH* aInstance = nullptr,
287 const wxString& aVariantName = wxEmptyString ) const { return false; }
288 bool ResolveDNP( const SCH_SHEET_PATH* aInstance = nullptr,
289 const wxString& aVariantName = wxEmptyString ) const;
290
291 wxString ResolveText( const wxString& aText, const SCH_SHEET_PATH* aPath, int aDepth = 0 ) const;
292
302 virtual bool IsMovableFromAnchorPoint() const { return true; }
303
305 void SetStoredPos( const VECTOR2I& aPos ) { m_storedPos = aPos; }
306
319 SCHEMATIC* Schematic() const;
320
321 const SYMBOL* GetParentSymbol() const;
323
328 virtual bool HasHypertext() const { return false; }
329
334 virtual bool HasHoveredHypertext() const { return HasHypertext() && IsRollover(); }
335
336 virtual void DoHypertextAction( EDA_DRAW_FRAME* aFrame, const VECTOR2I& aMousePos ) const { }
337
341 SCH_LAYER_ID GetLayer() const { return m_layer; }
342 void SetLayer( SCH_LAYER_ID aLayer ) { m_layer = aLayer; }
343
347 std::vector<int> ViewGetLayers() const override;
348
349 int GetMaxError() const;
350
354 virtual int GetPenWidth() const { return 0; }
355
356 int GetEffectivePenWidth( const SCH_RENDER_SETTINGS* aSettings ) const;
357
358 const wxString& GetDefaultFont( const RENDER_SETTINGS* aSettings ) const;
359
360 const KIFONT::METRICS& GetFontMetrics() const;
361
362 bool RenderAsBitmap( double aWorldScale ) const override;
363
370 virtual double Similarity( const SCH_ITEM& aItem ) const
371 {
372 wxCHECK_MSG( false, 0.0, wxT( "Similarity not implemented in " ) + GetClass() );
373 }
374
380 double SimilarityBase( const SCH_ITEM& aItem ) const
381 {
382 double similarity = 1.0;
383
384 if( m_unit != aItem.m_unit )
385 similarity *= 0.9;
386
387 if( m_bodyStyle != aItem.m_bodyStyle )
388 similarity *= 0.9;
389
390 if( m_private != aItem.m_private )
391 similarity *= 0.9;
392
393 return similarity;
394 }
395
399 virtual void Move( const VECTOR2I& aMoveVector )
400 {
401 wxCHECK_MSG( false, /*void*/, wxT( "Move not implemented in " ) + GetClass() );
402 }
403
407 virtual void MirrorHorizontally( int aCenter )
408 {
409 wxCHECK_MSG( false, /*void*/, wxT( "MirrorHorizontally not implemented in " ) + GetClass() );
410 }
411
415 virtual void MirrorVertically( int aCenter )
416 {
417 wxCHECK_MSG( false, /*void*/, wxT( "MirrorVertically not implemented in " ) + GetClass() );
418 }
419
423 virtual void Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
424 {
425 wxCHECK_MSG( false, /*void*/, wxT( "Rotate not implemented in " ) + GetClass() );
426 }
427
437 virtual void BeginEdit( const VECTOR2I& aPosition ) {}
438
449 virtual bool ContinueEdit( const VECTOR2I& aPosition ) { return false; }
450
456 virtual void EndEdit( bool aClosed = false ) {}
457
467 virtual void CalcEdit( const VECTOR2I& aPosition ) {}
468
479 virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {}
480
499 virtual bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
500 std::vector<DANGLING_END_ITEM>& aItemListByPos,
501 const SCH_SHEET_PATH* aSheet = nullptr )
502 {
503 return false;
504 }
505
518 virtual bool IsEndPoint( const VECTOR2I& aPt ) const { return false; }
519
520 virtual bool IsDangling() const { return false; }
521
522 virtual bool CanConnect( const SCH_ITEM* aItem ) const { return m_layer == aItem->GetLayer(); }
523
527 virtual bool IsConnectable() const { return false; }
528
533 virtual bool IsPointClickableAnchor( const VECTOR2I& aPos ) const { return false; }
534
542 virtual std::vector<VECTOR2I> GetConnectionPoints() const { return {}; }
543
550 bool IsConnected( const VECTOR2I& aPoint ) const;
551
557 SCH_CONNECTION* Connection( const SCH_SHEET_PATH* aSheet = nullptr ) const;
558
562 const SCH_ITEM_VEC& ConnectedItems( const SCH_SHEET_PATH& aPath );
563
567 void AddConnectionTo( const SCH_SHEET_PATH& aPath, SCH_ITEM* aItem );
568
572 void ClearConnectedItems( const SCH_SHEET_PATH& aPath );
573
580
582
586 virtual bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const { return true; }
587
589
590 void SetConnectivityDirty( bool aDirty = true ) { m_connectivity_dirty = aDirty; }
591
607 virtual bool HasConnectivityChanges( const SCH_ITEM* aItem,
608 const SCH_SHEET_PATH* aInstance = nullptr ) const
609 {
610 return false;
611 }
612
614 void SetConnectionGraph( CONNECTION_GRAPH* aGraph );
615
616 virtual bool HasCachedDriverName() const { return false; }
617 virtual const wxString& GetCachedDriverName() const;
618
619 virtual void SetLastResolvedState( const SCH_ITEM* aItem ) { }
620
621 std::shared_ptr<NETCLASS> GetEffectiveNetClass( const SCH_SHEET_PATH* aSheet = nullptr ) const;
622
628
629 virtual void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) { }
630
631 virtual void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) { }
632
633 virtual void ClearCaches();
634
642 virtual bool HasLineStroke() const { return false; }
643
644 virtual STROKE_PARAMS GetStroke() const { wxCHECK( false, STROKE_PARAMS() ); }
645
646 virtual void SetStroke( const STROKE_PARAMS& aStroke ) { wxCHECK( false, /* void */ ); }
647
648 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
649
660 virtual void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
661 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed)
662 {
663 wxCHECK_MSG( false, /*void*/, wxT( "Plot not implemented in " ) + GetClass() );
664 }
665
670
674 void AddRuleAreaToCache( SCH_RULE_AREA* aRuleArea ) { m_rule_areas_cache.insert( aRuleArea ); }
675
679 void RemoveRuleAreaFromCache( SCH_RULE_AREA* aRuleArea ) { m_rule_areas_cache.erase( aRuleArea ); }
680
684 const std::unordered_set<SCH_RULE_AREA*>& GetRuleAreaCache() const
685 {
686 return m_rule_areas_cache;
687 }
688
689 const std::vector<wxString>* GetEmbeddedFonts() override;
690
705 enum COMPARE_FLAGS : int
706 {
707 UNIT = 0x01,
708 EQUALITY = 0x02,
709 ERC = 0x04,
711 };
712
713 virtual bool operator==( const SCH_ITEM& aOther ) const;
714
715 virtual bool operator<( const SCH_ITEM& aItem ) const;
716
717protected:
725 virtual void swapData( SCH_ITEM* aItem );
726
728 {
729 return static_cast<SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
730 }
731
733 {
734 bool operator()( const SCH_ITEM* aFirst, const SCH_ITEM* aSecond ) const;
735 };
736
757 virtual int compare( const SCH_ITEM& aOther, int aCompareFlags = 0 ) const;
758
759private:
760 friend class CONNECTION_GRAPH;
761
775 virtual bool doIsConnected( const VECTOR2I& aPosition ) const { return false; }
776
777protected:
779 int m_unit; // set to 0 if common to all units
780 int m_bodyStyle; // set to 0 if common to all body styles
781 bool m_private; // only shown in Symbol Editor
782 AUTOPLACE_ALGO m_fieldsAutoplaced; // indicates status of field autoplacement
783 VECTOR2I m_storedPos; // temp variable used in some move commands to store
784 // an initial position of the item or mouse cursor
785
787 std::map<SCH_SHEET_PATH, SCH_ITEM_VEC, SHEET_PATH_CMP> m_connected_items;
788
790 std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> m_connection_map;
791
793
795 std::unordered_set<SCH_RULE_AREA*> m_rule_areas_cache;
796
797private:
798 friend class LIB_SYMBOL;
799};
800
801#ifndef SWIG
803#endif
804
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:950
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Definition sch_item.cpp:939
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:960
const EDA_ITEM * m_parent
A pointer to the parent object (in the case of pins).
Definition sch_item.h:139
bool operator==(const DANGLING_END_ITEM &aB) const
Definition sch_item.h:116
DANGLING_END_T m_type
The type of connection of m_item.
Definition sch_item.h:138
DANGLING_END_ITEM(DANGLING_END_T aType, EDA_ITEM *aItem, const VECTOR2I &aPosition)
Definition sch_item.h:99
DANGLING_END_T GetType() const
Definition sch_item.h:133
bool operator<(const DANGLING_END_ITEM &rhs) const
Definition sch_item.h:124
DANGLING_END_ITEM(DANGLING_END_T aType, EDA_ITEM *aItem, const VECTOR2I &aPosition, const EDA_ITEM *aParent)
Definition sch_item.h:107
VECTOR2I m_pos
The position of the connection point.
Definition sch_item.h:137
const EDA_ITEM * GetParent() const
Definition sch_item.h:132
EDA_ITEM * GetItem() const
Definition sch_item.h:131
EDA_ITEM * m_item
A pointer to the connectable object.
Definition sch_item.h:136
VECTOR2I GetPosition() const
Definition sch_item.h:130
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:99
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:111
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition eda_item.h:198
bool IsRollover() const
Definition eda_item.h:132
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:41
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:66
Base plotter engine class.
Definition plotter.h:136
RENDER_SETTINGS * RenderSettings()
Definition plotter.h:167
Holds all the data relating to one schematic.
Definition schematic.h:88
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:168
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:803
void SetStoredPos(const VECTOR2I &aPos)
Definition sch_item.h:305
friend class CONNECTION_GRAPH
Definition sch_item.h:760
virtual void SetExcludedFromBOM(bool aExcludeFromBOM, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:263
VECTOR2I m_storedPos
Definition sch_item.h:783
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:146
virtual void SetBodyStyle(int aBodyStyle)
Definition sch_item.h:247
virtual bool CanConnect(const SCH_ITEM *aItem) const
Definition sch_item.h:522
virtual bool IsEndPoint(const VECTOR2I &aPt) const
Test if aPt is an end point of this schematic object.
Definition sch_item.h:518
virtual bool IsConnectable() const
Definition sch_item.h:527
void RemoveRuleAreaFromCache(SCH_RULE_AREA *aRuleArea)
Remove a specific rule area from the item's cache.
Definition sch_item.h:679
virtual void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo)
Definition sch_item.h:629
virtual bool HasHoveredHypertext() const
Indicates that a hypertext link is currently active.
Definition sch_item.h:334
int m_unit
Definition sch_item.h:779
bool ResolveExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:332
virtual int GetPenWidth() const
Definition sch_item.h:354
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:539
SCH_ITEM & operator=(const SCH_ITEM &aPin)
Definition sch_item.cpp:80
void ClearConnectedItems(const SCH_SHEET_PATH &aPath)
Clear all connections to this item.
Definition sch_item.cpp:530
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
Definition sch_item.h:775
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
Definition sch_item.h:631
int m_bodyStyle
Definition sch_item.h:780
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:479
const std::vector< wxString > * GetEmbeddedFonts() override
Definition sch_item.cpp:819
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition sch_item.h:727
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:499
virtual ~SCH_ITEM()
Definition sch_item.cpp:93
const SYMBOL * GetParentSymbol() const
Definition sch_item.cpp:260
virtual wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const
Definition sch_item.cpp:188
void SetPrivate(bool aPrivate)
Definition sch_item.h:253
virtual void swapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
Definition sch_item.cpp:607
virtual const wxString & GetCachedDriverName() const
Definition sch_item.cpp:600
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:254
virtual void SetLastResolvedState(const SCH_ITEM *aItem)
Definition sch_item.h:619
int GetBodyStyle() const
Definition sch_item.h:248
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:370
virtual bool IsDangling() const
Definition sch_item.h:520
virtual bool IsPointClickableAnchor(const VECTOR2I &aPos) const
Definition sch_item.h:533
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:457
virtual bool ContinueEdit(const VECTOR2I &aPosition)
Continue an edit in progress at aPosition.
Definition sch_item.h:449
virtual void MirrorHorizontally(int aCenter)
Mirror item horizontally about aCenter.
Definition sch_item.h:407
virtual void DoHypertextAction(EDA_DRAW_FRAME *aFrame, const VECTOR2I &aMousePos) const
Definition sch_item.h:336
const std::unordered_set< SCH_RULE_AREA * > & GetRuleAreaCache() const
Get the cache of rule areas enclosing this item.
Definition sch_item.h:684
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
Definition sch_item.cpp:561
virtual wxString GetUnitDisplayName(int aUnit, bool aLabel) const
Definition sch_item.cpp:177
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
Definition sch_item.cpp:545
friend class LIB_SYMBOL
Definition sch_item.h:798
virtual void Move(const VECTOR2I &aMoveVector)
Move the item by aMoveVector to a new position.
Definition sch_item.h:399
COMPARE_FLAGS
The list of flags used by the compare function.
Definition sch_item.h:706
@ SKIP_TST_POS
Definition sch_item.h:710
virtual bool HasHypertext() const
Indicates that the item has at least one hypertext action.
Definition sch_item.h:328
virtual bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:279
int GetUnit() const
Definition sch_item.h:239
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition sch_item.cpp:509
virtual void CalcEdit(const VECTOR2I &aPosition)
Calculate the attributes of an item at aPosition when it is being edited.
Definition sch_item.h:467
virtual bool operator==(const SCH_ITEM &aOther) const
Definition sch_item.cpp:674
bool m_connectivity_dirty
Definition sch_item.h:792
virtual void SetDNP(bool aDNP, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:284
bool IsPrivate() const
Definition sch_item.h:254
virtual void ClearCaches()
Definition sch_item.cpp:654
void SetLayer(SCH_LAYER_ID aLayer)
Definition sch_item.h:342
void AddRuleAreaToCache(SCH_RULE_AREA *aRuleArea)
Add a rule area to the item's cache.
Definition sch_item.h:674
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition sch_item.h:341
void ClearRuleAreasCache()
Reset the cache of rule areas (called prior to schematic connectivity computation)
Definition sch_item.h:669
virtual void SetStroke(const STROKE_PARAMS &aStroke)
Definition sch_item.h:646
int GetMaxError() const
Definition sch_item.cpp:737
virtual bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:272
virtual void SetBodyStyleProp(const wxString &aBodyStyle)
Definition sch_item.cpp:226
void SetConnectivityDirty(bool aDirty=true)
Definition sch_item.h:590
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:698
virtual wxString GetBodyStyleProp() const
Definition sch_item.cpp:248
void SetFieldsAutoplaced(AUTOPLACE_ALGO aAlgo)
Definition sch_item.h:627
bool RenderAsBitmap(double aWorldScale) const override
Definition sch_item.cpp:791
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:660
virtual void Rotate(const VECTOR2I &aCenter, bool aRotateCCW)
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition sch_item.h:423
const wxString & GetDefaultFont(const RENDER_SETTINGS *aSettings) const
Definition sch_item.cpp:746
bool IsConnectivityDirty() const
Definition sch_item.h:588
void SetConnectionGraph(CONNECTION_GRAPH *aGraph)
Update the connection graph for all connections in this item.
Definition sch_item.cpp:497
virtual void SetUnit(int aUnit)
Definition sch_item.h:238
AUTOPLACE_ALGO m_fieldsAutoplaced
Definition sch_item.h:782
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:795
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition sch_item.cpp:633
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
Definition sch_item.cpp:464
virtual void SetUnitString(const wxString &aUnit)
Definition sch_item.cpp:199
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:56
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
Definition sch_item.h:790
virtual bool HasCachedDriverName() const
Definition sch_item.h:616
virtual bool operator<(const SCH_ITEM &aItem) const
Definition sch_item.cpp:683
bool ResolveExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:300
bool m_private
Definition sch_item.h:781
SCH_CONNECTION * GetOrInitConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Definition sch_item.cpp:585
virtual bool IsMovableFromAnchorPoint() const
Check if object is movable from the anchor point.
Definition sch_item.h:302
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:607
AUTOPLACE_ALGO GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
Definition sch_item.h:626
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:473
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
Definition sch_item.cpp:363
virtual void SetExcludedFromPosFiles(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:277
wxString GetClass() const override
Return the class name.
Definition sch_item.h:178
VECTOR2I & GetStoredPos()
Definition sch_item.h:304
bool ResolveExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:316
virtual void EndEdit(bool aClosed=false)
End an object editing action.
Definition sch_item.h:456
const KIFONT::METRICS & GetFontMetrics() const
Definition sch_item.cpp:759
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:787
bool ResolveDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:348
virtual wxString GetUnitString() const
Definition sch_item.cpp:221
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
Definition sch_item.cpp:768
virtual STROKE_PARAMS GetStroke() const
Definition sch_item.h:644
virtual void BeginEdit(const VECTOR2I &aPosition)
Begin drawing a symbol library draw item at aPosition.
Definition sch_item.h:437
bool IsGroupableType() const
Definition sch_item.cpp:114
void SwapItemData(SCH_ITEM *aImage)
Swap data between aItem and aImage.
Definition sch_item.cpp:613
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:284
SCH_LAYER_ID m_layer
Definition sch_item.h:778
virtual bool HasLineStroke() const
Check if this schematic item has line stoke properties.
Definition sch_item.h:642
virtual bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const
Return true if this item should propagate connection info to aItem.
Definition sch_item.h:586
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition sch_item.h:542
virtual void SetExcludedFromBoard(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:270
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:380
virtual bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:258
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:286
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition sch_item.h:183
virtual void MirrorVertically(int aCenter)
Mirror item vertically about aCenter.
Definition sch_item.h:415
virtual void SetExcludedFromSim(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:256
virtual bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:265
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:63
RECURSE_MODE
Definition eda_item.h:51
SCH_LAYER_ID
Eeschema drawing layers.
Definition layer_ids.h:449
@ LAYER_WIRE
Definition layer_ids.h:452
@ LAYER_NOTES
Definition layer_ids.h:467
@ LAYER_BUS
Definition layer_ids.h:453
#define DECLARE_ENUM_TO_WXANY(type)
Definition property.h:787
AUTOPLACE_ALGO
Definition sch_item.h:69
@ AUTOPLACE_MANUAL
Definition sch_item.h:72
@ AUTOPLACE_NONE
Definition sch_item.h:70
@ AUTOPLACE_AUTO
Definition sch_item.h:71
DANGLING_END_T
Definition sch_item.h:78
@ NO_CONNECT_END
Definition sch_item.h:88
@ SHEET_LABEL_END
Definition sch_item.h:87
@ LABEL_END
Definition sch_item.h:84
@ JUNCTION_END
Definition sch_item.h:82
@ BUS_END
Definition sch_item.h:81
@ PIN_END
Definition sch_item.h:83
@ BUS_ENTRY_END
Definition sch_item.h:85
@ WIRE_END
Definition sch_item.h:80
@ WIRE_ENTRY_END
Definition sch_item.h:86
@ DANGLING_END_UNKNOWN
Definition sch_item.h:79
std::vector< SCH_ITEM * > SCH_ITEM_VEC
Definition sch_item.h:157
BODY_STYLE
Definition sch_item.h:59
@ BASE
Definition sch_item.h:60
@ DEMORGAN
Definition sch_item.h:61
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:692
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:78
@ SCH_LINE_T
Definition typeinfo.h:167
@ SCH_ITEM_LOCATE_WIRE_T
Definition typeinfo.h:190
@ SCH_ITEM_LOCATE_BUS_T
Definition typeinfo.h:191
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
Definition typeinfo.h:192
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695