KiCad PCB EDA Suite
schematic.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) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <bus_alias.h>
21#include <connection_graph.h>
22#include <erc_settings.h>
23#include <sch_marker.h>
24#include <project.h>
27#include <schematic.h>
28#include <sch_junction.h>
29#include <sch_line.h>
30#include <sch_screen.h>
31#include <sim/spice_settings.h>
32#include <sch_label.h>
33
35 EDA_ITEM( nullptr, SCHEMATIC_T ),
36 m_project( nullptr ),
37 m_rootSheet( nullptr )
38{
41
42 SetProject( aPrj );
43}
44
45
47{
48 delete m_currentSheet;
49 delete m_connectionGraph;
50}
51
52
54{
55 // Assume project already saved
56 if( m_project )
57 {
59
60 delete project.m_ErcSettings;
61 delete project.m_SchematicSettings;
62
63 project.m_ErcSettings = nullptr;
64 project.m_SchematicSettings = nullptr;
65
66 m_project = nullptr; // clear the project, so we don't do this again when setting a new one
67 }
68
69 delete m_rootSheet;
70
71 m_rootSheet = nullptr;
72
75}
76
77
79{
80 if( m_project )
81 {
83
84 delete project.m_ErcSettings;
85 delete project.m_SchematicSettings;
86
87 project.m_ErcSettings = nullptr;
88 project.m_SchematicSettings = nullptr;
89 }
90
91 m_project = aPrj;
92
93 if( m_project )
94 {
96 project.m_ErcSettings = new ERC_SETTINGS( &project, "erc" );
97 project.m_SchematicSettings = new SCHEMATIC_SETTINGS( &project, "schematic" );
98
99 project.m_SchematicSettings->LoadFromFile();
100 project.m_SchematicSettings->m_NgspiceSimulatorSettings->LoadFromFile();
101 project.m_ErcSettings->LoadFromFile();
102 }
103}
104
105
106void SCHEMATIC::SetRoot( SCH_SHEET* aRootSheet )
107{
108 wxCHECK_RET( aRootSheet, wxS( "Call to SetRoot with null SCH_SHEET!" ) );
109
110 m_rootSheet = aRootSheet;
111
114
116}
117
118
120{
121 return IsValid() ? m_rootSheet->GetScreen() : nullptr;
122}
123
124
125bool SCHEMATIC::ResolveTextVar( wxString* token, int aDepth ) const
126{
127 if( !CurrentSheet().empty() )
128 {
129 if( token->IsSameAs( wxT( "#" ) ) )
130 {
131 *token = CurrentSheet().GetPageNumber();
132 return true;
133 }
134 else if( token->IsSameAs( wxT( "##" ) ) )
135 {
136 *token = wxString::Format( "%i", Root().CountSheets() );
137 return true;
138 }
139 else if( token->IsSameAs( wxT( "SHEETPATH" ) ) )
140 {
141 *token = CurrentSheet().PathHumanReadable();
142 return true;
143 }
144 else if( token->IsSameAs( wxT( "SHEETNAME" ) ) )
145 {
146 *token = CurrentSheet().Last()->GetName();
147 return true;
148 }
149 else if( token->IsSameAs( wxT( "FILENAME" ) ) )
150 {
151 wxFileName fn( GetFileName() );
152 *token = fn.GetFullName();
153 return true;
154 }
155 else if( token->IsSameAs( wxT( "PROJECTNAME" ) ) )
156 {
157 *token = Prj().GetProjectName();
158 return true;
159 }
160
161 if( CurrentSheet().LastScreen()->GetTitleBlock().TextVarResolver( token, m_project ) )
162 return true;
163 }
164
165 if( Prj().TextVarResolver( token ) )
166 return true;
167
168 return false;
169}
170
171
173{
174 return IsValid() ? m_rootSheet->GetScreen()->GetFileName() : wxString( wxEmptyString );
175}
176
177
179{
180 wxASSERT( m_project );
182}
183
184
186{
187 wxASSERT( m_project );
189}
190
191
192std::vector<SCH_MARKER*> SCHEMATIC::ResolveERCExclusions()
193{
194 SCH_SHEET_LIST sheetList = GetSheets();
195 ERC_SETTINGS& settings = ErcSettings();
196
197 // Migrate legacy marker exclusions to new format to ensure exclusion matching functions across
198 // file versions. Silently drops any legacy exclusions which can not be mapped to the new format
199 // without risking an incorrect exclusion - this is preferable to silently dropping
200 // new ERC errors / warnings due to an incorrect match between a legacy and new
201 // marker serialization format
202 std::set<wxString> migratedExclusions;
203
204 for( auto it = settings.m_ErcExclusions.begin(); it != settings.m_ErcExclusions.end(); )
205 {
206 SCH_MARKER* testMarker = SCH_MARKER::Deserialize( this, *it );
207 if( testMarker->IsLegacyMarker() )
208 {
209 const wxString settingsKey = testMarker->GetRCItem()->GetSettingsKey();
210
211 if( settingsKey != wxT( "pin_to_pin" ) && settingsKey != wxT( "hier_label_mismatch" )
212 && settingsKey != wxT( "different_unit_net" ) )
213 {
214 migratedExclusions.insert( testMarker->Serialize() );
215 }
216
217 it = settings.m_ErcExclusions.erase( it );
218 }
219 else
220 {
221 ++it;
222 }
223 delete testMarker;
224 }
225
226 settings.m_ErcExclusions.insert( migratedExclusions.begin(), migratedExclusions.end() );
227
228 // End of legacy exclusion removal / migrations
229
230 for( const SCH_SHEET_PATH& sheet : sheetList )
231 {
232 for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_MARKER_T ) )
233 {
234 SCH_MARKER* marker = static_cast<SCH_MARKER*>( item );
235 auto it = settings.m_ErcExclusions.find( marker->Serialize() );
236
237 if( it != settings.m_ErcExclusions.end() )
238 {
239 marker->SetExcluded( true );
240 settings.m_ErcExclusions.erase( it );
241 }
242 }
243 }
244
245 std::vector<SCH_MARKER*> newMarkers;
246
247 for( const wxString& exclusionData : settings.m_ErcExclusions )
248 {
249 SCH_MARKER* marker = SCH_MARKER::Deserialize( this, exclusionData );
250
251 if( marker )
252 {
253 marker->SetExcluded( true );
254 newMarkers.push_back( marker );
255 }
256 }
257
258 settings.m_ErcExclusions.clear();
259
260 return newMarkers;
261}
262
263
264std::shared_ptr<BUS_ALIAS> SCHEMATIC::GetBusAlias( const wxString& aLabel ) const
265{
266 for( const SCH_SHEET_PATH& sheet : GetSheets() )
267 {
268 for( const std::shared_ptr<BUS_ALIAS>& alias : sheet.LastScreen()->GetBusAliases() )
269 {
270 if( alias->GetName() == aLabel )
271 return alias;
272 }
273 }
274
275 return nullptr;
276}
277
278
280{
281 std::set<wxString> names;
282
283 for( const auto& [ key, subgraphList ] : m_connectionGraph->GetNetMap() )
284 {
285 CONNECTION_SUBGRAPH* firstSubgraph = subgraphList[0];
286
287 if( !firstSubgraph->m_driver_connection->IsBus()
289 {
290 names.insert( key.Name );
291 }
292 }
293
294 return names;
295}
296
297
298bool SCHEMATIC::ResolveCrossReference( wxString* token, int aDepth ) const
299{
300 SCH_SHEET_LIST sheetList = GetSheets();
301 wxString remainder;
302 wxString ref = token->BeforeFirst( ':', &remainder );
303 SCH_SHEET_PATH sheetPath;
304 SCH_ITEM* refItem = sheetList.GetItem( KIID( ref ), &sheetPath );
305
306 if( refItem && refItem->Type() == SCH_SYMBOL_T )
307 {
308 SCH_SYMBOL* refSymbol = static_cast<SCH_SYMBOL*>( refItem );
309
310 if( refSymbol->ResolveTextVar( &remainder, aDepth + 1 ) )
311 *token = remainder;
312 else
313 *token = refSymbol->GetRef( &sheetPath, true ) + wxS( ":" ) + remainder;
314
315 return true; // Cross-reference is resolved whether or not the actual textvar was
316 }
317 else if( refItem && refItem->Type() == SCH_SHEET_T )
318 {
319 SCH_SHEET* refSheet = static_cast<SCH_SHEET*>( refItem );
320
321 if( refSheet->ResolveTextVar( &remainder, aDepth + 1 ) )
322 *token = remainder;
323
324 return true; // Cross-reference is resolved whether or not the actual textvar was
325 }
326
327 return false;
328}
329
330
331std::map<int, wxString> SCHEMATIC::GetVirtualPageToSheetNamesMap() const
332{
333 std::map<int, wxString> namesMap;
334
335 for( const SCH_SHEET_PATH& sheet : GetSheets() )
336 {
337 if( sheet.size() == 1 )
338 namesMap[sheet.GetVirtualPageNumber()] = _( "<root sheet>" );
339 else
340 namesMap[sheet.GetVirtualPageNumber()] = sheet.Last()->GetName();
341 }
342
343 return namesMap;
344}
345
346
347std::map<int, wxString> SCHEMATIC::GetVirtualPageToSheetPagesMap() const
348{
349 std::map<int, wxString> pagesMap;
350
351 for( const SCH_SHEET_PATH& sheet : GetSheets() )
352 pagesMap[sheet.GetVirtualPageNumber()] = sheet.GetPageNumber();
353
354 return pagesMap;
355}
356
357
358wxString SCHEMATIC::ConvertRefsToKIIDs( const wxString& aSource ) const
359{
360 wxString newbuf;
361 size_t sourceLen = aSource.length();
362
363 for( size_t i = 0; i < sourceLen; ++i )
364 {
365 if( aSource[i] == '$' && i + 1 < sourceLen && aSource[i+1] == '{' )
366 {
367 wxString token;
368 bool isCrossRef = false;
369 int nesting = 0;
370
371 for( i = i + 2; i < sourceLen; ++i )
372 {
373 if( aSource[i] == '{'
374 && ( aSource[i-1] == '_' || aSource[i-1] == '^' || aSource[i-1] == '~' ) )
375 {
376 nesting++;
377 }
378
379 if( aSource[i] == '}' )
380 {
381 nesting--;
382
383 if( nesting < 0 )
384 break;
385 }
386
387 if( aSource[i] == ':' )
388 isCrossRef = true;
389
390 token.append( aSource[i] );
391 }
392
393 if( isCrossRef )
394 {
395 SCH_SHEET_LIST sheetList = GetSheets();
396 wxString remainder;
397 wxString ref = token.BeforeFirst( ':', &remainder );
398 SCH_REFERENCE_LIST references;
399
400 sheetList.GetSymbols( references );
401
402 for( size_t jj = 0; jj < references.GetCount(); jj++ )
403 {
404 SCH_SYMBOL* refSymbol = references[ jj ].GetSymbol();
405
406 if( ref == refSymbol->GetRef( &references[ jj ].GetSheetPath(), true ) )
407 {
408 token = refSymbol->m_Uuid.AsString() + wxS( ":" ) + remainder;
409 break;
410 }
411 }
412 }
413
414 newbuf.append( wxS( "${" ) + token + wxS( "}" ) );
415 }
416 else
417 {
418 newbuf.append( aSource[i] );
419 }
420 }
421
422 return newbuf;
423}
424
425
426wxString SCHEMATIC::ConvertKIIDsToRefs( const wxString& aSource ) const
427{
428 wxString newbuf;
429 size_t sourceLen = aSource.length();
430
431 for( size_t i = 0; i < sourceLen; ++i )
432 {
433 if( aSource[i] == '$' && i + 1 < sourceLen && aSource[i+1] == '{' )
434 {
435 wxString token;
436 bool isCrossRef = false;
437
438 for( i = i + 2; i < sourceLen; ++i )
439 {
440 if( aSource[i] == '}' )
441 break;
442
443 if( aSource[i] == ':' )
444 isCrossRef = true;
445
446 token.append( aSource[i] );
447 }
448
449 if( isCrossRef )
450 {
451 SCH_SHEET_LIST sheetList = GetSheets();
452 wxString remainder;
453 wxString ref = token.BeforeFirst( ':', &remainder );
454
455 SCH_SHEET_PATH refSheetPath;
456 SCH_ITEM* refItem = sheetList.GetItem( KIID( ref ), &refSheetPath );
457
458 if( refItem && refItem->Type() == SCH_SYMBOL_T )
459 {
460 SCH_SYMBOL* refSymbol = static_cast<SCH_SYMBOL*>( refItem );
461 token = refSymbol->GetRef( &refSheetPath, true ) + wxS( ":" ) + remainder;
462 }
463 }
464
465 newbuf.append( wxS( "${" ) + token + wxS( "}" ) );
466 }
467 else
468 {
469 newbuf.append( aSource[i] );
470 }
471 }
472
473 return newbuf;
474}
475
476
478{
479 static SCH_SHEET_LIST hierarchy;
480
481 hierarchy.clear();
482 hierarchy.BuildSheetList( m_rootSheet, false );
483
484 return hierarchy;
485}
486
487
489{
490 SCH_SCREENS screens( m_rootSheet );
491
493}
494
495
497{
498 // Filename is rootSheetName-sheetName-...-sheetName
499 // Note that we need to fetch the rootSheetName out of its filename, as the root SCH_SHEET's
500 // name is just a timestamp.
501
502 wxFileName rootFn( CurrentSheet().at( 0 )->GetFileName() );
503 wxString filename = rootFn.GetName();
504
505 for( unsigned i = 1; i < CurrentSheet().size(); i++ )
506 filename += wxT( "-" ) + CurrentSheet().at( i )->GetName();
507
508 return filename;
509}
510
511
513{
514 SCH_SCREEN* screen;
515 SCH_SCREENS s_list( Root() );
516
517 // Set the sheet count, and the sheet number (1 for root sheet)
518 int sheet_count = Root().CountSheets();
519 int sheet_number = 1;
520 const KIID_PATH& current_sheetpath = CurrentSheet().Path();
521
522 // @todo Remove all pseudo page number system is left over from prior to real page number
523 // implementation.
524 for( const SCH_SHEET_PATH& sheet : GetSheets() )
525 {
526 if( sheet.Path() == current_sheetpath ) // Current sheet path found
527 break;
528
529 sheet_number++; // Not found, increment before this current path
530 }
531
532 for( screen = s_list.GetFirst(); screen != nullptr; screen = s_list.GetNext() )
533 screen->SetPageCount( sheet_count );
534
535 CurrentSheet().SetVirtualPageNumber( sheet_number );
536 CurrentSheet().LastScreen()->SetVirtualPageNumber( sheet_number );
537 CurrentSheet().LastScreen()->SetPageNumber( CurrentSheet().GetPageNumber() );
538}
539
540
541void SCHEMATIC::RecomputeIntersheetRefs( const std::function<void( SCH_GLOBALLABEL* )>& aItemCallback )
542{
543 std::map<wxString, std::set<int>>& pageRefsMap = GetPageRefsMap();
544
545 pageRefsMap.clear();
546
547 SCH_SCREENS screens( Root() );
548 std::vector<int> virtualPageNumbers;
549
550 /* Iterate over screens */
551 for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
552 {
553 virtualPageNumbers.clear();
554
555 /* Find in which sheets this screen is used */
556 for( const SCH_SHEET_PATH& sheet : GetSheets() )
557 {
558 if( sheet.LastScreen() == screen )
559 virtualPageNumbers.push_back( sheet.GetVirtualPageNumber() );
560 }
561
562 for( SCH_ITEM* item : screen->Items() )
563 {
564 if( item->Type() == SCH_GLOBAL_LABEL_T )
565 {
566 SCH_GLOBALLABEL* globalLabel = static_cast<SCH_GLOBALLABEL*>( item );
567 std::set<int>& virtualpageList = pageRefsMap[globalLabel->GetText()];
568
569 for( const int& pageNo : virtualPageNumbers )
570 virtualpageList.insert( pageNo );
571 }
572 }
573 }
574
575 bool show = Settings().m_IntersheetRefsShow;
576
577 // Refresh all global labels. Note that we have to collect them first as the
578 // SCH_SCREEN::Update() call is going to invalidate the RTree iterator.
579
580 std::vector<SCH_GLOBALLABEL*> currentSheetGlobalLabels;
581
582 for( EDA_ITEM* item : CurrentSheet().LastScreen()->Items().OfType( SCH_GLOBAL_LABEL_T ) )
583 currentSheetGlobalLabels.push_back( static_cast<SCH_GLOBALLABEL*>( item ) );
584
585 for( SCH_GLOBALLABEL* globalLabel : currentSheetGlobalLabels )
586 {
587 std::vector<SCH_FIELD>& fields = globalLabel->GetFields();
588
589 fields[0].SetVisible( show );
590
591 if( show )
592 {
593 if( fields.size() == 1 && fields[0].GetTextPos() == globalLabel->GetPosition() )
594 globalLabel->AutoplaceFields( CurrentSheet().LastScreen(), false );
595
596 CurrentSheet().LastScreen()->Update( globalLabel );
597 aItemCallback( globalLabel );
598 }
599 }
600}
601
602
604{
605 for( const SCH_SHEET_PATH& sheet : GetSheets() )
606 {
607 SCH_SCREEN* screen = sheet.LastScreen();
608
609 std::deque<EDA_ITEM*> allItems;
610
611 for( auto item : screen->Items() )
612 allItems.push_back( item );
613
614 // Add missing junctions and breakup wires as needed
615 for( const VECTOR2I& point : screen->GetNeededJunctions( allItems ) )
616 {
617 SCH_JUNCTION* junction = new SCH_JUNCTION( point );
618 screen->Append( junction );
619
620 // Breakup wires
621 for( SCH_LINE* wire : screen->GetBusesAndWires( point, true ) )
622 {
623 SCH_LINE* newSegment = wire->BreakAt( point );
624 screen->Append( newSegment );
625 }
626 }
627 }
628}
void SetPageCount(int aPageCount)
Definition: base_screen.cpp:63
void SetPageNumber(const wxString &aPageNumber)
Definition: base_screen.h:79
void SetVirtualPageNumber(int aPageNumber)
Definition: base_screen.h:76
Calculates the connectivity of a schematic and generates netlists.
const NET_MAP & GetNetMap() const
A subgraph is a set of items that are electrically connected on a single sheet.
static PRIORITY GetDriverPriority(SCH_ITEM *aDriver)
Return the priority (higher is more important) of a candidate driver.
SCH_CONNECTION * m_driver_connection
Cache for driver connection.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
const KIID m_Uuid
Definition: eda_item.h:492
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
Container for ERC settings.
Definition: erc_settings.h:114
std::set< wxString > m_ErcExclusions
Definition: erc_settings.h:174
Definition: kiid.h:48
wxString AsString() const
Definition: kiid.cpp:257
std::shared_ptr< RC_ITEM > GetRCItem() const
Definition: marker_base.h:105
void SetExcluded(bool aExcluded)
Definition: marker_base.h:98
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:65
ERC_SETTINGS * m_ErcSettings
Eeschema params.
Definition: project_file.h:127
SCHEMATIC_SETTINGS * m_SchematicSettings
Definition: project_file.h:130
Container for project specific data.
Definition: project.h:64
virtual const wxString GetProjectName() const
Return the short name of the project.
Definition: project.cpp:132
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:149
These settings were stored in SCH_BASE_FRAME previously.
void Reset()
Initialize this schematic to a blank one, unloading anything existing.
Definition: schematic.cpp:53
void SetLegacySymbolInstanceData()
Update the symbol value and footprint instance data for legacy designs.
Definition: schematic.cpp:488
CONNECTION_GRAPH * m_connectionGraph
Holds and calculates connectivity information of this schematic.
Definition: schematic.h:232
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:120
SCH_SHEET_PATH * m_currentSheet
The sheet path of the sheet currently being edited or displayed.
Definition: schematic.h:229
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: schematic.cpp:125
virtual ~SCHEMATIC()
Definition: schematic.cpp:46
std::shared_ptr< BUS_ALIAS > GetBusAlias(const wxString &aLabel) const
Return a pointer to a bus alias object for the given label, or null if one doesn't exist.
Definition: schematic.cpp:264
std::vector< SCH_MARKER * > ResolveERCExclusions()
Definition: schematic.cpp:192
wxString GetFileName() const override
Helper to retrieve the filename from the root sheet screen.
Definition: schematic.cpp:172
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:178
wxString ConvertKIIDsToRefs(const wxString &aSource) const
Definition: schematic.cpp:426
std::map< wxString, std::set< int > > & GetPageRefsMap()
Definition: schematic.h:161
SCH_SHEET_LIST & GetFullHierarchy() const
Return the full schematic flattened hierarchical sheet list.
Definition: schematic.cpp:477
void FixupJunctions()
Add junctions to this schematic where required.
Definition: schematic.cpp:603
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:86
wxString ConvertRefsToKIIDs(const wxString &aSource) const
Definition: schematic.cpp:358
void SetRoot(SCH_SHEET *aRootSheet)
Initialize the schematic with a new root sheet.
Definition: schematic.cpp:106
void SetProject(PROJECT *aPrj)
Definition: schematic.cpp:78
std::map< int, wxString > GetVirtualPageToSheetPagesMap() const
Definition: schematic.cpp:347
PROJECT * m_project
Definition: schematic.h:218
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
Definition: schematic.cpp:119
SCHEMATIC(PROJECT *aPrj)
Definition: schematic.cpp:34
std::set< wxString > GetNetClassAssignmentCandidates()
Return the set of netname candidates for netclass assignment.
Definition: schematic.cpp:279
void RecomputeIntersheetRefs(const std::function< void(SCH_GLOBALLABEL *)> &aItemCallback)
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
Definition: schematic.cpp:541
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
Definition: schematic.h:107
SCH_SHEET & Root() const
Definition: schematic.h:91
std::map< int, wxString > GetVirtualPageToSheetNamesMap() const
Definition: schematic.cpp:331
wxString GetUniqueFilenameForCurrentSheet()
Definition: schematic.cpp:496
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
Definition: schematic.cpp:512
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:76
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
Definition: schematic.cpp:298
ERC_SETTINGS & ErcSettings() const
Definition: schematic.cpp:185
SCH_SHEET * m_rootSheet
The top-level sheet in this schematic hierarchy (or potentially the only one)
Definition: schematic.h:221
bool IsBus() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:40
SCH_LINE * BreakAt(const VECTOR2I &aPoint)
Break this segment into two at the specified point.
Definition: sch_line.cpp:561
wxString Serialize() const
Definition: sch_marker.cpp:78
bool IsLegacyMarker() const
Determines if this marker is legacy (i.e.
Definition: sch_marker.h:121
static SCH_MARKER * Deserialize(SCHEMATIC *schematic, const wxString &data)
Definition: sch_marker.cpp:99
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
size_t GetCount() const
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:638
SCH_SCREEN * GetNext()
SCH_SCREEN * GetFirst()
void SetLegacySymbolInstanceData()
Update the symbol value and footprint instance data for legacy designs.
void Update(SCH_ITEM *aItem)
Update aItem's bounding box in the tree.
Definition: sch_screen.cpp:265
std::vector< SCH_LINE * > GetBusesAndWires(const VECTOR2I &aPosition, bool aIgnoreEndpoints=false) const
Return buses and wires passing through aPosition.
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
Definition: sch_screen.h:109
const wxString & GetFileName() const
Definition: sch_screen.h:144
std::vector< VECTOR2I > GetNeededJunctions(const std::deque< EDA_ITEM * > &aItems) const
Return the unique set of points belonging to aItems where a junction is needed.
void Append(SCH_ITEM *aItem)
Definition: sch_screen.cpp:145
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
SCH_ITEM * GetItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr) const
Fetch a SCH_ITEM by ID.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
void BuildSheetList(SCH_SHEET *aSheet, bool aCheckIntegrity)
Build the list of sheets and their sheet path from aSheet.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false) const
Return the sheet path in a human readable form made from the sheet names.
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
SCH_SCREEN * LastScreen()
wxString GetPageNumber() const
SCH_SHEET * at(size_t aIndex) const
Forwarded method from std::vector.
void SetVirtualPageNumber(int aPageNumber)
Set the sheet instance virtual page number.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
void clear()
Forwarded method from std::vector.
size_t size() const
Forwarded method from std::vector.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
wxString GetName() const
Definition: sch_sheet.h:103
int CountSheets() const
Count the number of sheets found in "this" sheet including all of the subsheets.
Definition: sch_sheet.cpp:779
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:106
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Definition: sch_sheet.cpp:233
Schematic symbol object.
Definition: sch_symbol.h:81
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:652
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
static bool empty(const wxTextEntryBase *aCtrl)
#define _(s)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
@ SCH_SYMBOL_T
Definition: typeinfo.h:156
@ SCH_SHEET_T
Definition: typeinfo.h:158
@ SCH_MARKER_T
Definition: typeinfo.h:141
@ SCHEMATIC_T
Definition: typeinfo.h:188
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:152