KiCad PCB EDA Suite
CADSTAR_ARCHIVE_PARSER::FIGURE Struct Reference

#include <cadstar_archive_parser.h>

Inheritance diagram for CADSTAR_ARCHIVE_PARSER::FIGURE:
CADSTAR_ARCHIVE_PARSER::PARSER

Public Member Functions

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

Public Attributes

FIGURE_ID ID
 
LINECODE_ID LineCodeID
 
LAYER_ID LayerID
 
SHAPE Shape
 
GROUP_ID GroupID = wxEmptyString
 If not empty, this FIGURE is part of a group. More...
 
REUSEBLOCKREF ReuseBlockRef
 
SWAP_RULE SwapRule = SWAP_RULE::BOTH
 Only applicable to Figures in Components. More...
 
bool Fixed = false
 
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUEAttributeValues
 

Detailed Description

Definition at line 895 of file cadstar_archive_parser.h.

Member Function Documentation

◆ Parse()

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

Implements CADSTAR_ARCHIVE_PARSER::PARSER.

Definition at line 1591 of file cadstar_archive_parser.cpp.

1592{
1593 wxASSERT( aNode->GetName() == wxT( "FIGURE" ) );
1594
1595 ID = GetXmlAttributeIDString( aNode, 0 );
1596 LineCodeID = GetXmlAttributeIDString( aNode, 1 );
1597 LayerID = GetXmlAttributeIDString( aNode, 2 );
1598
1599 XNODE* cNode = aNode->GetChildren();
1600 bool shapeIsInitialised = false; // Stop more than one Shape Object
1601 wxString location = wxString::Format( "Figure %s", ID );
1602
1603 if( !cNode )
1604 THROW_MISSING_NODE_IO_ERROR( wxT( "Shape" ), location );
1605
1606 for( ; cNode; cNode = cNode->GetNext() )
1607 {
1608 wxString cNodeName = cNode->GetName();
1609
1610 if( !shapeIsInitialised && Shape.IsShape( cNode ) )
1611 {
1612 Shape.Parse( cNode, aContext );
1613 shapeIsInitialised = true;
1614 }
1615 else if( cNodeName == wxT( "SWAPRULE" ) )
1616 {
1617 SwapRule = ParseSwapRule( cNode );
1618 }
1619 else if( cNodeName == wxT( "FIX" ) )
1620 {
1621 Fixed = true;
1622 }
1623 else if( cNodeName == wxT( "GROUPREF" ) )
1624 {
1625
1626 GroupID = GetXmlAttributeIDString( cNode, 0 );
1627 }
1628 else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
1629 {
1630 ReuseBlockRef.Parse( cNode, aContext );
1631 }
1632 else if( cNodeName == wxT( "ATTR" ) )
1633 {
1634 ATTRIBUTE_VALUE attr;
1635 attr.Parse( cNode, aContext );
1636 AttributeValues.insert( std::make_pair( attr.AttributeID, attr ) );
1637 }
1638 else
1639 {
1640 THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
1641 }
1642 }
1643}
#define THROW_MISSING_NODE_IO_ERROR(nodename, location)
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
static SWAP_RULE ParseSwapRule(XNODE *aNode)
static wxString GetXmlAttributeIDString(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 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
GROUP_ID GroupID
If not empty, this FIGURE is part of a group.
SWAP_RULE SwapRule
Only applicable to Figures in Components.
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override

References CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_VALUE::AttributeID, Format(), XNODE::GetChildren(), XNODE::GetNext(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_VALUE::Parse(), CADSTAR_ARCHIVE_PARSER::ParseSwapRule(), THROW_MISSING_NODE_IO_ERROR, and THROW_UNKNOWN_NODE_IO_ERROR.

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

Member Data Documentation

◆ AttributeValues

std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> CADSTAR_ARCHIVE_PARSER::FIGURE::AttributeValues

Definition at line 906 of file cadstar_archive_parser.h.

◆ Fixed

bool CADSTAR_ARCHIVE_PARSER::FIGURE::Fixed = false

Definition at line 905 of file cadstar_archive_parser.h.

◆ GroupID

GROUP_ID CADSTAR_ARCHIVE_PARSER::FIGURE::GroupID = wxEmptyString

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

Definition at line 902 of file cadstar_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadFigures().

◆ ID

◆ LayerID

◆ LineCodeID

◆ ReuseBlockRef

REUSEBLOCKREF CADSTAR_ARCHIVE_PARSER::FIGURE::ReuseBlockRef

Definition at line 903 of file cadstar_archive_parser.h.

◆ Shape

◆ SwapRule

SWAP_RULE CADSTAR_ARCHIVE_PARSER::FIGURE::SwapRule = SWAP_RULE::BOTH

Only applicable to Figures in Components.

Definition at line 904 of file cadstar_archive_parser.h.


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