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 ),
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 SCHEMATIC* sch = Schematic();
120
121 if( sch != nullptr )
122 sch->ConnectionGraph()->RemoveItem( this );
123}
124
125
126SCH_ITEM* SCH_ITEM::Duplicate( bool doClone ) const
127{
128 SCH_ITEM* newItem = (SCH_ITEM*) Clone();
129
130 if( !doClone )
131 const_cast<KIID&>( newItem->m_Uuid ) = KIID();
132
133 newItem->ClearFlags( SELECTED | BRIGHTENED );
134
135 newItem->RunOnChildren(
136 []( SCH_ITEM* aChild )
137 {
138 aChild->ClearFlags( SELECTED | BRIGHTENED );
139 } );
140
141 return newItem;
142}
143
144
146{
147 EDA_ITEM* parent = GetParent();
148
149 while( parent )
150 {
151 if( parent->Type() == SCHEMATIC_T )
152 return static_cast<SCHEMATIC*>( parent );
153 else
154 parent = parent->GetParent();
155 }
156
157 return nullptr;
158}
159
160
162{
163 const EDA_ITEM* parent = GetParent();
164
165 while( parent )
166 {
167 if( parent->Type() == SCH_SYMBOL_T )
168 return static_cast<const SCH_SYMBOL*>( parent );
169 else if( parent->Type() == LIB_SYMBOL_T )
170 return static_cast<const LIB_SYMBOL*>( parent );
171 else
172 parent = parent->GetParent();
173 }
174
175 return nullptr;
176}
177
178
180{
181 EDA_ITEM* parent = GetParent();
182
183 while( parent )
184 {
185 if( parent->Type() == SCH_SYMBOL_T )
186 return static_cast<SCH_SYMBOL*>( parent );
187 else if( parent->Type() == LIB_SYMBOL_T )
188 return static_cast<LIB_SYMBOL*>( parent );
189 else
190 parent = parent->GetParent();
191 }
192
193 return nullptr;
194}
195
196
197void SCH_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
198{
199 // Basic fallback
200 aCount = 3;
201 aLayers[0] = LAYER_DEVICE;
202 aLayers[1] = LAYER_DEVICE_BACKGROUND;
203 aLayers[2] = LAYER_SELECTION_SHADOWS;
204}
205
206
207bool SCH_ITEM::IsConnected( const VECTOR2I& aPosition ) const
208{
209 if(( m_flags & STRUCT_DELETED ) || ( m_flags & SKIP_STRUCT ) )
210 return false;
211
212 return doIsConnected( aPosition );
213}
214
215
217{
218 if( !IsConnectable() )
219 return nullptr;
220
221 if( !aSheet )
222 aSheet = &Schematic()->CurrentSheet();
223
224 auto it = m_connection_map.find( *aSheet );
225
226 if( it == m_connection_map.end() )
227 return nullptr;
228 else
229 return it->second;
230}
231
232
234{
235 for( auto& [path, conn] : m_connection_map )
236 {
237 conn->SetGraph( aGraph );
238
239 for( auto& member : conn->AllMembers() )
240 member->SetGraph( aGraph );
241 }
242}
243
244
245std::shared_ptr<NETCLASS> SCH_ITEM::GetEffectiveNetClass( const SCH_SHEET_PATH* aSheet ) const
246{
247 static std::shared_ptr<NETCLASS> nullNetclass = std::make_shared<NETCLASS>( wxEmptyString );
248
249 SCHEMATIC* schematic = Schematic();
250
251 if( schematic )
252 {
253 std::shared_ptr<NET_SETTINGS>& netSettings = schematic->Prj().GetProjectFile().m_NetSettings;
254 SCH_CONNECTION* connection = Connection( aSheet );
255
256 if( connection )
257 return netSettings->GetEffectiveNetClass( connection->Name() );
258 else
259 return netSettings->m_DefaultNetClass;
260 }
261
262 return nullNetclass;
263}
264
265
267{
268 auto it = m_connected_items.find( aSheet );
269
270 if( it != m_connected_items.end() )
271 it->second.clear();
272}
273
274
276{
277 return m_connected_items[ aSheet ];
278}
279
280
282{
283 SCH_ITEM_VEC& vec = m_connected_items[ aSheet ];
284
285 // The vector elements are small, so reserve 1k at a time to prevent re-allocations
286 if( vec.size() == vec.capacity() )
287 vec.reserve( vec.size() + 4096 );
288
289 // Add item to the correct place in the sorted vector if it is not already there
290 auto it = std::lower_bound( vec.begin(), vec.end(), aItem );
291
292 if( it == vec.end() || *it != aItem )
293 vec.insert( it, aItem );
294}
295
296
298 CONNECTION_GRAPH* aGraph )
299{
300 SCH_CONNECTION* connection = Connection( &aSheet );
301
302 // N.B. Do not clear the dirty connectivity flag here because we may need
303 // to create a connection for a different sheet, and we don't want to
304 // skip the connection creation because the flag is cleared.
305 if( connection )
306 {
307 connection->Reset();
308 }
309 else
310 {
311 connection = new SCH_CONNECTION( this );
312 m_connection_map.insert( std::make_pair( aSheet, connection ) );
313 }
314
315 connection->SetGraph( aGraph );
316 connection->SetSheet( aSheet );
317 return connection;
318}
319
320
322 CONNECTION_GRAPH* aGraph )
323{
324 if( !IsConnectable() )
325 return nullptr;
326
327 SCH_CONNECTION* connection = Connection( &aSheet );
328
329 if( connection )
330 return connection;
331 else
332 return InitializeConnection( aSheet, aGraph );
333}
334
335
336const wxString& SCH_ITEM::GetCachedDriverName() const
337{
338 static wxString s_empty;
339 return s_empty;
340}
341
342
344{
346}
347
348
350{
351 EDA_ITEM_FLAGS editFlags = GetEditFlags();
352 EDA_ITEM_FLAGS tempFlags = GetTempFlags();
353 EDA_ITEM_FLAGS aItem_editFlags = aItem->GetEditFlags();
354 EDA_ITEM_FLAGS aItem_tempFlags = aItem->GetTempFlags();
355
356 std::swap( m_flags, aItem->m_flags );
357
359 SetFlags( editFlags );
361 SetFlags( tempFlags );
362
363 aItem->ClearEditFlags();
364 aItem->SetFlags( aItem_editFlags );
365 aItem->ClearTempFlags();
366 aItem->SetFlags( aItem_tempFlags );
367}
368
369
371{
372 auto clearTextCaches =
373 []( SCH_ITEM* aItem )
374 {
375 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
376
377 if( text )
378 {
379 text->ClearBoundingBoxCache();
380 text->ClearRenderCache();
381 }
382 };
383
384 clearTextCaches( this );
385
386 RunOnChildren( clearTextCaches );
387}
388
389
390bool SCH_ITEM::operator==( const SCH_ITEM& aOther ) const
391{
392 if( Type() != aOther.Type() )
393 return false;
394
395 return compare( aOther, SCH_ITEM::COMPARE_FLAGS::EQUALITY ) == 0;
396}
397
398
399bool SCH_ITEM::operator<( const SCH_ITEM& aOther ) const
400{
401 if( Type() != aOther.Type() )
402 return Type() < aOther.Type();
403
404 return ( compare( aOther ) < 0 );
405}
406
407
408bool SCH_ITEM::cmp_items::operator()( const SCH_ITEM* aFirst, const SCH_ITEM* aSecond ) const
409{
410 return aFirst->compare( *aSecond, COMPARE_FLAGS::EQUALITY ) < 0;
411}
412
413
414int SCH_ITEM::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
415{
416 if( Type() != aOther.Type() )
417 return Type() - aOther.Type();
418
419 if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::UNIT ) && m_unit != aOther.m_unit )
420 return m_unit - aOther.m_unit;
421
422 if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::UNIT ) && m_bodyStyle != aOther.m_bodyStyle )
423 return m_bodyStyle - aOther.m_bodyStyle;
424
425 if( IsPrivate() != aOther.IsPrivate() )
426 return IsPrivate() ? 1 : -1;
427
428 if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::SKIP_TST_POS ) )
429 {
430 if( GetPosition().x != aOther.GetPosition().x )
431 return GetPosition().x - aOther.GetPosition().x;
432
433 if( GetPosition().y != aOther.GetPosition().y )
434 return GetPosition().y - aOther.GetPosition().y;
435 }
436
437 if( ( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::EQUALITY )
438 || ( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::ERC ) )
439 {
440 return 0;
441 }
442
443 if( m_Uuid < aOther.m_Uuid )
444 return -1;
445
446 if( m_Uuid > aOther.m_Uuid )
447 return 1;
448
449 return 0;
450}
451
452
453const wxString& SCH_ITEM::GetDefaultFont() const
454{
456
457 return cfg->m_Appearance.default_font;
458}
459
460
462{
463 if( SCHEMATIC* schematic = Schematic() )
464 return schematic->Settings().m_FontMetrics;
465
467}
468
469
471{
472 // For historical reasons, a stored value of 0 means "default width" and negative
473 // numbers meant "don't stroke".
474
475 if( GetPenWidth() < 0 )
476 return 0;
477 else if( GetPenWidth() == 0 )
478 return std::max( aSettings->GetDefaultPenWidth(), aSettings->GetMinPenWidth() );
479 else
480 return std::max( GetPenWidth(), aSettings->GetMinPenWidth() );
481}
482
483
484bool SCH_ITEM::RenderAsBitmap( double aWorldScale ) const
485{
486 if( IsHypertext() )
487 return false;
488
489 if( const EDA_TEXT* text = dynamic_cast<const EDA_TEXT*>( this ) )
490 return text->GetTextHeight() * aWorldScale < BITMAP_FONT_SIZE_THRESHOLD;
491
492 return false;
493}
494
495
497 std::vector<MSG_PANEL_ITEM>& aList )
498{
499 wxString msg;
500
501 aList.emplace_back( _( "Type" ), GetFriendlyName() );
502
503 if( const SYMBOL* parent = GetParentSymbol() )
504 {
505 if( parent->GetUnitCount() )
506 aList.emplace_back( _( "Unit" ), GetUnitDescription( m_unit ) );
507
508 if( parent->HasAlternateBodyStyle() )
509 aList.emplace_back( _( "Body Style" ), GetBodyStyleDescription( m_bodyStyle ) );
510 }
511
512 if( IsPrivate() )
513 aList.emplace_back( _( "Private" ), wxEmptyString );
514}
515
516
517static struct SCH_ITEM_DESC
518{
520 {
524
525#ifdef NOTYET
526 // Not yet functional in UI
527 propMgr.AddProperty( new PROPERTY<SCH_ITEM, bool>( _HKI( "Locked" ),
529#endif
530
531 auto multiUnit =
532 [=]( INSPECTABLE* aItem ) -> bool
533 {
534 if( SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( aItem ) )
535 {
536 if( const SYMBOL* symbol = schItem->GetParentSymbol() )
537 return symbol->IsMulti();
538 }
539
540 return false;
541 };
542
543 auto multiBodyStyle =
544 [=]( INSPECTABLE* aItem ) -> bool
545 {
546 if( SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( aItem ) )
547 {
548 if( const SYMBOL* symbol = schItem->GetParentSymbol() )
549 return symbol->HasAlternateBodyStyle();
550 }
551
552 return false;
553 };
554
555 propMgr.AddProperty( new PROPERTY<SCH_ITEM, int>( _HKI( "Unit" ),
557 .SetAvailableFunc( multiUnit )
559
560 propMgr.AddProperty( new PROPERTY<SCH_ITEM, int>( _HKI( "Body Style" ),
562 .SetAvailableFunc( multiBodyStyle )
564
565 propMgr.AddProperty( new PROPERTY<SCH_ITEM, bool>( _HKI( "Private" ),
568 }
570
572
573
574static bool lessYX( const DANGLING_END_ITEM& a, const DANGLING_END_ITEM& b )
575{
576 const auto aPos = a.GetPosition();
577 const auto bPos = b.GetPosition();
578 return aPos.y < bPos.y ? true : ( aPos.y > bPos.y ? false : aPos.x < bPos.x );
579};
580
581
582static bool lessType( const DANGLING_END_ITEM& a, const DANGLING_END_ITEM& b )
583{
584 return a.GetType() < b.GetType();
585};
586
587
588std::vector<DANGLING_END_ITEM>::iterator
589DANGLING_END_ITEM_HELPER::get_lower_pos( std::vector<DANGLING_END_ITEM>& aItemListByPos,
590 const VECTOR2I& aPos )
591{
592 DANGLING_END_ITEM needle = DANGLING_END_ITEM( PIN_END, nullptr, aPos );
593 auto start = aItemListByPos.begin();
594 auto end = aItemListByPos.end();
595 return std::lower_bound( start, end, needle, lessYX );
596}
597
598
599std::vector<DANGLING_END_ITEM>::iterator
600DANGLING_END_ITEM_HELPER::get_lower_type( std::vector<DANGLING_END_ITEM>& aItemListByType,
601 const DANGLING_END_T& aType )
602{
603 DANGLING_END_ITEM needle = DANGLING_END_ITEM( aType, nullptr, VECTOR2I{} );
604 auto start = aItemListByType.begin();
605 auto end = aItemListByType.end();
606 return std::lower_bound( start, end, needle, lessType );
607}
608
609
611 std::vector<DANGLING_END_ITEM>& aItemListByType,
612 std::vector<DANGLING_END_ITEM>& aItemListByPos )
613{
614 // WIRE_END pairs must be kept together. Hence stable sort.
615 std::stable_sort( aItemListByType.begin(), aItemListByType.end(), lessType );
616 // Sort by y first, pins are more likely to share x than y.
617 std::sort( aItemListByPos.begin(), aItemListByPos.end(), lessYX );
618}
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:600
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Definition: sch_item.cpp:589
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:610
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:139
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:88
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:242
virtual void ClearEditFlags()
Definition: eda_item.h:140
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:132
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:126
const KIID m_Uuid
Definition: eda_item.h:485
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:128
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:490
EDA_ITEM_FLAGS GetTempFlags() const
Definition: eda_item.h:145
virtual wxString GetFriendlyName() const
Definition: eda_item.cpp:329
EDA_ITEM * GetParent() const
Definition: eda_item.h:102
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:82
virtual void ClearTempFlags()
Definition: eda_item.h:152
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:83
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:77
static wxString LetterSubReference(int aUnit, int aFirstId)
Definition: lib_symbol.cpp:721
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:173
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:166
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:75
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:136
CONNECTION_GRAPH * ConnectionGraph() const override
Definition: schematic.h:146
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:90
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:174
virtual void SetBodyStyle(int aBodyStyle)
Definition: sch_item.h:239
virtual bool IsConnectable() const
Definition: sch_item.h:457
int m_unit
Definition: sch_item.h:732
virtual bool IsLocked() const
Definition: sch_item.h:276
virtual int GetPenWidth() const
Definition: sch_item.h:300
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:275
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:266
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_item.h:728
int m_bodyStyle
Definition: sch_item.h:733
const wxString & GetDefaultFont() const
Definition: sch_item.cpp:453
virtual ~SCH_ITEM()
Definition: sch_item.cpp:114
const SYMBOL * GetParentSymbol() const
Definition: sch_item.cpp:161
void SetPrivate(bool aPrivate)
Definition: sch_item.h:242
virtual const wxString & GetCachedDriverName() const
Definition: sch_item.cpp:336
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:145
int GetBodyStyle() const
Definition: sch_item.h:240
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:297
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
Definition: sch_item.cpp:281
virtual void SetLocked(bool aLocked)
Definition: sch_item.h:277
@ SKIP_TST_POS
Definition: sch_item.h:670
@ EQUALITY
Definition: sch_item.h:668
int GetUnit() const
Definition: sch_item.h:237
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition: sch_item.cpp:245
virtual bool operator==(const SCH_ITEM &aOther) const
Definition: sch_item.cpp:390
bool m_connectivity_dirty
Definition: sch_item.h:745
bool IsPrivate() const
Definition: sch_item.h:243
virtual void ClearCaches()
Definition: sch_item.cpp:370
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
Definition: sch_item.h:576
virtual void SwapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
Definition: sch_item.cpp:343
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:414
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:735
bool RenderAsBitmap(double aWorldScale) const override
Definition: sch_item.cpp:484
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:233
virtual void SetUnit(int aUnit)
Definition: sch_item.h:236
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition: sch_item.cpp:349
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
Definition: sch_item.cpp:207
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:197
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:743
virtual bool operator<(const SCH_ITEM &aItem) const
Definition: sch_item.cpp:399
bool m_private
Definition: sch_item.h:734
virtual bool IsHypertext() const
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_item.h:282
SCH_CONNECTION * GetOrInitConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Definition: sch_item.cpp:321
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:216
wxString GetClass() const override
Return the class name.
Definition: sch_item.h:184
const KIFONT::METRICS & GetFontMetrics() const
Definition: sch_item.cpp:461
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:740
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
Definition: sch_item.cpp:470
SCH_LAYER_ID m_layer
Definition: sch_item.h:731
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:126
void getSymbolEditorMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Definition: sch_item.cpp:496
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:105
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:386
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:395
#define UNIMPLEMENTED_FOR(type)
Definition: macros.h:96
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
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:574
#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:582
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:163
@ 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:408
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