KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_io_easyeda.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) 2023 Alex Shvartzkop <[email protected]>
5 * Copyright (C) 2023-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 "sch_easyeda_parser.h"
26#include "sch_io_easyeda.h"
27
28#include <font/fontconfig.h>
30#include <project_sch.h>
31#include <sch_screen.h>
32#include <sch_sheet.h>
33#include <schematic.h>
34#include <string_utils.h>
36#include <wx/log.h>
37#include <wx/stdstream.h>
38#include <wx/zipstrm.h>
39
40#include <nlohmann/json.hpp>
41#include <core/map_helpers.h>
42#include <wx/wfstream.h>
43
44
45static bool FindSchFileInStream( const wxString& aName, wxInputStream& aStream,
46 nlohmann::json& aOut, EASYEDA::DOCUMENT& aDoc,
47 EASYEDA::DOC_TYPE& aDocType )
48{
49 if( aName.Lower().EndsWith( wxS( ".json" ) ) )
50 {
51 wxStdInputStream sin( aStream );
52 nlohmann::json js = nlohmann::json::parse( sin, nullptr, false );
53
54 if( js.is_discarded() )
55 return false;
56
59
60 if( doc.docType )
61 type = *doc.docType;
62 else
63 type = doc.head.docType;
64
66 || type == EASYEDA::DOC_TYPE::SYMBOL )
67 {
68 aOut = js;
69 aDoc = doc;
70 aDocType = type;
71 return true;
72 }
73 }
74 else if( aName.Lower().EndsWith( wxS( ".zip" ) ) )
75 {
76 std::shared_ptr<wxZipEntry> entry;
77 wxZipInputStream zip( aStream );
78
79 if( !zip.IsOk() )
80 return false;
81
82 while( entry.reset( zip.GetNextEntry() ), entry.get() != NULL )
83 {
84 wxString name = entry->GetName();
85
86 if( FindSchFileInStream( name, zip, aOut, aDoc, aDocType ) )
87 return true;
88 }
89 }
90
91 return false;
92}
93
94
95bool SCH_IO_EASYEDA::CanReadSchematicFile( const wxString& aFileName ) const
96{
97 if( !SCH_IO::CanReadSchematicFile( aFileName ) )
98 return false;
99
100 try
101 {
102 wxFFileInputStream in( aFileName );
103 nlohmann::json js;
105 EASYEDA::DOC_TYPE docType;
106
107 return FindSchFileInStream( aFileName, in, js, doc, docType );
108 }
109 catch( nlohmann::json::exception& )
110 {
111 }
112 catch( std::exception& )
113 {
114 }
115
116 return false;
117}
118
119
120bool SCH_IO_EASYEDA::CanReadLibrary( const wxString& aFileName ) const
121{
122 return CanReadSchematicFile( aFileName );
123}
124
125
127{
128 return 0;
129}
130
131
132LIB_SYMBOL* loadSymbol( const wxString& aLibraryPath, nlohmann::json aFileData,
133 const wxString& aAliasName, const std::map<std::string, UTF8>* aProperties )
134{
135 SCH_EASYEDA_PARSER parser( nullptr, nullptr );
136 std::map<wxString, int> namesCounter;
137
138 try
139 {
140 wxFFileInputStream in( aLibraryPath );
141 nlohmann::json js;
142 EASYEDA::DOCUMENT topDoc;
143 EASYEDA::DOC_TYPE topDocType;
144
145 if( !FindSchFileInStream( aLibraryPath, in, js, topDoc, topDocType ) )
146 {
147 THROW_IO_ERROR( wxString::Format( _( "Unable to find a valid schematic file in '%s'" ),
148 aLibraryPath ) );
149 }
150
151 if( topDocType == EASYEDA::DOC_TYPE::SCHEMATIC_SHEET
152 || topDocType == EASYEDA::DOC_TYPE::SCHEMATIC_LIST )
153 {
155
156 for( const EASYEDA::DOCUMENT& subDoc : *schDoc.schematics )
157 {
158 if( subDoc.docType )
159 {
161 continue;
162 }
163 else
164 {
166 continue;
167 }
168
169 EASYEDA::DOCUMENT dataStrDoc = subDoc.dataStr->get<EASYEDA::DOCUMENT>();
170
171 for( wxString shap : dataStrDoc.shape )
172 {
173 if( !shap.Contains( wxS( "LIB" ) ) )
174 continue;
175
176 shap.Replace( wxS( "#@$" ), wxS( "\n" ) );
177 wxArrayString parts = wxSplit( shap, '\n', '\0' );
178
179 if( parts.size() < 1 )
180 continue;
181
182 wxArrayString paramsRoot = wxSplit( parts[0], '~', '\0' );
183
184 if( paramsRoot.size() < 1 )
185 continue;
186
187 wxString rootType = paramsRoot[0];
188
189 if( rootType == wxS( "LIB" ) )
190 {
191 if( paramsRoot.size() < 4 )
192 continue;
193
194 VECTOR2D origin( parser.Convert( paramsRoot[1] ),
195 parser.Convert( paramsRoot[2] ) );
196
197 wxString symbolName = wxString::Format( wxS( "Unknown_%s_%s" ),
198 paramsRoot[1], paramsRoot[2] );
199
200 wxArrayString paramParts = wxSplit( paramsRoot[3], '`', '\0' );
201
202 std::map<wxString, wxString> paramMap;
203
204 for( size_t i = 1; i < paramParts.size(); i += 2 )
205 {
206 wxString key = paramParts[i - 1];
207 wxString value = paramParts[i];
208
209 if( key == wxS( "spiceSymbolName" ) && !value.IsEmpty() )
210 symbolName = value;
211
212 paramMap[key] = value;
213 }
214
215 int& serial = namesCounter[symbolName];
216
217 if( serial > 0 )
218 symbolName << wxS( "_" ) << serial;
219
220 serial++;
221
222 paramMap[wxS( "spiceSymbolName" )] = symbolName;
223
224 if( symbolName == aAliasName )
225 {
226 parts.RemoveAt( 0 );
227
228 LIB_SYMBOL* ksymbol = parser.ParseSymbol( origin, paramMap, parts );
229
230 // Clear reference numbers
231 SCH_FIELD& refField = ksymbol->GetReferenceField();
232 wxString origRef = refField.GetText();
233 wxString reference;
234
235 for( size_t i = 0; i < origRef.size() && !wxIsdigit( origRef[i] ); i++ )
236 reference << origRef[i];
237
238 refField.SetText( reference );
239
240 return ksymbol;
241 }
242 }
243 }
244 }
245 }
246 else if( topDocType == EASYEDA::DOC_TYPE::SYMBOL )
247 {
249
250 wxString symbolName = wxS( "Unknown" );
251
252 std::optional<std::map<wxString, wxString>> c_para;
253
254 if( symDoc.c_para )
255 c_para = symDoc.c_para;
256 else if( topDoc.head.c_para )
257 c_para = topDoc.head.c_para;
258
259 if( !c_para )
260 return nullptr;
261
262 symbolName = get_def( *c_para, wxS( "name" ), symbolName );
263
264 int& serial = namesCounter[symbolName];
265
266 if( serial > 0 )
267 symbolName << wxS( "_" ) << serial;
268
269 serial++;
270
271 if( symbolName != aAliasName )
272 return nullptr;
273
274 VECTOR2D origin( topDoc.head.x, topDoc.head.y );
275
276 LIB_SYMBOL* ksymbol = parser.ParseSymbol( origin, *c_para, topDoc.shape );
277
278 // Clear reference numbers
279 SCH_FIELD& refField = ksymbol->GetReferenceField();
280 wxString origRef = refField.GetText();
281 wxString reference;
282
283 for( size_t i = 0; i < origRef.size() && !wxIsdigit( origRef[i] ); i++ )
284 reference << origRef[i];
285
286 refField.SetText( reference );
287
288 return ksymbol;
289 }
290 }
291 catch( nlohmann::json::exception& e )
292 {
293 THROW_IO_ERROR( wxString::Format( _( "Error loading symbol '%s' from library '%s': %s" ),
294 aAliasName, aLibraryPath, e.what() ) );
295 }
296 catch( std::exception& e )
297 {
298 THROW_IO_ERROR( wxString::Format( _( "Error loading symbol '%s' from library '%s': %s" ),
299 aAliasName, aLibraryPath, e.what() ) );
300 }
301
302 return nullptr;
303}
304
305
306void SCH_IO_EASYEDA::EnumerateSymbolLib( wxArrayString& aSymbolNameList,
307 const wxString& aLibraryPath,
308 const std::map<std::string, UTF8>* aProperties )
309{
310 std::map<wxString, int> namesCounter;
311
312 // Suppress font substitution warnings
314
315 try
316 {
317 wxFFileInputStream in( aLibraryPath );
318 nlohmann::json js;
319 EASYEDA::DOCUMENT topDoc;
320 EASYEDA::DOC_TYPE topDocType;
321
322 if( !FindSchFileInStream( aLibraryPath, in, js, topDoc, topDocType ) )
323 {
324 THROW_IO_ERROR( wxString::Format( _( "Unable to find a valid schematic file in '%s'" ),
325 aLibraryPath ) );
326 }
327
328 if( topDocType == EASYEDA::DOC_TYPE::SCHEMATIC_SHEET
329 || topDocType == EASYEDA::DOC_TYPE::SCHEMATIC_LIST )
330 {
332
333 for( const EASYEDA::DOCUMENT& subDoc : *schDoc.schematics )
334 {
335 if( subDoc.docType )
336 {
338 continue;
339 }
340 else
341 {
343 continue;
344 }
345
346 EASYEDA::DOCUMENT dataStrDoc = subDoc.dataStr->get<EASYEDA::DOCUMENT>();
347
348 for( wxString shap : dataStrDoc.shape )
349 {
350 if( !shap.Contains( wxS( "LIB" ) ) )
351 continue;
352
353 shap.Replace( wxS( "#@$" ), wxS( "\n" ) );
354 wxArrayString parts = wxSplit( shap, '\n', '\0' );
355
356 if( parts.size() < 1 )
357 continue;
358
359 wxArrayString paramsRoot = wxSplit( parts[0], '~', '\0' );
360
361 if( paramsRoot.size() < 1 )
362 continue;
363
364 wxString rootType = paramsRoot[0];
365
366 if( rootType == wxS( "LIB" ) )
367 {
368 if( paramsRoot.size() < 4 )
369 continue;
370
371 wxString symbolName = wxString::Format( wxS( "Unknown_%s_%s" ),
372 paramsRoot[1], paramsRoot[2] );
373
374 wxArrayString paramParts = wxSplit( paramsRoot[3], '`', '\0' );
375
376 std::map<wxString, wxString> paramMap;
377
378 for( size_t i = 1; i < paramParts.size(); i += 2 )
379 {
380 wxString key = paramParts[i - 1];
381 wxString value = paramParts[i];
382
383 if( key == wxS( "spiceSymbolName" ) && !value.IsEmpty() )
384 symbolName = value;
385
386 paramMap[key] = value;
387 }
388
389 int& serial = namesCounter[symbolName];
390
391 if( serial > 0 )
392 symbolName << wxS( "_" ) << serial;
393
394 serial++;
395
396 aSymbolNameList.Add( symbolName );
397 }
398 }
399 }
400 }
401 else if( topDocType == EASYEDA::DOC_TYPE::SYMBOL )
402 {
404
405 wxString packageName = wxS( "Unknown" );
406
407 if( symDoc.c_para )
408 {
409 packageName = get_def( *symDoc.c_para, wxS( "name" ), packageName );
410 }
411 else if( topDoc.head.c_para )
412 {
413 packageName = get_def( *topDoc.head.c_para, wxS( "name" ), packageName );
414 }
415
416 aSymbolNameList.Add( packageName );
417 }
418 }
419 catch( nlohmann::json::exception& e )
420 {
421 THROW_IO_ERROR( wxString::Format( _( "Error enumerating symbol library '%s': %s" ),
422 aLibraryPath, e.what() ) );
423 }
424 catch( std::exception& e )
425 {
426 THROW_IO_ERROR( wxString::Format( _( "Error enumerating symbol library '%s': %s" ),
427 aLibraryPath, e.what() ) );
428 }
429}
430
431
432void SCH_IO_EASYEDA::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
433 const wxString& aLibraryPath,
434 const std::map<std::string, UTF8>* aProperties )
435{
436 wxFFileInputStream in( aLibraryPath );
437 nlohmann::json js;
438 EASYEDA::DOCUMENT topDoc;
439 EASYEDA::DOC_TYPE topDocType;
440
441 if( !FindSchFileInStream( aLibraryPath, in, js, topDoc, topDocType ) )
442 {
443 THROW_IO_ERROR( wxString::Format( _( "Unable to find a valid schematic file in '%s'" ),
444 aLibraryPath ) );
445 }
446
447 try
448 {
449 wxArrayString symbolNameList;
450
451 EnumerateSymbolLib( symbolNameList, aLibraryPath, aProperties );
452
453 for( const wxString& symbolName : symbolNameList )
454 {
455 LIB_SYMBOL* sym = loadSymbol( aLibraryPath, js, symbolName, aProperties );
456
457 if( sym )
458 aSymbolList.push_back( sym );
459 }
460 }
461 catch( nlohmann::json::exception& e )
462 {
463 THROW_IO_ERROR( wxString::Format( _( "Error enumerating symbol library '%s': %s" ),
464 aLibraryPath, e.what() ) );
465 }
466 catch( std::exception& e )
467 {
468 THROW_IO_ERROR( wxString::Format( _( "Error enumerating symbol library '%s': %s" ),
469 aLibraryPath, e.what() ) );
470 }
471}
472
473
474LIB_SYMBOL* SCH_IO_EASYEDA::LoadSymbol( const wxString& aLibraryPath,
475 const wxString& aAliasName,
476 const std::map<std::string, UTF8>* aProperties )
477{
478 try
479 {
480 wxFFileInputStream in( aLibraryPath );
481 nlohmann::json js;
482 EASYEDA::DOCUMENT topDoc;
483 EASYEDA::DOC_TYPE topDocType;
484
485 if( !FindSchFileInStream( aLibraryPath, in, js, topDoc, topDocType ) )
486 {
487 THROW_IO_ERROR( wxString::Format( _( "Unable to find a valid schematic file in '%s'" ),
488 aLibraryPath ) );
489 }
490
491 return loadSymbol( aLibraryPath, js, aAliasName, aProperties );
492 }
493 catch( nlohmann::json::exception& e )
494 {
495 THROW_IO_ERROR( wxString::Format( _( "Error loading symbol '%s' from library '%s': %s" ),
496 aAliasName, aLibraryPath, e.what() ) );
497 }
498 catch( std::exception& e )
499 {
500 THROW_IO_ERROR( wxString::Format( _( "Error loading symbol '%s' from library '%s': %s" ),
501 aAliasName, aLibraryPath, e.what() ) );
502 }
503
504 return nullptr;
505}
506
507
508static void LoadSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aRootSheet, const wxString& aFileName )
509{
510 SCH_EASYEDA_PARSER parser( nullptr, nullptr );
511
512 try
513 {
514 wxFFileInputStream in( aFileName );
515 nlohmann::json js;
516 EASYEDA::DOCUMENT topDoc;
517 EASYEDA::DOC_TYPE topDocType;
518
519 if( !FindSchFileInStream( aFileName, in, js, topDoc, topDocType ) )
520 {
521 THROW_IO_ERROR( wxString::Format( _( "Unable to find a valid schematic file in '%s'" ),
522 aFileName ) );
523 }
524
525 if( topDocType == EASYEDA::DOC_TYPE::SCHEMATIC_SHEET
526 || topDocType == EASYEDA::DOC_TYPE::SCHEMATIC_LIST )
527 {
528 int pageNum = 1;
530
531 for( const EASYEDA::DOCUMENT& subDoc : *schDoc.schematics )
532 {
533 if( subDoc.docType )
534 {
536 continue;
537 }
538 else
539 {
541 continue;
542 }
543
544 EASYEDA::DOCUMENT dataStrDoc = subDoc.dataStr->get<EASYEDA::DOCUMENT>();
545
546 if( schDoc.schematics->size() > 1 )
547 {
548 wxString sheetTitle =
549 !subDoc.title.empty() ? subDoc.title : ( wxString() << pageNum );
550
551 wxString sheetBaseName = EscapeString( sheetTitle, CTX_FILENAME );
552
553 wxFileName sheetFname( aFileName );
554 sheetFname.SetFullName(
555 sheetBaseName + wxS( "." )
556 + wxString::FromUTF8( FILEEXT::KiCadSchematicFileExtension ) );
557
558 wxFileName relSheetPath( sheetFname );
559 relSheetPath.MakeRelativeTo(
560 wxFileName( aRootSheet->GetFileName() ).GetPath() );
561
562 std::unique_ptr<SCH_SHEET> subSheet = std::make_unique<SCH_SHEET>( aSchematic );
563 subSheet->SetFileName( relSheetPath.GetFullPath() );
564 subSheet->SetName( sheetTitle );
565
566 SCH_SCREEN* screen = new SCH_SCREEN( aSchematic );
567 screen->SetFileName( sheetFname.GetFullPath() );
568 screen->SetPageNumber( wxString() << pageNum );
569 subSheet->SetScreen( screen );
570
571 VECTOR2I pos;
572 pos.x = schIUScale.MilsToIU( 200 );
573 pos.y = schIUScale.MilsToIU( 200 )
574 + ( subSheet->GetSize().y + schIUScale.MilsToIU( 200 ) )
575 * ( pageNum - 1 );
576
577 subSheet->SetPosition( pos );
578
579 SCH_SHEET_PATH sheetPath;
580 sheetPath.push_back( aRootSheet );
581 sheetPath.push_back( subSheet.get() );
582 sheetPath.SetPageNumber( wxString() << pageNum );
583 aSchematic->SetCurrentSheet( sheetPath );
584
585 parser.ParseSchematic( aSchematic, subSheet.get(), aFileName,
586 dataStrDoc.shape );
587
588 aRootSheet->GetScreen()->Append( subSheet.release() );
589 }
590 else
591 {
592 parser.ParseSchematic( aSchematic, aRootSheet, aFileName, dataStrDoc.shape );
593 }
594
595 pageNum++;
596 }
597 }
598 }
599 catch( nlohmann::json::exception& e )
600 {
602 wxString::Format( _( "Error loading schematic '%s': %s" ), aFileName, e.what() ) );
603 }
604 catch( std::exception& e )
605 {
607 wxString::Format( _( "Error loading schematic '%s': %s" ), aFileName, e.what() ) );
608 }
609}
610
611
612SCH_SHEET* SCH_IO_EASYEDA::LoadSchematicFile( const wxString& aFileName, SCHEMATIC* aSchematic,
613 SCH_SHEET* aAppendToMe,
614 const std::map<std::string, UTF8>* aProperties )
615{
616 wxCHECK( !aFileName.IsEmpty() && aSchematic, nullptr );
617
618 // Show the font substitution warnings
620
621 SCH_SHEET* rootSheet = nullptr;
622
623 if( aAppendToMe )
624 {
625 wxCHECK_MSG( aSchematic->IsValid(), nullptr,
626 wxS( "Can't append to a schematic with no root!" ) );
627
628 rootSheet = &aSchematic->Root();
629 }
630 else
631 {
632 rootSheet = new SCH_SHEET( aSchematic );
633 rootSheet->SetFileName( aFileName );
634 aSchematic->SetRoot( rootSheet );
635 }
636
637 if( !rootSheet->GetScreen() )
638 {
639 SCH_SCREEN* screen = new SCH_SCREEN( aSchematic );
640
641 screen->SetFileName( aFileName );
642 rootSheet->SetScreen( screen );
643 }
644
645 SYMBOL_LIB_TABLE* libTable = PROJECT_SCH::SchSymbolLibTable( &aSchematic->Prj() );
646
647 wxCHECK_MSG( libTable, nullptr, wxS( "Could not load symbol lib table." ) );
648 LoadSchematic( aSchematic, rootSheet, aFileName );
650
651 return rootSheet;
652}
const char * name
Definition: DXF_plotter.cpp:57
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:110
void SetPageNumber(const wxString &aPageNumber)
Definition: base_screen.h:79
static double Convert(const wxString &aValue)
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:94
Define a library symbol object.
Definition: lib_symbol.h:78
SCH_FIELD & GetReferenceField() const
Return reference to the reference designator field.
static SYMBOL_LIB_TABLE * SchSymbolLibTable(PROJECT *aProject)
Accessor for project symbol library table.
Holds all the data relating to one schematic.
Definition: schematic.h:77
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:152
void SetCurrentSheet(const SCH_SHEET_PATH &aPath) override
Definition: schematic.h:157
void SetRoot(SCH_SHEET *aRootSheet)
Initialize the schematic with a new root sheet.
Definition: schematic.cpp:194
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
Definition: schematic.h:137
SCH_SHEET & Root() const
Definition: schematic.h:121
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:92
void ParseSchematic(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxString &aFileName, wxArrayString aShapes)
LIB_SYMBOL * ParseSymbol(const VECTOR2D &aOrigin, std::map< wxString, wxString > aParams, wxArrayString aShapes)
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
void SetText(const wxString &aText) override
Definition: sch_field.cpp:1212
bool CanReadLibrary(const wxString &aFileName) const override
Checks if this IO object can read the specified library file/directory.
SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load information from some input file format that this SCH_IO implementation knows about,...
int GetModifyHash() const override
Return the modification hash from the library cache.
void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
bool CanReadSchematicFile(const wxString &aFileName) const override
Checks if this SCH_IO can read the specified schematic file.
LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aAliasName, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
virtual bool CanReadSchematicFile(const wxString &aFileName) const
Checks if this SCH_IO can read the specified schematic file.
Definition: sch_io.cpp:45
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Definition: sch_screen.cpp:153
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
Definition: sch_screen.cpp:118
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
void push_back(SCH_SHEET *aSheet)
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
void SetFileName(const wxString &aFilename)
Definition: sch_sheet.h:312
wxString GetFileName() const
Return the filename corresponding to this sheet.
Definition: sch_sheet.h:306
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:110
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:173
static REPORTER & GetInstance()
Definition: reporter.cpp:199
static void SetReporter(REPORTER *aReporter)
Set the reporter to use for reporting font substitution warnings.
Definition: fontconfig.cpp:64
#define _(s)
static const std::string KiCadSchematicFileExtension
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:39
wxString get_def(const std::map< wxString, wxString > &aMap, const char *aKey, const char *aDefval="")
Definition: map_helpers.h:64
static void LoadSchematic(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxString &aFileName)
LIB_SYMBOL * loadSymbol(const wxString &aLibraryPath, nlohmann::json aFileData, const wxString &aAliasName, const std::map< std::string, UTF8 > *aProperties)
static bool FindSchFileInStream(const wxString &aName, wxInputStream &aStream, nlohmann::json &aOut, EASYEDA::DOCUMENT &aDoc, EASYEDA::DOC_TYPE &aDocType)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_FILENAME
Definition: string_utils.h:61
std::optional< std::vector< DOCUMENT > > schematics
std::optional< std::map< wxString, wxString > > c_para
std::optional< nlohmann::json > dataStr
std::optional< DOC_TYPE > docType
std::optional< std::map< wxString, wxString > > c_para
constexpr int MilsToIU(int mils) const
Definition: base_units.h:93
Definition of file extensions used in Kicad.