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  TYPE { TYPE::LINEARDIM, TYPE::LEADERDIM, TYPE::ANGLEDIM }
 
enum  SUBTYPE {
  SUBTYPE::ORTHOGONAL, SUBTYPE::DIRECT, SUBTYPE::ANGLED, SUBTYPE::DIAMETER,
  SUBTYPE::RADIUS, SUBTYPE::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,
571  DIRECT,
573  ANGLED,
575  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 1382 of file cadstar_pcb_archive_parser.cpp.

1383 {
1384  if( aNode->GetName() == wxT( "LINEARDIM" ) || aNode->GetName() == wxT( "LEADERDIM" )
1385  || aNode->GetName() == wxT( "ANGLEDIM" ) )
1386  {
1387  return true;
1388  }
1389  else
1390  {
1391  return false;
1392  }
1393 }

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

1397 {
1398  wxASSERT( IsDimension( aNode ) );
1399 
1400  std::map<wxString, TYPE> typeMap = { { wxT( "LINEARDIM" ), TYPE::LINEARDIM },
1401  { wxT( "LEADERDIM" ), TYPE::LEADERDIM }, { wxT( "ANGLEDIM" ), TYPE::ANGLEDIM } };
1402 
1403  //make sure aNode is valid TYPE
1404  wxASSERT_MSG( typeMap.find( aNode->GetName() ) != typeMap.end(),
1405  "Not a valid type. What happened to the node Name?" );
1406 
1407  Type = typeMap[aNode->GetName()];
1408  LayerID = GetXmlAttributeIDString( aNode, 1 );
1409  wxString subTypeStr = GetXmlAttributeIDString( aNode, 2 );
1410 
1411  std::map<wxString, SUBTYPE> subTypeMap = {
1412  { wxT( "DIMENSION_ORTHOGONAL" ), SUBTYPE::ORTHOGONAL },
1413  { wxT( "DIMENSION_DIRECT" ), SUBTYPE::DIRECT },
1414  { wxT( "DIMENSION_ANGLED" ), SUBTYPE::ANGLED },
1415  { wxT( "DIMENSION_DIAMETER" ), SUBTYPE::DIAMETER },
1416  { wxT( "DIMENSION_RADIUS" ), SUBTYPE::RADIUS },
1417  { wxT( "DIMENSION_ANGULAR" ), SUBTYPE::ANGULAR } };
1418 
1419  if( subTypeMap.find( subTypeStr ) == subTypeMap.end() )
1420  THROW_UNKNOWN_PARAMETER_IO_ERROR( subTypeStr, aNode->GetName() );
1421 
1422  Subtype = subTypeMap[subTypeStr];
1423  Precision = GetXmlAttributeIDLong( aNode, 3 );
1424 
1425  XNODE* cNode = aNode->GetChildren();
1426 
1427  bool idParsed = false;
1428  bool unitsParsed = false; //UNITS or ANGUNITS
1429  bool arrowParsed = false;
1430  bool textFormatParsed = false;
1431  bool extLineParsed = false;
1432  bool lineParsed = false;
1433  bool textParsed = false;
1434 
1435  for( ; cNode; cNode = cNode->GetNext() )
1436  {
1437  wxString cNodeName = cNode->GetName();
1438 
1439  if( !idParsed && cNodeName == wxT( "DIMREF" ) )
1440  {
1441  ID = GetXmlAttributeIDString( cNode, 0 );
1442  idParsed = true;
1443  }
1444  else if( !unitsParsed && cNodeName == wxT( "UNITS" ) )
1445  {
1446  LinearUnits = ParseUnits( cNode );
1447  unitsParsed = true;
1448  }
1449  else if( !unitsParsed && cNodeName == wxT( "ANGUNITS" ) )
1450  {
1451  AngularUnits = ParseAngunits( cNode );
1452  unitsParsed = true;
1453  }
1454  else if( !arrowParsed && cNodeName == wxT( "DIMARROW" ) )
1455  {
1456  Arrow.Parse( cNode, aContext );
1457  arrowParsed = true;
1458  }
1459  else if( !textFormatParsed && cNodeName == wxT( "DIMTEXT" ) )
1460  {
1461  TextParams.Parse( cNode, aContext );
1462  textFormatParsed = true;
1463  }
1464  else if( !extLineParsed && cNodeName == wxT( "EXTLINE" ) )
1465  {
1466  ExtensionLineParams.Parse( cNode, aContext );
1467  extLineParsed = true;
1468  }
1469  else if( !lineParsed && LINE::IsLine( cNode ) )
1470  {
1471  Line.Parse( cNode, aContext );
1472  lineParsed = true;
1473  }
1474  else if( !textParsed && cNodeName == wxT( "TEXT" ) )
1475  {
1476  // Do not parse the fields in dimension text (will be done when loading, if required)
1477  Text.Parse( cNode, aContext, false );
1478  textParsed = true;
1479  }
1480  else if( cNodeName == wxT( "FIX" ) )
1481  {
1482  Fixed = true;
1483  }
1484  else if( cNodeName == wxT( "GROUPREF" ) )
1485  {
1486  GroupID = GetXmlAttributeIDString( cNode, 0 );
1487  }
1488  else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
1489  {
1490  ReuseBlockRef.Parse( cNode, aContext );
1491  }
1492  else
1493  {
1494  THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
1495  }
1496  }
1497 }
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static ANGUNITS ParseAngunits(XNODE *aNode)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
EXTENSION_LINE ExtensionLineParams
Not applicable to TYPE=LEADERDIM.
Typically used for Radius/Diameter Dimension.
ANGUNITS AngularUnits
Only Applicable to TYPE=ANGLEDIM.
LAYER_ID LayerID
ID on which to draw this [param1].
XNODE * GetChildren() const
Definition: xnode.h:62
A linear dimension parallel to measurement but with orthogonal extension lines (i....
DIMENSION_ID ID
Some ID (doesn't seem to be used) subnode="DIMREF".
long Precision
Number of decimal points to display in the measurement [param3].
An orthogonal dimension (either x or y measurement) token=DIMENSION_ORTHOGONAL.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static long GetXmlAttributeIDLong(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
Hold an XML or S-expression element.
Definition: xnode.h:43
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
XNODE * GetNext() const
Definition: xnode.h:67
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
A linear dimension parallel to measurement with perpendicular extension lines token=DIMENSION_DIRECT.
static UNITS ParseUnits(XNODE *aNode)
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
#define THROW_UNKNOWN_PARAMETER_IO_ERROR(param, location)
GROUP_ID GroupID
If not empty, this DIMENSION is part of a group.

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: