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 863 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 1486 of file cadstar_archive_parser.cpp.

1487 {
1488  wxASSERT( aNode->GetName() == wxT( "FIGURE" ) );
1489 
1490  ID = GetXmlAttributeIDString( aNode, 0 );
1491  LineCodeID = GetXmlAttributeIDString( aNode, 1 );
1492  LayerID = GetXmlAttributeIDString( aNode, 2 );
1493 
1494  XNODE* cNode = aNode->GetChildren();
1495  bool shapeIsInitialised = false; // Stop more than one Shape Object
1496  wxString location = wxString::Format( "Figure %s", ID );
1497 
1498  if( !cNode )
1499  THROW_MISSING_NODE_IO_ERROR( wxT( "Shape" ), location );
1500 
1501  for( ; cNode; cNode = cNode->GetNext() )
1502  {
1503  wxString cNodeName = cNode->GetName();
1504 
1505  if( !shapeIsInitialised && Shape.IsShape( cNode ) )
1506  {
1507  Shape.Parse( cNode, aContext );
1508  shapeIsInitialised = true;
1509  }
1510  else if( cNodeName == wxT( "SWAPRULE" ) )
1511  {
1512  SwapRule = ParseSwapRule( cNode );
1513  }
1514  else if( cNodeName == wxT( "FIX" ) )
1515  {
1516  Fixed = true;
1517  }
1518  else if( cNodeName == wxT( "GROUPREF" ) )
1519  {
1520 
1521  GroupID = GetXmlAttributeIDString( cNode, 0 );
1522  }
1523  else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
1524  {
1525  ReuseBlockRef.Parse( cNode, aContext );
1526  }
1527  else if( cNodeName == wxT( "ATTR" ) )
1528  {
1529  ATTRIBUTE_VALUE attr;
1530  attr.Parse( cNode, aContext );
1531  AttributeValues.insert( std::make_pair( attr.AttributeID, attr ) );
1532  }
1533  else
1534  {
1535  THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
1536  }
1537  }
1538 }
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
static SWAP_RULE ParseSwapRule(XNODE *aNode)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
GROUP_ID GroupID
If not empty, this FIGURE is part of a group.
XNODE * GetChildren() const
Definition: xnode.h:62
#define THROW_MISSING_NODE_IO_ERROR(nodename, location)
Hold an XML or S-expression element.
Definition: xnode.h:43
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
XNODE * GetNext() const
Definition: xnode.h:67
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
SWAP_RULE SwapRule
Only applicable to Figures in Components.

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

◆ Fixed

bool CADSTAR_ARCHIVE_PARSER::FIGURE::Fixed = false

Definition at line 873 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 870 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 871 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 872 of file cadstar_archive_parser.h.


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