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 851 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 1478 of file cadstar_archive_parser.cpp.

1479 {
1480  wxASSERT( aNode->GetName() == wxT( "FIGURE" ) );
1481 
1482  ID = GetXmlAttributeIDString( aNode, 0 );
1483  LineCodeID = GetXmlAttributeIDString( aNode, 1 );
1484  LayerID = GetXmlAttributeIDString( aNode, 2 );
1485 
1486  XNODE* cNode = aNode->GetChildren();
1487  bool shapeIsInitialised = false; // Stop more than one Shape Object
1488  wxString location = wxString::Format( "Figure %s", ID );
1489 
1490  if( !cNode )
1491  THROW_MISSING_NODE_IO_ERROR( wxT( "Shape" ), location );
1492 
1493  for( ; cNode; cNode = cNode->GetNext() )
1494  {
1495  wxString cNodeName = cNode->GetName();
1496 
1497  if( !shapeIsInitialised && Shape.IsShape( cNode ) )
1498  {
1499  Shape.Parse( cNode, aContext );
1500  shapeIsInitialised = true;
1501  }
1502  else if( cNodeName == wxT( "SWAPRULE" ) )
1503  {
1504  SwapRule = ParseSwapRule( cNode );
1505  }
1506  else if( cNodeName == wxT( "FIX" ) )
1507  {
1508  Fixed = true;
1509  }
1510  else if( cNodeName == wxT( "GROUPREF" ) )
1511  {
1512 
1513  GroupID = GetXmlAttributeIDString( cNode, 0 );
1514  }
1515  else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
1516  {
1517  ReuseBlockRef.Parse( cNode, aContext );
1518  }
1519  else if( cNodeName == wxT( "ATTR" ) )
1520  {
1521  ATTRIBUTE_VALUE attr;
1522  attr.Parse( cNode, aContext );
1523  AttributeValues.insert( std::make_pair( attr.AttributeID, attr ) );
1524  }
1525  else
1526  {
1527  THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
1528  }
1529  }
1530 }
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 862 of file cadstar_archive_parser.h.

◆ Fixed

bool CADSTAR_ARCHIVE_PARSER::FIGURE::Fixed = false

Definition at line 861 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 858 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 859 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 860 of file cadstar_archive_parser.h.


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