KiCad PCB EDA Suite
CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE Struct Reference

< Token can be either "LEADERLINE", "LINEARLINE" or "ANGULARLINE" More...

#include <cadstar_pcb_archive_parser.h>

Inheritance diagram for CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE:
CADSTAR_ARCHIVE_PARSER::PARSER

Public Types

enum class  TYPE { LINEARLINE , LEADERLINE , ANGULARLINE }
 
enum class  STYLE { INTERNAL , EXTERNAL }
 

Public Member Functions

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

Static Public Member Functions

static bool IsLine (XNODE *aNode)
 

Public Attributes

TYPE Type
 
LINECODE_ID LineCodeID
 param0 More...
 
STYLE Style
 Subnode="DIMLINETYPE". More...
 
POINT Start
 [point1] More...
 
POINT End
 [point2] More...
 
POINT Centre
 Only for TYPE=ANGULARLINE [point3]. More...
 
long LeaderAngle = UNDEFINED_VALUE
 Only for TYPE=LEADERLINE subnode "LEADERANG". More...
 
long LeaderLineLength = UNDEFINED_VALUE
 Only for TYPE=LEADERLINE Length of the angled part of the leader line [param5]. More...
 
long LeaderLineExtensionLength = UNDEFINED_VALUE
 Only for TYPE=LEADERLINE Length of the horizontal part of the leader line [param6]. More...
 

Detailed Description

< Token can be either "LEADERLINE", "LINEARLINE" or "ANGULARLINE"

Definition at line 656 of file cadstar_pcb_archive_parser.h.

Member Enumeration Documentation

◆ STYLE

Enumerator
INTERNAL 

The lines are placed inside the measurement token=DIMENSION_INTERNAL.

EXTERNAL 

The lines are placed outside the measurement (typically used when limited space) token=DIMENSION_EXTERNAL.

Definition at line 667 of file cadstar_pcb_archive_parser.h.

668 {
669 INTERNAL,
671 EXTERNAL
673 };

◆ TYPE

Enumerator
LINEARLINE 

Only for dimensions of type LINEARDIM.

LEADERLINE 

Only for dimensions of type LEADERRDIM.

If STYLE = INTERNAL, the result is the same as a LINEARLINE, i.e. all Leader Line-specific elements are ignored.

ANGULARLINE 

Only for dimensions of type ANGULARDIM.

Definition at line 658 of file cadstar_pcb_archive_parser.h.

659 {
660 LINEARLINE,
661 LEADERLINE,
664 ANGULARLINE
665 };

Member Function Documentation

◆ IsLine()

bool CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::IsLine ( XNODE aNode)
static

Definition at line 1325 of file cadstar_pcb_archive_parser.cpp.

1326{
1327 if( aNode->GetName() == wxT( "LEADERLINE" ) || aNode->GetName() == wxT( "LINEARLINE" )
1328 || aNode->GetName() == wxT( "ANGULARLINE" ) )
1329 {
1330 return true;
1331 }
1332 else
1333 {
1334 return false;
1335 }
1336}

◆ Parse()

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

Implements CADSTAR_ARCHIVE_PARSER::PARSER.

Definition at line 1339 of file cadstar_pcb_archive_parser.cpp.

1340{
1341 wxASSERT( IsLine( aNode ) );
1342
1343 if( aNode->GetName() == wxT( "LINEARLINE" ) )
1345 else if( aNode->GetName() == wxT( "LEADERLINE" ) )
1347 else if( aNode->GetName() == wxT( "ANGULARLINE" ) )
1349 else
1350 wxASSERT_MSG( true, wxT( "Not a valid type. What happened to the node Name?" ) );
1351
1352 LineCodeID = GetXmlAttributeIDString( aNode, 0 );
1353
1354 if( Type == TYPE::LEADERLINE )
1355 {
1358 }
1359
1360 XNODE* cNode = aNode->GetChildren();
1361 int noOfPoints = 0;
1362 int requiredNoOfPoints = 2;
1363
1364 if( Type == TYPE::ANGULARLINE )
1365 requiredNoOfPoints = 3;
1366
1367 for( ; cNode; cNode = cNode->GetNext() )
1368 {
1369 wxString cNodeName = cNode->GetName();
1370
1371 if( cNodeName == wxT( "DIMLINETYPE" ) )
1372 {
1373 wxString styleStr = GetXmlAttributeIDString( cNode, 0 );
1374
1375 if( styleStr == wxT( "DIMENSION_INTERNAL" ) )
1377 else if( styleStr == wxT( "DIMENSION_EXTERNAL" ) )
1379 else
1380 THROW_UNKNOWN_PARAMETER_IO_ERROR( styleStr, cNodeName );
1381 }
1382 else if( noOfPoints < requiredNoOfPoints && cNodeName == wxT( "PT" ) )
1383 {
1384 ++noOfPoints;
1385
1386 if( noOfPoints == 1 )
1387 Start.Parse( cNode, aContext );
1388 else if( noOfPoints == 2 )
1389 End.Parse( cNode, aContext );
1390 else
1391 Centre.Parse( cNode, aContext );
1392 }
1393 else if( Type == TYPE::LEADERLINE && cNodeName == wxT( "LEADERANG" ) )
1394 {
1395 LeaderAngle = GetXmlAttributeIDLong( cNode, 0 );
1396 }
1397 else
1398 {
1399 THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
1400 }
1401 }
1402
1403 if( noOfPoints != requiredNoOfPoints )
1404 THROW_MISSING_PARAMETER_IO_ERROR( wxT( "PT" ), aNode->GetName() );
1405}
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
#define THROW_UNKNOWN_PARAMETER_IO_ERROR(param, location)
#define THROW_MISSING_PARAMETER_IO_ERROR(param, location)
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
static long GetXmlAttributeIDLong(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
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
@ INTERNAL
The lines are placed inside the measurement token=DIMENSION_INTERNAL.
@ EXTERNAL
The lines are placed outside the measurement (typically used when limited space) token=DIMENSION_EXTE...
@ LEADERLINE
Only for dimensions of type LEADERRDIM.
@ LINEARLINE
Only for dimensions of type LINEARDIM.
@ ANGULARLINE
Only for dimensions of type ANGULARDIM.
long LeaderLineExtensionLength
Only for TYPE=LEADERLINE Length of the horizontal part of the leader line [param6].
long LeaderLineLength
Only for TYPE=LEADERLINE Length of the angled part of the leader line [param5].
long LeaderAngle
Only for TYPE=LEADERLINE subnode "LEADERANG".
POINT Centre
Only for TYPE=ANGULARLINE [point3].

References XNODE::GetChildren(), XNODE::GetNext(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDLong(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), THROW_MISSING_PARAMETER_IO_ERROR, THROW_UNKNOWN_NODE_IO_ERROR, and THROW_UNKNOWN_PARAMETER_IO_ERROR.

Member Data Documentation

◆ Centre

POINT CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::Centre

Only for TYPE=ANGULARLINE [point3].

Definition at line 681 of file cadstar_pcb_archive_parser.h.

◆ End

POINT CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::End

[point2]

Definition at line 680 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions().

◆ LeaderAngle

long CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::LeaderAngle = UNDEFINED_VALUE

Only for TYPE=LEADERLINE subnode "LEADERANG".

Definition at line 683 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions().

◆ LeaderLineExtensionLength

long CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::LeaderLineExtensionLength = UNDEFINED_VALUE

Only for TYPE=LEADERLINE Length of the horizontal part of the leader line [param6].

Definition at line 686 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions().

◆ LeaderLineLength

long CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::LeaderLineLength = UNDEFINED_VALUE

Only for TYPE=LEADERLINE Length of the angled part of the leader line [param5].

Definition at line 684 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions().

◆ LineCodeID

LINECODE_ID CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::LineCodeID

◆ Start

POINT CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::Start

[point1]

Definition at line 679 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions().

◆ Style

STYLE CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::Style

Subnode="DIMLINETYPE".

Definition at line 677 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions().

◆ Type

TYPE CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::Type

Definition at line 675 of file cadstar_pcb_archive_parser.h.


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