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 1018 of file cadstar_pcb_archive_parser.cpp.

1019{
1020 wxASSERT( aNode->GetName() == wxT( "COMPCOPPER" ) );
1021
1023 LayerID = GetXmlAttributeIDString( aNode, 1 );
1024
1025 XNODE* cNode = aNode->GetChildren();
1026 bool shapeIsInitialised = false; // Stop more than one Shape Object
1027 wxString location = wxT( "COMPCOPPER" );
1028
1029 if( !cNode )
1030 THROW_MISSING_NODE_IO_ERROR( wxT( "Shape" ), location );
1031
1032 for( ; cNode; cNode = cNode->GetNext() )
1033 {
1034 wxString cNodeName = cNode->GetName();
1035
1036 if( !shapeIsInitialised && Shape.IsShape( cNode ) )
1037 {
1038 Shape.Parse( cNode, aContext );
1039 shapeIsInitialised = true;
1040 }
1041 else if( cNodeName == wxT( "SWAPRULE" ) )
1042 {
1043 SwapRule = ParseSwapRule( cNode );
1044 }
1045 else if( cNodeName == wxT( "ASSOCPIN" ) )
1046 {
1047 wxXmlAttribute* xmlAttribute = cNode->GetAttributes();
1048
1049 for( ; xmlAttribute; xmlAttribute = xmlAttribute->GetNext() )
1050 {
1051 if( !IsValidAttribute( xmlAttribute ) )
1052 continue;
1053
1054 long padId;
1055
1056 if( !xmlAttribute->GetValue().ToLong( &padId ) )
1057 THROW_PARSING_IO_ERROR( wxT( "ASSOCPIN" ), location );
1058
1059 AssociatedPadIDs.push_back( (PAD_ID) padId );
1060 }
1061
1062 CheckNoChildNodes( cNode );
1063 }
1064 else
1065 {
1066 THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
1067 }
1068 }
1069}
#define THROW_MISSING_NODE_IO_ERROR(nodename, location)
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
#define THROW_PARSING_IO_ERROR(param, location)
static SWAP_RULE ParseSwapRule(XNODE *aNode)
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
static bool IsValidAttribute(wxXmlAttribute *aAttribute)
static void CheckNoChildNodes(XNODE *aNode)
long PAD_ID
Pad identifier (pin) in the PCB.
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

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: