KiCad PCB EDA Suite
|
#include <ltspice_schematic.h>
Classes | |
struct | ARC |
The ARC is represented inside a rectangle whose opposite site are given. More... | |
struct | BUSTAP |
struct | CIRCLE |
The CIRCLE is represented in Ltpsice inside a rectangle whose two opposite points and line style are given. More... | |
struct | DATAFLAG |
struct | FLAG |
struct | IOPIN |
IOPIN is special contact on symbol used for IO operations. More... | |
struct | LINE |
struct | LT_ASC |
A struct to hold .asc file definition. More... | |
struct | LT_PIN |
struct | LT_SYMBOL |
A struct to hold SYMBOL definition. More... | |
struct | LT_WINDOW |
struct | RECTANGLE |
A 4-sided polygon with opposite equal sides, used in representing shapes. More... | |
struct | TEXT |
struct | WIRE |
A metallic connection, used for transfer, between two points or pin. More... | |
Public Types | |
enum class | LINESTYLE { SOLID = 0 , DASH = 1 , DOT = 2 , DASHDOT = 3 , DASHDOTDOT = 4 } |
enum class | LINEWIDTH { Normal = 5 , Wide = 10 } |
enum class | POLARITY { INPUT , OUTPUT , BIDIR } |
Polarity enum represents polarity of pin. More... | |
enum class | SYMBOLTYPE { CELL , BLOCK } |
Type of Symbol loaded from asc and asy file. More... | |
enum class | JUSTIFICATION { NONE , BOTTOM , LEFT , RIGHT , CENTER , TOP , VBOTTOM , VLEFT , VRIGHT , VCENTER , VTOP } |
Defines in what ways the PIN or TEXT can be justified. More... | |
enum class | ORIENTATION { R0 , R90 , R180 , R270 , M0 , M90 , M180 , M270 } |
Defines different types or rotation and mirror operation can be applied to a LT_SYMBOL. More... | |
Public Member Functions | |
LTSPICE_SCHEMATIC (const wxString &aFilename, const wxFileName &aLTspiceDataDir, REPORTER *aReporter, PROGRESS_REPORTER *aProgressReporter) | |
~LTSPICE_SCHEMATIC () | |
void | Load (SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxFileName &aLibraryFileName, REPORTER *aReporter) |
The main function responsible for loading the .asc and .asy files. | |
void | GetAscAndAsyFilePaths (const wxDir &aDir, bool aRecursive, std::map< wxString, wxString > &aMapOfAscFiles, std::map< wxString, wxString > &aMapOfAsyFiles, const wxString &aBase=wxEmptyString) |
Used to get file path for Asc and Asy files. | |
std::vector< LTSPICE_FILE > | GetSchematicElements (const wxString &aAscFile) |
Used to get symbols list present in asc file. | |
bool | IsAsySubsheet (const wxString &aAsyFile) |
Check if the asy file content indicates that we need to load subsheet. | |
std::map< wxString, wxString > | ReadAsyFiles (const std::vector< LTSPICE_FILE > &aSourceFiles, const std::map< wxString, wxString > &aAsyFileMap) |
The function returns a map. | |
std::map< wxString, wxString > | ReadAsyFile (const LTSPICE_FILE &aSourceFile, const std::map< wxString, wxString > &aAsyFileMap) |
std::vector< LT_ASC > | StructureBuilder () |
Build Intermediate data structure. | |
LT_SYMBOL | SymbolBuilder (const wxString &aAscFileName, LT_ASC &aAscFile) |
LT_SYMBOL | SymbolBuilder (const wxString &aAscFileName, const wxString &aAsyFileContent, LT_ASC &aAscFile) |
const wxFileName & | GetLTspiceDataDir () |
Static Private Member Functions | |
static void | aggregateAttributeValue (wxArrayString &aTokens, int aIndex) |
Join value present across multiple tokens into one. | |
static int | integerCheck (const wxString &aToken, int aLineNumber, const wxString &aFileName) |
Used to check if the given token in integer or not. | |
static VECTOR2I | pointCheck (const wxString &aTokenX, const wxString &aTokenY, int aLineNumber, const wxString &aFileName) |
static void | tokensSizeRangeCheck (size_t aActualSize, int aExpectedMin, int aExpectedMax, int aLineNumber, const wxString &aFileName) |
Used to check size of the token generated from split function. | |
static void | removeCarriageReturn (wxString &elementFromLine) |
static LINESTYLE | getLineStyle (int aValue) |
static LINEWIDTH | getLineWidth (const wxString &aValue) |
static POLARITY | getPolarity (const wxString &aValue) |
static ORIENTATION | getSymbolRotationOrMirror (const wxString &aValue) |
static JUSTIFICATION | getTextJustification (const wxString &aValue) |
static JUSTIFICATION | getPinJustification (const wxString &aValue) |
static SYMBOLTYPE | getSymbolType (const wxString &aValue) |
Private Attributes | |
REPORTER * | m_reporter |
SCHEMATIC * | m_schematic |
wxFileName | m_ltspiceDataDir |
PROGRESS_REPORTER * | m_progressReporter |
std::map< wxString, std::map< wxString, wxString > > | m_fileCache |
Definition at line 58 of file ltspice_schematic.h.
|
strong |
Defines in what ways the PIN or TEXT can be justified.
Enumerator | |
---|---|
NONE | |
BOTTOM | |
LEFT | |
RIGHT | |
CENTER | |
TOP | |
VBOTTOM | |
VLEFT | |
VRIGHT | |
VCENTER | |
VTOP |
Definition at line 101 of file ltspice_schematic.h.
|
strong |
Enumerator | |
---|---|
SOLID | |
DASH | |
DOT | |
DASHDOT | |
DASHDOTDOT |
Definition at line 61 of file ltspice_schematic.h.
|
strong |
Enumerator | |
---|---|
Normal | |
Wide |
Definition at line 70 of file ltspice_schematic.h.
|
strong |
Defines different types or rotation and mirror operation can be applied to a LT_SYMBOL.
Enumerator | |
---|---|
R0 | |
R90 | |
R180 | |
R270 | |
M0 | |
M90 | |
M180 | |
M270 |
Definition at line 119 of file ltspice_schematic.h.
|
strong |
Polarity enum represents polarity of pin.
Enumerator | |
---|---|
INPUT | |
OUTPUT | |
BIDIR |
Definition at line 79 of file ltspice_schematic.h.
|
strong |
Type of Symbol loaded from asc and asy file.
NOTE: Currently we have only found CELL and BLOCK type of symbol components others, we are not able to reproduce till now.
Enumerator | |
---|---|
CELL | |
BLOCK |
Definition at line 92 of file ltspice_schematic.h.
|
inlineexplicit |
Definition at line 280 of file ltspice_schematic.h.
|
inline |
Definition at line 288 of file ltspice_schematic.h.
|
staticprivate |
Join value present across multiple tokens into one.
aTokens | an array of tokenised data. |
aIndex | from where the tokens should be concatenated. |
Definition at line 396 of file ltspice_schematic.cpp.
Referenced by StructureBuilder(), and SymbolBuilder().
void LTSPICE_SCHEMATIC::GetAscAndAsyFilePaths | ( | const wxDir & | aDir, |
bool | aRecursive, | ||
std::map< wxString, wxString > & | aMapOfAscFiles, | ||
std::map< wxString, wxString > & | aMapOfAsyFiles, | ||
const wxString & | aBase = wxEmptyString |
||
) |
Used to get file path for Asc and Asy files.
aMapOfAscFiles | map of string containing content from asc files. |
aMapOfAsyFiles | map of string containing content from asy files. |
Definition at line 199 of file ltspice_schematic.cpp.
References _, GetAscAndAsyFilePaths(), m_reporter, path, and REPORTER::Report().
Referenced by GetAscAndAsyFilePaths(), and Load().
|
staticprivate |
aValue | integer value between 0-3 |
Definition at line 404 of file ltspice_schematic.cpp.
References _, DASH, DASHDOT, DASHDOTDOT, DOT, SOLID, and THROW_IO_ERROR.
Referenced by StructureBuilder(), and SymbolBuilder().
|
staticprivate |
aValue | string value |
Definition at line 421 of file ltspice_schematic.cpp.
References _, Normal, THROW_IO_ERROR, and Wide.
Referenced by StructureBuilder(), and SymbolBuilder().
|
inline |
Definition at line 352 of file ltspice_schematic.h.
References m_ltspiceDataDir.
Referenced by SCH_IO_LTSPICE_PARSER::CreateFields(), and SCH_IO_LTSPICE_PARSER::readIncludes().
|
staticprivate |
aValue | string value |
Definition at line 496 of file ltspice_schematic.cpp.
References _, BOTTOM, LEFT, NONE, RIGHT, THROW_IO_ERROR, TOP, VBOTTOM, VCENTER, VLEFT, VRIGHT, and VTOP.
Referenced by SymbolBuilder().
|
staticprivate |
aValue | string value |
Definition at line 435 of file ltspice_schematic.cpp.
References _, BIDIR, INPUT, OUTPUT, and THROW_IO_ERROR.
Referenced by StructureBuilder().
std::vector< LTSPICE_FILE > LTSPICE_SCHEMATIC::GetSchematicElements | ( | const wxString & | aAscFile | ) |
Used to get symbols list present in asc file.
aFilePath | path where file to be read is kept. |
aReadType | specifies in which type the file is to be read eg. r specifies file is use open for reading. |
Definition at line 305 of file ltspice_schematic.cpp.
Referenced by Load().
|
staticprivate |
aValue | string value |
Definition at line 453 of file ltspice_schematic.cpp.
References _, M0, M180, M270, M90, R0, R180, R270, R90, and THROW_IO_ERROR.
Referenced by StructureBuilder().
|
staticprivate |
aValue | string value |
Definition at line 518 of file ltspice_schematic.cpp.
References _, BLOCK, CELL, and THROW_IO_ERROR.
Referenced by SymbolBuilder().
|
staticprivate |
aValue | string value |
Definition at line 474 of file ltspice_schematic.cpp.
References _, BOTTOM, CENTER, LEFT, RIGHT, THROW_IO_ERROR, TOP, VBOTTOM, VCENTER, VLEFT, VRIGHT, and VTOP.
Referenced by StructureBuilder(), and SymbolBuilder().
|
staticprivate |
Used to check if the given token in integer or not.
aToken | token to be verified. |
aLineNumber | gives on which line number the check is called. |
aFileName | gives in which file the check is been called. |
IO_ERROR | if the token is not an integer. |
Definition at line 353 of file ltspice_schematic.cpp.
References _, and THROW_IO_ERROR.
Referenced by pointCheck(), StructureBuilder(), and SymbolBuilder().
bool LTSPICE_SCHEMATIC::IsAsySubsheet | ( | const wxString & | aAsyFile | ) |
Check if the asy file content indicates that we need to load subsheet.
aAsyFile | contents of .asy file. |
Definition at line 334 of file ltspice_schematic.cpp.
Referenced by Load().
void LTSPICE_SCHEMATIC::Load | ( | SCHEMATIC * | aSchematic, |
SCH_SHEET * | aRootSheet, | ||
const wxFileName & | aLibraryFileName, | ||
REPORTER * | aReporter | ||
) |
The main function responsible for loading the .asc and .asy files.
Loads the asc file and asy files.
aSchematic | is the schematic object. |
aRootSheet | is the root sheet referencing variable. |
aLibraryFileName | is the name of the library which gets created when the plugin runs. |
Definition at line 36 of file ltspice_schematic.cpp.
References SCH_IO_LTSPICE_PARSER::CreateSymbol(), alg::delete_if(), LTSPICE_FILE::ElementName, GetAscAndAsyFilePaths(), LIB_SYMBOL::GetBoundingBox(), SCH_SHEET::GetFields(), BOX2< Vec >::GetOrigin(), PROJECT::GetProjectPath(), GetSchematicElements(), SCH_SHEET::GetScreen(), BOX2< Vec >::GetSize(), IsAsySubsheet(), m_fileCache, m_ltspiceDataDir, m_schematic, SCH_IO_LTSPICE_PARSER::Parse(), SCHEMATIC::Prj(), SCH_SHEET_PATH::push_back(), ReadAsyFile(), ReadAsyFiles(), REPORTER::Report(), RPT_SEVERITY_ERROR, SafeReadFile(), LTSPICE_FILE::Screen, SCH_SCREEN::SetFileName(), EDA_ITEM::SetParent(), SCH_SHEET::SetPosition(), SCH_SHEET::SetScreen(), SCH_SHEET::SetSize(), SCH_FIELD::SetText(), LTSPICE_FILE::Sheet, SHEETFILENAME, SHEETNAME, StructureBuilder(), SymbolBuilder(), SCH_IO_LTSPICE_PARSER::ToKicadCoords(), and IO_ERROR::What().
Referenced by SCH_IO_LTSPICE::LoadSchematicFile().
|
staticprivate |
Definition at line 369 of file ltspice_schematic.cpp.
References integerCheck().
Referenced by StructureBuilder(), and SymbolBuilder().
std::map< wxString, wxString > LTSPICE_SCHEMATIC::ReadAsyFile | ( | const LTSPICE_FILE & | aSourceFile, |
const std::map< wxString, wxString > & | aAsyFileMap | ||
) |
Definition at line 273 of file ltspice_schematic.cpp.
References LTSPICE_FILE::ElementName, and SafeReadFile().
Referenced by Load().
std::map< wxString, wxString > LTSPICE_SCHEMATIC::ReadAsyFiles | ( | const std::vector< LTSPICE_FILE > & | aSourceFiles, |
const std::map< wxString, wxString > & | aAsyFileMap | ||
) |
The function returns a map.
This map has all the asy files in form of string. For asy files the key will be symbol name.
aFilenames | contains all the symbols for which we we have to load the .asy files |
Definition at line 288 of file ltspice_schematic.cpp.
References SafeReadFile().
Referenced by Load().
|
staticprivate |
Definition at line 532 of file ltspice_schematic.cpp.
Referenced by StructureBuilder(), and SymbolBuilder().
std::vector< LTSPICE_SCHEMATIC::LT_ASC > LTSPICE_SCHEMATIC::StructureBuilder | ( | ) |
Build Intermediate data structure.
The Arc is enclosed in the square given by above coordinates and its start and end coordinates are given. The arc is drawn counterclockwise from the starting point to the ending point.
Definition at line 774 of file ltspice_schematic.cpp.
References aggregateAttributeValue(), LTSPICE_SCHEMATIC::ARC::ArcEnd, LTSPICE_SCHEMATIC::LT_ASC::Arcs, LTSPICE_SCHEMATIC::ARC::ArcStart, LTSPICE_SCHEMATIC::CIRCLE::BotRight, LTSPICE_SCHEMATIC::ARC::BotRight, LTSPICE_SCHEMATIC::RECTANGLE::BotRight, LTSPICE_SCHEMATIC::LT_ASC::BoundingBox, LTSPICE_SCHEMATIC::LT_ASC::Bustap, LTSPICE_SCHEMATIC::LT_ASC::Circles, LTSPICE_SCHEMATIC::LT_ASC::DataFlags, LTSPICE_SCHEMATIC::LINE::End, LTSPICE_SCHEMATIC::WIRE::End, LTSPICE_SCHEMATIC::BUSTAP::End, flag, LTSPICE_SCHEMATIC::LT_ASC::Flags, LTSPICE_SCHEMATIC::LT_WINDOW::FontSize, getLineStyle(), getLineWidth(), getPolarity(), getSymbolRotationOrMirror(), getTextJustification(), integerCheck(), LTSPICE_SCHEMATIC::LT_ASC::Iopins, LTSPICE_SCHEMATIC::LT_WINDOW::Justification, LTSPICE_SCHEMATIC::LT_ASC::Lines, LTSPICE_SCHEMATIC::LINE::LineStyle, LTSPICE_SCHEMATIC::CIRCLE::LineStyle, LTSPICE_SCHEMATIC::ARC::LineStyle, LTSPICE_SCHEMATIC::RECTANGLE::LineStyle, LTSPICE_SCHEMATIC::LINE::LineWidth, LTSPICE_SCHEMATIC::CIRCLE::LineWidth, LTSPICE_SCHEMATIC::ARC::LineWidth, LTSPICE_SCHEMATIC::RECTANGLE::LineWidth, LTSPICE_SCHEMATIC::IOPIN::Location, m_fileCache, BOX2< Vec >::Merge(), name, LTSPICE_SCHEMATIC::LT_SYMBOL::Offset, pointCheck(), LTSPICE_SCHEMATIC::IOPIN::Polarity, LTSPICE_SCHEMATIC::LT_WINDOW::Position, LTSPICE_SCHEMATIC::LT_ASC::Rectangles, removeCarriageReturn(), LTSPICE_SCHEMATIC::LT_ASC::SheetNumber, LTSPICE_SCHEMATIC::LT_ASC::SheetSize, LTSPICE_SCHEMATIC::LINE::Start, LTSPICE_SCHEMATIC::WIRE::Start, LTSPICE_SCHEMATIC::BUSTAP::Start, SymbolBuilder(), LTSPICE_SCHEMATIC::LT_SYMBOL::SymbolOrientation, LTSPICE_SCHEMATIC::LT_ASC::Symbols, text, LTSPICE_SCHEMATIC::LT_ASC::Texts, tokensSizeRangeCheck(), LTSPICE_SCHEMATIC::CIRCLE::TopLeft, LTSPICE_SCHEMATIC::ARC::TopLeft, LTSPICE_SCHEMATIC::RECTANGLE::TopLeft, LTSPICE_SCHEMATIC::LT_ASC::Version, LTSPICE_SCHEMATIC::LT_WINDOW::WindowNumber, and LTSPICE_SCHEMATIC::LT_ASC::Wires.
Referenced by Load().
LTSPICE_SCHEMATIC::LT_SYMBOL LTSPICE_SCHEMATIC::SymbolBuilder | ( | const wxString & | aAscFileName, |
const wxString & | aAsyFileContent, | ||
LT_ASC & | aAscFile | ||
) |
The Circle is enclosed in the square which is represented by bottomRight and topLeft coordinates.
The Arc is enclosed in the square given by above coordinates and its start and end coordinates are given. The arc is drawn counterclockwise from the starting point to the ending point.
Definition at line 550 of file ltspice_schematic.cpp.
References aggregateAttributeValue(), LTSPICE_SCHEMATIC::ARC::ArcEnd, LTSPICE_SCHEMATIC::LT_SYMBOL::Arcs, LTSPICE_SCHEMATIC::ARC::ArcStart, LTSPICE_SCHEMATIC::CIRCLE::BotRight, LTSPICE_SCHEMATIC::ARC::BotRight, LTSPICE_SCHEMATIC::RECTANGLE::BotRight, CELL, LTSPICE_SCHEMATIC::LT_SYMBOL::Circles, LTSPICE_SCHEMATIC::LINE::End, LTSPICE_SCHEMATIC::LT_WINDOW::FontSize, getLineStyle(), getLineWidth(), getPinJustification(), getSymbolType(), getTextJustification(), integerCheck(), LTSPICE_SCHEMATIC::LT_WINDOW::Justification, LTSPICE_SCHEMATIC::LT_SYMBOL::Lines, LTSPICE_SCHEMATIC::LINE::LineStyle, LTSPICE_SCHEMATIC::CIRCLE::LineStyle, LTSPICE_SCHEMATIC::ARC::LineStyle, LTSPICE_SCHEMATIC::RECTANGLE::LineStyle, LTSPICE_SCHEMATIC::LINE::LineWidth, LTSPICE_SCHEMATIC::CIRCLE::LineWidth, LTSPICE_SCHEMATIC::ARC::LineWidth, LTSPICE_SCHEMATIC::RECTANGLE::LineWidth, name, LTSPICE_SCHEMATIC::LT_SYMBOL::Name, pin, LTSPICE_SCHEMATIC::LT_SYMBOL::Pins, pointCheck(), LTSPICE_SCHEMATIC::LT_WINDOW::Position, R0, LTSPICE_SCHEMATIC::LT_SYMBOL::Rectangles, removeCarriageReturn(), LTSPICE_SCHEMATIC::LINE::Start, LTSPICE_SCHEMATIC::LT_SYMBOL::SymAttributes, LTSPICE_SCHEMATIC::LT_SYMBOL::SymbolOrientation, LTSPICE_SCHEMATIC::LT_SYMBOL::SymbolType, tokensSizeRangeCheck(), LTSPICE_SCHEMATIC::CIRCLE::TopLeft, LTSPICE_SCHEMATIC::ARC::TopLeft, LTSPICE_SCHEMATIC::RECTANGLE::TopLeft, LTSPICE_SCHEMATIC::LT_WINDOW::WindowNumber, and LTSPICE_SCHEMATIC::LT_SYMBOL::Windows.
LTSPICE_SCHEMATIC::LT_SYMBOL LTSPICE_SCHEMATIC::SymbolBuilder | ( | const wxString & | aAscFileName, |
LT_ASC & | aAscFile | ||
) |
Definition at line 539 of file ltspice_schematic.cpp.
References _, m_fileCache, SymbolBuilder(), and THROW_IO_ERROR.
Referenced by SCH_IO_LTSPICE_PARSER::CreateKicadSYMBOLs(), Load(), StructureBuilder(), and SymbolBuilder().
|
staticprivate |
Used to check size of the token generated from split function.
aActualSize | actual size of array of token. |
aExpectedMin | expected lower range(i.e size) of array of token. |
aExpectedMax | expected higher range(i.e size) of array of token. |
aLineNumber | gives on which line number the check is called. |
aFileName | gives in which file the check is been called. |
IO_ERROR | if the actualSize is not within expected lower range..higher range. |
Definition at line 377 of file ltspice_schematic.cpp.
References _, and THROW_IO_ERROR.
Referenced by StructureBuilder(), and SymbolBuilder().
|
private |
Definition at line 439 of file ltspice_schematic.h.
Referenced by Load(), StructureBuilder(), and SymbolBuilder().
|
private |
Definition at line 436 of file ltspice_schematic.h.
Referenced by GetLTspiceDataDir(), and Load().
|
private |
Definition at line 437 of file ltspice_schematic.h.
|
private |
Definition at line 434 of file ltspice_schematic.h.
Referenced by GetAscAndAsyFilePaths().
|
private |
Definition at line 435 of file ltspice_schematic.h.
Referenced by Load().