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 905 of file cadstar_archive_parser.h.

Member Function Documentation

◆ Parse() [1/2]

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

◆ Parse() [2/2]

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

Definition at line 1643 of file cadstar_archive_parser.cpp.

1645{
1646 wxASSERT( aNode->GetName() == wxT( "TEXT" ) );
1647
1648 ID = GetXmlAttributeIDString( aNode, 0 );
1649 Text = GetXmlAttributeIDString( aNode, 1 );
1650
1651 if( aParseFields )
1652 Text = ParseTextFields( Text, aContext );
1653
1654 TextCodeID = GetXmlAttributeIDString( aNode, 2 );
1655 LayerID = GetXmlAttributeIDString( aNode, 3 );
1656
1657 XNODE* cNode = aNode->GetChildren();
1658
1659 if( !cNode )
1660 THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), wxT( "TEXT" ) );
1661
1662 for( ; cNode; cNode = cNode->GetNext() )
1663 {
1664 wxString cNodeName = cNode->GetName();
1665
1666 if( cNodeName == wxT( "PT" ) )
1667 Position.Parse( cNode, aContext );
1668 else if( cNodeName == wxT( "ORIENT" ) )
1669 OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
1670 else if( cNodeName == wxT( "MIRROR" ) )
1671 Mirror = true;
1672 else if( cNodeName == wxT( "FIX" ) )
1673 Fixed = true;
1674 else if( cNodeName == wxT( "SWAPRULE" ) )
1675 SwapRule = ParseSwapRule( cNode );
1676 else if( cNodeName == wxT( "ALIGN" ) )
1677 Alignment = ParseAlignment( cNode );
1678 else if( cNodeName == wxT( "JUSTIFICATION" ) )
1680 else if( cNodeName == wxT( "GROUPREF" ) )
1681 GroupID = GetXmlAttributeIDString( cNode, 0 );
1682 else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
1683 ReuseBlockRef.Parse( cNode, aContext );
1684 else
1685 THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "TEXT" ) );
1686 }
1687}
#define THROW_MISSING_NODE_IO_ERROR(nodename, location)
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
static ALIGNMENT ParseAlignment(XNODE *aNode)
static SWAP_RULE ParseSwapRule(XNODE *aNode)
static JUSTIFICATION ParseJustification(XNODE *aNode)
static wxString ParseTextFields(const 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 long GetXmlAttributeIDLong(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
Hold an XML or S-expression element.
Definition: xnode.h:44
XNODE * GetChildren() const
Definition: xnode.h:62
XNODE * GetNext() const
Definition: xnode.h:67
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...
JUSTIFICATION Justification
Note: Justification has no effect on single lines of text.
GROUP_ID GroupID
If not empty, this FIGURE is part of a group.

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 918 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 914 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 923 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 916 of file cadstar_archive_parser.h.

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

◆ LayerID

◆ Mirror

◆ OrientAngle

◆ Position

◆ ReuseBlockRef

REUSEBLOCKREF CADSTAR_ARCHIVE_PARSER::TEXT::ReuseBlockRef

Definition at line 924 of file cadstar_archive_parser.h.

◆ SwapRule

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

Definition at line 915 of file cadstar_archive_parser.h.

◆ Text

◆ TextCodeID


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