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

Constructor & Destructor Documentation

◆ TEXT_LOCATION()

CADSTAR_ARCHIVE_PARSER::TEXT_LOCATION::TEXT_LOCATION ( )
inline

Definition at line 788 of file cadstar_archive_parser.h.

789 {
790 // The default alignment for TEXT_LOCATION (when "NO_ALIGNMENT" is selected) is
791 // Bottom left, matching CADSTAR's default behaviour
793 }
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 1316 of file cadstar_archive_parser.cpp.

1317{
1318 wxASSERT( aNode->GetName() == wxT( "TEXTLOC" ) );
1319
1320 wxString attributeStr = GetXmlAttributeIDString( aNode, 0 );
1321 bool attributeIDisSet = false;
1322
1323 if( attributeStr == wxT( "PART_NAME" ) )
1324 {
1326 attributeIDisSet = true;
1327 }
1328 else if( attributeStr == wxT( "COMP_NAME" ) )
1329 {
1331 attributeIDisSet = true;
1332 }
1333 else if( attributeStr == wxT( "COMP_NAME2" ) )
1334 {
1336 attributeIDisSet = true;
1337 }
1338 else if( attributeStr == wxT( "SYMBOL_NAME" ) )
1339 {
1341 attributeIDisSet = true;
1342 }
1343 else if( attributeStr == wxT( "LINK_ORIGIN" ) )
1344 {
1346 attributeIDisSet = true;
1347 }
1348 else if( attributeStr == wxT( "SIGNALNAME_ORIGIN" ) )
1349 {
1351 attributeIDisSet = true;
1352 }
1353 else if( attributeStr == wxT( "ATTRREF" ) )
1354 {
1355 //We will initialise when we parse all child nodes
1356 attributeIDisSet = false;
1357 }
1358 else
1359 {
1360 THROW_UNKNOWN_PARAMETER_IO_ERROR( attributeStr, wxT( "TEXTLOC" ) );
1361 }
1362
1363 TextCodeID = GetXmlAttributeIDString( aNode, 1 );
1364 LayerID = GetXmlAttributeIDString( aNode, 2, false );
1365
1366 //Parse child nodes
1367 XNODE* cNode = aNode->GetChildren();
1368
1369 for( ; cNode; cNode = cNode->GetNext() )
1370 {
1371 wxString cNodeName = cNode->GetName();
1372
1373 if( ParseSubNode( cNode, aContext ) )
1374 {
1375 continue;
1376 }
1377 else if( !attributeIDisSet && cNodeName == wxT( "ATTRREF" ) )
1378 {
1380 attributeIDisSet = true;
1381 }
1382 else if( cNodeName == wxT( "ORIENT" ) )
1383 {
1384 OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
1385 }
1386 else if( cNodeName == wxT( "MIRROR" ) )
1387 {
1388 Mirror = true;
1389 }
1390 else if( cNodeName == wxT( "FIX" ) )
1391 {
1392 Fixed = true;
1393 }
1394 else if( cNodeName == wxT( "ALIGN" ) )
1395 {
1396 Alignment = ParseAlignment( cNode );
1397 }
1398 else if( cNodeName == wxT( "JUSTIFICATION" ) )
1399 {
1401 }
1402 else
1403 {
1404 THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "TEXTLOC" ) );
1405 }
1406 }
1407
1409 THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), wxT( "TEXTLOC" ) );
1410}
#define SYMBOL_NAME_ATTRID
Symbol Name attribute ID - used for placement of designators on the schematic.
#define SIGNALNAME_ORIGIN_ATTRID
#define THROW_MISSING_NODE_IO_ERROR(nodename, location)
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
#define LINK_ORIGIN_ATTRID
#define COMPONENT_NAME_2_ATTRID
Component Name 2 Attribute ID - typically used for indicating the placement of designators in placeme...
#define THROW_UNKNOWN_PARAMETER_IO_ERROR(param, location)
#define COMPONENT_NAME_ATTRID
Component Name Attribute ID - typically used for placement of designators on silk screen.
#define PART_NAME_ATTRID
static ALIGNMENT ParseAlignment(XNODE *aNode)
static const long UNDEFINED_VALUE
static JUSTIFICATION ParseJustification(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
JUSTIFICATION Justification
Note: Justification has no effect on single lines of text.
bool ParseSubNode(XNODE *aChildNode, PARSER_CONTEXT *aContext)

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, THROW_UNKNOWN_PARAMETER_IO_ERROR, and CADSTAR_ARCHIVE_PARSER::UNDEFINED_VALUE.

Referenced by CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Parse(), and CADSTAR_ARCHIVE_PARSER::SYMDEF::ParseSubNode().

◆ ParseIdentifiers()

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

Definition at line 1110 of file cadstar_archive_parser.cpp.

1112{
1113 TextCodeID = GetXmlAttributeIDString( aNode, 0 );
1114 LayerID = GetXmlAttributeIDString( aNode, 1 );
1115}

References CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString().

◆ ParseSubNode()

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

Definition at line 1118 of file cadstar_archive_parser.cpp.

1120{
1121 wxString cNodeName = aChildNode->GetName();
1122
1123 if( cNodeName == wxT( "PT" ) )
1124 Position.Parse( aChildNode, aContext );
1125 else if( cNodeName == wxT( "ORIENT" ) )
1126 OrientAngle = GetXmlAttributeIDLong( aChildNode, 0 );
1127 else if( cNodeName == wxT( "MIRROR" ) )
1128 Mirror = true;
1129 else if( cNodeName == wxT( "FIX" ) )
1130 Fixed = true;
1131 else if( cNodeName == wxT( "ALIGN" ) )
1132 Alignment = ParseAlignment( aChildNode );
1133 else if( cNodeName == wxT( "JUSTIFICATION" ) )
1134 Justification = ParseJustification( aChildNode );
1135 else
1136 return false;
1137
1138 return true;
1139}
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override

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 711 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

◆ Fixed

bool CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::Fixed = false
inherited

Definition at line 708 of file cadstar_archive_parser.h.

◆ Justification

◆ LayerID

LAYER_ID CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION::LayerID
inherited

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