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