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

Member Function Documentation

◆ IsVertex()

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

Definition at line 416 of file cadstar_archive_parser.cpp.

417 {
418  wxString aNodeName = aNode->GetName();
419 
420  if( aNodeName == wxT( "PT" ) || aNodeName == wxT( "ACWARC" ) || aNodeName == wxT( "CWARC" )
421  || aNodeName == wxT( "CWSEMI" ) || aNodeName == wxT( "ACWSEMI" ) )
422  {
423  return true;
424  }
425  else
426  {
427  return false;
428  }
429 }

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

433 {
434  wxASSERT( IsVertex( aNode ) );
435 
436  wxString aNodeName = aNode->GetName();
437 
438  if( aNodeName == wxT( "PT" ) )
439  {
443  End.Parse( aNode, aContext );
444  }
445  else if( aNodeName == wxT( "ACWARC" ) || aNodeName == wxT( "CWARC" ) )
446  {
447  if( aNodeName == wxT( "ACWARC" ) )
449  else
451 
452  std::vector<POINT> pts = ParseAllChildPoints( aNode, aContext, true, 2 );
453 
454  Center = pts[0];
455  End = pts[1];
456  }
457  else if( aNodeName == wxT( "ACWSEMI" ) || aNodeName == wxT( "CWSEMI" ) )
458  {
459  if( aNodeName == wxT( "ACWSEMI" ) )
461  else
463 
466 
467  std::vector<POINT> pts = ParseAllChildPoints( aNode, aContext, true, 1 );
468 
469  End = pts[0];
470  }
471  else
472  {
473  wxASSERT_MSG( true, wxT( "Unknown VERTEX type" ) );
474  }
475 }
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: