KiCad PCB EDA Suite
PCAD2KICAD::PCB_TEXT Class Reference

#include <pcb_text.h>

Inheritance diagram for PCAD2KICAD::PCB_TEXT:
PCAD2KICAD::PCB_COMPONENT

Public Member Functions

 PCB_TEXT (PCB_CALLBACKS *aCallbacks, BOARD *aBoard)
 
 ~PCB_TEXT ()
 
virtual void Parse (XNODE *aNode, int aLayer, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
 
void AddToModule (MODULE *aModule) override
 
void AddToBoard () override
 
virtual void SetPosOffset (int aX_offs, int aY_offs)
 
virtual void Flip ()
 
PCB_LAYER_ID GetKiCadLayer ()
 
int GetNetCode (wxString aNetName)
 

Public Attributes

int m_tag
 
char m_objType
 
int m_PCadLayer
 
PCB_LAYER_ID m_KiCadLayer
 
KIID m_uuid
 
int m_positionX
 
int m_positionY
 
int m_rotation
 
TTEXTVALUE m_name
 
wxString m_net
 
int m_netCode
 
wxString m_compRef
 
wxString m_patGraphRefName
 

Protected Attributes

PCB_CALLBACKSm_callbacks
 
BOARDm_board
 

Detailed Description

Definition at line 40 of file pcb_text.h.

Constructor & Destructor Documentation

◆ PCB_TEXT()

PCAD2KICAD::PCB_TEXT::PCB_TEXT ( PCB_CALLBACKS aCallbacks,
BOARD aBoard 
)

Definition at line 38 of file pcb_text.cpp.

38  : PCB_COMPONENT( aCallbacks,
39  aBoard )
40 {
41  m_objType = wxT( 'T' );
42 }
PCB_COMPONENT(PCB_CALLBACKS *aCallbacks, BOARD *aBoard)

References PCAD2KICAD::PCB_COMPONENT::m_objType.

◆ ~PCB_TEXT()

PCAD2KICAD::PCB_TEXT::~PCB_TEXT ( )

Definition at line 45 of file pcb_text.cpp.

46 {
47 }

Member Function Documentation

◆ AddToBoard()

void PCAD2KICAD::PCB_TEXT::AddToBoard ( )
overridevirtual

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 101 of file pcb_text.cpp.

102 {
106 
107  TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board );
108  m_board->Add( pcbtxt, ADD_MODE::APPEND );
109 
110  pcbtxt->SetText( m_name.text );
111 
112  if( m_name.isTrueType )
114  else
116 
117  pcbtxt->SetItalic( m_name.isItalic );
119 
120  SetTextJustify( pcbtxt, m_name.justify );
122  m_name.textPositionY ) );
123 
124  pcbtxt->SetMirrored( m_name.mirror );
125 
126  if( pcbtxt->IsMirrored() )
127  pcbtxt->SetTextAngle( 3600.0 - m_name.textRotation );
128  else
129  pcbtxt->SetTextAngle( m_name.textRotation );
130 
131  pcbtxt->SetLayer( m_KiCadLayer );
132 }
void SetMirrored(bool isMirrored)
Definition: eda_text.h:172
void SetTextAngle(double aAngle)
bool IsMirrored() const
Definition: eda_text.h:173
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void SetItalic(bool isItalic)
Definition: eda_text.h:163
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:231
void SetTextSizeFromTrueTypeFontHeight(EDA_TEXT *aText, int aTextHeight)
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:111
void SetTextJustify(EDA_TEXT *aText, TTEXT_JUSTIFY aJustify)
void SetTextSizeFromStrokeFontHeight(EDA_TEXT *aText, int aTextHeight)
void SetThickness(int aNewThickness)
Set the pen width.
Definition: eda_text.h:143

References BOARD::Add(), APPEND, PCAD2KICAD::_TTEXTVALUE::isItalic, EDA_TEXT::IsMirrored(), PCAD2KICAD::_TTEXTVALUE::isTrueType, PCAD2KICAD::_TTEXTVALUE::justify, PCAD2KICAD::PCB_COMPONENT::m_board, PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, PCAD2KICAD::PCB_COMPONENT::m_name, PCAD2KICAD::PCB_COMPONENT::m_positionX, PCAD2KICAD::PCB_COMPONENT::m_positionY, PCAD2KICAD::PCB_COMPONENT::m_rotation, PCAD2KICAD::_TTEXTVALUE::mirror, EDA_TEXT::SetItalic(), BOARD_ITEM::SetLayer(), EDA_TEXT::SetMirrored(), EDA_TEXT::SetText(), TEXTE_PCB::SetTextAngle(), PCAD2KICAD::SetTextJustify(), EDA_TEXT::SetTextPos(), PCAD2KICAD::SetTextSizeFromStrokeFontHeight(), PCAD2KICAD::SetTextSizeFromTrueTypeFontHeight(), EDA_TEXT::SetThickness(), PCAD2KICAD::_TTEXTVALUE::text, PCAD2KICAD::_TTEXTVALUE::textHeight, PCAD2KICAD::_TTEXTVALUE::textPositionX, PCAD2KICAD::_TTEXTVALUE::textPositionY, PCAD2KICAD::_TTEXTVALUE::textRotation, and PCAD2KICAD::_TTEXTVALUE::textstrokeWidth.

◆ AddToModule()

void PCAD2KICAD::PCB_TEXT::AddToModule ( MODULE aModule)
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 96 of file pcb_text.cpp.

97 {
98 }

◆ Flip()

◆ GetKiCadLayer()

◆ GetNetCode()

◆ Parse()

void PCAD2KICAD::PCB_TEXT::Parse ( XNODE aNode,
int  aLayer,
const wxString &  aDefaultMeasurementUnit,
const wxString &  aActualConversion 
)
virtual

Definition at line 50 of file pcb_text.cpp.

54 {
55  XNODE* lNode;
56  wxString str;
57 
58  m_PCadLayer = aLayer;
60  m_positionX = 0;
61  m_positionY = 0;
62  m_name.mirror = 0; // Normal, not mirrored
63  lNode = FindNode( aNode, wxT( "pt" ) );
64 
65  if( lNode )
66  SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
67  &m_positionX, &m_positionY, aActualConversion );
68 
69  lNode = FindNode( aNode, wxT( "rotation" ) );
70 
71  if( lNode )
72  {
73  str = lNode->GetNodeContent();
74  str.Trim( false );
75  m_rotation = StrToInt1Units( str );
76  }
77 
78  aNode->GetAttribute( wxT( "Name" ), &m_name.text );
79  m_name.text.Replace( "\r", "" );
80 
81  str = FindNodeGetContent( aNode, wxT( "justify" ) );
83 
84  str = FindNodeGetContent( aNode, wxT( "isFlipped" ) );
85 
86  if( str == wxT( "True" ) )
87  m_name.mirror = 1;
88 
89  lNode = FindNode( aNode, wxT( "textStyleRef" ) );
90 
91  if( lNode )
92  SetFontProperty( lNode, &m_name, aDefaultMeasurementUnit, aActualConversion );
93 }
void SetFontProperty(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
void SetPosition(wxString aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)
PCB_LAYER_ID GetKiCadLayer()
Definition: pcb_component.h:73
wxString FindNodeGetContent(XNODE *aChild, const wxString &aTag)
XNODE holds an XML or S-expression element.
Definition: xnode.h:43
TTEXT_JUSTIFY GetJustifyIdentificator(const wxString &aJustify)
XNODE * FindNode(XNODE *aChild, const wxString &aTag)
int StrToInt1Units(const wxString &aStr)

References PCAD2KICAD::FindNode(), PCAD2KICAD::FindNodeGetContent(), PCAD2KICAD::GetJustifyIdentificator(), PCAD2KICAD::PCB_COMPONENT::GetKiCadLayer(), PCAD2KICAD::_TTEXTVALUE::justify, PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, PCAD2KICAD::PCB_COMPONENT::m_name, PCAD2KICAD::PCB_COMPONENT::m_PCadLayer, PCAD2KICAD::PCB_COMPONENT::m_positionX, PCAD2KICAD::PCB_COMPONENT::m_positionY, PCAD2KICAD::PCB_COMPONENT::m_rotation, PCAD2KICAD::_TTEXTVALUE::mirror, PCAD2KICAD::SetFontProperty(), PCAD2KICAD::SetPosition(), PCAD2KICAD::StrToInt1Units(), and PCAD2KICAD::_TTEXTVALUE::text.

Referenced by PCAD2KICAD::PCB_MODULE::DoLayerContentsObjects().

◆ SetPosOffset()

void PCAD2KICAD::PCB_COMPONENT::SetPosOffset ( int  aX_offs,
int  aY_offs 
)
virtualinherited

Member Data Documentation

◆ m_board

◆ m_callbacks

◆ m_compRef

wxString PCAD2KICAD::PCB_COMPONENT::m_compRef
inherited

◆ m_KiCadLayer

◆ m_name

◆ m_net

◆ m_netCode

◆ m_objType

◆ m_patGraphRefName

wxString PCAD2KICAD::PCB_COMPONENT::m_patGraphRefName
inherited

◆ m_PCadLayer

◆ m_positionX

◆ m_positionY

◆ m_rotation

◆ m_tag

int PCAD2KICAD::PCB_COMPONENT::m_tag
inherited

Definition at line 51 of file pcb_component.h.

Referenced by PCAD2KICAD::PCB_COMPONENT::PCB_COMPONENT().

◆ m_uuid

KIID PCAD2KICAD::PCB_COMPONENT::m_uuid
inherited

Definition at line 55 of file pcb_component.h.


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