KiCad PCB EDA Suite
CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION Struct Reference

Linear, leader (radius/diameter) or angular dimension. More...

#include <cadstar_pcb_archive_parser.h>

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

Classes

struct  ARROW
 
struct  EXTENSION_LINE
 < Token "EXTLINE" More...
 
struct  LINE
 < Token can be either "LEADERLINE", "LINEARLINE" or "ANGULARLINE" More...
 
struct  TEXTFORMAT
 Contains formatting specific for a CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION object. More...
 

Public Types

enum class  TYPE { LINEARDIM , LEADERDIM , ANGLEDIM }
 
enum class  SUBTYPE {
  ORTHOGONAL , DIRECT , ANGLED , DIAMETER ,
  RADIUS , ANGULAR
}
 

Public Member Functions

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

Static Public Member Functions

static bool IsDimension (XNODE *aNode)
 

Public Attributes

TYPE Type
 
DIMENSION_ID ID
 Some ID (doesn't seem to be used) subnode="DIMREF". More...
 
LAYER_ID LayerID
 ID on which to draw this [param1]. More...
 
SUBTYPE Subtype
 [param2] More...
 
long Precision
 Number of decimal points to display in the measurement [param3]. More...
 
UNITS LinearUnits
 
ANGUNITS AngularUnits
 Only Applicable to TYPE=ANGLEDIM. More...
 
ARROW Arrow
 
TEXTFORMAT TextParams
 
EXTENSION_LINE ExtensionLineParams
 Not applicable to TYPE=LEADERDIM. More...
 
LINE Line
 
TEXT Text
 
bool Fixed = false
 
GROUP_ID GroupID = wxEmptyString
 If not empty, this DIMENSION is part of a group. More...
 
REUSEBLOCKREF ReuseBlockRef
 

Detailed Description

Linear, leader (radius/diameter) or angular dimension.

Definition at line 558 of file cadstar_pcb_archive_parser.h.

Member Enumeration Documentation

◆ SUBTYPE

Enumerator
ORTHOGONAL 

An orthogonal dimension (either x or y measurement) token=DIMENSION_ORTHOGONAL.

DIRECT 

A linear dimension parallel to measurement with perpendicular extension lines token=DIMENSION_DIRECT.

ANGLED 

A linear dimension parallel to measurement but with orthogonal extension lines (i.e.

x or y axis, angled with respect to measurement) token=DIMENSION_ANGLED

DIAMETER 

token=DIMENSION_DIAMETER

RADIUS 

token=DIMENSION_RADIUS

ANGULAR 

token=DIMENSION_ANGULAR

Definition at line 568 of file cadstar_pcb_archive_parser.h.

569 {
570 ORTHOGONAL,
572 DIRECT,
574 ANGLED,
577 DIAMETER,
578 RADIUS,
579 ANGULAR
580 };

◆ TYPE

Enumerator
LINEARDIM 

Linear Dimension.

LEADERDIM 

Typically used for Radius/Diameter Dimension.

ANGLEDIM 

Angular Dimension.

Definition at line 560 of file cadstar_pcb_archive_parser.h.

561 {
562 LINEARDIM,
563 LEADERDIM,
564 ANGLEDIM
565 };

Member Function Documentation

◆ IsDimension()

bool CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::IsDimension ( XNODE aNode)
static

Definition at line 1408 of file cadstar_pcb_archive_parser.cpp.

1409{
1410 if( aNode->GetName() == wxT( "LINEARDIM" ) || aNode->GetName() == wxT( "LEADERDIM" )
1411 || aNode->GetName() == wxT( "ANGLEDIM" ) )
1412 {
1413 return true;
1414 }
1415 else
1416 {
1417 return false;
1418 }
1419}

Referenced by CADSTAR_PCB_ARCHIVE_PARSER::SYMDEF_PCB::Parse(), and CADSTAR_PCB_ARCHIVE_PARSER::LAYOUT::Parse().

◆ Parse()

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

Implements CADSTAR_ARCHIVE_PARSER::PARSER.

Definition at line 1422 of file cadstar_pcb_archive_parser.cpp.

1423{
1424 wxASSERT( IsDimension( aNode ) );
1425
1426 std::map<wxString, TYPE> typeMap = { { wxT( "LINEARDIM" ), TYPE::LINEARDIM },
1427 { wxT( "LEADERDIM" ), TYPE::LEADERDIM }, { wxT( "ANGLEDIM" ), TYPE::ANGLEDIM } };
1428
1429 //make sure aNode is valid TYPE
1430 wxASSERT_MSG( typeMap.find( aNode->GetName() ) != typeMap.end(),
1431 wxT( "Not a valid type. What happened to the node Name?" ) );
1432
1433 Type = typeMap[aNode->GetName()];
1434 LayerID = GetXmlAttributeIDString( aNode, 1 );
1435 wxString subTypeStr = GetXmlAttributeIDString( aNode, 2 );
1436
1437 std::map<wxString, SUBTYPE> subTypeMap = {
1438 { wxT( "DIMENSION_ORTHOGONAL" ), SUBTYPE::ORTHOGONAL },
1439 { wxT( "DIMENSION_DIRECT" ), SUBTYPE::DIRECT },
1440 { wxT( "DIMENSION_ANGLED" ), SUBTYPE::ANGLED },
1441 { wxT( "DIMENSION_DIAMETER" ), SUBTYPE::DIAMETER },
1442 { wxT( "DIMENSION_RADIUS" ), SUBTYPE::RADIUS },
1443 { wxT( "DIMENSION_ANGULAR" ), SUBTYPE::ANGULAR } };
1444
1445 if( subTypeMap.find( subTypeStr ) == subTypeMap.end() )
1446 THROW_UNKNOWN_PARAMETER_IO_ERROR( subTypeStr, aNode->GetName() );
1447
1448 Subtype = subTypeMap[subTypeStr];
1449 Precision = GetXmlAttributeIDLong( aNode, 3 );
1450
1451 XNODE* cNode = aNode->GetChildren();
1452
1453 bool idParsed = false;
1454 bool unitsParsed = false; //UNITS or ANGUNITS
1455 bool arrowParsed = false;
1456 bool textFormatParsed = false;
1457 bool extLineParsed = false;
1458 bool lineParsed = false;
1459 bool textParsed = false;
1460
1461 for( ; cNode; cNode = cNode->GetNext() )
1462 {
1463 wxString cNodeName = cNode->GetName();
1464
1465 if( !idParsed && cNodeName == wxT( "DIMREF" ) )
1466 {
1467 ID = GetXmlAttributeIDString( cNode, 0 );
1468 idParsed = true;
1469 }
1470 else if( !unitsParsed && cNodeName == wxT( "UNITS" ) )
1471 {
1472 LinearUnits = ParseUnits( cNode );
1473 unitsParsed = true;
1474 }
1475 else if( !unitsParsed && cNodeName == wxT( "ANGUNITS" ) )
1476 {
1477 AngularUnits = ParseAngunits( cNode );
1478 unitsParsed = true;
1479 }
1480 else if( !arrowParsed && cNodeName == wxT( "DIMARROW" ) )
1481 {
1482 Arrow.Parse( cNode, aContext );
1483 arrowParsed = true;
1484 }
1485 else if( !textFormatParsed && cNodeName == wxT( "DIMTEXT" ) )
1486 {
1487 TextParams.Parse( cNode, aContext );
1488 textFormatParsed = true;
1489 }
1490 else if( !extLineParsed && cNodeName == wxT( "EXTLINE" ) )
1491 {
1492 ExtensionLineParams.Parse( cNode, aContext );
1493 extLineParsed = true;
1494 }
1495 else if( !lineParsed && LINE::IsLine( cNode ) )
1496 {
1497 Line.Parse( cNode, aContext );
1498 lineParsed = true;
1499 }
1500 else if( !textParsed && cNodeName == wxT( "TEXT" ) )
1501 {
1502 // Do not parse the fields in dimension text (will be done when loading, if required)
1503 Text.Parse( cNode, aContext, false );
1504 textParsed = true;
1505 }
1506 else if( cNodeName == wxT( "FIX" ) )
1507 {
1508 Fixed = true;
1509 }
1510 else if( cNodeName == wxT( "GROUPREF" ) )
1511 {
1512 GroupID = GetXmlAttributeIDString( cNode, 0 );
1513 }
1514 else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
1515 {
1516 ReuseBlockRef.Parse( cNode, aContext );
1517 }
1518 else
1519 {
1520 THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
1521 }
1522 }
1523}
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
#define THROW_UNKNOWN_PARAMETER_IO_ERROR(param, location)
static UNITS ParseUnits(XNODE *aNode)
static ANGUNITS ParseAngunits(XNODE *aNode)
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
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
LAYER_ID LayerID
ID on which to draw this [param1].
@ DIRECT
A linear dimension parallel to measurement with perpendicular extension lines token=DIMENSION_DIRECT.
@ ORTHOGONAL
An orthogonal dimension (either x or y measurement) token=DIMENSION_ORTHOGONAL.
@ ANGLED
A linear dimension parallel to measurement but with orthogonal extension lines (i....
GROUP_ID GroupID
If not empty, this DIMENSION is part of a group.
EXTENSION_LINE ExtensionLineParams
Not applicable to TYPE=LEADERDIM.
DIMENSION_ID ID
Some ID (doesn't seem to be used) subnode="DIMREF".
@ LEADERDIM
Typically used for Radius/Diameter Dimension.
long Precision
Number of decimal points to display in the measurement [param3].
ANGUNITS AngularUnits
Only Applicable to TYPE=ANGLEDIM.

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

Referenced by CADSTAR_PCB_ARCHIVE_PARSER::SYMDEF_PCB::Parse(), and CADSTAR_PCB_ARCHIVE_PARSER::LAYOUT::Parse().

Member Data Documentation

◆ AngularUnits

ANGUNITS CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::AngularUnits

Only Applicable to TYPE=ANGLEDIM.

Definition at line 701 of file cadstar_pcb_archive_parser.h.

◆ Arrow

ARROW CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Arrow

Definition at line 702 of file cadstar_pcb_archive_parser.h.

◆ ExtensionLineParams

EXTENSION_LINE CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::ExtensionLineParams

Not applicable to TYPE=LEADERDIM.

Definition at line 704 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings(), and CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions().

◆ Fixed

bool CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Fixed = false

Definition at line 707 of file cadstar_pcb_archive_parser.h.

◆ GroupID

GROUP_ID CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::GroupID = wxEmptyString

If not empty, this DIMENSION is part of a group.

Definition at line 708 of file cadstar_pcb_archive_parser.h.

◆ ID

◆ LayerID

LAYER_ID CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LayerID

ID on which to draw this [param1].

Definition at line 696 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings().

◆ Line

LINE CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Line

◆ LinearUnits

UNITS CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LinearUnits

◆ Precision

long CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Precision

Number of decimal points to display in the measurement [param3].

Definition at line 698 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings().

◆ ReuseBlockRef

REUSEBLOCKREF CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::ReuseBlockRef

Definition at line 710 of file cadstar_pcb_archive_parser.h.

◆ Subtype

SUBTYPE CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Subtype

[param2]

Definition at line 697 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions().

◆ Text

TEXT CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Text

◆ TextParams

TEXTFORMAT CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::TextParams

Definition at line 703 of file cadstar_pcb_archive_parser.h.

◆ Type

TYPE CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Type

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