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 <trace_helpers.h>
38#include <general.h>
39#include <netclass.h>
42
43
44// Rendering fonts is expensive (particularly when using outline fonts). At small effective
45// sizes (ie: zoomed out) the visual differences between outline and/or stroke fonts and the
46// bitmap font becomes immaterial, and there's often more to draw when zoomed out so the
47// performance gain becomes more significant.
48#define BITMAP_FONT_SIZE_THRESHOLD 3
49
50
51wxString SCH_ITEM::GetUnitDescription( int aUnit )
52{
53 if( aUnit == 0 )
54 return _( "All" );
55 else
56 return LIB_SYMBOL::LetterSubReference( aUnit, 'A' );
57}
58
59
60wxString SCH_ITEM::GetBodyStyleDescription( int aBodyStyle )
61{
62 if( aBodyStyle == 0 )
63 return _( "All" );
64 else if( aBodyStyle == BODY_STYLE::DEMORGAN )
65 return _( "Alternate" );
66 else if( aBodyStyle == BODY_STYLE::BASE )
67 return _( "Standard" );
68 else
69 return wxT( "?" );
70}
71
72
73/* Constructor and destructor for SCH_ITEM */
74/* They are not inline because this creates problems with gcc at linking time in debug mode */
75
76SCH_ITEM::SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType, int aUnit, int aBodyStyle ) :
77 EDA_ITEM( aParent, aType ),
78 m_unit( aUnit ),
79 m_bodyStyle( aBodyStyle ),
80 m_private( false )
81{
82 m_layer = LAYER_WIRE; // It's only a default, in fact
84 m_connectivity_dirty = false; // Item is unconnected until it is placed, so it's clean
85}
86
87
89 EDA_ITEM( aItem )
90{
91 m_layer = aItem.m_layer;
92 m_unit = aItem.m_unit;
94 m_private = aItem.m_private;
97}
98
99
101{
102 m_layer = aItem.m_layer;
103 m_unit = aItem.m_unit;
104 m_bodyStyle = aItem.m_bodyStyle;
105 m_private = aItem.m_private;
108
109 return *this;
110}
111
112
114{
115 for( const auto& it : m_connection_map )
116 delete it.second;
117}
118
119
120SCH_ITEM* SCH_ITEM::Duplicate( bool doClone ) const
121{
122 SCH_ITEM* newItem = (SCH_ITEM*) Clone();
123
124 if( !doClone )
125 const_cast<KIID&>( newItem->m_Uuid ) = KIID();
126
127 newItem->ClearFlags( SELECTED | BRIGHTENED );
128
129 newItem->RunOnChildren(
130 []( SCH_ITEM* aChild )
131 {
132 aChild->ClearFlags( SELECTED | BRIGHTENED );
133 } );
134
135 return newItem;
136}
137
138
140{
141 EDA_ITEM* parent = GetParent();
142
143 while( parent )
144 {
145 if( parent->Type() == SCHEMATIC_T )
146 return static_cast<SCHEMATIC*>( parent );
147 else
148 parent = parent->GetParent();
149 }
150
151 return nullptr;
152}
153
154
156{
157 const EDA_ITEM* parent = GetParent();
158
159 while( parent )
160 {
161 if( parent->Type() == SCH_SYMBOL_T )
162 return static_cast<const SCH_SYMBOL*>( parent );
163 else if( parent->Type() == LIB_SYMBOL_T )
164 return static_cast<const LIB_SYMBOL*>( parent );
165 else
166 parent = parent->GetParent();
167 }
168
169 return nullptr;
170}
171
172
174{
175 EDA_ITEM* parent = GetParent();
176
177 while( parent )
178 {
179 if( parent->Type() == SCH_SYMBOL_T )
180 return static_cast<SCH_SYMBOL*>( parent );
181 else if( parent->Type() == LIB_SYMBOL_T )
182 return static_cast<LIB_SYMBOL*>( parent );
183 else
184 parent = parent->GetParent();
185 }
186
187 return nullptr;
188}
189
190
191void SCH_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
192{
193 // Basic fallback
194 aCount = 3;
195 aLayers[0] = LAYER_DEVICE;
196 aLayers[1] = LAYER_DEVICE_BACKGROUND;
197 aLayers[2] = LAYER_SELECTION_SHADOWS;
198}
199
200
201bool SCH_ITEM::IsConnected( const VECTOR2I& aPosition ) const
202{
203 if(( m_flags & STRUCT_DELETED ) || ( m_flags & SKIP_STRUCT ) )
204 return false;
205
206 return doIsConnected( aPosition );
207}
208
209
211{
212 if( !IsConnectable() )
213 return nullptr;
214
215 if( !aSheet )
216 aSheet = &Schematic()->CurrentSheet();
217
218 auto it = m_connection_map.find( *aSheet );
219
220 if( it == m_connection_map.end() )
221 return nullptr;
222 else
223 return it->second;
224}
225
226
228{
229 for( auto& [path, conn] : m_connection_map )
230 {
231 conn->SetGraph( aGraph );
232
233 for( auto& member : conn->AllMembers() )
234 member->SetGraph( aGraph );
235 }
236}
237
238
239std::shared_ptr<NETCLASS> SCH_ITEM::GetEffectiveNetClass( const SCH_SHEET_PATH* aSheet ) const
240{
241 static std::shared_ptr<NETCLASS> nullNetclass = std::make_shared<NETCLASS>( wxEmptyString );
242
243 SCHEMATIC* schematic = Schematic();
244
245 if( schematic )
246 {
247 std::shared_ptr<NET_SETTINGS>& netSettings = schematic->Prj().GetProjectFile().m_NetSettings;
248 SCH_CONNECTION* connection = Connection( aSheet );
249
250 if( connection )
251 return netSettings->GetEffectiveNetClass( connection->Name() );
252 else
253 return netSettings->m_DefaultNetClass;
254 }
255
256 return nullNetclass;
257}
258
259
261{
262 auto it = m_connected_items.find( aSheet );
263
264 if( it != m_connected_items.end() )
265 it->second.clear();
266}
267
268
270{
271 return m_connected_items[ aSheet ];
272}
273
274
276{
277 SCH_ITEM_VEC& vec = m_connected_items[ aSheet ];
278
279 // The vector elements are small, so reserve 1k at a time to prevent re-allocations
280 if( vec.size() == vec.capacity() )
281 vec.reserve( vec.size() + 4096 );
282
283 // Add item to the correct place in the sorted vector if it is not already there
284 auto it = std::lower_bound( vec.begin(), vec.end(), aItem );
285
286 if( it == vec.end() || *it != aItem )
287 vec.insert( it, aItem );
288}
289
290
292 CONNECTION_GRAPH* aGraph )
293{
294 SCH_CONNECTION* connection = Connection( &aSheet );
295
296 // N.B. Do not clear the dirty connectivity flag here because we may need
297 // to create a connection for a different sheet, and we don't want to
298 // skip the connection creation because the flag is cleared.
299 if( connection )
300 {
301 connection->Reset();
302 }
303 else
304 {
305 connection = new SCH_CONNECTION( this );
306 m_connection_map.insert( std::make_pair( aSheet, connection ) );
307 }
308
309 connection->SetGraph( aGraph );
310 connection->SetSheet( aSheet );
311 return connection;
312}
313
314
316 CONNECTION_GRAPH* aGraph )
317{
318 if( !IsConnectable() )
319 return nullptr;
320
321 SCH_CONNECTION* connection = Connection( &aSheet );
322
323 if( connection )
324 return connection;
325 else
326 return InitializeConnection( aSheet, aGraph );
327}
328
329
330const wxString& SCH_ITEM::GetCachedDriverName() const
331{
332 static wxString s_empty;
333 return s_empty;
334}
335
336
338{
340}
341
342
344{
345 EDA_ITEM_FLAGS editFlags = GetEditFlags();
346 EDA_ITEM_FLAGS tempFlags = GetTempFlags();
347 EDA_ITEM_FLAGS aItem_editFlags = aItem->GetEditFlags();
348 EDA_ITEM_FLAGS aItem_tempFlags = aItem->GetTempFlags();
349
350 std::swap( m_flags, aItem->m_flags );
351
353 SetFlags( editFlags );
355 SetFlags( tempFlags );
356
357 aItem->ClearEditFlags();
358 aItem->SetFlags( aItem_editFlags );
359 aItem->ClearTempFlags();
360 aItem->SetFlags( aItem_tempFlags );
361}
362
363
365{
366 auto clearTextCaches =
367 []( SCH_ITEM* aItem )
368 {
369 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
370
371 if( text )
372 {
373 text->ClearBoundingBoxCache();
374 text->ClearRenderCache();
375 }
376 };
377
378 clearTextCaches( this );
379
380 RunOnChildren( clearTextCaches );
381}
382
383
384bool SCH_ITEM::operator==( const SCH_ITEM& aOther ) const
385{
386 if( Type() != aOther.Type() )
387 return false;
388
389 return compare( aOther, SCH_ITEM::COMPARE_FLAGS::EQUALITY ) == 0;
390}
391
392
393bool SCH_ITEM::operator<( const SCH_ITEM& aOther ) const
394{
395 if( Type() != aOther.Type() )
396 return Type() < aOther.Type();
397
398 return ( compare( aOther ) < 0 );
399}
400
401
402bool SCH_ITEM::cmp_items::operator()( const SCH_ITEM* aFirst, const SCH_ITEM* aSecond ) const
403{
404 return aFirst->compare( *aSecond, COMPARE_FLAGS::EQUALITY ) < 0;
405}
406
407
408int SCH_ITEM::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
409{
410 if( Type() != aOther.Type() )
411 return Type() - aOther.Type();
412
413 if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::UNIT ) && m_unit != aOther.m_unit )
414 return m_unit - aOther.m_unit;
415
416 if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::UNIT ) && m_bodyStyle != aOther.m_bodyStyle )
417 return m_bodyStyle - aOther.m_bodyStyle;
418
419 if( IsPrivate() != aOther.IsPrivate() )
420 return IsPrivate() ? 1 : -1;
421
422 if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::SKIP_TST_POS ) )
423 {
424 if( GetPosition().x != aOther.GetPosition().x )
425 return GetPosition().x - aOther.GetPosition().x;
426
427 if( GetPosition().y != aOther.GetPosition().y )
428 return GetPosition().y - aOther.GetPosition().y;
429 }
430
431 if( ( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::EQUALITY )
432 || ( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::ERC ) )
433 {
434 return 0;
435 }
436
437 if( m_Uuid < aOther.m_Uuid )
438 return -1;
439
440 if( m_Uuid > aOther.m_Uuid )
441 return 1;
442
443 return 0;
444}
445
446
447const wxString& SCH_ITEM::GetDefaultFont() const
448{
450
451 return cfg->m_Appearance.default_font;
452}
453
454
456{
457 if( SCHEMATIC* schematic = Schematic() )
458 return schematic->Settings().m_FontMetrics;
459
461}
462
463
465{
466 // For historical reasons, a stored value of 0 means "default width" and negative
467 // numbers meant "don't stroke".
468
469 if( GetPenWidth() < 0 )
470 return 0;
471 else if( GetPenWidth() == 0 )
472 return std::max( aSettings->GetDefaultPenWidth(), aSettings->GetMinPenWidth() );
473 else
474 return std::max( GetPenWidth(), aSettings->GetMinPenWidth() );
475}
476
477
478bool SCH_ITEM::RenderAsBitmap( double aWorldScale ) const
479{
480 if( IsHypertext() )
481 return false;
482
483 if( const EDA_TEXT* text = dynamic_cast<const EDA_TEXT*>( this ) )
484 return text->GetTextHeight() * aWorldScale < BITMAP_FONT_SIZE_THRESHOLD;
485
486 return false;
487}
488
489
491 std::vector<MSG_PANEL_ITEM>& aList )
492{
493 wxString msg;
494
495 aList.emplace_back( _( "Type" ), GetFriendlyName() );
496
497 if( const SYMBOL* parent = GetParentSymbol() )
498 {
499 if( parent->GetUnitCount() )
500 aList.emplace_back( _( "Unit" ), GetUnitDescription( m_unit ) );
501
502 if( parent->HasAlternateBodyStyle() )
503 aList.emplace_back( _( "Body Style" ), GetBodyStyleDescription( m_bodyStyle ) );
504 }
505
506 if( IsPrivate() )
507 aList.emplace_back( _( "Private" ), wxEmptyString );
508}
509
510
511static struct SCH_ITEM_DESC
512{
514 {
518
519#ifdef NOTYET
520 // Not yet functional in UI
521 propMgr.AddProperty( new PROPERTY<SCH_ITEM, bool>( _HKI( "Locked" ),
523#endif
524
525 auto multiUnit =
526 [=]( INSPECTABLE* aItem ) -> bool
527 {
528 if( SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( aItem ) )
529 {
530 if( const SYMBOL* symbol = schItem->GetParentSymbol() )
531 return symbol->IsMulti();
532 }
533
534 return false;
535 };
536
537 auto multiBodyStyle =
538 [=]( INSPECTABLE* aItem ) -> bool
539 {
540 if( SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( aItem ) )
541 {
542 if( const SYMBOL* symbol = schItem->GetParentSymbol() )
543 return symbol->HasAlternateBodyStyle();
544 }
545
546 return false;
547 };
548
549 propMgr.AddProperty( new PROPERTY<SCH_ITEM, int>( _HKI( "Unit" ),
551 .SetAvailableFunc( multiUnit )
553
554 propMgr.AddProperty( new PROPERTY<SCH_ITEM, int>( _HKI( "Body Style" ),
556 .SetAvailableFunc( multiBodyStyle )
558
559 propMgr.AddProperty( new PROPERTY<SCH_ITEM, bool>( _HKI( "Private" ),
562 }
564
566
567
568static bool lessYX( const DANGLING_END_ITEM& a, const DANGLING_END_ITEM& b )
569{
570 const auto aPos = a.GetPosition();
571 const auto bPos = b.GetPosition();
572 return aPos.y < bPos.y ? true : ( aPos.y > bPos.y ? false : aPos.x < bPos.x );
573};
574
575
576static bool lessType( const DANGLING_END_ITEM& a, const DANGLING_END_ITEM& b )
577{
578 return a.GetType() < b.GetType();
579};
580
581
582std::vector<DANGLING_END_ITEM>::iterator
583DANGLING_END_ITEM_HELPER::get_lower_pos( std::vector<DANGLING_END_ITEM>& aItemListByPos,
584 const VECTOR2I& aPos )
585{
586 DANGLING_END_ITEM needle = DANGLING_END_ITEM( PIN_END, nullptr, aPos );
587 auto start = aItemListByPos.begin();
588 auto end = aItemListByPos.end();
589 return std::lower_bound( start, end, needle, lessYX );
590}
591
592
593std::vector<DANGLING_END_ITEM>::iterator
594DANGLING_END_ITEM_HELPER::get_lower_type( std::vector<DANGLING_END_ITEM>& aItemListByType,
595 const DANGLING_END_T& aType )
596{
597 DANGLING_END_ITEM needle = DANGLING_END_ITEM( aType, nullptr, VECTOR2I{} );
598 auto start = aItemListByType.begin();
599 auto end = aItemListByType.end();
600 return std::lower_bound( start, end, needle, lessType );
601}
602
603
605 std::vector<DANGLING_END_ITEM>& aItemListByType,
606 std::vector<DANGLING_END_ITEM>& aItemListByPos )
607{
608 // WIRE_END pairs must be kept together. Hence stable sort.
609 std::stable_sort( aItemListByType.begin(), aItemListByType.end(), lessType );
610 // Sort by y first, pins are more likely to share x than y.
611 std::sort( aItemListByPos.begin(), aItemListByPos.end(), lessYX );
612}
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:594
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Definition: sch_item.cpp:583
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:604
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
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:269
SCH_ITEM & operator=(const SCH_ITEM &aPin)
Definition: sch_item.cpp:100
void ClearConnectedItems(const SCH_SHEET_PATH &aPath)
Clear all connections to this item.
Definition: sch_item.cpp:260
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:447
virtual ~SCH_ITEM()
Definition: sch_item.cpp:113
const SYMBOL * GetParentSymbol() const
Definition: sch_item.cpp:155
void SetPrivate(bool aPrivate)
Definition: sch_item.h:242
virtual const wxString & GetCachedDriverName() const
Definition: sch_item.cpp:330
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:139
int GetBodyStyle() const
Definition: sch_item.h:240
static wxString GetUnitDescription(int aUnit)
Definition: sch_item.cpp:51
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
Definition: sch_item.cpp:291
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
Definition: sch_item.cpp:275
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:239
virtual bool operator==(const SCH_ITEM &aOther) const
Definition: sch_item.cpp:384
bool m_connectivity_dirty
Definition: sch_item.h:745
bool IsPrivate() const
Definition: sch_item.h:243
virtual void ClearCaches()
Definition: sch_item.cpp:364
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:337
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:408
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:735
bool RenderAsBitmap(double aWorldScale) const override
Definition: sch_item.cpp:478
static wxString GetBodyStyleDescription(int aBodyStyle)
Definition: sch_item.cpp:60
void SetConnectionGraph(CONNECTION_GRAPH *aGraph)
Updates the connection graph for all connections in this item.
Definition: sch_item.cpp:227
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:343
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
Definition: sch_item.cpp:201
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:191
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition: sch_item.cpp:76
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:393
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:315
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:210
wxString GetClass() const override
Return the class name.
Definition: sch_item.h:184
const KIFONT::METRICS & GetFontMetrics() const
Definition: sch_item.cpp:455
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:464
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:120
void getSymbolEditorMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Definition: sch_item.cpp:490
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:108
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:366
static bool lessYX(const DANGLING_END_ITEM &a, const DANGLING_END_ITEM &b)
Definition: sch_item.cpp:568
#define BITMAP_FONT_SIZE_THRESHOLD
Definition: sch_item.cpp:48
static bool lessType(const DANGLING_END_ITEM &a, const DANGLING_END_ITEM &b)
Definition: sch_item.cpp:576
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:402
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