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

Constructor & Destructor Documentation

◆ TEXT_LOCATION()

CADSTAR_ARCHIVE_PARSER::TEXT_LOCATION::TEXT_LOCATION ( )
inline

Definition at line 756 of file cadstar_archive_parser.h.

757  {
758  // The default alignment for TEXT_LOCATION (when "NO_ALIGNMENT" is selected) is
759  // Bottom left, matching CADSTAR's default behaviour
761  }
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 1211 of file cadstar_archive_parser.cpp.

1212 {
1213  wxASSERT( aNode->GetName() == wxT( "TEXTLOC" ) );
1214 
1215  wxString attributeStr = GetXmlAttributeIDString( aNode, 0 );
1216  bool attributeIDisSet = false;
1217 
1218  if( attributeStr == wxT( "PART_NAME" ) )
1219  {
1221  attributeIDisSet = true;
1222  }
1223  else if( attributeStr == wxT( "COMP_NAME" ) )
1224  {
1226  attributeIDisSet = true;
1227  }
1228  else if( attributeStr == wxT( "COMP_NAME2" ) )
1229  {
1231  attributeIDisSet = true;
1232  }
1233  else if( attributeStr == wxT( "SYMBOL_NAME" ) )
1234  {
1236  attributeIDisSet = true;
1237  }
1238  else if( attributeStr == wxT( "LINK_ORIGIN" ) )
1239  {
1241  attributeIDisSet = true;
1242  }
1243  else if( attributeStr == wxT( "SIGNALNAME_ORIGIN" ) )
1244  {
1246  attributeIDisSet = true;
1247  }
1248  else if( attributeStr == wxT( "ATTRREF" ) )
1249  {
1250  //We will initialise when we parse all child nodes
1251  attributeIDisSet = false;
1252  }
1253  else
1254  {
1255  THROW_UNKNOWN_PARAMETER_IO_ERROR( attributeStr, wxT( "TEXTLOC" ) );
1256  }
1257 
1258  TextCodeID = GetXmlAttributeIDString( aNode, 1 );
1259  LayerID = GetXmlAttributeIDString( aNode, 2, false );
1260 
1261  //Parse child nodes
1262  XNODE* cNode = aNode->GetChildren();
1263 
1264  for( ; cNode; cNode = cNode->GetNext() )
1265  {
1266  wxString cNodeName = cNode->GetName();
1267 
1268  if( ParseSubNode( cNode, aContext ) )
1269  {
1270  continue;
1271  }
1272  else if( !attributeIDisSet && cNodeName == wxT( "ATTRREF" ) )
1273  {
1274  AttributeID = GetXmlAttributeIDString( cNode, 0 );
1275  attributeIDisSet = true;
1276  }
1277  else if( cNodeName == wxT( "ORIENT" ) )
1278  {
1279  OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
1280  }
1281  else if( cNodeName == wxT( "MIRROR" ) )
1282  {
1283  Mirror = true;
1284  }
1285  else if( cNodeName == wxT( "FIX" ) )
1286  {
1287  Fixed = true;
1288  }
1289  else if( cNodeName == wxT( "ALIGN" ) )
1290  {
1291  Alignment = ParseAlignment( cNode );
1292  }
1293  else if( cNodeName == wxT( "JUSTIFICATION" ) )
1294  {
1295  Justification = ParseJustification( cNode );
1296  }
1297  else
1298  {
1299  THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "TEXTLOC" ) );
1300  }
1301  }
1302 
1303  if( !Position.IsFullySpecified() )
1304  THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), wxT( "TEXTLOC" ) );
1305 }
#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 1005 of file cadstar_archive_parser.cpp.

1007 {
1008  TextCodeID = GetXmlAttributeIDString( aNode, 0 );
1009  LayerID = GetXmlAttributeIDString( aNode, 1 );
1010 }
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 1013 of file cadstar_archive_parser.cpp.

1015 {
1016  wxString cNodeName = aChildNode->GetName();
1017 
1018  if( cNodeName == wxT( "PT" ) )
1019  Position.Parse( aChildNode, aContext );
1020  else if( cNodeName == wxT( "ORIENT" ) )
1021  OrientAngle = GetXmlAttributeIDLong( aChildNode, 0 );
1022  else if( cNodeName == wxT( "MIRROR" ) )
1023  Mirror = true;
1024  else if( cNodeName == wxT( "FIX" ) )
1025  Fixed = true;
1026  else if( cNodeName == wxT( "ALIGN" ) )
1027  Alignment = ParseAlignment( aChildNode );
1028  else if( cNodeName == wxT( "JUSTIFICATION" ) )
1029  Justification = ParseJustification( aChildNode );
1030  else
1031  return false;
1032 
1033  return true;
1034 }
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 679 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::loadSchematicSymbolInstances(), 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 676 of file cadstar_archive_parser.h.

◆ Justification

◆ LayerID

LAYER_ID CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::LayerID
inherited

Definition at line 672 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: