KiCad PCB EDA Suite
CADSTAR_SCH_ARCHIVE_PARSER Class Reference

Represents a CADSTAR Schematic Archive (*.csa) file. More...

#include <cadstar_sch_archive_parser.h>

Inheritance diagram for CADSTAR_SCH_ARCHIVE_PARSER:
CADSTAR_ARCHIVE_PARSER CADSTAR_SCH_ARCHIVE_LOADER

Classes

struct  ASSIGNMENTS_SCM
 
struct  BLOCK
 
struct  BUS
 
struct  CADSTAR_SCHEMATIC
 
struct  CODEDEFS_SCM
 
struct  COMP
 
struct  LIBRARY_SCM
 
struct  NET_SCH
 
struct  PARTREF
 
struct  PIN_NUM_LABEL_LOC
 
struct  SHEETS
 
struct  SIGLOC
 Net name or bus name label. More...
 
struct  SIGNALREFERENCELINK
 
struct  SYMBOL
 
struct  SYMBOLVARIANT
 
struct  SYMDEF_SCM
 
struct  SYMPINNAME_LABEL
 
struct  TERMATTR
 
struct  TERMINAL
 
struct  TERMINAL_SHAPE
 
struct  TERMINALCODE
 

Public Types

enum class  TERMINAL_SHAPE_TYPE {
  ANNULUS , BOX , BULLET , CIRCLE ,
  CROSS , DIAMOND , FINGER , OCTAGON ,
  PLUS , POINTER , RECTANGLE , ROUNDED_RECT ,
  SQUARE , STAR , TRIANGLE , UNDEFINED
}
 
typedef wxString TERMINALCODE_ID
 
typedef wxString SYMBOL_ID
 
typedef wxString BUS_ID
 
typedef wxString BLOCK_ID
 
typedef wxString SHEET_NAME
 
enum class  TEXT_FIELD_NAME {
  DESIGN_TITLE , SHORT_JOBNAME , LONG_JOBNAME , NUM_OF_SHEETS ,
  SHEET_NUMBER , SHEET_NAME , VARIANT_NAME , VARIANT_DESCRIPTION ,
  REG_USER , COMPANY_NAME , CURRENT_USER , DATE ,
  TIME , MACHINE_NAME , FROM_FILE , DISTANCE ,
  UNITS_SHORT , UNITS_ABBREV , UNITS_FULL , HYPERLINK ,
  NONE
}
 These are special fields in text objects enclosed between the tokens '<@' and '>' such as <@[FIELD_NAME][FIELD_VALUE]>. More...
 
enum class  RESOLUTION { HUNDREDTH_MICRON }
 
enum class  LINESTYLE {
  SOLID , DASH , DASHDOT , DASHDOTDOT ,
  DOT
}
 
enum class  VERTEX_TYPE {
  POINT , CLOCKWISE_ARC , CLOCKWISE_SEMICIRCLE , ANTICLOCKWISE_ARC ,
  ANTICLOCKWISE_SEMICIRCLE
}
 
enum class  SHAPE_TYPE { OPENSHAPE , OUTLINE , SOLID , HATCHED }
 
enum class  UNITS {
  DESIGN , THOU , INCH , MICROMETRE ,
  MM , CENTIMETER , METER
}
 
enum class  ANGUNITS { DEGREES , RADIANS }
 
enum class  GRID_TYPE { FRACTIONALGRID , STEPGRID }
 
enum class  ALIGNMENT {
  NO_ALIGNMENT , TOPLEFT , TOPCENTER , TOPRIGHT ,
  CENTERLEFT , CENTERCENTER , CENTERRIGHT , BOTTOMLEFT ,
  BOTTOMCENTER , BOTTOMRIGHT
}
 From CADSTAR Help: "Text Alignment enables you to define the position of an alignment origin for all text items in CADSTAR. More...
 
enum class  JUSTIFICATION { LEFT , CENTER , RIGHT }
 From CADSTAR Help: "Multi Line Text can also be justified as Left, Centre or Right. More...
 
enum class  READABILITY { BOTTOM_TO_TOP , TOP_TO_BOTTOM }
 Sets the readability direction of text. More...
 
enum class  ATTROWNER {
  ALL_ITEMS , AREA , BOARD , COMPONENT ,
  CONNECTION , COPPER , DOCSYMBOL , FIGURE ,
  NET , NETCLASS , PART , PART_DEFINITION ,
  PIN , SIGNALREF , SYMBOL , SYMDEF ,
  TEMPLATE , TESTPOINT
}
 
enum class  ATTRUSAGE {
  BOTH , COMPONENT , PART_DEFINITION , PART_LIBRARY ,
  SYMBOL , UNDEFINED
}
 
enum class  SWAP_RULE { NO_SWAP , USE_SWAP_LAYER , BOTH }
 Corresponds to "Display when" Item property. More...
 
typedef wxString LINECODE_ID
 
typedef wxString HATCHCODE_ID
 
typedef wxString ROUTECODE_ID
 
typedef wxString NETCLASS_ID
 
typedef wxString SPACING_CLASS_ID
 
typedef wxString TEXTCODE_ID
 
typedef wxString LAYER_ID
 ID of a Sheet (if schematic) or board Layer (if PCB) More...
 
typedef wxString VARIANT_ID
 
typedef wxString ATTRIBUTE_ID
 
typedef wxString SYMDEF_ID
 
typedef wxString PART_ID
 
typedef wxString GATE_ID
 
typedef long TERMINAL_ID
 Terminal is the pin identifier in the schematic. More...
 
typedef long PART_DEFINITION_PIN_ID
 Pin identifier in the part definition. More...
 
typedef long PART_PIN_ID
 Pin identifier in the part. More...
 
typedef wxString TEXT_ID
 
typedef wxString FIGURE_ID
 
typedef wxString GROUP_ID
 
typedef wxString REUSEBLOCK_ID
 
typedef wxString NET_ID
 
typedef wxString NETELEMENT_ID
 
typedef wxString DOCUMENTATION_SYMBOL_ID
 
typedef wxString COLOR_ID
 

Public Member Functions

 CADSTAR_SCH_ARCHIVE_PARSER (wxString aFilename)
 
virtual ~CADSTAR_SCH_ARCHIVE_PARSER ()
 
void Parse ()
 Parses the file. More...
 

Static Public Member Functions

static TERMINAL_SHAPE_TYPE ParseTermShapeType (const wxString &aShapeStr)
 
static wxString ParseTextFields (const wxString &aTextString, PARSER_CONTEXT *aParserContext)
 Replaces CADSTAR fields for the equivalent in KiCad and stores the field values in aParserContext. More...
 
static UNITS ParseUnits (XNODE *aNode)
 
static ANGUNITS ParseAngunits (XNODE *aNode)
 
static ALIGNMENT ParseAlignment (XNODE *aNode)
 
static JUSTIFICATION ParseJustification (XNODE *aNode)
 
static READABILITY ParseReadability (XNODE *aNode)
 
static SWAP_RULE ParseSwapRule (XNODE *aNode)
 
static void InsertAttributeAtEnd (XNODE *aNode, wxString aValue)
 
static XNODELoadArchiveFile (const wxString &aFileName, const wxString &aFileTypeIdentifier, PROGRESS_REPORTER *aProgressReporter=nullptr)
 Reads a CADSTAR Archive file (S-parameter format) More...
 
static bool IsValidAttribute (wxXmlAttribute *aAttribute)
 
static wxString GetXmlAttributeIDString (XNODE *aNode, unsigned int aID, bool aIsRequired=true)
 
static long GetXmlAttributeIDLong (XNODE *aNode, unsigned int aID, bool aIsRequired=true)
 
static void CheckNoChildNodes (XNODE *aNode)
 
static void CheckNoNextNodes (XNODE *aNode)
 
static void ParseChildEValue (XNODE *aNode, PARSER_CONTEXT *aContext, EVALUE &aValueToParse)
 
static std::vector< POINTParseAllChildPoints (XNODE *aNode, PARSER_CONTEXT *aContext, bool aTestAllChildNodes=false, int aExpectedNumPoints=UNDEFINED_VALUE)
 if no children are present, it just returns an empty vector (without throwing an exception) More...
 
static std::vector< VERTEXParseAllChildVertices (XNODE *aNode, PARSER_CONTEXT *aContext, bool aTestAllChildNodes=false)
 if no children are present, it just returns an empty vector (without throwing an exception) More...
 
static std::vector< CUTOUTParseAllChildCutouts (XNODE *aNode, PARSER_CONTEXT *aContext, bool aTestAllChildNodes=false)
 if no children are present, it just returns an empty vector (without throwing an exception) More...
 
static long GetNumberOfChildNodes (XNODE *aNode)
 
static long GetNumberOfStepsForReporting (XNODE *aRootNode, std::vector< wxString > aSubNodeChildrenToCount)
 
static wxString HandleTextOverbar (wxString aCadstarString)
 Convert a string with CADSTAR overbar characters to equivalent in KiCad. More...
 
static void FixTextPositionNoAlignment (EDA_TEXT *aKiCadTextItem)
 Corrects the position of a text element that had NO_ALIGNMENT in CADSTAR. More...
 
static wxString generateLibName (const wxString &aRefName, const wxString &aAlternateName)
 

Public Attributes

wxString Filename
 
HEADER Header
 
ASSIGNMENTS_SCM Assignments
 
LIBRARY_SCM Library
 
PARTS Parts
 
SHEETS Sheets
 
CADSTAR_SCHEMATIC Schematic
 
ATTRCOLORS AttrColors
 
PARTNAMECOL SymbolPartNameColor
 
int KiCadUnitDivider
 Use this value to convert units in this CSA file to KiCad units. More...
 

Static Public Attributes

static const long UNDEFINED_VALUE = -1
 
static const double TXT_HEIGHT_RATIO = ( 24.0 - 5.0 ) / 24.0
 CADSTAR fonts are drawn on a 24x24 integer matrix, where the each axis goes from 0 to 24. More...
 
static const std::map< TEXT_FIELD_NAME, wxString > CADSTAR_TO_KICAD_FIELDS
 Map between CADSTAR fields and KiCad text variables. More...
 
static const long FONT_NORMAL = 400
 
static const long FONT_BOLD = 700
 

Protected Member Functions

void checkPoint ()
 Updates m_progressReporter or throws if user cancelled. More...
 

Protected Attributes

PARSER_CONTEXT m_context
 
PROGRESS_REPORTERm_progressReporter
 

Private Attributes

XNODEm_rootNode
 

Detailed Description

Represents a CADSTAR Schematic Archive (*.csa) file.

Definition at line 35 of file cadstar_sch_archive_parser.h.

Member Typedef Documentation

◆ ATTRIBUTE_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_ID
inherited

Definition at line 107 of file cadstar_archive_parser.h.

◆ BLOCK_ID

Definition at line 61 of file cadstar_sch_archive_parser.h.

◆ BUS_ID

Definition at line 60 of file cadstar_sch_archive_parser.h.

◆ COLOR_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::COLOR_ID
inherited

Definition at line 121 of file cadstar_archive_parser.h.

◆ DOCUMENTATION_SYMBOL_ID

Definition at line 120 of file cadstar_archive_parser.h.

◆ FIGURE_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::FIGURE_ID
inherited

Definition at line 115 of file cadstar_archive_parser.h.

◆ GATE_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::GATE_ID
inherited

Definition at line 110 of file cadstar_archive_parser.h.

◆ GROUP_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::GROUP_ID
inherited

Definition at line 116 of file cadstar_archive_parser.h.

◆ HATCHCODE_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::HATCHCODE_ID
inherited

Definition at line 100 of file cadstar_archive_parser.h.

◆ LAYER_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::LAYER_ID
inherited

ID of a Sheet (if schematic) or board Layer (if PCB)

Definition at line 105 of file cadstar_archive_parser.h.

◆ LINECODE_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::LINECODE_ID
inherited

Definition at line 99 of file cadstar_archive_parser.h.

◆ NET_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::NET_ID
inherited

Definition at line 118 of file cadstar_archive_parser.h.

◆ NETCLASS_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::NETCLASS_ID
inherited

Definition at line 102 of file cadstar_archive_parser.h.

◆ NETELEMENT_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::NETELEMENT_ID
inherited

Definition at line 119 of file cadstar_archive_parser.h.

◆ PART_DEFINITION_PIN_ID

Pin identifier in the part definition.

Definition at line 112 of file cadstar_archive_parser.h.

◆ PART_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::PART_ID
inherited

Definition at line 109 of file cadstar_archive_parser.h.

◆ PART_PIN_ID

typedef long CADSTAR_ARCHIVE_PARSER::PART_PIN_ID
inherited

Pin identifier in the part.

Definition at line 113 of file cadstar_archive_parser.h.

◆ REUSEBLOCK_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::REUSEBLOCK_ID
inherited

Definition at line 117 of file cadstar_archive_parser.h.

◆ ROUTECODE_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::ROUTECODE_ID
inherited

Definition at line 101 of file cadstar_archive_parser.h.

◆ SHEET_NAME

Definition at line 62 of file cadstar_sch_archive_parser.h.

◆ SPACING_CLASS_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::SPACING_CLASS_ID
inherited

Definition at line 103 of file cadstar_archive_parser.h.

◆ SYMBOL_ID

Definition at line 59 of file cadstar_sch_archive_parser.h.

◆ SYMDEF_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::SYMDEF_ID
inherited

Definition at line 108 of file cadstar_archive_parser.h.

◆ TERMINAL_ID

typedef long CADSTAR_ARCHIVE_PARSER::TERMINAL_ID
inherited

Terminal is the pin identifier in the schematic.

Definition at line 111 of file cadstar_archive_parser.h.

◆ TERMINALCODE_ID

Definition at line 58 of file cadstar_sch_archive_parser.h.

◆ TEXT_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::TEXT_ID
inherited

Definition at line 114 of file cadstar_archive_parser.h.

◆ TEXTCODE_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::TEXTCODE_ID
inherited

Definition at line 104 of file cadstar_archive_parser.h.

◆ VARIANT_ID

typedef wxString CADSTAR_ARCHIVE_PARSER::VARIANT_ID
inherited

Definition at line 106 of file cadstar_archive_parser.h.

Member Enumeration Documentation

◆ ALIGNMENT

enum class CADSTAR_ARCHIVE_PARSER::ALIGNMENT
stronginherited

From CADSTAR Help: "Text Alignment enables you to define the position of an alignment origin for all text items in CADSTAR.

The alignment origin is a point on or within the text boundary and defines how the text is displayed.

For example, with an alignment of bottom-right the origin will be positioned at the bottom right of the text boundary. This makes it easier to right-align several text items regardless of the length of text displayed.

Text Alignment applies to all CADSTAR text. [...]

Note: Unaligned text operates in the way CADSTAR text always has. In most cases this behaves as Bottom Left alignment, but there are a few exceptions, e.g. pin names. Also unaligned multiline text has an origin Bottom Left of the first line."

See also JUSTIFICATION

Enumerator
NO_ALIGNMENT 

NO_ALIGNMENT has different meaning depending on the object type.

TOPLEFT 
TOPCENTER 
TOPRIGHT 
CENTERLEFT 
CENTERCENTER 
CENTERRIGHT 
BOTTOMLEFT 
BOTTOMCENTER 
BOTTOMRIGHT 

Definition at line 608 of file cadstar_archive_parser.h.

609 {
610 NO_ALIGNMENT,
611 TOPLEFT,
612 TOPCENTER,
613 TOPRIGHT,
614 CENTERLEFT,
615 CENTERCENTER,
616 CENTERRIGHT,
617 BOTTOMLEFT,
618 BOTTOMCENTER,
619 BOTTOMRIGHT
620 };

◆ ANGUNITS

enum class CADSTAR_ARCHIVE_PARSER::ANGUNITS
stronginherited
Enumerator
DEGREES 
RADIANS 

Definition at line 518 of file cadstar_archive_parser.h.

519 {
520 DEGREES,
521 RADIANS
522 };

◆ ATTROWNER

enum class CADSTAR_ARCHIVE_PARSER::ATTROWNER
stronginherited
Enumerator
ALL_ITEMS 
AREA 
BOARD 
COMPONENT 
CONNECTION 
COPPER 
DOCSYMBOL 
FIGURE 
NET 
NETCLASS 
PART 

Only library Attributes.

PART_DEFINITION 

Only library Attributes.

PIN 
SIGNALREF 
SYMBOL 
SYMDEF 
TEMPLATE 
TESTPOINT 

Definition at line 662 of file cadstar_archive_parser.h.

663 {
664 ALL_ITEMS,
665 AREA,
666 BOARD,
667 COMPONENT,
668 CONNECTION,
669 COPPER,
670 DOCSYMBOL,
671 FIGURE,
672 NET,
673 NETCLASS,
674 PART,
675 PART_DEFINITION,
676 PIN,
677 SIGNALREF,
678 SYMBOL,
679 SYMDEF,
680 TEMPLATE,
682 };
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:269
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:85
A collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:47
@ TESTPOINT
a test point pad
@ NET
This item represents a net.

◆ ATTRUSAGE

enum class CADSTAR_ARCHIVE_PARSER::ATTRUSAGE
stronginherited
Enumerator
BOTH 

From CADSTAR Help: Assigned to both Schematic symbols and PCB components, and displayed on Schematic and PCB designs.

COMPONENT 

From CADSTAR Help: Assigned to PCB components and displayed on PCB designs.

PART_DEFINITION 

From CADSTAR Help: Assigned to Parts library Definitions and displayed by the Library searcher.

PART_LIBRARY 

From CADSTAR Help: Only used by non-Cadstar applications.

SYMBOL 

From CADSTAR Help: Assigned to Schematic Symbols and displayed on Schematic Designs.

UNDEFINED 

Note: It seems that some attribute have no "ATTRUSAGE" defined.

It appears that the attributes that fall under this category are the ones associated with the design itself (i.e. not inherited from the library)

Definition at line 685 of file cadstar_archive_parser.h.

686 {
687 BOTH,
689 COMPONENT,
690 PART_DEFINITION,
692 PART_LIBRARY,
693 SYMBOL,
695 UNDEFINED
698 };

◆ GRID_TYPE

enum class CADSTAR_ARCHIVE_PARSER::GRID_TYPE
stronginherited
Enumerator
FRACTIONALGRID 

Param1 = Units, Param2 = Divisor.

The grid is equal in X and Y dimensions with a step size equal to Param1/Param2

STEPGRID 

Param1 = X Step, Param2 = Y Step. A standard x,y grid.

Definition at line 528 of file cadstar_archive_parser.h.

529 {
530 FRACTIONALGRID,
532 STEPGRID
533 };

◆ JUSTIFICATION

enum class CADSTAR_ARCHIVE_PARSER::JUSTIFICATION
stronginherited

From CADSTAR Help: "Multi Line Text can also be justified as Left, Centre or Right.

This does not affect the text alignment. Note: Justification of single line text has no effect."

This only affects multiline text

See also ALIGNMENT

Enumerator
LEFT 
CENTER 
RIGHT 

Definition at line 634 of file cadstar_archive_parser.h.

◆ LINESTYLE

enum class CADSTAR_ARCHIVE_PARSER::LINESTYLE
stronginherited
Enumerator
SOLID 
DASH 
DASHDOT 
DASHDOTDOT 
DOT 

Definition at line 287 of file cadstar_archive_parser.h.

◆ READABILITY

enum class CADSTAR_ARCHIVE_PARSER::READABILITY
stronginherited

Sets the readability direction of text.

From CADSTAR Help: "Horizontal text will always be displayed from left to right (i.e. never upside down). Vertical text can be set as readable from either the left or right edge of the design."

I.e. Vertical text can either be rotated 90 degrees clockwise or 90 degrees anticlockwise from horizontal. This does not impact vertical text

Enumerator
BOTTOM_TO_TOP 

When text is vertical, show it rotated 90 degrees anticlockwise.

TOP_TO_BOTTOM 

When text is vertical, show it rotated 90 degrees clockwise.

Definition at line 652 of file cadstar_archive_parser.h.

653 {
654 BOTTOM_TO_TOP,
655 TOP_TO_BOTTOM
656 };

◆ RESOLUTION

enum class CADSTAR_ARCHIVE_PARSER::RESOLUTION
stronginherited
Enumerator
HUNDREDTH_MICRON 

Definition at line 249 of file cadstar_archive_parser.h.

250 {
251 HUNDREDTH_MICRON
252 };

◆ SHAPE_TYPE

enum class CADSTAR_ARCHIVE_PARSER::SHAPE_TYPE
stronginherited
Enumerator
OPENSHAPE 

Unfilled open shape. Cannot have cutouts.

OUTLINE 

Unfilled closed shape.

SOLID 

Filled closed shape (solid fill).

HATCHED 

Filled closed shape (hatch fill).

Definition at line 474 of file cadstar_archive_parser.h.

475 {
476 OPENSHAPE,
477 OUTLINE,
478 SOLID,
479 HATCHED
480 };

◆ SWAP_RULE

enum class CADSTAR_ARCHIVE_PARSER::SWAP_RULE
stronginherited

Corresponds to "Display when" Item property.

From CADSTAR Help: "This parameter enables you to make the visibility of a component outline/area (or an area of component copper, or a string of component text) dependent on the current mirror status of the component. For example, you may require a string of component text to be displayed only when the component is mirrored."

Enumerator
NO_SWAP 

Display when Unmirrored.

USE_SWAP_LAYER 

Display when Mirrored.

BOTH 

Always display (Mirrored and Unmirrored)

Definition at line 842 of file cadstar_archive_parser.h.

843 {
844 NO_SWAP,
845 USE_SWAP_LAYER,
846 BOTH
847 };

◆ TERMINAL_SHAPE_TYPE

Enumerator
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)

Definition at line 65 of file cadstar_sch_archive_parser.h.

66 {
67 ANNULUS,
68 BOX,
69 BULLET,
70 CIRCLE,
71 CROSS,
72 DIAMOND,
73 FINGER,
74 OCTAGON,
75 PLUS,
76 POINTER,
78 ROUNDED_RECT,
79 SQUARE,
80 STAR,
83 };
Represent basic circle geometry with utility geometry functions.
Definition: circle.h:33
A triangle object.
Definition: triangle_3d.h:43

◆ TEXT_FIELD_NAME

enum class CADSTAR_ARCHIVE_PARSER::TEXT_FIELD_NAME
stronginherited

These are special fields in text objects enclosed between the tokens '<@' and '>' such as <@[FIELD_NAME][FIELD_VALUE]>.

For example: "<@DESIGN TITLEProject [email protected]>"

Enumerator
DESIGN_TITLE 
SHORT_JOBNAME 
LONG_JOBNAME 
NUM_OF_SHEETS 
SHEET_NUMBER 
SHEET_NAME 
VARIANT_NAME 
VARIANT_DESCRIPTION 
REG_USER 
COMPANY_NAME 
CURRENT_USER 
DATE 
TIME 
MACHINE_NAME 
FROM_FILE 
DISTANCE 
UNITS_SHORT 
UNITS_ABBREV 
UNITS_FULL 
HYPERLINK 
NONE 

Synthetic for flagging.

Definition at line 142 of file cadstar_archive_parser.h.

143 {
144 DESIGN_TITLE,
145 SHORT_JOBNAME,
146 LONG_JOBNAME,
147 NUM_OF_SHEETS,
148 SHEET_NUMBER,
150 VARIANT_NAME,
151 VARIANT_DESCRIPTION,
152 REG_USER,
153 COMPANY_NAME,
154 CURRENT_USER,
155 DATE,
156 TIME,
157 MACHINE_NAME,
158 FROM_FILE,
159 DISTANCE,
160 UNITS_SHORT,
161 UNITS_ABBREV,
162 UNITS_FULL,
163 HYPERLINK,
164 NONE
165 };
@ NONE
Definition: kibis.h:53

◆ UNITS

enum class CADSTAR_ARCHIVE_PARSER::UNITS
stronginherited
Enumerator
DESIGN 

Inherits from design units (assumed Assignments->Technology->Units)

THOU 
INCH 
MICROMETRE 
MM 
CENTIMETER 
METER 

Definition at line 503 of file cadstar_archive_parser.h.

504 {
505 DESIGN,
506 THOU,
507 INCH,
508 MICROMETRE,
509 MM,
511 METER
512 };
@ INCH
Definition: rs274x.cpp:64

◆ VERTEX_TYPE

enum class CADSTAR_ARCHIVE_PARSER::VERTEX_TYPE
stronginherited
Enumerator
POINT 
CLOCKWISE_ARC 
CLOCKWISE_SEMICIRCLE 
ANTICLOCKWISE_ARC 
ANTICLOCKWISE_SEMICIRCLE 

Definition at line 428 of file cadstar_archive_parser.h.

429 {
430 POINT,
431 CLOCKWISE_ARC,
432 CLOCKWISE_SEMICIRCLE,
433 ANTICLOCKWISE_ARC,
434 ANTICLOCKWISE_SEMICIRCLE
435 };

Constructor & Destructor Documentation

◆ CADSTAR_SCH_ARCHIVE_PARSER()

CADSTAR_SCH_ARCHIVE_PARSER::CADSTAR_SCH_ARCHIVE_PARSER ( wxString  aFilename)
inlineexplicit

Definition at line 38 of file cadstar_sch_archive_parser.h.

◆ ~CADSTAR_SCH_ARCHIVE_PARSER()

virtual CADSTAR_SCH_ARCHIVE_PARSER::~CADSTAR_SCH_ARCHIVE_PARSER ( )
inlinevirtual

Definition at line 44 of file cadstar_sch_archive_parser.h.

45 {
46 if( m_rootNode )
47 delete m_rootNode;
48 }

References m_rootNode.

Member Function Documentation

◆ CheckNoChildNodes()

◆ CheckNoNextNodes()

void CADSTAR_ARCHIVE_PARSER::CheckNoNextNodes ( XNODE aNode)
staticinherited

◆ checkPoint()

void CADSTAR_ARCHIVE_PARSER::checkPoint ( )
protectedinherited

Updates m_progressReporter or throws if user cancelled.

Definition at line 2774 of file cadstar_archive_parser.cpp.

2775{
2776 if( m_progressReporter )
2777 {
2779
2781 THROW_IO_ERROR( _( "File import cancelled by user." ) );
2782 }
2783}
PROGRESS_REPORTER * m_progressReporter
virtual bool KeepRefreshing(bool aWait=false)=0
Update the UI (if any).
virtual void AdvanceProgress()=0
Increment the progress bar length (inside the current virtual zone).
#define _(s)
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:38

References _, PROGRESS_REPORTER::AdvanceProgress(), PROGRESS_REPORTER::KeepRefreshing(), CADSTAR_ARCHIVE_PARSER::m_progressReporter, and THROW_IO_ERROR.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), CADSTAR_SCH_ARCHIVE_LOADER::Load(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary(), Parse(), and CADSTAR_PCB_ARCHIVE_PARSER::Parse().

◆ FixTextPositionNoAlignment()

void CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment ( EDA_TEXT aKiCadTextItem)
staticinherited

Corrects the position of a text element that had NO_ALIGNMENT in CADSTAR.

Assumes that the provided text element has been initialised with a position and orientation.

Parameters
aKiCadTextItema Kicad item to correct

Definition at line 2747 of file cadstar_archive_parser.cpp.

2748{
2749 if( !aKiCadTextItem->GetText().IsEmpty() )
2750 {
2751 VECTOR2I positionOffset( 0, aKiCadTextItem->GetInterline() );
2752 RotatePoint( positionOffset, aKiCadTextItem->GetTextAngle() );
2753
2754 EDA_ITEM* textEdaItem = dynamic_cast<EDA_ITEM*>( aKiCadTextItem );
2755
2756 if( textEdaItem &&
2757 ( textEdaItem->Type() == LIB_TEXT_T || textEdaItem->Type() == LIB_FIELD_T ) )
2758 {
2759 // Y coordinate increases upwards in the symbol editor
2760 positionOffset.y = -positionOffset.y;
2761 }
2762
2763 //Count num of additional lines
2764 wxString text = aKiCadTextItem->GetText();
2765 int numExtraLines = text.Replace( "\n", "\n" );
2766 numExtraLines -= text.at( text.size() - 1 ) == '\n'; // Ignore new line character at end
2767 positionOffset.x *= numExtraLines;
2768 positionOffset.y *= numExtraLines;
2769
2770 aKiCadTextItem->Offset( positionOffset );
2771 }
2772}
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:120
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
int GetInterline() const
Return the distance between two lines of text.
Definition: eda_text.cpp:499
void Offset(const VECTOR2I &aOffset)
Definition: eda_text.cpp:391
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
@ LIB_TEXT_T
Definition: typeinfo.h:200
@ LIB_FIELD_T
Definition: typeinfo.h:208

References EDA_TEXT::GetInterline(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), LIB_FIELD_T, LIB_TEXT_T, EDA_TEXT::Offset(), RotatePoint(), text, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), and CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText().

◆ generateLibName()

static wxString CADSTAR_ARCHIVE_PARSER::generateLibName ( const wxString &  aRefName,
const wxString &  aAlternateName 
)
inlinestaticinherited

Definition at line 1436 of file cadstar_archive_parser.h.

1437 {
1438 return aRefName
1439 + ( ( aAlternateName.size() > 0 ) ? ( wxT( " (" ) + aAlternateName + wxT( ")" ) )
1440 : wxString( wxT( "" ) ) );
1441 }

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary().

◆ GetNumberOfChildNodes()

long CADSTAR_ARCHIVE_PARSER::GetNumberOfChildNodes ( XNODE aNode)
staticinherited

Definition at line 2705 of file cadstar_archive_parser.cpp.

2706{
2707 XNODE* childNodes = aNode->GetChildren();
2708 long retval = 0;
2709
2710 for( ; childNodes; childNodes = childNodes->GetNext() )
2711 retval++;
2712
2713 return retval;
2714}
Hold an XML or S-expression element.
Definition: xnode.h:44

References XNODE::GetChildren(), and XNODE::GetNext().

Referenced by CADSTAR_ARCHIVE_PARSER::GetNumberOfStepsForReporting().

◆ GetNumberOfStepsForReporting()

long CADSTAR_ARCHIVE_PARSER::GetNumberOfStepsForReporting ( XNODE aRootNode,
std::vector< wxString >  aSubNodeChildrenToCount 
)
staticinherited

Definition at line 2717 of file cadstar_archive_parser.cpp.

2718{
2719 XNODE* level1Node = aRootNode->GetChildren();
2720 long retval = 0;
2721
2722 for( ; level1Node; level1Node = level1Node->GetNext() )
2723 {
2724 for( wxString childNodeName : aSubNodeChildrenToCount )
2725 {
2726 if( level1Node->GetName() == childNodeName )
2727 retval += GetNumberOfChildNodes( level1Node );
2728 }
2729
2730 retval++;
2731 }
2732
2733 return retval;
2734}
static long GetNumberOfChildNodes(XNODE *aNode)

References XNODE::GetChildren(), XNODE::GetNext(), and CADSTAR_ARCHIVE_PARSER::GetNumberOfChildNodes().

Referenced by Parse(), and CADSTAR_PCB_ARCHIVE_PARSER::Parse().

◆ GetXmlAttributeIDLong()

long CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDLong ( XNODE aNode,
unsigned int  aID,
bool  aIsRequired = true 
)
staticinherited
Parameters
aNode
aID
aIsRequiredPrevents exception throwing if false.
Returns
returns the value (long) of attribute "attrX" in aNode where 'X' is aID
Exceptions
IO_ERRORif attribute does not exist

Definition at line 2577 of file cadstar_archive_parser.cpp.

2579{
2580 long retVal;
2581 bool success = GetXmlAttributeIDString( aNode, aID, aIsRequired ).ToLong( &retVal );
2582
2583 if( !success )
2584 {
2585 if( aIsRequired )
2586 THROW_PARSING_IO_ERROR( std::to_string( aID ), aNode->GetName() );
2587 else
2588 return UNDEFINED_VALUE;
2589 }
2590
2591 return retVal;
2592}
#define THROW_PARSING_IO_ERROR(param, location)
static const long UNDEFINED_VALUE
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)

References CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), THROW_PARSING_IO_ERROR, and CADSTAR_ARCHIVE_PARSER::UNDEFINED_VALUE.

Referenced by CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::ROUTE_VERTEX::Parse(), CADSTAR_ARCHIVE_PARSER::FORMAT::Parse(), CADSTAR_ARCHIVE_PARSER::HATCH::Parse(), CADSTAR_ARCHIVE_PARSER::FONT::Parse(), CADSTAR_ARCHIVE_PARSER::TEXTCODE::Parse(), CADSTAR_ARCHIVE_PARSER::ROUTEREASSIGN::Parse(), CADSTAR_ARCHIVE_PARSER::ROUTECODE::Parse(), CADSTAR_ARCHIVE_PARSER::POINT::Parse(), CADSTAR_ARCHIVE_PARSER::LONGPOINT::Parse(), CADSTAR_ARCHIVE_PARSER::GRID::Parse(), CADSTAR_ARCHIVE_PARSER::ATTRNAME::COLUMNORDER::Parse(), CADSTAR_ARCHIVE_PARSER::ATTRNAME::COLUMNWIDTH::Parse(), CADSTAR_ARCHIVE_PARSER::TEXT_LOCATION::Parse(), CADSTAR_ARCHIVE_PARSER::REUSEBLOCK::Parse(), CADSTAR_ARCHIVE_PARSER::PART::DEFINITION::GATE::Parse(), CADSTAR_ARCHIVE_PARSER::PART::DEFINITION::PIN::Parse(), CADSTAR_ARCHIVE_PARSER::PART::DEFINITION::Parse(), CADSTAR_ARCHIVE_PARSER::PART::PART_PIN::Parse(), CADSTAR_ARCHIVE_PARSER::PART::Parse(), CADSTAR_ARCHIVE_PARSER::DOCUMENTATION_SYMBOL::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL_SHAPE::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::PIN_NUM_LABEL_LOC::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::TERMATTR::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::SYMPINNAME_LABEL::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::PIN_NUM::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::SYM_TERM::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BLOCK_TERM::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::LAYER::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COPREASSIGN::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COPPERCODE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::SPACINGCODE::REASSIGN::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::SPACINGCODE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::CADSTAR_PAD_SHAPE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::PADCODE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::VIACODE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::LAYERPAIR::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::SPCCLASSSPACE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::TECHNOLOGY_SECTION::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_PAD::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::ARROW::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::TEXTFORMAT::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::EXTENSION_LINE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::SYMDEF_PCB::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::AREA::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::PIN_ATTRIBUTE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::PADEXCEPTION::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::PIN::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::COPPER_TERMINAL::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::TEMPLATE::POURING::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COPPER::NETREF::COPPER_TERM::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::DRILL_TABLE::Parse(), CADSTAR_ARCHIVE_PARSER::TEXT::Parse(), CADSTAR_ARCHIVE_PARSER::SETTINGS::ParseSubNode(), CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::ParseSubNode(), CADSTAR_ARCHIVE_PARSER::SYMDEF::ParseSubNode(), and CADSTAR_ARCHIVE_PARSER::NET::ParseSubNode().

◆ GetXmlAttributeIDString()

wxString CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString ( XNODE aNode,
unsigned int  aID,
bool  aIsRequired = true 
)
staticinherited
Parameters
aNode
aID
aIsRequiredPrevents exception throwing if false.
Returns
returns the value (wxString) of attribute "attrX" in aNode where 'X' is aID
Exceptions
IO_ERRORif attribute does not exist

Definition at line 2558 of file cadstar_archive_parser.cpp.

2560{
2561 wxString attrName, retVal;
2562 attrName = "attr";
2563 attrName << aID;
2564
2565 if( !aNode->GetAttribute( attrName, &retVal ) )
2566 {
2567 if( aIsRequired )
2568 THROW_MISSING_PARAMETER_IO_ERROR( std::to_string( aID ), aNode->GetName() );
2569 else
2570 return wxEmptyString;
2571 }
2572
2573 return retVal;
2574}
#define THROW_MISSING_PARAMETER_IO_ERROR(param, location)

References THROW_MISSING_PARAMETER_IO_ERROR.

Referenced by CADSTAR_ARCHIVE_PARSER::PART::GetPinType(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDLong(), CADSTAR_ARCHIVE_PARSER::FORMAT::Parse(), CADSTAR_ARCHIVE_PARSER::TIMESTAMP::Parse(), CADSTAR_ARCHIVE_PARSER::HEADER::Parse(), CADSTAR_ARCHIVE_PARSER::VARIANT::Parse(), CADSTAR_ARCHIVE_PARSER::LINECODE::Parse(), CADSTAR_ARCHIVE_PARSER::HATCHCODE::Parse(), CADSTAR_ARCHIVE_PARSER::FONT::Parse(), CADSTAR_ARCHIVE_PARSER::TEXTCODE::Parse(), CADSTAR_ARCHIVE_PARSER::ROUTEREASSIGN::Parse(), CADSTAR_ARCHIVE_PARSER::ROUTECODE::Parse(), CADSTAR_ARCHIVE_PARSER::EVALUE::Parse(), CADSTAR_ARCHIVE_PARSER::SHAPE::Parse(), CADSTAR_ARCHIVE_PARSER::GRID::Parse(), CADSTAR_ARCHIVE_PARSER::ATTRNAME::Parse(), CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_VALUE::Parse(), CADSTAR_ARCHIVE_PARSER::TEXT_LOCATION::Parse(), CADSTAR_ARCHIVE_PARSER::CADSTAR_NETCLASS::Parse(), CADSTAR_ARCHIVE_PARSER::SPCCLASSNAME::Parse(), CADSTAR_ARCHIVE_PARSER::REUSEBLOCK::Parse(), CADSTAR_ARCHIVE_PARSER::REUSEBLOCKREF::Parse(), CADSTAR_ARCHIVE_PARSER::GROUP::Parse(), CADSTAR_ARCHIVE_PARSER::FIGURE::Parse(), CADSTAR_ARCHIVE_PARSER::PART::DEFINITION::GATE::Parse(), CADSTAR_ARCHIVE_PARSER::PART::DEFINITION::PIN::Parse(), CADSTAR_ARCHIVE_PARSER::PART::DEFINITION::SWAP_GROUP::Parse(), CADSTAR_ARCHIVE_PARSER::PART::DEFINITION::Parse(), CADSTAR_ARCHIVE_PARSER::PART::PART_PIN::Parse(), CADSTAR_ARCHIVE_PARSER::PART::Parse(), CADSTAR_ARCHIVE_PARSER::DOCUMENTATION_SYMBOL::Parse(), CADSTAR_ARCHIVE_PARSER::DFLTSETTINGS::Parse(), CADSTAR_ARCHIVE_PARSER::ATTRCOL::Parse(), CADSTAR_ARCHIVE_PARSER::PARTNAMECOL::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::TERMINALCODE::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::PIN_NUM_LABEL_LOC::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::SHEETS::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::COMP::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::PARTREF::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::SYMPINNAME_LABEL::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::SYMBOLVARIANT::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::SIGNALREFERENCELINK::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::SIGLOC::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::BUS::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::BLOCK::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::JUNCTION_SCH::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::SYM_TERM::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BUS_TERM::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BLOCK_TERM::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::DANGLER::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::CONNECTION_SCH::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::MATERIAL::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::LAYER::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::LAYERDEFS::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COPREASSIGN::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COPPERCODE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::SPACINGCODE::REASSIGN::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::SPACINGCODE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::PADREASSIGN::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::PADCODE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::VIAREASSIGN::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::VIACODE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::LAYERPAIR::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::SPCCLASSSPACE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::RULESET::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_COPPER::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_AREA::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_PAD::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::ARROW::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::TEXTFORMAT::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::EXTENSION_LINE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::CADSTAR_BOARD::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::AREA::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::PADEXCEPTION::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::TRUNK::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::PIN::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::JUNCTION_PCB::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::VIA::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::COPPER_TERMINAL::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::ROUTE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::CONNECTION_PCB::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::TEMPLATE::POURING::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::TEMPLATE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COPPER::NETREF::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COPPER::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::DRILL_TABLE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::LAYOUT::Parse(), CADSTAR_ARCHIVE_PARSER::TEXT::Parse(), CADSTAR_ARCHIVE_PARSER::ParseAlignment(), CADSTAR_ARCHIVE_PARSER::ParseAngunits(), CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::ParseIdentifiers(), CADSTAR_ARCHIVE_PARSER::SYMDEF::ParseIdentifiers(), CADSTAR_ARCHIVE_PARSER::NET::JUNCTION::ParseIdentifiers(), CADSTAR_ARCHIVE_PARSER::NET::CONNECTION::ParseIdentifiers(), CADSTAR_ARCHIVE_PARSER::NET::ParseIdentifiers(), CADSTAR_ARCHIVE_PARSER::ParseJustification(), CADSTAR_ARCHIVE_PARSER::ParseReadability(), CADSTAR_ARCHIVE_PARSER::NET::JUNCTION::ParseSubNode(), CADSTAR_ARCHIVE_PARSER::NET::CONNECTION::ParseSubNode(), CADSTAR_ARCHIVE_PARSER::NET::ParseSubNode(), CADSTAR_ARCHIVE_PARSER::ParseSwapRule(), CADSTAR_PCB_ARCHIVE_PARSER::ParseTestlandSide(), and CADSTAR_ARCHIVE_PARSER::ParseUnits().

◆ HandleTextOverbar()

wxString CADSTAR_ARCHIVE_PARSER::HandleTextOverbar ( wxString  aCadstarString)
staticinherited

Convert a string with CADSTAR overbar characters to equivalent in KiCad.

Parameters
aCadstarStringInput string
Returns
KiCad string with overbar characters

Definition at line 2737 of file cadstar_archive_parser.cpp.

2738{
2739 wxString escapedText = aCadstarString;
2740
2741 escapedText.Replace( wxT( "'" ), wxT( "~" ) );
2742
2743 return ConvertToNewOverbarNotation( escapedText );
2744}
wxString ConvertToNewOverbarNotation(const wxString &aOldStr)
Convert the old ~...~ overbar notation to the new ~{...} one.

References ConvertToNewOverbarNotation().

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), CADSTAR_SCH_ARCHIVE_LOADER::loadBusses(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(), and CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary().

◆ InsertAttributeAtEnd()

void CADSTAR_ARCHIVE_PARSER::InsertAttributeAtEnd ( XNODE aNode,
wxString  aValue 
)
staticinherited

Definition at line 2406 of file cadstar_archive_parser.cpp.

2407{
2408 wxString result;
2409 int numAttributes = 0;
2410
2411 if( aNode->GetAttribute( wxT( "numAttributes" ), &result ) )
2412 {
2413 numAttributes = wxAtoi( result );
2414 aNode->DeleteAttribute( wxT( "numAttributes" ) );
2415 ++numAttributes;
2416 }
2417
2418 aNode->AddAttribute( wxT( "numAttributes" ), wxString::Format( wxT( "%i" ), numAttributes ) );
2419
2420 wxString paramName = wxT( "attr" );
2421 paramName << numAttributes;
2422
2423 aNode->AddAttribute( paramName, aValue );
2424}
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References Format().

Referenced by CADSTAR_ARCHIVE_PARSER::LoadArchiveFile().

◆ IsValidAttribute()

◆ LoadArchiveFile()

XNODE * CADSTAR_ARCHIVE_PARSER::LoadArchiveFile ( const wxString &  aFileName,
const wxString &  aFileTypeIdentifier,
PROGRESS_REPORTER aProgressReporter = nullptr 
)
staticinherited

Reads a CADSTAR Archive file (S-parameter format)

Parameters
aFileName
aFileTypeIdentifierIdentifier of the first node in the file to check against. E.g. "CADSTARPCB"
aProgressReporterPointer to a Progress Reporter to report progress to.
Returns
XNODE pointing to the top of the tree for further parsing. Each node has the first element as the node's name and subsequent elements as node attributes ("attr0", "attr1", "attr2", etc.). Caller is responsible for deleting to avoid memory leaks.
Exceptions
IO_ERROR

Definition at line 2427 of file cadstar_archive_parser.cpp.

2429{
2430 KEYWORD emptyKeywords[1] = {};
2431 XNODE* rootNode = nullptr;
2432 XNODE* cNode = nullptr;
2433 XNODE* iNode = nullptr;
2434 int tok;
2435 bool cadstarFileCheckDone = false;
2436 wxString str;
2437 wxCSConv win1252( wxT( "windows-1252" ) );
2438 wxMBConv* conv = &win1252; // Initial testing suggests file encoding to be Windows-1252
2439 // More samples required.
2440
2441 // Open the file and get the file size
2442 FILE* fp = wxFopen( aFileName, wxT( "rt" ) );
2443
2444 if( !fp )
2445 THROW_IO_ERROR( wxString::Format( _( "Cannot open file '%s'" ), aFileName ) );
2446
2447 fseek( fp, 0L, SEEK_END );
2448 long fileSize = ftell( fp );
2449 rewind( fp );
2450
2451 DSNLEXER lexer( emptyKeywords, 0, nullptr, fp, aFileName );
2452
2453 auto currentProgress = [&]() -> double
2454 {
2455 return static_cast<double>( ftell( fp ) ) / fileSize;
2456 };
2457
2458 double previousReportedProgress = -1.0;
2459
2460 while( ( tok = lexer.NextTok() ) != DSN_EOF )
2461 {
2462 if( aProgressReporter && ( currentProgress() - previousReportedProgress ) > 0.01 )
2463 {
2464 if( !aProgressReporter->KeepRefreshing() )
2465 {
2466 delete rootNode;
2467 THROW_IO_ERROR( _( "File import cancelled by user." ) );
2468 }
2469
2470 aProgressReporter->SetCurrentProgress( currentProgress() );
2471 previousReportedProgress = currentProgress();
2472 }
2473
2474 if( tok == DSN_RIGHT )
2475 {
2476 cNode = iNode;
2477 if( cNode )
2478 {
2479 iNode = cNode->GetParent();
2480 }
2481 else
2482 {
2483 //too many closing brackets
2484 delete rootNode;
2485 THROW_IO_ERROR( _( "The selected file is not valid or might be corrupt!" ) );
2486 }
2487 }
2488 else if( tok == DSN_LEFT )
2489 {
2490 tok = lexer.NextTok();
2491 str = wxString( lexer.CurText(), *conv );
2492 cNode = new XNODE( wxXML_ELEMENT_NODE, str );
2493
2494 if( !rootNode )
2495 rootNode = cNode;
2496
2497 if( iNode )
2498 {
2499 //we will add it as attribute as well as child node
2500 InsertAttributeAtEnd( iNode, str );
2501 iNode->AddChild( cNode );
2502 }
2503 else if( !cadstarFileCheckDone )
2504 {
2505 if( cNode->GetName() != aFileTypeIdentifier )
2506 {
2507 delete rootNode;
2508 THROW_IO_ERROR( _( "The selected file is not valid or might be corrupt!" ) );
2509 }
2510
2511 cadstarFileCheckDone = true;
2512 }
2513
2514 iNode = cNode;
2515 }
2516 else if( iNode )
2517 {
2518 str = wxString( lexer.CurText(), *conv );
2519 //Insert even if string is empty
2520 InsertAttributeAtEnd( iNode, str );
2521 }
2522 else
2523 {
2524 //not enough closing brackets
2525 delete rootNode;
2526 THROW_IO_ERROR( _( "The selected file is not valid or might be corrupt!" ) );
2527 }
2528 }
2529
2530 // Not enough closing brackets
2531 if( iNode != nullptr )
2532 {
2533 delete rootNode;
2534 THROW_IO_ERROR( _( "The selected file is not valid or might be corrupt!" ) );
2535 }
2536
2537 // Throw if no data was parsed
2538 if( rootNode )
2539 {
2540 return rootNode;
2541 }
2542 else
2543 {
2544 delete rootNode;
2545 THROW_IO_ERROR( _( "The selected file is not valid or might be corrupt!" ) );
2546 }
2547
2548 return nullptr;
2549}
static void InsertAttributeAtEnd(XNODE *aNode, wxString aValue)
Implement a lexical analyzer for the SPECCTRA DSN file format.
Definition: dsnlexer.h:79
virtual void SetCurrentProgress(double aProgress)=0
Set the progress value to aProgress (0..1).
@ DSN_LEFT
Definition: dsnlexer.h:67
@ DSN_RIGHT
Definition: dsnlexer.h:66
@ DSN_EOF
Definition: dsnlexer.h:69
Hold a keyword string and its unique integer token.
Definition: dsnlexer.h:40

References _, DSNLEXER::CurText(), DSN_EOF, DSN_LEFT, DSN_RIGHT, Format(), XNODE::GetParent(), CADSTAR_ARCHIVE_PARSER::InsertAttributeAtEnd(), PROGRESS_REPORTER::KeepRefreshing(), DSNLEXER::NextTok(), PROGRESS_REPORTER::SetCurrentProgress(), and THROW_IO_ERROR.

Referenced by Parse(), and CADSTAR_PCB_ARCHIVE_PARSER::Parse().

◆ Parse()

void CADSTAR_SCH_ARCHIVE_PARSER::Parse ( )

Parses the file.

Exceptions
IO_ERRORif file could not be opened or there was an error while parsing

Definition at line 33 of file cadstar_sch_archive_parser.cpp.

34{
36 m_progressReporter->BeginPhase( 0 ); // Read file
37
38 m_rootNode = LoadArchiveFile( Filename, wxT( "CADSTARSCM" ), m_progressReporter );
39
41 {
42 m_progressReporter->BeginPhase( 1 ); // Parse File
43
44 std::vector<wxString> subNodeChildrenToCount = { wxT( "LIBRARY" ), wxT( "PARTS" ),
45 wxT( "SCHEMATIC" ) };
46
47 long numOfSteps = GetNumberOfStepsForReporting( m_rootNode, subNodeChildrenToCount );
49 }
50
52
53 XNODE* cNode = m_rootNode->GetChildren();
54
55 if( !cNode )
56 THROW_MISSING_NODE_IO_ERROR( wxT( "HEADER" ), wxT( "CADSTARSCM" ) );
57
58 for( ; cNode; cNode = cNode->GetNext() )
59 {
60 if( cNode->GetName() == wxT( "HEADER" ) )
61 {
62 Header.Parse( cNode, &m_context );
63
64 switch( Header.Resolution )
65 {
67 KiCadUnitDivider = (long) 1e5 / (long) SCH_IU_PER_MM;
68 break;
69
70 default:
71 wxASSERT_MSG( true, wxT( "Unknown File Resolution" ) );
72 break;
73 }
74 }
75 else if( cNode->GetName() == wxT( "ASSIGNMENTS" ) )
76 {
77 Assignments.Parse( cNode, &m_context );
78 }
79 else if( cNode->GetName() == wxT( "LIBRARY" ) )
80 {
81 Library.Parse( cNode, &m_context );
82 }
83 else if( cNode->GetName() == wxT( "DEFAULTS" ) )
84 {
85 // No design information here (no need to parse)
86 // Only contains CADSTAR configuration data such as default shapes, text and units
87 // In future some of this could be converted to KiCad but limited value
88 }
89 else if( cNode->GetName() == wxT( "PARTS" ) )
90 {
91 Parts.Parse( cNode, &m_context );
92 }
93 else if( cNode->GetName() == wxT( "SHEETS" ) )
94 {
95 Sheets.Parse( cNode, &m_context );
96 }
97 else if( cNode->GetName() == wxT( "SCHEMATIC" ) )
98 {
99 Schematic.Parse( cNode, &m_context );
100 }
101 else if( cNode->GetName() == wxT( "DISPLAY" ) )
102 {
103 // For now only interested in Attribute visibilities, in order to set field visibilities
104 // in the imported design
105 XNODE* subNode = cNode->GetChildren();
106
107 for( ; subNode; subNode = subNode->GetNext() )
108 {
109 if( subNode->GetName() == wxT( "ATTRCOLORS" ) )
110 {
111 AttrColors.Parse( subNode, &m_context );
112 }
113 else if( subNode->GetName() == wxT( "SCMITEMCOLORS" ) )
114 {
115 XNODE* sub2Node = subNode->GetChildren();
116
117 for( ; sub2Node; sub2Node = sub2Node->GetNext() )
118 {
119 if( sub2Node->GetName() == wxT( "SYMCOL" ) )
120 {
121 XNODE* sub3Node = sub2Node->GetChildren();
122
123 for( ; sub3Node; sub3Node = sub3Node->GetNext() )
124 {
125 if( sub3Node->GetName() == wxT( "PARTNAMECOL" ) )
126 SymbolPartNameColor.Parse( sub3Node, &m_context );
127 }
128 }
129 }
130 }
131 else
132 {
133 // No design information here
134 // Contains CADSTAR Display settings such as layer/element colours and visibility.
135 // In the future these settings could be converted to KiCad
136 }
137 }
138
139 }
140 else
141 {
142 THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), wxT( "[root]" ) );
143 }
144
145 checkPoint();
146 }
147
148 delete m_rootNode;
149 m_rootNode = nullptr;
150}
constexpr double SCH_IU_PER_MM
Definition: base_units.h:73
#define THROW_MISSING_NODE_IO_ERROR(nodename, location)
static XNODE * LoadArchiveFile(const wxString &aFileName, const wxString &aFileTypeIdentifier, PROGRESS_REPORTER *aProgressReporter=nullptr)
Reads a CADSTAR Archive file (S-parameter format)
void checkPoint()
Updates m_progressReporter or throws if user cancelled.
static long GetNumberOfStepsForReporting(XNODE *aRootNode, std::vector< wxString > aSubNodeChildrenToCount)
virtual void BeginPhase(int aPhase)=0
Initialize the aPhase virtual zone of the dialog progress bar.
virtual void SetMaxProgress(int aMaxProgress)=0
Fix the value that gives the 100 percent progress bar length (inside the current virtual zone).
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
std::function< void()> CheckPointCallback
Callback function to report progress.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override

References Assignments, AttrColors, PROGRESS_REPORTER::BeginPhase(), CADSTAR_ARCHIVE_PARSER::checkPoint(), CADSTAR_ARCHIVE_PARSER::PARSER_CONTEXT::CheckPointCallback, Filename, XNODE::GetChildren(), XNODE::GetNext(), CADSTAR_ARCHIVE_PARSER::GetNumberOfStepsForReporting(), Header, CADSTAR_ARCHIVE_PARSER::HUNDREDTH_MICRON, KiCadUnitDivider, Library, CADSTAR_ARCHIVE_PARSER::LoadArchiveFile(), CADSTAR_ARCHIVE_PARSER::m_context, CADSTAR_ARCHIVE_PARSER::m_progressReporter, m_rootNode, CADSTAR_ARCHIVE_PARSER::HEADER::Parse(), CADSTAR_ARCHIVE_PARSER::PARTS::Parse(), CADSTAR_ARCHIVE_PARSER::ATTRCOLORS::Parse(), CADSTAR_ARCHIVE_PARSER::PARTNAMECOL::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::ASSIGNMENTS_SCM::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::LIBRARY_SCM::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::SHEETS::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::CADSTAR_SCHEMATIC::Parse(), Parts, CADSTAR_ARCHIVE_PARSER::HEADER::Resolution, SCH_IU_PER_MM, Schematic, PROGRESS_REPORTER::SetMaxProgress(), Sheets, SymbolPartNameColor, THROW_MISSING_NODE_IO_ERROR, and THROW_UNKNOWN_NODE_IO_ERROR.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::Load().

◆ ParseAlignment()

CADSTAR_ARCHIVE_PARSER::ALIGNMENT CADSTAR_ARCHIVE_PARSER::ParseAlignment ( XNODE aNode)
staticinherited

Definition at line 1042 of file cadstar_archive_parser.cpp.

1043{
1044 wxASSERT( aNode->GetName() == wxT( "ALIGN" ) );
1045
1046 wxString alignmentStr = GetXmlAttributeIDString( aNode, 0 );
1047
1048 if( alignmentStr == wxT( "BOTTOMCENTER" ) )
1050 else if( alignmentStr == wxT( "BOTTOMLEFT" ) )
1051 return ALIGNMENT::BOTTOMLEFT;
1052 else if( alignmentStr == wxT( "BOTTOMRIGHT" ) )
1054 else if( alignmentStr == wxT( "CENTERCENTER" ) )
1056 else if( alignmentStr == wxT( "CENTERLEFT" ) )
1057 return ALIGNMENT::CENTERLEFT;
1058 else if( alignmentStr == wxT( "CENTERRIGHT" ) )
1060 else if( alignmentStr == wxT( "TOPCENTER" ) )
1061 return ALIGNMENT::TOPCENTER;
1062 else if( alignmentStr == wxT( "TOPLEFT" ) )
1063 return ALIGNMENT::TOPLEFT;
1064 else if( alignmentStr == wxT( "TOPRIGHT" ) )
1065 return ALIGNMENT::TOPRIGHT;
1066 else
1067 THROW_UNKNOWN_PARAMETER_IO_ERROR( alignmentStr, wxT( "ALIGN" ) );
1068
1069 //shouldn't be here but avoids compiler warning
1071}
#define THROW_UNKNOWN_PARAMETER_IO_ERROR(param, location)
@ NO_ALIGNMENT
NO_ALIGNMENT has different meaning depending on the object type.

References CADSTAR_ARCHIVE_PARSER::BOTTOMCENTER, CADSTAR_ARCHIVE_PARSER::BOTTOMLEFT, CADSTAR_ARCHIVE_PARSER::BOTTOMRIGHT, CADSTAR_ARCHIVE_PARSER::CENTERCENTER, CADSTAR_ARCHIVE_PARSER::CENTERLEFT, CADSTAR_ARCHIVE_PARSER::CENTERRIGHT, CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), CADSTAR_ARCHIVE_PARSER::NO_ALIGNMENT, THROW_UNKNOWN_PARAMETER_IO_ERROR, CADSTAR_ARCHIVE_PARSER::TOPCENTER, CADSTAR_ARCHIVE_PARSER::TOPLEFT, and CADSTAR_ARCHIVE_PARSER::TOPRIGHT.

Referenced by CADSTAR_ARCHIVE_PARSER::TEXT_LOCATION::Parse(), CADSTAR_ARCHIVE_PARSER::TEXT::Parse(), and CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::ParseSubNode().

◆ ParseAllChildCutouts()

std::vector< CADSTAR_ARCHIVE_PARSER::CUTOUT > CADSTAR_ARCHIVE_PARSER::ParseAllChildCutouts ( XNODE aNode,
PARSER_CONTEXT aContext,
bool  aTestAllChildNodes = false 
)
staticinherited

if no children are present, it just returns an empty vector (without throwing an exception)

Parameters
aNodecontaining a series of CUTOUT objects
aTestAllChildNodes
aExpectedNumPointsif -1, this is check is disabled
Returns
std::vector containing all CUTOUT objects
Exceptions
IO_ERRORif one of the following:
  • Unable to parse a CUTOUT object
  • aTestAllChildNodes is true and one of the child nodes is not a valid CUTOUT object

Definition at line 2679 of file cadstar_archive_parser.cpp.

2681{
2682 std::vector<CUTOUT> retVal;
2683
2684 XNODE* cNode = aNode->GetChildren();
2685
2686 for( ; cNode; cNode = cNode->GetNext() )
2687 {
2688 if( cNode->GetName() == wxT( "CUTOUT" ) )
2689 {
2690 CUTOUT cutout;
2691 //TODO try.. catch + throw again with more detailed error information
2692 cutout.Parse( cNode, aContext );
2693 retVal.push_back( cutout );
2694 }
2695 else if( aTestAllChildNodes )
2696 {
2697 THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
2698 }
2699 }
2700
2701 return retVal;
2702}
@ CUTOUT
Make a cutout to an existing zone.

References XNODE::GetChildren(), XNODE::GetNext(), CADSTAR_ARCHIVE_PARSER::CUTOUT::Parse(), and THROW_UNKNOWN_NODE_IO_ERROR.

Referenced by CADSTAR_ARCHIVE_PARSER::SHAPE::Parse().

◆ ParseAllChildPoints()

std::vector< CADSTAR_ARCHIVE_PARSER::POINT > CADSTAR_ARCHIVE_PARSER::ParseAllChildPoints ( XNODE aNode,
PARSER_CONTEXT aContext,
bool  aTestAllChildNodes = false,
int  aExpectedNumPoints = UNDEFINED_VALUE 
)
staticinherited

if no children are present, it just returns an empty vector (without throwing an exception)

Parameters
aNodecontaining a series of POINT objects
aTestAllChildNodes
aExpectedNumPointsif UNDEFINED_VALUE (i.e. -1), this is check is disabled
Returns
std::vector containing all POINT objects
Exceptions
IO_ERRORif one of the following:
  • Unable to parse a POINT object
  • aTestAllChildNodes is true and one of the child nodes is not a valid POINT object
  • aExpectedNumPoints is non-negative and the number of POINT objects found is different

Definition at line 2619 of file cadstar_archive_parser.cpp.

2621{
2622 std::vector<POINT> retVal;
2623
2624 XNODE* cNode = aNode->GetChildren();
2625
2626 for( ; cNode; cNode = cNode->GetNext() )
2627 {
2628 if( cNode->GetName() == wxT( "PT" ) )
2629 {
2630 POINT pt;
2631 //TODO try.. catch + throw again with more detailed error information
2632 pt.Parse( cNode, aContext );
2633 retVal.push_back( pt );
2634 }
2635 else if( aTestAllChildNodes )
2636 {
2637 THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
2638 }
2639 }
2640
2641 if( aExpectedNumPoints != UNDEFINED_VALUE
2642 && retVal.size() != static_cast<size_t>( aExpectedNumPoints ) )
2643 {
2645 _( "Unexpected number of points in '%s'. Found %d but expected %d." ),
2646 aNode->GetName(), retVal.size(), aExpectedNumPoints ) );
2647 }
2648
2649 return retVal;
2650}

References _, Format(), XNODE::GetChildren(), XNODE::GetNext(), CADSTAR_ARCHIVE_PARSER::POINT::Parse(), THROW_IO_ERROR, THROW_UNKNOWN_NODE_IO_ERROR, and CADSTAR_ARCHIVE_PARSER::UNDEFINED_VALUE.

Referenced by CADSTAR_ARCHIVE_PARSER::VERTEX::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::CONNECTION_SCH::Parse(), and CADSTAR_ARCHIVE_PARSER::SETTINGS::ParseSubNode().

◆ ParseAllChildVertices()

std::vector< CADSTAR_ARCHIVE_PARSER::VERTEX > CADSTAR_ARCHIVE_PARSER::ParseAllChildVertices ( XNODE aNode,
PARSER_CONTEXT aContext,
bool  aTestAllChildNodes = false 
)
staticinherited

if no children are present, it just returns an empty vector (without throwing an exception)

Parameters
aNodecontaining a series of VERTEX objects
aTestAllChildNodes
aExpectedNumPointsif -1, this is check is disabled
Returns
std::vector containing all VERTEX objects
Exceptions
IO_ERRORif one of the following:
  • Unable to parse a VERTEX object
  • aTestAllChildNodes is true and one of the child nodes is not a valid VERTEX object

Definition at line 2653 of file cadstar_archive_parser.cpp.

2655{
2656 std::vector<VERTEX> retVal;
2657
2658 XNODE* cNode = aNode->GetChildren();
2659
2660 for( ; cNode; cNode = cNode->GetNext() )
2661 {
2662 if( VERTEX::IsVertex( cNode ) )
2663 {
2664 VERTEX vertex;
2665 //TODO try.. catch + throw again with more detailed error information
2666 vertex.Parse( cNode, aContext );
2667 retVal.push_back( vertex );
2668 }
2669 else if( aTestAllChildNodes )
2670 {
2671 THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
2672 }
2673 }
2674
2675 return retVal;
2676}

References XNODE::GetChildren(), XNODE::GetNext(), CADSTAR_ARCHIVE_PARSER::VERTEX::IsVertex(), CADSTAR_ARCHIVE_PARSER::VERTEX::Parse(), and THROW_UNKNOWN_NODE_IO_ERROR.

Referenced by CADSTAR_ARCHIVE_PARSER::CUTOUT::Parse(), and CADSTAR_ARCHIVE_PARSER::SHAPE::Parse().

◆ ParseAngunits()

CADSTAR_ARCHIVE_PARSER::ANGUNITS CADSTAR_ARCHIVE_PARSER::ParseAngunits ( XNODE aNode)
staticinherited

Definition at line 681 of file cadstar_archive_parser.cpp.

682{
683 wxASSERT( aNode->GetName() == wxT( "ANGUNITS" ) );
684
685 wxString angUnitStr = GetXmlAttributeIDString( aNode, 0 );
686
687 if( angUnitStr == wxT( "DEGREES" ) )
688 return ANGUNITS::DEGREES;
689 else if( angUnitStr == wxT( "RADIANS" ) )
690 return ANGUNITS::RADIANS;
691 else
692 THROW_UNKNOWN_PARAMETER_IO_ERROR( angUnitStr, aNode->GetName() );
693
694 return ANGUNITS();
695}

References CADSTAR_ARCHIVE_PARSER::DEGREES, CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), CADSTAR_ARCHIVE_PARSER::RADIANS, and THROW_UNKNOWN_PARAMETER_IO_ERROR.

Referenced by CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Parse().

◆ ParseChildEValue()

void CADSTAR_ARCHIVE_PARSER::ParseChildEValue ( XNODE aNode,
PARSER_CONTEXT aContext,
EVALUE aValueToParse 
)
staticinherited
Parameters
aNodewith a child node containing an EVALUE
aValueToParse
Exceptions
IO_ERRORif unable to parse or node is not an EVALUE

Definition at line 2609 of file cadstar_archive_parser.cpp.

2611{
2612 if( aNode->GetChildren()->GetName() == wxT( "E" ) )
2613 aValueToParse.Parse( aNode->GetChildren(), aContext );
2614 else
2615 THROW_UNKNOWN_NODE_IO_ERROR( aNode->GetChildren()->GetName(), aNode->GetName() );
2616}

References XNODE::GetChildren(), CADSTAR_ARCHIVE_PARSER::EVALUE::Parse(), and THROW_UNKNOWN_NODE_IO_ERROR.

Referenced by CADSTAR_PCB_ARCHIVE_PARSER::MATERIAL::Parse().

◆ ParseJustification()

CADSTAR_ARCHIVE_PARSER::JUSTIFICATION CADSTAR_ARCHIVE_PARSER::ParseJustification ( XNODE aNode)
staticinherited

Definition at line 1074 of file cadstar_archive_parser.cpp.

1075{
1076 wxASSERT( aNode->GetName() == wxT( "JUSTIFICATION" ) );
1077
1078 wxString justificationStr = GetXmlAttributeIDString( aNode, 0 );
1079
1080 if( justificationStr == wxT( "LEFT" ) )
1081 return JUSTIFICATION::LEFT;
1082 else if( justificationStr == wxT( "RIGHT" ) )
1083 return JUSTIFICATION::RIGHT;
1084 else if( justificationStr == wxT( "CENTER" ) )
1085 return JUSTIFICATION::CENTER;
1086 else
1087 THROW_UNKNOWN_PARAMETER_IO_ERROR( justificationStr, wxT( "JUSTIFICATION" ) );
1088
1089 return JUSTIFICATION::LEFT;
1090}

References CADSTAR_ARCHIVE_PARSER::CENTER, CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), CADSTAR_ARCHIVE_PARSER::LEFT, CADSTAR_ARCHIVE_PARSER::RIGHT, and THROW_UNKNOWN_PARAMETER_IO_ERROR.

Referenced by CADSTAR_ARCHIVE_PARSER::TEXT_LOCATION::Parse(), CADSTAR_ARCHIVE_PARSER::TEXT::Parse(), and CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::ParseSubNode().

◆ ParseReadability()

CADSTAR_ARCHIVE_PARSER::READABILITY CADSTAR_ARCHIVE_PARSER::ParseReadability ( XNODE aNode)
staticinherited

Definition at line 1093 of file cadstar_archive_parser.cpp.

1094{
1095 wxASSERT( aNode->GetName() == wxT( "READABILITY" ) );
1096
1097 wxString readabilityStr = GetXmlAttributeIDString( aNode, 0 );
1098
1099 if( readabilityStr == wxT( "BOTTOM_TO_TOP" ) )
1101 else if( readabilityStr == wxT( "TOP_TO_BOTTOM" ) )
1103 else
1104 THROW_UNKNOWN_PARAMETER_IO_ERROR( readabilityStr, wxT( "READABILITY" ) );
1105
1107}
@ BOTTOM_TO_TOP
When text is vertical, show it rotated 90 degrees anticlockwise.
@ TOP_TO_BOTTOM
When text is vertical, show it rotated 90 degrees clockwise.

References CADSTAR_ARCHIVE_PARSER::BOTTOM_TO_TOP, CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), THROW_UNKNOWN_PARAMETER_IO_ERROR, and CADSTAR_ARCHIVE_PARSER::TOP_TO_BOTTOM.

Referenced by CADSTAR_ARCHIVE_PARSER::DOCUMENTATION_SYMBOL::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Parse(), and CADSTAR_PCB_ARCHIVE_PARSER::DRILL_TABLE::Parse().

◆ ParseSwapRule()

CADSTAR_ARCHIVE_PARSER::SWAP_RULE CADSTAR_ARCHIVE_PARSER::ParseSwapRule ( XNODE aNode)
staticinherited

Definition at line 1505 of file cadstar_archive_parser.cpp.

1506{
1507 wxASSERT( aNode->GetName() == wxT( "SWAPRULE" ) );
1508
1509 SWAP_RULE retval;
1510 wxString swapRuleStr = GetXmlAttributeIDString( aNode, 0 );
1511
1512 if( swapRuleStr == wxT( "NO_SWAP" ) )
1513 retval = SWAP_RULE::NO_SWAP;
1514 else if( swapRuleStr == wxT( "USE_SWAP_LAYER" ) )
1516 else
1517 THROW_UNKNOWN_PARAMETER_IO_ERROR( swapRuleStr, wxT( "SWAPRULE" ) );
1518
1519 return retval;
1520}
SWAP_RULE
Corresponds to "Display when" Item property.
@ USE_SWAP_LAYER
Display when Mirrored.
@ NO_SWAP
Display when Unmirrored.

References CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), CADSTAR_ARCHIVE_PARSER::NO_SWAP, THROW_UNKNOWN_PARAMETER_IO_ERROR, and CADSTAR_ARCHIVE_PARSER::USE_SWAP_LAYER.

Referenced by CADSTAR_ARCHIVE_PARSER::FIGURE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_COPPER::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_AREA::Parse(), and CADSTAR_ARCHIVE_PARSER::TEXT::Parse().

◆ ParseTermShapeType()

CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL_SHAPE_TYPE CADSTAR_SCH_ARCHIVE_PARSER::ParseTermShapeType ( const wxString &  aShapeStr)
static

Definition at line 153 of file cadstar_sch_archive_parser.cpp.

155{
156 if( aShapeStr == wxT( "ANNULUS" ) )
158 else if( aShapeStr == wxT( "BOX" ) )
160 else if( aShapeStr == wxT( "BULLET" ) )
162 else if( aShapeStr == wxT( "ROUND" ) )
164 else if( aShapeStr == wxT( "CROSS" ) )
166 else if( aShapeStr == wxT( "DIAMOND" ) )
168 else if( aShapeStr == wxT( "FINGER" ) )
170 else if( aShapeStr == wxT( "OCTAGON" ) )
172 else if( aShapeStr == wxT( "PLUS" ) )
174 else if( aShapeStr == wxT( "POINTER" ) )
176 else if( aShapeStr == wxT( "RECTANGLE" ) )
178 else if( aShapeStr == wxT( "ROUNDED" ) )
180 else if( aShapeStr == wxT( "SQUARE" ) )
182 else if( aShapeStr == wxT( "STAR" ) )
184 else if( aShapeStr == wxT( "TRIANGLE" ) )
186 else
188}
@ UNDEFINED
Only used for error checking (not a real shape)

References ANNULUS, BOX, BULLET, CIRCLE, CROSS, DIAMOND, FINGER, OCTAGON, PLUS, POINTER, RECTANGLE, ROUNDED_RECT, SQUARE, STAR, TRIANGLE, and UNDEFINED.

Referenced by CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL_SHAPE::IsTermShape(), and CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL_SHAPE::Parse().

◆ ParseTextFields()

wxString CADSTAR_ARCHIVE_PARSER::ParseTextFields ( const wxString &  aTextString,
PARSER_CONTEXT aParserContext 
)
staticinherited

Replaces CADSTAR fields for the equivalent in KiCad and stores the field values in aParserContext.

Parameters
aTextStringText string to parse
aParserContextPARSER_CONTEXT in which to store the values of the found fields
Returns

Definition at line 848 of file cadstar_archive_parser.cpp.

850{
851 static const std::map<TEXT_FIELD_NAME, wxString> txtTokens =
852 {
853 { TEXT_FIELD_NAME::DESIGN_TITLE, wxT( "DESIGN TITLE" ) },
854 { TEXT_FIELD_NAME::SHORT_JOBNAME, wxT( "SHORT_JOBNAME" ) },
855 { TEXT_FIELD_NAME::LONG_JOBNAME, wxT( "LONG_JOBNAME" ) },
856 { TEXT_FIELD_NAME::NUM_OF_SHEETS, wxT( "NUM_OF_SHEETS" ) },
857 { TEXT_FIELD_NAME::SHEET_NUMBER, wxT( "SHEET_NUMBER" ) },
858 { TEXT_FIELD_NAME::SHEET_NAME, wxT( "SHEET_NAME" ) },
859 { TEXT_FIELD_NAME::VARIANT_NAME, wxT( "VARIANT_NAME" ) },
860 { TEXT_FIELD_NAME::VARIANT_DESCRIPTION, wxT( "VARIANT_DESCRIPTION" ) },
861 { TEXT_FIELD_NAME::REG_USER, wxT( "REG_USER" ) },
862 { TEXT_FIELD_NAME::COMPANY_NAME, wxT( "COMPANY_NAME" ) },
863 { TEXT_FIELD_NAME::CURRENT_USER, wxT( "CURRENT_USER" ) },
864 { TEXT_FIELD_NAME::DATE, wxT( "DATE" ) },
865 { TEXT_FIELD_NAME::TIME, wxT( "TIME" ) },
866 { TEXT_FIELD_NAME::MACHINE_NAME, wxT( "MACHINE_NAME" ) },
867 { TEXT_FIELD_NAME::FROM_FILE, wxT( "FROM_FILE" ) },
868 { TEXT_FIELD_NAME::DISTANCE, wxT( "DISTANCE" ) },
869 { TEXT_FIELD_NAME::UNITS_SHORT, wxT( "UNITS SHORT" ) },
870 { TEXT_FIELD_NAME::UNITS_ABBREV, wxT( "UNITS ABBREV" ) },
871 { TEXT_FIELD_NAME::UNITS_FULL, wxT( "UNITS FULL" ) },
872 { TEXT_FIELD_NAME::HYPERLINK, wxT( "HYPERLINK" ) }
873 };
874
875 wxString remainingStr = aTextString;
876 wxString returnStr;
877
878 while( remainingStr.size() > 0 )
879 {
880 //Find the start token
881 size_t startpos = remainingStr.Find( wxT( "<@" ) );
882
883 if( static_cast<int>( startpos ) == wxNOT_FOUND )
884 {
885 // No more fields to parse, add to return string
886 returnStr += remainingStr;
887 break;
888 }
889
890 if( startpos > 0 )
891 returnStr += remainingStr.SubString( 0, startpos - 1 );
892
893 if( ( startpos + 2 ) >= remainingStr.size() )
894 break;
895
896 remainingStr = remainingStr.Mid( startpos + 2 );
897
898 //Find the expected token for the field
900
901 for( std::pair<TEXT_FIELD_NAME, wxString> txtF : txtTokens )
902 {
903 if( remainingStr.StartsWith( txtF.second ) )
904 {
905 foundField = txtF.first;
906 break;
907 }
908 }
909
910 if( foundField == TEXT_FIELD_NAME::NONE )
911 {
912 // Not a valid field, lets keep looking
913 returnStr += wxT( "<@" );
914 continue;
915 }
916
917 //Now lets find the end token
918 size_t endpos = remainingStr.Find( wxT( "@>" ) );
919
920 if( static_cast<int>( endpos ) == wxNOT_FOUND )
921 {
922 // The field we found isn't valid as it doesn't have a termination
923 // Lets append the whole thing as plain text
924 returnStr += wxT( "<@" ) + remainingStr;
925 break;
926 }
927
928 size_t valueStart = txtTokens.at( foundField ).size();
929 wxString fieldValue = remainingStr.SubString( valueStart, endpos - 1 );
930 wxString address;
931
932 if( foundField == TEXT_FIELD_NAME::FROM_FILE || foundField == TEXT_FIELD_NAME::HYPERLINK )
933 {
934 // The first character should always be a double quotation mark
935 wxASSERT_MSG( fieldValue.at( 0 ) == '"', "Expected '\"' as the first character" );
936
937 size_t splitPos = fieldValue.find_first_of( '"', 1 );
938 address = fieldValue.SubString( 1, splitPos - 1 );
939
940 if( foundField == TEXT_FIELD_NAME::HYPERLINK )
941 {
942 // Assume the last two characters are "@>"
943 wxASSERT_MSG( remainingStr.EndsWith( wxT( "@>" ) ),
944 "Expected '@>' at the end of a hyperlink" );
945
946 fieldValue = remainingStr.SubString( valueStart + splitPos + 1,
947 remainingStr.Length() - 3 );
948
949 remainingStr = wxEmptyString;
950 }
951 else
952 {
953 fieldValue = fieldValue.Mid( splitPos + 1 );
954 }
955 }
956
957 switch( foundField )
958 {
970
971 if( aContext->TextFieldToValuesMap.find( foundField )
972 != aContext->TextFieldToValuesMap.end() )
973 {
974 aContext->InconsistentTextFields.insert( foundField );
975 }
976 else
977 {
978 aContext->TextFieldToValuesMap.insert( { foundField, fieldValue } );
979 }
980
982
986 returnStr += wxT( "${" ) + CADSTAR_TO_KICAD_FIELDS.at( foundField ) + wxT( "}" );
987 break;
988
993 // Just flatten the text for distances
994 returnStr += fieldValue;
995 break;
996
998 {
999 wxFileName fn( address );
1000 wxString fieldFmt = wxT( "FROM_FILE_%s_%s" );
1001 wxString fieldName = wxString::Format( fieldFmt, fn.GetName(), fn.GetExt() );
1002
1003 int version = 1;
1004
1005 while(
1006 aContext->FilenamesToTextMap.find( fieldName )
1007 != aContext->FilenamesToTextMap.end()
1008 && aContext->FilenamesToTextMap.at( fieldName ) != fieldValue )
1009 {
1010 fieldName = wxString::Format( fieldFmt, fn.GetName(), fn.GetExt() )
1011 + wxString::Format( wxT( "_%d" ), version++ );
1012 }
1013
1014 aContext->FilenamesToTextMap[fieldName] = fieldValue;
1015 returnStr += wxT( "${" ) + fieldName + wxT( "}" );
1016 }
1017 break;
1018
1020 {
1021 aContext->TextToHyperlinksMap[fieldValue] = address;
1022 returnStr += ParseTextFields( fieldValue, aContext );
1023 }
1024 break;
1025
1027 wxFAIL_MSG( "We should have already covered this scenario above" );
1028 break;
1029 }
1030
1031
1032 if( ( endpos + 2 ) >= remainingStr.size() )
1033 break;
1034
1035 remainingStr = remainingStr.Mid( endpos + 2 );
1036 }
1037
1038 return returnStr;
1039}
static const std::map< TEXT_FIELD_NAME, wxString > CADSTAR_TO_KICAD_FIELDS
Map between CADSTAR fields and KiCad text variables.
TEXT_FIELD_NAME
These are special fields in text objects enclosed between the tokens '<@' and '>' such as <@[FIELD_NA...
static wxString ParseTextFields(const wxString &aTextString, PARSER_CONTEXT *aParserContext)
Replaces CADSTAR fields for the equivalent in KiCad and stores the field values in aParserContext.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83

References CADSTAR_ARCHIVE_PARSER::CADSTAR_TO_KICAD_FIELDS, CADSTAR_ARCHIVE_PARSER::COMPANY_NAME, CADSTAR_ARCHIVE_PARSER::CURRENT_USER, CADSTAR_ARCHIVE_PARSER::DATE, CADSTAR_ARCHIVE_PARSER::DESIGN_TITLE, CADSTAR_ARCHIVE_PARSER::DISTANCE, CADSTAR_ARCHIVE_PARSER::PARSER_CONTEXT::FilenamesToTextMap, Format(), CADSTAR_ARCHIVE_PARSER::FROM_FILE, CADSTAR_ARCHIVE_PARSER::HYPERLINK, CADSTAR_ARCHIVE_PARSER::PARSER_CONTEXT::InconsistentTextFields, KI_FALLTHROUGH, CADSTAR_ARCHIVE_PARSER::LONG_JOBNAME, CADSTAR_ARCHIVE_PARSER::MACHINE_NAME, CADSTAR_ARCHIVE_PARSER::NONE, CADSTAR_ARCHIVE_PARSER::NUM_OF_SHEETS, CADSTAR_ARCHIVE_PARSER::ParseTextFields(), CADSTAR_ARCHIVE_PARSER::REG_USER, CADSTAR_ARCHIVE_PARSER::SHEET_NAME, CADSTAR_ARCHIVE_PARSER::SHEET_NUMBER, CADSTAR_ARCHIVE_PARSER::SHORT_JOBNAME, CADSTAR_ARCHIVE_PARSER::PARSER_CONTEXT::TextFieldToValuesMap, CADSTAR_ARCHIVE_PARSER::PARSER_CONTEXT::TextToHyperlinksMap, CADSTAR_ARCHIVE_PARSER::TIME, CADSTAR_ARCHIVE_PARSER::UNITS_ABBREV, CADSTAR_ARCHIVE_PARSER::UNITS_FULL, CADSTAR_ARCHIVE_PARSER::UNITS_SHORT, CADSTAR_ARCHIVE_PARSER::VARIANT_DESCRIPTION, and CADSTAR_ARCHIVE_PARSER::VARIANT_NAME.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), CADSTAR_ARCHIVE_PARSER::TEXT::Parse(), and CADSTAR_ARCHIVE_PARSER::ParseTextFields().

◆ ParseUnits()

CADSTAR_ARCHIVE_PARSER::UNITS CADSTAR_ARCHIVE_PARSER::ParseUnits ( XNODE aNode)
staticinherited

Definition at line 654 of file cadstar_archive_parser.cpp.

655{
656 wxASSERT( aNode->GetName() == wxT( "UNITS" ) );
657
658 wxString unit = GetXmlAttributeIDString( aNode, 0 );
659
660 if( unit == wxT( "CENTIMETER" ) )
661 return UNITS::CENTIMETER;
662 else if( unit == wxT( "INCH" ) )
663 return UNITS::INCH;
664 else if( unit == wxT( "METER" ) )
665 return UNITS::METER;
666 else if( unit == wxT( "MICROMETRE" ) )
667 return UNITS::MICROMETRE;
668 else if( unit == wxT( "MM" ) )
669 return UNITS::MM;
670 else if( unit == wxT( "THOU" ) )
671 return UNITS::THOU;
672 else if( unit == wxT( "DESIGN" ) )
673 return UNITS::DESIGN;
674 else
675 THROW_UNKNOWN_PARAMETER_IO_ERROR( unit, wxT( "UNITS" ) );
676
677 return UNITS();
678}
@ DESIGN
Inherits from design units (assumed Assignments->Technology->Units)

References CADSTAR_ARCHIVE_PARSER::CENTIMETER, CADSTAR_ARCHIVE_PARSER::DESIGN, CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), CADSTAR_ARCHIVE_PARSER::INCH, CADSTAR_ARCHIVE_PARSER::METER, CADSTAR_ARCHIVE_PARSER::MICROMETRE, CADSTAR_ARCHIVE_PARSER::MM, CADSTAR_ARCHIVE_PARSER::THOU, and THROW_UNKNOWN_PARAMETER_IO_ERROR.

Referenced by CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Parse(), and CADSTAR_ARCHIVE_PARSER::SETTINGS::ParseSubNode().

Member Data Documentation

◆ Assignments

◆ AttrColors

ATTRCOLORS CADSTAR_SCH_ARCHIVE_PARSER::AttrColors

◆ CADSTAR_TO_KICAD_FIELDS

const std::map< CADSTAR_ARCHIVE_PARSER::TEXT_FIELD_NAME, wxString > CADSTAR_ARCHIVE_PARSER::CADSTAR_TO_KICAD_FIELDS
staticinherited
Initial value:
=
{ { TEXT_FIELD_NAME::DESIGN_TITLE, wxT( "DESIGN_TITLE" ) },
{ TEXT_FIELD_NAME::SHORT_JOBNAME, wxT( "SHORT_JOBNAME" ) },
{ TEXT_FIELD_NAME::LONG_JOBNAME, wxT( "LONG_JOBNAME" ) },
{ TEXT_FIELD_NAME::SHEET_NAME, wxT( "SHEETNAME" ) },
{ TEXT_FIELD_NAME::VARIANT_NAME, wxT( "VARIANT_NAME" ) },
{ TEXT_FIELD_NAME::VARIANT_DESCRIPTION, wxT( "VARIANT_DESCRIPTION" ) },
{ TEXT_FIELD_NAME::REG_USER, wxT( "REG_USER" ) },
{ TEXT_FIELD_NAME::COMPANY_NAME, wxT( "COMPANY_NAME" ) },
{ TEXT_FIELD_NAME::CURRENT_USER, wxT( "CURRENT_USER" ) },
{ TEXT_FIELD_NAME::DATE, wxT( "DATE" ) },
{ TEXT_FIELD_NAME::TIME, wxT( "TIME" ) },
{ TEXT_FIELD_NAME::MACHINE_NAME, wxT( "MACHINE_NAME" ) } }

Map between CADSTAR fields and KiCad text variables.

This is used as a lookup table when parsing CADSTAR text fields. Most variables have a similar name in KiCad as in CADSTAR.

Definition at line 171 of file cadstar_archive_parser.h.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadTextVariables(), CADSTAR_PCB_ARCHIVE_LOADER::loadTextVariables(), and CADSTAR_ARCHIVE_PARSER::ParseTextFields().

◆ Filename

◆ FONT_BOLD

const long CADSTAR_ARCHIVE_PARSER::FONT_BOLD = 700
staticinherited

◆ FONT_NORMAL

const long CADSTAR_ARCHIVE_PARSER::FONT_NORMAL = 400
staticinherited

Definition at line 328 of file cadstar_archive_parser.h.

◆ Header

◆ KiCadUnitDivider

int CADSTAR_SCH_ARCHIVE_PARSER::KiCadUnitDivider

Use this value to convert units in this CSA file to KiCad units.

Definition at line 462 of file cadstar_sch_archive_parser.h.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::getKiCadLength(), CADSTAR_SCH_ARCHIVE_LOADER::Load(), and Parse().

◆ Library

◆ m_context

◆ m_progressReporter

◆ m_rootNode

XNODE* CADSTAR_SCH_ARCHIVE_PARSER::m_rootNode
private

Definition at line 465 of file cadstar_sch_archive_parser.h.

Referenced by Parse(), and ~CADSTAR_SCH_ARCHIVE_PARSER().

◆ Parts

◆ Schematic

◆ Sheets

◆ SymbolPartNameColor

◆ TXT_HEIGHT_RATIO

const double CADSTAR_ARCHIVE_PARSER::TXT_HEIGHT_RATIO = ( 24.0 - 5.0 ) / 24.0
staticinherited

CADSTAR fonts are drawn on a 24x24 integer matrix, where the each axis goes from 0 to 24.

The characters can each specify a width of between 12 and 24, but the height is fixed at 24.

The default CADSTAR font uses y=5 as the starting point for capital letters, leaving space for the tails of letters such as "g", "p", "y", "q", etc.

The font height in CADSTAR corresponds to the full 24 point height. In KiCad it only corresponds to the height above the guide line, meaning the overall text height will be larger in KiCad.

Definition at line 136 of file cadstar_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::applyTextCode(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), and CADSTAR_SCH_ARCHIVE_LOADER::getTextHeightFromTextCode().

◆ UNDEFINED_VALUE


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