2020-09-08 19:51:22 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-01-31 20:47:36 +00:00
|
|
|
* Copyright (C) 2020-2021 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
|
|
|
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-09-08 19:51:22 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file cadstar_pcb_archive_parser.cpp
|
|
|
|
* @brief Reads in a CADSTAR Schematic Archive (*.csa) file
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CADSTAR_SCH_ARCHIVE_PARSER_H_
|
|
|
|
#define CADSTAR_SCH_ARCHIVE_PARSER_H_
|
|
|
|
|
2023-12-19 17:39:26 +00:00
|
|
|
#include <io/cadstar/cadstar_archive_parser.h>
|
2020-09-08 19:51:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Represents a CADSTAR Schematic Archive (*.csa) file
|
|
|
|
*/
|
|
|
|
class CADSTAR_SCH_ARCHIVE_PARSER : public CADSTAR_ARCHIVE_PARSER
|
|
|
|
{
|
|
|
|
public:
|
2024-05-03 16:35:47 +00:00
|
|
|
explicit CADSTAR_SCH_ARCHIVE_PARSER( const wxString& aFilename ) :
|
|
|
|
CADSTAR_ARCHIVE_PARSER(),
|
|
|
|
Filename( aFilename ),
|
|
|
|
Header(),
|
|
|
|
Assignments(),
|
|
|
|
KiCadUnitDivider( 10 ),
|
|
|
|
m_rootNode( nullptr )
|
2020-09-08 19:51:22 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-02-27 22:55:20 +00:00
|
|
|
virtual ~CADSTAR_SCH_ARCHIVE_PARSER()
|
|
|
|
{
|
2024-05-03 16:35:47 +00:00
|
|
|
delete m_rootNode;
|
2023-02-27 22:55:20 +00:00
|
|
|
}
|
|
|
|
|
2020-09-08 19:51:22 +00:00
|
|
|
/**
|
|
|
|
* @brief Parses the file
|
|
|
|
* @throw IO_ERROR if file could not be opened or there was
|
|
|
|
* an error while parsing
|
|
|
|
*/
|
|
|
|
void Parse();
|
|
|
|
|
2020-09-19 22:05:02 +00:00
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
typedef wxString TERMINALCODE_ID;
|
|
|
|
typedef wxString SYMBOL_ID;
|
|
|
|
typedef wxString BUS_ID;
|
|
|
|
typedef wxString BLOCK_ID;
|
|
|
|
typedef wxString SHEET_NAME;
|
|
|
|
|
2020-09-27 13:10:59 +00:00
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
enum class TERMINAL_SHAPE_TYPE
|
|
|
|
{
|
|
|
|
ANNULUS,
|
|
|
|
BOX,
|
|
|
|
BULLET,
|
|
|
|
CIRCLE, ///< Keyword "ROUND"
|
|
|
|
CROSS,
|
|
|
|
DIAMOND,
|
|
|
|
FINGER,
|
|
|
|
OCTAGON,
|
|
|
|
PLUS,
|
|
|
|
POINTER,
|
|
|
|
RECTANGLE,
|
|
|
|
ROUNDED_RECT, ///< Keyword "ROUNDED"
|
|
|
|
SQUARE,
|
|
|
|
STAR,
|
|
|
|
TRIANGLE,
|
|
|
|
UNDEFINED ///< Only used for error checking (not a real shape)
|
|
|
|
};
|
|
|
|
|
2020-09-27 13:10:59 +00:00
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
static TERMINAL_SHAPE_TYPE ParseTermShapeType( const wxString& aShapeStr );
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct TERMINAL_SHAPE : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
TERMINAL_SHAPE_TYPE ShapeType;
|
|
|
|
long Size = UNDEFINED_VALUE;
|
2021-02-08 08:06:41 +00:00
|
|
|
// Note in the CADSTAR GUI, it only talks about "length", but the file seems to
|
|
|
|
// split it in "left length" and "right length" (similar to PADCODE in the PCB)
|
|
|
|
// for some terminal shapes such as RECTANGLE but not for others, such as TRIANGLE
|
|
|
|
long LeftLength = UNDEFINED_VALUE; ///< Might also be total length
|
|
|
|
long RightLength = UNDEFINED_VALUE; ///< Could be blank
|
2020-09-13 21:42:17 +00:00
|
|
|
long InternalFeature = UNDEFINED_VALUE;
|
|
|
|
long OrientAngle = 0; ///< 1/1000 of a Degree
|
|
|
|
|
|
|
|
static bool IsTermShape( XNODE* aNode );
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct TERMINALCODE : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
TERMINALCODE_ID ID;
|
|
|
|
wxString Name;
|
|
|
|
TERMINAL_SHAPE Shape;
|
|
|
|
bool Filled = false;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct CODEDEFS_SCM : CADSTAR_ARCHIVE_PARSER::CODEDEFS
|
|
|
|
{
|
|
|
|
std::map<TERMINALCODE_ID, TERMINALCODE> TerminalCodes;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct ASSIGNMENTS_SCM : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
2020-09-19 22:05:02 +00:00
|
|
|
CODEDEFS_SCM Codedefs;
|
|
|
|
GRIDS Grids;
|
|
|
|
SETTINGS Settings;
|
|
|
|
bool NetclassEditAttributeSettings = false; //< Unclear what this does
|
|
|
|
bool SpacingclassEditAttributeSettings = false; //< Unclear what this does
|
2020-09-13 21:42:17 +00:00
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct TERMINAL : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
TERMINAL_ID ID;
|
|
|
|
TERMINALCODE_ID TerminalCodeID;
|
|
|
|
POINT Position; ///< Pad position within the component's coordinate frame.
|
|
|
|
long OrientAngle = 0;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct PIN_NUM_LABEL_LOC : CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION
|
|
|
|
{
|
|
|
|
TERMINAL_ID TerminalID;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
2020-09-19 22:05:02 +00:00
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
struct SYMDEF_SCM : CADSTAR_ARCHIVE_PARSER::SYMDEF
|
|
|
|
{
|
2020-09-19 22:05:02 +00:00
|
|
|
std::map<TERMINAL_ID, TERMINAL> Terminals;
|
2020-09-13 21:42:17 +00:00
|
|
|
std::map<TERMINAL_ID, PIN_NUM_LABEL_LOC> PinLabelLocations;
|
|
|
|
std::map<TERMINAL_ID, PIN_NUM_LABEL_LOC> PinNumberLocations;
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct LIBRARY_SCM : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
std::map<SYMDEF_ID, SYMDEF_SCM> SymbolDefinitions;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct SHEETS : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
2020-09-19 22:05:02 +00:00
|
|
|
std::map<LAYER_ID, SHEET_NAME> SheetNames;
|
|
|
|
std::vector<LAYER_ID> SheetOrder; ///< A vector to also store the order in which
|
|
|
|
///< sheets are to be displayed
|
2020-09-13 21:42:17 +00:00
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct COMP : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
wxString Designator = wxEmptyString;
|
|
|
|
bool ReadOnly = false;
|
|
|
|
bool HasLocation = false;
|
|
|
|
ATTRIBUTE_LOCATION AttrLoc;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct PARTREF : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
PART_ID RefID = wxEmptyString;
|
|
|
|
bool ReadOnly = false;
|
|
|
|
bool HasLocation = false;
|
|
|
|
ATTRIBUTE_LOCATION AttrLoc;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct TERMATTR : PARSER
|
2020-11-15 14:42:01 +00:00
|
|
|
{
|
2023-03-26 14:54:21 +00:00
|
|
|
TERMINAL_ID TerminalID;
|
|
|
|
std::vector<ATTRIBUTE_VALUE> Attributes;
|
2020-11-15 14:42:01 +00:00
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-11-15 14:42:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct SYMPINNAME_LABEL : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
TERMINAL_ID TerminalID;
|
2020-09-19 22:05:02 +00:00
|
|
|
wxString NameOrLabel;
|
2020-09-13 21:42:17 +00:00
|
|
|
bool HasLocation = false;
|
|
|
|
ATTRIBUTE_LOCATION AttrLoc;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct SYMBOLVARIANT : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
enum class TYPE
|
|
|
|
{
|
|
|
|
GLOBALSIGNAL,
|
2021-02-17 16:57:26 +00:00
|
|
|
SIGNALREF,
|
|
|
|
TESTPOINT
|
2020-09-13 21:42:17 +00:00
|
|
|
//TODO: there might be others
|
2020-09-19 22:05:02 +00:00
|
|
|
};
|
2020-09-13 21:42:17 +00:00
|
|
|
|
2020-09-19 22:05:02 +00:00
|
|
|
TYPE Type;
|
2021-02-17 16:57:26 +00:00
|
|
|
wxString Reference = wxEmptyString;
|
2020-09-13 21:42:17 +00:00
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct SIGNALREFERENCELINK : CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION
|
|
|
|
{
|
|
|
|
wxString Text; ///< This contains the numbers of the other sheets where the
|
|
|
|
///< signal reference is present separated by commas
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct SYMBOL : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
struct PIN_NUM : PARSER
|
2020-09-26 13:27:03 +00:00
|
|
|
{
|
|
|
|
TERMINAL_ID TerminalID;
|
|
|
|
long PinNum;
|
|
|
|
bool HasLocation = false;
|
|
|
|
ATTRIBUTE_LOCATION AttrLoc;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-26 13:27:03 +00:00
|
|
|
};
|
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
SYMBOL_ID ID;
|
|
|
|
SYMDEF_ID SymdefID;
|
|
|
|
LAYER_ID LayerID; ///< Sheet on which symbol is located
|
|
|
|
POINT Origin;
|
|
|
|
GROUP_ID GroupID = wxEmptyString; ///< If not empty, this symbol is part of a group
|
|
|
|
REUSEBLOCKREF ReuseBlockRef;
|
|
|
|
long OrientAngle = 0;
|
|
|
|
bool Mirror = false;
|
|
|
|
bool Fixed = false;
|
2020-11-23 20:54:34 +00:00
|
|
|
long ScaleRatioNumerator = 1; ///< Symbols can be arbitrarily scaled in CADSTAR
|
|
|
|
long ScaleRatioDenominator = 1;
|
2020-09-13 21:42:17 +00:00
|
|
|
READABILITY Readability = READABILITY::BOTTOM_TO_TOP;
|
|
|
|
|
|
|
|
bool IsComponent = false;
|
|
|
|
COMP ComponentRef;
|
|
|
|
bool HasPartRef = false;
|
|
|
|
PARTREF PartRef;
|
|
|
|
bool PartNameVisible = true;
|
|
|
|
GATE_ID GateID; ///< The gate this symbol represents within the associated Part
|
|
|
|
|
2020-09-19 22:05:02 +00:00
|
|
|
bool IsSymbolVariant = false;
|
|
|
|
SYMBOLVARIANT SymbolVariant;
|
2020-09-13 21:42:17 +00:00
|
|
|
SIGNALREFERENCELINK SigRefLink; ///< Signal References (a special form of global signal)
|
2020-09-19 22:05:02 +00:00
|
|
|
///< have annotations showing the location of all the
|
2020-09-13 21:42:17 +00:00
|
|
|
///< other sheets where the signal is present
|
|
|
|
|
|
|
|
SYMBOL_ID VariantParentSymbolID = wxEmptyString;
|
|
|
|
VARIANT_ID VariantID = wxEmptyString;
|
|
|
|
|
2020-11-15 14:42:01 +00:00
|
|
|
std::map<TERMINAL_ID, TERMATTR> TerminalAttributes;
|
2020-11-18 23:26:27 +00:00
|
|
|
std::map<TERMINAL_ID, SYMPINNAME_LABEL> PinLabels; ///< Equivalent to KiCad's Pin Name
|
|
|
|
std::map<TERMINAL_ID, SYMPINNAME_LABEL> PinNames; ///< Identifier of the pin in the PCB
|
|
|
|
///< Equivalent to KiCad's Pin Number
|
|
|
|
std::map<TERMINAL_ID, PIN_NUM> PinNumbers; ///< This seems to only appear in older
|
|
|
|
///< designs and is similar to PinNames
|
|
|
|
///< but only allowing numerical values
|
2020-09-13 21:42:17 +00:00
|
|
|
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
2020-09-19 22:05:02 +00:00
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
/**
|
|
|
|
* @brief Net name or bus name label
|
|
|
|
*/
|
|
|
|
struct SIGLOC : CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct BUS : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
BUS_ID ID;
|
|
|
|
LINECODE_ID LineCodeID;
|
|
|
|
LAYER_ID LayerID; ///< Sheet on which bus is located
|
|
|
|
SHAPE Shape;
|
|
|
|
wxString Name = wxEmptyString;
|
|
|
|
bool HasBusLabel = false;
|
|
|
|
SIGLOC BusLabel;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct BLOCK : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
enum class TYPE
|
|
|
|
{
|
2020-09-19 22:05:02 +00:00
|
|
|
CLONE, ///< the block is referring to the sheet it is on.
|
2020-09-13 21:42:17 +00:00
|
|
|
PARENT,
|
|
|
|
CHILD
|
|
|
|
};
|
|
|
|
|
2020-09-19 22:05:02 +00:00
|
|
|
BLOCK_ID ID;
|
|
|
|
TYPE Type; ///< Determines what the associated layer is, whether parent, child or clone
|
|
|
|
LAYER_ID LayerID = wxEmptyString; ///< The sheet block is on (TODO: verify this is true)
|
|
|
|
LAYER_ID AssocLayerID = wxEmptyString; ///< Parent or Child linked sheet
|
|
|
|
wxString Name = wxEmptyString;
|
|
|
|
bool HasBlockLabel = false;
|
2020-09-13 21:42:17 +00:00
|
|
|
ATTRIBUTE_LOCATION BlockLabel;
|
|
|
|
|
|
|
|
std::map<TERMINAL_ID, TERMINAL> Terminals;
|
|
|
|
std::map<FIGURE_ID, FIGURE> Figures;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct NET_SCH : CADSTAR_ARCHIVE_PARSER::NET
|
|
|
|
{
|
2020-09-23 20:39:11 +00:00
|
|
|
struct JUNCTION_SCH : CADSTAR_ARCHIVE_PARSER::NET::JUNCTION ///< "JPT" nodename.
|
|
|
|
{
|
|
|
|
TERMINALCODE_ID TerminalCodeID; ///< Usually a circle, but size can be varied
|
2020-12-29 19:38:16 +00:00
|
|
|
bool HasNetLabel = false;
|
|
|
|
SIGLOC NetLabel;
|
2020-09-23 20:39:11 +00:00
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-23 20:39:11 +00:00
|
|
|
};
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct SYM_TERM : PARSER ///< "TERM" nodename (represents a pin in a SCH symbol)
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
NETELEMENT_ID ID; ///< First character is "P"
|
|
|
|
SYMBOL_ID SymbolID;
|
|
|
|
TERMINAL_ID TerminalID;
|
|
|
|
bool HasNetLabel = false;
|
|
|
|
SIGLOC NetLabel;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
2021-06-09 19:32:58 +00:00
|
|
|
struct BUS_TERM : PARSER ///< "BUSTERM" nodename (represents a connection to a bus)
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
NETELEMENT_ID ID; ///< First two characters "BT"
|
|
|
|
BUS_ID BusID;
|
|
|
|
POINT FirstPoint; ///< Point on the bus itself
|
|
|
|
POINT SecondPoint; ///< Start point for any wires
|
|
|
|
bool HasNetLabel = false;
|
|
|
|
SIGLOC NetLabel;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
2021-06-09 19:32:58 +00:00
|
|
|
struct BLOCK_TERM : PARSER ///< "BLOCKTERM" nodename (represents a connection to a block)
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
NETELEMENT_ID ID; ///< First four characters "BLKT"
|
|
|
|
BLOCK_ID BlockID;
|
|
|
|
TERMINAL_ID TerminalID;
|
|
|
|
bool HasNetLabel = false;
|
|
|
|
SIGLOC NetLabel;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
2020-09-26 13:27:03 +00:00
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
struct DANGLER : PARSER ///< "DANGLER" nodename (represents a dangling wire)
|
2020-09-26 13:27:03 +00:00
|
|
|
{
|
|
|
|
NETELEMENT_ID ID; ///< First character "D"
|
|
|
|
TERMINALCODE_ID TerminalCodeID;
|
|
|
|
LAYER_ID LayerID;
|
|
|
|
POINT Position;
|
|
|
|
bool HasNetLabel = false;
|
|
|
|
SIGLOC NetLabel;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-26 13:27:03 +00:00
|
|
|
};
|
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
struct CONNECTION_SCH : CADSTAR_ARCHIVE_PARSER::NET::CONNECTION ///< "CONN" nodename
|
|
|
|
{
|
|
|
|
LAYER_ID LayerID; ///< Sheet on which the connection is drawn
|
|
|
|
std::vector<POINT> Path;
|
|
|
|
GROUP_ID GroupID = wxEmptyString;
|
|
|
|
REUSEBLOCKREF ReuseBlockRef;
|
|
|
|
LINECODE_ID ConnectionLineCode;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
2020-09-23 20:39:11 +00:00
|
|
|
std::map<NETELEMENT_ID, JUNCTION_SCH> Junctions;
|
|
|
|
std::map<NETELEMENT_ID, SYM_TERM> Terminals;
|
|
|
|
std::map<NETELEMENT_ID, BUS_TERM> BusTerminals;
|
|
|
|
std::map<NETELEMENT_ID, BLOCK_TERM> BlockTerminals;
|
2020-09-26 13:27:03 +00:00
|
|
|
std::map<NETELEMENT_ID, DANGLER> Danglers;
|
2020-09-23 20:39:11 +00:00
|
|
|
std::vector<CONNECTION_SCH> Connections;
|
2020-09-13 21:42:17 +00:00
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-02-13 20:00:17 +00:00
|
|
|
struct CADSTAR_SCHEMATIC : PARSER
|
2020-09-13 21:42:17 +00:00
|
|
|
{
|
|
|
|
std::map<GROUP_ID, GROUP> Groups;
|
|
|
|
std::map<REUSEBLOCK_ID, REUSEBLOCK> ReuseBlocks;
|
|
|
|
std::map<FIGURE_ID, FIGURE> Figures;
|
|
|
|
std::map<SYMBOL_ID, SYMBOL> Symbols;
|
|
|
|
std::map<BUS_ID, BUS> Buses;
|
|
|
|
std::map<BLOCK_ID, BLOCK> Blocks;
|
|
|
|
std::map<NET_ID, NET_SCH> Nets;
|
|
|
|
std::map<TEXT_ID, TEXT> Texts;
|
|
|
|
std::map<DOCUMENTATION_SYMBOL_ID, DOCUMENTATION_SYMBOL> DocumentationSymbols;
|
|
|
|
VARIANT_HIERARCHY VariantHierarchy;
|
|
|
|
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues;
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
2020-09-13 21:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-02-13 20:00:17 +00:00
|
|
|
wxString Filename;
|
|
|
|
HEADER Header;
|
|
|
|
ASSIGNMENTS_SCM Assignments;
|
|
|
|
LIBRARY_SCM Library;
|
|
|
|
PARTS Parts;
|
|
|
|
SHEETS Sheets;
|
|
|
|
CADSTAR_SCHEMATIC Schematic;
|
|
|
|
ATTRCOLORS AttrColors;
|
|
|
|
PARTNAMECOL SymbolPartNameColor;
|
2020-09-13 21:42:17 +00:00
|
|
|
|
2021-02-18 18:02:49 +00:00
|
|
|
int KiCadUnitDivider; ///<Use this value to convert units in this CSA file to KiCad units
|
2020-09-08 19:51:22 +00:00
|
|
|
|
2023-02-27 22:55:20 +00:00
|
|
|
private:
|
|
|
|
XNODE* m_rootNode; // Currently parsed root node
|
|
|
|
|
2020-09-08 19:51:22 +00:00
|
|
|
}; //CADSTAR_SCH_ARCHIVE_PARSER
|
|
|
|
|
|
|
|
#endif // CADSTAR_SCH_ARCHIVE_PARSER_H_
|