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 <sch_sheet_path.h>
34#include <netclass.h>
35#include <stroke_params.h>
36#include <layer_ids.h>
37#include <sch_render_settings.h>
38#include <plotters/plotter.h>
39
41class SCH_CONNECTION;
42class SCH_SHEET_PATH;
43class SCHEMATIC;
44class SCH_COMMIT;
45class SYMBOL;
46class LINE_READER;
47class SCH_EDIT_FRAME;
48class SCH_RULE_AREA;
49struct SCH_PLOT_OPTS;
50
51namespace KIFONT
52{
53class METRICS;
54}
55
56
57enum BODY_STYLE : int
58{
59 BASE = 1,
61};
62
63
64#define MINIMUM_SELECTION_DISTANCE 2 // Minimum selection distance in mils
65
66
68{
69 AUTOPLACE_NONE, // No autoplacement
70 AUTOPLACE_AUTO, // A minimalist placement algorithm.
71 AUTOPLACE_MANUAL // A more involved routine that can be annoying if done from the get go.
72 // Initiated by a hotkey or menu item.
73};
74
75
89
90
96{
97public:
98 DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition )
99 {
100 m_item = aItem;
101 m_type = aType;
102 m_pos = aPosition;
103 m_parent = aItem;
104 }
105
106 DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition,
107 const EDA_ITEM* aParent )
108 {
109 m_item = aItem;
110 m_type = aType;
111 m_pos = aPosition;
112 m_parent = aParent;
113 }
114
115 bool operator==( const DANGLING_END_ITEM& aB ) const
116 {
117 return GetItem() == aB.GetItem()
118 && GetPosition() == aB.GetPosition()
119 && GetType() == aB.GetType()
120 && GetParent() == aB.GetParent();
121 }
122
123 bool operator<( const DANGLING_END_ITEM& rhs ) const
124 {
125 return( m_pos.x < rhs.m_pos.x || ( m_pos.x == rhs.m_pos.x && m_pos.y < rhs.m_pos.y )
126 || ( m_pos == rhs.m_pos && m_item < rhs.m_item ) );
127 }
128
129 VECTOR2I GetPosition() const { return m_pos; }
130 EDA_ITEM* GetItem() const { return m_item; }
131 const EDA_ITEM* GetParent() const { return m_parent; }
132 DANGLING_END_T GetType() const { return m_type; }
133
134private:
139};
140
141
143{
144public:
145 static std::vector<DANGLING_END_ITEM>::iterator
146 get_lower_pos( std::vector<DANGLING_END_ITEM>& aItemListByPos, const VECTOR2I& aPos );
147
148 static std::vector<DANGLING_END_ITEM>::iterator
149 get_lower_type( std::vector<DANGLING_END_ITEM>& aItemListByType, const DANGLING_END_T& aType );
150
152 static void sort_dangling_end_items( std::vector<DANGLING_END_ITEM>& aItemListByType,
153 std::vector<DANGLING_END_ITEM>& aItemListByPos );
154};
155
156typedef std::vector<SCH_ITEM*> SCH_ITEM_VEC;
157
158
166class SCH_ITEM : public EDA_ITEM
167{
168public:
169 SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType, int aUnit = 0, int aBodyStyle = 0 );
170
171 SCH_ITEM( const SCH_ITEM& aItem );
172
173 SCH_ITEM& operator=( const SCH_ITEM& aPin );
174
175 virtual ~SCH_ITEM();
176
177 wxString GetClass() const override
178 {
179 return wxT( "SCH_ITEM" );
180 }
181
182 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
183 {
184 if( EDA_ITEM::IsType( aScanTypes ) )
185 return true;
186
187 for( KICAD_T scanType : aScanTypes )
188 {
189 if( scanType == SCH_ITEM_LOCATE_WIRE_T && m_layer == LAYER_WIRE )
190 return true;
191
192 if ( scanType == SCH_ITEM_LOCATE_BUS_T && m_layer == LAYER_BUS )
193 return true;
194
195 if ( scanType == SCH_ITEM_LOCATE_GRAPHIC_LINE_T
196 && Type() == SCH_LINE_T && m_layer == LAYER_NOTES )
197 {
198 return true;
199 }
200 }
201
202 return false;
203 }
204
205 bool IsGroupableType() const;
206
217 void SwapItemData( SCH_ITEM* aImage );
218
222 void SwapFlags( SCH_ITEM* aItem );
223
235 SCH_ITEM* Duplicate( bool addToParentGroup, SCH_COMMIT* aCommit = nullptr, bool doClone = false ) const;
236
237 virtual void SetUnit( int aUnit ) { m_unit = aUnit; }
238 int GetUnit() const { return m_unit; }
239
240 virtual void SetUnitString( const wxString& aUnit );
241 virtual wxString GetUnitString() const;
242
243 virtual wxString GetUnitDisplayName( int aUnit, bool aLabel ) const;
244 virtual wxString GetBodyStyleDescription( int aBodyStyle, bool aLabel ) const;
245
246 virtual void SetBodyStyle( int aBodyStyle ) { m_bodyStyle = aBodyStyle; }
247 int GetBodyStyle() const { return m_bodyStyle; }
248
249 virtual void SetBodyStyleProp( const wxString& aBodyStyle );
250 virtual wxString GetBodyStyleProp() const;
251
252 void SetPrivate( bool aPrivate ) { m_private = aPrivate; }
253 bool IsPrivate() const { return m_private; }
254
255 virtual void SetExcludedFromSim( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
256 const wxString& aVariantName = wxEmptyString ) { }
257 virtual bool GetExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
258 const wxString& aVariantName = wxEmptyString ) const { return false; }
259 bool ResolveExcludedFromSim( const SCH_SHEET_PATH* aInstance = nullptr,
260 const wxString& aVariantName = wxEmptyString ) const;
261
262 virtual void SetExcludedFromBOM( bool aExcludeFromBOM, const SCH_SHEET_PATH* aInstance = nullptr,
263 const wxString& aVariantName = wxEmptyString ) { }
264 virtual bool GetExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
265 const wxString& aVariantName = wxEmptyString ) const { return false; }
266 bool ResolveExcludedFromBOM( const SCH_SHEET_PATH* aInstance = nullptr,
267 const wxString& aVariantName = wxEmptyString ) const;
268
269 virtual void SetExcludedFromBoard( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
270 const wxString& aVariantName = wxEmptyString ) { }
271 virtual bool GetExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
272 const wxString& aVariantName = wxEmptyString ) const { return false; }
273 bool ResolveExcludedFromBoard( const SCH_SHEET_PATH* aInstance = nullptr,
274 const wxString& aVariantName = wxEmptyString ) const;
275
276 virtual void SetExcludedFromPosFiles( bool aExclude, const SCH_SHEET_PATH* aInstance = nullptr,
277 const wxString& aVariantName = wxEmptyString ) { }
278 virtual bool GetExcludedFromPosFiles( const SCH_SHEET_PATH* aInstance = nullptr,
279 const wxString& aVariantName = wxEmptyString ) const { return false; }
280 bool ResolveExcludedFromPosFiles( const SCH_SHEET_PATH* aInstance = nullptr,
281 const wxString& aVariantName = wxEmptyString ) const;
282
283 virtual void SetDNP( bool aDNP, const SCH_SHEET_PATH* aInstance = nullptr,
284 const wxString& aVariantName = wxEmptyString ) { }
285 virtual bool GetDNP( const SCH_SHEET_PATH* aInstance = nullptr,
286 const wxString& aVariantName = wxEmptyString ) const { return false; }
287 bool ResolveDNP( const SCH_SHEET_PATH* aInstance = nullptr,
288 const wxString& aVariantName = wxEmptyString ) const;
289
290 wxString ResolveText( const wxString& aText, const SCH_SHEET_PATH* aPath, int aDepth = 0 ) const;
291
301 virtual bool IsMovableFromAnchorPoint() const { return true; }
302
304 void SetStoredPos( const VECTOR2I& aPos ) { m_storedPos = aPos; }
305
318 SCHEMATIC* Schematic() const;
319
320 const SYMBOL* GetParentSymbol() const;
322
327 virtual bool HasHypertext() const { return false; }
328
333 virtual bool HasHoveredHypertext() const { return HasHypertext() && IsRollover(); }
334
335 virtual void DoHypertextAction( EDA_DRAW_FRAME* aFrame, const VECTOR2I& aMousePos ) const { }
336
340 SCH_LAYER_ID GetLayer() const { return m_layer; }
341 void SetLayer( SCH_LAYER_ID aLayer ) { m_layer = aLayer; }
342
346 std::vector<int> ViewGetLayers() const override;
347
348 int GetMaxError() const;
349
353 virtual int GetPenWidth() const { return 0; }
354
355 int GetEffectivePenWidth( const SCH_RENDER_SETTINGS* aSettings ) const;
356
357 const wxString& GetDefaultFont( const RENDER_SETTINGS* aSettings ) const;
358
359 const KIFONT::METRICS& GetFontMetrics() const;
360
361 bool RenderAsBitmap( double aWorldScale ) const override;
362
369 virtual double Similarity( const SCH_ITEM& aItem ) const
370 {
371 wxCHECK_MSG( false, 0.0, wxT( "Similarity not implemented in " ) + GetClass() );
372 }
373
379 double SimilarityBase( const SCH_ITEM& aItem ) const
380 {
381 double similarity = 1.0;
382
383 if( m_unit != aItem.m_unit )
384 similarity *= 0.9;
385
386 if( m_bodyStyle != aItem.m_bodyStyle )
387 similarity *= 0.9;
388
389 if( m_private != aItem.m_private )
390 similarity *= 0.9;
391
392 return similarity;
393 }
394
398 virtual void Move( const VECTOR2I& aMoveVector )
399 {
400 wxCHECK_MSG( false, /*void*/, wxT( "Move not implemented in " ) + GetClass() );
401 }
402
406 virtual void MirrorHorizontally( int aCenter )
407 {
408 wxCHECK_MSG( false, /*void*/, wxT( "MirrorHorizontally not implemented in " ) + GetClass() );
409 }
410
414 virtual void MirrorVertically( int aCenter )
415 {
416 wxCHECK_MSG( false, /*void*/, wxT( "MirrorVertically not implemented in " ) + GetClass() );
417 }
418
422 virtual void Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
423 {
424 wxCHECK_MSG( false, /*void*/, wxT( "Rotate not implemented in " ) + GetClass() );
425 }
426
436 virtual void BeginEdit( const VECTOR2I& aPosition ) {}
437
448 virtual bool ContinueEdit( const VECTOR2I& aPosition ) { return false; }
449
455 virtual void EndEdit( bool aClosed = false ) {}
456
466 virtual void CalcEdit( const VECTOR2I& aPosition ) {}
467
478 virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {}
479
498 virtual bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
499 std::vector<DANGLING_END_ITEM>& aItemListByPos,
500 const SCH_SHEET_PATH* aSheet = nullptr )
501 {
502 return false;
503 }
504
517 virtual bool IsEndPoint( const VECTOR2I& aPt ) const { return false; }
518
519 virtual bool IsDangling() const { return false; }
520
521 virtual bool CanConnect( const SCH_ITEM* aItem ) const { return m_layer == aItem->GetLayer(); }
522
526 virtual bool IsConnectable() const { return false; }
527
532 virtual bool IsPointClickableAnchor( const VECTOR2I& aPos ) const { return false; }
533
541 virtual std::vector<VECTOR2I> GetConnectionPoints() const { return {}; }
542
549 bool IsConnected( const VECTOR2I& aPoint ) const;
550
556 SCH_CONNECTION* Connection( const SCH_SHEET_PATH* aSheet = nullptr ) const;
557
561 const SCH_ITEM_VEC& ConnectedItems( const SCH_SHEET_PATH& aPath );
562
566 void AddConnectionTo( const SCH_SHEET_PATH& aPath, SCH_ITEM* aItem );
567
571 void ClearConnectedItems( const SCH_SHEET_PATH& aPath );
572
579
581
585 virtual bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const { return true; }
586
588
589 void SetConnectivityDirty( bool aDirty = true ) { m_connectivity_dirty = aDirty; }
590
606 virtual bool HasConnectivityChanges( const SCH_ITEM* aItem,
607 const SCH_SHEET_PATH* aInstance = nullptr ) const
608 {
609 return false;
610 }
611
613 void SetConnectionGraph( CONNECTION_GRAPH* aGraph );
614
615 virtual bool HasCachedDriverName() const { return false; }
616 virtual const wxString& GetCachedDriverName() const;
617
618 virtual void SetLastResolvedState( const SCH_ITEM* aItem ) { }
619
620 std::shared_ptr<NETCLASS> GetEffectiveNetClass( const SCH_SHEET_PATH* aSheet = nullptr ) const;
621
627
628 virtual void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) { }
629
630 virtual void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) { }
631
632 virtual void ClearCaches();
633
641 virtual bool HasLineStroke() const { return false; }
642
643 virtual STROKE_PARAMS GetStroke() const { wxCHECK( false, STROKE_PARAMS() ); }
644
645 virtual void SetStroke( const STROKE_PARAMS& aStroke ) { wxCHECK( false, /* void */ ); }
646
647 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
648
659 virtual void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
660 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed)
661 {
662 wxCHECK_MSG( false, /*void*/, wxT( "Plot not implemented in " ) + GetClass() );
663 }
664
669
673 void AddRuleAreaToCache( SCH_RULE_AREA* aRuleArea ) { m_rule_areas_cache.insert( aRuleArea ); }
674
678 const std::unordered_set<SCH_RULE_AREA*>& GetRuleAreaCache() const
679 {
680 return m_rule_areas_cache;
681 }
682
683 const std::vector<wxString>* GetEmbeddedFonts() override;
684
699 enum COMPARE_FLAGS : int
700 {
701 UNIT = 0x01,
702 EQUALITY = 0x02,
703 ERC = 0x04,
705 };
706
707 virtual bool operator==( const SCH_ITEM& aOther ) const;
708
709 virtual bool operator<( const SCH_ITEM& aItem ) const;
710
711protected:
719 virtual void swapData( SCH_ITEM* aItem );
720
722 {
723 return static_cast<SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
724 }
725
727 {
728 bool operator()( const SCH_ITEM* aFirst, const SCH_ITEM* aSecond ) const;
729 };
730
751 virtual int compare( const SCH_ITEM& aOther, int aCompareFlags = 0 ) const;
752
753private:
754 friend class CONNECTION_GRAPH;
755
769 virtual bool doIsConnected( const VECTOR2I& aPosition ) const { return false; }
770
771protected:
773 int m_unit; // set to 0 if common to all units
774 int m_bodyStyle; // set to 0 if common to all body styles
775 bool m_private; // only shown in Symbol Editor
776 AUTOPLACE_ALGO m_fieldsAutoplaced; // indicates status of field autoplacement
777 VECTOR2I m_storedPos; // temp variable used in some move commands to store
778 // an initial position of the item or mouse cursor
779
781 std::map<SCH_SHEET_PATH, SCH_ITEM_VEC, SHEET_PATH_CMP> m_connected_items;
782
784 std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> m_connection_map;
785
787
789 std::unordered_set<SCH_RULE_AREA*> m_rule_areas_cache;
790
791private:
792 friend class LIB_SYMBOL;
793};
794
795#ifndef SWIG
797#endif
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:943
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Definition sch_item.cpp:932
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:953
const EDA_ITEM * m_parent
A pointer to the parent object (in the case of pins).
Definition sch_item.h:138
bool operator==(const DANGLING_END_ITEM &aB) const
Definition sch_item.h:115
DANGLING_END_T m_type
The type of connection of m_item.
Definition sch_item.h:137
DANGLING_END_ITEM(DANGLING_END_T aType, EDA_ITEM *aItem, const VECTOR2I &aPosition)
Definition sch_item.h:98
DANGLING_END_T GetType() const
Definition sch_item.h:132
bool operator<(const DANGLING_END_ITEM &rhs) const
Definition sch_item.h:123
DANGLING_END_ITEM(DANGLING_END_T aType, EDA_ITEM *aItem, const VECTOR2I &aPosition, const EDA_ITEM *aParent)
Definition sch_item.h:106
VECTOR2I m_pos
The position of the connection point.
Definition sch_item.h:136
const EDA_ITEM * GetParent() const
Definition sch_item.h:131
EDA_ITEM * GetItem() const
Definition sch_item.h:130
EDA_ITEM * m_item
A pointer to the connectable object.
Definition sch_item.h:135
VECTOR2I GetPosition() const
Definition sch_item.h:129
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition eda_item.h:198
bool IsRollover() const
Definition eda_item.h:131
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:39
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:167
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:796
void SetStoredPos(const VECTOR2I &aPos)
Definition sch_item.h:304
friend class CONNECTION_GRAPH
Definition sch_item.h:754
virtual void SetExcludedFromBOM(bool aExcludeFromBOM, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:262
VECTOR2I m_storedPos
Definition sch_item.h:777
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:140
virtual void SetBodyStyle(int aBodyStyle)
Definition sch_item.h:246
virtual bool CanConnect(const SCH_ITEM *aItem) const
Definition sch_item.h:521
virtual bool IsEndPoint(const VECTOR2I &aPt) const
Test if aPt is an end point of this schematic object.
Definition sch_item.h:517
virtual bool IsConnectable() const
Definition sch_item.h:526
virtual void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo)
Definition sch_item.h:628
virtual bool HasHoveredHypertext() const
Indicates that a hypertext link is currently active.
Definition sch_item.h:333
int m_unit
Definition sch_item.h:773
bool ResolveExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:325
virtual int GetPenWidth() const
Definition sch_item.h:353
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:532
SCH_ITEM & operator=(const SCH_ITEM &aPin)
Definition sch_item.cpp:78
void ClearConnectedItems(const SCH_SHEET_PATH &aPath)
Clear all connections to this item.
Definition sch_item.cpp:523
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
Definition sch_item.h:769
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
Definition sch_item.h:630
int m_bodyStyle
Definition sch_item.h:774
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:478
const std::vector< wxString > * GetEmbeddedFonts() override
Definition sch_item.cpp:812
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition sch_item.h:721
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:498
virtual ~SCH_ITEM()
Definition sch_item.cpp:91
const SYMBOL * GetParentSymbol() const
Definition sch_item.cpp:253
virtual wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const
Definition sch_item.cpp:182
void SetPrivate(bool aPrivate)
Definition sch_item.h:252
virtual void swapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
Definition sch_item.cpp:600
virtual const wxString & GetCachedDriverName() const
Definition sch_item.cpp:593
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:247
virtual void SetLastResolvedState(const SCH_ITEM *aItem)
Definition sch_item.h:618
int GetBodyStyle() const
Definition sch_item.h:247
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:369
virtual bool IsDangling() const
Definition sch_item.h:519
virtual bool IsPointClickableAnchor(const VECTOR2I &aPos) const
Definition sch_item.h:532
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:450
virtual bool ContinueEdit(const VECTOR2I &aPosition)
Continue an edit in progress at aPosition.
Definition sch_item.h:448
virtual void MirrorHorizontally(int aCenter)
Mirror item horizontally about aCenter.
Definition sch_item.h:406
virtual void DoHypertextAction(EDA_DRAW_FRAME *aFrame, const VECTOR2I &aMousePos) const
Definition sch_item.h:335
const std::unordered_set< SCH_RULE_AREA * > & GetRuleAreaCache() const
Get the cache of rule areas enclosing this item.
Definition sch_item.h:678
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
Definition sch_item.cpp:554
virtual wxString GetUnitDisplayName(int aUnit, bool aLabel) const
Definition sch_item.cpp:171
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
Definition sch_item.cpp:538
friend class LIB_SYMBOL
Definition sch_item.h:792
virtual void Move(const VECTOR2I &aMoveVector)
Move the item by aMoveVector to a new position.
Definition sch_item.h:398
COMPARE_FLAGS
The list of flags used by the compare function.
Definition sch_item.h:700
@ SKIP_TST_POS
Definition sch_item.h:704
virtual bool HasHypertext() const
Indicates that the item has at least one hypertext action.
Definition sch_item.h:327
virtual bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:278
int GetUnit() const
Definition sch_item.h:238
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition sch_item.cpp:502
virtual void CalcEdit(const VECTOR2I &aPosition)
Calculate the attributes of an item at aPosition when it is being edited.
Definition sch_item.h:466
virtual bool operator==(const SCH_ITEM &aOther) const
Definition sch_item.cpp:667
bool m_connectivity_dirty
Definition sch_item.h:786
virtual void SetDNP(bool aDNP, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:283
bool IsPrivate() const
Definition sch_item.h:253
virtual void ClearCaches()
Definition sch_item.cpp:647
void SetLayer(SCH_LAYER_ID aLayer)
Definition sch_item.h:341
void AddRuleAreaToCache(SCH_RULE_AREA *aRuleArea)
Add a rule area to the item's cache.
Definition sch_item.h:673
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition sch_item.h:340
void ClearRuleAreasCache()
Reset the cache of rule areas (called prior to schematic connectivity computation)
Definition sch_item.h:668
virtual void SetStroke(const STROKE_PARAMS &aStroke)
Definition sch_item.h:645
int GetMaxError() const
Definition sch_item.cpp:730
virtual bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:271
virtual void SetBodyStyleProp(const wxString &aBodyStyle)
Definition sch_item.cpp:219
void SetConnectivityDirty(bool aDirty=true)
Definition sch_item.h:589
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:691
virtual wxString GetBodyStyleProp() const
Definition sch_item.cpp:241
void SetFieldsAutoplaced(AUTOPLACE_ALGO aAlgo)
Definition sch_item.h:626
bool RenderAsBitmap(double aWorldScale) const override
Definition sch_item.cpp:784
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:659
virtual void Rotate(const VECTOR2I &aCenter, bool aRotateCCW)
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition sch_item.h:422
const wxString & GetDefaultFont(const RENDER_SETTINGS *aSettings) const
Definition sch_item.cpp:739
bool IsConnectivityDirty() const
Definition sch_item.h:587
void SetConnectionGraph(CONNECTION_GRAPH *aGraph)
Update the connection graph for all connections in this item.
Definition sch_item.cpp:490
virtual void SetUnit(int aUnit)
Definition sch_item.h:237
AUTOPLACE_ALGO m_fieldsAutoplaced
Definition sch_item.h:776
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:789
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition sch_item.cpp:626
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
Definition sch_item.cpp:457
virtual void SetUnitString(const wxString &aUnit)
Definition sch_item.cpp:192
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:54
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
Definition sch_item.h:784
virtual bool HasCachedDriverName() const
Definition sch_item.h:615
virtual bool operator<(const SCH_ITEM &aItem) const
Definition sch_item.cpp:676
bool ResolveExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:293
bool m_private
Definition sch_item.h:775
SCH_CONNECTION * GetOrInitConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Definition sch_item.cpp:578
virtual bool IsMovableFromAnchorPoint() const
Check if object is movable from the anchor point.
Definition sch_item.h:301
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:606
AUTOPLACE_ALGO GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
Definition sch_item.h:625
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:466
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
Definition sch_item.cpp:356
virtual void SetExcludedFromPosFiles(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:276
wxString GetClass() const override
Return the class name.
Definition sch_item.h:177
VECTOR2I & GetStoredPos()
Definition sch_item.h:303
bool ResolveExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:309
virtual void EndEdit(bool aClosed=false)
End an object editing action.
Definition sch_item.h:455
const KIFONT::METRICS & GetFontMetrics() const
Definition sch_item.cpp:752
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:781
bool ResolveDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:341
virtual wxString GetUnitString() const
Definition sch_item.cpp:214
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
Definition sch_item.cpp:761
virtual STROKE_PARAMS GetStroke() const
Definition sch_item.h:643
virtual void BeginEdit(const VECTOR2I &aPosition)
Begin drawing a symbol library draw item at aPosition.
Definition sch_item.h:436
bool IsGroupableType() const
Definition sch_item.cpp:108
void SwapItemData(SCH_ITEM *aImage)
Swap data between aItem and aImage.
Definition sch_item.cpp:606
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:277
SCH_LAYER_ID m_layer
Definition sch_item.h:772
virtual bool HasLineStroke() const
Check if this schematic item has line stoke properties.
Definition sch_item.h:641
virtual bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const
Return true if this item should propagate connection info to aItem.
Definition sch_item.h:585
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition sch_item.h:541
virtual void SetExcludedFromBoard(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:269
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:379
virtual bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:257
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:285
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition sch_item.h:182
virtual void MirrorVertically(int aCenter)
Mirror item vertically about aCenter.
Definition sch_item.h:414
virtual void SetExcludedFromSim(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Definition sch_item.h:255
virtual bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.h:264
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:50
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:68
@ AUTOPLACE_MANUAL
Definition sch_item.h:71
@ AUTOPLACE_NONE
Definition sch_item.h:69
@ AUTOPLACE_AUTO
Definition sch_item.h:70
DANGLING_END_T
Definition sch_item.h:77
@ NO_CONNECT_END
Definition sch_item.h:87
@ SHEET_LABEL_END
Definition sch_item.h:86
@ LABEL_END
Definition sch_item.h:83
@ JUNCTION_END
Definition sch_item.h:81
@ BUS_END
Definition sch_item.h:80
@ PIN_END
Definition sch_item.h:82
@ BUS_ENTRY_END
Definition sch_item.h:84
@ WIRE_END
Definition sch_item.h:79
@ WIRE_ENTRY_END
Definition sch_item.h:85
@ DANGLING_END_UNKNOWN
Definition sch_item.h:78
std::vector< SCH_ITEM * > SCH_ITEM_VEC
Definition sch_item.h:156
BODY_STYLE
Definition sch_item.h:58
@ BASE
Definition sch_item.h:59
@ DEMORGAN
Definition sch_item.h:60
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
bool operator()(const SCH_ITEM *aFirst, const SCH_ITEM *aSecond) const
Definition sch_item.cpp:685
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