KiCad PCB EDA Suite
CADSTAR_ARCHIVE_PARSER::VERTEX Struct Reference

Represents a vertex in a shape. More...

#include <cadstar_archive_parser.h>

Inheritance diagram for CADSTAR_ARCHIVE_PARSER::VERTEX:
CADSTAR_ARCHIVE_PARSER::PARSER

Public Member Functions

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

Static Public Member Functions

static bool IsVertex (XNODE *aNode)
 

Public Attributes

VERTEX_TYPE Type
 
POINT Center
 
POINT End
 

Detailed Description

Represents a vertex in a shape.

E.g. A circle is made by two semicircles with the same center point.

Definition at line 429 of file cadstar_archive_parser.h.

Member Function Documentation

◆ IsVertex()

bool CADSTAR_ARCHIVE_PARSER::VERTEX::IsVertex ( XNODE aNode)
static

Definition at line 422 of file cadstar_archive_parser.cpp.

423 {
424  wxString aNodeName = aNode->GetName();
425 
426  if( aNodeName == wxT( "PT" ) || aNodeName == wxT( "ACWARC" ) || aNodeName == wxT( "CWARC" )
427  || aNodeName == wxT( "CWSEMI" ) || aNodeName == wxT( "ACWSEMI" ) )
428  {
429  return true;
430  }
431  else
432  {
433  return false;
434  }
435 }

Referenced by CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::ROUTE_VERTEX::Parse(), and CADSTAR_ARCHIVE_PARSER::ParseAllChildVertices().

◆ Parse()

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

Implements CADSTAR_ARCHIVE_PARSER::PARSER.

Definition at line 438 of file cadstar_archive_parser.cpp.

439 {
440  wxASSERT( IsVertex( aNode ) );
441 
442  wxString aNodeName = aNode->GetName();
443 
444  if( aNodeName == wxT( "PT" ) )
445  {
449  End.Parse( aNode, aContext );
450  }
451  else if( aNodeName == wxT( "ACWARC" ) || aNodeName == wxT( "CWARC" ) )
452  {
453  if( aNodeName == wxT( "ACWARC" ) )
455  else
457 
458  std::vector<POINT> pts = ParseAllChildPoints( aNode, aContext, true, 2 );
459 
460  Center = pts[0];
461  End = pts[1];
462  }
463  else if( aNodeName == wxT( "ACWSEMI" ) || aNodeName == wxT( "CWSEMI" ) )
464  {
465  if( aNodeName == wxT( "ACWSEMI" ) )
467  else
469 
472 
473  std::vector<POINT> pts = ParseAllChildPoints( aNode, aContext, true, 1 );
474 
475  End = pts[0];
476  }
477  else
478  {
479  wxASSERT_MSG( true, wxT( "Unknown VERTEX type" ) );
480  }
481 }
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static const long UNDEFINED_VALUE
static std::vector< POINT > ParseAllChildPoints(XNODE *aNode, PARSER_CONTEXT *aContext, bool aTestAllChildNodes=false, int aExpectedNumPoints=UNDEFINED_VALUE)
if no children are present, it just returns an empty vector (without throwing an exception)

References CADSTAR_ARCHIVE_PARSER::ANTICLOCKWISE_ARC, CADSTAR_ARCHIVE_PARSER::ANTICLOCKWISE_SEMICIRCLE, PCAD2KICAD::Center, CADSTAR_ARCHIVE_PARSER::CLOCKWISE_ARC, CADSTAR_ARCHIVE_PARSER::CLOCKWISE_SEMICIRCLE, CADSTAR_ARCHIVE_PARSER::ParseAllChildPoints(), CADSTAR_ARCHIVE_PARSER::POINT, and CADSTAR_ARCHIVE_PARSER::UNDEFINED_VALUE.

Referenced by CADSTAR_ARCHIVE_PARSER::ParseAllChildVertices().

Member Data Documentation

◆ Center

◆ End

◆ Type


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