KiCad PCB EDA Suite
CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_COPPER Struct Reference

A shape of copper in the component footprint. More...

#include <cadstar_pcb_archive_parser.h>

Inheritance diagram for CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_COPPER:
CADSTAR_ARCHIVE_PARSER::PARSER

Public Member Functions

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

Public Attributes

COPPERCODE_ID CopperCodeID
 
LAYER_ID LayerID
 
SHAPE Shape
 
SWAP_RULE SwapRule = SWAP_RULE::BOTH
 
std::vector< PAD_IDAssociatedPadIDs
 

Detailed Description

A shape of copper in the component footprint.

For KiCad import, this could be converted to a custom shaped pad (as long as AssociatedPadIDs is not empty)

Definition at line 438 of file cadstar_pcb_archive_parser.h.

Member Function Documentation

◆ Parse()

void CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_COPPER::Parse ( XNODE aNode,
PARSER_CONTEXT aContext 
)
overridevirtual

Implements CADSTAR_ARCHIVE_PARSER::PARSER.

Definition at line 994 of file cadstar_pcb_archive_parser.cpp.

995 {
996  wxASSERT( aNode->GetName() == wxT( "COMPCOPPER" ) );
997 
999  LayerID = GetXmlAttributeIDString( aNode, 1 );
1000 
1001  XNODE* cNode = aNode->GetChildren();
1002  bool shapeIsInitialised = false; // Stop more than one Shape Object
1003  wxString location = wxT( "COMPCOPPER" );
1004 
1005  if( !cNode )
1006  THROW_MISSING_NODE_IO_ERROR( wxT( "Shape" ), location );
1007 
1008  for( ; cNode; cNode = cNode->GetNext() )
1009  {
1010  wxString cNodeName = cNode->GetName();
1011 
1012  if( !shapeIsInitialised && Shape.IsShape( cNode ) )
1013  {
1014  Shape.Parse( cNode, aContext );
1015  shapeIsInitialised = true;
1016  }
1017  else if( cNodeName == wxT( "SWAPRULE" ) )
1018  {
1019  SwapRule = ParseSwapRule( cNode );
1020  }
1021  else if( cNodeName == wxT( "ASSOCPIN" ) )
1022  {
1023  wxXmlAttribute* xmlAttribute = cNode->GetAttributes();
1024 
1025  for( ; xmlAttribute; xmlAttribute = xmlAttribute->GetNext() )
1026  {
1027  if( !IsValidAttribute( xmlAttribute ) )
1028  continue;
1029 
1030  long padId;
1031 
1032  if( !xmlAttribute->GetValue().ToLong( &padId ) )
1033  THROW_PARSING_IO_ERROR( wxT( "ASSOCPIN" ), location );
1034 
1035  AssociatedPadIDs.push_back( (PAD_ID) padId );
1036  }
1037 
1038  CheckNoChildNodes( cNode );
1039  }
1040  else
1041  {
1042  THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
1043  }
1044  }
1045 }
static bool IsValidAttribute(wxXmlAttribute *aAttribute)
long PAD_ID
Pad identifier (pin) in the PCB.
static SWAP_RULE ParseSwapRule(XNODE *aNode)
static void CheckNoChildNodes(XNODE *aNode)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
XNODE * GetChildren() const
Definition: xnode.h:62
#define THROW_PARSING_IO_ERROR(param, location)
#define THROW_MISSING_NODE_IO_ERROR(nodename, location)
Hold an XML or S-expression element.
Definition: xnode.h:43
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)

References CADSTAR_ARCHIVE_PARSER::CheckNoChildNodes(), XNODE::GetChildren(), XNODE::GetNext(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), CADSTAR_ARCHIVE_PARSER::IsValidAttribute(), CADSTAR_ARCHIVE_PARSER::ParseSwapRule(), THROW_MISSING_NODE_IO_ERROR, THROW_PARSING_IO_ERROR, and THROW_UNKNOWN_NODE_IO_ERROR.

Referenced by CADSTAR_PCB_ARCHIVE_PARSER::SYMDEF_PCB::Parse().

Member Data Documentation

◆ AssociatedPadIDs

std::vector<PAD_ID> CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_COPPER::AssociatedPadIDs

◆ CopperCodeID

COPPERCODE_ID CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_COPPER::CopperCodeID

◆ LayerID

LAYER_ID CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_COPPER::LayerID

◆ Shape

SHAPE CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_COPPER::Shape

◆ SwapRule

SWAP_RULE CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_COPPER::SwapRule = SWAP_RULE::BOTH

Definition at line 443 of file cadstar_pcb_archive_parser.h.


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