KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SCH_IO_GEDA Class Reference

A SCH_IO derivation for loading gEDA/gschem schematic files (.sch). More...

#include <sch_io_geda.h>

Inheritance diagram for SCH_IO_GEDA:
SCH_IO IO_BASE

Classes

struct  BUS_SEGMENT
 Parsed bus segment in KiCad coordinates with gEDA ripper direction. More...
 
struct  DEFERRED_SHEET
 Deferred hierarchical sheet loads. More...
 
struct  GEDA_ATTR
 Parsed attribute from a gEDA T line inside a { } block. More...
 
struct  NET_ATTR_RECORD
 Components with net= attributes that need post-processing. More...
 
struct  PENDING_COMPONENT
 Pending component waiting for symbol resolution. More...
 
struct  SYM_CACHE_ENTRY
 Entry in the symbol library search cache. More...
 

Public Member Functions

 SCH_IO_GEDA ()
 
 ~SCH_IO_GEDA () override
 
const IO_BASE::IO_FILE_DESC GetSchematicFileDesc () const override
 Returns schematic file description for the SCH_IO.
 
const IO_BASE::IO_FILE_DESC GetLibraryDesc () const override
 Get the descriptor for the library container that this IO plugin operates on.
 
bool CanReadSchematicFile (const wxString &aFileName) const override
 Checks if this SCH_IO can read the specified schematic file.
 
int GetModifyHash () const override
 Return the modification hash from the library cache.
 
SCH_SHEETLoadSchematicFile (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, into either a new SCH_SHEET or an existing one.
 
bool IsLibraryWritable (const wxString &aLibraryPath) override
 Return true if the library at aLibraryPath is writable.
 
virtual void SaveLibrary (const wxString &aFileName, const std::map< std::string, UTF8 > *aProperties=nullptr)
 
virtual void SaveSchematicFile (const wxString &aFileName, SCH_SHEET *aSheet, SCHEMATIC *aSchematic, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Write aSchematic to a storage file in a format that this SCH_IO implementation knows about, or it can be used to write a portion of aSchematic to a special kind of export file.
 
virtual void EnumerateSymbolLib (wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
 
virtual void EnumerateSymbolLib (std::vector< LIB_SYMBOL * > &aSymbolList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Populate a list of LIB_SYMBOL aliases contained within the library aLibraryPath.
 
virtual LIB_SYMBOLLoadSymbol (const wxString &aLibraryPath, const wxString &aPartName, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this SCH_IO knows about.
 
virtual void SaveSymbol (const wxString &aLibraryPath, const LIB_SYMBOL *aSymbol, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Write aSymbol to an existing library located at aLibraryPath.
 
virtual void DeleteSymbol (const wxString &aLibraryPath, const wxString &aSymbolName, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.
 
virtual void GetLibraryOptions (std::map< std::string, UTF8 > *aListToAppendTo) const override
 Append supported SCH_IO options to aListToAppenTo along with internationalized descriptions.
 
virtual bool SupportsSubLibraries () const
 
virtual void GetSubLibraryNames (std::vector< wxString > &aNames)
 Retrieves a list of sub-libraries in this library.
 
virtual wxString GetSubLibraryDescription (const wxString &aName)
 Gets a description of a sublibrary.
 
virtual void GetAvailableSymbolFields (std::vector< wxString > &aNames)
 Retrieves a list of (custom) field names that are present on symbols in this library.
 
virtual void GetDefaultSymbolFields (std::vector< wxString > &aNames)
 Retrieves a list of (custom) field names that should be shown by default for this library in the symbol chooser.
 
virtual const wxString & GetError () const
 Return an error string to the caller.
 
virtual void SetLibraryManagerAdapter (SYMBOL_LIBRARY_ADAPTER *aAdapter)
 Some library plugins need to interface with other loaded libraries.
 
const wxString & GetName () const
 Return a brief hard coded name for this IO interface.
 
virtual bool IsPCB_IO () const
 Work-around for lack of dynamic_cast across compile units on Mac.
 
virtual void SetReporter (REPORTER *aReporter)
 Set an optional reporter for warnings/errors.
 
virtual void SetProgressReporter (PROGRESS_REPORTER *aReporter)
 Set an optional progress reporter.
 
virtual const IO_FILE_DESC GetLibraryFileDesc () const
 Get the descriptor for the individual library elements that this IO plugin operates on.
 
virtual bool CanReadLibrary (const wxString &aFileName) const
 Checks if this IO object can read the specified library file/directory.
 
virtual void CreateLibrary (const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Create a new empty library at aLibraryPath empty.
 
virtual bool DeleteLibrary (const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Delete an existing library and returns true, or if library does not exist returns false, or throws an exception if library exists but is read only or cannot be deleted for some other reason.
 
virtual bool SupportsConfigurationDialog () const
 
virtual DIALOG_SHIMCreateConfigurationDialog (wxWindow *aParent)
 
virtual void Report (const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
 
virtual void AdvanceProgressPhase ()
 

Static Public Member Functions

static const std::map< wxString, wxString > & getBuiltinSymbols ()
 Return the map of built-in gEDA symbol definitions (symbol name -> .sym content).
 

Protected Attributes

wxString m_name
 Name of the IO loader.
 
REPORTERm_reporter
 Reporter to log errors/warnings to, may be nullptr.
 
PROGRESS_REPORTERm_progressReporter
 Progress reporter to track the progress of the operation, may be nullptr.
 

Private Member Functions

int toKiCadDist (int aMils) const
 Convert a gEDA distance in mils to KiCad IU.
 
VECTOR2I toKiCad (int aGedaX, int aGedaY) const
 Apply the Y-flip and scale to transform gEDA coords to KiCad.
 
bool parseVersionLine (const wxString &aLine)
 Parse the "v YYYYMMDD N" version line and validate.
 
std::vector< GEDA_ATTRparseAttributes (wxTextFile &aFile, size_t &aLineIdx)
 Read a { } attribute block starting after the '{' line.
 
wxString findAttr (const std::vector< GEDA_ATTR > &aAttrs, const wxString &aName) const
 Find an attribute by name, returns empty string if not found.
 
const GEDA_ATTRfindAttrStruct (const std::vector< GEDA_ATTR > &aAttrs, const wxString &aName) const
 Find a GEDA_ATTR struct by name, returns nullptr if not found.
 
std::vector< GEDA_ATTRmaybeParseAttributes (wxTextFile &aFile, size_t &aLineIdx)
 Check for and consume a { } attribute block at the current line position.
 
void parseComponent (const wxString &aLine, wxTextFile &aFile, size_t &aLineIdx)
 
void parseNet (const wxString &aLine, wxTextFile &aFile, size_t &aLineIdx)
 
void parseBus (const wxString &aLine, wxTextFile &aFile, size_t &aLineIdx)
 
void parseText (const wxString &aLine, wxTextFile &aFile, size_t &aLineIdx)
 
void parseLine (const wxString &aLine, wxTextFile &aFile, size_t &aLineIdx)
 
void parseBox (const wxString &aLine, wxTextFile &aFile, size_t &aLineIdx)
 
void parseCircle (const wxString &aLine, wxTextFile &aFile, size_t &aLineIdx)
 
void parseArc (const wxString &aLine, wxTextFile &aFile, size_t &aLineIdx)
 
void parsePath (const wxString &aLine, wxTextFile &aFile, size_t &aLineIdx)
 
void parsePicture (const wxString &aLine, wxTextFile &aFile, size_t &aLineIdx)
 
void parsePin (const wxString &aLine, wxTextFile &aFile, size_t &aLineIdx)
 
void parseEmbeddedComponent (wxTextFile &aFile, size_t &aLineIdx)
 
void initSymbolLibrary ()
 Ensure the symbol library hash is built by scanning gEDA library dirs.
 
void scanSymbolDir (const wxString &aDir, int aDepth=0)
 Recursively scan a directory for .sym files and populate m_symLibrary.
 
void parseRcFileForLibraries (const wxString &aPath, const wxString &aBaseDir)
 Parse an RC file (gafrc or gschemrc) for component-library directives.
 
std::unique_ptr< LIB_SYMBOLloadSymbolFile (const wxString &aPath, wxString *aSymversion=nullptr, wxString *aNetAttr=nullptr)
 Load a .sym file and return a LIB_SYMBOL.
 
void parseSymbolObjects (wxTextFile &aFile, size_t &aLineIdx, LIB_SYMBOL &aSymbol, size_t aEndLine)
 Parse objects from a .sym file or [] block into a LIB_SYMBOL.
 
void addSymbolPin (LIB_SYMBOL &aSymbol, int aX1, int aY1, int aX2, int aY2, int aWhichEnd, const std::vector< GEDA_ATTR > &aAttrs)
 Create a pin on a LIB_SYMBOL from gEDA P line data and its attributes.
 
void addSymbolGraphic (LIB_SYMBOL &aSymbol, const wxString &aLine, wxTextFile &aFile, size_t &aLineIdx, wxChar aType)
 Add a graphical item (line/box/circle/arc/path) to a LIB_SYMBOL.
 
void flushPendingComponent ()
 Instantiate the pending component: look up or load the symbol, create SCH_SYMBOL, apply transforms and attributes, and emit to screen.
 
void importHierarchicalSheet (const wxString &aSourceFile)
 Import a gEDA hierarchical sub-schematic as a KiCad SCH_SHEET.
 
LIB_SYMBOLgetOrLoadSymbol (const wxString &aBasename)
 Get or load a cached symbol by gEDA basename.
 
std::unique_ptr< LIB_SYMBOLloadBuiltinSymbol (const wxString &aBasename)
 Try loading a symbol from the built-in standard library embedded in the importer.
 
std::unique_ptr< LIB_SYMBOLcreateFallbackSymbol (const wxString &aBasename)
 Create a fallback rectangular symbol when the .sym file is not found.
 
int toKiCadOrientation (int aAngle, int aMirror) const
 Map gEDA angle (0/90/180/270) + mirror to KiCad symbol orientation.
 
wxString getLibName () const
 Derive the KiCad import library name from the schematic file.
 
void trackEndpoint (int aGedaX, int aGedaY)
 Track a point as a net or pin endpoint for junction detection.
 
void postProcess ()
 Run the full post-processing pipeline after parsing is complete:
 
void processNetAttributes ()
 For each component with net= attributes, create global labels at pin positions.
 
void addJunctions ()
 Place junctions where 3+ net/pin endpoints coincide.
 
void addBusEntries ()
 Create SCH_BUS_WIRE_ENTRY objects where net endpoints touch bus segments.
 
void loadDeferredSheets ()
 Load sub-schematics for any SCH_SHEET objects created during parsing.
 
void fitPageToContent ()
 Enlarge the page if needed and center all content on the sheet.
 

Static Private Member Functions

static LINE_STYLE toLineStyle (int aDashStyle)
 Map gEDA dashstyle (0-4) to KiCad LINE_STYLE.
 
static FILL_T toFillType (int aFillType)
 Map gEDA filltype (0-4) to KiCad FILL_T.
 

Private Attributes

SCH_SCREENm_screen
 
SCH_SHEETm_rootSheet
 
SCHEMATICm_schematic
 
wxFileName m_filename
 
int m_maxY
 The maximum Y coordinate seen during parsing (gEDA coords, before flip).
 
long m_releaseVersion
 gEDA file version fields from the "v YYYYMMDD N" header line.
 
long m_fileFormatVersion
 
std::unique_ptr< PENDING_COMPONENTm_pendingComp
 Pending component awaiting symbol resolution.
 
std::map< wxString, SYM_CACHE_ENTRYm_symLibrary
 Symbol library cache: gEDA basename -> cache entry.
 
bool m_symLibraryInitialized
 
std::map< wxString, std::unique_ptr< LIB_SYMBOL > > m_libSymbols
 Loaded symbols for this import session, keyed by basename.
 
int m_powerCounter
 Sequential counter for auto-generated #PWR references.
 
std::map< std::pair< int, int >, int > m_netEndpoints
 Net endpoint positions in raw gEDA coordinates for junction detection.
 
std::vector< NET_ATTR_RECORDm_netAttrRecords
 
std::vector< BUS_SEGMENTm_busSegments
 
std::vector< DEFERRED_SHEETm_deferredSheets
 
std::set< wxString > m_importStack
 Set of fully-resolved file paths currently in the import call stack, used to detect and prevent circular hierarchy references.
 
const std::map< std::string, UTF8 > * m_properties
 Properties passed from the import framework (search paths, etc.)
 

Static Private Attributes

static constexpr int MILS_TO_IU = 254
 gEDA coordinates are mils with Y-up.
 

Detailed Description

A SCH_IO derivation for loading gEDA/gschem schematic files (.sch).

gEDA schematics are ASCII text files with a simple line-oriented format. Each object type is identified by the first character of its definition line: C=component, N=net, U=bus, P=pin, T=text, L=line, B=box, V=circle, A=arc, H=path, G=picture, {=attributes, [=embedded component.

Symbol loading follows the sch-rnd model: .sym files are discovered by scanning standard gEDA library directories and loaded on first reference. Embedded symbols (defined inline via [] blocks) are also supported.

Definition at line 73 of file sch_io_geda.h.

Constructor & Destructor Documentation

◆ SCH_IO_GEDA()

◆ ~SCH_IO_GEDA()

SCH_IO_GEDA::~SCH_IO_GEDA ( )
overridedefault

Member Function Documentation

◆ addBusEntries()

void SCH_IO_GEDA::addBusEntries ( )
private

◆ addJunctions()

void SCH_IO_GEDA::addJunctions ( )
private

Place junctions where 3+ net/pin endpoints coincide.

Definition at line 4223 of file sch_io_geda.cpp.

References SCH_LINE::GetEndPoint(), SCH_ITEM::GetLayer(), SCH_LINE::GetStartPoint(), LAYER_WIRE, m_netEndpoints, m_screen, SCH_LINE_T, toKiCad(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by postProcess().

◆ addSymbolGraphic()

◆ addSymbolPin()

void SCH_IO_GEDA::addSymbolPin ( LIB_SYMBOL & aSymbol,
int aX1,
int aY1,
int aX2,
int aY2,
int aWhichEnd,
const std::vector< GEDA_ATTR > & aAttrs )
private

◆ AdvanceProgressPhase()

void IO_BASE::AdvanceProgressPhase ( )
virtualinherited

Definition at line 133 of file io_base.cpp.

References _, m_progressReporter, and THROW_IO_ERROR.

◆ CanReadLibrary()

◆ CanReadSchematicFile()

bool SCH_IO_GEDA::CanReadSchematicFile ( const wxString & aFileName) const
overridevirtual

Checks if this SCH_IO can read the specified schematic file.

If not overriden, extension check is used.

Reimplemented from SCH_IO.

Definition at line 1493 of file sch_io_geda.cpp.

◆ CreateConfigurationDialog()

virtual DIALOG_SHIM * IO_BASE::CreateConfigurationDialog ( wxWindow * aParent)
inlinevirtualinherited
Returns
a new instance of dialog that configures this plugin, or nullptr if this plugin does not support a configuration dialog. Caller takes ownership.

Reimplemented in SCH_IO_DATABASE.

Definition at line 213 of file io_base.h.

◆ createFallbackSymbol()

std::unique_ptr< LIB_SYMBOL > SCH_IO_GEDA::createFallbackSymbol ( const wxString & aBasename)
private

Create a fallback rectangular symbol when the .sym file is not found.

Definition at line 3659 of file sch_io_geda.cpp.

References DEFAULT, DEFAULT_SYMBOL_SIZE_MILS, LAYER_DEVICE, RECTANGLE, EDA_SHAPE::SetEnd(), EDA_SHAPE::SetStart(), SCH_SHAPE::SetStroke(), and toKiCadDist().

Referenced by getOrLoadSymbol().

◆ CreateLibrary()

void IO_BASE::CreateLibrary ( const wxString & aLibraryPath,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Create a new empty library at aLibraryPath empty.

It is an error to attempt to create an existing library or to attempt to create on a "read only" location.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several elements.
aPropertiesis an associative array that can be used to tell the library create function anything special, because it can take any number of additional named tuning arguments that the IO is known to support. The caller continues to own this object (IO may not delete it), and IOs should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem finding the library, or creating it.

Reimplemented in DESIGN_BLOCK_IO, PCB_IO_KICAD_SEXPR, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 46 of file io_base.cpp.

References NOT_IMPLEMENTED.

Referenced by LIBRARY_MANAGER_ADAPTER::CreateLibrary().

◆ DeleteLibrary()

bool IO_BASE::DeleteLibrary ( const wxString & aLibraryPath,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Delete an existing library and returns true, or if library does not exist returns false, or throws an exception if library exists but is read only or cannot be deleted for some other reason.

Parameters
aLibraryPathis a locator for the "library", usually a directory or file which will contain several elements.
aPropertiesis an associative array that can be used to tell the library delete implementation function anything special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Returns
true if library deleted, false if library did not exist.
Exceptions
IO_ERRORif there is a problem deleting an existing library.

Reimplemented in DESIGN_BLOCK_IO, PCB_IO_GEDA, PCB_IO_KICAD_LEGACY, PCB_IO_KICAD_SEXPR, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 53 of file io_base.cpp.

References NOT_IMPLEMENTED.

Referenced by LIBRARY_MANAGER_ADAPTER::DeleteLibrary().

◆ DeleteSymbol()

void SCH_IO::DeleteSymbol ( const wxString & aLibraryPath,
const wxString & aSymbolName,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several symbols.
aSymbolNameis the name of a LIB_SYMBOL associated with it's root LIB_SYMBOL object to delete from the specified library.
aPropertiesis an associative array that can be used to tell the library delete function anything special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem finding the alias or the library or deleting it.

Reimplemented in SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 116 of file sch_io.cpp.

References NOT_IMPLEMENTED.

Referenced by LIB_BUFFER::SaveBuffer().

◆ EnumerateSymbolLib() [1/2]

void SCH_IO::EnumerateSymbolLib ( std::vector< LIB_SYMBOL * > & aSymbolList,
const wxString & aLibraryPath,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Populate a list of LIB_SYMBOL aliases contained within the library aLibraryPath.

Note
It is the responsibility of the caller to delete the returned object from the heap. Failure to do this will result in memory leaks.
Parameters
aSymbolListis an array to populate with the LIB_SYMBOL pointers associated with the library.
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing one or more LIB_SYMBOL objects.
aPropertiesis an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif the library cannot be found, the part library cannot be loaded.

Reimplemented in SCH_IO_ALTIUM, SCH_IO_CADSTAR_ARCHIVE, SCH_IO_DATABASE, SCH_IO_EAGLE, SCH_IO_EASYEDA, SCH_IO_EASYEDAPRO, SCH_IO_HTTP_LIB, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 91 of file sch_io.cpp.

References NOT_IMPLEMENTED.

◆ EnumerateSymbolLib() [2/2]

void SCH_IO::EnumerateSymbolLib ( wxArrayString & aSymbolNameList,
const wxString & aLibraryPath,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.

Parameters
aSymbolNameListis an array to populate with the LIB_SYMBOL names associated with the library.
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing one or more LIB_SYMBOL objects.
aPropertiesis an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif the library cannot be found, the part library cannot be loaded.

Reimplemented in SCH_IO_ALTIUM, SCH_IO_CADSTAR_ARCHIVE, SCH_IO_DATABASE, SCH_IO_EAGLE, SCH_IO_EASYEDA, SCH_IO_EASYEDAPRO, SCH_IO_HTTP_LIB, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 82 of file sch_io.cpp.

References NOT_IMPLEMENTED.

Referenced by SYMBOL_LIBRARY_ADAPTER::enumerateLibrary(), SYMBOL_LIBRARY_ADAPTER::GetSymbolNames(), SYMBOL_LIBRARY_ADAPTER::GetSymbols(), and SYMBOL_LIBRARY_ADAPTER::LoadOne().

◆ findAttr()

wxString SCH_IO_GEDA::findAttr ( const std::vector< GEDA_ATTR > & aAttrs,
const wxString & aName ) const
private

Find an attribute by name, returns empty string if not found.

Definition at line 1664 of file sch_io_geda.cpp.

Referenced by addSymbolPin(), flushPendingComponent(), importHierarchicalSheet(), parseNet(), and parsePin().

◆ findAttrStruct()

const SCH_IO_GEDA::GEDA_ATTR * SCH_IO_GEDA::findAttrStruct ( const std::vector< GEDA_ATTR > & aAttrs,
const wxString & aName ) const
private

Find a GEDA_ATTR struct by name, returns nullptr if not found.

Definition at line 1677 of file sch_io_geda.cpp.

Referenced by flushPendingComponent().

◆ fitPageToContent()

void SCH_IO_GEDA::fitPageToContent ( )
private

◆ flushPendingComponent()

◆ GetAvailableSymbolFields()

virtual void SCH_IO::GetAvailableSymbolFields ( std::vector< wxString > & aNames)
inlinevirtualinherited

Retrieves a list of (custom) field names that are present on symbols in this library.

The plugin is responsible for guaranteeing that this list contains the set of unique custom field names present on any symbols contained in the library.

The required KiCad fields are not included in this list.

Parameters
aNameswill be filled with any custom fields present in this library.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE, SCH_IO_DATABASE, SCH_IO_HTTP_LIB, and SCH_IO_KICAD_SEXPR.

Definition at line 326 of file sch_io.h.

Referenced by SYMBOL_LIBRARY_ADAPTER::GetAvailableExtraFields(), and GetDefaultSymbolFields().

◆ getBuiltinSymbols()

const std::map< wxString, wxString > & SCH_IO_GEDA::getBuiltinSymbols ( )
static

Return the map of built-in gEDA symbol definitions (symbol name -> .sym content).

Definition at line 135 of file sch_io_geda.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), getOrLoadSymbol(), and loadBuiltinSymbol().

◆ GetDefaultSymbolFields()

virtual void SCH_IO::GetDefaultSymbolFields ( std::vector< wxString > & aNames)
inlinevirtualinherited

Retrieves a list of (custom) field names that should be shown by default for this library in the symbol chooser.

This list should be a subset of the result returned by GetAvailableSymbolFields().

The preference for which fields to hide and show for a given library is stored on a per-library basis in a user's preferences (or in the project local settings for a project- local library). The set of fields returned by GetDefaultSymbolFields() will be used if this preference is missing.

Parameters
aNameswill be filled with the custom field names that should be shown by default

Reimplemented in SCH_IO_DATABASE, SCH_IO_HTTP_LIB, and SCH_IO_KICAD_SEXPR.

Definition at line 340 of file sch_io.h.

References GetAvailableSymbolFields().

◆ GetError()

const wxString & SCH_IO::GetError ( ) const
virtualinherited

Return an error string to the caller.

This is useful for schematic loaders that can load partial schematics where throwing an exception would be problematic such as the KiCad legacy plugin.

Returns
an unformatted string containing errors if any.

Reimplemented in SCH_IO_HTTP_LIB, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 139 of file sch_io.cpp.

References NOT_IMPLEMENTED.

◆ getLibName()

wxString SCH_IO_GEDA::getLibName ( ) const
private

Derive the KiCad import library name from the schematic file.

Definition at line 1756 of file sch_io_geda.cpp.

References LIB_ID::FixIllegalChars(), m_filename, m_schematic, and UTF8::wx_str().

Referenced by flushPendingComponent().

◆ GetLibraryDesc()

const IO_BASE::IO_FILE_DESC SCH_IO_GEDA::GetLibraryDesc ( ) const
inlineoverridevirtual

Get the descriptor for the library container that this IO plugin operates on.

Returns
File descriptor for the container of the library elements

Implements IO_BASE.

Definition at line 84 of file sch_io_geda.h.

◆ GetLibraryFileDesc()

virtual const IO_FILE_DESC IO_BASE::GetLibraryFileDesc ( ) const
inlinevirtualinherited

Get the descriptor for the individual library elements that this IO plugin operates on.

For libraries where all the elements are in a single container (e.g. all elements in a single file), then this will return the descriptor from IO_BASE::GetLibraryDesc().

Returns
File descriptor for the library elements

Reimplemented in PCB_IO_EASYEDA, PCB_IO_EASYEDAPRO, PCB_IO_GEDA, and PCB_IO_KICAD_SEXPR.

Definition at line 117 of file io_base.h.

References GetLibraryDesc().

Referenced by PCB_IO::CanReadFootprint().

◆ GetLibraryOptions()

void SCH_IO::GetLibraryOptions ( std::map< std::string, UTF8 > * aListToAppendTo) const
overridevirtualinherited

Append supported SCH_IO options to aListToAppenTo along with internationalized descriptions.

Options are typically appended so that a derived SCH_IO can call its base class function by the same name first, thus inheriting options declared there. (Some base class options could pertain to all Symbol*() functions in all derived SCH_IOs.) Note that since aListToAppendTo is a PROPERTIES object, all options will be unique and last guy wins.

Parameters
aListToAppendToholds a tuple of
option
This eventually is what shows up into the fp-lib-table "options" field, possibly combined with others.
internationalized description
The internationalized description is displayed in DIALOG_PLUGIN_OPTIONS. It may be multi-line and be quite explanatory of the option.

In the future perhaps aListToAppendTo evolves to something capable of also holding a wxValidator for the cells in said dialog: http://forums.wxwidgets.org/viewtopic.php?t=23277&p=104180. This would require a 3 column list, and introducing wx GUI knowledge to SCH_IO, which has been avoided to date.

Reimplemented from IO_BASE.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE.

Definition at line 124 of file sch_io.cpp.

References IO_BASE::GetLibraryOptions().

◆ GetModifyHash()

int SCH_IO_GEDA::GetModifyHash ( ) const
inlineoverridevirtual

Return the modification hash from the library cache.

Note
This is temporary until the new s-expr file format is implement. The new file format will embed symbols instead of referencing them from the library. This function can be removed when the new file format is implemented.
Returns
the modification hash of the library cache.

Implements SCH_IO.

Definition at line 91 of file sch_io_geda.h.

◆ GetName()

const wxString & IO_BASE::GetName ( ) const
inlineinherited

Return a brief hard coded name for this IO interface.

Definition at line 79 of file io_base.h.

References m_name.

Referenced by SCH_IO_ALTIUM::ParseLibFile().

◆ getOrLoadSymbol()

LIB_SYMBOL * SCH_IO_GEDA::getOrLoadSymbol ( const wxString & aBasename)
private

◆ GetSchematicFileDesc()

const IO_BASE::IO_FILE_DESC SCH_IO_GEDA::GetSchematicFileDesc ( ) const
inlineoverridevirtual

Returns schematic file description for the SCH_IO.

Reimplemented from SCH_IO.

Definition at line 79 of file sch_io_geda.h.

References _HKI.

◆ GetSubLibraryDescription()

virtual wxString SCH_IO::GetSubLibraryDescription ( const wxString & aName)
inlinevirtualinherited

Gets a description of a sublibrary.

Has no effect if SupportsSubLibraries() returns false.

Parameters
aNamecontains the name of the sublibrary for which the description is retrieved
Returns
the description of the sublibrary

Reimplemented in SCH_IO_HTTP_LIB.

Definition at line 315 of file sch_io.h.

Referenced by SYMBOL_LIBRARY_ADAPTER::GetSubLibraries().

◆ GetSubLibraryNames()

virtual void SCH_IO::GetSubLibraryNames ( std::vector< wxString > & aNames)
inlinevirtualinherited

Retrieves a list of sub-libraries in this library.

Some types of symbol library support sub-libraries, which are a single-level organizational hierarchy that is implementation-defined per plugin. Most of KiCad ignores sub-libraries and treats the hierarchy between library and symbol as flat, but the sub-libraries are used for sorting and grouping symbols in the symbol chooser.

Has no effect if SupportsSubLibraries() returns false.

Parameters
aNameswill be filled with a list of sub-libraries within this symbol library

Reimplemented in SCH_IO_DATABASE, and SCH_IO_HTTP_LIB.

Definition at line 304 of file sch_io.h.

Referenced by SYMBOL_LIBRARY_ADAPTER::GetSubLibraries().

◆ importHierarchicalSheet()

void SCH_IO_GEDA::importHierarchicalSheet ( const wxString & aSourceFile)
private

Import a gEDA hierarchical sub-schematic as a KiCad SCH_SHEET.

Called when a component has a source= attribute.

Definition at line 4073 of file sch_io_geda.cpp.

References _, findAttr(), m_deferredSheets, m_filename, m_importStack, m_pendingComp, IO_BASE::m_reporter, m_rootSheet, m_screen, RPT_SEVERITY_WARNING, schIUScale, SHEET_FILENAME, SHEET_NAME, and toKiCad().

Referenced by flushPendingComponent().

◆ initSymbolLibrary()

void SCH_IO_GEDA::initSymbolLibrary ( )
private

Ensure the symbol library hash is built by scanning gEDA library dirs.

Definition at line 2639 of file sch_io_geda.cpp.

References m_filename, m_properties, m_symLibraryInitialized, parseRcFileForLibraries(), and scanSymbolDir().

Referenced by getOrLoadSymbol().

◆ IsLibraryWritable()

bool SCH_IO_GEDA::IsLibraryWritable ( const wxString & aLibraryPath)
inlineoverridevirtual

Return true if the library at aLibraryPath is writable.

The system libraries are typically read only because of where they are installed..

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
Exceptions
IO_ERRORif no library at aLibraryPath exists.

Reimplemented from IO_BASE.

Definition at line 97 of file sch_io_geda.h.

◆ IsPCB_IO()

virtual bool IO_BASE::IsPCB_IO ( ) const
inlinevirtualinherited

Work-around for lack of dynamic_cast across compile units on Mac.

Reimplemented in PCB_IO.

Definition at line 84 of file io_base.h.

Referenced by FOOTPRINT_LIBRARY_ADAPTER::pcbplugin().

◆ loadBuiltinSymbol()

std::unique_ptr< LIB_SYMBOL > SCH_IO_GEDA::loadBuiltinSymbol ( const wxString & aBasename)
private

Try loading a symbol from the built-in standard library embedded in the importer.

Definition at line 3503 of file sch_io_geda.cpp.

References getBuiltinSymbols(), loadSymbolFile(), m_symLibrary, SCH_IO_GEDA::SYM_CACHE_ENTRY::netAttr, and result.

Referenced by getOrLoadSymbol().

◆ loadDeferredSheets()

◆ LoadSchematicFile()

SCH_SHEET * SCH_IO_GEDA::LoadSchematicFile ( const wxString & aFileName,
SCHEMATIC * aSchematic,
SCH_SHEET * aAppendToMe = nullptr,
const std::map< std::string, UTF8 > * aProperties = nullptr )
overridevirtual

Load information from some input file format that this SCH_IO implementation knows about, into either a new SCH_SHEET or an existing one.

This may be used to load an entire new SCH_SHEET, or to augment an existing one if aAppendToMe is not NULL.

Parameters
aFileNameis the name of the file to use as input and may be foreign in nature or native in nature.
aKiwayis the KIWAY object used to access the symbol libraries loaded by the project.
aAppendToMeis an existing SCH_SHEET to append to, but if NULL then this means "do not append, rather load anew".
aPropertiesis an associative array that can be used to tell the loader how to load the file, because it can take any number of additional named arguments that the plugin is known to support. These are tuning parameters for the import or load. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Returns
the successfully loaded schematic, or the same one as aAppendToMe if aAppendToMe was not NULL, and the caller owns it.
Exceptions
IO_ERRORif there is a problem loading, and its contents should say what went wrong, using line number and character offsets of the input file if possible.

Reimplemented from SCH_IO.

Definition at line 4506 of file sch_io_geda.cpp.

References _, copy, fitPageToContent(), SCH_SCREEN::GetUuid(), SCHEMATIC::IsValid(), LoadSchematicFile(), m_busSegments, m_deferredSheets, m_fileFormatVersion, m_filename, m_libSymbols, m_maxY, m_netAttrRecords, m_netEndpoints, m_pendingComp, m_powerCounter, m_properties, m_releaseVersion, IO_BASE::m_reporter, m_rootSheet, m_schematic, m_screen, m_symLibrary, m_symLibraryInitialized, name, parseArc(), parseBox(), parseBus(), parseCircle(), parseComponent(), parseEmbeddedComponent(), parseLine(), parseNet(), parsePath(), parsePicture(), parsePin(), parseText(), parseVersionLine(), postProcess(), radius, RPT_SEVERITY_WARNING, SCH_IO_GEDA(), schIUScale, SCH_SCREEN::SetFileName(), SCH_SHEET::SetScreen(), SCHEMATIC::SetTopLevelSheets(), SHEET_FILENAME, SHEET_NAME, THROW_IO_ERROR, top(), and IO_ERROR::What().

Referenced by loadDeferredSheets(), and LoadSchematicFile().

◆ LoadSymbol()

LIB_SYMBOL * SCH_IO::LoadSymbol ( const wxString & aLibraryPath,
const wxString & aPartName,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this SCH_IO knows about.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several symbols.
aPartNameis the name of the LIB_SYMBOL to load.
aPropertiesis an associative array that can be used to tell the loader implementation to do something special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Returns
the part created on the heap if found caller shares it or NULL if not found.
Exceptions
IO_ERRORif the library cannot be found or read. No exception is thrown in the case where aAliasName cannot be found.

Reimplemented in SCH_IO_ALTIUM, SCH_IO_CADSTAR_ARCHIVE, SCH_IO_DATABASE, SCH_IO_EAGLE, SCH_IO_EASYEDA, SCH_IO_EASYEDAPRO, SCH_IO_HTTP_LIB, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 100 of file sch_io.cpp.

References NOT_IMPLEMENTED.

Referenced by SYMBOL_LIBRARY_ADAPTER::LoadSymbol(), and LIB_BUFFER::SaveBuffer().

◆ loadSymbolFile()

std::unique_ptr< LIB_SYMBOL > SCH_IO_GEDA::loadSymbolFile ( const wxString & aPath,
wxString * aSymversion = nullptr,
wxString * aNetAttr = nullptr )
private

Load a .sym file and return a LIB_SYMBOL.

Parses the symbol format which is the same as schematic format but contains P/L/A/V/B/T/H objects within a symbol context. If aSymversion is non-null, the symbol's symversion attribute (if present) is written to it. If aNetAttr is non-null, the symbol's net= attribute (if present) is written to it.

Definition at line 2930 of file sch_io_geda.cpp.

References addSymbolGraphic(), addSymbolPin(), and maybeParseAttributes().

Referenced by getOrLoadSymbol(), and loadBuiltinSymbol().

◆ maybeParseAttributes()

std::vector< SCH_IO_GEDA::GEDA_ATTR > SCH_IO_GEDA::maybeParseAttributes ( wxTextFile & aFile,
size_t & aLineIdx )
private

Check for and consume a { } attribute block at the current line position.

Definition at line 1690 of file sch_io_geda.cpp.

References parseAttributes().

Referenced by addSymbolGraphic(), loadSymbolFile(), parseArc(), parseBox(), parseBus(), parseCircle(), parseComponent(), parseEmbeddedComponent(), parseLine(), parseNet(), parsePath(), parsePin(), and parseText().

◆ parseArc()

void SCH_IO_GEDA::parseArc ( const wxString & aLine,
wxTextFile & aFile,
size_t & aLineIdx )
private

◆ parseAttributes()

std::vector< SCH_IO_GEDA::GEDA_ATTR > SCH_IO_GEDA::parseAttributes ( wxTextFile & aFile,
size_t & aLineIdx )
private

◆ parseBox()

void SCH_IO_GEDA::parseBox ( const wxString & aLine,
wxTextFile & aFile,
size_t & aLineIdx )
private

◆ parseBus()

void SCH_IO_GEDA::parseBus ( const wxString & aLine,
wxTextFile & aFile,
size_t & aLineIdx )
private

◆ parseCircle()

void SCH_IO_GEDA::parseCircle ( const wxString & aLine,
wxTextFile & aFile,
size_t & aLineIdx )
private

◆ parseComponent()

void SCH_IO_GEDA::parseComponent ( const wxString & aLine,
wxTextFile & aFile,
size_t & aLineIdx )
private

Definition at line 1779 of file sch_io_geda.cpp.

References flushPendingComponent(), m_pendingComp, and maybeParseAttributes().

Referenced by LoadSchematicFile().

◆ parseEmbeddedComponent()

void SCH_IO_GEDA::parseEmbeddedComponent ( wxTextFile & aFile,
size_t & aLineIdx )
private

Definition at line 1932 of file sch_io_geda.cpp.

References addSymbolGraphic(), addSymbolPin(), m_pendingComp, and maybeParseAttributes().

Referenced by LoadSchematicFile().

◆ parseLine()

void SCH_IO_GEDA::parseLine ( const wxString & aLine,
wxTextFile & aFile,
size_t & aLineIdx )
private

◆ parseNet()

void SCH_IO_GEDA::parseNet ( const wxString & aLine,
wxTextFile & aFile,
size_t & aLineIdx )
private

◆ parsePath()

void SCH_IO_GEDA::parsePath ( const wxString & aLine,
wxTextFile & aFile,
size_t & aLineIdx )
private

◆ parsePicture()

void SCH_IO_GEDA::parsePicture ( const wxString & aLine,
wxTextFile & aFile,
size_t & aLineIdx )
private

◆ parsePin()

void SCH_IO_GEDA::parsePin ( const wxString & aLine,
wxTextFile & aFile,
size_t & aLineIdx )
private

◆ parseRcFileForLibraries()

void SCH_IO_GEDA::parseRcFileForLibraries ( const wxString & aPath,
const wxString & aBaseDir )
private

Parse an RC file (gafrc or gschemrc) for component-library directives.

Definition at line 2877 of file sch_io_geda.cpp.

References scanSymbolDir().

Referenced by initSymbolLibrary().

◆ parseSymbolObjects()

void SCH_IO_GEDA::parseSymbolObjects ( wxTextFile & aFile,
size_t & aLineIdx,
LIB_SYMBOL & aSymbol,
size_t aEndLine )
private

Parse objects from a .sym file or [] block into a LIB_SYMBOL.

◆ parseText()

◆ parseVersionLine()

bool SCH_IO_GEDA::parseVersionLine ( const wxString & aLine)
private

Parse the "v YYYYMMDD N" version line and validate.

Definition at line 1549 of file sch_io_geda.cpp.

References m_fileFormatVersion, and m_releaseVersion.

Referenced by LoadSchematicFile().

◆ postProcess()

void SCH_IO_GEDA::postProcess ( )
private

Run the full post-processing pipeline after parsing is complete:

  1. Flush any pending component
  2. Compute bounding box and Y-flip all coordinates
  3. Process net= attributes for implicit connections
  4. Place junctions where 3+ endpoints meet

Definition at line 4154 of file sch_io_geda.cpp.

References addBusEntries(), addJunctions(), flushPendingComponent(), loadDeferredSheets(), and processNetAttributes().

Referenced by LoadSchematicFile().

◆ processNetAttributes()

void SCH_IO_GEDA::processNetAttributes ( )
private

For each component with net= attributes, create global labels at pin positions.

Definition at line 4164 of file sch_io_geda.cpp.

References std::abs(), SPIN_STYLE::BOTTOM, GEDA_DEFAULT_TEXT_SIZE_MILS, LIB_SYMBOL::GetPins(), SPIN_STYLE::LEFT, m_netAttrRecords, m_screen, pin, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, SPIN_STYLE::RIGHT, toKiCadDist(), SPIN_STYLE::UP, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by postProcess().

◆ Report()

◆ SaveLibrary()

void SCH_IO::SaveLibrary ( const wxString & aFileName,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Reimplemented in SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 61 of file sch_io.cpp.

References NOT_IMPLEMENTED.

◆ SaveSchematicFile()

void SCH_IO::SaveSchematicFile ( const wxString & aFileName,
SCH_SHEET * aSheet,
SCHEMATIC * aSchematic,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Write aSchematic to a storage file in a format that this SCH_IO implementation knows about, or it can be used to write a portion of aSchematic to a special kind of export file.

Parameters
aFileNameis the name of a file to save to on disk.
aSheetis the class SCH_SHEET in memory document tree from which to extract information when writing to aFileName. The caller continues to own the SCHEMATIC, and the plugin should refrain from modifying the SCHEMATIC if possible.
aSchematicis the SCHEMATIC object used to access any schematic-wide or project information needed to save the document.
aPropertiesis an associative array that can be used to tell the saver how to save the file, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL. Set the #PropSaveCurrentSheetOnly property to only save the current sheet. Otherwise, all hierarchical sheets are saved.
Exceptions
IO_ERRORif there is a problem saving or exporting.

Reimplemented in SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 74 of file sch_io.cpp.

References NOT_IMPLEMENTED.

◆ SaveSymbol()

void SCH_IO::SaveSymbol ( const wxString & aLibraryPath,
const LIB_SYMBOL * aSymbol,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Write aSymbol to an existing library located at aLibraryPath.

If a LIB_SYMBOL by the same name already exists or there are any conflicting alias names, the new LIB_SYMBOL will silently overwrite any existing aliases and/or part because libraries cannot have duplicate alias names. It is the responsibility of the caller to check the library for conflicts before saving.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several symbols.
aSymbolis what to store in the library. The library is refreshed and the caller must update any LIB_SYMBOL pointers that may have changed.
aPropertiesis an associative array that can be used to tell the saver how to save the symbol, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem saving.

Reimplemented in SCH_IO_HTTP_LIB, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 108 of file sch_io.cpp.

References NOT_IMPLEMENTED.

Referenced by LIB_BUFFER::SaveBuffer().

◆ scanSymbolDir()

void SCH_IO_GEDA::scanSymbolDir ( const wxString & aDir,
int aDepth = 0 )
private

Recursively scan a directory for .sym files and populate m_symLibrary.

Definition at line 2844 of file sch_io_geda.cpp.

References m_symLibrary, SCH_IO_GEDA::SYM_CACHE_ENTRY::path, and scanSymbolDir().

Referenced by initSymbolLibrary(), parseRcFileForLibraries(), and scanSymbolDir().

◆ SetLibraryManagerAdapter()

virtual void SCH_IO::SetLibraryManagerAdapter ( SYMBOL_LIBRARY_ADAPTER * aAdapter)
inlinevirtualinherited

Some library plugins need to interface with other loaded libraries.

To do this, they receive a reference to the project-specific manager adapter.

Reimplemented in SCH_IO_DATABASE, and SCH_IO_HTTP_LIB.

Definition at line 359 of file sch_io.h.

◆ SetProgressReporter()

virtual void IO_BASE::SetProgressReporter ( PROGRESS_REPORTER * aReporter)
inlinevirtualinherited

Set an optional progress reporter.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE.

Definition at line 94 of file io_base.h.

References m_progressReporter.

Referenced by PCB_CONTROL::AppendBoard().

◆ SetReporter()

virtual void IO_BASE::SetReporter ( REPORTER * aReporter)
inlinevirtualinherited

Set an optional reporter for warnings/errors.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE.

Definition at line 89 of file io_base.h.

References m_reporter.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and KI_TEST::LoadBoardWithCapture().

◆ SupportsConfigurationDialog()

virtual bool IO_BASE::SupportsConfigurationDialog ( ) const
inlinevirtualinherited
Returns
true if this plugin supports a GUI for configuration that can be launched from the library table configuration dialog or other UI contexts

Reimplemented in SCH_IO_DATABASE.

Definition at line 207 of file io_base.h.

◆ SupportsSubLibraries()

virtual bool SCH_IO::SupportsSubLibraries ( ) const
inlinevirtualinherited
Returns
true if this plugin supports libraries that contain sub-libraries.

Reimplemented in SCH_IO_DATABASE, and SCH_IO_HTTP_LIB.

Definition at line 290 of file sch_io.h.

Referenced by SYMBOL_LIBRARY_ADAPTER::SupportsSubLibraries().

◆ toFillType()

FILL_T SCH_IO_GEDA::toFillType ( int aFillType)
staticprivate

Map gEDA filltype (0-4) to KiCad FILL_T.

Definition at line 1720 of file sch_io_geda.cpp.

References CROSS_HATCH, FILLED_SHAPE, HATCH, and NO_FILL.

Referenced by addSymbolGraphic(), parseBox(), and parseCircle().

◆ toKiCad()

VECTOR2I SCH_IO_GEDA::toKiCad ( int aGedaX,
int aGedaY ) const
private

Apply the Y-flip and scale to transform gEDA coords to KiCad.

Call only after m_maxY has been computed in the post-processing pass.

Definition at line 1539 of file sch_io_geda.cpp.

References m_maxY, and toKiCadDist().

Referenced by addJunctions(), flushPendingComponent(), importHierarchicalSheet(), parseArc(), parseBox(), parseBus(), parseCircle(), parseLine(), parseNet(), parsePath(), parsePicture(), parsePin(), and parseText().

◆ toKiCadDist()

int SCH_IO_GEDA::toKiCadDist ( int aMils) const
private

◆ toKiCadOrientation()

int SCH_IO_GEDA::toKiCadOrientation ( int aAngle,
int aMirror ) const
private

Map gEDA angle (0/90/180/270) + mirror to KiCad symbol orientation.

Definition at line 1736 of file sch_io_geda.cpp.

References SYM_MIRROR_Y, SYM_ORIENT_0, SYM_ORIENT_180, SYM_ORIENT_270, and SYM_ORIENT_90.

Referenced by flushPendingComponent().

◆ toLineStyle()

LINE_STYLE SCH_IO_GEDA::toLineStyle ( int aDashStyle)
staticprivate

Map gEDA dashstyle (0-4) to KiCad LINE_STYLE.

Definition at line 1707 of file sch_io_geda.cpp.

References DASH, DASHDOT, DASHDOTDOT, DEFAULT, and DOT.

Referenced by addSymbolGraphic(), parseArc(), parseBox(), parseCircle(), parseLine(), and parsePath().

◆ trackEndpoint()

void SCH_IO_GEDA::trackEndpoint ( int aGedaX,
int aGedaY )
private

Track a point as a net or pin endpoint for junction detection.

Definition at line 4144 of file sch_io_geda.cpp.

References m_netEndpoints.

Referenced by flushPendingComponent(), parseNet(), and parsePin().

Member Data Documentation

◆ m_busSegments

std::vector<BUS_SEGMENT> SCH_IO_GEDA::m_busSegments
private

Definition at line 345 of file sch_io_geda.h.

Referenced by addBusEntries(), LoadSchematicFile(), and parseBus().

◆ m_deferredSheets

std::vector<DEFERRED_SHEET> SCH_IO_GEDA::m_deferredSheets
private

Definition at line 355 of file sch_io_geda.h.

Referenced by importHierarchicalSheet(), loadDeferredSheets(), and LoadSchematicFile().

◆ m_fileFormatVersion

long SCH_IO_GEDA::m_fileFormatVersion
private

Definition at line 309 of file sch_io_geda.h.

Referenced by LoadSchematicFile(), parseText(), parseVersionLine(), and SCH_IO_GEDA().

◆ m_filename

wxFileName SCH_IO_GEDA::m_filename
private

◆ m_importStack

std::set<wxString> SCH_IO_GEDA::m_importStack
private

Set of fully-resolved file paths currently in the import call stack, used to detect and prevent circular hierarchy references.

Definition at line 359 of file sch_io_geda.h.

Referenced by importHierarchicalSheet(), and loadDeferredSheets().

◆ m_libSymbols

std::map<wxString, std::unique_ptr<LIB_SYMBOL> > SCH_IO_GEDA::m_libSymbols
private

Loaded symbols for this import session, keyed by basename.

Definition at line 319 of file sch_io_geda.h.

Referenced by flushPendingComponent(), getOrLoadSymbol(), and LoadSchematicFile().

◆ m_maxY

int SCH_IO_GEDA::m_maxY
private

The maximum Y coordinate seen during parsing (gEDA coords, before flip).

Definition at line 304 of file sch_io_geda.h.

Referenced by flushPendingComponent(), LoadSchematicFile(), parsePicture(), SCH_IO_GEDA(), and toKiCad().

◆ m_name

wxString IO_BASE::m_name
protectedinherited

Name of the IO loader.

Definition at line 234 of file io_base.h.

Referenced by PCB_IO_IPC2581::generateBOMSection(), GetName(), and IO_BASE().

◆ m_netAttrRecords

std::vector<NET_ATTR_RECORD> SCH_IO_GEDA::m_netAttrRecords
private

Definition at line 335 of file sch_io_geda.h.

Referenced by flushPendingComponent(), LoadSchematicFile(), and processNetAttributes().

◆ m_netEndpoints

std::map<std::pair<int,int>, int> SCH_IO_GEDA::m_netEndpoints
private

Net endpoint positions in raw gEDA coordinates for junction detection.

Definition at line 325 of file sch_io_geda.h.

Referenced by addJunctions(), LoadSchematicFile(), and trackEndpoint().

◆ m_pendingComp

std::unique_ptr<PENDING_COMPONENT> SCH_IO_GEDA::m_pendingComp
private

Pending component awaiting symbol resolution.

Definition at line 312 of file sch_io_geda.h.

Referenced by flushPendingComponent(), importHierarchicalSheet(), LoadSchematicFile(), parseComponent(), and parseEmbeddedComponent().

◆ m_powerCounter

int SCH_IO_GEDA::m_powerCounter
private

Sequential counter for auto-generated #PWR references.

Definition at line 322 of file sch_io_geda.h.

Referenced by flushPendingComponent(), LoadSchematicFile(), and SCH_IO_GEDA().

◆ m_progressReporter

◆ m_properties

const std::map<std::string, UTF8>* SCH_IO_GEDA::m_properties
private

Properties passed from the import framework (search paths, etc.)

Definition at line 362 of file sch_io_geda.h.

Referenced by initSymbolLibrary(), loadDeferredSheets(), LoadSchematicFile(), and SCH_IO_GEDA().

◆ m_releaseVersion

long SCH_IO_GEDA::m_releaseVersion
private

gEDA file version fields from the "v YYYYMMDD N" header line.

Used for version-aware parsing of old format files.

Definition at line 308 of file sch_io_geda.h.

Referenced by LoadSchematicFile(), parseArc(), parseBox(), parseBus(), parseCircle(), parseLine(), parsePin(), parseText(), parseVersionLine(), and SCH_IO_GEDA().

◆ m_reporter

REPORTER* IO_BASE::m_reporter
protectedinherited

Reporter to log errors/warnings to, may be nullptr.

Definition at line 237 of file io_base.h.

Referenced by SCH_IO_CADSTAR_ARCHIVE::ensureLoadedLibrary(), SCH_IO_GEDA::flushPendingComponent(), PCB_IO_ALTIUM_DESIGNER::FootprintLoad(), SCH_IO_GEDA::getOrLoadSymbol(), SCH_IO_GEDA::importHierarchicalSheet(), IO_BASE(), PCB_IO_ALLEGRO::LoadBoard(), PCB_IO_ALTIUM_CIRCUIT_MAKER::LoadBoard(), PCB_IO_ALTIUM_CIRCUIT_STUDIO::LoadBoard(), PCB_IO_ALTIUM_DESIGNER::LoadBoard(), PCB_IO_PADS::LoadBoard(), PCB_IO_PADS_BINARY::LoadBoard(), PCB_IO_SOLIDWORKS::LoadBoard(), PCB_IO_PADS::loadCopperShapes(), SCH_IO_GEDA::loadDeferredSheets(), PCB_IO_PADS::loadFootprints(), PCB_IO_PADS::loadKeepouts(), SCH_IO_ALTIUM::LoadSchematicFile(), SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile(), SCH_IO_GEDA::LoadSchematicFile(), SCH_IO_LTSPICE::LoadSchematicFile(), SCH_IO_PADS::LoadSchematicFile(), PCB_IO_PADS::loadTexts(), PCB_IO_PADS_BINARY::loadTexts(), PCB_IO_PADS::loadTracksAndVias(), PCB_IO_PADS_BINARY::loadTracksAndVias(), PCB_IO_PADS::loadZones(), PCB_IO_PADS_BINARY::loadZones(), SCH_IO_ALTIUM::ParsePowerPort(), PCB_IO_ALLEGRO::PCB_IO_ALLEGRO(), PCB_IO_ALTIUM_DESIGNER::PCB_IO_ALTIUM_DESIGNER(), PCB_IO_SOLIDWORKS::PCB_IO_SOLIDWORKS(), Report(), PCB_IO_PADS::reportStatistics(), PCB_IO_PADS_BINARY::reportStatistics(), SCH_IO_ALTIUM::SCH_IO_ALTIUM(), SCH_IO_CADSTAR_ARCHIVE::SCH_IO_CADSTAR_ARCHIVE(), SCH_IO_EAGLE::SCH_IO_EAGLE(), SCH_IO_EASYEDA::SCH_IO_EASYEDA(), SCH_IO_EASYEDAPRO::SCH_IO_EASYEDAPRO(), SCH_IO_GEDA::SCH_IO_GEDA(), SCH_IO_LTSPICE::SCH_IO_LTSPICE(), SetReporter(), and SCH_IO_CADSTAR_ARCHIVE::SetReporter().

◆ m_rootSheet

SCH_SHEET* SCH_IO_GEDA::m_rootSheet
private

Definition at line 299 of file sch_io_geda.h.

Referenced by importHierarchicalSheet(), LoadSchematicFile(), and SCH_IO_GEDA().

◆ m_schematic

SCHEMATIC* SCH_IO_GEDA::m_schematic
private

◆ m_screen

◆ m_symLibrary

std::map<wxString, SYM_CACHE_ENTRY> SCH_IO_GEDA::m_symLibrary
private

Symbol library cache: gEDA basename -> cache entry.

Definition at line 315 of file sch_io_geda.h.

Referenced by flushPendingComponent(), getOrLoadSymbol(), loadBuiltinSymbol(), loadDeferredSheets(), LoadSchematicFile(), and scanSymbolDir().

◆ m_symLibraryInitialized

bool SCH_IO_GEDA::m_symLibraryInitialized
private

◆ MILS_TO_IU

int SCH_IO_GEDA::MILS_TO_IU = 254
staticconstexprprivate

gEDA coordinates are mils with Y-up.

KiCad uses 100nm IU with Y-down. During parsing we store raw gEDA coordinates, then post-process to flip Y.

Definition at line 152 of file sch_io_geda.h.

Referenced by flushPendingComponent(), and toKiCadDist().


The documentation for this class was generated from the following files: