KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_item.cpp
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) 2006 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <pgm_base.h>
27#include <eeschema_settings.h>
28#include <eda_item.h>
29#include <sch_connection.h>
30#include <sch_item.h>
31#include <sch_screen.h>
32#include <sch_sheet_path.h>
33#include <sch_draw_panel.h>
34#include <sch_edit_frame.h>
35#include <schematic.h>
36#include <symbol.h>
37#include <connection_graph.h>
38#include <trace_helpers.h>
39#include <general.h>
40#include <netclass.h>
43
44
45// Rendering fonts is expensive (particularly when using outline fonts). At small effective
46// sizes (ie: zoomed out) the visual differences between outline and/or stroke fonts and the
47// bitmap font becomes immaterial, and there's often more to draw when zoomed out so the
48// performance gain becomes more significant.
49#define BITMAP_FONT_SIZE_THRESHOLD 3
50
51
52wxString SCH_ITEM::GetUnitDescription( int aUnit )
53{
54 if( aUnit == 0 )
55 return _( "All" );
56 else
57 return LIB_SYMBOL::LetterSubReference( aUnit, 'A' );
58}
59
60
61wxString SCH_ITEM::GetBodyStyleDescription( int aBodyStyle )
62{
63 if( aBodyStyle == 0 )
64 return _( "All" );
65 else if( aBodyStyle == BODY_STYLE::DEMORGAN )
66 return _( "Alternate" );
67 else if( aBodyStyle == BODY_STYLE::BASE )
68 return _( "Standard" );
69 else
70 return wxT( "?" );
71}
72
73
74/* Constructor and destructor for SCH_ITEM */
75/* They are not inline because this creates problems with gcc at linking time in debug mode */
76
77SCH_ITEM::SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType, int aUnit, int aBodyStyle ) :
78 EDA_ITEM( aParent, aType, true, false ),
79 m_unit( aUnit ),
80 m_bodyStyle( aBodyStyle ),
81 m_private( false )
82{
83 m_layer = LAYER_WIRE; // It's only a default, in fact
85 m_connectivity_dirty = false; // Item is unconnected until it is placed, so it's clean
86}
87
88
90 EDA_ITEM( aItem )
91{
92 m_layer = aItem.m_layer;
93 m_unit = aItem.m_unit;
95 m_private = aItem.m_private;
98}
99
100
102{
103 m_layer = aItem.m_layer;
104 m_unit = aItem.m_unit;
105 m_bodyStyle = aItem.m_bodyStyle;
106 m_private = aItem.m_private;
109
110 return *this;
111}
112
113
115{
116 for( const auto& it : m_connection_map )
117 delete it.second;
118
119 // Do not try to modify SCHEMATIC::ConnectionGraph()
120 // if the schematic does not exist
122 return;
123
124 SCHEMATIC* sch = Schematic();
125
126 if( sch != nullptr )
127 sch->ConnectionGraph()->RemoveItem( this );
128}
129
130
131SCH_ITEM* SCH_ITEM::Duplicate( bool doClone ) const
132{
133 SCH_ITEM* newItem = (SCH_ITEM*) Clone();
134
135 if( !doClone )
136 const_cast<KIID&>( newItem->m_Uuid ) = KIID();
137
138 newItem->ClearFlags( SELECTED | BRIGHTENED );
139
140 newItem->RunOnChildren(
141 []( SCH_ITEM* aChild )
142 {
143 aChild->ClearFlags( SELECTED | BRIGHTENED );
144 } );
145
146 return newItem;
147}
148
149
151{
152 EDA_ITEM* parent = GetParent();
153
154 while( parent )
155 {
156 if( parent->Type() == SCHEMATIC_T )
157 return static_cast<SCHEMATIC*>( parent );
158 else
159 parent = parent->GetParent();
160 }
161
162 return nullptr;
163}
164
165
167{
168 const EDA_ITEM* parent = GetParent();
169
170 while( parent )
171 {
172 if( parent->Type() == SCH_SYMBOL_T )
173 return static_cast<const SCH_SYMBOL*>( parent );
174 else if( parent->Type() == LIB_SYMBOL_T )
175 return static_cast<const LIB_SYMBOL*>( parent );
176 else
177 parent = parent->GetParent();
178 }
179
180 return nullptr;
181}
182
183
185{
186 EDA_ITEM* parent = GetParent();
187
188 while( parent )
189 {
190 if( parent->Type() == SCH_SYMBOL_T )
191 return static_cast<SCH_SYMBOL*>( parent );
192 else if( parent->Type() == LIB_SYMBOL_T )
193 return static_cast<LIB_SYMBOL*>( parent );
194 else
195 parent = parent->GetParent();
196 }
197
198 return nullptr;
199}
200
201
202void SCH_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
203{
204 // Basic fallback
205 aCount = 3;
206 aLayers[0] = LAYER_DEVICE;
207 aLayers[1] = LAYER_DEVICE_BACKGROUND;
208 aLayers[2] = LAYER_SELECTION_SHADOWS;
209}
210
211
212bool SCH_ITEM::IsConnected( const VECTOR2I& aPosition ) const
213{
214 if(( m_flags & STRUCT_DELETED ) || ( m_flags & SKIP_STRUCT ) )
215 return false;
216
217 return doIsConnected( aPosition );
218}
219
220
222{
223 if( !IsConnectable() )
224 return nullptr;
225
226 if( !aSheet )
227 aSheet = &Schematic()->CurrentSheet();
228
229 auto it = m_connection_map.find( *aSheet );
230
231 if( it == m_connection_map.end() )
232 return nullptr;
233 else
234 return it->second;
235}
236
237
239{
240 for( auto& [path, conn] : m_connection_map )
241 {
242 conn->SetGraph( aGraph );
243
244 for( auto& member : conn->AllMembers() )
245 member->SetGraph( aGraph );
246 }
247}
248
249
250std::shared_ptr<NETCLASS> SCH_ITEM::GetEffectiveNetClass( const SCH_SHEET_PATH* aSheet ) const
251{
252 static std::shared_ptr<NETCLASS> nullNetclass = std::make_shared<NETCLASS>( wxEmptyString );
253
254 SCHEMATIC* schematic = Schematic();
255
256 if( schematic )
257 {
258 std::shared_ptr<NET_SETTINGS>& netSettings = schematic->Prj().GetProjectFile().m_NetSettings;
259 SCH_CONNECTION* connection = Connection( aSheet );
260
261 if( connection )
262 return netSettings->GetEffectiveNetClass( connection->Name() );
263 else
264 return netSettings->GetDefaultNetclass();
265 }
266
267 return nullNetclass;
268}
269
270
272{
273 auto it = m_connected_items.find( aSheet );
274
275 if( it != m_connected_items.end() )
276 it->second.clear();
277}
278
279
281{
282 return m_connected_items[ aSheet ];
283}
284
285
287{
288 SCH_ITEM_VEC& vec = m_connected_items[ aSheet ];
289
290 // The vector elements are small, so reserve 1k at a time to prevent re-allocations
291 if( vec.size() == vec.capacity() )
292 vec.reserve( vec.size() + 4096 );
293
294 // Add item to the correct place in the sorted vector if it is not already there
295 auto it = std::lower_bound( vec.begin(), vec.end(), aItem );
296
297 if( it == vec.end() || *it != aItem )
298 vec.insert( it, aItem );
299}
300
301
303 CONNECTION_GRAPH* aGraph )
304{
305 SCH_CONNECTION* connection = Connection( &aSheet );
306
307 // N.B. Do not clear the dirty connectivity flag here because we may need
308 // to create a connection for a different sheet, and we don't want to
309 // skip the connection creation because the flag is cleared.
310 if( connection )
311 {
312 connection->Reset();
313 }
314 else
315 {
316 connection = new SCH_CONNECTION( this );
317 m_connection_map.insert( std::make_pair( aSheet, connection ) );
318 }
319
320 connection->SetGraph( aGraph );
321 connection->SetSheet( aSheet );
322 return connection;
323}
324
325
327 CONNECTION_GRAPH* aGraph )
328{
329 if( !IsConnectable() )
330 return nullptr;
331
332 SCH_CONNECTION* connection = Connection( &aSheet );
333
334 if( connection )
335 return connection;
336 else
337 return InitializeConnection( aSheet, aGraph );
338}
339
340
341const wxString& SCH_ITEM::GetCachedDriverName() const
342{
343 static wxString s_empty;
344 return s_empty;
345}
346
347
349{
351}
352
353
355{
356 EDA_ITEM_FLAGS editFlags = GetEditFlags();
357 EDA_ITEM_FLAGS tempFlags = GetTempFlags();
358 EDA_ITEM_FLAGS aItem_editFlags = aItem->GetEditFlags();
359 EDA_ITEM_FLAGS aItem_tempFlags = aItem->GetTempFlags();
360
361 std::swap( m_flags, aItem->m_flags );
362
364 SetFlags( editFlags );
366 SetFlags( tempFlags );
367
368 aItem->ClearEditFlags();
369 aItem->SetFlags( aItem_editFlags );
370 aItem->ClearTempFlags();
371 aItem->SetFlags( aItem_tempFlags );
372}
373
374
376{
377 auto clearTextCaches =
378 []( SCH_ITEM* aItem )
379 {
380 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
381
382 if( text )
383 {
384 text->ClearBoundingBoxCache();
385 text->ClearRenderCache();
386 }
387 };
388
389 clearTextCaches( this );
390
391 RunOnChildren( clearTextCaches );
392}
393
394
395bool SCH_ITEM::operator==( const SCH_ITEM& aOther ) const
396{
397 if( Type() != aOther.Type() )
398 return false;
399
400 return compare( aOther, SCH_ITEM::COMPARE_FLAGS::EQUALITY ) == 0;
401}
402
403
404bool SCH_ITEM::operator<( const SCH_ITEM& aOther ) const
405{
406 if( Type() != aOther.Type() )
407 return Type() < aOther.Type();
408
409 return ( compare( aOther ) < 0 );
410}
411
412
413bool SCH_ITEM::cmp_items::operator()( const SCH_ITEM* aFirst, const SCH_ITEM* aSecond ) const
414{
415 return aFirst->compare( *aSecond, COMPARE_FLAGS::EQUALITY ) < 0;
416}
417
418
419int SCH_ITEM::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
420{
421 if( Type() != aOther.Type() )
422 return Type() - aOther.Type();
423
424 if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::UNIT ) && m_unit != aOther.m_unit )
425 return m_unit - aOther.m_unit;
426
427 if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::UNIT ) && m_bodyStyle != aOther.m_bodyStyle )
428 return m_bodyStyle - aOther.m_bodyStyle;
429
430 if( IsPrivate() != aOther.IsPrivate() )
431 return IsPrivate() ? 1 : -1;
432
433 if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::SKIP_TST_POS ) )
434 {
435 if( GetPosition().x != aOther.GetPosition().x )
436 return GetPosition().x - aOther.GetPosition().x;
437
438 if( GetPosition().y != aOther.GetPosition().y )
439 return GetPosition().y - aOther.GetPosition().y;
440 }
441
442 if( ( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::EQUALITY )
443 || ( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::ERC ) )
444 {
445 return 0;
446 }
447
448 if( m_Uuid < aOther.m_Uuid )
449 return -1;
450
451 if( m_Uuid > aOther.m_Uuid )
452 return 1;
453
454 return 0;
455}
456
457
458const wxString& SCH_ITEM::GetDefaultFont() const
459{
461
462 return cfg->m_Appearance.default_font;
463}
464
465
467{
468 if( SCHEMATIC* schematic = Schematic() )
469 return schematic->Settings().m_FontMetrics;
470
472}
473
474
476{
477 // For historical reasons, a stored value of 0 means "default width" and negative
478 // numbers meant "don't stroke".
479
480 if( GetPenWidth() < 0 )
481 return 0;
482 else if( GetPenWidth() == 0 )
483 return std::max( aSettings->GetDefaultPenWidth(), aSettings->GetMinPenWidth() );
484 else
485 return std::max( GetPenWidth(), aSettings->GetMinPenWidth() );
486}
487
488
489bool SCH_ITEM::RenderAsBitmap( double aWorldScale ) const
490{
491 if( IsHypertext() )
492 return false;
493
494 if( const EDA_TEXT* text = dynamic_cast<const EDA_TEXT*>( this ) )
495 return text->GetTextHeight() * aWorldScale < BITMAP_FONT_SIZE_THRESHOLD;
496
497 return false;
498}
499
500
502 std::vector<MSG_PANEL_ITEM>& aList )
503{
504 wxString msg;
505
506 aList.emplace_back( _( "Type" ), GetFriendlyName() );
507
508 if( const SYMBOL* parent = GetParentSymbol() )
509 {
510 if( parent->GetUnitCount() )
511 aList.emplace_back( _( "Unit" ), GetUnitDescription( m_unit ) );
512
513 if( parent->HasAlternateBodyStyle() )
514 aList.emplace_back( _( "Body Style" ), GetBodyStyleDescription( m_bodyStyle ) );
515 }
516
517 if( IsPrivate() )
518 aList.emplace_back( _( "Private" ), wxEmptyString );
519}
520
521
522static struct SCH_ITEM_DESC
523{
525 {
529
530#ifdef NOTYET
531 // Not yet functional in UI
532 propMgr.AddProperty( new PROPERTY<SCH_ITEM, bool>( _HKI( "Locked" ),
534#endif
535
536 auto multiUnit =
537 [=]( INSPECTABLE* aItem ) -> bool
538 {
539 if( SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( aItem ) )
540 {
541 if( const SYMBOL* symbol = schItem->GetParentSymbol() )
542 return symbol->IsMulti();
543 }
544
545 return false;
546 };
547
548 auto multiBodyStyle =
549 [=]( INSPECTABLE* aItem ) -> bool
550 {
551 if( SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( aItem ) )
552 {
553 if( const SYMBOL* symbol = schItem->GetParentSymbol() )
554 return symbol->HasAlternateBodyStyle();
555 }
556
557 return false;
558 };
559
560 propMgr.AddProperty( new PROPERTY<SCH_ITEM, int>( _HKI( "Unit" ),
562 .SetAvailableFunc( multiUnit )
564
565 propMgr.AddProperty( new PROPERTY<SCH_ITEM, int>( _HKI( "Body Style" ),
567 .SetAvailableFunc( multiBodyStyle )
569
570 propMgr.AddProperty( new PROPERTY<SCH_ITEM, bool>( _HKI( "Private" ),
573 }
575
577
578
579static bool lessYX( const DANGLING_END_ITEM& a, const DANGLING_END_ITEM& b )
580{
581 const auto aPos = a.GetPosition();
582 const auto bPos = b.GetPosition();
583 return aPos.y < bPos.y ? true : ( aPos.y > bPos.y ? false : aPos.x < bPos.x );
584};
585
586
587static bool lessType( const DANGLING_END_ITEM& a, const DANGLING_END_ITEM& b )
588{
589 return a.GetType() < b.GetType();
590};
591
592
593std::vector<DANGLING_END_ITEM>::iterator
594DANGLING_END_ITEM_HELPER::get_lower_pos( std::vector<DANGLING_END_ITEM>& aItemListByPos,
595 const VECTOR2I& aPos )
596{
597 DANGLING_END_ITEM needle = DANGLING_END_ITEM( PIN_END, nullptr, aPos );
598 auto start = aItemListByPos.begin();
599 auto end = aItemListByPos.end();
600 return std::lower_bound( start, end, needle, lessYX );
601}
602
603
604std::vector<DANGLING_END_ITEM>::iterator
605DANGLING_END_ITEM_HELPER::get_lower_type( std::vector<DANGLING_END_ITEM>& aItemListByType,
606 const DANGLING_END_T& aType )
607{
608 DANGLING_END_ITEM needle = DANGLING_END_ITEM( aType, nullptr, VECTOR2I{} );
609 auto start = aItemListByType.begin();
610 auto end = aItemListByType.end();
611 return std::lower_bound( start, end, needle, lessType );
612}
613
614
616 std::vector<DANGLING_END_ITEM>& aItemListByType,
617 std::vector<DANGLING_END_ITEM>& aItemListByPos )
618{
619 // WIRE_END pairs must be kept together. Hence stable sort.
620 std::stable_sort( aItemListByType.begin(), aItemListByType.end(), lessType );
621 // Sort by y first, pins are more likely to share x than y.
622 std::sort( aItemListByPos.begin(), aItemListByPos.end(), lessYX );
623}
Calculate the connectivity of a schematic and generates netlists.
void RemoveItem(SCH_ITEM *aItem)
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:605
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Definition: sch_item.cpp:594
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:615
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:95
DANGLING_END_T GetType() const
Definition: sch_item.h:131
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:89
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:243
virtual void ClearEditFlags()
Definition: eda_item.h:141
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:133
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:127
const KIID m_Uuid
Definition: eda_item.h:489
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:129
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:499
EDA_ITEM_FLAGS GetTempFlags() const
Definition: eda_item.h:146
virtual wxString GetFriendlyName() const
Definition: eda_item.cpp:332
EDA_ITEM * GetParent() const
Definition: eda_item.h:103
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:85
virtual void ClearTempFlags()
Definition: eda_item.h:153
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:79
Class that other classes need to inherit from, in order to be inspectable.
Definition: inspectable.h:36
static const METRICS & Default()
Definition: font.cpp:52
int GetDefaultPenWidth() const
Definition: kiid.h:49
Define a library symbol object.
Definition: lib_symbol.h:78
static wxString LetterSubReference(int aUnit, int aFirstId)
Definition: lib_symbol.cpp:447
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
std::shared_ptr< NET_SETTINGS > m_NetSettings
Net settings for this project (owned here)
Definition: project_file.h:178
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:200
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
Definition: property.h:257
PROPERTY_BASE & SetIsHiddenFromDesignEditors(bool aIsHidden=true)
Definition: property.h:321
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:85
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:87
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
Holds all the data relating to one schematic.
Definition: schematic.h:77
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:152
CONNECTION_GRAPH * ConnectionGraph() const override
Definition: schematic.h:162
static bool m_IsSchematicExists
True if a SCHEMATIC exists, false if not.
Definition: schematic.h:338
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:92
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
void Reset()
Clears connectivity information.
wxString Name(bool aIgnoreSheet=false) const
void SetGraph(CONNECTION_GRAPH *aGraph)
void SetSheet(SCH_SHEET_PATH aSheet)
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:166
virtual void SetBodyStyle(int aBodyStyle)
Definition: sch_item.h:231
virtual bool IsConnectable() const
Definition: sch_item.h:449
int m_unit
Definition: sch_item.h:724
virtual bool IsLocked() const
Definition: sch_item.h:268
virtual int GetPenWidth() const
Definition: sch_item.h:292
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:280
SCH_ITEM & operator=(const SCH_ITEM &aPin)
Definition: sch_item.cpp:101
void ClearConnectedItems(const SCH_SHEET_PATH &aPath)
Clear all connections to this item.
Definition: sch_item.cpp:271
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_item.h:720
int m_bodyStyle
Definition: sch_item.h:725
const wxString & GetDefaultFont() const
Definition: sch_item.cpp:458
virtual ~SCH_ITEM()
Definition: sch_item.cpp:114
const SYMBOL * GetParentSymbol() const
Definition: sch_item.cpp:166
void SetPrivate(bool aPrivate)
Definition: sch_item.h:234
virtual const wxString & GetCachedDriverName() const
Definition: sch_item.cpp:341
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:150
int GetBodyStyle() const
Definition: sch_item.h:232
static wxString GetUnitDescription(int aUnit)
Definition: sch_item.cpp:52
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
Definition: sch_item.cpp:302
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
Definition: sch_item.cpp:286
virtual void SetLocked(bool aLocked)
Definition: sch_item.h:269
@ SKIP_TST_POS
Definition: sch_item.h:662
@ EQUALITY
Definition: sch_item.h:660
int GetUnit() const
Definition: sch_item.h:229
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition: sch_item.cpp:250
virtual bool operator==(const SCH_ITEM &aOther) const
Definition: sch_item.cpp:395
bool m_connectivity_dirty
Definition: sch_item.h:737
bool IsPrivate() const
Definition: sch_item.h:235
virtual void ClearCaches()
Definition: sch_item.cpp:375
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
Definition: sch_item.h:568
virtual void SwapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
Definition: sch_item.cpp:348
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:419
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:727
bool RenderAsBitmap(double aWorldScale) const override
Definition: sch_item.cpp:489
static wxString GetBodyStyleDescription(int aBodyStyle)
Definition: sch_item.cpp:61
void SetConnectionGraph(CONNECTION_GRAPH *aGraph)
Updates the connection graph for all connections in this item.
Definition: sch_item.cpp:238
virtual void SetUnit(int aUnit)
Definition: sch_item.h:228
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition: sch_item.cpp:354
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
Definition: sch_item.cpp:212
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_item.cpp:202
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition: sch_item.cpp:77
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
Definition: sch_item.h:735
virtual bool operator<(const SCH_ITEM &aItem) const
Definition: sch_item.cpp:404
bool m_private
Definition: sch_item.h:726
virtual bool IsHypertext() const
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_item.h:274
SCH_CONNECTION * GetOrInitConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Definition: sch_item.cpp:326
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:221
wxString GetClass() const override
Return the class name.
Definition: sch_item.h:176
const KIFONT::METRICS & GetFontMetrics() const
Definition: sch_item.cpp:466
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:732
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
Definition: sch_item.cpp:475
SCH_LAYER_ID m_layer
Definition: sch_item.h:723
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:131
void getSymbolEditorMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Definition: sch_item.cpp:501
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Schematic symbol object.
Definition: sch_symbol.h:104
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
A base class for LIB_SYMBOL and SCH_SYMBOL.
Definition: symbol.h:34
#define _HKI(x)
#define _(s)
#define BRIGHTENED
item is drawn with a bright contour
#define SELECTED
Item was manually selected by the user.
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
std::uint32_t EDA_ITEM_FLAGS
SCH_LAYER_ID
Eeschema drawing layers.
Definition: layer_ids.h:353
@ LAYER_DEVICE
Definition: layer_ids.h:370
@ LAYER_WIRE
Definition: layer_ids.h:356
@ LAYER_DEVICE_BACKGROUND
Definition: layer_ids.h:387
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:397
#define UNIMPLEMENTED_FOR(type)
Definition: macros.h:96
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE
#define TYPE_HASH(x)
Definition: property.h:71
#define IMPLEMENT_ENUM_TO_WXANY(type)
Definition: property.h:763
#define REGISTER_TYPE(x)
Definition: property_mgr.h:371
static bool lessYX(const DANGLING_END_ITEM &a, const DANGLING_END_ITEM &b)
Definition: sch_item.cpp:579
#define BITMAP_FONT_SIZE_THRESHOLD
Definition: sch_item.cpp:49
static bool lessType(const DANGLING_END_ITEM &a, const DANGLING_END_ITEM &b)
Definition: sch_item.cpp:587
static struct SCH_ITEM_DESC _SCH_ITEM_DESC
DANGLING_END_T
Definition: sch_item.h:76
@ PIN_END
Definition: sch_item.h:81
std::vector< SCH_ITEM * > SCH_ITEM_VEC
Definition: sch_item.h:155
@ FIELDS_AUTOPLACED_NO
Definition: sch_item.h:69
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:413
wxLogTrace helper definitions.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ LIB_SYMBOL_T
Definition: typeinfo.h:148
@ SCH_SYMBOL_T
Definition: typeinfo.h:172
@ SCHEMATIC_T
Definition: typeinfo.h:203