KiCad PCB EDA Suite
CADSTAR_ARCHIVE_PARSER::TEXT_LOCATION Struct Reference

Corresponds to CADSTAR "origin". More...

#include <cadstar_archive_parser.h>

Inheritance diagram for CADSTAR_ARCHIVE_PARSER::TEXT_LOCATION:
CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION CADSTAR_ARCHIVE_PARSER::PARSER

Public Member Functions

 TEXT_LOCATION ()
 
void Parse (XNODE *aNode, PARSER_CONTEXT *aContext) override
 
void ParseIdentifiers (XNODE *aNode, PARSER_CONTEXT *aContext)
 
bool ParseSubNode (XNODE *aChildNode, PARSER_CONTEXT *aContext)
 

Public Attributes

ATTRIBUTE_ID AttributeID
 
TEXTCODE_ID TextCodeID
 
LAYER_ID LayerID
 
POINT Position
 
long OrientAngle = 0
 
bool Mirror = false
 
bool Fixed = false
 
JUSTIFICATION Justification
 Note: Justification has no effect on single lines of text. More...
 
ALIGNMENT Alignment
 In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left of the first line. More...
 

Detailed Description

Corresponds to CADSTAR "origin".

This is used for setting a location of an attribute e.g. Designator (called Component Name in CADSTAR), Part Name (name of component in the library), etc. The atom identifier is "TEXTLOC"

Definition at line 742 of file cadstar_archive_parser.h.

Constructor & Destructor Documentation

◆ TEXT_LOCATION()

CADSTAR_ARCHIVE_PARSER::TEXT_LOCATION::TEXT_LOCATION ( )
inline

Definition at line 744 of file cadstar_archive_parser.h.

745  {
746  // The default alignment for TEXT_LOCATION (when "NO_ALIGNMENT" is selected) is
747  // Bottom left, matching CADSTAR's default behaviour
749  }
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...

References CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::Alignment, and CADSTAR_ARCHIVE_PARSER::BOTTOMLEFT.

Member Function Documentation

◆ Parse()

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

Reimplemented from CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION.

Definition at line 1203 of file cadstar_archive_parser.cpp.

1204 {
1205  wxASSERT( aNode->GetName() == wxT( "TEXTLOC" ) );
1206 
1207  wxString attributeStr = GetXmlAttributeIDString( aNode, 0 );
1208  bool attributeIDisSet = false;
1209 
1210  if( attributeStr == wxT( "PART_NAME" ) )
1211  {
1213  attributeIDisSet = true;
1214  }
1215  else if( attributeStr == wxT( "COMP_NAME" ) )
1216  {
1218  attributeIDisSet = true;
1219  }
1220  else if( attributeStr == wxT( "COMP_NAME2" ) )
1221  {
1223  attributeIDisSet = true;
1224  }
1225  else if( attributeStr == wxT( "SYMBOL_NAME" ) )
1226  {
1228  attributeIDisSet = true;
1229  }
1230  else if( attributeStr == wxT( "LINK_ORIGIN" ) )
1231  {
1233  attributeIDisSet = true;
1234  }
1235  else if( attributeStr == wxT( "SIGNALNAME_ORIGIN" ) )
1236  {
1238  attributeIDisSet = true;
1239  }
1240  else if( attributeStr == wxT( "ATTRREF" ) )
1241  {
1242  //We will initialise when we parse all child nodes
1243  attributeIDisSet = false;
1244  }
1245  else
1246  {
1247  THROW_UNKNOWN_PARAMETER_IO_ERROR( attributeStr, wxT( "TEXTLOC" ) );
1248  }
1249 
1250  TextCodeID = GetXmlAttributeIDString( aNode, 1 );
1251  LayerID = GetXmlAttributeIDString( aNode, 2, false );
1252 
1253  //Parse child nodes
1254  XNODE* cNode = aNode->GetChildren();
1255 
1256  for( ; cNode; cNode = cNode->GetNext() )
1257  {
1258  wxString cNodeName = cNode->GetName();
1259 
1260  if( ParseSubNode( cNode, aContext ) )
1261  {
1262  continue;
1263  }
1264  else if( !attributeIDisSet && cNodeName == wxT( "ATTRREF" ) )
1265  {
1266  AttributeID = GetXmlAttributeIDString( cNode, 0 );
1267  attributeIDisSet = true;
1268  }
1269  else if( cNodeName == wxT( "ORIENT" ) )
1270  {
1271  OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
1272  }
1273  else if( cNodeName == wxT( "MIRROR" ) )
1274  {
1275  Mirror = true;
1276  }
1277  else if( cNodeName == wxT( "FIX" ) )
1278  {
1279  Fixed = true;
1280  }
1281  else if( cNodeName == wxT( "ALIGN" ) )
1282  {
1283  Alignment = ParseAlignment( cNode );
1284  }
1285  else if( cNodeName == wxT( "JUSTIFICATION" ) )
1286  {
1287  Justification = ParseJustification( cNode );
1288  }
1289  else
1290  {
1291  THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "TEXTLOC" ) );
1292  }
1293  }
1294 
1295  if( !Position.IsFullySpecified() )
1296  THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), wxT( "TEXTLOC" ) );
1297 }
#define SIGNALNAME_ORIGIN_ATTRID
static JUSTIFICATION ParseJustification(XNODE *aNode)
#define COMPONENT_NAME_2_ATTRID
Component Name 2 Attribute ID - typically used for indicating the placement of designators in placeme...
#define SYMBOL_NAME_ATTRID
Symbol Name attribute ID - used for placement of designators on the schematic.
#define COMPONENT_NAME_ATTRID
Component Name Attribute ID - typically used for placement of designators on silk screen.
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...
XNODE * GetChildren() const
Definition: xnode.h:62
#define THROW_MISSING_NODE_IO_ERROR(nodename, location)
#define PART_NAME_ATTRID
static long GetXmlAttributeIDLong(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
Hold an XML or S-expression element.
Definition: xnode.h:43
XNODE * GetNext() const
Definition: xnode.h:67
#define LINK_ORIGIN_ATTRID
bool ParseSubNode(XNODE *aChildNode, PARSER_CONTEXT *aContext)
JUSTIFICATION Justification
Note: Justification has no effect on single lines of text.
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
static ALIGNMENT ParseAlignment(XNODE *aNode)
#define THROW_UNKNOWN_PARAMETER_IO_ERROR(param, location)

References COMPONENT_NAME_2_ATTRID, COMPONENT_NAME_ATTRID, XNODE::GetChildren(), XNODE::GetNext(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDLong(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), LINK_ORIGIN_ATTRID, CADSTAR_ARCHIVE_PARSER::ParseAlignment(), CADSTAR_ARCHIVE_PARSER::ParseJustification(), PART_NAME_ATTRID, SIGNALNAME_ORIGIN_ATTRID, SYMBOL_NAME_ATTRID, THROW_MISSING_NODE_IO_ERROR, THROW_UNKNOWN_NODE_IO_ERROR, and THROW_UNKNOWN_PARAMETER_IO_ERROR.

Referenced by CADSTAR_ARCHIVE_PARSER::SYMDEF::ParseSubNode().

◆ ParseIdentifiers()

void CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::ParseIdentifiers ( XNODE aNode,
PARSER_CONTEXT aContext 
)
inherited

Definition at line 999 of file cadstar_archive_parser.cpp.

1000 {
1001  TextCodeID = GetXmlAttributeIDString( aNode, 0 );
1002  LayerID = GetXmlAttributeIDString( aNode, 1 );
1003 }
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)

References CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString().

◆ ParseSubNode()

bool CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::ParseSubNode ( XNODE aChildNode,
PARSER_CONTEXT aContext 
)
inherited

Definition at line 1006 of file cadstar_archive_parser.cpp.

1007 {
1008  wxString cNodeName = aChildNode->GetName();
1009 
1010  if( cNodeName == wxT( "PT" ) )
1011  Position.Parse( aChildNode, aContext );
1012  else if( cNodeName == wxT( "ORIENT" ) )
1013  OrientAngle = GetXmlAttributeIDLong( aChildNode, 0 );
1014  else if( cNodeName == wxT( "MIRROR" ) )
1015  Mirror = true;
1016  else if( cNodeName == wxT( "FIX" ) )
1017  Fixed = true;
1018  else if( cNodeName == wxT( "ALIGN" ) )
1019  Alignment = ParseAlignment( aChildNode );
1020  else if( cNodeName == wxT( "JUSTIFICATION" ) )
1021  Justification = ParseJustification( aChildNode );
1022  else
1023  return false;
1024 
1025  return true;
1026 }
static JUSTIFICATION ParseJustification(XNODE *aNode)
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static long GetXmlAttributeIDLong(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
JUSTIFICATION Justification
Note: Justification has no effect on single lines of text.
static ALIGNMENT ParseAlignment(XNODE *aNode)

References CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDLong(), CADSTAR_ARCHIVE_PARSER::ParseAlignment(), and CADSTAR_ARCHIVE_PARSER::ParseJustification().

Member Data Documentation

◆ Alignment

ALIGNMENT CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::Alignment
inherited
Initial value:
= ALIGNMENT::
NO_ALIGNMENT

In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left of the first line.

Note that this is different from BOTTOM_LEFT (which is bottom left of the whole text block)

Definition at line 667 of file cadstar_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), CADSTAR_SCH_ARCHIVE_LOADER::applyToLibraryFieldAttribute(), CADSTAR_SCH_ARCHIVE_LOADER::loadBusses(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(), and TEXT_LOCATION().

◆ AttributeID

ATTRIBUTE_ID CADSTAR_ARCHIVE_PARSER::TEXT_LOCATION::AttributeID

◆ Fixed

bool CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::Fixed = false
inherited

Definition at line 664 of file cadstar_archive_parser.h.

◆ Justification

JUSTIFICATION CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::Justification
inherited

◆ LayerID

LAYER_ID CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::LayerID
inherited

Definition at line 660 of file cadstar_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute().

◆ Mirror

◆ OrientAngle

◆ Position

◆ TextCodeID


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