KiCad PCB EDA Suite
CADSTAR_ARCHIVE_PARSER::TEXT Struct Reference

#include <cadstar_archive_parser.h>

Inheritance diagram for CADSTAR_ARCHIVE_PARSER::TEXT:
CADSTAR_ARCHIVE_PARSER::PARSER

Public Member Functions

void Parse (XNODE *aNode, PARSER_CONTEXT *aContext) override
 
void Parse (XNODE *aNode, PARSER_CONTEXT *aContext, bool aParseFields)
 

Public Attributes

TEXT_ID ID
 
wxString Text
 
TEXTCODE_ID TextCodeID
 
LAYER_ID LayerID
 
POINT Position
 
long OrientAngle = 0
 
bool Mirror = false
 
bool Fixed = false
 
SWAP_RULE SwapRule = SWAP_RULE::BOTH
 
JUSTIFICATION Justification
 Note: Justification has no effect on single lines of text. More...
 
ALIGNMENT Alignment
 In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left of the first line. More...
 
GROUP_ID GroupID = wxEmptyString
 If not empty, this FIGURE is part of a group. More...
 
REUSEBLOCKREF ReuseBlockRef
 

Detailed Description

Definition at line 868 of file cadstar_archive_parser.h.

Member Function Documentation

◆ Parse() [1/2]

void CADSTAR_ARCHIVE_PARSER::TEXT::Parse ( XNODE aNode,
PARSER_CONTEXT aContext 
)
overridevirtual

Implements CADSTAR_ARCHIVE_PARSER::PARSER.

Definition at line 1533 of file cadstar_archive_parser.cpp.

1534 {
1535  Parse( aNode, aContext, true );
1536 }
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override

Referenced by CADSTAR_SCH_ARCHIVE_PARSER::CADSTAR_SCHEMATIC::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::LAYOUT::Parse(), and CADSTAR_ARCHIVE_PARSER::SYMDEF::ParseSubNode().

◆ Parse() [2/2]

void CADSTAR_ARCHIVE_PARSER::TEXT::Parse ( XNODE aNode,
PARSER_CONTEXT aContext,
bool  aParseFields 
)

Definition at line 1539 of file cadstar_archive_parser.cpp.

1541 {
1542  wxASSERT( aNode->GetName() == wxT( "TEXT" ) );
1543 
1544  ID = GetXmlAttributeIDString( aNode, 0 );
1545  Text = GetXmlAttributeIDString( aNode, 1 );
1546 
1547  if( aParseFields )
1548  Text = ParseTextFields( Text, aContext );
1549 
1550  TextCodeID = GetXmlAttributeIDString( aNode, 2 );
1551  LayerID = GetXmlAttributeIDString( aNode, 3 );
1552 
1553  XNODE* cNode = aNode->GetChildren();
1554 
1555  if( !cNode )
1556  THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), wxT( "TEXT" ) );
1557 
1558  for( ; cNode; cNode = cNode->GetNext() )
1559  {
1560  wxString cNodeName = cNode->GetName();
1561 
1562  if( cNodeName == wxT( "PT" ) )
1563  Position.Parse( cNode, aContext );
1564  else if( cNodeName == wxT( "ORIENT" ) )
1565  OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
1566  else if( cNodeName == wxT( "MIRROR" ) )
1567  Mirror = true;
1568  else if( cNodeName == wxT( "FIX" ) )
1569  Fixed = true;
1570  else if( cNodeName == wxT( "SWAPRULE" ) )
1571  SwapRule = ParseSwapRule( cNode );
1572  else if( cNodeName == wxT( "ALIGN" ) )
1573  Alignment = ParseAlignment( cNode );
1574  else if( cNodeName == wxT( "JUSTIFICATION" ) )
1575  Justification = ParseJustification( cNode );
1576  else if( cNodeName == wxT( "GROUPREF" ) )
1577  GroupID = GetXmlAttributeIDString( cNode, 0 );
1578  else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
1579  ReuseBlockRef.Parse( cNode, aContext );
1580  else
1581  THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "TEXT" ) );
1582  }
1583 }
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
GROUP_ID GroupID
If not empty, this FIGURE is part of a group.
static JUSTIFICATION ParseJustification(XNODE *aNode)
static SWAP_RULE ParseSwapRule(XNODE *aNode)
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...
XNODE * GetChildren() const
Definition: xnode.h:62
#define THROW_MISSING_NODE_IO_ERROR(nodename, location)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static long GetXmlAttributeIDLong(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
Hold an XML or S-expression element.
Definition: xnode.h:43
JUSTIFICATION Justification
Note: Justification has no effect on single lines of text.
XNODE * GetNext() const
Definition: xnode.h:67
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
static wxString ParseTextFields(wxString aTextString, PARSER_CONTEXT *aParserContext)
Replaces CADSTAR fields for the equivalent in KiCad and stores the field values in aParserContext.
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
static ALIGNMENT ParseAlignment(XNODE *aNode)

References XNODE::GetChildren(), XNODE::GetNext(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDLong(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), CADSTAR_ARCHIVE_PARSER::ParseAlignment(), CADSTAR_ARCHIVE_PARSER::ParseJustification(), CADSTAR_ARCHIVE_PARSER::ParseSwapRule(), CADSTAR_ARCHIVE_PARSER::ParseTextFields(), THROW_MISSING_NODE_IO_ERROR, and THROW_UNKNOWN_NODE_IO_ERROR.

Member Data Documentation

◆ Alignment

ALIGNMENT CADSTAR_ARCHIVE_PARSER::TEXT::Alignment
Initial value:
= ALIGNMENT::
NO_ALIGNMENT

In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left of the first line.

Note that this is different from BOTTOM_LEFT (which is bottom left of the whole text block)

Definition at line 881 of file cadstar_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), and CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary().

◆ Fixed

bool CADSTAR_ARCHIVE_PARSER::TEXT::Fixed = false

Definition at line 877 of file cadstar_archive_parser.h.

◆ GroupID

GROUP_ID CADSTAR_ARCHIVE_PARSER::TEXT::GroupID = wxEmptyString

If not empty, this FIGURE is part of a group.

Definition at line 886 of file cadstar_archive_parser.h.

◆ ID

◆ Justification

JUSTIFICATION CADSTAR_ARCHIVE_PARSER::TEXT::Justification
Initial value:

Note: Justification has no effect on single lines of text.

Definition at line 879 of file cadstar_archive_parser.h.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), and CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary().

◆ LayerID

LAYER_ID CADSTAR_ARCHIVE_PARSER::TEXT::LayerID

◆ Mirror

◆ OrientAngle

◆ Position

◆ ReuseBlockRef

REUSEBLOCKREF CADSTAR_ARCHIVE_PARSER::TEXT::ReuseBlockRef

Definition at line 887 of file cadstar_archive_parser.h.

◆ SwapRule

SWAP_RULE CADSTAR_ARCHIVE_PARSER::TEXT::SwapRule = SWAP_RULE::BOTH

Definition at line 878 of file cadstar_archive_parser.h.

◆ Text

◆ TextCodeID


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