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
202std::vector<int> SCH_ITEM::ViewGetLayers() const
203{
204 // Basic fallback
206}
207
208
209bool SCH_ITEM::IsConnected( const VECTOR2I& aPosition ) const
210{
211 if(( m_flags & STRUCT_DELETED ) || ( m_flags & SKIP_STRUCT ) )
212 return false;
213
214 return doIsConnected( aPosition );
215}
216
217
219{
220 if( !IsConnectable() )
221 return nullptr;
222
223 if( !aSheet )
224 aSheet = &Schematic()->CurrentSheet();
225
226 auto it = m_connection_map.find( *aSheet );
227
228 if( it == m_connection_map.end() )
229 return nullptr;
230 else
231 return it->second;
232}
233
234
236{
237 for( auto& [path, conn] : m_connection_map )
238 {
239 conn->SetGraph( aGraph );
240
241 for( auto& member : conn->AllMembers() )
242 member->SetGraph( aGraph );
243 }
244}
245
246
247std::shared_ptr<NETCLASS> SCH_ITEM::GetEffectiveNetClass( const SCH_SHEET_PATH* aSheet ) const
248{
249 static std::shared_ptr<NETCLASS> nullNetclass = std::make_shared<NETCLASS>( wxEmptyString );
250
251 SCHEMATIC* schematic = Schematic();
252
253 if( schematic )
254 {
255 std::shared_ptr<NET_SETTINGS>& netSettings = schematic->Prj().GetProjectFile().m_NetSettings;
256 SCH_CONNECTION* connection = Connection( aSheet );
257
258 if( connection )
259 return netSettings->GetEffectiveNetClass( connection->Name() );
260 else
261 return netSettings->GetDefaultNetclass();
262 }
263
264 return nullNetclass;
265}
266
267
269{
270 auto it = m_connected_items.find( aSheet );
271
272 if( it != m_connected_items.end() )
273 it->second.clear();
274}
275
276
278{
279 return m_connected_items[ aSheet ];
280}
281
282
284{
285 SCH_ITEM_VEC& vec = m_connected_items[ aSheet ];
286
287 // The vector elements are small, so reserve 1k at a time to prevent re-allocations
288 if( vec.size() == vec.capacity() )
289 vec.reserve( vec.size() + 4096 );
290
291 // Add item to the correct place in the sorted vector if it is not already there
292 auto it = std::lower_bound( vec.begin(), vec.end(), aItem );
293
294 if( it == vec.end() || *it != aItem )
295 vec.insert( it, aItem );
296}
297
298
300 CONNECTION_GRAPH* aGraph )
301{
302 SCH_CONNECTION* connection = Connection( &aSheet );
303
304 // N.B. Do not clear the dirty connectivity flag here because we may need
305 // to create a connection for a different sheet, and we don't want to
306 // skip the connection creation because the flag is cleared.
307 if( connection )
308 {
309 connection->Reset();
310 }
311 else
312 {
313 connection = new SCH_CONNECTION( this );
314 m_connection_map.insert( std::make_pair( aSheet, connection ) );
315 }
316
317 connection->SetGraph( aGraph );
318 connection->SetSheet( aSheet );
319 return connection;
320}
321
322
324 CONNECTION_GRAPH* aGraph )
325{
326 if( !IsConnectable() )
327 return nullptr;
328
329 SCH_CONNECTION* connection = Connection( &aSheet );
330
331 if( connection )
332 return connection;
333 else
334 return InitializeConnection( aSheet, aGraph );
335}
336
337
338const wxString& SCH_ITEM::GetCachedDriverName() const
339{
340 static wxString s_empty;
341 return s_empty;
342}
343
344
346{
348}
349
350
352{
353 EDA_ITEM_FLAGS editFlags = GetEditFlags();
354 EDA_ITEM_FLAGS tempFlags = GetTempFlags();
355 EDA_ITEM_FLAGS aItem_editFlags = aItem->GetEditFlags();
356 EDA_ITEM_FLAGS aItem_tempFlags = aItem->GetTempFlags();
357
358 std::swap( m_flags, aItem->m_flags );
359
361 SetFlags( editFlags );
363 SetFlags( tempFlags );
364
365 aItem->ClearEditFlags();
366 aItem->SetFlags( aItem_editFlags );
367 aItem->ClearTempFlags();
368 aItem->SetFlags( aItem_tempFlags );
369}
370
371
373{
374 auto clearTextCaches =
375 []( SCH_ITEM* aItem )
376 {
377 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
378
379 if( text )
380 {
381 text->ClearBoundingBoxCache();
382 text->ClearRenderCache();
383 }
384 };
385
386 clearTextCaches( this );
387
388 RunOnChildren( clearTextCaches );
389}
390
391
392bool SCH_ITEM::operator==( const SCH_ITEM& aOther ) const
393{
394 if( Type() != aOther.Type() )
395 return false;
396
397 return compare( aOther, SCH_ITEM::COMPARE_FLAGS::EQUALITY ) == 0;
398}
399
400
401bool SCH_ITEM::operator<( const SCH_ITEM& aOther ) const
402{
403 if( Type() != aOther.Type() )
404 return Type() < aOther.Type();
405
406 return ( compare( aOther ) < 0 );
407}
408
409
410bool SCH_ITEM::cmp_items::operator()( const SCH_ITEM* aFirst, const SCH_ITEM* aSecond ) const
411{
412 return aFirst->compare( *aSecond, COMPARE_FLAGS::EQUALITY ) < 0;
413}
414
415
416int SCH_ITEM::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
417{
418 if( Type() != aOther.Type() )
419 return Type() - aOther.Type();
420
421 if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::UNIT ) && m_unit != aOther.m_unit )
422 return m_unit - aOther.m_unit;
423
424 if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::UNIT ) && m_bodyStyle != aOther.m_bodyStyle )
425 return m_bodyStyle - aOther.m_bodyStyle;
426
427 if( IsPrivate() != aOther.IsPrivate() )
428 return IsPrivate() ? 1 : -1;
429
430 if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::SKIP_TST_POS ) )
431 {
432 if( GetPosition().x != aOther.GetPosition().x )
433 return GetPosition().x - aOther.GetPosition().x;
434
435 if( GetPosition().y != aOther.GetPosition().y )
436 return GetPosition().y - aOther.GetPosition().y;
437 }
438
439 if( ( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::EQUALITY )
440 || ( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::ERC ) )
441 {
442 return 0;
443 }
444
445 if( m_Uuid < aOther.m_Uuid )
446 return -1;
447
448 if( m_Uuid > aOther.m_Uuid )
449 return 1;
450
451 return 0;
452}
453
454
455const wxString& SCH_ITEM::GetDefaultFont() const
456{
458 EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
459
460 return cfg->m_Appearance.default_font;
461}
462
463
465{
466 if( SCHEMATIC* schematic = Schematic() )
467 return schematic->Settings().m_FontMetrics;
468
470}
471
472
474{
475 // For historical reasons, a stored value of 0 means "default width" and negative
476 // numbers meant "don't stroke".
477
478 if( GetPenWidth() < 0 )
479 return 0;
480 else if( GetPenWidth() == 0 )
481 return std::max( aSettings->GetDefaultPenWidth(), aSettings->GetMinPenWidth() );
482 else
483 return std::max( GetPenWidth(), aSettings->GetMinPenWidth() );
484}
485
486
487bool SCH_ITEM::RenderAsBitmap( double aWorldScale ) const
488{
489 if( IsHypertext() )
490 return false;
491
492 if( const EDA_TEXT* text = dynamic_cast<const EDA_TEXT*>( this ) )
493 return text->GetTextHeight() * aWorldScale < BITMAP_FONT_SIZE_THRESHOLD;
494
495 return false;
496}
497
498
500 std::vector<MSG_PANEL_ITEM>& aList )
501{
502 wxString msg;
503
504 aList.emplace_back( _( "Type" ), GetFriendlyName() );
505
506 if( const SYMBOL* parent = GetParentSymbol() )
507 {
508 if( parent->GetUnitCount() )
509 aList.emplace_back( _( "Unit" ), GetUnitDescription( m_unit ) );
510
511 if( parent->HasAlternateBodyStyle() )
512 aList.emplace_back( _( "Body Style" ), GetBodyStyleDescription( m_bodyStyle ) );
513 }
514
515 if( IsPrivate() )
516 aList.emplace_back( _( "Private" ), wxEmptyString );
517}
518
519
520static struct SCH_ITEM_DESC
521{
523 {
527
528#ifdef NOTYET
529 // Not yet functional in UI
530 propMgr.AddProperty( new PROPERTY<SCH_ITEM, bool>( _HKI( "Locked" ),
532#endif
533
534 auto multiUnit =
535 [=]( INSPECTABLE* aItem ) -> bool
536 {
537 if( SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( aItem ) )
538 {
539 if( const SYMBOL* symbol = schItem->GetParentSymbol() )
540 return symbol->IsMulti();
541 }
542
543 return false;
544 };
545
546 auto multiBodyStyle =
547 [=]( INSPECTABLE* aItem ) -> bool
548 {
549 if( SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( aItem ) )
550 {
551 if( const SYMBOL* symbol = schItem->GetParentSymbol() )
552 return symbol->HasAlternateBodyStyle();
553 }
554
555 return false;
556 };
557
558 propMgr.AddProperty( new PROPERTY<SCH_ITEM, int>( _HKI( "Unit" ),
560 .SetAvailableFunc( multiUnit )
562
563 propMgr.AddProperty( new PROPERTY<SCH_ITEM, int>( _HKI( "Body Style" ),
565 .SetAvailableFunc( multiBodyStyle )
567
568 propMgr.AddProperty( new PROPERTY<SCH_ITEM, bool>( _HKI( "Private" ),
571 }
573
575
576
577static bool lessYX( const DANGLING_END_ITEM& a, const DANGLING_END_ITEM& b )
578{
579 const auto aPos = a.GetPosition();
580 const auto bPos = b.GetPosition();
581 return aPos.y < bPos.y ? true : ( aPos.y > bPos.y ? false : aPos.x < bPos.x );
582};
583
584
585static bool lessType( const DANGLING_END_ITEM& a, const DANGLING_END_ITEM& b )
586{
587 return a.GetType() < b.GetType();
588};
589
590
591std::vector<DANGLING_END_ITEM>::iterator
592DANGLING_END_ITEM_HELPER::get_lower_pos( std::vector<DANGLING_END_ITEM>& aItemListByPos,
593 const VECTOR2I& aPos )
594{
595 DANGLING_END_ITEM needle = DANGLING_END_ITEM( PIN_END, nullptr, aPos );
596 auto start = aItemListByPos.begin();
597 auto end = aItemListByPos.end();
598 return std::lower_bound( start, end, needle, lessYX );
599}
600
601
602std::vector<DANGLING_END_ITEM>::iterator
603DANGLING_END_ITEM_HELPER::get_lower_type( std::vector<DANGLING_END_ITEM>& aItemListByType,
604 const DANGLING_END_T& aType )
605{
606 DANGLING_END_ITEM needle = DANGLING_END_ITEM( aType, nullptr, VECTOR2I{} );
607 auto start = aItemListByType.begin();
608 auto end = aItemListByType.end();
609 return std::lower_bound( start, end, needle, lessType );
610}
611
612
614 std::vector<DANGLING_END_ITEM>& aItemListByType,
615 std::vector<DANGLING_END_ITEM>& aItemListByPos )
616{
617 // WIRE_END pairs must be kept together. Hence stable sort.
618 std::stable_sort( aItemListByType.begin(), aItemListByType.end(), lessType );
619 // Sort by y first, pins are more likely to share x than y.
620 std::sort( aItemListByPos.begin(), aItemListByPos.end(), lessYX );
621}
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:603
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Definition: sch_item.cpp:592
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:613
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:80
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:277
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:268
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:455
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:338
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:150
int GetBodyStyle() const
Definition: sch_item.h:232
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:202
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:299
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
Definition: sch_item.cpp:283
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:247
virtual bool operator==(const SCH_ITEM &aOther) const
Definition: sch_item.cpp:392
bool m_connectivity_dirty
Definition: sch_item.h:737
bool IsPrivate() const
Definition: sch_item.h:235
virtual void ClearCaches()
Definition: sch_item.cpp:372
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:345
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:416
FIELDS_AUTOPLACED m_fieldsAutoplaced
Definition: sch_item.h:727
bool RenderAsBitmap(double aWorldScale) const override
Definition: sch_item.cpp:487
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:235
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:351
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
Definition: sch_item.cpp:209
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:401
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:323
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:218
wxString GetClass() const override
Return the class name.
Definition: sch_item.h:176
const KIFONT::METRICS & GetFontMetrics() const
Definition: sch_item.cpp:464
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:473
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:499
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(const wxString &aFilename)
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:577
#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:585
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:410
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