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
157
165class SCH_ITEM : public EDA_ITEM
166{
167public:
168 SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType, int aUnit = 0, int aBodyStyle = 0 );
169
170 SCH_ITEM( const SCH_ITEM& aItem );
171
172 SCH_ITEM& operator=( const SCH_ITEM& aPin );
173
174 virtual ~SCH_ITEM();
175
176 wxString GetClass() const override
177 {
178 return wxT( "SCH_ITEM" );
179 }
180
181 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
182 {
183 if( EDA_ITEM::IsType( aScanTypes ) )
184 return true;
185
186 for( KICAD_T scanType : aScanTypes )
187 {
188 if( scanType == SCH_ITEM_LOCATE_WIRE_T && m_layer == LAYER_WIRE )
189 return true;
190
191 if ( scanType == SCH_ITEM_LOCATE_BUS_T && m_layer == LAYER_BUS )
192 return true;
193
194 if ( scanType == SCH_ITEM_LOCATE_GRAPHIC_LINE_T
195 && Type() == SCH_LINE_T && m_layer == LAYER_NOTES )
196 {
197 return true;
198 }
199 }
200
201 return false;
202 }
203
204 bool IsGroupableType() const;
205
216 void SwapItemData( SCH_ITEM* aImage );
217
221 void SwapFlags( SCH_ITEM* aItem );
222
234 SCH_ITEM* Duplicate( bool addToParentGroup, SCH_COMMIT* aCommit = nullptr, bool doClone = false ) const;
235
236 virtual void SetUnit( int aUnit ) { m_unit = aUnit; }
237 int GetUnit() const { return m_unit; }
238
239 virtual void SetUnitString( const wxString& aUnit );
240 virtual wxString GetUnitString() const;
241
242 virtual wxString GetUnitDisplayName( int aUnit, bool aLabel ) const;
243 virtual wxString GetBodyStyleDescription( int aBodyStyle, bool aLabel ) const;
244
245 virtual void SetBodyStyle( int aBodyStyle ) { m_bodyStyle = aBodyStyle; }
246 int GetBodyStyle() const { return m_bodyStyle; }
247
248 virtual void SetBodyStyleProp( const wxString& aBodyStyle );
249 virtual wxString GetBodyStyleProp() const;
250
251 void SetPrivate( bool aPrivate ) { m_private = aPrivate; }
252 bool IsPrivate() const { return m_private; }
253
254 bool IsLocked() const override;
255 void SetLocked( bool aLocked ) override { m_isLocked = aLocked; }
256
257 virtual void SetExcludedFromSim( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
258 const wxString& aVariantName = wxEmptyString ) { }
259 virtual bool GetExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
260 const wxString& aVariantName = wxEmptyString ) const { return false; }
261 bool ResolveExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
262 const wxString& aVariantName = wxEmptyString ) const;
263
264 virtual void SetExcludedFromBOM( bool aExcludeFromBOM, const SCH_SHEET_PATH* aInstance = nullptr,
265 const wxString& aVariantName = wxEmptyString ) { }
266 virtual bool GetExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
267 const wxString& aVariantName = wxEmptyString ) const { return false; }
268 bool ResolveExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
269 const wxString& aVariantName = wxEmptyString ) const;
270
271 virtual void SetExcludedFromBoard( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
272 const wxString& aVariantName = wxEmptyString ) { }
273 virtual bool GetExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
274 const wxString& aVariantName = wxEmptyString ) const { return false; }
275 bool ResolveExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
276 const wxString& aVariantName = wxEmptyString ) const;
277
278 virtual void SetExcludedFromPosFiles( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
279 const wxString& aVariantName = wxEmptyString ) { }
280 virtual bool GetExcludedFromPosFiles( const SCH_SHEET_PATH* aInstance = nullptr,
281 const wxString& aVariantName = wxEmptyString ) const { return false; }
282 bool ResolveExcludedFromPosFiles( const SCH_SHEET_PATH* aInstance = nullptr,
283 const wxString& aVariantName = wxEmptyString ) const;
284
285 virtual void SetDNP( bool aDNP, const SCH_SHEET_PATH* aInstance = nullptr,
286 const wxString& aVariantName = wxEmptyString ) { }
287 virtual bool GetDNP( const SCH_SHEET_PATH* aInstance = nullptr,
288 const wxString& aVariantName = wxEmptyString ) const { return false; }
289 bool ResolveDNP( const SCH_SHEET_PATH* aInstance = nullptr,
290 const wxString& aVariantName = wxEmptyString ) const;
291
292 wxString ResolveText( const wxString& aText, const SCH_SHEET_PATH* aPath, int aDepth = 0 ) const;
293
303 virtual bool IsMovableFromAnchorPoint() const { return true; }
304
306 void SetStoredPos( const VECTOR2I& aPos ) { m_storedPos = aPos; }
307
320 SCHEMATIC* Schematic() const;
321
322 const SYMBOL* GetParentSymbol() const;
324
329 virtual bool HasHypertext() const { return false; }
330
335 virtual bool HasHoveredHypertext() const { return HasHypertext() && IsRollover(); }
336
337 virtual void DoHypertextAction( EDA_DRAW_FRAME* aFrame, const VECTOR2I& aMousePos ) const { }
338
342 SCH_LAYER_ID GetLayer() const { return m_layer; }
343 void SetLayer( SCH_LAYER_ID aLayer ) { m_layer = aLayer; }
344
348 std::vector<int> ViewGetLayers() const override;
349
350 int GetMaxError() const;
351
355 virtual int GetPenWidth() const { return 0; }
356
357 int GetEffectivePenWidth( const SCH_RENDER_SETTINGS* aSettings ) const;
358
359 const wxString& GetDefaultFont( const RENDER_SETTINGS* aSettings ) const;
360
361 const KIFONT::METRICS& GetFontMetrics() const;
362
363 bool RenderAsBitmap( double aWorldScale ) const override;
364
371 virtual double Similarity( const SCH_ITEM& aItem ) const
372 {
373 wxCHECK_MSG( false, 0.0, wxT( "Similarity not implemented in " ) + GetClass() );
374 }
375
381 double SimilarityBase( const SCH_ITEM& aItem ) const
382 {
383 double similarity = 1.0;
384
385 if( m_unit != aItem.m_unit )
386 similarity *= 0.9;
387
388 if( m_bodyStyle != aItem.m_bodyStyle )
389 similarity *= 0.9;
390
391 if( m_private != aItem.m_private )
392 similarity *= 0.9;
393
394 return similarity;
395 }
396
400 virtual void Move( const VECTOR2I& aMoveVector )
401 {
402 wxCHECK_MSG( false, /*void*/, wxT( "Move not implemented in " ) + GetClass() );
403 }
404
408 virtual void MirrorHorizontally( int aCenter )
409 {
410 wxCHECK_MSG( false, /*void*/, wxT( "MirrorHorizontally not implemented in " ) + GetClass() );
411 }
412
416 virtual void MirrorVertically( int aCenter )
417 {
418 wxCHECK_MSG( false, /*void*/, wxT( "MirrorVertically not implemented in " ) + GetClass() );
419 }
420
424 virtual void Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
425 {
426 wxCHECK_MSG( false, /*void*/, wxT( "Rotate not implemented in " ) + GetClass() );
427 }
428
438 virtual void BeginEdit( const VECTOR2I& aPosition ) {}
439
450 virtual bool ContinueEdit( const VECTOR2I& aPosition ) { return false; }
451
457 virtual void EndEdit( bool aClosed = false ) {}
458
468 virtual void CalcEdit( const VECTOR2I& aPosition ) {}
469
480 virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {}
481
500 virtual bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
501 std::vector<DANGLING_END_ITEM>& aItemListByPos,
502 const SCH_SHEET_PATH* aSheet = nullptr )
503 {
504 return false;
505 }
506
519 virtual bool IsEndPoint( const VECTOR2I& aPt ) const { return false; }
520
521 virtual bool IsDangling() const { return false; }
522
523 virtual bool CanConnect( const SCH_ITEM* aItem ) const { return m_layer == aItem->GetLayer(); }
524
528 virtual bool IsConnectable() const { return false; }
529
534 virtual bool IsPointClickableAnchor( const VECTOR2I& aPos ) const { return false; }
535
543 virtual std::vector<VECTOR2I> GetConnectionPoints() const { return {}; }
544
551 bool IsConnected( const VECTOR2I& aPoint ) const;
552
558 SCH_CONNECTION* Connection( const SCH_SHEET_PATH* aSheet = nullptr ) const;
559
563 const std::vector<SCH_ITEM*>& ConnectedItems( const SCH_SHEET_PATH& aPath );
564
568 void AddConnectionTo( const SCH_SHEET_PATH& aPath, SCH_ITEM* aItem );
569
573 void ClearConnectedItems( const SCH_SHEET_PATH& aPath );
574
581
583
587 virtual bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const { return true; }
588
590
591 void SetConnectivityDirty( bool aDirty = true ) { m_connectivity_dirty = aDirty; }
592
608 virtual bool HasConnectivityChanges( const SCH_ITEM* aItem,
609 const SCH_SHEET_PATH* aInstance = nullptr ) const
610 {
611 return false;
612 }
613
615 void SetConnectionGraph( CONNECTION_GRAPH* aGraph );
616
617 virtual bool HasCachedDriverName() const { return false; }
618 virtual const wxString& GetCachedDriverName() const;
619
620 virtual void SetLastResolvedState( const SCH_ITEM* aItem ) { }
621
622 std::shared_ptr<NETCLASS> GetEffectiveNetClass( const SCH_SHEET_PATH* aSheet = nullptr ) const;
623
629
630 virtual void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) { }
631
632 virtual void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) { }
633
634 virtual void ClearCaches();
635
643 virtual bool HasLineStroke() const { return false; }
644
645 virtual STROKE_PARAMS GetStroke() const { wxCHECK( false, STROKE_PARAMS() ); }
646
647 virtual void SetStroke( const STROKE_PARAMS& aStroke ) { wxCHECK( false, /* void */ ); }
648
649 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
650
661 virtual void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
662 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed)
663 {
664 wxCHECK_MSG( false, /*void*/, wxT( "Plot not implemented in " ) + GetClass() );
665 }
666
671
675 void AddRuleAreaToCache( SCH_RULE_AREA* aRuleArea ) { m_rule_areas_cache.insert( aRuleArea ); }
676
680 void RemoveRuleAreaFromCache( SCH_RULE_AREA* aRuleArea ) { m_rule_areas_cache.erase( aRuleArea ); }
681
685 const std::unordered_set<SCH_RULE_AREA*>& GetRuleAreaCache() const
686 {
687 return m_rule_areas_cache;
688 }
689
690 const std::vector<wxString>* GetEmbeddedFonts() override;
691
706 enum COMPARE_FLAGS : int
707 {
708 UNIT = 0x01,
709 EQUALITY = 0x02,
710 ERC = 0x04,
712 };
713
714 virtual bool operator==( const SCH_ITEM& aOther ) const;
715
716 virtual bool operator<( const SCH_ITEM& aItem ) const;
717
718protected:
726 virtual void swapData( SCH_ITEM* aItem );
727
729 {
730 return static_cast<SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
731 }
732
734 {
735 bool operator()( const SCH_ITEM* aFirst, const SCH_ITEM* aSecond ) const;
736 };
737
758 virtual int compare( const SCH_ITEM& aOther, int aCompareFlags = 0 ) const;
759
760private:
761 friend class CONNECTION_GRAPH;
762
776 virtual bool doIsConnected( const VECTOR2I& aPosition ) const { return false; }
777
778protected:
780 int m_unit; // set to 0 if common to all units
781 int m_bodyStyle; // set to 0 if common to all body styles
782 bool m_private; // only shown in Symbol Editor
783 AUTOPLACE_ALGO m_fieldsAutoplaced; // indicates status of field autoplacement
784 VECTOR2I m_storedPos; // temp variable used in some move commands to store
785 // an initial position of the item or mouse cursor
786
788 std::map<SCH_SHEET_PATH, std::vector<SCH_ITEM*>, SHEET_PATH_CMP> m_connected_items;
789
791 std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> m_connection_map;
792
794
796 std::unordered_set<SCH_RULE_AREA*> m_rule_areas_cache;
797
799
800private:
801 friend class LIB_SYMBOL;
802};
803
805
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:974
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Definition sch_item.cpp:963
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:984
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:100
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:112
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition eda_item.h:206
bool IsRollover() const
Definition eda_item.h:140
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:137
RENDER_SETTINGS * RenderSettings()
Definition plotter.h:168
Holds all the data relating to one schematic.
Definition schematic.h:89
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:166
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:829
void SetStoredPos(const VECTOR2I &aPos)
Definition sch_item.h:306
friend class CONNECTION_GRAPH
Definition sch_item.h:761
virtual void SetExcludedFromBOM(bool aExcludeFromBOM, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:264
VECTOR2I m_storedPos
Definition sch_item.h:784
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:164
virtual void SetBodyStyle(int aBodyStyle)
Definition sch_item.h:245
virtual bool CanConnect(const SCH_ITEM *aItem) const
Definition sch_item.h:523
virtual bool IsEndPoint(const VECTOR2I &aPt) const
Test if aPt is an end point of this schematic object.
Definition sch_item.h:519
virtual bool IsConnectable() const
Definition sch_item.h:528
void SetLocked(bool aLocked) override
Definition sch_item.h:255
void RemoveRuleAreaFromCache(SCH_RULE_AREA *aRuleArea)
Remove a specific rule area from the item's cache.
Definition sch_item.h:680
virtual void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo)
Definition sch_item.h:630
virtual bool HasHoveredHypertext() const
Indicates that a hypertext link is currently active.
Definition sch_item.h:335
int m_unit
Definition sch_item.h:780
bool ResolveExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:350
virtual int GetPenWidth() const
Definition sch_item.h:355
SCH_ITEM & operator=(const SCH_ITEM &aPin)
Definition sch_item.cpp:82
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:788
void ClearConnectedItems(const SCH_SHEET_PATH &aPath)
Clear all connections to this item.
Definition sch_item.cpp:553
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
Definition sch_item.h:776
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
Definition sch_item.h:632
int m_bodyStyle
Definition sch_item.h:781
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:480
const std::vector< wxString > * GetEmbeddedFonts() override
Definition sch_item.cpp:845
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition sch_item.h:728
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:500
virtual ~SCH_ITEM()
Definition sch_item.cpp:96
const SYMBOL * GetParentSymbol() const
Definition sch_item.cpp:278
virtual wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const
Definition sch_item.cpp:206
void SetPrivate(bool aPrivate)
Definition sch_item.h:251
virtual void swapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
Definition sch_item.cpp:630
virtual const wxString & GetCachedDriverName() const
Definition sch_item.cpp:623
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:272
virtual void SetLastResolvedState(const SCH_ITEM *aItem)
Definition sch_item.h:620
int GetBodyStyle() const
Definition sch_item.h:246
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:371
virtual bool IsDangling() const
Definition sch_item.h:521
virtual bool IsPointClickableAnchor(const VECTOR2I &aPos) const
Definition sch_item.h:534
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:475
virtual bool ContinueEdit(const VECTOR2I &aPosition)
Continue an edit in progress at aPosition.
Definition sch_item.h:450
virtual void MirrorHorizontally(int aCenter)
Mirror item horizontally about aCenter.
Definition sch_item.h:408
virtual void DoHypertextAction(EDA_DRAW_FRAME *aFrame, const VECTOR2I &aMousePos) const
Definition sch_item.h:337
const std::unordered_set< SCH_RULE_AREA * > & GetRuleAreaCache() const
Get the cache of rule areas enclosing this item.
Definition sch_item.h:685
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
Definition sch_item.cpp:584
virtual wxString GetUnitDisplayName(int aUnit, bool aLabel) const
Definition sch_item.cpp:195
bool IsLocked() const override
Definition sch_item.cpp:152
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
Definition sch_item.cpp:568
friend class LIB_SYMBOL
Definition sch_item.h:801
virtual void Move(const VECTOR2I &aMoveVector)
Move the item by aMoveVector to a new position.
Definition sch_item.h:400
COMPARE_FLAGS
The list of flags used by the compare function.
Definition sch_item.h:707
@ SKIP_TST_POS
Definition sch_item.h:711
virtual bool HasHypertext() const
Indicates that the item has at least one hypertext action.
Definition sch_item.h:329
virtual bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:280
int GetUnit() const
Definition sch_item.h:237
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition sch_item.cpp:527
virtual void CalcEdit(const VECTOR2I &aPosition)
Calculate the attributes of an item at aPosition when it is being edited.
Definition sch_item.h:468
virtual bool operator==(const SCH_ITEM &aOther) const
Definition sch_item.cpp:700
bool m_connectivity_dirty
Definition sch_item.h:793
virtual void SetDNP(bool aDNP, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:285
bool IsPrivate() const
Definition sch_item.h:252
virtual void ClearCaches()
Definition sch_item.cpp:680
void SetLayer(SCH_LAYER_ID aLayer)
Definition sch_item.h:343
void AddRuleAreaToCache(SCH_RULE_AREA *aRuleArea)
Add a rule area to the item's cache.
Definition sch_item.h:675
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:562
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition sch_item.h:342
void ClearRuleAreasCache()
Reset the cache of rule areas (called prior to schematic connectivity computation)
Definition sch_item.h:670
virtual void SetStroke(const STROKE_PARAMS &aStroke)
Definition sch_item.h:647
int GetMaxError() const
Definition sch_item.cpp:763
virtual bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:273
virtual void SetBodyStyleProp(const wxString &aBodyStyle)
Definition sch_item.cpp:244
void SetConnectivityDirty(bool aDirty=true)
Definition sch_item.h:591
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:724
virtual wxString GetBodyStyleProp() const
Definition sch_item.cpp:266
void SetFieldsAutoplaced(AUTOPLACE_ALGO aAlgo)
Definition sch_item.h:628
bool RenderAsBitmap(double aWorldScale) const override
Definition sch_item.cpp:817
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:661
virtual void Rotate(const VECTOR2I &aCenter, bool aRotateCCW)
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition sch_item.h:424
const wxString & GetDefaultFont(const RENDER_SETTINGS *aSettings) const
Definition sch_item.cpp:772
bool IsConnectivityDirty() const
Definition sch_item.h:589
void SetConnectionGraph(CONNECTION_GRAPH *aGraph)
Update the connection graph for all connections in this item.
Definition sch_item.cpp:515
virtual void SetUnit(int aUnit)
Definition sch_item.h:236
AUTOPLACE_ALGO m_fieldsAutoplaced
Definition sch_item.h:783
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:796
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition sch_item.cpp:659
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
Definition sch_item.cpp:482
virtual void SetUnitString(const wxString &aUnit)
Definition sch_item.cpp:217
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:791
virtual bool HasCachedDriverName() const
Definition sch_item.h:617
virtual bool operator<(const SCH_ITEM &aItem) const
Definition sch_item.cpp:709
bool ResolveExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:318
bool m_private
Definition sch_item.h:782
SCH_CONNECTION * GetOrInitConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Definition sch_item.cpp:608
virtual bool IsMovableFromAnchorPoint() const
Check if object is movable from the anchor point.
Definition sch_item.h:303
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:608
AUTOPLACE_ALGO GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
Definition sch_item.h:627
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:491
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
Definition sch_item.cpp:381
virtual void SetExcludedFromPosFiles(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:278
wxString GetClass() const override
Return the class name.
Definition sch_item.h:176
VECTOR2I & GetStoredPos()
Definition sch_item.h:305
bool ResolveExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:334
virtual void EndEdit(bool aClosed=false)
End an object editing action.
Definition sch_item.h:457
const KIFONT::METRICS & GetFontMetrics() const
Definition sch_item.cpp:785
bool ResolveDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:366
virtual wxString GetUnitString() const
Definition sch_item.cpp:239
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
Definition sch_item.cpp:794
virtual STROKE_PARAMS GetStroke() const
Definition sch_item.h:645
virtual void BeginEdit(const VECTOR2I &aPosition)
Begin drawing a symbol library draw item at aPosition.
Definition sch_item.h:438
bool IsGroupableType() const
Definition sch_item.cpp:117
void SwapItemData(SCH_ITEM *aImage)
Swap data between aItem and aImage.
Definition sch_item.cpp:636
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:302
SCH_LAYER_ID m_layer
Definition sch_item.h:779
virtual bool HasLineStroke() const
Check if this schematic item has line stoke properties.
Definition sch_item.h:643
virtual bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const
Return true if this item should propagate connection info to aItem.
Definition sch_item.h:587
bool m_isLocked
Definition sch_item.h:798
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition sch_item.h:543
virtual void SetExcludedFromBoard(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:271
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:381
virtual bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:259
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:287
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition sch_item.h:181
virtual void MirrorVertically(int aCenter)
Mirror item vertically about aCenter.
Definition sch_item.h:416
virtual void SetExcludedFromSim(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:257
virtual bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:266
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:52
SCH_LAYER_ID
Eeschema drawing layers.
Definition layer_ids.h:451
@ LAYER_WIRE
Definition layer_ids.h:454
@ LAYER_NOTES
Definition layer_ids.h:469
@ LAYER_BUS
Definition layer_ids.h:455
#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
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:718
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:75
@ SCH_LINE_T
Definition typeinfo.h:164
@ SCH_ITEM_LOCATE_WIRE_T
Definition typeinfo.h:187
@ SCH_ITEM_LOCATE_BUS_T
Definition typeinfo.h:188
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
Definition typeinfo.h:189
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:687